@madarco/agentbox 0.28.1 → 0.29.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (452) hide show
  1. package/CHANGELOG.md +146 -0
  2. package/dist/_cloud-attach-EUO2OL7W.js +30 -0
  3. package/dist/chunk-2JHPGPLE.js +71 -0
  4. package/dist/chunk-2JHPGPLE.js.map +1 -0
  5. package/dist/{chunk-JQLOGVZK.js → chunk-4KYP775X.js} +85 -21
  6. package/dist/chunk-4KYP775X.js.map +1 -0
  7. package/dist/{chunk-V5NWSLWD.js → chunk-4NUETVTR.js} +14 -14
  8. package/dist/{chunk-OXKW4GWD.js → chunk-53OTEDBS.js} +4 -70
  9. package/dist/chunk-53OTEDBS.js.map +1 -0
  10. package/dist/{chunk-FGQFVUMH.js → chunk-6YSYQZRH.js} +3 -3
  11. package/dist/{chunk-KFLGXE3R.js → chunk-73D2HKA3.js} +138 -24
  12. package/dist/chunk-73D2HKA3.js.map +1 -0
  13. package/dist/{chunk-HYXCH4GA.js → chunk-7LC5IG5K.js} +7 -7
  14. package/dist/{chunk-NHVGKFVY.js → chunk-7LNXTPEE.js} +340 -22
  15. package/dist/chunk-7LNXTPEE.js.map +1 -0
  16. package/dist/{chunk-74VIUGY6.js → chunk-A2TATHHJ.js} +6 -9
  17. package/dist/chunk-A2TATHHJ.js.map +1 -0
  18. package/dist/{chunk-YI4GHC2E.js → chunk-AC3HU25W.js} +12 -15
  19. package/dist/chunk-AC3HU25W.js.map +1 -0
  20. package/dist/{chunk-7ABO7OIF.js → chunk-AUHYXXCA.js} +4 -4
  21. package/dist/{chunk-FPMRFMVK.js → chunk-B4YFG5TB.js} +9 -9
  22. package/dist/{chunk-OUF3YTQO.js → chunk-BIKWXLX7.js} +14 -17
  23. package/dist/chunk-BIKWXLX7.js.map +1 -0
  24. package/dist/{chunk-CKD3PRON.js → chunk-CZPVVFCF.js} +12 -9
  25. package/dist/{chunk-CKD3PRON.js.map → chunk-CZPVVFCF.js.map} +1 -1
  26. package/dist/chunk-F4PPZ4SI.js +17 -0
  27. package/dist/chunk-F4PPZ4SI.js.map +1 -0
  28. package/dist/{chunk-BWM56FKY.js → chunk-FEFLAITR.js} +11 -11
  29. package/dist/{chunk-EVT2SNF2.js → chunk-FELVUIIM.js} +3 -3
  30. package/dist/{chunk-46NNZMZT.js → chunk-I2DEYQLZ.js} +372 -72
  31. package/dist/chunk-I2DEYQLZ.js.map +1 -0
  32. package/dist/{chunk-OUWVN2F2.js → chunk-I7BSBUPC.js} +16 -13
  33. package/dist/chunk-I7BSBUPC.js.map +1 -0
  34. package/dist/{chunk-G3H2L3O2.js → chunk-MNDKP4VS.js} +23 -3
  35. package/dist/chunk-MNDKP4VS.js.map +1 -0
  36. package/dist/{chunk-BUMKBUXS.js → chunk-PAWAGULH.js} +3 -3
  37. package/dist/{chunk-4PR3KJ5X.js → chunk-PFEBKXFD.js} +20 -20
  38. package/dist/{chunk-JDSYMTMS.js → chunk-QDU7YDME.js} +130 -66
  39. package/dist/chunk-QDU7YDME.js.map +1 -0
  40. package/dist/{chunk-JNC7MCWJ.js → chunk-S32GHLVU.js} +10 -10
  41. package/dist/chunk-S32GHLVU.js.map +1 -0
  42. package/dist/{chunk-WB6S4W7O.js → chunk-THKVKVRF.js} +2413 -1012
  43. package/dist/chunk-THKVKVRF.js.map +1 -0
  44. package/dist/{chunk-7RSE7ESY.js → chunk-UEEW5TW7.js} +27 -18
  45. package/dist/chunk-UEEW5TW7.js.map +1 -0
  46. package/dist/{chunk-B4DAH2F2.js → chunk-UTOC2NHC.js} +3 -3
  47. package/dist/{chunk-NHTRTST5.js → chunk-WDBDFLH3.js} +38 -15
  48. package/dist/chunk-WDBDFLH3.js.map +1 -0
  49. package/dist/{chunk-PSA6GADQ.js → chunk-WHFCJBMO.js} +14 -1
  50. package/dist/chunk-WHFCJBMO.js.map +1 -0
  51. package/dist/{chunk-KJ5TCYNI.js → chunk-WJUKN4L4.js} +7 -6
  52. package/dist/chunk-WJUKN4L4.js.map +1 -0
  53. package/dist/{chunk-GFOWBXV7.js → chunk-XENTK32L.js} +463 -253
  54. package/dist/chunk-XENTK32L.js.map +1 -0
  55. package/dist/cloud-backends.js +5 -5
  56. package/dist/{cloud-poller-SUNA6ZQC-7M5LJHHE.js → cloud-poller-QJRZXB4W-LJ2BRB3L.js} +2 -2
  57. package/dist/{control-plane-5R7PYRQ6.js → control-plane-YQFX2ILX.js} +19 -18
  58. package/dist/cp-hub-upload-RMJ3XJ65.js +81 -0
  59. package/dist/cp-hub-upload-RMJ3XJ65.js.map +1 -0
  60. package/dist/{custody-client-PNCC2HBJ.js → custody-client-L4FEFW4C.js} +5 -4
  61. package/dist/{deploy-hetzner-SSGSXAKA.js → deploy-hetzner-EECQ4JCM.js} +10 -10
  62. package/dist/{dist-RN6JOAG4.js → dist-3BKIPZR3.js} +81 -45
  63. package/dist/{dist-K5M4HKG7.js → dist-C5B6NGBO.js} +21 -9
  64. package/dist/{dist-6PYXFREL.js → dist-E5EXDZG4.js} +61 -16
  65. package/dist/dist-E5EXDZG4.js.map +1 -0
  66. package/dist/{dist-XATN4ZIR.js → dist-FBM2WS5S.js} +22 -4
  67. package/dist/{dist-XQLKK7H3.js → dist-NFF2KEMB.js} +54 -28
  68. package/dist/dist-NFF2KEMB.js.map +1 -0
  69. package/dist/{dist-5OR4QTQW.js → dist-NTUHJOK3.js} +9 -9
  70. package/dist/{dist-ZNQZHTUN.js → dist-PTYASENV.js} +35 -6
  71. package/dist/{dist-POILUDVJ.js → dist-Q4UDCSZQ.js} +9 -9
  72. package/dist/{dist-M4O5MU5K.js → dist-TXFTYNNE.js} +8 -8
  73. package/dist/{dist-EPFS5PRI.js → dist-XUOHE22G.js} +10 -10
  74. package/dist/{dist-SN2TCRZ5.js → dist-Z2TPC3EN.js} +9 -9
  75. package/dist/host-reach-drainer-N4JSFUBY.js +9 -0
  76. package/dist/hub-3HPYOV5O.js +37 -0
  77. package/dist/{hub-adopt-I44VGSBL.js → hub-adopt-NCCCMMXL.js} +8 -8
  78. package/dist/{hub-api-client-WJPBXZAZ.js → hub-api-client-5U6WOTZ3.js} +2 -2
  79. package/dist/{hub-docker-target-REEEWUG2.js → hub-docker-target-ZKAWXVPH.js} +16 -16
  80. package/dist/index.js +1321 -882
  81. package/dist/index.js.map +1 -1
  82. package/dist/prepare-KIVDQRMN.js +41 -0
  83. package/dist/prepared-custody-EFSOOAIQ.js +36 -0
  84. package/dist/{prepared-state-PV3GUBHO-MF56HWMZ.js → prepared-state-LNQ7DYSU-2YFSDOCV.js} +4 -3
  85. package/dist/{publish-credentials-BPHUO5VL.js → publish-credentials-F2A5OVCO.js} +11 -11
  86. package/dist/registry-O3X2CDDU.js +18 -0
  87. package/dist/relay-3T57T4RI.js +20 -0
  88. package/dist/relay-3T57T4RI.js.map +1 -0
  89. package/dist/{remote-docker-share-RX5ARK45.js → remote-docker-share-QDCBM5UM.js} +11 -11
  90. package/dist/remote-docker-share-QDCBM5UM.js.map +1 -0
  91. package/dist/tool-grant-push-6ISDIJKH.js +90 -0
  92. package/dist/tool-grant-push-6ISDIJKH.js.map +1 -0
  93. package/package.json +1 -2
  94. package/runtime/_shared/agentbox-tool-shim +21 -0
  95. package/runtime/_shared/ctl.cjs +6760 -5299
  96. package/runtime/_shared/gh-shim +103 -228
  97. package/runtime/digitalocean/agentbox-tool-shim +21 -0
  98. package/runtime/digitalocean/ctl.cjs +6760 -5299
  99. package/runtime/digitalocean/gh-shim +103 -228
  100. package/runtime/digitalocean/scripts/install-box.sh +9 -15
  101. package/runtime/docker/Dockerfile.box +8 -18
  102. package/runtime/docker/packages/ctl/dist/bin.cjs +6760 -5299
  103. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-tool-shim +21 -0
  104. package/runtime/docker/packages/sandbox-docker/scripts/gh-shim +103 -228
  105. package/runtime/e2b/agentbox-tool-shim +21 -0
  106. package/runtime/e2b/ctl.cjs +6760 -5299
  107. package/runtime/e2b/gh-shim +103 -228
  108. package/runtime/e2b/scripts/build-template.sh +5 -9
  109. package/runtime/hetzner/agentbox-tool-shim +21 -0
  110. package/runtime/hetzner/ctl.cjs +6760 -5299
  111. package/runtime/hetzner/gh-shim +103 -228
  112. package/runtime/hetzner/scripts/install-box.sh +9 -15
  113. package/runtime/hub/apps/hub/.next/BUILD_ID +1 -1
  114. package/runtime/hub/apps/hub/.next/app-path-routes-manifest.json +2 -0
  115. package/runtime/hub/apps/hub/.next/build-manifest.json +3 -3
  116. package/runtime/hub/apps/hub/.next/routes-manifest.json +16 -0
  117. package/runtime/hub/apps/hub/.next/server/app/(auth)/api/auth/[...all]/route.js +5 -5
  118. package/runtime/hub/apps/hub/.next/server/app/(auth)/api/auth/[...all]/route.js.nft.json +1 -1
  119. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/[id]/answer/route.js +2 -2
  120. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/[id]/answer/route.js.nft.json +1 -1
  121. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/route.js +2 -2
  122. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/route.js.nft.json +1 -1
  123. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/[action]/route.js +2 -2
  124. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/[action]/route.js.nft.json +1 -1
  125. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/agent/route.js +2 -2
  126. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/agent/route.js.nft.json +1 -1
  127. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/branches/route.js +2 -2
  128. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/branches/route.js.nft.json +1 -1
  129. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/checkpoint/route.js +2 -2
  130. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/checkpoint/route.js.nft.json +1 -1
  131. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/[op]/route.js +2 -2
  132. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/[op]/route.js.nft.json +1 -1
  133. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/route.js +2 -2
  134. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/route.js.nft.json +1 -1
  135. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/logs/route.js +1 -1
  136. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/logs/route.js.nft.json +1 -1
  137. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/open/route.js +2 -2
  138. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/open/route.js.nft.json +1 -1
  139. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/rename/route.js +2 -2
  140. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/rename/route.js.nft.json +1 -1
  141. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/route.js +2 -2
  142. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/route.js.nft.json +1 -1
  143. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/restart/route.js +2 -2
  144. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/restart/route.js.nft.json +1 -1
  145. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/route.js +2 -2
  146. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/route.js.nft.json +1 -1
  147. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/vnc/route/app-paths-manifest.json +3 -0
  148. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/vnc/route/build-manifest.json +9 -0
  149. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/vnc/route/server-reference-manifest.json +4 -0
  150. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/vnc/route.js +8 -0
  151. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/vnc/route.js.map +5 -0
  152. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/vnc/route.js.nft.json +1 -0
  153. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/vnc/route_client-reference-manifest.js +3 -0
  154. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/route.js +2 -2
  155. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/route.js.nft.json +1 -1
  156. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/checkpoints/route.js +2 -2
  157. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/checkpoints/route.js.nft.json +1 -1
  158. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/custody/[...path]/route.js +1 -1
  159. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/custody/[...path]/route.js.nft.json +1 -1
  160. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/custody/blob/[...path]/route.js +2 -2
  161. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/custody/blob/[...path]/route.js.nft.json +1 -1
  162. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/health/route.js +2 -2
  163. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/health/route.js.nft.json +1 -1
  164. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/bake/route.js +2 -2
  165. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/bake/route.js.nft.json +1 -1
  166. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/route.js +2 -2
  167. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/route.js.nft.json +1 -1
  168. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/route.js +2 -2
  169. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/route.js.nft.json +1 -1
  170. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/login-code/route.js +2 -2
  171. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/login-code/route.js.nft.json +1 -1
  172. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/logs/route.js +2 -2
  173. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/logs/route.js.nft.json +1 -1
  174. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/route.js +2 -2
  175. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/route.js.nft.json +1 -1
  176. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/route.js +2 -2
  177. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/route.js.nft.json +1 -1
  178. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/open-targets/route.js +2 -2
  179. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/open-targets/route.js.nft.json +1 -1
  180. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/branches/route.js +2 -2
  181. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/branches/route.js.nft.json +1 -1
  182. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/route.js +2 -2
  183. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/route.js.nft.json +1 -1
  184. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/seed/route.js +2 -2
  185. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/seed/route.js.nft.json +1 -1
  186. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/route.js +2 -2
  187. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/route.js.nft.json +1 -1
  188. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/credentials/route.js +2 -2
  189. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/credentials/route.js.nft.json +1 -1
  190. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/prepare/route.js +2 -2
  191. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/prepare/route.js.nft.json +1 -1
  192. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/route.js +2 -2
  193. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/route.js.nft.json +1 -1
  194. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/prune/route.js +2 -2
  195. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/prune/route.js.nft.json +1 -1
  196. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/system/route.js +2 -2
  197. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/system/route.js.nft.json +1 -1
  198. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page.js +1 -1
  199. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page.js.nft.json +1 -1
  200. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page.js +1 -1
  201. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page.js.nft.json +1 -1
  202. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page_client-reference-manifest.js +1 -1
  203. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/vnc/route/app-paths-manifest.json +3 -0
  204. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/vnc/route/build-manifest.json +9 -0
  205. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/vnc/route/server-reference-manifest.json +4 -0
  206. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/vnc/route.js +8 -0
  207. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/vnc/route.js.map +5 -0
  208. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/vnc/route.js.nft.json +1 -0
  209. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/vnc/route_client-reference-manifest.js +3 -0
  210. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/custody/page.js +1 -1
  211. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/custody/page.js.nft.json +1 -1
  212. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page.js +1 -1
  213. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page.js.nft.json +1 -1
  214. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page.js +1 -1
  215. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page.js.nft.json +1 -1
  216. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page.js +1 -1
  217. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page.js.nft.json +1 -1
  218. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page_client-reference-manifest.js +1 -1
  219. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/system/page.js +1 -1
  220. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/system/page.js.nft.json +1 -1
  221. package/runtime/hub/apps/hub/.next/server/app/[...path]/route.js +4 -4
  222. package/runtime/hub/apps/hub/.next/server/app/[...path]/route.js.nft.json +1 -1
  223. package/runtime/hub/apps/hub/.next/server/app/_global-error.html +1 -1
  224. package/runtime/hub/apps/hub/.next/server/app/_global-error.rsc +1 -1
  225. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  226. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  227. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  228. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  229. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  230. package/runtime/hub/apps/hub/.next/server/app-paths-manifest.json +2 -0
  231. package/runtime/hub/apps/hub/.next/server/chunks/044u_hub__next-internal_server_app_(dashboard)_boxes_[id]_vnc_route_actions_1cy1392.js +3 -0
  232. package/runtime/hub/apps/hub/.next/server/chunks/1jcg_server_app_(dashboard)_api_v1_boxes_[id]_vnc_route_actions_10y_e83.js +3 -0
  233. package/runtime/hub/apps/hub/.next/server/chunks/{[externals]__1nj4awx._.js → [externals]__02a249v._.js} +2 -2
  234. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__00f9v4p._.js +1 -1
  235. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__01nppdu._.js +1 -1
  236. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__02f8rwr._.js +1 -1
  237. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__068_052._.js +1 -1
  238. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__06ma5m4._.js +3 -0
  239. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__07kp2fu._.js +1 -1
  240. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__1yi-2wa._.js → [root-of-the-server]__08u01ud._.js} +3 -3
  241. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__098bkh3._.js +3 -0
  242. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__1hxo1tv._.js → [root-of-the-server]__09hbkgm._.js} +2 -2
  243. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__09tmbom._.js +3 -0
  244. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0_3m9sf._.js +1 -1
  245. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0aotdzg._.js +3 -0
  246. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0bn6-pu._.js +1 -1
  247. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0cpt9f9._.js +1 -1
  248. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0d1lmiq._.js +15 -15
  249. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0dom248._.js +1 -1
  250. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0f0bb7o._.js +1 -1
  251. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0gb04bp._.js +1 -1
  252. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0glplq7._.js +1 -1
  253. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__0xrdbh9._.js → [root-of-the-server]__0gxfyol._.js} +2 -2
  254. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0hsb2ak._.js +1 -1
  255. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0joqm8t._.js +1 -1
  256. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0jp-895._.js +1 -1
  257. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__1leda2s._.js → [root-of-the-server]__0jpqg_t._.js} +2 -2
  258. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__17bhgkz._.js → [root-of-the-server]__0lgnu00._.js} +2 -2
  259. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0lsv9-6._.js +1 -1
  260. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0pzgufc._.js +1 -1
  261. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0qfv7z6._.js +1 -1
  262. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0qlr61y._.js +1 -1
  263. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0s8srqi._.js +1 -1
  264. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0urn9j5._.js +1 -1
  265. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0vb8mk2._.js +4 -0
  266. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__17w5eaa._.js → [root-of-the-server]__0x27ifo._.js} +2 -2
  267. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0y7rvy1._.js +1 -1
  268. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0zsgjre._.js +1 -1
  269. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1-bqa8a._.js +1 -1
  270. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__11uspjg._.js +1 -1
  271. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__0zvr6ul._.js → [root-of-the-server]__15tgdh6._.js} +2 -2
  272. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__1ek7nxv._.js → [root-of-the-server]__16bz_kz._.js} +2 -2
  273. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__1w7jw4q._.js → [root-of-the-server]__18tehjj._.js} +2 -2
  274. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__1ds8g0e._.js → [root-of-the-server]__1_hzv4s._.js} +2 -2
  275. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__0cgpsh8._.js → [root-of-the-server]__1b5f5h4._.js} +2 -2
  276. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__10-aihp._.js → [root-of-the-server]__1dv80yf._.js} +2 -2
  277. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1eanlxn._.js +1 -1
  278. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__16lcb2d._.js → [root-of-the-server]__1fc-nvn._.js} +2 -2
  279. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1h4iahl._.js +1 -1
  280. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__0f-c-eh._.js → [root-of-the-server]__1j0vnh3._.js} +2 -2
  281. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1lgrtx6._.js +1 -1
  282. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__1unqgd7._.js → [root-of-the-server]__1lz7931._.js} +2 -2
  283. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__1oclxlx._.js → [root-of-the-server]__1n3u6-5._.js} +2 -2
  284. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1qky5cd._.js +1 -1
  285. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1r2quye._.js +3 -0
  286. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1rb_nc5._.js +1 -1
  287. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__0cv16py._.js → [root-of-the-server]__1spr8ss._.js} +2 -2
  288. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1t_juqb._.js +1 -1
  289. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__0t8kwy3._.js → [root-of-the-server]__1tct9rj._.js} +3 -3
  290. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__0gfa1jg._.js → [root-of-the-server]__1tjtt06._.js} +2 -2
  291. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__09cigc7._.js → [root-of-the-server]__1whjno0._.js} +2 -2
  292. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1wn4-iv._.js +3 -0
  293. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1x6zxrf._.js +1 -1
  294. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__0tyixgg._.js → [root-of-the-server]__1xfxc6i._.js} +2 -2
  295. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__1m1_gm_._.js → [root-of-the-server]__1xqcvi4._.js} +2 -2
  296. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__207d30i._.js +1 -1
  297. package/runtime/hub/apps/hub/.next/server/chunks/_07icdxf._.js +1 -1
  298. package/runtime/hub/apps/hub/.next/server/chunks/_0907rw0._.js +1 -1
  299. package/runtime/hub/apps/hub/.next/server/chunks/_0adm87k._.js +1 -1
  300. package/runtime/hub/apps/hub/.next/server/chunks/_0g01mkg._.js +1 -1
  301. package/runtime/hub/apps/hub/.next/server/chunks/_0l_klgd._.js +1 -1
  302. package/runtime/hub/apps/hub/.next/server/chunks/_0lfm81x._.js +1 -1
  303. package/runtime/hub/apps/hub/.next/server/chunks/_0tbg83f._.js +1 -1
  304. package/runtime/hub/apps/hub/.next/server/chunks/_0tms_au._.js +1 -1
  305. package/runtime/hub/apps/hub/.next/server/chunks/_0zhli27._.js +1 -1
  306. package/runtime/hub/apps/hub/.next/server/chunks/_10yfoq5._.js +1 -1
  307. package/runtime/hub/apps/hub/.next/server/chunks/_12uhpbp._.js +1 -1
  308. package/runtime/hub/apps/hub/.next/server/chunks/_17a9v8y._.js +2 -2
  309. package/runtime/hub/apps/hub/.next/server/chunks/_1c7x9ee._.js +1 -1
  310. package/runtime/hub/apps/hub/.next/server/chunks/_1n-c443._.js +1 -1
  311. package/runtime/hub/apps/hub/.next/server/chunks/_1y80vfg._.js +1 -1
  312. package/runtime/hub/apps/hub/.next/server/chunks/_214_q-1._.js +1 -1
  313. package/runtime/hub/apps/hub/.next/server/chunks/apps_hub_app_(dashboard)_api_v1_lib_openapi_ts_1yokmzt._.js +1 -1
  314. package/runtime/hub/apps/hub/.next/server/chunks/{packages_relay_dist_0eg7ay1._.js → packages_relay_dist_0p8dnf4._.js} +4 -4
  315. package/runtime/hub/apps/hub/.next/server/chunks/ssr/{[root-of-the-server]__1plrs94._.js → [root-of-the-server]__0-c5j6l._.js} +2 -2
  316. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0r2xlss._.js +1 -1
  317. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_19vy9ni._.js +2 -2
  318. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_app_(dashboard)_boxes_[id]_page_tsx_1-j_972._.js +1 -1
  319. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_app_(dashboard)_settings_page_tsx_0hv6n82._.js +1 -1
  320. package/runtime/hub/apps/hub/.next/server/chunks/ssr/{packages_relay_dist_1z9j3g0._.js → packages_relay_dist_0sap-2l._.js} +4 -4
  321. package/runtime/hub/apps/hub/.next/server/functions-config-manifest.json +3 -1
  322. package/runtime/hub/apps/hub/.next/server/middleware-build-manifest.js +3 -3
  323. package/runtime/hub/apps/hub/.next/server/middleware.js +1 -1
  324. package/runtime/hub/apps/hub/.next/server/pages/500.html +1 -1
  325. package/runtime/hub/apps/hub/.next/static/chunks/{328ny-3zs_h7m.js → 0jefm3re1-2jv.js} +1 -1
  326. package/runtime/hub/apps/hub/.next/static/chunks/{30h8mz040b5-l.js → 3u4odx1_-dy6b.js} +1 -1
  327. package/runtime/hub/apps/hub/app/(dashboard)/api/v1/boxes/[id]/vnc/route.ts +45 -0
  328. package/runtime/hub/apps/hub/app/(dashboard)/api/v1/lib/openapi.ts +45 -1
  329. package/runtime/hub/apps/hub/app/(dashboard)/api/v1/lib/validate.ts +14 -3
  330. package/runtime/hub/apps/hub/app/(dashboard)/boxes/[id]/vnc/route.ts +58 -0
  331. package/runtime/hub/apps/hub/app/(dashboard)/boxes/components/access.tsx +26 -9
  332. package/runtime/hub/apps/hub/app/(dashboard)/settings/components/provider-actions.tsx +34 -26
  333. package/runtime/hub/apps/hub/{auth-JMVHQKWY.js → auth-V7KPRWPS.js} +2 -2
  334. package/runtime/hub/apps/hub/{auth-config-5IFRWOK4.js → auth-config-B3Y3BT2I.js} +2 -2
  335. package/runtime/hub/apps/hub/{chunk-QU3FFGJY.js → chunk-2WB3A5IN.js} +11 -14
  336. package/runtime/hub/apps/hub/{chunk-LPYK2354.js → chunk-5ABFGGPT.js} +339 -21
  337. package/runtime/hub/apps/hub/{chunk-VKOCY6SX.js → chunk-BI4MPGQT.js} +49 -14
  338. package/runtime/hub/apps/hub/{chunk-UMPTTQBE.js → chunk-G6FJR7TN.js} +461 -251
  339. package/runtime/hub/apps/hub/{chunk-KTVETF3F.js → chunk-QGAP34GN.js} +11 -8
  340. package/runtime/hub/apps/hub/{chunk-5TM7XXLT.js → chunk-QWSP6WJ2.js} +2833 -1277
  341. package/runtime/hub/apps/hub/{chunk-EZUK53CC.js → chunk-RPPOFMPA.js} +85 -21
  342. package/runtime/hub/apps/hub/{chunk-3LAHFDJF.js → chunk-VWQNSZGI.js} +22 -2
  343. package/runtime/hub/apps/hub/{chunk-D33EV4YZ.js → chunk-ZP4RYI4U.js} +1 -1
  344. package/runtime/hub/apps/hub/{cloud-poller-SUNA6ZQC-VSKVMYHL.js → cloud-poller-QJRZXB4W-G7ECKNKQ.js} +1 -1
  345. package/runtime/hub/apps/hub/{dist-JVEDVVVG.js → dist-4F6XEJHK.js} +7 -7
  346. package/runtime/hub/apps/hub/{dist-2YP57GMB.js → dist-A3JOKKYG.js} +13 -13
  347. package/runtime/hub/apps/hub/{dist-D265LCAN.js → dist-CGH7PEMZ.js} +21 -3
  348. package/runtime/hub/apps/hub/{dist-SYWTB6RD.js → dist-F547YSBE.js} +15 -18
  349. package/runtime/hub/apps/hub/{dist-YK5FFPXZ.js → dist-FEHV4PC7.js} +62 -20
  350. package/runtime/hub/apps/hub/{dist-NKCXH5DW.js → dist-P7NT6VLK.js} +6 -6
  351. package/runtime/hub/apps/hub/{dist-E2FTSTCY.js → dist-W2YXTEQN.js} +34 -5
  352. package/runtime/hub/apps/hub/{dist-ELZHBQEM.js → dist-W5SGEJLA.js} +11 -11
  353. package/runtime/hub/apps/hub/{dist-N3E5YAYY.js → dist-YB3Y2XDK.js} +53 -26
  354. package/runtime/hub/apps/hub/{dist-5HTJSOHS.js → dist-ZTJMZLED.js} +19 -7
  355. package/runtime/hub/apps/hub/docker-compose.yml +1 -0
  356. package/runtime/hub/apps/hub/{hub-token-MDOBY7MZ.js → hub-token-DDJ5Z6RS.js} +2 -2
  357. package/runtime/hub/apps/hub/{hub-worker-UFFLF37F.js → hub-worker-I5QBLSRU.js} +16 -16
  358. package/runtime/hub/apps/hub/lib/boxes/backend-types.ts +11 -0
  359. package/runtime/hub/apps/hub/lib/boxes/types.ts +43 -0
  360. package/runtime/hub/apps/hub/lib/boxes/vnc-link.ts +51 -0
  361. package/runtime/hub/apps/hub/lib/hub-backend.ts +127 -54
  362. package/runtime/hub/apps/hub/lib/hub-worker.ts +4 -4
  363. package/runtime/hub/apps/hub/lib/provider-importers.ts +66 -1
  364. package/runtime/hub/apps/hub/{prepared-state-PV3GUBHO-PPRQDYFR.js → prepared-state-LNQ7DYSU-4I7FNNNS.js} +3 -2
  365. package/runtime/hub/apps/hub/server.js +130 -72
  366. package/runtime/hub/apps/hub/server.ts +18 -0
  367. package/runtime/hub/apps/hub/test/vnc-link.test.ts +61 -0
  368. package/runtime/hub/apps/hub/tsconfig.tsbuildinfo +1 -1
  369. package/runtime/hub-deploy/docker-compose.yml +1 -0
  370. package/runtime/relay/bin.cjs +16626 -14688
  371. package/runtime/vercel/agentbox-tool-shim +21 -0
  372. package/runtime/vercel/ctl.cjs +6760 -5299
  373. package/runtime/vercel/gh-shim +103 -228
  374. package/runtime/vercel/scripts/provision.sh +5 -9
  375. package/share/host-skills/agentbox-info/SKILL.md +24 -14
  376. package/dist/_cloud-attach-Y5HIQ373.js +0 -28
  377. package/dist/chunk-46NNZMZT.js.map +0 -1
  378. package/dist/chunk-74VIUGY6.js.map +0 -1
  379. package/dist/chunk-7RSE7ESY.js.map +0 -1
  380. package/dist/chunk-G3H2L3O2.js.map +0 -1
  381. package/dist/chunk-GFOWBXV7.js.map +0 -1
  382. package/dist/chunk-JDSYMTMS.js.map +0 -1
  383. package/dist/chunk-JNC7MCWJ.js.map +0 -1
  384. package/dist/chunk-JQLOGVZK.js.map +0 -1
  385. package/dist/chunk-KFLGXE3R.js.map +0 -1
  386. package/dist/chunk-KJ5TCYNI.js.map +0 -1
  387. package/dist/chunk-NHTRTST5.js.map +0 -1
  388. package/dist/chunk-NHVGKFVY.js.map +0 -1
  389. package/dist/chunk-OUF3YTQO.js.map +0 -1
  390. package/dist/chunk-OUWVN2F2.js.map +0 -1
  391. package/dist/chunk-OXKW4GWD.js.map +0 -1
  392. package/dist/chunk-PSA6GADQ.js.map +0 -1
  393. package/dist/chunk-WB6S4W7O.js.map +0 -1
  394. package/dist/chunk-YI4GHC2E.js.map +0 -1
  395. package/dist/dist-6PYXFREL.js.map +0 -1
  396. package/dist/dist-XQLKK7H3.js.map +0 -1
  397. package/dist/hub-MJ7O4WXW.js +0 -36
  398. package/dist/prepare-V4U5HVJU.js +0 -40
  399. package/dist/prepared-custody-QIXW7MJM.js +0 -35
  400. package/dist/relay-DRDELF6B.js +0 -20
  401. package/runtime/_shared/linear-shim +0 -181
  402. package/runtime/_shared/ntn-shim +0 -95
  403. package/runtime/digitalocean/linear-shim +0 -181
  404. package/runtime/digitalocean/ntn-shim +0 -95
  405. package/runtime/docker/packages/sandbox-docker/scripts/linear-shim +0 -181
  406. package/runtime/docker/packages/sandbox-docker/scripts/ntn-shim +0 -95
  407. package/runtime/e2b/linear-shim +0 -181
  408. package/runtime/e2b/ntn-shim +0 -95
  409. package/runtime/hetzner/linear-shim +0 -181
  410. package/runtime/hetzner/ntn-shim +0 -95
  411. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__039tc0m._.js +0 -3
  412. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0c_3x8u._.js +0 -3
  413. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0ty7ew1._.js +0 -3
  414. package/runtime/vercel/linear-shim +0 -181
  415. package/runtime/vercel/ntn-shim +0 -95
  416. /package/dist/{_cloud-attach-Y5HIQ373.js.map → _cloud-attach-EUO2OL7W.js.map} +0 -0
  417. /package/dist/{chunk-V5NWSLWD.js.map → chunk-4NUETVTR.js.map} +0 -0
  418. /package/dist/{chunk-FGQFVUMH.js.map → chunk-6YSYQZRH.js.map} +0 -0
  419. /package/dist/{chunk-HYXCH4GA.js.map → chunk-7LC5IG5K.js.map} +0 -0
  420. /package/dist/{chunk-7ABO7OIF.js.map → chunk-AUHYXXCA.js.map} +0 -0
  421. /package/dist/{chunk-FPMRFMVK.js.map → chunk-B4YFG5TB.js.map} +0 -0
  422. /package/dist/{chunk-BWM56FKY.js.map → chunk-FEFLAITR.js.map} +0 -0
  423. /package/dist/{chunk-EVT2SNF2.js.map → chunk-FELVUIIM.js.map} +0 -0
  424. /package/dist/{chunk-BUMKBUXS.js.map → chunk-PAWAGULH.js.map} +0 -0
  425. /package/dist/{chunk-4PR3KJ5X.js.map → chunk-PFEBKXFD.js.map} +0 -0
  426. /package/dist/{chunk-B4DAH2F2.js.map → chunk-UTOC2NHC.js.map} +0 -0
  427. /package/dist/{cloud-poller-SUNA6ZQC-7M5LJHHE.js.map → cloud-poller-QJRZXB4W-LJ2BRB3L.js.map} +0 -0
  428. /package/dist/{control-plane-5R7PYRQ6.js.map → control-plane-YQFX2ILX.js.map} +0 -0
  429. /package/dist/{custody-client-PNCC2HBJ.js.map → custody-client-L4FEFW4C.js.map} +0 -0
  430. /package/dist/{deploy-hetzner-SSGSXAKA.js.map → deploy-hetzner-EECQ4JCM.js.map} +0 -0
  431. /package/dist/{dist-5OR4QTQW.js.map → dist-3BKIPZR3.js.map} +0 -0
  432. /package/dist/{dist-EPFS5PRI.js.map → dist-C5B6NGBO.js.map} +0 -0
  433. /package/dist/{dist-K5M4HKG7.js.map → dist-FBM2WS5S.js.map} +0 -0
  434. /package/dist/{dist-M4O5MU5K.js.map → dist-NTUHJOK3.js.map} +0 -0
  435. /package/dist/{dist-POILUDVJ.js.map → dist-PTYASENV.js.map} +0 -0
  436. /package/dist/{dist-RN6JOAG4.js.map → dist-Q4UDCSZQ.js.map} +0 -0
  437. /package/dist/{dist-SN2TCRZ5.js.map → dist-TXFTYNNE.js.map} +0 -0
  438. /package/dist/{dist-XATN4ZIR.js.map → dist-XUOHE22G.js.map} +0 -0
  439. /package/dist/{dist-ZNQZHTUN.js.map → dist-Z2TPC3EN.js.map} +0 -0
  440. /package/dist/{hub-MJ7O4WXW.js.map → host-reach-drainer-N4JSFUBY.js.map} +0 -0
  441. /package/dist/{hub-adopt-I44VGSBL.js.map → hub-3HPYOV5O.js.map} +0 -0
  442. /package/dist/{hub-api-client-WJPBXZAZ.js.map → hub-adopt-NCCCMMXL.js.map} +0 -0
  443. /package/dist/{prepare-V4U5HVJU.js.map → hub-api-client-5U6WOTZ3.js.map} +0 -0
  444. /package/dist/{hub-docker-target-REEEWUG2.js.map → hub-docker-target-ZKAWXVPH.js.map} +0 -0
  445. /package/dist/{prepared-custody-QIXW7MJM.js.map → prepare-KIVDQRMN.js.map} +0 -0
  446. /package/dist/{prepared-state-PV3GUBHO-MF56HWMZ.js.map → prepared-custody-EFSOOAIQ.js.map} +0 -0
  447. /package/dist/{relay-DRDELF6B.js.map → prepared-state-LNQ7DYSU-2YFSDOCV.js.map} +0 -0
  448. /package/dist/{publish-credentials-BPHUO5VL.js.map → publish-credentials-F2A5OVCO.js.map} +0 -0
  449. /package/dist/{remote-docker-share-RX5ARK45.js.map → registry-O3X2CDDU.js.map} +0 -0
  450. /package/runtime/hub/apps/hub/.next/static/{z7_2bKU93xE7GwllL1Duv → nDHi_1342DzyGDC14ocQo}/_buildManifest.js +0 -0
  451. /package/runtime/hub/apps/hub/.next/static/{z7_2bKU93xE7GwllL1Duv → nDHi_1342DzyGDC14ocQo}/_clientMiddlewareManifest.js +0 -0
  452. /package/runtime/hub/apps/hub/.next/static/{z7_2bKU93xE7GwllL1Duv → nDHi_1342DzyGDC14ocQo}/_ssgManifest.js +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/provider/spec.ts","../src/provider/registry.ts","../src/control-plane/with-hub.ts"],"sourcesContent":["/**\n * `--provider` accepts a *spec*, not just a name — see\n * `@agentbox/config`'s `provider-spec.ts`, which owns the parser so the CLI and\n * the hub cannot drift on what `docker:<host>` means.\n *\n * Everything that takes a `--provider` runs its value through `parseProviderSpec`,\n * so a spec works anywhere a bare name does. A name with no `:` parses to\n * itself, which keeps every existing call site's behavior exactly as it was.\n */\n\nexport {\n parseProviderSpec,\n providerNameOf,\n REMOTE_DOCKER,\n type ProviderSpec,\n} from '@agentbox/config';\n\nimport type { EffectiveConfig } from '@agentbox/config';\nimport { parseProviderSpec, REMOTE_DOCKER } from '@agentbox/config';\n\n/**\n * The effective provider spec for a queued create job, folding a `remoteHost`\n * (the `--remote-host` flag) into the spec. A `--remote-host` on an otherwise-bare\n * `docker` job IS a remote-docker box — encode it as `docker:<host>` so the worker\n * resolves the REMOTE engine, not the local one (a bare `docker` job would build\n * on this machine, silently ignoring the host the submitter asked for). A cloud\n * name, or an explicit `docker:<host>` spec (which already carries its host), pass\n * through unchanged.\n */\nexport function resolveCreateProviderSpec(\n providerName: string | undefined,\n remoteHost: string | undefined,\n): string {\n const raw = (providerName && providerName.trim()) || 'docker';\n if (remoteHost && parseProviderSpec(raw).name === 'docker') return `docker:${remoteHost}`;\n return raw;\n}\n\n/**\n * Resolve the provider + engine for a command, in one place.\n *\n * `box.provider` is stored as a bare provider NAME (the parser splits a\n * `docker:<host>` spec into `box.provider` + `box.remoteDockerHost`), so a\n * command can no longer get the host out of the config value itself. It has to\n * read the second key — and it must, because `dockerProviderRefusal` decides\n * whether a remote-docker create is allowed by whether the control box can\n * reach that host: a dropped host reads as \"no engine\" and refuses the create.\n *\n * Precedence, unchanged from when the spec carried the host: an explicit\n * `--remote-host` beats the host inside `--provider docker:<host>`, which beats\n * the configured `box.remoteDockerHost`.\n */\nexport function resolveProviderChoice(\n cfg: EffectiveConfig,\n opts: { provider?: string; remoteHost?: string } = {},\n): { providerName: string; remoteHost: string | undefined; spec: string } {\n const { name: providerName, remoteHost: specHost } = parseProviderSpec(\n opts.provider?.trim() || cfg.box.provider || 'docker',\n );\n const host =\n opts.remoteHost?.trim() || specHost || (cfg.box.remoteDockerHost || '').trim() || undefined;\n // Only remote-docker has an engine; carrying a stray host onto a cloud\n // provider would make `--remote-host` look honoured when it is ignored.\n const remoteHost = providerName === REMOTE_DOCKER ? host : undefined;\n return { providerName, remoteHost, spec: providerSpecFor(providerName, remoteHost) };\n}\n\n/**\n * The wire form for the hub API, which still speaks the spec: the hub worker\n * splits it again on its side (`parseProviderSpec` in `hub-worker.ts`). Only\n * remote-docker re-sugars; every other name is already the whole story.\n */\nexport function providerSpecFor(providerName: string, remoteHost: string | undefined): string {\n return providerName === REMOTE_DOCKER && remoteHost ? `docker:${remoteHost}` : providerName;\n}\n","/**\n * Provider registry — resolves a `Provider` for either an existing box (from\n * its `provider` discriminator) or a fresh `create` (from --provider flag /\n * config / default). Lazy `import()` keeps the Daytona SDK out of the Docker\n * hot path.\n */\n\nimport type { EffectiveConfig } from '@agentbox/config';\nimport type { ProviderKind } from '@agentbox/config';\nimport type { BoxRecord, Provider, ProviderName } from '@agentbox/core';\nimport { getRuntimeProviderNames, isRuntimeProvider, loadProviderModule } from './loaders.js';\nimport { parseProviderSpec } from './spec.js';\n\n/** A built-in `ProviderKind` OR a registered plugin provider name. */\nexport type KnownProviderName = ProviderKind | (string & {});\n\n/**\n * True for a built-in provider, a registered plugin provider, or a\n * host-qualified spec (`docker:<host>`). Every `--provider` validation goes\n * through here, so a spec is accepted everywhere a bare name is.\n */\nexport function isKnownProvider(name: string): boolean {\n try {\n return isRuntimeProvider(parseProviderSpec(name).name);\n } catch {\n // A malformed spec (`docker:` with no host) is not a known provider; the\n // caller's error message names it.\n return false;\n }\n}\n\n/**\n * Resolve a `Provider` by name or spec, running its first-run credential gate\n * first. Each provider package's `providerModule.ensureCredentials` walks the\n * user through `agentbox <provider> login` on first use (a no-op for docker and\n * remote-docker, which have no credential, and for non-TTY callers). The\n * base-snapshot gate lives inside `backend.provision`, not here, so `agentbox\n * prepare` can build the snapshot without tripping it. Built-ins load through\n * the bundle-inlined map; unknown names fall back to the plugin registry.\n */\nexport async function getProvider(name: ProviderName): Promise<Provider> {\n const mod = await loadProviderModule(parseProviderSpec(name).name);\n if (mod.ensureCredentials) await mod.ensureCredentials();\n return mod.provider;\n}\n\n/** Provider for an existing box record. Defaults to 'docker' for legacy records. */\nexport async function providerForBox(box: BoxRecord): Promise<Provider> {\n return getProvider(box.provider ?? 'docker');\n}\n\nexport interface CreateProviderChoice {\n /** Explicit --provider flag, if the command exposed one. */\n flag?: string;\n /** Effective config (carries box.provider for the layered default). */\n config: EffectiveConfig;\n}\n\n/**\n * Provider for a fresh `agentbox create`. Precedence: --provider flag >\n * box.provider config > 'docker'. Throws if the resolved name isn't registered.\n */\n/** Lazy: keeps the env-file read off every `getProvider` call. */\nasync function loadControlPlaneEnvLazily(): Promise<void> {\n const { loadControlPlaneEnv } = await import('../control-plane/env-file.js');\n loadControlPlaneEnv();\n}\n\nexport async function providerForCreate(choice: CreateProviderChoice): Promise<Provider> {\n const flag = choice.flag?.trim();\n const spec = (flag && flag.length > 0 ? flag : choice.config.box.provider) as ProviderName;\n if (typeof spec !== 'string' || spec.length === 0 || !isKnownProvider(spec)) {\n throw new Error(\n `unknown sandbox provider \"${String(spec)}\" (known: ${getRuntimeProviderNames().join(', ')})`,\n );\n }\n // A control-plane create needs the admin bearer in `process.env` — the\n // provider registers the box on the plane and pushes seed material with it.\n // The token lives in the setup-written env file, and nothing on the create\n // path was loading it, so in an ordinary shell (where the user has not\n // sourced it) every PC create silently skipped registration: the box came up\n // with `topology: control-plane` but the plane never heard of it, its seed was\n // never stored, and its `git push` had no token to lease with.\n //\n // Every create path resolves its provider through here, so this is the one\n // place that covers create / claude / codex / opencode / queued jobs.\n // Optional-chained: a real EffectiveConfig always carries `relay` (defaults\n // fill it), but callers/tests hand this a narrower object.\n if (choice.config.relay?.controlPlaneUrl) await loadControlPlaneEnvLazily();\n return getProvider(spec);\n}\n","/**\n * `withHubClient` — the one entry point CLI commands use to run an operation\n * against the hub's `/api/v1`, in BOTH modes (a local hub or a remote control\n * box; the only difference is the base URL + token, resolved by\n * `resolveHubApiTarget`). It:\n *\n * 1. resolves the client (auto-starting a local hub when needed),\n * 2. gates the hub's `/api/v1` version once up front — a hub outside\n * {@link SUPPORTED_HUB_API_VERSIONS} is refused with an upgrade hint rather\n * than failing on a changed field mid-operation,\n * 3. runs the caller's op, and\n * 4. maps a {@link HubApiError} (or an unreachable hub) to a stable CLI exit\n * code + an actionable message.\n *\n * Later steps of the `/api/v1` consolidation are then a mechanical conversion:\n * wrap the op body in `withHubClient` and delete the inline provider code. A\n * command that needs to special-case a code (e.g. treat `not_found` as info)\n * catches it inside its own callback before it reaches the mapper here.\n */\nimport { log } from '@clack/prompts';\nimport type { HubTarget } from '../commands/hub.js';\nimport { HubApiClient, HubApiError, SUPPORTED_HUB_API_VERSIONS } from './hub-api-client.js';\n\nexport interface WithHubOptions {\n /** Override the hub URL (default: the configured control box, else the local hub). */\n url?: string;\n /**\n * Prefer the hub on THIS machine even when a remote control box is configured\n * (the which-hub principle, Step 1). A docker box is always local-owned, so a\n * docker op sets this to avoid hitting a remote hub that never owned it (it\n * would answer `not_found`). Reuses Step 0's exposed-loopback-first ladder.\n */\n preferLocal?: boolean;\n}\n\n/** True when the hub's reported `apiVersion` is one this CLI speaks. */\nexport function isSupportedApiVersion(version: string | undefined): boolean {\n return (\n version !== undefined && (SUPPORTED_HUB_API_VERSIONS as readonly string[]).includes(version)\n );\n}\n\n// Distinct exit codes per API error class, so scripts can branch on the failure\n// kind. `not_found` reuses 2 to match the lifecycle-error convention\n// (`handleLifecycleError`). Anything unmapped (including `internal`) is a plain 1.\nconst EXIT_BY_CODE: Record<string, number> = {\n not_found: 2,\n unauthorized: 3,\n invalid_request: 4,\n conflict: 5,\n backend_unavailable: 6,\n};\n\n/** The CLI exit code for a hub `/api/v1` error code. */\nexport function exitCodeForApiError(code: string): number {\n return EXIT_BY_CODE[code] ?? 1;\n}\n\n/**\n * The exit code to report for a hub error. A carried `details.exitCode` (a box\n * command's own exit — e.g. 64 for `git push --host-only` with no host checkout)\n * wins, so the CLI surfaces the box's faithful exit rather than the coarse\n * code→exit mapping. Falls back to the per-code table otherwise.\n */\nfunction exitCodeForHubError(err: HubApiError): number {\n const carried = (err.details as { exitCode?: unknown } | undefined)?.exitCode;\n if (typeof carried === 'number' && Number.isInteger(carried) && carried > 0) return carried;\n return exitCodeForApiError(err.code);\n}\n\n/** An extra actionable line for the error classes where the raw message isn't enough. */\nfunction hintForApiError(err: HubApiError): string | null {\n switch (err.code) {\n case 'unauthorized':\n return 'The hub rejected the API token. Restart a local hub with `agentbox hub restart`, or check AGENTBOX_HUB_API_KEY for a remote control box.';\n case 'backend_unavailable':\n return \"The hub reached its backend but it was unavailable — the provider or host it needs may not be configured on the hub's machine.\";\n default:\n return null;\n }\n}\n\n/**\n * Map a resolved {@link HubTarget} to the `/api/v1` client target, or the reason\n * it can't be used. Pure — the local⇄remote logic lives in `resolveHubTarget`;\n * this only converts `token`→`apiKey` and decides whether a token is present.\n * The token IS the Bearer for both modes (a local hub's token, or a control\n * box's `AGENTBOX_HUB_API_KEY`).\n */\nexport function hubApiTargetFrom(\n target: HubTarget,\n):\n | { ok: true; url: string; apiKey: string }\n | { ok: false; reason: 'no-token'; mode: 'local' | 'remote' } {\n if (!target.token) return { ok: false, reason: 'no-token', mode: target.mode };\n return { ok: true, url: target.url, apiKey: target.token };\n}\n\n/** Print a hub failure and set the matching exit code. Never throws. */\nfunction reportHubError(err: unknown, url: string): void {\n if (err instanceof HubApiError) {\n log.error(err.message);\n const hint = hintForApiError(err);\n if (hint) log.info(hint);\n process.exitCode = exitCodeForHubError(err);\n return;\n }\n // A fetch/network failure (hub down, wrong URL) surfaces as a plain Error.\n log.error(`Can't reach the hub at ${url}: ${err instanceof Error ? err.message : String(err)}`);\n process.exitCode = 1;\n}\n\nexport async function withHubClient<T>(\n opts: WithHubOptions,\n fn: (client: HubApiClient) => Promise<T>,\n): Promise<T | undefined> {\n // Lazy import breaks the hub.ts <-> control-plane.ts module cycle that both of\n // those already sit in (hub.ts consumes control-plane.ts's command list at\n // load time). Cheap after the first call — the module is cached.\n const { resolveHubApiTarget } = await import('../commands/control-plane.js');\n const target = await resolveHubApiTarget(opts.url, { preferLocal: opts.preferLocal });\n if (!target) {\n // resolveHubApiTarget already printed an actionable error (missing config /\n // key, or a local-hub autostart failure).\n process.exitCode = 1;\n return undefined;\n }\n const client = new HubApiClient(target);\n\n // Version gate — also the first authed-adjacent round-trip, so an unreachable\n // hub is reported here rather than surfacing later as a confusing op failure.\n try {\n const health = await client.health();\n if (!isSupportedApiVersion(health.apiVersion)) {\n log.error(\n `The hub at ${target.url} serves API ${health.apiVersion ? `\"${health.apiVersion}\"` : '(none reported)'}, ` +\n `which this CLI doesn't support (needs ${SUPPORTED_HUB_API_VERSIONS.join(', ')}).`,\n );\n log.info(\n 'Upgrade it (`agentbox hub update` for a remote control box, or `agentbox hub restart` for a local hub) or update this CLI to match.',\n );\n process.exitCode = 1;\n return undefined;\n }\n } catch (err) {\n if (err instanceof HubApiError) {\n // A hub too old to expose /api/v1 answers the probe with an error envelope.\n log.error(\n `The hub at ${target.url} didn't answer the /api/v1 health probe (${err.code}). It may be too old — upgrade it.`,\n );\n process.exitCode = 1;\n } else {\n reportHubError(err, target.url);\n }\n return undefined;\n }\n\n try {\n return await fn(client);\n } catch (err) {\n reportHubError(err, target.url);\n return undefined;\n }\n}\n\n/**\n * Whether the hub that OWNS this box runs on THIS machine — the `preferLocal`\n * answer for any box op. **The one ownership predicate**: a lifecycle/destroy op\n * can only be served by the hub that owns the box, and getting this wrong sends\n * the op to a hub that never registered the box (→ `not_found`). True for the\n * provider families the LOCAL hub drives directly:\n * - `docker` — a container on this machine.\n * - `remote-docker` — a container on another machine's engine, but the box\n * registers with the LOCAL relay (the local hub drives the remote engine over\n * SSH), so its owner is still local.\n * Cloud providers (e2b/vercel/hetzner/daytona/digitalocean) are owned by whichever\n * hub is configured, so they are NOT local-owned. Every caller MUST use this rather\n * than an inline `provider === 'docker'` check — five copies drift; a new provider\n * is classified here once.\n */\nexport function boxOwningHubIsLocal(box: { provider?: string }): boolean {\n const p = box.provider ?? 'docker';\n return p === 'docker' || p === 'remote-docker';\n}\n\n/** The outcome of a box op routed to its owning hub (see {@link withOwningHub}). */\nexport type OwningHubOutcome = 'ok' | 'not-found' | undefined;\n\n/**\n * Run a box op against the hub that OWNS the box (local for docker/remote-docker,\n * the configured hub for cloud — see {@link boxOwningHubIsLocal}), retrying the\n * OTHER distinct hub on `not_found`. A box can legitimately be unknown to the\n * first hub — e.g. a docker box whose op reached a configured remote hub that\n * never owned it — so a single `not_found` is not proof it belongs to no hub.\n * Returns:\n * - `'ok'` — some hub performed the op.\n * - `'not-found'` — no hub AgentBox knows owns the box.\n * - `undefined` — a hub error other than not_found (the owner-first attempt\n * went through {@link withHubClient}, which already reported it\n * + set the exit code).\n */\nexport async function withOwningHub(\n box: { id: string; provider?: string },\n op: (client: HubApiClient) => Promise<void>,\n): Promise<OwningHubOutcome> {\n const ownerLocal = boxOwningHubIsLocal(box);\n const primary = await withHubClient({ preferLocal: ownerLocal }, async (client) => {\n try {\n await op(client);\n return 'ok' as const;\n } catch (err) {\n if (err instanceof HubApiError && err.code === 'not_found') return 'not-found' as const;\n throw err;\n }\n });\n if (primary === undefined) return undefined; // withHubClient reported + set the exit code\n if (primary === 'ok') return 'ok';\n // The owner-first hub does not know this box. Retry the OTHER distinct hub.\n const other = await runOpOnOtherHub(box, op, !ownerLocal);\n if (other === 'ok') return 'ok';\n if (other === 'error') return undefined; // a real error on the retry hub — already reported\n return 'not-found';\n}\n\n/**\n * Run the op against the OTHER hub (the one `preferLocalOther` selects), skipped\n * when it resolves to the same URL as the owner-first attempt (a pure-local setup\n * has only one hub). Distinguishes three outcomes so a REAL error on the retry hub\n * isn't misreported as \"no hub owns the box\":\n * - `'ok'` — the retry hub performed the op.\n * - `'error'` — a genuine failure (conflict / auth / provider error); it is\n * REPORTED here (message + exit code) and the caller aborts.\n * - `'not-found'` — the retry hub doesn't own the box (`not_found`), OR it was\n * unreachable / unresolvable — neither is proof of ownership,\n * so the caller treats the box as owned by no known hub.\n */\nasync function runOpOnOtherHub(\n box: { id: string; provider?: string },\n op: (client: HubApiClient) => Promise<void>,\n preferLocalOther: boolean,\n): Promise<'ok' | 'error' | 'not-found'> {\n let owner: { url: string; apiKey: string } | null;\n let other: { url: string; apiKey: string } | null;\n try {\n const { resolveHubApiTarget } = await import('../commands/control-plane.js');\n [owner, other] = await Promise.all([\n resolveHubApiTarget(undefined, { quiet: true, preferLocal: !preferLocalOther }),\n // Non-quiet so a stopped LOCAL retry hub is auto-started (it's a candidate owner).\n resolveHubApiTarget(undefined, { preferLocal: preferLocalOther }),\n ]);\n } catch {\n return 'not-found'; // couldn't even resolve the other hub — not proof of ownership\n }\n if (!other) return 'not-found';\n if (owner && owner.url === other.url) return 'not-found'; // no distinct second hub\n try {\n await op(new HubApiClient(other));\n return 'ok';\n } catch (err) {\n if (err instanceof HubApiError) {\n // `not_found` = legitimately not owned here; any other code (conflict, auth,\n // backend, internal) is a REAL failure to surface, NOT \"no hub owns the box\".\n if (err.code === 'not_found') return 'not-found';\n reportHubError(err, other.url);\n return 'error';\n }\n // A network/transport failure to the second hub — unreachable is not proof of\n // ownership, so preserve the box (the caller keeps its record / refuses).\n return 'not-found';\n }\n}\n\n/**\n * Report a box that no hub AgentBox knows about owns, for the lifecycle commands\n * (start/stop/pause/unpause). Sets the `not_found` exit code (2). `destroy` does\n * NOT use this — it keeps the local record and names `--force` instead, because\n * dropping the record of a possibly-still-running resource is the dangerous case.\n */\nexport function reportBoxNotOnAnyHub(box: { name: string }): void {\n log.error(`Box ${box.name} was not found on any hub AgentBox knows.`);\n log.info('Run `agentbox ls` to see boxes AgentBox can drive.');\n process.exitCode = 2;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA6BO,SAAS,0BACd,cACA,YACQ;AACR,QAAM,MAAO,gBAAgB,aAAa,KAAK,KAAM;AACrD,MAAI,cAAc,kBAAkB,GAAG,EAAE,SAAS,SAAU,QAAO,UAAU,UAAU;AACvF,SAAO;AACT;AAgBO,SAAS,sBACd,KACA,OAAmD,CAAC,GACoB;AACxE,QAAM,EAAE,MAAM,cAAc,YAAY,SAAS,IAAI;AAAA,IACnD,KAAK,UAAU,KAAK,KAAK,IAAI,IAAI,YAAY;AAAA,EAC/C;AACA,QAAM,OACJ,KAAK,YAAY,KAAK,KAAK,aAAa,IAAI,IAAI,oBAAoB,IAAI,KAAK,KAAK;AAGpF,QAAM,aAAa,iBAAiB,gBAAgB,OAAO;AAC3D,SAAO,EAAE,cAAc,YAAY,MAAM,gBAAgB,cAAc,UAAU,EAAE;AACrF;AAOO,SAAS,gBAAgB,cAAsB,YAAwC;AAC5F,SAAO,iBAAiB,iBAAiB,aAAa,UAAU,UAAU,KAAK;AACjF;;;ACrDO,SAAS,gBAAgB,MAAuB;AACrD,MAAI;AACF,WAAO,kBAAkB,kBAAkB,IAAI,EAAE,IAAI;AAAA,EACvD,QAAQ;AAGN,WAAO;AAAA,EACT;AACF;AAWA,eAAsB,YAAY,MAAuC;AACvE,QAAM,MAAM,MAAM,mBAAmB,kBAAkB,IAAI,EAAE,IAAI;AACjE,MAAI,IAAI,kBAAmB,OAAM,IAAI,kBAAkB;AACvD,SAAO,IAAI;AACb;AAGA,eAAsB,eAAe,KAAmC;AACtE,SAAO,YAAY,IAAI,YAAY,QA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AI,SAAS,YAAa,QAAO;AACrC,qBAAe,KAAK,MAAM,GAAG;AAC7B,aAAO;AAAA,IACT;AAGA,WAAO;AAAA,EACT;AACF;AAQO,SAAS,qBAAqB,KAA6B;AAChE,MAAI,MAAM,OAAO,IAAI,IAAI,2CAA2C;AACpE,MAAI,KAAK,oDAAoD;AAC7D,UAAQ,WAAW;AACrB;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/control-plane/hub-api-client.ts"],"sourcesContent":["/**\n * The PC's client for a hub's public REST API (`/api/v1`) — the SAME surface the\n * tray and web UI speak. Its only local⇄remote difference is the base URL + token\n * (a control box's `AGENTBOX_HUB_API_KEY`, or a local hub's token), so a command\n * built on this client works against either by swapping the target.\n *\n * This is the CLI's ONE client. The internal relay wire (`/admin/*` + `/remote/*`)\n * is the box↔hub + credential plane — not a client API — and after the `/api/v1`\n * consolidation the CLI no longer holds a client for it (a guard test enforces\n * this; see `test/no-internal-wire-client.test.ts`). Every client-facing box and\n * fleet operation (list, lifecycle, git, approvals, custody) goes through here.\n */\n\n/**\n * A hub box as the `/api/v1` list/get returns it (the UI view + raw host fields).\n * Mirrors the hub's own `Box` for the fields a CLI/tray client reads. The\n * \"adoption / reconstruction\" block is what lets a thin CLI (`agentbox ls`, and\n * Step 4's box resolution) rebuild a drivable local record from THIS payload\n * instead of the internal `/admin/store` registration wire — it carries every\n * NON-SECRET field `registrationToBoxRecord` needs. Tokens (relay/bridge/preview)\n * are deliberately absent: a fresh adoption re-mints them.\n */\nexport interface HubApiBox {\n id: string;\n name?: string;\n /** Cosmetic user label (set via rename); the CLI prefers it over `name`. */\n displayName?: string | null;\n /** The hub's computed primary label (displayName || session title || name). */\n task: string;\n provider: string;\n /** Raw provider runtime state; absent on synthetic in-flight `job:` boxes. */\n state?: 'running' | 'paused' | 'stopped' | 'missing' | 'destroyed';\n /** Normalized lifecycle status (running | paused | stopped | creating | error). */\n status: string;\n branch: string;\n /** Absolute host path of the box's project — host topology only. */\n projectRoot?: string;\n projectIndex?: number;\n createdAt?: number;\n /** Normalized primary agent for display ('claude' | 'codex' | 'opencode' | 'shell'). */\n agent?: string;\n // ── Agent activity / session titles (the AGENT column + cmux dock). ──\n claudeActivity?: string;\n codexActivity?: string;\n claudeSessionTitle?: string;\n codexSessionTitle?: string;\n opencodeSessionTitle?: string;\n /** Live shell-session count (docker only); absent → the CLI renders `-`. */\n shellCount?: number;\n // ── Endpoints (the URL column; Step 7's `url`/`screen`). ──\n webUrl?: string | null;\n vncUrl?: string | null;\n vncEnabled?: boolean;\n // ── Adoption / reconstruction fields (non-secret; cloud boxes only, EXCEPT\n // originUrl which is populated for any registered box, docker included). ──\n sandboxId?: string;\n // Repo origin URL — the cross-machine project key `list` scopes by when a box's\n // projectRoot names no local directory (it's a remote hub's own path).\n originUrl?: string | null;\n publicHost?: string;\n image?: string;\n webPort?: number;\n previewUrls?: Record<number, string>;\n lastAgent?: 'claude' | 'codex' | 'opencode';\n topology?: string;\n}\n\n/** A create-job's status as `/api/v1/jobs/:id` (and each row of `/api/v1/jobs`) returns it. */\nexport interface HubApiJob {\n id: string;\n status: 'queued' | 'running' | 'done' | 'failed' | string;\n boxId?: string;\n /** A failed job's reason — surfaced so a create reports a failure, not a silent \"done\". */\n error?: string;\n provider?: string;\n name?: string;\n agent?: string;\n createdAt?: string;\n login?: {\n required?: boolean;\n phase?: string;\n url?: string;\n error?: string;\n lastError?: string;\n };\n}\n\n/** Body for `POST /api/v1/boxes` — mirrors the hub's `CreateBoxInput`. */\nexport interface HubApiCreateBoxInput {\n /** Exactly one of projectId / repoUrl. */\n projectId?: string;\n repoUrl?: string;\n agent: 'claude' | 'codex' | 'opencode' | 'none';\n provider?: string;\n name?: string;\n prompt?: string;\n agentArgs?: string[];\n startAgent?: boolean;\n /** A foreground (interactive) create — the hub runs it in the ungated lane. */\n foreground?: boolean;\n fromBranch?: string;\n setupWizard?: boolean;\n /** Box-shaping knobs (image, snapshot, limits, size/location, carry, ...). */\n opts?: Record<string, unknown>;\n}\n\n/**\n * A sandbox provider as `/api/v1/providers` returns it. Mirrors the hub's own\n * `ProviderOption`; only the fields a CLI/tray client reads are named here.\n */\nexport interface HubApiProvider {\n id: string;\n label: string;\n /** Base baked (or, for remote-docker, at least one host registered). */\n configured: boolean;\n hasCredentials?: boolean;\n /** Id of a bake already in flight for this provider, if any. */\n jobId?: string;\n reason?: string;\n /** Only present when the caller asked for `?freshness=1`. */\n baseStatus?: 'fresh' | 'stale' | 'unprepared' | 'unknown';\n baseStaleReason?: string;\n}\n\n/** A remote-docker host alias as `/api/v1/hosts` returns it. */\nexport interface HubApiHost {\n alias: string;\n ssh?: string;\n baked?: boolean;\n default?: boolean;\n /** The hub holds its own key for this host (it was shared with it). */\n managedKey?: boolean;\n}\n\n/** What a PC sends to share one of its own engines with a control box. */\nexport interface HubApiHostShare {\n alias: string;\n /** Human-facing connection string, as the sharer wrote it. */\n ssh: string;\n /** The `ssh -G` expansion — what the hub actually dials. */\n connection: { host: string; user?: string; port?: number };\n /** PEM of the key minted for the hub. Never returned by the API. */\n identity?: string;\n default?: boolean;\n}\n\n/** A pending host-action approval as `/api/v1/approvals` returns it. */\nexport interface HubApiApproval {\n id: string;\n boxId: string;\n message: string;\n detail?: string;\n command?: string;\n cwd?: string;\n argv?: string[];\n defaultAnswer: 'y' | 'n';\n createdAt: number;\n}\n\n/** Result of a box git/service op (mirrors the backend `BoxOpResult`). */\nexport interface HubApiOpResult {\n ok: boolean;\n stdout?: string;\n stderr?: string;\n error?: string;\n}\n\n/** One supervised service, as `GET /boxes/:id/services` returns it (mirrors the\n * backend `ServiceView`). The persisted-snapshot source fills pid/restarts/\n * lastExitCode/command with nulls/defaults. */\nexport interface HubApiServiceView {\n name: string;\n state: string;\n pid: number | null;\n restarts: number;\n lastExitCode: number | null;\n blockedOn: string[];\n command: string;\n}\n\n/**\n * A box's agentbox.yaml task/service/port status (mirrors the backend\n * `ServicesResult`). `source` says whether it came from a live in-box pull, the\n * persisted snapshot (box paused/stopped), or is unavailable (box gone / never\n * reported).\n */\nexport interface HubApiServices {\n source: 'live' | 'persisted' | 'unavailable';\n services: HubApiServiceView[];\n tasks: { name: string; state: string }[];\n ports: { port: number; service: string | null }[];\n error?: string;\n}\n\nexport type HubLifecycleAction = 'start' | 'pause' | 'resume' | 'stop' | 'destroy';\nexport type HubGitOp = 'checkout' | 'branch' | 'pull' | 'push' | 'push-host';\n\n/** Result of `POST /boxes/:id/checkpoint` (a captured project checkpoint). */\nexport interface HubApiCheckpointCreate {\n ok: true;\n name: string;\n /** docker manifest type ('layered'/'merged') or 'snapshot' for a cloud backend. */\n kind: string;\n ref: string;\n provider: string;\n dir?: string;\n /** The default-checkpoint config key written when --set-default was requested. */\n setDefaultKey?: string;\n}\n\n/** One checkpoint row from `GET /checkpoints` (defaults resolved server-side). */\nexport interface HubApiCheckpointItem {\n name: string;\n provider: string;\n kind: string;\n sourceBoxName: string;\n createdAt: string;\n isDefault: boolean;\n}\n\nexport interface HubApiCheckpointProject {\n segment: string;\n projectRoot?: string;\n label: string;\n items: HubApiCheckpointItem[];\n}\n\nexport interface HubApiCheckpointListing {\n projects: HubApiCheckpointProject[];\n}\n\n/** Result of `DELETE /checkpoints` (removed backends + swept default pointers). */\nexport interface HubApiCheckpointRemove {\n ok: true;\n removed: string[];\n clearedKeys: string[];\n warnedKeys: string[];\n}\n\n/** The local (docker) prune tally — mirrors the backend PruneResultView. */\nexport interface HubApiPruneResult {\n removedRecords: string[];\n removedContainers: string[];\n removedVolumes: string[];\n removedSnapshotDirs: string[];\n removedBoxDirs: string[];\n removedCheckpointImages: string[];\n dryRun: boolean;\n}\n\nexport interface HubApiPruneGeneral {\n kind: 'general';\n result: HubApiPruneResult;\n projectConfigs: string[];\n}\n\nexport interface HubApiCloudOrphan {\n sandboxId: string;\n name?: string;\n state?: string;\n createdAt?: string;\n}\n\nexport interface HubApiPruneCloud {\n kind: 'cloud';\n provider: string;\n dryRun: boolean;\n orphans: HubApiCloudOrphan[];\n deleted: number;\n failed: number;\n reaped: number;\n}\n\nexport type HubApiPruneView = HubApiPruneGeneral | HubApiPruneCloud;\n\n/** `GET /boxes/:id/agent` — the raw BoxStatusClaude snapshot (null = none yet). */\nexport interface HubApiAgentState {\n claude: unknown;\n}\n\n/** The unauthenticated liveness probe (`GET /api/v1/health`). */\nexport interface HubApiHealth {\n ok: boolean;\n /** The API contract the hub serves, e.g. `v1`. Gated against {@link SUPPORTED_HUB_API_VERSIONS}. */\n apiVersion: string;\n /** The AgentBox version the hub runs (a control box may differ from this CLI). */\n version?: string;\n profile?: string;\n}\n\n/**\n * The `/api/v1` contract versions this CLI knows how to speak. The hub reports its\n * own on `GET /api/v1/health` (`apiVersion`); a hub outside this set is refused up\n * front with an upgrade hint rather than failing on a missing/changed field later.\n */\nexport const SUPPORTED_HUB_API_VERSIONS = ['v1'] as const;\n\nexport interface HubApiTarget {\n url: string;\n apiKey: string;\n fetchImpl?: typeof fetch;\n}\n\n/** An error carrying the `/api/v1` envelope's code + HTTP status (+ optional details). */\nexport class HubApiError extends Error {\n constructor(\n message: string,\n readonly code: string,\n readonly status: number,\n /**\n * The envelope's `error.details`, when present. Git ops carry the box\n * command's own `exitCode` here so a caller can surface a faithful exit\n * (e.g. 64 for `push --host-only` with no host checkout) that the coarse\n * code→exit mapping can't express.\n */\n readonly details?: unknown,\n ) {\n super(message);\n this.name = 'HubApiError';\n }\n}\n\ninterface ApiErrorBody {\n error?: { code?: string; message?: string; details?: unknown };\n}\n\nexport class HubApiClient {\n private readonly base: string;\n private readonly token: string;\n private readonly fetchImpl: typeof fetch;\n\n constructor(target: HubApiTarget) {\n this.base = target.url.replace(/\\/+$/, '');\n this.token = target.apiKey;\n this.fetchImpl = target.fetchImpl ?? fetch;\n }\n\n private async request<T>(method: string, path: string, body?: unknown): Promise<T> {\n const res = await this.fetchImpl(`${this.base}/api/v1${path}`, {\n method,\n headers: {\n Authorization: `Bearer ${this.token}`,\n ...(body !== undefined ? { 'Content-Type': 'application/json' } : {}),\n },\n ...(body !== undefined ? { body: JSON.stringify(body) } : {}),\n });\n if (res.status === 204) return undefined as T;\n const text = await res.text();\n let parsed: unknown;\n try {\n parsed = text.length > 0 ? JSON.parse(text) : {};\n } catch {\n throw new HubApiError(`unexpected non-JSON response (${res.status})`, 'internal', res.status);\n }\n if (!res.ok) {\n const err = (parsed as ApiErrorBody).error;\n throw new HubApiError(\n err?.message ?? `request failed: ${res.status}`,\n err?.code ?? 'internal',\n res.status,\n err?.details,\n );\n }\n return parsed as T;\n }\n\n /**\n * Liveness + API-version probe. Unauthenticated on the hub (the Bearer we send\n * is harmless), so it also confirms the hub is reachable before an authed call.\n * Throws `HubApiError` on a non-2xx (e.g. a hub too old to expose `/api/v1`).\n */\n health(): Promise<HubApiHealth> {\n return this.request<HubApiHealth>('GET', '/health');\n }\n\n /**\n * All boxes the hub knows (its own + registered). Topology-agnostic read.\n * `live` (opt-in, expensive — mirrors `listProviders({ freshness })`) asks the\n * hub to refresh each cloud box's `state` with an authoritative SDK probe; the\n * default serves the fast persisted state.\n */\n async listBoxes(opts: { live?: boolean } = {}): Promise<HubApiBox[]> {\n const q = opts.live ? '?live=1' : '';\n return (await this.request<{ boxes: HubApiBox[] }>('GET', `/boxes${q}`)).boxes;\n }\n\n /** One box by id (throws HubApiError 'not_found' when absent). */\n getBox(id: string): Promise<HubApiBox> {\n return this.request<HubApiBox>('GET', `/boxes/${encodeURIComponent(id)}`);\n }\n\n /**\n * Resolve a box ref (`id | name | sandbox id | index`) server-side, mirroring\n * the CLI's local `findBox`. Returns the match SET: `[]`=none, `[box]`=unique,\n * `[…]`=an ambiguous id prefix (the caller disambiguates). `project` (an\n * absolute host project root) enables numeric project-index resolution.\n */\n async resolveBox(ref: string, project?: string): Promise<HubApiBox[]> {\n const q = new URLSearchParams({ ref });\n if (project !== undefined) q.set('project', project);\n return (await this.request<{ boxes: HubApiBox[] }>('GET', `/boxes?${q.toString()}`)).boxes;\n }\n\n /** Lifecycle action on a box. Reverse-adoption lets the hub drive registered-only boxes. */\n async lifecycle(id: string, action: HubLifecycleAction): Promise<void> {\n await this.request<{ ok: true }>('POST', `/boxes/${encodeURIComponent(id)}/${action}`);\n }\n\n /**\n * Real destroy: tears down the cloud resource AND reaps the hub's\n * registration/custody. `keepSnapshot` preserves a docker box's local snapshot\n * dir (mirrors the CLI's `--keep-snapshot`), so it travels on the request body.\n */\n async destroy(id: string, opts: { keepSnapshot?: boolean } = {}): Promise<void> {\n await this.request<{ ok: true }>('POST', `/boxes/${encodeURIComponent(id)}/destroy`, opts);\n }\n\n /** A git op against the box's branch. */\n git(id: string, op: HubGitOp, body: Record<string, unknown> = {}): Promise<HubApiOpResult> {\n return this.request<HubApiOpResult>('POST', `/boxes/${encodeURIComponent(id)}/git/${op}`, body);\n }\n\n /**\n * Create a box (async). Forks server-side: a `projectId` with a local workspace\n * → the file queue; a `repoUrl` (or a projectId with no local folder) → the\n * control-plane clone queue. Returns the background job id; progress streams\n * over {@link streamJobLog} and the verdict comes from {@link getJob}.\n */\n async createBox(body: HubApiCreateBoxInput): Promise<{ jobId: string }> {\n return this.request<{ jobId: string }>('POST', '/boxes', body);\n }\n\n /** Create-job status (poll until done/failed). */\n getJob(id: string): Promise<HubApiJob> {\n return this.request<HubApiJob>('GET', `/jobs/${encodeURIComponent(id)}`);\n }\n\n /** The unified background-job listing (`queue list` / `hub jobs`). Newest first. */\n async listJobs(): Promise<HubApiJob[]> {\n return (await this.request<{ jobs: HubApiJob[] }>('GET', '/jobs')).jobs;\n }\n\n /**\n * Deliver a pasted OAuth code to a create job awaiting a Claude re-login (the\n * one interactive create affordance). The worker consumes it from the manifest.\n */\n async submitLoginCode(id: string, code: string): Promise<void> {\n await this.request<{ ok: true }>('POST', `/jobs/${encodeURIComponent(id)}/login-code`, {\n code,\n });\n }\n\n /**\n * The hub's sandbox providers. `freshness` additionally reports base staleness\n * (`baseStatus`/`baseStaleReason`), which the hub computes by hashing its own\n * build context — the expensive path, so it stays opt-in there too.\n */\n async listProviders(opts: { freshness?: boolean } = {}): Promise<HubApiProvider[]> {\n const q = opts.freshness ? '?freshness=1' : '';\n return (await this.request<{ providers: HubApiProvider[] }>('GET', `/providers${q}`)).providers;\n }\n\n /** The remote-docker host aliases the hub itself has registered. */\n async listHosts(): Promise<HubApiHost[]> {\n return (await this.request<{ hosts: HubApiHost[] }>('GET', '/hosts')).hosts;\n }\n\n /**\n * Register one of THIS machine's remote-docker engines on the hub, with the\n * connection + key it needs to reach it itself. The hub probes ssh + docker\n * before saving, so a resolved promise means the hub really got there.\n */\n async addHost(body: HubApiHostShare): Promise<void> {\n await this.request<{ ok: true }>('POST', '/hosts', body);\n }\n\n /** Forget a host on the hub. Boxes already created against it are reported. */\n async removeHost(alias: string): Promise<{ boxesAffected?: string[] }> {\n return await this.request<{ boxesAffected?: string[] }>(\n 'DELETE',\n `/hosts/${encodeURIComponent(alias)}`,\n );\n }\n\n /**\n * Bake the box image on one of the HUB's remote-docker hosts. Returns a job id\n * that streams over {@link streamJobLog}, exactly like a provider bake.\n */\n async bakeHost(alias: string): Promise<string> {\n const res = await this.request<{ jobId: string }>(\n 'POST',\n `/hosts/${encodeURIComponent(alias)}/bake`,\n );\n return res.jobId;\n }\n\n /**\n * Persist a provider's credentials ON the hub: the hub validates the given\n * canonical fields (e.g. `{ apiKey }`, `{ token, teamId?, projectId? }`) against\n * the cloud, then writes them to its own `~/.agentbox/secrets.env`. Never echoes\n * secret values. A rejected token surfaces as `HubApiError('invalid_request')`.\n */\n async setProviderCredentials(id: string, fields: Record<string, string>): Promise<void> {\n await this.request<{ ok: true }>(\n 'POST',\n `/providers/${encodeURIComponent(id)}/credentials`,\n fields,\n );\n }\n\n /**\n * Bake a provider's base ON the hub. Async: returns the id of a background job\n * whose progress streams over {@link streamJobLog}.\n */\n async prepareProvider(\n id: string,\n body: {\n force?: boolean;\n claudeInstall?: 'native' | 'npm';\n build?: boolean;\n size?: string;\n location?: string;\n name?: string;\n } = {},\n ): Promise<string> {\n const res = await this.request<{ jobId: string }>(\n 'POST',\n `/providers/${encodeURIComponent(id)}/prepare`,\n body,\n );\n return res.jobId;\n }\n\n /**\n * Stream a job's log lines until the server closes the SSE stream.\n *\n * Deliberately NOT routed through `request`: the response is an event stream,\n * not JSON, and consuming it as text would buffer the whole bake (minutes of\n * silence) before printing anything. Resolves when the stream ends; the caller\n * still polls {@link getJob} for the terminal verdict, since a dropped\n * connection must not read as a successful bake.\n */\n async streamJobLog(\n id: string,\n onLine: (line: string) => void,\n signal?: AbortSignal,\n ): Promise<void> {\n const res = await this.fetchImpl(`${this.base}/api/v1/jobs/${encodeURIComponent(id)}/logs`, {\n headers: { Authorization: `Bearer ${this.token}`, Accept: 'text/event-stream' },\n signal,\n });\n if (!res.ok || !res.body) return;\n const decoder = new TextDecoder();\n let buffer = '';\n for await (const chunk of res.body as unknown as AsyncIterable<Uint8Array>) {\n buffer += decoder.decode(chunk, { stream: true });\n // SSE frames are blank-line separated; a partial trailing frame stays in\n // the buffer until the rest of it arrives.\n const frames = buffer.split('\\n\\n');\n buffer = frames.pop() ?? '';\n for (const frame of frames) {\n let event = '';\n let data = '';\n for (const raw of frame.split('\\n')) {\n if (raw.startsWith('event:')) event = raw.slice(6).trim();\n else if (raw.startsWith('data:')) data = raw.slice(5).trim();\n }\n // `open`/`end`/`login` carry structured state the caller gets from\n // getJob instead; only the log lines belong on screen.\n if (event !== 'log' || data.length === 0) continue;\n try {\n const line = JSON.parse(data) as unknown;\n if (typeof line === 'string' && line.length > 0) onLine(line);\n } catch {\n /* a frame we can't parse is not worth failing a bake over */\n }\n }\n }\n }\n\n /** Pending host-action approvals across every box. */\n async listApprovals(): Promise<HubApiApproval[]> {\n return (await this.request<{ approvals: HubApiApproval[] }>('GET', '/approvals')).approvals;\n }\n\n /**\n * Answer a pending approval by id. `cancelled` marks a dismissal distinctly\n * from a plain deny in the audit trail (the `agent approve --cancel` capability);\n * it still resolves the parked action as not-approved.\n */\n async answerApproval(id: string, answer: 'y' | 'n', cancelled?: boolean): Promise<void> {\n await this.request<{ ok: true }>('POST', `/approvals/${encodeURIComponent(id)}/answer`, {\n answer,\n ...(cancelled === true ? { cancelled: true } : {}),\n });\n }\n\n /**\n * The box's agentbox.yaml service/task/port status — a live in-box pull when the\n * box is running, else the persisted snapshot (so a paused box still reports),\n * matching what `agentbox status` shows.\n */\n getServices(id: string): Promise<HubApiServices> {\n return this.request<HubApiServices>('GET', `/boxes/${encodeURIComponent(id)}/services`);\n }\n\n /** Restart one service by name, or every service when `name` is omitted. */\n restartService(id: string, name?: string): Promise<HubApiOpResult> {\n return this.request<HubApiOpResult>(\n 'POST',\n `/boxes/${encodeURIComponent(id)}/services/restart`,\n name ? { name } : {},\n );\n }\n\n /**\n * Set (or clear, with an empty string) a box's cosmetic display label. Pure\n * state — the container / git branch / URL are untouched.\n */\n async rename(id: string, displayName: string): Promise<void> {\n await this.request<{ ok: true }>('POST', `/boxes/${encodeURIComponent(id)}/rename`, {\n displayName,\n });\n }\n\n // ── checkpoints (durable project assets) ──\n\n /** Capture the box state as a project checkpoint (docker commit / cloud snapshot). */\n createCheckpoint(\n id: string,\n body: { name?: string; merged?: boolean; setDefault?: boolean; replace?: boolean } = {},\n ): Promise<HubApiCheckpointCreate> {\n return this.request<HubApiCheckpointCreate>(\n 'POST',\n `/boxes/${encodeURIComponent(id)}/checkpoint`,\n body,\n );\n }\n\n /** List a project's checkpoints (docker + cloud), or every project's with `global`. */\n listCheckpoints(\n opts: { project?: string; global?: boolean } = {},\n ): Promise<HubApiCheckpointListing> {\n const q = new URLSearchParams();\n if (opts.global) q.set('global', '1');\n if (opts.project !== undefined) q.set('project', opts.project);\n return this.request<HubApiCheckpointListing>('GET', `/checkpoints?${q.toString()}`);\n }\n\n /** Delete a checkpoint from every store that has it (or just `provider`'s). */\n deleteCheckpoint(opts: {\n project: string;\n ref: string;\n provider?: string;\n }): Promise<HubApiCheckpointRemove> {\n const q = new URLSearchParams({ project: opts.project, ref: opts.ref });\n if (opts.provider !== undefined) q.set('provider', opts.provider);\n return this.request<HubApiCheckpointRemove>('DELETE', `/checkpoints?${q.toString()}`);\n }\n\n // ── prune (fleet cleanup) ──\n\n /**\n * Prune orphan fleet resources. Without `provider` (or provider === 'docker'):\n * orphan docker records/resources + project configs. With a cloud provider:\n * enumerate untracked sandboxes, deleting + reaping when !dryRun.\n */\n prune(\n body: { all?: boolean; dryRun?: boolean; provider?: string } = {},\n ): Promise<HubApiPruneView> {\n return this.request<HubApiPruneView>('POST', '/prune', body);\n }\n\n // ── agent state ──\n\n /** The box's in-box coding-agent status snapshot (Claude activity/plan/question). */\n getAgentState(id: string): Promise<HubApiAgentState> {\n return this.request<HubApiAgentState>('GET', `/boxes/${encodeURIComponent(id)}/agent`);\n }\n\n // ── box service logs ──\n\n /** Non-follow tail of a service log (or the ctl-daemon log with `daemon`). */\n async getBoxLogs(\n id: string,\n params: { service?: string; tail: number; daemon?: boolean },\n ): Promise<{ output: string }> {\n return this.request<{ output: string }>(\n 'GET',\n `/boxes/${encodeURIComponent(id)}/logs?${logQuery(params).toString()}`,\n );\n }\n\n /**\n * Follow a service log over SSE, invoking `onLine` for each `log` event until the\n * hub closes the stream. Resolves with the terminal status (from the `end` event,\n * or 'gone' if the stream dropped). A non-2xx answer (e.g. box not found) throws\n * a {@link HubApiError} so `withOwningHub` can retry the other hub — mirrors\n * {@link streamJobLog}, which deliberately bypasses `request` for the same reason.\n */\n async streamBoxLog(\n id: string,\n params: { service?: string; tail: number; daemon?: boolean },\n onLine: (line: string) => void,\n signal?: AbortSignal,\n ): Promise<{ status: string }> {\n const res = await this.fetchImpl(\n `${this.base}/api/v1/boxes/${encodeURIComponent(id)}/logs?${logQuery({ ...params, follow: true }).toString()}`,\n { headers: { Authorization: `Bearer ${this.token}`, Accept: 'text/event-stream' }, signal },\n );\n if (!res.ok) {\n // The route answers a bad request / missing box with the JSON error envelope,\n // not an SSE stream — surface it as a HubApiError like `request` does.\n const text = await res.text().catch(() => '');\n let body: ApiErrorBody = {};\n try {\n body = text.length > 0 ? (JSON.parse(text) as ApiErrorBody) : {};\n } catch {\n /* non-JSON error body */\n }\n throw new HubApiError(\n body.error?.message ?? `request failed: ${res.status}`,\n body.error?.code ?? 'internal',\n res.status,\n body.error?.details,\n );\n }\n if (!res.body) return { status: 'gone' };\n const decoder = new TextDecoder();\n let buffer = '';\n let status = 'gone';\n try {\n for await (const chunk of res.body as unknown as AsyncIterable<Uint8Array>) {\n buffer += decoder.decode(chunk, { stream: true });\n const frames = buffer.split('\\n\\n');\n buffer = frames.pop() ?? '';\n for (const frame of frames) {\n let event = '';\n let data = '';\n for (const raw of frame.split('\\n')) {\n if (raw.startsWith('event:')) event = raw.slice(6).trim();\n else if (raw.startsWith('data:')) data = raw.slice(5).trim();\n }\n if (data.length === 0) continue;\n if (event === 'log') {\n try {\n const line = JSON.parse(data) as unknown;\n if (typeof line === 'string') onLine(line);\n } catch {\n /* a frame we can't parse is not worth aborting the stream over */\n }\n } else if (event === 'end') {\n try {\n const parsed = JSON.parse(data) as { status?: string };\n if (typeof parsed.status === 'string') status = parsed.status;\n } catch {\n /* keep the default */\n }\n }\n }\n }\n } catch (err) {\n // A caller-requested abort (Ctrl-C on a `-f` follow) surfaces as an\n // AbortError from the streaming read — that's a clean stop, not a failure,\n // so don't let it bubble to withHubClient's \"can't reach the hub\" mapper.\n if (signal?.aborted) return { status: 'aborted' };\n throw err;\n }\n return { status };\n }\n}\n\n/** Build the shared `/boxes/:id/logs` query string (service/tail/daemon/follow). */\nfunction logQuery(params: {\n service?: string;\n tail: number;\n daemon?: boolean;\n follow?: boolean;\n}): URLSearchParams {\n const q = new URLSearchParams();\n q.set('tail', String(params.tail));\n if (params.service !== undefined) q.set('service', params.service);\n if (params.daemon) q.set('daemon', '1');\n if (params.follow) q.set('follow', '1');\n return q;\n}\n"],"mappings":";;;AAuSO,IAAM,6BAA6B,CAAC,IAAI;AASxC,IAAM,cAAN,cAA0B,MAAM;AAAA,EACrC,YACE,SACS,MACA,QAOA,SACT;AACA,UAA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