@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
@@ -21,7 +21,7 @@ import {
21
21
  setE2bCredentials,
22
22
  updatePreparedState,
23
23
  writePreparedState
24
- } from "./chunk-74VIUGY6.js";
24
+ } from "./chunk-A2TATHHJ.js";
25
25
  import {
26
26
  createCloudProvider,
27
27
  currentCloudBaseFingerprint,
@@ -31,11 +31,10 @@ import {
31
31
  renderInnerCommand,
32
32
  resolveCloudCheckpoint,
33
33
  writeCloudCheckpointManifest
34
- } from "./chunk-JQLOGVZK.js";
35
- import "./chunk-46NNZMZT.js";
36
- import "./chunk-WB6S4W7O.js";
37
- import "./chunk-NHVGKFVY.js";
38
- import "./chunk-CKD3PRON.js";
34
+ } from "./chunk-4KYP775X.js";
35
+ import "./chunk-I2DEYQLZ.js";
36
+ import "./chunk-THKVKVRF.js";
37
+ import "./chunk-CZPVVFCF.js";
39
38
  import {
40
39
  claudeInstallFingerprint,
41
40
  computeContextManifest,
@@ -43,10 +42,11 @@ import {
43
42
  readCliStamp,
44
43
  recordBox,
45
44
  stageAllAgentStatic
46
- } from "./chunk-GFOWBXV7.js";
45
+ } from "./chunk-XENTK32L.js";
46
+ import "./chunk-7LNXTPEE.js";
47
47
  import "./chunk-QESXSSO6.js";
48
48
  import "./chunk-6V366IZC.js";
49
- import "./chunk-G3H2L3O2.js";
49
+ import "./chunk-MNDKP4VS.js";
50
50
  import "./chunk-WJFZJZIM.js";
51
51
 
52
52
  // ../../packages/sandbox-e2b/dist/index.js
@@ -331,6 +331,9 @@ var BOX_USER = "vscode";
331
331
  var BOX_OWNER = "vscode:vscode";
332
332
  var DEFAULT_E2B_DOMAIN = "e2b.app";
333
333
  var DEFAULT_TIMEOUT_MS = 45 * 6e4;
334
+ function connectOpts(apiKey, timeoutMs = DEFAULT_TIMEOUT_MS) {
335
+ return { apiKey, timeoutMs };
336
+ }
334
337
  var E2B_WEB_PORT = 8080;
