@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
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../packages/sandbox-e2b/src/index.ts","../../../packages/sandbox-e2b/src/backend.ts","../../../packages/sandbox-e2b/src/retry.ts","../../../packages/sandbox-e2b/src/prepare.ts","../../../packages/sandbox-e2b/src/build-attach.ts","../../../packages/sandbox-e2b/src/provider-module.ts"],"sourcesContent":["/**\n * The E2B sandbox provider. A thin `CloudBackend` over the `e2b` v2 SDK,\n * composed via `@agentbox/sandbox-cloud`'s `createCloudProvider` for\n * everything provider-agnostic (workspace seeding, ctl launch, state, relay\n * polling).\n *\n * Three capabilities are overridden on top of the cloud scaffold:\n * - `prepare` — bake the custom base template via Template.build\n * (`agentbox prepare --provider e2b`).\n * - `buildAttach` — SDK-streaming PTY bridge (E2B has no SSH).\n * - `checkpoint` — store the E2B snapshot id (template id) in the manifest\n * so restore boots from it (`Sandbox.createSnapshot` produces an\n * id-addressed reusable snapshot, same shape as Vercel).\n *\n * `launchDockerd: true` — E2B microVMs DO support nested containers (full root\n * + cap_sys_admin + working namespaces, verified 2026-06-23), so the base\n * template bakes the docker engine and the cloud scaffold auto-starts dockerd\n * on every create/resume (same as the vercel/hetzner/daytona providers).\n */\n\nimport type { BoxRecord, Provider, ProviderCheckpoint } from '@agentbox/core';\nimport {\n createCloudProvider,\n currentCloudBaseFingerprint,\n listCloudCheckpoints,\n removeCloudCheckpointDir,\n resolveCloudCheckpoint,\n writeCloudCheckpointManifest,\n} from '@agentbox/sandbox-cloud';\nimport { readCliStamp, recordBox, type ProviderModule } from '@agentbox/sandbox-core';\nimport { e2bBackend, DEFAULT_BOX_IMAGE_REF } from './backend.js';\nimport { Sandbox, resolveApiKey } from './sdk.js';\nimport { withE2bRetry } from './retry.js';\nimport { prepareE2bProvider } from './prepare.js';\nimport { buildE2bAttach } from './build-attach.js';\nimport { currentE2bBaseFingerprintLive,\n currentE2bBaseFileHashes,\n} from './prepared-state.js';\nimport { ensureE2bCredentials, setE2bCredentials } from './credentials.js';\nimport { doctorChecks, readCredStatusSummary } from './provider-module.js';\n\nconst BACKEND_NAME = 'e2b';\n\nconst cloudProvider = createCloudProvider(e2bBackend, {\n // E2B applies resources at the template level (Template.build({ cpuCount,\n // memoryMB }) — `prepare` sets these). The numbers below are advisory\n // metadata for BoxRecord stats / the dashboard pane; per-create overrides\n // aren't honored by the SDK.\n defaultResources: { cpu: 2, memory: 4, disk: 8 },\n launchDockerd: true,\n});\n\n/**\n * Create a reusable, named E2B snapshot from a running sandbox.\n * `Sandbox.createSnapshot` pauses the source while capturing, then returns a\n * persistent `snapshotId` (template id form: `name:tag` or `template-id:tag`)\n * usable with `Sandbox.create({ template })` — see SDK docs.\n */\nasync function createE2bSnapshot(sandboxId: string, name: string): Promise<string> {\n const apiKey = resolveApiKey();\n return withE2bRetry(\n { method: 'createSnapshot', retryOnAmbiguous: false, attemptTimeoutMs: 900_000, backoffMs: [] },\n async () => {\n const info = await Sandbox.createSnapshot(sandboxId, { apiKey, name });\n return info.snapshotId;\n },\n );\n}\n\n/** Delete a snapshot by id. Idempotent — a missing snapshot is success. */\nasync function deleteE2bSnapshot(snapshotId: string): Promise<void> {\n const apiKey = resolveApiKey();\n await withE2bRetry({ method: 'deleteSnapshot', retryOnAmbiguous: true }, async () => {\n try {\n await Sandbox.deleteSnapshot(snapshotId, { apiKey });\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n if (/not.?found|404/i.test(msg)) return; // idempotent\n throw err;\n }\n });\n}\n\n/**\n * Build a safe, unique E2B snapshot name. E2B names are global within a team\n * (`createSnapshot({ name })` reuses an existing name if it exists, growing\n * the build set). We stamp a per-create timestamp so each checkpoint gets its\n * own name → its own template id, never overwriting an earlier checkpoint.\n */\nfunction snapshotName(boxName: string, checkpointName: string): string {\n // E2B template names accept lower-case alnum + dashes/dots; coerce.\n const sanitize = (s: string): string =>\n s.toLowerCase().replace(/[^a-z0-9.-]+/g, '-').replace(/^-+|-+$/g, '');\n const ts = new Date().toISOString().replace(/[:.]/g, '-').replace('T', '_').replace('Z', '');\n return `agentbox-${sanitize(boxName)}-${sanitize(checkpointName)}-${sanitize(ts)}`;\n}\n\n/**\n * E2B-specific checkpoint capability. Unlike the scaffold's default (which\n * stores a caller-chosen snapshot *name*), we capture the SDK-returned\n * opaque snapshot id and store THAT in the manifest's `snapshotName` field —\n * the cloud create flow passes `manifest.snapshotName` straight to\n * `provision({ snapshot })`, and the E2B backend boots from it as a template\n * id. (Same id-addressed shape as Vercel's checkpoint capability.)\n */\nconst e2bCheckpoint: ProviderCheckpoint = {\n async create(box: BoxRecord, name: string) {\n if (!box.projectRoot) {\n throw new Error(\n 'cloud checkpoint requires the box to have a project root (run `agentbox checkpoint` from inside the project)',\n );\n }\n if (!box.cloud?.sandboxId) {\n throw new Error(`e2b box ${box.name} has no sandboxId — record is malformed`);\n }\n // NOTE: createSnapshot pauses the source sandbox; agentbox-ctl-checkpoint\n // resumes it lazily on the next op (Sandbox.connect auto-resumes).\n const e2bSnapName = snapshotName(box.name, name);\n const snapshotId = await createE2bSnapshot(box.cloud.sandboxId, e2bSnapName);\n // The box is now paused — persist it so the fast `agentbox list` path\n // doesn't show a stale `running` after a checkpoint. Best-effort.\n try {\n await recordBox({ ...box, cloud: { ...box.cloud, lastState: 'paused' } });\n } catch {\n // not worth failing the checkpoint over a state-record write\n }\n const info = await writeCloudCheckpointManifest(box.projectRoot, BACKEND_NAME, name, {\n snapshotName: snapshotId,\n sourceBoxId: box.id,\n sourceBoxName: box.name,\n baseProvider: BACKEND_NAME,\n baseFingerprint: currentCloudBaseFingerprint(BACKEND_NAME),\n cliVersion: readCliStamp().cliVersion,\n });\n return { ref: info.name };\n },\n async list(projectRoot: string) {\n const entries = await listCloudCheckpoints(projectRoot, BACKEND_NAME);\n return entries.map((e) => ({ ref: e.name, createdAt: e.manifest.createdAt }));\n },\n async remove(projectRoot: string, ref: string) {\n const entry = await resolveCloudCheckpoint(projectRoot, BACKEND_NAME, ref);\n if (!entry) return;\n try {\n await deleteE2bSnapshot(entry.manifest.snapshotName);\n } catch {\n // best-effort: drop the local manifest even if the remote delete failed\n // (network/perms/already-gone) so the user isn't left with a dead pointer.\n }\n await removeCloudCheckpointDir(projectRoot, BACKEND_NAME, ref);\n },\n};\n\nexport const e2bProvider: Provider = {\n ...cloudProvider,\n prepare: prepareE2bProvider,\n buildAttach: buildE2bAttach,\n checkpoint: e2bCheckpoint,\n baseFingerprint: (claudeInstall) => currentE2bBaseFingerprintLive(claudeInstall),\n};\n\n/** Uniform surface the CLI provider loader resolves this package through. */\nexport const providerModule: ProviderModule = {\n provider: e2bProvider,\n backend: e2bBackend,\n ensureCredentials: ensureE2bCredentials,\n readCredStatus: readCredStatusSummary,\n setCredentials: (fields) => Promise.resolve(setE2bCredentials(fields)),\n currentBaseFingerprintLive: (claudeInstall) => currentE2bBaseFingerprintLive(claudeInstall),\n currentBaseFileHashes: () => currentE2bBaseFileHashes(),\n doctorChecks,\n};\n\nexport { e2bBackend, DEFAULT_BOX_IMAGE_REF };\nexport { ensureE2bEnvLoaded, reloadE2bEnv } from './env-loader.js';\nexport {\n ensureE2bCredentials,\n setE2bCredentials,\n readE2bCredStatus,\n secretsPath,\n maskKey,\n type EnsureE2bCredentialsOptions,\n type E2bCredStatus,\n} from './credentials.js';\nexport {\n RUNTIME_ASSETS,\n candidatesFor,\n resolveRuntimeAssets,\n findStagedCliRuntimeRoot,\n type RuntimeAsset,\n type ResolvedAsset,\n} from './runtime-assets.js';\nexport {\n prepareE2b,\n prepareE2bProvider,\n type PrepareE2bOptions,\n type PrepareE2bResult,\n} from './prepare.js';\nexport {\n currentE2bBaseFingerprintLive,\n ensureE2bBaseTemplate,\n preparedStatePath,\n readPreparedState,\n writePreparedState,\n updatePreparedState,\n type PreparedE2bState,\n type PreparedE2bBase,\n} from './prepared-state.js';\nexport { buildE2bAttach } from './build-attach.js';\n","/**\n * E2B `CloudBackend` — maps the provider-neutral cloud primitives onto the\n * `e2b` v2 SDK (Firecracker microVMs + pause/resume persistence). Composed\n * into a full `Provider` by `@agentbox/sandbox-cloud`'s `createCloudProvider`.\n *\n * Platform shape this backend is built around:\n * - Boxes boot from the prepared base template baked by `agentbox prepare\n * --provider e2b` (Template.build → custom Debian image with agentbox-ctl,\n * the vscode user, /workspace, claude/codex/opencode, tmux, Chromium).\n * `backend.provision` gates on `ensureE2bBaseTemplate()` (mirrors the\n * hetzner/vercel pattern: `prepare` itself sidesteps the gate so a cold\n * install can bootstrap). A snapshot ref (cloud checkpoint) wins over\n * the prepared base.\n * - No nested containers (Firecracker microVM); the provider sets\n * `launchDockerd: false`.\n * - Preview URLs (`{port}-{sandboxId}.{E2B_DOMAIN}`) are public HTTPS by\n * default (allowPublicTraffic=true); no header token needed. We construct\n * the URL string locally so `previewUrl` doesn't have to `Sandbox.connect`\n * (which would auto-resume a paused box).\n * - `Sandbox.getInfo` is a NON-resuming static API; `state()`/`get()` use it\n * to check existence cheaply without waking a paused sandbox. Auto-resume\n * happens only inside `Sandbox.connect` (used by ops that need a live\n * handle: exec, file ops, pause, destroy).\n * - `Sandbox.pause` is the canonical pause API (`betaPause` is deprecated).\n * - `Sandbox.createSnapshot` is the reusable-snapshot primitive; the\n * provider overrides the whole `checkpoint` capability in index.ts to\n * store the resulting snapshot id (matching vercel's id-addressed shape).\n * - No SSH — the provider overrides `buildAttach` with an SDK-streaming\n * PTY bridge (`buildE2bAttach`); the legacy `attachArgv` slot stays\n * unset.\n */\n\nimport { readFile } from 'node:fs/promises';\nimport type {\n CloudBackend,\n CloudExecOptions,\n CloudExecResult,\n CloudFileEntry,\n CloudHandle,\n CloudPreviewUrl,\n CloudProvisionRequest,\n CloudSandboxSummary,\n CloudState,\n} from '@agentbox/core';\nimport type { SandboxInfo, SandboxState } from './sdk.js';\nimport { Sandbox, Template, resolveApiKey } from './sdk.js';\nimport { withE2bRetry } from './retry.js';\nimport { parseE2bSize } from './prepare.js';\nimport { ensureE2bBaseTemplate, readPreparedState } from './prepared-state.js';\n\n/**\n * Sentinel image ref the cloud-provider hands us when no --image was passed.\n * Mirrors docker's convention; the actual template id is read from the\n * prepared-state file by `provision`.\n */\nexport const DEFAULT_BOX_IMAGE_REF = 'agentbox/box:dev';\n\n/** Box user agentbox standardizes on (matches docker/vercel — created by build-template.sh). */\nconst BOX_USER = 'vscode';\nconst BOX_OWNER = 'vscode:vscode';\n\n/** Default E2B preview hostname. Override via the SDK's `E2B_DOMAIN` env. */\nconst DEFAULT_E2B_DOMAIN = 'e2b.app';\n\n/**\n * Per-box session timeout the SDK enforces at create. Past it, E2B\n * auto-terminates the sandbox. The host keepalive loop renews it while the\n * agent is active via `renewTimeout` (static `Sandbox.setTimeout`), so a\n * long-running session isn't killed mid-work. 45 min default mirrors vercel.\n */\nconst DEFAULT_TIMEOUT_MS = 45 * 60_000;\n\nconst E2B_WEB_PORT = 8080;\n\n/** Single-quote a string for safe embedding inside a `bash -lc '<…>'`. */\nfunction shq(s: string): string {\n return \"'\" + s.replace(/'/g, \"'\\\\''\") + \"'\";\n}\n\n/**\n * Convert a Node `Buffer` to a plain `ArrayBuffer` because E2B's `files.write`\n * `data:` field is `string | ArrayBuffer | Blob | ReadableStream` — Buffer is a\n * `Uint8Array` subclass and doesn't satisfy that union at the type level (even\n * though it works at runtime). Copy rather than slice the underlying buffer:\n * Buffers may share an underlying ArrayBuffer with a pooled allocator, so\n * `data.buffer` of a small Buffer can be a megabyte-long shared region.\n */\nfunction bufferToArrayBuffer(b: Buffer): ArrayBuffer {\n const ab = new ArrayBuffer(b.byteLength);\n new Uint8Array(ab).set(b);\n return ab;\n}\n\n/**\n * Map the SDK's nullable string state onto our 4-value `CloudState`.\n * E2B reports 'running' | 'paused' (per SDK types). Anything else (or absent)\n * → 'missing' so callers ping-pong the lifecycle into a clean state.\n */\nfunction mapState(s: SandboxState | undefined): CloudState {\n switch (s) {\n case 'running':\n return 'running';\n case 'paused':\n return 'paused';\n default:\n return 'missing';\n }\n}\n\n/** True when the error means \"sandbox doesn't exist\" (404). */\nfunction isNotFound(err: unknown): boolean {\n if (!err || typeof err !== 'object') return false;\n const name = err instanceof Error ? err.name : '';\n if (name === 'SandboxNotFoundError' || name === 'NotFoundError') return true;\n const status = (err as { statusCode?: unknown; status?: unknown }).statusCode ?? (err as { status?: unknown }).status;\n return status === 404;\n}\n\n/**\n * Sanitize a box name for use as the `metadata.name` value. E2B accepts\n * arbitrary strings (probed) but we strip control chars defensively so a name\n * with embedded newlines can't break log parsing or response shapes.\n */\nfunction safeMetadataName(name: string): string {\n return name.replace(/[\\u0000-\\u001f]/g, '').slice(0, 200);\n}\n\nexport const e2bBackend: CloudBackend = {\n name: 'e2b',\n\n // The cloud scaffold's WebProxy binds whatever port we expose here, and\n // `agentbox url --kind=web` resolves via `getHost(port)`. 8080 matches the\n // non-privileged convention vercel uses — `getHost` accepts any port, but\n // staying on 8080 keeps the in-box ctl flag (AGENTBOX_WEB_PROXY_PORT)\n // identical across cloud providers.\n webProxyPort: E2B_WEB_PORT,\n\n async provision(req: CloudProvisionRequest): Promise<CloudHandle> {\n const apiKey = resolveApiKey();\n const log = req.onLog ?? (() => {});\n // Resolve the template to boot from: an explicit cloud-checkpoint snapshot\n // (req.snapshot) wins, else the prepared base template id. We don't fall\n // back to E2B's stock `base` template — every box must have the agentbox\n // runtime baked in. The gate throws an actionable \"run `agentbox prepare`\"\n // error when no template is recorded yet (mirrors the hetzner/vercel\n // pattern: `prepare` itself sidesteps the gate by calling `prepareE2b`\n // directly, never `provision`).\n if (req.snapshot === undefined) {\n ensureE2bBaseTemplate();\n }\n const template = req.snapshot ?? readPreparedState().base?.templateId;\n if (!template) {\n throw new Error(\n 'e2b provision: no template available — `agentbox prepare --provider e2b` must run first',\n );\n }\n\n // E2B resources are fixed at template-build time (E2B rejects per-create\n // resources). If the user asked for a size that differs from what the\n // template was baked with, warn loudly — never send it to Sandbox.create.\n if (req.size && req.size.trim().length > 0) {\n let requestedKey: string | undefined;\n try {\n const parsed = parseE2bSize(req.size);\n if (parsed) requestedKey = `${String(parsed.cpuCount)}-${String(parsed.memoryMB / 1024)}`;\n } catch {\n // A foreign/malformed box.size (e.g. a hetzner server type) isn't ours\n // to validate here — prepare surfaces that. Skip the size-drift warning.\n }\n const bakedSize = readPreparedState().base?.size;\n if (requestedKey && requestedKey !== bakedSize) {\n log(\n `e2b: WARNING — size '${requestedKey}' is ignored at create time; ` +\n `this template was baked at ${bakedSize ?? 'the default size'}. ` +\n `E2B resources are fixed at bake time — re-bake with ` +\n `\\`agentbox prepare --provider e2b --size ${requestedKey} --force\\` to change them.`,\n );\n }\n }\n\n // No-retry: Sandbox.create is billable and non-idempotent — a timeout\n // after the request reached the origin could leave a duplicate sandbox we\n // can't reference for cleanup.\n const sb = await withE2bRetry(\n { method: 'provision', retryOnAmbiguous: false, attemptTimeoutMs: 300_000, backoffMs: [] },\n async () =>\n Sandbox.create({\n apiKey,\n template,\n // Friendly name (so prune can see it) + the 'agentbox' marker so\n // `list()` can filter out sandboxes provisioned by other tooling.\n metadata: { agentbox: 'true', 'agentbox.name': safeMetadataName(req.name), name: safeMetadataName(req.name) },\n envs: req.env,\n timeoutMs: req.timeoutMs ?? DEFAULT_TIMEOUT_MS,\n }),\n );\n log(`e2b: created sandbox ${sb.sandboxId} (template ${template})`);\n return { sandboxId: sb.sandboxId };\n },\n\n async get(sandboxId: string): Promise<CloudHandle | null> {\n const apiKey = resolveApiKey();\n return withE2bRetry({ method: 'get', retryOnAmbiguous: true }, async () => {\n try {\n // Static, NON-resuming — won't wake a paused sandbox just to confirm\n // it exists (per orchestrator review #1: connect would auto-resume).\n await Sandbox.getInfo(sandboxId, { apiKey });\n return { sandboxId };\n } catch (err) {\n if (isNotFound(err)) return null;\n throw err;\n }\n });\n },\n\n async list(): Promise<CloudSandboxSummary[]> {\n const apiKey = resolveApiKey();\n return withE2bRetry({ method: 'list', retryOnAmbiguous: true }, async () => {\n const summaries: CloudSandboxSummary[] = [];\n // Default query returns both running and paused sandboxes. We filter\n // client-side to the ones we created (metadata.agentbox === 'true').\n for (const state of ['running', 'paused'] as const) {\n const paginator = Sandbox.list({ apiKey, query: { state: [state] } });\n while (paginator.hasNext) {\n const page = await paginator.nextItems();\n for (const info of page) {\n if (info.metadata?.['agentbox'] !== 'true') continue;\n const friendly =\n info.metadata?.['agentbox.name'] ?? info.metadata?.['name'];\n const summary: CloudSandboxSummary = { sandboxId: info.sandboxId, state };\n if (friendly) summary.name = friendly;\n const startedAt = info.startedAt;\n if (startedAt instanceof Date) summary.createdAt = startedAt.toISOString();\n summaries.push(summary);\n }\n }\n }\n return summaries;\n });\n },\n\n // E2B has no separate stop primitive — sandboxes are either running or\n // paused. start is therefore a connect-and-resume (auto-resume inside\n // Sandbox.connect handles a paused box transparently).\n async start(h: CloudHandle): Promise<void> {\n const apiKey = resolveApiKey();\n await withE2bRetry(\n { method: 'start', retryOnAmbiguous: true, attemptTimeoutMs: 120_000 },\n async () => {\n await Sandbox.connect(h.sandboxId, { apiKey });\n },\n );\n },\n\n // stop ≡ pause on E2B (the pause IS the cold-storage state).\n async stop(h: CloudHandle): Promise<void> {\n await this.pause(h);\n },\n\n async pause(h: CloudHandle): Promise<void> {\n const apiKey = resolveApiKey();\n await withE2bRetry(\n { method: 'pause', retryOnAmbiguous: true, attemptTimeoutMs: 120_000 },\n async () => {\n await Sandbox.pause(h.sandboxId, { apiKey });\n },\n );\n },\n\n async resume(h: CloudHandle): Promise<void> {\n await this.start(h);\n },\n\n // E2B `setTimeout` SETS the TTL to N ms from now (absolute-from-now), so we\n // ignore the host's tracked deadline and use `target - now`. The static\n // `Sandbox.setTimeout` hits the API without `connect` (no resume of a paused\n // box). The host only calls when target > current, so this never shortens.\n async renewTimeout(h: CloudHandle, targetDeadlineEpochMs: number): Promise<void> {\n const ttlMs = Math.max(0, targetDeadlineEpochMs - Date.now());\n if (ttlMs === 0) return;\n const apiKey = resolveApiKey();\n await withE2bRetry({ method: 'renewTimeout', retryOnAmbiguous: true }, async () => {\n await Sandbox.setTimeout(h.sandboxId, ttlMs, { apiKey });\n });\n },\n\n async destroy(h: CloudHandle): Promise<void> {\n const apiKey = resolveApiKey();\n await withE2bRetry(\n { method: 'destroy', retryOnAmbiguous: true, attemptTimeoutMs: 120_000 },\n async () => {\n try {\n await Sandbox.kill(h.sandboxId, { apiKey });\n } catch (err) {\n if (isNotFound(err)) return; // idempotent\n throw err;\n }\n },\n );\n },\n\n async state(h: CloudHandle): Promise<CloudState> {\n const apiKey = resolveApiKey();\n return withE2bRetry({ method: 'state', retryOnAmbiguous: true }, async () => {\n try {\n const info: SandboxInfo = await Sandbox.getInfo(h.sandboxId, { apiKey });\n return mapState(info.state);\n } catch (err) {\n if (isNotFound(err)) return 'missing';\n throw err;\n }\n });\n },\n\n async exec(h: CloudHandle, cmd: string, opts?: CloudExecOptions): Promise<CloudExecResult> {\n const apiKey = resolveApiKey();\n // Default per-attempt cap is 5 min — covers the cloud scaffold's\n // workspace-seed/carry extracts (tar of thousands of files, chown -R).\n // Callers can shorten with opts.attemptTimeoutMs for snappier probes.\n const timeoutMs = opts?.attemptTimeoutMs ?? 300_000;\n return withE2bRetry(\n {\n method: 'exec',\n retryOnAmbiguous: opts?.noRetry ? false : true,\n attemptTimeoutMs: timeoutMs,\n backoffMs: opts?.noRetry ? [] : undefined,\n },\n async () => {\n // Connect for the live handle — auto-resumes a paused box, which is\n // the correct semantics for exec (caller wants the command to run).\n const sb = await Sandbox.connect(h.sandboxId, { apiKey });\n // E2B's `commands.run` accepts only 'root' | 'user' | 'vscode'…; any\n // unix username we create in the fixup is valid. Pass through.\n const user = (opts?.user ?? BOX_USER) as 'root' | 'user';\n try {\n const r = await sb.commands.run(cmd, {\n ...(opts?.cwd !== undefined ? { cwd: opts.cwd } : {}),\n ...(opts?.env !== undefined ? { envs: opts.env } : {}),\n user,\n timeoutMs,\n });\n return { exitCode: r.exitCode, stdout: r.stdout ?? '', stderr: r.stderr ?? '' };\n } catch (err) {\n // commands.run throws on non-zero exit; the CommandResult fields\n // (exitCode/stdout/stderr) hang off the error. Map back into our\n // CloudExecResult so callers see exit=1, not a thrown exception\n // (vercel/daytona/hetzner exec contract returns the result).\n if (err instanceof Error && err.name === 'CommandExitError') {\n const ce = err as unknown as {\n exitCode: number;\n stdout: string;\n stderr: string;\n };\n return { exitCode: ce.exitCode, stdout: ce.stdout ?? '', stderr: ce.stderr ?? '' };\n }\n throw err;\n }\n },\n );\n },\n\n async uploadFile(h: CloudHandle, localPath: string, remotePath: string): Promise<void> {\n const apiKey = resolveApiKey();\n await withE2bRetry(\n { method: 'uploadFile', retryOnAmbiguous: true, attemptTimeoutMs: 300_000 },\n async () => {\n const data = await readFile(localPath);\n const sb = await Sandbox.connect(h.sandboxId, { apiKey });\n await sb.files.write([{ path: remotePath, data: bufferToArrayBuffer(data) }]);\n // files.write writes as the default user; chown to vscode so reads\n // from the scaffold's `sudo -u vscode …` exec calls succeed. Best-\n // effort — a chown failure on a world-readable file is harmless.\n try {\n await sb.commands.run(`sudo -n chown ${BOX_OWNER} ${shq(remotePath)}`, {\n user: 'root',\n timeoutMs: 10_000,\n });\n } catch {\n // ignore — file is at least present and readable\n }\n },\n );\n },\n\n async downloadFile(h: CloudHandle, remotePath: string, localPath: string): Promise<void> {\n const apiKey = resolveApiKey();\n await withE2bRetry(\n { method: 'downloadFile', retryOnAmbiguous: true, attemptTimeoutMs: 300_000 },\n async () => {\n const sb = await Sandbox.connect(h.sandboxId, { apiKey });\n const bytes = await sb.files.read(remotePath, { format: 'bytes' });\n const { writeFile } = await import('node:fs/promises');\n await writeFile(localPath, Buffer.from(bytes));\n },\n );\n },\n\n async listFiles(h: CloudHandle, remoteDir: string): Promise<CloudFileEntry[]> {\n const apiKey = resolveApiKey();\n return withE2bRetry({ method: 'listFiles', retryOnAmbiguous: true }, async () => {\n const sb = await Sandbox.connect(h.sandboxId, { apiKey });\n const entries = await sb.files.list(remoteDir);\n return entries.map((e) => ({ name: e.name, isDir: e.type === 'dir' }));\n });\n },\n\n async previewUrl(h: CloudHandle, port: number): Promise<CloudPreviewUrl> {\n // E2B's `sandbox.getHost(port)` is just string interpolation of\n // `${port}-${sandboxId}.${sandboxDomain}` — calling it via Sandbox.connect\n // would auto-resume a paused box (the SDK's documented behavior). The\n // domain defaults to `e2b.app` with `E2B_DOMAIN` as the override (matches\n // the SDK's `ConnectionConfig` default), so we construct the URL locally\n // and never wake the box for a UI/dashboard URL fetch.\n const domain = process.env.E2B_DOMAIN ?? DEFAULT_E2B_DOMAIN;\n return { url: `https://${String(port)}-${h.sandboxId}.${domain}`, token: undefined };\n },\n\n // Fewer params than the interface's (h, port, expiresInSeconds) is fine —\n // E2B preview URLs are already public + browser-usable; no per-URL TTL.\n async signedPreviewUrl(h: CloudHandle, port: number): Promise<CloudPreviewUrl> {\n return this.previewUrl(h, port);\n },\n\n /**\n * Probe whether a snapshot (i.e. a template id) is still bootable. E2B's\n * snapshot ids look like `template-id:tag` or `team-slug/name:tag` — both\n * accepted by `Template.exists(name)`. Returns false on any lookup failure\n * (treated by the cloud-provider as \"gone\" so it falls back to a from-base\n * boot rather than 410ing the user).\n */\n async snapshotExists(snapshotName: string): Promise<boolean> {\n const apiKey = resolveApiKey();\n return withE2bRetry({ method: 'snapshotExists', retryOnAmbiguous: true }, async () => {\n try {\n return await Template.exists(snapshotName, { apiKey });\n } catch {\n return false;\n }\n });\n },\n};\n","/**\n * Bounded retry wrapper for E2B SDK calls — mirrors `withVercelRetry` /\n * `withHetznerRetry` in shape and intent. The E2B API rate-limits (429) and\n * can return transient 5xx during incidents; without bounded retries those\n * propagate as wedges in the calling lifecycle code.\n *\n * Non-idempotent ops (`provision`/`Sandbox.create`) pass `retryOnAmbiguous:\n * false` so a timeout after the request reached the origin doesn't create a\n * duplicate billable sandbox.\n */\n\nexport interface WithRetryOptions {\n method: string;\n /** Per-attempt timeout (ms). Default 30_000. */\n attemptTimeoutMs?: number;\n /** Backoff before attempts 2, 3, … (ms). Default [1000, 2000, 4000]. */\n backoffMs?: readonly number[];\n /**\n * Retry on errors where we can't be sure the server applied the request\n * (connection failures, per-attempt timeouts, 5xx). Set false for\n * non-idempotent operations where a retry could create a duplicate resource.\n */\n retryOnAmbiguous: boolean;\n /** Override the default stderr retry sink (used by tests). */\n onRetry?: (line: string) => void;\n}\n\nconst DEFAULT_BACKOFF: readonly number[] = [1000, 2000, 4000];\nconst DEFAULT_ATTEMPT_TIMEOUT_MS = 30_000;\n\nclass AttemptTimeoutError extends Error {\n constructor(method: string, ms: number) {\n super(`e2b ${method}: per-attempt timeout after ${String(ms)}ms`);\n this.name = 'AttemptTimeoutError';\n }\n}\n\nexport function isAttemptTimeout(err: unknown): err is AttemptTimeoutError {\n return err instanceof AttemptTimeoutError;\n}\n\n/** HTTP status code dug out of whatever error shape the SDK throws. */\nfunction statusCodeOf(err: unknown): number | undefined {\n if (!err || typeof err !== 'object') return undefined;\n for (const key of ['statusCode', 'status', 'code'] as const) {\n const v = (err as Record<string, unknown>)[key];\n if (typeof v === 'number') return v;\n }\n const resp = (err as { response?: { status?: unknown } }).response;\n if (resp && typeof resp.status === 'number') return resp.status;\n return undefined;\n}\n\nexport function isRetriable(err: unknown, allowAmbiguous: boolean): boolean {\n if (err instanceof AttemptTimeoutError) return allowAmbiguous;\n\n // The SDK exposes a dedicated `SandboxNotFoundError` and `RateLimitError`.\n // Match by error name to avoid an import cycle (sdk.ts → retry → sdk).\n const name = err instanceof Error ? err.name : undefined;\n if (name === 'RateLimitError') return true;\n if (name === 'SandboxNotFoundError') return false;\n\n const status = statusCodeOf(err);\n if (status !== undefined) {\n if (status === 429) return true;\n if (status >= 500 && status <= 599) return allowAmbiguous;\n return false;\n }\n\n // Raw fetch / undici errors. Node wraps low-level errors in `{ cause }`.\n if (err && typeof err === 'object') {\n const candidates: unknown[] = [err, (err as { cause?: unknown }).cause];\n for (const c of candidates) {\n if (!c || typeof c !== 'object') continue;\n const code = (c as { code?: unknown }).code;\n if (\n code === 'ECONNRESET' ||\n code === 'ETIMEDOUT' ||\n code === 'ECONNABORTED' ||\n code === 'EAI_AGAIN' ||\n code === 'ECONNREFUSED' ||\n code === 'ENOTFOUND' ||\n code === 'UND_ERR_SOCKET' ||\n code === 'UND_ERR_CONNECT_TIMEOUT'\n ) {\n return allowAmbiguous;\n }\n }\n }\n return false;\n}\n\nexport async function withE2bRetry<T>(opts: WithRetryOptions, fn: () => Promise<T>): Promise<T> {\n const backoff = opts.backoffMs ?? DEFAULT_BACKOFF;\n const maxAttempts = backoff.length + 1;\n const timeoutMs = opts.attemptTimeoutMs ?? DEFAULT_ATTEMPT_TIMEOUT_MS;\n const log = opts.onRetry ?? defaultRetryLog;\n\n for (let attempt = 1; attempt <= maxAttempts; attempt++) {\n try {\n return await raceTimeout(fn(), timeoutMs, opts.method);\n } catch (err) {\n const last = attempt === maxAttempts;\n if (last || !isRetriable(err, opts.retryOnAmbiguous)) throw err;\n const delay = backoff[attempt - 1] ?? backoff[backoff.length - 1] ?? 4000;\n log(\n `e2b ${opts.method}: attempt ${String(attempt)} failed (${errorSummary(err)}); retrying in ${String(delay)}ms`,\n );\n await sleep(delay);\n }\n }\n throw new Error(`withE2bRetry: exhausted attempts for ${opts.method}`);\n}\n\nfunction defaultRetryLog(line: string): void {\n process.stderr.write(`\\n[e2b-retry] ${line}\\n`);\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((r) => setTimeout(r, ms));\n}\n\nasync function raceTimeout<T>(p: Promise<T>, ms: number, method: string): Promise<T> {\n let timer: ReturnType<typeof setTimeout> | undefined;\n try {\n return await Promise.race([\n p,\n new Promise<never>((_resolve, reject) => {\n timer = setTimeout(() => reject(new AttemptTimeoutError(method, ms)), ms);\n }),\n ]);\n } finally {\n if (timer !== undefined) clearTimeout(timer);\n }\n}\n\nfunction errorSummary(err: unknown): string {\n if (err instanceof Error) {\n const status = statusCodeOf(err);\n return status !== undefined\n ? `${err.name}(${String(status)}): ${truncate(err.message)}`\n : `${err.name}: ${truncate(err.message)}`;\n }\n return truncate(String(err));\n}\n\nfunction truncate(s: string, max = 160): string {\n return s.length > max ? `${s.slice(0, max)}…` : s;\n}\n","/**\n * `agentbox prepare --provider e2b` — bake the E2B base template.\n *\n * Unlike Vercel/Hetzner, E2B can build templates from a build DSL (the SDK's\n * `Template` + `Template.build`). We mirror Vercel's `prepare` shape but drive\n * the build through the SDK builder API instead of booting a sandbox + running\n * `provision.sh`:\n *\n * 1. Resolve runtime assets + fingerprint the build context. Skip-fast when\n * an up-to-date template id is already recorded.\n * 2. Stage every resolved asset under a temp `fileContextPath` directory\n * with predictable relative names (E2B's `template.copy(src, dest)`\n * requires sources to be RELATIVE paths inside the context dir).\n * 3. `Template({ fileContextPath })` → `.fromBaseImage()` (E2B's default\n * Debian 12 + node 20 + git + sudo). `.copy(rel, dest)` for each asset,\n * `.runCmd('bash /tmp/agentbox-build-template.sh', { user: 'root' })`,\n * `.setReadyCmd('test -x /usr/local/bin/agentbox-ctl')`.\n * 4. `Template.build(t, 'agentbox-base:<tag>', { cpuCount, memoryMB,\n * onBuildLogs })` streams logs into the spinner; returns the BuildInfo\n * with the template id.\n * 5. Persist `{ schema:1, base: { templateId, contextSha256, cliVersion,\n * cliCommit, createdAt } }` to ~/.agentbox/e2b-prepared.json.\n *\n * Templates on E2B are reusable named resources addressed by id+tag. Re-running\n * with the same name reuses the existing template id (E2B's documented\n * behavior). Unlike Vercel snapshots there's no per-box eviction concern; one\n * template is reused for every create.\n *\n * vCPU / RAM are template-level on E2B — set them here so per-box `create`\n * doesn't try to override them (which E2B rejects).\n */\n\nimport { copyFile, mkdir, mkdtemp, rm } from 'node:fs/promises';\nimport { tmpdir } from 'node:os';\nimport { dirname, join, resolve } from 'node:path';\nimport type { Provider } from '@agentbox/core';\nimport {\n claudeInstallFingerprint,\n computeContextManifest,\n readCliStamp,\n stageAllAgentStatic,\n type AgentStaticStage,\n} from '@agentbox/sandbox-core';\nimport { ensureE2bCredentials } from './credentials.js';\nimport { resolveApiKey, Template } from './sdk.js';\nimport {\n preparedStatePath,\n readPreparedState,\n writePreparedState,\n} from './prepared-state.js';\nimport {\n findStagedCliRuntimeRoot,\n resolveRuntimeAssets,\n type ResolvedAsset,\n} from './runtime-assets.js';\n\nexport interface PrepareE2bOptions {\n name?: string;\n hostWorkspace?: string;\n /** Force re-bake even when an up-to-date template id is recorded. */\n force?: boolean;\n /**\n * Bake-time `cpu-memory` GB size (e.g. `4-8`). Wins over `cpuCount`/`memoryMB`\n * when set. A third `-disk` slot is accepted with a warning (E2B has no disk\n * knob). Resolved by the CLI from `--size` / `box.sizeE2b` / `box.size`.\n */\n size?: string;\n /** vCPUs for the baked template (default 2). E2B applies this per-sandbox at boot. */\n cpuCount?: number;\n /** Memory in MiB for the baked template (default 4096). */\n memoryMB?: number;\n /** CLI runtime tree (set by the CLI to its dist neighbor). */\n cliRuntimeRoot?: string;\n /** Repo root for the dev fallback (defaults to a cwd-walk). */\n repoRoot?: string;\n /** How build-template.sh installs Claude Code (`native` default | `npm`). */\n claudeInstall?: 'native' | 'npm';\n onLog?: (line: string) => void;\n}\n\nexport interface PrepareE2bResult {\n snapshotName?: string;\n}\n\n/** Template name agentbox bakes under. E2B treats `name:tag` as a single addressable build. */\nconst TEMPLATE_NAME = 'agentbox-base:latest';\nconst DEFAULT_TAG = 'latest';\n\nconst DEFAULT_CPU = 2;\nconst DEFAULT_MEMORY_MB = 4096;\n\n/**\n * Parse a `cpu-memory` GB size spec (e.g. `4-8`) into E2B's\n * `{ cpuCount, memoryMB }`. A third `-disk` slot is accepted but ignored with a\n * warning (E2B's `Template.build` has no disk knob). Returns `undefined` for an\n * empty/unset spec (caller keeps its defaults); throws on a malformed spec so\n * `prepare` surfaces it rather than silently baking the default size.\n *\n * Exported for unit tests.\n */\nexport function parseE2bSize(\n spec: string | undefined,\n warn?: (msg: string) => void,\n): { cpuCount: number; memoryMB: number } | undefined {\n const trimmed = (spec ?? '').trim();\n if (trimmed === '') return undefined;\n const parts = trimmed.split('-');\n const bad = (): never => {\n throw new Error(\n `invalid --size '${trimmed}' for e2b: expected 'cpu-memory' GB, e.g. '4-8'.`,\n );\n };\n if (parts.length < 2 || parts.length > 3) bad();\n const nums = parts.map((p) => Number(p));\n // Every present slot must be a positive integer (rejects '4-8-', 'a-b', '0-8').\n if (nums.some((n) => !Number.isInteger(n) || n <= 0)) bad();\n if (parts.length === 3) {\n warn?.(\n `e2b: ignoring the disk slot in size '${trimmed}' — E2B templates have no disk knob; ` +\n `only cpu-memory (${String(nums[0])}-${String(nums[1])}) is applied.`,\n );\n }\n return { cpuCount: nums[0]!, memoryMB: nums[1]! * 1024 };\n}\n\n/** Normalize a parsed E2B size back to a canonical `cpu-memGB` key for the prepared state. */\nfunction e2bSizeKey(parsed: { cpuCount: number; memoryMB: number }): string {\n return `${String(parsed.cpuCount)}-${String(parsed.memoryMB / 1024)}`;\n}\n\nexport async function prepareE2b(\n opts: PrepareE2bOptions = {},\n): Promise<PrepareE2bResult> {\n await ensureE2bCredentials();\n const apiKey = resolveApiKey();\n const log = opts.onLog ?? (() => {});\n const progress = (s: string) => log(`prepare-e2b: ${s}`);\n\n const assets = resolveRuntimeAssets({\n cliRuntimeRoot: opts.cliRuntimeRoot ?? findStagedCliRuntimeRoot(),\n repoRoot: opts.repoRoot,\n });\n const claudeInstall = opts.claudeInstall ?? 'native';\n // Keep the per-file digests, not just the fold: a later `stale` verdict can\n // then name the files that changed instead of only reporting a moved hash.\n const contextManifest = await computeContextManifest(\n assets.map((a) => ({ rel: a.name, abs: a.localPath })),\n );\n const contextSha = claudeInstallFingerprint(contextManifest.contextSha256, claudeInstall);\n\n // Bake-time size. A `--size` / `box.sizeE2b` like `4-8` overrides the default\n // cpu/memory (E2B rejects per-create resources, so it MUST be baked). The\n // normalized `cpu-memGB` key gates skip-fast so a re-sized bake rebuilds.\n const parsedSize = parseE2bSize(opts.size, (m) => log(m));\n const sizeKey = parsedSize ? e2bSizeKey(parsedSize) : undefined;\n\n // Skip-fast: existing template + matching fingerprint.\n //\n // Probe the persisted templateId itself, not TEMPLATE_NAME. If someone\n // (or another bake) rebuilt the alias under a different id, the name still\n // resolves but the stored id is stale and `Sandbox.create({ template: <stale id> })`\n // 404s. `Template.exists` accepts both `name:tag` and `template-id:tag`\n // forms, so we pass the exact id we'd later hand to `provision`.\n const existing = readPreparedState();\n if (!opts.force && existing.base) {\n const bakedSize = existing.base.size;\n if (existing.base.contextSha256 === contextSha && bakedSize === sizeKey) {\n const stillThere = await templateExists(existing.base.templateId, apiKey);\n if (stillThere) {\n progress(\n `template ${existing.base.templateId} already exists (fingerprint ${contextSha.slice(0, 12)} matches); skipping (pass --force to rebuild)`,\n );\n return { snapshotName: existing.base.templateId };\n }\n progress(`recorded template ${existing.base.templateId} is gone on E2B; rebuilding`);\n } else if (existing.base.contextSha256 === contextSha && bakedSize !== sizeKey) {\n progress(\n `size changed (was ${bakedSize ?? 'default'}, now ${sizeKey ?? 'default'}); rebuilding`,\n );\n } else {\n progress(\n `build context changed (was ${existing.base.contextSha256?.slice(0, 12) ?? '<none>'}, now ${contextSha.slice(0, 12)}); rebuilding`,\n );\n }\n }\n\n // E2B's `template.copy(src, dest)` requires `src` to be a RELATIVE path\n // inside the Template's `fileContextPath`. Stage every resolved asset into\n // a temp dir under its logical name (asset.name) so the copy chain reads\n // from a single context root.\n const contextDir = await mkdtemp(join(tmpdir(), 'agentbox-e2b-build-'));\n let agentStages: AgentStaticStage[] = [];\n try {\n progress(`staging build context at ${contextDir}`);\n await stageAssetsInto(contextDir, assets);\n\n // Stage the host's per-tool static config (shared sync-layer producer) and\n // copy each tarball into the build context (E2B copy sources must be\n // relative to fileContextPath).\n agentStages = await stageAllAgentStatic({ hostWorkspace: opts.hostWorkspace });\n for (const s of agentStages) for (const w of s.staged.warnings) log(w);\n const usableStages = agentStages.filter((s) => s.staged.tarballPath !== null);\n for (const s of usableStages) {\n await copyFile(s.staged.tarballPath as string, resolve(contextDir, e2bStagePaths(s.kind).contextRel));\n }\n\n // Build the Template via the SDK builder. fromBaseImage() starts from E2B's\n // own `e2bdev/base` (Debian 12 + node 20 + git + sudo), which halves the\n // install time vs starting from a vanilla Debian image.\n progress('assembling template build (fromBaseImage + asset copy + runCmd)');\n const template = Template({ fileContextPath: contextDir }).fromBaseImage();\n for (const a of assets) {\n progress(` copy ${a.name} -> ${a.remotePath}`);\n template.copy(a.name, a.remotePath, {\n forceUpload: true,\n mode: a.remoteMode,\n user: 'root',\n });\n }\n template.runCmd(`AGENTBOX_CLAUDE_INSTALL=${claudeInstall} bash /tmp/agentbox-build-template.sh 2>&1`, {\n user: 'root',\n });\n\n // Seed the host's static agent config ON TOP of the built box (the vscode\n // user + home dirs exist only after build-template.sh). Copy each staged\n // tarball into the build, then one root pass extracts + chowns them —\n // mirrors Vercel/Hetzner/Daytona's host-static bake.\n for (const s of usableStages) {\n const { contextRel, remoteTar } = e2bStagePaths(s.kind);\n progress(` seed ${s.kind} static -> ${s.extractDir}`);\n template.copy(contextRel, remoteTar, { forceUpload: true, mode: 0o644, user: 'root' });\n }\n if (usableStages.length > 0) {\n const extract =\n usableStages\n .map((s) => `mkdir -p ${s.extractDir} && tar -xzf ${e2bStagePaths(s.kind).remoteTar} -C ${s.extractDir} --no-same-permissions --no-same-owner -m`)\n .join(' && ') +\n ' && chown -R vscode:vscode /home/vscode/.claude /home/vscode/.codex /home/vscode/.local' +\n ' && ([ -d /home/vscode/.agents ] && chown -R vscode:vscode /home/vscode/.agents || true)' +\n ' && rm -f /tmp/agentbox-seed-*.tar.gz';\n template.runCmd(extract, { user: 'root' });\n }\n // setReadyCmd flips the builder into TemplateFinal — required for build().\n // The check passes once the script's last `install` step lands the ctl bundle.\n const finalTemplate = template.setReadyCmd(\n 'test -x /usr/local/bin/agentbox-ctl',\n );\n\n // Parsed `--size` wins over the explicit cpuCount/memoryMB options, which\n // win over the built-in defaults.\n const cpuCount = parsedSize?.cpuCount ?? opts.cpuCount ?? DEFAULT_CPU;\n const memoryMB = parsedSize?.memoryMB ?? opts.memoryMB ?? DEFAULT_MEMORY_MB;\n progress(\n `running Template.build('${TEMPLATE_NAME}', { cpuCount: ${String(cpuCount)}, memoryMB: ${String(memoryMB)} })`,\n );\n const info = await Template.build(finalTemplate, TEMPLATE_NAME, {\n apiKey,\n cpuCount,\n memoryMB,\n onBuildLogs: (entry: LogEntryLike) => {\n // LogEntry exposes timestamp / level / message; stream the human form.\n log(`[build] ${formatBuildLog(entry)}`);\n },\n });\n progress(`template built: id=${info.templateId} build=${info.buildId} name=${info.name}`);\n\n // Persist. `Sandbox.create({ template })` auto-appends `:default` when no\n // tag is given (and 404s if that tag wasn't built), so we MUST store the\n // tagged form. `info.templateId` is just the raw id with no tag; use the\n // first tag we built with (`latest`) or fall back to `info.tags[0]`.\n const tag = info.tags?.[0] ?? DEFAULT_TAG;\n const cliStamp = readCliStamp();\n const taggedId = `${info.templateId}:${tag}`;\n writePreparedState({\n schema: 1,\n base: {\n templateId: taggedId,\n // info.name is the full `name:tag` pair Template.build() was called\n // with (e.g. `agentbox-base:latest`). Earlier code re-appended `:${tag}`\n // and produced `agentbox-base:latest:latest` in the status display.\n templateName: info.name,\n contextSha256: contextSha,\n files: contextManifest.files,\n ...(sizeKey ? { size: sizeKey } : {}),\n cliVersion: cliStamp.cliVersion,\n cliCommit: cliStamp.cliCommit,\n createdAt: new Date().toISOString(),\n },\n });\n progress(`wrote ${preparedStatePath()}`);\n\n progress(`prepare complete — base template ${taggedId}`);\n return { snapshotName: taggedId };\n } finally {\n await Promise.all(agentStages.map((s) => s.staged.cleanup())).catch(() => {\n // best-effort: staged-tarball cleanup failures are noise.\n });\n await rm(contextDir, { recursive: true, force: true }).catch(() => {\n // best-effort: temp dir cleanup failures are noise, not errors.\n });\n }\n}\n\n/**\n * Copy every asset into `contextDir` under its logical `name`. Preserves the\n * source mode on the copy (E2B's `template.copy` also accepts a `mode`\n * override, but the on-disk mode keeps the local stage representative).\n */\nasync function stageAssetsInto(\n contextDir: string,\n assets: ResolvedAsset[],\n): Promise<void> {\n for (const a of assets) {\n const dest = resolve(contextDir, a.name);\n await mkdir(dirname(dest), { recursive: true });\n await copyFile(a.localPath, dest);\n }\n}\n\n/** E2B build paths for a staged tool (derived from its kind). E2B copy sources\n * must be RELATIVE to the Template `fileContextPath`, so the tarball is staged\n * into the context dir under `contextRel` then copied to `remoteTar`. */\nfunction e2bStagePaths(kind: AgentStaticStage['kind']): { contextRel: string; remoteTar: string } {\n return {\n contextRel: `agentbox-seed-${kind}.tar.gz`,\n remoteTar: `/tmp/agentbox-seed-${kind}.tar.gz`,\n };\n}\n\n/**\n * Check if a named template is bootable on E2B. Returns true on a 'ready'\n * build, false on anything else (deleted, errored, never built). Used by the\n * skip-fast path to detect a template that was deleted out-of-band.\n */\nasync function templateExists(name: string, apiKey: string): Promise<boolean> {\n try {\n return await Template.exists(name, { apiKey });\n } catch {\n return false;\n }\n}\n\n/**\n * E2B's `LogEntry` shape (timestamp, level, message). We treat the SDK's\n * type loosely here so the line-stream doesn't bind us to internal class\n * shapes — only the `.toString()` plus `.message` are documented.\n */\ninterface LogEntryLike {\n message?: string;\n level?: string;\n timestamp?: Date;\n toString(): string;\n}\n\nfunction formatBuildLog(entry: LogEntryLike): string {\n // The SDK's LogEntry.toString() emits a `[level] timestamp message` form.\n // For the spinner we only want the message — and clip overly long lines.\n const raw = typeof entry.message === 'string' ? entry.message : entry.toString();\n const cleaned = raw.replace(/\\r?\\n+$/, '');\n return cleaned.length > 200 ? cleaned.slice(0, 200) + '…' : cleaned;\n}\n\n/** Provider-level binding used by the CLI's `prepare` command. */\nexport const prepareE2bProvider: NonNullable<Provider['prepare']> = (req) =>\n prepareE2b({\n name: req.name,\n hostWorkspace: req.hostWorkspace ?? process.cwd(),\n force: req.force,\n size: req.size,\n claudeInstall: req.claudeInstall,\n onLog: req.onLog,\n });\n","/**\n * `buildE2bAttach` — the E2B provider's override of `Provider.buildAttach`.\n *\n * E2B has no SSH and no public PTY CLI like Vercel's `sbx exec -i`. We ship\n * our own attach helper (`attach-helper.cjs`) that connects to the sandbox via\n * the SDK and bridges the host PTY to an in-box `sandbox.pty.create()`.\n *\n * Argv shape:\n * node <attach-helper.cjs> --sandbox-id <id> --user vscode\n *\n * The inner bash command (`renderInnerCommand` output: tmux ensure + attach)\n * is passed through the environment as `AGENTBOX_E2B_INNER_CMD` so quoting\n * stays sane and it doesn't leak through `ps`. `E2B_API_KEY` is passed through\n * the env for the same reason. `node-pty` (the host PTY wrapper) is what\n * spawns this argv, so stdin/stdout/SIGWINCH all reach the helper unchanged.\n */\n\nimport { existsSync } from 'node:fs';\nimport { dirname, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport {\n type AttachKind,\n type AttachSpec,\n type BoxRecord,\n type BuildAttachOptions,\n} from '@agentbox/core';\nimport { hostTermForCloud, renderInnerCommand } from '@agentbox/sandbox-cloud';\nimport { resolveApiKey } from './sdk.js';\n\nconst SELF = dirname(fileURLToPath(import.meta.url));\n\n/**\n * Resolve the absolute path to `attach-helper.cjs`. In the published CLI it\n * lives at `runtime/e2b/attach-helper.cjs` (next to the staged provider\n * runtime tree); in dev it lives next to the package's `dist/`.\n */\nexport function resolveAttachHelperPath(): string {\n const candidates = [\n // dev: dist/index.js sibling\n resolve(SELF, 'attach-helper.cjs'),\n // dev: src compiled to dist/, while index.ts is in src/\n resolve(SELF, '..', 'dist', 'attach-helper.cjs'),\n // staged CLI: apps/cli/runtime/e2b/attach-helper.cjs\n resolve(SELF, '..', 'runtime', 'e2b', 'attach-helper.cjs'),\n resolve(SELF, '..', '..', 'runtime', 'e2b', 'attach-helper.cjs'),\n ];\n for (const p of candidates) {\n if (existsSync(p)) return p;\n }\n // Last-resort: still return the first candidate so the error message points\n // somewhere informative.\n return candidates[0]!;\n}\n\nexport async function buildE2bAttach(\n box: BoxRecord,\n kind: AttachKind,\n opts?: BuildAttachOptions,\n): Promise<AttachSpec> {\n const sandboxId = box.cloud?.sandboxId;\n if (!sandboxId) {\n throw new Error(`e2b box ${box.name} has no sandboxId — record is malformed`);\n }\n\n const helper = resolveAttachHelperPath();\n if (!existsSync(helper)) {\n throw new Error(\n `e2b attach helper not found at ${helper} — rebuild the CLI (\\`pnpm -w build\\`) ` +\n 'so packages/sandbox-e2b/dist/attach-helper.cjs is generated.',\n );\n }\n\n const apiKey = resolveApiKey();\n const inner = renderInnerCommand(kind, opts);\n // Forward the host's TERM (the helper has no host env once node-pty spawns\n // it, so pass it explicitly). The helper sets it on the in-box PTY; the\n // renderInnerCommand TERM guard downgrades to xterm-256color when the box's\n // terminfo doesn't carry it (e.g. xterm-ghostty), matching the docker path.\n const hostTerm = hostTermForCloud();\n\n const argv = [\n process.execPath,\n helper,\n '--sandbox-id',\n sandboxId,\n '--user',\n 'vscode',\n ];\n // Detached pre-start (new-tab attach / `-i` queue worker): the inner command\n // only creates the tmux session (no `exec tmux attach`). The helper must run\n // it once and EXIT rather than open a persistent interactive PTY that idles\n // forever — otherwise the host's `runDetached` await never resolves and\n // `agentbox <agent>` hangs after \"box ready\". See attach-helper.ts header.\n if (opts?.detached) argv.push('--detached');\n\n return {\n argv,\n env: {\n E2B_API_KEY: apiKey,\n AGENTBOX_E2B_INNER_CMD: inner,\n AGENTBOX_HOST_TERM: hostTerm,\n },\n };\n}\n","/**\n * Doctor probes + normalized credential status for the e2b provider,\n * assembled into `providerModule` in `index.ts`. Moved out of apps/cli so the\n * CLI dispatches to it generically (see `@agentbox/sandbox-core`'s `ProviderModule`).\n */\n\nimport { errSummary, type CheckResult, type CredStatusSummary } from '@agentbox/sandbox-core';\nimport { readE2bCredStatus } from './credentials.js';\nimport { readPreparedState } from './prepared-state.js';\n\nexport function readCredStatusSummary(): CredStatusSummary {\n const cred = readE2bCredStatus();\n return { configured: cred.auth !== 'none', label: cred.auth };\n}\n\nexport async function doctorChecks(): Promise<CheckResult[]> {\n try {\n const cred = readE2bCredStatus();\n const credRes: CheckResult =\n cred.auth === 'none'\n ? {\n label: 'credentials',\n status: 'warn',\n detail: 'not configured',\n hint: '`agentbox e2b login`',\n }\n : { label: 'credentials', status: 'ok', detail: `${cred.auth} (${cred.source})` };\n\n const prepared = readPreparedState();\n const tmplRes: CheckResult = prepared.base?.templateId\n ? {\n label: 'base template',\n status: 'ok',\n detail: `${prepared.base.templateName ?? prepared.base.templateId} (${prepared.base.cliVersion ?? '—'})`,\n }\n : {\n label: 'base template',\n status: 'warn',\n detail: 'not baked',\n hint: '`agentbox prepare --provider e2b`',\n };\n return [credRes, tmplRes];\n } catch (err) {\n return [{ label: 'credentials', status: 'warn', detail: errSummary(err) }];\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACgCA,SAAS,gBAAgB;AEAzB,SAAS,UAAU,OAAO,SAAS,UAAU;AAC7C,SAAS,cAAc;AACvB,SAAS,SAAS,MAAM,eAAe;ACjBvC,SAAS,kBAAkB;AAC3B,SAAS,WAAAA,UAAS,WAAAC,gBAAe;AACjC,SAAS,qBAAqB;AFQ9B,IAAM,kBAAqC,CAAC,KAAM,KAAM,GAAI;AAC5D,IAAM,6BAA6B;AAEnC,IAAM,sBAAN,cAAkC,MAAM;EACtC,YAAY,QAAgB,IAAY;AACtC,UAAM,OAAO,MAAM,+BAA+B,OAAO,EAAE,CAAC,IAAI;AAChE,SAAK,OAAO;EACd;AACF;AAOA,SAAS,aAAa,KAAkC;AACtD,MAAI,CAAC,OAAO,OAAO,QAAQ,SAAU,QAAO;AAC5C,aAAW,OAAO,CAAC,cAAc,UAAU,MAAM,GAAY;AAC3D,UAAM,IAAK,IAAgC,GAAG;AAC9C,QAAI,OAAO,MAAM,SAAU,QAAO;EACpC;AACA,QAAM,OAAQ,IAA4C;AAC1D,MAAI,QAAQ,OAAO,KAAK,WAAW,SAAU,QAAO,KAAK;AACzD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,kBAAkB,IAAI,MAAM,WAAW,WAAW;AAG3E,QAAI;AACF,YAAM,UAAU,EAAE,GAAG,KAAK,OAAO,EAAE,GAAG,IAAI,OAAO,WAAW,SAAS,EAAE,CAAC;IAC1E,QAAQ;IAER;AACA,UAAM,OAAO,MAAM,6BAA6B,IAAI,aAAa,cAAc,MAAM;MACnF,cAAc;MACd,aAAa,IAAI;MACjB,eAAe,IAAI;MACnB,cAAc;MACd,iBAAiB,4BAA4B,YAAY;MACzD,YAAYC,aAAa,EAAE;IAC7B,CAAC;AACD,WAAO,EAAE,KAAK,KAAK,KAAK;EAC1B;EACA,MAAM,KAAK,aAAqB;AAC9B,UAAM,UAAU,MAAM,qBAAqB,aAAa,YAAY;AACpE,WAAO,QAAQ,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,EAAE,SAAS,UAAU,EAAE;EAC9E;EACA,MAAM,OAAO,aAAqB,KAAa;AAC7C,UAAM,QAAQ,MAAM,uBAAuB,aAAa,cAAc,GAAG;AACzE,QAAI,CAAC,MAAO;AACZ,QAAI;AACF,YAAM,kBAAkB,MAAM,SAAS,YAAY;IACrD,QAAQ;IAGR;AACA,UAAM,yBAAyB,aAAa,cAAc,GAAG;EAC/D;AACF;AAEO,IAAM,cAAwB;EACnC,GAAG;EACH,SAAS;EACT,aAAa;EACb,YAAY;EACZ,iBAAiB,CAAC,kBAAkB,8BAA8B,aAAa;AACjF;AAGO,IAAM,iBAAiC;EAC5C,UAAU;EACV,SAAS;EACT,mBAAmB;EACnB,gBAAgB;EAChB,gBAAgB,CAAC,WAAW,QAAQ,QAAQ,kBAAkB,MAAM,CAAC;EACrE,4BAA4B,CAAC,kBAAkB,8BAA8B,aAAa;EAC1F,uBAAuB,MAAM,yBAAyB;EACtD;AACF;","names":["dirname","resolve","snapshotName","dirname","resolve","readCliStamp"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../packages/sandbox-daytona/src/index.ts","../../../packages/sandbox-daytona/src/checkpoint.ts","../../../packages/sandbox-daytona/src/prepare.ts","../../../packages/sandbox-daytona/src/prepare-vm.ts","../../../packages/sandbox-daytona/src/provider-module.ts","../../../packages/sandbox-daytona/src/status.ts"],"sourcesContent":["/**\n * The Daytona Cloud sandbox provider. A thin `CloudBackend` over\n * `@daytona/sdk`, composed via `@agentbox/sandbox-cloud`'s `createCloudProvider`\n * for everything provider-agnostic (workspace seeding, ctl launch, state).\n */\n\nimport type { Provider } from '@agentbox/core';\nimport type { ProviderModule } from '@agentbox/sandbox-core';\nimport { createCloudProvider } from '@agentbox/sandbox-cloud';\nimport { DAYTONA_DEFAULT_RESOURCES, daytonaBackend, DEFAULT_BOX_IMAGE_REF } from './backend.js';\nimport { makeDaytonaCheckpoint } from './checkpoint.js';\nimport { prepareDaytona } from './prepare.js';\nimport { currentDaytonaBaseFingerprintLive } from './prepared-state.js';\nimport { ensureDaytonaCredentials, setDaytonaCredentials } from './credentials.js';\nimport { doctorChecks, readCredStatusSummary } from './provider-module.js';\n\nconst cloudProvider = createCloudProvider(daytonaBackend, {\n defaultResources: { ...DAYTONA_DEFAULT_RESOURCES },\n});\n\nexport const daytonaProvider: Provider = {\n ...cloudProvider,\n prepare: prepareDaytona,\n // Overrides the generic cloud checkpoint: a Daytona cold snapshot needs the\n // sandbox stopped, which kills the in-box daemons, so the capture has to\n // reconnect the box afterwards. See `makeDaytonaCheckpoint`.\n checkpoint: makeDaytonaCheckpoint(cloudProvider),\n baseFingerprint: (claudeInstall) => currentDaytonaBaseFingerprintLive(claudeInstall),\n};\n\n/** Uniform surface the CLI provider loader resolves this package through. */\nexport const providerModule: ProviderModule = {\n provider: daytonaProvider,\n backend: daytonaBackend,\n ensureCredentials: ensureDaytonaCredentials,\n readCredStatus: readCredStatusSummary,\n setCredentials: setDaytonaCredentials,\n currentBaseFingerprintLive: (claudeInstall) => currentDaytonaBaseFingerprintLive(claudeInstall),\n doctorChecks,\n};\n\nexport { DAYTONA_DEFAULT_RESOURCES, daytonaBackend, DEFAULT_BOX_IMAGE_REF };\nexport { resolveDockerfileContext, type DockerfileContext } from './dockerfile-context.js';\nexport { ensureDaytonaEnvLoaded } from './env-loader.js';\nexport { currentDaytonaBaseFingerprintLive } from './prepared-state.js';\n// Called by the CLI provider registry to gate first-run interactive setup.\n// Plain async function — no commander surface — so adding it here doesn't\n// pull commander/clack into consumers' type graphs. The full CLI command\n// lives at the `./cli` subpath export.\nexport { ensureDaytonaCredentials, setDaytonaCredentials } from './credentials.js';\nexport type { EnsureDaytonaCredentialsOptions } from './credentials.js';\nexport {\n getDaytonaStatus,\n type DaytonaStatus,\n type DaytonaSnapshotSummary,\n type DaytonaVolumeSummary,\n} from './status.js';\n","/**\n * Daytona cloud checkpoints.\n *\n * Overrides the generic cloud checkpoint (`makeCloudCheckpoint`) because\n * Daytona's capture has two properties the generic one doesn't model:\n *\n * 1. **A cold snapshot requires the sandbox STOPPED, and Daytona will not stop\n * it for you.** (The hot, filesystem+memory variant needs `includeMemory`,\n * which the published TS SDK silently drops — so it's out of reach until\n * upstream fixes the wrapper.) So we stop, capture, and start again. The\n * stop kills the in-box `ctl` daemon, dockerd, VNC and the agent's tmux\n * session, so the box must be *reconnected* afterwards or the user is left\n * with a running sandbox whose services are all dead.\n *\n * 2. **A snapshot name must never be reused.** Recreating a snapshot under a\n * recently-deleted name yields one that reports `active` but cannot boot\n * (\"Sandbox failed to start: internal error\") — Daytona's delete is async\n * and racing it corrupts the new snapshot. `agentbox checkpoint rm <name>`\n * followed by a re-create with the same name would walk straight into that,\n * so the Daytona-side name carries a nonce while the user-facing checkpoint\n * name stays whatever they typed. The manifest maps one to the other.\n */\nimport type { BoxRecord, Provider, ProviderCheckpoint } from '@agentbox/core';\nimport {\n cloudSnapshotName,\n currentCloudBaseFingerprint,\n listCloudCheckpoints,\n removeCloudCheckpointDir,\n resolveCloudCheckpoint,\n writeCloudCheckpointManifest,\n} from '@agentbox/sandbox-cloud';\nimport { readCliStamp } from '@agentbox/sandbox-core';\nimport { daytonaBackend } from './backend.js';\n\nconst BACKEND_NAME = 'daytona';\n\nexport function makeDaytonaCheckpoint(cloudProvider: Provider): ProviderCheckpoint {\n return {\n async create(box: BoxRecord, name: string) {\n if (!box.projectRoot) {\n throw new Error(\n 'cloud checkpoint requires the box to have a project root (run `agentbox checkpoint` from inside the project)',\n );\n }\n const sandboxId = box.cloud?.sandboxId;\n if (!sandboxId) {\n throw new Error(`daytona box ${box.name} has no sandboxId — record is malformed`);\n }\n const handle = { sandboxId, sandboxClass: box.cloud?.sandboxClass };\n // Unique per capture — see the name-reuse note above.\n const snapshotName = `${cloudSnapshotName(box.projectRoot, name)}-${Math.floor(Date.now() / 1000).toString(36)}`;\n\n await daytonaBackend.createSnapshot?.(handle, snapshotName);\n\n // The capture stopped and restarted the sandbox, so everything the box was\n // running is gone. `reconnect` re-runs the bootstrap (ctl, dockerd, VNC,\n // preview URLs) — without it the box looks up but answers nothing.\n await cloudProvider.reconnect(box);\n\n const info = await writeCloudCheckpointManifest(box.projectRoot, BACKEND_NAME, name, {\n snapshotName,\n sourceBoxId: box.id,\n sourceBoxName: box.name,\n baseProvider: BACKEND_NAME,\n baseFingerprint: currentCloudBaseFingerprint(BACKEND_NAME),\n cliVersion: readCliStamp().cliVersion,\n });\n return { ref: info.name };\n },\n\n async list(projectRoot: string) {\n const entries = await listCloudCheckpoints(projectRoot, BACKEND_NAME);\n return entries.map((e) => ({ ref: e.name, createdAt: e.manifest.createdAt }));\n },\n\n async remove(projectRoot: string, ref: string) {\n const entry = await resolveCloudCheckpoint(projectRoot, BACKEND_NAME, ref);\n if (!entry) return;\n try {\n await daytonaBackend.deleteSnapshot?.(entry.manifest.snapshotName);\n } catch {\n // Best-effort: drop the local manifest even when the remote delete fails,\n // so the user isn't left holding a pointer to nothing.\n }\n await removeCloudCheckpointDir(projectRoot, BACKEND_NAME, ref);\n },\n };\n}\n","/**\n * Daytona-side implementation of the `Provider.prepare` hook (`agentbox\n * prepare --provider daytona`). One-time, user-triggered:\n *\n * 1. Stage filtered tarballs of the host's `~/.claude`, `~/.codex`, and\n * `~/.local/share/opencode` static config (no auth tokens — those go on\n * the per-org `agentbox-credentials` volume at create time).\n * 2. Build a layered Daytona `Image`: start from `Dockerfile.box`, then\n * `.addLocalFile()` each staged tarball + `.runCommands()` to extract\n * them into the right paths inside the image.\n * 3. Call `daytona.snapshot.create({ name, image }, { onLogs })` — Daytona\n * runs the build server-side, registers the result as an org-scoped\n * named snapshot, and returns when it's `active`.\n *\n * Replaces the old `agentbox daytona publish-snapshot` flow that\n * provisioned a sandbox + ran an in-sandbox bake + called the broken\n * `_experimental_createSnapshot`. The new path never provisions a sandbox.\n *\n * Source of truth for the public API:\n * https://www.daytona.io/docs/en/snapshots/\n */\n\nimport { copyFileSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';\nimport { tmpdir } from 'node:os';\nimport { dirname, join } from 'node:path';\nimport { Image } from '@daytona/sdk';\nimport type { PrepareOptions, PrepareResult } from '@agentbox/core';\nimport { DAYTONA_VM_REGION, type DaytonaSandboxClass } from '@agentbox/config';\nimport {\n claudeInstallFingerprint,\n stageAllAgentStatic,\n type AgentStaticStage,\n} from '@agentbox/sandbox-core';\nimport {\n DAYTONA_DEFAULT_RESOURCES,\n daytonaBackend,\n getClient,\n parseDaytonaSize,\n} from './backend.js';\nimport { resolveDaytonaCustomClaudeMd, resolveDockerfileContext } from './dockerfile-context.js';\nimport { ensureDaytonaEnvLoaded } from './env-loader.js';\nimport {\n bakeDaytonaVmBase,\n deleteSnapshotQuietly,\n VmBaseImageUnavailableError,\n} from './prepare-vm.js';\nimport {\n computeDaytonaContextFingerprint,\n computeDockerBaseSha,\n preparedMatches,\n readPreparedDaytonaState,\n writePreparedDaytonaState,\n} from './prepared-state.js';\n\n/**\n * Default snapshot name. Keyed on the first 12 chars of the build-context\n * fingerprint so identical content produces the same snapshot name across\n * machines / CLI runs (idempotent): if the named snapshot already exists\n * on Daytona, prepare can short-circuit without uploading the build\n * context again. Falls back to a timestamp when fingerprinting fails\n * (partial dev rebuild).\n */\nexport function defaultSnapshotName(\n fingerprint: string | null,\n sizeKey?: string,\n sandboxClass?: DaytonaSandboxClass,\n): string {\n // The size suffix keeps re-sized bakes from colliding on one name, so a\n // `--size 2-4-8` snapshot doesn't overwrite the `4-8-20` one. Same for the\n // class: a VM and a container snapshot of the same context are different\n // artifacts and cannot substitute for each other. Container stays unsuffixed\n // so existing snapshot names keep resolving.\n const suffix = `${sizeKey ? `-${sizeKey}` : ''}${sandboxClass === 'linux-vm' ? '-vm' : ''}`;\n if (fingerprint) return `agentbox-base-${fingerprint.slice(0, 12)}${suffix}`;\n return `agentbox-base-${Math.floor(Date.now() / 1000).toString()}${suffix}`;\n}\n\n/**\n * Daytona build paths for a staged tool. The tarball is copied into the seed\n * build-context dir under `contextRel` (a RELATIVE name — the Daytona builder\n * only resolves COPY sources that map to a relative archive entry; an absolute\n * `addLocalFile` COPY silently fails to land), then COPYed to `remoteTar`.\n */\nfunction daytonaSeedPaths(kind: AgentStaticStage['kind']): { contextRel: string; remoteTar: string } {\n return {\n contextRel: `agentbox-seed-${kind}.tar.gz`,\n remoteTar: `/tmp/agentbox-seed-${kind}.tar.gz`,\n };\n}\n\n/** Relative name the daytona CLAUDE.md overlay is staged under in the seed context dir. */\nconst DAYTONA_CLAUDE_MD_REL = 'agentbox-custom-CLAUDE.md';\n\n/**\n * Build the appended Dockerfile commands for the seed bake. Every `COPY` source\n * is a RELATIVE name resolved against the seed build-context dir — the Daytona\n * builder drops absolute-source COPYs (they archive to a stripped relative entry\n * that the absolute source can't reference), so relative names are mandatory.\n * Runs as root (COPY drops files root-owned; chown -R + /etc/claude-code need\n * root), then restores `USER vscode` so the image keeps its default-user invariant.\n * Pure + exported for the regression test.\n */\nexport function buildDaytonaSeedCommands(\n usable: ReadonlyArray<Pick<AgentStaticStage, 'kind' | 'extractDir'>>,\n): string[] {\n const cmds: string[] = [\n 'USER root',\n `COPY ${DAYTONA_CLAUDE_MD_REL} /tmp/agentbox-custom-CLAUDE.md`,\n ...usable.map((s) => `COPY ${daytonaSeedPaths(s.kind).contextRel} ${daytonaSeedPaths(s.kind).remoteTar}`),\n 'RUN install -m 0644 /tmp/agentbox-custom-CLAUDE.md /etc/claude-code/CLAUDE.md && rm -f /tmp/agentbox-custom-CLAUDE.md',\n ...usable.map(\n (s) =>\n `RUN mkdir -p ${s.extractDir} && tar -xzf ${daytonaSeedPaths(s.kind).remoteTar} -C ${s.extractDir} --no-same-permissions --no-same-owner -m`,\n ),\n ];\n if (usable.length > 0) {\n // Own the extracted trees as the box user, then drop the staging tarballs.\n // ~/.agents is only present when the host had one (skills dir); guard it.\n cmds.push(\n 'RUN chown -R vscode:vscode /home/vscode/.claude /home/vscode/.codex /home/vscode/.local' +\n ' && ( [ -d /home/vscode/.agents ] && chown -R vscode:vscode /home/vscode/.agents || true )' +\n ' && rm -f /tmp/agentbox-seed-*.tar.gz',\n );\n }\n cmds.push('USER vscode');\n return cmds;\n}\n\n/**\n * Run `agentbox prepare --provider daytona`. Returns `{ snapshotName }` on\n * success so the CLI can pin it into the project config.\n */\nexport async function prepareDaytona(opts: PrepareOptions): Promise<PrepareResult> {\n ensureDaytonaEnvLoaded();\n const log = opts.onLog ?? (() => {});\n\n // Fingerprint the build context first so we can (a) name the snapshot\n // deterministically and (b) detect cache hits against the recorded\n // prepared state. Computed before staging so an early `null` (partial\n // dev rebuild) doesn't waste a tar staging cycle.\n const claudeInstall = opts.claudeInstall ?? 'native';\n\n // Bake-time resources. A `--size` / `box.sizeDaytona` like `4-8-20` sets the\n // snapshot's baked CPU/memory/disk (Daytona rejects resources on the create\n // snapshot path, so it MUST be set here). Normalize to a canonical\n // `cpu-memory-disk` string for the snapshot-name suffix + prepared-state so\n // `04-08-20` and `4-8-20` don't fork the cache.\n const sizeSpec = opts.size?.trim() || undefined;\n const sizeResources = sizeSpec ? parseDaytonaSize(sizeSpec) : undefined;\n if (sizeSpec && !sizeResources) {\n throw new Error(\n `invalid --size '${sizeSpec}' for daytona: expected 'cpu-memory-disk' GB, e.g. '4-8-20'.`,\n );\n }\n const sizeKey = sizeResources\n ? `${String(sizeResources.cpu)}-${String(sizeResources.memory)}-${String(sizeResources.disk)}`\n : undefined;\n\n // The class is fixed at bake time — a snapshot of one class cannot create a\n // sandbox of the other — so it belongs in the snapshot name and the cache key.\n let sandboxClass: DaytonaSandboxClass =\n opts.sandboxClass === 'container' ? 'container' : 'linux-vm';\n const rawFingerprint = await computeDaytonaContextFingerprint();\n // Fold the install mode into the sha so native↔npm are distinct cache\n // identities (`native` leaves the hash unchanged) — the snapshot name and the\n // prepared-state match both derive from it.\n const fingerprint = rawFingerprint\n ? {\n ...rawFingerprint,\n contextSha256: claudeInstallFingerprint(rawFingerprint.contextSha256, claudeInstall),\n }\n : rawFingerprint;\n // Not const: a linux-vm bake that finds no published base image downgrades to\n // container below, and must then drop the `-vm` suffix from its name.\n let snapshotName =\n opts.name ?? defaultSnapshotName(fingerprint?.contextSha256 ?? null, sizeKey, sandboxClass);\n\n const prepared = readPreparedDaytonaState();\n if (\n !opts.force &&\n fingerprint &&\n preparedMatches(prepared, fingerprint.contextSha256, sizeKey, sandboxClass)\n ) {\n // Confirm the snapshot still exists on Daytona before short-circuiting.\n // A \"yes locally, no on the server\" mismatch must rebuild.\n try {\n const existing = await getClient().snapshot.get(\n prepared?.base?.imageRef ?? snapshotName,\n );\n if (existing?.name) {\n log(\n `daytona snapshot '${existing.name}' up to date ` +\n `(fingerprint ${fingerprint.contextSha256.slice(0, 12)}) — skipping rebuild ` +\n `(pass --force to override)`,\n );\n return { snapshotName: existing.name };\n }\n log(\n `recorded snapshot '${prepared?.base?.imageRef ?? snapshotName}' not found on Daytona; rebuilding`,\n );\n } catch {\n log(\n `recorded snapshot lookup failed; rebuilding (pass --force to silence)`,\n );\n }\n } else if (!opts.force && fingerprint && prepared?.base?.contextSha256) {\n const bakedSize = prepared.extras?.size;\n const bakedClass = prepared.extras?.class ?? 'container';\n const sameContext = prepared.base.contextSha256 === fingerprint.contextSha256;\n if (sameContext && bakedClass !== sandboxClass) {\n log(\n `daytona sandbox class changed (was ${bakedClass}, now ${sandboxClass}); rebuilding snapshot`,\n );\n } else if (sameContext && bakedSize !== sizeKey) {\n log(\n `daytona size changed (was ${bakedSize ?? 'default'}, now ${sizeKey ?? 'default'}); ` +\n `rebuilding snapshot`,\n );\n } else {\n log(\n `daytona build context changed (was ${prepared.base.contextSha256.slice(0, 12)}, ` +\n `now ${fingerprint.contextSha256.slice(0, 12)}); rebuilding snapshot`,\n );\n }\n }\n\n const ctx = resolveDockerfileContext();\n if (!ctx) {\n throw new Error(\n 'could not locate AgentBox Dockerfile.box build context for the Daytona snapshot. ' +\n 'Set AGENTBOX_DOCKER_CONTEXT to the directory containing Dockerfile.box.',\n );\n }\n\n const daytonaClaudeMd = resolveDaytonaCustomClaudeMd();\n if (!daytonaClaudeMd) {\n throw new Error(\n 'could not locate packages/sandbox-daytona/scripts/custom-system-CLAUDE.md ' +\n '(or its staged runtime/daytona/ copy). Ensure `pnpm -w build` ran so the ' +\n 'CLI staging populated runtime/daytona/.',\n );\n }\n\n if (sandboxClass === 'linux-vm') {\n const dockerBaseSha = await computeDockerBaseSha(claudeInstall);\n if (!dockerBaseSha) {\n throw new Error(\n 'could not fingerprint the docker build context, which names the published box image ' +\n 'a linux-vm base must boot from. Ensure `pnpm -w build` ran, or set ' +\n '`agentbox config set box.daytonaClass container`.',\n );\n }\n try {\n const baked = await bakeDaytonaVmBase({\n client: getClient(opts.location ?? DAYTONA_VM_REGION),\n backend: daytonaBackend,\n regionId: opts.location ?? DAYTONA_VM_REGION,\n snapshotName,\n dockerBaseSha,\n registry: opts.registry,\n baseImage: opts.vmBaseImage,\n // Always explicit: a snapshot created with no `resources` gets Daytona's\n // 1 vCPU / 1 GiB / 3 GiB default, and the box image does not fit in 3 GiB\n // (the build dies mid-pull with a bare \"internal error\").\n resources: sizeResources ?? { ...DAYTONA_DEFAULT_RESOURCES },\n hostWorkspace: opts.hostWorkspace,\n claudeMdOverlay: daytonaClaudeMd,\n onLog: log,\n });\n if (fingerprint) {\n writePreparedDaytonaState({\n snapshotName: baked.snapshotName,\n contextSha256: fingerprint.contextSha256,\n size: sizeKey,\n class: 'linux-vm',\n env: baked.env,\n });\n log(`recorded daytona-prepared.json (fingerprint ${fingerprint.contextSha256.slice(0, 12)})`);\n }\n // Reap the snapshot this bake replaces. Only after the new one is recorded\n // — a failed bake must never leave the user with no base at all. Never the\n // one we just made, and never a container snapshot (a user who flips the\n // class back would want it).\n const superseded = prepared?.base?.imageRef;\n if (superseded && superseded !== baked.snapshotName && prepared?.extras?.class === 'linux-vm') {\n log(`removing superseded snapshot '${superseded}'`);\n await deleteSnapshotQuietly(getClient(opts.location ?? DAYTONA_VM_REGION), superseded);\n }\n return { snapshotName: baked.snapshotName };\n } catch (err) {\n if (!(err instanceof VmBaseImageUnavailableError)) throw err;\n // No published image for this context (a locally edited Dockerfile.box is\n // the usual cause — a contributor, not an end user). Daytona cannot build\n // a VM from a Dockerfile, so the only thing we *can* bake is a container.\n log(\n `daytona: ${err.message} This usually means a locally modified Dockerfile.box. ` +\n `Daytona can't build a linux-vm base from a Dockerfile, so falling back to a ` +\n `container snapshot (no pause/resume).`,\n );\n sandboxClass = 'container';\n // Re-derive the name without the `-vm` suffix, or we'd register a\n // container snapshot under a name that advertises a VM.\n snapshotName =\n opts.name ?? defaultSnapshotName(fingerprint?.contextSha256 ?? null, sizeKey, sandboxClass);\n }\n }\n\n const stages = await stageAllAgentStatic({ hostWorkspace: opts.hostWorkspace });\n // Surface staging warnings (codex Keychain landmine, etc.) before the\n // longer build kicks off.\n for (const s of stages) {\n for (const w of s.staged.warnings) log(w);\n }\n\n // The Daytona SDK's `Image.fromDockerfile` takes only a path — no build args —\n // and appended `.env()`/`.runCommands()` land *after* the base Dockerfile's\n // Claude RUN (too late, and a native 403 would already have failed the build).\n // So for npm mode we build from a sibling temp Dockerfile with the\n // `AGENTBOX_CLAUDE_INSTALL` ARG default flipped to `npm`. It must live in the\n // original's directory so the Dockerfile's relative COPY sources still resolve.\n let tempDockerfile: string | null = null;\n const dockerfilePath =\n claudeInstall === 'npm'\n ? (tempDockerfile = writeNpmDockerfile(ctx.dockerfile))\n : ctx.dockerfile;\n\n // Seed build-context dir: the daytona CLAUDE.md + each staged tarball are\n // copied here under RELATIVE names so the appended `COPY <name>` sources map\n // to relative archive entries the Daytona builder actually reconstructs.\n // (An absolute `addLocalFile` COPY emits `COPY /abs/tmp/x` but archives the\n // entry as the stripped `abs/tmp/x` — the mismatch silently drops the layer.)\n let seedContextDir: string | null = null;\n try {\n // git-lfs (binary + `git lfs install --system`) is inherited for free from\n // Dockerfile.box, so an in-box checkout of an LFS repo smudges real content.\n // No daytona-specific overlay step is needed; the host-side object seeding\n // lives in sandbox-cloud's workspace-seed (seedCloneLfsObjects).\n let image: Image = Image.fromDockerfile(dockerfilePath);\n\n seedContextDir = mkdtempSync(join(tmpdir(), 'agentbox-daytona-seed-'));\n // Overlay the daytona-specific /etc/claude-code/CLAUDE.md on top of the\n // docker-shaped one baked by Dockerfile.box (daytona boxes have no host\n // .git/ bind-mount, so the in-box hint needs daytona-specific git wording).\n copyFileSync(daytonaClaudeMd, join(seedContextDir, DAYTONA_CLAUDE_MD_REL));\n\n const usable = stages.filter((s) => s.staged.tarballPath !== null);\n for (const s of usable) {\n copyFileSync(s.staged.tarballPath as string, join(seedContextDir, daytonaSeedPaths(s.kind).contextRel));\n }\n\n image = image.dockerfileCommands(buildDaytonaSeedCommands(usable), seedContextDir);\n\n // Region: a container snapshot registers wherever the client points (the\n // account default unless the user pinned `box.daytonaRegion`).\n const client = getClient(opts.location ?? '');\n log(\n `creating Daytona snapshot '${snapshotName}'${sizeResources ? ` (${sizeKey})` : ''}…`,\n );\n const snapshot = await client.snapshot.create(\n {\n name: snapshotName,\n image,\n ...(sizeResources ? { resources: sizeResources } : {}),\n ...(opts.location ? { regionId: opts.location } : {}),\n },\n {\n onLogs: (chunk: string) => log(String(chunk).split('\\n').filter(Boolean).join(' ')),\n },\n );\n log(`snapshot '${snapshot.name}' is ${snapshot.state ?? 'created'}`);\n if (fingerprint) {\n writePreparedDaytonaState({\n snapshotName: snapshot.name ?? snapshotName,\n contextSha256: fingerprint.contextSha256,\n size: sizeKey,\n class: 'container',\n });\n log(\n `recorded daytona-prepared.json (fingerprint ${fingerprint.contextSha256.slice(0, 12)})`,\n );\n }\n return { snapshotName: snapshot.name ?? snapshotName };\n } finally {\n await Promise.all(stages.map((s) => s.staged.cleanup()));\n if (tempDockerfile) rmSync(tempDockerfile, { force: true });\n if (seedContextDir) rmSync(seedContextDir, { recursive: true, force: true });\n }\n}\n\n/**\n * Write a sibling copy of `Dockerfile.box` with the `AGENTBOX_CLAUDE_INSTALL`\n * ARG default flipped from `native` to `npm`, and return its path. A sibling\n * (same directory) keeps the Dockerfile's relative COPY sources resolvable.\n * Throws if the ARG line isn't found (Dockerfile drifted from this expectation).\n */\nfunction writeNpmDockerfile(originalPath: string): string {\n const original = readFileSync(originalPath, 'utf8');\n const flipped = original.replace(\n 'ARG AGENTBOX_CLAUDE_INSTALL=native',\n 'ARG AGENTBOX_CLAUDE_INSTALL=npm',\n );\n if (flipped === original) {\n throw new Error(\n `could not enable npm Claude install for Daytona: 'ARG AGENTBOX_CLAUDE_INSTALL=native' ` +\n `not found in ${originalPath}. The Dockerfile.box drifted from the expected shape.`,\n );\n }\n const target = join(dirname(originalPath), '.agentbox-claude-npm.Dockerfile');\n writeFileSync(target, flipped);\n return target;\n}\n","/**\n * The `linux-vm` half of `agentbox prepare --provider daytona`.\n *\n * The container path builds its base with Daytona's declarative builder\n * (`Image.fromDockerfile` + layered seed commands). **That is not available for\n * VMs** — Daytona builds a VM snapshot only from a prebuilt registry image\n * (verified 2026-07-12: passing an `Image` with `sandboxClass: LINUX_VM` fails\n * with `build snapshot: rpc error: code = Unauthenticated`). So the VM bake is\n * shaped like Hetzner's and Vercel's instead — boot once, provision in-place,\n * snapshot the result:\n *\n * 1. `snapshot.create` a VM snapshot straight from the published GHCR box\n * image (`ghcr.io/madarco/agentbox/box:sha-<docker-context-sha>`), which\n * CI already builds and publishes. ~66s, vs ~7 min for a Dockerfile build.\n * 2. Boot one throwaway sandbox from it and, in-place:\n * a. repair `sudo` (see below),\n * b. seed the host's agent static config + the daytona CLAUDE.md overlay.\n * 3. Stop it and cold-snapshot it as the real base, then delete it.\n *\n * ## Why sudo needs repairing\n *\n * Converting the container image into a VM rootfs strips setuid bits: `sudo`\n * lands as mode 0755 and cannot escalate (\"must be owned by uid 0 and have the\n * setuid bit set\"). Only mount/umount/su keep theirs. That breaks the seed\n * (installing `/etc/claude-code/CLAUDE.md` needs root) and breaks the\n * passwordless sudo the in-box agent is told it has. `create({ user: 'root' })`\n * is not a way out — the sandbox then fails to start.\n *\n * The escape hatch is the docker socket, which the image already gives us:\n * dockerd runs at boot and `vscode` is in the `docker` group, so a privileged\n * container can write the host VM's filesystem. The repair persists into the\n * snapshot, so every box booted from this base has working sudo from the start.\n */\nimport { createHash } from 'node:crypto';\nimport type { CloudBackend, CloudHandle } from '@agentbox/core';\nimport type { Daytona } from '@daytona/sdk';\nimport { SandboxClass } from '@daytona/sdk';\nimport { seedAgentStaticIntoCloudBox } from '@agentbox/sandbox-cloud';\nimport { BOX_IMAGE_REGISTRY, registryRefForSha } from '@agentbox/sandbox-core';\nimport { waitForSnapshotActive } from './snapshot-wait.js';\n\n/**\n * Restore sudo's setuid bit (and quiet its hostname warning) from inside the\n * box, by borrowing root from the docker daemon. Exported for the unit test.\n *\n * `--privileged -v /:/host` is what lets an unprivileged `vscode` write a\n * root-owned file: the container runs as root and sees the VM's rootfs at\n * /host. This is not a privilege escalation we are introducing — `vscode` is\n * already in the `docker` group, which is root-equivalent by construction.\n */\nexport function buildSudoRepairCommand(): string {\n return (\n 'docker run --rm --privileged -v /:/host alpine sh -c ' +\n `'chown root:root /host/usr/bin/sudo && chmod 4755 /host/usr/bin/sudo && ` +\n // sudo emits \"unable to resolve host <name>\" on every call when the box's\n // hostname has no /etc/hosts entry. Noisy, and it costs a DNS timeout.\n `grep -q \"\\\\b$(cat /host/etc/hostname)\\\\b\" /host/etc/hosts || ` +\n `echo \"127.0.0.1 $(cat /host/etc/hostname)\" >> /host/etc/hosts'`\n );\n}\n\n/** Poll until dockerd answers — it starts at boot, but not instantly. */\nexport function buildDockerWaitCommand(): string {\n return 'for i in $(seq 1 30); do docker info >/dev/null 2>&1 && exit 0; sleep 2; done; exit 1';\n}\n\nexport interface VmBaseBakeOptions {\n client: Daytona;\n backend: CloudBackend;\n /** Region the VM snapshot is registered in — only us-east-1 has VM runners. */\n regionId: string;\n /** Final base-snapshot name, pinned into `box.imageDaytona`. */\n snapshotName: string;\n /** Raw docker build-context sha — names the published GHCR image. */\n dockerBaseSha: string;\n /** Registry override (`box.imageRegistry`); empty = the public default. */\n registry?: string;\n /**\n * Explicit base image (`box.daytonaVmBaseImage`), bypassing the\n * fingerprint-tagged lookup. The escape hatch for a build context with no\n * published image — chiefly a locally modified `Dockerfile.box`, i.e. anyone\n * developing on the monorepo, since a local `pnpm build` regenerates\n * `packages/ctl/dist/bin.cjs` and shifts the context sha off CI's.\n */\n baseImage?: string;\n resources?: { cpu: number; memory: number; disk: number };\n hostWorkspace?: string;\n /** Host path to the daytona `/etc/claude-code/CLAUDE.md` overlay. */\n claudeMdOverlay: string;\n onLog?: (line: string) => void;\n}\n\n/**\n * Thrown when the GHCR image the VM base must boot from doesn't exist for this\n * build context — a locally edited `Dockerfile.box`, or an npm Claude install\n * (CI publishes only the native variant). The caller degrades to the container\n * class rather than dead-ending the user.\n */\nexport class VmBaseImageUnavailableError extends Error {}\n\n/** Does the registry actually have this tag? Anonymous HEAD — no docker needed. */\nexport async function ghcrTagExists(ref: string): Promise<boolean> {\n // ghcr.io/<owner>/<path>:<tag>\n const m = /^ghcr\\.io\\/(.+):([^:]+)$/.exec(ref);\n if (!m) return true; // non-GHCR registry: don't pretend to know; let the bake try.\n const [, repo, tag] = m;\n try {\n const tokenRes = await fetch(\n `https://ghcr.io/token?scope=repository:${repo}:pull&service=ghcr.io`,\n );\n if (!tokenRes.ok) return false;\n const { token } = (await tokenRes.json()) as { token?: string };\n if (!token) return false;\n const res = await fetch(`https://ghcr.io/v2/${repo}/manifests/${tag}`, {\n method: 'HEAD',\n headers: {\n Authorization: `Bearer ${token}`,\n Accept: [\n 'application/vnd.oci.image.index.v1+json',\n 'application/vnd.oci.image.manifest.v1+json',\n 'application/vnd.docker.distribution.manifest.list.v2+json',\n 'application/vnd.docker.distribution.manifest.v2+json',\n ].join(','),\n },\n });\n return res.ok;\n } catch {\n // Network trouble is not \"the tag is missing\" — let the bake surface the\n // real error rather than silently downgrading the user to a container.\n return true;\n }\n}\n\n/**\n * The image's declared environment (`ENV` in Dockerfile.box, plus PATH), read\n * from its config blob in the registry.\n *\n * A container inherits `ENV` from the image's *metadata*. A linux-vm does not:\n * the conversion turns the image into a rootfs, and metadata is not a file, so\n * every `ENV` silently disappears — `DISPLAY=:1` above all, which is why the\n * in-box browser died with \"Missing X server or $DISPLAY\" on a VM box while\n * working fine on docker and container-class daytona. (Same family as the\n * setuid-stripping the sudo repair works around.)\n *\n * Read rather than hardcoded: Dockerfile.box owns these values, and a copy here\n * would rot the first time someone adds an ENV. The config blob is a few hundred\n * bytes — no image pull.\n *\n * Returns null when the env can't be read (non-GHCR override, network trouble):\n * the caller warns and bakes anyway rather than failing the whole prepare.\n */\nexport async function fetchImageEnv(ref: string): Promise<string[] | null> {\n const m = /^ghcr\\.io\\/(.+):([^:]+)$/.exec(ref);\n if (!m) return null;\n const [, repo, tag] = m;\n const accept = [\n 'application/vnd.oci.image.index.v1+json',\n 'application/vnd.oci.image.manifest.v1+json',\n 'application/vnd.docker.distribution.manifest.list.v2+json',\n 'application/vnd.docker.distribution.manifest.v2+json',\n ].join(',');\n try {\n const tokenRes = await fetch(\n `https://ghcr.io/token?scope=repository:${repo}:pull&service=ghcr.io`,\n );\n if (!tokenRes.ok) return null;\n const { token } = (await tokenRes.json()) as { token?: string };\n if (!token) return null;\n const headers = { Authorization: `Bearer ${token}`, Accept: accept };\n\n const get = async (r: string): Promise<Record<string, unknown> | null> => {\n const res = await fetch(`https://ghcr.io/v2/${repo}/${r}`, { headers });\n return res.ok ? ((await res.json()) as Record<string, unknown>) : null;\n };\n\n let manifest = await get(`manifests/${tag}`);\n // Multi-arch index -> pick the linux/amd64 child (Daytona is x86_64 only).\n const children = manifest?.manifests as\n | Array<{ digest: string; platform?: { os?: string; architecture?: string } }>\n | undefined;\n if (children) {\n const amd64 = children.find(\n (c) => c.platform?.os === 'linux' && c.platform.architecture === 'amd64',\n );\n if (!amd64) return null;\n manifest = await get(`manifests/${amd64.digest}`);\n }\n const configDigest = (manifest?.config as { digest?: string } | undefined)?.digest;\n if (!configDigest) return null;\n const config = await get(`blobs/${configDigest}`);\n const env = (config?.config as { Env?: unknown } | undefined)?.Env;\n if (!Array.isArray(env)) return null;\n return env.filter((e): e is string => typeof e === 'string' && e.includes('='));\n } catch {\n return null;\n }\n}\n\n/**\n * Put the image's `ENV` back on disk in the VM, where a rootfs can carry it.\n *\n * Two files, because two kinds of process need it and neither reads the other's:\n * - `/etc/profile.d/` — login shells (the ssh attach, any `bash -lc`).\n * - `/etc/environment` — PAM, and it's the conventional home for these.\n *\n * The values are also handed to `create` as sandbox env vars (see the backend),\n * which is what covers plain non-login `exec` — the path `agent-browser` runs on.\n */\nexport function buildEnvRestoreCommand(env: string[]): string {\n const shQuote = (v: string): string => `'${v.replace(/'/g, `'\\\\''`)}'`;\n const profile = env\n .map((e) => {\n const i = e.indexOf('=');\n return `export ${e.slice(0, i)}=${shQuote(e.slice(i + 1))}`;\n })\n .join('\\n');\n const envFile = env.join('\\n');\n const b64 = (s: string): string => Buffer.from(`${s}\\n`, 'utf8').toString('base64');\n // base64 through a pipe: the values contain quotes and colons, and this command\n // is itself shipped through a shell.\n return (\n `printf %s '${b64(profile)}' | base64 -d | sudo tee /etc/profile.d/agentbox-image-env.sh >/dev/null && ` +\n `sudo chmod 644 /etc/profile.d/agentbox-image-env.sh && ` +\n `printf %s '${b64(envFile)}' | base64 -d | sudo tee -a /etc/environment >/dev/null`\n );\n}\n\n/** What a VM bake produced: the snapshot, and the image env it had to restore. */\nexport interface VmBaseBakeResult {\n snapshotName: string;\n /**\n * The image's `ENV`, recorded so `create` can also hand it to the sandbox.\n * The on-disk copy covers login shells; sandbox env vars cover the plain\n * non-login `exec` that `agent-browser` (and every other host-driven command)\n * runs on. Empty when the registry couldn't be read.\n */\n env: string[];\n}\n\n/**\n * Bake the linux-vm base snapshot.\n */\nexport async function bakeDaytonaVmBase(opts: VmBaseBakeOptions): Promise<VmBaseBakeResult> {\n const log = opts.onLog ?? (() => {});\n let imageEnv: string[] = [];\n const override = opts.baseImage?.trim();\n const registry = opts.registry && opts.registry.length > 0 ? opts.registry : BOX_IMAGE_REGISTRY;\n const imageRef = override || registryRefForSha(opts.dockerBaseSha, registry);\n\n // An explicit override is the user's problem to get right — if it doesn't\n // exist, Daytona's own error is clearer than a guess from us, and silently\n // downgrading them to a container would ignore what they asked for.\n if (!override && !(await ghcrTagExists(imageRef))) {\n throw new VmBaseImageUnavailableError(\n `the linux-vm base needs a published box image, and '${imageRef}' isn't in the registry.`,\n );\n }\n if (override) log(`using box.daytonaVmBaseImage override: ${imageRef}`);\n\n // Tier 1: the plain box image as a VM snapshot. Content-addressed by the\n // docker sha, so a re-bake with different agent config reuses it (this is the\n // expensive step — it pulls a ~2 GB image). An overridden image gets its own\n // name so it can't collide with a fingerprint-derived one.\n const vmBaseStem = override\n ? `agentbox-vmbase-x${sha12(override)}`\n : `agentbox-vmbase-${opts.dockerBaseSha.slice(0, 12)}`;\n\n let vmBaseName = vmBaseStem;\n if (await snapshotIsActive(opts.client, vmBaseName)) {\n log(`reusing linux-vm base image snapshot '${vmBaseName}'`);\n } else {\n vmBaseName = await createVmBaseSnapshot(opts, vmBaseStem, imageRef, log);\n }\n\n // Tier 2: boot it, provision in-place, snapshot the result.\n log('booting a throwaway sandbox to seed the base…');\n let sandbox;\n try {\n sandbox = await opts.client.create({ snapshot: vmBaseName }, { timeout: 900 });\n } catch {\n // A snapshot recreated under a recently-deleted name reports `active` but\n // cannot boot (\"Sandbox failed to start: internal error\") — Daytona's delete\n // is async and racing it corrupts the new snapshot. Nothing distinguishes\n // this from a healthy snapshot until you try to boot it, so treat a boot\n // failure as \"the base is poisoned\", rebuild under a name that has never\n // existed, and retry once.\n log(`linux-vm base '${vmBaseName}' failed to boot; rebuilding it under a fresh name…`);\n await deleteSnapshotQuietly(opts.client, vmBaseName);\n vmBaseName = await createVmBaseSnapshot(opts, `${vmBaseStem}-${nonce()}`, imageRef, log);\n sandbox = await opts.client.create({ snapshot: vmBaseName }, { timeout: 900 });\n }\n const handle: CloudHandle = { sandboxId: sandbox.id, sandboxClass: 'linux-vm' };\n try {\n const wait = await opts.backend.exec(handle, buildDockerWaitCommand());\n if (wait.exitCode !== 0) {\n throw new Error(\n 'dockerd never came up in the VM base, so sudo cannot be repaired ' +\n '(the repair borrows root from the docker socket).',\n );\n }\n log('repairing sudo (the VM rootfs conversion strips setuid bits)…');\n const repair = await opts.backend.exec(handle, buildSudoRepairCommand());\n if (repair.exitCode !== 0) {\n throw new Error(\n `failed to restore sudo in the VM base (exit ${String(repair.exitCode)}): ` +\n `${repair.stdout}${repair.stderr}`,\n );\n }\n\n // The conversion drops the image's ENV along with the setuid bits. Put it\n // back on disk (needs the sudo we just repaired). Without it a VM box has no\n // DISPLAY, and the in-box browser dies with \"Missing X server or $DISPLAY\".\n imageEnv = (await fetchImageEnv(imageRef)) ?? [];\n if (imageEnv.length > 0) {\n log(`restoring the image's ${String(imageEnv.length)} env vars (the VM conversion drops them)…`);\n const envFix = await opts.backend.exec(handle, buildEnvRestoreCommand(imageEnv));\n if (envFix.exitCode !== 0) {\n throw new Error(\n `failed to restore the image environment in the VM base (exit ${String(envFix.exitCode)}): ` +\n `${envFix.stdout}${envFix.stderr}`,\n );\n }\n } else {\n log(\n `warning: could not read the environment of '${imageRef}' from the registry — ` +\n `a VM box may come up without DISPLAY (no in-box browser).`,\n );\n }\n\n await seedAgentStaticIntoCloudBox(opts.backend, handle, {\n hostWorkspace: opts.hostWorkspace,\n claudeMdOverlay: opts.claudeMdOverlay,\n onLog: log,\n });\n\n // Cold snapshot: filesystem only, and Daytona requires the sandbox STOPPED.\n // It does not stop for you.\n log('stopping the sandbox to capture a cold snapshot…');\n await sandbox.stop();\n // Never reuse a name (see the boot-failure comment above): a re-bake gets a\n // fresh one and the snapshot it replaces is deleted afterwards. The name\n // doesn't need to be deterministic — prepared state records whatever we\n // pinned, and that's what the skip-rebuild check reads.\n const finalName = `${opts.snapshotName}-${nonce()}`;\n log(`capturing base snapshot '${finalName}'…`);\n await sandbox._experimental_createSnapshot(finalName, 900);\n await waitForSnapshotActive(opts.client, finalName);\n log(`snapshot '${finalName}' is active`);\n return { snapshotName: finalName, env: imageEnv };\n } finally {\n // Always reap the throwaway — an orphan VM bills by the hour.\n try {\n await sandbox.delete(120);\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n log(`warning: could not delete the temporary bake sandbox ${sandbox.id}: ${msg}`);\n }\n }\n}\n\n/** Stable 12-hex digest of an image ref, for a collision-free snapshot name. */\nfunction sha12(s: string): string {\n return createHash('sha256').update(s).digest('hex').slice(0, 12);\n}\n\n/** Short, monotonic, never-reused token for a snapshot name. */\nfunction nonce(): string {\n return Math.floor(Date.now() / 1000).toString(36);\n}\n\nasync function createVmBaseSnapshot(\n opts: VmBaseBakeOptions,\n name: string,\n imageRef: string,\n log: (line: string) => void,\n): Promise<string> {\n log(`creating linux-vm base image snapshot '${name}' from ${imageRef}…`);\n await opts.client.snapshot.create(\n {\n name,\n image: imageRef,\n sandboxClass: SandboxClass.LINUX_VM,\n regionId: opts.regionId,\n // Always explicit: a snapshot with no `resources` gets Daytona's 1 vCPU /\n // 1 GiB / 3 GiB default, and the box image does not fit in 3 GiB — the\n // build dies mid-pull with a bare \"internal error\".\n resources: opts.resources ?? { cpu: 2, memory: 4, disk: 8 },\n },\n { onLogs: (c: string) => log(String(c).split('\\n').filter(Boolean).join(' ')) },\n );\n return name;\n}\n\nasync function snapshotIsActive(client: Daytona, name: string): Promise<boolean> {\n try {\n const snap = await client.snapshot.get(name);\n return snap?.state === 'active';\n } catch {\n return false;\n }\n}\n\n/** Best-effort delete — used to reap a superseded or poisoned snapshot. */\nexport async function deleteSnapshotQuietly(client: Daytona, name: string): Promise<void> {\n try {\n const snap = await client.snapshot.get(name);\n await client.snapshot.delete(snap);\n } catch {\n /* already gone, or never existed */\n }\n}\n","/**\n * Doctor probes + normalized credential status for the daytona provider,\n * assembled into `providerModule` in `index.ts`. Moved out of apps/cli so the\n * CLI dispatches to it generically (see `@agentbox/sandbox-core`'s `ProviderModule`).\n */\n\nimport { loadEffectiveConfig, resolveDaytonaClass } from '@agentbox/config';\nimport { errSummary, type CheckResult, type CredStatusSummary } from '@agentbox/sandbox-core';\nimport { readPreparedDaytonaState } from './prepared-state.js';\nimport { getDaytonaStatus, hasDaytonaCredentials } from './status.js';\n\nexport function readCredStatusSummary(): CredStatusSummary {\n // Credentials only — no network. This runs in the install wizard's provider\n // step just to answer \"logged in?\", and it used to fetch the whole snapshot +\n // volume inventory to do it.\n return { configured: hasDaytonaCredentials().configured };\n}\n\nexport async function doctorChecks(): Promise<CheckResult[]> {\n try {\n // Snapshots only: the rows below render the snapshot count and nothing else,\n // so the volume list was a second API round-trip whose result was discarded.\n const status = await getDaytonaStatus({ volumes: false });\n if (!status.configured) {\n return [\n {\n label: 'credentials',\n status: 'warn',\n // The SDK's reason is a paragraph (env-var enumeration) — doctor just\n // needs the vercel/e2b-style one-liner; `prepare --status` keeps it.\n detail: 'not configured',\n hint: '`agentbox daytona login`',\n },\n ];\n }\n const credRes: CheckResult = { label: 'credentials', status: 'ok', detail: 'configured' };\n return [credRes, await baseSnapshotCheck(status.snapshots.length)];\n } catch (err) {\n return [{ label: 'credentials', status: 'warn', detail: errSummary(err) }];\n }\n}\n\n/**\n * A snapshot existing isn't enough: a snapshot's class is immutable and can only\n * create sandboxes of that same class, so a container base with\n * `box.daytonaClass: linux-vm` configured is unusable — every create would fail.\n * Counting snapshots would report that as healthy, so compare the class too.\n */\nasync function baseSnapshotCheck(snapshotCount: number): Promise<CheckResult> {\n if (snapshotCount === 0) {\n return {\n label: 'base snapshot',\n status: 'warn',\n detail: 'none',\n hint: '`agentbox prepare --provider daytona`',\n };\n }\n const prepared = readPreparedDaytonaState();\n // Absent `class` = a snapshot baked before classes existed, which was\n // necessarily a container.\n const bakedClass = prepared?.base ? (prepared.extras?.class ?? 'container') : undefined;\n\n let wantClass: string | undefined;\n try {\n wantClass = resolveDaytonaClass((await loadEffectiveConfig(process.cwd())).effective);\n } catch {\n // No project config to read (e.g. doctor run outside a project) — the count\n // is still worth reporting; just don't claim anything about the class.\n }\n\n if (bakedClass && wantClass && bakedClass !== wantClass) {\n return {\n label: 'base snapshot',\n status: 'warn',\n detail: `baked as '${bakedClass}' but box.daytonaClass is '${wantClass}' — creates will fail`,\n hint: '`agentbox prepare --provider daytona --force`',\n };\n }\n return {\n label: 'base snapshot',\n status: 'ok',\n detail: `${String(snapshotCount)} agentbox snapshot(s)${bakedClass ? ` (base: ${bakedClass})` : ''}`,\n };\n}\n","/**\n * Read-only status helpers for `agentbox prepare` (no-args mode). Surfaces\n * the user-facing inventory of agentbox-owned base images / snapshots /\n * volumes on the configured Daytona org so the user can see at a glance\n * what's already prepared and what isn't.\n *\n * Daytona-side state lives in two places:\n * - **Snapshots** — built by `agentbox prepare --provider daytona`. Listed\n * filtered to `agentbox*` so we don't surface unrelated org snapshots.\n * - **Volumes** — the per-org `agentbox-credentials` volume created lazily\n * by `ensureAgentVolumesForCloud` on first `agentbox create --provider\n * daytona`.\n *\n * All calls swallow auth/network errors and return an empty section — the\n * status command must work for users who don't have Daytona configured.\n */\n\nimport { ensureDaytonaEnvLoaded } from './env-loader.js';\nimport { getClient } from './backend.js';\n\nexport interface DaytonaSnapshotSummary {\n name: string;\n state?: string;\n /** Snapshot size in GB, as reported by Daytona (may be undefined for non-`active` states). */\n sizeGb?: number;\n createdAt?: string;\n errorReason?: string;\n}\n\nexport interface DaytonaVolumeSummary {\n name: string;\n id: string;\n state?: string;\n createdAt?: string;\n lastUsedAt?: string;\n}\n\nexport interface DaytonaStatus {\n /** True when Daytona credentials are present + the SDK could connect. */\n configured: boolean;\n /** Snapshots whose name starts with `agentbox` (case-insensitive). */\n snapshots: DaytonaSnapshotSummary[];\n /** Volumes whose name starts with `agentbox` (case-insensitive). */\n volumes: DaytonaVolumeSummary[];\n /** Non-fatal explanation when `configured` is false. */\n reason?: string;\n}\n\nfunction isAgentboxName(name: unknown): boolean {\n return typeof name === 'string' && name.toLowerCase().startsWith('agentbox');\n}\n\n/**\n * Upper bound on a status list call. This is a *diagnostic* read — a hung API\n * must degrade to \"couldn't list\" rather than stall the caller. `doctor` in\n * particular prints no spinner, so an unbounded await just looks like a freeze.\n * Mirrors the bound the cloud-state probes already use host-side.\n */\nconst STATUS_PROBE_TIMEOUT_MS = 8000;\n\nfunction withStatusTimeout<T>(p: Promise<T>, what: string): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n const t = setTimeout(\n () => reject(new Error(`${what} timed out after ${String(STATUS_PROBE_TIMEOUT_MS)}ms`)),\n STATUS_PROBE_TIMEOUT_MS,\n );\n // The SDK call keeps running; we just stop waiting on it. unref so a pending\n // timer can't hold the process open after the CLI is done.\n t.unref?.();\n p.then(\n (v) => {\n clearTimeout(t);\n resolve(v);\n },\n (e: unknown) => {\n clearTimeout(t);\n reject(e instanceof Error ? e : new Error(String(e)));\n },\n );\n });\n}\n\n/**\n * Are Daytona credentials present? Credential-only: constructs the SDK client\n * (which throws when no key/JWT is configured) and makes **no network call**.\n *\n * This is what `configured` in {@link DaytonaStatus} has always meant — the\n * status helper sets it as soon as the client is built, before any list. Callers\n * that only want that answer (the install wizard's provider picker, doctor's\n * \"credentials\" row) should ask here rather than pay for two API round-trips.\n */\nexport function hasDaytonaCredentials(): { configured: boolean; reason?: string } {\n try {\n ensureDaytonaEnvLoaded();\n getClient();\n return { configured: true };\n } catch (err) {\n return {\n configured: false,\n reason: err instanceof Error ? err.message.split('\\n')[0] : String(err),\n };\n }\n}\n\nexport interface DaytonaStatusOptions {\n /**\n * Fetch the volume list. Each list is a separate round-trip to the Daytona\n * API, and `doctor` renders only the snapshot count — so it asks for snapshots\n * alone and halves the network cost of the check. `prepare --status`, which\n * prints the volume inventory, leaves this on. Default true (the full picture).\n */\n volumes?: boolean;\n}\n\n/**\n * Collect a read-only summary of agentbox-owned snapshots + volumes on the\n * Daytona org. Never throws — failure paths return `configured: false` with\n * a one-line reason.\n *\n * Only reaches the network when credentials are present: with no key `getClient()`\n * throws and we return `configured: false` before any request — so an unconfigured\n * machine pays nothing.\n */\nexport async function getDaytonaStatus(opts: DaytonaStatusOptions = {}): Promise<DaytonaStatus> {\n const wantVolumes = opts.volumes !== false;\n try {\n ensureDaytonaEnvLoaded();\n } catch (err) {\n return {\n configured: false,\n snapshots: [],\n volumes: [],\n reason: err instanceof Error ? err.message : String(err),\n };\n }\n\n let client;\n try {\n client = getClient();\n } catch (err) {\n return {\n configured: false,\n snapshots: [],\n volumes: [],\n reason: err instanceof Error ? err.message.split('\\n')[0] : String(err),\n };\n }\n\n const snapshots: DaytonaSnapshotSummary[] = [];\n const volumes: DaytonaVolumeSummary[] = [];\n const reasons: string[] = [];\n\n // Both lists are independent round-trips; issue them together rather than\n // back to back. Each is bounded — an unreachable/slow Daytona must degrade to\n // \"couldn't list\" rather than hang `doctor` (which has no spinner at all, so a\n // stall just looks like a freeze).\n const listSnapshots = async (): Promise<void> => {\n try {\n const list = await withStatusTimeout(client.snapshot.list(), 'snapshot list');\n const items = (list as { items?: unknown[] }).items ?? (Array.isArray(list) ? list : []);\n for (const s of items) {\n const dto = s as { name?: unknown; state?: unknown; size?: unknown; createdAt?: unknown; errorReason?: unknown };\n if (!isAgentboxName(dto.name)) continue;\n snapshots.push({\n name: dto.name as string,\n state: typeof dto.state === 'string' ? dto.state : undefined,\n sizeGb: typeof dto.size === 'number' ? dto.size : undefined,\n createdAt: typeof dto.createdAt === 'string' ? dto.createdAt : undefined,\n errorReason: typeof dto.errorReason === 'string' ? dto.errorReason : undefined,\n });\n }\n } catch (err) {\n reasons.push(\n `snapshot list failed: ${err instanceof Error ? err.message.split('\\n')[0] : String(err)}`,\n );\n }\n };\n\n const listVolumes = async (): Promise<void> => {\n try {\n const list = await withStatusTimeout(client.volume.list(), 'volume list');\n const items: unknown[] = Array.isArray(list)\n ? list\n : ((list as { items?: unknown[] }).items ?? []);\n for (const v of items) {\n const dto = v as { name?: unknown; id?: unknown; state?: unknown; createdAt?: unknown; lastUsedAt?: unknown };\n if (!isAgentboxName(dto.name)) continue;\n volumes.push({\n name: dto.name as string,\n id: typeof dto.id === 'string' ? dto.id : '',\n state: typeof dto.state === 'string' ? dto.state : undefined,\n createdAt: typeof dto.createdAt === 'string' ? dto.createdAt : undefined,\n lastUsedAt: typeof dto.lastUsedAt === 'string' ? dto.lastUsedAt : undefined,\n });\n }\n } catch (err) {\n reasons.push(\n `volume list failed: ${err instanceof Error ? err.message.split('\\n')[0] : String(err)}`,\n );\n }\n };\n\n await Promise.all(wantVolumes ? [listSnapshots(), listVolumes()] : [listSnapshots()]);\n const reason = reasons.length > 0 ? reasons.join('; ') : undefined;\n\n return {\n configured: true,\n snapshots: snapshots.sort((a, b) => (b.createdAt ?? '').localeCompare(a.createdAt ?? '')),\n volumes: volumes.sort((a, b) => a.name.localeCompare(b.name)),\n reason,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEsBA,SAAS,cAAc,aAAa,cAAc,QAAQ,qBAAqB;AAC/E,SAAS,cAAc;AACvB,SAAS,SAAS,YAAY;AAC9B,SAAS,aAAa;ACQtB,SAAS,kBAAkB;AAG3B,SAAS,oBAA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ACR,QAAQ,aAAa,UAAU,8BAA8B,SAAS;MACtE,MAAM;IACR;EACF;AACA,SAAO;IACL,OAAO;IACP,QAAQ;IACR,QAAQ,GAAG,OAAO,aAAa,CAAC,wBAAwB,aAAa,WAAW,UAAU,MAAM,EAAE;EACpG;AACF;AJnEA,IAAM,gBAAgB,oBAAoB,gBAAgB;EACxD,kBAAkB,EAAE,GAAG,0BAA0B;AACnD,CAAC;AAEM,IAAM,kBAA4B;EACvC,GAAG;EACH,SAAS;;;;EAIT,YAAY,sBAAsB,aAAa;EAC/C,iBAAiB,CAAC,kBAAkB,kCAAkC,aAAa;AACrF;AAGO,IAAM,iBAAiC;EAC5C,UAAU;EACV,SAAS;EACT,mBAAmB;EACnB,gBAAgB;EAChB,gBAAgB;EAChB,4BAA4B,CAAC,kBAAkB,kCAAkC,aAAa;EAC9F;AACF;","names":["cloudProvider"]}
@@ -1,36 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- describeRemoteHubBuild,
4
- hubCommand,
5
- resolveHubTarget
6
- } from "./chunk-7RSE7ESY.js";
7
- import "./chunk-7ABO7OIF.js";
8
- import "./chunk-JDSYMTMS.js";
9
- import "./chunk-OXKW4GWD.js";
10
- import "./chunk-OUF3YTQO.js";
11
- import "./chunk-5F34YIRI.js";
12
- import "./chunk-VPBE72HG.js";
13
- import "./chunk-HYXCH4GA.js";
14
- import "./chunk-BUMKBUXS.js";
15
- import "./chunk-PSA6GADQ.js";
16
- import "./chunk-NHTRTST5.js";
17
- import "./chunk-FGQFVUMH.js";
18
- import "./chunk-YI4GHC2E.js";
19
- import "./chunk-JNC7MCWJ.js";
20
- import "./chunk-JQLOGVZK.js";
21
- import "./chunk-46NNZMZT.js";
22
- import "./chunk-WB6S4W7O.js";
23
- import "./chunk-OUWVN2F2.js";
24
- import "./chunk-NHVGKFVY.js";
25
- import "./chunk-CKD3PRON.js";
26
- import "./chunk-GFOWBXV7.js";
27
- import "./chunk-QESXSSO6.js";
28
- import "./chunk-6V366IZC.js";
29
- import "./chunk-G3H2L3O2.js";
30
- import "./chunk-WJFZJZIM.js";
31
- export {
32
- describeRemoteHubBuild,
33
- hubCommand,
34
- resolveHubTarget
35
- };
36
- //# sourceMappingURL=hub-MJ7O4WXW.js.map
@@ -1,40 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- prepareCommand,
4
- renderControlBoxProviders,
5
- resolvePrepareTargetKind,
6
- runPrepare
7
- } from "./chunk-4PR3KJ5X.js";
8
- import "./chunk-FPMRFMVK.js";
9
- import "./chunk-JDSYMTMS.js";
10
- import "./chunk-OXKW4GWD.js";
11
- import "./chunk-OUF3YTQO.js";
12
- import "./chunk-5F34YIRI.js";
13
- import "./chunk-B4DAH2F2.js";
14
- import "./chunk-V5NWSLWD.js";
15
- import "./chunk-VPBE72HG.js";
16
- import "./chunk-BWM56FKY.js";
17
- import "./chunk-HYXCH4GA.js";
18
- import "./chunk-BUMKBUXS.js";
19
- import "./chunk-PSA6GADQ.js";
20
- import "./chunk-FGQFVUMH.js";
21
- import "./chunk-YI4GHC2E.js";
22
- import "./chunk-JNC7MCWJ.js";
23
- import "./chunk-JQLOGVZK.js";
24
- import "./chunk-46NNZMZT.js";
25
- import "./chunk-WB6S4W7O.js";
26
- import "./chunk-OUWVN2F2.js";
27
- import "./chunk-NHVGKFVY.js";
28
- import "./chunk-CKD3PRON.js";
29
- import "./chunk-GFOWBXV7.js";
30
- import "./chunk-QESXSSO6.js";
31
- import "./chunk-6V366IZC.js";
32
- import "./chunk-G3H2L3O2.js";
33
- import "./chunk-WJFZJZIM.js";
34
- export {
35
- prepareCommand,
36
- renderControlBoxProviders,
37
- resolvePrepareTargetKind,
38
- runPrepare
39
- };
40
- //# sourceMappingURL=prepare-V4U5HVJU.js.map
@@ -1,35 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- adoptPreparedBases,
4
- pinAdoptedBase,
5
- sharePreparedBase,
6
- tryAdoptPreparedBase
7
- } from "./chunk-FPMRFMVK.js";
8
- import "./chunk-JDSYMTMS.js";
9
- import "./chunk-OXKW4GWD.js";
10
- import "./chunk-OUF3YTQO.js";
11
- import "./chunk-5F34YIRI.js";
12
- import "./chunk-HYXCH4GA.js";
13
- import "./chunk-BUMKBUXS.js";
14
- import "./chunk-PSA6GADQ.js";
15
- import "./chunk-FGQFVUMH.js";
16
- import "./chunk-YI4GHC2E.js";
17
- import "./chunk-JNC7MCWJ.js";
18
- import "./chunk-JQLOGVZK.js";
19
- import "./chunk-46NNZMZT.js";
20
- import "./chunk-WB6S4W7O.js";
21
- import "./chunk-OUWVN2F2.js";
22
- import "./chunk-NHVGKFVY.js";
23
- import "./chunk-CKD3PRON.js";
24
- import "./chunk-GFOWBXV7.js";
25
- import "./chunk-QESXSSO6.js";
26
- import "./chunk-6V366IZC.js";
27
- import "./chunk-G3H2L3O2.js";
28
- import "./chunk-WJFZJZIM.js";
29
- export {
30
- adoptPreparedBases,
31
- pinAdoptedBase,
32
- sharePreparedBase,
33
- tryAdoptPreparedBase
34
- };
35
- //# sourceMappingURL=prepared-custody-QIXW7MJM.js.map
@@ -1,20 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- rehydrateFromState,
4
- relayCommand
5
- } from "./chunk-NHTRTST5.js";
6
- import "./chunk-FGQFVUMH.js";
7
- import "./chunk-46NNZMZT.js";
8
- import "./chunk-WB6S4W7O.js";
9
- import "./chunk-NHVGKFVY.js";
10
- import "./chunk-CKD3PRON.js";
11
- import "./chunk-GFOWBXV7.js";
12
- import "./chunk-QESXSSO6.js";
13
- import "./chunk-6V366IZC.js";
14
- import "./chunk-G3H2L3O2.js";
15
- import "./chunk-WJFZJZIM.js";
16
- export {
17
- rehydrateFromState,
18
- relayCommand
19
- };
20
- //# sourceMappingURL=relay-DRDELF6B.js.map