@madarco/agentbox 0.25.1 → 0.26.1

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 (121) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +8 -7
  3. package/dist/{_cloud-attach-FGMI2ZHO.js → _cloud-attach-7WRQH6XZ.js} +5 -5
  4. package/dist/{chunk-5VNL6SHJ.js → chunk-7ZZAZPYX.js} +3 -3
  5. package/dist/{chunk-ZTSVY3YL.js → chunk-BA2VLJVU.js} +3 -3
  6. package/dist/{chunk-3BR63LCB.js → chunk-DJQMK4RN.js} +12 -4
  7. package/dist/chunk-DJQMK4RN.js.map +1 -0
  8. package/dist/{chunk-6GZK74GT.js → chunk-DQHMDDAT.js} +2 -2
  9. package/dist/{chunk-P5U6AP6K.js → chunk-I2OAJS3L.js} +40 -377
  10. package/dist/{chunk-P5U6AP6K.js.map → chunk-I2OAJS3L.js.map} +1 -1
  11. package/dist/{chunk-5F5SOSDY.js → chunk-JGZSA5ZI.js} +72 -23
  12. package/dist/chunk-JGZSA5ZI.js.map +1 -0
  13. package/dist/{chunk-67VF2QZC.js → chunk-K5KOLYIL.js} +3 -3
  14. package/dist/{chunk-4LS2TOF3.js → chunk-PK2QF4IR.js} +569 -195
  15. package/dist/chunk-PK2QF4IR.js.map +1 -0
  16. package/dist/{chunk-3PSRBK24.js → chunk-UIFL7F2G.js} +54 -37
  17. package/dist/chunk-UIFL7F2G.js.map +1 -0
  18. package/dist/{chunk-4DBLYT2F.js → chunk-ZY7M7MXH.js} +41 -16
  19. package/dist/chunk-ZY7M7MXH.js.map +1 -0
  20. package/dist/chunk-ZYKNSHOH.js +259 -0
  21. package/dist/chunk-ZYKNSHOH.js.map +1 -0
  22. package/dist/{dist-X7R2EMJL.js → dist-5IICYSR6.js} +42 -374
  23. package/dist/{dist-X7R2EMJL.js.map → dist-5IICYSR6.js.map} +1 -1
  24. package/dist/{dist-5G42NFOG.js → dist-AR5CHRSV.js} +86 -45
  25. package/dist/{dist-5G42NFOG.js.map → dist-AR5CHRSV.js.map} +1 -1
  26. package/dist/{dist-AZUD2LUA.js → dist-DTNYMBQ5.js} +12 -12
  27. package/dist/{dist-MEK44IS5.js → dist-K4LNH3EC.js} +6 -6
  28. package/dist/{dist-SN6ABGMD.js → dist-POVRY7HO.js} +8 -4
  29. package/dist/{dist-SBDYDH7H.js → dist-U2SVLJUQ.js} +4 -2
  30. package/dist/{dist-4I7XHDC3.js → dist-XYY6SIKG.js} +6 -6
  31. package/dist/dist-YA7EXBGG.js +809 -0
  32. package/dist/dist-YA7EXBGG.js.map +1 -0
  33. package/dist/index.js +971 -591
  34. package/dist/index.js.map +1 -1
  35. package/dist/{prepared-state-75DIZ55S-5UAKJX3L.js → prepared-state-75DIZ55S-W6NU3S3B.js} +2 -2
  36. package/package.json +8 -7
  37. package/runtime/_shared/ctl.cjs +83 -36
  38. package/runtime/digitalocean/ctl.cjs +83 -36
  39. package/runtime/docker/packages/ctl/dist/bin.cjs +83 -36
  40. package/runtime/e2b/ctl.cjs +83 -36
  41. package/runtime/hetzner/ctl.cjs +83 -36
  42. package/runtime/hub/apps/hub/.next/BUILD_ID +1 -1
  43. package/runtime/hub/apps/hub/.next/build-manifest.json +3 -3
  44. package/runtime/hub/apps/hub/.next/server/app/(auth)/api/auth/[...all]/route.js +1 -1
  45. package/runtime/hub/apps/hub/.next/server/app/(auth)/api/auth/[...all]/route.js.nft.json +1 -1
  46. package/runtime/hub/apps/hub/.next/server/app/_global-error.html +1 -1
  47. package/runtime/hub/apps/hub/.next/server/app/_global-error.rsc +1 -1
  48. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  49. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  50. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  51. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  52. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  53. package/runtime/hub/apps/hub/.next/server/chunks/0-fj_better-auth_dist_adapters_kysely-adapter_index_mjs_0btft52._.js +3 -0
  54. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0d1lmiq._.js +5 -5
  55. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0keu6we._.js +1 -1
  56. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1-9g0ae._.js +1 -1
  57. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1bqbkd5._.js +1 -1
  58. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__19pc87s._.js → [root-of-the-server]__1k8g143._.js} +2 -2
  59. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1qa4a0v._.js +1 -1
  60. package/runtime/hub/apps/hub/.next/server/chunks/_0760z6y._.js +4 -4
  61. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_0xy-j7z._.js +1 -1
  62. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_010858m.js +1 -1
  63. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_04zwxnx.js +1 -1
  64. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_06exuc7.js +1 -1
  65. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_0f2ldrt.js +1 -1
  66. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_0f2tzep.js +1 -1
  67. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_116nh32.js +1 -1
  68. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_11dyjcb.js +1 -1
  69. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_1_4knli.js +1 -1
  70. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__08-1wwu._.js +1 -1
  71. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__0c9mbcn._.js +1 -1
  72. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__0gdfxj4._.js +1 -1
  73. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__0kc-hwp._.js +1 -1
  74. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__0lu73p6._.js +1 -1
  75. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__10bfmwi._.js +1 -1
  76. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__18qvdzb._.js +1 -1
  77. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__1l2urlw._.js +1 -1
  78. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0ro6vh6._.js +1 -1
  79. package/runtime/hub/apps/hub/.next/server/middleware-build-manifest.js +3 -3
  80. package/runtime/hub/apps/hub/.next/server/pages/500.html +1 -1
  81. package/runtime/hub/apps/hub/{auth-MVL4NCQC.js → auth-DC44GQZY.js} +2 -2
  82. package/runtime/hub/apps/hub/{auth-config-GRIXACTV.js → auth-config-LALRDYDO.js} +2 -2
  83. package/runtime/hub/apps/hub/{chunk-JLG5JJXD.js → chunk-3FJNKSNZ.js} +1 -1
  84. package/runtime/hub/apps/hub/{chunk-RSENJ2FT.js → chunk-4QY2VZCF.js} +502 -132
  85. package/runtime/hub/apps/hub/{chunk-23AU7VYS.js → chunk-BARD2DI6.js} +11 -3
  86. package/runtime/hub/apps/hub/{chunk-V3OMPMI3.js → chunk-QSMPSV5Z.js} +70 -21
  87. package/runtime/hub/apps/hub/{chunk-GARA7RQW.js → chunk-XZZXPEVV.js} +57 -36
  88. package/runtime/hub/apps/hub/{dist-WZKTIA2R.js → dist-3ENKQN5G.js} +35 -365
  89. package/runtime/hub/apps/hub/{dist-TP4SXMDY.js → dist-6VGJOQYK.js} +84 -43
  90. package/runtime/hub/apps/hub/{dist-JVU3QCLG.js → dist-AE6IV4FV.js} +4 -4
  91. package/runtime/hub/apps/hub/{dist-IZ2JCN5R.js → dist-EQV4L7KP.js} +3 -1
  92. package/runtime/hub/apps/hub/dist-NNBELNA7.js +1017 -0
  93. package/runtime/hub/apps/hub/{dist-DZGSA3US.js → dist-RJJ2SDYO.js} +4 -4
  94. package/runtime/hub/apps/hub/{dist-VWSHZIPN.js → dist-TU7D6UTB.js} +37 -366
  95. package/runtime/hub/apps/hub/{dist-YWY2DSSL.js → dist-WAZKGVYL.js} +7 -3
  96. package/runtime/hub/apps/hub/{hub-token-BJG6Q5II.js → hub-token-COBZGSLS.js} +2 -2
  97. package/runtime/hub/apps/hub/package.json +1 -0
  98. package/runtime/hub/apps/hub/{prepared-state-75DIZ55S-JDILR4OP.js → prepared-state-75DIZ55S-NYEDSU2U.js} +1 -1
  99. package/runtime/hub/apps/hub/server.js +20 -16
  100. package/runtime/relay/bin.cjs +57 -20
  101. package/runtime/vercel/ctl.cjs +83 -36
  102. package/dist/chunk-3BR63LCB.js.map +0 -1
  103. package/dist/chunk-3PSRBK24.js.map +0 -1
  104. package/dist/chunk-4DBLYT2F.js.map +0 -1
  105. package/dist/chunk-4LS2TOF3.js.map +0 -1
  106. package/dist/chunk-5F5SOSDY.js.map +0 -1
  107. package/runtime/hub/apps/hub/.next/server/chunks/0zhp_better-auth_dist_adapters_kysely-adapter_index_mjs_1rl4qnh._.js +0 -3
  108. /package/dist/{_cloud-attach-FGMI2ZHO.js.map → _cloud-attach-7WRQH6XZ.js.map} +0 -0
  109. /package/dist/{chunk-5VNL6SHJ.js.map → chunk-7ZZAZPYX.js.map} +0 -0
  110. /package/dist/{chunk-ZTSVY3YL.js.map → chunk-BA2VLJVU.js.map} +0 -0
  111. /package/dist/{chunk-6GZK74GT.js.map → chunk-DQHMDDAT.js.map} +0 -0
  112. /package/dist/{chunk-67VF2QZC.js.map → chunk-K5KOLYIL.js.map} +0 -0
  113. /package/dist/{dist-4I7XHDC3.js.map → dist-DTNYMBQ5.js.map} +0 -0
  114. /package/dist/{dist-MEK44IS5.js.map → dist-K4LNH3EC.js.map} +0 -0
  115. /package/dist/{dist-AZUD2LUA.js.map → dist-POVRY7HO.js.map} +0 -0
  116. /package/dist/{dist-SBDYDH7H.js.map → dist-U2SVLJUQ.js.map} +0 -0
  117. /package/dist/{dist-SN6ABGMD.js.map → dist-XYY6SIKG.js.map} +0 -0
  118. /package/dist/{prepared-state-75DIZ55S-5UAKJX3L.js.map → prepared-state-75DIZ55S-W6NU3S3B.js.map} +0 -0
  119. /package/runtime/hub/apps/hub/.next/static/{fo5EgsHa6PFLTBagfLiuM → mJYh9UHTsLaGGyRjBSvme}/_buildManifest.js +0 -0
  120. /package/runtime/hub/apps/hub/.next/static/{fo5EgsHa6PFLTBagfLiuM → mJYh9UHTsLaGGyRjBSvme}/_clientMiddlewareManifest.js +0 -0
  121. /package/runtime/hub/apps/hub/.next/static/{fo5EgsHa6PFLTBagfLiuM → mJYh9UHTsLaGGyRjBSvme}/_ssgManifest.js +0 -0
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  readE2bCredStatus,
6
6
  readPreparedState as readPreparedState3,
7
7
  secretsPath as secretsPath4
