@madarco/agentbox 0.21.0 → 0.22.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 (571) hide show
  1. package/CHANGELOG.md +109 -0
  2. package/README.md +32 -0
  3. package/dist/{_cloud-attach-U3QJO7IF.js → _cloud-attach-YH2SU75S.js} +5 -4
  4. package/dist/chunk-ALEYDWAO.js +2561 -0
  5. package/dist/chunk-ALEYDWAO.js.map +1 -0
  6. package/dist/{chunk-QKL7PCXQ.js → chunk-CDEJ2GQK.js} +836 -488
  7. package/dist/chunk-CDEJ2GQK.js.map +1 -0
  8. package/dist/{chunk-PX7G4PSI.js → chunk-GGWVTWJM.js} +65 -34
  9. package/dist/{chunk-PX7G4PSI.js.map → chunk-GGWVTWJM.js.map} +1 -1
  10. package/dist/chunk-KBVD2UUQ.js +1654 -0
  11. package/dist/chunk-KBVD2UUQ.js.map +1 -0
  12. package/dist/{chunk-IXQTUXWV.js → chunk-O2NDZQHN.js} +50 -52
  13. package/dist/{chunk-IXQTUXWV.js.map → chunk-O2NDZQHN.js.map} +1 -1
  14. package/dist/{dist-NWKOEWUJ.js → chunk-O67ZESNL.js} +1059 -109
  15. package/dist/chunk-O67ZESNL.js.map +1 -0
  16. package/dist/chunk-VBSRJG53.js +1241 -0
  17. package/dist/chunk-VBSRJG53.js.map +1 -0
  18. package/dist/{chunk-6JJIKCMY.js → chunk-W2FLHB54.js} +26 -56
  19. package/dist/chunk-W2FLHB54.js.map +1 -0
  20. package/dist/{chunk-YZVFGFYQ.js → chunk-YZXXBHWG.js} +1937 -2975
  21. package/dist/chunk-YZXXBHWG.js.map +1 -0
  22. package/dist/{dist-SAS4PIHA.js → dist-EJXUKIR7.js} +41 -36
  23. package/dist/{dist-UVQJ2BZJ.js → dist-LJHS4PTC.js} +112 -62
  24. package/dist/dist-LJHS4PTC.js.map +1 -0
  25. package/dist/dist-QBXEP4VY.js +89 -0
  26. package/dist/dist-QNV4H6NN.js +80 -0
  27. package/dist/dist-QNV4H6NN.js.map +1 -0
  28. package/dist/{dist-FMA5Y25B.js → dist-UR2DB2HT.js} +83 -9
  29. package/dist/dist-UR2DB2HT.js.map +1 -0
  30. package/dist/dist-YECTRVGD.js +102 -0
  31. package/dist/dist-YECTRVGD.js.map +1 -0
  32. package/dist/index.js +3243 -1448
  33. package/dist/index.js.map +1 -1
  34. package/dist/{prepared-state-MQHD3M5F-YYVVMTNJ.js → prepared-state-5FIGV4BE-BMUK63FD.js} +2 -2
  35. package/dist/prepared-state-5FIGV4BE-BMUK63FD.js.map +1 -0
  36. package/package.json +12 -5
  37. package/runtime/_shared/agentbox-checkpoint-cleanup +55 -0
  38. package/runtime/_shared/agentbox-codex-hooks.json +68 -0
  39. package/runtime/_shared/agentbox-dockerd-start +145 -0
  40. package/runtime/_shared/agentbox-open +28 -0
  41. package/runtime/_shared/agentbox-portless-trust +82 -0
  42. package/runtime/_shared/agentbox-setup-skill.md +317 -0
  43. package/runtime/_shared/agentbox-vnc-start +102 -0
  44. package/runtime/_shared/claude-managed-settings.json +116 -0
  45. package/runtime/_shared/ctl.cjs +27469 -0
  46. package/runtime/_shared/gh-shim +344 -0
  47. package/runtime/_shared/git-shim +131 -0
  48. package/runtime/_shared/linear-shim +181 -0
  49. package/runtime/_shared/ntn-shim +95 -0
  50. package/runtime/_shared/opencode-agentbox-plugin.js +76 -0
  51. package/runtime/docker/Dockerfile.box +30 -17
  52. package/runtime/docker/packages/ctl/dist/bin.cjs +11871 -10351
  53. package/runtime/e2b/ctl.cjs +11871 -10351
  54. package/runtime/e2b/scripts/build-template.sh +31 -15
  55. package/runtime/hetzner/ctl.cjs +11871 -10351
  56. package/runtime/hetzner/scripts/install-box.sh +37 -19
  57. package/runtime/hub/apps/hub/.next/BUILD_ID +1 -0
  58. package/runtime/hub/apps/hub/.next/app-path-routes-manifest.json +36 -0
  59. package/runtime/hub/apps/hub/.next/build-manifest.json +21 -0
  60. package/runtime/hub/apps/hub/.next/package.json +1 -0
  61. package/runtime/hub/apps/hub/.next/prerender-manifest.json +36 -0
  62. package/runtime/hub/apps/hub/.next/required-server-files.json +350 -0
  63. package/runtime/hub/apps/hub/.next/routes-manifest.json +292 -0
  64. package/runtime/hub/apps/hub/.next/server/app/(auth)/api/auth/[...all]/route/app-paths-manifest.json +3 -0
  65. package/runtime/hub/apps/hub/.next/server/app/(auth)/api/auth/[...all]/route/build-manifest.json +9 -0
  66. package/runtime/hub/apps/hub/.next/server/app/(auth)/api/auth/[...all]/route/server-reference-manifest.json +4 -0
  67. package/runtime/hub/apps/hub/.next/server/app/(auth)/api/auth/[...all]/route.js +13 -0
  68. package/runtime/hub/apps/hub/.next/server/app/(auth)/api/auth/[...all]/route.js.map +5 -0
  69. package/runtime/hub/apps/hub/.next/server/app/(auth)/api/auth/[...all]/route.js.nft.json +1 -0
  70. package/runtime/hub/apps/hub/.next/server/app/(auth)/api/auth/[...all]/route_client-reference-manifest.js +3 -0
  71. package/runtime/hub/apps/hub/.next/server/app/(auth)/signin/page/app-paths-manifest.json +3 -0
  72. package/runtime/hub/apps/hub/.next/server/app/(auth)/signin/page/build-manifest.json +17 -0
  73. package/runtime/hub/apps/hub/.next/server/app/(auth)/signin/page/next-font-manifest.json +13 -0
  74. package/runtime/hub/apps/hub/.next/server/app/(auth)/signin/page/react-loadable-manifest.json +1 -0
  75. package/runtime/hub/apps/hub/.next/server/app/(auth)/signin/page/server-reference-manifest.json +4 -0
  76. package/runtime/hub/apps/hub/.next/server/app/(auth)/signin/page.js +14 -0
  77. package/runtime/hub/apps/hub/.next/server/app/(auth)/signin/page.js.map +5 -0
  78. package/runtime/hub/apps/hub/.next/server/app/(auth)/signin/page.js.nft.json +1 -0
  79. package/runtime/hub/apps/hub/.next/server/app/(auth)/signin/page_client-reference-manifest.js +3 -0
  80. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/events/route/app-paths-manifest.json +3 -0
  81. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/events/route/build-manifest.json +9 -0
  82. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/events/route/server-reference-manifest.json +4 -0
  83. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/events/route.js +7 -0
  84. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/events/route.js.map +5 -0
  85. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/events/route.js.nft.json +1 -0
  86. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/events/route_client-reference-manifest.js +3 -0
  87. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/jobs/[id]/logs/route/app-paths-manifest.json +3 -0
  88. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/jobs/[id]/logs/route/build-manifest.json +9 -0
  89. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/jobs/[id]/logs/route/server-reference-manifest.json +4 -0
  90. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/jobs/[id]/logs/route.js +7 -0
  91. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/jobs/[id]/logs/route.js.map +5 -0
  92. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/jobs/[id]/logs/route.js.nft.json +1 -0
  93. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/jobs/[id]/logs/route_client-reference-manifest.js +3 -0
  94. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/[id]/answer/route/app-paths-manifest.json +3 -0
  95. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/[id]/answer/route/build-manifest.json +9 -0
  96. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/[id]/answer/route/server-reference-manifest.json +4 -0
  97. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/[id]/answer/route.js +9 -0
  98. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/[id]/answer/route.js.map +5 -0
  99. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/[id]/answer/route.js.nft.json +1 -0
  100. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/[id]/answer/route_client-reference-manifest.js +3 -0
  101. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/route/app-paths-manifest.json +3 -0
  102. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/route/build-manifest.json +9 -0
  103. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/route/server-reference-manifest.json +4 -0
  104. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/route.js +8 -0
  105. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/route.js.map +5 -0
  106. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/route.js.nft.json +1 -0
  107. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/route_client-reference-manifest.js +3 -0
  108. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/[action]/route/app-paths-manifest.json +3 -0
  109. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/[action]/route/build-manifest.json +9 -0
  110. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/[action]/route/server-reference-manifest.json +4 -0
  111. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/[action]/route.js +9 -0
  112. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/[action]/route.js.map +5 -0
  113. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/[action]/route.js.nft.json +1 -0
  114. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/[action]/route_client-reference-manifest.js +3 -0
  115. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/branches/route/app-paths-manifest.json +3 -0
  116. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/branches/route/build-manifest.json +9 -0
  117. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/branches/route/server-reference-manifest.json +4 -0
  118. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/branches/route.js +8 -0
  119. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/branches/route.js.map +5 -0
  120. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/branches/route.js.nft.json +1 -0
  121. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/branches/route_client-reference-manifest.js +3 -0
  122. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/[op]/route/app-paths-manifest.json +3 -0
  123. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/[op]/route/build-manifest.json +9 -0
  124. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/[op]/route/server-reference-manifest.json +4 -0
  125. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/[op]/route.js +9 -0
  126. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/[op]/route.js.map +5 -0
  127. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/[op]/route.js.nft.json +1 -0
  128. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/[op]/route_client-reference-manifest.js +3 -0
  129. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/route/app-paths-manifest.json +3 -0
  130. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/route/build-manifest.json +9 -0
  131. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/route/server-reference-manifest.json +4 -0
  132. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/route.js +8 -0
  133. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/route.js.map +5 -0
  134. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/route.js.nft.json +1 -0
  135. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/route_client-reference-manifest.js +3 -0
  136. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/route/app-paths-manifest.json +3 -0
  137. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/route/build-manifest.json +9 -0
  138. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/route/server-reference-manifest.json +4 -0
  139. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/route.js +8 -0
  140. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/route.js.map +5 -0
  141. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/route.js.nft.json +1 -0
  142. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/route_client-reference-manifest.js +3 -0
  143. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/restart/route/app-paths-manifest.json +3 -0
  144. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/restart/route/build-manifest.json +9 -0
  145. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/restart/route/server-reference-manifest.json +4 -0
  146. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/restart/route.js +9 -0
  147. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/restart/route.js.map +5 -0
  148. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/restart/route.js.nft.json +1 -0
  149. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/restart/route_client-reference-manifest.js +3 -0
  150. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/route/app-paths-manifest.json +3 -0
  151. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/route/build-manifest.json +9 -0
  152. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/route/server-reference-manifest.json +4 -0
  153. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/route.js +8 -0
  154. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/route.js.map +5 -0
  155. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/route.js.nft.json +1 -0
  156. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/route_client-reference-manifest.js +3 -0
  157. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/route/app-paths-manifest.json +3 -0
  158. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/route/build-manifest.json +9 -0
  159. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/route/server-reference-manifest.json +4 -0
  160. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/route.js +9 -0
  161. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/route.js.map +5 -0
  162. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/route.js.nft.json +1 -0
  163. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/route_client-reference-manifest.js +3 -0
  164. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/docs/route/app-paths-manifest.json +3 -0
  165. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/docs/route/build-manifest.json +9 -0
  166. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/docs/route/server-reference-manifest.json +4 -0
  167. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/docs/route.js +7 -0
  168. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/docs/route.js.map +5 -0
  169. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/docs/route.js.nft.json +1 -0
  170. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/docs/route_client-reference-manifest.js +3 -0
  171. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/health/route/app-paths-manifest.json +3 -0
  172. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/health/route/build-manifest.json +9 -0
  173. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/health/route/server-reference-manifest.json +4 -0
  174. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/health/route.js +8 -0
  175. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/health/route.js.map +5 -0
  176. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/health/route.js.nft.json +1 -0
  177. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/health/route_client-reference-manifest.js +3 -0
  178. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/login-code/route/app-paths-manifest.json +3 -0
  179. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/login-code/route/build-manifest.json +9 -0
  180. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/login-code/route/server-reference-manifest.json +4 -0
  181. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/login-code/route.js +9 -0
  182. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/login-code/route.js.map +5 -0
  183. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/login-code/route.js.nft.json +1 -0
  184. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/login-code/route_client-reference-manifest.js +3 -0
  185. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/logs/route/app-paths-manifest.json +3 -0
  186. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/logs/route/build-manifest.json +9 -0
  187. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/logs/route/server-reference-manifest.json +4 -0
  188. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/logs/route.js +8 -0
  189. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/logs/route.js.map +5 -0
  190. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/logs/route.js.nft.json +1 -0
  191. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/logs/route_client-reference-manifest.js +3 -0
  192. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/route/app-paths-manifest.json +3 -0
  193. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/route/build-manifest.json +9 -0
  194. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/route/server-reference-manifest.json +4 -0
  195. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/route.js +8 -0
  196. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/route.js.map +5 -0
  197. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/route.js.nft.json +1 -0
  198. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/route_client-reference-manifest.js +3 -0
  199. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/openapi.json/route/app-paths-manifest.json +3 -0
  200. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/openapi.json/route/build-manifest.json +9 -0
  201. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/openapi.json/route/server-reference-manifest.json +4 -0
  202. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/openapi.json/route.js +7 -0
  203. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/openapi.json/route.js.map +5 -0
  204. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/openapi.json/route.js.nft.json +1 -0
  205. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/openapi.json/route_client-reference-manifest.js +3 -0
  206. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/branches/route/app-paths-manifest.json +3 -0
  207. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/branches/route/build-manifest.json +9 -0
  208. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/branches/route/server-reference-manifest.json +4 -0
  209. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/branches/route.js +8 -0
  210. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/branches/route.js.map +5 -0
  211. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/branches/route.js.nft.json +1 -0
  212. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/branches/route_client-reference-manifest.js +3 -0
  213. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/route/app-paths-manifest.json +3 -0
  214. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/route/build-manifest.json +9 -0
  215. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/route/server-reference-manifest.json +4 -0
  216. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/route.js +8 -0
  217. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/route.js.map +5 -0
  218. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/route.js.nft.json +1 -0
  219. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/route_client-reference-manifest.js +3 -0
  220. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/route/app-paths-manifest.json +3 -0
  221. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/route/build-manifest.json +9 -0
  222. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/route/server-reference-manifest.json +4 -0
  223. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/route.js +9 -0
  224. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/route.js.map +5 -0
  225. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/route.js.nft.json +1 -0
  226. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/route_client-reference-manifest.js +3 -0
  227. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/credentials/route/app-paths-manifest.json +3 -0
  228. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/credentials/route/build-manifest.json +9 -0
  229. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/credentials/route/server-reference-manifest.json +4 -0
  230. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/credentials/route.js +9 -0
  231. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/credentials/route.js.map +5 -0
  232. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/credentials/route.js.nft.json +1 -0
  233. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/credentials/route_client-reference-manifest.js +3 -0
  234. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/prepare/route/app-paths-manifest.json +3 -0
  235. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/prepare/route/build-manifest.json +9 -0
  236. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/prepare/route/server-reference-manifest.json +4 -0
  237. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/prepare/route.js +9 -0
  238. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/prepare/route.js.map +5 -0
  239. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/prepare/route.js.nft.json +1 -0
  240. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/prepare/route_client-reference-manifest.js +3 -0
  241. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/route/app-paths-manifest.json +3 -0
  242. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/route/build-manifest.json +9 -0
  243. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/route/server-reference-manifest.json +4 -0
  244. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/route.js +8 -0
  245. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/route.js.map +5 -0
  246. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/route.js.nft.json +1 -0
  247. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/route_client-reference-manifest.js +3 -0
  248. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page/app-paths-manifest.json +3 -0
  249. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page/build-manifest.json +17 -0
  250. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page/next-font-manifest.json +13 -0
  251. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page/react-loadable-manifest.json +1 -0
  252. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page/server-reference-manifest.json +17 -0
  253. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page.js +17 -0
  254. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page.js.map +5 -0
  255. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page.js.nft.json +1 -0
  256. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page_client-reference-manifest.js +3 -0
  257. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page/app-paths-manifest.json +3 -0
  258. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page/build-manifest.json +17 -0
  259. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page/next-font-manifest.json +13 -0
  260. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page/react-loadable-manifest.json +1 -0
  261. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page/server-reference-manifest.json +137 -0
  262. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page.js +17 -0
  263. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page.js.map +5 -0
  264. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page.js.nft.json +1 -0
  265. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page_client-reference-manifest.js +3 -0
  266. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page/app-paths-manifest.json +3 -0
  267. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page/build-manifest.json +17 -0
  268. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page/next-font-manifest.json +13 -0
  269. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page/react-loadable-manifest.json +1 -0
  270. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page/server-reference-manifest.json +125 -0
  271. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page.js +17 -0
  272. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page.js.map +5 -0
  273. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page.js.nft.json +1 -0
  274. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page_client-reference-manifest.js +3 -0
  275. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page/app-paths-manifest.json +3 -0
  276. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page/build-manifest.json +17 -0
  277. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page/next-font-manifest.json +13 -0
  278. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page/react-loadable-manifest.json +1 -0
  279. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page/server-reference-manifest.json +89 -0
  280. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page.js +17 -0
  281. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page.js.map +5 -0
  282. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page.js.nft.json +1 -0
  283. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page_client-reference-manifest.js +3 -0
  284. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page/app-paths-manifest.json +3 -0
  285. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page/build-manifest.json +17 -0
  286. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page/next-font-manifest.json +13 -0
  287. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page/react-loadable-manifest.json +1 -0
  288. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page/server-reference-manifest.json +4 -0
  289. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page.js +16 -0
  290. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page.js.map +5 -0
  291. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page.js.nft.json +1 -0
  292. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page_client-reference-manifest.js +3 -0
  293. package/runtime/hub/apps/hub/.next/server/app/[...path]/route/app-paths-manifest.json +3 -0
  294. package/runtime/hub/apps/hub/.next/server/app/[...path]/route/build-manifest.json +9 -0
  295. package/runtime/hub/apps/hub/.next/server/app/[...path]/route/server-reference-manifest.json +4 -0
  296. package/runtime/hub/apps/hub/.next/server/app/[...path]/route.js +8 -0
  297. package/runtime/hub/apps/hub/.next/server/app/[...path]/route.js.map +5 -0
  298. package/runtime/hub/apps/hub/.next/server/app/[...path]/route.js.nft.json +1 -0
  299. package/runtime/hub/apps/hub/.next/server/app/[...path]/route_client-reference-manifest.js +3 -0
  300. package/runtime/hub/apps/hub/.next/server/app/_global-error/page/app-paths-manifest.json +3 -0
  301. package/runtime/hub/apps/hub/.next/server/app/_global-error/page/build-manifest.json +17 -0
  302. package/runtime/hub/apps/hub/.next/server/app/_global-error/page/next-font-manifest.json +6 -0
  303. package/runtime/hub/apps/hub/.next/server/app/_global-error/page/react-loadable-manifest.json +1 -0
  304. package/runtime/hub/apps/hub/.next/server/app/_global-error/page/server-reference-manifest.json +4 -0
  305. package/runtime/hub/apps/hub/.next/server/app/_global-error/page.js +10 -0
  306. package/runtime/hub/apps/hub/.next/server/app/_global-error/page.js.map +5 -0
  307. package/runtime/hub/apps/hub/.next/server/app/_global-error/page.js.nft.json +1 -0
  308. package/runtime/hub/apps/hub/.next/server/app/_global-error/page_client-reference-manifest.js +3 -0
  309. package/runtime/hub/apps/hub/.next/server/app/_global-error.html +1 -0
  310. package/runtime/hub/apps/hub/.next/server/app/_global-error.meta +15 -0
  311. package/runtime/hub/apps/hub/.next/server/app/_global-error.rsc +14 -0
  312. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +5 -0
  313. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_full.segment.rsc +14 -0
  314. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_head.segment.rsc +5 -0
  315. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_index.segment.rsc +5 -0
  316. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -0
  317. package/runtime/hub/apps/hub/.next/server/app/_not-found/page/app-paths-manifest.json +3 -0
  318. package/runtime/hub/apps/hub/.next/server/app/_not-found/page/build-manifest.json +17 -0
  319. package/runtime/hub/apps/hub/.next/server/app/_not-found/page/next-font-manifest.json +13 -0
  320. package/runtime/hub/apps/hub/.next/server/app/_not-found/page/react-loadable-manifest.json +1 -0
  321. package/runtime/hub/apps/hub/.next/server/app/_not-found/page/server-reference-manifest.json +4 -0
  322. package/runtime/hub/apps/hub/.next/server/app/_not-found/page.js +13 -0
  323. package/runtime/hub/apps/hub/.next/server/app/_not-found/page.js.map +5 -0
  324. package/runtime/hub/apps/hub/.next/server/app/_not-found/page.js.nft.json +1 -0
  325. package/runtime/hub/apps/hub/.next/server/app/_not-found/page_client-reference-manifest.js +3 -0
  326. package/runtime/hub/apps/hub/.next/server/app-paths-manifest.json +36 -0
  327. package/runtime/hub/apps/hub/.next/server/chunks/01te_@better-auth_kysely-adapter_dist_0jw_ngm._.js +3 -0
  328. package/runtime/hub/apps/hub/.next/server/chunks/01te_@better-auth_kysely-adapter_dist_0z6cvsk._.js +3 -0
  329. package/runtime/hub/apps/hub/.next/server/chunks/01te_@better-auth_kysely-adapter_dist_210bxd8._.js +3 -0
  330. package/runtime/hub/apps/hub/.next/server/chunks/01te_@better-auth_kysely-adapter_dist_index_mjs_0h-j5xt._.js +4 -0
  331. package/runtime/hub/apps/hub/.next/server/chunks/044u_hub__next-internal_server_app_(auth)_api_auth_[___all]_route_actions_1agi0ag.js +3 -0
  332. package/runtime/hub/apps/hub/.next/server/chunks/044u_hub__next-internal_server_app_(dashboard)_api_v1_boxes_route_actions_1ggp_5o.js +3 -0
  333. package/runtime/hub/apps/hub/.next/server/chunks/044u_hub__next-internal_server_app_(dashboard)_api_v1_health_route_actions_017gnzg.js +3 -0
  334. package/runtime/hub/apps/hub/.next/server/chunks/044u_hub__next-internal_server_app_(dashboard)_api_v1_projects_route_actions_04w8ozk.js +3 -0
  335. package/runtime/hub/apps/hub/.next/server/chunks/09mp_@better-auth_memory-adapter_dist_index_mjs_0ti_30h._.js +3 -0
  336. package/runtime/hub/apps/hub/.next/server/chunks/09xn_next_0tn6frk._.js +6 -0
  337. package/runtime/hub/apps/hub/.next/server/chunks/0d-b_next_dist_server_app-render_after-task-async-storage_external_0-exn7p.js +3 -0
  338. package/runtime/hub/apps/hub/.next/server/chunks/0m4a_kysely_dist_095p8vu._.js +3 -0
  339. package/runtime/hub/apps/hub/.next/server/chunks/0m4a_kysely_dist_1skbhvx._.js +3 -0
  340. package/runtime/hub/apps/hub/.next/server/chunks/0sj1_@opentelemetry_api_build_esm_index_0xy-j06.js +3 -0
  341. package/runtime/hub/apps/hub/.next/server/chunks/0ssw__next-internal_server_app_(dashboard)_api_jobs_[id]_logs_route_actions_01aqmf3.js +3 -0
  342. package/runtime/hub/apps/hub/.next/server/chunks/0ssw__next-internal_server_app_(dashboard)_api_v1_approvals_route_actions_1vwxs9a.js +3 -0
  343. package/runtime/hub/apps/hub/.next/server/chunks/0ssw__next-internal_server_app_(dashboard)_api_v1_boxes_[id]_route_actions_01510xg.js +3 -0
  344. package/runtime/hub/apps/hub/.next/server/chunks/0ssw__next-internal_server_app_(dashboard)_api_v1_jobs_[id]_route_actions_0oc630h.js +3 -0
  345. package/runtime/hub/apps/hub/.next/server/chunks/0ssw__next-internal_server_app_(dashboard)_api_v1_openapi_json_route_actions_1lunxjz.js +3 -0
  346. package/runtime/hub/apps/hub/.next/server/chunks/0ssw__next-internal_server_app_(dashboard)_api_v1_providers_route_actions_1666ry8.js +3 -0
  347. package/runtime/hub/apps/hub/.next/server/chunks/0web_next-internal_server_app_(dashboard)_api_v1_projects_[id]_route_actions_1beikpx.js +3 -0
  348. package/runtime/hub/apps/hub/.next/server/chunks/0zhp_better-auth_dist_adapters_kysely-adapter_index_mjs_1rl4qnh._.js +3 -0
  349. package/runtime/hub/apps/hub/.next/server/chunks/151__@better-auth_core_dist_0ecdp_3._.js +5 -0
  350. package/runtime/hub/apps/hub/.next/server/chunks/1jcg_server_app_(dashboard)_api_v1_approvals_[id]_answer_route_actions_1cq4z5x.js +3 -0
  351. package/runtime/hub/apps/hub/.next/server/chunks/1jcg_server_app_(dashboard)_api_v1_boxes_[id]_[action]_route_actions_0cib0ju.js +3 -0
  352. package/runtime/hub/apps/hub/.next/server/chunks/1jcg_server_app_(dashboard)_api_v1_boxes_[id]_branches_route_actions_15snjix.js +3 -0
  353. package/runtime/hub/apps/hub/.next/server/chunks/1jcg_server_app_(dashboard)_api_v1_boxes_[id]_git_[op]_route_actions_116a41w.js +3 -0
  354. package/runtime/hub/apps/hub/.next/server/chunks/1jcg_server_app_(dashboard)_api_v1_boxes_[id]_git_route_actions_1a-q-i2.js +3 -0
  355. package/runtime/hub/apps/hub/.next/server/chunks/1jcg_server_app_(dashboard)_api_v1_boxes_[id]_services_restart_route_actions_1yvsbmm.js +3 -0
  356. package/runtime/hub/apps/hub/.next/server/chunks/1jcg_server_app_(dashboard)_api_v1_boxes_[id]_services_route_actions_1uvv36v.js +3 -0
  357. package/runtime/hub/apps/hub/.next/server/chunks/1jcg_server_app_(dashboard)_api_v1_jobs_[id]_login-code_route_actions_1825jmw.js +3 -0
  358. package/runtime/hub/apps/hub/.next/server/chunks/1jcg_server_app_(dashboard)_api_v1_jobs_[id]_logs_route_actions_0msc0_w.js +3 -0
  359. package/runtime/hub/apps/hub/.next/server/chunks/1jcg_server_app_(dashboard)_api_v1_projects_[id]_branches_route_actions_07i0vrw.js +3 -0
  360. package/runtime/hub/apps/hub/.next/server/chunks/1jcg_server_app_(dashboard)_api_v1_providers_[id]_credentials_route_actions_1cds5re.js +3 -0
  361. package/runtime/hub/apps/hub/.next/server/chunks/1jcg_server_app_(dashboard)_api_v1_providers_[id]_prepare_route_actions_079fbng.js +3 -0
  362. package/runtime/hub/apps/hub/.next/server/chunks/[externals]__12m3qoa._.js +3 -0
  363. package/runtime/hub/apps/hub/.next/server/chunks/[externals]_pg_15jfwkh._.js +3 -0
  364. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__04h15ml._.js +3 -0
  365. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__04jgk9x._.js +3 -0
  366. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__07ednlo._.js +3 -0
  367. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0d1lmiq._.js +105 -0
  368. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0ig1bot._.js +3 -0
  369. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0keu6we._.js +3 -0
  370. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0ql4fjo._.js +3 -0
  371. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0se1fty._.js +3 -0
  372. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0t7o5ed._.js +3 -0
  373. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0vs8fma._.js +3 -0
  374. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0vxaujy._.js +6 -0
  375. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0w9ud8u._.js +3 -0
  376. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0yhb0gc._.js +3 -0
  377. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1-9g0ae._.js +461 -0
  378. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__13jwk_k._.js +3 -0
  379. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__16_uteg._.js +3 -0
  380. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__16p2m-g._.js +3 -0
  381. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__19pc87s._.js +3 -0
  382. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1_gu2yk._.js +3 -0
  383. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1ai-945._.js +3 -0
  384. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1bqbkd5._.js +14 -0
  385. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1bu2zio._.js +3 -0
  386. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1ctczev._.js +3 -0
  387. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1d6mtlk._.js +3 -0
  388. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1d75vsx._.js +6 -0
  389. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1dn_3i1._.js +3 -0
  390. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1e4z_-v._.js +3 -0
  391. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1f2sueq._.js +3 -0
  392. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1f9zctr._.js +3 -0
  393. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1hqla7-._.js +3 -0
  394. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1js2jdv._.js +3 -0
  395. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1mttufy._.js +3 -0
  396. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1nepkp-._.js +6 -0
  397. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1pp5oib._.js +3 -0
  398. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1q5bqse._.js +3 -0
  399. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1qa4a0v._.js +14 -0
  400. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1qwhzmi._.js +3 -0
  401. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1v9om6g._.js +3 -0
  402. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1xeczo7._.js +3 -0
  403. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__20503l7._.js +3 -0
  404. package/runtime/hub/apps/hub/.next/server/chunks/[turbopack]_runtime.js +903 -0
  405. package/runtime/hub/apps/hub/.next/server/chunks/_033w048._.js +3 -0
  406. package/runtime/hub/apps/hub/.next/server/chunks/_06f2faq._.js +3 -0
  407. package/runtime/hub/apps/hub/.next/server/chunks/_0760z6y._.js +27 -0
  408. package/runtime/hub/apps/hub/.next/server/chunks/_0pyhcqe._.js +3 -0
  409. package/runtime/hub/apps/hub/.next/server/chunks/_1-42ili._.js +3 -0
  410. package/runtime/hub/apps/hub/.next/server/chunks/_11__3wi._.js +3 -0
  411. package/runtime/hub/apps/hub/.next/server/chunks/_12flzuh._.js +3 -0
  412. package/runtime/hub/apps/hub/.next/server/chunks/_1rpkqst._.js +3 -0
  413. package/runtime/hub/apps/hub/.next/server/chunks/_1wt72m1._.js +3 -0
  414. package/runtime/hub/apps/hub/.next/server/chunks/_1x3l5t8._.js +3 -0
  415. package/runtime/hub/apps/hub/.next/server/chunks/apps_hub__next-internal_server_app_(dashboard)_api_events_route_actions_17s9lxs.js +3 -0
  416. package/runtime/hub/apps/hub/.next/server/chunks/apps_hub__next-internal_server_app_(dashboard)_api_v1_docs_route_actions_0d-s_oo.js +3 -0
  417. package/runtime/hub/apps/hub/.next/server/chunks/apps_hub__next-internal_server_app_[___path]_route_actions_1hdraye.js +3 -0
  418. package/runtime/hub/apps/hub/.next/server/chunks/packages_relay_dist_control-plane_03a-9aj.js +86 -0
  419. package/runtime/hub/apps/hub/.next/server/chunks/ssr/044u_hub__next-internal_server_app_(dashboard)_projects_[id]_page_actions_15f56np.js +3 -0
  420. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_0iwlo01._.js +6 -0
  421. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_0xy-j7z._.js +3 -0
  422. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_client_components_20xzgz2._.js +3 -0
  423. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_client_components_builtin_forbidden_1x5yo9-.js +3 -0
  424. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_client_components_builtin_global-error_14poel6.js +3 -0
  425. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_client_components_builtin_unauthorized_0vj9qge.js +3 -0
  426. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_010858m.js +4 -0
  427. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_04zwxnx.js +4 -0
  428. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_06exuc7.js +4 -0
  429. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_0f2ldrt.js +4 -0
  430. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_0f2tzep.js +4 -0
  431. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_116nh32.js +4 -0
  432. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_11dyjcb.js +4 -0
  433. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_1_4knli.js +4 -0
  434. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[externals]_pg_15jfwkh._.js +3 -0
  435. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[externals]_pg_20c820g._.js +3 -0
  436. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__03-x9xy._.js +19 -0
  437. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__08-1wwu._.js +3 -0
  438. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__0c9mbcn._.js +3 -0
  439. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__0cpdgd0._.js +33 -0
  440. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__0gdfxj4._.js +3 -0
  441. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__0j0tjwn._.js +3 -0
  442. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__0kc-hwp._.js +3 -0
  443. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__0lu73p6._.js +3 -0
  444. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__10bfmwi._.js +3 -0
  445. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__18qvdzb._.js +33 -0
  446. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__1bq2f8q._.js +3 -0
  447. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__1c1x9zr._.js +3 -0
  448. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__1he4k-q._.js +3 -0
  449. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__1l2urlw._.js +3 -0
  450. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[turbopack]_runtime.js +903 -0
  451. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_04br1ft._.js +6 -0
  452. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_09gdzmo._.js +3 -0
  453. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0kpdmm-._.js +3 -0
  454. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0ozyjt1._.js +21 -0
  455. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0ro6vh6._.js +27 -0
  456. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0tgpglr._.js +3 -0
  457. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_1laion6._.js +3 -0
  458. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_0_lzzn3._.js +3 -0
  459. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_0b_hsjl._.js +3 -0
  460. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub__next-internal_server_app_(auth)_signin_page_actions_1vmiwl7.js +3 -0
  461. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub__next-internal_server_app_(dashboard)_approvals_page_actions_1mi0bpn.js +3 -0
  462. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub__next-internal_server_app_(dashboard)_boxes_[id]_page_actions_0k7kgn2.js +3 -0
  463. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub__next-internal_server_app_(dashboard)_page_actions_1t3u0xy.js +3 -0
  464. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub__next-internal_server_app_(dashboard)_settings_page_actions_0ti7gxm.js +3 -0
  465. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub__next-internal_server_app__global-error_page_actions_1ofuxm1.js +3 -0
  466. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub__next-internal_server_app__not-found_page_actions_1fmdkci.js +3 -0
  467. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_app_(dashboard)_boxes_[id]_page_tsx_1-j_972._.js +3 -0
  468. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_app_(dashboard)_boxes_components_box-table_tsx_0a9pyn_._.js +3 -0
  469. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_components_1z1p98f._.js +3 -0
  470. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_lib_auth_client_ts_1uxjxr_._.js +3 -0
  471. package/runtime/hub/apps/hub/.next/server/chunks/ssr/node_modules__pnpm_04qfi10._.js +3 -0
  472. package/runtime/hub/apps/hub/.next/server/chunks/ssr/node_modules__pnpm_0kvuy0s._.js +33 -0
  473. package/runtime/hub/apps/hub/.next/server/chunks/ssr/packages_relay_dist_control-plane_0ve-wz4.js +80 -0
  474. package/runtime/hub/apps/hub/.next/server/functions-config-manifest.json +40 -0
  475. package/runtime/hub/apps/hub/.next/server/middleware-build-manifest.js +21 -0
  476. package/runtime/hub/apps/hub/.next/server/middleware-manifest.json +6 -0
  477. package/runtime/hub/apps/hub/.next/server/middleware.js +5 -0
  478. package/runtime/hub/apps/hub/.next/server/next-font-manifest.js +1 -0
  479. package/runtime/hub/apps/hub/.next/server/next-font-manifest.json +49 -0
  480. package/runtime/hub/apps/hub/.next/server/pages/500.html +1 -0
  481. package/runtime/hub/apps/hub/.next/server/pages-manifest.json +3 -0
  482. package/runtime/hub/apps/hub/.next/server/prefetch-hints.json +1 -0
  483. package/runtime/hub/apps/hub/.next/server/server-reference-manifest.js +1 -0
  484. package/runtime/hub/apps/hub/.next/server/server-reference-manifest.json +276 -0
  485. package/runtime/hub/apps/hub/.next/static/TpPTWVdZDxqrPlONtJcR5/_buildManifest.js +11 -0
  486. package/runtime/hub/apps/hub/.next/static/TpPTWVdZDxqrPlONtJcR5/_clientMiddlewareManifest.js +6 -0
  487. package/runtime/hub/apps/hub/.next/static/TpPTWVdZDxqrPlONtJcR5/_ssgManifest.js +1 -0
  488. package/runtime/hub/apps/hub/.next/static/chunks/0cz1d0mv5g_q7.js +1 -0
  489. package/runtime/hub/apps/hub/.next/static/chunks/0dx4alyqu7cq1.css +3 -0
  490. package/runtime/hub/apps/hub/.next/static/chunks/0lq354ziiwxxl.js +1 -0
  491. package/runtime/hub/apps/hub/.next/static/chunks/0ptag81psa0nj.js +1 -0
  492. package/runtime/hub/apps/hub/.next/static/chunks/11vmjdy3390ik.js +1 -0
  493. package/runtime/hub/apps/hub/.next/static/chunks/19cwkdx97a5_c.js +1 -0
  494. package/runtime/hub/apps/hub/.next/static/chunks/1svigjdfotduh.js +1 -0
  495. package/runtime/hub/apps/hub/.next/static/chunks/1t3645mc1s54c.js +1 -0
  496. package/runtime/hub/apps/hub/.next/static/chunks/1y49eldffr2-_.js +31 -0
  497. package/runtime/hub/apps/hub/.next/static/chunks/26ef4lcj-7-li.js +1 -0
  498. package/runtime/hub/apps/hub/.next/static/chunks/2d5e6t-5j4etp.js +1 -0
  499. package/runtime/hub/apps/hub/.next/static/chunks/2ozcn3ku69ymf.js +1 -0
  500. package/runtime/hub/apps/hub/.next/static/chunks/2w65a9zig6ya7.js +4 -0
  501. package/runtime/hub/apps/hub/.next/static/chunks/2x7nfpuaaba_a.js +1 -0
  502. package/runtime/hub/apps/hub/.next/static/chunks/3-zanu4ioia5i.js +1 -0
  503. package/runtime/hub/apps/hub/.next/static/chunks/3c49t4evjq8hf.js +1 -0
  504. package/runtime/hub/apps/hub/.next/static/chunks/3x8k7so-uoat8.js +2 -0
  505. package/runtime/hub/apps/hub/.next/static/chunks/3y2c7woqhtx9s.js +1 -0
  506. package/runtime/hub/apps/hub/.next/static/chunks/turbopack-2x4_cva4cco3h.js +1 -0
  507. package/runtime/hub/apps/hub/.next/static/media/02263ebadd758ea4-s.29yke99gs9qpn.woff2 +0 -0
  508. package/runtime/hub/apps/hub/.next/static/media/03fc1b4a8d284b5e-s.p.0wiir8udbzjvx.woff2 +0 -0
  509. package/runtime/hub/apps/hub/.next/static/media/1a69062cfe6f77f8-s.0o-3_g79811ob.woff2 +0 -0
  510. package/runtime/hub/apps/hub/.next/static/media/1bcd0e671759a44c-s.2qt3tdwt-y9x_.woff2 +0 -0
  511. package/runtime/hub/apps/hub/.next/static/media/23b7a97ae3b5c134-s.p.226pwps5o-gq_.woff2 +0 -0
  512. package/runtime/hub/apps/hub/.next/static/media/2e95a7d252b9825a-s.15orukf5wyxb5.woff2 +0 -0
  513. package/runtime/hub/apps/hub/.next/static/media/2fe89d53234c61d4-s.1u30mmyq6lnsd.woff2 +0 -0
  514. package/runtime/hub/apps/hub/.next/static/media/57215795b8570f5c-s.2rixgazldzomk.woff2 +0 -0
  515. package/runtime/hub/apps/hub/.next/static/media/59b15b4bcd7b1eb5-s.2vemzm0itqzfy.woff2 +0 -0
  516. package/runtime/hub/apps/hub/.next/static/media/5e05ae5b48faa55e-s.1yd4_i3e35931.woff2 +0 -0
  517. package/runtime/hub/apps/hub/.next/static/media/68757d6cddeff913-s.1i-sca43-qwng.woff2 +0 -0
  518. package/runtime/hub/apps/hub/.next/static/media/6ff74e33ebd7bca3-s.352ti9pm7m6qh.woff2 +0 -0
  519. package/runtime/hub/apps/hub/.next/static/media/7fea77d1d19108bf-s.2y65deuc30pmy.woff2 +0 -0
  520. package/runtime/hub/apps/hub/.next/static/media/90c51ce8fb754fe8-s.02z5rrbg5nt92.woff2 +0 -0
  521. package/runtime/hub/apps/hub/.next/static/media/99e609270109b47d-s.p.40sczeszzbjw1.woff2 +0 -0
  522. package/runtime/hub/apps/hub/.next/static/media/9a4838fcda0d1bca-s.0ngr-xkgqz1kf.woff2 +0 -0
  523. package/runtime/hub/apps/hub/.next/static/media/a7afbb44bec2bb18-s.1qc6dx89jd2qv.woff2 +0 -0
  524. package/runtime/hub/apps/hub/.next/static/media/e15f58668ad64cb8-s.3cvcemwuzoywn.woff2 +0 -0
  525. package/runtime/hub/apps/hub/.next/static/media/e390973e931a41c5-s.0rgnxg2b64rzs.woff2 +0 -0
  526. package/runtime/hub/apps/hub/.next/static/media/e532fa1b9921e1cd-s.3cb5lpr2l6xud.woff2 +0 -0
  527. package/runtime/hub/apps/hub/.next/static/media/effe91970fc4db64-s.p.0oace-s_gkfks.woff2 +0 -0
  528. package/runtime/hub/apps/hub/auth-YBXDRLHG.js +75 -0
  529. package/runtime/hub/apps/hub/auth-config-LJGI76HI.js +21 -0
  530. package/runtime/hub/apps/hub/chunk-3LAHFDJF.js +287 -0
  531. package/runtime/hub/apps/hub/chunk-AKLBSCSZ.js +8573 -0
  532. package/runtime/hub/apps/hub/chunk-EFW34I43.js +7299 -0
  533. package/runtime/hub/apps/hub/chunk-JDA7BPPN.js +2806 -0
  534. package/runtime/hub/apps/hub/chunk-LJG4CEGS.js +3341 -0
  535. package/runtime/hub/apps/hub/chunk-OBKLTPIR.js +41 -0
  536. package/runtime/hub/apps/hub/chunk-OF242BLD.js +797 -0
  537. package/runtime/hub/apps/hub/chunk-TZFWAJVB.js +38 -0
  538. package/runtime/hub/apps/hub/chunk-V5KGFHCF.js +12683 -0
  539. package/runtime/hub/apps/hub/cloud-poller-SUNA6ZQC-VSKVMYHL.js +10 -0
  540. package/runtime/hub/apps/hub/dist-BF54UNHK.js +1029 -0
  541. package/runtime/hub/apps/hub/dist-CM4YAQLI.js +1656 -0
  542. package/runtime/hub/apps/hub/dist-ELOY2IUE.js +533 -0
  543. package/runtime/hub/apps/hub/dist-FDBOJ74K.js +1085 -0
  544. package/runtime/hub/apps/hub/dist-GGM4BUKM.js +2281 -0
  545. package/runtime/hub/apps/hub/dist-IENF7YOD.js +88 -0
  546. package/runtime/hub/apps/hub/execa-4DLVNM6E.js +32 -0
  547. package/runtime/hub/apps/hub/hub-token-EW32VDIU.js +25 -0
  548. package/runtime/hub/apps/hub/package.json +55 -0
  549. package/runtime/hub/apps/hub/prepared-state-5FIGV4BE-FIXKBF5A.js +19 -0
  550. package/runtime/hub/apps/hub/public/logo.svg +5 -0
  551. package/runtime/hub/apps/hub/server.js +838 -0
  552. package/runtime/relay/bin.cjs +1738 -482
  553. package/runtime/vercel/ctl.cjs +11871 -10351
  554. package/runtime/vercel/scripts/provision.sh +31 -15
  555. package/dist/chunk-6JJIKCMY.js.map +0 -1
  556. package/dist/chunk-DBMLOY3T.js +0 -793
  557. package/dist/chunk-DBMLOY3T.js.map +0 -1
  558. package/dist/chunk-KTEDFUKM.js +0 -831
  559. package/dist/chunk-KTEDFUKM.js.map +0 -1
  560. package/dist/chunk-QKL7PCXQ.js.map +0 -1
  561. package/dist/chunk-X2DWS4KS.js +0 -820
  562. package/dist/chunk-X2DWS4KS.js.map +0 -1
  563. package/dist/chunk-YZVFGFYQ.js.map +0 -1
  564. package/dist/dist-FMA5Y25B.js.map +0 -1
  565. package/dist/dist-NWKOEWUJ.js.map +0 -1
  566. package/dist/dist-U76JL6HI.js +0 -738
  567. package/dist/dist-U76JL6HI.js.map +0 -1
  568. package/dist/dist-UVQJ2BZJ.js.map +0 -1
  569. /package/dist/{_cloud-attach-U3QJO7IF.js.map → _cloud-attach-YH2SU75S.js.map} +0 -0
  570. /package/dist/{dist-SAS4PIHA.js.map → dist-EJXUKIR7.js.map} +0 -0
  571. /package/dist/{prepared-state-MQHD3M5F-YYVVMTNJ.js.map → dist-QBXEP4VY.js.map} +0 -0
