@madarco/agentbox 0.17.1 → 0.18.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.
Files changed (28) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/{_cloud-attach-RUD4W33P.js → _cloud-attach-3UC3IL62.js} +3 -3
  3. package/dist/{chunk-YUGLNTT2.js → chunk-5BO6SGMI.js} +349 -16
  4. package/dist/chunk-5BO6SGMI.js.map +1 -0
  5. package/dist/{chunk-KTDJ5JTE.js → chunk-OG4KMYOJ.js} +2 -2
  6. package/dist/{chunk-HFQZJO73.js → chunk-U7IZS2ZP.js} +10 -4
  7. package/dist/{chunk-HFQZJO73.js.map → chunk-U7IZS2ZP.js.map} +1 -1
  8. package/dist/{dist-BO2R55FX.js → dist-3UYQZOAO.js} +3 -3
  9. package/dist/{dist-CNABE32V.js → dist-4BHW7DCO.js} +3 -3
  10. package/dist/{dist-TEKY3GFT.js → dist-7BS2JS27.js} +3 -3
  11. package/dist/{dist-VAATGBAR.js → dist-CFSKUAS5.js} +2 -2
  12. package/dist/{dist-CROGTJ7N.js → dist-T7ESSBCZ.js} +3 -3
  13. package/dist/index.js +676 -276
  14. package/dist/index.js.map +1 -1
  15. package/package.json +4 -4
  16. package/runtime/docker/packages/ctl/dist/bin.cjs +9 -3
  17. package/runtime/e2b/ctl.cjs +9 -3
  18. package/runtime/hetzner/ctl.cjs +9 -3
  19. package/runtime/relay/bin.cjs +9 -3
  20. package/runtime/vercel/ctl.cjs +9 -3
  21. package/dist/chunk-YUGLNTT2.js.map +0 -1
  22. /package/dist/{_cloud-attach-RUD4W33P.js.map → _cloud-attach-3UC3IL62.js.map} +0 -0
  23. /package/dist/{chunk-KTDJ5JTE.js.map → chunk-OG4KMYOJ.js.map} +0 -0
  24. /package/dist/{dist-BO2R55FX.js.map → dist-3UYQZOAO.js.map} +0 -0
  25. /package/dist/{dist-CNABE32V.js.map → dist-4BHW7DCO.js.map} +0 -0
  26. /package/dist/{dist-TEKY3GFT.js.map → dist-7BS2JS27.js.map} +0 -0
  27. /package/dist/{dist-VAATGBAR.js.map → dist-CFSKUAS5.js.map} +0 -0
  28. /package/dist/{dist-CROGTJ7N.js.map → dist-T7ESSBCZ.js.map} +0 -0