8
- } from "./chunk-6GZK74GT.js";
8
+ } from "./chunk-DQHMDDAT.js";
9
9
  import {
10
10
  detectEgressIp as detectEgressIp2,
11
11
  ensureDigitalOceanCredentials,
@@ -17,7 +17,11 @@ import {
17
17
  readPreparedState as readPreparedState4,
18
18
  secretsPath as secretsPath5,
19
19
  syncFirewallSource as syncFirewallSource2
20
- } from "./chunk-5VNL6SHJ.js";
20
+ } from "./chunk-7ZZAZPYX.js";
21
+ import {
22
+ probeRemoteEngine,
23
+ readPreparedState as readPreparedState5
24
+ } from "./chunk-ZYKNSHOH.js";
21
25
  import {
22
26
  ADVANCED_HINT_GROUPS,
23
27
  ALERT_BAND_ROWS,
@@ -43,6 +47,7 @@ import {
43
47
  loadProviderModule,
44
48
  loadPtyBackend,
45
49
  menuLines,
50
+ parseProviderSpec,
46
51
  pasteHostClipboardImage,
47
52
  popTerminalTitle,
48
53
  postAnswer,
@@ -61,7 +66,7 @@ import {
61
66
  subscribePrompts,
62
67
  uploadImageFileToBox,
63
68
  withFirewallRepair
64
- } from "./chunk-4DBLYT2F.js";
69
+ } from "./chunk-ZY7M7MXH.js";
65
70
  import {
66
71
  daytonaBackend,
67
72
  ensureDaytonaCredentials,
@@ -69,7 +74,7 @@ import {
69
74
  readDaytonaCredStatus,
70
75
  readPreparedDaytonaState,
71
76
  secretsPath
72
- } from "./chunk-67VF2QZC.js";
77
+ } from "./chunk-K5KOLYIL.js";
73
78
  import {
74
79
  deployControlPlaneToHetzner,
75
80
  detectEgressIp,
@@ -81,7 +86,7 @@ import {
81
86
  readPreparedState,
82
87
  secretsPath as secretsPath2,
83
88
  syncFirewallSource
84
- } from "./chunk-P5U6AP6K.js";
89
+ } from "./chunk-I2OAJS3L.js";
85
90
  import {
86
91
  createGitDeployment,
87
92
  createGitProject,
@@ -100,7 +105,7 @@ import {
100
105
  resolveVercelApiAuth,
101
106
  secretsPath as secretsPath3,
102
107
  upsertProjectEnv
103
- } from "./chunk-ZTSVY3YL.js";
108
+ } from "./chunk-BA2VLJVU.js";
104
109
  import {
105
110
  agentSpecsForCloud,
106
111
  baseFreshnessFromFingerprints,
@@ -113,7 +118,7 @@ import {
113
118
  probeCloudCheckpoint,
114
119
  resolveCloudCheckpoint,
115
120
  seedAgentVolumesIfFresh
116
- } from "./chunk-3BR63LCB.js";
121
+ } from "./chunk-DJQMK4RN.js";
117
122
  import {
118
123
  ALL_CONNECTORS,
119
124
  BOX_STATUS_EVENT,
@@ -263,7 +268,7 @@ import {
263
268
  waitForTmuxPaneContent,
264
269
  warmUpClaudeCredentials,
265
270
  writeJob
266
- } from "./chunk-3PSRBK24.js";
271
+ } from "./chunk-UIFL7F2G.js";
267
272
  import {
268
273
  BUILT_IN_DEFAULTS,
269
274
  CLOUD_PROVIDER_NAMES,
@@ -289,8 +294,9 @@ import {
289
294
  resolveDaytonaClass,
290
295
  resolveDefaultCheckpoint,
291
296
  setConfigValue,
297
+ setConfigWarningSink,
292
298
  unsetConfigValue
293
- } from "./chunk-5F5SOSDY.js";
299
+ } from "./chunk-JGZSA5ZI.js";
294
300
  import {
295
301
  AmbiguousBoxError,
296
302
  BoxNotFoundError,
@@ -369,7 +375,7 @@ import {
369
375
  toSyncKind,
370
376
  transportSettingsTarget,
371
377
  upsertClaudeSshConfig
372
- } from "./chunk-4LS2TOF3.js";
378
+ } from "./chunk-PK2QF4IR.js";
373
379
  import "./chunk-G3H2L3O2.js";
374
380
  import {
375
381
  __export,
@@ -377,14 +383,14 @@ import {
377
383
  } from "./chunk-WJFZJZIM.js";
378
384
 
379
385
  // src/version.ts
380
- var AGENTBOX_VERSION = true ? "0.25.1" : "0.0.0-dev";
381
- var AGENTBOX_COMMIT = true ? "e7696959f" : "dev";
386
+ var AGENTBOX_VERSION = true ? "0.26.1" : "0.0.0-dev";
387
+ var AGENTBOX_COMMIT = true ? "7b5111bf" : "dev";
382
388
 
383
389
  // src/index.ts
384
390
  import { existsSync as _existsSync } from "fs";
385
391
  import { dirname as _dirname, resolve as _resolve } from "path";
386
392
  import { fileURLToPath as _fileURLToPath } from "url";
387
- import { Command as Command66 } from "commander";
393
+ import { Command as Command67 } from "commander";
388
394
 
389
395
  // src/engine-override.ts
390
396
  async function applyEngineOverrideAtStartup() {
@@ -399,18 +405,39 @@ async function applyEngineOverrideAtStartup() {
399
405
 
400
406
  // src/help.ts
401
407
  var HELP_GROUPS = [
402
- { title: "Create & run", commands: ["create", "claude", "fork", "codex", "opencode"] },
408
+ {
409
+ title: "Create & run",
410
+ commands: ["create", "attach", "fork", "claude", "codex", "opencode"]
411
+ },
403
412
  {
404
413
  title: "Access",
405
- commands: ["dashboard", "attach", "url", "screen", "code", "shell", "open", "logs", "drive"]
414
+ commands: ["dashboard", "url", "screen", "code", "shell", "open", "logs", "drive"]
406
415
  },
407
- { title: "Inspect", commands: ["list", "status", "top", "agent"] },
408
- { title: "Lifecycle", commands: ["start", "stop", "destroy", "pause", "unpause"] },
409
- { title: "Sync & state", commands: ["download", "cp", "checkpoint", "queue"] },
416
+ { title: "Inspect", commands: ["list", "status", "services", "top", "agent"] },
417
+ { title: "Lifecycle", commands: ["start", "stop", "destroy", "pause", "unpause", "recover"] },
410
418
  {
411
- title: "Advanced",
419
+ title: "Git & sync",
420
+ commands: ["git", "git push", "git pull", "git pr", "download", "cp", "checkpoint", "queue"]
421
+ },
422
+ {
423
+ title: "Providers",
412
424
  commands: [
413
425
  "prepare",
426
+ "docker",
427
+ "daytona",
428
+ "hetzner",
429
+ "vercel",
430
+ "e2b",
431
+ "digitalocean",
432
+ "remote-docker",
433
+ "plugin",
434
+ "inbound",
435
+ "connect"
436
+ ]
437
+ },
438
+ {
439
+ title: "Advanced",
440
+ commands: [
414
441
  "wait",
415
442
  "prune",
416
443
  "doctor",
@@ -418,16 +445,55 @@ var HELP_GROUPS = [
418
445
  "install",
419
446
  "app",
420
447
  "config",
421
- "git",
422
448
  "relay",
423
- "docker",
424
- "daytona",
425
- "hetzner",
426
- "vercel",
427
- "e2b"
449
+ "hub"
428
450
  ]
429
451
  }
430
452
  ];
453
+ var SHORT_DESCRIPTIONS = {
454
+ create: "Create and start a new agent box (no agent launched)",
455
+ claude: "Create a box and launch Claude Code (detachable tmux session)",
456
+ codex: "Create a box and launch OpenAI Codex (detachable tmux session)",
457
+ opencode: "Create a box and launch OpenCode (detachable tmux session)",
458
+ fork: "Fork the current host agent session into a new box and resume it there",
459
+ attach: "Attach to the running agent tmux session in a box",
460
+ url: "Open a box's web app URL in the browser",
461
+ shell: "Open an interactive shell in a box (detachable tmux session)",
462
+ open: "Mount a box /workspace in Finder (sshfs), or open it in a host app",
463
+ drive: "Drive a box tmux session: snapshot screen, send keys, wait for output",
464
+ top: "Live resource monitor (cpu/mem/disk) for a box, project, or all boxes",
465
+ agent: "Query and wait on the in-box coding agent's state",
466
+ start: "Start a stopped box",
467
+ stop: "Stop a box (disk preserved)",
468
+ destroy: "Destroy a box and discard its writable layer",
469
+ pause: "Pause a box (docker cgroup freeze / cloud archive)",
470
+ unpause: "Resume a paused box",
471
+ recover: "Reconnect to an already-running box without power-cycling it",
472
+ download: "Download a box's /workspace back to the host (gitignore-aware)",
473
+ cp: "Copy files between host and box (like `docker cp`)",
474
+ checkpoint: "List and manage project checkpoints (warm state new boxes start from)",
475
+ "git pull": "Fetch via the relay then merge in /workspace (or switch branch first)",
476
+ prepare: "Build provider base images / snapshots, or show what's prepared",
477
+ docker: "Local Docker provider (the default) \u2014 sugar for `--provider docker`",
478
+ daytona: "Daytona cloud provider \u2014 credentials + `--provider daytona` sugar",
479
+ hetzner: "Hetzner Cloud VPS provider \u2014 credentials, firewall + provider sugar",
480
+ vercel: "Vercel Sandbox provider \u2014 credentials + `--provider vercel` sugar",
481
+ e2b: "E2B sandbox provider \u2014 credentials + `--provider e2b` sugar",
482
+ digitalocean: "DigitalOcean Droplet provider \u2014 credentials, firewall + provider sugar",
483
+ "remote-docker": "Docker on a machine you own, over SSH \u2014 provider sugar",
484
+ inbound: "Set a VPS box's inbound-access policy (per-box firewall)",
485
+ connect: "Print a VPS box's SSH details to drive it from another device",
486
+ prune: "Clean up orphan state records (--all: orphan docker resources)",
487
+ doctor: "Diagnose system compatibility and provider readiness",
488
+ "self-update": "Update agentbox, host skills, box image, relay/hub, and the tray app",
489
+ install: "Interactive setup wizard: pick a provider, log in, prepare its image",
490
+ app: "Control the AgentBox menu-bar app",
491
+ config: "Read / write layered config (global, project, workspace)",
492
+ hub: "Run the AgentBox hub \u2014 relay + Web UI on http://127.0.0.1:8787"
493
+ };
494
+ var TERM_OVERRIDES = {
495
+ "git pr": "pr create -f"
496
+ };
431
497
  function term(cmd) {
432
498
  const aliases = cmd.aliases();
433
499
  return aliases.length ? `${cmd.name()}|${aliases.join("|")}` : cmd.name();
@@ -438,31 +504,131 @@ function isHiddenCommand(cmd) {
438
504
  function buildGroupedHelp(program2) {
439
505
  const visible = program2.commands.filter((c) => !isHiddenCommand(c));
440
506
  const byName = new Map(visible.map((c) => [c.name(), c]));
441
- const grouped = new Set(HELP_GROUPS.flatMap((g) => g.commands));
507
+ const grouped = new Set(HELP_GROUPS.flatMap((g) => g.commands.map((n) => n.split(" ")[0])));
442
508
  const orphans = visible.map((c) => c.name()).filter((n) => !grouped.has(n));
443
509
  const groups = [...HELP_GROUPS];
444
510
  if (orphans.length) groups.push({ title: "Other", commands: orphans });
445
- const terms = [];
511
+ const resolve7 = (name) => {
512
+ const parts = name.split(" ");
513
+ let cmd = byName.get(parts[0]);
514
+ for (const part of parts.slice(1)) {
515
+ cmd = cmd?.commands.find((c) => c.name() === part || c.aliases().includes(part));
516
+ }
517
+ return cmd ? { cmd, depth: parts.length - 1 } : void 0;
518
+ };
519
+ const rowTerm = (name, cmd) => TERM_OVERRIDES[name] ?? term(cmd);
520
+ const termWidths = [];
446
521
  for (const g of groups) {
447
522
  for (const name of g.commands) {
448
- const cmd = byName.get(name);
449
- if (cmd) terms.push(term(cmd));
523
+ const row2 = resolve7(name);
524
+ if (row2) termWidths.push(rowTerm(name, row2.cmd).length + row2.depth * 2);
450
525
  }
451
526
  }
452
- const pad5 = Math.max(0, ...terms.map((t) => t.length)) + 2;
527
+ const pad5 = Math.max(0, ...termWidths) + 2;
528
+ const descBudget = MAX_HELP_LINE - 4 - pad5;
453
529
  const lines = ["Commands:"];
454
530
  for (const g of groups) {
455
531
  const title = g.hint ? `${g.title} (${g.hint})` : g.title;
456
532
  lines.push("", ` ${title}`);
457
533
  for (const name of g.commands) {
458
- const cmd = byName.get(name);
459
- if (!cmd) continue;
460
- lines.push(` ${term(cmd).padEnd(pad5)}${cmd.description()}`);
534
+ const row2 = resolve7(name);
535
+ if (!row2) continue;
536
+ const description = SHORT_DESCRIPTIONS[name] ?? row2.cmd.description();
537
+ const indent = " " + " ".repeat(row2.depth);
538
+ lines.push(
539
+ `${indent}${rowTerm(name, row2.cmd).padEnd(pad5 - row2.depth * 2)}${clip(description, descBudget)}`
540
+ );
461
541
  }
462
542
  }
463
543
  lines.push("", "Run `agentbox <command> --help` for command-specific options.");
464
544
  return lines.join("\n");
465
545
  }
546
+ var MAX_HELP_LINE = 100;
547
+ function clip(text4, budget) {
548
+ if (text4.length <= budget) return text4;
549
+ const cut = text4.lastIndexOf(" ", budget - 1);
550
+ return `${text4.slice(0, cut > budget / 2 ? cut : budget - 1).trimEnd()}\u2026`;
551
+ }
552
+ var COMPACT_HELP = [
553
+ {
554
+ title: "Run an agent",
555
+ rows: [
556
+ {
557
+ commands: ["claude", "codex", "opencode"],
558
+ description: "Start the agent in a new isolated box"
559
+ }
560
+ ]
561
+ },
562
+ {
563
+ title: "Work with boxes",
564
+ rows: [
565
+ { commands: ["attach"], description: "Re-attach to a box's agent session" },
566
+ { commands: ["list"], description: "List agent boxes (-g for all projects)" },
567
+ {
568
+ commands: ["url", "screen", "open", "code"],
569
+ description: "Open a box's web app, VNC, files, or editor"
570
+ },
571
+ { commands: ["destroy"], description: "Destroy a box" }
572
+ ]
573
+ },
574
+ {
575
+ title: "Git",
576
+ rows: [
577
+ {
578
+ commands: ["git"],
579
+ term: "git push|pull|pr",
580
+ description: "Push box commits to the remote, pull host changes into the box, open PRs"
581
+ }
582
+ ]
583
+ }
584
+ ];
585
+ var COMPACT_EXAMPLE = [
586
+ "Example:",
587
+ " agentbox claude # launch Claude, one box per task/branch",
588
+ " agentbox hetzner|e2b|\u2026 codex # launch with other agents or providers",
589
+ " ! agentbox fork hetzner|e2b|\u2026 # teleport the current session from the chat",
590
+ "",
591
+ " agentbox attach 1 # detach with Ctrl+a d, then re-attach",
592
+ "",
593
+ " # Then ask your agent to push/pr or do it from your pc:",
594
+ " agentbox git push 1 # push to remote",
595
+ " agentbox git push 1 --host-only # move back the branch to your pc",
596
+ " agentbox git pr create 1 -f # create a PR from the box",
597
+ " agentbox destroy # remove the box",
598
+ "",
599
+ " # Or ask your host agent (via the /agentbox-info skill) to spin up",
600
+ " # boxes for subtasks and orchestrate them for you"
601
+ ];
602
+ var COMPACT_MORE = [
603
+ " More in `agentbox help`",
604
+ " dashboard, pause|stop|checkpoint, claude|codex|opencode,",
605
+ " connect|download|services|inbound, drive|queue, config, \u2026"
606
+ ];
607
+ var COMPACT_FOOTER = ["Run `agentbox <command> --help` for command options."];
608
+ function buildCompactHelp(program2) {
609
+ const byName = new Map(program2.commands.map((c) => [c.name(), c]));
610
+ const rowTerm = (row2) => {
611
+ if (row2.term) return row2.term;
612
+ if (row2.commands.length === 1) {
613
+ const cmd = byName.get(row2.commands[0]);
614
+ if (cmd) return term(cmd);
615
+ }
616
+ return row2.commands.join("|");
617
+ };
618
+ const allTerms = COMPACT_HELP.flatMap((g) => g.rows.map(rowTerm));
619
+ const pad5 = Math.max(0, ...allTerms.map((t) => t.length)) + 3;
620
+ const lines = ["Commands:"];
621
+ for (const g of COMPACT_HELP) {
622
+ lines.push("", ` ${g.title}`);
623
+ for (const row2 of g.rows) {
624
+ const cmd = byName.get(row2.commands[0]);
625
+ const description = row2.description ?? cmd?.description() ?? "";
626
+ lines.push(` ${rowTerm(row2).padEnd(pad5)}${description}`);
627
+ }
628
+ }
629
+ lines.push("", ...COMPACT_MORE, "", ...COMPACT_EXAMPLE, "", ...COMPACT_FOOTER);
630
+ return lines.join("\n");
631
+ }
466
632
 
467
633
  // src/commands/agent.ts
468
634
  import { log as log3 } from "@clack/prompts";
@@ -1343,7 +1509,7 @@ function decideTrayUpdate(input) {
1343
1509
  function isReleaseVersion(v) {
1344
1510
  const core = v.split("-", 1)[0] ?? v;
1345
1511
  const parts = core.split(".");
1346
- return parts.length === 3 && parts.every((p) => /^\d+$/.test(p)) && core !== "0.0.0";
1512
+ return parts.length === 3 && parts.every((p2) => /^\d+$/.test(p2)) && core !== "0.0.0";
1347
1513
  }
1348
1514
  async function readInstalledTrayVersion() {
1349
1515
  if (!trayInstalled()) return void 0;
@@ -1903,6 +2069,15 @@ function cloudSizingProviderOptions(providerName, cfg, flags = {}) {
1903
2069
  if (providerName === "e2b") {
1904
2070
  out.timeoutMs = cfg.box.e2bTimeoutMs;
1905
2071
  }
2072
+ if (providerName === "remote-docker") {
2073
+ const host = (flags.remoteHost?.trim() || cfg.box.remoteDockerHost || "").trim();
2074
+ if (host.length === 0) {
2075
+ throw new Error(
2076
+ "remote-docker needs an SSH destination: use `agentbox docker:<host> \u2026`, pass `--remote-host <host>`, or set a default with `agentbox config set box.remoteDockerHost <user@host>`"
2077
+ );
2078
+ }
2079
+ out.remoteHost = host;
2080
+ }
1906
2081
  if (providerName === "daytona") {
1907
2082
  out.timeoutMs = cfg.box.daytonaTimeoutMs;
1908
2083
  out.sandboxClass = resolveDaytonaClass(cfg);
@@ -1916,9 +2091,9 @@ function cloudSizingProviderOptions(providerName, cfg, flags = {}) {
1916
2091
  import { stat } from "fs/promises";
1917
2092
  import { homedir as homedir4 } from "os";
1918
2093
  import { join as join6 } from "path";
1919
- async function fileExists(p) {
2094
+ async function fileExists(p2) {
1920
2095
  try {
1921
- await stat(p);
2096
+ await stat(p2);
1922
2097
  return true;
1923
2098
  } catch {
1924
2099
  return false;
@@ -2017,11 +2192,11 @@ function toTarExcludes(tokens) {
2017
2192
  return out;
2018
2193
  }
2019
2194
  function effectiveExcludes(userTokens, useDefaults) {
2020
- const seen = /* @__PURE__ */ new Set();
2195
+ const seen2 = /* @__PURE__ */ new Set();
2021
2196
  const out = [];
2022
2197
  const add = (t) => {
2023
- if (t && !seen.has(t)) {
2024
- seen.add(t);
2198
+ if (t && !seen2.has(t)) {
2199
+ seen2.add(t);
2025
2200
  out.push(t);
2026
2201
  }
2027
2202
  };
@@ -2044,7 +2219,7 @@ function isPathExcluded(relPath, tokens) {
2044
2219
  }
2045
2220
  return false;
2046
2221
  }
2047
- async function buildNode(abs, rel, tokens, seen) {
2222
+ async function buildNode(abs, rel, tokens, seen2) {
2048
2223
  let bytes = 0;
2049
2224
  const children = [];
2050
2225
  let entries;
@@ -2064,10 +2239,10 @@ async function buildNode(abs, rel, tokens, seen) {
2064
2239
  continue;
2065
2240
  }
2066
2241
  const key = `${String(st.dev)}:${String(st.ino)}`;
2067
- if (seen.has(key)) continue;
2068
- seen.add(key);
2242
+ if (seen2.has(key)) continue;
2243
+ seen2.add(key);
2069
2244
  if (st.isDirectory()) {
2070
- const child = await buildNode(full, childRel, tokens, seen);
2245
+ const child = await buildNode(full, childRel, tokens, seen2);
2071
2246
  bytes += child.bytes;
2072
2247
  children.push(child);
2073
2248
  } else if (st.isFile()) {
@@ -2246,8 +2421,8 @@ function expandHostPath(src, ctx) {
2246
2421
  if (isAbsolute(src)) return resolve(src);
2247
2422
  throw new Error(`${ctx.where}: src "${src}" must start with /, ~/, or ./`);
2248
2423
  }
2249
- function containsDotDot(p) {
2250
- const segs = normalize(p).split("/");
2424
+ function containsDotDot(p2) {
2425
+ const segs = normalize(p2).split("/");
2251
2426
  return segs.some((s) => s === "..");
2252
2427
  }
2253
2428
  function validateBoxDest(dest, ctx) {
@@ -2264,15 +2439,15 @@ function validateBoxDest(dest, ctx) {
2264
2439
  if (DENYLIST_DEST_EXACT.has(dest)) {
2265
2440
  throw new Error(`${ctx.where}.dest "${dest}" is on the denylist`);
2266
2441
  }
2267
- for (const p of DENYLIST_DEST_PREFIXES) {
2268
- if (dest === p || dest.startsWith(`${p}/`)) {
2269
- throw new Error(`${ctx.where}.dest "${dest}" is on the denylist (prefix ${p})`);
2442
+ for (const p2 of DENYLIST_DEST_PREFIXES) {
2443
+ if (dest === p2 || dest.startsWith(`${p2}/`)) {
2444
+ throw new Error(`${ctx.where}.dest "${dest}" is on the denylist (prefix ${p2})`);
2270
2445
  }
2271
2446
  }
2272
2447
  }
2273
2448
  async function dirSizeCapped(dir, cap, exclude = []) {
2274
2449
  let total = 0;
2275
- const seen = /* @__PURE__ */ new Set();
2450
+ const seen2 = /* @__PURE__ */ new Set();
2276
2451
  async function walk(d) {
2277
2452
  if (total > cap) return;
2278
2453
  const { readdir: readdir4 } = await import("fs/promises");
@@ -2294,8 +2469,8 @@ async function dirSizeCapped(dir, cap, exclude = []) {
2294
2469
  continue;
2295
2470
  }
2296
2471
  const key = `${String(st.dev)}:${String(st.ino)}`;
2297
- if (seen.has(key)) continue;
2298
- seen.add(key);
2472
+ if (seen2.has(key)) continue;
2473
+ seen2.add(key);
2299
2474
  if (st.isDirectory()) {
2300
2475
  await walk(full);
2301
2476
  } else if (st.isFile()) {
@@ -2310,7 +2485,7 @@ async function dirSizeCapped(dir, cap, exclude = []) {
2310
2485
 
2311
2486
  // src/lib/carry-resync.ts
2312
2487
  async function resyncCarryFiles(args) {
2313
- const log67 = args.onLog ?? (() => {
2488
+ const log69 = args.onLog ?? (() => {
2314
2489
  });
2315
2490
  const prior = args.box.carry?.entries ?? [];
2316
2491
  if (prior.length === 0) return { recopied: 0, skippedNew: 0 };
@@ -2322,7 +2497,7 @@ async function resyncCarryFiles(args) {
2322
2497
  maxBytes: cfg.effective.box.cpMaxBytes
2323
2498
  });
2324
2499
  if (resolved.errors.length > 0) {
2325
- log67(`carry: resync skipped (resolve errors: ${resolved.errors.length})`);
2500
+ log69(`carry: resync skipped (resolve errors: ${resolved.errors.length})`);
2326
2501
  return { recopied: 0, skippedNew: 0 };
2327
2502
  }
2328
2503
  const priorByDest = new Map(prior.map((e) => [e.dest, e]));
@@ -2339,7 +2514,7 @@ async function resyncCarryFiles(args) {
2339
2514
  if (hash === void 0 || hash !== existing.hash) changed.push(entry);
2340
2515
  }
2341
2516
  if (skippedNew > 0) {
2342
- log67(
2517
+ log69(
2343
2518
  `carry: ${String(skippedNew)} new entry/entries not applied on resync \u2014 recreate the box to approve`
2344
2519
  );
2345
2520
  }
@@ -2347,9 +2522,9 @@ async function resyncCarryFiles(args) {
2347
2522
  const result = await copyCarryPathsToBox({
2348
2523
  container: args.box.container,
2349
2524
  entries: changed,
2350
- onLog: log67
2525
+ onLog: log69
2351
2526
  });
2352
- for (const err of result.errors) log67(`carry: ${err}`);
2527
+ for (const err of result.errors) log69(`carry: ${err}`);
2353
2528
  const updatedByDest = new Map(result.applied.map((e) => [e.dest, e]));
2354
2529
  const mergedEntries = prior.map((e) => updatedByDest.get(e.dest) ?? e);
2355
2530
  await recordBox({
@@ -2357,7 +2532,7 @@ async function resyncCarryFiles(args) {
2357
2532
  carry: { count: mergedEntries.length, entries: mergedEntries }
2358
2533
  });
2359
2534
  if (result.applied.length > 0) {
2360
- log67(`carry: re-copied ${String(result.applied.length)} changed file(s)`);
2535
+ log69(`carry: re-copied ${String(result.applied.length)} changed file(s)`);
2361
2536
  }
2362
2537
  return { recopied: result.applied.length, skippedNew };
2363
2538
  }
@@ -2691,9 +2866,9 @@ async function resolveBranchSelection(opts) {
2691
2866
  }
2692
2867
 
2693
2868
  // src/lib/launch-recap.ts
2694
- function homeShorten(p) {
2869
+ function homeShorten(p2) {
2695
2870
  const home = homedir6();
2696
- return p === home || p.startsWith(home + "/") ? "~" + p.slice(home.length) : p;
2871
+ return p2 === home || p2.startsWith(home + "/") ? "~" + p2.slice(home.length) : p2;
2697
2872
  }
2698
2873
  function whiten(text4) {
2699
2874
  if (process.env.NO_COLOR) return text4;
@@ -3013,21 +3188,21 @@ async function resolveSshIdentity(host) {
3013
3188
  for (const line of (r.stdout ?? "").split("\n")) {
3014
3189
  const m = /^identityfile\s+(.+)$/i.exec(line.trim());
3015
3190
  if (!m) continue;
3016
- const p = m[1].replace(/^~(?=\/)/, home);
3017
- if (await fileExists2(p)) return p;
3191
+ const p2 = m[1].replace(/^~(?=\/)/, home);
3192
+ if (await fileExists2(p2)) return p2;
3018
3193
  }
3019
3194
  }
3020
3195
  } catch {
3021
3196
  }
3022
3197
  for (const name of ["id_ed25519", "id_rsa", "id_ecdsa"]) {
3023
- const p = join11(home, ".ssh", name);
3024
- if (await fileExists2(p)) return p;
3198
+ const p2 = join11(home, ".ssh", name);
3199
+ if (await fileExists2(p2)) return p2;
3025
3200
  }
3026
3201
  return null;
3027
3202
  }
3028
- async function fileExists2(p) {
3203
+ async function fileExists2(p2) {
3029
3204
  try {
3030
- return (await stat4(p)).isFile();
3205
+ return (await stat4(p2)).isFile();
3031
3206
  } catch {
3032
3207
  return false;
3033
3208
  }
@@ -3393,13 +3568,13 @@ async function resolveCodexTeleport(opts) {
3393
3568
  forwardArgs: ["resume", picked.uuid]
3394
3569
  };
3395
3570
  }
3396
- function posixBasename(p) {
3397
- const i = p.lastIndexOf("/");
3398
- return i === -1 ? p : p.slice(i + 1);
3571
+ function posixBasename(p2) {
3572
+ const i = p2.lastIndexOf("/");
3573
+ return i === -1 ? p2 : p2.slice(i + 1);
3399
3574
  }
3400
- function posixDirname(p) {
3401
- const i = p.lastIndexOf("/");
3402
- return i === -1 ? "." : p.slice(0, i);
3575
+ function posixDirname(p2) {
3576
+ const i = p2.lastIndexOf("/");
3577
+ return i === -1 ? "." : p2.slice(0, i);
3403
3578
  }
3404
3579
  async function listCodexSessions(sessionsRoot) {
3405
3580
  const out = [];
@@ -3561,10 +3736,10 @@ import { existsSync as existsSync7 } from "fs";
3561
3736
  import { homedir as homedir10, tmpdir as tmpdir5 } from "os";
3562
3737
  import { basename as basename2, isAbsolute as isAbsolute2, join as join14, resolve as resolve2 } from "path";
3563
3738
  var BOX_CLAUDE_PLANS_DIR = "/home/vscode/.claude/plans";
3564
- function expandHome(p, hostHome) {
3565
- if (p === "~") return hostHome;
3566
- if (p.startsWith("~/")) return join14(hostHome, p.slice(2));
3567
- return isAbsolute2(p) ? p : resolve2(p);
3739
+ function expandHome(p2, hostHome) {
3740
+ if (p2 === "~") return hostHome;
3741
+ if (p2.startsWith("~/")) return join14(hostHome, p2.slice(2));
3742
+ return isAbsolute2(p2) ? p2 : resolve2(p2);
3568
3743
  }
3569
3744
  async function resolvePlanTeleport(opts) {
3570
3745
  const hostHome = opts.hostHome ?? homedir10();
@@ -3887,7 +4062,7 @@ async function evaluateCheckpoint(provider, projectRoot, ref) {
3887
4062
  }
3888
4063
  async function evaluateBaseFreshness(provider, claudeInstall) {
3889
4064
  if (provider === "docker") {
3890
- const { evaluateDockerBaseFreshness: evaluateDockerBaseFreshness2 } = await import("./dist-SN6ABGMD.js");
4065
+ const { evaluateDockerBaseFreshness: evaluateDockerBaseFreshness2 } = await import("./dist-POVRY7HO.js");
3891
4066
  return await evaluateDockerBaseFreshness2({ claudeInstall });
3892
4067
  }
3893
4068
  const stored = currentCloudBaseFingerprint(provider);
@@ -3908,7 +4083,7 @@ function buildSetupInitialPrompt(workspace, hasAgentboxYaml = false) {
3908
4083
  var WIZARD_AUTOLAUNCH_ENV = "AGENTBOX_WIZARD_AUTOLAUNCH";
3909
4084
  var WIZARD_ENV_FILES_ENV = "AGENTBOX_WIZARD_ENV_FILES";
3910
4085
  var WIZARD_RECREATE_ENV = "AGENTBOX_WIZARD_RECREATE";
3911
- var WIZARD_ENV_SCAN_PATTERNS = DEFAULT_ENV_PATTERNS.filter((p) => p !== "agentbox.yaml");
4086
+ var WIZARD_ENV_SCAN_PATTERNS = DEFAULT_ENV_PATTERNS.filter((p2) => p2 !== "agentbox.yaml");
3912
4087
  async function maybeRunSetupWizard(args) {
3913
4088
  if (process.env[WIZARD_AUTOLAUNCH_ENV] === "1") {
3914
4089
  if (args.command !== "claude") return { action: "proceed" };
@@ -3984,7 +4159,7 @@ async function maybeRunSetupWizard(args) {
3984
4159
  if (found.length > 0) {
3985
4160
  const picked = await multiselect({
3986
4161
  message: "Import host env/secret files into the box? (space to toggle, enter to confirm)",
3987
- options: found.map((p) => ({ value: p, label: p })),
4162
+ options: found.map((p2) => ({ value: p2, label: p2 })),
3988
4163
  initialValues: found,
3989
4164
  required: false
3990
4165
  });
@@ -4065,7 +4240,7 @@ function serializeEnvFilesForEnv(files) {
4065
4240
  }
4066
4241
  function parseEnvFilesFromEnv(raw) {
4067
4242
  if (!raw) return void 0;
4068
- const out = raw.split("\0").filter((p) => p.length > 0);
4243
+ const out = raw.split("\0").filter((p2) => p2.length > 0);
4069
4244
  return out.length > 0 ? out : void 0;
4070
4245
  }
4071
4246
  function passthroughFlags(opts) {
@@ -4148,7 +4323,7 @@ async function renderDocker(status) {
4148
4323
  }
4149
4324
  async function daytonaStatus() {
4150
4325
  try {
4151
- const mod = await import("./dist-5G42NFOG.js");
4326
+ const mod = await import("./dist-AR5CHRSV.js");
4152
4327
  return await mod.getDaytonaStatus();
4153
4328
  } catch (err) {
4154
4329
  return {
@@ -4159,7 +4334,7 @@ async function daytonaStatus() {
4159
4334
  }
4160
4335
  async function e2bStatus() {
4161
4336
  try {
4162
- const mod = await import("./dist-MEK44IS5.js");
4337
+ const mod = await import("./dist-K4LNH3EC.js");
4163
4338
  const cred = mod.readE2bCredStatus();
4164
4339
  if (cred.auth === "none") {
4165
4340
  return { configured: false, reason: "not configured \u2014 run `agentbox e2b login`" };
@@ -4261,14 +4436,15 @@ function resolvePrepareLocation(providerName, cliLocation, effective) {
4261
4436
  const configured = providerName === "hetzner" ? effective?.box.hetznerLocation : providerName === "digitalocean" ? effective?.box.digitaloceanRegion : providerName === "daytona" ? effective?.box.daytonaRegion : void 0;
4262
4437
  return cliLocation?.trim() || configured || void 0;
4263
4438
  }
4264
- async function runPrepare(providerName, opts = {}) {
4265
- if (!isKnownProvider(providerName)) {
4439
+ async function runPrepare(providerSpec, opts = {}) {
4440
+ if (!isKnownProvider(providerSpec)) {
4266
4441
  process.stderr.write(
4267
4442
  `error: --provider must be one of: ${getRuntimeProviderNames().join(", ")}
4268
4443
  `
4269
4444
  );
4270
4445
  process.exit(1);
4271
4446
  }
4447
+ const { name: providerName, remoteHost } = parseProviderSpec(providerSpec);
4272
4448
  if (providerName === "daytona" && !opts.yes && process.stdin.isTTY) {
4273
4449
  process.stdout.write(
4274
4450
  "This will trigger a Daytona image build (~7 min cold, ~seconds with cache) and register a named snapshot in your org.\nRe-run with --yes to skip this notice.\n"
@@ -4287,6 +4463,7 @@ async function runPrepare(providerName, opts = {}) {
4287
4463
  const vmBaseImage = providerName === "daytona" ? cfg?.effective.box.daytonaVmBaseImage || void 0 : void 0;
4288
4464
  const location = resolvePrepareLocation(providerName, opts.location, cfg?.effective);
4289
4465
  const size = opts.size?.trim() || (cfg ? resolveBoxSize(cfg.effective, providerName) : "") || void 0;
4466
+ const host = providerName === "remote-docker" ? remoteHost || cfg?.effective.box.remoteDockerHost || void 0 : void 0;
4290
4467
  const sp = spinner4();
4291
4468
  sp.start(`preparing ${providerName}\u2026`);
4292
4469
  try {
@@ -4299,6 +4476,7 @@ async function runPrepare(providerName, opts = {}) {
4299
4476
  claudeInstall,
4300
4477
  location,
4301
4478
  size,
4479
+ host,
4302
4480
  sandboxClass,
4303
4481
  vmBaseImage,
4304
4482
  onLog: (line) => sp.message(line.slice(0, 80))
@@ -4962,7 +5140,7 @@ async function attachClaudeWrapped(box, sessionName, reattach, onError, openIn)
4962
5140
  onError,
4963
5141
  openIn,
4964
5142
  onPasteImage: canPaste ? () => pasteHostClipboardImage(provider, box) : void 0,
4965
- onPasteImageFile: canPaste ? (p) => uploadImageFileToBox(provider, box, p) : void 0
5143
+ onPasteImageFile: canPaste ? (p2) => uploadImageFileToBox(provider, box, p2) : void 0
4966
5144
  });
4967
5145
  process.exit(code);
4968
5146
  }
@@ -5203,7 +5381,9 @@ var claudeCommand = new Command5("claude").description("Create a sandboxed box a
5203
5381
  cliOverrides: buildClaudeCliOverrides(opts)
5204
5382
  });
5205
5383
  const projectRoot = (await findProjectRoot(opts.workspace)).root;
5206
- const providerName = opts.provider ?? cfg.effective.box.provider ?? "docker";
5384
+ const { name: providerName, remoteHost } = parseProviderSpec(
5385
+ opts.provider ?? cfg.effective.box.provider ?? "docker"
5386
+ );
5207
5387
  const isCloud = providerName !== "docker";
5208
5388
  if (cfg.effective.git.pushMode === "direct" && !isCloud) {
5209
5389
  prompt_exports.log.error(
@@ -5420,7 +5600,9 @@ var claudeCommand = new Command5("claude").description("Create a sandboxed box a
5420
5600
  gitPushMode: cfg.effective.git.pushMode,
5421
5601
  // Per-provider session-lifetime (e2b/vercel timeout) so the keepalive
5422
5602
  // seeds correctly; mirrors `agentbox create`.
5423
- providerOptions: cloudSizingProviderOptions(provider.name, cfg.effective)
5603
+ providerOptions: cloudSizingProviderOptions(provider.name, cfg.effective, {
5604
+ remoteHost
5605
+ })
5424
5606
  },
5425
5607
  binary: "claude",
5426
5608
  hasSeedPrompt: Boolean(planPrepared) || wiz.action === "launch-with-prompt" && Boolean(wiz.initialPrompt) || Boolean(resumePrepared),
@@ -6189,9 +6371,9 @@ async function maybeRunCodexLogin(args) {
6189
6371
  }
6190
6372
  async function cloudCodexCredAvailable(env = process.env) {
6191
6373
  if ((env["OPENAI_API_KEY"] ?? "").length > 0) return true;
6192
- for (const p of [CODEX_CREDENTIALS_BACKUP_FILE, join18(homedir14(), ".codex", "auth.json")]) {
6374
+ for (const p2 of [CODEX_CREDENTIALS_BACKUP_FILE, join18(homedir14(), ".codex", "auth.json")]) {
6193
6375
  try {
6194
- await access(p);
6376
+ await access(p2);
6195
6377
  return true;
6196
6378
  } catch {
6197
6379
  }
@@ -6332,7 +6514,9 @@ var codexCommand = new Command6("codex").description("Create a sandboxed box and
6332
6514
  cliOverrides: buildCodexCliOverrides(opts)
6333
6515
  });
6334
6516
  const projectRoot = (await findProjectRoot(opts.workspace)).root;
6335
- const providerName = opts.provider ?? cfg.effective.box.provider ?? "docker";
6517
+ const { name: providerName, remoteHost } = parseProviderSpec(
6518
+ opts.provider ?? cfg.effective.box.provider ?? "docker"
6519
+ );
6336
6520
  const isCloud = providerName !== "docker";
6337
6521
  if (cfg.effective.git.pushMode === "direct" && !isCloud) {
6338
6522
  prompt_exports.log.error(
@@ -6467,7 +6651,9 @@ var codexCommand = new Command6("codex").description("Create a sandboxed box and
6467
6651
  controlPlaneUrl: cfg.effective.relay.controlPlaneUrl,
6468
6652
  gitPushMode: cfg.effective.git.pushMode,
6469
6653
  // Per-provider session-lifetime (e2b/vercel timeout); mirrors create.
6470
- providerOptions: cloudSizingProviderOptions(provider.name, cfg.effective)
6654
+ providerOptions: cloudSizingProviderOptions(provider.name, cfg.effective, {
6655
+ remoteHost
6656
+ })
6471
6657
  },
6472
6658
  binary: "codex",
6473
6659
  sessionName: cfg.effective.codex.sessionName,
@@ -7050,9 +7236,9 @@ async function cloudOpencodeCredAvailable(env = process.env) {
7050
7236
  for (const k of OPENCODE_FORWARDED_ENV_KEYS) {
7051
7237
  if ((env[k] ?? "").length > 0) return true;
7052
7238
  }
7053
- for (const p of [OPENCODE_CREDENTIALS_BACKUP_FILE, join19(homedir15(), ".local", "share", "opencode", "auth.json")]) {
7239
+ for (const p2 of [OPENCODE_CREDENTIALS_BACKUP_FILE, join19(homedir15(), ".local", "share", "opencode", "auth.json")]) {
7054
7240
  try {
7055
- await access2(p);
7241
+ await access2(p2);
7056
7242
  return true;
7057
7243
  } catch {
7058
7244
  }
@@ -7169,7 +7355,9 @@ var opencodeCommand = new Command7("opencode").description("Create a sandboxed b
7169
7355
  cliOverrides: buildOpencodeCliOverrides(opts)
7170
7356
  });
7171
7357
  const projectRoot = (await findProjectRoot(opts.workspace)).root;
7172
- const providerName = opts.provider ?? cfg.effective.box.provider ?? "docker";
7358
+ const { name: providerName, remoteHost } = parseProviderSpec(
7359
+ opts.provider ?? cfg.effective.box.provider ?? "docker"
7360
+ );
7173
7361
  const isCloud = providerName !== "docker";
7174
7362
  if (cfg.effective.git.pushMode === "direct" && !isCloud) {
7175
7363
  prompt_exports.log.error(
@@ -7304,7 +7492,9 @@ var opencodeCommand = new Command7("opencode").description("Create a sandboxed b
7304
7492
  controlPlaneUrl: cfg.effective.relay.controlPlaneUrl,
7305
7493
  gitPushMode: cfg.effective.git.pushMode,
7306
7494
  // Per-provider session-lifetime (e2b/vercel timeout); mirrors create.
7307
- providerOptions: cloudSizingProviderOptions(provider.name, cfg.effective)
7495
+ providerOptions: cloudSizingProviderOptions(provider.name, cfg.effective, {
7496
+ remoteHost
7497
+ })
7308
7498
  },
7309
7499
  binary: "opencode",
7310
7500
  sessionName: cfg.effective.opencode.sessionName,
@@ -7894,7 +8084,7 @@ function cloudRow(c, backend, def) {
7894
8084
  }
7895
8085
  async function listAllProjects() {
7896
8086
  const projects = await listProjectsConfigured();
7897
- const rootByHash = new Map(projects.map((p) => [p.hash, p.originalPath]));
8087
+ const rootByHash = new Map(projects.map((p2) => [p2.hash, p2.originalPath]));
7898
8088
  const dockerGroups = await listAllCheckpoints();
7899
8089
  const cloudGroups = await Promise.all(
7900
8090
  (await allCloudBackends()).map(async (backend) => ({
@@ -8275,9 +8465,22 @@ var OPEN_IN_APPS = [
8275
8465
  "iterm2",
8276
8466
  "finder"
8277
8467
  ];
8278
- var PERSISTENT_SSH_PROVIDERS = ["docker", "hetzner"];
8279
- var IDE_PROVIDERS = ["docker", "hetzner", "daytona"];
8280
- var SSH_MOUNT_PROVIDERS = ["docker", "hetzner", "daytona"];
8468
+ var PERSISTENT_SSH_PROVIDERS = [
8469
+ "docker",
8470
+ "hetzner",
8471
+ // remote-docker qualifies for the same reason docker does: a per-box key that
8472
+ // outlives the CLI call. Its box sshd is reached by `ProxyJump`ing through the
8473
+ // engine (ssh's own transport — no AgentBox-held tunnel to keep alive), and
8474
+ // start/open re-resolve the published port into `~/.ssh/config`.
8475
+ "remote-docker"
8476
+ ];
8477
+ var IDE_PROVIDERS = ["docker", "hetzner", "daytona", "remote-docker"];
8478
+ var SSH_MOUNT_PROVIDERS = [
8479
+ "docker",
8480
+ "hetzner",
8481
+ "daytona",
8482
+ "remote-docker"
8483
+ ];
8281
8484
  function realSeams() {
8282
8485
  return {
8283
8486
  env: process.env,
@@ -8299,8 +8502,8 @@ function macAppInstalled(appName, seams) {
8299
8502
  return seams.existsSync(join20("/Applications", appName)) || seams.existsSync(join20(seams.homedir(), "Applications", appName));
8300
8503
  }
8301
8504
  function defaultHerdrSocketPath(seams = realSeams()) {
8302
- const p = join20(seams.homedir(), ".config", "herdr", "herdr.sock");
8303
- return seams.existsSync(p) ? p : void 0;
8505
+ const p2 = join20(seams.homedir(), ".config", "herdr", "herdr.sock");
8506
+ return seams.existsSync(p2) ? p2 : void 0;
8304
8507
  }
8305
8508
  var CMUX_APP_CLI_SUFFIX = "cmux.app/Contents/Resources/bin/cmux";
8306
8509
  var VSCODE_APPS = [
@@ -8323,8 +8526,8 @@ function resolveVscodeCli(cli, seams = realSeams()) {
8323
8526
  const app = VSCODE_APPS.find((a) => a.cli === cli);
8324
8527
  if (!app) return void 0;
8325
8528
  for (const root of ["/Applications", join20(seams.homedir(), "Applications")]) {
8326
- const p = join20(root, app.appName, app.bundleCliSuffix);
8327
- if (seams.existsSync(p)) return p;
8529
+ const p2 = join20(root, app.appName, app.bundleCliSuffix);
8530
+ if (seams.existsSync(p2)) return p2;
8328
8531
  }
8329
8532
  return void 0;
8330
8533
  }
@@ -8504,20 +8707,20 @@ async function prepareDockerAttach(box, opts) {
8504
8707
  return attachedContainerUri(box.container, { dockerContext });
8505
8708
  }
8506
8709
  async function prepareCloudAttach(box, opts) {
8507
- const p = await providerForBox(box);
8508
- const state = await p.probeState(box);
8710
+ const p2 = await providerForBox(box);
8711
+ const state = await p2.probeState(box);
8509
8712
  if (state === "paused") {
8510
8713
  log20.info("box is paused; resuming");
8511
- await p.resume(box);
8714
+ await p2.resume(box);
8512
8715
  } else if (state === "stopped") {
8513
8716
  log20.info("box is stopped; starting");
8514
- await p.start(box);
8717
+ await p2.start(box);
8515
8718
  } else if (state === "missing") {
8516
8719
  throw new Error(`cloud sandbox for ${box.name} is missing; was it deleted?`);
8517
8720
  }
8518
8721
  if (opts.wait) {
8519
8722
  try {
8520
- const r = await p.exec(box, ["agentbox-ctl", "wait-ready", "--json", "--timeout", opts.timeoutMs]);
8723
+ const r = await p2.exec(box, ["agentbox-ctl", "wait-ready", "--json", "--timeout", opts.timeoutMs]);
8521
8724
  const reply = JSON.parse(r.stdout);
8522
8725
  if (!reply.ready) {
8523
8726
  const lines = [];
@@ -8531,7 +8734,7 @@ async function prepareCloudAttach(box, opts) {
8531
8734
  log20.warn(`wait-ready failed (continuing): ${err instanceof Error ? err.message : String(err)}`);
8532
8735
  }
8533
8736
  }
8534
- const { alias } = await ensureCloudSshAlias(box, p, { bringOnline: false });
8737
+ const { alias } = await ensureCloudSshAlias(box, p2, { bringOnline: false });
8535
8738
  log20.info(`updated ~/.ssh/config alias ${alias}`);
8536
8739
  return `vscode-remote://ssh-remote+${alias}/workspace`;
8537
8740
  }
@@ -8854,9 +9057,9 @@ var listProjectsCommand = new Command12("list-projects").description("List direc
8854
9057
  process.stdout.write("(no per-project config recorded)\n");
8855
9058
  return;
8856
9059
  }
8857
- for (const p of projects) {
9060
+ for (const p2 of projects) {
8858
9061
  process.stdout.write(
8859
- `${p.hash} ${p.originalPath}${p.hasConfigFile ? "" : " (meta only \u2014 no config.yaml)"}
9062
+ `${p2.hash} ${p2.originalPath}${p2.hasConfigFile ? "" : " (meta only \u2014 no config.yaml)"}
8860
9063
  `
8861
9064
  );
8862
9065
  }
@@ -8931,9 +9134,9 @@ function parseBoxArg(arg) {
8931
9134
  const prefix = arg.slice(0, idx);
8932
9135
  if (prefix.includes("/")) return null;
8933
9136
  if (prefix.length === 0) return null;
8934
- const p = arg.slice(idx + 1);
8935
- if (p.length === 0) return null;
8936
- return { boxRef: prefix, path: p };
9137
+ const p2 = arg.slice(idx + 1);
9138
+ if (p2.length === 0) return null;
9139
+ return { boxRef: prefix, path: p2 };
8937
9140
  }
8938
9141
  function parseArgs(paths) {
8939
9142
  if (paths.length === 0) {
@@ -9116,7 +9319,13 @@ async function attachShell(record) {
9116
9319
  }
9117
9320
  var createCommand = new Command14("create").description(
9118
9321
  "Create and start a new agent box (Docker container with /workspace seeded via in-container git worktree)"
9119
- ).option("-w, --workspace <path>", "host workspace to mount", process.cwd()).option("-n, --name <name>", "friendly box name (default: <workspace-basename>-<id>)").option("--provider <name>", "sandbox backend: 'docker' (default) or 'daytona' (cloud)").option(
9322
+ ).option("-w, --workspace <path>", "host workspace to mount", process.cwd()).option("-n, --name <name>", "friendly box name (default: <workspace-basename>-<id>)").option(
9323
+ "--provider <name>",
9324
+ "sandbox backend: docker (default), daytona, hetzner, digitalocean, vercel, e2b, remote-docker. `docker:<host>` runs the box on that machine's docker engine over SSH."
9325
+ ).option(
9326
+ "--remote-host <dest>",
9327
+ "SSH destination whose docker engine runs the box \u2014 an ~/.ssh/config alias or [user@]host[:port]. Overrides box.remoteDockerHost. Same as `--provider docker:<dest>`. remote-docker-only."
9328
+ ).option(
9120
9329
  "--host-snapshot",
9121
9330
  "APFS-clone the host workspace into a per-box scratch dir before seeding /workspace (stabilizes the tar-pipe source)"
9122
9331
  ).option("--no-host-snapshot", "bind the live workspace directly (host edits leak into reads)").option(
@@ -9191,7 +9400,10 @@ var createCommand = new Command14("create").description(
9191
9400
  await registerProject(projectRoot);
9192
9401
  } catch {
9193
9402
  }
9194
- const providerName = opts.provider ?? cfg.effective.box.provider ?? "docker";
9403
+ const { name: providerName, remoteHost: specRemoteHost } = parseProviderSpec(
9404
+ opts.provider ?? cfg.effective.box.provider ?? "docker"
9405
+ );
9406
+ const remoteHost = opts.remoteHost ?? specRemoteHost;
9195
9407
  if (cfg.effective.git.pushMode === "direct" && providerName === "docker") {
9196
9408
  log22.error(
9197
9409
  "git.pushMode=direct / --dangerously-with-credentials is not applicable to docker boxes (they run on your host and bind-mount the host .git). Use a cloud provider (e.g. --provider hetzner|e2b|vercel|daytona)."
@@ -9212,6 +9424,9 @@ var createCommand = new Command14("create").description(
9212
9424
  if (opts.inbound && providerName !== "hetzner" && providerName !== "digitalocean") {
9213
9425
  log22.warn(`--inbound applies to hetzner/digitalocean only; ignored for provider ${providerName}`);
9214
9426
  }
9427
+ if (opts.remoteHost && providerName !== "remote-docker") {
9428
+ log22.warn(`--remote-host applies to remote-docker only; ignored for provider ${providerName}`);
9429
+ }
9215
9430
  const imageDefault = resolveBoxImage(
9216
9431
  cfg.effective,
9217
9432
  providerName
@@ -9368,7 +9583,8 @@ var createCommand = new Command14("create").description(
9368
9583
  ...cloudSizingProviderOptions(provider.name, cfg.effective, {
9369
9584
  size: opts.size,
9370
9585
  location: opts.location,
9371
- inbound: opts.inbound
9586
+ inbound: opts.inbound,
9587
+ remoteHost
9372
9588
  })
9373
9589
  }
9374
9590
  });
@@ -9421,7 +9637,7 @@ var createCommand = new Command14("create").description(
9421
9637
  const n = await bumpProjectGcCounter();
9422
9638
  if (n % m.pruneProjectConfigsEvery === 0) {
9423
9639
  const boxes = await listBoxes();
9424
- const protectedPaths = boxes.map((b) => b.projectRoot).filter((p) => typeof p === "string");
9640
+ const protectedPaths = boxes.map((b) => b.projectRoot).filter((p2) => typeof p2 === "string");
9425
9641
  const res = await pruneOrphanProjectConfigs({ protectedPaths });
9426
9642
  if (res.removed.length > 0) {
9427
9643
  log22.info(
@@ -9434,7 +9650,7 @@ var createCommand = new Command14("create").description(
9434
9650
  }
9435
9651
  outro7("done");
9436
9652
  if (attachClaudeAfter) {
9437
- const { cloudAgentAttach: cloudAgentAttach2 } = await import("./_cloud-attach-FGMI2ZHO.js");
9653
+ const { cloudAgentAttach: cloudAgentAttach2 } = await import("./_cloud-attach-7WRQH6XZ.js");
9438
9654
  await cloudAgentAttach2({
9439
9655
  box: result.record,
9440
9656
  binary: "claude",
@@ -12012,9 +12228,73 @@ var digitaloceanCommand = new Command21("digitalocean").description(
12012
12228
  "DigitalOcean Droplet provider \u2014 credentials, firewall, plus sugar for `--provider digitalocean` (e.g. `agentbox digitalocean create|claude|codex|opencode`)"
12013
12229
  ).addCommand(loginSub5, { isDefault: true }).addCommand(firewallSub2);
12014
12230
 
12231
+ // ../../packages/sandbox-remote-docker/dist/cli.js
12232
+ import { Command as Command22 } from "commander";
12233
+ import * as p from "@clack/prompts";
12234
+ var remoteDockerCommand = new Command22("remote-docker").description("Remote Docker provider \u2014 run boxes on your own machine over SSH").addCommand(
12235
+ new Command22("check").description("Verify an SSH destination can host boxes (ssh reachable + docker present)").argument("[host]", "SSH destination (default: box.remoteDockerHost)").action(async (host) => {
12236
+ const target = (host ?? await configuredHost()).trim();
12237
+ if (!target) {
12238
+ p.log.error(
12239
+ "no SSH destination \u2014 pass one (`agentbox remote-docker check user@host`) or set `box.remoteDockerHost`"
12240
+ );
12241
+ process.exitCode = 1;
12242
+ return;
12243
+ }
12244
+ const s = p.spinner();
12245
+ s.start(`probing ${target}`);
12246
+ const res = await probeRemoteEngine(target);
12247
+ if (!res.ok) {
12248
+ s.stop(`${target}: unusable`);
12249
+ p.log.error(res.error);
12250
+ process.exitCode = 1;
12251
+ return;
12252
+ }
12253
+ s.stop(`${target}: docker ${res.version} (${res.os}/${res.arch})`);
12254
+ const baked = readPreparedState5()?.hosts[target];
12255
+ p.log.info(
12256
+ baked ? `box image baked: ${baked.imageRef}` : `box image not baked yet \u2014 the first create will do it, or run \`agentbox prepare --provider docker:${target}\``
12257
+ );
12258
+ })
12259
+ ).addCommand(
12260
+ new Command22("use").description("Set the default SSH destination for `--provider remote-docker`").argument("<host>", "SSH destination (~/.ssh/config alias or [user@]host[:port])").option("-g, --global", "write to the global config instead of this project").action(async (host, opts) => {
12261
+ const res = await probeRemoteEngine(host);
12262
+ if (!res.ok) {
12263
+ p.log.error(res.error);
12264
+ process.exitCode = 1;
12265
+ return;
12266
+ }
12267
+ await setConfigValue(
12268
+ opts.global ? "global" : "project",
12269
+ "box.remoteDockerHost",
12270
+ host,
12271
+ process.cwd()
12272
+ );
12273
+ p.log.success(
12274
+ `box.remoteDockerHost = ${host} (${opts.global ? "global" : "project"}) \u2014 docker ${res.version}`
12275
+ );
12276
+ })
12277
+ ).addCommand(
12278
+ new Command22("hosts").description("List the remote engines this machine has baked a box image on").action(() => {
12279
+ const state = readPreparedState5();
12280
+ const hosts = Object.entries(state?.hosts ?? {});
12281
+ if (hosts.length === 0) {
12282
+ p.log.info("no remote engines prepared yet");
12283
+ return;
12284
+ }
12285
+ for (const [host, info] of hosts) {
12286
+ p.log.info(`${host} ${info.imageRef} (${info.cliVersion ?? "\u2014"}, ${info.createdAt})`);
12287
+ }
12288
+ })
12289
+ );
12290
+ async function configuredHost() {
12291
+ const cfg = await loadEffectiveConfig(process.cwd());
12292
+ return cfg.effective.box.remoteDockerHost || "";
12293
+ }
12294
+
12015
12295
  // src/commands/destroy.ts
12016
12296
  import { execa as execa7 } from "execa";
12017
- import { Command as Command22 } from "commander";
12297
+ import { Command as Command23 } from "commander";
12018
12298
  async function destroyOrphanContainer(ref) {
12019
12299
  const candidates = ref.startsWith("agentbox-") ? [ref] : [`agentbox-${ref}`, ref];
12020
12300
  for (const name of candidates) {
@@ -12037,7 +12317,7 @@ async function destroyOrphanContainer(ref) {
12037
12317
  }
12038
12318
  return null;
12039
12319
  }
12040
- var destroyCommand = new Command22("destroy").alias("rm").description("Destroy a box and discard its container writable layer (where /workspace lived)").argument(
12320
+ var destroyCommand = new Command23("destroy").alias("rm").description("Destroy a box and discard its container writable layer (where /workspace lived)").argument(
12041
12321
  "[box]",
12042
12322
  "box ref: project index, id, id prefix, name, or container (default: the only box in this project)"
12043
12323
  ).option("-y, --yes", "skip the confirmation prompt").option("--keep-snapshot", "don't delete the snapshot dir under ~/.agentbox/snapshots/").action(async (idOrName, opts) => {
@@ -12103,10 +12383,10 @@ var destroyCommand = new Command22("destroy").alias("rm").description("Destroy a
12103
12383
  });
12104
12384
 
12105
12385
  // src/commands/download.ts
12106
- import { Command as Command28 } from "commander";
12386
+ import { Command as Command29 } from "commander";
12107
12387
 
12108
12388
  // src/commands/download-claude.ts
12109
- import { Command as Command23 } from "commander";
12389
+ import { Command as Command24 } from "commander";
12110
12390
 
12111
12391
  // src/commands/_agent-pull.ts
12112
12392
  async function cloudTransportForPull(box) {
@@ -12243,7 +12523,7 @@ function tag(item) {
12243
12523
  const noun = item.category === "plugins" ? "plugin" : item.category.replace(/s$/, "");
12244
12524
  return ` ${item.category}/${item.name} (new ${noun})`;
12245
12525
  }
12246
- var downloadClaudeCommand = new Command23("claude").description(
12526
+ var downloadClaudeCommand = new Command24("claude").description(
12247
12527
  "Download box-installed Claude skills/plugins/agents/commands back to host ~/.claude (additive), optionally propagating them to other boxes"
12248
12528
  ).argument(
12249
12529
  "[box]",
@@ -12322,8 +12602,8 @@ var downloadClaudeCommand = new Command23("claude").description(
12322
12602
  });
12323
12603
 
12324
12604
  // src/commands/download-codex.ts
12325
- import { Command as Command24 } from "commander";
12326
- var downloadCodexCommand = new Command24("codex").description(
12605
+ import { Command as Command25 } from "commander";
12606
+ var downloadCodexCommand = new Command25("codex").description(
12327
12607
  "Download box-side Codex config/auth (config.toml, auth.json, prompts) back to host ~/.codex (additive), optionally propagating them to other boxes"
12328
12608
  ).argument(
12329
12609
  "[box]",
@@ -12395,8 +12675,8 @@ var downloadCodexCommand = new Command24("codex").description(
12395
12675
  });
12396
12676
 
12397
12677
  // src/commands/download-opencode.ts
12398
- import { Command as Command25 } from "commander";
12399
- var downloadOpencodeCommand = new Command25("opencode").description(
12678
+ import { Command as Command26 } from "commander";
12679
+ var downloadOpencodeCommand = new Command26("opencode").description(
12400
12680
  "Download box-side OpenCode config/auth (auth.json, opencode.json, agents, commands, themes) back to host ~/.config + ~/.local/share opencode (additive), optionally propagating them to other boxes"
12401
12681
  ).argument(
12402
12682
  "[box]",
@@ -12468,7 +12748,7 @@ var downloadOpencodeCommand = new Command25("opencode").description(
12468
12748
  });
12469
12749
 
12470
12750
  // src/commands/download-config.ts
12471
- import { Command as Command26 } from "commander";
12751
+ import { Command as Command27 } from "commander";
12472
12752
  function tagChange(line) {
12473
12753
  const sp = line.indexOf(" ");
12474
12754
  const code = sp === -1 ? line : line.slice(0, sp);
@@ -12477,7 +12757,7 @@ function tagChange(line) {
12477
12757
  return ` ${path} ${isNew ? "(new)" : "(overwrites host)"}`;
12478
12758
  }
12479
12759
  var CONFIG_PATTERNS = ["agentbox.yaml"];
12480
- var downloadConfigCommand = new Command26("config").description("Download agentbox.yaml box -> host").argument(
12760
+ var downloadConfigCommand = new Command27("config").description("Download agentbox.yaml box -> host").argument(
12481
12761
  "[box]",
12482
12762
  "box ref: project index, id, id prefix, name, or container (default: the only box in this project)"
12483
12763
  ).option("-y, --yes", "skip the confirmation prompt").option("--dry-run", "list matched files and exit; don't write").option("--no-refresh", "skip the box->scratch-dir rsync step").action(async (idOrName, opts) => {
@@ -12543,7 +12823,7 @@ var downloadConfigCommand = new Command26("config").description("Download agentb
12543
12823
  });
12544
12824
 
12545
12825
  // src/commands/download-env.ts
12546
- import { Command as Command27 } from "commander";
12826
+ import { Command as Command28 } from "commander";
12547
12827
  function tagChange2(line) {
12548
12828
  const sp = line.indexOf(" ");
12549
12829
  const code = sp === -1 ? line : line.slice(0, sp);
@@ -12551,7 +12831,7 @@ function tagChange2(line) {
12551
12831
  const isNew = /^>f\++$/.test(code);
12552
12832
  return ` ${path} ${isNew ? "(new)" : "(overwrites host)"}`;
12553
12833
  }
12554
- var downloadEnvCommand = new Command27("env").description(
12834
+ var downloadEnvCommand = new Command28("env").description(
12555
12835
  "Download gitignored env/config files (.env*, .envrc, secrets.toml, agentbox.yaml, ...) box -> host"
12556
12836
  ).argument(
12557
12837
  "[box]",
@@ -12627,7 +12907,7 @@ var downloadEnvCommand = new Command27("env").description(
12627
12907
  });
12628
12908
 
12629
12909
  // src/commands/download.ts
12630
- var downloadCommand = new Command28("download").enablePositionalOptions().description("Download a box's /workspace back into your host workspace dir (gitignore-aware)").argument(
12910
+ var downloadCommand = new Command29("download").enablePositionalOptions().description("Download a box's /workspace back into your host workspace dir (gitignore-aware)").argument(
12631
12911
  "[box]",
12632
12912
  "box ref: project index, id, id prefix, name, or container (default: the only box in this project)"
12633
12913
  ).option("-y, --yes", "skip the confirmation prompt").option("--dry-run", "print the change list and exit; don't write").option(
@@ -12756,8 +13036,8 @@ downloadCommand.addCommand(downloadOpencodeCommand);
12756
13036
  downloadCommand.addCommand(downloadConfigCommand);
12757
13037
 
12758
13038
  // src/commands/drive.ts
12759
- import { log as log38 } from "@clack/prompts";
12760
- import { Command as Command29 } from "commander";
13039
+ import { log as log39 } from "@clack/prompts";
13040
+ import { Command as Command30 } from "commander";
12761
13041
 
12762
13042
  // src/lib/drive/keys.ts
12763
13043
  var NAMED = {
@@ -12836,11 +13116,11 @@ function resolveToken(raw) {
12836
13116
  // src/commands/drive.ts
12837
13117
  var PROMPT_ENTER_DELAY_MS = 200;
12838
13118
  var POLL_INTERVAL_MS2 = 250;
12839
- var driveCommand = new Command29("drive").description(
13119
+ var driveCommand = new Command30("drive").description(
12840
13120
  "Drive a running tmux session inside a box: snapshot the screen, send keystrokes, type text, or wait for output. Targets the agent session by default (claude \u2192 codex \u2192 opencode)."
12841
13121
  );
12842
13122
  var sessionOption = ["--session <name>", "tmux session to target (default: first running agent session)"];
12843
- var driveSnapshotCommand = new Command29("snapshot").description("Print the rendered terminal contents of the box's active tmux session.").argument(
13123
+ var driveSnapshotCommand = new Command30("snapshot").description("Print the rendered terminal contents of the box's active tmux session.").argument(
12844
13124
  "[box]",
12845
13125
  "box ref: project index, id, id prefix, name, or container (default: the only box in this project)"
12846
13126
  ).option(sessionOption[0], sessionOption[1]).option("--ansi", "preserve ANSI color/style escape sequences (default: plain text)").option("--with-cursor", "include cursor coordinates and pane size (implies --json)").option("--rows <range>", 'inclusive row range "FROM:TO" (negative numbers walk into scrollback)').option("--json", "emit a JSON envelope { session, cols, rows, cursor?, screen }").action(async (boxRef, opts) => {
@@ -12869,7 +13149,7 @@ var driveSnapshotCommand = new Command29("snapshot").description("Print the rend
12869
13149
  handleDriveError(err);
12870
13150
  }
12871
13151
  });
12872
- var driveKeypressCommand = new Command29("keypress").description('Send keystrokes parsed via the DSL (e.g. "<C-a>q", "ls<Enter>"). Each arg is concatenated with no spaces.').argument(
13152
+ var driveKeypressCommand = new Command30("keypress").description('Send keystrokes parsed via the DSL (e.g. "<C-a>q", "ls<Enter>"). Each arg is concatenated with no spaces.').argument(
12873
13153
  "<box>",
12874
13154
  "box ref: project index, id, id prefix, name, or container"
12875
13155
  ).argument("<keys...>", "one or more DSL tokens / literal text; `<<` escapes a literal `<`").option(sessionOption[0], sessionOption[1]).action(async (boxRef, keys, opts) => {
@@ -12883,7 +13163,7 @@ var driveKeypressCommand = new Command29("keypress").description('Send keystroke
12883
13163
  handleDriveError(err);
12884
13164
  }
12885
13165
  });
12886
- var driveSendTextCommand = new Command29("send-text").description("Type literal text into the session (no DSL parsing, no trailing Enter).").argument("<box>", "box ref").argument("<text>", "literal text to type").option(sessionOption[0], sessionOption[1]).action(async (boxRef, text4, opts) => {
13166
+ var driveSendTextCommand = new Command30("send-text").description("Type literal text into the session (no DSL parsing, no trailing Enter).").argument("<box>", "box ref").argument("<text>", "literal text to type").option(sessionOption[0], sessionOption[1]).action(async (boxRef, text4, opts) => {
12887
13167
  try {
12888
13168
  const box = await resolveBoxOrExit(boxRef);
12889
13169
  const provider = await providerForBox(box);
@@ -12893,7 +13173,7 @@ var driveSendTextCommand = new Command29("send-text").description("Type literal
12893
13173
  handleDriveError(err);
12894
13174
  }
12895
13175
  });
12896
- var drivePromptCommand = new Command29("prompt").description('Type text into the agent session and press Enter \u2014 convenience for "send a message to the running agent".').argument("<box>", "box ref").argument("<text>", "prompt text to send (literal; no DSL parsing)").option(sessionOption[0], sessionOption[1]).option("--delay <ms>", `milliseconds to wait between text and Enter (default: ${String(PROMPT_ENTER_DELAY_MS)})`).action(async (boxRef, text4, opts) => {
13176
+ var drivePromptCommand = new Command30("prompt").description('Type text into the agent session and press Enter \u2014 convenience for "send a message to the running agent".').argument("<box>", "box ref").argument("<text>", "prompt text to send (literal; no DSL parsing)").option(sessionOption[0], sessionOption[1]).option("--delay <ms>", `milliseconds to wait between text and Enter (default: ${String(PROMPT_ENTER_DELAY_MS)})`).action(async (boxRef, text4, opts) => {
12897
13177
  try {
12898
13178
  const box = await resolveBoxOrExit(boxRef);
12899
13179
  const provider = await providerForBox(box);
@@ -12906,7 +13186,7 @@ var drivePromptCommand = new Command29("prompt").description('Type text into the
12906
13186
  handleDriveError(err);
12907
13187
  }
12908
13188
  });
12909
- var driveWaitCommand = new Command29("wait").description("Block until --text appears in the session's rendered screen, or exit non-zero on timeout.").argument("<box>", "box ref").requiredOption("--text <str>", "substring to wait for").option("--timeout <ms>", "wall-clock cap in milliseconds (default: 5000)").option(sessionOption[0], sessionOption[1]).option("--json", "emit a JSON envelope { matched, elapsedMs, session, screen? }").action(async (boxRef, opts) => {
13189
+ var driveWaitCommand = new Command30("wait").description("Block until --text appears in the session's rendered screen, or exit non-zero on timeout.").argument("<box>", "box ref").requiredOption("--text <str>", "substring to wait for").option("--timeout <ms>", "wall-clock cap in milliseconds (default: 5000)").option(sessionOption[0], sessionOption[1]).option("--json", "emit a JSON envelope { matched, elapsedMs, session, screen? }").action(async (boxRef, opts) => {
12910
13190
  try {
12911
13191
  const box = await resolveBoxOrExit(boxRef);
12912
13192
  const provider = await providerForBox(box);
@@ -12939,14 +13219,14 @@ var driveWaitCommand = new Command29("wait").description("Block until --text app
12939
13219
  }) + "\n"
12940
13220
  );
12941
13221
  } else {
12942
- log38.error(`text not found within ${String(timeoutMs)}ms: ${opts.text}`);
13222
+ log39.error(`text not found within ${String(timeoutMs)}ms: ${opts.text}`);
12943
13223
  }
12944
13224
  process.exit(1);
12945
13225
  } catch (err) {
12946
13226
  handleDriveError(err);
12947
13227
  }
12948
13228
  });
12949
- var driveResizeCommand = new Command29("resize").description("Resize the tmux window to <cols> x <rows>.").argument("<box>", "box ref").argument("<cols>", "columns (positive int)").argument("<rows>", "rows (positive int)").option(sessionOption[0], sessionOption[1]).action(async (boxRef, colsStr, rowsStr, opts) => {
13229
+ var driveResizeCommand = new Command30("resize").description("Resize the tmux window to <cols> x <rows>.").argument("<box>", "box ref").argument("<cols>", "columns (positive int)").argument("<rows>", "rows (positive int)").option(sessionOption[0], sessionOption[1]).action(async (boxRef, colsStr, rowsStr, opts) => {
12950
13230
  try {
12951
13231
  const box = await resolveBoxOrExit(boxRef);
12952
13232
  const provider = await providerForBox(box);
@@ -12966,8 +13246,8 @@ driveCommand.addCommand(driveWaitCommand);
12966
13246
  driveCommand.addCommand(driveResizeCommand);
12967
13247
  function handleDriveError(err) {
12968
13248
  if (err instanceof SessionNotFoundError) {
12969
- log38.error(err.message);
12970
- log38.info("start an agent first (e.g. `agentbox claude <box>`) or pass --session.");
13249
+ log39.error(err.message);
13250
+ log39.info("start an agent first (e.g. `agentbox claude <box>`) or pass --session.");
12971
13251
  process.exit(2);
12972
13252
  }
12973
13253
  handleLifecycleError(err);
@@ -12991,8 +13271,8 @@ function sleep4(ms) {
12991
13271
  }
12992
13272
 
12993
13273
  // src/commands/fork.ts
12994
- import { log as log39 } from "@clack/prompts";
12995
- import { Command as Command30 } from "commander";
13274
+ import { log as log40 } from "@clack/prompts";
13275
+ import { Command as Command31 } from "commander";
12996
13276
  import { existsSync as existsSync10, readdirSync as readdirSync3, statSync as statSync2 } from "fs";
12997
13277
  import { homedir as homedir16 } from "os";
12998
13278
  import { join as join21 } from "path";
@@ -13064,7 +13344,7 @@ function resolveAttachArgs(attachIn) {
13064
13344
  if (attachIn === "same") return ["--attach-in", "same"];
13065
13345
  return detectHostTerminal() === "unknown" ? ["--no-attach"] : ["--attach-in", attachIn];
13066
13346
  }
13067
- var forkCommand = new Command30("fork").description(
13347
+ var forkCommand = new Command31("fork").description(
13068
13348
  "Fork the current host agent session into a new box and resume it there. Autodetects the agent (Claude / Codex) and the current session from the launching agent's env, so a bare `agentbox fork` forks whatever you ran it from. Opens the box in a new terminal tab under iTerm/tmux; otherwise starts it in the background."
13069
13349
  ).argument(
13070
13350
  "[provider]",
@@ -13090,36 +13370,36 @@ var forkCommand = new Command30("fork").description(
13090
13370
  'copy a Claude Code plan file (e.g. ~/.claude/plans/<slug>.md) into the box, start claude in plan mode, and seed a "resume the plan" prompt. Claude only.'
13091
13371
  ).action(async (providerArg, opts) => {
13092
13372
  if ((process.env.AGENTBOX_RELAY_URL ?? "").trim().length > 0) {
13093
- log39.error(
13373
+ log40.error(
13094
13374
  "agentbox fork runs on the host only: it teleports a host agent session into a new box. You appear to be inside a box (AGENTBOX_RELAY_URL is set) \u2014 box\u2192box fork is not supported yet."
13095
13375
  );
13096
13376
  process.exit(2);
13097
13377
  }
13098
13378
  const agent = opts.agent?.trim() || detectAgentFromEnv() || "claude";
13099
13379
  if (!FORK_AGENTS.includes(agent)) {
13100
- log39.error(`--agent: expected one of ${FORK_AGENTS.join(", ")}, got "${opts.agent ?? ""}"`);
13380
+ log40.error(`--agent: expected one of ${FORK_AGENTS.join(", ")}, got "${opts.agent ?? ""}"`);
13101
13381
  process.exit(2);
13102
13382
  }
13103
13383
  const attachIn = opts.attachIn ?? "tab";
13104
13384
  if (!FORK_ATTACH_VALUES.includes(attachIn)) {
13105
- log39.error(`--attach-in: expected one of ${FORK_ATTACH_VALUES.join(", ")}, got "${attachIn}"`);
13385
+ log40.error(`--attach-in: expected one of ${FORK_ATTACH_VALUES.join(", ")}, got "${attachIn}"`);
13106
13386
  process.exit(2);
13107
13387
  }
13108
13388
  const plan = opts.plan?.trim();
13109
13389
  if (plan && agent !== "claude") {
13110
- log39.error("--plan is only supported with --agent claude (plan mode is Claude-specific).");
13390
+ log40.error("--plan is only supported with --agent claude (plan mode is Claude-specific).");
13111
13391
  process.exit(2);
13112
13392
  }
13113
13393
  const carryMode = opts.carry ?? "send";
13114
13394
  if (carryMode !== "send" && carryMode !== "skip") {
13115
- log39.error(`--carry: expected 'send' or 'skip', got "${opts.carry ?? ""}"`);
13395
+ log40.error(`--carry: expected 'send' or 'skip', got "${opts.carry ?? ""}"`);
13116
13396
  process.exit(2);
13117
13397
  }
13118
13398
  let provider;
13119
13399
  try {
13120
13400
  provider = resolveForkProvider(providerArg, opts.provider);
13121
13401
  } catch (err) {
13122
- log39.error(err instanceof Error ? err.message : String(err));
13402
+ log40.error(err instanceof Error ? err.message : String(err));
13123
13403
  process.exit(2);
13124
13404
  }
13125
13405
  if (!opts.session?.trim()) {
@@ -13143,7 +13423,7 @@ var forkCommand = new Command30("fork").description(
13143
13423
  try {
13144
13424
  sessionArgs = resolveSessionArgs(agent, opts);
13145
13425
  } catch (err) {
13146
- log39.error(err instanceof Error ? err.message : String(err));
13426
+ log40.error(err instanceof Error ? err.message : String(err));
13147
13427
  process.exit(2);
13148
13428
  }
13149
13429
  const subArgv = [
@@ -13165,7 +13445,7 @@ var forkCommand = new Command30("fork").description(
13165
13445
  });
13166
13446
 
13167
13447
  // src/commands/install.ts
13168
- import { Command as Command34 } from "commander";
13448
+ import { Command as Command35 } from "commander";
13169
13449
  import { execa as execa9 } from "execa";
13170
13450
  import {
13171
13451
  existsSync as existsSync18,
@@ -13290,8 +13570,8 @@ async function checkSsh() {
13290
13570
  async function onPath(bin) {
13291
13571
  const r = await execa8("which", [bin], { reject: false });
13292
13572
  if (r.exitCode !== 0) return null;
13293
- const p = (r.stdout ?? "").trim();
13294
- return p.length > 0 ? p : null;
13573
+ const p2 = (r.stdout ?? "").trim();
13574
+ return p2.length > 0 ? p2 : null;
13295
13575
  }
13296
13576
  async function checkSshfs() {
13297
13577
  const path = await onPath("sshfs");
@@ -13309,11 +13589,32 @@ function checkMacfuse() {
13309
13589
  };
13310
13590
  }
13311
13591
  async function runSystemChecks() {
13312
- const [git2, ssh, sshfs] = await Promise.all([checkGit(), checkSsh(), checkSshfs()]);
13592
+ const [git2, ssh, sshfs, config] = await Promise.all([
13593
+ checkGit(),
13594
+ checkSsh(),
13595
+ checkSshfs(),
13596
+ checkConfig()
13597
+ ]);
13313
13598
  const results = [checkNode(), checkPlatform(), checkAgentboxHome(), git2, ssh, sshfs];
13314
13599
  if (process.platform === "darwin") results.push(checkMacfuse());
13600
+ results.push(...config);
13315
13601
  return results;
13316
13602
  }
13603
+ async function checkConfig() {
13604
+ let loaded;
13605
+ try {
13606
+ loaded = await loadEffectiveConfig(process.cwd());
13607
+ } catch (err) {
13608
+ return [{ label: "config", status: "warn", detail: errSummary(err) }];
13609
+ }
13610
+ if (loaded.warnings.length === 0) return [];
13611
+ return loaded.warnings.map((detail) => ({
13612
+ label: "config",
13613
+ status: "warn",
13614
+ detail,
13615
+ hint: "fix the key, or ignore this if it was set by a newer agentbox"
13616
+ }));
13617
+ }
13317
13618
  var INTEGRATION_PROBE_TIMEOUT_MS = 1e4;
13318
13619
  async function probeIntegrationBin(bin, args) {
13319
13620
  try {
@@ -13436,8 +13737,7 @@ async function baseFreshnessRow(name) {
13436
13737
  async function runProviderChecks(name) {
13437
13738
  try {
13438
13739
  const mod = await loadProviderModule(name);
13439
- const results = await mod.doctorChecks();
13440
- const fresh = await baseFreshnessRow(name);
13740
+ const [results, fresh] = await Promise.all([mod.doctorChecks(), baseFreshnessRow(name)]);
13441
13741
  return { title: name, results: fresh ? [...results, fresh] : results };
13442
13742
  } catch (err) {
13443
13743
  return {
@@ -13447,12 +13747,16 @@ async function runProviderChecks(name) {
13447
13747
  }
13448
13748
  }
13449
13749
  async function runAllChecks() {
13450
- const sys = { title: "system", results: await runSystemChecks() };
13451
- const providerGroups = await Promise.all(
13452
- getRuntimeProviderNames().map((n) => runProviderChecks(n))
13453
- );
13454
- const integrations = { title: "integrations", results: await integrationsChecks() };
13455
- return [sys, ...providerGroups, integrations];
13750
+ const [sysResults, providerGroups, integrationResults] = await Promise.all([
13751
+ runSystemChecks(),
13752
+ Promise.all(getRuntimeProviderNames().map((n) => runProviderChecks(n))),
13753
+ integrationsChecks()
13754
+ ]);
13755
+ return [
13756
+ { title: "system", results: sysResults },
13757
+ ...providerGroups,
13758
+ { title: "integrations", results: integrationResults }
13759
+ ];
13456
13760
  }
13457
13761
  function worstInResults(results) {
13458
13762
  let worst = "ok";
@@ -13642,8 +13946,8 @@ async function maybePromptStar(opts) {
13642
13946
  }
13643
13947
 
13644
13948
  // src/commands/install-cmux.ts
13645
- import { intro as intro9, log as log41, note as note3, outro as outro8 } from "@clack/prompts";
13646
- import { Command as Command31 } from "commander";
13949
+ import { intro as intro9, log as log42, note as note3, outro as outro8 } from "@clack/prompts";
13950
+ import { Command as Command32 } from "commander";
13647
13951
  import { existsSync as existsSync15, mkdirSync as mkdirSync9, readFileSync as readFileSync7, renameSync as renameSync3, writeFileSync as writeFileSync9 } from "fs";
13648
13952
  import { homedir as homedir20 } from "os";
13649
13953
  import { dirname as dirname5, join as join26 } from "path";
@@ -13670,7 +13974,7 @@ function parseHeight(raw) {
13670
13974
  if (!Number.isFinite(n) || n <= 0) return 320;
13671
13975
  return Math.round(n);
13672
13976
  }
13673
- var installCmuxCommand = new Command31("cmux").description(
13977
+ var installCmuxCommand = new Command32("cmux").description(
13674
13978
  "Add an AgentBox panel to the cmux sidebar dock (~/.config/cmux/dock.json) showing the live list of all your boxes."
13675
13979
  ).option("--height <points>", "panel height in points", "320").option("--title <text>", "panel title shown in the dock header", "AgentBox").option("--dry-run", "print the resulting dock.json without writing it").option("--force", "reset a dock.json that fails to parse (backed up to dock.json.bak)").action((opts) => {
13676
13980
  const dockPath = cmuxDockPath();
@@ -13688,7 +13992,7 @@ var installCmuxCommand = new Command31("cmux").description(
13688
13992
  if (parsed && typeof parsed === "object") doc = parsed;
13689
13993
  } catch {
13690
13994
  if (!opts.force) {
13691
- log41.error(
13995
+ log42.error(
13692
13996
  `existing dock config is not valid JSON: ${dockPath}
13693
13997
  fix it by hand, or pass --force to back it up and write a fresh one`
13694
13998
  );
@@ -13696,7 +14000,7 @@ fix it by hand, or pass --force to back it up and write a fresh one`
13696
14000
  }
13697
14001
  if (!opts.dryRun) {
13698
14002
  renameSync3(dockPath, dockPath + ".bak");
13699
- log41.warn(`backed up unparseable dock config to ${dockPath}.bak`);
14003
+ log42.warn(`backed up unparseable dock config to ${dockPath}.bak`);
13700
14004
  }
13701
14005
  doc = { controls: [] };
13702
14006
  }
@@ -13725,8 +14029,8 @@ To see it:
13725
14029
  });
13726
14030
 
13727
14031
  // src/commands/install-herdr.ts
13728
- import { intro as intro10, log as log42, note as note4, outro as outro9 } from "@clack/prompts";
13729
- import { Command as Command32, Option } from "commander";
14032
+ import { intro as intro10, log as log43, note as note4, outro as outro9 } from "@clack/prompts";
14033
+ import { Command as Command33, Option } from "commander";
13730
14034
  import { spawnSync as spawnSync4 } from "child_process";
13731
14035
  import { chmodSync, existsSync as existsSync16, mkdirSync as mkdirSync10, readFileSync as readFileSync8, writeFileSync as writeFileSync10 } from "fs";
13732
14036
  import { homedir as homedir21 } from "os";
@@ -13857,9 +14161,9 @@ function escapeRe(s) {
13857
14161
  return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
13858
14162
  }
13859
14163
  function writeShim(dir) {
13860
- const p = join27(dir, "agentbox-shim.sh");
13861
- writeFileSync10(p, herdrShimContent(process.execPath, process.argv[1] ?? "agentbox"));
13862
- chmodSync(p, 493);
14164
+ const p2 = join27(dir, "agentbox-shim.sh");
14165
+ writeFileSync10(p2, herdrShimContent(process.execPath, process.argv[1] ?? "agentbox"));
14166
+ chmodSync(p2, 493);
13863
14167
  }
13864
14168
  function applyKeybindings() {
13865
14169
  const cfg = herdrConfigPath();
@@ -13869,7 +14173,7 @@ function applyKeybindings() {
13869
14173
  spawnSync4(herdrBinary(), ["server", "reload-config"], { stdio: "ignore" });
13870
14174
  return cfg;
13871
14175
  }
13872
- var installHerdrCommand = new Command32("herdr").description(
14176
+ var installHerdrCommand = new Command33("herdr").description(
13873
14177
  "Install a Herdr plugin: a boxes-list overlay, keyboard shortcuts, and Ctrl+click to open a box web app."
13874
14178
  ).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) => {
13875
14179
  if (opts.pluginKeys) {
@@ -13920,7 +14224,7 @@ ${herdrKeybindingsBlock()}
13920
14224
  if (linked.status === 0) {
13921
14225
  spawnSync4(bin, ["server", "reload-config"], { stdio: "ignore" });
13922
14226
  } else {
13923
- log42.warn(
14227
+ log43.warn(
13924
14228
  `could not run \`${bin} plugin link\` (is Herdr installed / running?).
13925
14229
  Run it yourself: herdr plugin link ${dir} && herdr server reload-config`
13926
14230
  );
@@ -13936,7 +14240,7 @@ Added shortcuts to ${cfg}
13936
14240
  });
13937
14241
 
13938
14242
  // src/commands/install-codex.ts
13939
- import { Command as Command33 } from "commander";
14243
+ import { Command as Command34 } from "commander";
13940
14244
  import { spawnSync as spawnSync5 } from "child_process";
13941
14245
  import {
13942
14246
  existsSync as existsSync17,
@@ -14031,7 +14335,7 @@ function codexPluginInstalled(bin) {
14031
14335
  const r = spawnSync5(bin, ["plugin", "list", "--json"], { encoding: "utf8" });
14032
14336
  if (r.status !== 0 || !r.stdout) return false;
14033
14337
  const parsed = JSON.parse(r.stdout);
14034
- return (parsed.installed ?? []).some((p) => p.pluginId === PLUGIN_ID);
14338
+ return (parsed.installed ?? []).some((p2) => p2.pluginId === PLUGIN_ID);
14035
14339
  } catch {
14036
14340
  return false;
14037
14341
  }
@@ -14156,7 +14460,7 @@ ${codexPluginEnableTable()}
14156
14460
  }
14157
14461
  return result;
14158
14462
  }
14159
- var installCodexCommand = new Command33("codex").description(
14463
+ var installCodexCommand = new Command34("codex").description(
14160
14464
  "Install + enable the AgentBox Codex plugin (marketplace add, plugin add, and enable it by default in ~/.codex/config.toml)."
14161
14465
  ).option("--dry-run", "print the commands and config block without changing anything").option("--force", "re-install and re-enable even if the plugin was disabled").option("--no-dev", "use the published GitHub marketplace even inside a source checkout").action(async (opts) => {
14162
14466
  (0, prompt_exports.intro)("AgentBox Codex plugin");
@@ -14224,8 +14528,8 @@ function paintLine(line, center) {
14224
14528
  }
14225
14529
  return out + "\x1B[0m";
14226
14530
  }
14227
- async function animateBanner() {
14228
- if (process.env.NO_COLOR || process.env.CI || process.env.AGENTBOX_NO_ANIM || !process.stdout.isTTY) {
14531
+ async function animateBanner(animate) {
14532
+ if (!animate || process.env.NO_COLOR || process.env.CI || process.env.AGENTBOX_NO_ANIM || !process.stdout.isTTY) {
14229
14533
  process.stdout.write(BANNER);
14230
14534
  return;
14231
14535
  }
@@ -14300,6 +14604,13 @@ function writableReason(target, force) {
14300
14604
  }
14301
14605
  return force ? "forced" : "skip";
14302
14606
  }
14607
+ function sameContent(src, dest) {
14608
+ try {
14609
+ return readFileSync10(dest, "utf8") === readFileSync10(src, "utf8");
14610
+ } catch {
14611
+ return false;
14612
+ }
14613
+ }
14303
14614
  function installHostSkills(opts = {}) {
14304
14615
  const force = opts.force === true;
14305
14616
  const dryRun = opts.dryRun === true;
@@ -14369,6 +14680,10 @@ async function installForkSkill(opts = {}) {
14369
14680
  symlinkSync3(src, dest);
14370
14681
  return { written: [dest], skipped: 0, blocked: [], method: "symlink" };
14371
14682
  }
14683
+ if (!force && sameContent(src, dest)) {
14684
+ if (!quiet) prompt_exports.log.info(`host /agentbox skill already up to date (${dest})`);
14685
+ return { written: [], skipped: 1, blocked: [], method: "skip" };
14686
+ }
14372
14687
  try {
14373
14688
  await execa9(
14374
14689
  "npx",
@@ -14420,8 +14735,33 @@ async function runProviderLogin(name) {
14420
14735
  await mod.ensureCredentials();
14421
14736
  return true;
14422
14737
  }
14423
- function tutorialBody(provider) {
14424
- const startCmd = provider === "docker" ? "agentbox claude " : `agentbox ${provider} claude`;
14738
+ async function maybeSetDefaultProvider(name, autoYes) {
14739
+ const cfg = await loadEffectiveConfig(process.cwd());
14740
+ if (cfg.effective.box.provider === name) return true;
14741
+ const label = providerMeta(name).label;
14742
+ const wantDefault = autoYes ? true : await confirm({
14743
+ message: `Make ${label} the default for new boxes? (plain \`agentbox claude\` will use it)`,
14744
+ initialValue: true
14745
+ });
14746
+ if (!wantDefault) {
14747
+ prompt_exports.log.info(
14748
+ `left the default as ${cfg.effective.box.provider} \u2014 start a ${name} box with \`agentbox ${name} claude\`, or set it later with \`agentbox config set box.provider ${name} --global\``
14749
+ );
14750
+ return false;
14751
+ }
14752
+ try {
14753
+ const r = await setConfigValue("global", "box.provider", name, process.cwd(), { raw: true });
14754
+ prompt_exports.log.info(`box.provider = ${name} (wrote ${r.path})`);
14755
+ return true;
14756
+ } catch (err) {
14757
+ prompt_exports.log.warn(
14758
+ `could not write box.provider: ${err instanceof Error ? err.message : String(err)} \u2014 set it with \`agentbox config set box.provider ${name} --global\``
14759
+ );
14760
+ return false;
14761
+ }
14762
+ }
14763
+ function tutorialBody(provider, isDefault) {
14764
+ const startCmd = isDefault ? "agentbox claude " : `agentbox ${provider} claude`;
14425
14765
  return `Get started:
14426
14766
  ${startCmd} # for claude, codex, opencode
14427
14767
  -> Setup wizard? -> Yes # install dependencies and setup agentbox.yaml
@@ -14435,9 +14775,10 @@ function isProviderName(s) {
14435
14775
  }
14436
14776
  async function runInstallWizard(opts = {}) {
14437
14777
  if (!ensureTty()) return false;
14438
- await animateBanner();
14778
+ const sysPromise = runSystemChecks();
14779
+ await animateBanner(isFirstRun());
14439
14780
  (0, prompt_exports.intro)("Check system compatibility");
14440
- const sysResults = await runSystemChecks();
14781
+ const sysResults = await sysPromise;
14441
14782
  const sysGroup = { title: "system", results: sysResults };
14442
14783
  process.stdout.write(" " + formatCompact([sysGroup]) + "\n");
14443
14784
  const hardFail = sysResults.find((r) => r.status === "fail");
@@ -14462,10 +14803,10 @@ async function runInstallWizard(opts = {}) {
14462
14803
  const picked = await select({
14463
14804
  message: "Which provider do you want to set up?",
14464
14805
  initialValue: "docker",
14465
- options: KNOWN_PROVIDERS.map((p) => ({
14466
- value: p,
14467
- label: providerMeta(p).label,
14468
- hint: providerMeta(p).loginHint
14806
+ options: KNOWN_PROVIDERS.map((p2) => ({
14807
+ value: p2,
14808
+ label: providerMeta(p2).label,
14809
+ hint: providerMeta(p2).loginHint
14469
14810
  }))
14470
14811
  });
14471
14812
  providerName = picked;
@@ -14496,6 +14837,7 @@ async function runInstallWizard(opts = {}) {
14496
14837
  `skipped \u2014 the ${providerName} base will build lazily on first \`agentbox ${providerName === "docker" ? "" : providerName + " "}create\``
14497
14838
  );
14498
14839
  }
14840
+ const isDefaultProvider = await maybeSetDefaultProvider(providerName, opts.yes ?? false);
14499
14841
  const sp = (0, prompt_exports.spinner)();
14500
14842
  sp.start("installing host /agentbox skill\u2026");
14501
14843
  try {
@@ -14567,22 +14909,22 @@ pass \`agentbox install --skills-only --force\` to overwrite`
14567
14909
  }
14568
14910
  }
14569
14911
  }
14570
- (0, prompt_exports.note)(tutorialBody(providerName), "Next steps");
14912
+ (0, prompt_exports.note)(tutorialBody(providerName, isDefaultProvider), "Next steps");
14571
14913
  (0, prompt_exports.outro)(
14572
14914
  opts.fromAutoTrigger ? "\u2728 Setup complete \u2014 continuing with your command\u2026" : "\u2728 Setup complete"
14573
14915
  );
14574
14916
  await maybePromptStar({ trigger: "install" });
14575
14917
  return true;
14576
14918
  }
14577
- var installCommand = new Command34("install").description(
14919
+ var installCommand = new Command35("install").description(
14578
14920
  "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."
14579
14921
  ).option(
14580
14922
  "--skills-only",
14581
14923
  "only install the host /agentbox skill files (no wizard, no login, no prepare)"
14582
14924
  ).option("--force", "overwrite existing skill files even if not AgentBox-managed").option("--dry-run", "print what would be written without changing anything").option(
14583
14925
  "-p, --provider <name>",
14584
- "pre-select the provider to set up (docker | daytona | hetzner | vercel)"
14585
- ).option("-y, --yes", "auto-confirm the prepare step").action(async (opts, cmd) => {
14926
+ `pre-select the provider to set up (${PROVIDER_NAMES.join(" | ")})`
14927
+ ).option("-y, --yes", "auto-confirm the prepare step and the default-provider prompt").action(async (opts, cmd) => {
14586
14928
  const stray = cmd.args[0];
14587
14929
  if (stray !== void 0) {
14588
14930
  const targets = cmd.commands.map((c) => c.name()).join(", ");
@@ -14635,10 +14977,9 @@ installCommand.addCommand(installAppCommand);
14635
14977
  // src/commands/plugin.ts
14636
14978
  import { execFileSync } from "child_process";
14637
14979
  import { existsSync as existsSync19, readFileSync as readFileSync11, statSync as statSync3 } from "fs";
14638
- import { createRequire } from "module";
14639
14980
  import { dirname as dirname9, isAbsolute as isAbsolute3, resolve as resolve6 } from "path";
14640
14981
  import { pathToFileURL } from "url";
14641
- import { Command as Command35 } from "commander";
14982
+ import { Command as Command36 } from "commander";
14642
14983
  function resolutionPaths() {
14643
14984
  const paths = /* @__PURE__ */ new Set();
14644
14985
  paths.add(process.cwd());
@@ -14647,7 +14988,7 @@ function resolutionPaths() {
14647
14988
  if (g) paths.add(g);
14648
14989
  } catch {
14649
14990
  }
14650
- for (const p of (process.env.NODE_PATH ?? "").split(":")) if (p) paths.add(p);
14991
+ for (const p2 of (process.env.NODE_PATH ?? "").split(":")) if (p2) paths.add(p2);
14651
14992
  return [...paths];
14652
14993
  }
14653
14994
  function resolvePackage(arg) {
@@ -14655,16 +14996,18 @@ function resolvePackage(arg) {
14655
14996
  if ((arg.startsWith(".") || arg.startsWith("/") || isAbsolute3(arg)) && existsSync19(arg)) {
14656
14997
  pkgDir = statSync3(arg).isDirectory() ? resolve6(arg) : dirname9(resolve6(arg));
14657
14998
  } else {
14658
- const req = createRequire(pathToFileURL(resolve6(process.cwd(), "noop.js")).href);
14659
14999
  let pkgJsonPath;
14660
15000
  for (const base of resolutionPaths()) {
14661
- try {
14662
- pkgJsonPath = req.resolve(`${arg}/package.json`, {
14663
- paths: [base, resolve6(base, "node_modules")]
14664
- });
14665
- break;
14666
- } catch {
15001
+ for (const candidate of [
15002
+ resolve6(base, arg, "package.json"),
15003
+ resolve6(base, "node_modules", arg, "package.json")
15004
+ ]) {
15005
+ if (existsSync19(candidate)) {
15006
+ pkgJsonPath = candidate;
15007
+ break;
15008
+ }
14667
15009
  }
15010
+ if (pkgJsonPath) break;
14668
15011
  }
14669
15012
  if (!pkgJsonPath) {
14670
15013
  throw new Error(
@@ -14724,7 +15067,7 @@ async function loadAndValidate(pkg) {
14724
15067
  }
14725
15068
  return { providers, apiVersion };
14726
15069
  }
14727
- var pluginCommand = new Command35("plugin").description(
15070
+ var pluginCommand = new Command36("plugin").description(
14728
15071
  "Manage externally-installed provider packages (community providers)"
14729
15072
  );
14730
15073
  pluginCommand.command("add").argument("<package>", "installed package name or a path to its directory").option("-y, --yes", "skip the trust confirmation prompt").description("register an installed provider package so `--provider <name>` can use it").action(async (packageArg, opts) => {
@@ -14739,19 +15082,19 @@ pluginCommand.command("add").argument("<package>", "installed package name or a
14739
15082
  return;
14740
15083
  }
14741
15084
  const existing = readPluginRegistrySync().plugins;
14742
- for (const p of validated.providers) {
15085
+ for (const p2 of validated.providers) {
14743
15086
  const clash = existing.find(
14744
- (r) => r.packageName !== pkg.packageName && r.providers.includes(p.name)
15087
+ (r) => r.packageName !== pkg.packageName && r.providers.includes(p2.name)
14745
15088
  );
14746
15089
  if (clash) {
14747
15090
  prompt_exports.log.error(
14748
- `provider "${p.name}" is already provided by "${clash.packageName}" \u2014 remove it first (\`agentbox plugin remove ${p.name}\`)`
15091
+ `provider "${p2.name}" is already provided by "${clash.packageName}" \u2014 remove it first (\`agentbox plugin remove ${p2.name}\`)`
14749
15092
  );
14750
15093
  process.exitCode = 1;
14751
15094
  return;
14752
15095
  }
14753
15096
  }
14754
- const provNames = validated.providers.map((p) => p.name).join(", ");
15097
+ const provNames = validated.providers.map((p2) => p2.name).join(", ");
14755
15098
  prompt_exports.log.info(
14756
15099
  `${pkg.packageName}@${pkg.version} \u2014 provider(s): ${provNames} (SDK v${String(validated.apiVersion)})`
14757
15100
  );
@@ -14769,7 +15112,7 @@ pluginCommand.command("add").argument("<package>", "installed package name or a
14769
15112
  packageName: pkg.packageName,
14770
15113
  resolvedEntry: pkg.entryPath,
14771
15114
  version: pkg.version,
14772
- providers: validated.providers.map((p) => p.name),
15115
+ providers: validated.providers.map((p2) => p2.name),
14773
15116
  apiVersion: validated.apiVersion,
14774
15117
  addedAt: (/* @__PURE__ */ new Date()).toISOString()
14775
15118
  });
@@ -14781,16 +15124,16 @@ pluginCommand.command("list").description("list registered provider plugins").ac
14781
15124
  process.stdout.write("no provider plugins registered\n");
14782
15125
  return;
14783
15126
  }
14784
- for (const p of plugins) {
15127
+ for (const p2 of plugins) {
14785
15128
  process.stdout.write(
14786
- `${p.providers.join(", ").padEnd(20)} ${p.packageName}@${p.version} (SDK v${String(p.apiVersion)})
15129
+ `${p2.providers.join(", ").padEnd(20)} ${p2.packageName}@${p2.version} (SDK v${String(p2.apiVersion)})
14787
15130
  `
14788
15131
  );
14789
15132
  }
14790
15133
  });
14791
15134
  pluginCommand.command("info").argument("<name>", "provider name or package name").description("show a registered plugin").action((name) => {
14792
15135
  const { plugins } = readPluginRegistrySync();
14793
- const hit = plugins.find((p) => p.packageName === name || p.providers.includes(name));
15136
+ const hit = plugins.find((p2) => p2.packageName === name || p2.providers.includes(name));
14794
15137
  if (!hit) {
14795
15138
  process.stderr.write(`no registered plugin matches "${name}"
14796
15139
  `);
@@ -14811,8 +15154,8 @@ pluginCommand.command("remove").alias("rm").argument("<name>", "provider name or
14811
15154
  });
14812
15155
 
14813
15156
  // src/commands/doctor.ts
14814
- import { Command as Command36 } from "commander";
14815
- var doctorCommand = new Command36("doctor").description(
15157
+ import { Command as Command37 } from "commander";
15158
+ var doctorCommand = new Command37("doctor").description(
14816
15159
  "Diagnose system compatibility and provider readiness (Node, git, ssh, Docker daemon, provider credentials, prepared snapshots)."
14817
15160
  ).option(
14818
15161
  "-p, --provider <name>",
@@ -14878,7 +15221,7 @@ function formatUnknown(err) {
14878
15221
  }
14879
15222
 
14880
15223
  // src/commands/git.ts
14881
- import { Command as Command37 } from "commander";
15224
+ import { Command as Command38 } from "commander";
14882
15225
  var WORKSPACE = "/workspace";
14883
15226
  var TOKEN_TTL_MS = 12e4;
14884
15227
  async function runInBox(box, argv2) {
@@ -14961,7 +15304,7 @@ function buildPredictedGhPrParams(ghArgs) {
14961
15304
  async function exitWith(code) {
14962
15305
  process.exit(code);
14963
15306
  }
14964
- var pushCommand = new Command37("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)").option("--host-only", "land the branch in the host's local repo only; do NOT push to the remote (nothing is published online)").option("--as <branch>", "with --host-only: destination branch name in the host repo (default: the box's branch name)").option("--force", "with --host-only: allow a non-fast-forward overwrite of the destination branch").allowExcessArguments(true).allowUnknownOption(true).action(
15307
+ var pushCommand = new Command38("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)").option("--host-only", "land the branch in the host's local repo only; do NOT push to the remote (nothing is published online)").option("--as <branch>", "with --host-only: destination branch name in the host repo (default: the box's branch name)").option("--force", "with --host-only: allow a non-fast-forward overwrite of the destination branch").allowExcessArguments(true).allowUnknownOption(true).action(
14965
15308
  async (boxRef, args, opts) => {
14966
15309
  try {
14967
15310
  if (opts.hostOnly && opts.remote) {
@@ -14982,7 +15325,7 @@ var pushCommand = new Command37("push").description("Push the box's branch via t
14982
15325
  }
14983
15326
  }
14984
15327
  );
14985
- var fetchCommand = new Command37("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) => {
15328
+ var fetchCommand = new Command38("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) => {
14986
15329
  try {
14987
15330
  const box = await resolveBoxOrExit(boxRef);
14988
15331
  const predicted = buildPredictedGitParams(opts.remote, args);
@@ -14995,7 +15338,7 @@ var fetchCommand = new Command37("fetch").description("Fetch via the host relay
14995
15338
  handleLifecycleError(err);
14996
15339
  }
14997
15340
  });
14998
- var pullCommand = new Command37("pull").description(
15341
+ var pullCommand = new Command38("pull").description(
14999
15342
  "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."
15000
15343
  ).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(
15001
15344
  async (boxRef, branch, args, opts) => {
@@ -15017,7 +15360,7 @@ var pullCommand = new Command37("pull").description(
15017
15360
  }
15018
15361
  }
15019
15362
  );
15020
- var checkoutCommand = new Command37("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) => {
15363
+ var checkoutCommand = new Command38("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) => {
15021
15364
  try {
15022
15365
  const box = await resolveBoxOrExit(boxRef);
15023
15366
  const provider = await providerForBox(box);
@@ -15028,7 +15371,7 @@ var checkoutCommand = new Command37("checkout").description("Change the box's wo
15028
15371
  handleLifecycleError(err);
15029
15372
  }
15030
15373
  });
15031
- var branchCommand = new Command37("branch").description("Create a new agentbox/* branch from HEAD (or a given base) and switch the box onto it").argument("<box>", "box ref").argument("<name>", "new branch name (an 'agentbox/' prefix is added when missing)").option("--from <ref>", "base ref to fork from (default: the box's current HEAD)").action(async (boxRef, name, opts) => {
15374
+ var branchCommand = new Command38("branch").description("Create a new agentbox/* branch from HEAD (or a given base) and switch the box onto it").argument("<box>", "box ref").argument("<name>", "new branch name (an 'agentbox/' prefix is added when missing)").option("--from <ref>", "base ref to fork from (default: the box's current HEAD)").action(async (boxRef, name, opts) => {
15032
15375
  try {
15033
15376
  const box = await resolveBoxOrExit(boxRef);
15034
15377
  const provider = await providerForBox(box);
@@ -15039,7 +15382,7 @@ var branchCommand = new Command37("branch").description("Create a new agentbox/*
15039
15382
  handleLifecycleError(err);
15040
15383
  }
15041
15384
  });
15042
- var statusCommand = new Command37("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) => {
15385
+ var statusCommand = new Command38("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) => {
15043
15386
  try {
15044
15387
  const box = await resolveBoxOrExit(boxRef);
15045
15388
  await exitWith(await runAndStream(box, ["git", "status", ...args]));
@@ -15065,7 +15408,7 @@ function injectPrCreateHead2(op, box, args) {
15065
15408
  return injectPrCreateHead(op, rootWt?.branch, args);
15066
15409
  }
15067
15410
  function buildPrSubcommand(op) {
15068
- return new Command37(op).description(PR_OP_DESCRIPTIONS[op]).argument("<box>", "box ref").argument(
15411
+ return new Command38(op).description(PR_OP_DESCRIPTIONS[op]).argument("<box>", "box ref").argument(
15069
15412
  "[args...]",
15070
15413
  "extra flags forwarded to `gh pr <op>` (e.g. --title, --body, --label, --draft, --json)"
15071
15414
  ).allowExcessArguments(true).allowUnknownOption(true).action(async (boxRef, args) => {
@@ -15081,18 +15424,18 @@ function buildPrSubcommand(op) {
15081
15424
  }
15082
15425
  });
15083
15426
  }
15084
- var prCommand = new Command37("pr").description(
15427
+ var prCommand = new Command38("pr").description(
15085
15428
  "PR operations against a box's branch via the host `gh` CLI"
15086
15429
  );
15087
15430
  for (const op of GH_PR_OPS) {
15088
15431
  const sub = buildPrSubcommand(op);
15089
15432
  prCommand.addCommand(sub, op === "create" ? { isDefault: true } : void 0);
15090
15433
  }
15091
- var gitCommand = new Command37("git").description("Run git / gh pr operations against a box from the host").addCommand(pushCommand).addCommand(fetchCommand).addCommand(pullCommand).addCommand(checkoutCommand).addCommand(branchCommand).addCommand(statusCommand).addCommand(prCommand);
15434
+ var gitCommand = new Command38("git").description("Run git / gh pr operations against a box from the host").addCommand(pushCommand).addCommand(fetchCommand).addCommand(pullCommand).addCommand(checkoutCommand).addCommand(branchCommand).addCommand(statusCommand).addCommand(prCommand);
15092
15435
 
15093
15436
  // src/commands/list.ts
15094
- import { log as log46 } from "@clack/prompts";
15095
- import { Command as Command38 } from "commander";
15437
+ import { log as log47 } from "@clack/prompts";
15438
+ import { Command as Command39 } from "commander";
15096
15439
  import { pathToFileURL as pathToFileURL2 } from "url";
15097
15440
 
15098
15441
  // src/box-label.ts
@@ -15126,11 +15469,11 @@ async function applyLiveCloudStates(boxes) {
15126
15469
  })
15127
15470
  );
15128
15471
  }
15129
- function withTimeout(p, ms) {
15472
+ function withTimeout(p2, ms) {
15130
15473
  return new Promise((resolve7) => {
15131
15474
  const t = setTimeout(() => resolve7(null), ms);
15132
15475
  if (typeof t.unref === "function") t.unref();
15133
- p.then(
15476
+ p2.then(
15134
15477
  (v) => {
15135
15478
  clearTimeout(t);
15136
15479
  resolve7(v);
@@ -15263,8 +15606,8 @@ function urlCell(box, stream) {
15263
15606
  }
15264
15607
  const sep2 = " ";
15265
15608
  return {
15266
- text: parts.map((p) => p.text).join(sep2),
15267
- width: parts.reduce((a, p) => a + p.width, 0) + sep2.length * (parts.length - 1)
15609
+ text: parts.map((p2) => p2.text).join(sep2),
15610
+ width: parts.reduce((a, p2) => a + p2.width, 0) + sep2.length * (parts.length - 1)
15268
15611
  };
15269
15612
  }
15270
15613
  function workspaceCell(path, target, stream) {
@@ -15456,7 +15799,7 @@ async function buildListText(all, live) {
15456
15799
  ${table}`;
15457
15800
  }
15458
15801
  var listCommand2 = withWatchOptions(
15459
- new Command38("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(
15802
+ new Command39("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(
15460
15803
  "--live",
15461
15804
  "probe live cloud state via the provider SDK (slower; default: last host-known state)"
15462
15805
  ).option("--cmux", "compact output for the cmux dock sidebar (narrow, 2 lines per box)").option(
@@ -15465,7 +15808,7 @@ var listCommand2 = withWatchOptions(
15465
15808
  )
15466
15809
  ).action(async (opts) => {
15467
15810
  if (opts.json && opts.watch) {
15468
- log46.error("cannot combine --json with --watch");
15811
+ log47.error("cannot combine --json with --watch");
15469
15812
  process.exit(2);
15470
15813
  }
15471
15814
  const all = opts.global ?? false;
@@ -15510,11 +15853,11 @@ var listCommand2 = withWatchOptions(
15510
15853
  });
15511
15854
 
15512
15855
  // src/commands/logs.ts
15513
- import { log as log47 } from "@clack/prompts";
15514
- import { Command as Command39 } from "commander";
15856
+ import { log as log48 } from "@clack/prompts";
15857
+ import { Command as Command40 } from "commander";
15515
15858
  import { spawn as spawn6 } from "child_process";
15516
15859
  var DAEMON_LOG_PATH = "/var/log/agentbox/ctl-daemon.log";
15517
- var logsCommand = new Command39("logs").description("Print recent log lines from a box service; -f to stream").argument(
15860
+ var logsCommand = new Command40("logs").description("Print recent log lines from a box service; -f to stream").argument(
15518
15861
  "[box]",
15519
15862
  "box ref (optional when cwd has exactly 1 box): project index, id, id prefix, name, or container"
15520
15863
  ).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(
@@ -15532,9 +15875,9 @@ var logsCommand = new Command39("logs").description("Print recent log lines from
15532
15875
  service = boxArg;
15533
15876
  }
15534
15877
  if (!service && !opts.daemon) {
15535
- log47.error("missing <service> argument");
15536
- log47.info("usage: agentbox logs [box] <service> [-n N] [-f]");
15537
- log47.info(" agentbox logs [box] --daemon [-n N] [-f]");
15878
+ log48.error("missing <service> argument");
15879
+ log48.info("usage: agentbox logs [box] <service> [-n N] [-f]");
15880
+ log48.info(" agentbox logs [box] --daemon [-n N] [-f]");
15538
15881
  process.exit(2);
15539
15882
  }
15540
15883
  const box = await resolveBoxOrExit(idOrName);
@@ -15545,7 +15888,7 @@ var logsCommand = new Command39("logs").description("Print recent log lines from
15545
15888
  if (!opts.follow) {
15546
15889
  const proc = await provider.exec(box, args, { user: "vscode" });
15547
15890
  if (proc.exitCode !== 0) {
15548
- log47.error(
15891
+ log48.error(
15549
15892
  `${opts.daemon ? "daemon log" : "agentbox-ctl logs"} failed: ${proc.stderr || proc.stdout}`
15550
15893
  );
15551
15894
  process.exit(1);
@@ -15601,12 +15944,12 @@ var logsCommand = new Command39("logs").description("Print recent log lines from
15601
15944
  });
15602
15945
 
15603
15946
  // src/commands/open.ts
15604
- import { log as log48 } from "@clack/prompts";
15947
+ import { log as log49 } from "@clack/prompts";
15605
15948
  import { execa as execa10 } from "execa";
15606
15949
  import { existsSync as existsSync20, mkdirSync as mkdirSync13 } from "fs";
15607
15950
  import { homedir as homedir24 } from "os";
15608
15951
  import { join as join30 } from "path";
15609
- import { Command as Command40, InvalidArgumentError as InvalidArgumentError3 } from "commander";
15952
+ import { Command as Command41, InvalidArgumentError as InvalidArgumentError3 } from "commander";
15610
15953
 
15611
15954
  // src/commands/path.ts
15612
15955
  async function runPath(box, opts) {
@@ -15636,7 +15979,7 @@ function parseOpenTarget(value) {
15636
15979
  `expected one of: claude, codex, herdr, cmux, vscode, iterm2, finder (got "${value}")`
15637
15980
  );
15638
15981
  }
15639
- var openCommand = new Command40("open").description(
15982
+ var openCommand = new Command41("open").description(
15640
15983
  "Mount a box /workspace via sshfs and reveal in Finder (default), or open it in a host app via --in"
15641
15984
  ).argument(
15642
15985
  "[box]",
@@ -15754,11 +16097,11 @@ async function ensurePersistentSshAlias(box, appLabel) {
15754
16097
  }
15755
16098
  async function openInCodex(box) {
15756
16099
  const alias = await ensurePersistentSshAlias(box, "Codex");
15757
- log48.info(`ssh alias '${alias}' written (Include'd from ~/.ssh/config)`);
16100
+ log49.info(`ssh alias '${alias}' written (Include'd from ~/.ssh/config)`);
15758
16101
  const url = codexAddUrl(alias);
15759
16102
  const opened = await execa10(hostOpenCommand(), [url], { reject: false });
15760
16103
  if (opened.exitCode !== 0) {
15761
- log48.warn(
16104
+ log49.warn(
15762
16105
  `could not auto-open the Codex link (is Codex.app installed?): ${opened.stderr || `exit ${String(opened.exitCode)}`}`
15763
16106
  );
15764
16107
  const link = hyperlink(`Add ${alias} to Codex SSH`, url, process.stdout);
@@ -15768,18 +16111,18 @@ ${url}
15768
16111
  process.exitCode = 1;
15769
16112
  return;
15770
16113
  }
15771
- log48.success(`opening Codex \u2014 the SSH connection form is pre-filled with '${alias}'`);
16114
+ log49.success(`opening Codex \u2014 the SSH connection form is pre-filled with '${alias}'`);
15772
16115
  process.stdout.write(url + "\n");
15773
16116
  }
15774
16117
  async function openInClaude(box) {
15775
16118
  const alias = await ensurePersistentSshAlias(box, "Claude");
15776
- log48.info(`ssh alias '${alias}' written (Include'd from ~/.ssh/config)`);
16119
+ log49.info(`ssh alias '${alias}' written (Include'd from ~/.ssh/config)`);
15777
16120
  const entry = claudeSshEntryFor(alias, box.name);
15778
16121
  upsertClaudeSshConfig(entry);
15779
- log48.info(`added '${entry.name}' to Claude desktop's SSH connections (${claudeSettingsPath()})`);
16122
+ log49.info(`added '${entry.name}' to Claude desktop's SSH connections (${claudeSettingsPath()})`);
15780
16123
  const opened = await execa10(hostOpenCommand(), ["-a", "Claude"], { reject: false });
15781
16124
  if (opened.exitCode !== 0) {
15782
- log48.warn(
16125
+ log49.warn(
15783
16126
  `could not launch Claude (is Claude.app installed?): ${opened.stderr || `exit ${String(opened.exitCode)}`}`
15784
16127
  );
15785
16128
  process.stdout.write(
@@ -15789,29 +16132,29 @@ async function openInClaude(box) {
15789
16132
  process.exitCode = 1;
15790
16133
  return;
15791
16134
  }
15792
- log48.success(`opening Claude \u2014 pick '${entry.name}' from the Environment dropdown`);
16135
+ log49.success(`opening Claude \u2014 pick '${entry.name}' from the Environment dropdown`);
15793
16136
  }
15794
16137
  async function openInTerminalApp(box, host) {
15795
16138
  if ((box.provider ?? "docker") === "docker") {
15796
16139
  const insp = await inspectBox(box.id);
15797
16140
  if (insp.state === "paused") {
15798
- log48.info("box is paused; unpausing");
16141
+ log49.info("box is paused; unpausing");
15799
16142
  await unpauseBox(box.id);
15800
16143
  } else if (insp.state === "stopped") {
15801
- log48.info("box is stopped; starting");
16144
+ log49.info("box is stopped; starting");
15802
16145
  await startBox(box.id);
15803
16146
  } else if (insp.state === "missing") {
15804
16147
  throw new Error(`box ${box.name} has no container; was it destroyed?`);
15805
16148
  }
15806
16149
  } else {
15807
- const p = await providerForBox(box);
15808
- const state = await p.probeState(box);
16150
+ const p2 = await providerForBox(box);
16151
+ const state = await p2.probeState(box);
15809
16152
  if (state === "paused") {
15810
- log48.info("box is paused; resuming");
15811
- await p.resume(box);
16153
+ log49.info("box is paused; resuming");
16154
+ await p2.resume(box);
15812
16155
  } else if (state === "stopped") {
15813
- log48.info("box is stopped; starting");
15814
- await p.start(box);
16156
+ log49.info("box is stopped; starting");
16157
+ await p2.start(box);
15815
16158
  } else if (state === "missing") {
15816
16159
  throw new Error(`cloud sandbox for ${box.name} is missing; was it deleted?`);
15817
16160
  }
@@ -15857,15 +16200,15 @@ ${r.error ?? ""}`
15857
16200
  const hint = host === "herdr" ? " Is Herdr running? (`herdr status server`)" : host === "cmux" ? " Is cmux running?" : " Is iTerm2 installed?";
15858
16201
  throw new Error(`could not open in ${host}: ${r.error ?? "unknown error"}.${hint}`);
15859
16202
  }
15860
- log48.success(`opened ${box.name} in a new ${host} ${host === "iterm2" ? "window" : "workspace"} (agentbox attach)`);
16203
+ log49.success(`opened ${box.name} in a new ${host} ${host === "iterm2" ? "window" : "workspace"} (agentbox attach)`);
15861
16204
  }
15862
16205
  async function bringDockerBoxOnline(box) {
15863
16206
  const insp = await inspectBox(box.id);
15864
16207
  if (insp.state === "paused") {
15865
- log48.info("box is paused; unpausing");
16208
+ log49.info("box is paused; unpausing");
15866
16209
  await unpauseBox(box.id);
15867
16210
  } else if (insp.state === "stopped") {
15868
- log48.info("box is stopped; starting");
16211
+ log49.info("box is stopped; starting");
15869
16212
  const started = await startBox(box.id);
15870
16213
  return started.record;
15871
16214
  } else if (insp.state === "missing") {
@@ -15904,10 +16247,10 @@ async function runSshfsMount(box, opts) {
15904
16247
  if (!existsSync20(mountRoot)) {
15905
16248
  mkdirSync13(mountRoot, { recursive: true, mode: 493 });
15906
16249
  } else if (await isMounted(mountRoot)) {
15907
- log48.info(`re-mounting (stale mount detected at ${mountRoot})`);
16250
+ log49.info(`re-mounting (stale mount detected at ${mountRoot})`);
15908
16251
  await tryUnmount(mountRoot);
15909
16252
  }
15910
- log48.info(`mounting ${alias}:/workspace at ${mountRoot}`);
16253
+ log49.info(`mounting ${alias}:/workspace at ${mountRoot}`);
15911
16254
  const mount = await execa10(
15912
16255
  sshfsBin,
15913
16256
  [
@@ -15956,8 +16299,8 @@ async function tryUnmount(path) {
15956
16299
  }
15957
16300
 
15958
16301
  // src/commands/pause.ts
15959
- import { Command as Command41 } from "commander";
15960
- var pauseCommand = new Command41("pause").description(
16302
+ import { Command as Command42 } from "commander";
16303
+ var pauseCommand = new Command42("pause").description(
15961
16304
  "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)."
15962
16305
  ).argument(
15963
16306
  "[box]",
@@ -15984,9 +16327,9 @@ var pauseCommand = new Command41("pause").description(
15984
16327
  });
15985
16328
 
15986
16329
  // src/commands/inbound.ts
15987
- import { confirm as confirm3, isCancel as isCancel5, log as log49 } from "@clack/prompts";
15988
- import { Command as Command42 } from "commander";
15989
- var inboundCommand = new Command42("inbound").description(
16330
+ import { confirm as confirm3, isCancel as isCancel5, log as log50 } from "@clack/prompts";
16331
+ import { Command as Command43 } from "commander";
16332
+ var inboundCommand = new Command43("inbound").description(
15990
16333
  "Set a VPS box's inbound-access policy (hetzner / digitalocean per-box firewall). `open` = SSH reachable from anywhere (0.0.0.0/0, key-only \u2014 reach the box from a phone with the laptop off); `lock` = host egress IP only; a CIDR list = host egress plus those. `--show` prints the current policy."
15991
16334
  ).argument(
15992
16335
  "[box]",
@@ -16011,7 +16354,7 @@ var inboundCommand = new Command42("inbound").description(
16011
16354
  return;
16012
16355
  }
16013
16356
  if (!provider.setInbound) {
16014
- log49.error(
16357
+ log50.error(
16015
16358
  `inbound access control isn't supported for provider '${box.provider ?? "docker"}' \u2014 only hetzner / digitalocean boxes have a per-box firewall.`
16016
16359
  );
16017
16360
  process.exit(2);
@@ -16019,16 +16362,16 @@ var inboundCommand = new Command42("inbound").description(
16019
16362
  const raw = spec.join(" ");
16020
16363
  const policy = parseInboundSpec(raw);
16021
16364
  if (policy.mode === "open" && !opts.yes) {
16022
- log49.warn(
16365
+ log50.warn(
16023
16366
  `This opens SSH (port 22) on box '${box.name}' to the entire internet (0.0.0.0/0). Access stays key-only (password auth is disabled), but the port becomes publicly reachable.`
16024
16367
  );
16025
16368
  const ok = await confirm3({ message: "Open the firewall to the world?", initialValue: false });
16026
16369
  if (isCancel5(ok) || !ok) {
16027
- log49.info("cancelled");
16370
+ log50.info("cancelled");
16028
16371
  return;
16029
16372
  }
16030
16373
  }
16031
- const applied = await provider.setInbound(box, raw, (line) => log49.step(line));
16374
+ const applied = await provider.setInbound(box, raw, (line) => log50.step(line));
16032
16375
  process.stdout.write(`inbound set for ${box.name}: ${describeInbound(applied)}
16033
16376
  `);
16034
16377
  } catch (err) {
@@ -16038,15 +16381,15 @@ var inboundCommand = new Command42("inbound").description(
16038
16381
 
16039
16382
  // src/commands/connect.ts
16040
16383
  import { readFile as readFile6 } from "fs/promises";
16041
- import { confirm as confirm4, isCancel as isCancel6, log as log50 } from "@clack/prompts";
16042
- import { Command as Command43 } from "commander";
16384
+ import { confirm as confirm4, isCancel as isCancel6, log as log51 } from "@clack/prompts";
16385
+ import { Command as Command44 } from "commander";
16043
16386
  function looksLikePublicKey(s) {
16044
16387
  return /^(ssh-(ed25519|rsa|dss)|ecdsa-sha2-\S+|sk-ssh-\S+|sk-ecdsa-\S+)\s+\S+/.test(s.trim());
16045
16388
  }
16046
16389
  function shellSingleQuote(s) {
16047
16390
  return `'${s.replace(/'/g, `'\\''`)}'`;
16048
16391
  }
16049
- var connectCommand = new Command43("connect").description(
16392
+ var connectCommand = new Command44("connect").description(
16050
16393
  "Print a VPS box's SSH connection details (to drive it from a phone / other SSH client with the laptop off), add another device's key, export the box key, or copy git credentials into the box so it pushes on its own (--dangerously-git-credentials). Pair with `agentbox inbound <box> open` so the box is reachable off-network. Hetzner / DigitalOcean only."
16051
16394
  ).argument(
16052
16395
  "[box]",
@@ -16066,36 +16409,36 @@ var connectCommand = new Command43("connect").description(
16066
16409
  const provider = await providerForBox(box);
16067
16410
  if (opts.dangerouslyGitCredentials) {
16068
16411
  if (opts.addKey || opts.exportKey) {
16069
- log50.error("--dangerously-git-credentials cannot be combined with --add-key / --export-key.");
16412
+ log51.error("--dangerously-git-credentials cannot be combined with --add-key / --export-key.");
16070
16413
  process.exit(2);
16071
16414
  }
16072
16415
  if (!provider.enableDirectGit || !provider.buildAttach) {
16073
- log50.error(
16416
+ log51.error(
16074
16417
  `\`connect --dangerously-git-credentials\` needs an SSH cloud box (hetzner / digitalocean) \u2014 provider '${box.provider ?? "docker"}' isn't supported here` + (provider.enableDirectGit ? "" : " (docker boxes bind-mount the host .git, so git direct mode is N/A)") + "."
16075
16418
  );
16076
16419
  process.exit(2);
16077
16420
  }
16078
16421
  const projectRoot = box.projectRoot ?? box.workspacePath ?? process.cwd();
16079
- const gate = await runGitCredsGate({ projectRoot, onLog: (l) => log50.step(l) });
16422
+ const gate = await runGitCredsGate({ projectRoot, onLog: (l) => log51.step(l) });
16080
16423
  if (gate.decision === "cancel") {
16081
- log50.info("cancelled");
16424
+ log51.info("cancelled");
16082
16425
  return;
16083
16426
  }
16084
16427
  if (gate.decision === "skip" || gate.entries.length === 0) {
16085
- log50.warn(
16428
+ log51.warn(
16086
16429
  "no git credential could be resolved for this repo (no token / ssh key found); nothing was applied."
16087
16430
  );
16088
16431
  return;
16089
16432
  }
16090
16433
  await resolveCloudSshTarget(box, provider, {
16091
16434
  bringOnline: true,
16092
- logInfo: (l) => log50.step(l)
16435
+ logInfo: (l) => log51.step(l)
16093
16436
  });
16094
16437
  await provider.enableDirectGit(box, gate.entries, {
16095
16438
  hostRepo: projectRoot,
16096
- onLog: (l) => log50.step(l)
16439
+ onLog: (l) => log51.step(l)
16097
16440
  });
16098
- log50.success(
16441
+ log51.success(
16099
16442
  `git direct mode enabled for ${box.name} \u2014 it can now \`git push\` / \`pull\` on its own with your laptop off.`
16100
16443
  );
16101
16444
  const lastAgent = box.lastAgent;
@@ -16108,9 +16451,9 @@ var connectCommand = new Command43("connect").description(
16108
16451
  await restoreAgentSessions(box, provider, {
16109
16452
  restoreOnly: lastAgent,
16110
16453
  force: true,
16111
- onLog: (l) => log50.step(l)
16454
+ onLog: (l) => log51.step(l)
16112
16455
  });
16113
- log50.success(`${lastAgent} restarted in the background \u2014 it now pushes direct.`);
16456
+ log51.success(`${lastAgent} restarted in the background \u2014 it now pushes direct.`);
16114
16457
  return;
16115
16458
  }
16116
16459
  }
@@ -16122,23 +16465,23 @@ var connectCommand = new Command43("connect").description(
16122
16465
  return;
16123
16466
  }
16124
16467
  if (!provider.buildAttach) {
16125
- log50.error(
16468
+ log51.error(
16126
16469
  `\`connect\` needs an SSH box \u2014 provider '${box.provider ?? "docker"}' isn't reachable over SSH (only hetzner / digitalocean boxes are).`
16127
16470
  );
16128
16471
  process.exit(2);
16129
16472
  }
16130
16473
  const conn = await resolveCloudSshTarget(box, provider, {
16131
16474
  bringOnline: Boolean(opts.addKey),
16132
- logInfo: (l) => log50.step(l)
16475
+ logInfo: (l) => log51.step(l)
16133
16476
  });
16134
16477
  if (!conn.identityFile) {
16135
- log50.error(`box '${box.name}' has no persistent SSH key \u2014 only hetzner / digitalocean boxes are supported.`);
16478
+ log51.error(`box '${box.name}' has no persistent SSH key \u2014 only hetzner / digitalocean boxes are supported.`);
16136
16479
  process.exit(2);
16137
16480
  }
16138
16481
  if (opts.addKey) {
16139
16482
  const raw = opts.addKey.startsWith("@") ? (await readFile6(opts.addKey.slice(1), "utf8")).trim() : opts.addKey.trim();
16140
16483
  if (!looksLikePublicKey(raw)) {
16141
- log50.error(
16484
+ log51.error(
16142
16485
  "that does not look like an SSH public key (expected e.g. `ssh-ed25519 AAAA\u2026 comment`). Pass the public key string or @path-to-key.pub."
16143
16486
  );
16144
16487
  process.exit(2);
@@ -16147,7 +16490,7 @@ var connectCommand = new Command43("connect").description(
16147
16490
  const script = `set -e; mkdir -p ~/.ssh && chmod 700 ~/.ssh; touch ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys; if grep -qxF ${q} ~/.ssh/authorized_keys; then echo already-present; else echo ${q} >> ~/.ssh/authorized_keys && echo added; fi`;
16148
16491
  const res = await provider.exec(box, ["bash", "-lc", script]);
16149
16492
  if (res.exitCode !== 0) {
16150
- log50.error(`failed to add key: ${res.stderr || res.stdout || `exit ${String(res.exitCode)}`}`);
16493
+ log51.error(`failed to add key: ${res.stderr || res.stdout || `exit ${String(res.exitCode)}`}`);
16151
16494
  process.exit(1);
16152
16495
  }
16153
16496
  const already = res.stdout.includes("already-present");
@@ -16160,12 +16503,12 @@ var connectCommand = new Command43("connect").description(
16160
16503
  }
16161
16504
  if (opts.exportKey) {
16162
16505
  if (!opts.yes) {
16163
- log50.warn(
16506
+ log51.warn(
16164
16507
  `This prints box '${box.name}''s PRIVATE key. Anyone with it can SSH in as ${conn.user}. Prefer \`--add-key <your-device.pub>\` (the box key then never leaves this host).`
16165
16508
  );
16166
16509
  const ok = await confirm4({ message: "Export the private key?", initialValue: false });
16167
16510
  if (isCancel6(ok) || !ok) {
16168
- log50.info("cancelled");
16511
+ log51.info("cancelled");
16169
16512
  return;
16170
16513
  }
16171
16514
  }
@@ -16210,7 +16553,7 @@ var connectCommand = new Command43("connect").description(
16210
16553
  });
16211
16554
 
16212
16555
  // src/commands/prune.ts
16213
- import { Command as Command44 } from "commander";
16556
+ import { Command as Command45 } from "commander";
16214
16557
  function totalRemovals(r, projectConfigs) {
16215
16558
  return r.removedRecords.length + r.removedContainers.length + r.removedVolumes.length + r.removedSnapshotDirs.length + r.removedBoxDirs.length + projectConfigs.length;
16216
16559
  }
@@ -16251,12 +16594,12 @@ function summary(r, projectConfigs) {
16251
16594
  async function liveProjectRoots() {
16252
16595
  try {
16253
16596
  const boxes = await listBoxes();
16254
- return boxes.map((b) => b.projectRoot).filter((p) => typeof p === "string");
16597
+ return boxes.map((b) => b.projectRoot).filter((p2) => typeof p2 === "string");
16255
16598
  } catch {
16256
16599
  return [];
16257
16600
  }
16258
16601
  }
16259
- var pruneCommand = new Command44("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(
16602
+ var pruneCommand = new Command45("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(
16260
16603
  "--all",
16261
16604
  "also remove orphan agentbox-* containers, volumes, snapshot dirs, and orphan per-project config dirs"
16262
16605
  ).option("-y, --yes", "skip the confirmation prompt").option(
@@ -16301,7 +16644,14 @@ ${summary(result, removedProjects)}
16301
16644
  handleLifecycleError(err);
16302
16645
  }
16303
16646
  });
16304
- var CLOUD_PRUNE_PROVIDERS = ["daytona", "hetzner", "vercel", "e2b", "digitalocean"];
16647
+ var CLOUD_PRUNE_PROVIDERS = [
16648
+ "daytona",
16649
+ "hetzner",
16650
+ "vercel",
16651
+ "e2b",
16652
+ "digitalocean",
16653
+ "remote-docker"
16654
+ ];
16305
16655
  function isCloudPruneProvider(name) {
16306
16656
  return CLOUD_PRUNE_PROVIDERS.includes(name);
16307
16657
  }
@@ -16370,17 +16720,17 @@ async function pruneCloud(provider, opts) {
16370
16720
 
16371
16721
  // src/commands/queue.ts
16372
16722
  import { readFile as readFile7, stat as stat7 } from "fs/promises";
16373
- import { intro as intro13, log as log52, outro as outro12 } from "@clack/prompts";
16374
- import { Command as Command45 } from "commander";
16723
+ import { intro as intro13, log as log53, outro as outro12 } from "@clack/prompts";
16724
+ import { Command as Command46 } from "commander";
16375
16725
  var TERMINAL_STATUSES = /* @__PURE__ */ new Set(["done", "failed", "cancelled"]);
16376
- var queueCommand = new Command45("queue").description("Inspect and manage background `agentbox claude|codex|opencode -i` jobs");
16377
- var queueListCommand = new Command45("list").description("List queued, running, and (with --all) terminal background jobs").option("--all", "include done/failed/cancelled jobs (default: hide terminal)").action(async (opts) => {
16726
+ var queueCommand = new Command46("queue").description("Inspect and manage background `agentbox claude|codex|opencode -i` jobs");
16727
+ var queueListCommand = new Command46("list").description("List queued, running, and (with --all) terminal background jobs").option("--all", "include done/failed/cancelled jobs (default: hide terminal)").action(async (opts) => {
16378
16728
  const jobs = await loadQueue();
16379
16729
  const cfg = await loadQueueConfig();
16380
16730
  const visible = opts.all === true ? jobs : jobs.filter((j) => !TERMINAL_STATUSES.has(j.status));
16381
16731
  if (visible.length === 0) {
16382
- log52.info(opts.all ? "no queued jobs." : "no active queued jobs (--all to see terminal).");
16383
- log52.info(`queue.maxConcurrent = ${String(cfg.maxConcurrent)} (queue.enabled=${String(cfg.enabled)})`);
16732
+ log53.info(opts.all ? "no queued jobs." : "no active queued jobs (--all to see terminal).");
16733
+ log53.info(`queue.maxConcurrent = ${String(cfg.maxConcurrent)} (queue.enabled=${String(cfg.enabled)})`);
16384
16734
  return;
16385
16735
  }
16386
16736
  const rows = visible.map((j) => ({
@@ -16405,12 +16755,12 @@ var queueListCommand = new Command45("list").description("List queued, running,
16405
16755
  headers.map((h, i) => pad5(String(r[h]), widths[i])).join(" ") + "\n"
16406
16756
  );
16407
16757
  }
16408
- log52.info(`queue.maxConcurrent = ${String(cfg.maxConcurrent)} (queue.enabled=${String(cfg.enabled)})`);
16758
+ log53.info(`queue.maxConcurrent = ${String(cfg.maxConcurrent)} (queue.enabled=${String(cfg.enabled)})`);
16409
16759
  });
16410
- var queueShowCommand = new Command45("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) => {
16760
+ var queueShowCommand = new Command46("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) => {
16411
16761
  const job = await readJob(id);
16412
16762
  if (!job) {
16413
- log52.error(`no job with id ${id}`);
16763
+ log53.error(`no job with id ${id}`);
16414
16764
  process.exit(1);
16415
16765
  }
16416
16766
  process.stdout.write(JSON.stringify(job, null, 2) + "\n");
@@ -16426,18 +16776,18 @@ var queueShowCommand = new Command45("show").description("Dump a job manifest an
16426
16776
  process.stdout.write(slice.join("\n"));
16427
16777
  if (!slice.join("\n").endsWith("\n")) process.stdout.write("\n");
16428
16778
  } catch {
16429
- log52.info(`(no log at ${job.logPath} yet)`);
16779
+ log53.info(`(no log at ${job.logPath} yet)`);
16430
16780
  }
16431
16781
  });
16432
- var queueCancelCommand = new Command45("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) => {
16782
+ var queueCancelCommand = new Command46("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) => {
16433
16783
  intro13(`Cancelling queue job ${id}...`);
16434
16784
  const job = await readJob(id);
16435
16785
  if (!job) {
16436
- log52.error(`no job with id ${id}`);
16786
+ log53.error(`no job with id ${id}`);
16437
16787
  process.exit(1);
16438
16788
  }
16439
16789
  if (job.status !== "queued") {
16440
- log52.error(
16790
+ log53.error(
16441
16791
  `job ${id} is ${job.status}; cancel only flips 'queued' \u2192 'cancelled'.` + (job.status === "running" ? ` Use 'agentbox destroy ${job.boxName || id}' to stop the box.` : "")
16442
16792
  );
16443
16793
  process.exit(1);
@@ -16451,13 +16801,13 @@ var queueCancelCommand = new Command45("cancel").description("Cancel a queued jo
16451
16801
  await writeJob(cancelled);
16452
16802
  outro12(`job ${id} cancelled`);
16453
16803
  });
16454
- var queueClearCommand = new Command45("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) => {
16804
+ var queueClearCommand = new Command46("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) => {
16455
16805
  const targets = /* @__PURE__ */ new Set();
16456
16806
  if (opts.all === true || opts.done === true) targets.add("done");
16457
16807
  if (opts.all === true || opts.failed === true) targets.add("failed");
16458
16808
  if (opts.all === true || opts.cancelled === true) targets.add("cancelled");
16459
16809
  if (targets.size === 0) {
16460
- log52.error("pick at least one of: --done, --failed, --cancelled, --all");
16810
+ log53.error("pick at least one of: --done, --failed, --cancelled, --all");
16461
16811
  process.exit(2);
16462
16812
  }
16463
16813
  const jobs = await loadQueue();
@@ -16467,7 +16817,7 @@ var queueClearCommand = new Command45("clear").description("Sweep terminal-state
16467
16817
  await deleteJob(j.id);
16468
16818
  removed += 1;
16469
16819
  }
16470
- log52.success(`removed ${String(removed)} manifest${removed === 1 ? "" : "s"}`);
16820
+ log53.success(`removed ${String(removed)} manifest${removed === 1 ? "" : "s"}`);
16471
16821
  });
16472
16822
  var QUEUE_WAIT_EVENTS = [
16473
16823
  "new-box",
@@ -16480,11 +16830,11 @@ var QUEUE_WAIT_EVENTS = [
16480
16830
  var ACTIVE_JOB_STATUSES = /* @__PURE__ */ new Set(["queued", "running"]);
16481
16831
  var DEFAULT_QUEUE_WAIT_TIMEOUT_MS = 10 * 60 * 1e3;
16482
16832
  var QUEUE_POLL_INTERVAL_MS = 500;
16483
- var queueWaitForCommand = new Command45("wait-for").description(
16833
+ var queueWaitForCommand = new Command46("wait-for").description(
16484
16834
  `Block until a queue / box event fires. <event> one of: ${QUEUE_WAIT_EVENTS.join(" | ")}.`
16485
16835
  ).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) => {
16486
16836
  if (!QUEUE_WAIT_EVENTS.includes(eventRaw)) {
16487
- log52.error(`unknown event '${eventRaw}' (one of: ${QUEUE_WAIT_EVENTS.join(", ")})`);
16837
+ log53.error(`unknown event '${eventRaw}' (one of: ${QUEUE_WAIT_EVENTS.join(", ")})`);
16488
16838
  process.exit(2);
16489
16839
  }
16490
16840
  const event = eventRaw;
@@ -16504,11 +16854,11 @@ var queueWaitForCommand = new Command45("wait-for").description(
16504
16854
  if (opts.json === true) {
16505
16855
  process.stdout.write(JSON.stringify({ matched: false, event, elapsedMs }) + "\n");
16506
16856
  } else {
16507
- log52.error(`'${event}' did not occur within ${String(timeoutMs)}ms`);
16857
+ log53.error(`'${event}' did not occur within ${String(timeoutMs)}ms`);
16508
16858
  }
16509
16859
  process.exit(1);
16510
16860
  }
16511
- log52.error(err instanceof Error ? err.message : String(err));
16861
+ log53.error(err instanceof Error ? err.message : String(err));
16512
16862
  process.exit(1);
16513
16863
  }
16514
16864
  });
@@ -16605,8 +16955,8 @@ function truncate(s, max) {
16605
16955
  }
16606
16956
 
16607
16957
  // src/commands/relay.ts
16608
- import { log as log53, spinner as spinner11 } from "@clack/prompts";
16609
- import { Command as Command46 } from "commander";
16958
+ import { log as log54, spinner as spinner12 } from "@clack/prompts";
16959
+ import { Command as Command47 } from "commander";
16610
16960
  async function rehydrateFromState() {
16611
16961
  const state = await readState();
16612
16962
  await rehydrateRelayRegistry(
@@ -16650,7 +17000,7 @@ function renderStatus(s) {
16650
17000
  }
16651
17001
  return ["relay: not running", ` log: ${s.logFile}`].join("\n");
16652
17002
  }
16653
- var statusSub2 = new Command46("status").description("Show whether the host relay is running, with pid / port / box count").option("--json", "emit RelayStatus as JSON").action(async (opts) => {
17003
+ var statusSub2 = new Command47("status").description("Show whether the host relay is running, with pid / port / box count").option("--json", "emit RelayStatus as JSON").action(async (opts) => {
16654
17004
  try {
16655
17005
  const s = await getRelayStatus();
16656
17006
  if (opts.json) {
@@ -16662,9 +17012,9 @@ var statusSub2 = new Command46("status").description("Show whether the host rela
16662
17012
  handleLifecycleError(err);
16663
17013
  }
16664
17014
  });
16665
- var stopSub2 = new Command46("stop").description("Stop the host relay process (idempotent)").action(async () => {
17015
+ var stopSub2 = new Command47("stop").description("Stop the host relay process (idempotent)").action(async () => {
16666
17016
  try {
16667
- const s = spinner11();
17017
+ const s = spinner12();
16668
17018
  s.start("stopping relay");
16669
17019
  const result = await stopRelay();
16670
17020
  s.stop(
@@ -16674,9 +17024,9 @@ var stopSub2 = new Command46("stop").description("Stop the host relay process (i
16674
17024
  handleLifecycleError(err);
16675
17025
  }
16676
17026
  });
16677
- var startSub2 = new Command46("start").description("Start the host relay if not already running (idempotent)").action(async () => {
17027
+ var startSub2 = new Command47("start").description("Start the host relay if not already running (idempotent)").action(async () => {
16678
17028
  try {
16679
- const s = spinner11();
17029
+ const s = spinner12();
16680
17030
  s.start("starting relay");
16681
17031
  const ep = await ensureRelay();
16682
17032
  await rehydrateFromState();
@@ -16685,15 +17035,15 @@ var startSub2 = new Command46("start").description("Start the host relay if not
16685
17035
  handleLifecycleError(err);
16686
17036
  }
16687
17037
  });
16688
- var restartSub2 = new Command46("restart").description("Stop then start the host relay").action(async () => {
17038
+ var restartSub2 = new Command47("restart").description("Stop then start the host relay").action(async () => {
16689
17039
  try {
16690
- const s = spinner11();
17040
+ const s = spinner12();
16691
17041
  s.start("stopping relay");
16692
17042
  const stopped = await stopRelay();
16693
17043
  s.stop(
16694
17044
  stopped.stopped ? `stopped relay (pid ${String(stopped.pid)})` : "relay was not running"
16695
17045
  );
16696
- const s2 = spinner11();
17046
+ const s2 = spinner12();
16697
17047
  s2.start("starting relay");
16698
17048
  try {
16699
17049
  const ep = await ensureRelay();
@@ -16701,19 +17051,19 @@ var restartSub2 = new Command46("restart").description("Stop then start the host
16701
17051
  s2.stop(`relay running on ${ep.hostUrl}`);
16702
17052
  } catch (err) {
16703
17053
  s2.stop("relay start failed");
16704
- log53.warn(err instanceof Error ? err.message : String(err));
17054
+ log54.warn(err instanceof Error ? err.message : String(err));
16705
17055
  throw err;
16706
17056
  }
16707
17057
  } catch (err) {
16708
17058
  handleLifecycleError(err);
16709
17059
  }
16710
17060
  });
16711
- var relayCommand = new Command46("relay").description("Manage the host relay process (status / stop / start / restart)").addCommand(statusSub2, { isDefault: true }).addCommand(stopSub2).addCommand(startSub2).addCommand(restartSub2);
17061
+ var relayCommand = new Command47("relay").description("Manage the host relay process (status / stop / start / restart)").addCommand(statusSub2, { isDefault: true }).addCommand(stopSub2).addCommand(startSub2).addCommand(restartSub2);
16712
17062
 
16713
17063
  // src/commands/hub.ts
16714
17064
  import { spawn as spawn7 } from "child_process";
16715
- import { log as log54, spinner as spinner12 } from "@clack/prompts";
16716
- import { Command as Command47 } from "commander";
17065
+ import { log as log55, spinner as spinner13 } from "@clack/prompts";
17066
+ import { Command as Command48 } from "commander";
16717
17067
  async function resolvePortlessEnabled() {
16718
17068
  try {
16719
17069
  const cfg = await loadEffectiveConfig(process.cwd());
@@ -16744,7 +17094,7 @@ function renderStatus2(s) {
16744
17094
  }
16745
17095
  return ["hub: not running", ` log: ${s.logFile}`].join("\n");
16746
17096
  }
16747
- var statusSub3 = new Command47("status").description("Show whether the hub (relay + Web UI) is running, with its URL").option("--json", "emit HubStatus as JSON").action(async (opts) => {
17097
+ var statusSub3 = new Command48("status").description("Show whether the hub (relay + Web UI) is running, with its URL").option("--json", "emit HubStatus as JSON").action(async (opts) => {
16748
17098
  try {
16749
17099
  const s = await getHubStatus();
16750
17100
  if (opts.json) {
@@ -16756,9 +17106,9 @@ var statusSub3 = new Command47("status").description("Show whether the hub (rela
16756
17106
  handleLifecycleError(err);
16757
17107
  }
16758
17108
  });
16759
- var startSub3 = new Command47("start").description("Start the hub (relay + Web UI on port 8787) and open it").option("--no-open", "don't open the browser, just print the URL").action(async (opts) => {
17109
+ var startSub3 = new Command48("start").description("Start the hub (relay + Web UI on port 8787) and open it").option("--no-open", "don't open the browser, just print the URL").action(async (opts) => {
16760
17110
  try {
16761
- const s = spinner12();
17111
+ const s = spinner13();
16762
17112
  s.start("starting hub");
16763
17113
  const ep = await ensureHub({
16764
17114
  onLog: (line) => s.message(line),
@@ -16775,9 +17125,9 @@ var startSub3 = new Command47("start").description("Start the hub (relay + Web U
16775
17125
  handleLifecycleError(err);
16776
17126
  }
16777
17127
  });
16778
- var stopSub3 = new Command47("stop").description("Stop the hub process (idempotent)").action(async () => {
17128
+ var stopSub3 = new Command48("stop").description("Stop the hub process (idempotent)").action(async () => {
16779
17129
  try {
16780
- const s = spinner12();
17130
+ const s = spinner13();
16781
17131
  s.start("stopping hub");
16782
17132
  const result = await stopHub();
16783
17133
  s.stop(result.stopped ? `stopped hub (pid ${String(result.pid)})` : "hub was not running");
@@ -16785,13 +17135,13 @@ var stopSub3 = new Command47("stop").description("Stop the hub process (idempote
16785
17135
  handleLifecycleError(err);
16786
17136
  }
16787
17137
  });
16788
- var restartSub3 = new Command47("restart").description("Stop then start the hub").option("--no-open", "don't open the browser, just print the URL").action(async (opts) => {
17138
+ var restartSub3 = new Command48("restart").description("Stop then start the hub").option("--no-open", "don't open the browser, just print the URL").action(async (opts) => {
16789
17139
  try {
16790
- const s = spinner12();
17140
+ const s = spinner13();
16791
17141
  s.start("stopping hub");
16792
17142
  const stopped = await stopHub();
16793
17143
  s.stop(stopped.stopped ? `stopped hub (pid ${String(stopped.pid)})` : "hub was not running");
16794
- const s2 = spinner12();
17144
+ const s2 = spinner13();
16795
17145
  s2.start("starting hub");
16796
17146
  try {
16797
17147
  const ep = await ensureHub({
@@ -16807,20 +17157,20 @@ var restartSub3 = new Command47("restart").description("Stop then start the hub"
16807
17157
  if (opts.open !== false) openInBrowser2(ep.openUrl);
16808
17158
  } catch (err) {
16809
17159
  s2.stop("hub start failed");
16810
- log54.warn(err instanceof Error ? err.message : String(err));
17160
+ log55.warn(err instanceof Error ? err.message : String(err));
16811
17161
  throw err;
16812
17162
  }
16813
17163
  } catch (err) {
16814
17164
  handleLifecycleError(err);
16815
17165
  }
16816
17166
  });
16817
- var hubCommand = new Command47("hub").description(
17167
+ var hubCommand = new Command48("hub").description(
16818
17168
  "Run the AgentBox hub \u2014 the relay + Web UI on http://127.0.0.1:8787 (also https://agentbox.localhost when Portless is installed)"
16819
17169
  ).addCommand(startSub3, { isDefault: true }).addCommand(statusSub3).addCommand(stopSub3).addCommand(restartSub3);
16820
17170
 
16821
17171
  // src/commands/control-plane.ts
16822
- import { isCancel as isCancel8, log as log55, note as note7, select as select3, spinner as spinner13 } from "@clack/prompts";
16823
- import { Command as Command48 } from "commander";
17172
+ import { isCancel as isCancel8, log as log56, note as note7, select as select3, spinner as spinner14 } from "@clack/prompts";
17173
+ import { Command as Command49 } from "commander";
16824
17174
  import { spawn as spawn10 } from "child_process";
16825
17175
  import { existsSync as existsSync21, readFileSync as readFileSync12 } from "fs";
16826
17176
  import { chmod as chmod2, mkdir as mkdir2, rm, writeFile as writeFile6 } from "fs/promises";
@@ -16832,22 +17182,22 @@ import { randomBytes as randomBytes3 } from "crypto";
16832
17182
  // src/control-plane/create-box.ts
16833
17183
  function makeControlPlaneCreateBox(deps) {
16834
17184
  return async (request, jobId) => {
16835
- const log67 = deps.log ?? (() => {
17185
+ const log69 = deps.log ?? (() => {
16836
17186
  });
16837
17187
  const dir = deps.tmpDir(jobId);
16838
17188
  try {
16839
- log67(`leasing a push token for ${request.repoUrl}`);
17189
+ log69(`leasing a push token for ${request.repoUrl}`);
16840
17190
  const authedUrl = await deps.leaseRemoteUrl(request.repoUrl);
16841
- log67(`cloning ${request.repoUrl}${request.branch ? `@${request.branch}` : ""} into ${dir}`);
17191
+ log69(`cloning ${request.repoUrl}${request.branch ? `@${request.branch}` : ""} into ${dir}`);
16842
17192
  await deps.cloneRepo(authedUrl, request.repoUrl, dir, request.branch);
16843
- log67(`provisioning ${request.provider} box from the clone`);
17193
+ log69(`provisioning ${request.provider} box from the clone`);
16844
17194
  const box = await deps.createBox({
16845
17195
  workspacePath: dir,
16846
17196
  name: request.name,
16847
17197
  provider: request.provider,
16848
17198
  onLog: deps.log
16849
17199
  });
16850
- log67(`created box ${box.id}`);
17200
+ log69(`created box ${box.id}`);
16851
17201
  return { boxId: box.id };
16852
17202
  } finally {
16853
17203
  await deps.cleanup(dir);
@@ -16865,7 +17215,7 @@ async function runGitHubAppManifestFlow(opts) {
16865
17215
  const githubUrl = (opts.githubUrl ?? "https://github.com").replace(/\/$/, "");
16866
17216
  const apiBaseUrl = (opts.apiBaseUrl ?? "https://api.github.com").replace(/\/$/, "");
16867
17217
  const fetchImpl = opts.fetchImpl ?? fetch;
16868
- const log67 = opts.log ?? (() => {
17218
+ const log69 = opts.log ?? (() => {
16869
17219
  });
16870
17220
  const state = randomBytes(16).toString("hex");
16871
17221
  return new Promise((resolve7, reject) => {
@@ -16967,10 +17317,10 @@ async function runGitHubAppManifestFlow(opts) {
16967
17317
  server.listen(0, "127.0.0.1", () => {
16968
17318
  listenPort = server.address().port;
16969
17319
  const startUrl = `http://127.0.0.1:${String(listenPort)}/`;
16970
- log67(`opening ${startUrl} to create the GitHub App\u2026`);
17320
+ log69(`opening ${startUrl} to create the GitHub App\u2026`);
16971
17321
  void Promise.resolve(opts.openBrowser(startUrl)).catch((err) => {
16972
- log67(`could not open the browser automatically: ${err instanceof Error ? err.message : String(err)}`);
16973
- log67(`open this URL manually: ${startUrl}`);
17322
+ log69(`could not open the browser automatically: ${err instanceof Error ? err.message : String(err)}`);
17323
+ log69(`open this URL manually: ${startUrl}`);
16974
17324
  });
16975
17325
  });
16976
17326
  });
@@ -17015,9 +17365,9 @@ async function ghLogin() {
17015
17365
  const login = r.stdout.trim();
17016
17366
  return r.code === 0 && login.length > 0 ? login : null;
17017
17367
  }
17018
- async function ensureFork(repo, login, log67) {
17368
+ async function ensureFork(repo, login, log69) {
17019
17369
  const fork = `${login}/${nameOf(repo)}`;
17020
- log67(`forking ${repo} -> ${fork}\u2026`);
17370
+ log69(`forking ${repo} -> ${fork}\u2026`);
17021
17371
  const f = await gh(["repo", "fork", repo, "--clone=false"]);
17022
17372
  if (f.code !== 0 && !/already exists/i.test(`${f.stderr}${f.stdout}`)) {
17023
17373
  throw new Error(`gh repo fork ${repo} failed: ${(f.stderr || f.stdout).trim()}`);
@@ -17036,13 +17386,13 @@ var PROJECT_DEFAULT = "agentbox-control-plane";
17036
17386
  var ROOT_DIRECTORY = "apps/hub";
17037
17387
  var GitConnectError = class extends Error {
17038
17388
  };
17039
- function connectedTo(p, repo) {
17040
- return !!p?.link && p.link.type === "github" && `${p.link.org ?? ""}/${p.link.repo ?? ""}`.toLowerCase() === repo.toLowerCase();
17389
+ function connectedTo(p2, repo) {
17390
+ return !!p2?.link && p2.link.type === "github" && `${p2.link.org ?? ""}/${p2.link.repo ?? ""}`.toLowerCase() === repo.toLowerCase();
17041
17391
  }
17042
17392
  function isConnectError(msg) {
17043
17393
  return /install the GitHub integration|integration first|github integration/i.test(msg);
17044
17394
  }
17045
- function provisionNeon(teamId, projectId, log67) {
17395
+ function provisionNeon(teamId, projectId, log69) {
17046
17396
  return new Promise((resolve7) => {
17047
17397
  const work = mkdtempSync2(join31(tmpdir6(), "agentbox-neon-"));
17048
17398
  const env = { ...process.env, VERCEL_PROJECT_ID: projectId, ...teamId ? { VERCEL_ORG_ID: teamId } : {} };
@@ -17052,7 +17402,7 @@ function provisionNeon(teamId, projectId, log67) {
17052
17402
  stdio: ["ignore", "pipe", "pipe"]
17053
17403
  });
17054
17404
  const onData = (c) => {
17055
- for (const l of c.toString("utf8").split(/\r?\n/)) if (l.trim()) log67(`neon: ${l.trim()}`);
17405
+ for (const l of c.toString("utf8").split(/\r?\n/)) if (l.trim()) log69(`neon: ${l.trim()}`);
17056
17406
  };
17057
17407
  child.stdout.on("data", onData);
17058
17408
  child.stderr.on("data", onData);
@@ -17064,22 +17414,22 @@ function provisionNeon(teamId, projectId, log67) {
17064
17414
  resolve7();
17065
17415
  };
17066
17416
  child.on("error", (e) => {
17067
- log67(`neon: could not run \`vercel integration add neon\` (${e.message}) \u2014 continuing`);
17417
+ log69(`neon: could not run \`vercel integration add neon\` (${e.message}) \u2014 continuing`);
17068
17418
  done();
17069
17419
  });
17070
17420
  child.on("close", (code) => {
17071
- if (code !== 0) log67(`neon: integration add exited ${String(code)} \u2014 continuing (it may already be attached)`);
17421
+ if (code !== 0) log69(`neon: integration add exited ${String(code)} \u2014 continuing (it may already be attached)`);
17072
17422
  done();
17073
17423
  });
17074
17424
  });
17075
17425
  }
17076
- async function pollDeployment(token, teamId, id, log67) {
17426
+ async function pollDeployment(token, teamId, id, log69) {
17077
17427
  const stop = Date.now() + 20 * 6e4;
17078
17428
  let last = "";
17079
17429
  while (Date.now() < stop) {
17080
17430
  const d = await getDeployment(token, teamId, id);
17081
17431
  if (d.readyState !== last) {
17082
- log67(`build: ${d.readyState.toLowerCase()}`);
17432
+ log69(`build: ${d.readyState.toLowerCase()}`);
17083
17433
  last = d.readyState;
17084
17434
  }
17085
17435
  if (d.readyState === "READY") return;
@@ -17144,14 +17494,14 @@ async function apiDeploy(a) {
17144
17494
  return { url: alias.startsWith("http") ? alias : `https://${alias}` };
17145
17495
  }
17146
17496
  function deployButtonUrl(repo, projectName) {
17147
- const p = new URLSearchParams({
17497
+ const p2 = new URLSearchParams({
17148
17498
  "repository-url": `https://github.com/${repo}`,
17149
17499
  "root-directory": ROOT_DIRECTORY,
17150
17500
  stores: '[{"type":"postgres"}]',
17151
17501
  "project-name": projectName,
17152
17502
  "repository-name": projectName
17153
17503
  });
17154
- return `https://vercel.com/new/clone?${p.toString()}`;
17504
+ return `https://vercel.com/new/clone?${p2.toString()}`;
17155
17505
  }
17156
17506
  async function buttonDeploy(a) {
17157
17507
  const url = deployButtonUrl(a.repo, a.projectName);
@@ -17292,7 +17642,7 @@ async function waitForHealthz(url, deadlineMs) {
17292
17642
  }
17293
17643
  return false;
17294
17644
  }
17295
- var setupSub = new Command48("setup").description(
17645
+ var setupSub = new Command49("setup").description(
17296
17646
  "Create the GitHub App the control plane leases push tokens with, and write its deploy config (env + admin token)"
17297
17647
  ).option("--name <name>", "GitHub App name (default: autogenerated agentbox-<rand>, must be globally unique)").option("--org <org>", "create the App under an organization instead of your user account").option("--deploy <target>", "deploy the plane after creating the App: vercel | hetzner | none").option("--repo <owner/name>", "GitHub repo to deploy the plane from (default madarco/agentbox; fork + pass this if you don't own it)").option("--ref <ref>", "git ref of the repo to deploy (branch/tag/sha; default main) \u2014 used by Vercel + Hetzner").action(async (opts) => {
17298
17648
  try {
@@ -17301,7 +17651,7 @@ var setupSub = new Command48("setup").description(
17301
17651
  'Your browser will open to GitHub to create the App. Review the\npermissions (Contents + Pull requests: write) and click "Create".',
17302
17652
  "GitHub App"
17303
17653
  );
17304
- const s = spinner13();
17654
+ const s = spinner14();
17305
17655
  s.start("waiting for the GitHub App to be created in your browser");
17306
17656
  const app = await runGitHubAppManifestFlow({
17307
17657
  appName: String(name),
@@ -17331,7 +17681,7 @@ AGENTBOX_RELAY_ADMIN_TOKEN=${adminToken}
17331
17681
  JSON.stringify({ appId: app.appId, slug: app.slug, htmlUrl: app.htmlUrl, installUrl: app.installUrl }, null, 2) + "\n",
17332
17682
  { mode: 384 }
17333
17683
  );
17334
- log55.success(`GitHub App ready. Deploy config written to ${ENV_PATH2} (0600).`);
17684
+ log56.success(`GitHub App ready. Deploy config written to ${ENV_PATH2} (0600).`);
17335
17685
  const target = await resolveDeployTarget(opts.deploy);
17336
17686
  let deployedUrl = null;
17337
17687
  if (target !== "none") {
@@ -17347,7 +17697,7 @@ AGENTBOX_HUB_ADMIN_PASSWORD=${hubAuth.AGENTBOX_HUB_ADMIN_PASSWORD}
17347
17697
  await chmod2(ENV_PATH2, 384);
17348
17698
  }
17349
17699
  try {
17350
- const ds = spinner13();
17700
+ const ds = spinner14();
17351
17701
  ds.start(`deploying the control plane to ${target}`);
17352
17702
  const onLog = (line) => ds.message(line);
17353
17703
  const repo = opts.repo ?? DEFAULT_DEPLOY_REPO;
@@ -17365,7 +17715,7 @@ AGENTBOX_HUB_ADMIN_PASSWORD=${hubAuth.AGENTBOX_HUB_ADMIN_PASSWORD}
17365
17715
  }
17366
17716
  ds.stop(`deployed: ${deployedUrl}`);
17367
17717
  } catch (e) {
17368
- log55.warn(`deploy to ${target} failed: ${e instanceof Error ? e.message : String(e)}`);
17718
+ log56.warn(`deploy to ${target} failed: ${e instanceof Error ? e.message : String(e)}`);
17369
17719
  printManualDeploy();
17370
17720
  }
17371
17721
  } else {
@@ -17373,13 +17723,13 @@ AGENTBOX_HUB_ADMIN_PASSWORD=${hubAuth.AGENTBOX_HUB_ADMIN_PASSWORD}
17373
17723
  }
17374
17724
  if (deployedUrl) {
17375
17725
  const url = await applyControlPlaneUrl(deployedUrl);
17376
- log55.success(`Pointed the CLI at ${url} (relay.controlPlaneUrl).`);
17726
+ log56.success(`Pointed the CLI at ${url} (relay.controlPlaneUrl).`);
17377
17727
  const ok = await waitForHealthz(url, 6e4);
17378
- log55[ok ? "success" : "warn"](
17728
+ log56[ok ? "success" : "warn"](
17379
17729
  ok ? `Control plane is healthy (${url}/healthz).` : `Could not confirm ${url}/healthz yet \u2014 check the deployment.`
17380
17730
  );
17381
17731
  }
17382
- log55.info(`Install the App on your repos: ${app.installUrl}`);
17732
+ log56.info(`Install the App on your repos: ${app.installUrl}`);
17383
17733
  openInBrowser(app.installUrl);
17384
17734
  } catch (err) {
17385
17735
  handleLifecycleError(err);
@@ -17388,7 +17738,7 @@ AGENTBOX_HUB_ADMIN_PASSWORD=${hubAuth.AGENTBOX_HUB_ADMIN_PASSWORD}
17388
17738
  async function resolveDeployTarget(flag) {
17389
17739
  if (flag === "vercel" || flag === "hetzner" || flag === "none") return flag;
17390
17740
  if (flag) {
17391
- log55.warn(`unknown --deploy "${flag}"; choose interactively`);
17741
+ log56.warn(`unknown --deploy "${flag}"; choose interactively`);
17392
17742
  }
17393
17743
  const choice = await select3({
17394
17744
  message: "Deploy the control plane now?",
@@ -17403,7 +17753,7 @@ async function resolveDeployTarget(flag) {
17403
17753
  return choice;
17404
17754
  }
17405
17755
  function printManualDeploy() {
17406
- log55.info(
17756
+ log56.info(
17407
17757
  [
17408
17758
  "Deploy later with the written env:",
17409
17759
  ` Self-host: cd apps/hub && docker compose --env-file ${ENV_PATH2} up --build`,
@@ -17412,45 +17762,45 @@ function printManualDeploy() {
17412
17762
  ].join("\n")
17413
17763
  );
17414
17764
  }
17415
- var setUrlSub = new Command48("set-url").description("Point boxes + the CLI at a deployed control plane (sets relay.controlPlaneUrl)").argument("<url>", "base URL of the deployed control plane, e.g. https://plane.example.com").action(async (url) => {
17765
+ var setUrlSub = new Command49("set-url").description("Point boxes + the CLI at a deployed control plane (sets relay.controlPlaneUrl)").argument("<url>", "base URL of the deployed control plane, e.g. https://plane.example.com").action(async (url) => {
17416
17766
  try {
17417
17767
  const trimmed = await applyControlPlaneUrl(url);
17418
- log55.success(`Set relay.controlPlaneUrl = ${trimmed}`);
17768
+ log56.success(`Set relay.controlPlaneUrl = ${trimmed}`);
17419
17769
  } catch (err) {
17420
17770
  handleLifecycleError(err);
17421
17771
  }
17422
17772
  });
17423
- var unsetUrlSub = new Command48("unset-url").description("Stop using a control plane on this machine (removes relay.controlPlaneUrl)").option("--purge", "also delete this machine's local App metadata + admin token (~/.agentbox/control-plane)").action(async (opts) => {
17773
+ var unsetUrlSub = new Command49("unset-url").description("Stop using a control plane on this machine (removes relay.controlPlaneUrl)").option("--purge", "also delete this machine's local App metadata + admin token (~/.agentbox/control-plane)").action(async (opts) => {
17424
17774
  try {
17425
17775
  const g = await unsetConfigValue("global", "relay.controlPlaneUrl", process.cwd());
17426
- const p = await unsetConfigValue("project", "relay.controlPlaneUrl", process.cwd());
17427
- if (!g.existed && !p.existed) {
17428
- log55.info("No control plane was configured (relay.controlPlaneUrl not set).");
17776
+ const p2 = await unsetConfigValue("project", "relay.controlPlaneUrl", process.cwd());
17777
+ if (!g.existed && !p2.existed) {
17778
+ log56.info("No control plane was configured (relay.controlPlaneUrl not set).");
17429
17779
  } else {
17430
- const where = [g.existed ? "global" : null, p.existed ? "project" : null].filter(Boolean).join(" + ");
17431
- log55.success(
17780
+ const where = [g.existed ? "global" : null, p2.existed ? "project" : null].filter(Boolean).join(" + ");
17781
+ log56.success(
17432
17782
  `Removed relay.controlPlaneUrl (${where}). New cloud boxes now push through the host relay (your laptop must be on), and the GitHub-App repo-authorization prompt no longer fires.`
17433
17783
  );
17434
17784
  }
17435
17785
  if (existsSync21(CP_DIR2)) {
17436
17786
  if (opts.purge) {
17437
17787
  await rm(CP_DIR2, { recursive: true, force: true });
17438
- log55.success(`Purged this machine's control-plane credentials (${CP_DIR2}).`);
17788
+ log56.success(`Purged this machine's control-plane credentials (${CP_DIR2}).`);
17439
17789
  } else {
17440
- log55.info(`This machine's App metadata + admin token remain in ${CP_DIR2} (use --purge to delete).`);
17790
+ log56.info(`This machine's App metadata + admin token remain in ${CP_DIR2} (use --purge to delete).`);
17441
17791
  }
17442
17792
  }
17443
17793
  } catch (err) {
17444
17794
  handleLifecycleError(err);
17445
17795
  }
17446
17796
  });
17447
- var statusSub4 = new Command48("status").description("Check whether the configured control plane is reachable").option("--url <url>", "override the control-plane URL (default: relay.controlPlaneUrl)").option("--json", "emit JSON").action(async (opts) => {
17797
+ var statusSub4 = new Command49("status").description("Check whether the configured control plane is reachable").option("--url <url>", "override the control-plane URL (default: relay.controlPlaneUrl)").option("--json", "emit JSON").action(async (opts) => {
17448
17798
  try {
17449
- const { loadEffectiveConfig: loadEffectiveConfig2 } = await import("./dist-SBDYDH7H.js");
17799
+ const { loadEffectiveConfig: loadEffectiveConfig2 } = await import("./dist-U2SVLJUQ.js");
17450
17800
  const cfg = await loadEffectiveConfig2(process.cwd());
17451
17801
  const url = (opts.url ?? cfg.effective.relay.controlPlaneUrl ?? "").replace(/\/$/, "");
17452
17802
  if (!url) {
17453
- log55.error("No control plane configured. Run `agentbox control-plane set-url <url>` (or pass --url).");
17803
+ log56.error("No control plane configured. Run `agentbox control-plane set-url <url>` (or pass --url).");
17454
17804
  process.exitCode = 1;
17455
17805
  return;
17456
17806
  }
@@ -17475,36 +17825,36 @@ var statusSub4 = new Command48("status").description("Check whether the configur
17475
17825
  handleLifecycleError(err);
17476
17826
  }
17477
17827
  });
17478
- var addSub = new Command48("add").description("Authorize the current project's git repo on the control plane's GitHub App").action(async () => {
17828
+ var addSub = new Command49("add").description("Authorize the current project's git repo on the control plane's GitHub App").action(async () => {
17479
17829
  try {
17480
17830
  const cfg = await loadEffectiveConfig(process.cwd());
17481
17831
  const controlPlaneUrl = cfg.effective.relay.controlPlaneUrl;
17482
17832
  if (!controlPlaneUrl) {
17483
- log55.error("No control plane configured. Run `agentbox control-plane set-url <url>` first.");
17833
+ log56.error("No control plane configured. Run `agentbox control-plane set-url <url>` first.");
17484
17834
  process.exitCode = 1;
17485
17835
  return;
17486
17836
  }
17487
17837
  const ownerRepo = await resolveOwnerRepo(process.cwd());
17488
17838
  if (!ownerRepo) {
17489
- log55.error("No git origin found here \u2014 `cd` into a project with a GitHub remote.");
17839
+ log56.error("No git origin found here \u2014 `cd` into a project with a GitHub remote.");
17490
17840
  process.exitCode = 1;
17491
17841
  return;
17492
17842
  }
17493
17843
  const { owner, repo } = ownerRepo;
17494
17844
  const installed = await checkRepoInstalled(owner, repo, controlPlaneUrl);
17495
17845
  if (installed === true) {
17496
- log55.success(`${owner}/${repo} is already authorized on the GitHub App.`);
17846
+ log56.success(`${owner}/${repo} is already authorized on the GitHub App.`);
17497
17847
  return;
17498
17848
  }
17499
17849
  const url = addRepoUrl(loadControlPlaneMeta());
17500
17850
  if (!url) {
17501
- log55.error(
17851
+ log56.error(
17502
17852
  "No GitHub App metadata found locally. Run this from a machine that ran `control-plane setup`,\nor open your App settings on GitHub and add the repo manually."
17503
17853
  );
17504
17854
  process.exitCode = 1;
17505
17855
  return;
17506
17856
  }
17507
- log55.info(`Opening ${url} \u2014 select ${owner}/${repo}, then approve.`);
17857
+ log56.info(`Opening ${url} \u2014 select ${owner}/${repo}, then approve.`);
17508
17858
  openInBrowser(url);
17509
17859
  } catch (err) {
17510
17860
  handleLifecycleError(err);
@@ -17530,14 +17880,14 @@ function runGit(args) {
17530
17880
  );
17531
17881
  });
17532
17882
  }
17533
- var workerSub = new Command48("worker").description(
17883
+ var workerSub = new Command49("worker").description(
17534
17884
  "Drain the control plane box-creation queue and provision real boxes (long-running; needs provider creds + the App key)"
17535
17885
  ).requiredOption("--store <url>", "Postgres URL of the control plane (same store the plane uses)").option("--once", "drain the queue once and exit (default: loop)").option("--poll-interval <ms>", "poll interval when looping", "5000").action(async (opts) => {
17536
17886
  try {
17537
17887
  loadControlPlaneEnv();
17538
17888
  const appCfg = loadGitHubAppConfig();
17539
17889
  if (!appCfg) {
17540
- log55.error("No GitHub App configured. Run `agentbox control-plane setup` first.");
17890
+ log56.error("No GitHub App configured. Run `agentbox control-plane setup` first.");
17541
17891
  process.exitCode = 1;
17542
17892
  return;
17543
17893
  }
@@ -17558,8 +17908,8 @@ var workerSub = new Command48("worker").description(
17558
17908
  await runGit(["-C", dest, "remote", "set-url", "origin", repoUrl]);
17559
17909
  },
17560
17910
  createBox: async ({ workspacePath, name, provider, onLog }) => {
17561
- const p = await providerForCreate({ flag: provider, config: cfg.effective });
17562
- const created = await p.create({ workspacePath, name, projectRoot: workspacePath, onLog });
17911
+ const p2 = await providerForCreate({ flag: provider, config: cfg.effective });
17912
+ const created = await p2.create({ workspacePath, name, projectRoot: workspacePath, onLog });
17563
17913
  return { id: created.record.id };
17564
17914
  },
17565
17915
  tmpDir: (jobId) => join33(tmpdir7(), `agentbox-cp-worker-${jobId}`),
@@ -17589,10 +17939,10 @@ var workerSub = new Command48("worker").description(
17589
17939
  handleLifecycleError(err);
17590
17940
  }
17591
17941
  });
17592
- var controlPlaneCommand = new Command48("control-plane").description("EXPERIMENTAL - Set up + manage the hosted control plane (GitHub App, deploy config, reachability)").addCommand(statusSub4, { isDefault: true }).addCommand(setupSub).addCommand(setUrlSub).addCommand(unsetUrlSub).addCommand(addSub).addCommand(workerSub);
17942
+ var controlPlaneCommand = new Command49("control-plane").description("EXPERIMENTAL - Set up + manage the hosted control plane (GitHub App, deploy config, reachability)").addCommand(statusSub4, { isDefault: true }).addCommand(setupSub).addCommand(setUrlSub).addCommand(unsetUrlSub).addCommand(addSub).addCommand(workerSub);
17593
17943
 
17594
17944
  // src/commands/_run-queued-job.ts
17595
- import { Command as Command49 } from "commander";
17945
+ import { Command as Command50 } from "commander";
17596
17946
  import { stat as stat8 } from "fs/promises";
17597
17947
  import { join as join34 } from "path";
17598
17948
 
@@ -17656,14 +18006,14 @@ async function needsClaudeLogin(image, isCloud) {
17656
18006
  return !await hostBackupHasCredentials();
17657
18007
  }
17658
18008
  async function ensureClaudeLoginFresh(args) {
17659
- const { id, log: log67, image, isCloud } = args;
18009
+ const { id, log: log69, image, isCloud } = args;
17660
18010
  if (!await needsClaudeLogin(image, isCloud)) return;
17661
- log67.write("claude login is expired or missing \u2014 starting browser re-login");
18011
+ log69.write("claude login is expired or missing \u2014 starting browser re-login");
17662
18012
  await patchJobLogin(id, { required: true, phase: "starting" });
17663
- await ensureImage(image, { onProgress: (line) => log67.write(line) });
18013
+ await ensureImage(image, { onProgress: (line) => log69.write(line) });
17664
18014
  let chain = Promise.resolve();
17665
18015
  const enqueue = (patch) => {
17666
- chain = chain.then(() => patchJobLogin(id, patch)).catch((err) => log67.write(`login manifest write failed: ${err instanceof Error ? err.message : String(err)}`));
18016
+ chain = chain.then(() => patchJobLogin(id, patch)).catch((err) => log69.write(`login manifest write failed: ${err instanceof Error ? err.message : String(err)}`));
17667
18017
  };
17668
18018
  let pendingCode = null;
17669
18019
  const codeWatcher = setInterval(() => {
@@ -17679,8 +18029,8 @@ async function ensureClaudeLoginFresh(args) {
17679
18029
  const result = await runClaudeLogin({
17680
18030
  image,
17681
18031
  signal: abort.signal,
17682
- writeRaw: (chunk) => log67.raw(chunk),
17683
- writeLog: (line) => log67.write(line),
18032
+ writeRaw: (chunk) => log69.raw(chunk),
18033
+ writeLog: (line) => log69.write(line),
17684
18034
  onPhase: (phase, u) => {
17685
18035
  const patch = { phase };
17686
18036
  if (u?.url) patch.url = u.url;
@@ -17696,30 +18046,30 @@ async function ensureClaudeLoginFresh(args) {
17696
18046
  });
17697
18047
  await chain;
17698
18048
  if (!result.ok) throw new Error(result.error ?? "claude login failed");
17699
- log67.write("claude login refreshed");
18049
+ log69.write("claude login refreshed");
17700
18050
  } finally {
17701
18051
  clearInterval(codeWatcher);
17702
18052
  for (const sig of ["SIGTERM", "SIGINT"]) process.removeListener(sig, onSignal);
17703
18053
  }
17704
18054
  }
17705
- var runQueuedJobCommand = new Command49("_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) => {
17706
- const log67 = openCommandLog(`queue-${id}`);
17707
- log67.write(`worker pid=${String(process.pid)} starting for job ${id}`);
18055
+ var runQueuedJobCommand = new Command50("_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) => {
18056
+ const log69 = openCommandLog(`queue-${id}`);
18057
+ log69.write(`worker pid=${String(process.pid)} starting for job ${id}`);
17708
18058
  let job = null;
17709
18059
  try {
17710
18060
  job = await readJob(id);
17711
18061
  if (!job) {
17712
- log67.write(`FATAL: no manifest at id=${id}`);
17713
- log67.close();
18062
+ log69.write(`FATAL: no manifest at id=${id}`);
18063
+ log69.close();
17714
18064
  process.exit(64);
17715
18065
  }
17716
18066
  const onBoxCreated = (boxId) => {
17717
18067
  if (job) job = { ...job, boxId };
17718
18068
  };
17719
18069
  if ((job.providerName || "docker") === "docker") {
17720
- await runDockerJob(job, log67, onBoxCreated);
18070
+ await runDockerJob(job, log69, onBoxCreated);
17721
18071
  } else {
17722
- await runCloudJob(job, log67, onBoxCreated);
18072
+ await runCloudJob(job, log69, onBoxCreated);
17723
18073
  }
17724
18074
  const persisted = await readJob(id);
17725
18075
  const done = {
@@ -17730,12 +18080,12 @@ var runQueuedJobCommand = new Command49("_run-queued-job").description("internal
17730
18080
  login: persisted?.login
17731
18081
  };
17732
18082
  await writeJob(done);
17733
- log67.write(`done`);
17734
- log67.close();
18083
+ log69.write(`done`);
18084
+ log69.close();
17735
18085
  process.exit(0);
17736
18086
  } catch (err) {
17737
18087
  const msg = err instanceof Error ? err.stack ?? err.message : String(err);
17738
- log67.write(`FAIL: ${msg}`);
18088
+ log69.write(`FAIL: ${msg}`);
17739
18089
  if (job) {
17740
18090
  try {
17741
18091
  const persisted = await readJob(id);
@@ -17751,31 +18101,33 @@ var runQueuedJobCommand = new Command49("_run-queued-job").description("internal
17751
18101
  } catch {
17752
18102
  }
17753
18103
  }
17754
- log67.close();
18104
+ log69.close();
17755
18105
  process.exit(1);
17756
18106
  }
17757
18107
  });
17758
- async function runDockerJob(job, log67, onBoxCreated) {
18108
+ async function runDockerJob(job, log69, onBoxCreated) {
17759
18109
  const opts = job.createOpts;
17760
18110
  const cfg = await loadEffectiveConfig(opts.workspace, {
17761
18111
  cliOverrides: buildOverridesFromJob(job)
17762
18112
  });
17763
18113
  const projectRoot = (await findProjectRoot(opts.workspace)).root;
17764
- const providerName = job.providerName || cfg.effective.box.provider || "docker";
18114
+ const { name: providerName } = parseProviderSpec(
18115
+ job.providerName || cfg.effective.box.provider || "docker"
18116
+ );
17765
18117
  const providerDefault = resolveDefaultCheckpoint(cfg.effective, providerName);
17766
18118
  const checkpointRef = opts.snapshot && opts.snapshot.length > 0 ? opts.snapshot : providerDefault.length > 0 ? providerDefault : void 0;
17767
18119
  const useSnapshot = opts.hostSnapshot === false ? false : opts.hostSnapshot === true ? true : cfg.effective.box.hostSnapshot ?? false;
17768
18120
  const resolved = !job.noAgent && job.agent === "claude-code" ? await resolveClaudeAuth(process.env) : null;
17769
18121
  const withPlaywright = cfg.effective.box.withPlaywright || cfg.effective.browser.default !== "agent-browser";
17770
18122
  if (!job.noAgent && job.agent === "claude-code") {
17771
- await ensureClaudeLoginFresh({ id: job.id, log: log67, image: cfg.effective.box.image, isCloud: false });
18123
+ await ensureClaudeLoginFresh({ id: job.id, log: log69, image: cfg.effective.box.image, isCloud: false });
17772
18124
  }
17773
18125
  const portlessEnabled = opts.portless ?? await resolvePortlessNonInteractive({
17774
18126
  engine: await detectEngine(),
17775
18127
  enabled: cfg.effective.portless.enabled,
17776
18128
  cwd: opts.workspace
17777
18129
  });
17778
- log67.write(`creating box for agent=${job.noAgent ? "none" : job.agent}`);
18130
+ log69.write(`creating box for agent=${job.noAgent ? "none" : job.agent}`);
17779
18131
  const result = await createBox({
17780
18132
  workspacePath: opts.workspace,
17781
18133
  name: opts.name && opts.name.length > 0 ? opts.name : void 0,
@@ -17800,30 +18152,30 @@ async function runDockerJob(job, log67, onBoxCreated) {
17800
18152
  // at box-create time (the worker runs on the host, so it can read the files).
17801
18153
  carry: opts.carry,
17802
18154
  projectRoot,
17803
- onLog: (line) => log67.write(line)
18155
+ onLog: (line) => log69.write(line)
17804
18156
  });
17805
- log67.write(`box created: ${result.record.container}`);
18157
+ log69.write(`box created: ${result.record.container}`);
17806
18158
  onBoxCreated(result.record.id);
17807
18159
  if (!job.noAgent) await recordLastAgent(result.record.id, toSyncKind(job.agent)).catch(() => {
17808
18160
  });
17809
18161
  const persisted = await readJob(job.id);
17810
18162
  await writeJob({ ...job, boxId: result.record.id, login: persisted?.login });
17811
18163
  if (job.noAgent) {
17812
- log67.write("no-agent box created; skipping agent session");
18164
+ log69.write("no-agent box created; skipping agent session");
17813
18165
  return;
17814
18166
  }
17815
18167
  const resyncWarning = result.resync ? buildResyncWarning(result.resync) : null;
17816
- if (resyncWarning) log67.write(resyncWarning);
18168
+ if (resyncWarning) log69.write(resyncWarning);
17817
18169
  const seeded = await applySetupWizardPrompt(job, opts.workspace, job.prompt);
17818
18170
  const prompt = prependResyncWarning(resyncWarning, seeded);
17819
18171
  const promptedArgs = buildPromptArgs(job.agent, prompt, job.agentArgs);
17820
18172
  if (job.agent === "claude-code") {
17821
- log67.write(`checking plugin native deps`);
18173
+ log69.write(`checking plugin native deps`);
17822
18174
  await rebuildPluginNativeDeps(result.record.container, {
17823
18175
  volume: result.record.claudeConfigVolume ?? SHARED_CLAUDE_VOLUME,
17824
- onProgress: (line) => log67.write(line)
18176
+ onProgress: (line) => log69.write(line)
17825
18177
  });
17826
- log67.write(`starting claude session`);
18178
+ log69.write(`starting claude session`);
17827
18179
  await startClaudeSession({
17828
18180
  container: result.record.container,
17829
18181
  claudeArgs: applyClaudeSkipPermissions(promptedArgs, cfg.effective),
@@ -17831,22 +18183,22 @@ async function runDockerJob(job, log67, onBoxCreated) {
17831
18183
  boxName: result.record.name
17832
18184
  });
17833
18185
  } else if (job.agent === "codex") {
17834
- log67.write(`checking codex`);
18186
+ log69.write(`checking codex`);
17835
18187
  await ensureCodexInstalled(result.record.container, {
17836
- onProgress: (line) => log67.write(line)
18188
+ onProgress: (line) => log69.write(line)
17837
18189
  });
17838
- log67.write(`starting codex session`);
18190
+ log69.write(`starting codex session`);
17839
18191
  await startCodexSession({
17840
18192
  container: result.record.container,
17841
18193
  codexArgs: applyCodexSkipPermissions(promptedArgs, cfg.effective),
17842
18194
  sessionName: cfg.effective.codex.sessionName
17843
18195
  });
17844
18196
  } else if (job.agent === "opencode") {
17845
- log67.write(`checking opencode`);
18197
+ log69.write(`checking opencode`);
17846
18198
  await ensureOpencodeInstalled(result.record.container, {
17847
- onProgress: (line) => log67.write(line)
18199
+ onProgress: (line) => log69.write(line)
17848
18200
  });
17849
- log67.write(`starting opencode session`);
18201
+ log69.write(`starting opencode session`);
17850
18202
  await startOpencodeSession({
17851
18203
  container: result.record.container,
17852
18204
  opencodeArgs: promptedArgs,
@@ -17855,14 +18207,14 @@ async function runDockerJob(job, log67, onBoxCreated) {
17855
18207
  } else {
17856
18208
  throw new Error(`unknown agent kind: ${String(job.agent)}`);
17857
18209
  }
17858
- await maybeOpenQueuedTerminal(job, result.record.name, log67);
18210
+ await maybeOpenQueuedTerminal(job, result.record.name, log69);
17859
18211
  }
17860
- async function maybeOpenQueuedTerminal(job, boxName, log67) {
18212
+ async function maybeOpenQueuedTerminal(job, boxName, log69) {
17861
18213
  const ctx = job.openTerminal;
17862
18214
  if (!ctx) return;
17863
18215
  const cliEntry = process.env["AGENTBOX_CLI_ENTRY"];
17864
18216
  if (!cliEntry) {
17865
- log67.write("queue.openIn: AGENTBOX_CLI_ENTRY unset; cannot open terminal");
18217
+ log69.write("queue.openIn: AGENTBOX_CLI_ENTRY unset; cannot open terminal");
17866
18218
  return;
17867
18219
  }
17868
18220
  const argv2 = [
@@ -17876,28 +18228,29 @@ async function maybeOpenQueuedTerminal(job, boxName, log67) {
17876
18228
  ];
17877
18229
  try {
17878
18230
  const r = await spawnQueuedOpenTerminal(ctx, argv2, boxName);
17879
- log67.write(
18231
+ log69.write(
17880
18232
  r.launched ? `queue.openIn: ${r.note}` : `queue.openIn: open failed: ${r.error ?? ""}`
17881
18233
  );
17882
18234
  } catch (err) {
17883
- log67.write(`queue.openIn: open threw: ${err instanceof Error ? err.message : String(err)}`);
18235
+ log69.write(`queue.openIn: open threw: ${err instanceof Error ? err.message : String(err)}`);
17884
18236
  }
17885
18237
  }
17886
- async function runCloudJob(job, log67, onBoxCreated) {
18238
+ async function runCloudJob(job, log69, onBoxCreated) {
17887
18239
  const opts = job.createOpts;
17888
18240
  const cfg = await loadEffectiveConfig(opts.workspace, {
17889
18241
  cliOverrides: buildOverridesFromJob(job)
17890
18242
  });
17891
18243
  const projectRoot = (await findProjectRoot(opts.workspace)).root;
17892
- const providerName = job.providerName || cfg.effective.box.provider || "docker";
17893
- const provider = await providerForCreate({ flag: providerName, config: cfg.effective });
18244
+ const providerSpec = job.providerName || cfg.effective.box.provider || "docker";
18245
+ const { name: providerName, remoteHost } = parseProviderSpec(providerSpec);
18246
+ const provider = await providerForCreate({ flag: providerSpec, config: cfg.effective });
17894
18247
  const providerDefault = resolveDefaultCheckpoint(cfg.effective, providerName);
17895
18248
  const checkpointRef = opts.snapshot && opts.snapshot.length > 0 ? opts.snapshot : providerDefault.length > 0 ? providerDefault : void 0;
17896
18249
  const withPlaywright = cfg.effective.box.withPlaywright || cfg.effective.browser.default !== "agent-browser";
17897
18250
  if (!job.noAgent && job.agent === "claude-code") {
17898
- await ensureClaudeLoginFresh({ id: job.id, log: log67, image: DEFAULT_BOX_IMAGE, isCloud: true });
18251
+ await ensureClaudeLoginFresh({ id: job.id, log: log69, image: DEFAULT_BOX_IMAGE, isCloud: true });
17899
18252
  }
17900
- log67.write(`creating cloud box (${providerName}) for agent=${job.noAgent ? "none" : job.agent}`);
18253
+ log69.write(`creating cloud box (${providerName}) for agent=${job.noAgent ? "none" : job.agent}`);
17901
18254
  const result = await provider.create({
17902
18255
  workspacePath: opts.workspace,
17903
18256
  name: opts.name && opts.name.length > 0 ? opts.name : void 0,
@@ -17914,12 +18267,12 @@ async function runCloudJob(job, log67, onBoxCreated) {
17914
18267
  // worker runs on the host too, so it reads the files and uploads them.
17915
18268
  carry: opts.carry,
17916
18269
  projectRoot,
17917
- onLog: (line) => log67.write(line),
18270
+ onLog: (line) => log69.write(line),
17918
18271
  // Same size / location / session-lifetime resolution the foreground
17919
18272
  // `agentbox create` does, so a queued box isn't sized differently.
17920
- providerOptions: cloudSizingProviderOptions(providerName, cfg.effective)
18273
+ providerOptions: cloudSizingProviderOptions(providerName, cfg.effective, { remoteHost })
17921
18274
  });
17922
- log67.write(`box created: ${result.record.id}`);
18275
+ log69.write(`box created: ${result.record.id}`);
17923
18276
  onBoxCreated(result.record.id);
17924
18277
  if (!job.noAgent) await recordLastAgent(result.record.id, toSyncKind(job.agent)).catch(() => {
17925
18278
  });
@@ -17929,10 +18282,10 @@ async function runCloudJob(job, log67, onBoxCreated) {
17929
18282
  result.record,
17930
18283
  provider,
17931
18284
  cfg.effective.ssh.autoConfig,
17932
- (m) => log67.write(m)
18285
+ (m) => log69.write(m)
17933
18286
  );
17934
18287
  if (job.noAgent) {
17935
- log67.write("no-agent box created; skipping agent session");
18288
+ log69.write("no-agent box created; skipping agent session");
17936
18289
  return;
17937
18290
  }
17938
18291
  const seeded = await applySetupWizardPrompt(job, opts.workspace, job.prompt);
@@ -17955,14 +18308,14 @@ async function runCloudJob(job, log67, onBoxCreated) {
17955
18308
  } else {
17956
18309
  throw new Error(`unknown agent kind: ${String(job.agent)}`);
17957
18310
  }
17958
- log67.write(`starting detached ${job.agent} session`);
18311
+ log69.write(`starting detached ${job.agent} session`);
17959
18312
  await cloudAgentStartDetached({
17960
18313
  box: result.record,
17961
18314
  binary,
17962
18315
  sessionName,
17963
18316
  extraArgs
17964
18317
  });
17965
- await maybeOpenQueuedTerminal(job, result.record.name, log67);
18318
+ await maybeOpenQueuedTerminal(job, result.record.name, log69);
17966
18319
  }
17967
18320
  function buildOverridesFromJob(job) {
17968
18321
  const opts = job.createOpts;
@@ -17992,19 +18345,19 @@ function buildOverridesFromJob(job) {
17992
18345
  }
17993
18346
 
17994
18347
  // src/commands/_run-queued-prepare.ts
17995
- import { Command as Command50 } from "commander";
17996
- var runQueuedPrepareCommand = new Command50("_run-queued-prepare").description("internal: run a queued provider image-bake job (do not invoke directly)").argument("<id>", "queue job id (from ~/.agentbox/queue/<id>.json)").action(async (id) => {
17997
- const log67 = openCommandLog(`queue-${id}`);
17998
- log67.write(`prepare worker pid=${String(process.pid)} starting for job ${id}`);
18348
+ import { Command as Command51 } from "commander";
18349
+ var runQueuedPrepareCommand = new Command51("_run-queued-prepare").description("internal: run a queued provider image-bake job (do not invoke directly)").argument("<id>", "queue job id (from ~/.agentbox/queue/<id>.json)").action(async (id) => {
18350
+ const log69 = openCommandLog(`queue-${id}`);
18351
+ log69.write(`prepare worker pid=${String(process.pid)} starting for job ${id}`);
17999
18352
  let job = null;
18000
18353
  try {
18001
18354
  job = await readJob(id);
18002
18355
  if (!job) {
18003
- log67.write(`FATAL: no manifest at id=${id}`);
18004
- log67.close();
18356
+ log69.write(`FATAL: no manifest at id=${id}`);
18357
+ log69.close();
18005
18358
  process.exit(64);
18006
18359
  }
18007
- await runPrepareJob(job, log67);
18360
+ await runPrepareJob(job, log69);
18008
18361
  const done = {
18009
18362
  ...job,
18010
18363
  status: "done",
@@ -18012,12 +18365,12 @@ var runQueuedPrepareCommand = new Command50("_run-queued-prepare").description("
18012
18365
  exitCode: 0
18013
18366
  };
18014
18367
  await writeJob(done);
18015
- log67.write("done");
18016
- log67.close();
18368
+ log69.write("done");
18369
+ log69.close();
18017
18370
  process.exit(0);
18018
18371
  } catch (err) {
18019
18372
  const msg = err instanceof Error ? err.stack ?? err.message : String(err);
18020
- log67.write(`FAIL: ${msg}`);
18373
+ log69.write(`FAIL: ${msg}`);
18021
18374
  if (job) {
18022
18375
  try {
18023
18376
  const failed = {
@@ -18031,11 +18384,11 @@ var runQueuedPrepareCommand = new Command50("_run-queued-prepare").description("
18031
18384
  } catch {
18032
18385
  }
18033
18386
  }
18034
- log67.close();
18387
+ log69.close();
18035
18388
  process.exit(1);
18036
18389
  }
18037
18390
  });
18038
- async function runPrepareJob(job, log67) {
18391
+ async function runPrepareJob(job, log69) {
18039
18392
  const providerName = job.providerName;
18040
18393
  if (!isKnownProvider(providerName)) {
18041
18394
  throw new Error(`unknown provider '${providerName}'`);
@@ -18048,24 +18401,24 @@ async function runPrepareJob(job, log67) {
18048
18401
  if (typeof provider.prepare !== "function") {
18049
18402
  throw new Error(`provider '${providerName}' does not implement prepare`);
18050
18403
  }
18051
- log67.write(`baking ${providerName} (force=${String(job.prepare?.force ?? false)})`);
18404
+ log69.write(`baking ${providerName} (force=${String(job.prepare?.force ?? false)})`);
18052
18405
  const result = await provider.prepare({
18053
18406
  hostWorkspace: cwd,
18054
18407
  force: job.prepare?.force,
18055
18408
  registry,
18056
18409
  claudeInstall,
18057
- onLog: (line) => log67.write(line)
18410
+ onLog: (line) => log69.write(line)
18058
18411
  });
18059
- log67.write(
18412
+ log69.write(
18060
18413
  result.snapshotName !== void 0 ? `prepared ${providerName}: ${result.snapshotName}` : `prepared ${providerName}`
18061
18414
  );
18062
18415
  if (result.snapshotName !== void 0 && isProviderKind(providerName)) {
18063
18416
  const key = boxImageConfigKey(providerName);
18064
18417
  try {
18065
18418
  await setConfigValue("global", key, result.snapshotName, cwd);
18066
- log67.write(`pinned ${key}=${result.snapshotName} (global)`);
18419
+ log69.write(`pinned ${key}=${result.snapshotName} (global)`);
18067
18420
  } catch (err) {
18068
- log67.write(
18421
+ log69.write(
18069
18422
  `warning: baked ${result.snapshotName} but failed to pin ${key}: ${err instanceof Error ? err.message : String(err)}`
18070
18423
  );
18071
18424
  }
@@ -18073,10 +18426,10 @@ async function runPrepareJob(job, log67) {
18073
18426
  }
18074
18427
 
18075
18428
  // src/commands/_claude-login-worker.ts
18076
- import { Command as Command51 } from "commander";
18077
- var claudeLoginWorkerCommand = new Command51("_claude-login-worker").description("internal: drive `claude auth login` under a pty for headless login (do not invoke directly)").argument("<id>", "login session id (~/.agentbox/claude-login/<id>/)").action(async (id) => {
18078
- const log67 = openCommandLog(`claude-login-${id}`);
18079
- log67.write(`worker pid=${String(process.pid)} starting for session ${id}`);
18429
+ import { Command as Command52 } from "commander";
18430
+ var claudeLoginWorkerCommand = new Command52("_claude-login-worker").description("internal: drive `claude auth login` under a pty for headless login (do not invoke directly)").argument("<id>", "login session id (~/.agentbox/claude-login/<id>/)").action(async (id) => {
18431
+ const log69 = openCommandLog(`claude-login-${id}`);
18432
+ log69.write(`worker pid=${String(process.pid)} starting for session ${id}`);
18080
18433
  const base = { pid: process.pid, createdAt: (/* @__PURE__ */ new Date()).toISOString() };
18081
18434
  let cur = { ...base, phase: "starting" };
18082
18435
  const setState = (patch) => {
@@ -18086,15 +18439,15 @@ var claudeLoginWorkerCommand = new Command51("_claude-login-worker").description
18086
18439
  setState({ phase: "starting" });
18087
18440
  const req = readLoginRequest(id);
18088
18441
  if (!req) {
18089
- log67.write(`FATAL: no request.json for session ${id}`);
18442
+ log69.write(`FATAL: no request.json for session ${id}`);
18090
18443
  setState({ phase: "error", error: "internal: missing login request" });
18091
- log67.close();
18444
+ log69.close();
18092
18445
  process.exit(64);
18093
18446
  }
18094
18447
  const abort = new AbortController();
18095
18448
  for (const sig of ["SIGTERM", "SIGINT"]) {
18096
18449
  process.on(sig, () => {
18097
- log67.write(`received ${sig}; aborting`);
18450
+ log69.write(`received ${sig}; aborting`);
18098
18451
  abort.abort();
18099
18452
  });
18100
18453
  }
@@ -18103,18 +18456,18 @@ var claudeLoginWorkerCommand = new Command51("_claude-login-worker").description
18103
18456
  // No method flags → the subscription paste-code flow (prints a URL, reads a
18104
18457
  // code). Respect an explicit method the user forwarded (e.g. --console).
18105
18458
  extraArgs: req.extraArgs,
18106
- writeRaw: (chunk) => log67.raw(chunk),
18107
- writeLog: (line) => log67.write(line),
18459
+ writeRaw: (chunk) => log69.raw(chunk),
18460
+ writeLog: (line) => log69.write(line),
18108
18461
  onPhase: (phase, update) => setState({ phase, ...update }),
18109
18462
  getCode: () => takeLoginCode(id),
18110
18463
  signal: abort.signal
18111
18464
  });
18112
- log67.close();
18465
+ log69.close();
18113
18466
  process.exit(result.ok ? 0 : 1);
18114
18467
  });
18115
18468
 
18116
18469
  // src/commands/_post-update-refresh.ts
18117
- import { Command as Command52 } from "commander";
18470
+ import { Command as Command53 } from "commander";
18118
18471
 
18119
18472
  // src/lib/post-update-refresh.ts
18120
18473
  async function maybeUpdateTray(say) {
@@ -18194,7 +18547,7 @@ async function runPostUpdateRefresh(opts = {}) {
18194
18547
  }
18195
18548
 
18196
18549
  // src/commands/_post-update-refresh.ts
18197
- var postUpdateRefreshCommand = new Command52("_post-update-refresh").description("internal: refresh skills, box image, relay, and tray after a package update").option("--skip-skills", "skip refreshing the host skill files").action(async (opts) => {
18550
+ var postUpdateRefreshCommand = new Command53("_post-update-refresh").description("internal: refresh skills, box image, relay, and tray after a package update").option("--skip-skills", "skip refreshing the host skill files").action(async (opts) => {
18198
18551
  try {
18199
18552
  await runPostUpdateRefresh({ skipSkills: opts.skipSkills });
18200
18553
  } catch (err) {
@@ -18318,7 +18671,7 @@ function nudgeMessage(state, method, version = AGENTBOX_VERSION) {
18318
18671
 
18319
18672
  // src/commands/herdr.ts
18320
18673
  import { spawnSync as spawnSync6 } from "child_process";
18321
- import { Command as Command53 } from "commander";
18674
+ import { Command as Command54 } from "commander";
18322
18675
  function parseHerdrLink(uri) {
18323
18676
  if (!uri) return null;
18324
18677
  const m = uri.match(/^agentbox:\/\/([^/]+)\/(.+)$/);
@@ -18344,7 +18697,7 @@ function herdrContextCwd(env = process.env) {
18344
18697
  }
18345
18698
  return process.cwd();
18346
18699
  }
18347
- var newCommand = new Command53("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) => {
18700
+ var newCommand = new Command54("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) => {
18348
18701
  const agent = opts.agent ?? "claude";
18349
18702
  const cwd = herdrContextCwd();
18350
18703
  const r = await spawnInNewTerminal({
@@ -18357,7 +18710,7 @@ var newCommand = new Command53("new").description("Open a new box session in a f
18357
18710
  if (r.launched) process.stdout.write(r.note + "\n");
18358
18711
  else if (r.error) process.stderr.write(r.error + "\n");
18359
18712
  });
18360
- var linkCommand = new Command53("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) => {
18713
+ var linkCommand = new Command54("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) => {
18361
18714
  const link = parseHerdrLink(uriArg ?? process.env["HERDR_PLUGIN_CLICKED_URL"]);
18362
18715
  if (!link) return;
18363
18716
  if (link.verb !== "web") return;
@@ -18390,14 +18743,14 @@ var linkCommand = new Command53("link").description("Handle a Ctrl+click on an a
18390
18743
  sound: "request"
18391
18744
  });
18392
18745
  });
18393
- var herdrCommand = new Command53("herdr").description("Internal: Herdr plugin entry points (see `agentbox install herdr`)").addCommand(newCommand).addCommand(linkCommand);
18746
+ var herdrCommand = new Command54("herdr").description("Internal: Herdr plugin entry points (see `agentbox install herdr`)").addCommand(newCommand).addCommand(linkCommand);
18394
18747
 
18395
18748
  // src/commands/recover.ts
18396
18749
  import { homedir as homedir27 } from "os";
18397
18750
  import { join as join35 } from "path";
18398
18751
  import { access as access3 } from "fs/promises";
18399
- import { isCancel as isCancel9, log as log57, select as select4 } from "@clack/prompts";
18400
- import { Command as Command54 } from "commander";
18752
+ import { isCancel as isCancel9, log as log58, select as select4 } from "@clack/prompts";
18753
+ import { Command as Command55 } from "commander";
18401
18754
  function hetznerKeyPath(sandboxId) {
18402
18755
  return join35(homedir27(), ".agentbox", "boxes", sandboxId, "ssh", "id_ed25519");
18403
18756
  }
@@ -18429,7 +18782,7 @@ async function readBoxBranch(box) {
18429
18782
  }
18430
18783
  async function recoverKnownBox(box, opts) {
18431
18784
  if (await hetznerKeyMissing(box)) {
18432
- log57.warn(
18785
+ log58.warn(
18433
18786
  `${box.name}: per-box SSH key not found at ${hetznerKeyPath(box.cloud?.sandboxId ?? box.id)} \u2014 this box was created on another host and can't be controlled from here. Skipping.`
18434
18787
  );
18435
18788
  return false;
@@ -18438,19 +18791,19 @@ async function recoverKnownBox(box, opts) {
18438
18791
  const record = await withFirewallRepair(
18439
18792
  provider,
18440
18793
  box,
18441
- { enabled: opts.firewallSync, onLog: (line) => log57.success(line) },
18794
+ { enabled: opts.firewallSync, onLog: (line) => log58.success(line) },
18442
18795
  () => provider.reconnect(box)
18443
18796
  );
18444
- log57.success(`reconnected ${record.name}`);
18797
+ log58.success(`reconnected ${record.name}`);
18445
18798
  const lastAgent = normalizeLastAgent(record.lastAgent);
18446
18799
  await restoreAgentSessions(record, provider, {
18447
18800
  restoreOnly: lastAgent,
18448
- onLog: (line) => log57.info(line)
18801
+ onLog: (line) => log58.info(line)
18449
18802
  });
18450
18803
  if (opts.attach) {
18451
18804
  const result = await attachToRunningAgent(record, {});
18452
18805
  if (result === "none") {
18453
- log57.warn(
18806
+ log58.warn(
18454
18807
  `${record.name} reconnected but no agent session came up${lastAgent ? ` (last agent: ${lastAgent})` : ""}. Start one with: agentbox ${lastAgent ?? "claude"} ${record.name}`
18455
18808
  );
18456
18809
  }
@@ -18460,11 +18813,11 @@ async function recoverKnownBox(box, opts) {
18460
18813
  async function adoptUnknownBox(provider, ref) {
18461
18814
  const backend = await cloudBackendForProvider(provider);
18462
18815
  if (!backend) {
18463
- log57.error(`--adopt is cloud-only; '${provider}' has no remote sandbox list`);
18816
+ log58.error(`--adopt is cloud-only; '${provider}' has no remote sandbox list`);
18464
18817
  process.exit(2);
18465
18818
  }
18466
18819
  if (!backend.list) {
18467
- log57.error(`${provider} backend doesn't expose list(); cannot enumerate sandboxes to adopt`);
18820
+ log58.error(`${provider} backend doesn't expose list(); cannot enumerate sandboxes to adopt`);
18468
18821
  process.exit(2);
18469
18822
  }
18470
18823
  const [remote, state] = await Promise.all([backend.list(), readState()]);
@@ -18477,14 +18830,14 @@ async function adoptUnknownBox(provider, ref) {
18477
18830
  (sb2) => !knownIds.has(sb2.sandboxId) && (sb2.name ?? "").length > 0
18478
18831
  );
18479
18832
  if (candidates.length === 0) {
18480
- log57.info(`no un-tracked ${provider} sandboxes to adopt`);
18833
+ log58.info(`no un-tracked ${provider} sandboxes to adopt`);
18481
18834
  return null;
18482
18835
  }
18483
18836
  let chosen;
18484
18837
  if (ref) {
18485
18838
  chosen = candidates.find((sb2) => sb2.sandboxId === ref || sb2.name === ref);
18486
18839
  if (!chosen) {
18487
- log57.error(`no adoptable ${provider} sandbox matches '${ref}'`);
18840
+ log58.error(`no adoptable ${provider} sandbox matches '${ref}'`);
18488
18841
  process.exit(1);
18489
18842
  }
18490
18843
  } else if (candidates.length === 1) {
@@ -18499,7 +18852,7 @@ async function adoptUnknownBox(provider, ref) {
18499
18852
  }))
18500
18853
  });
18501
18854
  if (isCancel9(picked)) {
18502
- log57.info("cancelled");
18855
+ log58.info("cancelled");
18503
18856
  return null;
18504
18857
  }
18505
18858
  chosen = picked;
@@ -18523,7 +18876,7 @@ async function adoptUnknownBox(provider, ref) {
18523
18876
  }
18524
18877
  };
18525
18878
  if (await hetznerKeyMissing(record)) {
18526
- log57.error(
18879
+ log58.error(
18527
18880
  `cannot adopt ${record.name}: per-box SSH key not found at ${hetznerKeyPath(sb.sandboxId)} \u2014 Hetzner boxes can only be controlled from the host that created them (the private key never leaves that host).`
18528
18881
  );
18529
18882
  process.exit(1);
@@ -18542,13 +18895,13 @@ async function adoptUnknownBox(provider, ref) {
18542
18895
  ];
18543
18896
  }
18544
18897
  await recordBox(record);
18545
- log57.success(`adopted ${record.name} (${provider} sandbox ${sb.sandboxId})`);
18546
- log57.warn(
18898
+ log58.success(`adopted ${record.name} (${provider} sandbox ${sb.sandboxId})`);
18899
+ log58.warn(
18547
18900
  "host-side project linkage (project index, git worktree host paths) could not be reconstructed from the box."
18548
18901
  );
18549
18902
  return record;
18550
18903
  }
18551
- var recoverCommand = new Command54("recover").description(
18904
+ var recoverCommand = new Command55("recover").description(
18552
18905
  "Reconnect to an already-running box without power-cycling it: ensure the relay is up, re-open the host transport (Hetzner SSH tunnel) + portless aliases, re-register with the relay, relaunch the agent it was running, and attach. With --all, recover every box in state. With --provider <p> --adopt [ref], first rebuild local state for a box created elsewhere."
18553
18906
  ).argument(
18554
18907
  "[box]",
@@ -18564,7 +18917,7 @@ var recoverCommand = new Command54("recover").description(
18564
18917
  if (opts.adopt) {
18565
18918
  const provider = opts.provider;
18566
18919
  if (!provider || !isKnownProvider(provider) || provider === "docker") {
18567
- log57.error("--adopt requires --provider <daytona|hetzner|vercel|e2b>");
18920
+ log58.error("--adopt requires --provider <daytona|hetzner|vercel|e2b>");
18568
18921
  process.exit(2);
18569
18922
  }
18570
18923
  const adopted = await adoptUnknownBox(provider, idOrName);
@@ -18578,7 +18931,7 @@ var recoverCommand = new Command54("recover").description(
18578
18931
  if (opts.all) {
18579
18932
  const state = await readState();
18580
18933
  if (state.boxes.length === 0) {
18581
- log57.info("no boxes in local state to recover");
18934
+ log58.info("no boxes in local state to recover");
18582
18935
  return;
18583
18936
  }
18584
18937
  let ok = 0;
@@ -18590,12 +18943,12 @@ var recoverCommand = new Command54("recover").description(
18590
18943
  }))
18591
18944
  ok++;
18592
18945
  } catch (err) {
18593
- log57.warn(
18946
+ log58.warn(
18594
18947
  `${box2.name}: recover failed: ${err instanceof Error ? err.message : String(err)}`
18595
18948
  );
18596
18949
  }
18597
18950
  }
18598
- log57.success(`recovered ${String(ok)}/${String(state.boxes.length)} box(es)`);
18951
+ log58.success(`recovered ${String(ok)}/${String(state.boxes.length)} box(es)`);
18599
18952
  return;
18600
18953
  }
18601
18954
  const box = await resolveBoxOrExit(idOrName);
@@ -18610,8 +18963,8 @@ var recoverCommand = new Command54("recover").description(
18610
18963
 
18611
18964
  // src/commands/screen.ts
18612
18965
  import { spawnSync as spawnSync7 } from "child_process";
18613
- import { log as log58 } from "@clack/prompts";
18614
- import { Command as Command55 } from "commander";
18966
+ import { log as log59 } from "@clack/prompts";
18967
+ import { Command as Command56 } from "commander";
18615
18968
  var SIGNED_URL_TTL_MIN = 1;
18616
18969
  var SIGNED_URL_TTL_MAX = 86400;
18617
18970
  function parseTtlOrExit(raw) {
@@ -18624,7 +18977,7 @@ function parseTtlOrExit(raw) {
18624
18977
  }
18625
18978
  return n;
18626
18979
  }
18627
- var screenCommand = new Command55("screen").description("Open a box's VNC (noVNC) viewer in the browser (auto-unpause/start)").argument(
18980
+ var screenCommand = new Command56("screen").description("Open a box's VNC (noVNC) viewer in the browser (auto-unpause/start)").argument(
18628
18981
  "[box]",
18629
18982
  "box ref: project index, id, id prefix, name, or container (default: the only box in this project)"
18630
18983
  ).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(
@@ -18641,23 +18994,23 @@ var screenCommand = new Command55("screen").description("Open a box's VNC (noVNC
18641
18994
  if (provider === "docker") {
18642
18995
  const insp = await inspectBox(box.id);
18643
18996
  if (insp.state === "paused") {
18644
- log58.info("box is paused; unpausing");
18997
+ log59.info("box is paused; unpausing");
18645
18998
  await unpauseBox(box.id);
18646
18999
  } else if (insp.state === "stopped") {
18647
- log58.info("box is stopped; starting");
19000
+ log59.info("box is stopped; starting");
18648
19001
  await startBox(box.id);
18649
19002
  } else if (insp.state === "missing") {
18650
19003
  throw new Error(`box ${box.name} has no container; was it destroyed?`);
18651
19004
  }
18652
19005
  const br = await ensureBoxBrowserShowingApp(box);
18653
19006
  if (br.up && !br.alreadyRunning) {
18654
- log58.info(
19007
+ log59.info(
18655
19008
  br.target !== "about:blank" ? `opened ${br.target} in the in-box browser (visible in the VNC view)` : "started in-box browser"
18656
19009
  );
18657
19010
  } else if (br.alreadyRunning) {
18658
- log58.info("in-box browser already running; left it untouched");
19011
+ log59.info("in-box browser already running; left it untouched");
18659
19012
  } else {
18660
- log58.warn(`could not start in-box browser: ${br.reason ?? "unknown"}`);
19013
+ log59.warn(`could not start in-box browser: ${br.reason ?? "unknown"}`);
18661
19014
  }
18662
19015
  const engine = await detectEngine();
18663
19016
  const urls = buildVncUrls(box, engine);
@@ -18675,24 +19028,24 @@ var screenCommand = new Command55("screen").description("Open a box's VNC (noVNC
18675
19028
  );
18676
19029
  }
18677
19030
  const ttl = parseTtlOrExit(opts.ttl);
18678
- const p = await providerForBox(box);
18679
- const state = await p.probeState(box);
19031
+ const p2 = await providerForBox(box);
19032
+ const state = await p2.probeState(box);
18680
19033
  if (state === "paused") {
18681
- log58.info("box is paused; resuming");
18682
- await p.resume(box);
19034
+ log59.info("box is paused; resuming");
19035
+ await p2.resume(box);
18683
19036
  } else if (state === "stopped") {
18684
- log58.info("box is stopped; starting");
18685
- await p.start(box);
19037
+ log59.info("box is stopped; starting");
19038
+ await p2.start(box);
18686
19039
  } else if (state === "missing") {
18687
19040
  throw new Error(`cloud sandbox for ${box.name} is missing; was it deleted?`);
18688
19041
  }
18689
- const br = await openWebAppOnVncScreen(box, p);
19042
+ const br = await openWebAppOnVncScreen(box, p2);
18690
19043
  if (br.opened) {
18691
- log58.info(`opened ${br.target ?? ""} in the in-box browser (visible in the VNC view)`);
19044
+ log59.info(`opened ${br.target ?? ""} in the in-box browser (visible in the VNC view)`);
18692
19045
  } else if (br.reason && br.reason !== "no web service") {
18693
- log58.warn(`could not open in-box browser (continuing): ${br.reason}`);
19046
+ log59.warn(`could not open in-box browser (continuing): ${br.reason}`);
18694
19047
  }
18695
- const base = await p.resolveUrl(box, { kind: "vnc", ttl });
19048
+ const base = await p2.resolveUrl(box, { kind: "vnc", ttl });
18696
19049
  url = `${base.replace(/\/$/, "")}/vnc.html?autoconnect=1&password=${encodeURIComponent(box.vncPassword)}`;
18697
19050
  }
18698
19051
  if (opts.print) {
@@ -18712,8 +19065,8 @@ var screenCommand = new Command55("screen").description("Open a box's VNC (noVNC
18712
19065
  });
18713
19066
 
18714
19067
  // src/commands/services.ts
18715
- import { log as log59 } from "@clack/prompts";
18716
- import { Command as Command56 } from "commander";
19068
+ import { log as log60 } from "@clack/prompts";
19069
+ import { Command as Command57 } from "commander";
18717
19070
  async function liveStatus(provider, box) {
18718
19071
  const r = await boxServicesStatusRaw(provider, box).catch(() => null);
18719
19072
  if (!r || r.exitCode !== 0) return null;
@@ -18723,7 +19076,7 @@ async function liveStatus(provider, box) {
18723
19076
  return null;
18724
19077
  }
18725
19078
  }
18726
- var listCommand3 = new Command56("list").description("List the box's services with their live state (running / ready / crashed / \u2026)").argument("[box]", "box ref (default: the only box in this project)").option("--json", "print the raw live status (services, tasks, ports) as JSON").action(async (idOrName, opts) => {
19079
+ var listCommand3 = new Command57("list").description("List the box's services with their live state (running / ready / crashed / \u2026)").argument("[box]", "box ref (default: the only box in this project)").option("--json", "print the raw live status (services, tasks, ports) as JSON").action(async (idOrName, opts) => {
18727
19080
  try {
18728
19081
  const box = await resolveBoxOrExit(idOrName);
18729
19082
  const provider = await providerForBox(box);
@@ -18733,7 +19086,7 @@ var listCommand3 = new Command56("list").description("List the box's services wi
18733
19086
  process.stdout.write(JSON.stringify({ services: [], tasks: [], ports: [] }) + "\n");
18734
19087
  return;
18735
19088
  }
18736
- log59.error("could not reach the box supervisor (is the box running?). Try `agentbox status` for the persisted snapshot.");
19089
+ log60.error("could not reach the box supervisor (is the box running?). Try `agentbox status` for the persisted snapshot.");
18737
19090
  process.exit(1);
18738
19091
  }
18739
19092
  if (opts.json) {
@@ -18749,7 +19102,7 @@ var listCommand3 = new Command56("list").description("List the box's services wi
18749
19102
  handleLifecycleError(err);
18750
19103
  }
18751
19104
  });
18752
- var restartCommand = new Command56("restart").description("Restart one service, or every service when no name is given").argument("[box]", "box ref (default: the only box in this project)").argument("[name]", "service to restart (omit to restart all)").action(async (idOrName, name) => {
19105
+ var restartCommand = new Command57("restart").description("Restart one service, or every service when no name is given").argument("[box]", "box ref (default: the only box in this project)").argument("[name]", "service to restart (omit to restart all)").action(async (idOrName, name) => {
18753
19106
  try {
18754
19107
  const { box, shifted } = await resolveBoxOrShift(idOrName);
18755
19108
  const serviceName = shifted ? idOrName : name;
@@ -18762,7 +19115,7 @@ var restartCommand = new Command56("restart").description("Restart one service,
18762
19115
  }
18763
19116
  const live = await liveStatus(provider, box);
18764
19117
  if (!live) {
18765
- log59.error("could not reach the box supervisor (is the box running?)");
19118
+ log60.error("could not reach the box supervisor (is the box running?)");
18766
19119
  process.exit(1);
18767
19120
  }
18768
19121
  const names = live.services.map((s) => s.name);
@@ -18786,22 +19139,22 @@ var restartCommand = new Command56("restart").description("Restart one service,
18786
19139
  handleLifecycleError(err);
18787
19140
  }
18788
19141
  });
18789
- var servicesCommand = new Command56("services").description("List and restart a box's agentbox.yaml services").addCommand(listCommand3, { isDefault: true }).addCommand(restartCommand);
19142
+ var servicesCommand = new Command57("services").description("List and restart a box's agentbox.yaml services").addCommand(listCommand3, { isDefault: true }).addCommand(restartCommand);
18790
19143
 
18791
19144
  // src/commands/shell.ts
18792
19145
  import { spawnSync as spawnSync8 } from "child_process";
18793
- import { log as log61, spinner as spinner14 } from "@clack/prompts";
18794
- import { Command as Command57 } from "commander";
19146
+ import { log as log62, spinner as spinner15 } from "@clack/prompts";
19147
+ import { Command as Command58 } from "commander";
18795
19148
 
18796
19149
  // src/commands/_provider-guard.ts
18797
- import { log as log60 } from "@clack/prompts";
19150
+ import { log as log61 } from "@clack/prompts";
18798
19151
  function requireDockerProvider(box, commandName) {
18799
19152
  const provider = box.provider ?? "docker";
18800
19153
  if (provider === "docker") return;
18801
- log60.error(
19154
+ log61.error(
18802
19155
  `\`agentbox ${commandName}\` doesn't yet support cloud boxes (this box's provider is '${provider}').`
18803
19156
  );
18804
- log60.info(
19157
+ log61.info(
18805
19158
  "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."
18806
19159
  );
18807
19160
  process.exit(2);
@@ -18843,10 +19196,10 @@ function fmtAgo2(iso) {
18843
19196
  async function ensureBoxRunning(box) {
18844
19197
  const insp = await inspectBox(box.id);
18845
19198
  if (insp.state === "paused") {
18846
- log61.info("box is paused; unpausing");
19199
+ log62.info("box is paused; unpausing");
18847
19200
  await unpauseBox(box.id);
18848
19201
  } else if (insp.state === "stopped") {
18849
- log61.info("box is stopped; starting");
19202
+ log62.info("box is stopped; starting");
18850
19203
  await startBox(box.id);
18851
19204
  } else if (insp.state === "missing") {
18852
19205
  throw new Error(`box ${box.name} has no container; was it destroyed?`);
@@ -18885,7 +19238,7 @@ async function startOrAttachShell(box, cfg) {
18885
19238
  const label = shellLabel(cfg.sessionName);
18886
19239
  const info = await shellSessionInfo(box.container, cfg.sessionName, cfg.user);
18887
19240
  if (info.running) {
18888
- log61.info(`reattaching to shell "${label}" \u2014 Control+a d to detach`);
19241
+ log62.info(`reattaching to shell "${label}" \u2014 Control+a d to detach`);
18889
19242
  } else {
18890
19243
  await startShellSession({
18891
19244
  container: box.container,
@@ -18893,7 +19246,7 @@ async function startOrAttachShell(box, cfg) {
18893
19246
  user: cfg.user,
18894
19247
  login: cfg.login
18895
19248
  });
18896
- log61.info(`shell "${label}" \u2014 Control+a d to detach, leaves it running`);
19249
+ log62.info(`shell "${label}" \u2014 Control+a d to detach, leaves it running`);
18897
19250
  }
18898
19251
  const code = await runWrappedAttach({
18899
19252
  container: box.container,
@@ -18917,7 +19270,7 @@ async function runSshConfig(box, opts) {
18917
19270
  );
18918
19271
  }
18919
19272
  if (await hasUnmanagedHostConflict(conn.alias)) {
18920
- log61.warn(
19273
+ log62.warn(
18921
19274
  `~/.ssh/config already has a non-agentbox \`Host ${conn.alias}\` entry. agentbox's Include is prepended, so SSH applies agentbox's HostName/IdentityFile first and your entry is ignored \u2014 rename the box (or remove your entry) if you meant yours to win.`
18922
19275
  );
18923
19276
  }
@@ -18962,7 +19315,7 @@ async function runSshConfig(box, opts) {
18962
19315
  ];
18963
19316
  process.stdout.write(lines.join("\n") + "\n");
18964
19317
  }
18965
- var shellCommand = new Command57("shell").description(
19318
+ var shellCommand = new Command58("shell").description(
18966
19319
  "Open an interactive shell in a box, in a detachable tmux session (auto-unpause/start)"
18967
19320
  ).argument(
18968
19321
  "[box]",
@@ -18995,7 +19348,7 @@ var shellCommand = new Command57("shell").description(
18995
19348
  throw new Error(`cloud sandbox for ${box.name} is missing; was it destroyed?`);
18996
19349
  }
18997
19350
  if (state !== "running") {
18998
- const s = spinner14();
19351
+ const s = spinner15();
18999
19352
  s.start(state === "paused" ? "resuming box" : "starting box");
19000
19353
  box = await provider.start(box);
19001
19354
  s.stop("box running");
@@ -19075,7 +19428,7 @@ var shellCommand = new Command57("shell").description(
19075
19428
  handleLifecycleError(err);
19076
19429
  }
19077
19430
  });
19078
- var shellAttachCommand = new Command57("attach").description(
19431
+ var shellAttachCommand = new Command58("attach").description(
19079
19432
  "Attach to a shell tmux session in a box, starting one if none is running (auto-unpause/start)"
19080
19433
  ).argument(
19081
19434
  "[box]",
@@ -19113,7 +19466,7 @@ function renderShellTable(sessions) {
19113
19466
  for (const r of rows) process.stdout.write(`${fmt(r)}
19114
19467
  `);
19115
19468
  }
19116
- var shellLsCommand = new Command57("ls").description("List the shell tmux sessions running in a box").argument(
19469
+ var shellLsCommand = new Command58("ls").description("List the shell tmux sessions running in a box").argument(
19117
19470
  "[box]",
19118
19471
  "box ref: project index, id, id prefix, name, or container (default: the only box in this project)"
19119
19472
  ).action(async (idOrName) => {
@@ -19122,11 +19475,11 @@ var shellLsCommand = new Command57("ls").description("List the shell tmux sessio
19122
19475
  requireDockerProvider(box, "shell");
19123
19476
  const insp = await inspectBox(box.id);
19124
19477
  if (insp.state !== "running") {
19125
- log61.info(`box ${box.name} is ${insp.state} \u2014 no live shell sessions`);
19478
+ log62.info(`box ${box.name} is ${insp.state} \u2014 no live shell sessions`);
19126
19479
  return;
19127
19480
  }
19128
19481
  if (insp.shellSessions.length === 0) {
19129
- log61.info(
19482
+ log62.info(
19130
19483
  `no shell sessions in ${box.name} \u2014 start one with: agentbox shell ${reattachRef2(box)}`
19131
19484
  );
19132
19485
  return;
@@ -19136,7 +19489,7 @@ var shellLsCommand = new Command57("ls").description("List the shell tmux sessio
19136
19489
  handleLifecycleError(err);
19137
19490
  }
19138
19491
  });
19139
- var shellKillCommand = new Command57("kill").description("Kill a shell tmux session in a box (the shell and anything running in it)").argument(
19492
+ var shellKillCommand = new Command58("kill").description("Kill a shell tmux session in a box (the shell and anything running in it)").argument(
19140
19493
  "[box]",
19141
19494
  "box ref: project index, id, id prefix, name, or container (default: the only box in this project)"
19142
19495
  ).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) {
@@ -19146,25 +19499,25 @@ var shellKillCommand = new Command57("kill").description("Kill a shell tmux sess
19146
19499
  requireDockerProvider(box, "shell");
19147
19500
  const insp = await inspectBox(box.id);
19148
19501
  if (insp.state !== "running") {
19149
- log61.info(`box ${box.name} is ${insp.state} \u2014 no shell sessions to kill`);
19502
+ log62.info(`box ${box.name} is ${insp.state} \u2014 no shell sessions to kill`);
19150
19503
  return;
19151
19504
  }
19152
19505
  if (opts.all) {
19153
19506
  if (insp.shellSessions.length === 0) {
19154
- log61.info(`no shell sessions in ${box.name}`);
19507
+ log62.info(`no shell sessions in ${box.name}`);
19155
19508
  return;
19156
19509
  }
19157
19510
  let killed = 0;
19158
19511
  for (const s of insp.shellSessions) {
19159
19512
  if (await killShellSession(box.container, s.sessionName)) killed++;
19160
19513
  }
19161
- log61.success(`killed ${String(killed)} shell session${killed === 1 ? "" : "s"} in ${box.name}`);
19514
+ log62.success(`killed ${String(killed)} shell session${killed === 1 ? "" : "s"} in ${box.name}`);
19162
19515
  return;
19163
19516
  }
19164
19517
  const target = shellSessionName(opts.name);
19165
19518
  const ok = await killShellSession(box.container, target);
19166
- if (ok) log61.success(`killed shell "${shellLabel(target)}" in ${box.name}`);
19167
- else log61.warn(`no shell "${shellLabel(target)}" in ${box.name} (already gone?)`);
19519
+ if (ok) log62.success(`killed shell "${shellLabel(target)}" in ${box.name}`);
19520
+ else log62.warn(`no shell "${shellLabel(target)}" in ${box.name} (already gone?)`);
19168
19521
  } catch (err) {
19169
19522
  handleLifecycleError(err);
19170
19523
  }
@@ -19174,8 +19527,8 @@ shellCommand.addCommand(shellLsCommand);
19174
19527
  shellCommand.addCommand(shellKillCommand);
19175
19528
 
19176
19529
  // src/commands/start.ts
19177
- import { Command as Command58 } from "commander";
19178
- var startCommand = new Command58("start").description(
19530
+ import { Command as Command59 } from "commander";
19531
+ var startCommand = new Command59("start").description(
19179
19532
  "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)."
19180
19533
  ).argument(
19181
19534
  "[box]",
@@ -19215,8 +19568,8 @@ var startCommand = new Command58("start").description(
19215
19568
  });
19216
19569
 
19217
19570
  // src/commands/status.ts
19218
- import { log as log63 } from "@clack/prompts";
19219
- import { Command as Command59 } from "commander";
19571
+ import { log as log64 } from "@clack/prompts";
19572
+ import { Command as Command60 } from "commander";
19220
19573
 
19221
19574
  // src/endpoints-render.ts
19222
19575
  function renderEndpointLines(endpoints, stream) {
@@ -19289,9 +19642,9 @@ function renderPersistedSections(s) {
19289
19642
  if (s.ports.length === 0) {
19290
19643
  out.push(" (none listening)");
19291
19644
  } else {
19292
- const other = s.ports.filter((p) => !p.service).map((p) => p.port).sort((a, b) => a - b);
19645
+ const other = s.ports.filter((p2) => !p2.service).map((p2) => p2.port).sort((a, b) => a - b);
19293
19646
  out.push(
19294
- ...s.ports.filter((p) => p.service).map((p) => ` :${String(p.port)} (${p.service})`)
19647
+ ...s.ports.filter((p2) => p2.service).map((p2) => ` :${String(p2.port)} (${p2.service})`)
19295
19648
  );
19296
19649
  if (other.length > 0) out.push(` other (${other.length}): ${other.join(", ")}`);
19297
19650
  }
@@ -19299,7 +19652,7 @@ function renderPersistedSections(s) {
19299
19652
  }
19300
19653
 
19301
19654
  // src/commands/inspect.ts
19302
- import { log as log62 } from "@clack/prompts";
19655
+ import { log as log63 } from "@clack/prompts";
19303
19656
  function fmtLimit(n, unit) {
19304
19657
  return n && n > 0 ? `${String(n)}${unit}` : "unlimited";
19305
19658
  }
@@ -19458,7 +19811,7 @@ function renderCodexActivityCloud(persisted) {
19458
19811
  async function runInspect(box, opts) {
19459
19812
  try {
19460
19813
  if (opts.json && opts.watch) {
19461
- log62.error("cannot combine --json with --watch");
19814
+ log63.error("cannot combine --json with --watch");
19462
19815
  process.exit(2);
19463
19816
  }
19464
19817
  const isCloud = (box.provider ?? "docker") !== "docker";
@@ -19496,7 +19849,7 @@ async function runInspect(box, opts) {
19496
19849
  // src/commands/status.ts
19497
19850
  var MAX_DISPLAY_NAME = 60;
19498
19851
  var statusCommand2 = withWatchOptions(
19499
- new Command59("status").description("Show service + task status from a box's agentbox-ctl daemon").argument(
19852
+ new Command60("status").description("Show service + task status from a box's agentbox-ctl daemon").argument(
19500
19853
  "[box]",
19501
19854
  "box ref: project index, id, id prefix, name, or container (default: the only box in this project)"
19502
19855
  ).option("-j, --json", "machine-readable JSON output").option("--inspect", "show detailed box info (volumes, limits, paths) plus service/task status").option(
@@ -19506,17 +19859,17 @@ var statusCommand2 = withWatchOptions(
19506
19859
  ).action(async (idOrName, opts) => {
19507
19860
  try {
19508
19861
  if (opts.json && opts.watch) {
19509
- log63.error("cannot combine --json with --watch");
19862
+ log64.error("cannot combine --json with --watch");
19510
19863
  process.exit(2);
19511
19864
  }
19512
19865
  if (opts.setName !== void 0 && opts.clearName) {
19513
- log63.error("cannot combine --set-name with --clear-name");
19866
+ log64.error("cannot combine --set-name with --clear-name");
19514
19867
  process.exit(2);
19515
19868
  }
19516
19869
  const box = await resolveBoxOrExit(idOrName);
19517
19870
  if (opts.setName !== void 0 || opts.clearName) {
19518
19871
  if (opts.json || opts.watch) {
19519
- log63.error("cannot combine --set-name/--clear-name with --json or --watch");
19872
+ log64.error("cannot combine --set-name/--clear-name with --json or --watch");
19520
19873
  process.exit(2);
19521
19874
  }
19522
19875
  const before = boxLabel(box);
@@ -19526,11 +19879,11 @@ var statusCommand2 = withWatchOptions(
19526
19879
  } else {
19527
19880
  next = [...opts.setName].filter((c) => c >= " " && c.charCodeAt(0) !== 127).join("").trim();
19528
19881
  if (!next) {
19529
- log63.error("--set-name requires a non-empty name (use --clear-name to reset)");
19882
+ log64.error("--set-name requires a non-empty name (use --clear-name to reset)");
19530
19883
  process.exit(2);
19531
19884
  }
19532
19885
  if (next.length > MAX_DISPLAY_NAME) {
19533
- log63.error(`name too long (max ${String(MAX_DISPLAY_NAME)} chars)`);
19886
+ log64.error(`name too long (max ${String(MAX_DISPLAY_NAME)} chars)`);
19534
19887
  process.exit(2);
19535
19888
  }
19536
19889
  }
@@ -19664,8 +20017,8 @@ function renderPersisted2(s, state) {
19664
20017
  }
19665
20018
 
19666
20019
  // src/commands/stop.ts
19667
- import { Command as Command60 } from "commander";
19668
- var stopCommand = new Command60("stop").description(
20020
+ import { Command as Command61 } from "commander";
20021
+ var stopCommand = new Command61("stop").description(
19669
20022
  "Stop a box (Docker: docker stop; preserves upper + node_modules volumes. Cloud: backend.stop \u2014 sandbox stays in your account, disk preserved)."
19670
20023
  ).argument(
19671
20024
  "[box]",
@@ -19694,7 +20047,7 @@ restart with: agentbox start ${box.name}
19694
20047
  });
19695
20048
 
19696
20049
  // src/commands/top.ts
19697
- import { Command as Command61 } from "commander";
20050
+ import { Command as Command62 } from "commander";
19698
20051
  var COLS = ["BOX", "STATE", "CPU%", "MEM USAGE / LIMIT", "MEM%", "PIDS", "DISK", "NET I/O"];
19699
20052
  function row(name, state, s) {
19700
20053
  const mem = `${fmtBytes2(s.memUsedBytes)} / ${fmtBytes2(s.memLimitBytes)}`;
@@ -19768,7 +20121,7 @@ async function renderProjectFooters() {
19768
20121
 
19769
20122
  SYSTEM: ${parts.join(" - ")}` : "";
19770
20123
  }
19771
- var topCommand = new Command61("top").description("Live resource monitor (cpu/mem/pids/disk) for a box, the project, or every box").argument(
20124
+ var topCommand = new Command62("top").description("Live resource monitor (cpu/mem/pids/disk) for a box, the project, or every box").argument(
19772
20125
  "[box]",
19773
20126
  "box ref (default: every box on the host; --project narrows to the cwd's project)"
19774
20127
  ).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) => {
@@ -19801,8 +20154,8 @@ var topCommand = new Command61("top").description("Live resource monitor (cpu/me
19801
20154
  });
19802
20155
 
19803
20156
  // src/commands/unpause.ts
19804
- import { Command as Command62 } from "commander";
19805
- var unpauseCommand = new Command62("unpause").description(
20157
+ import { Command as Command63 } from "commander";
20158
+ var unpauseCommand = new Command63("unpause").description(
19806
20159
  "Resume a paused box. Docker: `docker unpause` (sub-second). Cloud: backend.resume (re-hydrates from archive \u2014 slower first time)."
19807
20160
  ).argument(
19808
20161
  "[box]",
@@ -19839,7 +20192,7 @@ var unpauseCommand = new Command62("unpause").description(
19839
20192
 
19840
20193
  // src/commands/update.ts
19841
20194
  import { spawn as spawn11 } from "child_process";
19842
- import { Command as Command63 } from "commander";
20195
+ import { Command as Command64 } from "commander";
19843
20196
  var PKG2 = "@madarco/agentbox";
19844
20197
  function selfUpdateCommand(method) {
19845
20198
  if (method === "npm") return { cmd: "npm", args: ["install", "-g", `${PKG2}@latest`] };
@@ -19880,7 +20233,7 @@ async function reportLatest() {
19880
20233
  } catch {
19881
20234
  }
19882
20235
  }
19883
- var updateCommand = new Command63("self-update").description(
20236
+ var updateCommand = new Command64("self-update").description(
19884
20237
  "Update agentbox: self-update via npm/pnpm (unless run via npx), refresh the host skills, re-check the box image (rebuilt on the next create only if its build context changed), reload the relay/hub, and update the menu-bar app"
19885
20238
  ).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 + app").option("--skip-skills", "skip refreshing the host skill files in ~/.claude, ~/.codex, ~/.config/opencode").action(async (opts) => {
19886
20239
  try {
@@ -19950,8 +20303,8 @@ var updateCommand = new Command63("self-update").description(
19950
20303
 
19951
20304
  // src/commands/url.ts
19952
20305
  import { spawnSync as spawnSync9 } from "child_process";
19953
- import { log as log65 } from "@clack/prompts";
19954
- import { Command as Command64 } from "commander";
20306
+ import { log as log66 } from "@clack/prompts";
20307
+ import { Command as Command65 } from "commander";
19955
20308
  var SIGNED_URL_TTL_MIN2 = 1;
19956
20309
  var SIGNED_URL_TTL_MAX2 = 86400;
19957
20310
  function parseTtlOrExit2(raw) {
@@ -19964,7 +20317,7 @@ function parseTtlOrExit2(raw) {
19964
20317
  }
19965
20318
  return n;
19966
20319
  }
19967
- var urlCommand = new Command64("url").description(
20320
+ var urlCommand = new Command65("url").description(
19968
20321
  "Open a box's web app URL in the browser, even when no service declares `expose:` (auto-unpause/start)"
19969
20322
  ).argument(
19970
20323
  "[box]",
@@ -19983,10 +20336,10 @@ var urlCommand = new Command64("url").description(
19983
20336
  if (provider === "docker") {
19984
20337
  const insp = await inspectBox(box.id);
19985
20338
  if (insp.state === "paused") {
19986
- log65.info("box is paused; unpausing");
20339
+ log66.info("box is paused; unpausing");
19987
20340
  await unpauseBox(box.id);
19988
20341
  } else if (insp.state === "stopped") {
19989
- log65.info("box is stopped; starting");
20342
+ log66.info("box is stopped; starting");
19990
20343
  await startBox(box.id);
19991
20344
  } else if (insp.state === "missing") {
19992
20345
  throw new Error(`box ${box.name} has no container; was it destroyed?`);
@@ -20012,18 +20365,18 @@ var urlCommand = new Command64("url").description(
20012
20365
  }
20013
20366
  } else {
20014
20367
  const ttl = parseTtlOrExit2(opts.ttl);
20015
- const p = await providerForBox(box);
20016
- const state = await p.probeState(box);
20368
+ const p2 = await providerForBox(box);
20369
+ const state = await p2.probeState(box);
20017
20370
  if (state === "paused") {
20018
- log65.info("box is paused; resuming");
20019
- await p.resume(box);
20371
+ log66.info("box is paused; resuming");
20372
+ await p2.resume(box);
20020
20373
  } else if (state === "stopped") {
20021
- log65.info("box is stopped; starting");
20022
- await p.start(box);
20374
+ log66.info("box is stopped; starting");
20375
+ await p2.start(box);
20023
20376
  } else if (state === "missing") {
20024
20377
  throw new Error(`cloud sandbox for ${box.name} is missing; was it deleted?`);
20025
20378
  }
20026
- url = await p.resolveUrl(box, { kind: "web", ttl });
20379
+ url = await p2.resolveUrl(box, { kind: "web", ttl });
20027
20380
  }
20028
20381
  if (opts.print) {
20029
20382
  process.stdout.write(`${url}
@@ -20042,9 +20395,9 @@ var urlCommand = new Command64("url").description(
20042
20395
  });
20043
20396
 
20044
20397
  // src/commands/wait.ts
20045
- import { log as log66 } from "@clack/prompts";
20046
- import { Command as Command65 } from "commander";
20047
- var waitCommand = new Command65("wait").description("Block until the box reports all autostart units ready").argument(
20398
+ import { log as log67 } from "@clack/prompts";
20399
+ import { Command as Command66 } from "commander";
20400
+ var waitCommand = new Command66("wait").description("Block until the box reports all autostart units ready").argument(
20048
20401
  "[box]",
20049
20402
  "box ref: project index, id, id prefix, name, or container (default: the only box in this project)"
20050
20403
  ).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) => {
@@ -20060,7 +20413,7 @@ var waitCommand = new Command65("wait").description("Block until the box reports
20060
20413
  try {
20061
20414
  parsed = JSON.parse(proc.stdout);
20062
20415
  } catch {
20063
- log66.error(`agentbox-ctl wait-ready failed: ${proc.stderr || proc.stdout}`);
20416
+ log67.error(`agentbox-ctl wait-ready failed: ${proc.stderr || proc.stdout}`);
20064
20417
  process.exit(1);
20065
20418
  }
20066
20419
  if (opts.json) {
@@ -20095,6 +20448,17 @@ function rewriteProviderPrefix(argv2) {
20095
20448
  return [...head, subcmd, "--provider", provider, ...rest];
20096
20449
  }
20097
20450
 
20451
+ // src/lib/config-warnings.ts
20452
+ import { log as log68 } from "@clack/prompts";
20453
+ var seen = /* @__PURE__ */ new Set();
20454
+ function installConfigWarningSink() {
20455
+ setConfigWarningSink((message) => {
20456
+ if (seen.has(message)) return;
20457
+ seen.add(message);
20458
+ log68.warn(message);
20459
+ });
20460
+ }
20461
+
20098
20462
  // src/index.ts
20099
20463
  process.env.DOCKER_CLI_HINTS ??= "false";
20100
20464
  process.env.AGENTBOX_CLI_VERSION = AGENTBOX_VERSION;
@@ -20111,7 +20475,8 @@ process.env.AGENTBOX_CLI_COMMIT = AGENTBOX_COMMIT;
20111
20475
  }
20112
20476
  }
20113
20477
  }
20114
- var program = new Command66();
20478
+ installConfigWarningSink();
20479
+ var program = new Command67();
20115
20480
  program.name("agentbox").description("Launch coding agents in isolated sandboxes").version(AGENTBOX_VERSION);
20116
20481
  program.enablePositionalOptions();
20117
20482
  program.addCommand(createCommand);
@@ -20164,6 +20529,7 @@ program.addCommand(hetznerCommand);
20164
20529
  program.addCommand(vercelCommand);
20165
20530
  program.addCommand(e2bCommand);
20166
20531
  program.addCommand(digitaloceanCommand);
20532
+ program.addCommand(remoteDockerCommand);
20167
20533
  program.addCommand(dockerCommand);
20168
20534
  program.addCommand(updateCommand);
20169
20535
  program.addCommand(installCommand);
@@ -20171,7 +20537,21 @@ program.addCommand(appCommand);
20171
20537
  program.addCommand(pluginCommand);
20172
20538
  program.addCommand(doctorCommand);
20173
20539
  program.configureHelp({ visibleCommands: () => [] });
20174
- program.addHelpText("after", () => "\n" + buildGroupedHelp(program));
20540
+ program.addHelpText("after", () => "\n" + buildCompactHelp(program));
20541
+ program.helpCommand(false);
20542
+ program.addCommand(
20543
+ new Command67("help").description("List every command, grouped; `help <command>` for one command").argument("[command]", "command to show help for").action((name) => {
20544
+ if (name) {
20545
+ const sub = program.commands.find(
20546
+ (c) => c.name() === name || c.aliases().includes(name)
20547
+ );
20548
+ if (!sub) program.error(`unknown command '${name}'`);
20549
+ sub.help();
20550
+ }
20551
+ process.stdout.write(program.helpInformation() + "\n" + buildGroupedHelp(program) + "\n");
20552
+ }),
20553
+ { hidden: true }
20554
+ );
20175
20555
  await applyEngineOverrideAtStartup();
20176
20556
  var argv = rewriteProviderPrefix(process.argv);
20177
20557
  var FIRST_RUN_EXEMPT = /* @__PURE__ */ new Set([