@madarco/agentbox 0.21.0 → 0.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +109 -0
- package/README.md +32 -0
- package/dist/{_cloud-attach-U3QJO7IF.js → _cloud-attach-YH2SU75S.js} +5 -4
- package/dist/chunk-ALEYDWAO.js +2561 -0
- package/dist/chunk-ALEYDWAO.js.map +1 -0
- package/dist/{chunk-QKL7PCXQ.js → chunk-CDEJ2GQK.js} +836 -488
- package/dist/chunk-CDEJ2GQK.js.map +1 -0
- package/dist/{chunk-PX7G4PSI.js → chunk-GGWVTWJM.js} +65 -34
- package/dist/{chunk-PX7G4PSI.js.map → chunk-GGWVTWJM.js.map} +1 -1
- package/dist/chunk-KBVD2UUQ.js +1654 -0
- package/dist/chunk-KBVD2UUQ.js.map +1 -0
- package/dist/{chunk-IXQTUXWV.js → chunk-O2NDZQHN.js} +50 -52
- package/dist/{chunk-IXQTUXWV.js.map → chunk-O2NDZQHN.js.map} +1 -1
- package/dist/{dist-NWKOEWUJ.js → chunk-O67ZESNL.js} +1059 -109
- package/dist/chunk-O67ZESNL.js.map +1 -0
- package/dist/chunk-VBSRJG53.js +1241 -0
- package/dist/chunk-VBSRJG53.js.map +1 -0
- package/dist/{chunk-6JJIKCMY.js → chunk-W2FLHB54.js} +26 -56
- package/dist/chunk-W2FLHB54.js.map +1 -0
- package/dist/{chunk-YZVFGFYQ.js → chunk-YZXXBHWG.js} +1937 -2975
- package/dist/chunk-YZXXBHWG.js.map +1 -0
- package/dist/{dist-SAS4PIHA.js → dist-EJXUKIR7.js} +41 -36
- package/dist/{dist-UVQJ2BZJ.js → dist-LJHS4PTC.js} +112 -62
- package/dist/dist-LJHS4PTC.js.map +1 -0
- package/dist/dist-QBXEP4VY.js +89 -0
- package/dist/dist-QNV4H6NN.js +80 -0
- package/dist/dist-QNV4H6NN.js.map +1 -0
- package/dist/{dist-FMA5Y25B.js → dist-UR2DB2HT.js} +83 -9
- package/dist/dist-UR2DB2HT.js.map +1 -0
- package/dist/dist-YECTRVGD.js +102 -0
- package/dist/dist-YECTRVGD.js.map +1 -0
- package/dist/index.js +3243 -1448
- package/dist/index.js.map +1 -1
- package/dist/{prepared-state-MQHD3M5F-YYVVMTNJ.js → prepared-state-5FIGV4BE-BMUK63FD.js} +2 -2
- package/dist/prepared-state-5FIGV4BE-BMUK63FD.js.map +1 -0
- package/package.json +12 -5
- package/runtime/_shared/agentbox-checkpoint-cleanup +55 -0
- package/runtime/_shared/agentbox-codex-hooks.json +68 -0
- package/runtime/_shared/agentbox-dockerd-start +145 -0
- package/runtime/_shared/agentbox-open +28 -0
- package/runtime/_shared/agentbox-portless-trust +82 -0
- package/runtime/_shared/agentbox-setup-skill.md +317 -0
- package/runtime/_shared/agentbox-vnc-start +102 -0
- package/runtime/_shared/claude-managed-settings.json +116 -0
- package/runtime/_shared/ctl.cjs +27469 -0
- package/runtime/_shared/gh-shim +344 -0
- package/runtime/_shared/git-shim +131 -0
- package/runtime/_shared/linear-shim +181 -0
- package/runtime/_shared/ntn-shim +95 -0
- package/runtime/_shared/opencode-agentbox-plugin.js +76 -0
- package/runtime/docker/Dockerfile.box +30 -17
- package/runtime/docker/packages/ctl/dist/bin.cjs +11871 -10351
- package/runtime/e2b/ctl.cjs +11871 -10351
- package/runtime/e2b/scripts/build-template.sh +31 -15
- package/runtime/hetzner/ctl.cjs +11871 -10351
- package/runtime/hetzner/scripts/install-box.sh +37 -19
- package/runtime/hub/apps/hub/.next/BUILD_ID +1 -0
- package/runtime/hub/apps/hub/.next/app-path-routes-manifest.json +36 -0
- package/runtime/hub/apps/hub/.next/build-manifest.json +21 -0
- package/runtime/hub/apps/hub/.next/package.json +1 -0
- package/runtime/hub/apps/hub/.next/prerender-manifest.json +36 -0
- package/runtime/hub/apps/hub/.next/required-server-files.json +350 -0
- package/runtime/hub/apps/hub/.next/routes-manifest.json +292 -0
- package/runtime/hub/apps/hub/.next/server/app/(auth)/api/auth/[...all]/route/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(auth)/api/auth/[...all]/route/build-manifest.json +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(auth)/api/auth/[...all]/route/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/(auth)/api/auth/[...all]/route.js +13 -0
- package/runtime/hub/apps/hub/.next/server/app/(auth)/api/auth/[...all]/route.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(auth)/api/auth/[...all]/route.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(auth)/api/auth/[...all]/route_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(auth)/signin/page/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(auth)/signin/page/build-manifest.json +17 -0
- package/runtime/hub/apps/hub/.next/server/app/(auth)/signin/page/next-font-manifest.json +13 -0
- package/runtime/hub/apps/hub/.next/server/app/(auth)/signin/page/react-loadable-manifest.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(auth)/signin/page/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/(auth)/signin/page.js +14 -0
- package/runtime/hub/apps/hub/.next/server/app/(auth)/signin/page.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(auth)/signin/page.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(auth)/signin/page_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/events/route/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/events/route/build-manifest.json +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/events/route/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/events/route.js +7 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/events/route.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/events/route.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/events/route_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/jobs/[id]/logs/route/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/jobs/[id]/logs/route/build-manifest.json +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/jobs/[id]/logs/route/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/jobs/[id]/logs/route.js +7 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/jobs/[id]/logs/route.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/jobs/[id]/logs/route.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/jobs/[id]/logs/route_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/[id]/answer/route/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/[id]/answer/route/build-manifest.json +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/[id]/answer/route/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/[id]/answer/route.js +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/[id]/answer/route.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/[id]/answer/route.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/[id]/answer/route_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/route/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/route/build-manifest.json +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/route/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/route.js +8 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/route.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/route.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/approvals/route_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/[action]/route/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/[action]/route/build-manifest.json +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/[action]/route/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/[action]/route.js +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/[action]/route.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/[action]/route.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/[action]/route_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/branches/route/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/branches/route/build-manifest.json +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/branches/route/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/branches/route.js +8 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/branches/route.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/branches/route.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/branches/route_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/[op]/route/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/[op]/route/build-manifest.json +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/[op]/route/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/[op]/route.js +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/[op]/route.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/[op]/route.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/[op]/route_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/route/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/route/build-manifest.json +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/route/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/route.js +8 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/route.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/route.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/git/route_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/route/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/route/build-manifest.json +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/route/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/route.js +8 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/route.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/route.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/route_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/restart/route/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/restart/route/build-manifest.json +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/restart/route/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/restart/route.js +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/restart/route.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/restart/route.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/restart/route_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/route/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/route/build-manifest.json +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/route/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/route.js +8 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/route.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/route.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/services/route_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/route/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/route/build-manifest.json +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/route/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/route.js +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/route.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/route.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/route_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/docs/route/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/docs/route/build-manifest.json +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/docs/route/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/docs/route.js +7 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/docs/route.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/docs/route.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/docs/route_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/health/route/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/health/route/build-manifest.json +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/health/route/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/health/route.js +8 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/health/route.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/health/route.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/health/route_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/login-code/route/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/login-code/route/build-manifest.json +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/login-code/route/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/login-code/route.js +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/login-code/route.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/login-code/route.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/login-code/route_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/logs/route/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/logs/route/build-manifest.json +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/logs/route/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/logs/route.js +8 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/logs/route.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/logs/route.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/logs/route_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/route/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/route/build-manifest.json +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/route/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/route.js +8 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/route.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/route.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/jobs/[id]/route_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/openapi.json/route/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/openapi.json/route/build-manifest.json +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/openapi.json/route/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/openapi.json/route.js +7 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/openapi.json/route.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/openapi.json/route.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/openapi.json/route_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/branches/route/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/branches/route/build-manifest.json +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/branches/route/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/branches/route.js +8 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/branches/route.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/branches/route.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/branches/route_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/route/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/route/build-manifest.json +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/route/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/route.js +8 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/route.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/route.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/[id]/route_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/route/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/route/build-manifest.json +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/route/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/route.js +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/route.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/route.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/projects/route_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/credentials/route/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/credentials/route/build-manifest.json +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/credentials/route/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/credentials/route.js +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/credentials/route.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/credentials/route.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/credentials/route_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/prepare/route/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/prepare/route/build-manifest.json +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/prepare/route/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/prepare/route.js +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/prepare/route.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/prepare/route.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/[id]/prepare/route_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/route/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/route/build-manifest.json +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/route/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/route.js +8 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/route.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/route.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/providers/route_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page/build-manifest.json +17 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page/next-font-manifest.json +13 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page/react-loadable-manifest.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page/server-reference-manifest.json +17 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page.js +17 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page/build-manifest.json +17 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page/next-font-manifest.json +13 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page/react-loadable-manifest.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page/server-reference-manifest.json +137 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page.js +17 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page/build-manifest.json +17 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page/next-font-manifest.json +13 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page/react-loadable-manifest.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page/server-reference-manifest.json +125 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page.js +17 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page/build-manifest.json +17 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page/next-font-manifest.json +13 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page/react-loadable-manifest.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page/server-reference-manifest.json +89 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page.js +17 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page/build-manifest.json +17 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page/next-font-manifest.json +13 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page/react-loadable-manifest.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page.js +16 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/[...path]/route/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/[...path]/route/build-manifest.json +9 -0
- package/runtime/hub/apps/hub/.next/server/app/[...path]/route/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/[...path]/route.js +8 -0
- package/runtime/hub/apps/hub/.next/server/app/[...path]/route.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/[...path]/route.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/[...path]/route_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/_global-error/page/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/_global-error/page/build-manifest.json +17 -0
- package/runtime/hub/apps/hub/.next/server/app/_global-error/page/next-font-manifest.json +6 -0
- package/runtime/hub/apps/hub/.next/server/app/_global-error/page/react-loadable-manifest.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/_global-error/page/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/_global-error/page.js +10 -0
- package/runtime/hub/apps/hub/.next/server/app/_global-error/page.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/_global-error/page.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/_global-error/page_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/_global-error.html +1 -0
- package/runtime/hub/apps/hub/.next/server/app/_global-error.meta +15 -0
- package/runtime/hub/apps/hub/.next/server/app/_global-error.rsc +14 -0
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +5 -0
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_full.segment.rsc +14 -0
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_head.segment.rsc +5 -0
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_index.segment.rsc +5 -0
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -0
- package/runtime/hub/apps/hub/.next/server/app/_not-found/page/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/_not-found/page/build-manifest.json +17 -0
- package/runtime/hub/apps/hub/.next/server/app/_not-found/page/next-font-manifest.json +13 -0
- package/runtime/hub/apps/hub/.next/server/app/_not-found/page/react-loadable-manifest.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/_not-found/page/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/_not-found/page.js +13 -0
- package/runtime/hub/apps/hub/.next/server/app/_not-found/page.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/_not-found/page.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/_not-found/page_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app-paths-manifest.json +36 -0
- package/runtime/hub/apps/hub/.next/server/chunks/01te_@better-auth_kysely-adapter_dist_0jw_ngm._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/01te_@better-auth_kysely-adapter_dist_0z6cvsk._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/01te_@better-auth_kysely-adapter_dist_210bxd8._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/01te_@better-auth_kysely-adapter_dist_index_mjs_0h-j5xt._.js +4 -0
- package/runtime/hub/apps/hub/.next/server/chunks/044u_hub__next-internal_server_app_(auth)_api_auth_[___all]_route_actions_1agi0ag.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/044u_hub__next-internal_server_app_(dashboard)_api_v1_boxes_route_actions_1ggp_5o.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/044u_hub__next-internal_server_app_(dashboard)_api_v1_health_route_actions_017gnzg.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/044u_hub__next-internal_server_app_(dashboard)_api_v1_projects_route_actions_04w8ozk.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/09mp_@better-auth_memory-adapter_dist_index_mjs_0ti_30h._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/09xn_next_0tn6frk._.js +6 -0
- package/runtime/hub/apps/hub/.next/server/chunks/0d-b_next_dist_server_app-render_after-task-async-storage_external_0-exn7p.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/0m4a_kysely_dist_095p8vu._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/0m4a_kysely_dist_1skbhvx._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/0sj1_@opentelemetry_api_build_esm_index_0xy-j06.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/0ssw__next-internal_server_app_(dashboard)_api_jobs_[id]_logs_route_actions_01aqmf3.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/0ssw__next-internal_server_app_(dashboard)_api_v1_approvals_route_actions_1vwxs9a.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/0ssw__next-internal_server_app_(dashboard)_api_v1_boxes_[id]_route_actions_01510xg.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/0ssw__next-internal_server_app_(dashboard)_api_v1_jobs_[id]_route_actions_0oc630h.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/0ssw__next-internal_server_app_(dashboard)_api_v1_openapi_json_route_actions_1lunxjz.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/0ssw__next-internal_server_app_(dashboard)_api_v1_providers_route_actions_1666ry8.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/0web_next-internal_server_app_(dashboard)_api_v1_projects_[id]_route_actions_1beikpx.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/0zhp_better-auth_dist_adapters_kysely-adapter_index_mjs_1rl4qnh._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/151__@better-auth_core_dist_0ecdp_3._.js +5 -0
- package/runtime/hub/apps/hub/.next/server/chunks/1jcg_server_app_(dashboard)_api_v1_approvals_[id]_answer_route_actions_1cq4z5x.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/1jcg_server_app_(dashboard)_api_v1_boxes_[id]_[action]_route_actions_0cib0ju.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/1jcg_server_app_(dashboard)_api_v1_boxes_[id]_branches_route_actions_15snjix.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/1jcg_server_app_(dashboard)_api_v1_boxes_[id]_git_[op]_route_actions_116a41w.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/1jcg_server_app_(dashboard)_api_v1_boxes_[id]_git_route_actions_1a-q-i2.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/1jcg_server_app_(dashboard)_api_v1_boxes_[id]_services_restart_route_actions_1yvsbmm.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/1jcg_server_app_(dashboard)_api_v1_boxes_[id]_services_route_actions_1uvv36v.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/1jcg_server_app_(dashboard)_api_v1_jobs_[id]_login-code_route_actions_1825jmw.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/1jcg_server_app_(dashboard)_api_v1_jobs_[id]_logs_route_actions_0msc0_w.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/1jcg_server_app_(dashboard)_api_v1_projects_[id]_branches_route_actions_07i0vrw.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/1jcg_server_app_(dashboard)_api_v1_providers_[id]_credentials_route_actions_1cds5re.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/1jcg_server_app_(dashboard)_api_v1_providers_[id]_prepare_route_actions_079fbng.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[externals]__12m3qoa._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[externals]_pg_15jfwkh._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__04h15ml._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__04jgk9x._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__07ednlo._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0d1lmiq._.js +105 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0ig1bot._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0keu6we._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0ql4fjo._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0se1fty._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0t7o5ed._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0vs8fma._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0vxaujy._.js +6 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0w9ud8u._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0yhb0gc._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1-9g0ae._.js +461 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__13jwk_k._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__16_uteg._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__16p2m-g._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__19pc87s._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1_gu2yk._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1ai-945._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1bqbkd5._.js +14 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1bu2zio._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1ctczev._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1d6mtlk._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1d75vsx._.js +6 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1dn_3i1._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1e4z_-v._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1f2sueq._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1f9zctr._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1hqla7-._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1js2jdv._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1mttufy._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1nepkp-._.js +6 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1pp5oib._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1q5bqse._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1qa4a0v._.js +14 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1qwhzmi._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1v9om6g._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1xeczo7._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__20503l7._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[turbopack]_runtime.js +903 -0
- package/runtime/hub/apps/hub/.next/server/chunks/_033w048._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/_06f2faq._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/_0760z6y._.js +27 -0
- package/runtime/hub/apps/hub/.next/server/chunks/_0pyhcqe._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/_1-42ili._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/_11__3wi._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/_12flzuh._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/_1rpkqst._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/_1wt72m1._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/_1x3l5t8._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/apps_hub__next-internal_server_app_(dashboard)_api_events_route_actions_17s9lxs.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/apps_hub__next-internal_server_app_(dashboard)_api_v1_docs_route_actions_0d-s_oo.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/apps_hub__next-internal_server_app_[___path]_route_actions_1hdraye.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/packages_relay_dist_control-plane_03a-9aj.js +86 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/044u_hub__next-internal_server_app_(dashboard)_projects_[id]_page_actions_15f56np.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_0iwlo01._.js +6 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_0xy-j7z._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_client_components_20xzgz2._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_client_components_builtin_forbidden_1x5yo9-.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_client_components_builtin_global-error_14poel6.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_client_components_builtin_unauthorized_0vj9qge.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_010858m.js +4 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_04zwxnx.js +4 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_06exuc7.js +4 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_0f2ldrt.js +4 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_0f2tzep.js +4 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_116nh32.js +4 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_11dyjcb.js +4 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_1_4knli.js +4 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/[externals]_pg_15jfwkh._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/[externals]_pg_20c820g._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__03-x9xy._.js +19 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__08-1wwu._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__0c9mbcn._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__0cpdgd0._.js +33 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__0gdfxj4._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__0j0tjwn._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__0kc-hwp._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__0lu73p6._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__10bfmwi._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__18qvdzb._.js +33 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__1bq2f8q._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__1c1x9zr._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__1he4k-q._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__1l2urlw._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/[turbopack]_runtime.js +903 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/_04br1ft._.js +6 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/_09gdzmo._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0kpdmm-._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0ozyjt1._.js +21 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0ro6vh6._.js +27 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0tgpglr._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/_1laion6._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_0_lzzn3._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_0b_hsjl._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub__next-internal_server_app_(auth)_signin_page_actions_1vmiwl7.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub__next-internal_server_app_(dashboard)_approvals_page_actions_1mi0bpn.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub__next-internal_server_app_(dashboard)_boxes_[id]_page_actions_0k7kgn2.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub__next-internal_server_app_(dashboard)_page_actions_1t3u0xy.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub__next-internal_server_app_(dashboard)_settings_page_actions_0ti7gxm.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub__next-internal_server_app__global-error_page_actions_1ofuxm1.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub__next-internal_server_app__not-found_page_actions_1fmdkci.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_app_(dashboard)_boxes_[id]_page_tsx_1-j_972._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_app_(dashboard)_boxes_components_box-table_tsx_0a9pyn_._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_components_1z1p98f._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_lib_auth_client_ts_1uxjxr_._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/node_modules__pnpm_04qfi10._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/node_modules__pnpm_0kvuy0s._.js +33 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/packages_relay_dist_control-plane_0ve-wz4.js +80 -0
- package/runtime/hub/apps/hub/.next/server/functions-config-manifest.json +40 -0
- package/runtime/hub/apps/hub/.next/server/middleware-build-manifest.js +21 -0
- package/runtime/hub/apps/hub/.next/server/middleware-manifest.json +6 -0
- package/runtime/hub/apps/hub/.next/server/middleware.js +5 -0
- package/runtime/hub/apps/hub/.next/server/next-font-manifest.js +1 -0
- package/runtime/hub/apps/hub/.next/server/next-font-manifest.json +49 -0
- package/runtime/hub/apps/hub/.next/server/pages/500.html +1 -0
- package/runtime/hub/apps/hub/.next/server/pages-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/prefetch-hints.json +1 -0
- package/runtime/hub/apps/hub/.next/server/server-reference-manifest.js +1 -0
- package/runtime/hub/apps/hub/.next/server/server-reference-manifest.json +276 -0
- package/runtime/hub/apps/hub/.next/static/TpPTWVdZDxqrPlONtJcR5/_buildManifest.js +11 -0
- package/runtime/hub/apps/hub/.next/static/TpPTWVdZDxqrPlONtJcR5/_clientMiddlewareManifest.js +6 -0
- package/runtime/hub/apps/hub/.next/static/TpPTWVdZDxqrPlONtJcR5/_ssgManifest.js +1 -0
- package/runtime/hub/apps/hub/.next/static/chunks/0cz1d0mv5g_q7.js +1 -0
- package/runtime/hub/apps/hub/.next/static/chunks/0dx4alyqu7cq1.css +3 -0
- package/runtime/hub/apps/hub/.next/static/chunks/0lq354ziiwxxl.js +1 -0
- package/runtime/hub/apps/hub/.next/static/chunks/0ptag81psa0nj.js +1 -0
- package/runtime/hub/apps/hub/.next/static/chunks/11vmjdy3390ik.js +1 -0
- package/runtime/hub/apps/hub/.next/static/chunks/19cwkdx97a5_c.js +1 -0
- package/runtime/hub/apps/hub/.next/static/chunks/1svigjdfotduh.js +1 -0
- package/runtime/hub/apps/hub/.next/static/chunks/1t3645mc1s54c.js +1 -0
- package/runtime/hub/apps/hub/.next/static/chunks/1y49eldffr2-_.js +31 -0
- package/runtime/hub/apps/hub/.next/static/chunks/26ef4lcj-7-li.js +1 -0
- package/runtime/hub/apps/hub/.next/static/chunks/2d5e6t-5j4etp.js +1 -0
- package/runtime/hub/apps/hub/.next/static/chunks/2ozcn3ku69ymf.js +1 -0
- package/runtime/hub/apps/hub/.next/static/chunks/2w65a9zig6ya7.js +4 -0
- package/runtime/hub/apps/hub/.next/static/chunks/2x7nfpuaaba_a.js +1 -0
- package/runtime/hub/apps/hub/.next/static/chunks/3-zanu4ioia5i.js +1 -0
- package/runtime/hub/apps/hub/.next/static/chunks/3c49t4evjq8hf.js +1 -0
- package/runtime/hub/apps/hub/.next/static/chunks/3x8k7so-uoat8.js +2 -0
- package/runtime/hub/apps/hub/.next/static/chunks/3y2c7woqhtx9s.js +1 -0
- package/runtime/hub/apps/hub/.next/static/chunks/turbopack-2x4_cva4cco3h.js +1 -0
- package/runtime/hub/apps/hub/.next/static/media/02263ebadd758ea4-s.29yke99gs9qpn.woff2 +0 -0
- package/runtime/hub/apps/hub/.next/static/media/03fc1b4a8d284b5e-s.p.0wiir8udbzjvx.woff2 +0 -0
- package/runtime/hub/apps/hub/.next/static/media/1a69062cfe6f77f8-s.0o-3_g79811ob.woff2 +0 -0
- package/runtime/hub/apps/hub/.next/static/media/1bcd0e671759a44c-s.2qt3tdwt-y9x_.woff2 +0 -0
- package/runtime/hub/apps/hub/.next/static/media/23b7a97ae3b5c134-s.p.226pwps5o-gq_.woff2 +0 -0
- package/runtime/hub/apps/hub/.next/static/media/2e95a7d252b9825a-s.15orukf5wyxb5.woff2 +0 -0
- package/runtime/hub/apps/hub/.next/static/media/2fe89d53234c61d4-s.1u30mmyq6lnsd.woff2 +0 -0
- package/runtime/hub/apps/hub/.next/static/media/57215795b8570f5c-s.2rixgazldzomk.woff2 +0 -0
- package/runtime/hub/apps/hub/.next/static/media/59b15b4bcd7b1eb5-s.2vemzm0itqzfy.woff2 +0 -0
- package/runtime/hub/apps/hub/.next/static/media/5e05ae5b48faa55e-s.1yd4_i3e35931.woff2 +0 -0
- package/runtime/hub/apps/hub/.next/static/media/68757d6cddeff913-s.1i-sca43-qwng.woff2 +0 -0
- package/runtime/hub/apps/hub/.next/static/media/6ff74e33ebd7bca3-s.352ti9pm7m6qh.woff2 +0 -0
- package/runtime/hub/apps/hub/.next/static/media/7fea77d1d19108bf-s.2y65deuc30pmy.woff2 +0 -0
- package/runtime/hub/apps/hub/.next/static/media/90c51ce8fb754fe8-s.02z5rrbg5nt92.woff2 +0 -0
- package/runtime/hub/apps/hub/.next/static/media/99e609270109b47d-s.p.40sczeszzbjw1.woff2 +0 -0
- package/runtime/hub/apps/hub/.next/static/media/9a4838fcda0d1bca-s.0ngr-xkgqz1kf.woff2 +0 -0
- package/runtime/hub/apps/hub/.next/static/media/a7afbb44bec2bb18-s.1qc6dx89jd2qv.woff2 +0 -0
- package/runtime/hub/apps/hub/.next/static/media/e15f58668ad64cb8-s.3cvcemwuzoywn.woff2 +0 -0
- package/runtime/hub/apps/hub/.next/static/media/e390973e931a41c5-s.0rgnxg2b64rzs.woff2 +0 -0
- package/runtime/hub/apps/hub/.next/static/media/e532fa1b9921e1cd-s.3cb5lpr2l6xud.woff2 +0 -0
- package/runtime/hub/apps/hub/.next/static/media/effe91970fc4db64-s.p.0oace-s_gkfks.woff2 +0 -0
- package/runtime/hub/apps/hub/auth-YBXDRLHG.js +75 -0
- package/runtime/hub/apps/hub/auth-config-LJGI76HI.js +21 -0
- package/runtime/hub/apps/hub/chunk-3LAHFDJF.js +287 -0
- package/runtime/hub/apps/hub/chunk-AKLBSCSZ.js +8573 -0
- package/runtime/hub/apps/hub/chunk-EFW34I43.js +7299 -0
- package/runtime/hub/apps/hub/chunk-JDA7BPPN.js +2806 -0
- package/runtime/hub/apps/hub/chunk-LJG4CEGS.js +3341 -0
- package/runtime/hub/apps/hub/chunk-OBKLTPIR.js +41 -0
- package/runtime/hub/apps/hub/chunk-OF242BLD.js +797 -0
- package/runtime/hub/apps/hub/chunk-TZFWAJVB.js +38 -0
- package/runtime/hub/apps/hub/chunk-V5KGFHCF.js +12683 -0
- package/runtime/hub/apps/hub/cloud-poller-SUNA6ZQC-VSKVMYHL.js +10 -0
- package/runtime/hub/apps/hub/dist-BF54UNHK.js +1029 -0
- package/runtime/hub/apps/hub/dist-CM4YAQLI.js +1656 -0
- package/runtime/hub/apps/hub/dist-ELOY2IUE.js +533 -0
- package/runtime/hub/apps/hub/dist-FDBOJ74K.js +1085 -0
- package/runtime/hub/apps/hub/dist-GGM4BUKM.js +2281 -0
- package/runtime/hub/apps/hub/dist-IENF7YOD.js +88 -0
- package/runtime/hub/apps/hub/execa-4DLVNM6E.js +32 -0
- package/runtime/hub/apps/hub/hub-token-EW32VDIU.js +25 -0
- package/runtime/hub/apps/hub/package.json +55 -0
- package/runtime/hub/apps/hub/prepared-state-5FIGV4BE-FIXKBF5A.js +19 -0
- package/runtime/hub/apps/hub/public/logo.svg +5 -0
- package/runtime/hub/apps/hub/server.js +838 -0
- package/runtime/relay/bin.cjs +1738 -482
- package/runtime/vercel/ctl.cjs +11871 -10351
- package/runtime/vercel/scripts/provision.sh +31 -15
- package/dist/chunk-6JJIKCMY.js.map +0 -1
- package/dist/chunk-DBMLOY3T.js +0 -793
- package/dist/chunk-DBMLOY3T.js.map +0 -1
- package/dist/chunk-KTEDFUKM.js +0 -831
- package/dist/chunk-KTEDFUKM.js.map +0 -1
- package/dist/chunk-QKL7PCXQ.js.map +0 -1
- package/dist/chunk-X2DWS4KS.js +0 -820
- package/dist/chunk-X2DWS4KS.js.map +0 -1
- package/dist/chunk-YZVFGFYQ.js.map +0 -1
- package/dist/dist-FMA5Y25B.js.map +0 -1
- package/dist/dist-NWKOEWUJ.js.map +0 -1
- package/dist/dist-U76JL6HI.js +0 -738
- package/dist/dist-U76JL6HI.js.map +0 -1
- package/dist/dist-UVQJ2BZJ.js.map +0 -1
- /package/dist/{_cloud-attach-U3QJO7IF.js.map → _cloud-attach-YH2SU75S.js.map} +0 -0
- /package/dist/{dist-SAS4PIHA.js.map → dist-EJXUKIR7.js.map} +0 -0
- /package/dist/{prepared-state-MQHD3M5F-YYVVMTNJ.js.map → dist-QBXEP4VY.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../packages/sandbox-vercel/src/env-loader.ts","../../../packages/sandbox-vercel/src/sbx-cli.ts","../../../packages/sandbox-vercel/src/vercel-rest.ts","../../../packages/sandbox-vercel/src/credentials.ts","../../../packages/sandbox-vercel/src/cli-store.ts","../../../packages/sandbox-vercel/src/sdk.ts","../../../packages/sandbox-vercel/src/runtime-assets.ts","../../../packages/sandbox-vercel/src/prepared-state.ts","../../../packages/sandbox-vercel/src/index.ts","../../../packages/sandbox-vercel/src/backend.ts","../../../packages/sandbox-vercel/src/retry.ts","../../../packages/sandbox-vercel/src/prepare.ts","../../../packages/sandbox-vercel/src/build-attach.ts","../../../packages/sandbox-vercel/src/provider-module.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'node:fs';\nimport { homedir } from 'node:os';\nimport { resolve } from 'node:path';\n\n/**\n * Vercel env auto-loader. The `@vercel/sandbox` SDK reads `VERCEL_OIDC_TOKEN`\n * from `process.env`; for the access-token path we read `VERCEL_TOKEN` +\n * `VERCEL_TEAM_ID` + `VERCEL_PROJECT_ID` and thread them into every SDK call as\n * explicit `Credentials`. We pull all of these in from `~/.agentbox/secrets.env`\n * (written by `agentbox vercel login`) so the SDK Just Works after a one-time\n * login — exactly the daytona/hetzner model.\n *\n * Lookup order (first wins; process.env is never overwritten):\n * 1. `process.env` (already set in the shell).\n * 2. `~/.agentbox/secrets.env` — written by `agentbox vercel login`.\n *\n * Project-level `.env` / `.env.local` are intentionally NOT consulted: those\n * files belong to the app code being developed, and a `VERCEL_*` value there\n * (e.g. a `vercel env pull` OIDC token, or the app's own deploy token) is meant\n * for in-box code, not for the host CLI to harvest and provision sandboxes with.\n * Put host credentials in `~/.agentbox/secrets.env` (or the shell env).\n *\n * Only Vercel-prefixed keys are imported; the rest of the file is left alone.\n * Idempotent and side-effect-free after the first call.\n */\nconst VERCEL_KEYS = [\n 'VERCEL_OIDC_TOKEN',\n 'VERCEL_TOKEN',\n 'VERCEL_TEAM_ID',\n 'VERCEL_PROJECT_ID',\n // Marker for CLI-login mode (`agentbox vercel login` → `sandbox login`). The\n // access token is NOT stored here — it's read live from the Vercel CLI store;\n // only this marker + team/project ids are persisted.\n 'VERCEL_AUTH_SOURCE',\n] as const;\n\nlet loaded = false;\n\nexport function ensureVercelEnvLoaded(): void {\n if (loaded) return;\n loaded = true;\n importVercelFromFile(resolve(homedir(), '.agentbox', 'secrets.env'), VERCEL_KEYS);\n}\n\n/**\n * Force a re-read of `~/.agentbox/secrets.env`. Used by the interactive\n * `agentbox vercel login` flow after it persists the credential trio, so the\n * same process can pick it up without a restart.\n */\nexport function reloadVercelEnv(): void {\n loaded = false;\n ensureVercelEnvLoaded();\n}\n\nfunction importVercelFromFile(path: string, keys: readonly string[]): void {\n if (!existsSync(path)) return;\n let body: string;\n try {\n body = readFileSync(path, 'utf8');\n } catch {\n return;\n }\n const parsed = parseEnvFile(body);\n for (const key of keys) {\n if (process.env[key] !== undefined) continue;\n const value = parsed[key];\n if (typeof value === 'string') {\n process.env[key] = value;\n }\n }\n}\n\n/**\n * Minimal `.env` parser: handles `KEY=value`, `KEY=\"value\"`, `KEY='value'`,\n * `export KEY=value`, blank lines, and `#` comments. No variable\n * interpolation — predictable over feature-complete (matches the daytona\n * loader's behavior).\n */\nexport function parseEnvFile(body: string): Record<string, string> {\n const out: Record<string, string> = {};\n for (const rawLine of body.split(/\\r?\\n/)) {\n const line = rawLine.trim();\n if (line.length === 0 || line.startsWith('#')) continue;\n const stripped = line.startsWith('export ') ? line.slice('export '.length) : line;\n const eq = stripped.indexOf('=');\n if (eq <= 0) continue;\n const key = stripped.slice(0, eq).trim();\n let value = stripped.slice(eq + 1).trim();\n if (\n value.length >= 2 &&\n ((value.startsWith('\"') && value.endsWith('\"')) ||\n (value.startsWith(\"'\") && value.endsWith(\"'\")))\n ) {\n value = value.slice(1, -1);\n }\n out[key] = value;\n }\n return out;\n}\n","/**\n * Driver for the official Vercel Sandbox CLI (`sandbox` / `sbx`, installed via\n * `npm i -g sandbox`). AgentBox's CLI-login auth mode uses it for two things:\n * - `loginSbx` — run `sandbox login` interactively so the user completes\n * the browser OAuth and the CLI writes its own credential store.\n * - `refreshSbxToken` — run a cheap read command (`sandbox list`) which makes\n * the CLI lazily refresh its access token from its stored refresh token\n * when the token is stale. Verified non-interactive: a stale token is\n * refreshed without opening a browser.\n *\n * Mirrors the probe/install patterns in sandbox-docker/src/portless.ts: execa\n * with `reject:false` for never-throw probes, spawnSync with inherited stdio for\n * the interactive login.\n */\n\nimport { spawnSync } from 'node:child_process';\nimport { execa } from 'execa';\n\n/**\n * Binaries the Sandbox CLI installs. `sbx` is the short alias; we prefer it but\n * fall back to `sandbox`. Pinned here so a future rename is a one-line fix.\n */\nconst SBX_BINS = ['sbx', 'sandbox'] as const;\n\nexport interface SbxState {\n /** A Sandbox CLI binary resolved on PATH and answered `--version`. */\n installed: boolean;\n /** The binary name that answered (`sbx` or `sandbox`), when installed. */\n bin?: string;\n /** Version string, when installed. */\n version?: string;\n}\n\nlet cached: SbxState | null = null;\n\n/**\n * Probe the host for the Sandbox CLI. Cached per-process (install state can't\n * change mid-command); `resetSbxCache` clears it after an install or for tests.\n */\nexport async function detectSbx(): Promise<SbxState> {\n if (cached !== null) return cached;\n for (const bin of SBX_BINS) {\n try {\n const r = await execa(bin, ['--version'], { reject: false });\n if (r.exitCode === 0) {\n cached = { installed: true, bin, version: (r.stdout ?? '').trim() || undefined };\n return cached;\n }\n } catch {\n // try the next bin name\n }\n }\n cached = { installed: false };\n return cached;\n}\n\n/** Drop the per-process probe cache so the next `detectSbx()` re-probes. */\nexport function resetSbxCache(): void {\n cached = null;\n}\n\n/** Command the user should run to install the Sandbox CLI. */\nexport function installSbxHint(): string {\n return 'npm install -g sandbox';\n}\n\n/** Install the Sandbox CLI globally (`npm install -g sandbox`). Never throws. */\nexport async function installSbx(): Promise<boolean> {\n try {\n const r = await execa('npm', ['install', '-g', 'sandbox'], { reject: false });\n return r.exitCode === 0;\n } catch {\n return false;\n }\n}\n\n/**\n * Run `sandbox login` with inherited stdio so the user sees the CLI's own\n * browser-OAuth output and can interact with it. Blocking, like the interactive\n * agent launch path. Returns the exit status (0 = success).\n */\nexport function loginSbx(bin: string): number {\n const r = spawnSync(bin, ['login'], { stdio: 'inherit' });\n return r.status ?? 1;\n}\n\n/**\n * Trigger the CLI's lazy token refresh by running a cheap read command. The CLI\n * refreshes its access token from the stored refresh token when the token is\n * stale and leaves a still-valid token untouched, so this is safe to call\n * eagerly. Non-interactive (stdin from /dev/null); returns true on exit 0.\n */\nexport async function refreshSbxToken(bin: string): Promise<boolean> {\n try {\n const r = await execa(bin, ['list'], {\n reject: false,\n timeout: 30_000,\n stdin: 'ignore',\n });\n return r.exitCode === 0;\n } catch {\n return false;\n }\n}\n","/**\n * Minimal Vercel REST helpers used by the CLI-login auth flow. The Sandbox SDK\n * requires a projectId on every call, but the OAuth access token harvested from\n * the CLI is team-scoped with no project — so after login we list the team's\n * projects (and optionally create one) to resolve a project to scope sandboxes\n * to. Plain `fetch`; no SDK. Each call takes the harvested `(token, teamId)`.\n */\n\nconst API = 'https://api.vercel.com';\n\nexport interface VercelProject {\n id: string;\n name: string;\n}\n\nclass VercelApiError extends Error {\n constructor(\n readonly status: number,\n message: string,\n ) {\n super(message);\n this.name = 'VercelApiError';\n }\n}\n\nasync function api(\n token: string,\n path: string,\n init?: { method?: string; body?: unknown },\n): Promise<unknown> {\n const res = await fetch(`${API}${path}`, {\n method: init?.method ?? 'GET',\n headers: {\n Authorization: `Bearer ${token}`,\n ...(init?.body ? { 'Content-Type': 'application/json' } : {}),\n },\n body: init?.body ? JSON.stringify(init.body) : undefined,\n });\n const text = await res.text();\n let json: unknown = null;\n try {\n json = text ? JSON.parse(text) : null;\n } catch {\n json = null;\n }\n if (!res.ok) {\n const detail =\n (json as { error?: { message?: string } } | null)?.error?.message ??\n text ??\n res.statusText;\n throw new VercelApiError(res.status, `Vercel API ${res.status}: ${detail}`);\n }\n return json;\n}\n\n/**\n * Validate the token and return the authenticated user (probe / status).\n * `defaultTeamId` is the team the account (and the `sbx` CLI's default sandbox\n * project) is scoped to — the CLI-login flow falls back to it when the CLI store\n * records no selected team.\n */\nexport async function getUser(\n token: string,\n): Promise<{ id: string; username?: string; defaultTeamId?: string }> {\n const json = (await api(token, '/v2/user')) as {\n user?: { id: string; username?: string; defaultTeamId?: string };\n };\n const user = json.user;\n if (!user?.id) throw new Error('Vercel /v2/user returned no user');\n return user;\n}\n\n/** List the team's projects (id + name). Paginates up to `limit` (default 100). */\nexport async function listProjects(\n token: string,\n teamId: string,\n limit = 100,\n): Promise<VercelProject[]> {\n const json = (await api(\n token,\n `/v9/projects?teamId=${encodeURIComponent(teamId)}&limit=${limit}`,\n )) as { projects?: Array<{ id: string; name: string }> };\n return (json.projects ?? []).map((p) => ({ id: p.id, name: p.name }));\n}\n\n/**\n * Create a project under the team. On a 409 (name already taken) re-list and\n * return the existing project of that name, so the caller treats create as\n * idempotent.\n */\nexport async function createProject(\n token: string,\n teamId: string,\n name: string,\n): Promise<VercelProject> {\n try {\n const json = (await api(token, `/v9/projects?teamId=${encodeURIComponent(teamId)}`, {\n method: 'POST',\n body: { name },\n })) as { id: string; name: string };\n return { id: json.id, name: json.name };\n } catch (err) {\n if (err instanceof VercelApiError && err.status === 409) {\n const existing = (await listProjects(token, teamId)).find((p) => p.name === name);\n if (existing) return existing;\n }\n throw err;\n }\n}\n\n// --- Git-backed control-plane deploy ---------------------------------------\n// These drive the REST API so `agentbox control-plane setup --deploy vercel`\n// builds the control plane FROM GitHub (no local upload). Shapes verified\n// against the Vercel REST docs (project create is v11; deployments v13).\n\n/** Append `teamId` as a query param (handles an existing `?`). */\nfunction withTeam(path: string, teamId: string | undefined): string {\n if (!teamId) return path;\n return `${path}${path.includes('?') ? '&' : '?'}teamId=${encodeURIComponent(teamId)}`;\n}\n\nexport interface VercelProjectFull {\n id: string;\n name: string;\n framework?: string | null;\n rootDirectory?: string | null;\n /** Connected Git repo, when the project is Git-backed. */\n link?: { type?: string; org?: string; repo?: string } | null;\n targets?: { production?: { alias?: string[] } | null } | null;\n}\n\n/** GET a project by id or name; null on 404. */\nexport async function getProject(\n token: string,\n teamId: string | undefined,\n idOrName: string,\n): Promise<VercelProjectFull | null> {\n try {\n return (await api(token, withTeam(`/v9/projects/${encodeURIComponent(idOrName)}`, teamId))) as VercelProjectFull;\n } catch (err) {\n if (err instanceof VercelApiError && err.status === 404) return null;\n throw err;\n }\n}\n\nexport interface CreateGitProjectInput {\n name: string;\n /** `owner/name` GitHub slug. */\n repo: string;\n rootDirectory: string;\n framework?: string;\n}\n\n/**\n * Create a Git-connected project. `gitRepository` connects the repo at create\n * time (there is no documented post-hoc connect endpoint, and it is not\n * PATCH-able — callers delete+recreate to re-connect). Throws the Vercel error\n * verbatim, including the \"install the GitHub integration first\" case when the\n * repo owner hasn't installed the Vercel GitHub App.\n */\nexport async function createGitProject(\n token: string,\n teamId: string | undefined,\n input: CreateGitProjectInput,\n): Promise<VercelProjectFull> {\n // NB: a Git deployment checks out the WHOLE repo, so the app's turbo build\n // (`cd ../..`) sees the workspace without needing the \"files outside root\n // directory\" toggle — and `/v11/projects` rejects that field anyway.\n return (await api(token, withTeam('/v11/projects', teamId), {\n method: 'POST',\n body: {\n name: input.name,\n framework: input.framework ?? 'nextjs',\n rootDirectory: input.rootDirectory,\n gitRepository: { type: 'github', repo: input.repo },\n },\n })) as VercelProjectFull;\n}\n\nexport async function deleteProject(\n token: string,\n teamId: string | undefined,\n idOrName: string,\n): Promise<void> {\n await api(token, withTeam(`/v9/projects/${encodeURIComponent(idOrName)}`, teamId), { method: 'DELETE' });\n}\n\n/** PATCH the settings that ARE updatable (not `gitRepository`). */\nexport async function patchProjectSettings(\n token: string,\n teamId: string | undefined,\n idOrName: string,\n settings: { framework?: string; rootDirectory?: string; sourceFilesOutsideRootDirectory?: boolean },\n): Promise<void> {\n await api(token, withTeam(`/v9/projects/${encodeURIComponent(idOrName)}`, teamId), {\n method: 'PATCH',\n body: settings,\n });\n}\n\nexport interface VercelEnvVar {\n key: string;\n value: string;\n type?: 'encrypted' | 'plain' | 'sensitive';\n target?: string[];\n}\n\n/** Idempotent upsert (`?upsert=true` updates the value when the key exists). */\nexport async function upsertProjectEnv(\n token: string,\n teamId: string | undefined,\n idOrName: string,\n vars: VercelEnvVar[],\n): Promise<void> {\n await api(token, withTeam(`/v10/projects/${encodeURIComponent(idOrName)}/env?upsert=true`, teamId), {\n method: 'POST',\n body: vars.map((v) => ({\n key: v.key,\n value: v.value,\n type: v.type ?? 'encrypted',\n target: v.target ?? ['production'],\n })),\n });\n}\n\n/** Whether the project already has an env var named `key` (any target). */\nexport async function projectHasEnv(\n token: string,\n teamId: string | undefined,\n idOrName: string,\n key: string,\n): Promise<boolean> {\n const r = (await api(token, withTeam(`/v9/projects/${encodeURIComponent(idOrName)}/env`, teamId))) as {\n envs?: Array<{ key?: string }>;\n };\n return (r.envs ?? []).some((e) => e.key === key);\n}\n\nexport interface CreateGitDeploymentInput {\n name: string;\n projectId: string;\n owner: string;\n repo: string;\n ref: string;\n}\n\n/** Trigger a production build FROM GitHub (gitSource = no file upload). */\nexport async function createGitDeployment(\n token: string,\n teamId: string | undefined,\n input: CreateGitDeploymentInput,\n): Promise<{ id: string; url?: string }> {\n const res = (await api(token, withTeam('/v13/deployments?skipAutoDetectionConfirmation=1', teamId), {\n method: 'POST',\n body: {\n name: input.name,\n project: input.projectId,\n target: 'production',\n gitSource: { type: 'github', org: input.owner, repo: input.repo, ref: input.ref },\n },\n })) as { id?: string; url?: string };\n if (!res.id) throw new Error('Vercel deployment create returned no id');\n return { id: res.id, url: res.url };\n}\n\nexport interface DeploymentStatus {\n readyState: string;\n url?: string;\n aliasFinal?: string | null;\n alias?: string[];\n errorMessage?: string;\n errorStep?: string;\n}\n\nexport async function getDeployment(\n token: string,\n teamId: string | undefined,\n id: string,\n): Promise<DeploymentStatus> {\n const d = (await api(token, withTeam(`/v13/deployments/${encodeURIComponent(id)}`, teamId))) as {\n readyState?: string;\n status?: string;\n url?: string;\n aliasFinal?: string | null;\n alias?: string[];\n errorMessage?: string;\n errorStep?: string;\n };\n return {\n readyState: d.readyState ?? d.status ?? 'UNKNOWN',\n url: d.url,\n aliasFinal: d.aliasFinal,\n alias: d.alias,\n errorMessage: d.errorMessage,\n errorStep: d.errorStep,\n };\n}\n\n/** The stable production alias (survives redeploys), or null. */\nexport async function getProductionAlias(\n token: string,\n teamId: string | undefined,\n idOrName: string,\n): Promise<string | null> {\n const p = await getProject(token, teamId, idOrName);\n const aliases = p?.targets?.production?.alias;\n return Array.isArray(aliases) && aliases.length > 0 ? aliases[0]! : null;\n}\n","import { homedir } from 'node:os';\nimport { resolve } from 'node:path';\nimport { hostOpenCommand, writeManagedSecrets, type CredSetResult } from '@agentbox/sandbox-core';\nimport {\n cancel,\n confirm,\n isCancel,\n intro,\n log,\n note,\n outro,\n password,\n select,\n spinner,\n text,\n} from '@clack/prompts';\nimport { ensureVercelEnvLoaded, reloadVercelEnv } from './env-loader.js';\n\n// Ctrl+C at a prompt resolves with the cancel symbol; turn that into a real\n// quit so the command never silently continues as if the user answered \"No\".\nfunction exitOnCancel<T>(v: T | symbol): T {\n if (isCancel(v)) {\n cancel('Cancelled.');\n process.exit(130);\n }\n return v as T;\n}\nimport { hasUsableCredentials } from './sdk.js';\nimport { cliStorePaths, isNearExpiry, readCliAuth, readCliCurrentTeam } from './cli-store.js';\nimport { detectSbx, installSbx, installSbxHint, loginSbx, resetSbxCache } from './sbx-cli.js';\nimport { createProject, getUser, listProjects, type VercelProject } from './vercel-rest.js';\n\nconst DASHBOARD_TOKENS_URL = 'https://vercel.com/account/settings/tokens';\n\n/**\n * Keys we manage in `~/.agentbox/secrets.env`. On reconfigure we strip prior\n * values for these before appending so the file never accumulates duplicates.\n * `VERCEL_AUTH_SOURCE` is the CLI-login marker; the access token itself is never\n * stored here in that mode (it's read live from the Vercel CLI store).\n */\nconst MANAGED_KEYS = [\n 'VERCEL_OIDC_TOKEN',\n 'VERCEL_TOKEN',\n 'VERCEL_TEAM_ID',\n 'VERCEL_PROJECT_ID',\n 'VERCEL_AUTH_SOURCE',\n] as const;\n\nexport interface EnsureVercelCredentialsOptions {\n /** Re-prompt even when valid credentials are already present (`agentbox vercel login`). */\n force?: boolean;\n}\n\n/**\n * First-run interactive setup for Vercel credentials. The access-token path\n * persists a `VERCEL_TOKEN` trio to `~/.agentbox/secrets.env` (the canonical\n * store, matching daytona/hetzner). OIDC is also supported, but the token must\n * be present in the shell env or in `~/.agentbox/secrets.env` — agentbox does\n * NOT harvest `.env.local` (that file belongs to the app being developed).\n *\n * No-op when credentials are already configured. Silent no-op when stdin isn't\n * a TTY so scripted/CI callers get the SDK's \"not configured\" error instead of\n * a hung prompt.\n */\nexport async function ensureVercelCredentials(\n opts: EnsureVercelCredentialsOptions = {},\n): Promise<void> {\n ensureVercelEnvLoaded();\n\n if (!opts.force && hasUsableCredentials()) return;\n if (!process.stdin.isTTY) return;\n\n intro('Vercel setup');\n note(\n `AgentBox needs Vercel credentials to provision sandboxes.\\n` +\n `Sign in with Vercel (recommended): drives the Vercel \\`sandbox\\` CLI through a browser login, then reads the token from the CLI's own store and keeps it fresh — no token to paste.\\n` +\n `Access token (best for CI / headless): personal access token + team id + project id, saved to \\`~/.agentbox/secrets.env\\`.\\n` +\n `OIDC (short interactive work): export VERCEL_OIDC_TOKEN in your shell or add it to \\`~/.agentbox/secrets.env\\` (dev token expires ~12h, no headless refresh).`,\n 'Credentials required',\n );\n\n const mode = exitOnCancel(\n await select({\n message: 'How do you want to authenticate?',\n options: [\n { value: 'cli', label: 'Sign in with Vercel (browser) — recommended for interactive use' },\n { value: 'token', label: 'Access token (VERCEL_TOKEN + team + project) — best for CI / headless' },\n { value: 'oidc', label: 'OIDC token (VERCEL_OIDC_TOKEN in env / secrets.env) — short interactive work' },\n ],\n initialValue: 'cli',\n }),\n );\n\n if (mode === 'cli') {\n await runCliLogin();\n return;\n }\n\n if (mode === 'oidc') {\n note(\n `Get an OIDC token with \\`vercel link\\` then \\`vercel env pull\\`, then make it visible to AgentBox by either:\\n` +\n ` export VERCEL_OIDC_TOKEN=<token> # in this shell\\n` +\n ` echo \"VERCEL_OIDC_TOKEN=<token>\" >> ~/.agentbox/secrets.env\\n` +\n `Re-do every ~12h; the dev token expires. AgentBox does not harvest .env.local.`,\n 'OIDC setup',\n );\n // Re-read in case the user already added the token to secrets.env.\n reloadVercelEnv();\n if (process.env.VERCEL_OIDC_TOKEN) {\n log.success('Found VERCEL_OIDC_TOKEN — Vercel is configured.');\n await ensureSbxInstalled();\n outro('Setup complete.');\n } else {\n log.warn('No VERCEL_OIDC_TOKEN found yet — set it as above, then re-run `agentbox vercel login`.');\n }\n return;\n }\n\n const creds = await promptForTokenTrio();\n persistCredentials(creds);\n log.success(`Vercel credentials saved to ${secretsPath()}`);\n await ensureSbxInstalled();\n outro('Setup complete.');\n}\n\ninterface TokenTrio {\n token: string;\n teamId: string;\n projectId: string;\n}\n\nasync function promptForTokenTrio(): Promise<TokenTrio> {\n const openIt = exitOnCancel(\n await confirm({\n message: `Open ${DASHBOARD_TOKENS_URL} to create a token?`,\n initialValue: true,\n }),\n );\n if (openIt) openDashboard();\n\n const token = exitOnCancel(\n await password({\n message: 'Paste your Vercel access token',\n validate: (v) => (v && v.trim().length > 0 ? undefined : 'Cannot be empty'),\n }),\n );\n const teamId = exitOnCancel(\n await text({\n message: 'Team ID (team settings → General)',\n placeholder: 'team_...',\n validate: (v) => (v && v.trim().length > 0 ? undefined : 'Cannot be empty'),\n }),\n );\n const projectId = exitOnCancel(\n await text({\n message: 'Project ID (project settings → General)',\n placeholder: 'prj_...',\n validate: (v) => (v && v.trim().length > 0 ? undefined : 'Cannot be empty'),\n }),\n );\n return { token: token.trim(), teamId: teamId.trim(), projectId: projectId.trim() };\n}\n\nfunction persistCredentials(creds: TokenTrio): void {\n writeManaged({\n VERCEL_TOKEN: creds.token,\n VERCEL_TEAM_ID: creds.teamId,\n VERCEL_PROJECT_ID: creds.projectId,\n });\n}\n\n/**\n * Persist the CLI-login marker + cached stable ids. The access token is\n * deliberately omitted — it's read live from the Vercel CLI store on each call\n * and refreshed there, so the only thing we cache is the team/project scope.\n */\nfunction persistCliCredentials(ids: { teamId: string; projectId: string }): void {\n writeManaged({\n VERCEL_AUTH_SOURCE: 'cli',\n VERCEL_TEAM_ID: ids.teamId,\n VERCEL_PROJECT_ID: ids.projectId,\n });\n}\n\n/**\n * Atomically rewrite the managed Vercel keys in `~/.agentbox/secrets.env`:\n * strip every prior value for a `MANAGED_KEYS` entry, then append exactly the\n * keys in `record` (mode 0600, temp-file + rename). Also mirrors the record\n * into `process.env` (and clears the other managed keys there) so the current\n * run uses the new values immediately.\n */\nfunction writeManaged(record: Record<string, string>): void {\n writeManagedSecrets(MANAGED_KEYS, record);\n}\n\n/**\n * Non-interactive credential set (the headless path the hub drives). Token mode\n * only — the interactive browser (`sbx login`) flow can't run headless.\n * Validates `{ token }` against the Vercel API (`getUser`), scopes to the given\n * `teamId` (or the token's default team), optionally records `projectId`, then\n * persists to `~/.agentbox/secrets.env`. Writing `VERCEL_TOKEN` clears any prior\n * CLI-login marker (`VERCEL_AUTH_SOURCE`).\n */\nexport async function setVercelCredentials(\n fields: Record<string, string>,\n): Promise<CredSetResult> {\n ensureVercelEnvLoaded();\n const token = (fields.token ?? '').trim();\n const projectId = (fields.projectId ?? '').trim() || undefined;\n let teamId = (fields.teamId ?? '').trim() || undefined;\n if (!token) {\n return { ok: false, error: 'token is required', status: { configured: false } };\n }\n try {\n const user = await getUser(token);\n if (!teamId) teamId = user.defaultTeamId;\n } catch (err) {\n return {\n ok: false,\n error: `token rejected by Vercel: ${err instanceof Error ? err.message : String(err)}`,\n status: { configured: false },\n };\n }\n if (!teamId) {\n return {\n ok: false,\n error: 'could not determine a Vercel team — provide teamId',\n status: { configured: false },\n };\n }\n const record: Record<string, string> = { VERCEL_TOKEN: token, VERCEL_TEAM_ID: teamId };\n if (projectId) record.VERCEL_PROJECT_ID = projectId;\n writeManaged(record);\n return {\n ok: true,\n status: { configured: true, label: projectId ? 'token' : 'token (no project)' },\n };\n}\n\n/**\n * The full CLI-login flow: make sure the Vercel `sandbox` CLI is installed (offer\n * to install it), run its browser OAuth, harvest the team id from the CLI store,\n * let the user pick a project to scope sandboxes to, and persist the marker +\n * ids. The access token is never stored — `resolveCredentials` reads it live.\n */\n/**\n * Make sure the Vercel `sandbox` CLI is on PATH, offering to install it. Every\n * login mode ensures it because interactive attach (`agentbox shell|claude|\n * codex|opencode` on a vercel box) drives `sbx exec` for a real PTY. Returns the\n * resolved bin, or null if absent / declined / install failed (callers warn).\n */\nasync function ensureSbxInstalled(): Promise<{ bin: string } | null> {\n let det = await detectSbx();\n if (!det.installed) {\n const doInstall = exitOnCancel(\n await confirm({\n message: `The Vercel sandbox CLI (needed for interactive attach) isn't installed. Install it now? (${installSbxHint()})`,\n initialValue: true,\n }),\n );\n if (!doInstall) {\n log.warn(\n `Install it with \\`${installSbxHint()}\\` to use \\`agentbox shell|claude|codex|opencode\\` on Vercel boxes.`,\n );\n return null;\n }\n const sp = spinner();\n sp.start('Installing the Vercel sandbox CLI…');\n const ok = await installSbx();\n resetSbxCache();\n det = await detectSbx();\n if (!ok || !det.installed || !det.bin) {\n sp.stop('Install failed.');\n log.warn(`Could not install the sandbox CLI — run \\`${installSbxHint()}\\` manually.`);\n return null;\n }\n sp.stop(`Installed sandbox CLI${det.version ? ` ${det.version}` : ''}.`);\n }\n return det.bin ? { bin: det.bin } : null;\n}\n\nasync function runCliLogin(): Promise<void> {\n const det = await ensureSbxInstalled();\n if (!det) {\n log.warn('The Vercel sandbox CLI is required to sign in this way — install it, then re-run `agentbox vercel login`.');\n return;\n }\n\n note('A browser window will open to sign in to Vercel.', 'Vercel sign-in');\n const status = loginSbx(det.bin);\n if (status !== 0) {\n log.warn('Vercel sign-in did not complete — re-run `agentbox vercel login` to try again.');\n return;\n }\n\n const auth = readCliAuth();\n if (!auth) {\n log.warn('Sign-in finished but no access token was found in the Vercel CLI store. Try again.');\n return;\n }\n\n // Validate the token early so a bad/expired session fails here, not mid-op.\n // The same call yields the account's default team, which scopes sandboxes when\n // the CLI store records no selected team (the current `sbx` CLI no longer\n // writes `currentTeam` to its config.json).\n let user: { id: string; username?: string; defaultTeamId?: string };\n try {\n user = await getUser(auth.token);\n } catch (err) {\n log.warn(\n `The Vercel session looks invalid (${err instanceof Error ? err.message : String(err)}). ` +\n 'Re-run `agentbox vercel login`.',\n );\n return;\n }\n\n const teamId = resolveCliTeamId(user.defaultTeamId);\n if (!teamId) {\n log.warn(\n 'Signed in, but could not determine a Vercel team to scope sandboxes to. ' +\n 'Set VERCEL_TEAM_ID in `~/.agentbox/secrets.env` and re-run `agentbox vercel login`.',\n );\n return;\n }\n\n const projectId = await resolveProjectId(auth.token, teamId);\n if (projectId === null) {\n log.warn('No project selected — re-run `agentbox vercel login` to finish setup.');\n return;\n }\n\n persistCliCredentials({ teamId, projectId });\n reloadVercelEnv();\n log.success(`Signed in with Vercel — credentials managed by the sandbox CLI (saved scope to ${secretsPath()}).`);\n outro('Setup complete.');\n}\n\n/**\n * Resolve the team id sandboxes run under, in precedence order:\n * 1. `VERCEL_TEAM_ID` — a prior login's cache or a user override.\n * 2. the CLI store's `currentTeam` — older `vercel`/`sandbox` CLIs wrote it.\n * 3. the account's default team — the current `sbx` CLI records no selected\n * team, so we fall back to the team its OAuth token defaults to (the same\n * team `sbx login` scopes its default sandbox project to).\n * Null when none is available.\n */\nfunction resolveCliTeamId(defaultTeamId?: string): string | null {\n return process.env.VERCEL_TEAM_ID ?? readCliCurrentTeam() ?? defaultTeamId ?? null;\n}\n\n/**\n * Resolve a token + teamId for direct Vercel REST API calls (the Git-backed\n * control-plane deploy), reusing the same sources as the login flow: a\n * `VERCEL_TOKEN` (env / secrets.env) else the CLI session's live access token;\n * teamId from `VERCEL_TEAM_ID` / the CLI's selected team / the account default.\n * Returns null when no token is available (caller tells the user to log in).\n */\nexport async function resolveVercelApiAuth(): Promise<{ token: string; teamId: string | undefined } | null> {\n ensureVercelEnvLoaded();\n const token = process.env.VERCEL_TOKEN ?? readCliAuth()?.token;\n if (!token) return null;\n let teamId: string | undefined = process.env.VERCEL_TEAM_ID ?? readCliCurrentTeam() ?? undefined;\n if (!teamId) {\n try {\n teamId = (await getUser(token)).defaultTeamId;\n } catch {\n /* personal scope / unreachable — proceed without a teamId */\n }\n }\n return { token, teamId };\n}\n\n/**\n * Pick the Vercel project sandboxes run under. Lists the team's projects in a\n * clack select (pre-selecting an existing `agentbox` / sandbox-default project),\n * plus a \"create a new project\" entry. Returns the project id, or null if the\n * user cancelled. Non-interactive callers reuse/create an `agentbox` project.\n */\nasync function resolveProjectId(token: string, teamId: string): Promise<string | null> {\n let projects: VercelProject[] = [];\n const sp = spinner();\n sp.start('Loading your Vercel projects…');\n try {\n projects = await listProjects(token, teamId);\n sp.stop(`Found ${projects.length} project${projects.length === 1 ? '' : 's'}.`);\n } catch (err) {\n sp.stop('Could not list projects.');\n log.warn(`Failed to list Vercel projects: ${err instanceof Error ? err.message : String(err)}`);\n return null;\n }\n\n const CREATE = '__create__';\n const preferred =\n projects.find((p) => p.name === 'agentbox') ??\n projects.find((p) => p.name === 'vercel-sandbox-default-project');\n const choice = exitOnCancel(\n await select({\n message: 'Which Vercel project should sandboxes run under?',\n options: [\n ...projects.map((p) => ({ value: p.id, label: p.name })),\n { value: CREATE, label: 'Create a new project…' },\n ],\n initialValue: preferred ? preferred.id : CREATE,\n }),\n );\n\n if (choice !== CREATE) return choice;\n\n const name = exitOnCancel(\n await text({\n message: 'New project name',\n placeholder: 'agentbox',\n defaultValue: 'agentbox',\n validate: (v) => (v && v.trim().length > 0 ? undefined : 'Cannot be empty'),\n }),\n );\n try {\n const created = await createProject(token, teamId, name.trim() || 'agentbox');\n return created.id;\n } catch (err) {\n log.warn(`Could not create the project: ${err instanceof Error ? err.message : String(err)}`);\n return null;\n }\n}\n\nfunction openDashboard(): void {\n // Lazy import keeps node:child_process out of the module's load cost.\n import('node:child_process')\n .then(({ spawnSync }) => {\n const r = spawnSync(hostOpenCommand(), [DASHBOARD_TOKENS_URL], { stdio: 'ignore' });\n if (r.status !== 0) {\n log.warn(`Could not auto-open the browser — visit ${DASHBOARD_TOKENS_URL} manually.`);\n }\n })\n .catch(() => {\n log.warn(`Could not auto-open the browser — visit ${DASHBOARD_TOKENS_URL} manually.`);\n });\n}\n\nexport function secretsPath(): string {\n return resolve(homedir(), '.agentbox', 'secrets.env');\n}\n\nexport interface VercelCredStatus {\n /** Which auth mode is configured. */\n auth: 'oidc' | 'cli' | 'token' | 'none';\n /** Legacy alias kept for callers that branch on OIDC. */\n oidc: boolean;\n token?: string;\n teamId?: string;\n projectId?: string;\n source: 'env' | 'secrets.env' | 'cli-store' | 'none';\n /**\n * CLI mode only: details about the live Vercel CLI session. Whether the\n * `sandbox` CLI is *installed* needs an async probe (`detectSbx`) and is not\n * reported here — the status printer probes it separately.\n */\n cli?: {\n /** A logged-in session was found in the CLI store. */\n loggedIn: boolean;\n /** Unix seconds the live access token expires at, when known. */\n expiresAt?: number;\n /** True when the token is at/near expiry (a refresh would fire). */\n nearExpiry?: boolean;\n /** Path to the CLI's `auth.json`. */\n authPath: string;\n };\n}\n\nexport function readVercelCredStatus(): VercelCredStatus {\n const shellHad = !!process.env.VERCEL_OIDC_TOKEN || !!process.env.VERCEL_TOKEN;\n ensureVercelEnvLoaded();\n const oidc = !!process.env.VERCEL_OIDC_TOKEN;\n const teamId = process.env.VERCEL_TEAM_ID;\n const projectId = process.env.VERCEL_PROJECT_ID;\n\n if (oidc) {\n return { auth: 'oidc', oidc: true, teamId, projectId, source: shellHad ? 'env' : 'secrets.env' };\n }\n\n if (process.env.VERCEL_AUTH_SOURCE === 'cli') {\n const auth = readCliAuth();\n return {\n auth: 'cli',\n oidc: false,\n token: auth?.token,\n teamId,\n projectId,\n source: 'cli-store',\n cli: {\n loggedIn: !!auth,\n expiresAt: auth?.expiresAt,\n nearExpiry: auth ? isNearExpiry(auth) : undefined,\n authPath: cliStorePaths().authPath,\n },\n };\n }\n\n const token = process.env.VERCEL_TOKEN;\n if (!token) return { auth: 'none', oidc: false, source: 'none' };\n return {\n auth: 'token',\n oidc: false,\n token,\n teamId,\n projectId,\n source: shellHad ? 'env' : 'secrets.env',\n };\n}\n\nexport function maskKey(value: string): string {\n if (value.length <= 8) return '*'.repeat(value.length);\n return `${value.slice(0, 4)}…${'*'.repeat(8)}${value.slice(-4)}`;\n}\n","/**\n * Reader for the Vercel CLI's own credential store — written by `sandbox login`\n * / `vercel login` (the `sandbox`/`sbx` CLI and `vercel` CLI share one store).\n *\n * AgentBox's \"CLI-login\" auth mode (see credentials.ts) drives that CLI for the\n * browser OAuth, then reads the resulting OAuth access token live from here on\n * every SDK call rather than copying it into `secrets.env`: the token is a\n * short-lived, opaque `vca_…` access token that the CLI refreshes lazily from\n * its stored refresh token, so the CLI store is the single self-refreshing\n * source of truth. We only cache the stable bits (team/project id + a marker)\n * in `secrets.env`.\n *\n * Pure FS + path logic — no clack, no execa — so it stays trivially testable.\n */\n\nimport { existsSync, readFileSync } from 'node:fs';\nimport { homedir } from 'node:os';\nimport { join } from 'node:path';\n\n/** The shape of the CLI's `auth.json` (only the fields we consume). */\nexport interface VercelCliAuth {\n /** Opaque OAuth access token (`vca_…`). NOT a JWT — expiry is `expiresAt`. */\n token: string;\n /** Unix seconds. Absent on some CLI versions → treated as near-expiry. */\n expiresAt?: number;\n /** Present but unused by us; the CLI uses it to self-refresh `token`. */\n refreshToken?: string;\n}\n\n/**\n * Resolve the `com.vercel.cli` data directory the way the CLI itself does\n * (xdg-app-paths-style), per platform:\n * - macOS: ~/Library/Application Support/com.vercel.cli\n * - Windows: %APPDATA%\\com.vercel.cli\n * - else: $XDG_DATA_HOME/com.vercel.cli (default ~/.local/share/...)\n *\n * `AGENTBOX_VERCEL_CLI_DIR` overrides outright — for tests and the rare install\n * that relocates the store.\n */\nexport function vercelCliDir(): string {\n const override = process.env.AGENTBOX_VERCEL_CLI_DIR;\n if (override && override.trim().length > 0) return override.trim();\n\n const name = 'com.vercel.cli';\n if (process.platform === 'darwin') {\n return join(homedir(), 'Library', 'Application Support', name);\n }\n if (process.platform === 'win32') {\n const appData = process.env.APPDATA;\n if (appData && appData.trim().length > 0) return join(appData, name);\n return join(homedir(), 'AppData', 'Roaming', name);\n }\n const xdg = process.env.XDG_DATA_HOME;\n const base = xdg && xdg.trim().length > 0 ? xdg.trim() : join(homedir(), '.local', 'share');\n return join(base, name);\n}\n\n/** Absolute paths to the CLI store files, for status/diagnostics. */\nexport function cliStorePaths(): { authPath: string; configPath: string } {\n const dir = vercelCliDir();\n return { authPath: join(dir, 'auth.json'), configPath: join(dir, 'config.json') };\n}\n\nfunction readJson(path: string): unknown {\n if (!existsSync(path)) return null;\n try {\n return JSON.parse(readFileSync(path, 'utf8'));\n } catch {\n return null;\n }\n}\n\n/**\n * Read the live access token from the CLI store. Returns null when the store is\n * missing / unparseable / has no token (CLI never logged in, or logged out) so\n * callers can surface a clear \"run `agentbox vercel login`\" error.\n */\nexport function readCliAuth(): VercelCliAuth | null {\n const raw = readJson(cliStorePaths().authPath) as Record<string, unknown> | null;\n if (!raw || typeof raw.token !== 'string' || raw.token.length === 0) return null;\n return {\n token: raw.token,\n expiresAt: typeof raw.expiresAt === 'number' ? raw.expiresAt : undefined,\n refreshToken: typeof raw.refreshToken === 'string' ? raw.refreshToken : undefined,\n };\n}\n\n/** Read the CLI's currently-selected team (`config.json` `currentTeam`). */\nexport function readCliCurrentTeam(): string | null {\n const raw = readJson(cliStorePaths().configPath) as Record<string, unknown> | null;\n return raw && typeof raw.currentTeam === 'string' && raw.currentTeam.length > 0\n ? raw.currentTeam\n : null;\n}\n\n/**\n * Whether the access token is at/near expiry and should be refreshed before\n * use. A missing `expiresAt` is treated as near-expiry so we always probe a\n * refresh rather than ship a token of unknown age. `skewSec` is the safety\n * window: refresh if the token expires within that many seconds.\n */\nexport function isNearExpiry(auth: VercelCliAuth, skewSec = 120): boolean {\n if (auth.expiresAt === undefined) return true;\n return auth.expiresAt * 1000 < Date.now() + skewSec * 1000;\n}\n","/**\n * Thin loader around `@vercel/sandbox`. Resolves the auth credentials once and\n * threads them into every SDK call.\n *\n * Three auth modes (in precedence order):\n * - OIDC: `VERCEL_OIDC_TOKEN` in env → decode the JWT for owner/project and\n * pass `{ token, teamId, projectId }` explicitly.\n * - CLI-login: `VERCEL_AUTH_SOURCE=cli` → read the live OAuth access token\n * from the Vercel CLI's own store (`auth.json`) and the cached team/project\n * ids from `secrets.env`. The token is never copied to `secrets.env`; the\n * CLI store is the self-refreshing source of truth. `ensureFreshCredentials`\n * refreshes it (via the `sbx` CLI) before use when it's near expiry.\n * - Access token: `VERCEL_TOKEN` + `VERCEL_TEAM_ID` + `VERCEL_PROJECT_ID` →\n * passed explicitly as `{ token, teamId, projectId }` on each call, since\n * the SDK does NOT read those from env automatically.\n */\n\nimport { ensureVercelEnvLoaded } from './env-loader.js';\nimport { isNearExpiry, readCliAuth, readCliCurrentTeam } from './cli-store.js';\nimport { detectSbx, refreshSbxToken } from './sbx-cli.js';\n\nexport interface VercelCredentials {\n token: string;\n teamId: string;\n projectId: string;\n}\n\n/**\n * Resolve the credentials to thread into SDK calls. Throws when nothing is\n * configured (or an OIDC token has expired) so callers get a clear, actionable\n * error instead of an opaque SDK auth failure.\n *\n * For OIDC we do NOT return `{}` and let the SDK read the env var: the SDK's\n * env-OIDC path (`@vercel/oidc`) tries to *refresh* the token via the Vercel\n * CLI's `.vercel/project.json` + cached auth, which an agentbox box doesn't\n * have, so it fails with \"Could not get credentials from OIDC context\". Instead\n * we decode the OIDC JWT — which embeds `owner_id` (teamId) and `project_id` —\n * and pass `{ token, teamId, projectId }` explicitly, which uses the SDK's\n * direct-credentials path (the OIDC token is itself a valid API bearer).\n */\nexport function resolveCredentials(): VercelCredentials {\n ensureVercelEnvLoaded();\n const oidc = process.env.VERCEL_OIDC_TOKEN;\n if (oidc) {\n const claims = decodeOidcClaims(oidc);\n if (!claims) {\n throw new Error(\n 'VERCEL_OIDC_TOKEN is set but could not be decoded (not a valid Vercel OIDC JWT). ' +\n 'Re-run `vercel env pull`, or use the VERCEL_TOKEN + VERCEL_TEAM_ID + VERCEL_PROJECT_ID trio.',\n );\n }\n if (claims.exp !== undefined && claims.exp * 1000 < Date.now()) {\n throw new Error(\n 'VERCEL_OIDC_TOKEN has expired (Vercel dev OIDC tokens last ~12h). ' +\n 'Re-run `vercel env pull` to refresh it, then retry.',\n );\n }\n return { token: oidc, teamId: claims.teamId, projectId: claims.projectId };\n }\n if (process.env.VERCEL_AUTH_SOURCE === 'cli') {\n const auth = readCliAuth();\n if (!auth) {\n throw new Error(\n 'Vercel CLI session not found — run `agentbox vercel login` (or `sbx login`) to sign in again.',\n );\n }\n const teamId = process.env.VERCEL_TEAM_ID ?? readCliCurrentTeam() ?? undefined;\n const projectId = process.env.VERCEL_PROJECT_ID;\n if (!teamId || !projectId) {\n throw new Error(\n 'Vercel CLI auth is missing the team/project id — re-run `agentbox vercel login`.',\n );\n }\n // Live token straight from the CLI store; nothing cached on disk.\n return { token: auth.token, teamId, projectId };\n }\n const token = process.env.VERCEL_TOKEN;\n const teamId = process.env.VERCEL_TEAM_ID;\n const projectId = process.env.VERCEL_PROJECT_ID;\n if (token && teamId && projectId) return { token, teamId, projectId };\n throw new Error(\n 'Vercel credentials not configured.\\n' +\n 'Either run `vercel link && vercel env pull` to get a VERCEL_OIDC_TOKEN, ' +\n 'or set VERCEL_TOKEN + VERCEL_TEAM_ID + VERCEL_PROJECT_ID ' +\n '(see `agentbox vercel login`).',\n );\n}\n\ninterface OidcClaims {\n teamId: string;\n projectId: string;\n exp?: number;\n}\n\n/** Decode the `owner_id`/`project_id`/`exp` claims from a Vercel OIDC JWT. */\nfunction decodeOidcClaims(token: string): OidcClaims | null {\n const parts = token.split('.');\n if (parts.length < 2 || !parts[1]) return null;\n try {\n const payload = JSON.parse(Buffer.from(parts[1], 'base64url').toString('utf8')) as {\n owner_id?: unknown;\n project_id?: unknown;\n exp?: unknown;\n };\n if (typeof payload.owner_id !== 'string' || typeof payload.project_id !== 'string') return null;\n return {\n teamId: payload.owner_id,\n projectId: payload.project_id,\n exp: typeof payload.exp === 'number' ? payload.exp : undefined,\n };\n } catch {\n return null;\n }\n}\n\n/** True when any auth mode is configured. Used by the credential gate. */\nexport function hasUsableCredentials(): boolean {\n ensureVercelEnvLoaded();\n if (process.env.VERCEL_OIDC_TOKEN) return true;\n if (\n process.env.VERCEL_AUTH_SOURCE === 'cli' &&\n process.env.VERCEL_TEAM_ID &&\n process.env.VERCEL_PROJECT_ID &&\n readCliAuth()\n ) {\n return true;\n }\n return Boolean(\n process.env.VERCEL_TOKEN && process.env.VERCEL_TEAM_ID && process.env.VERCEL_PROJECT_ID,\n );\n}\n\n/**\n * Refresh the CLI-login access token before use when it's near expiry. No-op\n * for the OIDC and access-token modes (nothing to refresh). For CLI mode: if the\n * live token in the CLI store is within the safety window, run a cheap `sbx`\n * read command, which makes the CLI rotate its own token from the stored refresh\n * token, then re-read `secrets.env`. Throws an actionable error when the CLI is\n * gone or the refresh fails (e.g. the refresh token itself expired).\n *\n * Call this once at the top of each backend operation, BEFORE the (sync)\n * `resolveCredentials()` reads the token. An in-process single-flight collapses\n * concurrent ops onto one refresh; cross-process races are harmless (the CLI\n * writes its store atomically and a fresh-token refresh is a no-op).\n */\nlet inflightRefresh: Promise<void> | null = null;\n\nexport function ensureFreshCredentials(): Promise<void> {\n ensureVercelEnvLoaded();\n if (process.env.VERCEL_AUTH_SOURCE !== 'cli') return Promise.resolve();\n if (inflightRefresh) return inflightRefresh;\n inflightRefresh = refreshCliToken().finally(() => {\n inflightRefresh = null;\n });\n return inflightRefresh;\n}\n\nasync function refreshCliToken(): Promise<void> {\n const auth = readCliAuth();\n if (!auth) return; // resolveCredentials() will throw the clear \"logged out\" error\n if (!isNearExpiry(auth)) return; // still valid — no work\n\n const det = await detectSbx();\n if (!det.installed || !det.bin) {\n throw new Error(\n 'Vercel access token is near expiry and the `sandbox` CLI is no longer installed — ' +\n 'reinstall it (`npm install -g sandbox`) or run `agentbox vercel login`.',\n );\n }\n const ok = await refreshSbxToken(det.bin);\n if (!ok) {\n throw new Error(\n 'Vercel token refresh failed — run `agentbox vercel login` (the refresh token may have expired).',\n );\n }\n // The token lives in the CLI store, not secrets.env — refreshSbxToken rotated\n // auth.json in place, so the next readCliAuth() returns the fresh token.\n const fresh = readCliAuth();\n if (!fresh || isNearExpiry(fresh, 0)) {\n throw new Error(\n 'Vercel token is still stale after a refresh attempt — run `agentbox vercel login`.',\n );\n }\n}\n\n// Re-export the SDK surface we use so the rest of the package imports from one\n// place (and tests can mock `./sdk.js` instead of the package).\nexport { Sandbox, Snapshot } from '@vercel/sandbox';\nexport type { Sandbox as SandboxType } from '@vercel/sandbox';\n","/**\n * Resolver for the on-disk files shipped into a fresh Vercel sandbox during\n * `prepareVercel()`. Same idea as the hetzner resolver: a flat list of files to\n * upload via `sandbox.writeFiles`, each resolved from either the staged CLI\n * runtime tree or the monorepo source tree.\n *\n * Lookup order per file:\n * 1. The CLI's staged runtime tree: `<cliRoot>/runtime/vercel/...`.\n * 2. The monorepo source tree (dev fallback) under `packages/`.\n *\n * Any missing file throws a clear error naming the paths tried. Includes the\n * shared `agentbox-dockerd-start` helper — Vercel now supports nested\n * containers, so the base snapshot bakes the docker engine + this launcher.\n */\n\nimport { existsSync } from 'node:fs';\nimport { dirname, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nconst SELF = dirname(fileURLToPath(import.meta.url));\n\nexport function findStagedCliRuntimeRoot(): string | undefined {\n const candidates = [\n resolve(SELF, '..', 'runtime'),\n resolve(SELF, '..', '..', 'runtime'),\n ];\n for (const c of candidates) {\n if (existsSync(resolve(c, 'vercel', 'scripts', 'provision.sh'))) return c;\n }\n return undefined;\n}\n\nexport interface RuntimeAsset {\n /** Logical name (used in error messages + log lines). */\n name: string;\n /** Absolute path on the box (writeFiles target). */\n remotePath: string;\n /** File mode to apply after upload. */\n remoteMode: number;\n}\n\n/**\n * Where each asset lands inside the sandbox. provision.sh reads them from these\n * fixed paths. The agent/runtime helpers go straight to /usr/local/bin; baked\n * config files to /tmp for provision.sh to `install` into place.\n */\nexport const RUNTIME_ASSETS: readonly RuntimeAsset[] = [\n { name: 'provision.sh', remotePath: '/tmp/agentbox-provision.sh', remoteMode: 0o755 },\n { name: 'agentbox-ctl', remotePath: '/tmp/agentbox-ctl', remoteMode: 0o755 },\n { name: 'agentbox-vnc-start', remotePath: '/tmp/agentbox-vnc-start', remoteMode: 0o755 },\n { name: 'agentbox-dockerd-start', remotePath: '/tmp/agentbox-dockerd-start', remoteMode: 0o755 },\n { name: 'agentbox-checkpoint-cleanup', remotePath: '/tmp/agentbox-checkpoint-cleanup', remoteMode: 0o755 },\n { name: 'agentbox-open', remotePath: '/tmp/agentbox-open', remoteMode: 0o755 },\n { name: 'gh-shim', remotePath: '/tmp/agentbox-gh-shim', remoteMode: 0o755 },\n { name: 'git-shim', remotePath: '/tmp/agentbox-git-shim', remoteMode: 0o755 },\n { name: 'ntn-shim', remotePath: '/tmp/agentbox-ntn-shim', remoteMode: 0o755 },\n { name: 'linear-shim', remotePath: '/tmp/agentbox-linear-shim', remoteMode: 0o755 },\n { name: 'custom-system-CLAUDE.md', remotePath: '/tmp/agentbox-custom-CLAUDE.md', remoteMode: 0o644 },\n { name: 'claude-managed-settings.json', remotePath: '/tmp/agentbox-managed-settings.json', remoteMode: 0o644 },\n { name: 'agentbox-codex-hooks.json', remotePath: '/tmp/agentbox-codex-hooks.json', remoteMode: 0o644 },\n { name: 'agentbox-setup-skill.md', remotePath: '/tmp/agentbox-setup-skill.md', remoteMode: 0o644 },\n] as const;\n\nexport interface ResolvedAsset extends RuntimeAsset {\n localPath: string;\n}\n\nexport function candidatesFor(\n name: string,\n opts: { cliRuntimeRoot?: string; repoRoot?: string } = {},\n): string[] {\n const cliRoot = opts.cliRuntimeRoot;\n const monorepo = opts.repoRoot ?? guessRepoRoot();\n\n const monorepoRelative: Record<string, string[]> = {\n 'provision.sh': ['packages/sandbox-vercel/scripts/provision.sh'],\n 'agentbox-ctl': ['packages/ctl/dist/bin.cjs'],\n 'agentbox-vnc-start': ['packages/sandbox-docker/scripts/agentbox-vnc-start'],\n 'agentbox-dockerd-start': ['packages/sandbox-docker/scripts/agentbox-dockerd-start'],\n 'agentbox-checkpoint-cleanup': ['packages/sandbox-docker/scripts/agentbox-checkpoint-cleanup'],\n 'agentbox-open': ['packages/sandbox-docker/scripts/agentbox-open'],\n 'gh-shim': ['packages/sandbox-docker/scripts/gh-shim'],\n 'git-shim': ['packages/sandbox-docker/scripts/git-shim'],\n 'ntn-shim': ['packages/sandbox-docker/scripts/ntn-shim'],\n 'linear-shim': ['packages/sandbox-docker/scripts/linear-shim'],\n 'custom-system-CLAUDE.md': ['packages/sandbox-vercel/scripts/custom-system-CLAUDE.md'],\n 'claude-managed-settings.json': ['packages/sandbox-docker/scripts/claude-managed-settings.json'],\n 'agentbox-codex-hooks.json': ['packages/sandbox-docker/scripts/agentbox-codex-hooks.json'],\n 'agentbox-setup-skill.md': ['apps/cli/share/agentbox-setup/SKILL.md'],\n };\n\n const cliRelative: Record<string, string[]> = {\n 'provision.sh': ['vercel/scripts/provision.sh'],\n 'agentbox-ctl': ['vercel/ctl.cjs'],\n 'agentbox-vnc-start': ['vercel/agentbox-vnc-start', 'docker/packages/sandbox-docker/scripts/agentbox-vnc-start'],\n 'agentbox-dockerd-start': ['vercel/agentbox-dockerd-start', 'docker/packages/sandbox-docker/scripts/agentbox-dockerd-start'],\n 'agentbox-checkpoint-cleanup': ['vercel/agentbox-checkpoint-cleanup', 'docker/packages/sandbox-docker/scripts/agentbox-checkpoint-cleanup'],\n 'agentbox-open': ['vercel/agentbox-open', 'docker/packages/sandbox-docker/scripts/agentbox-open'],\n 'gh-shim': ['vercel/gh-shim', 'docker/packages/sandbox-docker/scripts/gh-shim'],\n 'git-shim': ['vercel/git-shim', 'docker/packages/sandbox-docker/scripts/git-shim'],\n 'ntn-shim': ['vercel/ntn-shim', 'docker/packages/sandbox-docker/scripts/ntn-shim'],\n 'linear-shim': ['vercel/linear-shim', 'docker/packages/sandbox-docker/scripts/linear-shim'],\n 'custom-system-CLAUDE.md': ['vercel/custom-system-CLAUDE.md'],\n 'claude-managed-settings.json': ['vercel/claude-managed-settings.json', 'docker/packages/sandbox-docker/scripts/claude-managed-settings.json'],\n 'agentbox-codex-hooks.json': ['vercel/agentbox-codex-hooks.json', 'docker/packages/sandbox-docker/scripts/agentbox-codex-hooks.json'],\n 'agentbox-setup-skill.md': ['vercel/agentbox-setup-skill.md', 'docker/apps/cli/share/agentbox-setup/SKILL.md'],\n };\n\n const out: string[] = [];\n if (cliRoot) {\n for (const rel of cliRelative[name] ?? []) out.push(resolve(cliRoot, rel));\n }\n for (const rel of monorepoRelative[name] ?? []) out.push(resolve(monorepo, rel));\n return out;\n}\n\nexport function resolveRuntimeAssets(\n opts: { cliRuntimeRoot?: string; repoRoot?: string } = {},\n): ResolvedAsset[] {\n const out: ResolvedAsset[] = [];\n const missing: Array<{ name: string; tried: string[] }> = [];\n for (const asset of RUNTIME_ASSETS) {\n const cands = candidatesFor(asset.name, opts);\n const hit = cands.find((p) => existsSync(p));\n if (!hit) {\n missing.push({ name: asset.name, tried: cands });\n continue;\n }\n out.push({ ...asset, localPath: hit });\n }\n if (missing.length > 0) {\n const lines = missing.flatMap((m) => [` - ${m.name}: tried`, ...m.tried.map((p) => ` ${p}`)]);\n throw new Error(\n `vercel: could not resolve runtime assets needed to bake the base snapshot:\\n` +\n lines.join('\\n') +\n `\\n\\nIf running from the monorepo, ensure \\`pnpm -w build\\` has run so packages/ctl/dist/bin.cjs exists.`,\n );\n }\n return out;\n}\n\nfunction guessRepoRoot(): string {\n let cur = SELF;\n for (let i = 0; i < 8; i++) {\n if (existsSync(resolve(cur, 'pnpm-workspace.yaml'))) return cur;\n const parent = dirname(cur);\n if (parent === cur) break;\n cur = parent;\n }\n return SELF;\n}\n","/**\n * Persisted record of what `agentbox prepare --provider vercel` has built.\n * Lives at `~/.agentbox/vercel-prepared.json` so the auto-prepare gate\n * (`ensureVercelBaseSnapshot()`) and `backend.provision` can resolve the base\n * snapshot to boot every box from.\n *\n * Single tier for now — the shared base snapshot (AL2023 + deps + agentbox-ctl\n * + agents). A per-project snapshot tier (matching the hetzner/daytona shape)\n * is a future optimization tracked in docs/vercel-backlog.md.\n *\n * Schema versioned so future shape changes can migrate; only `schema: 1` is\n * accepted today.\n */\n\nimport { claudeInstallFingerprint, computeContextSha256, readPreparedStateRaw, writePreparedStateRaw, preparedStatePathFor } from '@agentbox/sandbox-core';\nimport { UserFacingError } from '@agentbox/core';\nimport { findStagedCliRuntimeRoot, resolveRuntimeAssets } from './runtime-assets.js';\n\nconst SCHEMA = 1 as const;\n\nexport interface PreparedVercelBase {\n /** Vercel snapshot id (opaque). The thing `Sandbox.create({ source }) ` boots from. */\n snapshotId: string;\n /** Deterministic SHA-256 of the prepare build context (provision.sh + assets). */\n contextSha256?: string;\n /** CLI version that produced this snapshot (informational). */\n cliVersion?: string;\n /** Git short SHA of the CLI build (informational). */\n cliCommit?: string;\n /** ISO timestamp of bake completion. */\n createdAt: string;\n}\n\nexport interface PreparedVercelState {\n schema: typeof SCHEMA;\n /** The shared base snapshot. Absent until first `agentbox prepare`. */\n base?: PreparedVercelBase;\n}\n\nexport function preparedStatePath(): string {\n return preparedStatePathFor('vercel');\n}\n\nexport function readPreparedState(): PreparedVercelState {\n const raw = readPreparedStateRaw('vercel');\n if (raw === null || typeof raw !== 'object') return { schema: SCHEMA };\n const parsed = raw as Partial<PreparedVercelState>;\n if (parsed.schema !== SCHEMA) {\n // Unknown/missing schema: refuse to read — the next prepare overwrites it.\n return { schema: SCHEMA };\n }\n return { schema: SCHEMA, base: parsed.base };\n}\n\nexport function writePreparedState(state: PreparedVercelState): void {\n writePreparedStateRaw('vercel', state);\n}\n\n/** Update one field of the state without forcing callers to read/merge/write. */\nexport function updatePreparedState(mutate: (s: PreparedVercelState) => void): void {\n const s = readPreparedState();\n mutate(s);\n writePreparedState(s);\n}\n\n/**\n * Compute the CURRENT build-context fingerprint for the vercel base snapshot\n * (the SHA over every file `prepare` would `writeFiles` into the builder\n * sandbox). Side-effect-free — never builds. Returns `undefined` when the\n * runtime assets can't be resolved (dev tree without `pnpm -w build`) so\n * the CLI can degrade to \"can't tell, don't nag\".\n *\n * Used by `evaluateBaseFreshness` to compare against the stored value in\n * `vercel-prepared.json.base.contextSha256`. Must produce a byte-identical\n * hash to the one `prepare` writes — both go through the same\n * `resolveRuntimeAssets` + `computeContextSha256` chain.\n */\nexport async function currentVercelBaseFingerprintLive(\n claudeInstall: 'native' | 'npm' = 'native',\n): Promise<string | undefined> {\n try {\n const assets = resolveRuntimeAssets({ cliRuntimeRoot: findStagedCliRuntimeRoot() });\n // Fold in claudeInstall exactly as `prepare` does — otherwise an npm-baked\n // base never matches the stored (npm-folded) fingerprint.\n return claudeInstallFingerprint(\n await computeContextSha256(assets.map((a) => ({ rel: a.name, abs: a.localPath }))),\n claudeInstall,\n );\n } catch {\n return undefined;\n }\n}\n\n/**\n * First-use gate. If no base snapshot is recorded, throw an actionable error\n * pointing at `agentbox prepare --provider vercel`. Called by `backend.provision`\n * (indirectly via the snapshot resolution) and usable by the CLI.\n */\nexport function ensureVercelBaseSnapshot(): void {\n const state = readPreparedState();\n if (state.base !== undefined) return;\n throw new UserFacingError(\n 'no Vercel base snapshot found.\\n' +\n 'Run `agentbox prepare --provider vercel` first — Vercel cannot build images ' +\n 'from a Dockerfile, so the base snapshot is a one-time prerequisite for cloud boxes.',\n );\n}\n","/**\n * The Vercel Sandbox provider. A thin `CloudBackend` over `@vercel/sandbox`,\n * composed via `@agentbox/sandbox-cloud`'s `createCloudProvider` for everything\n * provider-agnostic (workspace seeding, ctl/VNC launch, state, relay polling).\n *\n * Three capabilities are overridden on top of the cloud scaffold:\n * - `prepare` — bake the base snapshot (Vercel can't build from a Dockerfile).\n * - `buildAttach` — SDK-streaming tmux bridge (Vercel has no SSH).\n * - `checkpoint` — store the Vercel snapshot *id* in the manifest so restore\n * boots from it (Vercel snapshots are id-addressed, not name-addressed).\n *\n * `launchDockerd: true` — Vercel Sandbox now supports nested containers, so the\n * base snapshot bakes the docker engine and the cloud scaffold auto-starts\n * dockerd on every create/resume (see agentbox-dockerd-start).\n */\n\nimport type { BoxRecord, Provider, ProviderCheckpoint } from '@agentbox/core';\nimport {\n createCloudProvider,\n currentCloudBaseFingerprint,\n listCloudCheckpoints,\n removeCloudCheckpointDir,\n resolveCloudCheckpoint,\n writeCloudCheckpointManifest,\n} from '@agentbox/sandbox-cloud';\nimport {\n vercelBackend,\n snapshotVercelSandbox,\n deleteVercelSnapshot,\n DEFAULT_BOX_IMAGE_REF,\n} from './backend.js';\nimport { readCliStamp, recordBox, type ProviderModule } from '@agentbox/sandbox-core';\nimport { prepareVercelProvider } from './prepare.js';\nimport { buildVercelAttach } from './build-attach.js';\nimport { currentVercelBaseFingerprintLive } from './prepared-state.js';\nimport { ensureVercelCredentials, setVercelCredentials } from './credentials.js';\nimport { doctorChecks, readCredStatusSummary } from './provider-module.js';\n\nconst BACKEND_NAME = 'vercel';\n\nconst cloudProvider = createCloudProvider(vercelBackend, {\n // Vercel couples RAM to vCPU at 2048 MB/vCPU; disk is a fixed 32 GB NVMe.\n defaultResources: { cpu: 2, memory: 4, disk: 32 },\n launchDockerd: true,\n});\n\n/**\n * Vercel-specific checkpoint capability. Unlike the scaffold's default (which\n * stores a caller-chosen snapshot *name*), we capture the opaque Vercel\n * snapshot id and store THAT in the manifest's `snapshotName` field — the cloud\n * create flow passes `manifest.snapshotName` straight to\n * `provision({ snapshot })`, and the Vercel backend boots from it as a snapshot\n * id. (The scaffold's `cloudSnapshotName` project-scoping isn't needed — Vercel\n * snapshot ids are already globally unique.)\n */\nconst vercelCheckpoint: ProviderCheckpoint = {\n async create(box: BoxRecord, name: string) {\n if (!box.projectRoot) {\n throw new Error(\n 'cloud checkpoint requires the box to have a project root (run `agentbox checkpoint` from inside the project)',\n );\n }\n if (!box.cloud?.sandboxId) {\n throw new Error(`vercel box ${box.name} has no sandboxId — record is malformed`);\n }\n // NOTE: snapshotting stops the source sandbox; persistent mode resumes it\n // on the next call. Surfaced to the user in `agentbox checkpoint` docs.\n const snapshotId = await snapshotVercelSandbox(box.cloud.sandboxId);\n // The box is now stopped — persist it so the fast `agentbox list` path\n // doesn't show a stale `running` after a checkpoint. Best-effort.\n try {\n await recordBox({ ...box, cloud: { ...box.cloud, lastState: 'paused' } });\n } catch {\n // not worth failing the checkpoint over a state-record write\n }\n const info = await writeCloudCheckpointManifest(box.projectRoot, BACKEND_NAME, name, {\n snapshotName: snapshotId,\n sourceBoxId: box.id,\n sourceBoxName: box.name,\n baseProvider: BACKEND_NAME,\n baseFingerprint: currentCloudBaseFingerprint(BACKEND_NAME),\n cliVersion: readCliStamp().cliVersion,\n });\n return { ref: info.name };\n },\n async list(projectRoot: string) {\n const entries = await listCloudCheckpoints(projectRoot, BACKEND_NAME);\n return entries.map((e) => ({ ref: e.name, createdAt: e.manifest.createdAt }));\n },\n async remove(projectRoot: string, ref: string) {\n const entry = await resolveCloudCheckpoint(projectRoot, BACKEND_NAME, ref);\n if (!entry) return;\n try {\n await deleteVercelSnapshot(entry.manifest.snapshotName);\n } catch {\n // best-effort: drop the local manifest even if the remote delete failed\n // (network/perms/already-gone) so the user isn't left with a dead pointer.\n }\n await removeCloudCheckpointDir(projectRoot, BACKEND_NAME, ref);\n },\n};\n\nexport const vercelProvider: Provider = {\n ...cloudProvider,\n prepare: prepareVercelProvider,\n buildAttach: buildVercelAttach,\n checkpoint: vercelCheckpoint,\n baseFingerprint: () => currentVercelBaseFingerprintLive(),\n};\n\n/** Uniform surface the CLI provider loader resolves this package through. */\nexport const providerModule: ProviderModule = {\n provider: vercelProvider,\n backend: vercelBackend,\n ensureCredentials: ensureVercelCredentials,\n readCredStatus: readCredStatusSummary,\n setCredentials: setVercelCredentials,\n currentBaseFingerprintLive: (claudeInstall) => currentVercelBaseFingerprintLive(claudeInstall),\n doctorChecks,\n};\n\nexport { vercelBackend, DEFAULT_BOX_IMAGE_REF };\nexport { ensureVercelEnvLoaded, reloadVercelEnv } from './env-loader.js';\nexport { ensureVercelCredentials, setVercelCredentials } from './credentials.js';\nexport type { EnsureVercelCredentialsOptions } from './credentials.js';\nexport {\n readVercelCredStatus,\n resolveVercelApiAuth,\n secretsPath,\n maskKey,\n type VercelCredStatus,\n} from './credentials.js';\nexport {\n getProject,\n createGitProject,\n deleteProject,\n patchProjectSettings,\n projectHasEnv,\n upsertProjectEnv,\n createGitDeployment,\n getDeployment,\n getProductionAlias,\n type VercelProjectFull,\n type CreateGitProjectInput,\n type CreateGitDeploymentInput,\n type DeploymentStatus,\n type VercelEnvVar,\n} from './vercel-rest.js';\nexport {\n prepareVercel,\n prepareVercelProvider,\n type PrepareVercelOptions,\n type PrepareVercelResult,\n} from './prepare.js';\nexport {\n currentVercelBaseFingerprintLive,\n ensureVercelBaseSnapshot,\n preparedStatePath,\n readPreparedState,\n writePreparedState,\n updatePreparedState,\n type PreparedVercelState,\n type PreparedVercelBase,\n} from './prepared-state.js';\nexport {\n RUNTIME_ASSETS,\n candidatesFor,\n resolveRuntimeAssets,\n findStagedCliRuntimeRoot,\n type RuntimeAsset,\n type ResolvedAsset,\n} from './runtime-assets.js';\nexport { buildVercelAttach } from './build-attach.js';\n","/**\n * Vercel `CloudBackend` — maps the provider-neutral cloud primitives onto\n * `@vercel/sandbox` v2 (Firecracker microVMs + snapshots). Composed into a full\n * `Provider` by `@agentbox/sandbox-cloud`'s `createCloudProvider`.\n *\n * Platform shape this backend is built around (see docs/cloud-providers.md):\n * - No custom image — sandboxes boot from a Vercel snapshot baked once by\n * `agentbox prepare --provider vercel`. `provision` always needs a snapshot\n * id (the prepared base, or a cloud-checkpoint snapshot).\n * - No SSH — `attachArgv` is intentionally omitted; the provider overrides\n * `buildAttach` with a Vercel-SDK-streaming helper instead.\n * - No nested containers — dockerd is disabled at the provider level.\n * - Persistent sandboxes auto-snapshot on stop and auto-resume on the next\n * `Sandbox.get({ resume: true })`, which is how pause/resume map cleanly.\n * - The sandbox's native user is `vercel-sandbox`; agentbox standardizes on\n * `vscode` (uid 1000), created by provision.sh. So `exec` drops privileges\n * to `vscode` (root → `sudo -u vscode`) unless the caller asks for root,\n * and `uploadFile` chowns to uid 1000 after the SDK writes as\n * `vercel-sandbox`.\n * - Max 4 exposed ports: we use 80 (WebProxy), 6080 (noVNC), 8788 (relay/ctl\n * bridge). One slot is left free for a future per-service expose.\n */\n\nimport { readFile } from 'node:fs/promises';\nimport type {\n CloudBackend,\n CloudExecOptions,\n CloudExecResult,\n CloudFileEntry,\n CloudHandle,\n CloudPreviewUrl,\n CloudProvisionRequest,\n CloudSandboxSummary,\n CloudState,\n} from '@agentbox/core';\nimport type { NetworkPolicy } from '@vercel/sandbox';\nimport {\n ensureFreshCredentials,\n resolveCredentials,\n Sandbox,\n Snapshot,\n type SandboxType,\n} from './sdk.js';\nimport { withVercelRetry } from './retry.js';\nimport { readPreparedState } from './prepared-state.js';\n\n/** Sentinel image ref the cloud-provider hands us when no --image was passed. */\nexport const DEFAULT_BOX_IMAGE_REF = 'agentbox/box:dev';\n\n/** Box user agentbox standardizes on. provision.sh creates it (uid auto-assigned —\n * the Vercel default user may already hold 1000, and there are no bind mounts so\n * the exact uid is irrelevant). chown targets it by name, not number. */\nconst BOX_USER = 'vscode';\nconst BOX_OWNER = 'vscode:vscode';\n\n/**\n * Base ports exposed at create. Vercel REJECTS privileged ports (<1024) with a\n * 400, so we cannot expose the scaffold's WebProxy on :80. Instead the in-box\n * WebProxy binds 8080 (set via `webProxyPort` → AGENTBOX_WEB_PROXY_PORT) and we\n * expose 8080 here so `sandbox.domain(8080)` routes to it → the in-box `expose:`\n * service. Ports are fixed at create (update can't add a routable port to a\n * running sandbox — verified), so 8080 must be in this base set. The other two\n * base ports are 6080 (noVNC) and 8788 (the relay/ctl bridge the host poller\n * reaches via `sandbox.domain(8788)`). Remaining slots (up to VERCEL_MAX_PORTS)\n * are filled at create from `agentbox.yaml` `expose:` ports (see buildExposedPorts).\n */\nexport const VERCEL_EXPOSED_PORTS = [8080, 6080, 8788] as const;\n\n/** Vercel's hard per-sandbox exposed-port cap. */\nexport const VERCEL_MAX_PORTS = 4;\n\n/**\n * Merge requested `expose:` service ports into the base set: drop privileged\n * (<1024 — Vercel 400s) and out-of-range ports + dupes, preserve order, and cap\n * at Vercel's 4-port limit. A preview URL only routes to a port declared here at\n * create time, so this is what makes `services.*.expose` reachable on Vercel.\n */\nexport function buildExposedPorts(extra: readonly number[] | undefined): number[] {\n const ports = [...VERCEL_EXPOSED_PORTS] as number[];\n const seen = new Set<number>(ports);\n for (const p of extra ?? []) {\n if (ports.length >= VERCEL_MAX_PORTS) break;\n if (Number.isInteger(p) && p >= 1024 && p < 65_536 && !seen.has(p)) {\n ports.push(p);\n seen.add(p);\n }\n }\n return ports;\n}\n\n/**\n * Parse the `box.vercelNetworkPolicy` config string into a Vercel\n * `NetworkPolicy`. `''`/unset → undefined (SDK default = allow-all). The\n * literals `allow-all` / `deny-all` pass through; anything else is treated as a\n * comma-separated domain allowlist `{ allow: [...] }` (everything else denied).\n */\nexport function parseNetworkPolicy(raw: string | undefined): NetworkPolicy | undefined {\n const v = (raw ?? '').trim();\n if (v === '') return undefined;\n if (v === 'allow-all' || v === 'deny-all') return v;\n const allow = v\n .split(',')\n .map((s) => s.trim())\n .filter((s) => s.length > 0);\n return allow.length > 0 ? { allow } : undefined;\n}\n\n/**\n * Default per-session timeout. 45 min is the Hobby ceiling, so it's safe across\n * all plans; persistent mode makes a hit transparent (the VM auto-snapshots and\n * auto-resumes on the next SDK call). Pro/Enterprise users who want a longer\n * single session can rely on `extendTimeout` / future config.\n */\nconst DEFAULT_TIMEOUT_MS = 45 * 60_000;\n\n/**\n * Per-box snapshot retention. Keep one auto-snapshot, never expiring, so a\n * paused box can always resume; `destroy` purges a box's own snapshot explicitly.\n *\n * `deleteEvicted: false` is load-bearing, NOT a tweak. A box boots from a shared\n * snapshot (the prepared base, or a `setup` checkpoint), and Vercel reports that\n * source as the box's `currentSnapshotId` until it takes its first auto-snapshot\n * — i.e. the source is the first member of this box's retention window. With\n * `deleteEvicted: true`, the box's first stop/snapshot evicts the source and\n * DELETES it, nuking the shared base/checkpoint every other box depends on, so\n * every later `create` 410s with \"Snapshot expired or deleted.\" (Same hazard the\n * `destroy` guard already dodges, but eviction is automatic and bypasses it.)\n * `false` keeps evicted snapshots around (they fall back to `snapshotExpiration`,\n * which we pin to 0 = never at create) — trading a little snapshot accumulation\n * for never deleting a snapshot another box boots from.\n */\nconst KEEP_LAST_SNAPSHOTS = { count: 1, expiration: 0, deleteEvicted: false } as const;\n\nfunction creds(): Partial<{ token: string; teamId: string; projectId: string }> {\n return resolveCredentials();\n}\n\n/** Single-quote a string for safe embedding inside a `bash -lc '<…>'`. */\nfunction shq(s: string): string {\n return \"'\" + s.replace(/'/g, \"'\\\\''\") + \"'\";\n}\n\nasync function getSandbox(id: string): Promise<SandboxType> {\n // resume:false — plain handle resolution; lifecycle methods opt into resume.\n return Sandbox.get({ name: id, resume: false, ...creds() });\n}\n\nasync function maybeGetSandbox(id: string): Promise<SandboxType | null> {\n try {\n return await getSandbox(id);\n } catch {\n return null;\n }\n}\n\n/**\n * Map Vercel's session status onto our 4-value `CloudState`. Transitional\n * states report as 'running' so callers don't ping-pong; 'stopped' maps to\n * 'paused' because a persistent sandbox keeps an auto-snapshot and resumes on\n * the next call (our pause semantics). 'aborted'/'failed' → 'missing'.\n */\nfunction mapState(s: string | undefined): CloudState {\n switch (s) {\n case 'running':\n return 'running';\n case 'pending':\n case 'stopping':\n case 'snapshotting':\n return 'running';\n case 'stopped':\n return 'paused';\n case 'aborted':\n case 'failed':\n default:\n return 'missing';\n }\n}\n\n/**\n * Build a `runCommand` invocation that runs `cmd` (already a shell string) as\n * the box user (`vscode`) by default, or as root when requested. Always starts\n * the SDK command as root (`sudo: true`) so the inner `sudo -u vscode` is\n * reliably passwordless, then drops privileges. cwd + env are applied inside\n * the dropped shell so they land in the right user/home context.\n */\nfunction buildRunCommand(\n cmd: string,\n opts?: CloudExecOptions,\n): { cmd: string; args: string[]; sudo: boolean } {\n const prelude: string[] = [];\n if (opts?.cwd) prelude.push(`cd ${shq(opts.cwd)}`);\n for (const [k, v] of Object.entries(opts?.env ?? {})) {\n // The value is shell-quoted, but the key is interpolated bare into a\n // `bash -lc` string that runs as root — reject anything that isn't a POSIX\n // env-var name so a key like `x;rm -rf /` can't inject a command.\n if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(k)) {\n throw new Error(`vercel exec: invalid env var name ${JSON.stringify(k)}`);\n }\n prelude.push(`export ${k}=${shq(v)}`);\n }\n const inner = [...prelude, cmd].join('\\n');\n const user = opts?.user ?? BOX_USER;\n if (user === 'root') {\n return { cmd: 'bash', args: ['-lc', inner], sudo: true };\n }\n return {\n cmd: 'bash',\n args: ['-lc', `sudo -u ${user} -H bash -lc ${shq(inner)}`],\n sudo: true,\n };\n}\n\nexport const vercelBackend: CloudBackend = {\n name: 'vercel',\n\n // Vercel rejects privileged ports (<1024) and can't add a routable port to a\n // running sandbox (update registers a route that 502s — verified). So the\n // in-box WebProxy binds 8080 (exposed at create via VERCEL_EXPOSED_PORTS) and\n // `agentbox url` resolves sandbox.domain(8080) → WebProxy → the in-box service.\n webProxyPort: 8080,\n\n async provision(req: CloudProvisionRequest): Promise<CloudHandle> {\n await ensureFreshCredentials();\n // Resolve the snapshot to boot from: an explicit cloud-checkpoint snapshot\n // (req.snapshot) wins, else the prepared base. Vercel can't build from a\n // Dockerfile, so there is no image fallback — fail loud with the fix.\n const snapshotId = req.snapshot ?? readPreparedState().base?.snapshotId;\n if (!snapshotId) {\n throw new Error(\n 'no Vercel base snapshot found.\\n' +\n 'Run `agentbox prepare --provider vercel` first — Vercel cannot build images ' +\n 'from a Dockerfile, so the base snapshot is a one-time prerequisite.',\n );\n }\n const networkPolicy = parseNetworkPolicy(req.networkPolicy);\n // No-retry: Sandbox.create is billable and non-idempotent — a timeout after\n // the request reached the origin could leave a duplicate sandbox we can't\n // reference for cleanup.\n const handle = await withVercelRetry(\n { method: 'provision', retryOnAmbiguous: false, attemptTimeoutMs: 900_000, backoffMs: [] },\n async () => {\n const sb = await Sandbox.create({\n name: req.name,\n source: { type: 'snapshot', snapshotId },\n resources: { vcpus: req.resources?.cpu ?? 2 },\n ports: buildExposedPorts(req.exposePorts),\n timeout: req.timeoutMs ?? DEFAULT_TIMEOUT_MS,\n env: req.env,\n tags: { agentbox: 'true', 'agentbox.name': req.name },\n persistent: true,\n // Pin the sandbox-default expiration to never. Evicted snapshots (see\n // KEEP_LAST_SNAPSHOTS) fall back to this, so the shared base/checkpoint\n // a box boots from is never re-stamped with a finite expiry on eviction.\n snapshotExpiration: 0,\n keepLastSnapshots: { ...KEEP_LAST_SNAPSHOTS },\n ...(networkPolicy ? { networkPolicy } : {}),\n ...creds(),\n });\n return { sandboxId: sb.name };\n },\n );\n // Agent credentials are seeded by `createCloudProvider`'s unified\n // post-provision step (`seedAgentVolumesIfFresh`) via `uploadFile` + `exec`\n // — the symlinks baked into provision.sh route ~/.claude/.credentials.json\n // etc. through to `~/.agentbox-creds/<agent>/`.\n return handle;\n },\n\n async get(sandboxId: string): Promise<CloudHandle | null> {\n await ensureFreshCredentials();\n return withVercelRetry({ method: 'get', retryOnAmbiguous: true }, async () => {\n const sb = await maybeGetSandbox(sandboxId);\n return sb ? { sandboxId: sb.name } : null;\n });\n },\n\n async list(): Promise<CloudSandboxSummary[]> {\n await ensureFreshCredentials();\n return withVercelRetry({ method: 'list', retryOnAmbiguous: true }, async () => {\n const page = await Sandbox.list({ ...creds() });\n const items = await page.toArray();\n return items\n .filter((sb) => sb.tags?.['agentbox'] === 'true')\n .map((sb): CloudSandboxSummary => {\n const summary: CloudSandboxSummary = { sandboxId: sb.name };\n const friendly = sb.tags?.['agentbox.name'] ?? sb.name;\n if (friendly) summary.name = friendly;\n if (typeof sb.createdAt === 'number') {\n summary.createdAt = new Date(sb.createdAt).toISOString();\n }\n summary.state = mapState(sb.status);\n return summary;\n });\n });\n },\n\n async start(h: CloudHandle): Promise<void> {\n await ensureFreshCredentials();\n await withVercelRetry(\n { method: 'start', retryOnAmbiguous: true, attemptTimeoutMs: 120_000 },\n async () => {\n // resume:true auto-resumes a persistent sandbox from its current snapshot.\n await Sandbox.get({ name: h.sandboxId, resume: true, ...creds() });\n },\n );\n },\n\n async stop(h: CloudHandle): Promise<void> {\n await ensureFreshCredentials();\n await withVercelRetry(\n { method: 'stop', retryOnAmbiguous: true, attemptTimeoutMs: 120_000 },\n async () => {\n const sb = await getSandbox(h.sandboxId);\n // For a persistent sandbox this captures an auto-snapshot and shuts the\n // VM down — resume happens lazily on the next Sandbox.get.\n await sb.stop();\n },\n );\n },\n\n // pause == stop on Vercel (the auto-snapshot IS the cold-storage state).\n async pause(h: CloudHandle): Promise<void> {\n await this.stop(h);\n },\n\n async resume(h: CloudHandle): Promise<void> {\n await this.start(h);\n },\n\n async destroy(h: CloudHandle): Promise<void> {\n await ensureFreshCredentials();\n await withVercelRetry(\n { method: 'destroy', retryOnAmbiguous: true, attemptTimeoutMs: 120_000 },\n async () => {\n const sb = await maybeGetSandbox(h.sandboxId);\n if (!sb) return; // already gone — destroy is idempotent\n // Purge only a snapshot THIS box created (its own stop-time auto-\n // snapshot), never the shared base/source it booted from. A fresh box\n // has currentSnapshotId === sourceSnapshotId === the prepared base, and\n // deleting that would nuke the base snapshot every other box depends on.\n const snapId = sb.currentSnapshotId;\n const source = sb.sourceSnapshotId;\n const base = readPreparedState().base?.snapshotId;\n const ownSnapshot =\n snapId !== undefined && snapId !== source && snapId !== base;\n await sb.delete();\n if (ownSnapshot) {\n try {\n const snap = await Snapshot.get({ snapshotId: snapId, ...creds() });\n await snap.delete();\n } catch {\n // best-effort: a snapshot already gone is fine; the user can clean\n // stragglers from the Vercel dashboard.\n }\n }\n },\n );\n },\n\n async state(h: CloudHandle): Promise<CloudState> {\n await ensureFreshCredentials();\n return withVercelRetry({ method: 'state', retryOnAmbiguous: true }, async () => {\n const sb = await maybeGetSandbox(h.sandboxId);\n if (!sb) return 'missing';\n return mapState(sb.status);\n });\n },\n\n async exec(h: CloudHandle, cmd: string, opts?: CloudExecOptions): Promise<CloudExecResult> {\n await ensureFreshCredentials();\n return withVercelRetry(\n {\n method: 'exec',\n retryOnAmbiguous: opts?.noRetry ? false : true,\n attemptTimeoutMs: opts?.attemptTimeoutMs ?? 120_000,\n backoffMs: opts?.noRetry ? [] : undefined,\n },\n async () => {\n const sb = await getSandbox(h.sandboxId);\n const r = await sb.runCommand(buildRunCommand(cmd, opts));\n const [stdout, stderr] = await Promise.all([r.stdout(), r.stderr()]);\n return { exitCode: r.exitCode, stdout, stderr };\n },\n );\n },\n\n async uploadFile(h: CloudHandle, localPath: string, remotePath: string): Promise<void> {\n await ensureFreshCredentials();\n await withVercelRetry(\n { method: 'uploadFile', retryOnAmbiguous: true, attemptTimeoutMs: 300_000 },\n async () => {\n const content = await readFile(localPath);\n const sb = await getSandbox(h.sandboxId);\n await sb.writeFiles([{ path: remotePath, content }]);\n // writeFiles writes as `vercel-sandbox`; chown to the box user so the\n // scaffold's vscode-context reads/extractions succeed. Best-effort —\n // a chown failure on a world-readable /tmp staging file is harmless.\n try {\n await sb.runCommand({ cmd: 'chown', args: [BOX_OWNER, remotePath], sudo: true });\n } catch {\n // ignore — file is at least present and readable\n }\n },\n );\n },\n\n async downloadFile(h: CloudHandle, remotePath: string, localPath: string): Promise<void> {\n await ensureFreshCredentials();\n await withVercelRetry(\n { method: 'downloadFile', retryOnAmbiguous: true, attemptTimeoutMs: 300_000 },\n async () => {\n const sb = await getSandbox(h.sandboxId);\n const written = await sb.downloadFile(\n { path: remotePath },\n { path: localPath },\n { mkdirRecursive: true },\n );\n if (written === null) {\n throw new Error(`vercel downloadFile: source not found: ${remotePath}`);\n }\n },\n );\n },\n\n async listFiles(h: CloudHandle, remoteDir: string): Promise<CloudFileEntry[]> {\n await ensureFreshCredentials();\n return withVercelRetry({ method: 'listFiles', retryOnAmbiguous: true }, async () => {\n const sb = await getSandbox(h.sandboxId);\n const entries = await sb.fs.readdir(remoteDir, { withFileTypes: true });\n return entries.map((e) => ({ name: e.name, isDir: e.isDirectory() }));\n });\n },\n\n async previewUrl(h: CloudHandle, port: number): Promise<CloudPreviewUrl> {\n await ensureFreshCredentials();\n return withVercelRetry({ method: 'previewUrl', retryOnAmbiguous: true }, async () => {\n const sb = await getSandbox(h.sandboxId);\n // sb.domain(port) is a public HTTPS URL (no header token needed).\n return { url: sb.domain(port), token: undefined };\n });\n },\n\n // Fewer params than the interface's (h, port, expiresInSeconds) is fine —\n // Vercel sandbox domains are already public + browser-usable, so the signed\n // URL is just the standard one (the TTL is governed by the sandbox session\n // lifetime, not a per-URL signature, so the expiry arg is irrelevant here).\n async signedPreviewUrl(h: CloudHandle, port: number): Promise<CloudPreviewUrl> {\n return this.previewUrl(h, port);\n },\n\n // Vercel `extendTimeout` is ADDITIVE (adds to the current deadline) and the\n // remaining time isn't readable, so the host passes its tracked deadline and\n // we extend by the delta to land the death-time at `target`. The host only\n // calls when target > current, so this never shortens. A plan-cap rejection\n // bubbles to the keepalive loop's catch (it lets the box lapse at the cap).\n async renewTimeout(\n h: CloudHandle,\n targetDeadlineEpochMs: number,\n currentDeadlineEpochMs: number,\n ): Promise<void> {\n const deltaMs = Math.max(0, targetDeadlineEpochMs - currentDeadlineEpochMs);\n if (deltaMs === 0) return;\n await ensureFreshCredentials();\n await withVercelRetry({ method: 'renewTimeout', retryOnAmbiguous: true }, async () => {\n const sb = await getSandbox(h.sandboxId);\n await sb.extendTimeout(deltaMs);\n });\n },\n\n async snapshotExists(snapshotName: string): Promise<boolean> {\n await ensureFreshCredentials();\n return withVercelRetry({ method: 'snapshotExists', retryOnAmbiguous: true }, async () => {\n try {\n const snap = await Snapshot.get({ snapshotId: snapshotName, ...creds() });\n // `Snapshot.get` resolves deleted/failed tombstones (status field) rather\n // than throwing, so \"didn't throw\" wrongly passes a dead snapshot. Only a\n // 'created' snapshot can actually boot a sandbox.\n return snap.status === 'created';\n } catch {\n return false;\n }\n });\n },\n\n // NOTE: no `createSnapshot`/`deleteSnapshot` here. Vercel snapshots are\n // addressed by an opaque id (not a caller-chosen name), which doesn't fit the\n // CloudBackend `createSnapshot(handle, name): void` contract — the provider\n // needs the id back to store it in the checkpoint manifest. The Vercel\n // provider therefore overrides the whole `checkpoint` capability in index.ts\n // using `snapshotVercelSandbox` / `deleteVercelSnapshot` below.\n};\n\n/**\n * Snapshot a running sandbox and return the resulting Vercel snapshot id.\n * `sb.snapshot()` stops the source sandbox as part of capture; persistent mode\n * resumes it on the next SDK call, so the box comes back automatically.\n */\nexport async function snapshotVercelSandbox(sandboxId: string): Promise<string> {\n await ensureFreshCredentials();\n return withVercelRetry(\n { method: 'createSnapshot', retryOnAmbiguous: false, attemptTimeoutMs: 900_000, backoffMs: [] },\n async () => {\n const sb = await getSandbox(sandboxId);\n const snap = await sb.snapshot({ expiration: 0 });\n return snap.snapshotId;\n },\n );\n}\n\n/** Delete a Vercel snapshot by id. Idempotent — a missing snapshot is success. */\nexport async function deleteVercelSnapshot(snapshotId: string): Promise<void> {\n await ensureFreshCredentials();\n await withVercelRetry({ method: 'deleteSnapshot', retryOnAmbiguous: true }, async () => {\n try {\n const snap = await Snapshot.get({ snapshotId, ...creds() });\n await snap.delete();\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n if (/not.?found|404/i.test(msg)) return; // idempotent\n throw err;\n }\n });\n}\n","/**\n * Bounded retry wrapper for Vercel Sandbox SDK calls — mirrors\n * `withDaytonaRetry` / `withHetznerRetry` in shape and intent. The Vercel\n * control plane rate-limits (429) and can return transient 5xx during\n * incidents; without bounded retries those propagate as wedges in the calling\n * lifecycle code.\n *\n * Non-idempotent ops (`provision`/`Sandbox.create`, `createSnapshot`) pass\n * `retryOnAmbiguous: false` so a timeout after the request reached the origin\n * doesn't create a duplicate billable sandbox/snapshot.\n */\n\nexport interface WithRetryOptions {\n method: string;\n /** Per-attempt timeout (ms). Default 30_000. */\n attemptTimeoutMs?: number;\n /** Backoff before attempts 2, 3, … (ms). Default [1000, 2000, 4000]. */\n backoffMs?: readonly number[];\n /**\n * Retry on errors where we can't be sure the server applied the request\n * (connection failures, per-attempt timeouts, 5xx). Set false for\n * non-idempotent operations where a retry could create a duplicate resource.\n */\n retryOnAmbiguous: boolean;\n /** Override the default stderr retry sink (used by tests). */\n onRetry?: (line: string) => void;\n}\n\nconst DEFAULT_BACKOFF: readonly number[] = [1000, 2000, 4000];\nconst DEFAULT_ATTEMPT_TIMEOUT_MS = 30_000;\n\nclass AttemptTimeoutError extends Error {\n constructor(method: string, ms: number) {\n super(`vercel ${method}: per-attempt timeout after ${String(ms)}ms`);\n this.name = 'AttemptTimeoutError';\n }\n}\n\nexport function isAttemptTimeout(err: unknown): err is AttemptTimeoutError {\n return err instanceof AttemptTimeoutError;\n}\n\n/** HTTP status code dug out of whatever error shape the SDK throws. */\nfunction statusCodeOf(err: unknown): number | undefined {\n if (!err || typeof err !== 'object') return undefined;\n for (const key of ['statusCode', 'status', 'code'] as const) {\n const v = (err as Record<string, unknown>)[key];\n if (typeof v === 'number') return v;\n }\n const resp = (err as { response?: { status?: unknown } }).response;\n if (resp && typeof resp.status === 'number') return resp.status;\n return undefined;\n}\n\nexport function isRetriable(err: unknown, allowAmbiguous: boolean): boolean {\n if (err instanceof AttemptTimeoutError) return allowAmbiguous;\n\n const status = statusCodeOf(err);\n if (status !== undefined) {\n if (status === 429) return true; // rate limited — the server told us to wait\n if (status >= 500 && status <= 599) return allowAmbiguous;\n return false; // 4xx (auth, validation, not_found) — permanent\n }\n\n // Raw fetch / undici errors. Node wraps low-level errors in `{ cause }`.\n if (err && typeof err === 'object') {\n const candidates: unknown[] = [err, (err as { cause?: unknown }).cause];\n for (const c of candidates) {\n if (!c || typeof c !== 'object') continue;\n const code = (c as { code?: unknown }).code;\n if (\n code === 'ECONNRESET' ||\n code === 'ETIMEDOUT' ||\n code === 'ECONNABORTED' ||\n code === 'EAI_AGAIN' ||\n code === 'ECONNREFUSED' ||\n code === 'ENOTFOUND' ||\n code === 'UND_ERR_SOCKET' ||\n code === 'UND_ERR_CONNECT_TIMEOUT'\n ) {\n return allowAmbiguous;\n }\n }\n }\n return false;\n}\n\nexport async function withVercelRetry<T>(\n opts: WithRetryOptions,\n fn: () => Promise<T>,\n): Promise<T> {\n const backoff = opts.backoffMs ?? DEFAULT_BACKOFF;\n const maxAttempts = backoff.length + 1;\n const timeoutMs = opts.attemptTimeoutMs ?? DEFAULT_ATTEMPT_TIMEOUT_MS;\n const log = opts.onRetry ?? defaultRetryLog;\n\n for (let attempt = 1; attempt <= maxAttempts; attempt++) {\n try {\n return await raceTimeout(fn(), timeoutMs, opts.method);\n } catch (err) {\n const last = attempt === maxAttempts;\n if (last || !isRetriable(err, opts.retryOnAmbiguous)) throw err;\n const delay = backoff[attempt - 1] ?? backoff[backoff.length - 1] ?? 4000;\n log(\n `vercel ${opts.method}: attempt ${String(attempt)} failed (${errorSummary(err)}); retrying in ${String(delay)}ms`,\n );\n await sleep(delay);\n }\n }\n throw new Error(`withVercelRetry: exhausted attempts for ${opts.method}`);\n}\n\nfunction defaultRetryLog(line: string): void {\n process.stderr.write(`\\n[vercel-retry] ${line}\\n`);\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((r) => setTimeout(r, ms));\n}\n\nasync function raceTimeout<T>(p: Promise<T>, ms: number, method: string): Promise<T> {\n let timer: ReturnType<typeof setTimeout> | undefined;\n try {\n return await Promise.race([\n p,\n new Promise<never>((_resolve, reject) => {\n timer = setTimeout(() => reject(new AttemptTimeoutError(method, ms)), ms);\n }),\n ]);\n } finally {\n if (timer !== undefined) clearTimeout(timer);\n }\n}\n\nfunction errorSummary(err: unknown): string {\n if (err instanceof Error) {\n const status = statusCodeOf(err);\n return status !== undefined\n ? `${err.name}(${String(status)}): ${truncate(err.message)}`\n : `${err.name}: ${truncate(err.message)}`;\n }\n return truncate(String(err));\n}\n\nfunction truncate(s: string, max = 160): string {\n return s.length > max ? `${s.slice(0, max)}…` : s;\n}\n","/**\n * `agentbox prepare --provider vercel` — bake the per-team Vercel base\n * snapshot. Vercel can't build an image from a Dockerfile, so (like hetzner)\n * we boot a fresh sandbox, run an installer, and snapshot the result. That\n * snapshot id is what every per-box `create` boots from.\n *\n * Flow:\n * 1. Resolve runtime assets + fingerprint the build context. Skip the bake\n * when an up-to-date base snapshot already exists (unless --force).\n * 2. `Sandbox.create({ runtime: 'node24', persistent: false })` — fresh AL2023.\n * 3. `writeFiles` the assets (ctl bundle, helpers, baked configs, provision.sh).\n * 4. Run provision.sh as root, streaming output to the prepare log.\n * 5. Stage host agent static config (claude/codex/opencode) into the snapshot.\n * 6. `sandbox.snapshot({ expiration: 0 })` → the never-expiring base snapshot.\n * 7. Persist the snapshot id into ~/.agentbox/vercel-prepared.json.\n * 8. Delete the builder sandbox.\n *\n * Step 8 is safe: a Vercel snapshot is an independent, id-addressed resource\n * that survives its source sandbox's deletion (verified live — snapshot stays\n * `status: 'created'` and boots a fresh sandbox after the builder is deleted).\n * We delete it best-effort *after* the snapshot id is persisted, so a delete\n * failure only leaves a lingering sandbox for Vercel's reaper, never a broken\n * bake.\n */\n\nimport { readFile } from 'node:fs/promises';\nimport { Writable } from 'node:stream';\nimport type { Provider } from '@agentbox/core';\nimport { claudeInstallFingerprint, computeContextSha256, readCliStamp } from '@agentbox/sandbox-core';\nimport {\n stageClaudeStaticForUpload,\n stageCodexStaticForUpload,\n stageOpencodeStaticForUpload,\n type StageResult,\n} from '@agentbox/sandbox-cloud';\nimport { ensureVercelCredentials } from './credentials.js';\nimport {\n ensureFreshCredentials,\n resolveCredentials,\n Sandbox,\n Snapshot,\n type SandboxType,\n} from './sdk.js';\nimport {\n preparedStatePath,\n readPreparedState,\n writePreparedState,\n} from './prepared-state.js';\nimport {\n findStagedCliRuntimeRoot,\n resolveRuntimeAssets,\n type ResolvedAsset,\n} from './runtime-assets.js';\n\nexport interface PrepareVercelOptions {\n name?: string;\n hostWorkspace?: string;\n /** Force re-bake even when an up-to-date base snapshot is recorded. */\n force?: boolean;\n /** vCPUs for the builder sandbox (default 4 for a fast bake). */\n vcpus?: number;\n /** CLI runtime tree (set by the CLI to its dist neighbor). */\n cliRuntimeRoot?: string;\n /** Repo root for the dev fallback (defaults to a cwd-walk). */\n repoRoot?: string;\n /** How provision.sh installs Claude Code (`native` default | `npm`). */\n claudeInstall?: 'native' | 'npm';\n onLog?: (line: string) => void;\n}\n\nexport interface PrepareVercelResult {\n snapshotName?: string;\n}\n\nconst BUILDER_TIMEOUT_MS = 25 * 60_000;\nconst SHELL = '/bin/bash';\n\nexport async function prepareVercel(\n opts: PrepareVercelOptions = {},\n): Promise<PrepareVercelResult> {\n await ensureVercelCredentials();\n await ensureFreshCredentials();\n const creds = resolveCredentials();\n const log = opts.onLog ?? (() => {});\n const progress = (s: string) => log(`prepare-vercel: ${s}`);\n\n const assets = resolveRuntimeAssets({\n cliRuntimeRoot: opts.cliRuntimeRoot ?? findStagedCliRuntimeRoot(),\n repoRoot: opts.repoRoot,\n });\n const claudeInstall = opts.claudeInstall ?? 'native';\n const contextSha = claudeInstallFingerprint(\n await computeContextSha256(assets.map((a) => ({ rel: a.name, abs: a.localPath }))),\n claudeInstall,\n );\n\n // Skip-fast: existing base snapshot still on Vercel + matching fingerprint.\n const existing = readPreparedState();\n if (!opts.force && existing.base) {\n const stillThere = await snapshotExists(existing.base.snapshotId, creds);\n if (stillThere && existing.base.contextSha256 === contextSha) {\n progress(\n `base snapshot ${existing.base.snapshotId} already exists (fingerprint ${contextSha.slice(0, 12)} matches); skipping (pass --force to rebuild)`,\n );\n return { snapshotName: existing.base.snapshotId };\n }\n if (!stillThere) {\n progress(`recorded base snapshot ${existing.base.snapshotId} is gone on Vercel; rebuilding`);\n } else {\n progress(\n `build context changed (was ${existing.base.contextSha256?.slice(0, 12) ?? '<none>'}, now ${contextSha.slice(0, 12)}); rebuilding`,\n );\n }\n }\n\n progress(`creating builder sandbox (node24, ${String(opts.vcpus ?? 4)} vcpus)`);\n const sb = await Sandbox.create({\n runtime: 'node24',\n resources: { vcpus: opts.vcpus ?? 4 },\n timeout: BUILDER_TIMEOUT_MS,\n tags: { agentbox: 'true', 'agentbox.role': 'prepare' },\n persistent: false,\n ...creds,\n });\n progress(`builder sandbox ${sb.name} up`);\n\n // 3. Upload assets.\n progress(`uploading ${String(assets.length)} runtime asset(s)`);\n await sb.writeFiles(\n await Promise.all(\n assets.map(async (a: ResolvedAsset) => ({\n path: a.remotePath,\n content: await readFile(a.localPath),\n mode: a.remoteMode,\n })),\n ),\n );\n\n // 4. Run provision.sh as root, streaming output.\n progress('running provision.sh (this takes a few minutes)');\n const install = await sb.runCommand({\n cmd: SHELL,\n args: ['-lc', `AGENTBOX_CLAUDE_INSTALL=${claudeInstall} bash /tmp/agentbox-provision.sh 2>&1`],\n sudo: true,\n stdout: lineSink((l) => log(`[provision] ${l}`)),\n stderr: lineSink((l) => log(`[provision] ${l}`)),\n });\n if (install.exitCode !== 0) {\n throw new Error(`provision.sh failed on the builder sandbox (exit ${String(install.exitCode)})`);\n }\n progress('provision.sh complete');\n\n // 5. Stage host agent static config into the snapshot (best-effort).\n await stageAgentConfig(sb, opts.hostWorkspace, log);\n\n // 6. Snapshot (never expires). NOTE: this stops the builder sandbox.\n progress('creating base snapshot (expiration: never)');\n const snap = await sb.snapshot({ expiration: 0 });\n progress(`snapshot created: ${snap.snapshotId}`);\n\n // 7. Persist.\n const cliStamp = readCliStamp();\n writePreparedState({\n schema: 1,\n base: {\n snapshotId: snap.snapshotId,\n contextSha256: contextSha,\n cliVersion: cliStamp.cliVersion,\n cliCommit: cliStamp.cliCommit,\n createdAt: new Date().toISOString(),\n },\n });\n progress(`wrote ${preparedStatePath()}`);\n\n // 8. Delete the builder. The snapshot is an independent resource that\n // survives this (verified live), and its id is already persisted above, so\n // this is best-effort: a failure just leaves the sandbox for Vercel's reaper.\n progress('deleting builder sandbox');\n try {\n await sb.delete();\n progress('builder sandbox deleted');\n } catch (err) {\n progress(\n `builder delete failed (left for Vercel reaper): ${err instanceof Error ? err.message : String(err)}`,\n );\n }\n\n progress(`prepare complete — base snapshot ${snap.snapshotId}`);\n return { snapshotName: snap.snapshotId };\n}\n\nasync function snapshotExists(\n snapshotId: string,\n creds: Partial<{ token: string; teamId: string; projectId: string }>,\n): Promise<boolean> {\n try {\n const snap = await Snapshot.get({ snapshotId, ...creds });\n // `Snapshot.get` resolves even for a deleted/failed snapshot (status field),\n // so a bare \"didn't throw\" wrongly skip-passes a tombstone. Only a 'created'\n // snapshot is bootable — anything else means rebuild.\n return snap.status === 'created';\n } catch {\n return false;\n }\n}\n\nasync function stageAgentConfig(\n sb: SandboxType,\n hostWorkspace: string | undefined,\n log: (line: string) => void,\n): Promise<void> {\n const progress = (s: string) => log(`prepare-vercel: ${s}`);\n progress('staging host agent static config');\n const stagings: Array<{ kind: 'claude' | 'codex' | 'opencode'; tar: StageResult; dest: string }> = [];\n try {\n const claudeTar = await stageClaudeStaticForUpload({ hostWorkspace });\n for (const w of claudeTar.warnings) progress(w);\n if (claudeTar.tarballPath) stagings.push({ kind: 'claude', tar: claudeTar, dest: '/home/vscode/.claude' });\n else await claudeTar.cleanup();\n\n const codexTar = await stageCodexStaticForUpload();\n for (const w of codexTar.warnings) progress(w);\n if (codexTar.tarballPath) stagings.push({ kind: 'codex', tar: codexTar, dest: '/home/vscode/.codex' });\n else await codexTar.cleanup();\n\n const opencodeTar = await stageOpencodeStaticForUpload();\n for (const w of opencodeTar.warnings) progress(w);\n if (opencodeTar.tarballPath) stagings.push({ kind: 'opencode', tar: opencodeTar, dest: '/home/vscode/.local/share/opencode' });\n else await opencodeTar.cleanup();\n\n for (const s of stagings) {\n const remote = `/tmp/agentbox-${s.kind}-static.tar.gz`;\n progress(`uploading ${s.kind} static config`);\n await sb.writeFiles([{ path: remote, content: await readFile(s.tar.tarballPath as string) }]);\n // Extract as vscode so files land owned by the box user. The dest dir\n // already exists (provision.sh's credential-pivot step) — extract into it.\n const extract =\n `sudo -u vscode mkdir -p ${s.dest} && ` +\n `sudo -u vscode tar -xzf ${remote} -C ${s.dest} --no-same-permissions --no-same-owner -m && ` +\n `rm -f ${remote}`;\n const r = await sb.runCommand({ cmd: SHELL, args: ['-lc', extract], sudo: true });\n if (r.exitCode !== 0) {\n progress(`WARN: ${s.kind} static extract failed (exit ${String(r.exitCode)}) — continuing`);\n } else {\n progress(`baked ${s.kind} static config into snapshot`);\n }\n }\n } finally {\n for (const s of stagings) await s.tar.cleanup();\n }\n}\n\n/**\n * Adapt a line-callback to the `Writable` the SDK's `runCommand` streams into.\n * Buffers partial lines so each `onLine` gets a complete line.\n */\nfunction lineSink(onLine: (line: string) => void): Writable {\n let buf = '';\n return new Writable({\n write(chunk: Buffer, _enc: BufferEncoding, cb: () => void) {\n buf += chunk.toString('utf8');\n let nl: number;\n while ((nl = buf.indexOf('\\n')) !== -1) {\n onLine(buf.slice(0, nl));\n buf = buf.slice(nl + 1);\n }\n cb();\n },\n final(cb: () => void) {\n if (buf.length > 0) onLine(buf);\n cb();\n },\n });\n}\n\n/** Provider-level binding used by the CLI's `prepare` command. */\nexport const prepareVercelProvider: NonNullable<Provider['prepare']> = (req) =>\n prepareVercel({\n name: req.name,\n hostWorkspace: req.hostWorkspace ?? process.cwd(),\n force: req.force,\n claudeInstall: req.claudeInstall,\n onLog: req.onLog,\n });\n","/**\n * `buildVercelAttach` — the Vercel provider's override of `Provider.buildAttach`.\n *\n * Vercel has no SSH, so the cloud scaffold's `ssh … -t '<cmd>'` argv is unusable.\n * Instead we drive the official Vercel Sandbox CLI (`sbx`/`sandbox`), which has a\n * real interactive PTY (`sbx exec -i`) and streams non-interactive output live —\n * giving a proper terminal with none of the old send-keys/capture-pane polling.\n *\n * Argv shape (validated against sbx 3.0.1):\n * sbx exec --sudo [-i] --project <p> --scope <team> <name>\n * -- sudo -u vscode -H bash -lc '<inner>'\n *\n * Notes:\n * - The sandbox's default exec user is `vercel-sandbox`; we pass `--sudo` (runs\n * as root) and then `sudo -u vscode -H` so tmux/agents run as the box user in\n * /workspace. Passing `sudo -u vscode …` directly as sbx's argv (not wrapped\n * in an outer `bash -lc`) avoids a double-`bash -lc` re-parse.\n * - `-i` only for interactive shell/agent attaches; detached pre-start and logs\n * run non-interactively (live stdout stream).\n * - The access token is passed via the child env (`VERCEL_AUTH_TOKEN`), never in\n * argv, so it can't leak through `ps`. project/scope are not secret → flags.\n * - `<inner>` is the shared cloud `renderInnerCommand` (same tmux ensure +\n * footer-aware config + `exec tmux attach` used by hetzner/daytona).\n */\n\nimport {\n type AttachKind,\n type AttachSpec,\n type BoxRecord,\n type BuildAttachOptions,\n} from '@agentbox/core';\nimport { hostTermForCloud, renderInnerCommand } from '@agentbox/sandbox-cloud';\nimport { detectSbx } from './sbx-cli.js';\nimport { ensureFreshCredentials, resolveCredentials } from './sdk.js';\n\nexport async function buildVercelAttach(\n box: BoxRecord,\n kind: AttachKind,\n opts?: BuildAttachOptions,\n): Promise<AttachSpec> {\n const sandboxId = box.cloud?.sandboxId;\n if (!sandboxId) {\n throw new Error(`vercel box ${box.name} has no sandboxId — record is malformed`);\n }\n\n const det = await detectSbx();\n if (!det.installed || !det.bin) {\n throw new Error(\n 'Vercel interactive attach needs the Vercel `sandbox` CLI — run ' +\n '`agentbox vercel login` (it installs it) or `npm install -g sandbox`.',\n );\n }\n\n await ensureFreshCredentials();\n const { token, teamId, projectId } = resolveCredentials();\n\n // Interactive (real PTY) only for live shell/agent attaches. Detached\n // pre-start and logs stream non-interactively.\n const interactive = (kind === 'shell' || kind === 'agent') && !opts?.detached;\n\n // `sbx exec` (unlike `ssh -t`) forwards neither TERM nor the locale, so the\n // box session lands in TERM=unknown + an ASCII (POSIX) locale — tmux then\n // collapses Claude Code's Unicode glyphs (logo, spinner, box-drawing) to `_`.\n // Force a UTF-8 locale and forward the host's TERM (matching the docker\n // provider) so a box that carries that terminfo renders at full fidelity;\n // renderInnerCommand's TERM guard downgrades to xterm-256color when it\n // doesn't, so an exotic host TERM (e.g. xterm-ghostty) never breaks attach.\n // hostTermForCloud sanitizes to a safe terminfo name — required because this\n // value is interpolated into the bash -lc prelude below.\n const envPrelude = `export LANG=C.UTF-8 LC_ALL=C.UTF-8 TERM=${hostTermForCloud()}; `;\n const inner = envPrelude + renderInnerCommand(kind, opts);\n\n const argv = [\n det.bin,\n 'exec',\n '--sudo',\n ...(interactive ? ['-i'] : []),\n '--project',\n projectId,\n '--scope',\n teamId,\n sandboxId,\n '--',\n 'sudo',\n '-u',\n 'vscode',\n '-H',\n 'bash',\n '-lc',\n inner,\n ];\n\n return { argv, env: { VERCEL_AUTH_TOKEN: token } };\n}\n","/**\n * Doctor probes + normalized credential status for the vercel provider,\n * assembled into `providerModule` in `index.ts`. Moved out of apps/cli so the\n * CLI dispatches to it generically (see `@agentbox/sandbox-core`'s `ProviderModule`).\n */\n\nimport { errSummary, type CheckResult, type CredStatusSummary } from '@agentbox/sandbox-core';\nimport { readVercelCredStatus } from './credentials.js';\nimport { readPreparedState } from './prepared-state.js';\n\nexport function readCredStatusSummary(): CredStatusSummary {\n const cred = readVercelCredStatus();\n return { configured: cred.auth !== 'none', label: cred.auth };\n}\n\nexport async function doctorChecks(): Promise<CheckResult[]> {\n try {\n const cred = readVercelCredStatus();\n const credRes: CheckResult =\n cred.auth === 'none'\n ? {\n label: 'credentials',\n status: 'warn',\n detail: 'not configured',\n hint: '`agentbox vercel login`',\n }\n : { label: 'credentials', status: 'ok', detail: `${cred.auth} (${cred.source})` };\n\n const prepared = readPreparedState();\n const snapRes: CheckResult = prepared.base?.snapshotId\n ? {\n label: 'base snapshot',\n status: 'ok',\n detail: `${prepared.base.snapshotId.slice(0, 16)}… (${prepared.base.cliVersion ?? '—'})`,\n }\n : {\n label: 'base snapshot',\n status: 'warn',\n detail: 'not baked',\n hint: '`agentbox prepare --provider vercel`',\n };\n return [credRes, snapRes];\n } catch (err) {\n return [{ label: 'credentials', status: 'warn', detail: errSummary(err) }];\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,YAAY,oBAAoB;AACzC,SAAS,eAAe;AACxB,SAAS,eAAe;ACaxB,SAAS,iBAAiB;AAC1B,SAAS,aAAa;AEhBtB,SAAS,WAAAA,gBAAe;AACxB,SAAS,WAAAC,gBAAe;AAExB;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;OACK;ACAP,SAAS,cAAAC,aAAY,gBAAAC,qBAAoB;AACzC,SAAS,WAAAC,gBAAe;AACxB,SAAS,YAAY;AC0KrB,SAAS,SAAS,gBAAgB;AC5KlC,SAAS,cAAAF,mBAAkB;AAC3B,SAAS,SAAS,WAAAG,gBAAe;AACjC,SAAS,qBAAqB;ANQ9B,IAAM,cAAc;EAClB;EACA;EACA;EACA;;;;EAIA;AACF;AAEA,IAAI,SAAS;AAEN,SAAS,wBAA8B;AAC5C,MAAI,OAAQ;AACZ,WAAS;AACT,uBAAqB,QAAQ,QAAQ,GAAG,aAAa,aAAa,GAAG,WAAW;AAClF;AAOO,SAAS,kBAAwB;AACtC,WAAS;AACT,wBAAsB;AACxB;AAEA,SAAS,qBAAqB,MAAc,MAA+B;AACzE,MAAI,CAAC,WAAW,IAAI,EAAG;AACvB,MAAI;AACJ,MAAI;AACF,WAAO,aAAa,MAAM,MAAM;EAClC,QAAQ;AACN;EACF;AACA,QAAM,SAAS,aAAa,IAAI;AAChC,aAAW,OAAO,MAAM;AACtB,QAAI,QAAQ,IAAI,GAAG,MAAM,OAAW;AACpC,UAAM,QAAQ,OAAO,GAAG;AACxB,QAAI,OAAO,UAAU,UAAU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1B;EACA,MAAM,KAAK,aAAqB;AAC9B,UAAM,UAAU,MAAM,qBAAqB,aAAa,YAAY;AACpE,WAAO,QAAQ,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,EAAE,SAAS,UAAU,EAAE;EAC9E;EACA,MAAM,OAAO,aAAqB,KAAa;AAC7C,UAAM,QAAQ,MAAM,uBAAuB,aAAa,cAAc,GAAG;AACzE,QAAI,CAAC,MAAO;AACZ,QAAI;AACF,YAAM,qBAAqB,MAAM,SAAS,YAAY;IACxD,QAAQ;IAGR;AACA,UAAM,yBAAyB,aAAa,cAAc,GAAG;EAC/D;AACF;AAEO,IAAM,iBAA2B;EACtC,GAAG;EACH,SAAS;EACT,aAAa;EACb,YAAY;EACZ,iBAAiB,MAAM,iCAAiC;AAC1D;AAGO,IAAM,iBAAiC;EAC5C,UAAU;EACV,SAAS;EACT,mBAAmB;EACnB,gBAAgB;EAChB,gBAAgB;EAChB,4BAA4B,CAAC,kBAAkB,iCAAiC,aAAa;EAC7F;AACF;","names":["homedir","resolve","existsSync","readFileSync","homedir","resolve","text","homedir","existsSync","readFileSync","teamId","projectId","creds","spawnSync","resolve","readFile","log","creds","readFile","readCliStamp"]}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
DOCKER_CONTEXT_FILE_MAP,
|
|
4
|
+
claudeInstallFingerprint,
|
|
4
5
|
computeContextSha256,
|
|
5
6
|
hostOpenCommand,
|
|
6
7
|
readCliStamp,
|
|
7
8
|
readPreparedStateRaw,
|
|
8
9
|
resolveContextFilesFrom,
|
|
10
|
+
writeManagedSecrets,
|
|
9
11
|
writePreparedStateRaw
|
|
10
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-ALEYDWAO.js";
|
|
11
13
|
|
|
12
|
-
// ../../packages/sandbox-daytona/dist/chunk-
|
|
14
|
+
// ../../packages/sandbox-daytona/dist/chunk-6WHCUMQO.js
|
|
13
15
|
import { existsSync } from "fs";
|
|
14
16
|
import { dirname, resolve } from "path";
|
|
15
17
|
import { fileURLToPath } from "url";
|
|
@@ -29,16 +31,8 @@ import {
|
|
|
29
31
|
DaytonaValidationError
|
|
30
32
|
} from "@daytonaio/sdk";
|
|
31
33
|
import { spawnSync } from "child_process";
|
|
32
|
-
import {
|
|
33
|
-
chmodSync,
|
|
34
|
-
existsSync as existsSync3,
|
|
35
|
-
mkdirSync,
|
|
36
|
-
readFileSync as readFileSync2,
|
|
37
|
-
renameSync,
|
|
38
|
-
writeFileSync
|
|
39
|
-
} from "fs";
|
|
40
34
|
import { homedir as homedir2 } from "os";
|
|
41
|
-
import {
|
|
35
|
+
import { resolve as resolve3 } from "path";
|
|
42
36
|
import {
|
|
43
37
|
cancel,
|
|
44
38
|
confirm,
|
|
@@ -51,8 +45,9 @@ import {
|
|
|
51
45
|
spinner,
|
|
52
46
|
text
|
|
53
47
|
} from "@clack/prompts";
|
|
54
|
-
import {
|
|
55
|
-
import {
|
|
48
|
+
import { createHash } from "crypto";
|
|
49
|
+
import { existsSync as existsSync3 } from "fs";
|
|
50
|
+
import { dirname as dirname2, resolve as resolve4 } from "path";
|
|
56
51
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
57
52
|
function resolveDockerfileContext() {
|
|
58
53
|
const override = process.env.AGENTBOX_DOCKER_CONTEXT;
|
|
@@ -696,41 +691,39 @@ function applyToEnv(creds) {
|
|
|
696
691
|
if (creds.organizationId) process.env.DAYTONA_ORGANIZATION_ID = creds.organizationId;
|
|
697
692
|
}
|
|
698
693
|
function persistCredentials(creds) {
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
694
|
+
const record = {};
|
|
695
|
+
if (creds.apiKey) record.DAYTONA_API_KEY = creds.apiKey;
|
|
696
|
+
if (creds.jwtToken) record.DAYTONA_JWT_TOKEN = creds.jwtToken;
|
|
697
|
+
if (creds.organizationId) record.DAYTONA_ORGANIZATION_ID = creds.organizationId;
|
|
698
|
+
writeManagedSecrets(MANAGED_KEYS, record);
|
|
699
|
+
}
|
|
700
|
+
async function setDaytonaCredentials(fields) {
|
|
701
|
+
const apiKey = (fields.apiKey ?? "").trim();
|
|
702
|
+
const jwtToken = (fields.jwtToken ?? "").trim();
|
|
703
|
+
const organizationId = (fields.organizationId ?? "").trim();
|
|
704
|
+
let creds;
|
|
705
|
+
if (apiKey) {
|
|
706
|
+
creds = { apiKey };
|
|
707
|
+
} else if (jwtToken && organizationId) {
|
|
708
|
+
creds = { jwtToken, organizationId };
|
|
709
|
+
} else {
|
|
710
|
+
return {
|
|
711
|
+
ok: false,
|
|
712
|
+
error: "provide apiKey, or jwtToken + organizationId",
|
|
713
|
+
status: { configured: false }
|
|
714
|
+
};
|
|
709
715
|
}
|
|
710
|
-
const
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
const lines = [];
|
|
718
|
-
if (creds.apiKey) lines.push(`DAYTONA_API_KEY=${creds.apiKey}`);
|
|
719
|
-
if (creds.jwtToken) lines.push(`DAYTONA_JWT_TOKEN=${creds.jwtToken}`);
|
|
720
|
-
if (creds.organizationId) lines.push(`DAYTONA_ORGANIZATION_ID=${creds.organizationId}`);
|
|
721
|
-
const body = (kept ? `${kept}
|
|
722
|
-
` : "") + lines.join("\n") + "\n";
|
|
723
|
-
const tmp = `${path}.tmp`;
|
|
724
|
-
writeFileSync(tmp, body, { mode: 384 });
|
|
725
|
-
try {
|
|
726
|
-
chmodSync(tmp, 384);
|
|
727
|
-
} catch {
|
|
728
|
-
}
|
|
729
|
-
renameSync(tmp, path);
|
|
730
|
-
try {
|
|
731
|
-
chmodSync(path, 384);
|
|
732
|
-
} catch {
|
|
716
|
+
const result = await validateCredentials(creds);
|
|
717
|
+
if (!result.ok && result.kind === "auth") {
|
|
718
|
+
return {
|
|
719
|
+
ok: false,
|
|
720
|
+
error: `credentials rejected by Daytona: ${result.message}`,
|
|
721
|
+
status: { configured: false }
|
|
722
|
+
};
|
|
733
723
|
}
|
|
724
|
+
persistCredentials(creds);
|
|
725
|
+
const label = result.ok ? creds.apiKey ? "key" : "jwt" : "key (unvalidated)";
|
|
726
|
+
return { ok: true, status: { configured: true, label } };
|
|
734
727
|
}
|
|
735
728
|
function openDashboard() {
|
|
736
729
|
try {
|
|
@@ -767,13 +760,13 @@ var SCHEMA = 1;
|
|
|
767
760
|
function resolveDaytonaContextFiles() {
|
|
768
761
|
const ctx = resolveDockerfileContext();
|
|
769
762
|
if (!ctx) return null;
|
|
770
|
-
const here =
|
|
763
|
+
const here = dirname2(fileURLToPath2(import.meta.url));
|
|
771
764
|
const packageRoot = resolve4(here, "..");
|
|
772
765
|
const monorepoRoot = resolve4(here, "..", "..", "..");
|
|
773
766
|
const dockerPackageRoot = resolve4(monorepoRoot, "packages", "sandbox-docker");
|
|
774
767
|
const docker = resolveContextFilesFrom(DOCKER_CONTEXT_FILE_MAP, {
|
|
775
768
|
contextDir: ctx.context,
|
|
776
|
-
devRoot:
|
|
769
|
+
devRoot: existsSync3(dockerPackageRoot) ? dockerPackageRoot : packageRoot
|
|
777
770
|
});
|
|
778
771
|
if (!docker) return null;
|
|
779
772
|
const overlay = resolveDaytonaCustomClaudeMd();
|
|
@@ -786,15 +779,19 @@ function resolveDaytonaContextFiles() {
|
|
|
786
779
|
{ rel: "daytona/custom-system-CLAUDE.md", abs: overlay }
|
|
787
780
|
];
|
|
788
781
|
}
|
|
782
|
+
var DAYTONA_SEED_SCHEMA = "relctx-1";
|
|
789
783
|
async function computeDaytonaContextFingerprint() {
|
|
790
784
|
const files = resolveDaytonaContextFiles();
|
|
791
785
|
if (!files) return null;
|
|
792
|
-
|
|
786
|
+
const rawSha = await computeContextSha256(files);
|
|
787
|
+
const contextSha256 = createHash("sha256").update(`${rawSha}\0daytona-seed=${DAYTONA_SEED_SCHEMA}`).digest("hex");
|
|
788
|
+
return { contextSha256, files };
|
|
793
789
|
}
|
|
794
|
-
async function currentDaytonaBaseFingerprintLive() {
|
|
790
|
+
async function currentDaytonaBaseFingerprintLive(claudeInstall = "native") {
|
|
795
791
|
try {
|
|
796
792
|
const fp = await computeDaytonaContextFingerprint();
|
|
797
|
-
|
|
793
|
+
if (!fp?.contextSha256) return void 0;
|
|
794
|
+
return claudeInstallFingerprint(fp.contextSha256, claudeInstall);
|
|
798
795
|
} catch {
|
|
799
796
|
return void 0;
|
|
800
797
|
}
|
|
@@ -832,6 +829,7 @@ export {
|
|
|
832
829
|
getClient,
|
|
833
830
|
daytonaBackend,
|
|
834
831
|
ensureDaytonaCredentials,
|
|
832
|
+
setDaytonaCredentials,
|
|
835
833
|
secretsPath,
|
|
836
834
|
readDaytonaCredStatus,
|
|
837
835
|
maskKey,
|
|
@@ -841,4 +839,4 @@ export {
|
|
|
841
839
|
writePreparedDaytonaState,
|
|
842
840
|
preparedMatches
|
|
843
841
|
};
|
|
844
|
-
//# sourceMappingURL=chunk-
|
|
842
|
+
//# sourceMappingURL=chunk-O2NDZQHN.js.map
|