@madarco/agentbox 0.28.1 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (452) hide show
  1. package/CHANGELOG.md +124 -0
  2. package/dist/_cloud-attach-HKRHYCY7.js +30 -0
  3. package/dist/{chunk-JNC7MCWJ.js → chunk-3INUZQTR.js} +10 -10
  4. package/dist/chunk-3INUZQTR.js.map +1 -0
  5. package/dist/{chunk-4PR3KJ5X.js → chunk-6PIGTR4D.js} +20 -20
  6. package/dist/{chunk-NHVGKFVY.js → chunk-7LNXTPEE.js} +340 -22
  7. package/dist/chunk-7LNXTPEE.js.map +1 -0
  8. package/dist/{chunk-WB6S4W7O.js → chunk-7Q6BG5AN.js} +2413 -1012
  9. package/dist/chunk-7Q6BG5AN.js.map +1 -0
  10. package/dist/{chunk-BUMKBUXS.js → chunk-7QU6XENE.js} +3 -3
  11. package/dist/chunk-BWE2I5QG.js +17 -0
  12. package/dist/chunk-BWE2I5QG.js.map +1 -0
  13. package/dist/{chunk-7ABO7OIF.js → chunk-CO2I3CQI.js} +4 -4
  14. package/dist/{chunk-OUF3YTQO.js → chunk-DBXCFLAR.js} +14 -17
  15. package/dist/chunk-DBXCFLAR.js.map +1 -0
  16. package/dist/{chunk-74VIUGY6.js → chunk-DYETLPUT.js} +6 -9
  17. package/dist/chunk-DYETLPUT.js.map +1 -0
  18. package/dist/{chunk-HYXCH4GA.js → chunk-EFVTQ7YB.js} +7 -7
  19. package/dist/{chunk-46NNZMZT.js → chunk-EPFXLXCW.js} +372 -72
  20. package/dist/chunk-EPFXLXCW.js.map +1 -0
  21. package/dist/chunk-GWKGSXDC.js +71 -0
  22. package/dist/chunk-GWKGSXDC.js.map +1 -0
  23. package/dist/{chunk-CKD3PRON.js → chunk-GWYD7YBK.js} +12 -9
  24. package/dist/{chunk-CKD3PRON.js.map → chunk-GWYD7YBK.js.map} +1 -1
  25. package/dist/{chunk-NHTRTST5.js → chunk-HNWZO2XU.js} +38 -15
  26. package/dist/chunk-HNWZO2XU.js.map +1 -0
  27. package/dist/{chunk-EVT2SNF2.js → chunk-HO2ACZES.js} +3 -3
  28. package/dist/{chunk-V5NWSLWD.js → chunk-HP4L45LW.js} +14 -14
  29. package/dist/{chunk-B4DAH2F2.js → chunk-LHOKRCNF.js} +3 -3
  30. package/dist/{chunk-G3H2L3O2.js → chunk-MNDKP4VS.js} +23 -3
  31. package/dist/chunk-MNDKP4VS.js.map +1 -0
  32. package/dist/{chunk-JDSYMTMS.js → chunk-NAT2H7J4.js} +110 -66
  33. package/dist/chunk-NAT2H7J4.js.map +1 -0
  34. package/dist/{chunk-KFLGXE3R.js → chunk-NGERWFSA.js} +133 -22
  35. package/dist/chunk-NGERWFSA.js.map +1 -0
  36. package/dist/{chunk-GFOWBXV7.js → chunk-OKLEPEWZ.js} +460 -253
  37. package/dist/chunk-OKLEPEWZ.js.map +1 -0
  38. package/dist/{chunk-YI4GHC2E.js → chunk-QU5BI2HC.js} +12 -15
  39. package/dist/chunk-QU5BI2HC.js.map +1 -0
  40. package/dist/{chunk-BWM56FKY.js → chunk-RQURMAPA.js} +11 -11
  41. package/dist/{chunk-FPMRFMVK.js → chunk-RZCLRWNY.js} +9 -9
  42. package/dist/{chunk-JQLOGVZK.js → chunk-THUST2QK.js} +85 -21
  43. package/dist/chunk-THUST2QK.js.map +1 -0
  44. package/dist/{chunk-OXKW4GWD.js → chunk-UPVP6YGJ.js} +4 -70
  45. package/dist/chunk-UPVP6YGJ.js.map +1 -0
  46. package/dist/{chunk-7RSE7ESY.js → chunk-VVNXQ4XS.js} +27 -18
  47. package/dist/chunk-VVNXQ4XS.js.map +1 -0
  48. package/dist/{chunk-FGQFVUMH.js → chunk-VY54AX4T.js} +3 -3
  49. package/dist/{chunk-OUWVN2F2.js → chunk-WGNI24H2.js} +16 -13
  50. package/dist/chunk-WGNI24H2.js.map +1 -0
  51. package/dist/{chunk-PSA6GADQ.js → chunk-WHFCJBMO.js} +14 -1
  52. package/dist/chunk-WHFCJBMO.js.map +1 -0
  53. package/dist/{chunk-KJ5TCYNI.js → chunk-WHJYOO5H.js} +7 -6
  54. package/dist/chunk-WHJYOO5H.js.map +1 -0
  55. package/dist/cloud-backends.js +5 -5
  56. package/dist/{cloud-poller-SUNA6ZQC-7M5LJHHE.js → cloud-poller-QJRZXB4W-LJ2BRB3L.js} +2 -2
  57. package/dist/{control-plane-5R7PYRQ6.js → control-plane-UKKYXHIQ.js} +19 -18
  58. package/dist/cp-hub-upload-BM2OLTOS.js +81 -0
  59. package/dist/cp-hub-upload-BM2OLTOS.js.map +1 -0
  60. package/dist/{custody-client-PNCC2HBJ.js → custody-client-NPXJ46TB.js} +5 -4
  61. package/dist/{deploy-hetzner-SSGSXAKA.js → deploy-hetzner-Y3ILCDRF.js} +10 -10
  62. package/dist/{dist-RN6JOAG4.js → dist-5OGQ3CJQ.js} +81 -45
  63. package/dist/{dist-5OR4QTQW.js → dist-7B3VCLZI.js} +9 -9
  64. package/dist/{dist-EPFS5PRI.js → dist-A5ZEIVAW.js} +10 -10
  65. package/dist/{dist-6PYXFREL.js → dist-DOEGENNW.js} +61 -16
  66. package/dist/dist-DOEGENNW.js.map +1 -0
  67. package/dist/{dist-XQLKK7H3.js → dist-EOGD7KD6.js} +54 -28
  68. package/dist/dist-EOGD7KD6.js.map +1 -0
  69. package/dist/{dist-XATN4ZIR.js → dist-FBM2WS5S.js} +22 -4
  70. package/dist/{dist-POILUDVJ.js → dist-MUTFY7FA.js} +9 -9
  71. package/dist/{dist-ZNQZHTUN.js → dist-SMDXLPZO.js} +35 -6
  72. package/dist/{dist-M4O5MU5K.js → dist-VTLQKZ2E.js} +8 -8
  73. package/dist/{dist-SN2TCRZ5.js → dist-ZJIJHCZB.js} +9 -9
  74. package/dist/{dist-K5M4HKG7.js → dist-ZNYS7CVF.js} +21 -9
  75. package/dist/host-reach-drainer-ZJU2STQQ.js +9 -0
  76. package/dist/hub-Q4VOF4WN.js +37 -0
  77. package/dist/{hub-adopt-I44VGSBL.js → hub-adopt-OA336ZXZ.js} +8 -8
  78. package/dist/{hub-api-client-WJPBXZAZ.js → hub-api-client-5U6WOTZ3.js} +2 -2
  79. package/dist/{hub-docker-target-REEEWUG2.js → hub-docker-target-JKFCABK4.js} +16 -16
  80. package/dist/index.js +1321 -882
  81. package/dist/index.js.map +1 -1
  82. package/dist/prepare-GFWWKWGF.js +41 -0
  83. package/dist/prepared-custody-KU4PDVBT.js +36 -0
  84. package/dist/{prepared-state-PV3GUBHO-MF56HWMZ.js → prepared-state-LNQ7DYSU-AR5RMXAO.js} +4 -3
  85. package/dist/{publish-credentials-BPHUO5VL.js → publish-credentials-3SQXX45P.js} +11 -11
  86. package/dist/registry-AFKV3EO2.js +18 -0
  87. package/dist/relay-QH6OEY2V.js +20 -0
  88. package/dist/relay-QH6OEY2V.js.map +1 -0
  89. package/dist/{remote-docker-share-RX5ARK45.js → remote-docker-share-RMS6IB5X.js} +11 -11
  90. package/dist/remote-docker-share-RMS6IB5X.js.map +1 -0
  91. package/dist/tool-grant-push-T6DRBY3W.js +90 -0
  92. package/dist/tool-grant-push-T6DRBY3W.js.map +1 -0
  93. package/package.json +1 -2
  94. package/runtime/_shared/agentbox-tool-shim +21 -0
  95. package/runtime/_shared/ctl.cjs +6757 -5299
  96. package/runtime/_shared/gh-shim +103 -228
  97. package/runtime/digitalocean/agentbox-tool-shim +21 -0
  98. package/runtime/digitalocean/ctl.cjs +6757 -5299
  99. package/runtime/digitalocean/gh-shim +103 -228
  100. package/runtime/digitalocean/scripts/install-box.sh +9 -15
  101. package/runtime/docker/Dockerfile.box +8 -18
  102. package/runtime/docker/packages/ctl/dist/bin.cjs +6757 -5299
  103. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-tool-shim +21 -0
  104. package/runtime/docker/packages/sandbox-docker/scripts/gh-shim +103 -228
  105. package/runtime/e2b/agentbox-tool-shim +21 -0
  106. package/runtime/e2b/ctl.cjs +6757 -5299
  107. package/runtime/e2b/gh-shim +103 -228
  108. package/runtime/e2b/scripts/build-template.sh +5 -9
  109. package/runtime/hetzner/agentbox-tool-shim +21 -0
  110. package/runtime/hetzner/ctl.cjs +6757 -5299
  111. package/runtime/hetzner/gh-shim +103 -228
  112. package/runtime/hetzner/scripts/install-box.sh +9 -15
  113. package/runtime/hub/apps/hub/.next/BUILD_ID +1 -1
  114. package/runtime/hub/apps/hub/.next/app-path-routes-manifest.json +2 -0
  115. package/runtime/hub/apps/hub/.next/build-manifest.json +3 -3
  116. package/runtime/hub/apps/hub/.next/routes-manifest.json +16 -0
  117. package/runtime/hub/apps/hub/.next/server/app/(auth)/api/auth/[...all]/route.js +5 -5
  118. package/runtime/hub/apps/hub/.next/server/app/(auth)/api/auth/[...all]/route.js.nft.json +1 -1
  119. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/[id]/answer/route.js +2 -2
  120. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/[id]/answer/route.js.nft.json +1 -1
  121. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/route.js +2 -2
  122. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/route.js.nft.json +1 -1
  123. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/[action]/route.js +2 -2
  124. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/[action]/route.js.nft.json +1 -1
  125. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/agent/route.js +2 -2
  126. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/agent/route.js.nft.json +1 -1
  127. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/branches/route.js +2 -2
  128. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/branches/route.js.nft.json +1 -1
  129. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/checkpoint/route.js +2 -2
  130. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/checkpoint/route.js.nft.json +1 -1
  131. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/[op]/route.js +2 -2
  132. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/[op]/route.js.nft.json +1 -1
  133. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/route.js +2 -2
  134. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/route.js.nft.json +1 -1
  135. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/logs/route.js +1 -1
  136. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/logs/route.js.nft.json +1 -1
  137. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/open/route.js +2 -2
  138. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/open/route.js.nft.json +1 -1
  139. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/rename/route.js +2 -2
  140. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/rename/route.js.nft.json +1 -1
  141. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/route.js +2 -2
  142. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/route.js.nft.json +1 -1
  143. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/restart/route.js +2 -2
  144. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/restart/route.js.nft.json +1 -1
  145. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/route.js +2 -2
  146. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/route.js.nft.json +1 -1
  147. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/vnc/route/app-paths-manifest.json +3 -0
  148. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/vnc/route/build-manifest.json +9 -0
  149. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/vnc/route/server-reference-manifest.json +4 -0
  150. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/vnc/route.js +8 -0
  151. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/vnc/route.js.map +5 -0
  152. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/vnc/route.js.nft.json +1 -0
  153. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/vnc/route_client-reference-manifest.js +3 -0
  154. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/route.js +2 -2
  155. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/route.js.nft.json +1 -1
  156. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/checkpoints/route.js +2 -2
  157. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/checkpoints/route.js.nft.json +1 -1
  158. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/custody/[...path]/route.js +1 -1
  159. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/custody/[...path]/route.js.nft.json +1 -1
  160. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/custody/blob/[...path]/route.js +2 -2
  161. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/custody/blob/[...path]/route.js.nft.json +1 -1
  162. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/health/route.js +2 -2
  163. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/health/route.js.nft.json +1 -1
  164. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/bake/route.js +2 -2
  165. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/bake/route.js.nft.json +1 -1
  166. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/route.js +2 -2
  167. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/route.js.nft.json +1 -1
  168. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/route.js +2 -2
  169. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/route.js.nft.json +1 -1
  170. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/login-code/route.js +2 -2
  171. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/login-code/route.js.nft.json +1 -1
  172. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/logs/route.js +2 -2
  173. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/logs/route.js.nft.json +1 -1
  174. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/route.js +2 -2
  175. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/route.js.nft.json +1 -1
  176. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/route.js +2 -2
  177. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/route.js.nft.json +1 -1
  178. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/open-targets/route.js +2 -2
  179. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/open-targets/route.js.nft.json +1 -1
  180. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/branches/route.js +2 -2
  181. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/branches/route.js.nft.json +1 -1
  182. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/route.js +2 -2
  183. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/route.js.nft.json +1 -1
  184. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/seed/route.js +2 -2
  185. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/seed/route.js.nft.json +1 -1
  186. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/route.js +2 -2
  187. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/route.js.nft.json +1 -1
  188. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/credentials/route.js +2 -2
  189. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/credentials/route.js.nft.json +1 -1
  190. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/prepare/route.js +2 -2
  191. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/prepare/route.js.nft.json +1 -1
  192. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/route.js +2 -2
  193. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/route.js.nft.json +1 -1
  194. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/prune/route.js +2 -2
  195. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/prune/route.js.nft.json +1 -1
  196. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/system/route.js +2 -2
  197. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/system/route.js.nft.json +1 -1
  198. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page.js +1 -1
  199. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page.js.nft.json +1 -1
  200. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page.js +1 -1
  201. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page.js.nft.json +1 -1
  202. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page_client-reference-manifest.js +1 -1
  203. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/vnc/route/app-paths-manifest.json +3 -0
  204. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/vnc/route/build-manifest.json +9 -0
  205. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/vnc/route/server-reference-manifest.json +4 -0
  206. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/vnc/route.js +8 -0
  207. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/vnc/route.js.map +5 -0
  208. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/vnc/route.js.nft.json +1 -0
  209. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/vnc/route_client-reference-manifest.js +3 -0
  210. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/custody/page.js +1 -1
  211. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/custody/page.js.nft.json +1 -1
  212. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page.js +1 -1
  213. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page.js.nft.json +1 -1
  214. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page.js +1 -1
  215. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page.js.nft.json +1 -1
  216. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page.js +1 -1
  217. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page.js.nft.json +1 -1
  218. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page_client-reference-manifest.js +1 -1
  219. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/system/page.js +1 -1
  220. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/system/page.js.nft.json +1 -1
  221. package/runtime/hub/apps/hub/.next/server/app/[...path]/route.js +4 -4
  222. package/runtime/hub/apps/hub/.next/server/app/[...path]/route.js.nft.json +1 -1
  223. package/runtime/hub/apps/hub/.next/server/app/_global-error.html +1 -1
  224. package/runtime/hub/apps/hub/.next/server/app/_global-error.rsc +1 -1
  225. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  226. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  227. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  228. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  229. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  230. package/runtime/hub/apps/hub/.next/server/app-paths-manifest.json +2 -0
  231. package/runtime/hub/apps/hub/.next/server/chunks/044u_hub__next-internal_server_app_(dashboard)_boxes_[id]_vnc_route_actions_1cy1392.js +3 -0
  232. package/runtime/hub/apps/hub/.next/server/chunks/1jcg_server_app_(dashboard)_api_v1_boxes_[id]_vnc_route_actions_10y_e83.js +3 -0
  233. package/runtime/hub/apps/hub/.next/server/chunks/{[externals]__1nj4awx._.js → [externals]__02a249v._.js} +2 -2
  234. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__00f9v4p._.js +1 -1
  235. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__01nppdu._.js +1 -1
  236. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__02f8rwr._.js +1 -1
  237. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__068_052._.js +1 -1
  238. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__06ma5m4._.js +3 -0
  239. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__07kp2fu._.js +1 -1
  240. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__1yi-2wa._.js → [root-of-the-server]__08u01ud._.js} +3 -3
  241. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__098bkh3._.js +3 -0
  242. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__1hxo1tv._.js → [root-of-the-server]__09hbkgm._.js} +2 -2
  243. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__09tmbom._.js +3 -0
  244. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0_3m9sf._.js +1 -1
  245. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0aotdzg._.js +3 -0
  246. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0bn6-pu._.js +1 -1
  247. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0cpt9f9._.js +1 -1
  248. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0d1lmiq._.js +15 -15
  249. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0dom248._.js +1 -1
  250. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0f0bb7o._.js +1 -1
  251. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0gb04bp._.js +1 -1
  252. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0glplq7._.js +1 -1
  253. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__0xrdbh9._.js → [root-of-the-server]__0gxfyol._.js} +2 -2
  254. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0hsb2ak._.js +1 -1
  255. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0joqm8t._.js +1 -1
  256. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0jp-895._.js +1 -1
  257. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__1leda2s._.js → [root-of-the-server]__0jpqg_t._.js} +2 -2
  258. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__17bhgkz._.js → [root-of-the-server]__0lgnu00._.js} +2 -2
  259. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0lsv9-6._.js +1 -1
  260. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0pzgufc._.js +1 -1
  261. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0qfv7z6._.js +1 -1
  262. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0qlr61y._.js +1 -1
  263. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0s8srqi._.js +1 -1
  264. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0urn9j5._.js +1 -1
  265. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0vb8mk2._.js +4 -0
  266. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__17w5eaa._.js → [root-of-the-server]__0x27ifo._.js} +2 -2
  267. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0y7rvy1._.js +1 -1
  268. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0zsgjre._.js +1 -1
  269. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1-bqa8a._.js +1 -1
  270. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__11uspjg._.js +1 -1
  271. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__0zvr6ul._.js → [root-of-the-server]__15tgdh6._.js} +2 -2
  272. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__1ek7nxv._.js → [root-of-the-server]__16bz_kz._.js} +2 -2
  273. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__1w7jw4q._.js → [root-of-the-server]__18tehjj._.js} +2 -2
  274. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__1ds8g0e._.js → [root-of-the-server]__1_hzv4s._.js} +2 -2
  275. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__0cgpsh8._.js → [root-of-the-server]__1b5f5h4._.js} +2 -2
  276. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__10-aihp._.js → [root-of-the-server]__1dv80yf._.js} +2 -2
  277. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1eanlxn._.js +1 -1
  278. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__16lcb2d._.js → [root-of-the-server]__1fc-nvn._.js} +2 -2
  279. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1h4iahl._.js +1 -1
  280. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__0f-c-eh._.js → [root-of-the-server]__1j0vnh3._.js} +2 -2
  281. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1lgrtx6._.js +1 -1
  282. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__1unqgd7._.js → [root-of-the-server]__1lz7931._.js} +2 -2
  283. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__1oclxlx._.js → [root-of-the-server]__1n3u6-5._.js} +2 -2
  284. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1qky5cd._.js +1 -1
  285. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1r2quye._.js +3 -0
  286. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1rb_nc5._.js +1 -1
  287. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__0cv16py._.js → [root-of-the-server]__1spr8ss._.js} +2 -2
  288. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1t_juqb._.js +1 -1
  289. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__0t8kwy3._.js → [root-of-the-server]__1tct9rj._.js} +3 -3
  290. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__0gfa1jg._.js → [root-of-the-server]__1tjtt06._.js} +2 -2
  291. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__09cigc7._.js → [root-of-the-server]__1whjno0._.js} +2 -2
  292. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1wn4-iv._.js +3 -0
  293. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1x6zxrf._.js +1 -1
  294. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__0tyixgg._.js → [root-of-the-server]__1xfxc6i._.js} +2 -2
  295. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__1m1_gm_._.js → [root-of-the-server]__1xqcvi4._.js} +2 -2
  296. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__207d30i._.js +1 -1
  297. package/runtime/hub/apps/hub/.next/server/chunks/_07icdxf._.js +1 -1
  298. package/runtime/hub/apps/hub/.next/server/chunks/_0907rw0._.js +1 -1
  299. package/runtime/hub/apps/hub/.next/server/chunks/_0adm87k._.js +1 -1
  300. package/runtime/hub/apps/hub/.next/server/chunks/_0g01mkg._.js +1 -1
  301. package/runtime/hub/apps/hub/.next/server/chunks/_0l_klgd._.js +1 -1
  302. package/runtime/hub/apps/hub/.next/server/chunks/_0lfm81x._.js +1 -1
  303. package/runtime/hub/apps/hub/.next/server/chunks/_0tbg83f._.js +1 -1
  304. package/runtime/hub/apps/hub/.next/server/chunks/_0tms_au._.js +1 -1
  305. package/runtime/hub/apps/hub/.next/server/chunks/_0zhli27._.js +1 -1
  306. package/runtime/hub/apps/hub/.next/server/chunks/_10yfoq5._.js +1 -1
  307. package/runtime/hub/apps/hub/.next/server/chunks/_12uhpbp._.js +1 -1
  308. package/runtime/hub/apps/hub/.next/server/chunks/_17a9v8y._.js +2 -2
  309. package/runtime/hub/apps/hub/.next/server/chunks/_1c7x9ee._.js +1 -1
  310. package/runtime/hub/apps/hub/.next/server/chunks/_1n-c443._.js +1 -1
  311. package/runtime/hub/apps/hub/.next/server/chunks/_1y80vfg._.js +1 -1
  312. package/runtime/hub/apps/hub/.next/server/chunks/_214_q-1._.js +1 -1
  313. package/runtime/hub/apps/hub/.next/server/chunks/apps_hub_app_(dashboard)_api_v1_lib_openapi_ts_1yokmzt._.js +1 -1
  314. package/runtime/hub/apps/hub/.next/server/chunks/{packages_relay_dist_0eg7ay1._.js → packages_relay_dist_0p8dnf4._.js} +4 -4
  315. package/runtime/hub/apps/hub/.next/server/chunks/ssr/{[root-of-the-server]__1plrs94._.js → [root-of-the-server]__0-c5j6l._.js} +2 -2
  316. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0r2xlss._.js +1 -1
  317. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_19vy9ni._.js +2 -2
  318. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_app_(dashboard)_boxes_[id]_page_tsx_1-j_972._.js +1 -1
  319. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_app_(dashboard)_settings_page_tsx_0hv6n82._.js +1 -1
  320. package/runtime/hub/apps/hub/.next/server/chunks/ssr/{packages_relay_dist_1z9j3g0._.js → packages_relay_dist_0sap-2l._.js} +4 -4
  321. package/runtime/hub/apps/hub/.next/server/functions-config-manifest.json +3 -1
  322. package/runtime/hub/apps/hub/.next/server/middleware-build-manifest.js +3 -3
  323. package/runtime/hub/apps/hub/.next/server/middleware.js +1 -1
  324. package/runtime/hub/apps/hub/.next/server/pages/500.html +1 -1
  325. package/runtime/hub/apps/hub/.next/static/chunks/{328ny-3zs_h7m.js → 0jefm3re1-2jv.js} +1 -1
  326. package/runtime/hub/apps/hub/.next/static/chunks/{30h8mz040b5-l.js → 3u4odx1_-dy6b.js} +1 -1
  327. package/runtime/hub/apps/hub/app/(dashboard)/api/v1/boxes/[id]/vnc/route.ts +45 -0
  328. package/runtime/hub/apps/hub/app/(dashboard)/api/v1/lib/openapi.ts +45 -1
  329. package/runtime/hub/apps/hub/app/(dashboard)/api/v1/lib/validate.ts +14 -3
  330. package/runtime/hub/apps/hub/app/(dashboard)/boxes/[id]/vnc/route.ts +58 -0
  331. package/runtime/hub/apps/hub/app/(dashboard)/boxes/components/access.tsx +26 -9
  332. package/runtime/hub/apps/hub/app/(dashboard)/settings/components/provider-actions.tsx +34 -26
  333. package/runtime/hub/apps/hub/{auth-JMVHQKWY.js → auth-V7KPRWPS.js} +2 -2
  334. package/runtime/hub/apps/hub/{auth-config-5IFRWOK4.js → auth-config-B3Y3BT2I.js} +2 -2
  335. package/runtime/hub/apps/hub/{chunk-VKOCY6SX.js → chunk-3AD3MYNV.js} +49 -14
  336. package/runtime/hub/apps/hub/{chunk-KTVETF3F.js → chunk-3ZDBZYOY.js} +11 -8
  337. package/runtime/hub/apps/hub/{chunk-LPYK2354.js → chunk-5ABFGGPT.js} +339 -21
  338. package/runtime/hub/apps/hub/{chunk-UMPTTQBE.js → chunk-GBYD2ODL.js} +458 -251
  339. package/runtime/hub/apps/hub/{chunk-5TM7XXLT.js → chunk-H5SUXDZA.js} +2833 -1277
  340. package/runtime/hub/apps/hub/{chunk-QU3FFGJY.js → chunk-UQ5XNPOF.js} +11 -14
  341. package/runtime/hub/apps/hub/{chunk-3LAHFDJF.js → chunk-VWQNSZGI.js} +22 -2
  342. package/runtime/hub/apps/hub/{chunk-EZUK53CC.js → chunk-WHGY7HOC.js} +85 -21
  343. package/runtime/hub/apps/hub/{chunk-D33EV4YZ.js → chunk-ZP4RYI4U.js} +1 -1
  344. package/runtime/hub/apps/hub/{cloud-poller-SUNA6ZQC-VSKVMYHL.js → cloud-poller-QJRZXB4W-G7ECKNKQ.js} +1 -1
  345. package/runtime/hub/apps/hub/{dist-ELZHBQEM.js → dist-37EKQ6RZ.js} +11 -11
  346. package/runtime/hub/apps/hub/{dist-D265LCAN.js → dist-CGH7PEMZ.js} +21 -3
  347. package/runtime/hub/apps/hub/{dist-SYWTB6RD.js → dist-CMVSARW5.js} +15 -18
  348. package/runtime/hub/apps/hub/{dist-5HTJSOHS.js → dist-EGXZRZH2.js} +19 -7
  349. package/runtime/hub/apps/hub/{dist-YK5FFPXZ.js → dist-EOGGFZZS.js} +62 -20
  350. package/runtime/hub/apps/hub/{dist-E2FTSTCY.js → dist-LJBHOO3K.js} +34 -5
  351. package/runtime/hub/apps/hub/{dist-N3E5YAYY.js → dist-R77W6WJ5.js} +53 -26
  352. package/runtime/hub/apps/hub/{dist-JVEDVVVG.js → dist-TH2JZYZY.js} +7 -7
  353. package/runtime/hub/apps/hub/{dist-2YP57GMB.js → dist-XPRGHQH2.js} +13 -13
  354. package/runtime/hub/apps/hub/{dist-NKCXH5DW.js → dist-Z2Y5F7AF.js} +6 -6
  355. package/runtime/hub/apps/hub/docker-compose.yml +1 -0
  356. package/runtime/hub/apps/hub/{hub-token-MDOBY7MZ.js → hub-token-DDJ5Z6RS.js} +2 -2
  357. package/runtime/hub/apps/hub/{hub-worker-UFFLF37F.js → hub-worker-DXVMUQWF.js} +16 -16
  358. package/runtime/hub/apps/hub/lib/boxes/backend-types.ts +11 -0
  359. package/runtime/hub/apps/hub/lib/boxes/types.ts +43 -0
  360. package/runtime/hub/apps/hub/lib/boxes/vnc-link.ts +51 -0
  361. package/runtime/hub/apps/hub/lib/hub-backend.ts +127 -54
  362. package/runtime/hub/apps/hub/lib/hub-worker.ts +4 -4
  363. package/runtime/hub/apps/hub/lib/provider-importers.ts +66 -1
  364. package/runtime/hub/apps/hub/{prepared-state-PV3GUBHO-PPRQDYFR.js → prepared-state-LNQ7DYSU-ABC2EQVI.js} +3 -2
  365. package/runtime/hub/apps/hub/server.js +130 -72
  366. package/runtime/hub/apps/hub/server.ts +18 -0
  367. package/runtime/hub/apps/hub/test/vnc-link.test.ts +61 -0
  368. package/runtime/hub/apps/hub/tsconfig.tsbuildinfo +1 -1
  369. package/runtime/hub-deploy/docker-compose.yml +1 -0
  370. package/runtime/relay/bin.cjs +16623 -14688
  371. package/runtime/vercel/agentbox-tool-shim +21 -0
  372. package/runtime/vercel/ctl.cjs +6757 -5299
  373. package/runtime/vercel/gh-shim +103 -228
  374. package/runtime/vercel/scripts/provision.sh +5 -9
  375. package/share/host-skills/agentbox-info/SKILL.md +24 -14
  376. package/dist/_cloud-attach-Y5HIQ373.js +0 -28
  377. package/dist/chunk-46NNZMZT.js.map +0 -1
  378. package/dist/chunk-74VIUGY6.js.map +0 -1
  379. package/dist/chunk-7RSE7ESY.js.map +0 -1
  380. package/dist/chunk-G3H2L3O2.js.map +0 -1
  381. package/dist/chunk-GFOWBXV7.js.map +0 -1
  382. package/dist/chunk-JDSYMTMS.js.map +0 -1
  383. package/dist/chunk-JNC7MCWJ.js.map +0 -1
  384. package/dist/chunk-JQLOGVZK.js.map +0 -1
  385. package/dist/chunk-KFLGXE3R.js.map +0 -1
  386. package/dist/chunk-KJ5TCYNI.js.map +0 -1
  387. package/dist/chunk-NHTRTST5.js.map +0 -1
  388. package/dist/chunk-NHVGKFVY.js.map +0 -1
  389. package/dist/chunk-OUF3YTQO.js.map +0 -1
  390. package/dist/chunk-OUWVN2F2.js.map +0 -1
  391. package/dist/chunk-OXKW4GWD.js.map +0 -1
  392. package/dist/chunk-PSA6GADQ.js.map +0 -1
  393. package/dist/chunk-WB6S4W7O.js.map +0 -1
  394. package/dist/chunk-YI4GHC2E.js.map +0 -1
  395. package/dist/dist-6PYXFREL.js.map +0 -1
  396. package/dist/dist-XQLKK7H3.js.map +0 -1
  397. package/dist/hub-MJ7O4WXW.js +0 -36
  398. package/dist/prepare-V4U5HVJU.js +0 -40
  399. package/dist/prepared-custody-QIXW7MJM.js +0 -35
  400. package/dist/relay-DRDELF6B.js +0 -20
  401. package/runtime/_shared/linear-shim +0 -181
  402. package/runtime/_shared/ntn-shim +0 -95
  403. package/runtime/digitalocean/linear-shim +0 -181
  404. package/runtime/digitalocean/ntn-shim +0 -95
  405. package/runtime/docker/packages/sandbox-docker/scripts/linear-shim +0 -181
  406. package/runtime/docker/packages/sandbox-docker/scripts/ntn-shim +0 -95
  407. package/runtime/e2b/linear-shim +0 -181
  408. package/runtime/e2b/ntn-shim +0 -95
  409. package/runtime/hetzner/linear-shim +0 -181
  410. package/runtime/hetzner/ntn-shim +0 -95
  411. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__039tc0m._.js +0 -3
  412. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0c_3x8u._.js +0 -3
  413. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0ty7ew1._.js +0 -3
  414. package/runtime/vercel/linear-shim +0 -181
  415. package/runtime/vercel/ntn-shim +0 -95
  416. /package/dist/{_cloud-attach-Y5HIQ373.js.map → _cloud-attach-HKRHYCY7.js.map} +0 -0
  417. /package/dist/{chunk-4PR3KJ5X.js.map → chunk-6PIGTR4D.js.map} +0 -0
  418. /package/dist/{chunk-BUMKBUXS.js.map → chunk-7QU6XENE.js.map} +0 -0
  419. /package/dist/{chunk-7ABO7OIF.js.map → chunk-CO2I3CQI.js.map} +0 -0
  420. /package/dist/{chunk-HYXCH4GA.js.map → chunk-EFVTQ7YB.js.map} +0 -0
  421. /package/dist/{chunk-EVT2SNF2.js.map → chunk-HO2ACZES.js.map} +0 -0
  422. /package/dist/{chunk-V5NWSLWD.js.map → chunk-HP4L45LW.js.map} +0 -0
  423. /package/dist/{chunk-B4DAH2F2.js.map → chunk-LHOKRCNF.js.map} +0 -0
  424. /package/dist/{chunk-BWM56FKY.js.map → chunk-RQURMAPA.js.map} +0 -0
  425. /package/dist/{chunk-FPMRFMVK.js.map → chunk-RZCLRWNY.js.map} +0 -0
  426. /package/dist/{chunk-FGQFVUMH.js.map → chunk-VY54AX4T.js.map} +0 -0
  427. /package/dist/{cloud-poller-SUNA6ZQC-7M5LJHHE.js.map → cloud-poller-QJRZXB4W-LJ2BRB3L.js.map} +0 -0
  428. /package/dist/{control-plane-5R7PYRQ6.js.map → control-plane-UKKYXHIQ.js.map} +0 -0
  429. /package/dist/{custody-client-PNCC2HBJ.js.map → custody-client-NPXJ46TB.js.map} +0 -0
  430. /package/dist/{deploy-hetzner-SSGSXAKA.js.map → deploy-hetzner-Y3ILCDRF.js.map} +0 -0
  431. /package/dist/{dist-5OR4QTQW.js.map → dist-5OGQ3CJQ.js.map} +0 -0
  432. /package/dist/{dist-EPFS5PRI.js.map → dist-7B3VCLZI.js.map} +0 -0
  433. /package/dist/{dist-K5M4HKG7.js.map → dist-A5ZEIVAW.js.map} +0 -0
  434. /package/dist/{dist-M4O5MU5K.js.map → dist-FBM2WS5S.js.map} +0 -0
  435. /package/dist/{dist-POILUDVJ.js.map → dist-MUTFY7FA.js.map} +0 -0
  436. /package/dist/{dist-RN6JOAG4.js.map → dist-SMDXLPZO.js.map} +0 -0
  437. /package/dist/{dist-SN2TCRZ5.js.map → dist-VTLQKZ2E.js.map} +0 -0
  438. /package/dist/{dist-XATN4ZIR.js.map → dist-ZJIJHCZB.js.map} +0 -0
  439. /package/dist/{dist-ZNQZHTUN.js.map → dist-ZNYS7CVF.js.map} +0 -0
  440. /package/dist/{hub-MJ7O4WXW.js.map → host-reach-drainer-ZJU2STQQ.js.map} +0 -0
  441. /package/dist/{hub-adopt-I44VGSBL.js.map → hub-Q4VOF4WN.js.map} +0 -0
  442. /package/dist/{hub-api-client-WJPBXZAZ.js.map → hub-adopt-OA336ZXZ.js.map} +0 -0
  443. /package/dist/{prepare-V4U5HVJU.js.map → hub-api-client-5U6WOTZ3.js.map} +0 -0
  444. /package/dist/{hub-docker-target-REEEWUG2.js.map → hub-docker-target-JKFCABK4.js.map} +0 -0
  445. /package/dist/{prepared-custody-QIXW7MJM.js.map → prepare-GFWWKWGF.js.map} +0 -0
  446. /package/dist/{prepared-state-PV3GUBHO-MF56HWMZ.js.map → prepared-custody-KU4PDVBT.js.map} +0 -0
  447. /package/dist/{relay-DRDELF6B.js.map → prepared-state-LNQ7DYSU-AR5RMXAO.js.map} +0 -0
  448. /package/dist/{publish-credentials-BPHUO5VL.js.map → publish-credentials-3SQXX45P.js.map} +0 -0
  449. /package/dist/{remote-docker-share-RX5ARK45.js.map → registry-AFKV3EO2.js.map} +0 -0
  450. /package/runtime/hub/apps/hub/.next/static/{z7_2bKU93xE7GwllL1Duv → XIx10ozuCZRzwSsiCF_5t}/_buildManifest.js +0 -0
  451. /package/runtime/hub/apps/hub/.next/static/{z7_2bKU93xE7GwllL1Duv → XIx10ozuCZRzwSsiCF_5t}/_clientMiddlewareManifest.js +0 -0
  452. /package/runtime/hub/apps/hub/.next/static/{z7_2bKU93xE7GwllL1Duv → XIx10ozuCZRzwSsiCF_5t}/_ssgManifest.js +0 -0