@@ -1,90 +1,101 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
- BOX_DYNAMIC_SYNC_MANIFEST,
4
- BOX_MEMORY_DIR,
5
- BOX_WORKFLOWS_DIR,
6
3
  CLAUDE_FORWARDED_ENV_KEYS,
7
- CODEX_CREDENTIALS_BACKUP_FILE,
8
4
  CODEX_FORWARDED_ENV_KEYS,
9
5
  CODEX_OVERRIDE_WROTE_MARKER,
10
- CREDENTIALS_BACKUP_FILE,
11
- OPENCODE_CREDENTIALS_BACKUP_FILE,
12
6
  OPENCODE_FORWARDED_ENV_KEYS,
13
7
  SHARED_CLAUDE_VOLUME,
14
8
  SHARED_CODEX_VOLUME,
15
9
  SHARED_OPENCODE_VOLUME,
16
10
  TERM_FALLBACK_SNIPPET,
17
11
  buildCodexAgentsOverrideScript,
18
- buildHostEnvFindArgs,
19
- buildHostSyncManifest,
20
12
  buildTmuxConfigShellSnippet,
21
- computeSyncDelta,
22
13
  ensureRelay,
23
14
  extractCodexCredentials,
24
15
  extractOpencodeCredentials,
25
16
  forgetBoxFromRelay,