335
338
  function shq(s) {
336
339
  return "'" + s.replace(/'/g, "'\\''") + "'";
@@ -368,6 +371,9 @@ var e2bBackend = {
368
371
  // staying on 8080 keeps the in-box ctl flag (AGENTBOX_WEB_PROXY_PORT)
369
372
  // identical across cloud providers.
370
373
  webProxyPort: E2B_WEB_PORT,
374
+ // See CloudBackend.stageFilesAsRoot: exec runs as the unprivileged `vscode`,
375
+ // so the carry extract's trailing chown needs root.
376
+ stageFilesAsRoot: true,
371
377
  async provision(req) {
372
378
  const apiKey = resolveApiKey();
373
379
  const log = req.onLog ?? (() => {
@@ -402,9 +408,24 @@ var e2bBackend = {
402
408
  template,
403
409
  // Friendly name (so prune can see it) + the 'agentbox' marker so
404
410
  // `list()` can filter out sandboxes provisioned by other tooling.
405
- metadata: { agentbox: "true", "agentbox.name": safeMetadataName(req.name), name: safeMetadataName(req.name) },
411
+ metadata: {
412
+ agentbox: "true",
413
+ "agentbox.name": safeMetadataName(req.name),
414
+ name: safeMetadataName(req.name)
415
+ },
406
416
  envs: req.env,
407
- timeoutMs: req.timeoutMs ?? DEFAULT_TIMEOUT_MS
417
+ timeoutMs: req.timeoutMs ?? DEFAULT_TIMEOUT_MS,
418
+ // Survive the plan cap instead of being destroyed by it. The cap
419
+ // (1 h Hobby / 24 h Pro) is not extendable, so the SDK default of
420
+ // `onTimeout: 'kill'` loses work the keepalive is powerless to save.
421
+ // `pause` preserves filesystem AND memory, and `autoResume` brings
422
+ // the box back on the next inbound request with a fresh window — so
423
+ // the hour mark becomes a brief freeze rather than a dead box.
424
+ //
425
+ // autoResume is also why this backend declares
426
+ // `timeoutModel: 'inactivity'`: once any request revives a paused
427
+ // box, the host must own the idle decision (see below).
428
+ lifecycle: { onTimeout: "pause", autoResume: true }
408
429
  })
409
430
  );
410
431
  log(`e2b: created sandbox ${sb.sandboxId} (template ${template})`);
@@ -452,7 +473,7 @@ var e2bBackend = {
452
473
  await withE2bRetry(
453
474
  { method: "start", retryOnAmbiguous: true, attemptTimeoutMs: 12e4 },
454
475
  async () => {
455
- await Sandbox.connect(h.sandboxId, { apiKey });
476
+ await Sandbox.connect(h.sandboxId, connectOpts(apiKey));
456
477
  }
457
478
  );
458
479
  },
@@ -484,6 +505,14 @@ var e2bBackend = {
484
505
  await Sandbox.setTimeout(h.sandboxId, ttlMs, { apiKey });
485
506
  });
486
507
  },
508
+ // E2B's raw timer is absolute, but `provision` sets `lifecycle.autoResume`,
509
+ // and once a paused box revives on ANY inbound request the relay's own
510
+ // `CloudBoxPoller` — which long-polls every cloud box's preview URL forever —
511
+ // becomes an infinite resurrection loop. That is exactly the condition
512
+ // `timeoutModel: 'inactivity'` describes, so the host must own the idle
513
+ // decision (pause the box itself once its agent has been idle a full window)
514
+ // and stop the poller when it does. Same treatment daytona gets.
515
+ timeoutModel: "inactivity",
487
516
  async destroy(h) {
488
517
  const apiKey = resolveApiKey();
489
518
  await withE2bRetry(
@@ -521,7 +550,7 @@ var e2bBackend = {
521
550
  backoffMs: opts?.noRetry ? [] : void 0
522
551
  },
523
552
  async () => {
524
- const sb = await Sandbox.connect(h.sandboxId, { apiKey });
553
+ const sb = await Sandbox.connect(h.sandboxId, connectOpts(apiKey));
525
554
  const user = opts?.user ?? BOX_USER;
526
555
  try {
527
556
  const r = await sb.commands.run(cmd, {
@@ -547,7 +576,7 @@ var e2bBackend = {
547
576
  { method: "uploadFile", retryOnAmbiguous: true, attemptTimeoutMs: 3e5 },
548
577
  async () => {
549
578
  const data = await readFile(localPath);
550
- const sb = await Sandbox.connect(h.sandboxId, { apiKey });
579
+ const sb = await Sandbox.connect(h.sandboxId, connectOpts(apiKey));
551
580
  await sb.files.write([{ path: remotePath, data: bufferToArrayBuffer(data) }]);
552
581
  try {
553
582
  await sb.commands.run(`sudo -n chown ${BOX_OWNER} ${shq(remotePath)}`, {
@@ -564,7 +593,7 @@ var e2bBackend = {
564
593
  await withE2bRetry(
565
594
  { method: "downloadFile", retryOnAmbiguous: true, attemptTimeoutMs: 3e5 },
566
595
  async () => {
567
- const sb = await Sandbox.connect(h.sandboxId, { apiKey });
596
+ const sb = await Sandbox.connect(h.sandboxId, connectOpts(apiKey));
568
597
  const bytes = await sb.files.read(remotePath, { format: "bytes" });
569
598
  const { writeFile } = await import("fs/promises");
570
599
  await writeFile(localPath, Buffer.from(bytes));
@@ -574,7 +603,7 @@ var e2bBackend = {
574
603
  async listFiles(h, remoteDir) {
575
604
  const apiKey = resolveApiKey();
576
605
  return withE2bRetry({ method: "listFiles", retryOnAmbiguous: true }, async () => {
577
- const sb = await Sandbox.connect(h.sandboxId, { apiKey });
606
+ const sb = await Sandbox.connect(h.sandboxId, connectOpts(apiKey));
578
607
  const entries = await sb.files.list(remoteDir);
579
608
  return entries.map((e) => ({ name: e.name, isDir: e.type === "dir" }));
580
609
  });
@@ -683,6 +712,21 @@ async function doctorChecks() {
683
712
  return [{ label: "credentials", status: "warn", detail: errSummary(err) }];
684
713
  }
685
714
  }
715
+ function sizeIgnoredReason(size) {
716
+ let requested;
717
+ try {
718
+ const parsed = parseE2bSize(size);
719
+ if (parsed) requested = `${String(parsed.cpuCount)}-${String(parsed.memoryMB / 1024)}`;
720
+ } catch {
721
+ return null;
722
+ }
723
+ if (!requested) return null;
724
+ const prepared = readPreparedState();
725
+ if (!prepared.base) return null;
726
+ const baked = prepared.base.size;
727
+ if (requested === baked) return null;
728
+ return `e2b: size '${requested}' is ignored at create time; this template was baked at ${baked ?? "the default size"}. E2B resources are fixed at bake time \u2014 re-bake with \`agentbox prepare --provider e2b --size ${requested} --force\` to change them.`;
729
+ }
686
730
  var BACKEND_NAME = "e2b";
687
731
  var cloudProvider = createCloudProvider(e2bBackend, {
688
732
  // E2B applies resources at the template level (Template.build({ cpuCount,
@@ -774,6 +818,7 @@ var providerModule = {
774
818
  setCredentials: (fields) => Promise.resolve(setE2bCredentials(fields)),
775
819
  currentBaseFingerprintLive: (claudeInstall) => currentE2bBaseFingerprintLive(claudeInstall),
776
820
  currentBaseFileHashes: () => currentE2bBaseFileHashes(),
821
+ sizeIgnoredReason,
777
822
  doctorChecks
778
823
  };
779
824
  export {
@@ -802,4 +847,4 @@ export {
802
847
  updatePreparedState,
803
848
  writePreparedState
804
849
  };
805
- //# sourceMappingURL=dist-6PYXFREL.js.map
850
+ //# sourceMappingURL=dist-E5EXDZG4.js.map
@@ -0,0 +1 @@
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, currentE2bBaseFileHashes } from './prepared-state.js';\nimport { ensureE2bCredentials, setE2bCredentials } from './credentials.js';\nimport { doctorChecks, readCredStatusSummary, sizeIgnoredReason } 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\n .toLowerCase()\n .replace(/[^a-z0-9.-]+/g, '-')\n .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 sizeIgnoredReason,\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. The host keepalive loop\n * renews it while the agent is active via `renewTimeout` (static\n * `Sandbox.setTimeout`), so a long-running session isn't cut mid-work. 45 min\n * default mirrors vercel.\n *\n * Renewal cannot outrun the PLAN CAP: per the SDK's own typings, a sandbox may\n * be kept alive at most 1 h on Hobby and 24 h on Pro. That cap is why boxes\n * were observed dying at exactly 60 min — not a missing keepalive. We survive\n * it with `lifecycle.onTimeout: 'pause'` (see `provision`) rather than trying\n * to extend past it.\n */\nconst DEFAULT_TIMEOUT_MS = 45 * 60_000;\n\n/**\n * Connect options for every `Sandbox.connect` call.\n *\n * `timeoutMs` here is the SANDBOX deadline, not a request timeout, and the SDK\n * always sends it — omitting it means `DEFAULT_SANDBOX_TIMEOUT_MS` (5 min).\n * On a running sandbox the API only ever extends, so this can't shorten a live\n * box; it exists so a box AUTO-RESUMED by one of these calls comes back with a\n * real session window instead of five minutes. Auto-resume is the common path\n * now that `provision` sets `lifecycle.autoResume`.\n */\nfunction connectOpts(apiKey: string, timeoutMs: number = DEFAULT_TIMEOUT_MS) {\n return { apiKey, timeoutMs };\n}\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 =\n (err as { statusCode?: unknown; status?: unknown }).statusCode ??\n (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 // See CloudBackend.stageFilesAsRoot: exec runs as the unprivileged `vscode`,\n // so the carry extract's trailing chown needs root.\n stageFilesAsRoot: true,\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: {\n agentbox: 'true',\n 'agentbox.name': safeMetadataName(req.name),\n name: safeMetadataName(req.name),\n },\n envs: req.env,\n timeoutMs: req.timeoutMs ?? DEFAULT_TIMEOUT_MS,\n // Survive the plan cap instead of being destroyed by it. The cap\n // (1 h Hobby / 24 h Pro) is not extendable, so the SDK default of\n // `onTimeout: 'kill'` loses work the keepalive is powerless to save.\n // `pause` preserves filesystem AND memory, and `autoResume` brings\n // the box back on the next inbound request with a fresh window — so\n // the hour mark becomes a brief freeze rather than a dead box.\n //\n // autoResume is also why this backend declares\n // `timeoutModel: 'inactivity'`: once any request revives a paused\n // box, the host must own the idle decision (see below).\n lifecycle: { onTimeout: 'pause', autoResume: true },\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 = 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, connectOpts(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 // E2B's raw timer is absolute, but `provision` sets `lifecycle.autoResume`,\n // and once a paused box revives on ANY inbound request the relay's own\n // `CloudBoxPoller` — which long-polls every cloud box's preview URL forever —\n // becomes an infinite resurrection loop. That is exactly the condition\n // `timeoutModel: 'inactivity'` describes, so the host must own the idle\n // decision (pause the box itself once its agent has been idle a full window)\n // and stop the poller when it does. Same treatment daytona gets.\n timeoutModel: 'inactivity',\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, connectOpts(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, connectOpts(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, connectOpts(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, connectOpts(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 { parseE2bSize } from './prepare.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\n/**\n * E2B fixes resources at TEMPLATE-build time and rejects per-create resources,\n * so any size that disagrees with the bake is discarded. Same comparison the\n * backend makes at provision — kept in step so the two can't drift.\n */\nexport function sizeIgnoredReason(size: string): string | null {\n let requested: string | undefined;\n try {\n const parsed = parseE2bSize(size);\n if (parsed) requested = `${String(parsed.cpuCount)}-${String(parsed.memoryMB / 1024)}`;\n } catch {\n // parseE2bSize THROWS on a malformed spec (unlike daytona's, which returns\n // undefined). A foreign value in the generic `box.size` isn't ours to\n // validate here — `prepare` surfaces it. Stay quiet.\n return null;\n }\n if (!requested) return null;\n const prepared = readPreparedState();\n // Nothing baked yet: `prepare` will build the template AT this size, so there\n // is no mismatch to report (same reasoning as daytona's).\n if (!prepared.base) return null;\n const baked = prepared.base.size;\n if (requested === baked) return null;\n return (\n `e2b: size '${requested}' is ignored at create time; this template was baked at ` +\n `${baked ?? 'the default size'}. E2B resources are fixed at bake time — re-bake with ` +\n `\\`agentbox prepare --provider e2b --size ${requested} --force\\` to change them.`\n );\n}\n"],"mappings":";;;;;;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name","resolve","readCliStamp"]}
@@ -1,9 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
+ BUILTIN_GH_GRANT,
3
4
  BUILT_IN_DEFAULTS,
4
5
  CLOUD_PROVIDER_NAMES,
5
6
  DAYTONA_VM_REGION,
6
7
  GLOBAL_CONFIG_FILE,
8
+ GLOBAL_TOOLS_FILE,
7
9
  HUB_ROUTABLE_PROVIDER_NAMES,
8
10
  KEY_REGISTRY,
9
11
  PROJECTS_DIR,
@@ -22,8 +24,10 @@ import {
22
24
  hashProjectPath,
23
25
  isHubRoutableProvider,
24
26
  isProviderKind,
27
+ isValidToolName,
25
28
  listProjectsConfigured,
26
29
  loadEffectiveConfig,
30
+ loadGrantedTools,
27
31
  loadProjectAgentboxDefaults,
28
32
  lookupKey,
29
33
  mergeConfigYaml,
@@ -35,31 +39,38 @@ import {
35
39
  projectConfigFile,
36
40
  projectDirSegment,
37
41
  projectMetaFile,
42
+ projectToolsFile,
38
43
  providerKeyCap,
39
44
  providerMeta,
40
45
  providerNameOf,
41
46
  pruneOrphanProjectConfigs,
47
+ readToolsFile,
42
48
  registerProject,
49
+ removeToolGrant,
43
50
  resolveBoxImage,
44
51
  resolveBoxSize,
45
52
  resolveDaytonaClass,
46
53
  resolveDaytonaRegion,
47
54
  resolveDefaultCheckpoint,
48
55
  resolvePrepareLocation,
56
+ resolveProjectToolsFile,
49
57
  sanitizeMnemonic,
50
58
  setConfigValue,
51
59
  setConfigWarningSink,
52
60
  unregisterProject,
53
61
  unsetConfigValue,
54
62
  withFileLock,
55
- workspaceConfigFile
56
- } from "./chunk-NHVGKFVY.js";
63
+ workspaceConfigFile,
64
+ writeToolGrant
65
+ } from "./chunk-7LNXTPEE.js";
57
66
  import "./chunk-WJFZJZIM.js";
58
67
  export {
68
+ BUILTIN_GH_GRANT,
59
69
  BUILT_IN_DEFAULTS,
60
70
  CLOUD_PROVIDER_NAMES,
61
71
  DAYTONA_VM_REGION,
62
72
  GLOBAL_CONFIG_FILE,
73
+ GLOBAL_TOOLS_FILE,
63
74
  HUB_ROUTABLE_PROVIDER_NAMES,
64
75
  KEY_REGISTRY,
65
76
  PROJECTS_DIR,
@@ -78,8 +89,10 @@ export {
78
89
  hashProjectPath,
79
90
  isHubRoutableProvider,
80
91
  isProviderKind,
92
+ isValidToolName,
81
93
  listProjectsConfigured,
82
94
  loadEffectiveConfig,
95
+ loadGrantedTools,
83
96
  loadProjectAgentboxDefaults,
84
97
  lookupKey,
85
98
  mergeConfigYaml,
@@ -91,23 +104,28 @@ export {
91
104
  projectConfigFile,
92
105
  projectDirSegment,
93
106
  projectMetaFile,
107
+ projectToolsFile,
94
108
  providerKeyCap,
95
109
  providerMeta,
96
110
  providerNameOf,
97
111
  pruneOrphanProjectConfigs,
112
+ readToolsFile,
98
113
  registerProject,
114
+ removeToolGrant,
99
115
  resolveBoxImage,
100
116
  resolveBoxSize,
101
117
  resolveDaytonaClass,
102
118
  resolveDaytonaRegion,
103
119
  resolveDefaultCheckpoint,
104
120
  resolvePrepareLocation,
121
+ resolveProjectToolsFile,
105
122
  sanitizeMnemonic,
106
123
  setConfigValue,
107
124
  setConfigWarningSink,
108
125
  unregisterProject,
109
126
  unsetConfigValue,
110
127
  withFileLock,
111
- workspaceConfigFile
128
+ workspaceConfigFile,
129
+ writeToolGrant
112
130
  };
113
- //# sourceMappingURL=dist-XATN4ZIR.js.map
131
+ //# sourceMappingURL=dist-FBM2WS5S.js.map
@@ -17,7 +17,7 @@ import {
17
17
  setDaytonaCredentials,
18
18
  waitForSnapshotActive,
19
19
  writePreparedDaytonaState
20
- } from "./chunk-KJ5TCYNI.js";
20
+ } from "./chunk-WJUKN4L4.js";
21
21
  import {
22
22
  cloudSnapshotName,
23
23
  createCloudProvider,
@@ -27,15 +27,10 @@ import {
27
27
  resolveCloudCheckpoint,
28
28
  seedAgentStaticIntoCloudBox,
29
29
  writeCloudCheckpointManifest
30
- } from "./chunk-JQLOGVZK.js";
31
- import "./chunk-46NNZMZT.js";
32
- import "./chunk-WB6S4W7O.js";
33
- import {
34
- DAYTONA_VM_REGION,
35
- loadEffectiveConfig,
36
- resolveDaytonaClass
37
- } from "./chunk-NHVGKFVY.js";
38
- import "./chunk-CKD3PRON.js";
30
+ } from "./chunk-4KYP775X.js";
31
+ import "./chunk-I2DEYQLZ.js";
32
+ import "./chunk-THKVKVRF.js";
33
+ import "./chunk-CZPVVFCF.js";
39
34
  import {
40
35
  BOX_IMAGE_REGISTRY,
41
36
  claudeInstallFingerprint,
@@ -43,10 +38,15 @@ import {
43
38
  readCliStamp,
44
39
  registryRefForSha,
45
40
  stageAllAgentStatic
46
- } from "./chunk-GFOWBXV7.js";
41
+ } from "./chunk-XENTK32L.js";
42
+ import {
43
+ DAYTONA_VM_REGION,
44
+ loadEffectiveConfig,
45
+ resolveDaytonaClass
46
+ } from "./chunk-7LNXTPEE.js";
47
47
  import "./chunk-QESXSSO6.js";
48
48
  import "./chunk-6V366IZC.js";
49
- import "./chunk-G3H2L3O2.js";
49
+ import "./chunk-MNDKP4VS.js";
50
50
  import "./chunk-WJFZJZIM.js";
51
51
 
52
52
  // ../../packages/sandbox-daytona/dist/index.js
@@ -321,7 +321,9 @@ function buildDaytonaSeedCommands(usable) {
321
321
  const cmds = [
322
322
  "USER root",
323
323
  `COPY ${DAYTONA_CLAUDE_MD_REL} /tmp/agentbox-custom-CLAUDE.md`,
324
- ...usable.map((s) => `COPY ${daytonaSeedPaths(s.kind).contextRel} ${daytonaSeedPaths(s.kind).remoteTar}`),
324
+ ...usable.map(
325
+ (s) => `COPY ${daytonaSeedPaths(s.kind).contextRel} ${daytonaSeedPaths(s.kind).remoteTar}`
326
+ ),
325
327
  "RUN install -m 0644 /tmp/agentbox-custom-CLAUDE.md /etc/claude-code/CLAUDE.md && rm -f /tmp/agentbox-custom-CLAUDE.md",
326
328
  ...usable.map(
327
329
  (s) => `RUN mkdir -p ${s.extractDir} && tar -xzf ${daytonaSeedPaths(s.kind).remoteTar} -C ${s.extractDir} --no-same-permissions --no-same-owner -m`
@@ -358,9 +360,7 @@ async function prepareDaytona(opts) {
358
360
  const prepared = readPreparedDaytonaState();
359
361
  if (!opts.force && fingerprint && preparedMatches(prepared, fingerprint.contextSha256, sizeKey, sandboxClass)) {
360
362
  try {
361
- const existing = await getClient().snapshot.get(
362
- prepared?.base?.imageRef ?? snapshotName
363
- );
363
+ const existing = await getClient().snapshot.get(prepared?.base?.imageRef ?? snapshotName);
364
364
  if (existing?.name) {
365
365
  log(
366
366
  `daytona snapshot '${existing.name}' up to date (fingerprint ${fingerprint.contextSha256.slice(0, 12)}) \u2014 skipping rebuild (pass --force to override)`
@@ -371,9 +371,7 @@ async function prepareDaytona(opts) {
371
371
  `recorded snapshot '${prepared?.base?.imageRef ?? snapshotName}' not found on Daytona; rebuilding`
372
372
  );
373
373
  } catch {
374
- log(
375
- `recorded snapshot lookup failed; rebuilding (pass --force to silence)`
376
- );
374
+ log(`recorded snapshot lookup failed; rebuilding (pass --force to silence)`);
377
375
  }
378
376
  } else if (!opts.force && fingerprint && prepared?.base?.contextSha256) {
379
377
  const bakedSize = prepared.extras?.size;
@@ -434,10 +432,15 @@ async function prepareDaytona(opts) {
434
432
  snapshotName: baked.snapshotName,
435
433
  contextSha256: fingerprint.contextSha256,
436
434
  size: sizeKey,
435
+ // This path always sends explicit resources (see the `resources:` line
436
+ // above), so the effective size is exactly what we asked for.
437
+ effectiveSize: sizeKey ?? formatDaytonaSize(DAYTONA_DEFAULT_RESOURCES),
437
438
  class: "linux-vm",
438
439
  env: baked.env
439
440
  });
440
- log(`recorded daytona-prepared.json (fingerprint ${fingerprint.contextSha256.slice(0, 12)})`);
441
+ log(
442
+ `recorded daytona-prepared.json (fingerprint ${fingerprint.contextSha256.slice(0, 12)})`
443
+ );
441
444
  }
442
445
  const superseded = prepared?.base?.imageRef;
443
446
  if (superseded && superseded !== baked.snapshotName && prepared?.extras?.class === "linux-vm") {
@@ -467,13 +470,14 @@ async function prepareDaytona(opts) {
467
470
  copyFileSync(daytonaClaudeMd, join(seedContextDir, DAYTONA_CLAUDE_MD_REL));
468
471
  const usable = stages.filter((s) => s.staged.tarballPath !== null);
469
472
  for (const s of usable) {
470
- copyFileSync(s.staged.tarballPath, join(seedContextDir, daytonaSeedPaths(s.kind).contextRel));
473
+ copyFileSync(
474
+ s.staged.tarballPath,
475
+ join(seedContextDir, daytonaSeedPaths(s.kind).contextRel)
476
+ );
471
477
  }
472
478
  image = image.dockerfileCommands(buildDaytonaSeedCommands(usable), seedContextDir);
473
479
  const client = getClient(opts.location ?? "");
474
- log(
475
- `creating Daytona snapshot '${snapshotName}'${sizeResources ? ` (${sizeKey})` : ""}\u2026`
476
- );
480
+ log(`creating Daytona snapshot '${snapshotName}'${sizeResources ? ` (${sizeKey})` : ""}\u2026`);
477
481
  const snapshot = await client.snapshot.create(
478
482
  {
479
483
  name: snapshotName,
@@ -491,11 +495,13 @@ async function prepareDaytona(opts) {
491
495
  snapshotName: snapshot.name ?? snapshotName,
492
496
  contextSha256: fingerprint.contextSha256,
493
497
  size: sizeKey,
498
+ // Without an explicit size this path lets Daytona pick, so read the
499
+ // resources back off the created snapshot. Absent when the SDK doesn't
500
+ // report them — better silent than a guessed number in a warning.
501
+ effectiveSize: sizeKey ?? snapshotResourceKey(snapshot),
494
502
  class: "container"
495
503
  });
496
- log(
497
- `recorded daytona-prepared.json (fingerprint ${fingerprint.contextSha256.slice(0, 12)})`
498
- );
504
+ log(`recorded daytona-prepared.json (fingerprint ${fingerprint.contextSha256.slice(0, 12)})`);
499
505
  }
500
506
  return { snapshotName: snapshot.name ?? snapshotName };
501
507
  } finally {
@@ -519,6 +525,15 @@ function writeNpmDockerfile(originalPath) {
519
525
  writeFileSync(target, flipped);
520
526
  return target;
521
527
  }
528
+ function formatDaytonaSize(r) {
529
+ return `${String(r.cpu)}-${String(r.memory)}-${String(r.disk)}`;
530
+ }
531
+ function snapshotResourceKey(snapshot) {
532
+ const r = snapshot?.resources;
533
+ if (!r || typeof r.cpu !== "number" || typeof r.memory !== "number" || typeof r.disk !== "number")
534
+ return void 0;
535
+ return formatDaytonaSize({ cpu: r.cpu, memory: r.memory, disk: r.disk });
536
+ }
522
537
  function isAgentboxName(name) {
523
538
  return typeof name === "string" && name.toLowerCase().startsWith("agentbox");
524
539
  }
@@ -685,6 +700,16 @@ async function baseSnapshotCheck(snapshotCount) {
685
700
  detail: `${String(snapshotCount)} agentbox snapshot(s)${bakedClass ? ` (base: ${bakedClass})` : ""}`
686
701
  };
687
702
  }
703
+ function sizeIgnoredReason(size) {
704
+ const parsed = parseDaytonaSize(size);
705
+ if (!parsed) return null;
706
+ const requested = `${String(parsed.cpu)}-${String(parsed.memory)}-${String(parsed.disk)}`;
707
+ const prepared = readPreparedDaytonaState();
708
+ if (!prepared?.base) return null;
709
+ const baked = prepared.extras?.effectiveSize ?? prepared.extras?.size;
710
+ if (requested === baked) return null;
711
+ return `daytona: size '${requested}' is ignored on the snapshot path; this snapshot was baked at ${baked ?? "the default size"}. Daytona resources are fixed at bake time \u2014 re-bake with \`agentbox prepare --provider daytona --size ${requested} --force\` to change them.`;
712
+ }
688
713
  var cloudProvider = createCloudProvider(daytonaBackend, {
689
714
  defaultResources: { ...DAYTONA_DEFAULT_RESOURCES }
690
715
  });
@@ -704,6 +729,7 @@ var providerModule = {
704
729
  readCredStatus: readCredStatusSummary,
705
730
  setCredentials: setDaytonaCredentials,
706
731
  currentBaseFingerprintLive: (claudeInstall) => currentDaytonaBaseFingerprintLive(claudeInstall),
732
+ sizeIgnoredReason,
707
733
  doctorChecks
708
734
  };
709
735
  export {
@@ -719,4 +745,4 @@ export {
719
745
  resolveDockerfileContext,
720
746
  setDaytonaCredentials
721
747
  };
722
- //# sourceMappingURL=dist-XQLKK7H3.js.map
748
+ //# sourceMappingURL=dist-NFF2KEMB.js.map