@@ -3,66 +3,7 @@ import {
3
3
  HubApiClient,
4
4
  HubApiError,
5
5
  SUPPORTED_HUB_API_VERSIONS
6
- } from "./chunk-PSA6GADQ.js";
7
- import {
8
- getRuntimeProviderNames,
9
- isRuntimeProvider,
10
- loadProviderModule
11
- } from "./chunk-OUWVN2F2.js";
12
- import {
13
- REMOTE_DOCKER,
14
- parseProviderSpec
15
- } from "./chunk-NHVGKFVY.js";
16
-
17
- // src/provider/spec.ts
18
- function resolveCreateProviderSpec(providerName, remoteHost) {
19
- const raw = providerName && providerName.trim() || "docker";
20
- if (remoteHost && parseProviderSpec(raw).name === "docker") return `docker:${remoteHost}`;
21
- return raw;
22
- }
23
- function resolveProviderChoice(cfg, opts = {}) {
24
- const { name: providerName, remoteHost: specHost } = parseProviderSpec(
25
- opts.provider?.trim() || cfg.box.provider || "docker"
26
- );
27
- const host = opts.remoteHost?.trim() || specHost || (cfg.box.remoteDockerHost || "").trim() || void 0;
28
- const remoteHost = providerName === REMOTE_DOCKER ? host : void 0;
29
- return { providerName, remoteHost, spec: providerSpecFor(providerName, remoteHost) };
30
- }
31
- function providerSpecFor(providerName, remoteHost) {
32
- return providerName === REMOTE_DOCKER && remoteHost ? `docker:${remoteHost}` : providerName;
33
- }
34
-
35
- // src/provider/registry.ts
36
- function isKnownProvider(name) {
37
- try {
38
- return isRuntimeProvider(parseProviderSpec(name).name);
39
- } catch {
40
- return false;
41
- }
42
- }
43
- async function getProvider(name) {
44
- const mod = await loadProviderModule(parseProviderSpec(name).name);
45
- if (mod.ensureCredentials) await mod.ensureCredentials();
46
- return mod.provider;
47
- }
48
- async function providerForBox(box) {
49
- return getProvider(box.provider ?? "docker");
50
- }
51
- async function loadControlPlaneEnvLazily() {
52
- const { loadControlPlaneEnv } = await import("./env-file-XT7SDXSX.js");
53
- loadControlPlaneEnv();
54
- }
55
- async function providerForCreate(choice) {
56
- const flag = choice.flag?.trim();
57
- const spec = flag && flag.length > 0 ? flag : choice.config.box.provider;
58
- if (typeof spec !== "string" || spec.length === 0 || !isKnownProvider(spec)) {
59
- throw new Error(
60
- `unknown sandbox provider "${String(spec)}" (known: ${getRuntimeProviderNames().join(", ")})`
61
- );
62
- }
63
- if (choice.config.relay?.controlPlaneUrl) await loadControlPlaneEnvLazily();
64
- return getProvider(spec);
65
- }
6
+ } from "./chunk-WHFCJBMO.js";
66
7
 