26
17
  generateRelayToken,
27
18
  generateVncPassword,
28
- hashProjectPath,
29
- hostClaudeBackupExpired,
30
- isRealAgentCredential,
31
- loadEffectiveConfig,
32
19
  portlessAlias,
33
20
  portlessGetUrl,
34
21
  portlessUnalias,
35
- projectDirSegment,
36
22
  registerBoxWithRelay,
37
- sanitizeMnemonic,
38
- stageClaudeCredentialsForUpload,
39
- stageClaudeJsonOnlyForUpload,
40
- stageClaudeStaticForUpload,
41
- stageCodexCredentialsForUpload,
42
- stageCodexStaticForUpload,
43
- stageDynamicSyncTarball,
44
- stageOpencodeCredentialsForUpload,
45
- stageOpencodeStateForUpload,
46
- stageOpencodeStaticForUpload,
47
23
  syncClaudeCredentials
48
- } from "./chunk-YZVFGFYQ.js";
24
+ } from "./chunk-YZXXBHWG.js";
49
25
  import {
26
+ hashProjectPath,
27
+ loadEffectiveConfig,
28
+ projectDirSegment,
29
+ sanitizeMnemonic
30
+ } from "./chunk-VBSRJG53.js";
31
+ import {
32
+ BOX_DYNAMIC_SYNC_MANIFEST,
33
+ BOX_HOME,
34
+ BOX_MEMORY_DIR,
35
+ BOX_WORKFLOWS_DIR,
50
36
  DEFAULT_BOX_IMAGE,
37
+ SEED_MARKER,
38
+ SYNC_DRYRUN_ENV,
51
39
  allocateProjectIndex,
40
+ buildHostSyncManifest,
41
+ computeSyncDelta,
52
42
  detectGitRepos,
43
+ dirnameUnix,
44
+ dryRunProviderSync,
45
+ extractCredentials,
53
46
  generateBoxId,
47
+ hostClaudeBackupExpired,
48
+ makeHostGitPorts,
49
+ makeSyncContext,
50
+ planCarryEntry,
51
+ pushEnvFiles,
54
52
  readCliStamp,
55
53
  readPreparedStateRaw,
56
54
  readState,
57
55
  recordBox,
58
56
  removeBoxRecord,
59
- renderCarryEntries
60
- } from "./chunk-X2DWS4KS.js";
57
+ renderCarryEntries,
58
+ resolveSyncTopology,
59
+ resyncWorkspace,
60
+ stageClaudeCredentialsForUpload,
61
+ stageClaudeJsonOnlyForUpload,
62
+ stageClaudeStaticForUpload,
63
+ stageCodexCredentialsForUpload,
64
+ stageCodexStaticForUpload,
65
+ stageDynamicSyncTarball,
66
+ stageOpencodeCredentialsForUpload,
67
+ stageOpencodeStateForUpload,
68
+ stageOpencodeStaticForUpload
69
+ } from "./chunk-ALEYDWAO.js";
61
70
 
62
71
  // ../../packages/sandbox-cloud/dist/index.js
63
72
  import { basename as basename2, resolve } from "path";
64
- import { chmod, mkdir, writeFile } from "fs/promises";
65
- import { dirname } from "path";
66
- import { mkdtemp, rm, writeFile as writeFile2 } from "fs/promises";
67
- import { tmpdir } from "os";
68
- import { dirname as dirname2, join } from "path";
69
73
  import { execa } from "execa";
70
- import { mkdir as mkdir2, readFile, readdir, rm as rm2, writeFile as writeFile3 } from "fs/promises";
71
- import { homedir } from "os";
72
- import { basename, join as join2 } from "path";
73
- import { mkdtemp as mkdtemp2, rm as rm3, writeFile as writeFile4 } from "fs/promises";
74
+ import { mkdtemp, rm, writeFile } from "fs/promises";
75
+ import { tmpdir } from "os";
76
+ import { join } from "path";
77
+ import { mkdtemp as mkdtemp2, rm as rm2 } from "fs/promises";
74
78
  import { tmpdir as tmpdir2 } from "os";
75
- import { join as join3 } from "path";
79
+ import { join as join2 } from "path";
76
80
  import { execa as execa2 } from "execa";
77
- import { mkdtemp as mkdtemp3, rm as rm4 } from "fs/promises";
81
+ import { mkdtemp as mkdtemp3, rm as rm3, writeFile as writeFile2 } from "fs/promises";
78
82
  import { tmpdir as tmpdir3 } from "os";
79
- import { join as join4 } from "path";
83
+ import { dirname, join as join3 } from "path";
80
84
  import { execa as execa3 } from "execa";
85
+ import { mkdtemp as mkdtemp4, rm as rm4 } from "fs/promises";
86
+ import { tmpdir as tmpdir4 } from "os";
87
+ import { join as join4 } from "path";
88
+ import { execa as execa4 } from "execa";
89
+ import { mkdir, readFile, readdir, rm as rm5, writeFile as writeFile3 } from "fs/promises";
90
+ import { homedir } from "os";
91
+ import { basename, join as join5 } from "path";
81
92
  import { readFile as readFile2 } from "fs/promises";
82
- import { join as join5 } from "path";
93
+ import { join as join6 } from "path";
83
94
  import { parse as parseYaml } from "yaml";
84
- import { execa as execa4 } from "execa";
95
+ import { execa as execa5 } from "execa";
85
96
  import { existsSync, mkdirSync, renameSync, statSync } from "fs";
