@madarco/agentbox 0.26.1 → 0.27.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 (263) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +1 -1
  3. package/dist/{_cloud-attach-7WRQH6XZ.js → _cloud-attach-WDGM6FL5.js} +4 -4
  4. package/dist/{chunk-UIFL7F2G.js → chunk-26IKZRTT.js} +2 -2
  5. package/dist/chunk-G3H2L3O2.js +0 -0
  6. package/dist/{chunk-DJQMK4RN.js → chunk-HR7NHH5J.js} +14 -9
  7. package/dist/chunk-HR7NHH5J.js.map +1 -0
  8. package/dist/{chunk-K5KOLYIL.js → chunk-IDH5A4RR.js} +2 -2
  9. package/dist/{chunk-ZY7M7MXH.js → chunk-JE6UI5YR.js} +10 -10
  10. package/dist/chunk-JGZSA5ZI.js +0 -0
  11. package/dist/{chunk-7ZZAZPYX.js → chunk-KWOEUFVA.js} +2 -2
  12. package/dist/{chunk-BA2VLJVU.js → chunk-LL7NCMUU.js} +3 -3
  13. package/dist/{chunk-I2OAJS3L.js → chunk-NEF6MDJO.js} +4 -4
  14. package/dist/{chunk-I2OAJS3L.js.map → chunk-NEF6MDJO.js.map} +1 -1
  15. package/dist/{dist-YA7EXBGG.js → chunk-SJ75AIA2.js} +486 -92
  16. package/dist/chunk-SJ75AIA2.js.map +1 -0
  17. package/dist/{chunk-PK2QF4IR.js → chunk-UJEH2NJT.js} +27 -14
  18. package/dist/chunk-UJEH2NJT.js.map +1 -0
  19. package/dist/{chunk-DQHMDDAT.js → chunk-V5XXJH63.js} +2 -2
  20. package/dist/chunk-WJFZJZIM.js +0 -0
  21. package/dist/cloud-poller-SUNA6ZQC-7M5LJHHE.js +0 -0
  22. package/dist/{dist-DTNYMBQ5.js → dist-FTKS2GI4.js} +5 -5
  23. package/dist/{dist-5IICYSR6.js → dist-KQTMCVME.js} +5 -5
  24. package/dist/{dist-5IICYSR6.js.map → dist-KQTMCVME.js.map} +1 -1
  25. package/dist/{dist-AR5CHRSV.js → dist-O3LKOIE7.js} +5 -5
  26. package/dist/{dist-POVRY7HO.js → dist-OO52HARR.js} +3 -3
  27. package/dist/{dist-K4LNH3EC.js → dist-TSFVB7AI.js} +5 -5
  28. package/dist/dist-U2SVLJUQ.js +0 -0
  29. package/dist/{dist-XYY6SIKG.js → dist-WVYAURMF.js} +5 -5
  30. package/dist/dist-Z6L5MM5D.js +46 -0
  31. package/dist/index.js +392 -211
  32. package/dist/index.js.map +1 -1
  33. package/dist/{prepared-state-75DIZ55S-W6NU3S3B.js → prepared-state-75DIZ55S-TNJXWMXV.js} +2 -2
  34. package/dist/prepared-state-75DIZ55S-TNJXWMXV.js.map +1 -0
  35. package/package.json +31 -29
  36. package/runtime/_shared/agentbox-checkpoint-cleanup +0 -0
  37. package/runtime/_shared/agentbox-dockerd-start +0 -0
  38. package/runtime/_shared/agentbox-open +0 -0
  39. package/runtime/_shared/agentbox-portless-trust +0 -0
  40. package/runtime/_shared/agentbox-vnc-start +0 -0
  41. package/runtime/_shared/ctl.cjs +0 -0
  42. package/runtime/_shared/gh-shim +0 -0
  43. package/runtime/_shared/git-shim +0 -0
  44. package/runtime/_shared/linear-shim +0 -0
  45. package/runtime/_shared/ntn-shim +0 -0
  46. package/runtime/digitalocean/agentbox-checkpoint-cleanup +0 -0
  47. package/runtime/digitalocean/agentbox-dockerd-start +0 -0
  48. package/runtime/digitalocean/agentbox-open +0 -0
  49. package/runtime/digitalocean/agentbox-portless-trust +0 -0
  50. package/runtime/digitalocean/agentbox-vnc-start +0 -0
  51. package/runtime/digitalocean/ctl.cjs +0 -0
  52. package/runtime/digitalocean/gh-shim +0 -0
  53. package/runtime/digitalocean/git-shim +0 -0
  54. package/runtime/digitalocean/linear-shim +0 -0
  55. package/runtime/digitalocean/ntn-shim +0 -0
  56. package/runtime/digitalocean/scripts/install-box.sh +0 -0
  57. package/runtime/docker/packages/ctl/dist/bin.cjs +0 -0
  58. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-checkpoint-cleanup +0 -0
  59. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-dockerd-start +0 -0
  60. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-open +0 -0
  61. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-portless-trust +0 -0
  62. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-sshd-start +0 -0
  63. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-vnc-start +0 -0
  64. package/runtime/docker/packages/sandbox-docker/scripts/chromium-resolver +0 -0
  65. package/runtime/docker/packages/sandbox-docker/scripts/gh-shim +0 -0
  66. package/runtime/docker/packages/sandbox-docker/scripts/git-shim +0 -0
  67. package/runtime/docker/packages/sandbox-docker/scripts/linear-shim +0 -0
  68. package/runtime/docker/packages/sandbox-docker/scripts/ntn-shim +0 -0
  69. package/runtime/e2b/agentbox-checkpoint-cleanup +0 -0
  70. package/runtime/e2b/agentbox-dockerd-start +0 -0
  71. package/runtime/e2b/agentbox-open +0 -0
  72. package/runtime/e2b/agentbox-vnc-start +0 -0
  73. package/runtime/e2b/ctl.cjs +0 -0
  74. package/runtime/e2b/gh-shim +0 -0
  75. package/runtime/e2b/git-shim +0 -0
  76. package/runtime/e2b/linear-shim +0 -0
  77. package/runtime/e2b/ntn-shim +0 -0
  78. package/runtime/e2b/scripts/build-template.sh +0 -0
  79. package/runtime/hetzner/agentbox-checkpoint-cleanup +0 -0
  80. package/runtime/hetzner/agentbox-dockerd-start +0 -0
  81. package/runtime/hetzner/agentbox-open +0 -0
  82. package/runtime/hetzner/agentbox-portless-trust +0 -0
  83. package/runtime/hetzner/agentbox-vnc-start +0 -0
  84. package/runtime/hetzner/ctl.cjs +0 -0
  85. package/runtime/hetzner/gh-shim +0 -0
  86. package/runtime/hetzner/git-shim +0 -0
  87. package/runtime/hetzner/linear-shim +0 -0
  88. package/runtime/hetzner/ntn-shim +0 -0
  89. package/runtime/hetzner/scripts/install-box.sh +0 -0
  90. package/runtime/hub/apps/hub/.next/BUILD_ID +1 -1
  91. package/runtime/hub/apps/hub/.next/app-path-routes-manifest.json +3 -0
  92. package/runtime/hub/apps/hub/.next/build-manifest.json +3 -3
  93. package/runtime/hub/apps/hub/.next/prerender-manifest.json +3 -3
  94. package/runtime/hub/apps/hub/.next/routes-manifest.json +22 -0
  95. package/runtime/hub/apps/hub/.next/server/app/(auth)/api/auth/[...all]/route.js +1 -1
  96. package/runtime/hub/apps/hub/.next/server/app/(auth)/api/auth/[...all]/route.js.nft.json +1 -1
  97. package/runtime/hub/apps/hub/.next/server/app/(auth)/signin/page_client-reference-manifest.js +1 -1
  98. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/docs/route.js +2 -1
  99. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/docs/route.js.nft.json +1 -1
  100. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/bake/route/app-paths-manifest.json +3 -0
  101. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/bake/route/build-manifest.json +9 -0
  102. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/bake/route/server-reference-manifest.json +4 -0
  103. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/bake/route.js +8 -0
  104. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/bake/route.js.map +5 -0
  105. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/bake/route.js.nft.json +1 -0
  106. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/bake/route_client-reference-manifest.js +3 -0
  107. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/route/app-paths-manifest.json +3 -0
  108. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/route/build-manifest.json +9 -0
  109. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/route/server-reference-manifest.json +4 -0
  110. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/route.js +8 -0
  111. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/route.js.map +5 -0
  112. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/route.js.nft.json +1 -0
  113. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/route_client-reference-manifest.js +3 -0
  114. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/route/app-paths-manifest.json +3 -0
  115. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/route/build-manifest.json +9 -0
  116. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/route/server-reference-manifest.json +4 -0
  117. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/route.js +9 -0
  118. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/route.js.map +5 -0
  119. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/route.js.nft.json +1 -0
  120. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/route_client-reference-manifest.js +3 -0
  121. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/openapi.json/route.js +2 -1
  122. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/openapi.json/route.js.nft.json +1 -1
  123. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page/server-reference-manifest.json +1 -1
  124. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page_client-reference-manifest.js +1 -1
  125. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page/server-reference-manifest.json +12 -12
  126. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page.js.nft.json +1 -1
  127. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page_client-reference-manifest.js +1 -1
  128. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page/server-reference-manifest.json +11 -11
  129. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page.js.nft.json +1 -1
  130. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
  131. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page/server-reference-manifest.json +8 -8
  132. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page.js.nft.json +1 -1
  133. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page_client-reference-manifest.js +1 -1
  134. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page.js.nft.json +1 -1
  135. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page_client-reference-manifest.js +1 -1
  136. package/runtime/hub/apps/hub/.next/server/app/_global-error.html +1 -1
  137. package/runtime/hub/apps/hub/.next/server/app/_global-error.rsc +1 -1
  138. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  139. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  140. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  141. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  142. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  143. package/runtime/hub/apps/hub/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  144. package/runtime/hub/apps/hub/.next/server/app-paths-manifest.json +3 -0
  145. package/runtime/hub/apps/hub/.next/server/chunks/044u_hub__next-internal_server_app_(dashboard)_api_v1_hosts_route_actions_0b_404_.js +3 -0
  146. package/runtime/hub/apps/hub/.next/server/chunks/0web_next-internal_server_app_(dashboard)_api_v1_hosts_[alias]_route_actions_0swypy5.js +3 -0
  147. package/runtime/hub/apps/hub/.next/server/chunks/0zhp_better-auth_dist_adapters_kysely-adapter_index_mjs_1rl4qnh._.js +3 -0
  148. package/runtime/hub/apps/hub/.next/server/chunks/1jcg_server_app_(dashboard)_api_v1_hosts_[alias]_bake_route_actions_1-_pu3n.js +3 -0
  149. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0a7djvw._.js +3 -0
  150. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0bmro0b._.js +3 -0
  151. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0d1lmiq._.js +5 -5
  152. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0keu6we._.js +1 -1
  153. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0t4qmv-._.js +3 -0
  154. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0xh14bo._.js +3 -0
  155. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1-9g0ae._.js +1 -1
  156. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__13ioh5z._.js +3 -0
  157. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__1k8g143._.js → [root-of-the-server]__19pc87s._.js} +2 -2
  158. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1h4xycg._.js +3 -0
  159. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1hqla7-._.js +1 -1
  160. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1md9kdw._.js +3 -0
  161. package/runtime/hub/apps/hub/.next/server/chunks/_0760z6y._.js +4 -4
  162. package/runtime/hub/apps/hub/.next/server/chunks/_1bng7w9._.js +3 -0
  163. package/runtime/hub/apps/hub/.next/server/chunks/apps_hub_app_(dashboard)_api_v1_lib_openapi_ts_1yokmzt._.js +14 -0
  164. package/runtime/hub/apps/hub/.next/server/chunks/ssr/044u_hub__next-internal_server_app_(dashboard)_projects_[id]_page_actions_15f56np.js +1 -1
  165. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_0xy-j7z._.js +1 -1
  166. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_1uccfbf._.js +1 -1
  167. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_010858m.js +1 -1
  168. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_04zwxnx.js +1 -1
  169. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_06exuc7.js +1 -1
  170. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_0f2ldrt.js +1 -1
  171. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_0f2tzep.js +1 -1
  172. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_116nh32.js +1 -1
  173. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_11dyjcb.js +1 -1
  174. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_1_4knli.js +1 -1
  175. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__08-1wwu._.js +1 -1
  176. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__0c9mbcn._.js +1 -1
  177. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__0gdfxj4._.js +1 -1
  178. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__0kc-hwp._.js +1 -1
  179. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__0lu73p6._.js +1 -1
  180. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__10bfmwi._.js +1 -1
  181. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__18qvdzb._.js +1 -1
  182. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__1l2urlw._.js +1 -1
  183. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_03s-ah2._.js +3 -0
  184. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0kpdmm-._.js +1 -1
  185. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0ozyjt1._.js +1 -1
  186. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0r4px38._.js +3 -0
  187. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_18w2zeh._.js +3 -0
  188. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_0od97-d._.js +3 -0
  189. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub__next-internal_server_app_(dashboard)_approvals_page_actions_1mi0bpn.js +1 -1
  190. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub__next-internal_server_app_(dashboard)_boxes_[id]_page_actions_0k7kgn2.js +1 -1
  191. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub__next-internal_server_app_(dashboard)_page_actions_1t3u0xy.js +1 -1
  192. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_app_(dashboard)_boxes_[id]_page_tsx_1-j_972._.js +1 -1
  193. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_app_(dashboard)_boxes_components_box-table_tsx_0a9pyn_._.js +1 -1
  194. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_app_(dashboard)_settings_page_tsx_0hv6n82._.js +3 -0
  195. package/runtime/hub/apps/hub/.next/server/functions-config-manifest.json +3 -0
  196. package/runtime/hub/apps/hub/.next/server/middleware-build-manifest.js +3 -3
  197. package/runtime/hub/apps/hub/.next/server/pages/500.html +1 -1
  198. package/runtime/hub/apps/hub/.next/server/server-reference-manifest.js +1 -1
  199. package/runtime/hub/apps/hub/.next/server/server-reference-manifest.json +18 -18
  200. package/runtime/hub/apps/hub/.next/static/chunks/070w7h5rh5ja6.js +1 -0
  201. package/runtime/hub/apps/hub/.next/static/chunks/1_ur0im1g7_s9.js +1 -0
  202. package/runtime/hub/apps/hub/.next/static/chunks/{000a1sa7te1h8.js → 2awpm9w8crker.js} +1 -1
  203. package/runtime/hub/apps/hub/.next/static/chunks/{3-zanu4ioia5i.js → 2gfw8-qyx5xi_.js} +1 -1
  204. package/runtime/hub/apps/hub/.next/static/chunks/30de2x24ntwkg.js +1 -0
  205. package/runtime/hub/apps/hub/.next/static/chunks/3e5n630psqst8.js +1 -0
  206. package/runtime/hub/apps/hub/.next/static/chunks/3tqnniym2yvpb.js +1 -0
  207. package/runtime/hub/apps/hub/.next/static/chunks/{3dfjrxx-dy644.css → 42uysd_max-yq.css} +1 -1
  208. package/runtime/hub/apps/hub/{chunk-BARD2DI6.js → chunk-EHBJKZCL.js} +13 -8
  209. package/runtime/hub/apps/hub/{chunk-4QY2VZCF.js → chunk-RXYOWSSN.js} +19 -13
  210. package/runtime/hub/apps/hub/{chunk-XZZXPEVV.js → chunk-YJ5MJOXK.js} +1 -1
  211. package/runtime/hub/apps/hub/{dist-3ENKQN5G.js → dist-3I7KUI6W.js} +3 -3
  212. package/runtime/hub/apps/hub/{dist-WAZKGVYL.js → dist-6FPPUSWZ.js} +2 -2
  213. package/runtime/hub/apps/hub/{dist-NNBELNA7.js → dist-DX6IYMAH.js} +300 -109
  214. package/runtime/hub/apps/hub/{dist-RJJ2SDYO.js → dist-G6TXUSPZ.js} +3 -3
  215. package/runtime/hub/apps/hub/{dist-AE6IV4FV.js → dist-GTVVXCBP.js} +3 -3
  216. package/runtime/hub/apps/hub/{dist-6VGJOQYK.js → dist-JG45OFT2.js} +3 -3
  217. package/runtime/hub/apps/hub/{dist-TU7D6UTB.js → dist-LYDHYTP2.js} +3 -3
  218. package/runtime/hub/apps/hub/{prepared-state-75DIZ55S-NYEDSU2U.js → prepared-state-75DIZ55S-2IFNUHHM.js} +1 -1
  219. package/runtime/hub/apps/hub/server.js +136 -19
  220. package/runtime/relay/bin.cjs +0 -0
  221. package/runtime/vercel/agentbox-checkpoint-cleanup +0 -0
  222. package/runtime/vercel/agentbox-dockerd-start +0 -0
  223. package/runtime/vercel/agentbox-open +0 -0
  224. package/runtime/vercel/agentbox-vnc-start +0 -0
  225. package/runtime/vercel/ctl.cjs +0 -0
  226. package/runtime/vercel/gh-shim +0 -0
  227. package/runtime/vercel/git-shim +0 -0
  228. package/runtime/vercel/linear-shim +0 -0
  229. package/runtime/vercel/ntn-shim +0 -0
  230. package/runtime/vercel/scripts/provision.sh +0 -0
  231. package/LICENSE +0 -21
  232. package/dist/chunk-DJQMK4RN.js.map +0 -1
  233. package/dist/chunk-PK2QF4IR.js.map +0 -1
  234. package/dist/chunk-ZYKNSHOH.js +0 -259
  235. package/dist/chunk-ZYKNSHOH.js.map +0 -1
  236. package/dist/dist-YA7EXBGG.js.map +0 -1
  237. package/runtime/hub/apps/hub/.next/server/chunks/0-fj_better-auth_dist_adapters_kysely-adapter_index_mjs_0btft52._.js +0 -3
  238. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1bqbkd5._.js +0 -14
  239. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1qa4a0v._.js +0 -14
  240. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_09gdzmo._.js +0 -3
  241. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0tgpglr._.js +0 -3
  242. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_1laion6._.js +0 -3
  243. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_0b_hsjl._.js +0 -3
  244. package/runtime/hub/apps/hub/.next/static/chunks/1c5w3kqosumog.js +0 -1
  245. package/runtime/hub/apps/hub/.next/static/chunks/1o3ot_9-8jgzc.js +0 -1
  246. package/runtime/hub/apps/hub/.next/static/chunks/1z4elhg8gyq98.js +0 -1
  247. package/runtime/hub/apps/hub/.next/static/chunks/3uq9hf-roasav.js +0 -1
  248. /package/dist/{_cloud-attach-7WRQH6XZ.js.map → _cloud-attach-WDGM6FL5.js.map} +0 -0
  249. /package/dist/{chunk-UIFL7F2G.js.map → chunk-26IKZRTT.js.map} +0 -0
  250. /package/dist/{chunk-K5KOLYIL.js.map → chunk-IDH5A4RR.js.map} +0 -0
  251. /package/dist/{chunk-ZY7M7MXH.js.map → chunk-JE6UI5YR.js.map} +0 -0
  252. /package/dist/{chunk-7ZZAZPYX.js.map → chunk-KWOEUFVA.js.map} +0 -0
  253. /package/dist/{chunk-BA2VLJVU.js.map → chunk-LL7NCMUU.js.map} +0 -0
  254. /package/dist/{chunk-DQHMDDAT.js.map → chunk-V5XXJH63.js.map} +0 -0
  255. /package/dist/{dist-DTNYMBQ5.js.map → dist-FTKS2GI4.js.map} +0 -0
  256. /package/dist/{dist-AR5CHRSV.js.map → dist-O3LKOIE7.js.map} +0 -0
  257. /package/dist/{dist-POVRY7HO.js.map → dist-OO52HARR.js.map} +0 -0
  258. /package/dist/{dist-K4LNH3EC.js.map → dist-TSFVB7AI.js.map} +0 -0
  259. /package/dist/{dist-XYY6SIKG.js.map → dist-WVYAURMF.js.map} +0 -0
  260. /package/dist/{prepared-state-75DIZ55S-W6NU3S3B.js.map → dist-Z6L5MM5D.js.map} +0 -0
  261. /package/runtime/hub/apps/hub/.next/static/{mJYh9UHTsLaGGyRjBSvme → PWF2iHQOg9-rRyfqVDLrh}/_buildManifest.js +0 -0
  262. /package/runtime/hub/apps/hub/.next/static/{mJYh9UHTsLaGGyRjBSvme → PWF2iHQOg9-rRyfqVDLrh}/_clientMiddlewareManifest.js +0 -0
  263. /package/runtime/hub/apps/hub/.next/static/{mJYh9UHTsLaGGyRjBSvme → PWF2iHQOg9-rRyfqVDLrh}/_ssgManifest.js +0 -0