67
8
  // src/control-plane/with-hub.ts
68
9
  import { log } from "@clack/prompts";
@@ -110,7 +51,7 @@ function reportHubError(err, url) {
110
51
  process.exitCode = 1;
111
52
  }
112
53
  async function withHubClient(opts, fn) {
113
- const { resolveHubApiTarget } = await import("./control-plane-5R7PYRQ6.js");
54
+ const { resolveHubApiTarget } = await import("./control-plane-UKKYXHIQ.js");
114
55
  const target = await resolveHubApiTarget(opts.url, { preferLocal: opts.preferLocal });
115
56
  if (!target) {
116
57
  process.exitCode = 1;
@@ -173,7 +114,7 @@ async function runOpOnOtherHub(box, op, preferLocalOther) {
173
114
  let owner;
174
115
  let other;
175
116
  try {
176
- const { resolveHubApiTarget } = await import("./control-plane-5R7PYRQ6.js");
117
+ const { resolveHubApiTarget } = await import("./control-plane-UKKYXHIQ.js");
177
118
  [owner, other] = await Promise.all([
178
119
  resolveHubApiTarget(void 0, { quiet: true, preferLocal: !preferLocalOther }),
179
120
  // Non-quiet so a stopped LOCAL retry hub is auto-started (it's a candidate owner).
@@ -203,17 +144,10 @@ function reportBoxNotOnAnyHub(box) {
203
144
  }
204
145
 
205
146
  export {
206
- resolveCreateProviderSpec,
207
- resolveProviderChoice,
208
- providerSpecFor,
209
- isKnownProvider,
210
- getProvider,
211
- providerForBox,
212
- providerForCreate,
213
147
  hubApiTargetFrom,
214
148
  withHubClient,
215
149
  boxOwningHubIsLocal,
216
150
  withOwningHub,
217
151
  reportBoxNotOnAnyHub
218
152
  };
219
- //# sourceMappingURL=chunk-OXKW4GWD.js.map
153
+ //# sourceMappingURL=chunk-UPVP6YGJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/control-plane/with-hub.ts"],"sourcesContent":["/**\n * `withHubClient` — the one entry point CLI commands use to run an operation\n * against the hub's `/api/v1`, in BOTH modes (a local hub or a remote control\n * box; the only difference is the base URL + token, resolved by\n * `resolveHubApiTarget`). It:\n *\n * 1. resolves the client (auto-starting a local hub when needed),\n * 2. gates the hub's `/api/v1` version once up front — a hub outside\n * {@link SUPPORTED_HUB_API_VERSIONS} is refused with an upgrade hint rather\n * than failing on a changed field mid-operation,\n * 3. runs the caller's op, and\n * 4. maps a {@link HubApiError} (or an unreachable hub) to a stable CLI exit\n * code + an actionable message.\n *\n * Later steps of the `/api/v1` consolidation are then a mechanical conversion:\n * wrap the op body in `withHubClient` and delete the inline provider code. A\n * command that needs to special-case a code (e.g. treat `not_found` as info)\n * catches it inside its own callback before it reaches the mapper here.\n */\nimport { log } from '@clack/prompts';\nimport type { HubTarget } from '../commands/hub.js';\nimport { HubApiClient, HubApiError, SUPPORTED_HUB_API_VERSIONS } from './hub-api-client.js';\n\nexport interface WithHubOptions {\n /** Override the hub URL (default: the configured control box, else the local hub). */\n url?: string;\n /**\n * Prefer the hub on THIS machine even when a remote control box is configured\n * (the which-hub principle, Step 1). A docker box is always local-owned, so a\n * docker op sets this to avoid hitting a remote hub that never owned it (it\n * would answer `not_found`). Reuses Step 0's exposed-loopback-first ladder.\n */\n preferLocal?: boolean;\n}\n\n/** True when the hub's reported `apiVersion` is one this CLI speaks. */\nexport function isSupportedApiVersion(version: string | undefined): boolean {\n return (\n version !== undefined && (SUPPORTED_HUB_API_VERSIONS as readonly string[]).includes(version)\n );\n}\n\n// Distinct exit codes per API error class, so scripts can branch on the failure\n// kind. `not_found` reuses 2 to match the lifecycle-error convention\n// (`handleLifecycleError`). Anything unmapped (including `internal`) is a plain 1.\nconst EXIT_BY_CODE: Record<string, number> = {\n not_found: 2,\n unauthorized: 3,\n invalid_request: 4,\n conflict: 5,\n backend_unavailable: 6,\n};\n\n/** The CLI exit code for a hub `/api/v1` error code. */\nexport function exitCodeForApiError(code: string): number {\n return EXIT_BY_CODE[code] ?? 1;\n}\n\n/**\n * The exit code to report for a hub error. A carried `details.exitCode` (a box\n * command's own exit — e.g. 64 for `git push --host-only` with no host checkout)\n * wins, so the CLI surfaces the box's faithful exit rather than the coarse\n * code→exit mapping. Falls back to the per-code table otherwise.\n */\nfunction exitCodeForHubError(err: HubApiError): number {\n const carried = (err.details as { exitCode?: unknown } | undefined)?.exitCode;\n if (typeof carried === 'number' && Number.isInteger(carried) && carried > 0) return carried;\n return exitCodeForApiError(err.code);\n}\n\n/** An extra actionable line for the error classes where the raw message isn't enough. */\nfunction hintForApiError(err: HubApiError): string | null {\n switch (err.code) {\n case 'unauthorized':\n return 'The hub rejected the API token. Restart a local hub with `agentbox hub restart`, or check AGENTBOX_HUB_API_KEY for a remote control box.';\n case 'backend_unavailable':\n return \"The hub reached its backend but it was unavailable — the provider or host it needs may not be configured on the hub's machine.\";\n default:\n return null;\n }\n}\n\n/**\n * Map a resolved {@link HubTarget} to the `/api/v1` client target, or the reason\n * it can't be used. Pure — the local⇄remote logic lives in `resolveHubTarget`;\n * this only converts `token`→`apiKey` and decides whether a token is present.\n * The token IS the Bearer for both modes (a local hub's token, or a control\n * box's `AGENTBOX_HUB_API_KEY`).\n */\nexport function hubApiTargetFrom(\n target: HubTarget,\n):\n | { ok: true; url: string; apiKey: string }\n | { ok: false; reason: 'no-token'; mode: 'local' | 'remote' } {\n if (!target.token) return { ok: false, reason: 'no-token', mode: target.mode };\n return { ok: true, url: target.url, apiKey: target.token };\n}\n\n/** Print a hub failure and set the matching exit code. Never throws. */\nfunction reportHubError(err: unknown, url: string): void {\n if (err instanceof HubApiError) {\n log.error(err.message);\n const hint = hintForApiError(err);\n if (hint) log.info(hint);\n process.exitCode = exitCodeForHubError(err);\n return;\n }\n // A fetch/network failure (hub down, wrong URL) surfaces as a plain Error.\n log.error(`Can't reach the hub at ${url}: ${err instanceof Error ? err.message : String(err)}`);\n process.exitCode = 1;\n}\n\nexport async function withHubClient<T>(\n opts: WithHubOptions,\n fn: (client: HubApiClient) => Promise<T>,\n): Promise<T | undefined> {\n // Lazy import breaks the hub.ts <-> control-plane.ts module cycle that both of\n // those already sit in (hub.ts consumes control-plane.ts's command list at\n // load time). Cheap after the first call — the module is cached.\n const { resolveHubApiTarget } = await import('../commands/control-plane.js');\n const target = await resolveHubApiTarget(opts.url, { preferLocal: opts.preferLocal });\n if (!target) {\n // resolveHubApiTarget already printed an actionable error (missing config /\n // key, or a local-hub autostart failure).\n process.exitCode = 1;\n return undefined;\n }\n const client = new HubApiClient(target);\n\n // Version gate — also the first authed-adjacent round-trip, so an unreachable\n // hub is reported here rather than surfacing later as a confusing op failure.\n try {\n const health = await client.health();\n if (!isSupportedApiVersion(health.apiVersion)) {\n log.error(\n `The hub at ${target.url} serves API ${health.apiVersion ? `\"${health.apiVersion}\"` : '(none reported)'}, ` +\n `which this CLI doesn't support (needs ${SUPPORTED_HUB_API_VERSIONS.join(', ')}).`,\n );\n log.info(\n 'Upgrade it (`agentbox hub update` for a remote control box, or `agentbox hub restart` for a local hub) or update this CLI to match.',\n );\n process.exitCode = 1;\n return undefined;\n }\n } catch (err) {\n if (err instanceof HubApiError) {\n // A hub too old to expose /api/v1 answers the probe with an error envelope.\n log.error(\n `The hub at ${target.url} didn't answer the /api/v1 health probe (${err.code}). It may be too old — upgrade it.`,\n );\n process.exitCode = 1;\n } else {\n reportHubError(err, target.url);\n }\n return undefined;\n }\n\n try {\n return await fn(client);\n } catch (err) {\n reportHubError(err, target.url);\n return undefined;\n }\n}\n\n/**\n * Whether the hub that OWNS this box runs on THIS machine — the `preferLocal`\n * answer for any box op. **The one ownership predicate**: a lifecycle/destroy op\n * can only be served by the hub that owns the box, and getting this wrong sends\n * the op to a hub that never registered the box (→ `not_found`). True for the\n * provider families the LOCAL hub drives directly:\n * - `docker` — a container on this machine.\n * - `remote-docker` — a container on another machine's engine, but the box\n * registers with the LOCAL relay (the local hub drives the remote engine over\n * SSH), so its owner is still local.\n * Cloud providers (e2b/vercel/hetzner/daytona/digitalocean) are owned by whichever\n * hub is configured, so they are NOT local-owned. Every caller MUST use this rather\n * than an inline `provider === 'docker'` check — five copies drift; a new provider\n * is classified here once.\n */\nexport function boxOwningHubIsLocal(box: { provider?: string }): boolean {\n const p = box.provider ?? 'docker';\n return p === 'docker' || p === 'remote-docker';\n}\n\n/** The outcome of a box op routed to its owning hub (see {@link withOwningHub}). */\nexport type OwningHubOutcome = 'ok' | 'not-found' | undefined;\n\n/**\n * Run a box op against the hub that OWNS the box (local for docker/remote-docker,\n * the configured hub for cloud — see {@link boxOwningHubIsLocal}), retrying the\n * OTHER distinct hub on `not_found`. A box can legitimately be unknown to the\n * first hub — e.g. a docker box whose op reached a configured remote hub that\n * never owned it — so a single `not_found` is not proof it belongs to no hub.\n * Returns:\n * - `'ok'` — some hub performed the op.\n * - `'not-found'` — no hub AgentBox knows owns the box.\n * - `undefined` — a hub error other than not_found (the owner-first attempt\n * went through {@link withHubClient}, which already reported it\n * + set the exit code).\n */\nexport async function withOwningHub(\n box: { id: string; provider?: string },\n op: (client: HubApiClient) => Promise<void>,\n): Promise<OwningHubOutcome> {\n const ownerLocal = boxOwningHubIsLocal(box);\n const primary = await withHubClient({ preferLocal: ownerLocal }, async (client) => {\n try {\n await op(client);\n return 'ok' as const;\n } catch (err) {\n if (err instanceof HubApiError && err.code === 'not_found') return 'not-found' as const;\n throw err;\n }\n });\n if (primary === undefined) return undefined; // withHubClient reported + set the exit code\n if (primary === 'ok') return 'ok';\n // The owner-first hub does not know this box. Retry the OTHER distinct hub.\n const other = await runOpOnOtherHub(box, op, !ownerLocal);\n if (other === 'ok') return 'ok';\n if (other === 'error') return undefined; // a real error on the retry hub — already reported\n return 'not-found';\n}\n\n/**\n * Run the op against the OTHER hub (the one `preferLocalOther` selects), skipped\n * when it resolves to the same URL as the owner-first attempt (a pure-local setup\n * has only one hub). Distinguishes three outcomes so a REAL error on the retry hub\n * isn't misreported as \"no hub owns the box\":\n * - `'ok'` — the retry hub performed the op.\n * - `'error'` — a genuine failure (conflict / auth / provider error); it is\n * REPORTED here (message + exit code) and the caller aborts.\n * - `'not-found'` — the retry hub doesn't own the box (`not_found`), OR it was\n * unreachable / unresolvable — neither is proof of ownership,\n * so the caller treats the box as owned by no known hub.\n */\nasync function runOpOnOtherHub(\n box: { id: string; provider?: string },\n op: (client: HubApiClient) => Promise<void>,\n preferLocalOther: boolean,\n): Promise<'ok' | 'error' | 'not-found'> {\n let owner: { url: string; apiKey: string } | null;\n let other: { url: string; apiKey: string } | null;\n try {\n const { resolveHubApiTarget } = await import('../commands/control-plane.js');\n [owner, other] = await Promise.all([\n resolveHubApiTarget(undefined, { quiet: true, preferLocal: !preferLocalOther }),\n // Non-quiet so a stopped LOCAL retry hub is auto-started (it's a candidate owner).\n resolveHubApiTarget(undefined, { preferLocal: preferLocalOther }),\n ]);\n } catch {\n return 'not-found'; // couldn't even resolve the other hub — not proof of ownership\n }\n if (!other) return 'not-found';\n if (owner && owner.url === other.url) return 'not-found'; // no distinct second hub\n try {\n await op(new HubApiClient(other));\n return 'ok';\n } catch (err) {\n if (err instanceof HubApiError) {\n // `not_found` = legitimately not owned here; any other code (conflict, auth,\n // backend, internal) is a REAL failure to surface, NOT \"no hub owns the box\".\n if (err.code === 'not_found') return 'not-found';\n reportHubError(err, other.url);\n return 'error';\n }\n // A network/transport failure to the second hub — unreachable is not proof of\n // ownership, so preserve the box (the caller keeps its record / refuses).\n return 'not-found';\n }\n}\n\n/**\n * Report a box that no hub AgentBox knows about owns, for the lifecycle commands\n * (start/stop/pause/unpause). Sets the `not_found` exit code (2). `destroy` does\n * NOT use this — it keeps the local record and names `--force` instead, because\n * dropping the record of a possibly-still-running resource is the dangerous case.\n */\nexport function reportBoxNotOnAnyHub(box: { name: string }): void {\n log.error(`Box ${box.name} was not found on any hub AgentBox knows.`);\n log.info('Run `agentbox ls` to see boxes AgentBox can drive.');\n process.exitCode = 2;\n}\n"],"mappings":";;;;;;;;AAmBA,SAAS,WAAW;AAiBb,SAAS,sBAAsB,SAAsC;AAC1E,SACE,YAAY,UAAc,2BAAiD,SAAS,OAAO;AAE/F;AAKA,IAAM,eAAuC;AAAA,EAC3C,WAAW;AAAA,EACX,cAAc;AAAA,EACd,iBAAiB;AAAA,EACjB,UAAU;AAAA,EACV,qBAAqB;AACvB;AAGO,SAAS,oBAAoB,MAAsB;AACxD,SAAO,aAAa,IAAI,KAAK;AAC/B;AAQA,SAAS,oBAAoB,KAA0B;AACrD,QAAM,UAAW,IAAI,SAAgD;AACrE,MAAI,OAAO,YAAY,YAAY,OAAO,UAAU,OAAO,KAAK,UAAU,EAAG,QAAO;AACpF,SAAO,oBAAoB,IAAI,IAAI;AACrC;AAGA,SAAS,gBAAgB,KAAiC;AACxD,UAAQ,IAAI,MAAM;AAAA,IAChB,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;AASO,SAAS,iBACd,QAG8D;AAC9D,MAAI,CAAC,OAAO,MAAO,QAAO,EAAE,IAAI,OAAO,QAAQ,YAAY,MAAM,OAAO,KAAK;AAC7E,SAAO,EAAE,IAAI,MAAM,KAAK,OAAO,KAAK,QAAQ,OAAO,MAAM;AAC3D;AAGA,SAAS,eAAe,KAAc,KAAmB;AACvD,MAAI,eAAe,aAAa;AAC9B,QAAI,MAAM,IAAI,OAAO;AACrB,UAAM,OAAO,gBAAgB,GAAG;AAChC,QAAI,KAAM,KAAI,KAAK,IAAI;AACvB,YAAQ,WAAW,oBAAoB,GAAG;AAC1C;A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NotFoundError,
4
4
  adoptHubBox,
5
5
  pullBoxSshKeys
6
- } from "./chunk-7ABO7OIF.js";
6
+ } from "./chunk-CO2I3CQI.js";
7
7
  import {
8
8
  AGENTBOX_VERSION,
9
9
  channelOfVersion,
@@ -14,26 +14,26 @@ import {
14
14
  resolveHubApiTarget,
15
15
  restoreTunnelIfExposed,
16
16
  stopTunnelIfExposed
17
- } from "./chunk-JDSYMTMS.js";
17
+ } from "./chunk-NAT2H7J4.js";
18
18
  import {
19
- loadControlPlaneEnv
20
- } from "./chunk-5F34YIRI.js";
19
+ CustodyClient
20
+ } from "./chunk-7QU6XENE.js";
21
21
  import {
22
22
  confirm,
23
23
  prompt_exports
24
24
  } from "./chunk-VPBE72HG.js";
25
- import {
26
- CustodyClient
27
- } from "./chunk-BUMKBUXS.js";
28
25
  import {
29
26
  HubApiClient
30
- } from "./chunk-PSA6GADQ.js";
27
+ } from "./chunk-WHFCJBMO.js";
28
+ import {
29
+ loadControlPlaneEnv
30
+ } from "./chunk-5F34YIRI.js";
31
31
  import {
32
32
  rehydrateFromState
33
- } from "./chunk-NHTRTST5.js";
33
+ } from "./chunk-HNWZO2XU.js";
34
34
  import {
35
35
  handleLifecycleError
36
- } from "./chunk-FGQFVUMH.js";
36
+ } from "./chunk-VY54AX4T.js";
37
37
  import {
38
38
  detectPortless,
39
39
  ensurePortlessProxy,
@@ -46,18 +46,18 @@ import {
46
46
  portlessStartHint,
47
47
  resetPortlessCache,
48
48
  uninstallPortlessService
49
- } from "./chunk-46NNZMZT.js";
50
- import {
51
- loadEffectiveConfig,
52
- setConfigValue
53
- } from "./chunk-NHVGKFVY.js";
49
+ } from "./chunk-EPFXLXCW.js";
54
50
  import {
55
51
  controlPlaneDeployPath,
56
52
  ensureHub,
57
53
  getHubStatus,
58
54
  hostOpenCommand,
59
55
  stopHub
60
- } from "./chunk-GFOWBXV7.js";
56
+ } from "./chunk-OKLEPEWZ.js";
57
+ import {
58
+ loadEffectiveConfig,
59
+ setConfigValue
60
+ } from "./chunk-7LNXTPEE.js";
61
61
 
