@madarco/agentbox 0.28.1 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (452) hide show
  1. package/CHANGELOG.md +124 -0
  2. package/dist/_cloud-attach-HKRHYCY7.js +30 -0
  3. package/dist/{chunk-JNC7MCWJ.js → chunk-3INUZQTR.js} +10 -10
  4. package/dist/chunk-3INUZQTR.js.map +1 -0
  5. package/dist/{chunk-4PR3KJ5X.js → chunk-6PIGTR4D.js} +20 -20
  6. package/dist/{chunk-NHVGKFVY.js → chunk-7LNXTPEE.js} +340 -22
  7. package/dist/chunk-7LNXTPEE.js.map +1 -0
  8. package/dist/{chunk-WB6S4W7O.js → chunk-7Q6BG5AN.js} +2413 -1012
  9. package/dist/chunk-7Q6BG5AN.js.map +1 -0
  10. package/dist/{chunk-BUMKBUXS.js → chunk-7QU6XENE.js} +3 -3
  11. package/dist/chunk-BWE2I5QG.js +17 -0
  12. package/dist/chunk-BWE2I5QG.js.map +1 -0
  13. package/dist/{chunk-7ABO7OIF.js → chunk-CO2I3CQI.js} +4 -4
  14. package/dist/{chunk-OUF3YTQO.js → chunk-DBXCFLAR.js} +14 -17
  15. package/dist/chunk-DBXCFLAR.js.map +1 -0
  16. package/dist/{chunk-74VIUGY6.js → chunk-DYETLPUT.js} +6 -9
  17. package/dist/chunk-DYETLPUT.js.map +1 -0
  18. package/dist/{chunk-HYXCH4GA.js → chunk-EFVTQ7YB.js} +7 -7
  19. package/dist/{chunk-46NNZMZT.js → chunk-EPFXLXCW.js} +372 -72
  20. package/dist/chunk-EPFXLXCW.js.map +1 -0
  21. package/dist/chunk-GWKGSXDC.js +71 -0
  22. package/dist/chunk-GWKGSXDC.js.map +1 -0
  23. package/dist/{chunk-CKD3PRON.js → chunk-GWYD7YBK.js} +12 -9
  24. package/dist/{chunk-CKD3PRON.js.map → chunk-GWYD7YBK.js.map} +1 -1
  25. package/dist/{chunk-NHTRTST5.js → chunk-HNWZO2XU.js} +38 -15
  26. package/dist/chunk-HNWZO2XU.js.map +1 -0
  27. package/dist/{chunk-EVT2SNF2.js → chunk-HO2ACZES.js} +3 -3
  28. package/dist/{chunk-V5NWSLWD.js → chunk-HP4L45LW.js} +14 -14
  29. package/dist/{chunk-B4DAH2F2.js → chunk-LHOKRCNF.js} +3 -3
  30. package/dist/{chunk-G3H2L3O2.js → chunk-MNDKP4VS.js} +23 -3
  31. package/dist/chunk-MNDKP4VS.js.map +1 -0
  32. package/dist/{chunk-JDSYMTMS.js → chunk-NAT2H7J4.js} +110 -66
  33. package/dist/chunk-NAT2H7J4.js.map +1 -0
  34. package/dist/{chunk-KFLGXE3R.js → chunk-NGERWFSA.js} +133 -22
  35. package/dist/chunk-NGERWFSA.js.map +1 -0
  36. package/dist/{chunk-GFOWBXV7.js → chunk-OKLEPEWZ.js} +460 -253
  37. package/dist/chunk-OKLEPEWZ.js.map +1 -0
  38. package/dist/{chunk-YI4GHC2E.js → chunk-QU5BI2HC.js} +12 -15
  39. package/dist/chunk-QU5BI2HC.js.map +1 -0
  40. package/dist/{chunk-BWM56FKY.js → chunk-RQURMAPA.js} +11 -11
  41. package/dist/{chunk-FPMRFMVK.js → chunk-RZCLRWNY.js} +9 -9
  42. package/dist/{chunk-JQLOGVZK.js → chunk-THUST2QK.js} +85 -21
  43. package/dist/chunk-THUST2QK.js.map +1 -0
  44. package/dist/{chunk-OXKW4GWD.js → chunk-UPVP6YGJ.js} +4 -70
  45. package/dist/chunk-UPVP6YGJ.js.map +1 -0
  46. package/dist/{chunk-7RSE7ESY.js → chunk-VVNXQ4XS.js} +27 -18
  47. package/dist/chunk-VVNXQ4XS.js.map +1 -0
  48. package/dist/{chunk-FGQFVUMH.js → chunk-VY54AX4T.js} +3 -3
  49. package/dist/{chunk-OUWVN2F2.js → chunk-WGNI24H2.js} +16 -13
  50. package/dist/chunk-WGNI24H2.js.map +1 -0
  51. package/dist/{chunk-PSA6GADQ.js → chunk-WHFCJBMO.js} +14 -1
  52. package/dist/chunk-WHFCJBMO.js.map +1 -0
  53. package/dist/{chunk-KJ5TCYNI.js → chunk-WHJYOO5H.js} +7 -6
  54. package/dist/chunk-WHJYOO5H.js.map +1 -0
  55. package/dist/cloud-backends.js +5 -5
  56. package/dist/{cloud-poller-SUNA6ZQC-7M5LJHHE.js → cloud-poller-QJRZXB4W-LJ2BRB3L.js} +2 -2
  57. package/dist/{control-plane-5R7PYRQ6.js → control-plane-UKKYXHIQ.js} +19 -18
  58. package/dist/cp-hub-upload-BM2OLTOS.js +81 -0
  59. package/dist/cp-hub-upload-BM2OLTOS.js.map +1 -0
  60. package/dist/{custody-client-PNCC2HBJ.js → custody-client-NPXJ46TB.js} +5 -4
  61. package/dist/{deploy-hetzner-SSGSXAKA.js → deploy-hetzner-Y3ILCDRF.js} +10 -10
  62. package/dist/{dist-RN6JOAG4.js → dist-5OGQ3CJQ.js} +81 -45
  63. package/dist/{dist-5OR4QTQW.js → dist-7B3VCLZI.js} +9 -9
  64. package/dist/{dist-EPFS5PRI.js → dist-A5ZEIVAW.js} +10 -10
  65. package/dist/{dist-6PYXFREL.js → dist-DOEGENNW.js} +61 -16
  66. package/dist/dist-DOEGENNW.js.map +1 -0
  67. package/dist/{dist-XQLKK7H3.js → dist-EOGD7KD6.js} +54 -28
  68. package/dist/dist-EOGD7KD6.js.map +1 -0
  69. package/dist/{dist-XATN4ZIR.js → dist-FBM2WS5S.js} +22 -4
  70. package/dist/{dist-POILUDVJ.js → dist-MUTFY7FA.js} +9 -9
  71. package/dist/{dist-ZNQZHTUN.js → dist-SMDXLPZO.js} +35 -6
  72. package/dist/{dist-M4O5MU5K.js → dist-VTLQKZ2E.js} +8 -8
  73. package/dist/{dist-SN2TCRZ5.js → dist-ZJIJHCZB.js} +9 -9
  74. package/dist/{dist-K5M4HKG7.js → dist-ZNYS7CVF.js} +21 -9
  75. package/dist/host-reach-drainer-ZJU2STQQ.js +9 -0
  76. package/dist/hub-Q4VOF4WN.js +37 -0
  77. package/dist/{hub-adopt-I44VGSBL.js → hub-adopt-OA336ZXZ.js} +8 -8
  78. package/dist/{hub-api-client-WJPBXZAZ.js → hub-api-client-5U6WOTZ3.js} +2 -2
  79. package/dist/{hub-docker-target-REEEWUG2.js → hub-docker-target-JKFCABK4.js} +16 -16
  80. package/dist/index.js +1321 -882
  81. package/dist/index.js.map +1 -1
  82. package/dist/prepare-GFWWKWGF.js +41 -0
  83. package/dist/prepared-custody-KU4PDVBT.js +36 -0
  84. package/dist/{prepared-state-PV3GUBHO-MF56HWMZ.js → prepared-state-LNQ7DYSU-AR5RMXAO.js} +4 -3
  85. package/dist/{publish-credentials-BPHUO5VL.js → publish-credentials-3SQXX45P.js} +11 -11
  86. package/dist/registry-AFKV3EO2.js +18 -0
  87. package/dist/relay-QH6OEY2V.js +20 -0
  88. package/dist/relay-QH6OEY2V.js.map +1 -0
  89. package/dist/{remote-docker-share-RX5ARK45.js → remote-docker-share-RMS6IB5X.js} +11 -11
  90. package/dist/remote-docker-share-RMS6IB5X.js.map +1 -0
  91. package/dist/tool-grant-push-T6DRBY3W.js +90 -0
  92. package/dist/tool-grant-push-T6DRBY3W.js.map +1 -0
  93. package/package.json +1 -2
  94. package/runtime/_shared/agentbox-tool-shim +21 -0
  95. package/runtime/_shared/ctl.cjs +6757 -5299
  96. package/runtime/_shared/gh-shim +103 -228
  97. package/runtime/digitalocean/agentbox-tool-shim +21 -0
  98. package/runtime/digitalocean/ctl.cjs +6757 -5299
  99. package/runtime/digitalocean/gh-shim +103 -228
  100. package/runtime/digitalocean/scripts/install-box.sh +9 -15
  101. package/runtime/docker/Dockerfile.box +8 -18
  102. package/runtime/docker/packages/ctl/dist/bin.cjs +6757 -5299
  103. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-tool-shim +21 -0
  104. package/runtime/docker/packages/sandbox-docker/scripts/gh-shim +103 -228
  105. package/runtime/e2b/agentbox-tool-shim +21 -0
  106. package/runtime/e2b/ctl.cjs +6757 -5299
  107. package/runtime/e2b/gh-shim +103 -228
  108. package/runtime/e2b/scripts/build-template.sh +5 -9
  109. package/runtime/hetzner/agentbox-tool-shim +21 -0
  110. package/runtime/hetzner/ctl.cjs +6757 -5299
  111. package/runtime/hetzner/gh-shim +103 -228
  112. package/runtime/hetzner/scripts/install-box.sh +9 -15
  113. package/runtime/hub/apps/hub/.next/BUILD_ID +1 -1
  114. package/runtime/hub/apps/hub/.next/app-path-routes-manifest.json +2 -0
  115. package/runtime/hub/apps/hub/.next/build-manifest.json +3 -3
  116. package/runtime/hub/apps/hub/.next/routes-manifest.json +16 -0
  117. package/runtime/hub/apps/hub/.next/server/app/(auth)/api/auth/[...all]/route.js +5 -5
  118. package/runtime/hub/apps/hub/.next/server/app/(auth)/api/auth/[...all]/route.js.nft.json +1 -1
  119. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/[id]/answer/route.js +2 -2
  120. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/[id]/answer/route.js.nft.json +1 -1
  121. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/route.js +2 -2
  122. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/route.js.nft.json +1 -1
  123. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/[action]/route.js +2 -2
  124. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/[action]/route.js.nft.json +1 -1
  125. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/agent/route.js +2 -2
  126. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/agent/route.js.nft.json +1 -1
  127. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/branches/route.js +2 -2
  128. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/branches/route.js.nft.json +1 -1
  129. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/checkpoint/route.js +2 -2
  130. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/checkpoint/route.js.nft.json +1 -1
  131. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/[op]/route.js +2 -2
  132. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/[op]/route.js.nft.json +1 -1
  133. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/route.js +2 -2
  134. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/route.js.nft.json +1 -1
  135. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/logs/route.js +1 -1
  136. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/logs/route.js.nft.json +1 -1
  137. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/open/route.js +2 -2
  138. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/open/route.js.nft.json +1 -1
  139. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/rename/route.js +2 -2
  140. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/rename/route.js.nft.json +1 -1
  141. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/route.js +2 -2
  142. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/route.js.nft.json +1 -1
  143. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/restart/route.js +2 -2
  144. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/restart/route.js.nft.json +1 -1
  145. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/route.js +2 -2
  146. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/route.js.nft.json +1 -1
  147. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/vnc/route/app-paths-manifest.json +3 -0
  148. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/vnc/route/build-manifest.json +9 -0
  149. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/vnc/route/server-reference-manifest.json +4 -0
  150. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/vnc/route.js +8 -0
  151. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/vnc/route.js.map +5 -0
  152. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/vnc/route.js.nft.json +1 -0
  153. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/vnc/route_client-reference-manifest.js +3 -0
  154. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/route.js +2 -2
  155. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/route.js.nft.json +1 -1
  156. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/checkpoints/route.js +2 -2
  157. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/checkpoints/route.js.nft.json +1 -1
  158. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/custody/[...path]/route.js +1 -1
  159. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/custody/[...path]/route.js.nft.json +1 -1
  160. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/custody/blob/[...path]/route.js +2 -2
  161. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/custody/blob/[...path]/route.js.nft.json +1 -1
  162. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/health/route.js +2 -2
  163. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/health/route.js.nft.json +1 -1
  164. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/bake/route.js +2 -2
  165. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/bake/route.js.nft.json +1 -1
  166. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/route.js +2 -2
  167. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/route.js.nft.json +1 -1
  168. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/route.js +2 -2
  169. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/route.js.nft.json +1 -1
  170. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/login-code/route.js +2 -2
  171. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/login-code/route.js.nft.json +1 -1
  172. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/logs/route.js +2 -2
  173. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/logs/route.js.nft.json +1 -1
  174. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/route.js +2 -2
  175. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/route.js.nft.json +1 -1
  176. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/route.js +2 -2
  177. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/route.js.nft.json +1 -1
  178. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/open-targets/route.js +2 -2
  179. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/open-targets/route.js.nft.json +1 -1
  180. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/branches/route.js +2 -2
  181. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/branches/route.js.nft.json +1 -1
  182. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/route.js +2 -2
  183. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/route.js.nft.json +1 -1
  184. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/seed/route.js +2 -2
  185. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/seed/route.js.nft.json +1 -1
  186. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/route.js +2 -2
  187. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/route.js.nft.json +1 -1
  188. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/credentials/route.js +2 -2
  189. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/credentials/route.js.nft.json +1 -1
  190. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/prepare/route.js +2 -2
  191. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/prepare/route.js.nft.json +1 -1
  192. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/route.js +2 -2
  193. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/route.js.nft.json +1 -1
  194. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/prune/route.js +2 -2
  195. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/prune/route.js.nft.json +1 -1
  196. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/system/route.js +2 -2
  197. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/system/route.js.nft.json +1 -1
  198. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page.js +1 -1
  199. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page.js.nft.json +1 -1
  200. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page.js +1 -1
  201. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page.js.nft.json +1 -1
  202. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page_client-reference-manifest.js +1 -1
  203. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/vnc/route/app-paths-manifest.json +3 -0
  204. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/vnc/route/build-manifest.json +9 -0
  205. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/vnc/route/server-reference-manifest.json +4 -0
  206. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/vnc/route.js +8 -0
  207. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/vnc/route.js.map +5 -0
  208. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/vnc/route.js.nft.json +1 -0
  209. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/vnc/route_client-reference-manifest.js +3 -0
  210. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/custody/page.js +1 -1
  211. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/custody/page.js.nft.json +1 -1
  212. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page.js +1 -1
  213. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page.js.nft.json +1 -1
  214. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page.js +1 -1
  215. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page.js.nft.json +1 -1
  216. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page.js +1 -1
  217. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page.js.nft.json +1 -1
  218. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page_client-reference-manifest.js +1 -1
  219. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/system/page.js +1 -1
  220. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/system/page.js.nft.json +1 -1
  221. package/runtime/hub/apps/hub/.next/server/app/[...path]/route.js +4 -4
  222. package/runtime/hub/apps/hub/.next/server/app/[...path]/route.js.nft.json +1 -1
  223. package/runtime/hub/apps/hub/.next/server/app/_global-error.html +1 -1
  224. package/runtime/hub/apps/hub/.next/server/app/_global-error.rsc +1 -1
  225. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  226. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  227. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  228. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  229. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  230. package/runtime/hub/apps/hub/.next/server/app-paths-manifest.json +2 -0
  231. package/runtime/hub/apps/hub/.next/server/chunks/044u_hub__next-internal_server_app_(dashboard)_boxes_[id]_vnc_route_actions_1cy1392.js +3 -0
  232. package/runtime/hub/apps/hub/.next/server/chunks/1jcg_server_app_(dashboard)_api_v1_boxes_[id]_vnc_route_actions_10y_e83.js +3 -0
  233. package/runtime/hub/apps/hub/.next/server/chunks/{[externals]__1nj4awx._.js → [externals]__02a249v._.js} +2 -2
  234. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__00f9v4p._.js +1 -1
  235. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__01nppdu._.js +1 -1
  236. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__02f8rwr._.js +1 -1
  237. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__068_052._.js +1 -1
  238. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__06ma5m4._.js +3 -0
  239. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__07kp2fu._.js +1 -1
  240. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__1yi-2wa._.js → [root-of-the-server]__08u01ud._.js} +3 -3
  241. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__098bkh3._.js +3 -0
  242. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__1hxo1tv._.js → [root-of-the-server]__09hbkgm._.js} +2 -2
  243. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__09tmbom._.js +3 -0
  244. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0_3m9sf._.js +1 -1
  245. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0aotdzg._.js +3 -0
  246. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0bn6-pu._.js +1 -1
  247. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0cpt9f9._.js +1 -1
  248. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0d1lmiq._.js +15 -15
  249. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0dom248._.js +1 -1
  250. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0f0bb7o._.js +1 -1
  251. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0gb04bp._.js +1 -1
  252. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0glplq7._.js +1 -1
  253. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__0xrdbh9._.js → [root-of-the-server]__0gxfyol._.js} +2 -2
  254. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0hsb2ak._.js +1 -1
  255. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0joqm8t._.js +1 -1
  256. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0jp-895._.js +1 -1
  257. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__1leda2s._.js → [root-of-the-server]__0jpqg_t._.js} +2 -2
  258. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__17bhgkz._.js → [root-of-the-server]__0lgnu00._.js} +2 -2
  259. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0lsv9-6._.js +1 -1
  260. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0pzgufc._.js +1 -1
  261. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0qfv7z6._.js +1 -1
  262. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0qlr61y._.js +1 -1
  263. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0s8srqi._.js +1 -1
  264. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0urn9j5._.js +1 -1
  265. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0vb8mk2._.js +4 -0
  266. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__17w5eaa._.js → [root-of-the-server]__0x27ifo._.js} +2 -2
  267. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0y7rvy1._.js +1 -1
  268. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0zsgjre._.js +1 -1
  269. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1-bqa8a._.js +1 -1
  270. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__11uspjg._.js +1 -1
  271. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__0zvr6ul._.js → [root-of-the-server]__15tgdh6._.js} +2 -2
  272. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__1ek7nxv._.js → [root-of-the-server]__16bz_kz._.js} +2 -2
  273. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__1w7jw4q._.js → [root-of-the-server]__18tehjj._.js} +2 -2
  274. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__1ds8g0e._.js → [root-of-the-server]__1_hzv4s._.js} +2 -2
  275. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__0cgpsh8._.js → [root-of-the-server]__1b5f5h4._.js} +2 -2
  276. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__10-aihp._.js → [root-of-the-server]__1dv80yf._.js} +2 -2
  277. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1eanlxn._.js +1 -1
  278. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__16lcb2d._.js → [root-of-the-server]__1fc-nvn._.js} +2 -2
  279. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1h4iahl._.js +1 -1
  280. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__0f-c-eh._.js → [root-of-the-server]__1j0vnh3._.js} +2 -2
  281. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1lgrtx6._.js +1 -1
  282. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__1unqgd7._.js → [root-of-the-server]__1lz7931._.js} +2 -2
  283. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__1oclxlx._.js → [root-of-the-server]__1n3u6-5._.js} +2 -2
  284. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1qky5cd._.js +1 -1
  285. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1r2quye._.js +3 -0
  286. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1rb_nc5._.js +1 -1
  287. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__0cv16py._.js → [root-of-the-server]__1spr8ss._.js} +2 -2
  288. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1t_juqb._.js +1 -1
  289. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__0t8kwy3._.js → [root-of-the-server]__1tct9rj._.js} +3 -3
  290. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__0gfa1jg._.js → [root-of-the-server]__1tjtt06._.js} +2 -2
  291. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__09cigc7._.js → [root-of-the-server]__1whjno0._.js} +2 -2
  292. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1wn4-iv._.js +3 -0
  293. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1x6zxrf._.js +1 -1
  294. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__0tyixgg._.js → [root-of-the-server]__1xfxc6i._.js} +2 -2
  295. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__1m1_gm_._.js → [root-of-the-server]__1xqcvi4._.js} +2 -2
  296. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__207d30i._.js +1 -1
  297. package/runtime/hub/apps/hub/.next/server/chunks/_07icdxf._.js +1 -1
  298. package/runtime/hub/apps/hub/.next/server/chunks/_0907rw0._.js +1 -1
  299. package/runtime/hub/apps/hub/.next/server/chunks/_0adm87k._.js +1 -1
  300. package/runtime/hub/apps/hub/.next/server/chunks/_0g01mkg._.js +1 -1
  301. package/runtime/hub/apps/hub/.next/server/chunks/_0l_klgd._.js +1 -1
  302. package/runtime/hub/apps/hub/.next/server/chunks/_0lfm81x._.js +1 -1
  303. package/runtime/hub/apps/hub/.next/server/chunks/_0tbg83f._.js +1 -1
  304. package/runtime/hub/apps/hub/.next/server/chunks/_0tms_au._.js +1 -1
  305. package/runtime/hub/apps/hub/.next/server/chunks/_0zhli27._.js +1 -1
  306. package/runtime/hub/apps/hub/.next/server/chunks/_10yfoq5._.js +1 -1
  307. package/runtime/hub/apps/hub/.next/server/chunks/_12uhpbp._.js +1 -1
  308. package/runtime/hub/apps/hub/.next/server/chunks/_17a9v8y._.js +2 -2
  309. package/runtime/hub/apps/hub/.next/server/chunks/_1c7x9ee._.js +1 -1
  310. package/runtime/hub/apps/hub/.next/server/chunks/_1n-c443._.js +1 -1
  311. package/runtime/hub/apps/hub/.next/server/chunks/_1y80vfg._.js +1 -1
  312. package/runtime/hub/apps/hub/.next/server/chunks/_214_q-1._.js +1 -1
  313. package/runtime/hub/apps/hub/.next/server/chunks/apps_hub_app_(dashboard)_api_v1_lib_openapi_ts_1yokmzt._.js +1 -1
  314. package/runtime/hub/apps/hub/.next/server/chunks/{packages_relay_dist_0eg7ay1._.js → packages_relay_dist_0p8dnf4._.js} +4 -4
  315. package/runtime/hub/apps/hub/.next/server/chunks/ssr/{[root-of-the-server]__1plrs94._.js → [root-of-the-server]__0-c5j6l._.js} +2 -2
  316. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0r2xlss._.js +1 -1
  317. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_19vy9ni._.js +2 -2
  318. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_app_(dashboard)_boxes_[id]_page_tsx_1-j_972._.js +1 -1
  319. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_app_(dashboard)_settings_page_tsx_0hv6n82._.js +1 -1
  320. package/runtime/hub/apps/hub/.next/server/chunks/ssr/{packages_relay_dist_1z9j3g0._.js → packages_relay_dist_0sap-2l._.js} +4 -4
  321. package/runtime/hub/apps/hub/.next/server/functions-config-manifest.json +3 -1
  322. package/runtime/hub/apps/hub/.next/server/middleware-build-manifest.js +3 -3
  323. package/runtime/hub/apps/hub/.next/server/middleware.js +1 -1
  324. package/runtime/hub/apps/hub/.next/server/pages/500.html +1 -1
  325. package/runtime/hub/apps/hub/.next/static/chunks/{328ny-3zs_h7m.js → 0jefm3re1-2jv.js} +1 -1
  326. package/runtime/hub/apps/hub/.next/static/chunks/{30h8mz040b5-l.js → 3u4odx1_-dy6b.js} +1 -1
  327. package/runtime/hub/apps/hub/app/(dashboard)/api/v1/boxes/[id]/vnc/route.ts +45 -0
  328. package/runtime/hub/apps/hub/app/(dashboard)/api/v1/lib/openapi.ts +45 -1
  329. package/runtime/hub/apps/hub/app/(dashboard)/api/v1/lib/validate.ts +14 -3
  330. package/runtime/hub/apps/hub/app/(dashboard)/boxes/[id]/vnc/route.ts +58 -0
  331. package/runtime/hub/apps/hub/app/(dashboard)/boxes/components/access.tsx +26 -9
  332. package/runtime/hub/apps/hub/app/(dashboard)/settings/components/provider-actions.tsx +34 -26
  333. package/runtime/hub/apps/hub/{auth-JMVHQKWY.js → auth-V7KPRWPS.js} +2 -2
  334. package/runtime/hub/apps/hub/{auth-config-5IFRWOK4.js → auth-config-B3Y3BT2I.js} +2 -2
  335. package/runtime/hub/apps/hub/{chunk-VKOCY6SX.js → chunk-3AD3MYNV.js} +49 -14
  336. package/runtime/hub/apps/hub/{chunk-KTVETF3F.js → chunk-3ZDBZYOY.js} +11 -8
  337. package/runtime/hub/apps/hub/{chunk-LPYK2354.js → chunk-5ABFGGPT.js} +339 -21
  338. package/runtime/hub/apps/hub/{chunk-UMPTTQBE.js → chunk-GBYD2ODL.js} +458 -251
  339. package/runtime/hub/apps/hub/{chunk-5TM7XXLT.js → chunk-H5SUXDZA.js} +2833 -1277
  340. package/runtime/hub/apps/hub/{chunk-QU3FFGJY.js → chunk-UQ5XNPOF.js} +11 -14
  341. package/runtime/hub/apps/hub/{chunk-3LAHFDJF.js → chunk-VWQNSZGI.js} +22 -2
  342. package/runtime/hub/apps/hub/{chunk-EZUK53CC.js → chunk-WHGY7HOC.js} +85 -21
  343. package/runtime/hub/apps/hub/{chunk-D33EV4YZ.js → chunk-ZP4RYI4U.js} +1 -1
  344. package/runtime/hub/apps/hub/{cloud-poller-SUNA6ZQC-VSKVMYHL.js → cloud-poller-QJRZXB4W-G7ECKNKQ.js} +1 -1
  345. package/runtime/hub/apps/hub/{dist-ELZHBQEM.js → dist-37EKQ6RZ.js} +11 -11
  346. package/runtime/hub/apps/hub/{dist-D265LCAN.js → dist-CGH7PEMZ.js} +21 -3
  347. package/runtime/hub/apps/hub/{dist-SYWTB6RD.js → dist-CMVSARW5.js} +15 -18
  348. package/runtime/hub/apps/hub/{dist-5HTJSOHS.js → dist-EGXZRZH2.js} +19 -7
  349. package/runtime/hub/apps/hub/{dist-YK5FFPXZ.js → dist-EOGGFZZS.js} +62 -20
  350. package/runtime/hub/apps/hub/{dist-E2FTSTCY.js → dist-LJBHOO3K.js} +34 -5
  351. package/runtime/hub/apps/hub/{dist-N3E5YAYY.js → dist-R77W6WJ5.js} +53 -26
  352. package/runtime/hub/apps/hub/{dist-JVEDVVVG.js → dist-TH2JZYZY.js} +7 -7
  353. package/runtime/hub/apps/hub/{dist-2YP57GMB.js → dist-XPRGHQH2.js} +13 -13
  354. package/runtime/hub/apps/hub/{dist-NKCXH5DW.js → dist-Z2Y5F7AF.js} +6 -6
  355. package/runtime/hub/apps/hub/docker-compose.yml +1 -0
  356. package/runtime/hub/apps/hub/{hub-token-MDOBY7MZ.js → hub-token-DDJ5Z6RS.js} +2 -2
  357. package/runtime/hub/apps/hub/{hub-worker-UFFLF37F.js → hub-worker-DXVMUQWF.js} +16 -16
  358. package/runtime/hub/apps/hub/lib/boxes/backend-types.ts +11 -0
  359. package/runtime/hub/apps/hub/lib/boxes/types.ts +43 -0
  360. package/runtime/hub/apps/hub/lib/boxes/vnc-link.ts +51 -0
  361. package/runtime/hub/apps/hub/lib/hub-backend.ts +127 -54
  362. package/runtime/hub/apps/hub/lib/hub-worker.ts +4 -4
  363. package/runtime/hub/apps/hub/lib/provider-importers.ts +66 -1
  364. package/runtime/hub/apps/hub/{prepared-state-PV3GUBHO-PPRQDYFR.js → prepared-state-LNQ7DYSU-ABC2EQVI.js} +3 -2
  365. package/runtime/hub/apps/hub/server.js +130 -72
  366. package/runtime/hub/apps/hub/server.ts +18 -0
  367. package/runtime/hub/apps/hub/test/vnc-link.test.ts +61 -0
  368. package/runtime/hub/apps/hub/tsconfig.tsbuildinfo +1 -1
  369. package/runtime/hub-deploy/docker-compose.yml +1 -0
  370. package/runtime/relay/bin.cjs +16623 -14688
  371. package/runtime/vercel/agentbox-tool-shim +21 -0
  372. package/runtime/vercel/ctl.cjs +6757 -5299
  373. package/runtime/vercel/gh-shim +103 -228
  374. package/runtime/vercel/scripts/provision.sh +5 -9
  375. package/share/host-skills/agentbox-info/SKILL.md +24 -14
  376. package/dist/_cloud-attach-Y5HIQ373.js +0 -28
  377. package/dist/chunk-46NNZMZT.js.map +0 -1
  378. package/dist/chunk-74VIUGY6.js.map +0 -1
  379. package/dist/chunk-7RSE7ESY.js.map +0 -1
  380. package/dist/chunk-G3H2L3O2.js.map +0 -1
  381. package/dist/chunk-GFOWBXV7.js.map +0 -1
  382. package/dist/chunk-JDSYMTMS.js.map +0 -1
  383. package/dist/chunk-JNC7MCWJ.js.map +0 -1
  384. package/dist/chunk-JQLOGVZK.js.map +0 -1
  385. package/dist/chunk-KFLGXE3R.js.map +0 -1
  386. package/dist/chunk-KJ5TCYNI.js.map +0 -1
  387. package/dist/chunk-NHTRTST5.js.map +0 -1
  388. package/dist/chunk-NHVGKFVY.js.map +0 -1
  389. package/dist/chunk-OUF3YTQO.js.map +0 -1
  390. package/dist/chunk-OUWVN2F2.js.map +0 -1
  391. package/dist/chunk-OXKW4GWD.js.map +0 -1
  392. package/dist/chunk-PSA6GADQ.js.map +0 -1
  393. package/dist/chunk-WB6S4W7O.js.map +0 -1
  394. package/dist/chunk-YI4GHC2E.js.map +0 -1
  395. package/dist/dist-6PYXFREL.js.map +0 -1
  396. package/dist/dist-XQLKK7H3.js.map +0 -1
  397. package/dist/hub-MJ7O4WXW.js +0 -36
  398. package/dist/prepare-V4U5HVJU.js +0 -40
  399. package/dist/prepared-custody-QIXW7MJM.js +0 -35
  400. package/dist/relay-DRDELF6B.js +0 -20
  401. package/runtime/_shared/linear-shim +0 -181
  402. package/runtime/_shared/ntn-shim +0 -95
  403. package/runtime/digitalocean/linear-shim +0 -181
  404. package/runtime/digitalocean/ntn-shim +0 -95
  405. package/runtime/docker/packages/sandbox-docker/scripts/linear-shim +0 -181
  406. package/runtime/docker/packages/sandbox-docker/scripts/ntn-shim +0 -95
  407. package/runtime/e2b/linear-shim +0 -181
  408. package/runtime/e2b/ntn-shim +0 -95
  409. package/runtime/hetzner/linear-shim +0 -181
  410. package/runtime/hetzner/ntn-shim +0 -95
  411. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__039tc0m._.js +0 -3
  412. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0c_3x8u._.js +0 -3
  413. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0ty7ew1._.js +0 -3
  414. package/runtime/vercel/linear-shim +0 -181
  415. package/runtime/vercel/ntn-shim +0 -95
  416. /package/dist/{_cloud-attach-Y5HIQ373.js.map → _cloud-attach-HKRHYCY7.js.map} +0 -0
  417. /package/dist/{chunk-4PR3KJ5X.js.map → chunk-6PIGTR4D.js.map} +0 -0
  418. /package/dist/{chunk-BUMKBUXS.js.map → chunk-7QU6XENE.js.map} +0 -0
  419. /package/dist/{chunk-7ABO7OIF.js.map → chunk-CO2I3CQI.js.map} +0 -0
  420. /package/dist/{chunk-HYXCH4GA.js.map → chunk-EFVTQ7YB.js.map} +0 -0
  421. /package/dist/{chunk-EVT2SNF2.js.map → chunk-HO2ACZES.js.map} +0 -0
  422. /package/dist/{chunk-V5NWSLWD.js.map → chunk-HP4L45LW.js.map} +0 -0
  423. /package/dist/{chunk-B4DAH2F2.js.map → chunk-LHOKRCNF.js.map} +0 -0
  424. /package/dist/{chunk-BWM56FKY.js.map → chunk-RQURMAPA.js.map} +0 -0
  425. /package/dist/{chunk-FPMRFMVK.js.map → chunk-RZCLRWNY.js.map} +0 -0
  426. /package/dist/{chunk-FGQFVUMH.js.map → chunk-VY54AX4T.js.map} +0 -0
  427. /package/dist/{cloud-poller-SUNA6ZQC-7M5LJHHE.js.map → cloud-poller-QJRZXB4W-LJ2BRB3L.js.map} +0 -0
  428. /package/dist/{control-plane-5R7PYRQ6.js.map → control-plane-UKKYXHIQ.js.map} +0 -0
  429. /package/dist/{custody-client-PNCC2HBJ.js.map → custody-client-NPXJ46TB.js.map} +0 -0
  430. /package/dist/{deploy-hetzner-SSGSXAKA.js.map → deploy-hetzner-Y3ILCDRF.js.map} +0 -0
  431. /package/dist/{dist-5OR4QTQW.js.map → dist-5OGQ3CJQ.js.map} +0 -0
  432. /package/dist/{dist-EPFS5PRI.js.map → dist-7B3VCLZI.js.map} +0 -0
  433. /package/dist/{dist-K5M4HKG7.js.map → dist-A5ZEIVAW.js.map} +0 -0
  434. /package/dist/{dist-M4O5MU5K.js.map → dist-FBM2WS5S.js.map} +0 -0
  435. /package/dist/{dist-POILUDVJ.js.map → dist-MUTFY7FA.js.map} +0 -0
  436. /package/dist/{dist-RN6JOAG4.js.map → dist-SMDXLPZO.js.map} +0 -0
  437. /package/dist/{dist-SN2TCRZ5.js.map → dist-VTLQKZ2E.js.map} +0 -0
  438. /package/dist/{dist-XATN4ZIR.js.map → dist-ZJIJHCZB.js.map} +0 -0
  439. /package/dist/{dist-ZNQZHTUN.js.map → dist-ZNYS7CVF.js.map} +0 -0
  440. /package/dist/{hub-MJ7O4WXW.js.map → host-reach-drainer-ZJU2STQQ.js.map} +0 -0
  441. /package/dist/{hub-adopt-I44VGSBL.js.map → hub-Q4VOF4WN.js.map} +0 -0
  442. /package/dist/{hub-api-client-WJPBXZAZ.js.map → hub-adopt-OA336ZXZ.js.map} +0 -0
  443. /package/dist/{prepare-V4U5HVJU.js.map → hub-api-client-5U6WOTZ3.js.map} +0 -0
  444. /package/dist/{hub-docker-target-REEEWUG2.js.map → hub-docker-target-JKFCABK4.js.map} +0 -0
  445. /package/dist/{prepared-custody-QIXW7MJM.js.map → prepare-GFWWKWGF.js.map} +0 -0
  446. /package/dist/{prepared-state-PV3GUBHO-MF56HWMZ.js.map → prepared-custody-KU4PDVBT.js.map} +0 -0
  447. /package/dist/{relay-DRDELF6B.js.map → prepared-state-LNQ7DYSU-AR5RMXAO.js.map} +0 -0
  448. /package/dist/{publish-credentials-BPHUO5VL.js.map → publish-credentials-3SQXX45P.js.map} +0 -0
  449. /package/dist/{remote-docker-share-RX5ARK45.js.map → registry-AFKV3EO2.js.map} +0 -0
  450. /package/runtime/hub/apps/hub/.next/static/{z7_2bKU93xE7GwllL1Duv → XIx10ozuCZRzwSsiCF_5t}/_buildManifest.js +0 -0
  451. /package/runtime/hub/apps/hub/.next/static/{z7_2bKU93xE7GwllL1Duv → XIx10ozuCZRzwSsiCF_5t}/_clientMiddlewareManifest.js +0 -0
  452. /package/runtime/hub/apps/hub/.next/static/{z7_2bKU93xE7GwllL1Duv → XIx10ozuCZRzwSsiCF_5t}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../packages/config/src/providers.ts","../../../packages/config/src/types.ts","../../../packages/config/src/provider-spec.ts","../../../packages/config/src/parse.ts","../../../packages/config/src/paths.ts","../../../packages/config/src/load.ts","../../../packages/config/src/image.ts","../../../packages/config/src/checkpoint.ts","../../../packages/config/src/size.ts","../../../packages/config/src/location.ts","../../../packages/config/src/daytona.ts","../../../packages/config/src/file-lock.ts","../../../packages/config/src/write.ts","../../../packages/config/src/tools.ts"],"sourcesContent":["/**\n * Single source of truth for the set of sandbox providers.\n *\n * Adding one row to `PROVIDERS` is the *only* place a new provider's identity\n * has to be registered. This table drives, by derivation:\n * - the `ProviderKind` union (below),\n * - the `box.provider` enum + its description (see `types.ts`),\n * - the per-provider `box.image<P>` / `box.size<P>` / `box.defaultCheckpoint<P>`\n * entries in `KEY_REGISTRY` (generated in `types.ts`),\n * - the CLI's known/cloud provider lists, the install-wizard picker\n * labels/hints, the wizard's rebuild-time estimate, and the doctor groups.\n *\n * The interface fields on `UserConfig`/`EffectiveConfig` and the JSON schema\n * still list the per-provider keys explicitly (static types can't be generated\n * from a runtime array); a test (`test/providers.test.ts`) fails if either\n * drifts from this table.\n */\n\n/** One credential a UI prompts for, keyed as `ProviderModule.setCredentials` expects. */\nexport interface ProviderCredentialField {\n /** Field key passed to `setCredentials` (e.g. `apiKey`, `token`, `teamId`). */\n readonly key: string;\n readonly label: string;\n readonly optional?: boolean;\n /**\n * Mask in UIs and never echo back. Defaults to true when omitted — a field is\n * a secret unless it says otherwise. DigitalOcean's `project` is the exception:\n * it lands in the `box.digitaloceanProject` config key, not `secrets.env`.\n */\n readonly secret?: boolean;\n readonly hint?: string;\n}\n\n/**\n * What a provider can do. Every flag is DECLARED, not inferred from method\n * presence: `createCloudProvider` defines `setInbound`/`repairReachability`/\n * `enableDirectGit`/`checkpoint` on every cloud provider (delegating to an\n * optional backend method at call time), so `Provider` method presence says\n * which scaffold was used, not what the provider supports. Docker is the sharp\n * case — it has no `provider.checkpoint` at all, yet `docker commit` checkpoints\n * are the oldest feature in the repo.\n *\n * `CloudBackend` methods, being written by the provider author, ARE honest —\n * `prune`, `inbound` and `timeoutModel` below must agree with `backend.list`,\n * `backend.setInbound` and `backend.timeoutModel`, and a test asserts it.\n */\nexport interface ProviderCapabilities {\n /** Checkpoint capture/restore is supported at all. */\n readonly checkpoints: boolean;\n /** Capturing a checkpoint stops and reboots the box (the capture prompt). */\n readonly checkpointReboots: boolean;\n /** Real SSH into the box: `agentbox code` (IDE) and `agentbox open` (sshfs mount). */\n readonly ssh: boolean;\n /**\n * The per-box SSH identity outlives the CLI call, so an app that connects on\n * its own later works (`open --in claude|codex`). An expiring token gateway\n * (daytona) does not qualify.\n */\n readonly persistentSsh: boolean;\n /**\n * `buildAttach` yields a plain `ssh … user@host` pointing AT the box — the only\n * shape `resolveCloudSshTarget` can parse a target out of. A provider with its\n * own `sshTarget` needs this false.\n */\n readonly directBoxSsh: boolean;\n /** Per-box inbound firewall policy (`--inbound`). Must match `!!backend.setInbound`. */\n readonly inbound: boolean;\n /** `git.pushMode=direct` can be switched on post-create (`--with-credentials`). */\n readonly directGit: boolean;\n /** Host-to-box workspace resync. */\n readonly resync: boolean;\n /** Orphan sandboxes are enumerable + deletable. Must match `!!backend.list`. */\n readonly prune: boolean;\n readonly vnc: boolean;\n /** Nested containers (in-box dockerd) work. */\n readonly dind: boolean;\n /**\n * What `pause` actually does. 'freeze' preserves the running process tree\n * (docker pause, daytona linux-vm, vercel/e2b snapshot-resume); 'stop' powers\n * the box off so only the disk survives (hetzner and digitalocean are both\n * literally `pause ≡ stop`).\n *\n * NOT a gate on offering a pause control — powering a VPS down is useful, it\n * stops billing. A UI should relabel on 'stop', never hide.\n */\n readonly pauseSemantics: 'freeze' | 'stop';\n /** Creates can be handed to a remote control box (`cloud.viaHub`). */\n readonly hubRoutable: boolean;\n /** Session-lifetime model. Must match `backend.timeoutModel`. */\n readonly timeoutModel?: 'absolute' | 'inactivity';\n}\n\n/**\n * Everything a UI or CLI can know about a provider WITHOUT loading its module.\n *\n * Built-ins declare this in the `PROVIDERS` table below. External plugins\n * declare the same shape on `ProviderModule.descriptor`, which `agentbox plugin\n * add` snapshots into `~/.agentbox/plugins.json` — so every consumer resolves a\n * descriptor synchronously and offline, whichever kind of provider it is.\n */\nexport interface ProviderDescriptor {\n /** Canonical name — MUST equal the `@agentbox/sandbox-<name>` package suffix. */\n readonly name: string;\n /** 'local' = docker; 'cloud' = has a CloudBackend + a prepared base snapshot. */\n readonly kind: 'local' | 'cloud';\n /** Human label for the install-wizard picker. */\n readonly label: string;\n /** One-line hint for the install-wizard picker. */\n readonly loginHint: string;\n readonly credentials: {\n /**\n * `secrets.env` key names whose presence means \"credentials configured\".\n * Only the NAME is ever read, never the value. Empty = none needed.\n */\n readonly envKeys: readonly string[];\n /** Fields a credential form prompts for. Empty = none needed. */\n readonly fields: readonly ProviderCredentialField[];\n };\n readonly bake: {\n /**\n * Whether a base image/snapshot must exist before the provider is usable.\n * False for docker (its base self-heals on create) and remote-docker (the\n * image builds lazily on first create). Note this is NOT `!!provider.prepare`\n * — all seven built-ins have a `prepare`.\n */\n readonly required: boolean;\n /** Rough bake time in minutes, shown by the install wizard. */\n readonly approxMinutes: string;\n /** Typical streamed create-log line count, for client progress pacing. */\n readonly createProgressSteps?: number;\n /** Typical streamed bake-log line count. Bakes are far more verbose. */\n readonly bakeProgressSteps?: number;\n };\n readonly capabilities: ProviderCapabilities;\n /** Known VM sizes. Absent = free-form string the backend interprets. */\n readonly sizes?: readonly { readonly key: string; readonly label: string }[];\n /** Known regions/datacenters. Absent = the provider has no region choice. */\n readonly regions?: readonly { readonly key: string; readonly label: string }[];\n /** Fragment describing this backend, joined into the `box.provider` enum description. */\n readonly blurb: string;\n /** Description of the per-provider `box.size<P>` KEY_REGISTRY entry. */\n readonly sizeDesc: string;\n /** Description of the per-provider `box.image<P>` KEY_REGISTRY entry. */\n readonly imageDesc: string;\n}\n\nexport const PROVIDERS = [\n {\n name: 'docker',\n kind: 'local',\n label: 'Docker (local)',\n loginHint: 'builds a ~1GB local image; no login needed',\n credentials: { envKeys: [], fields: [] },\n // The base self-heals: `ensureImage` pulls or builds on create, so a missing\n // base is a slow first create, never a blocked one.\n bake: { required: false, approxMinutes: '1', createProgressSteps: 52, bakeProgressSteps: 420 },\n capabilities: {\n // `docker commit` — the oldest checkpoint implementation in the repo. It\n // does NOT hang off `provider.checkpoint` (see the interface doc).\n checkpoints: true,\n checkpointReboots: false,\n ssh: true,\n persistentSsh: true,\n // Its localhost sshd is reached by published port, not a direct `ssh\n // user@host` attach argv.\n directBoxSsh: false,\n inbound: false,\n directGit: false,\n resync: true,\n prune: false,\n vnc: true,\n dind: true,\n pauseSemantics: 'freeze',\n // Local engine — there is no hub to route a create to.\n hubRoutable: false,\n },\n blurb: 'local Docker containers',\n sizeDesc:\n 'Per-provider override of `box.size` for docker. Reserved — docker sizing is controlled via `box.memory` / `box.cpus` / `box.disk`.',\n imageDesc:\n 'Per-provider override of `box.image` for docker (local docker image ref, e.g. `agentbox/box:dev`). Wins over the generic when set.',\n },\n {\n name: 'daytona',\n kind: 'cloud',\n label: 'Daytona (cloud sandbox)',\n loginHint: 'paste an API key from the Daytona dashboard',\n credentials: {\n envKeys: ['DAYTONA_API_KEY', 'DAYTONA_JWT_TOKEN'],\n fields: [{ key: 'apiKey', label: 'API key' }],\n },\n bake: {\n required: true,\n approxMinutes: '7',\n createProgressSteps: 1900,\n bakeProgressSteps: 1500,\n },\n capabilities: {\n checkpoints: true,\n // `sb._experimental_createSnapshot` stops the sandbox to capture it.\n checkpointReboots: true,\n ssh: true,\n // The SSH gateway is reached with an expiring token, so an app that dials\n // in on its own later (codex) finds a dead credential.\n persistentSsh: false,\n directBoxSsh: true,\n inbound: false,\n directGit: true,\n resync: true,\n prune: true,\n vnc: true,\n dind: true,\n // linux-vm `pause()` freezes CPU + memory. The `container` class has no\n // pause primitive and archives instead (filesystem only) — see backend.ts.\n pauseSemantics: 'freeze',\n hubRoutable: true,\n timeoutModel: 'inactivity',\n },\n blurb: 'Daytona Cloud sandboxes',\n sizeDesc:\n 'Per-provider override of `box.size` for daytona. `cpu-memory-disk` GB spec (e.g. `4-8-20`). Only honored on the image/Dockerfile create path; on the snapshot path the size is fixed at bake time (Daytona rejects custom resources on snapshot-resume).',\n imageDesc:\n 'Per-provider override of `box.image` for daytona (named snapshot, e.g. `agentbox-base-<fingerprint>`). Written by `agentbox prepare --provider daytona`.',\n },\n {\n name: 'hetzner',\n kind: 'cloud',\n label: 'Hetzner (cloud VPS)',\n loginHint: 'paste an API token from the Hetzner Console',\n credentials: {\n envKeys: ['HCLOUD_TOKEN'],\n fields: [{ key: 'token', label: 'API token' }],\n },\n bake: {\n required: true,\n approxMinutes: '7-10',\n createProgressSteps: 41,\n bakeProgressSteps: 900,\n },\n capabilities: {\n checkpoints: true,\n // `create_image` defaults to no-pause, matching `docker commit`.\n checkpointReboots: false,\n ssh: true,\n persistentSsh: true,\n directBoxSsh: true,\n inbound: true,\n directGit: true,\n resync: true,\n prune: true,\n vnc: true,\n dind: true,\n // \"Hetzner has no archive primitive. Pause ≡ stop.\" (backend.ts)\n pauseSemantics: 'stop',\n hubRoutable: true,\n },\n blurb: 'Hetzner Cloud VPSes',\n sizeDesc:\n 'Per-provider override of `box.size` for hetzner. Server type string (e.g. `cx23`, `cx33`, `cx43`).',\n imageDesc:\n 'Per-provider override of `box.image` for hetzner (image description, e.g. `agentbox-base-<fingerprint>`). Written by `agentbox prepare --provider hetzner`.',\n },\n {\n name: 'vercel',\n kind: 'cloud',\n label: 'Vercel (cloud microVM)',\n loginHint: 'installs the Vercel sandbox CLI, then a browser sign-in',\n credentials: {\n envKeys: ['VERCEL_TOKEN', 'VERCEL_OIDC_TOKEN', 'VERCEL_AUTH_SOURCE'],\n fields: [\n { key: 'token', label: 'Access token' },\n { key: 'teamId', label: 'Team ID', optional: true },\n { key: 'projectId', label: 'Project ID', optional: true },\n ],\n },\n bake: {\n required: true,\n approxMinutes: '5-10',\n createProgressSteps: 33,\n bakeProgressSteps: 400,\n },\n capabilities: {\n checkpoints: true,\n // `sb.snapshot()` stops the box; the live agent process doesn't survive.\n checkpointReboots: true,\n // No SSH at all — attach is a custom tmux bridge over the SDK.\n ssh: false,\n persistentSsh: false,\n directBoxSsh: false,\n inbound: false,\n directGit: true,\n resync: true,\n prune: true,\n vnc: true,\n // Nested containers verified working 2026-06-30 (`launchDockerd: true`).\n dind: true,\n pauseSemantics: 'freeze',\n hubRoutable: true,\n },\n blurb: 'Vercel Sandboxes',\n sizeDesc:\n 'Per-provider override of `box.size` for vercel. vCPU count — one of `1`, `2`, `4`, `8` (Vercel couples RAM at 2048 MB/vCPU). Default 2.',\n imageDesc:\n 'Per-provider override of `box.image` for vercel (snapshot id, e.g. `snap_…`). Written by `agentbox prepare --provider vercel`.',\n },\n {\n name: 'e2b',\n kind: 'cloud',\n label: 'E2B (cloud microVM)',\n loginHint: 'paste an API key from the E2B dashboard',\n credentials: {\n envKeys: ['E2B_API_KEY'],\n fields: [{ key: 'apiKey', label: 'API key' }],\n },\n bake: { required: true, approxMinutes: '2', createProgressSteps: 34, bakeProgressSteps: 500 },\n capabilities: {\n checkpoints: true,\n checkpointReboots: false,\n // No SSH — attach is an SDK-streaming PTY bridge.\n ssh: false,\n persistentSsh: false,\n directBoxSsh: false,\n inbound: false,\n directGit: true,\n resync: true,\n prune: true,\n vnc: true,\n // Full root + cap_sys_admin, verified 2026-06-23.\n dind: true,\n pauseSemantics: 'freeze',\n hubRoutable: true,\n timeoutModel: 'inactivity',\n },\n blurb: 'E2B microVMs',\n sizeDesc:\n 'Per-provider override of `box.size` for e2b. `cpu-memory` GB spec (e.g. `4-8`). Template-level: baked by `agentbox prepare --provider e2b --size <spec>`; E2B rejects per-create resources.',\n imageDesc:\n 'Per-provider override of `box.image` for e2b (template id or `name:tag`, e.g. `agentbox-base:latest`). Written by `agentbox prepare --provider e2b`.',\n },\n {\n name: 'digitalocean',\n kind: 'cloud',\n label: 'DigitalOcean (cloud VPS)',\n loginHint: 'paste a Personal Access Token from the DigitalOcean Console',\n credentials: {\n envKeys: ['DIGITALOCEAN_TOKEN'],\n fields: [\n { key: 'token', label: 'API token' },\n // Not a secret: the host writes it to `box.digitaloceanProject`. Blank\n // means \"leave unchanged\", never \"clear\" — clearing is a `config unset`.\n {\n key: 'project',\n label: 'Project',\n optional: true,\n secret: false,\n hint: 'blank leaves it unchanged',\n },\n ],\n },\n bake: {\n required: true,\n approxMinutes: '7-10',\n createProgressSteps: 41,\n bakeProgressSteps: 900,\n },\n capabilities: {\n checkpoints: true,\n checkpointReboots: false,\n // A VPS with a real sshd, same shape as hetzner. The pre-descriptor\n // `IDE_PROVIDERS` / `SSH_MOUNT_PROVIDERS` arrays omitted digitalocean while\n // listing it in `PROVIDERS_WITH_DIRECT_BOX_SSH` — an oversight, not a\n // limitation, so `agentbox code` / `open` start working here.\n ssh: true,\n persistentSsh: true,\n directBoxSsh: true,\n inbound: true,\n directGit: true,\n resync: true,\n prune: true,\n vnc: true,\n dind: true,\n // \"DigitalOcean has no archive primitive. Pause ≡ stop (power off).\"\n pauseSemantics: 'stop',\n hubRoutable: true,\n },\n blurb: 'DigitalOcean Droplets',\n sizeDesc:\n 'Per-provider override of `box.size` for digitalocean. Droplet size slug (e.g. `s-2vcpu-4gb`, `s-4vcpu-8gb`).',\n imageDesc:\n 'Per-provider override of `box.image` for digitalocean (numeric snapshot id). Written by `agentbox prepare --provider digitalocean`.',\n },\n {\n name: 'remote-docker',\n kind: 'cloud',\n label: 'Remote Docker (your own machine over SSH)',\n // It connects as you, over your own ~/.ssh/config — there is no credential\n // to store, so there is none to check.\n loginHint: 'point it at an SSH host you can already reach (no login needed)',\n credentials: { envKeys: [], fields: [] },\n // Usable as soon as one host alias is registered: the image builds lazily on\n // first create. Readiness is the alias count, not a base marker.\n bake: { required: false, approxMinutes: '1-3' },\n capabilities: {\n checkpoints: true,\n checkpointReboots: false,\n ssh: true,\n persistentSsh: true,\n // Reached by ProxyJump through the engine, via its own `sshTarget`.\n directBoxSsh: false,\n inbound: false,\n directGit: true,\n resync: true,\n prune: true,\n vnc: true,\n dind: true,\n pauseSemantics: 'freeze',\n // Docker on YOUR OWN machine — a control box can't reach it.\n hubRoutable: false,\n },\n blurb: 'Docker on a remote machine over SSH',\n sizeDesc:\n \"Per-provider override of `box.size` for remote-docker. `cpu-memory` GB spec (e.g. `4-8`) mapped to the container's `--cpus` / `--memory`. Empty = unlimited (the remote engine's defaults).\",\n imageDesc:\n 'Per-provider override of `box.image` for remote-docker (a docker image ref on the REMOTE engine). Normally left empty: the provider derives a fingerprint-tagged ref (`agentbox/box:<sha12>`) and ensures it on the remote itself.',\n },\n] as const satisfies readonly ProviderDescriptor[];\n\n/** Sandbox backend new boxes are created on. Derived from the `PROVIDERS` table. */\nexport type ProviderKind = (typeof PROVIDERS)[number]['name'];\n\n/** All provider names, in canonical order. */\nexport const PROVIDER_NAMES: readonly ProviderKind[] = PROVIDERS.map((p) => p.name);\n\n/** Cloud provider names only (everything except docker). */\nexport const CLOUD_PROVIDER_NAMES: readonly ProviderKind[] = PROVIDERS.filter(\n (p) => p.kind === 'cloud',\n).map((p) => p.name);\n\n/**\n * Providers whose box creates can run on a remote hub (the deployed control box):\n * the true clouds only. Excludes `docker` (local engine — no hub to route to) and\n * `remote-docker` (docker on YOUR OWN machine over SSH — the control box can't\n * reach it, and the create-via-hub path rejects it). NOT the same as\n * {@link CLOUD_PROVIDER_NAMES}, which counts `remote-docker` as cloud for the\n * git-bundle staging / SSH-sync it shares with the real clouds.\n */\nexport const HUB_ROUTABLE_PROVIDER_NAMES: readonly ProviderKind[] = PROVIDERS.filter(\n (p) => p.capabilities.hubRoutable,\n).map((p) => p.name);\n\n/** True when `name`'s creates can be handed to a remote control box. */\nexport function isHubRoutableProvider(name: string): boolean {\n return (HUB_ROUTABLE_PROVIDER_NAMES as readonly string[]).includes(name);\n}\n\nexport function isProviderKind(name: string): name is ProviderKind {\n return (PROVIDER_NAMES as readonly string[]).includes(name);\n}\n\n/**\n * The BUILT-IN descriptor for `name`. Throws on an unknown name, so it is only\n * safe behind `isProviderKind`. To resolve a descriptor for any runtime provider\n * — built-in OR registered plugin — use `resolveProviderDescriptor` from\n * `@agentbox/sandbox-core`, which falls back to the plugin registry snapshot.\n */\nexport function providerMeta(name: ProviderKind): ProviderDescriptor {\n const m = PROVIDERS.find((p) => p.name === name);\n if (!m) throw new Error(`unknown provider: ${String(name)}`);\n return m;\n}\n\n/**\n * Capitalize a provider name for its config-key suffix: `e2b` -> `E2b`,\n * `docker` -> `Docker`, `digitalocean` -> `Digitalocean`. First char upper,\n * the rest verbatim — matches the hand-written keys this table replaced.\n *\n * A hyphenated name camelizes across the hyphen (`remote-docker` ->\n * `RemoteDocker`), because `box.imageRemote-docker` is not a legal config key.\n */\nexport function providerKeyCap(name: string): string {\n return name\n .split('-')\n .filter((seg) => seg.length > 0)\n .map((seg) => seg.charAt(0).toUpperCase() + seg.slice(1))\n .join('');\n}\n\n/** Per-provider config key, e.g. `('image','hetzner')` -> `'box.imageHetzner'`. */\nexport function perProviderConfigKey(\n base: 'image' | 'size' | 'defaultCheckpoint',\n provider: string,\n): string {\n return `box.${base}${providerKeyCap(provider)}`;\n}\n","/**\n * Layered user config. The same shape is accepted at three layers:\n * - global ~/.agentbox/config.yaml\n * - project ~/.agentbox/projects/<hash>/config.yaml\n * - workspace defaults: block in ./agentbox.yaml\n *\n * Plus a CLI-flag layer at runtime. Precedence (highest wins):\n * cli > workspace > project > global > built-in defaults.\n */\n\nimport { PROVIDERS, PROVIDER_NAMES, perProviderConfigKey, type ProviderKind } from './providers.js';\n\nexport type IdeFlavor = 'vscode' | 'cursor' | 'auto';\nexport type EngineKind = 'orbstack' | 'docker-desktop' | 'other' | 'auto';\nexport type BrowserKind = 'agent-browser' | 'playwright' | 'both';\n/** Sandbox backend new boxes are created on. Defined in `providers.ts` (the single source of truth) and re-exported here for back-compat. */\nexport type { ProviderKind };\n/**\n * How the base image/snapshot installs Claude Code at bake time. `native`\n * (Anthropic's installer, the default) or `npm` (`@anthropic-ai/claude-code`) —\n * an opt-in fallback for cloud egress IPs whose CDN the native installer 403s.\n */\nexport type ClaudeInstallMethod = 'native' | 'npm';\n\n/**\n * Which terminal renderer Claude Code uses inside a box.\n *\n * Claude Code's `fullscreen` renderer (alternate screen + virtualised\n * scrollback) repaints differentially: it skips cells it believes are already\n * blank. Over a network transport that assumption breaks down and stale\n * characters are left in the blank regions, visible on scroll and cleared only\n * by a full repaint (resizing the terminal). `default` is the classic renderer\n * and does not have the problem, so boxes use it unless told otherwise.\n * `auto` leaves the choice to Claude Code.\n */\nexport type ClaudeTuiMode = 'default' | 'fullscreen' | 'auto';\n/**\n * How a box's `git push` reaches GitHub:\n * - `relay` — the box asks the host relay to push with the HOST's credentials\n * (they never enter the box). Docker boxes always use this; for a cloud box it\n * runs through the host relay's cloud poller (git-bundle pull-back).\n * - `lease` — the relay/plane leases a short-lived GitHub-App token and the box\n * pushes directly with it (keeps working with the laptop off). Needs a\n * reachable relay/plane with a GitHub App configured.\n * - `direct` — the box holds a COPY of your git credentials (token + SSH key)\n * and pushes/pulls/signs entirely on its own, so it keeps working with the\n * laptop off and needs no hub. Selected via `--with-credentials`, which copies\n * the credentials in behind a confirmation prompt. Dangerous: the credentials\n * live inside the box and in any snapshot/checkpoint of it. Cloud boxes only.\n * REFUSED when a control box is configured (`relay.controlPlaneUrl`): leasing\n * already gives the box laptop-off push without the credential copy, so the\n * copy is pure downside there. It stays available only without a control box.\n * - `auto` (default) — lease when a control plane is configured for the box\n * (`relay.controlPlaneUrl`), else relay. Today's behavior.\n * Docker boxes ignore this (always `relay` — they bind-mount the host `.git`).\n */\nexport type GitPushMode = 'auto' | 'relay' | 'lease' | 'direct';\n/**\n * Which git credential a deployed hub (control box) uses on your behalf.\n *\n * - `gh` (default) — the hub holds a GitHub token (taken from your own `gh`\n * login at `hub setup`) and does the git work itself: boxes ask it to push via\n * the relay's bundle path and never receive a credential at all. Nothing has to\n * be installed or approved on the GitHub side, so it works on repos you only\n * collaborate on and in orgs where you can't install an App.\n * - `app` — the hub holds a GitHub App private key and leases a 1-hour,\n * single-repo installation token to each box on every push. Tighter (the token\n * is narrow and short-lived) but it requires the repo OWNER to install the App,\n * which in most work orgs is an admin decision.\n *\n * This is deploy intent: it selects what `hub setup` / `hub deploy` provisions,\n * and which push mode a cloud box is given. It cannot reconfigure a hub that is\n * already running — change it there and redeploy, or set the token on the hub.\n */\nexport type HubGitAuthMode = 'gh' | 'app';\n/**\n * How this machine relates to a hub, and specifically whether the local docker\n * engine is offered here.\n *\n * - `auto` (default) — docker / remote-docker are available when there is no\n * control box, and gated OFF once one is configured (`relay.controlPlaneUrl`):\n * a docker box built on the laptop can't run with the laptop off, which is the\n * whole reason a control box exists, so the pickers, `doctor`, `prepare`,\n * `create` and `ls` stop offering it and route the fleet through the hub.\n * - `thin` — force the gated behavior even without a configured control box (for\n * a machine driven purely as a thin `/api/v1` client, e.g. via `--url`).\n * - `local` — keep docker on regardless of a control box. This is the escape\n * hatch every \"docker is hidden here\" message names.\n */\nexport type HubMode = 'auto' | 'thin' | 'local';\n/** Where `agentbox claude|codex|opencode` opens the attached session when the host\n * shell is running inside tmux, cmux, Herdr, or iTerm2. `same` keeps today's inline behavior. */\nexport type AttachOpenIn = 'split' | 'window' | 'tab' | 'same';\n/** Where a background `-i` (queued) run opens the box once the worker has created\n * it. `none` (default) opens nothing — the historical behavior. The open is\n * driven by the host relay's queue worker when the box becomes ready, not at\n * submit time, so there is no `same` (inline) mode here. */\nexport type QueueOpenIn = 'none' | 'split' | 'window' | 'tab';\n\nexport interface UserConfig {\n /**\n * Config-file shape version. Stamped to `1` on first write so future\n * migrations (e.g. a renamed key, a leaf-shape change) have a stable\n * read-time discriminator. No behavioural effect yet — placeholder for\n * later. Loader strips it before merge so it never leaks into\n * `EffectiveConfig`.\n */\n schema?: number;\n box?: {\n /**\n * Which backend new boxes go to. Always a bare provider NAME here: the\n * host-qualified `docker:<alias>` spec is an *input* form only — the parser\n * desugars it into `provider` + `remoteDockerHost` (see `desugarProviderSpec`\n * in `parse.ts`), so nothing downstream has to re-split a config value.\n */\n provider?: ProviderKind;\n hostSnapshot?: boolean;\n defaultCheckpoint?: string;\n /** Per-provider override of `defaultCheckpoint`. Resolved before falling back to the global. */\n defaultCheckpointDocker?: string;\n defaultCheckpointDaytona?: string;\n defaultCheckpointHetzner?: string;\n defaultCheckpointVercel?: string;\n defaultCheckpointE2b?: string;\n defaultCheckpointDigitalocean?: string;\n defaultCheckpointRemoteDocker?: string;\n /**\n * Generic VM-size fallback for cloud providers. Provider-interpreted:\n * Hetzner = server type string (e.g. `cx33`); Daytona = `cpu-memory-disk`\n * GB spec (e.g. `4-8-20`); Vercel = vCPU count (`1`/`2`/`4`/`8`);\n * E2B = `cpu-memory` GB spec (e.g. `4-8`), applied at `prepare` time.\n * Per-provider `size{Provider}` wins over this. Docker ignores it (it uses\n * `memory`/`cpus`/`disk`).\n */\n size?: string;\n sizeDocker?: string;\n sizeDaytona?: string;\n sizeHetzner?: string;\n sizeVercel?: string;\n sizeE2b?: string;\n sizeDigitalocean?: string;\n sizeRemoteDocker?: string;\n withPlaywright?: boolean;\n /**\n * How the base image/snapshot installs Claude Code at bake time. Bake-time\n * only (read by `agentbox prepare`, not `create`); `npm` is a fallback for\n * cloud egress IPs the native installer's CDN 403s.\n */\n claudeInstall?: ClaudeInstallMethod;\n /** Terminal renderer Claude Code uses inside the box. */\n claudeTui?: ClaudeTuiMode;\n withEnv?: boolean;\n resyncOnStart?: boolean;\n vnc?: boolean;\n autoApproveHostActions?: boolean;\n autoApproveSafeHostActions?: boolean;\n isolateClaudeConfig?: boolean;\n isolateCodexConfig?: boolean;\n isolateOpencodeConfig?: boolean;\n image?: string;\n /**\n * Per-provider override of `image`. Written by `agentbox prepare\n * --provider <name>` so a daytona prepare can't poison a hetzner create.\n * Resolved before falling back to the generic.\n */\n imageDocker?: string;\n imageDaytona?: string;\n imageHetzner?: string;\n imageVercel?: string;\n imageE2b?: string;\n imageDigitalocean?: string;\n imageRemoteDocker?: string;\n imageRegistry?: string;\n dockerCacheShared?: boolean;\n memory?: number;\n cpus?: number;\n pidsLimit?: number;\n disk?: string;\n bundleDepth?: number;\n daytonaClass?: string;\n daytonaRegion?: string;\n daytonaTimeoutMs?: number;\n daytonaVmBaseImage?: string;\n hetznerLocation?: string;\n digitaloceanRegion?: string;\n digitaloceanProject?: string;\n remoteDockerHost?: string;\n vercelTimeoutMs?: number;\n vercelNetworkPolicy?: string;\n e2bTimeoutMs?: number;\n cpMaxBytes?: number;\n credentialSync?: boolean;\n inbound?: string;\n };\n checkpoint?: {\n maxLayers?: number;\n };\n claude?: {\n sessionName?: string;\n dangerouslySkipPermissions?: boolean;\n };\n codex?: {\n sessionName?: string;\n dangerouslySkipPermissions?: boolean;\n };\n opencode?: {\n sessionName?: string;\n };\n attach?: {\n openIn?: AttachOpenIn;\n cmuxStatus?: boolean;\n herdrStatus?: boolean;\n };\n code?: {\n ide?: IdeFlavor;\n wait?: boolean;\n timeoutMs?: number;\n autoTerminals?: boolean;\n };\n shell?: {\n user?: string;\n login?: boolean;\n tmux?: boolean;\n };\n ssh?: {\n autoConfig?: boolean;\n };\n engine?: {\n kind?: EngineKind;\n };\n browser?: {\n default?: BrowserKind;\n };\n relay?: {\n port?: number;\n /**\n * Public HTTPS URL of a deployed control plane (the hosted Next.js +\n * Postgres app). When set, newly created cloud boxes point at it for their\n * centralized concerns — git-token leasing, permission state, the box\n * registry/events — and push to GitHub directly with a leased token, so\n * they keep working with the laptop off. Empty/unset = laptop-local relay\n * (the default). Set via `agentbox hub set-url`.\n */\n controlPlaneUrl?: string;\n /**\n * Per-request body cap (bytes) for custody PUTs. Defaults to 32 MiB.\n * Custody carries a project's untracked-files seed tarball, which the\n * relay's 1 MiB control-plane body cap is far too small for; this is scoped\n * to custody so every other route keeps that cap.\n *\n * Two sides enforce it independently: on a PC this governs how large a seed\n * blob the client will try to upload, while a **control box** enforces its\n * own cap from `AGENTBOX_CUSTODY_MAX_BODY_BYTES`. Raising only this one lets\n * the client offer a blob the control box then refuses — the push drops that\n * blob and continues, so raise both to actually admit a bigger seed.\n */\n custodyMaxBodyBytes?: number;\n /**\n * Cap for the streaming custody blob surface (`/admin/custody-blob/*`),\n * which carries the objects too big for the JSON API — a project's `carry:`\n * material above all. Defaults to 100 MiB to match `box.cpMaxBytes`, so an\n * entry the carry gate accepted can actually be stored.\n *\n * Same two-sided rule as `custodyMaxBodyBytes`: a control box enforces its\n * own via `AGENTBOX_CUSTODY_MAX_BLOB_BYTES`, so raise both.\n */\n custodyMaxBlobBytes?: number;\n /**\n * How long a control box waits for the user's machine to pick up a host\n * action that only that machine can run (`cp` between box and host), before\n * it treats the machine as offline. Also the silence after which a machine\n * that took an action is presumed gone, so the box is never left hanging.\n */\n hostReachTimeoutMs?: number;\n };\n git?: {\n pushMode?: GitPushMode;\n };\n hub?: {\n gitAuth?: HubGitAuthMode;\n mode?: HubMode;\n };\n vnc?: {\n containerPort?: number;\n };\n portless?: {\n enabled?: boolean;\n stateDir?: string;\n };\n autopause?: {\n enabled?: boolean;\n maxRunningBoxes?: number;\n idleMinutes?: number;\n };\n queue?: {\n enabled?: boolean;\n maxConcurrent?: number;\n maxWorking?: number;\n idleGraceSeconds?: number;\n openIn?: QueueOpenIn;\n };\n cloud?: {\n useCurrentBranch?: boolean;\n viaHub?: boolean;\n };\n maintenance?: {\n pruneProjectConfigs?: boolean;\n pruneProjectConfigsEvery?: number;\n };\n update?: {\n /**\n * Daily background check for a newer published CLI (npm registry) and\n * tray app (release sha sidecar), plus the \"newer version available\"\n * nudge it feeds. At most one network probe per 24h; `false` disables\n * both the probe and the nudge.\n */\n check?: boolean;\n /**\n * Release channel. `auto` (default) follows the installed build — a\n * `-nightly.` version means nightly. `nightly` pins membership so it\n * survives a stable version being installed from the nightly channel;\n * `stable` is the opt-out. See docs/nightly-channel-plan.md.\n */\n channel?: 'auto' | 'stable' | 'nightly';\n };\n tools?: {\n gh?: {\n enabled?: boolean;\n };\n request?: {\n enabled?: boolean;\n };\n };\n}\n\n/**\n * Required-everywhere variant returned as the merged effective config. Each\n * leaf is filled from BUILT_IN_DEFAULTS when no layer set it.\n *\n * `box.hostSnapshot` and `portless.enabled` are intentionally\n * `boolean | undefined` (unprompted): the default is \"ask the user\", expressed\n * as undefined.\n */\nexport interface EffectiveConfig {\n box: {\n /** A bare provider name — a `docker:<alias>` input is already split (see `UserConfig`). */\n provider: ProviderKind;\n hostSnapshot: boolean | undefined;\n defaultCheckpoint: string;\n defaultCheckpointDocker: string;\n defaultCheckpointDaytona: string;\n defaultCheckpointHetzner: string;\n defaultCheckpointVercel: string;\n defaultCheckpointE2b: string;\n defaultCheckpointDigitalocean: string;\n defaultCheckpointRemoteDocker: string;\n size: string;\n sizeDocker: string;\n sizeDaytona: string;\n sizeHetzner: string;\n sizeVercel: string;\n sizeE2b: string;\n sizeDigitalocean: string;\n sizeRemoteDocker: string;\n withPlaywright: boolean;\n claudeInstall: ClaudeInstallMethod;\n claudeTui: ClaudeTuiMode;\n withEnv: boolean;\n resyncOnStart: boolean;\n vnc: boolean;\n autoApproveHostActions: boolean;\n autoApproveSafeHostActions: boolean;\n isolateClaudeConfig: boolean;\n isolateCodexConfig: boolean;\n isolateOpencodeConfig: boolean;\n image: string;\n imageDocker: string;\n imageDaytona: string;\n imageHetzner: string;\n imageVercel: string;\n imageE2b: string;\n imageDigitalocean: string;\n imageRemoteDocker: string;\n imageRegistry: string;\n dockerCacheShared: boolean;\n memory: number;\n cpus: number;\n pidsLimit: number;\n disk: string;\n bundleDepth: number | undefined;\n daytonaClass: string;\n daytonaRegion: string;\n daytonaTimeoutMs: number;\n daytonaVmBaseImage: string;\n hetznerLocation: string;\n digitaloceanRegion: string;\n digitaloceanProject: string;\n remoteDockerHost: string;\n vercelTimeoutMs: number;\n vercelNetworkPolicy: string;\n e2bTimeoutMs: number;\n cpMaxBytes: number;\n credentialSync: boolean;\n inbound: string;\n };\n checkpoint: {\n maxLayers: number;\n };\n claude: {\n sessionName: string;\n dangerouslySkipPermissions: boolean;\n };\n codex: {\n sessionName: string;\n dangerouslySkipPermissions: boolean;\n };\n opencode: {\n sessionName: string;\n };\n attach: {\n openIn: AttachOpenIn;\n cmuxStatus: boolean;\n herdrStatus: boolean;\n };\n code: {\n ide: IdeFlavor;\n wait: boolean;\n timeoutMs: number;\n autoTerminals: boolean;\n };\n shell: {\n user: string;\n login: boolean;\n tmux: boolean;\n };\n ssh: {\n autoConfig: boolean;\n };\n engine: {\n kind: EngineKind;\n };\n browser: {\n default: BrowserKind;\n };\n relay: {\n port: number;\n controlPlaneUrl: string | undefined;\n custodyMaxBodyBytes: number;\n custodyMaxBlobBytes: number;\n hostReachTimeoutMs: number;\n };\n git: {\n pushMode: GitPushMode;\n };\n hub: {\n gitAuth: HubGitAuthMode;\n mode: HubMode;\n };\n vnc: {\n containerPort: number;\n };\n portless: {\n enabled: boolean | undefined;\n stateDir: string;\n };\n autopause: {\n enabled: boolean;\n maxRunningBoxes: number;\n idleMinutes: number;\n };\n queue: {\n enabled: boolean;\n maxConcurrent: number;\n maxWorking: number;\n idleGraceSeconds: number;\n openIn: QueueOpenIn;\n };\n cloud: {\n useCurrentBranch: boolean;\n viaHub: boolean;\n };\n maintenance: {\n pruneProjectConfigs: boolean;\n pruneProjectConfigsEvery: number;\n };\n update: {\n check: boolean;\n channel: 'auto' | 'stable' | 'nightly';\n };\n tools: {\n gh: {\n enabled: boolean;\n };\n request: {\n enabled: boolean;\n };\n };\n}\n\nexport type ConfigSource = 'cli' | 'workspace' | 'project' | 'global' | 'default';\n\nexport interface ConfigLayer {\n source: ConfigSource;\n /** File path the layer was loaded from. Absent for `cli` and `default`. */\n path?: string;\n values: Partial<UserConfig>;\n}\n\nexport interface LoadedConfig {\n effective: EffectiveConfig;\n layers: {\n cli: { values: Partial<UserConfig> };\n workspace: { path: string | null; values: Partial<UserConfig> };\n project: { path: string; values: Partial<UserConfig> };\n global: { path: string; values: Partial<UserConfig> };\n defaults: EffectiveConfig;\n };\n /** Per-leaf source map: 'box.hostSnapshot' -> 'workspace'. Powers `config get --all`. */\n sources: Record<string, ConfigSource>;\n /** Resolved project root used for the project layer (cwd if no agentbox.yaml found). */\n projectRoot: string;\n projectHash: string;\n /** True if we walked up to an agentbox.yaml; false if we fell back to cwd. */\n hasAgentboxYaml: boolean;\n /**\n * Non-fatal issues found while parsing the layers — today, unknown keys\n * (skipped, not applied). Empty on a clean load. `agentbox doctor` lists\n * these; the CLI also prints them via the warning sink (see `setConfigWarningSink`).\n */\n warnings: string[];\n}\n\nexport const BUILT_IN_DEFAULTS: EffectiveConfig = {\n box: {\n provider: 'docker',\n hostSnapshot: undefined,\n defaultCheckpoint: '',\n defaultCheckpointDocker: '',\n defaultCheckpointDaytona: '',\n defaultCheckpointHetzner: '',\n defaultCheckpointVercel: '',\n defaultCheckpointE2b: '',\n defaultCheckpointDigitalocean: '',\n defaultCheckpointRemoteDocker: '',\n size: '',\n sizeDocker: '',\n sizeDaytona: '',\n sizeHetzner: '',\n sizeVercel: '',\n sizeE2b: '',\n sizeDigitalocean: '',\n sizeRemoteDocker: '',\n withPlaywright: false,\n claudeInstall: 'native',\n claudeTui: 'default',\n withEnv: false,\n resyncOnStart: true,\n vnc: true,\n autoApproveHostActions: false,\n autoApproveSafeHostActions: true,\n isolateClaudeConfig: false,\n isolateCodexConfig: false,\n isolateOpencodeConfig: false,\n image: 'agentbox/box:dev',\n imageDocker: '',\n imageDaytona: '',\n imageHetzner: '',\n imageVercel: '',\n imageE2b: '',\n imageDigitalocean: '',\n // Empty = the provider derives the fingerprint-tagged ref itself and ensures\n // it on the remote engine; set only to pin a hand-built image there.\n imageRemoteDocker: '',\n // Mirrors BOX_IMAGE_REGISTRY in @agentbox/sandbox-docker. Empty disables the\n // registry pull (always build the docker base image locally).\n imageRegistry: 'ghcr.io/madarco/agentbox/box',\n dockerCacheShared: false,\n memory: 0,\n cpus: 0,\n pidsLimit: 0,\n disk: '',\n bundleDepth: undefined,\n daytonaClass: 'linux-vm',\n // Empty = derive from the class: linux-vm implies us-east-1 (the only\n // region with VM runners), container keeps Daytona's own default.\n daytonaRegion: '',\n daytonaTimeoutMs: 1_500_000,\n // Empty = the fingerprint-tagged image CI publishes to GHCR.\n daytonaVmBaseImage: '',\n hetznerLocation: 'nbg1',\n digitaloceanRegion: 'nyc3',\n // Empty = leave boxes in the account's default project (DigitalOcean's own\n // behavior). There is no sane default id to pick — it differs per account.\n digitaloceanProject: '',\n // Empty = no default remote engine; `--provider remote-docker` then errors\n // unless the SSH destination came from `docker:<host>` / `--remote-host`.\n remoteDockerHost: '',\n vercelTimeoutMs: 2_700_000,\n vercelNetworkPolicy: '',\n e2bTimeoutMs: 2_700_000,\n cpMaxBytes: 100 * 1024 * 1024,\n credentialSync: true,\n inbound: 'locked',\n },\n checkpoint: {\n maxLayers: 3,\n },\n claude: {\n sessionName: 'claude',\n dangerouslySkipPermissions: true,\n },\n codex: {\n sessionName: 'codex',\n dangerouslySkipPermissions: true,\n },\n opencode: {\n sessionName: 'opencode',\n },\n attach: {\n openIn: 'split',\n cmuxStatus: true,\n herdrStatus: true,\n },\n code: {\n ide: 'auto',\n wait: true,\n timeoutMs: 120_000,\n autoTerminals: true,\n },\n shell: {\n user: 'vscode',\n login: true,\n tmux: true,\n },\n ssh: {\n autoConfig: true,\n },\n engine: {\n kind: 'auto',\n },\n browser: {\n default: 'agent-browser',\n },\n relay: {\n port: 8787,\n controlPlaneUrl: undefined,\n custodyMaxBodyBytes: 32 * 1024 * 1024,\n custodyMaxBlobBytes: 100 * 1024 * 1024,\n hostReachTimeoutMs: 60_000,\n },\n git: {\n pushMode: 'auto',\n },\n hub: {\n gitAuth: 'gh',\n mode: 'auto',\n },\n vnc: {\n containerPort: 6080,\n },\n portless: {\n enabled: undefined,\n stateDir: '',\n },\n autopause: {\n enabled: true,\n maxRunningBoxes: 5,\n idleMinutes: 5,\n },\n queue: {\n enabled: true,\n maxConcurrent: 5,\n maxWorking: 0,\n idleGraceSeconds: 15,\n openIn: 'none',\n },\n cloud: {\n useCurrentBranch: false,\n viaHub: true,\n },\n maintenance: {\n pruneProjectConfigs: true,\n pruneProjectConfigsEvery: 50,\n },\n update: {\n check: true,\n channel: 'auto',\n },\n tools: {\n gh: { enabled: true },\n request: { enabled: true },\n },\n};\n\nexport type KeyType = 'bool' | 'string' | 'int' | 'enum';\n\nexport interface KeyDescriptor {\n /** Dot-path, e.g. \"box.snapshot\". */\n key: string;\n type: KeyType;\n enumValues?: readonly string[];\n description: string;\n /** True for keys most users shouldn't touch (image, ports). Hidden from `list` by default. */\n advanced?: boolean;\n /**\n * `enum` only: also accept a host-qualified provider spec (`docker:<alias>`).\n * `box.provider` is an enum of provider NAMES, but `docker:<host>` names an\n * engine and resolves to the same remote-docker provider — and it is what a\n * control box's own engine is spelled as, so it has to be settable as a\n * default. The membership check stays exact for everything else.\n */\n allowProviderSpec?: boolean;\n}\n\n/** Join blurbs into \"a, b, c, or d\" for the enum description. */\nfunction joinOr(items: readonly string[]): string {\n if (items.length <= 1) return items.join('');\n return `${items.slice(0, -1).join(', ')}, or ${items[items.length - 1]}`;\n}\n\n/**\n * Per-provider config-key descriptors generated from the `PROVIDERS` table so a\n * new provider gets its `box.defaultCheckpoint<P>` / `box.size<P>` /\n * `box.image<P>` entries automatically. The `size`/`image` descriptions come\n * from the table (they carry provider-specific detail); the checkpoint one is\n * uniform.\n */\nfunction perProviderCheckpointKeys(): KeyDescriptor[] {\n return PROVIDERS.map((p) => ({\n key: perProviderConfigKey('defaultCheckpoint', p.name),\n type: 'string',\n description: `Per-provider override of \\`box.defaultCheckpoint\\` for ${p.name}. Wins over the global when set; set via \\`agentbox checkpoint set-default --provider ${p.name}\\`.`,\n advanced: true,\n }));\n}\nfunction perProviderSizeKeys(): KeyDescriptor[] {\n return PROVIDERS.map((p) => ({\n key: perProviderConfigKey('size', p.name),\n type: 'string',\n description: p.sizeDesc,\n advanced: true,\n }));\n}\nfunction perProviderImageKeys(): KeyDescriptor[] {\n return PROVIDERS.map((p) => ({\n key: perProviderConfigKey('image', p.name),\n type: 'string',\n description: p.imageDesc,\n advanced: true,\n }));\n}\n\n/**\n * Single source of truth for which keys are addressable from the CLI. The\n * parser, `set`/`unset`, and `list` all walk this. Adding a key here is the\n * one place a new field has to be registered (plus the type interface above\n * and the JSON schema). Per-provider `box.{image,size,defaultCheckpoint}<P>`\n * keys are generated from the `PROVIDERS` table (see `providers.ts`).\n */\nexport const KEY_REGISTRY: readonly KeyDescriptor[] = [\n {\n key: 'box.provider',\n type: 'enum',\n enumValues: PROVIDER_NAMES,\n allowProviderSpec: true,\n description:\n `Sandbox backend new boxes are created on: ${joinOr(PROVIDERS.map((p) => p.blurb))}. ` +\n 'Also accepts a host-qualified `docker:<alias>` spec naming a registered remote-docker engine (e.g. `docker:hub` for your control box).',\n },\n {\n key: 'box.hostSnapshot',\n type: 'bool',\n description:\n 'Use a frozen APFS clone of the host workspace as the overlay lower (default: prompt). Was box.snapshot.',\n },\n {\n key: 'box.defaultCheckpoint',\n type: 'string',\n description:\n 'Checkpoint ref new boxes in this project start from when --snapshot is not given (set via `agentbox checkpoint set-default`). Used as fallback when no per-provider override is set.',\n },\n ...perProviderCheckpointKeys(),\n {\n key: 'box.size',\n type: 'string',\n description:\n 'Default VM size for cloud providers. Provider-interpreted: hetzner = server type (e.g. `cx33`); daytona = `cpu-memory-disk` GB (e.g. `4-8-20`); vercel = vCPU count (1, 2, 4, 8); e2b = `cpu-memory` GB (e.g. `4-8`). Used as fallback when no per-provider override is set. Docker ignores it.',\n },\n ...perProviderSizeKeys(),\n {\n key: 'checkpoint.maxLayers',\n type: 'int',\n description:\n 'Max stacked checkpoint layers before a new checkpoint is materialized merged (flattened) instead of layered.',\n advanced: true,\n },\n {\n key: 'box.withPlaywright',\n type: 'bool',\n description: 'Install @playwright/cli@latest in the box at create time.',\n },\n {\n key: 'box.claudeInstall',\n type: 'enum',\n enumValues: ['native', 'npm'] as const,\n description:\n \"How `agentbox prepare` installs Claude Code into the base image/snapshot: `native` (Anthropic's installer, the default) or `npm` (@anthropic-ai/claude-code). A fallback for cloud egress IPs the native installer's CDN 403s. Bake-time only — change it, then re-run `agentbox prepare --provider <name>`.\",\n },\n {\n key: 'box.claudeTui',\n type: 'enum',\n enumValues: ['default', 'fullscreen', 'auto'] as const,\n description:\n \"Terminal renderer Claude Code uses inside a box: `default` (the classic renderer, the AgentBox default), `fullscreen` (Claude's alternate-screen renderer), or `auto` (let Claude decide). Boxes default to `default` because the fullscreen renderer's differential repaint leaves stale characters behind over a network transport — visible while scrolling, and cleared only by resizing the terminal. Applied via /etc/agentbox/box.env, so it takes effect on the next box start.\",\n },\n {\n key: 'box.withEnv',\n type: 'bool',\n description:\n 'Copy host env/config files (.env*, secrets.toml, agentbox.yaml, ...) into /workspace at box create time (gitignore-bypassing).',\n },\n {\n key: 'box.resyncOnStart',\n type: 'bool',\n description:\n \"Merge the host's current branch into the box and overlay the host's uncommitted/untracked changes when starting an agent session (keeps the box's version on conflict and warns the agent).\",\n },\n {\n key: 'box.vnc',\n type: 'bool',\n description: 'Run the per-box Xvnc + noVNC stack.',\n },\n {\n key: 'box.autoApproveHostActions',\n type: 'bool',\n description:\n 'Auto-approve host-action confirmations (git push, cp host<->box, gh PR writes, checkpoint) for this box without an interactive prompt. Off by default; intended for unattended orchestration of trusted boxes. Each auto-approval is recorded as a relay event (visible in `agentbox agent` / the dashboard).',\n },\n {\n key: 'box.autoApproveSafeHostActions',\n type: 'bool',\n description:\n \"Auto-approve the SAFE subset of host actions without a prompt: opening a PR, PR/review comments, re-running CI, pushing to the box's scratch or host-sanctioned branch, checkpoints, calls to a granted host tool, and file copy/download that stays inside the box project folder (non-secret). Uncontained or secret file transfers, non-sanctioned-branch pushes, and PR merge/checkout still prompt. On by default; set false to prompt for every host action (the pre-relax behavior). Superseded by box.autoApproveHostActions, which approves everything. Each auto-approval is recorded as a relay event.\",\n },\n {\n key: 'box.isolateClaudeConfig',\n type: 'bool',\n description: 'Use a per-box ~/.claude volume instead of the shared one.',\n },\n {\n key: 'box.isolateCodexConfig',\n type: 'bool',\n description: 'Use a per-box ~/.codex volume instead of the shared one.',\n },\n {\n key: 'box.isolateOpencodeConfig',\n type: 'bool',\n description: 'Use a per-box OpenCode config/data volume instead of the shared one.',\n },\n {\n key: 'box.image',\n type: 'string',\n description:\n 'Generic box image ref (fallback). Used as fallback when no per-provider override is set; the default `agentbox/box:dev` is treated as a sentinel by cloud backends (boot from their prepared base snapshot instead).',\n advanced: true,\n },\n ...perProviderImageKeys(),\n {\n key: 'box.imageRegistry',\n type: 'string',\n description:\n 'Registry repo to pull the prebuilt docker base image from before building locally. Empty = always build. Docker only (advanced).',\n advanced: true,\n },\n {\n key: 'box.dockerCacheShared',\n type: 'bool',\n description:\n \"Share the in-box docker image cache across boxes via the 'agentbox-docker-cache' volume (preserved on destroy/prune; only one box can run at a time when set).\",\n },\n {\n key: 'box.memory',\n type: 'int',\n description:\n 'Hard memory ceiling in MiB for new boxes (0 = unlimited). Use --memory on create/claude for byte/k/m/g strings.',\n },\n {\n key: 'box.cpus',\n type: 'int',\n description:\n 'CPU count cap for new boxes (0 = unlimited). Whole cores via config; use --cpus for fractional (e.g. 1.5).',\n },\n {\n key: 'box.pidsLimit',\n type: 'int',\n description: 'Max process count (PIDs cgroup) for new boxes (0 = unlimited).',\n },\n {\n key: 'box.disk',\n type: 'string',\n description:\n \"Best-effort writable-layer size for new boxes, e.g. '10G'. No-op on overlay2 / the macOS engines.\",\n advanced: true,\n },\n {\n key: 'box.bundleDepth',\n type: 'int',\n description:\n 'Cap git bundle history shipped to cloud sandboxes (daytona, hetzner). 0 = full history. Unset = adaptive default (last 200 commits; re-bundle at 100 if the bundle exceeds 20 MB). Ignored for docker (which bind-mounts .git/).',\n },\n {\n key: 'box.daytonaClass',\n type: 'string',\n description:\n 'Daytona sandbox class for new --provider daytona boxes: `linux-vm` (default) or `container`. `linux-vm` gives real pause/resume (CPU + memory frozen, running processes survive) and a much faster base bake, but runs only in `us-east-1` — the sole region with VM runners. Choose `container` to stay in a shared region (e.g. `eu`). Changing this needs a re-bake: `agentbox prepare --provider daytona --force`. Daytona-only.',\n },\n {\n key: 'box.daytonaRegion',\n type: 'string',\n description:\n 'Daytona region new --provider daytona boxes are created in (e.g. `us`, `eu`, `us-east-1`). Empty (the default) derives it from `box.daytonaClass`: `linux-vm` implies `us-east-1`, `container` uses the account default. Only `us-east-1` has linux-vm runners, so pairing `linux-vm` with another region fails at create. Daytona-only.',\n },\n {\n key: 'box.daytonaTimeoutMs',\n type: 'int',\n description:\n 'Idle timeout (ms) a new --provider daytona box is created with, after which Daytona auto-stops it. The host keepalive loop pushes this forward while the agent is working, so only genuinely idle boxes lapse. Default 1500000 (25 min). 0 disables auto-stop entirely. Unlike vercel/e2b (absolute session TTLs) this is an *inactivity* window. Daytona-only.',\n },\n {\n key: 'box.daytonaVmBaseImage',\n type: 'string',\n description:\n 'Registry image the daytona `linux-vm` base snapshot is baked from. Empty (the default) uses the fingerprint-tagged box image CI publishes (`ghcr.io/madarco/agentbox/box:sha-<context-sha>`). Daytona can only build a VM snapshot from a prebuilt image, never a Dockerfile, so a build context with no published image (a locally modified `Dockerfile.box`) has nothing to boot and falls back to the container class -- set this to bake a VM from your own published image instead. Must be amd64 and carry an explicit tag or digest. Daytona-only.',\n },\n {\n key: 'box.hetznerLocation',\n type: 'string',\n description:\n 'Hetzner datacenter location new --provider hetzner boxes are created in (e.g. `nbg1`, `fsn1`, `hel1`, `ash`). Default `nbg1`. Overridable per-create with `--location`. Hetzner-only; ignored by other providers.',\n },\n {\n key: 'box.digitaloceanRegion',\n type: 'string',\n description:\n 'DigitalOcean region new --provider digitalocean boxes are created in (e.g. `nyc3`, `nyc1`, `sfo3`, `ams3`, `fra1`). Default `nyc3`. Overridable per-create with `--location`. DigitalOcean-only; ignored by other providers.',\n },\n {\n key: 'box.digitaloceanProject',\n type: 'string',\n description:\n \"DigitalOcean Project new --provider digitalocean boxes are placed in — a name or the project's UUID. Unset (the default) leaves boxes in the account's default project. Set it per repo via `agentbox.yaml`, or globally at `agentbox digitalocean login`. DigitalOcean-only; ignored by other providers.\",\n },\n {\n key: 'box.remoteDockerHost',\n type: 'string',\n description:\n 'Default SSH destination new --provider remote-docker boxes run their container on — an `~/.ssh/config` alias or `[user@]host[:port]`. Overridable per-create with `agentbox docker:<host> …` or `--remote-host`. SSH auth comes from your own `~/.ssh/config` + agent, unless the host was shared with a control box (`agentbox remote-docker share`), which registers an explicit key. remote-docker-only; ignored by other providers.',\n },\n {\n key: 'box.vercelTimeoutMs',\n type: 'int',\n description:\n 'Max session length (ms) for new --provider vercel boxes before the VM auto-snapshots; persistent mode auto-resumes on the next call. Default 2700000 (45 min, the Hobby ceiling). Vercel-only.',\n },\n {\n key: 'box.e2bTimeoutMs',\n type: 'int',\n description:\n 'Session window (ms) a --provider e2b box is created with and re-armed with on every resume; the host keepalive pushes it forward while the agent is working, and doubles as the idle window after which the host pauses the box. Boxes pause rather than die at the window (and at E2B’s own ~1 h Hobby / 24 h Pro cap), keeping filesystem and memory. Default 2700000 (45 min). E2B-only.',\n },\n {\n key: 'box.cpMaxBytes',\n type: 'int',\n description:\n 'Max bytes a single host→box copy may transfer after excludes, shared by `agentbox cp` (blocked with a size breakdown unless --yes) and each `carry:` entry (rejected at resolve time). Default 104857600 (100 MiB).',\n advanced: true,\n },\n {\n key: 'box.credentialSync',\n type: 'bool',\n description:\n 'Automatically sync refreshed agent credentials (claude/codex/opencode) from boxes to the host backup and out to all other running boxes. Claude OAuth refresh rotates the refresh token, so without this every other copy 401s after any box refreshes. Default true; --no-credential-sync at create disables the in-box watcher for that box.',\n },\n {\n key: 'box.inbound',\n type: 'string',\n description:\n \"Inbound-access policy for VPS boxes (hetzner, digitalocean per-box firewall). `locked` (default) = SSH reachable only from your host's egress IP; `open` = SSH reachable from anywhere (0.0.0.0/0, key-only — to drive a box from a phone with the laptop off); a CIDR list (e.g. `203.0.113.5/32`) = host egress plus those. Override per box with `--inbound` or after create with `agentbox inbound <box>`. Ignored by non-VPS providers.\",\n },\n {\n key: 'box.vercelNetworkPolicy',\n type: 'string',\n description:\n \"Egress lock for new --provider vercel boxes: 'allow-all' (default, unset), 'deny-all', or a comma-separated domain allowlist (e.g. 'github.com,*.npmjs.org') that denies everything else. Vercel-only; ignored by other providers.\",\n },\n {\n key: 'claude.sessionName',\n type: 'string',\n description: 'tmux session name for `agentbox claude`.',\n },\n {\n key: 'claude.dangerouslySkipPermissions',\n type: 'bool',\n description:\n 'Launch claude in new boxes with --dangerously-skip-permissions (auto-accept tool use). Safe because boxes are isolated; on by default. Override per-box with --no-dangerously-skip-permissions.',\n },\n {\n key: 'codex.sessionName',\n type: 'string',\n description: 'tmux session name for `agentbox codex`.',\n },\n {\n key: 'codex.dangerouslySkipPermissions',\n type: 'bool',\n description:\n 'Launch codex in new boxes with --dangerously-bypass-approvals-and-sandbox (never prompt for approval). Safe because boxes are isolated; on by default. Override per-box with --no-dangerously-skip-permissions.',\n },\n {\n key: 'opencode.sessionName',\n type: 'string',\n description: 'tmux session name for `agentbox opencode`.',\n },\n {\n key: 'attach.openIn',\n type: 'enum',\n enumValues: ['split', 'window', 'tab', 'same'] as const,\n description:\n 'Where `agentbox claude|codex|opencode` opens the attached session when run from tmux, cmux, Herdr, or iTerm2: `split` (tmux split-window / cmux new-split / Herdr pane.split / iTerm2 vertical split, default — same workspace), `window` (tmux new-window / cmux new-workspace / Herdr workspace.create / new iTerm2 window), `tab` (tmux new-window / cmux new-surface / Herdr tab.create in the current workspace / new iTerm2 tab), or `same` (attach inline in the current terminal). Outside tmux/cmux/Herdr/iTerm2 every value behaves like `same`.',\n },\n {\n key: 'attach.cmuxStatus',\n type: 'bool',\n description:\n \"When attached inside cmux, reflect the box agent's live activity on its cmux workspace (colour + description: blue=working, amber=needs input, idle clears; restored on detach) and, when the agent needs input, flag the box's own tab via a cmux notification (tab badge + reorder + desktop notification) so it stands out among sibling tabs. cmux only; no-op in other terminals.\",\n },\n {\n key: 'attach.herdrStatus',\n type: 'bool',\n description:\n \"When attached inside Herdr, report the box agent's live activity to its Herdr pane (pane.report_agent: working / blocked / idle) so it looks like a normal agent pane and Herdr handles needs-input natively, and fire a Herdr notification for AgentBox's own host-relay approval prompts (git push / PR / checkpoint …) which Herdr can't otherwise see. Herdr only; no-op in other terminals.\",\n },\n {\n key: 'code.ide',\n type: 'enum',\n enumValues: ['vscode', 'cursor', 'auto'] as const,\n description: 'Which IDE `agentbox code` launches; \"auto\" prefers code, falls back to cursor.',\n },\n {\n key: 'code.wait',\n type: 'bool',\n description: 'Block on agentbox-ctl wait-ready before opening the IDE.',\n },\n {\n key: 'code.timeoutMs',\n type: 'int',\n description: 'wait-ready timeout in milliseconds.',\n },\n {\n key: 'code.autoTerminals',\n type: 'bool',\n description: 'Generate /workspace/.vscode/tasks.json so the IDE auto-opens log panels.',\n },\n {\n key: 'shell.user',\n type: 'string',\n description: 'Default in-container user for `agentbox shell`.',\n },\n {\n key: 'shell.login',\n type: 'bool',\n description: 'Pass `-l` to bash so the login profile loads.',\n },\n {\n key: 'shell.tmux',\n type: 'bool',\n description: 'Run `agentbox shell` inside a detachable tmux session (Ctrl+a d to detach).',\n },\n {\n key: 'ssh.autoConfig',\n type: 'bool',\n description:\n \"Automatically write a `~/.agentbox/ssh/config` entry (Include'd from `~/.ssh/config`) for SSH-capable cloud boxes on create and start/resume, so `ssh <box>` just works. On by default; set false if you manage `~/.ssh/config` yourself. Explicit `agentbox shell --ssh-config`/`code`/`open` still write on demand regardless.\",\n },\n {\n key: 'engine.kind',\n type: 'enum',\n enumValues: ['orbstack', 'docker-desktop', 'other', 'auto'] as const,\n description:\n 'Override the docker-engine auto-detection (used for OrbStack-only optimisations).',\n },\n {\n key: 'browser.default',\n type: 'enum',\n enumValues: ['agent-browser', 'playwright', 'both'] as const,\n description:\n 'Default browser stack inside the box. \"playwright\" or \"both\" implies box.withPlaywright.',\n },\n {\n key: 'relay.port',\n type: 'int',\n description: 'Host relay TCP port (advanced).',\n advanced: true,\n },\n {\n key: 'relay.controlPlaneUrl',\n type: 'string',\n description:\n 'Public HTTPS URL of a deployed control plane (hosted Next.js + Postgres app). When set, new cloud boxes point at it for git-token leasing, permission state, and the box registry/events, and push to GitHub directly with a leased token so they keep working with the laptop off. Set via `agentbox hub set-url`.',\n },\n {\n key: 'relay.custodyMaxBodyBytes',\n type: 'int',\n description:\n 'Per-request body cap (bytes) for custody JSON PUTs (default 33554432 = 32 MiB). This is the simple base64-in-JSON API, used for small values (credentials, .env files, SSH keys); large payloads go to the streaming blob API governed by relay.custodyMaxBlobBytes. It applies only to custody, so every other relay route keeps the 1 MiB control-plane cap. On a PC it governs how large a blob the client will upload; a control box enforces its own cap via AGENTBOX_CUSTODY_MAX_BODY_BYTES, so raise both.',\n advanced: true,\n },\n {\n key: 'relay.custodyMaxBlobBytes',\n type: 'int',\n description:\n \"Per-request cap (bytes) for the streaming custody blob API (default 104857600 = 100 MiB), which carries payloads too large to buffer as base64 — chiefly a project's `carry:` material. Defaults to the same value as box.cpMaxBytes so an entry the carry gate accepted at resolve time can actually be stored on a control box; if the two disagree the CLI promises a copy the transport then refuses. Enforced mid-stream (an over-cap upload is cut off, not landed). A control box enforces its own cap via AGENTBOX_CUSTODY_MAX_BLOB_BYTES, so raise both.\",\n advanced: true,\n },\n {\n key: 'relay.hostReachTimeoutMs',\n type: 'int',\n description:\n 'How long a control box waits (ms, default 60000) for your machine to pick up a copy between a box and your files, before treating it as offline — and how long a silence must last before a machine that already took the copy is presumed gone. Your machine long-polls the control box while its relay runs, so this is a missed-heartbeat window, not a per-copy timeout: once your machine has the action it can sit on a confirmation prompt for as long as you like. Read on the machine that does the waiting — set it ON THE CONTROL BOX (its own config, or AGENTBOX_HOST_REACH_TIMEOUT_MS in its deploy env); setting it on your laptop governs nothing, since your laptop is not the one parking the copy. Lower it to fall back to the hub cache sooner on a flaky link, raise it if your machine sleeps often.',\n advanced: true,\n },\n {\n key: 'git.pushMode',\n type: 'enum',\n enumValues: ['auto', 'relay', 'lease', 'direct'] as const,\n description:\n \"How a box's `git push` reaches GitHub: `relay` (the host relay pushes with your host credentials — they never enter the box), `lease` (the relay/plane leases a short-lived GitHub-App token and the box pushes directly, so it works with the laptop off), `direct` (the box holds a COPY of your git credentials and pushes/pulls/signs entirely on its own — needs no host or hub, but the credentials live inside the box and its snapshots; set via `--with-credentials`, which copies them in behind a confirmation), or `auto` (default — lease when `relay.controlPlaneUrl` is set for the box, else relay). Only affects cloud boxes; docker boxes always use `relay`. Forcing `relay` needs a reachable host relay for the box; forcing `lease` needs a reachable relay/plane with a GitHub App; `direct` needs credentials to have been copied into the box at create time, and is REFUSED when a control box is configured (`relay.controlPlaneUrl`) — use leasing (the `auto` default) instead.\",\n },\n {\n key: 'hub.mode',\n type: 'enum',\n enumValues: ['auto', 'thin', 'local'] as const,\n description:\n \"Whether the local docker engine is offered on this machine: `auto` (default — docker and remote-docker are available until a control box is configured (`relay.controlPlaneUrl`), then gated off since a laptop-built docker box can't run with the laptop off), `thin` (force the gated behavior even without a configured control box), or `local` (keep docker on regardless of a control box). When gated, `create --provider docker` is refused, docker rows are dropped from the provider pickers / `doctor` / `prepare`, and docker boxes are shown as inactive in `ls`; set `hub.mode=local` to use docker here anyway.\",\n },\n {\n key: 'hub.gitAuth',\n type: 'enum',\n enumValues: ['gh', 'app'] as const,\n description:\n 'Which git credential a deployed hub (control box) uses: `gh` (default — the hub holds a GitHub token taken from your own `gh` login and does the git work itself, so boxes never receive a credential and nothing needs installing or approving on GitHub) or `app` (the hub holds a GitHub App private key and leases a 1-hour, single-repo token to each box, which is tighter but requires the repo owner to install the App). Deploy intent: it selects what `agentbox hub setup` / `hub deploy` provisions and which push mode a cloud box gets — it cannot reconfigure a hub that is already running.',\n },\n {\n key: 'vnc.containerPort',\n type: 'int',\n description: 'Container-side noVNC port (advanced).',\n advanced: true,\n },\n {\n key: 'portless.enabled',\n type: 'bool',\n description:\n 'Map each box web app to a https://<box-name>.localhost URL via the Portless proxy (Docker Desktop only; OrbStack already has .orb.local). Default: prompt.',\n },\n {\n key: 'portless.stateDir',\n type: 'string',\n description:\n 'Host Portless state directory to share into boxes (advanced; default: Portless’s own location).',\n advanced: true,\n },\n {\n key: 'autopause.enabled',\n type: 'bool',\n description:\n 'Let the host relay periodically pause idle boxes when more than autopause.maxRunningBoxes are running.',\n },\n {\n key: 'autopause.maxRunningBoxes',\n type: 'int',\n description:\n 'Target maximum number of simultaneously-running boxes before idle ones get auto-paused.',\n },\n {\n key: 'autopause.idleMinutes',\n type: 'int',\n description:\n 'Minutes a box must be continuously idle (claude state) before it is eligible for auto-pause.',\n },\n {\n key: 'queue.enabled',\n type: 'bool',\n description:\n 'Run `agentbox claude|codex|opencode -i <prompt>` jobs through the host-wide background queue (FIFO, capped by queue.maxConcurrent).',\n },\n {\n key: 'queue.maxConcurrent',\n type: 'int',\n description:\n 'Max number of simultaneously-running boxes (across providers) before background `-i` jobs queue up instead of starting immediately. Per-invocation override: `--max-running <n>`.',\n },\n {\n key: 'queue.maxWorking',\n type: 'int',\n description:\n 'Max agents actively working/thinking (quota-consuming) at once before background `-i` jobs queue. 0 = disabled (use the queue.maxConcurrent running-box gate). Counts all boxes, foreground + queued. Per-invocation override: `--max-working <n>`.',\n },\n {\n key: 'queue.idleGraceSeconds',\n type: 'int',\n description:\n 'Seconds an agent must stay non-working before it frees its working slot (debounce against brief idle flaps between turns). Only used when queue.maxWorking > 0.',\n },\n {\n key: 'queue.openIn',\n type: 'enum',\n enumValues: ['none', 'split', 'window', 'tab'] as const,\n description:\n 'When a background `-i` job finishes creating its box, where the host relay opens an attached terminal onto it: `none` (default — open nothing, just queue), `split`, `window`, or `tab`. Honored only when the submitting shell runs inside tmux, cmux, Herdr, or iTerm2 (the targeting is captured at submit time). Under cmux, `split` splits the pane you submitted from (falling back to the parent workspace, then a new workspace), `tab` adds a tab in the parent workspace, and `window` opens a separate workspace; under Herdr, `split` splits the pane you submitted from, `tab` adds a tab in the parent workspace, and `window` opens a separate workspace; iTerm2 opens relative to the frontmost window. Unlike `attach.openIn` there is no `same` mode — the box is created asynchronously, so it is always a fresh terminal.',\n },\n {\n key: 'cloud.useCurrentBranch',\n type: 'bool',\n description:\n \"On cloud providers (daytona/hetzner), start new boxes on the host's current branch instead of forking a new agentbox/<box-name> branch. Overridden by an explicit --use-branch / --from-branch.\",\n },\n {\n key: 'cloud.viaHub',\n type: 'bool',\n description:\n 'When a control box is configured (relay.controlPlaneUrl), create cloud boxes ON the control box by default instead of on this machine (so they keep running with the laptop off). On by default; set false to always build cloud boxes locally. Overridden per-command by --via-hub / --local. Docker and remote-docker always build locally regardless.',\n },\n {\n key: 'maintenance.pruneProjectConfigs',\n type: 'bool',\n description:\n 'Periodically delete ~/.agentbox/projects/<hash>/ dirs whose source workspace folder no longer exists.',\n },\n {\n key: 'maintenance.pruneProjectConfigsEvery',\n type: 'int',\n description: 'Run the orphan project-config sweep every N successful `agentbox create`.',\n },\n {\n key: 'update.check',\n type: 'bool',\n description:\n 'Daily background check for a newer published agentbox (npm registry) and menu-bar app (release sha sidecar), plus the \"newer version available\" nudge. At most one network probe per 24h; false disables both.',\n },\n {\n key: 'update.channel',\n type: 'enum',\n enumValues: ['auto', 'stable', 'nightly'] as const,\n description:\n 'Which release channel `agentbox self-update` and `install app` follow: `auto` (default) follows the installed build, `nightly` opts into pre-release builds cut from the nightly branch, `stable` opts back out. Nightly always installs the newest build of EITHER channel, so a stable release supersedes the nightlies that preceded it.',\n },\n {\n key: 'tools.gh.enabled',\n type: 'bool',\n description:\n \"Whether the built-in `gh` host-tool grant is active. True (default) keeps the in-box `gh` shim routing GitHub operations through the host relay with the host's own `gh` auth; false revokes the grant so `gh` stops resolving in new boxes. Every other host tool is opt-in via `agentbox tools add` or an `agentbox.yaml` `tools:` request.\",\n },\n {\n key: 'tools.request.enabled',\n type: 'bool',\n description:\n 'Whether a box may ask the host for access to a new host CLI (`agentbox-ctl tool request <bin>`). True (default) raises a host approval prompt naming the box, the binary and the reason; false refuses the request outright so boxes can only use tools already granted.',\n },\n];\n\nconst REGISTRY_BY_KEY = new Map<string, KeyDescriptor>(KEY_REGISTRY.map((d) => [d.key, d]));\n\nexport function lookupKey(key: string): KeyDescriptor | undefined {\n return REGISTRY_BY_KEY.get(key);\n}\n\nexport class UserConfigError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'UserConfigError';\n }\n}\n\nexport type ConfigScope = 'global' | 'project';\n","/**\n * `--provider` accepts a *spec*, not just a name: `docker:<host>` means \"the\n * docker engine on <host>\", i.e. the remote-docker provider pointed at that SSH\n * destination.\n *\n * agentbox docker:buildbox claude\n * agentbox create --provider docker:dev@10.0.0.9:2222\n * agentbox prepare --provider docker:buildbox\n *\n * Reading `docker:` as the base is deliberate: to the user this IS docker, just\n * not here. `remote-docker:<host>` is accepted too, for anyone who reaches for\n * the provider's real name.\n *\n * It lives in `@agentbox/config` — beside the PROVIDERS table it is really about\n * — because BOTH the CLI and the hub have to read the same spec: the CLI when it\n * routes a create, the hub when its worker is handed one. A second parser is\n * exactly how the two drift.\n */\n\nexport const REMOTE_DOCKER = 'remote-docker';\n\nexport interface ProviderSpec {\n /** The provider name to resolve (`remote-docker` for a `docker:<host>` spec). */\n name: string;\n /** The SSH destination, when the spec named one. */\n remoteHost?: string;\n}\n\n/**\n * Split `<base>:<host>` on the FIRST colon — everything after it is the SSH\n * destination, which may itself contain a `:port` suffix\n * (`docker:dev@10.0.0.9:2222` → host `dev@10.0.0.9:2222`).\n */\nexport function parseProviderSpec(spec: string): ProviderSpec {\n const raw = spec.trim();\n const colon = raw.indexOf(':');\n if (colon < 0) return { name: raw };\n\n const base = raw.slice(0, colon);\n const host = raw.slice(colon + 1).trim();\n if (base !== 'docker' && base !== REMOTE_DOCKER) {\n // Not a remote spec — hand the whole string back and let the caller's\n // unknown-provider error name it, rather than silently reinterpreting it.\n return { name: raw };\n }\n if (host.length === 0) {\n throw new Error(\n `provider \"${raw}\" names no host — write \\`${base}:<ssh-host>\\` (an ~/.ssh/config alias or [user@]host[:port])`,\n );\n }\n return { name: REMOTE_DOCKER, remoteHost: host };\n}\n\n/** The provider name a spec resolves to, ignoring any host. */\nexport function providerNameOf(spec: string): string {\n return parseProviderSpec(spec).name;\n}\n","import { parse as parseYaml } from 'yaml';\nimport { parseProviderSpec } from './provider-spec.js';\nimport { KEY_REGISTRY, type KeyDescriptor, type UserConfig, UserConfigError } from './types.js';\n\nfunction isPlainObject(v: unknown): v is Record<string, unknown> {\n return typeof v === 'object' && v !== null && !Array.isArray(v);\n}\n\n/** Keys removed in a rename. Surfaced with a migration hint instead of a bare \"unknown key\". */\nconst RENAMED_KEYS: ReadonlyMap<string, string> = new Map([['box.snapshot', 'box.hostSnapshot']]);\n\nexport interface ParseOptions {\n /**\n * Called once per unknown key/section. Unknown keys are IGNORED, not fatal:\n * this parser is bundled into provider plugins (`@madarco/agentbox-provider-sdk`\n * inlines `@agentbox/config`), so a plugin pinned to an older SDK parses the\n * user's config with a stale KEY_REGISTRY. Throwing there would mean every\n * config key we add breaks every already-published plugin until it republishes.\n * Type errors and renamed keys still throw — only *unknown* keys degrade to a\n * warning.\n */\n onWarning?: (message: string) => void;\n}\n\ninterface BranchSpec {\n name: string;\n /** Map of leaf-key (dot-suffix) → descriptor whose `key` starts with this branch. */\n leaves: Map<string, KeyDescriptor>;\n}\n\nconst BRANCHES: Map<string, BranchSpec> = (() => {\n const out = new Map<string, BranchSpec>();\n for (const desc of KEY_REGISTRY) {\n const idx = desc.key.indexOf('.');\n if (idx < 0) {\n throw new Error(`KEY_REGISTRY entry ${desc.key} must use dot-path form (branch.leaf)`);\n }\n const branch = desc.key.slice(0, idx);\n const leaf = desc.key.slice(idx + 1);\n let entry = out.get(branch);\n if (!entry) {\n entry = { name: branch, leaves: new Map() };\n out.set(branch, entry);\n }\n entry.leaves.set(leaf, desc);\n }\n return out;\n})();\n\n/**\n * Coerce a typed YAML scalar (already typed by the YAML parser) into the\n * descriptor's expected type. Strings from the CLI go through `coerceFromString`\n * instead — that path accepts e.g. \"true\" or \"120000\".\n */\nfunction coerceTypedValue(raw: unknown, desc: KeyDescriptor, where: string): unknown {\n if (raw === null) {\n throw new UserConfigError(`${where} must not be null (use \\`agentbox config unset\\` to clear)`);\n }\n switch (desc.type) {\n case 'bool':\n if (typeof raw !== 'boolean') {\n throw new UserConfigError(`${where} must be a boolean (got ${typeof raw})`);\n }\n return raw;\n case 'string':\n if (typeof raw !== 'string') {\n throw new UserConfigError(`${where} must be a string (got ${typeof raw})`);\n }\n if (raw.length === 0) {\n throw new UserConfigError(`${where} must not be empty`);\n }\n return raw;\n case 'int':\n if (typeof raw !== 'number' || !Number.isInteger(raw)) {\n throw new UserConfigError(`${where} must be an integer (got ${String(raw)})`);\n }\n return raw;\n case 'enum':\n if (typeof raw !== 'string' || !enumValueAllowed(desc, raw)) {\n throw new UserConfigError(\n `${where} must be one of: ${desc.enumValues!.join(', ')}${desc.allowProviderSpec ? ' (or a `docker:<host>` spec)' : ''} (got ${String(raw)})`,\n );\n }\n return raw;\n }\n}\n\n/**\n * Enum membership, plus the one deliberate widening: a `box.provider` may hold a\n * host-qualified `docker:<alias>` spec. Parsed rather than pattern-matched so the\n * accepted shapes cannot drift from what the CLI and hub actually resolve.\n */\nfunction enumValueAllowed(desc: KeyDescriptor, raw: string): boolean {\n if (desc.enumValues!.includes(raw)) return true;\n if (!desc.allowProviderSpec) return false;\n try {\n const spec = parseProviderSpec(raw);\n return spec.remoteHost !== undefined && desc.enumValues!.includes(spec.name);\n } catch {\n return false;\n }\n}\n\n/**\n * Split a host-qualified `box.provider` (`docker:hub`) into the two keys that\n * actually store it: `box.provider` (a bare provider NAME) and\n * `box.remoteDockerHost` (the engine). The spec is a usability affordance for\n * argv and for hand-written YAML; keeping it in the stored value would mean\n * every consumer re-splitting a config string, and would force `provider`'s type\n * open to `string`. Desugaring HERE — rather than only in `agentbox config set`\n * — is what lets a hand-edited `provider: docker:hub` keep working.\n *\n * Runs per LAYER, so the two keys land together in the file that named them and\n * merge as an ordinary pair afterwards.\n */\nfunction desugarProviderSpec(\n box: Record<string, unknown>,\n where: string,\n opts: ParseOptions,\n): void {\n const raw = box['provider'];\n if (typeof raw !== 'string') return;\n let spec;\n try {\n spec = parseProviderSpec(raw);\n } catch {\n // Unreachable: coerceTypedValue already rejected an unparseable spec.\n return;\n }\n if (spec.remoteHost === undefined) return;\n\n const existing = box['remoteDockerHost'];\n if (typeof existing === 'string' && existing !== spec.remoteHost) {\n // The spec wins, matching how `--provider docker:<host>` has always beaten\n // the configured default. Loud, because the losing key looks live.\n opts.onWarning?.(\n `${where}.box: provider \"${raw}\" names host \"${spec.remoteHost}\", which overrides ` +\n `remoteDockerHost \"${existing}\" in the same file`,\n );\n }\n box['provider'] = spec.name;\n box['remoteDockerHost'] = spec.remoteHost;\n}\n\n/**\n * Parse a UserConfig document text (YAML). Malformed values (wrong type, bad\n * enum, renamed key) throw UserConfigError; unknown keys are reported to\n * `opts.onWarning` and skipped (see `ParseOptions`).\n *\n * `where` is the human-readable origin for error messages, e.g. the file path.\n * Empty / whitespace-only input parses to `{}`.\n */\nexport function parseUserConfig(\n text: string,\n where: string,\n opts: ParseOptions = {},\n): Partial<UserConfig> {\n let doc: unknown;\n try {\n doc = parseYaml(text);\n } catch (err) {\n throw new UserConfigError(\n `${where}: yaml parse error: ${err instanceof Error ? err.message : String(err)}`,\n );\n }\n if (doc === null || doc === undefined) return {};\n if (!isPlainObject(doc)) {\n throw new UserConfigError(`${where}: top-level must be a mapping`);\n }\n return parseUserConfigObject(doc, where, opts);\n}\n\n/**\n * Same validation as `parseUserConfig` but starting from an already-decoded\n * object. Used when the caller has the YAML parsed (e.g. agentbox.yaml's\n * `defaults:` block).\n */\nexport function parseUserConfigObject(\n doc: unknown,\n where: string,\n opts: ParseOptions = {},\n): Partial<UserConfig> {\n if (doc === null || doc === undefined) return {};\n if (!isPlainObject(doc)) {\n throw new UserConfigError(`${where}: must be a mapping`);\n }\n\n const out: Partial<UserConfig> = {};\n for (const [branchName, branchRaw] of Object.entries(doc)) {\n // Top-level `schema` is a metadata stamp written by the loader on first\n // save (future-proofs migrations). It's not a config section and never\n // appears in `EffectiveConfig`; carry it through so writers preserve it\n // round-trip, but skip the \"must be a mapping\" / leaf checks below.\n if (branchName === 'schema') {\n if (branchRaw !== undefined && branchRaw !== null) {\n if (typeof branchRaw !== 'number' || !Number.isInteger(branchRaw)) {\n throw new UserConfigError(\n `${where}.schema: must be an integer (got ${String(branchRaw)})`,\n );\n }\n out.schema = branchRaw;\n }\n continue;\n }\n const branchSpec = BRANCHES.get(branchName);\n if (!branchSpec) {\n opts.onWarning?.(\n `${where}: unknown config section \"${branchName}\" — ignored (typo, or set by a newer agentbox)`,\n );\n continue;\n }\n if (branchRaw === null || branchRaw === undefined) continue;\n if (!isPlainObject(branchRaw)) {\n throw new UserConfigError(`${where}.${branchName}: must be a mapping`);\n }\n const branchOut = parseBranchObject(branchSpec, branchName, branchRaw, '', where, opts);\n if (branchName === 'box') desugarProviderSpec(branchOut, where, opts);\n if (Object.keys(branchOut).length > 0) {\n // We've validated that each branch matches one of UserConfig's known\n // sub-objects; the indexed write keeps the union type happy.\n (out as Record<string, unknown>)[branchName] = branchOut;\n }\n }\n return out;\n}\n\n/**\n * Validate a YAML branch sub-tree against `branchSpec`'s registered leaf paths.\n * Handles nested keys like `tools.gh.enabled` — the branch is\n * `tools`, the leaf path is `gh.enabled`, so the YAML can be\n * written as a nested mapping. `qualifiedPrefix` is the dotted path walked so\n * far within the branch (empty at top level).\n */\nfunction parseBranchObject(\n branchSpec: BranchSpec,\n branchName: string,\n raw: Record<string, unknown>,\n qualifiedPrefix: string,\n where: string,\n opts: ParseOptions,\n): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n for (const [name, value] of Object.entries(raw)) {\n if (value === undefined) continue;\n const qualified = qualifiedPrefix ? `${qualifiedPrefix}.${name}` : name;\n const desc = branchSpec.leaves.get(qualified);\n if (desc) {\n out[name] = coerceTypedValue(value, desc, `${where}.${desc.key}`);\n continue;\n }\n // Not a leaf — descend if it's a mapping AND a deeper leaf is registered\n // beneath this path. Otherwise the key is unknown / not in the registry.\n if (isPlainObject(value) && branchHasLeafBelow(branchSpec, qualified)) {\n const sub = parseBranchObject(branchSpec, branchName, value, qualified, where, opts);\n if (Object.keys(sub).length > 0) out[name] = sub;\n continue;\n }\n // A rename still throws: the old name was valid in every older registry, so\n // this can't be a forward-compat miss — it's a real migration the user must do.\n const renamedTo = RENAMED_KEYS.get(`${branchName}.${qualified}`);\n if (renamedTo) {\n throw new UserConfigError(\n `${where}.${branchName}.${qualified} was renamed to ${renamedTo} — update your config`,\n );\n }\n opts.onWarning?.(\n `${where}.${branchName}: unknown key \"${qualified}\" — ignored (typo, or set by a newer agentbox)`,\n );\n }\n return out;\n}\n\nfunction branchHasLeafBelow(branchSpec: BranchSpec, prefix: string): boolean {\n const needle = `${prefix}.`;\n for (const leaf of branchSpec.leaves.keys()) {\n if (leaf.startsWith(needle)) return true;\n }\n return false;\n}\n\n/**\n * Coerce a string (e.g. typed at the CLI by `agentbox config set`) into the\n * declared type for `key`. Booleans accept true/false/yes/no/1/0 (case\n * insensitive). Returns the typed value or throws UserConfigError.\n */\nexport function coerceFromString(key: string, raw: string): unknown {\n const desc = lookupKeyOrThrow(key);\n switch (desc.type) {\n case 'bool': {\n const v = raw.trim().toLowerCase();\n if (v === 'true' || v === 'yes' || v === '1' || v === 'on') return true;\n if (v === 'false' || v === 'no' || v === '0' || v === 'off') return false;\n throw new UserConfigError(`${key}: expected a boolean (true/false), got \"${raw}\"`);\n }\n case 'string':\n if (raw.length === 0) throw new UserConfigError(`${key}: must not be empty`);\n return raw;\n case 'int': {\n const n = Number(raw);\n if (!Number.isFinite(n) || !Number.isInteger(n)) {\n throw new UserConfigError(`${key}: expected an integer, got \"${raw}\"`);\n }\n return n;\n }\n case 'enum':\n if (!enumValueAllowed(desc, raw)) {\n throw new UserConfigError(\n `${key}: expected one of ${desc.enumValues!.join(', ')}${desc.allowProviderSpec ? ' (or a \\`docker:<host>\\` spec)' : ''}, got \"${raw}\"`,\n );\n }\n return raw;\n }\n}\n\nfunction lookupKeyOrThrow(key: string): KeyDescriptor {\n const renamedTo = RENAMED_KEYS.get(key);\n if (renamedTo) {\n throw new UserConfigError(`${key} was renamed to ${renamedTo} — use ${renamedTo} instead`);\n }\n const idx = key.indexOf('.');\n if (idx < 0) {\n throw new UserConfigError(`unknown key \"${key}\" (must be in branch.leaf form)`);\n }\n const branch = BRANCHES.get(key.slice(0, idx));\n if (!branch) {\n throw new UserConfigError(\n `unknown config section \"${key.slice(0, idx)}\" (known: ${[...BRANCHES.keys()].join(', ')})`,\n );\n }\n const desc = branch.leaves.get(key.slice(idx + 1));\n if (!desc) {\n throw new UserConfigError(\n `unknown key \"${key}\" (known in ${branch.name}: ${[...branch.leaves.keys()].join(', ')})`,\n );\n }\n return desc;\n}\n","import { createHash } from 'node:crypto';\nimport { realpath, stat } from 'node:fs/promises';\nimport { homedir } from 'node:os';\nimport { basename, dirname, join, resolve } from 'node:path';\nimport type { ConfigScope } from './types.js';\n\nexport const STATE_DIR = join(homedir(), '.agentbox');\nexport const GLOBAL_CONFIG_FILE = join(STATE_DIR, 'config.yaml');\nexport const PROJECTS_DIR = join(STATE_DIR, 'projects');\nexport const WORKSPACE_CONFIG_BASENAME = 'agentbox.yaml';\n\nexport interface ProjectRoot {\n /** Absolute path to the resolved project root (host filesystem). */\n root: string;\n hasAgentboxYaml: boolean;\n}\n\n/**\n * Walk up from `cwd` until we find an `agentbox.yaml`. That dir is the\n * \"project\". If no ancestor has one, we fall back to `cwd` (per spec) so\n * `agentbox config` still does something sane in dirs without a workspace\n * file. The returned path is always absolute and **symlink-canonicalised**\n * via `realpath` — without this, macOS's `/tmp` symlink to `/private/tmp`\n * makes `findProjectRoot('/tmp/x')` (at create time, --workspace) and\n * `findProjectRoot(process.cwd())` (at resolve time, the same dir) return\n * different roots, breaking the per-project box index match.\n */\nexport async function findProjectRoot(cwd: string): Promise<ProjectRoot> {\n const start = await canonicalize(cwd);\n let dir = start;\n // Defensive cap on iterations: filesystem roots end with `dirname(x) === x`.\n for (let i = 0; i < 64; i++) {\n if (await fileExists(join(dir, WORKSPACE_CONFIG_BASENAME))) {\n return { root: dir, hasAgentboxYaml: true };\n }\n const parent = dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n return { root: start, hasAgentboxYaml: false };\n}\n\nasync function canonicalize(p: string): Promise<string> {\n const abs = resolve(p);\n // realpath only works for paths that exist. cwd and create-time\n // workspaces always do; fall back to the resolved (non-canonicalised)\n // path for anything else (e.g. config get from a deleted dir).\n try {\n return await realpath(abs);\n } catch {\n return abs;\n }\n}\n\nasync function fileExists(p: string): Promise<boolean> {\n try {\n const st = await stat(p);\n return st.isFile();\n } catch {\n return false;\n }\n}\n\n/**\n * SHA-1 (first 16 hex chars) of the *normalised* absolute path. We strip a\n * single trailing slash so `/foo/` and `/foo` hash identically. Case is\n * preserved — macOS APFS is case-preserving and so is the user's intent.\n */\nexport function hashProjectPath(absPath: string): string {\n const normalised = absPath.length > 1 && absPath.endsWith('/')\n ? absPath.slice(0, -1)\n : absPath;\n return createHash('sha1').update(normalised).digest('hex').slice(0, 16);\n}\n\n/**\n * Make `raw` safe to embed as the mnemonic half of an on-disk dir segment or a\n * Docker tag repo. Lowercased so docker tag repos stay valid; `-` collapses to\n * `_` so the single `-` between hash and mnemonic remains the only one (which\n * is what `listProjectsConfigured` parses on). Bounded length, never empty.\n */\nexport function sanitizeMnemonic(raw: string): string {\n return (\n raw\n .toLowerCase()\n .replace(/-/g, '_')\n .replace(/[^a-z0-9_]+/g, '_')\n .replace(/_+/g, '_')\n .replace(/^_+|_+$/g, '')\n .slice(0, 32) || 'unnamed'\n );\n}\n\n/**\n * On-disk dir segment for a project under `~/.agentbox/projects/` and\n * `~/.agentbox/checkpoints/`: `<hash>-<mnemonic>`. The hash stays the\n * canonical key; the trailing mnemonic is decorative — readers parse the hash\n * as the leading 16 hex chars and ignore the suffix.\n */\nexport function projectDirSegment(absPath: string): string {\n return `${hashProjectPath(absPath)}-${sanitizeMnemonic(basename(absPath))}`;\n}\n\nexport function projectConfigDir(absPath: string): string {\n return join(PROJECTS_DIR, projectDirSegment(absPath));\n}\n\nexport function projectConfigFile(absPath: string): string {\n return join(projectConfigDir(absPath), 'config.yaml');\n}\n\nexport function projectMetaFile(absPath: string): string {\n return join(projectConfigDir(absPath), 'meta.json');\n}\n\nexport function workspaceConfigFile(workspacePath: string): string {\n return join(workspacePath, WORKSPACE_CONFIG_BASENAME);\n}\n\n/**\n * Resolve a file path for a given scope. For `global`, no cwd is needed;\n * for `project`, `cwd` selects which project hash. Workspace path uses the\n * resolved project root (the dir holding `agentbox.yaml`, or cwd as fallback).\n */\nexport async function configPathFor(\n scope: ConfigScope | 'workspace',\n cwd: string,\n): Promise<string> {\n if (scope === 'global') return GLOBAL_CONFIG_FILE;\n const root = await findProjectRoot(cwd);\n if (scope === 'project') return projectConfigFile(root.root);\n return workspaceConfigFile(root.root);\n}\n\n/**\n * Host-side host-tool grant files. Kept out of `config.yaml` on purpose:\n * `KEY_REGISTRY` is a closed registry of typed scalar keys, and the grant\n * list is an open map whose entries are written by an approval flow, not\n * typed by hand. Layered the same way as config — a global grant applies\n * everywhere, a project grant only to that project. See docs/host-tools.md.\n */\nexport const GLOBAL_TOOLS_FILE = join(STATE_DIR, 'tools.yaml');\n\nexport function projectToolsFile(absPath: string): string {\n return join(projectConfigDir(absPath), 'tools.yaml');\n}\n","import { readFile } from 'node:fs/promises';\nimport { parse as parseYaml } from 'yaml';\nimport {\n findProjectRoot,\n GLOBAL_CONFIG_FILE,\n hashProjectPath,\n projectConfigFile,\n workspaceConfigFile,\n} from './paths.js';\nimport { parseUserConfig, parseUserConfigObject } from './parse.js';\nimport {\n BUILT_IN_DEFAULTS,\n type ConfigSource,\n type EffectiveConfig,\n KEY_REGISTRY,\n type LoadedConfig,\n type UserConfig,\n} from './types.js';\n\n/**\n * Process-wide sink for non-fatal config warnings (unknown keys). Registered by\n * the CLI so every `loadEffectiveConfig` call surfaces them without threading a\n * logger through ~84 call sites.\n *\n * A provider plugin bundles its own copy of this module (the SDK inlines\n * `@agentbox/config`) and registers NO sink — so a stale plugin silently\n * tolerates keys it hasn't heard of, while the host CLI still tells the user.\n */\nlet warningSink: ((message: string) => void) | null = null;\n\nexport function setConfigWarningSink(fn: ((message: string) => void) | null): void {\n warningSink = fn;\n}\n\nfunction collectWarning(into: string[], message: string): void {\n into.push(message);\n warningSink?.(message);\n}\n\n/**\n * ENOENT-tolerant read of a UserConfig file. Anything else propagates.\n */\nasync function loadOptionalUserConfig(\n path: string,\n warnings: string[],\n): Promise<Partial<UserConfig>> {\n let text: string;\n try {\n text = await readFile(path, 'utf8');\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') return {};\n throw err;\n }\n return parseUserConfig(text, path, { onWarning: (m) => collectWarning(warnings, m) });\n}\n\n/**\n * Read the `defaults:` block from `<workspacePath>/agentbox.yaml`. Returns\n * `{}` if the file is missing or has no `defaults:` key. Throws on YAML\n * parse errors or invalid `defaults:` content (so typos surface as soon as\n * the user runs anything in the workspace).\n *\n * The rest of `agentbox.yaml` is owned by `@agentbox/ctl` — we don't validate\n * it here and we don't depend on that package.\n */\nexport async function loadProjectAgentboxDefaults(\n workspacePath: string,\n warnings: string[] = [],\n): Promise<Partial<UserConfig>> {\n const path = workspaceConfigFile(workspacePath);\n let text: string;\n try {\n text = await readFile(path, 'utf8');\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') return {};\n throw err;\n }\n let doc: unknown;\n try {\n doc = parseYaml(text);\n } catch {\n // The ctl parser will surface its own error on the next box action; we\n // only throw if defaults: is present and broken (validated below).\n return {};\n }\n if (doc === null || doc === undefined || typeof doc !== 'object' || Array.isArray(doc)) {\n return {};\n }\n const defaults = (doc as Record<string, unknown>)['defaults'];\n if (defaults === undefined || defaults === null) return {};\n return parseUserConfigObject(defaults, `${path} defaults`, {\n onWarning: (m) => collectWarning(warnings, m),\n });\n}\n\nexport interface LoadEffectiveConfigOptions {\n /** Highest-precedence layer; values supplied by command-line flags. */\n cliOverrides?: Partial<UserConfig>;\n}\n\n/**\n * Load and merge all four config sources for the cwd. Per-leaf precedence\n * (highest wins): cli > workspace > project > global > built-in defaults.\n *\n * The returned `sources` map has one entry per leaf in the registry — useful\n * for `agentbox config get --all` to show provenance.\n */\nexport async function loadEffectiveConfig(\n cwd: string,\n opts: LoadEffectiveConfigOptions = {},\n): Promise<LoadedConfig> {\n const projectRoot = await findProjectRoot(cwd);\n const projectPath = projectConfigFile(projectRoot.root);\n const workspacePath = projectRoot.hasAgentboxYaml ? workspaceConfigFile(projectRoot.root) : null;\n\n const warnings: string[] = [];\n const [globalValues, projectValues, workspaceValues] = await Promise.all([\n loadOptionalUserConfig(GLOBAL_CONFIG_FILE, warnings),\n loadOptionalUserConfig(projectPath, warnings),\n workspacePath ? loadProjectAgentboxDefaults(projectRoot.root, warnings) : Promise.resolve({}),\n ]);\n\n const cliValues = opts.cliOverrides ?? {};\n\n const { effective, sources } = mergeLayers({\n cli: cliValues,\n workspace: workspaceValues,\n project: projectValues,\n global: globalValues,\n });\n\n return {\n effective,\n layers: {\n cli: { values: cliValues },\n workspace: { path: workspacePath, values: workspaceValues },\n project: { path: projectPath, values: projectValues },\n global: { path: GLOBAL_CONFIG_FILE, values: globalValues },\n defaults: BUILT_IN_DEFAULTS,\n },\n sources,\n projectRoot: projectRoot.root,\n projectHash: hashProjectPath(projectRoot.root),\n hasAgentboxYaml: projectRoot.hasAgentboxYaml,\n warnings,\n };\n}\n\ninterface MergeInput {\n cli: Partial<UserConfig>;\n workspace: Partial<UserConfig>;\n project: Partial<UserConfig>;\n global: Partial<UserConfig>;\n}\n\n/**\n * Walk every key in KEY_REGISTRY, pick the highest-precedence layer that has\n * a leaf value, and record the source. Lower-precedence layers never\n * overwrite a higher-precedence definition; absent leaves don't shadow.\n */\nfunction mergeLayers(input: MergeInput): {\n effective: EffectiveConfig;\n sources: Record<string, ConfigSource>;\n} {\n // Deep-clone the defaults; we'll overwrite leaves in place.\n const effective: EffectiveConfig = JSON.parse(JSON.stringify(BUILT_IN_DEFAULTS)) as EffectiveConfig;\n const sources: Record<string, ConfigSource> = {};\n\n const layerOrder: Array<{ source: ConfigSource; values: Partial<UserConfig> }> = [\n { source: 'cli', values: input.cli },\n { source: 'workspace', values: input.workspace },\n { source: 'project', values: input.project },\n { source: 'global', values: input.global },\n ];\n\n for (const desc of KEY_REGISTRY) {\n const idx = desc.key.indexOf('.');\n const branch = desc.key.slice(0, idx);\n const leaf = desc.key.slice(idx + 1);\n\n let chosen: { source: ConfigSource; value: unknown } | null = null;\n for (const layer of layerOrder) {\n const v = readLeaf(layer.values, branch, leaf);\n if (v !== undefined) {\n chosen = { source: layer.source, value: v };\n break;\n }\n }\n\n if (chosen) {\n writeLeaf(effective, branch, leaf, chosen.value);\n sources[desc.key] = chosen.source;\n } else {\n sources[desc.key] = 'default';\n }\n }\n\n return { effective, sources };\n}\n\nfunction readLeaf(\n obj: Partial<UserConfig>,\n branch: string,\n leaf: string,\n): unknown {\n let cur: unknown = (obj as Record<string, unknown>)[branch];\n for (const seg of leaf.split('.')) {\n if (cur === undefined || cur === null || typeof cur !== 'object') return undefined;\n cur = (cur as Record<string, unknown>)[seg];\n }\n return cur;\n}\n\nfunction writeLeaf(\n obj: EffectiveConfig,\n branch: string,\n leaf: string,\n value: unknown,\n): void {\n let cur: Record<string, unknown> | undefined =\n (obj as unknown as Record<string, Record<string, unknown>>)[branch];\n if (!cur) return; // BUILT_IN_DEFAULTS guarantees the branch exists\n const segs = leaf.split('.');\n for (let i = 0; i < segs.length - 1; i++) {\n const seg = segs[i]!;\n const next = cur[seg];\n if (next === undefined || next === null || typeof next !== 'object') {\n // BUILT_IN_DEFAULTS guarantees nested sub-objects exist for every\n // registered key path, so this is unreachable in practice; defaulting\n // to a fresh sub-object keeps the function total.\n cur[seg] = {};\n }\n cur = cur[seg] as Record<string, unknown>;\n }\n cur[segs[segs.length - 1]!] = value;\n}\n","/**\n * Resolve the effective box image ref for a given provider.\n *\n * Precedence (highest wins):\n * 1. `box.image<Provider>` — per-provider override\n * (`imageDocker` / `imageDaytona` / `imageHetzner` / `imageVercel`).\n * 2. `box.image` — generic fallback (defaults to `agentbox/box:dev`,\n * which cloud backends recognize as a sentinel meaning \"boot from\n * the provider's prepared base snapshot\").\n *\n * Each `agentbox prepare --provider X` writes its result into its own\n * per-provider key, so cross-provider prepares can no longer poison\n * creates on other providers.\n */\nimport type { EffectiveConfig, ProviderKind } from './types.js';\nimport { isProviderKind, perProviderConfigKey } from './providers.js';\n\n/**\n * Read a per-provider `box.<base><P>` string field off the effective config.\n * Only BUILT-IN providers have such a key; any other name — a stray value, or\n * an external plugin provider — returns '' so the caller falls through to the\n * generic `box.<base>`. For a plugin that generic is the image sentinel\n * (`agentbox/box:dev`), which the plugin's own backend maps to its prepared\n * snapshot — so a plugin never accidentally reads docker's per-provider value.\n */\nfunction perProviderValue(\n cfg: EffectiveConfig,\n base: 'image' | 'size' | 'defaultCheckpoint',\n provider: ProviderKind | string,\n): string {\n if (!isProviderKind(provider)) return '';\n const field = perProviderConfigKey(base, provider).slice('box.'.length);\n const val = (cfg.box as Record<string, unknown>)[field];\n return typeof val === 'string' ? val : '';\n}\n\nexport function resolveBoxImage(cfg: EffectiveConfig, provider: ProviderKind | string): string {\n // Unknown provider names fall back to the generic `box.image` — a stray\n // value in argv or config shouldn't crash before the validation layer.\n const perProvider = perProviderValue(cfg, 'image', provider);\n if (perProvider.length > 0) return perProvider;\n return cfg.box.image;\n}\n\nexport { perProviderValue };\n\n/**\n * Flat KEY_REGISTRY key for `agentbox prepare --provider X` to pin the\n * resulting image into the right per-provider slot; mirrors\n * `defaultCheckpointConfigKey`. Unknown provider → generic `box.image`\n * (legacy callers).\n */\nexport function boxImageConfigKey(provider: ProviderKind | string | undefined): string {\n if (provider && isProviderKind(provider)) return perProviderConfigKey('image', provider);\n return 'box.image';\n}\n","/**\n * Resolve the effective default checkpoint ref for a given provider.\n *\n * Precedence (highest wins):\n * 1. `box.defaultCheckpoint<Provider>` — per-provider override\n * (`defaultCheckpointDocker` / `defaultCheckpointDaytona` /\n * `defaultCheckpointHetzner`).\n * 2. `box.defaultCheckpoint` — global fallback (back-compat shape: every\n * pre-cloud config has this; no flag was needed).\n * 3. '' — no default.\n *\n * Returning the empty string (instead of undefined) matches the\n * `EffectiveConfig.box.defaultCheckpoint` shape so call sites that already\n * test `.length > 0` keep working unchanged.\n */\nimport type { EffectiveConfig, ProviderKind } from './types.js';\nimport { isProviderKind, perProviderConfigKey } from './providers.js';\nimport { perProviderValue } from './image.js';\n\nexport function resolveDefaultCheckpoint(\n cfg: EffectiveConfig,\n provider: ProviderKind | string,\n): string {\n // Unknown provider names fall back to the global default — a stray value in\n // config or argv shouldn't crash before the validation layer.\n const perProvider = perProviderValue(cfg, 'defaultCheckpoint', provider);\n if (perProvider.length > 0) return perProvider;\n return cfg.box.defaultCheckpoint;\n}\n\n/**\n * Config key (one of the flat KEY_REGISTRY entries) used by `agentbox\n * checkpoint set-default [--provider X]` to write the right field. Passing\n * an unknown provider falls back to the global key (legacy callers).\n */\nexport function defaultCheckpointConfigKey(provider: ProviderKind | string | undefined): string {\n if (provider && isProviderKind(provider)) {\n return perProviderConfigKey('defaultCheckpoint', provider);\n }\n return 'box.defaultCheckpoint';\n}\n","/**\n * Resolve the effective default VM size for a given cloud provider.\n *\n * Precedence (highest wins):\n * 1. `box.size<Provider>` — per-provider override\n * (`sizeDocker` / `sizeDaytona` / `sizeHetzner` / `sizeVercel`).\n * 2. `box.size` — generic fallback.\n * 3. '' — no preference; backend uses its built-in default.\n *\n * Interpretation is provider-specific:\n * - hetzner: server type string (e.g. `cx33`).\n * - daytona: `cpu-memory-disk` GB spec (e.g. `4-8-20`), baked at prepare time\n * on the snapshot path.\n * - vercel: vCPU count — `1`, `2`, `4` or `8` (RAM is coupled at 2 GB/vCPU).\n * - e2b: `cpu-memory` GB spec (e.g. `4-8`), baked at prepare time.\n * - docker: reserved (docker uses memory/cpus/disk). The key exists for\n * surface uniformity.\n *\n * Returning '' (rather than undefined) mirrors how `resolveDefaultCheckpoint`\n * shapes its result, so call sites can `.length > 0` test uniformly.\n */\nimport type { EffectiveConfig, ProviderKind } from './types.js';\nimport { perProviderValue } from './image.js';\n\nexport function resolveBoxSize(cfg: EffectiveConfig, provider: ProviderKind | string): string {\n // Unknown provider names fall back to the generic `box.size` — a stray value\n // in argv or config shouldn't crash before the validation layer.\n const perProvider = perProviderValue(cfg, 'size', provider);\n if (perProvider.length > 0) return perProvider;\n return cfg.box.size;\n}\n","/**\n * Resolve the effective bake datacenter / region for a provider whose base\n * snapshot has a placement fixed at prepare time.\n *\n * Precedence (highest wins):\n * 1. an explicit value (a `--location` flag threaded through the prepare job).\n * 2. the provider's config pin — `box.hetznerLocation` / `box.digitaloceanRegion`\n * / `box.daytonaRegion`.\n * 3. undefined — the provider bakes in its own default location.\n *\n * Only hetzner, digitalocean, and daytona place a base at bake time; every other\n * provider ignores location (their base has no per-region placement).\n */\nimport type { EffectiveConfig } from './types.js';\n\nexport function resolvePrepareLocation(\n provider: string,\n explicit: string | undefined,\n cfg: EffectiveConfig | undefined,\n): string | undefined {\n const configured =\n provider === 'hetzner'\n ? cfg?.box.hetznerLocation\n : provider === 'digitalocean'\n ? cfg?.box.digitaloceanRegion\n : provider === 'daytona'\n ? cfg?.box.daytonaRegion\n : undefined;\n return explicit?.trim() || configured || undefined;\n}\n","/**\n * Daytona sandbox-class + region resolution.\n *\n * Daytona has two sandbox classes and they are not interchangeable:\n *\n * - `linux-vm` — a real VM. Gives true pause/resume (CPU + memory frozen, so\n * running processes and tmux sessions survive), a filesystem+memory\n * snapshot capability, and a base bake that takes ~1 min instead of ~7\n * (it boots a prebuilt registry image rather than building a Dockerfile).\n * It cannot be archived, and it runs in exactly ONE region.\n * - `container` — the original shape. Archivable, buildable from a\n * Dockerfile via Daytona's declarative builder, available in the shared\n * regions (`us`, `eu`).\n *\n * The region coupling is the sharp edge: only `us-east-1` has linux-vm runners.\n * Asking for a VM anywhere else fails at create with \"No runners are configured\n * in region '<r>' for sandbox class 'linux-vm'\". So an unset `box.daytonaRegion`\n * derives from the class rather than defaulting to a constant — otherwise the\n * default class and the default region would contradict each other.\n *\n * A user who needs a specific region (EU data residency, latency) sets\n * `box.daytonaClass=container` and gets the old behavior.\n */\nimport type { EffectiveConfig } from './types.js';\n\nexport type DaytonaSandboxClass = 'linux-vm' | 'container';\n\n/** The only Daytona region with linux-vm runners (verified 2026-07-12). */\nexport const DAYTONA_VM_REGION = 'us-east-1';\n\nexport function resolveDaytonaClass(cfg: EffectiveConfig): DaytonaSandboxClass {\n // Anything that isn't an explicit `container` resolves to the default rather\n // than being forwarded to the SDK — Daytona also has `windows`/`android`\n // classes we don't support, and a typo shouldn't reach the API.\n return cfg.box.daytonaClass === 'container' ? 'container' : 'linux-vm';\n}\n\n/**\n * The region to create in. An explicit `box.daytonaRegion` always wins (so a\n * user can follow Daytona to a second VM region the day one appears, without\n * waiting on a release). Empty derives from the class; for `container` we\n * return '' and let the SDK use the account default, preserving today's\n * behavior for existing users byte-for-byte.\n */\nexport function resolveDaytonaRegion(cfg: EffectiveConfig): string {\n // `?? ''` rather than trusting the type: callers can hand us a config that\n // predates these keys (a partially-merged or hand-built object), and a\n // resolver that throws on a missing optional key is a poor neighbour.\n const explicit = (cfg.box.daytonaRegion ?? '').trim();\n if (explicit.length > 0) return explicit;\n return resolveDaytonaClass(cfg) === 'linux-vm' ? DAYTONA_VM_REGION : '';\n}\n","import { mkdir, open, rm, stat } from 'node:fs/promises';\nimport { dirname } from 'node:path';\nimport { setTimeout as delay } from 'node:timers/promises';\n\n// Cross-process lock tunables. The lock guards a read-modify-write of a file\n// several agentbox processes share — two concurrent image bakes, for instance,\n// both pin their `box.image<Provider>` into the global config from separate\n// detached workers. Held for one read+write (sub-millisecond), so contention\n// clears fast.\nconst LOCK_STALE_MS = 15_000; // a lock older than this is presumed abandoned\nconst LOCK_ACQUIRE_TIMEOUT_MS = 20_000;\nconst LOCK_RETRY_MS = 25;\n\n/**\n * Run `fn` while holding an exclusive cross-process lock on `${path}.lock`.\n *\n * Acquisition: create the lockfile with `wx` (O_EXCL) — atomic on local FSes.\n * On contention, retry with a short backoff until {@link LOCK_ACQUIRE_TIMEOUT_MS};\n * a lockfile older than {@link LOCK_STALE_MS} is treated as abandoned (crashed\n * holder) and forcibly broken. If the lock still can't be taken before the\n * timeout we proceed anyway — the write itself is atomic (temp+rename) so the\n * worst case degrades to a possible lost update, never a corrupt file. The lock\n * is always released in `finally`.\n */\nexport async function withFileLock<T>(path: string, fn: () => Promise<T>): Promise<T> {\n const lockPath = `${path}.lock`;\n await mkdir(dirname(path), { recursive: true });\n const deadline = Date.now() + LOCK_ACQUIRE_TIMEOUT_MS;\n let held = false;\n while (!held) {\n try {\n const fh = await open(lockPath, 'wx');\n await fh.writeFile(`${String(process.pid)}\\n`);\n await fh.close();\n held = true;\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code !== 'EEXIST') throw err;\n // Break a stale lock left by a crashed holder.\n try {\n const st = await stat(lockPath);\n if (Date.now() - st.mtimeMs > LOCK_STALE_MS) {\n await rm(lockPath, { force: true });\n continue;\n }\n } catch {\n // lock vanished between open and stat — retry immediately\n continue;\n }\n if (Date.now() >= deadline) break; // give up waiting; proceed best-effort\n await delay(LOCK_RETRY_MS);\n }\n }\n try {\n return await fn();\n } finally {\n if (held) await rm(lockPath, { force: true }).catch(() => {});\n }\n}\n","import { mkdir, readFile, rename, rm, stat, writeFile } from 'node:fs/promises';\nimport { dirname, isAbsolute, join } from 'node:path';\nimport { parse as parseYaml, stringify as stringifyYaml } from 'yaml';\nimport {\n configPathFor,\n findProjectRoot,\n hashProjectPath,\n PROJECTS_DIR,\n projectConfigFile,\n projectMetaFile,\n} from './paths.js';\nimport { coerceFromString, parseUserConfig } from './parse.js';\nimport { parseProviderSpec } from './provider-spec.js';\nimport { withFileLock } from './file-lock.js';\nimport { type ConfigScope, lookupKey, type UserConfig, UserConfigError } from './types.js';\nimport { readdir } from 'node:fs/promises';\n\ninterface WriteResult {\n path: string;\n /** The value we coerced and stored, after string→typed conversion. */\n coerced: unknown;\n /**\n * Every leaf actually written, in order. Usually just the requested key —\n * `box.provider: docker:hub` is the exception, splitting into two (see\n * {@link providerSpecLeaves}). Callers that report what they did should print\n * these rather than the key they asked for.\n */\n written: readonly { key: string; value: unknown }[];\n}\n\ninterface SetOptions {\n /**\n * When true (the CLI `set` path), accept a string and coerce. When false\n * (programmatic), accept any typed value and write it through after a\n * round-trip parse for validation.\n */\n raw?: boolean;\n}\n\n/**\n * The leaves a `set` actually writes. `box.provider: docker:hub` is sugar for a\n * PAIR — the provider name plus the engine — so it expands to two keys and the\n * stored `box.provider` stays a bare `ProviderKind`. The parser desugars the\n * same way on read (`desugarProviderSpec`), so a hand-edited file and a file we\n * wrote behave identically; this just keeps files we write already-canonical.\n */\nfunction providerSpecLeaves(\n key: string,\n value: unknown,\n): readonly { key: string; value: unknown }[] {\n if (key !== 'box.provider' || typeof value !== 'string') return [{ key, value }];\n const spec = parseProviderSpec(value);\n if (spec.remoteHost === undefined) return [{ key, value }];\n return [\n { key: 'box.provider', value: spec.name },\n { key: 'box.remoteDockerHost', value: spec.remoteHost },\n ];\n}\n\n/**\n * Set one dotted key in a `config.yaml` **body**, preserving everything else,\n * and return the new body. Pure — no filesystem — so a caller holding a config\n * file that isn't on this machine can merge into it.\n *\n * That is the reason this exists separately from {@link setConfigValue}: the\n * hetzner control-plane deploy has to write `box.claudeInstall` into the VPS's\n * config, which the hub *also* writes itself (`box.remoteDockerHost`). Uploading\n * a freshly-generated file would silently drop the hub's own keys on every\n * redeploy, so the deploy reads the remote body, merges here, and uploads.\n *\n * Validates the merged document the same way `setConfigValue` does; an unknown\n * key or a body whose top level isn't a mapping throws `UserConfigError`.\n */\nexport function mergeConfigYaml(body: string, key: string, value: unknown): string {\n if (!lookupKey(key)) {\n throw new UserConfigError(`unknown key \"${key}\"`);\n }\n const doc = parseDocBody(body, '<config.yaml>');\n for (const leaf of providerSpecLeaves(key, value)) setLeaf(doc, leaf.key, leaf.value);\n stampSchema(doc);\n const merged = stringifyYaml(doc);\n parseUserConfig(merged, '<config.yaml>');\n return merged;\n}\n\n/**\n * Write a single key into the chosen scope's config file. Creates parent\n * dirs and (for project scope) the meta.json sidecar. Atomic via tmp-rename.\n *\n * The read-modify-write runs under a cross-process file lock: unrelated\n * agentbox processes write the same global `config.yaml` concurrently (two\n * parallel image bakes each pin their own `box.image<Provider>` from a separate\n * detached worker), and without the lock the later writer's read would predate\n * the earlier one's write and silently drop its key.\n */\nexport async function setConfigValue(\n scope: ConfigScope,\n key: string,\n value: unknown,\n cwd: string,\n opts: SetOptions = {},\n): Promise<WriteResult> {\n if (!lookupKey(key)) {\n throw new UserConfigError(`unknown key \"${key}\"`);\n }\n\n const coerced = opts.raw && typeof value === 'string' ? coerceFromString(key, value) : value;\n\n const written = providerSpecLeaves(key, coerced);\n\n const path = await configPathFor(scope, cwd);\n await withFileLock(path, async () => {\n const current = await readExistingDoc(path);\n // Both leaves land under ONE lock: a half-written pair would leave the\n // provider pointing at remote-docker with no engine to reach.\n for (const leaf of written) setLeaf(current, leaf.key, leaf.value);\n stampSchema(current);\n // Re-parse to validate the merged document; any change that produces an\n // invalid file (shouldn't be possible here, but defence-in-depth) throws.\n parseUserConfig(stringifyYaml(current), path);\n await atomicWriteYaml(path, current);\n });\n\n if (scope === 'project') {\n const root = (await findProjectRoot(cwd)).root;\n await touchProjectMeta(root);\n }\n\n return { path, coerced, written };\n}\n\n/**\n * Remove a key from the chosen scope's config file. Empty parent objects are\n * pruned so the file stays tidy. ENOENT is treated as success. Locked like\n * {@link setConfigValue} — same read-modify-write, same lost-update hazard.\n */\nexport async function unsetConfigValue(\n scope: ConfigScope,\n key: string,\n cwd: string,\n): Promise<{ path: string; existed: boolean }> {\n if (!lookupKey(key)) {\n throw new UserConfigError(`unknown key \"${key}\"`);\n }\n const path = await configPathFor(scope, cwd);\n const existed = await withFileLock(path, async () => {\n const current = await readExistingDoc(path);\n if (!unsetLeaf(current, key)) return false;\n stampSchema(current);\n await atomicWriteYaml(path, current);\n return true;\n });\n if (!existed) return { path, existed: false };\n if (scope === 'project') {\n const root = (await findProjectRoot(cwd)).root;\n await touchProjectMeta(root);\n }\n return { path, existed: true };\n}\n\nexport interface ProjectEntry {\n /** SHA-1 (first 16 hex chars) of `originalPath` — the canonical key. */\n hash: string;\n /**\n * On-disk dir name under `PROJECTS_DIR`. Equal to the hash for legacy\n * pre-rename dirs; `<hash>-<mnemonic>` for new dirs. Used directly when we\n * need to `rm` the dir so the call works regardless of which shape happens\n * to be on disk.\n */\n dirName: string;\n originalPath: string;\n createdAt: string | null;\n lastSeenAt: string | null;\n configPath: string;\n hasConfigFile: boolean;\n /**\n * The repo this project's folder pointed at, recorded when it was last seen.\n * Outlives the folder on purpose: a control box builds boxes from throwaway\n * clones, so by the time it needs the origin to clone again, the directory it\n * would have read `git remote` from is gone.\n */\n originUrl?: string;\n}\n\n/**\n * Enumerate per-project config dirs. The meta.json's recorded\n * `originalPath` is what we report — the hash on disk is opaque.\n */\nexport async function listProjectsConfigured(): Promise<ProjectEntry[]> {\n let entries: string[];\n try {\n entries = await readdir(PROJECTS_DIR);\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') return [];\n throw err;\n }\n const out: ProjectEntry[] = [];\n for (const dirName of entries) {\n // Dir shape is `<sha1-16>` (legacy) or `<sha1-16>-<mnemonic>` (current);\n // either way the leading 16 hex chars are the canonical key.\n const m = /^([0-9a-f]{16})(?:-.+)?$/.exec(dirName);\n if (!m) continue;\n const hash = m[1]!;\n const meta = await readMeta(dirName);\n if (!meta) continue;\n const cfgPath = projectConfigFile(meta.originalPath);\n const hasConfig = await fileExists(cfgPath);\n out.push({\n hash,\n dirName,\n originalPath: meta.originalPath,\n createdAt: meta.createdAt,\n lastSeenAt: meta.lastSeenAt,\n configPath: cfgPath,\n hasConfigFile: hasConfig,\n ...(meta.originUrl ? { originUrl: meta.originUrl } : {}),\n });\n }\n out.sort((a, b) => a.originalPath.localeCompare(b.originalPath));\n return out;\n}\n\nexport interface PruneOrphanProjectConfigsOptions {\n dryRun?: boolean;\n /** Absolute project roots of live boxes — kept even if the folder is gone. */\n protectedPaths?: string[];\n}\n\nexport interface PruneOrphanProjectConfigsResult {\n removed: { hash: string; originalPath: string }[];\n dryRun: boolean;\n}\n\n/**\n * Delete `~/.agentbox/projects/<hash>/` dirs whose recorded `originalPath`\n * workspace folder no longer exists on disk. Conservative by construction:\n * only an ENOENT on `originalPath` counts as orphaned (a transient/permission\n * error is never treated as \"deleted\"), and any path in `protectedPaths` (the\n * project roots of still-live boxes) is left alone. Best-effort and\n * idempotent — a failed `rm` is swallowed.\n */\nexport async function pruneOrphanProjectConfigs(\n opts: PruneOrphanProjectConfigsOptions = {},\n): Promise<PruneOrphanProjectConfigsResult> {\n const dryRun = opts.dryRun ?? false;\n const keep = new Set(opts.protectedPaths ?? []);\n const removed: { hash: string; originalPath: string }[] = [];\n for (const entry of await listProjectsConfigured()) {\n if (!isAbsolute(entry.originalPath) || keep.has(entry.originalPath)) continue;\n let missing = false;\n try {\n await stat(entry.originalPath);\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') missing = true;\n }\n if (!missing) continue;\n removed.push({ hash: entry.hash, originalPath: entry.originalPath });\n if (!dryRun) {\n try {\n // Remove by the on-disk dir name (originalPath is gone, so recomputing\n // the segment from it would be pointless; entry.dirName preserves\n // whichever shape — legacy `<hash>` or new `<hash>-<mnemonic>` —\n // happens to be on disk).\n await rm(join(PROJECTS_DIR, entry.dirName), { recursive: true, force: true });\n } catch {\n /* best-effort */\n }\n }\n }\n return { removed, dryRun };\n}\n\n/**\n * Sidecar counter for the periodic create-time sweep. Lives inside\n * `PROJECTS_DIR` but `listProjectsConfigured` only reads 16-hex-named dirs, so\n * a dotfile here is invisible to it.\n */\nconst PROJECT_GC_COUNTER_FILE = join(PROJECTS_DIR, '.gc.json');\n\n/** Read `{creates}` (0 if missing/corrupt), increment, atomic-write, return new value. */\nexport async function bumpProjectGcCounter(): Promise<number> {\n let prior = 0;\n try {\n const parsed = JSON.parse(await readFile(PROJECT_GC_COUNTER_FILE, 'utf8')) as {\n creates?: unknown;\n };\n if (typeof parsed.creates === 'number' && Number.isFinite(parsed.creates)) {\n prior = parsed.creates;\n }\n } catch {\n /* missing or corrupt -> start from 0 */\n }\n const next = prior + 1;\n await mkdir(PROJECTS_DIR, { recursive: true });\n const tmp = `${PROJECT_GC_COUNTER_FILE}.tmp-${process.pid.toString()}-${Date.now().toString(36)}`;\n await writeFile(tmp, JSON.stringify({ creates: next }) + '\\n', { encoding: 'utf8', mode: 0o644 });\n await rename(tmp, PROJECT_GC_COUNTER_FILE);\n return next;\n}\n\nasync function readMeta(dirName: string): Promise<{\n originalPath: string;\n createdAt: string | null;\n lastSeenAt: string | null;\n originUrl: string | null;\n} | null> {\n const metaPath = `${PROJECTS_DIR}/${dirName}/meta.json`;\n try {\n const text = await readFile(metaPath, 'utf8');\n const parsed = JSON.parse(text) as Record<string, unknown>;\n if (typeof parsed['originalPath'] !== 'string') return null;\n return {\n originalPath: parsed['originalPath'],\n createdAt: typeof parsed['createdAt'] === 'string' ? parsed['createdAt'] : null,\n lastSeenAt: typeof parsed['lastSeenAt'] === 'string' ? parsed['lastSeenAt'] : null,\n originUrl: typeof parsed['originUrl'] === 'string' ? parsed['originUrl'] : null,\n };\n } catch {\n return null;\n }\n}\n\nasync function fileExists(p: string): Promise<boolean> {\n try {\n const st = await stat(p);\n return st.isFile();\n } catch {\n return false;\n }\n}\n\n/**\n * Read the file as a RAW yaml mapping for round-tripping. Deliberately not\n * `parseUserConfig`: that drops keys it doesn't recognize, and this document is\n * written straight back to disk — so parsing here would silently DELETE any key\n * the current registry doesn't know (e.g. one written by a newer agentbox) on\n * the next `config set`. Validation of the merged doc still happens in\n * `setConfigValue`; the key being set is validated by `lookupKey`.\n */\n/**\n * Parse a config-file body into a mutable doc. An empty/blank body is an empty\n * doc (that's how a first write starts), `label` only names the source in errors.\n */\nfunction parseDocBody(text: string, label: string): Partial<UserConfig> {\n let doc: unknown;\n try {\n doc = parseYaml(text);\n } catch (err) {\n throw new UserConfigError(\n `${label}: yaml parse error: ${err instanceof Error ? err.message : String(err)}`,\n );\n }\n if (doc === null || doc === undefined) return {};\n if (typeof doc !== 'object' || Array.isArray(doc)) {\n throw new UserConfigError(`${label}: top-level must be a mapping`);\n }\n return doc as Partial<UserConfig>;\n}\n\nasync function readExistingDoc(path: string): Promise<Partial<UserConfig>> {\n let text: string;\n try {\n text = await readFile(path, 'utf8');\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') return {};\n throw err;\n }\n return parseDocBody(text, path);\n}\n\n/**\n * Stamp `schema: 1` on a doc that hasn't been stamped yet. Idempotent — a\n * doc already carrying any `schema` value is left alone. Future schema\n * bumps live here.\n */\nconst CURRENT_CONFIG_SCHEMA = 1;\nfunction stampSchema(doc: Partial<UserConfig>): void {\n if (typeof doc.schema !== 'number') {\n doc.schema = CURRENT_CONFIG_SCHEMA;\n }\n}\n\nfunction setLeaf(doc: Partial<UserConfig>, key: string, value: unknown): void {\n const segs = key.split('.');\n let cur = doc as unknown as Record<string, unknown>;\n for (let i = 0; i < segs.length - 1; i++) {\n const seg = segs[i]!;\n const next = cur[seg];\n if (!next || typeof next !== 'object') {\n cur[seg] = {};\n }\n cur = cur[seg] as Record<string, unknown>;\n }\n cur[segs[segs.length - 1]!] = value;\n}\n\nfunction unsetLeaf(doc: Partial<UserConfig>, key: string): boolean {\n const segs = key.split('.');\n const path: Record<string, unknown>[] = [doc as unknown as Record<string, unknown>];\n for (let i = 0; i < segs.length - 1; i++) {\n const seg = segs[i]!;\n const next = path[path.length - 1]![seg];\n if (!next || typeof next !== 'object') return false;\n path.push(next as Record<string, unknown>);\n }\n const leafSeg = segs[segs.length - 1]!;\n const leafContainer = path[path.length - 1]!;\n if (!(leafSeg in leafContainer)) return false;\n delete leafContainer[leafSeg];\n // Prune empty parent objects from leaf-most up so the YAML stays tidy.\n for (let i = path.length - 1; i > 0; i--) {\n if (Object.keys(path[i]!).length > 0) break;\n delete path[i - 1]![segs[i - 1]!];\n }\n return true;\n}\n\nasync function atomicWriteYaml(path: string, doc: Partial<UserConfig>): Promise<void> {\n await mkdir(dirname(path), { recursive: true });\n // YAML serialises empty objects as `{}` which is correct but ugly; if the\n // doc is empty we still want a usable placeholder file.\n const text =\n Object.keys(doc).length === 0 ? '# managed by agentbox config — empty\\n' : stringifyYaml(doc);\n const tmp = `${path}.tmp-${process.pid.toString()}-${Date.now().toString(36)}`;\n await writeFile(tmp, text, { encoding: 'utf8', mode: 0o644 });\n await rename(tmp, path);\n}\n\n/**\n * Register a project (a folder on the PC) in the on-disk registry so it is\n * enumerable via {@link listProjectsConfigured} even before it has any config\n * value or any box. Idempotent: creates `~/.agentbox/projects/<hash>/meta.json`\n * on first call and refreshes `lastSeenAt` (preserving `createdAt`) after.\n *\n * `absPath` should be a canonical project root (e.g. `findProjectRoot(cwd).root`).\n * Callers that start from an arbitrary user path should canonicalize first.\n */\nexport async function registerProject(\n absPath: string,\n opts: { originUrl?: string } = {},\n): Promise<void> {\n await touchProjectMeta(absPath, opts.originUrl);\n}\n\n/**\n * Remove a project from the on-disk registry by its {@link hashProjectPath}\n * hash — deletes `~/.agentbox/projects/<hash>-<mnemonic>/`, i.e. its `meta.json`\n * and any project-scoped `config.yaml` the user set for that folder. Does NOT\n * touch the workspace folder/files, its git repo, or checkpoints (a separate\n * `~/.agentbox/checkpoints/` tree). Idempotent: returns `false` when the hash\n * isn't registered (nothing to remove). Mirrors the delete\n * {@link pruneOrphanProjectConfigs} does (rm by the on-disk `dirName`).\n */\nexport async function unregisterProject(hash: string): Promise<boolean> {\n const entry = (await listProjectsConfigured()).find((e) => e.hash === hash);\n if (!entry) return false;\n await rm(join(PROJECTS_DIR, entry.dirName), { recursive: true, force: true });\n return true;\n}\n\nasync function touchProjectMeta(absPath: string, originUrl?: string): Promise<void> {\n const dir = dirname(projectMetaFile(absPath));\n await mkdir(dir, { recursive: true });\n const metaPath = projectMetaFile(absPath);\n let prior: { originalPath?: string; createdAt?: string; originUrl?: string } = {};\n try {\n prior = JSON.parse(await readFile(metaPath, 'utf8')) as typeof prior;\n } catch {\n /* fresh file */\n }\n const now = new Date().toISOString();\n // A caller that didn't read an origin (the folder may be gone) must not erase\n // the one recorded when it was there.\n const origin = originUrl ?? prior.originUrl;\n const next = {\n originalPath: absPath,\n hash: hashProjectPath(absPath),\n createdAt: prior.createdAt ?? now,\n lastSeenAt: now,\n ...(origin ? { originUrl: origin } : {}),\n };\n const tmp = `${metaPath}.tmp-${process.pid.toString()}-${Date.now().toString(36)}`;\n await writeFile(tmp, JSON.stringify(next, null, 2) + '\\n', { encoding: 'utf8', mode: 0o644 });\n await rename(tmp, metaPath);\n}\n\n// Re-export for ergonomics; same path resolution as the loader uses.\nexport { configPathFor };\n","/**\n * Host-tool grants — the authoritative, host-only record of which host CLIs\n * a box may reach through the relay.\n *\n * The trust split matters: a project's `agentbox.yaml` `tools:` block only\n * *requests* access (it is committed, and a cloned repo must not be able to\n * wire itself to the host's credentials). The host approves a request once,\n * and the approval lands here. The relay consults only this file, so an\n * unapproved yaml entry is inert.\n *\n * Layered global < project, mirroring `loadEffectiveConfig`: a global grant\n * applies to every project, a project grant only to its own. Project wins on\n * name collision so a project can narrow (add a `deny`) what a global grant\n * allows.\n */\n\nimport { mkdir, readFile, writeFile } from 'node:fs/promises';\nimport { dirname } from 'node:path';\nimport { parse as parseYaml, stringify as stringifyYaml } from 'yaml';\nimport { findProjectRoot, GLOBAL_TOOLS_FILE, projectToolsFile } from './paths.js';\n\n/** Where a grant came from; surfaced by `agentbox tools list`. */\nexport type ToolGrantSource = 'builtin' | 'cli' | 'yaml' | 'request';\n\nexport interface ToolGrant {\n /** Command name the box types, and the basename of its shim symlink. */\n name: string;\n /** Host binary actually executed. Defaults to `name`. */\n bin: string;\n /**\n * Argv patterns (JS regexes, matched against the space-joined argv) that\n * run without a host prompt even when prompting is otherwise on. Use for\n * the read-only subcommands of a chatty CLI.\n */\n allow?: string[];\n /**\n * Argv patterns refused outright, before any prompt or spawn. Layered on\n * top of the built-in credential deny list, never replacing it.\n */\n deny?: string[];\n /** Per-call wall-clock budget; host tools are non-interactive. */\n timeoutMs?: number;\n source: ToolGrantSource;\n /** ISO timestamp of the approval that created this grant. */\n approvedAt?: string;\n}\n\n/** On-disk shape of a `tools.yaml`. */\ninterface ToolsFile {\n tools?: Record<string, Omit<ToolGrant, 'name'> | null>;\n}\n\n/**\n * The one grant every box gets for free. `gh` predates this system — Claude\n * Code's PR badge and our documented agent flows call it — and it keeps its\n * bespoke relay handler (branch injection, the `gh api` endpoint allowlist),\n * so it is listed here for discoverability but never dispatched through\n * `tool.run`. `tools.gh.enabled: false` revokes it.\n */\nexport const BUILTIN_GH_GRANT: ToolGrant = {\n name: 'gh',\n bin: 'gh',\n source: 'builtin',\n};\n\n/**\n * Every granted tool for `cwd`, keyed by name. Global grants first, project\n * grants layered on top. Never throws: a malformed or unreadable grant file\n * yields no grants, so the relay fails closed.\n *\n * `cwd` is resolved to its project root first, exactly as `loadEffectiveConfig`\n * does. Hashing the raw cwd would key a subdirectory to a different project\n * (so `agentbox doctor` two levels down would report no grants) and would\n * miss on symlinked paths, where the writer canonicalises and the reader\n * would not.\n */\nexport async function loadGrantedTools(\n cwd: string,\n opts: { includeBuiltins?: boolean } = {},\n): Promise<Map<string, ToolGrant>> {\n const merged = new Map<string, ToolGrant>();\n if (opts.includeBuiltins !== false) merged.set(BUILTIN_GH_GRANT.name, BUILTIN_GH_GRANT);\n let root = cwd;\n try {\n root = (await findProjectRoot(cwd)).root;\n } catch {\n // Fall back to the literal cwd; a lookup failure must not throw here.\n }\n for (const file of [GLOBAL_TOOLS_FILE, projectToolsFile(root)]) {\n for (const grant of await readToolsFile(file)) merged.set(grant.name, grant);\n }\n return merged;\n}\n\n/**\n * Where a project-scoped grant for `cwd` is written. Shares the project-root\n * resolution with {@link loadGrantedTools} so a write and the relay's read\n * always land on the same file.\n */\nexport async function resolveProjectToolsFile(cwd: string): Promise<string> {\n try {\n return projectToolsFile((await findProjectRoot(cwd)).root);\n } catch {\n return projectToolsFile(cwd);\n }\n}\n\n/** Read one grant file; `[]` when absent or malformed (fail closed). */\nexport async function readToolsFile(file: string): Promise<ToolGrant[]> {\n let raw: string;\n try {\n raw = await readFile(file, 'utf8');\n } catch {\n return [];\n }\n let doc: unknown;\n try {\n doc = parseYaml(raw);\n } catch {\n return [];\n }\n const tools = (doc as ToolsFile | null)?.tools;\n if (!tools || typeof tools !== 'object') return [];\n const out: ToolGrant[] = [];\n for (const [name, value] of Object.entries(tools)) {\n if (!isValidToolName(name)) continue;\n const entry = (value ?? {}) as Partial<ToolGrant>;\n out.push({\n name,\n bin: typeof entry.bin === 'string' && entry.bin ? entry.bin : name,\n ...(stringArray(entry.allow) ? { allow: stringArray(entry.allow) } : {}),\n ...(stringArray(entry.deny) ? { deny: stringArray(entry.deny) } : {}),\n ...(typeof entry.timeoutMs === 'number' && entry.timeoutMs > 0\n ? { timeoutMs: entry.timeoutMs }\n : {}),\n source: isGrantSource(entry.source) ? entry.source : 'cli',\n ...(typeof entry.approvedAt === 'string' ? { approvedAt: entry.approvedAt } : {}),\n });\n }\n return out;\n}\n\n/**\n * Write (or overwrite) one grant in a grant file, preserving the others.\n * Read-modify-write rather than a merge helper because the file is small and\n * only ever touched by an interactive approval.\n */\nexport async function writeToolGrant(file: string, grant: ToolGrant): Promise<void> {\n const existing = await readToolsFile(file);\n const byName = new Map(existing.map((g) => [g.name, g]));\n byName.set(grant.name, grant);\n await persist(file, [...byName.values()]);\n}\n\n/** Remove a grant. Returns false when it wasn't there. */\nexport async function removeToolGrant(file: string, name: string): Promise<boolean> {\n const existing = await readToolsFile(file);\n const kept = existing.filter((g) => g.name !== name);\n if (kept.length === existing.length) return false;\n await persist(file, kept);\n return true;\n}\n\nasync function persist(file: string, grants: ToolGrant[]): Promise<void> {\n await mkdir(dirname(file), { recursive: true });\n const tools: Record<string, Omit<ToolGrant, 'name'>> = {};\n for (const g of grants.sort((a, b) => a.name.localeCompare(b.name))) {\n const rest: Omit<ToolGrant, 'name'> = { bin: g.bin, source: g.source };\n if (g.allow) rest.allow = g.allow;\n if (g.deny) rest.deny = g.deny;\n if (g.timeoutMs !== undefined) rest.timeoutMs = g.timeoutMs;\n if (g.approvedAt) rest.approvedAt = g.approvedAt;\n tools[g.name] = rest;\n }\n const header =\n '# agentbox host-tool grants — written by `agentbox tools` and by approved\\n' +\n '# in-box `agentbox-ctl tool request` calls. The relay reads only this file;\\n' +\n '# an agentbox.yaml `tools:` entry is a request until it is approved here.\\n';\n await writeFile(file, header + stringifyYaml({ tools }), 'utf8');\n}\n\n/**\n * A tool name becomes a `~/.local/bin/<name>` symlink inside the box, so it\n * has to be a plain command name — no path separators, no leading dash, no\n * shell metacharacters.\n */\nexport function isValidToolName(name: string): boolean {\n return /^[a-zA-Z0-9][a-zA-Z0-9._+-]{0,63}$/.test(name);\n}\n\nfunction stringArray(v: unknown): string[] | undefined {\n if (!Array.isArray(v)) return undefined;\n const out = v.filter((x): x is string => typeof x === 'string' && x.length > 0);\n return out.length > 0 ? out : undefined;\n}\n\nfunction isGrantSource(v: unknown): v is ToolGrantSource {\n return v === 'builtin' || v === 'cli' || v === 'yaml' || v === 'request';\n}\n"],"mappings":";;;AGAA,SAA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,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,YAAY,CAAC,UAAU,KAAK;IAC5B,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,YAAY,CAAC,WAAW,cAAc,MAAM;IAC5C,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;IACF,UAAU;EACZ;EACA,GAAG,qBAAqB;EACxB;IACE,KAAK;IACL,MAAM;IACN,aACE;IACF,UAAU;EACZ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;IACF,UAAU;EACZ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;IACF,UAAU;EACZ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,YAAY,CAAC,SAAS,UAAU,OAAO,MAAM;IAC7C,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,YAAY,CAAC,UAAU,UAAU,MAAM;IACvC,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,YAAY,CAAC,YAAY,kBAAkB,SAAS,MAAM;IAC1D,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,YAAY,CAAC,iBAAiB,cAAc,MAAM;IAClD,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;IACb,UAAU;EACZ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;IACF,UAAU;EACZ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;IACF,UAAU;EACZ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;IACF,UAAU;EACZ;EACA;IACE,KAAK;IACL,MAAM;IACN,YAAY,CAAC,QAAQ,SAAS,SAAS,QAAQ;IAC/C,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,YAAY,CAAC,QAAQ,QAAQ,OAAO;IACpC,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,YAAY,CAAC,MAAM,KAAK;IACxB,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;IACb,UAAU;EACZ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;IACF,UAAU;EACZ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,YAAY,CAAC,QAAQ,SAAS,UAAU,KAAK;IAC7C,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,YAA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