@madarco/agentbox 0.28.1 → 0.29.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (452) hide show
  1. package/CHANGELOG.md +146 -0
  2. package/dist/_cloud-attach-EUO2OL7W.js +30 -0
  3. package/dist/chunk-2JHPGPLE.js +71 -0
  4. package/dist/chunk-2JHPGPLE.js.map +1 -0
  5. package/dist/{chunk-JQLOGVZK.js → chunk-4KYP775X.js} +85 -21
  6. package/dist/chunk-4KYP775X.js.map +1 -0
  7. package/dist/{chunk-V5NWSLWD.js → chunk-4NUETVTR.js} +14 -14
  8. package/dist/{chunk-OXKW4GWD.js → chunk-53OTEDBS.js} +4 -70
  9. package/dist/chunk-53OTEDBS.js.map +1 -0
  10. package/dist/{chunk-FGQFVUMH.js → chunk-6YSYQZRH.js} +3 -3
  11. package/dist/{chunk-KFLGXE3R.js → chunk-73D2HKA3.js} +138 -24
  12. package/dist/chunk-73D2HKA3.js.map +1 -0
  13. package/dist/{chunk-HYXCH4GA.js → chunk-7LC5IG5K.js} +7 -7
  14. package/dist/{chunk-NHVGKFVY.js → chunk-7LNXTPEE.js} +340 -22
  15. package/dist/chunk-7LNXTPEE.js.map +1 -0
  16. package/dist/{chunk-74VIUGY6.js → chunk-A2TATHHJ.js} +6 -9
  17. package/dist/chunk-A2TATHHJ.js.map +1 -0
  18. package/dist/{chunk-YI4GHC2E.js → chunk-AC3HU25W.js} +12 -15
  19. package/dist/chunk-AC3HU25W.js.map +1 -0
  20. package/dist/{chunk-7ABO7OIF.js → chunk-AUHYXXCA.js} +4 -4
  21. package/dist/{chunk-FPMRFMVK.js → chunk-B4YFG5TB.js} +9 -9
  22. package/dist/{chunk-OUF3YTQO.js → chunk-BIKWXLX7.js} +14 -17
  23. package/dist/chunk-BIKWXLX7.js.map +1 -0
  24. package/dist/{chunk-CKD3PRON.js → chunk-CZPVVFCF.js} +12 -9
  25. package/dist/{chunk-CKD3PRON.js.map → chunk-CZPVVFCF.js.map} +1 -1
  26. package/dist/chunk-F4PPZ4SI.js +17 -0
  27. package/dist/chunk-F4PPZ4SI.js.map +1 -0
  28. package/dist/{chunk-BWM56FKY.js → chunk-FEFLAITR.js} +11 -11
  29. package/dist/{chunk-EVT2SNF2.js → chunk-FELVUIIM.js} +3 -3
  30. package/dist/{chunk-46NNZMZT.js → chunk-I2DEYQLZ.js} +372 -72
  31. package/dist/chunk-I2DEYQLZ.js.map +1 -0
  32. package/dist/{chunk-OUWVN2F2.js → chunk-I7BSBUPC.js} +16 -13
  33. package/dist/chunk-I7BSBUPC.js.map +1 -0
  34. package/dist/{chunk-G3H2L3O2.js → chunk-MNDKP4VS.js} +23 -3
  35. package/dist/chunk-MNDKP4VS.js.map +1 -0
  36. package/dist/{chunk-BUMKBUXS.js → chunk-PAWAGULH.js} +3 -3
  37. package/dist/{chunk-4PR3KJ5X.js → chunk-PFEBKXFD.js} +20 -20
  38. package/dist/{chunk-JDSYMTMS.js → chunk-QDU7YDME.js} +130 -66
  39. package/dist/chunk-QDU7YDME.js.map +1 -0
  40. package/dist/{chunk-JNC7MCWJ.js → chunk-S32GHLVU.js} +10 -10
  41. package/dist/chunk-S32GHLVU.js.map +1 -0
  42. package/dist/{chunk-WB6S4W7O.js → chunk-THKVKVRF.js} +2413 -1012
  43. package/dist/chunk-THKVKVRF.js.map +1 -0
  44. package/dist/{chunk-7RSE7ESY.js → chunk-UEEW5TW7.js} +27 -18
  45. package/dist/chunk-UEEW5TW7.js.map +1 -0
  46. package/dist/{chunk-B4DAH2F2.js → chunk-UTOC2NHC.js} +3 -3
  47. package/dist/{chunk-NHTRTST5.js → chunk-WDBDFLH3.js} +38 -15
  48. package/dist/chunk-WDBDFLH3.js.map +1 -0
  49. package/dist/{chunk-PSA6GADQ.js → chunk-WHFCJBMO.js} +14 -1
  50. package/dist/chunk-WHFCJBMO.js.map +1 -0
  51. package/dist/{chunk-KJ5TCYNI.js → chunk-WJUKN4L4.js} +7 -6
  52. package/dist/chunk-WJUKN4L4.js.map +1 -0
  53. package/dist/{chunk-GFOWBXV7.js → chunk-XENTK32L.js} +463 -253
  54. package/dist/chunk-XENTK32L.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-YQFX2ILX.js} +19 -18
  58. package/dist/cp-hub-upload-RMJ3XJ65.js +81 -0
  59. package/dist/cp-hub-upload-RMJ3XJ65.js.map +1 -0
  60. package/dist/{custody-client-PNCC2HBJ.js → custody-client-L4FEFW4C.js} +5 -4
  61. package/dist/{deploy-hetzner-SSGSXAKA.js → deploy-hetzner-EECQ4JCM.js} +10 -10
  62. package/dist/{dist-RN6JOAG4.js → dist-3BKIPZR3.js} +81 -45
  63. package/dist/{dist-K5M4HKG7.js → dist-C5B6NGBO.js} +21 -9
  64. package/dist/{dist-6PYXFREL.js → dist-E5EXDZG4.js} +61 -16
  65. package/dist/dist-E5EXDZG4.js.map +1 -0
  66. package/dist/{dist-XATN4ZIR.js → dist-FBM2WS5S.js} +22 -4
  67. package/dist/{dist-XQLKK7H3.js → dist-NFF2KEMB.js} +54 -28
  68. package/dist/dist-NFF2KEMB.js.map +1 -0
  69. package/dist/{dist-5OR4QTQW.js → dist-NTUHJOK3.js} +9 -9
  70. package/dist/{dist-ZNQZHTUN.js → dist-PTYASENV.js} +35 -6
  71. package/dist/{dist-POILUDVJ.js → dist-Q4UDCSZQ.js} +9 -9
  72. package/dist/{dist-M4O5MU5K.js → dist-TXFTYNNE.js} +8 -8
  73. package/dist/{dist-EPFS5PRI.js → dist-XUOHE22G.js} +10 -10
  74. package/dist/{dist-SN2TCRZ5.js → dist-Z2TPC3EN.js} +9 -9
  75. package/dist/host-reach-drainer-N4JSFUBY.js +9 -0
  76. package/dist/hub-3HPYOV5O.js +37 -0
  77. package/dist/{hub-adopt-I44VGSBL.js → hub-adopt-NCCCMMXL.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-ZKAWXVPH.js} +16 -16
  80. package/dist/index.js +1321 -882
  81. package/dist/index.js.map +1 -1
  82. package/dist/prepare-KIVDQRMN.js +41 -0
  83. package/dist/prepared-custody-EFSOOAIQ.js +36 -0
  84. package/dist/{prepared-state-PV3GUBHO-MF56HWMZ.js → prepared-state-LNQ7DYSU-2YFSDOCV.js} +4 -3
  85. package/dist/{publish-credentials-BPHUO5VL.js → publish-credentials-F2A5OVCO.js} +11 -11
  86. package/dist/registry-O3X2CDDU.js +18 -0
  87. package/dist/relay-3T57T4RI.js +20 -0
  88. package/dist/relay-3T57T4RI.js.map +1 -0
  89. package/dist/{remote-docker-share-RX5ARK45.js → remote-docker-share-QDCBM5UM.js} +11 -11
  90. package/dist/remote-docker-share-QDCBM5UM.js.map +1 -0
  91. package/dist/tool-grant-push-6ISDIJKH.js +90 -0
  92. package/dist/tool-grant-push-6ISDIJKH.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 +6760 -5299
  96. package/runtime/_shared/gh-shim +103 -228
  97. package/runtime/digitalocean/agentbox-tool-shim +21 -0
  98. package/runtime/digitalocean/ctl.cjs +6760 -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 +6760 -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 +6760 -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 +6760 -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-QU3FFGJY.js → chunk-2WB3A5IN.js} +11 -14
  336. package/runtime/hub/apps/hub/{chunk-LPYK2354.js → chunk-5ABFGGPT.js} +339 -21
  337. package/runtime/hub/apps/hub/{chunk-VKOCY6SX.js → chunk-BI4MPGQT.js} +49 -14
  338. package/runtime/hub/apps/hub/{chunk-UMPTTQBE.js → chunk-G6FJR7TN.js} +461 -251
  339. package/runtime/hub/apps/hub/{chunk-KTVETF3F.js → chunk-QGAP34GN.js} +11 -8
  340. package/runtime/hub/apps/hub/{chunk-5TM7XXLT.js → chunk-QWSP6WJ2.js} +2833 -1277
  341. package/runtime/hub/apps/hub/{chunk-EZUK53CC.js → chunk-RPPOFMPA.js} +85 -21
  342. package/runtime/hub/apps/hub/{chunk-3LAHFDJF.js → chunk-VWQNSZGI.js} +22 -2
  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-JVEDVVVG.js → dist-4F6XEJHK.js} +7 -7
  346. package/runtime/hub/apps/hub/{dist-2YP57GMB.js → dist-A3JOKKYG.js} +13 -13
  347. package/runtime/hub/apps/hub/{dist-D265LCAN.js → dist-CGH7PEMZ.js} +21 -3
  348. package/runtime/hub/apps/hub/{dist-SYWTB6RD.js → dist-F547YSBE.js} +15 -18
  349. package/runtime/hub/apps/hub/{dist-YK5FFPXZ.js → dist-FEHV4PC7.js} +62 -20
  350. package/runtime/hub/apps/hub/{dist-NKCXH5DW.js → dist-P7NT6VLK.js} +6 -6
  351. package/runtime/hub/apps/hub/{dist-E2FTSTCY.js → dist-W2YXTEQN.js} +34 -5
  352. package/runtime/hub/apps/hub/{dist-ELZHBQEM.js → dist-W5SGEJLA.js} +11 -11
  353. package/runtime/hub/apps/hub/{dist-N3E5YAYY.js → dist-YB3Y2XDK.js} +53 -26
  354. package/runtime/hub/apps/hub/{dist-5HTJSOHS.js → dist-ZTJMZLED.js} +19 -7
  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-I5QBLSRU.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-4I7FNNNS.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 +16626 -14688
  371. package/runtime/vercel/agentbox-tool-shim +21 -0
  372. package/runtime/vercel/ctl.cjs +6760 -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-EUO2OL7W.js.map} +0 -0
  417. /package/dist/{chunk-V5NWSLWD.js.map → chunk-4NUETVTR.js.map} +0 -0
  418. /package/dist/{chunk-FGQFVUMH.js.map → chunk-6YSYQZRH.js.map} +0 -0
  419. /package/dist/{chunk-HYXCH4GA.js.map → chunk-7LC5IG5K.js.map} +0 -0
  420. /package/dist/{chunk-7ABO7OIF.js.map → chunk-AUHYXXCA.js.map} +0 -0
  421. /package/dist/{chunk-FPMRFMVK.js.map → chunk-B4YFG5TB.js.map} +0 -0
  422. /package/dist/{chunk-BWM56FKY.js.map → chunk-FEFLAITR.js.map} +0 -0
  423. /package/dist/{chunk-EVT2SNF2.js.map → chunk-FELVUIIM.js.map} +0 -0
  424. /package/dist/{chunk-BUMKBUXS.js.map → chunk-PAWAGULH.js.map} +0 -0
  425. /package/dist/{chunk-4PR3KJ5X.js.map → chunk-PFEBKXFD.js.map} +0 -0
  426. /package/dist/{chunk-B4DAH2F2.js.map → chunk-UTOC2NHC.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-YQFX2ILX.js.map} +0 -0
  429. /package/dist/{custody-client-PNCC2HBJ.js.map → custody-client-L4FEFW4C.js.map} +0 -0
  430. /package/dist/{deploy-hetzner-SSGSXAKA.js.map → deploy-hetzner-EECQ4JCM.js.map} +0 -0
  431. /package/dist/{dist-5OR4QTQW.js.map → dist-3BKIPZR3.js.map} +0 -0
  432. /package/dist/{dist-EPFS5PRI.js.map → dist-C5B6NGBO.js.map} +0 -0
  433. /package/dist/{dist-K5M4HKG7.js.map → dist-FBM2WS5S.js.map} +0 -0
  434. /package/dist/{dist-M4O5MU5K.js.map → dist-NTUHJOK3.js.map} +0 -0
  435. /package/dist/{dist-POILUDVJ.js.map → dist-PTYASENV.js.map} +0 -0
  436. /package/dist/{dist-RN6JOAG4.js.map → dist-Q4UDCSZQ.js.map} +0 -0
  437. /package/dist/{dist-SN2TCRZ5.js.map → dist-TXFTYNNE.js.map} +0 -0
  438. /package/dist/{dist-XATN4ZIR.js.map → dist-XUOHE22G.js.map} +0 -0
  439. /package/dist/{dist-ZNQZHTUN.js.map → dist-Z2TPC3EN.js.map} +0 -0
  440. /package/dist/{hub-MJ7O4WXW.js.map → host-reach-drainer-N4JSFUBY.js.map} +0 -0
  441. /package/dist/{hub-adopt-I44VGSBL.js.map → hub-3HPYOV5O.js.map} +0 -0
  442. /package/dist/{hub-api-client-WJPBXZAZ.js.map → hub-adopt-NCCCMMXL.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-ZKAWXVPH.js.map} +0 -0
  445. /package/dist/{prepared-custody-QIXW7MJM.js.map → prepare-KIVDQRMN.js.map} +0 -0
  446. /package/dist/{prepared-state-PV3GUBHO-MF56HWMZ.js.map → prepared-custody-EFSOOAIQ.js.map} +0 -0
  447. /package/dist/{relay-DRDELF6B.js.map → prepared-state-LNQ7DYSU-2YFSDOCV.js.map} +0 -0
  448. /package/dist/{publish-credentials-BPHUO5VL.js.map → publish-credentials-F2A5OVCO.js.map} +0 -0
  449. /package/dist/{remote-docker-share-RX5ARK45.js.map → registry-O3X2CDDU.js.map} +0 -0
  450. /package/runtime/hub/apps/hub/.next/static/{z7_2bKU93xE7GwllL1Duv → nDHi_1342DzyGDC14ocQo}/_buildManifest.js +0 -0
  451. /package/runtime/hub/apps/hub/.next/static/{z7_2bKU93xE7GwllL1Duv → nDHi_1342DzyGDC14ocQo}/_clientMiddlewareManifest.js +0 -0
  452. /package/runtime/hub/apps/hub/.next/static/{z7_2bKU93xE7GwllL1Duv → nDHi_1342DzyGDC14ocQo}/_ssgManifest.js +0 -0
