@madarco/agentbox 0.18.0 → 0.19.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 +56 -0
- package/README.md +4 -3
- package/dist/{_cloud-attach-3UC3IL62.js → _cloud-attach-YM2KOWHO.js} +4 -4
- package/dist/{chunk-6QFPYU4Z.js → chunk-7K2A3NLE.js} +8 -5
- package/dist/chunk-7K2A3NLE.js.map +1 -0
- package/dist/{chunk-U7IZS2ZP.js → chunk-A5OFRJDI.js} +1313 -213
- package/dist/chunk-A5OFRJDI.js.map +1 -0
- package/dist/{chunk-5BO6SGMI.js → chunk-JK5V4OLT.js} +7 -7
- 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-SPUUOEW2.js} +273 -54
- package/dist/chunk-SPUUOEW2.js.map +1 -0
- package/dist/{chunk-XWBFWUY2.js → chunk-Y6PUCLOE.js} +2 -2
- package/dist/{dist-CFSKUAS5.js → dist-EKSNZHDY.js} +13 -3
- package/dist/{dist-7BS2JS27.js → dist-FTCDWRAL.js} +18 -7
- package/dist/dist-FTCDWRAL.js.map +1 -0
- package/dist/{dist-4BHW7DCO.js → dist-PRDYMXCX.js} +10 -5
- package/dist/dist-PRDYMXCX.js.map +1 -0
- package/dist/{dist-3UYQZOAO.js → dist-U2BHTWG4.js} +17 -5
- package/dist/dist-U2BHTWG4.js.map +1 -0
- package/dist/{dist-T7ESSBCZ.js → dist-VQSZVBT3.js} +20 -6
- package/dist/dist-VQSZVBT3.js.map +1 -0
- package/dist/index.js +471 -311
- package/dist/index.js.map +1 -1
- package/dist/{prepared-state-MQHD3M5F-OVABNV66.js → prepared-state-MQHD3M5F-5ZMCNY43.js} +2 -2
- package/package.json +5 -5
- package/runtime/docker/apps/cli/share/agentbox-setup/SKILL.md +1 -1
- package/runtime/docker/packages/ctl/dist/bin.cjs +133 -107
- package/runtime/docker/packages/sandbox-docker/scripts/agentbox-dockerd-start +13 -0
- package/runtime/e2b/agentbox-setup-skill.md +1 -1
- package/runtime/e2b/ctl.cjs +133 -107
- package/runtime/hetzner/agentbox-dockerd-start +13 -0
- package/runtime/hetzner/agentbox-setup-skill.md +1 -1
- package/runtime/hetzner/ctl.cjs +133 -107
- package/runtime/relay/bin.cjs +261 -63
- package/runtime/vercel/agentbox-dockerd-start +145 -0
- package/runtime/vercel/agentbox-setup-skill.md +1 -1
- package/runtime/vercel/ctl.cjs +133 -107
- 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 +2 -2
- package/share/host-skills/codex/agentbox.md +10 -2
- 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/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-YM2KOWHO.js.map} +0 -0
- /package/dist/{chunk-5BO6SGMI.js.map → chunk-JK5V4OLT.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/{chunk-XWBFWUY2.js.map → chunk-Y6PUCLOE.js.map} +0 -0
- /package/dist/{dist-CFSKUAS5.js.map → dist-EKSNZHDY.js.map} +0 -0
- /package/dist/{prepared-state-MQHD3M5F-OVABNV66.js.map → prepared-state-MQHD3M5F-5ZMCNY43.js.map} +0 -0
package/runtime/vercel/ctl.cjs
CHANGED
|
@@ -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);
|
|
@@ -11443,33 +11443,33 @@ function normalizeQuestion(raw) {
|
|
|
11443
11443
|
return out;
|
|
11444
11444
|
}
|
|
11445
11445
|
function readStdinJson() {
|
|
11446
|
-
return new Promise((
|
|
11446
|
+
return new Promise((resolve3) => {
|
|
11447
11447
|
if (process.stdin.isTTY) {
|
|
11448
|
-
|
|
11448
|
+
resolve3(null);
|
|
11449
11449
|
return;
|
|
11450
11450
|
}
|
|
11451
11451
|
const chunks = [];
|
|
11452
11452
|
const cap = setTimeout(() => {
|
|
11453
11453
|
process.stdin.removeAllListeners();
|
|
11454
|
-
|
|
11454
|
+
resolve3(null);
|
|
11455
11455
|
}, 1e3);
|
|
11456
11456
|
cap.unref();
|
|
11457
11457
|
process.stdin.on("data", (b) => chunks.push(b));
|
|
11458
11458
|
process.stdin.on("end", () => {
|
|
11459
11459
|
clearTimeout(cap);
|
|
11460
11460
|
if (chunks.length === 0) {
|
|
11461
|
-
|
|
11461
|
+
resolve3(null);
|
|
11462
11462
|
return;
|
|
11463
11463
|
}
|
|
11464
11464
|
try {
|
|
11465
|
-
|
|
11465
|
+
resolve3(JSON.parse(Buffer.concat(chunks).toString("utf8")));
|
|
11466
11466
|
} catch {
|
|
11467
|
-
|
|
11467
|
+
resolve3(null);
|
|
11468
11468
|
}
|
|
11469
11469
|
});
|
|
11470
11470
|
process.stdin.on("error", () => {
|
|
11471
11471
|
clearTimeout(cap);
|
|
11472
|
-
|
|
11472
|
+
resolve3(null);
|
|
11473
11473
|
});
|
|
11474
11474
|
});
|
|
11475
11475
|
}
|
|
@@ -11511,7 +11511,7 @@ function postRpc(method, params, opts = {}) {
|
|
|
11511
11511
|
const isHttps = url.protocol === "https:";
|
|
11512
11512
|
const transport = isHttps ? import_node_https.request : import_node_http.request;
|
|
11513
11513
|
const port = url.port.length > 0 ? Number.parseInt(url.port, 10) : isHttps ? 443 : 80;
|
|
11514
|
-
return new Promise((
|
|
11514
|
+
return new Promise((resolve3) => {
|
|
11515
11515
|
const req = transport(
|
|
11516
11516
|
{
|
|
11517
11517
|
host: url.hostname,
|
|
@@ -11539,14 +11539,14 @@ function postRpc(method, params, opts = {}) {
|
|
|
11539
11539
|
} catch {
|
|
11540
11540
|
parsed = null;
|
|
11541
11541
|
}
|
|
11542
|
-
|
|
11542
|
+
resolve3({ status: status2, parsed, raw: text, internalExitCode: null });
|
|
11543
11543
|
});
|
|
11544
11544
|
}
|
|
11545
11545
|
);
|
|
11546
11546
|
req.on("error", (err) => {
|
|
11547
11547
|
process.stderr.write(`${prefix}: ${String(err.message ?? err)}
|
|
11548
11548
|
`);
|
|
11549
|
-
|
|
11549
|
+
resolve3({ status: 0, parsed: null, raw: "", internalExitCode: 126 });
|
|
11550
11550
|
});
|
|
11551
11551
|
req.write(body);
|
|
11552
11552
|
req.end();
|
|
@@ -11580,14 +11580,14 @@ function buildCpParams(boxPath, hostPath, opts) {
|
|
|
11580
11580
|
return params;
|
|
11581
11581
|
}
|
|
11582
11582
|
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
|
|
11583
|
+
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
11584
|
const code = await postRpcAndExit("cp.toHost", buildCpParams(boxPath, hostPath, opts), {
|
|
11585
11585
|
errorPrefix: "agentbox-ctl cp"
|
|
11586
11586
|
});
|
|
11587
11587
|
process.exit(code);
|
|
11588
11588
|
})
|
|
11589
11589
|
).addCommand(
|
|
11590
|
-
new Command("fromHost").description("Copy host:<hostPath> -> box:<boxPath>").argument("<hostPath>", "source
|
|
11590
|
+
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
11591
|
const code = await postRpcAndExit("cp.fromHost", buildCpParams(boxPath, hostPath, opts), {
|
|
11592
11592
|
errorPrefix: "agentbox-ctl cp"
|
|
11593
11593
|
});
|
|
@@ -14010,8 +14010,8 @@ var disconnect = (anyProcess) => {
|
|
|
14010
14010
|
// ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/utils/deferred.js
|
|
14011
14011
|
var createDeferred = () => {
|
|
14012
14012
|
const methods = {};
|
|
14013
|
-
const promise = new Promise((
|
|
14014
|
-
Object.assign(methods, { resolve:
|
|
14013
|
+
const promise = new Promise((resolve3, reject) => {
|
|
14014
|
+
Object.assign(methods, { resolve: resolve3, reject });
|
|
14015
14015
|
});
|
|
14016
14016
|
return Object.assign(promise, methods);
|
|
14017
14017
|
};
|
|
@@ -18648,11 +18648,11 @@ var addConcurrentStream = (concurrentStreams, stream, waitName) => {
|
|
|
18648
18648
|
const promises = weakMap.get(stream);
|
|
18649
18649
|
const promise = createDeferred();
|
|
18650
18650
|
promises.push(promise);
|
|
18651
|
-
const
|
|
18652
|
-
return { resolve:
|
|
18651
|
+
const resolve3 = promise.resolve.bind(promise);
|
|
18652
|
+
return { resolve: resolve3, promises };
|
|
18653
18653
|
};
|
|
18654
|
-
var waitForConcurrentStreams = async ({ resolve:
|
|
18655
|
-
|
|
18654
|
+
var waitForConcurrentStreams = async ({ resolve: resolve3, promises }, subprocess) => {
|
|
18655
|
+
resolve3();
|
|
18656
18656
|
const [isSubprocessExit] = await Promise.race([
|
|
18657
18657
|
Promise.allSettled([true, subprocess]),
|
|
18658
18658
|
Promise.all([false, ...promises])
|
|
@@ -19254,8 +19254,11 @@ var PLACEHOLDER_KEYS = [
|
|
|
19254
19254
|
"AGENTBOX_BOX_KIND",
|
|
19255
19255
|
"AGENTBOX_HOST_WORKSPACE",
|
|
19256
19256
|
"AGENTBOX_PROJECT_ROOT",
|
|
19257
|
-
// Convenience: the
|
|
19258
|
-
//
|
|
19257
|
+
// Convenience: the host this box is reachable at. Derived from
|
|
19258
|
+
// AGENTBOX_BOX_NAME as `<box-name>.localhost` when not set explicitly (the
|
|
19259
|
+
// portless host for docker/hetzner). Public-URL cloud providers
|
|
19260
|
+
// (vercel/daytona/e2b) set it explicitly at boot to the real preview host
|
|
19261
|
+
// (e.g. `<sub>.vercel.run`), which then wins over the derived fallback.
|
|
19259
19262
|
"AGENTBOX_BOX_HOST"
|
|
19260
19263
|
];
|
|
19261
19264
|
var PLACEHOLDER_SET = new Set(PLACEHOLDER_KEYS);
|
|
@@ -19765,8 +19768,8 @@ var HostActionQueue = class {
|
|
|
19765
19768
|
params,
|
|
19766
19769
|
createdAt: new Date(this.now()).toISOString()
|
|
19767
19770
|
};
|
|
19768
|
-
return new Promise((
|
|
19769
|
-
this.map.set(id, { action, resolve:
|
|
19771
|
+
return new Promise((resolve22) => {
|
|
19772
|
+
this.map.set(id, { action, resolve: resolve22, delivered: false });
|
|
19770
19773
|
});
|
|
19771
19774
|
}
|
|
19772
19775
|
/**
|
|
@@ -19899,11 +19902,11 @@ var PendingPrompts = class {
|
|
|
19899
19902
|
return true;
|
|
19900
19903
|
}
|
|
19901
19904
|
add(boxId, ev) {
|
|
19902
|
-
return new Promise((
|
|
19905
|
+
return new Promise((resolve22) => {
|
|
19903
19906
|
this.entries.set(ev.id, {
|
|
19904
19907
|
ev,
|
|
19905
19908
|
boxId,
|
|
19906
|
-
resolve:
|
|
19909
|
+
resolve: resolve22,
|
|
19907
19910
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
19908
19911
|
});
|
|
19909
19912
|
});
|
|
@@ -20210,7 +20213,7 @@ function runHostBinary(connector, argv, cwd, timeoutMs) {
|
|
|
20210
20213
|
`
|
|
20211
20214
|
});
|
|
20212
20215
|
}
|
|
20213
|
-
return new Promise((
|
|
20216
|
+
return new Promise((resolve22) => {
|
|
20214
20217
|
const child = (0, import_child_process.spawn)(connector.hostBin, [...argv], {
|
|
20215
20218
|
cwd,
|
|
20216
20219
|
env,
|
|
@@ -20222,7 +20225,7 @@ function runHostBinary(connector, argv, cwd, timeoutMs) {
|
|
|
20222
20225
|
const finish = (exitCode) => {
|
|
20223
20226
|
if (settled) return;
|
|
20224
20227
|
settled = true;
|
|
20225
|
-
|
|
20228
|
+
resolve22({ exitCode, stdout, stderr });
|
|
20226
20229
|
};
|
|
20227
20230
|
const timer = setTimeout(() => {
|
|
20228
20231
|
child.kill("SIGTERM");
|
|
@@ -20427,7 +20430,7 @@ async function probeGh() {
|
|
|
20427
20430
|
return null;
|
|
20428
20431
|
}
|
|
20429
20432
|
function runHostGh(args, cwd, timeoutMs = GH_RPC_TIMEOUT_MS) {
|
|
20430
|
-
return new Promise((
|
|
20433
|
+
return new Promise((resolve22) => {
|
|
20431
20434
|
const child = (0, import_child_process2.spawn)("gh", args, {
|
|
20432
20435
|
cwd,
|
|
20433
20436
|
env: process.env,
|
|
@@ -20439,7 +20442,7 @@ function runHostGh(args, cwd, timeoutMs = GH_RPC_TIMEOUT_MS) {
|
|
|
20439
20442
|
const finish = (exitCode) => {
|
|
20440
20443
|
if (settled) return;
|
|
20441
20444
|
settled = true;
|
|
20442
|
-
|
|
20445
|
+
resolve22({ exitCode, stdout, stderr });
|
|
20443
20446
|
};
|
|
20444
20447
|
const timer = setTimeout(() => {
|
|
20445
20448
|
child.kill("SIGTERM");
|
|
@@ -20503,7 +20506,7 @@ async function checkoutGuards(hostMainRepo, registeredBranches) {
|
|
|
20503
20506
|
return null;
|
|
20504
20507
|
}
|
|
20505
20508
|
function runGitProbe(args) {
|
|
20506
|
-
return new Promise((
|
|
20509
|
+
return new Promise((resolve22) => {
|
|
20507
20510
|
const child = (0, import_child_process2.spawn)("git", args, { env: process.env, stdio: ["ignore", "pipe", "pipe"] });
|
|
20508
20511
|
let stdout = "";
|
|
20509
20512
|
let stderr = "";
|
|
@@ -20514,10 +20517,10 @@ function runGitProbe(args) {
|
|
|
20514
20517
|
stderr += c3.toString("utf8");
|
|
20515
20518
|
});
|
|
20516
20519
|
child.on("error", (err) => {
|
|
20517
|
-
|
|
20520
|
+
resolve22({ exitCode: 127, stdout, stderr: stderr + String(err.message ?? err) });
|
|
20518
20521
|
});
|
|
20519
20522
|
child.on("close", (code) => {
|
|
20520
|
-
|
|
20523
|
+
resolve22({ exitCode: code ?? -1, stdout, stderr });
|
|
20521
20524
|
});
|
|
20522
20525
|
});
|
|
20523
20526
|
}
|
|
@@ -20944,6 +20947,17 @@ async function lookupCloudBox(boxId) {
|
|
|
20944
20947
|
}
|
|
20945
20948
|
return { workspacePath: hit.box.workspacePath, cloudSandboxId: sid };
|
|
20946
20949
|
}
|
|
20950
|
+
async function boxWorkspacePath(boxId) {
|
|
20951
|
+
const state = await readState();
|
|
20952
|
+
const hit = findBox(boxId, state);
|
|
20953
|
+
return hit.kind === "ok" ? hit.box.workspacePath : void 0;
|
|
20954
|
+
}
|
|
20955
|
+
function resolveHostPath(workspacePath, hostPath) {
|
|
20956
|
+
if ((0, import_path5.isAbsolute)(hostPath)) return hostPath;
|
|
20957
|
+
if (hostPath === "~") return (0, import_os4.homedir)();
|
|
20958
|
+
if (hostPath.startsWith("~/")) return (0, import_path5.join)((0, import_os4.homedir)(), hostPath.slice(2));
|
|
20959
|
+
return workspacePath ? (0, import_path5.resolve)(workspacePath, hostPath) : (0, import_path5.resolve)(hostPath);
|
|
20960
|
+
}
|
|
20947
20961
|
var cloudCpModule;
|
|
20948
20962
|
async function loadCloudCp() {
|
|
20949
20963
|
if (cloudCpModule) return cloudCpModule;
|
|
@@ -20972,27 +20986,28 @@ async function runCpRpc(action, deps) {
|
|
|
20972
20986
|
};
|
|
20973
20987
|
}
|
|
20974
20988
|
const direction = action.method === "cp.toHost" ? "box -> host" : "host -> box";
|
|
20989
|
+
const lookup = await lookupCloudBox(deps.boxId);
|
|
20990
|
+
const hostAbs = resolveHostPath(lookup.workspacePath, params.hostPath);
|
|
20975
20991
|
if (deps.prompts && deps.subscribers) {
|
|
20976
20992
|
const verdict = await askPrompt(deps.prompts, deps.subscribers, deps.boxId, {
|
|
20977
20993
|
kind: "confirm",
|
|
20978
20994
|
message: `Allow cp (${direction}) on ${deps.boxName ?? deps.boxId}?`,
|
|
20979
|
-
detail: action.method === "cp.toHost" ? `${params.boxPath} -> ${
|
|
20995
|
+
detail: action.method === "cp.toHost" ? `${params.boxPath} -> ${hostAbs}` : `${hostAbs} -> ${params.boxPath}`,
|
|
20980
20996
|
defaultAnswer: "n",
|
|
20981
20997
|
context: {
|
|
20982
20998
|
command: action.method,
|
|
20983
|
-
argv: [params.boxPath,
|
|
20999
|
+
argv: [params.boxPath, hostAbs]
|
|
20984
21000
|
}
|
|
20985
21001
|
});
|
|
20986
21002
|
if (verdict.answer !== "y") {
|
|
20987
21003
|
return { exitCode: 10, stdout: "", stderr: "denied by user\n" };
|
|
20988
21004
|
}
|
|
20989
21005
|
}
|
|
20990
|
-
const lookup = await lookupCloudBox(deps.boxId);
|
|
20991
21006
|
const backend = await resolveCloudBackend(deps.backendName);
|
|
20992
21007
|
const handle = { sandboxId: lookup.cloudSandboxId };
|
|
20993
21008
|
const cp = await loadCloudCp();
|
|
20994
21009
|
try {
|
|
20995
|
-
const result = action.method === "cp.toHost" ? await cp.downloadFromCloudBox(backend, handle, params.boxPath,
|
|
21010
|
+
const result = action.method === "cp.toHost" ? await cp.downloadFromCloudBox(backend, handle, params.boxPath, hostAbs) : await cp.uploadToCloudBox(backend, handle, hostAbs, params.boxPath);
|
|
20996
21011
|
return { exitCode: 0, stdout: `${result.finalPath}
|
|
20997
21012
|
`, stderr: "" };
|
|
20998
21013
|
} catch (err) {
|
|
@@ -21068,7 +21083,7 @@ async function runDownloadRpc(action, deps) {
|
|
|
21068
21083
|
const backend = await resolveCloudBackend(deps.backendName);
|
|
21069
21084
|
const handle = { sandboxId: lookup.cloudSandboxId };
|
|
21070
21085
|
const cp = await loadCloudCp();
|
|
21071
|
-
const hostDst = typeof params.hostPath === "string" && params.hostPath.length > 0 ? params.hostPath : lookup.workspacePath;
|
|
21086
|
+
const hostDst = typeof params.hostPath === "string" && params.hostPath.length > 0 ? resolveHostPath(lookup.workspacePath, params.hostPath) : lookup.workspacePath;
|
|
21072
21087
|
try {
|
|
21073
21088
|
const result = await cp.pullCloudDirContents(backend, handle, "/workspace", hostDst);
|
|
21074
21089
|
return { exitCode: 0, stdout: `${result.finalPath}
|
|
@@ -21302,7 +21317,7 @@ function send(res, status2, body, contentType = "application/json") {
|
|
|
21302
21317
|
}
|
|
21303
21318
|
}
|
|
21304
21319
|
async function readJsonBody(req) {
|
|
21305
|
-
return new Promise((
|
|
21320
|
+
return new Promise((resolve22, reject) => {
|
|
21306
21321
|
let total = 0;
|
|
21307
21322
|
const chunks = [];
|
|
21308
21323
|
req.on("data", (chunk) => {
|
|
@@ -21317,11 +21332,11 @@ async function readJsonBody(req) {
|
|
|
21317
21332
|
req.on("end", () => {
|
|
21318
21333
|
const text = Buffer.concat(chunks).toString("utf8");
|
|
21319
21334
|
if (text.length === 0) {
|
|
21320
|
-
|
|
21335
|
+
resolve22({});
|
|
21321
21336
|
return;
|
|
21322
21337
|
}
|
|
21323
21338
|
try {
|
|
21324
|
-
|
|
21339
|
+
resolve22(JSON.parse(text));
|
|
21325
21340
|
} catch (err) {
|
|
21326
21341
|
reject(err instanceof Error ? err : new Error(String(err)));
|
|
21327
21342
|
}
|
|
@@ -21555,7 +21570,9 @@ function createRelayServer(opts) {
|
|
|
21555
21570
|
return;
|
|
21556
21571
|
}
|
|
21557
21572
|
const direction = body.method === "cp.toHost" ? "box -> host" : "host -> box";
|
|
21558
|
-
const
|
|
21573
|
+
const workspacePath = await boxWorkspacePath(reg.boxId);
|
|
21574
|
+
const hostAbs = resolveHostPath(workspacePath, params.hostPath);
|
|
21575
|
+
const pathDetail = body.method === "cp.toHost" ? `${params.boxPath} -> ${hostAbs}` : `${hostAbs} -> ${params.boxPath}`;
|
|
21559
21576
|
const detailParts = [pathDetail];
|
|
21560
21577
|
if (params.exclude && params.exclude.length > 0) {
|
|
21561
21578
|
detailParts.push(`exclude: ${params.exclude.join(", ")}`);
|
|
@@ -21569,14 +21586,17 @@ function createRelayServer(opts) {
|
|
|
21569
21586
|
defaultAnswer: "n",
|
|
21570
21587
|
context: {
|
|
21571
21588
|
command: body.method,
|
|
21572
|
-
argv: [params.boxPath,
|
|
21589
|
+
argv: [params.boxPath, hostAbs]
|
|
21573
21590
|
}
|
|
21574
21591
|
});
|
|
21575
21592
|
if (verdict.answer !== "y") {
|
|
21576
21593
|
send(res, 500, { exitCode: 10, stdout: "", stderr: "denied by user\n" });
|
|
21577
21594
|
return;
|
|
21578
21595
|
}
|
|
21579
|
-
const result = await handleCpRpc(reg, body.method, params
|
|
21596
|
+
const result = await handleCpRpc(reg, body.method, params, {
|
|
21597
|
+
hostPath: hostAbs,
|
|
21598
|
+
cwd: workspacePath
|
|
21599
|
+
});
|
|
21580
21600
|
const status2 = result.exitCode === 0 ? 200 : 500;
|
|
21581
21601
|
send(res, status2, result);
|
|
21582
21602
|
return;
|
|
@@ -22007,10 +22027,10 @@ data: {"ts":"${(/* @__PURE__ */ new Date()).toISOString()}"}
|
|
|
22007
22027
|
},
|
|
22008
22028
|
close: async () => {
|
|
22009
22029
|
if (pollers) await pollers.stopAll();
|
|
22010
|
-
await new Promise((
|
|
22030
|
+
await new Promise((resolve22, reject) => {
|
|
22011
22031
|
server.close((err) => {
|
|
22012
22032
|
if (err) reject(err);
|
|
22013
|
-
else
|
|
22033
|
+
else resolve22();
|
|
22014
22034
|
});
|
|
22015
22035
|
});
|
|
22016
22036
|
}
|
|
@@ -22247,7 +22267,7 @@ async function handleIntegrationRpc(method, reg, params, prompts, subscribers, h
|
|
|
22247
22267
|
}
|
|
22248
22268
|
return runHostIntegration(connector, opDesc, args, worktree.hostMainRepo);
|
|
22249
22269
|
}
|
|
22250
|
-
async function handleCpRpc(reg, method, params) {
|
|
22270
|
+
async function handleCpRpc(reg, method, params, opts) {
|
|
22251
22271
|
const entry = process.env.AGENTBOX_CLI_ENTRY;
|
|
22252
22272
|
if (!entry) {
|
|
22253
22273
|
return {
|
|
@@ -22261,8 +22281,8 @@ async function handleCpRpc(reg, method, params) {
|
|
|
22261
22281
|
for (const pat of params.exclude ?? []) flags.push("--exclude", pat);
|
|
22262
22282
|
if (params.defaultExcludes === false) flags.push("--no-default-excludes");
|
|
22263
22283
|
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);
|
|
22284
|
+
const argv = method === "cp.toHost" ? [process.execPath, entry, "cp", boxRef, opts.hostPath, ...flags] : [process.execPath, entry, "cp", opts.hostPath, boxRef, ...flags];
|
|
22285
|
+
return runHostCommand(argv, CP_RPC_TIMEOUT_MS, opts.cwd);
|
|
22266
22286
|
}
|
|
22267
22287
|
async function handleDownloadRpc(reg, kind) {
|
|
22268
22288
|
const entry = process.env.AGENTBOX_CLI_ENTRY;
|
|
@@ -22276,7 +22296,8 @@ async function handleDownloadRpc(reg, kind) {
|
|
|
22276
22296
|
const argv = [process.execPath, entry, "download"];
|
|
22277
22297
|
if (kind !== "workspace") argv.push(kind);
|
|
22278
22298
|
argv.push(reg.name, "-y");
|
|
22279
|
-
|
|
22299
|
+
const cwd = await boxWorkspacePath(reg.boxId);
|
|
22300
|
+
return runHostCommand(argv, DOWNLOAD_RPC_TIMEOUT_MS, cwd);
|
|
22280
22301
|
}
|
|
22281
22302
|
async function handleCheckpointRpc(reg, params) {
|
|
22282
22303
|
const entry = process.env.AGENTBOX_CLI_ENTRY;
|
|
@@ -22303,16 +22324,20 @@ function isOpenableUrl(value) {
|
|
|
22303
22324
|
}
|
|
22304
22325
|
return url.protocol === "http:" || url.protocol === "https:";
|
|
22305
22326
|
}
|
|
22306
|
-
function runHostCommand(argv, timeoutMs = GIT_RPC_TIMEOUT_MS) {
|
|
22307
|
-
return new Promise((
|
|
22327
|
+
function runHostCommand(argv, timeoutMs = GIT_RPC_TIMEOUT_MS, cwd) {
|
|
22328
|
+
return new Promise((resolve22) => {
|
|
22308
22329
|
const [cmd, ...rest] = argv;
|
|
22309
22330
|
if (!cmd) {
|
|
22310
|
-
|
|
22331
|
+
resolve22({ exitCode: 64, stdout: "", stderr: "empty command" });
|
|
22311
22332
|
return;
|
|
22312
22333
|
}
|
|
22313
22334
|
const child = (0, import_child_process3.spawn)(cmd, rest, {
|
|
22314
22335
|
env: process.env,
|
|
22315
|
-
stdio: ["ignore", "pipe", "pipe"]
|
|
22336
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
22337
|
+
// Default to the relay daemon's CWD when unset (legacy behaviour); callers
|
|
22338
|
+
// that know the box pass its workspace so relative host paths + project
|
|
22339
|
+
// config resolve against the box, not whatever dir launched the relay.
|
|
22340
|
+
...cwd ? { cwd } : {}
|
|
22316
22341
|
});
|
|
22317
22342
|
let stdout = "";
|
|
22318
22343
|
let stderr = "";
|
|
@@ -22320,7 +22345,7 @@ function runHostCommand(argv, timeoutMs = GIT_RPC_TIMEOUT_MS) {
|
|
|
22320
22345
|
const finish = (exitCode) => {
|
|
22321
22346
|
if (settled) return;
|
|
22322
22347
|
settled = true;
|
|
22323
|
-
|
|
22348
|
+
resolve22({ exitCode, stdout, stderr });
|
|
22324
22349
|
};
|
|
22325
22350
|
const timer = setTimeout(() => {
|
|
22326
22351
|
child.kill("SIGTERM");
|
|
@@ -22348,11 +22373,11 @@ relay: command timed out after ${String(timeoutMs)}ms
|
|
|
22348
22373
|
}
|
|
22349
22374
|
async function startRelayServer(opts) {
|
|
22350
22375
|
const handle = createRelayServer(opts);
|
|
22351
|
-
await new Promise((
|
|
22376
|
+
await new Promise((resolve22, reject) => {
|
|
22352
22377
|
handle.server.once("error", reject);
|
|
22353
22378
|
handle.server.listen(opts.port, opts.host ?? "0.0.0.0", () => {
|
|
22354
22379
|
handle.server.removeListener("error", reject);
|
|
22355
|
-
|
|
22380
|
+
resolve22();
|
|
22356
22381
|
});
|
|
22357
22382
|
});
|
|
22358
22383
|
return handle;
|
|
@@ -22361,6 +22386,7 @@ var QUEUE_DIR = (0, import_path6.join)(STATE_DIR2, "queue");
|
|
|
22361
22386
|
var TERMINAL_RETENTION_MS = 60 * 60 * 1e3;
|
|
22362
22387
|
var SWEEP_INTERVAL_MS = 60 * 1e3;
|
|
22363
22388
|
var QUEUE_LOGS_DIR = (0, import_path6.join)(STATE_DIR2, "logs");
|
|
22389
|
+
var FAILURE_BACKOFF_MS = 5 * 6e4;
|
|
22364
22390
|
|
|
22365
22391
|
// src/config.ts
|
|
22366
22392
|
var import_promises19 = require("fs/promises");
|
|
@@ -23038,16 +23064,16 @@ function matchState(pane) {
|
|
|
23038
23064
|
return null;
|
|
23039
23065
|
}
|
|
23040
23066
|
function defaultCapturePane(sessionName) {
|
|
23041
|
-
return new Promise((
|
|
23067
|
+
return new Promise((resolve3) => {
|
|
23042
23068
|
const child = (0, import_node_child_process7.spawn)("tmux", ["capture-pane", "-p", "-t", sessionName], {
|
|
23043
23069
|
stdio: ["ignore", "pipe", "ignore"]
|
|
23044
23070
|
});
|
|
23045
23071
|
let stdout = "";
|
|
23046
23072
|
child.stdout.on("data", (b) => stdout += b.toString("utf8"));
|
|
23047
|
-
child.on("error", () =>
|
|
23073
|
+
child.on("error", () => resolve3(null));
|
|
23048
23074
|
child.on("close", (code) => {
|
|
23049
|
-
if (code === 0)
|
|
23050
|
-
else
|
|
23075
|
+
if (code === 0) resolve3(stdout);
|
|
23076
|
+
else resolve3(null);
|
|
23051
23077
|
});
|
|
23052
23078
|
});
|
|
23053
23079
|
}
|
|
@@ -23098,16 +23124,16 @@ function matchWaiting(pane) {
|
|
|
23098
23124
|
return WAITING_PATTERNS.some((re) => re.test(region));
|
|
23099
23125
|
}
|
|
23100
23126
|
function defaultCapturePane2(sessionName) {
|
|
23101
|
-
return new Promise((
|
|
23127
|
+
return new Promise((resolve3) => {
|
|
23102
23128
|
const child = (0, import_node_child_process8.spawn)("tmux", ["capture-pane", "-p", "-t", sessionName], {
|
|
23103
23129
|
stdio: ["ignore", "pipe", "ignore"]
|
|
23104
23130
|
});
|
|
23105
23131
|
let stdout = "";
|
|
23106
23132
|
child.stdout.on("data", (b) => stdout += b.toString("utf8"));
|
|
23107
|
-
child.on("error", () =>
|
|
23133
|
+
child.on("error", () => resolve3(null));
|
|
23108
23134
|
child.on("close", (code) => {
|
|
23109
|
-
if (code === 0)
|
|
23110
|
-
else
|
|
23135
|
+
if (code === 0) resolve3(stdout);
|
|
23136
|
+
else resolve3(null);
|
|
23111
23137
|
});
|
|
23112
23138
|
});
|
|
23113
23139
|
}
|
|
@@ -23465,13 +23491,13 @@ var ServiceRunner = class extends import_node_events15.EventEmitter {
|
|
|
23465
23491
|
const child = this.child;
|
|
23466
23492
|
if (child && child.exitCode === null) {
|
|
23467
23493
|
child.kill("SIGTERM");
|
|
23468
|
-
await new Promise((
|
|
23494
|
+
await new Promise((resolve3) => {
|
|
23469
23495
|
const timer = setTimeout(() => {
|
|
23470
23496
|
if (child.exitCode === null) child.kill("SIGKILL");
|
|
23471
23497
|
}, 5e3);
|
|
23472
23498
|
child.once("exit", () => {
|
|
23473
23499
|
clearTimeout(timer);
|
|
23474
|
-
|
|
23500
|
+
resolve3();
|
|
23475
23501
|
});
|
|
23476
23502
|
});
|
|
23477
23503
|
}
|
|
@@ -23732,7 +23758,7 @@ var TaskRunner = class extends import_node_events15.EventEmitter {
|
|
|
23732
23758
|
}
|
|
23733
23759
|
/** Run the `run_once.check` probe. Resolves true when it exits 0. */
|
|
23734
23760
|
runCheck(command, cwd) {
|
|
23735
|
-
return new Promise((
|
|
23761
|
+
return new Promise((resolve3) => {
|
|
23736
23762
|
let child;
|
|
23737
23763
|
try {
|
|
23738
23764
|
child = this.spawnFn("bash", ["-c", command], {
|
|
@@ -23745,7 +23771,7 @@ var TaskRunner = class extends import_node_events15.EventEmitter {
|
|
|
23745
23771
|
"stderr",
|
|
23746
23772
|
`[ctl] run_once check spawn failed: ${err instanceof Error ? err.message : String(err)}`
|
|
23747
23773
|
);
|
|
23748
|
-
|
|
23774
|
+
resolve3(false);
|
|
23749
23775
|
return;
|
|
23750
23776
|
}
|
|
23751
23777
|
const onLine = (stream) => (chunk) => {
|
|
@@ -23755,8 +23781,8 @@ var TaskRunner = class extends import_node_events15.EventEmitter {
|
|
|
23755
23781
|
};
|
|
23756
23782
|
child.stdout?.on("data", onLine("stdout"));
|
|
23757
23783
|
child.stderr?.on("data", onLine("stderr"));
|
|
23758
|
-
child.on("error", () =>
|
|
23759
|
-
child.on("exit", (code) =>
|
|
23784
|
+
child.on("error", () => resolve3(false));
|
|
23785
|
+
child.on("exit", (code) => resolve3(code === 0));
|
|
23760
23786
|
});
|
|
23761
23787
|
}
|
|
23762
23788
|
/** Returns a human reason if the task is already satisfied (skip), else null. */
|
|
@@ -24039,11 +24065,11 @@ var Supervisor = class extends import_node_events15.EventEmitter {
|
|
|
24039
24065
|
const targets = args.units && args.units.length > 0 ? args.units : this.autostartNames();
|
|
24040
24066
|
const timeoutMs = args.timeoutMs ?? 6e4;
|
|
24041
24067
|
if (targets.length === 0 || this.areAllReady(targets)) return { ready: true };
|
|
24042
|
-
return new Promise((
|
|
24068
|
+
return new Promise((resolve3) => {
|
|
24043
24069
|
const onChange = () => {
|
|
24044
24070
|
if (this.areAllReady(targets)) {
|
|
24045
24071
|
cleanup();
|
|
24046
|
-
|
|
24072
|
+
resolve3({ ready: true });
|
|
24047
24073
|
}
|
|
24048
24074
|
};
|
|
24049
24075
|
const cleanup = () => {
|
|
@@ -24053,7 +24079,7 @@ var Supervisor = class extends import_node_events15.EventEmitter {
|
|
|
24053
24079
|
const timer = setTimeout(() => {
|
|
24054
24080
|
cleanup();
|
|
24055
24081
|
const d = this.diagnose(targets);
|
|
24056
|
-
|
|
24082
|
+
resolve3({ ready: false, timedOut: d.notYet, failed: d.failed });
|
|
24057
24083
|
}, timeoutMs);
|
|
24058
24084
|
this.on("change", onChange);
|
|
24059
24085
|
});
|
|
@@ -24345,14 +24371,14 @@ function sanitizePaneTitle(raw, ctx) {
|
|
|
24345
24371
|
return t.length > MAX_TITLE_LEN ? t.slice(0, MAX_TITLE_LEN) : t;
|
|
24346
24372
|
}
|
|
24347
24373
|
function runTool(cmd, args) {
|
|
24348
|
-
return new Promise((
|
|
24374
|
+
return new Promise((resolve3) => {
|
|
24349
24375
|
const child = (0, import_node_child_process10.spawn)(cmd, args, { stdio: ["ignore", "pipe", "pipe"] });
|
|
24350
24376
|
let stdout = "";
|
|
24351
24377
|
let stderr = "";
|
|
24352
24378
|
child.stdout.on("data", (b) => stdout += b.toString("utf8"));
|
|
24353
24379
|
child.stderr.on("data", (b) => stderr += b.toString("utf8"));
|
|
24354
|
-
child.on("error", () =>
|
|
24355
|
-
child.on("close", (code) =>
|
|
24380
|
+
child.on("error", () => resolve3({ exitCode: 127, stdout, stderr }));
|
|
24381
|
+
child.on("close", (code) => resolve3({ exitCode: code ?? -1, stdout, stderr }));
|
|
24356
24382
|
});
|
|
24357
24383
|
}
|
|
24358
24384
|
async function probeAgentSession(sessionName) {
|
|
@@ -24557,12 +24583,12 @@ async function collectPorts(supervisor) {
|
|
|
24557
24583
|
}));
|
|
24558
24584
|
}
|
|
24559
24585
|
function run(cmd, args) {
|
|
24560
|
-
return new Promise((
|
|
24586
|
+
return new Promise((resolve3) => {
|
|
24561
24587
|
const child = (0, import_node_child_process11.spawn)(cmd, args, { stdio: ["ignore", "pipe", "ignore"] });
|
|
24562
24588
|
let stdout = "";
|
|
24563
24589
|
child.stdout.on("data", (b) => stdout += b.toString("utf8"));
|
|
24564
|
-
child.on("error", () =>
|
|
24565
|
-
child.on("close", (code) =>
|
|
24590
|
+
child.on("error", () => resolve3({ exitCode: 127, stdout }));
|
|
24591
|
+
child.on("close", (code) => resolve3({ exitCode: code ?? -1, stdout }));
|
|
24566
24592
|
});
|
|
24567
24593
|
}
|
|
24568
24594
|
async function discoverListeningPorts() {
|
|
@@ -24598,11 +24624,11 @@ async function startServer(opts) {
|
|
|
24598
24624
|
sock.end();
|
|
24599
24625
|
});
|
|
24600
24626
|
});
|
|
24601
|
-
await new Promise((
|
|
24627
|
+
await new Promise((resolve3, reject) => {
|
|
24602
24628
|
server.once("error", reject);
|
|
24603
24629
|
server.listen(opts.socketPath, () => {
|
|
24604
24630
|
server.removeListener("error", reject);
|
|
24605
|
-
|
|
24631
|
+
resolve3();
|
|
24606
24632
|
});
|
|
24607
24633
|
});
|
|
24608
24634
|
await (0, import_promises23.chmod)(opts.socketPath, 432).catch(() => {
|
|
@@ -24846,14 +24872,14 @@ function startBoxRelayForwarder(opts) {
|
|
|
24846
24872
|
});
|
|
24847
24873
|
req.pipe(upstreamReq);
|
|
24848
24874
|
});
|
|
24849
|
-
return new Promise((
|
|
24875
|
+
return new Promise((resolve3, reject) => {
|
|
24850
24876
|
const onError = (err) => {
|
|
24851
24877
|
reject(err);
|
|
24852
24878
|
};
|
|
24853
24879
|
server.once("error", onError);
|
|
24854
24880
|
server.listen(opts.port, "127.0.0.1", () => {
|
|
24855
24881
|
server.removeListener("error", onError);
|
|
24856
|
-
|
|
24882
|
+
resolve3({
|
|
24857
24883
|
url: `http://127.0.0.1:${String(opts.port)}`,
|
|
24858
24884
|
close: () => new Promise((res) => {
|
|
24859
24885
|
server.close(() => res());
|
|
@@ -25162,26 +25188,26 @@ function buildParams(opts, extra) {
|
|
|
25162
25188
|
return params;
|
|
25163
25189
|
}
|
|
25164
25190
|
function runLocalGit(args, cwd) {
|
|
25165
|
-
return new Promise((
|
|
25191
|
+
return new Promise((resolve3) => {
|
|
25166
25192
|
const child = (0, import_node_child_process12.spawn)("git", args, { cwd, stdio: "inherit" });
|
|
25167
|
-
child.on("close", (code) =>
|
|
25193
|
+
child.on("close", (code) => resolve3(code ?? 1));
|
|
25168
25194
|
child.on("error", (err) => {
|
|
25169
25195
|
process.stderr.write(`agentbox-ctl git: ${String(err.message ?? err)}
|
|
25170
25196
|
`);
|
|
25171
|
-
|
|
25197
|
+
resolve3(126);
|
|
25172
25198
|
});
|
|
25173
25199
|
});
|
|
25174
25200
|
}
|
|
25175
25201
|
function hasGitIdentity(cwd) {
|
|
25176
|
-
return new Promise((
|
|
25202
|
+
return new Promise((resolve3) => {
|
|
25177
25203
|
const child = (0, import_node_child_process12.spawn)("git", ["config", "user.email"], {
|
|
25178
25204
|
cwd,
|
|
25179
25205
|
stdio: ["ignore", "pipe", "ignore"]
|
|
25180
25206
|
});
|
|
25181
25207
|
let out = "";
|
|
25182
25208
|
child.stdout.on("data", (c3) => out += c3.toString("utf8"));
|
|
25183
|
-
child.on("close", (code) =>
|
|
25184
|
-
child.on("error", () =>
|
|
25209
|
+
child.on("close", (code) => resolve3(code === 0 && out.trim().length > 0));
|
|
25210
|
+
child.on("error", () => resolve3(false));
|
|
25185
25211
|
});
|
|
25186
25212
|
}
|
|
25187
25213
|
var gitCommand = new Command("git").description("Git operations that need host credentials (routed through the agentbox relay)").addCommand(
|
|
@@ -25320,7 +25346,7 @@ function isHttpUrl(value) {
|
|
|
25320
25346
|
}
|
|
25321
25347
|
}
|
|
25322
25348
|
function openInBoxBrowser(url) {
|
|
25323
|
-
return new Promise((
|
|
25349
|
+
return new Promise((resolve3) => {
|
|
25324
25350
|
const child = (0, import_node_child_process13.spawn)("agent-browser", ["open", "--headed", url], { stdio: "inherit" });
|
|
25325
25351
|
const timer = setTimeout(() => {
|
|
25326
25352
|
child.kill("SIGTERM");
|
|
@@ -25328,18 +25354,18 @@ function openInBoxBrowser(url) {
|
|
|
25328
25354
|
`agentbox-ctl open: agent-browser timed out after ${String(OPEN_TIMEOUT_MS)}ms
|
|
25329
25355
|
`
|
|
25330
25356
|
);
|
|
25331
|
-
|
|
25357
|
+
resolve3(124);
|
|
25332
25358
|
}, OPEN_TIMEOUT_MS);
|
|
25333
25359
|
if (typeof timer.unref === "function") timer.unref();
|
|
25334
25360
|
child.on("close", (code) => {
|
|
25335
25361
|
clearTimeout(timer);
|
|
25336
|
-
|
|
25362
|
+
resolve3(code ?? 1);
|
|
25337
25363
|
});
|
|
25338
25364
|
child.on("error", (err) => {
|
|
25339
25365
|
clearTimeout(timer);
|
|
25340
25366
|
process.stderr.write(`agentbox-ctl open: ${String(err.message ?? err)}
|
|
25341
25367
|
`);
|
|
25342
|
-
|
|
25368
|
+
resolve3(126);
|
|
25343
25369
|
});
|
|
25344
25370
|
});
|
|
25345
25371
|
}
|