@madarco/agentbox 0.22.1 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +93 -0
- package/dist/{_cloud-attach-YH2SU75S.js → _cloud-attach-RFPLNACE.js} +5 -5
- package/dist/{chunk-GGWVTWJM.js → chunk-6OQENOJZ.js} +16 -13
- package/dist/chunk-6OQENOJZ.js.map +1 -0
- package/dist/{chunk-ALEYDWAO.js → chunk-CKC3CP7Y.js} +494 -148
- package/dist/chunk-CKC3CP7Y.js.map +1 -0
- package/dist/{chunk-O67ZESNL.js → chunk-ERMU7RMK.js} +43 -58
- package/dist/{chunk-O67ZESNL.js.map → chunk-ERMU7RMK.js.map} +1 -1
- package/dist/chunk-G3H2L3O2.js +0 -0
- package/dist/{chunk-KBVD2UUQ.js → chunk-JXDSSSXS.js} +3 -3
- package/dist/{chunk-CDEJ2GQK.js → chunk-L5SOSNQI.js} +4 -4
- package/dist/{chunk-W2FLHB54.js → chunk-Q626V2YX.js} +2 -2
- package/dist/{chunk-YZXXBHWG.js → chunk-QGL734YX.js} +170 -53
- package/dist/chunk-QGL734YX.js.map +1 -0
- package/dist/{chunk-VBSRJG53.js → chunk-QT3SHMLY.js} +9 -1
- package/dist/chunk-QT3SHMLY.js.map +1 -0
- package/dist/{chunk-O2NDZQHN.js → chunk-QVWGQJV6.js} +2 -2
- package/dist/chunk-WJFZJZIM.js +0 -0
- package/dist/cloud-poller-SUNA6ZQC-7M5LJHHE.js +0 -0
- package/dist/{dist-QBXEP4VY.js → dist-2BTJQUJS.js} +2 -2
- package/dist/{dist-UR2DB2HT.js → dist-GEHCZJCS.js} +6 -6
- package/dist/{dist-LJHS4PTC.js → dist-GJCIKH2C.js} +6 -6
- package/dist/{dist-EJXUKIR7.js → dist-JFUUDAI3.js} +18 -4
- package/dist/{dist-QNV4H6NN.js → dist-W5476E2U.js} +6 -6
- package/dist/{dist-YECTRVGD.js → dist-Z3GSHEFO.js} +8 -7
- package/dist/index.js +1339 -782
- package/dist/index.js.map +1 -1
- package/dist/{prepared-state-5FIGV4BE-BMUK63FD.js → prepared-state-LW2PKTEQ-5YMKG7UN.js} +2 -2
- package/package.json +28 -27
- package/runtime/_shared/agentbox-checkpoint-cleanup +0 -0
- package/runtime/_shared/agentbox-dockerd-start +0 -0
- package/runtime/_shared/agentbox-open +0 -0
- package/runtime/_shared/agentbox-portless-trust +0 -0
- package/runtime/_shared/agentbox-vnc-start +0 -0
- package/runtime/_shared/ctl.cjs +13 -1
- package/runtime/_shared/gh-shim +0 -0
- package/runtime/_shared/git-shim +0 -0
- package/runtime/_shared/linear-shim +0 -0
- package/runtime/_shared/ntn-shim +0 -0
- package/runtime/docker/Dockerfile.box +12 -0
- package/runtime/docker/packages/ctl/dist/bin.cjs +13 -1
- package/runtime/docker/packages/sandbox-docker/scripts/agentbox-checkpoint-cleanup +0 -0
- package/runtime/docker/packages/sandbox-docker/scripts/agentbox-dockerd-start +0 -0
- package/runtime/docker/packages/sandbox-docker/scripts/agentbox-open +0 -0
- package/runtime/docker/packages/sandbox-docker/scripts/agentbox-portless-trust +0 -0
- package/runtime/docker/packages/sandbox-docker/scripts/agentbox-sshd-start +44 -0
- package/runtime/docker/packages/sandbox-docker/scripts/agentbox-vnc-start +0 -0
- package/runtime/docker/packages/sandbox-docker/scripts/chromium-resolver +0 -0
- package/runtime/docker/packages/sandbox-docker/scripts/gh-shim +0 -0
- package/runtime/docker/packages/sandbox-docker/scripts/git-shim +0 -0
- package/runtime/docker/packages/sandbox-docker/scripts/linear-shim +0 -0
- package/runtime/docker/packages/sandbox-docker/scripts/ntn-shim +0 -0
- package/runtime/e2b/agentbox-checkpoint-cleanup +0 -0
- package/runtime/e2b/agentbox-dockerd-start +0 -0
- package/runtime/e2b/agentbox-open +0 -0
- package/runtime/e2b/agentbox-vnc-start +0 -0
- package/runtime/e2b/ctl.cjs +13 -1
- package/runtime/e2b/gh-shim +0 -0
- package/runtime/e2b/git-shim +0 -0
- package/runtime/e2b/linear-shim +0 -0
- package/runtime/e2b/ntn-shim +0 -0
- package/runtime/e2b/scripts/build-template.sh +0 -0
- package/runtime/hetzner/agentbox-checkpoint-cleanup +0 -0
- package/runtime/hetzner/agentbox-dockerd-start +0 -0
- package/runtime/hetzner/agentbox-open +0 -0
- package/runtime/hetzner/agentbox-portless-trust +0 -0
- package/runtime/hetzner/agentbox-vnc-start +0 -0
- package/runtime/hetzner/ctl.cjs +13 -1
- package/runtime/hetzner/gh-shim +0 -0
- package/runtime/hetzner/git-shim +0 -0
- package/runtime/hetzner/linear-shim +0 -0
- package/runtime/hetzner/ntn-shim +0 -0
- package/runtime/hetzner/scripts/install-box.sh +0 -0
- package/runtime/hub/apps/hub/.next/BUILD_ID +1 -1
- package/runtime/hub/apps/hub/.next/app-path-routes-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/build-manifest.json +3 -3
- package/runtime/hub/apps/hub/.next/routes-manifest.json +22 -0
- package/runtime/hub/apps/hub/.next/server/app/(auth)/signin/page_client-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/open/route/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/open/route/build-manifest.json +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/open/route/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/open/route.js +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/open/route.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/open/route.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/open/route_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/rename/route/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/rename/route/build-manifest.json +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/rename/route/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/rename/route.js +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/rename/route.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/rename/route.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/rename/route_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/open-targets/route/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/open-targets/route/build-manifest.json +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/open-targets/route/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/open-targets/route.js +8 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/open-targets/route.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/open-targets/route.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/open-targets/route_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page_client-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page/server-reference-manifest.json +12 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page_client-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page/server-reference-manifest.json +12 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page/server-reference-manifest.json +12 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page_client-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page_client-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.html +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/0m4a_kysely_dist_095p8vu._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/0ssw__next-internal_server_app_(dashboard)_api_v1_open-targets_route_actions_1z-vd4m.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/1jcg_server_app_(dashboard)_api_v1_boxes_[id]_open_route_actions_1agwl8h.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/1jcg_server_app_(dashboard)_api_v1_boxes_[id]_rename_route_actions_0mf3a9p.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0d1lmiq._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0keu6we._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0ql4fjo._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0szd4sh._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0vs8fma._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0w9ud8u._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0yhb0gc._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1-0flwc._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1a50b07._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1bqbkd5._.js +2 -2
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1dn_3i1._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1hqla7-._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1js2jdv._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1nepkp-._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1q5bqse._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1qa4a0v._.js +2 -2
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1thipug._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1v9om6g._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/_06f2faq._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/_0760z6y._.js +14 -14
- package/runtime/hub/apps/hub/.next/server/chunks/_0f3molr._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/_0lgs9kd._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/044u_hub__next-internal_server_app_(dashboard)_projects_[id]_page_actions_15f56np.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/_09gdzmo._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0ozyjt1._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0ro6vh6._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0tgpglr._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/_1laion6._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_0b_hsjl._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub__next-internal_server_app_(dashboard)_boxes_[id]_page_actions_0k7kgn2.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub__next-internal_server_app_(dashboard)_page_actions_1t3u0xy.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_app_(dashboard)_boxes_[id]_page_tsx_1-j_972._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_app_(dashboard)_boxes_components_box-table_tsx_0a9pyn_._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_components_1z1p98f._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/functions-config-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/middleware-build-manifest.js +3 -3
- package/runtime/hub/apps/hub/.next/server/pages/500.html +1 -1
- package/runtime/hub/apps/hub/.next/server/server-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/server-reference-manifest.json +24 -0
- package/runtime/hub/apps/hub/.next/static/chunks/1py5tlz57h7ra.js +1 -0
- package/runtime/hub/apps/hub/.next/static/chunks/{3y2c7woqhtx9s.js → 23fswvjrabu89.js} +1 -1
- package/runtime/hub/apps/hub/.next/static/chunks/2xc1sm79a6tsb.js +1 -0
- package/runtime/hub/apps/hub/.next/static/chunks/3nedwutnzpdis.css +3 -0
- package/runtime/hub/apps/hub/.next/static/chunks/3p86ecqhr_7yy.js +1 -0
- package/runtime/hub/apps/hub/.next/static/chunks/3qof5hg87qf5n.js +1 -0
- package/runtime/hub/apps/hub/{auth-YBXDRLHG.js → auth-675P3LQS.js} +2 -2
- package/runtime/hub/apps/hub/{auth-config-LJGI76HI.js → auth-config-AOBEKRZQ.js} +2 -2
- package/runtime/hub/apps/hub/{chunk-OBKLTPIR.js → chunk-56YQBVN2.js} +1 -1
- package/runtime/hub/apps/hub/{chunk-JDA7BPPN.js → chunk-6HD4PARX.js} +9 -9
- package/runtime/hub/apps/hub/{chunk-AKLBSCSZ.js → chunk-EXQCBM5Q.js} +8 -0
- package/runtime/hub/apps/hub/{chunk-V5KGFHCF.js → chunk-JQFB2CNA.js} +132 -16
- package/runtime/hub/apps/hub/{chunk-LJG4CEGS.js → chunk-K6RA5GJI.js} +412 -117
- package/runtime/hub/apps/hub/{dist-ELOY2IUE.js → dist-3HR4RIPE.js} +17 -3
- package/runtime/hub/apps/hub/{dist-GGM4BUKM.js → dist-7GNKBKFV.js} +29 -42
- package/runtime/hub/apps/hub/{dist-BF54UNHK.js → dist-JWVTVHBT.js} +4 -4
- package/runtime/hub/apps/hub/{dist-CM4YAQLI.js → dist-OUNL2TCW.js} +4 -4
- package/runtime/hub/apps/hub/{dist-IENF7YOD.js → dist-STQK5XM6.js} +1 -1
- package/runtime/hub/apps/hub/{dist-FDBOJ74K.js → dist-TOHA4OA5.js} +4 -4
- package/runtime/hub/apps/hub/{hub-token-EW32VDIU.js → hub-token-2BZFBBW3.js} +2 -2
- package/runtime/hub/apps/hub/{prepared-state-5FIGV4BE-FIXKBF5A.js → prepared-state-LW2PKTEQ-7BCXARGA.js} +1 -1
- package/runtime/hub/apps/hub/server.js +153 -31
- package/runtime/relay/bin.cjs +13 -1
- package/runtime/vercel/agentbox-checkpoint-cleanup +0 -0
- package/runtime/vercel/agentbox-dockerd-start +0 -0
- package/runtime/vercel/agentbox-open +0 -0
- package/runtime/vercel/agentbox-vnc-start +0 -0
- package/runtime/vercel/ctl.cjs +13 -1
- package/runtime/vercel/gh-shim +0 -0
- package/runtime/vercel/git-shim +0 -0
- package/runtime/vercel/linear-shim +0 -0
- package/runtime/vercel/ntn-shim +0 -0
- package/runtime/vercel/scripts/provision.sh +0 -0
- package/LICENSE +0 -21
- package/dist/chunk-ALEYDWAO.js.map +0 -1
- package/dist/chunk-GGWVTWJM.js.map +0 -1
- package/dist/chunk-VBSRJG53.js.map +0 -1
- package/dist/chunk-YZXXBHWG.js.map +0 -1
- package/runtime/hub/apps/hub/.next/static/chunks/0dx4alyqu7cq1.css +0 -3
- package/runtime/hub/apps/hub/.next/static/chunks/0lq354ziiwxxl.js +0 -1
- package/runtime/hub/apps/hub/.next/static/chunks/11vmjdy3390ik.js +0 -1
- package/runtime/hub/apps/hub/.next/static/chunks/1svigjdfotduh.js +0 -1
- package/runtime/hub/apps/hub/.next/static/chunks/2d5e6t-5j4etp.js +0 -1
- /package/dist/{_cloud-attach-YH2SU75S.js.map → _cloud-attach-RFPLNACE.js.map} +0 -0
- /package/dist/{chunk-KBVD2UUQ.js.map → chunk-JXDSSSXS.js.map} +0 -0
- /package/dist/{chunk-CDEJ2GQK.js.map → chunk-L5SOSNQI.js.map} +0 -0
- /package/dist/{chunk-W2FLHB54.js.map → chunk-Q626V2YX.js.map} +0 -0
- /package/dist/{chunk-O2NDZQHN.js.map → chunk-QVWGQJV6.js.map} +0 -0
- /package/dist/{dist-EJXUKIR7.js.map → dist-2BTJQUJS.js.map} +0 -0
- /package/dist/{dist-UR2DB2HT.js.map → dist-GEHCZJCS.js.map} +0 -0
- /package/dist/{dist-LJHS4PTC.js.map → dist-GJCIKH2C.js.map} +0 -0
- /package/dist/{dist-QBXEP4VY.js.map → dist-JFUUDAI3.js.map} +0 -0
- /package/dist/{dist-QNV4H6NN.js.map → dist-W5476E2U.js.map} +0 -0
- /package/dist/{dist-YECTRVGD.js.map → dist-Z3GSHEFO.js.map} +0 -0
- /package/dist/{prepared-state-5FIGV4BE-BMUK63FD.js.map → prepared-state-LW2PKTEQ-5YMKG7UN.js.map} +0 -0
- /package/runtime/hub/apps/hub/.next/static/{TpPTWVdZDxqrPlONtJcR5 → 6WtaFwavHBpin3eT7-HjR}/_buildManifest.js +0 -0
- /package/runtime/hub/apps/hub/.next/static/{TpPTWVdZDxqrPlONtJcR5 → 6WtaFwavHBpin3eT7-HjR}/_clientMiddlewareManifest.js +0 -0
- /package/runtime/hub/apps/hub/.next/static/{TpPTWVdZDxqrPlONtJcR5 → 6WtaFwavHBpin3eT7-HjR}/_ssgManifest.js +0 -0
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
readE2bCredStatus,
|
|
6
6
|
readPreparedState as readPreparedState3,
|
|
7
7
|
secretsPath as secretsPath4
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-Q626V2YX.js";
|
|
9
9
|
import {
|
|
10
10
|
ADVANCED_HINT_GROUPS,
|
|
11
11
|
ALERT_BAND_ROWS,
|
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
subscribePrompts,
|
|
50
50
|
uploadImageFileToBox,
|
|
51
51
|
withFirewallRepair
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-6OQENOJZ.js";
|
|
53
53
|
import {
|
|
54
54
|
daytonaBackend,
|
|
55
55
|
ensureDaytonaCredentials,
|
|
@@ -57,7 +57,7 @@ import {
|
|
|
57
57
|
readDaytonaCredStatus,
|
|
58
58
|
readPreparedDaytonaState,
|
|
59
59
|
secretsPath
|
|
60
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-QVWGQJV6.js";
|
|
61
61
|
import {
|
|
62
62
|
deployControlPlaneToHetzner,
|
|
63
63
|
detectEgressIp,
|
|
@@ -69,7 +69,7 @@ import {
|
|
|
69
69
|
readPreparedState,
|
|
70
70
|
secretsPath as secretsPath2,
|
|
71
71
|
syncFirewallSource
|
|
72
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-ERMU7RMK.js";
|
|
73
73
|
import {
|
|
74
74
|
createGitDeployment,
|
|
75
75
|
createGitProject,
|
|
@@ -88,7 +88,7 @@ import {
|
|
|
88
88
|
resolveVercelApiAuth,
|
|
89
89
|
secretsPath as secretsPath3,
|
|
90
90
|
upsertProjectEnv
|
|
91
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-JXDSSSXS.js";
|
|
92
92
|
import {
|
|
93
93
|
agentSpecsForCloud,
|
|
94
94
|
baseFreshnessFromFingerprints,
|
|
@@ -100,7 +100,7 @@ import {
|
|
|
100
100
|
probeCloudCheckpoint,
|
|
101
101
|
resolveCloudCheckpoint,
|
|
102
102
|
seedAgentVolumesIfFresh
|
|
103
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-L5SOSNQI.js";
|
|
104
104
|
import {
|
|
105
105
|
ALL_CONNECTORS,
|
|
106
106
|
BOX_STATUS_EVENT,
|
|
@@ -202,6 +202,7 @@ import {
|
|
|
202
202
|
readBoxStatus,
|
|
203
203
|
readJob,
|
|
204
204
|
rebuildPluginNativeDeps,
|
|
205
|
+
refreshBoxSshd,
|
|
205
206
|
refreshExport,
|
|
206
207
|
registerBoxWithRelay,
|
|
207
208
|
rehydrateRelayRegistry,
|
|
@@ -247,10 +248,11 @@ import {
|
|
|
247
248
|
waitForTmuxPaneContent,
|
|
248
249
|
warmUpClaudeCredentials,
|
|
249
250
|
writeJob
|
|
250
|
-
} from "./chunk-
|
|
251
|
+
} from "./chunk-QGL734YX.js";
|
|
251
252
|
import {
|
|
252
253
|
BUILT_IN_DEFAULTS,
|
|
253
254
|
CLOUD_PROVIDER_NAMES,
|
|
255
|
+
GLOBAL_CONFIG_FILE,
|
|
254
256
|
KEY_REGISTRY,
|
|
255
257
|
PROVIDER_NAMES,
|
|
256
258
|
UserConfigError,
|
|
@@ -263,6 +265,7 @@ import {
|
|
|
263
265
|
listProjectsConfigured,
|
|
264
266
|
loadEffectiveConfig,
|
|
265
267
|
lookupKey,
|
|
268
|
+
parseUserConfig,
|
|
266
269
|
providerMeta,
|
|
267
270
|
pruneOrphanProjectConfigs,
|
|
268
271
|
registerProject,
|
|
@@ -271,7 +274,7 @@ import {
|
|
|
271
274
|
resolveDefaultCheckpoint,
|
|
272
275
|
setConfigValue,
|
|
273
276
|
unsetConfigValue
|
|
274
|
-
} from "./chunk-
|
|
277
|
+
} from "./chunk-QT3SHMLY.js";
|
|
275
278
|
import {
|
|
276
279
|
AmbiguousBoxError,
|
|
277
280
|
BoxNotFoundError,
|
|
@@ -281,6 +284,9 @@ import {
|
|
|
281
284
|
SUPPORTED_SDK_API_VERSIONS,
|
|
282
285
|
UserFacingError,
|
|
283
286
|
addPluginRecord,
|
|
287
|
+
agentboxAliasFor,
|
|
288
|
+
agentboxSshConfigPath,
|
|
289
|
+
autoWriteSshConfig,
|
|
284
290
|
boxGitCheckout,
|
|
285
291
|
boxGitNewBranch,
|
|
286
292
|
boxGitPull,
|
|
@@ -289,11 +295,15 @@ import {
|
|
|
289
295
|
boxRestartService,
|
|
290
296
|
boxRestartServices,
|
|
291
297
|
boxServicesStatusRaw,
|
|
298
|
+
claudeSettingsPath,
|
|
299
|
+
claudeSshEntryFor,
|
|
292
300
|
computeDockerContextFingerprint,
|
|
301
|
+
ensureCloudSshAlias,
|
|
293
302
|
ensureImage,
|
|
294
303
|
errSummary,
|
|
295
304
|
firstLine,
|
|
296
305
|
generateBoxId,
|
|
306
|
+
hasUnmanagedHostConflict,
|
|
297
307
|
hostBackupHasCredentials,
|
|
298
308
|
hostClaudeBackupExpired,
|
|
299
309
|
hostOpenCommand,
|
|
@@ -303,6 +313,7 @@ import {
|
|
|
303
313
|
isSupportedApiVersion,
|
|
304
314
|
mutateState,
|
|
305
315
|
normalizeLastAgent,
|
|
316
|
+
readAgentboxSshAlias,
|
|
306
317
|
readPluginRegistrySync,
|
|
307
318
|
readPreparedDockerState,
|
|
308
319
|
readState,
|
|
@@ -313,12 +324,16 @@ import {
|
|
|
313
324
|
removePluginRecord,
|
|
314
325
|
resolveAgentLauncher,
|
|
315
326
|
resolveBoxRef,
|
|
327
|
+
resolveCloudSshTarget,
|
|
316
328
|
resolveRuleRefs,
|
|
317
329
|
scanHostEnvFiles,
|
|
318
330
|
scratchBranchName,
|
|
331
|
+
setBoxDisplayName,
|
|
332
|
+
syncAgentboxSshConfig,
|
|
319
333
|
toQueueKind,
|
|
320
|
-
toSyncKind
|
|
321
|
-
|
|
334
|
+
toSyncKind,
|
|
335
|
+
upsertClaudeSshConfig
|
|
336
|
+
} from "./chunk-CKC3CP7Y.js";
|
|
322
337
|
import "./chunk-G3H2L3O2.js";
|
|
323
338
|
import {
|
|
324
339
|
__export,
|
|
@@ -326,14 +341,14 @@ import {
|
|
|
326
341
|
} from "./chunk-WJFZJZIM.js";
|
|
327
342
|
|
|
328
343
|
// src/version.ts
|
|
329
|
-
var AGENTBOX_VERSION = true ? "0.
|
|
330
|
-
var AGENTBOX_COMMIT = true ? "
|
|
344
|
+
var AGENTBOX_VERSION = true ? "0.23.0" : "0.0.0-dev";
|
|
345
|
+
var AGENTBOX_COMMIT = true ? "0a2aba48e" : "dev";
|
|
331
346
|
|
|
332
347
|
// src/index.ts
|
|
333
348
|
import { existsSync as _existsSync } from "fs";
|
|
334
349
|
import { dirname as _dirname, resolve as _resolve } from "path";
|
|
335
350
|
import { fileURLToPath as _fileURLToPath } from "url";
|
|
336
|
-
import { Command as
|
|
351
|
+
import { Command as Command62 } from "commander";
|
|
337
352
|
|
|
338
353
|
// src/engine-override.ts
|
|
339
354
|
async function applyEngineOverrideAtStartup() {
|
|
@@ -1091,9 +1106,9 @@ import { intro as intro2, log as log5, outro as outro2, spinner } from "@clack/p
|
|
|
1091
1106
|
import { Command as Command3 } from "commander";
|
|
1092
1107
|
import { execa as execa2 } from "execa";
|
|
1093
1108
|
import { spawn } from "child_process";
|
|
1094
|
-
import { existsSync as
|
|
1095
|
-
import { homedir } from "os";
|
|
1096
|
-
import { join as
|
|
1109
|
+
import { existsSync as existsSync3, readdirSync, readFileSync as readFileSync3, statSync, writeFileSync as writeFileSync2 } from "fs";
|
|
1110
|
+
import { homedir as homedir2 } from "os";
|
|
1111
|
+
import { join as join3 } from "path";
|
|
1097
1112
|
import { setTimeout as delay2 } from "timers/promises";
|
|
1098
1113
|
|
|
1099
1114
|
// src/commands/install-tray.ts
|
|
@@ -1101,10 +1116,60 @@ import { intro, log as log4, outro } from "@clack/prompts";
|
|
|
1101
1116
|
import { Command as Command2 } from "commander";
|
|
1102
1117
|
import { execa } from "execa";
|
|
1103
1118
|
import { createHash as createHash2 } from "crypto";
|
|
1104
|
-
import { existsSync, mkdtempSync, readFileSync, rmSync } from "fs";
|
|
1119
|
+
import { existsSync as existsSync2, mkdtempSync, readFileSync as readFileSync2, rmSync } from "fs";
|
|
1105
1120
|
import { tmpdir } from "os";
|
|
1106
|
-
import { join } from "path";
|
|
1121
|
+
import { join as join2 } from "path";
|
|
1107
1122
|
import { setTimeout as delay } from "timers/promises";
|
|
1123
|
+
|
|
1124
|
+
// src/lib/update-state.ts
|
|
1125
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
1126
|
+
import { homedir } from "os";
|
|
1127
|
+
import { dirname, join } from "path";
|
|
1128
|
+
var STATE_VERSION = 1;
|
|
1129
|
+
function updateStatePath() {
|
|
1130
|
+
return join(homedir(), ".agentbox", "update-state.json");
|
|
1131
|
+
}
|
|
1132
|
+
function readUpdateState() {
|
|
1133
|
+
const path = updateStatePath();
|
|
1134
|
+
if (!existsSync(path)) return { version: STATE_VERSION };
|
|
1135
|
+
try {
|
|
1136
|
+
const parsed = JSON.parse(readFileSync(path, "utf8"));
|
|
1137
|
+
const state = { version: STATE_VERSION };
|
|
1138
|
+
if (typeof parsed.lastRunVersion === "string") state.lastRunVersion = parsed.lastRunVersion;
|
|
1139
|
+
if (typeof parsed.traySha === "string") state.traySha = parsed.traySha;
|
|
1140
|
+
if (parsed.remoteCheck !== void 0 && typeof parsed.remoteCheck === "object" && typeof parsed.remoteCheck.checkedAt === "string") {
|
|
1141
|
+
state.remoteCheck = {
|
|
1142
|
+
checkedAt: parsed.remoteCheck.checkedAt,
|
|
1143
|
+
...typeof parsed.remoteCheck.npmLatest === "string" ? { npmLatest: parsed.remoteCheck.npmLatest } : {},
|
|
1144
|
+
...typeof parsed.remoteCheck.trayLatestSha === "string" ? { trayLatestSha: parsed.remoteCheck.trayLatestSha } : {}
|
|
1145
|
+
};
|
|
1146
|
+
}
|
|
1147
|
+
return state;
|
|
1148
|
+
} catch {
|
|
1149
|
+
return { version: STATE_VERSION };
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
function writeUpdateState(patch) {
|
|
1153
|
+
const state = readUpdateState();
|
|
1154
|
+
const merged = { ...state, ...patch, version: STATE_VERSION };
|
|
1155
|
+
for (const key of Object.keys(merged)) {
|
|
1156
|
+
if (merged[key] === void 0) delete merged[key];
|
|
1157
|
+
}
|
|
1158
|
+
const path = updateStatePath();
|
|
1159
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
1160
|
+
writeFileSync(path, JSON.stringify(merged, null, 2) + "\n");
|
|
1161
|
+
return merged;
|
|
1162
|
+
}
|
|
1163
|
+
var DAY_MS = 24 * 60 * 60 * 1e3;
|
|
1164
|
+
function remoteCheckFresh(state, now = /* @__PURE__ */ new Date()) {
|
|
1165
|
+
const at = state.remoteCheck?.checkedAt;
|
|
1166
|
+
if (at === void 0) return false;
|
|
1167
|
+
const t = Date.parse(at);
|
|
1168
|
+
if (Number.isNaN(t)) return false;
|
|
1169
|
+
return now.getTime() - t < DAY_MS && t - now.getTime() < DAY_MS;
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
// src/commands/install-tray.ts
|
|
1108
1173
|
var APP_NAME = "AgentBox";
|
|
1109
1174
|
var APP_PATH = `/Applications/${APP_NAME}.app`;
|
|
1110
1175
|
var APP_BUNDLE_ID = "com.madarco.agentbox-tray";
|
|
@@ -1123,23 +1188,26 @@ async function installTray(opts = {}) {
|
|
|
1123
1188
|
await execa("pkill", ["-x", APP_NAME]).catch(() => void 0);
|
|
1124
1189
|
await execa("pkill", ["-x", LEGACY_APP_NAME]).catch(() => void 0);
|
|
1125
1190
|
if (opts.uninstall) {
|
|
1126
|
-
if (
|
|
1127
|
-
if (
|
|
1191
|
+
if (existsSync2(APP_PATH)) rmSync(APP_PATH, { recursive: true, force: true });
|
|
1192
|
+
if (existsSync2(LEGACY_APP_PATH)) rmSync(LEGACY_APP_PATH, { recursive: true, force: true });
|
|
1193
|
+
writeUpdateState({ traySha: void 0 });
|
|
1128
1194
|
say(`Removed ${APP_PATH}. (Launch-at-login is unregistered by the app itself.)`);
|
|
1129
1195
|
return { ran: true };
|
|
1130
1196
|
}
|
|
1131
1197
|
let zip;
|
|
1198
|
+
let sha;
|
|
1132
1199
|
let scratch = null;
|
|
1133
1200
|
if (opts.zip) {
|
|
1134
|
-
if (!
|
|
1201
|
+
if (!existsSync2(opts.zip)) {
|
|
1135
1202
|
say(`No zip at ${opts.zip}.`);
|
|
1136
1203
|
return { ran: false, reason: "zip-missing" };
|
|
1137
1204
|
}
|
|
1138
1205
|
zip = opts.zip;
|
|
1206
|
+
sha = createHash2("sha256").update(readFileSync2(zip)).digest("hex");
|
|
1139
1207
|
} else {
|
|
1140
|
-
scratch = mkdtempSync(
|
|
1208
|
+
scratch = mkdtempSync(join2(tmpdir(), "agentbox-tray-"));
|
|
1141
1209
|
try {
|
|
1142
|
-
zip = await downloadAndVerify(opts.tag ?? DEFAULT_TAG, scratch, say);
|
|
1210
|
+
({ zipPath: zip, sha } = await downloadAndVerify(opts.tag ?? DEFAULT_TAG, scratch, say));
|
|
1143
1211
|
} catch (err) {
|
|
1144
1212
|
rmSync(scratch, { recursive: true, force: true });
|
|
1145
1213
|
say(`Download failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -1147,10 +1215,11 @@ async function installTray(opts = {}) {
|
|
|
1147
1215
|
}
|
|
1148
1216
|
}
|
|
1149
1217
|
try {
|
|
1150
|
-
if (
|
|
1218
|
+
if (existsSync2(APP_PATH)) rmSync(APP_PATH, { recursive: true, force: true });
|
|
1151
1219
|
await execa("ditto", ["-x", "-k", zip, "/Applications"]);
|
|
1152
|
-
if (
|
|
1220
|
+
if (existsSync2(LEGACY_APP_PATH)) rmSync(LEGACY_APP_PATH, { recursive: true, force: true });
|
|
1153
1221
|
await execa("xattr", ["-dr", "com.apple.quarantine", APP_PATH]).catch(() => void 0);
|
|
1222
|
+
writeUpdateState({ traySha: sha });
|
|
1154
1223
|
await launchTray(say);
|
|
1155
1224
|
} finally {
|
|
1156
1225
|
if (scratch) rmSync(scratch, { recursive: true, force: true });
|
|
@@ -1158,6 +1227,33 @@ async function installTray(opts = {}) {
|
|
|
1158
1227
|
say(`Installed ${APP_PATH} and launched it (look for the box icon in the menu bar).`);
|
|
1159
1228
|
return { ran: true };
|
|
1160
1229
|
}
|
|
1230
|
+
function trayInstalled() {
|
|
1231
|
+
return process.platform === "darwin" && existsSync2(APP_PATH);
|
|
1232
|
+
}
|
|
1233
|
+
async function fetchTraySidecarSha(tag2 = DEFAULT_TAG) {
|
|
1234
|
+
try {
|
|
1235
|
+
const { stdout } = await execa("curl", [
|
|
1236
|
+
"-fsSL",
|
|
1237
|
+
"--max-time",
|
|
1238
|
+
"5",
|
|
1239
|
+
`${RELEASE_BASE}/${tag2}/${APP_NAME}.zip.sha256`
|
|
1240
|
+
]);
|
|
1241
|
+
return parseSidecarSha(stdout);
|
|
1242
|
+
} catch {
|
|
1243
|
+
return void 0;
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
function parseSidecarSha(body) {
|
|
1247
|
+
const first = body.trim().split(/\s+/)[0]?.toLowerCase();
|
|
1248
|
+
return first && /^[0-9a-f]{64}$/.test(first) ? first : void 0;
|
|
1249
|
+
}
|
|
1250
|
+
function decideTrayUpdate(input) {
|
|
1251
|
+
if (!input.installed) return { update: false, reason: "not-installed" };
|
|
1252
|
+
if (input.latestSha === void 0) return { update: false, reason: "no-latest-sha" };
|
|
1253
|
+
if (input.stampedSha === void 0) return { update: true, reason: "no-stamp" };
|
|
1254
|
+
if (input.stampedSha !== input.latestSha) return { update: true, reason: "mismatch" };
|
|
1255
|
+
return { update: false, reason: "up-to-date" };
|
|
1256
|
+
}
|
|
1161
1257
|
async function trayRunning() {
|
|
1162
1258
|
return await execa("pgrep", ["-x", APP_NAME]).catch(() => null) !== null;
|
|
1163
1259
|
}
|
|
@@ -1174,17 +1270,17 @@ async function launchTray(say) {
|
|
|
1174
1270
|
}
|
|
1175
1271
|
async function downloadAndVerify(tag2, dir, say) {
|
|
1176
1272
|
const base = `${RELEASE_BASE}/${tag2}`;
|
|
1177
|
-
const zipPath =
|
|
1178
|
-
const shaPath =
|
|
1273
|
+
const zipPath = join2(dir, `${APP_NAME}.zip`);
|
|
1274
|
+
const shaPath = join2(dir, `${APP_NAME}.zip.sha256`);
|
|
1179
1275
|
say(`Downloading ${APP_NAME} (${tag2})\u2026`);
|
|
1180
1276
|
await execa("curl", ["-fSL", "-o", zipPath, `${base}/${APP_NAME}.zip`]);
|
|
1181
1277
|
await execa("curl", ["-fSL", "-o", shaPath, `${base}/${APP_NAME}.zip.sha256`]);
|
|
1182
|
-
const expected =
|
|
1183
|
-
const actual = createHash2("sha256").update(
|
|
1278
|
+
const expected = parseSidecarSha(readFileSync2(shaPath, "utf8"));
|
|
1279
|
+
const actual = createHash2("sha256").update(readFileSync2(zipPath)).digest("hex");
|
|
1184
1280
|
if (!expected || expected !== actual) {
|
|
1185
1281
|
throw new Error(`checksum mismatch (expected ${expected ?? "none"}, got ${actual})`);
|
|
1186
1282
|
}
|
|
1187
|
-
return zipPath;
|
|
1283
|
+
return { zipPath, sha: actual };
|
|
1188
1284
|
}
|
|
1189
1285
|
var installTrayCommand = new Command2("tray").description("Download and install the AgentBox Tray macOS menu-bar app into /Applications").option("--uninstall", "quit and remove the menu-bar app").option("--tag <tag>", "release tag to install from (default: tray-latest)").option("--zip <path>", "install a local AgentBox.zip instead of downloading").action(async (opts) => {
|
|
1190
1286
|
intro(opts.uninstall ? "Removing AgentBox Tray\u2026" : "Installing AgentBox Tray\u2026");
|
|
@@ -1194,7 +1290,7 @@ var installTrayCommand = new Command2("tray").description("Download and install
|
|
|
1194
1290
|
});
|
|
1195
1291
|
|
|
1196
1292
|
// src/commands/app.ts
|
|
1197
|
-
var DIAGNOSTIC_REPORTS_DIR =
|
|
1293
|
+
var DIAGNOSTIC_REPORTS_DIR = join3(homedir2(), "Library/Logs/DiagnosticReports");
|
|
1198
1294
|
var LOG_PREDICATE = `subsystem == "${APP_BUNDLE_ID}"`;
|
|
1199
1295
|
function ensureMac() {
|
|
1200
1296
|
if (process.platform === "darwin") return true;
|
|
@@ -1221,14 +1317,14 @@ async function stopTray() {
|
|
|
1221
1317
|
await execa2("pkill", ["-x", LEGACY_APP_NAME]).catch(() => void 0);
|
|
1222
1318
|
}
|
|
1223
1319
|
function ensureInstalled() {
|
|
1224
|
-
if (
|
|
1320
|
+
if (existsSync3(APP_PATH)) return true;
|
|
1225
1321
|
log5.error(`${APP_PATH} is not installed. Run \`agentbox install tray\` first.`);
|
|
1226
1322
|
process.exitCode = 1;
|
|
1227
1323
|
return false;
|
|
1228
1324
|
}
|
|
1229
1325
|
var IPS_NAME = new RegExp(`^${APP_NAME}[-_].*\\.ips$`, "i");
|
|
1230
1326
|
function listCrashReports() {
|
|
1231
|
-
const dirs = [DIAGNOSTIC_REPORTS_DIR,
|
|
1327
|
+
const dirs = [DIAGNOSTIC_REPORTS_DIR, join3(DIAGNOSTIC_REPORTS_DIR, "Retired")];
|
|
1232
1328
|
const reports = [];
|
|
1233
1329
|
for (const dir of dirs) {
|
|
1234
1330
|
let names;
|
|
@@ -1239,7 +1335,7 @@ function listCrashReports() {
|
|
|
1239
1335
|
}
|
|
1240
1336
|
for (const n of names) {
|
|
1241
1337
|
if (!IPS_NAME.test(n)) continue;
|
|
1242
|
-
const path =
|
|
1338
|
+
const path = join3(dir, n);
|
|
1243
1339
|
try {
|
|
1244
1340
|
reports.push({ name: n, path, mtimeMs: statSync(path).mtimeMs });
|
|
1245
1341
|
} catch {
|
|
@@ -1279,7 +1375,7 @@ function printCrashReports(reports, limit = 5) {
|
|
|
1279
1375
|
var statusSub = new Command3("status").description("Show whether the AgentBox app is running, with pid(s)").option("--json", "emit { running, pids, installed, appPath } as JSON").action(async (opts) => {
|
|
1280
1376
|
const mac = process.platform === "darwin";
|
|
1281
1377
|
const pids = mac ? await trayPids() : [];
|
|
1282
|
-
const installed = mac &&
|
|
1378
|
+
const installed = mac && existsSync3(APP_PATH);
|
|
1283
1379
|
if (opts.json) {
|
|
1284
1380
|
process.stdout.write(
|
|
1285
1381
|
JSON.stringify({ running: pids.length > 0, pids, installed, appPath: APP_PATH }, null, 2) + "\n"
|
|
@@ -1389,14 +1485,14 @@ async function writeBugReportBundle(outPath, last) {
|
|
|
1389
1485
|
const cliVersion = AGENTBOX_VERSION;
|
|
1390
1486
|
const macVersion = (await execa2("sw_vers", ["-productVersion"], { reject: false }).catch(() => null))?.stdout ?? "unknown";
|
|
1391
1487
|
const pids = await trayPids();
|
|
1392
|
-
const installed =
|
|
1488
|
+
const installed = existsSync3(APP_PATH);
|
|
1393
1489
|
const { text: logText, failureNote } = await trayUnifiedLog(last);
|
|
1394
1490
|
const reports = listCrashReports();
|
|
1395
1491
|
const newest = reports[0];
|
|
1396
1492
|
let newestBody = "";
|
|
1397
1493
|
if (newest) {
|
|
1398
1494
|
try {
|
|
1399
|
-
newestBody =
|
|
1495
|
+
newestBody = readFileSync3(newest.path, "utf8");
|
|
1400
1496
|
} catch (err) {
|
|
1401
1497
|
newestBody = `(failed to read ${newest.path}: ${err instanceof Error ? err.message : String(err)})`;
|
|
1402
1498
|
}
|
|
@@ -1422,7 +1518,7 @@ async function writeBugReportBundle(outPath, last) {
|
|
|
1422
1518
|
newestBody.trimEnd(),
|
|
1423
1519
|
""
|
|
1424
1520
|
].join("\n");
|
|
1425
|
-
|
|
1521
|
+
writeFileSync2(outPath, bundle);
|
|
1426
1522
|
s.stop("Diagnostics collected");
|
|
1427
1523
|
log5.info(`Wrote bug-report bundle to ${outPath}`);
|
|
1428
1524
|
}
|
|
@@ -1500,14 +1596,14 @@ async function password(opts) {
|
|
|
1500
1596
|
// src/control-plane/ensure-repo-installed.ts
|
|
1501
1597
|
import { confirm as confirm2, isCancel as isCancel2, log as clog, note } from "@clack/prompts";
|
|
1502
1598
|
import { spawn as spawn2 } from "child_process";
|
|
1503
|
-
import { existsSync as
|
|
1504
|
-
import { homedir as
|
|
1505
|
-
import { join as
|
|
1599
|
+
import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "fs";
|
|
1600
|
+
import { homedir as homedir3 } from "os";
|
|
1601
|
+
import { join as join4 } from "path";
|
|
1506
1602
|
import { execa as execa3 } from "execa";
|
|
1507
|
-
var CP_DIR =
|
|
1508
|
-
var ENV_PATH =
|
|
1509
|
-
var META_PATH =
|
|
1510
|
-
var REPOS_STATE =
|
|
1603
|
+
var CP_DIR = join4(homedir3(), ".agentbox", "control-plane");
|
|
1604
|
+
var ENV_PATH = join4(CP_DIR, "control-plane.env");
|
|
1605
|
+
var META_PATH = join4(CP_DIR, "control-plane.json");
|
|
1606
|
+
var REPOS_STATE = join4(CP_DIR, "repos.json");
|
|
1511
1607
|
function openInBrowser(url) {
|
|
1512
1608
|
try {
|
|
1513
1609
|
const child = spawn2(hostOpenCommand(), [url], { detached: true, stdio: "ignore" });
|
|
@@ -1517,14 +1613,14 @@ function openInBrowser(url) {
|
|
|
1517
1613
|
}
|
|
1518
1614
|
function loadControlPlaneMeta() {
|
|
1519
1615
|
try {
|
|
1520
|
-
return JSON.parse(
|
|
1616
|
+
return JSON.parse(readFileSync4(META_PATH, "utf8"));
|
|
1521
1617
|
} catch {
|
|
1522
1618
|
return null;
|
|
1523
1619
|
}
|
|
1524
1620
|
}
|
|
1525
1621
|
function loadLocalControlPlaneEnv() {
|
|
1526
|
-
if (!
|
|
1527
|
-
for (const line of
|
|
1622
|
+
if (!existsSync4(ENV_PATH)) return;
|
|
1623
|
+
for (const line of readFileSync4(ENV_PATH, "utf8").split("\n")) {
|
|
1528
1624
|
const m = /^([A-Z_]+)=(.*)$/.exec(line.trim());
|
|
1529
1625
|
if (m && !process.env[m[1]]) process.env[m[1]] = m[2];
|
|
1530
1626
|
}
|
|
@@ -1570,15 +1666,15 @@ function addRepoUrl(meta) {
|
|
|
1570
1666
|
}
|
|
1571
1667
|
function readReposState() {
|
|
1572
1668
|
try {
|
|
1573
|
-
return JSON.parse(
|
|
1669
|
+
return JSON.parse(readFileSync4(REPOS_STATE, "utf8"));
|
|
1574
1670
|
} catch {
|
|
1575
1671
|
return {};
|
|
1576
1672
|
}
|
|
1577
1673
|
}
|
|
1578
1674
|
function writeReposState(state) {
|
|
1579
1675
|
try {
|
|
1580
|
-
|
|
1581
|
-
|
|
1676
|
+
mkdirSync2(CP_DIR, { recursive: true });
|
|
1677
|
+
writeFileSync3(REPOS_STATE, JSON.stringify(state, null, 2) + "\n", { mode: 384 });
|
|
1582
1678
|
} catch {
|
|
1583
1679
|
}
|
|
1584
1680
|
}
|
|
@@ -1641,8 +1737,8 @@ import { Command as Command5 } from "commander";
|
|
|
1641
1737
|
|
|
1642
1738
|
// src/auth.ts
|
|
1643
1739
|
import { readFile } from "fs/promises";
|
|
1644
|
-
import { join as
|
|
1645
|
-
var AUTH_FILE =
|
|
1740
|
+
import { join as join5 } from "path";
|
|
1741
|
+
var AUTH_FILE = join5(STATE_DIR, "auth.json");
|
|
1646
1742
|
async function resolveClaudeAuth(processEnv, opts = {}) {
|
|
1647
1743
|
const env = {};
|
|
1648
1744
|
const envApiKey = processEnv["ANTHROPIC_API_KEY"];
|
|
@@ -1691,8 +1787,8 @@ function cloudSizingProviderOptions(providerName, cfg) {
|
|
|
1691
1787
|
|
|
1692
1788
|
// src/lib/queue/assert-creds.ts
|
|
1693
1789
|
import { stat } from "fs/promises";
|
|
1694
|
-
import { homedir as
|
|
1695
|
-
import { join as
|
|
1790
|
+
import { homedir as homedir4 } from "os";
|
|
1791
|
+
import { join as join6 } from "path";
|
|
1696
1792
|
async function fileExists(p) {
|
|
1697
1793
|
try {
|
|
1698
1794
|
await stat(p);
|
|
@@ -1710,14 +1806,14 @@ async function claudeCredStatus(env, isCloud) {
|
|
|
1710
1806
|
}
|
|
1711
1807
|
async function codexAuthAvailable(image, env = process.env) {
|
|
1712
1808
|
if ((env["OPENAI_API_KEY"] ?? "").length > 0) return true;
|
|
1713
|
-
if (await fileExists(
|
|
1809
|
+
if (await fileExists(join6(homedir4(), ".codex", "auth.json"))) return true;
|
|
1714
1810
|
return volumeHasCodexAuth(SHARED_CODEX_VOLUME, image);
|
|
1715
1811
|
}
|
|
1716
1812
|
async function opencodeAuthAvailable(image, env = process.env) {
|
|
1717
1813
|
for (const k of OPENCODE_FORWARDED_ENV_KEYS) {
|
|
1718
1814
|
if ((env[k] ?? "").length > 0) return true;
|
|
1719
1815
|
}
|
|
1720
|
-
if (await fileExists(
|
|
1816
|
+
if (await fileExists(join6(homedir4(), ".local", "share", "opencode", "auth.json"))) return true;
|
|
1721
1817
|
return volumeHasOpencodeAuth(SHARED_OPENCODE_VOLUME, image);
|
|
1722
1818
|
}
|
|
1723
1819
|
var MESSAGES = {
|
|
@@ -1759,16 +1855,16 @@ function buildPromptArgs(agentKind, prompt, userArgs) {
|
|
|
1759
1855
|
}
|
|
1760
1856
|
|
|
1761
1857
|
// src/lib/carry-resync.ts
|
|
1762
|
-
import { join as
|
|
1858
|
+
import { join as join9 } from "path";
|
|
1763
1859
|
|
|
1764
1860
|
// src/lib/carry-resolve.ts
|
|
1765
1861
|
import { realpath, stat as stat3 } from "fs/promises";
|
|
1766
|
-
import { homedir as
|
|
1767
|
-
import { isAbsolute, join as
|
|
1862
|
+
import { homedir as homedir5 } from "os";
|
|
1863
|
+
import { isAbsolute, join as join8, normalize, relative, resolve } from "path";
|
|
1768
1864
|
|
|
1769
1865
|
// src/lib/dir-breakdown.ts
|
|
1770
1866
|
import { readdir, stat as stat2 } from "fs/promises";
|
|
1771
|
-
import { join as
|
|
1867
|
+
import { join as join7 } from "path";
|
|
1772
1868
|
var DEFAULT_CP_EXCLUDES = [
|
|
1773
1869
|
".git",
|
|
1774
1870
|
"node_modules",
|
|
@@ -1833,7 +1929,7 @@ async function buildNode(abs, rel, tokens, seen) {
|
|
|
1833
1929
|
for (const name of entries) {
|
|
1834
1930
|
const childRel = rel ? `${rel}/${name}` : name;
|
|
1835
1931
|
if (isPathExcluded(childRel, tokens)) continue;
|
|
1836
|
-
const full =
|
|
1932
|
+
const full = join7(abs, name);
|
|
1837
1933
|
let st;
|
|
1838
1934
|
try {
|
|
1839
1935
|
st = await stat2(full);
|
|
@@ -1892,7 +1988,7 @@ function fmtBytes(n) {
|
|
|
1892
1988
|
var DENYLIST_DEST_PREFIXES = ["/proc", "/sys", "/dev"];
|
|
1893
1989
|
var DENYLIST_DEST_EXACT = /* @__PURE__ */ new Set(["/etc/passwd", "/etc/shadow"]);
|
|
1894
1990
|
async function resolveCarry(items, opts) {
|
|
1895
|
-
const home = opts.homeDir ??
|
|
1991
|
+
const home = opts.homeDir ?? homedir5();
|
|
1896
1992
|
const cap = opts.maxBytes ?? BUILT_IN_DEFAULTS.box.cpMaxBytes;
|
|
1897
1993
|
const projectRoot = opts.projectRoot;
|
|
1898
1994
|
const replacements = opts.replacements ?? {};
|
|
@@ -2061,7 +2157,7 @@ async function dirSizeCapped(dir, cap, exclude = []) {
|
|
|
2061
2157
|
}
|
|
2062
2158
|
for (const name of names) {
|
|
2063
2159
|
if (total > cap) return;
|
|
2064
|
-
const full =
|
|
2160
|
+
const full = join8(d, name);
|
|
2065
2161
|
const rel = relative(dir, full).split(/[\\/]/).join("/");
|
|
2066
2162
|
if (exclude.length > 0 && isPathExcluded(rel, exclude)) continue;
|
|
2067
2163
|
let st;
|
|
@@ -2091,7 +2187,7 @@ async function resyncCarryFiles(args) {
|
|
|
2091
2187
|
});
|
|
2092
2188
|
const prior = args.box.carry?.entries ?? [];
|
|
2093
2189
|
if (prior.length === 0) return { recopied: 0, skippedNew: 0 };
|
|
2094
|
-
const items = await loadCarrySection(
|
|
2190
|
+
const items = await loadCarrySection(join9(args.projectRoot, "agentbox.yaml"));
|
|
2095
2191
|
if (items.length === 0) return { recopied: 0, skippedNew: 0 };
|
|
2096
2192
|
const cfg = await loadEffectiveConfig(args.projectRoot);
|
|
2097
2193
|
const resolved = await resolveCarry(items, {
|
|
@@ -2372,7 +2468,7 @@ function makeProgressReporter(verbose) {
|
|
|
2372
2468
|
}
|
|
2373
2469
|
|
|
2374
2470
|
// src/lib/launch-recap.ts
|
|
2375
|
-
import { homedir as
|
|
2471
|
+
import { homedir as homedir6 } from "os";
|
|
2376
2472
|
import { note as note2 } from "@clack/prompts";
|
|
2377
2473
|
|
|
2378
2474
|
// src/lib/from-branch.ts
|
|
@@ -2469,7 +2565,7 @@ async function resolveBranchSelection(opts) {
|
|
|
2469
2565
|
|
|
2470
2566
|
// src/lib/launch-recap.ts
|
|
2471
2567
|
function homeShorten(p) {
|
|
2472
|
-
const home =
|
|
2568
|
+
const home = homedir6();
|
|
2473
2569
|
return p === home || p.startsWith(home + "/") ? "~" + p.slice(home.length) : p;
|
|
2474
2570
|
}
|
|
2475
2571
|
function whiten(text3) {
|
|
@@ -2563,7 +2659,7 @@ async function cloudAgentCreate(args) {
|
|
|
2563
2659
|
|
|
2564
2660
|
// src/lib/carry-gate.ts
|
|
2565
2661
|
import { readFile as readFile2 } from "fs/promises";
|
|
2566
|
-
import { join as
|
|
2662
|
+
import { join as join10 } from "path";
|
|
2567
2663
|
import { log as log8 } from "@clack/prompts";
|
|
2568
2664
|
|
|
2569
2665
|
// src/fmt.ts
|
|
@@ -2658,7 +2754,7 @@ function pad(s, w) {
|
|
|
2658
2754
|
async function runCarryGate(args) {
|
|
2659
2755
|
const emit = args.onLog ?? (() => {
|
|
2660
2756
|
});
|
|
2661
|
-
const yamlPath =
|
|
2757
|
+
const yamlPath = join10(args.projectRoot, "agentbox.yaml");
|
|
2662
2758
|
let yamlText = "";
|
|
2663
2759
|
try {
|
|
2664
2760
|
yamlText = await readFile2(yamlPath, "utf8");
|
|
@@ -2719,9 +2815,9 @@ async function runQueuedCarryGate(args) {
|
|
|
2719
2815
|
|
|
2720
2816
|
// src/session-teleport/claude.ts
|
|
2721
2817
|
import { mkdir, mkdtemp, readdir as readdir2, readFile as readFile3, stat as stat4, writeFile } from "fs/promises";
|
|
2722
|
-
import { existsSync as
|
|
2723
|
-
import { homedir as
|
|
2724
|
-
import { join as
|
|
2818
|
+
import { existsSync as existsSync5 } from "fs";
|
|
2819
|
+
import { homedir as homedir7, tmpdir as tmpdir2 } from "os";
|
|
2820
|
+
import { join as join11 } from "path";
|
|
2725
2821
|
|
|
2726
2822
|
// src/session-teleport/cwd-encoding.ts
|
|
2727
2823
|
function encodeClaudeProjectsDir(absPath) {
|
|
@@ -2741,22 +2837,22 @@ var TeleportError = class extends Error {
|
|
|
2741
2837
|
// src/session-teleport/claude.ts
|
|
2742
2838
|
var BOX_CLAUDE_PROJECTS_DIR = `/home/vscode/.claude/projects/${BOX_WORKSPACE_ENCODED}`;
|
|
2743
2839
|
async function resolveClaudeTeleport(opts) {
|
|
2744
|
-
const hostHome = opts.hostHome ??
|
|
2745
|
-
const projectDir =
|
|
2840
|
+
const hostHome = opts.hostHome ?? homedir7();
|
|
2841
|
+
const projectDir = join11(
|
|
2746
2842
|
hostHome,
|
|
2747
2843
|
".claude",
|
|
2748
2844
|
"projects",
|
|
2749
2845
|
encodeClaudeProjectsDir(opts.hostCwd)
|
|
2750
2846
|
);
|
|
2751
|
-
if (!
|
|
2847
|
+
if (!existsSync5(projectDir)) {
|
|
2752
2848
|
throw new TeleportError(
|
|
2753
2849
|
`no Claude session history found on the host for ${opts.hostCwd} (expected at ${projectDir}). Run \`claude\` here at least once before using -c / --resume.`
|
|
2754
2850
|
);
|
|
2755
2851
|
}
|
|
2756
2852
|
const sessionPath = await pickSessionFile(projectDir, opts.mode);
|
|
2757
2853
|
const sessionId = sessionPath.replace(/\.jsonl$/u, "").split("/").pop() ?? "";
|
|
2758
|
-
const stage = await mkdtemp(
|
|
2759
|
-
const stagedFile =
|
|
2854
|
+
const stage = await mkdtemp(join11(tmpdir2(), "agentbox-teleport-claude-"));
|
|
2855
|
+
const stagedFile = join11(stage, `${sessionId}.jsonl`);
|
|
2760
2856
|
await rewriteSessionFile(sessionPath, stagedFile, opts.hostCwd);
|
|
2761
2857
|
opts.log?.(`teleport: claude session ${sessionId} staged for upload`);
|
|
2762
2858
|
return {
|
|
@@ -2770,8 +2866,8 @@ async function resolveClaudeTeleport(opts) {
|
|
|
2770
2866
|
}
|
|
2771
2867
|
async function pickSessionFile(projectDir, mode) {
|
|
2772
2868
|
if (mode.kind === "resume") {
|
|
2773
|
-
const target =
|
|
2774
|
-
if (!
|
|
2869
|
+
const target = join11(projectDir, `${mode.id}.jsonl`);
|
|
2870
|
+
if (!existsSync5(target)) {
|
|
2775
2871
|
throw new TeleportError(
|
|
2776
2872
|
`Claude session "${mode.id}" not found in ${projectDir}. List available sessions with: ls "${projectDir}"`
|
|
2777
2873
|
);
|
|
@@ -2787,7 +2883,7 @@ async function pickSessionFile(projectDir, mode) {
|
|
|
2787
2883
|
}
|
|
2788
2884
|
const stats = await Promise.all(
|
|
2789
2885
|
jsonl.map(async (name) => {
|
|
2790
|
-
const full =
|
|
2886
|
+
const full = join11(projectDir, name);
|
|
2791
2887
|
const s = await stat4(full);
|
|
2792
2888
|
return { full, mtimeMs: s.mtimeMs };
|
|
2793
2889
|
})
|
|
@@ -2821,19 +2917,19 @@ async function rewriteSessionFile(src, dst, hostCwd) {
|
|
|
2821
2917
|
}
|
|
2822
2918
|
out.push(line);
|
|
2823
2919
|
}
|
|
2824
|
-
await mkdir(
|
|
2920
|
+
await mkdir(join11(dst, ".."), { recursive: true });
|
|
2825
2921
|
await writeFile(dst, out.join("\n"), "utf8");
|
|
2826
2922
|
}
|
|
2827
2923
|
|
|
2828
2924
|
// src/session-teleport/codex.ts
|
|
2829
2925
|
import { mkdtemp as mkdtemp2, readdir as readdir3, readFile as readFile4, stat as stat5, writeFile as writeFile2 } from "fs/promises";
|
|
2830
|
-
import { existsSync as
|
|
2831
|
-
import { homedir as
|
|
2832
|
-
import { join as
|
|
2926
|
+
import { existsSync as existsSync6 } from "fs";
|
|
2927
|
+
import { homedir as homedir8, tmpdir as tmpdir3 } from "os";
|
|
2928
|
+
import { join as join12 } from "path";
|
|
2833
2929
|
async function resolveCodexTeleport(opts) {
|
|
2834
|
-
const hostHome = opts.hostHome ??
|
|
2835
|
-
const sessionsRoot =
|
|
2836
|
-
if (!
|
|
2930
|
+
const hostHome = opts.hostHome ?? homedir8();
|
|
2931
|
+
const sessionsRoot = join12(hostHome, ".codex", "sessions");
|
|
2932
|
+
if (!existsSync6(sessionsRoot)) {
|
|
2837
2933
|
throw new TeleportError(
|
|
2838
2934
|
`no Codex session history found on the host (expected at ${sessionsRoot}). Run \`codex\` at least once before using -c / --resume.`
|
|
2839
2935
|
);
|
|
@@ -2874,8 +2970,8 @@ async function resolveCodexTeleport(opts) {
|
|
|
2874
2970
|
matching.sort((a, b) => b.mtimeMs - a.mtimeMs);
|
|
2875
2971
|
picked = matching[0];
|
|
2876
2972
|
}
|
|
2877
|
-
const stage = await mkdtemp2(
|
|
2878
|
-
const stagedFile =
|
|
2973
|
+
const stage = await mkdtemp2(join12(tmpdir3(), "agentbox-teleport-codex-"));
|
|
2974
|
+
const stagedFile = join12(stage, posixBasename(picked.relPath));
|
|
2879
2975
|
await rewriteCodexSession(picked.hostPath, stagedFile, opts.hostCwd);
|
|
2880
2976
|
opts.log?.(`teleport: codex session ${picked.uuid} staged for upload`);
|
|
2881
2977
|
const boxParentDir = `/home/vscode/.codex/sessions/${posixDirname(picked.relPath)}`;
|
|
@@ -2901,21 +2997,21 @@ async function listCodexSessions(sessionsRoot) {
|
|
|
2901
2997
|
const years = await safeReaddir(sessionsRoot);
|
|
2902
2998
|
for (const y of years) {
|
|
2903
2999
|
if (!/^\d{4}$/u.test(y)) continue;
|
|
2904
|
-
const yDir =
|
|
3000
|
+
const yDir = join12(sessionsRoot, y);
|
|
2905
3001
|
const months = await safeReaddir(yDir);
|
|
2906
3002
|
for (const m of months) {
|
|
2907
3003
|
if (!/^\d{2}$/u.test(m)) continue;
|
|
2908
|
-
const mDir =
|
|
3004
|
+
const mDir = join12(yDir, m);
|
|
2909
3005
|
const days = await safeReaddir(mDir);
|
|
2910
3006
|
for (const d of days) {
|
|
2911
3007
|
if (!/^\d{2}$/u.test(d)) continue;
|
|
2912
|
-
const dDir =
|
|
3008
|
+
const dDir = join12(mDir, d);
|
|
2913
3009
|
const files = await safeReaddir(dDir);
|
|
2914
3010
|
for (const name of files) {
|
|
2915
3011
|
if (!name.startsWith("rollout-") || !name.endsWith(".jsonl")) continue;
|
|
2916
3012
|
const uuid = extractCodexUuid(name);
|
|
2917
3013
|
if (uuid === null) continue;
|
|
2918
|
-
const hostPath =
|
|
3014
|
+
const hostPath = join12(dDir, name);
|
|
2919
3015
|
let mtimeMs = 0;
|
|
2920
3016
|
try {
|
|
2921
3017
|
mtimeMs = (await stat5(hostPath)).mtimeMs;
|
|
@@ -3052,26 +3148,26 @@ async function uploadTeleport(input) {
|
|
|
3052
3148
|
|
|
3053
3149
|
// src/session-teleport/plan.ts
|
|
3054
3150
|
import { mkdtemp as mkdtemp3, readFile as readFile5, writeFile as writeFile3 } from "fs/promises";
|
|
3055
|
-
import { existsSync as
|
|
3056
|
-
import { homedir as
|
|
3057
|
-
import { basename, isAbsolute as isAbsolute2, join as
|
|
3151
|
+
import { existsSync as existsSync7 } from "fs";
|
|
3152
|
+
import { homedir as homedir9, tmpdir as tmpdir4 } from "os";
|
|
3153
|
+
import { basename, isAbsolute as isAbsolute2, join as join13, resolve as resolve2 } from "path";
|
|
3058
3154
|
var BOX_CLAUDE_PLANS_DIR = "/home/vscode/.claude/plans";
|
|
3059
3155
|
function expandHome(p, hostHome) {
|
|
3060
3156
|
if (p === "~") return hostHome;
|
|
3061
|
-
if (p.startsWith("~/")) return
|
|
3157
|
+
if (p.startsWith("~/")) return join13(hostHome, p.slice(2));
|
|
3062
3158
|
return isAbsolute2(p) ? p : resolve2(p);
|
|
3063
3159
|
}
|
|
3064
3160
|
async function resolvePlanTeleport(opts) {
|
|
3065
|
-
const hostHome = opts.hostHome ??
|
|
3161
|
+
const hostHome = opts.hostHome ?? homedir9();
|
|
3066
3162
|
const planFile = expandHome(opts.planPath, hostHome);
|
|
3067
|
-
if (!
|
|
3163
|
+
if (!existsSync7(planFile)) {
|
|
3068
3164
|
throw new TeleportError(
|
|
3069
3165
|
`plan file not found on the host: ${planFile}. Pass --plan with the path to a Claude Code plan (e.g. ~/.claude/plans/<slug>.md).`
|
|
3070
3166
|
);
|
|
3071
3167
|
}
|
|
3072
3168
|
const name = basename(planFile);
|
|
3073
|
-
const stage = await mkdtemp3(
|
|
3074
|
-
const stagedFile =
|
|
3169
|
+
const stage = await mkdtemp3(join13(tmpdir4(), "agentbox-teleport-plan-"));
|
|
3170
|
+
const stagedFile = join13(stage, name);
|
|
3075
3171
|
const raw = await readFile5(planFile, "utf8");
|
|
3076
3172
|
const absCwd = opts.hostCwd ? resolve2(expandHome(opts.hostCwd, hostHome)) : "";
|
|
3077
3173
|
const rewritten = absCwd ? raw.split(absCwd).join(BOX_WORKSPACE) : raw;
|
|
@@ -3089,37 +3185,37 @@ async function resolvePlanTeleport(opts) {
|
|
|
3089
3185
|
|
|
3090
3186
|
// src/lib/install-hint.ts
|
|
3091
3187
|
import { log as log9 } from "@clack/prompts";
|
|
3092
|
-
import { existsSync as
|
|
3093
|
-
import { homedir as
|
|
3094
|
-
import { join as
|
|
3188
|
+
import { existsSync as existsSync8, mkdirSync as mkdirSync3, writeFileSync as writeFileSync4 } from "fs";
|
|
3189
|
+
import { homedir as homedir10 } from "os";
|
|
3190
|
+
import { join as join14 } from "path";
|
|
3095
3191
|
function maybeShowInstallHint() {
|
|
3096
3192
|
try {
|
|
3097
|
-
const skill =
|
|
3098
|
-
if (
|
|
3099
|
-
const marker =
|
|
3100
|
-
if (
|
|
3101
|
-
|
|
3102
|
-
|
|
3193
|
+
const skill = join14(homedir10(), ".claude", "skills", "agentbox", "SKILL.md");
|
|
3194
|
+
if (existsSync8(skill)) return;
|
|
3195
|
+
const marker = join14(homedir10(), ".agentbox", "install-hint-shown");
|
|
3196
|
+
if (existsSync8(marker)) return;
|
|
3197
|
+
mkdirSync3(join14(homedir10(), ".agentbox"), { recursive: true });
|
|
3198
|
+
writeFileSync4(marker, "");
|
|
3103
3199
|
log9.info("tip: run 'agentbox install' to enable the /agentbox fork command in host Claude");
|
|
3104
3200
|
} catch {
|
|
3105
3201
|
}
|
|
3106
3202
|
}
|
|
3107
3203
|
|
|
3108
3204
|
// src/lib/log-file.ts
|
|
3109
|
-
import { closeSync, mkdirSync as
|
|
3110
|
-
import { homedir as
|
|
3111
|
-
import { join as
|
|
3205
|
+
import { closeSync, mkdirSync as mkdirSync4, openSync, renameSync, symlinkSync, unlinkSync, writeFileSync as writeFileSync5, writeSync } from "fs";
|
|
3206
|
+
import { homedir as homedir11 } from "os";
|
|
3207
|
+
import { join as join15 } from "path";
|
|
3112
3208
|
function stateDir() {
|
|
3113
|
-
return process.env.AGENTBOX_HOME ??
|
|
3209
|
+
return process.env.AGENTBOX_HOME ?? join15(homedir11(), ".agentbox");
|
|
3114
3210
|
}
|
|
3115
3211
|
function logsDir() {
|
|
3116
|
-
return
|
|
3212
|
+
return join15(stateDir(), "logs");
|
|
3117
3213
|
}
|
|
3118
3214
|
function openCommandLog(command) {
|
|
3119
3215
|
const dir = logsDir();
|
|
3120
|
-
|
|
3121
|
-
const path =
|
|
3122
|
-
const prev =
|
|
3216
|
+
mkdirSync4(dir, { recursive: true });
|
|
3217
|
+
const path = join15(dir, `${command}.log`);
|
|
3218
|
+
const prev = join15(dir, `${command}.log.prev`);
|
|
3123
3219
|
try {
|
|
3124
3220
|
renameSync(path, prev);
|
|
3125
3221
|
} catch {
|
|
@@ -3179,7 +3275,7 @@ function openCommandLog(command) {
|
|
|
3179
3275
|
};
|
|
3180
3276
|
}
|
|
3181
3277
|
function updateLatestSymlink(dir, target) {
|
|
3182
|
-
const link =
|
|
3278
|
+
const link = join15(dir, "latest.log");
|
|
3183
3279
|
try {
|
|
3184
3280
|
unlinkSync(link);
|
|
3185
3281
|
} catch {
|
|
@@ -3188,7 +3284,7 @@ function updateLatestSymlink(dir, target) {
|
|
|
3188
3284
|
symlinkSync(target, link);
|
|
3189
3285
|
} catch {
|
|
3190
3286
|
try {
|
|
3191
|
-
|
|
3287
|
+
writeFileSync5(link, target + "\n");
|
|
3192
3288
|
} catch {
|
|
3193
3289
|
}
|
|
3194
3290
|
}
|
|
@@ -3283,7 +3379,7 @@ async function setupPortlessHost(opts = {}) {
|
|
|
3283
3379
|
async function maybePromptPortless(args) {
|
|
3284
3380
|
if (args.enabled !== void 0) return args.enabled;
|
|
3285
3381
|
if (args.engine === "orbstack") return false;
|
|
3286
|
-
if (!process.stdin.isTTY || args.yes) return
|
|
3382
|
+
if (!process.stdin.isTTY || args.yes) return resolvePortlessNonInteractive(args);
|
|
3287
3383
|
const answer = await confirm({
|
|
3288
3384
|
message: "Use Portless to give box web apps a friendly local URL? (installs the portless CLI and starts a local proxy if needed)",
|
|
3289
3385
|
initialValue: true
|
|
@@ -3298,6 +3394,18 @@ async function maybePromptPortless(args) {
|
|
|
3298
3394
|
if (answer) await setupPortlessHost();
|
|
3299
3395
|
return answer;
|
|
3300
3396
|
}
|
|
3397
|
+
async function resolvePortlessNonInteractive(args) {
|
|
3398
|
+
if (args.enabled !== void 0) return args.enabled;
|
|
3399
|
+
if (args.engine === "orbstack") return false;
|
|
3400
|
+
const state = await detectPortless();
|
|
3401
|
+
if (state.proxyRunning) {
|
|
3402
|
+
try {
|
|
3403
|
+
await setConfigValue("global", "portless.enabled", true, args.cwd, { raw: false });
|
|
3404
|
+
} catch {
|
|
3405
|
+
}
|
|
3406
|
+
}
|
|
3407
|
+
return state.proxyRunning;
|
|
3408
|
+
}
|
|
3301
3409
|
|
|
3302
3410
|
// src/wizard.ts
|
|
3303
3411
|
import { basename as basename2 } from "path";
|
|
@@ -3628,7 +3736,7 @@ async function renderDocker(status) {
|
|
|
3628
3736
|
}
|
|
3629
3737
|
async function daytonaStatus() {
|
|
3630
3738
|
try {
|
|
3631
|
-
const mod = await import("./dist-
|
|
3739
|
+
const mod = await import("./dist-GJCIKH2C.js");
|
|
3632
3740
|
return await mod.getDaytonaStatus();
|
|
3633
3741
|
} catch (err) {
|
|
3634
3742
|
return {
|
|
@@ -3639,7 +3747,7 @@ async function daytonaStatus() {
|
|
|
3639
3747
|
}
|
|
3640
3748
|
async function e2bStatus() {
|
|
3641
3749
|
try {
|
|
3642
|
-
const mod = await import("./dist-
|
|
3750
|
+
const mod = await import("./dist-GEHCZJCS.js");
|
|
3643
3751
|
const cred = mod.readE2bCredStatus();
|
|
3644
3752
|
if (cred.auth === "none") {
|
|
3645
3753
|
return { configured: false, reason: "not configured \u2014 run `agentbox e2b login`" };
|
|
@@ -3872,73 +3980,73 @@ function describeError(err) {
|
|
|
3872
3980
|
|
|
3873
3981
|
// src/commands/claude.ts
|
|
3874
3982
|
import { spawn as spawn3 } from "child_process";
|
|
3875
|
-
import { existsSync as
|
|
3983
|
+
import { existsSync as existsSync9 } from "fs";
|
|
3876
3984
|
import { randomUUID } from "crypto";
|
|
3877
3985
|
import { setTimeout as sleep3 } from "timers/promises";
|
|
3878
3986
|
|
|
3879
3987
|
// src/lib/claude-login-session.ts
|
|
3880
3988
|
import {
|
|
3881
|
-
mkdirSync as
|
|
3989
|
+
mkdirSync as mkdirSync5,
|
|
3882
3990
|
readdirSync as readdirSync2,
|
|
3883
|
-
readFileSync as
|
|
3991
|
+
readFileSync as readFileSync5,
|
|
3884
3992
|
renameSync as renameSync2,
|
|
3885
3993
|
rmSync as rmSync2,
|
|
3886
3994
|
unlinkSync as unlinkSync2,
|
|
3887
|
-
writeFileSync as
|
|
3995
|
+
writeFileSync as writeFileSync6
|
|
3888
3996
|
} from "fs";
|
|
3889
|
-
import { homedir as
|
|
3890
|
-
import { join as
|
|
3997
|
+
import { homedir as homedir12 } from "os";
|
|
3998
|
+
import { join as join16 } from "path";
|
|
3891
3999
|
function selectLoginMode(o) {
|
|
3892
4000
|
if (o.code) return "code";
|
|
3893
4001
|
if (o.headless || !o.isTTY) return "headless";
|
|
3894
4002
|
return "interactive";
|
|
3895
4003
|
}
|
|
3896
4004
|
function stateDir2() {
|
|
3897
|
-
return process.env.AGENTBOX_HOME ??
|
|
4005
|
+
return process.env.AGENTBOX_HOME ?? join16(homedir12(), ".agentbox");
|
|
3898
4006
|
}
|
|
3899
4007
|
function loginRootDir() {
|
|
3900
|
-
return
|
|
4008
|
+
return join16(stateDir2(), "claude-login");
|
|
3901
4009
|
}
|
|
3902
4010
|
function loginSessionDir(id) {
|
|
3903
|
-
return
|
|
4011
|
+
return join16(loginRootDir(), id);
|
|
3904
4012
|
}
|
|
3905
4013
|
function atomicWrite(path, data) {
|
|
3906
4014
|
const tmp = `${path}.tmp.${String(process.pid)}.${String(Date.now())}`;
|
|
3907
|
-
|
|
4015
|
+
writeFileSync6(tmp, data, { mode: 384 });
|
|
3908
4016
|
renameSync2(tmp, path);
|
|
3909
4017
|
}
|
|
3910
4018
|
function readJsonWithRetry(path) {
|
|
3911
4019
|
for (let attempt = 0; attempt < 2; attempt++) {
|
|
3912
4020
|
try {
|
|
3913
|
-
return JSON.parse(
|
|
4021
|
+
return JSON.parse(readFileSync5(path, "utf8"));
|
|
3914
4022
|
} catch {
|
|
3915
4023
|
}
|
|
3916
4024
|
}
|
|
3917
4025
|
return null;
|
|
3918
4026
|
}
|
|
3919
4027
|
function writeLoginRequest(id, req) {
|
|
3920
|
-
|
|
3921
|
-
atomicWrite(
|
|
4028
|
+
mkdirSync5(loginSessionDir(id), { recursive: true });
|
|
4029
|
+
atomicWrite(join16(loginSessionDir(id), "request.json"), JSON.stringify(req));
|
|
3922
4030
|
}
|
|
3923
4031
|
function readLoginRequest(id) {
|
|
3924
|
-
return readJsonWithRetry(
|
|
4032
|
+
return readJsonWithRetry(join16(loginSessionDir(id), "request.json"));
|
|
3925
4033
|
}
|
|
3926
4034
|
function writeLoginState(id, state) {
|
|
3927
|
-
|
|
4035
|
+
mkdirSync5(loginSessionDir(id), { recursive: true });
|
|
3928
4036
|
const full = { ...state, updatedAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
3929
|
-
atomicWrite(
|
|
4037
|
+
atomicWrite(join16(loginSessionDir(id), "state.json"), JSON.stringify(full));
|
|
3930
4038
|
}
|
|
3931
4039
|
function readLoginState(id) {
|
|
3932
|
-
return readJsonWithRetry(
|
|
4040
|
+
return readJsonWithRetry(join16(loginSessionDir(id), "state.json"));
|
|
3933
4041
|
}
|
|
3934
4042
|
function writeLoginCode(id, code) {
|
|
3935
|
-
|
|
3936
|
-
atomicWrite(
|
|
4043
|
+
mkdirSync5(loginSessionDir(id), { recursive: true });
|
|
4044
|
+
atomicWrite(join16(loginSessionDir(id), "code"), code.trim());
|
|
3937
4045
|
}
|
|
3938
4046
|
function takeLoginCode(id) {
|
|
3939
|
-
const path =
|
|
4047
|
+
const path = join16(loginSessionDir(id), "code");
|
|
3940
4048
|
try {
|
|
3941
|
-
const code =
|
|
4049
|
+
const code = readFileSync5(path, "utf8").trim();
|
|
3942
4050
|
try {
|
|
3943
4051
|
unlinkSync2(path);
|
|
3944
4052
|
} catch {
|
|
@@ -5010,7 +5118,7 @@ async function startHeadlessLogin(args) {
|
|
|
5010
5118
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
5011
5119
|
});
|
|
5012
5120
|
const entry = process.env.AGENTBOX_CLI_ENTRY ?? process.argv[1];
|
|
5013
|
-
if (!entry || !
|
|
5121
|
+
if (!entry || !existsSync9(entry)) {
|
|
5014
5122
|
prompt_exports.log.error("could not resolve the agentbox CLI entry to spawn the login worker");
|
|
5015
5123
|
process.exit(1);
|
|
5016
5124
|
}
|
|
@@ -5127,8 +5235,8 @@ claudeCommand.addCommand(claudeLoginCommand);
|
|
|
5127
5235
|
|
|
5128
5236
|
// src/commands/codex.ts
|
|
5129
5237
|
import { access } from "fs/promises";
|
|
5130
|
-
import { homedir as
|
|
5131
|
-
import { join as
|
|
5238
|
+
import { homedir as homedir13 } from "os";
|
|
5239
|
+
import { join as join17 } from "path";
|
|
5132
5240
|
import { Command as Command6 } from "commander";
|
|
5133
5241
|
function pickCodexCreateOpts(opts) {
|
|
5134
5242
|
return {
|
|
@@ -5224,7 +5332,7 @@ async function maybeRunCodexLogin(args) {
|
|
|
5224
5332
|
}
|
|
5225
5333
|
async function cloudCodexCredAvailable(env = process.env) {
|
|
5226
5334
|
if ((env["OPENAI_API_KEY"] ?? "").length > 0) return true;
|
|
5227
|
-
for (const p of [CODEX_CREDENTIALS_BACKUP_FILE,
|
|
5335
|
+
for (const p of [CODEX_CREDENTIALS_BACKUP_FILE, join17(homedir13(), ".codex", "auth.json")]) {
|
|
5228
5336
|
try {
|
|
5229
5337
|
await access(p);
|
|
5230
5338
|
return true;
|
|
@@ -5918,8 +6026,8 @@ codexCommand.addCommand(codexLoginCommand);
|
|
|
5918
6026
|
|
|
5919
6027
|
// src/commands/opencode.ts
|
|
5920
6028
|
import { access as access2 } from "fs/promises";
|
|
5921
|
-
import { homedir as
|
|
5922
|
-
import { join as
|
|
6029
|
+
import { homedir as homedir14 } from "os";
|
|
6030
|
+
import { join as join18 } from "path";
|
|
5923
6031
|
import { Command as Command7 } from "commander";
|
|
5924
6032
|
function pickOpencodeCreateOpts(opts) {
|
|
5925
6033
|
return {
|
|
@@ -6014,7 +6122,7 @@ async function cloudOpencodeCredAvailable(env = process.env) {
|
|
|
6014
6122
|
for (const k of OPENCODE_FORWARDED_ENV_KEYS) {
|
|
6015
6123
|
if ((env[k] ?? "").length > 0) return true;
|
|
6016
6124
|
}
|
|
6017
|
-
for (const p of [OPENCODE_CREDENTIALS_BACKUP_FILE,
|
|
6125
|
+
for (const p of [OPENCODE_CREDENTIALS_BACKUP_FILE, join18(homedir14(), ".local", "share", "opencode", "auth.json")]) {
|
|
6018
6126
|
try {
|
|
6019
6127
|
await access2(p);
|
|
6020
6128
|
return true;
|
|
@@ -7103,200 +7211,137 @@ var checkpointCommand = new Command9("checkpoint").alias("checkpoints").descript
|
|
|
7103
7211
|
|
|
7104
7212
|
// src/commands/code.ts
|
|
7105
7213
|
import { spawn as spawn4 } from "child_process";
|
|
7106
|
-
import { log as log19 } from "@clack/prompts";
|
|
7107
|
-
import { Command as Command10, InvalidArgumentError } from "commander";
|
|
7108
|
-
|
|
7109
|
-
// src/cloud-ssh.ts
|
|
7110
7214
|
import { log as log18 } from "@clack/prompts";
|
|
7215
|
+
import { Command as Command10, InvalidArgumentError } from "commander";
|
|
7111
7216
|
|
|
7112
|
-
// src/
|
|
7113
|
-
import {
|
|
7114
|
-
import { homedir as
|
|
7115
|
-
import {
|
|
7116
|
-
|
|
7117
|
-
|
|
7118
|
-
|
|
7119
|
-
|
|
7120
|
-
|
|
7121
|
-
|
|
7122
|
-
|
|
7123
|
-
|
|
7217
|
+
// src/commands/_open-in.ts
|
|
7218
|
+
import { existsSync as realExistsSync } from "fs";
|
|
7219
|
+
import { homedir as realHomedir } from "os";
|
|
7220
|
+
import { delimiter, join as join19 } from "path";
|
|
7221
|
+
var OPEN_IN_APPS = [
|
|
7222
|
+
"claude",
|
|
7223
|
+
"codex",
|
|
7224
|
+
"herdr",
|
|
7225
|
+
"cmux",
|
|
7226
|
+
"vscode",
|
|
7227
|
+
"iterm2",
|
|
7228
|
+
"finder"
|
|
7229
|
+
];
|
|
7230
|
+
var PERSISTENT_SSH_PROVIDERS = ["docker", "hetzner"];
|
|
7231
|
+
var IDE_PROVIDERS = ["docker", "hetzner", "daytona"];
|
|
7232
|
+
var SSH_MOUNT_PROVIDERS = ["docker", "hetzner", "daytona"];
|
|
7233
|
+
function realSeams() {
|
|
7234
|
+
return {
|
|
7235
|
+
env: process.env,
|
|
7236
|
+
platform: process.platform,
|
|
7237
|
+
homedir: realHomedir,
|
|
7238
|
+
existsSync: realExistsSync
|
|
7239
|
+
};
|
|
7124
7240
|
}
|
|
7125
|
-
|
|
7126
|
-
|
|
7127
|
-
|
|
7128
|
-
|
|
7241
|
+
function pathHasBinary(name, seams) {
|
|
7242
|
+
const path = seams.env["PATH"] ?? "";
|
|
7243
|
+
for (const dir of path.split(delimiter)) {
|
|
7244
|
+
if (dir.length === 0) continue;
|
|
7245
|
+
if (seams.existsSync(join19(dir, name))) return true;
|
|
7246
|
+
}
|
|
7247
|
+
return false;
|
|
7129
7248
|
}
|
|
7130
|
-
function
|
|
7131
|
-
|
|
7249
|
+
function macAppInstalled(appName, seams) {
|
|
7250
|
+
if (seams.platform !== "darwin") return false;
|
|
7251
|
+
return seams.existsSync(join19("/Applications", appName)) || seams.existsSync(join19(seams.homedir(), "Applications", appName));
|
|
7132
7252
|
}
|
|
7133
|
-
function
|
|
7134
|
-
|
|
7253
|
+
function defaultHerdrSocketPath(seams = realSeams()) {
|
|
7254
|
+
const p = join19(seams.homedir(), ".config", "herdr", "herdr.sock");
|
|
7255
|
+
return seams.existsSync(p) ? p : void 0;
|
|
7135
7256
|
}
|
|
7136
|
-
|
|
7137
|
-
|
|
7138
|
-
|
|
7139
|
-
|
|
7140
|
-
|
|
7141
|
-
|
|
7257
|
+
var CMUX_APP_CLI_SUFFIX = "cmux.app/Contents/Resources/bin/cmux";
|
|
7258
|
+
var VSCODE_APPS = [
|
|
7259
|
+
{
|
|
7260
|
+
flavor: "vscode",
|
|
7261
|
+
cli: "code",
|
|
7262
|
+
appName: "Visual Studio Code.app",
|
|
7263
|
+
bundleCliSuffix: "Contents/Resources/app/bin/code"
|
|
7264
|
+
},
|
|
7265
|
+
{
|
|
7266
|
+
flavor: "cursor",
|
|
7267
|
+
cli: "cursor",
|
|
7268
|
+
appName: "Cursor.app",
|
|
7269
|
+
bundleCliSuffix: "Contents/Resources/app/bin/cursor"
|
|
7142
7270
|
}
|
|
7143
|
-
|
|
7144
|
-
function
|
|
7145
|
-
|
|
7146
|
-
|
|
7147
|
-
|
|
7148
|
-
|
|
7149
|
-
|
|
7150
|
-
|
|
7151
|
-
|
|
7152
|
-
lines.push(` IdentityFile ${opts.identityFile}`);
|
|
7153
|
-
lines.push(` IdentitiesOnly yes`);
|
|
7154
|
-
}
|
|
7155
|
-
lines.push(
|
|
7156
|
-
` StrictHostKeyChecking accept-new`,
|
|
7157
|
-
` UserKnownHostsFile /dev/null`,
|
|
7158
|
-
` LogLevel ERROR`,
|
|
7159
|
-
endMarker(opts.alias),
|
|
7160
|
-
""
|
|
7161
|
-
);
|
|
7162
|
-
return lines.join("\n");
|
|
7163
|
-
}
|
|
7164
|
-
function stripLegacyInlineBlocks(contents) {
|
|
7165
|
-
const pattern = /^# BEGIN agentbox cloud box .*\n[\s\S]*?^# END agentbox cloud box .*\n?/gm;
|
|
7166
|
-
return contents.replace(pattern, "");
|
|
7167
|
-
}
|
|
7168
|
-
function hasIncludeBlock(contents) {
|
|
7169
|
-
return contents.includes(INCLUDE_BEGIN) || contents.includes(`Include ${agentboxSshConfigPath()}`);
|
|
7170
|
-
}
|
|
7171
|
-
async function ensureSshInclude() {
|
|
7172
|
-
const path = sshConfigPath();
|
|
7173
|
-
await fs.mkdir(join18(homedir14(), ".ssh"), { recursive: true, mode: 448 });
|
|
7174
|
-
const existing = stripLegacyInlineBlocks(await readFileOrEmpty(path));
|
|
7175
|
-
let next = existing;
|
|
7176
|
-
if (!hasIncludeBlock(existing)) {
|
|
7177
|
-
const block = `${INCLUDE_BEGIN}
|
|
7178
|
-
Include ${agentboxSshConfigPath()}
|
|
7179
|
-
${INCLUDE_END}
|
|
7180
|
-
`;
|
|
7181
|
-
next = existing.length === 0 ? block : `${block}
|
|
7182
|
-
${existing}`;
|
|
7183
|
-
}
|
|
7184
|
-
await fs.writeFile(path, next, { mode: 384 });
|
|
7185
|
-
await fs.chmod(path, 384);
|
|
7186
|
-
}
|
|
7187
|
-
async function syncAgentboxSshConfig(statePath = stateFilePath()) {
|
|
7188
|
-
const state = await readState(statePath);
|
|
7189
|
-
const blocks = [];
|
|
7190
|
-
for (const box of state.boxes) {
|
|
7191
|
-
const ssh = box.cloud?.ssh;
|
|
7192
|
-
if (!ssh) continue;
|
|
7193
|
-
blocks.push(
|
|
7194
|
-
buildBlock({
|
|
7195
|
-
alias: agentboxAliasFor(box.name),
|
|
7196
|
-
hostname: ssh.host,
|
|
7197
|
-
user: ssh.user,
|
|
7198
|
-
identityFile: ssh.identityFile
|
|
7199
|
-
})
|
|
7200
|
-
);
|
|
7271
|
+
];
|
|
7272
|
+
function resolveVscodeCli(cli, seams = realSeams()) {
|
|
7273
|
+
if (pathHasBinary(cli, seams)) return cli;
|
|
7274
|
+
if (seams.platform !== "darwin") return void 0;
|
|
7275
|
+
const app = VSCODE_APPS.find((a) => a.cli === cli);
|
|
7276
|
+
if (!app) return void 0;
|
|
7277
|
+
for (const root of ["/Applications", join19(seams.homedir(), "Applications")]) {
|
|
7278
|
+
const p = join19(root, app.appName, app.bundleCliSuffix);
|
|
7279
|
+
if (seams.existsSync(p)) return p;
|
|
7201
7280
|
}
|
|
7202
|
-
|
|
7203
|
-
const path = agentboxSshConfigPath();
|
|
7204
|
-
await fs.mkdir(dirname(path), { recursive: true, mode: 448 });
|
|
7205
|
-
await fs.writeFile(path, header + blocks.join("\n"), { mode: 384 });
|
|
7206
|
-
await fs.chmod(path, 384);
|
|
7207
|
-
await ensureSshInclude();
|
|
7208
|
-
}
|
|
7209
|
-
async function hasUnmanagedHostConflict(alias) {
|
|
7210
|
-
const contents = stripLegacyInlineBlocks(await readFileOrEmpty(sshConfigPath()));
|
|
7211
|
-
if (contents === "") return false;
|
|
7212
|
-
return contents.split("\n").some((line) => {
|
|
7213
|
-
const m = /^\s*Host\s+(.+?)\s*$/.exec(line);
|
|
7214
|
-
if (!m) return false;
|
|
7215
|
-
return m[1].split(/\s+/).includes(alias);
|
|
7216
|
-
});
|
|
7281
|
+
return void 0;
|
|
7217
7282
|
}
|
|
7218
|
-
function
|
|
7219
|
-
|
|
7220
|
-
|
|
7221
|
-
|
|
7222
|
-
|
|
7223
|
-
const
|
|
7224
|
-
|
|
7225
|
-
|
|
7226
|
-
break;
|
|
7227
|
-
}
|
|
7228
|
-
if (!target) return void 0;
|
|
7229
|
-
let identityFile;
|
|
7230
|
-
for (let i = 0; i < argv2.length - 1; i++) {
|
|
7231
|
-
if (argv2[i] === "-i") {
|
|
7232
|
-
identityFile = argv2[i + 1];
|
|
7233
|
-
break;
|
|
7283
|
+
function resolveCmuxBinary(seams = realSeams()) {
|
|
7284
|
+
const bundled = seams.env["CMUX_BUNDLED_CLI_PATH"];
|
|
7285
|
+
if (bundled && bundled.length > 0) return bundled;
|
|
7286
|
+
if (pathHasBinary("cmux", seams)) return "cmux";
|
|
7287
|
+
if (seams.platform === "darwin") {
|
|
7288
|
+
for (const root of ["/Applications", join19(seams.homedir(), "Applications")]) {
|
|
7289
|
+
const cli = join19(root, CMUX_APP_CLI_SUFFIX);
|
|
7290
|
+
if (seams.existsSync(cli)) return cli;
|
|
7234
7291
|
}
|
|
7235
7292
|
}
|
|
7236
|
-
return
|
|
7237
|
-
}
|
|
7238
|
-
async function readAgentboxSshAlias(alias) {
|
|
7239
|
-
const contents = await readFileOrEmpty(agentboxSshConfigPath());
|
|
7240
|
-
if (contents === "") return void 0;
|
|
7241
|
-
const begin = beginMarker(alias);
|
|
7242
|
-
const end = endMarker(alias);
|
|
7243
|
-
const escape = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
7244
|
-
const match = new RegExp(`^${escape(begin)}\\n([\\s\\S]*?)${escape(end)}`, "m").exec(contents);
|
|
7245
|
-
if (!match) return void 0;
|
|
7246
|
-
const body = match[1] ?? "";
|
|
7247
|
-
const field = (name) => new RegExp(`^\\s*${name}\\s+(.+)$`, "m").exec(body)?.[1]?.trim();
|
|
7248
|
-
return { hostName: field("HostName"), identityFile: field("IdentityFile") };
|
|
7293
|
+
return void 0;
|
|
7249
7294
|
}
|
|
7250
|
-
|
|
7251
|
-
|
|
7252
|
-
|
|
7253
|
-
|
|
7254
|
-
|
|
7255
|
-
|
|
7256
|
-
|
|
7257
|
-
|
|
7258
|
-
|
|
7259
|
-
|
|
7260
|
-
|
|
7261
|
-
|
|
7262
|
-
}
|
|
7263
|
-
|
|
7264
|
-
|
|
7265
|
-
}
|
|
7266
|
-
|
|
7295
|
+
function detectOpenTargets(seams = realSeams()) {
|
|
7296
|
+
return {
|
|
7297
|
+
claude: {
|
|
7298
|
+
// Claude desktop has no add-SSH deep link; `open --in claude` writes the
|
|
7299
|
+
// box into the app's own settings (sshConfigs) instead — same persistent
|
|
7300
|
+
// SSH requirement as codex, since the app connects on its own later.
|
|
7301
|
+
available: macAppInstalled("Claude.app", seams),
|
|
7302
|
+
providers: [...PERSISTENT_SSH_PROVIDERS]
|
|
7303
|
+
},
|
|
7304
|
+
codex: {
|
|
7305
|
+
available: macAppInstalled("Codex.app", seams),
|
|
7306
|
+
providers: [...PERSISTENT_SSH_PROVIDERS]
|
|
7307
|
+
},
|
|
7308
|
+
herdr: {
|
|
7309
|
+
available: pathHasBinary("herdr", seams) || defaultHerdrSocketPath(seams) !== void 0
|
|
7310
|
+
},
|
|
7311
|
+
cmux: {
|
|
7312
|
+
available: pathHasBinary("cmux", seams) || macAppInstalled("cmux.app", seams)
|
|
7313
|
+
},
|
|
7314
|
+
vscode: {
|
|
7315
|
+
// PATH shim OR the .app bundle — a freshly-dragged VS Code/Cursor has no
|
|
7316
|
+
// `code`/`cursor` on PATH until the user runs the "Install 'code' command"
|
|
7317
|
+
// step, but `agentbox open --in vscode` can launch it from the bundle.
|
|
7318
|
+
available: VSCODE_APPS.some(
|
|
7319
|
+
(a) => pathHasBinary(a.cli, seams) || macAppInstalled(a.appName, seams)
|
|
7320
|
+
),
|
|
7321
|
+
providers: [...IDE_PROVIDERS]
|
|
7322
|
+
},
|
|
7323
|
+
iterm2: {
|
|
7324
|
+
available: macAppInstalled("iTerm.app", seams)
|
|
7325
|
+
},
|
|
7326
|
+
finder: {
|
|
7327
|
+
// The OS file-manager reveal always works (Finder on macOS, xdg-open
|
|
7328
|
+
// elsewhere); provider gating is what limits `open` to SSH-capable boxes.
|
|
7329
|
+
available: true,
|
|
7330
|
+
providers: [...SSH_MOUNT_PROVIDERS]
|
|
7267
7331
|
}
|
|
7268
|
-
}
|
|
7269
|
-
const spec = await p.buildAttach(box, "shell", { noTmux: true });
|
|
7270
|
-
const target = parseSshTarget(spec.argv);
|
|
7271
|
-
if (!target) {
|
|
7272
|
-
throw new Error(`could not parse <user>@<host> from cloud SSH argv: ${spec.argv.join(" ")}`);
|
|
7273
|
-
}
|
|
7274
|
-
const alias = agentboxAliasFor(box.name);
|
|
7275
|
-
return { alias, host: target.host, user: target.user, identityFile: target.identityFile };
|
|
7332
|
+
};
|
|
7276
7333
|
}
|
|
7277
|
-
|
|
7278
|
-
|
|
7279
|
-
await recordBoxSsh(box.id, {
|
|
7280
|
-
host: conn.host,
|
|
7281
|
-
user: conn.user,
|
|
7282
|
-
identityFile: conn.identityFile
|
|
7283
|
-
});
|
|
7284
|
-
await syncAgentboxSshConfig();
|
|
7285
|
-
return conn;
|
|
7334
|
+
function codexAddUrl(alias) {
|
|
7335
|
+
return `codex://settings/connections/ssh/add?name=${encodeURIComponent(alias)}`;
|
|
7286
7336
|
}
|
|
7287
|
-
|
|
7288
|
-
|
|
7289
|
-
|
|
7290
|
-
const
|
|
7291
|
-
|
|
7292
|
-
|
|
7293
|
-
|
|
7294
|
-
|
|
7295
|
-
identityFile: conn.identityFile
|
|
7296
|
-
});
|
|
7297
|
-
await syncAgentboxSshConfig();
|
|
7298
|
-
} catch {
|
|
7299
|
-
}
|
|
7337
|
+
function renderTargets(report) {
|
|
7338
|
+
const lines = OPEN_IN_APPS.map((app) => {
|
|
7339
|
+
const info = report[app];
|
|
7340
|
+
const status = info.available ? "available" : "not installed";
|
|
7341
|
+
const scope = info.providers ? ` (${info.providers.join(", ")} boxes)` : "";
|
|
7342
|
+
return `${app}: ${status}${info.available ? scope : ""}`;
|
|
7343
|
+
});
|
|
7344
|
+
return lines.join("\n") + "\n";
|
|
7300
7345
|
}
|
|
7301
7346
|
|
|
7302
7347
|
// src/commands/code.ts
|
|
@@ -7328,40 +7373,43 @@ var codeCommand = new Command10("code").description("Open a box in VS Code or Cu
|
|
|
7328
7373
|
).action(async (idOrName, opts) => {
|
|
7329
7374
|
try {
|
|
7330
7375
|
const box = await resolveBoxOrExit(idOrName);
|
|
7331
|
-
|
|
7332
|
-
cliOverrides: buildCodeCliOverrides(opts)
|
|
7333
|
-
});
|
|
7334
|
-
const wait = cfg.effective.code.wait;
|
|
7335
|
-
const autoTerminals = cfg.effective.code.autoTerminals;
|
|
7336
|
-
const timeoutMs = String(cfg.effective.code.timeoutMs);
|
|
7337
|
-
const ide = cfg.effective.code.ide;
|
|
7338
|
-
const forcedIde = ide === "auto" ? void 0 : ide;
|
|
7339
|
-
const provider = box.provider ?? "docker";
|
|
7340
|
-
const folderUri = provider === "docker" ? await prepareDockerAttach(box, { wait, autoTerminals, timeoutMs, regenTasks: opts.regenTasks }) : await prepareCloudAttach(box, { wait, timeoutMs });
|
|
7341
|
-
if (opts.print) {
|
|
7342
|
-
process.stdout.write(folderUri + "\n");
|
|
7343
|
-
return;
|
|
7344
|
-
}
|
|
7345
|
-
const exit = await launchIde(folderUri, forcedIde);
|
|
7346
|
-
if (exit.code !== 0) {
|
|
7347
|
-
log19.error(`failed to launch ${exit.flavor ? ideProfile(exit.flavor).displayName : "IDE"} via ${exit.via} (exit ${String(exit.code)})`);
|
|
7348
|
-
process.stdout.write(folderUri + "\n");
|
|
7349
|
-
process.exit(1);
|
|
7350
|
-
}
|
|
7351
|
-
log19.success(
|
|
7352
|
-
`opening ${box.name} in ${ideProfile(exit.flavor).displayName} (${exit.via})`
|
|
7353
|
-
);
|
|
7376
|
+
await runCodeOpen(box, opts);
|
|
7354
7377
|
} catch (err) {
|
|
7355
7378
|
handleLifecycleError(err);
|
|
7356
7379
|
}
|
|
7357
7380
|
});
|
|
7381
|
+
async function runCodeOpen(box, opts) {
|
|
7382
|
+
const cfg = await loadEffectiveConfig(box.workspacePath, {
|
|
7383
|
+
cliOverrides: buildCodeCliOverrides(opts)
|
|
7384
|
+
});
|
|
7385
|
+
const wait = cfg.effective.code.wait;
|
|
7386
|
+
const autoTerminals = cfg.effective.code.autoTerminals;
|
|
7387
|
+
const timeoutMs = String(cfg.effective.code.timeoutMs);
|
|
7388
|
+
const ide = cfg.effective.code.ide;
|
|
7389
|
+
const forcedIde = ide === "auto" ? void 0 : ide;
|
|
7390
|
+
const provider = box.provider ?? "docker";
|
|
7391
|
+
const folderUri = provider === "docker" ? await prepareDockerAttach(box, { wait, autoTerminals, timeoutMs, regenTasks: opts.regenTasks }) : await prepareCloudAttach(box, { wait, timeoutMs });
|
|
7392
|
+
if (opts.print) {
|
|
7393
|
+
process.stdout.write(folderUri + "\n");
|
|
7394
|
+
return;
|
|
7395
|
+
}
|
|
7396
|
+
const exit = await launchIde(folderUri, forcedIde);
|
|
7397
|
+
if (exit.code !== 0) {
|
|
7398
|
+
log18.error(`failed to launch ${exit.flavor ? ideProfile(exit.flavor).displayName : "IDE"} via ${exit.via} (exit ${String(exit.code)})`);
|
|
7399
|
+
process.stdout.write(folderUri + "\n");
|
|
7400
|
+
process.exit(1);
|
|
7401
|
+
}
|
|
7402
|
+
log18.success(
|
|
7403
|
+
`opening ${box.name} in ${ideProfile(exit.flavor).displayName} (${exit.via})`
|
|
7404
|
+
);
|
|
7405
|
+
}
|
|
7358
7406
|
async function prepareDockerAttach(box, opts) {
|
|
7359
7407
|
const insp = await inspectBox(box.id);
|
|
7360
7408
|
if (insp.state === "paused") {
|
|
7361
|
-
|
|
7409
|
+
log18.info(`box is paused; unpausing`);
|
|
7362
7410
|
await unpauseBox(box.id);
|
|
7363
7411
|
} else if (insp.state === "stopped") {
|
|
7364
|
-
|
|
7412
|
+
log18.info(`box is stopped; starting`);
|
|
7365
7413
|
await startBox(box.id);
|
|
7366
7414
|
} else if (insp.state === "missing") {
|
|
7367
7415
|
throw new Error(`box ${box.name} has no container; was it destroyed?`);
|
|
@@ -7372,9 +7420,9 @@ async function prepareDockerAttach(box, opts) {
|
|
|
7372
7420
|
const lines = [];
|
|
7373
7421
|
if (reply.timedOut.length > 0) lines.push(`timed out: ${reply.timedOut.join(", ")}`);
|
|
7374
7422
|
if (reply.failed.length > 0) lines.push(`failed: ${reply.failed.join(", ")}`);
|
|
7375
|
-
|
|
7423
|
+
log18.warn(`box not fully ready (${lines.join("; ")}). Opening anyway.`);
|
|
7376
7424
|
} else {
|
|
7377
|
-
|
|
7425
|
+
log18.success("all units ready");
|
|
7378
7426
|
}
|
|
7379
7427
|
}
|
|
7380
7428
|
if (opts.autoTerminals) {
|
|
@@ -7384,14 +7432,14 @@ async function prepareDockerAttach(box, opts) {
|
|
|
7384
7432
|
regen: opts.regenTasks
|
|
7385
7433
|
});
|
|
7386
7434
|
if (r.status === "wrote") {
|
|
7387
|
-
|
|
7435
|
+
log18.info(`wrote /workspace/.vscode/tasks.json (${String(services.length)} service(s))`);
|
|
7388
7436
|
} else if (r.status === "skipped-user-owned") {
|
|
7389
|
-
|
|
7437
|
+
log18.warn(
|
|
7390
7438
|
"user-owned .vscode/tasks.json detected; skipping auto-terminals (pass --regen-tasks to overwrite)"
|
|
7391
7439
|
);
|
|
7392
7440
|
}
|
|
7393
7441
|
} catch (err) {
|
|
7394
|
-
|
|
7442
|
+
log18.warn(
|
|
7395
7443
|
`auto-terminals failed: ${err instanceof Error ? err.message : String(err)}`
|
|
7396
7444
|
);
|
|
7397
7445
|
}
|
|
@@ -7403,10 +7451,10 @@ async function prepareCloudAttach(box, opts) {
|
|
|
7403
7451
|
const p = await providerForBox(box);
|
|
7404
7452
|
const state = await p.probeState(box);
|
|
7405
7453
|
if (state === "paused") {
|
|
7406
|
-
|
|
7454
|
+
log18.info("box is paused; resuming");
|
|
7407
7455
|
await p.resume(box);
|
|
7408
7456
|
} else if (state === "stopped") {
|
|
7409
|
-
|
|
7457
|
+
log18.info("box is stopped; starting");
|
|
7410
7458
|
await p.start(box);
|
|
7411
7459
|
} else if (state === "missing") {
|
|
7412
7460
|
throw new Error(`cloud sandbox for ${box.name} is missing; was it deleted?`);
|
|
@@ -7419,16 +7467,16 @@ async function prepareCloudAttach(box, opts) {
|
|
|
7419
7467
|
const lines = [];
|
|
7420
7468
|
if (reply.timedOut.length > 0) lines.push(`timed out: ${reply.timedOut.join(", ")}`);
|
|
7421
7469
|
if (reply.failed.length > 0) lines.push(`failed: ${reply.failed.join(", ")}`);
|
|
7422
|
-
|
|
7470
|
+
log18.warn(`box not fully ready (${lines.join("; ")}). Opening anyway.`);
|
|
7423
7471
|
} else {
|
|
7424
|
-
|
|
7472
|
+
log18.success("all units ready");
|
|
7425
7473
|
}
|
|
7426
7474
|
} catch (err) {
|
|
7427
|
-
|
|
7475
|
+
log18.warn(`wait-ready failed (continuing): ${err instanceof Error ? err.message : String(err)}`);
|
|
7428
7476
|
}
|
|
7429
7477
|
}
|
|
7430
|
-
const { alias } = await ensureCloudSshAlias(box, { bringOnline: false });
|
|
7431
|
-
|
|
7478
|
+
const { alias } = await ensureCloudSshAlias(box, p, { bringOnline: false });
|
|
7479
|
+
log18.info(`updated ~/.ssh/config alias ${alias}`);
|
|
7432
7480
|
return `vscode-remote://ssh-remote+${alias}/workspace`;
|
|
7433
7481
|
}
|
|
7434
7482
|
async function runWaitReadyDocker(container, timeoutMs) {
|
|
@@ -7453,21 +7501,26 @@ async function launchIde(folderUri, forced) {
|
|
|
7453
7501
|
if (code !== null) return code;
|
|
7454
7502
|
const cursor = await tryCli("cursor", folderUri);
|
|
7455
7503
|
if (cursor !== null) return cursor;
|
|
7456
|
-
|
|
7504
|
+
log18.warn("neither `code` nor `cursor` found on PATH or in /Applications; falling back to `open vscode://...`");
|
|
7457
7505
|
return launchOne("vscode", folderUri);
|
|
7458
7506
|
}
|
|
7459
7507
|
async function tryCli(flavor, folderUri) {
|
|
7460
7508
|
const profile = ideProfile(flavor);
|
|
7461
|
-
const
|
|
7509
|
+
const bin = resolveVscodeCli(profile.cli);
|
|
7510
|
+
if (!bin) return null;
|
|
7511
|
+
const code = await spawnCommand(bin, ["--folder-uri", folderUri]);
|
|
7462
7512
|
if (code === 127) return null;
|
|
7463
7513
|
return { code, flavor, via: "cli" };
|
|
7464
7514
|
}
|
|
7465
7515
|
async function launchOne(flavor, folderUri) {
|
|
7466
7516
|
const profile = ideProfile(flavor);
|
|
7467
|
-
const
|
|
7468
|
-
if (
|
|
7469
|
-
|
|
7470
|
-
|
|
7517
|
+
const bin = resolveVscodeCli(profile.cli);
|
|
7518
|
+
if (bin) {
|
|
7519
|
+
const cliCode = await spawnCommand(bin, ["--folder-uri", folderUri]);
|
|
7520
|
+
if (cliCode !== 127) return { code: cliCode, flavor, via: "cli" };
|
|
7521
|
+
}
|
|
7522
|
+
log18.warn(
|
|
7523
|
+
`\`${profile.cli}\` not found on PATH or in /Applications; falling back to \`${hostOpenCommand()} ${profile.protocolScheme}://...\` (the %2B URL-encoding bug may break attach)`
|
|
7471
7524
|
);
|
|
7472
7525
|
const url = `${profile.protocolScheme}://${folderUri.replace(/^vscode-remote:\/\//, "vscode-remote/")}`;
|
|
7473
7526
|
const fallback = await spawnCommand(hostOpenCommand(), [url]);
|
|
@@ -7770,7 +7823,7 @@ var configCommand = new Command11("config").description("Read / write layered co
|
|
|
7770
7823
|
|
|
7771
7824
|
// src/commands/cp.ts
|
|
7772
7825
|
import { resolve as resolve3 } from "path";
|
|
7773
|
-
import { log as
|
|
7826
|
+
import { log as log19 } from "@clack/prompts";
|
|
7774
7827
|
import { Command as Command12 } from "commander";
|
|
7775
7828
|
function collectExclude(val, acc) {
|
|
7776
7829
|
acc.push(val);
|
|
@@ -7928,10 +7981,10 @@ var cpCommand = new Command12("cp").description("Copy files between host and box
|
|
|
7928
7981
|
}
|
|
7929
7982
|
const insp = await inspectBox(box.id);
|
|
7930
7983
|
if (insp.state === "paused") {
|
|
7931
|
-
|
|
7984
|
+
log19.info("box is paused; unpausing");
|
|
7932
7985
|
await unpauseBox(box.id);
|
|
7933
7986
|
} else if (insp.state === "stopped") {
|
|
7934
|
-
|
|
7987
|
+
log19.info("box is stopped; starting");
|
|
7935
7988
|
await startBox(box.id);
|
|
7936
7989
|
} else if (insp.state === "missing") {
|
|
7937
7990
|
throw new Error(`box ${box.name} has no container; was it destroyed?`);
|
|
@@ -7939,7 +7992,7 @@ var cpCommand = new Command12("cp").description("Copy files between host and box
|
|
|
7939
7992
|
if (parsed.direction === "upload") {
|
|
7940
7993
|
const result = await uploadToBox(box, parsed.hostSrcs, parsed.boxDst, tarPatterns);
|
|
7941
7994
|
if (result.warn) {
|
|
7942
|
-
|
|
7995
|
+
log19.warn(`copied to ${box.name}:${result.finalPath}, but ${result.warn}`);
|
|
7943
7996
|
} else {
|
|
7944
7997
|
process.stdout.write(`copied to ${box.name}:${result.finalPath}
|
|
7945
7998
|
`);
|
|
@@ -7960,7 +8013,7 @@ var cpCommand = new Command12("cp").description("Copy files between host and box
|
|
|
7960
8013
|
});
|
|
7961
8014
|
|
|
7962
8015
|
// src/commands/create.ts
|
|
7963
|
-
import { intro as intro8, log as
|
|
8016
|
+
import { intro as intro8, log as log20, outro as outro7 } from "@clack/prompts";
|
|
7964
8017
|
import { Command as Command13 } from "commander";
|
|
7965
8018
|
import { execSync, spawnSync as spawnSync2 } from "child_process";
|
|
7966
8019
|
function buildCliOverrides(opts) {
|
|
@@ -8113,13 +8166,13 @@ var createCommand = new Command13("create").description(
|
|
|
8113
8166
|
onLog: (line) => cmdLog.write(line)
|
|
8114
8167
|
});
|
|
8115
8168
|
if (gate.decision === "cancel") {
|
|
8116
|
-
|
|
8169
|
+
log20.warn("carry: cancelled \u2014 not creating the box");
|
|
8117
8170
|
cmdLog.close();
|
|
8118
8171
|
process.exit(0);
|
|
8119
8172
|
}
|
|
8120
8173
|
if (gate.decision === "approve") carryEntries = gate.entries;
|
|
8121
8174
|
} catch (err) {
|
|
8122
|
-
|
|
8175
|
+
log20.error(err instanceof Error ? err.message : String(err));
|
|
8123
8176
|
cmdLog.close();
|
|
8124
8177
|
process.exit(1);
|
|
8125
8178
|
}
|
|
@@ -8138,7 +8191,7 @@ var createCommand = new Command13("create").description(
|
|
|
8138
8191
|
baseStatus
|
|
8139
8192
|
});
|
|
8140
8193
|
if (wiz.rebuildBase) {
|
|
8141
|
-
|
|
8194
|
+
log20.warn(`${providerName} base image is outdated; rebuilding before create\u2026`);
|
|
8142
8195
|
await runPrepare(providerName, {
|
|
8143
8196
|
force: true,
|
|
8144
8197
|
cwd: opts.workspace,
|
|
@@ -8184,7 +8237,7 @@ var createCommand = new Command13("create").description(
|
|
|
8184
8237
|
} catch (err) {
|
|
8185
8238
|
if (err instanceof FromBranchError || err instanceof UseBranchError) {
|
|
8186
8239
|
s.stop("aborting: invalid branch selection");
|
|
8187
|
-
|
|
8240
|
+
log20.error(err.message);
|
|
8188
8241
|
cmdLog.close();
|
|
8189
8242
|
process.exit(2);
|
|
8190
8243
|
}
|
|
@@ -8232,21 +8285,26 @@ var createCommand = new Command13("create").description(
|
|
|
8232
8285
|
});
|
|
8233
8286
|
s.stop(`box ${result.record.container} ready`);
|
|
8234
8287
|
const createResyncWarning = result.resync ? buildResyncWarning(result.resync) : null;
|
|
8235
|
-
if (createResyncWarning)
|
|
8288
|
+
if (createResyncWarning) log20.warn(createResyncWarning);
|
|
8236
8289
|
if (!isDocker) {
|
|
8237
|
-
await autoWriteSshConfig(
|
|
8290
|
+
await autoWriteSshConfig(
|
|
8291
|
+
result.record,
|
|
8292
|
+
provider,
|
|
8293
|
+
cfg.effective.ssh.autoConfig,
|
|
8294
|
+
(m2) => log20.warn(m2)
|
|
8295
|
+
);
|
|
8238
8296
|
}
|
|
8239
|
-
|
|
8297
|
+
log20.info(`id: ${result.record.id}`);
|
|
8240
8298
|
if (typeof result.record.projectIndex === "number") {
|
|
8241
|
-
|
|
8299
|
+
log20.info(`n: ${String(result.record.projectIndex)} (in ${projectRoot})`);
|
|
8242
8300
|
}
|
|
8243
|
-
|
|
8244
|
-
|
|
8301
|
+
log20.info(`container: ${result.record.container}`);
|
|
8302
|
+
log20.info(`image: ${result.record.image}${result.imageBuilt ? " (built just now)" : ""}`);
|
|
8245
8303
|
if (result.record.snapshotDir) {
|
|
8246
|
-
|
|
8304
|
+
log20.info(`snapshot: ${result.record.snapshotDir}`);
|
|
8247
8305
|
}
|
|
8248
8306
|
if (result.record.checkpointSource) {
|
|
8249
|
-
|
|
8307
|
+
log20.info(
|
|
8250
8308
|
`checkpoint: ${result.record.checkpointSource.ref} (${result.record.checkpointSource.type}) \u2192 ${result.record.checkpointImage ?? "(missing)"}`
|
|
8251
8309
|
);
|
|
8252
8310
|
}
|
|
@@ -8258,7 +8316,7 @@ var createCommand = new Command13("create").description(
|
|
|
8258
8316
|
` agentbox claude attach ${result.record.name}`,
|
|
8259
8317
|
` agentbox url ${result.record.name}`
|
|
8260
8318
|
];
|
|
8261
|
-
|
|
8319
|
+
log20.message(
|
|
8262
8320
|
[
|
|
8263
8321
|
"",
|
|
8264
8322
|
"Try it:",
|
|
@@ -8277,7 +8335,7 @@ var createCommand = new Command13("create").description(
|
|
|
8277
8335
|
const protectedPaths = boxes.map((b) => b.projectRoot).filter((p) => typeof p === "string");
|
|
8278
8336
|
const res = await pruneOrphanProjectConfigs({ protectedPaths });
|
|
8279
8337
|
if (res.removed.length > 0) {
|
|
8280
|
-
|
|
8338
|
+
log20.info(
|
|
8281
8339
|
`cleaned ${String(res.removed.length)} orphan project config dir(s): ` + res.removed.map((r) => r.originalPath).join(", ")
|
|
8282
8340
|
);
|
|
8283
8341
|
}
|
|
@@ -8287,7 +8345,7 @@ var createCommand = new Command13("create").description(
|
|
|
8287
8345
|
}
|
|
8288
8346
|
outro7("done");
|
|
8289
8347
|
if (attachClaudeAfter) {
|
|
8290
|
-
const { cloudAgentAttach: cloudAgentAttach2 } = await import("./_cloud-attach-
|
|
8348
|
+
const { cloudAgentAttach: cloudAgentAttach2 } = await import("./_cloud-attach-RFPLNACE.js");
|
|
8291
8349
|
await cloudAgentAttach2({
|
|
8292
8350
|
box: result.record,
|
|
8293
8351
|
binary: "claude",
|
|
@@ -8303,14 +8361,14 @@ var createCommand = new Command13("create").description(
|
|
|
8303
8361
|
s.stop("failed");
|
|
8304
8362
|
const msg = err instanceof Error ? err.message : String(err);
|
|
8305
8363
|
cmdLog.write(`FAIL: ${err instanceof Error ? err.stack ?? err.message : String(err)}`);
|
|
8306
|
-
|
|
8364
|
+
log20.error(msg);
|
|
8307
8365
|
try {
|
|
8308
8366
|
const running = execSync('docker ps --format "{{.Names}}"', {
|
|
8309
8367
|
stdio: ["ignore", "pipe", "ignore"]
|
|
8310
8368
|
}).toString().split("\n").filter((n) => n.startsWith("agentbox-"));
|
|
8311
8369
|
if (running.length > 0) {
|
|
8312
|
-
|
|
8313
|
-
|
|
8370
|
+
log20.warn(`leftover containers: ${running.join(", ")}`);
|
|
8371
|
+
log20.warn(`remove with: docker rm -f ${running.join(" ")}`);
|
|
8314
8372
|
}
|
|
8315
8373
|
} catch {
|
|
8316
8374
|
}
|
|
@@ -8323,7 +8381,7 @@ var createCommand = new Command13("create").description(
|
|
|
8323
8381
|
|
|
8324
8382
|
// src/commands/dashboard.ts
|
|
8325
8383
|
import { spawn as spawn5 } from "child_process";
|
|
8326
|
-
import { log as
|
|
8384
|
+
import { log as log21 } from "@clack/prompts";
|
|
8327
8385
|
import { Command as Command14 } from "commander";
|
|
8328
8386
|
|
|
8329
8387
|
// src/dashboard/layout.ts
|
|
@@ -9850,7 +9908,7 @@ function toSidebar(b) {
|
|
|
9850
9908
|
var dashboardCommand = new Command14("dashboard").description("Box list + the selected box live Agent session").argument("[box]", "initial box (default: first running box; -p restricts to the cwd project)").option("-p, --project", "only this project's boxes (default: all boxes globally)").action(async (idOrName, opts) => {
|
|
9851
9909
|
try {
|
|
9852
9910
|
if (!process.stdout.isTTY || !process.stdin.isTTY) {
|
|
9853
|
-
|
|
9911
|
+
log21.error("agentbox dashboard needs an interactive terminal");
|
|
9854
9912
|
process.exit(2);
|
|
9855
9913
|
}
|
|
9856
9914
|
const backend = await loadPtyBackend();
|
|
@@ -9860,10 +9918,10 @@ var dashboardCommand = new Command14("dashboard").description("Box list + the se
|
|
|
9860
9918
|
ptySpawn = backend.ptySpawn;
|
|
9861
9919
|
termCtor = backend.termCtor;
|
|
9862
9920
|
} else {
|
|
9863
|
-
|
|
9921
|
+
log21.error(
|
|
9864
9922
|
"agentbox dashboard is unavailable here (native terminal backend failed to load)"
|
|
9865
9923
|
);
|
|
9866
|
-
|
|
9924
|
+
log21.info("use `agentbox claude` / `agentbox attach` instead");
|
|
9867
9925
|
process.exit(2);
|
|
9868
9926
|
}
|
|
9869
9927
|
const project = await findProjectRoot(process.cwd());
|
|
@@ -10270,11 +10328,11 @@ var dashboardCommand = new Command14("dashboard").description("Box list + the se
|
|
|
10270
10328
|
});
|
|
10271
10329
|
|
|
10272
10330
|
// ../../packages/sandbox-daytona/dist/cli.js
|
|
10273
|
-
import { log as
|
|
10331
|
+
import { log as log22, spinner as spinner8 } from "@clack/prompts";
|
|
10274
10332
|
import { Command as Command15 } from "commander";
|
|
10275
10333
|
function reportError(err) {
|
|
10276
10334
|
const message = err instanceof Error ? err.message : String(err);
|
|
10277
|
-
|
|
10335
|
+
log22.error(message);
|
|
10278
10336
|
process.exitCode = 1;
|
|
10279
10337
|
}
|
|
10280
10338
|
var loginSub = new Command15("login").description("Set up (or rotate) Daytona credentials for cloud boxes").option("--status", "show what is currently configured (masked) and exit").action(async (opts) => {
|
|
@@ -10292,7 +10350,7 @@ var loginSub = new Command15("login").description("Set up (or rotate) Daytona cr
|
|
|
10292
10350
|
}
|
|
10293
10351
|
await ensureDaytonaCredentials({ force: true });
|
|
10294
10352
|
if (readPreparedDaytonaState()?.base === void 0) {
|
|
10295
|
-
|
|
10353
|
+
log22.info(
|
|
10296
10354
|
"Base snapshot not built yet \u2014 run `agentbox prepare --provider daytona` (or `agentbox install`) to bake it."
|
|
10297
10355
|
);
|
|
10298
10356
|
}
|
|
@@ -10338,7 +10396,7 @@ var resyncSub = new Command15("resync").description(
|
|
|
10338
10396
|
const sb = spinner8();
|
|
10339
10397
|
sb.start(`provisioning throwaway sandbox to refresh: ${agents.join(", ")}`);
|
|
10340
10398
|
const ensured = await ensureAgentVolumesForCloud(daytonaBackend, {
|
|
10341
|
-
onLog: (line) =>
|
|
10399
|
+
onLog: (line) => log22.info(line)
|
|
10342
10400
|
});
|
|
10343
10401
|
if (ensured.agents.length === 0) {
|
|
10344
10402
|
sb.stop("no agent volumes available \u2014 the daytona backend has no volume primitive");
|
|
@@ -10378,7 +10436,7 @@ var resyncSub = new Command15("resync").description(
|
|
|
10378
10436
|
}
|
|
10379
10437
|
sb3.stop("throwaway sandbox destroyed");
|
|
10380
10438
|
}
|
|
10381
|
-
|
|
10439
|
+
log22.success(
|
|
10382
10440
|
`Daytona agent volumes refreshed: ${agents.join(", ")}. Next \`agentbox create --provider daytona\` will use the updated credentials.`
|
|
10383
10441
|
);
|
|
10384
10442
|
} catch (err) {
|
|
@@ -10398,11 +10456,11 @@ var dockerCommand = new Command16("docker").description(
|
|
|
10398
10456
|
});
|
|
10399
10457
|
|
|
10400
10458
|
// ../../packages/sandbox-hetzner/dist/cli.js
|
|
10401
|
-
import { log as
|
|
10459
|
+
import { log as log23 } from "@clack/prompts";
|
|
10402
10460
|
import { Command as Command17 } from "commander";
|
|
10403
10461
|
function reportError2(err) {
|
|
10404
10462
|
const message = err instanceof Error ? err.message : String(err);
|
|
10405
|
-
|
|
10463
|
+
log23.error(message);
|
|
10406
10464
|
process.exitCode = 1;
|
|
10407
10465
|
}
|
|
10408
10466
|
var loginSub2 = new Command17("login").description("Set up (or rotate) Hetzner Cloud credentials for VPS boxes").option("--status", "show what is currently configured (masked) and exit").action(async (opts) => {
|
|
@@ -10420,7 +10478,7 @@ var loginSub2 = new Command17("login").description("Set up (or rotate) Hetzner C
|
|
|
10420
10478
|
}
|
|
10421
10479
|
await ensureHetznerCredentials({ force: true });
|
|
10422
10480
|
if (readPreparedState().base === void 0) {
|
|
10423
|
-
|
|
10481
|
+
log23.info(
|
|
10424
10482
|
"Base snapshot not built yet \u2014 run `agentbox prepare --provider hetzner` (or `agentbox install`) to bake it."
|
|
10425
10483
|
);
|
|
10426
10484
|
}
|
|
@@ -10551,11 +10609,11 @@ var hetznerCommand = new Command17("hetzner").description(
|
|
|
10551
10609
|
).addCommand(loginSub2, { isDefault: true }).addCommand(firewallSub);
|
|
10552
10610
|
|
|
10553
10611
|
// ../../packages/sandbox-vercel/dist/cli.js
|
|
10554
|
-
import { log as
|
|
10612
|
+
import { log as log24 } from "@clack/prompts";
|
|
10555
10613
|
import { Command as Command18 } from "commander";
|
|
10556
10614
|
function reportError3(err) {
|
|
10557
10615
|
const message = err instanceof Error ? err.message : String(err);
|
|
10558
|
-
|
|
10616
|
+
log24.error(message);
|
|
10559
10617
|
process.exitCode = 1;
|
|
10560
10618
|
}
|
|
10561
10619
|
function relativeExpiry(expiresAt) {
|
|
@@ -10618,7 +10676,7 @@ var loginSub3 = new Command18("login").description("Set up (or rotate) Vercel cr
|
|
|
10618
10676
|
}
|
|
10619
10677
|
await ensureVercelCredentials({ force: true });
|
|
10620
10678
|
if (readPreparedState2().base === void 0) {
|
|
10621
|
-
|
|
10679
|
+
log24.info(
|
|
10622
10680
|
"Base snapshot not built yet \u2014 run `agentbox prepare --provider vercel` (or `agentbox install`) to bake it."
|
|
10623
10681
|
);
|
|
10624
10682
|
}
|
|
@@ -10631,11 +10689,11 @@ var vercelCommand = new Command18("vercel").description(
|
|
|
10631
10689
|
).addCommand(loginSub3, { isDefault: true });
|
|
10632
10690
|
|
|
10633
10691
|
// ../../packages/sandbox-e2b/dist/cli.js
|
|
10634
|
-
import { log as
|
|
10692
|
+
import { log as log25 } from "@clack/prompts";
|
|
10635
10693
|
import { Command as Command19 } from "commander";
|
|
10636
10694
|
function reportError4(err) {
|
|
10637
10695
|
const message = err instanceof Error ? err.message : String(err);
|
|
10638
|
-
|
|
10696
|
+
log25.error(message);
|
|
10639
10697
|
process.exitCode = 1;
|
|
10640
10698
|
}
|
|
10641
10699
|
function printStatus4() {
|
|
@@ -10667,7 +10725,7 @@ var loginSub4 = new Command19("login").description("Set up (or rotate) E2B crede
|
|
|
10667
10725
|
}
|
|
10668
10726
|
await ensureE2bCredentials({ force: true });
|
|
10669
10727
|
if (readPreparedState3().base === void 0) {
|
|
10670
|
-
|
|
10728
|
+
log25.info(
|
|
10671
10729
|
"Base template not built yet \u2014 run `agentbox prepare --provider e2b` (or `agentbox install`) to bake it."
|
|
10672
10730
|
);
|
|
10673
10731
|
}
|
|
@@ -11221,7 +11279,7 @@ downloadCommand.addCommand(downloadOpencodeCommand);
|
|
|
11221
11279
|
downloadCommand.addCommand(downloadConfigCommand);
|
|
11222
11280
|
|
|
11223
11281
|
// src/commands/drive.ts
|
|
11224
|
-
import { log as
|
|
11282
|
+
import { log as log33 } from "@clack/prompts";
|
|
11225
11283
|
import { Command as Command27 } from "commander";
|
|
11226
11284
|
|
|
11227
11285
|
// src/lib/drive/keys.ts
|
|
@@ -11404,7 +11462,7 @@ var driveWaitCommand = new Command27("wait").description("Block until --text app
|
|
|
11404
11462
|
}) + "\n"
|
|
11405
11463
|
);
|
|
11406
11464
|
} else {
|
|
11407
|
-
|
|
11465
|
+
log33.error(`text not found within ${String(timeoutMs)}ms: ${opts.text}`);
|
|
11408
11466
|
}
|
|
11409
11467
|
process.exit(1);
|
|
11410
11468
|
} catch (err) {
|
|
@@ -11431,8 +11489,8 @@ driveCommand.addCommand(driveWaitCommand);
|
|
|
11431
11489
|
driveCommand.addCommand(driveResizeCommand);
|
|
11432
11490
|
function handleDriveError(err) {
|
|
11433
11491
|
if (err instanceof SessionNotFoundError) {
|
|
11434
|
-
|
|
11435
|
-
|
|
11492
|
+
log33.error(err.message);
|
|
11493
|
+
log33.info("start an agent first (e.g. `agentbox claude <box>`) or pass --session.");
|
|
11436
11494
|
process.exit(2);
|
|
11437
11495
|
}
|
|
11438
11496
|
handleLifecycleError(err);
|
|
@@ -11456,11 +11514,11 @@ function sleep4(ms) {
|
|
|
11456
11514
|
}
|
|
11457
11515
|
|
|
11458
11516
|
// src/commands/fork.ts
|
|
11459
|
-
import { log as
|
|
11517
|
+
import { log as log34 } from "@clack/prompts";
|
|
11460
11518
|
import { Command as Command28 } from "commander";
|
|
11461
|
-
import { existsSync as
|
|
11519
|
+
import { existsSync as existsSync10, readdirSync as readdirSync3, statSync as statSync2 } from "fs";
|
|
11462
11520
|
import { homedir as homedir15 } from "os";
|
|
11463
|
-
import { join as
|
|
11521
|
+
import { join as join20 } from "path";
|
|
11464
11522
|
var FORK_AGENTS = ["claude", "codex", "opencode"];
|
|
11465
11523
|
var FORK_PROVIDERS = PROVIDER_NAMES;
|
|
11466
11524
|
function resolveForkProvider(positional, flag) {
|
|
@@ -11500,12 +11558,12 @@ function resolveSessionArgs(agent, opts) {
|
|
|
11500
11558
|
}
|
|
11501
11559
|
if (opts.session) return ["--resume", opts.session];
|
|
11502
11560
|
if (agent === "codex") return ["--continue"];
|
|
11503
|
-
const dir =
|
|
11504
|
-
if (!
|
|
11561
|
+
const dir = join20(homedir15(), ".claude", "projects", encodeClaudeProjectsDir(opts.workspace));
|
|
11562
|
+
if (!existsSync10(dir)) return ["--continue"];
|
|
11505
11563
|
const now = Date.now();
|
|
11506
11564
|
const recent = readdirSync3(dir).filter((f) => f.endsWith(".jsonl")).map((f) => {
|
|
11507
11565
|
try {
|
|
11508
|
-
return statSync2(
|
|
11566
|
+
return statSync2(join20(dir, f)).mtimeMs;
|
|
11509
11567
|
} catch {
|
|
11510
11568
|
return 0;
|
|
11511
11569
|
}
|
|
@@ -11555,49 +11613,49 @@ var forkCommand = new Command28("fork").description(
|
|
|
11555
11613
|
'copy a Claude Code plan file (e.g. ~/.claude/plans/<slug>.md) into the box, start claude in plan mode, and seed a "resume the plan" prompt. Claude only.'
|
|
11556
11614
|
).action(async (providerArg, opts) => {
|
|
11557
11615
|
if ((process.env.AGENTBOX_RELAY_URL ?? "").trim().length > 0) {
|
|
11558
|
-
|
|
11616
|
+
log34.error(
|
|
11559
11617
|
"agentbox fork runs on the host only: it teleports a host agent session into a new box. You appear to be inside a box (AGENTBOX_RELAY_URL is set) \u2014 box\u2192box fork is not supported yet."
|
|
11560
11618
|
);
|
|
11561
11619
|
process.exit(2);
|
|
11562
11620
|
}
|
|
11563
11621
|
const agent = opts.agent?.trim() || detectAgentFromEnv() || "claude";
|
|
11564
11622
|
if (!FORK_AGENTS.includes(agent)) {
|
|
11565
|
-
|
|
11623
|
+
log34.error(`--agent: expected one of ${FORK_AGENTS.join(", ")}, got "${opts.agent ?? ""}"`);
|
|
11566
11624
|
process.exit(2);
|
|
11567
11625
|
}
|
|
11568
11626
|
const attachIn = opts.attachIn ?? "tab";
|
|
11569
11627
|
if (!FORK_ATTACH_VALUES.includes(attachIn)) {
|
|
11570
|
-
|
|
11628
|
+
log34.error(`--attach-in: expected one of ${FORK_ATTACH_VALUES.join(", ")}, got "${attachIn}"`);
|
|
11571
11629
|
process.exit(2);
|
|
11572
11630
|
}
|
|
11573
11631
|
const plan = opts.plan?.trim();
|
|
11574
11632
|
if (plan && agent !== "claude") {
|
|
11575
|
-
|
|
11633
|
+
log34.error("--plan is only supported with --agent claude (plan mode is Claude-specific).");
|
|
11576
11634
|
process.exit(2);
|
|
11577
11635
|
}
|
|
11578
11636
|
const carryMode = opts.carry ?? "send";
|
|
11579
11637
|
if (carryMode !== "send" && carryMode !== "skip") {
|
|
11580
|
-
|
|
11638
|
+
log34.error(`--carry: expected 'send' or 'skip', got "${opts.carry ?? ""}"`);
|
|
11581
11639
|
process.exit(2);
|
|
11582
11640
|
}
|
|
11583
11641
|
let provider;
|
|
11584
11642
|
try {
|
|
11585
11643
|
provider = resolveForkProvider(providerArg, opts.provider);
|
|
11586
11644
|
} catch (err) {
|
|
11587
|
-
|
|
11645
|
+
log34.error(err instanceof Error ? err.message : String(err));
|
|
11588
11646
|
process.exit(2);
|
|
11589
11647
|
}
|
|
11590
11648
|
if (!opts.session?.trim()) {
|
|
11591
11649
|
if (agent === "claude") {
|
|
11592
11650
|
const envId = (process.env.CLAUDE_CODE_SESSION_ID ?? process.env.CLAUDE_SESSION_ID ?? "").trim();
|
|
11593
11651
|
if (envId) {
|
|
11594
|
-
const dir =
|
|
11652
|
+
const dir = join20(
|
|
11595
11653
|
homedir15(),
|
|
11596
11654
|
".claude",
|
|
11597
11655
|
"projects",
|
|
11598
11656
|
encodeClaudeProjectsDir(opts.workspace)
|
|
11599
11657
|
);
|
|
11600
|
-
if (
|
|
11658
|
+
if (existsSync10(join20(dir, `${envId}.jsonl`))) opts.session = envId;
|
|
11601
11659
|
}
|
|
11602
11660
|
} else if (agent === "codex") {
|
|
11603
11661
|
const envId = (process.env.CODEX_THREAD_ID ?? "").trim();
|
|
@@ -11608,7 +11666,7 @@ var forkCommand = new Command28("fork").description(
|
|
|
11608
11666
|
try {
|
|
11609
11667
|
sessionArgs = resolveSessionArgs(agent, opts);
|
|
11610
11668
|
} catch (err) {
|
|
11611
|
-
|
|
11669
|
+
log34.error(err instanceof Error ? err.message : String(err));
|
|
11612
11670
|
process.exit(2);
|
|
11613
11671
|
}
|
|
11614
11672
|
const subArgv = [
|
|
@@ -11633,20 +11691,20 @@ var forkCommand = new Command28("fork").description(
|
|
|
11633
11691
|
import { Command as Command32 } from "commander";
|
|
11634
11692
|
import { execa as execa8 } from "execa";
|
|
11635
11693
|
import {
|
|
11636
|
-
existsSync as
|
|
11694
|
+
existsSync as existsSync18,
|
|
11637
11695
|
lstatSync,
|
|
11638
|
-
mkdirSync as
|
|
11639
|
-
readFileSync as
|
|
11696
|
+
mkdirSync as mkdirSync12,
|
|
11697
|
+
readFileSync as readFileSync10,
|
|
11640
11698
|
rmSync as rmSync4,
|
|
11641
11699
|
symlinkSync as symlinkSync3,
|
|
11642
|
-
writeFileSync as
|
|
11700
|
+
writeFileSync as writeFileSync12
|
|
11643
11701
|
} from "fs";
|
|
11644
11702
|
import { homedir as homedir22 } from "os";
|
|
11645
|
-
import { dirname as dirname8, join as
|
|
11703
|
+
import { dirname as dirname8, join as join28, resolve as resolve5 } from "path";
|
|
11646
11704
|
|
|
11647
11705
|
// src/lib/source-checkout.ts
|
|
11648
|
-
import { existsSync as
|
|
11649
|
-
import { dirname as dirname2, join as
|
|
11706
|
+
import { existsSync as existsSync11 } from "fs";
|
|
11707
|
+
import { dirname as dirname2, join as join21, resolve as resolve4, sep } from "path";
|
|
11650
11708
|
import { fileURLToPath } from "url";
|
|
11651
11709
|
function resolveHostSkillsDir() {
|
|
11652
11710
|
const here = dirname2(fileURLToPath(import.meta.url));
|
|
@@ -11655,7 +11713,7 @@ function resolveHostSkillsDir() {
|
|
|
11655
11713
|
resolve4(here, "..", "..", "share", "host-skills")
|
|
11656
11714
|
];
|
|
11657
11715
|
for (const c of candidates) {
|
|
11658
|
-
if (
|
|
11716
|
+
if (existsSync11(c)) return c;
|
|
11659
11717
|
}
|
|
11660
11718
|
throw new Error(`could not locate bundled host skills; tried:
|
|
11661
11719
|
${candidates.join("\n ")}`);
|
|
@@ -11672,15 +11730,15 @@ function resolveDevRepoRoot() {
|
|
|
11672
11730
|
}
|
|
11673
11731
|
if (!isSourceCheckout(hostSkillsDir)) return null;
|
|
11674
11732
|
const root = resolve4(hostSkillsDir, "..", "..", "..", "..");
|
|
11675
|
-
const hasMarketplace =
|
|
11676
|
-
const hasPlugin =
|
|
11733
|
+
const hasMarketplace = existsSync11(join21(root, ".agents", "plugins", "marketplace.json"));
|
|
11734
|
+
const hasPlugin = existsSync11(join21(root, "plugins", "agentbox"));
|
|
11677
11735
|
return hasMarketplace && hasPlugin ? root : null;
|
|
11678
11736
|
}
|
|
11679
11737
|
|
|
11680
11738
|
// src/lib/doctor-checks.ts
|
|
11681
|
-
import { accessSync, constants as fsConstants, mkdirSync as
|
|
11739
|
+
import { accessSync, constants as fsConstants, existsSync as existsSync12, mkdirSync as mkdirSync6 } from "fs";
|
|
11682
11740
|
import { homedir as homedir16 } from "os";
|
|
11683
|
-
import { join as
|
|
11741
|
+
import { join as join22 } from "path";
|
|
11684
11742
|
import { execa as execa7 } from "execa";
|
|
11685
11743
|
var NODE_MIN_MAJOR = 20;
|
|
11686
11744
|
var NODE_MIN_MINOR = 10;
|
|
@@ -11720,9 +11778,9 @@ function checkPlatform() {
|
|
|
11720
11778
|
};
|
|
11721
11779
|
}
|
|
11722
11780
|
function checkAgentboxHome() {
|
|
11723
|
-
const dir =
|
|
11781
|
+
const dir = join22(homedir16(), ".agentbox");
|
|
11724
11782
|
try {
|
|
11725
|
-
|
|
11783
|
+
mkdirSync6(dir, { recursive: true });
|
|
11726
11784
|
accessSync(dir, fsConstants.W_OK);
|
|
11727
11785
|
return { label: "~/.agentbox", status: "ok", detail: dir };
|
|
11728
11786
|
} catch (err) {
|
|
@@ -11752,9 +11810,32 @@ async function checkSsh() {
|
|
|
11752
11810
|
hint: "install ssh \u2014 required for hetzner and cloud attach"
|
|
11753
11811
|
};
|
|
11754
11812
|
}
|
|
11813
|
+
async function onPath(bin) {
|
|
11814
|
+
const r = await execa7("which", [bin], { reject: false });
|
|
11815
|
+
if (r.exitCode !== 0) return null;
|
|
11816
|
+
const p = (r.stdout ?? "").trim();
|
|
11817
|
+
return p.length > 0 ? p : null;
|
|
11818
|
+
}
|
|
11819
|
+
async function checkSshfs() {
|
|
11820
|
+
const path = await onPath("sshfs");
|
|
11821
|
+
if (path) return { label: "sshfs", status: "ok", detail: path };
|
|
11822
|
+
const hint = process.platform === "darwin" ? "optional: `brew install macfuse sshfs` \u2014 needed for `agentbox open` (sshfs mount)" : "optional: install sshfs (e.g. `apt install sshfs`) \u2014 needed for `agentbox open` (sshfs mount)";
|
|
11823
|
+
return { label: "sshfs", status: "warn", detail: "not found", hint };
|
|
11824
|
+
}
|
|
11825
|
+
function checkMacfuse() {
|
|
11826
|
+
const present = existsSync12("/Library/Filesystems/macfuse.fs") || existsSync12("/Library/Filesystems/osxfuse.fs");
|
|
11827
|
+
return present ? { label: "macfuse", status: "ok", detail: "/Library/Filesystems/macfuse.fs" } : {
|
|
11828
|
+
label: "macfuse",
|
|
11829
|
+
status: "warn",
|
|
11830
|
+
detail: "not installed",
|
|
11831
|
+
hint: "optional: `brew install macfuse` \u2014 the FUSE backend `agentbox open` mounts through"
|
|
11832
|
+
};
|
|
11833
|
+
}
|
|
11755
11834
|
async function runSystemChecks() {
|
|
11756
|
-
const [git, ssh] = await Promise.all([checkGit(), checkSsh()]);
|
|
11757
|
-
|
|
11835
|
+
const [git, ssh, sshfs] = await Promise.all([checkGit(), checkSsh(), checkSshfs()]);
|
|
11836
|
+
const results = [checkNode(), checkPlatform(), checkAgentboxHome(), git, ssh, sshfs];
|
|
11837
|
+
if (process.platform === "darwin") results.push(checkMacfuse());
|
|
11838
|
+
return results;
|
|
11758
11839
|
}
|
|
11759
11840
|
var INTEGRATION_PROBE_TIMEOUT_MS = 1e4;
|
|
11760
11841
|
async function probeIntegrationBin(bin, args) {
|
|
@@ -11974,46 +12055,46 @@ function formatDetailed(groups) {
|
|
|
11974
12055
|
}
|
|
11975
12056
|
|
|
11976
12057
|
// src/lib/first-run.ts
|
|
11977
|
-
import { existsSync as
|
|
12058
|
+
import { existsSync as existsSync13, mkdirSync as mkdirSync7, writeFileSync as writeFileSync7 } from "fs";
|
|
11978
12059
|
import { homedir as homedir17 } from "os";
|
|
11979
|
-
import { dirname as dirname3, join as
|
|
12060
|
+
import { dirname as dirname3, join as join23 } from "path";
|
|
11980
12061
|
var MARKER_VERSION = 1;
|
|
11981
12062
|
function setupMarkerPath() {
|
|
11982
|
-
return
|
|
12063
|
+
return join23(homedir17(), ".agentbox", "setup-complete.json");
|
|
11983
12064
|
}
|
|
11984
12065
|
function isFirstRun() {
|
|
11985
|
-
return !
|
|
12066
|
+
return !existsSync13(setupMarkerPath());
|
|
11986
12067
|
}
|
|
11987
12068
|
function markSetupComplete(provider) {
|
|
11988
12069
|
const path = setupMarkerPath();
|
|
11989
|
-
|
|
12070
|
+
mkdirSync7(dirname3(path), { recursive: true });
|
|
11990
12071
|
const body = {
|
|
11991
12072
|
version: MARKER_VERSION,
|
|
11992
12073
|
completedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11993
12074
|
provider
|
|
11994
12075
|
};
|
|
11995
|
-
|
|
12076
|
+
writeFileSync7(path, JSON.stringify(body, null, 2) + "\n");
|
|
11996
12077
|
}
|
|
11997
12078
|
|
|
11998
12079
|
// src/lib/star-prompt.ts
|
|
11999
12080
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
12000
|
-
import { existsSync as
|
|
12081
|
+
import { existsSync as existsSync14, mkdirSync as mkdirSync8, readFileSync as readFileSync6, writeFileSync as writeFileSync8 } from "fs";
|
|
12001
12082
|
import { homedir as homedir18 } from "os";
|
|
12002
|
-
import { dirname as dirname4, join as
|
|
12003
|
-
var
|
|
12083
|
+
import { dirname as dirname4, join as join24 } from "path";
|
|
12084
|
+
var STATE_VERSION2 = 1;
|
|
12004
12085
|
var REPO = "madarco/agentbox";
|
|
12005
12086
|
var REPO_URL = `https://github.com/${REPO}`;
|
|
12006
|
-
var DEFAULT_STATE = { version:
|
|
12087
|
+
var DEFAULT_STATE = { version: STATE_VERSION2, installCount: 0, starred: false };
|
|
12007
12088
|
function starStatePath() {
|
|
12008
|
-
return
|
|
12089
|
+
return join24(homedir18(), ".agentbox", "star-prompt.json");
|
|
12009
12090
|
}
|
|
12010
12091
|
function readStarState() {
|
|
12011
12092
|
const path = starStatePath();
|
|
12012
|
-
if (!
|
|
12093
|
+
if (!existsSync14(path)) return { ...DEFAULT_STATE };
|
|
12013
12094
|
try {
|
|
12014
|
-
const parsed = JSON.parse(
|
|
12095
|
+
const parsed = JSON.parse(readFileSync6(path, "utf8"));
|
|
12015
12096
|
return {
|
|
12016
|
-
version:
|
|
12097
|
+
version: STATE_VERSION2,
|
|
12017
12098
|
installCount: typeof parsed.installCount === "number" ? parsed.installCount : 0,
|
|
12018
12099
|
starred: parsed.starred === true
|
|
12019
12100
|
};
|
|
@@ -12023,8 +12104,8 @@ function readStarState() {
|
|
|
12023
12104
|
}
|
|
12024
12105
|
function writeStarState(state) {
|
|
12025
12106
|
const path = starStatePath();
|
|
12026
|
-
|
|
12027
|
-
|
|
12107
|
+
mkdirSync8(dirname4(path), { recursive: true });
|
|
12108
|
+
writeFileSync8(path, JSON.stringify(state, null, 2) + "\n");
|
|
12028
12109
|
}
|
|
12029
12110
|
function ghReady() {
|
|
12030
12111
|
const r = spawnSync3("gh", ["auth", "status"], { stdio: "ignore" });
|
|
@@ -12070,16 +12151,16 @@ async function maybePromptStar(opts) {
|
|
|
12070
12151
|
}
|
|
12071
12152
|
|
|
12072
12153
|
// src/commands/install-cmux.ts
|
|
12073
|
-
import { intro as intro9, log as
|
|
12154
|
+
import { intro as intro9, log as log36, note as note3, outro as outro8 } from "@clack/prompts";
|
|
12074
12155
|
import { Command as Command29 } from "commander";
|
|
12075
|
-
import { existsSync as
|
|
12156
|
+
import { existsSync as existsSync15, mkdirSync as mkdirSync9, readFileSync as readFileSync7, renameSync as renameSync3, writeFileSync as writeFileSync9 } from "fs";
|
|
12076
12157
|
import { homedir as homedir19 } from "os";
|
|
12077
|
-
import { dirname as dirname5, join as
|
|
12158
|
+
import { dirname as dirname5, join as join25 } from "path";
|
|
12078
12159
|
var CONTROL_ID = "agentbox";
|
|
12079
12160
|
function cmuxDockPath(env = process.env) {
|
|
12080
12161
|
const xdg = env["XDG_CONFIG_HOME"];
|
|
12081
|
-
const base = xdg && xdg.length > 0 ? xdg :
|
|
12082
|
-
return
|
|
12162
|
+
const base = xdg && xdg.length > 0 ? xdg : join25(homedir19(), ".config");
|
|
12163
|
+
return join25(base, "cmux", "dock.json");
|
|
12083
12164
|
}
|
|
12084
12165
|
function upsertAgentboxControl(doc, opts) {
|
|
12085
12166
|
const controls = Array.isArray(doc.controls) ? doc.controls : [];
|
|
@@ -12109,14 +12190,14 @@ var installCmuxCommand = new Command29("cmux").description(
|
|
|
12109
12190
|
height: parseHeight(opts.height)
|
|
12110
12191
|
};
|
|
12111
12192
|
let doc = { controls: [] };
|
|
12112
|
-
if (
|
|
12113
|
-
const raw =
|
|
12193
|
+
if (existsSync15(dockPath)) {
|
|
12194
|
+
const raw = readFileSync7(dockPath, "utf8");
|
|
12114
12195
|
try {
|
|
12115
12196
|
const parsed = JSON.parse(raw);
|
|
12116
12197
|
if (parsed && typeof parsed === "object") doc = parsed;
|
|
12117
12198
|
} catch {
|
|
12118
12199
|
if (!opts.force) {
|
|
12119
|
-
|
|
12200
|
+
log36.error(
|
|
12120
12201
|
`existing dock config is not valid JSON: ${dockPath}
|
|
12121
12202
|
fix it by hand, or pass --force to back it up and write a fresh one`
|
|
12122
12203
|
);
|
|
@@ -12124,7 +12205,7 @@ fix it by hand, or pass --force to back it up and write a fresh one`
|
|
|
12124
12205
|
}
|
|
12125
12206
|
if (!opts.dryRun) {
|
|
12126
12207
|
renameSync3(dockPath, dockPath + ".bak");
|
|
12127
|
-
|
|
12208
|
+
log36.warn(`backed up unparseable dock config to ${dockPath}.bak`);
|
|
12128
12209
|
}
|
|
12129
12210
|
doc = { controls: [] };
|
|
12130
12211
|
}
|
|
@@ -12137,8 +12218,8 @@ fix it by hand, or pass --force to back it up and write a fresh one`
|
|
|
12137
12218
|
outro8(`would write ${dockPath}`);
|
|
12138
12219
|
return;
|
|
12139
12220
|
}
|
|
12140
|
-
|
|
12141
|
-
|
|
12221
|
+
mkdirSync9(dirname5(dockPath), { recursive: true });
|
|
12222
|
+
writeFileSync9(dockPath, json);
|
|
12142
12223
|
intro9("AgentBox cmux dock panel");
|
|
12143
12224
|
note3(
|
|
12144
12225
|
`Wrote ${dockPath}
|
|
@@ -12153,23 +12234,23 @@ To see it:
|
|
|
12153
12234
|
});
|
|
12154
12235
|
|
|
12155
12236
|
// src/commands/install-herdr.ts
|
|
12156
|
-
import { intro as intro10, log as
|
|
12237
|
+
import { intro as intro10, log as log37, note as note4, outro as outro9 } from "@clack/prompts";
|
|
12157
12238
|
import { Command as Command30, Option } from "commander";
|
|
12158
12239
|
import { spawnSync as spawnSync4 } from "child_process";
|
|
12159
|
-
import { chmodSync, existsSync as
|
|
12240
|
+
import { chmodSync, existsSync as existsSync16, mkdirSync as mkdirSync10, readFileSync as readFileSync8, writeFileSync as writeFileSync10 } from "fs";
|
|
12160
12241
|
import { homedir as homedir20 } from "os";
|
|
12161
|
-
import { dirname as dirname6, join as
|
|
12242
|
+
import { dirname as dirname6, join as join26 } from "path";
|
|
12162
12243
|
var PLUGIN_VERSION = "0.2.0";
|
|
12163
12244
|
function herdrPluginDir(env = process.env) {
|
|
12164
|
-
const home = env["AGENTBOX_HOME"] ??
|
|
12165
|
-
return
|
|
12245
|
+
const home = env["AGENTBOX_HOME"] ?? join26(homedir20(), ".agentbox");
|
|
12246
|
+
return join26(home, "herdr", "plugin");
|
|
12166
12247
|
}
|
|
12167
12248
|
function herdrConfigPath(env = process.env) {
|
|
12168
12249
|
const override = env["HERDR_CONFIG_PATH"];
|
|
12169
12250
|
if (override && override.length > 0) return override;
|
|
12170
12251
|
const xdg = env["XDG_CONFIG_HOME"];
|
|
12171
|
-
const base = xdg && xdg.length > 0 ? xdg :
|
|
12172
|
-
return
|
|
12252
|
+
const base = xdg && xdg.length > 0 ? xdg : join26(homedir20(), ".config");
|
|
12253
|
+
return join26(base, "herdr", "config.toml");
|
|
12173
12254
|
}
|
|
12174
12255
|
function herdrBinary(env = process.env) {
|
|
12175
12256
|
const b = env["HERDR_BIN_PATH"];
|
|
@@ -12285,15 +12366,15 @@ function escapeRe(s) {
|
|
|
12285
12366
|
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
12286
12367
|
}
|
|
12287
12368
|
function writeShim(dir) {
|
|
12288
|
-
const p =
|
|
12289
|
-
|
|
12369
|
+
const p = join26(dir, "agentbox-shim.sh");
|
|
12370
|
+
writeFileSync10(p, herdrShimContent(process.execPath, process.argv[1] ?? "agentbox"));
|
|
12290
12371
|
chmodSync(p, 493);
|
|
12291
12372
|
}
|
|
12292
12373
|
function applyKeybindings() {
|
|
12293
12374
|
const cfg = herdrConfigPath();
|
|
12294
|
-
const existing =
|
|
12295
|
-
|
|
12296
|
-
|
|
12375
|
+
const existing = existsSync16(cfg) ? readFileSync8(cfg, "utf8") : "";
|
|
12376
|
+
mkdirSync10(dirname6(cfg), { recursive: true });
|
|
12377
|
+
writeFileSync10(cfg, upsertHerdrKeybindings(existing, herdrKeybindingsBlock()));
|
|
12297
12378
|
spawnSync4(herdrBinary(), ["server", "reload-config"], { stdio: "ignore" });
|
|
12298
12379
|
return cfg;
|
|
12299
12380
|
}
|
|
@@ -12310,18 +12391,18 @@ var installHerdrCommand = new Command30("herdr").description(
|
|
|
12310
12391
|
return;
|
|
12311
12392
|
}
|
|
12312
12393
|
const dir = herdrPluginDir();
|
|
12313
|
-
const file =
|
|
12394
|
+
const file = join26(dir, "herdr-plugin.toml");
|
|
12314
12395
|
const cfgPath = herdrConfigPath();
|
|
12315
12396
|
if (opts.dryRun) {
|
|
12316
12397
|
intro10("agentbox install herdr (dry run)");
|
|
12317
12398
|
process.stdout.write(`# --- ${file} ---
|
|
12318
12399
|
${buildHerdrManifest()}
|
|
12319
12400
|
`);
|
|
12320
|
-
process.stdout.write(`# --- ${
|
|
12401
|
+
process.stdout.write(`# --- ${join26(dir, "build.sh")} ---
|
|
12321
12402
|
${herdrBuildScript()}
|
|
12322
12403
|
`);
|
|
12323
12404
|
process.stdout.write(
|
|
12324
|
-
`# --- ${
|
|
12405
|
+
`# --- ${join26(dir, "agentbox-shim.sh")} ---
|
|
12325
12406
|
${herdrShimContent(process.execPath, process.argv[1] ?? "agentbox")}
|
|
12326
12407
|
`
|
|
12327
12408
|
);
|
|
@@ -12331,10 +12412,10 @@ ${herdrKeybindingsBlock()}
|
|
|
12331
12412
|
outro9(`would write ${dir}/*, edit ${cfgPath}, and run \`herdr plugin link ${dir}\``);
|
|
12332
12413
|
return;
|
|
12333
12414
|
}
|
|
12334
|
-
|
|
12335
|
-
|
|
12336
|
-
const buildPath =
|
|
12337
|
-
|
|
12415
|
+
mkdirSync10(dir, { recursive: true });
|
|
12416
|
+
writeFileSync10(file, buildHerdrManifest());
|
|
12417
|
+
const buildPath = join26(dir, "build.sh");
|
|
12418
|
+
writeFileSync10(buildPath, herdrBuildScript());
|
|
12338
12419
|
chmodSync(buildPath, 493);
|
|
12339
12420
|
writeShim(dir);
|
|
12340
12421
|
const cfg = applyKeybindings();
|
|
@@ -12348,7 +12429,7 @@ ${herdrKeybindingsBlock()}
|
|
|
12348
12429
|
if (linked.status === 0) {
|
|
12349
12430
|
spawnSync4(bin, ["server", "reload-config"], { stdio: "ignore" });
|
|
12350
12431
|
} else {
|
|
12351
|
-
|
|
12432
|
+
log37.warn(
|
|
12352
12433
|
`could not run \`${bin} plugin link\` (is Herdr installed / running?).
|
|
12353
12434
|
Run it yourself: herdr plugin link ${dir} && herdr server reload-config`
|
|
12354
12435
|
);
|
|
@@ -12367,53 +12448,53 @@ Added shortcuts to ${cfg}
|
|
|
12367
12448
|
import { Command as Command31 } from "commander";
|
|
12368
12449
|
import { spawnSync as spawnSync5 } from "child_process";
|
|
12369
12450
|
import {
|
|
12370
|
-
existsSync as
|
|
12371
|
-
mkdirSync as
|
|
12372
|
-
readFileSync as
|
|
12451
|
+
existsSync as existsSync17,
|
|
12452
|
+
mkdirSync as mkdirSync11,
|
|
12453
|
+
readFileSync as readFileSync9,
|
|
12373
12454
|
readdirSync as readdirSync4,
|
|
12374
12455
|
rmSync as rmSync3,
|
|
12375
12456
|
symlinkSync as symlinkSync2,
|
|
12376
|
-
writeFileSync as
|
|
12457
|
+
writeFileSync as writeFileSync11
|
|
12377
12458
|
} from "fs";
|
|
12378
12459
|
import { homedir as homedir21 } from "os";
|
|
12379
|
-
import { dirname as dirname7, join as
|
|
12460
|
+
import { dirname as dirname7, join as join27 } from "path";
|
|
12380
12461
|
import { parse as parseToml } from "smol-toml";
|
|
12381
12462
|
var MARKETPLACE_SOURCE = "madarco/agentbox";
|
|
12382
12463
|
var MARKETPLACE_NAME = "agentbox";
|
|
12383
12464
|
var PLUGIN_NAME = "agentbox";
|
|
12384
12465
|
var PLUGIN_ID = `${PLUGIN_NAME}@${MARKETPLACE_NAME}`;
|
|
12385
|
-
var PLUGIN_BUNDLE_REL =
|
|
12466
|
+
var PLUGIN_BUNDLE_REL = join27("plugins", "agentbox");
|
|
12386
12467
|
function marketplaceSource(opts = {}) {
|
|
12387
12468
|
const devRoot = opts.noDev ? null : resolveDevRepoRoot();
|
|
12388
12469
|
return { source: devRoot ?? MARKETPLACE_SOURCE, devRoot };
|
|
12389
12470
|
}
|
|
12390
12471
|
function symlinkStagedSkills(devRoot, env = process.env) {
|
|
12391
12472
|
try {
|
|
12392
|
-
const pluginRoot =
|
|
12393
|
-
const bundle =
|
|
12473
|
+
const pluginRoot = join27(codexHomeDir(env), "plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME);
|
|
12474
|
+
const bundle = join27(devRoot, PLUGIN_BUNDLE_REL);
|
|
12394
12475
|
let versionDir;
|
|
12395
12476
|
try {
|
|
12396
12477
|
const manifest = JSON.parse(
|
|
12397
|
-
|
|
12478
|
+
readFileSync9(join27(bundle, ".codex-plugin", "plugin.json"), "utf8")
|
|
12398
12479
|
);
|
|
12399
|
-
if (manifest.version) versionDir =
|
|
12480
|
+
if (manifest.version) versionDir = join27(pluginRoot, manifest.version);
|
|
12400
12481
|
} catch {
|
|
12401
12482
|
}
|
|
12402
|
-
if (!versionDir || !
|
|
12403
|
-
const children =
|
|
12404
|
-
versionDir = children.length === 1 ?
|
|
12483
|
+
if (!versionDir || !existsSync17(versionDir)) {
|
|
12484
|
+
const children = existsSync17(pluginRoot) ? readdirSync4(pluginRoot) : [];
|
|
12485
|
+
versionDir = children.length === 1 ? join27(pluginRoot, children[0]) : void 0;
|
|
12405
12486
|
}
|
|
12406
|
-
if (!versionDir || !
|
|
12487
|
+
if (!versionDir || !existsSync17(versionDir)) {
|
|
12407
12488
|
return { linked: 0, error: "staged plugin dir not found" };
|
|
12408
12489
|
}
|
|
12409
|
-
const skillsDir =
|
|
12410
|
-
if (!
|
|
12490
|
+
const skillsDir = join27(bundle, "skills");
|
|
12491
|
+
if (!existsSync17(skillsDir)) return { linked: 0 };
|
|
12411
12492
|
let linked = 0;
|
|
12412
12493
|
for (const name of readdirSync4(skillsDir)) {
|
|
12413
|
-
const repoSkill =
|
|
12414
|
-
if (!
|
|
12415
|
-
const stagedSkill =
|
|
12416
|
-
|
|
12494
|
+
const repoSkill = join27(skillsDir, name, "SKILL.md");
|
|
12495
|
+
if (!existsSync17(repoSkill)) continue;
|
|
12496
|
+
const stagedSkill = join27(versionDir, "skills", name, "SKILL.md");
|
|
12497
|
+
mkdirSync11(dirname7(stagedSkill), { recursive: true });
|
|
12417
12498
|
rmSync3(stagedSkill, { force: true });
|
|
12418
12499
|
symlinkSync2(repoSkill, stagedSkill);
|
|
12419
12500
|
linked++;
|
|
@@ -12424,18 +12505,18 @@ function symlinkStagedSkills(devRoot, env = process.env) {
|
|
|
12424
12505
|
}
|
|
12425
12506
|
}
|
|
12426
12507
|
function syncBundleSkill(devRoot) {
|
|
12427
|
-
spawnSync5("node", [
|
|
12508
|
+
spawnSync5("node", [join27(devRoot, "scripts", "check-plugin-skill-sync.mjs"), "--fix"], {
|
|
12428
12509
|
cwd: devRoot,
|
|
12429
12510
|
stdio: "ignore"
|
|
12430
12511
|
});
|
|
12431
12512
|
}
|
|
12432
12513
|
function codexHomeDir(env = process.env) {
|
|
12433
12514
|
const override = env["CODEX_HOME"];
|
|
12434
|
-
return override && override.length > 0 ? override :
|
|
12515
|
+
return override && override.length > 0 ? override : join27(homedir21(), ".codex");
|
|
12435
12516
|
}
|
|
12436
12517
|
function currentMarketplaceType(env = process.env) {
|
|
12437
12518
|
try {
|
|
12438
|
-
const cfg =
|
|
12519
|
+
const cfg = readFileSync9(codexConfigPath(env), "utf8");
|
|
12439
12520
|
const parsed = parseToml(cfg);
|
|
12440
12521
|
const t = parsed.marketplaces?.[MARKETPLACE_NAME]?.source_type;
|
|
12441
12522
|
return typeof t === "string" ? t : null;
|
|
@@ -12444,7 +12525,7 @@ function currentMarketplaceType(env = process.env) {
|
|
|
12444
12525
|
}
|
|
12445
12526
|
}
|
|
12446
12527
|
function codexConfigPath(env = process.env) {
|
|
12447
|
-
return
|
|
12528
|
+
return join27(codexHomeDir(env), "config.toml");
|
|
12448
12529
|
}
|
|
12449
12530
|
function codexBinary(env = process.env) {
|
|
12450
12531
|
const b = env["CODEX_BIN_PATH"];
|
|
@@ -12520,7 +12601,7 @@ async function installCodexPlugin(opts = {}) {
|
|
|
12520
12601
|
configPath: cfgPath,
|
|
12521
12602
|
dev: devRoot !== null
|
|
12522
12603
|
};
|
|
12523
|
-
if (!
|
|
12604
|
+
if (!existsSync17(codexHomeDir(env)) || !codexCliAvailable(env)) {
|
|
12524
12605
|
return result;
|
|
12525
12606
|
}
|
|
12526
12607
|
result.ran = true;
|
|
@@ -12530,7 +12611,7 @@ async function installCodexPlugin(opts = {}) {
|
|
|
12530
12611
|
process.stdout.write(
|
|
12531
12612
|
`# would run: ${bin} plugin marketplace add ${source}
|
|
12532
12613
|
# would run: ${bin} plugin add ${PLUGIN_ID}
|
|
12533
|
-
` + (devRoot ? `# would symlink the staged skills/*/SKILL.md -> ${
|
|
12614
|
+
` + (devRoot ? `# would symlink the staged skills/*/SKILL.md -> ${join27(devRoot, PLUGIN_BUNDLE_REL, "skills")}/*
|
|
12534
12615
|
` : "") + `# --- appended to ${cfgPath} (only if not already configured) ---
|
|
12535
12616
|
${codexPluginEnableTable()}
|
|
12536
12617
|
`
|
|
@@ -12571,12 +12652,12 @@ ${codexPluginEnableTable()}
|
|
|
12571
12652
|
}
|
|
12572
12653
|
}
|
|
12573
12654
|
}
|
|
12574
|
-
const existing =
|
|
12655
|
+
const existing = existsSync17(cfgPath) ? readFileSync9(cfgPath, "utf8") : "";
|
|
12575
12656
|
const { text: text3, status } = upsertCodexPluginEnable(existing, { force: opts.force });
|
|
12576
12657
|
result.enableStatus = status;
|
|
12577
12658
|
if (text3 !== existing) {
|
|
12578
|
-
|
|
12579
|
-
|
|
12659
|
+
mkdirSync11(dirname7(cfgPath), { recursive: true });
|
|
12660
|
+
writeFileSync11(cfgPath, text3);
|
|
12580
12661
|
} else if (status === "user-disabled" && !opts.quiet) {
|
|
12581
12662
|
prompt_exports.log.info(
|
|
12582
12663
|
`AgentBox Codex plugin is present but disabled in ${cfgPath} \u2014 leaving it off. Re-run with --force (or set enabled = true) to use it.`
|
|
@@ -12692,21 +12773,21 @@ ${LOGO_L2}\x1B[0m` + SYNC_END2);
|
|
|
12692
12773
|
var LEGACY_INFO_MARKER = "Drive AgentBox from the host:";
|
|
12693
12774
|
function installTargets() {
|
|
12694
12775
|
const home = homedir22();
|
|
12695
|
-
const claudeSkills =
|
|
12776
|
+
const claudeSkills = join28(home, ".claude", "skills");
|
|
12696
12777
|
return [
|
|
12697
12778
|
{
|
|
12698
|
-
src:
|
|
12699
|
-
dest:
|
|
12779
|
+
src: join28("agentbox-info", "SKILL.md"),
|
|
12780
|
+
dest: join28(claudeSkills, "agentbox-info", "SKILL.md")
|
|
12700
12781
|
},
|
|
12701
12782
|
{
|
|
12702
|
-
src:
|
|
12703
|
-
dest:
|
|
12704
|
-
gateDir:
|
|
12783
|
+
src: join28("codex", "agentbox.md"),
|
|
12784
|
+
dest: join28(home, ".codex", "prompts", "agentbox.md"),
|
|
12785
|
+
gateDir: join28(home, ".codex")
|
|
12705
12786
|
},
|
|
12706
12787
|
{
|
|
12707
|
-
src:
|
|
12708
|
-
dest:
|
|
12709
|
-
gateDir:
|
|
12788
|
+
src: join28("opencode", "agentbox.md"),
|
|
12789
|
+
dest: join28(home, ".config", "opencode", "commands", "agentbox.md"),
|
|
12790
|
+
gateDir: join28(home, ".config", "opencode")
|
|
12710
12791
|
}
|
|
12711
12792
|
];
|
|
12712
12793
|
}
|
|
@@ -12718,11 +12799,11 @@ function isSymlink(target) {
|
|
|
12718
12799
|
}
|
|
12719
12800
|
}
|
|
12720
12801
|
function writableReason(target, force) {
|
|
12721
|
-
if (!
|
|
12802
|
+
if (!existsSync18(target)) {
|
|
12722
12803
|
if (isSymlink(target)) return "managed";
|
|
12723
12804
|
return "new";
|
|
12724
12805
|
}
|
|
12725
|
-
const existing =
|
|
12806
|
+
const existing = readFileSync10(target, "utf8");
|
|
12726
12807
|
if (existing.includes(MANAGED_SENTINEL) || existing.includes(LEGACY_INFO_MARKER)) {
|
|
12727
12808
|
return "managed";
|
|
12728
12809
|
}
|
|
@@ -12738,13 +12819,13 @@ function installHostSkills(opts = {}) {
|
|
|
12738
12819
|
const blocked = [];
|
|
12739
12820
|
let skipped = 0;
|
|
12740
12821
|
for (const t of installTargets()) {
|
|
12741
|
-
const src =
|
|
12742
|
-
if (!
|
|
12822
|
+
const src = join28(srcDir, t.src);
|
|
12823
|
+
if (!existsSync18(src)) {
|
|
12743
12824
|
if (!quiet) prompt_exports.log.warn(`bundled file missing (skipped): ${src}`);
|
|
12744
12825
|
skipped++;
|
|
12745
12826
|
continue;
|
|
12746
12827
|
}
|
|
12747
|
-
if (t.gateDir && !
|
|
12828
|
+
if (t.gateDir && !existsSync18(t.gateDir)) continue;
|
|
12748
12829
|
const reason = writableReason(t.dest, force);
|
|
12749
12830
|
if (reason === "skip") {
|
|
12750
12831
|
if (!quiet) prompt_exports.log.warn(`user-modified file at ${t.dest}, skipping; pass --force to overwrite`);
|
|
@@ -12757,13 +12838,13 @@ function installHostSkills(opts = {}) {
|
|
|
12757
12838
|
written.push(t.dest);
|
|
12758
12839
|
continue;
|
|
12759
12840
|
}
|
|
12760
|
-
|
|
12841
|
+
mkdirSync12(dirname8(t.dest), { recursive: true });
|
|
12761
12842
|
if (link) {
|
|
12762
12843
|
rmSync4(t.dest, { force: true });
|
|
12763
12844
|
symlinkSync3(resolve5(srcDir, t.src), t.dest);
|
|
12764
12845
|
} else {
|
|
12765
12846
|
if (isSymlink(t.dest)) rmSync4(t.dest, { force: true });
|
|
12766
|
-
|
|
12847
|
+
writeFileSync12(t.dest, readFileSync10(src, "utf8"));
|
|
12767
12848
|
}
|
|
12768
12849
|
written.push(t.dest);
|
|
12769
12850
|
}
|
|
@@ -12775,9 +12856,9 @@ async function installForkSkill(opts = {}) {
|
|
|
12775
12856
|
const dryRun = opts.dryRun === true;
|
|
12776
12857
|
const quiet = opts.quiet === true;
|
|
12777
12858
|
const srcDir = resolveHostSkillsDir();
|
|
12778
|
-
const src =
|
|
12779
|
-
const dest =
|
|
12780
|
-
if (!
|
|
12859
|
+
const src = join28(srcDir, "agentbox", "SKILL.md");
|
|
12860
|
+
const dest = join28(homedir22(), ".claude", "skills", "agentbox", "SKILL.md");
|
|
12861
|
+
if (!existsSync18(src)) {
|
|
12781
12862
|
if (!quiet) prompt_exports.log.warn(`bundled file missing (skipped): ${src}`);
|
|
12782
12863
|
return { written: [], skipped: 1, blocked: [], method: "skip" };
|
|
12783
12864
|
}
|
|
@@ -12792,7 +12873,7 @@ async function installForkSkill(opts = {}) {
|
|
|
12792
12873
|
return { written: [dest], skipped: 0, blocked: [], method: "dry-run" };
|
|
12793
12874
|
}
|
|
12794
12875
|
if (isSourceCheckout(srcDir)) {
|
|
12795
|
-
|
|
12876
|
+
mkdirSync12(dirname8(dest), { recursive: true });
|
|
12796
12877
|
rmSync4(dest, { force: true });
|
|
12797
12878
|
symlinkSync3(src, dest);
|
|
12798
12879
|
return { written: [dest], skipped: 0, blocked: [], method: "symlink" };
|
|
@@ -12815,16 +12896,16 @@ async function installForkSkill(opts = {}) {
|
|
|
12815
12896
|
],
|
|
12816
12897
|
{ timeout: 12e4 }
|
|
12817
12898
|
);
|
|
12818
|
-
if (
|
|
12899
|
+
if (existsSync18(dest)) return { written: [dest], skipped: 0, blocked: [], method: "npx" };
|
|
12819
12900
|
throw new Error("`skills add` reported success but wrote no skill file");
|
|
12820
12901
|
} catch (err) {
|
|
12821
12902
|
if (!quiet) {
|
|
12822
12903
|
const msg = err instanceof Error ? err.message : String(err);
|
|
12823
12904
|
prompt_exports.log.warn(`\`npx skills add\` failed (${msg}); copying the bundled fork skill instead`);
|
|
12824
12905
|
}
|
|
12825
|
-
|
|
12906
|
+
mkdirSync12(dirname8(dest), { recursive: true });
|
|
12826
12907
|
if (isSymlink(dest)) rmSync4(dest, { force: true });
|
|
12827
|
-
|
|
12908
|
+
writeFileSync12(dest, readFileSync10(src, "utf8"));
|
|
12828
12909
|
return { written: [dest], skipped: 0, blocked: [], method: "copy" };
|
|
12829
12910
|
}
|
|
12830
12911
|
}
|
|
@@ -12962,6 +13043,9 @@ pass \`agentbox install --skills-only --force\` to overwrite`
|
|
|
12962
13043
|
prompt_exports.log.warn(`Codex plugin setup skipped: ${err instanceof Error ? err.message : String(err)}`);
|
|
12963
13044
|
}
|
|
12964
13045
|
markSetupComplete(providerName);
|
|
13046
|
+
if (AGENTBOX_VERSION !== "0.0.0-dev" && readUpdateState().lastRunVersion === void 0) {
|
|
13047
|
+
writeUpdateState({ lastRunVersion: AGENTBOX_VERSION });
|
|
13048
|
+
}
|
|
12965
13049
|
const providerGroup = await runProviderChecks(providerName);
|
|
12966
13050
|
process.stdout.write(" " + formatCompact([sysGroup, providerGroup]) + "\n");
|
|
12967
13051
|
if (process.platform === "darwin") {
|
|
@@ -13036,7 +13120,7 @@ installCommand.addCommand(installTrayCommand);
|
|
|
13036
13120
|
|
|
13037
13121
|
// src/commands/plugin.ts
|
|
13038
13122
|
import { execFileSync } from "child_process";
|
|
13039
|
-
import { existsSync as
|
|
13123
|
+
import { existsSync as existsSync19, readFileSync as readFileSync11, statSync as statSync3 } from "fs";
|
|
13040
13124
|
import { createRequire } from "module";
|
|
13041
13125
|
import { dirname as dirname9, isAbsolute as isAbsolute3, resolve as resolve6 } from "path";
|
|
13042
13126
|
import { pathToFileURL } from "url";
|
|
@@ -13054,7 +13138,7 @@ function resolutionPaths() {
|
|
|
13054
13138
|
}
|
|
13055
13139
|
function resolvePackage(arg) {
|
|
13056
13140
|
let pkgDir;
|
|
13057
|
-
if ((arg.startsWith(".") || arg.startsWith("/") || isAbsolute3(arg)) &&
|
|
13141
|
+
if ((arg.startsWith(".") || arg.startsWith("/") || isAbsolute3(arg)) && existsSync19(arg)) {
|
|
13058
13142
|
pkgDir = statSync3(arg).isDirectory() ? resolve6(arg) : dirname9(resolve6(arg));
|
|
13059
13143
|
} else {
|
|
13060
13144
|
const req = createRequire(pathToFileURL(resolve6(process.cwd(), "noop.js")).href);
|
|
@@ -13075,7 +13159,7 @@ function resolvePackage(arg) {
|
|
|
13075
13159
|
}
|
|
13076
13160
|
pkgDir = dirname9(pkgJsonPath);
|
|
13077
13161
|
}
|
|
13078
|
-
const pkgJson = JSON.parse(
|
|
13162
|
+
const pkgJson = JSON.parse(readFileSync11(resolve6(pkgDir, "package.json"), "utf8"));
|
|
13079
13163
|
const entryRel = pickEntry(pkgJson);
|
|
13080
13164
|
return {
|
|
13081
13165
|
packageName: pkgJson.name ?? arg,
|
|
@@ -13493,10 +13577,16 @@ for (const op of GH_PR_OPS) {
|
|
|
13493
13577
|
var gitCommand = new Command35("git").description("Run git / gh pr operations against a box from the host").addCommand(pushCommand).addCommand(fetchCommand).addCommand(pullCommand).addCommand(checkoutCommand).addCommand(branchCommand).addCommand(statusCommand).addCommand(prCommand);
|
|
13494
13578
|
|
|
13495
13579
|
// src/commands/list.ts
|
|
13496
|
-
import { log as
|
|
13580
|
+
import { log as log41 } from "@clack/prompts";
|
|
13497
13581
|
import { Command as Command36 } from "commander";
|
|
13498
13582
|
import { pathToFileURL as pathToFileURL2 } from "url";
|
|
13499
13583
|
|
|
13584
|
+
// src/box-label.ts
|
|
13585
|
+
function boxLabel(box) {
|
|
13586
|
+
const custom = box.displayName?.trim();
|
|
13587
|
+
return custom ? custom : box.name;
|
|
13588
|
+
}
|
|
13589
|
+
|
|
13500
13590
|
// src/hyperlink.ts
|
|
13501
13591
|
import { supportsHyperlink } from "supports-hyperlinks";
|
|
13502
13592
|
var ESC2 = "\x1B";
|
|
@@ -13768,7 +13858,7 @@ function renderCmuxRows(boxes, color, width, linkNames = false) {
|
|
|
13768
13858
|
lines.push(projectHeader(projectLabel(root), color, width));
|
|
13769
13859
|
for (const b of group) {
|
|
13770
13860
|
const idx = b.projectIndex ? `${String(b.projectIndex)} ` : "";
|
|
13771
|
-
const disp = tailKeep(b
|
|
13861
|
+
const disp = tailKeep(boxLabel(b), Math.max(1, width - idx.length));
|
|
13772
13862
|
const name = linkNames ? hyperlink(disp, `agentbox://web/${b.id}`, void 0, true) : disp;
|
|
13773
13863
|
lines.push(`${idx}${name}`);
|
|
13774
13864
|
lines.push(" " + cmuxStatusCell(b, color));
|
|
@@ -13790,7 +13880,7 @@ function renderTable(boxes, stream) {
|
|
|
13790
13880
|
const wsCol = header.length - 1;
|
|
13791
13881
|
const lead = boxes.map((b) => [
|
|
13792
13882
|
plain(typeof b.projectIndex === "number" ? String(b.projectIndex) : ""),
|
|
13793
|
-
plain(b
|
|
13883
|
+
plain(boxLabel(b)),
|
|
13794
13884
|
plain(b.state),
|
|
13795
13885
|
// One column for every agent (claude / codex / opencode) — see agentSummary.
|
|
13796
13886
|
plain(agentSummary(b)),
|
|
@@ -13861,7 +13951,7 @@ var listCommand2 = withWatchOptions(
|
|
|
13861
13951
|
)
|
|
13862
13952
|
).action(async (opts) => {
|
|
13863
13953
|
if (opts.json && opts.watch) {
|
|
13864
|
-
|
|
13954
|
+
log41.error("cannot combine --json with --watch");
|
|
13865
13955
|
process.exit(2);
|
|
13866
13956
|
}
|
|
13867
13957
|
const all = opts.global ?? false;
|
|
@@ -13906,7 +13996,7 @@ var listCommand2 = withWatchOptions(
|
|
|
13906
13996
|
});
|
|
13907
13997
|
|
|
13908
13998
|
// src/commands/logs.ts
|
|
13909
|
-
import { log as
|
|
13999
|
+
import { log as log42 } from "@clack/prompts";
|
|
13910
14000
|
import { Command as Command37 } from "commander";
|
|
13911
14001
|
import { spawn as spawn6 } from "child_process";
|
|
13912
14002
|
var DAEMON_LOG_PATH = "/var/log/agentbox/ctl-daemon.log";
|
|
@@ -13928,9 +14018,9 @@ var logsCommand = new Command37("logs").description("Print recent log lines from
|
|
|
13928
14018
|
service = boxArg;
|
|
13929
14019
|
}
|
|
13930
14020
|
if (!service && !opts.daemon) {
|
|
13931
|
-
|
|
13932
|
-
|
|
13933
|
-
|
|
14021
|
+
log42.error("missing <service> argument");
|
|
14022
|
+
log42.info("usage: agentbox logs [box] <service> [-n N] [-f]");
|
|
14023
|
+
log42.info(" agentbox logs [box] --daemon [-n N] [-f]");
|
|
13934
14024
|
process.exit(2);
|
|
13935
14025
|
}
|
|
13936
14026
|
const box = await resolveBoxOrExit(idOrName);
|
|
@@ -13941,7 +14031,7 @@ var logsCommand = new Command37("logs").description("Print recent log lines from
|
|
|
13941
14031
|
if (!opts.follow) {
|
|
13942
14032
|
const proc = await provider.exec(box, args, { user: "vscode" });
|
|
13943
14033
|
if (proc.exitCode !== 0) {
|
|
13944
|
-
|
|
14034
|
+
log42.error(
|
|
13945
14035
|
`${opts.daemon ? "daemon log" : "agentbox-ctl logs"} failed: ${proc.stderr || proc.stdout}`
|
|
13946
14036
|
);
|
|
13947
14037
|
process.exit(1);
|
|
@@ -13997,12 +14087,12 @@ var logsCommand = new Command37("logs").description("Print recent log lines from
|
|
|
13997
14087
|
});
|
|
13998
14088
|
|
|
13999
14089
|
// src/commands/open.ts
|
|
14000
|
-
import { log as
|
|
14090
|
+
import { log as log43 } from "@clack/prompts";
|
|
14001
14091
|
import { execa as execa9 } from "execa";
|
|
14002
|
-
import { existsSync as
|
|
14092
|
+
import { existsSync as existsSync20, mkdirSync as mkdirSync13 } from "fs";
|
|
14003
14093
|
import { homedir as homedir23 } from "os";
|
|
14004
|
-
import { join as
|
|
14005
|
-
import { Command as Command38 } from "commander";
|
|
14094
|
+
import { join as join29 } from "path";
|
|
14095
|
+
import { Command as Command38, InvalidArgumentError as InvalidArgumentError3 } from "commander";
|
|
14006
14096
|
|
|
14007
14097
|
// src/commands/path.ts
|
|
14008
14098
|
async function runPath(box, opts) {
|
|
@@ -14024,23 +14114,72 @@ async function runPath(box, opts) {
|
|
|
14024
14114
|
}
|
|
14025
14115
|
|
|
14026
14116
|
// src/commands/open.ts
|
|
14027
|
-
|
|
14117
|
+
function parseOpenTarget(value) {
|
|
14118
|
+
if (value === "claude" || value === "codex" || value === "herdr" || value === "cmux" || value === "vscode" || value === "iterm2" || value === "finder") {
|
|
14119
|
+
return value;
|
|
14120
|
+
}
|
|
14121
|
+
throw new InvalidArgumentError3(
|
|
14122
|
+
`expected one of: claude, codex, herdr, cmux, vscode, iterm2, finder (got "${value}")`
|
|
14123
|
+
);
|
|
14124
|
+
}
|
|
14125
|
+
var openCommand = new Command38("open").description(
|
|
14126
|
+
"Mount a box /workspace via sshfs and reveal in Finder (default), or open it in a host app via --in"
|
|
14127
|
+
).argument(
|
|
14028
14128
|
"[box]",
|
|
14029
14129
|
"box ref: project index, id, id prefix, name, or container (default: the only box in this project)"
|
|
14030
|
-
).option("--no-refresh", "skip the rsync; open
|
|
14130
|
+
).option("--no-refresh", "legacy docker (no sshd) only: skip the rsync; open what's on disk").option(
|
|
14031
14131
|
"--include-node-modules",
|
|
14032
|
-
"include /workspace/node_modules in the
|
|
14033
|
-
).option("--path", "print the host
|
|
14132
|
+
"legacy docker (no sshd) only: include /workspace/node_modules in the export"
|
|
14133
|
+
).option("--path", "print the host mount path instead of launching Finder").option("--print", "alias of --path").option(
|
|
14034
14134
|
"--unmount",
|
|
14035
|
-
"
|
|
14036
|
-
).
|
|
14135
|
+
"unmount any existing sshfs mount for the box and exit"
|
|
14136
|
+
).option(
|
|
14137
|
+
"--in <app>",
|
|
14138
|
+
"open the box in a host app instead of Finder: codex | herdr | cmux | vscode | iterm2 | finder",
|
|
14139
|
+
parseOpenTarget
|
|
14140
|
+
).option("--targets", "print which --in apps are installed on this host and exit (no box needed)").option("--json", "with --targets: machine-readable output").action(async (idOrName, opts) => {
|
|
14037
14141
|
try {
|
|
14142
|
+
if (opts.targets) {
|
|
14143
|
+
const report = detectOpenTargets();
|
|
14144
|
+
process.stdout.write(opts.json ? JSON.stringify(report) + "\n" : renderTargets(report));
|
|
14145
|
+
return;
|
|
14146
|
+
}
|
|
14038
14147
|
const box = await resolveBoxOrExit(idOrName);
|
|
14039
|
-
|
|
14040
|
-
|
|
14041
|
-
await
|
|
14148
|
+
if (opts.unmount) {
|
|
14149
|
+
const mountRoot = join29(homedir23(), ".agentbox", "mounts", box.name);
|
|
14150
|
+
const ok = await tryUnmount(mountRoot);
|
|
14151
|
+
process.stdout.write(ok ? `unmounted ${mountRoot}
|
|
14152
|
+
` : `nothing mounted at ${mountRoot}
|
|
14153
|
+
`);
|
|
14154
|
+
return;
|
|
14155
|
+
}
|
|
14156
|
+
const app = opts.in ?? "finder";
|
|
14157
|
+
if (app === "claude") {
|
|
14158
|
+
await openInClaude(box);
|
|
14159
|
+
return;
|
|
14160
|
+
}
|
|
14161
|
+
if (app === "codex") {
|
|
14162
|
+
await openInCodex(box);
|
|
14163
|
+
return;
|
|
14164
|
+
}
|
|
14165
|
+
if (app === "herdr" || app === "cmux" || app === "iterm2") {
|
|
14166
|
+
await openInTerminalApp(box, app);
|
|
14167
|
+
return;
|
|
14168
|
+
}
|
|
14169
|
+
if (app === "vscode") {
|
|
14170
|
+
await runCodeOpen(box, {});
|
|
14171
|
+
return;
|
|
14172
|
+
}
|
|
14173
|
+
const providerName = box.provider ?? "docker";
|
|
14174
|
+
if (SSH_MOUNT_PROVIDERS.includes(providerName) && (providerName !== "docker" || box.sshEnabled)) {
|
|
14175
|
+
await runSshfsMount(box, opts);
|
|
14042
14176
|
return;
|
|
14043
14177
|
}
|
|
14178
|
+
if (providerName !== "docker") {
|
|
14179
|
+
throw new Error(
|
|
14180
|
+
`'agentbox open' live-mounts /workspace over sshfs, which ${providerName} boxes don't support (no SSH). Use 'agentbox download ${box.name}' to copy files to your host, or 'agentbox open ${box.name} --in vscode'.`
|
|
14181
|
+
);
|
|
14182
|
+
}
|
|
14044
14183
|
if (opts.path || opts.print) {
|
|
14045
14184
|
await runPath(box, {
|
|
14046
14185
|
refresh: opts.refresh,
|
|
@@ -14061,35 +14200,200 @@ var openCommand = new Command38("open").description("Open a box's /workspace in
|
|
|
14061
14200
|
handleLifecycleError(err);
|
|
14062
14201
|
}
|
|
14063
14202
|
});
|
|
14064
|
-
async function
|
|
14065
|
-
const
|
|
14066
|
-
if (
|
|
14067
|
-
|
|
14068
|
-
|
|
14069
|
-
|
|
14070
|
-
else process.stdout.write(`nothing mounted at ${mountRoot}
|
|
14071
|
-
`);
|
|
14072
|
-
return;
|
|
14073
|
-
}
|
|
14074
|
-
if (opts.path || opts.print) {
|
|
14075
|
-
process.stdout.write(`${mountRoot}
|
|
14076
|
-
`);
|
|
14077
|
-
return;
|
|
14203
|
+
async function ensurePersistentSshAlias(box, appLabel) {
|
|
14204
|
+
const providerName = box.provider ?? "docker";
|
|
14205
|
+
if (!PERSISTENT_SSH_PROVIDERS.includes(providerName)) {
|
|
14206
|
+
throw new Error(
|
|
14207
|
+
`'--in ${appLabel.toLowerCase()}' needs a box with a persistent SSH key \u2014 docker (localhost sshd) and Hetzner cloud boxes qualify (this box is '${providerName}'). Daytona uses a 60-min token that expires; Vercel/E2B have no SSH. Try 'agentbox open ${box.name} --in vscode'.`
|
|
14208
|
+
);
|
|
14078
14209
|
}
|
|
14079
|
-
|
|
14080
|
-
if (!sshfsBin) {
|
|
14210
|
+
if (providerName === "docker" && !box.sshEnabled) {
|
|
14081
14211
|
throw new Error(
|
|
14082
|
-
|
|
14212
|
+
`box '${box.name}' predates the in-box sshd, so it can't be added to ${appLabel} over SSH. Recreate the box (new docker boxes run sshd), or use 'agentbox open ${box.name} --in vscode'.`
|
|
14083
14213
|
);
|
|
14084
14214
|
}
|
|
14085
|
-
|
|
14086
|
-
|
|
14087
|
-
|
|
14088
|
-
|
|
14089
|
-
|
|
14090
|
-
|
|
14215
|
+
if (providerName === "docker") {
|
|
14216
|
+
let online = await bringDockerBoxOnline(box);
|
|
14217
|
+
if (!online.ssh) online = await resolveBoxOrExit(online.id);
|
|
14218
|
+
if (!online.ssh?.identityFile) {
|
|
14219
|
+
throw new Error(
|
|
14220
|
+
`box '${box.name}' has no SSH key on disk \u2014 its in-box sshd may have failed to start. Try 'agentbox start ${box.name}' and retry.`
|
|
14221
|
+
);
|
|
14222
|
+
}
|
|
14223
|
+
await syncAgentboxSshConfig();
|
|
14224
|
+
return agentboxAliasFor(online.name);
|
|
14091
14225
|
}
|
|
14092
|
-
|
|
14226
|
+
const provider = await providerForBox(box);
|
|
14227
|
+
const conn = await resolveCloudSshTarget(box, provider);
|
|
14228
|
+
if (!conn.identityFile) {
|
|
14229
|
+
throw new Error(
|
|
14230
|
+
`box '${box.name}' (provider '${providerName}') has no persistent SSH key, so it can't be added to ${appLabel} over SSH.`
|
|
14231
|
+
);
|
|
14232
|
+
}
|
|
14233
|
+
await recordBoxSsh(box.id, {
|
|
14234
|
+
host: conn.host,
|
|
14235
|
+
user: conn.user,
|
|
14236
|
+
identityFile: conn.identityFile
|
|
14237
|
+
});
|
|
14238
|
+
await syncAgentboxSshConfig();
|
|
14239
|
+
return conn.alias;
|
|
14240
|
+
}
|
|
14241
|
+
async function openInCodex(box) {
|
|
14242
|
+
const alias = await ensurePersistentSshAlias(box, "Codex");
|
|
14243
|
+
log43.info(`ssh alias '${alias}' written (Include'd from ~/.ssh/config)`);
|
|
14244
|
+
const url = codexAddUrl(alias);
|
|
14245
|
+
const opened = await execa9(hostOpenCommand(), [url], { reject: false });
|
|
14246
|
+
if (opened.exitCode !== 0) {
|
|
14247
|
+
log43.warn(
|
|
14248
|
+
`could not auto-open the Codex link (is Codex.app installed?): ${opened.stderr || `exit ${String(opened.exitCode)}`}`
|
|
14249
|
+
);
|
|
14250
|
+
const link = hyperlink(`Add ${alias} to Codex SSH`, url, process.stdout);
|
|
14251
|
+
process.stdout.write(`open manually: ${link}
|
|
14252
|
+
${url}
|
|
14253
|
+
`);
|
|
14254
|
+
process.exitCode = 1;
|
|
14255
|
+
return;
|
|
14256
|
+
}
|
|
14257
|
+
log43.success(`opening Codex \u2014 the SSH connection form is pre-filled with '${alias}'`);
|
|
14258
|
+
process.stdout.write(url + "\n");
|
|
14259
|
+
}
|
|
14260
|
+
async function openInClaude(box) {
|
|
14261
|
+
const alias = await ensurePersistentSshAlias(box, "Claude");
|
|
14262
|
+
log43.info(`ssh alias '${alias}' written (Include'd from ~/.ssh/config)`);
|
|
14263
|
+
const entry = claudeSshEntryFor(alias, box.name);
|
|
14264
|
+
upsertClaudeSshConfig(entry);
|
|
14265
|
+
log43.info(`added '${entry.name}' to Claude desktop's SSH connections (${claudeSettingsPath()})`);
|
|
14266
|
+
const opened = await execa9(hostOpenCommand(), ["-a", "Claude"], { reject: false });
|
|
14267
|
+
if (opened.exitCode !== 0) {
|
|
14268
|
+
log43.warn(
|
|
14269
|
+
`could not launch Claude (is Claude.app installed?): ${opened.stderr || `exit ${String(opened.exitCode)}`}`
|
|
14270
|
+
);
|
|
14271
|
+
process.stdout.write(
|
|
14272
|
+
`the SSH connection '${entry.name}' is saved \u2014 open Claude manually and pick it from the Environment dropdown
|
|
14273
|
+
`
|
|
14274
|
+
);
|
|
14275
|
+
process.exitCode = 1;
|
|
14276
|
+
return;
|
|
14277
|
+
}
|
|
14278
|
+
log43.success(`opening Claude \u2014 pick '${entry.name}' from the Environment dropdown`);
|
|
14279
|
+
}
|
|
14280
|
+
async function openInTerminalApp(box, host) {
|
|
14281
|
+
if ((box.provider ?? "docker") === "docker") {
|
|
14282
|
+
const insp = await inspectBox(box.id);
|
|
14283
|
+
if (insp.state === "paused") {
|
|
14284
|
+
log43.info("box is paused; unpausing");
|
|
14285
|
+
await unpauseBox(box.id);
|
|
14286
|
+
} else if (insp.state === "stopped") {
|
|
14287
|
+
log43.info("box is stopped; starting");
|
|
14288
|
+
await startBox(box.id);
|
|
14289
|
+
} else if (insp.state === "missing") {
|
|
14290
|
+
throw new Error(`box ${box.name} has no container; was it destroyed?`);
|
|
14291
|
+
}
|
|
14292
|
+
} else {
|
|
14293
|
+
const p = await providerForBox(box);
|
|
14294
|
+
const state = await p.probeState(box);
|
|
14295
|
+
if (state === "paused") {
|
|
14296
|
+
log43.info("box is paused; resuming");
|
|
14297
|
+
await p.resume(box);
|
|
14298
|
+
} else if (state === "stopped") {
|
|
14299
|
+
log43.info("box is stopped; starting");
|
|
14300
|
+
await p.start(box);
|
|
14301
|
+
} else if (state === "missing") {
|
|
14302
|
+
throw new Error(`cloud sandbox for ${box.name} is missing; was it deleted?`);
|
|
14303
|
+
}
|
|
14304
|
+
}
|
|
14305
|
+
const env = { ...process.env };
|
|
14306
|
+
if (host === "herdr" && !env["HERDR_SOCKET_PATH"]) {
|
|
14307
|
+
const sock = defaultHerdrSocketPath();
|
|
14308
|
+
if (!sock) {
|
|
14309
|
+
throw new Error(
|
|
14310
|
+
`Herdr socket not found (~/.config/herdr/herdr.sock). Is Herdr running? Set up the integration with 'agentbox install herdr'.`
|
|
14311
|
+
);
|
|
14312
|
+
}
|
|
14313
|
+
env["HERDR_SOCKET_PATH"] = sock;
|
|
14314
|
+
}
|
|
14315
|
+
if (host === "cmux") {
|
|
14316
|
+
const bin = resolveCmuxBinary();
|
|
14317
|
+
if (!bin) {
|
|
14318
|
+
throw new Error(
|
|
14319
|
+
`cmux CLI not found \u2014 not on PATH and no /Applications/cmux.app. Install cmux first.`
|
|
14320
|
+
);
|
|
14321
|
+
}
|
|
14322
|
+
env["CMUX_BUNDLED_CLI_PATH"] = bin;
|
|
14323
|
+
}
|
|
14324
|
+
const cwd = box.workspacePath || box.projectRoot || homedir23();
|
|
14325
|
+
const r = await spawnInNewTerminal({
|
|
14326
|
+
host,
|
|
14327
|
+
mode: "window",
|
|
14328
|
+
argv: [process.execPath, process.argv[1] ?? "agentbox", "attach", box.name, "--inline"],
|
|
14329
|
+
cwd,
|
|
14330
|
+
title: box.name,
|
|
14331
|
+
env,
|
|
14332
|
+
// A failed attach (e.g. no agent session yet) should leave a usable shell
|
|
14333
|
+
// in the new pane, not a closed one.
|
|
14334
|
+
keepShell: true
|
|
14335
|
+
});
|
|
14336
|
+
if (!r.launched) {
|
|
14337
|
+
if (host === "cmux" && /password|auth|denied|unauthorized|control/i.test(r.error ?? "")) {
|
|
14338
|
+
throw new Error(
|
|
14339
|
+
`cmux refused the control connection \u2014 external processes can't drive it by default. In cmux Settings enable socketControlMode "automation", or set a socket password (Settings, or CMUX_SOCKET_PASSWORD).
|
|
14340
|
+
${r.error ?? ""}`
|
|
14341
|
+
);
|
|
14342
|
+
}
|
|
14343
|
+
const hint = host === "herdr" ? " Is Herdr running? (`herdr status server`)" : host === "cmux" ? " Is cmux running?" : " Is iTerm2 installed?";
|
|
14344
|
+
throw new Error(`could not open in ${host}: ${r.error ?? "unknown error"}.${hint}`);
|
|
14345
|
+
}
|
|
14346
|
+
log43.success(`opened ${box.name} in a new ${host} ${host === "iterm2" ? "window" : "workspace"} (agentbox attach)`);
|
|
14347
|
+
}
|
|
14348
|
+
async function bringDockerBoxOnline(box) {
|
|
14349
|
+
const insp = await inspectBox(box.id);
|
|
14350
|
+
if (insp.state === "paused") {
|
|
14351
|
+
log43.info("box is paused; unpausing");
|
|
14352
|
+
await unpauseBox(box.id);
|
|
14353
|
+
} else if (insp.state === "stopped") {
|
|
14354
|
+
log43.info("box is stopped; starting");
|
|
14355
|
+
const started = await startBox(box.id);
|
|
14356
|
+
return started.record;
|
|
14357
|
+
} else if (insp.state === "missing") {
|
|
14358
|
+
throw new Error(`box ${box.name} has no container; was it destroyed?`);
|
|
14359
|
+
}
|
|
14360
|
+
return await refreshBoxSshd(box);
|
|
14361
|
+
}
|
|
14362
|
+
async function runSshfsMount(box, opts) {
|
|
14363
|
+
const mountRoot = join29(homedir23(), ".agentbox", "mounts", box.name);
|
|
14364
|
+
if (opts.path || opts.print) {
|
|
14365
|
+
process.stdout.write(`${mountRoot}
|
|
14366
|
+
`);
|
|
14367
|
+
return;
|
|
14368
|
+
}
|
|
14369
|
+
const sshfsBin = await locateBinary("sshfs");
|
|
14370
|
+
if (!sshfsBin) {
|
|
14371
|
+
throw new Error(
|
|
14372
|
+
"sshfs not found on PATH. Install with `brew install macfuse sshfs` (macOS) or your distro's package manager, then retry. `agentbox open` mounts the box /workspace via sshfs."
|
|
14373
|
+
);
|
|
14374
|
+
}
|
|
14375
|
+
let alias;
|
|
14376
|
+
if ((box.provider ?? "docker") === "docker") {
|
|
14377
|
+
let online = await bringDockerBoxOnline(box);
|
|
14378
|
+
if (!online.ssh) online = await resolveBoxOrExit(online.id);
|
|
14379
|
+
if (!online.ssh) {
|
|
14380
|
+
throw new Error(
|
|
14381
|
+
`box '${box.name}' has no SSH endpoint \u2014 its in-box sshd may have failed to start. Try 'agentbox start ${box.name}' and retry, or 'agentbox open ${box.name} --in vscode'.`
|
|
14382
|
+
);
|
|
14383
|
+
}
|
|
14384
|
+
await syncAgentboxSshConfig();
|
|
14385
|
+
alias = agentboxAliasFor(online.name);
|
|
14386
|
+
} else {
|
|
14387
|
+
const provider = await providerForBox(box);
|
|
14388
|
+
({ alias } = await ensureCloudSshAlias(box, provider));
|
|
14389
|
+
}
|
|
14390
|
+
if (!existsSync20(mountRoot)) {
|
|
14391
|
+
mkdirSync13(mountRoot, { recursive: true, mode: 493 });
|
|
14392
|
+
} else if (await isMounted(mountRoot)) {
|
|
14393
|
+
log43.info(`re-mounting (stale mount detected at ${mountRoot})`);
|
|
14394
|
+
await tryUnmount(mountRoot);
|
|
14395
|
+
}
|
|
14396
|
+
log43.info(`mounting ${alias}:/workspace at ${mountRoot}`);
|
|
14093
14397
|
const mount = await execa9(
|
|
14094
14398
|
sshfsBin,
|
|
14095
14399
|
[
|
|
@@ -14107,7 +14411,9 @@ async function runCloudOpen(box, opts) {
|
|
|
14107
14411
|
{ reject: false }
|
|
14108
14412
|
);
|
|
14109
14413
|
if (mount.exitCode !== 0) {
|
|
14110
|
-
|
|
14414
|
+
const err = `${mount.stderr || ""}${mount.stdout || ""}`;
|
|
14415
|
+
const macfuseHint = process.platform === "darwin" && /fuse|macfuse|load|not permitted|mount_macfuse/i.test(err) ? ` \u2014 is macFUSE installed and approved? Run 'brew install macfuse' (may need a reboot and approving the system extension in System Settings \u203A Privacy & Security), then retry.` : "";
|
|
14416
|
+
throw new Error(`sshfs mount failed (exit ${String(mount.exitCode)}): ${err}${macfuseHint}`);
|
|
14111
14417
|
}
|
|
14112
14418
|
await execa9(hostOpenCommand(), [mountRoot], { reject: false });
|
|
14113
14419
|
process.stdout.write(`opened ${mountRoot}
|
|
@@ -14320,7 +14626,7 @@ async function pruneCloud(provider, opts) {
|
|
|
14320
14626
|
|
|
14321
14627
|
// src/commands/queue.ts
|
|
14322
14628
|
import { readFile as readFile6, stat as stat6 } from "fs/promises";
|
|
14323
|
-
import { intro as intro13, log as
|
|
14629
|
+
import { intro as intro13, log as log45, outro as outro12 } from "@clack/prompts";
|
|
14324
14630
|
import { Command as Command41 } from "commander";
|
|
14325
14631
|
var TERMINAL_STATUSES = /* @__PURE__ */ new Set(["done", "failed", "cancelled"]);
|
|
14326
14632
|
var queueCommand = new Command41("queue").description("Inspect and manage background `agentbox claude|codex|opencode -i` jobs");
|
|
@@ -14329,8 +14635,8 @@ var queueListCommand = new Command41("list").description("List queued, running,
|
|
|
14329
14635
|
const cfg = await loadQueueConfig();
|
|
14330
14636
|
const visible = opts.all === true ? jobs : jobs.filter((j) => !TERMINAL_STATUSES.has(j.status));
|
|
14331
14637
|
if (visible.length === 0) {
|
|
14332
|
-
|
|
14333
|
-
|
|
14638
|
+
log45.info(opts.all ? "no queued jobs." : "no active queued jobs (--all to see terminal).");
|
|
14639
|
+
log45.info(`queue.maxConcurrent = ${String(cfg.maxConcurrent)} (queue.enabled=${String(cfg.enabled)})`);
|
|
14334
14640
|
return;
|
|
14335
14641
|
}
|
|
14336
14642
|
const rows = visible.map((j) => ({
|
|
@@ -14355,12 +14661,12 @@ var queueListCommand = new Command41("list").description("List queued, running,
|
|
|
14355
14661
|
headers.map((h, i) => pad4(String(r[h]), widths[i])).join(" ") + "\n"
|
|
14356
14662
|
);
|
|
14357
14663
|
}
|
|
14358
|
-
|
|
14664
|
+
log45.info(`queue.maxConcurrent = ${String(cfg.maxConcurrent)} (queue.enabled=${String(cfg.enabled)})`);
|
|
14359
14665
|
});
|
|
14360
14666
|
var queueShowCommand = new Command41("show").description("Dump a job manifest and tail its log").argument("<id>", "queue job id (from `agentbox queue list`)").option("--tail <n>", "lines of log to print (default: 50)", "50").action(async (id, opts) => {
|
|
14361
14667
|
const job = await readJob(id);
|
|
14362
14668
|
if (!job) {
|
|
14363
|
-
|
|
14669
|
+
log45.error(`no job with id ${id}`);
|
|
14364
14670
|
process.exit(1);
|
|
14365
14671
|
}
|
|
14366
14672
|
process.stdout.write(JSON.stringify(job, null, 2) + "\n");
|
|
@@ -14376,18 +14682,18 @@ var queueShowCommand = new Command41("show").description("Dump a job manifest an
|
|
|
14376
14682
|
process.stdout.write(slice.join("\n"));
|
|
14377
14683
|
if (!slice.join("\n").endsWith("\n")) process.stdout.write("\n");
|
|
14378
14684
|
} catch {
|
|
14379
|
-
|
|
14685
|
+
log45.info(`(no log at ${job.logPath} yet)`);
|
|
14380
14686
|
}
|
|
14381
14687
|
});
|
|
14382
14688
|
var queueCancelCommand = new Command41("cancel").description("Cancel a queued job; running jobs are NOT killed \u2014 use `agentbox destroy` instead").argument("<id>", "queue job id (from `agentbox queue list`)").action(async (id) => {
|
|
14383
14689
|
intro13(`Cancelling queue job ${id}...`);
|
|
14384
14690
|
const job = await readJob(id);
|
|
14385
14691
|
if (!job) {
|
|
14386
|
-
|
|
14692
|
+
log45.error(`no job with id ${id}`);
|
|
14387
14693
|
process.exit(1);
|
|
14388
14694
|
}
|
|
14389
14695
|
if (job.status !== "queued") {
|
|
14390
|
-
|
|
14696
|
+
log45.error(
|
|
14391
14697
|
`job ${id} is ${job.status}; cancel only flips 'queued' \u2192 'cancelled'.` + (job.status === "running" ? ` Use 'agentbox destroy ${job.boxName || id}' to stop the box.` : "")
|
|
14392
14698
|
);
|
|
14393
14699
|
process.exit(1);
|
|
@@ -14407,7 +14713,7 @@ var queueClearCommand = new Command41("clear").description("Sweep terminal-state
|
|
|
14407
14713
|
if (opts.all === true || opts.failed === true) targets.add("failed");
|
|
14408
14714
|
if (opts.all === true || opts.cancelled === true) targets.add("cancelled");
|
|
14409
14715
|
if (targets.size === 0) {
|
|
14410
|
-
|
|
14716
|
+
log45.error("pick at least one of: --done, --failed, --cancelled, --all");
|
|
14411
14717
|
process.exit(2);
|
|
14412
14718
|
}
|
|
14413
14719
|
const jobs = await loadQueue();
|
|
@@ -14417,7 +14723,7 @@ var queueClearCommand = new Command41("clear").description("Sweep terminal-state
|
|
|
14417
14723
|
await deleteJob(j.id);
|
|
14418
14724
|
removed += 1;
|
|
14419
14725
|
}
|
|
14420
|
-
|
|
14726
|
+
log45.success(`removed ${String(removed)} manifest${removed === 1 ? "" : "s"}`);
|
|
14421
14727
|
});
|
|
14422
14728
|
var QUEUE_WAIT_EVENTS = [
|
|
14423
14729
|
"new-box",
|
|
@@ -14434,7 +14740,7 @@ var queueWaitForCommand = new Command41("wait-for").description(
|
|
|
14434
14740
|
`Block until a queue / box event fires. <event> one of: ${QUEUE_WAIT_EVENTS.join(" | ")}.`
|
|
14435
14741
|
).argument("<event>", `target event: ${QUEUE_WAIT_EVENTS.join(" | ")}`).option("--box <ref>", "box ref (required for box-paused / box-running / box-stopped)").option("--job <id>", "queue job id (required for job-done)").option("--timeout <ms>", `wall-clock cap (default: ${String(DEFAULT_QUEUE_WAIT_TIMEOUT_MS)})`).option("--json", "emit a JSON envelope { matched, elapsedMs, ... }").action(async (eventRaw, opts) => {
|
|
14436
14742
|
if (!QUEUE_WAIT_EVENTS.includes(eventRaw)) {
|
|
14437
|
-
|
|
14743
|
+
log45.error(`unknown event '${eventRaw}' (one of: ${QUEUE_WAIT_EVENTS.join(", ")})`);
|
|
14438
14744
|
process.exit(2);
|
|
14439
14745
|
}
|
|
14440
14746
|
const event = eventRaw;
|
|
@@ -14454,11 +14760,11 @@ var queueWaitForCommand = new Command41("wait-for").description(
|
|
|
14454
14760
|
if (opts.json === true) {
|
|
14455
14761
|
process.stdout.write(JSON.stringify({ matched: false, event, elapsedMs }) + "\n");
|
|
14456
14762
|
} else {
|
|
14457
|
-
|
|
14763
|
+
log45.error(`'${event}' did not occur within ${String(timeoutMs)}ms`);
|
|
14458
14764
|
}
|
|
14459
14765
|
process.exit(1);
|
|
14460
14766
|
}
|
|
14461
|
-
|
|
14767
|
+
log45.error(err instanceof Error ? err.message : String(err));
|
|
14462
14768
|
process.exit(1);
|
|
14463
14769
|
}
|
|
14464
14770
|
});
|
|
@@ -14555,7 +14861,7 @@ function truncate(s, max) {
|
|
|
14555
14861
|
}
|
|
14556
14862
|
|
|
14557
14863
|
// src/commands/relay.ts
|
|
14558
|
-
import { log as
|
|
14864
|
+
import { log as log46, spinner as spinner10 } from "@clack/prompts";
|
|
14559
14865
|
import { Command as Command42 } from "commander";
|
|
14560
14866
|
async function rehydrateFromState() {
|
|
14561
14867
|
const state = await readState();
|
|
@@ -14651,7 +14957,7 @@ var restartSub2 = new Command42("restart").description("Stop then start the host
|
|
|
14651
14957
|
s2.stop(`relay running on ${ep.hostUrl}`);
|
|
14652
14958
|
} catch (err) {
|
|
14653
14959
|
s2.stop("relay start failed");
|
|
14654
|
-
|
|
14960
|
+
log46.warn(err instanceof Error ? err.message : String(err));
|
|
14655
14961
|
throw err;
|
|
14656
14962
|
}
|
|
14657
14963
|
} catch (err) {
|
|
@@ -14662,7 +14968,7 @@ var relayCommand = new Command42("relay").description("Manage the host relay pro
|
|
|
14662
14968
|
|
|
14663
14969
|
// src/commands/hub.ts
|
|
14664
14970
|
import { spawn as spawn7 } from "child_process";
|
|
14665
|
-
import { log as
|
|
14971
|
+
import { log as log47, spinner as spinner11 } from "@clack/prompts";
|
|
14666
14972
|
import { Command as Command43 } from "commander";
|
|
14667
14973
|
async function resolvePortlessEnabled() {
|
|
14668
14974
|
try {
|
|
@@ -14757,7 +15063,7 @@ var restartSub3 = new Command43("restart").description("Stop then start the hub"
|
|
|
14757
15063
|
if (opts.open !== false) openInBrowser2(ep.openUrl);
|
|
14758
15064
|
} catch (err) {
|
|
14759
15065
|
s2.stop("hub start failed");
|
|
14760
|
-
|
|
15066
|
+
log47.warn(err instanceof Error ? err.message : String(err));
|
|
14761
15067
|
throw err;
|
|
14762
15068
|
}
|
|
14763
15069
|
} catch (err) {
|
|
@@ -14769,13 +15075,13 @@ var hubCommand = new Command43("hub").description(
|
|
|
14769
15075
|
).addCommand(startSub3, { isDefault: true }).addCommand(statusSub3).addCommand(stopSub3).addCommand(restartSub3);
|
|
14770
15076
|
|
|
14771
15077
|
// src/commands/control-plane.ts
|
|
14772
|
-
import { isCancel as isCancel5, log as
|
|
15078
|
+
import { isCancel as isCancel5, log as log48, note as note7, select as select3, spinner as spinner12 } from "@clack/prompts";
|
|
14773
15079
|
import { Command as Command44 } from "commander";
|
|
14774
15080
|
import { spawn as spawn10 } from "child_process";
|
|
14775
|
-
import { existsSync as
|
|
15081
|
+
import { existsSync as existsSync21, readFileSync as readFileSync12 } from "fs";
|
|
14776
15082
|
import { chmod, mkdir as mkdir2, rm, writeFile as writeFile5 } from "fs/promises";
|
|
14777
15083
|
import { hostname, homedir as homedir25, tmpdir as tmpdir6 } from "os";
|
|
14778
|
-
import { join as
|
|
15084
|
+
import { join as join32 } from "path";
|
|
14779
15085
|
import { setTimeout as delay3 } from "timers/promises";
|
|
14780
15086
|
import { randomBytes as randomBytes3 } from "crypto";
|
|
14781
15087
|
|
|
@@ -14930,7 +15236,7 @@ async function runGitHubAppManifestFlow(opts) {
|
|
|
14930
15236
|
import { spawn as spawn9 } from "child_process";
|
|
14931
15237
|
import { mkdtempSync as mkdtempSync2, rmSync as rmSync5 } from "fs";
|
|
14932
15238
|
import { tmpdir as tmpdir5 } from "os";
|
|
14933
|
-
import { join as
|
|
15239
|
+
import { join as join30 } from "path";
|
|
14934
15240
|
|
|
14935
15241
|
// src/control-plane/github-fork.ts
|
|
14936
15242
|
import { spawn as spawn8 } from "child_process";
|
|
@@ -14994,7 +15300,7 @@ function isConnectError(msg) {
|
|
|
14994
15300
|
}
|
|
14995
15301
|
function provisionNeon(teamId, projectId, log60) {
|
|
14996
15302
|
return new Promise((resolve7) => {
|
|
14997
|
-
const work = mkdtempSync2(
|
|
15303
|
+
const work = mkdtempSync2(join30(tmpdir5(), "agentbox-neon-"));
|
|
14998
15304
|
const env = { ...process.env, VERCEL_PROJECT_ID: projectId, ...teamId ? { VERCEL_ORG_ID: teamId } : {} };
|
|
14999
15305
|
const child = spawn9("vercel", ["integration", "add", "neon", "--non-interactive"], {
|
|
15000
15306
|
cwd: work,
|
|
@@ -15167,7 +15473,7 @@ async function deployControlPlaneToVercel(opts) {
|
|
|
15167
15473
|
// src/control-plane/deploy-hetzner.ts
|
|
15168
15474
|
import { readFile as readFile7, writeFile as writeFile4 } from "fs/promises";
|
|
15169
15475
|
import { homedir as homedir24 } from "os";
|
|
15170
|
-
import { join as
|
|
15476
|
+
import { join as join31 } from "path";
|
|
15171
15477
|
async function runHetznerDeploy(opts) {
|
|
15172
15478
|
if (readHetznerCredStatus().source === "none") {
|
|
15173
15479
|
throw new Error("no HCLOUD_TOKEN configured \u2014 run `agentbox hetzner login` first");
|
|
@@ -15178,7 +15484,7 @@ async function runHetznerDeploy(opts) {
|
|
|
15178
15484
|
repoRef: opts.repoRef,
|
|
15179
15485
|
onLog: opts.log
|
|
15180
15486
|
});
|
|
15181
|
-
const deployPath =
|
|
15487
|
+
const deployPath = join31(homedir24(), ".agentbox", "control-plane", "deploy.json");
|
|
15182
15488
|
await writeFile4(
|
|
15183
15489
|
deployPath,
|
|
15184
15490
|
JSON.stringify({ provider: "hetzner", ...result }, null, 2) + "\n",
|
|
@@ -15219,10 +15525,10 @@ async function resolveHubAuthEnv() {
|
|
|
15219
15525
|
}
|
|
15220
15526
|
|
|
15221
15527
|
// src/commands/control-plane.ts
|
|
15222
|
-
var CP_DIR2 =
|
|
15223
|
-
var PEM_PATH =
|
|
15224
|
-
var ENV_PATH2 =
|
|
15225
|
-
var META_PATH2 =
|
|
15528
|
+
var CP_DIR2 = join32(homedir25(), ".agentbox", "control-plane");
|
|
15529
|
+
var PEM_PATH = join32(CP_DIR2, "github-app.pem");
|
|
15530
|
+
var ENV_PATH2 = join32(CP_DIR2, "control-plane.env");
|
|
15531
|
+
var META_PATH2 = join32(CP_DIR2, "control-plane.json");
|
|
15226
15532
|
var DEFAULT_DEPLOY_REPO = "madarco/agentbox";
|
|
15227
15533
|
var DEFAULT_DEPLOY_REF = "main";
|
|
15228
15534
|
async function applyControlPlaneUrl(url) {
|
|
@@ -15281,7 +15587,7 @@ AGENTBOX_RELAY_ADMIN_TOKEN=${adminToken}
|
|
|
15281
15587
|
JSON.stringify({ appId: app.appId, slug: app.slug, htmlUrl: app.htmlUrl, installUrl: app.installUrl }, null, 2) + "\n",
|
|
15282
15588
|
{ mode: 384 }
|
|
15283
15589
|
);
|
|
15284
|
-
|
|
15590
|
+
log48.success(`GitHub App ready. Deploy config written to ${ENV_PATH2} (0600).`);
|
|
15285
15591
|
const target = await resolveDeployTarget(opts.deploy);
|
|
15286
15592
|
let deployedUrl = null;
|
|
15287
15593
|
if (target !== "none") {
|
|
@@ -15315,7 +15621,7 @@ AGENTBOX_HUB_ADMIN_PASSWORD=${hubAuth.AGENTBOX_HUB_ADMIN_PASSWORD}
|
|
|
15315
15621
|
}
|
|
15316
15622
|
ds.stop(`deployed: ${deployedUrl}`);
|
|
15317
15623
|
} catch (e) {
|
|
15318
|
-
|
|
15624
|
+
log48.warn(`deploy to ${target} failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
15319
15625
|
printManualDeploy();
|
|
15320
15626
|
}
|
|
15321
15627
|
} else {
|
|
@@ -15323,13 +15629,13 @@ AGENTBOX_HUB_ADMIN_PASSWORD=${hubAuth.AGENTBOX_HUB_ADMIN_PASSWORD}
|
|
|
15323
15629
|
}
|
|
15324
15630
|
if (deployedUrl) {
|
|
15325
15631
|
const url = await applyControlPlaneUrl(deployedUrl);
|
|
15326
|
-
|
|
15632
|
+
log48.success(`Pointed the CLI at ${url} (relay.controlPlaneUrl).`);
|
|
15327
15633
|
const ok = await waitForHealthz(url, 6e4);
|
|
15328
|
-
|
|
15634
|
+
log48[ok ? "success" : "warn"](
|
|
15329
15635
|
ok ? `Control plane is healthy (${url}/healthz).` : `Could not confirm ${url}/healthz yet \u2014 check the deployment.`
|
|
15330
15636
|
);
|
|
15331
15637
|
}
|
|
15332
|
-
|
|
15638
|
+
log48.info(`Install the App on your repos: ${app.installUrl}`);
|
|
15333
15639
|
openInBrowser(app.installUrl);
|
|
15334
15640
|
} catch (err) {
|
|
15335
15641
|
handleLifecycleError(err);
|
|
@@ -15338,7 +15644,7 @@ AGENTBOX_HUB_ADMIN_PASSWORD=${hubAuth.AGENTBOX_HUB_ADMIN_PASSWORD}
|
|
|
15338
15644
|
async function resolveDeployTarget(flag) {
|
|
15339
15645
|
if (flag === "vercel" || flag === "hetzner" || flag === "none") return flag;
|
|
15340
15646
|
if (flag) {
|
|
15341
|
-
|
|
15647
|
+
log48.warn(`unknown --deploy "${flag}"; choose interactively`);
|
|
15342
15648
|
}
|
|
15343
15649
|
const choice = await select3({
|
|
15344
15650
|
message: "Deploy the control plane now?",
|
|
@@ -15353,7 +15659,7 @@ async function resolveDeployTarget(flag) {
|
|
|
15353
15659
|
return choice;
|
|
15354
15660
|
}
|
|
15355
15661
|
function printManualDeploy() {
|
|
15356
|
-
|
|
15662
|
+
log48.info(
|
|
15357
15663
|
[
|
|
15358
15664
|
"Deploy later with the written env:",
|
|
15359
15665
|
` Self-host: cd apps/hub && docker compose --env-file ${ENV_PATH2} up --build`,
|
|
@@ -15365,7 +15671,7 @@ function printManualDeploy() {
|
|
|
15365
15671
|
var setUrlSub = new Command44("set-url").description("Point boxes + the CLI at a deployed control plane (sets relay.controlPlaneUrl)").argument("<url>", "base URL of the deployed control plane, e.g. https://plane.example.com").action(async (url) => {
|
|
15366
15672
|
try {
|
|
15367
15673
|
const trimmed = await applyControlPlaneUrl(url);
|
|
15368
|
-
|
|
15674
|
+
log48.success(`Set relay.controlPlaneUrl = ${trimmed}`);
|
|
15369
15675
|
} catch (err) {
|
|
15370
15676
|
handleLifecycleError(err);
|
|
15371
15677
|
}
|
|
@@ -15375,19 +15681,19 @@ var unsetUrlSub = new Command44("unset-url").description("Stop using a control p
|
|
|
15375
15681
|
const g = await unsetConfigValue("global", "relay.controlPlaneUrl", process.cwd());
|
|
15376
15682
|
const p = await unsetConfigValue("project", "relay.controlPlaneUrl", process.cwd());
|
|
15377
15683
|
if (!g.existed && !p.existed) {
|
|
15378
|
-
|
|
15684
|
+
log48.info("No control plane was configured (relay.controlPlaneUrl not set).");
|
|
15379
15685
|
} else {
|
|
15380
15686
|
const where = [g.existed ? "global" : null, p.existed ? "project" : null].filter(Boolean).join(" + ");
|
|
15381
|
-
|
|
15687
|
+
log48.success(
|
|
15382
15688
|
`Removed relay.controlPlaneUrl (${where}). New cloud boxes now push through the host relay (your laptop must be on), and the GitHub-App repo-authorization prompt no longer fires.`
|
|
15383
15689
|
);
|
|
15384
15690
|
}
|
|
15385
|
-
if (
|
|
15691
|
+
if (existsSync21(CP_DIR2)) {
|
|
15386
15692
|
if (opts.purge) {
|
|
15387
15693
|
await rm(CP_DIR2, { recursive: true, force: true });
|
|
15388
|
-
|
|
15694
|
+
log48.success(`Purged this machine's control-plane credentials (${CP_DIR2}).`);
|
|
15389
15695
|
} else {
|
|
15390
|
-
|
|
15696
|
+
log48.info(`This machine's App metadata + admin token remain in ${CP_DIR2} (use --purge to delete).`);
|
|
15391
15697
|
}
|
|
15392
15698
|
}
|
|
15393
15699
|
} catch (err) {
|
|
@@ -15396,11 +15702,11 @@ var unsetUrlSub = new Command44("unset-url").description("Stop using a control p
|
|
|
15396
15702
|
});
|
|
15397
15703
|
var statusSub4 = new Command44("status").description("Check whether the configured control plane is reachable").option("--url <url>", "override the control-plane URL (default: relay.controlPlaneUrl)").option("--json", "emit JSON").action(async (opts) => {
|
|
15398
15704
|
try {
|
|
15399
|
-
const { loadEffectiveConfig: loadEffectiveConfig2 } = await import("./dist-
|
|
15705
|
+
const { loadEffectiveConfig: loadEffectiveConfig2 } = await import("./dist-2BTJQUJS.js");
|
|
15400
15706
|
const cfg = await loadEffectiveConfig2(process.cwd());
|
|
15401
15707
|
const url = (opts.url ?? cfg.effective.relay.controlPlaneUrl ?? "").replace(/\/$/, "");
|
|
15402
15708
|
if (!url) {
|
|
15403
|
-
|
|
15709
|
+
log48.error("No control plane configured. Run `agentbox control-plane set-url <url>` (or pass --url).");
|
|
15404
15710
|
process.exitCode = 1;
|
|
15405
15711
|
return;
|
|
15406
15712
|
}
|
|
@@ -15430,31 +15736,31 @@ var addSub = new Command44("add").description("Authorize the current project's g
|
|
|
15430
15736
|
const cfg = await loadEffectiveConfig(process.cwd());
|
|
15431
15737
|
const controlPlaneUrl = cfg.effective.relay.controlPlaneUrl;
|
|
15432
15738
|
if (!controlPlaneUrl) {
|
|
15433
|
-
|
|
15739
|
+
log48.error("No control plane configured. Run `agentbox control-plane set-url <url>` first.");
|
|
15434
15740
|
process.exitCode = 1;
|
|
15435
15741
|
return;
|
|
15436
15742
|
}
|
|
15437
15743
|
const ownerRepo = await resolveOwnerRepo(process.cwd());
|
|
15438
15744
|
if (!ownerRepo) {
|
|
15439
|
-
|
|
15745
|
+
log48.error("No git origin found here \u2014 `cd` into a project with a GitHub remote.");
|
|
15440
15746
|
process.exitCode = 1;
|
|
15441
15747
|
return;
|
|
15442
15748
|
}
|
|
15443
15749
|
const { owner, repo } = ownerRepo;
|
|
15444
15750
|
const installed = await checkRepoInstalled(owner, repo, controlPlaneUrl);
|
|
15445
15751
|
if (installed === true) {
|
|
15446
|
-
|
|
15752
|
+
log48.success(`${owner}/${repo} is already authorized on the GitHub App.`);
|
|
15447
15753
|
return;
|
|
15448
15754
|
}
|
|
15449
15755
|
const url = addRepoUrl(loadControlPlaneMeta());
|
|
15450
15756
|
if (!url) {
|
|
15451
|
-
|
|
15757
|
+
log48.error(
|
|
15452
15758
|
"No GitHub App metadata found locally. Run this from a machine that ran `control-plane setup`,\nor open your App settings on GitHub and add the repo manually."
|
|
15453
15759
|
);
|
|
15454
15760
|
process.exitCode = 1;
|
|
15455
15761
|
return;
|
|
15456
15762
|
}
|
|
15457
|
-
|
|
15763
|
+
log48.info(`Opening ${url} \u2014 select ${owner}/${repo}, then approve.`);
|
|
15458
15764
|
openInBrowser(url);
|
|
15459
15765
|
} catch (err) {
|
|
15460
15766
|
handleLifecycleError(err);
|
|
@@ -15462,8 +15768,8 @@ var addSub = new Command44("add").description("Authorize the current project's g
|
|
|
15462
15768
|
});
|
|
15463
15769
|
function loadControlPlaneEnv() {
|
|
15464
15770
|
if (process.env.GITHUB_APP_ID && process.env.GITHUB_APP_PRIVATE_KEY) return;
|
|
15465
|
-
if (!
|
|
15466
|
-
for (const line of
|
|
15771
|
+
if (!existsSync21(ENV_PATH2)) return;
|
|
15772
|
+
for (const line of readFileSync12(ENV_PATH2, "utf8").split("\n")) {
|
|
15467
15773
|
const m = /^([A-Z_]+)=(.*)$/.exec(line.trim());
|
|
15468
15774
|
if (m && !process.env[m[1]]) process.env[m[1]] = m[2];
|
|
15469
15775
|
}
|
|
@@ -15487,7 +15793,7 @@ var workerSub = new Command44("worker").description(
|
|
|
15487
15793
|
loadControlPlaneEnv();
|
|
15488
15794
|
const appCfg = loadGitHubAppConfig();
|
|
15489
15795
|
if (!appCfg) {
|
|
15490
|
-
|
|
15796
|
+
log48.error("No GitHub App configured. Run `agentbox control-plane setup` first.");
|
|
15491
15797
|
process.exitCode = 1;
|
|
15492
15798
|
return;
|
|
15493
15799
|
}
|
|
@@ -15512,7 +15818,7 @@ var workerSub = new Command44("worker").description(
|
|
|
15512
15818
|
const created = await p.create({ workspacePath, name, projectRoot: workspacePath, onLog });
|
|
15513
15819
|
return { id: created.record.id };
|
|
15514
15820
|
},
|
|
15515
|
-
tmpDir: (jobId) =>
|
|
15821
|
+
tmpDir: (jobId) => join32(tmpdir6(), `agentbox-cp-worker-${jobId}`),
|
|
15516
15822
|
cleanup: (dir) => rm(dir, { recursive: true, force: true }),
|
|
15517
15823
|
log: (line) => process.stdout.write(`agentbox-cp-worker: ${line}
|
|
15518
15824
|
`)
|
|
@@ -15544,7 +15850,7 @@ var controlPlaneCommand = new Command44("control-plane").description("EXPERIMENT
|
|
|
15544
15850
|
// src/commands/_run-queued-job.ts
|
|
15545
15851
|
import { Command as Command45 } from "commander";
|
|
15546
15852
|
import { stat as stat7 } from "fs/promises";
|
|
15547
|
-
import { join as
|
|
15853
|
+
import { join as join33 } from "path";
|
|
15548
15854
|
|
|
15549
15855
|
// src/lib/claude-login-run.ts
|
|
15550
15856
|
var URL_TIMEOUT_MS = 6e4;
|
|
@@ -15692,7 +15998,7 @@ async function runClaudeLogin(opts) {
|
|
|
15692
15998
|
// src/commands/_run-queued-job.ts
|
|
15693
15999
|
async function applySetupWizardPrompt(job, workspace, basePrompt) {
|
|
15694
16000
|
if (!job.setupWizard) return basePrompt;
|
|
15695
|
-
const hasYaml = await stat7(
|
|
16001
|
+
const hasYaml = await stat7(join33(workspace, "agentbox.yaml")).then(() => true).catch(() => false);
|
|
15696
16002
|
const setup = buildSetupInitialPrompt(workspace, hasYaml);
|
|
15697
16003
|
const rest = basePrompt.trim();
|
|
15698
16004
|
return rest ? `${setup}
|
|
@@ -15828,6 +16134,11 @@ async function runDockerJob(job, log60, onBoxCreated) {
|
|
|
15828
16134
|
if (!job.noAgent && job.agent === "claude-code") {
|
|
15829
16135
|
await ensureClaudeLoginFresh({ id: job.id, log: log60, image: cfg.effective.box.image, isCloud: false });
|
|
15830
16136
|
}
|
|
16137
|
+
const portlessEnabled = opts.portless ?? await resolvePortlessNonInteractive({
|
|
16138
|
+
engine: await detectEngine(),
|
|
16139
|
+
enabled: cfg.effective.portless.enabled,
|
|
16140
|
+
cwd: opts.workspace
|
|
16141
|
+
});
|
|
15831
16142
|
log60.write(`creating box for agent=${job.noAgent ? "none" : job.agent}`);
|
|
15832
16143
|
const result = await createBox({
|
|
15833
16144
|
workspacePath: opts.workspace,
|
|
@@ -15845,12 +16156,7 @@ async function runDockerJob(job, log60, onBoxCreated) {
|
|
|
15845
16156
|
withEnv: cfg.effective.box.withEnv,
|
|
15846
16157
|
vnc: { enabled: cfg.effective.box.vnc },
|
|
15847
16158
|
docker: { sharedCache: cfg.effective.box.dockerCacheShared },
|
|
15848
|
-
|
|
15849
|
-
// interactively, but they must still honor a resolved `portless.enabled`.
|
|
15850
|
-
// Explicit --portless / --no-portless on the job wins; otherwise fall back
|
|
15851
|
-
// to the effective config so a host that opted in gets its <name>.localhost
|
|
15852
|
-
// alias registered. Undefined (never opted in) still skips, as before.
|
|
15853
|
-
portless: opts.portless ?? cfg.effective.portless.enabled,
|
|
16159
|
+
portless: portlessEnabled,
|
|
15854
16160
|
portlessStateDir: cfg.effective.portless.stateDir || void 0,
|
|
15855
16161
|
resyncOnStart: opts.resync,
|
|
15856
16162
|
limits: resolveLimits(cfg.effective.box, opts),
|
|
@@ -15980,6 +16286,12 @@ async function runCloudJob(job, log60, onBoxCreated) {
|
|
|
15980
16286
|
});
|
|
15981
16287
|
const persisted = await readJob(job.id);
|
|
15982
16288
|
await writeJob({ ...job, boxId: result.record.id, login: persisted?.login });
|
|
16289
|
+
await autoWriteSshConfig(
|
|
16290
|
+
result.record,
|
|
16291
|
+
provider,
|
|
16292
|
+
cfg.effective.ssh.autoConfig,
|
|
16293
|
+
(m) => log60.write(m)
|
|
16294
|
+
);
|
|
15983
16295
|
if (job.noAgent) {
|
|
15984
16296
|
log60.write("no-agent box created; skipping agent session");
|
|
15985
16297
|
return;
|
|
@@ -16162,9 +16474,208 @@ var claudeLoginWorkerCommand = new Command47("_claude-login-worker").description
|
|
|
16162
16474
|
process.exit(result.ok ? 0 : 1);
|
|
16163
16475
|
});
|
|
16164
16476
|
|
|
16477
|
+
// src/commands/_post-update-refresh.ts
|
|
16478
|
+
import { Command as Command48 } from "commander";
|
|
16479
|
+
|
|
16480
|
+
// src/lib/post-update-refresh.ts
|
|
16481
|
+
async function maybeUpdateTray(say) {
|
|
16482
|
+
if (!trayInstalled()) return;
|
|
16483
|
+
const state = readUpdateState();
|
|
16484
|
+
const latestSha = remoteCheckFresh(state) && state.remoteCheck?.trayLatestSha !== void 0 ? state.remoteCheck.trayLatestSha : await fetchTraySidecarSha();
|
|
16485
|
+
const decision = decideTrayUpdate({
|
|
16486
|
+
installed: true,
|
|
16487
|
+
stampedSha: state.traySha,
|
|
16488
|
+
latestSha
|
|
16489
|
+
});
|
|
16490
|
+
if (!decision.update) {
|
|
16491
|
+
say(
|
|
16492
|
+
decision.reason === "no-latest-sha" ? "menu-bar app: release sha unavailable \u2014 skipped" : "menu-bar app already current"
|
|
16493
|
+
);
|
|
16494
|
+
return;
|
|
16495
|
+
}
|
|
16496
|
+
const res = await installTray({ quiet: true });
|
|
16497
|
+
say(
|
|
16498
|
+
res.ran ? "menu-bar app updated" : `menu-bar app not updated (${res.reason ?? "unknown"}) \u2014 run \`agentbox install tray\` manually`
|
|
16499
|
+
);
|
|
16500
|
+
}
|
|
16501
|
+
async function runPostUpdateRefresh(opts = {}) {
|
|
16502
|
+
const say = (msg) => {
|
|
16503
|
+
if (!opts.quiet) prompt_exports.log.info(msg);
|
|
16504
|
+
};
|
|
16505
|
+
const warn = (step, err) => {
|
|
16506
|
+
prompt_exports.log.warn(`${step} failed (${err instanceof Error ? err.message : String(err)}) \u2014 continuing`);
|
|
16507
|
+
};
|
|
16508
|
+
if (!opts.skipSkills) {
|
|
16509
|
+
try {
|
|
16510
|
+
const res = installHostSkills({ quiet: true });
|
|
16511
|
+
say(
|
|
16512
|
+
res.written.length > 0 ? `refreshed host skills (${String(res.written.length)} file(s))` : `host skills already current (${String(res.skipped)} skipped)`
|
|
16513
|
+
);
|
|
16514
|
+
if (res.blocked.length > 0) {
|
|
16515
|
+
prompt_exports.log.warn(
|
|
16516
|
+
`user-modified skill file(s) left in place: ${res.blocked.join(", ")} \u2014 run \`agentbox install --skills-only --force\` to overwrite`
|
|
16517
|
+
);
|
|
16518
|
+
}
|
|
16519
|
+
} catch (err) {
|
|
16520
|
+
warn("host skills refresh", err);
|
|
16521
|
+
}
|
|
16522
|
+
}
|
|
16523
|
+
try {
|
|
16524
|
+
const removed = await removeImage(DEFAULT_BOX_IMAGE);
|
|
16525
|
+
say(
|
|
16526
|
+
removed ? `removed image ${DEFAULT_BOX_IMAGE} (rebuilds on next create/claude)` : `image ${DEFAULT_BOX_IMAGE} not present (nothing to remove)`
|
|
16527
|
+
);
|
|
16528
|
+
} catch (err) {
|
|
16529
|
+
warn("box image removal", err);
|
|
16530
|
+
}
|
|
16531
|
+
try {
|
|
16532
|
+
const stop = await stopRelay();
|
|
16533
|
+
say(stop.stopped ? `stopped relay (pid ${String(stop.pid)})` : "relay was not running");
|
|
16534
|
+
const ep = await ensureRelay();
|
|
16535
|
+
say(`relay back up on ${ep.hostUrl}`);
|
|
16536
|
+
} catch (err) {
|
|
16537
|
+
warn("relay reload", err);
|
|
16538
|
+
}
|
|
16539
|
+
try {
|
|
16540
|
+
await maybeUpdateTray(say);
|
|
16541
|
+
} catch (err) {
|
|
16542
|
+
warn("menu-bar app update", err);
|
|
16543
|
+
}
|
|
16544
|
+
writeUpdateState({ lastRunVersion: AGENTBOX_VERSION });
|
|
16545
|
+
}
|
|
16546
|
+
|
|
16547
|
+
// src/commands/_post-update-refresh.ts
|
|
16548
|
+
var postUpdateRefreshCommand = new Command48("_post-update-refresh").description("internal: refresh skills, box image, relay, and tray after a package update").option("--skip-skills", "skip refreshing the host skill files").action(async (opts) => {
|
|
16549
|
+
try {
|
|
16550
|
+
await runPostUpdateRefresh({ skipSkills: opts.skipSkills });
|
|
16551
|
+
} catch (err) {
|
|
16552
|
+
handleLifecycleError(err);
|
|
16553
|
+
}
|
|
16554
|
+
});
|
|
16555
|
+
|
|
16556
|
+
// src/lib/update-check.ts
|
|
16557
|
+
import { readFile as readFile8 } from "fs/promises";
|
|
16558
|
+
|
|
16559
|
+
// src/exec-method.ts
|
|
16560
|
+
import { realpathSync } from "fs";
|
|
16561
|
+
function detectExecutionMethod(input) {
|
|
16562
|
+
const ua = input.userAgent ?? "";
|
|
16563
|
+
const argv1 = input.argv1 ?? "";
|
|
16564
|
+
if (argv1.includes("/_npx/") || argv1.includes("/.npm/_npx") || /\bnpx\//.test(ua)) {
|
|
16565
|
+
return "npx";
|
|
16566
|
+
}
|
|
16567
|
+
if (/\bpnpm\//.test(ua)) {
|
|
16568
|
+
return "pnpm";
|
|
16569
|
+
}
|
|
16570
|
+
if (/\bnpm\//.test(ua)) {
|
|
16571
|
+
return "npm";
|
|
16572
|
+
}
|
|
16573
|
+
let real = argv1;
|
|
16574
|
+
try {
|
|
16575
|
+
real = realpathSync(argv1);
|
|
16576
|
+
} catch {
|
|
16577
|
+
}
|
|
16578
|
+
if (real.includes("/pnpm/global/")) {
|
|
16579
|
+
return "pnpm";
|
|
16580
|
+
}
|
|
16581
|
+
if (real.includes("/lib/node_modules/")) {
|
|
16582
|
+
return "npm";
|
|
16583
|
+
}
|
|
16584
|
+
return "direct";
|
|
16585
|
+
}
|
|
16586
|
+
|
|
16587
|
+
// src/lib/semver-lite.ts
|
|
16588
|
+
var TRIPLET = /^(\d+)\.(\d+)\.(\d+)$/;
|
|
16589
|
+
function parseTriplet(v) {
|
|
16590
|
+
const m = TRIPLET.exec(v.trim());
|
|
16591
|
+
if (!m) return null;
|
|
16592
|
+
return [Number(m[1]), Number(m[2]), Number(m[3])];
|
|
16593
|
+
}
|
|
16594
|
+
function compareSemver(a, b) {
|
|
16595
|
+
const pa = parseTriplet(a);
|
|
16596
|
+
const pb = parseTriplet(b);
|
|
16597
|
+
if (!pa || !pb) return null;
|
|
16598
|
+
for (let i = 0; i < 3; i++) {
|
|
16599
|
+
const ai = pa[i];
|
|
16600
|
+
const bi = pb[i];
|
|
16601
|
+
if (ai < bi) return -1;
|
|
16602
|
+
if (ai > bi) return 1;
|
|
16603
|
+
}
|
|
16604
|
+
return 0;
|
|
16605
|
+
}
|
|
16606
|
+
function isNewer(latest, current) {
|
|
16607
|
+
if (latest === void 0) return false;
|
|
16608
|
+
return compareSemver(latest, current) === 1;
|
|
16609
|
+
}
|
|
16610
|
+
|
|
16611
|
+
// src/lib/update-check.ts
|
|
16612
|
+
var PKG = "@madarco/agentbox";
|
|
16613
|
+
var REGISTRY_URL = `https://registry.npmjs.org/${PKG}/latest`;
|
|
16614
|
+
function nudgeEligible(method, version) {
|
|
16615
|
+
return version !== "0.0.0-dev" && (method === "npm" || method === "pnpm");
|
|
16616
|
+
}
|
|
16617
|
+
async function updateCheckEnabled() {
|
|
16618
|
+
try {
|
|
16619
|
+
const cfg = await loadEffectiveConfig(process.cwd());
|
|
16620
|
+
return cfg.effective.update.check;
|
|
16621
|
+
} catch {
|
|
16622
|
+
try {
|
|
16623
|
+
const raw = await readFile8(GLOBAL_CONFIG_FILE, "utf8");
|
|
16624
|
+
return parseUserConfig(raw, GLOBAL_CONFIG_FILE).update?.check ?? true;
|
|
16625
|
+
} catch (err) {
|
|
16626
|
+
return err.code === "ENOENT";
|
|
16627
|
+
}
|
|
16628
|
+
}
|
|
16629
|
+
}
|
|
16630
|
+
async function fetchNpmLatest() {
|
|
16631
|
+
try {
|
|
16632
|
+
const res = await fetch(REGISTRY_URL, { signal: AbortSignal.timeout(3e3) });
|
|
16633
|
+
if (!res.ok) return void 0;
|
|
16634
|
+
const body = await res.json();
|
|
16635
|
+
return typeof body.version === "string" ? body.version : void 0;
|
|
16636
|
+
} catch {
|
|
16637
|
+
return void 0;
|
|
16638
|
+
}
|
|
16639
|
+
}
|
|
16640
|
+
function maybeStartRemoteCheck() {
|
|
16641
|
+
const state = readUpdateState();
|
|
16642
|
+
if (remoteCheckFresh(state)) return null;
|
|
16643
|
+
const method = detectExecutionMethod({
|
|
16644
|
+
userAgent: process.env.npm_config_user_agent,
|
|
16645
|
+
argv1: process.argv[1]
|
|
16646
|
+
});
|
|
16647
|
+
const run = async () => {
|
|
16648
|
+
let npmLatest;
|
|
16649
|
+
let trayLatestSha;
|
|
16650
|
+
if (await updateCheckEnabled()) {
|
|
16651
|
+
[npmLatest, trayLatestSha] = await Promise.all([
|
|
16652
|
+
nudgeEligible(method, AGENTBOX_VERSION) ? fetchNpmLatest() : Promise.resolve(void 0),
|
|
16653
|
+
trayInstalled() ? fetchTraySidecarSha() : Promise.resolve(void 0)
|
|
16654
|
+
]);
|
|
16655
|
+
}
|
|
16656
|
+
const prev = readUpdateState().remoteCheck;
|
|
16657
|
+
npmLatest ??= prev?.npmLatest;
|
|
16658
|
+
trayLatestSha ??= prev?.trayLatestSha;
|
|
16659
|
+
writeUpdateState({
|
|
16660
|
+
remoteCheck: {
|
|
16661
|
+
checkedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
16662
|
+
...npmLatest !== void 0 ? { npmLatest } : {},
|
|
16663
|
+
...trayLatestSha !== void 0 ? { trayLatestSha } : {}
|
|
16664
|
+
}
|
|
16665
|
+
});
|
|
16666
|
+
};
|
|
16667
|
+
return run().catch(() => void 0);
|
|
16668
|
+
}
|
|
16669
|
+
function nudgeMessage(state, method, version = AGENTBOX_VERSION) {
|
|
16670
|
+
if (!nudgeEligible(method, version)) return null;
|
|
16671
|
+
const latest = state.remoteCheck?.npmLatest;
|
|
16672
|
+
if (!isNewer(latest, version)) return null;
|
|
16673
|
+
return `a newer agentbox (${latest}) is available \u2014 run \`agentbox self-update\``;
|
|
16674
|
+
}
|
|
16675
|
+
|
|
16165
16676
|
// src/commands/herdr.ts
|
|
16166
16677
|
import { spawnSync as spawnSync6 } from "child_process";
|
|
16167
|
-
import { Command as
|
|
16678
|
+
import { Command as Command49 } from "commander";
|
|
16168
16679
|
function parseHerdrLink(uri) {
|
|
16169
16680
|
if (!uri) return null;
|
|
16170
16681
|
const m = uri.match(/^agentbox:\/\/([^/]+)\/(.+)$/);
|
|
@@ -16190,7 +16701,7 @@ function herdrContextCwd(env = process.env) {
|
|
|
16190
16701
|
}
|
|
16191
16702
|
return process.cwd();
|
|
16192
16703
|
}
|
|
16193
|
-
var newCommand = new
|
|
16704
|
+
var newCommand = new Command49("new").description("Open a new box session in a fresh Herdr tab (used by the plugin shortcut)").option("--agent <agent>", "agent to launch (claude|codex|opencode)", "claude").action(async (opts) => {
|
|
16194
16705
|
const agent = opts.agent ?? "claude";
|
|
16195
16706
|
const cwd = herdrContextCwd();
|
|
16196
16707
|
const r = await spawnInNewTerminal({
|
|
@@ -16203,7 +16714,7 @@ var newCommand = new Command48("new").description("Open a new box session in a f
|
|
|
16203
16714
|
if (r.launched) process.stdout.write(r.note + "\n");
|
|
16204
16715
|
else if (r.error) process.stderr.write(r.error + "\n");
|
|
16205
16716
|
});
|
|
16206
|
-
var linkCommand = new
|
|
16717
|
+
var linkCommand = new Command49("link").description("Handle a Ctrl+click on an agentbox:// link (used by the plugin link handler)").argument("[uri]", "the clicked URI; defaults to $HERDR_PLUGIN_CLICKED_URL").action(async (uriArg) => {
|
|
16207
16718
|
const link = parseHerdrLink(uriArg ?? process.env["HERDR_PLUGIN_CLICKED_URL"]);
|
|
16208
16719
|
if (!link) return;
|
|
16209
16720
|
if (link.verb !== "web") return;
|
|
@@ -16236,16 +16747,16 @@ var linkCommand = new Command48("link").description("Handle a Ctrl+click on an a
|
|
|
16236
16747
|
sound: "request"
|
|
16237
16748
|
});
|
|
16238
16749
|
});
|
|
16239
|
-
var herdrCommand = new
|
|
16750
|
+
var herdrCommand = new Command49("herdr").description("Internal: Herdr plugin entry points (see `agentbox install herdr`)").addCommand(newCommand).addCommand(linkCommand);
|
|
16240
16751
|
|
|
16241
16752
|
// src/commands/recover.ts
|
|
16242
16753
|
import { homedir as homedir26 } from "os";
|
|
16243
|
-
import { join as
|
|
16754
|
+
import { join as join34 } from "path";
|
|
16244
16755
|
import { access as access3 } from "fs/promises";
|
|
16245
16756
|
import { isCancel as isCancel6, log as log50, select as select4 } from "@clack/prompts";
|
|
16246
|
-
import { Command as
|
|
16757
|
+
import { Command as Command50 } from "commander";
|
|
16247
16758
|
function hetznerKeyPath(sandboxId) {
|
|
16248
|
-
return
|
|
16759
|
+
return join34(homedir26(), ".agentbox", "boxes", sandboxId, "ssh", "id_ed25519");
|
|
16249
16760
|
}
|
|
16250
16761
|
async function fileExists2(path) {
|
|
16251
16762
|
try {
|
|
@@ -16394,7 +16905,7 @@ async function adoptUnknownBox(provider, ref) {
|
|
|
16394
16905
|
);
|
|
16395
16906
|
return record;
|
|
16396
16907
|
}
|
|
16397
|
-
var recoverCommand = new
|
|
16908
|
+
var recoverCommand = new Command50("recover").description(
|
|
16398
16909
|
"Reconnect to an already-running box without power-cycling it: ensure the relay is up, re-open the host transport (Hetzner SSH tunnel) + portless aliases, re-register with the relay, relaunch the agent it was running, and attach. With --all, recover every box in state. With --provider <p> --adopt [ref], first rebuild local state for a box created elsewhere."
|
|
16399
16910
|
).argument(
|
|
16400
16911
|
"[box]",
|
|
@@ -16457,7 +16968,7 @@ var recoverCommand = new Command49("recover").description(
|
|
|
16457
16968
|
// src/commands/screen.ts
|
|
16458
16969
|
import { spawnSync as spawnSync7 } from "child_process";
|
|
16459
16970
|
import { log as log51 } from "@clack/prompts";
|
|
16460
|
-
import { Command as
|
|
16971
|
+
import { Command as Command51 } from "commander";
|
|
16461
16972
|
var SIGNED_URL_TTL_MIN = 1;
|
|
16462
16973
|
var SIGNED_URL_TTL_MAX = 86400;
|
|
16463
16974
|
function parseTtlOrExit(raw) {
|
|
@@ -16470,7 +16981,7 @@ function parseTtlOrExit(raw) {
|
|
|
16470
16981
|
}
|
|
16471
16982
|
return n;
|
|
16472
16983
|
}
|
|
16473
|
-
var screenCommand = new
|
|
16984
|
+
var screenCommand = new Command51("screen").description("Open a box's VNC (noVNC) viewer in the browser (auto-unpause/start)").argument(
|
|
16474
16985
|
"[box]",
|
|
16475
16986
|
"box ref: project index, id, id prefix, name, or container (default: the only box in this project)"
|
|
16476
16987
|
).option("--print", "print the URL to stdout instead of launching the browser").option("--loopback", "docker only: use the 127.0.0.1 URL instead of the OrbStack .orb.local URL").option(
|
|
@@ -16578,7 +17089,7 @@ var screenCommand = new Command50("screen").description("Open a box's VNC (noVNC
|
|
|
16578
17089
|
|
|
16579
17090
|
// src/commands/services.ts
|
|
16580
17091
|
import { log as log52 } from "@clack/prompts";
|
|
16581
|
-
import { Command as
|
|
17092
|
+
import { Command as Command52 } from "commander";
|
|
16582
17093
|
async function liveStatus(provider, box) {
|
|
16583
17094
|
const r = await boxServicesStatusRaw(provider, box).catch(() => null);
|
|
16584
17095
|
if (!r || r.exitCode !== 0) return null;
|
|
@@ -16588,7 +17099,7 @@ async function liveStatus(provider, box) {
|
|
|
16588
17099
|
return null;
|
|
16589
17100
|
}
|
|
16590
17101
|
}
|
|
16591
|
-
var listCommand3 = new
|
|
17102
|
+
var listCommand3 = new Command52("list").description("List the box's services with their live state (running / ready / crashed / \u2026)").argument("[box]", "box ref (default: the only box in this project)").option("--json", "print the raw live status (services, tasks, ports) as JSON").action(async (idOrName, opts) => {
|
|
16592
17103
|
try {
|
|
16593
17104
|
const box = await resolveBoxOrExit(idOrName);
|
|
16594
17105
|
const provider = await providerForBox(box);
|
|
@@ -16614,7 +17125,7 @@ var listCommand3 = new Command51("list").description("List the box's services wi
|
|
|
16614
17125
|
handleLifecycleError(err);
|
|
16615
17126
|
}
|
|
16616
17127
|
});
|
|
16617
|
-
var restartCommand = new
|
|
17128
|
+
var restartCommand = new Command52("restart").description("Restart one service, or every service when no name is given").argument("[box]", "box ref (default: the only box in this project)").argument("[name]", "service to restart (omit to restart all)").action(async (idOrName, name) => {
|
|
16618
17129
|
try {
|
|
16619
17130
|
const { box, shifted } = await resolveBoxOrShift(idOrName);
|
|
16620
17131
|
const serviceName = shifted ? idOrName : name;
|
|
@@ -16651,12 +17162,12 @@ var restartCommand = new Command51("restart").description("Restart one service,
|
|
|
16651
17162
|
handleLifecycleError(err);
|
|
16652
17163
|
}
|
|
16653
17164
|
});
|
|
16654
|
-
var servicesCommand = new
|
|
17165
|
+
var servicesCommand = new Command52("services").description("List and restart a box's agentbox.yaml services").addCommand(listCommand3, { isDefault: true }).addCommand(restartCommand);
|
|
16655
17166
|
|
|
16656
17167
|
// src/commands/shell.ts
|
|
16657
17168
|
import { spawnSync as spawnSync8 } from "child_process";
|
|
16658
17169
|
import { log as log54 } from "@clack/prompts";
|
|
16659
|
-
import { Command as
|
|
17170
|
+
import { Command as Command53 } from "commander";
|
|
16660
17171
|
|
|
16661
17172
|
// src/commands/_provider-guard.ts
|
|
16662
17173
|
import { log as log53 } from "@clack/prompts";
|
|
@@ -16774,7 +17285,8 @@ async function startOrAttachShell(box, cfg) {
|
|
|
16774
17285
|
process.exit(code);
|
|
16775
17286
|
}
|
|
16776
17287
|
async function runSshConfig(box, opts) {
|
|
16777
|
-
const
|
|
17288
|
+
const provider = await providerForBox(box);
|
|
17289
|
+
const conn = await resolveCloudSshTarget(box, provider);
|
|
16778
17290
|
if (!conn.identityFile) {
|
|
16779
17291
|
throw new Error(
|
|
16780
17292
|
`box '${box.name}' (provider '${box.provider ?? "docker"}') has no persistent SSH key, so it can't be added to Codex / Claude desktop over SSH. Only Hetzner cloud boxes are supported \u2014 Docker boxes aren't reachable over SSH, and Daytona uses a 60-min token that expires.`
|
|
@@ -16791,7 +17303,7 @@ async function runSshConfig(box, opts) {
|
|
|
16791
17303
|
identityFile: conn.identityFile
|
|
16792
17304
|
});
|
|
16793
17305
|
await syncAgentboxSshConfig();
|
|
16794
|
-
const codexUrl =
|
|
17306
|
+
const codexUrl = codexAddUrl(conn.alias);
|
|
16795
17307
|
if (opts.json) {
|
|
16796
17308
|
process.stdout.write(
|
|
16797
17309
|
JSON.stringify(
|
|
@@ -16821,11 +17333,12 @@ async function runSshConfig(box, opts) {
|
|
|
16821
17333
|
``,
|
|
16822
17334
|
`Codex: ${codexLink}`,
|
|
16823
17335
|
` ${codexUrl}`,
|
|
17336
|
+
` (auto-open with: agentbox open ${box.name} --in codex)`,
|
|
16824
17337
|
`Claude desktop: add an SSH connection to host "${conn.alias}" (already in ~/.ssh/config)`
|
|
16825
17338
|
];
|
|
16826
17339
|
process.stdout.write(lines.join("\n") + "\n");
|
|
16827
17340
|
}
|
|
16828
|
-
var shellCommand = new
|
|
17341
|
+
var shellCommand = new Command53("shell").description(
|
|
16829
17342
|
"Open an interactive shell in a box, in a detachable tmux session (auto-unpause/start)"
|
|
16830
17343
|
).argument(
|
|
16831
17344
|
"[box]",
|
|
@@ -16927,7 +17440,7 @@ var shellCommand = new Command52("shell").description(
|
|
|
16927
17440
|
handleLifecycleError(err);
|
|
16928
17441
|
}
|
|
16929
17442
|
});
|
|
16930
|
-
var shellAttachCommand = new
|
|
17443
|
+
var shellAttachCommand = new Command53("attach").description(
|
|
16931
17444
|
"Attach to a shell tmux session in a box, starting one if none is running (auto-unpause/start)"
|
|
16932
17445
|
).argument(
|
|
16933
17446
|
"[box]",
|
|
@@ -16965,7 +17478,7 @@ function renderShellTable(sessions) {
|
|
|
16965
17478
|
for (const r of rows) process.stdout.write(`${fmt(r)}
|
|
16966
17479
|
`);
|
|
16967
17480
|
}
|
|
16968
|
-
var shellLsCommand = new
|
|
17481
|
+
var shellLsCommand = new Command53("ls").description("List the shell tmux sessions running in a box").argument(
|
|
16969
17482
|
"[box]",
|
|
16970
17483
|
"box ref: project index, id, id prefix, name, or container (default: the only box in this project)"
|
|
16971
17484
|
).action(async (idOrName) => {
|
|
@@ -16988,7 +17501,7 @@ var shellLsCommand = new Command52("ls").description("List the shell tmux sessio
|
|
|
16988
17501
|
handleLifecycleError(err);
|
|
16989
17502
|
}
|
|
16990
17503
|
});
|
|
16991
|
-
var shellKillCommand = new
|
|
17504
|
+
var shellKillCommand = new Command53("kill").description("Kill a shell tmux session in a box (the shell and anything running in it)").argument(
|
|
16992
17505
|
"[box]",
|
|
16993
17506
|
"box ref: project index, id, id prefix, name, or container (default: the only box in this project)"
|
|
16994
17507
|
).option("-n, --name <label>", "shell label to kill (default: the box default shell)").option("--all", "kill every shell session in the box").action(async function(idOrName) {
|
|
@@ -17026,8 +17539,8 @@ shellCommand.addCommand(shellLsCommand);
|
|
|
17026
17539
|
shellCommand.addCommand(shellKillCommand);
|
|
17027
17540
|
|
|
17028
17541
|
// src/commands/start.ts
|
|
17029
|
-
import { Command as
|
|
17030
|
-
var startCommand = new
|
|
17542
|
+
import { Command as Command54 } from "commander";
|
|
17543
|
+
var startCommand = new Command54("start").description(
|
|
17031
17544
|
"Start a stopped box. Docker: docker start + relaunch ctl/dockerd/vnc daemons. Cloud: backend.start, then re-resolve preview URLs/tokens, re-launch in-sandbox ctl/dockerd daemons, and re-register with the host relay (so the CloudBoxPoller resumes)."
|
|
17032
17545
|
).argument(
|
|
17033
17546
|
"[box]",
|
|
@@ -17049,7 +17562,13 @@ var startCommand = new Command53("start").description(
|
|
|
17049
17562
|
process.stdout.write(`started ${box.name}
|
|
17050
17563
|
`);
|
|
17051
17564
|
const cfg = await loadEffectiveConfig(record.workspacePath);
|
|
17052
|
-
await autoWriteSshConfig(
|
|
17565
|
+
await autoWriteSshConfig(
|
|
17566
|
+
record,
|
|
17567
|
+
provider,
|
|
17568
|
+
cfg.effective.ssh.autoConfig,
|
|
17569
|
+
(m) => process.stderr.write(`agentbox: ${m}
|
|
17570
|
+
`)
|
|
17571
|
+
);
|
|
17053
17572
|
await restoreAgentSessions(record, provider, {
|
|
17054
17573
|
onLog: (line) => process.stdout.write(`${line}
|
|
17055
17574
|
`)
|
|
@@ -17062,7 +17581,7 @@ var startCommand = new Command53("start").description(
|
|
|
17062
17581
|
|
|
17063
17582
|
// src/commands/status.ts
|
|
17064
17583
|
import { log as log56 } from "@clack/prompts";
|
|
17065
|
-
import { Command as
|
|
17584
|
+
import { Command as Command55 } from "commander";
|
|
17066
17585
|
|
|
17067
17586
|
// src/endpoints-render.ts
|
|
17068
17587
|
function renderEndpointLines(endpoints, stream) {
|
|
@@ -17340,18 +17859,52 @@ async function runInspect(box, opts) {
|
|
|
17340
17859
|
}
|
|
17341
17860
|
|
|
17342
17861
|
// src/commands/status.ts
|
|
17862
|
+
var MAX_DISPLAY_NAME = 60;
|
|
17343
17863
|
var statusCommand2 = withWatchOptions(
|
|
17344
|
-
new
|
|
17864
|
+
new Command55("status").description("Show service + task status from a box's agentbox-ctl daemon").argument(
|
|
17345
17865
|
"[box]",
|
|
17346
17866
|
"box ref: project index, id, id prefix, name, or container (default: the only box in this project)"
|
|
17347
|
-
).option("-j, --json", "machine-readable JSON output").option("--inspect", "show detailed box info (volumes, limits, paths) plus service/task status")
|
|
17867
|
+
).option("-j, --json", "machine-readable JSON output").option("--inspect", "show detailed box info (volumes, limits, paths) plus service/task status").option(
|
|
17868
|
+
"--set-name <name>",
|
|
17869
|
+
"rename the box: set a cosmetic display label (does not change the container, git branch, or URL)"
|
|
17870
|
+
).option("--clear-name", "clear the box display label, falling back to the original name")
|
|
17348
17871
|
).action(async (idOrName, opts) => {
|
|
17349
17872
|
try {
|
|
17350
17873
|
if (opts.json && opts.watch) {
|
|
17351
17874
|
log56.error("cannot combine --json with --watch");
|
|
17352
17875
|
process.exit(2);
|
|
17353
17876
|
}
|
|
17877
|
+
if (opts.setName !== void 0 && opts.clearName) {
|
|
17878
|
+
log56.error("cannot combine --set-name with --clear-name");
|
|
17879
|
+
process.exit(2);
|
|
17880
|
+
}
|
|
17354
17881
|
const box = await resolveBoxOrExit(idOrName);
|
|
17882
|
+
if (opts.setName !== void 0 || opts.clearName) {
|
|
17883
|
+
if (opts.json || opts.watch) {
|
|
17884
|
+
log56.error("cannot combine --set-name/--clear-name with --json or --watch");
|
|
17885
|
+
process.exit(2);
|
|
17886
|
+
}
|
|
17887
|
+
const before = boxLabel(box);
|
|
17888
|
+
let next;
|
|
17889
|
+
if (opts.clearName) {
|
|
17890
|
+
next = void 0;
|
|
17891
|
+
} else {
|
|
17892
|
+
next = [...opts.setName].filter((c) => c >= " " && c.charCodeAt(0) !== 127).join("").trim();
|
|
17893
|
+
if (!next) {
|
|
17894
|
+
log56.error("--set-name requires a non-empty name (use --clear-name to reset)");
|
|
17895
|
+
process.exit(2);
|
|
17896
|
+
}
|
|
17897
|
+
if (next.length > MAX_DISPLAY_NAME) {
|
|
17898
|
+
log56.error(`name too long (max ${String(MAX_DISPLAY_NAME)} chars)`);
|
|
17899
|
+
process.exit(2);
|
|
17900
|
+
}
|
|
17901
|
+
}
|
|
17902
|
+
await setBoxDisplayName(box.id, next);
|
|
17903
|
+
const after = next ?? box.name;
|
|
17904
|
+
process.stdout.write(`renamed ${before} -> ${after}
|
|
17905
|
+
`);
|
|
17906
|
+
return;
|
|
17907
|
+
}
|
|
17355
17908
|
if ((box.provider ?? "docker") !== "docker") {
|
|
17356
17909
|
await runInspect(box, { json: opts.json, watch: opts.watch, interval: opts.interval });
|
|
17357
17910
|
return;
|
|
@@ -17476,8 +18029,8 @@ function renderPersisted2(s, state) {
|
|
|
17476
18029
|
}
|
|
17477
18030
|
|
|
17478
18031
|
// src/commands/stop.ts
|
|
17479
|
-
import { Command as
|
|
17480
|
-
var stopCommand = new
|
|
18032
|
+
import { Command as Command56 } from "commander";
|
|
18033
|
+
var stopCommand = new Command56("stop").description(
|
|
17481
18034
|
"Stop a box (Docker: docker stop; preserves upper + node_modules volumes. Cloud: backend.stop \u2014 sandbox stays in your account, disk preserved)."
|
|
17482
18035
|
).argument(
|
|
17483
18036
|
"[box]",
|
|
@@ -17506,7 +18059,7 @@ restart with: agentbox start ${box.name}
|
|
|
17506
18059
|
});
|
|
17507
18060
|
|
|
17508
18061
|
// src/commands/top.ts
|
|
17509
|
-
import { Command as
|
|
18062
|
+
import { Command as Command57 } from "commander";
|
|
17510
18063
|
var COLS = ["BOX", "STATE", "CPU%", "MEM USAGE / LIMIT", "MEM%", "PIDS", "DISK", "NET I/O"];
|
|
17511
18064
|
function row(name, state, s) {
|
|
17512
18065
|
const mem = `${fmtBytes2(s.memUsedBytes)} / ${fmtBytes2(s.memLimitBytes)}`;
|
|
@@ -17580,7 +18133,7 @@ async function renderProjectFooters() {
|
|
|
17580
18133
|
|
|
17581
18134
|
SYSTEM: ${parts.join(" - ")}` : "";
|
|
17582
18135
|
}
|
|
17583
|
-
var topCommand = new
|
|
18136
|
+
var topCommand = new Command57("top").description("Live resource monitor (cpu/mem/pids/disk) for a box, the project, or every box").argument(
|
|
17584
18137
|
"[box]",
|
|
17585
18138
|
"box ref (default: every box on the host; --project narrows to the cwd's project)"
|
|
17586
18139
|
).option("-p, --project", "show only boxes in the cwd's project").option("--once", "print a single snapshot instead of watching").option("-j, --json", "machine-readable JSON (implies --once)").option("--interval <seconds>", "refresh interval", "2").option("--live", "probe live cloud state via the provider SDK (slower; default: last host-known)").action(async (idOrName, opts) => {
|
|
@@ -17613,8 +18166,8 @@ var topCommand = new Command56("top").description("Live resource monitor (cpu/me
|
|
|
17613
18166
|
});
|
|
17614
18167
|
|
|
17615
18168
|
// src/commands/unpause.ts
|
|
17616
|
-
import { Command as
|
|
17617
|
-
var unpauseCommand = new
|
|
18169
|
+
import { Command as Command58 } from "commander";
|
|
18170
|
+
var unpauseCommand = new Command58("unpause").description(
|
|
17618
18171
|
"Resume a paused box. Docker: `docker unpause` (sub-second). Cloud: backend.resume (re-hydrates from archive \u2014 slower first time)."
|
|
17619
18172
|
).argument(
|
|
17620
18173
|
"[box]",
|
|
@@ -17632,7 +18185,13 @@ var unpauseCommand = new Command57("unpause").description(
|
|
|
17632
18185
|
process.stdout.write(`unpaused ${box.name}
|
|
17633
18186
|
`);
|
|
17634
18187
|
const cfg = await loadEffectiveConfig(box.workspacePath);
|
|
17635
|
-
await autoWriteSshConfig(
|
|
18188
|
+
await autoWriteSshConfig(
|
|
18189
|
+
box,
|
|
18190
|
+
provider,
|
|
18191
|
+
cfg.effective.ssh.autoConfig,
|
|
18192
|
+
(m) => process.stderr.write(`agentbox: ${m}
|
|
18193
|
+
`)
|
|
18194
|
+
);
|
|
17636
18195
|
await restoreAgentSessions(box, provider, {
|
|
17637
18196
|
onLog: (line) => process.stdout.write(`${line}
|
|
17638
18197
|
`)
|
|
@@ -17645,29 +18204,11 @@ var unpauseCommand = new Command57("unpause").description(
|
|
|
17645
18204
|
|
|
17646
18205
|
// src/commands/update.ts
|
|
17647
18206
|
import { spawn as spawn11 } from "child_process";
|
|
17648
|
-
import { Command as
|
|
17649
|
-
|
|
17650
|
-
// src/exec-method.ts
|
|
17651
|
-
function detectExecutionMethod(input) {
|
|
17652
|
-
const ua = input.userAgent ?? "";
|
|
17653
|
-
const argv1 = input.argv1 ?? "";
|
|
17654
|
-
if (argv1.includes("/_npx/") || argv1.includes("/.npm/_npx") || /\bnpx\//.test(ua)) {
|
|
17655
|
-
return "npx";
|
|
17656
|
-
}
|
|
17657
|
-
if (/\bpnpm\//.test(ua)) {
|
|
17658
|
-
return "pnpm";
|
|
17659
|
-
}
|
|
17660
|
-
if (/\bnpm\//.test(ua)) {
|
|
17661
|
-
return "npm";
|
|
17662
|
-
}
|
|
17663
|
-
return "direct";
|
|
17664
|
-
}
|
|
17665
|
-
|
|
17666
|
-
// src/commands/update.ts
|
|
17667
|
-
var PKG = "@madarco/agentbox";
|
|
18207
|
+
import { Command as Command59 } from "commander";
|
|
18208
|
+
var PKG2 = "@madarco/agentbox";
|
|
17668
18209
|
function selfUpdateCommand(method) {
|
|
17669
|
-
if (method === "npm") return { cmd: "npm", args: ["install", "-g", `${
|
|
17670
|
-
if (method === "pnpm") return { cmd: "pnpm", args: ["add", "-g", `${
|
|
18210
|
+
if (method === "npm") return { cmd: "npm", args: ["install", "-g", `${PKG2}@latest`] };
|
|
18211
|
+
if (method === "pnpm") return { cmd: "pnpm", args: ["add", "-g", `${PKG2}@latest`] };
|
|
17671
18212
|
return null;
|
|
17672
18213
|
}
|
|
17673
18214
|
function describeSelfUpdate(method) {
|
|
@@ -17689,15 +18230,31 @@ function runInherit(cmd, args) {
|
|
|
17689
18230
|
child.on("close", (code) => resolveP(code ?? 0));
|
|
17690
18231
|
});
|
|
17691
18232
|
}
|
|
17692
|
-
|
|
17693
|
-
|
|
17694
|
-
|
|
18233
|
+
async function reportLatest() {
|
|
18234
|
+
try {
|
|
18235
|
+
const res = await fetch(`https://registry.npmjs.org/${PKG2}/latest`, {
|
|
18236
|
+
signal: AbortSignal.timeout(3e3)
|
|
18237
|
+
});
|
|
18238
|
+
if (!res.ok) return;
|
|
18239
|
+
const body = await res.json();
|
|
18240
|
+
const latest = typeof body.version === "string" ? body.version : void 0;
|
|
18241
|
+
if (latest === void 0) return;
|
|
18242
|
+
prompt_exports.log.info(
|
|
18243
|
+
isNewer(latest, AGENTBOX_VERSION) ? `current ${AGENTBOX_VERSION} \u2192 latest ${latest}` : `already the latest (${AGENTBOX_VERSION}) \u2014 refreshing skills/image/relay/app anyway`
|
|
18244
|
+
);
|
|
18245
|
+
} catch {
|
|
18246
|
+
}
|
|
18247
|
+
}
|
|
18248
|
+
var updateCommand = new Command59("self-update").description(
|
|
18249
|
+
"Update agentbox: self-update via npm/pnpm (unless run via npx), refresh the host skills, wipe the box image so it rebuilds, reload the relay, and update the menu-bar app"
|
|
18250
|
+
).option("-y, --yes", "skip the confirmation prompt").option("--dry-run", "show what would happen, don't change anything").option("--skip-self", "skip the package self-update; only refresh the skills + image + relay + app").option("--skip-skills", "skip refreshing the host skill files in ~/.claude, ~/.codex, ~/.config/opencode").action(async (opts) => {
|
|
17695
18251
|
try {
|
|
17696
18252
|
const method = detectExecutionMethod({
|
|
17697
18253
|
userAgent: process.env.npm_config_user_agent,
|
|
17698
18254
|
argv1: process.argv[1]
|
|
17699
18255
|
});
|
|
17700
18256
|
(0, prompt_exports.intro)("agentbox self-update");
|
|
18257
|
+
await reportLatest();
|
|
17701
18258
|
const selfStep = opts.skipSelf ? "self-update: skipped (--skip-self)" : describeSelfUpdate(method);
|
|
17702
18259
|
const skillsStep = opts.skipSkills ? "skills: skipped (--skip-skills)" : "skills: refresh agentbox-managed host skill files in ~/.claude (and Codex/OpenCode)";
|
|
17703
18260
|
prompt_exports.log.info(
|
|
@@ -17706,7 +18263,8 @@ var updateCommand = new Command58("self-update").description(
|
|
|
17706
18263
|
` ${selfStep}`,
|
|
17707
18264
|
` ${skillsStep}`,
|
|
17708
18265
|
` image: docker image rm -f ${DEFAULT_BOX_IMAGE} (rebuilds on next create/claude)`,
|
|
17709
|
-
" relay: stop, then respawn
|
|
18266
|
+
" relay: stop, then respawn",
|
|
18267
|
+
" app: update the menu-bar app if the published build changed (macOS, when installed)"
|
|
17710
18268
|
].join("\n")
|
|
17711
18269
|
);
|
|
17712
18270
|
if (opts.dryRun) {
|
|
@@ -17734,67 +18292,19 @@ var updateCommand = new Command58("self-update").description(
|
|
|
17734
18292
|
throw new Error(`${cmd.cmd} exited with code ${String(code)}`);
|
|
17735
18293
|
}
|
|
17736
18294
|
selfUpdated = true;
|
|
17737
|
-
prompt_exports.log.success(`updated ${
|
|
17738
|
-
}
|
|
17739
|
-
}
|
|
17740
|
-
if (opts.skipSkills) {
|
|
17741
|
-
prompt_exports.log.info("skipping skills refresh (--skip-skills)");
|
|
17742
|
-
} else if (selfUpdated) {
|
|
17743
|
-
const code = await runInherit("agentbox", ["install", "--skills-only"]);
|
|
17744
|
-
if (code === 0) {
|
|
17745
|
-
prompt_exports.log.success("refreshed host skills (via updated build)");
|
|
17746
|
-
} else {
|
|
17747
|
-
prompt_exports.log.warn(
|
|
17748
|
-
`host skills not refreshed (agentbox install --skills-only exited ${String(code)}) \u2014 run it manually to pick up the new versions`
|
|
17749
|
-
);
|
|
17750
|
-
}
|
|
17751
|
-
} else {
|
|
17752
|
-
try {
|
|
17753
|
-
const res = installHostSkills({ quiet: true });
|
|
17754
|
-
if (res.written.length > 0) {
|
|
17755
|
-
prompt_exports.log.success(`refreshed host skills (${String(res.written.length)} file(s))`);
|
|
17756
|
-
} else {
|
|
17757
|
-
prompt_exports.log.info(`host skills already current (${String(res.skipped)} skipped)`);
|
|
17758
|
-
}
|
|
17759
|
-
if (res.blocked.length > 0) {
|
|
17760
|
-
prompt_exports.log.warn(
|
|
17761
|
-
`user-modified skill file(s) left in place: ${res.blocked.join(", ")} \u2014 run \`agentbox install --skills-only --force\` to overwrite`
|
|
17762
|
-
);
|
|
17763
|
-
}
|
|
17764
|
-
} catch (err) {
|
|
17765
|
-
prompt_exports.log.warn(
|
|
17766
|
-
`host skills not refreshed (${err instanceof Error ? err.message : String(err)})`
|
|
17767
|
-
);
|
|
18295
|
+
prompt_exports.log.success(`updated ${PKG2} via ${cmd.cmd}`);
|
|
17768
18296
|
}
|
|
17769
18297
|
}
|
|
17770
|
-
const s = (0, prompt_exports.spinner)();
|
|
17771
|
-
s.start(`removing image ${DEFAULT_BOX_IMAGE}`);
|
|
17772
|
-
const removed = await removeImage(DEFAULT_BOX_IMAGE);
|
|
17773
|
-
s.stop(
|
|
17774
|
-
removed ? `removed image ${DEFAULT_BOX_IMAGE} (rebuilds on next create/claude)` : `image ${DEFAULT_BOX_IMAGE} not present (nothing to remove)`
|
|
17775
|
-
);
|
|
17776
|
-
const sr = (0, prompt_exports.spinner)();
|
|
17777
|
-
sr.start("stopping relay");
|
|
17778
|
-
const stop = await stopRelay();
|
|
17779
|
-
sr.stop(
|
|
17780
|
-
stop.stopped ? `stopped relay (pid ${String(stop.pid)})` : "relay was not running"
|
|
17781
|
-
);
|
|
17782
18298
|
if (selfUpdated) {
|
|
17783
|
-
|
|
17784
|
-
|
|
17785
|
-
)
|
|
17786
|
-
} else {
|
|
17787
|
-
const sr2 = (0, prompt_exports.spinner)();
|
|
17788
|
-
sr2.start("restarting relay");
|
|
17789
|
-
try {
|
|
17790
|
-
const ep = await ensureRelay();
|
|
17791
|
-
sr2.stop(`relay back up on ${ep.hostUrl}`);
|
|
17792
|
-
} catch (err) {
|
|
17793
|
-
sr2.stop("relay restart failed");
|
|
18299
|
+
const args = ["_post-update-refresh", ...opts.skipSkills ? ["--skip-skills"] : []];
|
|
18300
|
+
const code = await runInherit("agentbox", args);
|
|
18301
|
+
if (code !== 0) {
|
|
17794
18302
|
prompt_exports.log.warn(
|
|
17795
|
-
|
|
18303
|
+
`post-update refresh exited ${String(code)} \u2014 run \`agentbox self-update --skip-self\` to retry`
|
|
17796
18304
|
);
|
|
17797
18305
|
}
|
|
18306
|
+
} else {
|
|
18307
|
+
await runPostUpdateRefresh({ skipSkills: opts.skipSkills });
|
|
17798
18308
|
}
|
|
17799
18309
|
await maybePromptStar({ trigger: "self-update" });
|
|
17800
18310
|
(0, prompt_exports.outro)("update complete");
|
|
@@ -17806,7 +18316,7 @@ var updateCommand = new Command58("self-update").description(
|
|
|
17806
18316
|
// src/commands/url.ts
|
|
17807
18317
|
import { spawnSync as spawnSync9 } from "child_process";
|
|
17808
18318
|
import { log as log58 } from "@clack/prompts";
|
|
17809
|
-
import { Command as
|
|
18319
|
+
import { Command as Command60 } from "commander";
|
|
17810
18320
|
var SIGNED_URL_TTL_MIN2 = 1;
|
|
17811
18321
|
var SIGNED_URL_TTL_MAX2 = 86400;
|
|
17812
18322
|
function parseTtlOrExit2(raw) {
|
|
@@ -17819,7 +18329,7 @@ function parseTtlOrExit2(raw) {
|
|
|
17819
18329
|
}
|
|
17820
18330
|
return n;
|
|
17821
18331
|
}
|
|
17822
|
-
var urlCommand = new
|
|
18332
|
+
var urlCommand = new Command60("url").description(
|
|
17823
18333
|
"Open a box's web app URL in the browser, even when no service declares `expose:` (auto-unpause/start)"
|
|
17824
18334
|
).argument(
|
|
17825
18335
|
"[box]",
|
|
@@ -17898,8 +18408,8 @@ var urlCommand = new Command59("url").description(
|
|
|
17898
18408
|
|
|
17899
18409
|
// src/commands/wait.ts
|
|
17900
18410
|
import { log as log59 } from "@clack/prompts";
|
|
17901
|
-
import { Command as
|
|
17902
|
-
var waitCommand = new
|
|
18411
|
+
import { Command as Command61 } from "commander";
|
|
18412
|
+
var waitCommand = new Command61("wait").description("Block until the box reports all autostart units ready").argument(
|
|
17903
18413
|
"[box]",
|
|
17904
18414
|
"box ref: project index, id, id prefix, name, or container (default: the only box in this project)"
|
|
17905
18415
|
).option("--timeout <ms>", "overall timeout in milliseconds", "120000").option("--units <names...>", "restrict to the named units").option("-j, --json", "machine-readable JSON output").action(async (idOrName, opts) => {
|
|
@@ -17966,7 +18476,7 @@ process.env.AGENTBOX_CLI_COMMIT = AGENTBOX_COMMIT;
|
|
|
17966
18476
|
}
|
|
17967
18477
|
}
|
|
17968
18478
|
}
|
|
17969
|
-
var program = new
|
|
18479
|
+
var program = new Command62();
|
|
17970
18480
|
program.name("agentbox").description("Launch coding agents in isolated sandboxes").version(AGENTBOX_VERSION);
|
|
17971
18481
|
program.enablePositionalOptions();
|
|
17972
18482
|
program.addCommand(createCommand);
|
|
@@ -18009,6 +18519,7 @@ program.addCommand(controlPlaneCommand, { hidden: true });
|
|
|
18009
18519
|
program.addCommand(runQueuedJobCommand, { hidden: true });
|
|
18010
18520
|
program.addCommand(runQueuedPrepareCommand, { hidden: true });
|
|
18011
18521
|
program.addCommand(claudeLoginWorkerCommand, { hidden: true });
|
|
18522
|
+
program.addCommand(postUpdateRefreshCommand, { hidden: true });
|
|
18012
18523
|
program.addCommand(herdrCommand, { hidden: true });
|
|
18013
18524
|
program.addCommand(daytonaCommand);
|
|
18014
18525
|
program.addCommand(hetznerCommand);
|
|
@@ -18034,6 +18545,7 @@ var FIRST_RUN_EXEMPT = /* @__PURE__ */ new Set([
|
|
|
18034
18545
|
"_run-queued-job",
|
|
18035
18546
|
"_run-queued-prepare",
|
|
18036
18547
|
"_claude-login-worker",
|
|
18548
|
+
"_post-update-refresh",
|
|
18037
18549
|
"drive",
|
|
18038
18550
|
"screen"
|
|
18039
18551
|
]);
|
|
@@ -18059,8 +18571,53 @@ if (isFirstRun() && isFirstRunHookEligible(argv)) {
|
|
|
18059
18571
|
);
|
|
18060
18572
|
}
|
|
18061
18573
|
}
|
|
18062
|
-
|
|
18063
|
-
|
|
18064
|
-
|
|
18065
|
-
|
|
18574
|
+
var versionPromptShown = false;
|
|
18575
|
+
if (AGENTBOX_VERSION !== "0.0.0-dev") {
|
|
18576
|
+
const state = readUpdateState();
|
|
18577
|
+
if (state.lastRunVersion === void 0) {
|
|
18578
|
+
writeUpdateState({ lastRunVersion: AGENTBOX_VERSION });
|
|
18579
|
+
} else if (state.lastRunVersion !== AGENTBOX_VERSION && isFirstRunHookEligible(argv) && argv[2] !== "self-update") {
|
|
18580
|
+
versionPromptShown = true;
|
|
18581
|
+
try {
|
|
18582
|
+
const yes = await confirm({
|
|
18583
|
+
message: `agentbox was updated (${state.lastRunVersion} \u2192 ${AGENTBOX_VERSION}) \u2014 download new version now?`,
|
|
18584
|
+
initialValue: true
|
|
18585
|
+
});
|
|
18586
|
+
if (yes) {
|
|
18587
|
+
await runPostUpdateRefresh();
|
|
18588
|
+
} else {
|
|
18589
|
+
writeUpdateState({ lastRunVersion: AGENTBOX_VERSION });
|
|
18590
|
+
}
|
|
18591
|
+
} catch (err) {
|
|
18592
|
+
process.stderr.write(
|
|
18593
|
+
`post-update refresh failed: ${err instanceof Error ? err.message : String(err)}
|
|
18594
|
+
`
|
|
18595
|
+
);
|
|
18596
|
+
}
|
|
18597
|
+
}
|
|
18598
|
+
}
|
|
18599
|
+
if (isFirstRunHookEligible(argv)) {
|
|
18600
|
+
maybeStartRemoteCheck();
|
|
18601
|
+
}
|
|
18602
|
+
program.parseAsync(argv).then(
|
|
18603
|
+
async () => {
|
|
18604
|
+
if (versionPromptShown || !isFirstRunHookEligible(argv)) return;
|
|
18605
|
+
const msg = nudgeMessage(
|
|
18606
|
+
readUpdateState(),
|
|
18607
|
+
detectExecutionMethod({
|
|
18608
|
+
userAgent: process.env.npm_config_user_agent,
|
|
18609
|
+
argv1: process.argv[1]
|
|
18610
|
+
})
|
|
18611
|
+
);
|
|
18612
|
+
if (msg !== null && await updateCheckEnabled()) {
|
|
18613
|
+
process.stderr.write(`
|
|
18614
|
+
${msg}
|
|
18615
|
+
`);
|
|
18616
|
+
}
|
|
18617
|
+
},
|
|
18618
|
+
(err) => {
|
|
18619
|
+
printCliError(err, process.stderr);
|
|
18620
|
+
process.exit(1);
|
|
18621
|
+
}
|
|
18622
|
+
);
|
|
18066
18623
|
//# sourceMappingURL=index.js.map
|