@madarco/agentbox 0.23.4 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +79 -0
- package/LICENSE +21 -0
- package/README.md +3 -2
- package/dist/{_cloud-attach-BQRWX3J2.js → _cloud-attach-T6GPR6LJ.js} +5 -5
- package/dist/{chunk-GGRZ3GZO.js → chunk-5KHEH47T.js} +91 -79
- package/dist/chunk-5KHEH47T.js.map +1 -0
- package/dist/{chunk-I6ZRWTPR.js → chunk-6U2S6QWD.js} +219 -18
- package/dist/chunk-6U2S6QWD.js.map +1 -0
- package/dist/{chunk-LK2JT2OO.js → chunk-DEDTPG2D.js} +880 -146
- package/dist/chunk-DEDTPG2D.js.map +1 -0
- package/dist/chunk-G3H2L3O2.js +0 -0
- package/dist/{chunk-LA4JMS27.js → chunk-I654PBHA.js} +290 -330
- package/dist/chunk-I654PBHA.js.map +1 -0
- package/dist/{chunk-W3FQPFP7.js → chunk-K2EDQGZP.js} +18 -4
- package/dist/chunk-K2EDQGZP.js.map +1 -0
- package/dist/{chunk-LSQXT5WZ.js → chunk-LC4E2EIZ.js} +3 -3
- package/dist/{chunk-LSQXT5WZ.js.map → chunk-LC4E2EIZ.js.map} +1 -1
- package/dist/{chunk-SFA57TGX.js → chunk-NACA6AM7.js} +183 -49
- package/dist/chunk-NACA6AM7.js.map +1 -0
- package/dist/{chunk-QEQFZLYR.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-V235KVEX.js → dist-7OUOHQPA.js} +196 -151
- package/dist/dist-7OUOHQPA.js.map +1 -0
- package/dist/{dist-Z2NEVV55.js → dist-B7TNWGVG.js} +8 -4
- package/dist/{dist-CUKBKS3N.js → dist-KYV3LEHG.js} +10 -6
- package/dist/{dist-FXQFTT75.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-QO4CTLAX.js → dist-Z7KEPQC7.js} +6 -6
- package/dist/index.js +2560 -1108
- package/dist/index.js.map +1 -1
- package/dist/{prepared-state-BUO75YLZ-CDTISC2C.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)/boxes/[id]/page_client-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page_client-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page_client-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.html +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/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/_06f2faq._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/_0760z6y._.js +8 -8
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/_09gdzmo._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0ro6vh6._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0tgpglr._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/_1laion6._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_0b_hsjl._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/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/1c5w3kqosumog.js +1 -0
- package/runtime/hub/apps/hub/.next/static/chunks/1o3ot_9-8jgzc.js +1 -0
- package/runtime/hub/apps/hub/.next/static/chunks/380qcmusmigzz.js +1 -0
- package/runtime/hub/apps/hub/.next/static/chunks/3uq9hf-roasav.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-H22XP3NY.js → chunk-3VE7AYVK.js} +600 -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-2Z74R6ZT.js → chunk-FGBXEXUV.js} +351 -292
- package/runtime/hub/apps/hub/{chunk-AR7CEZ2G.js → chunk-YVELHPNY.js} +218 -17
- package/runtime/hub/apps/hub/{dist-LZNRLUYY.js → dist-33ZNVTC6.js} +183 -49
- package/runtime/hub/apps/hub/{dist-Q6G66Z57.js → dist-4SXAJBOC.js} +195 -150
- package/runtime/hub/apps/hub/{dist-SD4G36EP.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-LNHEG5P4.js → dist-UJVIROA4.js} +19 -5
- package/runtime/hub/apps/hub/dist-XULFTIMT.js +2212 -0
- package/runtime/hub/apps/hub/{dist-VV6Z2CQX.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-CAXQS5Y3.js → prepared-state-BUO75YLZ-O4GZMDRF.js} +1 -1
- package/runtime/hub/apps/hub/server.js +38 -19
- 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-GGRZ3GZO.js.map +0 -1
- package/dist/chunk-I6ZRWTPR.js.map +0 -1
- package/dist/chunk-LA4JMS27.js.map +0 -1
- package/dist/chunk-LK2JT2OO.js.map +0 -1
- package/dist/chunk-QEQFZLYR.js.map +0 -1
- package/dist/chunk-QT3SHMLY.js.map +0 -1
- package/dist/chunk-SFA57TGX.js.map +0 -1
- package/dist/chunk-W3FQPFP7.js.map +0 -1
- package/dist/dist-FXQFTT75.js.map +0 -1
- package/dist/dist-V235KVEX.js.map +0 -1
- package/runtime/hub/apps/hub/.next/static/chunks/0joh_xsiowfc4.js +0 -1
- package/runtime/hub/apps/hub/.next/static/chunks/20hq7-0depjid.js +0 -1
- package/runtime/hub/apps/hub/.next/static/chunks/3p86ecqhr_7yy.js +0 -1
- package/runtime/hub/apps/hub/.next/static/chunks/3qof5hg87qf5n.js +0 -1
- /package/dist/{_cloud-attach-BQRWX3J2.js.map → _cloud-attach-T6GPR6LJ.js.map} +0 -0
- /package/dist/{dist-2BTJQUJS.js.map → dist-B7TNWGVG.js.map} +0 -0
- /package/dist/{dist-CUKBKS3N.js.map → dist-KYV3LEHG.js.map} +0 -0
- /package/dist/{dist-QO4CTLAX.js.map → dist-T5MXBZGP.js.map} +0 -0
- /package/dist/{dist-Z2NEVV55.js.map → dist-Z7KEPQC7.js.map} +0 -0
- /package/dist/{prepared-state-BUO75YLZ-CDTISC2C.js.map → prepared-state-BUO75YLZ-RQRFFBJW.js.map} +0 -0
- /package/runtime/hub/apps/hub/.next/static/{eVq-z4zld_8DGQudbYogV → XtIjHGqvY4mQsOY2-m1Jy}/_buildManifest.js +0 -0
- /package/runtime/hub/apps/hub/.next/static/{eVq-z4zld_8DGQudbYogV → XtIjHGqvY4mQsOY2-m1Jy}/_clientMiddlewareManifest.js +0 -0
- /package/runtime/hub/apps/hub/.next/static/{eVq-z4zld_8DGQudbYogV → XtIjHGqvY4mQsOY2-m1Jy}/_ssgManifest.js +0 -0
|
@@ -322,29 +322,33 @@ import { mkdtemp, readFile as readFile4, writeFile as writeFile3 } from "fs/prom
|
|
|
322
322
|
import { tmpdir } from "os";
|
|
323
323
|
import { basename as basename2, join as join7 } from "path";
|
|
324
324
|
import { join as join8 } from "path";
|
|
325
|
+
import { chmod, mkdir as mkdir4, readdir as readdir2, readFile as readFile5, stat as stat4, writeFile as writeFile4 } from "fs/promises";
|
|
325
326
|
import { homedir as homedir6 } from "os";
|
|
326
|
-
import {
|
|
327
|
-
import { tmpdir as tmpdir2 } from "os";
|
|
328
|
-
import { join as join9 } from "path";
|
|
329
|
-
import { readdir as readdir2, stat as stat4 } from "fs/promises";
|
|
327
|
+
import { dirname as dirname6, join as join9 } from "path";
|
|
330
328
|
import { homedir as homedir7 } from "os";
|
|
331
|
-
import {
|
|
332
|
-
import {
|
|
333
|
-
import {
|
|
334
|
-
import { stat as
|
|
335
|
-
import {
|
|
336
|
-
import { dirname as dirname6 } from "path";
|
|
337
|
-
import { createHash } from "crypto";
|
|
338
|
-
import { readFile as readFile6 } from "fs/promises";
|
|
329
|
+
import { mkdtemp as mkdtemp3, rm as rm4 } from "fs/promises";
|
|
330
|
+
import { tmpdir as tmpdir3 } from "os";
|
|
331
|
+
import { join as join11 } from "path";
|
|
332
|
+
import { readdir as readdir3, stat as stat5 } from "fs/promises";
|
|
333
|
+
import { homedir as homedir8 } from "os";
|
|
339
334
|
import { join as join12 } from "path";
|
|
335
|
+
import { readdir as readdir4, realpath as realpath2, stat as stat6 } from "fs/promises";
|
|
336
|
+
import { isAbsolute as isAbsolute3, join as join13, relative } from "path";
|
|
337
|
+
import { stat as stat7 } from "fs/promises";
|
|
338
|
+
import { chmod as chmod2, mkdir as mkdir6, mkdtemp as mkdtemp4, readFile as readFile6, rename as rename3, rm as rm5, writeFile as writeFile6 } from "fs/promises";
|
|
339
|
+
import { tmpdir as tmpdir4 } from "os";
|
|
340
|
+
import { dirname as dirname8, join as join14 } from "path";
|
|
341
|
+
import { createHash } from "crypto";
|
|
342
|
+
import { readFile as readFile7 } from "fs/promises";
|
|
343
|
+
import { join as join15 } from "path";
|
|
340
344
|
import { createHash as createHash2 } from "crypto";
|
|
341
|
-
import { copyFile, mkdir as
|
|
342
|
-
import { homedir as
|
|
343
|
-
import { basename as basename22, dirname as
|
|
344
|
-
import { copyFile as copyFile2, mkdtemp as
|
|
345
|
-
import { homedir as
|
|
346
|
-
import { basename as basename3, join as
|
|
347
|
-
import { homedir as
|
|
345
|
+
import { copyFile, mkdir as mkdir7, mkdtemp as mkdtemp5, readdir as readdir5, readFile as readFile8, rm as rm6, stat as stat8 } from "fs/promises";
|
|
346
|
+
import { homedir as homedir9, tmpdir as tmpdir5 } from "os";
|
|
347
|
+
import { basename as basename22, dirname as dirname9, join as join16 } from "path";
|
|
348
|
+
import { copyFile as copyFile2, mkdtemp as mkdtemp6, readdir as readdir6, readFile as readFile9, rm as rm7, stat as stat9, writeFile as writeFile7 } from "fs/promises";
|
|
349
|
+
import { homedir as homedir11, tmpdir as tmpdir6 } from "os";
|
|
350
|
+
import { basename as basename3, join as join17, relative as relative2 } from "path";
|
|
351
|
+
import { homedir as homedir10 } from "os";
|
|
348
352
|
|
|
349
353
|
// ../../node_modules/.pnpm/smol-toml@1.7.0/node_modules/smol-toml/dist/date.js
|
|
350
354
|
var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
|
|
@@ -1170,9 +1174,9 @@ function stringify(obj, { maxDepth = 1e3, numbersAsFloat = false } = {}) {
|
|
|
1170
1174
|
// ../../packages/sandbox-core/dist/index.js
|
|
1171
1175
|
import { createHash as createHash3 } from "crypto";
|
|
1172
1176
|
import { existsSync as existsSync4, mkdirSync as mkdirSync3, readFileSync as readFileSync4, renameSync as renameSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
1173
|
-
import { readFile as
|
|
1174
|
-
import { homedir as
|
|
1175
|
-
import { dirname as
|
|
1177
|
+
import { readFile as readFile10 } from "fs/promises";
|
|
1178
|
+
import { homedir as homedir12 } from "os";
|
|
1179
|
+
import { dirname as dirname10, resolve as pathResolve } from "path";
|
|
1176
1180
|
var STATE_DIR = join2(homedir2(), ".agentbox");
|
|
1177
1181
|
var STATE_FILE = join2(STATE_DIR, "state.json");
|
|
1178
1182
|
var EMPTY = { version: 1, boxes: [] };
|
|
@@ -1660,6 +1664,47 @@ async function mintSshKey(targetDir, comment) {
|
|
|
1660
1664
|
const publicKey = (await readFile2(pub, "utf8")).trim();
|
|
1661
1665
|
return { dir, privatePath: priv, publicPath: pub, publicKey };
|
|
1662
1666
|
}
|
|
1667
|
+
var OPEN_INBOUND_SOURCES = ["0.0.0.0/0", "::/0"];
|
|
1668
|
+
function normalizeInboundCidr(raw) {
|
|
1669
|
+
const trimmed = raw.trim();
|
|
1670
|
+
if (trimmed.includes("/")) return trimmed;
|
|
1671
|
+
if (trimmed.includes(":")) return `${trimmed}/128`;
|
|
1672
|
+
return `${trimmed}/32`;
|
|
1673
|
+
}
|
|
1674
|
+
function parseInboundSpec(spec) {
|
|
1675
|
+
let s = (spec ?? "").trim();
|
|
1676
|
+
if (s === "" || /^lock(ed)?$/i.test(s)) return { mode: "locked", sources: [] };
|
|
1677
|
+
if (/^open$/i.test(s)) return { mode: "open", sources: [] };
|
|
1678
|
+
if (/^whitelist\b:?/i.test(s)) s = s.replace(/^whitelist\b:?/i, "").trim();
|
|
1679
|
+
const sources = s.split(/[\s,]+/).map((x) => x.trim()).filter((x) => x.length > 0).map(normalizeInboundCidr);
|
|
1680
|
+
if (sources.length === 0) {
|
|
1681
|
+
throw new Error(
|
|
1682
|
+
"inbound 'whitelist' needs at least one CIDR, e.g. `--inbound 203.0.113.5/32` or `--inbound whitelist:203.0.113.0/24`"
|
|
1683
|
+
);
|
|
1684
|
+
}
|
|
1685
|
+
return { mode: "whitelist", sources };
|
|
1686
|
+
}
|
|
1687
|
+
function resolveInboundSources(policy, hostEgressCidr) {
|
|
1688
|
+
if (policy.mode === "open") return [...OPEN_INBOUND_SOURCES];
|
|
1689
|
+
const out = /* @__PURE__ */ new Set();
|
|
1690
|
+
if (hostEgressCidr && hostEgressCidr.trim().length > 0) {
|
|
1691
|
+
out.add(normalizeInboundCidr(hostEgressCidr));
|
|
1692
|
+
}
|
|
1693
|
+
if (policy.mode === "whitelist") {
|
|
1694
|
+
for (const s of policy.sources) out.add(normalizeInboundCidr(s));
|
|
1695
|
+
}
|
|
1696
|
+
return [...out];
|
|
1697
|
+
}
|
|
1698
|
+
function describeInbound(policy) {
|
|
1699
|
+
switch (policy.mode) {
|
|
1700
|
+
case "open":
|
|
1701
|
+
return "open (SSH reachable from anywhere \u2014 0.0.0.0/0, key-only)";
|
|
1702
|
+
case "whitelist":
|
|
1703
|
+
return `whitelist (host egress + ${policy.sources.join(", ")})`;
|
|
1704
|
+
default:
|
|
1705
|
+
return "locked (SSH reachable only from the host egress IP)";
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1663
1708
|
var BOX_WORKSPACE = "/workspace";
|
|
1664
1709
|
function run(provider, box, argv) {
|
|
1665
1710
|
return provider.exec(box, argv, { cwd: BOX_WORKSPACE });
|
|
@@ -1909,6 +1954,17 @@ var AGENT_SYNC_SPECS = [
|
|
|
1909
1954
|
// separately; `state_*.sqlite*` is the resume-cwd index (rebuilt in-box);
|
|
1910
1955
|
// `packages`/`plugins/.plugin-appserver`/`computer-use` are heavy
|
|
1911
1956
|
// macOS-only artifacts; the rest is host-only session/log/cache state.
|
|
1957
|
+
//
|
|
1958
|
+
// `.tmp` carve-in: the git-marketplace snapshots (`.tmp/marketplaces/`,
|
|
1959
|
+
// ~13 MB) must reach the box or in-box `codex plugin` breaks
|
|
1960
|
+
// ("marketplace root does not contain a supported manifest" — and the
|
|
1961
|
+
// box can't re-clone, the git shim blocks `clone`). The includes are
|
|
1962
|
+
// emitted BEFORE the excludes (first-match-wins): the root `.tmp/` dir
|
|
1963
|
+
// and the marketplaces subtree transfer, `/.tmp/*` drops its other
|
|
1964
|
+
// children (the ~200 MB desktop-app `bundled-marketplaces` + `plugins`
|
|
1965
|
+
// payloads), and the unanchored `.tmp` still blocks nested `.tmp` dirs
|
|
1966
|
+
// elsewhere in the tree.
|
|
1967
|
+
include: ["/.tmp/", "/.tmp/marketplaces/***"],
|
|
1912
1968
|
exclude: [
|
|
1913
1969
|
"auth.json",
|
|
1914
1970
|
"sessions",
|
|
@@ -1922,6 +1978,7 @@ var AGENT_SYNC_SPECS = [
|
|
|
1922
1978
|
"cache",
|
|
1923
1979
|
"vendor_imports",
|
|
1924
1980
|
"tmp",
|
|
1981
|
+
"/.tmp/*",
|
|
1925
1982
|
".tmp",
|
|
1926
1983
|
".codex-global-state.json",
|
|
1927
1984
|
".codex-global-state.json.bak",
|
|
@@ -2018,6 +2075,233 @@ function resolveAgentSpec(name) {
|
|
|
2018
2075
|
if (!spec) throw new Error(`no agent sync spec for '${name}'`);
|
|
2019
2076
|
return spec;
|
|
2020
2077
|
}
|
|
2078
|
+
var SKILL_EXCLUDE_PREFIXES = ["agentbox-"];
|
|
2079
|
+
var CONTAINER_PLUGINS_PREFIX = "/home/vscode/.claude/plugins/";
|
|
2080
|
+
function pickNewItems(boxNames, hostNames, excludePrefixes = []) {
|
|
2081
|
+
const host = new Set(hostNames);
|
|
2082
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2083
|
+
const out = [];
|
|
2084
|
+
for (const name of boxNames) {
|
|
2085
|
+
if (name.length === 0 || host.has(name) || seen.has(name)) continue;
|
|
2086
|
+
if (excludePrefixes.some((p) => name.startsWith(p))) continue;
|
|
2087
|
+
seen.add(name);
|
|
2088
|
+
out.push(name);
|
|
2089
|
+
}
|
|
2090
|
+
return out.sort();
|
|
2091
|
+
}
|
|
2092
|
+
function rewritePluginPaths(value, hostPluginsPrefix) {
|
|
2093
|
+
if (typeof value === "string") {
|
|
2094
|
+
return value.split(CONTAINER_PLUGINS_PREFIX).join(hostPluginsPrefix);
|
|
2095
|
+
}
|
|
2096
|
+
if (Array.isArray(value)) {
|
|
2097
|
+
return value.map((v) => rewritePluginPaths(v, hostPluginsPrefix));
|
|
2098
|
+
}
|
|
2099
|
+
if (value !== null && typeof value === "object") {
|
|
2100
|
+
const out = {};
|
|
2101
|
+
for (const [k, v] of Object.entries(value)) {
|
|
2102
|
+
out[k] = rewritePluginPaths(v, hostPluginsPrefix);
|
|
2103
|
+
}
|
|
2104
|
+
return out;
|
|
2105
|
+
}
|
|
2106
|
+
return value;
|
|
2107
|
+
}
|
|
2108
|
+
function isPlainObject2(v) {
|
|
2109
|
+
return v !== null && typeof v === "object" && !Array.isArray(v);
|
|
2110
|
+
}
|
|
2111
|
+
function additiveMerge(hostRoot, boxRoot, hostPluginsPrefix, selectMap, withMap) {
|
|
2112
|
+
const hostMap = selectMap(hostRoot);
|
|
2113
|
+
const boxMap = selectMap(boxRoot);
|
|
2114
|
+
if (!isPlainObject2(boxMap)) {
|
|
2115
|
+
return { data: hostRoot, changed: false, addedKeys: [] };
|
|
2116
|
+
}
|
|
2117
|
+
const base = isPlainObject2(hostMap) ? { ...hostMap } : {};
|
|
2118
|
+
const addedKeys = [];
|
|
2119
|
+
for (const [key, value] of Object.entries(boxMap)) {
|
|
2120
|
+
if (Object.prototype.hasOwnProperty.call(base, key)) continue;
|
|
2121
|
+
base[key] = rewritePluginPaths(value, hostPluginsPrefix);
|
|
2122
|
+
addedKeys.push(key);
|
|
2123
|
+
}
|
|
2124
|
+
if (addedKeys.length === 0) {
|
|
2125
|
+
return { data: hostRoot, changed: false, addedKeys: [] };
|
|
2126
|
+
}
|
|
2127
|
+
return { data: withMap(hostRoot, base), changed: true, addedKeys: addedKeys.sort() };
|
|
2128
|
+
}
|
|
2129
|
+
function mergeKnownMarketplaces(hostJson, boxJson, opts) {
|
|
2130
|
+
const prefix = `${opts.hostHome}/.claude/plugins/`;
|
|
2131
|
+
return additiveMerge(
|
|
2132
|
+
isPlainObject2(hostJson) ? hostJson : {},
|
|
2133
|
+
boxJson,
|
|
2134
|
+
prefix,
|
|
2135
|
+
(root) => root,
|
|
2136
|
+
(_host, merged) => merged
|
|
2137
|
+
);
|
|
2138
|
+
}
|
|
2139
|
+
function mergeInstalledPlugins(hostJson, boxJson, opts) {
|
|
2140
|
+
const prefix = `${opts.hostHome}/.claude/plugins/`;
|
|
2141
|
+
const hostRoot = isPlainObject2(hostJson) ? hostJson : { plugins: {} };
|
|
2142
|
+
return additiveMerge(
|
|
2143
|
+
hostRoot,
|
|
2144
|
+
boxJson,
|
|
2145
|
+
prefix,
|
|
2146
|
+
(root) => isPlainObject2(root) ? root["plugins"] : void 0,
|
|
2147
|
+
(host, merged) => ({ ...host, plugins: merged })
|
|
2148
|
+
);
|
|
2149
|
+
}
|
|
2150
|
+
function referencedPluginVersionKeys(installedPluginsJson) {
|
|
2151
|
+
const keys = /* @__PURE__ */ new Set();
|
|
2152
|
+
if (!isPlainObject2(installedPluginsJson)) return keys;
|
|
2153
|
+
const plugins = installedPluginsJson["plugins"];
|
|
2154
|
+
if (!isPlainObject2(plugins)) return keys;
|
|
2155
|
+
for (const entries of Object.values(plugins)) {
|
|
2156
|
+
if (!Array.isArray(entries)) continue;
|
|
2157
|
+
for (const entry of entries) {
|
|
2158
|
+
if (!isPlainObject2(entry)) continue;
|
|
2159
|
+
const installPath = entry["installPath"];
|
|
2160
|
+
if (typeof installPath !== "string") continue;
|
|
2161
|
+
const segments = installPath.split("/").filter((s) => s.length > 0);
|
|
2162
|
+
if (segments.length < 3) continue;
|
|
2163
|
+
keys.add(segments.slice(-3).join("/"));
|
|
2164
|
+
}
|
|
2165
|
+
}
|
|
2166
|
+
return keys;
|
|
2167
|
+
}
|
|
2168
|
+
var CLAUDE_PULL_DIR_CATEGORIES = ["skills", "agents", "commands"];
|
|
2169
|
+
function claudeInventoryScript(src) {
|
|
2170
|
+
return [
|
|
2171
|
+
"for cat in skills agents commands; do",
|
|
2172
|
+
` [ -d "${src}/$cat" ] || continue;`,
|
|
2173
|
+
` for d in "${src}/$cat"/*/; do`,
|
|
2174
|
+
' [ -d "$d" ] || continue;',
|
|
2175
|
+
' printf "DIR %s %s\\n" "$cat" "$(basename "$d")";',
|
|
2176
|
+
" done;",
|
|
2177
|
+
"done;",
|
|
2178
|
+
`if [ -d ${src}/plugins/cache ]; then`,
|
|
2179
|
+
` for m in ${src}/plugins/cache/*/; do`,
|
|
2180
|
+
' [ -d "$m" ] || continue;',
|
|
2181
|
+
' for p in "$m"*/; do',
|
|
2182
|
+
' [ -d "$p" ] || continue;',
|
|
2183
|
+
' printf "PLUGIN %s/%s\\n" "$(basename "$m")" "$(basename "$p")";',
|
|
2184
|
+
" done;",
|
|
2185
|
+
" done;",
|
|
2186
|
+
"fi;",
|
|
2187
|
+
"for f in installed_plugins known_marketplaces; do",
|
|
2188
|
+
` [ -f "${src}/plugins/$f.json" ] || continue;`,
|
|
2189
|
+
' printf "JSON %s " "$f";',
|
|
2190
|
+
` base64 -w0 "${src}/plugins/$f.json";`,
|
|
2191
|
+
' printf "\\n";',
|
|
2192
|
+
"done"
|
|
2193
|
+
].join(" ");
|
|
2194
|
+
}
|
|
2195
|
+
function parseClaudeInventory(stdout) {
|
|
2196
|
+
const dirs = { skills: [], agents: [], commands: [] };
|
|
2197
|
+
const plugins = [];
|
|
2198
|
+
const registries = {};
|
|
2199
|
+
for (const line of stdout.split("\n")) {
|
|
2200
|
+
if (line.startsWith("DIR ")) {
|
|
2201
|
+
const rest = line.slice(4);
|
|
2202
|
+
const sp = rest.indexOf(" ");
|
|
2203
|
+
if (sp === -1) continue;
|
|
2204
|
+
const cat = rest.slice(0, sp);
|
|
2205
|
+
const name = rest.slice(sp + 1);
|
|
2206
|
+
if (cat in dirs) dirs[cat].push(name);
|
|
2207
|
+
} else if (line.startsWith("PLUGIN ")) {
|
|
2208
|
+
plugins.push(line.slice(7));
|
|
2209
|
+
} else if (line.startsWith("JSON ")) {
|
|
2210
|
+
const rest = line.slice(5);
|
|
2211
|
+
const sp = rest.indexOf(" ");
|
|
2212
|
+
if (sp === -1) continue;
|
|
2213
|
+
const which = rest.slice(0, sp);
|
|
2214
|
+
try {
|
|
2215
|
+
registries[which] = JSON.parse(Buffer.from(rest.slice(sp + 1), "base64").toString("utf8"));
|
|
2216
|
+
} catch {
|
|
2217
|
+
}
|
|
2218
|
+
}
|
|
2219
|
+
}
|
|
2220
|
+
return { dirs, plugins, registries };
|
|
2221
|
+
}
|
|
2222
|
+
async function listChildDirs(dir) {
|
|
2223
|
+
try {
|
|
2224
|
+
const entries = await readdir2(dir, { withFileTypes: true });
|
|
2225
|
+
return entries.filter((e) => e.isDirectory() || e.isSymbolicLink()).map((e) => e.name);
|
|
2226
|
+
} catch {
|
|
2227
|
+
return [];
|
|
2228
|
+
}
|
|
2229
|
+
}
|
|
2230
|
+
async function readJsonFile(path) {
|
|
2231
|
+
try {
|
|
2232
|
+
return JSON.parse(await readFile5(path, "utf8"));
|
|
2233
|
+
} catch {
|
|
2234
|
+
return void 0;
|
|
2235
|
+
}
|
|
2236
|
+
}
|
|
2237
|
+
async function computeClaudePullPlan(inv, opts = {}) {
|
|
2238
|
+
const hostHome = opts.hostHome ?? homedir6();
|
|
2239
|
+
const hostClaude = join9(hostHome, ".claude");
|
|
2240
|
+
const newItems = [];
|
|
2241
|
+
const copyRels = [];
|
|
2242
|
+
for (const cat of CLAUDE_PULL_DIR_CATEGORIES) {
|
|
2243
|
+
const hostNames = await listChildDirs(join9(hostClaude, cat));
|
|
2244
|
+
const excludes = cat === "skills" ? SKILL_EXCLUDE_PREFIXES : [];
|
|
2245
|
+
for (const name of pickNewItems(inv.dirs[cat] ?? [], hostNames, excludes)) {
|
|
2246
|
+
newItems.push({ category: cat, name });
|
|
2247
|
+
copyRels.push(`${cat}/${name}`);
|
|
2248
|
+
}
|
|
2249
|
+
}
|
|
2250
|
+
const hostPluginKeys = [];
|
|
2251
|
+
for (const m of await listChildDirs(join9(hostClaude, "plugins", "cache"))) {
|
|
2252
|
+
for (const p of await listChildDirs(join9(hostClaude, "plugins", "cache", m))) {
|
|
2253
|
+
hostPluginKeys.push(`${m}/${p}`);
|
|
2254
|
+
}
|
|
2255
|
+
}
|
|
2256
|
+
for (const key of pickNewItems(inv.plugins, hostPluginKeys)) {
|
|
2257
|
+
newItems.push({ category: "plugins", name: key });
|
|
2258
|
+
copyRels.push(`plugins/cache/${key}`);
|
|
2259
|
+
}
|
|
2260
|
+
const hostInstalled = await readJsonFile(join9(hostClaude, "plugins", "installed_plugins.json"));
|
|
2261
|
+
const hostMarkets = await readJsonFile(join9(hostClaude, "plugins", "known_marketplaces.json"));
|
|
2262
|
+
const mergedInstalled = mergeInstalledPlugins(hostInstalled, inv.registries["installed_plugins"], {
|
|
2263
|
+
hostHome
|
|
2264
|
+
});
|
|
2265
|
+
const mergedMarkets = mergeKnownMarketplaces(hostMarkets, inv.registries["known_marketplaces"], {
|
|
2266
|
+
hostHome
|
|
2267
|
+
});
|
|
2268
|
+
const mergedRegistries = [];
|
|
2269
|
+
if (mergedInstalled.changed) mergedRegistries.push("installed_plugins.json");
|
|
2270
|
+
if (mergedMarkets.changed) mergedRegistries.push("known_marketplaces.json");
|
|
2271
|
+
return { newItems, copyRels, mergedInstalled, mergedMarkets, mergedRegistries };
|
|
2272
|
+
}
|
|
2273
|
+
async function writeClaudeMergedRegistries(plan, opts = {}) {
|
|
2274
|
+
if (!plan.mergedInstalled.changed && !plan.mergedMarkets.changed) return;
|
|
2275
|
+
const hostClaude = join9(opts.hostHome ?? homedir6(), ".claude");
|
|
2276
|
+
await mkdir4(join9(hostClaude, "plugins"), { recursive: true });
|
|
2277
|
+
if (plan.mergedMarkets.changed) {
|
|
2278
|
+
await writeFile4(
|
|
2279
|
+
join9(hostClaude, "plugins", "known_marketplaces.json"),
|
|
2280
|
+
`${JSON.stringify(plan.mergedMarkets.data, null, 2)}
|
|
2281
|
+
`
|
|
2282
|
+
);
|
|
2283
|
+
}
|
|
2284
|
+
if (plan.mergedInstalled.changed) {
|
|
2285
|
+
await writeFile4(
|
|
2286
|
+
join9(hostClaude, "plugins", "installed_plugins.json"),
|
|
2287
|
+
`${JSON.stringify(plan.mergedInstalled.data, null, 2)}
|
|
2288
|
+
`
|
|
2289
|
+
);
|
|
2290
|
+
}
|
|
2291
|
+
}
|
|
2292
|
+
var CODEX_PULL_ITEMS = ["config.toml", "auth.json", "prompts"];
|
|
2293
|
+
var OPENCODE_PULL_DATA_ITEMS = ["auth.json"];
|
|
2294
|
+
var OPENCODE_PULL_CONFIG_ITEMS = [
|
|
2295
|
+
"opencode.json",
|
|
2296
|
+
"opencode.jsonc",
|
|
2297
|
+
"agents",
|
|
2298
|
+
"commands",
|
|
2299
|
+
"modes",
|
|
2300
|
+
"plugins",
|
|
2301
|
+
"skills",
|
|
2302
|
+
"tools",
|
|
2303
|
+
"themes"
|
|
2304
|
+
];
|
|
2021
2305
|
function makeSyncContext(init) {
|
|
2022
2306
|
return {
|
|
2023
2307
|
boxName: init.boxName,
|
|
@@ -2026,7 +2310,7 @@ function makeSyncContext(init) {
|
|
|
2026
2310
|
hostWorkspace: init.hostWorkspace,
|
|
2027
2311
|
projectRoot: init.projectRoot ?? init.hostWorkspace,
|
|
2028
2312
|
boxWorkspace: init.boxWorkspace ?? "/workspace",
|
|
2029
|
-
hostHome: init.hostHome ??
|
|
2313
|
+
hostHome: init.hostHome ?? homedir7(),
|
|
2030
2314
|
onLog: init.onLog ?? (() => {
|
|
2031
2315
|
})
|
|
2032
2316
|
};
|
|
@@ -2098,8 +2382,8 @@ async function scanHostEnvFiles(workspaceDir, patterns) {
|
|
|
2098
2382
|
async function pushEnvFiles(ctx, transport, patterns) {
|
|
2099
2383
|
const list = await findEnvFilesForTar(ctx.hostWorkspace, patterns);
|
|
2100
2384
|
if (list.length === 0) return { copied: 0 };
|
|
2101
|
-
const stage = await
|
|
2102
|
-
const localTar =
|
|
2385
|
+
const stage = await mkdtemp3(join11(tmpdir3(), "agentbox-envfiles-"));
|
|
2386
|
+
const localTar = join11(stage, "envfiles.tar");
|
|
2103
2387
|
try {
|
|
2104
2388
|
const packed = await execa(
|
|
2105
2389
|
"tar",
|
|
@@ -2119,7 +2403,7 @@ async function pushEnvFiles(ctx, transport, patterns) {
|
|
|
2119
2403
|
return { copied: 0 };
|
|
2120
2404
|
}
|
|
2121
2405
|
} finally {
|
|
2122
|
-
await
|
|
2406
|
+
await rm4(stage, { recursive: true, force: true });
|
|
2123
2407
|
}
|
|
2124
2408
|
return { copied: list.length };
|
|
2125
2409
|
}
|
|
@@ -2159,9 +2443,9 @@ function planCarryEntry(entry) {
|
|
|
2159
2443
|
parentChainNeeded
|
|
2160
2444
|
};
|
|
2161
2445
|
}
|
|
2162
|
-
async function
|
|
2446
|
+
async function pathExists2(p) {
|
|
2163
2447
|
try {
|
|
2164
|
-
await
|
|
2448
|
+
await stat5(p);
|
|
2165
2449
|
return true;
|
|
2166
2450
|
} catch {
|
|
2167
2451
|
return false;
|
|
@@ -2171,18 +2455,18 @@ function encodeClaudeProjectsKey(absPath) {
|
|
|
2171
2455
|
return absPath.replace(/[^a-zA-Z0-9]/g, "-");
|
|
2172
2456
|
}
|
|
2173
2457
|
var BOX_CLAUDE_PROJECT_DIR = "/home/vscode/.claude/projects/-workspace";
|
|
2174
|
-
async function resolveClaudeMemoryDir(hostWorkspace, hostHome =
|
|
2458
|
+
async function resolveClaudeMemoryDir(hostWorkspace, hostHome = homedir8()) {
|
|
2175
2459
|
if (hostWorkspace.length === 0) return null;
|
|
2176
|
-
const memDir =
|
|
2460
|
+
const memDir = join12(
|
|
2177
2461
|
hostHome,
|
|
2178
2462
|
".claude",
|
|
2179
2463
|
"projects",
|
|
2180
2464
|
encodeClaudeProjectsKey(hostWorkspace),
|
|
2181
2465
|
"memory"
|
|
2182
2466
|
);
|
|
2183
|
-
if (!await
|
|
2467
|
+
if (!await pathExists2(memDir)) return null;
|
|
2184
2468
|
try {
|
|
2185
|
-
const entries = await
|
|
2469
|
+
const entries = await readdir3(memDir);
|
|
2186
2470
|
if (entries.length === 0) return null;
|
|
2187
2471
|
} catch {
|
|
2188
2472
|
return null;
|
|
@@ -2211,13 +2495,13 @@ async function findUnsyncableSymlinks(root, reachableRoots) {
|
|
|
2211
2495
|
try {
|
|
2212
2496
|
let entries;
|
|
2213
2497
|
try {
|
|
2214
|
-
entries = await
|
|
2498
|
+
entries = await readdir4(realDir, { withFileTypes: true });
|
|
2215
2499
|
} catch {
|
|
2216
2500
|
return;
|
|
2217
2501
|
}
|
|
2218
2502
|
for (const ent of entries) {
|
|
2219
|
-
const realFull =
|
|
2220
|
-
const virtualFull = virtualDir ?
|
|
2503
|
+
const realFull = join13(realDir, ent.name);
|
|
2504
|
+
const virtualFull = virtualDir ? join13(virtualDir, ent.name) : ent.name;
|
|
2221
2505
|
if (ent.isSymbolicLink()) {
|
|
2222
2506
|
let real;
|
|
2223
2507
|
try {
|
|
@@ -2230,7 +2514,7 @@ async function findUnsyncableSymlinks(root, reachableRoots) {
|
|
|
2230
2514
|
unsyncable.push(virtualFull);
|
|
2231
2515
|
continue;
|
|
2232
2516
|
}
|
|
2233
|
-
const st = await
|
|
2517
|
+
const st = await stat6(real).catch(() => null);
|
|
2234
2518
|
if (st?.isDirectory()) await walk(real, virtualFull);
|
|
2235
2519
|
} else if (ent.isDirectory()) {
|
|
2236
2520
|
await walk(realFull, virtualFull);
|
|
@@ -2243,9 +2527,9 @@ async function findUnsyncableSymlinks(root, reachableRoots) {
|
|
|
2243
2527
|
await walk(root, "");
|
|
2244
2528
|
return unsyncable;
|
|
2245
2529
|
}
|
|
2246
|
-
async function
|
|
2530
|
+
async function pathExists3(p) {
|
|
2247
2531
|
try {
|
|
2248
|
-
await
|
|
2532
|
+
await stat7(p);
|
|
2249
2533
|
return true;
|
|
2250
2534
|
} catch {
|
|
2251
2535
|
return false;
|
|
@@ -2254,7 +2538,7 @@ async function pathExists2(p) {
|
|
|
2254
2538
|
async function seedAgentsVolume(args) {
|
|
2255
2539
|
const seed = args.transport.seedVolumeFromHost;
|
|
2256
2540
|
if (!seed) throw new Error("seedAgentsVolume requires a transport with seedVolumeFromHost");
|
|
2257
|
-
const willSync = args.syncFromHost && await
|
|
2541
|
+
const willSync = args.syncFromHost && await pathExists3(args.hostAgents);
|
|
2258
2542
|
if (!willSync) {
|
|
2259
2543
|
try {
|
|
2260
2544
|
await seed.call(args.transport, args.volume, []);
|
|
@@ -2295,7 +2579,7 @@ function isRealAgentCredential(agent, text) {
|
|
|
2295
2579
|
}
|
|
2296
2580
|
async function hostClaudeBackupExpired(path = CLAUDE_HOST_BACKUP, now = Date.now()) {
|
|
2297
2581
|
try {
|
|
2298
|
-
const parsed = JSON.parse(await
|
|
2582
|
+
const parsed = JSON.parse(await readFile6(path, "utf8"));
|
|
2299
2583
|
const exp = parsed?.claudeAiOauth?.expiresAt;
|
|
2300
2584
|
return typeof exp === "number" && Number.isFinite(exp) && exp < now;
|
|
2301
2585
|
} catch {
|
|
@@ -2304,7 +2588,7 @@ async function hostClaudeBackupExpired(path = CLAUDE_HOST_BACKUP, now = Date.now
|
|
|
2304
2588
|
}
|
|
2305
2589
|
async function hostBackupHasCredentials(path = CLAUDE_HOST_BACKUP) {
|
|
2306
2590
|
try {
|
|
2307
|
-
const parsed = JSON.parse(await
|
|
2591
|
+
const parsed = JSON.parse(await readFile6(path, "utf8"));
|
|
2308
2592
|
const rt = parsed?.claudeAiOauth?.refreshToken;
|
|
2309
2593
|
return typeof rt === "string" && rt.length > 0;
|
|
2310
2594
|
} catch {
|
|
@@ -2320,9 +2604,9 @@ async function extractCredentials(transport, opts = {}) {
|
|
|
2320
2604
|
try {
|
|
2321
2605
|
const text = await transport.readText(spec.credential.boxAbsPath);
|
|
2322
2606
|
if (!text || !isRealAgentCredential(spec.id, text)) continue;
|
|
2323
|
-
await
|
|
2324
|
-
await
|
|
2325
|
-
await
|
|
2607
|
+
await mkdir6(dirname8(hostBackup), { recursive: true });
|
|
2608
|
+
await writeFile6(hostBackup, text, { mode: 384 });
|
|
2609
|
+
await chmod2(hostBackup, 384).catch(() => {
|
|
2326
2610
|
});
|
|
2327
2611
|
extracted.push(spec.id);
|
|
2328
2612
|
log(`extracted ${spec.id} login from box to ${hostBackup}`);
|
|
@@ -2334,6 +2618,88 @@ async function extractCredentials(transport, opts = {}) {
|
|
|
2334
2618
|
}
|
|
2335
2619
|
return extracted;
|
|
2336
2620
|
}
|
|
2621
|
+
var MAX_CREDENTIAL_BYTES = 256 * 1024;
|
|
2622
|
+
function parseCredentialsUpdate(payload) {
|
|
2623
|
+
if (payload === null || typeof payload !== "object") return null;
|
|
2624
|
+
const obj = payload;
|
|
2625
|
+
const agent = obj["agent"];
|
|
2626
|
+
if (typeof agent !== "string" || !AGENT_SYNC_SPECS.some((s) => s.id === agent)) return null;
|
|
2627
|
+
const b64 = obj["contentBase64"];
|
|
2628
|
+
if (typeof b64 !== "string" || b64.length === 0 || b64.length > MAX_CREDENTIAL_BYTES) return null;
|
|
2629
|
+
let content;
|
|
2630
|
+
try {
|
|
2631
|
+
content = Buffer.from(b64, "base64").toString("utf8");
|
|
2632
|
+
} catch {
|
|
2633
|
+
return null;
|
|
2634
|
+
}
|
|
2635
|
+
if (!isRealAgentCredential(agent, content)) return null;
|
|
2636
|
+
return { agent, content };
|
|
2637
|
+
}
|
|
2638
|
+
function claudeExpiresAt(text) {
|
|
2639
|
+
try {
|
|
2640
|
+
const parsed = JSON.parse(text);
|
|
2641
|
+
const exp = parsed?.claudeAiOauth?.expiresAt;
|
|
2642
|
+
return typeof exp === "number" && Number.isFinite(exp) ? exp : null;
|
|
2643
|
+
} catch {
|
|
2644
|
+
return null;
|
|
2645
|
+
}
|
|
2646
|
+
}
|
|
2647
|
+
function shouldAcceptCredentialUpdate(agent, incoming, existing) {
|
|
2648
|
+
if (existing === null) return { accept: true, reason: "no existing backup" };
|
|
2649
|
+
if (existing === incoming) return { accept: false, reason: "unchanged" };
|
|
2650
|
+
if (resolveAgentSpec(agent).credential.realShape === "claude-oauth") {
|
|
2651
|
+
const incomingExp = claudeExpiresAt(incoming);
|
|
2652
|
+
const existingExp = claudeExpiresAt(existing);
|
|
2653
|
+
if (incomingExp === null) return { accept: false, reason: "incoming blob has no expiresAt" };
|
|
2654
|
+
if (existingExp !== null && incomingExp <= existingExp) {
|
|
2655
|
+
return { accept: false, reason: "not newer than backup" };
|
|
2656
|
+
}
|
|
2657
|
+
return { accept: true, reason: "newer expiresAt" };
|
|
2658
|
+
}
|
|
2659
|
+
return { accept: true, reason: "content changed" };
|
|
2660
|
+
}
|
|
2661
|
+
async function writeCredentialBackup(agent, content, opts = {}) {
|
|
2662
|
+
const path = opts.backupPath ?? resolveAgentSpec(agent).credential.hostBackup;
|
|
2663
|
+
await mkdir6(dirname8(path), { recursive: true });
|
|
2664
|
+
const tmp = `${path}.tmp-${String(process.pid)}`;
|
|
2665
|
+
await writeFile6(tmp, content, { mode: 384 });
|
|
2666
|
+
await rename3(tmp, path);
|
|
2667
|
+
await chmod2(path, 384).catch(() => {
|
|
2668
|
+
});
|
|
2669
|
+
}
|
|
2670
|
+
async function readCredentialBackup(agent, opts = {}) {
|
|
2671
|
+
const path = opts.backupPath ?? resolveAgentSpec(agent).credential.hostBackup;
|
|
2672
|
+
try {
|
|
2673
|
+
return await readFile6(path, "utf8");
|
|
2674
|
+
} catch {
|
|
2675
|
+
return null;
|
|
2676
|
+
}
|
|
2677
|
+
}
|
|
2678
|
+
async function pushCredentialToBox(transport, agent, content) {
|
|
2679
|
+
const abs = resolveAgentSpec(agent).credential.boxAbsPath;
|
|
2680
|
+
const dir = abs.slice(0, abs.lastIndexOf("/"));
|
|
2681
|
+
const stage = await mkdtemp4(join14(tmpdir4(), "agentbox-cred-push-"));
|
|
2682
|
+
try {
|
|
2683
|
+
const tmp = join14(stage, "credential");
|
|
2684
|
+
await writeFile6(tmp, content, { mode: 384 });
|
|
2685
|
+
const mk = await transport.exec(["sh", "-c", `mkdir -p '${dir}'`]);
|
|
2686
|
+
if (mk.exitCode !== 0) {
|
|
2687
|
+
throw new Error(`mkdir ${dir} in box failed: ${mk.stderr.trim()}`);
|
|
2688
|
+
}
|
|
2689
|
+
await transport.pushFile(tmp, abs);
|
|
2690
|
+
const normalize22 = `chown "$(id -un):" '${abs}' && chmod 600 '${abs}'`;
|
|
2691
|
+
const norm = await transport.exec([
|
|
2692
|
+
"sh",
|
|
2693
|
+
"-c",
|
|
2694
|
+
`{ ${normalize22}; } 2>/dev/null || sudo sh -c "${normalize22.replaceAll('"', '\\"')}"`
|
|
2695
|
+
]);
|
|
2696
|
+
if (norm.exitCode !== 0) {
|
|
2697
|
+
throw new Error(`chown/chmod of ${abs} in box failed: ${norm.stderr.trim()}`);
|
|
2698
|
+
}
|
|
2699
|
+
} finally {
|
|
2700
|
+
await rm5(stage, { recursive: true, force: true });
|
|
2701
|
+
}
|
|
2702
|
+
}
|
|
2337
2703
|
var NON_REGULAR_TOKEN = "-";
|
|
2338
2704
|
function classifyUntrackedOverlay(boxToken, hostHash) {
|
|
2339
2705
|
if (boxToken === void 0) return "copy";
|
|
@@ -2482,7 +2848,7 @@ function makeHostGitPorts() {
|
|
|
2482
2848
|
return untracked.exitCode === 0 ? splitNul(untracked.stdout) : [];
|
|
2483
2849
|
},
|
|
2484
2850
|
async hashHostFile(hostMain, relPath) {
|
|
2485
|
-
return createHash("sha256").update(await
|
|
2851
|
+
return createHash("sha256").update(await readFile7(join15(hostMain, relPath))).digest("hex");
|
|
2486
2852
|
},
|
|
2487
2853
|
async packHostFiles(hostMain, relPaths) {
|
|
2488
2854
|
const tarOut = await execa("tar", ["-C", hostMain, "--null", "-T", "-", "-cf", "-"], {
|
|
@@ -2497,9 +2863,9 @@ function makeHostGitPorts() {
|
|
|
2497
2863
|
var BOX_WORKFLOWS_DIR = "/home/vscode/.claude/workflows";
|
|
2498
2864
|
var BOX_DYNAMIC_SYNC_MANIFEST = "/home/vscode/.agentbox/dynamic-sync.json";
|
|
2499
2865
|
var BOX_MEMORY_DIR = `${BOX_CLAUDE_PROJECT_DIR}/memory`;
|
|
2500
|
-
async function
|
|
2866
|
+
async function pathExists4(p) {
|
|
2501
2867
|
try {
|
|
2502
|
-
await
|
|
2868
|
+
await stat8(p);
|
|
2503
2869
|
return true;
|
|
2504
2870
|
} catch {
|
|
2505
2871
|
return false;
|
|
@@ -2508,21 +2874,21 @@ async function pathExists3(p) {
|
|
|
2508
2874
|
async function walkFiles(root, prefix = "") {
|
|
2509
2875
|
let entries;
|
|
2510
2876
|
try {
|
|
2511
|
-
entries = await
|
|
2877
|
+
entries = await readdir5(root, { withFileTypes: true });
|
|
2512
2878
|
} catch {
|
|
2513
2879
|
return [];
|
|
2514
2880
|
}
|
|
2515
2881
|
const out = [];
|
|
2516
2882
|
for (const ent of entries) {
|
|
2517
2883
|
const rel = prefix ? `${prefix}/${ent.name}` : ent.name;
|
|
2518
|
-
const full =
|
|
2884
|
+
const full = join16(root, ent.name);
|
|
2519
2885
|
if (ent.isDirectory()) {
|
|
2520
2886
|
out.push(...await walkFiles(full, rel));
|
|
2521
2887
|
} else if (ent.isFile()) {
|
|
2522
2888
|
out.push(rel);
|
|
2523
2889
|
} else if (ent.isSymbolicLink()) {
|
|
2524
2890
|
try {
|
|
2525
|
-
const s = await
|
|
2891
|
+
const s = await stat8(full);
|
|
2526
2892
|
if (s.isFile()) out.push(rel);
|
|
2527
2893
|
} catch {
|
|
2528
2894
|
}
|
|
@@ -2531,7 +2897,7 @@ async function walkFiles(root, prefix = "") {
|
|
|
2531
2897
|
return out;
|
|
2532
2898
|
}
|
|
2533
2899
|
async function hashFile(absPath) {
|
|
2534
|
-
const buf = await
|
|
2900
|
+
const buf = await readFile8(absPath);
|
|
2535
2901
|
return createHash2("sha256").update(buf).digest("hex");
|
|
2536
2902
|
}
|
|
2537
2903
|
async function buildHostSet(name, hostDir, boxDst) {
|
|
@@ -2539,13 +2905,13 @@ async function buildHostSet(name, hostDir, boxDst) {
|
|
|
2539
2905
|
const rels = await walkFiles(hostDir);
|
|
2540
2906
|
const files = {};
|
|
2541
2907
|
for (const rel of rels) {
|
|
2542
|
-
files[rel] = await hashFile(
|
|
2908
|
+
files[rel] = await hashFile(join16(hostDir, rel));
|
|
2543
2909
|
}
|
|
2544
2910
|
return { dst: boxDst, files, hostDir };
|
|
2545
2911
|
}
|
|
2546
|
-
async function buildHostSyncManifest(workspacePath, hostHome =
|
|
2547
|
-
const workflowsDir =
|
|
2548
|
-
const workflowsHost = await
|
|
2912
|
+
async function buildHostSyncManifest(workspacePath, hostHome = homedir9()) {
|
|
2913
|
+
const workflowsDir = join16(hostHome, ".claude", "workflows");
|
|
2914
|
+
const workflowsHost = await pathExists4(workflowsDir) ? workflowsDir : null;
|
|
2549
2915
|
const memoryHost = await resolveClaudeMemoryDir(workspacePath, hostHome);
|
|
2550
2916
|
const [workflows, memory] = await Promise.all([
|
|
2551
2917
|
buildHostSet("workflows", workflowsHost, BOX_WORKFLOWS_DIR),
|
|
@@ -2566,7 +2932,7 @@ function computeSyncDelta(host, box) {
|
|
|
2566
2932
|
uploads.push({
|
|
2567
2933
|
set: name,
|
|
2568
2934
|
rel,
|
|
2569
|
-
absSrc:
|
|
2935
|
+
absSrc: join16(hostSet.hostDir, rel),
|
|
2570
2936
|
dst: `${hostSet.dst}/${rel}`
|
|
2571
2937
|
});
|
|
2572
2938
|
}
|
|
@@ -2585,15 +2951,15 @@ async function stageDynamicSyncTarball(uploads) {
|
|
|
2585
2951
|
return { tarballPath: null, cleanup: async () => {
|
|
2586
2952
|
} };
|
|
2587
2953
|
}
|
|
2588
|
-
const stageDir = await
|
|
2954
|
+
const stageDir = await mkdtemp5(join16(tmpdir5(), "agentbox-dynsync-stage-"));
|
|
2589
2955
|
let tarballPath = null;
|
|
2590
2956
|
try {
|
|
2591
2957
|
for (const up of uploads) {
|
|
2592
|
-
const target =
|
|
2593
|
-
await
|
|
2958
|
+
const target = join16(stageDir, up.set, up.rel);
|
|
2959
|
+
await mkdir7(dirname9(target), { recursive: true });
|
|
2594
2960
|
await copyFile(up.absSrc, target);
|
|
2595
2961
|
}
|
|
2596
|
-
tarballPath =
|
|
2962
|
+
tarballPath = join16(tmpdir5(), `agentbox-dynsync-${basename22(stageDir)}.tar.gz`);
|
|
2597
2963
|
await execa("tar", ["-czf", tarballPath, "-C", stageDir, "."], {
|
|
2598
2964
|
env: { ...process.env, COPYFILE_DISABLE: "1" }
|
|
2599
2965
|
});
|
|
@@ -2601,13 +2967,13 @@ async function stageDynamicSyncTarball(uploads) {
|
|
|
2601
2967
|
return {
|
|
2602
2968
|
tarballPath: tp,
|
|
2603
2969
|
cleanup: async () => {
|
|
2604
|
-
await
|
|
2605
|
-
await
|
|
2970
|
+
await rm6(stageDir, { recursive: true, force: true });
|
|
2971
|
+
await rm6(tp, { force: true });
|
|
2606
2972
|
}
|
|
2607
2973
|
};
|
|
2608
2974
|
} catch (err) {
|
|
2609
|
-
await
|
|
2610
|
-
if (tarballPath) await
|
|
2975
|
+
await rm6(stageDir, { recursive: true, force: true });
|
|
2976
|
+
if (tarballPath) await rm6(tarballPath, { force: true });
|
|
2611
2977
|
throw err;
|
|
2612
2978
|
}
|
|
2613
2979
|
}
|
|
@@ -2727,7 +3093,7 @@ var BOX_WORKSPACE2 = "/workspace";
|
|
|
2727
3093
|
var MINIMAL_TRUSTED_CODEX_CONFIG = `[projects."${BOX_WORKSPACE2}"]
|
|
2728
3094
|
trust_level = "trusted"
|
|
2729
3095
|
`;
|
|
2730
|
-
function sanitizeCodexConfigForBox(tomlText, hostHome =
|
|
3096
|
+
function sanitizeCodexConfigForBox(tomlText, hostHome = homedir10()) {
|
|
2731
3097
|
const cfg = parse(tomlText);
|
|
2732
3098
|
let changed = false;
|
|
2733
3099
|
if (isRecord(cfg["mcp_servers"])) {
|
|
@@ -2773,13 +3139,52 @@ function sanitizeCodexConfigForBox(tomlText, hostHome = homedir9()) {
|
|
|
2773
3139
|
projects[BOX_WORKSPACE2] = wsEntry;
|
|
2774
3140
|
changed = true;
|
|
2775
3141
|
}
|
|
2776
|
-
|
|
3142
|
+
const keptMarketplaces = isRecord(cfg["marketplaces"]) ? Object.keys(cfg["marketplaces"]) : [];
|
|
3143
|
+
return { text: changed ? stringify(cfg) : tomlText, changed, keptMarketplaces };
|
|
3144
|
+
}
|
|
3145
|
+
var BOX_MERGED_TABLES = ["marketplaces", "plugins", "mcp_servers", "projects"];
|
|
3146
|
+
function mergeCodexConfigForBox(hostSanitizedText, boxText) {
|
|
3147
|
+
const host = parse(hostSanitizedText);
|
|
3148
|
+
const hostMarketplaces = () => isRecord(host["marketplaces"]) ? Object.keys(host["marketplaces"]) : [];
|
|
3149
|
+
if (boxText === null) {
|
|
3150
|
+
return { text: hostSanitizedText, marketplaces: hostMarketplaces(), mergedFromBox: false };
|
|
3151
|
+
}
|
|
3152
|
+
let box;
|
|
3153
|
+
try {
|
|
3154
|
+
box = parse(boxText);
|
|
3155
|
+
} catch {
|
|
3156
|
+
return { text: hostSanitizedText, marketplaces: hostMarketplaces(), mergedFromBox: false };
|
|
3157
|
+
}
|
|
3158
|
+
let merged = false;
|
|
3159
|
+
for (const table of BOX_MERGED_TABLES) {
|
|
3160
|
+
const boxTable = box[table];
|
|
3161
|
+
if (!isRecord(boxTable)) continue;
|
|
3162
|
+
const hostTable = isRecord(host[table]) ? host[table] : {};
|
|
3163
|
+
for (const [name, def] of Object.entries(boxTable)) {
|
|
3164
|
+
if (name in hostTable) continue;
|
|
3165
|
+
hostTable[name] = def;
|
|
3166
|
+
merged = true;
|
|
3167
|
+
}
|
|
3168
|
+
if (Object.keys(hostTable).length > 0) host[table] = hostTable;
|
|
3169
|
+
}
|
|
3170
|
+
for (const [key, value] of Object.entries(box)) {
|
|
3171
|
+
if (BOX_MERGED_TABLES.includes(key)) continue;
|
|
3172
|
+
if (key in host) continue;
|
|
3173
|
+
host[key] = value;
|
|
3174
|
+
merged = true;
|
|
3175
|
+
}
|
|
3176
|
+
const marketplaces = isRecord(host["marketplaces"]) ? Object.keys(host["marketplaces"]) : [];
|
|
3177
|
+
return {
|
|
3178
|
+
text: merged ? stringify(host) : hostSanitizedText,
|
|
3179
|
+
marketplaces,
|
|
3180
|
+
mergedFromBox: merged
|
|
3181
|
+
};
|
|
2777
3182
|
}
|
|
2778
3183
|
var CREDENTIALS_BACKUP_FILE = resolveAgentSpec("claude").credential.hostBackup;
|
|
2779
3184
|
var CLOUD_WORKSPACE = "/workspace";
|
|
2780
|
-
async function
|
|
3185
|
+
async function pathExists5(p) {
|
|
2781
3186
|
try {
|
|
2782
|
-
await
|
|
3187
|
+
await stat9(p);
|
|
2783
3188
|
return true;
|
|
2784
3189
|
} catch {
|
|
2785
3190
|
return false;
|
|
@@ -2790,15 +3195,15 @@ async function findBrokenSymlinks(root) {
|
|
|
2790
3195
|
async function walk(dir) {
|
|
2791
3196
|
let entries;
|
|
2792
3197
|
try {
|
|
2793
|
-
entries = await
|
|
3198
|
+
entries = await readdir6(dir, { withFileTypes: true });
|
|
2794
3199
|
} catch {
|
|
2795
3200
|
return;
|
|
2796
3201
|
}
|
|
2797
3202
|
for (const ent of entries) {
|
|
2798
|
-
const full =
|
|
3203
|
+
const full = join17(dir, ent.name);
|
|
2799
3204
|
if (ent.isSymbolicLink()) {
|
|
2800
3205
|
try {
|
|
2801
|
-
await
|
|
3206
|
+
await stat9(full);
|
|
2802
3207
|
} catch {
|
|
2803
3208
|
broken.push(relative2(root, full));
|
|
2804
3209
|
}
|
|
@@ -2811,14 +3216,15 @@ async function findBrokenSymlinks(root) {
|
|
|
2811
3216
|
return broken;
|
|
2812
3217
|
}
|
|
2813
3218
|
async function mkStageDir(prefix) {
|
|
2814
|
-
return
|
|
3219
|
+
return mkdtemp6(join17(tmpdir6(), `agentbox-${prefix}-stage-`));
|
|
2815
3220
|
}
|
|
3221
|
+
var STAGE_WRITABLE_CHMOD = "--chmod=Du+rwx,Fu+rw";
|
|
2816
3222
|
function emptyResult(warnings = []) {
|
|
2817
3223
|
return { tarballPath: null, cleanup: async () => {
|
|
2818
3224
|
}, warnings };
|
|
2819
3225
|
}
|
|
2820
3226
|
async function tarballFromDir(stageDir, agent) {
|
|
2821
|
-
const tarballPath =
|
|
3227
|
+
const tarballPath = join17(tmpdir6(), `agentbox-${agent}-${basename3(stageDir)}.tar.gz`);
|
|
2822
3228
|
await execa("tar", ["-czf", tarballPath, "-C", stageDir, "."], {
|
|
2823
3229
|
env: { ...process.env, COPYFILE_DISABLE: "1" }
|
|
2824
3230
|
});
|
|
@@ -2827,7 +3233,7 @@ async function tarballFromDir(stageDir, agent) {
|
|
|
2827
3233
|
function makeCleanup(paths) {
|
|
2828
3234
|
return async () => {
|
|
2829
3235
|
for (const p of paths) {
|
|
2830
|
-
await
|
|
3236
|
+
await rm7(p, { recursive: true, force: true });
|
|
2831
3237
|
}
|
|
2832
3238
|
};
|
|
2833
3239
|
}
|
|
@@ -2835,7 +3241,7 @@ async function stageSingleFileTarball(agent, sourcePath, tarballEntryName) {
|
|
|
2835
3241
|
const stageDir = await mkStageDir(agent);
|
|
2836
3242
|
let tarballPath = null;
|
|
2837
3243
|
try {
|
|
2838
|
-
await copyFile2(sourcePath,
|
|
3244
|
+
await copyFile2(sourcePath, join17(stageDir, tarballEntryName));
|
|
2839
3245
|
tarballPath = await tarballFromDir(stageDir, agent);
|
|
2840
3246
|
return {
|
|
2841
3247
|
tarballPath,
|
|
@@ -2843,19 +3249,19 @@ async function stageSingleFileTarball(agent, sourcePath, tarballEntryName) {
|
|
|
2843
3249
|
warnings: []
|
|
2844
3250
|
};
|
|
2845
3251
|
} catch (err) {
|
|
2846
|
-
await
|
|
2847
|
-
if (tarballPath) await
|
|
3252
|
+
await rm7(stageDir, { recursive: true, force: true });
|
|
3253
|
+
if (tarballPath) await rm7(tarballPath, { force: true });
|
|
2848
3254
|
throw err;
|
|
2849
3255
|
}
|
|
2850
3256
|
}
|
|
2851
3257
|
var CLAUDE_STATIC_EXCLUDES = resolveAgentSpec("claude").staticPaths[0]?.exclude ?? [];
|
|
2852
3258
|
async function buildBoxClaudeJsonFromHost(opts) {
|
|
2853
3259
|
const { hostHome, hostWorkspace } = opts;
|
|
2854
|
-
const hostClaudeJson =
|
|
3260
|
+
const hostClaudeJson = join17(hostHome, ".claude.json");
|
|
2855
3261
|
let working;
|
|
2856
|
-
if (await
|
|
3262
|
+
if (await pathExists5(hostClaudeJson)) {
|
|
2857
3263
|
try {
|
|
2858
|
-
working = JSON.parse(await
|
|
3264
|
+
working = JSON.parse(await readFile9(hostClaudeJson, "utf8"));
|
|
2859
3265
|
} catch {
|
|
2860
3266
|
working = null;
|
|
2861
3267
|
}
|
|
@@ -2886,7 +3292,7 @@ async function buildBoxClaudeJsonFromHost(opts) {
|
|
|
2886
3292
|
return working;
|
|
2887
3293
|
}
|
|
2888
3294
|
async function stageClaudeJsonOnlyForUpload(opts = {}) {
|
|
2889
|
-
const hostHome = opts.hostHome ??
|
|
3295
|
+
const hostHome = opts.hostHome ?? homedir11();
|
|
2890
3296
|
const stageDir = await mkStageDir("claude-json-only");
|
|
2891
3297
|
let tarballPath = null;
|
|
2892
3298
|
try {
|
|
@@ -2894,7 +3300,7 @@ async function stageClaudeJsonOnlyForUpload(opts = {}) {
|
|
|
2894
3300
|
hostHome,
|
|
2895
3301
|
hostWorkspace: opts.hostWorkspace
|
|
2896
3302
|
});
|
|
2897
|
-
await
|
|
3303
|
+
await writeFile7(join17(stageDir, "_claude.json"), JSON.stringify(claudeJson, null, 2));
|
|
2898
3304
|
tarballPath = await tarballFromDir(stageDir, "claude-json-only");
|
|
2899
3305
|
return {
|
|
2900
3306
|
tarballPath,
|
|
@@ -2902,15 +3308,15 @@ async function stageClaudeJsonOnlyForUpload(opts = {}) {
|
|
|
2902
3308
|
warnings: []
|
|
2903
3309
|
};
|
|
2904
3310
|
} catch (err) {
|
|
2905
|
-
await
|
|
2906
|
-
if (tarballPath) await
|
|
3311
|
+
await rm7(stageDir, { recursive: true, force: true });
|
|
3312
|
+
if (tarballPath) await rm7(tarballPath, { force: true });
|
|
2907
3313
|
throw err;
|
|
2908
3314
|
}
|
|
2909
3315
|
}
|
|
2910
3316
|
async function stageClaudeStaticForUpload(opts = {}) {
|
|
2911
|
-
const hostHome = opts.hostHome ??
|
|
2912
|
-
const hostClaude =
|
|
2913
|
-
if (!await
|
|
3317
|
+
const hostHome = opts.hostHome ?? homedir11();
|
|
3318
|
+
const hostClaude = join17(hostHome, ".claude");
|
|
3319
|
+
if (!await pathExists5(hostClaude)) return emptyResult();
|
|
2914
3320
|
const stageDir = await mkStageDir("claude-static");
|
|
2915
3321
|
let tarballPath = null;
|
|
2916
3322
|
try {
|
|
@@ -2921,18 +3327,19 @@ async function stageClaudeStaticForUpload(opts = {}) {
|
|
|
2921
3327
|
];
|
|
2922
3328
|
await execa("rsync", [
|
|
2923
3329
|
"-a",
|
|
3330
|
+
STAGE_WRITABLE_CHMOD,
|
|
2924
3331
|
"--copy-unsafe-links",
|
|
2925
3332
|
...excludes,
|
|
2926
3333
|
`${hostClaude}/`,
|
|
2927
3334
|
`${stageDir}/`
|
|
2928
3335
|
]);
|
|
2929
|
-
const settingsPath =
|
|
2930
|
-
if (await
|
|
3336
|
+
const settingsPath = join17(stageDir, "settings.json");
|
|
3337
|
+
if (await pathExists5(settingsPath)) {
|
|
2931
3338
|
try {
|
|
2932
|
-
const parsed = JSON.parse(await
|
|
3339
|
+
const parsed = JSON.parse(await readFile9(settingsPath, "utf8"));
|
|
2933
3340
|
const filtered = filterHostHooks(parsed, hostHome);
|
|
2934
3341
|
if (filtered.removedCommands.length > 0) {
|
|
2935
|
-
await
|
|
3342
|
+
await writeFile7(settingsPath, JSON.stringify(filtered.data, null, 2));
|
|
2936
3343
|
}
|
|
2937
3344
|
} catch {
|
|
2938
3345
|
}
|
|
@@ -2941,17 +3348,17 @@ async function stageClaudeStaticForUpload(opts = {}) {
|
|
|
2941
3348
|
hostHome,
|
|
2942
3349
|
hostWorkspace: opts.hostWorkspace
|
|
2943
3350
|
});
|
|
2944
|
-
await
|
|
2945
|
-
const pluginsDir =
|
|
2946
|
-
if (await
|
|
3351
|
+
await writeFile7(join17(stageDir, "_claude.json"), JSON.stringify(claudeJson, null, 2));
|
|
3352
|
+
const pluginsDir = join17(stageDir, "plugins");
|
|
3353
|
+
if (await pathExists5(pluginsDir)) {
|
|
2947
3354
|
try {
|
|
2948
|
-
const entries = await
|
|
3355
|
+
const entries = await readdir6(pluginsDir, { withFileTypes: true });
|
|
2949
3356
|
for (const ent of entries) {
|
|
2950
3357
|
if (!ent.isFile() || !ent.name.endsWith(".json")) continue;
|
|
2951
|
-
const file =
|
|
2952
|
-
const raw = await
|
|
3358
|
+
const file = join17(pluginsDir, ent.name);
|
|
3359
|
+
const raw = await readFile9(file, "utf8");
|
|
2953
3360
|
const replaced = raw.split(`${hostHome}/.claude/plugins/`).join("/home/vscode/.claude/plugins/");
|
|
2954
|
-
if (replaced !== raw) await
|
|
3361
|
+
if (replaced !== raw) await writeFile7(file, replaced);
|
|
2955
3362
|
}
|
|
2956
3363
|
} catch {
|
|
2957
3364
|
}
|
|
@@ -2963,42 +3370,69 @@ async function stageClaudeStaticForUpload(opts = {}) {
|
|
|
2963
3370
|
warnings: []
|
|
2964
3371
|
};
|
|
2965
3372
|
} catch (err) {
|
|
2966
|
-
await
|
|
2967
|
-
if (tarballPath) await
|
|
3373
|
+
await rm7(stageDir, { recursive: true, force: true });
|
|
3374
|
+
if (tarballPath) await rm7(tarballPath, { force: true });
|
|
2968
3375
|
throw err;
|
|
2969
3376
|
}
|
|
2970
3377
|
}
|
|
2971
3378
|
async function stageClaudeCredentialsForUpload() {
|
|
2972
|
-
if (!await
|
|
3379
|
+
if (!await pathExists5(CREDENTIALS_BACKUP_FILE)) return emptyResult();
|
|
2973
3380
|
return stageSingleFileTarball("claude-creds", CREDENTIALS_BACKUP_FILE, ".credentials.json");
|
|
2974
3381
|
}
|
|
2975
3382
|
var CODEX_STATIC_EXCLUDES = resolveAgentSpec("codex").staticPaths[0]?.exclude ?? [];
|
|
3383
|
+
var CODEX_STATIC_INCLUDES = resolveAgentSpec("codex").staticPaths[0]?.include ?? [];
|
|
2976
3384
|
var CODEX_KEYCHAIN_WARNING = 'codex: ~/.codex/auth.json missing. On macOS the codex CLI defaults to storing the OAuth token in the system Keychain, which isn\'t reachable from a remote sandbox. To share creds with cloud boxes either:\n - add `cli_auth_credentials_store = "file"` to ~/.codex/config.toml then re-run `codex login`, or\n - set OPENAI_API_KEY in your environment, or\n - run `codex login --with-api-key` for a file-backed login.\nSkipping codex seed; in-box codex will prompt for sign-in.';
|
|
2977
3385
|
async function sanitizeStagedCodexConfig(configPath, hostHome) {
|
|
2978
3386
|
try {
|
|
2979
|
-
if (!await
|
|
2980
|
-
const { text, changed } = sanitizeCodexConfigForBox(
|
|
2981
|
-
|
|
3387
|
+
if (!await pathExists5(configPath)) return { keptMarketplaces: [] };
|
|
3388
|
+
const { text, changed, keptMarketplaces } = sanitizeCodexConfigForBox(
|
|
3389
|
+
await readFile9(configPath, "utf8"),
|
|
3390
|
+
hostHome
|
|
3391
|
+
);
|
|
3392
|
+
if (changed) await writeFile7(configPath, text);
|
|
3393
|
+
return { keptMarketplaces };
|
|
2982
3394
|
} catch {
|
|
3395
|
+
return null;
|
|
3396
|
+
}
|
|
3397
|
+
}
|
|
3398
|
+
async function purgeOrphanCodexMarketplaceDirs(stageDir, keptMarketplaces) {
|
|
3399
|
+
const kept = new Set(keptMarketplaces);
|
|
3400
|
+
for (const rel of ["plugins/cache", ".tmp/marketplaces"]) {
|
|
3401
|
+
const dir = join17(stageDir, rel);
|
|
3402
|
+
let entries;
|
|
3403
|
+
try {
|
|
3404
|
+
entries = await readdir6(dir);
|
|
3405
|
+
} catch {
|
|
3406
|
+
continue;
|
|
3407
|
+
}
|
|
3408
|
+
for (const name of entries) {
|
|
3409
|
+
if (kept.has(name)) continue;
|
|
3410
|
+
await rm7(join17(dir, name), { recursive: true, force: true });
|
|
3411
|
+
}
|
|
2983
3412
|
}
|
|
2984
3413
|
}
|
|
2985
3414
|
async function stageCodexStaticForUpload(opts = {}) {
|
|
2986
|
-
const hostHome = opts.hostHome ??
|
|
2987
|
-
const hostCodex =
|
|
2988
|
-
if (!await
|
|
3415
|
+
const hostHome = opts.hostHome ?? homedir11();
|
|
3416
|
+
const hostCodex = join17(hostHome, ".codex");
|
|
3417
|
+
if (!await pathExists5(hostCodex)) return emptyResult();
|
|
2989
3418
|
const stageDir = await mkStageDir("codex-static");
|
|
2990
3419
|
let tarballPath = null;
|
|
2991
3420
|
try {
|
|
2992
3421
|
const codexBroken = await findBrokenSymlinks(hostCodex);
|
|
2993
3422
|
await execa("rsync", [
|
|
2994
3423
|
"-a",
|
|
3424
|
+
STAGE_WRITABLE_CHMOD,
|
|
2995
3425
|
"-L",
|
|
2996
3426
|
...codexBroken.map((r) => `--exclude=/${r}`),
|
|
3427
|
+
...CODEX_STATIC_INCLUDES.map((p) => `--include=${p}`),
|
|
2997
3428
|
...CODEX_STATIC_EXCLUDES.map((p) => `--exclude=${p}`),
|
|
2998
3429
|
`${hostCodex}/`,
|
|
2999
3430
|
`${stageDir}/`
|
|
3000
3431
|
]);
|
|
3001
|
-
await sanitizeStagedCodexConfig(
|
|
3432
|
+
const sanitized = await sanitizeStagedCodexConfig(join17(stageDir, "config.toml"), hostHome);
|
|
3433
|
+
if (sanitized !== null) {
|
|
3434
|
+
await purgeOrphanCodexMarketplaceDirs(stageDir, sanitized.keptMarketplaces);
|
|
3435
|
+
}
|
|
3002
3436
|
tarballPath = await tarballFromDir(stageDir, "codex-static");
|
|
3003
3437
|
return {
|
|
3004
3438
|
tarballPath,
|
|
@@ -3006,21 +3440,22 @@ async function stageCodexStaticForUpload(opts = {}) {
|
|
|
3006
3440
|
warnings: []
|
|
3007
3441
|
};
|
|
3008
3442
|
} catch (err) {
|
|
3009
|
-
await
|
|
3010
|
-
if (tarballPath) await
|
|
3443
|
+
await rm7(stageDir, { recursive: true, force: true });
|
|
3444
|
+
if (tarballPath) await rm7(tarballPath, { force: true });
|
|
3011
3445
|
throw err;
|
|
3012
3446
|
}
|
|
3013
3447
|
}
|
|
3014
3448
|
async function stageAgentsStaticForUpload(opts = {}) {
|
|
3015
|
-
const hostHome = opts.hostHome ??
|
|
3016
|
-
const hostAgents =
|
|
3017
|
-
if (!await
|
|
3449
|
+
const hostHome = opts.hostHome ?? homedir11();
|
|
3450
|
+
const hostAgents = join17(hostHome, ".agents");
|
|
3451
|
+
if (!await pathExists5(hostAgents)) return emptyResult();
|
|
3018
3452
|
const stageDir = await mkStageDir("agents-static");
|
|
3019
3453
|
let tarballPath = null;
|
|
3020
3454
|
try {
|
|
3021
3455
|
const broken = await findBrokenSymlinks(hostAgents);
|
|
3022
3456
|
await execa("rsync", [
|
|
3023
3457
|
"-a",
|
|
3458
|
+
STAGE_WRITABLE_CHMOD,
|
|
3024
3459
|
"-L",
|
|
3025
3460
|
...broken.map((r) => `--exclude=/${r}`),
|
|
3026
3461
|
`${hostAgents}/`,
|
|
@@ -3033,28 +3468,28 @@ async function stageAgentsStaticForUpload(opts = {}) {
|
|
|
3033
3468
|
warnings: []
|
|
3034
3469
|
};
|
|
3035
3470
|
} catch (err) {
|
|
3036
|
-
await
|
|
3037
|
-
if (tarballPath) await
|
|
3471
|
+
await rm7(stageDir, { recursive: true, force: true });
|
|
3472
|
+
if (tarballPath) await rm7(tarballPath, { force: true });
|
|
3038
3473
|
throw err;
|
|
3039
3474
|
}
|
|
3040
3475
|
}
|
|
3041
3476
|
async function stageCodexCredentialsForUpload(opts = {}) {
|
|
3042
|
-
const hostHome = opts.hostHome ??
|
|
3043
|
-
const cloudBackup =
|
|
3044
|
-
if (await
|
|
3477
|
+
const hostHome = opts.hostHome ?? homedir11();
|
|
3478
|
+
const cloudBackup = join17(hostHome, ".agentbox", "codex-credentials.json");
|
|
3479
|
+
if (await pathExists5(cloudBackup)) {
|
|
3045
3480
|
return stageSingleFileTarball("codex-creds", cloudBackup, "auth.json");
|
|
3046
3481
|
}
|
|
3047
|
-
const hostAuth =
|
|
3048
|
-
if (!await
|
|
3482
|
+
const hostAuth = join17(hostHome, ".codex", "auth.json");
|
|
3483
|
+
if (!await pathExists5(hostAuth)) return emptyResult([CODEX_KEYCHAIN_WARNING]);
|
|
3049
3484
|
return stageSingleFileTarball("codex-creds", hostAuth, "auth.json");
|
|
3050
3485
|
}
|
|
3051
3486
|
var OPENCODE_DATA_EXCLUDES = resolveAgentSpec("opencode").staticPaths[0]?.exclude ?? [];
|
|
3052
3487
|
async function stageOpencodeStaticForUpload(opts = {}) {
|
|
3053
|
-
const hostHome = opts.hostHome ??
|
|
3054
|
-
const hostData =
|
|
3055
|
-
const hostConfig =
|
|
3056
|
-
const hasData = await
|
|
3057
|
-
const hasConfig = await
|
|
3488
|
+
const hostHome = opts.hostHome ?? homedir11();
|
|
3489
|
+
const hostData = join17(hostHome, ".local", "share", "opencode");
|
|
3490
|
+
const hostConfig = join17(hostHome, ".config", "opencode");
|
|
3491
|
+
const hasData = await pathExists5(hostData);
|
|
3492
|
+
const hasConfig = await pathExists5(hostConfig);
|
|
3058
3493
|
if (!hasData && !hasConfig) return emptyResult();
|
|
3059
3494
|
const stageDir = await mkStageDir("opencode-static");
|
|
3060
3495
|
let tarballPath = null;
|
|
@@ -3063,6 +3498,7 @@ async function stageOpencodeStaticForUpload(opts = {}) {
|
|
|
3063
3498
|
const dataBroken = await findBrokenSymlinks(hostData);
|
|
3064
3499
|
await execa("rsync", [
|
|
3065
3500
|
"-a",
|
|
3501
|
+
STAGE_WRITABLE_CHMOD,
|
|
3066
3502
|
"-L",
|
|
3067
3503
|
...dataBroken.map((r) => `--exclude=/${r}`),
|
|
3068
3504
|
...OPENCODE_DATA_EXCLUDES.map((p) => `--exclude=${p}`),
|
|
@@ -3071,10 +3507,11 @@ async function stageOpencodeStaticForUpload(opts = {}) {
|
|
|
3071
3507
|
]);
|
|
3072
3508
|
}
|
|
3073
3509
|
if (hasConfig) {
|
|
3074
|
-
const configStage =
|
|
3510
|
+
const configStage = join17(stageDir, "config");
|
|
3075
3511
|
const cfgBroken = await findBrokenSymlinks(hostConfig);
|
|
3076
3512
|
await execa("rsync", [
|
|
3077
3513
|
"-a",
|
|
3514
|
+
STAGE_WRITABLE_CHMOD,
|
|
3078
3515
|
"-L",
|
|
3079
3516
|
...cfgBroken.map((r) => `--exclude=/${r}`),
|
|
3080
3517
|
`${hostConfig}/`,
|
|
@@ -3088,25 +3525,25 @@ async function stageOpencodeStaticForUpload(opts = {}) {
|
|
|
3088
3525
|
warnings: []
|
|
3089
3526
|
};
|
|
3090
3527
|
} catch (err) {
|
|
3091
|
-
await
|
|
3092
|
-
if (tarballPath) await
|
|
3528
|
+
await rm7(stageDir, { recursive: true, force: true });
|
|
3529
|
+
if (tarballPath) await rm7(tarballPath, { force: true });
|
|
3093
3530
|
throw err;
|
|
3094
3531
|
}
|
|
3095
3532
|
}
|
|
3096
3533
|
async function stageOpencodeCredentialsForUpload(opts = {}) {
|
|
3097
|
-
const hostHome = opts.hostHome ??
|
|
3098
|
-
const cloudBackup =
|
|
3099
|
-
if (await
|
|
3534
|
+
const hostHome = opts.hostHome ?? homedir11();
|
|
3535
|
+
const cloudBackup = join17(hostHome, ".agentbox", "opencode-credentials.json");
|
|
3536
|
+
if (await pathExists5(cloudBackup)) {
|
|
3100
3537
|
return stageSingleFileTarball("opencode-creds", cloudBackup, "auth.json");
|
|
3101
3538
|
}
|
|
3102
|
-
const hostAuth =
|
|
3103
|
-
if (!await
|
|
3539
|
+
const hostAuth = join17(hostHome, ".local", "share", "opencode", "auth.json");
|
|
3540
|
+
if (!await pathExists5(hostAuth)) return emptyResult();
|
|
3104
3541
|
return stageSingleFileTarball("opencode-creds", hostAuth, "auth.json");
|
|
3105
3542
|
}
|
|
3106
3543
|
async function stageOpencodeStateForUpload(opts = {}) {
|
|
3107
|
-
const hostHome = opts.hostHome ??
|
|
3108
|
-
const hostModel =
|
|
3109
|
-
if (!await
|
|
3544
|
+
const hostHome = opts.hostHome ?? homedir11();
|
|
3545
|
+
const hostModel = join17(hostHome, ".local", "state", "opencode", "model.json");
|
|
3546
|
+
if (!await pathExists5(hostModel)) return emptyResult();
|
|
3110
3547
|
return stageSingleFileTarball("opencode-state", hostModel, "model.json");
|
|
3111
3548
|
}
|
|
3112
3549
|
var CLAUDE_STATIC_BOX_DIR = "/home/vscode/.claude";
|
|
@@ -3131,7 +3568,7 @@ function preparedStatePathFor(provider) {
|
|
|
3131
3568
|
if (!/^[A-Za-z0-9._-]+$/.test(provider)) {
|
|
3132
3569
|
throw new Error(`invalid provider name for prepared-state: ${JSON.stringify(provider)}`);
|
|
3133
3570
|
}
|
|
3134
|
-
return pathResolve(
|
|
3571
|
+
return pathResolve(homedir12(), ".agentbox", `${provider}-prepared.json`);
|
|
3135
3572
|
}
|
|
3136
3573
|
function readPreparedStateRaw(provider) {
|
|
3137
3574
|
const path = preparedStatePathFor(provider);
|
|
@@ -3144,14 +3581,14 @@ function readPreparedStateRaw(provider) {
|
|
|
3144
3581
|
}
|
|
3145
3582
|
function writePreparedStateRaw(provider, state) {
|
|
3146
3583
|
const path = preparedStatePathFor(provider);
|
|
3147
|
-
mkdirSync3(
|
|
3584
|
+
mkdirSync3(dirname10(path), { recursive: true });
|
|
3148
3585
|
const body = JSON.stringify(state, null, 2) + "\n";
|
|
3149
3586
|
const tmp = `${path}.tmp`;
|
|
3150
3587
|
writeFileSync3(tmp, body, { mode: 384 });
|
|
3151
3588
|
renameSync2(tmp, path);
|
|
3152
3589
|
}
|
|
3153
3590
|
async function sha256OfFile(path) {
|
|
3154
|
-
const buf = await
|
|
3591
|
+
const buf = await readFile10(path);
|
|
3155
3592
|
return createHash3("sha256").update(buf).digest("hex");
|
|
3156
3593
|
}
|
|
3157
3594
|
async function computeContextSha256(files) {
|
|
@@ -3232,11 +3669,11 @@ import { dirname as dirname23, resolve as resolve23 } from "path";
|
|
|
3232
3669
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
3233
3670
|
import { existsSync as existsSync5 } from "fs";
|
|
3234
3671
|
import { fileURLToPath } from "url";
|
|
3235
|
-
import { dirname as
|
|
3672
|
+
import { dirname as dirname7, resolve as resolve4 } from "path";
|
|
3236
3673
|
var DEFAULT_BOX_IMAGE = "agentbox/box:dev";
|
|
3237
3674
|
async function resolveClaudeInstallMode() {
|
|
3238
3675
|
try {
|
|
3239
|
-
const { loadEffectiveConfig } = await import("./dist-
|
|
3676
|
+
const { loadEffectiveConfig } = await import("./dist-GF5EBRNG.js");
|
|
3240
3677
|
const cfg = await loadEffectiveConfig(process.cwd());
|
|
3241
3678
|
return cfg.effective.box.claudeInstall;
|
|
3242
3679
|
} catch {
|
|
@@ -3247,7 +3684,7 @@ var BOX_IMAGE_REGISTRY = "ghcr.io/madarco/agentbox/box";
|
|
|
3247
3684
|
function registryRefForSha(sha, registry = BOX_IMAGE_REGISTRY) {
|
|
3248
3685
|
return `${registry}:sha-${sha.slice(0, 16)}`;
|
|
3249
3686
|
}
|
|
3250
|
-
var here =
|
|
3687
|
+
var here = dirname7(fileURLToPath(import.meta.url));
|
|
3251
3688
|
function resolveDockerBuild() {
|
|
3252
3689
|
const override = process.env.AGENTBOX_DOCKER_CONTEXT;
|
|
3253
3690
|
if (override && existsSync5(resolve4(override, "Dockerfile.box"))) {
|
|
@@ -3350,7 +3787,7 @@ async function buildImage(opts = {}) {
|
|
|
3350
3787
|
return ref;
|
|
3351
3788
|
}
|
|
3352
3789
|
async function pullOrBuild(ref, fingerprint, opts = {}) {
|
|
3353
|
-
const { writePreparedDockerState: writePreparedDockerState2 } = await import("./prepared-state-BUO75YLZ-
|
|
3790
|
+
const { writePreparedDockerState: writePreparedDockerState2 } = await import("./prepared-state-BUO75YLZ-O4GZMDRF.js");
|
|
3354
3791
|
const registry = opts.registry ?? BOX_IMAGE_REGISTRY;
|
|
3355
3792
|
const allowPull = opts.allowPull !== false;
|
|
3356
3793
|
if (allowPull && registry && fingerprint) {
|
|
@@ -3377,7 +3814,7 @@ async function pullOrBuild(ref, fingerprint, opts = {}) {
|
|
|
3377
3814
|
return { source: "built" };
|
|
3378
3815
|
}
|
|
3379
3816
|
async function ensureImage(ref = DEFAULT_BOX_IMAGE, opts = {}) {
|
|
3380
|
-
const { computeDockerContextFingerprint: computeDockerContextFingerprint2, readPreparedDockerState: readPreparedDockerState2, preparedMatches: preparedMatches2 } = await import("./prepared-state-BUO75YLZ-
|
|
3817
|
+
const { computeDockerContextFingerprint: computeDockerContextFingerprint2, readPreparedDockerState: readPreparedDockerState2, preparedMatches: preparedMatches2 } = await import("./prepared-state-BUO75YLZ-O4GZMDRF.js");
|
|
3381
3818
|
const claudeInstall = opts.claudeInstall ?? await resolveClaudeInstallMode();
|
|
3382
3819
|
const rawFingerprint = await computeDockerContextFingerprint2({
|
|
3383
3820
|
contextDir: opts.contextDir
|
|
@@ -3427,7 +3864,7 @@ function classifyDockerBaseFreshness(input) {
|
|
|
3427
3864
|
return { state: "fresh" };
|
|
3428
3865
|
}
|
|
3429
3866
|
async function evaluateDockerBaseFreshness(opts = {}) {
|
|
3430
|
-
const { computeDockerContextFingerprint: computeDockerContextFingerprint2, readPreparedDockerState: readPreparedDockerState2 } = await import("./prepared-state-BUO75YLZ-
|
|
3867
|
+
const { computeDockerContextFingerprint: computeDockerContextFingerprint2, readPreparedDockerState: readPreparedDockerState2 } = await import("./prepared-state-BUO75YLZ-O4GZMDRF.js");
|
|
3431
3868
|
const ref = opts.ref ?? DEFAULT_BOX_IMAGE;
|
|
3432
3869
|
const imagePresent = await imageExists(ref);
|
|
3433
3870
|
if (!imagePresent) return { state: "unprepared" };
|
|
@@ -3522,6 +3959,9 @@ export {
|
|
|
3522
3959
|
syncAgentboxSshConfig,
|
|
3523
3960
|
autoWriteSshConfig,
|
|
3524
3961
|
mintSshKey,
|
|
3962
|
+
parseInboundSpec,
|
|
3963
|
+
resolveInboundSources,
|
|
3964
|
+
describeInbound,
|
|
3525
3965
|
BOX_WORKSPACE,
|
|
3526
3966
|
boxGitCheckout,
|
|
3527
3967
|
boxGitNewBranch,
|
|
@@ -3537,6 +3977,15 @@ export {
|
|
|
3537
3977
|
isSupportedApiVersion,
|
|
3538
3978
|
pluginForProvider,
|
|
3539
3979
|
renderCarryEntries,
|
|
3980
|
+
AGENT_SYNC_SPECS,
|
|
3981
|
+
referencedPluginVersionKeys,
|
|
3982
|
+
claudeInventoryScript,
|
|
3983
|
+
parseClaudeInventory,
|
|
3984
|
+
computeClaudePullPlan,
|
|
3985
|
+
writeClaudeMergedRegistries,
|
|
3986
|
+
CODEX_PULL_ITEMS,
|
|
3987
|
+
OPENCODE_PULL_DATA_ITEMS,
|
|
3988
|
+
OPENCODE_PULL_CONFIG_ITEMS,
|
|
3540
3989
|
makeSyncContext,
|
|
3541
3990
|
DEFAULT_ENV_PATTERNS,
|
|
3542
3991
|
ENV_PRUNE_DIRS,
|
|
@@ -3556,6 +4005,11 @@ export {
|
|
|
3556
4005
|
hostClaudeBackupExpired,
|
|
3557
4006
|
hostBackupHasCredentials,
|
|
3558
4007
|
extractCredentials,
|
|
4008
|
+
parseCredentialsUpdate,
|
|
4009
|
+
shouldAcceptCredentialUpdate,
|
|
4010
|
+
writeCredentialBackup,
|
|
4011
|
+
readCredentialBackup,
|
|
4012
|
+
pushCredentialToBox,
|
|
3559
4013
|
resyncWorkspace,
|
|
3560
4014
|
makeHostGitPorts,
|
|
3561
4015
|
BOX_WORKFLOWS_DIR,
|
|
@@ -3570,6 +4024,7 @@ export {
|
|
|
3570
4024
|
setInstallMethodNative,
|
|
3571
4025
|
MINIMAL_TRUSTED_CODEX_CONFIG,
|
|
3572
4026
|
sanitizeCodexConfigForBox,
|
|
4027
|
+
mergeCodexConfigForBox,
|
|
3573
4028
|
stageClaudeJsonOnlyForUpload,
|
|
3574
4029
|
stageClaudeStaticForUpload,
|
|
3575
4030
|
stageClaudeCredentialsForUpload,
|