86
- import { mkdtemp as mkdtemp4, rm as rm5 } from "fs/promises";
87
- import { tmpdir as tmpdir4 } from "os";
97
+ import { mkdtemp as mkdtemp5, rm as rm6 } from "fs/promises";
98
+ import { tmpdir as tmpdir5 } from "os";
88
99
  import {
89
100
  basename as hostBasename,
90
101
  dirname as hostDirname,
@@ -92,10 +103,279 @@ import {
92
103
  resolve as hostResolve
93
104
  } from "path";
94
105
  import { posix } from "path";
95
- import { execa as execa5 } from "execa";
96
- import { copyFile, mkdir as mkdir3, mkdtemp as mkdtemp5, rm as rm6, stat } from "fs/promises";
97
- import { tmpdir as tmpdir5 } from "os";
98
- import { dirname as dirname3, join as join6 } from "path";
106
+ import { execa as execa6 } from "execa";
107
+ import { execa as execa7 } from "execa";
108
+ import { copyFile, mkdir as mkdir2, mkdtemp as mkdtemp6, rm as rm7, stat } from "fs/promises";
109
+ import { tmpdir as tmpdir6 } from "os";
110
+ import { dirname as dirname2, join as join7 } from "path";
111
+ function quoteShellArgv(argv) {
112
+ return argv.map(quoteShellArg).join(" ");
113
+ }
114
+ function quoteShellArg(arg) {
115
+ if (arg.length === 0) return "''";
116
+ if (/^[A-Za-z0-9_@%+=:,./-]+$/.test(arg)) return arg;
117
+ return "'" + arg.replace(/'/g, "'\\''") + "'";
118
+ }
119
+ function bashScript(body) {
120
+ return `bash -c ${quoteShellArg(body)}`;
121
+ }
122
+ var TARGET_REF = "refs/agentbox-resync/target";
123
+ var STASH_REF = "refs/agentbox-resync/stash";
124
+ var SHA_RE = /^[0-9a-f]{40}$/;
125
+ var BOX_REVLIST_CAP = 500;
126
+ async function resyncCloudWorkspace(backend, handle, worktrees, onLog) {
127
+ const log = onLog ?? (() => {
128
+ });
129
+ const probeAsRoot = backend.name === "vercel" || backend.name === "e2b";
130
+ const stage = await mkdtemp(join(tmpdir(), "agentbox-resync-"));
131
+ const prefetch = /* @__PURE__ */ new Map();
132
+ try {
133
+ for (const [i, w] of worktrees.entries()) {
134
+ prefetch.set(w.hostMainRepo, await prefetchRepo(backend, handle, w, stage, i, log));
135
+ }
136
+ const hostPorts = makeHostGitPorts();
137
+ const ports = {
138
+ ...hostPorts,
139
+ // Merge target = the in-box temp ref. When no shared ancestor was found we
140
+ // fall back to the box branch: the concern treats `hostRef === boxBranch`
141
+ // as "merging self" and skips the merge, but STILL overlays the host's
142
+ // untracked files (non-destructive, box wins) — whereas a null ref would
143
+ // make it skip the whole repo. stashSha is null in that case (no bundle),
144
+ // so the stash overlay is skipped too.
145
+ resolveHostRef: (hostMain) => {
146
+ const pf = prefetch.get(hostMain);
147
+ return Promise.resolve(pf ? pf.targetRef ?? pf.branch : null);
148
+ },
149
+ // The stash object is in-box (bundled + fetched); the concern applies by SHA.
150
+ createHostStash: (hostMain) => Promise.resolve(prefetch.get(hostMain)?.stashSha ?? null),
151
+ boxGit: (ct, args) => boxGit(backend, handle, ct, args),
152
+ probeUntrackedTokens: (ct, paths) => probeUntrackedTokens(backend, handle, ct, paths, probeAsRoot),
153
+ applyTarToBox: (ct, tar) => applyTarToBox(backend, handle, stage, ct, tar)
154
+ };
155
+ const results = await resyncWorkspace(worktrees, ports, log);
156
+ await cleanupBoxRefs(backend, handle, worktrees, prefetch);
157
+ return results;
158
+ } finally {
159
+ await rm(stage, { recursive: true, force: true });
160
+ }
161
+ }
162
+ async function prefetchRepo(backend, handle, w, stage, idx, log) {
163
+ const ct = w.containerPath;
164
+ const hostMain = w.hostMainRepo;
165
+ const none = { targetRef: null, stashSha: null, branch: w.branch };
166
+ const rev = await backend.exec(
167
+ handle,
168
+ bashScript(`git -C ${quoteShellArg(ct)} rev-list --max-count=${String(BOX_REVLIST_CAP)} ${quoteShellArg(w.branch)} 2>/dev/null || true`)
169
+ );
170
+ const boxShas = rev.stdout.split("\n").map((s) => s.trim()).filter((s) => SHA_RE.test(s));
171
+ if (boxShas.length === 0) {
172
+ log(`resync: ${ct}: box branch has no commits; overlay only`);
173
+ return none;
174
+ }
175
+ const batch = await execa(
176
+ "git",
177
+ ["-C", hostMain, "cat-file", "--batch-check=%(objectname) %(objecttype)"],
178
+ { input: boxShas.join("\n"), reject: false }
179
+ );
180
+ const present = /* @__PURE__ */ new Set();
181
+ for (const line of batch.stdout.split("\n")) {
182
+ const parts = line.trim().split(" ");
183
+ if (parts.length >= 2 && parts[1] === "commit" && parts[0]) present.add(parts[0]);
184
+ }
185
+ const base = boxShas.find((s) => present.has(s));
186
+ if (!base) {
187
+ log(`resync: ${ct}: no shared ancestor with the host (repo replaced?); overlay only (non-destructive)`);
188
+ return none;
189
+ }
190
+ const hRes = await execa("git", ["-C", hostMain, "rev-parse", "HEAD"], { reject: false });
191
+ const hostTip = hRes.stdout.trim();
192
+ if (hRes.exitCode !== 0 || !SHA_RE.test(hostTip)) return none;
193
+ const stashRes = await execa("git", ["-C", hostMain, "stash", "create"], { reject: false });
194
+ const stashSha = stashRes.exitCode === 0 && SHA_RE.test(stashRes.stdout.trim()) ? stashRes.stdout.trim() : null;
195
+ const needTarget = hostTip !== base;
196
+ const bundleRefs = [];
197
+ if (needTarget) bundleRefs.push(TARGET_REF);
198
+ if (stashSha) bundleRefs.push(STASH_REF);
199
+ if (bundleRefs.length === 0) {
200
+ log(`resync: ${ct}: already up to date with the host; overlay untracked only`);
201
+ return { targetRef: null, stashSha: null, branch: w.branch };
202
+ }
203
+ const bundlePath = join(stage, `resync-${String(idx)}.bundle`);
204
+ try {
205
+ if (needTarget) await execa("git", ["-C", hostMain, "update-ref", TARGET_REF, hostTip], { reject: false });
206
+ if (stashSha) await execa("git", ["-C", hostMain, "update-ref", STASH_REF, stashSha], { reject: false });
207
+ const b = await execa(
208
+ "git",
209
+ ["-C", hostMain, "bundle", "create", bundlePath, ...bundleRefs, `^${base}`],
210
+ { reject: false }
211
+ );
212
+ if (b.exitCode !== 0) {
213
+ log(`resync: ${ct}: bundle build failed; overlay only: ${(b.stderr || "").split("\n")[0]}`);
214
+ return none;
215
+ }
216
+ } finally {
217
+ if (needTarget) await execa("git", ["-C", hostMain, "update-ref", "-d", TARGET_REF], { reject: false });
218
+ if (stashSha) await execa("git", ["-C", hostMain, "update-ref", "-d", STASH_REF], { reject: false });
219
+ }
220
+ const remote = `/tmp/agentbox-resync-${String(idx)}.bundle`;
221
+ await backend.uploadFile(handle, bundlePath, remote);
222
+ const refspecs = bundleRefs.map((r) => `+${r}:${r}`);
223
+ const fetch2 = await backend.exec(
224
+ handle,
225
+ bashScript(
226
+ `git -C ${quoteShellArg(ct)} fetch --no-tags ${quoteShellArg(remote)} ${refspecs.map((r) => quoteShellArg(r)).join(" ")} && rm -f ${quoteShellArg(remote)}`
227
+ )
228
+ );
229
+ if (fetch2.exitCode !== 0) {
230
+ log(`resync: ${ct}: in-box bundle fetch failed; overlay only: ${(fetch2.stderr || fetch2.stdout || "").split("\n")[0]}`);
231
+ return none;
232
+ }
233
+ log(
234
+ needTarget ? `resync: ${ct}: fetched host commits (${base.slice(0, 8)}..${hostTip.slice(0, 8)})${stashSha ? " + host stash" : ""}` : `resync: ${ct}: no new host commits; fetched host stash only`
235
+ );
236
+ return { targetRef: needTarget ? TARGET_REF : null, stashSha, branch: w.branch };
237
+ }
238
+ async function boxGit(backend, handle, ct, args) {
239
+ const cmd = `git -C ${quoteShellArg(ct)} ${quoteShellArgv(args)}`;
240
+ const r = await backend.exec(handle, bashScript(cmd));
241
+ return { exitCode: r.exitCode, stdout: r.stdout, stderr: r.stderr };
242
+ }
243
+ async function probeUntrackedTokens(backend, handle, ct, relPaths, asRoot) {
244
+ const tokens = /* @__PURE__ */ new Map();
245
+ if (relPaths.length === 0) return tokens;
246
+ const payload = Buffer.from(relPaths.join("\0")).toString("base64");
247
+ const script = `printf %s ${quoteShellArg(payload)} | base64 -d | ( cd ${quoteShellArg(ct)} && while IFS= read -r -d '' f; do if [ -f "$f" ] && [ ! -L "$f" ]; then printf '%s\\0%s\\0' "$(sha256sum < "$f" | cut -d' ' -f1)" "$f"; elif [ -e "$f" ]; then printf '%s\\0%s\\0' '-' "$f"; fi; done )`;
248
+ const r = await backend.exec(handle, bashScript(script), asRoot ? { user: "root" } : void 0);
249
+ if (r.exitCode === 0) {
250
+ const flat = r.stdout.split("\0").filter((s) => s.length > 0);
251
+ for (let i = 0; i + 1 < flat.length; i += 2) {
252
+ const token = flat[i];
253
+ const path = flat[i + 1];
254
+ if (token !== void 0 && path !== void 0) tokens.set(path, token);
255
+ }
256
+ }
257
+ return tokens;
258
+ }
259
+ async function applyTarToBox(backend, handle, stage, ct, tar) {
260
+ const local = join(stage, "overlay.tar");
261
+ await writeFile(local, tar);
262
+ const remote = "/tmp/agentbox-resync-overlay.tar";
263
+ await backend.uploadFile(handle, local, remote);
264
+ await backend.exec(
265
+ handle,
266
+ bashScript(`tar -C ${quoteShellArg(ct)} -xf ${quoteShellArg(remote)} && rm -f ${quoteShellArg(remote)}`)
267
+ );
268
+ }
269
+ async function cleanupBoxRefs(backend, handle, worktrees, prefetch) {
270
+ for (const w of worktrees) {
271
+ if (!prefetch.get(w.hostMainRepo)?.targetRef) continue;
272
+ const ct = quoteShellArg(w.containerPath);
273
+ await backend.exec(
274
+ handle,
275
+ bashScript(
276
+ `git -C ${ct} update-ref -d ${TARGET_REF} 2>/dev/null || true; git -C ${ct} update-ref -d ${STASH_REF} 2>/dev/null || true`
277
+ )
278
+ ).catch(() => {
279
+ });
280
+ }
281
+ }
282
+ function createCloudSyncTransport(init) {
283
+ const { backend, handle } = init;
284
+ const hasVolume = typeof backend.ensureVolume === "function";
285
+ let tarSeq = 0;
286
+ const caps = {
287
+ persistentVolumes: hasVolume,
288
+ helperContainer: false,
289
+ ephemeralFs: !hasVolume
290
+ };
291
+ const transport = {
292
+ caps,
293
+ async exec(cmd, opts) {
294
+ const r = await backend.exec(handle, quoteShellArgv(cmd), {
295
+ cwd: opts?.cwd,
296
+ env: opts?.env,
297
+ user: opts?.user,
298
+ attemptTimeoutMs: opts?.attemptTimeoutMs,
299
+ noRetry: opts?.noRetry
300
+ });
301
+ return { exitCode: r.exitCode, stdout: r.stdout, stderr: r.stderr };
302
+ },
303
+ async applyTarball(hostTarPath, boxDestDir) {
304
+ const remoteTar = `/tmp/agentbox-apply-${String(tarSeq++)}.tar`;
305
+ await backend.uploadFile(handle, hostTarPath, remoteTar);
306
+ const r = await backend.exec(
307
+ handle,
308
+ `tar -xf ${remoteTar} -C ${boxDestDir} --no-same-permissions --no-same-owner -m && rm -f ${remoteTar}`
309
+ );
310
+ if (r.exitCode !== 0) {
311
+ throw new Error(
312
+ `cloud tar extract into ${boxDestDir} failed (exit ${String(r.exitCode)}): ${r.stderr.slice(-200)}`
313
+ );
314
+ }
315
+ },
316
+ async pushTree(hostSrcDir, boxDestDir, opts) {
317
+ const stage = await mkdtemp2(join2(tmpdir2(), "agentbox-pushtree-"));
318
+ const localTar = join2(stage, "tree.tar");
319
+ try {
320
+ const packArgs = ["-C", hostSrcDir];
321
+ for (const ex of opts?.exclude ?? []) packArgs.push(`--exclude=${ex}`);
322
+ packArgs.push("-cf", localTar, ".");
323
+ const packed = await execa2("tar", packArgs, { reject: false });
324
+ if (packed.exitCode !== 0) {
325
+ throw new Error(`tar pack of ${hostSrcDir} failed: ${String(packed.stderr).slice(0, 300)}`);
326
+ }
327
+ await transport.applyTarball(localTar, boxDestDir, opts);
328
+ } finally {
329
+ await rm2(stage, { recursive: true, force: true });
330
+ }
331
+ },
332
+ async pushFile(hostSrcPath, boxDestPath, opts) {
333
+ await backend.uploadFile(handle, hostSrcPath, boxDestPath);
334
+ if (opts?.uid !== void 0 && opts.uid !== 0) {
335
+ await backend.exec(handle, `chown ${String(opts.uid)}:${String(opts.uid)} ${boxDestPath}`);
336
+ }
337
+ if (opts?.mode !== void 0) {
338
+ await backend.exec(handle, `chmod ${opts.mode.toString(8)} ${boxDestPath}`);
339
+ }
340
+ },
341
+ async pullTree(boxSrcDir, hostDestDir, opts) {
342
+ const remoteTar = `/tmp/agentbox-pull-${String(tarSeq++)}.tar`;
343
+ const excludes = (opts?.exclude ?? []).map((e) => `--exclude=${e}`).join(" ");
344
+ const pack = await backend.exec(
345
+ handle,
346
+ `tar -C ${boxSrcDir} ${excludes} -cf ${remoteTar} .`
347
+ );
348
+ if (pack.exitCode !== 0) {
349
+ throw new Error(`cloud tar of ${boxSrcDir} failed: ${pack.stderr.slice(-200)}`);
350
+ }
351
+ const stage = await mkdtemp2(join2(tmpdir2(), "agentbox-pulltree-"));
352
+ const localTar = join2(stage, "tree.tar");
353
+ try {
354
+ await backend.downloadFile(handle, remoteTar, localTar);
355
+ await execa2("tar", ["-xf", localTar, "-C", hostDestDir], { reject: false });
356
+ } finally {
357
+ await rm2(stage, { recursive: true, force: true });
358
+ await backend.exec(handle, `rm -f ${remoteTar}`).catch(() => {
359
+ });
360
+ }
361
+ },
362
+ async pullFile(boxSrcPath, hostDestPath) {
363
+ await backend.downloadFile(handle, boxSrcPath, hostDestPath);
364
+ },
365
+ async readText(boxPath) {
366
+ const r = await backend.exec(handle, `cat ${boxPath} 2>/dev/null`, { noRetry: true });
367
+ if (r.exitCode !== 0) return null;
368
+ return r.stdout;
369
+ }
370
+ };
371
+ if (hasVolume) {
372
+ transport.ensureVolume = async (name) => {
373
+ const ensured = await backend.ensureVolume(name);
374
+ return ensured;
375
+ };
376
+ }
377
+ return transport;
378
+ }
99
379
  var CREDENTIALS_VOLUME = "agentbox-credentials";
100
380
  var AGENT_SPECS = [
101
381
  {
@@ -123,7 +403,6 @@ var AGENT_SPECS = [
123
403
  stageCredentials: () => stageOpencodeCredentialsForUpload()
124
404
  }
125
405
  ];
126
- var SEED_MARKER = ".agentbox-seeded-at";
127
406
  async function ensureAgentVolumesForCloud(backend, opts = {}) {
128
407
  const log = opts.onLog ?? (() => {
129
408
  });
@@ -329,38 +608,9 @@ function agentSpecsForCloud() {
329
608
  credentialsSubpath: s.credentialsSubpath
330
609
  }));
331
610
  }
332
- var EXTRACT_SPECS = [
333
- { kind: "claude", boxPath: "/home/vscode/.claude/.credentials.json", hostBackup: CREDENTIALS_BACKUP_FILE },
334
- { kind: "codex", boxPath: "/home/vscode/.codex/auth.json", hostBackup: CODEX_CREDENTIALS_BACKUP_FILE },
335
- {
336
- kind: "opencode",
337
- boxPath: "/home/vscode/.local/share/opencode/auth.json",
338
- hostBackup: OPENCODE_CREDENTIALS_BACKUP_FILE
339
- }
340
- ];
341
611
  async function extractCloudAgentCredentials(backend, handle, opts = {}) {
342
- const log = opts.onLog ?? (() => {
343
- });
344
- const extracted = [];
345
- for (const spec of EXTRACT_SPECS) {
346
- const hostBackup = opts.backups?.[spec.kind] ?? spec.hostBackup;
347
- try {
348
- const r = await backend.exec(handle, `cat ${spec.boxPath} 2>/dev/null`, { noRetry: true });
349
- const text = r.stdout;
350
- if (r.exitCode !== 0 || !text || !isRealAgentCredential(spec.kind, text)) continue;
351
- await mkdir(dirname(hostBackup), { recursive: true });
352
- await writeFile(hostBackup, text, { mode: 384 });
353
- await chmod(hostBackup, 384).catch(() => {
354
- });
355
- extracted.push(spec.kind);
356
- log(`extracted ${spec.kind} login from box to ${hostBackup}`);
357
- } catch (err) {
358
- log(
359
- `WARN: ${spec.kind} credential extract failed (${err instanceof Error ? err.message : String(err)}) \u2014 skipping`
360
- );
361
- }
362
- }
363
- return extracted;
612
+ const transport = createCloudSyncTransport({ backend, handle });
613
+ return extractCredentials(transport, { onLog: opts.onLog, backups: opts.backups });
364
614
  }
365
615
  function sq(p) {
366
616
  return `'${p.replace(/'/g, `'\\''`)}'`;
@@ -389,8 +639,8 @@ async function seedDynamicConfig(backend, handle, opts) {
389
639
  }
390
640
  delta.nextManifest.syncedAt = (/* @__PURE__ */ new Date()).toISOString();
391
641
  const staged = await stageDynamicSyncTarball(delta.uploads);
392
- const manifestDir = await mkdtemp(join(tmpdir(), "agentbox-dynsync-manifest-"));
393
- const manifestTmp = join(manifestDir, "dynamic-sync.json");
642
+ const manifestDir = await mkdtemp3(join3(tmpdir3(), "agentbox-dynsync-manifest-"));
643
+ const manifestTmp = join3(manifestDir, "dynamic-sync.json");
394
644
  await writeFile2(manifestTmp, JSON.stringify(delta.nextManifest, null, 2));
395
645
  try {
396
646
  const steps = [
@@ -424,7 +674,7 @@ async function seedDynamicConfig(backend, handle, opts) {
424
674
  );
425
675
  } finally {
426
676
  await staged.cleanup();
427
- await rm(dirname2(manifestTmp), { recursive: true, force: true });
677
+ await rm3(dirname(manifestTmp), { recursive: true, force: true });
428
678
  }
429
679
  } catch (err) {
430
680
  log(
@@ -486,17 +736,6 @@ async function seedClaudeJsonAtCreate(backend, handle, opts = {}) {
486
736
  if (staged) await staged.cleanup();
487
737
  }
488
738
  }
489
- function quoteShellArgv(argv) {
490
- return argv.map(quoteShellArg).join(" ");
491
- }
492
- function quoteShellArg(arg) {
493
- if (arg.length === 0) return "''";
494
- if (/^[A-Za-z0-9_@%+=:,./-]+$/.test(arg)) return arg;
495
- return "'" + arg.replace(/'/g, "'\\''") + "'";
496
- }
497
- function bashScript(body) {
498
- return `bash -c ${quoteShellArg(body)}`;
499
- }
500
739
  var FALLBACK_NAME = "agentbox";
501
740
  var FALLBACK_EMAIL = "agentbox@users.noreply.github.com";
502
741
  async function seedGitIdentity(backend, handle, opts = {}) {
@@ -514,26 +753,202 @@ async function seedGitIdentity(backend, handle, opts = {}) {
514
753
  }
515
754
  async function readHostGitConfig(key, hostRepo) {
516
755
  const args = hostRepo ? ["-C", hostRepo, "config", key] : ["config", key];
517
- const r = await execa("git", args, { reject: false });
756
+ const r = await execa3("git", args, { reject: false });
518
757
  if (r.exitCode !== 0) return null;
519
758
  const value = (r.stdout ?? "").trim();
520
759
  return value.length > 0 ? value : null;
521
760
  }
522
- var CLOUD_CHECKPOINTS_ROOT = join2(homedir(), ".agentbox", "cloud-checkpoints");
761
+ async function uploadEnvFiles(args) {
762
+ if (args.files.length === 0) return { copied: 0 };
763
+ const ctx = makeSyncContext({
764
+ boxName: "",
765
+ boxId: "",
766
+ provider: "cloud",
767
+ hostWorkspace: args.workspacePath,
768
+ boxWorkspace: args.workspaceDir ?? "/workspace",
769
+ onLog: args.onLog
770
+ });
771
+ const transport = createCloudSyncTransport({ backend: args.backend, handle: args.handle });
772
+ return pushEnvFiles(ctx, transport, args.files);
773
+ }
774
+ async function uploadCarryPaths(args) {
775
+ const log = args.onLog ?? (() => {
776
+ });
777
+ if (args.entries.length === 0) {
778
+ return { copied: 0, errors: [], applied: [] };
779
+ }
780
+ const stage = await mkdtemp4(join4(tmpdir4(), "agentbox-carry-"));
781
+ const errors = [];
782
+ const applied = [];
783
+ let copied = 0;
784
+ try {
785
+ for (const [i, entry] of args.entries.entries()) {
786
+ const where = `carry[${String(i)}] "${entry.rawSrc}"`;
787
+ if (entry.kind === "missing") {
788
+ log(`${where}: skipped (missing on host, optional)`);
789
+ continue;
790
+ }
791
+ try {
792
+ await uploadOneEntry({
793
+ backend: args.backend,
794
+ handle: args.handle,
795
+ entry,
796
+ stageDir: stage,
797
+ index: i
798
+ });
799
+ copied += 1;
800
+ applied.push({ src: entry.absSrc, dest: entry.absDest, bytes: entry.bytes ?? 0 });
801
+ } catch (err) {
802
+ const msg = err instanceof Error ? err.message : String(err);
803
+ errors.push(`${where}: ${msg}`);
804
+ log(`${where}: failed: ${msg}`);
805
+ }
806
+ }
807
+ } finally {
808
+ await rm4(stage, { recursive: true, force: true });
809
+ }
810
+ return { copied, errors, applied };
811
+ }
812
+ async function uploadOneEntry(args) {
813
+ const { entry } = args;
814
+ const plan = planCarryEntry(entry);
815
+ if (!plan) return;
816
+ const { boxDest, isDir, parentDir, exclude, uid, mode, fileBase, renameNeeded } = plan;
817
+ const localTar = join4(args.stageDir, `carry-${String(args.index)}.tar`);
818
+ const excludeArgs = isDir ? exclude.map((p) => `--exclude=${p}`) : [];
819
+ const tarArgs = isDir ? ["-C", entry.absSrc, "-cf", localTar, ...excludeArgs, "."] : ["-C", dirnameUnix(entry.absSrc), "-cf", localTar, fileBase];
820
+ const packed = await execa4("tar", tarArgs, { reject: false });
821
+ if (packed.exitCode !== 0) {
822
+ throw new Error(`tar pack failed: ${String(packed.stderr).slice(0, 300)}`);
823
+ }
824
+ const remoteTar = `/tmp/agentbox-carry-${String(args.index)}.tar`;
825
+ await args.backend.uploadFile(args.handle, localTar, remoteTar);
826
+ const parts = [
827
+ `mkdir -p ${shellQuote(parentDir)}`,
828
+ isDir ? `tar -xf ${remoteTar} -C ${shellQuote(boxDest)} --no-same-permissions --no-same-owner -m` : `tar -xf ${remoteTar} -C ${shellQuote(parentDir)} --no-same-permissions --no-same-owner -m`
829
+ ];
830
+ if (renameNeeded) {
831
+ parts.push(
832
+ `mv ${shellQuote(`${parentDir}/${fileBase}`)} ${shellQuote(boxDest)}`
833
+ );
834
+ }
835
+ if (mode) parts.push(`chmod -R ${mode} ${shellQuote(boxDest)}`);
836
+ parts.push(`chown -R ${String(uid)}:${String(uid)} ${shellQuote(boxDest)}`);
837
+ if (plan.parentChainNeeded) {
838
+ parts.push(
839
+ `parent=$(dirname ${shellQuote(boxDest)}); while [ "$parent" != "${BOX_HOME}" ] && [ "$parent" != "/" ]; do chown ${String(uid)}:${String(uid)} "$parent"; parent=$(dirname "$parent"); done`
840
+ );
841
+ }
842
+ parts.push(`rm -f ${remoteTar}`);
843
+ const cmd = parts.join(" && ");
844
+ const wantsRoot = args.backend.name === "vercel" || args.backend.name === "e2b";
845
+ const execOpts = wantsRoot ? { user: "root" } : void 0;
846
+ const res = await args.backend.exec(args.handle, cmd, execOpts);
847
+ if (res.exitCode !== 0) {
848
+ throw new Error(
849
+ `in-box extract failed (exit ${String(res.exitCode)}): ${(res.stderr || res.stdout).slice(-300)}`
850
+ );
851
+ }
852
+ }
853
+ function shellQuote(s) {
854
+ return `'${s.replace(/'/g, `'\\''`)}'`;
855
+ }
856
+ function makeCloudSync(backend, handle, opts = {}) {
857
+ if (process.env[SYNC_DRYRUN_ENV]) return dryRunProviderSync(backend.name);
858
+ return {
859
+ // Cloud live-box resync: pre-fetch the host commits into the box, then run
860
+ // the shared resync concern (merge + overlay, box wins; never reset --hard).
861
+ // See workspace-resync.ts. The provider's resyncWorkspace(box) re-derives the
862
+ // worktrees (detectGitRepos) + gates on hostSeeded before calling here.
863
+ async resyncWorkspace(ctx, worktrees) {
864
+ if (worktrees.length === 0) return { repos: [], hadConflicts: false };
865
+ const repos = await resyncCloudWorkspace(backend, handle, worktrees, ctx.onLog);
866
+ const hadConflicts = repos.some(
867
+ (r) => r.mergeConflicts.length > 0 || r.overlaySkipped.length > 0
868
+ );
869
+ return { repos, hadConflicts };
870
+ },
871
+ async seedAgentConfig(ctx) {
872
+ await ensureAgentHomeDirsOwned(backend, handle, { onLog: ctx.onLog });
873
+ await ensureCodexAgentsOverride(backend, handle, { onLog: ctx.onLog });
874
+ await seedOpencodeModelState(backend, handle, { onLog: ctx.onLog });
875
+ await seedClaudeJsonAtCreate(backend, handle, {
876
+ hostWorkspace: ctx.hostWorkspace,
877
+ onLog: ctx.onLog
878
+ });
879
+ await seedDynamicConfig(backend, handle, {
880
+ workspacePath: ctx.hostWorkspace,
881
+ onLog: ctx.onLog
882
+ });
883
+ },
884
+ async seedCredentials(ctx) {
885
+ await refreshAgentCredentialsBackup({ onLog: ctx.onLog });
886
+ const agents = opts.agents ?? [];
887
+ if (agents.length > 0) {
888
+ await seedAgentVolumesIfFresh(backend, handle, {
889
+ agents,
890
+ hostWorkspace: ctx.hostWorkspace,
891
+ onLog: ctx.onLog
892
+ });
893
+ }
894
+ },
895
+ extractCredentials() {
896
+ return extractCloudAgentCredentials(backend, handle);
897
+ },
898
+ async seedGitIdentity(ctx) {
899
+ await seedGitIdentity(backend, handle, {
900
+ hostRepo: ctx.hostWorkspace,
901
+ onLog: ctx.onLog
902
+ });
903
+ },
904
+ async seedEnvFiles(ctx, patterns) {
905
+ return uploadEnvFiles({
906
+ backend,
907
+ handle,
908
+ workspacePath: ctx.hostWorkspace,
909
+ files: patterns,
910
+ workspaceDir: ctx.boxWorkspace,
911
+ onLog: ctx.onLog
912
+ });
913
+ },
914
+ async applyCarry(ctx, entries) {
915
+ const rendered = await renderCarryEntries(
916
+ entries,
917
+ {
918
+ name: ctx.boxName,
919
+ id: ctx.boxId,
920
+ kind: "cloud",
921
+ hostWorkspace: ctx.hostWorkspace,
922
+ projectRoot: ctx.projectRoot
923
+ },
924
+ ctx.onLog
925
+ );
926
+ return uploadCarryPaths({ backend, handle, entries: rendered, onLog: ctx.onLog });
927
+ }
928
+ };
929
+ }
930
+ var CLOUD_CHECKPOINTS_ROOT = join5(homedir(), ".agentbox", "cloud-checkpoints");
523
931
  var CLOUD_SNAPSHOT_NAME_PREFIX = "agentbox-ckpt-";
