@madarco/agentbox 0.18.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +56 -0
- package/README.md +4 -3
- package/dist/{_cloud-attach-3UC3IL62.js → _cloud-attach-YM2KOWHO.js} +4 -4
- package/dist/{chunk-6QFPYU4Z.js → chunk-7K2A3NLE.js} +8 -5
- package/dist/chunk-7K2A3NLE.js.map +1 -0
- package/dist/{chunk-U7IZS2ZP.js → chunk-A5OFRJDI.js} +1313 -213
- package/dist/chunk-A5OFRJDI.js.map +1 -0
- package/dist/{chunk-5BO6SGMI.js → chunk-JK5V4OLT.js} +7 -7
- package/dist/{chunk-IA6YHH52.js → chunk-MODNW54N.js} +6 -3
- package/dist/{chunk-IA6YHH52.js.map → chunk-MODNW54N.js.map} +1 -1
- package/dist/{chunk-46NXCJ6Z.js → chunk-NXX3KQZ6.js} +2 -2
- package/dist/{chunk-3JXSW6PN.js → chunk-P6UT5XGE.js} +2 -2
- package/dist/{chunk-OG4KMYOJ.js → chunk-SPUUOEW2.js} +273 -54
- package/dist/chunk-SPUUOEW2.js.map +1 -0
- package/dist/{chunk-XWBFWUY2.js → chunk-Y6PUCLOE.js} +2 -2
- package/dist/{dist-CFSKUAS5.js → dist-EKSNZHDY.js} +13 -3
- package/dist/{dist-7BS2JS27.js → dist-FTCDWRAL.js} +18 -7
- package/dist/dist-FTCDWRAL.js.map +1 -0
- package/dist/{dist-4BHW7DCO.js → dist-PRDYMXCX.js} +10 -5
- package/dist/dist-PRDYMXCX.js.map +1 -0
- package/dist/{dist-3UYQZOAO.js → dist-U2BHTWG4.js} +17 -5
- package/dist/dist-U2BHTWG4.js.map +1 -0
- package/dist/{dist-T7ESSBCZ.js → dist-VQSZVBT3.js} +20 -6
- package/dist/dist-VQSZVBT3.js.map +1 -0
- package/dist/index.js +471 -311
- package/dist/index.js.map +1 -1
- package/dist/{prepared-state-MQHD3M5F-OVABNV66.js → prepared-state-MQHD3M5F-5ZMCNY43.js} +2 -2
- package/package.json +5 -5
- package/runtime/docker/apps/cli/share/agentbox-setup/SKILL.md +1 -1
- package/runtime/docker/packages/ctl/dist/bin.cjs +133 -107
- package/runtime/docker/packages/sandbox-docker/scripts/agentbox-dockerd-start +13 -0
- package/runtime/e2b/agentbox-setup-skill.md +1 -1
- package/runtime/e2b/ctl.cjs +133 -107
- package/runtime/hetzner/agentbox-dockerd-start +13 -0
- package/runtime/hetzner/agentbox-setup-skill.md +1 -1
- package/runtime/hetzner/ctl.cjs +133 -107
- package/runtime/relay/bin.cjs +261 -63
- package/runtime/vercel/agentbox-dockerd-start +145 -0
- package/runtime/vercel/agentbox-setup-skill.md +1 -1
- package/runtime/vercel/ctl.cjs +133 -107
- package/runtime/vercel/custom-system-CLAUDE.md +5 -4
- package/runtime/vercel/scripts/provision.sh +20 -5
- package/share/agentbox-setup/SKILL.md +1 -1
- package/share/host-skills/agentbox/SKILL.md +2 -2
- package/share/host-skills/codex/agentbox.md +10 -2
- package/dist/chunk-6QFPYU4Z.js.map +0 -1
- package/dist/chunk-OG4KMYOJ.js.map +0 -1
- package/dist/chunk-U7IZS2ZP.js.map +0 -1
- package/dist/dist-3UYQZOAO.js.map +0 -1
- package/dist/dist-4BHW7DCO.js.map +0 -1
- package/dist/dist-7BS2JS27.js.map +0 -1
- package/dist/dist-T7ESSBCZ.js.map +0 -1
- /package/dist/{_cloud-attach-3UC3IL62.js.map → _cloud-attach-YM2KOWHO.js.map} +0 -0
- /package/dist/{chunk-5BO6SGMI.js.map → chunk-JK5V4OLT.js.map} +0 -0
- /package/dist/{chunk-46NXCJ6Z.js.map → chunk-NXX3KQZ6.js.map} +0 -0
- /package/dist/{chunk-3JXSW6PN.js.map → chunk-P6UT5XGE.js.map} +0 -0
- /package/dist/{chunk-XWBFWUY2.js.map → chunk-Y6PUCLOE.js.map} +0 -0
- /package/dist/{dist-CFSKUAS5.js.map → dist-EKSNZHDY.js.map} +0 -0
- /package/dist/{prepared-state-MQHD3M5F-OVABNV66.js.map → prepared-state-MQHD3M5F-5ZMCNY43.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
stripTitleGlyph,
|
|
35
35
|
subscribePrompts,
|
|
36
36
|
uploadImageFileToBox
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-JK5V4OLT.js";
|
|
38
38
|
import {
|
|
39
39
|
daytonaBackend,
|
|
40
40
|
ensureDaytonaCredentials,
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
readDaytonaCredStatus,
|
|
43
43
|
readPreparedDaytonaState,
|
|
44
44
|
secretsPath
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-NXX3KQZ6.js";
|
|
46
46
|
import {
|
|
47
47
|
detectEgressIp,
|
|
48
48
|
ensureHetznerCredentials,
|
|
@@ -53,7 +53,7 @@ import {
|
|
|
53
53
|
readPreparedState,
|
|
54
54
|
secretsPath as secretsPath2,
|
|
55
55
|
syncFirewallSource
|
|
56
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-P6UT5XGE.js";
|
|
57
57
|
import {
|
|
58
58
|
detectSbx,
|
|
59
59
|
ensureVercelCredentials,
|
|
@@ -62,14 +62,14 @@ import {
|
|
|
62
62
|
readPreparedState as readPreparedState2,
|
|
63
63
|
readVercelCredStatus,
|
|
64
64
|
secretsPath as secretsPath3
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-MODNW54N.js";
|
|
66
66
|
import {
|
|
67
67
|
ensureE2bCredentials,
|
|
68
68
|
maskKey as maskKey4,
|
|
69
69
|
readE2bCredStatus,
|
|
70
70
|
readPreparedState as readPreparedState3,
|
|
71
71
|
secretsPath as secretsPath4
|
|
72
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-Y6PUCLOE.js";
|
|
73
73
|
import {
|
|
74
74
|
agentSpecsForCloud,
|
|
75
75
|
currentCloudBaseFingerprint,
|
|
@@ -79,7 +79,7 @@ import {
|
|
|
79
79
|
probeCloudCheckpoint,
|
|
80
80
|
resolveCloudCheckpoint,
|
|
81
81
|
seedAgentVolumesIfFresh
|
|
82
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-SPUUOEW2.js";
|
|
83
83
|
import {
|
|
84
84
|
ALL_CONNECTORS,
|
|
85
85
|
BOX_STATUS_EVENT,
|
|
@@ -235,7 +235,7 @@ import {
|
|
|
235
235
|
waitForTmuxPaneContent,
|
|
236
236
|
warmUpClaudeCredentials,
|
|
237
237
|
writeJob
|
|
238
|
-
} from "./chunk-
|
|
238
|
+
} from "./chunk-A5OFRJDI.js";
|
|
239
239
|
import {
|
|
240
240
|
AmbiguousBoxError,
|
|
241
241
|
BoxNotFoundError,
|
|
@@ -253,7 +253,7 @@ import {
|
|
|
253
253
|
resolveAgentLauncher,
|
|
254
254
|
resolveBoxRef,
|
|
255
255
|
resolveRuleRefs
|
|
256
|
-
} from "./chunk-
|
|
256
|
+
} from "./chunk-7K2A3NLE.js";
|
|
257
257
|
import "./chunk-G3H2L3O2.js";
|
|
258
258
|
import {
|
|
259
259
|
__export,
|
|
@@ -261,8 +261,8 @@ import {
|
|
|
261
261
|
} from "./chunk-WJFZJZIM.js";
|
|
262
262
|
|
|
263
263
|
// src/version.ts
|
|
264
|
-
var AGENTBOX_VERSION = true ? "0.
|
|
265
|
-
var AGENTBOX_COMMIT = true ? "
|
|
264
|
+
var AGENTBOX_VERSION = true ? "0.19.0" : "0.0.0-dev";
|
|
265
|
+
var AGENTBOX_COMMIT = true ? "e1a69779a" : "dev";
|
|
266
266
|
|
|
267
267
|
// src/index.ts
|
|
268
268
|
import { Command as Command51 } from "commander";
|
|
@@ -1018,7 +1018,7 @@ function parsePositiveInt(raw, label) {
|
|
|
1018
1018
|
}
|
|
1019
1019
|
|
|
1020
1020
|
// src/commands/attach.ts
|
|
1021
|
-
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";
|
|
1022
1022
|
import { Command as Command6 } from "commander";
|
|
1023
1023
|
import { execa as execa2 } from "execa";
|
|
1024
1024
|
|
|
@@ -1526,7 +1526,7 @@ async function dirSizeCapped(dir, cap, exclude = []) {
|
|
|
1526
1526
|
|
|
1527
1527
|
// src/lib/carry-resync.ts
|
|
1528
1528
|
async function resyncCarryFiles(args) {
|
|
1529
|
-
const
|
|
1529
|
+
const log51 = args.onLog ?? (() => {
|
|
1530
1530
|
});
|
|
1531
1531
|
const prior = args.box.carry?.entries ?? [];
|
|
1532
1532
|
if (prior.length === 0) return { recopied: 0, skippedNew: 0 };
|
|
@@ -1538,7 +1538,7 @@ async function resyncCarryFiles(args) {
|
|
|
1538
1538
|
maxBytes: cfg.effective.box.cpMaxBytes
|
|
1539
1539
|
});
|
|
1540
1540
|
if (resolved.errors.length > 0) {
|
|
1541
|
-
|
|
1541
|
+
log51(`carry: resync skipped (resolve errors: ${resolved.errors.length})`);
|
|
1542
1542
|
return { recopied: 0, skippedNew: 0 };
|
|
1543
1543
|
}
|
|
1544
1544
|
const priorByDest = new Map(prior.map((e) => [e.dest, e]));
|
|
@@ -1555,7 +1555,7 @@ async function resyncCarryFiles(args) {
|
|
|
1555
1555
|
if (hash === void 0 || hash !== existing.hash) changed.push(entry);
|
|
1556
1556
|
}
|
|
1557
1557
|
if (skippedNew > 0) {
|
|
1558
|
-
|
|
1558
|
+
log51(
|
|
1559
1559
|
`carry: ${String(skippedNew)} new entry/entries not applied on resync \u2014 recreate the box to approve`
|
|
1560
1560
|
);
|
|
1561
1561
|
}
|
|
@@ -1563,9 +1563,9 @@ async function resyncCarryFiles(args) {
|
|
|
1563
1563
|
const result = await copyCarryPathsToBox({
|
|
1564
1564
|
container: args.box.container,
|
|
1565
1565
|
entries: changed,
|
|
1566
|
-
onLog:
|
|
1566
|
+
onLog: log51
|
|
1567
1567
|
});
|
|
1568
|
-
for (const err of result.errors)
|
|
1568
|
+
for (const err of result.errors) log51(`carry: ${err}`);
|
|
1569
1569
|
const updatedByDest = new Map(result.applied.map((e) => [e.dest, e]));
|
|
1570
1570
|
const mergedEntries = prior.map((e) => updatedByDest.get(e.dest) ?? e);
|
|
1571
1571
|
await recordBox({
|
|
@@ -1573,7 +1573,7 @@ async function resyncCarryFiles(args) {
|
|
|
1573
1573
|
carry: { count: mergedEntries.length, entries: mergedEntries }
|
|
1574
1574
|
});
|
|
1575
1575
|
if (result.applied.length > 0) {
|
|
1576
|
-
|
|
1576
|
+
log51(`carry: re-copied ${String(result.applied.length)} changed file(s)`);
|
|
1577
1577
|
}
|
|
1578
1578
|
return { recopied: result.applied.length, skippedNew };
|
|
1579
1579
|
}
|
|
@@ -1821,6 +1821,9 @@ function resolveAttachInOption(opts) {
|
|
|
1821
1821
|
return void 0;
|
|
1822
1822
|
}
|
|
1823
1823
|
|
|
1824
|
+
// src/commands/_cloud-agent-create.ts
|
|
1825
|
+
import { log as log4 } from "@clack/prompts";
|
|
1826
|
+
|
|
1824
1827
|
// src/lib/progress.ts
|
|
1825
1828
|
import { spinner } from "@clack/prompts";
|
|
1826
1829
|
|
|
@@ -1996,6 +1999,9 @@ ${instruction}`));
|
|
|
1996
1999
|
}
|
|
1997
2000
|
|
|
1998
2001
|
// src/commands/_cloud-agent-create.ts
|
|
2002
|
+
function agentKindFor(mode) {
|
|
2003
|
+
return mode === "claude" ? "claude-code" : mode;
|
|
2004
|
+
}
|
|
1999
2005
|
async function cloudAgentCreate(args) {
|
|
2000
2006
|
const s = makeProgressReporter(args.verbose === true);
|
|
2001
2007
|
s.start("creating cloud box");
|
|
@@ -2013,6 +2019,11 @@ async function cloudAgentCreate(args) {
|
|
|
2013
2019
|
extraArgs = [...hook.agentArgsPrefix, ...extraArgs ?? []];
|
|
2014
2020
|
}
|
|
2015
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
|
+
}
|
|
2016
2027
|
await printLaunchRecap({
|
|
2017
2028
|
record: result.record,
|
|
2018
2029
|
mode: args.mode,
|
|
@@ -2043,7 +2054,7 @@ async function cloudAgentCreate(args) {
|
|
|
2043
2054
|
// src/lib/carry-gate.ts
|
|
2044
2055
|
import { readFile as readFile2 } from "fs/promises";
|
|
2045
2056
|
import { join as join6 } from "path";
|
|
2046
|
-
import { log as
|
|
2057
|
+
import { log as log6 } from "@clack/prompts";
|
|
2047
2058
|
|
|
2048
2059
|
// src/fmt.ts
|
|
2049
2060
|
function fmtBytes2(n) {
|
|
@@ -2184,13 +2195,13 @@ async function runQueuedCarryGate(args) {
|
|
|
2184
2195
|
onLog: args.onLog
|
|
2185
2196
|
});
|
|
2186
2197
|
if (gate.decision === "cancel") {
|
|
2187
|
-
|
|
2198
|
+
log6.warn("carry: cancelled \u2014 not queuing the job");
|
|
2188
2199
|
args.onClose?.();
|
|
2189
2200
|
process.exit(0);
|
|
2190
2201
|
}
|
|
2191
2202
|
return gate.decision === "approve" ? gate.entries : [];
|
|
2192
2203
|
} catch (err) {
|
|
2193
|
-
|
|
2204
|
+
log6.error(err instanceof Error ? err.message : String(err));
|
|
2194
2205
|
args.onClose?.();
|
|
2195
2206
|
process.exit(1);
|
|
2196
2207
|
}
|
|
@@ -2446,6 +2457,22 @@ async function peekCodexCwd(file) {
|
|
|
2446
2457
|
}
|
|
2447
2458
|
return null;
|
|
2448
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
|
+
}
|
|
2449
2476
|
async function rewriteCodexSession(src, dst, hostCwd) {
|
|
2450
2477
|
const raw = await readFile4(src, "utf8");
|
|
2451
2478
|
const lines = raw.split("\n");
|
|
@@ -2464,13 +2491,10 @@ async function rewriteCodexSession(src, dst, hostCwd) {
|
|
|
2464
2491
|
}
|
|
2465
2492
|
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
2466
2493
|
const obj = parsed;
|
|
2467
|
-
if (obj.type === "
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
out.push(JSON.stringify(obj));
|
|
2472
|
-
continue;
|
|
2473
|
-
}
|
|
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;
|
|
2474
2498
|
}
|
|
2475
2499
|
}
|
|
2476
2500
|
out.push(line);
|
|
@@ -2554,7 +2578,7 @@ async function resolvePlanTeleport(opts) {
|
|
|
2554
2578
|
}
|
|
2555
2579
|
|
|
2556
2580
|
// src/lib/install-hint.ts
|
|
2557
|
-
import { log as
|
|
2581
|
+
import { log as log7 } from "@clack/prompts";
|
|
2558
2582
|
import { existsSync as existsSync4, mkdirSync, writeFileSync } from "fs";
|
|
2559
2583
|
import { homedir as homedir7 } from "os";
|
|
2560
2584
|
import { join as join10 } from "path";
|
|
@@ -2566,7 +2590,7 @@ function maybeShowInstallHint() {
|
|
|
2566
2590
|
if (existsSync4(marker)) return;
|
|
2567
2591
|
mkdirSync(join10(homedir7(), ".agentbox"), { recursive: true });
|
|
2568
2592
|
writeFileSync(marker, "");
|
|
2569
|
-
|
|
2593
|
+
log7.info("tip: run 'agentbox install' to enable the /agentbox fork command in host Claude");
|
|
2570
2594
|
} catch {
|
|
2571
2595
|
}
|
|
2572
2596
|
}
|
|
@@ -2756,13 +2780,13 @@ import { basename as basename2 } from "path";
|
|
|
2756
2780
|
async function cloudBackendForProvider(provider) {
|
|
2757
2781
|
switch (provider) {
|
|
2758
2782
|
case "daytona":
|
|
2759
|
-
return (await import("./dist-
|
|
2783
|
+
return (await import("./dist-FTCDWRAL.js")).daytonaBackend;
|
|
2760
2784
|
case "hetzner":
|
|
2761
|
-
return (await import("./dist-
|
|
2785
|
+
return (await import("./dist-PRDYMXCX.js")).hetznerBackend;
|
|
2762
2786
|
case "vercel":
|
|
2763
|
-
return (await import("./dist-
|
|
2787
|
+
return (await import("./dist-VQSZVBT3.js")).vercelBackend;
|
|
2764
2788
|
case "e2b":
|
|
2765
|
-
return (await import("./dist-
|
|
2789
|
+
return (await import("./dist-U2BHTWG4.js")).e2bBackend;
|
|
2766
2790
|
default:
|
|
2767
2791
|
return null;
|
|
2768
2792
|
}
|
|
@@ -2770,13 +2794,13 @@ async function cloudBackendForProvider(provider) {
|
|
|
2770
2794
|
async function currentCloudBaseFingerprintLive(provider) {
|
|
2771
2795
|
switch (provider) {
|
|
2772
2796
|
case "daytona":
|
|
2773
|
-
return (await import("./dist-
|
|
2797
|
+
return (await import("./dist-FTCDWRAL.js")).currentDaytonaBaseFingerprintLive();
|
|
2774
2798
|
case "hetzner":
|
|
2775
|
-
return (await import("./dist-
|
|
2799
|
+
return (await import("./dist-PRDYMXCX.js")).currentHetznerBaseFingerprintLive();
|
|
2776
2800
|
case "vercel":
|
|
2777
|
-
return (await import("./dist-
|
|
2801
|
+
return (await import("./dist-VQSZVBT3.js")).currentVercelBaseFingerprintLive();
|
|
2778
2802
|
case "e2b":
|
|
2779
|
-
return (await import("./dist-
|
|
2803
|
+
return (await import("./dist-U2BHTWG4.js")).currentE2bBaseFingerprintLive();
|
|
2780
2804
|
default:
|
|
2781
2805
|
return void 0;
|
|
2782
2806
|
}
|
|
@@ -3052,7 +3076,7 @@ function passthroughFlags(opts) {
|
|
|
3052
3076
|
}
|
|
3053
3077
|
|
|
3054
3078
|
// src/commands/prepare.ts
|
|
3055
|
-
import { intro, log as
|
|
3079
|
+
import { intro, log as log10, spinner as spinner3 } from "@clack/prompts";
|
|
3056
3080
|
import { Command as Command2 } from "commander";
|
|
3057
3081
|
async function dockerStatus() {
|
|
3058
3082
|
let img;
|
|
@@ -3115,7 +3139,7 @@ async function renderDocker(status) {
|
|
|
3115
3139
|
}
|
|
3116
3140
|
async function daytonaStatus() {
|
|
3117
3141
|
try {
|
|
3118
|
-
const mod = await import("./dist-
|
|
3142
|
+
const mod = await import("./dist-FTCDWRAL.js");
|
|
3119
3143
|
return await mod.getDaytonaStatus();
|
|
3120
3144
|
} catch (err) {
|
|
3121
3145
|
return {
|
|
@@ -3126,7 +3150,7 @@ async function daytonaStatus() {
|
|
|
3126
3150
|
}
|
|
3127
3151
|
async function e2bStatus() {
|
|
3128
3152
|
try {
|
|
3129
|
-
const mod = await import("./dist-
|
|
3153
|
+
const mod = await import("./dist-U2BHTWG4.js");
|
|
3130
3154
|
const cred = mod.readE2bCredStatus();
|
|
3131
3155
|
if (cred.auth === "none") {
|
|
3132
3156
|
return { configured: false, reason: "not configured \u2014 run `agentbox e2b login`" };
|
|
@@ -3236,7 +3260,7 @@ async function runPrepare(providerName, opts = {}) {
|
|
|
3236
3260
|
}
|
|
3237
3261
|
const provider = await getProvider(providerName);
|
|
3238
3262
|
if (typeof provider.prepare !== "function") {
|
|
3239
|
-
|
|
3263
|
+
log10.error(`provider '${providerName}' does not implement prepare`);
|
|
3240
3264
|
process.exit(1);
|
|
3241
3265
|
}
|
|
3242
3266
|
const cwd = opts.cwd ?? process.cwd();
|
|
@@ -3257,10 +3281,10 @@ async function runPrepare(providerName, opts = {}) {
|
|
|
3257
3281
|
const configKey = boxImageConfigKey(providerName);
|
|
3258
3282
|
try {
|
|
3259
3283
|
const written = await setConfigValue("project", configKey, result.snapshotName, cwd);
|
|
3260
|
-
|
|
3284
|
+
log10.success(`${configKey} = ${result.snapshotName} (written to ${written.path})`);
|
|
3261
3285
|
} catch (err) {
|
|
3262
3286
|
const msg = err instanceof Error ? err.message : String(err);
|
|
3263
|
-
|
|
3287
|
+
log10.warn(
|
|
3264
3288
|
`prepared snapshot '${result.snapshotName}', but failed to pin it into the project config: ${msg}
|
|
3265
3289
|
Run \`agentbox config set --project ${configKey} ${result.snapshotName}\` manually.`
|
|
3266
3290
|
);
|
|
@@ -3274,24 +3298,19 @@ Run \`agentbox config set --project ${configKey} ${result.snapshotName}\` manual
|
|
|
3274
3298
|
if (typeof projectImage === "string" && projectImage.length > 0 && projectImage !== DEFAULT_BOX_IMAGE) {
|
|
3275
3299
|
const cleared = await unsetConfigValue("project", "box.image", cwd);
|
|
3276
3300
|
if (cleared.existed) {
|
|
3277
|
-
|
|
3301
|
+
log10.warn(
|
|
3278
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>\``
|
|
3279
3303
|
);
|
|
3280
3304
|
}
|
|
3281
3305
|
}
|
|
3282
3306
|
} catch (err) {
|
|
3283
3307
|
const msg = err instanceof Error ? err.message : String(err);
|
|
3284
|
-
|
|
3308
|
+
log10.warn(`could not migrate stale box.image (continuing): ${msg}`);
|
|
3285
3309
|
}
|
|
3286
3310
|
if (!opts.suppressStatus) {
|
|
3287
3311
|
process.stdout.write("\n");
|
|
3288
3312
|
await showStatus({ onlyProvider: providerName });
|
|
3289
3313
|
}
|
|
3290
|
-
if (!opts.suppressTip) {
|
|
3291
|
-
log9.info(
|
|
3292
|
-
"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"
|
|
3293
|
-
);
|
|
3294
|
-
}
|
|
3295
3314
|
} catch (err) {
|
|
3296
3315
|
sp.stop(`prepare failed: ${describeError(err)}`);
|
|
3297
3316
|
throw err;
|
|
@@ -3707,7 +3726,6 @@ var claudeCommand = new Command3("claude").description("Create a sandboxed box a
|
|
|
3707
3726
|
await runPrepare(providerName, {
|
|
3708
3727
|
force: true,
|
|
3709
3728
|
cwd: opts.workspace,
|
|
3710
|
-
suppressTip: true,
|
|
3711
3729
|
suppressStatus: true
|
|
3712
3730
|
});
|
|
3713
3731
|
}
|
|
@@ -3763,9 +3781,11 @@ var claudeCommand = new Command3("claude").description("Create a sandboxed box a
|
|
|
3763
3781
|
limits: resolveLimits(cfg.effective.box, opts),
|
|
3764
3782
|
fromBranch,
|
|
3765
3783
|
useBranch,
|
|
3784
|
+
resyncOnStart: opts.resync,
|
|
3766
3785
|
projectRoot
|
|
3767
3786
|
},
|
|
3768
3787
|
binary: "claude",
|
|
3788
|
+
hasSeedPrompt: Boolean(planPrepared) || wiz.action === "launch-with-prompt" && Boolean(wiz.initialPrompt) || Boolean(resumePrepared),
|
|
3769
3789
|
sessionName: cfg.effective.claude.sessionName,
|
|
3770
3790
|
mode: "claude",
|
|
3771
3791
|
extraArgs: effectiveClaudeArgs,
|
|
@@ -4589,11 +4609,13 @@ var codexCommand = new Command4("codex").description("Create a sandboxed box and
|
|
|
4589
4609
|
limits: resolveLimits(cfg.effective.box, opts),
|
|
4590
4610
|
fromBranch,
|
|
4591
4611
|
useBranch,
|
|
4612
|
+
resyncOnStart: opts.resync,
|
|
4592
4613
|
projectRoot
|
|
4593
4614
|
},
|
|
4594
4615
|
binary: "codex",
|
|
4595
4616
|
sessionName: cfg.effective.codex.sessionName,
|
|
4596
4617
|
mode: "codex",
|
|
4618
|
+
hasSeedPrompt: Boolean(resumePrepared),
|
|
4597
4619
|
extraArgs: applyCodexSkipPermissions(codexArgs, cfg.effective),
|
|
4598
4620
|
verbose: opts.verbose === true,
|
|
4599
4621
|
openIn: hostAwareOpenIn(cfg),
|
|
@@ -5325,11 +5347,15 @@ var opencodeCommand = new Command5("opencode").description("Create a sandboxed b
|
|
|
5325
5347
|
limits: resolveLimits(cfg.effective.box, opts),
|
|
5326
5348
|
fromBranch,
|
|
5327
5349
|
useBranch,
|
|
5350
|
+
resyncOnStart: opts.resync,
|
|
5328
5351
|
projectRoot
|
|
5329
5352
|
},
|
|
5330
5353
|
binary: "opencode",
|
|
5331
5354
|
sessionName: cfg.effective.opencode.sessionName,
|
|
5332
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,
|
|
5333
5359
|
extraArgs: opencodeArgs,
|
|
5334
5360
|
verbose: opts.verbose === true,
|
|
5335
5361
|
openIn: hostAwareOpenIn(cfg),
|
|
@@ -5759,7 +5785,7 @@ var attachCommand = new Command6("attach").description(
|
|
|
5759
5785
|
const isCloud = (box.provider ?? "docker") !== "docker";
|
|
5760
5786
|
const sessions = isCloud ? await probeCloudAgentSessions(box, opts.sessionName) : await probeDockerAgentSessions(box.container, opts.sessionName);
|
|
5761
5787
|
if (sessions.length === 0) {
|
|
5762
|
-
|
|
5788
|
+
log14.warn(`no agent session running in ${box.name}`);
|
|
5763
5789
|
process.exit(1);
|
|
5764
5790
|
}
|
|
5765
5791
|
const winner = await pickSession(box.name, sessions);
|
|
@@ -5795,13 +5821,13 @@ var CLOUD_BACKENDS = ["daytona", "hetzner", "vercel", "e2b"];
|
|
|
5795
5821
|
async function cloudProviderFor(backend) {
|
|
5796
5822
|
switch (backend) {
|
|
5797
5823
|
case "daytona":
|
|
5798
|
-
return (await import("./dist-
|
|
5824
|
+
return (await import("./dist-FTCDWRAL.js")).daytonaProvider;
|
|
5799
5825
|
case "hetzner":
|
|
5800
|
-
return (await import("./dist-
|
|
5826
|
+
return (await import("./dist-PRDYMXCX.js")).hetznerProvider;
|
|
5801
5827
|
case "vercel":
|
|
5802
|
-
return (await import("./dist-
|
|
5828
|
+
return (await import("./dist-VQSZVBT3.js")).vercelProvider;
|
|
5803
5829
|
case "e2b":
|
|
5804
|
-
return (await import("./dist-
|
|
5830
|
+
return (await import("./dist-U2BHTWG4.js")).e2bProvider;
|
|
5805
5831
|
}
|
|
5806
5832
|
}
|
|
5807
5833
|
var CHECKPOINT_NOTICE = "Checkpoint in progress \u2014 the box will be unresponsive for a moment";
|
|
@@ -6165,7 +6191,7 @@ var checkpointCommand = new Command7("checkpoint").alias("checkpoints").descript
|
|
|
6165
6191
|
|
|
6166
6192
|
// src/commands/code.ts
|
|
6167
6193
|
import { spawn } from "child_process";
|
|
6168
|
-
import { log as
|
|
6194
|
+
import { log as log16 } from "@clack/prompts";
|
|
6169
6195
|
import { Command as Command8, InvalidArgumentError } from "commander";
|
|
6170
6196
|
|
|
6171
6197
|
// src/ssh-config.ts
|
|
@@ -6306,11 +6332,11 @@ var codeCommand = new Command8("code").description("Open a box in VS Code or Cur
|
|
|
6306
6332
|
}
|
|
6307
6333
|
const exit = await launchIde(folderUri, forcedIde);
|
|
6308
6334
|
if (exit.code !== 0) {
|
|
6309
|
-
|
|
6335
|
+
log16.error(`failed to launch ${exit.flavor ? ideProfile(exit.flavor).displayName : "IDE"} via ${exit.via} (exit ${String(exit.code)})`);
|
|
6310
6336
|
process.stdout.write(folderUri + "\n");
|
|
6311
6337
|
process.exit(1);
|
|
6312
6338
|
}
|
|
6313
|
-
|
|
6339
|
+
log16.success(
|
|
6314
6340
|
`opening ${box.name} in ${ideProfile(exit.flavor).displayName} (${exit.via})`
|
|
6315
6341
|
);
|
|
6316
6342
|
} catch (err) {
|
|
@@ -6320,10 +6346,10 @@ var codeCommand = new Command8("code").description("Open a box in VS Code or Cur
|
|
|
6320
6346
|
async function prepareDockerAttach(box, opts) {
|
|
6321
6347
|
const insp = await inspectBox(box.id);
|
|
6322
6348
|
if (insp.state === "paused") {
|
|
6323
|
-
|
|
6349
|
+
log16.info(`box is paused; unpausing`);
|
|
6324
6350
|
await unpauseBox(box.id);
|
|
6325
6351
|
} else if (insp.state === "stopped") {
|
|
6326
|
-
|
|
6352
|
+
log16.info(`box is stopped; starting`);
|
|
6327
6353
|
await startBox(box.id);
|
|
6328
6354
|
} else if (insp.state === "missing") {
|
|
6329
6355
|
throw new Error(`box ${box.name} has no container; was it destroyed?`);
|
|
@@ -6334,9 +6360,9 @@ async function prepareDockerAttach(box, opts) {
|
|
|
6334
6360
|
const lines = [];
|
|
6335
6361
|
if (reply.timedOut.length > 0) lines.push(`timed out: ${reply.timedOut.join(", ")}`);
|
|
6336
6362
|
if (reply.failed.length > 0) lines.push(`failed: ${reply.failed.join(", ")}`);
|
|
6337
|
-
|
|
6363
|
+
log16.warn(`box not fully ready (${lines.join("; ")}). Opening anyway.`);
|
|
6338
6364
|
} else {
|
|
6339
|
-
|
|
6365
|
+
log16.success("all units ready");
|
|
6340
6366
|
}
|
|
6341
6367
|
}
|
|
6342
6368
|
if (opts.autoTerminals) {
|
|
@@ -6346,14 +6372,14 @@ async function prepareDockerAttach(box, opts) {
|
|
|
6346
6372
|
regen: opts.regenTasks
|
|
6347
6373
|
});
|
|
6348
6374
|
if (r.status === "wrote") {
|
|
6349
|
-
|
|
6375
|
+
log16.info(`wrote /workspace/.vscode/tasks.json (${String(services.length)} service(s))`);
|
|
6350
6376
|
} else if (r.status === "skipped-user-owned") {
|
|
6351
|
-
|
|
6377
|
+
log16.warn(
|
|
6352
6378
|
"user-owned .vscode/tasks.json detected; skipping auto-terminals (pass --regen-tasks to overwrite)"
|
|
6353
6379
|
);
|
|
6354
6380
|
}
|
|
6355
6381
|
} catch (err) {
|
|
6356
|
-
|
|
6382
|
+
log16.warn(
|
|
6357
6383
|
`auto-terminals failed: ${err instanceof Error ? err.message : String(err)}`
|
|
6358
6384
|
);
|
|
6359
6385
|
}
|
|
@@ -6365,10 +6391,10 @@ async function prepareCloudAttach(box, opts) {
|
|
|
6365
6391
|
const p = await providerForBox(box);
|
|
6366
6392
|
const state = await p.probeState(box);
|
|
6367
6393
|
if (state === "paused") {
|
|
6368
|
-
|
|
6394
|
+
log16.info("box is paused; resuming");
|
|
6369
6395
|
await p.resume(box);
|
|
6370
6396
|
} else if (state === "stopped") {
|
|
6371
|
-
|
|
6397
|
+
log16.info("box is stopped; starting");
|
|
6372
6398
|
await p.start(box);
|
|
6373
6399
|
} else if (state === "missing") {
|
|
6374
6400
|
throw new Error(`cloud sandbox for ${box.name} is missing; was it deleted?`);
|
|
@@ -6381,12 +6407,12 @@ async function prepareCloudAttach(box, opts) {
|
|
|
6381
6407
|
const lines = [];
|
|
6382
6408
|
if (reply.timedOut.length > 0) lines.push(`timed out: ${reply.timedOut.join(", ")}`);
|
|
6383
6409
|
if (reply.failed.length > 0) lines.push(`failed: ${reply.failed.join(", ")}`);
|
|
6384
|
-
|
|
6410
|
+
log16.warn(`box not fully ready (${lines.join("; ")}). Opening anyway.`);
|
|
6385
6411
|
} else {
|
|
6386
|
-
|
|
6412
|
+
log16.success("all units ready");
|
|
6387
6413
|
}
|
|
6388
6414
|
} catch (err) {
|
|
6389
|
-
|
|
6415
|
+
log16.warn(`wait-ready failed (continuing): ${err instanceof Error ? err.message : String(err)}`);
|
|
6390
6416
|
}
|
|
6391
6417
|
}
|
|
6392
6418
|
if (!p.buildAttach) {
|
|
@@ -6408,7 +6434,7 @@ async function prepareCloudAttach(box, opts) {
|
|
|
6408
6434
|
user: target.user,
|
|
6409
6435
|
identityFile: target.identityFile
|
|
6410
6436
|
});
|
|
6411
|
-
|
|
6437
|
+
log16.info(`updated ~/.ssh/config alias ${alias}`);
|
|
6412
6438
|
return `vscode-remote://ssh-remote+${alias}/workspace`;
|
|
6413
6439
|
}
|
|
6414
6440
|
async function runWaitReadyDocker(container, timeoutMs) {
|
|
@@ -6433,7 +6459,7 @@ async function launchIde(folderUri, forced) {
|
|
|
6433
6459
|
if (code !== null) return code;
|
|
6434
6460
|
const cursor = await tryCli("cursor", folderUri);
|
|
6435
6461
|
if (cursor !== null) return cursor;
|
|
6436
|
-
|
|
6462
|
+
log16.warn("neither `code` nor `cursor` found in PATH; falling back to `open vscode://...`");
|
|
6437
6463
|
return launchOne("vscode", folderUri);
|
|
6438
6464
|
}
|
|
6439
6465
|
async function tryCli(flavor, folderUri) {
|
|
@@ -6446,7 +6472,7 @@ async function launchOne(flavor, folderUri) {
|
|
|
6446
6472
|
const profile = ideProfile(flavor);
|
|
6447
6473
|
const cliCode = await spawnCommand(profile.cli, ["--folder-uri", folderUri]);
|
|
6448
6474
|
if (cliCode !== 127) return { code: cliCode, flavor, via: "cli" };
|
|
6449
|
-
|
|
6475
|
+
log16.warn(
|
|
6450
6476
|
`\`${profile.cli}\` not found in PATH; falling back to \`${hostOpenCommand()} ${profile.protocolScheme}://...\` (the %2B URL-encoding bug may break attach)`
|
|
6451
6477
|
);
|
|
6452
6478
|
const url = `${profile.protocolScheme}://${folderUri.replace(/^vscode-remote:\/\//, "vscode-remote/")}`;
|
|
@@ -6750,7 +6776,7 @@ var configCommand = new Command9("config").description("Read / write layered con
|
|
|
6750
6776
|
|
|
6751
6777
|
// src/commands/cp.ts
|
|
6752
6778
|
import { resolve as resolve3 } from "path";
|
|
6753
|
-
import { log as
|
|
6779
|
+
import { log as log17 } from "@clack/prompts";
|
|
6754
6780
|
import { Command as Command10 } from "commander";
|
|
6755
6781
|
function collectExclude(val, acc) {
|
|
6756
6782
|
acc.push(val);
|
|
@@ -6886,10 +6912,10 @@ var cpCommand = new Command10("cp").description("Copy files between host and box
|
|
|
6886
6912
|
}
|
|
6887
6913
|
const insp = await inspectBox(box.id);
|
|
6888
6914
|
if (insp.state === "paused") {
|
|
6889
|
-
|
|
6915
|
+
log17.info("box is paused; unpausing");
|
|
6890
6916
|
await unpauseBox(box.id);
|
|
6891
6917
|
} else if (insp.state === "stopped") {
|
|
6892
|
-
|
|
6918
|
+
log17.info("box is stopped; starting");
|
|
6893
6919
|
await startBox(box.id);
|
|
6894
6920
|
} else if (insp.state === "missing") {
|
|
6895
6921
|
throw new Error(`box ${box.name} has no container; was it destroyed?`);
|
|
@@ -6897,7 +6923,7 @@ var cpCommand = new Command10("cp").description("Copy files between host and box
|
|
|
6897
6923
|
if (parsed.direction === "upload") {
|
|
6898
6924
|
const result = await uploadToBox(box, parsed.hostPath, parsed.boxPath, tarPatterns);
|
|
6899
6925
|
if (result.warn) {
|
|
6900
|
-
|
|
6926
|
+
log17.warn(`copied to ${box.name}:${result.finalPath}, but ${result.warn}`);
|
|
6901
6927
|
} else {
|
|
6902
6928
|
process.stdout.write(`copied to ${box.name}:${result.finalPath}
|
|
6903
6929
|
`);
|
|
@@ -6918,7 +6944,7 @@ var cpCommand = new Command10("cp").description("Copy files between host and box
|
|
|
6918
6944
|
});
|
|
6919
6945
|
|
|
6920
6946
|
// src/commands/create.ts
|
|
6921
|
-
import { intro as intro6, log as
|
|
6947
|
+
import { intro as intro6, log as log18, outro as outro5 } from "@clack/prompts";
|
|
6922
6948
|
import { Command as Command11 } from "commander";
|
|
6923
6949
|
import { execSync, spawnSync as spawnSync2 } from "child_process";
|
|
6924
6950
|
function buildCliOverrides(opts) {
|
|
@@ -7066,13 +7092,13 @@ var createCommand = new Command11("create").description(
|
|
|
7066
7092
|
onLog: (line) => cmdLog.write(line)
|
|
7067
7093
|
});
|
|
7068
7094
|
if (gate.decision === "cancel") {
|
|
7069
|
-
|
|
7095
|
+
log18.warn("carry: cancelled \u2014 not creating the box");
|
|
7070
7096
|
cmdLog.close();
|
|
7071
7097
|
process.exit(0);
|
|
7072
7098
|
}
|
|
7073
7099
|
if (gate.decision === "approve") carryEntries = gate.entries;
|
|
7074
7100
|
} catch (err) {
|
|
7075
|
-
|
|
7101
|
+
log18.error(err instanceof Error ? err.message : String(err));
|
|
7076
7102
|
cmdLog.close();
|
|
7077
7103
|
process.exit(1);
|
|
7078
7104
|
}
|
|
@@ -7088,11 +7114,10 @@ var createCommand = new Command11("create").description(
|
|
|
7088
7114
|
baseStatus
|
|
7089
7115
|
});
|
|
7090
7116
|
if (wiz.rebuildBase) {
|
|
7091
|
-
|
|
7117
|
+
log18.warn(`${providerName} base image is outdated; rebuilding before create\u2026`);
|
|
7092
7118
|
await runPrepare(providerName, {
|
|
7093
7119
|
force: true,
|
|
7094
7120
|
cwd: opts.workspace,
|
|
7095
|
-
suppressTip: true,
|
|
7096
7121
|
suppressStatus: true
|
|
7097
7122
|
});
|
|
7098
7123
|
}
|
|
@@ -7135,7 +7160,7 @@ var createCommand = new Command11("create").description(
|
|
|
7135
7160
|
} catch (err) {
|
|
7136
7161
|
if (err instanceof FromBranchError || err instanceof UseBranchError) {
|
|
7137
7162
|
s.stop("aborting: invalid branch selection");
|
|
7138
|
-
|
|
7163
|
+
log18.error(err.message);
|
|
7139
7164
|
cmdLog.close();
|
|
7140
7165
|
process.exit(2);
|
|
7141
7166
|
}
|
|
@@ -7180,18 +7205,18 @@ var createCommand = new Command11("create").description(
|
|
|
7180
7205
|
});
|
|
7181
7206
|
s.stop(`box ${result.record.container} ready`);
|
|
7182
7207
|
const createResyncWarning = result.resync ? buildResyncWarning(result.resync) : null;
|
|
7183
|
-
if (createResyncWarning)
|
|
7184
|
-
|
|
7208
|
+
if (createResyncWarning) log18.warn(createResyncWarning);
|
|
7209
|
+
log18.info(`id: ${result.record.id}`);
|
|
7185
7210
|
if (typeof result.record.projectIndex === "number") {
|
|
7186
|
-
|
|
7211
|
+
log18.info(`n: ${String(result.record.projectIndex)} (in ${projectRoot})`);
|
|
7187
7212
|
}
|
|
7188
|
-
|
|
7189
|
-
|
|
7213
|
+
log18.info(`container: ${result.record.container}`);
|
|
7214
|
+
log18.info(`image: ${result.record.image}${result.imageBuilt ? " (built just now)" : ""}`);
|
|
7190
7215
|
if (result.record.snapshotDir) {
|
|
7191
|
-
|
|
7216
|
+
log18.info(`snapshot: ${result.record.snapshotDir}`);
|
|
7192
7217
|
}
|
|
7193
7218
|
if (result.record.checkpointSource) {
|
|
7194
|
-
|
|
7219
|
+
log18.info(
|
|
7195
7220
|
`checkpoint: ${result.record.checkpointSource.ref} (${result.record.checkpointSource.type}) \u2192 ${result.record.checkpointImage ?? "(missing)"}`
|
|
7196
7221
|
);
|
|
7197
7222
|
}
|
|
@@ -7203,7 +7228,7 @@ var createCommand = new Command11("create").description(
|
|
|
7203
7228
|
` agentbox claude attach ${result.record.name}`,
|
|
7204
7229
|
` agentbox url ${result.record.name}`
|
|
7205
7230
|
];
|
|
7206
|
-
|
|
7231
|
+
log18.message(
|
|
7207
7232
|
[
|
|
7208
7233
|
"",
|
|
7209
7234
|
"Try it:",
|
|
@@ -7222,7 +7247,7 @@ var createCommand = new Command11("create").description(
|
|
|
7222
7247
|
const protectedPaths = boxes.map((b) => b.projectRoot).filter((p) => typeof p === "string");
|
|
7223
7248
|
const res = await pruneOrphanProjectConfigs({ protectedPaths });
|
|
7224
7249
|
if (res.removed.length > 0) {
|
|
7225
|
-
|
|
7250
|
+
log18.info(
|
|
7226
7251
|
`cleaned ${String(res.removed.length)} orphan project config dir(s): ` + res.removed.map((r) => r.originalPath).join(", ")
|
|
7227
7252
|
);
|
|
7228
7253
|
}
|
|
@@ -7232,7 +7257,7 @@ var createCommand = new Command11("create").description(
|
|
|
7232
7257
|
}
|
|
7233
7258
|
outro5("done");
|
|
7234
7259
|
if (attachClaudeAfter) {
|
|
7235
|
-
const { cloudAgentAttach: cloudAgentAttach2 } = await import("./_cloud-attach-
|
|
7260
|
+
const { cloudAgentAttach: cloudAgentAttach2 } = await import("./_cloud-attach-YM2KOWHO.js");
|
|
7236
7261
|
await cloudAgentAttach2({
|
|
7237
7262
|
box: result.record,
|
|
7238
7263
|
binary: "claude",
|
|
@@ -7248,14 +7273,14 @@ var createCommand = new Command11("create").description(
|
|
|
7248
7273
|
s.stop("failed");
|
|
7249
7274
|
const msg = err instanceof Error ? err.message : String(err);
|
|
7250
7275
|
cmdLog.write(`FAIL: ${err instanceof Error ? err.stack ?? err.message : String(err)}`);
|
|
7251
|
-
|
|
7276
|
+
log18.error(msg);
|
|
7252
7277
|
try {
|
|
7253
7278
|
const running = execSync('docker ps --format "{{.Names}}"', {
|
|
7254
7279
|
stdio: ["ignore", "pipe", "ignore"]
|
|
7255
7280
|
}).toString().split("\n").filter((n) => n.startsWith("agentbox-"));
|
|
7256
7281
|
if (running.length > 0) {
|
|
7257
|
-
|
|
7258
|
-
|
|
7282
|
+
log18.warn(`leftover containers: ${running.join(", ")}`);
|
|
7283
|
+
log18.warn(`remove with: docker rm -f ${running.join(" ")}`);
|
|
7259
7284
|
}
|
|
7260
7285
|
} catch {
|
|
7261
7286
|
}
|
|
@@ -7268,7 +7293,7 @@ var createCommand = new Command11("create").description(
|
|
|
7268
7293
|
|
|
7269
7294
|
// src/commands/dashboard.ts
|
|
7270
7295
|
import { spawn as spawn2 } from "child_process";
|
|
7271
|
-
import { log as
|
|
7296
|
+
import { log as log19 } from "@clack/prompts";
|
|
7272
7297
|
import { Command as Command12 } from "commander";
|
|
7273
7298
|
|
|
7274
7299
|
// src/dashboard/layout.ts
|
|
@@ -8791,7 +8816,7 @@ function toSidebar(b) {
|
|
|
8791
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) => {
|
|
8792
8817
|
try {
|
|
8793
8818
|
if (!process.stdout.isTTY || !process.stdin.isTTY) {
|
|
8794
|
-
|
|
8819
|
+
log19.error("agentbox dashboard needs an interactive terminal");
|
|
8795
8820
|
process.exit(2);
|
|
8796
8821
|
}
|
|
8797
8822
|
const backend = await loadPtyBackend();
|
|
@@ -8801,10 +8826,10 @@ var dashboardCommand = new Command12("dashboard").description("Box list + the se
|
|
|
8801
8826
|
ptySpawn = backend.ptySpawn;
|
|
8802
8827
|
termCtor = backend.termCtor;
|
|
8803
8828
|
} else {
|
|
8804
|
-
|
|
8829
|
+
log19.error(
|
|
8805
8830
|
"agentbox dashboard is unavailable here (native terminal backend failed to load)"
|
|
8806
8831
|
);
|
|
8807
|
-
|
|
8832
|
+
log19.info("use `agentbox claude` / `agentbox attach` instead");
|
|
8808
8833
|
process.exit(2);
|
|
8809
8834
|
}
|
|
8810
8835
|
const project = await findProjectRoot(process.cwd());
|
|
@@ -9209,11 +9234,11 @@ var dashboardCommand = new Command12("dashboard").description("Box list + the se
|
|
|
9209
9234
|
});
|
|
9210
9235
|
|
|
9211
9236
|
// ../../packages/sandbox-daytona/dist/cli.js
|
|
9212
|
-
import { log as
|
|
9237
|
+
import { log as log20, spinner as spinner7 } from "@clack/prompts";
|
|
9213
9238
|
import { Command as Command13 } from "commander";
|
|
9214
9239
|
function reportError(err) {
|
|
9215
9240
|
const message = err instanceof Error ? err.message : String(err);
|
|
9216
|
-
|
|
9241
|
+
log20.error(message);
|
|
9217
9242
|
process.exitCode = 1;
|
|
9218
9243
|
}
|
|
9219
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) => {
|
|
@@ -9231,7 +9256,7 @@ var loginSub = new Command13("login").description("Set up (or rotate) Daytona cr
|
|
|
9231
9256
|
}
|
|
9232
9257
|
await ensureDaytonaCredentials({ force: true });
|
|
9233
9258
|
if (readPreparedDaytonaState()?.base === void 0) {
|
|
9234
|
-
|
|
9259
|
+
log20.info(
|
|
9235
9260
|
"Base snapshot not built yet \u2014 run `agentbox prepare --provider daytona` (or `agentbox install`) to bake it."
|
|
9236
9261
|
);
|
|
9237
9262
|
}
|
|
@@ -9277,7 +9302,7 @@ var resyncSub = new Command13("resync").description(
|
|
|
9277
9302
|
const sb = spinner7();
|
|
9278
9303
|
sb.start(`provisioning throwaway sandbox to refresh: ${agents.join(", ")}`);
|
|
9279
9304
|
const ensured = await ensureAgentVolumesForCloud(daytonaBackend, {
|
|
9280
|
-
onLog: (line) =>
|
|
9305
|
+
onLog: (line) => log20.info(line)
|
|
9281
9306
|
});
|
|
9282
9307
|
if (ensured.agents.length === 0) {
|
|
9283
9308
|
sb.stop("no agent volumes available \u2014 the daytona backend has no volume primitive");
|
|
@@ -9317,7 +9342,7 @@ var resyncSub = new Command13("resync").description(
|
|
|
9317
9342
|
}
|
|
9318
9343
|
sb3.stop("throwaway sandbox destroyed");
|
|
9319
9344
|
}
|
|
9320
|
-
|
|
9345
|
+
log20.success(
|
|
9321
9346
|
`Daytona agent volumes refreshed: ${agents.join(", ")}. Next \`agentbox create --provider daytona\` will use the updated credentials.`
|
|
9322
9347
|
);
|
|
9323
9348
|
} catch (err) {
|
|
@@ -9337,11 +9362,11 @@ var dockerCommand = new Command14("docker").description(
|
|
|
9337
9362
|
});
|
|
9338
9363
|
|
|
9339
9364
|
// ../../packages/sandbox-hetzner/dist/cli.js
|
|
9340
|
-
import { log as
|
|
9365
|
+
import { log as log21 } from "@clack/prompts";
|
|
9341
9366
|
import { Command as Command15 } from "commander";
|
|
9342
9367
|
function reportError2(err) {
|
|
9343
9368
|
const message = err instanceof Error ? err.message : String(err);
|
|
9344
|
-
|
|
9369
|
+
log21.error(message);
|
|
9345
9370
|
process.exitCode = 1;
|
|
9346
9371
|
}
|
|
9347
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) => {
|
|
@@ -9359,7 +9384,7 @@ var loginSub2 = new Command15("login").description("Set up (or rotate) Hetzner C
|
|
|
9359
9384
|
}
|
|
9360
9385
|
await ensureHetznerCredentials({ force: true });
|
|
9361
9386
|
if (readPreparedState().base === void 0) {
|
|
9362
|
-
|
|
9387
|
+
log21.info(
|
|
9363
9388
|
"Base snapshot not built yet \u2014 run `agentbox prepare --provider hetzner` (or `agentbox install`) to bake it."
|
|
9364
9389
|
);
|
|
9365
9390
|
}
|
|
@@ -9490,11 +9515,11 @@ var hetznerCommand = new Command15("hetzner").description(
|
|
|
9490
9515
|
).addCommand(loginSub2, { isDefault: true }).addCommand(firewallSub);
|
|
9491
9516
|
|
|
9492
9517
|
// ../../packages/sandbox-vercel/dist/cli.js
|
|
9493
|
-
import { log as
|
|
9518
|
+
import { log as log22 } from "@clack/prompts";
|
|
9494
9519
|
import { Command as Command16 } from "commander";
|
|
9495
9520
|
function reportError3(err) {
|
|
9496
9521
|
const message = err instanceof Error ? err.message : String(err);
|
|
9497
|
-
|
|
9522
|
+
log22.error(message);
|
|
9498
9523
|
process.exitCode = 1;
|
|
9499
9524
|
}
|
|
9500
9525
|
function relativeExpiry(expiresAt) {
|
|
@@ -9557,7 +9582,7 @@ var loginSub3 = new Command16("login").description("Set up (or rotate) Vercel cr
|
|
|
9557
9582
|
}
|
|
9558
9583
|
await ensureVercelCredentials({ force: true });
|
|
9559
9584
|
if (readPreparedState2().base === void 0) {
|
|
9560
|
-
|
|
9585
|
+
log22.info(
|
|
9561
9586
|
"Base snapshot not built yet \u2014 run `agentbox prepare --provider vercel` (or `agentbox install`) to bake it."
|
|
9562
9587
|
);
|
|
9563
9588
|
}
|
|
@@ -9570,11 +9595,11 @@ var vercelCommand = new Command16("vercel").description(
|
|
|
9570
9595
|
).addCommand(loginSub3, { isDefault: true });
|
|
9571
9596
|
|
|
9572
9597
|
// ../../packages/sandbox-e2b/dist/cli.js
|
|
9573
|
-
import { log as
|
|
9598
|
+
import { log as log23 } from "@clack/prompts";
|
|
9574
9599
|
import { Command as Command17 } from "commander";
|
|
9575
9600
|
function reportError4(err) {
|
|
9576
9601
|
const message = err instanceof Error ? err.message : String(err);
|
|
9577
|
-
|
|
9602
|
+
log23.error(message);
|
|
9578
9603
|
process.exitCode = 1;
|
|
9579
9604
|
}
|
|
9580
9605
|
function printStatus4() {
|
|
@@ -9606,7 +9631,7 @@ var loginSub4 = new Command17("login").description("Set up (or rotate) E2B crede
|
|
|
9606
9631
|
}
|
|
9607
9632
|
await ensureE2bCredentials({ force: true });
|
|
9608
9633
|
if (readPreparedState3().base === void 0) {
|
|
9609
|
-
|
|
9634
|
+
log23.info(
|
|
9610
9635
|
"Base template not built yet \u2014 run `agentbox prepare --provider e2b` (or `agentbox install`) to bake it."
|
|
9611
9636
|
);
|
|
9612
9637
|
}
|
|
@@ -10160,7 +10185,7 @@ downloadCommand.addCommand(downloadOpencodeCommand);
|
|
|
10160
10185
|
downloadCommand.addCommand(downloadConfigCommand);
|
|
10161
10186
|
|
|
10162
10187
|
// src/commands/drive.ts
|
|
10163
|
-
import { log as
|
|
10188
|
+
import { log as log31 } from "@clack/prompts";
|
|
10164
10189
|
import { Command as Command25 } from "commander";
|
|
10165
10190
|
|
|
10166
10191
|
// src/lib/drive/keys.ts
|
|
@@ -10343,7 +10368,7 @@ var driveWaitCommand = new Command25("wait").description("Block until --text app
|
|
|
10343
10368
|
}) + "\n"
|
|
10344
10369
|
);
|
|
10345
10370
|
} else {
|
|
10346
|
-
|
|
10371
|
+
log31.error(`text not found within ${String(timeoutMs)}ms: ${opts.text}`);
|
|
10347
10372
|
}
|
|
10348
10373
|
process.exit(1);
|
|
10349
10374
|
} catch (err) {
|
|
@@ -10370,8 +10395,8 @@ driveCommand.addCommand(driveWaitCommand);
|
|
|
10370
10395
|
driveCommand.addCommand(driveResizeCommand);
|
|
10371
10396
|
function handleDriveError(err) {
|
|
10372
10397
|
if (err instanceof SessionNotFoundError) {
|
|
10373
|
-
|
|
10374
|
-
|
|
10398
|
+
log31.error(err.message);
|
|
10399
|
+
log31.info("start an agent first (e.g. `agentbox claude <box>`) or pass --session.");
|
|
10375
10400
|
process.exit(2);
|
|
10376
10401
|
}
|
|
10377
10402
|
handleLifecycleError(err);
|
|
@@ -10395,12 +10420,32 @@ function sleep3(ms) {
|
|
|
10395
10420
|
}
|
|
10396
10421
|
|
|
10397
10422
|
// src/commands/fork.ts
|
|
10398
|
-
import { log as
|
|
10423
|
+
import { log as log32 } from "@clack/prompts";
|
|
10399
10424
|
import { Command as Command26 } from "commander";
|
|
10400
10425
|
import { existsSync as existsSync5, readdirSync, statSync } from "fs";
|
|
10401
10426
|
import { homedir as homedir12 } from "os";
|
|
10402
10427
|
import { join as join15 } from "path";
|
|
10403
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
|
+
}
|
|
10404
10449
|
var AGENT_COMMAND = {
|
|
10405
10450
|
claude: claudeCommand,
|
|
10406
10451
|
codex: codexCommand,
|
|
@@ -10449,16 +10494,19 @@ function resolveAttachArgs(attachIn) {
|
|
|
10449
10494
|
return detectHostTerminal() === "unknown" ? ["--no-attach"] : ["--attach-in", attachIn];
|
|
10450
10495
|
}
|
|
10451
10496
|
var forkCommand = new Command26("fork").description(
|
|
10452
|
-
"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'"
|
|
10453
10501
|
).option("-w, --workspace <path>", "host workspace to mount", process.cwd()).option(
|
|
10454
10502
|
"--agent <name>",
|
|
10455
|
-
"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)."
|
|
10456
10504
|
).option(
|
|
10457
10505
|
"--session <id>",
|
|
10458
|
-
"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."
|
|
10459
10507
|
).option(
|
|
10460
10508
|
"--provider <name>",
|
|
10461
|
-
"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`."
|
|
10462
10510
|
).option("-n, --name <name>", "box name (default: fork-<HHMMSS>)").option(
|
|
10463
10511
|
"--attach-in <mode>",
|
|
10464
10512
|
"where to open the forked session: window | tab | split | background | same (default: tab). Falls back to background outside tmux/iTerm."
|
|
@@ -10469,39 +10517,62 @@ var forkCommand = new Command26("fork").description(
|
|
|
10469
10517
|
).option(
|
|
10470
10518
|
"--plan <path>",
|
|
10471
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.'
|
|
10472
|
-
).action(async (opts) => {
|
|
10520
|
+
).action(async (providerArg, opts) => {
|
|
10473
10521
|
if ((process.env.AGENTBOX_RELAY_URL ?? "").trim().length > 0) {
|
|
10474
|
-
|
|
10522
|
+
log32.error(
|
|
10475
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."
|
|
10476
10524
|
);
|
|
10477
10525
|
process.exit(2);
|
|
10478
10526
|
}
|
|
10479
|
-
const agent = opts.agent?.trim() || "claude";
|
|
10527
|
+
const agent = opts.agent?.trim() || detectAgentFromEnv() || "claude";
|
|
10480
10528
|
if (!FORK_AGENTS.includes(agent)) {
|
|
10481
|
-
|
|
10529
|
+
log32.error(`--agent: expected one of ${FORK_AGENTS.join(", ")}, got "${opts.agent ?? ""}"`);
|
|
10482
10530
|
process.exit(2);
|
|
10483
10531
|
}
|
|
10484
10532
|
const attachIn = opts.attachIn ?? "tab";
|
|
10485
10533
|
if (!FORK_ATTACH_VALUES.includes(attachIn)) {
|
|
10486
|
-
|
|
10534
|
+
log32.error(`--attach-in: expected one of ${FORK_ATTACH_VALUES.join(", ")}, got "${attachIn}"`);
|
|
10487
10535
|
process.exit(2);
|
|
10488
10536
|
}
|
|
10489
10537
|
const plan = opts.plan?.trim();
|
|
10490
10538
|
if (plan && agent !== "claude") {
|
|
10491
|
-
|
|
10539
|
+
log32.error("--plan is only supported with --agent claude (plan mode is Claude-specific).");
|
|
10492
10540
|
process.exit(2);
|
|
10493
10541
|
}
|
|
10494
10542
|
const carryMode = opts.carry ?? "send";
|
|
10495
10543
|
if (carryMode !== "send" && carryMode !== "skip") {
|
|
10496
|
-
|
|
10544
|
+
log32.error(`--carry: expected 'send' or 'skip', got "${opts.carry ?? ""}"`);
|
|
10497
10545
|
process.exit(2);
|
|
10498
10546
|
}
|
|
10499
|
-
|
|
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
|
+
}
|
|
10500
10571
|
let sessionArgs;
|
|
10501
10572
|
try {
|
|
10502
10573
|
sessionArgs = resolveSessionArgs(agent, opts);
|
|
10503
10574
|
} catch (err) {
|
|
10504
|
-
|
|
10575
|
+
log32.error(err instanceof Error ? err.message : String(err));
|
|
10505
10576
|
process.exit(2);
|
|
10506
10577
|
}
|
|
10507
10578
|
const subArgv = [
|
|
@@ -10524,6 +10595,7 @@ var forkCommand = new Command26("fork").description(
|
|
|
10524
10595
|
|
|
10525
10596
|
// src/commands/install.ts
|
|
10526
10597
|
import { Command as Command29 } from "commander";
|
|
10598
|
+
import { execa as execa5 } from "execa";
|
|
10527
10599
|
import {
|
|
10528
10600
|
existsSync as existsSync10,
|
|
10529
10601
|
lstatSync,
|
|
@@ -10660,7 +10732,7 @@ async function dockerChecks() {
|
|
|
10660
10732
|
];
|
|
10661
10733
|
}
|
|
10662
10734
|
const daemonRes = { label: "docker daemon", status: "ok", detail: "reachable" };
|
|
10663
|
-
const mod = await import("./dist-
|
|
10735
|
+
const mod = await import("./dist-EKSNZHDY.js");
|
|
10664
10736
|
let imgRes;
|
|
10665
10737
|
try {
|
|
10666
10738
|
const img = await mod.imageInfo(mod.DEFAULT_BOX_IMAGE);
|
|
@@ -10691,7 +10763,7 @@ async function dockerChecks() {
|
|
|
10691
10763
|
}
|
|
10692
10764
|
async function daytonaChecks() {
|
|
10693
10765
|
try {
|
|
10694
|
-
const mod = await import("./dist-
|
|
10766
|
+
const mod = await import("./dist-FTCDWRAL.js");
|
|
10695
10767
|
const status = await mod.getDaytonaStatus();
|
|
10696
10768
|
if (!status.configured) {
|
|
10697
10769
|
return [
|
|
@@ -10727,7 +10799,7 @@ async function daytonaChecks() {
|
|
|
10727
10799
|
}
|
|
10728
10800
|
async function hetznerChecks() {
|
|
10729
10801
|
try {
|
|
10730
|
-
const mod = await import("./dist-
|
|
10802
|
+
const mod = await import("./dist-PRDYMXCX.js");
|
|
10731
10803
|
const cred = mod.readHetznerCredStatus();
|
|
10732
10804
|
const credRes = cred.source === "none" ? {
|
|
10733
10805
|
label: "credentials",
|
|
@@ -10759,7 +10831,7 @@ async function hetznerChecks() {
|
|
|
10759
10831
|
}
|
|
10760
10832
|
async function vercelChecks() {
|
|
10761
10833
|
try {
|
|
10762
|
-
const mod = await import("./dist-
|
|
10834
|
+
const mod = await import("./dist-VQSZVBT3.js");
|
|
10763
10835
|
const cred = mod.readVercelCredStatus();
|
|
10764
10836
|
const credRes = cred.auth === "none" ? {
|
|
10765
10837
|
label: "credentials",
|
|
@@ -10795,7 +10867,7 @@ async function vercelChecks() {
|
|
|
10795
10867
|
}
|
|
10796
10868
|
async function e2bChecks() {
|
|
10797
10869
|
try {
|
|
10798
|
-
const mod = await import("./dist-
|
|
10870
|
+
const mod = await import("./dist-U2BHTWG4.js");
|
|
10799
10871
|
const cred = mod.readE2bCredStatus();
|
|
10800
10872
|
const credRes = cred.auth === "none" ? {
|
|
10801
10873
|
label: "credentials",
|
|
@@ -11126,7 +11198,7 @@ async function maybePromptStar(opts) {
|
|
|
11126
11198
|
}
|
|
11127
11199
|
|
|
11128
11200
|
// src/commands/install-cmux.ts
|
|
11129
|
-
import { intro as intro7, log as
|
|
11201
|
+
import { intro as intro7, log as log34, note as note2, outro as outro6 } from "@clack/prompts";
|
|
11130
11202
|
import { Command as Command27 } from "commander";
|
|
11131
11203
|
import { existsSync as existsSync8, mkdirSync as mkdirSync6, readFileSync as readFileSync2, renameSync as renameSync2, writeFileSync as writeFileSync5 } from "fs";
|
|
11132
11204
|
import { homedir as homedir16 } from "os";
|
|
@@ -11172,7 +11244,7 @@ var installCmuxCommand = new Command27("cmux").description(
|
|
|
11172
11244
|
if (parsed && typeof parsed === "object") doc = parsed;
|
|
11173
11245
|
} catch {
|
|
11174
11246
|
if (!opts.force) {
|
|
11175
|
-
|
|
11247
|
+
log34.error(
|
|
11176
11248
|
`existing dock config is not valid JSON: ${dockPath}
|
|
11177
11249
|
fix it by hand, or pass --force to back it up and write a fresh one`
|
|
11178
11250
|
);
|
|
@@ -11180,7 +11252,7 @@ fix it by hand, or pass --force to back it up and write a fresh one`
|
|
|
11180
11252
|
}
|
|
11181
11253
|
if (!opts.dryRun) {
|
|
11182
11254
|
renameSync2(dockPath, dockPath + ".bak");
|
|
11183
|
-
|
|
11255
|
+
log34.warn(`backed up unparseable dock config to ${dockPath}.bak`);
|
|
11184
11256
|
}
|
|
11185
11257
|
doc = { controls: [] };
|
|
11186
11258
|
}
|
|
@@ -11209,7 +11281,7 @@ To see it:
|
|
|
11209
11281
|
});
|
|
11210
11282
|
|
|
11211
11283
|
// src/commands/install-herdr.ts
|
|
11212
|
-
import { intro as intro8, log as
|
|
11284
|
+
import { intro as intro8, log as log35, note as note3, outro as outro7 } from "@clack/prompts";
|
|
11213
11285
|
import { Command as Command28, Option } from "commander";
|
|
11214
11286
|
import { spawnSync as spawnSync4 } from "child_process";
|
|
11215
11287
|
import { chmodSync, existsSync as existsSync9, mkdirSync as mkdirSync7, readFileSync as readFileSync3, writeFileSync as writeFileSync6 } from "fs";
|
|
@@ -11404,7 +11476,7 @@ ${herdrKeybindingsBlock()}
|
|
|
11404
11476
|
if (linked.status === 0) {
|
|
11405
11477
|
spawnSync4(bin, ["server", "reload-config"], { stdio: "ignore" });
|
|
11406
11478
|
} else {
|
|
11407
|
-
|
|
11479
|
+
log35.warn(
|
|
11408
11480
|
`could not run \`${bin} plugin link\` (is Herdr installed / running?).
|
|
11409
11481
|
Run it yourself: herdr plugin link ${dir} && herdr server reload-config`
|
|
11410
11482
|
);
|
|
@@ -11502,7 +11574,6 @@ function installTargets() {
|
|
|
11502
11574
|
const home = homedir18();
|
|
11503
11575
|
const claudeSkills = join21(home, ".claude", "skills");
|
|
11504
11576
|
return [
|
|
11505
|
-
{ src: join21("agentbox", "SKILL.md"), dest: join21(claudeSkills, "agentbox", "SKILL.md") },
|
|
11506
11577
|
{
|
|
11507
11578
|
src: join21("agentbox-info", "SKILL.md"),
|
|
11508
11579
|
dest: join21(claudeSkills, "agentbox-info", "SKILL.md")
|
|
@@ -11593,6 +11664,65 @@ function installHostSkills(opts = {}) {
|
|
|
11593
11664
|
}
|
|
11594
11665
|
return { written, skipped, blocked };
|
|
11595
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
|
+
}
|
|
11596
11726
|
var PROVIDER_HINTS = {
|
|
11597
11727
|
docker: "builds a ~1GB local image; no login needed",
|
|
11598
11728
|
hetzner: "paste an API token from the Hetzner Console",
|
|
@@ -11617,7 +11747,7 @@ function ensureTty() {
|
|
|
11617
11747
|
async function runProviderLogin(name) {
|
|
11618
11748
|
if (name === "docker") return true;
|
|
11619
11749
|
if (name === "daytona") {
|
|
11620
|
-
const mod2 = await import("./dist-
|
|
11750
|
+
const mod2 = await import("./dist-FTCDWRAL.js");
|
|
11621
11751
|
const status2 = await mod2.getDaytonaStatus();
|
|
11622
11752
|
if (status2.configured) {
|
|
11623
11753
|
prompt_exports.log.info("daytona: already configured");
|
|
@@ -11629,7 +11759,7 @@ async function runProviderLogin(name) {
|
|
|
11629
11759
|
return true;
|
|
11630
11760
|
}
|
|
11631
11761
|
if (name === "hetzner") {
|
|
11632
|
-
const mod2 = await import("./dist-
|
|
11762
|
+
const mod2 = await import("./dist-PRDYMXCX.js");
|
|
11633
11763
|
const status2 = mod2.readHetznerCredStatus();
|
|
11634
11764
|
if (status2.source !== "none") {
|
|
11635
11765
|
prompt_exports.log.info("hetzner: already configured");
|
|
@@ -11641,7 +11771,7 @@ async function runProviderLogin(name) {
|
|
|
11641
11771
|
return true;
|
|
11642
11772
|
}
|
|
11643
11773
|
if (name === "vercel") {
|
|
11644
|
-
const mod2 = await import("./dist-
|
|
11774
|
+
const mod2 = await import("./dist-VQSZVBT3.js");
|
|
11645
11775
|
const status2 = mod2.readVercelCredStatus();
|
|
11646
11776
|
if (status2.auth !== "none") {
|
|
11647
11777
|
prompt_exports.log.info(`vercel: already configured (${status2.auth})`);
|
|
@@ -11652,7 +11782,7 @@ async function runProviderLogin(name) {
|
|
|
11652
11782
|
await mod2.ensureVercelCredentials();
|
|
11653
11783
|
return true;
|
|
11654
11784
|
}
|
|
11655
|
-
const mod = await import("./dist-
|
|
11785
|
+
const mod = await import("./dist-U2BHTWG4.js");
|
|
11656
11786
|
const status = mod.readE2bCredStatus();
|
|
11657
11787
|
if (status.auth !== "none") {
|
|
11658
11788
|
prompt_exports.log.info(`e2b: already configured (${status.auth})`);
|
|
@@ -11727,8 +11857,7 @@ async function runInstallWizard(opts = {}) {
|
|
|
11727
11857
|
await runPrepare(providerName, {
|
|
11728
11858
|
cwd: process.cwd(),
|
|
11729
11859
|
yes: true,
|
|
11730
|
-
suppressStatus: true
|
|
11731
|
-
suppressTip: true
|
|
11860
|
+
suppressStatus: true
|
|
11732
11861
|
});
|
|
11733
11862
|
} catch (err) {
|
|
11734
11863
|
prompt_exports.log.warn(
|
|
@@ -11742,17 +11871,20 @@ async function runInstallWizard(opts = {}) {
|
|
|
11742
11871
|
}
|
|
11743
11872
|
const sp = (0, prompt_exports.spinner)();
|
|
11744
11873
|
sp.start("installing host /agentbox skill\u2026");
|
|
11745
|
-
let skillRes;
|
|
11746
11874
|
try {
|
|
11747
|
-
skillRes = installHostSkills({ force: opts.force, dryRun: opts.dryRun, quiet: true });
|
|
11748
|
-
|
|
11749
|
-
|
|
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`);
|
|
11750
11881
|
} else {
|
|
11751
|
-
sp.stop(`Agentbox Skills: nothing to write (${String(
|
|
11882
|
+
sp.stop(`Agentbox Skills: nothing to write (${String(skipped)} skipped)`);
|
|
11752
11883
|
}
|
|
11753
|
-
|
|
11884
|
+
const blocked = [...skillRes.blocked, ...forkRes.blocked];
|
|
11885
|
+
if (blocked.length > 0) {
|
|
11754
11886
|
prompt_exports.log.warn(
|
|
11755
|
-
`user-modified host skill file(s) left in place: ${
|
|
11887
|
+
`user-modified host skill file(s) left in place: ${blocked.join(", ")}
|
|
11756
11888
|
pass \`agentbox install --skills-only --force\` to overwrite`
|
|
11757
11889
|
);
|
|
11758
11890
|
}
|
|
@@ -11782,23 +11914,27 @@ var installCommand = new Command29("install").description(
|
|
|
11782
11914
|
if (opts.skillsOnly) {
|
|
11783
11915
|
(0, prompt_exports.intro)("Installing AgentBox host commands...");
|
|
11784
11916
|
let res;
|
|
11917
|
+
let forkRes;
|
|
11785
11918
|
try {
|
|
11786
11919
|
res = installHostSkills({ force: opts.force, dryRun: opts.dryRun });
|
|
11920
|
+
forkRes = await installForkSkill({ force: opts.force, dryRun: opts.dryRun });
|
|
11787
11921
|
} catch (err) {
|
|
11788
11922
|
prompt_exports.log.error(err instanceof Error ? err.message : String(err));
|
|
11789
11923
|
process.exit(1);
|
|
11790
11924
|
}
|
|
11925
|
+
const written = [...res.written, ...forkRes.written];
|
|
11926
|
+
const skipped = res.skipped + forkRes.skipped;
|
|
11791
11927
|
if (opts.dryRun) {
|
|
11792
11928
|
(0, prompt_exports.outro)(
|
|
11793
|
-
`dry-run: ${String(
|
|
11929
|
+
`dry-run: ${String(written.length)} file(s) would be written, ${String(skipped)} skipped`
|
|
11794
11930
|
);
|
|
11795
11931
|
return;
|
|
11796
11932
|
}
|
|
11797
|
-
if (
|
|
11798
|
-
(0, prompt_exports.outro)(`nothing installed (${String(
|
|
11933
|
+
if (written.length === 0) {
|
|
11934
|
+
(0, prompt_exports.outro)(`nothing installed (${String(skipped)} skipped)`);
|
|
11799
11935
|
return;
|
|
11800
11936
|
}
|
|
11801
|
-
(0, prompt_exports.outro)(`installed: ${
|
|
11937
|
+
(0, prompt_exports.outro)(`installed: ${written.join(", ")}`);
|
|
11802
11938
|
return;
|
|
11803
11939
|
}
|
|
11804
11940
|
const ok = await runInstallWizard({
|
|
@@ -12021,7 +12157,7 @@ for (const op of GH_PR_OPS) {
|
|
|
12021
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);
|
|
12022
12158
|
|
|
12023
12159
|
// src/commands/list.ts
|
|
12024
|
-
import { log as
|
|
12160
|
+
import { log as log37 } from "@clack/prompts";
|
|
12025
12161
|
import { Command as Command32 } from "commander";
|
|
12026
12162
|
import { pathToFileURL } from "url";
|
|
12027
12163
|
|
|
@@ -12389,7 +12525,7 @@ var listCommand2 = withWatchOptions(
|
|
|
12389
12525
|
)
|
|
12390
12526
|
).action(async (opts) => {
|
|
12391
12527
|
if (opts.json && opts.watch) {
|
|
12392
|
-
|
|
12528
|
+
log37.error("cannot combine --json with --watch");
|
|
12393
12529
|
process.exit(2);
|
|
12394
12530
|
}
|
|
12395
12531
|
const all = opts.global ?? false;
|
|
@@ -12434,7 +12570,7 @@ var listCommand2 = withWatchOptions(
|
|
|
12434
12570
|
});
|
|
12435
12571
|
|
|
12436
12572
|
// src/commands/logs.ts
|
|
12437
|
-
import { log as
|
|
12573
|
+
import { log as log38 } from "@clack/prompts";
|
|
12438
12574
|
import { Command as Command33 } from "commander";
|
|
12439
12575
|
import { spawn as spawn3 } from "child_process";
|
|
12440
12576
|
var DAEMON_LOG_PATH = "/var/log/agentbox/ctl-daemon.log";
|
|
@@ -12456,9 +12592,9 @@ var logsCommand = new Command33("logs").description("Print recent log lines from
|
|
|
12456
12592
|
service = boxArg;
|
|
12457
12593
|
}
|
|
12458
12594
|
if (!service && !opts.daemon) {
|
|
12459
|
-
|
|
12460
|
-
|
|
12461
|
-
|
|
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]");
|
|
12462
12598
|
process.exit(2);
|
|
12463
12599
|
}
|
|
12464
12600
|
const box = await resolveBoxOrExit(idOrName);
|
|
@@ -12469,7 +12605,7 @@ var logsCommand = new Command33("logs").description("Print recent log lines from
|
|
|
12469
12605
|
if (!opts.follow) {
|
|
12470
12606
|
const proc = await provider.exec(box, args, { user: "vscode" });
|
|
12471
12607
|
if (proc.exitCode !== 0) {
|
|
12472
|
-
|
|
12608
|
+
log38.error(
|
|
12473
12609
|
`${opts.daemon ? "daemon log" : "agentbox-ctl logs"} failed: ${proc.stderr || proc.stdout}`
|
|
12474
12610
|
);
|
|
12475
12611
|
process.exit(1);
|
|
@@ -12525,8 +12661,8 @@ var logsCommand = new Command33("logs").description("Print recent log lines from
|
|
|
12525
12661
|
});
|
|
12526
12662
|
|
|
12527
12663
|
// src/commands/open.ts
|
|
12528
|
-
import { log as
|
|
12529
|
-
import { execa as
|
|
12664
|
+
import { log as log39 } from "@clack/prompts";
|
|
12665
|
+
import { execa as execa6 } from "execa";
|
|
12530
12666
|
import { existsSync as existsSync11, mkdirSync as mkdirSync9 } from "fs";
|
|
12531
12667
|
import { homedir as homedir19 } from "os";
|
|
12532
12668
|
import { join as join22 } from "path";
|
|
@@ -12631,11 +12767,11 @@ async function runCloudOpen(box, provider, opts) {
|
|
|
12631
12767
|
if (!existsSync11(mountRoot)) {
|
|
12632
12768
|
mkdirSync9(mountRoot, { recursive: true, mode: 493 });
|
|
12633
12769
|
} else if (await isMounted(mountRoot)) {
|
|
12634
|
-
|
|
12770
|
+
log39.info(`re-mounting (stale mount detected at ${mountRoot})`);
|
|
12635
12771
|
await tryUnmount(mountRoot);
|
|
12636
12772
|
}
|
|
12637
|
-
|
|
12638
|
-
const mount = await
|
|
12773
|
+
log39.info(`mounting ${alias}:/workspace at ${mountRoot}`);
|
|
12774
|
+
const mount = await execa6(
|
|
12639
12775
|
sshfsBin,
|
|
12640
12776
|
[
|
|
12641
12777
|
`${alias}:/workspace`,
|
|
@@ -12654,27 +12790,27 @@ async function runCloudOpen(box, provider, opts) {
|
|
|
12654
12790
|
if (mount.exitCode !== 0) {
|
|
12655
12791
|
throw new Error(`sshfs mount failed (exit ${String(mount.exitCode)}): ${mount.stderr || mount.stdout}`);
|
|
12656
12792
|
}
|
|
12657
|
-
await
|
|
12793
|
+
await execa6(hostOpenCommand(), [mountRoot], { reject: false });
|
|
12658
12794
|
process.stdout.write(`opened ${mountRoot}
|
|
12659
12795
|
`);
|
|
12660
12796
|
process.stdout.write(`unmount later with: agentbox open ${box.name} --unmount
|
|
12661
12797
|
`);
|
|
12662
12798
|
}
|
|
12663
12799
|
async function locateBinary(name) {
|
|
12664
|
-
const r = await
|
|
12800
|
+
const r = await execa6("which", [name], { reject: false });
|
|
12665
12801
|
if (r.exitCode !== 0) return null;
|
|
12666
12802
|
const path = (r.stdout ?? "").trim();
|
|
12667
12803
|
return path.length > 0 ? path : null;
|
|
12668
12804
|
}
|
|
12669
12805
|
async function isMounted(path) {
|
|
12670
|
-
const r = await
|
|
12806
|
+
const r = await execa6("sh", ["-c", `mount | grep -F " on ${path} "`], { reject: false });
|
|
12671
12807
|
return r.exitCode === 0;
|
|
12672
12808
|
}
|
|
12673
12809
|
async function tryUnmount(path) {
|
|
12674
12810
|
if (await isMounted(path)) {
|
|
12675
|
-
const u = await
|
|
12811
|
+
const u = await execa6("umount", [path], { reject: false });
|
|
12676
12812
|
if (u.exitCode === 0) return true;
|
|
12677
|
-
const d = await
|
|
12813
|
+
const d = await execa6("diskutil", ["unmount", path], { reject: false });
|
|
12678
12814
|
return d.exitCode === 0;
|
|
12679
12815
|
}
|
|
12680
12816
|
return false;
|
|
@@ -12865,7 +13001,7 @@ async function pruneCloud(provider, opts) {
|
|
|
12865
13001
|
|
|
12866
13002
|
// src/commands/queue.ts
|
|
12867
13003
|
import { readFile as readFile6, stat as stat6 } from "fs/promises";
|
|
12868
|
-
import { intro as intro10, log as
|
|
13004
|
+
import { intro as intro10, log as log41, outro as outro9 } from "@clack/prompts";
|
|
12869
13005
|
import { Command as Command37 } from "commander";
|
|
12870
13006
|
var TERMINAL_STATUSES = /* @__PURE__ */ new Set(["done", "failed", "cancelled"]);
|
|
12871
13007
|
var queueCommand = new Command37("queue").description("Inspect and manage background `agentbox claude|codex|opencode -i` jobs");
|
|
@@ -12874,8 +13010,8 @@ var queueListCommand = new Command37("list").description("List queued, running,
|
|
|
12874
13010
|
const cfg = await loadQueueConfig();
|
|
12875
13011
|
const visible = opts.all === true ? jobs : jobs.filter((j) => !TERMINAL_STATUSES.has(j.status));
|
|
12876
13012
|
if (visible.length === 0) {
|
|
12877
|
-
|
|
12878
|
-
|
|
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)})`);
|
|
12879
13015
|
return;
|
|
12880
13016
|
}
|
|
12881
13017
|
const rows = visible.map((j) => ({
|
|
@@ -12900,12 +13036,12 @@ var queueListCommand = new Command37("list").description("List queued, running,
|
|
|
12900
13036
|
headers.map((h, i) => pad4(String(r[h]), widths[i])).join(" ") + "\n"
|
|
12901
13037
|
);
|
|
12902
13038
|
}
|
|
12903
|
-
|
|
13039
|
+
log41.info(`queue.maxConcurrent = ${String(cfg.maxConcurrent)} (queue.enabled=${String(cfg.enabled)})`);
|
|
12904
13040
|
});
|
|
12905
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) => {
|
|
12906
13042
|
const job = await readJob(id);
|
|
12907
13043
|
if (!job) {
|
|
12908
|
-
|
|
13044
|
+
log41.error(`no job with id ${id}`);
|
|
12909
13045
|
process.exit(1);
|
|
12910
13046
|
}
|
|
12911
13047
|
process.stdout.write(JSON.stringify(job, null, 2) + "\n");
|
|
@@ -12921,18 +13057,18 @@ var queueShowCommand = new Command37("show").description("Dump a job manifest an
|
|
|
12921
13057
|
process.stdout.write(slice.join("\n"));
|
|
12922
13058
|
if (!slice.join("\n").endsWith("\n")) process.stdout.write("\n");
|
|
12923
13059
|
} catch {
|
|
12924
|
-
|
|
13060
|
+
log41.info(`(no log at ${job.logPath} yet)`);
|
|
12925
13061
|
}
|
|
12926
13062
|
});
|
|
12927
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) => {
|
|
12928
13064
|
intro10(`Cancelling queue job ${id}...`);
|
|
12929
13065
|
const job = await readJob(id);
|
|
12930
13066
|
if (!job) {
|
|
12931
|
-
|
|
13067
|
+
log41.error(`no job with id ${id}`);
|
|
12932
13068
|
process.exit(1);
|
|
12933
13069
|
}
|
|
12934
13070
|
if (job.status !== "queued") {
|
|
12935
|
-
|
|
13071
|
+
log41.error(
|
|
12936
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.` : "")
|
|
12937
13073
|
);
|
|
12938
13074
|
process.exit(1);
|
|
@@ -12952,7 +13088,7 @@ var queueClearCommand = new Command37("clear").description("Sweep terminal-state
|
|
|
12952
13088
|
if (opts.all === true || opts.failed === true) targets.add("failed");
|
|
12953
13089
|
if (opts.all === true || opts.cancelled === true) targets.add("cancelled");
|
|
12954
13090
|
if (targets.size === 0) {
|
|
12955
|
-
|
|
13091
|
+
log41.error("pick at least one of: --done, --failed, --cancelled, --all");
|
|
12956
13092
|
process.exit(2);
|
|
12957
13093
|
}
|
|
12958
13094
|
const jobs = await loadQueue();
|
|
@@ -12962,7 +13098,7 @@ var queueClearCommand = new Command37("clear").description("Sweep terminal-state
|
|
|
12962
13098
|
await deleteJob(j.id);
|
|
12963
13099
|
removed += 1;
|
|
12964
13100
|
}
|
|
12965
|
-
|
|
13101
|
+
log41.success(`removed ${String(removed)} manifest${removed === 1 ? "" : "s"}`);
|
|
12966
13102
|
});
|
|
12967
13103
|
var QUEUE_WAIT_EVENTS = [
|
|
12968
13104
|
"new-box",
|
|
@@ -12979,7 +13115,7 @@ var queueWaitForCommand = new Command37("wait-for").description(
|
|
|
12979
13115
|
`Block until a queue / box event fires. <event> one of: ${QUEUE_WAIT_EVENTS.join(" | ")}.`
|
|
12980
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) => {
|
|
12981
13117
|
if (!QUEUE_WAIT_EVENTS.includes(eventRaw)) {
|
|
12982
|
-
|
|
13118
|
+
log41.error(`unknown event '${eventRaw}' (one of: ${QUEUE_WAIT_EVENTS.join(", ")})`);
|
|
12983
13119
|
process.exit(2);
|
|
12984
13120
|
}
|
|
12985
13121
|
const event = eventRaw;
|
|
@@ -12999,11 +13135,11 @@ var queueWaitForCommand = new Command37("wait-for").description(
|
|
|
12999
13135
|
if (opts.json === true) {
|
|
13000
13136
|
process.stdout.write(JSON.stringify({ matched: false, event, elapsedMs }) + "\n");
|
|
13001
13137
|
} else {
|
|
13002
|
-
|
|
13138
|
+
log41.error(`'${event}' did not occur within ${String(timeoutMs)}ms`);
|
|
13003
13139
|
}
|
|
13004
13140
|
process.exit(1);
|
|
13005
13141
|
}
|
|
13006
|
-
|
|
13142
|
+
log41.error(err instanceof Error ? err.message : String(err));
|
|
13007
13143
|
process.exit(1);
|
|
13008
13144
|
}
|
|
13009
13145
|
});
|
|
@@ -13100,7 +13236,7 @@ function truncate(s, max) {
|
|
|
13100
13236
|
}
|
|
13101
13237
|
|
|
13102
13238
|
// src/commands/relay.ts
|
|
13103
|
-
import { log as
|
|
13239
|
+
import { log as log42, spinner as spinner9 } from "@clack/prompts";
|
|
13104
13240
|
import { Command as Command38 } from "commander";
|
|
13105
13241
|
async function rehydrateFromState() {
|
|
13106
13242
|
const state = await readState();
|
|
@@ -13195,7 +13331,7 @@ var restartSub = new Command38("restart").description("Stop then start the host
|
|
|
13195
13331
|
s2.stop(`relay running on ${ep.hostUrl}`);
|
|
13196
13332
|
} catch (err) {
|
|
13197
13333
|
s2.stop("relay start failed");
|
|
13198
|
-
|
|
13334
|
+
log42.warn(err instanceof Error ? err.message : String(err));
|
|
13199
13335
|
throw err;
|
|
13200
13336
|
}
|
|
13201
13337
|
} catch (err) {
|
|
@@ -13207,23 +13343,23 @@ var relayCommand = new Command38("relay").description("Manage the host relay pro
|
|
|
13207
13343
|
// src/commands/_run-queued-job.ts
|
|
13208
13344
|
import { Command as Command39 } from "commander";
|
|
13209
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) => {
|
|
13210
|
-
const
|
|
13211
|
-
|
|
13346
|
+
const log51 = openCommandLog(`queue-${id}`);
|
|
13347
|
+
log51.write(`worker pid=${String(process.pid)} starting for job ${id}`);
|
|
13212
13348
|
let job = null;
|
|
13213
13349
|
try {
|
|
13214
13350
|
job = await readJob(id);
|
|
13215
13351
|
if (!job) {
|
|
13216
|
-
|
|
13217
|
-
|
|
13352
|
+
log51.write(`FATAL: no manifest at id=${id}`);
|
|
13353
|
+
log51.close();
|
|
13218
13354
|
process.exit(64);
|
|
13219
13355
|
}
|
|
13220
13356
|
const onBoxCreated = (boxId) => {
|
|
13221
13357
|
if (job) job = { ...job, boxId };
|
|
13222
13358
|
};
|
|
13223
13359
|
if ((job.providerName || "docker") === "docker") {
|
|
13224
|
-
await runDockerJob(job,
|
|
13360
|
+
await runDockerJob(job, log51, onBoxCreated);
|
|
13225
13361
|
} else {
|
|
13226
|
-
await runCloudJob(job,
|
|
13362
|
+
await runCloudJob(job, log51, onBoxCreated);
|
|
13227
13363
|
}
|
|
13228
13364
|
const done = {
|
|
13229
13365
|
...job,
|
|
@@ -13232,12 +13368,12 @@ var runQueuedJobCommand = new Command39("_run-queued-job").description("internal
|
|
|
13232
13368
|
exitCode: 0
|
|
13233
13369
|
};
|
|
13234
13370
|
await writeJob(done);
|
|
13235
|
-
|
|
13236
|
-
|
|
13371
|
+
log51.write(`done`);
|
|
13372
|
+
log51.close();
|
|
13237
13373
|
process.exit(0);
|
|
13238
13374
|
} catch (err) {
|
|
13239
13375
|
const msg = err instanceof Error ? err.stack ?? err.message : String(err);
|
|
13240
|
-
|
|
13376
|
+
log51.write(`FAIL: ${msg}`);
|
|
13241
13377
|
if (job) {
|
|
13242
13378
|
try {
|
|
13243
13379
|
const failed = {
|
|
@@ -13251,11 +13387,11 @@ var runQueuedJobCommand = new Command39("_run-queued-job").description("internal
|
|
|
13251
13387
|
} catch {
|
|
13252
13388
|
}
|
|
13253
13389
|
}
|
|
13254
|
-
|
|
13390
|
+
log51.close();
|
|
13255
13391
|
process.exit(1);
|
|
13256
13392
|
}
|
|
13257
13393
|
});
|
|
13258
|
-
async function runDockerJob(job,
|
|
13394
|
+
async function runDockerJob(job, log51, onBoxCreated) {
|
|
13259
13395
|
const opts = job.createOpts;
|
|
13260
13396
|
const cfg = await loadEffectiveConfig(opts.workspace, {
|
|
13261
13397
|
cliOverrides: buildOverridesFromJob(job)
|
|
@@ -13267,7 +13403,7 @@ async function runDockerJob(job, log50, onBoxCreated) {
|
|
|
13267
13403
|
const useSnapshot = opts.hostSnapshot === false ? false : opts.hostSnapshot === true ? true : cfg.effective.box.hostSnapshot ?? false;
|
|
13268
13404
|
const resolved = job.agent === "claude-code" ? await resolveClaudeAuth(process.env) : null;
|
|
13269
13405
|
const withPlaywright = cfg.effective.box.withPlaywright || cfg.effective.browser.default !== "agent-browser";
|
|
13270
|
-
|
|
13406
|
+
log51.write(`creating box for agent=${job.agent}`);
|
|
13271
13407
|
const result = await createBox({
|
|
13272
13408
|
workspacePath: opts.workspace,
|
|
13273
13409
|
name: opts.name && opts.name.length > 0 ? opts.name : void 0,
|
|
@@ -13293,22 +13429,22 @@ async function runDockerJob(job, log50, onBoxCreated) {
|
|
|
13293
13429
|
// at box-create time (the worker runs on the host, so it can read the files).
|
|
13294
13430
|
carry: opts.carry,
|
|
13295
13431
|
projectRoot,
|
|
13296
|
-
onLog: (line) =>
|
|
13432
|
+
onLog: (line) => log51.write(line)
|
|
13297
13433
|
});
|
|
13298
|
-
|
|
13434
|
+
log51.write(`box created: ${result.record.container}`);
|
|
13299
13435
|
onBoxCreated(result.record.id);
|
|
13300
13436
|
await writeJob({ ...job, boxId: result.record.id });
|
|
13301
13437
|
const resyncWarning = result.resync ? buildResyncWarning(result.resync) : null;
|
|
13302
|
-
if (resyncWarning)
|
|
13438
|
+
if (resyncWarning) log51.write(resyncWarning);
|
|
13303
13439
|
const prompt = prependResyncWarning(resyncWarning, job.prompt);
|
|
13304
13440
|
const promptedArgs = buildPromptArgs(job.agent, prompt, job.agentArgs);
|
|
13305
13441
|
if (job.agent === "claude-code") {
|
|
13306
|
-
|
|
13442
|
+
log51.write(`checking plugin native deps`);
|
|
13307
13443
|
await rebuildPluginNativeDeps(result.record.container, {
|
|
13308
13444
|
volume: result.record.claudeConfigVolume ?? SHARED_CLAUDE_VOLUME,
|
|
13309
|
-
onProgress: (line) =>
|
|
13445
|
+
onProgress: (line) => log51.write(line)
|
|
13310
13446
|
});
|
|
13311
|
-
|
|
13447
|
+
log51.write(`starting claude session`);
|
|
13312
13448
|
await startClaudeSession({
|
|
13313
13449
|
container: result.record.container,
|
|
13314
13450
|
claudeArgs: applyClaudeSkipPermissions(promptedArgs, cfg.effective),
|
|
@@ -13316,22 +13452,22 @@ async function runDockerJob(job, log50, onBoxCreated) {
|
|
|
13316
13452
|
boxName: result.record.name
|
|
13317
13453
|
});
|
|
13318
13454
|
} else if (job.agent === "codex") {
|
|
13319
|
-
|
|
13455
|
+
log51.write(`checking codex`);
|
|
13320
13456
|
await ensureCodexInstalled(result.record.container, {
|
|
13321
|
-
onProgress: (line) =>
|
|
13457
|
+
onProgress: (line) => log51.write(line)
|
|
13322
13458
|
});
|
|
13323
|
-
|
|
13459
|
+
log51.write(`starting codex session`);
|
|
13324
13460
|
await startCodexSession({
|
|
13325
13461
|
container: result.record.container,
|
|
13326
13462
|
codexArgs: applyCodexSkipPermissions(promptedArgs, cfg.effective),
|
|
13327
13463
|
sessionName: cfg.effective.codex.sessionName
|
|
13328
13464
|
});
|
|
13329
13465
|
} else if (job.agent === "opencode") {
|
|
13330
|
-
|
|
13466
|
+
log51.write(`checking opencode`);
|
|
13331
13467
|
await ensureOpencodeInstalled(result.record.container, {
|
|
13332
|
-
onProgress: (line) =>
|
|
13468
|
+
onProgress: (line) => log51.write(line)
|
|
13333
13469
|
});
|
|
13334
|
-
|
|
13470
|
+
log51.write(`starting opencode session`);
|
|
13335
13471
|
await startOpencodeSession({
|
|
13336
13472
|
container: result.record.container,
|
|
13337
13473
|
opencodeArgs: promptedArgs,
|
|
@@ -13340,17 +13476,17 @@ async function runDockerJob(job, log50, onBoxCreated) {
|
|
|
13340
13476
|
} else {
|
|
13341
13477
|
throw new Error(`unknown agent kind: ${String(job.agent)}`);
|
|
13342
13478
|
}
|
|
13343
|
-
await maybeOpenQueuedTerminal(job, result.record.name,
|
|
13479
|
+
await maybeOpenQueuedTerminal(job, result.record.name, log51);
|
|
13344
13480
|
}
|
|
13345
13481
|
function agentBinaryName(agent) {
|
|
13346
13482
|
return agent === "claude-code" ? "claude" : agent;
|
|
13347
13483
|
}
|
|
13348
|
-
async function maybeOpenQueuedTerminal(job, boxName,
|
|
13484
|
+
async function maybeOpenQueuedTerminal(job, boxName, log51) {
|
|
13349
13485
|
const ctx = job.openTerminal;
|
|
13350
13486
|
if (!ctx) return;
|
|
13351
13487
|
const cliEntry = process.env["AGENTBOX_CLI_ENTRY"];
|
|
13352
13488
|
if (!cliEntry) {
|
|
13353
|
-
|
|
13489
|
+
log51.write("queue.openIn: AGENTBOX_CLI_ENTRY unset; cannot open terminal");
|
|
13354
13490
|
return;
|
|
13355
13491
|
}
|
|
13356
13492
|
const argv2 = [
|
|
@@ -13364,14 +13500,14 @@ async function maybeOpenQueuedTerminal(job, boxName, log50) {
|
|
|
13364
13500
|
];
|
|
13365
13501
|
try {
|
|
13366
13502
|
const r = await spawnQueuedOpenTerminal(ctx, argv2, boxName);
|
|
13367
|
-
|
|
13503
|
+
log51.write(
|
|
13368
13504
|
r.launched ? `queue.openIn: ${r.note}` : `queue.openIn: open failed: ${r.error ?? ""}`
|
|
13369
13505
|
);
|
|
13370
13506
|
} catch (err) {
|
|
13371
|
-
|
|
13507
|
+
log51.write(`queue.openIn: open threw: ${err instanceof Error ? err.message : String(err)}`);
|
|
13372
13508
|
}
|
|
13373
13509
|
}
|
|
13374
|
-
async function runCloudJob(job,
|
|
13510
|
+
async function runCloudJob(job, log51, onBoxCreated) {
|
|
13375
13511
|
const opts = job.createOpts;
|
|
13376
13512
|
const cfg = await loadEffectiveConfig(opts.workspace, {
|
|
13377
13513
|
cliOverrides: buildOverridesFromJob(job)
|
|
@@ -13382,7 +13518,7 @@ async function runCloudJob(job, log50, onBoxCreated) {
|
|
|
13382
13518
|
const providerDefault = resolveDefaultCheckpoint(cfg.effective, providerName);
|
|
13383
13519
|
const checkpointRef = opts.snapshot && opts.snapshot.length > 0 ? opts.snapshot : providerDefault.length > 0 ? providerDefault : void 0;
|
|
13384
13520
|
const withPlaywright = cfg.effective.box.withPlaywright || cfg.effective.browser.default !== "agent-browser";
|
|
13385
|
-
|
|
13521
|
+
log51.write(`creating cloud box (${providerName}) for agent=${job.agent}`);
|
|
13386
13522
|
const result = await provider.create({
|
|
13387
13523
|
workspacePath: opts.workspace,
|
|
13388
13524
|
name: opts.name && opts.name.length > 0 ? opts.name : void 0,
|
|
@@ -13396,9 +13532,9 @@ async function runCloudJob(job, log50, onBoxCreated) {
|
|
|
13396
13532
|
// worker runs on the host too, so it reads the files and uploads them.
|
|
13397
13533
|
carry: opts.carry,
|
|
13398
13534
|
projectRoot,
|
|
13399
|
-
onLog: (line) =>
|
|
13535
|
+
onLog: (line) => log51.write(line)
|
|
13400
13536
|
});
|
|
13401
|
-
|
|
13537
|
+
log51.write(`box created: ${result.record.id}`);
|
|
13402
13538
|
onBoxCreated(result.record.id);
|
|
13403
13539
|
await writeJob({ ...job, boxId: result.record.id });
|
|
13404
13540
|
const promptedArgs = buildPromptArgs(job.agent, job.prompt, job.agentArgs);
|
|
@@ -13420,14 +13556,14 @@ async function runCloudJob(job, log50, onBoxCreated) {
|
|
|
13420
13556
|
} else {
|
|
13421
13557
|
throw new Error(`unknown agent kind: ${String(job.agent)}`);
|
|
13422
13558
|
}
|
|
13423
|
-
|
|
13559
|
+
log51.write(`starting detached ${job.agent} session`);
|
|
13424
13560
|
await cloudAgentStartDetached({
|
|
13425
13561
|
box: result.record,
|
|
13426
13562
|
binary,
|
|
13427
13563
|
sessionName,
|
|
13428
13564
|
extraArgs
|
|
13429
13565
|
});
|
|
13430
|
-
await maybeOpenQueuedTerminal(job, result.record.name,
|
|
13566
|
+
await maybeOpenQueuedTerminal(job, result.record.name, log51);
|
|
13431
13567
|
}
|
|
13432
13568
|
function buildOverridesFromJob(job) {
|
|
13433
13569
|
const opts = job.createOpts;
|
|
@@ -13534,7 +13670,7 @@ var herdrCommand = new Command40("herdr").description("Internal: Herdr plugin en
|
|
|
13534
13670
|
|
|
13535
13671
|
// src/commands/screen.ts
|
|
13536
13672
|
import { spawnSync as spawnSync6 } from "child_process";
|
|
13537
|
-
import { log as
|
|
13673
|
+
import { log as log43 } from "@clack/prompts";
|
|
13538
13674
|
import { Command as Command41 } from "commander";
|
|
13539
13675
|
var SIGNED_URL_TTL_MIN = 1;
|
|
13540
13676
|
var SIGNED_URL_TTL_MAX = 86400;
|
|
@@ -13565,10 +13701,10 @@ var screenCommand = new Command41("screen").description("Open a box's VNC (noVNC
|
|
|
13565
13701
|
if (provider === "docker") {
|
|
13566
13702
|
const insp = await inspectBox(box.id);
|
|
13567
13703
|
if (insp.state === "paused") {
|
|
13568
|
-
|
|
13704
|
+
log43.info("box is paused; unpausing");
|
|
13569
13705
|
await unpauseBox(box.id);
|
|
13570
13706
|
} else if (insp.state === "stopped") {
|
|
13571
|
-
|
|
13707
|
+
log43.info("box is stopped; starting");
|
|
13572
13708
|
await startBox(box.id);
|
|
13573
13709
|
} else if (insp.state === "missing") {
|
|
13574
13710
|
throw new Error(`box ${box.name} has no container; was it destroyed?`);
|
|
@@ -13578,13 +13714,13 @@ var screenCommand = new Command41("screen").description("Open a box's VNC (noVNC
|
|
|
13578
13714
|
const inBoxUrl = exposePort !== void 0 ? box.portlessUrl ?? `http://localhost:${String(exposePort)}` : "about:blank";
|
|
13579
13715
|
const br = await ensureBoxBrowser(box.container, void 0, inBoxUrl);
|
|
13580
13716
|
if (br.up && !br.alreadyRunning) {
|
|
13581
|
-
|
|
13717
|
+
log43.info(
|
|
13582
13718
|
exposePort !== void 0 ? `opened ${inBoxUrl} in the in-box browser (visible in the VNC view)` : "started in-box browser"
|
|
13583
13719
|
);
|
|
13584
13720
|
} else if (br.alreadyRunning) {
|
|
13585
|
-
|
|
13721
|
+
log43.info("in-box browser already running; left it untouched");
|
|
13586
13722
|
} else {
|
|
13587
|
-
|
|
13723
|
+
log43.warn(`could not start in-box browser: ${br.reason ?? "unknown"}`);
|
|
13588
13724
|
}
|
|
13589
13725
|
const engine = await detectEngine();
|
|
13590
13726
|
const urls = buildVncUrls(box, engine);
|
|
@@ -13605,10 +13741,10 @@ var screenCommand = new Command41("screen").description("Open a box's VNC (noVNC
|
|
|
13605
13741
|
const p = await providerForBox(box);
|
|
13606
13742
|
const state = await p.probeState(box);
|
|
13607
13743
|
if (state === "paused") {
|
|
13608
|
-
|
|
13744
|
+
log43.info("box is paused; resuming");
|
|
13609
13745
|
await p.resume(box);
|
|
13610
13746
|
} else if (state === "stopped") {
|
|
13611
|
-
|
|
13747
|
+
log43.info("box is stopped; starting");
|
|
13612
13748
|
await p.start(box);
|
|
13613
13749
|
} else if (state === "missing") {
|
|
13614
13750
|
throw new Error(`cloud sandbox for ${box.name} is missing; was it deleted?`);
|
|
@@ -13623,14 +13759,14 @@ var screenCommand = new Command41("screen").description("Open a box's VNC (noVNC
|
|
|
13623
13759
|
user: "vscode"
|
|
13624
13760
|
});
|
|
13625
13761
|
if (br.exitCode === 0) {
|
|
13626
|
-
|
|
13762
|
+
log43.info(`opened ${webUrl} in the in-box browser (visible in the VNC view)`);
|
|
13627
13763
|
} else {
|
|
13628
|
-
|
|
13764
|
+
log43.warn(
|
|
13629
13765
|
`could not open in-box browser (continuing): ${br.stderr.trim() || br.stdout.trim() || `exit ${String(br.exitCode)}`}`
|
|
13630
13766
|
);
|
|
13631
13767
|
}
|
|
13632
13768
|
} catch (err) {
|
|
13633
|
-
|
|
13769
|
+
log43.warn(
|
|
13634
13770
|
`in-box browser skipped: ${err instanceof Error ? err.message : String(err)}`
|
|
13635
13771
|
);
|
|
13636
13772
|
}
|
|
@@ -13656,18 +13792,18 @@ var screenCommand = new Command41("screen").description("Open a box's VNC (noVNC
|
|
|
13656
13792
|
|
|
13657
13793
|
// src/commands/shell.ts
|
|
13658
13794
|
import { spawnSync as spawnSync7 } from "child_process";
|
|
13659
|
-
import { log as
|
|
13795
|
+
import { log as log45 } from "@clack/prompts";
|
|
13660
13796
|
import { Command as Command42 } from "commander";
|
|
13661
13797
|
|
|
13662
13798
|
// src/commands/_provider-guard.ts
|
|
13663
|
-
import { log as
|
|
13799
|
+
import { log as log44 } from "@clack/prompts";
|
|
13664
13800
|
function requireDockerProvider(box, commandName) {
|
|
13665
13801
|
const provider = box.provider ?? "docker";
|
|
13666
13802
|
if (provider === "docker") return;
|
|
13667
|
-
|
|
13803
|
+
log44.error(
|
|
13668
13804
|
`\`agentbox ${commandName}\` doesn't yet support cloud boxes (this box's provider is '${provider}').`
|
|
13669
13805
|
);
|
|
13670
|
-
|
|
13806
|
+
log44.info(
|
|
13671
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."
|
|
13672
13808
|
);
|
|
13673
13809
|
process.exit(2);
|
|
@@ -13709,10 +13845,10 @@ function fmtAgo2(iso) {
|
|
|
13709
13845
|
async function ensureBoxRunning(box) {
|
|
13710
13846
|
const insp = await inspectBox(box.id);
|
|
13711
13847
|
if (insp.state === "paused") {
|
|
13712
|
-
|
|
13848
|
+
log45.info("box is paused; unpausing");
|
|
13713
13849
|
await unpauseBox(box.id);
|
|
13714
13850
|
} else if (insp.state === "stopped") {
|
|
13715
|
-
|
|
13851
|
+
log45.info("box is stopped; starting");
|
|
13716
13852
|
await startBox(box.id);
|
|
13717
13853
|
} else if (insp.state === "missing") {
|
|
13718
13854
|
throw new Error(`box ${box.name} has no container; was it destroyed?`);
|
|
@@ -13751,7 +13887,7 @@ async function startOrAttachShell(box, cfg) {
|
|
|
13751
13887
|
const label = shellLabel(cfg.sessionName);
|
|
13752
13888
|
const info = await shellSessionInfo(box.container, cfg.sessionName, cfg.user);
|
|
13753
13889
|
if (info.running) {
|
|
13754
|
-
|
|
13890
|
+
log45.info(`reattaching to shell "${label}" \u2014 Control+a d to detach`);
|
|
13755
13891
|
} else {
|
|
13756
13892
|
await startShellSession({
|
|
13757
13893
|
container: box.container,
|
|
@@ -13759,7 +13895,7 @@ async function startOrAttachShell(box, cfg) {
|
|
|
13759
13895
|
user: cfg.user,
|
|
13760
13896
|
login: cfg.login
|
|
13761
13897
|
});
|
|
13762
|
-
|
|
13898
|
+
log45.info(`shell "${label}" \u2014 Control+a d to detach, leaves it running`);
|
|
13763
13899
|
}
|
|
13764
13900
|
const code = await runWrappedAttach({
|
|
13765
13901
|
container: box.container,
|
|
@@ -13916,11 +14052,11 @@ var shellLsCommand = new Command42("ls").description("List the shell tmux sessio
|
|
|
13916
14052
|
requireDockerProvider(box, "shell");
|
|
13917
14053
|
const insp = await inspectBox(box.id);
|
|
13918
14054
|
if (insp.state !== "running") {
|
|
13919
|
-
|
|
14055
|
+
log45.info(`box ${box.name} is ${insp.state} \u2014 no live shell sessions`);
|
|
13920
14056
|
return;
|
|
13921
14057
|
}
|
|
13922
14058
|
if (insp.shellSessions.length === 0) {
|
|
13923
|
-
|
|
14059
|
+
log45.info(
|
|
13924
14060
|
`no shell sessions in ${box.name} \u2014 start one with: agentbox shell ${reattachRef2(box)}`
|
|
13925
14061
|
);
|
|
13926
14062
|
return;
|
|
@@ -13940,25 +14076,25 @@ var shellKillCommand = new Command42("kill").description("Kill a shell tmux sess
|
|
|
13940
14076
|
requireDockerProvider(box, "shell");
|
|
13941
14077
|
const insp = await inspectBox(box.id);
|
|
13942
14078
|
if (insp.state !== "running") {
|
|
13943
|
-
|
|
14079
|
+
log45.info(`box ${box.name} is ${insp.state} \u2014 no shell sessions to kill`);
|
|
13944
14080
|
return;
|
|
13945
14081
|
}
|
|
13946
14082
|
if (opts.all) {
|
|
13947
14083
|
if (insp.shellSessions.length === 0) {
|
|
13948
|
-
|
|
14084
|
+
log45.info(`no shell sessions in ${box.name}`);
|
|
13949
14085
|
return;
|
|
13950
14086
|
}
|
|
13951
14087
|
let killed = 0;
|
|
13952
14088
|
for (const s of insp.shellSessions) {
|
|
13953
14089
|
if (await killShellSession(box.container, s.sessionName)) killed++;
|
|
13954
14090
|
}
|
|
13955
|
-
|
|
14091
|
+
log45.success(`killed ${String(killed)} shell session${killed === 1 ? "" : "s"} in ${box.name}`);
|
|
13956
14092
|
return;
|
|
13957
14093
|
}
|
|
13958
14094
|
const target = shellSessionName(opts.name);
|
|
13959
14095
|
const ok = await killShellSession(box.container, target);
|
|
13960
|
-
if (ok)
|
|
13961
|
-
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?)`);
|
|
13962
14098
|
} catch (err) {
|
|
13963
14099
|
handleLifecycleError(err);
|
|
13964
14100
|
}
|
|
@@ -13992,7 +14128,7 @@ var startCommand = new Command43("start").description(
|
|
|
13992
14128
|
});
|
|
13993
14129
|
|
|
13994
14130
|
// src/commands/status.ts
|
|
13995
|
-
import { log as
|
|
14131
|
+
import { log as log47 } from "@clack/prompts";
|
|
13996
14132
|
import { Command as Command44 } from "commander";
|
|
13997
14133
|
|
|
13998
14134
|
// src/endpoints-render.ts
|
|
@@ -14022,8 +14158,61 @@ function renderEndpointLines(endpoints, stream) {
|
|
|
14022
14158
|
return entries.map((e) => ` ${e.name.padEnd(nameWidth)} ${e.value}`);
|
|
14023
14159
|
}
|
|
14024
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
|
+
|
|
14025
14214
|
// src/commands/inspect.ts
|
|
14026
|
-
import { log as
|
|
14215
|
+
import { log as log46 } from "@clack/prompts";
|
|
14027
14216
|
function fmtLimit(n, unit) {
|
|
14028
14217
|
return n && n > 0 ? `${String(n)}${unit}` : "unlimited";
|
|
14029
14218
|
}
|
|
@@ -14065,6 +14254,13 @@ async function renderText(i) {
|
|
|
14065
14254
|
`host export ${i.hostPaths.mergedExport} (run \`agentbox open\` to refresh)`,
|
|
14066
14255
|
`created ${i.record.createdAt}`
|
|
14067
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
|
+
}
|
|
14068
14264
|
return lines.join("\n");
|
|
14069
14265
|
}
|
|
14070
14266
|
function renderCheckpoint(i, sizeBytes) {
|
|
@@ -14147,6 +14343,9 @@ async function renderCloudText(box) {
|
|
|
14147
14343
|
`persisted ${persisted ? `${persisted.timestamp} (${String(persisted.services.length)} svc, ${String(persisted.tasks.length)} tasks, ${String(persisted.ports.length)} ports)` : "(none)"}`,
|
|
14148
14344
|
`created ${box.createdAt}`
|
|
14149
14345
|
];
|
|
14346
|
+
if (persisted) {
|
|
14347
|
+
lines.push("", ...renderPersistedSections(persisted));
|
|
14348
|
+
}
|
|
14150
14349
|
return lines.join("\n");
|
|
14151
14350
|
}
|
|
14152
14351
|
function webPreviewLine(box) {
|
|
@@ -14168,7 +14367,7 @@ function renderCodexActivityCloud(persisted) {
|
|
|
14168
14367
|
async function runInspect(box, opts) {
|
|
14169
14368
|
try {
|
|
14170
14369
|
if (opts.json && opts.watch) {
|
|
14171
|
-
|
|
14370
|
+
log46.error("cannot combine --json with --watch");
|
|
14172
14371
|
process.exit(2);
|
|
14173
14372
|
}
|
|
14174
14373
|
const isCloud = (box.provider ?? "docker") !== "docker";
|
|
@@ -14208,11 +14407,11 @@ var statusCommand2 = withWatchOptions(
|
|
|
14208
14407
|
new Command44("status").description("Show service + task status from a box's agentbox-ctl daemon").argument(
|
|
14209
14408
|
"[box]",
|
|
14210
14409
|
"box ref: project index, id, id prefix, name, or container (default: the only box in this project)"
|
|
14211
|
-
).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")
|
|
14212
14411
|
).action(async (idOrName, opts) => {
|
|
14213
14412
|
try {
|
|
14214
14413
|
if (opts.json && opts.watch) {
|
|
14215
|
-
|
|
14414
|
+
log47.error("cannot combine --json with --watch");
|
|
14216
14415
|
process.exit(2);
|
|
14217
14416
|
}
|
|
14218
14417
|
const box = await resolveBoxOrExit(idOrName);
|
|
@@ -14254,18 +14453,6 @@ var statusCommand2 = withWatchOptions(
|
|
|
14254
14453
|
handleLifecycleError(err);
|
|
14255
14454
|
}
|
|
14256
14455
|
});
|
|
14257
|
-
async function fetchLive(state, container) {
|
|
14258
|
-
if (state !== "running") return null;
|
|
14259
|
-
const proc = await execInBox(container, ["agentbox-ctl", "status", "--json"], {
|
|
14260
|
-
user: "vscode"
|
|
14261
|
-
});
|
|
14262
|
-
if (proc.exitCode !== 0) return null;
|
|
14263
|
-
try {
|
|
14264
|
-
return JSON.parse(proc.stdout);
|
|
14265
|
-
} catch {
|
|
14266
|
-
return null;
|
|
14267
|
-
}
|
|
14268
|
-
}
|
|
14269
14456
|
async function buildStatusText(id, container) {
|
|
14270
14457
|
const inspected = await inspectBox(id);
|
|
14271
14458
|
const { state, endpoints, persistedStatus } = inspected;
|
|
@@ -14279,11 +14466,7 @@ async function buildStatusText(id, container) {
|
|
|
14279
14466
|
out.push("CLAUDE", renderClaude(inspected, persistedStatus));
|
|
14280
14467
|
out.push("", "SHELLS", renderShells2(inspected));
|
|
14281
14468
|
if (live) {
|
|
14282
|
-
|
|
14283
|
-
out.push("", "TASKS", renderTaskTable(live.tasks));
|
|
14284
|
-
}
|
|
14285
|
-
out.push("", "SERVICES", renderStatusTable(live.services));
|
|
14286
|
-
out.push("", "PORTS", renderPortsTable(live.ports));
|
|
14469
|
+
out.push("", ...renderLiveSections(live));
|
|
14287
14470
|
return out.join("\n");
|
|
14288
14471
|
}
|
|
14289
14472
|
if (!persistedStatus) {
|
|
@@ -14348,34 +14531,11 @@ function renderShells2(i) {
|
|
|
14348
14531
|
return i.shellSessions.map((s) => ` ${s.label} ${s.attached ? "attached" : "detached"}`).join("\n");
|
|
14349
14532
|
}
|
|
14350
14533
|
function renderPersisted2(s, state) {
|
|
14351
|
-
|
|
14352
|
-
|
|
14353
|
-
|
|
14354
|
-
|
|
14355
|
-
|
|
14356
|
-
}
|
|
14357
|
-
out.push("SERVICES");
|
|
14358
|
-
if (s.services.length === 0) {
|
|
14359
|
-
out.push(" (none)");
|
|
14360
|
-
} else {
|
|
14361
|
-
out.push(
|
|
14362
|
-
...s.services.map(
|
|
14363
|
-
(svc) => ` ${svc.name} ${svc.state}${svc.port !== null ? ` :${String(svc.port)}` : ""}`
|
|
14364
|
-
)
|
|
14365
|
-
);
|
|
14366
|
-
}
|
|
14367
|
-
out.push("");
|
|
14368
|
-
out.push("PORTS");
|
|
14369
|
-
if (s.ports.length === 0) {
|
|
14370
|
-
out.push(" (none listening)");
|
|
14371
|
-
} else {
|
|
14372
|
-
const other = s.ports.filter((p) => !p.service).map((p) => p.port).sort((a, b) => a - b);
|
|
14373
|
-
out.push(
|
|
14374
|
-
...s.ports.filter((p) => p.service).map((p) => ` :${String(p.port)} (${p.service})`)
|
|
14375
|
-
);
|
|
14376
|
-
if (other.length > 0) out.push(` other (${other.length}): ${other.join(", ")}`);
|
|
14377
|
-
}
|
|
14378
|
-
return out.join("\n");
|
|
14534
|
+
return [
|
|
14535
|
+
`(persisted snapshot from ${s.timestamp}; box is ${state})`,
|
|
14536
|
+
"",
|
|
14537
|
+
...renderPersistedSections(s)
|
|
14538
|
+
].join("\n");
|
|
14379
14539
|
}
|
|
14380
14540
|
|
|
14381
14541
|
// src/commands/stop.ts
|
|
@@ -14701,7 +14861,7 @@ var updateCommand = new Command48("self-update").description(
|
|
|
14701
14861
|
|
|
14702
14862
|
// src/commands/url.ts
|
|
14703
14863
|
import { spawnSync as spawnSync8 } from "child_process";
|
|
14704
|
-
import { log as
|
|
14864
|
+
import { log as log49 } from "@clack/prompts";
|
|
14705
14865
|
import { Command as Command49 } from "commander";
|
|
14706
14866
|
var SIGNED_URL_TTL_MIN2 = 1;
|
|
14707
14867
|
var SIGNED_URL_TTL_MAX2 = 86400;
|
|
@@ -14734,10 +14894,10 @@ var urlCommand = new Command49("url").description(
|
|
|
14734
14894
|
if (provider === "docker") {
|
|
14735
14895
|
const insp = await inspectBox(box.id);
|
|
14736
14896
|
if (insp.state === "paused") {
|
|
14737
|
-
|
|
14897
|
+
log49.info("box is paused; unpausing");
|
|
14738
14898
|
await unpauseBox(box.id);
|
|
14739
14899
|
} else if (insp.state === "stopped") {
|
|
14740
|
-
|
|
14900
|
+
log49.info("box is stopped; starting");
|
|
14741
14901
|
await startBox(box.id);
|
|
14742
14902
|
} else if (insp.state === "missing") {
|
|
14743
14903
|
throw new Error(`box ${box.name} has no container; was it destroyed?`);
|
|
@@ -14766,10 +14926,10 @@ var urlCommand = new Command49("url").description(
|
|
|
14766
14926
|
const p = await providerForBox(box);
|
|
14767
14927
|
const state = await p.probeState(box);
|
|
14768
14928
|
if (state === "paused") {
|
|
14769
|
-
|
|
14929
|
+
log49.info("box is paused; resuming");
|
|
14770
14930
|
await p.resume(box);
|
|
14771
14931
|
} else if (state === "stopped") {
|
|
14772
|
-
|
|
14932
|
+
log49.info("box is stopped; starting");
|
|
14773
14933
|
await p.start(box);
|
|
14774
14934
|
} else if (state === "missing") {
|
|
14775
14935
|
throw new Error(`cloud sandbox for ${box.name} is missing; was it deleted?`);
|
|
@@ -14793,7 +14953,7 @@ var urlCommand = new Command49("url").description(
|
|
|
14793
14953
|
});
|
|
14794
14954
|
|
|
14795
14955
|
// src/commands/wait.ts
|
|
14796
|
-
import { log as
|
|
14956
|
+
import { log as log50 } from "@clack/prompts";
|
|
14797
14957
|
import { Command as Command50 } from "commander";
|
|
14798
14958
|
var waitCommand = new Command50("wait").description("Block until the box reports all autostart units ready").argument(
|
|
14799
14959
|
"[box]",
|
|
@@ -14811,7 +14971,7 @@ var waitCommand = new Command50("wait").description("Block until the box reports
|
|
|
14811
14971
|
try {
|
|
14812
14972
|
parsed = JSON.parse(proc.stdout);
|
|
14813
14973
|
} catch {
|
|
14814
|
-
|
|
14974
|
+
log50.error(`agentbox-ctl wait-ready failed: ${proc.stderr || proc.stdout}`);
|
|
14815
14975
|
process.exit(1);
|
|
14816
14976
|
}
|
|
14817
14977
|
if (opts.json) {
|