package/dist/index.js CHANGED
@@ -12,6 +12,8 @@ import {
12
12
  createMenuLines,
13
13
  detectHostTerminal,
14
14
  getProvider,
15
+ herdrSend,
16
+ hostAwareOpenIn,
15
17
  isKnownProvider,
16
18
  lifecycleMenuLines,
17
19
  loadPtyBackend,
@@ -30,8 +32,9 @@ import {
30
32
  spawnInNewTerminal,
31
33
  statusLine,
32
34
  stripTitleGlyph,
33
- subscribePrompts
34
- } from "./chunk-YUGLNTT2.js";
35
+ subscribePrompts,
36
+ uploadImageFileToBox
37
+ } from "./chunk-5BO6SGMI.js";
35
38
  import {
36
39
  daytonaBackend,
37
40
  ensureDaytonaCredentials,
@@ -76,7 +79,7 @@ import {
76
79
  probeCloudCheckpoint,
77
80
  resolveCloudCheckpoint,
78
81
  seedAgentVolumesIfFresh
79
- } from "./chunk-KTDJ5JTE.js";
82
+ } from "./chunk-OG4KMYOJ.js";
80
83
  import {
81
84
  ALL_CONNECTORS,
82
85
  BOX_STATUS_EVENT,
@@ -232,7 +235,7 @@ import {
232
235
  waitForTmuxPaneContent,
233
236
  warmUpClaudeCredentials,
234
237
  writeJob
235
- } from "./chunk-HFQZJO73.js";
238
+ } from "./chunk-U7IZS2ZP.js";
236
239
  import {
237
240
  AmbiguousBoxError,
238
241
  BoxNotFoundError,
@@ -258,11 +261,11 @@ import {
258
261
  } from "./chunk-WJFZJZIM.js";
259
262
 
260
263
  // src/version.ts
261
- var AGENTBOX_VERSION = true ? "0.17.1" : "0.0.0-dev";
262
- var AGENTBOX_COMMIT = true ? "82738adfb" : "dev";
264
+ var AGENTBOX_VERSION = true ? "0.18.0" : "0.0.0-dev";
265
+ var AGENTBOX_COMMIT = true ? "49139851d" : "dev";
263
266
 
264
267
  // src/index.ts
265
- import { Command as Command49 } from "commander";
268
+ import { Command as Command51 } from "commander";
266
269
 
267
270
  // src/engine-override.ts
268
271
  async function applyEngineOverrideAtStartup() {
@@ -1523,7 +1526,7 @@ async function dirSizeCapped(dir, cap, exclude = []) {
1523
1526
 
1524
1527
  // src/lib/carry-resync.ts
1525
1528
  async function resyncCarryFiles(args) {
1526
- const log48 = args.onLog ?? (() => {
1529
+ const log50 = args.onLog ?? (() => {
1527
1530
  });
1528
1531
  const prior = args.box.carry?.entries ?? [];
1529
1532
  if (prior.length === 0) return { recopied: 0, skippedNew: 0 };
@@ -1535,7 +1538,7 @@ async function resyncCarryFiles(args) {
1535
1538
  maxBytes: cfg.effective.box.cpMaxBytes
1536
1539
  });
1537
1540
  if (resolved.errors.length > 0) {
1538
- log48(`carry: resync skipped (resolve errors: ${resolved.errors.length})`);
1541
+ log50(`carry: resync skipped (resolve errors: ${resolved.errors.length})`);
1539
1542
  return { recopied: 0, skippedNew: 0 };
1540
1543
  }
1541
1544
  const priorByDest = new Map(prior.map((e) => [e.dest, e]));
@@ -1552,7 +1555,7 @@ async function resyncCarryFiles(args) {
1552
1555
  if (hash === void 0 || hash !== existing.hash) changed.push(entry);
1553
1556
  }
1554
1557
  if (skippedNew > 0) {
1555
- log48(
1558
+ log50(
1556
1559
  `carry: ${String(skippedNew)} new entry/entries not applied on resync \u2014 recreate the box to approve`
1557
1560
  );
1558
1561
  }
@@ -1560,9 +1563,9 @@ async function resyncCarryFiles(args) {
1560
1563
  const result = await copyCarryPathsToBox({
1561
1564
  container: args.box.container,
1562
1565
  entries: changed,
1563
- onLog: log48
1566
+ onLog: log50
1564
1567
  });
1565
- for (const err of result.errors) log48(`carry: ${err}`);
1568
+ for (const err of result.errors) log50(`carry: ${err}`);
1566
1569
  const updatedByDest = new Map(result.applied.map((e) => [e.dest, e]));
1567
1570
  const mergedEntries = prior.map((e) => updatedByDest.get(e.dest) ?? e);
1568
1571
  await recordBox({
@@ -1570,7 +1573,7 @@ async function resyncCarryFiles(args) {
1570
1573
  carry: { count: mergedEntries.length, entries: mergedEntries }
1571
1574
  });
1572
1575
  if (result.applied.length > 0) {
1573
- log48(`carry: re-copied ${String(result.applied.length)} changed file(s)`);
1576
+ log50(`carry: re-copied ${String(result.applied.length)} changed file(s)`);
1574
1577
  }
1575
1578
  return { recopied: result.applied.length, skippedNew };
1576
1579
  }
@@ -1742,6 +1745,15 @@ function captureOpenTerminalContext(mode, env = process.env, cwd = process.cwd()
1742
1745
  cmuxWorkspaceId: env["CMUX_WORKSPACE_ID"]
1743
1746
  };
1744
1747
  }
1748
+ if (host === "herdr") {
1749
+ return {
1750
+ ...base,
1751
+ host,
1752
+ herdrSocket: env["HERDR_SOCKET_PATH"],
1753
+ herdrPaneId: env["HERDR_PANE_ID"],
1754
+ herdrWorkspaceId: env["HERDR_WORKSPACE_ID"]
1755
+ };
1756
+ }
1745
1757
  return { ...base, host };
1746
1758
  }
1747
1759
  function spawnQueuedOpenTerminal(ctx, argv2, title) {
@@ -1772,6 +1784,20 @@ function spawnQueuedOpenTerminal(ctx, argv2, title) {
1772
1784
  cmuxWorkspaceFallback: true
1773
1785
  });
1774
1786
  }
1787
+ if (ctx.host === "herdr") {
1788
+ const env = { ...process.env };
1789
+ if (ctx.herdrSocket) env["HERDR_SOCKET_PATH"] = ctx.herdrSocket;
1790
+ return spawnInNewTerminal({
1791
+ host: "herdr",
1792
+ mode: ctx.mode,
1793
+ argv: argv2,
1794
+ cwd: ctx.cwd,
1795
+ title,
1796
+ env,
1797
+ herdrTargetPane: ctx.herdrPaneId,
1798
+ herdrTargetWorkspace: ctx.herdrWorkspaceId
1799
+ });
1800
+ }
1775
1801
  return spawnInNewTerminal({ host: "iterm2", mode: ctx.mode, argv: argv2, cwd: ctx.cwd, title });
1776
1802
  }
1777
1803
 
@@ -2730,13 +2756,13 @@ import { basename as basename2 } from "path";
2730
2756
  async function cloudBackendForProvider(provider) {
2731
2757
  switch (provider) {
2732
2758
  case "daytona":
2733
- return (await import("./dist-TEKY3GFT.js")).daytonaBackend;
2759
+ return (await import("./dist-7BS2JS27.js")).daytonaBackend;
2734
2760
  case "hetzner":
2735
- return (await import("./dist-CNABE32V.js")).hetznerBackend;
2761
+ return (await import("./dist-4BHW7DCO.js")).hetznerBackend;
2736
2762
  case "vercel":
2737
- return (await import("./dist-CROGTJ7N.js")).vercelBackend;
2763
+ return (await import("./dist-T7ESSBCZ.js")).vercelBackend;
2738
2764
  case "e2b":
2739
- return (await import("./dist-BO2R55FX.js")).e2bBackend;
2765
+ return (await import("./dist-3UYQZOAO.js")).e2bBackend;
2740
2766
  default:
2741
2767
  return null;
2742
2768
  }
@@ -2744,13 +2770,13 @@ async function cloudBackendForProvider(provider) {
2744
2770
  async function currentCloudBaseFingerprintLive(provider) {
2745
2771
  switch (provider) {
2746
2772
  case "daytona":
2747
- return (await import("./dist-TEKY3GFT.js")).currentDaytonaBaseFingerprintLive();
2773
+ return (await import("./dist-7BS2JS27.js")).currentDaytonaBaseFingerprintLive();
2748
2774
  case "hetzner":
2749
- return (await import("./dist-CNABE32V.js")).currentHetznerBaseFingerprintLive();
2775
+ return (await import("./dist-4BHW7DCO.js")).currentHetznerBaseFingerprintLive();
2750
2776
  case "vercel":
2751
- return (await import("./dist-CROGTJ7N.js")).currentVercelBaseFingerprintLive();
2777
+ return (await import("./dist-T7ESSBCZ.js")).currentVercelBaseFingerprintLive();
2752
2778
  case "e2b":
2753
- return (await import("./dist-BO2R55FX.js")).currentE2bBaseFingerprintLive();
2779
+ return (await import("./dist-3UYQZOAO.js")).currentE2bBaseFingerprintLive();
2754
2780
  default:
2755
2781
  return void 0;
2756
2782
  }
@@ -3089,7 +3115,7 @@ async function renderDocker(status) {
3089
3115
  }
3090
3116
  async function daytonaStatus() {
3091
3117
  try {
3092
- const mod = await import("./dist-TEKY3GFT.js");
3118
+ const mod = await import("./dist-7BS2JS27.js");
3093
3119
  return await mod.getDaytonaStatus();
3094
3120
  } catch (err) {
3095
3121
  return {
@@ -3100,7 +3126,7 @@ async function daytonaStatus() {
3100
3126
  }
3101
3127
  async function e2bStatus() {
3102
3128
  try {
3103
- const mod = await import("./dist-BO2R55FX.js");
3129
+ const mod = await import("./dist-3UYQZOAO.js");
3104
3130
  const cred = mod.readE2bCredStatus();
3105
3131
  if (cred.auth === "none") {
3106
3132
  return { configured: false, reason: "not configured \u2014 run `agentbox e2b login`" };
@@ -3357,7 +3383,8 @@ async function attachClaudeWrapped(box, sessionName, reattach, onError, openIn)
3357
3383
  detachNotice: formatDetachNotice(reattach),
3358
3384
  onError,
3359
3385
  openIn,
3360
- onPasteImage: canPaste ? () => pasteHostClipboardImage(provider, box) : void 0
3386
+ onPasteImage: canPaste ? () => pasteHostClipboardImage(provider, box) : void 0,
3387
+ onPasteImageFile: canPaste ? (p) => uploadImageFileToBox(provider, box, p) : void 0
3361
3388
  });
3362
3389
  process.exit(code);
3363
3390
  }
@@ -3743,7 +3770,7 @@ var claudeCommand = new Command3("claude").description("Create a sandboxed box a
3743
3770
  mode: "claude",
3744
3771
  extraArgs: effectiveClaudeArgs,
3745
3772
  verbose: opts.verbose === true,
3746
- openIn: cfg.effective.attach.openIn,
3773
+ openIn: hostAwareOpenIn(cfg),
3747
3774
  attach: opts.attach !== false,
3748
3775
  beforeStart: resumePrepared || planPrepared ? async (box) => {
3749
3776
  try {
@@ -3922,7 +3949,7 @@ ${f.stderr.trim()}`
3922
3949
  sessionName,
3923
3950
  reattachRef(result.record),
3924
3951
  (m) => cmdLog.write(m),
3925
- cfg.effective.attach.openIn
3952
+ hostAwareOpenIn(cfg)
3926
3953
  );
3927
3954
  } catch (err) {
3928
3955
  s.stop("failed");
@@ -3955,7 +3982,7 @@ async function startOrAttachClaude(box, claudeArgs, opts, resumePrepared) {
3955
3982
  if (opts.resync !== void 0) cliOverrides.box = { resyncOnStart: opts.resync };
3956
3983
  const cfg = await loadEffectiveConfig(box.workspacePath, { cliOverrides });
3957
3984
  const sessionName = cfg.effective.claude.sessionName;
3958
- const openIn = cfg.effective.attach.openIn;
3985
+ const openIn = hostAwareOpenIn(cfg);
3959
3986
  const wantAttach = opts.attach !== false;
3960
3987
  const resolved = await resolveClaudeAuth(process.env);
3961
3988
  const insp = await inspectBox(box.id);
@@ -4094,7 +4121,7 @@ var claudeAttachCommand = new Command3("attach").description(
4094
4121
  binary: "claude",
4095
4122
  sessionName: opts.sessionName ?? "claude",
4096
4123
  mode: "claude",
4097
- openIn: cfg.effective.attach.openIn
4124
+ openIn: hostAwareOpenIn(cfg)
4098
4125
  });
4099
4126
  return;
4100
4127
  }
@@ -4187,7 +4214,7 @@ var claudeStartCommand = new Command3("start").description(
4187
4214
  sessionName: opts.sessionName ?? "claude",
4188
4215
  mode: "claude",
4189
4216
  extraArgs: effectiveClaudeArgs,
4190
- openIn: cfg.effective.attach.openIn
4217
+ openIn: hostAwareOpenIn(cfg)
4191
4218
  });
4192
4219
  return;
4193
4220
  }
@@ -4569,7 +4596,7 @@ var codexCommand = new Command4("codex").description("Create a sandboxed box and
4569
4596
  mode: "codex",
4570
4597
  extraArgs: applyCodexSkipPermissions(codexArgs, cfg.effective),
4571
4598
  verbose: opts.verbose === true,
4572
- openIn: cfg.effective.attach.openIn,
4599
+ openIn: hostAwareOpenIn(cfg),
4573
4600
  attach: opts.attach !== false,
4574
4601
  beforeStart: resumePrepared ? async (box) => {
4575
4602
  try {
@@ -4699,7 +4726,7 @@ var codexCommand = new Command4("codex").description("Create a sandboxed box and
4699
4726
  sessionName,
4700
4727
  reattachRef(result.record),
4701
4728
  (m) => cmdLog.write(m),
4702
- cfg.effective.attach.openIn
4729
+ hostAwareOpenIn(cfg)
4703
4730
  );
4704
4731
  } catch (err) {
4705
4732
  s.stop("failed");
@@ -4732,7 +4759,7 @@ async function startOrAttachCodex(box, codexArgs, opts, resumePrepared) {
4732
4759
  if (opts.resync !== void 0) cliOverrides.box = { resyncOnStart: opts.resync };
4733
4760
  const cfg = await loadEffectiveConfig(box.workspacePath, { cliOverrides });
4734
4761
  const sessionName = cfg.effective.codex.sessionName;
4735
- const openIn = cfg.effective.attach.openIn;
4762
+ const openIn = hostAwareOpenIn(cfg);
4736
4763
  const wantAttach = opts.attach !== false;
4737
4764
  const insp = await inspectBox(box.id);
4738
4765
  if (insp.state === "missing") {
@@ -4844,7 +4871,7 @@ var codexAttachCommand = new Command4("attach").description(
4844
4871
  binary: "codex",
4845
4872
  sessionName: opts.sessionName ?? "codex",
4846
4873
  mode: "codex",
4847
- openIn: cfg.effective.attach.openIn
4874
+ openIn: hostAwareOpenIn(cfg)
4848
4875
  });
4849
4876
  return;
4850
4877
  }
@@ -4937,7 +4964,7 @@ var codexStartCommand = new Command4("start").description(
4937
4964
  sessionName: opts.sessionName ?? "codex",
4938
4965
  mode: "codex",
4939
4966
  extraArgs: effectiveCodexArgs,
4940
- openIn: cfg.effective.attach.openIn
4967
+ openIn: hostAwareOpenIn(cfg)
4941
4968
  });
4942
4969
  return;
4943
4970
  }
@@ -5305,7 +5332,7 @@ var opencodeCommand = new Command5("opencode").description("Create a sandboxed b
5305
5332
  mode: "opencode",
5306
5333
  extraArgs: opencodeArgs,
5307
5334
  verbose: opts.verbose === true,
5308
- openIn: cfg.effective.attach.openIn,
5335
+ openIn: hostAwareOpenIn(cfg),
5309
5336
  attach: opts.attach !== false
5310
5337
  });
5311
5338
  return;
@@ -5385,7 +5412,7 @@ var opencodeCommand = new Command5("opencode").description("Create a sandboxed b
5385
5412
  sessionName,
5386
5413
  reattachRef(result.record),
5387
5414
  (m) => cmdLog.write(m),
5388
- cfg.effective.attach.openIn
5415
+ hostAwareOpenIn(cfg)
5389
5416
  );
5390
5417
  } catch (err) {
5391
5418
  s.stop("failed");
@@ -5412,7 +5439,7 @@ async function startOrAttachOpencode(box, opencodeArgs, opts) {
5412
5439
  if (opts.resync !== void 0) cliOverrides.box = { resyncOnStart: opts.resync };
5413
5440
  const cfg = await loadEffectiveConfig(box.workspacePath, { cliOverrides });
5414
5441
  const sessionName = cfg.effective.opencode.sessionName;
5415
- const openIn = cfg.effective.attach.openIn;
5442
+ const openIn = hostAwareOpenIn(cfg);
5416
5443
  const wantAttach = opts.attach !== false;
5417
5444
  const insp = await inspectBox(box.id);
5418
5445
  if (insp.state === "missing") {
@@ -5492,7 +5519,7 @@ var opencodeAttachCommand = new Command5("attach").description(
5492
5519
  binary: "opencode",
5493
5520
  sessionName: opts.sessionName ?? "opencode",
5494
5521
  mode: "opencode",
5495
- openIn: cfg.effective.attach.openIn
5522
+ openIn: hostAwareOpenIn(cfg)
5496
5523
  });
5497
5524
  return;
5498
5525
  }
@@ -5560,7 +5587,7 @@ var opencodeStartCommand = new Command5("start").description(
5560
5587
  sessionName: opts.sessionName ?? "opencode",
5561
5588
  mode: "opencode",
5562
5589
  extraArgs: effectiveOpencodeArgs,
5563
- openIn: cfg.effective.attach.openIn
5590
+ openIn: hostAwareOpenIn(cfg)
5564
5591
  });
5565
5592
  return;
5566
5593
  }
@@ -5747,7 +5774,7 @@ var attachCommand = new Command6("attach").description(
5747
5774
  binary: winner.kind,
5748
5775
  sessionName: winner.sessionName,
5749
5776
  mode: winner.kind,
5750
- openIn: cfg2.effective.attach.openIn
5777
+ openIn: hostAwareOpenIn(cfg2)
5751
5778
  });
5752
5779
  return;
5753
5780
  }
@@ -5755,7 +5782,7 @@ var attachCommand = new Command6("attach").description(
5755
5782
  const cfg = await loadEffectiveConfig(box.workspacePath, {
5756
5783
  cliOverrides: attachIn ? { attach: { openIn: attachIn } } : {}
5757
5784
  });
5758
- await dispatchDocker(box, winner, cfg.effective.attach.openIn);
5785
+ await dispatchDocker(box, winner, hostAwareOpenIn(cfg));
5759
5786
  } catch (err) {
5760
5787
  handleLifecycleError(err);
5761
5788
  }
@@ -5768,13 +5795,13 @@ var CLOUD_BACKENDS = ["daytona", "hetzner", "vercel", "e2b"];
5768
5795
  async function cloudProviderFor(backend) {
5769
5796
  switch (backend) {
5770
5797
  case "daytona":
5771
- return (await import("./dist-TEKY3GFT.js")).daytonaProvider;
5798
+ return (await import("./dist-7BS2JS27.js")).daytonaProvider;
5772
5799
  case "hetzner":
5773
- return (await import("./dist-CNABE32V.js")).hetznerProvider;
5800
+ return (await import("./dist-4BHW7DCO.js")).hetznerProvider;
5774
5801
  case "vercel":
5775
- return (await import("./dist-CROGTJ7N.js")).vercelProvider;
5802
+ return (await import("./dist-T7ESSBCZ.js")).vercelProvider;
5776
5803
  case "e2b":
5777
- return (await import("./dist-BO2R55FX.js")).e2bProvider;
5804
+ return (await import("./dist-3UYQZOAO.js")).e2bProvider;
5778
5805
  }
5779
5806
  }
5780
5807
  var CHECKPOINT_NOTICE = "Checkpoint in progress \u2014 the box will be unresponsive for a moment";
@@ -7205,7 +7232,7 @@ var createCommand = new Command11("create").description(
7205
7232
  }
7206
7233
  outro5("done");
7207
7234
  if (attachClaudeAfter) {
7208
- const { cloudAgentAttach: cloudAgentAttach2 } = await import("./_cloud-attach-RUD4W33P.js");
7235
+ const { cloudAgentAttach: cloudAgentAttach2 } = await import("./_cloud-attach-3UC3IL62.js");
7209
7236
  await cloudAgentAttach2({
7210
7237
  box: result.record,
7211
7238
  binary: "claude",
@@ -10496,18 +10523,18 @@ var forkCommand = new Command26("fork").description(
10496
10523
  });
10497
10524
 
10498
10525
  // src/commands/install.ts
10499
- import { Command as Command28 } from "commander";
10526
+ import { Command as Command29 } from "commander";
10500
10527
  import {
10501
- existsSync as existsSync8,
10528
+ existsSync as existsSync10,
10502
10529
  lstatSync,
10503
- mkdirSync as mkdirSync6,
10504
- readFileSync as readFileSync2,
10530
+ mkdirSync as mkdirSync8,
10531
+ readFileSync as readFileSync4,
10505
10532
  rmSync,
10506
10533
  symlinkSync as symlinkSync2,
10507
- writeFileSync as writeFileSync5
10534
+ writeFileSync as writeFileSync7
10508
10535
  } from "fs";
10509
- import { homedir as homedir16 } from "os";
10510
- import { dirname as dirname3, join as join19, resolve as resolve4, sep } from "path";
10536
+ import { homedir as homedir18 } from "os";
10537
+ import { dirname as dirname5, join as join21, resolve as resolve4, sep } from "path";
10511
10538
  import { fileURLToPath } from "url";
10512
10539
 
10513
10540
  // src/lib/doctor-checks.ts
@@ -10633,7 +10660,7 @@ async function dockerChecks() {
10633
10660
  ];
10634
10661
  }
10635
10662
  const daemonRes = { label: "docker daemon", status: "ok", detail: "reachable" };
10636
- const mod = await import("./dist-VAATGBAR.js");
10663
+ const mod = await import("./dist-CFSKUAS5.js");
10637
10664
  let imgRes;
10638
10665
  try {
10639
10666
  const img = await mod.imageInfo(mod.DEFAULT_BOX_IMAGE);
@@ -10664,7 +10691,7 @@ async function dockerChecks() {
10664
10691
  }
10665
10692
  async function daytonaChecks() {
10666
10693
  try {
10667
- const mod = await import("./dist-TEKY3GFT.js");
10694
+ const mod = await import("./dist-7BS2JS27.js");
10668
10695
  const status = await mod.getDaytonaStatus();
10669
10696
  if (!status.configured) {
10670
10697
  return [
@@ -10700,7 +10727,7 @@ async function daytonaChecks() {
10700
10727
  }
10701
10728
  async function hetznerChecks() {
10702
10729
  try {
10703
- const mod = await import("./dist-CNABE32V.js");
10730
+ const mod = await import("./dist-4BHW7DCO.js");
10704
10731
  const cred = mod.readHetznerCredStatus();
10705
10732
  const credRes = cred.source === "none" ? {
10706
10733
  label: "credentials",
@@ -10732,7 +10759,7 @@ async function hetznerChecks() {
10732
10759
  }
10733
10760
  async function vercelChecks() {
10734
10761
  try {
10735
- const mod = await import("./dist-CROGTJ7N.js");
10762
+ const mod = await import("./dist-T7ESSBCZ.js");
10736
10763
  const cred = mod.readVercelCredStatus();
10737
10764
  const credRes = cred.auth === "none" ? {
10738
10765
  label: "credentials",
@@ -10768,7 +10795,7 @@ async function vercelChecks() {
10768
10795
  }
10769
10796
  async function e2bChecks() {
10770
10797
  try {
10771
- const mod = await import("./dist-BO2R55FX.js");
10798
+ const mod = await import("./dist-3UYQZOAO.js");
10772
10799
  const cred = mod.readE2bCredStatus();
10773
10800
  const credRes = cred.auth === "none" ? {
10774
10801
  label: "credentials",
@@ -11024,17 +11051,91 @@ function markSetupComplete(provider) {
11024
11051
  writeFileSync3(path, JSON.stringify(body, null, 2) + "\n");
11025
11052
  }
11026
11053
 
11027
- // src/commands/install-cmux.ts
11028
- import { intro as intro7, log as log32, note as note2, outro as outro6 } from "@clack/prompts";
11029
- import { Command as Command27 } from "commander";
11030
- import { existsSync as existsSync7, mkdirSync as mkdirSync5, readFileSync, renameSync as renameSync2, writeFileSync as writeFileSync4 } from "fs";
11054
+ // src/lib/star-prompt.ts
11055
+ import { spawnSync as spawnSync3 } from "child_process";
11056
+ import { existsSync as existsSync7, mkdirSync as mkdirSync5, readFileSync, writeFileSync as writeFileSync4 } from "fs";
11031
11057
  import { homedir as homedir15 } from "os";
11032
11058
  import { dirname as dirname2, join as join18 } from "path";
11059
+ var STATE_VERSION = 1;
11060
+ var REPO = "madarco/agentbox";
11061
+ var REPO_URL = `https://github.com/${REPO}`;
11062
+ var DEFAULT_STATE = { version: STATE_VERSION, installCount: 0, starred: false };
11063
+ function starStatePath() {
11064
+ return join18(homedir15(), ".agentbox", "star-prompt.json");
11065
+ }
11066
+ function readStarState() {
11067
+ const path = starStatePath();
11068
+ if (!existsSync7(path)) return { ...DEFAULT_STATE };
11069
+ try {
11070
+ const parsed = JSON.parse(readFileSync(path, "utf8"));
11071
+ return {
11072
+ version: STATE_VERSION,
11073
+ installCount: typeof parsed.installCount === "number" ? parsed.installCount : 0,
11074
+ starred: parsed.starred === true
11075
+ };
11076
+ } catch {
11077
+ return { ...DEFAULT_STATE };
11078
+ }
11079
+ }
11080
+ function writeStarState(state) {
11081
+ const path = starStatePath();
11082
+ mkdirSync5(dirname2(path), { recursive: true });
11083
+ writeFileSync4(path, JSON.stringify(state, null, 2) + "\n");
11084
+ }
11085
+ function ghReady() {
11086
+ const r = spawnSync3("gh", ["auth", "status"], { stdio: "ignore" });
11087
+ return r.error === void 0 && r.status === 0;
11088
+ }
11089
+ async function maybePromptStar(opts) {
11090
+ if (!process.stdout.isTTY) return;
11091
+ const state = readStarState();
11092
+ if (state.starred) return;
11093
+ let shouldPrompt;
11094
+ if (opts.trigger === "install") {
11095
+ state.installCount += 1;
11096
+ writeStarState(state);
11097
+ shouldPrompt = state.installCount === 3 || state.installCount === 4;
11098
+ } else {
11099
+ shouldPrompt = true;
11100
+ }
11101
+ if (!shouldPrompt) return;
11102
+ const yes = await confirm({
11103
+ message: "Help support this open source project \u2014 would you like to star it on GitHub? Thanks!",
11104
+ initialValue: true
11105
+ });
11106
+ if (!yes) return;
11107
+ try {
11108
+ if (ghReady()) {
11109
+ const r = spawnSync3("gh", ["api", "--method", "PUT", `/user/starred/${REPO}`], {
11110
+ stdio: "ignore"
11111
+ });
11112
+ if (r.error === void 0 && r.status === 0) {
11113
+ state.starred = true;
11114
+ writeStarState(state);
11115
+ prompt_exports.log.success(`Starred ${REPO} \u2014 thank you!`);
11116
+ return;
11117
+ }
11118
+ }
11119
+ spawnSync3(hostOpenCommand(), [REPO_URL], { stdio: "ignore" });
11120
+ prompt_exports.log.info(`Opened ${REPO_URL} \u2014 star away!`);
11121
+ } catch (err) {
11122
+ prompt_exports.log.warn(
11123
+ `couldn't open the star page (${err instanceof Error ? err.message : String(err)}) \u2014 star it anytime at ${REPO_URL}`
11124
+ );
11125
+ }
11126
+ }
11127
+
11128
+ // src/commands/install-cmux.ts
11129
+ import { intro as intro7, log as log33, note as note2, outro as outro6 } from "@clack/prompts";
11130
+ import { Command as Command27 } from "commander";
11131
+ import { existsSync as existsSync8, mkdirSync as mkdirSync6, readFileSync as readFileSync2, renameSync as renameSync2, writeFileSync as writeFileSync5 } from "fs";
11132
+ import { homedir as homedir16 } from "os";
11133
+ import { dirname as dirname3, join as join19 } from "path";
11033
11134
  var CONTROL_ID = "agentbox";
11034
11135
  function cmuxDockPath(env = process.env) {
11035
11136
  const xdg = env["XDG_CONFIG_HOME"];
11036
- const base = xdg && xdg.length > 0 ? xdg : join18(homedir15(), ".config");
11037
- return join18(base, "cmux", "dock.json");
11137
+ const base = xdg && xdg.length > 0 ? xdg : join19(homedir16(), ".config");
11138
+ return join19(base, "cmux", "dock.json");
11038
11139
  }
11039
11140
  function upsertAgentboxControl(doc, opts) {
11040
11141
  const controls = Array.isArray(doc.controls) ? doc.controls : [];
@@ -11064,14 +11165,14 @@ var installCmuxCommand = new Command27("cmux").description(
11064
11165
  height: parseHeight(opts.height)
11065
11166
  };
11066
11167
  let doc = { controls: [] };
11067
- if (existsSync7(dockPath)) {
11068
- const raw = readFileSync(dockPath, "utf8");
11168
+ if (existsSync8(dockPath)) {
11169
+ const raw = readFileSync2(dockPath, "utf8");
11069
11170
  try {
11070
11171
  const parsed = JSON.parse(raw);
11071
11172
  if (parsed && typeof parsed === "object") doc = parsed;
11072
11173
  } catch {
11073
11174
  if (!opts.force) {
11074
- log32.error(
11175
+ log33.error(
11075
11176
  `existing dock config is not valid JSON: ${dockPath}
11076
11177
  fix it by hand, or pass --force to back it up and write a fresh one`
11077
11178
  );
@@ -11079,7 +11180,7 @@ fix it by hand, or pass --force to back it up and write a fresh one`
11079
11180
  }
11080
11181
  if (!opts.dryRun) {
11081
11182
  renameSync2(dockPath, dockPath + ".bak");
11082
- log32.warn(`backed up unparseable dock config to ${dockPath}.bak`);
11183
+ log33.warn(`backed up unparseable dock config to ${dockPath}.bak`);
11083
11184
  }
11084
11185
  doc = { controls: [] };
11085
11186
  }
@@ -11092,8 +11193,8 @@ fix it by hand, or pass --force to back it up and write a fresh one`
11092
11193
  outro6(`would write ${dockPath}`);
11093
11194
  return;
11094
11195
  }
11095
- mkdirSync5(dirname2(dockPath), { recursive: true });
11096
- writeFileSync4(dockPath, json);
11196
+ mkdirSync6(dirname3(dockPath), { recursive: true });
11197
+ writeFileSync5(dockPath, json);
11097
11198
  intro7("AgentBox cmux dock panel");
11098
11199
  note2(
11099
11200
  `Wrote ${dockPath}
@@ -11107,6 +11208,217 @@ To see it:
11107
11208
  outro6("done");
11108
11209
  });
11109
11210
 
11211
+ // src/commands/install-herdr.ts
11212
+ import { intro as intro8, log as log34, note as note3, outro as outro7 } from "@clack/prompts";
11213
+ import { Command as Command28, Option } from "commander";
11214
+ import { spawnSync as spawnSync4 } from "child_process";
11215
+ import { chmodSync, existsSync as existsSync9, mkdirSync as mkdirSync7, readFileSync as readFileSync3, writeFileSync as writeFileSync6 } from "fs";
11216
+ import { homedir as homedir17 } from "os";
11217
+ import { dirname as dirname4, join as join20 } from "path";
11218
+ var PLUGIN_VERSION = "0.1.0";
11219
+ function herdrPluginDir(env = process.env) {
11220
+ const home = env["AGENTBOX_HOME"] ?? join20(homedir17(), ".agentbox");
11221
+ return join20(home, "herdr", "plugin");
11222
+ }
11223
+ function herdrConfigPath(env = process.env) {
11224
+ const override = env["HERDR_CONFIG_PATH"];
11225
+ if (override && override.length > 0) return override;
11226
+ const xdg = env["XDG_CONFIG_HOME"];
11227
+ const base = xdg && xdg.length > 0 ? xdg : join20(homedir17(), ".config");
11228
+ return join20(base, "herdr", "config.toml");
11229
+ }
11230
+ function herdrBinary(env = process.env) {
11231
+ const b = env["HERDR_BIN_PATH"];
11232
+ return b && b.length > 0 ? b : "herdr";
11233
+ }
11234
+ function buildHerdrManifest() {
11235
+ return `# AgentBox Herdr plugin (https://herdr.dev/docs/plugins).
11236
+ # Install: herdr plugin install madarco/agentbox/herdr-plugin
11237
+ # Or, with the AgentBox CLI already installed: agentbox install herdr
11238
+ #
11239
+ # agentbox commands route through ./agentbox-shim.sh, written at install time
11240
+ # with the absolute path to your AgentBox CLI \u2014 Herdr runs plugin commands as a
11241
+ # bare argv with no shell expansion / unreliable PATH (e.g. under nvm).
11242
+ id = "agentbox"
11243
+ name = "AgentBox"
11244
+ version = "${PLUGIN_VERSION}"
11245
+ min_herdr_version = "0.7.0"
11246
+ platforms = ["linux", "macos", "windows"]
11247
+ description = "AgentBox: live boxes overlay, shortcuts, and Ctrl+click to open a box web app."
11248
+
11249
+ [[build]]
11250
+ command = ["sh", "build.sh"]
11251
+
11252
+ [[panes]]
11253
+ id = "boxes"
11254
+ title = "AgentBox"
11255
+ placement = "overlay"
11256
+ command = ["sh", "agentbox-shim.sh", "list", "--herdr", "--watch"]
11257
+
11258
+ [[actions]]
11259
+ id = "boxes"
11260
+ title = "AgentBox: boxes overlay"
11261
+ contexts = ["workspace"]
11262
+ command = ["herdr", "plugin", "pane", "open", "--plugin", "agentbox", "--entrypoint", "boxes", "--placement", "overlay"]
11263
+
11264
+ [[actions]]
11265
+ id = "new"
11266
+ title = "AgentBox: new box"
11267
+ contexts = ["workspace"]
11268
+ command = ["sh", "agentbox-shim.sh", "herdr", "new"]
11269
+
11270
+ [[actions]]
11271
+ id = "link"
11272
+ title = "AgentBox: open box link"
11273
+ contexts = ["workspace"]
11274
+ command = ["sh", "agentbox-shim.sh", "herdr", "link"]
11275
+
11276
+ # Keybindings are NOT declared here \u2014 Herdr ignores manifest keys. They're added
11277
+ # to the user's config.toml by \`agentbox install herdr\` / the build step.
11278
+
11279
+ [[link_handlers]]
11280
+ id = "web"
11281
+ title = "AgentBox: open box web app"
11282
+ pattern = "^agentbox://"
11283
+ action = "link"
11284
+ `;
11285
+ }
11286
+ function shq(s) {
11287
+ return `'${s.replace(/'/g, `'\\''`)}'`;
11288
+ }
11289
+ function herdrShimContent(node, cliEntry) {
11290
+ return `#!/bin/sh
11291
+ # Generated by \`agentbox install herdr\`. Routes Herdr plugin commands to the
11292
+ # AgentBox CLI by absolute path (Herdr runs commands without a reliable PATH).
11293
+ exec ${shq(node)} ${shq(cliEntry)} "$@"
11294
+ `;
11295
+ }
11296
+ function herdrBuildScript() {
11297
+ return `#!/bin/sh
11298
+ # AgentBox Herdr plugin bootstrap \u2014 runs during \`herdr plugin install\`.
11299
+ # (Local installs via \`agentbox install herdr\` set things up directly instead.)
11300
+ AGB="$(command -v agentbox || true)"
11301
+ if [ -z "$AGB" ]; then
11302
+ echo "AgentBox CLI not found \u2014 the Herdr plugin is installed but inert."
11303
+ echo "Install it and finish setup:"
11304
+ echo " npm i -g @madarco/agentbox && agentbox install herdr"
11305
+ exit 0
11306
+ fi
11307
+ "$AGB" install herdr --plugin-keys || \\
11308
+ echo "AgentBox plugin setup hit an issue; finish with: agentbox install herdr"
11309
+ exit 0
11310
+ `;
11311
+ }
11312
+ var KEY_BEGIN = "# >>> agentbox install herdr (managed) >>>";
11313
+ var KEY_END = "# <<< agentbox install herdr (managed) <<<";
11314
+ function herdrKeybindingsBlock() {
11315
+ return `${KEY_BEGIN}
11316
+ # Remove this block (or run \`herdr config reset-keys\`) to drop the shortcuts.
11317
+ [[keys.command]]
11318
+ key = "prefix+a"
11319
+ type = "plugin_action"
11320
+ command = "agentbox.boxes"
11321
+ description = "AgentBox: boxes overlay"
11322
+
11323
+ [[keys.command]]
11324
+ key = "prefix+shift+a"
11325
+ type = "plugin_action"
11326
+ command = "agentbox.new"
11327
+ description = "AgentBox: new box"
11328
+ ${KEY_END}`;
11329
+ }
11330
+ function upsertHerdrKeybindings(existing, block) {
11331
+ const stripped = existing.replace(
11332
+ new RegExp(`\\n*${escapeRe(KEY_BEGIN)}[\\s\\S]*?${escapeRe(KEY_END)}\\n*`, "g"),
11333
+ "\n"
11334
+ );
11335
+ const head = stripped.replace(/\s+$/, "");
11336
+ return (head.length > 0 ? `${head}
11337
+
11338
+ ` : "") + block + "\n";
11339
+ }
11340
+ function escapeRe(s) {
11341
+ return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
11342
+ }
11343
+ function writeShim(dir) {
11344
+ const p = join20(dir, "agentbox-shim.sh");
11345
+ writeFileSync6(p, herdrShimContent(process.execPath, process.argv[1] ?? "agentbox"));
11346
+ chmodSync(p, 493);
11347
+ }
11348
+ function applyKeybindings() {
11349
+ const cfg = herdrConfigPath();
11350
+ const existing = existsSync9(cfg) ? readFileSync3(cfg, "utf8") : "";
11351
+ mkdirSync7(dirname4(cfg), { recursive: true });
11352
+ writeFileSync6(cfg, upsertHerdrKeybindings(existing, herdrKeybindingsBlock()));
11353
+ spawnSync4(herdrBinary(), ["server", "reload-config"], { stdio: "ignore" });
11354
+ return cfg;
11355
+ }
11356
+ var installHerdrCommand = new Command28("herdr").description(
11357
+ "Install a Herdr plugin: a boxes-list overlay, keyboard shortcuts, and Ctrl+click to open a box web app."
11358
+ ).option("--dry-run", "print the generated files without writing or linking anything").addOption(new Option("--plugin-keys", "finish setup for a herdr-installed plugin").hideHelp()).action((opts) => {
11359
+ if (opts.pluginKeys) {
11360
+ writeShim(process.cwd());
11361
+ const cfg2 = applyKeybindings();
11362
+ process.stdout.write(
11363
+ `AgentBox: Herdr shortcuts installed (prefix a / prefix shift a) in ${cfg2}.
11364
+ `
11365
+ );
11366
+ return;
11367
+ }
11368
+ const dir = herdrPluginDir();
11369
+ const file = join20(dir, "herdr-plugin.toml");
11370
+ const cfgPath = herdrConfigPath();
11371
+ if (opts.dryRun) {
11372
+ intro8("agentbox install herdr (dry run)");
11373
+ process.stdout.write(`# --- ${file} ---
11374
+ ${buildHerdrManifest()}
11375
+ `);
11376
+ process.stdout.write(`# --- ${join20(dir, "build.sh")} ---
11377
+ ${herdrBuildScript()}
11378
+ `);
11379
+ process.stdout.write(
11380
+ `# --- ${join20(dir, "agentbox-shim.sh")} ---
11381
+ ${herdrShimContent(process.execPath, process.argv[1] ?? "agentbox")}
11382
+ `
11383
+ );
11384
+ process.stdout.write(`# --- appended to ${cfgPath} ---
11385
+ ${herdrKeybindingsBlock()}
11386
+ `);
11387
+ outro7(`would write ${dir}/*, edit ${cfgPath}, and run \`herdr plugin link ${dir}\``);
11388
+ return;
11389
+ }
11390
+ mkdirSync7(dir, { recursive: true });
11391
+ writeFileSync6(file, buildHerdrManifest());
11392
+ const buildPath = join20(dir, "build.sh");
11393
+ writeFileSync6(buildPath, herdrBuildScript());
11394
+ chmodSync(buildPath, 493);
11395
+ writeShim(dir);
11396
+ const cfg = applyKeybindings();
11397
+ intro8("AgentBox Herdr plugin");
11398
+ const bin = herdrBinary();
11399
+ let linked = spawnSync4(bin, ["plugin", "link", dir], { stdio: "ignore" });
11400
+ if (linked.status !== 0) {
11401
+ spawnSync4(bin, ["plugin", "unlink", "agentbox"], { stdio: "ignore" });
11402
+ linked = spawnSync4(bin, ["plugin", "link", dir], { stdio: "ignore" });
11403
+ }
11404
+ if (linked.status === 0) {
11405
+ spawnSync4(bin, ["server", "reload-config"], { stdio: "ignore" });
11406
+ } else {
11407
+ log34.warn(
11408
+ `could not run \`${bin} plugin link\` (is Herdr installed / running?).
11409
+ Run it yourself: herdr plugin link ${dir} && herdr server reload-config`
11410
+ );
11411
+ }
11412
+ note3(
11413
+ `Wrote ${dir}/
11414
+ Added shortcuts to ${cfg}
11415
+ ` + (linked.status === 0 ? `Linked with: herdr plugin link ${dir}
11416
+ ` : "") + '\nShortcuts (under Herdr prefix, default Ctrl+b \u2014 press the prefix, then the key):\n prefix a boxes overlay (all boxes)\n prefix shift a new box in the current project\n\nCtrl+click a box name in the overlay to open its web app.\n(remove the shortcuts with `herdr config reset-keys`, or by re-running.)\n\nTip: set the sidebar agent panel scope to "all" (agent_panel_scope = "all"\nin ~/.config/herdr/config.toml, or toggle it in the sidebar) so attached\nboxes stay visible when you switch projects.',
11417
+ "Installed"
11418
+ );
11419
+ outro7("done");
11420
+ });
11421
+
11110
11422
  // src/commands/install.ts
11111
11423
  var MANAGED_SENTINEL = "<!-- agentbox-managed:v1 -->";
11112
11424
  var LOGO_L1 = "\u2584\u2580\u2588 \u2588\u2580\u2580 \u2588\u2580\u2580 \u2588\u2584\u2591\u2588 \u2580\u2588\u2580 \u2588\u2584\u2584 \u2588\u2580\u2588 \u2580\u2584\u2580";
@@ -11187,34 +11499,34 @@ ${LOGO_L2}\x1B[0m` + SYNC_END2);
11187
11499
  }
11188
11500
  var LEGACY_INFO_MARKER = "Drive AgentBox from the host:";
11189
11501
  function installTargets() {
11190
- const home = homedir16();
11191
- const claudeSkills = join19(home, ".claude", "skills");
11502
+ const home = homedir18();
11503
+ const claudeSkills = join21(home, ".claude", "skills");
11192
11504
  return [
11193
- { src: join19("agentbox", "SKILL.md"), dest: join19(claudeSkills, "agentbox", "SKILL.md") },
11505
+ { src: join21("agentbox", "SKILL.md"), dest: join21(claudeSkills, "agentbox", "SKILL.md") },
11194
11506
  {
11195
- src: join19("agentbox-info", "SKILL.md"),
11196
- dest: join19(claudeSkills, "agentbox-info", "SKILL.md")
11507
+ src: join21("agentbox-info", "SKILL.md"),
11508
+ dest: join21(claudeSkills, "agentbox-info", "SKILL.md")
11197
11509
  },
11198
11510
  {
11199
- src: join19("codex", "agentbox.md"),
11200
- dest: join19(home, ".codex", "prompts", "agentbox.md"),
11201
- gateDir: join19(home, ".codex")
11511
+ src: join21("codex", "agentbox.md"),
11512
+ dest: join21(home, ".codex", "prompts", "agentbox.md"),
11513
+ gateDir: join21(home, ".codex")
11202
11514
  },
11203
11515
  {
11204
- src: join19("opencode", "agentbox.md"),
11205
- dest: join19(home, ".config", "opencode", "commands", "agentbox.md"),
11206
- gateDir: join19(home, ".config", "opencode")
11516
+ src: join21("opencode", "agentbox.md"),
11517
+ dest: join21(home, ".config", "opencode", "commands", "agentbox.md"),
11518
+ gateDir: join21(home, ".config", "opencode")
11207
11519
  }
11208
11520
  ];
11209
11521
  }
11210
11522
  function resolveHostSkillsDir() {
11211
- const here = dirname3(fileURLToPath(import.meta.url));
11523
+ const here = dirname5(fileURLToPath(import.meta.url));
11212
11524
  const candidates = [
11213
11525
  resolve4(here, "..", "share", "host-skills"),
11214
11526
  resolve4(here, "..", "..", "share", "host-skills")
11215
11527
  ];
11216
11528
  for (const c of candidates) {
11217
- if (existsSync8(c)) return c;
11529
+ if (existsSync10(c)) return c;
11218
11530
  }
11219
11531
  throw new Error(`could not locate bundled host skills; tried:
11220
11532
  ${candidates.join("\n ")}`);
@@ -11230,11 +11542,11 @@ function isSourceCheckout(srcDir) {
11230
11542
  return !srcDir.split(sep).includes("node_modules");
11231
11543
  }
11232
11544
  function writableReason(target, force) {
11233
- if (!existsSync8(target)) {
11545
+ if (!existsSync10(target)) {
11234
11546
  if (isSymlink(target)) return "managed";
11235
11547
  return "new";
11236
11548
  }
11237
- const existing = readFileSync2(target, "utf8");
11549
+ const existing = readFileSync4(target, "utf8");
11238
11550
  if (existing.includes(MANAGED_SENTINEL) || existing.includes(LEGACY_INFO_MARKER)) {
11239
11551
  return "managed";
11240
11552
  }
@@ -11250,13 +11562,13 @@ function installHostSkills(opts = {}) {
11250
11562
  const blocked = [];
11251
11563
  let skipped = 0;
11252
11564
  for (const t of installTargets()) {
11253
- const src = join19(srcDir, t.src);
11254
- if (!existsSync8(src)) {
11565
+ const src = join21(srcDir, t.src);
11566
+ if (!existsSync10(src)) {
11255
11567
  if (!quiet) prompt_exports.log.warn(`bundled file missing (skipped): ${src}`);
11256
11568
  skipped++;
11257
11569
  continue;
11258
11570
  }
11259
- if (t.gateDir && !existsSync8(t.gateDir)) continue;
11571
+ if (t.gateDir && !existsSync10(t.gateDir)) continue;
11260
11572
  const reason = writableReason(t.dest, force);
11261
11573
  if (reason === "skip") {
11262
11574
  if (!quiet) prompt_exports.log.warn(`user-modified file at ${t.dest}, skipping; pass --force to overwrite`);
@@ -11269,13 +11581,13 @@ function installHostSkills(opts = {}) {
11269
11581
  written.push(t.dest);
11270
11582
  continue;
11271
11583
  }
11272
- mkdirSync6(dirname3(t.dest), { recursive: true });
11584
+ mkdirSync8(dirname5(t.dest), { recursive: true });
11273
11585
  if (link) {
11274
11586
  rmSync(t.dest, { force: true });
11275
11587
  symlinkSync2(resolve4(srcDir, t.src), t.dest);
11276
11588
  } else {
11277
11589
  if (isSymlink(t.dest)) rmSync(t.dest, { force: true });
11278
- writeFileSync5(t.dest, readFileSync2(src, "utf8"));
11590
+ writeFileSync7(t.dest, readFileSync4(src, "utf8"));
11279
11591
  }
11280
11592
  written.push(t.dest);
11281
11593
  }
@@ -11305,7 +11617,7 @@ function ensureTty() {
11305
11617
  async function runProviderLogin(name) {
11306
11618
  if (name === "docker") return true;
11307
11619
  if (name === "daytona") {
11308
- const mod2 = await import("./dist-TEKY3GFT.js");
11620
+ const mod2 = await import("./dist-7BS2JS27.js");
11309
11621
  const status2 = await mod2.getDaytonaStatus();
11310
11622
  if (status2.configured) {
11311
11623
  prompt_exports.log.info("daytona: already configured");
@@ -11317,7 +11629,7 @@ async function runProviderLogin(name) {
11317
11629
  return true;
11318
11630
  }
11319
11631
  if (name === "hetzner") {
11320
- const mod2 = await import("./dist-CNABE32V.js");
11632
+ const mod2 = await import("./dist-4BHW7DCO.js");
11321
11633
  const status2 = mod2.readHetznerCredStatus();
11322
11634
  if (status2.source !== "none") {
11323
11635
  prompt_exports.log.info("hetzner: already configured");
@@ -11329,7 +11641,7 @@ async function runProviderLogin(name) {
11329
11641
  return true;
11330
11642
  }
11331
11643
  if (name === "vercel") {
11332
- const mod2 = await import("./dist-CROGTJ7N.js");
11644
+ const mod2 = await import("./dist-T7ESSBCZ.js");
11333
11645
  const status2 = mod2.readVercelCredStatus();
11334
11646
  if (status2.auth !== "none") {
11335
11647
  prompt_exports.log.info(`vercel: already configured (${status2.auth})`);
@@ -11340,7 +11652,7 @@ async function runProviderLogin(name) {
11340
11652
  await mod2.ensureVercelCredentials();
11341
11653
  return true;
11342
11654
  }
11343
- const mod = await import("./dist-BO2R55FX.js");
11655
+ const mod = await import("./dist-3UYQZOAO.js");
11344
11656
  const status = mod.readE2bCredStatus();
11345
11657
  if (status.auth !== "none") {
11346
11658
  prompt_exports.log.info(`e2b: already configured (${status.auth})`);
@@ -11455,9 +11767,10 @@ pass \`agentbox install --skills-only --force\` to overwrite`
11455
11767
  (0, prompt_exports.outro)(
11456
11768
  opts.fromAutoTrigger ? "\u2728 Setup complete \u2014 continuing with your command\u2026" : "\u2728 Setup complete"
11457
11769
  );
11770
+ await maybePromptStar({ trigger: "install" });
11458
11771
  return true;
11459
11772
  }
11460
- var installCommand = new Command28("install").description(
11773
+ var installCommand = new Command29("install").description(
11461
11774
  "Interactive setup wizard: system check, pick a provider, log in, prepare its base image/snapshot, and install the host /agentbox skill. `--skills-only` runs just the skill install."
11462
11775
  ).option(
11463
11776
  "--skills-only",
@@ -11498,10 +11811,11 @@ var installCommand = new Command28("install").description(
11498
11811
  });
11499
11812
  installCommand.enablePositionalOptions();
11500
11813
  installCommand.addCommand(installCmuxCommand);
11814
+ installCommand.addCommand(installHerdrCommand);
11501
11815
 
11502
11816
  // src/commands/doctor.ts
11503
- import { Command as Command29 } from "commander";
11504
- var doctorCommand = new Command29("doctor").description(
11817
+ import { Command as Command30 } from "commander";
11818
+ var doctorCommand = new Command30("doctor").description(
11505
11819
  "Diagnose system compatibility and provider readiness (Node, git, ssh, Docker daemon, provider credentials, prepared snapshots)."
11506
11820
  ).option(
11507
11821
  "-p, --provider <name>",
@@ -11567,7 +11881,7 @@ function formatUnknown(err) {
11567
11881
  }
11568
11882
 
11569
11883
  // src/commands/git.ts
11570
- import { Command as Command30 } from "commander";
11884
+ import { Command as Command31 } from "commander";
11571
11885
  var WORKSPACE = "/workspace";
11572
11886
  var TOKEN_TTL_MS = 12e4;
11573
11887
  async function runInBox(box, argv2) {
@@ -11599,7 +11913,7 @@ function buildPredictedGhPrParams(ghArgs) {
11599
11913
  async function exitWith(code) {
11600
11914
  process.exit(code);
11601
11915
  }
11602
- var pushCommand = new Command30("push").description("Push the box's branch via the host relay (host creds, no prompt)").argument("<box>", "box ref: project index, id, id prefix, name, or container").argument("[args...]", "extra flags forwarded to `agentbox-ctl git push` (e.g. --force-with-lease, --tags)").option("--remote <name>", "remote name (default: origin)").allowExcessArguments(true).allowUnknownOption(true).action(async (boxRef, args, opts) => {
11916
+ var pushCommand = new Command31("push").description("Push the box's branch via the host relay (host creds, no prompt)").argument("<box>", "box ref: project index, id, id prefix, name, or container").argument("[args...]", "extra flags forwarded to `agentbox-ctl git push` (e.g. --force-with-lease, --tags)").option("--remote <name>", "remote name (default: origin)").allowExcessArguments(true).allowUnknownOption(true).action(async (boxRef, args, opts) => {
11603
11917
  try {
11604
11918
  const box = await resolveBoxOrExit(boxRef);
11605
11919
  const predicted = buildPredictedGitParams(opts.remote, args);
@@ -11612,7 +11926,7 @@ var pushCommand = new Command30("push").description("Push the box's branch via t
11612
11926
  handleLifecycleError(err);
11613
11927
  }
11614
11928
  });
11615
- var fetchCommand = new Command30("fetch").description("Fetch via the host relay (refs land in the shared .git)").argument("<box>", "box ref").argument("[args...]", "extra flags forwarded to `agentbox-ctl git fetch` (e.g. --prune)").option("--remote <name>", "remote name (default: origin)").allowExcessArguments(true).allowUnknownOption(true).action(async (boxRef, args, opts) => {
11929
+ var fetchCommand = new Command31("fetch").description("Fetch via the host relay (refs land in the shared .git)").argument("<box>", "box ref").argument("[args...]", "extra flags forwarded to `agentbox-ctl git fetch` (e.g. --prune)").option("--remote <name>", "remote name (default: origin)").allowExcessArguments(true).allowUnknownOption(true).action(async (boxRef, args, opts) => {
11616
11930
  try {
11617
11931
  const box = await resolveBoxOrExit(boxRef);
11618
11932
  const predicted = buildPredictedGitParams(opts.remote, args);
@@ -11625,7 +11939,7 @@ var fetchCommand = new Command30("fetch").description("Fetch via the host relay
11625
11939
  handleLifecycleError(err);
11626
11940
  }
11627
11941
  });
11628
- var pullCommand = new Command30("pull").description(
11942
+ var pullCommand = new Command31("pull").description(
11629
11943
  "Fetch via the relay then merge in /workspace. With <branch>: first `git checkout <branch>` so the box switches base branch and pulls latest \u2014 useful for reusing a box on a new task."
11630
11944
  ).argument("<box>", "box ref").argument("[branch]", "optional branch to switch to before pulling (e.g. main)").argument("[args...]", "extra flags forwarded to `agentbox-ctl git pull`").option("--remote <name>", "remote name (default: origin)").option("--ff-only", "pass --ff-only to the in-box merge").allowExcessArguments(true).allowUnknownOption(true).action(
11631
11945
  async (boxRef, branch, args, opts) => {
@@ -11647,7 +11961,7 @@ var pullCommand = new Command30("pull").description(
11647
11961
  }
11648
11962
  }
11649
11963
  );
11650
- var checkoutCommand = new Command30("checkout").description("Change the box's working branch (runs `git checkout <branch>` in /workspace)").argument("<box>", "box ref").argument("<branch>", "branch to check out inside the box").argument("[args...]", "extra flags forwarded to `git checkout`").allowExcessArguments(true).allowUnknownOption(true).action(async (boxRef, branch, args) => {
11964
+ var checkoutCommand = new Command31("checkout").description("Change the box's working branch (runs `git checkout <branch>` in /workspace)").argument("<box>", "box ref").argument("<branch>", "branch to check out inside the box").argument("[args...]", "extra flags forwarded to `git checkout`").allowExcessArguments(true).allowUnknownOption(true).action(async (boxRef, branch, args) => {
11651
11965
  try {
11652
11966
  const box = await resolveBoxOrExit(boxRef);
11653
11967
  await exitWith(await runAndStream(box, ["git", "checkout", branch, ...args]));
@@ -11655,7 +11969,7 @@ var checkoutCommand = new Command30("checkout").description("Change the box's wo
11655
11969
  handleLifecycleError(err);
11656
11970
  }
11657
11971
  });
11658
- var statusCommand = new Command30("status").description("Run `git status` in the box's /workspace (read-only, no relay)").argument("<box>", "box ref").argument("[args...]", "extra flags forwarded to `git status`").allowExcessArguments(true).allowUnknownOption(true).action(async (boxRef, args) => {
11972
+ var statusCommand = new Command31("status").description("Run `git status` in the box's /workspace (read-only, no relay)").argument("<box>", "box ref").argument("[args...]", "extra flags forwarded to `git status`").allowExcessArguments(true).allowUnknownOption(true).action(async (boxRef, args) => {
11659
11973
  try {
11660
11974
  const box = await resolveBoxOrExit(boxRef);
11661
11975
  await exitWith(await runAndStream(box, ["git", "status", ...args]));
@@ -11681,7 +11995,7 @@ function injectPrCreateHead2(op, box, args) {
11681
11995
  return injectPrCreateHead(op, rootWt?.branch, args);
11682
11996
  }
11683
11997
  function buildPrSubcommand(op) {
11684
- return new Command30(op).description(PR_OP_DESCRIPTIONS[op]).argument("<box>", "box ref").argument(
11998
+ return new Command31(op).description(PR_OP_DESCRIPTIONS[op]).argument("<box>", "box ref").argument(
11685
11999
  "[args...]",
11686
12000
  "extra flags forwarded to `gh pr <op>` (e.g. --title, --body, --label, --draft, --json)"
11687
12001
  ).allowExcessArguments(true).allowUnknownOption(true).action(async (boxRef, args) => {
@@ -11697,27 +12011,27 @@ function buildPrSubcommand(op) {
11697
12011
  }
11698
12012
  });
11699
12013
  }
11700
- var prCommand = new Command30("pr").description(
12014
+ var prCommand = new Command31("pr").description(
11701
12015
  "PR operations against a box's branch via the host `gh` CLI"
11702
12016
  );
11703
12017
  for (const op of GH_PR_OPS) {
11704
12018
  const sub = buildPrSubcommand(op);
11705
12019
  prCommand.addCommand(sub, op === "create" ? { isDefault: true } : void 0);
11706
12020
  }
11707
- var gitCommand = new Command30("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);
12021
+ var gitCommand = new Command31("git").description("Run git / gh pr operations against a box from the host").addCommand(pushCommand).addCommand(fetchCommand).addCommand(pullCommand).addCommand(checkoutCommand).addCommand(statusCommand).addCommand(prCommand);
11708
12022
 
11709
12023
  // src/commands/list.ts
11710
- import { log as log34 } from "@clack/prompts";
11711
- import { Command as Command31 } from "commander";
12024
+ import { log as log36 } from "@clack/prompts";
12025
+ import { Command as Command32 } from "commander";
11712
12026
  import { pathToFileURL } from "url";
11713
12027
 
11714
12028
  // src/hyperlink.ts
11715
12029
  import { supportsHyperlink } from "supports-hyperlinks";
11716
12030
  var ESC2 = "\x1B";
11717
12031
  var ST = `${ESC2}\\`;
11718
- function hyperlink(label, url, stream) {
12032
+ function hyperlink(label, url, stream, force = false) {
11719
12033
  const out = stream ?? process.stdout;
11720
- if (!supportsHyperlink(out)) return label;
12034
+ if (!force && !supportsHyperlink(out)) return label;
11721
12035
  return `${ESC2}]8;;${url}${ST}${label}${ESC2}]8;;${ST}`;
11722
12036
  }
11723
12037
 
@@ -11966,7 +12280,7 @@ function projectHeader(label, color, width) {
11966
12280
  const h = `\u2500\u2500 ${name} \u2500\u2500`;
11967
12281
  return color ? colorize(h, "dim") : h;
11968
12282
  }
11969
- function renderCmuxRows(boxes, color, width) {
12283
+ function renderCmuxRows(boxes, color, width, linkNames = false) {
11970
12284
  const groups = /* @__PURE__ */ new Map();
11971
12285
  for (const b of boxes) {
11972
12286
  const key = b.projectRoot ?? "";
@@ -11982,7 +12296,9 @@ function renderCmuxRows(boxes, color, width) {
11982
12296
  lines.push(projectHeader(projectLabel(root), color, width));
11983
12297
  for (const b of group) {
11984
12298
  const idx = b.projectIndex ? `${String(b.projectIndex)} ` : "";
11985
- lines.push(`${idx}${tailKeep(b.name, Math.max(1, width - idx.length))}`);
12299
+ const disp = tailKeep(b.name, Math.max(1, width - idx.length));
12300
+ const name = linkNames ? hyperlink(disp, `agentbox://web/${b.id}`, void 0, true) : disp;
12301
+ lines.push(`${idx}${name}`);
11986
12302
  lines.push(" " + cmuxStatusCell(b, color));
11987
12303
  }
11988
12304
  }
@@ -11991,11 +12307,11 @@ function renderCmuxRows(boxes, color, width) {
11991
12307
  function cmuxEmptyMessage() {
11992
12308
  return "no boxes \xB7 agentbox create";
11993
12309
  }
11994
- async function buildCmuxText(live, color) {
12310
+ async function buildCmuxText(live, color, linkNames = false) {
11995
12311
  const { boxes } = await scopedBoxes(true, live);
11996
12312
  if (boxes.length === 0) return cmuxEmptyMessage();
11997
12313
  const width = process.stdout.columns ?? 30;
11998
- return renderCmuxRows(boxes, color, width);
12314
+ return renderCmuxRows(boxes, color, width, linkNames);
11999
12315
  }
12000
12316
  function renderTable(boxes, stream) {
12001
12317
  const header = ["N", "NAME", "STATE", "AGENT", "SHELLS", "PROVIDER", "URL", "WORKSPACE"];
@@ -12064,24 +12380,30 @@ async function buildListText(all, live) {
12064
12380
  ${table}`;
12065
12381
  }
12066
12382
  var listCommand2 = withWatchOptions(
12067
- new Command31("list").alias("ls").description("List agent boxes in the current project (-g for all)").option("-j, --json", "machine-readable JSON output").option("-g, --global", "include boxes from all projects").option(
12383
+ new Command32("list").alias("ls").description("List agent boxes in the current project (-g for all)").option("-j, --json", "machine-readable JSON output").option("-g, --global", "include boxes from all projects").option(
12068
12384
  "--live",
12069
12385
  "probe live cloud state via the provider SDK (slower; default: last host-known state)"
12070
- ).option("--cmux", "compact output for the cmux dock sidebar (narrow, 2 lines per box)")
12386
+ ).option("--cmux", "compact output for the cmux dock sidebar (narrow, 2 lines per box)").option(
12387
+ "--herdr",
12388
+ "compact output for the Herdr boxes overlay (like --cmux; box names link to the box web app)"
12389
+ )
12071
12390
  ).action(async (opts) => {
12072
12391
  if (opts.json && opts.watch) {
12073
- log34.error("cannot combine --json with --watch");
12392
+ log36.error("cannot combine --json with --watch");
12074
12393
  process.exit(2);
12075
12394
  }
12076
12395
  const all = opts.global ?? false;
12077
12396
  const live = opts.live ?? false;
12078
- if (opts.cmux) {
12397
+ if (opts.cmux || opts.herdr) {
12079
12398
  const color = !!process.stdout.isTTY && !process.env.NO_COLOR;
12399
+ const linkNames = !!opts.herdr;
12080
12400
  if (opts.watch) {
12081
- await watchRender(() => buildCmuxText(live, color), opts.interval, { hideStatusLine: true });
12401
+ await watchRender(() => buildCmuxText(live, color, linkNames), opts.interval, {
12402
+ hideStatusLine: true
12403
+ });
12082
12404
  return;
12083
12405
  }
12084
- process.stdout.write(await buildCmuxText(live, color) + "\n");
12406
+ process.stdout.write(await buildCmuxText(live, color, linkNames) + "\n");
12085
12407
  return;
12086
12408
  }
12087
12409
  if (opts.watch) {
@@ -12112,11 +12434,11 @@ var listCommand2 = withWatchOptions(
12112
12434
  });
12113
12435
 
12114
12436
  // src/commands/logs.ts
12115
- import { log as log35 } from "@clack/prompts";
12116
- import { Command as Command32 } from "commander";
12437
+ import { log as log37 } from "@clack/prompts";
12438
+ import { Command as Command33 } from "commander";
12117
12439
  import { spawn as spawn3 } from "child_process";
12118
12440
  var DAEMON_LOG_PATH = "/var/log/agentbox/ctl-daemon.log";
12119
- var logsCommand = new Command32("logs").description("Print recent log lines from a box service; -f to stream").argument(
12441
+ var logsCommand = new Command33("logs").description("Print recent log lines from a box service; -f to stream").argument(
12120
12442
  "[box]",
12121
12443
  "box ref (optional when cwd has exactly 1 box): project index, id, id prefix, name, or container"
12122
12444
  ).argument("[service]", "service name from agentbox.yaml").option("-n, --tail <n>", "how many recent lines to print first", "200").option("-f, --follow", "keep the connection open and stream new lines").option(
@@ -12134,9 +12456,9 @@ var logsCommand = new Command32("logs").description("Print recent log lines from
12134
12456
  service = boxArg;
12135
12457
  }
12136
12458
  if (!service && !opts.daemon) {
12137
- log35.error("missing <service> argument");
12138
- log35.info("usage: agentbox logs [box] <service> [-n N] [-f]");
12139
- log35.info(" agentbox logs [box] --daemon [-n N] [-f]");
12459
+ log37.error("missing <service> argument");
12460
+ log37.info("usage: agentbox logs [box] <service> [-n N] [-f]");
12461
+ log37.info(" agentbox logs [box] --daemon [-n N] [-f]");
12140
12462
  process.exit(2);
12141
12463
  }
12142
12464
  const box = await resolveBoxOrExit(idOrName);
@@ -12147,7 +12469,7 @@ var logsCommand = new Command32("logs").description("Print recent log lines from
12147
12469
  if (!opts.follow) {
12148
12470
  const proc = await provider.exec(box, args, { user: "vscode" });
12149
12471
  if (proc.exitCode !== 0) {
12150
- log35.error(
12472
+ log37.error(
12151
12473
  `${opts.daemon ? "daemon log" : "agentbox-ctl logs"} failed: ${proc.stderr || proc.stdout}`
12152
12474
  );
12153
12475
  process.exit(1);
@@ -12203,12 +12525,12 @@ var logsCommand = new Command32("logs").description("Print recent log lines from
12203
12525
  });
12204
12526
 
12205
12527
  // src/commands/open.ts
12206
- import { log as log36 } from "@clack/prompts";
12528
+ import { log as log38 } from "@clack/prompts";
12207
12529
  import { execa as execa5 } from "execa";
12208
- import { existsSync as existsSync9, mkdirSync as mkdirSync7 } from "fs";
12209
- import { homedir as homedir17 } from "os";
12210
- import { join as join20 } from "path";
12211
- import { Command as Command33 } from "commander";
12530
+ import { existsSync as existsSync11, mkdirSync as mkdirSync9 } from "fs";
12531
+ import { homedir as homedir19 } from "os";
12532
+ import { join as join22 } from "path";
12533
+ import { Command as Command34 } from "commander";
12212
12534
 
12213
12535
  // src/commands/path.ts
12214
12536
  async function runPath(box, opts) {
@@ -12230,7 +12552,7 @@ async function runPath(box, opts) {
12230
12552
  }
12231
12553
 
12232
12554
  // src/commands/open.ts
12233
- var openCommand = new Command33("open").description("Open a box's /workspace in Finder (docker: rsync'd snapshot; cloud: sshfs mount)").argument(
12555
+ var openCommand = new Command34("open").description("Open a box's /workspace in Finder (docker: rsync'd snapshot; cloud: sshfs mount)").argument(
12234
12556
  "[box]",
12235
12557
  "box ref: project index, id, id prefix, name, or container (default: the only box in this project)"
12236
12558
  ).option("--no-refresh", "skip the rsync; open whatever's already on disk (docker only)").option(
@@ -12269,7 +12591,7 @@ var openCommand = new Command33("open").description("Open a box's /workspace in
12269
12591
  }
12270
12592
  });
12271
12593
  async function runCloudOpen(box, provider, opts) {
12272
- const mountRoot = join20(homedir17(), ".agentbox", "mounts", box.name);
12594
+ const mountRoot = join22(homedir19(), ".agentbox", "mounts", box.name);
12273
12595
  if (opts.unmount) {
12274
12596
  const ok = await tryUnmount(mountRoot);
12275
12597
  if (ok) process.stdout.write(`unmounted ${mountRoot}
@@ -12306,13 +12628,13 @@ async function runCloudOpen(box, provider, opts) {
12306
12628
  user: target.user,
12307
12629
  identityFile: target.identityFile
12308
12630
  });
12309
- if (!existsSync9(mountRoot)) {
12310
- mkdirSync7(mountRoot, { recursive: true, mode: 493 });
12631
+ if (!existsSync11(mountRoot)) {
12632
+ mkdirSync9(mountRoot, { recursive: true, mode: 493 });
12311
12633
  } else if (await isMounted(mountRoot)) {
12312
- log36.info(`re-mounting (stale mount detected at ${mountRoot})`);
12634
+ log38.info(`re-mounting (stale mount detected at ${mountRoot})`);
12313
12635
  await tryUnmount(mountRoot);
12314
12636
  }
12315
- log36.info(`mounting ${alias}:/workspace at ${mountRoot}`);
12637
+ log38.info(`mounting ${alias}:/workspace at ${mountRoot}`);
12316
12638
  const mount = await execa5(
12317
12639
  sshfsBin,
12318
12640
  [
@@ -12359,8 +12681,8 @@ async function tryUnmount(path) {
12359
12681
  }
12360
12682
 
12361
12683
  // src/commands/pause.ts
12362
- import { Command as Command34 } from "commander";
12363
- var pauseCommand = new Command34("pause").description(
12684
+ import { Command as Command35 } from "commander";
12685
+ var pauseCommand = new Command35("pause").description(
12364
12686
  "Pause a box. Docker: `docker pause` (cgroup freeze \u2014 sub-second resume). Cloud: backend.pause (Daytona archive \u2014 cold storage; resume is slower but uses no quota while archived)."
12365
12687
  ).argument(
12366
12688
  "[box]",
@@ -12383,7 +12705,7 @@ var pauseCommand = new Command34("pause").description(
12383
12705
  });
12384
12706
 
12385
12707
  // src/commands/prune.ts
12386
- import { Command as Command35 } from "commander";
12708
+ import { Command as Command36 } from "commander";
12387
12709
  function totalRemovals(r, projectConfigs) {
12388
12710
  return r.removedRecords.length + r.removedContainers.length + r.removedVolumes.length + r.removedSnapshotDirs.length + r.removedBoxDirs.length + projectConfigs.length;
12389
12711
  }
@@ -12429,7 +12751,7 @@ async function liveProjectRoots() {
12429
12751
  return [];
12430
12752
  }
12431
12753
  }
12432
- var pruneCommand = new Command35("prune").description("Clean up orphan state.json records (and with --all, orphan docker resources)").option("--dry-run", "show what would be removed, don't change anything").option(
12754
+ var pruneCommand = new Command36("prune").description("Clean up orphan state.json records (and with --all, orphan docker resources)").option("--dry-run", "show what would be removed, don't change anything").option(
12433
12755
  "--all",
12434
12756
  "also remove orphan agentbox-* containers, volumes, snapshot dirs, and orphan per-project config dirs"
12435
12757
  ).option("-y, --yes", "skip the confirmation prompt").option(
@@ -12543,17 +12865,17 @@ async function pruneCloud(provider, opts) {
12543
12865
 
12544
12866
  // src/commands/queue.ts
12545
12867
  import { readFile as readFile6, stat as stat6 } from "fs/promises";
12546
- import { intro as intro9, log as log38, outro as outro8 } from "@clack/prompts";
12547
- import { Command as Command36 } from "commander";
12868
+ import { intro as intro10, log as log40, outro as outro9 } from "@clack/prompts";
12869
+ import { Command as Command37 } from "commander";
12548
12870
  var TERMINAL_STATUSES = /* @__PURE__ */ new Set(["done", "failed", "cancelled"]);
12549
- var queueCommand = new Command36("queue").description("Inspect and manage background `agentbox claude|codex|opencode -i` jobs");
12550
- var queueListCommand = new Command36("list").description("List queued, running, and (with --all) terminal background jobs").option("--all", "include done/failed/cancelled jobs (default: hide terminal)").action(async (opts) => {
12871
+ var queueCommand = new Command37("queue").description("Inspect and manage background `agentbox claude|codex|opencode -i` jobs");
12872
+ var queueListCommand = new Command37("list").description("List queued, running, and (with --all) terminal background jobs").option("--all", "include done/failed/cancelled jobs (default: hide terminal)").action(async (opts) => {
12551
12873
  const jobs = await loadQueue();
12552
12874
  const cfg = await loadQueueConfig();
12553
12875
  const visible = opts.all === true ? jobs : jobs.filter((j) => !TERMINAL_STATUSES.has(j.status));
12554
12876
  if (visible.length === 0) {
12555
- log38.info(opts.all ? "no queued jobs." : "no active queued jobs (--all to see terminal).");
12556
- log38.info(`queue.maxConcurrent = ${String(cfg.maxConcurrent)} (queue.enabled=${String(cfg.enabled)})`);
12877
+ log40.info(opts.all ? "no queued jobs." : "no active queued jobs (--all to see terminal).");
12878
+ log40.info(`queue.maxConcurrent = ${String(cfg.maxConcurrent)} (queue.enabled=${String(cfg.enabled)})`);
12557
12879
  return;
12558
12880
  }
12559
12881
  const rows = visible.map((j) => ({
@@ -12578,12 +12900,12 @@ var queueListCommand = new Command36("list").description("List queued, running,
12578
12900
  headers.map((h, i) => pad4(String(r[h]), widths[i])).join(" ") + "\n"
12579
12901
  );
12580
12902
  }
12581
- log38.info(`queue.maxConcurrent = ${String(cfg.maxConcurrent)} (queue.enabled=${String(cfg.enabled)})`);
12903
+ log40.info(`queue.maxConcurrent = ${String(cfg.maxConcurrent)} (queue.enabled=${String(cfg.enabled)})`);
12582
12904
  });
12583
- var queueShowCommand = new Command36("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) => {
12905
+ var queueShowCommand = new Command37("show").description("Dump a job manifest and tail its log").argument("<id>", "queue job id (from `agentbox queue list`)").option("--tail <n>", "lines of log to print (default: 50)", "50").action(async (id, opts) => {
12584
12906
  const job = await readJob(id);
12585
12907
  if (!job) {
12586
- log38.error(`no job with id ${id}`);
12908
+ log40.error(`no job with id ${id}`);
12587
12909
  process.exit(1);
12588
12910
  }
12589
12911
  process.stdout.write(JSON.stringify(job, null, 2) + "\n");
@@ -12599,18 +12921,18 @@ var queueShowCommand = new Command36("show").description("Dump a job manifest an
12599
12921
  process.stdout.write(slice.join("\n"));
12600
12922
  if (!slice.join("\n").endsWith("\n")) process.stdout.write("\n");
12601
12923
  } catch {
12602
- log38.info(`(no log at ${job.logPath} yet)`);
12924
+ log40.info(`(no log at ${job.logPath} yet)`);
12603
12925
  }
12604
12926
  });
12605
- var queueCancelCommand = new Command36("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) => {
12606
- intro9(`Cancelling queue job ${id}...`);
12927
+ 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
+ intro10(`Cancelling queue job ${id}...`);
12607
12929
  const job = await readJob(id);
12608
12930
  if (!job) {
12609
- log38.error(`no job with id ${id}`);
12931
+ log40.error(`no job with id ${id}`);
12610
12932
  process.exit(1);
12611
12933
  }
12612
12934
  if (job.status !== "queued") {
12613
- log38.error(
12935
+ log40.error(
12614
12936
  `job ${id} is ${job.status}; cancel only flips 'queued' \u2192 'cancelled'.` + (job.status === "running" ? ` Use 'agentbox destroy ${job.boxName || id}' to stop the box.` : "")
12615
12937
  );
12616
12938
  process.exit(1);
@@ -12622,15 +12944,15 @@ var queueCancelCommand = new Command36("cancel").description("Cancel a queued jo
12622
12944
  reason: "cancelled by user"
12623
12945
  };
12624
12946
  await writeJob(cancelled);
12625
- outro8(`job ${id} cancelled`);
12947
+ outro9(`job ${id} cancelled`);
12626
12948
  });
12627
- var queueClearCommand = new Command36("clear").description("Sweep terminal-state manifests from ~/.agentbox/queue/").option("--done", "remove done jobs").option("--failed", "remove failed jobs").option("--cancelled", "remove cancelled jobs").option("--all", "remove every terminal-state job (done + failed + cancelled)").action(async (opts) => {
12949
+ var queueClearCommand = new Command37("clear").description("Sweep terminal-state manifests from ~/.agentbox/queue/").option("--done", "remove done jobs").option("--failed", "remove failed jobs").option("--cancelled", "remove cancelled jobs").option("--all", "remove every terminal-state job (done + failed + cancelled)").action(async (opts) => {
12628
12950
  const targets = /* @__PURE__ */ new Set();
12629
12951
  if (opts.all === true || opts.done === true) targets.add("done");
12630
12952
  if (opts.all === true || opts.failed === true) targets.add("failed");
12631
12953
  if (opts.all === true || opts.cancelled === true) targets.add("cancelled");
12632
12954
  if (targets.size === 0) {
12633
- log38.error("pick at least one of: --done, --failed, --cancelled, --all");
12955
+ log40.error("pick at least one of: --done, --failed, --cancelled, --all");
12634
12956
  process.exit(2);
12635
12957
  }
12636
12958
  const jobs = await loadQueue();
@@ -12640,7 +12962,7 @@ var queueClearCommand = new Command36("clear").description("Sweep terminal-state
12640
12962
  await deleteJob(j.id);
12641
12963
  removed += 1;
12642
12964
  }
12643
- log38.success(`removed ${String(removed)} manifest${removed === 1 ? "" : "s"}`);
12965
+ log40.success(`removed ${String(removed)} manifest${removed === 1 ? "" : "s"}`);
12644
12966
  });
12645
12967
  var QUEUE_WAIT_EVENTS = [
12646
12968
  "new-box",
@@ -12653,11 +12975,11 @@ var QUEUE_WAIT_EVENTS = [
12653
12975
  var ACTIVE_JOB_STATUSES = /* @__PURE__ */ new Set(["queued", "running"]);
12654
12976
  var DEFAULT_QUEUE_WAIT_TIMEOUT_MS = 10 * 60 * 1e3;
12655
12977
  var QUEUE_POLL_INTERVAL_MS = 500;
12656
- var queueWaitForCommand = new Command36("wait-for").description(
12978
+ var queueWaitForCommand = new Command37("wait-for").description(
12657
12979
  `Block until a queue / box event fires. <event> one of: ${QUEUE_WAIT_EVENTS.join(" | ")}.`
12658
12980
  ).argument("<event>", `target event: ${QUEUE_WAIT_EVENTS.join(" | ")}`).option("--box <ref>", "box ref (required for box-paused / box-running / box-stopped)").option("--job <id>", "queue job id (required for job-done)").option("--timeout <ms>", `wall-clock cap (default: ${String(DEFAULT_QUEUE_WAIT_TIMEOUT_MS)})`).option("--json", "emit a JSON envelope { matched, elapsedMs, ... }").action(async (eventRaw, opts) => {
12659
12981
  if (!QUEUE_WAIT_EVENTS.includes(eventRaw)) {
12660
- log38.error(`unknown event '${eventRaw}' (one of: ${QUEUE_WAIT_EVENTS.join(", ")})`);
12982
+ log40.error(`unknown event '${eventRaw}' (one of: ${QUEUE_WAIT_EVENTS.join(", ")})`);
12661
12983
  process.exit(2);
12662
12984
  }
12663
12985
  const event = eventRaw;
@@ -12677,11 +12999,11 @@ var queueWaitForCommand = new Command36("wait-for").description(
12677
12999
  if (opts.json === true) {
12678
13000
  process.stdout.write(JSON.stringify({ matched: false, event, elapsedMs }) + "\n");
12679
13001
  } else {
12680
- log38.error(`'${event}' did not occur within ${String(timeoutMs)}ms`);
13002
+ log40.error(`'${event}' did not occur within ${String(timeoutMs)}ms`);
12681
13003
  }
12682
13004
  process.exit(1);
12683
13005
  }
12684
- log38.error(err instanceof Error ? err.message : String(err));
13006
+ log40.error(err instanceof Error ? err.message : String(err));
12685
13007
  process.exit(1);
12686
13008
  }
12687
13009
  });
@@ -12778,8 +13100,8 @@ function truncate(s, max) {
12778
13100
  }
12779
13101
 
12780
13102
  // src/commands/relay.ts
12781
- import { log as log39, spinner as spinner9 } from "@clack/prompts";
12782
- import { Command as Command37 } from "commander";
13103
+ import { log as log41, spinner as spinner9 } from "@clack/prompts";
13104
+ import { Command as Command38 } from "commander";
12783
13105
  async function rehydrateFromState() {
12784
13106
  const state = await readState();
12785
13107
  await rehydrateRelayRegistry(
@@ -12822,7 +13144,7 @@ function renderStatus(s) {
12822
13144
  }
12823
13145
  return ["relay: not running", ` log: ${s.logFile}`].join("\n");
12824
13146
  }
12825
- var statusSub = new Command37("status").description("Show whether the host relay is running, with pid / port / box count").option("--json", "emit RelayStatus as JSON").action(async (opts) => {
13147
+ var statusSub = new Command38("status").description("Show whether the host relay is running, with pid / port / box count").option("--json", "emit RelayStatus as JSON").action(async (opts) => {
12826
13148
  try {
12827
13149
  const s = await getRelayStatus();
12828
13150
  if (opts.json) {
@@ -12834,7 +13156,7 @@ var statusSub = new Command37("status").description("Show whether the host relay
12834
13156
  handleLifecycleError(err);
12835
13157
  }
12836
13158
  });
12837
- var stopSub = new Command37("stop").description("Stop the host relay process (idempotent)").action(async () => {
13159
+ var stopSub = new Command38("stop").description("Stop the host relay process (idempotent)").action(async () => {
12838
13160
  try {
12839
13161
  const s = spinner9();
12840
13162
  s.start("stopping relay");
@@ -12846,7 +13168,7 @@ var stopSub = new Command37("stop").description("Stop the host relay process (id
12846
13168
  handleLifecycleError(err);
12847
13169
  }
12848
13170
  });
12849
- var startSub = new Command37("start").description("Start the host relay if not already running (idempotent)").action(async () => {
13171
+ var startSub = new Command38("start").description("Start the host relay if not already running (idempotent)").action(async () => {
12850
13172
  try {
12851
13173
  const s = spinner9();
12852
13174
  s.start("starting relay");
@@ -12857,7 +13179,7 @@ var startSub = new Command37("start").description("Start the host relay if not a
12857
13179
  handleLifecycleError(err);
12858
13180
  }
12859
13181
  });
12860
- var restartSub = new Command37("restart").description("Stop then start the host relay").action(async () => {
13182
+ var restartSub = new Command38("restart").description("Stop then start the host relay").action(async () => {
12861
13183
  try {
12862
13184
  const s = spinner9();
12863
13185
  s.start("stopping relay");
@@ -12873,35 +13195,35 @@ var restartSub = new Command37("restart").description("Stop then start the host
12873
13195
  s2.stop(`relay running on ${ep.hostUrl}`);
12874
13196
  } catch (err) {
12875
13197
  s2.stop("relay start failed");
12876
- log39.warn(err instanceof Error ? err.message : String(err));
13198
+ log41.warn(err instanceof Error ? err.message : String(err));
12877
13199
  throw err;
12878
13200
  }
12879
13201
  } catch (err) {
12880
13202
  handleLifecycleError(err);
12881
13203
  }
12882
13204
  });
12883
- var relayCommand = new Command37("relay").description("Manage the host relay process (status / stop / start / restart)").addCommand(statusSub, { isDefault: true }).addCommand(stopSub).addCommand(startSub).addCommand(restartSub);
13205
+ var relayCommand = new Command38("relay").description("Manage the host relay process (status / stop / start / restart)").addCommand(statusSub, { isDefault: true }).addCommand(stopSub).addCommand(startSub).addCommand(restartSub);
12884
13206
 
12885
13207
  // src/commands/_run-queued-job.ts
12886
- import { Command as Command38 } from "commander";
12887
- var runQueuedJobCommand = new Command38("_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) => {
12888
- const log48 = openCommandLog(`queue-${id}`);
12889
- log48.write(`worker pid=${String(process.pid)} starting for job ${id}`);
13208
+ import { Command as Command39 } from "commander";
13209
+ 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 log50 = openCommandLog(`queue-${id}`);
13211
+ log50.write(`worker pid=${String(process.pid)} starting for job ${id}`);
12890
13212
  let job = null;
12891
13213
  try {
12892
13214
  job = await readJob(id);
12893
13215
  if (!job) {
12894
- log48.write(`FATAL: no manifest at id=${id}`);
12895
- log48.close();
13216
+ log50.write(`FATAL: no manifest at id=${id}`);
13217
+ log50.close();
12896
13218
  process.exit(64);
12897
13219
  }
12898
13220
  const onBoxCreated = (boxId) => {
12899
13221
  if (job) job = { ...job, boxId };
12900
13222
  };
12901
13223
  if ((job.providerName || "docker") === "docker") {
12902
- await runDockerJob(job, log48, onBoxCreated);
13224
+ await runDockerJob(job, log50, onBoxCreated);
12903
13225
  } else {
12904
- await runCloudJob(job, log48, onBoxCreated);
13226
+ await runCloudJob(job, log50, onBoxCreated);
12905
13227
  }
12906
13228
  const done = {
12907
13229
  ...job,
@@ -12910,12 +13232,12 @@ var runQueuedJobCommand = new Command38("_run-queued-job").description("internal
12910
13232
  exitCode: 0
12911
13233
  };
12912
13234
  await writeJob(done);
12913
- log48.write(`done`);
12914
- log48.close();
13235
+ log50.write(`done`);
13236
+ log50.close();
12915
13237
  process.exit(0);
12916
13238
  } catch (err) {
12917
13239
  const msg = err instanceof Error ? err.stack ?? err.message : String(err);
12918
- log48.write(`FAIL: ${msg}`);
13240
+ log50.write(`FAIL: ${msg}`);
12919
13241
  if (job) {
12920
13242
  try {
12921
13243
  const failed = {
@@ -12929,11 +13251,11 @@ var runQueuedJobCommand = new Command38("_run-queued-job").description("internal
12929
13251
  } catch {
12930
13252
  }
12931
13253
  }
12932
- log48.close();
13254
+ log50.close();
12933
13255
  process.exit(1);
12934
13256
  }
12935
13257
  });
12936
- async function runDockerJob(job, log48, onBoxCreated) {
13258
+ async function runDockerJob(job, log50, onBoxCreated) {
12937
13259
  const opts = job.createOpts;
12938
13260
  const cfg = await loadEffectiveConfig(opts.workspace, {
12939
13261
  cliOverrides: buildOverridesFromJob(job)
@@ -12945,7 +13267,7 @@ async function runDockerJob(job, log48, onBoxCreated) {
12945
13267
  const useSnapshot = opts.hostSnapshot === false ? false : opts.hostSnapshot === true ? true : cfg.effective.box.hostSnapshot ?? false;
12946
13268
  const resolved = job.agent === "claude-code" ? await resolveClaudeAuth(process.env) : null;
12947
13269
  const withPlaywright = cfg.effective.box.withPlaywright || cfg.effective.browser.default !== "agent-browser";
12948
- log48.write(`creating box for agent=${job.agent}`);
13270
+ log50.write(`creating box for agent=${job.agent}`);
12949
13271
  const result = await createBox({
12950
13272
  workspacePath: opts.workspace,
12951
13273
  name: opts.name && opts.name.length > 0 ? opts.name : void 0,
@@ -12971,22 +13293,22 @@ async function runDockerJob(job, log48, onBoxCreated) {
12971
13293
  // at box-create time (the worker runs on the host, so it can read the files).
12972
13294
  carry: opts.carry,
12973
13295
  projectRoot,
12974
- onLog: (line) => log48.write(line)
13296
+ onLog: (line) => log50.write(line)
12975
13297
  });
12976
- log48.write(`box created: ${result.record.container}`);
13298
+ log50.write(`box created: ${result.record.container}`);
12977
13299
  onBoxCreated(result.record.id);
12978
13300
  await writeJob({ ...job, boxId: result.record.id });
12979
13301
  const resyncWarning = result.resync ? buildResyncWarning(result.resync) : null;
12980
- if (resyncWarning) log48.write(resyncWarning);
13302
+ if (resyncWarning) log50.write(resyncWarning);
12981
13303
  const prompt = prependResyncWarning(resyncWarning, job.prompt);
12982
13304
  const promptedArgs = buildPromptArgs(job.agent, prompt, job.agentArgs);
12983
13305
  if (job.agent === "claude-code") {
12984
- log48.write(`checking plugin native deps`);
13306
+ log50.write(`checking plugin native deps`);
12985
13307
  await rebuildPluginNativeDeps(result.record.container, {
12986
13308
  volume: result.record.claudeConfigVolume ?? SHARED_CLAUDE_VOLUME,
12987
- onProgress: (line) => log48.write(line)
13309
+ onProgress: (line) => log50.write(line)
12988
13310
  });
12989
- log48.write(`starting claude session`);
13311
+ log50.write(`starting claude session`);
12990
13312
  await startClaudeSession({
12991
13313
  container: result.record.container,
12992
13314
  claudeArgs: applyClaudeSkipPermissions(promptedArgs, cfg.effective),
@@ -12994,22 +13316,22 @@ async function runDockerJob(job, log48, onBoxCreated) {
12994
13316
  boxName: result.record.name
12995
13317
  });
12996
13318
  } else if (job.agent === "codex") {
12997
- log48.write(`checking codex`);
13319
+ log50.write(`checking codex`);
12998
13320
  await ensureCodexInstalled(result.record.container, {
12999
- onProgress: (line) => log48.write(line)
13321
+ onProgress: (line) => log50.write(line)
13000
13322
  });
13001
- log48.write(`starting codex session`);
13323
+ log50.write(`starting codex session`);
13002
13324
  await startCodexSession({
13003
13325
  container: result.record.container,
13004
13326
  codexArgs: applyCodexSkipPermissions(promptedArgs, cfg.effective),
13005
13327
  sessionName: cfg.effective.codex.sessionName
13006
13328
  });
13007
13329
  } else if (job.agent === "opencode") {
13008
- log48.write(`checking opencode`);
13330
+ log50.write(`checking opencode`);
13009
13331
  await ensureOpencodeInstalled(result.record.container, {
13010
- onProgress: (line) => log48.write(line)
13332
+ onProgress: (line) => log50.write(line)
13011
13333
  });
13012
- log48.write(`starting opencode session`);
13334
+ log50.write(`starting opencode session`);
13013
13335
  await startOpencodeSession({
13014
13336
  container: result.record.container,
13015
13337
  opencodeArgs: promptedArgs,
@@ -13018,17 +13340,17 @@ async function runDockerJob(job, log48, onBoxCreated) {
13018
13340
  } else {
13019
13341
  throw new Error(`unknown agent kind: ${String(job.agent)}`);
13020
13342
  }
13021
- await maybeOpenQueuedTerminal(job, result.record.name, log48);
13343
+ await maybeOpenQueuedTerminal(job, result.record.name, log50);
13022
13344
  }
13023
13345
  function agentBinaryName(agent) {
13024
13346
  return agent === "claude-code" ? "claude" : agent;
13025
13347
  }
13026
- async function maybeOpenQueuedTerminal(job, boxName, log48) {
13348
+ async function maybeOpenQueuedTerminal(job, boxName, log50) {
13027
13349
  const ctx = job.openTerminal;
13028
13350
  if (!ctx) return;
13029
13351
  const cliEntry = process.env["AGENTBOX_CLI_ENTRY"];
13030
13352
  if (!cliEntry) {
13031
- log48.write("queue.openIn: AGENTBOX_CLI_ENTRY unset; cannot open terminal");
13353
+ log50.write("queue.openIn: AGENTBOX_CLI_ENTRY unset; cannot open terminal");
13032
13354
  return;
13033
13355
  }
13034
13356
  const argv2 = [
@@ -13042,14 +13364,14 @@ async function maybeOpenQueuedTerminal(job, boxName, log48) {
13042
13364
  ];
13043
13365
  try {
13044
13366
  const r = await spawnQueuedOpenTerminal(ctx, argv2, boxName);
13045
- log48.write(
13367
+ log50.write(
13046
13368
  r.launched ? `queue.openIn: ${r.note}` : `queue.openIn: open failed: ${r.error ?? ""}`
13047
13369
  );
13048
13370
  } catch (err) {
13049
- log48.write(`queue.openIn: open threw: ${err instanceof Error ? err.message : String(err)}`);
13371
+ log50.write(`queue.openIn: open threw: ${err instanceof Error ? err.message : String(err)}`);
13050
13372
  }
13051
13373
  }
13052
- async function runCloudJob(job, log48, onBoxCreated) {
13374
+ async function runCloudJob(job, log50, onBoxCreated) {
13053
13375
  const opts = job.createOpts;
13054
13376
  const cfg = await loadEffectiveConfig(opts.workspace, {
13055
13377
  cliOverrides: buildOverridesFromJob(job)
@@ -13060,7 +13382,7 @@ async function runCloudJob(job, log48, onBoxCreated) {
13060
13382
  const providerDefault = resolveDefaultCheckpoint(cfg.effective, providerName);
13061
13383
  const checkpointRef = opts.snapshot && opts.snapshot.length > 0 ? opts.snapshot : providerDefault.length > 0 ? providerDefault : void 0;
13062
13384
  const withPlaywright = cfg.effective.box.withPlaywright || cfg.effective.browser.default !== "agent-browser";
13063
- log48.write(`creating cloud box (${providerName}) for agent=${job.agent}`);
13385
+ log50.write(`creating cloud box (${providerName}) for agent=${job.agent}`);
13064
13386
  const result = await provider.create({
13065
13387
  workspacePath: opts.workspace,
13066
13388
  name: opts.name && opts.name.length > 0 ? opts.name : void 0,
@@ -13074,9 +13396,9 @@ async function runCloudJob(job, log48, onBoxCreated) {
13074
13396
  // worker runs on the host too, so it reads the files and uploads them.
13075
13397
  carry: opts.carry,
13076
13398
  projectRoot,
13077
- onLog: (line) => log48.write(line)
13399
+ onLog: (line) => log50.write(line)
13078
13400
  });
13079
- log48.write(`box created: ${result.record.id}`);
13401
+ log50.write(`box created: ${result.record.id}`);
13080
13402
  onBoxCreated(result.record.id);
13081
13403
  await writeJob({ ...job, boxId: result.record.id });
13082
13404
  const promptedArgs = buildPromptArgs(job.agent, job.prompt, job.agentArgs);
@@ -13098,14 +13420,14 @@ async function runCloudJob(job, log48, onBoxCreated) {
13098
13420
  } else {
13099
13421
  throw new Error(`unknown agent kind: ${String(job.agent)}`);
13100
13422
  }
13101
- log48.write(`starting detached ${job.agent} session`);
13423
+ log50.write(`starting detached ${job.agent} session`);
13102
13424
  await cloudAgentStartDetached({
13103
13425
  box: result.record,
13104
13426
  binary,
13105
13427
  sessionName,
13106
13428
  extraArgs
13107
13429
  });
13108
- await maybeOpenQueuedTerminal(job, result.record.name, log48);
13430
+ await maybeOpenQueuedTerminal(job, result.record.name, log50);
13109
13431
  }
13110
13432
  function buildOverridesFromJob(job) {
13111
13433
  const opts = job.createOpts;
@@ -13134,10 +13456,86 @@ function buildOverridesFromJob(job) {
13134
13456
  return out;
13135
13457
  }
13136
13458
 
13459
+ // src/commands/herdr.ts
13460
+ import { spawnSync as spawnSync5 } from "child_process";
13461
+ import { Command as Command40 } from "commander";
13462
+ function parseHerdrLink(uri) {
13463
+ if (!uri) return null;
13464
+ const m = uri.match(/^agentbox:\/\/([^/]+)\/(.+)$/);
13465
+ if (!m) return null;
13466
+ const verb = m[1];
13467
+ const rawBox = m[2];
13468
+ if (!verb || !rawBox) return null;
13469
+ try {
13470
+ return { verb, box: decodeURIComponent(rawBox) };
13471
+ } catch {
13472
+ return { verb, box: rawBox };
13473
+ }
13474
+ }
13475
+ function herdrContextCwd(env = process.env) {
13476
+ const raw = env["HERDR_PLUGIN_CONTEXT_JSON"];
13477
+ if (raw) {
13478
+ try {
13479
+ const ctx = JSON.parse(raw);
13480
+ const cwd = ctx["pane"]?.["cwd"] ?? ctx["workspace"]?.["cwd"];
13481
+ if (typeof cwd === "string" && cwd.length > 0) return cwd;
13482
+ } catch {
13483
+ }
13484
+ }
13485
+ return process.cwd();
13486
+ }
13487
+ var newCommand = new Command40("new").description("Open a new box session in a fresh Herdr tab (used by the plugin shortcut)").option("--agent <agent>", "agent to launch (claude|codex|opencode)", "claude").action(async (opts) => {
13488
+ const agent = opts.agent ?? "claude";
13489
+ const cwd = herdrContextCwd();
13490
+ const r = await spawnInNewTerminal({
13491
+ host: "herdr",
13492
+ mode: "tab",
13493
+ argv: [process.execPath, process.argv[1] ?? "agentbox", agent],
13494
+ cwd,
13495
+ title: `agentbox ${agent}`
13496
+ });
13497
+ if (r.launched) process.stdout.write(r.note + "\n");
13498
+ else if (r.error) process.stderr.write(r.error + "\n");
13499
+ });
13500
+ var linkCommand = new Command40("link").description("Handle a Ctrl+click on an agentbox:// link (used by the plugin link handler)").argument("[uri]", "the clicked URI; defaults to $HERDR_PLUGIN_CLICKED_URL").action(async (uriArg) => {
13501
+ const link = parseHerdrLink(uriArg ?? process.env["HERDR_PLUGIN_CLICKED_URL"]);
13502
+ if (!link) return;
13503
+ if (link.verb !== "web") return;
13504
+ const boxes = await listBoxes();
13505
+ const box = boxes.find((b) => b.id === link.box);
13506
+ if (!box) {
13507
+ herdrSend("notification.show", {
13508
+ title: "AgentBox",
13509
+ body: `box ${link.box} no longer exists`,
13510
+ sound: "request"
13511
+ });
13512
+ return;
13513
+ }
13514
+ const webUrl = box.endpoints.endpoints.find((e) => e.kind === "web" && e.url)?.url;
13515
+ if (webUrl) {
13516
+ spawnSync5(hostOpenCommand(), [webUrl], { stdio: "ignore" });
13517
+ return;
13518
+ }
13519
+ if (box.state !== "running") {
13520
+ herdrSend("notification.show", {
13521
+ title: box.name,
13522
+ body: `box is ${box.state} \u2014 start it, then click again`,
13523
+ sound: "request"
13524
+ });
13525
+ return;
13526
+ }
13527
+ herdrSend("notification.show", {
13528
+ title: box.name,
13529
+ body: "no web app exposed (add a service `expose:` in agentbox.yaml)",
13530
+ sound: "request"
13531
+ });
13532
+ });
13533
+ var herdrCommand = new Command40("herdr").description("Internal: Herdr plugin entry points (see `agentbox install herdr`)").addCommand(newCommand).addCommand(linkCommand);
13534
+
13137
13535
  // src/commands/screen.ts
13138
- import { spawnSync as spawnSync3 } from "child_process";
13139
- import { log as log40 } from "@clack/prompts";
13140
- import { Command as Command39 } from "commander";
13536
+ import { spawnSync as spawnSync6 } from "child_process";
13537
+ import { log as log42 } from "@clack/prompts";
13538
+ import { Command as Command41 } from "commander";
13141
13539
  var SIGNED_URL_TTL_MIN = 1;
13142
13540
  var SIGNED_URL_TTL_MAX = 86400;
13143
13541
  function parseTtlOrExit(raw) {
@@ -13150,7 +13548,7 @@ function parseTtlOrExit(raw) {
13150
13548
  }
13151
13549
  return n;
13152
13550
  }
13153
- var screenCommand = new Command39("screen").description("Open a box's VNC (noVNC) viewer in the browser (auto-unpause/start)").argument(
13551
+ var screenCommand = new Command41("screen").description("Open a box's VNC (noVNC) viewer in the browser (auto-unpause/start)").argument(
13154
13552
  "[box]",
13155
13553
  "box ref: project index, id, id prefix, name, or container (default: the only box in this project)"
13156
13554
  ).option("--print", "print the URL to stdout instead of launching the browser").option("--loopback", "docker only: use the 127.0.0.1 URL instead of the OrbStack .orb.local URL").option(
@@ -13167,10 +13565,10 @@ var screenCommand = new Command39("screen").description("Open a box's VNC (noVNC
13167
13565
  if (provider === "docker") {
13168
13566
  const insp = await inspectBox(box.id);
13169
13567
  if (insp.state === "paused") {
13170
- log40.info("box is paused; unpausing");
13568
+ log42.info("box is paused; unpausing");
13171
13569
  await unpauseBox(box.id);
13172
13570
  } else if (insp.state === "stopped") {
13173
- log40.info("box is stopped; starting");
13571
+ log42.info("box is stopped; starting");
13174
13572
  await startBox(box.id);
13175
13573
  } else if (insp.state === "missing") {
13176
13574
  throw new Error(`box ${box.name} has no container; was it destroyed?`);
@@ -13180,13 +13578,13 @@ var screenCommand = new Command39("screen").description("Open a box's VNC (noVNC
13180
13578
  const inBoxUrl = exposePort !== void 0 ? box.portlessUrl ?? `http://localhost:${String(exposePort)}` : "about:blank";
13181
13579
  const br = await ensureBoxBrowser(box.container, void 0, inBoxUrl);
13182
13580
  if (br.up && !br.alreadyRunning) {
13183
- log40.info(
13581
+ log42.info(
13184
13582
  exposePort !== void 0 ? `opened ${inBoxUrl} in the in-box browser (visible in the VNC view)` : "started in-box browser"
13185
13583
  );
13186
13584
  } else if (br.alreadyRunning) {
13187
- log40.info("in-box browser already running; left it untouched");
13585
+ log42.info("in-box browser already running; left it untouched");
13188
13586
  } else {
13189
- log40.warn(`could not start in-box browser: ${br.reason ?? "unknown"}`);
13587
+ log42.warn(`could not start in-box browser: ${br.reason ?? "unknown"}`);
13190
13588
  }
13191
13589
  const engine = await detectEngine();
13192
13590
  const urls = buildVncUrls(box, engine);
@@ -13207,10 +13605,10 @@ var screenCommand = new Command39("screen").description("Open a box's VNC (noVNC
13207
13605
  const p = await providerForBox(box);
13208
13606
  const state = await p.probeState(box);
13209
13607
  if (state === "paused") {
13210
- log40.info("box is paused; resuming");
13608
+ log42.info("box is paused; resuming");
13211
13609
  await p.resume(box);
13212
13610
  } else if (state === "stopped") {
13213
- log40.info("box is stopped; starting");
13611
+ log42.info("box is stopped; starting");
13214
13612
  await p.start(box);
13215
13613
  } else if (state === "missing") {
13216
13614
  throw new Error(`cloud sandbox for ${box.name} is missing; was it deleted?`);
@@ -13225,14 +13623,14 @@ var screenCommand = new Command39("screen").description("Open a box's VNC (noVNC
13225
13623
  user: "vscode"
13226
13624
  });
13227
13625
  if (br.exitCode === 0) {
13228
- log40.info(`opened ${webUrl} in the in-box browser (visible in the VNC view)`);
13626
+ log42.info(`opened ${webUrl} in the in-box browser (visible in the VNC view)`);
13229
13627
  } else {
13230
- log40.warn(
13628
+ log42.warn(
13231
13629
  `could not open in-box browser (continuing): ${br.stderr.trim() || br.stdout.trim() || `exit ${String(br.exitCode)}`}`
13232
13630
  );
13233
13631
  }
13234
13632
  } catch (err) {
13235
- log40.warn(
13633
+ log42.warn(
13236
13634
  `in-box browser skipped: ${err instanceof Error ? err.message : String(err)}`
13237
13635
  );
13238
13636
  }
@@ -13245,7 +13643,7 @@ var screenCommand = new Command39("screen").description("Open a box's VNC (noVNC
13245
13643
  `);
13246
13644
  return;
13247
13645
  }
13248
- const opened = spawnSync3(hostOpenCommand(), [url], { stdio: "inherit" });
13646
+ const opened = spawnSync6(hostOpenCommand(), [url], { stdio: "inherit" });
13249
13647
  if (opened.status !== 0) {
13250
13648
  throw new Error(`open ${url} failed (exit ${String(opened.status ?? "n/a")})`);
13251
13649
  }
@@ -13257,19 +13655,19 @@ var screenCommand = new Command39("screen").description("Open a box's VNC (noVNC
13257
13655
  });
13258
13656
 
13259
13657
  // src/commands/shell.ts
13260
- import { spawnSync as spawnSync4 } from "child_process";
13261
- import { log as log42 } from "@clack/prompts";
13262
- import { Command as Command40 } from "commander";
13658
+ import { spawnSync as spawnSync7 } from "child_process";
13659
+ import { log as log44 } from "@clack/prompts";
13660
+ import { Command as Command42 } from "commander";
13263
13661
 
13264
13662
  // src/commands/_provider-guard.ts
13265
- import { log as log41 } from "@clack/prompts";
13663
+ import { log as log43 } from "@clack/prompts";
13266
13664
  function requireDockerProvider(box, commandName) {
13267
13665
  const provider = box.provider ?? "docker";
13268
13666
  if (provider === "docker") return;
13269
- log41.error(
13667
+ log43.error(
13270
13668
  `\`agentbox ${commandName}\` doesn't yet support cloud boxes (this box's provider is '${provider}').`
13271
13669
  );
13272
- log41.info(
13670
+ log43.info(
13273
13671
  "Cloud-provider routing for this command is on the Phase 3 backlog. For now: use `agentbox url` for web access, `agentbox-ctl git push` from inside the sandbox via SSH/web terminal, or fall back to the cloud provider's own console."
13274
13672
  );
13275
13673
  process.exit(2);
@@ -13311,10 +13709,10 @@ function fmtAgo2(iso) {
13311
13709
  async function ensureBoxRunning(box) {
13312
13710
  const insp = await inspectBox(box.id);
13313
13711
  if (insp.state === "paused") {
13314
- log42.info("box is paused; unpausing");
13712
+ log44.info("box is paused; unpausing");
13315
13713
  await unpauseBox(box.id);
13316
13714
  } else if (insp.state === "stopped") {
13317
- log42.info("box is stopped; starting");
13715
+ log44.info("box is stopped; starting");
13318
13716
  await startBox(box.id);
13319
13717
  } else if (insp.state === "missing") {
13320
13718
  throw new Error(`box ${box.name} has no container; was it destroyed?`);
@@ -13353,7 +13751,7 @@ async function startOrAttachShell(box, cfg) {
13353
13751
  const label = shellLabel(cfg.sessionName);
13354
13752
  const info = await shellSessionInfo(box.container, cfg.sessionName, cfg.user);
13355
13753
  if (info.running) {
13356
- log42.info(`reattaching to shell "${label}" \u2014 Control+a d to detach`);
13754
+ log44.info(`reattaching to shell "${label}" \u2014 Control+a d to detach`);
13357
13755
  } else {
13358
13756
  await startShellSession({
13359
13757
  container: box.container,
@@ -13361,7 +13759,7 @@ async function startOrAttachShell(box, cfg) {
13361
13759
  user: cfg.user,
13362
13760
  login: cfg.login
13363
13761
  });
13364
- log42.info(`shell "${label}" \u2014 Control+a d to detach, leaves it running`);
13762
+ log44.info(`shell "${label}" \u2014 Control+a d to detach, leaves it running`);
13365
13763
  }
13366
13764
  const code = await runWrappedAttach({
13367
13765
  container: box.container,
@@ -13376,7 +13774,7 @@ async function startOrAttachShell(box, cfg) {
13376
13774
  });
13377
13775
  process.exit(code);
13378
13776
  }
13379
- var shellCommand = new Command40("shell").description(
13777
+ var shellCommand = new Command42("shell").description(
13380
13778
  "Open an interactive shell in a box, in a detachable tmux session (auto-unpause/start)"
13381
13779
  ).argument(
13382
13780
  "[box]",
@@ -13450,7 +13848,7 @@ var shellCommand = new Command40("shell").description(
13450
13848
  ...bashInvocation
13451
13849
  ];
13452
13850
  if (!isInteractive || effectiveCmd.length > 0) {
13453
- const child = spawnSync4("docker", plainArgv, { stdio: "inherit" });
13851
+ const child = spawnSync7("docker", plainArgv, { stdio: "inherit" });
13454
13852
  process.exit(child.status ?? 0);
13455
13853
  }
13456
13854
  if (tmux) {
@@ -13471,7 +13869,7 @@ var shellCommand = new Command40("shell").description(
13471
13869
  handleLifecycleError(err);
13472
13870
  }
13473
13871
  });
13474
- var shellAttachCommand = new Command40("attach").description(
13872
+ var shellAttachCommand = new Command42("attach").description(
13475
13873
  "Attach to a shell tmux session in a box, starting one if none is running (auto-unpause/start)"
13476
13874
  ).argument(
13477
13875
  "[box]",
@@ -13509,7 +13907,7 @@ function renderShellTable(sessions) {
13509
13907
  for (const r of rows) process.stdout.write(`${fmt(r)}
13510
13908
  `);
13511
13909
  }
13512
- var shellLsCommand = new Command40("ls").description("List the shell tmux sessions running in a box").argument(
13910
+ var shellLsCommand = new Command42("ls").description("List the shell tmux sessions running in a box").argument(
13513
13911
  "[box]",
13514
13912
  "box ref: project index, id, id prefix, name, or container (default: the only box in this project)"
13515
13913
  ).action(async (idOrName) => {
@@ -13518,11 +13916,11 @@ var shellLsCommand = new Command40("ls").description("List the shell tmux sessio
13518
13916
  requireDockerProvider(box, "shell");
13519
13917
  const insp = await inspectBox(box.id);
13520
13918
  if (insp.state !== "running") {
13521
- log42.info(`box ${box.name} is ${insp.state} \u2014 no live shell sessions`);
13919
+ log44.info(`box ${box.name} is ${insp.state} \u2014 no live shell sessions`);
13522
13920
  return;
13523
13921
  }
13524
13922
  if (insp.shellSessions.length === 0) {
13525
- log42.info(
13923
+ log44.info(
13526
13924
  `no shell sessions in ${box.name} \u2014 start one with: agentbox shell ${reattachRef2(box)}`
13527
13925
  );
13528
13926
  return;
@@ -13532,7 +13930,7 @@ var shellLsCommand = new Command40("ls").description("List the shell tmux sessio
13532
13930
  handleLifecycleError(err);
13533
13931
  }
13534
13932
  });
13535
- var shellKillCommand = new Command40("kill").description("Kill a shell tmux session in a box (the shell and anything running in it)").argument(
13933
+ var shellKillCommand = new Command42("kill").description("Kill a shell tmux session in a box (the shell and anything running in it)").argument(
13536
13934
  "[box]",
13537
13935
  "box ref: project index, id, id prefix, name, or container (default: the only box in this project)"
13538
13936
  ).option("-n, --name <label>", "shell label to kill (default: the box default shell)").option("--all", "kill every shell session in the box").action(async function(idOrName) {
@@ -13542,25 +13940,25 @@ var shellKillCommand = new Command40("kill").description("Kill a shell tmux sess
13542
13940
  requireDockerProvider(box, "shell");
13543
13941
  const insp = await inspectBox(box.id);
13544
13942
  if (insp.state !== "running") {
13545
- log42.info(`box ${box.name} is ${insp.state} \u2014 no shell sessions to kill`);
13943
+ log44.info(`box ${box.name} is ${insp.state} \u2014 no shell sessions to kill`);
13546
13944
  return;
13547
13945
  }
13548
13946
  if (opts.all) {
13549
13947
  if (insp.shellSessions.length === 0) {
13550
- log42.info(`no shell sessions in ${box.name}`);
13948
+ log44.info(`no shell sessions in ${box.name}`);
13551
13949
  return;
13552
13950
  }
13553
13951
  let killed = 0;
13554
13952
  for (const s of insp.shellSessions) {
13555
13953
  if (await killShellSession(box.container, s.sessionName)) killed++;
13556
13954
  }
13557
- log42.success(`killed ${String(killed)} shell session${killed === 1 ? "" : "s"} in ${box.name}`);
13955
+ log44.success(`killed ${String(killed)} shell session${killed === 1 ? "" : "s"} in ${box.name}`);
13558
13956
  return;
13559
13957
  }
13560
13958
  const target = shellSessionName(opts.name);
13561
13959
  const ok = await killShellSession(box.container, target);
13562
- if (ok) log42.success(`killed shell "${shellLabel(target)}" in ${box.name}`);
13563
- else log42.warn(`no shell "${shellLabel(target)}" in ${box.name} (already gone?)`);
13960
+ if (ok) log44.success(`killed shell "${shellLabel(target)}" in ${box.name}`);
13961
+ else log44.warn(`no shell "${shellLabel(target)}" in ${box.name} (already gone?)`);
13564
13962
  } catch (err) {
13565
13963
  handleLifecycleError(err);
13566
13964
  }
@@ -13570,8 +13968,8 @@ shellCommand.addCommand(shellLsCommand);
13570
13968
  shellCommand.addCommand(shellKillCommand);
13571
13969
 
13572
13970
  // src/commands/start.ts
13573
- import { Command as Command41 } from "commander";
13574
- var startCommand = new Command41("start").description(
13971
+ import { Command as Command43 } from "commander";
13972
+ var startCommand = new Command43("start").description(
13575
13973
  "Start a stopped box. Docker: docker start + relaunch ctl/dockerd/vnc daemons. Cloud: backend.start, then re-resolve preview URLs/tokens, re-launch in-sandbox ctl/dockerd daemons, and re-register with the host relay (so the CloudBoxPoller resumes)."
13576
13974
  ).argument(
13577
13975
  "[box]",
@@ -13594,8 +13992,8 @@ var startCommand = new Command41("start").description(
13594
13992
  });
13595
13993
 
13596
13994
  // src/commands/status.ts
13597
- import { log as log44 } from "@clack/prompts";
13598
- import { Command as Command42 } from "commander";
13995
+ import { log as log46 } from "@clack/prompts";
13996
+ import { Command as Command44 } from "commander";
13599
13997
 
13600
13998
  // src/endpoints-render.ts
13601
13999
  function renderEndpointLines(endpoints, stream) {
@@ -13625,7 +14023,7 @@ function renderEndpointLines(endpoints, stream) {
13625
14023
  }
13626
14024
 
13627
14025
  // src/commands/inspect.ts
13628
- import { log as log43 } from "@clack/prompts";
14026
+ import { log as log45 } from "@clack/prompts";
13629
14027
  function fmtLimit(n, unit) {
13630
14028
  return n && n > 0 ? `${String(n)}${unit}` : "unlimited";
13631
14029
  }
@@ -13770,7 +14168,7 @@ function renderCodexActivityCloud(persisted) {
13770
14168
  async function runInspect(box, opts) {
13771
14169
  try {
13772
14170
  if (opts.json && opts.watch) {
13773
- log43.error("cannot combine --json with --watch");
14171
+ log45.error("cannot combine --json with --watch");
13774
14172
  process.exit(2);
13775
14173
  }
13776
14174
  const isCloud = (box.provider ?? "docker") !== "docker";
@@ -13807,14 +14205,14 @@ async function runInspect(box, opts) {
13807
14205
 
13808
14206
  // src/commands/status.ts
13809
14207
  var statusCommand2 = withWatchOptions(
13810
- new Command42("status").description("Show service + task status from a box's agentbox-ctl daemon").argument(
14208
+ new Command44("status").description("Show service + task status from a box's agentbox-ctl daemon").argument(
13811
14209
  "[box]",
13812
14210
  "box ref: project index, id, id prefix, name, or container (default: the only box in this project)"
13813
14211
  ).option("-j, --json", "machine-readable JSON output").option("--inspect", "show detailed box info (volumes, limits, paths) instead of service/task status")
13814
14212
  ).action(async (idOrName, opts) => {
13815
14213
  try {
13816
14214
  if (opts.json && opts.watch) {
13817
- log44.error("cannot combine --json with --watch");
14215
+ log46.error("cannot combine --json with --watch");
13818
14216
  process.exit(2);
13819
14217
  }
13820
14218
  const box = await resolveBoxOrExit(idOrName);
@@ -13981,8 +14379,8 @@ function renderPersisted2(s, state) {
13981
14379
  }
13982
14380
 
13983
14381
  // src/commands/stop.ts
13984
- import { Command as Command43 } from "commander";
13985
- var stopCommand = new Command43("stop").description(
14382
+ import { Command as Command45 } from "commander";
14383
+ var stopCommand = new Command45("stop").description(
13986
14384
  "Stop a box (Docker: docker stop; preserves upper + node_modules volumes. Cloud: backend.stop \u2014 sandbox stays in your account, disk preserved)."
13987
14385
  ).argument(
13988
14386
  "[box]",
@@ -14011,7 +14409,7 @@ restart with: agentbox start ${box.name}
14011
14409
  });
14012
14410
 
14013
14411
  // src/commands/top.ts
14014
- import { Command as Command44 } from "commander";
14412
+ import { Command as Command46 } from "commander";
14015
14413
  var COLS = ["BOX", "STATE", "CPU%", "MEM USAGE / LIMIT", "MEM%", "PIDS", "DISK", "NET I/O"];
14016
14414
  function row(name, state, s) {
14017
14415
  const mem = `${fmtBytes2(s.memUsedBytes)} / ${fmtBytes2(s.memLimitBytes)}`;
@@ -14085,7 +14483,7 @@ async function renderProjectFooters() {
14085
14483
 
14086
14484
  SYSTEM: ${parts.join(" - ")}` : "";
14087
14485
  }
14088
- var topCommand = new Command44("top").description("Live resource monitor (cpu/mem/pids/disk) for a box, the project, or every box").argument(
14486
+ var topCommand = new Command46("top").description("Live resource monitor (cpu/mem/pids/disk) for a box, the project, or every box").argument(
14089
14487
  "[box]",
14090
14488
  "box ref (default: every box on the host; --project narrows to the cwd's project)"
14091
14489
  ).option("-p, --project", "show only boxes in the cwd's project").option("--once", "print a single snapshot instead of watching").option("-j, --json", "machine-readable JSON (implies --once)").option("--interval <seconds>", "refresh interval", "2").option("--live", "probe live cloud state via the provider SDK (slower; default: last host-known)").action(async (idOrName, opts) => {
@@ -14118,8 +14516,8 @@ var topCommand = new Command44("top").description("Live resource monitor (cpu/me
14118
14516
  });
14119
14517
 
14120
14518
  // src/commands/unpause.ts
14121
- import { Command as Command45 } from "commander";
14122
- var unpauseCommand = new Command45("unpause").description(
14519
+ import { Command as Command47 } from "commander";
14520
+ var unpauseCommand = new Command47("unpause").description(
14123
14521
  "Resume a paused box. Docker: `docker unpause` (sub-second). Cloud: backend.resume (re-hydrates from archive \u2014 slower first time)."
14124
14522
  ).argument(
14125
14523
  "[box]",
@@ -14143,7 +14541,7 @@ var unpauseCommand = new Command45("unpause").description(
14143
14541
 
14144
14542
  // src/commands/update.ts
14145
14543
  import { spawn as spawn4 } from "child_process";
14146
- import { Command as Command46 } from "commander";
14544
+ import { Command as Command48 } from "commander";
14147
14545
 
14148
14546
  // src/exec-method.ts
14149
14547
  function detectExecutionMethod(input) {
@@ -14187,7 +14585,7 @@ function runInherit(cmd, args) {
14187
14585
  child.on("close", (code) => resolveP(code ?? 0));
14188
14586
  });
14189
14587
  }
14190
- var updateCommand = new Command46("self-update").description(
14588
+ var updateCommand = new Command48("self-update").description(
14191
14589
  "Update agentbox: self-update via npm/pnpm (unless run via npx), refresh the host skills, wipe the box image so it rebuilds, and reload the relay"
14192
14590
  ).option("-y, --yes", "skip the confirmation prompt").option("--dry-run", "show what would happen, don't change anything").option("--skip-self", "skip the package self-update; only refresh the skills + image + relay").option("--skip-skills", "skip refreshing the host skill files in ~/.claude, ~/.codex, ~/.config/opencode").action(async (opts) => {
14193
14591
  try {
@@ -14294,6 +14692,7 @@ var updateCommand = new Command46("self-update").description(
14294
14692
  );
14295
14693
  }
14296
14694
  }
14695
+ await maybePromptStar({ trigger: "self-update" });
14297
14696
  (0, prompt_exports.outro)("update complete");
14298
14697
  } catch (err) {
14299
14698
  handleLifecycleError(err);
@@ -14301,9 +14700,9 @@ var updateCommand = new Command46("self-update").description(
14301
14700
  });
14302
14701
 
14303
14702
  // src/commands/url.ts
14304
- import { spawnSync as spawnSync5 } from "child_process";
14305
- import { log as log46 } from "@clack/prompts";
14306
- import { Command as Command47 } from "commander";
14703
+ import { spawnSync as spawnSync8 } from "child_process";
14704
+ import { log as log48 } from "@clack/prompts";
14705
+ import { Command as Command49 } from "commander";
14307
14706
  var SIGNED_URL_TTL_MIN2 = 1;
14308
14707
  var SIGNED_URL_TTL_MAX2 = 86400;
14309
14708
  function parseTtlOrExit2(raw) {
@@ -14316,7 +14715,7 @@ function parseTtlOrExit2(raw) {
14316
14715
  }
14317
14716
  return n;
14318
14717
  }
14319
- var urlCommand = new Command47("url").description(
14718
+ var urlCommand = new Command49("url").description(
14320
14719
  "Open a box's web app URL in the browser, even when no service declares `expose:` (auto-unpause/start)"
14321
14720
  ).argument(
14322
14721
  "[box]",
@@ -14335,10 +14734,10 @@ var urlCommand = new Command47("url").description(
14335
14734
  if (provider === "docker") {
14336
14735
  const insp = await inspectBox(box.id);
14337
14736
  if (insp.state === "paused") {
14338
- log46.info("box is paused; unpausing");
14737
+ log48.info("box is paused; unpausing");
14339
14738
  await unpauseBox(box.id);
14340
14739
  } else if (insp.state === "stopped") {
14341
- log46.info("box is stopped; starting");
14740
+ log48.info("box is stopped; starting");
14342
14741
  await startBox(box.id);
14343
14742
  } else if (insp.state === "missing") {
14344
14743
  throw new Error(`box ${box.name} has no container; was it destroyed?`);
@@ -14367,10 +14766,10 @@ var urlCommand = new Command47("url").description(
14367
14766
  const p = await providerForBox(box);
14368
14767
  const state = await p.probeState(box);
14369
14768
  if (state === "paused") {
14370
- log46.info("box is paused; resuming");
14769
+ log48.info("box is paused; resuming");
14371
14770
  await p.resume(box);
14372
14771
  } else if (state === "stopped") {
14373
- log46.info("box is stopped; starting");
14772
+ log48.info("box is stopped; starting");
14374
14773
  await p.start(box);
14375
14774
  } else if (state === "missing") {
14376
14775
  throw new Error(`cloud sandbox for ${box.name} is missing; was it deleted?`);
@@ -14382,7 +14781,7 @@ var urlCommand = new Command47("url").description(
14382
14781
  `);
14383
14782
  return;
14384
14783
  }
14385
- const opened = spawnSync5(hostOpenCommand(), [url], { stdio: "inherit" });
14784
+ const opened = spawnSync8(hostOpenCommand(), [url], { stdio: "inherit" });
14386
14785
  if (opened.status !== 0) {
14387
14786
  throw new Error(`open ${url} failed (exit ${String(opened.status ?? "n/a")})`);
14388
14787
  }
@@ -14394,9 +14793,9 @@ var urlCommand = new Command47("url").description(
14394
14793
  });
14395
14794
 
14396
14795
  // src/commands/wait.ts
14397
- import { log as log47 } from "@clack/prompts";
14398
- import { Command as Command48 } from "commander";
14399
- var waitCommand = new Command48("wait").description("Block until the box reports all autostart units ready").argument(
14796
+ import { log as log49 } from "@clack/prompts";
14797
+ import { Command as Command50 } from "commander";
14798
+ var waitCommand = new Command50("wait").description("Block until the box reports all autostart units ready").argument(
14400
14799
  "[box]",
14401
14800
  "box ref: project index, id, id prefix, name, or container (default: the only box in this project)"
14402
14801
  ).option("--timeout <ms>", "overall timeout in milliseconds", "120000").option("--units <names...>", "restrict to the named units").option("-j, --json", "machine-readable JSON output").action(async (idOrName, opts) => {
@@ -14412,7 +14811,7 @@ var waitCommand = new Command48("wait").description("Block until the box reports
14412
14811
  try {
14413
14812
  parsed = JSON.parse(proc.stdout);
14414
14813
  } catch {
14415
- log47.error(`agentbox-ctl wait-ready failed: ${proc.stderr || proc.stdout}`);
14814
+ log49.error(`agentbox-ctl wait-ready failed: ${proc.stderr || proc.stdout}`);
14416
14815
  process.exit(1);
14417
14816
  }
14418
14817
  if (opts.json) {
@@ -14451,7 +14850,7 @@ function rewriteProviderPrefix(argv2) {
14451
14850
  process.env.DOCKER_CLI_HINTS ??= "false";
14452
14851
  process.env.AGENTBOX_CLI_VERSION = AGENTBOX_VERSION;
14453
14852
  process.env.AGENTBOX_CLI_COMMIT = AGENTBOX_COMMIT;
14454
- var program = new Command49();
14853
+ var program = new Command51();
14455
14854
  program.name("agentbox").description("Launch coding agents in isolated sandboxes").version(AGENTBOX_VERSION);
14456
14855
  program.enablePositionalOptions();
14457
14856
  program.addCommand(createCommand);
@@ -14488,6 +14887,7 @@ program.addCommand(configCommand);
14488
14887
  program.addCommand(queueCommand);
14489
14888
  program.addCommand(relayCommand);
14490
14889
  program.addCommand(runQueuedJobCommand, { hidden: true });
14890
+ program.addCommand(herdrCommand, { hidden: true });
14491
14891
  program.addCommand(daytonaCommand);
14492
14892
  program.addCommand(hetznerCommand);
14493
14893
  program.addCommand(vercelCommand);