@@ -1,259 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- quoteShellArg,
4
- quoteShellArgv
5
- } from "./chunk-DJQMK4RN.js";
6
- import {
7
- SshTunnelManager,
8
- readCliStamp,
9
- readPreparedStateRaw,
10
- sshDestination,
11
- sshExec,
12
- sshOptArgs,
13
- writePreparedStateRaw
14
- } from "./chunk-PK2QF4IR.js";
15
-
16
- // ../../packages/sandbox-remote-docker/dist/chunk-KUTRXVTK.js
17
- import { execa } from "execa";
18
- function containerNameFor(boxName) {
19
- return `agentbox-${boxName}`;
20
- }
21
- function parseRemoteTarget(spec) {
22
- const raw = spec.trim();
23
- if (raw.length === 0) {
24
- throw new Error("remote-docker: empty SSH destination");
25
- }
26
- if (raw.includes("/")) {
27
- throw new Error(
28
- `remote-docker: invalid SSH destination "${raw}" \u2014 "/" separates the destination from the container in a sandbox id`
29
- );
30
- }
31
- const at = raw.lastIndexOf("@");
32
- const user = at >= 0 ? raw.slice(0, at) : void 0;
33
- const hostPort = at >= 0 ? raw.slice(at + 1) : raw;
34
- if (hostPort.length === 0 || user !== void 0 && user.length === 0) {
35
- throw new Error(`remote-docker: invalid SSH destination "${raw}"`);
36
- }
37
- const bracketed = /^\[(.+)\](?::(\d+))?$/.exec(hostPort);
38
- if (bracketed?.[1]) {
39
- const host = bracketed[1];
40
- if (bracketed[2] === void 0) return { host, user, spec: raw };
41
- return { host, user, port: checkedPort(bracketed[2], raw), spec: raw };
42
- }
43
- if (hostPort.includes(":")) {
44
- const colon = hostPort.lastIndexOf(":");
45
- const head = hostPort.slice(0, colon);
46
- const tail = hostPort.slice(colon + 1);
47
- if (!head.includes(":") && /^\d+$/.test(tail)) {
48
- return { host: head, user, port: checkedPort(tail, raw), spec: raw };
49
- }
50
- }
51
- return { host: hostPort, user, spec: raw };
52
- }
53
- function checkedPort(digits, raw) {
54
- const port = Number.parseInt(digits, 10);
55
- if (port <= 0 || port > 65535) {
56
- throw new Error(`remote-docker: invalid SSH port in "${raw}"`);
57
- }
58
- return port;
59
- }
60
- function makeSandboxId(targetSpec, container) {
61
- parseRemoteTarget(targetSpec);
62
- return `${targetSpec}/${container}`;
63
- }
64
- function parseSandboxId(sandboxId) {
65
- const slash = sandboxId.lastIndexOf("/");
66
- if (slash <= 0 || slash === sandboxId.length - 1) {
67
- throw new Error(
68
- `remote-docker: malformed sandbox id "${sandboxId}" \u2014 expected "<ssh-destination>/<container>"`
69
- );
70
- }
71
- return {
72
- target: parseRemoteTarget(sandboxId.slice(0, slash)),
73
- container: sandboxId.slice(slash + 1)
74
- };
75
- }
76
- function sshTargetFor(target, controlPath) {
77
- return {
78
- host: target.host,
79
- ...target.user !== void 0 ? { user: target.user } : {},
80
- ...target.port !== void 0 ? { port: target.port } : {},
81
- ...controlPath !== void 0 ? { controlPath } : {}
82
- };
83
- }
84
- var tunnels = new SshTunnelManager("remote-docker");
85
- async function ensureTunnel(sandboxId, target) {
86
- if (!tunnels.has(sandboxId)) {
87
- try {
88
- await tunnels.open({
89
- boxId: sandboxId,
90
- vpsHost: target.host,
91
- ...target.user !== void 0 ? { vpsUser: target.user } : {},
92
- ...target.port !== void 0 ? { port: target.port } : {}
93
- });
94
- } catch (err) {
95
- const msg = err instanceof Error ? err.message : String(err);
96
- throw new Error(
97
- `remote-docker: cannot SSH to "${target.spec}". Check that \`ssh ${target.spec} true\` works from this machine (the provider uses your own ~/.ssh/config, agent and known_hosts \u2014 it mints no keys).
98
- ${msg}`
99
- );
100
- }
101
- }
102
- const controlPath = tunnels.controlPath(sandboxId);
103
- return sshTargetFor(target, controlPath);
104
- }
105
- async function refreshTunnel(sandboxId, target) {
106
- await tunnels.refresh({
107
- boxId: sandboxId,
108
- vpsHost: target.host,
109
- ...target.user !== void 0 ? { vpsUser: target.user } : {},
110
- ...target.port !== void 0 ? { port: target.port } : {}
111
- });
112
- }
113
- async function dockerOnRemote(target, argv, opts = {}) {
114
- return sshExec(target, loginShell(`docker ${quoteShellArgv(argv)}`), {
115
- ...opts.timeoutMs !== void 0 ? { timeoutMs: opts.timeoutMs } : {},
116
- ...opts.onLine !== void 0 ? { onLine: opts.onLine } : {}
117
- });
118
- }
119
- async function dockerOnRemoteOrThrow(target, argv, opts = {}) {
120
- const res = await dockerOnRemote(target, argv, opts);
121
- if (res.exitCode !== 0) {
122
- throw new Error(
123
- `remote-docker: \`docker ${argv.join(" ")}\` failed (exit ${String(res.exitCode)}): ${res.stderr.trim() || res.stdout.trim() || "(no output)"}`
124
- );
125
- }
126
- return res.stdout;
127
- }
128
- function dockerExecArgv(container, command, opts = {}) {
129
- const argv = ["exec"];
130
- if (opts.interactive) argv.push("-i");
131
- if (opts.user) argv.push("-u", opts.user);
132
- if (opts.cwd) argv.push("-w", opts.cwd);
133
- for (const [k, v] of Object.entries(opts.env ?? {})) {
134
- argv.push("-e", `${k}=${v}`);
135
- }
136
- argv.push(container, "bash", "-lc", command);
137
- return argv;
138
- }
139
- var CONTAINER_USER = "vscode";
140
- async function pipeFileIntoContainer(target, container, input, remotePath) {
141
- const remote = loginShell(
142
- `docker ${quoteShellArgv(["exec", "-i", "-u", CONTAINER_USER, container, "sh", "-c", `cat > ${quoteShellArg(remotePath)}`])}`
143
- );
144
- const res = await execa("ssh", [...sshOptArgs(target), sshDestination(target), remote], {
145
- reject: false,
146
- input
147
- });
148
- if (res.exitCode !== 0) {
149
- throw new Error(
150
- `remote-docker: upload to ${container}:${remotePath} failed (exit ${String(res.exitCode)}): ${typeof res.stderr === "string" ? res.stderr : ""}`
151
- );
152
- }
153
- }
154
- async function pipeFileFromContainer(target, container, remotePath, output) {
155
- const remote = loginShell(
156
- `docker ${quoteShellArgv(["exec", "-u", CONTAINER_USER, container, "cat", remotePath])}`
157
- );
158
- const child = execa("ssh", [...sshOptArgs(target), sshDestination(target), remote], {
159
- reject: false,
160
- stdout: "pipe",
161
- stderr: "pipe"
162
- });
163
- child.stdout?.pipe(output);
164
- const res = await child;
165
- if (res.exitCode !== 0) {
166
- throw new Error(
167
- `remote-docker: download of ${container}:${remotePath} failed (exit ${String(res.exitCode)}): ${typeof res.stderr === "string" ? res.stderr : ""}`
168
- );
169
- }
170
- }
171
- function loginShell(command) {
172
- return `bash -lc ${quoteShellArg(command)}`;
173
- }
174
- async function probeRemoteEngine(spec) {
175
- let target;
176
- try {
177
- target = sshTargetFor(parseRemoteTarget(spec));
178
- } catch (err) {
179
- return { ok: false, error: err instanceof Error ? err.message : String(err) };
180
- }
181
- const reach = await sshExec({ ...target, options: { ConnectTimeout: "10" } }, "true", {
182
- timeoutMs: 2e4
183
- });
184
- if (reach.exitCode !== 0) {
185
- return {
186
- ok: false,
187
- error: `cannot SSH to ${spec}: ${reach.stderr.trim() || `exit ${String(reach.exitCode)}`}`
188
- };
189
- }
190
- const res = await dockerOnRemote(
191
- target,
192
- ["version", "--format", "{{.Server.Version}}|{{.Server.Arch}}|{{.Server.Os}}"],
193
- {
194
- timeoutMs: 3e4
195
- }
196
- );
197
- if (res.exitCode !== 0) {
198
- const err = res.stderr.trim() || res.stdout.trim();
199
- if (/command not found|not found/i.test(err)) {
200
- return {
201
- ok: false,
202
- error: `\`docker\` is not on ${spec}'s login-shell PATH (${err}). Install Docker there, or add it to the remote user's profile.`
203
- };
204
- }
205
- return { ok: false, error: `docker on ${spec} is not answering: ${err}` };
206
- }
207
- const [version = "", arch = "", os = ""] = res.stdout.trim().split("|");
208
- return { ok: true, version, arch, os };
209
- }
210
- var SCHEMA = 1;
211
- var PROVIDER = "remote-docker";
212
- function readPreparedState() {
213
- const raw = readPreparedStateRaw(PROVIDER);
214
- if (raw === null || typeof raw !== "object") return null;
215
- const parsed = raw;
216
- if (parsed.schema !== SCHEMA || typeof parsed.hosts !== "object" || parsed.hosts === null) {
217
- return null;
218
- }
219
- return { schema: SCHEMA, hosts: parsed.hosts };
220
- }
221
- function recordPreparedHost(host, fields) {
222
- const stamp = readCliStamp();
223
- const existing = readPreparedState();
224
- const next = {
225
- schema: SCHEMA,
226
- hosts: {
227
- ...existing?.hosts ?? {},
228
- [host]: {
229
- imageRef: fields.imageRef,
230
- contextSha256: fields.contextSha256,
231
- ...stamp.cliVersion ? { cliVersion: stamp.cliVersion } : {},
232
- ...stamp.cliCommit ? { cliCommit: stamp.cliCommit } : {},
233
- createdAt: (/* @__PURE__ */ new Date()).toISOString()
234
- }
235
- }
236
- };
237
- writePreparedStateRaw(PROVIDER, next);
238
- }
239
-
240
- export {
241
- containerNameFor,
242
- parseRemoteTarget,
243
- makeSandboxId,
244
- parseSandboxId,
245
- tunnels,
246
- ensureTunnel,
247
- refreshTunnel,
248
- dockerOnRemote,
249
- dockerOnRemoteOrThrow,
250
- dockerExecArgv,
251
- CONTAINER_USER,
252
- pipeFileIntoContainer,
253
- pipeFileFromContainer,
254
- loginShell,
255
- probeRemoteEngine,
256
- readPreparedState,
257
- recordPreparedHost
258
- };
259
- //# sourceMappingURL=chunk-ZYKNSHOH.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../packages/sandbox-remote-docker/src/target.ts","../../../packages/sandbox-remote-docker/src/remote-docker.ts","../../../packages/sandbox-remote-docker/src/prepared-state.ts"],"sourcesContent":["/**\n * The remote-docker addressing model.\n *\n * A box lives on *some* remote engine, and the code that has to reach it is not\n * always the code that created it: the host relay resolves a backend from a\n * bare `CloudHandle` (`{ sandboxId }`) with no access to the box record or the\n * user's config. So the SSH destination is encoded INTO the sandbox id:\n *\n * sandboxId = \"<ssh-destination>/<container-name>\"\n * e.g. \"buildbox/agentbox-brave-otter\"\n * \"dev@10.0.0.9:2222/agentbox-brave-otter\"\n *\n * That makes the handle self-describing and multi-host support fall out for\n * free — no host-side registry to keep in sync, and a box keeps working after\n * `box.remoteDockerHost` changes.\n *\n * An SSH destination is anything OpenSSH accepts: an `~/.ssh/config` alias\n * (`buildbox`), or `[user@]host[:port]`. We deliberately do NOT parse it into\n * our own notion of identity/port beyond the `:port` suffix — the user's\n * `~/.ssh/config` is the source of truth for keys, ports and usernames, and\n * re-deriving them here would only let us contradict it.\n */\n\nimport type { SshTargetArgs } from '@agentbox/sandbox-core';\n\n/** A parsed SSH destination. `user` / `port` are absent unless spelled out. */\nexport interface RemoteTarget {\n /** Host, IP, or `~/.ssh/config` alias. */\n host: string;\n user?: string;\n port?: number;\n /** The destination as the user wrote it — the canonical id-carrying form. */\n spec: string;\n}\n\n/** Container names are `agentbox-<box-name>`, matching the docker provider. */\nexport function containerNameFor(boxName: string): string {\n return `agentbox-${boxName}`;\n}\n\n/**\n * Parse `[user@]host[:port]` (or a bare ssh alias). Throws on an empty or\n * malformed destination — a bad host is worth failing loudly on, since every\n * later error would be an opaque ssh failure.\n */\nexport function parseRemoteTarget(spec: string): RemoteTarget {\n const raw = spec.trim();\n if (raw.length === 0) {\n throw new Error('remote-docker: empty SSH destination');\n }\n if (raw.includes('/')) {\n throw new Error(\n `remote-docker: invalid SSH destination \"${raw}\" — \"/\" separates the destination from the container in a sandbox id`,\n );\n }\n const at = raw.lastIndexOf('@');\n const user = at >= 0 ? raw.slice(0, at) : undefined;\n const hostPort = at >= 0 ? raw.slice(at + 1) : raw;\n if (hostPort.length === 0 || (user !== undefined && user.length === 0)) {\n throw new Error(`remote-docker: invalid SSH destination \"${raw}\"`);\n }\n\n // A bracketed IPv6 literal is the only form that can carry a port:\n // `[fe80::1]:2222`. Bare `fe80::1` is all host — its final `:1` is an address\n // group, not a port, and reading it as one would silently connect to :1.\n const bracketed = /^\\[(.+)\\](?::(\\d+))?$/.exec(hostPort);\n if (bracketed?.[1]) {\n const host = bracketed[1];\n if (bracketed[2] === undefined) return { host, user, spec: raw };\n return { host, user, port: checkedPort(bracketed[2], raw), spec: raw };\n }\n if (hostPort.includes(':')) {\n const colon = hostPort.lastIndexOf(':');\n const head = hostPort.slice(0, colon);\n const tail = hostPort.slice(colon + 1);\n // More than one colon ⇒ an unbracketed IPv6 literal ⇒ no port.\n if (!head.includes(':') && /^\\d+$/.test(tail)) {\n return { host: head, user, port: checkedPort(tail, raw), spec: raw };\n }\n }\n return { host: hostPort, user, spec: raw };\n}\n\nfunction checkedPort(digits: string, raw: string): number {\n const port = Number.parseInt(digits, 10);\n if (port <= 0 || port > 65535) {\n throw new Error(`remote-docker: invalid SSH port in \"${raw}\"`);\n }\n return port;\n}\n\n/** `<ssh-destination>/<container>` — the persisted sandbox id. */\nexport function makeSandboxId(targetSpec: string, container: string): string {\n // Validate the destination now so a malformed one can't be persisted.\n parseRemoteTarget(targetSpec);\n return `${targetSpec}/${container}`;\n}\n\nexport interface ParsedSandboxId {\n target: RemoteTarget;\n container: string;\n}\n\n/** Split a sandbox id back into its SSH destination and container name. */\nexport function parseSandboxId(sandboxId: string): ParsedSandboxId {\n const slash = sandboxId.lastIndexOf('/');\n if (slash <= 0 || slash === sandboxId.length - 1) {\n throw new Error(\n `remote-docker: malformed sandbox id \"${sandboxId}\" — expected \"<ssh-destination>/<container>\"`,\n );\n }\n return {\n target: parseRemoteTarget(sandboxId.slice(0, slash)),\n container: sandboxId.slice(slash + 1),\n };\n}\n\n/**\n * The `SshTargetArgs` for a destination. No `identity` and no `knownHosts`:\n * both come from the user's `~/.ssh/config` / agent / `~/.ssh/known_hosts`,\n * which is the whole point of pointing at a machine you already reach.\n */\nexport function sshTargetFor(target: RemoteTarget, controlPath?: string): SshTargetArgs {\n return {\n host: target.host,\n ...(target.user !== undefined ? { user: target.user } : {}),\n ...(target.port !== undefined ? { port: target.port } : {}),\n ...(controlPath !== undefined ? { controlPath } : {}),\n };\n}\n","/**\n * The single chokepoint through which every `docker` command reaches the remote\n * engine: one persistent SSH ControlMaster per box, `docker …` run inside a\n * remote LOGIN shell.\n *\n * Why not `DOCKER_HOST=ssh://user@host`? Two reasons, both fatal in practice:\n *\n * 1. Docker's ssh transport runs `docker system dial-stdio` on the remote,\n * which needs `docker` on the NON-login-shell PATH. That is exactly where\n * OrbStack (`~/.orbstack/bin`) and Colima break, so a Mac remote — a case\n * we explicitly support — would fail with an opaque \"command not found\".\n * A login shell (`bash -lc`) sources the profile and finds them.\n * 2. It opens a fresh SSH connection per `docker` invocation. Create issues\n * dozens; the ControlMaster amortizes the handshake to ~nothing.\n *\n * The trade is that we compose docker's argv into a shell string ourselves, so\n * every argument must be quoted — `quoteShellArgv` from @agentbox/sandbox-cloud\n * does that, and nothing in this package may build a remote command by\n * concatenation.\n */\n\nimport { execa } from 'execa';\nimport type { Readable, Writable } from 'node:stream';\nimport { quoteShellArg, quoteShellArgv } from '@agentbox/sandbox-cloud';\nimport {\n SshTunnelManager,\n sshDestination,\n sshExec,\n sshOptArgs,\n type SshTargetArgs,\n} from '@agentbox/sandbox-core';\nimport { parseRemoteTarget, sshTargetFor, type RemoteTarget } from './target.js';\n\n/** One ControlMaster per box, namespaced so ids can't collide with a VPS provider's. */\nexport const tunnels = new SshTunnelManager('remote-docker');\n\nexport interface RemoteExecResult {\n exitCode: number;\n stdout: string;\n stderr: string;\n}\n\n/**\n * Open (or reuse) the ControlMaster for a box and return an ssh target bound to\n * it. Every exec/upload/download/forward for that box rides this one connection.\n */\nexport async function ensureTunnel(\n sandboxId: string,\n target: RemoteTarget,\n): Promise<SshTargetArgs> {\n if (!tunnels.has(sandboxId)) {\n try {\n await tunnels.open({\n boxId: sandboxId,\n vpsHost: target.host,\n ...(target.user !== undefined ? { vpsUser: target.user } : {}),\n ...(target.port !== undefined ? { port: target.port } : {}),\n });\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n throw new Error(\n `remote-docker: cannot SSH to \"${target.spec}\". Check that \\`ssh ${target.spec} true\\` works from this machine ` +\n `(the provider uses your own ~/.ssh/config, agent and known_hosts — it mints no keys).\\n${msg}`,\n );\n }\n }\n const controlPath = tunnels.controlPath(sandboxId);\n return sshTargetFor(target, controlPath);\n}\n\n/** Re-open a dead master (host sleep/wake, network blip) and drop stale forwards. */\nexport async function refreshTunnel(sandboxId: string, target: RemoteTarget): Promise<void> {\n await tunnels.refresh({\n boxId: sandboxId,\n vpsHost: target.host,\n ...(target.user !== undefined ? { vpsUser: target.user } : {}),\n ...(target.port !== undefined ? { port: target.port } : {}),\n });\n}\n\n/**\n * Run `docker <argv…>` on the remote engine. `argv` is quoted, so callers pass\n * a plain array and never think about the shell.\n */\nexport async function dockerOnRemote(\n target: SshTargetArgs,\n argv: string[],\n opts: { timeoutMs?: number; onLine?: (line: string) => void } = {},\n): Promise<RemoteExecResult> {\n return sshExec(target, loginShell(`docker ${quoteShellArgv(argv)}`), {\n ...(opts.timeoutMs !== undefined ? { timeoutMs: opts.timeoutMs } : {}),\n ...(opts.onLine !== undefined ? { onLine: opts.onLine } : {}),\n });\n}\n\n/** Same, but throws with the remote's stderr on a non-zero exit. */\nexport async function dockerOnRemoteOrThrow(\n target: SshTargetArgs,\n argv: string[],\n opts: { timeoutMs?: number; onLine?: (line: string) => void } = {},\n): Promise<string> {\n const res = await dockerOnRemote(target, argv, opts);\n if (res.exitCode !== 0) {\n throw new Error(\n `remote-docker: \\`docker ${argv.join(' ')}\\` failed (exit ${String(res.exitCode)}): ${\n res.stderr.trim() || res.stdout.trim() || '(no output)'\n }`,\n );\n }\n return res.stdout;\n}\n\n/**\n * Run a command INSIDE the box's container: `docker exec … bash -lc '<cmd>'`.\n * This is what `CloudBackend.exec` is built on, so it carries the same\n * semantics the cloud scaffold expects (login shell, so `/etc/profile.d`\n * exports are visible).\n */\nexport function dockerExecArgv(\n container: string,\n command: string,\n opts: { user?: string; cwd?: string; env?: Record<string, string>; interactive?: boolean } = {},\n): string[] {\n const argv = ['exec'];\n if (opts.interactive) argv.push('-i');\n if (opts.user) argv.push('-u', opts.user);\n if (opts.cwd) argv.push('-w', opts.cwd);\n for (const [k, v] of Object.entries(opts.env ?? {})) {\n argv.push('-e', `${k}=${v}`);\n }\n argv.push(container, 'bash', '-lc', command);\n return argv;\n}\n\n/**\n * The user every exec and every file transfer runs as. It must be ONE user:\n * a file written as root that `exec` (as vscode) later has to delete leaves the\n * box wedged — and on a nested engine, where the container init is forced to\n * uid 0, `docker exec` with no `-u` would default to root and do exactly that.\n * So both sides name the user explicitly rather than inheriting the container's.\n */\nexport const CONTAINER_USER = 'vscode';\n\n/**\n * Stream a local file into a file inside the container, over the ControlMaster.\n *\n * Not `docker cp`: that would need the bytes staged on the remote host first\n * (an extra hop and a temp file to clean up). Piping into `cat` inside the\n * container is one hop, binary-safe, and leaves nothing behind. `execa` is\n * driven directly here because the transfer needs a stdin stream, which the\n * text-in/text-out `sshExec` deliberately doesn't model.\n */\nexport async function pipeFileIntoContainer(\n target: SshTargetArgs,\n container: string,\n input: Readable,\n remotePath: string,\n): Promise<void> {\n const remote = loginShell(\n `docker ${quoteShellArgv(['exec', '-i', '-u', CONTAINER_USER, container, 'sh', '-c', `cat > ${quoteShellArg(remotePath)}`])}`,\n );\n const res = await execa('ssh', [...sshOptArgs(target), sshDestination(target), remote], {\n reject: false,\n input,\n });\n if (res.exitCode !== 0) {\n throw new Error(\n `remote-docker: upload to ${container}:${remotePath} failed (exit ${String(res.exitCode)}): ${\n typeof res.stderr === 'string' ? res.stderr : ''\n }`,\n );\n }\n}\n\n/** Stream a file out of the container into a local writable stream. */\nexport async function pipeFileFromContainer(\n target: SshTargetArgs,\n container: string,\n remotePath: string,\n output: Writable,\n): Promise<void> {\n const remote = loginShell(\n `docker ${quoteShellArgv(['exec', '-u', CONTAINER_USER, container, 'cat', remotePath])}`,\n );\n const child = execa('ssh', [...sshOptArgs(target), sshDestination(target), remote], {\n reject: false,\n stdout: 'pipe',\n stderr: 'pipe',\n });\n child.stdout?.pipe(output);\n const res = await child;\n if (res.exitCode !== 0) {\n throw new Error(\n `remote-docker: download of ${container}:${remotePath} failed (exit ${String(res.exitCode)}): ${\n typeof res.stderr === 'string' ? res.stderr : ''\n }`,\n );\n }\n}\n\n/**\n * `bash -lc '<cmd>'` — a LOGIN shell, so the remote user's profile is sourced\n * and `docker` is found wherever their engine put it (Docker Desktop in\n * /usr/local/bin, OrbStack in ~/.orbstack/bin, Linux packages in /usr/bin).\n * This is the single reason a macOS remote works without a PATH config key.\n */\nexport function loginShell(command: string): string {\n return `bash -lc ${quoteShellArg(command)}`;\n}\n\n/**\n * Preflight a destination: SSH reachable, `docker` on the login-shell PATH, and\n * the daemon actually answering. Returns the engine's version + arch for the\n * doctor / `agentbox remote-docker check` output.\n */\nexport async function probeRemoteEngine(\n spec: string,\n): Promise<{ ok: true; version: string; arch: string; os: string } | { ok: false; error: string }> {\n let target: SshTargetArgs;\n try {\n target = sshTargetFor(parseRemoteTarget(spec));\n } catch (err) {\n return { ok: false, error: err instanceof Error ? err.message : String(err) };\n }\n const reach = await sshExec({ ...target, options: { ConnectTimeout: '10' } }, 'true', {\n timeoutMs: 20_000,\n });\n if (reach.exitCode !== 0) {\n return {\n ok: false,\n error: `cannot SSH to ${spec}: ${reach.stderr.trim() || `exit ${String(reach.exitCode)}`}`,\n };\n }\n const res = await dockerOnRemote(\n target,\n ['version', '--format', '{{.Server.Version}}|{{.Server.Arch}}|{{.Server.Os}}'],\n {\n timeoutMs: 30_000,\n },\n );\n if (res.exitCode !== 0) {\n const err = res.stderr.trim() || res.stdout.trim();\n if (/command not found|not found/i.test(err)) {\n return {\n ok: false,\n error: `\\`docker\\` is not on ${spec}'s login-shell PATH (${err}). Install Docker there, or add it to the remote user's profile.`,\n };\n }\n return { ok: false, error: `docker on ${spec} is not answering: ${err}` };\n }\n const [version = '', arch = '', os = ''] = res.stdout.trim().split('|');\n return { ok: true, version, arch, os };\n}\n","/**\n * `~/.agentbox/remote-docker-prepared.json`.\n *\n * Unlike every other cloud provider, this file is NOT load-bearing. The image\n * ref on a remote engine is its build-context fingerprint (`agentbox/box:<sha>`),\n * so \"is this host prepared?\" is answered by asking the engine, not by trusting\n * a local file — and it is answered per host, which a single file could never\n * do. What this records is the *history*: which hosts we have baked, with what,\n * and when, for `agentbox prepare --status` and `doctor` to report.\n */\n\nimport { readPreparedStateRaw, writePreparedStateRaw, readCliStamp } from '@agentbox/sandbox-core';\n\nconst SCHEMA = 1;\nconst PROVIDER = 'remote-docker';\n\nexport interface PreparedRemoteHost {\n imageRef: string;\n contextSha256: string;\n cliVersion?: string;\n cliCommit?: string;\n createdAt: string;\n}\n\nexport interface PreparedRemoteDockerState {\n schema: number;\n /** Keyed by SSH destination, exactly as the user spelled it. */\n hosts: Record<string, PreparedRemoteHost>;\n}\n\nexport function readPreparedState(): PreparedRemoteDockerState | null {\n const raw = readPreparedStateRaw(PROVIDER);\n if (raw === null || typeof raw !== 'object') return null;\n const parsed = raw as Partial<PreparedRemoteDockerState>;\n if (parsed.schema !== SCHEMA || typeof parsed.hosts !== 'object' || parsed.hosts === null) {\n return null;\n }\n return { schema: SCHEMA, hosts: parsed.hosts };\n}\n\nexport function recordPreparedHost(\n host: string,\n fields: { imageRef: string; contextSha256: string },\n): void {\n const stamp = readCliStamp();\n const existing = readPreparedState();\n const next: PreparedRemoteDockerState = {\n schema: SCHEMA,\n hosts: {\n ...(existing?.hosts ?? {}),\n [host]: {\n imageRef: fields.imageRef,\n contextSha256: fields.contextSha256,\n ...(stamp.cliVersion ? { cliVersion: stamp.cliVersion } : {}),\n ...(stamp.cliCommit ? { cliCommit: stamp.cliCommit } : {}),\n createdAt: new Date().toISOString(),\n },\n },\n };\n writePreparedStateRaw(PROVIDER, next);\n}\n"],"mappings":";;;;;;;;;;;;;;;;ACqBA,SAAS,aAAa;ADef,SAAS,iBAAiB,SAAyB;AACxD,SAAO,YAAY,OAAO;AAC5B;AAOO,SAAS,kBAAkB,MAA4B;AAC5D,QAAM,MAAM,KAAK,KAAK;AACtB,MAAI,IAAI,WAAW,GAAG;AACpB,UAAM,IAAI,MAAM,sCAAsC;EACxD;AACA,MAAI,IAAI,SAAS,GAAG,GAAG;AACrB,UAAM,IAAI;MACR,2CAA2C,GAAG;IAChD;EACF;AACA,QAAM,KAAK,IAAI,YAAY,GAAG;AAC9B,QAAM,OAAO,MAAM,IAAI,IAAI,MAAM,GAAG,EAAE,IAAI;AAC1C,QAAM,WAAW,MAAM,IAAI,IAAI,MAAM,KAAK,CAAC,IAAI;AAC/C,MAAI,SAAS,WAAW,KAAM,SAAS,UAAa,KAAK,WAAW,GAAI;AACtE,UAAM,IAAI,MAAM,2CAA2C,GAAG,GAAG;EACnE;AAKA,QAAM,YAAY,wBAAwB,KAAK,QAAQ;AACvD,MAAI,YAAY,CAAC,GAAG;AAClB,UAAM,OAAO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;QACL,IAAI;QACJ,OAAO,wBAAwB,IAAI,wBAAwB,GAAG;MAChE;IACF;AACA,WAAO,EAAE,IAAI,OAAO,OAAO,aAAa,IAAI,sBAAsB,GAAG,GAAG;EAC1E;AACA,QAAM,CAAC,UAAU,IAAI,OAAO,IAAI,KAAK,EAAE,IAAI,IAAI,OAAO,KAAK,EAAE,MAAM,GAAG;AACtE,SAAO,EAAE,IAAI,MAAM,SAAS,MAAM,GAAG;AACvC;AC/OA,IAAM,SAAS;AACf,IAAM,WAAW;AAgBV,SAAS,oBAAsD;AACpE,QAAM,MAAM,qBAAqB,QAAQ;AACzC,MAAI,QAAQ,QAAQ,OAAO,QAAQ,SAAU,QAAO;AACpD,QAAM,SAAS;AACf,MAAI,OAAO,WAAW,UAAU,OAAO,OAAO,UAAU,YAAY,OAAO,UAAU,MAAM;AACzF,WAAO;EACT;AACA,SAAO,EAAE,QAAQ,QAAQ,OAAO,OAAO,MAAM;AAC/C;AAEO,SAAS,mBACd,MACA,QACM;AACN,QAAM,QAAQ,aAAa;AAC3B,QAAM,WAAW,kBAAkB;AACnC,QAAM,OAAkC;IACtC,QAAQ;IACR,OAAO;MACL,GAAI,UAAU,SAAS,CAAC;MACxB,CAAC,IAAI,GAAG;QACN,UAAU,OAAO;QACjB,eAAe,OAAO;QACtB,GAAI,MAAM,aAAa,EAAE,YAAY,MAAM,WAAW,IAAI,CAAC;QAC3D,GAAI,MAAM,YAAY,EAAE,WAAW,MAAM,UAAU,IAAI,CAAC;QACxD,YAAW,oBAAI,KAAK,GAAE,YAAY;MACpC;IACF;EACF;AACA,wBAAsB,UAAU,IAAI;AACtC;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../packages/sandbox-remote-docker/src/index.ts","../../../packages/sandbox-remote-docker/src/backend.ts","../../../packages/sandbox-remote-docker/src/image.ts","../../../packages/sandbox-remote-docker/src/build-attach.ts","../../../packages/sandbox-remote-docker/src/box-ssh.ts","../../../packages/sandbox-remote-docker/src/prepare.ts","../../../packages/sandbox-remote-docker/src/provider-module.ts"],"sourcesContent":["/**\n * The remote-docker provider: `createCloudProvider(remoteDockerBackend)` plus\n * the four things the scaffold can't supply.\n *\n * - `buildAttach` — the scaffold's SSH attach lands on the machine, not in\n * the container; ours wraps the inner command in a `docker exec`.\n * - `checkpoint` — `docker commit` on the engine that runs the box, with the\n * host carried in the snapshot name (see `parseSnapshotName`).\n * - `prepare` — bake the box image on a remote engine.\n * - `baseFingerprint` — the docker build-context sha, so the CLI's\n * \"your base is stale\" nag works the same way it does locally.\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 { hashProjectPath, sanitizeMnemonic } from '@agentbox/config';\nimport { readCliStamp, type ProviderModule } from '@agentbox/sandbox-core';\nimport { basename } from 'node:path';\nimport { BACKEND_NAME, makeSnapshotName, remoteDockerBackend } from './backend.js';\nimport { buildRemoteDockerAttach } from './build-attach.js';\nimport { resolveBoxSshTarget } from './box-ssh.js';\nimport { currentContextSha } from './image.js';\nimport { prepareRemoteDocker } from './prepare.js';\nimport { parseSandboxId } from './target.js';\nimport { doctorChecks } from './provider-module.js';\n\nconst cloudProvider = createCloudProvider(remoteDockerBackend, {\n // Empty on purpose. The cloud default (2 cpu / 4 GB) would silently cap a box\n // on a 32-core workstation; a remote engine is the user's own machine, so a\n // box is unlimited unless `--size` says otherwise — the same deal the local\n // docker provider offers.\n defaultResources: {},\n launchDockerd: true,\n});\n\n/** The docker image a checkpoint commits to on the remote engine. */\nfunction checkpointImageRef(projectRoot: string, name: string): string {\n const mnemonic = sanitizeMnemonic(basename(projectRoot));\n return `agentbox-ckpt-${hashProjectPath(projectRoot)}_${mnemonic}:${name}`;\n}\n\nconst remoteDockerCheckpoint: ProviderCheckpoint = {\n async create(box: BoxRecord, name: string) {\n if (!box.projectRoot) {\n throw new Error(\n 'checkpoint requires the box to have a project root (run `agentbox checkpoint` from inside the project)',\n );\n }\n const sandboxId = box.cloud?.sandboxId;\n if (!sandboxId) {\n throw new Error(`remote-docker box ${box.name} has no sandboxId — record is malformed`);\n }\n const { target } = parseSandboxId(sandboxId);\n const snapshotName = makeSnapshotName(target.spec, checkpointImageRef(box.projectRoot, name));\n await remoteDockerBackend.createSnapshot?.({ sandboxId }, snapshotName);\n\n const info = await writeCloudCheckpointManifest(box.projectRoot, BACKEND_NAME, name, {\n snapshotName,\n sourceBoxId: box.id,\n sourceBoxName: box.name,\n baseProvider: BACKEND_NAME,\n baseFingerprint: currentCloudBaseFingerprint(BACKEND_NAME),\n cliVersion: readCliStamp().cliVersion,\n });\n return { ref: info.name };\n },\n\n async list(projectRoot: string) {\n const entries = await listCloudCheckpoints(projectRoot, BACKEND_NAME);\n return entries.map((e) => ({ ref: e.name, createdAt: e.manifest.createdAt }));\n },\n\n async remove(projectRoot: string, ref: string) {\n const entry = await resolveCloudCheckpoint(projectRoot, BACKEND_NAME, ref);\n if (!entry) return;\n await remoteDockerBackend.deleteSnapshot?.(entry.manifest.snapshotName);\n await removeCloudCheckpointDir(projectRoot, BACKEND_NAME, ref);\n },\n};\n\nexport const remoteDockerProvider: Provider = {\n ...cloudProvider,\n buildAttach: buildRemoteDockerAttach,\n // The box's own sshd, reached by jumping through the engine — see box-ssh.ts.\n // Supplying this is what lets `open` / `code` / `connect` treat a remote-docker\n // box like any other SSH-capable box, without the scaffold having to guess a\n // target out of an attach argv that points at the engine rather than the box.\n sshTarget: resolveBoxSshTarget,\n checkpoint: remoteDockerCheckpoint,\n prepare: prepareRemoteDocker,\n baseFingerprint: async (claudeInstall) => (await currentContextSha(claudeInstall)) ?? undefined,\n};\n\n/** Uniform surface the CLI provider loader resolves this package through. */\nexport const providerModule: ProviderModule = {\n provider: remoteDockerProvider,\n backend: remoteDockerBackend,\n currentBaseFingerprintLive: async (claudeInstall) =>\n (await currentContextSha(claudeInstall)) ?? undefined,\n doctorChecks,\n};\n\nexport { remoteDockerBackend, BACKEND_NAME, listOnHost } from './backend.js';\nexport { probeRemoteEngine } from './remote-docker.js';\nexport { parseRemoteTarget, parseSandboxId } from './target.js';\n","/**\n * `remoteDockerBackend` — a `CloudBackend` whose \"sandbox\" is a container on a\n * remote machine's Docker engine, reached over one SSH ControlMaster per box.\n *\n * It is a cloud backend, not a second docker provider, and that is the whole\n * design. The docker provider's core mechanism — bind-mounting the host's\n * `.git/` into the container so in-box commits land in the host repo with zero\n * sync — cannot cross a network. Everything that follows from that (the ctl\n * unix socket on a host path, `-p 127.0.0.1:…` on the *local* loopback,\n * `host.docker.internal` reaching the laptop's relay) is equally local-only.\n *\n * The cloud scaffold already solved all of it: `seedCloudWorkspace` syncs the\n * workspace as a shallow clone + carried-over stash/untracked, the in-box relay\n * on :8788 is long-polled by the host `CloudBoxPoller`, and `git push` travels\n * back as a bundle. So we implement the ~14 `CloudBackend` primitives in terms\n * of `docker` over SSH and inherit the rest.\n *\n * What stays docker-shaped: the image (a real Dockerfile build), checkpoints\n * (`docker commit`), nested containers (DinD, same caps as the local provider),\n * and pause (`docker pause`, a true freeze rather than a snapshot).\n */\n\nimport { createReadStream, createWriteStream } from 'node:fs';\nimport { mkdir } from 'node:fs/promises';\nimport { dirname } from 'node:path';\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 { loadEffectiveConfig } from '@agentbox/config';\nimport { CLOUD_VNC_PORT, CLOUD_WEB_PROXY_PORT, bashScript } from '@agentbox/sandbox-cloud';\nimport { readState, sshExec, type SshTargetArgs } from '@agentbox/sandbox-core';\nimport { ensureRemoteImage } from './image.js';\nimport {\n CONTAINER_USER,\n dockerExecArgv,\n dockerOnRemote,\n dockerOnRemoteOrThrow,\n ensureTunnel,\n pipeFileFromContainer,\n pipeFileIntoContainer,\n refreshTunnel,\n tunnels,\n} from './remote-docker.js';\nimport {\n containerNameFor,\n makeSandboxId,\n parseRemoteTarget,\n parseSandboxId,\n type RemoteTarget,\n} from './target.js';\n\nexport const BACKEND_NAME = 'remote-docker';\n\n/**\n * A checkpoint is a `docker commit` on ONE engine — the image never leaves it —\n * so the snapshot name has to carry the host as well as the image ref:\n *\n * \"<ssh-destination>#<docker-image-ref>\"\n * e.g. \"dev@10.0.0.9:2222#agentbox-ckpt-9f2a_myrepo:setup\"\n *\n * `deleteSnapshot` and `snapshotExists` are handed nothing but this string (no\n * `CloudHandle`), so without the host they could not find the image at all. It\n * cannot go in the docker ref itself: a ref admits neither `@` nor `:` outside\n * the tag, and an ssh destination is full of both. `#` never appears in either\n * half, so it is an unambiguous separator.\n *\n * Nothing outside this package interprets the string — the `CloudBackend`\n * contract treats it as opaque, round-tripping it from `createSnapshot` through\n * the manifest to `provision({ snapshot })`.\n */\nconst SNAPSHOT_SEP = '#';\n\nexport interface ParsedSnapshot {\n host: string;\n imageRef: string;\n}\n\nexport function makeSnapshotName(host: string, imageRef: string): string {\n return `${host}${SNAPSHOT_SEP}${imageRef}`;\n}\n\nexport function parseSnapshotName(snapshotName: string): ParsedSnapshot {\n const sep = snapshotName.indexOf(SNAPSHOT_SEP);\n if (sep <= 0 || sep === snapshotName.length - 1) {\n throw new Error(\n `remote-docker: malformed snapshot name \"${snapshotName}\" — expected \"<ssh-destination>#<image-ref>\"`,\n );\n }\n return {\n host: snapshotName.slice(0, sep),\n imageRef: snapshotName.slice(sep + 1),\n };\n}\n\n/**\n * Tunnel id for a host-scoped (rather than box-scoped) connection — the image\n * ops, which act on an engine rather than a container.\n */\nfunction snapshotTunnelId(host: string): string {\n return `engine:${host}`;\n}\n\n/** In-box relay port the host CloudBoxPoller long-polls (`/bridge/*`). */\nconst BRIDGE_PORT = 8788;\n/** The box image's always-on sshd — published so `agentbox open` / `code` work. */\nconst SSH_PORT = 22;\n\n/**\n * Ports published at `docker run`. Docker port mappings are immutable for the\n * life of a container (the same constraint Vercel has), so everything the host\n * may ever need to reach must be listed at create: the WebProxy, noVNC, the\n * bridge, sshd, plus whatever `agentbox.yaml` exposes.\n */\nfunction portsToPublish(exposePorts: number[] | undefined): number[] {\n const base = [CLOUD_WEB_PROXY_PORT, CLOUD_VNC_PORT, BRIDGE_PORT, SSH_PORT];\n return [...new Set([...base, ...(exposePorts ?? [])])];\n}\n\ninterface Ctx {\n target: SshTargetArgs;\n remote: RemoteTarget;\n container: string;\n}\n\n/**\n * Is the remote engine itself running inside an AgentBox sandbox? Only true in\n * the agentbox-in-agentbox dev loop this repo is developed with (CLAUDE.md ->\n * \"Use Agentbox inside Agentbox\"), where the nested dockerd lacks the\n * capabilities a normal engine has. `/etc/agentbox/box.env` is written into\n * every box by the create path, so its presence is the box's own identity file.\n */\nasync function remoteIsNested(target: SshTargetArgs): Promise<boolean> {\n const res = await sshExec(target, 'test -f /etc/agentbox/box.env');\n return res.exitCode === 0;\n}\n\n/** Resolve a handle into a live SSH connection + the container it names. */\nasync function ctxFor(h: CloudHandle): Promise<Ctx> {\n const { target: remote, container } = parseSandboxId(h.sandboxId);\n const target = await ensureTunnel(h.sandboxId, remote);\n return { target, remote, container };\n}\n\n/** `docker inspect` state string -> the provider-neutral CloudState. */\nexport function mapDockerState(status: string): CloudState {\n switch (status.trim()) {\n case 'running':\n return 'running';\n case 'paused':\n return 'paused';\n case 'created':\n case 'exited':\n case 'dead':\n case 'restarting':\n case 'removing':\n return 'stopped';\n default:\n return 'missing';\n }\n}\n\n/**\n * `docker port <c> <p>` -> the ephemeral port docker bound on the remote's\n * loopback. Its output is `127.0.0.1:49153` (possibly several lines, one per\n * binding); we take the first with a port.\n */\nexport function parseDockerPort(stdout: string): number | null {\n for (const line of stdout.split(/\\r?\\n/)) {\n const m = /:(\\d+)\\s*$/.exec(line.trim());\n if (m?.[1]) {\n const port = Number.parseInt(m[1], 10);\n if (Number.isFinite(port) && port > 0) return port;\n }\n }\n return null;\n}\n\n/** Parse `--size` as `cpu-memory` GB (e2b's spec shape). */\nexport function parseSize(size: string | undefined): { cpu?: number; memory?: number } {\n if (!size) return {};\n const m = /^(\\d+)(?:-(\\d+))?$/.exec(size.trim());\n if (!m?.[1]) return {};\n const cpu = Number.parseInt(m[1], 10);\n const memory = m[2] ? Number.parseInt(m[2], 10) : undefined;\n return { cpu, ...(memory !== undefined ? { memory } : {}) };\n}\n\n/**\n * The `docker run` argv for a box. Mirrors the local provider's `runBox` flags\n * — the cap/security/cgroup set is what makes the in-box dockerd work, and the\n * two must not drift.\n */\nexport function buildRunArgv(opts: {\n container: string;\n image: string;\n env: Record<string, string>;\n ports: number[];\n dockerVolume: string;\n cpu?: number;\n memory?: number;\n /** The remote engine is itself inside an AgentBox sandbox — see `remoteIsNested`. */\n nestedEngine?: boolean;\n}): string[] {\n const argv = [\n 'run',\n '-d',\n '--name',\n opts.container,\n '--hostname',\n opts.container,\n // The in-box dockerd needs these: SYS_ADMIN to `mount -t overlay` for\n // overlay2, NET_ADMIN for its bridge + iptables NAT, /dev/fuse +\n // apparmor:unconfined for the fuse-overlayfs fallback, seccomp:unconfined\n // because the default profile blocks syscalls nested containers need, and a\n // private cgroup namespace so runc can create its own slice. Same set as\n // the local docker provider; we still avoid --privileged.\n '--cap-add=SYS_ADMIN',\n '--cap-add=NET_ADMIN',\n '--device=/dev/fuse',\n '--security-opt=apparmor:unconfined',\n '--security-opt=seccomp=unconfined',\n '--cgroupns=private',\n ];\n if (opts.nestedEngine) {\n // The engine is itself inside an AgentBox sandbox, which has no\n // CAP_SYS_PTRACE. Its dockerd therefore cannot bind-mount /proc/<pid>/ns/net\n // for a container whose init runs as a different uid than the daemon —\n // and the box image's default USER is vscode (1000), so `docker run` dies\n // with \"bind-mount /proc/N/ns/net: permission denied\". Forcing init to uid 0\n // makes its /proc readable by the daemon and netns setup succeeds.\n //\n // The local docker provider does the same thing (see `runBox`), but keys it\n // off ITS OWN `AGENTBOX=1`. Here that would be the wrong signal: the CLI can\n // run inside a box while the engine sits on a real machine that has no such\n // limitation. What matters is whether the ENGINE is nested, so we ask it.\n argv.push('--user', '0');\n }\n if (opts.cpu) argv.push('--cpus', String(opts.cpu));\n if (opts.memory) argv.push('--memory', `${String(opts.memory)}g`);\n // /var/lib/docker on a volume, not the container layer: without it, every\n // image the agent pulls inside the box would be captured by `docker commit`\n // and bloat each checkpoint.\n argv.push('-v', `${opts.dockerVolume}:/var/lib/docker`);\n for (const port of opts.ports) {\n // Bind the REMOTE's loopback only: the box is reached through the SSH\n // tunnel, so there is no reason to expose it on the remote's LAN.\n argv.push('-p', `127.0.0.1:0:${String(port)}`);\n }\n for (const [k, v] of Object.entries(opts.env)) {\n argv.push('-e', `${k}=${v}`);\n }\n argv.push(opts.image, 'sleep', 'infinity');\n return argv;\n}\n\nexport const remoteDockerBackend: CloudBackend = {\n name: BACKEND_NAME,\n\n async provision(req: CloudProvisionRequest): Promise<CloudHandle> {\n const log = req.onLog ?? ((): void => {});\n // The SSH destination is resolved by the CLI (`docker:<host>` /\n // --remote-host / box.remoteDockerHost) and threaded through providerOptions.\n const spec = (req.host ?? '').trim();\n if (!spec) {\n throw new Error(\n 'remote-docker: no SSH destination. Use `agentbox docker:<host> …`, `--remote-host <host>`, or set `box.remoteDockerHost`.',\n );\n }\n const remote = parseRemoteTarget(spec);\n const container = containerNameFor(req.name);\n const sandboxId = makeSandboxId(remote.spec, container);\n const target = await ensureTunnel(sandboxId, remote);\n\n // A checkpoint is a `docker commit`ed image on THIS engine; otherwise ensure\n // the fingerprint-tagged base image is present (pull, else build).\n let image: string;\n if (req.snapshot) {\n const snap = parseSnapshotName(req.snapshot);\n // A checkpoint cannot follow you to another machine: the image lives on\n // the engine that committed it. Read as \"gone\" rather than erroring, so\n // the scaffold prunes the dangling manifest and builds a fresh box.\n if (snap.host !== remote.spec) {\n throw new Error(\n `snapshot expired or deleted: it was captured on ${snap.host}, not ${remote.spec} (a remote-docker checkpoint is local to its engine)`,\n );\n }\n image = snap.imageRef;\n const probe = await dockerOnRemote(target, ['image', 'inspect', image]);\n if (probe.exitCode !== 0) {\n // Same contract as the other clouds: a vanished snapshot must read as\n // \"gone\" so the scaffold prunes the manifest and re-provisions from base.\n throw new Error(`snapshot expired or deleted: ${image} is not on ${remote.spec}`);\n }\n } else {\n const ensured = await ensureRemoteImage(target, {\n imageRef: req.image && req.image !== 'agentbox/box:dev' ? req.image : undefined,\n onLog: log,\n });\n image = ensured.ref;\n }\n\n const { cpu, memory } = parseSize(req.size);\n const dockerVolume = `agentbox-docker-${container}`;\n await dockerOnRemoteOrThrow(target, ['volume', 'create', dockerVolume]);\n\n const nestedEngine = await remoteIsNested(target);\n if (nestedEngine) {\n log('[provision] remote engine is itself an AgentBox box — running the box init as root');\n }\n\n const argv = buildRunArgv({\n container,\n image,\n env: req.env ?? {},\n ports: portsToPublish(req.exposePorts),\n dockerVolume,\n nestedEngine,\n ...(cpu !== undefined ? { cpu } : {}),\n ...(memory !== undefined ? { memory } : {}),\n });\n log(`[provision] docker run ${container} on ${remote.spec}`);\n await dockerOnRemoteOrThrow(target, argv, { timeoutMs: 300_000 });\n\n return {\n sandboxId,\n resources: {\n ...(cpu !== undefined ? { cpu } : {}),\n ...(memory !== undefined ? { memory } : {}),\n },\n };\n },\n\n async get(sandboxId: string): Promise<CloudHandle | null> {\n let ctx: Ctx;\n try {\n ctx = await ctxFor({ sandboxId });\n } catch {\n return null;\n }\n const res = await dockerOnRemote(ctx.target, [\n 'inspect',\n '-f',\n '{{.State.Status}}',\n ctx.container,\n ]);\n return res.exitCode === 0 ? { sandboxId } : null;\n },\n\n /**\n * Every other cloud can ask its API \"what sandboxes exist?\". Here there is no\n * API and no registry of engines — a machine only becomes ours by being named\n * in a box record or in `box.remoteDockerHost`. So enumeration means: work out\n * which engines we have ever used, and ask each of them. An engine that has\n * gone away is skipped rather than fatal, since prune must still report on the\n * ones that answer.\n */\n async list(): Promise<CloudSandboxSummary[]> {\n const hosts = await knownHosts();\n const out: CloudSandboxSummary[] = [];\n for (const host of hosts) {\n try {\n out.push(...(await listOnHost(host)));\n } catch {\n // unreachable engine — nothing to report from it\n }\n }\n return out;\n },\n\n async start(h): Promise<void> {\n const ctx = await ctxFor(h);\n await dockerOnRemoteOrThrow(ctx.target, ['start', ctx.container], { timeoutMs: 120_000 });\n },\n\n async stop(h): Promise<void> {\n const ctx = await ctxFor(h);\n await dockerOnRemoteOrThrow(ctx.target, ['stop', ctx.container], { timeoutMs: 120_000 });\n },\n\n /**\n * A true freeze (SIGSTOP-equivalent via the freezer cgroup), not cold storage:\n * the container keeps its memory and its published ports, so resume is instant\n * and the forwarded ports stay valid.\n */\n async pause(h): Promise<void> {\n const ctx = await ctxFor(h);\n const state = await currentState(ctx);\n if (state !== 'running') return;\n await dockerOnRemoteOrThrow(ctx.target, ['pause', ctx.container]);\n },\n\n async resume(h): Promise<void> {\n const ctx = await ctxFor(h);\n const state = await currentState(ctx);\n if (state === 'paused') {\n await dockerOnRemoteOrThrow(ctx.target, ['unpause', ctx.container]);\n return;\n }\n if (state !== 'running') {\n await dockerOnRemoteOrThrow(ctx.target, ['start', ctx.container], { timeoutMs: 120_000 });\n }\n },\n\n async destroy(h): Promise<void> {\n const ctx = await ctxFor(h);\n // Idempotent: `rm -f` on a missing container is a no-op we tolerate, since\n // destroy must converge even after a partially-failed create.\n await dockerOnRemote(ctx.target, ['rm', '-f', ctx.container], { timeoutMs: 120_000 });\n await dockerOnRemote(ctx.target, ['volume', 'rm', '-f', `agentbox-docker-${ctx.container}`]);\n await tunnels.close(h.sandboxId);\n },\n\n async state(h): Promise<CloudState> {\n let ctx: Ctx;\n try {\n ctx = await ctxFor(h);\n } catch {\n // Unreachable host — the box may well be fine, but we cannot see it.\n return 'missing';\n }\n return currentState(ctx);\n },\n\n async exec(h, cmd: string, opts: CloudExecOptions = {}): Promise<CloudExecResult> {\n const ctx = await ctxFor(h);\n const argv = dockerExecArgv(ctx.container, cmd, {\n user: opts.user ?? CONTAINER_USER,\n ...(opts.cwd ? { cwd: opts.cwd } : {}),\n ...(opts.env ? { env: opts.env } : {}),\n });\n const res = await dockerOnRemote(ctx.target, argv, {\n timeoutMs: opts.attemptTimeoutMs ?? 300_000,\n });\n return { exitCode: res.exitCode, stdout: res.stdout, stderr: res.stderr };\n },\n\n async uploadFile(h, localPath: string, remotePath: string): Promise<void> {\n const ctx = await ctxFor(h);\n // The seed tars land in /tmp before an in-box extract; make sure the parent\n // exists, since `cat >` won't create it.\n await dockerOnRemote(\n ctx.target,\n dockerExecArgv(ctx.container, bashScript(`mkdir -p ${shellDir(remotePath)}`), {\n user: 'root',\n }),\n );\n await pipeFileIntoContainer(ctx.target, ctx.container, createReadStream(localPath), remotePath);\n },\n\n async downloadFile(h, remotePath: string, localPath: string): Promise<void> {\n const ctx = await ctxFor(h);\n await mkdir(dirname(localPath), { recursive: true });\n await pipeFileFromContainer(\n ctx.target,\n ctx.container,\n remotePath,\n createWriteStream(localPath),\n );\n },\n\n async listFiles(h, remoteDir: string): Promise<CloudFileEntry[]> {\n const ctx = await ctxFor(h);\n const res = await dockerOnRemote(\n ctx.target,\n dockerExecArgv(\n ctx.container,\n `find ${quote(remoteDir)} -mindepth 1 -maxdepth 1 -printf '%f\\\\t%y\\\\n'`,\n ),\n );\n if (res.exitCode !== 0) return [];\n const out: CloudFileEntry[] = [];\n for (const line of res.stdout.split(/\\r?\\n/)) {\n const [name, kind] = line.split('\\t');\n if (name) out.push({ name, isDir: kind === 'd' });\n }\n return out;\n },\n\n /**\n * The container's port is published on the REMOTE's loopback; we forward that\n * to a free local port over the box's ControlMaster. So the URL is always\n * `http://127.0.0.1:<local>` — reachable from the host browser and from the\n * host relay's poller alike.\n */\n async previewUrl(h, port: number): Promise<CloudPreviewUrl> {\n const ctx = await ctxFor(h);\n const remotePort = await publishedPort(ctx, port);\n const localPort = await tunnels.forward(h.sandboxId, remotePort);\n return { url: `http://127.0.0.1:${String(localPort)}` };\n },\n\n /** SSH is already the auth gate, so a \"signed\" URL is just the tunneled one. */\n async signedPreviewUrl(h, port: number): Promise<CloudPreviewUrl> {\n return remoteDockerBackend.previewUrl(h, port);\n },\n\n /**\n * The poller calls this when the local port stops answering — typically a\n * ControlMaster that died across a host sleep/wake. Re-open the master AND\n * re-read `docker port`: a container restart reassigns the remote's ephemeral\n * port, so a forward to the old one would connect to nothing.\n */\n async refreshPreviewUrl(h, port: number): Promise<CloudPreviewUrl> {\n const { target: remote } = parseSandboxId(h.sandboxId);\n await refreshTunnel(h.sandboxId, remote);\n return remoteDockerBackend.previewUrl(h, port);\n },\n\n async createSnapshot(h, snapshotName: string): Promise<void> {\n const ctx = await ctxFor(h);\n const snap = parseSnapshotName(snapshotName);\n await dockerOnRemoteOrThrow(ctx.target, ['commit', ctx.container, snap.imageRef], {\n timeoutMs: 600_000,\n });\n },\n\n async deleteSnapshot(snapshotName: string): Promise<void> {\n const snap = parseSnapshotName(snapshotName);\n try {\n const target = await ensureTunnel(snapshotTunnelId(snap.host), parseRemoteTarget(snap.host));\n await dockerOnRemote(target, ['image', 'rm', '-f', snap.imageRef]);\n } catch {\n // Unreachable host or already gone — best-effort, matching the other\n // clouds: the caller drops the local manifest either way.\n }\n },\n\n async snapshotExists(snapshotName: string): Promise<boolean> {\n let snap: ParsedSnapshot;\n try {\n snap = parseSnapshotName(snapshotName);\n } catch {\n return false;\n }\n try {\n const target = await ensureTunnel(snapshotTunnelId(snap.host), parseRemoteTarget(snap.host));\n const res = await dockerOnRemote(target, ['image', 'inspect', snap.imageRef]);\n return res.exitCode === 0;\n } catch {\n // Contract: must never throw. An unreachable engine reads as \"not\n // bootable\", which is the truth from here.\n return false;\n }\n },\n};\n\n/**\n * Engines this machine has used: every host named by a remote-docker box record,\n * plus the configured default. Deduped, order-stable.\n */\nasync function knownHosts(): Promise<string[]> {\n const hosts = new Set<string>();\n try {\n const state = await readState();\n for (const box of state.boxes) {\n if (box.provider !== BACKEND_NAME || !box.cloud?.sandboxId) continue;\n try {\n hosts.add(parseSandboxId(box.cloud.sandboxId).target.spec);\n } catch {\n // a malformed id names no engine we could ask\n }\n }\n } catch {\n // no state yet\n }\n try {\n const cfg = await loadEffectiveConfig(process.cwd());\n const dflt = (cfg.effective.box.remoteDockerHost || '').trim();\n if (dflt) hosts.add(dflt);\n } catch {\n // no config — the box records are all we have\n }\n return [...hosts];\n}\n\n/** List agentbox containers on one remote engine — the host-scoped `list()`. */\nexport async function listOnHost(spec: string): Promise<CloudSandboxSummary[]> {\n const remote = parseRemoteTarget(spec);\n const target = await ensureTunnel(`list:${remote.spec}`, remote);\n const res = await dockerOnRemote(target, [\n 'ps',\n '-a',\n '--filter',\n 'name=agentbox-',\n '--format',\n '{{.Names}}\\t{{.State}}\\t{{.CreatedAt}}',\n ]);\n if (res.exitCode !== 0) return [];\n const out: CloudSandboxSummary[] = [];\n for (const line of res.stdout.split(/\\r?\\n/)) {\n const [name, state, createdAt] = line.split('\\t');\n if (!name) continue;\n out.push({\n sandboxId: makeSandboxId(remote.spec, name),\n name,\n ...(createdAt ? { createdAt } : {}),\n state: mapDockerState(state ?? ''),\n });\n }\n return out;\n}\n\nasync function currentState(ctx: Ctx): Promise<CloudState> {\n const res = await dockerOnRemote(ctx.target, [\n 'inspect',\n '-f',\n '{{.State.Status}}',\n ctx.container,\n ]);\n if (res.exitCode !== 0) return 'missing';\n return mapDockerState(res.stdout);\n}\n\nasync function publishedPort(ctx: Ctx, containerPort: number): Promise<number> {\n const res = await dockerOnRemote(ctx.target, ['port', ctx.container, String(containerPort)]);\n const port = res.exitCode === 0 ? parseDockerPort(res.stdout) : null;\n if (port === null) {\n throw new Error(\n `remote-docker: container port ${String(containerPort)} is not published on ${ctx.container}. ` +\n 'Docker port mappings are fixed at create — a service exposed after the box was made is only ' +\n 'reachable through the :80 WebProxy until the box is recreated.',\n );\n }\n return port;\n}\n\nfunction shellDir(path: string): string {\n const slash = path.lastIndexOf('/');\n return quote(slash > 0 ? path.slice(0, slash) : '/');\n}\n\nfunction quote(s: string): string {\n return `'${s.replace(/'/g, \"'\\\\''\")}'`;\n}\n","/**\n * Getting the box image onto the remote engine.\n *\n * The image ref IS the build-context fingerprint: `agentbox/box:<sha16>`, the\n * same sha the local docker provider computes. That one decision removes a\n * whole class of state:\n *\n * - \"is this host prepared?\" == `docker image inspect agentbox/box:<sha>` on it.\n * No prepared-state file is consulted to decide, so it can't go stale or\n * disagree with reality, and it is naturally PER HOST (which a single\n * `~/.agentbox/remote-docker-prepared.json` could never be).\n * - a CLI upgrade that changes any baked file changes the sha, so the next\n * create ensures a new ref rather than silently running an old image.\n *\n * Ensure order: already present → pull the fingerprint-tagged image from GHCR\n * (published multi-arch, so an amd64 remote gets amd64 even though the laptop\n * is arm64) → stream the local build context to a remote `docker build -`.\n */\n\nimport { createReadStream } from 'node:fs';\nimport { rm } from 'node:fs/promises';\nimport { tmpdir } from 'node:os';\nimport { join } from 'node:path';\nimport { execa } from 'execa';\nimport { quoteShellArgv } from '@agentbox/sandbox-cloud';\nimport {\n BOX_IMAGE_REGISTRY,\n BUILD_CONTEXT_DIR,\n computeDockerContextFingerprint,\n registryRefForSha,\n} from '@agentbox/sandbox-docker';\nimport {\n claudeInstallFingerprint,\n sshDestination,\n sshOptArgs,\n type SshTargetArgs,\n} from '@agentbox/sandbox-core';\nimport { dockerOnRemote, loginShell } from './remote-docker.js';\n\nexport type ClaudeInstall = 'native' | 'npm';\n\nexport interface EnsureRemoteImageOptions {\n /** Pin an explicit image ref on the remote (`box.imageRemoteDocker`); skips the ensure. */\n imageRef?: string;\n claudeInstall?: ClaudeInstall;\n /** Registry to pull from. Empty string disables the pull and forces a build. */\n registry?: string;\n /** Force the build path even on a registry hit (`--build`). */\n allowPull?: boolean;\n /** Rebuild even when the ref is already present on the remote. */\n force?: boolean;\n onLog?: (line: string) => void;\n}\n\nexport interface EnsureRemoteImageResult {\n ref: string;\n source: 'pinned' | 'present' | 'pulled' | 'built';\n /** The build-context fingerprint the ref encodes, when we derived it. */\n contextSha256?: string;\n}\n\n/** The image ref a given build-context fingerprint maps to on the remote. */\nexport function remoteImageRef(contextSha256: string): string {\n return `agentbox/box:${contextSha256.slice(0, 16)}`;\n}\n\n/**\n * Resolve the fingerprint of the build context this CLI would bake, folding in\n * the Claude install mode exactly as the docker provider does (so an npm-baked\n * image and a native-baked one are different refs, not the same ref with\n * different contents). Null when the context can't be resolved — a dev tree\n * without `pnpm -w build`.\n */\nexport async function currentContextSha(claudeInstall?: ClaudeInstall): Promise<string | null> {\n const fp = await computeDockerContextFingerprint({});\n if (!fp) return null;\n return claudeInstall\n ? claudeInstallFingerprint(fp.contextSha256, claudeInstall)\n : fp.contextSha256;\n}\n\n/**\n * Make the box image present on the remote engine. Idempotent and cheap on the\n * hot path: a single `docker image inspect` when it's already there.\n */\nexport async function ensureRemoteImage(\n target: SshTargetArgs,\n opts: EnsureRemoteImageOptions = {},\n): Promise<EnsureRemoteImageResult> {\n const log = opts.onLog ?? ((): void => {});\n\n // An explicitly pinned ref is the user's problem to keep present — we neither\n // pull nor build it, because we have no idea what it contains.\n if (opts.imageRef && opts.imageRef.trim().length > 0) {\n const ref = opts.imageRef.trim();\n const probe = await dockerOnRemote(target, ['image', 'inspect', ref]);\n if (probe.exitCode !== 0) {\n throw new Error(\n `remote-docker: box.imageRemoteDocker pins \"${ref}\", which is not present on the remote engine. ` +\n `Build/pull it there, or unset the key to let AgentBox manage the image.`,\n );\n }\n return { ref, source: 'pinned' };\n }\n\n const sha = await currentContextSha(opts.claudeInstall);\n if (!sha) {\n throw new Error(\n 'remote-docker: cannot resolve the box build context (a dev tree needs `pnpm -w build` first)',\n );\n }\n const ref = remoteImageRef(sha);\n\n if (!opts.force) {\n const probe = await dockerOnRemote(target, ['image', 'inspect', ref]);\n if (probe.exitCode === 0) {\n log(`[image] ${ref} already present on the remote`);\n return { ref, source: 'present', contextSha256: sha };\n }\n }\n\n const registry = opts.registry ?? BOX_IMAGE_REGISTRY;\n if (opts.allowPull !== false && registry) {\n const remote = registryRefForSha(sha, registry);\n log(`[image] pulling ${remote} on the remote engine`);\n const pull = await dockerOnRemote(target, ['pull', remote], {\n timeoutMs: 900_000,\n onLine: (l) => log(`[image] ${l}`),\n });\n if (pull.exitCode === 0) {\n await dockerOnRemote(target, ['tag', remote, ref]);\n log(`[image] pulled ${remote} -> ${ref}`);\n return { ref, source: 'pulled', contextSha256: sha };\n }\n log('[image] registry miss — building on the remote from the local context');\n }\n\n await buildOnRemote(target, ref, opts);\n return { ref, source: 'built', contextSha256: sha };\n}\n\n/**\n * Stream the local build context to `docker build -` on the remote.\n *\n * `docker build -` reads a tar of the context from stdin, so the whole build\n * happens on the remote engine with no files staged on its disk beforehand —\n * and no dependency on the remote having a checkout of anything.\n */\nasync function buildOnRemote(\n target: SshTargetArgs,\n ref: string,\n opts: EnsureRemoteImageOptions,\n): Promise<void> {\n const log = opts.onLog ?? ((): void => {});\n const tarPath = join(tmpdir(), `agentbox-box-ctx-${String(process.pid)}.tar`);\n try {\n // COPYFILE_DISABLE stops macOS tar from emitting ._* AppleDouble entries,\n // which would land in the image as junk files.\n await execa('tar', ['-C', BUILD_CONTEXT_DIR, '-cf', tarPath, '.'], {\n env: { ...process.env, COPYFILE_DISABLE: '1' },\n });\n\n const buildArgs = ['build', '-t', ref, '-f', 'Dockerfile.box'];\n if (opts.claudeInstall) {\n buildArgs.push('--build-arg', `AGENTBOX_CLAUDE_INSTALL=${opts.claudeInstall}`);\n }\n buildArgs.push('-');\n\n log(`[image] building ${ref} on the remote (streaming the build context)`);\n const res = await execa(\n 'ssh',\n [\n ...sshOptArgs(target),\n sshDestination(target),\n loginShell(`docker ${quoteShellArgv(buildArgs)}`),\n ],\n { reject: false, input: createReadStream(tarPath), stdout: 'pipe', stderr: 'pipe' },\n );\n const out = `${typeof res.stdout === 'string' ? res.stdout : ''}${typeof res.stderr === 'string' ? res.stderr : ''}`;\n for (const line of out.split(/\\r?\\n/)) {\n if (line.trim().length > 0) log(`[image] ${line}`);\n }\n if (res.exitCode !== 0) {\n throw new Error(\n `remote-docker: remote \\`docker build\\` failed (exit ${String(res.exitCode)}). See the build output above.`,\n );\n }\n log(`[image] built ${ref}`);\n } finally {\n await rm(tarPath, { force: true });\n }\n}\n","/**\n * `buildRemoteDockerAttach` — this provider's override of `Provider.buildAttach`.\n *\n * The cloud scaffold's default appends the inner command to the backend's\n * `attachArgv`, which for an SSH backend lands it on the *host* it connects to.\n * For hetzner that host IS the box. Here it is the machine running the engine —\n * the box is a container on it — so the inner command has to be wrapped in a\n * `docker exec` before it crosses the wire. Hence a full override (the same\n * pattern vercel and e2b use for their non-SSH attaches).\n *\n * The result is a plain `ssh … -t 'docker exec -it … bash -lc <tmux>'`, so the\n * CLI's PTY wrapper drives it exactly like any other provider's attach.\n */\n\nimport type { AttachKind, AttachSpec, BoxRecord, BuildAttachOptions } from '@agentbox/core';\nimport {\n hostTermForCloud,\n quoteShellArg,\n quoteShellArgv,\n renderInnerCommand,\n} from '@agentbox/sandbox-cloud';\nimport { sshDestination, sshOptArgs } from '@agentbox/sandbox-core';\nimport { ensureTunnel } from './remote-docker.js';\nimport { parseSandboxId } from './target.js';\n\nconst CONTAINER_USER = 'vscode';\n\nexport async function buildRemoteDockerAttach(\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(`remote-docker box ${box.name} has no sandboxId — record is malformed`);\n }\n const { target: remote, container } = parseSandboxId(sandboxId);\n const target = await ensureTunnel(sandboxId, remote);\n\n // The tmux session bring-up + attach, identical to every other cloud box.\n const inner = renderInnerCommand(kind, opts);\n const dockerArgv = [\n 'exec',\n // `detached` only creates the session, so it needs no TTY — and asking for\n // one would make docker fail when the CLI runs it without a terminal.\n ...(opts.detached ? ['-i'] : ['-it']),\n '-u',\n opts.user ?? CONTAINER_USER,\n '-e',\n `TERM=${hostTermForCloud()}`,\n container,\n 'bash',\n '-lc',\n inner,\n ];\n const remoteCommand = `docker ${quoteShellArgv(dockerArgv)}`;\n\n const argv = [\n 'ssh',\n ...sshOptArgs(target),\n // -t forces TTY allocation through ssh; without it tmux and readline break.\n ...(opts.detached ? [] : ['-t']),\n sshDestination(target),\n // One argv element: ssh hands the string to the remote login shell, which\n // re-parses it — so the docker argv is quoted, not concatenated.\n remoteCommand,\n ];\n return { argv };\n}\n\n/** Exposed for the unit test — the quoting is the part worth pinning down. */\nexport const _internal = { quoteShellArg };\n","/**\n * Making the BOX (not the engine) reachable over SSH, so `agentbox open`\n * (sshfs), `agentbox code` (Remote-SSH) and `agentbox connect` work exactly as\n * they do for every other provider.\n *\n * The box is a container on someone else's machine, and its sshd is published\n * on THAT machine's loopback (`-p 127.0.0.1:0:22`). So there is no host:port a\n * local ssh could dial directly. The answer is `ProxyJump`: ssh connects to the\n * engine's machine, and the engine dials `127.0.0.1:<published port>` on our\n * behalf — which is precisely the address the box's sshd is listening on from\n * where the jump host stands.\n *\n * Host agentbox-<box>\n * HostName 127.0.0.1 # as resolved ON the jump host\n * Port <published>\n * User vscode\n * ProxyJump <engine> # the ssh destination the box lives on\n * IdentityFile ~/.agentbox/remote-docker/boxes/<id>/ssh/id_ed25519\n *\n * No `ssh -L` forward is involved: ssh's own transport does the hop, so the\n * alias keeps working in any process (VS Code, sshfs) without AgentBox having\n * to hold a tunnel open for it.\n *\n * The private key never leaves the host. The public half is installed into the\n * box's `authorized_keys` over the ControlMaster we already have.\n */\n\nimport type { BoxRecord, SshTargetRecord } from '@agentbox/core';\nimport { bashScript, quoteShellArg } from '@agentbox/sandbox-cloud';\nimport { defaultBoxSshDir, mintSshKey } from '@agentbox/sandbox-core';\nimport { CONTAINER_USER, dockerExecArgv, dockerOnRemote, ensureTunnel } from './remote-docker.js';\nimport { parseSandboxId } from './target.js';\nimport { parseDockerPort } from './backend.js';\n\n/** The box image's sshd listens here; we publish it on the engine's loopback. */\nconst SSH_CONTAINER_PORT = 22;\n\n/**\n * Bring the box's sshd up, make sure it trusts this host's per-box key, and\n * return the connection target. Idempotent — safe to call on every start: the\n * key is reused when present, `authorized_keys` is only appended to when the key\n * isn't already there, and sshd is only launched if it isn't already listening.\n *\n * Returns null (rather than throwing) when sshd doesn't come up, so a failure\n * here degrades `open`/`code` instead of breaking the lifecycle command that\n * triggered it.\n */\nexport async function resolveBoxSshTarget(box: BoxRecord): Promise<SshTargetRecord | null> {\n const sandboxId = box.cloud?.sandboxId;\n if (!sandboxId) return null;\n const { target: remote, container } = parseSandboxId(sandboxId);\n const conn = await ensureTunnel(sandboxId, remote);\n\n const key = await mintSshKey(\n defaultBoxSshDir(sandboxId, 'remote-docker'),\n `agentbox-${box.name}`,\n );\n\n // Install the public key. `grep -q` first so a restart doesn't grow the file\n // without bound. Runs as root because on a nested engine the container's init\n // is uid 0 and ~vscode/.ssh may not exist yet; the chown puts it back.\n const install = [\n `install -d -m 700 -o ${CONTAINER_USER} -g ${CONTAINER_USER} /home/${CONTAINER_USER}/.ssh`,\n `touch /home/${CONTAINER_USER}/.ssh/authorized_keys`,\n `grep -qF ${quoteShellArg(key.publicKey)} /home/${CONTAINER_USER}/.ssh/authorized_keys || echo ${quoteShellArg(key.publicKey)} >> /home/${CONTAINER_USER}/.ssh/authorized_keys`,\n `chown -R ${CONTAINER_USER}:${CONTAINER_USER} /home/${CONTAINER_USER}/.ssh`,\n `chmod 600 /home/${CONTAINER_USER}/.ssh/authorized_keys`,\n ].join(' && ');\n const installRes = await dockerOnRemote(\n conn,\n dockerExecArgv(container, bashScript(install), { user: 'root' }),\n );\n if (installRes.exitCode !== 0) return null;\n\n // Start sshd (the image ships `agentbox-sshd-start`, which manages the host\n // keys and /run/sshd). Idempotent, and a no-op when it's already listening.\n await dockerOnRemote(\n conn,\n dockerExecArgv(container, bashScript('/usr/local/bin/agentbox-sshd-start'), {\n user: 'root',\n }),\n { timeoutMs: 60_000 },\n );\n\n // The port docker published on the ENGINE's loopback. Re-read every time: it\n // is ephemeral and gets reassigned whenever the container restarts.\n const portRes = await dockerOnRemote(conn, ['port', container, String(SSH_CONTAINER_PORT)]);\n const port = portRes.exitCode === 0 ? parseDockerPort(portRes.stdout) : null;\n if (port === null) return null;\n\n return {\n // Resolved on the jump host, not here.\n host: '127.0.0.1',\n port,\n user: CONTAINER_USER,\n identityFile: key.privatePath,\n proxyJump: remote.spec,\n };\n}\n","/**\n * `agentbox prepare --provider docker:<host>` — bake the box image on a remote\n * engine.\n *\n * Unlike the VPS providers, this is not a mandatory gate: a remote engine can\n * build from a Dockerfile, so `create` ensures the image itself and prepare is\n * simply the eager form (\"do the slow part now, not when I'm waiting for a\n * box\"). It is also the only place that writes `remote-docker-prepared.json`,\n * which exists purely so `prepare --status` / `doctor` can report what has been\n * baked where.\n */\n\nimport type { PrepareOptions, PrepareResult } from '@agentbox/core';\nimport { ensureRemoteImage } from './image.js';\nimport { ensureTunnel } from './remote-docker.js';\nimport { recordPreparedHost } from './prepared-state.js';\nimport { parseRemoteTarget } from './target.js';\n\nexport async function prepareRemoteDocker(\n opts: PrepareOptions & { host?: string },\n): Promise<PrepareResult> {\n const log = opts.onLog ?? ((): void => {});\n const spec = (opts.host ?? '').trim();\n if (!spec) {\n throw new Error(\n 'remote-docker: prepare needs an SSH destination — `agentbox prepare --provider docker:<host>`, ' +\n 'or set `box.remoteDockerHost`.',\n );\n }\n const remote = parseRemoteTarget(spec);\n const target = await ensureTunnel(`engine:${remote.spec}`, remote);\n\n log(`[prepare] ensuring the box image on ${remote.spec}`);\n const res = await ensureRemoteImage(target, {\n ...(opts.claudeInstall ? { claudeInstall: opts.claudeInstall } : {}),\n ...(opts.registry !== undefined ? { registry: opts.registry } : {}),\n ...(opts.allowPull !== undefined ? { allowPull: opts.allowPull } : {}),\n ...(opts.force ? { force: true } : {}),\n onLog: log,\n });\n\n if (res.contextSha256) {\n recordPreparedHost(remote.spec, { imageRef: res.ref, contextSha256: res.contextSha256 });\n }\n log(`[prepare] ${remote.spec} ready — ${res.ref} (${res.source})`);\n\n // Deliberately no `snapshotName`: returning one makes the CLI pin\n // `box.imageRemoteDocker` to it, which would freeze every future create on\n // today's fingerprint and defeat the self-updating ref.\n return {};\n}\n","/**\n * Doctor probes for the remote-docker provider.\n *\n * There is no credential to check — the provider authenticates as you, through\n * your own `~/.ssh/config` and agent. What *can* be wrong is the destination:\n * unset, unreachable, or reachable but with no docker on the login-shell PATH.\n * So the checks are exactly those three, run against the configured default.\n */\n\nimport { loadEffectiveConfig } from '@agentbox/config';\nimport { detectPortless, portlessDoctorRow } from '@agentbox/sandbox-cloud';\nimport { errSummary, type CheckResult } from '@agentbox/sandbox-core';\nimport { probeRemoteEngine } from './remote-docker.js';\nimport { readPreparedState } from './prepared-state.js';\n\n// No `readCredStatus` / `ensureCredentials` on this provider's module, and that\n// is not an omission: there is no credential to store or prompt for. The CLI\n// and the hub both feature-detect those, so they simply show no login row.\n\nexport async function doctorChecks(): Promise<CheckResult[]> {\n try {\n const cfg = await loadEffectiveConfig(process.cwd());\n const host = (cfg.effective.box.remoteDockerHost || '').trim();\n if (!host) {\n return [\n {\n label: 'remote engine',\n status: 'warn',\n detail: 'no default SSH destination set',\n hint: '`agentbox config set box.remoteDockerHost <user@host>` (or use `agentbox docker:<host> …`)',\n },\n ];\n }\n\n const probe = await probeRemoteEngine(host);\n const engineRes: CheckResult = probe.ok\n ? {\n label: 'remote engine',\n status: 'ok',\n detail: `${host} — docker ${probe.version} (${probe.os}/${probe.arch})`,\n }\n : {\n label: 'remote engine',\n status: 'fail',\n detail: probe.error,\n hint: `check that \\`ssh ${host} true\\` works and docker is installed there`,\n };\n\n const prepared = readPreparedState();\n const baked = prepared?.hosts[host];\n const imageRes: CheckResult = baked\n ? {\n label: 'box image',\n status: 'ok',\n detail: `${baked.imageRef} (${baked.cliVersion ?? '—'})`,\n }\n : {\n label: 'box image',\n status: 'warn',\n detail: 'not baked on this host yet',\n hint: `\\`agentbox prepare --provider docker:${host}\\` (otherwise the first create bakes it)`,\n };\n\n // Host Portless mints the <box>.localhost alias for the SSH-forwarded port;\n // without it the box's web URL degrades to a raw loopback port.\n const portlessRes = portlessDoctorRow(await detectPortless());\n return [engineRes, imageRes, portlessRes];\n } catch (err) {\n return [{ label: 'remote engine', status: 'warn', detail: errSummary(err) }];\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,SAAS,gBAAgB;ACFzB,SAAS,oBAAAA,mBAAkB,yBAAyB;AACpD,SAAS,aAAa;AACtB,SAAS,eAAe;ACLxB,SAAS,wBAAwB;AACjC,SAAS,UAAU;AACnB,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,aAAa;AAuCf,SAAS,eAAe,eAA+B;AAC5D,SAAO,gBAAgB,cAAc,MAAM,GAAG,EAAE,CAAC;AACnD;AASA,eAAsB,kBAAkB,eAAuD;AAC7F,QAAM,KAAK,MAAM,gCAAgC,CAAC,CAAC;AACnD,MAAI,CAAC,GAAI,QAAO;AAChB,SAAO,gBACH,yBAAyB,GAAG,eAAe,aAAa,IACxD,GAAG;AACT;AAMA,eAAsB,kBACpB,QACA,OAAiC,CAAC,GACA;AAClC,QAAM,MAAM,KAAK,UAAU,MAAY;EAAC;AAIxC,MAAI,KAAK,YAAY,KAAK,SAAS,KAAK,EAAE,SAAS,GAAG;AACpD,UAAMC,OAAM,KAAK,SAAS,KAAK;AAC/B,UAAM,QAAQ,MAAM,eAAe,QAAQ,CAAC,SAAS,WAAWA,IAAG,CAAC;AACpE,QAAI,MAAM,aAAa,GAAG;AACxB,YAAM,IAAI;QACR,8CAA8CA,IAAG;MAEnD;IACF;AACA,WAAO,EAAE,KAAAA,MAAK,QAAQ,SAAS;EACjC;AAEA,QAAM,MAAM,MAAM,kBAAkB,KAAK,aAAa;AACtD,MAAI,CAAC,KAAK;AACR,UAAM,IAAI;MACR;IACF;EACF;AACA,QAAM,MAAM,eAAe,GAAG;AAE9B,MAAI,CAAC,KAAK,OAAO;AACf,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AC7B,QAAI,CAAC,WAAW;AACd,YAAM,IAAI,MAAM,qBAAqB,IAAI,IAAI,8CAAyC;IACxF;AACA,UAAM,EAAE,OAAO,IAAI,eAAe,SAAS;AAC3C,UAAM,eAAe,iBAAiB,OAAO,MAAM,mBAAmB,IAAI,aAAa,IAAI,CAAC;AAC5F,UAAM,oBAAoB,iBAAiB,EAAE,UAAU,GAAG,YAAY;AAEtE,UAAM,OAAO,MAAM,6BAA6B,IAAI,aAAa,cAAc,MAAM;MACnF;MACA,aAAa,IAAI;MACjB,eAAe,IAAI;MACnB,cAAc;MACd,iBAAiB,4BAA4B,YAAY;MACzD,YAAY,aAAa,EAAE;IAC7B,CAAC;AACD,WAAO,EAAE,KAAK,KAAK,KAAK;EAC1B;EAEA,MAAM,KAAK,aAAqB;AAC9B,UAAM,UAAU,MAAM,qBAAqB,aAAa,YAAY;AACpE,WAAO,QAAQ,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,EAAE,SAAS,UAAU,EAAE;EAC9E;EAEA,MAAM,OAAO,aAAqB,KAAa;AAC7C,UAAM,QAAQ,MAAM,uBAAuB,aAAa,cAAc,GAAG;AACzE,QAAI,CAAC,MAAO;AACZ,UAAM,oBAAoB,iBAAiB,MAAM,SAAS,YAAY;AACtE,UAAM,yBAAyB,aAAa,cAAc,GAAG;EAC/D;AACF;AAEO,IAAM,uBAAiC;EAC5C,GAAG;EACH,aAAa;;;;;EAKb,WAAW;EACX,YAAY;EACZ,SAAS;EACT,iBAAiB,OAAO,kBAAmB,MAAM,kBAAkB,aAAa,KAAM;AACxF;AAGO,IAAM,iBAAiC;EAC5C,UAAU;EACV,SAAS;EACT,4BAA4B,OAAO,kBAChC,MAAM,kBAAkB,aAAa,KAAM;EAC9C;AACF;","names":["createReadStream","ref","createReadStream","CONTAINER_USER","quoteShellArgv","sshOptArgs","sshDestination","quoteShellArg","bashScript","loadEffectiveConfig"]}
@@ -1,3 +0,0 @@
1
- module.exports=[83844,e=>{"use strict";e.s([],33481),e.i(33481);var r=e.i(13906);e.s(["createKyselyAdapter",()=>r.createKyselyAdapter,"kyselyAdapter",()=>r.kyselyAdapter],83844)}];
2
-
3
- //# sourceMappingURL=0-fj_better-auth_dist_adapters_kysely-adapter_index_mjs_0btft52._.js.map
@@ -1,14 +0,0 @@
1
- module.exports=[93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},96253,(e,t,r)=>{"use strict";t.exports=e.r(18622)},85132,(e,t,r)=>{"use strict";t.exports=e.r(96253).vendored["react-rsc"].React},86109,(e,t,r)=>{"use strict";var s=Object.defineProperty,n=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,a={},p={RequestCookies:()=>y,ResponseCookies:()=>g,parseCookie:()=>l,parseSetCookie:()=>u,stringifyCookie:()=>d};for(var c in p)s(a,c,{get:p[c],enumerable:!0});function d(e){var t;let r=["path"in e&&e.path&&`Path=${e.path}`,"expires"in e&&(e.expires||0===e.expires)&&`Expires=${("number"==typeof e.expires?new Date(e.expires):e.expires).toUTCString()}`,"maxAge"in e&&"number"==typeof e.maxAge&&`Max-Age=${e.maxAge}`,"domain"in e&&e.domain&&`Domain=${e.domain}`,"secure"in e&&e.secure&&"Secure","httpOnly"in e&&e.httpOnly&&"HttpOnly","sameSite"in e&&e.sameSite&&`SameSite=${e.sameSite}`,"partitioned"in e&&e.partitioned&&"Partitioned","priority"in e&&e.priority&&`Priority=${e.priority}`].filter(Boolean),s=`${e.name}=${encodeURIComponent(null!=(t=e.value)?t:"")}`;return 0===r.length?s:`${s}; ${r.join("; ")}`}function l(e){let t=new Map;for(let r of e.split(/; */)){if(!r)continue;let e=r.indexOf("=");if(-1===e){t.set(r,"true");continue}let[s,n]=[r.slice(0,e),r.slice(e+1)];try{t.set(s,decodeURIComponent(null!=n?n:"true"))}catch{}}return t}function u(e){if(!e)return;let[[t,r],...s]=l(e),{domain:n,expires:o,httponly:i,maxage:a,path:p,samesite:c,secure:d,partitioned:u,priority:y}=Object.fromEntries(s.map(([e,t])=>[e.toLowerCase().replace(/-/g,""),t]));{var g,b,f={name:t,value:decodeURIComponent(r),domain:n,...o&&{expires:new Date(o)},...i&&{httpOnly:!0},..."string"==typeof a&&{maxAge:Number(a)},path:p,...c&&{sameSite:h.includes(g=(g=c).toLowerCase())?g:void 0},...d&&{secure:!0},...y&&{priority:m.includes(b=(b=y).toLowerCase())?b:void 0},...u&&{partitioned:!0}};let e={};for(let t in f)f[t]&&(e[t]=f[t]);return e}}t.exports=((e,t,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let a of o(t))i.call(e,a)||void 0===a||s(e,a,{get:()=>t[a],enumerable:!(r=n(t,a))||r.enumerable});return e})(s({},"__esModule",{value:!0}),a);var h=["strict","lax","none"],m=["low","medium","high"],y=class{constructor(e){this._parsed=new Map,this._headers=e;const t=e.get("cookie");if(t)for(const[e,r]of l(t))this._parsed.set(e,{name:e,value:r})}[Symbol.iterator](){return this._parsed[Symbol.iterator]()}get size(){return this._parsed.size}get(...e){let t="string"==typeof e[0]?e[0]:e[0].name;return this._parsed.get(t)}getAll(...e){var t;let r=Array.from(this._parsed);if(!e.length)return r.map(([e,t])=>t);let s="string"==typeof e[0]?e[0]:null==(t=e[0])?void 0:t.name;return r.filter(([e])=>e===s).map(([e,t])=>t)}has(e){return this._parsed.has(e)}set(...e){let[t,r]=1===e.length?[e[0].name,e[0].value]:e,s=this._parsed;return s.set(t,{name:t,value:r}),this._headers.set("cookie",Array.from(s).map(([e,t])=>d(t)).join("; ")),this}delete(e){let t=this._parsed,r=Array.isArray(e)?e.map(e=>t.delete(e)):t.delete(e);return this._headers.set("cookie",Array.from(t).map(([e,t])=>d(t)).join("; ")),r}clear(){return this.delete(Array.from(this._parsed.keys())),this}[Symbol.for("edge-runtime.inspect.custom")](){return`RequestCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(e=>`${e.name}=${encodeURIComponent(e.value)}`).join("; ")}},g=class{constructor(e){var t,r,s;this._parsed=new Map,this._headers=e;const n=null!=(s=null!=(r=null==(t=e.getSetCookie)?void 0:t.call(e))?r:e.get("set-cookie"))?s:[];for(const e of Array.isArray(n)?n:function(e){if(!e)return[];var t,r,s,n,o,i=[],a=0;function p(){for(;a<e.length&&/\s/.test(e.charAt(a));)a+=1;return a<e.length}for(;a<e.length;){for(t=a,o=!1;p();)if(","===(r=e.charAt(a))){for(s=a,a+=1,p(),n=a;a<e.length&&"="!==(r=e.charAt(a))&&";"!==r&&","!==r;)a+=1;a<e.length&&"="===e.charAt(a)?(o=!0,a=n,i.push(e.substring(t,s)),t=a):a=s+1}else a+=1;(!o||a>=e.length)&&i.push(e.substring(t,e.length))}return i}(n)){const t=u(e);t&&this._parsed.set(t.name,t)}}get(...e){let t="string"==typeof e[0]?e[0]:e[0].name;return this._parsed.get(t)}getAll(...e){var t;let r=Array.from(this._parsed.values());if(!e.length)return r;let s="string"==typeof e[0]?e[0]:null==(t=e[0])?void 0:t.name;return r.filter(e=>e.name===s)}has(e){return this._parsed.has(e)}set(...e){let[t,r,s]=1===e.length?[e[0].name,e[0].value,e[0]]:e,n=this._parsed;return n.set(t,function(e={name:"",value:""}){return"number"==typeof e.expires&&(e.expires=new Date(e.expires)),e.maxAge&&(e.expires=new Date(Date.now()+1e3*e.maxAge)),(null===e.path||void 0===e.path)&&(e.path="/"),e}({name:t,value:r,...s})),function(e,t){for(let[,r]of(t.delete("set-cookie"),e)){let e=d(r);t.append("set-cookie",e)}}(n,this._headers),this}delete(...e){let[t,r]="string"==typeof e[0]?[e[0]]:[e[0].name,e[0]];return this.set({...r,name:t,value:"",expires:new Date(0)})}[Symbol.for("edge-runtime.inspect.custom")](){return`ResponseCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(d).join("; ")}}},48806,e=>{"use strict";let t={description:"Error",content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}}};e.s(["buildOpenApi",0,function(){return{openapi:"3.1.0",info:{title:"AgentBox Hub API",version:"1.0.0",description:'Launch and manage AgentBox sandboxes ("boxes") programmatically. Every endpoint except /health, /openapi.json and /docs requires an Authorization: Bearer <hub token> header (the token the hub prints on boot, also at ~/.agentbox/hub/token). Errors always return { error: { code, message, details? } }.'},servers:[{url:"/api/v1"}],security:[{bearerAuth:[]}],tags:[{name:"System",description:"Liveness and API version."},{name:"Boxes",description:"Create, inspect, and run lifecycle actions on boxes."},{name:"Box git",description:"Git state and operations on a box's branch."},{name:"Box services",description:"A box's agentbox.yaml service/task/port status."},{name:"Projects",description:"Register folders as projects and list their branches."},{name:"Providers",description:"Sandbox providers: status, credentials, base-image bake."},{name:"Approvals",description:"Pending host-action approvals."},{name:"Jobs",description:"Async create/bake job status and log streams."}],paths:{"/health":{get:{tags:["System"],summary:"Get liveness + API version",security:[],responses:{200:{description:"OK",content:{"application/json":{schema:{$ref:"#/components/schemas/Health"}}}}}}},"/boxes":{get:{tags:["Boxes"],summary:"List boxes",responses:{200:{description:"Boxes",content:{"application/json":{schema:{type:"object",properties:{boxes:{type:"array",items:{$ref:"#/components/schemas/Box"}}},required:["boxes"]}}}},401:t}},post:{tags:["Boxes"],summary:"Create a box",description:'Async — returns a job id. agent "none" just creates the box without starting an agent (prompt ignored). provider defaults to docker; a cloud provider must be configured on the host (see GET /providers).',requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/CreateBox"}}}},responses:{202:{description:"Accepted — build job enqueued",content:{"application/json":{schema:{type:"object",properties:{jobId:{type:"string"}},required:["jobId"]}}}},400:t,401:t,404:t,503:t}}},"/boxes/{id}":{get:{tags:["Boxes"],summary:"Get one box",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}}],responses:{200:{description:"Box",content:{"application/json":{schema:{$ref:"#/components/schemas/Box"}}}},401:t,404:t}}},"/boxes/{id}/{action}":{post:{tags:["Boxes"],summary:"Run a lifecycle action",description:"One of start | pause | resume | stop | destroy | screen. start brings a stopped box back up (resumes if paused, no-op if already running); it does not restart the agent session — that happens on the next attach. screen is the open-VNC prep step: it points the in-box browser at the box’s web app so the VNC desktop shows the app instead of a blank X screen — call it right before opening the box’s vncUrl.",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}},{name:"action",in:"path",required:!0,schema:{type:"string",enum:["start","pause","resume","stop","destroy","screen"]}}],responses:{200:{description:"Done",content:{"application/json":{schema:{type:"object",properties:{ok:{const:!0}},required:["ok"]}}}},400:t,401:t,404:t,409:t,503:t}}},"/boxes/{id}/git":{get:{tags:["Box git"],summary:"Get the box's live git summary",description:"The worktree's current branch, dirty, ahead/behind.",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}}],responses:{200:{description:"Git info",content:{"application/json":{schema:{$ref:"#/components/schemas/GitInfo"}}}},401:t,404:t,503:t}}},"/boxes/{id}/git/{op}":{post:{tags:["Box git"],summary:"Run a git op on the box branch",description:"checkout {branch}; branch {name, from?} (create+switch a new agentbox/* branch); pull {remote?, ffOnly?}; push {remote?, force?}; push-host {as?, force?} (land in the host repo only, publishes nothing).",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}},{name:"op",in:"path",required:!0,schema:{type:"string",enum:["checkout","branch","pull","push","push-host"]}}],requestBody:{required:!1,content:{"application/json":{schema:{$ref:"#/components/schemas/GitOpBody"}}}},responses:{200:{description:"Done (git stdout/stderr)",content:{"application/json":{schema:{$ref:"#/components/schemas/GitOpResult"}}}},400:t,401:t,404:t,409:t,503:t}}},"/boxes/{id}/branches":{get:{tags:["Box git"],summary:"List the box project's branches",description:"Local + remote branches and the current HEAD, for the box git-panel branch picker.",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}}],responses:{200:{description:"Branches",content:{"application/json":{schema:{$ref:"#/components/schemas/BranchList"}}}},400:t,401:t,404:t,503:t}}},"/boxes/{id}/services":{get:{tags:["Box services"],summary:"Get the box's service/task/port status",description:"From the box's agentbox.yaml — live, or the persisted snapshot when the box isn't running.",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}}],responses:{200:{description:"Services",content:{"application/json":{schema:{$ref:"#/components/schemas/Services"}}}},401:t,503:t}}},"/boxes/{id}/services/restart":{post:{tags:["Box services"],summary:"Restart services",description:"Restart one service (body {name}) or every service (empty body).",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}}],requestBody:{required:!1,content:{"application/json":{schema:{type:"object",properties:{name:{type:"string"}}}}}},responses:{200:{description:"Restarted",content:{"application/json":{schema:{type:"object",properties:{ok:{const:!0}},required:["ok"]}}}},400:t,401:t,404:t,409:t,503:t}}},"/boxes/{id}/open":{post:{tags:["Box services"],summary:"Open the box in a host app",description:"Launch the box in a host GUI app (Codex, VS Code/Cursor, cmux, Herdr, iTerm2) by re-shelling `agentbox open --in <app>`. Only works on a localhost hub running on macOS; a remote hub / non-macOS host refuses. An app must be installed and provider-eligible (e.g. Codex is Hetzner-only) — see GET /open-targets.",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}}],requestBody:{required:!0,content:{"application/json":{schema:{type:"object",properties:{app:{type:"string",enum:["codex","herdr","cmux","vscode","iterm2"]}},required:["app"]}}}},responses:{200:{description:"Launched",content:{"application/json":{schema:{type:"object",properties:{ok:{const:!0}},required:["ok"]}}}},400:t,401:t,404:t,409:t,503:t}}},"/open-targets":{get:{tags:["Box services"],summary:"Which host apps this hub can open a box in",description:'Reports whether the hub can launch host GUI apps (`supported` — true only on a localhost hub on macOS) and, if so, which of Codex/Herdr/cmux/VS Code/iTerm2 are installed plus their provider eligibility. Backs the box detail page "Apps" launchers.',responses:{200:{description:"Open targets",content:{"application/json":{schema:{type:"object",properties:{supported:{type:"boolean"},targets:{type:["object","null"],additionalProperties:{type:"object",properties:{available:{type:"boolean"},providers:{type:"array",items:{type:"string"}}},required:["available"]}}},required:["supported","targets"]}}}},401:t}}},"/projects":{get:{tags:["Projects"],summary:"List registered projects",responses:{200:{description:"Projects",content:{"application/json":{schema:{type:"object",properties:{projects:{type:"array",items:{$ref:"#/components/schemas/Project"}}},required:["projects"]}}}},401:t}},post:{tags:["Projects"],summary:"Register a folder as a project",requestBody:{required:!0,content:{"application/json":{schema:{type:"object",properties:{path:{type:"string",description:"Absolute path to the folder."}},required:["path"]}}}},responses:{200:{description:"Registered",content:{"application/json":{schema:{type:"object",properties:{ok:{const:!0}},required:["ok"]}}}},400:t,401:t,503:t}}},"/projects/{id}":{delete:{tags:["Projects"],summary:"Unregister an empty project",description:"Folder/files on disk are untouched.",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}}],responses:{200:{description:"Removed",content:{"application/json":{schema:{type:"object",properties:{ok:{const:!0}},required:["ok"]}}}},401:t,404:t,409:t,503:t}}},"/projects/{id}/branches":{get:{tags:["Projects"],summary:"List a project's branches",description:"Local + remote branches and the current HEAD, for the create-box base-branch picker.",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}}],responses:{200:{description:"Branches",content:{"application/json":{schema:{$ref:"#/components/schemas/BranchList"}}}},400:t,401:t,404:t,503:t}}},"/providers":{get:{tags:["Providers"],summary:"List sandbox providers",description:"With credential + baked status on this host.",responses:{200:{description:"Providers",content:{"application/json":{schema:{type:"object",properties:{providers:{type:"array",items:{$ref:"#/components/schemas/Provider"}}},required:["providers"]}}}},401:t}}},"/providers/{id}/credentials":{post:{tags:["Providers"],summary:"Set a provider's credentials",description:"API keys/tokens, validated then saved to secrets.env. Never echoes secret values.",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string",enum:["docker","daytona","hetzner","vercel","e2b","digitalocean","remote-docker"]}}],requestBody:{required:!0,content:{"application/json":{schema:{type:"object",additionalProperties:{type:"string"},description:"Provider-specific fields, e.g. { apiKey } (e2b), { token } (hetzner), { apiKey } or { jwtToken, organizationId } (daytona), { token, teamId?, projectId? } (vercel)."}}}},responses:{200:{description:"Saved",content:{"application/json":{schema:{type:"object",properties:{ok:{const:!0}},required:["ok"]}}}},400:t,401:t,503:t}}},"/providers/{id}/prepare":{post:{tags:["Providers"],summary:"Bake a provider's base image",description:"Async — returns a job id. Progress streams over GET /jobs/{id}/logs.",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string",enum:["docker","daytona","hetzner","vercel","e2b","digitalocean","remote-docker"]}}],requestBody:{required:!1,content:{"application/json":{schema:{type:"object",properties:{force:{type:"boolean"},claudeInstall:{type:"string",enum:["native","npm"]}}}}}},responses:{202:{description:"Bake enqueued",content:{"application/json":{schema:{type:"object",properties:{jobId:{type:"string"}},required:["jobId"]}}}},400:t,401:t,409:t,503:t}}},"/approvals":{get:{tags:["Approvals"],summary:"List pending host-action approvals",responses:{200:{description:"Approvals",content:{"application/json":{schema:{type:"object",properties:{approvals:{type:"array",items:{$ref:"#/components/schemas/Approval"}}},required:["approvals"]}}}},401:t}}},"/approvals/{id}/answer":{post:{tags:["Approvals"],summary:"Answer a pending approval",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}}],requestBody:{required:!0,content:{"application/json":{schema:{type:"object",properties:{answer:{type:"string",enum:["y","n"]}},required:["answer"]}}}},responses:{200:{description:"Resolved",content:{"application/json":{schema:{type:"object",properties:{ok:{const:!0}},required:["ok"]}}}},400:t,401:t,404:t,503:t}}},"/jobs/{id}":{get:{tags:["Jobs"],summary:"Get a create job status",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}}],responses:{200:{description:"Job",content:{"application/json":{schema:{$ref:"#/components/schemas/Job"}}}},401:t,404:t}}},"/jobs/{id}/logs":{get:{tags:["Jobs"],summary:"Stream a create job log (SSE)",description:"text/event-stream. Emits `open`, then `log` events per line, then a terminal `end` event with the final status.",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}}],responses:{200:{description:"SSE stream",content:{"text/event-stream":{}}},401:t,404:t,503:t}}}},components:{securitySchemes:{bearerAuth:{type:"http",scheme:"bearer",description:"The hub token (Authorization: Bearer <token>)."}},schemas:{Health:{type:"object",properties:{ok:{const:!0},apiVersion:{type:"string"},profile:{type:"string"}},required:["ok","apiVersion"]},Error:{type:"object",properties:{error:{type:"object",properties:{code:{type:"string"},message:{type:"string"},details:{}},required:["code","message"]}},required:["error"]},Box:{type:"object",properties:{id:{type:"string"},projectId:{type:"string"},repo:{type:"string"},branch:{type:"string"},task:{type:"string"},agent:{type:"string"},status:{type:"string",enum:["running","paused","stopped","creating","error"]},createdAt:{type:"number"},lastActivity:{type:"number"},host:{type:"string"},commits:{type:["number","null"]},filesTouched:{type:["number","null"]},error:{type:["string","null"]},displayName:{type:["string","null"],description:"Cosmetic user-set label (rename); null when unset"},webUrl:{type:["string","null"],description:"Host-openable web-service URL; null when absent/unreachable (e.g. paused)"},vncUrl:{type:["string","null"],description:"Host-openable VNC desktop URL; null when absent/unreachable"},state:{type:"string",enum:["running","paused","stopped","missing"],description:"Raw provider runtime state (host topology only). Absent on synthetic creating/error rows — presence distinguishes a real box whose agent errored from a failed create job."},name:{type:"string"},provider:{type:"string",description:"Raw provider id ('docker', 'daytona', …; plugin ids possible)"},projectRoot:{type:"string",description:"Absolute host path of the project. Host topology only — never emitted by the hosted plane"},projectIndex:{type:"number"},vncEnabled:{type:"boolean"},gitWorktrees:{type:"array",items:{type:"object",properties:{kind:{type:"string"},branch:{type:"string"}}}},claudeSessionTitle:{type:"string"},codexSessionTitle:{type:"string"},opencodeSessionTitle:{type:"string"},claudeActivity:{type:"string",description:"working | idle | waiting | end-plan | question | compacting | error | unknown"},codexActivity:{type:"string"}},required:["id","projectId","status","agent"]},Project:{type:"object",properties:{id:{type:"string"},name:{type:"string"},repo:{type:"string"},defaultBranch:{type:"string"},currentBranch:{type:"string",nullable:!0},needsSetup:{type:"boolean",description:"No agentbox.yaml + no default snapshot — the create form offers the setup wizard"},provider:{type:"string"},createdAt:{type:"number"}},required:["id","name"]},BranchList:{type:"object",properties:{current:{type:"string",nullable:!0,description:"The repo's current HEAD (the default base ref)"},branches:{type:"array",items:{type:"string"},description:"Local + remote-tracking branch names"}},required:["branches"]},Approval:{type:"object",properties:{id:{type:"string"},boxId:{type:"string"},message:{type:"string"},detail:{type:"string"},command:{type:"string"},cwd:{type:"string"},argv:{type:"array",items:{type:"string"}},defaultAnswer:{type:"string",enum:["y","n"]},createdAt:{type:"number"}},required:["id","boxId","message","defaultAnswer"]},Job:{type:"object",properties:{id:{type:"string"},status:{type:"string",enum:["queued","running","done","failed","cancelled"]},boxId:{type:"string"}},required:["id","status"]},CreateBox:{type:"object",properties:{projectId:{type:"string"},agent:{type:"string",enum:["claude","codex","opencode","none"]},provider:{type:"string",enum:["docker","daytona","hetzner","vercel","e2b","digitalocean","remote-docker"],default:"docker"},name:{type:"string"},prompt:{type:"string"},fromBranch:{type:"string",description:"Base ref the box's per-box branch forks from (branch / tag / SHA); default the project's HEAD"},setupWizard:{type:"boolean",description:'Seed the agent\'s first turn to generate agentbox.yaml (for projects with none). Inert for agent "none".'}},required:["projectId","agent"]},Provider:{type:"object",properties:{id:{type:"string",enum:["docker","daytona","hetzner","vercel","e2b","digitalocean","remote-docker"]},label:{type:"string"},configured:{type:"boolean",description:"Base image baked (usable for create) on this host."},hasCredentials:{type:"boolean",description:"Credentials present (docker: always true). Can be true while not yet configured (baked)."},jobId:{type:"string",description:"Id of an in-flight bake (prepare) job for this provider, if any."},reason:{type:"string"}},required:["id","label","configured"]},GitOpBody:{type:"object",description:"Union of git-op fields; only those for the chosen {op} are read (extras are ignored).",properties:{branch:{type:"string",description:"checkout: branch to switch to"},name:{type:"string",description:"branch: new branch name (agentbox/ prefix added when missing)"},from:{type:"string",description:"branch: base ref to fork from (default: box's HEAD)"},remote:{type:"string",description:"push/pull: remote name (default: origin)"},force:{type:"boolean",description:"push: force the remote push; push-host: overwrite the destination branch"},ffOnly:{type:"boolean",description:"pull: pass --ff-only to the merge"},as:{type:"string",description:"push-host: destination branch name in the host repo (default: the box's branch)"}}},GitOpResult:{type:"object",properties:{ok:{const:!0},stdout:{type:"string"},stderr:{type:"string"}},required:["ok"]},GitInfo:{type:"object",properties:{ok:{type:"boolean"},branch:{type:"string"},dirty:{type:"boolean"},ahead:{type:"number"},behind:{type:"number"},error:{type:"string"}},required:["ok"]},Services:{type:"object",properties:{source:{type:"string",enum:["live","persisted","unavailable"]},services:{type:"array",items:{type:"object",properties:{name:{type:"string"},state:{type:"string"},pid:{type:["number","null"]},restarts:{type:"number"},lastExitCode:{type:["number","null"]},blockedOn:{type:"array",items:{type:"string"}},command:{type:"string"}},required:["name","state"]}},tasks:{type:"array",items:{type:"object",properties:{name:{type:"string"},state:{type:"string"}},required:["name","state"]}},ports:{type:"array",items:{type:"object",properties:{port:{type:"number"},service:{type:["string","null"]}},required:["port"]}},error:{type:"string"}},required:["source","services","tasks","ports"]}}}}},"docsHtml",0,function(){return`<!doctype html>
2
- <html>
3
- <head>
4
- <title>AgentBox Hub API</title>
5
- <meta charset="utf-8" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1" />
7
- </head>
8
- <body>
9
- <script id="api-reference" data-url="/api/v1/openapi.json"></script>
10
- <script src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"></script>
11
- </body>
12
- </html>`}])},79924,e=>{"use strict";var t=e.i(56710),r=e.i(82809),s=e.i(74001),n=e.i(73300),o=e.i(68744),i=e.i(98570),a=e.i(56147),p=e.i(32931),c=e.i(61810),d=e.i(59963),l=e.i(44491),u=e.i(74916),h=e.i(33073),m=e.i(98603),y=e.i(93317),g=e.i(93695);e.i(95533);var b=e.i(75616),f=e.i(48806);e.s(["GET",0,function(){return Response.json((0,f.buildOpenApi)())},"dynamic",0,"force-dynamic","runtime",0,"nodejs"],59172);var v=e.i(59172);let x=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/(dashboard)/api/v1/openapi.json/route",pathname:"/api/v1/openapi.json",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/apps/hub/app/(dashboard)/api/v1/openapi.json/route.ts",nextConfigOutput:"standalone",userland:v,...{}}),{workAsyncStorage:j,workUnitAsyncStorage:k,serverHooks:w}=x;async function A(e,t,s){s.requestMeta&&(0,n.setRequestMeta)(e,s.requestMeta),x.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let f="/(dashboard)/api/v1/openapi.json/route";f=f.replace(/\/index$/,"")||"/";let v=await x.prepare(e,t,{srcPage:f,multiZoneDraftMode:!1});if(!v)return t.statusCode=400,t.end("Bad Request"),null==s.waitUntil||s.waitUntil.call(s,Promise.resolve()),null;let{buildId:j,deploymentId:k,params:w,nextConfig:A,parsedUrl:q,isDraftMode:R,prerenderManifest:C,routerServerContext:S,isOnDemandRevalidate:E,revalidateOnlyGenerated:B,resolvedPathname:P,clientReferenceManifest:O,serverActionsManifest:_}=v,I=(0,a.normalizeAppPath)(f),T=!!(C.dynamicRoutes[I]||C.routes[P]),$=async()=>((null==S?void 0:S.render404)?await S.render404(e,t,q,!1):t.end("This page could not be found"),null);if(T&&!R){let e=!!C.routes[P],t=C.dynamicRoutes[I];if(t&&!1===t.fallback&&!e){if(A.adapterPath)return await $();throw new g.NoFallbackError}}let H=null;!T||x.isDev||R||(H="/index"===(H=P)?"/":H);let N=!0===x.isDev||!T,U=T&&!N;_&&O&&(0,i.setManifestsSingleton)({page:f,clientReferenceManifest:O,serverActionsManifest:_});let D=e.method||"GET",L=(0,o.getTracer)(),G=L.getActiveScopeSpan(),M=!!(null==S?void 0:S.isWrappedByNextServer),z=!!(0,n.getRequestMeta)(e,"minimalMode"),K=(0,n.getRequestMeta)(e,"incrementalCache")||await x.getIncrementalCache(e,A,C,z);null==K||K.resetRequestCache(),globalThis.__incrementalCache=K;let F={params:w,previewProps:C.preview,renderOpts:{experimental:{authInterrupts:!!A.experimental.authInterrupts},cacheComponents:!!A.cacheComponents,supportsDynamicResponse:N,incrementalCache:K,cacheLifeProfiles:A.cacheLife,waitUntil:s.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,s,n)=>x.onRequestError(e,t,s,n,S)},sharedContext:{buildId:j,deploymentId:k}},V=new p.NodeNextRequest(e),J=new p.NodeNextResponse(t),W=c.NextRequestAdapter.fromNodeNextRequest(V,(0,c.signalFromNodeResponse)(t));try{let n,i=async e=>x.handle(W,F).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=L.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==d.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let s=r.get("next.route");if(s){let t=`${D} ${s}`;e.setAttributes({"next.route":s,"http.route":s,"next.span_name":t}),e.updateName(t),n&&n!==e&&(n.setAttribute("http.route",s),n.updateName(t))}else e.updateName(`${D} ${f}`)}),a=async n=>{var o,a;let p=async({previousCacheEntry:r})=>{try{if(!z&&E&&B&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let o=await i(n);e.fetchMetrics=F.renderOpts.fetchMetrics;let a=F.renderOpts.pendingWaitUntil;a&&s.waitUntil&&(s.waitUntil(a),a=void 0);let p=F.renderOpts.collectedTags;if(!T)return await (0,u.sendResponse)(V,J,o,F.renderOpts.pendingWaitUntil),null;{let e=await o.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(o.headers);p&&(t[y.NEXT_CACHE_TAGS_HEADER]=p),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==F.renderOpts.collectedRevalidate&&!(F.renderOpts.collectedRevalidate>=y.INFINITE_CACHE)&&F.renderOpts.collectedRevalidate,s=void 0===F.renderOpts.collectedExpire||F.renderOpts.collectedExpire>=y.INFINITE_CACHE?void 0:F.renderOpts.collectedExpire;return{value:{kind:b.CachedRouteKind.APP_ROUTE,status:o.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:s}}}}catch(t){throw(null==r?void 0:r.isStale)&&await x.onRequestError(e,t,{routerKind:"App Router",routePath:f,routeType:"route",revalidateReason:(0,l.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:E})},!1,S),t}},c=await x.handleResponse({req:e,nextConfig:A,cacheKey:H,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:C,isRoutePPREnabled:!1,isOnDemandRevalidate:E,revalidateOnlyGenerated:B,responseGenerator:p,waitUntil:s.waitUntil,isMinimalMode:z});if(!T)return null;if((null==c||null==(o=c.value)?void 0:o.kind)!==b.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==c||null==(a=c.value)?void 0:a.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});z||t.setHeader("x-nextjs-cache",E?"REVALIDATED":c.isMiss?"MISS":c.isStale?"STALE":"HIT"),R&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let d=(0,h.fromNodeOutgoingHttpHeaders)(c.value.headers);return z&&T||d.delete(y.NEXT_CACHE_TAGS_HEADER),!c.cacheControl||t.getHeader("Cache-Control")||d.get("Cache-Control")||d.set("Cache-Control",(0,m.getCacheControlHeader)(c.cacheControl)),await (0,u.sendResponse)(V,J,new Response(c.value.body,{headers:d,status:c.value.status||200})),null};M&&G?await a(G):(n=L.getActiveScopeSpan(),await L.withPropagatedContext(e.headers,()=>L.trace(d.BaseServerSpan.handleRequest,{spanName:`${D} ${f}`,kind:o.SpanKind.SERVER,attributes:{"http.method":D,"http.target":e.url}},a),void 0,!M))}catch(t){if(t instanceof g.NoFallbackError||await x.onRequestError(e,t,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,l.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:E})},!1,S),T)throw t;return await (0,u.sendResponse)(V,J,new Response(null,{status:500})),null}}e.s(["handler",0,A,"patchFetch",0,function(){return(0,s.patchFetch)({workAsyncStorage:j,workUnitAsyncStorage:k})},"routeModule",0,x,"serverHooks",0,w,"workAsyncStorage",0,j,"workUnitAsyncStorage",0,k],79924)}];
13
-
14
- //# sourceMappingURL=%5Broot-of-the-server%5D__1bqbkd5._.js.map