@madarco/agentbox 0.23.5 → 0.24.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +81 -0
- package/LICENSE +21 -0
- package/README.md +3 -2
- package/dist/{_cloud-attach-D4OQO5AJ.js → _cloud-attach-T6GPR6LJ.js} +5 -5
- package/dist/{chunk-KY32JO6J.js → chunk-5KHEH47T.js} +91 -79
- package/dist/chunk-5KHEH47T.js.map +1 -0
- package/dist/{chunk-YRTM3KNT.js → chunk-6U2S6QWD.js} +219 -18
- package/dist/chunk-6U2S6QWD.js.map +1 -0
- package/dist/{chunk-JYEZ6Q5M.js → chunk-DEDTPG2D.js} +874 -146
- package/dist/chunk-DEDTPG2D.js.map +1 -0
- package/dist/chunk-G3H2L3O2.js +0 -0
- package/dist/{chunk-JNY5GPIM.js → chunk-I654PBHA.js} +290 -330
- package/dist/chunk-I654PBHA.js.map +1 -0
- package/dist/{chunk-6KOQRSHH.js → chunk-K2EDQGZP.js} +18 -4
- package/dist/chunk-K2EDQGZP.js.map +1 -0
- package/dist/{chunk-KZWJMNLP.js → chunk-LC4E2EIZ.js} +3 -3
- package/dist/{chunk-KZWJMNLP.js.map → chunk-LC4E2EIZ.js.map} +1 -1
- package/dist/{chunk-DADOEMXP.js → chunk-NACA6AM7.js} +183 -49
- package/dist/chunk-NACA6AM7.js.map +1 -0
- package/dist/{chunk-FX32NZD4.js → chunk-RYQLFKCP.js} +20 -10
- package/dist/chunk-RYQLFKCP.js.map +1 -0
- package/dist/{chunk-QT3SHMLY.js → chunk-UIRBYL4G.js} +43 -12
- package/dist/chunk-UIRBYL4G.js.map +1 -0
- package/dist/chunk-WJFZJZIM.js +0 -0
- package/dist/chunk-WLHJZPFJ.js +845 -0
- package/dist/chunk-WLHJZPFJ.js.map +1 -0
- package/dist/cloud-poller-SUNA6ZQC-7M5LJHHE.js +0 -0
- package/dist/dist-3KIJ2KQ2.js +1437 -0
- package/dist/dist-3KIJ2KQ2.js.map +1 -0
- package/dist/{dist-564EDHFF.js → dist-7OUOHQPA.js} +196 -151
- package/dist/dist-7OUOHQPA.js.map +1 -0
- package/dist/{dist-CAT2TN75.js → dist-B7TNWGVG.js} +8 -4
- package/dist/{dist-UDQMBWYW.js → dist-KYV3LEHG.js} +10 -6
- package/dist/{dist-EAR4BLL2.js → dist-PHYCFYKH.js} +37 -17
- package/dist/dist-PHYCFYKH.js.map +1 -0
- package/dist/{dist-2BTJQUJS.js → dist-T5MXBZGP.js} +2 -2
- package/dist/{dist-O5Y4X4C5.js → dist-Z7KEPQC7.js} +6 -6
- package/dist/index.js +2617 -1094
- package/dist/index.js.map +1 -1
- package/dist/{prepared-state-BUO75YLZ-PW64VQMT.js → prepared-state-BUO75YLZ-RQRFFBJW.js} +2 -2
- package/package.json +28 -28
- package/runtime/_shared/agentbox-checkpoint-cleanup +0 -0
- package/runtime/_shared/agentbox-codex-hooks.json +1 -1
- 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 +468 -97
- package/runtime/_shared/gh-shim +0 -0
- package/runtime/_shared/git-shim +53 -3
- package/runtime/_shared/linear-shim +0 -0
- package/runtime/_shared/ntn-shim +0 -0
- package/runtime/daytona/custom-system-CLAUDE.md +1 -1
- package/runtime/digitalocean/agentbox-checkpoint-cleanup +55 -0
- package/runtime/digitalocean/agentbox-codex-hooks.json +68 -0
- package/runtime/digitalocean/agentbox-dockerd-start +145 -0
- package/runtime/digitalocean/agentbox-open +28 -0
- package/runtime/digitalocean/agentbox-portless-trust +82 -0
- package/runtime/digitalocean/agentbox-setup-skill.md +317 -0
- package/runtime/digitalocean/agentbox-vnc-start +102 -0
- package/runtime/digitalocean/claude-managed-settings.json +116 -0
- package/runtime/digitalocean/ctl.cjs +27852 -0
- package/runtime/digitalocean/custom-system-CLAUDE.md +39 -0
- package/runtime/digitalocean/gh-shim +344 -0
- package/runtime/digitalocean/git-shim +181 -0
- package/runtime/digitalocean/linear-shim +181 -0
- package/runtime/digitalocean/ntn-shim +95 -0
- package/runtime/digitalocean/opencode-agentbox-plugin.js +76 -0
- package/runtime/digitalocean/scripts/install-box.sh +462 -0
- package/runtime/docker/Dockerfile.box +5 -0
- package/runtime/docker/packages/ctl/dist/bin.cjs +468 -97
- package/runtime/docker/packages/sandbox-docker/scripts/agentbox-checkpoint-cleanup +0 -0
- package/runtime/docker/packages/sandbox-docker/scripts/agentbox-codex-hooks.json +1 -1
- 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 +0 -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/custom-system-CLAUDE.md +2 -1
- package/runtime/docker/packages/sandbox-docker/scripts/gh-shim +0 -0
- package/runtime/docker/packages/sandbox-docker/scripts/git-shim +53 -3
- 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-codex-hooks.json +1 -1
- 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 +468 -97
- package/runtime/e2b/custom-system-CLAUDE.md +6 -3
- package/runtime/e2b/gh-shim +0 -0
- package/runtime/e2b/git-shim +53 -3
- package/runtime/e2b/linear-shim +0 -0
- package/runtime/e2b/ntn-shim +0 -0
- package/runtime/e2b/scripts/build-template.sh +16 -0
- package/runtime/hetzner/agentbox-checkpoint-cleanup +0 -0
- package/runtime/hetzner/agentbox-codex-hooks.json +1 -1
- 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 +468 -97
- package/runtime/hetzner/custom-system-CLAUDE.md +1 -1
- package/runtime/hetzner/gh-shim +0 -0
- package/runtime/hetzner/git-shim +53 -3
- package/runtime/hetzner/linear-shim +0 -0
- package/runtime/hetzner/ntn-shim +0 -0
- package/runtime/hetzner/scripts/install-box.sh +5 -0
- package/runtime/hub/apps/hub/.next/BUILD_ID +1 -1
- package/runtime/hub/apps/hub/.next/build-manifest.json +3 -3
- 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/chunks/[root-of-the-server]__0d1lmiq._.js +12 -12
- 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]__1bqbkd5._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1qa4a0v._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/_0760z6y._.js +8 -8
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0ro6vh6._.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/middleware-build-manifest.js +3 -3
- package/runtime/hub/apps/hub/.next/server/pages/500.html +1 -1
- package/runtime/hub/apps/hub/.next/static/chunks/380qcmusmigzz.js +1 -0
- package/runtime/hub/apps/hub/{auth-675P3LQS.js → auth-Q447765C.js} +2 -2
- package/runtime/hub/apps/hub/{auth-config-AOBEKRZQ.js → auth-config-SIL635ZD.js} +2 -2
- package/runtime/hub/apps/hub/{chunk-FSEPYTQ6.js → chunk-3VE7AYVK.js} +594 -145
- package/runtime/hub/apps/hub/{chunk-EXQCBM5Q.js → chunk-64WEKO34.js} +42 -11
- package/runtime/hub/apps/hub/{chunk-56YQBVN2.js → chunk-DZPQB2JZ.js} +1 -1
- package/runtime/hub/apps/hub/{chunk-7M6FXZIO.js → chunk-FGBXEXUV.js} +350 -292
- package/runtime/hub/apps/hub/{chunk-Z7ZAL24C.js → chunk-YVELHPNY.js} +218 -17
- package/runtime/hub/apps/hub/{dist-EKQHCXWE.js → dist-33ZNVTC6.js} +183 -49
- package/runtime/hub/apps/hub/{dist-V4TJ44MT.js → dist-4SXAJBOC.js} +195 -150
- package/runtime/hub/apps/hub/{dist-QIXUPGPP.js → dist-EPJFN2J3.js} +116 -86
- package/runtime/hub/apps/hub/{dist-STQK5XM6.js → dist-GF5EBRNG.js} +1 -1
- package/runtime/hub/apps/hub/{dist-JGZ55OIJ.js → dist-UJVIROA4.js} +19 -5
- package/runtime/hub/apps/hub/dist-XULFTIMT.js +2212 -0
- package/runtime/hub/apps/hub/{dist-GGWYKXJE.js → dist-YM5J25H6.js} +7 -3
- package/runtime/hub/apps/hub/{hub-token-2BZFBBW3.js → hub-token-UITZEWVP.js} +2 -2
- package/runtime/hub/apps/hub/package.json +1 -0
- package/runtime/hub/apps/hub/{prepared-state-BUO75YLZ-UICXTY25.js → prepared-state-BUO75YLZ-O4GZMDRF.js} +1 -1
- package/runtime/hub/apps/hub/server.js +17 -15
- package/runtime/relay/bin.cjs +275 -59
- package/runtime/vercel/agentbox-checkpoint-cleanup +0 -0
- package/runtime/vercel/agentbox-codex-hooks.json +1 -1
- 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 +468 -97
- package/runtime/vercel/custom-system-CLAUDE.md +3 -2
- package/runtime/vercel/gh-shim +0 -0
- package/runtime/vercel/git-shim +53 -3
- package/runtime/vercel/linear-shim +0 -0
- package/runtime/vercel/ntn-shim +0 -0
- package/runtime/vercel/scripts/provision.sh +16 -0
- package/dist/chunk-6KOQRSHH.js.map +0 -1
- package/dist/chunk-DADOEMXP.js.map +0 -1
- package/dist/chunk-FX32NZD4.js.map +0 -1
- package/dist/chunk-JNY5GPIM.js.map +0 -1
- package/dist/chunk-JYEZ6Q5M.js.map +0 -1
- package/dist/chunk-KY32JO6J.js.map +0 -1
- package/dist/chunk-QT3SHMLY.js.map +0 -1
- package/dist/chunk-YRTM3KNT.js.map +0 -1
- package/dist/dist-564EDHFF.js.map +0 -1
- package/dist/dist-EAR4BLL2.js.map +0 -1
- package/runtime/hub/apps/hub/.next/static/chunks/0joh_xsiowfc4.js +0 -1
- /package/dist/{_cloud-attach-D4OQO5AJ.js.map → _cloud-attach-T6GPR6LJ.js.map} +0 -0
- /package/dist/{dist-2BTJQUJS.js.map → dist-B7TNWGVG.js.map} +0 -0
- /package/dist/{dist-CAT2TN75.js.map → dist-KYV3LEHG.js.map} +0 -0
- /package/dist/{dist-O5Y4X4C5.js.map → dist-T5MXBZGP.js.map} +0 -0
- /package/dist/{dist-UDQMBWYW.js.map → dist-Z7KEPQC7.js.map} +0 -0
- /package/dist/{prepared-state-BUO75YLZ-PW64VQMT.js.map → prepared-state-BUO75YLZ-RQRFFBJW.js.map} +0 -0
- /package/runtime/hub/apps/hub/.next/static/{lOi70Di6lcnEBsUUHKrQ5 → 3tBexekuTKIr_6nriQjKE}/_buildManifest.js +0 -0
- /package/runtime/hub/apps/hub/.next/static/{lOi70Di6lcnEBsUUHKrQ5 → 3tBexekuTKIr_6nriQjKE}/_clientMiddlewareManifest.js +0 -0
- /package/runtime/hub/apps/hub/.next/static/{lOi70Di6lcnEBsUUHKrQ5 → 3tBexekuTKIr_6nriQjKE}/_ssgManifest.js +0 -0
|
@@ -30,7 +30,7 @@ var PROVIDERS = [
|
|
|
30
30
|
loginHint: "approve a browser sign-in link",
|
|
31
31
|
rebuildMinutes: "7",
|
|
32
32
|
blurb: "Daytona Cloud sandboxes",
|
|
33
|
-
sizeDesc: "Per-provider override of `box.size` for daytona. `cpu-memory-disk` GB spec (e.g. `4-8-20`). Only honored on the image/Dockerfile create path; Daytona rejects custom resources on snapshot-resume.",
|
|
33
|
+
sizeDesc: "Per-provider override of `box.size` for daytona. `cpu-memory-disk` GB spec (e.g. `4-8-20`). Only honored on the image/Dockerfile create path; on the snapshot path the size is fixed at bake time (Daytona rejects custom resources on snapshot-resume).",
|
|
34
34
|
imageDesc: "Per-provider override of `box.image` for daytona (named snapshot, e.g. `agentbox-base-<fingerprint>`). Written by `agentbox prepare --provider daytona`."
|
|
35
35
|
},
|
|
36
36
|
{
|
|
@@ -50,7 +50,7 @@ var PROVIDERS = [
|
|
|
50
50
|
loginHint: "installs the Vercel sandbox CLI, then a browser sign-in",
|
|
51
51
|
rebuildMinutes: "5-10",
|
|
52
52
|
blurb: "Vercel Sandboxes",
|
|
53
|
-
sizeDesc: "Per-provider override of `box.size` for vercel.
|
|
53
|
+
sizeDesc: "Per-provider override of `box.size` for vercel. vCPU count \u2014 one of `1`, `2`, `4`, `8` (Vercel couples RAM at 2048 MB/vCPU). Default 2.",
|
|
54
54
|
imageDesc: "Per-provider override of `box.image` for vercel (snapshot id, e.g. `snap_\u2026`). Written by `agentbox prepare --provider vercel`."
|
|
55
55
|
},
|
|
56
56
|
{
|
|
@@ -60,8 +60,18 @@ var PROVIDERS = [
|
|
|
60
60
|
loginHint: "paste an API key from the E2B dashboard",
|
|
61
61
|
rebuildMinutes: "2",
|
|
62
62
|
blurb: "E2B microVMs",
|
|
63
|
-
sizeDesc: "Per-provider override of `box.size` for e2b.
|
|
63
|
+
sizeDesc: "Per-provider override of `box.size` for e2b. `cpu-memory` GB spec (e.g. `4-8`). Template-level: baked by `agentbox prepare --provider e2b --size <spec>`; E2B rejects per-create resources.",
|
|
64
64
|
imageDesc: "Per-provider override of `box.image` for e2b (template id or `name:tag`, e.g. `agentbox-base:latest`). Written by `agentbox prepare --provider e2b`."
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: "digitalocean",
|
|
68
|
+
kind: "cloud",
|
|
69
|
+
label: "DigitalOcean (cloud VPS)",
|
|
70
|
+
loginHint: "paste a Personal Access Token from the DigitalOcean Console",
|
|
71
|
+
rebuildMinutes: "7-10",
|
|
72
|
+
blurb: "DigitalOcean Droplets",
|
|
73
|
+
sizeDesc: "Per-provider override of `box.size` for digitalocean. Droplet size slug (e.g. `s-2vcpu-4gb`, `s-4vcpu-8gb`).",
|
|
74
|
+
imageDesc: "Per-provider override of `box.image` for digitalocean (numeric snapshot id). Written by `agentbox prepare --provider digitalocean`."
|
|
65
75
|
}
|
|
66
76
|
];
|
|
67
77
|
var PROVIDER_NAMES = PROVIDERS.map((p) => p.name);
|
|
@@ -92,12 +102,14 @@ var BUILT_IN_DEFAULTS = {
|
|
|
92
102
|
defaultCheckpointHetzner: "",
|
|
93
103
|
defaultCheckpointVercel: "",
|
|
94
104
|
defaultCheckpointE2b: "",
|
|
105
|
+
defaultCheckpointDigitalocean: "",
|
|
95
106
|
size: "",
|
|
96
107
|
sizeDocker: "",
|
|
97
108
|
sizeDaytona: "",
|
|
98
109
|
sizeHetzner: "",
|
|
99
110
|
sizeVercel: "",
|
|
100
111
|
sizeE2b: "",
|
|
112
|
+
sizeDigitalocean: "",
|
|
101
113
|
withPlaywright: false,
|
|
102
114
|
claudeInstall: "native",
|
|
103
115
|
withEnv: false,
|
|
@@ -114,6 +126,7 @@ var BUILT_IN_DEFAULTS = {
|
|
|
114
126
|
imageHetzner: "",
|
|
115
127
|
imageVercel: "",
|
|
116
128
|
imageE2b: "",
|
|
129
|
+
imageDigitalocean: "",
|
|
117
130
|
// Mirrors BOX_IMAGE_REGISTRY in @agentbox/sandbox-docker. Empty disables the
|
|
118
131
|
// registry pull (always build the docker base image locally).
|
|
119
132
|
imageRegistry: "ghcr.io/madarco/agentbox/box",
|
|
@@ -123,11 +136,14 @@ var BUILT_IN_DEFAULTS = {
|
|
|
123
136
|
pidsLimit: 0,
|
|
124
137
|
disk: "",
|
|
125
138
|
bundleDepth: void 0,
|
|
126
|
-
|
|
139
|
+
hetznerLocation: "nbg1",
|
|
140
|
+
digitaloceanRegion: "nyc3",
|
|
127
141
|
vercelTimeoutMs: 27e5,
|
|
128
142
|
vercelNetworkPolicy: "",
|
|
129
143
|
e2bTimeoutMs: 27e5,
|
|
130
|
-
cpMaxBytes: 100 * 1024 * 1024
|
|
144
|
+
cpMaxBytes: 100 * 1024 * 1024,
|
|
145
|
+
credentialSync: true,
|
|
146
|
+
inbound: "locked"
|
|
131
147
|
},
|
|
132
148
|
checkpoint: {
|
|
133
149
|
maxLayers: 3
|
|
@@ -258,7 +274,7 @@ var KEY_REGISTRY = [
|
|
|
258
274
|
{
|
|
259
275
|
key: "box.size",
|
|
260
276
|
type: "string",
|
|
261
|
-
description: "Default VM size for cloud providers. Provider-interpreted: hetzner = server type (e.g. `cx33`); daytona = `cpu-memory-disk` GB (e.g. `4-8-20`). Used as fallback when no per-provider override is set. Docker
|
|
277
|
+
description: "Default VM size for cloud providers. Provider-interpreted: hetzner = server type (e.g. `cx33`); daytona = `cpu-memory-disk` GB (e.g. `4-8-20`); vercel = vCPU count (1, 2, 4, 8); e2b = `cpu-memory` GB (e.g. `4-8`). Used as fallback when no per-provider override is set. Docker ignores it."
|
|
262
278
|
},
|
|
263
279
|
...perProviderSizeKeys(),
|
|
264
280
|
{
|
|
@@ -363,9 +379,14 @@ var KEY_REGISTRY = [
|
|
|
363
379
|
description: "Cap git bundle history shipped to cloud sandboxes (daytona, hetzner). 0 = full history. Unset = adaptive default (last 200 commits; re-bundle at 100 if the bundle exceeds 20 MB). Ignored for docker (which bind-mounts .git/)."
|
|
364
380
|
},
|
|
365
381
|
{
|
|
366
|
-
key: "box.
|
|
367
|
-
type: "
|
|
368
|
-
description: "
|
|
382
|
+
key: "box.hetznerLocation",
|
|
383
|
+
type: "string",
|
|
384
|
+
description: "Hetzner datacenter location new --provider hetzner boxes are created in (e.g. `nbg1`, `fsn1`, `hel1`, `ash`). Default `nbg1`. Overridable per-create with `--location`. Hetzner-only; ignored by other providers."
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
key: "box.digitaloceanRegion",
|
|
388
|
+
type: "string",
|
|
389
|
+
description: "DigitalOcean region new --provider digitalocean boxes are created in (e.g. `nyc3`, `nyc1`, `sfo3`, `ams3`, `fra1`). Default `nyc3`. Overridable per-create with `--location`. DigitalOcean-only; ignored by other providers."
|
|
369
390
|
},
|
|
370
391
|
{
|
|
371
392
|
key: "box.vercelTimeoutMs",
|
|
@@ -383,6 +404,16 @@ var KEY_REGISTRY = [
|
|
|
383
404
|
description: "Max bytes a single host\u2192box copy may transfer after excludes, shared by `agentbox cp` (blocked with a size breakdown unless --yes) and each `carry:` entry (rejected at resolve time). Default 104857600 (100 MiB).",
|
|
384
405
|
advanced: true
|
|
385
406
|
},
|
|
407
|
+
{
|
|
408
|
+
key: "box.credentialSync",
|
|
409
|
+
type: "bool",
|
|
410
|
+
description: "Automatically sync refreshed agent credentials (claude/codex/opencode) from boxes to the host backup and out to all other running boxes. Claude OAuth refresh rotates the refresh token, so without this every other copy 401s after any box refreshes. Default true; --no-credential-sync at create disables the in-box watcher for that box."
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
key: "box.inbound",
|
|
414
|
+
type: "string",
|
|
415
|
+
description: "Inbound-access policy for VPS boxes (hetzner, digitalocean per-box firewall). `locked` (default) = SSH reachable only from your host's egress IP; `open` = SSH reachable from anywhere (0.0.0.0/0, key-only \u2014 to drive a box from a phone with the laptop off); a CIDR list (e.g. `203.0.113.5/32`) = host egress plus those. Override per box with `--inbound` or after create with `agentbox inbound <box>`. Ignored by non-VPS providers."
|
|
416
|
+
},
|
|
386
417
|
{
|
|
387
418
|
key: "box.vercelNetworkPolicy",
|
|
388
419
|
type: "string",
|
|
@@ -496,8 +527,8 @@ var KEY_REGISTRY = [
|
|
|
496
527
|
{
|
|
497
528
|
key: "git.pushMode",
|
|
498
529
|
type: "enum",
|
|
499
|
-
enumValues: ["auto", "relay", "lease"],
|
|
500
|
-
description: "How a box's `git push` reaches GitHub: `relay` (the host relay pushes with your host credentials \u2014 they never enter the box), `lease` (the relay/plane leases a short-lived GitHub-App token and the box pushes directly, so it works with the laptop off), or `auto` (default \u2014 lease when `relay.controlPlaneUrl` is set for the box, else relay). Only affects cloud boxes; docker boxes always use `relay`. Forcing `relay` needs a reachable host relay for the box; forcing `lease` needs a reachable relay/plane with a GitHub App."
|
|
530
|
+
enumValues: ["auto", "relay", "lease", "direct"],
|
|
531
|
+
description: "How a box's `git push` reaches GitHub: `relay` (the host relay pushes with your host credentials \u2014 they never enter the box), `lease` (the relay/plane leases a short-lived GitHub-App token and the box pushes directly, so it works with the laptop off), `direct` (the box holds a COPY of your git credentials and pushes/pulls/signs entirely on its own \u2014 needs no host or hub, but the credentials live inside the box and its snapshots; set via `--with-credentials`, which copies them in behind a confirmation), or `auto` (default \u2014 lease when `relay.controlPlaneUrl` is set for the box, else relay). Only affects cloud boxes; docker boxes always use `relay`. Forcing `relay` needs a reachable host relay for the box; forcing `lease` needs a reachable relay/plane with a GitHub App; `direct` needs credentials to have been copied into the box at create time."
|
|
501
532
|
},
|
|
502
533
|
{
|
|
503
534
|
key: "vnc.containerPort",
|
|
@@ -1246,4 +1277,4 @@ export {
|
|
|
1246
1277
|
registerProject,
|
|
1247
1278
|
unregisterProject
|
|
1248
1279
|
};
|
|
1249
|
-
//# sourceMappingURL=chunk-
|
|
1280
|
+
//# sourceMappingURL=chunk-UIRBYL4G.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../packages/config/src/providers.ts","../../../packages/config/src/types.ts","../../../packages/config/src/parse.ts","../../../packages/config/src/paths.ts","../../../packages/config/src/load.ts","../../../packages/config/src/image.ts","../../../packages/config/src/checkpoint.ts","../../../packages/config/src/size.ts","../../../packages/config/src/write.ts"],"sourcesContent":["/**\n * Single source of truth for the set of sandbox providers.\n *\n * Adding one row to `PROVIDERS` is the *only* place a new provider's identity\n * has to be registered. This table drives, by derivation:\n * - the `ProviderKind` union (below),\n * - the `box.provider` enum + its description (see `types.ts`),\n * - the per-provider `box.image<P>` / `box.size<P>` / `box.defaultCheckpoint<P>`\n * entries in `KEY_REGISTRY` (generated in `types.ts`),\n * - the CLI's known/cloud provider lists, the install-wizard picker\n * labels/hints, the wizard's rebuild-time estimate, and the doctor groups.\n *\n * The interface fields on `UserConfig`/`EffectiveConfig` and the JSON schema\n * still list the per-provider keys explicitly (static types can't be generated\n * from a runtime array); a test (`test/providers.test.ts`) fails if either\n * drifts from this table.\n */\n\nexport interface ProviderMeta {\n /** Canonical name — MUST equal the `@agentbox/sandbox-<name>` package suffix. */\n readonly name: string;\n /** 'local' = docker; 'cloud' = has a CloudBackend + a prepared base snapshot. */\n readonly kind: 'local' | 'cloud';\n /** Human label for the install-wizard picker. */\n readonly label: string;\n /** One-line hint for the install-wizard picker. */\n readonly loginHint: string;\n /** Rough base-image/snapshot bake time (minutes) shown by the install wizard. */\n readonly rebuildMinutes: string;\n /** Fragment describing this backend, joined into the `box.provider` enum description. */\n readonly blurb: string;\n /** Description of the per-provider `box.size<P>` KEY_REGISTRY entry. */\n readonly sizeDesc: string;\n /** Description of the per-provider `box.image<P>` KEY_REGISTRY entry. */\n readonly imageDesc: string;\n}\n\nexport const PROVIDERS = [\n {\n name: 'docker',\n kind: 'local',\n label: 'Docker (local)',\n loginHint: 'builds a ~1GB local image; no login needed',\n rebuildMinutes: '1',\n blurb: 'local Docker containers',\n sizeDesc:\n 'Per-provider override of `box.size` for docker. Reserved — docker sizing is controlled via `box.memory` / `box.cpus` / `box.disk`.',\n imageDesc:\n 'Per-provider override of `box.image` for docker (local docker image ref, e.g. `agentbox/box:dev`). Wins over the generic when set.',\n },\n {\n name: 'daytona',\n kind: 'cloud',\n label: 'Daytona (cloud sandbox)',\n loginHint: 'approve a browser sign-in link',\n rebuildMinutes: '7',\n blurb: 'Daytona Cloud sandboxes',\n sizeDesc:\n 'Per-provider override of `box.size` for daytona. `cpu-memory-disk` GB spec (e.g. `4-8-20`). Only honored on the image/Dockerfile create path; on the snapshot path the size is fixed at bake time (Daytona rejects custom resources on snapshot-resume).',\n imageDesc:\n 'Per-provider override of `box.image` for daytona (named snapshot, e.g. `agentbox-base-<fingerprint>`). Written by `agentbox prepare --provider daytona`.',\n },\n {\n name: 'hetzner',\n kind: 'cloud',\n label: 'Hetzner (cloud VPS)',\n loginHint: 'paste an API token from the Hetzner Console',\n rebuildMinutes: '7-10',\n blurb: 'Hetzner Cloud VPSes',\n sizeDesc:\n 'Per-provider override of `box.size` for hetzner. Server type string (e.g. `cx23`, `cx33`, `cx43`).',\n imageDesc:\n 'Per-provider override of `box.image` for hetzner (image description, e.g. `agentbox-base-<fingerprint>`). Written by `agentbox prepare --provider hetzner`.',\n },\n {\n name: 'vercel',\n kind: 'cloud',\n label: 'Vercel (cloud microVM)',\n loginHint: 'installs the Vercel sandbox CLI, then a browser sign-in',\n rebuildMinutes: '5-10',\n blurb: 'Vercel Sandboxes',\n sizeDesc:\n 'Per-provider override of `box.size` for vercel. vCPU count — one of `1`, `2`, `4`, `8` (Vercel couples RAM at 2048 MB/vCPU). Default 2.',\n imageDesc:\n 'Per-provider override of `box.image` for vercel (snapshot id, e.g. `snap_…`). Written by `agentbox prepare --provider vercel`.',\n },\n {\n name: 'e2b',\n kind: 'cloud',\n label: 'E2B (cloud microVM)',\n loginHint: 'paste an API key from the E2B dashboard',\n rebuildMinutes: '2',\n blurb: 'E2B microVMs',\n sizeDesc:\n 'Per-provider override of `box.size` for e2b. `cpu-memory` GB spec (e.g. `4-8`). Template-level: baked by `agentbox prepare --provider e2b --size <spec>`; E2B rejects per-create resources.',\n imageDesc:\n 'Per-provider override of `box.image` for e2b (template id or `name:tag`, e.g. `agentbox-base:latest`). Written by `agentbox prepare --provider e2b`.',\n },\n {\n name: 'digitalocean',\n kind: 'cloud',\n label: 'DigitalOcean (cloud VPS)',\n loginHint: 'paste a Personal Access Token from the DigitalOcean Console',\n rebuildMinutes: '7-10',\n blurb: 'DigitalOcean Droplets',\n sizeDesc:\n 'Per-provider override of `box.size` for digitalocean. Droplet size slug (e.g. `s-2vcpu-4gb`, `s-4vcpu-8gb`).',\n imageDesc:\n 'Per-provider override of `box.image` for digitalocean (numeric snapshot id). Written by `agentbox prepare --provider digitalocean`.',\n },\n] as const satisfies readonly ProviderMeta[];\n\n/** Sandbox backend new boxes are created on. Derived from the `PROVIDERS` table. */\nexport type ProviderKind = (typeof PROVIDERS)[number]['name'];\n\n/** All provider names, in canonical order. */\nexport const PROVIDER_NAMES: readonly ProviderKind[] = PROVIDERS.map((p) => p.name);\n\n/** Cloud provider names only (everything except docker). */\nexport const CLOUD_PROVIDER_NAMES: readonly ProviderKind[] = PROVIDERS.filter(\n (p) => p.kind === 'cloud',\n).map((p) => p.name);\n\nexport function isProviderKind(name: string): name is ProviderKind {\n return (PROVIDER_NAMES as readonly string[]).includes(name);\n}\n\nexport function providerMeta(name: ProviderKind): ProviderMeta {\n const m = PROVIDERS.find((p) => p.name === name);\n if (!m) throw new Error(`unknown provider: ${String(name)}`);\n return m;\n}\n\n/**\n * Capitalize a provider name for its config-key suffix: `e2b` -> `E2b`,\n * `docker` -> `Docker`, `digitalocean` -> `Digitalocean`. First char upper,\n * the rest verbatim — matches the hand-written keys this table replaced.\n */\nexport function providerKeyCap(name: string): string {\n return name.charAt(0).toUpperCase() + name.slice(1);\n}\n\n/** Per-provider config key, e.g. `('image','hetzner')` -> `'box.imageHetzner'`. */\nexport function perProviderConfigKey(\n base: 'image' | 'size' | 'defaultCheckpoint',\n provider: string,\n): string {\n return `box.${base}${providerKeyCap(provider)}`;\n}\n","/**\n * Layered user config. The same shape is accepted at three layers:\n * - global ~/.agentbox/config.yaml\n * - project ~/.agentbox/projects/<hash>/config.yaml\n * - workspace defaults: block in ./agentbox.yaml\n *\n * Plus a CLI-flag layer at runtime. Precedence (highest wins):\n * cli > workspace > project > global > built-in defaults.\n */\n\nimport {\n PROVIDERS,\n PROVIDER_NAMES,\n perProviderConfigKey,\n type ProviderKind,\n} from './providers.js';\n\nexport type IdeFlavor = 'vscode' | 'cursor' | 'auto';\nexport type EngineKind = 'orbstack' | 'docker-desktop' | 'other' | 'auto';\nexport type BrowserKind = 'agent-browser' | 'playwright' | 'both';\n/** Sandbox backend new boxes are created on. Defined in `providers.ts` (the single source of truth) and re-exported here for back-compat. */\nexport type { ProviderKind };\n/**\n * How the base image/snapshot installs Claude Code at bake time. `native`\n * (Anthropic's installer, the default) or `npm` (`@anthropic-ai/claude-code`) —\n * an opt-in fallback for cloud egress IPs whose CDN the native installer 403s.\n */\nexport type ClaudeInstallMethod = 'native' | 'npm';\n/**\n * How a box's `git push` reaches GitHub:\n * - `relay` — the box asks the host relay to push with the HOST's credentials\n * (they never enter the box). Docker boxes always use this; for a cloud box it\n * runs through the host relay's cloud poller (git-bundle pull-back).\n * - `lease` — the relay/plane leases a short-lived GitHub-App token and the box\n * pushes directly with it (keeps working with the laptop off). Needs a\n * reachable relay/plane with a GitHub App configured.\n * - `direct` — the box holds a COPY of your git credentials (token + SSH key)\n * and pushes/pulls/signs entirely on its own, so it keeps working with the\n * laptop off and needs no hub. Selected via `--with-credentials`, which copies\n * the credentials in behind a confirmation prompt. Dangerous: the credentials\n * live inside the box and in any snapshot/checkpoint of it. Cloud boxes only.\n * - `auto` (default) — lease when a control plane is configured for the box\n * (`relay.controlPlaneUrl`), else relay. Today's behavior.\n * Docker boxes ignore this (always `relay` — they bind-mount the host `.git`).\n */\nexport type GitPushMode = 'auto' | 'relay' | 'lease' | 'direct';\n/** Where `agentbox claude|codex|opencode` opens the attached session when the host\n * shell is running inside tmux, cmux, Herdr, or iTerm2. `same` keeps today's inline behavior. */\nexport type AttachOpenIn = 'split' | 'window' | 'tab' | 'same';\n/** Where a background `-i` (queued) run opens the box once the worker has created\n * it. `none` (default) opens nothing — the historical behavior. The open is\n * driven by the host relay's queue worker when the box becomes ready, not at\n * submit time, so there is no `same` (inline) mode here. */\nexport type QueueOpenIn = 'none' | 'split' | 'window' | 'tab';\n\nexport interface UserConfig {\n /**\n * Config-file shape version. Stamped to `1` on first write so future\n * migrations (e.g. a renamed key, a leaf-shape change) have a stable\n * read-time discriminator. No behavioural effect yet — placeholder for\n * later. Loader strips it before merge so it never leaks into\n * `EffectiveConfig`.\n */\n schema?: number;\n box?: {\n provider?: ProviderKind;\n hostSnapshot?: boolean;\n defaultCheckpoint?: string;\n /** Per-provider override of `defaultCheckpoint`. Resolved before falling back to the global. */\n defaultCheckpointDocker?: string;\n defaultCheckpointDaytona?: string;\n defaultCheckpointHetzner?: string;\n defaultCheckpointVercel?: string;\n defaultCheckpointE2b?: string;\n defaultCheckpointDigitalocean?: string;\n /**\n * Generic VM-size fallback for cloud providers. Provider-interpreted:\n * Hetzner = server type string (e.g. `cx33`); Daytona = `cpu-memory-disk`\n * GB spec (e.g. `4-8-20`); Vercel = vCPU count (`1`/`2`/`4`/`8`);\n * E2B = `cpu-memory` GB spec (e.g. `4-8`), applied at `prepare` time.\n * Per-provider `size{Provider}` wins over this. Docker ignores it (it uses\n * `memory`/`cpus`/`disk`).\n */\n size?: string;\n sizeDocker?: string;\n sizeDaytona?: string;\n sizeHetzner?: string;\n sizeVercel?: string;\n sizeE2b?: string;\n sizeDigitalocean?: string;\n withPlaywright?: boolean;\n /**\n * How the base image/snapshot installs Claude Code at bake time. Bake-time\n * only (read by `agentbox prepare`, not `create`); `npm` is a fallback for\n * cloud egress IPs the native installer's CDN 403s.\n */\n claudeInstall?: ClaudeInstallMethod;\n withEnv?: boolean;\n resyncOnStart?: boolean;\n vnc?: boolean;\n autoApproveHostActions?: boolean;\n autoApproveSafeHostActions?: boolean;\n isolateClaudeConfig?: boolean;\n isolateCodexConfig?: boolean;\n isolateOpencodeConfig?: boolean;\n image?: string;\n /**\n * Per-provider override of `image`. Written by `agentbox prepare\n * --provider <name>` so a daytona prepare can't poison a hetzner create.\n * Resolved before falling back to the generic.\n */\n imageDocker?: string;\n imageDaytona?: string;\n imageHetzner?: string;\n imageVercel?: string;\n imageE2b?: string;\n imageDigitalocean?: string;\n imageRegistry?: string;\n dockerCacheShared?: boolean;\n memory?: number;\n cpus?: number;\n pidsLimit?: number;\n disk?: string;\n bundleDepth?: number;\n hetznerLocation?: string;\n digitaloceanRegion?: string;\n vercelTimeoutMs?: number;\n vercelNetworkPolicy?: string;\n e2bTimeoutMs?: number;\n cpMaxBytes?: number;\n credentialSync?: boolean;\n inbound?: string;\n };\n checkpoint?: {\n maxLayers?: number;\n };\n claude?: {\n sessionName?: string;\n dangerouslySkipPermissions?: boolean;\n };\n codex?: {\n sessionName?: string;\n dangerouslySkipPermissions?: boolean;\n };\n opencode?: {\n sessionName?: string;\n };\n attach?: {\n openIn?: AttachOpenIn;\n cmuxStatus?: boolean;\n herdrStatus?: boolean;\n };\n code?: {\n ide?: IdeFlavor;\n wait?: boolean;\n timeoutMs?: number;\n autoTerminals?: boolean;\n };\n shell?: {\n user?: string;\n login?: boolean;\n tmux?: boolean;\n };\n ssh?: {\n autoConfig?: boolean;\n };\n engine?: {\n kind?: EngineKind;\n };\n browser?: {\n default?: BrowserKind;\n };\n relay?: {\n port?: number;\n /**\n * Public HTTPS URL of a deployed control plane (the hosted Next.js +\n * Postgres app). When set, newly created cloud boxes point at it for their\n * centralized concerns — git-token leasing, permission state, the box\n * registry/events — and push to GitHub directly with a leased token, so\n * they keep working with the laptop off. Empty/unset = laptop-local relay\n * (the default). Set via `agentbox control-plane set-url`.\n */\n controlPlaneUrl?: string;\n };\n git?: {\n pushMode?: GitPushMode;\n };\n vnc?: {\n containerPort?: number;\n };\n portless?: {\n enabled?: boolean;\n stateDir?: string;\n };\n autopause?: {\n enabled?: boolean;\n maxRunningBoxes?: number;\n idleMinutes?: number;\n };\n queue?: {\n enabled?: boolean;\n maxConcurrent?: number;\n maxWorking?: number;\n idleGraceSeconds?: number;\n openIn?: QueueOpenIn;\n };\n cloud?: {\n useCurrentBranch?: boolean;\n };\n maintenance?: {\n pruneProjectConfigs?: boolean;\n pruneProjectConfigsEvery?: number;\n };\n update?: {\n /**\n * Daily background check for a newer published CLI (npm registry) and\n * tray app (release sha sidecar), plus the \"newer version available\"\n * nudge it feeds. At most one network probe per 24h; `false` disables\n * both the probe and the nudge.\n */\n check?: boolean;\n };\n integrations?: {\n notion?: {\n enabled?: boolean;\n };\n linear?: {\n enabled?: boolean;\n };\n };\n}\n\n/**\n * Required-everywhere variant returned as the merged effective config. Each\n * leaf is filled from BUILT_IN_DEFAULTS when no layer set it.\n *\n * `box.hostSnapshot` and `portless.enabled` are intentionally\n * `boolean | undefined` (unprompted): the default is \"ask the user\", expressed\n * as undefined.\n */\nexport interface EffectiveConfig {\n box: {\n provider: ProviderKind;\n hostSnapshot: boolean | undefined;\n defaultCheckpoint: string;\n defaultCheckpointDocker: string;\n defaultCheckpointDaytona: string;\n defaultCheckpointHetzner: string;\n defaultCheckpointVercel: string;\n defaultCheckpointE2b: string;\n defaultCheckpointDigitalocean: string;\n size: string;\n sizeDocker: string;\n sizeDaytona: string;\n sizeHetzner: string;\n sizeVercel: string;\n sizeE2b: string;\n sizeDigitalocean: string;\n withPlaywright: boolean;\n claudeInstall: ClaudeInstallMethod;\n withEnv: boolean;\n resyncOnStart: boolean;\n vnc: boolean;\n autoApproveHostActions: boolean;\n autoApproveSafeHostActions: boolean;\n isolateClaudeConfig: boolean;\n isolateCodexConfig: boolean;\n isolateOpencodeConfig: boolean;\n image: string;\n imageDocker: string;\n imageDaytona: string;\n imageHetzner: string;\n imageVercel: string;\n imageE2b: string;\n imageDigitalocean: string;\n imageRegistry: string;\n dockerCacheShared: boolean;\n memory: number;\n cpus: number;\n pidsLimit: number;\n disk: string;\n bundleDepth: number | undefined;\n hetznerLocation: string;\n digitaloceanRegion: string;\n vercelTimeoutMs: number;\n vercelNetworkPolicy: string;\n e2bTimeoutMs: number;\n cpMaxBytes: number;\n credentialSync: boolean;\n inbound: string;\n };\n checkpoint: {\n maxLayers: number;\n };\n claude: {\n sessionName: string;\n dangerouslySkipPermissions: boolean;\n };\n codex: {\n sessionName: string;\n dangerouslySkipPermissions: boolean;\n };\n opencode: {\n sessionName: string;\n };\n attach: {\n openIn: AttachOpenIn;\n cmuxStatus: boolean;\n herdrStatus: boolean;\n };\n code: {\n ide: IdeFlavor;\n wait: boolean;\n timeoutMs: number;\n autoTerminals: boolean;\n };\n shell: {\n user: string;\n login: boolean;\n tmux: boolean;\n };\n ssh: {\n autoConfig: boolean;\n };\n engine: {\n kind: EngineKind;\n };\n browser: {\n default: BrowserKind;\n };\n relay: {\n port: number;\n controlPlaneUrl: string | undefined;\n };\n git: {\n pushMode: GitPushMode;\n };\n vnc: {\n containerPort: number;\n };\n portless: {\n enabled: boolean | undefined;\n stateDir: string;\n };\n autopause: {\n enabled: boolean;\n maxRunningBoxes: number;\n idleMinutes: number;\n };\n queue: {\n enabled: boolean;\n maxConcurrent: number;\n maxWorking: number;\n idleGraceSeconds: number;\n openIn: QueueOpenIn;\n };\n cloud: {\n useCurrentBranch: boolean;\n };\n maintenance: {\n pruneProjectConfigs: boolean;\n pruneProjectConfigsEvery: number;\n };\n update: {\n check: boolean;\n };\n integrations: {\n notion: {\n enabled: boolean;\n };\n linear: {\n enabled: boolean;\n };\n };\n}\n\nexport type ConfigSource = 'cli' | 'workspace' | 'project' | 'global' | 'default';\n\nexport interface ConfigLayer {\n source: ConfigSource;\n /** File path the layer was loaded from. Absent for `cli` and `default`. */\n path?: string;\n values: Partial<UserConfig>;\n}\n\nexport interface LoadedConfig {\n effective: EffectiveConfig;\n layers: {\n cli: { values: Partial<UserConfig> };\n workspace: { path: string | null; values: Partial<UserConfig> };\n project: { path: string; values: Partial<UserConfig> };\n global: { path: string; values: Partial<UserConfig> };\n defaults: EffectiveConfig;\n };\n /** Per-leaf source map: 'box.hostSnapshot' -> 'workspace'. Powers `config get --all`. */\n sources: Record<string, ConfigSource>;\n /** Resolved project root used for the project layer (cwd if no agentbox.yaml found). */\n projectRoot: string;\n projectHash: string;\n /** True if we walked up to an agentbox.yaml; false if we fell back to cwd. */\n hasAgentboxYaml: boolean;\n}\n\nexport const BUILT_IN_DEFAULTS: EffectiveConfig = {\n box: {\n provider: 'docker',\n hostSnapshot: undefined,\n defaultCheckpoint: '',\n defaultCheckpointDocker: '',\n defaultCheckpointDaytona: '',\n defaultCheckpointHetzner: '',\n defaultCheckpointVercel: '',\n defaultCheckpointE2b: '',\n defaultCheckpointDigitalocean: '',\n size: '',\n sizeDocker: '',\n sizeDaytona: '',\n sizeHetzner: '',\n sizeVercel: '',\n sizeE2b: '',\n sizeDigitalocean: '',\n withPlaywright: false,\n claudeInstall: 'native',\n withEnv: false,\n resyncOnStart: true,\n vnc: true,\n autoApproveHostActions: false,\n autoApproveSafeHostActions: true,\n isolateClaudeConfig: false,\n isolateCodexConfig: false,\n isolateOpencodeConfig: false,\n image: 'agentbox/box:dev',\n imageDocker: '',\n imageDaytona: '',\n imageHetzner: '',\n imageVercel: '',\n imageE2b: '',\n imageDigitalocean: '',\n // Mirrors BOX_IMAGE_REGISTRY in @agentbox/sandbox-docker. Empty disables the\n // registry pull (always build the docker base image locally).\n imageRegistry: 'ghcr.io/madarco/agentbox/box',\n dockerCacheShared: false,\n memory: 0,\n cpus: 0,\n pidsLimit: 0,\n disk: '',\n bundleDepth: undefined,\n hetznerLocation: 'nbg1',\n digitaloceanRegion: 'nyc3',\n vercelTimeoutMs: 2_700_000,\n vercelNetworkPolicy: '',\n e2bTimeoutMs: 2_700_000,\n cpMaxBytes: 100 * 1024 * 1024,\n credentialSync: true,\n inbound: 'locked',\n },\n checkpoint: {\n maxLayers: 3,\n },\n claude: {\n sessionName: 'claude',\n dangerouslySkipPermissions: true,\n },\n codex: {\n sessionName: 'codex',\n dangerouslySkipPermissions: true,\n },\n opencode: {\n sessionName: 'opencode',\n },\n attach: {\n openIn: 'split',\n cmuxStatus: true,\n herdrStatus: true,\n },\n code: {\n ide: 'auto',\n wait: true,\n timeoutMs: 120_000,\n autoTerminals: true,\n },\n shell: {\n user: 'vscode',\n login: true,\n tmux: true,\n },\n ssh: {\n autoConfig: true,\n },\n engine: {\n kind: 'auto',\n },\n browser: {\n default: 'agent-browser',\n },\n relay: {\n port: 8787,\n controlPlaneUrl: undefined,\n },\n git: {\n pushMode: 'auto',\n },\n vnc: {\n containerPort: 6080,\n },\n portless: {\n enabled: undefined,\n stateDir: '',\n },\n autopause: {\n enabled: true,\n maxRunningBoxes: 5,\n idleMinutes: 5,\n },\n queue: {\n enabled: true,\n maxConcurrent: 5,\n maxWorking: 0,\n idleGraceSeconds: 15,\n openIn: 'none',\n },\n cloud: {\n useCurrentBranch: false,\n },\n maintenance: {\n pruneProjectConfigs: true,\n pruneProjectConfigsEvery: 50,\n },\n update: {\n check: true,\n },\n integrations: {\n notion: { enabled: false },\n linear: { enabled: false },\n },\n};\n\nexport type KeyType = 'bool' | 'string' | 'int' | 'enum';\n\nexport interface KeyDescriptor {\n /** Dot-path, e.g. \"box.snapshot\". */\n key: string;\n type: KeyType;\n enumValues?: readonly string[];\n description: string;\n /** True for keys most users shouldn't touch (image, ports). Hidden from `list` by default. */\n advanced?: boolean;\n}\n\n/** Join blurbs into \"a, b, c, or d\" for the enum description. */\nfunction joinOr(items: readonly string[]): string {\n if (items.length <= 1) return items.join('');\n return `${items.slice(0, -1).join(', ')}, or ${items[items.length - 1]}`;\n}\n\n/**\n * Per-provider config-key descriptors generated from the `PROVIDERS` table so a\n * new provider gets its `box.defaultCheckpoint<P>` / `box.size<P>` /\n * `box.image<P>` entries automatically. The `size`/`image` descriptions come\n * from the table (they carry provider-specific detail); the checkpoint one is\n * uniform.\n */\nfunction perProviderCheckpointKeys(): KeyDescriptor[] {\n return PROVIDERS.map((p) => ({\n key: perProviderConfigKey('defaultCheckpoint', p.name),\n type: 'string',\n description: `Per-provider override of \\`box.defaultCheckpoint\\` for ${p.name}. Wins over the global when set; set via \\`agentbox checkpoint set-default --provider ${p.name}\\`.`,\n advanced: true,\n }));\n}\nfunction perProviderSizeKeys(): KeyDescriptor[] {\n return PROVIDERS.map((p) => ({\n key: perProviderConfigKey('size', p.name),\n type: 'string',\n description: p.sizeDesc,\n advanced: true,\n }));\n}\nfunction perProviderImageKeys(): KeyDescriptor[] {\n return PROVIDERS.map((p) => ({\n key: perProviderConfigKey('image', p.name),\n type: 'string',\n description: p.imageDesc,\n advanced: true,\n }));\n}\n\n/**\n * Single source of truth for which keys are addressable from the CLI. The\n * parser, `set`/`unset`, and `list` all walk this. Adding a key here is the\n * one place a new field has to be registered (plus the type interface above\n * and the JSON schema). Per-provider `box.{image,size,defaultCheckpoint}<P>`\n * keys are generated from the `PROVIDERS` table (see `providers.ts`).\n */\nexport const KEY_REGISTRY: readonly KeyDescriptor[] = [\n {\n key: 'box.provider',\n type: 'enum',\n enumValues: PROVIDER_NAMES,\n description: `Sandbox backend new boxes are created on: ${joinOr(PROVIDERS.map((p) => p.blurb))}.`,\n },\n {\n key: 'box.hostSnapshot',\n type: 'bool',\n description:\n 'Use a frozen APFS clone of the host workspace as the overlay lower (default: prompt). Was box.snapshot.',\n },\n {\n key: 'box.defaultCheckpoint',\n type: 'string',\n description:\n 'Checkpoint ref new boxes in this project start from when --snapshot is not given (set via `agentbox checkpoint set-default`). Used as fallback when no per-provider override is set.',\n },\n ...perProviderCheckpointKeys(),\n {\n key: 'box.size',\n type: 'string',\n description:\n 'Default VM size for cloud providers. Provider-interpreted: hetzner = server type (e.g. `cx33`); daytona = `cpu-memory-disk` GB (e.g. `4-8-20`); vercel = vCPU count (1, 2, 4, 8); e2b = `cpu-memory` GB (e.g. `4-8`). Used as fallback when no per-provider override is set. Docker ignores it.',\n },\n ...perProviderSizeKeys(),\n {\n key: 'checkpoint.maxLayers',\n type: 'int',\n description:\n 'Max stacked checkpoint layers before a new checkpoint is materialized merged (flattened) instead of layered.',\n advanced: true,\n },\n {\n key: 'box.withPlaywright',\n type: 'bool',\n description: 'Install @playwright/cli@latest in the box at create time.',\n },\n {\n key: 'box.claudeInstall',\n type: 'enum',\n enumValues: ['native', 'npm'] as const,\n description:\n \"How `agentbox prepare` installs Claude Code into the base image/snapshot: `native` (Anthropic's installer, the default) or `npm` (@anthropic-ai/claude-code). A fallback for cloud egress IPs the native installer's CDN 403s. Bake-time only — change it, then re-run `agentbox prepare --provider <name>`.\",\n },\n {\n key: 'box.withEnv',\n type: 'bool',\n description:\n 'Copy host env/config files (.env*, secrets.toml, agentbox.yaml, ...) into /workspace at box create time (gitignore-bypassing).',\n },\n {\n key: 'box.resyncOnStart',\n type: 'bool',\n description:\n \"Merge the host's current branch into the box and overlay the host's uncommitted/untracked changes when starting an agent session (keeps the box's version on conflict and warns the agent).\",\n },\n {\n key: 'box.vnc',\n type: 'bool',\n description: 'Run the per-box Xvnc + noVNC stack.',\n },\n {\n key: 'box.autoApproveHostActions',\n type: 'bool',\n description:\n 'Auto-approve host-action confirmations (git push, cp host<->box, gh PR writes, checkpoint) for this box without an interactive prompt. Off by default; intended for unattended orchestration of trusted boxes. Each auto-approval is recorded as a relay event (visible in `agentbox agent` / the dashboard).',\n },\n {\n key: 'box.autoApproveSafeHostActions',\n type: 'bool',\n description:\n 'Auto-approve the SAFE subset of host actions without a prompt: opening a PR, PR/review comments, re-running CI, pushing to the box\\'s scratch or host-sanctioned branch, checkpoints, integration writes, and file copy/download that stays inside the box project folder (non-secret). Uncontained or secret file transfers, non-sanctioned-branch pushes, and PR merge/checkout still prompt. On by default; set false to prompt for every host action (the pre-relax behavior). Superseded by box.autoApproveHostActions, which approves everything. Each auto-approval is recorded as a relay event.',\n },\n {\n key: 'box.isolateClaudeConfig',\n type: 'bool',\n description: 'Use a per-box ~/.claude volume instead of the shared one.',\n },\n {\n key: 'box.isolateCodexConfig',\n type: 'bool',\n description: 'Use a per-box ~/.codex volume instead of the shared one.',\n },\n {\n key: 'box.isolateOpencodeConfig',\n type: 'bool',\n description: 'Use a per-box OpenCode config/data volume instead of the shared one.',\n },\n {\n key: 'box.image',\n type: 'string',\n description: 'Generic box image ref (fallback). Used as fallback when no per-provider override is set; the default `agentbox/box:dev` is treated as a sentinel by cloud backends (boot from their prepared base snapshot instead).',\n advanced: true,\n },\n ...perProviderImageKeys(),\n {\n key: 'box.imageRegistry',\n type: 'string',\n description:\n 'Registry repo to pull the prebuilt docker base image from before building locally. Empty = always build. Docker only (advanced).',\n advanced: true,\n },\n {\n key: 'box.dockerCacheShared',\n type: 'bool',\n description:\n \"Share the in-box docker image cache across boxes via the 'agentbox-docker-cache' volume (preserved on destroy/prune; only one box can run at a time when set).\",\n },\n {\n key: 'box.memory',\n type: 'int',\n description:\n 'Hard memory ceiling in MiB for new boxes (0 = unlimited). Use --memory on create/claude for byte/k/m/g strings.',\n },\n {\n key: 'box.cpus',\n type: 'int',\n description:\n 'CPU count cap for new boxes (0 = unlimited). Whole cores via config; use --cpus for fractional (e.g. 1.5).',\n },\n {\n key: 'box.pidsLimit',\n type: 'int',\n description: 'Max process count (PIDs cgroup) for new boxes (0 = unlimited).',\n },\n {\n key: 'box.disk',\n type: 'string',\n description:\n \"Best-effort writable-layer size for new boxes, e.g. '10G'. No-op on overlay2 / the macOS engines.\",\n advanced: true,\n },\n {\n key: 'box.bundleDepth',\n type: 'int',\n description:\n 'Cap git bundle history shipped to cloud sandboxes (daytona, hetzner). 0 = full history. Unset = adaptive default (last 200 commits; re-bundle at 100 if the bundle exceeds 20 MB). Ignored for docker (which bind-mounts .git/).',\n },\n {\n key: 'box.hetznerLocation',\n type: 'string',\n description:\n 'Hetzner datacenter location new --provider hetzner boxes are created in (e.g. `nbg1`, `fsn1`, `hel1`, `ash`). Default `nbg1`. Overridable per-create with `--location`. Hetzner-only; ignored by other providers.',\n },\n {\n key: 'box.digitaloceanRegion',\n type: 'string',\n description:\n 'DigitalOcean region new --provider digitalocean boxes are created in (e.g. `nyc3`, `nyc1`, `sfo3`, `ams3`, `fra1`). Default `nyc3`. Overridable per-create with `--location`. DigitalOcean-only; ignored by other providers.',\n },\n {\n key: 'box.vercelTimeoutMs',\n type: 'int',\n description:\n 'Max session length (ms) for new --provider vercel boxes before the VM auto-snapshots; persistent mode auto-resumes on the next call. Default 2700000 (45 min, the Hobby ceiling). Vercel-only.',\n },\n {\n key: 'box.e2bTimeoutMs',\n type: 'int',\n description:\n 'Session timeout (ms) a new --provider e2b box is created with, before E2B auto-pauses it on inactivity. The host keepalive loop pushes this forward while the agent is working. Default 2700000 (45 min); the Hobby tier caps total session at ~1 h regardless. E2B-only.',\n },\n {\n key: 'box.cpMaxBytes',\n type: 'int',\n description:\n 'Max bytes a single host→box copy may transfer after excludes, shared by `agentbox cp` (blocked with a size breakdown unless --yes) and each `carry:` entry (rejected at resolve time). Default 104857600 (100 MiB).',\n advanced: true,\n },\n {\n key: 'box.credentialSync',\n type: 'bool',\n description:\n 'Automatically sync refreshed agent credentials (claude/codex/opencode) from boxes to the host backup and out to all other running boxes. Claude OAuth refresh rotates the refresh token, so without this every other copy 401s after any box refreshes. Default true; --no-credential-sync at create disables the in-box watcher for that box.',\n },\n {\n key: 'box.inbound',\n type: 'string',\n description:\n \"Inbound-access policy for VPS boxes (hetzner, digitalocean per-box firewall). `locked` (default) = SSH reachable only from your host's egress IP; `open` = SSH reachable from anywhere (0.0.0.0/0, key-only — to drive a box from a phone with the laptop off); a CIDR list (e.g. `203.0.113.5/32`) = host egress plus those. Override per box with `--inbound` or after create with `agentbox inbound <box>`. Ignored by non-VPS providers.\",\n },\n {\n key: 'box.vercelNetworkPolicy',\n type: 'string',\n description:\n \"Egress lock for new --provider vercel boxes: 'allow-all' (default, unset), 'deny-all', or a comma-separated domain allowlist (e.g. 'github.com,*.npmjs.org') that denies everything else. Vercel-only; ignored by other providers.\",\n },\n {\n key: 'claude.sessionName',\n type: 'string',\n description: 'tmux session name for `agentbox claude`.',\n },\n {\n key: 'claude.dangerouslySkipPermissions',\n type: 'bool',\n description:\n 'Launch claude in new boxes with --dangerously-skip-permissions (auto-accept tool use). Safe because boxes are isolated; on by default. Override per-box with --no-dangerously-skip-permissions.',\n },\n {\n key: 'codex.sessionName',\n type: 'string',\n description: 'tmux session name for `agentbox codex`.',\n },\n {\n key: 'codex.dangerouslySkipPermissions',\n type: 'bool',\n description:\n 'Launch codex in new boxes with --dangerously-bypass-approvals-and-sandbox (never prompt for approval). Safe because boxes are isolated; on by default. Override per-box with --no-dangerously-skip-permissions.',\n },\n {\n key: 'opencode.sessionName',\n type: 'string',\n description: 'tmux session name for `agentbox opencode`.',\n },\n {\n key: 'attach.openIn',\n type: 'enum',\n enumValues: ['split', 'window', 'tab', 'same'] as const,\n description:\n 'Where `agentbox claude|codex|opencode` opens the attached session when run from tmux, cmux, Herdr, or iTerm2: `split` (tmux split-window / cmux new-split / Herdr pane.split / iTerm2 vertical split, default — same workspace), `window` (tmux new-window / cmux new-workspace / Herdr workspace.create / new iTerm2 window), `tab` (tmux new-window / cmux new-surface / Herdr tab.create in the current workspace / new iTerm2 tab), or `same` (attach inline in the current terminal). Outside tmux/cmux/Herdr/iTerm2 every value behaves like `same`.',\n },\n {\n key: 'attach.cmuxStatus',\n type: 'bool',\n description:\n \"When attached inside cmux, reflect the box agent's live activity on its cmux workspace (colour + description: blue=working, amber=needs input, idle clears; restored on detach) and, when the agent needs input, flag the box's own tab via a cmux notification (tab badge + reorder + desktop notification) so it stands out among sibling tabs. cmux only; no-op in other terminals.\",\n },\n {\n key: 'attach.herdrStatus',\n type: 'bool',\n description:\n \"When attached inside Herdr, report the box agent's live activity to its Herdr pane (pane.report_agent: working / blocked / idle) so it looks like a normal agent pane and Herdr handles needs-input natively, and fire a Herdr notification for AgentBox's own host-relay approval prompts (git push / PR / checkpoint …) which Herdr can't otherwise see. Herdr only; no-op in other terminals.\",\n },\n {\n key: 'code.ide',\n type: 'enum',\n enumValues: ['vscode', 'cursor', 'auto'] as const,\n description: 'Which IDE `agentbox code` launches; \"auto\" prefers code, falls back to cursor.',\n },\n {\n key: 'code.wait',\n type: 'bool',\n description: 'Block on agentbox-ctl wait-ready before opening the IDE.',\n },\n {\n key: 'code.timeoutMs',\n type: 'int',\n description: 'wait-ready timeout in milliseconds.',\n },\n {\n key: 'code.autoTerminals',\n type: 'bool',\n description: 'Generate /workspace/.vscode/tasks.json so the IDE auto-opens log panels.',\n },\n {\n key: 'shell.user',\n type: 'string',\n description: 'Default in-container user for `agentbox shell`.',\n },\n {\n key: 'shell.login',\n type: 'bool',\n description: 'Pass `-l` to bash so the login profile loads.',\n },\n {\n key: 'shell.tmux',\n type: 'bool',\n description: 'Run `agentbox shell` inside a detachable tmux session (Ctrl+a d to detach).',\n },\n {\n key: 'ssh.autoConfig',\n type: 'bool',\n description:\n 'Automatically write a `~/.agentbox/ssh/config` entry (Include\\'d from `~/.ssh/config`) for SSH-capable cloud boxes on create and start/resume, so `ssh <box>` just works. On by default; set false if you manage `~/.ssh/config` yourself. Explicit `agentbox shell --ssh-config`/`code`/`open` still write on demand regardless.',\n },\n {\n key: 'engine.kind',\n type: 'enum',\n enumValues: ['orbstack', 'docker-desktop', 'other', 'auto'] as const,\n description: 'Override the docker-engine auto-detection (used for OrbStack-only optimisations).',\n },\n {\n key: 'browser.default',\n type: 'enum',\n enumValues: ['agent-browser', 'playwright', 'both'] as const,\n description: 'Default browser stack inside the box. \"playwright\" or \"both\" implies box.withPlaywright.',\n },\n {\n key: 'relay.port',\n type: 'int',\n description: 'Host relay TCP port (advanced).',\n advanced: true,\n },\n {\n key: 'relay.controlPlaneUrl',\n type: 'string',\n description:\n 'Public HTTPS URL of a deployed control plane (hosted Next.js + Postgres app). When set, new cloud boxes point at it for git-token leasing, permission state, and the box registry/events, and push to GitHub directly with a leased token so they keep working with the laptop off. Set via `agentbox control-plane set-url`.',\n },\n {\n key: 'git.pushMode',\n type: 'enum',\n enumValues: ['auto', 'relay', 'lease', 'direct'] as const,\n description:\n \"How a box's `git push` reaches GitHub: `relay` (the host relay pushes with your host credentials — they never enter the box), `lease` (the relay/plane leases a short-lived GitHub-App token and the box pushes directly, so it works with the laptop off), `direct` (the box holds a COPY of your git credentials and pushes/pulls/signs entirely on its own — needs no host or hub, but the credentials live inside the box and its snapshots; set via `--with-credentials`, which copies them in behind a confirmation), or `auto` (default — lease when `relay.controlPlaneUrl` is set for the box, else relay). Only affects cloud boxes; docker boxes always use `relay`. Forcing `relay` needs a reachable host relay for the box; forcing `lease` needs a reachable relay/plane with a GitHub App; `direct` needs credentials to have been copied into the box at create time.\",\n },\n {\n key: 'vnc.containerPort',\n type: 'int',\n description: 'Container-side noVNC port (advanced).',\n advanced: true,\n },\n {\n key: 'portless.enabled',\n type: 'bool',\n description:\n 'Map each box web app to a https://<box-name>.localhost URL via the Portless proxy (Docker Desktop only; OrbStack already has .orb.local). Default: prompt.',\n },\n {\n key: 'portless.stateDir',\n type: 'string',\n description:\n 'Host Portless state directory to share into boxes (advanced; default: Portless’s own location).',\n advanced: true,\n },\n {\n key: 'autopause.enabled',\n type: 'bool',\n description:\n 'Let the host relay periodically pause idle boxes when more than autopause.maxRunningBoxes are running.',\n },\n {\n key: 'autopause.maxRunningBoxes',\n type: 'int',\n description:\n 'Target maximum number of simultaneously-running boxes before idle ones get auto-paused.',\n },\n {\n key: 'autopause.idleMinutes',\n type: 'int',\n description:\n 'Minutes a box must be continuously idle (claude state) before it is eligible for auto-pause.',\n },\n {\n key: 'queue.enabled',\n type: 'bool',\n description:\n 'Run `agentbox claude|codex|opencode -i <prompt>` jobs through the host-wide background queue (FIFO, capped by queue.maxConcurrent).',\n },\n {\n key: 'queue.maxConcurrent',\n type: 'int',\n description:\n 'Max number of simultaneously-running boxes (across providers) before background `-i` jobs queue up instead of starting immediately. Per-invocation override: `--max-running <n>`.',\n },\n {\n key: 'queue.maxWorking',\n type: 'int',\n description:\n 'Max agents actively working/thinking (quota-consuming) at once before background `-i` jobs queue. 0 = disabled (use the queue.maxConcurrent running-box gate). Counts all boxes, foreground + queued. Per-invocation override: `--max-working <n>`.',\n },\n {\n key: 'queue.idleGraceSeconds',\n type: 'int',\n description:\n 'Seconds an agent must stay non-working before it frees its working slot (debounce against brief idle flaps between turns). Only used when queue.maxWorking > 0.',\n },\n {\n key: 'queue.openIn',\n type: 'enum',\n enumValues: ['none', 'split', 'window', 'tab'] as const,\n description:\n 'When a background `-i` job finishes creating its box, where the host relay opens an attached terminal onto it: `none` (default — open nothing, just queue), `split`, `window`, or `tab`. Honored only when the submitting shell runs inside tmux, cmux, Herdr, or iTerm2 (the targeting is captured at submit time). Under cmux, `split` splits the pane you submitted from (falling back to the parent workspace, then a new workspace), `tab` adds a tab in the parent workspace, and `window` opens a separate workspace; under Herdr, `split` splits the pane you submitted from, `tab` adds a tab in the parent workspace, and `window` opens a separate workspace; iTerm2 opens relative to the frontmost window. Unlike `attach.openIn` there is no `same` mode — the box is created asynchronously, so it is always a fresh terminal.',\n },\n {\n key: 'cloud.useCurrentBranch',\n type: 'bool',\n description:\n \"On cloud providers (daytona/hetzner), start new boxes on the host's current branch instead of forking a new agentbox/<box-name> branch. Overridden by an explicit --use-branch / --from-branch.\",\n },\n {\n key: 'maintenance.pruneProjectConfigs',\n type: 'bool',\n description:\n 'Periodically delete ~/.agentbox/projects/<hash>/ dirs whose source workspace folder no longer exists.',\n },\n {\n key: 'maintenance.pruneProjectConfigsEvery',\n type: 'int',\n description: 'Run the orphan project-config sweep every N successful `agentbox create`.',\n },\n {\n key: 'update.check',\n type: 'bool',\n description:\n 'Daily background check for a newer published agentbox (npm registry) and menu-bar app (release sha sidecar), plus the \"newer version available\" nudge. At most one network probe per 24h; false disables both.',\n },\n {\n key: 'integrations.notion.enabled',\n type: 'bool',\n description:\n 'Enable the in-box Notion integration shim (`ntn`/`notion` commands routed via the host relay). When false (default), the relay refuses dispatch with a clear \"disabled\" error and no host process is touched.',\n },\n {\n key: 'integrations.linear.enabled',\n type: 'bool',\n description:\n 'Enable the in-box Linear integration shim (`linear` commands routed via the host relay; backed by `@schpet/linear-cli`). When false (default), the relay refuses dispatch with a clear \"disabled\" error and no host process is touched.',\n },\n];\n\nconst REGISTRY_BY_KEY = new Map<string, KeyDescriptor>(KEY_REGISTRY.map((d) => [d.key, d]));\n\nexport function lookupKey(key: string): KeyDescriptor | undefined {\n return REGISTRY_BY_KEY.get(key);\n}\n\nexport class UserConfigError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'UserConfigError';\n }\n}\n\nexport type ConfigScope = 'global' | 'project';\n","import { parse as parseYaml } from 'yaml';\nimport {\n KEY_REGISTRY,\n type KeyDescriptor,\n type UserConfig,\n UserConfigError,\n} from './types.js';\n\nfunction isPlainObject(v: unknown): v is Record<string, unknown> {\n return typeof v === 'object' && v !== null && !Array.isArray(v);\n}\n\n/** Keys removed in a rename. Surfaced with a migration hint instead of a bare \"unknown key\". */\nconst RENAMED_KEYS: ReadonlyMap<string, string> = new Map([['box.snapshot', 'box.hostSnapshot']]);\n\ninterface BranchSpec {\n name: string;\n /** Map of leaf-key (dot-suffix) → descriptor whose `key` starts with this branch. */\n leaves: Map<string, KeyDescriptor>;\n}\n\nconst BRANCHES: Map<string, BranchSpec> = (() => {\n const out = new Map<string, BranchSpec>();\n for (const desc of KEY_REGISTRY) {\n const idx = desc.key.indexOf('.');\n if (idx < 0) {\n throw new Error(`KEY_REGISTRY entry ${desc.key} must use dot-path form (branch.leaf)`);\n }\n const branch = desc.key.slice(0, idx);\n const leaf = desc.key.slice(idx + 1);\n let entry = out.get(branch);\n if (!entry) {\n entry = { name: branch, leaves: new Map() };\n out.set(branch, entry);\n }\n entry.leaves.set(leaf, desc);\n }\n return out;\n})();\n\n/**\n * Coerce a typed YAML scalar (already typed by the YAML parser) into the\n * descriptor's expected type. Strings from the CLI go through `coerceFromString`\n * instead — that path accepts e.g. \"true\" or \"120000\".\n */\nfunction coerceTypedValue(raw: unknown, desc: KeyDescriptor, where: string): unknown {\n if (raw === null) {\n throw new UserConfigError(`${where} must not be null (use \\`agentbox config unset\\` to clear)`);\n }\n switch (desc.type) {\n case 'bool':\n if (typeof raw !== 'boolean') {\n throw new UserConfigError(`${where} must be a boolean (got ${typeof raw})`);\n }\n return raw;\n case 'string':\n if (typeof raw !== 'string') {\n throw new UserConfigError(`${where} must be a string (got ${typeof raw})`);\n }\n if (raw.length === 0) {\n throw new UserConfigError(`${where} must not be empty`);\n }\n return raw;\n case 'int':\n if (typeof raw !== 'number' || !Number.isInteger(raw)) {\n throw new UserConfigError(`${where} must be an integer (got ${String(raw)})`);\n }\n return raw;\n case 'enum':\n if (typeof raw !== 'string' || !desc.enumValues!.includes(raw)) {\n throw new UserConfigError(\n `${where} must be one of: ${desc.enumValues!.join(', ')} (got ${String(raw)})`,\n );\n }\n return raw;\n }\n}\n\n/**\n * Parse a UserConfig document text (YAML). Strict: unknown branches and\n * unknown leaves throw UserConfigError so typos surface early.\n *\n * `where` is the human-readable origin for error messages, e.g. the file path.\n * Empty / whitespace-only input parses to `{}`.\n */\nexport function parseUserConfig(text: string, where: string): Partial<UserConfig> {\n let doc: unknown;\n try {\n doc = parseYaml(text);\n } catch (err) {\n throw new UserConfigError(\n `${where}: yaml parse error: ${err instanceof Error ? err.message : String(err)}`,\n );\n }\n if (doc === null || doc === undefined) return {};\n if (!isPlainObject(doc)) {\n throw new UserConfigError(`${where}: top-level must be a mapping`);\n }\n return parseUserConfigObject(doc, where);\n}\n\n/**\n * Same validation as `parseUserConfig` but starting from an already-decoded\n * object. Used when the caller has the YAML parsed (e.g. agentbox.yaml's\n * `defaults:` block).\n */\nexport function parseUserConfigObject(doc: unknown, where: string): Partial<UserConfig> {\n if (doc === null || doc === undefined) return {};\n if (!isPlainObject(doc)) {\n throw new UserConfigError(`${where}: must be a mapping`);\n }\n\n const out: Partial<UserConfig> = {};\n for (const [branchName, branchRaw] of Object.entries(doc)) {\n // Top-level `schema` is a metadata stamp written by the loader on first\n // save (future-proofs migrations). It's not a config section and never\n // appears in `EffectiveConfig`; carry it through so writers preserve it\n // round-trip, but skip the \"must be a mapping\" / leaf checks below.\n if (branchName === 'schema') {\n if (branchRaw !== undefined && branchRaw !== null) {\n if (typeof branchRaw !== 'number' || !Number.isInteger(branchRaw)) {\n throw new UserConfigError(`${where}.schema: must be an integer (got ${String(branchRaw)})`);\n }\n out.schema = branchRaw;\n }\n continue;\n }\n const branchSpec = BRANCHES.get(branchName);\n if (!branchSpec) {\n throw new UserConfigError(\n `${where}: unknown config section \"${branchName}\" (known: ${[...BRANCHES.keys()].join(', ')})`,\n );\n }\n if (branchRaw === null || branchRaw === undefined) continue;\n if (!isPlainObject(branchRaw)) {\n throw new UserConfigError(`${where}.${branchName}: must be a mapping`);\n }\n const branchOut = parseBranchObject(branchSpec, branchName, branchRaw, '', where);\n if (Object.keys(branchOut).length > 0) {\n // We've validated that each branch matches one of UserConfig's known\n // sub-objects; the indexed write keeps the union type happy.\n (out as Record<string, unknown>)[branchName] = branchOut;\n }\n }\n return out;\n}\n\n/**\n * Validate a YAML branch sub-tree against `branchSpec`'s registered leaf paths.\n * Handles nested keys like `integrations.notion.enabled` — the branch is\n * `integrations`, the leaf path is `notion.enabled`, so the YAML can be\n * written as a nested mapping. `qualifiedPrefix` is the dotted path walked so\n * far within the branch (empty at top level).\n */\nfunction parseBranchObject(\n branchSpec: BranchSpec,\n branchName: string,\n raw: Record<string, unknown>,\n qualifiedPrefix: string,\n where: string,\n): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n for (const [name, value] of Object.entries(raw)) {\n if (value === undefined) continue;\n const qualified = qualifiedPrefix ? `${qualifiedPrefix}.${name}` : name;\n const desc = branchSpec.leaves.get(qualified);\n if (desc) {\n out[name] = coerceTypedValue(value, desc, `${where}.${desc.key}`);\n continue;\n }\n // Not a leaf — descend if it's a mapping AND a deeper leaf is registered\n // beneath this path. Otherwise the key is unknown / not in the registry.\n if (isPlainObject(value) && branchHasLeafBelow(branchSpec, qualified)) {\n const sub = parseBranchObject(branchSpec, branchName, value, qualified, where);\n if (Object.keys(sub).length > 0) out[name] = sub;\n continue;\n }\n const renamedTo = RENAMED_KEYS.get(`${branchName}.${qualified}`);\n if (renamedTo) {\n throw new UserConfigError(\n `${where}.${branchName}.${qualified} was renamed to ${renamedTo} — update your config`,\n );\n }\n throw new UserConfigError(\n `${where}.${branchName}: unknown key \"${qualified}\" (known: ${[...branchSpec.leaves.keys()].join(', ')})`,\n );\n }\n return out;\n}\n\nfunction branchHasLeafBelow(branchSpec: BranchSpec, prefix: string): boolean {\n const needle = `${prefix}.`;\n for (const leaf of branchSpec.leaves.keys()) {\n if (leaf.startsWith(needle)) return true;\n }\n return false;\n}\n\n/**\n * Coerce a string (e.g. typed at the CLI by `agentbox config set`) into the\n * declared type for `key`. Booleans accept true/false/yes/no/1/0 (case\n * insensitive). Returns the typed value or throws UserConfigError.\n */\nexport function coerceFromString(key: string, raw: string): unknown {\n const desc = lookupKeyOrThrow(key);\n switch (desc.type) {\n case 'bool': {\n const v = raw.trim().toLowerCase();\n if (v === 'true' || v === 'yes' || v === '1' || v === 'on') return true;\n if (v === 'false' || v === 'no' || v === '0' || v === 'off') return false;\n throw new UserConfigError(`${key}: expected a boolean (true/false), got \"${raw}\"`);\n }\n case 'string':\n if (raw.length === 0) throw new UserConfigError(`${key}: must not be empty`);\n return raw;\n case 'int': {\n const n = Number(raw);\n if (!Number.isFinite(n) || !Number.isInteger(n)) {\n throw new UserConfigError(`${key}: expected an integer, got \"${raw}\"`);\n }\n return n;\n }\n case 'enum':\n if (!desc.enumValues!.includes(raw)) {\n throw new UserConfigError(\n `${key}: expected one of ${desc.enumValues!.join(', ')}, got \"${raw}\"`,\n );\n }\n return raw;\n }\n}\n\nfunction lookupKeyOrThrow(key: string): KeyDescriptor {\n const renamedTo = RENAMED_KEYS.get(key);\n if (renamedTo) {\n throw new UserConfigError(`${key} was renamed to ${renamedTo} — use ${renamedTo} instead`);\n }\n const idx = key.indexOf('.');\n if (idx < 0) {\n throw new UserConfigError(`unknown key \"${key}\" (must be in branch.leaf form)`);\n }\n const branch = BRANCHES.get(key.slice(0, idx));\n if (!branch) {\n throw new UserConfigError(\n `unknown config section \"${key.slice(0, idx)}\" (known: ${[...BRANCHES.keys()].join(', ')})`,\n );\n }\n const desc = branch.leaves.get(key.slice(idx + 1));\n if (!desc) {\n throw new UserConfigError(\n `unknown key \"${key}\" (known in ${branch.name}: ${[...branch.leaves.keys()].join(', ')})`,\n );\n }\n return desc;\n}\n","import { createHash } from 'node:crypto';\nimport { realpath, stat } from 'node:fs/promises';\nimport { homedir } from 'node:os';\nimport { basename, dirname, join, resolve } from 'node:path';\nimport type { ConfigScope } from './types.js';\n\nexport const STATE_DIR = join(homedir(), '.agentbox');\nexport const GLOBAL_CONFIG_FILE = join(STATE_DIR, 'config.yaml');\nexport const PROJECTS_DIR = join(STATE_DIR, 'projects');\nexport const WORKSPACE_CONFIG_BASENAME = 'agentbox.yaml';\n\nexport interface ProjectRoot {\n /** Absolute path to the resolved project root (host filesystem). */\n root: string;\n hasAgentboxYaml: boolean;\n}\n\n/**\n * Walk up from `cwd` until we find an `agentbox.yaml`. That dir is the\n * \"project\". If no ancestor has one, we fall back to `cwd` (per spec) so\n * `agentbox config` still does something sane in dirs without a workspace\n * file. The returned path is always absolute and **symlink-canonicalised**\n * via `realpath` — without this, macOS's `/tmp` symlink to `/private/tmp`\n * makes `findProjectRoot('/tmp/x')` (at create time, --workspace) and\n * `findProjectRoot(process.cwd())` (at resolve time, the same dir) return\n * different roots, breaking the per-project box index match.\n */\nexport async function findProjectRoot(cwd: string): Promise<ProjectRoot> {\n const start = await canonicalize(cwd);\n let dir = start;\n // Defensive cap on iterations: filesystem roots end with `dirname(x) === x`.\n for (let i = 0; i < 64; i++) {\n if (await fileExists(join(dir, WORKSPACE_CONFIG_BASENAME))) {\n return { root: dir, hasAgentboxYaml: true };\n }\n const parent = dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n return { root: start, hasAgentboxYaml: false };\n}\n\nasync function canonicalize(p: string): Promise<string> {\n const abs = resolve(p);\n // realpath only works for paths that exist. cwd and create-time\n // workspaces always do; fall back to the resolved (non-canonicalised)\n // path for anything else (e.g. config get from a deleted dir).\n try {\n return await realpath(abs);\n } catch {\n return abs;\n }\n}\n\nasync function fileExists(p: string): Promise<boolean> {\n try {\n const st = await stat(p);\n return st.isFile();\n } catch {\n return false;\n }\n}\n\n/**\n * SHA-1 (first 16 hex chars) of the *normalised* absolute path. We strip a\n * single trailing slash so `/foo/` and `/foo` hash identically. Case is\n * preserved — macOS APFS is case-preserving and so is the user's intent.\n */\nexport function hashProjectPath(absPath: string): string {\n const normalised = absPath.length > 1 && absPath.endsWith('/')\n ? absPath.slice(0, -1)\n : absPath;\n return createHash('sha1').update(normalised).digest('hex').slice(0, 16);\n}\n\n/**\n * Make `raw` safe to embed as the mnemonic half of an on-disk dir segment or a\n * Docker tag repo. Lowercased so docker tag repos stay valid; `-` collapses to\n * `_` so the single `-` between hash and mnemonic remains the only one (which\n * is what `listProjectsConfigured` parses on). Bounded length, never empty.\n */\nexport function sanitizeMnemonic(raw: string): string {\n return (\n raw\n .toLowerCase()\n .replace(/-/g, '_')\n .replace(/[^a-z0-9_]+/g, '_')\n .replace(/_+/g, '_')\n .replace(/^_+|_+$/g, '')\n .slice(0, 32) || 'unnamed'\n );\n}\n\n/**\n * On-disk dir segment for a project under `~/.agentbox/projects/` and\n * `~/.agentbox/checkpoints/`: `<hash>-<mnemonic>`. The hash stays the\n * canonical key; the trailing mnemonic is decorative — readers parse the hash\n * as the leading 16 hex chars and ignore the suffix.\n */\nexport function projectDirSegment(absPath: string): string {\n return `${hashProjectPath(absPath)}-${sanitizeMnemonic(basename(absPath))}`;\n}\n\nexport function projectConfigDir(absPath: string): string {\n return join(PROJECTS_DIR, projectDirSegment(absPath));\n}\n\nexport function projectConfigFile(absPath: string): string {\n return join(projectConfigDir(absPath), 'config.yaml');\n}\n\nexport function projectMetaFile(absPath: string): string {\n return join(projectConfigDir(absPath), 'meta.json');\n}\n\nexport function workspaceConfigFile(workspacePath: string): string {\n return join(workspacePath, WORKSPACE_CONFIG_BASENAME);\n}\n\n/**\n * Resolve a file path for a given scope. For `global`, no cwd is needed;\n * for `project`, `cwd` selects which project hash. Workspace path uses the\n * resolved project root (the dir holding `agentbox.yaml`, or cwd as fallback).\n */\nexport async function configPathFor(\n scope: ConfigScope | 'workspace',\n cwd: string,\n): Promise<string> {\n if (scope === 'global') return GLOBAL_CONFIG_FILE;\n const root = await findProjectRoot(cwd);\n if (scope === 'project') return projectConfigFile(root.root);\n return workspaceConfigFile(root.root);\n}\n","import { readFile } from 'node:fs/promises';\nimport { parse as parseYaml } from 'yaml';\nimport {\n findProjectRoot,\n GLOBAL_CONFIG_FILE,\n hashProjectPath,\n projectConfigFile,\n workspaceConfigFile,\n} from './paths.js';\nimport { parseUserConfig, parseUserConfigObject } from './parse.js';\nimport {\n BUILT_IN_DEFAULTS,\n type ConfigSource,\n type EffectiveConfig,\n KEY_REGISTRY,\n type LoadedConfig,\n type UserConfig,\n} from './types.js';\n\n/**\n * ENOENT-tolerant read of a UserConfig file. Anything else propagates.\n */\nasync function loadOptionalUserConfig(path: string): Promise<Partial<UserConfig>> {\n let text: string;\n try {\n text = await readFile(path, 'utf8');\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') return {};\n throw err;\n }\n return parseUserConfig(text, path);\n}\n\n/**\n * Read the `defaults:` block from `<workspacePath>/agentbox.yaml`. Returns\n * `{}` if the file is missing or has no `defaults:` key. Throws on YAML\n * parse errors or invalid `defaults:` content (so typos surface as soon as\n * the user runs anything in the workspace).\n *\n * The rest of `agentbox.yaml` is owned by `@agentbox/ctl` — we don't validate\n * it here and we don't depend on that package.\n */\nexport async function loadProjectAgentboxDefaults(\n workspacePath: string,\n): Promise<Partial<UserConfig>> {\n const path = workspaceConfigFile(workspacePath);\n let text: string;\n try {\n text = await readFile(path, 'utf8');\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') return {};\n throw err;\n }\n let doc: unknown;\n try {\n doc = parseYaml(text);\n } catch {\n // The ctl parser will surface its own error on the next box action; we\n // only throw if defaults: is present and broken (validated below).\n return {};\n }\n if (doc === null || doc === undefined || typeof doc !== 'object' || Array.isArray(doc)) {\n return {};\n }\n const defaults = (doc as Record<string, unknown>)['defaults'];\n if (defaults === undefined || defaults === null) return {};\n return parseUserConfigObject(defaults, `${path} defaults`);\n}\n\nexport interface LoadEffectiveConfigOptions {\n /** Highest-precedence layer; values supplied by command-line flags. */\n cliOverrides?: Partial<UserConfig>;\n}\n\n/**\n * Load and merge all four config sources for the cwd. Per-leaf precedence\n * (highest wins): cli > workspace > project > global > built-in defaults.\n *\n * The returned `sources` map has one entry per leaf in the registry — useful\n * for `agentbox config get --all` to show provenance.\n */\nexport async function loadEffectiveConfig(\n cwd: string,\n opts: LoadEffectiveConfigOptions = {},\n): Promise<LoadedConfig> {\n const projectRoot = await findProjectRoot(cwd);\n const projectPath = projectConfigFile(projectRoot.root);\n const workspacePath = projectRoot.hasAgentboxYaml ? workspaceConfigFile(projectRoot.root) : null;\n\n const [globalValues, projectValues, workspaceValues] = await Promise.all([\n loadOptionalUserConfig(GLOBAL_CONFIG_FILE),\n loadOptionalUserConfig(projectPath),\n workspacePath ? loadProjectAgentboxDefaults(projectRoot.root) : Promise.resolve({}),\n ]);\n\n const cliValues = opts.cliOverrides ?? {};\n\n const { effective, sources } = mergeLayers({\n cli: cliValues,\n workspace: workspaceValues,\n project: projectValues,\n global: globalValues,\n });\n\n return {\n effective,\n layers: {\n cli: { values: cliValues },\n workspace: { path: workspacePath, values: workspaceValues },\n project: { path: projectPath, values: projectValues },\n global: { path: GLOBAL_CONFIG_FILE, values: globalValues },\n defaults: BUILT_IN_DEFAULTS,\n },\n sources,\n projectRoot: projectRoot.root,\n projectHash: hashProjectPath(projectRoot.root),\n hasAgentboxYaml: projectRoot.hasAgentboxYaml,\n };\n}\n\ninterface MergeInput {\n cli: Partial<UserConfig>;\n workspace: Partial<UserConfig>;\n project: Partial<UserConfig>;\n global: Partial<UserConfig>;\n}\n\n/**\n * Walk every key in KEY_REGISTRY, pick the highest-precedence layer that has\n * a leaf value, and record the source. Lower-precedence layers never\n * overwrite a higher-precedence definition; absent leaves don't shadow.\n */\nfunction mergeLayers(input: MergeInput): {\n effective: EffectiveConfig;\n sources: Record<string, ConfigSource>;\n} {\n // Deep-clone the defaults; we'll overwrite leaves in place.\n const effective: EffectiveConfig = JSON.parse(JSON.stringify(BUILT_IN_DEFAULTS)) as EffectiveConfig;\n const sources: Record<string, ConfigSource> = {};\n\n const layerOrder: Array<{ source: ConfigSource; values: Partial<UserConfig> }> = [\n { source: 'cli', values: input.cli },\n { source: 'workspace', values: input.workspace },\n { source: 'project', values: input.project },\n { source: 'global', values: input.global },\n ];\n\n for (const desc of KEY_REGISTRY) {\n const idx = desc.key.indexOf('.');\n const branch = desc.key.slice(0, idx);\n const leaf = desc.key.slice(idx + 1);\n\n let chosen: { source: ConfigSource; value: unknown } | null = null;\n for (const layer of layerOrder) {\n const v = readLeaf(layer.values, branch, leaf);\n if (v !== undefined) {\n chosen = { source: layer.source, value: v };\n break;\n }\n }\n\n if (chosen) {\n writeLeaf(effective, branch, leaf, chosen.value);\n sources[desc.key] = chosen.source;\n } else {\n sources[desc.key] = 'default';\n }\n }\n\n return { effective, sources };\n}\n\nfunction readLeaf(\n obj: Partial<UserConfig>,\n branch: string,\n leaf: string,\n): unknown {\n let cur: unknown = (obj as Record<string, unknown>)[branch];\n for (const seg of leaf.split('.')) {\n if (cur === undefined || cur === null || typeof cur !== 'object') return undefined;\n cur = (cur as Record<string, unknown>)[seg];\n }\n return cur;\n}\n\nfunction writeLeaf(\n obj: EffectiveConfig,\n branch: string,\n leaf: string,\n value: unknown,\n): void {\n let cur: Record<string, unknown> | undefined =\n (obj as unknown as Record<string, Record<string, unknown>>)[branch];\n if (!cur) return; // BUILT_IN_DEFAULTS guarantees the branch exists\n const segs = leaf.split('.');\n for (let i = 0; i < segs.length - 1; i++) {\n const seg = segs[i]!;\n const next = cur[seg];\n if (next === undefined || next === null || typeof next !== 'object') {\n // BUILT_IN_DEFAULTS guarantees nested sub-objects exist for every\n // registered key path, so this is unreachable in practice; defaulting\n // to a fresh sub-object keeps the function total.\n cur[seg] = {};\n }\n cur = cur[seg] as Record<string, unknown>;\n }\n cur[segs[segs.length - 1]!] = value;\n}\n","/**\n * Resolve the effective box image ref for a given provider.\n *\n * Precedence (highest wins):\n * 1. `box.image<Provider>` — per-provider override\n * (`imageDocker` / `imageDaytona` / `imageHetzner` / `imageVercel`).\n * 2. `box.image` — generic fallback (defaults to `agentbox/box:dev`,\n * which cloud backends recognize as a sentinel meaning \"boot from\n * the provider's prepared base snapshot\").\n *\n * Each `agentbox prepare --provider X` writes its result into its own\n * per-provider key, so cross-provider prepares can no longer poison\n * creates on other providers.\n */\nimport type { EffectiveConfig, ProviderKind } from './types.js';\nimport { isProviderKind, perProviderConfigKey } from './providers.js';\n\n/**\n * Read a per-provider `box.<base><P>` string field off the effective config.\n * Only BUILT-IN providers have such a key; any other name — a stray value, or\n * an external plugin provider — returns '' so the caller falls through to the\n * generic `box.<base>`. For a plugin that generic is the image sentinel\n * (`agentbox/box:dev`), which the plugin's own backend maps to its prepared\n * snapshot — so a plugin never accidentally reads docker's per-provider value.\n */\nfunction perProviderValue(\n cfg: EffectiveConfig,\n base: 'image' | 'size' | 'defaultCheckpoint',\n provider: ProviderKind | string,\n): string {\n if (!isProviderKind(provider)) return '';\n const field = perProviderConfigKey(base, provider).slice('box.'.length);\n const val = (cfg.box as Record<string, unknown>)[field];\n return typeof val === 'string' ? val : '';\n}\n\nexport function resolveBoxImage(cfg: EffectiveConfig, provider: ProviderKind | string): string {\n // Unknown provider names fall back to the generic `box.image` — a stray\n // value in argv or config shouldn't crash before the validation layer.\n const perProvider = perProviderValue(cfg, 'image', provider);\n if (perProvider.length > 0) return perProvider;\n return cfg.box.image;\n}\n\nexport { perProviderValue };\n\n/**\n * Flat KEY_REGISTRY key for `agentbox prepare --provider X` to pin the\n * resulting image into the right per-provider slot; mirrors\n * `defaultCheckpointConfigKey`. Unknown provider → generic `box.image`\n * (legacy callers).\n */\nexport function boxImageConfigKey(provider: ProviderKind | string | undefined): string {\n if (provider && isProviderKind(provider)) return perProviderConfigKey('image', provider);\n return 'box.image';\n}\n","/**\n * Resolve the effective default checkpoint ref for a given provider.\n *\n * Precedence (highest wins):\n * 1. `box.defaultCheckpoint<Provider>` — per-provider override\n * (`defaultCheckpointDocker` / `defaultCheckpointDaytona` /\n * `defaultCheckpointHetzner`).\n * 2. `box.defaultCheckpoint` — global fallback (back-compat shape: every\n * pre-cloud config has this; no flag was needed).\n * 3. '' — no default.\n *\n * Returning the empty string (instead of undefined) matches the\n * `EffectiveConfig.box.defaultCheckpoint` shape so call sites that already\n * test `.length > 0` keep working unchanged.\n */\nimport type { EffectiveConfig, ProviderKind } from './types.js';\nimport { isProviderKind, perProviderConfigKey } from './providers.js';\nimport { perProviderValue } from './image.js';\n\nexport function resolveDefaultCheckpoint(\n cfg: EffectiveConfig,\n provider: ProviderKind | string,\n): string {\n // Unknown provider names fall back to the global default — a stray value in\n // config or argv shouldn't crash before the validation layer.\n const perProvider = perProviderValue(cfg, 'defaultCheckpoint', provider);\n if (perProvider.length > 0) return perProvider;\n return cfg.box.defaultCheckpoint;\n}\n\n/**\n * Config key (one of the flat KEY_REGISTRY entries) used by `agentbox\n * checkpoint set-default [--provider X]` to write the right field. Passing\n * an unknown provider falls back to the global key (legacy callers).\n */\nexport function defaultCheckpointConfigKey(provider: ProviderKind | string | undefined): string {\n if (provider && isProviderKind(provider)) {\n return perProviderConfigKey('defaultCheckpoint', provider);\n }\n return 'box.defaultCheckpoint';\n}\n","/**\n * Resolve the effective default VM size for a given cloud provider.\n *\n * Precedence (highest wins):\n * 1. `box.size<Provider>` — per-provider override\n * (`sizeDocker` / `sizeDaytona` / `sizeHetzner` / `sizeVercel`).\n * 2. `box.size` — generic fallback.\n * 3. '' — no preference; backend uses its built-in default.\n *\n * Interpretation is provider-specific:\n * - hetzner: server type string (e.g. `cx33`).\n * - daytona: `cpu-memory-disk` GB spec (e.g. `4-8-20`), baked at prepare time\n * on the snapshot path.\n * - vercel: vCPU count — `1`, `2`, `4` or `8` (RAM is coupled at 2 GB/vCPU).\n * - e2b: `cpu-memory` GB spec (e.g. `4-8`), baked at prepare time.\n * - docker: reserved (docker uses memory/cpus/disk). The key exists for\n * surface uniformity.\n *\n * Returning '' (rather than undefined) mirrors how `resolveDefaultCheckpoint`\n * shapes its result, so call sites can `.length > 0` test uniformly.\n */\nimport type { EffectiveConfig, ProviderKind } from './types.js';\nimport { perProviderValue } from './image.js';\n\nexport function resolveBoxSize(cfg: EffectiveConfig, provider: ProviderKind | string): string {\n // Unknown provider names fall back to the generic `box.size` — a stray value\n // in argv or config shouldn't crash before the validation layer.\n const perProvider = perProviderValue(cfg, 'size', provider);\n if (perProvider.length > 0) return perProvider;\n return cfg.box.size;\n}\n","import { mkdir, readFile, rename, rm, stat, writeFile } from 'node:fs/promises';\nimport { dirname, isAbsolute, join } from 'node:path';\nimport { stringify as stringifyYaml } from 'yaml';\nimport {\n configPathFor,\n findProjectRoot,\n hashProjectPath,\n PROJECTS_DIR,\n projectConfigFile,\n projectMetaFile,\n} from './paths.js';\nimport { coerceFromString, parseUserConfig } from './parse.js';\nimport { type ConfigScope, lookupKey, type UserConfig, UserConfigError } from './types.js';\nimport { readdir } from 'node:fs/promises';\n\ninterface WriteResult {\n path: string;\n /** The value we coerced and stored, after string→typed conversion. */\n coerced: unknown;\n}\n\ninterface SetOptions {\n /**\n * When true (the CLI `set` path), accept a string and coerce. When false\n * (programmatic), accept any typed value and write it through after a\n * round-trip parse for validation.\n */\n raw?: boolean;\n}\n\n/**\n * Write a single key into the chosen scope's config file. Creates parent\n * dirs and (for project scope) the meta.json sidecar. Atomic via tmp-rename.\n */\nexport async function setConfigValue(\n scope: ConfigScope,\n key: string,\n value: unknown,\n cwd: string,\n opts: SetOptions = {},\n): Promise<WriteResult> {\n if (!lookupKey(key)) {\n throw new UserConfigError(`unknown key \"${key}\"`);\n }\n\n const coerced = opts.raw && typeof value === 'string'\n ? coerceFromString(key, value)\n : value;\n\n const path = await configPathFor(scope, cwd);\n const current = await readExistingDoc(path);\n setLeaf(current, key, coerced);\n stampSchema(current);\n // Re-parse to validate the merged document; any change that produces an\n // invalid file (shouldn't be possible here, but defence-in-depth) throws.\n parseUserConfig(stringifyYaml(current), path);\n await atomicWriteYaml(path, current);\n\n if (scope === 'project') {\n const root = (await findProjectRoot(cwd)).root;\n await touchProjectMeta(root);\n }\n\n return { path, coerced };\n}\n\n/**\n * Remove a key from the chosen scope's config file. Empty parent objects are\n * pruned so the file stays tidy. ENOENT is treated as success.\n */\nexport async function unsetConfigValue(\n scope: ConfigScope,\n key: string,\n cwd: string,\n): Promise<{ path: string; existed: boolean }> {\n if (!lookupKey(key)) {\n throw new UserConfigError(`unknown key \"${key}\"`);\n }\n const path = await configPathFor(scope, cwd);\n const current = await readExistingDoc(path);\n const existed = unsetLeaf(current, key);\n if (!existed) return { path, existed: false };\n stampSchema(current);\n await atomicWriteYaml(path, current);\n if (scope === 'project') {\n const root = (await findProjectRoot(cwd)).root;\n await touchProjectMeta(root);\n }\n return { path, existed: true };\n}\n\nexport interface ProjectEntry {\n /** SHA-1 (first 16 hex chars) of `originalPath` — the canonical key. */\n hash: string;\n /**\n * On-disk dir name under `PROJECTS_DIR`. Equal to the hash for legacy\n * pre-rename dirs; `<hash>-<mnemonic>` for new dirs. Used directly when we\n * need to `rm` the dir so the call works regardless of which shape happens\n * to be on disk.\n */\n dirName: string;\n originalPath: string;\n createdAt: string | null;\n lastSeenAt: string | null;\n configPath: string;\n hasConfigFile: boolean;\n}\n\n/**\n * Enumerate per-project config dirs. The meta.json's recorded\n * `originalPath` is what we report — the hash on disk is opaque.\n */\nexport async function listProjectsConfigured(): Promise<ProjectEntry[]> {\n let entries: string[];\n try {\n entries = await readdir(PROJECTS_DIR);\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') return [];\n throw err;\n }\n const out: ProjectEntry[] = [];\n for (const dirName of entries) {\n // Dir shape is `<sha1-16>` (legacy) or `<sha1-16>-<mnemonic>` (current);\n // either way the leading 16 hex chars are the canonical key.\n const m = /^([0-9a-f]{16})(?:-.+)?$/.exec(dirName);\n if (!m) continue;\n const hash = m[1]!;\n const meta = await readMeta(dirName);\n if (!meta) continue;\n const cfgPath = projectConfigFile(meta.originalPath);\n const hasConfig = await fileExists(cfgPath);\n out.push({\n hash,\n dirName,\n originalPath: meta.originalPath,\n createdAt: meta.createdAt,\n lastSeenAt: meta.lastSeenAt,\n configPath: cfgPath,\n hasConfigFile: hasConfig,\n });\n }\n out.sort((a, b) => a.originalPath.localeCompare(b.originalPath));\n return out;\n}\n\nexport interface PruneOrphanProjectConfigsOptions {\n dryRun?: boolean;\n /** Absolute project roots of live boxes — kept even if the folder is gone. */\n protectedPaths?: string[];\n}\n\nexport interface PruneOrphanProjectConfigsResult {\n removed: { hash: string; originalPath: string }[];\n dryRun: boolean;\n}\n\n/**\n * Delete `~/.agentbox/projects/<hash>/` dirs whose recorded `originalPath`\n * workspace folder no longer exists on disk. Conservative by construction:\n * only an ENOENT on `originalPath` counts as orphaned (a transient/permission\n * error is never treated as \"deleted\"), and any path in `protectedPaths` (the\n * project roots of still-live boxes) is left alone. Best-effort and\n * idempotent — a failed `rm` is swallowed.\n */\nexport async function pruneOrphanProjectConfigs(\n opts: PruneOrphanProjectConfigsOptions = {},\n): Promise<PruneOrphanProjectConfigsResult> {\n const dryRun = opts.dryRun ?? false;\n const keep = new Set(opts.protectedPaths ?? []);\n const removed: { hash: string; originalPath: string }[] = [];\n for (const entry of await listProjectsConfigured()) {\n if (!isAbsolute(entry.originalPath) || keep.has(entry.originalPath)) continue;\n let missing = false;\n try {\n await stat(entry.originalPath);\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') missing = true;\n }\n if (!missing) continue;\n removed.push({ hash: entry.hash, originalPath: entry.originalPath });\n if (!dryRun) {\n try {\n // Remove by the on-disk dir name (originalPath is gone, so recomputing\n // the segment from it would be pointless; entry.dirName preserves\n // whichever shape — legacy `<hash>` or new `<hash>-<mnemonic>` —\n // happens to be on disk).\n await rm(join(PROJECTS_DIR, entry.dirName), { recursive: true, force: true });\n } catch {\n /* best-effort */\n }\n }\n }\n return { removed, dryRun };\n}\n\n/**\n * Sidecar counter for the periodic create-time sweep. Lives inside\n * `PROJECTS_DIR` but `listProjectsConfigured` only reads 16-hex-named dirs, so\n * a dotfile here is invisible to it.\n */\nconst PROJECT_GC_COUNTER_FILE = join(PROJECTS_DIR, '.gc.json');\n\n/** Read `{creates}` (0 if missing/corrupt), increment, atomic-write, return new value. */\nexport async function bumpProjectGcCounter(): Promise<number> {\n let prior = 0;\n try {\n const parsed = JSON.parse(await readFile(PROJECT_GC_COUNTER_FILE, 'utf8')) as {\n creates?: unknown;\n };\n if (typeof parsed.creates === 'number' && Number.isFinite(parsed.creates)) {\n prior = parsed.creates;\n }\n } catch {\n /* missing or corrupt -> start from 0 */\n }\n const next = prior + 1;\n await mkdir(PROJECTS_DIR, { recursive: true });\n const tmp = `${PROJECT_GC_COUNTER_FILE}.tmp-${process.pid.toString()}-${Date.now().toString(36)}`;\n await writeFile(tmp, JSON.stringify({ creates: next }) + '\\n', { encoding: 'utf8', mode: 0o644 });\n await rename(tmp, PROJECT_GC_COUNTER_FILE);\n return next;\n}\n\nasync function readMeta(\n dirName: string,\n): Promise<{ originalPath: string; createdAt: string | null; lastSeenAt: string | null } | null> {\n const metaPath = `${PROJECTS_DIR}/${dirName}/meta.json`;\n try {\n const text = await readFile(metaPath, 'utf8');\n const parsed = JSON.parse(text) as Record<string, unknown>;\n if (typeof parsed['originalPath'] !== 'string') return null;\n return {\n originalPath: parsed['originalPath'],\n createdAt: typeof parsed['createdAt'] === 'string' ? parsed['createdAt'] : null,\n lastSeenAt: typeof parsed['lastSeenAt'] === 'string' ? parsed['lastSeenAt'] : null,\n };\n } catch {\n return null;\n }\n}\n\nasync function fileExists(p: string): Promise<boolean> {\n try {\n const st = await stat(p);\n return st.isFile();\n } catch {\n return false;\n }\n}\n\nasync function readExistingDoc(path: string): Promise<Partial<UserConfig>> {\n let text: string;\n try {\n text = await readFile(path, 'utf8');\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') return {};\n throw err;\n }\n return parseUserConfig(text, path);\n}\n\n/**\n * Stamp `schema: 1` on a doc that hasn't been stamped yet. Idempotent — a\n * doc already carrying any `schema` value is left alone. Future schema\n * bumps live here.\n */\nconst CURRENT_CONFIG_SCHEMA = 1;\nfunction stampSchema(doc: Partial<UserConfig>): void {\n if (typeof doc.schema !== 'number') {\n doc.schema = CURRENT_CONFIG_SCHEMA;\n }\n}\n\nfunction setLeaf(doc: Partial<UserConfig>, key: string, value: unknown): void {\n const segs = key.split('.');\n let cur = doc as unknown as Record<string, unknown>;\n for (let i = 0; i < segs.length - 1; i++) {\n const seg = segs[i]!;\n const next = cur[seg];\n if (!next || typeof next !== 'object') {\n cur[seg] = {};\n }\n cur = cur[seg] as Record<string, unknown>;\n }\n cur[segs[segs.length - 1]!] = value;\n}\n\nfunction unsetLeaf(doc: Partial<UserConfig>, key: string): boolean {\n const segs = key.split('.');\n const path: Record<string, unknown>[] = [doc as unknown as Record<string, unknown>];\n for (let i = 0; i < segs.length - 1; i++) {\n const seg = segs[i]!;\n const next = path[path.length - 1]![seg];\n if (!next || typeof next !== 'object') return false;\n path.push(next as Record<string, unknown>);\n }\n const leafSeg = segs[segs.length - 1]!;\n const leafContainer = path[path.length - 1]!;\n if (!(leafSeg in leafContainer)) return false;\n delete leafContainer[leafSeg];\n // Prune empty parent objects from leaf-most up so the YAML stays tidy.\n for (let i = path.length - 1; i > 0; i--) {\n if (Object.keys(path[i]!).length > 0) break;\n delete path[i - 1]![segs[i - 1]!];\n }\n return true;\n}\n\nasync function atomicWriteYaml(path: string, doc: Partial<UserConfig>): Promise<void> {\n await mkdir(dirname(path), { recursive: true });\n // YAML serialises empty objects as `{}` which is correct but ugly; if the\n // doc is empty we still want a usable placeholder file.\n const text = Object.keys(doc).length === 0\n ? '# managed by agentbox config — empty\\n'\n : stringifyYaml(doc);\n const tmp = `${path}.tmp-${process.pid.toString()}-${Date.now().toString(36)}`;\n await writeFile(tmp, text, { encoding: 'utf8', mode: 0o644 });\n await rename(tmp, path);\n}\n\n/**\n * Register a project (a folder on the PC) in the on-disk registry so it is\n * enumerable via {@link listProjectsConfigured} even before it has any config\n * value or any box. Idempotent: creates `~/.agentbox/projects/<hash>/meta.json`\n * on first call and refreshes `lastSeenAt` (preserving `createdAt`) after.\n *\n * `absPath` should be a canonical project root (e.g. `findProjectRoot(cwd).root`).\n * Callers that start from an arbitrary user path should canonicalize first.\n */\nexport async function registerProject(absPath: string): Promise<void> {\n await touchProjectMeta(absPath);\n}\n\n/**\n * Remove a project from the on-disk registry by its {@link hashProjectPath}\n * hash — deletes `~/.agentbox/projects/<hash>-<mnemonic>/`, i.e. its `meta.json`\n * and any project-scoped `config.yaml` the user set for that folder. Does NOT\n * touch the workspace folder/files, its git repo, or checkpoints (a separate\n * `~/.agentbox/checkpoints/` tree). Idempotent: returns `false` when the hash\n * isn't registered (nothing to remove). Mirrors the delete\n * {@link pruneOrphanProjectConfigs} does (rm by the on-disk `dirName`).\n */\nexport async function unregisterProject(hash: string): Promise<boolean> {\n const entry = (await listProjectsConfigured()).find((e) => e.hash === hash);\n if (!entry) return false;\n await rm(join(PROJECTS_DIR, entry.dirName), { recursive: true, force: true });\n return true;\n}\n\nasync function touchProjectMeta(absPath: string): Promise<void> {\n const dir = dirname(projectMetaFile(absPath));\n await mkdir(dir, { recursive: true });\n const metaPath = projectMetaFile(absPath);\n let prior: { originalPath?: string; createdAt?: string } = {};\n try {\n prior = JSON.parse(await readFile(metaPath, 'utf8')) as typeof prior;\n } catch {\n /* fresh file */\n }\n const now = new Date().toISOString();\n const next = {\n originalPath: absPath,\n hash: hashProjectPath(absPath),\n createdAt: prior.createdAt ?? now,\n lastSeenAt: now,\n };\n const tmp = `${metaPath}.tmp-${process.pid.toString()}-${Date.now().toString(36)}`;\n await writeFile(tmp, JSON.stringify(next, null, 2) + '\\n', { encoding: 'utf8', mode: 0o644 });\n await rename(tmp, metaPath);\n}\n\n// Re-export for ergonomics; same path resolution as the loader uses.\nexport { configPathFor };\n"],"mappings":";;;AEAA,SAAS,SAAS,iBAAiB;ACAnC,SAAS,kBAAkB;AAC3B,SAAS,UAAU,YAAY;AAC/B,SAAS,eAAe;AACxB,SAAS,UAAU,SAAS,MAAM,eAAe;ACHjD,SAAS,gBAAgB;AACzB,SAAS,SAASA,kBAAiB;AIDnC,SAAS,OAAO,YAAAC,WAAU,QAAQ,IAAI,QAAAC,OAAM,iBAAiB;AAC7D,SAAS,WAAAC,UAAS,YAAY,QAAAC,aAAY;AAC1C,SAAS,aAAa,qBAAqB;AAW3C,SAAS,eAAe;ARwBjB,IAAM,YAAY;EACvB;IACE,MAAM;IACN,MAAM;IACN,OAAO;IACP,WAAW;IACX,gBAAgB;IAChB,OAAO;IACP,UACE;IACF,WACE;EACJ;EACA;IACE,MAAM;IACN,MAAM;IACN,OAAO;IACP,WAAW;IACX,gBAAgB;IAChB,OAAO;IACP,UACE;IACF,WACE;EACJ;EACA;IACE,MAAM;IACN,MAAM;IACN,OAAO;IACP,WAAW;IACX,gBAAgB;IAChB,OAAO;IACP,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E,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;IACb,UAAU;EACZ;EACA,GAAG,qBAAqB;EACxB;IACE,KAAK;IACL,MAAM;IACN,aACE;IACF,UAAU;EACZ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;IACF,UAAU;EACZ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;IACF,UAAU;EACZ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,YAAY,CAAC,SAAS,UAAU,OAAO,MAAM;IAC7C,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,YAAY,CAAC,UAAU,UAAU,MAAM;IACvC,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,YAAY,CAAC,YAAY,kBAAkB,SAAS,MAAM;IAC1D,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,YAAY,CAAC,iBAAiB,cAAc,MAAM;IAClD,aAAa;EACf;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;IACb,UAAU;EACZ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,YAAY,CAAC,QAAQ,SAAS,SAAS,QAAQ;IAC/C,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aAAa;IACb,UAAU;EACZ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;IACF,UAAU;EACZ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK;IACL,MAAM;IACN,aACE;EACJ;EACA;IACE,KAAK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