@madarco/agentbox 0.17.1 → 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 +78 -0
- package/README.md +4 -3
- package/dist/{_cloud-attach-RUD4W33P.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-HFQZJO73.js → chunk-A5OFRJDI.js} +1322 -216
- package/dist/chunk-A5OFRJDI.js.map +1 -0
- package/dist/{chunk-YUGLNTT2.js → chunk-JK5V4OLT.js} +349 -16
- package/dist/chunk-JK5V4OLT.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-KTDJ5JTE.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-VAATGBAR.js → dist-EKSNZHDY.js} +13 -3
- package/dist/{dist-TEKY3GFT.js → dist-FTCDWRAL.js} +18 -7
- package/dist/dist-FTCDWRAL.js.map +1 -0
- package/dist/{dist-CNABE32V.js → dist-PRDYMXCX.js} +10 -5
- package/dist/dist-PRDYMXCX.js.map +1 -0
- package/dist/{dist-BO2R55FX.js → dist-U2BHTWG4.js} +17 -5
- package/dist/dist-U2BHTWG4.js.map +1 -0
- package/dist/{dist-CROGTJ7N.js → dist-VQSZVBT3.js} +20 -6
- package/dist/dist-VQSZVBT3.js.map +1 -0
- package/dist/index.js +1009 -449
- package/dist/index.js.map +1 -1
- package/dist/{prepared-state-MQHD3M5F-OVABNV66.js → prepared-state-MQHD3M5F-5ZMCNY43.js} +2 -2
- package/package.json +3 -3
- package/runtime/docker/apps/cli/share/agentbox-setup/SKILL.md +1 -1
- package/runtime/docker/packages/ctl/dist/bin.cjs +142 -110
- 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 +142 -110
- package/runtime/hetzner/agentbox-dockerd-start +13 -0
- package/runtime/hetzner/agentbox-setup-skill.md +1 -1
- package/runtime/hetzner/ctl.cjs +142 -110
- package/runtime/relay/bin.cjs +270 -66
- package/runtime/vercel/agentbox-dockerd-start +145 -0
- package/runtime/vercel/agentbox-setup-skill.md +1 -1
- package/runtime/vercel/ctl.cjs +142 -110
- 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-HFQZJO73.js.map +0 -1
- package/dist/chunk-KTDJ5JTE.js.map +0 -1
- package/dist/chunk-YUGLNTT2.js.map +0 -1
- package/dist/dist-BO2R55FX.js.map +0 -1
- package/dist/dist-CNABE32V.js.map +0 -1
- package/dist/dist-CROGTJ7N.js.map +0 -1
- package/dist/dist-TEKY3GFT.js.map +0 -1
- /package/dist/{_cloud-attach-RUD4W33P.js.map → _cloud-attach-YM2KOWHO.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-VAATGBAR.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/dist/index.js
CHANGED
|
@@ -12,6 +12,8 @@ import {
|
|
|
12
12
|
createMenuLines,
|
|
13
13
|
detectHostTerminal,
|
|
14
14
|
getProvider,
|
|
15
|
+
herdrSend,
|
|
16
|
+
hostAwareOpenIn,
|
|
15
17
|
isKnownProvider,
|
|
16
18
|
lifecycleMenuLines,
|
|
17
19
|
loadPtyBackend,
|
|
@@ -30,8 +32,9 @@ import {
|
|
|
30
32
|
spawnInNewTerminal,
|
|
31
33
|
statusLine,
|
|
32
34
|
stripTitleGlyph,
|
|
33
|
-
subscribePrompts
|
|
34
|
-
|
|
35
|
+
subscribePrompts,
|
|
36
|
+
uploadImageFileToBox
|
|
37
|
+
} from "./chunk-JK5V4OLT.js";
|
|
35
38
|
import {
|
|
36
39
|
daytonaBackend,
|
|
37
40
|
ensureDaytonaCredentials,
|
|
@@ -39,7 +42,7 @@ import {
|
|
|
39
42
|
readDaytonaCredStatus,
|
|
40
43
|
readPreparedDaytonaState,
|
|
41
44
|
secretsPath
|
|
42
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-NXX3KQZ6.js";
|
|
43
46
|
import {
|
|
44
47
|
detectEgressIp,
|
|
45
48
|
ensureHetznerCredentials,
|
|
@@ -50,7 +53,7 @@ import {
|
|
|
50
53
|
readPreparedState,
|
|
51
54
|
secretsPath as secretsPath2,
|
|
52
55
|
syncFirewallSource
|
|
53
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-P6UT5XGE.js";
|
|
54
57
|
import {
|
|
55
58
|
detectSbx,
|
|
56
59
|
ensureVercelCredentials,
|
|
@@ -59,14 +62,14 @@ import {
|
|
|
59
62
|
readPreparedState as readPreparedState2,
|
|
60
63
|
readVercelCredStatus,
|
|
61
64
|
secretsPath as secretsPath3
|
|
62
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-MODNW54N.js";
|
|
63
66
|
import {
|
|
64
67
|
ensureE2bCredentials,
|
|
65
68
|
maskKey as maskKey4,
|
|
66
69
|
readE2bCredStatus,
|
|
67
70
|
readPreparedState as readPreparedState3,
|
|
68
71
|
secretsPath as secretsPath4
|
|
69
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-Y6PUCLOE.js";
|
|
70
73
|
import {
|
|
71
74
|
agentSpecsForCloud,
|
|
72
75
|
currentCloudBaseFingerprint,
|
|
@@ -76,7 +79,7 @@ import {
|
|
|
76
79
|
probeCloudCheckpoint,
|
|
77
80
|
resolveCloudCheckpoint,
|
|
78
81
|
seedAgentVolumesIfFresh
|
|
79
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-SPUUOEW2.js";
|
|
80
83
|
import {
|
|
81
84
|
ALL_CONNECTORS,
|
|
82
85
|
BOX_STATUS_EVENT,
|
|
@@ -232,7 +235,7 @@ import {
|
|
|
232
235
|
waitForTmuxPaneContent,
|
|
233
236
|
warmUpClaudeCredentials,
|
|
234
237
|
writeJob
|
|
235
|
-
} from "./chunk-
|
|
238
|
+
} from "./chunk-A5OFRJDI.js";
|
|
236
239
|
import {
|
|
237
240
|
AmbiguousBoxError,
|
|
238
241
|
BoxNotFoundError,
|
|
@@ -250,7 +253,7 @@ import {
|
|
|
250
253
|
resolveAgentLauncher,
|
|
251
254
|
resolveBoxRef,
|
|
252
255
|
resolveRuleRefs
|
|
253
|
-
} from "./chunk-
|
|
256
|
+
} from "./chunk-7K2A3NLE.js";
|
|
254
257
|
import "./chunk-G3H2L3O2.js";
|
|
255
258
|
import {
|
|
256
259
|
__export,
|
|
@@ -258,11 +261,11 @@ import {
|
|
|
258
261
|
} from "./chunk-WJFZJZIM.js";
|
|
259
262
|
|
|
260
263
|
// src/version.ts
|
|
261
|
-
var AGENTBOX_VERSION = true ? "0.
|
|
262
|
-
var AGENTBOX_COMMIT = true ? "
|
|
264
|
+
var AGENTBOX_VERSION = true ? "0.19.0" : "0.0.0-dev";
|
|
265
|
+
var AGENTBOX_COMMIT = true ? "e1a69779a" : "dev";
|
|
263
266
|
|
|
264
267
|
// src/index.ts
|
|
265
|
-
import { Command as
|
|
268
|
+
import { Command as Command51 } from "commander";
|
|
266
269
|
|
|
267
270
|
// src/engine-override.ts
|
|
268
271
|
async function applyEngineOverrideAtStartup() {
|
|
@@ -1015,7 +1018,7 @@ function parsePositiveInt(raw, label) {
|
|
|
1015
1018
|
}
|
|
1016
1019
|
|
|
1017
1020
|
// src/commands/attach.ts
|
|
1018
|
-
import { intro as intro5, isCancel as isCancel2, log as
|
|
1021
|
+
import { intro as intro5, isCancel as isCancel2, log as log14, outro as outro4, select as select2 } from "@clack/prompts";
|
|
1019
1022
|
import { Command as Command6 } from "commander";
|
|
1020
1023
|
import { execa as execa2 } from "execa";
|
|
1021
1024
|
|
|
@@ -1523,7 +1526,7 @@ async function dirSizeCapped(dir, cap, exclude = []) {
|
|
|
1523
1526
|
|
|
1524
1527
|
// src/lib/carry-resync.ts
|
|
1525
1528
|
async function resyncCarryFiles(args) {
|
|
1526
|
-
const
|
|
1529
|
+
const log51 = args.onLog ?? (() => {
|
|
1527
1530
|
});
|
|
1528
1531
|
const prior = args.box.carry?.entries ?? [];
|
|
1529
1532
|
if (prior.length === 0) return { recopied: 0, skippedNew: 0 };
|
|
@@ -1535,7 +1538,7 @@ async function resyncCarryFiles(args) {
|
|
|
1535
1538
|
maxBytes: cfg.effective.box.cpMaxBytes
|
|
1536
1539
|
});
|
|
1537
1540
|
if (resolved.errors.length > 0) {
|
|
1538
|
-
|
|
1541
|
+
log51(`carry: resync skipped (resolve errors: ${resolved.errors.length})`);
|
|
1539
1542
|
return { recopied: 0, skippedNew: 0 };
|
|
1540
1543
|
}
|
|
1541
1544
|
const priorByDest = new Map(prior.map((e) => [e.dest, e]));
|
|
@@ -1552,7 +1555,7 @@ async function resyncCarryFiles(args) {
|
|
|
1552
1555
|
if (hash === void 0 || hash !== existing.hash) changed.push(entry);
|
|
1553
1556
|
}
|
|
1554
1557
|
if (skippedNew > 0) {
|
|
1555
|
-
|
|
1558
|
+
log51(
|
|
1556
1559
|
`carry: ${String(skippedNew)} new entry/entries not applied on resync \u2014 recreate the box to approve`
|
|
1557
1560
|
);
|
|
1558
1561
|
}
|
|
@@ -1560,9 +1563,9 @@ async function resyncCarryFiles(args) {
|
|
|
1560
1563
|
const result = await copyCarryPathsToBox({
|
|
1561
1564
|
container: args.box.container,
|
|
1562
1565
|
entries: changed,
|
|
1563
|
-
onLog:
|
|
1566
|
+
onLog: log51
|
|
1564
1567
|
});
|
|
1565
|
-
for (const err of result.errors)
|
|
1568
|
+
for (const err of result.errors) log51(`carry: ${err}`);
|
|
1566
1569
|
const updatedByDest = new Map(result.applied.map((e) => [e.dest, e]));
|
|
1567
1570
|
const mergedEntries = prior.map((e) => updatedByDest.get(e.dest) ?? e);
|
|
1568
1571
|
await recordBox({
|
|
@@ -1570,7 +1573,7 @@ async function resyncCarryFiles(args) {
|
|
|
1570
1573
|
carry: { count: mergedEntries.length, entries: mergedEntries }
|
|
1571
1574
|
});
|
|
1572
1575
|
if (result.applied.length > 0) {
|
|
1573
|
-
|
|
1576
|
+
log51(`carry: re-copied ${String(result.applied.length)} changed file(s)`);
|
|
1574
1577
|
}
|
|
1575
1578
|
return { recopied: result.applied.length, skippedNew };
|
|
1576
1579
|
}
|
|
@@ -1742,6 +1745,15 @@ function captureOpenTerminalContext(mode, env = process.env, cwd = process.cwd()
|
|
|
1742
1745
|
cmuxWorkspaceId: env["CMUX_WORKSPACE_ID"]
|
|
1743
1746
|
};
|
|
1744
1747
|
}
|
|
1748
|
+
if (host === "herdr") {
|
|
1749
|
+
return {
|
|
1750
|
+
...base,
|
|
1751
|
+
host,
|
|
1752
|
+
herdrSocket: env["HERDR_SOCKET_PATH"],
|
|
1753
|
+
herdrPaneId: env["HERDR_PANE_ID"],
|
|
1754
|
+
herdrWorkspaceId: env["HERDR_WORKSPACE_ID"]
|
|
1755
|
+
};
|
|
1756
|
+
}
|
|
1745
1757
|
return { ...base, host };
|
|
1746
1758
|
}
|
|
1747
1759
|
function spawnQueuedOpenTerminal(ctx, argv2, title) {
|
|
@@ -1772,6 +1784,20 @@ function spawnQueuedOpenTerminal(ctx, argv2, title) {
|
|
|
1772
1784
|
cmuxWorkspaceFallback: true
|
|
1773
1785
|
});
|
|
1774
1786
|
}
|
|
1787
|
+
if (ctx.host === "herdr") {
|
|
1788
|
+
const env = { ...process.env };
|
|
1789
|
+
if (ctx.herdrSocket) env["HERDR_SOCKET_PATH"] = ctx.herdrSocket;
|
|
1790
|
+
return spawnInNewTerminal({
|
|
1791
|
+
host: "herdr",
|
|
1792
|
+
mode: ctx.mode,
|
|
1793
|
+
argv: argv2,
|
|
1794
|
+
cwd: ctx.cwd,
|
|
1795
|
+
title,
|
|
1796
|
+
env,
|
|
1797
|
+
herdrTargetPane: ctx.herdrPaneId,
|
|
1798
|
+
herdrTargetWorkspace: ctx.herdrWorkspaceId
|
|
1799
|
+
});
|
|
1800
|
+
}
|
|
1775
1801
|
return spawnInNewTerminal({ host: "iterm2", mode: ctx.mode, argv: argv2, cwd: ctx.cwd, title });
|
|
1776
1802
|
}
|
|
1777
1803
|
|
|
@@ -1795,6 +1821,9 @@ function resolveAttachInOption(opts) {
|
|
|
1795
1821
|
return void 0;
|
|
1796
1822
|
}
|
|
1797
1823
|
|
|
1824
|
+
// src/commands/_cloud-agent-create.ts
|
|
1825
|
+
import { log as log4 } from "@clack/prompts";
|
|
1826
|
+
|
|
1798
1827
|
// src/lib/progress.ts
|
|
1799
1828
|
import { spinner } from "@clack/prompts";
|
|
1800
1829
|
|
|
@@ -1970,6 +1999,9 @@ ${instruction}`));
|
|
|
1970
1999
|
}
|
|
1971
2000
|
|
|
1972
2001
|
// src/commands/_cloud-agent-create.ts
|
|
2002
|
+
function agentKindFor(mode) {
|
|
2003
|
+
return mode === "claude" ? "claude-code" : mode;
|
|
2004
|
+
}
|
|
1973
2005
|
async function cloudAgentCreate(args) {
|
|
1974
2006
|
const s = makeProgressReporter(args.verbose === true);
|
|
1975
2007
|
s.start("creating cloud box");
|
|
@@ -1987,6 +2019,11 @@ async function cloudAgentCreate(args) {
|
|
|
1987
2019
|
extraArgs = [...hook.agentArgsPrefix, ...extraArgs ?? []];
|
|
1988
2020
|
}
|
|
1989
2021
|
}
|
|
2022
|
+
const resyncWarning = result.resync ? buildResyncWarning(result.resync) : null;
|
|
2023
|
+
if (resyncWarning) {
|
|
2024
|
+
if (args.hasSeedPrompt) log4.warn(resyncWarning);
|
|
2025
|
+
else extraArgs = buildPromptArgs(agentKindFor(args.mode), resyncWarning, extraArgs ?? []);
|
|
2026
|
+
}
|
|
1990
2027
|
await printLaunchRecap({
|
|
1991
2028
|
record: result.record,
|
|
1992
2029
|
mode: args.mode,
|
|
@@ -2017,7 +2054,7 @@ async function cloudAgentCreate(args) {
|
|
|
2017
2054
|
// src/lib/carry-gate.ts
|
|
2018
2055
|
import { readFile as readFile2 } from "fs/promises";
|
|
2019
2056
|
import { join as join6 } from "path";
|
|
2020
|
-
import { log as
|
|
2057
|
+
import { log as log6 } from "@clack/prompts";
|
|
2021
2058
|
|
|
2022
2059
|
// src/fmt.ts
|
|
2023
2060
|
function fmtBytes2(n) {
|
|
@@ -2158,13 +2195,13 @@ async function runQueuedCarryGate(args) {
|
|
|
2158
2195
|
onLog: args.onLog
|
|
2159
2196
|
});
|
|
2160
2197
|
if (gate.decision === "cancel") {
|
|
2161
|
-
|
|
2198
|
+
log6.warn("carry: cancelled \u2014 not queuing the job");
|
|
2162
2199
|
args.onClose?.();
|
|
2163
2200
|
process.exit(0);
|
|
2164
2201
|
}
|
|
2165
2202
|
return gate.decision === "approve" ? gate.entries : [];
|
|
2166
2203
|
} catch (err) {
|
|
2167
|
-
|
|
2204
|
+
log6.error(err instanceof Error ? err.message : String(err));
|
|
2168
2205
|
args.onClose?.();
|
|
2169
2206
|
process.exit(1);
|
|
2170
2207
|
}
|
|
@@ -2420,6 +2457,22 @@ async function peekCodexCwd(file) {
|
|
|
2420
2457
|
}
|
|
2421
2458
|
return null;
|
|
2422
2459
|
}
|
|
2460
|
+
var CWD_REWRITE_TYPES = /* @__PURE__ */ new Set(["session_meta", "turn_context"]);
|
|
2461
|
+
function rewriteHostPath(s, hostCwd) {
|
|
2462
|
+
if (s === hostCwd) return BOX_WORKSPACE;
|
|
2463
|
+
if (s.startsWith(hostCwd + "/")) return BOX_WORKSPACE + s.slice(hostCwd.length);
|
|
2464
|
+
return s;
|
|
2465
|
+
}
|
|
2466
|
+
function deepRewriteHostPaths(value, hostCwd) {
|
|
2467
|
+
if (typeof value === "string") return rewriteHostPath(value, hostCwd);
|
|
2468
|
+
if (Array.isArray(value)) return value.map((v) => deepRewriteHostPaths(v, hostCwd));
|
|
2469
|
+
if (value && typeof value === "object") {
|
|
2470
|
+
const o = value;
|
|
2471
|
+
for (const k of Object.keys(o)) o[k] = deepRewriteHostPaths(o[k], hostCwd);
|
|
2472
|
+
return o;
|
|
2473
|
+
}
|
|
2474
|
+
return value;
|
|
2475
|
+
}
|
|
2423
2476
|
async function rewriteCodexSession(src, dst, hostCwd) {
|
|
2424
2477
|
const raw = await readFile4(src, "utf8");
|
|
2425
2478
|
const lines = raw.split("\n");
|
|
@@ -2438,13 +2491,10 @@ async function rewriteCodexSession(src, dst, hostCwd) {
|
|
|
2438
2491
|
}
|
|
2439
2492
|
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
2440
2493
|
const obj = parsed;
|
|
2441
|
-
if (obj.type === "
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
out.push(JSON.stringify(obj));
|
|
2446
|
-
continue;
|
|
2447
|
-
}
|
|
2494
|
+
if (typeof obj.type === "string" && CWD_REWRITE_TYPES.has(obj.type) && obj.payload && typeof obj.payload === "object" && !Array.isArray(obj.payload)) {
|
|
2495
|
+
obj.payload = deepRewriteHostPaths(obj.payload, hostCwd);
|
|
2496
|
+
out.push(JSON.stringify(obj));
|
|
2497
|
+
continue;
|
|
2448
2498
|
}
|
|
2449
2499
|
}
|
|
2450
2500
|
out.push(line);
|
|
@@ -2528,7 +2578,7 @@ async function resolvePlanTeleport(opts) {
|
|
|
2528
2578
|
}
|
|
2529
2579
|
|
|
2530
2580
|
// src/lib/install-hint.ts
|
|
2531
|
-
import { log as
|
|
2581
|
+
import { log as log7 } from "@clack/prompts";
|
|
2532
2582
|
import { existsSync as existsSync4, mkdirSync, writeFileSync } from "fs";
|
|
2533
2583
|
import { homedir as homedir7 } from "os";
|
|
2534
2584
|
import { join as join10 } from "path";
|
|
@@ -2540,7 +2590,7 @@ function maybeShowInstallHint() {
|
|
|
2540
2590
|
if (existsSync4(marker)) return;
|
|
2541
2591
|
mkdirSync(join10(homedir7(), ".agentbox"), { recursive: true });
|
|
2542
2592
|
writeFileSync(marker, "");
|
|
2543
|
-
|
|
2593
|
+
log7.info("tip: run 'agentbox install' to enable the /agentbox fork command in host Claude");
|
|
2544
2594
|
} catch {
|
|
2545
2595
|
}
|
|
2546
2596
|
}
|
|
@@ -2730,13 +2780,13 @@ import { basename as basename2 } from "path";
|
|
|
2730
2780
|
async function cloudBackendForProvider(provider) {
|
|
2731
2781
|
switch (provider) {
|
|
2732
2782
|
case "daytona":
|
|
2733
|
-
return (await import("./dist-
|
|
2783
|
+
return (await import("./dist-FTCDWRAL.js")).daytonaBackend;
|
|
2734
2784
|
case "hetzner":
|
|
2735
|
-
return (await import("./dist-
|
|
2785
|
+
return (await import("./dist-PRDYMXCX.js")).hetznerBackend;
|
|
2736
2786
|
case "vercel":
|
|
2737
|
-
return (await import("./dist-
|
|
2787
|
+
return (await import("./dist-VQSZVBT3.js")).vercelBackend;
|
|
2738
2788
|
case "e2b":
|
|
2739
|
-
return (await import("./dist-
|
|
2789
|
+
return (await import("./dist-U2BHTWG4.js")).e2bBackend;
|
|
2740
2790
|
default:
|
|
2741
2791
|
return null;
|
|
2742
2792
|
}
|
|
@@ -2744,13 +2794,13 @@ async function cloudBackendForProvider(provider) {
|
|
|
2744
2794
|
async function currentCloudBaseFingerprintLive(provider) {
|
|
2745
2795
|
switch (provider) {
|
|
2746
2796
|
case "daytona":
|
|
2747
|
-
return (await import("./dist-
|
|
2797
|
+
return (await import("./dist-FTCDWRAL.js")).currentDaytonaBaseFingerprintLive();
|
|
2748
2798
|
case "hetzner":
|
|
2749
|
-
return (await import("./dist-
|
|
2799
|
+
return (await import("./dist-PRDYMXCX.js")).currentHetznerBaseFingerprintLive();
|
|
2750
2800
|
case "vercel":
|
|
2751
|
-
return (await import("./dist-
|
|
2801
|
+
return (await import("./dist-VQSZVBT3.js")).currentVercelBaseFingerprintLive();
|
|
2752
2802
|
case "e2b":
|
|
2753
|
-
return (await import("./dist-
|
|
2803
|
+
return (await import("./dist-U2BHTWG4.js")).currentE2bBaseFingerprintLive();
|
|
2754
2804
|
default:
|
|
2755
2805
|
return void 0;
|
|
2756
2806
|
}
|
|
@@ -3026,7 +3076,7 @@ function passthroughFlags(opts) {
|
|
|
3026
3076
|
}
|
|
3027
3077
|
|
|
3028
3078
|
// src/commands/prepare.ts
|
|
3029
|
-
import { intro, log as
|
|
3079
|
+
import { intro, log as log10, spinner as spinner3 } from "@clack/prompts";
|
|
3030
3080
|
import { Command as Command2 } from "commander";
|
|
3031
3081
|
async function dockerStatus() {
|
|
3032
3082
|
let img;
|
|
@@ -3089,7 +3139,7 @@ async function renderDocker(status) {
|
|
|
3089
3139
|
}
|
|
3090
3140
|
async function daytonaStatus() {
|
|
3091
3141
|
try {
|
|
3092
|
-
const mod = await import("./dist-
|
|
3142
|
+
const mod = await import("./dist-FTCDWRAL.js");
|
|
3093
3143
|
return await mod.getDaytonaStatus();
|
|
3094
3144
|
} catch (err) {
|
|
3095
3145
|
return {
|
|
@@ -3100,7 +3150,7 @@ async function daytonaStatus() {
|
|
|
3100
3150
|
}
|
|
3101
3151
|
async function e2bStatus() {
|
|
3102
3152
|
try {
|
|
3103
|
-
const mod = await import("./dist-
|
|
3153
|
+
const mod = await import("./dist-U2BHTWG4.js");
|
|
3104
3154
|
const cred = mod.readE2bCredStatus();
|
|
3105
3155
|
if (cred.auth === "none") {
|
|
3106
3156
|
return { configured: false, reason: "not configured \u2014 run `agentbox e2b login`" };
|
|
@@ -3210,7 +3260,7 @@ async function runPrepare(providerName, opts = {}) {
|
|
|
3210
3260
|
}
|
|
3211
3261
|
const provider = await getProvider(providerName);
|
|
3212
3262
|
if (typeof provider.prepare !== "function") {
|
|
3213
|
-
|
|
3263
|
+
log10.error(`provider '${providerName}' does not implement prepare`);
|
|
3214
3264
|
process.exit(1);
|
|
3215
3265
|
}
|
|
3216
3266
|
const cwd = opts.cwd ?? process.cwd();
|
|
@@ -3231,10 +3281,10 @@ async function runPrepare(providerName, opts = {}) {
|
|
|
3231
3281
|
const configKey = boxImageConfigKey(providerName);
|
|
3232
3282
|
try {
|
|
3233
3283
|
const written = await setConfigValue("project", configKey, result.snapshotName, cwd);
|
|
3234
|
-
|
|
3284
|
+
log10.success(`${configKey} = ${result.snapshotName} (written to ${written.path})`);
|
|
3235
3285
|
} catch (err) {
|
|
3236
3286
|
const msg = err instanceof Error ? err.message : String(err);
|
|
3237
|
-
|
|
3287
|
+
log10.warn(
|
|
3238
3288
|
`prepared snapshot '${result.snapshotName}', but failed to pin it into the project config: ${msg}
|
|
3239
3289
|
Run \`agentbox config set --project ${configKey} ${result.snapshotName}\` manually.`
|
|
3240
3290
|
);
|
|
@@ -3248,24 +3298,19 @@ Run \`agentbox config set --project ${configKey} ${result.snapshotName}\` manual
|
|
|
3248
3298
|
if (typeof projectImage === "string" && projectImage.length > 0 && projectImage !== DEFAULT_BOX_IMAGE) {
|
|
3249
3299
|
const cleared = await unsetConfigValue("project", "box.image", cwd);
|
|
3250
3300
|
if (cleared.existed) {
|
|
3251
|
-
|
|
3301
|
+
log10.warn(
|
|
3252
3302
|
`migrated stale \`box.image\` from a previous prepare (was \`${projectImage}\`); re-set manually if you actually meant it: \`agentbox config set --project box.image <ref>\``
|
|
3253
3303
|
);
|
|
3254
3304
|
}
|
|
3255
3305
|
}
|
|
3256
3306
|
} catch (err) {
|
|
3257
3307
|
const msg = err instanceof Error ? err.message : String(err);
|
|
3258
|
-
|
|
3308
|
+
log10.warn(`could not migrate stale box.image (continuing): ${msg}`);
|
|
3259
3309
|
}
|
|
3260
3310
|
if (!opts.suppressStatus) {
|
|
3261
3311
|
process.stdout.write("\n");
|
|
3262
3312
|
await showStatus({ onlyProvider: providerName });
|
|
3263
3313
|
}
|
|
3264
|
-
if (!opts.suppressTip) {
|
|
3265
|
-
log9.info(
|
|
3266
|
-
"tip: install the agentbox host skill so Claude Code on this machine can drive AgentBox for you:\n npx skills add https://github.com/madarco/agentbox --skill agentbox"
|
|
3267
|
-
);
|
|
3268
|
-
}
|
|
3269
3314
|
} catch (err) {
|
|
3270
3315
|
sp.stop(`prepare failed: ${describeError(err)}`);
|
|
3271
3316
|
throw err;
|
|
@@ -3357,7 +3402,8 @@ async function attachClaudeWrapped(box, sessionName, reattach, onError, openIn)
|
|
|
3357
3402
|
detachNotice: formatDetachNotice(reattach),
|
|
3358
3403
|
onError,
|
|
3359
3404
|
openIn,
|
|
3360
|
-
onPasteImage: canPaste ? () => pasteHostClipboardImage(provider, box) : void 0
|
|
3405
|
+
onPasteImage: canPaste ? () => pasteHostClipboardImage(provider, box) : void 0,
|
|
3406
|
+
onPasteImageFile: canPaste ? (p) => uploadImageFileToBox(provider, box, p) : void 0
|
|
3361
3407
|
});
|
|
3362
3408
|
process.exit(code);
|
|
3363
3409
|
}
|
|
@@ -3680,7 +3726,6 @@ var claudeCommand = new Command3("claude").description("Create a sandboxed box a
|
|
|
3680
3726
|
await runPrepare(providerName, {
|
|
3681
3727
|
force: true,
|
|
3682
3728
|
cwd: opts.workspace,
|
|
3683
|
-
suppressTip: true,
|
|
3684
3729
|
suppressStatus: true
|
|
3685
3730
|
});
|
|
3686
3731
|
}
|
|
@@ -3736,14 +3781,16 @@ var claudeCommand = new Command3("claude").description("Create a sandboxed box a
|
|
|
3736
3781
|
limits: resolveLimits(cfg.effective.box, opts),
|
|
3737
3782
|
fromBranch,
|
|
3738
3783
|
useBranch,
|
|
3784
|
+
resyncOnStart: opts.resync,
|
|
3739
3785
|
projectRoot
|
|
3740
3786
|
},
|
|
3741
3787
|
binary: "claude",
|
|
3788
|
+
hasSeedPrompt: Boolean(planPrepared) || wiz.action === "launch-with-prompt" && Boolean(wiz.initialPrompt) || Boolean(resumePrepared),
|
|
3742
3789
|
sessionName: cfg.effective.claude.sessionName,
|
|
3743
3790
|
mode: "claude",
|
|
3744
3791
|
extraArgs: effectiveClaudeArgs,
|
|
3745
3792
|
verbose: opts.verbose === true,
|
|
3746
|
-
openIn: cfg
|
|
3793
|
+
openIn: hostAwareOpenIn(cfg),
|
|
3747
3794
|
attach: opts.attach !== false,
|
|
3748
3795
|
beforeStart: resumePrepared || planPrepared ? async (box) => {
|
|
3749
3796
|
try {
|
|
@@ -3922,7 +3969,7 @@ ${f.stderr.trim()}`
|
|
|
3922
3969
|
sessionName,
|
|
3923
3970
|
reattachRef(result.record),
|
|
3924
3971
|
(m) => cmdLog.write(m),
|
|
3925
|
-
cfg
|
|
3972
|
+
hostAwareOpenIn(cfg)
|
|
3926
3973
|
);
|
|
3927
3974
|
} catch (err) {
|
|
3928
3975
|
s.stop("failed");
|
|
@@ -3955,7 +4002,7 @@ async function startOrAttachClaude(box, claudeArgs, opts, resumePrepared) {
|
|
|
3955
4002
|
if (opts.resync !== void 0) cliOverrides.box = { resyncOnStart: opts.resync };
|
|
3956
4003
|
const cfg = await loadEffectiveConfig(box.workspacePath, { cliOverrides });
|
|
3957
4004
|
const sessionName = cfg.effective.claude.sessionName;
|
|
3958
|
-
const openIn = cfg
|
|
4005
|
+
const openIn = hostAwareOpenIn(cfg);
|
|
3959
4006
|
const wantAttach = opts.attach !== false;
|
|
3960
4007
|
const resolved = await resolveClaudeAuth(process.env);
|
|
3961
4008
|
const insp = await inspectBox(box.id);
|
|
@@ -4094,7 +4141,7 @@ var claudeAttachCommand = new Command3("attach").description(
|
|
|
4094
4141
|
binary: "claude",
|
|
4095
4142
|
sessionName: opts.sessionName ?? "claude",
|
|
4096
4143
|
mode: "claude",
|
|
4097
|
-
openIn: cfg
|
|
4144
|
+
openIn: hostAwareOpenIn(cfg)
|
|
4098
4145
|
});
|
|
4099
4146
|
return;
|
|
4100
4147
|
}
|
|
@@ -4187,7 +4234,7 @@ var claudeStartCommand = new Command3("start").description(
|
|
|
4187
4234
|
sessionName: opts.sessionName ?? "claude",
|
|
4188
4235
|
mode: "claude",
|
|
4189
4236
|
extraArgs: effectiveClaudeArgs,
|
|
4190
|
-
openIn: cfg
|
|
4237
|
+
openIn: hostAwareOpenIn(cfg)
|
|
4191
4238
|
});
|
|
4192
4239
|
return;
|
|
4193
4240
|
}
|
|
@@ -4562,14 +4609,16 @@ var codexCommand = new Command4("codex").description("Create a sandboxed box and
|
|
|
4562
4609
|
limits: resolveLimits(cfg.effective.box, opts),
|
|
4563
4610
|
fromBranch,
|
|
4564
4611
|
useBranch,
|
|
4612
|
+
resyncOnStart: opts.resync,
|
|
4565
4613
|
projectRoot
|
|
4566
4614
|
},
|
|
4567
4615
|
binary: "codex",
|
|
4568
4616
|
sessionName: cfg.effective.codex.sessionName,
|
|
4569
4617
|
mode: "codex",
|
|
4618
|
+
hasSeedPrompt: Boolean(resumePrepared),
|
|
4570
4619
|
extraArgs: applyCodexSkipPermissions(codexArgs, cfg.effective),
|
|
4571
4620
|
verbose: opts.verbose === true,
|
|
4572
|
-
openIn: cfg
|
|
4621
|
+
openIn: hostAwareOpenIn(cfg),
|
|
4573
4622
|
attach: opts.attach !== false,
|
|
4574
4623
|
beforeStart: resumePrepared ? async (box) => {
|
|
4575
4624
|
try {
|
|
@@ -4699,7 +4748,7 @@ var codexCommand = new Command4("codex").description("Create a sandboxed box and
|
|
|
4699
4748
|
sessionName,
|
|
4700
4749
|
reattachRef(result.record),
|
|
4701
4750
|
(m) => cmdLog.write(m),
|
|
4702
|
-
cfg
|
|
4751
|
+
hostAwareOpenIn(cfg)
|
|
4703
4752
|
);
|
|
4704
4753
|
} catch (err) {
|
|
4705
4754
|
s.stop("failed");
|
|
@@ -4732,7 +4781,7 @@ async function startOrAttachCodex(box, codexArgs, opts, resumePrepared) {
|
|
|
4732
4781
|
if (opts.resync !== void 0) cliOverrides.box = { resyncOnStart: opts.resync };
|
|
4733
4782
|
const cfg = await loadEffectiveConfig(box.workspacePath, { cliOverrides });
|
|
4734
4783
|
const sessionName = cfg.effective.codex.sessionName;
|
|
4735
|
-
const openIn = cfg
|
|
4784
|
+
const openIn = hostAwareOpenIn(cfg);
|
|
4736
4785
|
const wantAttach = opts.attach !== false;
|
|
4737
4786
|
const insp = await inspectBox(box.id);
|
|
4738
4787
|
if (insp.state === "missing") {
|
|
@@ -4844,7 +4893,7 @@ var codexAttachCommand = new Command4("attach").description(
|
|
|
4844
4893
|
binary: "codex",
|
|
4845
4894
|
sessionName: opts.sessionName ?? "codex",
|
|
4846
4895
|
mode: "codex",
|
|
4847
|
-
openIn: cfg
|
|
4896
|
+
openIn: hostAwareOpenIn(cfg)
|
|
4848
4897
|
});
|
|
4849
4898
|
return;
|
|
4850
4899
|
}
|
|
@@ -4937,7 +4986,7 @@ var codexStartCommand = new Command4("start").description(
|
|
|
4937
4986
|
sessionName: opts.sessionName ?? "codex",
|
|
4938
4987
|
mode: "codex",
|
|
4939
4988
|
extraArgs: effectiveCodexArgs,
|
|
4940
|
-
openIn: cfg
|
|
4989
|
+
openIn: hostAwareOpenIn(cfg)
|
|
4941
4990
|
});
|
|
4942
4991
|
return;
|
|
4943
4992
|
}
|
|
@@ -5298,14 +5347,18 @@ var opencodeCommand = new Command5("opencode").description("Create a sandboxed b
|
|
|
5298
5347
|
limits: resolveLimits(cfg.effective.box, opts),
|
|
5299
5348
|
fromBranch,
|
|
5300
5349
|
useBranch,
|
|
5350
|
+
resyncOnStart: opts.resync,
|
|
5301
5351
|
projectRoot
|
|
5302
5352
|
},
|
|
5303
5353
|
binary: "opencode",
|
|
5304
5354
|
sessionName: cfg.effective.opencode.sessionName,
|
|
5305
5355
|
mode: "opencode",
|
|
5356
|
+
// opencode surfaces the resync warning on stderr (matches its docker
|
|
5357
|
+
// path, which never injects it as an opening turn).
|
|
5358
|
+
hasSeedPrompt: true,
|
|
5306
5359
|
extraArgs: opencodeArgs,
|
|
5307
5360
|
verbose: opts.verbose === true,
|
|
5308
|
-
openIn: cfg
|
|
5361
|
+
openIn: hostAwareOpenIn(cfg),
|
|
5309
5362
|
attach: opts.attach !== false
|
|
5310
5363
|
});
|
|
5311
5364
|
return;
|
|
@@ -5385,7 +5438,7 @@ var opencodeCommand = new Command5("opencode").description("Create a sandboxed b
|
|
|
5385
5438
|
sessionName,
|
|
5386
5439
|
reattachRef(result.record),
|
|
5387
5440
|
(m) => cmdLog.write(m),
|
|
5388
|
-
cfg
|
|
5441
|
+
hostAwareOpenIn(cfg)
|
|
5389
5442
|
);
|
|
5390
5443
|
} catch (err) {
|
|
5391
5444
|
s.stop("failed");
|
|
@@ -5412,7 +5465,7 @@ async function startOrAttachOpencode(box, opencodeArgs, opts) {
|
|
|
5412
5465
|
if (opts.resync !== void 0) cliOverrides.box = { resyncOnStart: opts.resync };
|
|
5413
5466
|
const cfg = await loadEffectiveConfig(box.workspacePath, { cliOverrides });
|
|
5414
5467
|
const sessionName = cfg.effective.opencode.sessionName;
|
|
5415
|
-
const openIn = cfg
|
|
5468
|
+
const openIn = hostAwareOpenIn(cfg);
|
|
5416
5469
|
const wantAttach = opts.attach !== false;
|
|
5417
5470
|
const insp = await inspectBox(box.id);
|
|
5418
5471
|
if (insp.state === "missing") {
|
|
@@ -5492,7 +5545,7 @@ var opencodeAttachCommand = new Command5("attach").description(
|
|
|
5492
5545
|
binary: "opencode",
|
|
5493
5546
|
sessionName: opts.sessionName ?? "opencode",
|
|
5494
5547
|
mode: "opencode",
|
|
5495
|
-
openIn: cfg
|
|
5548
|
+
openIn: hostAwareOpenIn(cfg)
|
|
5496
5549
|
});
|
|
5497
5550
|
return;
|
|
5498
5551
|
}
|
|
@@ -5560,7 +5613,7 @@ var opencodeStartCommand = new Command5("start").description(
|
|
|
5560
5613
|
sessionName: opts.sessionName ?? "opencode",
|
|
5561
5614
|
mode: "opencode",
|
|
5562
5615
|
extraArgs: effectiveOpencodeArgs,
|
|
5563
|
-
openIn: cfg
|
|
5616
|
+
openIn: hostAwareOpenIn(cfg)
|
|
5564
5617
|
});
|
|
5565
5618
|
return;
|
|
5566
5619
|
}
|
|
@@ -5732,7 +5785,7 @@ var attachCommand = new Command6("attach").description(
|
|
|
5732
5785
|
const isCloud = (box.provider ?? "docker") !== "docker";
|
|
5733
5786
|
const sessions = isCloud ? await probeCloudAgentSessions(box, opts.sessionName) : await probeDockerAgentSessions(box.container, opts.sessionName);
|
|
5734
5787
|
if (sessions.length === 0) {
|
|
5735
|
-
|
|
5788
|
+
log14.warn(`no agent session running in ${box.name}`);
|
|
5736
5789
|
process.exit(1);
|
|
5737
5790
|
}
|
|
5738
5791
|
const winner = await pickSession(box.name, sessions);
|
|
@@ -5747,7 +5800,7 @@ var attachCommand = new Command6("attach").description(
|
|
|
5747
5800
|
binary: winner.kind,
|
|
5748
5801
|
sessionName: winner.sessionName,
|
|
5749
5802
|
mode: winner.kind,
|
|
5750
|
-
openIn: cfg2
|
|
5803
|
+
openIn: hostAwareOpenIn(cfg2)
|
|
5751
5804
|
});
|
|
5752
5805
|
return;
|
|
5753
5806
|
}
|
|
@@ -5755,7 +5808,7 @@ var attachCommand = new Command6("attach").description(
|
|
|
5755
5808
|
const cfg = await loadEffectiveConfig(box.workspacePath, {
|
|
5756
5809
|
cliOverrides: attachIn ? { attach: { openIn: attachIn } } : {}
|
|
5757
5810
|
});
|
|
5758
|
-
await dispatchDocker(box, winner, cfg
|
|
5811
|
+
await dispatchDocker(box, winner, hostAwareOpenIn(cfg));
|
|
5759
5812
|
} catch (err) {
|
|
5760
5813
|
handleLifecycleError(err);
|
|
5761
5814
|
}
|
|
@@ -5768,13 +5821,13 @@ var CLOUD_BACKENDS = ["daytona", "hetzner", "vercel", "e2b"];
|
|
|
5768
5821
|
async function cloudProviderFor(backend) {
|
|
5769
5822
|
switch (backend) {
|
|
5770
5823
|
case "daytona":
|
|
5771
|
-
return (await import("./dist-
|
|
5824
|
+
return (await import("./dist-FTCDWRAL.js")).daytonaProvider;
|
|
5772
5825
|
case "hetzner":
|
|
5773
|
-
return (await import("./dist-
|
|
5826
|
+
return (await import("./dist-PRDYMXCX.js")).hetznerProvider;
|
|
5774
5827
|
case "vercel":
|
|
5775
|
-
return (await import("./dist-
|
|
5828
|
+
return (await import("./dist-VQSZVBT3.js")).vercelProvider;
|
|
5776
5829
|
case "e2b":
|
|
5777
|
-
return (await import("./dist-
|
|
5830
|
+
return (await import("./dist-U2BHTWG4.js")).e2bProvider;
|
|
5778
5831
|
}
|
|
5779
5832
|
}
|
|
5780
5833
|
var CHECKPOINT_NOTICE = "Checkpoint in progress \u2014 the box will be unresponsive for a moment";
|
|
@@ -6138,7 +6191,7 @@ var checkpointCommand = new Command7("checkpoint").alias("checkpoints").descript
|
|
|
6138
6191
|
|
|
6139
6192
|
// src/commands/code.ts
|
|
6140
6193
|
import { spawn } from "child_process";
|
|
6141
|
-
import { log as
|
|
6194
|
+
import { log as log16 } from "@clack/prompts";
|
|
6142
6195
|
import { Command as Command8, InvalidArgumentError } from "commander";
|
|
6143
6196
|
|
|
6144
6197
|
// src/ssh-config.ts
|
|
@@ -6279,11 +6332,11 @@ var codeCommand = new Command8("code").description("Open a box in VS Code or Cur
|
|
|
6279
6332
|
}
|
|
6280
6333
|
const exit = await launchIde(folderUri, forcedIde);
|
|
6281
6334
|
if (exit.code !== 0) {
|
|
6282
|
-
|
|
6335
|
+
log16.error(`failed to launch ${exit.flavor ? ideProfile(exit.flavor).displayName : "IDE"} via ${exit.via} (exit ${String(exit.code)})`);
|
|
6283
6336
|
process.stdout.write(folderUri + "\n");
|
|
6284
6337
|
process.exit(1);
|
|
6285
6338
|
}
|
|
6286
|
-
|
|
6339
|
+
log16.success(
|
|
6287
6340
|
`opening ${box.name} in ${ideProfile(exit.flavor).displayName} (${exit.via})`
|
|
6288
6341
|
);
|
|
6289
6342
|
} catch (err) {
|
|
@@ -6293,10 +6346,10 @@ var codeCommand = new Command8("code").description("Open a box in VS Code or Cur
|
|
|
6293
6346
|
async function prepareDockerAttach(box, opts) {
|
|
6294
6347
|
const insp = await inspectBox(box.id);
|
|
6295
6348
|
if (insp.state === "paused") {
|
|
6296
|
-
|
|
6349
|
+
log16.info(`box is paused; unpausing`);
|
|
6297
6350
|
await unpauseBox(box.id);
|
|
6298
6351
|
} else if (insp.state === "stopped") {
|
|
6299
|
-
|
|
6352
|
+
log16.info(`box is stopped; starting`);
|
|
6300
6353
|
await startBox(box.id);
|
|
6301
6354
|
} else if (insp.state === "missing") {
|
|
6302
6355
|
throw new Error(`box ${box.name} has no container; was it destroyed?`);
|
|
@@ -6307,9 +6360,9 @@ async function prepareDockerAttach(box, opts) {
|
|
|
6307
6360
|
const lines = [];
|
|
6308
6361
|
if (reply.timedOut.length > 0) lines.push(`timed out: ${reply.timedOut.join(", ")}`);
|
|
6309
6362
|
if (reply.failed.length > 0) lines.push(`failed: ${reply.failed.join(", ")}`);
|
|
6310
|
-
|
|
6363
|
+
log16.warn(`box not fully ready (${lines.join("; ")}). Opening anyway.`);
|
|
6311
6364
|
} else {
|
|
6312
|
-
|
|
6365
|
+
log16.success("all units ready");
|
|
6313
6366
|
}
|
|
6314
6367
|
}
|
|
6315
6368
|
if (opts.autoTerminals) {
|
|
@@ -6319,14 +6372,14 @@ async function prepareDockerAttach(box, opts) {
|
|
|
6319
6372
|
regen: opts.regenTasks
|
|
6320
6373
|
});
|
|
6321
6374
|
if (r.status === "wrote") {
|
|
6322
|
-
|
|
6375
|
+
log16.info(`wrote /workspace/.vscode/tasks.json (${String(services.length)} service(s))`);
|
|
6323
6376
|
} else if (r.status === "skipped-user-owned") {
|
|
6324
|
-
|
|
6377
|
+
log16.warn(
|
|
6325
6378
|
"user-owned .vscode/tasks.json detected; skipping auto-terminals (pass --regen-tasks to overwrite)"
|
|
6326
6379
|
);
|
|
6327
6380
|
}
|
|
6328
6381
|
} catch (err) {
|
|
6329
|
-
|
|
6382
|
+
log16.warn(
|
|
6330
6383
|
`auto-terminals failed: ${err instanceof Error ? err.message : String(err)}`
|
|
6331
6384
|
);
|
|
6332
6385
|
}
|
|
@@ -6338,10 +6391,10 @@ async function prepareCloudAttach(box, opts) {
|
|
|
6338
6391
|
const p = await providerForBox(box);
|
|
6339
6392
|
const state = await p.probeState(box);
|
|
6340
6393
|
if (state === "paused") {
|
|
6341
|
-
|
|
6394
|
+
log16.info("box is paused; resuming");
|
|
6342
6395
|
await p.resume(box);
|
|
6343
6396
|
} else if (state === "stopped") {
|
|
6344
|
-
|
|
6397
|
+
log16.info("box is stopped; starting");
|
|
6345
6398
|
await p.start(box);
|
|
6346
6399
|
} else if (state === "missing") {
|
|
6347
6400
|
throw new Error(`cloud sandbox for ${box.name} is missing; was it deleted?`);
|
|
@@ -6354,12 +6407,12 @@ async function prepareCloudAttach(box, opts) {
|
|
|
6354
6407
|
const lines = [];
|
|
6355
6408
|
if (reply.timedOut.length > 0) lines.push(`timed out: ${reply.timedOut.join(", ")}`);
|
|
6356
6409
|
if (reply.failed.length > 0) lines.push(`failed: ${reply.failed.join(", ")}`);
|
|
6357
|
-
|
|
6410
|
+
log16.warn(`box not fully ready (${lines.join("; ")}). Opening anyway.`);
|
|
6358
6411
|
} else {
|
|
6359
|
-
|
|
6412
|
+
log16.success("all units ready");
|
|
6360
6413
|
}
|
|
6361
6414
|
} catch (err) {
|
|
6362
|
-
|
|
6415
|
+
log16.warn(`wait-ready failed (continuing): ${err instanceof Error ? err.message : String(err)}`);
|
|
6363
6416
|
}
|
|
6364
6417
|
}
|
|
6365
6418
|
if (!p.buildAttach) {
|
|
@@ -6381,7 +6434,7 @@ async function prepareCloudAttach(box, opts) {
|
|
|
6381
6434
|
user: target.user,
|
|
6382
6435
|
identityFile: target.identityFile
|
|
6383
6436
|
});
|
|
6384
|
-
|
|
6437
|
+
log16.info(`updated ~/.ssh/config alias ${alias}`);
|
|
6385
6438
|
return `vscode-remote://ssh-remote+${alias}/workspace`;
|
|
6386
6439
|
}
|
|
6387
6440
|
async function runWaitReadyDocker(container, timeoutMs) {
|
|
@@ -6406,7 +6459,7 @@ async function launchIde(folderUri, forced) {
|
|
|
6406
6459
|
if (code !== null) return code;
|
|
6407
6460
|
const cursor = await tryCli("cursor", folderUri);
|
|
6408
6461
|
if (cursor !== null) return cursor;
|
|
6409
|
-
|
|
6462
|
+
log16.warn("neither `code` nor `cursor` found in PATH; falling back to `open vscode://...`");
|
|
6410
6463
|
return launchOne("vscode", folderUri);
|
|
6411
6464
|
}
|
|
6412
6465
|
async function tryCli(flavor, folderUri) {
|
|
@@ -6419,7 +6472,7 @@ async function launchOne(flavor, folderUri) {
|
|
|
6419
6472
|
const profile = ideProfile(flavor);
|
|
6420
6473
|
const cliCode = await spawnCommand(profile.cli, ["--folder-uri", folderUri]);
|
|
6421
6474
|
if (cliCode !== 127) return { code: cliCode, flavor, via: "cli" };
|
|
6422
|
-
|
|
6475
|
+
log16.warn(
|
|
6423
6476
|
`\`${profile.cli}\` not found in PATH; falling back to \`${hostOpenCommand()} ${profile.protocolScheme}://...\` (the %2B URL-encoding bug may break attach)`
|
|
6424
6477
|
);
|
|
6425
6478
|
const url = `${profile.protocolScheme}://${folderUri.replace(/^vscode-remote:\/\//, "vscode-remote/")}`;
|
|
@@ -6723,7 +6776,7 @@ var configCommand = new Command9("config").description("Read / write layered con
|
|
|
6723
6776
|
|
|
6724
6777
|
// src/commands/cp.ts
|
|
6725
6778
|
import { resolve as resolve3 } from "path";
|
|
6726
|
-
import { log as
|
|
6779
|
+
import { log as log17 } from "@clack/prompts";
|
|
6727
6780
|
import { Command as Command10 } from "commander";
|
|
6728
6781
|
function collectExclude(val, acc) {
|
|
6729
6782
|
acc.push(val);
|
|
@@ -6859,10 +6912,10 @@ var cpCommand = new Command10("cp").description("Copy files between host and box
|
|
|
6859
6912
|
}
|
|
6860
6913
|
const insp = await inspectBox(box.id);
|
|
6861
6914
|
if (insp.state === "paused") {
|
|
6862
|
-
|
|
6915
|
+
log17.info("box is paused; unpausing");
|
|
6863
6916
|
await unpauseBox(box.id);
|
|
6864
6917
|
} else if (insp.state === "stopped") {
|
|
6865
|
-
|
|
6918
|
+
log17.info("box is stopped; starting");
|
|
6866
6919
|
await startBox(box.id);
|
|
6867
6920
|
} else if (insp.state === "missing") {
|
|
6868
6921
|
throw new Error(`box ${box.name} has no container; was it destroyed?`);
|
|
@@ -6870,7 +6923,7 @@ var cpCommand = new Command10("cp").description("Copy files between host and box
|
|
|
6870
6923
|
if (parsed.direction === "upload") {
|
|
6871
6924
|
const result = await uploadToBox(box, parsed.hostPath, parsed.boxPath, tarPatterns);
|
|
6872
6925
|
if (result.warn) {
|
|
6873
|
-
|
|
6926
|
+
log17.warn(`copied to ${box.name}:${result.finalPath}, but ${result.warn}`);
|
|
6874
6927
|
} else {
|
|
6875
6928
|
process.stdout.write(`copied to ${box.name}:${result.finalPath}
|
|
6876
6929
|
`);
|
|
@@ -6891,7 +6944,7 @@ var cpCommand = new Command10("cp").description("Copy files between host and box
|
|
|
6891
6944
|
});
|
|
6892
6945
|
|
|
6893
6946
|
// src/commands/create.ts
|
|
6894
|
-
import { intro as intro6, log as
|
|
6947
|
+
import { intro as intro6, log as log18, outro as outro5 } from "@clack/prompts";
|
|
6895
6948
|
import { Command as Command11 } from "commander";
|
|
6896
6949
|
import { execSync, spawnSync as spawnSync2 } from "child_process";
|
|
6897
6950
|
function buildCliOverrides(opts) {
|
|
@@ -7039,13 +7092,13 @@ var createCommand = new Command11("create").description(
|
|
|
7039
7092
|
onLog: (line) => cmdLog.write(line)
|
|
7040
7093
|
});
|
|
7041
7094
|
if (gate.decision === "cancel") {
|
|
7042
|
-
|
|
7095
|
+
log18.warn("carry: cancelled \u2014 not creating the box");
|
|
7043
7096
|
cmdLog.close();
|
|
7044
7097
|
process.exit(0);
|
|
7045
7098
|
}
|
|
7046
7099
|
if (gate.decision === "approve") carryEntries = gate.entries;
|
|
7047
7100
|
} catch (err) {
|
|
7048
|
-
|
|
7101
|
+
log18.error(err instanceof Error ? err.message : String(err));
|
|
7049
7102
|
cmdLog.close();
|
|
7050
7103
|
process.exit(1);
|
|
7051
7104
|
}
|
|
@@ -7061,11 +7114,10 @@ var createCommand = new Command11("create").description(
|
|
|
7061
7114
|
baseStatus
|
|
7062
7115
|
});
|
|
7063
7116
|
if (wiz.rebuildBase) {
|
|
7064
|
-
|
|
7117
|
+
log18.warn(`${providerName} base image is outdated; rebuilding before create\u2026`);
|
|
7065
7118
|
await runPrepare(providerName, {
|
|
7066
7119
|
force: true,
|
|
7067
7120
|
cwd: opts.workspace,
|
|
7068
|
-
suppressTip: true,
|
|
7069
7121
|
suppressStatus: true
|
|
7070
7122
|
});
|
|
7071
7123
|
}
|
|
@@ -7108,7 +7160,7 @@ var createCommand = new Command11("create").description(
|
|
|
7108
7160
|
} catch (err) {
|
|
7109
7161
|
if (err instanceof FromBranchError || err instanceof UseBranchError) {
|
|
7110
7162
|
s.stop("aborting: invalid branch selection");
|
|
7111
|
-
|
|
7163
|
+
log18.error(err.message);
|
|
7112
7164
|
cmdLog.close();
|
|
7113
7165
|
process.exit(2);
|
|
7114
7166
|
}
|
|
@@ -7153,18 +7205,18 @@ var createCommand = new Command11("create").description(
|
|
|
7153
7205
|
});
|
|
7154
7206
|
s.stop(`box ${result.record.container} ready`);
|
|
7155
7207
|
const createResyncWarning = result.resync ? buildResyncWarning(result.resync) : null;
|
|
7156
|
-
if (createResyncWarning)
|
|
7157
|
-
|
|
7208
|
+
if (createResyncWarning) log18.warn(createResyncWarning);
|
|
7209
|
+
log18.info(`id: ${result.record.id}`);
|
|
7158
7210
|
if (typeof result.record.projectIndex === "number") {
|
|
7159
|
-
|
|
7211
|
+
log18.info(`n: ${String(result.record.projectIndex)} (in ${projectRoot})`);
|
|
7160
7212
|
}
|
|
7161
|
-
|
|
7162
|
-
|
|
7213
|
+
log18.info(`container: ${result.record.container}`);
|
|
7214
|
+
log18.info(`image: ${result.record.image}${result.imageBuilt ? " (built just now)" : ""}`);
|
|
7163
7215
|
if (result.record.snapshotDir) {
|
|
7164
|
-
|
|
7216
|
+
log18.info(`snapshot: ${result.record.snapshotDir}`);
|
|
7165
7217
|
}
|
|
7166
7218
|
if (result.record.checkpointSource) {
|
|
7167
|
-
|
|
7219
|
+
log18.info(
|
|
7168
7220
|
`checkpoint: ${result.record.checkpointSource.ref} (${result.record.checkpointSource.type}) \u2192 ${result.record.checkpointImage ?? "(missing)"}`
|
|
7169
7221
|
);
|
|
7170
7222
|
}
|
|
@@ -7176,7 +7228,7 @@ var createCommand = new Command11("create").description(
|
|
|
7176
7228
|
` agentbox claude attach ${result.record.name}`,
|
|
7177
7229
|
` agentbox url ${result.record.name}`
|
|
7178
7230
|
];
|
|
7179
|
-
|
|
7231
|
+
log18.message(
|
|
7180
7232
|
[
|
|
7181
7233
|
"",
|
|
7182
7234
|
"Try it:",
|
|
@@ -7195,7 +7247,7 @@ var createCommand = new Command11("create").description(
|
|
|
7195
7247
|
const protectedPaths = boxes.map((b) => b.projectRoot).filter((p) => typeof p === "string");
|
|
7196
7248
|
const res = await pruneOrphanProjectConfigs({ protectedPaths });
|
|
7197
7249
|
if (res.removed.length > 0) {
|
|
7198
|
-
|
|
7250
|
+
log18.info(
|
|
7199
7251
|
`cleaned ${String(res.removed.length)} orphan project config dir(s): ` + res.removed.map((r) => r.originalPath).join(", ")
|
|
7200
7252
|
);
|
|
7201
7253
|
}
|
|
@@ -7205,7 +7257,7 @@ var createCommand = new Command11("create").description(
|
|
|
7205
7257
|
}
|
|
7206
7258
|
outro5("done");
|
|
7207
7259
|
if (attachClaudeAfter) {
|
|
7208
|
-
const { cloudAgentAttach: cloudAgentAttach2 } = await import("./_cloud-attach-
|
|
7260
|
+
const { cloudAgentAttach: cloudAgentAttach2 } = await import("./_cloud-attach-YM2KOWHO.js");
|
|
7209
7261
|
await cloudAgentAttach2({
|
|
7210
7262
|
box: result.record,
|
|
7211
7263
|
binary: "claude",
|
|
@@ -7221,14 +7273,14 @@ var createCommand = new Command11("create").description(
|
|
|
7221
7273
|
s.stop("failed");
|
|
7222
7274
|
const msg = err instanceof Error ? err.message : String(err);
|
|
7223
7275
|
cmdLog.write(`FAIL: ${err instanceof Error ? err.stack ?? err.message : String(err)}`);
|
|
7224
|
-
|
|
7276
|
+
log18.error(msg);
|
|
7225
7277
|
try {
|
|
7226
7278
|
const running = execSync('docker ps --format "{{.Names}}"', {
|
|
7227
7279
|
stdio: ["ignore", "pipe", "ignore"]
|
|
7228
7280
|
}).toString().split("\n").filter((n) => n.startsWith("agentbox-"));
|
|
7229
7281
|
if (running.length > 0) {
|
|
7230
|
-
|
|
7231
|
-
|
|
7282
|
+
log18.warn(`leftover containers: ${running.join(", ")}`);
|
|
7283
|
+
log18.warn(`remove with: docker rm -f ${running.join(" ")}`);
|
|
7232
7284
|
}
|
|
7233
7285
|
} catch {
|
|
7234
7286
|
}
|
|
@@ -7241,7 +7293,7 @@ var createCommand = new Command11("create").description(
|
|
|
7241
7293
|
|
|
7242
7294
|
// src/commands/dashboard.ts
|
|
7243
7295
|
import { spawn as spawn2 } from "child_process";
|
|
7244
|
-
import { log as
|
|
7296
|
+
import { log as log19 } from "@clack/prompts";
|
|
7245
7297
|
import { Command as Command12 } from "commander";
|
|
7246
7298
|
|
|
7247
7299
|
// src/dashboard/layout.ts
|
|
@@ -8764,7 +8816,7 @@ function toSidebar(b) {
|
|
|
8764
8816
|
var dashboardCommand = new Command12("dashboard").description("Box list + the selected box live Agent session").argument("[box]", "initial box (default: first running box; -p restricts to the cwd project)").option("-p, --project", "only this project's boxes (default: all boxes globally)").action(async (idOrName, opts) => {
|
|
8765
8817
|
try {
|
|
8766
8818
|
if (!process.stdout.isTTY || !process.stdin.isTTY) {
|
|
8767
|
-
|
|
8819
|
+
log19.error("agentbox dashboard needs an interactive terminal");
|
|
8768
8820
|
process.exit(2);
|
|
8769
8821
|
}
|
|
8770
8822
|
const backend = await loadPtyBackend();
|
|
@@ -8774,10 +8826,10 @@ var dashboardCommand = new Command12("dashboard").description("Box list + the se
|
|
|
8774
8826
|
ptySpawn = backend.ptySpawn;
|
|
8775
8827
|
termCtor = backend.termCtor;
|
|
8776
8828
|
} else {
|
|
8777
|
-
|
|
8829
|
+
log19.error(
|
|
8778
8830
|
"agentbox dashboard is unavailable here (native terminal backend failed to load)"
|
|
8779
8831
|
);
|
|
8780
|
-
|
|
8832
|
+
log19.info("use `agentbox claude` / `agentbox attach` instead");
|
|
8781
8833
|
process.exit(2);
|
|
8782
8834
|
}
|
|
8783
8835
|
const project = await findProjectRoot(process.cwd());
|
|
@@ -9182,11 +9234,11 @@ var dashboardCommand = new Command12("dashboard").description("Box list + the se
|
|
|
9182
9234
|
});
|
|
9183
9235
|
|
|
9184
9236
|
// ../../packages/sandbox-daytona/dist/cli.js
|
|
9185
|
-
import { log as
|
|
9237
|
+
import { log as log20, spinner as spinner7 } from "@clack/prompts";
|
|
9186
9238
|
import { Command as Command13 } from "commander";
|
|
9187
9239
|
function reportError(err) {
|
|
9188
9240
|
const message = err instanceof Error ? err.message : String(err);
|
|
9189
|
-
|
|
9241
|
+
log20.error(message);
|
|
9190
9242
|
process.exitCode = 1;
|
|
9191
9243
|
}
|
|
9192
9244
|
var loginSub = new Command13("login").description("Set up (or rotate) Daytona credentials for cloud boxes").option("--status", "show what is currently configured (masked) and exit").action(async (opts) => {
|
|
@@ -9204,7 +9256,7 @@ var loginSub = new Command13("login").description("Set up (or rotate) Daytona cr
|
|
|
9204
9256
|
}
|
|
9205
9257
|
await ensureDaytonaCredentials({ force: true });
|
|
9206
9258
|
if (readPreparedDaytonaState()?.base === void 0) {
|
|
9207
|
-
|
|
9259
|
+
log20.info(
|
|
9208
9260
|
"Base snapshot not built yet \u2014 run `agentbox prepare --provider daytona` (or `agentbox install`) to bake it."
|
|
9209
9261
|
);
|
|
9210
9262
|
}
|
|
@@ -9250,7 +9302,7 @@ var resyncSub = new Command13("resync").description(
|
|
|
9250
9302
|
const sb = spinner7();
|
|
9251
9303
|
sb.start(`provisioning throwaway sandbox to refresh: ${agents.join(", ")}`);
|
|
9252
9304
|
const ensured = await ensureAgentVolumesForCloud(daytonaBackend, {
|
|
9253
|
-
onLog: (line) =>
|
|
9305
|
+
onLog: (line) => log20.info(line)
|
|
9254
9306
|
});
|
|
9255
9307
|
if (ensured.agents.length === 0) {
|
|
9256
9308
|
sb.stop("no agent volumes available \u2014 the daytona backend has no volume primitive");
|
|
@@ -9290,7 +9342,7 @@ var resyncSub = new Command13("resync").description(
|
|
|
9290
9342
|
}
|
|
9291
9343
|
sb3.stop("throwaway sandbox destroyed");
|
|
9292
9344
|
}
|
|
9293
|
-
|
|
9345
|
+
log20.success(
|
|
9294
9346
|
`Daytona agent volumes refreshed: ${agents.join(", ")}. Next \`agentbox create --provider daytona\` will use the updated credentials.`
|
|
9295
9347
|
);
|
|
9296
9348
|
} catch (err) {
|
|
@@ -9310,11 +9362,11 @@ var dockerCommand = new Command14("docker").description(
|
|
|
9310
9362
|
});
|
|
9311
9363
|
|
|
9312
9364
|
// ../../packages/sandbox-hetzner/dist/cli.js
|
|
9313
|
-
import { log as
|
|
9365
|
+
import { log as log21 } from "@clack/prompts";
|
|
9314
9366
|
import { Command as Command15 } from "commander";
|
|
9315
9367
|
function reportError2(err) {
|
|
9316
9368
|
const message = err instanceof Error ? err.message : String(err);
|
|
9317
|
-
|
|
9369
|
+
log21.error(message);
|
|
9318
9370
|
process.exitCode = 1;
|
|
9319
9371
|
}
|
|
9320
9372
|
var loginSub2 = new Command15("login").description("Set up (or rotate) Hetzner Cloud credentials for VPS boxes").option("--status", "show what is currently configured (masked) and exit").action(async (opts) => {
|
|
@@ -9332,7 +9384,7 @@ var loginSub2 = new Command15("login").description("Set up (or rotate) Hetzner C
|
|
|
9332
9384
|
}
|
|
9333
9385
|
await ensureHetznerCredentials({ force: true });
|
|
9334
9386
|
if (readPreparedState().base === void 0) {
|
|
9335
|
-
|
|
9387
|
+
log21.info(
|
|
9336
9388
|
"Base snapshot not built yet \u2014 run `agentbox prepare --provider hetzner` (or `agentbox install`) to bake it."
|
|
9337
9389
|
);
|
|
9338
9390
|
}
|
|
@@ -9463,11 +9515,11 @@ var hetznerCommand = new Command15("hetzner").description(
|
|
|
9463
9515
|
).addCommand(loginSub2, { isDefault: true }).addCommand(firewallSub);
|
|
9464
9516
|
|
|
9465
9517
|
// ../../packages/sandbox-vercel/dist/cli.js
|
|
9466
|
-
import { log as
|
|
9518
|
+
import { log as log22 } from "@clack/prompts";
|
|
9467
9519
|
import { Command as Command16 } from "commander";
|
|
9468
9520
|
function reportError3(err) {
|
|
9469
9521
|
const message = err instanceof Error ? err.message : String(err);
|
|
9470
|
-
|
|
9522
|
+
log22.error(message);
|
|
9471
9523
|
process.exitCode = 1;
|
|
9472
9524
|
}
|
|
9473
9525
|
function relativeExpiry(expiresAt) {
|
|
@@ -9530,7 +9582,7 @@ var loginSub3 = new Command16("login").description("Set up (or rotate) Vercel cr
|
|
|
9530
9582
|
}
|
|
9531
9583
|
await ensureVercelCredentials({ force: true });
|
|
9532
9584
|
if (readPreparedState2().base === void 0) {
|
|
9533
|
-
|
|
9585
|
+
log22.info(
|
|
9534
9586
|
"Base snapshot not built yet \u2014 run `agentbox prepare --provider vercel` (or `agentbox install`) to bake it."
|
|
9535
9587
|
);
|
|
9536
9588
|
}
|
|
@@ -9543,11 +9595,11 @@ var vercelCommand = new Command16("vercel").description(
|
|
|
9543
9595
|
).addCommand(loginSub3, { isDefault: true });
|
|
9544
9596
|
|
|
9545
9597
|
// ../../packages/sandbox-e2b/dist/cli.js
|
|
9546
|
-
import { log as
|
|
9598
|
+
import { log as log23 } from "@clack/prompts";
|
|
9547
9599
|
import { Command as Command17 } from "commander";
|
|
9548
9600
|
function reportError4(err) {
|
|
9549
9601
|
const message = err instanceof Error ? err.message : String(err);
|
|
9550
|
-
|
|
9602
|
+
log23.error(message);
|
|
9551
9603
|
process.exitCode = 1;
|
|
9552
9604
|
}
|
|
9553
9605
|
function printStatus4() {
|
|
@@ -9579,7 +9631,7 @@ var loginSub4 = new Command17("login").description("Set up (or rotate) E2B crede
|
|
|
9579
9631
|
}
|
|
9580
9632
|
await ensureE2bCredentials({ force: true });
|
|
9581
9633
|
if (readPreparedState3().base === void 0) {
|
|
9582
|
-
|
|
9634
|
+
log23.info(
|
|
9583
9635
|
"Base template not built yet \u2014 run `agentbox prepare --provider e2b` (or `agentbox install`) to bake it."
|
|
9584
9636
|
);
|
|
9585
9637
|
}
|
|
@@ -10133,7 +10185,7 @@ downloadCommand.addCommand(downloadOpencodeCommand);
|
|
|
10133
10185
|
downloadCommand.addCommand(downloadConfigCommand);
|
|
10134
10186
|
|
|
10135
10187
|
// src/commands/drive.ts
|
|
10136
|
-
import { log as
|
|
10188
|
+
import { log as log31 } from "@clack/prompts";
|
|
10137
10189
|
import { Command as Command25 } from "commander";
|
|
10138
10190
|
|
|
10139
10191
|
// src/lib/drive/keys.ts
|
|
@@ -10316,7 +10368,7 @@ var driveWaitCommand = new Command25("wait").description("Block until --text app
|
|
|
10316
10368
|
}) + "\n"
|
|
10317
10369
|
);
|
|
10318
10370
|
} else {
|
|
10319
|
-
|
|
10371
|
+
log31.error(`text not found within ${String(timeoutMs)}ms: ${opts.text}`);
|
|
10320
10372
|
}
|
|
10321
10373
|
process.exit(1);
|
|
10322
10374
|
} catch (err) {
|
|
@@ -10343,8 +10395,8 @@ driveCommand.addCommand(driveWaitCommand);
|
|
|
10343
10395
|
driveCommand.addCommand(driveResizeCommand);
|
|
10344
10396
|
function handleDriveError(err) {
|
|
10345
10397
|
if (err instanceof SessionNotFoundError) {
|
|
10346
|
-
|
|
10347
|
-
|
|
10398
|
+
log31.error(err.message);
|
|
10399
|
+
log31.info("start an agent first (e.g. `agentbox claude <box>`) or pass --session.");
|
|
10348
10400
|
process.exit(2);
|
|
10349
10401
|
}
|
|
10350
10402
|
handleLifecycleError(err);
|
|
@@ -10368,12 +10420,32 @@ function sleep3(ms) {
|
|
|
10368
10420
|
}
|
|
10369
10421
|
|
|
10370
10422
|
// src/commands/fork.ts
|
|
10371
|
-
import { log as
|
|
10423
|
+
import { log as log32 } from "@clack/prompts";
|
|
10372
10424
|
import { Command as Command26 } from "commander";
|
|
10373
10425
|
import { existsSync as existsSync5, readdirSync, statSync } from "fs";
|
|
10374
10426
|
import { homedir as homedir12 } from "os";
|
|
10375
10427
|
import { join as join15 } from "path";
|
|
10376
10428
|
var FORK_AGENTS = ["claude", "codex", "opencode"];
|
|
10429
|
+
var FORK_PROVIDERS = ["docker", "daytona", "hetzner", "vercel", "e2b"];
|
|
10430
|
+
function resolveForkProvider(positional, flag) {
|
|
10431
|
+
const pos = positional?.trim();
|
|
10432
|
+
const fl = flag?.trim();
|
|
10433
|
+
if (pos && fl && pos !== fl) {
|
|
10434
|
+
throw new Error(`provider given twice: "${pos}" (positional) and --provider "${fl}" \u2014 pass it once.`);
|
|
10435
|
+
}
|
|
10436
|
+
const provider = fl || pos;
|
|
10437
|
+
if (provider && !FORK_PROVIDERS.includes(provider)) {
|
|
10438
|
+
throw new Error(`provider: expected one of ${FORK_PROVIDERS.join(", ")}, got "${provider}"`);
|
|
10439
|
+
}
|
|
10440
|
+
return provider || void 0;
|
|
10441
|
+
}
|
|
10442
|
+
function detectAgentFromEnv(env = process.env) {
|
|
10443
|
+
if (env.CLAUDECODE === "1" || (env.CLAUDE_CODE_SESSION_ID ?? "").trim().length > 0) {
|
|
10444
|
+
return "claude";
|
|
10445
|
+
}
|
|
10446
|
+
if ((env.CODEX_THREAD_ID ?? "").trim().length > 0) return "codex";
|
|
10447
|
+
return void 0;
|
|
10448
|
+
}
|
|
10377
10449
|
var AGENT_COMMAND = {
|
|
10378
10450
|
claude: claudeCommand,
|
|
10379
10451
|
codex: codexCommand,
|
|
@@ -10422,16 +10494,19 @@ function resolveAttachArgs(attachIn) {
|
|
|
10422
10494
|
return detectHostTerminal() === "unknown" ? ["--no-attach"] : ["--attach-in", attachIn];
|
|
10423
10495
|
}
|
|
10424
10496
|
var forkCommand = new Command26("fork").description(
|
|
10425
|
-
"Fork the current host agent session into a new box and resume it there. Opens the box in a new terminal tab under iTerm/tmux; otherwise starts it in the background."
|
|
10497
|
+
"Fork the current host agent session into a new box and resume it there. Autodetects the agent (Claude / Codex) and the current session from the launching agent's env, so a bare `agentbox fork` forks whatever you ran it from. Opens the box in a new terminal tab under iTerm/tmux; otherwise starts it in the background."
|
|
10498
|
+
).argument(
|
|
10499
|
+
"[provider]",
|
|
10500
|
+
"sandbox backend as a positional shorthand for --provider (e.g. `agentbox fork hetzner`): 'docker' (default), 'daytona', 'hetzner', 'vercel', or 'e2b'"
|
|
10426
10501
|
).option("-w, --workspace <path>", "host workspace to mount", process.cwd()).option(
|
|
10427
10502
|
"--agent <name>",
|
|
10428
|
-
"which agent to fork: claude
|
|
10503
|
+
"which agent to fork: claude, codex, or opencode. Autodetected from env (CLAUDECODE / CODEX_THREAD_ID) when omitted, defaulting to claude. OpenCode starts a fresh box (session resume not supported yet)."
|
|
10429
10504
|
).option(
|
|
10430
10505
|
"--session <id>",
|
|
10431
|
-
"host agent session id to resume (
|
|
10506
|
+
"host agent session id to resume. Autodetected from the launching agent's env (CLAUDE_CODE_SESSION_ID / CODEX_THREAD_ID) when omitted; else the newest session for this cwd (claude refuses if several were used recently). Ignored for --agent opencode."
|
|
10432
10507
|
).option(
|
|
10433
10508
|
"--provider <name>",
|
|
10434
|
-
"sandbox backend: 'docker' (default), 'daytona', 'hetzner', 'vercel', or 'e2b'"
|
|
10509
|
+
"sandbox backend: 'docker' (default), 'daytona', 'hetzner', 'vercel', or 'e2b'. Can also be passed positionally: `agentbox fork hetzner`."
|
|
10435
10510
|
).option("-n, --name <name>", "box name (default: fork-<HHMMSS>)").option(
|
|
10436
10511
|
"--attach-in <mode>",
|
|
10437
10512
|
"where to open the forked session: window | tab | split | background | same (default: tab). Falls back to background outside tmux/iTerm."
|
|
@@ -10442,39 +10517,62 @@ var forkCommand = new Command26("fork").description(
|
|
|
10442
10517
|
).option(
|
|
10443
10518
|
"--plan <path>",
|
|
10444
10519
|
'copy a Claude Code plan file (e.g. ~/.claude/plans/<slug>.md) into the box, start claude in plan mode, and seed a "resume the plan" prompt. Claude only.'
|
|
10445
|
-
).action(async (opts) => {
|
|
10520
|
+
).action(async (providerArg, opts) => {
|
|
10446
10521
|
if ((process.env.AGENTBOX_RELAY_URL ?? "").trim().length > 0) {
|
|
10447
|
-
|
|
10522
|
+
log32.error(
|
|
10448
10523
|
"agentbox fork runs on the host only: it teleports a host agent session into a new box. You appear to be inside a box (AGENTBOX_RELAY_URL is set) \u2014 box\u2192box fork is not supported yet."
|
|
10449
10524
|
);
|
|
10450
10525
|
process.exit(2);
|
|
10451
10526
|
}
|
|
10452
|
-
const agent = opts.agent?.trim() || "claude";
|
|
10527
|
+
const agent = opts.agent?.trim() || detectAgentFromEnv() || "claude";
|
|
10453
10528
|
if (!FORK_AGENTS.includes(agent)) {
|
|
10454
|
-
|
|
10529
|
+
log32.error(`--agent: expected one of ${FORK_AGENTS.join(", ")}, got "${opts.agent ?? ""}"`);
|
|
10455
10530
|
process.exit(2);
|
|
10456
10531
|
}
|
|
10457
10532
|
const attachIn = opts.attachIn ?? "tab";
|
|
10458
10533
|
if (!FORK_ATTACH_VALUES.includes(attachIn)) {
|
|
10459
|
-
|
|
10534
|
+
log32.error(`--attach-in: expected one of ${FORK_ATTACH_VALUES.join(", ")}, got "${attachIn}"`);
|
|
10460
10535
|
process.exit(2);
|
|
10461
10536
|
}
|
|
10462
10537
|
const plan = opts.plan?.trim();
|
|
10463
10538
|
if (plan && agent !== "claude") {
|
|
10464
|
-
|
|
10539
|
+
log32.error("--plan is only supported with --agent claude (plan mode is Claude-specific).");
|
|
10465
10540
|
process.exit(2);
|
|
10466
10541
|
}
|
|
10467
10542
|
const carryMode = opts.carry ?? "send";
|
|
10468
10543
|
if (carryMode !== "send" && carryMode !== "skip") {
|
|
10469
|
-
|
|
10544
|
+
log32.error(`--carry: expected 'send' or 'skip', got "${opts.carry ?? ""}"`);
|
|
10470
10545
|
process.exit(2);
|
|
10471
10546
|
}
|
|
10472
|
-
|
|
10547
|
+
let provider;
|
|
10548
|
+
try {
|
|
10549
|
+
provider = resolveForkProvider(providerArg, opts.provider);
|
|
10550
|
+
} catch (err) {
|
|
10551
|
+
log32.error(err instanceof Error ? err.message : String(err));
|
|
10552
|
+
process.exit(2);
|
|
10553
|
+
}
|
|
10554
|
+
if (!opts.session?.trim()) {
|
|
10555
|
+
if (agent === "claude") {
|
|
10556
|
+
const envId = (process.env.CLAUDE_CODE_SESSION_ID ?? process.env.CLAUDE_SESSION_ID ?? "").trim();
|
|
10557
|
+
if (envId) {
|
|
10558
|
+
const dir = join15(
|
|
10559
|
+
homedir12(),
|
|
10560
|
+
".claude",
|
|
10561
|
+
"projects",
|
|
10562
|
+
encodeClaudeProjectsDir(opts.workspace)
|
|
10563
|
+
);
|
|
10564
|
+
if (existsSync5(join15(dir, `${envId}.jsonl`))) opts.session = envId;
|
|
10565
|
+
}
|
|
10566
|
+
} else if (agent === "codex") {
|
|
10567
|
+
const envId = (process.env.CODEX_THREAD_ID ?? "").trim();
|
|
10568
|
+
if (envId) opts.session = envId;
|
|
10569
|
+
}
|
|
10570
|
+
}
|
|
10473
10571
|
let sessionArgs;
|
|
10474
10572
|
try {
|
|
10475
10573
|
sessionArgs = resolveSessionArgs(agent, opts);
|
|
10476
10574
|
} catch (err) {
|
|
10477
|
-
|
|
10575
|
+
log32.error(err instanceof Error ? err.message : String(err));
|
|
10478
10576
|
process.exit(2);
|
|
10479
10577
|
}
|
|
10480
10578
|
const subArgv = [
|
|
@@ -10496,18 +10594,19 @@ var forkCommand = new Command26("fork").description(
|
|
|
10496
10594
|
});
|
|
10497
10595
|
|
|
10498
10596
|
// src/commands/install.ts
|
|
10499
|
-
import { Command as
|
|
10597
|
+
import { Command as Command29 } from "commander";
|
|
10598
|
+
import { execa as execa5 } from "execa";
|
|
10500
10599
|
import {
|
|
10501
|
-
existsSync as
|
|
10600
|
+
existsSync as existsSync10,
|
|
10502
10601
|
lstatSync,
|
|
10503
|
-
mkdirSync as
|
|
10504
|
-
readFileSync as
|
|
10602
|
+
mkdirSync as mkdirSync8,
|
|
10603
|
+
readFileSync as readFileSync4,
|
|
10505
10604
|
rmSync,
|
|
10506
10605
|
symlinkSync as symlinkSync2,
|
|
10507
|
-
writeFileSync as
|
|
10606
|
+
writeFileSync as writeFileSync7
|
|
10508
10607
|
} from "fs";
|
|
10509
|
-
import { homedir as
|
|
10510
|
-
import { dirname as
|
|
10608
|
+
import { homedir as homedir18 } from "os";
|
|
10609
|
+
import { dirname as dirname5, join as join21, resolve as resolve4, sep } from "path";
|
|
10511
10610
|
import { fileURLToPath } from "url";
|
|
10512
10611
|
|
|
10513
10612
|
// src/lib/doctor-checks.ts
|
|
@@ -10633,7 +10732,7 @@ async function dockerChecks() {
|
|
|
10633
10732
|
];
|
|
10634
10733
|
}
|
|
10635
10734
|
const daemonRes = { label: "docker daemon", status: "ok", detail: "reachable" };
|
|
10636
|
-
const mod = await import("./dist-
|
|
10735
|
+
const mod = await import("./dist-EKSNZHDY.js");
|
|
10637
10736
|
let imgRes;
|
|
10638
10737
|
try {
|
|
10639
10738
|
const img = await mod.imageInfo(mod.DEFAULT_BOX_IMAGE);
|
|
@@ -10664,7 +10763,7 @@ async function dockerChecks() {
|
|
|
10664
10763
|
}
|
|
10665
10764
|
async function daytonaChecks() {
|
|
10666
10765
|
try {
|
|
10667
|
-
const mod = await import("./dist-
|
|
10766
|
+
const mod = await import("./dist-FTCDWRAL.js");
|
|
10668
10767
|
const status = await mod.getDaytonaStatus();
|
|
10669
10768
|
if (!status.configured) {
|
|
10670
10769
|
return [
|
|
@@ -10700,7 +10799,7 @@ async function daytonaChecks() {
|
|
|
10700
10799
|
}
|
|
10701
10800
|
async function hetznerChecks() {
|
|
10702
10801
|
try {
|
|
10703
|
-
const mod = await import("./dist-
|
|
10802
|
+
const mod = await import("./dist-PRDYMXCX.js");
|
|
10704
10803
|
const cred = mod.readHetznerCredStatus();
|
|
10705
10804
|
const credRes = cred.source === "none" ? {
|
|
10706
10805
|
label: "credentials",
|
|
@@ -10732,7 +10831,7 @@ async function hetznerChecks() {
|
|
|
10732
10831
|
}
|
|
10733
10832
|
async function vercelChecks() {
|
|
10734
10833
|
try {
|
|
10735
|
-
const mod = await import("./dist-
|
|
10834
|
+
const mod = await import("./dist-VQSZVBT3.js");
|
|
10736
10835
|
const cred = mod.readVercelCredStatus();
|
|
10737
10836
|
const credRes = cred.auth === "none" ? {
|
|
10738
10837
|
label: "credentials",
|
|
@@ -10768,7 +10867,7 @@ async function vercelChecks() {
|
|
|
10768
10867
|
}
|
|
10769
10868
|
async function e2bChecks() {
|
|
10770
10869
|
try {
|
|
10771
|
-
const mod = await import("./dist-
|
|
10870
|
+
const mod = await import("./dist-U2BHTWG4.js");
|
|
10772
10871
|
const cred = mod.readE2bCredStatus();
|
|
10773
10872
|
const credRes = cred.auth === "none" ? {
|
|
10774
10873
|
label: "credentials",
|
|
@@ -11024,17 +11123,91 @@ function markSetupComplete(provider) {
|
|
|
11024
11123
|
writeFileSync3(path, JSON.stringify(body, null, 2) + "\n");
|
|
11025
11124
|
}
|
|
11026
11125
|
|
|
11027
|
-
// src/
|
|
11028
|
-
import {
|
|
11029
|
-
import {
|
|
11030
|
-
import { existsSync as existsSync7, mkdirSync as mkdirSync5, readFileSync, renameSync as renameSync2, writeFileSync as writeFileSync4 } from "fs";
|
|
11126
|
+
// src/lib/star-prompt.ts
|
|
11127
|
+
import { spawnSync as spawnSync3 } from "child_process";
|
|
11128
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync5, readFileSync, writeFileSync as writeFileSync4 } from "fs";
|
|
11031
11129
|
import { homedir as homedir15 } from "os";
|
|
11032
11130
|
import { dirname as dirname2, join as join18 } from "path";
|
|
11131
|
+
var STATE_VERSION = 1;
|
|
11132
|
+
var REPO = "madarco/agentbox";
|
|
11133
|
+
var REPO_URL = `https://github.com/${REPO}`;
|
|
11134
|
+
var DEFAULT_STATE = { version: STATE_VERSION, installCount: 0, starred: false };
|
|
11135
|
+
function starStatePath() {
|
|
11136
|
+
return join18(homedir15(), ".agentbox", "star-prompt.json");
|
|
11137
|
+
}
|
|
11138
|
+
function readStarState() {
|
|
11139
|
+
const path = starStatePath();
|
|
11140
|
+
if (!existsSync7(path)) return { ...DEFAULT_STATE };
|
|
11141
|
+
try {
|
|
11142
|
+
const parsed = JSON.parse(readFileSync(path, "utf8"));
|
|
11143
|
+
return {
|
|
11144
|
+
version: STATE_VERSION,
|
|
11145
|
+
installCount: typeof parsed.installCount === "number" ? parsed.installCount : 0,
|
|
11146
|
+
starred: parsed.starred === true
|
|
11147
|
+
};
|
|
11148
|
+
} catch {
|
|
11149
|
+
return { ...DEFAULT_STATE };
|
|
11150
|
+
}
|
|
11151
|
+
}
|
|
11152
|
+
function writeStarState(state) {
|
|
11153
|
+
const path = starStatePath();
|
|
11154
|
+
mkdirSync5(dirname2(path), { recursive: true });
|
|
11155
|
+
writeFileSync4(path, JSON.stringify(state, null, 2) + "\n");
|
|
11156
|
+
}
|
|
11157
|
+
function ghReady() {
|
|
11158
|
+
const r = spawnSync3("gh", ["auth", "status"], { stdio: "ignore" });
|
|
11159
|
+
return r.error === void 0 && r.status === 0;
|
|
11160
|
+
}
|
|
11161
|
+
async function maybePromptStar(opts) {
|
|
11162
|
+
if (!process.stdout.isTTY) return;
|
|
11163
|
+
const state = readStarState();
|
|
11164
|
+
if (state.starred) return;
|
|
11165
|
+
let shouldPrompt;
|
|
11166
|
+
if (opts.trigger === "install") {
|
|
11167
|
+
state.installCount += 1;
|
|
11168
|
+
writeStarState(state);
|
|
11169
|
+
shouldPrompt = state.installCount === 3 || state.installCount === 4;
|
|
11170
|
+
} else {
|
|
11171
|
+
shouldPrompt = true;
|
|
11172
|
+
}
|
|
11173
|
+
if (!shouldPrompt) return;
|
|
11174
|
+
const yes = await confirm({
|
|
11175
|
+
message: "Help support this open source project \u2014 would you like to star it on GitHub? Thanks!",
|
|
11176
|
+
initialValue: true
|
|
11177
|
+
});
|
|
11178
|
+
if (!yes) return;
|
|
11179
|
+
try {
|
|
11180
|
+
if (ghReady()) {
|
|
11181
|
+
const r = spawnSync3("gh", ["api", "--method", "PUT", `/user/starred/${REPO}`], {
|
|
11182
|
+
stdio: "ignore"
|
|
11183
|
+
});
|
|
11184
|
+
if (r.error === void 0 && r.status === 0) {
|
|
11185
|
+
state.starred = true;
|
|
11186
|
+
writeStarState(state);
|
|
11187
|
+
prompt_exports.log.success(`Starred ${REPO} \u2014 thank you!`);
|
|
11188
|
+
return;
|
|
11189
|
+
}
|
|
11190
|
+
}
|
|
11191
|
+
spawnSync3(hostOpenCommand(), [REPO_URL], { stdio: "ignore" });
|
|
11192
|
+
prompt_exports.log.info(`Opened ${REPO_URL} \u2014 star away!`);
|
|
11193
|
+
} catch (err) {
|
|
11194
|
+
prompt_exports.log.warn(
|
|
11195
|
+
`couldn't open the star page (${err instanceof Error ? err.message : String(err)}) \u2014 star it anytime at ${REPO_URL}`
|
|
11196
|
+
);
|
|
11197
|
+
}
|
|
11198
|
+
}
|
|
11199
|
+
|
|
11200
|
+
// src/commands/install-cmux.ts
|
|
11201
|
+
import { intro as intro7, log as log34, note as note2, outro as outro6 } from "@clack/prompts";
|
|
11202
|
+
import { Command as Command27 } from "commander";
|
|
11203
|
+
import { existsSync as existsSync8, mkdirSync as mkdirSync6, readFileSync as readFileSync2, renameSync as renameSync2, writeFileSync as writeFileSync5 } from "fs";
|
|
11204
|
+
import { homedir as homedir16 } from "os";
|
|
11205
|
+
import { dirname as dirname3, join as join19 } from "path";
|
|
11033
11206
|
var CONTROL_ID = "agentbox";
|
|
11034
11207
|
function cmuxDockPath(env = process.env) {
|
|
11035
11208
|
const xdg = env["XDG_CONFIG_HOME"];
|
|
11036
|
-
const base = xdg && xdg.length > 0 ? xdg :
|
|
11037
|
-
return
|
|
11209
|
+
const base = xdg && xdg.length > 0 ? xdg : join19(homedir16(), ".config");
|
|
11210
|
+
return join19(base, "cmux", "dock.json");
|
|
11038
11211
|
}
|
|
11039
11212
|
function upsertAgentboxControl(doc, opts) {
|
|
11040
11213
|
const controls = Array.isArray(doc.controls) ? doc.controls : [];
|
|
@@ -11064,14 +11237,14 @@ var installCmuxCommand = new Command27("cmux").description(
|
|
|
11064
11237
|
height: parseHeight(opts.height)
|
|
11065
11238
|
};
|
|
11066
11239
|
let doc = { controls: [] };
|
|
11067
|
-
if (
|
|
11068
|
-
const raw =
|
|
11240
|
+
if (existsSync8(dockPath)) {
|
|
11241
|
+
const raw = readFileSync2(dockPath, "utf8");
|
|
11069
11242
|
try {
|
|
11070
11243
|
const parsed = JSON.parse(raw);
|
|
11071
11244
|
if (parsed && typeof parsed === "object") doc = parsed;
|
|
11072
11245
|
} catch {
|
|
11073
11246
|
if (!opts.force) {
|
|
11074
|
-
|
|
11247
|
+
log34.error(
|
|
11075
11248
|
`existing dock config is not valid JSON: ${dockPath}
|
|
11076
11249
|
fix it by hand, or pass --force to back it up and write a fresh one`
|
|
11077
11250
|
);
|
|
@@ -11079,7 +11252,7 @@ fix it by hand, or pass --force to back it up and write a fresh one`
|
|
|
11079
11252
|
}
|
|
11080
11253
|
if (!opts.dryRun) {
|
|
11081
11254
|
renameSync2(dockPath, dockPath + ".bak");
|
|
11082
|
-
|
|
11255
|
+
log34.warn(`backed up unparseable dock config to ${dockPath}.bak`);
|
|
11083
11256
|
}
|
|
11084
11257
|
doc = { controls: [] };
|
|
11085
11258
|
}
|
|
@@ -11092,8 +11265,8 @@ fix it by hand, or pass --force to back it up and write a fresh one`
|
|
|
11092
11265
|
outro6(`would write ${dockPath}`);
|
|
11093
11266
|
return;
|
|
11094
11267
|
}
|
|
11095
|
-
|
|
11096
|
-
|
|
11268
|
+
mkdirSync6(dirname3(dockPath), { recursive: true });
|
|
11269
|
+
writeFileSync5(dockPath, json);
|
|
11097
11270
|
intro7("AgentBox cmux dock panel");
|
|
11098
11271
|
note2(
|
|
11099
11272
|
`Wrote ${dockPath}
|
|
@@ -11107,6 +11280,217 @@ To see it:
|
|
|
11107
11280
|
outro6("done");
|
|
11108
11281
|
});
|
|
11109
11282
|
|
|
11283
|
+
// src/commands/install-herdr.ts
|
|
11284
|
+
import { intro as intro8, log as log35, note as note3, outro as outro7 } from "@clack/prompts";
|
|
11285
|
+
import { Command as Command28, Option } from "commander";
|
|
11286
|
+
import { spawnSync as spawnSync4 } from "child_process";
|
|
11287
|
+
import { chmodSync, existsSync as existsSync9, mkdirSync as mkdirSync7, readFileSync as readFileSync3, writeFileSync as writeFileSync6 } from "fs";
|
|
11288
|
+
import { homedir as homedir17 } from "os";
|
|
11289
|
+
import { dirname as dirname4, join as join20 } from "path";
|
|
11290
|
+
var PLUGIN_VERSION = "0.1.0";
|
|
11291
|
+
function herdrPluginDir(env = process.env) {
|
|
11292
|
+
const home = env["AGENTBOX_HOME"] ?? join20(homedir17(), ".agentbox");
|
|
11293
|
+
return join20(home, "herdr", "plugin");
|
|
11294
|
+
}
|
|
11295
|
+
function herdrConfigPath(env = process.env) {
|
|
11296
|
+
const override = env["HERDR_CONFIG_PATH"];
|
|
11297
|
+
if (override && override.length > 0) return override;
|
|
11298
|
+
const xdg = env["XDG_CONFIG_HOME"];
|
|
11299
|
+
const base = xdg && xdg.length > 0 ? xdg : join20(homedir17(), ".config");
|
|
11300
|
+
return join20(base, "herdr", "config.toml");
|
|
11301
|
+
}
|
|
11302
|
+
function herdrBinary(env = process.env) {
|
|
11303
|
+
const b = env["HERDR_BIN_PATH"];
|
|
11304
|
+
return b && b.length > 0 ? b : "herdr";
|
|
11305
|
+
}
|
|
11306
|
+
function buildHerdrManifest() {
|
|
11307
|
+
return `# AgentBox Herdr plugin (https://herdr.dev/docs/plugins).
|
|
11308
|
+
# Install: herdr plugin install madarco/agentbox/herdr-plugin
|
|
11309
|
+
# Or, with the AgentBox CLI already installed: agentbox install herdr
|
|
11310
|
+
#
|
|
11311
|
+
# agentbox commands route through ./agentbox-shim.sh, written at install time
|
|
11312
|
+
# with the absolute path to your AgentBox CLI \u2014 Herdr runs plugin commands as a
|
|
11313
|
+
# bare argv with no shell expansion / unreliable PATH (e.g. under nvm).
|
|
11314
|
+
id = "agentbox"
|
|
11315
|
+
name = "AgentBox"
|
|
11316
|
+
version = "${PLUGIN_VERSION}"
|
|
11317
|
+
min_herdr_version = "0.7.0"
|
|
11318
|
+
platforms = ["linux", "macos", "windows"]
|
|
11319
|
+
description = "AgentBox: live boxes overlay, shortcuts, and Ctrl+click to open a box web app."
|
|
11320
|
+
|
|
11321
|
+
[[build]]
|
|
11322
|
+
command = ["sh", "build.sh"]
|
|
11323
|
+
|
|
11324
|
+
[[panes]]
|
|
11325
|
+
id = "boxes"
|
|
11326
|
+
title = "AgentBox"
|
|
11327
|
+
placement = "overlay"
|
|
11328
|
+
command = ["sh", "agentbox-shim.sh", "list", "--herdr", "--watch"]
|
|
11329
|
+
|
|
11330
|
+
[[actions]]
|
|
11331
|
+
id = "boxes"
|
|
11332
|
+
title = "AgentBox: boxes overlay"
|
|
11333
|
+
contexts = ["workspace"]
|
|
11334
|
+
command = ["herdr", "plugin", "pane", "open", "--plugin", "agentbox", "--entrypoint", "boxes", "--placement", "overlay"]
|
|
11335
|
+
|
|
11336
|
+
[[actions]]
|
|
11337
|
+
id = "new"
|
|
11338
|
+
title = "AgentBox: new box"
|
|
11339
|
+
contexts = ["workspace"]
|
|
11340
|
+
command = ["sh", "agentbox-shim.sh", "herdr", "new"]
|
|
11341
|
+
|
|
11342
|
+
[[actions]]
|
|
11343
|
+
id = "link"
|
|
11344
|
+
title = "AgentBox: open box link"
|
|
11345
|
+
contexts = ["workspace"]
|
|
11346
|
+
command = ["sh", "agentbox-shim.sh", "herdr", "link"]
|
|
11347
|
+
|
|
11348
|
+
# Keybindings are NOT declared here \u2014 Herdr ignores manifest keys. They're added
|
|
11349
|
+
# to the user's config.toml by \`agentbox install herdr\` / the build step.
|
|
11350
|
+
|
|
11351
|
+
[[link_handlers]]
|
|
11352
|
+
id = "web"
|
|
11353
|
+
title = "AgentBox: open box web app"
|
|
11354
|
+
pattern = "^agentbox://"
|
|
11355
|
+
action = "link"
|
|
11356
|
+
`;
|
|
11357
|
+
}
|
|
11358
|
+
function shq(s) {
|
|
11359
|
+
return `'${s.replace(/'/g, `'\\''`)}'`;
|
|
11360
|
+
}
|
|
11361
|
+
function herdrShimContent(node, cliEntry) {
|
|
11362
|
+
return `#!/bin/sh
|
|
11363
|
+
# Generated by \`agentbox install herdr\`. Routes Herdr plugin commands to the
|
|
11364
|
+
# AgentBox CLI by absolute path (Herdr runs commands without a reliable PATH).
|
|
11365
|
+
exec ${shq(node)} ${shq(cliEntry)} "$@"
|
|
11366
|
+
`;
|
|
11367
|
+
}
|
|
11368
|
+
function herdrBuildScript() {
|
|
11369
|
+
return `#!/bin/sh
|
|
11370
|
+
# AgentBox Herdr plugin bootstrap \u2014 runs during \`herdr plugin install\`.
|
|
11371
|
+
# (Local installs via \`agentbox install herdr\` set things up directly instead.)
|
|
11372
|
+
AGB="$(command -v agentbox || true)"
|
|
11373
|
+
if [ -z "$AGB" ]; then
|
|
11374
|
+
echo "AgentBox CLI not found \u2014 the Herdr plugin is installed but inert."
|
|
11375
|
+
echo "Install it and finish setup:"
|
|
11376
|
+
echo " npm i -g @madarco/agentbox && agentbox install herdr"
|
|
11377
|
+
exit 0
|
|
11378
|
+
fi
|
|
11379
|
+
"$AGB" install herdr --plugin-keys || \\
|
|
11380
|
+
echo "AgentBox plugin setup hit an issue; finish with: agentbox install herdr"
|
|
11381
|
+
exit 0
|
|
11382
|
+
`;
|
|
11383
|
+
}
|
|
11384
|
+
var KEY_BEGIN = "# >>> agentbox install herdr (managed) >>>";
|
|
11385
|
+
var KEY_END = "# <<< agentbox install herdr (managed) <<<";
|
|
11386
|
+
function herdrKeybindingsBlock() {
|
|
11387
|
+
return `${KEY_BEGIN}
|
|
11388
|
+
# Remove this block (or run \`herdr config reset-keys\`) to drop the shortcuts.
|
|
11389
|
+
[[keys.command]]
|
|
11390
|
+
key = "prefix+a"
|
|
11391
|
+
type = "plugin_action"
|
|
11392
|
+
command = "agentbox.boxes"
|
|
11393
|
+
description = "AgentBox: boxes overlay"
|
|
11394
|
+
|
|
11395
|
+
[[keys.command]]
|
|
11396
|
+
key = "prefix+shift+a"
|
|
11397
|
+
type = "plugin_action"
|
|
11398
|
+
command = "agentbox.new"
|
|
11399
|
+
description = "AgentBox: new box"
|
|
11400
|
+
${KEY_END}`;
|
|
11401
|
+
}
|
|
11402
|
+
function upsertHerdrKeybindings(existing, block) {
|
|
11403
|
+
const stripped = existing.replace(
|
|
11404
|
+
new RegExp(`\\n*${escapeRe(KEY_BEGIN)}[\\s\\S]*?${escapeRe(KEY_END)}\\n*`, "g"),
|
|
11405
|
+
"\n"
|
|
11406
|
+
);
|
|
11407
|
+
const head = stripped.replace(/\s+$/, "");
|
|
11408
|
+
return (head.length > 0 ? `${head}
|
|
11409
|
+
|
|
11410
|
+
` : "") + block + "\n";
|
|
11411
|
+
}
|
|
11412
|
+
function escapeRe(s) {
|
|
11413
|
+
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
11414
|
+
}
|
|
11415
|
+
function writeShim(dir) {
|
|
11416
|
+
const p = join20(dir, "agentbox-shim.sh");
|
|
11417
|
+
writeFileSync6(p, herdrShimContent(process.execPath, process.argv[1] ?? "agentbox"));
|
|
11418
|
+
chmodSync(p, 493);
|
|
11419
|
+
}
|
|
11420
|
+
function applyKeybindings() {
|
|
11421
|
+
const cfg = herdrConfigPath();
|
|
11422
|
+
const existing = existsSync9(cfg) ? readFileSync3(cfg, "utf8") : "";
|
|
11423
|
+
mkdirSync7(dirname4(cfg), { recursive: true });
|
|
11424
|
+
writeFileSync6(cfg, upsertHerdrKeybindings(existing, herdrKeybindingsBlock()));
|
|
11425
|
+
spawnSync4(herdrBinary(), ["server", "reload-config"], { stdio: "ignore" });
|
|
11426
|
+
return cfg;
|
|
11427
|
+
}
|
|
11428
|
+
var installHerdrCommand = new Command28("herdr").description(
|
|
11429
|
+
"Install a Herdr plugin: a boxes-list overlay, keyboard shortcuts, and Ctrl+click to open a box web app."
|
|
11430
|
+
).option("--dry-run", "print the generated files without writing or linking anything").addOption(new Option("--plugin-keys", "finish setup for a herdr-installed plugin").hideHelp()).action((opts) => {
|
|
11431
|
+
if (opts.pluginKeys) {
|
|
11432
|
+
writeShim(process.cwd());
|
|
11433
|
+
const cfg2 = applyKeybindings();
|
|
11434
|
+
process.stdout.write(
|
|
11435
|
+
`AgentBox: Herdr shortcuts installed (prefix a / prefix shift a) in ${cfg2}.
|
|
11436
|
+
`
|
|
11437
|
+
);
|
|
11438
|
+
return;
|
|
11439
|
+
}
|
|
11440
|
+
const dir = herdrPluginDir();
|
|
11441
|
+
const file = join20(dir, "herdr-plugin.toml");
|
|
11442
|
+
const cfgPath = herdrConfigPath();
|
|
11443
|
+
if (opts.dryRun) {
|
|
11444
|
+
intro8("agentbox install herdr (dry run)");
|
|
11445
|
+
process.stdout.write(`# --- ${file} ---
|
|
11446
|
+
${buildHerdrManifest()}
|
|
11447
|
+
`);
|
|
11448
|
+
process.stdout.write(`# --- ${join20(dir, "build.sh")} ---
|
|
11449
|
+
${herdrBuildScript()}
|
|
11450
|
+
`);
|
|
11451
|
+
process.stdout.write(
|
|
11452
|
+
`# --- ${join20(dir, "agentbox-shim.sh")} ---
|
|
11453
|
+
${herdrShimContent(process.execPath, process.argv[1] ?? "agentbox")}
|
|
11454
|
+
`
|
|
11455
|
+
);
|
|
11456
|
+
process.stdout.write(`# --- appended to ${cfgPath} ---
|
|
11457
|
+
${herdrKeybindingsBlock()}
|
|
11458
|
+
`);
|
|
11459
|
+
outro7(`would write ${dir}/*, edit ${cfgPath}, and run \`herdr plugin link ${dir}\``);
|
|
11460
|
+
return;
|
|
11461
|
+
}
|
|
11462
|
+
mkdirSync7(dir, { recursive: true });
|
|
11463
|
+
writeFileSync6(file, buildHerdrManifest());
|
|
11464
|
+
const buildPath = join20(dir, "build.sh");
|
|
11465
|
+
writeFileSync6(buildPath, herdrBuildScript());
|
|
11466
|
+
chmodSync(buildPath, 493);
|
|
11467
|
+
writeShim(dir);
|
|
11468
|
+
const cfg = applyKeybindings();
|
|
11469
|
+
intro8("AgentBox Herdr plugin");
|
|
11470
|
+
const bin = herdrBinary();
|
|
11471
|
+
let linked = spawnSync4(bin, ["plugin", "link", dir], { stdio: "ignore" });
|
|
11472
|
+
if (linked.status !== 0) {
|
|
11473
|
+
spawnSync4(bin, ["plugin", "unlink", "agentbox"], { stdio: "ignore" });
|
|
11474
|
+
linked = spawnSync4(bin, ["plugin", "link", dir], { stdio: "ignore" });
|
|
11475
|
+
}
|
|
11476
|
+
if (linked.status === 0) {
|
|
11477
|
+
spawnSync4(bin, ["server", "reload-config"], { stdio: "ignore" });
|
|
11478
|
+
} else {
|
|
11479
|
+
log35.warn(
|
|
11480
|
+
`could not run \`${bin} plugin link\` (is Herdr installed / running?).
|
|
11481
|
+
Run it yourself: herdr plugin link ${dir} && herdr server reload-config`
|
|
11482
|
+
);
|
|
11483
|
+
}
|
|
11484
|
+
note3(
|
|
11485
|
+
`Wrote ${dir}/
|
|
11486
|
+
Added shortcuts to ${cfg}
|
|
11487
|
+
` + (linked.status === 0 ? `Linked with: herdr plugin link ${dir}
|
|
11488
|
+
` : "") + '\nShortcuts (under Herdr prefix, default Ctrl+b \u2014 press the prefix, then the key):\n prefix a boxes overlay (all boxes)\n prefix shift a new box in the current project\n\nCtrl+click a box name in the overlay to open its web app.\n(remove the shortcuts with `herdr config reset-keys`, or by re-running.)\n\nTip: set the sidebar agent panel scope to "all" (agent_panel_scope = "all"\nin ~/.config/herdr/config.toml, or toggle it in the sidebar) so attached\nboxes stay visible when you switch projects.',
|
|
11489
|
+
"Installed"
|
|
11490
|
+
);
|
|
11491
|
+
outro7("done");
|
|
11492
|
+
});
|
|
11493
|
+
|
|
11110
11494
|
// src/commands/install.ts
|
|
11111
11495
|
var MANAGED_SENTINEL = "<!-- agentbox-managed:v1 -->";
|
|
11112
11496
|
var LOGO_L1 = "\u2584\u2580\u2588 \u2588\u2580\u2580 \u2588\u2580\u2580 \u2588\u2584\u2591\u2588 \u2580\u2588\u2580 \u2588\u2584\u2584 \u2588\u2580\u2588 \u2580\u2584\u2580";
|
|
@@ -11187,34 +11571,33 @@ ${LOGO_L2}\x1B[0m` + SYNC_END2);
|
|
|
11187
11571
|
}
|
|
11188
11572
|
var LEGACY_INFO_MARKER = "Drive AgentBox from the host:";
|
|
11189
11573
|
function installTargets() {
|
|
11190
|
-
const home =
|
|
11191
|
-
const claudeSkills =
|
|
11574
|
+
const home = homedir18();
|
|
11575
|
+
const claudeSkills = join21(home, ".claude", "skills");
|
|
11192
11576
|
return [
|
|
11193
|
-
{ src: join19("agentbox", "SKILL.md"), dest: join19(claudeSkills, "agentbox", "SKILL.md") },
|
|
11194
11577
|
{
|
|
11195
|
-
src:
|
|
11196
|
-
dest:
|
|
11578
|
+
src: join21("agentbox-info", "SKILL.md"),
|
|
11579
|
+
dest: join21(claudeSkills, "agentbox-info", "SKILL.md")
|
|
11197
11580
|
},
|
|
11198
11581
|
{
|
|
11199
|
-
src:
|
|
11200
|
-
dest:
|
|
11201
|
-
gateDir:
|
|
11582
|
+
src: join21("codex", "agentbox.md"),
|
|
11583
|
+
dest: join21(home, ".codex", "prompts", "agentbox.md"),
|
|
11584
|
+
gateDir: join21(home, ".codex")
|
|
11202
11585
|
},
|
|
11203
11586
|
{
|
|
11204
|
-
src:
|
|
11205
|
-
dest:
|
|
11206
|
-
gateDir:
|
|
11587
|
+
src: join21("opencode", "agentbox.md"),
|
|
11588
|
+
dest: join21(home, ".config", "opencode", "commands", "agentbox.md"),
|
|
11589
|
+
gateDir: join21(home, ".config", "opencode")
|
|
11207
11590
|
}
|
|
11208
11591
|
];
|
|
11209
11592
|
}
|
|
11210
11593
|
function resolveHostSkillsDir() {
|
|
11211
|
-
const here =
|
|
11594
|
+
const here = dirname5(fileURLToPath(import.meta.url));
|
|
11212
11595
|
const candidates = [
|
|
11213
11596
|
resolve4(here, "..", "share", "host-skills"),
|
|
11214
11597
|
resolve4(here, "..", "..", "share", "host-skills")
|
|
11215
11598
|
];
|
|
11216
11599
|
for (const c of candidates) {
|
|
11217
|
-
if (
|
|
11600
|
+
if (existsSync10(c)) return c;
|
|
11218
11601
|
}
|
|
11219
11602
|
throw new Error(`could not locate bundled host skills; tried:
|
|
11220
11603
|
${candidates.join("\n ")}`);
|
|
@@ -11230,11 +11613,11 @@ function isSourceCheckout(srcDir) {
|
|
|
11230
11613
|
return !srcDir.split(sep).includes("node_modules");
|
|
11231
11614
|
}
|
|
11232
11615
|
function writableReason(target, force) {
|
|
11233
|
-
if (!
|
|
11616
|
+
if (!existsSync10(target)) {
|
|
11234
11617
|
if (isSymlink(target)) return "managed";
|
|
11235
11618
|
return "new";
|
|
11236
11619
|
}
|
|
11237
|
-
const existing =
|
|
11620
|
+
const existing = readFileSync4(target, "utf8");
|
|
11238
11621
|
if (existing.includes(MANAGED_SENTINEL) || existing.includes(LEGACY_INFO_MARKER)) {
|
|
11239
11622
|
return "managed";
|
|
11240
11623
|
}
|
|
@@ -11250,13 +11633,13 @@ function installHostSkills(opts = {}) {
|
|
|
11250
11633
|
const blocked = [];
|
|
11251
11634
|
let skipped = 0;
|
|
11252
11635
|
for (const t of installTargets()) {
|
|
11253
|
-
const src =
|
|
11254
|
-
if (!
|
|
11636
|
+
const src = join21(srcDir, t.src);
|
|
11637
|
+
if (!existsSync10(src)) {
|
|
11255
11638
|
if (!quiet) prompt_exports.log.warn(`bundled file missing (skipped): ${src}`);
|
|
11256
11639
|
skipped++;
|
|
11257
11640
|
continue;
|
|
11258
11641
|
}
|
|
11259
|
-
if (t.gateDir && !
|
|
11642
|
+
if (t.gateDir && !existsSync10(t.gateDir)) continue;
|
|
11260
11643
|
const reason = writableReason(t.dest, force);
|
|
11261
11644
|
if (reason === "skip") {
|
|
11262
11645
|
if (!quiet) prompt_exports.log.warn(`user-modified file at ${t.dest}, skipping; pass --force to overwrite`);
|
|
@@ -11269,18 +11652,77 @@ function installHostSkills(opts = {}) {
|
|
|
11269
11652
|
written.push(t.dest);
|
|
11270
11653
|
continue;
|
|
11271
11654
|
}
|
|
11272
|
-
|
|
11655
|
+
mkdirSync8(dirname5(t.dest), { recursive: true });
|
|
11273
11656
|
if (link) {
|
|
11274
11657
|
rmSync(t.dest, { force: true });
|
|
11275
11658
|
symlinkSync2(resolve4(srcDir, t.src), t.dest);
|
|
11276
11659
|
} else {
|
|
11277
11660
|
if (isSymlink(t.dest)) rmSync(t.dest, { force: true });
|
|
11278
|
-
|
|
11661
|
+
writeFileSync7(t.dest, readFileSync4(src, "utf8"));
|
|
11279
11662
|
}
|
|
11280
11663
|
written.push(t.dest);
|
|
11281
11664
|
}
|
|
11282
11665
|
return { written, skipped, blocked };
|
|
11283
11666
|
}
|
|
11667
|
+
var FORK_SKILL_REPO = "https://github.com/madarco/agentbox";
|
|
11668
|
+
async function installForkSkill(opts = {}) {
|
|
11669
|
+
const force = opts.force === true;
|
|
11670
|
+
const dryRun = opts.dryRun === true;
|
|
11671
|
+
const quiet = opts.quiet === true;
|
|
11672
|
+
const srcDir = resolveHostSkillsDir();
|
|
11673
|
+
const src = join21(srcDir, "agentbox", "SKILL.md");
|
|
11674
|
+
const dest = join21(homedir18(), ".claude", "skills", "agentbox", "SKILL.md");
|
|
11675
|
+
if (!existsSync10(src)) {
|
|
11676
|
+
if (!quiet) prompt_exports.log.warn(`bundled file missing (skipped): ${src}`);
|
|
11677
|
+
return { written: [], skipped: 1, blocked: [], method: "skip" };
|
|
11678
|
+
}
|
|
11679
|
+
const reason = writableReason(dest, force);
|
|
11680
|
+
if (reason === "skip") {
|
|
11681
|
+
if (!quiet) prompt_exports.log.warn(`user-modified file at ${dest}, skipping; pass --force to overwrite`);
|
|
11682
|
+
return { written: [], skipped: 1, blocked: [dest], method: "skip" };
|
|
11683
|
+
}
|
|
11684
|
+
if (dryRun) {
|
|
11685
|
+
const via = isSourceCheckout(srcDir) ? "link" : "npx skills add";
|
|
11686
|
+
if (!quiet) prompt_exports.log.info(`would install ${dest} via ${via} (${reason})`);
|
|
11687
|
+
return { written: [dest], skipped: 0, blocked: [], method: "dry-run" };
|
|
11688
|
+
}
|
|
11689
|
+
if (isSourceCheckout(srcDir)) {
|
|
11690
|
+
mkdirSync8(dirname5(dest), { recursive: true });
|
|
11691
|
+
rmSync(dest, { force: true });
|
|
11692
|
+
symlinkSync2(src, dest);
|
|
11693
|
+
return { written: [dest], skipped: 0, blocked: [], method: "symlink" };
|
|
11694
|
+
}
|
|
11695
|
+
try {
|
|
11696
|
+
await execa5(
|
|
11697
|
+
"npx",
|
|
11698
|
+
[
|
|
11699
|
+
"-y",
|
|
11700
|
+
"skills",
|
|
11701
|
+
"add",
|
|
11702
|
+
FORK_SKILL_REPO,
|
|
11703
|
+
"--skill",
|
|
11704
|
+
"agentbox",
|
|
11705
|
+
"-a",
|
|
11706
|
+
"claude-code",
|
|
11707
|
+
"-g",
|
|
11708
|
+
"-y",
|
|
11709
|
+
"--copy"
|
|
11710
|
+
],
|
|
11711
|
+
{ timeout: 12e4 }
|
|
11712
|
+
);
|
|
11713
|
+
if (existsSync10(dest)) return { written: [dest], skipped: 0, blocked: [], method: "npx" };
|
|
11714
|
+
throw new Error("`skills add` reported success but wrote no skill file");
|
|
11715
|
+
} catch (err) {
|
|
11716
|
+
if (!quiet) {
|
|
11717
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
11718
|
+
prompt_exports.log.warn(`\`npx skills add\` failed (${msg}); copying the bundled fork skill instead`);
|
|
11719
|
+
}
|
|
11720
|
+
mkdirSync8(dirname5(dest), { recursive: true });
|
|
11721
|
+
if (isSymlink(dest)) rmSync(dest, { force: true });
|
|
11722
|
+
writeFileSync7(dest, readFileSync4(src, "utf8"));
|
|
11723
|
+
return { written: [dest], skipped: 0, blocked: [], method: "copy" };
|
|
11724
|
+
}
|
|
11725
|
+
}
|
|
11284
11726
|
var PROVIDER_HINTS = {
|
|
11285
11727
|
docker: "builds a ~1GB local image; no login needed",
|
|
11286
11728
|
hetzner: "paste an API token from the Hetzner Console",
|
|
@@ -11305,7 +11747,7 @@ function ensureTty() {
|
|
|
11305
11747
|
async function runProviderLogin(name) {
|
|
11306
11748
|
if (name === "docker") return true;
|
|
11307
11749
|
if (name === "daytona") {
|
|
11308
|
-
const mod2 = await import("./dist-
|
|
11750
|
+
const mod2 = await import("./dist-FTCDWRAL.js");
|
|
11309
11751
|
const status2 = await mod2.getDaytonaStatus();
|
|
11310
11752
|
if (status2.configured) {
|
|
11311
11753
|
prompt_exports.log.info("daytona: already configured");
|
|
@@ -11317,7 +11759,7 @@ async function runProviderLogin(name) {
|
|
|
11317
11759
|
return true;
|
|
11318
11760
|
}
|
|
11319
11761
|
if (name === "hetzner") {
|
|
11320
|
-
const mod2 = await import("./dist-
|
|
11762
|
+
const mod2 = await import("./dist-PRDYMXCX.js");
|
|
11321
11763
|
const status2 = mod2.readHetznerCredStatus();
|
|
11322
11764
|
if (status2.source !== "none") {
|
|
11323
11765
|
prompt_exports.log.info("hetzner: already configured");
|
|
@@ -11329,7 +11771,7 @@ async function runProviderLogin(name) {
|
|
|
11329
11771
|
return true;
|
|
11330
11772
|
}
|
|
11331
11773
|
if (name === "vercel") {
|
|
11332
|
-
const mod2 = await import("./dist-
|
|
11774
|
+
const mod2 = await import("./dist-VQSZVBT3.js");
|
|
11333
11775
|
const status2 = mod2.readVercelCredStatus();
|
|
11334
11776
|
if (status2.auth !== "none") {
|
|
11335
11777
|
prompt_exports.log.info(`vercel: already configured (${status2.auth})`);
|
|
@@ -11340,7 +11782,7 @@ async function runProviderLogin(name) {
|
|
|
11340
11782
|
await mod2.ensureVercelCredentials();
|
|
11341
11783
|
return true;
|
|
11342
11784
|
}
|
|
11343
|
-
const mod = await import("./dist-
|
|
11785
|
+
const mod = await import("./dist-U2BHTWG4.js");
|
|
11344
11786
|
const status = mod.readE2bCredStatus();
|
|
11345
11787
|
if (status.auth !== "none") {
|
|
11346
11788
|
prompt_exports.log.info(`e2b: already configured (${status.auth})`);
|
|
@@ -11415,8 +11857,7 @@ async function runInstallWizard(opts = {}) {
|
|
|
11415
11857
|
await runPrepare(providerName, {
|
|
11416
11858
|
cwd: process.cwd(),
|
|
11417
11859
|
yes: true,
|
|
11418
|
-
suppressStatus: true
|
|
11419
|
-
suppressTip: true
|
|
11860
|
+
suppressStatus: true
|
|
11420
11861
|
});
|
|
11421
11862
|
} catch (err) {
|
|
11422
11863
|
prompt_exports.log.warn(
|
|
@@ -11430,17 +11871,20 @@ async function runInstallWizard(opts = {}) {
|
|
|
11430
11871
|
}
|
|
11431
11872
|
const sp = (0, prompt_exports.spinner)();
|
|
11432
11873
|
sp.start("installing host /agentbox skill\u2026");
|
|
11433
|
-
let skillRes;
|
|
11434
11874
|
try {
|
|
11435
|
-
skillRes = installHostSkills({ force: opts.force, dryRun: opts.dryRun, quiet: true });
|
|
11436
|
-
|
|
11437
|
-
|
|
11875
|
+
const skillRes = installHostSkills({ force: opts.force, dryRun: opts.dryRun, quiet: true });
|
|
11876
|
+
const forkRes = await installForkSkill({ force: opts.force, dryRun: opts.dryRun, quiet: true });
|
|
11877
|
+
const written = skillRes.written.length + forkRes.written.length;
|
|
11878
|
+
const skipped = skillRes.skipped + forkRes.skipped;
|
|
11879
|
+
if (written > 0) {
|
|
11880
|
+
sp.stop(`Agentbox Skills: Installed in ${String(written)} locations`);
|
|
11438
11881
|
} else {
|
|
11439
|
-
sp.stop(`Agentbox Skills: nothing to write (${String(
|
|
11882
|
+
sp.stop(`Agentbox Skills: nothing to write (${String(skipped)} skipped)`);
|
|
11440
11883
|
}
|
|
11441
|
-
|
|
11884
|
+
const blocked = [...skillRes.blocked, ...forkRes.blocked];
|
|
11885
|
+
if (blocked.length > 0) {
|
|
11442
11886
|
prompt_exports.log.warn(
|
|
11443
|
-
`user-modified host skill file(s) left in place: ${
|
|
11887
|
+
`user-modified host skill file(s) left in place: ${blocked.join(", ")}
|
|
11444
11888
|
pass \`agentbox install --skills-only --force\` to overwrite`
|
|
11445
11889
|
);
|
|
11446
11890
|
}
|
|
@@ -11455,9 +11899,10 @@ pass \`agentbox install --skills-only --force\` to overwrite`
|
|
|
11455
11899
|
(0, prompt_exports.outro)(
|
|
11456
11900
|
opts.fromAutoTrigger ? "\u2728 Setup complete \u2014 continuing with your command\u2026" : "\u2728 Setup complete"
|
|
11457
11901
|
);
|
|
11902
|
+
await maybePromptStar({ trigger: "install" });
|
|
11458
11903
|
return true;
|
|
11459
11904
|
}
|
|
11460
|
-
var installCommand = new
|
|
11905
|
+
var installCommand = new Command29("install").description(
|
|
11461
11906
|
"Interactive setup wizard: system check, pick a provider, log in, prepare its base image/snapshot, and install the host /agentbox skill. `--skills-only` runs just the skill install."
|
|
11462
11907
|
).option(
|
|
11463
11908
|
"--skills-only",
|
|
@@ -11469,23 +11914,27 @@ var installCommand = new Command28("install").description(
|
|
|
11469
11914
|
if (opts.skillsOnly) {
|
|
11470
11915
|
(0, prompt_exports.intro)("Installing AgentBox host commands...");
|
|
11471
11916
|
let res;
|
|
11917
|
+
let forkRes;
|
|
11472
11918
|
try {
|
|
11473
11919
|
res = installHostSkills({ force: opts.force, dryRun: opts.dryRun });
|
|
11920
|
+
forkRes = await installForkSkill({ force: opts.force, dryRun: opts.dryRun });
|
|
11474
11921
|
} catch (err) {
|
|
11475
11922
|
prompt_exports.log.error(err instanceof Error ? err.message : String(err));
|
|
11476
11923
|
process.exit(1);
|
|
11477
11924
|
}
|
|
11925
|
+
const written = [...res.written, ...forkRes.written];
|
|
11926
|
+
const skipped = res.skipped + forkRes.skipped;
|
|
11478
11927
|
if (opts.dryRun) {
|
|
11479
11928
|
(0, prompt_exports.outro)(
|
|
11480
|
-
`dry-run: ${String(
|
|
11929
|
+
`dry-run: ${String(written.length)} file(s) would be written, ${String(skipped)} skipped`
|
|
11481
11930
|
);
|
|
11482
11931
|
return;
|
|
11483
11932
|
}
|
|
11484
|
-
if (
|
|
11485
|
-
(0, prompt_exports.outro)(`nothing installed (${String(
|
|
11933
|
+
if (written.length === 0) {
|
|
11934
|
+
(0, prompt_exports.outro)(`nothing installed (${String(skipped)} skipped)`);
|
|
11486
11935
|
return;
|
|
11487
11936
|
}
|
|
11488
|
-
(0, prompt_exports.outro)(`installed: ${
|
|
11937
|
+
(0, prompt_exports.outro)(`installed: ${written.join(", ")}`);
|
|
11489
11938
|
return;
|
|
11490
11939
|
}
|
|
11491
11940
|
const ok = await runInstallWizard({
|
|
@@ -11498,10 +11947,11 @@ var installCommand = new Command28("install").description(
|
|
|
11498
11947
|
});
|
|
11499
11948
|
installCommand.enablePositionalOptions();
|
|
11500
11949
|
installCommand.addCommand(installCmuxCommand);
|
|
11950
|
+
installCommand.addCommand(installHerdrCommand);
|
|
11501
11951
|
|
|
11502
11952
|
// src/commands/doctor.ts
|
|
11503
|
-
import { Command as
|
|
11504
|
-
var doctorCommand = new
|
|
11953
|
+
import { Command as Command30 } from "commander";
|
|
11954
|
+
var doctorCommand = new Command30("doctor").description(
|
|
11505
11955
|
"Diagnose system compatibility and provider readiness (Node, git, ssh, Docker daemon, provider credentials, prepared snapshots)."
|
|
11506
11956
|
).option(
|
|
11507
11957
|
"-p, --provider <name>",
|
|
@@ -11567,7 +12017,7 @@ function formatUnknown(err) {
|
|
|
11567
12017
|
}
|
|
11568
12018
|
|
|
11569
12019
|
// src/commands/git.ts
|
|
11570
|
-
import { Command as
|
|
12020
|
+
import { Command as Command31 } from "commander";
|
|
11571
12021
|
var WORKSPACE = "/workspace";
|
|
11572
12022
|
var TOKEN_TTL_MS = 12e4;
|
|
11573
12023
|
async function runInBox(box, argv2) {
|
|
@@ -11599,7 +12049,7 @@ function buildPredictedGhPrParams(ghArgs) {
|
|
|
11599
12049
|
async function exitWith(code) {
|
|
11600
12050
|
process.exit(code);
|
|
11601
12051
|
}
|
|
11602
|
-
var pushCommand = new
|
|
12052
|
+
var pushCommand = new Command31("push").description("Push the box's branch via the host relay (host creds, no prompt)").argument("<box>", "box ref: project index, id, id prefix, name, or container").argument("[args...]", "extra flags forwarded to `agentbox-ctl git push` (e.g. --force-with-lease, --tags)").option("--remote <name>", "remote name (default: origin)").allowExcessArguments(true).allowUnknownOption(true).action(async (boxRef, args, opts) => {
|
|
11603
12053
|
try {
|
|
11604
12054
|
const box = await resolveBoxOrExit(boxRef);
|
|
11605
12055
|
const predicted = buildPredictedGitParams(opts.remote, args);
|
|
@@ -11612,7 +12062,7 @@ var pushCommand = new Command30("push").description("Push the box's branch via t
|
|
|
11612
12062
|
handleLifecycleError(err);
|
|
11613
12063
|
}
|
|
11614
12064
|
});
|
|
11615
|
-
var fetchCommand = new
|
|
12065
|
+
var fetchCommand = new Command31("fetch").description("Fetch via the host relay (refs land in the shared .git)").argument("<box>", "box ref").argument("[args...]", "extra flags forwarded to `agentbox-ctl git fetch` (e.g. --prune)").option("--remote <name>", "remote name (default: origin)").allowExcessArguments(true).allowUnknownOption(true).action(async (boxRef, args, opts) => {
|
|
11616
12066
|
try {
|
|
11617
12067
|
const box = await resolveBoxOrExit(boxRef);
|
|
11618
12068
|
const predicted = buildPredictedGitParams(opts.remote, args);
|
|
@@ -11625,7 +12075,7 @@ var fetchCommand = new Command30("fetch").description("Fetch via the host relay
|
|
|
11625
12075
|
handleLifecycleError(err);
|
|
11626
12076
|
}
|
|
11627
12077
|
});
|
|
11628
|
-
var pullCommand = new
|
|
12078
|
+
var pullCommand = new Command31("pull").description(
|
|
11629
12079
|
"Fetch via the relay then merge in /workspace. With <branch>: first `git checkout <branch>` so the box switches base branch and pulls latest \u2014 useful for reusing a box on a new task."
|
|
11630
12080
|
).argument("<box>", "box ref").argument("[branch]", "optional branch to switch to before pulling (e.g. main)").argument("[args...]", "extra flags forwarded to `agentbox-ctl git pull`").option("--remote <name>", "remote name (default: origin)").option("--ff-only", "pass --ff-only to the in-box merge").allowExcessArguments(true).allowUnknownOption(true).action(
|
|
11631
12081
|
async (boxRef, branch, args, opts) => {
|
|
@@ -11647,7 +12097,7 @@ var pullCommand = new Command30("pull").description(
|
|
|
11647
12097
|
}
|
|
11648
12098
|
}
|
|
11649
12099
|
);
|
|
11650
|
-
var checkoutCommand = new
|
|
12100
|
+
var checkoutCommand = new Command31("checkout").description("Change the box's working branch (runs `git checkout <branch>` in /workspace)").argument("<box>", "box ref").argument("<branch>", "branch to check out inside the box").argument("[args...]", "extra flags forwarded to `git checkout`").allowExcessArguments(true).allowUnknownOption(true).action(async (boxRef, branch, args) => {
|
|
11651
12101
|
try {
|
|
11652
12102
|
const box = await resolveBoxOrExit(boxRef);
|
|
11653
12103
|
await exitWith(await runAndStream(box, ["git", "checkout", branch, ...args]));
|
|
@@ -11655,7 +12105,7 @@ var checkoutCommand = new Command30("checkout").description("Change the box's wo
|
|
|
11655
12105
|
handleLifecycleError(err);
|
|
11656
12106
|
}
|
|
11657
12107
|
});
|
|
11658
|
-
var statusCommand = new
|
|
12108
|
+
var statusCommand = new Command31("status").description("Run `git status` in the box's /workspace (read-only, no relay)").argument("<box>", "box ref").argument("[args...]", "extra flags forwarded to `git status`").allowExcessArguments(true).allowUnknownOption(true).action(async (boxRef, args) => {
|
|
11659
12109
|
try {
|
|
11660
12110
|
const box = await resolveBoxOrExit(boxRef);
|
|
11661
12111
|
await exitWith(await runAndStream(box, ["git", "status", ...args]));
|
|
@@ -11681,7 +12131,7 @@ function injectPrCreateHead2(op, box, args) {
|
|
|
11681
12131
|
return injectPrCreateHead(op, rootWt?.branch, args);
|
|
11682
12132
|
}
|
|
11683
12133
|
function buildPrSubcommand(op) {
|
|
11684
|
-
return new
|
|
12134
|
+
return new Command31(op).description(PR_OP_DESCRIPTIONS[op]).argument("<box>", "box ref").argument(
|
|
11685
12135
|
"[args...]",
|
|
11686
12136
|
"extra flags forwarded to `gh pr <op>` (e.g. --title, --body, --label, --draft, --json)"
|
|
11687
12137
|
).allowExcessArguments(true).allowUnknownOption(true).action(async (boxRef, args) => {
|
|
@@ -11697,27 +12147,27 @@ function buildPrSubcommand(op) {
|
|
|
11697
12147
|
}
|
|
11698
12148
|
});
|
|
11699
12149
|
}
|
|
11700
|
-
var prCommand = new
|
|
12150
|
+
var prCommand = new Command31("pr").description(
|
|
11701
12151
|
"PR operations against a box's branch via the host `gh` CLI"
|
|
11702
12152
|
);
|
|
11703
12153
|
for (const op of GH_PR_OPS) {
|
|
11704
12154
|
const sub = buildPrSubcommand(op);
|
|
11705
12155
|
prCommand.addCommand(sub, op === "create" ? { isDefault: true } : void 0);
|
|
11706
12156
|
}
|
|
11707
|
-
var gitCommand = new
|
|
12157
|
+
var gitCommand = new Command31("git").description("Run git / gh pr operations against a box from the host").addCommand(pushCommand).addCommand(fetchCommand).addCommand(pullCommand).addCommand(checkoutCommand).addCommand(statusCommand).addCommand(prCommand);
|
|
11708
12158
|
|
|
11709
12159
|
// src/commands/list.ts
|
|
11710
|
-
import { log as
|
|
11711
|
-
import { Command as
|
|
12160
|
+
import { log as log37 } from "@clack/prompts";
|
|
12161
|
+
import { Command as Command32 } from "commander";
|
|
11712
12162
|
import { pathToFileURL } from "url";
|
|
11713
12163
|
|
|
11714
12164
|
// src/hyperlink.ts
|
|
11715
12165
|
import { supportsHyperlink } from "supports-hyperlinks";
|
|
11716
12166
|
var ESC2 = "\x1B";
|
|
11717
12167
|
var ST = `${ESC2}\\`;
|
|
11718
|
-
function hyperlink(label, url, stream) {
|
|
12168
|
+
function hyperlink(label, url, stream, force = false) {
|
|
11719
12169
|
const out = stream ?? process.stdout;
|
|
11720
|
-
if (!supportsHyperlink(out)) return label;
|
|
12170
|
+
if (!force && !supportsHyperlink(out)) return label;
|
|
11721
12171
|
return `${ESC2}]8;;${url}${ST}${label}${ESC2}]8;;${ST}`;
|
|
11722
12172
|
}
|
|
11723
12173
|
|
|
@@ -11966,7 +12416,7 @@ function projectHeader(label, color, width) {
|
|
|
11966
12416
|
const h = `\u2500\u2500 ${name} \u2500\u2500`;
|
|
11967
12417
|
return color ? colorize(h, "dim") : h;
|
|
11968
12418
|
}
|
|
11969
|
-
function renderCmuxRows(boxes, color, width) {
|
|
12419
|
+
function renderCmuxRows(boxes, color, width, linkNames = false) {
|
|
11970
12420
|
const groups = /* @__PURE__ */ new Map();
|
|
11971
12421
|
for (const b of boxes) {
|
|
11972
12422
|
const key = b.projectRoot ?? "";
|
|
@@ -11982,7 +12432,9 @@ function renderCmuxRows(boxes, color, width) {
|
|
|
11982
12432
|
lines.push(projectHeader(projectLabel(root), color, width));
|
|
11983
12433
|
for (const b of group) {
|
|
11984
12434
|
const idx = b.projectIndex ? `${String(b.projectIndex)} ` : "";
|
|
11985
|
-
|
|
12435
|
+
const disp = tailKeep(b.name, Math.max(1, width - idx.length));
|
|
12436
|
+
const name = linkNames ? hyperlink(disp, `agentbox://web/${b.id}`, void 0, true) : disp;
|
|
12437
|
+
lines.push(`${idx}${name}`);
|
|
11986
12438
|
lines.push(" " + cmuxStatusCell(b, color));
|
|
11987
12439
|
}
|
|
11988
12440
|
}
|
|
@@ -11991,11 +12443,11 @@ function renderCmuxRows(boxes, color, width) {
|
|
|
11991
12443
|
function cmuxEmptyMessage() {
|
|
11992
12444
|
return "no boxes \xB7 agentbox create";
|
|
11993
12445
|
}
|
|
11994
|
-
async function buildCmuxText(live, color) {
|
|
12446
|
+
async function buildCmuxText(live, color, linkNames = false) {
|
|
11995
12447
|
const { boxes } = await scopedBoxes(true, live);
|
|
11996
12448
|
if (boxes.length === 0) return cmuxEmptyMessage();
|
|
11997
12449
|
const width = process.stdout.columns ?? 30;
|
|
11998
|
-
return renderCmuxRows(boxes, color, width);
|
|
12450
|
+
return renderCmuxRows(boxes, color, width, linkNames);
|
|
11999
12451
|
}
|
|
12000
12452
|
function renderTable(boxes, stream) {
|
|
12001
12453
|
const header = ["N", "NAME", "STATE", "AGENT", "SHELLS", "PROVIDER", "URL", "WORKSPACE"];
|
|
@@ -12064,24 +12516,30 @@ async function buildListText(all, live) {
|
|
|
12064
12516
|
${table}`;
|
|
12065
12517
|
}
|
|
12066
12518
|
var listCommand2 = withWatchOptions(
|
|
12067
|
-
new
|
|
12519
|
+
new Command32("list").alias("ls").description("List agent boxes in the current project (-g for all)").option("-j, --json", "machine-readable JSON output").option("-g, --global", "include boxes from all projects").option(
|
|
12068
12520
|
"--live",
|
|
12069
12521
|
"probe live cloud state via the provider SDK (slower; default: last host-known state)"
|
|
12070
|
-
).option("--cmux", "compact output for the cmux dock sidebar (narrow, 2 lines per box)")
|
|
12522
|
+
).option("--cmux", "compact output for the cmux dock sidebar (narrow, 2 lines per box)").option(
|
|
12523
|
+
"--herdr",
|
|
12524
|
+
"compact output for the Herdr boxes overlay (like --cmux; box names link to the box web app)"
|
|
12525
|
+
)
|
|
12071
12526
|
).action(async (opts) => {
|
|
12072
12527
|
if (opts.json && opts.watch) {
|
|
12073
|
-
|
|
12528
|
+
log37.error("cannot combine --json with --watch");
|
|
12074
12529
|
process.exit(2);
|
|
12075
12530
|
}
|
|
12076
12531
|
const all = opts.global ?? false;
|
|
12077
12532
|
const live = opts.live ?? false;
|
|
12078
|
-
if (opts.cmux) {
|
|
12533
|
+
if (opts.cmux || opts.herdr) {
|
|
12079
12534
|
const color = !!process.stdout.isTTY && !process.env.NO_COLOR;
|
|
12535
|
+
const linkNames = !!opts.herdr;
|
|
12080
12536
|
if (opts.watch) {
|
|
12081
|
-
await watchRender(() => buildCmuxText(live, color), opts.interval, {
|
|
12537
|
+
await watchRender(() => buildCmuxText(live, color, linkNames), opts.interval, {
|
|
12538
|
+
hideStatusLine: true
|
|
12539
|
+
});
|
|
12082
12540
|
return;
|
|
12083
12541
|
}
|
|
12084
|
-
process.stdout.write(await buildCmuxText(live, color) + "\n");
|
|
12542
|
+
process.stdout.write(await buildCmuxText(live, color, linkNames) + "\n");
|
|
12085
12543
|
return;
|
|
12086
12544
|
}
|
|
12087
12545
|
if (opts.watch) {
|
|
@@ -12112,11 +12570,11 @@ var listCommand2 = withWatchOptions(
|
|
|
12112
12570
|
});
|
|
12113
12571
|
|
|
12114
12572
|
// src/commands/logs.ts
|
|
12115
|
-
import { log as
|
|
12116
|
-
import { Command as
|
|
12573
|
+
import { log as log38 } from "@clack/prompts";
|
|
12574
|
+
import { Command as Command33 } from "commander";
|
|
12117
12575
|
import { spawn as spawn3 } from "child_process";
|
|
12118
12576
|
var DAEMON_LOG_PATH = "/var/log/agentbox/ctl-daemon.log";
|
|
12119
|
-
var logsCommand = new
|
|
12577
|
+
var logsCommand = new Command33("logs").description("Print recent log lines from a box service; -f to stream").argument(
|
|
12120
12578
|
"[box]",
|
|
12121
12579
|
"box ref (optional when cwd has exactly 1 box): project index, id, id prefix, name, or container"
|
|
12122
12580
|
).argument("[service]", "service name from agentbox.yaml").option("-n, --tail <n>", "how many recent lines to print first", "200").option("-f, --follow", "keep the connection open and stream new lines").option(
|
|
@@ -12134,9 +12592,9 @@ var logsCommand = new Command32("logs").description("Print recent log lines from
|
|
|
12134
12592
|
service = boxArg;
|
|
12135
12593
|
}
|
|
12136
12594
|
if (!service && !opts.daemon) {
|
|
12137
|
-
|
|
12138
|
-
|
|
12139
|
-
|
|
12595
|
+
log38.error("missing <service> argument");
|
|
12596
|
+
log38.info("usage: agentbox logs [box] <service> [-n N] [-f]");
|
|
12597
|
+
log38.info(" agentbox logs [box] --daemon [-n N] [-f]");
|
|
12140
12598
|
process.exit(2);
|
|
12141
12599
|
}
|
|
12142
12600
|
const box = await resolveBoxOrExit(idOrName);
|
|
@@ -12147,7 +12605,7 @@ var logsCommand = new Command32("logs").description("Print recent log lines from
|
|
|
12147
12605
|
if (!opts.follow) {
|
|
12148
12606
|
const proc = await provider.exec(box, args, { user: "vscode" });
|
|
12149
12607
|
if (proc.exitCode !== 0) {
|
|
12150
|
-
|
|
12608
|
+
log38.error(
|
|
12151
12609
|
`${opts.daemon ? "daemon log" : "agentbox-ctl logs"} failed: ${proc.stderr || proc.stdout}`
|
|
12152
12610
|
);
|
|
12153
12611
|
process.exit(1);
|
|
@@ -12203,12 +12661,12 @@ var logsCommand = new Command32("logs").description("Print recent log lines from
|
|
|
12203
12661
|
});
|
|
12204
12662
|
|
|
12205
12663
|
// src/commands/open.ts
|
|
12206
|
-
import { log as
|
|
12207
|
-
import { execa as
|
|
12208
|
-
import { existsSync as
|
|
12209
|
-
import { homedir as
|
|
12210
|
-
import { join as
|
|
12211
|
-
import { Command as
|
|
12664
|
+
import { log as log39 } from "@clack/prompts";
|
|
12665
|
+
import { execa as execa6 } from "execa";
|
|
12666
|
+
import { existsSync as existsSync11, mkdirSync as mkdirSync9 } from "fs";
|
|
12667
|
+
import { homedir as homedir19 } from "os";
|
|
12668
|
+
import { join as join22 } from "path";
|
|
12669
|
+
import { Command as Command34 } from "commander";
|
|
12212
12670
|
|
|
12213
12671
|
// src/commands/path.ts
|
|
12214
12672
|
async function runPath(box, opts) {
|
|
@@ -12230,7 +12688,7 @@ async function runPath(box, opts) {
|
|
|
12230
12688
|
}
|
|
12231
12689
|
|
|
12232
12690
|
// src/commands/open.ts
|
|
12233
|
-
var openCommand = new
|
|
12691
|
+
var openCommand = new Command34("open").description("Open a box's /workspace in Finder (docker: rsync'd snapshot; cloud: sshfs mount)").argument(
|
|
12234
12692
|
"[box]",
|
|
12235
12693
|
"box ref: project index, id, id prefix, name, or container (default: the only box in this project)"
|
|
12236
12694
|
).option("--no-refresh", "skip the rsync; open whatever's already on disk (docker only)").option(
|
|
@@ -12269,7 +12727,7 @@ var openCommand = new Command33("open").description("Open a box's /workspace in
|
|
|
12269
12727
|
}
|
|
12270
12728
|
});
|
|
12271
12729
|
async function runCloudOpen(box, provider, opts) {
|
|
12272
|
-
const mountRoot =
|
|
12730
|
+
const mountRoot = join22(homedir19(), ".agentbox", "mounts", box.name);
|
|
12273
12731
|
if (opts.unmount) {
|
|
12274
12732
|
const ok = await tryUnmount(mountRoot);
|
|
12275
12733
|
if (ok) process.stdout.write(`unmounted ${mountRoot}
|
|
@@ -12306,14 +12764,14 @@ async function runCloudOpen(box, provider, opts) {
|
|
|
12306
12764
|
user: target.user,
|
|
12307
12765
|
identityFile: target.identityFile
|
|
12308
12766
|
});
|
|
12309
|
-
if (!
|
|
12310
|
-
|
|
12767
|
+
if (!existsSync11(mountRoot)) {
|
|
12768
|
+
mkdirSync9(mountRoot, { recursive: true, mode: 493 });
|
|
12311
12769
|
} else if (await isMounted(mountRoot)) {
|
|
12312
|
-
|
|
12770
|
+
log39.info(`re-mounting (stale mount detected at ${mountRoot})`);
|
|
12313
12771
|
await tryUnmount(mountRoot);
|
|
12314
12772
|
}
|
|
12315
|
-
|
|
12316
|
-
const mount = await
|
|
12773
|
+
log39.info(`mounting ${alias}:/workspace at ${mountRoot}`);
|
|
12774
|
+
const mount = await execa6(
|
|
12317
12775
|
sshfsBin,
|
|
12318
12776
|
[
|
|
12319
12777
|
`${alias}:/workspace`,
|
|
@@ -12332,35 +12790,35 @@ async function runCloudOpen(box, provider, opts) {
|
|
|
12332
12790
|
if (mount.exitCode !== 0) {
|
|
12333
12791
|
throw new Error(`sshfs mount failed (exit ${String(mount.exitCode)}): ${mount.stderr || mount.stdout}`);
|
|
12334
12792
|
}
|
|
12335
|
-
await
|
|
12793
|
+
await execa6(hostOpenCommand(), [mountRoot], { reject: false });
|
|
12336
12794
|
process.stdout.write(`opened ${mountRoot}
|
|
12337
12795
|
`);
|
|
12338
12796
|
process.stdout.write(`unmount later with: agentbox open ${box.name} --unmount
|
|
12339
12797
|
`);
|
|
12340
12798
|
}
|
|
12341
12799
|
async function locateBinary(name) {
|
|
12342
|
-
const r = await
|
|
12800
|
+
const r = await execa6("which", [name], { reject: false });
|
|
12343
12801
|
if (r.exitCode !== 0) return null;
|
|
12344
12802
|
const path = (r.stdout ?? "").trim();
|
|
12345
12803
|
return path.length > 0 ? path : null;
|
|
12346
12804
|
}
|
|
12347
12805
|
async function isMounted(path) {
|
|
12348
|
-
const r = await
|
|
12806
|
+
const r = await execa6("sh", ["-c", `mount | grep -F " on ${path} "`], { reject: false });
|
|
12349
12807
|
return r.exitCode === 0;
|
|
12350
12808
|
}
|
|
12351
12809
|
async function tryUnmount(path) {
|
|
12352
12810
|
if (await isMounted(path)) {
|
|
12353
|
-
const u = await
|
|
12811
|
+
const u = await execa6("umount", [path], { reject: false });
|
|
12354
12812
|
if (u.exitCode === 0) return true;
|
|
12355
|
-
const d = await
|
|
12813
|
+
const d = await execa6("diskutil", ["unmount", path], { reject: false });
|
|
12356
12814
|
return d.exitCode === 0;
|
|
12357
12815
|
}
|
|
12358
12816
|
return false;
|
|
12359
12817
|
}
|
|
12360
12818
|
|
|
12361
12819
|
// src/commands/pause.ts
|
|
12362
|
-
import { Command as
|
|
12363
|
-
var pauseCommand = new
|
|
12820
|
+
import { Command as Command35 } from "commander";
|
|
12821
|
+
var pauseCommand = new Command35("pause").description(
|
|
12364
12822
|
"Pause a box. Docker: `docker pause` (cgroup freeze \u2014 sub-second resume). Cloud: backend.pause (Daytona archive \u2014 cold storage; resume is slower but uses no quota while archived)."
|
|
12365
12823
|
).argument(
|
|
12366
12824
|
"[box]",
|
|
@@ -12383,7 +12841,7 @@ var pauseCommand = new Command34("pause").description(
|
|
|
12383
12841
|
});
|
|
12384
12842
|
|
|
12385
12843
|
// src/commands/prune.ts
|
|
12386
|
-
import { Command as
|
|
12844
|
+
import { Command as Command36 } from "commander";
|
|
12387
12845
|
function totalRemovals(r, projectConfigs) {
|
|
12388
12846
|
return r.removedRecords.length + r.removedContainers.length + r.removedVolumes.length + r.removedSnapshotDirs.length + r.removedBoxDirs.length + projectConfigs.length;
|
|
12389
12847
|
}
|
|
@@ -12429,7 +12887,7 @@ async function liveProjectRoots() {
|
|
|
12429
12887
|
return [];
|
|
12430
12888
|
}
|
|
12431
12889
|
}
|
|
12432
|
-
var pruneCommand = new
|
|
12890
|
+
var pruneCommand = new Command36("prune").description("Clean up orphan state.json records (and with --all, orphan docker resources)").option("--dry-run", "show what would be removed, don't change anything").option(
|
|
12433
12891
|
"--all",
|
|
12434
12892
|
"also remove orphan agentbox-* containers, volumes, snapshot dirs, and orphan per-project config dirs"
|
|
12435
12893
|
).option("-y, --yes", "skip the confirmation prompt").option(
|
|
@@ -12543,17 +13001,17 @@ async function pruneCloud(provider, opts) {
|
|
|
12543
13001
|
|
|
12544
13002
|
// src/commands/queue.ts
|
|
12545
13003
|
import { readFile as readFile6, stat as stat6 } from "fs/promises";
|
|
12546
|
-
import { intro as
|
|
12547
|
-
import { Command as
|
|
13004
|
+
import { intro as intro10, log as log41, outro as outro9 } from "@clack/prompts";
|
|
13005
|
+
import { Command as Command37 } from "commander";
|
|
12548
13006
|
var TERMINAL_STATUSES = /* @__PURE__ */ new Set(["done", "failed", "cancelled"]);
|
|
12549
|
-
var queueCommand = new
|
|
12550
|
-
var queueListCommand = new
|
|
13007
|
+
var queueCommand = new Command37("queue").description("Inspect and manage background `agentbox claude|codex|opencode -i` jobs");
|
|
13008
|
+
var queueListCommand = new Command37("list").description("List queued, running, and (with --all) terminal background jobs").option("--all", "include done/failed/cancelled jobs (default: hide terminal)").action(async (opts) => {
|
|
12551
13009
|
const jobs = await loadQueue();
|
|
12552
13010
|
const cfg = await loadQueueConfig();
|
|
12553
13011
|
const visible = opts.all === true ? jobs : jobs.filter((j) => !TERMINAL_STATUSES.has(j.status));
|
|
12554
13012
|
if (visible.length === 0) {
|
|
12555
|
-
|
|
12556
|
-
|
|
13013
|
+
log41.info(opts.all ? "no queued jobs." : "no active queued jobs (--all to see terminal).");
|
|
13014
|
+
log41.info(`queue.maxConcurrent = ${String(cfg.maxConcurrent)} (queue.enabled=${String(cfg.enabled)})`);
|
|
12557
13015
|
return;
|
|
12558
13016
|
}
|
|
12559
13017
|
const rows = visible.map((j) => ({
|
|
@@ -12578,12 +13036,12 @@ var queueListCommand = new Command36("list").description("List queued, running,
|
|
|
12578
13036
|
headers.map((h, i) => pad4(String(r[h]), widths[i])).join(" ") + "\n"
|
|
12579
13037
|
);
|
|
12580
13038
|
}
|
|
12581
|
-
|
|
13039
|
+
log41.info(`queue.maxConcurrent = ${String(cfg.maxConcurrent)} (queue.enabled=${String(cfg.enabled)})`);
|
|
12582
13040
|
});
|
|
12583
|
-
var queueShowCommand = new
|
|
13041
|
+
var queueShowCommand = new Command37("show").description("Dump a job manifest and tail its log").argument("<id>", "queue job id (from `agentbox queue list`)").option("--tail <n>", "lines of log to print (default: 50)", "50").action(async (id, opts) => {
|
|
12584
13042
|
const job = await readJob(id);
|
|
12585
13043
|
if (!job) {
|
|
12586
|
-
|
|
13044
|
+
log41.error(`no job with id ${id}`);
|
|
12587
13045
|
process.exit(1);
|
|
12588
13046
|
}
|
|
12589
13047
|
process.stdout.write(JSON.stringify(job, null, 2) + "\n");
|
|
@@ -12599,18 +13057,18 @@ var queueShowCommand = new Command36("show").description("Dump a job manifest an
|
|
|
12599
13057
|
process.stdout.write(slice.join("\n"));
|
|
12600
13058
|
if (!slice.join("\n").endsWith("\n")) process.stdout.write("\n");
|
|
12601
13059
|
} catch {
|
|
12602
|
-
|
|
13060
|
+
log41.info(`(no log at ${job.logPath} yet)`);
|
|
12603
13061
|
}
|
|
12604
13062
|
});
|
|
12605
|
-
var queueCancelCommand = new
|
|
12606
|
-
|
|
13063
|
+
var queueCancelCommand = new Command37("cancel").description("Cancel a queued job; running jobs are NOT killed \u2014 use `agentbox destroy` instead").argument("<id>", "queue job id (from `agentbox queue list`)").action(async (id) => {
|
|
13064
|
+
intro10(`Cancelling queue job ${id}...`);
|
|
12607
13065
|
const job = await readJob(id);
|
|
12608
13066
|
if (!job) {
|
|
12609
|
-
|
|
13067
|
+
log41.error(`no job with id ${id}`);
|
|
12610
13068
|
process.exit(1);
|
|
12611
13069
|
}
|
|
12612
13070
|
if (job.status !== "queued") {
|
|
12613
|
-
|
|
13071
|
+
log41.error(
|
|
12614
13072
|
`job ${id} is ${job.status}; cancel only flips 'queued' \u2192 'cancelled'.` + (job.status === "running" ? ` Use 'agentbox destroy ${job.boxName || id}' to stop the box.` : "")
|
|
12615
13073
|
);
|
|
12616
13074
|
process.exit(1);
|
|
@@ -12622,15 +13080,15 @@ var queueCancelCommand = new Command36("cancel").description("Cancel a queued jo
|
|
|
12622
13080
|
reason: "cancelled by user"
|
|
12623
13081
|
};
|
|
12624
13082
|
await writeJob(cancelled);
|
|
12625
|
-
|
|
13083
|
+
outro9(`job ${id} cancelled`);
|
|
12626
13084
|
});
|
|
12627
|
-
var queueClearCommand = new
|
|
13085
|
+
var queueClearCommand = new Command37("clear").description("Sweep terminal-state manifests from ~/.agentbox/queue/").option("--done", "remove done jobs").option("--failed", "remove failed jobs").option("--cancelled", "remove cancelled jobs").option("--all", "remove every terminal-state job (done + failed + cancelled)").action(async (opts) => {
|
|
12628
13086
|
const targets = /* @__PURE__ */ new Set();
|
|
12629
13087
|
if (opts.all === true || opts.done === true) targets.add("done");
|
|
12630
13088
|
if (opts.all === true || opts.failed === true) targets.add("failed");
|
|
12631
13089
|
if (opts.all === true || opts.cancelled === true) targets.add("cancelled");
|
|
12632
13090
|
if (targets.size === 0) {
|
|
12633
|
-
|
|
13091
|
+
log41.error("pick at least one of: --done, --failed, --cancelled, --all");
|
|
12634
13092
|
process.exit(2);
|
|
12635
13093
|
}
|
|
12636
13094
|
const jobs = await loadQueue();
|
|
@@ -12640,7 +13098,7 @@ var queueClearCommand = new Command36("clear").description("Sweep terminal-state
|
|
|
12640
13098
|
await deleteJob(j.id);
|
|
12641
13099
|
removed += 1;
|
|
12642
13100
|
}
|
|
12643
|
-
|
|
13101
|
+
log41.success(`removed ${String(removed)} manifest${removed === 1 ? "" : "s"}`);
|
|
12644
13102
|
});
|
|
12645
13103
|
var QUEUE_WAIT_EVENTS = [
|
|
12646
13104
|
"new-box",
|
|
@@ -12653,11 +13111,11 @@ var QUEUE_WAIT_EVENTS = [
|
|
|
12653
13111
|
var ACTIVE_JOB_STATUSES = /* @__PURE__ */ new Set(["queued", "running"]);
|
|
12654
13112
|
var DEFAULT_QUEUE_WAIT_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
12655
13113
|
var QUEUE_POLL_INTERVAL_MS = 500;
|
|
12656
|
-
var queueWaitForCommand = new
|
|
13114
|
+
var queueWaitForCommand = new Command37("wait-for").description(
|
|
12657
13115
|
`Block until a queue / box event fires. <event> one of: ${QUEUE_WAIT_EVENTS.join(" | ")}.`
|
|
12658
13116
|
).argument("<event>", `target event: ${QUEUE_WAIT_EVENTS.join(" | ")}`).option("--box <ref>", "box ref (required for box-paused / box-running / box-stopped)").option("--job <id>", "queue job id (required for job-done)").option("--timeout <ms>", `wall-clock cap (default: ${String(DEFAULT_QUEUE_WAIT_TIMEOUT_MS)})`).option("--json", "emit a JSON envelope { matched, elapsedMs, ... }").action(async (eventRaw, opts) => {
|
|
12659
13117
|
if (!QUEUE_WAIT_EVENTS.includes(eventRaw)) {
|
|
12660
|
-
|
|
13118
|
+
log41.error(`unknown event '${eventRaw}' (one of: ${QUEUE_WAIT_EVENTS.join(", ")})`);
|
|
12661
13119
|
process.exit(2);
|
|
12662
13120
|
}
|
|
12663
13121
|
const event = eventRaw;
|
|
@@ -12677,11 +13135,11 @@ var queueWaitForCommand = new Command36("wait-for").description(
|
|
|
12677
13135
|
if (opts.json === true) {
|
|
12678
13136
|
process.stdout.write(JSON.stringify({ matched: false, event, elapsedMs }) + "\n");
|
|
12679
13137
|
} else {
|
|
12680
|
-
|
|
13138
|
+
log41.error(`'${event}' did not occur within ${String(timeoutMs)}ms`);
|
|
12681
13139
|
}
|
|
12682
13140
|
process.exit(1);
|
|
12683
13141
|
}
|
|
12684
|
-
|
|
13142
|
+
log41.error(err instanceof Error ? err.message : String(err));
|
|
12685
13143
|
process.exit(1);
|
|
12686
13144
|
}
|
|
12687
13145
|
});
|
|
@@ -12778,8 +13236,8 @@ function truncate(s, max) {
|
|
|
12778
13236
|
}
|
|
12779
13237
|
|
|
12780
13238
|
// src/commands/relay.ts
|
|
12781
|
-
import { log as
|
|
12782
|
-
import { Command as
|
|
13239
|
+
import { log as log42, spinner as spinner9 } from "@clack/prompts";
|
|
13240
|
+
import { Command as Command38 } from "commander";
|
|
12783
13241
|
async function rehydrateFromState() {
|
|
12784
13242
|
const state = await readState();
|
|
12785
13243
|
await rehydrateRelayRegistry(
|
|
@@ -12822,7 +13280,7 @@ function renderStatus(s) {
|
|
|
12822
13280
|
}
|
|
12823
13281
|
return ["relay: not running", ` log: ${s.logFile}`].join("\n");
|
|
12824
13282
|
}
|
|
12825
|
-
var statusSub = new
|
|
13283
|
+
var statusSub = new Command38("status").description("Show whether the host relay is running, with pid / port / box count").option("--json", "emit RelayStatus as JSON").action(async (opts) => {
|
|
12826
13284
|
try {
|
|
12827
13285
|
const s = await getRelayStatus();
|
|
12828
13286
|
if (opts.json) {
|
|
@@ -12834,7 +13292,7 @@ var statusSub = new Command37("status").description("Show whether the host relay
|
|
|
12834
13292
|
handleLifecycleError(err);
|
|
12835
13293
|
}
|
|
12836
13294
|
});
|
|
12837
|
-
var stopSub = new
|
|
13295
|
+
var stopSub = new Command38("stop").description("Stop the host relay process (idempotent)").action(async () => {
|
|
12838
13296
|
try {
|
|
12839
13297
|
const s = spinner9();
|
|
12840
13298
|
s.start("stopping relay");
|
|
@@ -12846,7 +13304,7 @@ var stopSub = new Command37("stop").description("Stop the host relay process (id
|
|
|
12846
13304
|
handleLifecycleError(err);
|
|
12847
13305
|
}
|
|
12848
13306
|
});
|
|
12849
|
-
var startSub = new
|
|
13307
|
+
var startSub = new Command38("start").description("Start the host relay if not already running (idempotent)").action(async () => {
|
|
12850
13308
|
try {
|
|
12851
13309
|
const s = spinner9();
|
|
12852
13310
|
s.start("starting relay");
|
|
@@ -12857,7 +13315,7 @@ var startSub = new Command37("start").description("Start the host relay if not a
|
|
|
12857
13315
|
handleLifecycleError(err);
|
|
12858
13316
|
}
|
|
12859
13317
|
});
|
|
12860
|
-
var restartSub = new
|
|
13318
|
+
var restartSub = new Command38("restart").description("Stop then start the host relay").action(async () => {
|
|
12861
13319
|
try {
|
|
12862
13320
|
const s = spinner9();
|
|
12863
13321
|
s.start("stopping relay");
|
|
@@ -12873,35 +13331,35 @@ var restartSub = new Command37("restart").description("Stop then start the host
|
|
|
12873
13331
|
s2.stop(`relay running on ${ep.hostUrl}`);
|
|
12874
13332
|
} catch (err) {
|
|
12875
13333
|
s2.stop("relay start failed");
|
|
12876
|
-
|
|
13334
|
+
log42.warn(err instanceof Error ? err.message : String(err));
|
|
12877
13335
|
throw err;
|
|
12878
13336
|
}
|
|
12879
13337
|
} catch (err) {
|
|
12880
13338
|
handleLifecycleError(err);
|
|
12881
13339
|
}
|
|
12882
13340
|
});
|
|
12883
|
-
var relayCommand = new
|
|
13341
|
+
var relayCommand = new Command38("relay").description("Manage the host relay process (status / stop / start / restart)").addCommand(statusSub, { isDefault: true }).addCommand(stopSub).addCommand(startSub).addCommand(restartSub);
|
|
12884
13342
|
|
|
12885
13343
|
// src/commands/_run-queued-job.ts
|
|
12886
|
-
import { Command as
|
|
12887
|
-
var runQueuedJobCommand = new
|
|
12888
|
-
const
|
|
12889
|
-
|
|
13344
|
+
import { Command as Command39 } from "commander";
|
|
13345
|
+
var runQueuedJobCommand = new Command39("_run-queued-job").description("internal: run a queued background agent job (do not invoke directly)").argument("<id>", "queue job id (from ~/.agentbox/queue/<id>.json)").action(async (id) => {
|
|
13346
|
+
const log51 = openCommandLog(`queue-${id}`);
|
|
13347
|
+
log51.write(`worker pid=${String(process.pid)} starting for job ${id}`);
|
|
12890
13348
|
let job = null;
|
|
12891
13349
|
try {
|
|
12892
13350
|
job = await readJob(id);
|
|
12893
13351
|
if (!job) {
|
|
12894
|
-
|
|
12895
|
-
|
|
13352
|
+
log51.write(`FATAL: no manifest at id=${id}`);
|
|
13353
|
+
log51.close();
|
|
12896
13354
|
process.exit(64);
|
|
12897
13355
|
}
|
|
12898
13356
|
const onBoxCreated = (boxId) => {
|
|
12899
13357
|
if (job) job = { ...job, boxId };
|
|
12900
13358
|
};
|
|
12901
13359
|
if ((job.providerName || "docker") === "docker") {
|
|
12902
|
-
await runDockerJob(job,
|
|
13360
|
+
await runDockerJob(job, log51, onBoxCreated);
|
|
12903
13361
|
} else {
|
|
12904
|
-
await runCloudJob(job,
|
|
13362
|
+
await runCloudJob(job, log51, onBoxCreated);
|
|
12905
13363
|
}
|
|
12906
13364
|
const done = {
|
|
12907
13365
|
...job,
|
|
@@ -12910,12 +13368,12 @@ var runQueuedJobCommand = new Command38("_run-queued-job").description("internal
|
|
|
12910
13368
|
exitCode: 0
|
|
12911
13369
|
};
|
|
12912
13370
|
await writeJob(done);
|
|
12913
|
-
|
|
12914
|
-
|
|
13371
|
+
log51.write(`done`);
|
|
13372
|
+
log51.close();
|
|
12915
13373
|
process.exit(0);
|
|
12916
13374
|
} catch (err) {
|
|
12917
13375
|
const msg = err instanceof Error ? err.stack ?? err.message : String(err);
|
|
12918
|
-
|
|
13376
|
+
log51.write(`FAIL: ${msg}`);
|
|
12919
13377
|
if (job) {
|
|
12920
13378
|
try {
|
|
12921
13379
|
const failed = {
|
|
@@ -12929,11 +13387,11 @@ var runQueuedJobCommand = new Command38("_run-queued-job").description("internal
|
|
|
12929
13387
|
} catch {
|
|
12930
13388
|
}
|
|
12931
13389
|
}
|
|
12932
|
-
|
|
13390
|
+
log51.close();
|
|
12933
13391
|
process.exit(1);
|
|
12934
13392
|
}
|
|
12935
13393
|
});
|
|
12936
|
-
async function runDockerJob(job,
|
|
13394
|
+
async function runDockerJob(job, log51, onBoxCreated) {
|
|
12937
13395
|
const opts = job.createOpts;
|
|
12938
13396
|
const cfg = await loadEffectiveConfig(opts.workspace, {
|
|
12939
13397
|
cliOverrides: buildOverridesFromJob(job)
|
|
@@ -12945,7 +13403,7 @@ async function runDockerJob(job, log48, onBoxCreated) {
|
|
|
12945
13403
|
const useSnapshot = opts.hostSnapshot === false ? false : opts.hostSnapshot === true ? true : cfg.effective.box.hostSnapshot ?? false;
|
|
12946
13404
|
const resolved = job.agent === "claude-code" ? await resolveClaudeAuth(process.env) : null;
|
|
12947
13405
|
const withPlaywright = cfg.effective.box.withPlaywright || cfg.effective.browser.default !== "agent-browser";
|
|
12948
|
-
|
|
13406
|
+
log51.write(`creating box for agent=${job.agent}`);
|
|
12949
13407
|
const result = await createBox({
|
|
12950
13408
|
workspacePath: opts.workspace,
|
|
12951
13409
|
name: opts.name && opts.name.length > 0 ? opts.name : void 0,
|
|
@@ -12971,22 +13429,22 @@ async function runDockerJob(job, log48, onBoxCreated) {
|
|
|
12971
13429
|
// at box-create time (the worker runs on the host, so it can read the files).
|
|
12972
13430
|
carry: opts.carry,
|
|
12973
13431
|
projectRoot,
|
|
12974
|
-
onLog: (line) =>
|
|
13432
|
+
onLog: (line) => log51.write(line)
|
|
12975
13433
|
});
|
|
12976
|
-
|
|
13434
|
+
log51.write(`box created: ${result.record.container}`);
|
|
12977
13435
|
onBoxCreated(result.record.id);
|
|
12978
13436
|
await writeJob({ ...job, boxId: result.record.id });
|
|
12979
13437
|
const resyncWarning = result.resync ? buildResyncWarning(result.resync) : null;
|
|
12980
|
-
if (resyncWarning)
|
|
13438
|
+
if (resyncWarning) log51.write(resyncWarning);
|
|
12981
13439
|
const prompt = prependResyncWarning(resyncWarning, job.prompt);
|
|
12982
13440
|
const promptedArgs = buildPromptArgs(job.agent, prompt, job.agentArgs);
|
|
12983
13441
|
if (job.agent === "claude-code") {
|
|
12984
|
-
|
|
13442
|
+
log51.write(`checking plugin native deps`);
|
|
12985
13443
|
await rebuildPluginNativeDeps(result.record.container, {
|
|
12986
13444
|
volume: result.record.claudeConfigVolume ?? SHARED_CLAUDE_VOLUME,
|
|
12987
|
-
onProgress: (line) =>
|
|
13445
|
+
onProgress: (line) => log51.write(line)
|
|
12988
13446
|
});
|
|
12989
|
-
|
|
13447
|
+
log51.write(`starting claude session`);
|
|
12990
13448
|
await startClaudeSession({
|
|
12991
13449
|
container: result.record.container,
|
|
12992
13450
|
claudeArgs: applyClaudeSkipPermissions(promptedArgs, cfg.effective),
|
|
@@ -12994,22 +13452,22 @@ async function runDockerJob(job, log48, onBoxCreated) {
|
|
|
12994
13452
|
boxName: result.record.name
|
|
12995
13453
|
});
|
|
12996
13454
|
} else if (job.agent === "codex") {
|
|
12997
|
-
|
|
13455
|
+
log51.write(`checking codex`);
|
|
12998
13456
|
await ensureCodexInstalled(result.record.container, {
|
|
12999
|
-
onProgress: (line) =>
|
|
13457
|
+
onProgress: (line) => log51.write(line)
|
|
13000
13458
|
});
|
|
13001
|
-
|
|
13459
|
+
log51.write(`starting codex session`);
|
|
13002
13460
|
await startCodexSession({
|
|
13003
13461
|
container: result.record.container,
|
|
13004
13462
|
codexArgs: applyCodexSkipPermissions(promptedArgs, cfg.effective),
|
|
13005
13463
|
sessionName: cfg.effective.codex.sessionName
|
|
13006
13464
|
});
|
|
13007
13465
|
} else if (job.agent === "opencode") {
|
|
13008
|
-
|
|
13466
|
+
log51.write(`checking opencode`);
|
|
13009
13467
|
await ensureOpencodeInstalled(result.record.container, {
|
|
13010
|
-
onProgress: (line) =>
|
|
13468
|
+
onProgress: (line) => log51.write(line)
|
|
13011
13469
|
});
|
|
13012
|
-
|
|
13470
|
+
log51.write(`starting opencode session`);
|
|
13013
13471
|
await startOpencodeSession({
|
|
13014
13472
|
container: result.record.container,
|
|
13015
13473
|
opencodeArgs: promptedArgs,
|
|
@@ -13018,17 +13476,17 @@ async function runDockerJob(job, log48, onBoxCreated) {
|
|
|
13018
13476
|
} else {
|
|
13019
13477
|
throw new Error(`unknown agent kind: ${String(job.agent)}`);
|
|
13020
13478
|
}
|
|
13021
|
-
await maybeOpenQueuedTerminal(job, result.record.name,
|
|
13479
|
+
await maybeOpenQueuedTerminal(job, result.record.name, log51);
|
|
13022
13480
|
}
|
|
13023
13481
|
function agentBinaryName(agent) {
|
|
13024
13482
|
return agent === "claude-code" ? "claude" : agent;
|
|
13025
13483
|
}
|
|
13026
|
-
async function maybeOpenQueuedTerminal(job, boxName,
|
|
13484
|
+
async function maybeOpenQueuedTerminal(job, boxName, log51) {
|
|
13027
13485
|
const ctx = job.openTerminal;
|
|
13028
13486
|
if (!ctx) return;
|
|
13029
13487
|
const cliEntry = process.env["AGENTBOX_CLI_ENTRY"];
|
|
13030
13488
|
if (!cliEntry) {
|
|
13031
|
-
|
|
13489
|
+
log51.write("queue.openIn: AGENTBOX_CLI_ENTRY unset; cannot open terminal");
|
|
13032
13490
|
return;
|
|
13033
13491
|
}
|
|
13034
13492
|
const argv2 = [
|
|
@@ -13042,14 +13500,14 @@ async function maybeOpenQueuedTerminal(job, boxName, log48) {
|
|
|
13042
13500
|
];
|
|
13043
13501
|
try {
|
|
13044
13502
|
const r = await spawnQueuedOpenTerminal(ctx, argv2, boxName);
|
|
13045
|
-
|
|
13503
|
+
log51.write(
|
|
13046
13504
|
r.launched ? `queue.openIn: ${r.note}` : `queue.openIn: open failed: ${r.error ?? ""}`
|
|
13047
13505
|
);
|
|
13048
13506
|
} catch (err) {
|
|
13049
|
-
|
|
13507
|
+
log51.write(`queue.openIn: open threw: ${err instanceof Error ? err.message : String(err)}`);
|
|
13050
13508
|
}
|
|
13051
13509
|
}
|
|
13052
|
-
async function runCloudJob(job,
|
|
13510
|
+
async function runCloudJob(job, log51, onBoxCreated) {
|
|
13053
13511
|
const opts = job.createOpts;
|
|
13054
13512
|
const cfg = await loadEffectiveConfig(opts.workspace, {
|
|
13055
13513
|
cliOverrides: buildOverridesFromJob(job)
|
|
@@ -13060,7 +13518,7 @@ async function runCloudJob(job, log48, onBoxCreated) {
|
|
|
13060
13518
|
const providerDefault = resolveDefaultCheckpoint(cfg.effective, providerName);
|
|
13061
13519
|
const checkpointRef = opts.snapshot && opts.snapshot.length > 0 ? opts.snapshot : providerDefault.length > 0 ? providerDefault : void 0;
|
|
13062
13520
|
const withPlaywright = cfg.effective.box.withPlaywright || cfg.effective.browser.default !== "agent-browser";
|
|
13063
|
-
|
|
13521
|
+
log51.write(`creating cloud box (${providerName}) for agent=${job.agent}`);
|
|
13064
13522
|
const result = await provider.create({
|
|
13065
13523
|
workspacePath: opts.workspace,
|
|
13066
13524
|
name: opts.name && opts.name.length > 0 ? opts.name : void 0,
|
|
@@ -13074,9 +13532,9 @@ async function runCloudJob(job, log48, onBoxCreated) {
|
|
|
13074
13532
|
// worker runs on the host too, so it reads the files and uploads them.
|
|
13075
13533
|
carry: opts.carry,
|
|
13076
13534
|
projectRoot,
|
|
13077
|
-
onLog: (line) =>
|
|
13535
|
+
onLog: (line) => log51.write(line)
|
|
13078
13536
|
});
|
|
13079
|
-
|
|
13537
|
+
log51.write(`box created: ${result.record.id}`);
|
|
13080
13538
|
onBoxCreated(result.record.id);
|
|
13081
13539
|
await writeJob({ ...job, boxId: result.record.id });
|
|
13082
13540
|
const promptedArgs = buildPromptArgs(job.agent, job.prompt, job.agentArgs);
|
|
@@ -13098,14 +13556,14 @@ async function runCloudJob(job, log48, onBoxCreated) {
|
|
|
13098
13556
|
} else {
|
|
13099
13557
|
throw new Error(`unknown agent kind: ${String(job.agent)}`);
|
|
13100
13558
|
}
|
|
13101
|
-
|
|
13559
|
+
log51.write(`starting detached ${job.agent} session`);
|
|
13102
13560
|
await cloudAgentStartDetached({
|
|
13103
13561
|
box: result.record,
|
|
13104
13562
|
binary,
|
|
13105
13563
|
sessionName,
|
|
13106
13564
|
extraArgs
|
|
13107
13565
|
});
|
|
13108
|
-
await maybeOpenQueuedTerminal(job, result.record.name,
|
|
13566
|
+
await maybeOpenQueuedTerminal(job, result.record.name, log51);
|
|
13109
13567
|
}
|
|
13110
13568
|
function buildOverridesFromJob(job) {
|
|
13111
13569
|
const opts = job.createOpts;
|
|
@@ -13134,10 +13592,86 @@ function buildOverridesFromJob(job) {
|
|
|
13134
13592
|
return out;
|
|
13135
13593
|
}
|
|
13136
13594
|
|
|
13595
|
+
// src/commands/herdr.ts
|
|
13596
|
+
import { spawnSync as spawnSync5 } from "child_process";
|
|
13597
|
+
import { Command as Command40 } from "commander";
|
|
13598
|
+
function parseHerdrLink(uri) {
|
|
13599
|
+
if (!uri) return null;
|
|
13600
|
+
const m = uri.match(/^agentbox:\/\/([^/]+)\/(.+)$/);
|
|
13601
|
+
if (!m) return null;
|
|
13602
|
+
const verb = m[1];
|
|
13603
|
+
const rawBox = m[2];
|
|
13604
|
+
if (!verb || !rawBox) return null;
|
|
13605
|
+
try {
|
|
13606
|
+
return { verb, box: decodeURIComponent(rawBox) };
|
|
13607
|
+
} catch {
|
|
13608
|
+
return { verb, box: rawBox };
|
|
13609
|
+
}
|
|
13610
|
+
}
|
|
13611
|
+
function herdrContextCwd(env = process.env) {
|
|
13612
|
+
const raw = env["HERDR_PLUGIN_CONTEXT_JSON"];
|
|
13613
|
+
if (raw) {
|
|
13614
|
+
try {
|
|
13615
|
+
const ctx = JSON.parse(raw);
|
|
13616
|
+
const cwd = ctx["pane"]?.["cwd"] ?? ctx["workspace"]?.["cwd"];
|
|
13617
|
+
if (typeof cwd === "string" && cwd.length > 0) return cwd;
|
|
13618
|
+
} catch {
|
|
13619
|
+
}
|
|
13620
|
+
}
|
|
13621
|
+
return process.cwd();
|
|
13622
|
+
}
|
|
13623
|
+
var newCommand = new Command40("new").description("Open a new box session in a fresh Herdr tab (used by the plugin shortcut)").option("--agent <agent>", "agent to launch (claude|codex|opencode)", "claude").action(async (opts) => {
|
|
13624
|
+
const agent = opts.agent ?? "claude";
|
|
13625
|
+
const cwd = herdrContextCwd();
|
|
13626
|
+
const r = await spawnInNewTerminal({
|
|
13627
|
+
host: "herdr",
|
|
13628
|
+
mode: "tab",
|
|
13629
|
+
argv: [process.execPath, process.argv[1] ?? "agentbox", agent],
|
|
13630
|
+
cwd,
|
|
13631
|
+
title: `agentbox ${agent}`
|
|
13632
|
+
});
|
|
13633
|
+
if (r.launched) process.stdout.write(r.note + "\n");
|
|
13634
|
+
else if (r.error) process.stderr.write(r.error + "\n");
|
|
13635
|
+
});
|
|
13636
|
+
var linkCommand = new Command40("link").description("Handle a Ctrl+click on an agentbox:// link (used by the plugin link handler)").argument("[uri]", "the clicked URI; defaults to $HERDR_PLUGIN_CLICKED_URL").action(async (uriArg) => {
|
|
13637
|
+
const link = parseHerdrLink(uriArg ?? process.env["HERDR_PLUGIN_CLICKED_URL"]);
|
|
13638
|
+
if (!link) return;
|
|
13639
|
+
if (link.verb !== "web") return;
|
|
13640
|
+
const boxes = await listBoxes();
|
|
13641
|
+
const box = boxes.find((b) => b.id === link.box);
|
|
13642
|
+
if (!box) {
|
|
13643
|
+
herdrSend("notification.show", {
|
|
13644
|
+
title: "AgentBox",
|
|
13645
|
+
body: `box ${link.box} no longer exists`,
|
|
13646
|
+
sound: "request"
|
|
13647
|
+
});
|
|
13648
|
+
return;
|
|
13649
|
+
}
|
|
13650
|
+
const webUrl = box.endpoints.endpoints.find((e) => e.kind === "web" && e.url)?.url;
|
|
13651
|
+
if (webUrl) {
|
|
13652
|
+
spawnSync5(hostOpenCommand(), [webUrl], { stdio: "ignore" });
|
|
13653
|
+
return;
|
|
13654
|
+
}
|
|
13655
|
+
if (box.state !== "running") {
|
|
13656
|
+
herdrSend("notification.show", {
|
|
13657
|
+
title: box.name,
|
|
13658
|
+
body: `box is ${box.state} \u2014 start it, then click again`,
|
|
13659
|
+
sound: "request"
|
|
13660
|
+
});
|
|
13661
|
+
return;
|
|
13662
|
+
}
|
|
13663
|
+
herdrSend("notification.show", {
|
|
13664
|
+
title: box.name,
|
|
13665
|
+
body: "no web app exposed (add a service `expose:` in agentbox.yaml)",
|
|
13666
|
+
sound: "request"
|
|
13667
|
+
});
|
|
13668
|
+
});
|
|
13669
|
+
var herdrCommand = new Command40("herdr").description("Internal: Herdr plugin entry points (see `agentbox install herdr`)").addCommand(newCommand).addCommand(linkCommand);
|
|
13670
|
+
|
|
13137
13671
|
// src/commands/screen.ts
|
|
13138
|
-
import { spawnSync as
|
|
13139
|
-
import { log as
|
|
13140
|
-
import { Command as
|
|
13672
|
+
import { spawnSync as spawnSync6 } from "child_process";
|
|
13673
|
+
import { log as log43 } from "@clack/prompts";
|
|
13674
|
+
import { Command as Command41 } from "commander";
|
|
13141
13675
|
var SIGNED_URL_TTL_MIN = 1;
|
|
13142
13676
|
var SIGNED_URL_TTL_MAX = 86400;
|
|
13143
13677
|
function parseTtlOrExit(raw) {
|
|
@@ -13150,7 +13684,7 @@ function parseTtlOrExit(raw) {
|
|
|
13150
13684
|
}
|
|
13151
13685
|
return n;
|
|
13152
13686
|
}
|
|
13153
|
-
var screenCommand = new
|
|
13687
|
+
var screenCommand = new Command41("screen").description("Open a box's VNC (noVNC) viewer in the browser (auto-unpause/start)").argument(
|
|
13154
13688
|
"[box]",
|
|
13155
13689
|
"box ref: project index, id, id prefix, name, or container (default: the only box in this project)"
|
|
13156
13690
|
).option("--print", "print the URL to stdout instead of launching the browser").option("--loopback", "docker only: use the 127.0.0.1 URL instead of the OrbStack .orb.local URL").option(
|
|
@@ -13167,10 +13701,10 @@ var screenCommand = new Command39("screen").description("Open a box's VNC (noVNC
|
|
|
13167
13701
|
if (provider === "docker") {
|
|
13168
13702
|
const insp = await inspectBox(box.id);
|
|
13169
13703
|
if (insp.state === "paused") {
|
|
13170
|
-
|
|
13704
|
+
log43.info("box is paused; unpausing");
|
|
13171
13705
|
await unpauseBox(box.id);
|
|
13172
13706
|
} else if (insp.state === "stopped") {
|
|
13173
|
-
|
|
13707
|
+
log43.info("box is stopped; starting");
|
|
13174
13708
|
await startBox(box.id);
|
|
13175
13709
|
} else if (insp.state === "missing") {
|
|
13176
13710
|
throw new Error(`box ${box.name} has no container; was it destroyed?`);
|
|
@@ -13180,13 +13714,13 @@ var screenCommand = new Command39("screen").description("Open a box's VNC (noVNC
|
|
|
13180
13714
|
const inBoxUrl = exposePort !== void 0 ? box.portlessUrl ?? `http://localhost:${String(exposePort)}` : "about:blank";
|
|
13181
13715
|
const br = await ensureBoxBrowser(box.container, void 0, inBoxUrl);
|
|
13182
13716
|
if (br.up && !br.alreadyRunning) {
|
|
13183
|
-
|
|
13717
|
+
log43.info(
|
|
13184
13718
|
exposePort !== void 0 ? `opened ${inBoxUrl} in the in-box browser (visible in the VNC view)` : "started in-box browser"
|
|
13185
13719
|
);
|
|
13186
13720
|
} else if (br.alreadyRunning) {
|
|
13187
|
-
|
|
13721
|
+
log43.info("in-box browser already running; left it untouched");
|
|
13188
13722
|
} else {
|
|
13189
|
-
|
|
13723
|
+
log43.warn(`could not start in-box browser: ${br.reason ?? "unknown"}`);
|
|
13190
13724
|
}
|
|
13191
13725
|
const engine = await detectEngine();
|
|
13192
13726
|
const urls = buildVncUrls(box, engine);
|
|
@@ -13207,10 +13741,10 @@ var screenCommand = new Command39("screen").description("Open a box's VNC (noVNC
|
|
|
13207
13741
|
const p = await providerForBox(box);
|
|
13208
13742
|
const state = await p.probeState(box);
|
|
13209
13743
|
if (state === "paused") {
|
|
13210
|
-
|
|
13744
|
+
log43.info("box is paused; resuming");
|
|
13211
13745
|
await p.resume(box);
|
|
13212
13746
|
} else if (state === "stopped") {
|
|
13213
|
-
|
|
13747
|
+
log43.info("box is stopped; starting");
|
|
13214
13748
|
await p.start(box);
|
|
13215
13749
|
} else if (state === "missing") {
|
|
13216
13750
|
throw new Error(`cloud sandbox for ${box.name} is missing; was it deleted?`);
|
|
@@ -13225,14 +13759,14 @@ var screenCommand = new Command39("screen").description("Open a box's VNC (noVNC
|
|
|
13225
13759
|
user: "vscode"
|
|
13226
13760
|
});
|
|
13227
13761
|
if (br.exitCode === 0) {
|
|
13228
|
-
|
|
13762
|
+
log43.info(`opened ${webUrl} in the in-box browser (visible in the VNC view)`);
|
|
13229
13763
|
} else {
|
|
13230
|
-
|
|
13764
|
+
log43.warn(
|
|
13231
13765
|
`could not open in-box browser (continuing): ${br.stderr.trim() || br.stdout.trim() || `exit ${String(br.exitCode)}`}`
|
|
13232
13766
|
);
|
|
13233
13767
|
}
|
|
13234
13768
|
} catch (err) {
|
|
13235
|
-
|
|
13769
|
+
log43.warn(
|
|
13236
13770
|
`in-box browser skipped: ${err instanceof Error ? err.message : String(err)}`
|
|
13237
13771
|
);
|
|
13238
13772
|
}
|
|
@@ -13245,7 +13779,7 @@ var screenCommand = new Command39("screen").description("Open a box's VNC (noVNC
|
|
|
13245
13779
|
`);
|
|
13246
13780
|
return;
|
|
13247
13781
|
}
|
|
13248
|
-
const opened =
|
|
13782
|
+
const opened = spawnSync6(hostOpenCommand(), [url], { stdio: "inherit" });
|
|
13249
13783
|
if (opened.status !== 0) {
|
|
13250
13784
|
throw new Error(`open ${url} failed (exit ${String(opened.status ?? "n/a")})`);
|
|
13251
13785
|
}
|
|
@@ -13257,19 +13791,19 @@ var screenCommand = new Command39("screen").description("Open a box's VNC (noVNC
|
|
|
13257
13791
|
});
|
|
13258
13792
|
|
|
13259
13793
|
// src/commands/shell.ts
|
|
13260
|
-
import { spawnSync as
|
|
13261
|
-
import { log as
|
|
13262
|
-
import { Command as
|
|
13794
|
+
import { spawnSync as spawnSync7 } from "child_process";
|
|
13795
|
+
import { log as log45 } from "@clack/prompts";
|
|
13796
|
+
import { Command as Command42 } from "commander";
|
|
13263
13797
|
|
|
13264
13798
|
// src/commands/_provider-guard.ts
|
|
13265
|
-
import { log as
|
|
13799
|
+
import { log as log44 } from "@clack/prompts";
|
|
13266
13800
|
function requireDockerProvider(box, commandName) {
|
|
13267
13801
|
const provider = box.provider ?? "docker";
|
|
13268
13802
|
if (provider === "docker") return;
|
|
13269
|
-
|
|
13803
|
+
log44.error(
|
|
13270
13804
|
`\`agentbox ${commandName}\` doesn't yet support cloud boxes (this box's provider is '${provider}').`
|
|
13271
13805
|
);
|
|
13272
|
-
|
|
13806
|
+
log44.info(
|
|
13273
13807
|
"Cloud-provider routing for this command is on the Phase 3 backlog. For now: use `agentbox url` for web access, `agentbox-ctl git push` from inside the sandbox via SSH/web terminal, or fall back to the cloud provider's own console."
|
|
13274
13808
|
);
|
|
13275
13809
|
process.exit(2);
|
|
@@ -13311,10 +13845,10 @@ function fmtAgo2(iso) {
|
|
|
13311
13845
|
async function ensureBoxRunning(box) {
|
|
13312
13846
|
const insp = await inspectBox(box.id);
|
|
13313
13847
|
if (insp.state === "paused") {
|
|
13314
|
-
|
|
13848
|
+
log45.info("box is paused; unpausing");
|
|
13315
13849
|
await unpauseBox(box.id);
|
|
13316
13850
|
} else if (insp.state === "stopped") {
|
|
13317
|
-
|
|
13851
|
+
log45.info("box is stopped; starting");
|
|
13318
13852
|
await startBox(box.id);
|
|
13319
13853
|
} else if (insp.state === "missing") {
|
|
13320
13854
|
throw new Error(`box ${box.name} has no container; was it destroyed?`);
|
|
@@ -13353,7 +13887,7 @@ async function startOrAttachShell(box, cfg) {
|
|
|
13353
13887
|
const label = shellLabel(cfg.sessionName);
|
|
13354
13888
|
const info = await shellSessionInfo(box.container, cfg.sessionName, cfg.user);
|
|
13355
13889
|
if (info.running) {
|
|
13356
|
-
|
|
13890
|
+
log45.info(`reattaching to shell "${label}" \u2014 Control+a d to detach`);
|
|
13357
13891
|
} else {
|
|
13358
13892
|
await startShellSession({
|
|
13359
13893
|
container: box.container,
|
|
@@ -13361,7 +13895,7 @@ async function startOrAttachShell(box, cfg) {
|
|
|
13361
13895
|
user: cfg.user,
|
|
13362
13896
|
login: cfg.login
|
|
13363
13897
|
});
|
|
13364
|
-
|
|
13898
|
+
log45.info(`shell "${label}" \u2014 Control+a d to detach, leaves it running`);
|
|
13365
13899
|
}
|
|
13366
13900
|
const code = await runWrappedAttach({
|
|
13367
13901
|
container: box.container,
|
|
@@ -13376,7 +13910,7 @@ async function startOrAttachShell(box, cfg) {
|
|
|
13376
13910
|
});
|
|
13377
13911
|
process.exit(code);
|
|
13378
13912
|
}
|
|
13379
|
-
var shellCommand = new
|
|
13913
|
+
var shellCommand = new Command42("shell").description(
|
|
13380
13914
|
"Open an interactive shell in a box, in a detachable tmux session (auto-unpause/start)"
|
|
13381
13915
|
).argument(
|
|
13382
13916
|
"[box]",
|
|
@@ -13450,7 +13984,7 @@ var shellCommand = new Command40("shell").description(
|
|
|
13450
13984
|
...bashInvocation
|
|
13451
13985
|
];
|
|
13452
13986
|
if (!isInteractive || effectiveCmd.length > 0) {
|
|
13453
|
-
const child =
|
|
13987
|
+
const child = spawnSync7("docker", plainArgv, { stdio: "inherit" });
|
|
13454
13988
|
process.exit(child.status ?? 0);
|
|
13455
13989
|
}
|
|
13456
13990
|
if (tmux) {
|
|
@@ -13471,7 +14005,7 @@ var shellCommand = new Command40("shell").description(
|
|
|
13471
14005
|
handleLifecycleError(err);
|
|
13472
14006
|
}
|
|
13473
14007
|
});
|
|
13474
|
-
var shellAttachCommand = new
|
|
14008
|
+
var shellAttachCommand = new Command42("attach").description(
|
|
13475
14009
|
"Attach to a shell tmux session in a box, starting one if none is running (auto-unpause/start)"
|
|
13476
14010
|
).argument(
|
|
13477
14011
|
"[box]",
|
|
@@ -13509,7 +14043,7 @@ function renderShellTable(sessions) {
|
|
|
13509
14043
|
for (const r of rows) process.stdout.write(`${fmt(r)}
|
|
13510
14044
|
`);
|
|
13511
14045
|
}
|
|
13512
|
-
var shellLsCommand = new
|
|
14046
|
+
var shellLsCommand = new Command42("ls").description("List the shell tmux sessions running in a box").argument(
|
|
13513
14047
|
"[box]",
|
|
13514
14048
|
"box ref: project index, id, id prefix, name, or container (default: the only box in this project)"
|
|
13515
14049
|
).action(async (idOrName) => {
|
|
@@ -13518,11 +14052,11 @@ var shellLsCommand = new Command40("ls").description("List the shell tmux sessio
|
|
|
13518
14052
|
requireDockerProvider(box, "shell");
|
|
13519
14053
|
const insp = await inspectBox(box.id);
|
|
13520
14054
|
if (insp.state !== "running") {
|
|
13521
|
-
|
|
14055
|
+
log45.info(`box ${box.name} is ${insp.state} \u2014 no live shell sessions`);
|
|
13522
14056
|
return;
|
|
13523
14057
|
}
|
|
13524
14058
|
if (insp.shellSessions.length === 0) {
|
|
13525
|
-
|
|
14059
|
+
log45.info(
|
|
13526
14060
|
`no shell sessions in ${box.name} \u2014 start one with: agentbox shell ${reattachRef2(box)}`
|
|
13527
14061
|
);
|
|
13528
14062
|
return;
|
|
@@ -13532,7 +14066,7 @@ var shellLsCommand = new Command40("ls").description("List the shell tmux sessio
|
|
|
13532
14066
|
handleLifecycleError(err);
|
|
13533
14067
|
}
|
|
13534
14068
|
});
|
|
13535
|
-
var shellKillCommand = new
|
|
14069
|
+
var shellKillCommand = new Command42("kill").description("Kill a shell tmux session in a box (the shell and anything running in it)").argument(
|
|
13536
14070
|
"[box]",
|
|
13537
14071
|
"box ref: project index, id, id prefix, name, or container (default: the only box in this project)"
|
|
13538
14072
|
).option("-n, --name <label>", "shell label to kill (default: the box default shell)").option("--all", "kill every shell session in the box").action(async function(idOrName) {
|
|
@@ -13542,25 +14076,25 @@ var shellKillCommand = new Command40("kill").description("Kill a shell tmux sess
|
|
|
13542
14076
|
requireDockerProvider(box, "shell");
|
|
13543
14077
|
const insp = await inspectBox(box.id);
|
|
13544
14078
|
if (insp.state !== "running") {
|
|
13545
|
-
|
|
14079
|
+
log45.info(`box ${box.name} is ${insp.state} \u2014 no shell sessions to kill`);
|
|
13546
14080
|
return;
|
|
13547
14081
|
}
|
|
13548
14082
|
if (opts.all) {
|
|
13549
14083
|
if (insp.shellSessions.length === 0) {
|
|
13550
|
-
|
|
14084
|
+
log45.info(`no shell sessions in ${box.name}`);
|
|
13551
14085
|
return;
|
|
13552
14086
|
}
|
|
13553
14087
|
let killed = 0;
|
|
13554
14088
|
for (const s of insp.shellSessions) {
|
|
13555
14089
|
if (await killShellSession(box.container, s.sessionName)) killed++;
|
|
13556
14090
|
}
|
|
13557
|
-
|
|
14091
|
+
log45.success(`killed ${String(killed)} shell session${killed === 1 ? "" : "s"} in ${box.name}`);
|
|
13558
14092
|
return;
|
|
13559
14093
|
}
|
|
13560
14094
|
const target = shellSessionName(opts.name);
|
|
13561
14095
|
const ok = await killShellSession(box.container, target);
|
|
13562
|
-
if (ok)
|
|
13563
|
-
else
|
|
14096
|
+
if (ok) log45.success(`killed shell "${shellLabel(target)}" in ${box.name}`);
|
|
14097
|
+
else log45.warn(`no shell "${shellLabel(target)}" in ${box.name} (already gone?)`);
|
|
13564
14098
|
} catch (err) {
|
|
13565
14099
|
handleLifecycleError(err);
|
|
13566
14100
|
}
|
|
@@ -13570,8 +14104,8 @@ shellCommand.addCommand(shellLsCommand);
|
|
|
13570
14104
|
shellCommand.addCommand(shellKillCommand);
|
|
13571
14105
|
|
|
13572
14106
|
// src/commands/start.ts
|
|
13573
|
-
import { Command as
|
|
13574
|
-
var startCommand = new
|
|
14107
|
+
import { Command as Command43 } from "commander";
|
|
14108
|
+
var startCommand = new Command43("start").description(
|
|
13575
14109
|
"Start a stopped box. Docker: docker start + relaunch ctl/dockerd/vnc daemons. Cloud: backend.start, then re-resolve preview URLs/tokens, re-launch in-sandbox ctl/dockerd daemons, and re-register with the host relay (so the CloudBoxPoller resumes)."
|
|
13576
14110
|
).argument(
|
|
13577
14111
|
"[box]",
|
|
@@ -13594,8 +14128,8 @@ var startCommand = new Command41("start").description(
|
|
|
13594
14128
|
});
|
|
13595
14129
|
|
|
13596
14130
|
// src/commands/status.ts
|
|
13597
|
-
import { log as
|
|
13598
|
-
import { Command as
|
|
14131
|
+
import { log as log47 } from "@clack/prompts";
|
|
14132
|
+
import { Command as Command44 } from "commander";
|
|
13599
14133
|
|
|
13600
14134
|
// src/endpoints-render.ts
|
|
13601
14135
|
function renderEndpointLines(endpoints, stream) {
|
|
@@ -13624,8 +14158,61 @@ function renderEndpointLines(endpoints, stream) {
|
|
|
13624
14158
|
return entries.map((e) => ` ${e.name.padEnd(nameWidth)} ${e.value}`);
|
|
13625
14159
|
}
|
|
13626
14160
|
|
|
14161
|
+
// src/commands/_status-render.ts
|
|
14162
|
+
async function fetchLive(state, container) {
|
|
14163
|
+
if (state !== "running") return null;
|
|
14164
|
+
const proc = await execInBox(container, ["agentbox-ctl", "status", "--json"], {
|
|
14165
|
+
user: "vscode"
|
|
14166
|
+
});
|
|
14167
|
+
if (proc.exitCode !== 0) return null;
|
|
14168
|
+
try {
|
|
14169
|
+
return JSON.parse(proc.stdout);
|
|
14170
|
+
} catch {
|
|
14171
|
+
return null;
|
|
14172
|
+
}
|
|
14173
|
+
}
|
|
14174
|
+
function renderLiveSections(live) {
|
|
14175
|
+
const out = [];
|
|
14176
|
+
if (live.tasks.length > 0) {
|
|
14177
|
+
out.push("TASKS", renderTaskTable(live.tasks), "");
|
|
14178
|
+
}
|
|
14179
|
+
out.push("SERVICES", renderStatusTable(live.services), "");
|
|
14180
|
+
out.push("PORTS", renderPortsTable(live.ports));
|
|
14181
|
+
return out;
|
|
14182
|
+
}
|
|
14183
|
+
function renderPersistedSections(s) {
|
|
14184
|
+
const out = [];
|
|
14185
|
+
if (s.tasks.length > 0) {
|
|
14186
|
+
out.push("TASKS");
|
|
14187
|
+
out.push(...s.tasks.map((t) => ` ${t.name} ${t.state}`));
|
|
14188
|
+
out.push("");
|
|
14189
|
+
}
|
|
14190
|
+
out.push("SERVICES");
|
|
14191
|
+
if (s.services.length === 0) {
|
|
14192
|
+
out.push(" (none)");
|
|
14193
|
+
} else {
|
|
14194
|
+
out.push(
|
|
14195
|
+
...s.services.map(
|
|
14196
|
+
(svc) => ` ${svc.name} ${svc.state}${svc.port !== null ? ` :${String(svc.port)}` : ""}`
|
|
14197
|
+
)
|
|
14198
|
+
);
|
|
14199
|
+
}
|
|
14200
|
+
out.push("");
|
|
14201
|
+
out.push("PORTS");
|
|
14202
|
+
if (s.ports.length === 0) {
|
|
14203
|
+
out.push(" (none listening)");
|
|
14204
|
+
} else {
|
|
14205
|
+
const other = s.ports.filter((p) => !p.service).map((p) => p.port).sort((a, b) => a - b);
|
|
14206
|
+
out.push(
|
|
14207
|
+
...s.ports.filter((p) => p.service).map((p) => ` :${String(p.port)} (${p.service})`)
|
|
14208
|
+
);
|
|
14209
|
+
if (other.length > 0) out.push(` other (${other.length}): ${other.join(", ")}`);
|
|
14210
|
+
}
|
|
14211
|
+
return out;
|
|
14212
|
+
}
|
|
14213
|
+
|
|
13627
14214
|
// src/commands/inspect.ts
|
|
13628
|
-
import { log as
|
|
14215
|
+
import { log as log46 } from "@clack/prompts";
|
|
13629
14216
|
function fmtLimit(n, unit) {
|
|
13630
14217
|
return n && n > 0 ? `${String(n)}${unit}` : "unlimited";
|
|
13631
14218
|
}
|
|
@@ -13667,6 +14254,13 @@ async function renderText(i) {
|
|
|
13667
14254
|
`host export ${i.hostPaths.mergedExport} (run \`agentbox open\` to refresh)`,
|
|
13668
14255
|
`created ${i.record.createdAt}`
|
|
13669
14256
|
];
|
|
14257
|
+
const live = await fetchLive(i.state, i.record.container);
|
|
14258
|
+
if (live) {
|
|
14259
|
+
lines.push("", "(live from agentbox-ctl)", "", ...renderLiveSections(live));
|
|
14260
|
+
} else if (i.persistedStatus) {
|
|
14261
|
+
lines.push("", `(persisted snapshot from ${i.persistedStatus.timestamp})`, "");
|
|
14262
|
+
lines.push(...renderPersistedSections(i.persistedStatus));
|
|
14263
|
+
}
|
|
13670
14264
|
return lines.join("\n");
|
|
13671
14265
|
}
|
|
13672
14266
|
function renderCheckpoint(i, sizeBytes) {
|
|
@@ -13749,6 +14343,9 @@ async function renderCloudText(box) {
|
|
|
13749
14343
|
`persisted ${persisted ? `${persisted.timestamp} (${String(persisted.services.length)} svc, ${String(persisted.tasks.length)} tasks, ${String(persisted.ports.length)} ports)` : "(none)"}`,
|
|
13750
14344
|
`created ${box.createdAt}`
|
|
13751
14345
|
];
|
|
14346
|
+
if (persisted) {
|
|
14347
|
+
lines.push("", ...renderPersistedSections(persisted));
|
|
14348
|
+
}
|
|
13752
14349
|
return lines.join("\n");
|
|
13753
14350
|
}
|
|
13754
14351
|
function webPreviewLine(box) {
|
|
@@ -13770,7 +14367,7 @@ function renderCodexActivityCloud(persisted) {
|
|
|
13770
14367
|
async function runInspect(box, opts) {
|
|
13771
14368
|
try {
|
|
13772
14369
|
if (opts.json && opts.watch) {
|
|
13773
|
-
|
|
14370
|
+
log46.error("cannot combine --json with --watch");
|
|
13774
14371
|
process.exit(2);
|
|
13775
14372
|
}
|
|
13776
14373
|
const isCloud = (box.provider ?? "docker") !== "docker";
|
|
@@ -13807,14 +14404,14 @@ async function runInspect(box, opts) {
|
|
|
13807
14404
|
|
|
13808
14405
|
// src/commands/status.ts
|
|
13809
14406
|
var statusCommand2 = withWatchOptions(
|
|
13810
|
-
new
|
|
14407
|
+
new Command44("status").description("Show service + task status from a box's agentbox-ctl daemon").argument(
|
|
13811
14408
|
"[box]",
|
|
13812
14409
|
"box ref: project index, id, id prefix, name, or container (default: the only box in this project)"
|
|
13813
|
-
).option("-j, --json", "machine-readable JSON output").option("--inspect", "show detailed box info (volumes, limits, paths)
|
|
14410
|
+
).option("-j, --json", "machine-readable JSON output").option("--inspect", "show detailed box info (volumes, limits, paths) plus service/task status")
|
|
13814
14411
|
).action(async (idOrName, opts) => {
|
|
13815
14412
|
try {
|
|
13816
14413
|
if (opts.json && opts.watch) {
|
|
13817
|
-
|
|
14414
|
+
log47.error("cannot combine --json with --watch");
|
|
13818
14415
|
process.exit(2);
|
|
13819
14416
|
}
|
|
13820
14417
|
const box = await resolveBoxOrExit(idOrName);
|
|
@@ -13856,18 +14453,6 @@ var statusCommand2 = withWatchOptions(
|
|
|
13856
14453
|
handleLifecycleError(err);
|
|
13857
14454
|
}
|
|
13858
14455
|
});
|
|
13859
|
-
async function fetchLive(state, container) {
|
|
13860
|
-
if (state !== "running") return null;
|
|
13861
|
-
const proc = await execInBox(container, ["agentbox-ctl", "status", "--json"], {
|
|
13862
|
-
user: "vscode"
|
|
13863
|
-
});
|
|
13864
|
-
if (proc.exitCode !== 0) return null;
|
|
13865
|
-
try {
|
|
13866
|
-
return JSON.parse(proc.stdout);
|
|
13867
|
-
} catch {
|
|
13868
|
-
return null;
|
|
13869
|
-
}
|
|
13870
|
-
}
|
|
13871
14456
|
async function buildStatusText(id, container) {
|
|
13872
14457
|
const inspected = await inspectBox(id);
|
|
13873
14458
|
const { state, endpoints, persistedStatus } = inspected;
|
|
@@ -13881,11 +14466,7 @@ async function buildStatusText(id, container) {
|
|
|
13881
14466
|
out.push("CLAUDE", renderClaude(inspected, persistedStatus));
|
|
13882
14467
|
out.push("", "SHELLS", renderShells2(inspected));
|
|
13883
14468
|
if (live) {
|
|
13884
|
-
|
|
13885
|
-
out.push("", "TASKS", renderTaskTable(live.tasks));
|
|
13886
|
-
}
|
|
13887
|
-
out.push("", "SERVICES", renderStatusTable(live.services));
|
|
13888
|
-
out.push("", "PORTS", renderPortsTable(live.ports));
|
|
14469
|
+
out.push("", ...renderLiveSections(live));
|
|
13889
14470
|
return out.join("\n");
|
|
13890
14471
|
}
|
|
13891
14472
|
if (!persistedStatus) {
|
|
@@ -13950,39 +14531,16 @@ function renderShells2(i) {
|
|
|
13950
14531
|
return i.shellSessions.map((s) => ` ${s.label} ${s.attached ? "attached" : "detached"}`).join("\n");
|
|
13951
14532
|
}
|
|
13952
14533
|
function renderPersisted2(s, state) {
|
|
13953
|
-
|
|
13954
|
-
|
|
13955
|
-
|
|
13956
|
-
|
|
13957
|
-
|
|
13958
|
-
}
|
|
13959
|
-
out.push("SERVICES");
|
|
13960
|
-
if (s.services.length === 0) {
|
|
13961
|
-
out.push(" (none)");
|
|
13962
|
-
} else {
|
|
13963
|
-
out.push(
|
|
13964
|
-
...s.services.map(
|
|
13965
|
-
(svc) => ` ${svc.name} ${svc.state}${svc.port !== null ? ` :${String(svc.port)}` : ""}`
|
|
13966
|
-
)
|
|
13967
|
-
);
|
|
13968
|
-
}
|
|
13969
|
-
out.push("");
|
|
13970
|
-
out.push("PORTS");
|
|
13971
|
-
if (s.ports.length === 0) {
|
|
13972
|
-
out.push(" (none listening)");
|
|
13973
|
-
} else {
|
|
13974
|
-
const other = s.ports.filter((p) => !p.service).map((p) => p.port).sort((a, b) => a - b);
|
|
13975
|
-
out.push(
|
|
13976
|
-
...s.ports.filter((p) => p.service).map((p) => ` :${String(p.port)} (${p.service})`)
|
|
13977
|
-
);
|
|
13978
|
-
if (other.length > 0) out.push(` other (${other.length}): ${other.join(", ")}`);
|
|
13979
|
-
}
|
|
13980
|
-
return out.join("\n");
|
|
14534
|
+
return [
|
|
14535
|
+
`(persisted snapshot from ${s.timestamp}; box is ${state})`,
|
|
14536
|
+
"",
|
|
14537
|
+
...renderPersistedSections(s)
|
|
14538
|
+
].join("\n");
|
|
13981
14539
|
}
|
|
13982
14540
|
|
|
13983
14541
|
// src/commands/stop.ts
|
|
13984
|
-
import { Command as
|
|
13985
|
-
var stopCommand = new
|
|
14542
|
+
import { Command as Command45 } from "commander";
|
|
14543
|
+
var stopCommand = new Command45("stop").description(
|
|
13986
14544
|
"Stop a box (Docker: docker stop; preserves upper + node_modules volumes. Cloud: backend.stop \u2014 sandbox stays in your account, disk preserved)."
|
|
13987
14545
|
).argument(
|
|
13988
14546
|
"[box]",
|
|
@@ -14011,7 +14569,7 @@ restart with: agentbox start ${box.name}
|
|
|
14011
14569
|
});
|
|
14012
14570
|
|
|
14013
14571
|
// src/commands/top.ts
|
|
14014
|
-
import { Command as
|
|
14572
|
+
import { Command as Command46 } from "commander";
|
|
14015
14573
|
var COLS = ["BOX", "STATE", "CPU%", "MEM USAGE / LIMIT", "MEM%", "PIDS", "DISK", "NET I/O"];
|
|
14016
14574
|
function row(name, state, s) {
|
|
14017
14575
|
const mem = `${fmtBytes2(s.memUsedBytes)} / ${fmtBytes2(s.memLimitBytes)}`;
|
|
@@ -14085,7 +14643,7 @@ async function renderProjectFooters() {
|
|
|
14085
14643
|
|
|
14086
14644
|
SYSTEM: ${parts.join(" - ")}` : "";
|
|
14087
14645
|
}
|
|
14088
|
-
var topCommand = new
|
|
14646
|
+
var topCommand = new Command46("top").description("Live resource monitor (cpu/mem/pids/disk) for a box, the project, or every box").argument(
|
|
14089
14647
|
"[box]",
|
|
14090
14648
|
"box ref (default: every box on the host; --project narrows to the cwd's project)"
|
|
14091
14649
|
).option("-p, --project", "show only boxes in the cwd's project").option("--once", "print a single snapshot instead of watching").option("-j, --json", "machine-readable JSON (implies --once)").option("--interval <seconds>", "refresh interval", "2").option("--live", "probe live cloud state via the provider SDK (slower; default: last host-known)").action(async (idOrName, opts) => {
|
|
@@ -14118,8 +14676,8 @@ var topCommand = new Command44("top").description("Live resource monitor (cpu/me
|
|
|
14118
14676
|
});
|
|
14119
14677
|
|
|
14120
14678
|
// src/commands/unpause.ts
|
|
14121
|
-
import { Command as
|
|
14122
|
-
var unpauseCommand = new
|
|
14679
|
+
import { Command as Command47 } from "commander";
|
|
14680
|
+
var unpauseCommand = new Command47("unpause").description(
|
|
14123
14681
|
"Resume a paused box. Docker: `docker unpause` (sub-second). Cloud: backend.resume (re-hydrates from archive \u2014 slower first time)."
|
|
14124
14682
|
).argument(
|
|
14125
14683
|
"[box]",
|
|
@@ -14143,7 +14701,7 @@ var unpauseCommand = new Command45("unpause").description(
|
|
|
14143
14701
|
|
|
14144
14702
|
// src/commands/update.ts
|
|
14145
14703
|
import { spawn as spawn4 } from "child_process";
|
|
14146
|
-
import { Command as
|
|
14704
|
+
import { Command as Command48 } from "commander";
|
|
14147
14705
|
|
|
14148
14706
|
// src/exec-method.ts
|
|
14149
14707
|
function detectExecutionMethod(input) {
|
|
@@ -14187,7 +14745,7 @@ function runInherit(cmd, args) {
|
|
|
14187
14745
|
child.on("close", (code) => resolveP(code ?? 0));
|
|
14188
14746
|
});
|
|
14189
14747
|
}
|
|
14190
|
-
var updateCommand = new
|
|
14748
|
+
var updateCommand = new Command48("self-update").description(
|
|
14191
14749
|
"Update agentbox: self-update via npm/pnpm (unless run via npx), refresh the host skills, wipe the box image so it rebuilds, and reload the relay"
|
|
14192
14750
|
).option("-y, --yes", "skip the confirmation prompt").option("--dry-run", "show what would happen, don't change anything").option("--skip-self", "skip the package self-update; only refresh the skills + image + relay").option("--skip-skills", "skip refreshing the host skill files in ~/.claude, ~/.codex, ~/.config/opencode").action(async (opts) => {
|
|
14193
14751
|
try {
|
|
@@ -14294,6 +14852,7 @@ var updateCommand = new Command46("self-update").description(
|
|
|
14294
14852
|
);
|
|
14295
14853
|
}
|
|
14296
14854
|
}
|
|
14855
|
+
await maybePromptStar({ trigger: "self-update" });
|
|
14297
14856
|
(0, prompt_exports.outro)("update complete");
|
|
14298
14857
|
} catch (err) {
|
|
14299
14858
|
handleLifecycleError(err);
|
|
@@ -14301,9 +14860,9 @@ var updateCommand = new Command46("self-update").description(
|
|
|
14301
14860
|
});
|
|
14302
14861
|
|
|
14303
14862
|
// src/commands/url.ts
|
|
14304
|
-
import { spawnSync as
|
|
14305
|
-
import { log as
|
|
14306
|
-
import { Command as
|
|
14863
|
+
import { spawnSync as spawnSync8 } from "child_process";
|
|
14864
|
+
import { log as log49 } from "@clack/prompts";
|
|
14865
|
+
import { Command as Command49 } from "commander";
|
|
14307
14866
|
var SIGNED_URL_TTL_MIN2 = 1;
|
|
14308
14867
|
var SIGNED_URL_TTL_MAX2 = 86400;
|
|
14309
14868
|
function parseTtlOrExit2(raw) {
|
|
@@ -14316,7 +14875,7 @@ function parseTtlOrExit2(raw) {
|
|
|
14316
14875
|
}
|
|
14317
14876
|
return n;
|
|
14318
14877
|
}
|
|
14319
|
-
var urlCommand = new
|
|
14878
|
+
var urlCommand = new Command49("url").description(
|
|
14320
14879
|
"Open a box's web app URL in the browser, even when no service declares `expose:` (auto-unpause/start)"
|
|
14321
14880
|
).argument(
|
|
14322
14881
|
"[box]",
|
|
@@ -14335,10 +14894,10 @@ var urlCommand = new Command47("url").description(
|
|
|
14335
14894
|
if (provider === "docker") {
|
|
14336
14895
|
const insp = await inspectBox(box.id);
|
|
14337
14896
|
if (insp.state === "paused") {
|
|
14338
|
-
|
|
14897
|
+
log49.info("box is paused; unpausing");
|
|
14339
14898
|
await unpauseBox(box.id);
|
|
14340
14899
|
} else if (insp.state === "stopped") {
|
|
14341
|
-
|
|
14900
|
+
log49.info("box is stopped; starting");
|
|
14342
14901
|
await startBox(box.id);
|
|
14343
14902
|
} else if (insp.state === "missing") {
|
|
14344
14903
|
throw new Error(`box ${box.name} has no container; was it destroyed?`);
|
|
@@ -14367,10 +14926,10 @@ var urlCommand = new Command47("url").description(
|
|
|
14367
14926
|
const p = await providerForBox(box);
|
|
14368
14927
|
const state = await p.probeState(box);
|
|
14369
14928
|
if (state === "paused") {
|
|
14370
|
-
|
|
14929
|
+
log49.info("box is paused; resuming");
|
|
14371
14930
|
await p.resume(box);
|
|
14372
14931
|
} else if (state === "stopped") {
|
|
14373
|
-
|
|
14932
|
+
log49.info("box is stopped; starting");
|
|
14374
14933
|
await p.start(box);
|
|
14375
14934
|
} else if (state === "missing") {
|
|
14376
14935
|
throw new Error(`cloud sandbox for ${box.name} is missing; was it deleted?`);
|
|
@@ -14382,7 +14941,7 @@ var urlCommand = new Command47("url").description(
|
|
|
14382
14941
|
`);
|
|
14383
14942
|
return;
|
|
14384
14943
|
}
|
|
14385
|
-
const opened =
|
|
14944
|
+
const opened = spawnSync8(hostOpenCommand(), [url], { stdio: "inherit" });
|
|
14386
14945
|
if (opened.status !== 0) {
|
|
14387
14946
|
throw new Error(`open ${url} failed (exit ${String(opened.status ?? "n/a")})`);
|
|
14388
14947
|
}
|
|
@@ -14394,9 +14953,9 @@ var urlCommand = new Command47("url").description(
|
|
|
14394
14953
|
});
|
|
14395
14954
|
|
|
14396
14955
|
// src/commands/wait.ts
|
|
14397
|
-
import { log as
|
|
14398
|
-
import { Command as
|
|
14399
|
-
var waitCommand = new
|
|
14956
|
+
import { log as log50 } from "@clack/prompts";
|
|
14957
|
+
import { Command as Command50 } from "commander";
|
|
14958
|
+
var waitCommand = new Command50("wait").description("Block until the box reports all autostart units ready").argument(
|
|
14400
14959
|
"[box]",
|
|
14401
14960
|
"box ref: project index, id, id prefix, name, or container (default: the only box in this project)"
|
|
14402
14961
|
).option("--timeout <ms>", "overall timeout in milliseconds", "120000").option("--units <names...>", "restrict to the named units").option("-j, --json", "machine-readable JSON output").action(async (idOrName, opts) => {
|
|
@@ -14412,7 +14971,7 @@ var waitCommand = new Command48("wait").description("Block until the box reports
|
|
|
14412
14971
|
try {
|
|
14413
14972
|
parsed = JSON.parse(proc.stdout);
|
|
14414
14973
|
} catch {
|
|
14415
|
-
|
|
14974
|
+
log50.error(`agentbox-ctl wait-ready failed: ${proc.stderr || proc.stdout}`);
|
|
14416
14975
|
process.exit(1);
|
|
14417
14976
|
}
|
|
14418
14977
|
if (opts.json) {
|
|
@@ -14451,7 +15010,7 @@ function rewriteProviderPrefix(argv2) {
|
|
|
14451
15010
|
process.env.DOCKER_CLI_HINTS ??= "false";
|
|
14452
15011
|
process.env.AGENTBOX_CLI_VERSION = AGENTBOX_VERSION;
|
|
14453
15012
|
process.env.AGENTBOX_CLI_COMMIT = AGENTBOX_COMMIT;
|
|
14454
|
-
var program = new
|
|
15013
|
+
var program = new Command51();
|
|
14455
15014
|
program.name("agentbox").description("Launch coding agents in isolated sandboxes").version(AGENTBOX_VERSION);
|
|
14456
15015
|
program.enablePositionalOptions();
|
|
14457
15016
|
program.addCommand(createCommand);
|
|
@@ -14488,6 +15047,7 @@ program.addCommand(configCommand);
|
|
|
14488
15047
|
program.addCommand(queueCommand);
|
|
14489
15048
|
program.addCommand(relayCommand);
|
|
14490
15049
|
program.addCommand(runQueuedJobCommand, { hidden: true });
|
|
15050
|
+
program.addCommand(herdrCommand, { hidden: true });
|
|
14491
15051
|
program.addCommand(daytonaCommand);
|
|
14492
15052
|
program.addCommand(hetznerCommand);
|
|
14493
15053
|
program.addCommand(vercelCommand);
|