@@ -3,7 +3,7 @@ import {
3
3
  HubBoxNotFoundError,
4
4
  adoptHubBox,
5
5
  pullBoxSshKeys
6
- } from "./chunk-7ABO7OIF.js";
6
+ } from "./chunk-AUHYXXCA.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-QDU7YDME.js";
18
18
  import {
19
- loadControlPlaneEnv
20
- } from "./chunk-5F34YIRI.js";
19
+ CustodyClient
20
+ } from "./chunk-PAWAGULH.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-WDBDFLH3.js";
34
34
  import {
35
35
  handleLifecycleError
36
- } from "./chunk-FGQFVUMH.js";
36
+ } from "./chunk-6YSYQZRH.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-I2DEYQLZ.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-XENTK32L.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-UEEW5TW7.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,oE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AK,EACxC;AAAA,EACC;AAGF,EACC,WAAW,UAAU,EAAE,WAAW,KAAK,CAAC,EACxC,WAAW,SAAS,EACpB,WAAW,SAAS,EACpB,WAAW,OAAO,EAClB,WAAW,UAAU,EACrB,WAAW,OAAO,EAClB,WAAW,QAAQ;AAKtB,WAAW,OAAO,wBAAyB,YAAW,WAAW,GAAG;","names":["log","spinner","Command","Command","s","spinner","log"]}
@@ -26,7 +26,7 @@ async function controlBoxIsThisMachine() {
26
26
  try {
27
27
  const [{ readFile }, { controlPlaneDeployPath }] = await Promise.all([
28
28
  import("fs/promises"),
29
- import("./dist-ZNQZHTUN.js")
29
+ import("./dist-PTYASENV.js")
30
30
  ]);
31
31
  const raw = await readFile(controlPlaneDeployPath(), "utf8");
32
32
  return JSON.parse(raw).provider === "local";
@@ -39,7 +39,7 @@ async function dockerProviderRefusal(effective, providerName, remoteHost, contex
39
39
  if (!dockerProvidersHidden(effective)) return null;
40
40
  if (await controlBoxIsThisMachine()) return null;
41
41
  if (providerName === "remote-docker") {
42
- const { hubCanRunEngine } = await import("./remote-docker-share-RX5ARK45.js");
42
+ const { hubCanRunEngine } = await import("./remote-docker-share-QDCBM5UM.js");
43
43
  if (await hubCanRunEngine(providerName, remoteHost, effective)) return null;
44
44
  }
45
45
  return dockerHiddenMessage(effective, context, remoteHost);
@@ -54,4 +54,4 @@ export {
54
54
  controlBoxIsThisMachine,
55
55
  dockerProviderRefusal
56
56
  };
57
- //# sourceMappingURL=chunk-B4DAH2F2.js.map
57
+ //# sourceMappingURL=chunk-UTOC2NHC.js.map
@@ -1,21 +1,22 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  handleLifecycleError
4
- } from "./chunk-FGQFVUMH.js";
4
+ } from "./chunk-6YSYQZRH.js";
5
5
  import {
6
6
  ensureRelay,
7
7
  getRelayStatus,
8
8
  rehydrateRelayRegistry,
9
9
  stopRelay
10
- } from "./chunk-46NNZMZT.js";
11
- import {
12
- loadEffectiveConfig
13
- } from "./chunk-NHVGKFVY.js";
10
+ } from "./chunk-I2DEYQLZ.js";
14
11
  import {
15
12
  readState
16
- } from "./chunk-GFOWBXV7.js";
13
+ } from "./chunk-XENTK32L.js";
14
+ import {
15
+ loadEffectiveConfig
16
+ } from "./chunk-7LNXTPEE.js";
17
17
 