524
932
  function cloudSnapshotName(projectRoot, name) {
525
933
  const mnemonic = sanitizeMnemonic(basename(projectRoot));
526
934
  return `${CLOUD_SNAPSHOT_NAME_PREFIX}${hashProjectPath(projectRoot)}_${mnemonic}-${name}`;
527
935
  }
528
936
  function backendDir(backend, projectRoot) {
529
- return join2(CLOUD_CHECKPOINTS_ROOT, backend, projectDirSegment(projectRoot));
937
+ return join5(CLOUD_CHECKPOINTS_ROOT, backend, projectDirSegment(projectRoot));
938
+ }
939
+ async function listCloudBackendDirs() {
940
+ try {
941
+ return (await readdir(CLOUD_CHECKPOINTS_ROOT, { withFileTypes: true })).filter((e) => e.isDirectory()).map((e) => e.name);
942
+ } catch {
943
+ return [];
944
+ }
530
945
  }
531
946
  function checkpointDir(backend, projectRoot, name) {
532
- return join2(backendDir(backend, projectRoot), name);
947
+ return join5(backendDir(backend, projectRoot), name);
533
948
  }
534
949
  async function readManifest(dir) {
535
950
  try {
536
- const raw = await readFile(join2(dir, "manifest.json"), "utf8");
951
+ const raw = await readFile(join5(dir, "manifest.json"), "utf8");
537
952
  const m = JSON.parse(raw);
538
953
  if (m.schema !== 1 && m.schema !== 2) return null;
539
954
  return m;
@@ -550,7 +965,7 @@ async function listCloudCheckpointsInDir(root) {
550
965
  }
551
966
  const out = [];
552
967
  for (const name of entries) {
553
- const dir = join2(root, name);
968
+ const dir = join5(root, name);
554
969
  const manifest = await readManifest(dir);
555
970
  if (manifest) out.push({ name, dir, manifest });
556
971
  }
@@ -561,7 +976,7 @@ async function listCloudCheckpoints(projectRoot, backend) {
561
976
  return listCloudCheckpointsInDir(backendDir(backend, projectRoot));
562
977
  }
563
978
  async function listAllCloudCheckpoints(backend) {
564
- const backendRoot = join2(CLOUD_CHECKPOINTS_ROOT, backend);
979
+ const backendRoot = join5(CLOUD_CHECKPOINTS_ROOT, backend);
565
980
  let segments;
566
981
  try {
567
982
  segments = (await readdir(backendRoot, { withFileTypes: true })).filter((e) => e.isDirectory()).map((e) => e.name);
@@ -570,7 +985,7 @@ async function listAllCloudCheckpoints(backend) {
570
985
  }
571
986
  const out = [];
572
987
  for (const segment of segments) {
573
- const items = await listCloudCheckpointsInDir(join2(backendRoot, segment));
988
+ const items = await listCloudCheckpointsInDir(join5(backendRoot, segment));
574
989
  if (items.length > 0) out.push({ segment, items });
575
990
  }
576
991
  return out;
@@ -583,7 +998,7 @@ async function resolveCloudCheckpoint(projectRoot, backend, ref) {
583
998
  }
584
999
  async function writeCloudCheckpointManifest(projectRoot, backend, name, fields) {
585
1000
  const dir = checkpointDir(backend, projectRoot, name);
586
- await mkdir2(dir, { recursive: true });
1001
+ await mkdir(dir, { recursive: true });
587
1002
  const manifest = {
588
1003
  schema: 2,
589
1004
  name,
@@ -596,7 +1011,7 @@ async function writeCloudCheckpointManifest(projectRoot, backend, name, fields)
596
1011
  cliVersion: fields.cliVersion,
597
1012
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
598
1013
  };
599
- await writeFile3(join2(dir, "manifest.json"), JSON.stringify(manifest, null, 2) + "\n", "utf8");
1014
+ await writeFile3(join5(dir, "manifest.json"), JSON.stringify(manifest, null, 2) + "\n", "utf8");
600
1015
  return { name, dir, manifest };
601
1016
  }
602
1017
  function currentCloudBaseFingerprint(provider) {
@@ -607,11 +1022,22 @@ function currentCloudBaseFingerprint(provider) {
607
1022
  return void 0;
608
1023
  }
609
1024
  }
1025
+ function baseFreshnessFromFingerprints(stored, live) {
1026
+ if (!stored) return { state: "unprepared" };
1027
+ if (!live) return { state: "unknown" };
1028
+ if (stored !== live) {
1029
+ return {
1030
+ state: "stale",
1031
+ reason: `baked runtime differs (base ${stored.slice(0, 12)}, current ${live.slice(0, 12)})`
1032
+ };
1033
+ }
1034
+ return { state: "fresh" };
1035
+ }
610
1036
  async function removeCloudCheckpointDir(projectRoot, backend, name) {
611
1037
  const dir = checkpointDir(backend, projectRoot, name);
612
1038
  const existed = await readManifest(dir) !== null;
613
1039
  if (!existed) return false;
614
- await rm2(dir, { recursive: true, force: true });
1040
+ await rm5(dir, { recursive: true, force: true });
615
1041
  return true;
616
1042
  }
617
1043
  async function probeCloudCheckpoint(backend, projectRoot, ref) {
@@ -635,155 +1061,10 @@ function isSnapshotGoneError(err) {
635
1061
  const msg = parts.join(" ").toLowerCase();
636
1062
  return /snapshot[^.]*\b(expired|deleted|gone|not[ -]?found)\b/.test(msg) || msg.includes("expired or deleted");
637
1063
  }
638
- var WORKSPACE_DIR_DEFAULT = "/workspace";
639
- var REMOTE_TAR_PATH = "/tmp/agentbox-envfiles.tar";
640
- async function uploadEnvFiles(args) {
641
- const log = args.onLog ?? (() => {
642
- });
643
- if (args.files.length === 0) return { copied: 0 };
644
- const workspaceDir = args.workspaceDir ?? WORKSPACE_DIR_DEFAULT;
645
- const found = await execa2("find", buildHostEnvFindArgs(args.files).slice(1), {
646
- cwd: args.workspacePath,
647
- reject: false
648
- });
649
- if (found.exitCode !== 0) {
650
- log(`env-file scan failed: ${String(found.stderr).slice(0, 300)}`);
651
- return { copied: 0 };
652
- }
653
- const list = String(found.stdout).split("\0").filter((p) => p.length > 0);
654
- if (list.length === 0) return { copied: 0 };
655
- const stage = await mkdtemp2(join3(tmpdir2(), "agentbox-envfiles-"));
656
- const localTar = join3(stage, "envfiles.tar");
657
- try {
658
- const packed = await execa2(
659
- "tar",
660
- ["-C", args.workspacePath, "--null", "-T", "-", "-cf", localTar],
661
- { input: list.join("\0"), reject: false }
662
- );
663
- if (packed.exitCode !== 0) {
664
- log(`env-file tar pack failed: ${String(packed.stderr).slice(0, 300)}`);
665
- return { copied: 0 };
666
- }
667
- await writeFile4(join3(stage, ".marker"), "").catch(() => {
668
- });
669
- await args.backend.uploadFile(args.handle, localTar, REMOTE_TAR_PATH);
670
- const extract = await args.backend.exec(
671
- args.handle,
672
- `tar -xf ${REMOTE_TAR_PATH} -C ${workspaceDir} --no-same-permissions --no-same-owner -m && rm -f ${REMOTE_TAR_PATH}`
673
- );
674
- if (extract.exitCode !== 0) {
675
- log(
676
- `env-file extract failed (exit ${String(extract.exitCode)}); stdout: ${extract.stdout.slice(-200)} stderr: ${extract.stderr.slice(-200)}`
677
- );
678
- return { copied: 0 };
679
- }
680
- } finally {
681
- await rm3(stage, { recursive: true, force: true });
682
- }
683
- return { copied: list.length };
684
- }
685
- var BOX_HOME = "/home/vscode";
686
- async function uploadCarryPaths(args) {
687
- const log = args.onLog ?? (() => {
688
- });
689
- if (args.entries.length === 0) {
690
- return { copied: 0, errors: [], applied: [] };
691
- }
692
- const stage = await mkdtemp3(join4(tmpdir3(), "agentbox-carry-"));
693
- const errors = [];
694
- const applied = [];
695
- let copied = 0;
696
- try {
697
- for (const [i, entry] of args.entries.entries()) {
698
- const where = `carry[${String(i)}] "${entry.rawSrc}"`;
699
- if (entry.kind === "missing") {
700
- log(`${where}: skipped (missing on host, optional)`);
701
- continue;
702
- }
703
- try {
704
- await uploadOneEntry({
705
- backend: args.backend,
706
- handle: args.handle,
707
- entry,
708
- stageDir: stage,
709
- index: i
710
- });
711
- copied += 1;
712
- applied.push({ src: entry.absSrc, dest: entry.absDest, bytes: entry.bytes ?? 0 });
713
- } catch (err) {
714
- const msg = err instanceof Error ? err.message : String(err);
715
- errors.push(`${where}: ${msg}`);
716
- log(`${where}: failed: ${msg}`);
717
- }
718
- }
719
- } finally {
720
- await rm4(stage, { recursive: true, force: true });
721
- }
722
- return { copied, errors, applied };
723
- }
724
- async function uploadOneEntry(args) {
725
- const { entry } = args;
726
- if (entry.kind === "missing") return;
727
- const boxDest = entry.absDest.startsWith("~/") ? `${BOX_HOME}/${entry.absDest.slice(2)}` : entry.absDest;
728
- const isDir = entry.kind === "dir";
729
- const parentDir = isDir ? boxDest : dirnameUnix(boxDest);
730
- const localTar = join4(args.stageDir, `carry-${String(args.index)}.tar`);
731
- const excludeArgs = isDir ? (entry.exclude ?? []).map((p) => `--exclude=${p}`) : [];
732
- const tarArgs = isDir ? ["-C", entry.absSrc, "-cf", localTar, ...excludeArgs, "."] : ["-C", dirnameUnix(entry.absSrc), "-cf", localTar, basenameUnix(entry.absSrc)];
733
- const packed = await execa3("tar", tarArgs, { reject: false });
734
- if (packed.exitCode !== 0) {
735
- throw new Error(`tar pack failed: ${String(packed.stderr).slice(0, 300)}`);
736
- }
737
- const remoteTar = `/tmp/agentbox-carry-${String(args.index)}.tar`;
738
- await args.backend.uploadFile(args.handle, localTar, remoteTar);
739
- const mode = entry.mode !== void 0 ? entry.mode.toString(8).padStart(4, "0") : "";
740
- const uid = entry.user ?? 1e3;
741
- const fileBase = !isDir ? basenameUnix(entry.absSrc) : "";
742
- const destBase = !isDir ? basenameUnix(boxDest) : "";
743
- const renameNeeded = !isDir && fileBase !== destBase;
744
- const parts = [
745
- `mkdir -p ${shellQuote(parentDir)}`,
746
- isDir ? `tar -xf ${remoteTar} -C ${shellQuote(boxDest)} --no-same-permissions --no-same-owner -m` : `tar -xf ${remoteTar} -C ${shellQuote(parentDir)} --no-same-permissions --no-same-owner -m`
747
- ];
748
- if (renameNeeded) {
749
- parts.push(
750
- `mv ${shellQuote(`${parentDir}/${fileBase}`)} ${shellQuote(boxDest)}`
751
- );
752
- }
753
- if (mode) parts.push(`chmod -R ${mode} ${shellQuote(boxDest)}`);
754
- parts.push(`chown -R ${String(uid)}:${String(uid)} ${shellQuote(boxDest)}`);
755
- if (boxDest.startsWith(BOX_HOME + "/") && parentDir !== BOX_HOME) {
756
- parts.push(
757
- `parent=$(dirname ${shellQuote(boxDest)}); while [ "$parent" != "${BOX_HOME}" ] && [ "$parent" != "/" ]; do chown ${String(uid)}:${String(uid)} "$parent"; parent=$(dirname "$parent"); done`
758
- );
759
- }
760
- parts.push(`rm -f ${remoteTar}`);
761
- const cmd = parts.join(" && ");
762
- const wantsRoot = args.backend.name === "vercel" || args.backend.name === "e2b";
763
- const execOpts = wantsRoot ? { user: "root" } : void 0;
764
- const res = await args.backend.exec(args.handle, cmd, execOpts);
765
- if (res.exitCode !== 0) {
766
- throw new Error(
767
- `in-box extract failed (exit ${String(res.exitCode)}): ${(res.stderr || res.stdout).slice(-300)}`
768
- );
769
- }
770
- }
771
- function dirnameUnix(p) {
772
- const i = p.lastIndexOf("/");
773
- if (i <= 0) return "/";
774
- return p.slice(0, i);
775
- }
776
- function basenameUnix(p) {
777
- const i = p.lastIndexOf("/");
778
- return i < 0 ? p : p.slice(i + 1);
779
- }
780
- function shellQuote(s) {
781
- return `'${s.replace(/'/g, `'\\''`)}'`;
782
- }
783
1064
  async function readExposedServicePorts(workspacePath) {
784
1065
  let text;
785
1066
  try {
786
- text = await readFile2(join5(workspacePath, "agentbox.yaml"), "utf8");
1067
+ text = await readFile2(join6(workspacePath, "agentbox.yaml"), "utf8");
787
1068
  } catch {
788
1069
  return [];
789
1070
  }
@@ -829,11 +1110,11 @@ async function uploadOneToCloudBox(backend, handle, hostSrc, boxDst, exclude) {
829
1110
  finalName = posix.basename(boxDst);
830
1111
  }
831
1112
  const finalPath = boxParent === "/" ? `/${finalName}` : `${boxParent}/${finalName}`;
832
- const stage = await mkdtemp4(hostJoin(tmpdir4(), "agentbox-cp-up-"));
1113
+ const stage = await mkdtemp5(hostJoin(tmpdir5(), "agentbox-cp-up-"));
833
1114
  const localTar = hostJoin(stage, "payload.tar.gz");
834
1115
  try {
835
1116
  const excludeArgs = (exclude ?? []).map((p) => `--exclude=${p}`);
836
- await execa4("tar", ["-C", srcParent, "-czf", localTar, ...excludeArgs, srcBasename], {
1117
+ await execa5("tar", ["-C", srcParent, "-czf", localTar, ...excludeArgs, srcBasename], {
837
1118
  env: { ...process.env, COPYFILE_DISABLE: "1" }
838
1119
  });
839
1120
  await backend.uploadFile(handle, localTar, REMOTE_UP_TAR);
@@ -862,14 +1143,14 @@ async function uploadOneToCloudBox(backend, handle, hostSrc, boxDst, exclude) {
862
1143
  throw new Error(`cloud upload extract failed: ${r.stderr || r.stdout}`);
863
1144
  }
864
1145
  } finally {
865
- await rm5(stage, { recursive: true, force: true });
1146
+ await rm6(stage, { recursive: true, force: true });
866
1147
  }
867
1148
  return { finalPath };
868
1149
  }
869
1150
  async function pullCloudDirContents(backend, handle, boxSrcDir, hostDstDir) {
870
1151
  const dstAbs = hostResolve(hostDstDir);
871
1152
  mkdirSync(dstAbs, { recursive: true });
872
- const stage = await mkdtemp4(hostJoin(tmpdir4(), "agentbox-pull-"));
1153
+ const stage = await mkdtemp5(hostJoin(tmpdir5(), "agentbox-pull-"));
873
1154
  const localTar = hostJoin(stage, "payload.tar.gz");
874
1155
  try {
875
1156
  const packScript = [
@@ -882,11 +1163,11 @@ async function pullCloudDirContents(backend, handle, boxSrcDir, hostDstDir) {
882
1163
  throw new Error(`cloud workspace pack failed: ${r.stderr || r.stdout}`);
883
1164
  }
884
1165
  await backend.downloadFile(handle, REMOTE_DOWN_TAR, localTar);
885
- await execa4("tar", ["-xzf", localTar, "-C", dstAbs]);
1166
+ await execa5("tar", ["-xzf", localTar, "-C", dstAbs]);
886
1167
  await backend.exec(handle, `rm -f ${quoteShellArg(REMOTE_DOWN_TAR)}`).catch(() => {
887
1168
  });
888
1169
  } finally {
889
- await rm5(stage, { recursive: true, force: true });
1170
+ await rm6(stage, { recursive: true, force: true });
890
1171
  }
891
1172
  return { finalPath: dstAbs };
892
1173
  }
@@ -906,7 +1187,7 @@ async function downloadOneFromCloudBox(backend, handle, boxSrc, hostDst, exclude
906
1187
  }
907
1188
  mkdirSync(hostParent, { recursive: true });
908
1189
  const finalPath = hostJoin(hostParent, finalName);
909
- const stage = await mkdtemp4(hostJoin(tmpdir4(), "agentbox-cp-down-"));
1190
+ const stage = await mkdtemp5(hostJoin(tmpdir5(), "agentbox-cp-down-"));
910
1191
  const localTar = hostJoin(stage, "payload.tar.gz");
911
1192
  try {
912
1193
  const excludeArgs = (exclude ?? []).map((p) => `--exclude=${quoteShellArg(p)}`).join(" ");
@@ -920,14 +1201,14 @@ async function downloadOneFromCloudBox(backend, handle, boxSrc, hostDst, exclude
920
1201
  throw new Error(`cloud download pack failed: ${r.stderr || r.stdout}`);
921
1202
  }
922
1203
  await backend.downloadFile(handle, REMOTE_DOWN_TAR, localTar);
923
- await execa4("tar", ["-xzf", localTar, "-C", hostParent]);
1204
+ await execa5("tar", ["-xzf", localTar, "-C", hostParent]);
924
1205
  if (finalName !== srcBasename) {
925
1206
  renameSync(hostJoin(hostParent, srcBasename), finalPath);
926
1207
  }
927
1208
  await backend.exec(handle, `rm -f ${quoteShellArg(REMOTE_DOWN_TAR)}`).catch(() => {
928
1209
  });
929
1210
  } finally {
930
- await rm5(stage, { recursive: true, force: true });
1211
+ await rm6(stage, { recursive: true, force: true });
931
1212
  }
932
1213
  return { finalPath };
933
1214
  }
@@ -962,11 +1243,12 @@ async function downloadFromCloudBox(backend, handle, boxSrcs, hostDst, exclude)
962
1243
  }
963
1244
  return { finalPath: dstAbs };
964
1245
  }
965
- async function launchCloudCtlDaemon(args) {
1246
+ function buildBootstrapEnv(args) {
966
1247
  const env = [
967
1248
  `AGENTBOX_BOX_ID=${quoteShellArgv([args.boxId])}`,
968
1249
  `AGENTBOX_BOX_NAME=${quoteShellArgv([args.boxName])}`,
969
- `AGENTBOX_BOX_KIND=cloud`
1250
+ `AGENTBOX_BOX_KIND=cloud`,
1251
+ `AGENTBOX_LAUNCH_DOCKERD=${args.launchDockerd ? "1" : "0"}`
970
1252
  ];
971
1253
  if (args.relayUrl) env.push(`AGENTBOX_RELAY_URL=${quoteShellArgv([args.relayUrl])}`);
972
1254
  if (args.relayToken) env.push(`AGENTBOX_RELAY_TOKEN=${quoteShellArgv([args.relayToken])}`);
@@ -974,6 +1256,20 @@ async function launchCloudCtlDaemon(args) {
974
1256
  if (args.webProxyPort !== void 0)
975
1257
  env.push(`AGENTBOX_WEB_PROXY_PORT=${quoteShellArgv([String(args.webProxyPort)])}`);
976
1258
  if (args.boxHost) env.push(`AGENTBOX_BOX_HOST=${quoteShellArgv([args.boxHost])}`);
1259
+ if (args.vncPassword) {
1260
+ env.push(`AGENTBOX_VNC_ENABLED=1`);
1261
+ env.push(`AGENTBOX_VNC_PASSWORD=${quoteShellArgv([args.vncPassword])}`);
1262
+ } else {
1263
+ env.push(`AGENTBOX_VNC_ENABLED=0`);
1264
+ }
1265
+ if (args.clone) {
1266
+ env.push(`AGENTBOX_CLONE_URL=${quoteShellArgv([args.clone.authedUrl])}`);
1267
+ env.push(`AGENTBOX_ORIGIN_URL=${quoteShellArgv([args.clone.originUrl])}`);
1268
+ if (args.clone.branch)
1269
+ env.push(`AGENTBOX_CLONE_BRANCH=${quoteShellArgv([args.clone.branch])}`);
1270
+ if (args.clone.depth !== void 0)
1271
+ env.push(`AGENTBOX_CLONE_DEPTH=${quoteShellArgv([String(args.clone.depth)])}`);
1272
+ }
977
1273
  const boxEnvFile = [
978
1274
  `AGENTBOX_BOX_ID=${quoteShellArgv([args.boxId])}`,
979
1275
  `AGENTBOX_BOX_NAME=${quoteShellArgv([args.boxName])}`,
@@ -982,99 +1278,79 @@ async function launchCloudCtlDaemon(args) {
982
1278
  if (args.webProxyPort !== void 0)
983
1279
  boxEnvFile.push(`AGENTBOX_WEB_PROXY_PORT=${quoteShellArgv([String(args.webProxyPort)])}`);
984
1280
  if (args.boxHost) boxEnvFile.push(`AGENTBOX_BOX_HOST=${quoteShellArgv([args.boxHost])}`);
985
- const boxRelayPort = (() => {
986
- if (args.relayUrl) {
987
- try {
988
- const p = new URL(args.relayUrl).port;
989
- if (p) return Number.parseInt(p, 10);
990
- } catch {
991
- }
992
- }
993
- return 8788;
994
- })();
1281
+ if (args.controlPlaneUrl) {
1282
+ env.push(`AGENTBOX_CONTROL_PLANE_URL=${quoteShellArgv([args.controlPlaneUrl])}`);
1283
+ }
1284
+ const pushMode = args.gitPushMode ?? "auto";
1285
+ const lease = pushMode === "lease" || pushMode === "auto" && Boolean(args.controlPlaneUrl);
1286
+ if (lease) {
1287
+ boxEnvFile.push(`AGENTBOX_GIT_LEASE=1`);
1288
+ }
1289
+ return { env, boxEnvFile };
1290
+ }
1291
+ async function kickCloudBootstrap(args) {
1292
+ const { env, boxEnvFile } = buildBootstrapEnv(args);
995
1293
  const script = [
996
1294
  `set -e`,
997
- // Idempotent: if a healthy ctl daemon is already serving the box relay,
998
- // leave it — it already has the right env (relayUrl/token are stable across
999
- // a host-only reconnect), and a fresh spawn would just fail to bind :PORT
1000
- // and linger as an orphan. Only a real sandbox restart kills the daemon, in
1001
- // which case the probe fails and we (re)launch. Without this, every
1002
- // start/resume/recover leaked another idle daemon. node is guaranteed
1003
- // present (it runs agentbox-ctl); curl may not be.
1004
- `if node -e 'require("http").get("http://127.0.0.1:${String(boxRelayPort)}/healthz",r=>process.exit(r.statusCode===200?0:1)).on("error",()=>process.exit(1))' 2>/dev/null; then`,
1005
- ` echo "agentbox-ctl daemon already healthy on :${String(boxRelayPort)}; skipping launch"`,
1006
- ` exit 0`,
1007
- `fi`,
1295
+ // /etc/agentbox is root-owned; the non-root sandbox user needs sudo to
1296
+ // write the login-shell env file (cloud bases grant vscode passwordless
1297
+ // sudo; root SSH boxes fall through with SUDO=''). Quoted heredoc → the
1298
+ // values (already shell-quoted for `set -a; . box.env`) land verbatim.
1008
1299
  `if command -v sudo >/dev/null 2>&1; then SUDO='sudo -n'; else SUDO=''; fi`,
1009
- `$SUDO mkdir -p /run/agentbox /var/log/agentbox /etc/agentbox`,
1010
- `$SUDO chown "$(id -un):$(id -gn)" /run/agentbox /var/log/agentbox`,
1300
+ `$SUDO mkdir -p /etc/agentbox`,
1011
1301
  `$SUDO tee /etc/agentbox/box.env >/dev/null <<'AGENTBOX_BOX_ENV_EOF'`,
1012
1302
  ...boxEnvFile,
1013
1303
  `AGENTBOX_BOX_ENV_EOF`,
1014
1304
  `export ${env.join(" ")}`,
1015
- `nohup /usr/local/bin/agentbox-ctl daemon >> /var/log/agentbox/ctl-daemon.log 2>&1 &`,
1016
- `disown`,
1017
- `echo started`
1305
+ `/usr/local/bin/agentbox-ctl bootstrap`
1018
1306
  ].join("\n");
1019
1307
  const r = await args.backend.exec(args.handle, bashScript(script));
1020
- if (r.exitCode !== 0) {
1021
- throw new Error(`agentbox-ctl daemon launch failed: ${r.stderr || r.stdout}`);
1308
+ if (r.stdout && args.onLog) {
1309
+ for (const line of r.stdout.split("\n")) if (line.trim()) args.onLog(line);
1022
1310
  }
1023
- }
1024
- async function launchCloudDockerdDaemon(args) {
1025
- const timeoutMs = args.timeoutMs ?? 6e4;
1026
- const startScript = [
1027
- `set -euo pipefail`,
1028
- `mkdir -p /var/log/agentbox`,
1029
- `nohup sudo -n /usr/local/bin/agentbox-dockerd-start >> /var/log/agentbox/dockerd.log 2>&1 &`,
1030
- `echo "spawned dockerd"`
1031
- ].join("\n");
1032
- const launch = await args.backend.exec(args.handle, bashScript(startScript));
1033
- if (launch.exitCode !== 0) {
1034
- return {
1035
- up: false,
1036
- reason: `dockerd launch failed: ${launch.stderr || launch.stdout}`
1037
- };
1038
- }
1039
- const probeCmd = "[ -S /var/run/docker.sock ] && docker -H unix:///var/run/docker.sock info >/dev/null 2>&1";
1040
- const deadline = Date.now() + timeoutMs;
1041
- while (Date.now() < deadline) {
1042
- const probe = await args.backend.exec(args.handle, probeCmd);
1043
- if (probe.exitCode === 0) return { up: true };
1044
- await new Promise((r) => setTimeout(r, 500));
1311
+ if (r.exitCode !== 0) {
1312
+ throw new Error(`agentbox-ctl bootstrap failed: ${r.stderr || r.stdout}`);
1045
1313
  }
1046
- return {
1047
- up: false,
1048
- reason: `dockerd did not become ready within ${String(timeoutMs)}ms`
1049
- };
1050
1314
  }
1051
- async function launchCloudVncDaemon(args) {
1052
- const script = [
1053
- `set -e`,
1054
- `cd /home/vscode`,
1055
- `export AGENTBOX_VNC_PASSWORD=${quoteShellArg(args.vncPassword)}`,
1056
- `mkdir -p /var/log/agentbox 2>/dev/null || true`,
1057
- `nohup /usr/local/bin/agentbox-vnc-start >> /var/log/agentbox/vnc-start.log 2>&1 &`,
1058
- `disown`,
1059
- // Probe for websockify to bind 6080. ~15s ceiling: E2B's Python venv
1060
- // startup (websockify is a pure-python proxy launched from a venv) takes
1061
- // ~7-9s before the socket binds, so a 5s ceiling false-negatives every
1062
- // create. Docker/hetzner/daytona/vercel come up well inside this window.
1063
- `for _ in $(seq 1 150); do`,
1064
- ` if (echo > /dev/tcp/127.0.0.1/6080) 2>/dev/null; then echo ready; exit 0; fi`,
1065
- ` sleep 0.1`,
1066
- `done`,
1067
- `echo "websockify did not bind 6080 within 15s" >&2`,
1068
- `exit 1`
1069
- ].join("\n");
1070
- const r = await args.backend.exec(args.handle, bashScript(script));
1071
- if (r.exitCode !== 0) {
1072
- throw new Error(`agentbox-vnc-start failed: ${r.stderr || r.stdout}`);
1315
+ async function readGitOriginUrl(workspacePath) {
1316
+ const r = await execa6("git", ["-C", workspacePath, "remote", "get-url", "origin"], {
1317
+ reject: false
1318
+ });
1319
+ const url = (r.stdout ?? "").trim();
1320
+ return r.exitCode === 0 && url.length > 0 ? url : void 0;
1321
+ }
1322
+ async function registerBoxWithPlane(args) {
1323
+ const url = `${args.controlPlaneUrl.replace(/\/$/, "")}/admin/register-box`;
1324
+ const res = await fetch(url, {
1325
+ method: "POST",
1326
+ headers: {
1327
+ "Content-Type": "application/json",
1328
+ Authorization: `Bearer ${args.adminToken}`
1329
+ },
1330
+ body: JSON.stringify({
1331
+ boxId: args.boxId,
1332
+ token: args.token,
1333
+ name: args.name,
1334
+ kind: "cloud",
1335
+ backend: args.backend,
1336
+ originUrl: args.originUrl,
1337
+ bridgeToken: args.bridgeToken,
1338
+ previewUrl: args.previewUrl,
1339
+ previewToken: args.previewToken,
1340
+ createdAt: args.createdAt,
1341
+ projectIndex: args.projectIndex,
1342
+ autoApproveHostActions: args.autoApproveHostActions,
1343
+ autoApproveSafeHostActions: args.autoApproveSafeHostActions
1344
+ })
1345
+ });
1346
+ if (!res.ok) {
1347
+ const text = await res.text().catch(() => "");
1348
+ throw new Error(`plane register-box \u2192 ${String(res.status)}: ${text}`);
1073
1349
  }
1074
1350
  }
1075
- var WORKSPACE_DIR_DEFAULT2 = "/workspace";
1351
+ var WORKSPACE_DIR_DEFAULT = "/workspace";
1076
1352
  async function seedCloudWorkspace(args) {
1077
- const workspaceDir = args.workspaceDir ?? WORKSPACE_DIR_DEFAULT2;
1353
+ const workspaceDir = args.workspaceDir ?? WORKSPACE_DIR_DEFAULT;
1078
1354
  const log = args.onLog ?? (() => {
1079
1355
  });
1080
1356
  const repos = await detectGitRepos(args.workspacePath);
@@ -1190,16 +1466,16 @@ async function seedFromGitClone(args) {
1190
1466
  const log = args.onLog ?? (() => {
1191
1467
  });
1192
1468
  let conflicts = { mergeConflicts: [], overlaySkipped: [] };
1193
- const stage = await mkdtemp5(join6(tmpdir5(), "agentbox-clone-"));
1194
- const cloneDir = join6(stage, "clone");
1195
- const tarPath = join6(stage, "workspace.tar.gz");
1196
- const untrackedTarPath = join6(stage, "untracked.tar.gz");
1469
+ const stage = await mkdtemp6(join7(tmpdir6(), "agentbox-clone-"));
1470
+ const cloneDir = join7(stage, "clone");
1471
+ const tarPath = join7(stage, "workspace.tar.gz");
1472
+ const untrackedTarPath = join7(stage, "untracked.tar.gz");
1197
1473
  const stashSha = args.useBranch || args.skipCarryOver ? null : await safeStashCreate(args.hostRepo);
1198
1474
  const untrackedSize = args.useBranch || args.skipCarryOver ? 0 : await maybeBuildUntrackedTar(args.hostRepo, untrackedTarPath);
1199
1475
  let stashRefCreated = false;
1200
1476
  try {
1201
1477
  if (stashSha) {
1202
- const ref = await execa5(
1478
+ const ref = await execa7(
1203
1479
  "git",
1204
1480
  ["-C", args.hostRepo, "update-ref", STASH_CARRYOVER_REF, stashSha],
1205
1481
  { reject: false }
@@ -1224,8 +1500,8 @@ async function seedFromGitClone(args) {
1224
1500
  log(
1225
1501
  `clone tar exceeded ${String(LARGE_BUNDLE_THRESHOLD_BYTES / (1024 * 1024))} MB at depth ${String(DEFAULT_BUNDLE_DEPTH)} (${mb} MB), rebuilding at depth ${String(LARGE_BUNDLE_DEPTH)}`
1226
1502
  );
1227
- await rm6(cloneDir, { recursive: true, force: true });
1228
- await rm6(tarPath, { force: true });
1503
+ await rm7(cloneDir, { recursive: true, force: true });
1504
+ await rm7(tarPath, { force: true });
1229
1505
  await runShallowClone(args.hostRepo, cloneDir, LARGE_BUNDLE_DEPTH, stashRefCreated, cloneBranch);
1230
1506
  await seedCloneLfsObjects(args.hostRepo, cloneDir, lfsRef, log);
1231
1507
  await tarCloneDir(cloneDir, tarPath);
@@ -1289,18 +1565,18 @@ async function seedFromGitClone(args) {
1289
1565
  if (args.overlay) conflicts = parseSeedConflicts(r.stdout);
1290
1566
  } finally {
1291
1567
  if (stashRefCreated) {
1292
- await execa5("git", ["-C", args.hostRepo, "update-ref", "-d", STASH_CARRYOVER_REF], {
1568
+ await execa7("git", ["-C", args.hostRepo, "update-ref", "-d", STASH_CARRYOVER_REF], {
1293
1569
  reject: false
1294
1570
  });
1295
1571
  }
1296
- await rm6(stage, { recursive: true, force: true });
1572
+ await rm7(stage, { recursive: true, force: true });
1297
1573
  }
1298
1574
  return conflicts;
1299
1575
  }
1300
1576
  var DELTA_TARGET_REF = "refs/agentbox-delta/target";
1301
1577
  var REMOTE_DELTA_BUNDLE = "/tmp/agentbox-delta.bundle";
1302
1578
  var REMOTE_DELTA_LFS = "/tmp/agentbox-delta-lfs.tar.gz";
1303
- var SHA_RE = /^[0-9a-f]{40}$/;
1579
+ var SHA_RE2 = /^[0-9a-f]{40}$/;
1304
1580
  async function tryReseedRepoDelta(args) {
1305
1581
  const log = args.onLog ?? (() => {
1306
1582
  });
@@ -1310,35 +1586,35 @@ async function tryReseedRepoDelta(args) {
1310
1586
  bashScript(`git -C ${wd} rev-parse HEAD 2>/dev/null || true`)
1311
1587
  );
1312
1588
  const checkpointTip = tipRes.stdout.trim();
1313
- if (!SHA_RE.test(checkpointTip)) return null;
1589
+ if (!SHA_RE2.test(checkpointTip)) return null;
1314
1590
  const baseRef = args.useBranch ?? args.fromBranch ?? "HEAD";
1315
- const targetRes = await execa5("git", ["-C", args.hostRepo, "rev-parse", baseRef], {
1591
+ const targetRes = await execa7("git", ["-C", args.hostRepo, "rev-parse", baseRef], {
1316
1592
  reject: false
1317
1593
  });
1318
1594
  const target = targetRes.stdout.trim();
1319
- if (targetRes.exitCode !== 0 || !SHA_RE.test(target)) return null;
1320
- const hasTip = await execa5(
1595
+ if (targetRes.exitCode !== 0 || !SHA_RE2.test(target)) return null;
1596
+ const hasTip = await execa7(
1321
1597
  "git",
1322
1598
  ["-C", args.hostRepo, "cat-file", "-e", `${checkpointTip}^{commit}`],
1323
1599
  { reject: false }
1324
1600
  );
1325
1601
  if (hasTip.exitCode !== 0) return null;
1326
- const ancestor = await execa5(
1602
+ const ancestor = await execa7(
1327
1603
  "git",
1328
1604
  ["-C", args.hostRepo, "merge-base", "--is-ancestor", checkpointTip, target],
1329
1605
  { reject: false }
1330
1606
  );
1331
1607
  if (ancestor.exitCode !== 0) return null;
1332
- const stage = await mkdtemp5(join6(tmpdir5(), "agentbox-delta-"));
1333
- const bundlePath = join6(stage, "delta.bundle");
1334
- const untrackedTarPath = join6(stage, "untracked.tar.gz");
1335
- const deltaLfsTarPath = join6(stage, "delta-lfs.tar.gz");
1608
+ const stage = await mkdtemp6(join7(tmpdir6(), "agentbox-delta-"));
1609
+ const bundlePath = join7(stage, "delta.bundle");
1610
+ const untrackedTarPath = join7(stage, "untracked.tar.gz");
1611
+ const deltaLfsTarPath = join7(stage, "delta-lfs.tar.gz");
1336
1612
  const stashSha = args.useBranch || args.skipCarryOver ? null : await safeStashCreate(args.hostRepo);
1337
1613
  const untrackedSize = args.useBranch || args.skipCarryOver ? 0 : await maybeBuildUntrackedTar(args.hostRepo, untrackedTarPath);
1338
1614
  let stashRefCreated = false;
1339
1615
  try {
1340
1616
  if (stashSha) {
1341
- const ref = await execa5(
1617
+ const ref = await execa7(
1342
1618
  "git",
1343
1619
  ["-C", args.hostRepo, "update-ref", STASH_CARRYOVER_REF, stashSha],
1344
1620
  { reject: false }
@@ -1347,7 +1623,7 @@ async function tryReseedRepoDelta(args) {
1347
1623
  }
1348
1624
  const needTarget = target !== checkpointTip;
1349
1625
  if (needTarget) {
1350
- await execa5("git", ["-C", args.hostRepo, "update-ref", DELTA_TARGET_REF, target], {
1626
+ await execa7("git", ["-C", args.hostRepo, "update-ref", DELTA_TARGET_REF, target], {
1351
1627
  reject: false
1352
1628
  });
1353
1629
  }
@@ -1356,7 +1632,7 @@ async function tryReseedRepoDelta(args) {
1356
1632
  if (stashRefCreated) bundleRefs.push(STASH_CARRYOVER_REF);
1357
1633
  let haveBundle = false;
1358
1634
  if (bundleRefs.length > 0) {
1359
- const b = await execa5(
1635
+ const b = await execa7(
1360
1636
  "git",
1361
1637
  ["-C", args.hostRepo, "bundle", "create", bundlePath, ...bundleRefs, `^${checkpointTip}`],
1362
1638
  { reject: false }
@@ -1420,14 +1696,14 @@ async function tryReseedRepoDelta(args) {
1420
1696
  return parseSeedConflicts(r.stdout);
1421
1697
  } finally {
1422
1698
  if (stashRefCreated) {
1423
- await execa5("git", ["-C", args.hostRepo, "update-ref", "-d", STASH_CARRYOVER_REF], {
1699
+ await execa7("git", ["-C", args.hostRepo, "update-ref", "-d", STASH_CARRYOVER_REF], {
1424
1700
  reject: false
1425
1701
  });
1426
1702
  }
1427
- await execa5("git", ["-C", args.hostRepo, "update-ref", "-d", DELTA_TARGET_REF], {
1703
+ await execa7("git", ["-C", args.hostRepo, "update-ref", "-d", DELTA_TARGET_REF], {
1428
1704
  reject: false
1429
1705
  });
1430
- await rm6(stage, { recursive: true, force: true });
1706
+ await rm7(stage, { recursive: true, force: true });
1431
1707
  }
1432
1708
  }
1433
1709
  async function runShallowClone(hostRepo, cloneDir, depth, includeStashRef, fromBranch) {
@@ -1435,7 +1711,7 @@ async function runShallowClone(hostRepo, cloneDir, depth, includeStashRef, fromB
1435
1711
  if (depth !== null) cloneArgs.push(`--depth=${String(depth)}`);
1436
1712
  if (fromBranch) cloneArgs.push("--branch", fromBranch);
1437
1713
  cloneArgs.push(`file://${hostRepo}`, cloneDir);
1438
- await execa5("git", cloneArgs);
1714
+ await execa7("git", cloneArgs);
1439
1715
  if (includeStashRef) {
1440
1716
  const fetchArgs = ["-C", cloneDir, "fetch", "--quiet"];
1441
1717
  if (depth !== null) fetchArgs.push(`--depth=${String(depth)}`);
@@ -1443,20 +1719,20 @@ async function runShallowClone(hostRepo, cloneDir, depth, includeStashRef, fromB
1443
1719
  `file://${hostRepo}`,
1444
1720
  `+${STASH_CARRYOVER_REF}:refs/remotes/origin/agentbox-carryover/stash`
1445
1721
  );
1446
- await execa5("git", fetchArgs, { reject: false });
1722
+ await execa7("git", fetchArgs, { reject: false });
1447
1723
  }
1448
1724
  }
1449
1725
  async function tarCloneDir(cloneDir, outPath) {
1450
- await execa5("tar", ["-C", cloneDir, "-czf", outPath, "."], {
1726
+ await execa7("tar", ["-C", cloneDir, "-czf", outPath, "."], {
1451
1727
  env: { ...process.env, COPYFILE_DISABLE: "1" }
1452
1728
  });
1453
1729
  }
1454
1730
  var LFS_OID_RE = /^[0-9a-f]{64}$/;
1455
1731
  function lfsObjectRelPath(oid) {
1456
- return join6("lfs", "objects", oid.slice(0, 2), oid.slice(2, 4), oid);
1732
+ return join7("lfs", "objects", oid.slice(0, 2), oid.slice(2, 4), oid);
1457
1733
  }
1458
1734
  async function lfsOidsForRef(hostRepo, ref) {
1459
- const listed = await execa5("git", ["-C", hostRepo, "lfs", "ls-files", "--long", ref], {
1735
+ const listed = await execa7("git", ["-C", hostRepo, "lfs", "ls-files", "--long", ref], {
1460
1736
  reject: false
1461
1737
  });
1462
1738
  if (listed.exitCode !== 0) return [];
@@ -1464,11 +1740,11 @@ async function lfsOidsForRef(hostRepo, ref) {
1464
1740
  return [...new Set(oids)];
1465
1741
  }
1466
1742
  async function seedCloneLfsObjects(hostRepo, cloneDir, ref, log) {
1467
- const tracked = await execa5("git", ["-C", hostRepo, "lfs", "ls-files", "-n", ref], {
1743
+ const tracked = await execa7("git", ["-C", hostRepo, "lfs", "ls-files", "-n", ref], {
1468
1744
  reject: false
1469
1745
  });
1470
1746
  if (tracked.exitCode !== 0 || tracked.stdout.trim().length === 0) return;
1471
- const fetched = await execa5("git", ["-C", hostRepo, "lfs", "fetch", "origin", ref], {
1747
+ const fetched = await execa7("git", ["-C", hostRepo, "lfs", "fetch", "origin", ref], {
1472
1748
  reject: false
1473
1749
  });
1474
1750
  if (fetched.exitCode !== 0) {
@@ -1479,10 +1755,10 @@ async function seedCloneLfsObjects(hostRepo, cloneDir, ref, log) {
1479
1755
  let copied = 0;
1480
1756
  for (const oid of oids) {
1481
1757
  const rel = lfsObjectRelPath(oid);
1482
- const dst = join6(cloneDir, ".git", rel);
1758
+ const dst = join7(cloneDir, ".git", rel);
1483
1759
  try {
1484
- await mkdir3(dirname3(dst), { recursive: true });
1485
- await copyFile(join6(hostRepo, ".git", rel), dst);
1760
+ await mkdir2(dirname2(dst), { recursive: true });
1761
+ await copyFile(join7(hostRepo, ".git", rel), dst);
1486
1762
  copied++;
1487
1763
  } catch {
1488
1764
  }
@@ -1495,19 +1771,19 @@ async function maybeBuildDeltaLfsTar(hostRepo, target, checkpointTip, outPath) {
1495
1771
  const have = new Set(await lfsOidsForRef(hostRepo, checkpointTip));
1496
1772
  const deltaOids = targetOids.filter((o) => !have.has(o));
1497
1773
  if (deltaOids.length === 0) return 0;
1498
- await execa5("git", ["-C", hostRepo, "lfs", "fetch", "origin", target], { reject: false });
1499
- const gitDir = join6(hostRepo, ".git");
1774
+ await execa7("git", ["-C", hostRepo, "lfs", "fetch", "origin", target], { reject: false });
1775
+ const gitDir = join7(hostRepo, ".git");
1500
1776
  const relPaths = [];
1501
1777
  for (const oid of deltaOids) {
1502
1778
  const rel = lfsObjectRelPath(oid);
1503
1779
  try {
1504
- await stat(join6(gitDir, rel));
1780
+ await stat(join7(gitDir, rel));
1505
1781
  relPaths.push(rel);
1506
1782
  } catch {
1507
1783
  }
1508
1784
  }
1509
1785
  if (relPaths.length === 0) return 0;
1510
- const tar = await execa5("tar", ["-C", gitDir, "-czf", outPath, ...relPaths], {
1786
+ const tar = await execa7("tar", ["-C", gitDir, "-czf", outPath, ...relPaths], {
1511
1787
  env: { ...process.env, COPYFILE_DISABLE: "1" },
1512
1788
  reject: false
1513
1789
  });
@@ -1522,19 +1798,19 @@ async function safeFileSize(path) {
1522
1798
  }
1523
1799
  }
1524
1800
  async function safeStashCreate(hostRepo) {
1525
- const r = await execa5("git", ["-C", hostRepo, "stash", "create"], { reject: false });
1801
+ const r = await execa7("git", ["-C", hostRepo, "stash", "create"], { reject: false });
1526
1802
  if (r.exitCode !== 0) return null;
1527
1803
  const sha = r.stdout.trim();
1528
1804
  return sha.length > 0 ? sha : null;
1529
1805
  }
1530
1806
  async function maybeBuildUntrackedTar(hostRepo, outPath) {
1531
- const list = await execa5(
1807
+ const list = await execa7(
1532
1808
  "git",
1533
1809
  ["-C", hostRepo, "ls-files", "--others", "--exclude-standard", "-z"],
1534
1810
  { reject: false }
1535
1811
  );
1536
1812
  if (list.exitCode !== 0 || list.stdout.length === 0) return 0;
1537
- const tar = await execa5(
1813
+ const tar = await execa7(
1538
1814
  "tar",
1539
1815
  ["-C", hostRepo, "--null", "-T", "-", "-czf", outPath],
1540
1816
  {
@@ -1553,16 +1829,16 @@ async function maybeBuildUntrackedTar(hostRepo, outPath) {
1553
1829
  }
1554
1830
  }
1555
1831
  async function readOriginUrl(hostRepo) {
1556
- const r = await execa5("git", ["-C", hostRepo, "remote", "get-url", "origin"], { reject: false });
1832
+ const r = await execa7("git", ["-C", hostRepo, "remote", "get-url", "origin"], { reject: false });
1557
1833
  if (r.exitCode !== 0) return null;
1558
1834
  const out = (r.stdout ?? "").trim();
1559
1835
  return out.length > 0 ? out : null;
1560
1836
  }
1561
1837
  async function seedFromTar(args) {
1562
- const stage = await mkdtemp5(join6(tmpdir5(), "agentbox-tar-"));
1563
- const tarPath = join6(stage, "workspace.tar.gz");
1838
+ const stage = await mkdtemp6(join7(tmpdir6(), "agentbox-tar-"));
1839
+ const tarPath = join7(stage, "workspace.tar.gz");
1564
1840
  try {
1565
- await execa5("tar", ["-C", args.hostDir, "-czf", tarPath, "."]);
1841
+ await execa7("tar", ["-C", args.hostDir, "-czf", tarPath, "."]);
1566
1842
  const remoteTar = "/tmp/agentbox-workspace.tar.gz";
1567
1843
  await args.backend.uploadFile(args.handle, tarPath, remoteTar);
1568
1844
  const SUDO = `if command -v sudo >/dev/null 2>&1; then SUDO='sudo -n'; else SUDO=''; fi`;
@@ -1586,7 +1862,7 @@ async function seedFromTar(args) {
1586
1862
  throw new Error(`workspace seed (tar) failed: ${r.stderr || r.stdout}`);
1587
1863
  }
1588
1864
  } finally {
1589
- await rm6(stage, { recursive: true, force: true });
1865
+ await rm7(stage, { recursive: true, force: true });
1590
1866
  }
1591
1867
  }
1592
1868
  var CLOUD_WORKSPACE_DIR = "/workspace";
@@ -1789,15 +2065,7 @@ function createCloudProvider(backend, opts = {}) {
1789
2065
  }
1790
2066
  };
1791
2067
  await recordBox(next);
1792
- if (opts.launchDockerd !== false) {
1793
- try {
1794
- const dockerd = await launchCloudDockerdDaemon({ backend, handle: h, timeoutMs: 6e4 });
1795
- if (!dockerd.up) {
1796
- }
1797
- } catch {
1798
- }
1799
- }
1800
- await launchCloudCtlDaemon({
2068
+ await kickCloudBootstrap({
1801
2069
  backend,
1802
2070
  handle: h,
1803
2071
  boxId: box.id,
@@ -1806,15 +2074,37 @@ function createCloudProvider(backend, opts = {}) {
1806
2074
  relayToken: box.relayToken ?? "",
1807
2075
  bridgeToken: box.cloud?.bridgeToken,
1808
2076
  webProxyPort: backend.webProxyPort,
2077
+ launchDockerd: opts.launchDockerd !== false,
2078
+ vncPassword: box.vncEnabled ? box.vncPassword : void 0,
2079
+ controlPlaneUrl: box.cloud?.controlPlaneUrl,
2080
+ gitPushMode: box.cloud?.gitPushMode,
1809
2081
  boxHost: deriveCloudBoxHost(box.name, webPreview?.url)
1810
2082
  });
1811
- if (box.vncEnabled && box.vncPassword) {
1812
- try {
1813
- await launchCloudVncDaemon({ backend, handle: h, vncPassword: box.vncPassword });
1814
- } catch {
2083
+ if (box.cloud?.controlPlaneUrl && box.relayToken) {
2084
+ const adminToken = process.env.AGENTBOX_RELAY_ADMIN_TOKEN;
2085
+ const originUrl = await readGitOriginUrl(box.workspacePath).catch(() => void 0);
2086
+ if (adminToken && originUrl) {
2087
+ try {
2088
+ await registerBoxWithPlane({
2089
+ controlPlaneUrl: box.cloud.controlPlaneUrl,
2090
+ adminToken,
2091
+ boxId: box.id,
2092
+ token: box.relayToken,
2093
+ name: box.name,
2094
+ originUrl,
2095
+ backend: backend.name,
2096
+ bridgeToken: box.cloud.bridgeToken,
2097
+ previewUrl: relayPreview?.url,
2098
+ previewToken: relayPreview?.token,
2099
+ createdAt: box.createdAt,
2100
+ projectIndex: box.projectIndex,
2101
+ autoApproveHostActions: box.autoApproveHostActions,
2102
+ autoApproveSafeHostActions: box.autoApproveSafeHostActions
2103
+ });
2104
+ } catch {
2105
+ }
1815
2106
  }
1816
- }
1817
- if (relayPreview && box.relayToken && box.cloud?.bridgeToken) {
2107
+ } else if (relayPreview && box.relayToken && box.cloud?.bridgeToken) {
1818
2108
  try {
1819
2109
  await registerBoxWithRelay({
1820
2110
  boxId: box.id,
@@ -1827,7 +2117,8 @@ function createCloudProvider(backend, opts = {}) {
1827
2117
  bridgeToken: box.cloud.bridgeToken,
1828
2118
  createdAt: box.createdAt,
1829
2119
  projectIndex: box.projectIndex,
1830
- autoApproveHostActions: box.autoApproveHostActions
2120
+ autoApproveHostActions: box.autoApproveHostActions,
2121
+ autoApproveSafeHostActions: box.autoApproveSafeHostActions
1831
2122
  });
1832
2123
  } catch {
1833
2124
  }
@@ -1931,90 +2222,64 @@ function createCloudProvider(backend, opts = {}) {
1931
2222
  throw err;
1932
2223
  }
1933
2224
  }
2225
+ const inBoxClone = req.inBoxClone ? {
2226
+ authedUrl: req.inBoxClone.authedUrl,
2227
+ originUrl: req.inBoxClone.originUrl,
2228
+ branch: req.inBoxClone.branch,
2229
+ depth: req.bundleDepth
2230
+ } : void 0;
1934
2231
  try {
1935
- const seedResult = await seedCloudWorkspace({
1936
- backend,
1937
- handle,
1938
- workspacePath: req.workspacePath,
1939
- branch,
1940
- workspaceDir: CLOUD_WORKSPACE_DIR,
1941
- bundleDepth: req.bundleDepth,
1942
- fromBranch: req.fromBranch,
1943
- useBranch: req.useBranch,
1944
- overlay: Boolean(snapshotName),
1945
- // `--no-resync` (resyncOnStart === false): re-branch the box to the
1946
- // host tip but skip replaying the host's uncommitted/untracked state
1947
- // onto the warm checkpoint tree — matches docker's gated resync.
1948
- skipCarryOver: Boolean(snapshotName) && req.resyncOnStart === false,
1949
- onLog: log
1950
- });
1951
- const resync = seedResult.resync && seedResult.resync.hadConflicts ? seedResult.resync : void 0;
1952
- await refreshAgentCredentialsBackup({ onLog: log });
1953
- if (agentVolumes.agents.length > 0) {
1954
- await seedAgentVolumesIfFresh(backend, handle, {
1955
- agents: agentVolumes.agents,
1956
- hostWorkspace: req.workspacePath,
2232
+ let resync;
2233
+ if (inBoxClone) {
2234
+ log("skipping host workspace seed \u2014 box will clone in-box at bootstrap");
2235
+ } else {
2236
+ const seedResult = await seedCloudWorkspace({
2237
+ backend,
2238
+ handle,
2239
+ workspacePath: req.workspacePath,
2240
+ branch,
2241
+ workspaceDir: CLOUD_WORKSPACE_DIR,
2242
+ bundleDepth: req.bundleDepth,
2243
+ fromBranch: req.fromBranch,
2244
+ useBranch: req.useBranch,
2245
+ overlay: Boolean(snapshotName),
2246
+ // `--no-resync` (resyncOnStart === false): re-branch the box to the
2247
+ // host tip but skip replaying the host's uncommitted/untracked state
2248
+ // onto the warm checkpoint tree — matches docker's gated resync.
2249
+ skipCarryOver: Boolean(snapshotName) && req.resyncOnStart === false,
1957
2250
  onLog: log
1958
2251
  });
2252
+ resync = seedResult.resync && seedResult.resync.hadConflicts ? seedResult.resync : void 0;
1959
2253
  }
1960
- await ensureAgentHomeDirsOwned(backend, handle, { onLog: log });
1961
- await ensureCodexAgentsOverride(backend, handle, { onLog: log });
1962
- await seedOpencodeModelState(backend, handle, { onLog: log });
1963
- await seedClaudeJsonAtCreate(backend, handle, {
2254
+ const syncCtx = makeSyncContext({
2255
+ boxName: name,
2256
+ boxId: id,
2257
+ provider: "cloud",
1964
2258
  hostWorkspace: req.workspacePath,
2259
+ projectRoot: req.projectRoot,
2260
+ boxWorkspace: CLOUD_WORKSPACE_DIR,
1965
2261
  onLog: log
1966
2262
  });
1967
- await seedDynamicConfig(backend, handle, { workspacePath: req.workspacePath, onLog: log });
1968
- await seedGitIdentity(backend, handle, { hostRepo: req.workspacePath, onLog: log });
2263
+ const sync = makeCloudSync(backend, handle, { agents: agentVolumes.agents });
2264
+ await sync.seedCredentials(syncCtx);
2265
+ await sync.seedAgentConfig(syncCtx);
2266
+ await sync.seedGitIdentity(syncCtx);
1969
2267
  if (req.envFilesToImport && req.envFilesToImport.length > 0) {
1970
- const { copied } = await uploadEnvFiles({
1971
- backend,
1972
- handle,
1973
- workspacePath: req.workspacePath,
1974
- files: req.envFilesToImport,
1975
- workspaceDir: CLOUD_WORKSPACE_DIR,
1976
- onLog: log
1977
- });
2268
+ const { copied } = await sync.seedEnvFiles(syncCtx, req.envFilesToImport);
1978
2269
  if (copied > 0) log(`copied ${String(copied)} env/config file(s) into /workspace`);
1979
2270
  }
1980
2271
  let carrySummary;
1981
2272
  if (req.carry && req.carry.length > 0) {
1982
2273
  log(`carry: copying ${String(req.carry.length)} host path(s) into the box`);
1983
- const entries = await renderCarryEntries(
1984
- req.carry,
1985
- {
1986
- name,
1987
- id,
1988
- kind: "cloud",
1989
- hostWorkspace: req.workspacePath,
1990
- projectRoot: req.projectRoot
1991
- },
1992
- log
1993
- );
1994
- const result = await uploadCarryPaths({
1995
- backend,
1996
- handle,
1997
- entries,
1998
- onLog: log
1999
- });
2274
+ const result = await sync.applyCarry(syncCtx, req.carry);
2000
2275
  log(`carry: copied ${String(result.copied)}/${String(req.carry.length)} entry/entries`);
2001
2276
  for (const err of result.errors) log(`carry: ${err}`);
2002
2277
  if (result.applied.length > 0) {
2003
2278
  carrySummary = { count: result.applied.length, entries: result.applied };
2004
2279
  }
2005
2280
  }
2006
- if (opts.launchDockerd !== false) {
2007
- log("launching in-box dockerd");
2008
- try {
2009
- const dockerd = await launchCloudDockerdDaemon({ backend, handle, timeoutMs: 6e4 });
2010
- if (!dockerd.up)
2011
- log(`dockerd did not become ready (continuing): ${dockerd.reason ?? "unknown"}`);
2012
- } catch (err) {
2013
- log(
2014
- `dockerd daemon launch failed (continuing): ${err instanceof Error ? err.message : String(err)}`
2015
- );
2016
- }
2017
- }
2281
+ const vncEnabled = req.vnc?.enabled !== false;
2282
+ const vncPassword = vncEnabled ? generateVncPassword() : void 0;
2018
2283
  const wp = backend.webProxyPort ?? CLOUD_WEB_PROXY_PORT;
2019
2284
  let webPreview;
2020
2285
  try {
@@ -2022,8 +2287,8 @@ function createCloudProvider(backend, opts = {}) {
2022
2287
  } catch {
2023
2288
  webPreview = void 0;
2024
2289
  }
2025
- log("launching agentbox-ctl daemon");
2026
- await launchCloudCtlDaemon({
2290
+ log("running in-box bootstrap (clone? + dockerd + ctl + vnc)");
2291
+ await kickCloudBootstrap({
2027
2292
  backend,
2028
2293
  handle,
2029
2294
  boxId: id,
@@ -2032,20 +2297,14 @@ function createCloudProvider(backend, opts = {}) {
2032
2297
  relayToken,
2033
2298
  bridgeToken,
2034
2299
  webProxyPort: backend.webProxyPort,
2035
- boxHost: deriveCloudBoxHost(name, webPreview?.url)
2300
+ launchDockerd: opts.launchDockerd !== false,
2301
+ vncPassword,
2302
+ clone: inBoxClone,
2303
+ controlPlaneUrl: req.controlPlaneUrl,
2304
+ gitPushMode: req.gitPushMode,
2305
+ boxHost: deriveCloudBoxHost(name, webPreview?.url),
2306
+ onLog: log
2036
2307
  });
2037
- const vncEnabled = req.vnc?.enabled !== false;
2038
- const vncPassword = vncEnabled ? generateVncPassword() : void 0;
2039
- if (vncEnabled && vncPassword) {
2040
- log("launching VNC stack (Xvnc + websockify + noVNC)");
2041
- try {
2042
- await launchCloudVncDaemon({ backend, handle, vncPassword });
2043
- } catch (err) {
2044
- log(
2045
- `VNC daemon launch failed (continuing): ${err instanceof Error ? err.message : String(err)}`
2046
- );
2047
- }
2048
- }
2049
2308
  const portlessOpt = req.providerOptions?.["portless"] ?? true;
2050
2309
  let portlessAliasName;
2051
2310
  let portlessUrlResolved;
@@ -2102,8 +2361,45 @@ function createCloudProvider(backend, opts = {}) {
2102
2361
  }
2103
2362
  const state = await readState();
2104
2363
  const projectIndex = req.projectRoot ? allocateProjectIndex(state, req.projectRoot) : void 0;
2105
- const autoApproveHostActions = (await loadEffectiveConfig(req.projectRoot ?? req.workspacePath)).effective.box.autoApproveHostActions;
2106
- if (relayPreview) {
2364
+ const effectiveBoxForApprove = (await loadEffectiveConfig(req.projectRoot ?? req.workspacePath)).effective.box;
2365
+ const autoApproveHostActions = effectiveBoxForApprove.autoApproveHostActions;
2366
+ const autoApproveSafeHostActions = effectiveBoxForApprove.autoApproveSafeHostActions;
2367
+ if (req.controlPlaneUrl) {
2368
+ const adminToken = process.env.AGENTBOX_RELAY_ADMIN_TOKEN;
2369
+ const originUrl = req.inBoxClone ? req.inBoxClone.originUrl : await readGitOriginUrl(req.workspacePath).catch(() => void 0);
2370
+ if (!adminToken) {
2371
+ log(
2372
+ "control-plane URL configured but AGENTBOX_RELAY_ADMIN_TOKEN is unset; box git push (lease) will fail until the box is registered on the plane"
2373
+ );
2374
+ } else if (!originUrl) {
2375
+ log(
2376
+ "control-plane box: could not resolve the workspace origin URL; lease-push will fail until the box is registered on the plane with an origin"
2377
+ );
2378
+ } else {
2379
+ try {
2380
+ await registerBoxWithPlane({
2381
+ controlPlaneUrl: req.controlPlaneUrl,
2382
+ adminToken,
2383
+ boxId: id,
2384
+ token: relayToken,
2385
+ name,
2386
+ originUrl,
2387
+ backend: backend.name,
2388
+ bridgeToken,
2389
+ previewUrl: relayPreview?.url,
2390
+ previewToken: relayPreview?.token,
2391
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
2392
+ projectIndex,
2393
+ autoApproveHostActions,
2394
+ autoApproveSafeHostActions
2395
+ });
2396
+ } catch (err) {
2397
+ log(
2398
+ `register with control plane failed (continuing): ${err instanceof Error ? err.message : String(err)}`
2399
+ );
2400
+ }
2401
+ }
2402
+ } else if (relayPreview) {
2107
2403
  try {
2108
2404
  await registerBoxWithRelay({
2109
2405
  boxId: id,
@@ -2116,7 +2412,8 @@ function createCloudProvider(backend, opts = {}) {
2116
2412
  previewToken: relayPreview.token,
2117
2413
  bridgeToken,
2118
2414
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
2119
- autoApproveHostActions
2415
+ autoApproveHostActions,
2416
+ autoApproveSafeHostActions
2120
2417
  });
2121
2418
  } catch (err) {
2122
2419
  log(
@@ -2143,6 +2440,7 @@ function createCloudProvider(backend, opts = {}) {
2143
2440
  withPlaywright: req.withPlaywright,
2144
2441
  withEnv: req.withEnv,
2145
2442
  autoApproveHostActions: autoApproveHostActions ? true : void 0,
2443
+ autoApproveSafeHostActions: autoApproveSafeHostActions === false ? false : void 0,
2146
2444
  carry: carrySummary,
2147
2445
  portlessAlias: portlessAliasName,
2148
2446
  portlessUrl: portlessUrlResolved,
@@ -2172,7 +2470,15 @@ function createCloudProvider(backend, opts = {}) {
2172
2470
  bridgeToken,
2173
2471
  snapshotRef: resolvedCheckpointRef,
2174
2472
  lastState: "running",
2175
- sessionTimeoutMs: timeoutMs
2473
+ sessionTimeoutMs: timeoutMs,
2474
+ // Only host-seeded boxes share a fork base with the host, so only
2475
+ // they can be resynced back to the host tip on session start (7.5).
2476
+ // inBoxClone / plane boxes clone from a leased URL — left unset.
2477
+ hostSeeded: inBoxClone ? void 0 : true,
2478
+ workspaceBranch: branch,
2479
+ topology: resolveSyncTopology(backend.name, req.controlPlaneUrl),
2480
+ controlPlaneUrl: req.controlPlaneUrl,
2481
+ gitPushMode: req.gitPushMode
2176
2482
  },
2177
2483
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
2178
2484
  };
@@ -2360,6 +2666,40 @@ function createCloudProvider(backend, opts = {}) {
2360
2666
  // create` then surfaces a clean "not supported" error rather than a
2361
2667
  // silent no-op.
2362
2668
  checkpoint: makeCloudCheckpoint(backend),
2669
+ sync(box) {
2670
+ return makeCloudSync(backend, handleFor(box));
2671
+ },
2672
+ // Session-start live-box resync (Phase 7.5): merge the host's current state
2673
+ // back into the box, box-wins on conflict. Gated on `hostSeeded` so
2674
+ // inBoxClone / plane boxes (no host fork base) are left untouched. The box
2675
+ // layout is re-derived host-side (`detectGitRepos`) rather than recorded.
2676
+ async resyncWorkspace(box, onLog) {
2677
+ if (box.cloud?.hostSeeded !== true) return { repos: [], hadConflicts: false };
2678
+ const repos = await detectGitRepos(box.workspacePath);
2679
+ if (repos.length === 0) return { repos: [], hadConflicts: false };
2680
+ const branch = box.cloud.workspaceBranch ?? `agentbox/${box.name}`;
2681
+ const worktrees = repos.map((r) => {
2682
+ const containerPath = r.relPathFromWorkspace ? `${CLOUD_WORKSPACE_DIR}/${r.relPathFromWorkspace}` : CLOUD_WORKSPACE_DIR;
2683
+ return {
2684
+ kind: r.kind,
2685
+ hostMainRepo: r.hostMainRepo,
2686
+ containerPath,
2687
+ // Cloud boxes clone in place, so the worktree lives at its mount path.
2688
+ gitWorktreePath: containerPath,
2689
+ branch,
2690
+ relPathFromWorkspace: r.relPathFromWorkspace
2691
+ };
2692
+ });
2693
+ const ctx = makeSyncContext({
2694
+ boxName: box.name,
2695
+ boxId: box.id,
2696
+ provider: "cloud",
2697
+ hostWorkspace: box.workspacePath,
2698
+ boxWorkspace: CLOUD_WORKSPACE_DIR,
2699
+ onLog
2700
+ });
2701
+ return makeCloudSync(backend, handleFor(box)).resyncWorkspace(ctx, worktrees);
2702
+ },
2363
2703
  // Extract the box's agent login(s) back to the host (~/.agentbox) so the
2364
2704
  // next box inherits the login. Lives on the base cloud provider (not inside
2365
2705
  // `checkpoint.create`) so it works even for providers that override the
@@ -2367,7 +2707,13 @@ function createCloudProvider(backend, opts = {}) {
2367
2707
  // `checkpoint create --set-default`, while the box is guaranteed running.
2368
2708
  async extractAgentCredentials(box) {
2369
2709
  if (!box.cloud?.sandboxId) return [];
2370
- return extractCloudAgentCredentials(backend, { sandboxId: box.cloud.sandboxId });
2710
+ const ctx = makeSyncContext({
2711
+ boxName: box.name,
2712
+ boxId: box.id,
2713
+ provider: "cloud",
2714
+ hostWorkspace: box.workspacePath
2715
+ });
2716
+ return makeCloudSync(backend, handleFor(box)).extractCredentials(ctx);
2371
2717
  }
2372
2718
  // stats is provider-optional; cloud backends without a metrics API just
2373
2719
  // omit it. Backends that have one can decorate the returned provider.
@@ -2490,15 +2836,17 @@ export {
2490
2836
  ensureAgentVolumesForCloud,
2491
2837
  seedAgentVolumesIfFresh,
2492
2838
  agentSpecsForCloud,
2839
+ listCloudBackendDirs,
2493
2840
  listCloudCheckpoints,
2494
2841
  listAllCloudCheckpoints,
2495
2842
  resolveCloudCheckpoint,
2496
2843
  writeCloudCheckpointManifest,
2497
2844
  currentCloudBaseFingerprint,
2845
+ baseFreshnessFromFingerprints,
2498
2846
  removeCloudCheckpointDir,
2499
2847
  probeCloudCheckpoint,
2500
2848
  createCloudProvider,
2501
2849
  hostTermForCloud,
2502
2850
  renderInnerCommand
2503
2851
  };
2504
- //# sourceMappingURL=chunk-QKL7PCXQ.js.map
2852
+ //# sourceMappingURL=chunk-CDEJ2GQK.js.map