62
62
  // src/commands/hub.ts
63
63
  import { spawn } from "child_process";
@@ -307,7 +307,11 @@ function renderStatus(s, exposed) {
307
307
  ` url: ${s.openUrl}`,
308
308
  ...mode,
309
309
  ...exposedLines,
310
- ` log: ${s.logFile}`
310
+ ` log: ${s.logFile}`,
311
+ // A rebuild under a live hub only fails LATER, on the first lazy import
312
+ // ("Cannot find module 'dist-XXXX.js'"). Say so here, where someone is
313
+ // already looking, instead of leaving them to decode that at the call site.
314
+ ...s.staleBundle ? [" stale: rebuilt since this hub started \u2014 run `agentbox hub restart`"] : []
311
315
  ].join("\n");
312
316
  }
313
317
  const stoppedExposed = exposed ? [" mode: exposed (configured; the hub is not running)"] : [];
@@ -390,11 +394,16 @@ var statusSub = new Command2("status").description(
390
394
  );
391
395
  return;
392
396
  }
397
+ const drainer = (await getHubStatus()).running ? [] : [
398
+ " local: this machine is not draining host actions \u2014 `cp` between a box and",
399
+ " your files will use the hub cache; run `agentbox relay start` to serve live"
400
+ ];
393
401
  process.stdout.write(
394
402
  [
395
403
  `hub: remote (${st.healthy ? "reachable" : "UNREACHABLE"})`,
396
404
  ` url: ${st.url}`,
397
405
  ` health: ${st.detail}`,
406
+ ...drainer,
398
407
  ...b.version ? [` version: ${b.version}${b.versionSource === "deployed" ? " (as deployed)" : ""}`] : [],
399
408
  ...b.channel ? [` channel: ${b.channel}`] : [],
400
409
  ...b.build ? [` build: ${b.build}`] : [],
@@ -624,4 +633,4 @@ export {
624
633
  describeRemoteHubBuild,
625
634
  hubCommand
626
635
  };
627
- //# sourceMappingURL=chunk-7RSE7ESY.js.map
636
+ //# sourceMappingURL=chunk-VVNXQ4XS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/hub.ts","../src/commands/install-portless.ts","../src/portless-prompt.ts"],"sourcesContent":["import { spawn } from 'node:child_process';\nimport { readFile } from 'node:fs/promises';\nimport { log, spinner } from '@clack/prompts';\nimport { loadEffectiveConfig } from '@agentbox/config';\nimport {\n ensureHub,\n getHubStatus,\n stopHub,\n controlPlaneDeployPath,\n hostOpenCommand,\n type HubStatus,\n type ControlPlaneDeployRecord,\n} from '@agentbox/sandbox-core';\nimport { Command } from 'commander';\nimport { handleLifecycleError } from './_errors.js';\nimport { rehydrateFromState } from './relay.js';\nimport { ensurePortlessProxyQuietly, resolvePortlessEnabled } from '../portless-prompt.js';\nimport {\n resolveCustodyApiTarget,\n resolveHubApiTarget,\n controlPlaneSubcommands,\n probeControlPlaneStatus,\n localExposedLoopbackUrl,\n} from './control-plane.js';\nimport { restoreTunnelIfExposed, stopTunnelIfExposed } from '../control-plane/expose.js';\nimport { loadControlPlaneEnv } from '../control-plane/env-file.js';\nimport { channelOfVersion } from '../lib/channel.js';\nimport { AGENTBOX_VERSION } from '../version.js';\nimport { CustodyClient } from '../control-plane/custody-client.js';\nimport { HubApiClient } from '../control-plane/hub-api-client.js';\nimport type { HubApiBox } from '../control-plane/hub-api-client.js';\nimport { pullBoxSshKeys } from '../control-plane/hub-pull.js';\nimport { adoptHubBox, HubBoxNotFoundError } from '../control-plane/hub-adopt.js';\n\n/**\n * Resolve `portless.enabled` and, when the user has opted in, make sure a proxy\n * is actually up before the hub reports its URL — a proxy does not survive a\n * reboot, so \"the hub is on agentbox.localhost\" was regularly a lie. Only\n * `true` starts one: an unset preference still registers the alias (that costs\n * nothing) but must not spawn a daemon nobody asked for.\n */\nasync function resolvePortlessForHub(): Promise<boolean | undefined> {\n const enabled = await resolvePortlessEnabled();\n if (enabled === true) await ensurePortlessProxyQuietly();\n return enabled;\n}\n\n/** Best-effort: open the hub URL in the host browser (never throws). */\nfunction openInBrowser(url: string): void {\n try {\n const child = spawn(hostOpenCommand(), [url], { detached: true, stdio: 'ignore' });\n child.unref();\n } catch {\n /* the caller has already printed the URL */\n }\n}\n\n/**\n * The client-facing hub the CLI + tray talk to. `mode` is `remote` when a control\n * box is configured, else `local`. `token` is the single Bearer that authorizes\n * both `/api/v1` and the `/api/events` SSE stream (the local hub token, or\n * `AGENTBOX_HUB_API_KEY` for the remote control box).\n */\nexport interface HubTarget {\n mode: 'local' | 'remote';\n url: string;\n token: string;\n /**\n * Whether that hub is a process on THIS machine. `mode` alone can't answer it:\n * a `hub expose`-d machine is its own control box, so it is `remote`-shaped\n * (password profile, keyed by `AGENTBOX_HUB_API_KEY`) while still running\n * here. Callers that need to *start* or *stop* the hub — rather than merely\n * call it — have to branch on this, not on `mode`.\n */\n onThisMachine: boolean;\n}\n\n/**\n * Resolve the hub the CLI should talk to: the remote control box when one is\n * configured (`--url` > `relay.controlPlaneUrl`, with `AGENTBOX_HUB_API_KEY`),\n * else the local hub (`127.0.0.1:<port>` + `~/.agentbox/hub/token`). Surfaced to\n * the macOS tray via `agentbox hub target --json` so it follows the same config\n * (it can't parse the layered config itself). One Bearer authorizes both surfaces\n * in either mode (see `apps/hub/proxy.ts`).\n *\n * `preferLocal` prefers the hub on THIS machine even when a remote control box is\n * configured — the \"which hub\" knob for callers that have decided an operation\n * belongs here (e.g. a `cloud.viaHub=false` bake, or a base whose artifact lands\n * here). It skips only the configured REMOTE control-plane URL; it does NOT skip\n * the loopback branch, because a `hub expose`-d machine's hub IS on this machine\n * yet runs the password profile (its `/api/v1` wants `AGENTBOX_HUB_API_KEY` over\n * loopback, not the plain `~/.agentbox/hub/token`). Same precedence ladder as the\n * default, minus the remote URL — never a second resolver that could disagree.\n */\nexport async function resolveHubTarget(\n urlFlag?: string,\n opts: { preferLocal?: boolean } = {},\n): Promise<HubTarget> {\n const cfg = await loadEffectiveConfig(process.cwd());\n const url = (urlFlag ?? cfg.effective.relay.controlPlaneUrl ?? '').replace(/\\/$/, '');\n // A control box that IS this machine (`hub expose`) is reached over loopback,\n // not the box-facing LAN/tunnel URL — but it's still the `remote`-shaped API\n // (password profile, /api/v1 keyed by AGENTBOX_HUB_API_KEY). This is ALSO the\n // `preferLocal` answer for an exposed machine: the hub is right here, so the\n // plain local-hub token below would 401 against its password profile.\n //\n // Checked BEFORE the configured URL is required, because the two can disagree:\n // `hub unset-url` clears the config but leaves the exposed record, and the hub\n // keeps running the password profile. Falling through to local mode then\n // handed out the localhost token — which that hub does not accept — so\n // `hub target`, and the tray that follows it, pointed at the wrong credential.\n const loopback = urlFlag ? null : await localExposedLoopbackUrl();\n if (loopback) {\n loadControlPlaneEnv();\n return {\n mode: 'remote',\n url: loopback,\n token: process.env.AGENTBOX_HUB_API_KEY ?? '',\n onThisMachine: true,\n };\n }\n // The configured REMOTE control box — skipped under preferLocal so the caller\n // gets this machine's plain local hub instead (the not-exposed local case).\n if (url && !opts.preferLocal) {\n loadControlPlaneEnv();\n return {\n mode: 'remote',\n url,\n token: process.env.AGENTBOX_HUB_API_KEY ?? '',\n onThisMachine: false,\n };\n }\n const s = await getHubStatus();\n return {\n mode: 'local',\n url: `http://127.0.0.1:${String(s.port)}`,\n token: s.token ?? '',\n onThisMachine: true,\n };\n}\n\ninterface StatusOpts {\n url?: string;\n json?: boolean;\n}\n\nfunction renderStatus(s: HubStatus, exposed?: ControlPlaneDeployRecord | null): string {\n // The exposed CONFIG is a property of the machine, not of the running process,\n // so it is reported whether or not the hub is up. Reporting it only while\n // running made a stopped control box look like a plain local hub — with\n // autostart still installed and boxes still pointed at it.\n const exposedLines = exposed\n ? [\n ...(exposed.publicUrl ? [` box-facing url: ${exposed.publicUrl}`] : []),\n ...(exposed.tunnel ? [` tunnel: ${exposed.tunnel}`] : []),\n ...(exposed.autostart ? [' autostart: on'] : []),\n ]\n : [];\n if (s.running) {\n // `mode` describes the PROCESS, so it stays keyed on the live profile: a hub\n // running plain on a machine that is configured exposed is exactly the\n // mismatch worth seeing.\n const mode =\n s.profile === 'hetzner'\n ? [` mode: exposed (control box${s.worker ? ', worker on' : ''})`]\n : exposed\n ? [' mode: NOT exposed yet (configured, but this process is the plain hub)']\n : [];\n return [\n `hub: running${s.ui ? '' : ' (bare relay on the port — no UI; run `agentbox hub start`)'}`,\n ` pid: ${s.pid === null ? '?' : String(s.pid)}`,\n ` port: ${String(s.port)}`,\n ` url: ${s.openUrl}`,\n ...mode,\n ...exposedLines,\n ` log: ${s.logFile}`,\n // A rebuild under a live hub only fails LATER, on the first lazy import\n // (\"Cannot find module 'dist-XXXX.js'\"). Say so here, where someone is\n // already looking, instead of leaving them to decode that at the call site.\n ...(s.staleBundle\n ? [' stale: rebuilt since this hub started — run `agentbox hub restart`']\n : []),\n ].join('\\n');\n }\n const stoppedExposed = exposed ? [' mode: exposed (configured; the hub is not running)'] : [];\n if (s.pidAlive) {\n return [\n `hub: not responding (pid ${String(s.pid)} alive but /healthz silent)`,\n ...stoppedExposed,\n ...exposedLines,\n ` log: ${s.logFile}`,\n ].join('\\n');\n }\n return ['hub: not running', ...stoppedExposed, ...exposedLines, ` log: ${s.logFile}`].join(\n '\\n',\n );\n}\n\n/**\n * What `hub deploy` recorded for the control box at `url` — the only trace of\n * which build a remote hub is running (the VPS keeps no version marker, and in\n * package mode not even a git checkout to `rev-parse`). Matched on URL so a\n * `--url` probe of somebody else's hub doesn't get this machine's record.\n * Best-effort: an absent or unreadable record just omits the line.\n */\nasync function readDeployRecordFor(url: string): Promise<ControlPlaneDeployRecord | null> {\n try {\n const rec = JSON.parse(\n await readFile(controlPlaneDeployPath(), 'utf8'),\n ) as ControlPlaneDeployRecord;\n return rec.url === url ? rec : null;\n } catch {\n return null;\n }\n}\n\n/** The deploy record for a control box that IS this machine (`hub expose`), or null. */\nasync function readLocalDeployRecord(): Promise<ControlPlaneDeployRecord | null> {\n try {\n const rec = JSON.parse(\n await readFile(controlPlaneDeployPath(), 'utf8'),\n ) as ControlPlaneDeployRecord;\n return rec.provider === 'local' ? rec : null;\n } catch {\n return null;\n }\n}\n\nexport interface RemoteHubBuild {\n /** The version the hub reports, else the version that was deployed. */\n version: string | null;\n /** Where `version` came from — a live probe beats a local record. */\n versionSource: 'live' | 'deployed' | null;\n /** `nightly` / `stable`, or `source (<ref>)` for a build-from-source box. */\n channel: string | null;\n /** The deploy record's build line, e.g. `@madarco/agentbox@0.28.0 (npm)`. */\n build: string | null;\n /** Set when the control box runs a different version than this CLI. */\n drift: string | null;\n}\n\n/**\n * Reconcile what the hub reports with what this machine deployed.\n *\n * The live version wins: the record only says what was last *deployed*, which is\n * wrong after a failed update, and is absent entirely for a hub someone else set\n * up. A control box built before the images exported `AGENTBOX_CLI_VERSION`\n * reports nothing, so the record is the fallback rather than the source.\n *\n * Pure so the precedence is unit-testable.\n */\nexport function describeRemoteHubBuild(input: {\n liveVersion?: string | undefined;\n record: ControlPlaneDeployRecord | null;\n cliVersion: string;\n}): RemoteHubBuild {\n const source = input.record?.source ?? null;\n const build = source\n ? source.kind === 'package'\n ? `@madarco/agentbox@${source.spec} (npm)`\n : `${source.repoUrl}@${source.repoRef} (built from source)`\n : null;\n // A spec may be a dist-tag or a range (`--package nightly`), not a version.\n // Treating one as a version would print `version: nightly` and, worse, classify\n // it `stable` — `channelOfVersion` only looks for a `-nightly.` suffix. Until\n // the hub reports what it actually installed, we simply don't know.\n const deployedVersion =\n source?.kind === 'package' && /^\\d+\\.\\d+\\.\\d+/.test(source.spec) ? source.spec : null;\n const version = input.liveVersion ?? deployedVersion;\n const versionSource = input.liveVersion ? 'live' : deployedVersion ? 'deployed' : null;\n // A source build's \"channel\" is the ref itself — which is the branch the user\n // actually cares about (`nightly`, `main`, a feature branch).\n const channel =\n source?.kind === 'source'\n ? `source (${source.repoRef})`\n : version\n ? channelOfVersion(version)\n : null;\n // Only meaningful for a version we know is live; a stale record would nag forever.\n const drift =\n input.liveVersion && input.liveVersion !== input.cliVersion\n ? `this CLI is ${input.cliVersion} — run \\`agentbox hub update\\` to match`\n : null;\n return { version, versionSource, channel, build, drift };\n}\n\nconst statusSub = new Command('status')\n .description(\n 'Show hub status — the remote control box (reachability + box/event counts) when one is configured, else the local hub process',\n )\n .option(\n '--url <url>',\n 'probe this control-plane URL as the remote hub (default: relay.controlPlaneUrl)',\n )\n .option('--json', 'emit status as JSON')\n .action(async (opts: StatusOpts) => {\n try {\n // A control box that IS this machine (`hub expose`): show the exposed\n // detail (profile, worker, box-facing URL, tunnel) that a plain remote\n // probe of its loopback can't. Skipped when `--url` targets another hub.\n const localExposed = opts.url ? null : await readLocalDeployRecord();\n if (localExposed) {\n const s = await getHubStatus();\n if (opts.json) {\n process.stdout.write(JSON.stringify({ ...s, exposed: localExposed }, null, 2) + '\\n');\n return;\n }\n process.stdout.write(renderStatus(s, localExposed) + '\\n');\n return;\n }\n const target = await resolveHubTarget(opts.url);\n // Remote (a control box is configured, or --url given): probe its /healthz.\n if (target.mode === 'remote') {\n const st = await probeControlPlaneStatus(target.url);\n const record = await readDeployRecordFor(st.url);\n const b = describeRemoteHubBuild({\n liveVersion: st.version,\n record,\n cliVersion: AGENTBOX_VERSION,\n });\n if (opts.json) {\n process.stdout.write(\n JSON.stringify({\n ...st,\n ...(b.version ? { version: b.version, versionSource: b.versionSource } : {}),\n ...(b.channel ? { channel: b.channel } : {}),\n ...(b.build ? { deployed: b.build } : {}),\n }) + '\\n',\n );\n return;\n }\n // Copies between a box and THIS machine are served by this machine's\n // relay draining the control box's queue. With it down they fall back to\n // the hub's cached copy (or fail) — a degradation worth naming here,\n // where someone is already asking how the hub is doing.\n const drainer = (await getHubStatus()).running\n ? []\n : [\n ' local: this machine is not draining host actions — `cp` between a box and',\n ' your files will use the hub cache; run `agentbox relay start` to serve live',\n ];\n process.stdout.write(\n [\n `hub: remote (${st.healthy ? 'reachable' : 'UNREACHABLE'})`,\n ` url: ${st.url}`,\n ` health: ${st.detail}`,\n ...drainer,\n ...(b.version\n ? [` version: ${b.version}${b.versionSource === 'deployed' ? ' (as deployed)' : ''}`]\n : []),\n ...(b.channel ? [` channel: ${b.channel}`] : []),\n ...(b.build ? [` build: ${b.build}`] : []),\n ...(b.drift ? [` update: ${b.drift}`] : []),\n ].join('\\n') + '\\n',\n );\n return;\n }\n // Local: introspect the hub daemon process on this machine.\n const s = await getHubStatus();\n // When exposed, the deploy record carries the box-facing URL / tunnel /\n // autostart that /healthz doesn't.\n const exposed = s.profile === 'hetzner' ? await readLocalDeployRecord() : null;\n if (opts.json) {\n process.stdout.write(\n JSON.stringify({ ...s, ...(exposed ? { exposed } : {}) }, null, 2) + '\\n',\n );\n return;\n }\n process.stdout.write(renderStatus(s, exposed) + '\\n');\n } catch (err) {\n handleLifecycleError(err);\n }\n });\n\nconst targetSub = new Command('target')\n .description(\n 'Print the hub the CLI talks to — the remote control box when configured, else the local hub — with its API token. The seam the macOS tray follows to point at the same hub.',\n )\n .option('--url <url>', 'override the control-plane URL (default: relay.controlPlaneUrl)')\n .option('--json', 'emit { mode, url, token } as JSON (consumed by the tray)')\n .action(async (opts: { url?: string; json?: boolean }) => {\n try {\n const t = await resolveHubTarget(opts.url);\n if (opts.json) {\n process.stdout.write(JSON.stringify(t) + '\\n');\n return;\n }\n const tokenNote = t.token\n ? 'present'\n : t.mode === 'remote'\n ? '(none — set AGENTBOX_HUB_API_KEY, or run `agentbox hub setup`)'\n : '(none — start the hub with `agentbox hub`)';\n process.stdout.write(\n [`hub: ${t.mode}`, ` url: ${t.url}`, ` token: ${tokenNote}`].join('\\n') + '\\n',\n );\n } catch (err) {\n handleLifecycleError(err);\n }\n });\n\ninterface StartOpts {\n open?: boolean;\n local?: boolean;\n}\n\n/**\n * With a remote control box configured, `agentbox hub` opens THAT hub instead of\n * starting one here: it is the hub this CLI already talks to, it holds the boxes,\n * and booting a second empty UI on 127.0.0.1 only invites acting on the wrong\n * one. Nothing is lost by not starting it — every local operation that needs the\n * hub on this machine auto-starts it (`resolveHubApiClient`), and `--local`\n * forces it explicitly.\n *\n * A `hub expose`-d machine is excluded: it *is* the control box, so the hub to\n * open is the one to start (hence `onThisMachine`, not `mode`).\n */\nasync function openRemoteHub(target: HubTarget, opts: StartOpts): Promise<void> {\n const s = spinner();\n s.start(`reaching the control box at ${target.url}`);\n const st = await probeControlPlaneStatus(target.url);\n s.stop(\n st.healthy ? `control box reachable — ${st.detail}` : `control box UNREACHABLE (${st.detail})`,\n );\n process.stdout.write(`\\n Open: ${target.url}\\n\\n`);\n if (!st.healthy) {\n log.warn(\n 'Opening it anyway. `agentbox hub status` has the detail; ' +\n '`agentbox hub start --local` runs a hub on this machine instead.',\n );\n }\n if (opts.open !== false) openInBrowser(target.url);\n}\n\nconst startSub = new Command('start')\n .description(\n 'Open the hub — the remote control box when one is configured, else start the local hub (relay + Web UI on port 8787) and open it',\n )\n .option('--no-open', \"don't open the browser, just print the URL\")\n .option('--local', 'start the hub on this machine even when a control box is configured')\n .action(async (opts: StartOpts) => {\n try {\n if (opts.local !== true) {\n const target = await resolveHubTarget();\n if (!target.onThisMachine) {\n await openRemoteHub(target, opts);\n return;\n }\n }\n const s = spinner();\n s.start('starting hub');\n // If this machine is an exposed control box with a tunnel, (re)establish it\n // first so the hub boots knowing its public URL (autostart path).\n await restoreTunnelIfExposed((line) => s.message(line));\n const ep = await ensureHub({\n onLog: (line) => s.message(line),\n portlessEnabled: await resolvePortlessForHub(),\n });\n await rehydrateFromState();\n s.stop(`hub running on ${ep.hostUrl}`);\n process.stdout.write(`\\n Open: ${ep.openUrl}\\n\\n`);\n if (opts.open !== false) openInBrowser(ep.openUrl);\n } catch (err) {\n handleLifecycleError(err);\n }\n });\n\nconst stopSub = new Command('stop')\n .description('Stop the hub process (idempotent)')\n .action(async () => {\n try {\n const s = spinner();\n s.start('stopping hub');\n const result = await stopHub();\n // A tunnel outliving the hub serves nothing and, worse, the next\n // `hub start` would spawn a second one over it. Idempotent + no-op when\n // this machine isn't exposed.\n await stopTunnelIfExposed((line) => s.message(line));\n s.stop(result.stopped ? `stopped hub (pid ${String(result.pid)})` : 'hub was not running');\n } catch (err) {\n handleLifecycleError(err);\n }\n });\n\nconst restartSub = new Command('restart')\n .description('Stop then start the hub')\n .option('--no-open', \"don't open the browser, just print the URL\")\n .action(async (opts: StartOpts) => {\n try {\n const s = spinner();\n s.start('stopping hub');\n const stopped = await stopHub();\n s.stop(stopped.stopped ? `stopped hub (pid ${String(stopped.pid)})` : 'hub was not running');\n const s2 = spinner();\n s2.start('starting hub');\n try {\n await restoreTunnelIfExposed((line) => s2.message(line));\n const ep = await ensureHub({\n onLog: (line) => s2.message(line),\n portlessEnabled: await resolvePortlessForHub(),\n });\n await rehydrateFromState();\n s2.stop(`hub running on ${ep.hostUrl}`);\n process.stdout.write(`\\n Open: ${ep.openUrl}\\n\\n`);\n if (opts.open !== false) openInBrowser(ep.openUrl);\n } catch (err) {\n s2.stop('hub start failed');\n log.warn(err instanceof Error ? err.message : String(err));\n throw err;\n }\n } catch (err) {\n handleLifecycleError(err);\n }\n });\n\n/**\n * Resolve a box ref through the hub's `/api/v1` (server-side `findBox`) for the\n * `hub pull` / `hub adopt` commands. Returns the unique match + the hub API URL\n * (persisted on the adopted record), or null after printing an actionable error\n * — an ambiguous prefix lists the candidates, a total miss throws\n * {@link HubBoxNotFoundError} for the caller's catch to render.\n */\nasync function resolveHubBox(\n ref: string,\n urlFlag: string | undefined,\n): Promise<{ box: HubApiBox; url: string } | null> {\n const target = await resolveHubApiTarget(urlFlag);\n if (!target) {\n process.exitCode = 1;\n return null;\n }\n const matches = await new HubApiClient(target).resolveBox(ref);\n if (matches.length === 0) throw new HubBoxNotFoundError(ref);\n if (matches.length > 1) {\n log.error(`'${ref}' matches multiple boxes on the control box — pick one:`);\n for (const b of matches) process.stderr.write(` ${b.name ?? b.id} (id ${b.id})\\n`);\n log.info('retry with a longer id prefix, the full name, or the sandbox id');\n process.exitCode = 1;\n return null;\n }\n return { box: matches[0]!, url: target.url };\n}\n\nconst pullSub = new Command('pull')\n .description(\n \"Download a control-box-created box's SSH keys so this PC can attach / port-forward / cp to it\",\n )\n .argument('<box>', 'box id or name as shown by `agentbox hub boxes list`')\n .option('--url <url>', 'override the control-plane URL (default: relay.controlPlaneUrl)')\n .action(async (box: string, opts: { url?: string }) => {\n try {\n const resolved = await resolveHubBox(box, opts.url);\n if (!resolved) return;\n // SSH keys live in custody, over the hub's /api/v1: the byte-read needs the\n // admin token (elevated), so this only works from a machine that ran\n // `hub setup`/`expose`. remoteOnly — a control-box box has no keys on a\n // plain local hub.\n const custodyTarget = await resolveCustodyApiTarget(opts.url, { remoteOnly: true });\n if (!custodyTarget) {\n process.exitCode = 1;\n return;\n }\n const res = await pullBoxSshKeys({\n custody: new CustodyClient(custodyTarget),\n box: resolved.box,\n });\n if (res.files.length === 0) {\n log.warn(\n `No SSH key material in custody for '${box}' (boxes/${res.key}/ssh). ` +\n 'The box may mint no keypair (e2b/vercel).',\n );\n process.exitCode = 1;\n return;\n }\n log.success(\n `Pulled ${String(res.files.length)} key file(s) to ${res.dest} — attach / cp / port-forward now work.`,\n );\n } catch (err) {\n if (err instanceof HubBoxNotFoundError) {\n log.error(`${err.message}. Run \\`agentbox hub boxes list\\` to see what's there.`);\n process.exitCode = 1;\n return;\n }\n handleLifecycleError(err);\n }\n });\n\nconst adoptSub = new Command('adopt')\n .description(\n 'Rebuild local state for a control-box-created box so it resolves by name here: writes its BoxRecord and downloads its SSH keys. After this it shows in `agentbox ls` and works with attach / cp / url / screen.',\n )\n .argument('<box>', 'box id, name, or sandbox id as shown by `agentbox hub boxes list`')\n .option('--url <url>', 'override the control-plane URL (default: relay.controlPlaneUrl)')\n .action(async (box: string, opts: { url?: string }) => {\n try {\n const resolved = await resolveHubBox(box, opts.url);\n if (!resolved) return;\n // SSH keys come from custody over /api/v1 (best-effort): a thin client with\n // no admin token adopts the record and warns for SSH providers (the byte-read\n // is refused). remoteOnly — adoption is a control-box concern.\n const custodyTarget = await resolveCustodyApiTarget(opts.url, {\n quiet: true,\n remoteOnly: true,\n });\n const custody = custodyTarget ? new CustodyClient(custodyTarget) : undefined;\n const res = await adoptHubBox({\n box: resolved.box,\n custody,\n controlPlaneUrl: resolved.url,\n log: (line) => log.info(line),\n });\n const where = res.projectRoot\n ? `linked to ${res.projectRoot}`\n : 'no local clone of its repo — it shows under `agentbox ls -g` only';\n log.success(\n `${res.refreshed ? 'Refreshed' : 'Adopted'} ${res.record.name} (${res.record.provider} ${res.record.cloud?.sandboxId ?? ''}) — ${where}.`,\n );\n if (res.sshKeysMissing) {\n log.warn(\n `But the control box has no SSH key for it, so attach / cp / port-forward won't work yet. ` +\n `The key is uploaded by the host that created the box — check that it ran with a control box configured.`,\n );\n }\n } catch (err) {\n if (err instanceof HubBoxNotFoundError) {\n log.error(`${err.message}. Run \\`agentbox hub boxes list\\` to see what's there.`);\n process.exitCode = 1;\n return;\n }\n handleLifecycleError(err);\n }\n });\n\nexport const hubCommand = new Command('hub')\n .description(\n 'Run + manage the AgentBox hub — the local relay + Web UI on http://127.0.0.1:8787 ' +\n '(also https://agentbox.localhost when Portless is installed), and the remote control box ' +\n '(setup, deploy, boxes, approvals, credentials, custody)',\n )\n .addCommand(startSub, { isDefault: true })\n .addCommand(statusSub)\n .addCommand(targetSub)\n .addCommand(stopSub)\n .addCommand(restartSub)\n .addCommand(pullSub)\n .addCommand(adoptSub);\n\n// Fold the remote-hub admin subcommands (setup/deploy/set-url/add/worker/\n// credentials/secrets/project/custody/boxes/approvals) into the one `hub` group —\n// there is no separate `control-plane` command. All surfaced (not hidden).\nfor (const sub of controlPlaneSubcommands) hubCommand.addCommand(sub);\n","/**\n * `agentbox install portless` — set up Portless properly, once, so box URLs\n * keep working across reboots.\n *\n * Portless (https://portless.sh) is what turns a box's published port into\n * `https://<box>.localhost`. AgentBox can install the CLI and start a proxy on\n * demand, but a proxy started that way is just a process: it dies with the\n * machine, while the route registry it serves survives on disk. The result is\n * the failure this command exists to remove — `portless get` keeps answering\n * with a URL, `agentbox hub` keeps printing it, and nothing is listening.\n *\n * Portless ships the fix (`portless service install`: a root LaunchDaemon on\n * macOS, systemd on Linux, a startup task on Windows), so this command drives\n * that rather than hand-rolling autostart, and pairs it with the CA trust the\n * HTTPS proxy needs.\n */\n\nimport { confirm, intro, log, note, outro, spinner } from '../lib/prompt.js';\nimport { Command } from 'commander';\nimport {\n detectPortless,\n ensurePortlessProxy,\n installPortless,\n installPortlessService,\n portlessGetUrl,\n portlessInstallHint,\n portlessServiceStatus,\n resetPortlessCache,\n uninstallPortlessService,\n} from '@agentbox/sandbox-docker';\n\ninterface InstallPortlessOptions {\n uninstall?: boolean;\n yes?: boolean;\n}\n\n/**\n * Offer to make an already-running proxy permanent. Interactive-only and\n * best-effort: called from the first-run opt-in and from this command, never\n * from a background path. A \"no\" is simply not repeated in that session — the\n * `doctor` row keeps the nudge visible without another prompt.\n */\nexport async function offerPortlessService(): Promise<void> {\n if (!process.stdin.isTTY) return;\n const service = await portlessServiceStatus();\n if (service.installed) return;\n\n const yes = await confirm({\n message:\n 'Start the Portless proxy automatically at boot? ' +\n '(otherwise box URLs stop working after every restart)',\n initialValue: true,\n });\n if (!yes) {\n log.info('Skipped — run `agentbox install portless` later to set it up.');\n return;\n }\n await runServiceInstall();\n}\n\n/**\n * Install the OS service, reporting what happened. Shared by the interactive\n * offer and the command itself.\n */\nasync function runServiceInstall(): Promise<boolean> {\n // The service runs Portless's default mode — HTTPS on :443 — so a host that\n // was on the no-root :1355 proxy moves to clean, port-less URLs. That is the\n // mode the rest of AgentBox is written against (a cloud box mirrors it\n // internally, and `{{AGENTBOX_BOX_HOST}}` templates spell `https://…` by\n // hand), but it *does* change existing box URLs, so say so before prompting.\n log.info(\n 'Installing the Portless startup service (HTTPS on port 443) — ' +\n 'you may be asked for your password. Box URLs become https://<box>.localhost ' +\n '(the same URL that works inside a box).',\n );\n const res = await installPortlessService();\n resetPortlessCache();\n if (res === 'cancelled') {\n log.warn('Password prompt dismissed — the proxy will not start at boot.');\n return false;\n }\n if (res === 'failed') {\n log.warn('Could not install the Portless startup service — run `portless service install`.');\n return false;\n }\n const service = await portlessServiceStatus();\n if (!service.installed) {\n log.warn(\n 'Portless reported success but the service is not registered — check `portless service status`.',\n );\n return false;\n }\n log.success('Portless starts at boot now.');\n return true;\n}\n\nexport const installPortlessCommand = new Command('portless')\n .description(\n 'Install Portless and start its proxy at boot, so https://<box>.localhost URLs survive a reboot.',\n )\n .option('--uninstall', 'remove the Portless startup service (leaves the CLI installed)')\n .option('-y, --yes', 'no prompts: install the CLI and the startup service')\n .action(async (opts: InstallPortlessOptions) => {\n intro('agentbox install portless');\n\n if (opts.uninstall === true) {\n const ok = await uninstallPortlessService();\n if (ok) outro('Portless startup service removed.');\n else {\n log.warn('Could not remove the service — run `portless service uninstall`.');\n outro('nothing changed');\n }\n return;\n }\n\n let state = await detectPortless();\n if (!state.installed) {\n const s = spinner();\n s.start(`installing portless (${portlessInstallHint()})`);\n const ok = await installPortless();\n resetPortlessCache();\n s.stop(ok ? 'portless installed' : 'portless install failed');\n if (!ok) {\n log.warn(`Run \\`${portlessInstallHint()}\\` yourself, then re-run this command.`);\n outro('nothing changed');\n return;\n }\n state = await detectPortless();\n }\n\n const service = await portlessServiceStatus();\n if (service.installed) {\n log.info('Portless startup service already installed.');\n } else if (opts.yes === true) {\n await runServiceInstall();\n } else if (process.stdin.isTTY) {\n await offerPortlessService();\n } else {\n // Installing the service raises a password dialog. Never do that from a\n // script or a hook that nobody is watching — say what to run instead.\n log.info('Startup service not installed — run `agentbox install portless -y` to add it.');\n }\n\n // Whether or not the service went in, leave the host with a live proxy —\n // the service starts one at *boot*, not retroactively for this session.\n state = await ensurePortlessProxy({ allowRootPrompt: false });\n if (!state.proxyRunning) {\n log.warn('No Portless proxy is running — box URLs fall back to loopback ports.');\n outro('done, with warnings');\n return;\n }\n\n // Show the real URL rather than an assumed one: whether it carries a port\n // and which scheme it uses is decided by whichever proxy actually answered.\n const hubUrl = await portlessGetUrl('agentbox');\n const boxUrl = hubUrl.replace('//agentbox.', '//<box>.');\n note([`hub: ${hubUrl}`, `boxes: ${boxUrl}`].join('\\n'), 'URLs served by this proxy');\n outro('portless ready');\n });\n","import { confirm, log, spinner } from './lib/prompt.js';\nimport { loadEffectiveConfig, setConfigValue } from '@agentbox/config';\nimport {\n detectPortless,\n type DockerEngine,\n ensurePortlessProxy,\n installPortless,\n portlessInstallHint,\n portlessServiceHint,\n portlessStartHint,\n resetPortlessCache,\n} from '@agentbox/sandbox-docker';\nimport { offerPortlessService } from './commands/install-portless.js';\n\nexport interface PortlessPromptArgs {\n engine: DockerEngine;\n /** Effective `portless.enabled` — `undefined` means \"never prompted\". */\n enabled: boolean | undefined;\n yes: boolean;\n /** cwd for the config write (global scope resolves a fixed path regardless). */\n cwd: string;\n}\n\n/**\n * Bring the host Portless into a usable state after the user opts in: install\n * the CLI if missing, then start a proxy if none is running. We start the\n * default HTTPS proxy on :443 so box web apps get the clean\n * `https://<box>.localhost` (no port). Portless self-elevates via `sudo`, so\n * this asks for the host password once — a native GUI dialog on macOS. If the\n * user dismisses that prompt (or elevation fails) we fall back to the no-root\n * proxy (`--no-tls -p 1355`, `http://<box>.localhost:1355`) so create still\n * works. Best-effort — any failure degrades to a printed hint, never throws.\n *\n * `allowRootPrompt` gates the :443 attempt: the Docker path only reaches here\n * after an interactive \"yes\", but the Hetzner path calls this directly, so it\n * passes `false` for non-interactive / `--yes` runs to avoid a surprise\n * password dialog (falling straight through to the no-root :1355 proxy).\n *\n * The :443 preference is not cosmetic. `https://<box>.localhost` is the URL a\n * cloud box mirrors internally and the one users hand-write against\n * `{{AGENTBOX_BOX_HOST}}`, so host and box only agree while the host proxy\n * serves that exact scheme and port.\n */\nexport async function setupPortlessHost(opts: { allowRootPrompt?: boolean } = {}): Promise<void> {\n const allowRootPrompt = opts.allowRootPrompt ?? true;\n let state = await detectPortless();\n\n if (!state.installed) {\n const s = spinner();\n s.start('installing portless (npm install -g portless)');\n const ok = await installPortless();\n resetPortlessCache();\n s.stop(ok ? 'portless installed' : 'portless install failed');\n if (!ok) {\n log.warn(`Could not install Portless — run \\`${portlessInstallHint()}\\` yourself.`);\n return;\n }\n state = await detectPortless();\n }\n\n if (state.proxyRunning) {\n log.info('Portless proxy already running — boxes will use it.');\n // Running now, but a manually started proxy is gone after the next reboot.\n if (allowRootPrompt) await offerPortlessService();\n return;\n }\n\n // `ensurePortlessProxy` runs the ladder: the clean :443 proxy when we may ask\n // for a password, the no-root port when that is refused or already the mode\n // this host uses. No spinner around the root attempt — the elevation prompt is\n // modal and shouldn't race one.\n if (allowRootPrompt) {\n log.info(\n 'Starting the Portless proxy on https://<box>.localhost — you may be asked for your password.',\n );\n state = await ensurePortlessProxy({ allowRootPrompt: true });\n } else {\n const s = spinner();\n s.start('starting portless proxy');\n state = await ensurePortlessProxy({ allowRootPrompt: false });\n // No port asserted here: which port comes back is whichever one this host is\n // already configured for. The real URL is resolved via `portless get`.\n s.stop(state.proxyRunning ? 'portless proxy started' : 'portless proxy did not start');\n }\n\n if (!state.proxyRunning) {\n log.warn(\n `Could not start the Portless proxy — run \\`${portlessServiceHint()}\\` (starts it at boot) ` +\n `or \\`${portlessStartHint()}\\` for a one-off.`,\n );\n return;\n }\n if (allowRootPrompt) {\n log.success('Portless proxy started');\n await offerPortlessService();\n }\n}\n\n/**\n * Effective `portless.enabled`, resolved against the cwd so the global layer is\n * picked up. Best effort — a config read failure leaves it `undefined`, which\n * every caller treats as \"never decided\", not as an opt-out.\n */\nexport async function resolvePortlessEnabled(): Promise<boolean | undefined> {\n try {\n const cfg = await loadEffectiveConfig(process.cwd());\n return cfg.effective.portless.enabled;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Bring an already-opted-in host back to a working state without asking\n * anything. A proxy dies on reboot while its route registry survives, so\n * `portless get` keeps answering with URLs that resolve to nothing until\n * something restarts it — and before this, nothing did. Every entry point that\n * is about to hand out a `<box>.localhost` URL calls this.\n *\n * Silent by design: it never prompts for a password (the tray app, the queue\n * worker and `self-update` all reach here). It restarts the mode this host is\n * already configured for and never switches modes, so a host on the clean\n * HTTPS :443 proxy — which needs root — gets a pointer to the one-time fix\n * rather than a silently different URL. Warns once, at most.\n */\nexport async function ensurePortlessProxyQuietly(): Promise<void> {\n const state = await ensurePortlessProxy({ allowRootPrompt: false });\n if (!state.installed || state.proxyRunning) return;\n log.warn(\n `Portless proxy is not running — box URLs fall back to loopback ports. ` +\n `Start it at boot with \\`${portlessServiceHint()}\\`.`,\n );\n}\n\n/**\n * First-run opt-in for Portless. On Docker Desktop there is no per-container\n * DNS, so we offer to give box web apps a friendly `<box>.localhost` URL. The\n * answer — yes or no — is persisted to the *global* config so the prompt fires\n * exactly once per machine; a \"yes\" also installs the CLI and starts the proxy\n * (see `setupPortlessHost`). Returns the resolved enabled flag.\n *\n * Silent no-op (returns the effective value) when: already decided in any\n * config layer or via --portless/--no-portless; non-interactive or --yes; or\n * the engine is OrbStack (which already has .orb.local).\n */\nexport async function maybePromptPortless(args: PortlessPromptArgs): Promise<boolean> {\n if (args.enabled !== undefined) {\n // Already decided — but \"decided\" only ever meant the *preference* was\n // stored. The proxy itself is not durable (a reboot kills it), so an\n // opted-in host used to sit here with dead `<box>.localhost` URLs forever.\n if (args.enabled) await ensurePortlessProxyQuietly();\n return args.enabled;\n }\n if (args.engine === 'orbstack') return false;\n // Non-interactive (`--yes`, CI, no TTY): can't prompt — adopt a running proxy\n // instead of forcing the user to opt in from a terminal first.\n if (!process.stdin.isTTY || args.yes) return resolvePortlessNonInteractive(args);\n\n const answer = await confirm({\n message:\n 'Use Portless to give box web apps a friendly local URL? ' +\n '(installs the portless CLI and starts a local proxy if needed)',\n initialValue: true,\n });\n\n try {\n await setConfigValue('global', 'portless.enabled', answer, args.cwd, { raw: false });\n } catch (err) {\n log.warn(\n `Could not save the Portless preference: ${err instanceof Error ? err.message : String(err)}`,\n );\n }\n\n if (answer) await setupPortlessHost();\n return answer;\n}\n\n/**\n * Resolve `portless.enabled` when we can't prompt — background queue jobs, the\n * tray app's hub-create path, `--yes`, CI. Honors an already-decided value\n * (config or `--portless`/`--no-portless`). Otherwise, on Docker Desktop, it\n * adopts an already-running Portless proxy — and persists the choice so later\n * runs skip re-detection, mirroring an interactive \"yes\" for a user who already\n * has Portless up. Without this, the first box started from the tray app never\n * uses Portless even though the proxy is live on :443, until the user happens to\n * run `agentbox` once from a real terminal. Never installs or starts a proxy\n * unasked; OrbStack needs no Portless (it has `.orb.local`).\n */\nexport async function resolvePortlessNonInteractive(args: {\n engine: DockerEngine;\n enabled: boolean | undefined;\n cwd: string;\n}): Promise<boolean> {\n if (args.enabled !== undefined) {\n if (args.enabled) await ensurePortlessProxyQuietly();\n return args.enabled;\n }\n if (args.engine === 'orbstack') return false;\n const state = await detectPortless();\n if (state.proxyRunning) {\n try {\n await setConfigValue('global', 'portless.enabled', true, args.cwd, { raw: false });\n } catch {\n // Best-effort persist; still use the running proxy for this run.\n }\n }\n return state.proxyRunning;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,SAAS,OAAAA,MAAK,WAAAC,gBAAe;AAW7B,SAAS,WAAAC,gBAAe;;;ACKxB,SAAS,eAAe;AAwBxB,eAAsB,uBAAsC;AAC1D,MAAI,CAAC,QAAQ,MAAM,MAAO;AAC1B,QAAM,UAAU,MAAM,sBAAsB;AAC5C,MAAI,QAAQ,UAAW;AAEvB,QAAM,MAAM,MAAM,QAAQ;AAAA,IACxB,SACE;AAAA,IAEF,cAAc;AAAA,EAChB,CAAC;AACD,MAAI,CAAC,KAAK;AACR,uBAAI,KAAK,oEAA+D;AACxE;AAAA,EACF;AACA,QAAM,kBAAkB;AAC1B;AAMA,eAAe,oBAAsC;AAMnD,qBAAI;AAAA,IACF;AAAA,EAGF;AACA,QAAM,MAAM,MAAM,uBAAuB;AACzC,qBAAmB;AACnB,MAAI,QAAQ,aAAa;AACvB,uBAAI,KAAK,oEAA+D;AACxE,WAAO;AAAA,EACT;AACA,MAAI,QAAQ,UAAU;AACpB,uBAAI,KAAK,uFAAkF;AAC3F,WAAO;AAAA,EACT;AACA,QAAM,UAAU,MAAM,sBAAsB;AAC5C,MAAI,CAAC,QAAQ,WAAW;AACtB,uBAAI;AAAA,MACF;AAAA,IACF;AACA,WAAO;AAAA,EACT;AACA,qBAAI,Q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Command","s","spinner","log"]}
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  ClaudeSessionError
4
- } from "./chunk-46NNZMZT.js";
4
+ } from "./chunk-EPFXLXCW.js";
5
5
  import {
6
6
  AmbiguousBoxError,
7
7
  BoxNotFoundError
8
- } from "./chunk-GFOWBXV7.js";
8
+ } from "./chunk-OKLEPEWZ.js";
9
9
 