18
18
  // src/commands/relay.ts
19
+ import { readFile } from "fs/promises";
19
20
  import { log, spinner } from "@clack/prompts";
20
21
  import { Command } from "commander";
21
22
  async function probeControlPlane() {
@@ -40,7 +41,8 @@ async function probeControlPlane() {
40
41
  function renderControlPlane(cp) {
41
42
  const head = `control box: ${cp.reachable ? "reachable" : "UNREACHABLE"} (this PC operates through it)`;
42
43
  const lines = [head, ` url: ${cp.url}`];
43
- if (cp.reachable) lines.push(` health: ${String(cp.boxes ?? 0)} box(es), ${String(cp.events ?? 0)} event(s)`);
44
+ if (cp.reachable)
45
+ lines.push(` health: ${String(cp.boxes ?? 0)} box(es), ${String(cp.events ?? 0)} event(s)`);
44
46
  return lines.join("\n");
45
47
  }
46
48
  async function rehydrateFromState() {
@@ -67,7 +69,9 @@ async function rehydrateFromState() {
67
69
  function renderStatus(s) {
68
70
  if (s.running && s.health) {
69
71
  return [
70
- "relay: running",
72
+ // A hub answering here means no lean relay process exists at all — and no
73
+ // relay.pid, which is why `pid` falls back to the one /healthz reports.
74
+ s.health.ui === true ? "relay: running (served by the hub)" : "relay: running",
71
75
  ` pid: ${s.pid === null ? "?" : String(s.pid)}`,
72
76
  ` port: ${String(s.port)}`,
73
77
  ` url: ${s.endpoint.hostUrl}`,
@@ -111,13 +115,34 @@ var stopSub = new Command("stop").description("Stop the host relay process (idem
111
115
  handleLifecycleError(err);
112
116
  }
113
117
  });
118
+ async function startAndReport(s) {
119
+ await ensureRelay();
120
+ await rehydrateFromState();
121
+ const status = await getRelayStatus();
122
+ if (!status.running) {
123
+ s.stop("relay failed to start");
124
+ log.error(`nothing is answering /healthz on ${status.endpoint.hostUrl}`);
125
+ const tail = await tailLog(status.logFile);
126
+ log.info(tail ? `last lines of ${status.logFile}:
127
+ ${tail}` : `see ${status.logFile}`);
128
+ process.exit(1);
129
+ }
130
+ const what = status.health?.ui === true ? "hub (serving the relay)" : "relay";
131
+ s.stop(`${what} running on ${status.endpoint.hostUrl}`);
132
+ }
133
+ async function tailLog(file) {
134
+ try {
135
+ const lines = (await readFile(file, "utf8")).split("\n").filter((l) => l.trim().length > 0);
136
+ return lines.slice(-10).join("\n");
137
+ } catch {
138
+ return "";
139
+ }
140
+ }
114
141
  var startSub = new Command("start").description("Start the host relay if not already running (idempotent)").action(async () => {
115
142
  try {
116
143
  const s = spinner();
117
144
  s.start("starting relay");
118
- const ep = await ensureRelay();
119
- await rehydrateFromState();
120
- s.stop(`relay running on ${ep.hostUrl}`);
145
+ await startAndReport(s);
121
146
  } catch (err) {
122
147
  handleLifecycleError(err);
123
148
  }
@@ -133,9 +158,7 @@ var restartSub = new Command("restart").description("Stop then start the host re
133
158
  const s2 = spinner();
134
159
  s2.start("starting relay");
135
160
  try {
136
- const ep = await ensureRelay();
137
- await rehydrateFromState();
138
- s2.stop(`relay running on ${ep.hostUrl}`);
161
+ await startAndReport(s2);
139
162
  } catch (err) {
140
163
  s2.stop("relay start failed");
141
164
  log.warn(err instanceof Error ? err.message : String(err));
@@ -151,4 +174,4 @@ export {
151
174
  rehydrateFromState,
152
175
  relayCommand
153
176
  };
154
- //# sourceMappingURL=chunk-NHTRTST5.js.map
177
+ //# sourceMappingURL=chunk-WDBDFLH3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/relay.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { log, spinner } from '@clack/prompts';\nimport {\n ensureRelay,\n getRelayStatus,\n rehydrateRelayRegistry,\n stopRelay,\n type RelayStatus,\n} from '@agentbox/sandbox-docker';\nimport { readState } from '@agentbox/sandbox-core';\nimport { loadEffectiveConfig } from '@agentbox/config';\nimport { Command } from 'commander';\nimport { handleLifecycleError } from './_errors.js';\n\ninterface ControlPlaneInfo {\n url: string;\n reachable: boolean;\n boxes?: number;\n events?: number;\n}\n\n/**\n * Probe the configured control box (`relay.controlPlaneUrl`) `/healthz`, so\n * `relay status` shows the intermediary the PC operates through. Returns null\n * when no control box is configured. Never throws (an unreachable box is a\n * status line, not an error).\n */\nasync function probeControlPlane(): Promise<ControlPlaneInfo | null> {\n let url = '';\n try {\n const cfg = await loadEffectiveConfig(process.cwd());\n url = (cfg.effective.relay.controlPlaneUrl ?? '').replace(/\\/$/, '');\n } catch {\n return null;\n }\n if (!url) return null;\n try {\n const ctrl = AbortSignal.timeout(6000);\n const res = await fetch(`${url}/healthz`, { signal: ctrl });\n if (!res.ok) return { url, reachable: false };\n const body = (await res.json()) as { boxes?: number; events?: number };\n return { url, reachable: true, boxes: body.boxes, events: body.events };\n } catch {\n return { url, reachable: false };\n }\n}\n\nfunction renderControlPlane(cp: ControlPlaneInfo): string {\n const head = `control box: ${cp.reachable ? 'reachable' : 'UNREACHABLE'} (this PC operates through it)`;\n const lines = [head, ` url: ${cp.url}`];\n if (cp.reachable)\n lines.push(` health: ${String(cp.boxes ?? 0)} box(es), ${String(cp.events ?? 0)} event(s)`);\n return lines.join('\\n');\n}\n\n/**\n * After a fresh relay process starts (cold start or restart), it has no\n * in-memory box registry — and for cloud boxes that means no `CloudBoxPoller`\n * is running. Re-push every persisted (id, token, kind, preview…) so the\n * relay regains the same registry it had before the restart. Lifts the\n * cloud poller back up so status push + git push resume seamlessly.\n */\nexport async function rehydrateFromState(): Promise<void> {\n const state = await readState();\n await rehydrateRelayRegistry(\n state.boxes.map((b) => ({\n id: b.id,\n name: b.name,\n provider: b.provider,\n container: b.container,\n createdAt: b.createdAt,\n relayToken: b.relayToken,\n projectIndex: b.projectIndex,\n gitWorktrees: b.gitWorktrees,\n cloudBackend: b.cloud?.backend,\n relayPreviewUrl: b.cloud?.relayPreviewUrl,\n relayPreviewToken: b.cloud?.relayPreviewToken,\n bridgeToken: b.cloud?.bridgeToken,\n autoApproveHostActions: b.autoApproveHostActions,\n autoApproveSafeHostActions: b.autoApproveSafeHostActions,\n })),\n );\n}\n\ninterface StatusOpts {\n json?: boolean;\n}\n\nfunction renderStatus(s: RelayStatus): string {\n if (s.running && s.health) {\n return [\n // A hub answering here means no lean relay process exists at all — and no\n // relay.pid, which is why `pid` falls back to the one /healthz reports.\n s.health.ui === true ? 'relay: running (served by the hub)' : 'relay: running',\n ` pid: ${s.pid === null ? '?' : String(s.pid)}`,\n ` port: ${String(s.port)}`,\n ` url: ${s.endpoint.hostUrl}`,\n ` version: ${s.health.version ?? '(unknown — relay predates version field)'}`,\n ` commit: ${s.health.commit ?? '(unknown)'}`,\n ` boxes: ${String(s.health.boxes)}`,\n ` events: ${String(s.health.events)}`,\n ` log: ${s.logFile}`,\n ].join('\\n');\n }\n if (s.pidAlive) {\n return [\n `relay: not responding (pid ${String(s.pid)} alive but /healthz silent)`,\n ` log: ${s.logFile}`,\n ].join('\\n');\n }\n return ['relay: not running', ` log: ${s.logFile}`].join('\\n');\n}\n\nconst statusSub = new Command('status')\n .description('Show whether the host relay is running, with pid / port / box count')\n .option('--json', 'emit RelayStatus as JSON')\n .action(async (opts: StatusOpts) => {\n try {\n const [s, cp] = await Promise.all([getRelayStatus(), probeControlPlane()]);\n if (opts.json) {\n process.stdout.write(JSON.stringify({ ...s, controlPlane: cp }, null, 2) + '\\n');\n return;\n }\n process.stdout.write(renderStatus(s) + '\\n');\n if (cp) process.stdout.write('\\n' + renderControlPlane(cp) + '\\n');\n } catch (err) {\n handleLifecycleError(err);\n }\n });\n\nconst stopSub = new Command('stop')\n .description('Stop the host relay process (idempotent)')\n .action(async () => {\n try {\n const s = spinner();\n s.start('stopping relay');\n const result = await stopRelay();\n s.stop(\n result.stopped ? `stopped relay (pid ${String(result.pid)})` : 'relay was not running',\n );\n } catch (err) {\n handleLifecycleError(err);\n }\n });\n\n/**\n * Bring the relay up and REPORT WHAT IS ACTUALLY THERE.\n *\n * `ensureRelay()` returning an endpoint is not proof of liveness — it also\n * returns when it reused an incumbent, handed off to a hub, or gave up on a pid\n * whose /healthz stays silent. Printing its URL unconditionally is how a relay\n * that died on EADDRINUSE reported success while the box's RPCs went to whatever\n * else held the port. So: re-probe, and say `hub` when a hub is what answers\n * (there is no lean relay process in that case).\n */\nasync function startAndReport(s: ReturnType<typeof spinner>): Promise<void> {\n await ensureRelay();\n await rehydrateFromState();\n const status = await getRelayStatus();\n if (!status.running) {\n s.stop('relay failed to start');\n log.error(`nothing is answering /healthz on ${status.endpoint.hostUrl}`);\n const tail = await tailLog(status.logFile);\n log.info(tail ? `last lines of ${status.logFile}:\\n${tail}` : `see ${status.logFile}`);\n process.exit(1);\n }\n const what = status.health?.ui === true ? 'hub (serving the relay)' : 'relay';\n s.stop(`${what} running on ${status.endpoint.hostUrl}`);\n}\n\n/** Last few non-empty lines of the relay log, or '' when unreadable. */\nasync function tailLog(file: string): Promise<string> {\n try {\n const lines = (await readFile(file, 'utf8')).split('\\n').filter((l) => l.trim().length > 0);\n return lines.slice(-10).join('\\n');\n } catch {\n return '';\n }\n}\n\nconst startSub = new Command('start')\n .description('Start the host relay if not already running (idempotent)')\n .action(async () => {\n try {\n const s = spinner();\n s.start('starting relay');\n await startAndReport(s);\n } catch (err) {\n handleLifecycleError(err);\n }\n });\n\nconst restartSub = new Command('restart')\n .description('Stop then start the host relay')\n .action(async () => {\n try {\n const s = spinner();\n s.start('stopping relay');\n const stopped = await stopRelay();\n s.stop(\n stopped.stopped ? `stopped relay (pid ${String(stopped.pid)})` : 'relay was not running',\n );\n const s2 = spinner();\n s2.start('starting relay');\n try {\n await startAndReport(s2);\n } catch (err) {\n s2.stop('relay 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\nexport const relayCommand = new Command('relay')\n .description('Manage the host relay process (status / stop / start / restart)')\n .addCommand(statusSub, { isDefault: true })\n .addCommand(stopSub)\n .addCommand(startSub)\n .addCommand(restartSub);\n"],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AM,IAAI,EAAE,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC;AAC1F,WAAO,MAAM,MAAM,GAAG,EAAE,KAAK,IAAI;AAAA,EACnC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,IAAM,WAAW,IAAI,QAAQ,OAAO,EACjC,YAAY,0DAA0D,EACtE,OAAO,YAAY;AAClB,MAAI;AACF,UAAM,IAAI,QAAQ;AAClB,MAAE,MAAM,gBAAgB;AACxB,UAAM,eAAe,CAAC;AAAA,EACxB,SAAS,KAAK;AACZ,yBAAqB,GAAG;AAAA,EAC1B;AACF,CAAC;AAEH,IAAM,aAAa,IAAI,QAAQ,SAAS,EACrC,YAAY,gCAAgC,EAC5C,OAAO,YAAY;AAClB,MAAI;AACF,UAAM,IAAI,QAAQ;AAClB,MAAE,MAAM,gBAAgB;AACxB,UAAM,UAAU,MAAM,UAAU;AAChC,MAAE;AAAA,MACA,QAAQ,UAAU,sBAAsB,OAAO,QAAQ,GAAG,CAAC,MAAM;AAAA,IACnE;AACA,UAAM,KAAK,QAAQ;AACnB,OAAG,MAAM,gBAAgB;AACzB,QAAI;AACF,YAAM,eAAe,EAAE;AAAA,IACzB,SAAS,KAAK;AACZ,SAAG,KAAK,oBAAoB;AAC5B,UAAI,KAAK,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG,CAAC;AACzD,YAAM;AAAA,IACR;AAAA,EACF,SAAS,KAAK;AACZ,yBAAqB,GAAG;AAAA,EAC1B;AACF,CAAC;AAEI,IAAM,eAAe,IAAI,QAAQ,OAAO,EAC5C,YAAY,iEAAiE,EAC7E,WAAW,WAAW,EAAE,WAAW,KAAK,CAAC,EACzC,WAAW,OAAO,EAClB,WAAW,QAAQ,EACnB,WAAW,UAAU;","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,E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ONA_VM_REGION
4
- } from "./chunk-NHVGKFVY.js";
5
2
  import {
6
3
  DOCKER_CONTEXT_FILE_MAP,
7
4
  RUNTIME_ROOT_ENV,
@@ -14,9 +11,12 @@ import {
14
11
  resolveContextFilesFrom,
15
12
  writeManagedSecrets,
16
13
  writePreparedStateRaw
17
- } from "./chunk-GFOWBXV7.js";
14
+ } from "./chunk-XENTK32L.js";
15
+ import {
16
+ DAYTONA_VM_REGION
17
+ } from "./chunk-7LNXTPEE.js";
18
18
 
19
- // ../../packages/sandbox-daytona/dist/chunk-INPTTBUW.js
19
+ // ../../packages/sandbox-daytona/dist/chunk-URN542P7.js
20
20
  import { existsSync } from "fs";
21
21
  import { dirname, resolve } from "path";
22
22
  import { fileURLToPath } from "url";
@@ -204,6 +204,7 @@ function writePreparedDaytonaState(opts) {
204
204
  const stamp = readCliStamp();
205
205
  const extras = {
206
206
  ...opts.size ? { size: opts.size } : {},
207
+ ...opts.effectiveSize ? { effectiveSize: opts.effectiveSize } : {},
207
208
  ...opts.class ? { class: opts.class } : {},
208
209
  ...opts.env && opts.env.length > 0 ? { env: opts.env } : {}
209
210
  };
@@ -1012,4 +1013,4 @@ export {
1012
1013
  readDaytonaCredStatus,
1013
1014
  maskKey
1014
1015
  };
1015
- //# sourceMappingURL=chunk-KJ5TCYNI.js.map
1016
+ //# sourceMappingURL=chunk-WJUKN4L4.js.map