@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
@@ -0,0 +1,3341 @@
1
+ import { createRequire as __cr } from 'node:module'; import { fileURLToPath as __f } from 'node:url'; import { dirname as __d } from 'node:path'; const require = __cr(import.meta.url); const __filename = __f(import.meta.url); const __dirname = __d(__filename);
2
+ import {
3
+ execa
4
+ } from "./chunk-EFW34I43.js";
5
+
6
+ // ../../packages/core/dist/index.js
7
+ import { randomBytes } from "crypto";
8
+ import { homedir } from "os";
9
+ import { isAbsolute, join, resolve } from "path";
10
+ import { realpath } from "fs/promises";
11
+ import { basename, dirname, isAbsolute as isAbsolute2, normalize, resolve as resolve2, sep } from "path";
12
+ var PLACEHOLDER_KEYS = [
13
+ "AGENTBOX_BOX_NAME",
14
+ "AGENTBOX_BOX_ID",
15
+ "AGENTBOX_BOX_KIND",
16
+ "AGENTBOX_HOST_WORKSPACE",
17
+ "AGENTBOX_PROJECT_ROOT",
18
+ // Convenience: the host this box is reachable at. Derived from
19
+ // AGENTBOX_BOX_NAME as `<box-name>.localhost` when not set explicitly (the
20
+ // portless host for docker/hetzner). Public-URL cloud providers
21
+ // (vercel/daytona/e2b) set it explicitly at boot to the real preview host
22
+ // (e.g. `<sub>.vercel.run`), which then wins over the derived fallback.
23
+ "AGENTBOX_BOX_HOST"
24
+ ];
25
+ var PLACEHOLDER_SET = new Set(PLACEHOLDER_KEYS);
26
+ var ReplaceError = class extends Error {
27
+ constructor(message) {
28
+ super(message);
29
+ this.name = "ReplaceError";
30
+ }
31
+ };
32
+ var PLACEHOLDER_RE = /\{\{\s*([A-Z0-9_]+)\s*\}\}/g;
33
+ function substitutePlaceholders(text, context, onWarn) {
34
+ return text.replace(PLACEHOLDER_RE, (match, name) => {
35
+ if (!PLACEHOLDER_SET.has(name)) return match;
36
+ const value = context[name];
37
+ if (value === void 0) {
38
+ onWarn?.(`placeholder {{${name}}} has no value in this context \u2014 left untouched`);
39
+ return match;
40
+ }
41
+ return value;
42
+ });
43
+ }
44
+ function applyReplacements(content, opts) {
45
+ let out = content;
46
+ if (opts.env) {
47
+ out = substitutePlaceholders(out, opts.context, opts.onWarn);
48
+ }
49
+ for (const rule of opts.rules ?? []) {
50
+ const to = substitutePlaceholders(rule.to, opts.context, opts.onWarn);
51
+ if (rule.regex) {
52
+ let re;
53
+ try {
54
+ re = new RegExp(rule.from, rule.flags ?? "g");
55
+ } catch (err) {
56
+ throw new ReplaceError(
57
+ `invalid regex "${rule.from}": ${err instanceof Error ? err.message : String(err)}`
58
+ );
59
+ }
60
+ out = out.replace(re, to);
61
+ } else {
62
+ out = out.split(rule.from).join(to);
63
+ }
64
+ }
65
+ return out;
66
+ }
67
+ function deriveBoxHost(ctx) {
68
+ if (ctx.AGENTBOX_BOX_HOST === void 0 && ctx.AGENTBOX_BOX_NAME !== void 0) {
69
+ ctx.AGENTBOX_BOX_HOST = `${ctx.AGENTBOX_BOX_NAME}.localhost`;
70
+ }
71
+ return ctx;
72
+ }
73
+ function isPlainObject(v) {
74
+ return typeof v === "object" && v !== null && !Array.isArray(v);
75
+ }
76
+ var RULE_KEYS = /* @__PURE__ */ new Set(["from", "to", "regex", "flags"]);
77
+ function parseReplaceRule(raw, where) {
78
+ if (!isPlainObject(raw)) {
79
+ throw new ReplaceError(`${where} must be a mapping with at least { from, to }`);
80
+ }
81
+ for (const key of Object.keys(raw)) {
82
+ if (!RULE_KEYS.has(key)) throw new ReplaceError(`${where} has unknown key "${key}"`);
83
+ }
84
+ if (typeof raw.from !== "string" || raw.from.length === 0) {
85
+ throw new ReplaceError(`${where}.from must be a non-empty string`);
86
+ }
87
+ if (typeof raw.to !== "string") {
88
+ throw new ReplaceError(`${where}.to must be a string`);
89
+ }
90
+ const rule = { from: raw.from, to: raw.to };
91
+ if (raw.regex !== void 0 && raw.regex !== null) {
92
+ if (typeof raw.regex !== "boolean") throw new ReplaceError(`${where}.regex must be a boolean`);
93
+ rule.regex = raw.regex;
94
+ }
95
+ if (raw.flags !== void 0 && raw.flags !== null) {
96
+ if (typeof raw.flags !== "string") throw new ReplaceError(`${where}.flags must be a string`);
97
+ rule.flags = raw.flags;
98
+ }
99
+ if (rule.regex) {
100
+ try {
101
+ new RegExp(rule.from, rule.flags ?? "g");
102
+ } catch (err) {
103
+ throw new ReplaceError(
104
+ `${where}.from is not a valid regex: ${err instanceof Error ? err.message : String(err)}`
105
+ );
106
+ }
107
+ }
108
+ return rule;
109
+ }
110
+ function parseReplaceRules(raw, where) {
111
+ if (raw === void 0 || raw === null) return [];
112
+ if (!Array.isArray(raw)) throw new ReplaceError(`${where} must be a list of rules`);
113
+ return raw.map((r, i) => parseReplaceRule(r, `${where}[${String(i)}]`));
114
+ }
115
+ function parseReplacements(raw) {
116
+ if (raw === void 0 || raw === null) return {};
117
+ if (!isPlainObject(raw)) {
118
+ throw new ReplaceError("replacements must be a mapping of name \u2192 rule list");
119
+ }
120
+ const out = {};
121
+ for (const [name, rules] of Object.entries(raw)) {
122
+ if (!/^[A-Za-z0-9_-]+$/.test(name)) {
123
+ throw new ReplaceError(`replacements.${name}: name must match [A-Za-z0-9_-]+`);
124
+ }
125
+ out[name] = parseReplaceRules(rules, `replacements.${name}`);
126
+ }
127
+ return out;
128
+ }
129
+ var UserFacingError = class extends Error {
130
+ constructor(message) {
131
+ super(message);
132
+ this.name = "UserFacingError";
133
+ }
134
+ };
135
+ var BoxNotFoundError = class extends Error {
136
+ constructor(query) {
137
+ super(`no agentbox matches "${query}"`);
138
+ this.query = query;
139
+ this.name = "BoxNotFoundError";
140
+ }
141
+ query;
142
+ };
143
+ var AmbiguousBoxError = class extends Error {
144
+ constructor(query, matches) {
145
+ const ids = matches.map((m) => m.id).join(", ");
146
+ super(`"${query}" matches multiple boxes: ${ids}`);
147
+ this.query = query;
148
+ this.matches = matches;
149
+ this.name = "AmbiguousBoxError";
150
+ }
151
+ query;
152
+ matches;
153
+ };
154
+ var BOX_ID_PREFIX = "b";
155
+ function generateBoxId() {
156
+ return `${BOX_ID_PREFIX}${randomBytes(4).toString("hex")}`;
157
+ }
158
+ function normalizeLastAgent(raw) {
159
+ if (!raw) return void 0;
160
+ if (raw === "claude-code" || raw === "claude") return "claude";
161
+ if (raw === "codex") return "codex";
162
+ if (raw === "opencode") return "opencode";
163
+ return void 0;
164
+ }
165
+ var SYNC_DRYRUN_ENV = "AGENTBOX_SYNC_DRYRUN";
166
+ function dryRunProviderSync(label) {
167
+ const note = (ctx, op, detail = "") => ctx.onLog(`[sync dry-run] ${label}.${op}(${detail})`);
168
+ return {
169
+ resyncWorkspace(ctx, worktrees) {
170
+ note(ctx, "resyncWorkspace", `${String(worktrees.length)} worktree(s)`);
171
+ return Promise.resolve({ repos: [], hadConflicts: false });
172
+ },
173
+ seedAgentConfig(ctx) {
174
+ note(ctx, "seedAgentConfig");
175
+ return Promise.resolve();
176
+ },
177
+ seedCredentials(ctx) {
178
+ note(ctx, "seedCredentials");
179
+ return Promise.resolve();
180
+ },
181
+ extractCredentials(ctx) {
182
+ note(ctx, "extractCredentials");
183
+ return Promise.resolve([]);
184
+ },
185
+ seedGitIdentity(ctx) {
186
+ note(ctx, "seedGitIdentity");
187
+ return Promise.resolve();
188
+ },
189
+ seedEnvFiles(ctx, patterns) {
190
+ note(ctx, "seedEnvFiles", `${String(patterns.length)} pattern(s)`);
191
+ return Promise.resolve({ copied: 0 });
192
+ },
193
+ applyCarry(ctx, entries) {
194
+ note(ctx, "applyCarry", `${String(entries.length)} entry/entries`);
195
+ return Promise.resolve({ copied: 0, errors: [], applied: [] });
196
+ }
197
+ };
198
+ }
199
+ function resolveSyncTopology(providerName, controlPlaneUrl) {
200
+ if (providerName === "docker") return "docker";
201
+ return controlPlaneUrl && controlPlaneUrl.length > 0 ? "control-plane" : "cloud";
202
+ }
203
+ function parseDownloadKind(method) {
204
+ return method.split(".")[1] ?? "workspace";
205
+ }
206
+ function resolveHostPath(workspacePath, hostPath) {
207
+ if (isAbsolute(hostPath)) return hostPath;
208
+ if (hostPath === "~") return homedir();
209
+ if (hostPath.startsWith("~/")) return join(homedir(), hostPath.slice(2));
210
+ return workspacePath ? resolve(workspacePath, hostPath) : resolve(hostPath);
211
+ }
212
+ async function realpathSafe(p) {
213
+ try {
214
+ return await realpath(p);
215
+ } catch {
216
+ return resolve2(p);
217
+ }
218
+ }
219
+ function isInside(child, parent) {
220
+ const c = resolve2(child);
221
+ const p = resolve2(parent);
222
+ if (c === p) return true;
223
+ return c.startsWith(p + sep);
224
+ }
225
+ async function realpathDeepestExisting(p) {
226
+ let cur = resolve2(p);
227
+ const tail = [];
228
+ for (; ; ) {
229
+ try {
230
+ const real = await realpath(cur);
231
+ return tail.length > 0 ? resolve2(real, ...tail.reverse()) : real;
232
+ } catch (err) {
233
+ if (err.code !== "ENOENT") return resolve2(p);
234
+ const parent = dirname(cur);
235
+ if (parent === cur) return resolve2(p);
236
+ tail.push(basename(cur));
237
+ cur = parent;
238
+ }
239
+ }
240
+ }
241
+ async function isContainedInWorkspace(hostPath, workspacePath) {
242
+ if (!workspacePath) return false;
243
+ if (!isAbsolute2(hostPath)) return false;
244
+ if (normalize(hostPath).split(sep).includes("..")) return false;
245
+ const wsReal = await realpathSafe(workspacePath);
246
+ const real = await realpathDeepestExisting(hostPath);
247
+ return isInside(real, wsReal);
248
+ }
249
+ var SECRET_DIR_SEGMENTS = /* @__PURE__ */ new Set([".ssh", ".aws", ".gnupg"]);
250
+ var SECRET_BASENAMES = /* @__PURE__ */ new Set(["credentials", ".npmrc", ".netrc", ".pgpass", ".htpasswd"]);
251
+ var SECRET_BASENAME_PATTERNS = [
252
+ /^\.env(\..+)?$/,
253
+ // .env, .env.local, .env.production
254
+ /\.(pem|key|pfx|p12|keystore|jks)$/i,
255
+ /^id_(rsa|dsa|ecdsa|ed25519)$/
256
+ // private SSH keys (not the .pub)
257
+ ];
258
+ function looksLikeSecret(hostPath) {
259
+ const segs = normalize(hostPath).split(sep).filter(Boolean);
260
+ for (const seg of segs) {
261
+ if (SECRET_DIR_SEGMENTS.has(seg)) return true;
262
+ }
263
+ for (let i = 0; i + 1 < segs.length; i++) {
264
+ if (segs[i] === ".config" && segs[i + 1] === "gh") return true;
265
+ }
266
+ const base = basename(hostPath);
267
+ if (SECRET_BASENAMES.has(base)) return true;
268
+ return SECRET_BASENAME_PATTERNS.some((re) => re.test(base));
269
+ }
270
+ var SCRATCH_BRANCH_PREFIX = "agentbox/";
271
+ function isScratchBranch(branch) {
272
+ return !!branch && branch.startsWith(SCRATCH_BRANCH_PREFIX);
273
+ }
274
+ function isSanctionedPushBranch(branch, sanctionedBranch) {
275
+ if (isScratchBranch(branch)) return true;
276
+ return isResolvedBranch(branch ?? "") && !!sanctionedBranch && branch === sanctionedBranch;
277
+ }
278
+ function resolveRemote(remote) {
279
+ return remote ?? "origin";
280
+ }
281
+ function resolveLandDest(src, as) {
282
+ return as && as.length > 0 ? as : src;
283
+ }
284
+ function landRefspec(src, dest, force) {
285
+ return `${force ? "+" : ""}${src}:refs/heads/${dest}`;
286
+ }
287
+ function upstreamRef(remote, branch) {
288
+ return `${remote}/${branch}`;
289
+ }
290
+ function remoteTrackingRef(remote, branch) {
291
+ return `refs/remotes/${remote}/${branch}`;
292
+ }
293
+ function isResolvedBranch(s) {
294
+ return s.length > 0 && s !== "HEAD";
295
+ }
296
+ function sanitizeGitArgs(args) {
297
+ return Array.isArray(args) ? args.filter((a) => typeof a === "string") : [];
298
+ }
299
+
300
+ // ../../packages/sandbox-core/dist/index.js
301
+ import { mkdir, open, readFile, rename, rm, stat, writeFile } from "fs/promises";
302
+ import { homedir as homedir2 } from "os";
303
+ import { dirname as dirname2, join as join2 } from "path";
304
+ import { setTimeout as delay } from "timers/promises";
305
+ import { readdir, stat as stat2 } from "fs/promises";
306
+ import { join as join22 } from "path";
307
+ import { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "fs";
308
+ import { homedir as homedir22 } from "os";
309
+ import { dirname as dirname22, resolve as resolve3 } from "path";
310
+ import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
311
+ import { homedir as homedir3 } from "os";
312
+ import { dirname as dirname3, join as join3 } from "path";
313
+ import { mkdtemp, readFile as readFile3, writeFile as writeFile3 } from "fs/promises";
314
+ import { tmpdir } from "os";
315
+ import { basename as basename2, join as join4 } from "path";
316
+ import { join as join5 } from "path";
317
+ import { homedir as homedir4 } from "os";
318
+ import { mkdtemp as mkdtemp2, rm as rm3 } from "fs/promises";
319
+ import { tmpdir as tmpdir2 } from "os";
320
+ import { join as join6 } from "path";
321
+ import { readdir as readdir2, stat as stat4 } from "fs/promises";
322
+ import { homedir as homedir5 } from "os";
323
+ import { join as join7 } from "path";
324
+ import { readdir as readdir3, realpath as realpath2, stat as stat5 } from "fs/promises";
325
+ import { isAbsolute as isAbsolute3, join as join8, relative } from "path";
326
+ import { stat as stat6 } from "fs/promises";
327
+ import { chmod, mkdir as mkdir3, readFile as readFile4, writeFile as writeFile4 } from "fs/promises";
328
+ import { dirname as dirname4 } from "path";
329
+ import { createHash } from "crypto";
330
+ import { readFile as readFile5 } from "fs/promises";
331
+ import { join as join9 } from "path";
332
+ import { createHash as createHash2 } from "crypto";
333
+ import { copyFile, mkdir as mkdir4, mkdtemp as mkdtemp3, readdir as readdir4, readFile as readFile6, rm as rm4, stat as stat7 } from "fs/promises";
334
+ import { homedir as homedir6, tmpdir as tmpdir3 } from "os";
335
+ import { basename as basename22, dirname as dirname5, join as join10 } from "path";
336
+ import { copyFile as copyFile2, mkdtemp as mkdtemp4, readdir as readdir5, readFile as readFile7, rm as rm5, stat as stat8, writeFile as writeFile5 } from "fs/promises";
337
+ import { homedir as homedir8, tmpdir as tmpdir4 } from "os";
338
+ import { basename as basename3, join as join11, relative as relative2 } from "path";
339
+ import { homedir as homedir7 } from "os";
340
+
341
+ // ../../node_modules/.pnpm/smol-toml@1.7.0/node_modules/smol-toml/dist/date.js
342
+ var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
343
+ var TomlDate = class _TomlDate extends Date {
344
+ #hasDate = false;
345
+ #hasTime = false;
346
+ #offset = null;
347
+ constructor(date) {
348
+ let hasDate = true;
349
+ let hasTime = true;
350
+ let offset = "Z";
351
+ if (typeof date === "string") {
352
+ let match = date.match(DATE_TIME_RE);
353
+ if (match) {
354
+ if (!match[1]) {
355
+ hasDate = false;
356
+ date = `0000-01-01T${date}`;
357
+ }
358
+ hasTime = !!match[2];
359
+ hasTime && date[10] === " " && (date = date.replace(" ", "T"));
360
+ if (match[2] && +match[2] > 23) {
361
+ date = "";
362
+ } else {
363
+ offset = match[3] || null;
364
+ date = date.toUpperCase();
365
+ if (!offset && hasTime)
366
+ date += "Z";
367
+ }
368
+ } else {
369
+ date = "";
370
+ }
371
+ }
372
+ super(date);
373
+ if (!isNaN(this.getTime())) {
374
+ this.#hasDate = hasDate;
375
+ this.#hasTime = hasTime;
376
+ this.#offset = offset;
377
+ }
378
+ }
379
+ isDateTime() {
380
+ return this.#hasDate && this.#hasTime;
381
+ }
382
+ isLocal() {
383
+ return !this.#hasDate || !this.#hasTime || !this.#offset;
384
+ }
385
+ isDate() {
386
+ return this.#hasDate && !this.#hasTime;
387
+ }
388
+ isTime() {
389
+ return this.#hasTime && !this.#hasDate;
390
+ }
391
+ isValid() {
392
+ return this.#hasDate || this.#hasTime;
393
+ }
394
+ toISOString() {
395
+ let iso = super.toISOString();
396
+ if (this.isDate())
397
+ return iso.slice(0, 10);
398
+ if (this.isTime())
399
+ return iso.slice(11, 23);
400
+ if (this.#offset === null)
401
+ return iso.slice(0, -1);
402
+ if (this.#offset === "Z")
403
+ return iso;
404
+ let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
405
+ offset = this.#offset[0] === "-" ? offset : -offset;
406
+ let offsetDate = new Date(this.getTime() - offset * 6e4);
407
+ return offsetDate.toISOString().slice(0, -1) + this.#offset;
408
+ }
409
+ static wrapAsOffsetDateTime(jsDate, offset = "Z") {
410
+ let date = new _TomlDate(jsDate);
411
+ date.#offset = offset;
412
+ return date;
413
+ }
414
+ static wrapAsLocalDateTime(jsDate) {
415
+ let date = new _TomlDate(jsDate);
416
+ date.#offset = null;
417
+ return date;
418
+ }
419
+ static wrapAsLocalDate(jsDate) {
420
+ let date = new _TomlDate(jsDate);
421
+ date.#hasTime = false;
422
+ date.#offset = null;
423
+ return date;
424
+ }
425
+ static wrapAsLocalTime(jsDate) {
426
+ let date = new _TomlDate(jsDate);
427
+ date.#hasDate = false;
428
+ date.#offset = null;
429
+ return date;
430
+ }
431
+ };
432
+
433
+ // ../../node_modules/.pnpm/smol-toml@1.7.0/node_modules/smol-toml/dist/error.js
434
+ function getLineColFromPtr(string, ptr) {
435
+ let lines = string.slice(0, ptr).split(/\r\n|\n|\r/g);
436
+ return [lines.length, lines.pop().length + 1];
437
+ }
438
+ function makeCodeBlock(string, line, column) {
439
+ let lines = string.split(/\r\n|\n|\r/g);
440
+ let codeblock = "";
441
+ let numberLen = (Math.log10(line + 1) | 0) + 1;
442
+ for (let i = line - 1; i <= line + 1; i++) {
443
+ let l = lines[i - 1];
444
+ if (!l)
445
+ continue;
446
+ codeblock += i.toString().padEnd(numberLen, " ");
447
+ codeblock += ": ";
448
+ codeblock += l;
449
+ codeblock += "\n";
450
+ if (i === line) {
451
+ codeblock += " ".repeat(numberLen + column + 2);
452
+ codeblock += "^\n";
453
+ }
454
+ }
455
+ return codeblock;
456
+ }
457
+ var TomlError = class extends Error {
458
+ line;
459
+ column;
460
+ codeblock;
461
+ constructor(message, options) {
462
+ const [line, column] = getLineColFromPtr(options.toml, options.ptr);
463
+ const codeblock = makeCodeBlock(options.toml, line, column);
464
+ super(`Invalid TOML document: ${message}
465
+
466
+ ${codeblock}`, options);
467
+ this.line = line;
468
+ this.column = column;
469
+ this.codeblock = codeblock;
470
+ }
471
+ };
472
+
473
+ // ../../node_modules/.pnpm/smol-toml@1.7.0/node_modules/smol-toml/dist/primitive.js
474
+ var INT_REGEX = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
475
+ var FLOAT_REGEX = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
476
+ var LEADING_ZERO = /^[+-]?0[0-9_]/;
477
+ function parseString(str, ptr) {
478
+ let c = str[ptr++];
479
+ let first = c;
480
+ let isLiteral = c === "'";
481
+ let isMultiline = c === str[ptr] && c === str[ptr + 1];
482
+ if (isMultiline) {
483
+ if (str[ptr += 2] === "\n")
484
+ ptr++;
485
+ else if (str[ptr] === "\r" && str[ptr + 1] === "\n")
486
+ ptr += 2;
487
+ }
488
+ let parsed = "";
489
+ let sliceStart = ptr;
490
+ let state = 0;
491
+ for (let i = ptr; i < str.length; i++) {
492
+ c = str[i];
493
+ if (isMultiline && (c === "\n" || c === "\r" && str[i + 1] === "\n")) {
494
+ state = state && 3;
495
+ } else if (c < " " && c !== " " || c === "\x7F") {
496
+ throw new TomlError("control characters are not allowed in strings", {
497
+ toml: str,
498
+ ptr: i
499
+ });
500
+ } else if ((!state || state === 3) && c === first && (!isMultiline || str[i + 1] === first && str[i + 2] === first)) {
501
+ if (isMultiline) {
502
+ if (str[i + 3] === first)
503
+ i++;
504
+ if (str[i + 3] === first)
505
+ i++;
506
+ }
507
+ return [
508
+ // If we're in a newline escape still, then there's nothing to add.
509
+ // Also try to avoid concat if there's nothing to add to parsed, or nothing has been added to parsed.
510
+ state ? parsed : parsed + str.slice(sliceStart, i),
511
+ i + (isMultiline ? 3 : 1)
512
+ ];
513
+ } else if (!state) {
514
+ if (!isLiteral && c === "\\") {
515
+ parsed += str.slice(sliceStart, sliceStart = i);
516
+ state = 1;
517
+ }
518
+ } else if (state === 1) {
519
+ if (c === "x" || c === "u" || c === "U") {
520
+ let value = 0;
521
+ let len = c === "x" ? 2 : c === "u" ? 4 : 8;
522
+ for (let j = 0; j < len; j++, i++) {
523
+ let hex = str.charCodeAt(i + 1);
524
+ let digit = (
525
+ /* 0-9 */
526
+ hex >= 48 && hex <= 57 ? hex - 48 : (
527
+ /* A-F */
528
+ hex >= 65 && hex <= 70 ? hex - 65 + 10 : (
529
+ /* a-f */
530
+ hex >= 97 && hex <= 102 ? hex - 97 + 10 : -1
531
+ )
532
+ )
533
+ );
534
+ if (digit < 0)
535
+ throw new TomlError("invalid non-hex character in unicode escape", { toml: str, ptr: i + 1 });
536
+ value = value << 4 | digit;
537
+ }
538
+ if (value < 0 || value > 1114111 || value >= 55296 && value <= 57343) {
539
+ throw new TomlError("invalid unicode escape", { toml: str, ptr: i });
540
+ }
541
+ parsed += String.fromCodePoint(value);
542
+ sliceStart = i + 1;
543
+ state = 0;
544
+ } else if (c === " " || c === " ") {
545
+ state = 2;
546
+ } else {
547
+ if (c === "b")
548
+ parsed += "\b";
549
+ else if (c === "t")
550
+ parsed += " ";
551
+ else if (c === "n")
552
+ parsed += "\n";
553
+ else if (c === "f")
554
+ parsed += "\f";
555
+ else if (c === "r")
556
+ parsed += "\r";
557
+ else if (c === "e")
558
+ parsed += "\x1B";
559
+ else if (c === '"')
560
+ parsed += '"';
561
+ else if (c === "\\")
562
+ parsed += "\\";
563
+ else
564
+ throw new TomlError("unrecognized escape sequence", { toml: str, ptr: i });
565
+ sliceStart = i + 1;
566
+ state = 0;
567
+ }
568
+ } else if (c !== " " && c !== " ") {
569
+ if (state === 2) {
570
+ throw new TomlError("invalid escape: only line-ending whitespace may be escaped", {
571
+ toml: str,
572
+ ptr: sliceStart
573
+ });
574
+ }
575
+ state = !isLiteral && c === "\\" ? 1 : 0;
576
+ sliceStart = i;
577
+ }
578
+ }
579
+ throw new TomlError("unfinished string", { toml: str, ptr });
580
+ }
581
+ function parseValue(value, toml, ptr, integersAsBigInt) {
582
+ if (value === "true")
583
+ return true;
584
+ if (value === "false")
585
+ return false;
586
+ if (value === "-inf")
587
+ return -Infinity;
588
+ if (value === "inf" || value === "+inf")
589
+ return Infinity;
590
+ if (value === "nan" || value === "+nan" || value === "-nan")
591
+ return NaN;
592
+ if (value === "-0")
593
+ return integersAsBigInt ? 0n : 0;
594
+ let isInt = INT_REGEX.test(value);
595
+ if (isInt || FLOAT_REGEX.test(value)) {
596
+ if (LEADING_ZERO.test(value)) {
597
+ throw new TomlError("leading zeroes are not allowed", {
598
+ toml,
599
+ ptr
600
+ });
601
+ }
602
+ value = value.replace(/_/g, "");
603
+ let numeric = +value;
604
+ if (isNaN(numeric)) {
605
+ throw new TomlError("invalid number", {
606
+ toml,
607
+ ptr
608
+ });
609
+ }
610
+ if (isInt) {
611
+ if ((isInt = !Number.isSafeInteger(numeric)) && !integersAsBigInt) {
612
+ throw new TomlError("integer value cannot be represented losslessly", {
613
+ toml,
614
+ ptr
615
+ });
616
+ }
617
+ if (isInt || integersAsBigInt === true)
618
+ numeric = BigInt(value);
619
+ }
620
+ return numeric;
621
+ }
622
+ const date = new TomlDate(value);
623
+ if (!date.isValid()) {
624
+ throw new TomlError("invalid value", {
625
+ toml,
626
+ ptr
627
+ });
628
+ }
629
+ return date;
630
+ }
631
+
632
+ // ../../node_modules/.pnpm/smol-toml@1.7.0/node_modules/smol-toml/dist/util.js
633
+ function indexOfNewline(str, start = 0, end = str.length) {
634
+ let idx = str.indexOf("\n", start);
635
+ if (str[idx - 1] === "\r")
636
+ idx--;
637
+ return idx <= end ? idx : -1;
638
+ }
639
+ function skipComment(str, ptr) {
640
+ for (let i = ptr; i < str.length; i++) {
641
+ let c = str[i];
642
+ if (c === "\n")
643
+ return i;
644
+ if (c === "\r" && str[i + 1] === "\n")
645
+ return i + 1;
646
+ if (c < " " && c !== " " || c === "\x7F") {
647
+ throw new TomlError("control characters are not allowed in comments", {
648
+ toml: str,
649
+ ptr
650
+ });
651
+ }
652
+ }
653
+ return str.length;
654
+ }
655
+ function skipVoid(str, ptr, banNewLines, banComments) {
656
+ let c;
657
+ while (1) {
658
+ while ((c = str[ptr]) === " " || c === " " || !banNewLines && (c === "\n" || c === "\r" && str[ptr + 1] === "\n"))
659
+ ptr++;
660
+ if (banComments || c !== "#")
661
+ break;
662
+ ptr = skipComment(str, ptr);
663
+ }
664
+ return ptr;
665
+ }
666
+ function skipUntil(str, ptr, sep2, end, banNewLines = false) {
667
+ if (!end) {
668
+ ptr = indexOfNewline(str, ptr);
669
+ return ptr < 0 ? str.length : ptr;
670
+ }
671
+ for (let i = ptr; i < str.length; i++) {
672
+ let c = str[i];
673
+ if (c === "#") {
674
+ i = indexOfNewline(str, i);
675
+ } else if (c === sep2) {
676
+ return i + 1;
677
+ } else if (c === end || banNewLines && (c === "\n" || c === "\r" && str[i + 1] === "\n")) {
678
+ return i;
679
+ }
680
+ }
681
+ throw new TomlError("cannot find end of structure", {
682
+ toml: str,
683
+ ptr
684
+ });
685
+ }
686
+
687
+ // ../../node_modules/.pnpm/smol-toml@1.7.0/node_modules/smol-toml/dist/extract.js
688
+ function sliceAndTrimEndOf(str, startPtr, endPtr) {
689
+ let value = str.slice(startPtr, endPtr);
690
+ let commentIdx = value.indexOf("#");
691
+ if (commentIdx > -1) {
692
+ skipComment(str, commentIdx);
693
+ value = value.slice(0, commentIdx);
694
+ }
695
+ return [value.trimEnd(), commentIdx];
696
+ }
697
+ function extractValue(str, ptr, end, depth, integersAsBigInt) {
698
+ if (depth === 0) {
699
+ throw new TomlError("document contains excessively nested structures. aborting.", {
700
+ toml: str,
701
+ ptr
702
+ });
703
+ }
704
+ let c = str[ptr];
705
+ if (c === "[" || c === "{") {
706
+ let [value, endPtr2] = c === "[" ? parseArray(str, ptr, depth, integersAsBigInt) : parseInlineTable(str, ptr, depth, integersAsBigInt);
707
+ if (end) {
708
+ endPtr2 = skipVoid(str, endPtr2);
709
+ if (str[endPtr2] === ",")
710
+ endPtr2++;
711
+ else if (str[endPtr2] !== end) {
712
+ throw new TomlError("expected comma or end of structure", {
713
+ toml: str,
714
+ ptr: endPtr2
715
+ });
716
+ }
717
+ }
718
+ return [value, endPtr2];
719
+ }
720
+ if (c === '"' || c === "'") {
721
+ let [parsed, endPtr2] = parseString(str, ptr);
722
+ if (end) {
723
+ endPtr2 = skipVoid(str, endPtr2);
724
+ if (str[endPtr2] && str[endPtr2] !== "," && str[endPtr2] !== end && str[endPtr2] !== "\n" && str[endPtr2] !== "\r") {
725
+ throw new TomlError("unexpected character encountered", {
726
+ toml: str,
727
+ ptr: endPtr2
728
+ });
729
+ }
730
+ if (str[endPtr2] === ",")
731
+ endPtr2++;
732
+ }
733
+ return [parsed, endPtr2];
734
+ }
735
+ let endPtr = skipUntil(str, ptr, ",", end);
736
+ let slice = sliceAndTrimEndOf(str, ptr, endPtr - (str[endPtr - 1] === "," ? 1 : 0));
737
+ if (!slice[0]) {
738
+ throw new TomlError("incomplete key-value declaration: no value specified", {
739
+ toml: str,
740
+ ptr
741
+ });
742
+ }
743
+ if (end && slice[1] > -1) {
744
+ endPtr = skipVoid(str, ptr + slice[1]);
745
+ if (str[endPtr] === ",")
746
+ endPtr++;
747
+ }
748
+ return [
749
+ parseValue(slice[0], str, ptr, integersAsBigInt),
750
+ endPtr
751
+ ];
752
+ }
753
+
754
+ // ../../node_modules/.pnpm/smol-toml@1.7.0/node_modules/smol-toml/dist/struct.js
755
+ var KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
756
+ function parseKey(str, ptr, end = "=") {
757
+ let dot = ptr - 1;
758
+ let parsed = [];
759
+ let endPtr = str.indexOf(end, ptr);
760
+ if (endPtr < 0) {
761
+ throw new TomlError("incomplete key-value: cannot find end of key", {
762
+ toml: str,
763
+ ptr
764
+ });
765
+ }
766
+ do {
767
+ let c = str[ptr = ++dot];
768
+ if (c !== " " && c !== " ") {
769
+ if (c === '"' || c === "'") {
770
+ if (c === str[ptr + 1] && c === str[ptr + 2]) {
771
+ throw new TomlError("multiline strings are not allowed in keys", {
772
+ toml: str,
773
+ ptr
774
+ });
775
+ }
776
+ let [part, eos] = parseString(str, ptr);
777
+ dot = str.indexOf(".", eos);
778
+ let strEnd = str.slice(eos, dot < 0 || dot > endPtr ? endPtr : dot);
779
+ let newLine = indexOfNewline(strEnd);
780
+ if (newLine > -1) {
781
+ throw new TomlError("newlines are not allowed in keys", {
782
+ toml: str,
783
+ ptr: ptr + dot + newLine
784
+ });
785
+ }
786
+ if (strEnd.trimStart()) {
787
+ throw new TomlError("found extra tokens after the string part", {
788
+ toml: str,
789
+ ptr: eos
790
+ });
791
+ }
792
+ if (endPtr < eos) {
793
+ endPtr = str.indexOf(end, eos);
794
+ if (endPtr < 0) {
795
+ throw new TomlError("incomplete key-value: cannot find end of key", {
796
+ toml: str,
797
+ ptr
798
+ });
799
+ }
800
+ }
801
+ parsed.push(part);
802
+ } else {
803
+ dot = str.indexOf(".", ptr);
804
+ let part = str.slice(ptr, dot < 0 || dot > endPtr ? endPtr : dot);
805
+ if (!KEY_PART_RE.test(part)) {
806
+ throw new TomlError("only letter, numbers, dashes and underscores are allowed in keys", {
807
+ toml: str,
808
+ ptr
809
+ });
810
+ }
811
+ parsed.push(part.trimEnd());
812
+ }
813
+ }
814
+ } while (dot + 1 && dot < endPtr);
815
+ return [parsed, skipVoid(str, endPtr + 1, true, true)];
816
+ }
817
+ function parseInlineTable(str, ptr, depth, integersAsBigInt) {
818
+ let res = {};
819
+ let seen = /* @__PURE__ */ new Set();
820
+ let c;
821
+ ptr++;
822
+ while ((c = str[ptr++]) !== "}" && c) {
823
+ if (c === ",") {
824
+ throw new TomlError("expected value, found comma", {
825
+ toml: str,
826
+ ptr: ptr - 1
827
+ });
828
+ } else if (c === "#")
829
+ ptr = skipComment(str, ptr);
830
+ else if (c !== " " && c !== " " && c !== "\n" && c !== "\r") {
831
+ let k;
832
+ let t = res;
833
+ let hasOwn = false;
834
+ let [key, keyEndPtr] = parseKey(str, ptr - 1);
835
+ for (let i = 0; i < key.length; i++) {
836
+ if (i)
837
+ t = hasOwn ? t[k] : t[k] = {};
838
+ k = key[i];
839
+ if ((hasOwn = Object.hasOwn(t, k)) && (typeof t[k] !== "object" || seen.has(t[k]))) {
840
+ throw new TomlError("trying to redefine an already defined value", {
841
+ toml: str,
842
+ ptr
843
+ });
844
+ }
845
+ if (!hasOwn && k === "__proto__") {
846
+ Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
847
+ }
848
+ }
849
+ if (hasOwn) {
850
+ throw new TomlError("trying to redefine an already defined value", {
851
+ toml: str,
852
+ ptr
853
+ });
854
+ }
855
+ let [value, valueEndPtr] = extractValue(str, keyEndPtr, "}", depth - 1, integersAsBigInt);
856
+ seen.add(value);
857
+ t[k] = value;
858
+ ptr = valueEndPtr;
859
+ }
860
+ }
861
+ if (!c) {
862
+ throw new TomlError("unfinished table encountered", {
863
+ toml: str,
864
+ ptr
865
+ });
866
+ }
867
+ return [res, ptr];
868
+ }
869
+ function parseArray(str, ptr, depth, integersAsBigInt) {
870
+ let res = [];
871
+ let c;
872
+ ptr++;
873
+ while ((c = str[ptr++]) !== "]" && c) {
874
+ if (c === ",") {
875
+ throw new TomlError("expected value, found comma", {
876
+ toml: str,
877
+ ptr: ptr - 1
878
+ });
879
+ } else if (c === "#")
880
+ ptr = skipComment(str, ptr);
881
+ else if (c !== " " && c !== " " && c !== "\n" && c !== "\r") {
882
+ let e = extractValue(str, ptr - 1, "]", depth - 1, integersAsBigInt);
883
+ res.push(e[0]);
884
+ ptr = e[1];
885
+ }
886
+ }
887
+ if (!c) {
888
+ throw new TomlError("unfinished array encountered", {
889
+ toml: str,
890
+ ptr
891
+ });
892
+ }
893
+ return [res, ptr];
894
+ }
895
+
896
+ // ../../node_modules/.pnpm/smol-toml@1.7.0/node_modules/smol-toml/dist/parse.js
897
+ function peekTable(key, table, meta, type) {
898
+ let t = table;
899
+ let m = meta;
900
+ let k;
901
+ let hasOwn = false;
902
+ let state;
903
+ for (let i = 0; i < key.length; i++) {
904
+ if (i) {
905
+ t = hasOwn ? t[k] : t[k] = {};
906
+ m = (state = m[k]).c;
907
+ if (type === 0 && (state.t === 1 || state.t === 2)) {
908
+ return null;
909
+ }
910
+ if (state.t === 2) {
911
+ let l = t.length - 1;
912
+ t = t[l];
913
+ m = m[l].c;
914
+ }
915
+ }
916
+ k = key[i];
917
+ if ((hasOwn = Object.hasOwn(t, k)) && m[k]?.t === 0 && m[k]?.d) {
918
+ return null;
919
+ }
920
+ if (!hasOwn) {
921
+ if (k === "__proto__") {
922
+ Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
923
+ Object.defineProperty(m, k, { enumerable: true, configurable: true, writable: true });
924
+ }
925
+ m[k] = {
926
+ t: i < key.length - 1 && type === 2 ? 3 : type,
927
+ d: false,
928
+ i: 0,
929
+ c: {}
930
+ };
931
+ }
932
+ }
933
+ state = m[k];
934
+ if (state.t !== type && !(type === 1 && state.t === 3)) {
935
+ return null;
936
+ }
937
+ if (type === 2) {
938
+ if (!state.d) {
939
+ state.d = true;
940
+ t[k] = [];
941
+ }
942
+ t[k].push(t = {});
943
+ state.c[state.i++] = state = { t: 1, d: false, i: 0, c: {} };
944
+ }
945
+ if (state.d) {
946
+ return null;
947
+ }
948
+ state.d = true;
949
+ if (type === 1) {
950
+ t = hasOwn ? t[k] : t[k] = {};
951
+ } else if (type === 0 && hasOwn) {
952
+ return null;
953
+ }
954
+ return [k, t, state.c];
955
+ }
956
+ function parse(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
957
+ let res = {};
958
+ let meta = {};
959
+ let tbl = res;
960
+ let m = meta;
961
+ for (let ptr = skipVoid(toml, 0); ptr < toml.length; ) {
962
+ if (toml[ptr] === "[") {
963
+ let isTableArray = toml[++ptr] === "[";
964
+ let k = parseKey(toml, ptr += +isTableArray, "]");
965
+ if (isTableArray) {
966
+ if (toml[k[1] - 1] !== "]") {
967
+ throw new TomlError("expected end of table declaration", {
968
+ toml,
969
+ ptr: k[1] - 1
970
+ });
971
+ }
972
+ k[1]++;
973
+ }
974
+ let p = peekTable(
975
+ k[0],
976
+ res,
977
+ meta,
978
+ isTableArray ? 2 : 1
979
+ /* Type.EXPLICIT */
980
+ );
981
+ if (!p) {
982
+ throw new TomlError("trying to redefine an already defined table or value", {
983
+ toml,
984
+ ptr
985
+ });
986
+ }
987
+ m = p[2];
988
+ tbl = p[1];
989
+ ptr = k[1];
990
+ } else {
991
+ let k = parseKey(toml, ptr);
992
+ let p = peekTable(
993
+ k[0],
994
+ tbl,
995
+ m,
996
+ 0
997
+ /* Type.DOTTED */
998
+ );
999
+ if (!p) {
1000
+ throw new TomlError("trying to redefine an already defined table or value", {
1001
+ toml,
1002
+ ptr
1003
+ });
1004
+ }
1005
+ let v = extractValue(toml, k[1], void 0, maxDepth, integersAsBigInt);
1006
+ p[1][p[0]] = v[0];
1007
+ ptr = v[1];
1008
+ }
1009
+ ptr = skipVoid(toml, ptr, true);
1010
+ if (toml[ptr] && toml[ptr] !== "\n" && toml[ptr] !== "\r") {
1011
+ throw new TomlError("each key-value declaration must be followed by an end-of-line", {
1012
+ toml,
1013
+ ptr
1014
+ });
1015
+ }
1016
+ ptr = skipVoid(toml, ptr);
1017
+ }
1018
+ return res;
1019
+ }
1020
+
1021
+ // ../../node_modules/.pnpm/smol-toml@1.7.0/node_modules/smol-toml/dist/stringify.js
1022
+ var BARE_KEY = /^[a-z0-9-_]+$/i;
1023
+ function extendedTypeOf(obj) {
1024
+ let type = typeof obj;
1025
+ if (type === "object") {
1026
+ if (Array.isArray(obj))
1027
+ return "array";
1028
+ if (obj instanceof Date)
1029
+ return "date";
1030
+ }
1031
+ return type;
1032
+ }
1033
+ function isArrayOfTables(obj) {
1034
+ for (let i = 0; i < obj.length; i++) {
1035
+ if (extendedTypeOf(obj[i]) !== "object")
1036
+ return false;
1037
+ }
1038
+ return obj.length != 0;
1039
+ }
1040
+ function formatString(s) {
1041
+ return JSON.stringify(s).replace(/\x7f/g, "\\u007f");
1042
+ }
1043
+ function stringifyValue(val, type, depth, numberAsFloat) {
1044
+ if (depth === 0) {
1045
+ throw new Error("Could not stringify the object: maximum object depth exceeded");
1046
+ }
1047
+ if (type === "number") {
1048
+ if (isNaN(val))
1049
+ return "nan";
1050
+ if (val === Infinity)
1051
+ return "inf";
1052
+ if (val === -Infinity)
1053
+ return "-inf";
1054
+ if (Number.isInteger(val) && (numberAsFloat || !Number.isSafeInteger(val)))
1055
+ return val.toFixed(1);
1056
+ return val.toString();
1057
+ }
1058
+ if (type === "bigint" || type === "boolean") {
1059
+ return val.toString();
1060
+ }
1061
+ if (type === "string") {
1062
+ return formatString(val);
1063
+ }
1064
+ if (type === "date") {
1065
+ if (isNaN(val.getTime())) {
1066
+ throw new TypeError("cannot serialize invalid date");
1067
+ }
1068
+ return val.toISOString();
1069
+ }
1070
+ if (type === "object") {
1071
+ return stringifyInlineTable(val, depth, numberAsFloat);
1072
+ }
1073
+ if (type === "array") {
1074
+ return stringifyArray(val, depth, numberAsFloat);
1075
+ }
1076
+ }
1077
+ function stringifyInlineTable(obj, depth, numberAsFloat) {
1078
+ let keys = Object.keys(obj);
1079
+ if (keys.length === 0)
1080
+ return "{}";
1081
+ let res = "{ ";
1082
+ for (let i = 0; i < keys.length; i++) {
1083
+ let k = keys[i];
1084
+ if (i)
1085
+ res += ", ";
1086
+ res += BARE_KEY.test(k) ? k : formatString(k);
1087
+ res += " = ";
1088
+ res += stringifyValue(obj[k], extendedTypeOf(obj[k]), depth - 1, numberAsFloat);
1089
+ }
1090
+ return res + " }";
1091
+ }
1092
+ function stringifyArray(array, depth, numberAsFloat) {
1093
+ if (array.length === 0)
1094
+ return "[]";
1095
+ let res = "[ ";
1096
+ for (let i = 0; i < array.length; i++) {
1097
+ if (i)
1098
+ res += ", ";
1099
+ if (array[i] === null || array[i] === void 0) {
1100
+ throw new TypeError("arrays cannot contain null or undefined values");
1101
+ }
1102
+ res += stringifyValue(array[i], extendedTypeOf(array[i]), depth - 1, numberAsFloat);
1103
+ }
1104
+ return res + " ]";
1105
+ }
1106
+ function stringifyArrayTable(array, key, depth, numberAsFloat) {
1107
+ if (depth === 0) {
1108
+ throw new Error("Could not stringify the object: maximum object depth exceeded");
1109
+ }
1110
+ let res = "";
1111
+ for (let i = 0; i < array.length; i++) {
1112
+ res += `${res && "\n"}[[${key}]]
1113
+ `;
1114
+ res += stringifyTable(0, array[i], key, depth, numberAsFloat);
1115
+ }
1116
+ return res;
1117
+ }
1118
+ function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat) {
1119
+ if (depth === 0) {
1120
+ throw new Error("Could not stringify the object: maximum object depth exceeded");
1121
+ }
1122
+ let preamble = "";
1123
+ let tables = "";
1124
+ let keys = Object.keys(obj);
1125
+ for (let i = 0; i < keys.length; i++) {
1126
+ let k = keys[i];
1127
+ if (obj[k] !== null && obj[k] !== void 0) {
1128
+ let type = extendedTypeOf(obj[k]);
1129
+ if (type === "symbol" || type === "function") {
1130
+ throw new TypeError(`cannot serialize values of type '${type}'`);
1131
+ }
1132
+ let key = BARE_KEY.test(k) ? k : formatString(k);
1133
+ if (type === "array" && isArrayOfTables(obj[k])) {
1134
+ tables += (tables && "\n") + stringifyArrayTable(obj[k], prefix ? `${prefix}.${key}` : key, depth - 1, numberAsFloat);
1135
+ } else if (type === "object") {
1136
+ let tblKey = prefix ? `${prefix}.${key}` : key;
1137
+ tables += (tables && "\n") + stringifyTable(tblKey, obj[k], tblKey, depth - 1, numberAsFloat);
1138
+ } else {
1139
+ preamble += key;
1140
+ preamble += " = ";
1141
+ preamble += stringifyValue(obj[k], type, depth, numberAsFloat);
1142
+ preamble += "\n";
1143
+ }
1144
+ }
1145
+ }
1146
+ if (tableKey && (preamble || !tables))
1147
+ preamble = preamble ? `[${tableKey}]
1148
+ ${preamble}` : `[${tableKey}]`;
1149
+ return preamble && tables ? `${preamble}
1150
+ ${tables}` : preamble || tables;
1151
+ }
1152
+ function stringify(obj, { maxDepth = 1e3, numbersAsFloat = false } = {}) {
1153
+ if (extendedTypeOf(obj) !== "object") {
1154
+ throw new TypeError("stringify can only be called with an object");
1155
+ }
1156
+ let str = stringifyTable(0, obj, "", maxDepth, numbersAsFloat);
1157
+ if (str[str.length - 1] !== "\n")
1158
+ return str + "\n";
1159
+ return str;
1160
+ }
1161
+
1162
+ // ../../packages/sandbox-core/dist/index.js
1163
+ import { createHash as createHash3 } from "crypto";
1164
+ import { existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync3, renameSync as renameSync2, writeFileSync as writeFileSync2 } from "fs";
1165
+ import { readFile as readFile8 } from "fs/promises";
1166
+ import { homedir as homedir9 } from "os";
1167
+ import { dirname as dirname6, resolve as pathResolve } from "path";
1168
+ var STATE_DIR = join2(homedir2(), ".agentbox");
1169
+ var STATE_FILE = join2(STATE_DIR, "state.json");
1170
+ var EMPTY = { version: 1, boxes: [] };
1171
+ var LOCK_STALE_MS = 15e3;
1172
+ var LOCK_ACQUIRE_TIMEOUT_MS = 2e4;
1173
+ var LOCK_RETRY_MS = 25;
1174
+ async function withStateLock(path, fn) {
1175
+ const lockPath = `${path}.lock`;
1176
+ await mkdir(dirname2(path), { recursive: true });
1177
+ const deadline = Date.now() + LOCK_ACQUIRE_TIMEOUT_MS;
1178
+ let held = false;
1179
+ while (!held) {
1180
+ try {
1181
+ const fh = await open(lockPath, "wx");
1182
+ await fh.writeFile(`${String(process.pid)}
1183
+ `);
1184
+ await fh.close();
1185
+ held = true;
1186
+ } catch (err) {
1187
+ if (err.code !== "EEXIST") throw err;
1188
+ try {
1189
+ const st = await stat(lockPath);
1190
+ if (Date.now() - st.mtimeMs > LOCK_STALE_MS) {
1191
+ await rm(lockPath, { force: true });
1192
+ continue;
1193
+ }
1194
+ } catch {
1195
+ continue;
1196
+ }
1197
+ if (Date.now() >= deadline) break;
1198
+ await delay(LOCK_RETRY_MS);
1199
+ }
1200
+ }
1201
+ try {
1202
+ return await fn();
1203
+ } finally {
1204
+ if (held) await rm(lockPath, { force: true }).catch(() => {
1205
+ });
1206
+ }
1207
+ }
1208
+ async function mutateState(mutator, path = STATE_FILE) {
1209
+ await withStateLock(path, async () => {
1210
+ const state = await readState(path);
1211
+ await writeState(mutator(state), path);
1212
+ });
1213
+ }
1214
+ async function readState(path = STATE_FILE) {
1215
+ try {
1216
+ const raw = await readFile(path, "utf8");
1217
+ const parsed = JSON.parse(raw);
1218
+ if (parsed.version !== 1 || !Array.isArray(parsed.boxes)) {
1219
+ throw new Error(`unrecognized state file shape at ${path}`);
1220
+ }
1221
+ for (const b of parsed.boxes) {
1222
+ b.provider ??= "docker";
1223
+ if ((b.provider ?? "docker") === "docker" && !b.docker) {
1224
+ b.docker = projectDockerFields(b);
1225
+ }
1226
+ }
1227
+ return parsed;
1228
+ } catch (err) {
1229
+ if (err.code === "ENOENT") {
1230
+ return { ...EMPTY };
1231
+ }
1232
+ throw err;
1233
+ }
1234
+ }
1235
+ async function writeState(state, path = STATE_FILE) {
1236
+ await mkdir(dirname2(path), { recursive: true });
1237
+ const tmp = `${path}.tmp.${String(process.pid)}.${String(Date.now())}`;
1238
+ await writeFile(tmp, JSON.stringify(state, null, 2) + "\n", "utf8");
1239
+ await rename(tmp, path);
1240
+ }
1241
+ async function recordBox(box, path = STATE_FILE) {
1242
+ const toWrite = (box.provider ?? "docker") === "docker" && !box.docker ? { ...box, docker: projectDockerFields(box) } : box;
1243
+ await mutateState(
1244
+ (state) => ({
1245
+ version: 1,
1246
+ boxes: [...state.boxes.filter((b) => b.id !== toWrite.id), toWrite]
1247
+ }),
1248
+ path
1249
+ );
1250
+ }
1251
+ async function recordLastAgent(boxId, kind, path = STATE_FILE) {
1252
+ await mutateState(
1253
+ (state) => ({
1254
+ version: 1,
1255
+ boxes: state.boxes.map((b) => b.id === boxId ? { ...b, lastAgent: kind } : b)
1256
+ }),
1257
+ path
1258
+ );
1259
+ }
1260
+ async function reserveProjectIndex(record, projectRoot, path = STATE_FILE) {
1261
+ let index = 1;
1262
+ await mutateState((state) => {
1263
+ index = allocateProjectIndex(state, projectRoot);
1264
+ const reserved = { ...record, projectRoot, projectIndex: index };
1265
+ return {
1266
+ version: 1,
1267
+ boxes: [...state.boxes.filter((b) => b.id !== record.id), reserved]
1268
+ };
1269
+ }, path);
1270
+ return index;
1271
+ }
1272
+ function projectDockerFields(box) {
1273
+ return {
1274
+ container: box.container,
1275
+ image: box.image,
1276
+ snapshotDir: box.snapshotDir ?? null,
1277
+ socketPath: box.socketPath,
1278
+ claudeConfigVolume: box.claudeConfigVolume,
1279
+ codexConfigVolume: box.codexConfigVolume,
1280
+ opencodeConfigVolume: box.opencodeConfigVolume,
1281
+ vscodeServerVolume: box.vscodeServerVolume,
1282
+ cursorServerVolume: box.cursorServerVolume,
1283
+ vncHostPort: box.vncHostPort,
1284
+ webHostPort: box.webHostPort,
1285
+ portlessAlias: box.portlessAlias,
1286
+ portlessUrl: box.portlessUrl,
1287
+ portlessVncAlias: box.portlessVncAlias,
1288
+ portlessVncUrl: box.portlessVncUrl,
1289
+ dockerVolume: box.dockerVolume,
1290
+ dockerCacheShared: box.dockerCacheShared,
1291
+ checkpointImage: box.checkpointImage
1292
+ };
1293
+ }
1294
+ async function removeBoxRecord(id, path = STATE_FILE) {
1295
+ let removed = false;
1296
+ await mutateState((state) => {
1297
+ const next = state.boxes.filter((b) => b.id !== id);
1298
+ removed = next.length !== state.boxes.length;
1299
+ return { version: 1, boxes: next };
1300
+ }, path);
1301
+ return removed;
1302
+ }
1303
+ function findBox(idOrName, state) {
1304
+ const q = idOrName.trim();
1305
+ if (q.length === 0) return { kind: "none" };
1306
+ const exactId = state.boxes.find((b) => b.id === q);
1307
+ if (exactId) return { kind: "ok", box: exactId };
1308
+ const prefixMatches = state.boxes.filter((b) => b.id.startsWith(q));
1309
+ if (prefixMatches.length === 1) return { kind: "ok", box: prefixMatches[0] };
1310
+ if (prefixMatches.length > 1) return { kind: "ambiguous", matches: prefixMatches };
1311
+ const byName = state.boxes.find((b) => b.name === q);
1312
+ if (byName) return { kind: "ok", box: byName };
1313
+ const byContainer = state.boxes.find((b) => b.container === q);
1314
+ if (byContainer) return { kind: "ok", box: byContainer };
1315
+ return { kind: "none" };
1316
+ }
1317
+ function allocateProjectIndex(state, projectRoot) {
1318
+ let max = 0;
1319
+ for (const b of state.boxes) {
1320
+ if (b.projectRoot !== projectRoot) continue;
1321
+ if (typeof b.projectIndex === "number" && b.projectIndex > max) {
1322
+ max = b.projectIndex;
1323
+ }
1324
+ }
1325
+ return max + 1;
1326
+ }
1327
+ function autoPickProjectBox(state, projectRoot) {
1328
+ const matches = state.boxes.filter((b) => b.projectRoot === projectRoot);
1329
+ if (matches.length === 0) return { kind: "none" };
1330
+ if (matches.length === 1) return { kind: "ok", box: matches[0] };
1331
+ return { kind: "ambiguous", matches };
1332
+ }
1333
+ function resolveBoxRef(ref, state, projectRoot) {
1334
+ if (ref === void 0) {
1335
+ if (projectRoot === void 0) return { kind: "none" };
1336
+ return autoPickProjectBox(state, projectRoot);
1337
+ }
1338
+ const trimmed = ref.trim();
1339
+ if (projectRoot !== void 0 && /^[1-9][0-9]*$/.test(trimmed)) {
1340
+ const idx = Number.parseInt(trimmed, 10);
1341
+ const hit = state.boxes.find((b) => b.projectRoot === projectRoot && b.projectIndex === idx);
1342
+ return hit ? { kind: "ok", box: hit } : { kind: "none" };
1343
+ }
1344
+ return findBox(trimmed, state);
1345
+ }
1346
+ async function detectGitRepos(workspace) {
1347
+ const out = [];
1348
+ if (await isGitDir(join22(workspace, ".git"))) {
1349
+ out.push({ kind: "root", hostMainRepo: workspace, relPathFromWorkspace: "" });
1350
+ }
1351
+ let entries;
1352
+ try {
1353
+ entries = await readdir(workspace, { withFileTypes: true });
1354
+ } catch {
1355
+ return out;
1356
+ }
1357
+ for (const e of entries) {
1358
+ if (!e.isDirectory() || e.name.startsWith(".")) continue;
1359
+ const sub = join22(workspace, e.name);
1360
+ if (await isGitDir(join22(sub, ".git"))) {
1361
+ out.push({ kind: "nested", hostMainRepo: sub, relPathFromWorkspace: e.name });
1362
+ }
1363
+ }
1364
+ return out;
1365
+ }
1366
+ async function isGitDir(path) {
1367
+ try {
1368
+ const s = await stat2(path);
1369
+ return s.isDirectory();
1370
+ } catch {
1371
+ return false;
1372
+ }
1373
+ }
1374
+ async function pickFreshBranch(hostMainRepo, base) {
1375
+ let candidate = base;
1376
+ let suffix = 2;
1377
+ while (await branchExists(hostMainRepo, candidate)) {
1378
+ candidate = `${base}-${String(suffix++)}`;
1379
+ if (suffix > 100) throw new GitWorktreeError(`could not find a free branch name near ${base}`);
1380
+ }
1381
+ return candidate;
1382
+ }
1383
+ async function branchExists(hostMainRepo, name) {
1384
+ const result = await execa(
1385
+ "git",
1386
+ ["-C", hostMainRepo, "show-ref", "--verify", "--quiet", `refs/heads/${name}`],
1387
+ { reject: false }
1388
+ );
1389
+ return result.exitCode === 0;
1390
+ }
1391
+ var GitWorktreeError = class extends Error {
1392
+ constructor(message) {
1393
+ super(message);
1394
+ this.name = "GitWorktreeError";
1395
+ }
1396
+ };
1397
+ function hostOpenCommand() {
1398
+ return process.platform === "linux" ? "xdg-open" : "open";
1399
+ }
1400
+ var BOX_WORKSPACE = "/workspace";
1401
+ function run(provider, box, argv) {
1402
+ return provider.exec(box, argv, { cwd: BOX_WORKSPACE });
1403
+ }
1404
+ function scratchBranchName(name) {
1405
+ const trimmed = name.trim();
1406
+ return isScratchBranch(trimmed) ? trimmed : `${SCRATCH_BRANCH_PREFIX}${trimmed}`;
1407
+ }
1408
+ function boxGitCheckout(provider, box, branch, extraArgs = []) {
1409
+ return run(provider, box, ["git", "checkout", branch, ...extraArgs]);
1410
+ }
1411
+ function boxGitNewBranch(provider, box, name, from) {
1412
+ const argv = ["git", "checkout", "-b", scratchBranchName(name)];
1413
+ if (from && from.trim()) argv.push(from.trim());
1414
+ return run(provider, box, argv);
1415
+ }
1416
+ function gitRpcParams(remote, extraArgs) {
1417
+ const params = { path: BOX_WORKSPACE };
1418
+ if (remote) params.remote = remote;
1419
+ if (extraArgs.length > 0) params.args = extraArgs;
1420
+ return params;
1421
+ }
1422
+ async function boxGitPush(provider, box, opts, deps = {}) {
1423
+ const extraArgs = [...opts.args ?? [], ...opts.force ? ["--force"] : []];
1424
+ const params = gitRpcParams(opts.remote, extraArgs);
1425
+ const tokenArgs = deps.hostInitiatedArgs ? await deps.hostInitiatedArgs("git.push", params) : [];
1426
+ const argv = ["agentbox-ctl", "git", "push", ...tokenArgs];
1427
+ if (opts.remote) argv.push("--remote", opts.remote);
1428
+ argv.push(...extraArgs);
1429
+ return run(provider, box, argv);
1430
+ }
1431
+ async function boxGitPull(provider, box, opts, deps = {}) {
1432
+ const extraArgs = opts.args ?? [];
1433
+ const params = gitRpcParams(opts.remote, extraArgs);
1434
+ const tokenArgs = deps.hostInitiatedArgs ? await deps.hostInitiatedArgs("git.fetch", params) : [];
1435
+ const argv = ["agentbox-ctl", "git", "pull", ...tokenArgs];
1436
+ if (opts.remote) argv.push("--remote", opts.remote);
1437
+ if (opts.ffOnly) argv.push("--ff-only");
1438
+ argv.push(...extraArgs);
1439
+ return run(provider, box, argv);
1440
+ }
1441
+ function boxGitPushHost(provider, box, opts = {}) {
1442
+ const argv = ["agentbox-ctl", "git", "push", "--host-only"];
1443
+ if (opts.as) argv.push("--as", opts.as);
1444
+ if (opts.force) argv.push("--force");
1445
+ argv.push(...opts.args ?? []);
1446
+ return run(provider, box, argv);
1447
+ }
1448
+ function servicesStatusArgv() {
1449
+ return ["agentbox-ctl", "status", "--json"];
1450
+ }
1451
+ function boxServicesStatusRaw(provider, box) {
1452
+ return run(provider, box, servicesStatusArgv());
1453
+ }
1454
+ function restartServiceArgv(name) {
1455
+ return ["agentbox-ctl", "restart", name];
1456
+ }
1457
+ function boxRestartService(provider, box, name) {
1458
+ return run(provider, box, restartServiceArgv(name));
1459
+ }
1460
+ async function boxRestartServices(provider, box, names) {
1461
+ const out = [];
1462
+ for (const name of names) {
1463
+ out.push({ name, result: await boxRestartService(provider, box, name) });
1464
+ }
1465
+ return out;
1466
+ }
1467
+ function firstLine(s) {
1468
+ const i = s.indexOf("\n");
1469
+ return i === -1 ? s : s.slice(0, i);
1470
+ }
1471
+ function errSummary(err) {
1472
+ return err instanceof Error ? firstLine(err.message) : String(err);
1473
+ }
1474
+ function secretsEnvPath() {
1475
+ return resolve3(homedir22(), ".agentbox", "secrets.env");
1476
+ }
1477
+ function writeManagedSecrets(managedKeys, record) {
1478
+ for (const k of managedKeys) delete process.env[k];
1479
+ for (const [k, v] of Object.entries(record)) process.env[k] = v;
1480
+ const path = secretsEnvPath();
1481
+ mkdirSync(dirname22(path), { recursive: true });
1482
+ let existing = "";
1483
+ if (existsSync(path)) {
1484
+ try {
1485
+ existing = readFileSync(path, "utf8");
1486
+ } catch {
1487
+ existing = "";
1488
+ }
1489
+ }
1490
+ const kept = existing.split(/\r?\n/).filter((line) => {
1491
+ const stripped = line.startsWith("export ") ? line.slice("export ".length) : line;
1492
+ const eq = stripped.indexOf("=");
1493
+ if (eq <= 0) return true;
1494
+ const key = stripped.slice(0, eq).trim();
1495
+ return !managedKeys.includes(key);
1496
+ }).join("\n").replace(/\s+$/u, "");
1497
+ const lines = Object.entries(record).map(([k, v]) => `${k}=${v}`);
1498
+ const body = (kept ? `${kept}
1499
+ ` : "") + lines.join("\n") + "\n";
1500
+ const tmp = `${path}.tmp`;
1501
+ writeFileSync(tmp, body, { mode: 384 });
1502
+ try {
1503
+ chmodSync(tmp, 384);
1504
+ } catch {
1505
+ }
1506
+ renameSync(tmp, path);
1507
+ try {
1508
+ chmodSync(path, 384);
1509
+ } catch {
1510
+ }
1511
+ }
1512
+ var PLUGINS_FILE = join3(homedir3(), ".agentbox", "plugins.json");
1513
+ var SUPPORTED_SDK_API_VERSIONS = [1];
1514
+ function isSupportedApiVersion(v) {
1515
+ return SUPPORTED_SDK_API_VERSIONS.includes(v);
1516
+ }
1517
+ var EMPTY2 = { version: 1, plugins: [] };
1518
+ function normalize2(raw) {
1519
+ const parsed = raw;
1520
+ if (!parsed || parsed.version !== 1 || !Array.isArray(parsed.plugins)) {
1521
+ return { ...EMPTY2 };
1522
+ }
1523
+ return parsed;
1524
+ }
1525
+ function readPluginRegistrySync(path = PLUGINS_FILE) {
1526
+ try {
1527
+ if (!existsSync2(path)) return { ...EMPTY2 };
1528
+ return normalize2(JSON.parse(readFileSync2(path, "utf8")));
1529
+ } catch {
1530
+ return { ...EMPTY2 };
1531
+ }
1532
+ }
1533
+ function pluginForProvider(providerName, path = PLUGINS_FILE) {
1534
+ return readPluginRegistrySync(path).plugins.find((p) => p.providers.includes(providerName)) ?? null;
1535
+ }
1536
+ function carryPlaceholderContext(ctx) {
1537
+ const out = {};
1538
+ if (ctx.name) out.AGENTBOX_BOX_NAME = ctx.name;
1539
+ if (ctx.id) out.AGENTBOX_BOX_ID = ctx.id;
1540
+ if (ctx.kind) out.AGENTBOX_BOX_KIND = ctx.kind;
1541
+ if (ctx.hostWorkspace) out.AGENTBOX_HOST_WORKSPACE = ctx.hostWorkspace;
1542
+ if (ctx.projectRoot) out.AGENTBOX_PROJECT_ROOT = ctx.projectRoot;
1543
+ return deriveBoxHost(out);
1544
+ }
1545
+ function wantsRender(e) {
1546
+ return e.kind === "file" && (!!e.replaceEnvs || (e.replace?.length ?? 0) > 0);
1547
+ }
1548
+ async function renderCarryEntries(entries, ctx, onLog) {
1549
+ if (!entries.some(wantsRender)) return entries;
1550
+ const context = carryPlaceholderContext(ctx);
1551
+ const stage = await mkdtemp(join4(tmpdir(), "agentbox-carry-render-"));
1552
+ const out = [];
1553
+ for (const [i, entry] of entries.entries()) {
1554
+ if (!wantsRender(entry)) {
1555
+ out.push(entry);
1556
+ continue;
1557
+ }
1558
+ const content = await readFile3(entry.absSrc, "utf8");
1559
+ const rendered = applyReplacements(content, {
1560
+ env: entry.replaceEnvs,
1561
+ rules: entry.replace,
1562
+ context,
1563
+ onWarn: (msg) => onLog?.(`carry: ${entry.rawSrc}: ${msg}`)
1564
+ });
1565
+ const tmp = join4(stage, `${String(i)}-${basename2(entry.absSrc)}`);
1566
+ await writeFile3(tmp, rendered, "utf8");
1567
+ out.push({ ...entry, absSrc: tmp, bytes: Buffer.byteLength(rendered) });
1568
+ const what = [
1569
+ ...entry.replaceEnvs ? ["env"] : [],
1570
+ ...entry.replace?.length ? [`${String(entry.replace.length)} rule(s)`] : []
1571
+ ].join("+");
1572
+ onLog?.(`carry: rendered ${entry.rawSrc} (${what})`);
1573
+ }
1574
+ return out;
1575
+ }
1576
+ var CLAUDE_BOX_DIR = "/home/vscode/.claude";
1577
+ var CODEX_BOX_DIR = "/home/vscode/.codex";
1578
+ var OPENCODE_BOX_DIR = "/home/vscode/.local/share/opencode";
1579
+ var AGENT_SYNC_SPECS = [
1580
+ {
1581
+ id: "claude",
1582
+ aliases: ["claude-code"],
1583
+ sessionName: "claude",
1584
+ dockerVolume: "agentbox-claude-config",
1585
+ staticPaths: [
1586
+ {
1587
+ hostHomeRel: [".claude"],
1588
+ boxDir: CLAUDE_BOX_DIR,
1589
+ // Static-stage excludes (single source of truth; consumed by
1590
+ // `host-stage.ts:stageClaudeStaticForUpload`). `node_modules` drops
1591
+ // host-platform binaries; `.credentials.json` ships separately; the
1592
+ // rest is per-machine runtime/history state the in-box claude
1593
+ // regenerates (`workflows` is seeded per-box at create time, not baked).
1594
+ exclude: [
1595
+ "node_modules",
1596
+ ".credentials.json",
1597
+ "projects",
1598
+ "workflows",
1599
+ "sessions",
1600
+ "history.jsonl",
1601
+ "file-history",
1602
+ "shell-snapshots",
1603
+ "backups",
1604
+ "session-env",
1605
+ "paste-cache",
1606
+ "cache",
1607
+ "telemetry",
1608
+ "tasks",
1609
+ "downloads",
1610
+ "chrome",
1611
+ "ide",
1612
+ "debug",
1613
+ "mcp-needs-auth-cache.json",
1614
+ "stats-cache.json"
1615
+ ]
1616
+ }
1617
+ ],
1618
+ credential: {
1619
+ boxRelPath: ".credentials.json",
1620
+ boxAbsPath: `${CLAUDE_BOX_DIR}/.credentials.json`,
1621
+ hostBackup: join5(STATE_DIR, "claude-credentials.json"),
1622
+ cloudMountPath: "/home/vscode/.agentbox-creds/claude",
1623
+ cloudSubpath: "claude/",
1624
+ realShape: "claude-oauth"
1625
+ },
1626
+ forwardedEnvKeys: [
1627
+ "ANTHROPIC_API_KEY",
1628
+ "CLAUDE_CODE_OAUTH_TOKEN",
1629
+ "CLAUDE_EFFORT",
1630
+ "ANTHROPIC_MODEL"
1631
+ ],
1632
+ boxRunEnv: () => ({}),
1633
+ caps: { resume: true, teleport: "full", activitySource: "scraper" }
1634
+ },
1635
+ {
1636
+ id: "codex",
1637
+ aliases: [],
1638
+ sessionName: "codex",
1639
+ dockerVolume: "agentbox-codex-config",
1640
+ staticPaths: [
1641
+ {
1642
+ hostHomeRel: [".codex"],
1643
+ boxDir: CODEX_BOX_DIR,
1644
+ // Static-stage excludes (single source of truth; consumed by
1645
+ // `host-stage.ts:stageCodexStaticForUpload`). `auth.json` ships
1646
+ // separately; `state_*.sqlite*` is the resume-cwd index (rebuilt in-box);
1647
+ // `packages`/`plugins/.plugin-appserver`/`computer-use` are heavy
1648
+ // macOS-only artifacts; the rest is host-only session/log/cache state.
1649
+ exclude: [
1650
+ "auth.json",
1651
+ "sessions",
1652
+ "log",
1653
+ "history.jsonl",
1654
+ "hooks.json",
1655
+ "state_*.sqlite*",
1656
+ "logs_*.sqlite*",
1657
+ "external_agent_session_imports.json",
1658
+ "sqlite",
1659
+ "cache",
1660
+ "vendor_imports",
1661
+ "tmp",
1662
+ ".tmp",
1663
+ ".codex-global-state.json",
1664
+ ".codex-global-state.json.bak",
1665
+ ".personality_migration",
1666
+ "shell_snapshots",
1667
+ "session_index.jsonl",
1668
+ "models_cache.json",
1669
+ "installation_id",
1670
+ "version.json",
1671
+ "packages",
1672
+ "plugins/.plugin-appserver",
1673
+ "computer-use",
1674
+ "archived_sessions"
1675
+ ]
1676
+ }
1677
+ ],
1678
+ credential: {
1679
+ boxRelPath: "auth.json",
1680
+ boxAbsPath: `${CODEX_BOX_DIR}/auth.json`,
1681
+ hostBackup: join5(STATE_DIR, "codex-credentials.json"),
1682
+ cloudMountPath: "/home/vscode/.agentbox-creds/codex",
1683
+ cloudSubpath: "codex/",
1684
+ realShape: "nonempty-json"
1685
+ },
1686
+ forwardedEnvKeys: ["OPENAI_API_KEY"],
1687
+ boxRunEnv: () => ({}),
1688
+ caps: { resume: true, teleport: "full", activitySource: "scraper" }
1689
+ },
1690
+ {
1691
+ id: "opencode",
1692
+ aliases: [],
1693
+ sessionName: "opencode",
1694
+ dockerVolume: "agentbox-opencode-config",
1695
+ // The three-XDG-dir layout as DATA: the generic seed loop reproduces
1696
+ // `ensureOpencodeVolume`'s three-source rsync (data + config→config +
1697
+ // state→.state/opencode newest-wins) with no tool-specific control flow.
1698
+ staticPaths: [
1699
+ {
1700
+ hostHomeRel: [".local", "share", "opencode"],
1701
+ boxDir: OPENCODE_BOX_DIR,
1702
+ // Static-stage excludes for the data tree (single source of truth;
1703
+ // consumed by `host-stage.ts:stageOpencodeStaticForUpload`). `auth.json`
1704
+ // ships separately; the rest is host-only runtime state.
1705
+ exclude: [
1706
+ "auth.json",
1707
+ "storage",
1708
+ "log",
1709
+ "project",
1710
+ "cache",
1711
+ "bin",
1712
+ "repos",
1713
+ "snapshot",
1714
+ "config",
1715
+ "opencode.db",
1716
+ "opencode.db-shm",
1717
+ "opencode.db-wal"
1718
+ ]
1719
+ },
1720
+ { hostHomeRel: [".config", "opencode"], boxDir: OPENCODE_BOX_DIR, relocToSubpath: "config" },
1721
+ {
1722
+ hostHomeRel: [".local", "state", "opencode"],
1723
+ boxDir: OPENCODE_BOX_DIR,
1724
+ relocToSubpath: ".state/opencode",
1725
+ update: true,
1726
+ exclude: ["locks"]
1727
+ }
1728
+ ],
1729
+ credential: {
1730
+ boxRelPath: "auth.json",
1731
+ boxAbsPath: `${OPENCODE_BOX_DIR}/auth.json`,
1732
+ hostBackup: join5(STATE_DIR, "opencode-credentials.json"),
1733
+ cloudMountPath: "/home/vscode/.agentbox-creds/opencode",
1734
+ cloudSubpath: "opencode/",
1735
+ realShape: "nonempty-json"
1736
+ },
1737
+ forwardedEnvKeys: [
1738
+ "ANTHROPIC_API_KEY",
1739
+ "OPENAI_API_KEY",
1740
+ "OPENROUTER_API_KEY",
1741
+ "GEMINI_API_KEY",
1742
+ "GOOGLE_GENERATIVE_AI_API_KEY",
1743
+ "GOOGLE_API_KEY",
1744
+ "GROQ_API_KEY"
1745
+ ],
1746
+ boxRunEnv: () => ({
1747
+ OPENCODE_CONFIG_DIR: `${OPENCODE_BOX_DIR}/config`,
1748
+ XDG_STATE_HOME: `${OPENCODE_BOX_DIR}/.state`
1749
+ }),
1750
+ caps: { resume: false, teleport: "stub", activitySource: "plugin" }
1751
+ }
1752
+ ];
1753
+ function resolveAgentSpec(name) {
1754
+ const spec = AGENT_SYNC_SPECS.find((s) => s.id === name || s.aliases.includes(name));
1755
+ if (!spec) throw new Error(`no agent sync spec for '${name}'`);
1756
+ return spec;
1757
+ }
1758
+ function makeSyncContext(init) {
1759
+ return {
1760
+ boxName: init.boxName,
1761
+ boxId: init.boxId,
1762
+ provider: init.provider,
1763
+ hostWorkspace: init.hostWorkspace,
1764
+ projectRoot: init.projectRoot ?? init.hostWorkspace,
1765
+ boxWorkspace: init.boxWorkspace ?? "/workspace",
1766
+ hostHome: init.hostHome ?? homedir4(),
1767
+ onLog: init.onLog ?? (() => {
1768
+ })
1769
+ };
1770
+ }
1771
+ var DEFAULT_ENV_PATTERNS = [
1772
+ ".env",
1773
+ ".env.*",
1774
+ ".envrc",
1775
+ ".dev.vars",
1776
+ "secrets.toml",
1777
+ "local.settings.json",
1778
+ "appsettings.*.json",
1779
+ "agentbox.yaml"
1780
+ ];
1781
+ var ENV_PRUNE_DIRS = [
1782
+ "node_modules",
1783
+ ".git",
1784
+ ".venv",
1785
+ "venv",
1786
+ "__pycache__",
1787
+ "dist",
1788
+ ".next",
1789
+ "build"
1790
+ ];
1791
+ function nameGroup(names) {
1792
+ const out = [];
1793
+ names.forEach((n, i) => {
1794
+ if (i > 0) out.push("-o");
1795
+ out.push("-name", n);
1796
+ });
1797
+ return out;
1798
+ }
1799
+ function buildHostEnvFindArgs(patterns) {
1800
+ return [
1801
+ "find",
1802
+ ".",
1803
+ "(",
1804
+ "-type",
1805
+ "d",
1806
+ "(",
1807
+ ...nameGroup(ENV_PRUNE_DIRS),
1808
+ ")",
1809
+ "-prune",
1810
+ ")",
1811
+ "-o",
1812
+ "(",
1813
+ "-type",
1814
+ "f",
1815
+ "(",
1816
+ ...nameGroup(patterns),
1817
+ ")",
1818
+ "-print0",
1819
+ ")"
1820
+ ];
1821
+ }
1822
+ async function findEnvFilesForTar(workspaceDir, patterns) {
1823
+ if (patterns.length === 0) return [];
1824
+ const found = await execa("find", buildHostEnvFindArgs(patterns).slice(1), {
1825
+ cwd: workspaceDir,
1826
+ reject: false
1827
+ });
1828
+ if (found.exitCode !== 0) return [];
1829
+ return String(found.stdout).split("\0").filter((p) => p.length > 0);
1830
+ }
1831
+ async function scanHostEnvFiles(workspaceDir, patterns) {
1832
+ const raw = await findEnvFilesForTar(workspaceDir, patterns);
1833
+ return raw.map((p) => p.replace(/^\.\//, "")).filter((p) => p.length > 0);
1834
+ }
1835
+ async function pushEnvFiles(ctx, transport, patterns) {
1836
+ const list = await findEnvFilesForTar(ctx.hostWorkspace, patterns);
1837
+ if (list.length === 0) return { copied: 0 };
1838
+ const stage = await mkdtemp2(join6(tmpdir2(), "agentbox-envfiles-"));
1839
+ const localTar = join6(stage, "envfiles.tar");
1840
+ try {
1841
+ const packed = await execa(
1842
+ "tar",
1843
+ ["-C", ctx.hostWorkspace, "--null", "-T", "-", "-cf", localTar],
1844
+ { input: list.join("\0"), reject: false }
1845
+ );
1846
+ if (packed.exitCode !== 0) {
1847
+ ctx.onLog(`warning: env-file tar pack failed: ${String(packed.stderr).slice(0, 300)}`);
1848
+ return { copied: 0 };
1849
+ }
1850
+ try {
1851
+ await transport.applyTarball(localTar, ctx.boxWorkspace, { uid: 1e3 });
1852
+ } catch (err) {
1853
+ ctx.onLog(
1854
+ `warning: env-file copy into box failed: ${err instanceof Error ? err.message : String(err)}`
1855
+ );
1856
+ return { copied: 0 };
1857
+ }
1858
+ } finally {
1859
+ await rm3(stage, { recursive: true, force: true });
1860
+ }
1861
+ return { copied: list.length };
1862
+ }
1863
+ var BOX_HOME = "/home/vscode";
1864
+ function dirnameUnix(p) {
1865
+ const i = p.lastIndexOf("/");
1866
+ if (i <= 0) return "/";
1867
+ return p.slice(0, i);
1868
+ }
1869
+ function basenameUnix(p) {
1870
+ const i = p.lastIndexOf("/");
1871
+ return i < 0 ? p : p.slice(i + 1);
1872
+ }
1873
+ function planCarryEntry(entry) {
1874
+ if (entry.kind === "missing") return null;
1875
+ const boxDest = entry.absDest.startsWith("~/") ? `${BOX_HOME}/${entry.absDest.slice(2)}` : entry.absDest;
1876
+ const boxDestNoSlash = boxDest.endsWith("/") ? boxDest.slice(0, -1) : boxDest;
1877
+ const isDir = entry.kind === "dir";
1878
+ const parentDir = isDir ? boxDestNoSlash : dirnameUnix(boxDestNoSlash);
1879
+ const exclude = isDir ? entry.exclude ?? [] : [];
1880
+ const uid = entry.user ?? 1e3;
1881
+ const mode = entry.mode !== void 0 ? entry.mode.toString(8).padStart(4, "0") : void 0;
1882
+ const fileBase = isDir ? "" : basenameUnix(entry.absSrc);
1883
+ const destBase = isDir ? "" : basenameUnix(boxDest);
1884
+ const renameNeeded = !isDir && fileBase !== destBase;
1885
+ const parentChainNeeded = boxDest.startsWith(`${BOX_HOME}/`) && dirnameUnix(boxDest) !== BOX_HOME;
1886
+ return {
1887
+ boxDest,
1888
+ isDir,
1889
+ parentDir,
1890
+ exclude,
1891
+ uid,
1892
+ mode,
1893
+ fileBase,
1894
+ destBase,
1895
+ renameNeeded,
1896
+ parentChainNeeded
1897
+ };
1898
+ }
1899
+ async function pathExists(p) {
1900
+ try {
1901
+ await stat4(p);
1902
+ return true;
1903
+ } catch {
1904
+ return false;
1905
+ }
1906
+ }
1907
+ function encodeClaudeProjectsKey(absPath) {
1908
+ return absPath.replace(/[^a-zA-Z0-9]/g, "-");
1909
+ }
1910
+ var BOX_CLAUDE_PROJECT_DIR = "/home/vscode/.claude/projects/-workspace";
1911
+ async function resolveClaudeMemoryDir(hostWorkspace, hostHome = homedir5()) {
1912
+ if (hostWorkspace.length === 0) return null;
1913
+ const memDir = join7(
1914
+ hostHome,
1915
+ ".claude",
1916
+ "projects",
1917
+ encodeClaudeProjectsKey(hostWorkspace),
1918
+ "memory"
1919
+ );
1920
+ if (!await pathExists(memDir)) return null;
1921
+ try {
1922
+ const entries = await readdir2(memDir);
1923
+ if (entries.length === 0) return null;
1924
+ } catch {
1925
+ return null;
1926
+ }
1927
+ return memDir;
1928
+ }
1929
+ function isUnder(parent, child) {
1930
+ const rel = relative(parent, child);
1931
+ return rel === "" || !rel.startsWith("..") && !isAbsolute3(rel);
1932
+ }
1933
+ async function findUnsyncableSymlinks(root, reachableRoots) {
1934
+ const reachable = await Promise.all(
1935
+ reachableRoots.map(async (r) => {
1936
+ try {
1937
+ return await realpath2(r);
1938
+ } catch {
1939
+ return r;
1940
+ }
1941
+ })
1942
+ );
1943
+ const unsyncable = [];
1944
+ const onPath = /* @__PURE__ */ new Set();
1945
+ async function walk(realDir, virtualDir) {
1946
+ if (onPath.has(realDir)) return;
1947
+ onPath.add(realDir);
1948
+ try {
1949
+ let entries;
1950
+ try {
1951
+ entries = await readdir3(realDir, { withFileTypes: true });
1952
+ } catch {
1953
+ return;
1954
+ }
1955
+ for (const ent of entries) {
1956
+ const realFull = join8(realDir, ent.name);
1957
+ const virtualFull = virtualDir ? join8(virtualDir, ent.name) : ent.name;
1958
+ if (ent.isSymbolicLink()) {
1959
+ let real;
1960
+ try {
1961
+ real = await realpath2(realFull);
1962
+ } catch {
1963
+ unsyncable.push(virtualFull);
1964
+ continue;
1965
+ }
1966
+ if (!reachable.some((r) => isUnder(r, real))) {
1967
+ unsyncable.push(virtualFull);
1968
+ continue;
1969
+ }
1970
+ const st = await stat5(real).catch(() => null);
1971
+ if (st?.isDirectory()) await walk(real, virtualFull);
1972
+ } else if (ent.isDirectory()) {
1973
+ await walk(realFull, virtualFull);
1974
+ }
1975
+ }
1976
+ } finally {
1977
+ onPath.delete(realDir);
1978
+ }
1979
+ }
1980
+ await walk(root, "");
1981
+ return unsyncable;
1982
+ }
1983
+ async function pathExists2(p) {
1984
+ try {
1985
+ await stat6(p);
1986
+ return true;
1987
+ } catch {
1988
+ return false;
1989
+ }
1990
+ }
1991
+ async function seedAgentsVolume(args) {
1992
+ const seed = args.transport.seedVolumeFromHost;
1993
+ if (!seed) throw new Error("seedAgentsVolume requires a transport with seedVolumeFromHost");
1994
+ const willSync = args.syncFromHost && await pathExists2(args.hostAgents);
1995
+ if (!willSync) {
1996
+ try {
1997
+ await seed.call(args.transport, args.volume, []);
1998
+ } catch (err) {
1999
+ args.onLog?.(
2000
+ `skills: volume writable-chown failed (ignored): ${err instanceof Error ? err.message : String(err)}`
2001
+ );
2002
+ }
2003
+ return { synced: false };
2004
+ }
2005
+ const excludes = (await findUnsyncableSymlinks(args.hostAgents, [args.hostAgents])).map(
2006
+ (rel) => `/${rel}`
2007
+ );
2008
+ await seed.call(args.transport, args.volume, [
2009
+ { hostDir: args.hostAgents, destSubpath: "", exclude: excludes, copyUnsafeLinks: true }
2010
+ ]);
2011
+ if (excludes.length > 0) {
2012
+ args.onLog?.(`skills: excluded ${String(excludes.length)} unsyncable symlink(s) from ~/.agents`);
2013
+ }
2014
+ return { synced: true };
2015
+ }
2016
+ var SEED_MARKER = ".agentbox-seeded-at";
2017
+ var CLAUDE_HOST_BACKUP = resolveAgentSpec("claude").credential.hostBackup;
2018
+ function isRealAgentCredential(agent, text) {
2019
+ let parsed;
2020
+ try {
2021
+ parsed = JSON.parse(text);
2022
+ } catch {
2023
+ return false;
2024
+ }
2025
+ if (typeof parsed !== "object" || parsed === null) return false;
2026
+ const spec = AGENT_SYNC_SPECS.find((s) => s.id === agent);
2027
+ if (spec?.credential.realShape === "claude-oauth") {
2028
+ const rt = parsed.claudeAiOauth?.refreshToken;
2029
+ return typeof rt === "string" && rt.length > 0;
2030
+ }
2031
+ return Object.keys(parsed).length > 0;
2032
+ }
2033
+ async function hostClaudeBackupExpired(path = CLAUDE_HOST_BACKUP, now = Date.now()) {
2034
+ try {
2035
+ const parsed = JSON.parse(await readFile4(path, "utf8"));
2036
+ const exp = parsed?.claudeAiOauth?.expiresAt;
2037
+ return typeof exp === "number" && Number.isFinite(exp) && exp < now;
2038
+ } catch {
2039
+ return false;
2040
+ }
2041
+ }
2042
+ async function hostBackupHasCredentials(path = CLAUDE_HOST_BACKUP) {
2043
+ try {
2044
+ const parsed = JSON.parse(await readFile4(path, "utf8"));
2045
+ const rt = parsed?.claudeAiOauth?.refreshToken;
2046
+ return typeof rt === "string" && rt.length > 0;
2047
+ } catch {
2048
+ return false;
2049
+ }
2050
+ }
2051
+ async function extractCredentials(transport, opts = {}) {
2052
+ const log = opts.onLog ?? (() => {
2053
+ });
2054
+ const extracted = [];
2055
+ for (const spec of AGENT_SYNC_SPECS) {
2056
+ const hostBackup = opts.backups?.[spec.id] ?? spec.credential.hostBackup;
2057
+ try {
2058
+ const text = await transport.readText(spec.credential.boxAbsPath);
2059
+ if (!text || !isRealAgentCredential(spec.id, text)) continue;
2060
+ await mkdir3(dirname4(hostBackup), { recursive: true });
2061
+ await writeFile4(hostBackup, text, { mode: 384 });
2062
+ await chmod(hostBackup, 384).catch(() => {
2063
+ });
2064
+ extracted.push(spec.id);
2065
+ log(`extracted ${spec.id} login from box to ${hostBackup}`);
2066
+ } catch (err) {
2067
+ log(
2068
+ `WARN: ${spec.id} credential extract failed (${err instanceof Error ? err.message : String(err)}) \u2014 skipping`
2069
+ );
2070
+ }
2071
+ }
2072
+ return extracted;
2073
+ }
2074
+ var NON_REGULAR_TOKEN = "-";
2075
+ function classifyUntrackedOverlay(boxToken, hostHash) {
2076
+ if (boxToken === void 0) return "copy";
2077
+ if (boxToken === NON_REGULAR_TOKEN) return "conflict";
2078
+ return boxToken === hostHash ? "identical" : "conflict";
2079
+ }
2080
+ function splitNul(s) {
2081
+ return s.split("\0").filter((p) => p.length > 0);
2082
+ }
2083
+ async function unmergedPaths(ports, ct) {
2084
+ const r = await ports.boxGit(ct, ["diff", "--name-only", "--diff-filter=U", "-z"]);
2085
+ return r.exitCode === 0 ? splitNul(r.stdout) : [];
2086
+ }
2087
+ async function resyncWorkspace(worktrees, ports, onLog) {
2088
+ const log = onLog ?? (() => {
2089
+ });
2090
+ const results = [];
2091
+ for (const w of worktrees) {
2092
+ const ct = w.containerPath;
2093
+ const hostMain = w.hostMainRepo;
2094
+ const boxBranch = w.branch;
2095
+ const res = { containerPath: ct, mergeConflicts: [], overlaySkipped: [] };
2096
+ const hostRef = await ports.resolveHostRef(hostMain);
2097
+ if (!hostRef) {
2098
+ log(`resync: ${ct}: could not resolve host ref; skipping`);
2099
+ results.push(res);
2100
+ continue;
2101
+ }
2102
+ const hostStashSha = await ports.createHostStash(hostMain);
2103
+ const hostUntracked = await ports.listHostUntracked(hostMain);
2104
+ if (hostRef !== boxBranch) {
2105
+ const status = await ports.boxGit(ct, ["status", "--porcelain"]);
2106
+ const boxDirty = status.stdout.split("\n").some((line) => line.length > 0 && !line.startsWith("??"));
2107
+ let boxStashed = false;
2108
+ if (boxDirty) {
2109
+ const push = await ports.boxGit(ct, ["stash", "push", "-m", "agentbox-resync"]);
2110
+ boxStashed = push.exitCode === 0;
2111
+ }
2112
+ const newCommits = await ports.boxGit(ct, ["rev-list", "--count", `${boxBranch}..${hostRef}`]);
2113
+ const n = newCommits.exitCode === 0 ? newCommits.stdout.trim() : "?";
2114
+ const merge = await ports.boxGit(ct, ["merge", "--no-commit", hostRef]);
2115
+ const mergeInProgress = (await ports.boxGit(ct, ["rev-parse", "-q", "--verify", "MERGE_HEAD"])).exitCode === 0;
2116
+ const conflicts = await unmergedPaths(ports, ct);
2117
+ if (conflicts.length > 0) {
2118
+ await ports.boxGit(ct, ["checkout", "--ours", "--", ...conflicts]);
2119
+ await ports.boxGit(ct, ["add", "--", ...conflicts]);
2120
+ res.mergeConflicts.push(...conflicts);
2121
+ }
2122
+ if (mergeInProgress) {
2123
+ await ports.boxGit(ct, [
2124
+ "-c",
2125
+ "user.name=agentbox",
2126
+ "-c",
2127
+ "user.email=agentbox@users.noreply.github.com",
2128
+ "commit",
2129
+ "--no-edit"
2130
+ ]);
2131
+ log(
2132
+ `resync: ${ct}: merged ${n} new host commit(s) from ${hostRef}` + (conflicts.length > 0 ? ` (${String(conflicts.length)} conflict(s) kept box version)` : "")
2133
+ );
2134
+ } else if (merge.exitCode === 0) {
2135
+ log(`resync: ${ct}: ${n === "0" ? "already up to date" : `fast-forwarded to ${hostRef}`}`);
2136
+ } else {
2137
+ await ports.boxGit(ct, ["merge", "--abort"]);
2138
+ log(`resync: ${ct}: merge skipped (${(merge.stderr || merge.stdout).trim().split("\n")[0]})`);
2139
+ }
2140
+ if (boxStashed) {
2141
+ const pop = await ports.boxGit(ct, ["stash", "pop"]);
2142
+ if (pop.exitCode !== 0) {
2143
+ const popConflicts = await unmergedPaths(ports, ct);
2144
+ for (const p of popConflicts) {
2145
+ await ports.boxGit(ct, ["checkout", "--theirs", "--", p]);
2146
+ await ports.boxGit(ct, ["reset", "-q", "--", p]);
2147
+ }
2148
+ await ports.boxGit(ct, ["stash", "drop"]);
2149
+ }
2150
+ }
2151
+ }
2152
+ if (hostStashSha) {
2153
+ const apply = await ports.boxGit(ct, ["stash", "apply", hostStashSha]);
2154
+ if (apply.exitCode !== 0) {
2155
+ const conflicts = await unmergedPaths(ports, ct);
2156
+ for (const p of conflicts) {
2157
+ await ports.boxGit(ct, ["checkout", "--ours", "--", p]);
2158
+ await ports.boxGit(ct, ["reset", "-q", "--", p]);
2159
+ }
2160
+ if (conflicts.length > 0) res.overlaySkipped.push(...conflicts);
2161
+ }
2162
+ }
2163
+ if (hostUntracked.length > 0) {
2164
+ const boxTokens = await ports.probeUntrackedTokens(ct, hostUntracked);
2165
+ const toCopy = [];
2166
+ let identical = 0;
2167
+ for (const p of hostUntracked) {
2168
+ const boxToken = boxTokens.get(p);
2169
+ let hostHash = "";
2170
+ if (boxToken !== void 0 && boxToken !== NON_REGULAR_TOKEN) {
2171
+ try {
2172
+ hostHash = await ports.hashHostFile(hostMain, p);
2173
+ } catch {
2174
+ identical++;
2175
+ continue;
2176
+ }
2177
+ }
2178
+ const verdict = classifyUntrackedOverlay(boxToken, hostHash);
2179
+ if (verdict === "copy") toCopy.push(p);
2180
+ else if (verdict === "conflict") res.overlaySkipped.push(p);
2181
+ else identical++;
2182
+ }
2183
+ if (identical > 0) {
2184
+ log(`resync: ${ct}: ${String(identical)} untracked host file(s) already identical in box (no-op)`);
2185
+ }
2186
+ if (toCopy.length > 0) {
2187
+ const tar = await ports.packHostFiles(hostMain, toCopy);
2188
+ if (tar) {
2189
+ await ports.applyTarToBox(ct, tar);
2190
+ log(`resync: ${ct}: copied ${String(toCopy.length)} untracked host file(s)`);
2191
+ }
2192
+ }
2193
+ }
2194
+ results.push(res);
2195
+ }
2196
+ return results;
2197
+ }
2198
+ function makeHostGitPorts() {
2199
+ return {
2200
+ async resolveHostRef(hostMain) {
2201
+ const hostBranchProbe = await execa(
2202
+ "git",
2203
+ ["-C", hostMain, "symbolic-ref", "--short", "-q", "HEAD"],
2204
+ { reject: false }
2205
+ );
2206
+ const hostRef = hostBranchProbe.exitCode === 0 && hostBranchProbe.stdout.trim() ? hostBranchProbe.stdout.trim() : (await execa("git", ["-C", hostMain, "rev-parse", "HEAD"], { reject: false })).stdout.trim();
2207
+ return hostRef || null;
2208
+ },
2209
+ async createHostStash(hostMain) {
2210
+ const stash = await execa("git", ["-C", hostMain, "stash", "create"], { reject: false });
2211
+ return stash.exitCode === 0 ? stash.stdout.trim() || null : null;
2212
+ },
2213
+ async listHostUntracked(hostMain) {
2214
+ const untracked = await execa(
2215
+ "git",
2216
+ ["-C", hostMain, "ls-files", "--others", "--exclude-standard", "-z"],
2217
+ { reject: false }
2218
+ );
2219
+ return untracked.exitCode === 0 ? splitNul(untracked.stdout) : [];
2220
+ },
2221
+ async hashHostFile(hostMain, relPath) {
2222
+ return createHash("sha256").update(await readFile5(join9(hostMain, relPath))).digest("hex");
2223
+ },
2224
+ async packHostFiles(hostMain, relPaths) {
2225
+ const tarOut = await execa("tar", ["-C", hostMain, "--null", "-T", "-", "-cf", "-"], {
2226
+ input: relPaths.join("\0"),
2227
+ encoding: "buffer",
2228
+ reject: false
2229
+ });
2230
+ return tarOut.exitCode === 0 ? tarOut.stdout : null;
2231
+ }
2232
+ };
2233
+ }
2234
+ var BOX_WORKFLOWS_DIR = "/home/vscode/.claude/workflows";
2235
+ var BOX_DYNAMIC_SYNC_MANIFEST = "/home/vscode/.agentbox/dynamic-sync.json";
2236
+ var BOX_MEMORY_DIR = `${BOX_CLAUDE_PROJECT_DIR}/memory`;
2237
+ async function pathExists3(p) {
2238
+ try {
2239
+ await stat7(p);
2240
+ return true;
2241
+ } catch {
2242
+ return false;
2243
+ }
2244
+ }
2245
+ async function walkFiles(root, prefix = "") {
2246
+ let entries;
2247
+ try {
2248
+ entries = await readdir4(root, { withFileTypes: true });
2249
+ } catch {
2250
+ return [];
2251
+ }
2252
+ const out = [];
2253
+ for (const ent of entries) {
2254
+ const rel = prefix ? `${prefix}/${ent.name}` : ent.name;
2255
+ const full = join10(root, ent.name);
2256
+ if (ent.isDirectory()) {
2257
+ out.push(...await walkFiles(full, rel));
2258
+ } else if (ent.isFile()) {
2259
+ out.push(rel);
2260
+ } else if (ent.isSymbolicLink()) {
2261
+ try {
2262
+ const s = await stat7(full);
2263
+ if (s.isFile()) out.push(rel);
2264
+ } catch {
2265
+ }
2266
+ }
2267
+ }
2268
+ return out;
2269
+ }
2270
+ async function hashFile(absPath) {
2271
+ const buf = await readFile6(absPath);
2272
+ return createHash2("sha256").update(buf).digest("hex");
2273
+ }
2274
+ async function buildHostSet(name, hostDir, boxDst) {
2275
+ if (hostDir === null) return { dst: boxDst, files: {}, hostDir: null };
2276
+ const rels = await walkFiles(hostDir);
2277
+ const files = {};
2278
+ for (const rel of rels) {
2279
+ files[rel] = await hashFile(join10(hostDir, rel));
2280
+ }
2281
+ return { dst: boxDst, files, hostDir };
2282
+ }
2283
+ async function buildHostSyncManifest(workspacePath, hostHome = homedir6()) {
2284
+ const workflowsDir = join10(hostHome, ".claude", "workflows");
2285
+ const workflowsHost = await pathExists3(workflowsDir) ? workflowsDir : null;
2286
+ const memoryHost = await resolveClaudeMemoryDir(workspacePath, hostHome);
2287
+ const [workflows, memory] = await Promise.all([
2288
+ buildHostSet("workflows", workflowsHost, BOX_WORKFLOWS_DIR),
2289
+ buildHostSet("memory", memoryHost, BOX_MEMORY_DIR)
2290
+ ]);
2291
+ return { sets: { workflows, memory } };
2292
+ }
2293
+ var SET_NAMES = ["workflows", "memory"];
2294
+ function computeSyncDelta(host, box) {
2295
+ const uploads = [];
2296
+ const deletions = [];
2297
+ const nextSets = {};
2298
+ for (const name of SET_NAMES) {
2299
+ const hostSet = host.sets[name];
2300
+ const boxFiles = box?.sets?.[name]?.files ?? {};
2301
+ for (const [rel, hash] of Object.entries(hostSet.files)) {
2302
+ if (boxFiles[rel] !== hash) {
2303
+ uploads.push({
2304
+ set: name,
2305
+ rel,
2306
+ absSrc: join10(hostSet.hostDir, rel),
2307
+ dst: `${hostSet.dst}/${rel}`
2308
+ });
2309
+ }
2310
+ }
2311
+ for (const rel of Object.keys(boxFiles)) {
2312
+ if (!(rel in hostSet.files)) {
2313
+ deletions.push({ set: name, rel, dst: `${hostSet.dst}/${rel}` });
2314
+ }
2315
+ }
2316
+ nextSets[name] = { dst: hostSet.dst, files: hostSet.files };
2317
+ }
2318
+ return { uploads, deletions, nextManifest: { version: 1, sets: nextSets } };
2319
+ }
2320
+ async function stageDynamicSyncTarball(uploads) {
2321
+ if (uploads.length === 0) {
2322
+ return { tarballPath: null, cleanup: async () => {
2323
+ } };
2324
+ }
2325
+ const stageDir = await mkdtemp3(join10(tmpdir3(), "agentbox-dynsync-stage-"));
2326
+ let tarballPath = null;
2327
+ try {
2328
+ for (const up of uploads) {
2329
+ const target = join10(stageDir, up.set, up.rel);
2330
+ await mkdir4(dirname5(target), { recursive: true });
2331
+ await copyFile(up.absSrc, target);
2332
+ }
2333
+ tarballPath = join10(tmpdir3(), `agentbox-dynsync-${basename22(stageDir)}.tar.gz`);
2334
+ await execa("tar", ["-czf", tarballPath, "-C", stageDir, "."], {
2335
+ env: { ...process.env, COPYFILE_DISABLE: "1" }
2336
+ });
2337
+ const tp = tarballPath;
2338
+ return {
2339
+ tarballPath: tp,
2340
+ cleanup: async () => {
2341
+ await rm4(stageDir, { recursive: true, force: true });
2342
+ await rm4(tp, { force: true });
2343
+ }
2344
+ };
2345
+ } catch (err) {
2346
+ await rm4(stageDir, { recursive: true, force: true });
2347
+ if (tarballPath) await rm4(tarballPath, { force: true });
2348
+ throw err;
2349
+ }
2350
+ }
2351
+ function isHostPathHookCommand(command, hostHome) {
2352
+ if (typeof command !== "string" || command.length === 0) return false;
2353
+ if (hostHome.length === 0) return false;
2354
+ return command.includes(hostHome + "/");
2355
+ }
2356
+ function filterHostHooks(data, hostHome) {
2357
+ const clone = structuredClone(data);
2358
+ const removedCommands = [];
2359
+ if (clone === null || typeof clone !== "object" || Array.isArray(clone)) {
2360
+ return { data: clone, removedCommands };
2361
+ }
2362
+ const top = clone;
2363
+ const hooksRoot = top.hooks;
2364
+ if (hooksRoot === null || typeof hooksRoot !== "object" || Array.isArray(hooksRoot)) {
2365
+ return { data: clone, removedCommands };
2366
+ }
2367
+ for (const triggerName of Object.keys(hooksRoot)) {
2368
+ const triggerValue = hooksRoot[triggerName];
2369
+ if (!Array.isArray(triggerValue)) continue;
2370
+ for (const entry of triggerValue) {
2371
+ if (entry === null || typeof entry !== "object") continue;
2372
+ const matcher = entry;
2373
+ const inner = matcher.hooks;
2374
+ if (!Array.isArray(inner)) continue;
2375
+ for (let i = inner.length - 1; i >= 0; i--) {
2376
+ const leaf = inner[i];
2377
+ if (leaf === null || typeof leaf !== "object") continue;
2378
+ if (leaf.type === "command" && typeof leaf.command === "string" && isHostPathHookCommand(leaf.command, hostHome)) {
2379
+ removedCommands.push(leaf.command);
2380
+ inner.splice(i, 1);
2381
+ }
2382
+ }
2383
+ }
2384
+ }
2385
+ return { data: clone, removedCommands };
2386
+ }
2387
+ function trustWorkspace(data, workspacePath) {
2388
+ const clone = structuredClone(data);
2389
+ if (clone === null || typeof clone !== "object" || Array.isArray(clone)) {
2390
+ return { data: clone, trusted: false };
2391
+ }
2392
+ if (workspacePath.length === 0) return { data: clone, trusted: false };
2393
+ const obj = clone;
2394
+ if (obj.projects === null || typeof obj.projects !== "object" || Array.isArray(obj.projects)) {
2395
+ obj.projects = {};
2396
+ }
2397
+ const projects = obj.projects;
2398
+ const existing = projects[workspacePath];
2399
+ const entry = existing !== null && typeof existing === "object" && !Array.isArray(existing) ? existing : {};
2400
+ if (entry.hasTrustDialogAccepted === true) {
2401
+ projects[workspacePath] = entry;
2402
+ return { data: clone, trusted: false };
2403
+ }
2404
+ entry.hasTrustDialogAccepted = true;
2405
+ projects[workspacePath] = entry;
2406
+ return { data: clone, trusted: true };
2407
+ }
2408
+ function addProjectAlias(data, fromPath, toPath) {
2409
+ const clone = structuredClone(data);
2410
+ if (clone === null || typeof clone !== "object" || Array.isArray(clone)) {
2411
+ return { data: clone, aliased: false };
2412
+ }
2413
+ if (fromPath === toPath || fromPath.length === 0 || toPath.length === 0) {
2414
+ return { data: clone, aliased: false };
2415
+ }
2416
+ const obj = clone;
2417
+ const projects = obj.projects;
2418
+ if (projects === null || typeof projects !== "object" || Array.isArray(projects)) {
2419
+ return { data: clone, aliased: false };
2420
+ }
2421
+ const projectsMap = projects;
2422
+ const src = projectsMap[fromPath];
2423
+ if (src === null || typeof src !== "object" || Array.isArray(src)) {
2424
+ return { data: clone, aliased: false };
2425
+ }
2426
+ const existing = projectsMap[toPath];
2427
+ if (existing !== null && typeof existing === "object" && !Array.isArray(existing)) {
2428
+ projectsMap[toPath] = { ...existing, ...src };
2429
+ } else {
2430
+ projectsMap[toPath] = structuredClone(src);
2431
+ }
2432
+ return { data: clone, aliased: true };
2433
+ }
2434
+ function setInstallMethodNative(data) {
2435
+ const clone = structuredClone(data);
2436
+ if (clone === null || typeof clone !== "object" || Array.isArray(clone)) {
2437
+ return { data: clone, applied: false };
2438
+ }
2439
+ const obj = clone;
2440
+ const changed = obj.installMethod !== "native" || obj.autoUpdates !== false || obj.autoUpdatesProtectedForNative !== true;
2441
+ obj.installMethod = "native";
2442
+ obj.autoUpdates = false;
2443
+ obj.autoUpdatesProtectedForNative = true;
2444
+ return { data: clone, applied: changed };
2445
+ }
2446
+ function isHostOnlyPath(cmd, hostHome) {
2447
+ if (typeof cmd !== "string" || cmd.length === 0) return false;
2448
+ if (!cmd.startsWith("/")) return false;
2449
+ const hostOnlyRoots = [
2450
+ hostHome.endsWith("/") ? hostHome : `${hostHome}/`,
2451
+ "/Applications/",
2452
+ "/opt/homebrew/",
2453
+ "/Library/",
2454
+ "/System/",
2455
+ "/private/",
2456
+ "/Users/"
2457
+ ];
2458
+ return hostOnlyRoots.some((root) => cmd.startsWith(root));
2459
+ }
2460
+ function isRecord(v) {
2461
+ return typeof v === "object" && v !== null && !Array.isArray(v);
2462
+ }
2463
+ var BOX_WORKSPACE2 = "/workspace";
2464
+ var MINIMAL_TRUSTED_CODEX_CONFIG = `[projects."${BOX_WORKSPACE2}"]
2465
+ trust_level = "trusted"
2466
+ `;
2467
+ function sanitizeCodexConfigForBox(tomlText, hostHome = homedir7()) {
2468
+ const cfg = parse(tomlText);
2469
+ let changed = false;
2470
+ if (isRecord(cfg["mcp_servers"])) {
2471
+ const servers = cfg["mcp_servers"];
2472
+ for (const [name, def] of Object.entries(servers)) {
2473
+ if (isRecord(def) && isHostOnlyPath(def["command"], hostHome)) {
2474
+ delete servers[name];
2475
+ changed = true;
2476
+ }
2477
+ }
2478
+ }
2479
+ const notify = cfg["notify"];
2480
+ if (Array.isArray(notify) && isHostOnlyPath(notify[0], hostHome)) {
2481
+ delete cfg["notify"];
2482
+ changed = true;
2483
+ }
2484
+ const droppedMarkets = /* @__PURE__ */ new Set();
2485
+ if (isRecord(cfg["marketplaces"])) {
2486
+ const markets = cfg["marketplaces"];
2487
+ for (const [name, def] of Object.entries(markets)) {
2488
+ if (isRecord(def) && def["source_type"] === "local" && isHostOnlyPath(def["source"], hostHome)) {
2489
+ delete markets[name];
2490
+ droppedMarkets.add(name);
2491
+ changed = true;
2492
+ }
2493
+ }
2494
+ }
2495
+ if (droppedMarkets.size > 0 && isRecord(cfg["plugins"])) {
2496
+ const plugins = cfg["plugins"];
2497
+ for (const key of Object.keys(plugins)) {
2498
+ const marketplace = key.split("@")[1];
2499
+ if (marketplace !== void 0 && droppedMarkets.has(marketplace)) {
2500
+ delete plugins[key];
2501
+ changed = true;
2502
+ }
2503
+ }
2504
+ }
2505
+ if (!isRecord(cfg["projects"])) cfg["projects"] = {};
2506
+ const projects = cfg["projects"];
2507
+ const wsEntry = isRecord(projects[BOX_WORKSPACE2]) ? projects[BOX_WORKSPACE2] : {};
2508
+ if (wsEntry["trust_level"] !== "trusted") {
2509
+ wsEntry["trust_level"] = "trusted";
2510
+ projects[BOX_WORKSPACE2] = wsEntry;
2511
+ changed = true;
2512
+ }
2513
+ return { text: changed ? stringify(cfg) : tomlText, changed };
2514
+ }
2515
+ var CREDENTIALS_BACKUP_FILE = resolveAgentSpec("claude").credential.hostBackup;
2516
+ var CLOUD_WORKSPACE = "/workspace";
2517
+ async function pathExists4(p) {
2518
+ try {
2519
+ await stat8(p);
2520
+ return true;
2521
+ } catch {
2522
+ return false;
2523
+ }
2524
+ }
2525
+ async function findBrokenSymlinks(root) {
2526
+ const broken = [];
2527
+ async function walk(dir) {
2528
+ let entries;
2529
+ try {
2530
+ entries = await readdir5(dir, { withFileTypes: true });
2531
+ } catch {
2532
+ return;
2533
+ }
2534
+ for (const ent of entries) {
2535
+ const full = join11(dir, ent.name);
2536
+ if (ent.isSymbolicLink()) {
2537
+ try {
2538
+ await stat8(full);
2539
+ } catch {
2540
+ broken.push(relative2(root, full));
2541
+ }
2542
+ } else if (ent.isDirectory()) {
2543
+ await walk(full);
2544
+ }
2545
+ }
2546
+ }
2547
+ await walk(root);
2548
+ return broken;
2549
+ }
2550
+ async function mkStageDir(prefix) {
2551
+ return mkdtemp4(join11(tmpdir4(), `agentbox-${prefix}-stage-`));
2552
+ }
2553
+ function emptyResult(warnings = []) {
2554
+ return { tarballPath: null, cleanup: async () => {
2555
+ }, warnings };
2556
+ }
2557
+ async function tarballFromDir(stageDir, agent) {
2558
+ const tarballPath = join11(tmpdir4(), `agentbox-${agent}-${basename3(stageDir)}.tar.gz`);
2559
+ await execa("tar", ["-czf", tarballPath, "-C", stageDir, "."], {
2560
+ env: { ...process.env, COPYFILE_DISABLE: "1" }
2561
+ });
2562
+ return tarballPath;
2563
+ }
2564
+ function makeCleanup(paths) {
2565
+ return async () => {
2566
+ for (const p of paths) {
2567
+ await rm5(p, { recursive: true, force: true });
2568
+ }
2569
+ };
2570
+ }
2571
+ async function stageSingleFileTarball(agent, sourcePath, tarballEntryName) {
2572
+ const stageDir = await mkStageDir(agent);
2573
+ let tarballPath = null;
2574
+ try {
2575
+ await copyFile2(sourcePath, join11(stageDir, tarballEntryName));
2576
+ tarballPath = await tarballFromDir(stageDir, agent);
2577
+ return {
2578
+ tarballPath,
2579
+ cleanup: makeCleanup([stageDir, tarballPath]),
2580
+ warnings: []
2581
+ };
2582
+ } catch (err) {
2583
+ await rm5(stageDir, { recursive: true, force: true });
2584
+ if (tarballPath) await rm5(tarballPath, { force: true });
2585
+ throw err;
2586
+ }
2587
+ }
2588
+ var CLAUDE_STATIC_EXCLUDES = resolveAgentSpec("claude").staticPaths[0]?.exclude ?? [];
2589
+ async function buildBoxClaudeJsonFromHost(opts) {
2590
+ const { hostHome, hostWorkspace } = opts;
2591
+ const hostClaudeJson = join11(hostHome, ".claude.json");
2592
+ let working;
2593
+ if (await pathExists4(hostClaudeJson)) {
2594
+ try {
2595
+ working = JSON.parse(await readFile7(hostClaudeJson, "utf8"));
2596
+ } catch {
2597
+ working = null;
2598
+ }
2599
+ }
2600
+ if (working === void 0 || working === null) {
2601
+ working = {
2602
+ installMethod: "native",
2603
+ autoUpdates: false,
2604
+ autoUpdatesProtectedForNative: true,
2605
+ // Pre-accept onboarding so the in-box Claude doesn't show the theme
2606
+ // picker on first run. AgentBox installing implies the user has
2607
+ // already used Claude Code on the host.
2608
+ hasCompletedOnboarding: true,
2609
+ projects: { [CLOUD_WORKSPACE]: { hasTrustDialogAccepted: true } }
2610
+ };
2611
+ } else {
2612
+ working = filterHostHooks(working, hostHome).data;
2613
+ working = setInstallMethodNative(working).data;
2614
+ if (hostWorkspace) {
2615
+ working = addProjectAlias(working, hostWorkspace, CLOUD_WORKSPACE).data;
2616
+ }
2617
+ working = trustWorkspace(working, CLOUD_WORKSPACE).data;
2618
+ if (typeof working === "object" && working !== null) {
2619
+ const w = working;
2620
+ if (w["hasCompletedOnboarding"] !== true) w["hasCompletedOnboarding"] = true;
2621
+ }
2622
+ }
2623
+ return working;
2624
+ }
2625
+ async function stageClaudeJsonOnlyForUpload(opts = {}) {
2626
+ const hostHome = opts.hostHome ?? homedir8();
2627
+ const stageDir = await mkStageDir("claude-json-only");
2628
+ let tarballPath = null;
2629
+ try {
2630
+ const claudeJson = await buildBoxClaudeJsonFromHost({
2631
+ hostHome,
2632
+ hostWorkspace: opts.hostWorkspace
2633
+ });
2634
+ await writeFile5(join11(stageDir, "_claude.json"), JSON.stringify(claudeJson, null, 2));
2635
+ tarballPath = await tarballFromDir(stageDir, "claude-json-only");
2636
+ return {
2637
+ tarballPath,
2638
+ cleanup: makeCleanup([stageDir, tarballPath]),
2639
+ warnings: []
2640
+ };
2641
+ } catch (err) {
2642
+ await rm5(stageDir, { recursive: true, force: true });
2643
+ if (tarballPath) await rm5(tarballPath, { force: true });
2644
+ throw err;
2645
+ }
2646
+ }
2647
+ async function stageClaudeStaticForUpload(opts = {}) {
2648
+ const hostHome = opts.hostHome ?? homedir8();
2649
+ const hostClaude = join11(hostHome, ".claude");
2650
+ if (!await pathExists4(hostClaude)) return emptyResult();
2651
+ const stageDir = await mkStageDir("claude-static");
2652
+ let tarballPath = null;
2653
+ try {
2654
+ const broken = await findBrokenSymlinks(hostClaude);
2655
+ const excludes = [
2656
+ ...CLAUDE_STATIC_EXCLUDES.map((p) => `--exclude=${p}`),
2657
+ ...broken.map((r) => `--exclude=/${r}`)
2658
+ ];
2659
+ await execa("rsync", [
2660
+ "-a",
2661
+ "--copy-unsafe-links",
2662
+ ...excludes,
2663
+ `${hostClaude}/`,
2664
+ `${stageDir}/`
2665
+ ]);
2666
+ const settingsPath = join11(stageDir, "settings.json");
2667
+ if (await pathExists4(settingsPath)) {
2668
+ try {
2669
+ const parsed = JSON.parse(await readFile7(settingsPath, "utf8"));
2670
+ const filtered = filterHostHooks(parsed, hostHome);
2671
+ if (filtered.removedCommands.length > 0) {
2672
+ await writeFile5(settingsPath, JSON.stringify(filtered.data, null, 2));
2673
+ }
2674
+ } catch {
2675
+ }
2676
+ }
2677
+ const claudeJson = await buildBoxClaudeJsonFromHost({
2678
+ hostHome,
2679
+ hostWorkspace: opts.hostWorkspace
2680
+ });
2681
+ await writeFile5(join11(stageDir, "_claude.json"), JSON.stringify(claudeJson, null, 2));
2682
+ const pluginsDir = join11(stageDir, "plugins");
2683
+ if (await pathExists4(pluginsDir)) {
2684
+ try {
2685
+ const entries = await readdir5(pluginsDir, { withFileTypes: true });
2686
+ for (const ent of entries) {
2687
+ if (!ent.isFile() || !ent.name.endsWith(".json")) continue;
2688
+ const file = join11(pluginsDir, ent.name);
2689
+ const raw = await readFile7(file, "utf8");
2690
+ const replaced = raw.split(`${hostHome}/.claude/plugins/`).join("/home/vscode/.claude/plugins/");
2691
+ if (replaced !== raw) await writeFile5(file, replaced);
2692
+ }
2693
+ } catch {
2694
+ }
2695
+ }
2696
+ tarballPath = await tarballFromDir(stageDir, "claude-static");
2697
+ return {
2698
+ tarballPath,
2699
+ cleanup: makeCleanup([stageDir, tarballPath]),
2700
+ warnings: []
2701
+ };
2702
+ } catch (err) {
2703
+ await rm5(stageDir, { recursive: true, force: true });
2704
+ if (tarballPath) await rm5(tarballPath, { force: true });
2705
+ throw err;
2706
+ }
2707
+ }
2708
+ async function stageClaudeCredentialsForUpload() {
2709
+ if (!await pathExists4(CREDENTIALS_BACKUP_FILE)) return emptyResult();
2710
+ return stageSingleFileTarball("claude-creds", CREDENTIALS_BACKUP_FILE, ".credentials.json");
2711
+ }
2712
+ var CODEX_STATIC_EXCLUDES = resolveAgentSpec("codex").staticPaths[0]?.exclude ?? [];
2713
+ var CODEX_KEYCHAIN_WARNING = 'codex: ~/.codex/auth.json missing. On macOS the codex CLI defaults to storing the OAuth token in the system Keychain, which isn\'t reachable from a remote sandbox. To share creds with cloud boxes either:\n - add `cli_auth_credentials_store = "file"` to ~/.codex/config.toml then re-run `codex login`, or\n - set OPENAI_API_KEY in your environment, or\n - run `codex login --with-api-key` for a file-backed login.\nSkipping codex seed; in-box codex will prompt for sign-in.';
2714
+ async function sanitizeStagedCodexConfig(configPath, hostHome) {
2715
+ try {
2716
+ if (!await pathExists4(configPath)) return;
2717
+ const { text, changed } = sanitizeCodexConfigForBox(await readFile7(configPath, "utf8"), hostHome);
2718
+ if (changed) await writeFile5(configPath, text);
2719
+ } catch {
2720
+ }
2721
+ }
2722
+ async function stageCodexStaticForUpload(opts = {}) {
2723
+ const hostHome = opts.hostHome ?? homedir8();
2724
+ const hostCodex = join11(hostHome, ".codex");
2725
+ if (!await pathExists4(hostCodex)) return emptyResult();
2726
+ const stageDir = await mkStageDir("codex-static");
2727
+ let tarballPath = null;
2728
+ try {
2729
+ const codexBroken = await findBrokenSymlinks(hostCodex);
2730
+ await execa("rsync", [
2731
+ "-a",
2732
+ "-L",
2733
+ ...codexBroken.map((r) => `--exclude=/${r}`),
2734
+ ...CODEX_STATIC_EXCLUDES.map((p) => `--exclude=${p}`),
2735
+ `${hostCodex}/`,
2736
+ `${stageDir}/`
2737
+ ]);
2738
+ await sanitizeStagedCodexConfig(join11(stageDir, "config.toml"), hostHome);
2739
+ tarballPath = await tarballFromDir(stageDir, "codex-static");
2740
+ return {
2741
+ tarballPath,
2742
+ cleanup: makeCleanup([stageDir, tarballPath]),
2743
+ warnings: []
2744
+ };
2745
+ } catch (err) {
2746
+ await rm5(stageDir, { recursive: true, force: true });
2747
+ if (tarballPath) await rm5(tarballPath, { force: true });
2748
+ throw err;
2749
+ }
2750
+ }
2751
+ async function stageAgentsStaticForUpload(opts = {}) {
2752
+ const hostHome = opts.hostHome ?? homedir8();
2753
+ const hostAgents = join11(hostHome, ".agents");
2754
+ if (!await pathExists4(hostAgents)) return emptyResult();
2755
+ const stageDir = await mkStageDir("agents-static");
2756
+ let tarballPath = null;
2757
+ try {
2758
+ const broken = await findBrokenSymlinks(hostAgents);
2759
+ await execa("rsync", [
2760
+ "-a",
2761
+ "-L",
2762
+ ...broken.map((r) => `--exclude=/${r}`),
2763
+ `${hostAgents}/`,
2764
+ `${stageDir}/`
2765
+ ]);
2766
+ tarballPath = await tarballFromDir(stageDir, "agents-static");
2767
+ return {
2768
+ tarballPath,
2769
+ cleanup: makeCleanup([stageDir, tarballPath]),
2770
+ warnings: []
2771
+ };
2772
+ } catch (err) {
2773
+ await rm5(stageDir, { recursive: true, force: true });
2774
+ if (tarballPath) await rm5(tarballPath, { force: true });
2775
+ throw err;
2776
+ }
2777
+ }
2778
+ async function stageCodexCredentialsForUpload(opts = {}) {
2779
+ const hostHome = opts.hostHome ?? homedir8();
2780
+ const cloudBackup = join11(hostHome, ".agentbox", "codex-credentials.json");
2781
+ if (await pathExists4(cloudBackup)) {
2782
+ return stageSingleFileTarball("codex-creds", cloudBackup, "auth.json");
2783
+ }
2784
+ const hostAuth = join11(hostHome, ".codex", "auth.json");
2785
+ if (!await pathExists4(hostAuth)) return emptyResult([CODEX_KEYCHAIN_WARNING]);
2786
+ return stageSingleFileTarball("codex-creds", hostAuth, "auth.json");
2787
+ }
2788
+ var OPENCODE_DATA_EXCLUDES = resolveAgentSpec("opencode").staticPaths[0]?.exclude ?? [];
2789
+ async function stageOpencodeStaticForUpload(opts = {}) {
2790
+ const hostHome = opts.hostHome ?? homedir8();
2791
+ const hostData = join11(hostHome, ".local", "share", "opencode");
2792
+ const hostConfig = join11(hostHome, ".config", "opencode");
2793
+ const hasData = await pathExists4(hostData);
2794
+ const hasConfig = await pathExists4(hostConfig);
2795
+ if (!hasData && !hasConfig) return emptyResult();
2796
+ const stageDir = await mkStageDir("opencode-static");
2797
+ let tarballPath = null;
2798
+ try {
2799
+ if (hasData) {
2800
+ const dataBroken = await findBrokenSymlinks(hostData);
2801
+ await execa("rsync", [
2802
+ "-a",
2803
+ "-L",
2804
+ ...dataBroken.map((r) => `--exclude=/${r}`),
2805
+ ...OPENCODE_DATA_EXCLUDES.map((p) => `--exclude=${p}`),
2806
+ `${hostData}/`,
2807
+ `${stageDir}/`
2808
+ ]);
2809
+ }
2810
+ if (hasConfig) {
2811
+ const configStage = join11(stageDir, "config");
2812
+ const cfgBroken = await findBrokenSymlinks(hostConfig);
2813
+ await execa("rsync", [
2814
+ "-a",
2815
+ "-L",
2816
+ ...cfgBroken.map((r) => `--exclude=/${r}`),
2817
+ `${hostConfig}/`,
2818
+ `${configStage}/`
2819
+ ]);
2820
+ }
2821
+ tarballPath = await tarballFromDir(stageDir, "opencode-static");
2822
+ return {
2823
+ tarballPath,
2824
+ cleanup: makeCleanup([stageDir, tarballPath]),
2825
+ warnings: []
2826
+ };
2827
+ } catch (err) {
2828
+ await rm5(stageDir, { recursive: true, force: true });
2829
+ if (tarballPath) await rm5(tarballPath, { force: true });
2830
+ throw err;
2831
+ }
2832
+ }
2833
+ async function stageOpencodeCredentialsForUpload(opts = {}) {
2834
+ const hostHome = opts.hostHome ?? homedir8();
2835
+ const cloudBackup = join11(hostHome, ".agentbox", "opencode-credentials.json");
2836
+ if (await pathExists4(cloudBackup)) {
2837
+ return stageSingleFileTarball("opencode-creds", cloudBackup, "auth.json");
2838
+ }
2839
+ const hostAuth = join11(hostHome, ".local", "share", "opencode", "auth.json");
2840
+ if (!await pathExists4(hostAuth)) return emptyResult();
2841
+ return stageSingleFileTarball("opencode-creds", hostAuth, "auth.json");
2842
+ }
2843
+ async function stageOpencodeStateForUpload(opts = {}) {
2844
+ const hostHome = opts.hostHome ?? homedir8();
2845
+ const hostModel = join11(hostHome, ".local", "state", "opencode", "model.json");
2846
+ if (!await pathExists4(hostModel)) return emptyResult();
2847
+ return stageSingleFileTarball("opencode-state", hostModel, "model.json");
2848
+ }
2849
+ var CLAUDE_STATIC_BOX_DIR = "/home/vscode/.claude";
2850
+ var CODEX_STATIC_BOX_DIR = "/home/vscode/.codex";
2851
+ var OPENCODE_STATIC_BOX_DIR = "/home/vscode/.local/share/opencode";
2852
+ var AGENTS_STATIC_BOX_DIR = "/home/vscode/.agents";
2853
+ async function stageAllAgentStatic(opts = {}) {
2854
+ const [claude, codex, opencode, agents] = await Promise.all([
2855
+ stageClaudeStaticForUpload({ hostWorkspace: opts.hostWorkspace }),
2856
+ stageCodexStaticForUpload(),
2857
+ stageOpencodeStaticForUpload(),
2858
+ stageAgentsStaticForUpload()
2859
+ ]);
2860
+ return [
2861
+ { kind: "claude", extractDir: CLAUDE_STATIC_BOX_DIR, staged: claude },
2862
+ { kind: "codex", extractDir: CODEX_STATIC_BOX_DIR, staged: codex },
2863
+ { kind: "opencode", extractDir: OPENCODE_STATIC_BOX_DIR, staged: opencode },
2864
+ { kind: "agents", extractDir: AGENTS_STATIC_BOX_DIR, staged: agents }
2865
+ ];
2866
+ }
2867
+ function preparedStatePathFor(provider) {
2868
+ if (!/^[A-Za-z0-9._-]+$/.test(provider)) {
2869
+ throw new Error(`invalid provider name for prepared-state: ${JSON.stringify(provider)}`);
2870
+ }
2871
+ return pathResolve(homedir9(), ".agentbox", `${provider}-prepared.json`);
2872
+ }
2873
+ function readPreparedStateRaw(provider) {
2874
+ const path = preparedStatePathFor(provider);
2875
+ if (!existsSync3(path)) return null;
2876
+ try {
2877
+ return JSON.parse(readFileSync3(path, "utf8"));
2878
+ } catch {
2879
+ return null;
2880
+ }
2881
+ }
2882
+ function writePreparedStateRaw(provider, state) {
2883
+ const path = preparedStatePathFor(provider);
2884
+ mkdirSync2(dirname6(path), { recursive: true });
2885
+ const body = JSON.stringify(state, null, 2) + "\n";
2886
+ const tmp = `${path}.tmp`;
2887
+ writeFileSync2(tmp, body, { mode: 384 });
2888
+ renameSync2(tmp, path);
2889
+ }
2890
+ async function sha256OfFile(path) {
2891
+ const buf = await readFile8(path);
2892
+ return createHash3("sha256").update(buf).digest("hex");
2893
+ }
2894
+ async function computeContextSha256(files) {
2895
+ const sorted = [...files].sort((a, b) => a.rel < b.rel ? -1 : a.rel > b.rel ? 1 : 0);
2896
+ const outer = createHash3("sha256");
2897
+ for (const f of sorted) {
2898
+ const inner = await sha256OfFile(f.abs);
2899
+ outer.update(`${f.rel}\0${inner}
2900
+ `);
2901
+ }
2902
+ return outer.digest("hex");
2903
+ }
2904
+ function claudeInstallFingerprint(baseSha, mode) {
2905
+ if (mode === "native") return baseSha;
2906
+ return createHash3("sha256").update(`${baseSha}\0claude-install=npm`).digest("hex");
2907
+ }
2908
+ function readCliStamp() {
2909
+ return {
2910
+ cliVersion: process.env.AGENTBOX_CLI_VERSION ?? "unknown",
2911
+ cliCommit: process.env.AGENTBOX_CLI_COMMIT ?? "unknown"
2912
+ };
2913
+ }
2914
+ var DOCKER_CONTEXT_FILE_MAP = {
2915
+ "Dockerfile.box": { staged: "Dockerfile.box", dev: "Dockerfile.box" },
2916
+ "ctl/bin.cjs": {
2917
+ staged: "packages/ctl/dist/bin.cjs",
2918
+ dev: "../ctl/dist/bin.cjs"
2919
+ },
2920
+ "share/agentbox-setup/SKILL.md": {
2921
+ staged: "apps/cli/share/agentbox-setup/SKILL.md",
2922
+ dev: "../../apps/cli/share/agentbox-setup/SKILL.md"
2923
+ },
2924
+ "scripts/agentbox-vnc-start": {
2925
+ staged: "packages/sandbox-docker/scripts/agentbox-vnc-start",
2926
+ dev: "scripts/agentbox-vnc-start"
2927
+ },
2928
+ "scripts/agentbox-dockerd-start": {
2929
+ staged: "packages/sandbox-docker/scripts/agentbox-dockerd-start",
2930
+ dev: "scripts/agentbox-dockerd-start"
2931
+ },
2932
+ "scripts/agentbox-checkpoint-cleanup": {
2933
+ staged: "packages/sandbox-docker/scripts/agentbox-checkpoint-cleanup",
2934
+ dev: "scripts/agentbox-checkpoint-cleanup"
2935
+ },
2936
+ "scripts/agentbox-open": {
2937
+ staged: "packages/sandbox-docker/scripts/agentbox-open",
2938
+ dev: "scripts/agentbox-open"
2939
+ },
2940
+ "scripts/custom-system-CLAUDE.md": {
2941
+ staged: "packages/sandbox-docker/scripts/custom-system-CLAUDE.md",
2942
+ dev: "scripts/custom-system-CLAUDE.md"
2943
+ },
2944
+ "scripts/claude-managed-settings.json": {
2945
+ staged: "packages/sandbox-docker/scripts/claude-managed-settings.json",
2946
+ dev: "scripts/claude-managed-settings.json"
2947
+ },
2948
+ "scripts/agentbox-codex-hooks.json": {
2949
+ staged: "packages/sandbox-docker/scripts/agentbox-codex-hooks.json",
2950
+ dev: "scripts/agentbox-codex-hooks.json"
2951
+ }
2952
+ };
2953
+ function resolveContextFilesFrom(fileMap, opts) {
2954
+ const out = [];
2955
+ for (const [rel, paths] of Object.entries(fileMap)) {
2956
+ const candidates = [
2957
+ pathResolve(opts.contextDir, paths.staged),
2958
+ pathResolve(opts.devRoot, paths.dev)
2959
+ ];
2960
+ const hit = candidates.find((p) => existsSync3(p));
2961
+ if (!hit) return null;
2962
+ out.push({ rel, abs: hit });
2963
+ }
2964
+ return out;
2965
+ }
2966
+
2967
+ // ../../packages/sandbox-docker/dist/chunk-HAYZZFAH.js
2968
+ import { dirname as dirname23, resolve as resolve22 } from "path";
2969
+ import { fileURLToPath as fileURLToPath2 } from "url";
2970
+ import { existsSync as existsSync4 } from "fs";
2971
+ import { fileURLToPath } from "url";
2972
+ import { dirname as dirname7, resolve as resolve4 } from "path";
2973
+ var DEFAULT_BOX_IMAGE = "agentbox/box:dev";
2974
+ async function resolveClaudeInstallMode() {
2975
+ try {
2976
+ const { loadEffectiveConfig } = await import("./dist-IENF7YOD.js");
2977
+ const cfg = await loadEffectiveConfig(process.cwd());
2978
+ return cfg.effective.box.claudeInstall;
2979
+ } catch {
2980
+ return "native";
2981
+ }
2982
+ }
2983
+ var BOX_IMAGE_REGISTRY = "ghcr.io/madarco/agentbox/box";
2984
+ function registryRefForSha(sha, registry = BOX_IMAGE_REGISTRY) {
2985
+ return `${registry}:sha-${sha.slice(0, 16)}`;
2986
+ }
2987
+ var here = dirname7(fileURLToPath(import.meta.url));
2988
+ function resolveDockerBuild() {
2989
+ const override = process.env.AGENTBOX_DOCKER_CONTEXT;
2990
+ if (override && existsSync4(resolve4(override, "Dockerfile.box"))) {
2991
+ return { dockerfile: resolve4(override, "Dockerfile.box"), context: override };
2992
+ }
2993
+ const staged = resolve4(here, "..", "runtime", "docker");
2994
+ if (existsSync4(resolve4(staged, "Dockerfile.box"))) {
2995
+ return { dockerfile: resolve4(staged, "Dockerfile.box"), context: staged };
2996
+ }
2997
+ const packageRoot = resolve4(here, "..");
2998
+ return {
2999
+ dockerfile: resolve4(packageRoot, "Dockerfile.box"),
3000
+ context: resolve4(packageRoot, "..", "..")
3001
+ };
3002
+ }
3003
+ var { dockerfile: DOCKERFILE_PATH_RESOLVED, context: BUILD_CONTEXT_DIR_RESOLVED } = resolveDockerBuild();
3004
+ var DOCKERFILE_PATH = DOCKERFILE_PATH_RESOLVED;
3005
+ var BUILD_CONTEXT_DIR = BUILD_CONTEXT_DIR_RESOLVED;
3006
+ async function imageExists(ref) {
3007
+ const result = await execa("docker", ["image", "inspect", ref], { reject: false });
3008
+ return result.exitCode === 0;
3009
+ }
3010
+ async function pullImage(target, opts = {}) {
3011
+ const subprocess = execa("docker", ["pull", target], {
3012
+ stderr: "pipe",
3013
+ stdout: "pipe",
3014
+ reject: false
3015
+ });
3016
+ if (opts.onProgress) {
3017
+ const forward = (chunk) => {
3018
+ const text = typeof chunk === "string" ? chunk : chunk.toString("utf8");
3019
+ for (const line of text.split(/\r?\n/)) {
3020
+ if (line.length > 0) opts.onProgress?.(line);
3021
+ }
3022
+ };
3023
+ subprocess.stdout?.on("data", forward);
3024
+ subprocess.stderr?.on("data", forward);
3025
+ }
3026
+ const result = await subprocess;
3027
+ return result.exitCode === 0;
3028
+ }
3029
+ async function tagImage(source, target) {
3030
+ await execa("docker", ["tag", source, target]);
3031
+ }
3032
+ async function imageInfo(ref = DEFAULT_BOX_IMAGE) {
3033
+ const result = await execa(
3034
+ "docker",
3035
+ ["image", "inspect", "--format", "{{.Size}}|{{.Created}}", ref],
3036
+ { reject: false }
3037
+ );
3038
+ if (result.exitCode !== 0) return { ref, exists: false };
3039
+ const [sizeStr, createdAt] = result.stdout.trim().split("|");
3040
+ const sizeBytes = sizeStr ? Number.parseInt(sizeStr, 10) : NaN;
3041
+ return {
3042
+ ref,
3043
+ exists: true,
3044
+ sizeBytes: Number.isFinite(sizeBytes) ? sizeBytes : void 0,
3045
+ createdAt: createdAt && createdAt.length > 0 ? createdAt : void 0
3046
+ };
3047
+ }
3048
+ async function buildImage(opts = {}) {
3049
+ const ref = opts.ref ?? DEFAULT_BOX_IMAGE;
3050
+ const dockerfile = opts.dockerfile ?? DOCKERFILE_PATH;
3051
+ const contextDir = opts.contextDir ?? BUILD_CONTEXT_DIR;
3052
+ const args = ["build", "-t", ref, "-f", dockerfile];
3053
+ for (const [k, v] of Object.entries(opts.buildArgs ?? {})) {
3054
+ args.push("--build-arg", `${k}=${v}`);
3055
+ }
3056
+ args.push(contextDir);
3057
+ if (process.env.AGENTBOX === "1") {
3058
+ args.splice(1, 0, "--network=host");
3059
+ }
3060
+ const subprocess = execa("docker", args, {
3061
+ stderr: "pipe",
3062
+ stdout: "pipe"
3063
+ });
3064
+ if (opts.onProgress) {
3065
+ const forward = (chunk) => {
3066
+ const text = typeof chunk === "string" ? chunk : chunk.toString("utf8");
3067
+ for (const line of text.split(/\r?\n/)) {
3068
+ if (line.length > 0) opts.onProgress?.(line);
3069
+ }
3070
+ };
3071
+ subprocess.stdout?.on("data", forward);
3072
+ subprocess.stderr?.on("data", forward);
3073
+ }
3074
+ await subprocess;
3075
+ return ref;
3076
+ }
3077
+ async function pullOrBuild(ref, fingerprint, opts = {}) {
3078
+ const { writePreparedDockerState: writePreparedDockerState2 } = await import("./prepared-state-5FIGV4BE-FIXKBF5A.js");
3079
+ const registry = opts.registry ?? BOX_IMAGE_REGISTRY;
3080
+ const allowPull = opts.allowPull !== false;
3081
+ if (allowPull && registry && fingerprint) {
3082
+ const target = registryRefForSha(fingerprint.contextSha256, registry);
3083
+ opts.onProgress?.(`[image] pulling ${target}`);
3084
+ if (await pullImage(target, { onProgress: opts.onProgress })) {
3085
+ await tagImage(target, ref);
3086
+ writePreparedDockerState2({ imageRef: ref, contextSha256: fingerprint.contextSha256 });
3087
+ opts.onProgress?.(`[image] pulled ${target} -> ${ref}`);
3088
+ return { source: "pulled" };
3089
+ }
3090
+ opts.onProgress?.(`[image] registry miss, building ${ref} locally`);
3091
+ }
3092
+ await buildImage({
3093
+ ref,
3094
+ dockerfile: opts.dockerfile,
3095
+ contextDir: opts.contextDir,
3096
+ buildArgs: opts.buildArgs,
3097
+ onProgress: opts.onProgress
3098
+ });
3099
+ if (fingerprint) {
3100
+ writePreparedDockerState2({ imageRef: ref, contextSha256: fingerprint.contextSha256 });
3101
+ }
3102
+ return { source: "built" };
3103
+ }
3104
+ async function ensureImage(ref = DEFAULT_BOX_IMAGE, opts = {}) {
3105
+ const { computeDockerContextFingerprint: computeDockerContextFingerprint2, readPreparedDockerState: readPreparedDockerState2, preparedMatches: preparedMatches2 } = await import("./prepared-state-5FIGV4BE-FIXKBF5A.js");
3106
+ const claudeInstall = opts.claudeInstall ?? await resolveClaudeInstallMode();
3107
+ const rawFingerprint = await computeDockerContextFingerprint2({
3108
+ contextDir: opts.contextDir
3109
+ });
3110
+ const fingerprint = rawFingerprint ? {
3111
+ ...rawFingerprint,
3112
+ contextSha256: claudeInstallFingerprint(rawFingerprint.contextSha256, claudeInstall)
3113
+ } : null;
3114
+ const prepared = readPreparedDockerState2();
3115
+ const exists = await imageExists(ref);
3116
+ let reason;
3117
+ if (!exists) {
3118
+ reason = `image ${ref} not present`;
3119
+ } else if (!fingerprint) {
3120
+ return { ref, built: false, reason: "image present (fingerprint skipped)" };
3121
+ } else if (!prepared) {
3122
+ reason = "no docker-prepared.json on disk";
3123
+ } else if (!preparedMatches2(prepared, fingerprint.contextSha256)) {
3124
+ reason = `build context changed (was ${prepared.base?.contextSha256?.slice(0, 12) ?? "<none>"}, now ${fingerprint.contextSha256.slice(0, 12)})`;
3125
+ }
3126
+ if (!reason) {
3127
+ return { ref, built: false, reason: "image up to date" };
3128
+ }
3129
+ opts.onProgress?.(`[image] ${ref}: ${reason}`);
3130
+ const npm = claudeInstall === "npm";
3131
+ const { source } = await pullOrBuild(ref, fingerprint, {
3132
+ onProgress: opts.onProgress,
3133
+ dockerfile: opts.dockerfile,
3134
+ contextDir: opts.contextDir,
3135
+ // The published GHCR image is native-only, so npm mode must build locally.
3136
+ allowPull: npm ? false : opts.allowPull,
3137
+ registry: opts.registry,
3138
+ buildArgs: npm ? { AGENTBOX_CLAUDE_INSTALL: "npm" } : void 0
3139
+ });
3140
+ return { ref, built: source === "built", reason };
3141
+ }
3142
+ var SCHEMA = 1;
3143
+ function resolveContextFiles(opts = {}) {
3144
+ const ctx = opts.contextDir ?? BUILD_CONTEXT_DIR;
3145
+ const here2 = dirname23(fileURLToPath2(import.meta.url));
3146
+ const packageRoot = resolve22(here2, "..");
3147
+ return resolveContextFilesFrom(DOCKER_CONTEXT_FILE_MAP, {
3148
+ contextDir: ctx,
3149
+ devRoot: packageRoot
3150
+ });
3151
+ }
3152
+ async function computeDockerContextFingerprint(opts = {}) {
3153
+ const files = resolveContextFiles(opts);
3154
+ if (!files) return null;
3155
+ return { contextSha256: await computeContextSha256(files), files };
3156
+ }
3157
+ function readPreparedDockerState() {
3158
+ const raw = readPreparedStateRaw("docker");
3159
+ if (raw === null || typeof raw !== "object") return null;
3160
+ const parsed = raw;
3161
+ if (parsed.schema !== SCHEMA) return null;
3162
+ return { schema: SCHEMA, base: parsed.base };
3163
+ }
3164
+ function writePreparedDockerState(opts) {
3165
+ const stamp = readCliStamp();
3166
+ const state = {
3167
+ schema: SCHEMA,
3168
+ base: {
3169
+ imageRef: opts.imageRef ?? DEFAULT_BOX_IMAGE,
3170
+ contextSha256: opts.contextSha256,
3171
+ cliVersion: stamp.cliVersion,
3172
+ cliCommit: stamp.cliCommit,
3173
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
3174
+ }
3175
+ };
3176
+ writePreparedStateRaw("docker", state);
3177
+ }
3178
+ function preparedMatches(state, current) {
3179
+ return state?.base?.contextSha256 === current;
3180
+ }
3181
+
3182
+ export {
3183
+ parseReplacements,
3184
+ UserFacingError,
3185
+ BoxNotFoundError,
3186
+ AmbiguousBoxError,
3187
+ generateBoxId,
3188
+ normalizeLastAgent,
3189
+ SYNC_DRYRUN_ENV,
3190
+ dryRunProviderSync,
3191
+ resolveSyncTopology,
3192
+ parseDownloadKind,
3193
+ resolveHostPath,
3194
+ realpathSafe,
3195
+ isContainedInWorkspace,
3196
+ looksLikeSecret,
3197
+ isScratchBranch,
3198
+ isSanctionedPushBranch,
3199
+ resolveRemote,
3200
+ resolveLandDest,
3201
+ landRefspec,
3202
+ upstreamRef,
3203
+ remoteTrackingRef,
3204
+ isResolvedBranch,
3205
+ sanitizeGitArgs,
3206
+ STATE_DIR,
3207
+ STATE_FILE,
3208
+ readState,
3209
+ recordBox,
3210
+ recordLastAgent,
3211
+ reserveProjectIndex,
3212
+ removeBoxRecord,
3213
+ findBox,
3214
+ allocateProjectIndex,
3215
+ autoPickProjectBox,
3216
+ resolveBoxRef,
3217
+ detectGitRepos,
3218
+ pickFreshBranch,
3219
+ GitWorktreeError,
3220
+ hostOpenCommand,
3221
+ BOX_WORKSPACE,
3222
+ boxGitCheckout,
3223
+ boxGitNewBranch,
3224
+ boxGitPush,
3225
+ boxGitPull,
3226
+ boxGitPushHost,
3227
+ boxServicesStatusRaw,
3228
+ boxRestartService,
3229
+ boxRestartServices,
3230
+ errSummary,
3231
+ secretsEnvPath,
3232
+ writeManagedSecrets,
3233
+ isSupportedApiVersion,
3234
+ pluginForProvider,
3235
+ renderCarryEntries,
3236
+ makeSyncContext,
3237
+ DEFAULT_ENV_PATTERNS,
3238
+ ENV_PRUNE_DIRS,
3239
+ buildHostEnvFindArgs,
3240
+ scanHostEnvFiles,
3241
+ pushEnvFiles,
3242
+ BOX_HOME,
3243
+ dirnameUnix,
3244
+ planCarryEntry,
3245
+ encodeClaudeProjectsKey,
3246
+ BOX_CLAUDE_PROJECT_DIR,
3247
+ resolveClaudeMemoryDir,
3248
+ findUnsyncableSymlinks,
3249
+ seedAgentsVolume,
3250
+ SEED_MARKER,
3251
+ isRealAgentCredential,
3252
+ hostClaudeBackupExpired,
3253
+ hostBackupHasCredentials,
3254
+ extractCredentials,
3255
+ resyncWorkspace,
3256
+ makeHostGitPorts,
3257
+ BOX_WORKFLOWS_DIR,
3258
+ BOX_DYNAMIC_SYNC_MANIFEST,
3259
+ BOX_MEMORY_DIR,
3260
+ buildHostSyncManifest,
3261
+ computeSyncDelta,
3262
+ stageDynamicSyncTarball,
3263
+ filterHostHooks,
3264
+ trustWorkspace,
3265
+ addProjectAlias,
3266
+ setInstallMethodNative,
3267
+ MINIMAL_TRUSTED_CODEX_CONFIG,
3268
+ sanitizeCodexConfigForBox,
3269
+ stageClaudeJsonOnlyForUpload,
3270
+ stageClaudeStaticForUpload,
3271
+ stageClaudeCredentialsForUpload,
3272
+ stageCodexStaticForUpload,
3273
+ stageAgentsStaticForUpload,
3274
+ stageCodexCredentialsForUpload,
3275
+ stageOpencodeStaticForUpload,
3276
+ stageOpencodeCredentialsForUpload,
3277
+ stageOpencodeStateForUpload,
3278
+ stageAllAgentStatic,
3279
+ preparedStatePathFor,
3280
+ readPreparedStateRaw,
3281
+ writePreparedStateRaw,
3282
+ computeContextSha256,
3283
+ claudeInstallFingerprint,
3284
+ readCliStamp,
3285
+ DOCKER_CONTEXT_FILE_MAP,
3286
+ resolveContextFilesFrom,
3287
+ DEFAULT_BOX_IMAGE,
3288
+ BOX_IMAGE_REGISTRY,
3289
+ registryRefForSha,
3290
+ DOCKERFILE_PATH,
3291
+ imageExists,
3292
+ pullImage,
3293
+ tagImage,
3294
+ imageInfo,
3295
+ pullOrBuild,
3296
+ ensureImage,
3297
+ resolveContextFiles,
3298
+ computeDockerContextFingerprint,
3299
+ readPreparedDockerState,
3300
+ writePreparedDockerState,
3301
+ preparedMatches
3302
+ };
3303
+ /*! Bundled license information:
3304
+
3305
+ smol-toml/dist/date.js:
3306
+ smol-toml/dist/error.js:
3307
+ smol-toml/dist/primitive.js:
3308
+ smol-toml/dist/util.js:
3309
+ smol-toml/dist/extract.js:
3310
+ smol-toml/dist/struct.js:
3311
+ smol-toml/dist/parse.js:
3312
+ smol-toml/dist/stringify.js:
3313
+ smol-toml/dist/index.js:
3314
+ (*!
3315
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
3316
+ * SPDX-License-Identifier: BSD-3-Clause
3317
+ *
3318
+ * Redistribution and use in source and binary forms, with or without
3319
+ * modification, are permitted provided that the following conditions are met:
3320
+ *
3321
+ * 1. Redistributions of source code must retain the above copyright notice, this
3322
+ * list of conditions and the following disclaimer.
3323
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
3324
+ * this list of conditions and the following disclaimer in the
3325
+ * documentation and/or other materials provided with the distribution.
3326
+ * 3. Neither the name of the copyright holder nor the names of its contributors
3327
+ * may be used to endorse or promote products derived from this software without
3328
+ * specific prior written permission.
3329
+ *
3330
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
3331
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
3332
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
3333
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
3334
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3335
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
3336
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
3337
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
3338
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3339
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3340
+ *)
3341
+ */