10
10
  // src/commands/_errors.ts
11
11
  import { log } from "@clack/prompts";
@@ -32,4 +32,4 @@ function handleLifecycleError(err) {
32
32
  export {
33
33
  handleLifecycleError
34
34
  };
35
- //# sourceMappingURL=chunk-FGQFVUMH.js.map
35
+ //# sourceMappingURL=chunk-VY54AX4T.js.map
@@ -1,24 +1,25 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
- PROVIDER_NAMES,
4
- isProviderKind
5
- } from "./chunk-NHVGKFVY.js";
6
- import {
3
+ ensureProviderDescriptor,
7
4
  isSupportedApiVersion,
8
5
  pluginForProvider,
9
6
  pluginProviderNames
10
- } from "./chunk-GFOWBXV7.js";
7
+ } from "./chunk-OKLEPEWZ.js";
8
+ import {
9
+ PROVIDER_NAMES,
10
+ isProviderKind
11
+ } from "./chunk-7LNXTPEE.js";
11
12
 
12
13
  // src/provider/loaders.ts
13
14
  import { pathToFileURL } from "url";
14
15
  var IMPORTERS = {
15
- docker: () => import("./dist-K5M4HKG7.js"),
16
- daytona: () => import("./dist-XQLKK7H3.js"),
17
- hetzner: () => import("./dist-5OR4QTQW.js"),
18
- vercel: () => import("./dist-SN2TCRZ5.js"),
19
- e2b: () => import("./dist-6PYXFREL.js"),
20
- digitalocean: () => import("./dist-EPFS5PRI.js"),
21
- "remote-docker": () => import("./dist-POILUDVJ.js")
16
+ docker: () => import("./dist-ZNYS7CVF.js"),
17
+ daytona: () => import("./dist-EOGD7KD6.js"),
18
+ hetzner: () => import("./dist-7B3VCLZI.js"),
19
+ vercel: () => import("./dist-ZJIJHCZB.js"),
20
+ e2b: () => import("./dist-DOEGENNW.js"),
21
+ digitalocean: () => import("./dist-A5ZEIVAW.js"),
22
+ "remote-docker": () => import("./dist-MUTFY7FA.js")
22
23
  };
23
24
  function pickProviderModule(mod, name) {
24
25
  const m = mod;
@@ -47,6 +48,8 @@ async function loadProviderModule(name) {
47
48
  `plugin "${plugin.packageName}" does not export a providerModule for "${name}"`
48
49
  );
49
50
  }
51
+ void ensureProviderDescriptor(name, providerModule).catch(() => {
52
+ });
50
53
  return providerModule;
51
54
  }
52
55
  function getRuntimeProviderNames() {
@@ -61,4 +64,4 @@ export {
61
64
  getRuntimeProviderNames,
62
65
  isRuntimeProvider
63
66
  };
64
- //# sourceMappingURL=chunk-OUWVN2F2.js.map
67
+ //# sourceMappingURL=chunk-WGNI24H2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/provider/loaders.ts"],"sourcesContent":["/**\n * Per-provider lazy module loaders — the ONE place the CLI enumerates the\n * `@agentbox/sandbox-<name>` packages.\n *\n * Each package exposes a uniform `providerModule` (see `ProviderModule` in\n * `@agentbox/sandbox-core`); the create / doctor / install / checkpoint code\n * all resolve a provider through `loadProviderModule` and drive it generically,\n * so those call sites carry no per-provider `switch`.\n *\n * The `import()` specifiers are LITERAL — one arm per provider — on purpose.\n * The CLI's tsup build inlines every `@agentbox/sandbox-*` package\n * (`noExternal: [/^@agentbox\\//]`), which requires esbuild to statically\n * resolve each specifier; a runtime-variable `import('@agentbox/sandbox-' +\n * name)` would not inline and would `MODULE_NOT_FOUND` in the published CLI.\n * `Record<ProviderKind, …>` makes this map exhaustive: adding a provider to the\n * config `PROVIDERS` table forces a matching entry here (a TS error otherwise).\n *\n * Second consumer: `src/relay/cloud-backends.ts` re-exports this map's cloud\n * backends as the loader the spawned relay side-loads, so the literal-specifier\n * rule above is what keeps cloud `git push` working in a published install.\n */\n\nimport { pathToFileURL } from 'node:url';\nimport { PROVIDER_NAMES, isProviderKind, type ProviderKind } from '@agentbox/config';\nimport {\n ensureProviderDescriptor,\n pluginForProvider,\n pluginProviderNames,\n isSupportedApiVersion,\n type ProviderModule,\n} from '@agentbox/sandbox-core';\n\nconst IMPORTERS: Record<ProviderKind, () => Promise<{ providerModule: ProviderModule }>> = {\n docker: () => import('@agentbox/sandbox-docker'),\n daytona: () => import('@agentbox/sandbox-daytona'),\n hetzner: () => import('@agentbox/sandbox-hetzner'),\n vercel: () => import('@agentbox/sandbox-vercel'),\n e2b: () => import('@agentbox/sandbox-e2b'),\n digitalocean: () => import('@agentbox/sandbox-digitalocean'),\n 'remote-docker': () => import('@agentbox/sandbox-remote-docker'),\n};\n\n/**\n * Extract the `providerModule` matching `name` from an already-imported plugin\n * package. A plugin may export a single `providerModule` or a `providerModules`\n * array (multi-provider package).\n */\nfunction pickProviderModule(mod: unknown, name: string): ProviderModule | null {\n const m = mod as { providerModule?: ProviderModule; providerModules?: ProviderModule[] };\n const all = m.providerModules ?? (m.providerModule ? [m.providerModule] : []);\n // Strict match on provider.name — never fall back to all[0], or a package\n // could serve the WRONG provider for a mismatched `--provider` name.\n return all.find((pm) => pm.provider?.name === name) ?? null;\n}\n\n/**\n * Lazily import a provider package and return its uniform `providerModule`.\n *\n * Built-in providers resolve through the literal-specifier `IMPORTERS` map\n * (bundle-inlined). An unknown name falls back to the plugin registry: a TRUE\n * variable `import(resolvedEntry)` of the externally-installed package — NOT\n * inlined at build time, resolved from wherever the user installed it.\n */\nexport async function loadProviderModule(name: string): Promise<ProviderModule> {\n if (isProviderKind(name)) {\n return (await IMPORTERS[name]()).providerModule;\n }\n const plugin = pluginForProvider(name);\n if (!plugin) {\n throw new Error(\n `unknown provider \"${name}\" — not built in and no registered plugin provides it (run \\`agentbox plugin list\\`)`,\n );\n }\n if (!isSupportedApiVersion(plugin.apiVersion)) {\n throw new Error(\n `plugin \"${plugin.packageName}\" targets provider SDK v${String(plugin.apiVersion)}, which this AgentBox does not support — update the plugin or AgentBox`,\n );\n }\n // Variable specifier on purpose: this is the extension seam. esbuild leaves it\n // as a runtime import so an externally-installed package resolves at run time.\n // Convert to a file:// URL — a bare absolute path is not a valid ESM dynamic\n // import specifier on Windows / some Node setups.\n const mod = (await import(pathToFileURL(plugin.resolvedEntry).href)) as unknown;\n const providerModule = pickProviderModule(mod, name);\n if (!providerModule) {\n throw new Error(\n `plugin \"${plugin.packageName}\" does not export a providerModule for \"${name}\"`,\n );\n }\n // Back-fill the descriptor snapshot for a plugin registered before descriptors\n // existed (a v1 plugins.json) — we hold the module here, which is the only\n // moment deriving one is free. Deliberately NOT awaited: it is a cache write\n // whose only cost when lost is another derivation later, so it must never add\n // latency or a new failure mode to loading a provider.\n void ensureProviderDescriptor(name, providerModule).catch(() => {});\n return providerModule;\n}\n\n/** Built-in + registered-plugin provider names (deduped). */\nexport function getRuntimeProviderNames(): string[] {\n return [...new Set<string>([...PROVIDER_NAMES, ...pluginProviderNames()])];\n}\n\n/** True if `name` is a built-in provider or a registered plugin provider. */\nexport function isRuntimeProvider(name: string): boolean {\n return isProviderKind(name) || pluginProviderNames().includes(name);\n}\n"],"mappings":";;;;;;;;;;;;;AAsBA,SAAS,qBAAqB;AAU9B,IAAM,YAAqF;AAAA,EACzF,QAAQ,MAAM,OAAO,oBAA0B;AAAA,EAC/C,SAAS,MAAM,OAAO,oBAA2B;AAAA,EACjD,SAAS,MAAM,OAAO,oBAA2B;AAAA,EACjD,QAAQ,MAAM,OAAO,oBAA0B;AAAA,EAC/C,KAAK,MAAM,OAAO,oBAAuB;AAAA,EACzC,cAAc,MAAM,OAAO,oBAAgC;AAAA,EAC3D,iBAAiB,MAAM,OAAO,oBAAiC;AACjE;AAOA,SAAS,mBAAmB,KAAc,MAAqC;AAC7E,QAAM,IAAI;AACV,QAAM,MAAM,EAAE,oBAAoB,EAAE,iBAAiB,CAAC,EAAE,cAAc,IAAI,CAAC;AAG3E,SAAO,IAAI,KAAK,CAAC,OAAO,GAAG,UAAU,SAAS,IAAI,KAAK;AACzD;AAUA,eAAsB,mBAAmB,MAAuC;AAC9E,MAAI,eAAe,IAAI,GAAG;AACxB,YAAQ,MAAM,UAAU,IAAI,EAAE,GAAG;AAAA,EACnC;AACA,QAAM,SAAS,kBAAkB,IAAI;AACrC,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI;AAAA,MACR,qBAAqB,IAAI;AAAA,IAC3B;AAAA,EACF;AACA,MAAI,CAAC,sBAAsB,OAAO,UAAU,GAAG;AAC7C,UAAM,IAAI;AAAA,MACR,WAAW,OAAO,WAAW,2BAA2B,OAAO,OAAO,UAAU,CAAC;AAAA,IACnF;AAAA,EACF;AAKA,QAAM,MAAO,MAAM,OAAO,cAAc,OAAO,aAAa,EAAE;AAC9D,QAAM,iBAAiB,mBAAmB,KAAK,IAAI;AACnD,MAAI,CAAC,gBAAgB;AACnB,UAAM,IAAI;AAAA,MACR,WAAW,OAAO,WAAW,2CAA2C,IAAI;AAAA,IAC9E;AAAA,EACF;AAMA,OAAK,yBAAyB,MAAM,cAAc,EAAE,MAAM,MAAM;AAAA,EAAC,CAAC;AAClE,SAAO;AACT;AAGO,SAAS,0BAAoC;AAClD,SAAO,CAAC,GAAG,oBAAI,IAAY,CAAC,GAAG,gBAAgB,GAAG,oBAAoB,CAAC,CAAC,CAAC;AAC3E;AAGO,SAAS,kBAAkB,MAAuB;AACvD,SAAO,eAAe,IAAI,KAAK,oBAAoB,EAAE,SAAS,IAAI;AACpE;","names":[]}
@@ -73,6 +73,19 @@ var HubApiClient = class {
73
73
  getBox(id) {
74
74
  return this.request("GET", `/boxes/${encodeURIComponent(id)}`);
75
75
  }
76
+ /**
77
+ * Mint the box's ready-to-open noVNC viewer URL. Resolves live rather than
78
+ * reading the Box payload's `vncUrl`, which is null for daytona/vercel/e2b:
79
+ * their signed preview URLs expire, so they can't ride a listing. Throws
80
+ * HubApiError 'conflict' when the box isn't running or has VNC disabled.
81
+ */
82
+ vncUrl(id, opts = {}) {
83
+ const q = opts.ttl === void 0 ? "" : `?ttl=${String(opts.ttl)}`;
84
+ return this.request(
85
+ "GET",
86
+ `/boxes/${encodeURIComponent(id)}/vnc${q}`
87
+ );
88
+ }
76
89
  /**
77
90
  * Resolve a box ref (`id | name | sandbox id | index`) server-side, mirroring
78
91
  * the CLI's local `findBox`. Returns the match SET: `[]`=none, `[box]`=unique,
@@ -390,4 +403,4 @@ export {
390
403
  HubApiError,
391
404
  HubApiClient
392
405
  };
393
- //# sourceMappingURL=chunk-PSA6GADQ.js.map
406
+ //# sourceMappingURL=chunk-WHFCJBMO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/control-plane/hub-api-client.ts"],"sourcesContent":["/**\n * The PC's client for a hub's public REST API (`/api/v1`) — the SAME surface the\n * tray and web UI speak. Its only local⇄remote difference is the base URL + token\n * (a control box's `AGENTBOX_HUB_API_KEY`, or a local hub's token), so a command\n * built on this client works against either by swapping the target.\n *\n * This is the CLI's ONE client. The internal relay wire (`/admin/*` + `/remote/*`)\n * is the box↔hub + credential plane — not a client API — and after the `/api/v1`\n * consolidation the CLI no longer holds a client for it (a guard test enforces\n * this; see `test/no-internal-wire-client.test.ts`). Every client-facing box and\n * fleet operation (list, lifecycle, git, approvals, custody) goes through here.\n */\n\n/**\n * A hub box as the `/api/v1` list/get returns it (the UI view + raw host fields).\n * Mirrors the hub's own `Box` for the fields a CLI/tray client reads. The\n * \"adoption / reconstruction\" block is what lets a thin CLI (`agentbox ls`, and\n * Step 4's box resolution) rebuild a drivable local record from THIS payload\n * instead of the internal `/admin/store` registration wire — it carries every\n * NON-SECRET field `registrationToBoxRecord` needs. Tokens (relay/bridge/preview)\n * are deliberately absent: a fresh adoption re-mints them.\n */\nexport interface HubApiBox {\n id: string;\n name?: string;\n /** Cosmetic user label (set via rename); the CLI prefers it over `name`. */\n displayName?: string | null;\n /** The hub's computed primary label (displayName || session title || name). */\n task: string;\n provider: string;\n /** Raw provider runtime state; absent on synthetic in-flight `job:` boxes. */\n state?: 'running' | 'paused' | 'stopped' | 'missing' | 'destroyed';\n /** Normalized lifecycle status (running | paused | stopped | creating | error). */\n status: string;\n branch: string;\n /** Absolute host path of the box's project — host topology only. */\n projectRoot?: string;\n projectIndex?: number;\n createdAt?: number;\n /** Normalized primary agent for display ('claude' | 'codex' | 'opencode' | 'shell'). */\n agent?: string;\n // ── Agent activity / session titles (the AGENT column + cmux dock). ──\n claudeActivity?: string;\n codexActivity?: string;\n claudeSessionTitle?: string;\n codexSessionTitle?: string;\n opencodeSessionTitle?: string;\n /** Live shell-session count (docker only); absent → the CLI renders `-`. */\n shellCount?: number;\n // ── Endpoints (the URL column; Step 7's `url`/`screen`). ──\n webUrl?: string | null;\n vncUrl?: string | null;\n vncEnabled?: boolean;\n // ── Adoption / reconstruction fields (non-secret; cloud boxes only, EXCEPT\n // originUrl which is populated for any registered box, docker included). ──\n sandboxId?: string;\n // Repo origin URL — the cross-machine project key `list` scopes by when a box's\n // projectRoot names no local directory (it's a remote hub's own path).\n originUrl?: string | null;\n publicHost?: string;\n image?: string;\n webPort?: number;\n previewUrls?: Record<number, string>;\n lastAgent?: 'claude' | 'codex' | 'opencode';\n topology?: string;\n}\n\n/** A create-job's status as `/api/v1/jobs/:id` (and each row of `/api/v1/jobs`) returns it. */\nexport interface HubApiJob {\n id: string;\n status: 'queued' | 'running' | 'done' | 'failed' | string;\n boxId?: string;\n /** A failed job's reason — surfaced so a create reports a failure, not a silent \"done\". */\n error?: string;\n provider?: string;\n name?: string;\n agent?: string;\n createdAt?: string;\n login?: {\n required?: boolean;\n phase?: string;\n url?: string;\n error?: string;\n lastError?: string;\n };\n}\n\n/** Body for `POST /api/v1/boxes` — mirrors the hub's `CreateBoxInput`. */\nexport interface HubApiCreateBoxInput {\n /** Exactly one of projectId / repoUrl. */\n projectId?: string;\n repoUrl?: string;\n agent: 'claude' | 'codex' | 'opencode' | 'none';\n provider?: string;\n name?: string;\n prompt?: string;\n agentArgs?: string[];\n startAgent?: boolean;\n /** A foreground (interactive) create — the hub runs it in the ungated lane. */\n foreground?: boolean;\n fromBranch?: string;\n setupWizard?: boolean;\n /** Box-shaping knobs (image, snapshot, limits, size/location, carry, ...). */\n opts?: Record<string, unknown>;\n}\n\n/**\n * A sandbox provider as `/api/v1/providers` returns it. Mirrors the hub's own\n * `ProviderOption`; only the fields a CLI/tray client reads are named here.\n */\nexport interface HubApiProvider {\n id: string;\n label: string;\n /** Base baked (or, for remote-docker, at least one host registered). */\n configured: boolean;\n hasCredentials?: boolean;\n /** Id of a bake already in flight for this provider, if any. */\n jobId?: string;\n reason?: string;\n /** Only present when the caller asked for `?freshness=1`. */\n baseStatus?: 'fresh' | 'stale' | 'unprepared' | 'unknown';\n baseStaleReason?: string;\n}\n\n/** A remote-docker host alias as `/api/v1/hosts` returns it. */\nexport interface HubApiHost {\n alias: string;\n ssh?: string;\n baked?: boolean;\n default?: boolean;\n /** The hub holds its own key for this host (it was shared with it). */\n managedKey?: boolean;\n}\n\n/** What a PC sends to share one of its own engines with a control box. */\nexport interface HubApiHostShare {\n alias: string;\n /** Human-facing connection string, as the sharer wrote it. */\n ssh: string;\n /** The `ssh -G` expansion — what the hub actually dials. */\n connection: { host: string; user?: string; port?: number };\n /** PEM of the key minted for the hub. Never returned by the API. */\n identity?: string;\n default?: boolean;\n}\n\n/** A pending host-action approval as `/api/v1/approvals` returns it. */\nexport interface HubApiApproval {\n id: string;\n boxId: string;\n message: string;\n detail?: string;\n command?: string;\n cwd?: string;\n argv?: string[];\n defaultAnswer: 'y' | 'n';\n createdAt: number;\n}\n\n/** Result of a box git/service op (mirrors the backend `BoxOpResult`). */\nexport interface HubApiOpResult {\n ok: boolean;\n stdout?: string;\n stderr?: string;\n error?: string;\n}\n\n/** One supervised service, as `GET /boxes/:id/services` returns it (mirrors the\n * backend `ServiceView`). The persisted-snapshot source fills pid/restarts/\n * lastExitCode/command with nulls/defaults. */\nexport interface HubApiServiceView {\n name: string;\n state: string;\n pid: number | null;\n restarts: number;\n lastExitCode: number | null;\n blockedOn: string[];\n command: string;\n}\n\n/**\n * A box's agentbox.yaml task/service/port status (mirrors the backend\n * `ServicesResult`). `source` says whether it came from a live in-box pull, the\n * persisted snapshot (box paused/stopped), or is unavailable (box gone / never\n * reported).\n */\nexport interface HubApiServices {\n source: 'live' | 'persisted' | 'unavailable';\n services: HubApiServiceView[];\n tasks: { name: string; state: string }[];\n ports: { port: number; service: string | null }[];\n error?: string;\n}\n\n// `screen` is the open-VNC prep step (points the in-box browser at the web app),\n// not a state transition — it rides the same route as the lifecycle actions.\nexport type HubLifecycleAction = 'start' | 'pause' | 'resume' | 'stop' | 'destroy' | 'screen';\nexport type HubGitOp = 'checkout' | 'branch' | 'pull' | 'push' | 'push-host';\n\n/** Result of `POST /boxes/:id/checkpoint` (a captured project checkpoint). */\nexport interface HubApiCheckpointCreate {\n ok: true;\n name: string;\n /** docker manifest type ('layered'/'merged') or 'snapshot' for a cloud backend. */\n kind: string;\n ref: string;\n provider: string;\n dir?: string;\n /** The default-checkpoint config key written when --set-default was requested. */\n setDefaultKey?: string;\n}\n\n/** One checkpoint row from `GET /checkpoints` (defaults resolved server-side). */\nexport interface HubApiCheckpointItem {\n name: string;\n provider: string;\n kind: string;\n sourceBoxName: string;\n createdAt: string;\n isDefault: boolean;\n}\n\nexport interface HubApiCheckpointProject {\n segment: string;\n projectRoot?: string;\n label: string;\n items: HubApiCheckpointItem[];\n}\n\nexport interface HubApiCheckpointListing {\n projects: HubApiCheckpointProject[];\n}\n\n/** Result of `DELETE /checkpoints` (removed backends + swept default pointers). */\nexport interface HubApiCheckpointRemove {\n ok: true;\n removed: string[];\n clearedKeys: string[];\n warnedKeys: string[];\n}\n\n/** The local (docker) prune tally — mirrors the backend PruneResultView. */\nexport interface HubApiPruneResult {\n removedRecords: string[];\n removedContainers: string[];\n removedVolumes: string[];\n removedSnapshotDirs: string[];\n removedBoxDirs: string[];\n removedCheckpointImages: string[];\n dryRun: boolean;\n}\n\nexport interface HubApiPruneGeneral {\n kind: 'general';\n result: HubApiPruneResult;\n projectConfigs: string[];\n}\n\nexport interface HubApiCloudOrphan {\n sandboxId: string;\n name?: string;\n state?: string;\n createdAt?: string;\n}\n\nexport interface HubApiPruneCloud {\n kind: 'cloud';\n provider: string;\n dryRun: boolean;\n orphans: HubApiCloudOrphan[];\n deleted: number;\n failed: number;\n reaped: number;\n}\n\nexport type HubApiPruneView = HubApiPruneGeneral | HubApiPruneCloud;\n\n/** `GET /boxes/:id/agent` — the raw BoxStatusClaude snapshot (null = none yet). */\nexport interface HubApiAgentState {\n claude: unknown;\n}\n\n/** The unauthenticated liveness probe (`GET /api/v1/health`). */\nexport interface HubApiHealth {\n ok: boolean;\n /** The API contract the hub serves, e.g. `v1`. Gated against {@link SUPPORTED_HUB_API_VERSIONS}. */\n apiVersion: string;\n /** The AgentBox version the hub runs (a control box may differ from this CLI). */\n version?: string;\n profile?: string;\n}\n\n/**\n * The `/api/v1` contract versions this CLI knows how to speak. The hub reports its\n * own on `GET /api/v1/health` (`apiVersion`); a hub outside this set is refused up\n * front with an upgrade hint rather than failing on a missing/changed field later.\n */\nexport const SUPPORTED_HUB_API_VERSIONS = ['v1'] as const;\n\nexport interface HubApiTarget {\n url: string;\n apiKey: string;\n fetchImpl?: typeof fetch;\n}\n\n/** An error carrying the `/api/v1` envelope's code + HTTP status (+ optional details). */\nexport class HubApiError extends Error {\n constructor(\n message: string,\n readonly code: string,\n readonly status: number,\n /**\n * The envelope's `error.details`, when present. Git ops carry the box\n * command's own `exitCode` here so a caller can surface a faithful exit\n * (e.g. 64 for `push --host-only` with no host checkout) that the coarse\n * code→exit mapping can't express.\n */\n readonly details?: unknown,\n ) {\n super(message);\n this.name = 'HubApiError';\n }\n}\n\ninterface ApiErrorBody {\n error?: { code?: string; message?: string; details?: unknown };\n}\n\nexport class HubApiClient {\n private readonly base: string;\n private readonly token: string;\n private readonly fetchImpl: typeof fetch;\n\n constructor(target: HubApiTarget) {\n this.base = target.url.replace(/\\/+$/, '');\n this.token = target.apiKey;\n this.fetchImpl = target.fetchImpl ?? fetch;\n }\n\n private async request<T>(method: string, path: string, body?: unknown): Promise<T> {\n const res = await this.fetchImpl(`${this.base}/api/v1${path}`, {\n method,\n headers: {\n Authorization: `Bearer ${this.token}`,\n ...(body !== undefined ? { 'Content-Type': 'application/json' } : {}),\n },\n ...(body !== undefined ? { body: JSON.stringify(body) } : {}),\n });\n if (res.status === 204) return undefined as T;\n const text = await res.text();\n let parsed: unknown;\n try {\n parsed = text.length > 0 ? JSON.parse(text) : {};\n } catch {\n throw new HubApiError(`unexpected non-JSON response (${res.status})`, 'internal', res.status);\n }\n if (!res.ok) {\n const err = (parsed as ApiErrorBody).error;\n throw new HubApiError(\n err?.message ?? `request failed: ${res.status}`,\n err?.code ?? 'internal',\n res.status,\n err?.details,\n );\n }\n return parsed as T;\n }\n\n /**\n * Liveness + API-version probe. Unauthenticated on the hub (the Bearer we send\n * is harmless), so it also confirms the hub is reachable before an authed call.\n * Throws `HubApiError` on a non-2xx (e.g. a hub too old to expose `/api/v1`).\n */\n health(): Promise<HubApiHealth> {\n return this.request<HubApiHealth>('GET', '/health');\n }\n\n /**\n * All boxes the hub knows (its own + registered). Topology-agnostic read.\n * `live` (opt-in, expensive — mirrors `listProviders({ freshness })`) asks the\n * hub to refresh each cloud box's `state` with an authoritative SDK probe; the\n * default serves the fast persisted state.\n */\n async listBoxes(opts: { live?: boolean } = {}): Promise<HubApiBox[]> {\n const q = opts.live ? '?live=1' : '';\n return (await this.request<{ boxes: HubApiBox[] }>('GET', `/boxes${q}`)).boxes;\n }\n\n /** One box by id (throws HubApiError 'not_found' when absent). */\n getBox(id: string): Promise<HubApiBox> {\n return this.request<HubApiBox>('GET', `/boxes/${encodeURIComponent(id)}`);\n }\n\n /**\n * Mint the box's ready-to-open noVNC viewer URL. Resolves live rather than\n * reading the Box payload's `vncUrl`, which is null for daytona/vercel/e2b:\n * their signed preview URLs expire, so they can't ride a listing. Throws\n * HubApiError 'conflict' when the box isn't running or has VNC disabled.\n */\n vncUrl(id: string, opts: { ttl?: number } = {}): Promise<{ url: string; ttl?: number }> {\n const q = opts.ttl === undefined ? '' : `?ttl=${String(opts.ttl)}`;\n return this.request<{ url: string; ttl?: number }>(\n 'GET',\n `/boxes/${encodeURIComponent(id)}/vnc${q}`,\n );\n }\n\n /**\n * Resolve a box ref (`id | name | sandbox id | index`) server-side, mirroring\n * the CLI's local `findBox`. Returns the match SET: `[]`=none, `[box]`=unique,\n * `[…]`=an ambiguous id prefix (the caller disambiguates). `project` (an\n * absolute host project root) enables numeric project-index resolution.\n */\n async resolveBox(ref: string, project?: string): Promise<HubApiBox[]> {\n const q = new URLSearchParams({ ref });\n if (project !== undefined) q.set('project', project);\n return (await this.request<{ boxes: HubApiBox[] }>('GET', `/boxes?${q.toString()}`)).boxes;\n }\n\n /** Lifecycle action on a box. Reverse-adoption lets the hub drive registered-only boxes. */\n async lifecycle(id: string, action: HubLifecycleAction): Promise<void> {\n await this.request<{ ok: true }>('POST', `/boxes/${encodeURIComponent(id)}/${action}`);\n }\n\n /**\n * Real destroy: tears down the cloud resource AND reaps the hub's\n * registration/custody. `keepSnapshot` preserves a docker box's local snapshot\n * dir (mirrors the CLI's `--keep-snapshot`), so it travels on the request body.\n */\n async destroy(id: string, opts: { keepSnapshot?: boolean } = {}): Promise<void> {\n await this.request<{ ok: true }>('POST', `/boxes/${encodeURIComponent(id)}/destroy`, opts);\n }\n\n /** A git op against the box's branch. */\n git(id: string, op: HubGitOp, body: Record<string, unknown> = {}): Promise<HubApiOpResult> {\n return this.request<HubApiOpResult>('POST', `/boxes/${encodeURIComponent(id)}/git/${op}`, body);\n }\n\n /**\n * Create a box (async). Forks server-side: a `projectId` with a local workspace\n * → the file queue; a `repoUrl` (or a projectId with no local folder) → the\n * control-plane clone queue. Returns the background job id; progress streams\n * over {@link streamJobLog} and the verdict comes from {@link getJob}.\n */\n async createBox(body: HubApiCreateBoxInput): Promise<{ jobId: string }> {\n return this.request<{ jobId: string }>('POST', '/boxes', body);\n }\n\n /** Create-job status (poll until done/failed). */\n getJob(id: string): Promise<HubApiJob> {\n return this.request<HubApiJob>('GET', `/jobs/${encodeURIComponent(id)}`);\n }\n\n /** The unified background-job listing (`queue list` / `hub jobs`). Newest first. */\n async listJobs(): Promise<HubApiJob[]> {\n return (await this.request<{ jobs: HubApiJob[] }>('GET', '/jobs')).jobs;\n }\n\n /**\n * Deliver a pasted OAuth code to a create job awaiting a Claude re-login (the\n * one interactive create affordance). The worker consumes it from the manifest.\n */\n async submitLoginCode(id: string, code: string): Promise<void> {\n await this.request<{ ok: true }>('POST', `/jobs/${encodeURIComponent(id)}/login-code`, {\n code,\n });\n }\n\n /**\n * The hub's sandbox providers. `freshness` additionally reports base staleness\n * (`baseStatus`/`baseStaleReason`), which the hub computes by hashing its own\n * build context — the expensive path, so it stays opt-in there too.\n */\n async listProviders(opts: { freshness?: boolean } = {}): Promise<HubApiProvider[]> {\n const q = opts.freshness ? '?freshness=1' : '';\n return (await this.request<{ providers: HubApiProvider[] }>('GET', `/providers${q}`)).providers;\n }\n\n /** The remote-docker host aliases the hub itself has registered. */\n async listHosts(): Promise<HubApiHost[]> {\n return (await this.request<{ hosts: HubApiHost[] }>('GET', '/hosts')).hosts;\n }\n\n /**\n * Register one of THIS machine's remote-docker engines on the hub, with the\n * connection + key it needs to reach it itself. The hub probes ssh + docker\n * before saving, so a resolved promise means the hub really got there.\n */\n async addHost(body: HubApiHostShare): Promise<void> {\n await this.request<{ ok: true }>('POST', '/hosts', body);\n }\n\n /** Forget a host on the hub. Boxes already created against it are reported. */\n async removeHost(alias: string): Promise<{ boxesAffected?: string[] }> {\n return await this.request<{ boxesAffected?: string[] }>(\n 'DELETE',\n `/hosts/${encodeURIComponent(alias)}`,\n );\n }\n\n /**\n * Bake the box image on one of the HUB's remote-docker hosts. Returns a job id\n * that streams over {@link streamJobLog}, exactly like a provider bake.\n */\n async bakeHost(alias: string): Promise<string> {\n const res = await this.request<{ jobId: string }>(\n 'POST',\n `/hosts/${encodeURIComponent(alias)}/bake`,\n );\n return res.jobId;\n }\n\n /**\n * Persist a provider's credentials ON the hub: the hub validates the given\n * canonical fields (e.g. `{ apiKey }`, `{ token, teamId?, projectId? }`) against\n * the cloud, then writes them to its own `~/.agentbox/secrets.env`. Never echoes\n * secret values. A rejected token surfaces as `HubApiError('invalid_request')`.\n */\n async setProviderCredentials(id: string, fields: Record<string, string>): Promise<void> {\n await this.request<{ ok: true }>(\n 'POST',\n `/providers/${encodeURIComponent(id)}/credentials`,\n fields,\n );\n }\n\n /**\n * Bake a provider's base ON the hub. Async: returns the id of a background job\n * whose progress streams over {@link streamJobLog}.\n */\n async prepareProvider(\n id: string,\n body: {\n force?: boolean;\n claudeInstall?: 'native' | 'npm';\n build?: boolean;\n size?: string;\n location?: string;\n name?: string;\n } = {},\n ): Promise<string> {\n const res = await this.request<{ jobId: string }>(\n 'POST',\n `/providers/${encodeURIComponent(id)}/prepare`,\n body,\n );\n return res.jobId;\n }\n\n /**\n * Stream a job's log lines until the server closes the SSE stream.\n *\n * Deliberately NOT routed through `request`: the response is an event stream,\n * not JSON, and consuming it as text would buffer the whole bake (minutes of\n * silence) before printing anything. Resolves when the stream ends; the caller\n * still polls {@link getJob} for the terminal verdict, since a dropped\n * connection must not read as a successful bake.\n */\n async streamJobLog(\n id: string,\n onLine: (line: string) => void,\n signal?: AbortSignal,\n ): Promise<void> {\n const res = await this.fetchImpl(`${this.base}/api/v1/jobs/${encodeURIComponent(id)}/logs`, {\n headers: { Authorization: `Bearer ${this.token}`, Accept: 'text/event-stream' },\n signal,\n });\n if (!res.ok || !res.body) return;\n const decoder = new TextDecoder();\n let buffer = '';\n for await (const chunk of res.body as unknown as AsyncIterable<Uint8Array>) {\n buffer += decoder.decode(chunk, { stream: true });\n // SSE frames are blank-line separated; a partial trailing frame stays in\n // the buffer until the rest of it arrives.\n const frames = buffer.split('\\n\\n');\n buffer = frames.pop() ?? '';\n for (const frame of frames) {\n let event = '';\n let data = '';\n for (const raw of frame.split('\\n')) {\n if (raw.startsWith('event:')) event = raw.slice(6).trim();\n else if (raw.startsWith('data:')) data = raw.slice(5).trim();\n }\n // `open`/`end`/`login` carry structured state the caller gets from\n // getJob instead; only the log lines belong on screen.\n if (event !== 'log' || data.length === 0) continue;\n try {\n const line = JSON.parse(data) as unknown;\n if (typeof line === 'string' && line.length > 0) onLine(line);\n } catch {\n /* a frame we can't parse is not worth failing a bake over */\n }\n }\n }\n }\n\n /** Pending host-action approvals across every box. */\n async listApprovals(): Promise<HubApiApproval[]> {\n return (await this.request<{ approvals: HubApiApproval[] }>('GET', '/approvals')).approvals;\n }\n\n /**\n * Answer a pending approval by id. `cancelled` marks a dismissal distinctly\n * from a plain deny in the audit trail (the `agent approve --cancel` capability);\n * it still resolves the parked action as not-approved.\n */\n async answerApproval(id: string, answer: 'y' | 'n', cancelled?: boolean): Promise<void> {\n await this.request<{ ok: true }>('POST', `/approvals/${encodeURIComponent(id)}/answer`, {\n answer,\n ...(cancelled === true ? { cancelled: true } : {}),\n });\n }\n\n /**\n * The box's agentbox.yaml service/task/port status — a live in-box pull when the\n * box is running, else the persisted snapshot (so a paused box still reports),\n * matching what `agentbox status` shows.\n */\n getServices(id: string): Promise<HubApiServices> {\n return this.request<HubApiServices>('GET', `/boxes/${encodeURIComponent(id)}/services`);\n }\n\n /** Restart one service by name, or every service when `name` is omitted. */\n restartService(id: string, name?: string): Promise<HubApiOpResult> {\n return this.request<HubApiOpResult>(\n 'POST',\n `/boxes/${encodeURIComponent(id)}/services/restart`,\n name ? { name } : {},\n );\n }\n\n /**\n * Set (or clear, with an empty string) a box's cosmetic display label. Pure\n * state — the container / git branch / URL are untouched.\n */\n async rename(id: string, displayName: string): Promise<void> {\n await this.request<{ ok: true }>('POST', `/boxes/${encodeURIComponent(id)}/rename`, {\n displayName,\n });\n }\n\n // ── checkpoints (durable project assets) ──\n\n /** Capture the box state as a project checkpoint (docker commit / cloud snapshot). */\n createCheckpoint(\n id: string,\n body: { name?: string; merged?: boolean; setDefault?: boolean; replace?: boolean } = {},\n ): Promise<HubApiCheckpointCreate> {\n return this.request<HubApiCheckpointCreate>(\n 'POST',\n `/boxes/${encodeURIComponent(id)}/checkpoint`,\n body,\n );\n }\n\n /** List a project's checkpoints (docker + cloud), or every project's with `global`. */\n listCheckpoints(\n opts: { project?: string; global?: boolean } = {},\n ): Promise<HubApiCheckpointListing> {\n const q = new URLSearchParams();\n if (opts.global) q.set('global', '1');\n if (opts.project !== undefined) q.set('project', opts.project);\n return this.request<HubApiCheckpointListing>('GET', `/checkpoints?${q.toString()}`);\n }\n\n /** Delete a checkpoint from every store that has it (or just `provider`'s). */\n deleteCheckpoint(opts: {\n project: string;\n ref: string;\n provider?: string;\n }): Promise<HubApiCheckpointRemove> {\n const q = new URLSearchParams({ project: opts.project, ref: opts.ref });\n if (opts.provider !== undefined) q.set('provider', opts.provider);\n return this.request<HubApiCheckpointRemove>('DELETE', `/checkpoints?${q.toString()}`);\n }\n\n // ── prune (fleet cleanup) ──\n\n /**\n * Prune orphan fleet resources. Without `provider` (or provider === 'docker'):\n * orphan docker records/resources + project configs. With a cloud provider:\n * enumerate untracked sandboxes, deleting + reaping when !dryRun.\n */\n prune(\n body: { all?: boolean; dryRun?: boolean; provider?: string } = {},\n ): Promise<HubApiPruneView> {\n return this.request<HubApiPruneView>('POST', '/prune', body);\n }\n\n // ── agent state ──\n\n /** The box's in-box coding-agent status snapshot (Claude activity/plan/question). */\n getAgentState(id: string): Promise<HubApiAgentState> {\n return this.request<HubApiAgentState>('GET', `/boxes/${encodeURIComponent(id)}/agent`);\n }\n\n // ── box service logs ──\n\n /** Non-follow tail of a service log (or the ctl-daemon log with `daemon`). */\n async getBoxLogs(\n id: string,\n params: { service?: string; tail: number; daemon?: boolean },\n ): Promise<{ output: string }> {\n return this.request<{ output: string }>(\n 'GET',\n `/boxes/${encodeURIComponent(id)}/logs?${logQuery(params).toString()}`,\n );\n }\n\n /**\n * Follow a service log over SSE, invoking `onLine` for each `log` event until the\n * hub closes the stream. Resolves with the terminal status (from the `end` event,\n * or 'gone' if the stream dropped). A non-2xx answer (e.g. box not found) throws\n * a {@link HubApiError} so `withOwningHub` can retry the other hub — mirrors\n * {@link streamJobLog}, which deliberately bypasses `request` for the same reason.\n */\n async streamBoxLog(\n id: string,\n params: { service?: string; tail: number; daemon?: boolean },\n onLine: (line: string) => void,\n signal?: AbortSignal,\n ): Promise<{ status: string }> {\n const res = await this.fetchImpl(\n `${this.base}/api/v1/boxes/${encodeURIComponent(id)}/logs?${logQuery({ ...params, follow: true }).toString()}`,\n { headers: { Authorization: `Bearer ${this.token}`, Accept: 'text/event-stream' }, signal },\n );\n if (!res.ok) {\n // The route answers a bad request / missing box with the JSON error envelope,\n // not an SSE stream — surface it as a HubApiError like `request` does.\n const text = await res.text().catch(() => '');\n let body: ApiErrorBody = {};\n try {\n body = text.length > 0 ? (JSON.parse(text) as ApiErrorBody) : {};\n } catch {\n /* non-JSON error body */\n }\n throw new HubApiError(\n body.error?.message ?? `request failed: ${res.status}`,\n body.error?.code ?? 'internal',\n res.status,\n body.error?.details,\n );\n }\n if (!res.body) return { status: 'gone' };\n const decoder = new TextDecoder();\n let buffer = '';\n let status = 'gone';\n try {\n for await (const chunk of res.body as unknown as AsyncIterable<Uint8Array>) {\n buffer += decoder.decode(chunk, { stream: true });\n const frames = buffer.split('\\n\\n');\n buffer = frames.pop() ?? '';\n for (const frame of frames) {\n let event = '';\n let data = '';\n for (const raw of frame.split('\\n')) {\n if (raw.startsWith('event:')) event = raw.slice(6).trim();\n else if (raw.startsWith('data:')) data = raw.slice(5).trim();\n }\n if (data.length === 0) continue;\n if (event === 'log') {\n try {\n const line = JSON.parse(data) as unknown;\n if (typeof line === 'string') onLine(line);\n } catch {\n /* a frame we can't parse is not worth aborting the stream over */\n }\n } else if (event === 'end') {\n try {\n const parsed = JSON.parse(data) as { status?: string };\n if (typeof parsed.status === 'string') status = parsed.status;\n } catch {\n /* keep the default */\n }\n }\n }\n }\n } catch (err) {\n // A caller-requested abort (Ctrl-C on a `-f` follow) surfaces as an\n // AbortError from the streaming read — that's a clean stop, not a failure,\n // so don't let it bubble to withHubClient's \"can't reach the hub\" mapper.\n if (signal?.aborted) return { status: 'aborted' };\n throw err;\n }\n return { status };\n }\n}\n\n/** Build the shared `/boxes/:id/logs` query string (service/tail/daemon/follow). */\nfunction logQuery(params: {\n service?: string;\n tail: number;\n daemon?: boolean;\n follow?: boolean;\n}): URLSearchParams {\n const q = new URLSearchParams();\n q.set('tail', String(params.tail));\n if (params.service !== undefined) q.set('service', params.service);\n if (params.daemon) q.set('daemon', '1');\n if (params.follow) q.set('follow', '1');\n return q;\n}\n"],"mappings":";;;AAySO,IAAM,6BAA6B,CAAC,IAAI;AASxC,IAAM,cAAN,cAA0B,MAAM;AAAA,EACrC,YACE,SACS,MACA,QAOA,SACT;AACA,UAAM,OAAO;AAVJ;AACA;AAOA;AAGT,SAAK,OAAO;AAAA,EACd;AAAA,EAZW;AAAA,EACA;AAAA,EAOA;AAKb;AAMO,IAAM,eAAN,MAAmB;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EAEjB,YAAY,QAAsB;AAChC,SAAK,OAAO,OAAO,IAAI,QAAQ,QAAQ,EAAE;AACzC,SAAK,QAAQ,OAAO;AACpB,SAAK,YAAY,OAAO,aAAa;AAAA,EACvC;AAAA,EAEA,MAAc,QAAW,QAAgB,MAAc,MAA4B;AACjF,UAAM,MAAM,MAAM,KAAK,UAAU,GAAG,KAAK,IAAI,UAAU,IAAI,IAAI;AAAA,MAC7D;AAAA,MACA,SAAS;AAAA,QACP,eAAe,UAAU,KAAK,KAAK;AAAA,QACnC,GAAI,SAAS,SAAY,EAAE,gBAAgB,mBAAmB,IAAI,CAAC;AAAA,MACrE;AAAA,MACA,GAAI,SAAS,SAAY,EAAE,MAAM,KAAK,UAAU,IAAI,EAAE,IAAI,CAAC;AAAA,IAC7D,CAAC;AACD,QAAI,IAAI,WAAW,IAAK,QAAO;AAC/B,UAAM,OAAO,MAAM,IAAI,KAAK;AAC5B,QAAI;AACJ,QAAI;AACF,eAAS,KA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