@madarco/agentbox 0.23.5 → 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.
Files changed (180) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/LICENSE +21 -0
  3. package/README.md +3 -2
  4. package/dist/{_cloud-attach-D4OQO5AJ.js → _cloud-attach-T6GPR6LJ.js} +5 -5
  5. package/dist/{chunk-KY32JO6J.js → chunk-5KHEH47T.js} +91 -79
  6. package/dist/chunk-5KHEH47T.js.map +1 -0
  7. package/dist/{chunk-YRTM3KNT.js → chunk-6U2S6QWD.js} +219 -18
  8. package/dist/chunk-6U2S6QWD.js.map +1 -0
  9. package/dist/{chunk-JYEZ6Q5M.js → chunk-DEDTPG2D.js} +874 -146
  10. package/dist/chunk-DEDTPG2D.js.map +1 -0
  11. package/dist/chunk-G3H2L3O2.js +0 -0
  12. package/dist/{chunk-JNY5GPIM.js → chunk-I654PBHA.js} +290 -330
  13. package/dist/chunk-I654PBHA.js.map +1 -0
  14. package/dist/{chunk-6KOQRSHH.js → chunk-K2EDQGZP.js} +18 -4
  15. package/dist/chunk-K2EDQGZP.js.map +1 -0
  16. package/dist/{chunk-KZWJMNLP.js → chunk-LC4E2EIZ.js} +3 -3
  17. package/dist/{chunk-KZWJMNLP.js.map → chunk-LC4E2EIZ.js.map} +1 -1
  18. package/dist/{chunk-DADOEMXP.js → chunk-NACA6AM7.js} +183 -49
  19. package/dist/chunk-NACA6AM7.js.map +1 -0
  20. package/dist/{chunk-FX32NZD4.js → chunk-RYQLFKCP.js} +20 -10
  21. package/dist/chunk-RYQLFKCP.js.map +1 -0
  22. package/dist/{chunk-QT3SHMLY.js → chunk-UIRBYL4G.js} +43 -12
  23. package/dist/chunk-UIRBYL4G.js.map +1 -0
  24. package/dist/chunk-WJFZJZIM.js +0 -0
  25. package/dist/chunk-WLHJZPFJ.js +845 -0
  26. package/dist/chunk-WLHJZPFJ.js.map +1 -0
  27. package/dist/cloud-poller-SUNA6ZQC-7M5LJHHE.js +0 -0
  28. package/dist/dist-3KIJ2KQ2.js +1437 -0
  29. package/dist/dist-3KIJ2KQ2.js.map +1 -0
  30. package/dist/{dist-564EDHFF.js → dist-7OUOHQPA.js} +196 -151
  31. package/dist/dist-7OUOHQPA.js.map +1 -0
  32. package/dist/{dist-CAT2TN75.js → dist-B7TNWGVG.js} +8 -4
  33. package/dist/{dist-UDQMBWYW.js → dist-KYV3LEHG.js} +10 -6
  34. package/dist/{dist-EAR4BLL2.js → dist-PHYCFYKH.js} +37 -17
  35. package/dist/dist-PHYCFYKH.js.map +1 -0
  36. package/dist/{dist-2BTJQUJS.js → dist-T5MXBZGP.js} +2 -2
  37. package/dist/{dist-O5Y4X4C5.js → dist-Z7KEPQC7.js} +6 -6
  38. package/dist/index.js +2560 -1108
  39. package/dist/index.js.map +1 -1
  40. package/dist/{prepared-state-BUO75YLZ-PW64VQMT.js → prepared-state-BUO75YLZ-RQRFFBJW.js} +2 -2
  41. package/package.json +28 -28
  42. package/runtime/_shared/agentbox-checkpoint-cleanup +0 -0
  43. package/runtime/_shared/agentbox-codex-hooks.json +1 -1
  44. package/runtime/_shared/agentbox-dockerd-start +0 -0
  45. package/runtime/_shared/agentbox-open +0 -0
  46. package/runtime/_shared/agentbox-portless-trust +0 -0
  47. package/runtime/_shared/agentbox-vnc-start +0 -0
  48. package/runtime/_shared/ctl.cjs +468 -97
  49. package/runtime/_shared/gh-shim +0 -0
  50. package/runtime/_shared/git-shim +53 -3
  51. package/runtime/_shared/linear-shim +0 -0
  52. package/runtime/_shared/ntn-shim +0 -0
  53. package/runtime/daytona/custom-system-CLAUDE.md +1 -1
  54. package/runtime/digitalocean/agentbox-checkpoint-cleanup +55 -0
  55. package/runtime/digitalocean/agentbox-codex-hooks.json +68 -0
  56. package/runtime/digitalocean/agentbox-dockerd-start +145 -0
  57. package/runtime/digitalocean/agentbox-open +28 -0
  58. package/runtime/digitalocean/agentbox-portless-trust +82 -0
  59. package/runtime/digitalocean/agentbox-setup-skill.md +317 -0
  60. package/runtime/digitalocean/agentbox-vnc-start +102 -0
  61. package/runtime/digitalocean/claude-managed-settings.json +116 -0
  62. package/runtime/digitalocean/ctl.cjs +27852 -0
  63. package/runtime/digitalocean/custom-system-CLAUDE.md +39 -0
  64. package/runtime/digitalocean/gh-shim +344 -0
  65. package/runtime/digitalocean/git-shim +181 -0
  66. package/runtime/digitalocean/linear-shim +181 -0
  67. package/runtime/digitalocean/ntn-shim +95 -0
  68. package/runtime/digitalocean/opencode-agentbox-plugin.js +76 -0
  69. package/runtime/digitalocean/scripts/install-box.sh +462 -0
  70. package/runtime/docker/Dockerfile.box +5 -0
  71. package/runtime/docker/packages/ctl/dist/bin.cjs +468 -97
  72. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-checkpoint-cleanup +0 -0
  73. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-codex-hooks.json +1 -1
  74. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-dockerd-start +0 -0
  75. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-open +0 -0
  76. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-portless-trust +0 -0
  77. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-sshd-start +0 -0
  78. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-vnc-start +0 -0
  79. package/runtime/docker/packages/sandbox-docker/scripts/chromium-resolver +0 -0
  80. package/runtime/docker/packages/sandbox-docker/scripts/custom-system-CLAUDE.md +2 -1
  81. package/runtime/docker/packages/sandbox-docker/scripts/gh-shim +0 -0
  82. package/runtime/docker/packages/sandbox-docker/scripts/git-shim +53 -3
  83. package/runtime/docker/packages/sandbox-docker/scripts/linear-shim +0 -0
  84. package/runtime/docker/packages/sandbox-docker/scripts/ntn-shim +0 -0
  85. package/runtime/e2b/agentbox-checkpoint-cleanup +0 -0
  86. package/runtime/e2b/agentbox-codex-hooks.json +1 -1
  87. package/runtime/e2b/agentbox-dockerd-start +0 -0
  88. package/runtime/e2b/agentbox-open +0 -0
  89. package/runtime/e2b/agentbox-vnc-start +0 -0
  90. package/runtime/e2b/ctl.cjs +468 -97
  91. package/runtime/e2b/custom-system-CLAUDE.md +6 -3
  92. package/runtime/e2b/gh-shim +0 -0
  93. package/runtime/e2b/git-shim +53 -3
  94. package/runtime/e2b/linear-shim +0 -0
  95. package/runtime/e2b/ntn-shim +0 -0
  96. package/runtime/e2b/scripts/build-template.sh +16 -0
  97. package/runtime/hetzner/agentbox-checkpoint-cleanup +0 -0
  98. package/runtime/hetzner/agentbox-codex-hooks.json +1 -1
  99. package/runtime/hetzner/agentbox-dockerd-start +0 -0
  100. package/runtime/hetzner/agentbox-open +0 -0
  101. package/runtime/hetzner/agentbox-portless-trust +0 -0
  102. package/runtime/hetzner/agentbox-vnc-start +0 -0
  103. package/runtime/hetzner/ctl.cjs +468 -97
  104. package/runtime/hetzner/custom-system-CLAUDE.md +1 -1
  105. package/runtime/hetzner/gh-shim +0 -0
  106. package/runtime/hetzner/git-shim +53 -3
  107. package/runtime/hetzner/linear-shim +0 -0
  108. package/runtime/hetzner/ntn-shim +0 -0
  109. package/runtime/hetzner/scripts/install-box.sh +5 -0
  110. package/runtime/hub/apps/hub/.next/BUILD_ID +1 -1
  111. package/runtime/hub/apps/hub/.next/build-manifest.json +3 -3
  112. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page_client-reference-manifest.js +1 -1
  113. package/runtime/hub/apps/hub/.next/server/app/_global-error.html +1 -1
  114. package/runtime/hub/apps/hub/.next/server/app/_global-error.rsc +1 -1
  115. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  116. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  117. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  118. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  119. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  120. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0d1lmiq._.js +12 -12
  121. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0keu6we._.js +1 -1
  122. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1bqbkd5._.js +1 -1
  123. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1qa4a0v._.js +1 -1
  124. package/runtime/hub/apps/hub/.next/server/chunks/_0760z6y._.js +8 -8
  125. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0ro6vh6._.js +1 -1
  126. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_0b_hsjl._.js +1 -1
  127. package/runtime/hub/apps/hub/.next/server/middleware-build-manifest.js +3 -3
  128. package/runtime/hub/apps/hub/.next/server/pages/500.html +1 -1
  129. package/runtime/hub/apps/hub/.next/static/chunks/380qcmusmigzz.js +1 -0
  130. package/runtime/hub/apps/hub/{auth-675P3LQS.js → auth-Q447765C.js} +2 -2
  131. package/runtime/hub/apps/hub/{auth-config-AOBEKRZQ.js → auth-config-SIL635ZD.js} +2 -2
  132. package/runtime/hub/apps/hub/{chunk-FSEPYTQ6.js → chunk-3VE7AYVK.js} +594 -145
  133. package/runtime/hub/apps/hub/{chunk-EXQCBM5Q.js → chunk-64WEKO34.js} +42 -11
  134. package/runtime/hub/apps/hub/{chunk-56YQBVN2.js → chunk-DZPQB2JZ.js} +1 -1
  135. package/runtime/hub/apps/hub/{chunk-7M6FXZIO.js → chunk-FGBXEXUV.js} +350 -292
  136. package/runtime/hub/apps/hub/{chunk-Z7ZAL24C.js → chunk-YVELHPNY.js} +218 -17
  137. package/runtime/hub/apps/hub/{dist-EKQHCXWE.js → dist-33ZNVTC6.js} +183 -49
  138. package/runtime/hub/apps/hub/{dist-V4TJ44MT.js → dist-4SXAJBOC.js} +195 -150
  139. package/runtime/hub/apps/hub/{dist-QIXUPGPP.js → dist-EPJFN2J3.js} +116 -86
  140. package/runtime/hub/apps/hub/{dist-STQK5XM6.js → dist-GF5EBRNG.js} +1 -1
  141. package/runtime/hub/apps/hub/{dist-JGZ55OIJ.js → dist-UJVIROA4.js} +19 -5
  142. package/runtime/hub/apps/hub/dist-XULFTIMT.js +2212 -0
  143. package/runtime/hub/apps/hub/{dist-GGWYKXJE.js → dist-YM5J25H6.js} +7 -3
  144. package/runtime/hub/apps/hub/{hub-token-2BZFBBW3.js → hub-token-UITZEWVP.js} +2 -2
  145. package/runtime/hub/apps/hub/package.json +1 -0
  146. package/runtime/hub/apps/hub/{prepared-state-BUO75YLZ-UICXTY25.js → prepared-state-BUO75YLZ-O4GZMDRF.js} +1 -1
  147. package/runtime/hub/apps/hub/server.js +17 -15
  148. package/runtime/relay/bin.cjs +275 -59
  149. package/runtime/vercel/agentbox-checkpoint-cleanup +0 -0
  150. package/runtime/vercel/agentbox-codex-hooks.json +1 -1
  151. package/runtime/vercel/agentbox-dockerd-start +0 -0
  152. package/runtime/vercel/agentbox-open +0 -0
  153. package/runtime/vercel/agentbox-vnc-start +0 -0
  154. package/runtime/vercel/ctl.cjs +468 -97
  155. package/runtime/vercel/custom-system-CLAUDE.md +3 -2
  156. package/runtime/vercel/gh-shim +0 -0
  157. package/runtime/vercel/git-shim +53 -3
  158. package/runtime/vercel/linear-shim +0 -0
  159. package/runtime/vercel/ntn-shim +0 -0
  160. package/runtime/vercel/scripts/provision.sh +16 -0
  161. package/dist/chunk-6KOQRSHH.js.map +0 -1
  162. package/dist/chunk-DADOEMXP.js.map +0 -1
  163. package/dist/chunk-FX32NZD4.js.map +0 -1
  164. package/dist/chunk-JNY5GPIM.js.map +0 -1
  165. package/dist/chunk-JYEZ6Q5M.js.map +0 -1
  166. package/dist/chunk-KY32JO6J.js.map +0 -1
  167. package/dist/chunk-QT3SHMLY.js.map +0 -1
  168. package/dist/chunk-YRTM3KNT.js.map +0 -1
  169. package/dist/dist-564EDHFF.js.map +0 -1
  170. package/dist/dist-EAR4BLL2.js.map +0 -1
  171. package/runtime/hub/apps/hub/.next/static/chunks/0joh_xsiowfc4.js +0 -1
  172. /package/dist/{_cloud-attach-D4OQO5AJ.js.map → _cloud-attach-T6GPR6LJ.js.map} +0 -0
  173. /package/dist/{dist-2BTJQUJS.js.map → dist-B7TNWGVG.js.map} +0 -0
  174. /package/dist/{dist-CAT2TN75.js.map → dist-KYV3LEHG.js.map} +0 -0
  175. /package/dist/{dist-O5Y4X4C5.js.map → dist-T5MXBZGP.js.map} +0 -0
  176. /package/dist/{dist-UDQMBWYW.js.map → dist-Z7KEPQC7.js.map} +0 -0
  177. /package/dist/{prepared-state-BUO75YLZ-PW64VQMT.js.map → prepared-state-BUO75YLZ-RQRFFBJW.js.map} +0 -0
  178. /package/runtime/hub/apps/hub/.next/static/{lOi70Di6lcnEBsUUHKrQ5 → XtIjHGqvY4mQsOY2-m1Jy}/_buildManifest.js +0 -0
  179. /package/runtime/hub/apps/hub/.next/static/{lOi70Di6lcnEBsUUHKrQ5 → XtIjHGqvY4mQsOY2-m1Jy}/_clientMiddlewareManifest.js +0 -0
  180. /package/runtime/hub/apps/hub/.next/static/{lOi70Di6lcnEBsUUHKrQ5 → XtIjHGqvY4mQsOY2-m1Jy}/_ssgManifest.js +0 -0
@@ -295,39 +295,46 @@ import { mkdtemp, readFile as readFile4, writeFile as writeFile3 } from "fs/prom
295
295
  import { tmpdir } from "os";
296
296
  import { basename as basename2, join as join7 } from "path";
297
297
  import { join as join8 } from "path";
298
+ import { chmod, mkdir as mkdir4, readdir as readdir2, readFile as readFile5, stat as stat4, writeFile as writeFile4 } from "fs/promises";
298
299
  import { homedir as homedir6 } from "os";
299
- import { mkdtemp as mkdtemp2, rm as rm3 } from "fs/promises";
300
+ import { dirname as dirname6, join as join9 } from "path";
301
+ import { mkdir as mkdir5, mkdtemp as mkdtemp2, rm as rm3, writeFile as writeFile5 } from "fs/promises";
300
302
  import { tmpdir as tmpdir2 } from "os";
301
- import { join as join9 } from "path";
302
- import { execa as execa3 } from "execa";
303
- import { readdir as readdir2, stat as stat4 } from "fs/promises";
303
+ import { dirname as dirname7, join as join10 } from "path";
304
304
  import { homedir as homedir7 } from "os";
305
- import { join as join10 } from "path";
306
- import { readdir as readdir3, realpath as realpath2, stat as stat5 } from "fs/promises";
307
- import { isAbsolute, join as join11, relative } from "path";
308
- import { stat as stat6 } from "fs/promises";
309
- import { chmod, mkdir as mkdir4, readFile as readFile5, writeFile as writeFile4 } from "fs/promises";
310
- import { dirname as dirname6 } from "path";
311
- import { createHash } from "crypto";
312
- import { readFile as readFile6 } from "fs/promises";
305
+ import { mkdtemp as mkdtemp3, rm as rm4 } from "fs/promises";
306
+ import { tmpdir as tmpdir3 } from "os";
307
+ import { join as join11 } from "path";
308
+ import { execa as execa3 } from "execa";
309
+ import { readdir as readdir3, stat as stat5 } from "fs/promises";
310
+ import { homedir as homedir8 } from "os";
313
311
  import { join as join12 } from "path";
312
+ import { readdir as readdir4, realpath as realpath2, stat as stat6 } from "fs/promises";
313
+ import { isAbsolute, join as join13, relative } from "path";
314
+ import { stat as stat7 } from "fs/promises";
315
+ 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";
316
+ import { tmpdir as tmpdir4 } from "os";
317
+ import { dirname as dirname8, join as join14 } from "path";
318
+ import { createHash } from "crypto";
319
+ import { readFile as readFile7 } from "fs/promises";
320
+ import { join as join15 } from "path";
314
321
  import { execa as execa4 } from "execa";
315
322
  import { createHash as createHash2 } from "crypto";
316
- import { copyFile, mkdir as mkdir5, mkdtemp as mkdtemp3, readdir as readdir4, readFile as readFile7, rm as rm4, stat as stat7 } from "fs/promises";
317
- import { homedir as homedir8, tmpdir as tmpdir3 } from "os";
318
- import { basename as basename22, dirname as dirname7, join as join13 } from "path";
323
+ import { copyFile, mkdir as mkdir7, mkdtemp as mkdtemp5, readdir as readdir5, readFile as readFile8, rm as rm6, stat as stat8 } from "fs/promises";
324
+ import { homedir as homedir9, tmpdir as tmpdir5 } from "os";
325
+ import { basename as basename22, dirname as dirname9, join as join16 } from "path";
319
326
  import { execa as execa5 } from "execa";
320
- import { copyFile as copyFile2, mkdtemp as mkdtemp4, readdir as readdir5, readFile as readFile8, rm as rm5, stat as stat8, writeFile as writeFile5 } from "fs/promises";
321
- import { homedir as homedir10, tmpdir as tmpdir4 } from "os";
322
- import { basename as basename3, join as join14, relative as relative2 } from "path";
327
+ 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";
328
+ import { homedir as homedir11, tmpdir as tmpdir6 } from "os";
329
+ import { basename as basename3, join as join17, relative as relative2 } from "path";
323
330
  import { execa as execa6 } from "execa";
324
- import { homedir as homedir9 } from "os";
331
+ import { homedir as homedir10 } from "os";
325
332
  import { parse, stringify } from "smol-toml";
326
333
  import { createHash as createHash3 } from "crypto";
327
334
  import { existsSync as existsSync4, mkdirSync as mkdirSync3, readFileSync as readFileSync4, renameSync as renameSync2, writeFileSync as writeFileSync3 } from "fs";
328
- import { readFile as readFile9 } from "fs/promises";
329
- import { homedir as homedir11 } from "os";
330
- import { dirname as dirname8, resolve as pathResolve } from "path";
335
+ import { readFile as readFile10 } from "fs/promises";
336
+ import { homedir as homedir12 } from "os";
337
+ import { dirname as dirname10, resolve as pathResolve } from "path";
331
338
  var STATE_DIR = join(homedir(), ".agentbox");
332
339
  var STATE_FILE = join(STATE_DIR, "state.json");
333
340
  var EMPTY = { version: 1, boxes: [] };
@@ -867,6 +874,47 @@ async function mintSshKey(targetDir, comment) {
867
874
  const publicKey = (await readFile2(pub, "utf8")).trim();
868
875
  return { dir, privatePath: priv, publicPath: pub, publicKey };
869
876
  }
877
+ var OPEN_INBOUND_SOURCES = ["0.0.0.0/0", "::/0"];
878
+ function normalizeInboundCidr(raw) {
879
+ const trimmed = raw.trim();
880
+ if (trimmed.includes("/")) return trimmed;
881
+ if (trimmed.includes(":")) return `${trimmed}/128`;
882
+ return `${trimmed}/32`;
883
+ }
884
+ function parseInboundSpec(spec) {
885
+ let s = (spec ?? "").trim();
886
+ if (s === "" || /^lock(ed)?$/i.test(s)) return { mode: "locked", sources: [] };
887
+ if (/^open$/i.test(s)) return { mode: "open", sources: [] };
888
+ if (/^whitelist\b:?/i.test(s)) s = s.replace(/^whitelist\b:?/i, "").trim();
889
+ const sources = s.split(/[\s,]+/).map((x) => x.trim()).filter((x) => x.length > 0).map(normalizeInboundCidr);
890
+ if (sources.length === 0) {
891
+ throw new Error(
892
+ "inbound 'whitelist' needs at least one CIDR, e.g. `--inbound 203.0.113.5/32` or `--inbound whitelist:203.0.113.0/24`"
893
+ );
894
+ }
895
+ return { mode: "whitelist", sources };
896
+ }
897
+ function resolveInboundSources(policy, hostEgressCidr) {
898
+ if (policy.mode === "open") return [...OPEN_INBOUND_SOURCES];
899
+ const out = /* @__PURE__ */ new Set();
900
+ if (hostEgressCidr && hostEgressCidr.trim().length > 0) {
901
+ out.add(normalizeInboundCidr(hostEgressCidr));
902
+ }
903
+ if (policy.mode === "whitelist") {
904
+ for (const s of policy.sources) out.add(normalizeInboundCidr(s));
905
+ }
906
+ return [...out];
907
+ }
908
+ function describeInbound(policy) {
909
+ switch (policy.mode) {
910
+ case "open":
911
+ return "open (SSH reachable from anywhere \u2014 0.0.0.0/0, key-only)";
912
+ case "whitelist":
913
+ return `whitelist (host egress + ${policy.sources.join(", ")})`;
914
+ default:
915
+ return "locked (SSH reachable only from the host egress IP)";
916
+ }
917
+ }
870
918
  var BOX_WORKSPACE = "/workspace";
871
919
  function run(provider, box, argv) {
872
920
  return provider.exec(box, argv, { cwd: BOX_WORKSPACE });
@@ -1207,6 +1255,17 @@ var AGENT_SYNC_SPECS = [
1207
1255
  // separately; `state_*.sqlite*` is the resume-cwd index (rebuilt in-box);
1208
1256
  // `packages`/`plugins/.plugin-appserver`/`computer-use` are heavy
1209
1257
  // macOS-only artifacts; the rest is host-only session/log/cache state.
1258
+ //
1259
+ // `.tmp` carve-in: the git-marketplace snapshots (`.tmp/marketplaces/`,
1260
+ // ~13 MB) must reach the box or in-box `codex plugin` breaks
1261
+ // ("marketplace root does not contain a supported manifest" — and the
1262
+ // box can't re-clone, the git shim blocks `clone`). The includes are
1263
+ // emitted BEFORE the excludes (first-match-wins): the root `.tmp/` dir
1264
+ // and the marketplaces subtree transfer, `/.tmp/*` drops its other
1265
+ // children (the ~200 MB desktop-app `bundled-marketplaces` + `plugins`
1266
+ // payloads), and the unanchored `.tmp` still blocks nested `.tmp` dirs
1267
+ // elsewhere in the tree.
1268
+ include: ["/.tmp/", "/.tmp/marketplaces/***"],
1210
1269
  exclude: [
1211
1270
  "auth.json",
1212
1271
  "sessions",
@@ -1220,6 +1279,7 @@ var AGENT_SYNC_SPECS = [
1220
1279
  "cache",
1221
1280
  "vendor_imports",
1222
1281
  "tmp",
1282
+ "/.tmp/*",
1223
1283
  ".tmp",
1224
1284
  ".codex-global-state.json",
1225
1285
  ".codex-global-state.json.bak",
@@ -1316,6 +1376,512 @@ function resolveAgentSpec(name) {
1316
1376
  if (!spec) throw new Error(`no agent sync spec for '${name}'`);
1317
1377
  return spec;
1318
1378
  }
1379
+ var SKILL_EXCLUDE_PREFIXES = ["agentbox-"];
1380
+ var CONTAINER_PLUGINS_PREFIX = "/home/vscode/.claude/plugins/";
1381
+ function pickNewItems(boxNames, hostNames, excludePrefixes = []) {
1382
+ const host = new Set(hostNames);
1383
+ const seen = /* @__PURE__ */ new Set();
1384
+ const out = [];
1385
+ for (const name of boxNames) {
1386
+ if (name.length === 0 || host.has(name) || seen.has(name)) continue;
1387
+ if (excludePrefixes.some((p) => name.startsWith(p))) continue;
1388
+ seen.add(name);
1389
+ out.push(name);
1390
+ }
1391
+ return out.sort();
1392
+ }
1393
+ function rewritePluginPaths(value, hostPluginsPrefix) {
1394
+ if (typeof value === "string") {
1395
+ return value.split(CONTAINER_PLUGINS_PREFIX).join(hostPluginsPrefix);
1396
+ }
1397
+ if (Array.isArray(value)) {
1398
+ return value.map((v) => rewritePluginPaths(v, hostPluginsPrefix));
1399
+ }
1400
+ if (value !== null && typeof value === "object") {
1401
+ const out = {};
1402
+ for (const [k, v] of Object.entries(value)) {
1403
+ out[k] = rewritePluginPaths(v, hostPluginsPrefix);
1404
+ }
1405
+ return out;
1406
+ }
1407
+ return value;
1408
+ }
1409
+ function isPlainObject2(v) {
1410
+ return v !== null && typeof v === "object" && !Array.isArray(v);
1411
+ }
1412
+ function additiveMerge(hostRoot, boxRoot, hostPluginsPrefix, selectMap, withMap) {
1413
+ const hostMap = selectMap(hostRoot);
1414
+ const boxMap = selectMap(boxRoot);
1415
+ if (!isPlainObject2(boxMap)) {
1416
+ return { data: hostRoot, changed: false, addedKeys: [] };
1417
+ }
1418
+ const base = isPlainObject2(hostMap) ? { ...hostMap } : {};
1419
+ const addedKeys = [];
1420
+ for (const [key, value] of Object.entries(boxMap)) {
1421
+ if (Object.prototype.hasOwnProperty.call(base, key)) continue;
1422
+ base[key] = rewritePluginPaths(value, hostPluginsPrefix);
1423
+ addedKeys.push(key);
1424
+ }
1425
+ if (addedKeys.length === 0) {
1426
+ return { data: hostRoot, changed: false, addedKeys: [] };
1427
+ }
1428
+ return { data: withMap(hostRoot, base), changed: true, addedKeys: addedKeys.sort() };
1429
+ }
1430
+ function mergeKnownMarketplaces(hostJson, boxJson, opts) {
1431
+ const prefix = `${opts.hostHome}/.claude/plugins/`;
1432
+ return additiveMerge(
1433
+ isPlainObject2(hostJson) ? hostJson : {},
1434
+ boxJson,
1435
+ prefix,
1436
+ (root) => root,
1437
+ (_host, merged) => merged
1438
+ );
1439
+ }
1440
+ function mergeInstalledPlugins(hostJson, boxJson, opts) {
1441
+ const prefix = `${opts.hostHome}/.claude/plugins/`;
1442
+ const hostRoot = isPlainObject2(hostJson) ? hostJson : { plugins: {} };
1443
+ return additiveMerge(
1444
+ hostRoot,
1445
+ boxJson,
1446
+ prefix,
1447
+ (root) => isPlainObject2(root) ? root["plugins"] : void 0,
1448
+ (host, merged) => ({ ...host, plugins: merged })
1449
+ );
1450
+ }
1451
+ function referencedPluginVersionKeys(installedPluginsJson) {
1452
+ const keys = /* @__PURE__ */ new Set();
1453
+ if (!isPlainObject2(installedPluginsJson)) return keys;
1454
+ const plugins = installedPluginsJson["plugins"];
1455
+ if (!isPlainObject2(plugins)) return keys;
1456
+ for (const entries of Object.values(plugins)) {
1457
+ if (!Array.isArray(entries)) continue;
1458
+ for (const entry of entries) {
1459
+ if (!isPlainObject2(entry)) continue;
1460
+ const installPath = entry["installPath"];
1461
+ if (typeof installPath !== "string") continue;
1462
+ const segments = installPath.split("/").filter((s) => s.length > 0);
1463
+ if (segments.length < 3) continue;
1464
+ keys.add(segments.slice(-3).join("/"));
1465
+ }
1466
+ }
1467
+ return keys;
1468
+ }
1469
+ var CLAUDE_BOX_CONFIG_DIR = "/home/vscode/.claude";
1470
+ var CODEX_BOX_CONFIG_DIR = "/home/vscode/.codex";
1471
+ var OPENCODE_BOX_DATA_DIR = "/home/vscode/.local/share/opencode";
1472
+ var CLAUDE_PULL_DIR_CATEGORIES = ["skills", "agents", "commands"];
1473
+ function claudeInventoryScript(src) {
1474
+ return [
1475
+ "for cat in skills agents commands; do",
1476
+ ` [ -d "${src}/$cat" ] || continue;`,
1477
+ ` for d in "${src}/$cat"/*/; do`,
1478
+ ' [ -d "$d" ] || continue;',
1479
+ ' printf "DIR %s %s\\n" "$cat" "$(basename "$d")";',
1480
+ " done;",
1481
+ "done;",
1482
+ `if [ -d ${src}/plugins/cache ]; then`,
1483
+ ` for m in ${src}/plugins/cache/*/; do`,
1484
+ ' [ -d "$m" ] || continue;',
1485
+ ' for p in "$m"*/; do',
1486
+ ' [ -d "$p" ] || continue;',
1487
+ ' printf "PLUGIN %s/%s\\n" "$(basename "$m")" "$(basename "$p")";',
1488
+ " done;",
1489
+ " done;",
1490
+ "fi;",
1491
+ "for f in installed_plugins known_marketplaces; do",
1492
+ ` [ -f "${src}/plugins/$f.json" ] || continue;`,
1493
+ ' printf "JSON %s " "$f";',
1494
+ ` base64 -w0 "${src}/plugins/$f.json";`,
1495
+ ' printf "\\n";',
1496
+ "done"
1497
+ ].join(" ");
1498
+ }
1499
+ function parseClaudeInventory(stdout) {
1500
+ const dirs = { skills: [], agents: [], commands: [] };
1501
+ const plugins = [];
1502
+ const registries = {};
1503
+ for (const line of stdout.split("\n")) {
1504
+ if (line.startsWith("DIR ")) {
1505
+ const rest = line.slice(4);
1506
+ const sp = rest.indexOf(" ");
1507
+ if (sp === -1) continue;
1508
+ const cat = rest.slice(0, sp);
1509
+ const name = rest.slice(sp + 1);
1510
+ if (cat in dirs) dirs[cat].push(name);
1511
+ } else if (line.startsWith("PLUGIN ")) {
1512
+ plugins.push(line.slice(7));
1513
+ } else if (line.startsWith("JSON ")) {
1514
+ const rest = line.slice(5);
1515
+ const sp = rest.indexOf(" ");
1516
+ if (sp === -1) continue;
1517
+ const which = rest.slice(0, sp);
1518
+ try {
1519
+ registries[which] = JSON.parse(Buffer.from(rest.slice(sp + 1), "base64").toString("utf8"));
1520
+ } catch {
1521
+ }
1522
+ }
1523
+ }
1524
+ return { dirs, plugins, registries };
1525
+ }
1526
+ async function listChildDirs(dir) {
1527
+ try {
1528
+ const entries = await readdir2(dir, { withFileTypes: true });
1529
+ return entries.filter((e) => e.isDirectory() || e.isSymbolicLink()).map((e) => e.name);
1530
+ } catch {
1531
+ return [];
1532
+ }
1533
+ }
1534
+ async function readJsonFile(path) {
1535
+ try {
1536
+ return JSON.parse(await readFile5(path, "utf8"));
1537
+ } catch {
1538
+ return void 0;
1539
+ }
1540
+ }
1541
+ async function computeClaudePullPlan(inv, opts = {}) {
1542
+ const hostHome = opts.hostHome ?? homedir6();
1543
+ const hostClaude = join9(hostHome, ".claude");
1544
+ const newItems = [];
1545
+ const copyRels = [];
1546
+ for (const cat of CLAUDE_PULL_DIR_CATEGORIES) {
1547
+ const hostNames = await listChildDirs(join9(hostClaude, cat));
1548
+ const excludes = cat === "skills" ? SKILL_EXCLUDE_PREFIXES : [];
1549
+ for (const name of pickNewItems(inv.dirs[cat] ?? [], hostNames, excludes)) {
1550
+ newItems.push({ category: cat, name });
1551
+ copyRels.push(`${cat}/${name}`);
1552
+ }
1553
+ }
1554
+ const hostPluginKeys = [];
1555
+ for (const m of await listChildDirs(join9(hostClaude, "plugins", "cache"))) {
1556
+ for (const p of await listChildDirs(join9(hostClaude, "plugins", "cache", m))) {
1557
+ hostPluginKeys.push(`${m}/${p}`);
1558
+ }
1559
+ }
1560
+ for (const key of pickNewItems(inv.plugins, hostPluginKeys)) {
1561
+ newItems.push({ category: "plugins", name: key });
1562
+ copyRels.push(`plugins/cache/${key}`);
1563
+ }
1564
+ const hostInstalled = await readJsonFile(join9(hostClaude, "plugins", "installed_plugins.json"));
1565
+ const hostMarkets = await readJsonFile(join9(hostClaude, "plugins", "known_marketplaces.json"));
1566
+ const mergedInstalled = mergeInstalledPlugins(hostInstalled, inv.registries["installed_plugins"], {
1567
+ hostHome
1568
+ });
1569
+ const mergedMarkets = mergeKnownMarketplaces(hostMarkets, inv.registries["known_marketplaces"], {
1570
+ hostHome
1571
+ });
1572
+ const mergedRegistries = [];
1573
+ if (mergedInstalled.changed) mergedRegistries.push("installed_plugins.json");
1574
+ if (mergedMarkets.changed) mergedRegistries.push("known_marketplaces.json");
1575
+ return { newItems, copyRels, mergedInstalled, mergedMarkets, mergedRegistries };
1576
+ }
1577
+ async function writeClaudeMergedRegistries(plan, opts = {}) {
1578
+ if (!plan.mergedInstalled.changed && !plan.mergedMarkets.changed) return;
1579
+ const hostClaude = join9(opts.hostHome ?? homedir6(), ".claude");
1580
+ await mkdir4(join9(hostClaude, "plugins"), { recursive: true });
1581
+ if (plan.mergedMarkets.changed) {
1582
+ await writeFile4(
1583
+ join9(hostClaude, "plugins", "known_marketplaces.json"),
1584
+ `${JSON.stringify(plan.mergedMarkets.data, null, 2)}
1585
+ `
1586
+ );
1587
+ }
1588
+ if (plan.mergedInstalled.changed) {
1589
+ await writeFile4(
1590
+ join9(hostClaude, "plugins", "installed_plugins.json"),
1591
+ `${JSON.stringify(plan.mergedInstalled.data, null, 2)}
1592
+ `
1593
+ );
1594
+ }
1595
+ }
1596
+ async function pullClaudeExtrasViaTransport(t, opts = {}) {
1597
+ const boxDir = opts.boxDir ?? CLAUDE_BOX_CONFIG_DIR;
1598
+ const inv = await t.exec(["sh", "-c", claudeInventoryScript(boxDir)]);
1599
+ if (inv.exitCode !== 0) {
1600
+ throw new Error(
1601
+ `failed to inventory ${boxDir} in the box: ${inv.stderr.trim() || `exit ${String(inv.exitCode)}`}`
1602
+ );
1603
+ }
1604
+ const inventory = parseClaudeInventory(inv.stdout);
1605
+ const plan = await computeClaudePullPlan(inventory, { hostHome: opts.hostHome });
1606
+ const result = {
1607
+ newItems: plan.newItems,
1608
+ mergedRegistries: plan.mergedRegistries,
1609
+ sourceRegistries: inventory.registries
1610
+ };
1611
+ if (opts.dryRun || plan.newItems.length === 0 && plan.mergedRegistries.length === 0) {
1612
+ return result;
1613
+ }
1614
+ const hostClaude = join9(opts.hostHome ?? homedir6(), ".claude");
1615
+ for (const rel of plan.copyRels) {
1616
+ const hostDest = join9(hostClaude, rel);
1617
+ await mkdir4(hostDest, { recursive: true });
1618
+ await t.pullTree(`${boxDir}/${rel}`, hostDest, { exclude: ["node_modules"] });
1619
+ }
1620
+ await writeClaudeMergedRegistries(plan, { hostHome: opts.hostHome });
1621
+ return result;
1622
+ }
1623
+ var CODEX_PULL_ITEMS = ["config.toml", "auth.json", "prompts"];
1624
+ var OPENCODE_PULL_DATA_ITEMS = ["auth.json"];
1625
+ var OPENCODE_PULL_CONFIG_ITEMS = [
1626
+ "opencode.json",
1627
+ "opencode.jsonc",
1628
+ "agents",
1629
+ "commands",
1630
+ "modes",
1631
+ "plugins",
1632
+ "skills",
1633
+ "tools",
1634
+ "themes"
1635
+ ];
1636
+ function flatInventoryScript(groups) {
1637
+ const parts = [];
1638
+ for (const [group, { dir, items }] of Object.entries(groups)) {
1639
+ parts.push(
1640
+ `for f in ${items.join(" ")}; do if [ -d "${dir}/$f" ]; then echo "${group} DIR $f"; elif [ -e "${dir}/$f" ]; then echo "${group} FILE $f"; fi; done;`
1641
+ );
1642
+ }
1643
+ parts.push("true");
1644
+ return parts.join(" ");
1645
+ }
1646
+ function parseFlatInventory(stdout) {
1647
+ const out = [];
1648
+ for (const line of stdout.split("\n")) {
1649
+ const m = /^(\S+) (FILE|DIR) (\S+)$/.exec(line.trim());
1650
+ if (!m) continue;
1651
+ out.push({ group: m[1], kind: m[2] === "DIR" ? "dir" : "file", name: m[3] });
1652
+ }
1653
+ return out;
1654
+ }
1655
+ async function pathExists(path) {
1656
+ try {
1657
+ await stat4(path);
1658
+ return true;
1659
+ } catch {
1660
+ return false;
1661
+ }
1662
+ }
1663
+ async function pullFlatEntry(t, entry, boxPath, hostPath) {
1664
+ if (entry.kind === "dir") {
1665
+ await mkdir4(hostPath, { recursive: true });
1666
+ await t.pullTree(boxPath, hostPath, { exclude: ["node_modules"] });
1667
+ return;
1668
+ }
1669
+ await mkdir4(dirname6(hostPath), { recursive: true });
1670
+ await t.pullFile(boxPath, hostPath);
1671
+ if (entry.name === "auth.json") await chmod(hostPath, 384);
1672
+ }
1673
+ async function pullCodexConfigViaTransport(t, opts = {}) {
1674
+ const boxDir = opts.boxDir ?? CODEX_BOX_CONFIG_DIR;
1675
+ const hostCodex = join9(opts.hostHome ?? homedir6(), ".codex");
1676
+ const script = flatInventoryScript({ codex: { dir: boxDir, items: CODEX_PULL_ITEMS } });
1677
+ const inv = await t.exec(["sh", "-c", script]);
1678
+ if (inv.exitCode !== 0) {
1679
+ throw new Error(
1680
+ `failed to inventory ${boxDir} in the box: ${inv.stderr.trim() || `exit ${String(inv.exitCode)}`}`
1681
+ );
1682
+ }
1683
+ const entries = [];
1684
+ for (const entry of parseFlatInventory(inv.stdout)) {
1685
+ if (await pathExists(join9(hostCodex, entry.name))) continue;
1686
+ entries.push(entry);
1687
+ }
1688
+ const newItems = entries.map((e) => e.name);
1689
+ if (opts.dryRun || entries.length === 0) return { newItems };
1690
+ for (const entry of entries) {
1691
+ await pullFlatEntry(t, entry, `${boxDir}/${entry.name}`, join9(hostCodex, entry.name));
1692
+ }
1693
+ return { newItems };
1694
+ }
1695
+ async function pullOpencodeConfigViaTransport(t, opts = {}) {
1696
+ const boxDir = opts.boxDir ?? OPENCODE_BOX_DATA_DIR;
1697
+ const hostHome = opts.hostHome ?? homedir6();
1698
+ const hostBases = {
1699
+ data: join9(hostHome, ".local", "share", "opencode"),
1700
+ config: join9(hostHome, ".config", "opencode")
1701
+ };
1702
+ const script = flatInventoryScript({
1703
+ data: { dir: boxDir, items: OPENCODE_PULL_DATA_ITEMS },
1704
+ config: { dir: `${boxDir}/config`, items: OPENCODE_PULL_CONFIG_ITEMS }
1705
+ });
1706
+ const inv = await t.exec(["sh", "-c", script]);
1707
+ if (inv.exitCode !== 0) {
1708
+ throw new Error(
1709
+ `failed to inventory ${boxDir} in the box: ${inv.stderr.trim() || `exit ${String(inv.exitCode)}`}`
1710
+ );
1711
+ }
1712
+ const entries = [];
1713
+ for (const entry of parseFlatInventory(inv.stdout)) {
1714
+ if (entry.group !== "data" && entry.group !== "config") continue;
1715
+ const hostBase = hostBases[entry.group];
1716
+ if (await pathExists(join9(hostBase, entry.name))) continue;
1717
+ entries.push({ ...entry, label: entry.group === "data" ? entry.name : `config/${entry.name}` });
1718
+ }
1719
+ const newItems = entries.map((e) => e.label);
1720
+ if (opts.dryRun || entries.length === 0) return { newItems };
1721
+ for (const entry of entries) {
1722
+ const boxPath = entry.group === "data" ? `${boxDir}/${entry.name}` : `${boxDir}/config/${entry.name}`;
1723
+ const hostPath = join9(hostBases[entry.group], entry.name);
1724
+ await pullFlatEntry(t, entry, boxPath, hostPath);
1725
+ }
1726
+ return { newItems };
1727
+ }
1728
+ function agentBoxConfigDir(agent) {
1729
+ switch (agent) {
1730
+ case "claude":
1731
+ return CLAUDE_BOX_CONFIG_DIR;
1732
+ case "codex":
1733
+ return CODEX_BOX_CONFIG_DIR;
1734
+ default:
1735
+ return OPENCODE_BOX_DATA_DIR;
1736
+ }
1737
+ }
1738
+ function claudeStagedItems(result) {
1739
+ return result.newItems.map((it) => ({
1740
+ rel: it.category === "plugins" ? `plugins/cache/${it.name}` : `${it.category}/${it.name}`,
1741
+ label: `${it.category}/${it.name}`,
1742
+ kind: "dir"
1743
+ }));
1744
+ }
1745
+ function codexStagedItems(newItems) {
1746
+ return newItems.map((name) => ({
1747
+ rel: name,
1748
+ label: name,
1749
+ kind: name === "prompts" ? "dir" : "file"
1750
+ }));
1751
+ }
1752
+ function opencodeStagedItems(newItems) {
1753
+ return newItems.map((label) => {
1754
+ const name = label.startsWith("config/") ? label.slice("config/".length) : label;
1755
+ const isFile = name === "auth.json" || name === "opencode.json" || name === "opencode.jsonc";
1756
+ return { rel: label, label, kind: isFile ? "file" : "dir" };
1757
+ });
1758
+ }
1759
+ async function stageItemsViaTransport(t, boxDir, items, stagingDir) {
1760
+ for (const item of items) {
1761
+ const dest = join10(stagingDir, item.rel);
1762
+ if (item.kind === "dir") {
1763
+ await mkdir5(dest, { recursive: true });
1764
+ await t.pullTree(`${boxDir}/${item.rel}`, dest, { exclude: ["node_modules"] });
1765
+ } else {
1766
+ await mkdir5(dirname7(dest), { recursive: true });
1767
+ await t.pullFile(`${boxDir}/${item.rel}`, dest);
1768
+ }
1769
+ }
1770
+ }
1771
+ async function makeStagingDir(agent) {
1772
+ return mkdtemp2(join10(tmpdir2(), `agentbox-${agent}-propagate-`));
1773
+ }
1774
+ async function removeStagingDir(stagingDir) {
1775
+ await rm3(stagingDir, { recursive: true, force: true });
1776
+ }
1777
+ function transportSettingsTarget(t, boxDir, label) {
1778
+ const abs = (rel) => `${boxDir}/${rel}`;
1779
+ return {
1780
+ label,
1781
+ async exists(rel) {
1782
+ const r = await t.exec(["sh", "-c", `test -e '${abs(rel)}'`]);
1783
+ return r.exitCode === 0;
1784
+ },
1785
+ readText(rel) {
1786
+ return t.readText(abs(rel));
1787
+ },
1788
+ async writeText(rel, content, opts) {
1789
+ const stage = await mkdtemp2(join10(tmpdir2(), "agentbox-target-write-"));
1790
+ try {
1791
+ const tmp = join10(stage, "file");
1792
+ await writeFile5(tmp, content);
1793
+ await t.exec(["sh", "-c", `mkdir -p '${dirname7(abs(rel))}'`]);
1794
+ await t.pushFile(tmp, abs(rel));
1795
+ if (opts?.mode !== void 0) {
1796
+ await t.exec(["sh", "-c", `chmod ${opts.mode.toString(8)} '${abs(rel)}'`]);
1797
+ }
1798
+ } finally {
1799
+ await rm3(stage, { recursive: true, force: true });
1800
+ }
1801
+ },
1802
+ async copyIn(stagingAbs, rel, kind) {
1803
+ if (kind === "dir") {
1804
+ await t.exec(["sh", "-c", `mkdir -p '${abs(rel)}'`]);
1805
+ await t.pushTree(stagingAbs, abs(rel), { exclude: ["node_modules"] });
1806
+ } else {
1807
+ await t.exec(["sh", "-c", `mkdir -p '${dirname7(abs(rel))}'`]);
1808
+ await t.pushFile(stagingAbs, abs(rel));
1809
+ }
1810
+ }
1811
+ };
1812
+ }
1813
+ var CLAUDE_REGISTRY_FILES = [
1814
+ { key: "installed_plugins", rel: "plugins/installed_plugins.json" },
1815
+ { key: "known_marketplaces", rel: "plugins/known_marketplaces.json" }
1816
+ ];
1817
+ async function propagateStagedSettings(target, staged) {
1818
+ const result = {
1819
+ target: target.label,
1820
+ copied: [],
1821
+ skipped: [],
1822
+ mergedRegistries: []
1823
+ };
1824
+ for (const item of staged.items) {
1825
+ if (await target.exists(item.rel)) {
1826
+ result.skipped.push(item.label);
1827
+ continue;
1828
+ }
1829
+ await target.copyIn(join10(staged.stagingDir, item.rel), item.rel, item.kind);
1830
+ result.copied.push(item.label);
1831
+ }
1832
+ if (staged.agent === "claude" && staged.sourceRegistries) {
1833
+ for (const { key, rel } of CLAUDE_REGISTRY_FILES) {
1834
+ const source = staged.sourceRegistries[key];
1835
+ if (source === void 0) continue;
1836
+ const raw = await target.readText(rel);
1837
+ let targetJson;
1838
+ try {
1839
+ targetJson = raw === null ? void 0 : JSON.parse(raw);
1840
+ } catch {
1841
+ targetJson = void 0;
1842
+ }
1843
+ const merged = key === "installed_plugins" ? mergeInstalledPlugins(targetJson, source, { hostHome: "/home/vscode" }) : mergeKnownMarketplaces(targetJson, source, { hostHome: "/home/vscode" });
1844
+ if (!merged.changed) continue;
1845
+ await target.writeText(rel, `${JSON.stringify(merged.data, null, 2)}
1846
+ `);
1847
+ result.mergedRegistries.push(rel);
1848
+ }
1849
+ }
1850
+ return result;
1851
+ }
1852
+ function isolatedVolumeOf(box, agent) {
1853
+ switch (agent) {
1854
+ case "claude":
1855
+ return box.claudeConfigVolume;
1856
+ case "codex":
1857
+ return box.codexConfigVolume;
1858
+ default:
1859
+ return box.opencodeConfigVolume;
1860
+ }
1861
+ }
1862
+ function planPropagateTargets(boxes, opts) {
1863
+ const sharedVolume = resolveAgentSpec(opts.agent).dockerVolume;
1864
+ const inScope = boxes.filter(
1865
+ (b) => b.id !== opts.sourceBoxId && (opts.scope === "all" || (b.projectRoot ?? "") === (opts.projectRoot ?? ""))
1866
+ );
1867
+ const volumes = /* @__PURE__ */ new Map();
1868
+ const cloudBoxes = [];
1869
+ for (const box of inScope) {
1870
+ if ((box.provider ?? "docker") !== "docker") {
1871
+ cloudBoxes.push(box);
1872
+ continue;
1873
+ }
1874
+ const volume = isolatedVolumeOf(box, opts.agent) ?? sharedVolume;
1875
+ if (volume === opts.excludeVolume) continue;
1876
+ const entry = volumes.get(volume) ?? { boxNames: [], shared: volume === sharedVolume };
1877
+ entry.boxNames.push(box.name);
1878
+ volumes.set(volume, entry);
1879
+ }
1880
+ return {
1881
+ dockerVolumes: [...volumes.entries()].map(([volume, v]) => ({ volume, ...v })),
1882
+ cloudBoxes
1883
+ };
1884
+ }
1319
1885
  function makeSyncContext(init) {
1320
1886
  return {
1321
1887
  boxName: init.boxName,
@@ -1324,7 +1890,7 @@ function makeSyncContext(init) {
1324
1890
  hostWorkspace: init.hostWorkspace,
1325
1891
  projectRoot: init.projectRoot ?? init.hostWorkspace,
1326
1892
  boxWorkspace: init.boxWorkspace ?? "/workspace",
1327
- hostHome: init.hostHome ?? homedir6(),
1893
+ hostHome: init.hostHome ?? homedir7(),
1328
1894
  onLog: init.onLog ?? (() => {
1329
1895
  })
1330
1896
  };
@@ -1396,8 +1962,8 @@ async function scanHostEnvFiles(workspaceDir, patterns) {
1396
1962
  async function pushEnvFiles(ctx, transport, patterns) {
1397
1963
  const list = await findEnvFilesForTar(ctx.hostWorkspace, patterns);
1398
1964
  if (list.length === 0) return { copied: 0 };
1399
- const stage = await mkdtemp2(join9(tmpdir2(), "agentbox-envfiles-"));
1400
- const localTar = join9(stage, "envfiles.tar");
1965
+ const stage = await mkdtemp3(join11(tmpdir3(), "agentbox-envfiles-"));
1966
+ const localTar = join11(stage, "envfiles.tar");
1401
1967
  try {
1402
1968
  const packed = await execa3(
1403
1969
  "tar",
@@ -1417,7 +1983,7 @@ async function pushEnvFiles(ctx, transport, patterns) {
1417
1983
  return { copied: 0 };
1418
1984
  }
1419
1985
  } finally {
1420
- await rm3(stage, { recursive: true, force: true });
1986
+ await rm4(stage, { recursive: true, force: true });
1421
1987
  }
1422
1988
  return { copied: list.length };
1423
1989
  }
@@ -1457,9 +2023,9 @@ function planCarryEntry(entry) {
1457
2023
  parentChainNeeded
1458
2024
  };
1459
2025
  }
1460
- async function pathExists(p) {
2026
+ async function pathExists2(p) {
1461
2027
  try {
1462
- await stat4(p);
2028
+ await stat5(p);
1463
2029
  return true;
1464
2030
  } catch {
1465
2031
  return false;
@@ -1469,18 +2035,18 @@ function encodeClaudeProjectsKey(absPath) {
1469
2035
  return absPath.replace(/[^a-zA-Z0-9]/g, "-");
1470
2036
  }
1471
2037
  var BOX_CLAUDE_PROJECT_DIR = "/home/vscode/.claude/projects/-workspace";
1472
- async function resolveClaudeMemoryDir(hostWorkspace, hostHome = homedir7()) {
2038
+ async function resolveClaudeMemoryDir(hostWorkspace, hostHome = homedir8()) {
1473
2039
  if (hostWorkspace.length === 0) return null;
1474
- const memDir = join10(
2040
+ const memDir = join12(
1475
2041
  hostHome,
1476
2042
  ".claude",
1477
2043
  "projects",
1478
2044
  encodeClaudeProjectsKey(hostWorkspace),
1479
2045
  "memory"
1480
2046
  );
1481
- if (!await pathExists(memDir)) return null;
2047
+ if (!await pathExists2(memDir)) return null;
1482
2048
  try {
1483
- const entries = await readdir2(memDir);
2049
+ const entries = await readdir3(memDir);
1484
2050
  if (entries.length === 0) return null;
1485
2051
  } catch {
1486
2052
  return null;
@@ -1509,13 +2075,13 @@ async function findUnsyncableSymlinks(root, reachableRoots) {
1509
2075
  try {
1510
2076
  let entries;
1511
2077
  try {
1512
- entries = await readdir3(realDir, { withFileTypes: true });
2078
+ entries = await readdir4(realDir, { withFileTypes: true });
1513
2079
  } catch {
1514
2080
  return;
1515
2081
  }
1516
2082
  for (const ent of entries) {
1517
- const realFull = join11(realDir, ent.name);
1518
- const virtualFull = virtualDir ? join11(virtualDir, ent.name) : ent.name;
2083
+ const realFull = join13(realDir, ent.name);
2084
+ const virtualFull = virtualDir ? join13(virtualDir, ent.name) : ent.name;
1519
2085
  if (ent.isSymbolicLink()) {
1520
2086
  let real;
1521
2087
  try {
@@ -1528,7 +2094,7 @@ async function findUnsyncableSymlinks(root, reachableRoots) {
1528
2094
  unsyncable.push(virtualFull);
1529
2095
  continue;
1530
2096
  }
1531
- const st = await stat5(real).catch(() => null);
2097
+ const st = await stat6(real).catch(() => null);
1532
2098
  if (st?.isDirectory()) await walk(real, virtualFull);
1533
2099
  } else if (ent.isDirectory()) {
1534
2100
  await walk(realFull, virtualFull);
@@ -1541,9 +2107,9 @@ async function findUnsyncableSymlinks(root, reachableRoots) {
1541
2107
  await walk(root, "");
1542
2108
  return unsyncable;
1543
2109
  }
1544
- async function pathExists2(p) {
2110
+ async function pathExists3(p) {
1545
2111
  try {
1546
- await stat6(p);
2112
+ await stat7(p);
1547
2113
  return true;
1548
2114
  } catch {
1549
2115
  return false;
@@ -1552,7 +2118,7 @@ async function pathExists2(p) {
1552
2118
  async function seedAgentsVolume(args) {
1553
2119
  const seed = args.transport.seedVolumeFromHost;
1554
2120
  if (!seed) throw new Error("seedAgentsVolume requires a transport with seedVolumeFromHost");
1555
- const willSync = args.syncFromHost && await pathExists2(args.hostAgents);
2121
+ const willSync = args.syncFromHost && await pathExists3(args.hostAgents);
1556
2122
  if (!willSync) {
1557
2123
  try {
1558
2124
  await seed.call(args.transport, args.volume, []);
@@ -1593,7 +2159,7 @@ function isRealAgentCredential(agent, text) {
1593
2159
  }
1594
2160
  async function hostClaudeBackupExpired(path = CLAUDE_HOST_BACKUP, now = Date.now()) {
1595
2161
  try {
1596
- const parsed = JSON.parse(await readFile5(path, "utf8"));
2162
+ const parsed = JSON.parse(await readFile6(path, "utf8"));
1597
2163
  const exp = parsed?.claudeAiOauth?.expiresAt;
1598
2164
  return typeof exp === "number" && Number.isFinite(exp) && exp < now;
1599
2165
  } catch {
@@ -1602,7 +2168,7 @@ async function hostClaudeBackupExpired(path = CLAUDE_HOST_BACKUP, now = Date.now
1602
2168
  }
1603
2169
  async function hostBackupHasCredentials(path = CLAUDE_HOST_BACKUP) {
1604
2170
  try {
1605
- const parsed = JSON.parse(await readFile5(path, "utf8"));
2171
+ const parsed = JSON.parse(await readFile6(path, "utf8"));
1606
2172
  const rt = parsed?.claudeAiOauth?.refreshToken;
1607
2173
  return typeof rt === "string" && rt.length > 0;
1608
2174
  } catch {
@@ -1618,9 +2184,9 @@ async function extractCredentials(transport, opts = {}) {
1618
2184
  try {
1619
2185
  const text = await transport.readText(spec.credential.boxAbsPath);
1620
2186
  if (!text || !isRealAgentCredential(spec.id, text)) continue;
1621
- await mkdir4(dirname6(hostBackup), { recursive: true });
1622
- await writeFile4(hostBackup, text, { mode: 384 });
1623
- await chmod(hostBackup, 384).catch(() => {
2187
+ await mkdir6(dirname8(hostBackup), { recursive: true });
2188
+ await writeFile6(hostBackup, text, { mode: 384 });
2189
+ await chmod2(hostBackup, 384).catch(() => {
1624
2190
  });
1625
2191
  extracted.push(spec.id);
1626
2192
  log(`extracted ${spec.id} login from box to ${hostBackup}`);
@@ -1632,6 +2198,72 @@ async function extractCredentials(transport, opts = {}) {
1632
2198
  }
1633
2199
  return extracted;
1634
2200
  }
2201
+ var MAX_CREDENTIAL_BYTES = 256 * 1024;
2202
+ function claudeExpiresAt(text) {
2203
+ try {
2204
+ const parsed = JSON.parse(text);
2205
+ const exp = parsed?.claudeAiOauth?.expiresAt;
2206
+ return typeof exp === "number" && Number.isFinite(exp) ? exp : null;
2207
+ } catch {
2208
+ return null;
2209
+ }
2210
+ }
2211
+ function shouldAcceptCredentialUpdate(agent, incoming, existing) {
2212
+ if (existing === null) return { accept: true, reason: "no existing backup" };
2213
+ if (existing === incoming) return { accept: false, reason: "unchanged" };
2214
+ if (resolveAgentSpec(agent).credential.realShape === "claude-oauth") {
2215
+ const incomingExp = claudeExpiresAt(incoming);
2216
+ const existingExp = claudeExpiresAt(existing);
2217
+ if (incomingExp === null) return { accept: false, reason: "incoming blob has no expiresAt" };
2218
+ if (existingExp !== null && incomingExp <= existingExp) {
2219
+ return { accept: false, reason: "not newer than backup" };
2220
+ }
2221
+ return { accept: true, reason: "newer expiresAt" };
2222
+ }
2223
+ return { accept: true, reason: "content changed" };
2224
+ }
2225
+ async function writeCredentialBackup(agent, content, opts = {}) {
2226
+ const path = opts.backupPath ?? resolveAgentSpec(agent).credential.hostBackup;
2227
+ await mkdir6(dirname8(path), { recursive: true });
2228
+ const tmp = `${path}.tmp-${String(process.pid)}`;
2229
+ await writeFile6(tmp, content, { mode: 384 });
2230
+ await rename3(tmp, path);
2231
+ await chmod2(path, 384).catch(() => {
2232
+ });
2233
+ }
2234
+ async function readCredentialBackup(agent, opts = {}) {
2235
+ const path = opts.backupPath ?? resolveAgentSpec(agent).credential.hostBackup;
2236
+ try {
2237
+ return await readFile6(path, "utf8");
2238
+ } catch {
2239
+ return null;
2240
+ }
2241
+ }
2242
+ async function pushCredentialToBox(transport, agent, content) {
2243
+ const abs = resolveAgentSpec(agent).credential.boxAbsPath;
2244
+ const dir = abs.slice(0, abs.lastIndexOf("/"));
2245
+ const stage = await mkdtemp4(join14(tmpdir4(), "agentbox-cred-push-"));
2246
+ try {
2247
+ const tmp = join14(stage, "credential");
2248
+ await writeFile6(tmp, content, { mode: 384 });
2249
+ const mk = await transport.exec(["sh", "-c", `mkdir -p '${dir}'`]);
2250
+ if (mk.exitCode !== 0) {
2251
+ throw new Error(`mkdir ${dir} in box failed: ${mk.stderr.trim()}`);
2252
+ }
2253
+ await transport.pushFile(tmp, abs);
2254
+ const normalize22 = `chown "$(id -un):" '${abs}' && chmod 600 '${abs}'`;
2255
+ const norm = await transport.exec([
2256
+ "sh",
2257
+ "-c",
2258
+ `{ ${normalize22}; } 2>/dev/null || sudo sh -c "${normalize22.replaceAll('"', '\\"')}"`
2259
+ ]);
2260
+ if (norm.exitCode !== 0) {
2261
+ throw new Error(`chown/chmod of ${abs} in box failed: ${norm.stderr.trim()}`);
2262
+ }
2263
+ } finally {
2264
+ await rm5(stage, { recursive: true, force: true });
2265
+ }
2266
+ }
1635
2267
  var NON_REGULAR_TOKEN = "-";
1636
2268
  function classifyUntrackedOverlay(boxToken, hostHash) {
1637
2269
  if (boxToken === void 0) return "copy";
@@ -1780,7 +2412,7 @@ function makeHostGitPorts() {
1780
2412
  return untracked.exitCode === 0 ? splitNul(untracked.stdout) : [];
1781
2413
  },
1782
2414
  async hashHostFile(hostMain, relPath) {
1783
- return createHash("sha256").update(await readFile6(join12(hostMain, relPath))).digest("hex");
2415
+ return createHash("sha256").update(await readFile7(join15(hostMain, relPath))).digest("hex");
1784
2416
  },
1785
2417
  async packHostFiles(hostMain, relPaths) {
1786
2418
  const tarOut = await execa4("tar", ["-C", hostMain, "--null", "-T", "-", "-cf", "-"], {
@@ -1795,9 +2427,9 @@ function makeHostGitPorts() {
1795
2427
  var BOX_WORKFLOWS_DIR = "/home/vscode/.claude/workflows";
1796
2428
  var BOX_DYNAMIC_SYNC_MANIFEST = "/home/vscode/.agentbox/dynamic-sync.json";
1797
2429
  var BOX_MEMORY_DIR = `${BOX_CLAUDE_PROJECT_DIR}/memory`;
1798
- async function pathExists3(p) {
2430
+ async function pathExists4(p) {
1799
2431
  try {
1800
- await stat7(p);
2432
+ await stat8(p);
1801
2433
  return true;
1802
2434
  } catch {
1803
2435
  return false;
@@ -1806,21 +2438,21 @@ async function pathExists3(p) {
1806
2438
  async function walkFiles(root, prefix = "") {
1807
2439
  let entries;
1808
2440
  try {
1809
- entries = await readdir4(root, { withFileTypes: true });
2441
+ entries = await readdir5(root, { withFileTypes: true });
1810
2442
  } catch {
1811
2443
  return [];
1812
2444
  }
1813
2445
  const out = [];
1814
2446
  for (const ent of entries) {
1815
2447
  const rel = prefix ? `${prefix}/${ent.name}` : ent.name;
1816
- const full = join13(root, ent.name);
2448
+ const full = join16(root, ent.name);
1817
2449
  if (ent.isDirectory()) {
1818
2450
  out.push(...await walkFiles(full, rel));
1819
2451
  } else if (ent.isFile()) {
1820
2452
  out.push(rel);
1821
2453
  } else if (ent.isSymbolicLink()) {
1822
2454
  try {
1823
- const s = await stat7(full);
2455
+ const s = await stat8(full);
1824
2456
  if (s.isFile()) out.push(rel);
1825
2457
  } catch {
1826
2458
  }
@@ -1829,7 +2461,7 @@ async function walkFiles(root, prefix = "") {
1829
2461
  return out;
1830
2462
  }
1831
2463
  async function hashFile(absPath) {
1832
- const buf = await readFile7(absPath);
2464
+ const buf = await readFile8(absPath);
1833
2465
  return createHash2("sha256").update(buf).digest("hex");
1834
2466
  }
1835
2467
  async function buildHostSet(name, hostDir, boxDst) {
@@ -1837,13 +2469,13 @@ async function buildHostSet(name, hostDir, boxDst) {
1837
2469
  const rels = await walkFiles(hostDir);
1838
2470
  const files = {};
1839
2471
  for (const rel of rels) {
1840
- files[rel] = await hashFile(join13(hostDir, rel));
2472
+ files[rel] = await hashFile(join16(hostDir, rel));
1841
2473
  }
1842
2474
  return { dst: boxDst, files, hostDir };
1843
2475
  }
1844
- async function buildHostSyncManifest(workspacePath, hostHome = homedir8()) {
1845
- const workflowsDir = join13(hostHome, ".claude", "workflows");
1846
- const workflowsHost = await pathExists3(workflowsDir) ? workflowsDir : null;
2476
+ async function buildHostSyncManifest(workspacePath, hostHome = homedir9()) {
2477
+ const workflowsDir = join16(hostHome, ".claude", "workflows");
2478
+ const workflowsHost = await pathExists4(workflowsDir) ? workflowsDir : null;
1847
2479
  const memoryHost = await resolveClaudeMemoryDir(workspacePath, hostHome);
1848
2480
  const [workflows, memory] = await Promise.all([
1849
2481
  buildHostSet("workflows", workflowsHost, BOX_WORKFLOWS_DIR),
@@ -1864,7 +2496,7 @@ function computeSyncDelta(host, box) {
1864
2496
  uploads.push({
1865
2497
  set: name,
1866
2498
  rel,
1867
- absSrc: join13(hostSet.hostDir, rel),
2499
+ absSrc: join16(hostSet.hostDir, rel),
1868
2500
  dst: `${hostSet.dst}/${rel}`
1869
2501
  });
1870
2502
  }
@@ -1883,15 +2515,15 @@ async function stageDynamicSyncTarball(uploads) {
1883
2515
  return { tarballPath: null, cleanup: async () => {
1884
2516
  } };
1885
2517
  }
1886
- const stageDir = await mkdtemp3(join13(tmpdir3(), "agentbox-dynsync-stage-"));
2518
+ const stageDir = await mkdtemp5(join16(tmpdir5(), "agentbox-dynsync-stage-"));
1887
2519
  let tarballPath = null;
1888
2520
  try {
1889
2521
  for (const up of uploads) {
1890
- const target = join13(stageDir, up.set, up.rel);
1891
- await mkdir5(dirname7(target), { recursive: true });
2522
+ const target = join16(stageDir, up.set, up.rel);
2523
+ await mkdir7(dirname9(target), { recursive: true });
1892
2524
  await copyFile(up.absSrc, target);
1893
2525
  }
1894
- tarballPath = join13(tmpdir3(), `agentbox-dynsync-${basename22(stageDir)}.tar.gz`);
2526
+ tarballPath = join16(tmpdir5(), `agentbox-dynsync-${basename22(stageDir)}.tar.gz`);
1895
2527
  await execa5("tar", ["-czf", tarballPath, "-C", stageDir, "."], {
1896
2528
  env: { ...process.env, COPYFILE_DISABLE: "1" }
1897
2529
  });
@@ -1899,13 +2531,13 @@ async function stageDynamicSyncTarball(uploads) {
1899
2531
  return {
1900
2532
  tarballPath: tp,
1901
2533
  cleanup: async () => {
1902
- await rm4(stageDir, { recursive: true, force: true });
1903
- await rm4(tp, { force: true });
2534
+ await rm6(stageDir, { recursive: true, force: true });
2535
+ await rm6(tp, { force: true });
1904
2536
  }
1905
2537
  };
1906
2538
  } catch (err) {
1907
- await rm4(stageDir, { recursive: true, force: true });
1908
- if (tarballPath) await rm4(tarballPath, { force: true });
2539
+ await rm6(stageDir, { recursive: true, force: true });
2540
+ if (tarballPath) await rm6(tarballPath, { force: true });
1909
2541
  throw err;
1910
2542
  }
1911
2543
  }
@@ -2025,7 +2657,7 @@ var BOX_WORKSPACE2 = "/workspace";
2025
2657
  var MINIMAL_TRUSTED_CODEX_CONFIG = `[projects."${BOX_WORKSPACE2}"]
2026
2658
  trust_level = "trusted"
2027
2659
  `;
2028
- function sanitizeCodexConfigForBox(tomlText, hostHome = homedir9()) {
2660
+ function sanitizeCodexConfigForBox(tomlText, hostHome = homedir10()) {
2029
2661
  const cfg = parse(tomlText);
2030
2662
  let changed = false;
2031
2663
  if (isRecord(cfg["mcp_servers"])) {
@@ -2071,13 +2703,52 @@ function sanitizeCodexConfigForBox(tomlText, hostHome = homedir9()) {
2071
2703
  projects[BOX_WORKSPACE2] = wsEntry;
2072
2704
  changed = true;
2073
2705
  }
2074
- return { text: changed ? stringify(cfg) : tomlText, changed };
2706
+ const keptMarketplaces = isRecord(cfg["marketplaces"]) ? Object.keys(cfg["marketplaces"]) : [];
2707
+ return { text: changed ? stringify(cfg) : tomlText, changed, keptMarketplaces };
2708
+ }
2709
+ var BOX_MERGED_TABLES = ["marketplaces", "plugins", "mcp_servers", "projects"];
2710
+ function mergeCodexConfigForBox(hostSanitizedText, boxText) {
2711
+ const host = parse(hostSanitizedText);
2712
+ const hostMarketplaces = () => isRecord(host["marketplaces"]) ? Object.keys(host["marketplaces"]) : [];
2713
+ if (boxText === null) {
2714
+ return { text: hostSanitizedText, marketplaces: hostMarketplaces(), mergedFromBox: false };
2715
+ }
2716
+ let box;
2717
+ try {
2718
+ box = parse(boxText);
2719
+ } catch {
2720
+ return { text: hostSanitizedText, marketplaces: hostMarketplaces(), mergedFromBox: false };
2721
+ }
2722
+ let merged = false;
2723
+ for (const table of BOX_MERGED_TABLES) {
2724
+ const boxTable = box[table];
2725
+ if (!isRecord(boxTable)) continue;
2726
+ const hostTable = isRecord(host[table]) ? host[table] : {};
2727
+ for (const [name, def] of Object.entries(boxTable)) {
2728
+ if (name in hostTable) continue;
2729
+ hostTable[name] = def;
2730
+ merged = true;
2731
+ }
2732
+ if (Object.keys(hostTable).length > 0) host[table] = hostTable;
2733
+ }
2734
+ for (const [key, value] of Object.entries(box)) {
2735
+ if (BOX_MERGED_TABLES.includes(key)) continue;
2736
+ if (key in host) continue;
2737
+ host[key] = value;
2738
+ merged = true;
2739
+ }
2740
+ const marketplaces = isRecord(host["marketplaces"]) ? Object.keys(host["marketplaces"]) : [];
2741
+ return {
2742
+ text: merged ? stringify(host) : hostSanitizedText,
2743
+ marketplaces,
2744
+ mergedFromBox: merged
2745
+ };
2075
2746
  }
2076
2747
  var CREDENTIALS_BACKUP_FILE = resolveAgentSpec("claude").credential.hostBackup;
2077
2748
  var CLOUD_WORKSPACE = "/workspace";
2078
- async function pathExists4(p) {
2749
+ async function pathExists5(p) {
2079
2750
  try {
2080
- await stat8(p);
2751
+ await stat9(p);
2081
2752
  return true;
2082
2753
  } catch {
2083
2754
  return false;
@@ -2088,15 +2759,15 @@ async function findBrokenSymlinks(root) {
2088
2759
  async function walk(dir) {
2089
2760
  let entries;
2090
2761
  try {
2091
- entries = await readdir5(dir, { withFileTypes: true });
2762
+ entries = await readdir6(dir, { withFileTypes: true });
2092
2763
  } catch {
2093
2764
  return;
2094
2765
  }
2095
2766
  for (const ent of entries) {
2096
- const full = join14(dir, ent.name);
2767
+ const full = join17(dir, ent.name);
2097
2768
  if (ent.isSymbolicLink()) {
2098
2769
  try {
2099
- await stat8(full);
2770
+ await stat9(full);
2100
2771
  } catch {
2101
2772
  broken.push(relative2(root, full));
2102
2773
  }
@@ -2109,7 +2780,7 @@ async function findBrokenSymlinks(root) {
2109
2780
  return broken;
2110
2781
  }
2111
2782
  async function mkStageDir(prefix) {
2112
- return mkdtemp4(join14(tmpdir4(), `agentbox-${prefix}-stage-`));
2783
+ return mkdtemp6(join17(tmpdir6(), `agentbox-${prefix}-stage-`));
2113
2784
  }
2114
2785
  var STAGE_WRITABLE_CHMOD = "--chmod=Du+rwx,Fu+rw";
2115
2786
  function emptyResult(warnings = []) {
@@ -2117,7 +2788,7 @@ function emptyResult(warnings = []) {
2117
2788
  }, warnings };
2118
2789
  }
2119
2790
  async function tarballFromDir(stageDir, agent) {
2120
- const tarballPath = join14(tmpdir4(), `agentbox-${agent}-${basename3(stageDir)}.tar.gz`);
2791
+ const tarballPath = join17(tmpdir6(), `agentbox-${agent}-${basename3(stageDir)}.tar.gz`);
2121
2792
  await execa6("tar", ["-czf", tarballPath, "-C", stageDir, "."], {
2122
2793
  env: { ...process.env, COPYFILE_DISABLE: "1" }
2123
2794
  });
@@ -2126,7 +2797,7 @@ async function tarballFromDir(stageDir, agent) {
2126
2797
  function makeCleanup(paths) {
2127
2798
  return async () => {
2128
2799
  for (const p of paths) {
2129
- await rm5(p, { recursive: true, force: true });
2800
+ await rm7(p, { recursive: true, force: true });
2130
2801
  }
2131
2802
  };
2132
2803
  }
@@ -2134,7 +2805,7 @@ async function stageSingleFileTarball(agent, sourcePath, tarballEntryName) {
2134
2805
  const stageDir = await mkStageDir(agent);
2135
2806
  let tarballPath = null;
2136
2807
  try {
2137
- await copyFile2(sourcePath, join14(stageDir, tarballEntryName));
2808
+ await copyFile2(sourcePath, join17(stageDir, tarballEntryName));
2138
2809
  tarballPath = await tarballFromDir(stageDir, agent);
2139
2810
  return {
2140
2811
  tarballPath,
@@ -2142,19 +2813,19 @@ async function stageSingleFileTarball(agent, sourcePath, tarballEntryName) {
2142
2813
  warnings: []
2143
2814
  };
2144
2815
  } catch (err) {
2145
- await rm5(stageDir, { recursive: true, force: true });
2146
- if (tarballPath) await rm5(tarballPath, { force: true });
2816
+ await rm7(stageDir, { recursive: true, force: true });
2817
+ if (tarballPath) await rm7(tarballPath, { force: true });
2147
2818
  throw err;
2148
2819
  }
2149
2820
  }
2150
2821
  var CLAUDE_STATIC_EXCLUDES = resolveAgentSpec("claude").staticPaths[0]?.exclude ?? [];
2151
2822
  async function buildBoxClaudeJsonFromHost(opts) {
2152
2823
  const { hostHome, hostWorkspace } = opts;
2153
- const hostClaudeJson = join14(hostHome, ".claude.json");
2824
+ const hostClaudeJson = join17(hostHome, ".claude.json");
2154
2825
  let working;
2155
- if (await pathExists4(hostClaudeJson)) {
2826
+ if (await pathExists5(hostClaudeJson)) {
2156
2827
  try {
2157
- working = JSON.parse(await readFile8(hostClaudeJson, "utf8"));
2828
+ working = JSON.parse(await readFile9(hostClaudeJson, "utf8"));
2158
2829
  } catch {
2159
2830
  working = null;
2160
2831
  }
@@ -2185,7 +2856,7 @@ async function buildBoxClaudeJsonFromHost(opts) {
2185
2856
  return working;
2186
2857
  }
2187
2858
  async function stageClaudeJsonOnlyForUpload(opts = {}) {
2188
- const hostHome = opts.hostHome ?? homedir10();
2859
+ const hostHome = opts.hostHome ?? homedir11();
2189
2860
  const stageDir = await mkStageDir("claude-json-only");
2190
2861
  let tarballPath = null;
2191
2862
  try {
@@ -2193,7 +2864,7 @@ async function stageClaudeJsonOnlyForUpload(opts = {}) {
2193
2864
  hostHome,
2194
2865
  hostWorkspace: opts.hostWorkspace
2195
2866
  });
2196
- await writeFile5(join14(stageDir, "_claude.json"), JSON.stringify(claudeJson, null, 2));
2867
+ await writeFile7(join17(stageDir, "_claude.json"), JSON.stringify(claudeJson, null, 2));
2197
2868
  tarballPath = await tarballFromDir(stageDir, "claude-json-only");
2198
2869
  return {
2199
2870
  tarballPath,
@@ -2201,15 +2872,15 @@ async function stageClaudeJsonOnlyForUpload(opts = {}) {
2201
2872
  warnings: []
2202
2873
  };
2203
2874
  } catch (err) {
2204
- await rm5(stageDir, { recursive: true, force: true });
2205
- if (tarballPath) await rm5(tarballPath, { force: true });
2875
+ await rm7(stageDir, { recursive: true, force: true });
2876
+ if (tarballPath) await rm7(tarballPath, { force: true });
2206
2877
  throw err;
2207
2878
  }
2208
2879
  }
2209
2880
  async function stageClaudeStaticForUpload(opts = {}) {
2210
- const hostHome = opts.hostHome ?? homedir10();
2211
- const hostClaude = join14(hostHome, ".claude");
2212
- if (!await pathExists4(hostClaude)) return emptyResult();
2881
+ const hostHome = opts.hostHome ?? homedir11();
2882
+ const hostClaude = join17(hostHome, ".claude");
2883
+ if (!await pathExists5(hostClaude)) return emptyResult();
2213
2884
  const stageDir = await mkStageDir("claude-static");
2214
2885
  let tarballPath = null;
2215
2886
  try {
@@ -2226,13 +2897,13 @@ async function stageClaudeStaticForUpload(opts = {}) {
2226
2897
  `${hostClaude}/`,
2227
2898
  `${stageDir}/`
2228
2899
  ]);
2229
- const settingsPath = join14(stageDir, "settings.json");
2230
- if (await pathExists4(settingsPath)) {
2900
+ const settingsPath = join17(stageDir, "settings.json");
2901
+ if (await pathExists5(settingsPath)) {
2231
2902
  try {
2232
- const parsed = JSON.parse(await readFile8(settingsPath, "utf8"));
2903
+ const parsed = JSON.parse(await readFile9(settingsPath, "utf8"));
2233
2904
  const filtered = filterHostHooks(parsed, hostHome);
2234
2905
  if (filtered.removedCommands.length > 0) {
2235
- await writeFile5(settingsPath, JSON.stringify(filtered.data, null, 2));
2906
+ await writeFile7(settingsPath, JSON.stringify(filtered.data, null, 2));
2236
2907
  }
2237
2908
  } catch {
2238
2909
  }
@@ -2241,17 +2912,17 @@ async function stageClaudeStaticForUpload(opts = {}) {
2241
2912
  hostHome,
2242
2913
  hostWorkspace: opts.hostWorkspace
2243
2914
  });
2244
- await writeFile5(join14(stageDir, "_claude.json"), JSON.stringify(claudeJson, null, 2));
2245
- const pluginsDir = join14(stageDir, "plugins");
2246
- if (await pathExists4(pluginsDir)) {
2915
+ await writeFile7(join17(stageDir, "_claude.json"), JSON.stringify(claudeJson, null, 2));
2916
+ const pluginsDir = join17(stageDir, "plugins");
2917
+ if (await pathExists5(pluginsDir)) {
2247
2918
  try {
2248
- const entries = await readdir5(pluginsDir, { withFileTypes: true });
2919
+ const entries = await readdir6(pluginsDir, { withFileTypes: true });
2249
2920
  for (const ent of entries) {
2250
2921
  if (!ent.isFile() || !ent.name.endsWith(".json")) continue;
2251
- const file = join14(pluginsDir, ent.name);
2252
- const raw = await readFile8(file, "utf8");
2922
+ const file = join17(pluginsDir, ent.name);
2923
+ const raw = await readFile9(file, "utf8");
2253
2924
  const replaced = raw.split(`${hostHome}/.claude/plugins/`).join("/home/vscode/.claude/plugins/");
2254
- if (replaced !== raw) await writeFile5(file, replaced);
2925
+ if (replaced !== raw) await writeFile7(file, replaced);
2255
2926
  }
2256
2927
  } catch {
2257
2928
  }
@@ -2263,29 +2934,51 @@ async function stageClaudeStaticForUpload(opts = {}) {
2263
2934
  warnings: []
2264
2935
  };
2265
2936
  } catch (err) {
2266
- await rm5(stageDir, { recursive: true, force: true });
2267
- if (tarballPath) await rm5(tarballPath, { force: true });
2937
+ await rm7(stageDir, { recursive: true, force: true });
2938
+ if (tarballPath) await rm7(tarballPath, { force: true });
2268
2939
  throw err;
2269
2940
  }
2270
2941
  }
2271
2942
  async function stageClaudeCredentialsForUpload() {
2272
- if (!await pathExists4(CREDENTIALS_BACKUP_FILE)) return emptyResult();
2943
+ if (!await pathExists5(CREDENTIALS_BACKUP_FILE)) return emptyResult();
2273
2944
  return stageSingleFileTarball("claude-creds", CREDENTIALS_BACKUP_FILE, ".credentials.json");
2274
2945
  }
2275
2946
  var CODEX_STATIC_EXCLUDES = resolveAgentSpec("codex").staticPaths[0]?.exclude ?? [];
2947
+ var CODEX_STATIC_INCLUDES = resolveAgentSpec("codex").staticPaths[0]?.include ?? [];
2276
2948
  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.';
2277
2949
  async function sanitizeStagedCodexConfig(configPath, hostHome) {
2278
2950
  try {
2279
- if (!await pathExists4(configPath)) return;
2280
- const { text, changed } = sanitizeCodexConfigForBox(await readFile8(configPath, "utf8"), hostHome);
2281
- if (changed) await writeFile5(configPath, text);
2951
+ if (!await pathExists5(configPath)) return { keptMarketplaces: [] };
2952
+ const { text, changed, keptMarketplaces } = sanitizeCodexConfigForBox(
2953
+ await readFile9(configPath, "utf8"),
2954
+ hostHome
2955
+ );
2956
+ if (changed) await writeFile7(configPath, text);
2957
+ return { keptMarketplaces };
2282
2958
  } catch {
2959
+ return null;
2960
+ }
2961
+ }
2962
+ async function purgeOrphanCodexMarketplaceDirs(stageDir, keptMarketplaces) {
2963
+ const kept = new Set(keptMarketplaces);
2964
+ for (const rel of ["plugins/cache", ".tmp/marketplaces"]) {
2965
+ const dir = join17(stageDir, rel);
2966
+ let entries;
2967
+ try {
2968
+ entries = await readdir6(dir);
2969
+ } catch {
2970
+ continue;
2971
+ }
2972
+ for (const name of entries) {
2973
+ if (kept.has(name)) continue;
2974
+ await rm7(join17(dir, name), { recursive: true, force: true });
2975
+ }
2283
2976
  }
2284
2977
  }
2285
2978
  async function stageCodexStaticForUpload(opts = {}) {
2286
- const hostHome = opts.hostHome ?? homedir10();
2287
- const hostCodex = join14(hostHome, ".codex");
2288
- if (!await pathExists4(hostCodex)) return emptyResult();
2979
+ const hostHome = opts.hostHome ?? homedir11();
2980
+ const hostCodex = join17(hostHome, ".codex");
2981
+ if (!await pathExists5(hostCodex)) return emptyResult();
2289
2982
  const stageDir = await mkStageDir("codex-static");
2290
2983
  let tarballPath = null;
2291
2984
  try {
@@ -2295,11 +2988,15 @@ async function stageCodexStaticForUpload(opts = {}) {
2295
2988
  STAGE_WRITABLE_CHMOD,
2296
2989
  "-L",
2297
2990
  ...codexBroken.map((r) => `--exclude=/${r}`),
2991
+ ...CODEX_STATIC_INCLUDES.map((p) => `--include=${p}`),
2298
2992
  ...CODEX_STATIC_EXCLUDES.map((p) => `--exclude=${p}`),
2299
2993
  `${hostCodex}/`,
2300
2994
  `${stageDir}/`
2301
2995
  ]);
2302
- await sanitizeStagedCodexConfig(join14(stageDir, "config.toml"), hostHome);
2996
+ const sanitized = await sanitizeStagedCodexConfig(join17(stageDir, "config.toml"), hostHome);
2997
+ if (sanitized !== null) {
2998
+ await purgeOrphanCodexMarketplaceDirs(stageDir, sanitized.keptMarketplaces);
2999
+ }
2303
3000
  tarballPath = await tarballFromDir(stageDir, "codex-static");
2304
3001
  return {
2305
3002
  tarballPath,
@@ -2307,15 +3004,15 @@ async function stageCodexStaticForUpload(opts = {}) {
2307
3004
  warnings: []
2308
3005
  };
2309
3006
  } catch (err) {
2310
- await rm5(stageDir, { recursive: true, force: true });
2311
- if (tarballPath) await rm5(tarballPath, { force: true });
3007
+ await rm7(stageDir, { recursive: true, force: true });
3008
+ if (tarballPath) await rm7(tarballPath, { force: true });
2312
3009
  throw err;
2313
3010
  }
2314
3011
  }
2315
3012
  async function stageAgentsStaticForUpload(opts = {}) {
2316
- const hostHome = opts.hostHome ?? homedir10();
2317
- const hostAgents = join14(hostHome, ".agents");
2318
- if (!await pathExists4(hostAgents)) return emptyResult();
3013
+ const hostHome = opts.hostHome ?? homedir11();
3014
+ const hostAgents = join17(hostHome, ".agents");
3015
+ if (!await pathExists5(hostAgents)) return emptyResult();
2319
3016
  const stageDir = await mkStageDir("agents-static");
2320
3017
  let tarballPath = null;
2321
3018
  try {
@@ -2335,28 +3032,28 @@ async function stageAgentsStaticForUpload(opts = {}) {
2335
3032
  warnings: []
2336
3033
  };
2337
3034
  } catch (err) {
2338
- await rm5(stageDir, { recursive: true, force: true });
2339
- if (tarballPath) await rm5(tarballPath, { force: true });
3035
+ await rm7(stageDir, { recursive: true, force: true });
3036
+ if (tarballPath) await rm7(tarballPath, { force: true });
2340
3037
  throw err;
2341
3038
  }
2342
3039
  }
2343
3040
  async function stageCodexCredentialsForUpload(opts = {}) {
2344
- const hostHome = opts.hostHome ?? homedir10();
2345
- const cloudBackup = join14(hostHome, ".agentbox", "codex-credentials.json");
2346
- if (await pathExists4(cloudBackup)) {
3041
+ const hostHome = opts.hostHome ?? homedir11();
3042
+ const cloudBackup = join17(hostHome, ".agentbox", "codex-credentials.json");
3043
+ if (await pathExists5(cloudBackup)) {
2347
3044
  return stageSingleFileTarball("codex-creds", cloudBackup, "auth.json");
2348
3045
  }
2349
- const hostAuth = join14(hostHome, ".codex", "auth.json");
2350
- if (!await pathExists4(hostAuth)) return emptyResult([CODEX_KEYCHAIN_WARNING]);
3046
+ const hostAuth = join17(hostHome, ".codex", "auth.json");
3047
+ if (!await pathExists5(hostAuth)) return emptyResult([CODEX_KEYCHAIN_WARNING]);
2351
3048
  return stageSingleFileTarball("codex-creds", hostAuth, "auth.json");
2352
3049
  }
2353
3050
  var OPENCODE_DATA_EXCLUDES = resolveAgentSpec("opencode").staticPaths[0]?.exclude ?? [];
2354
3051
  async function stageOpencodeStaticForUpload(opts = {}) {
2355
- const hostHome = opts.hostHome ?? homedir10();
2356
- const hostData = join14(hostHome, ".local", "share", "opencode");
2357
- const hostConfig = join14(hostHome, ".config", "opencode");
2358
- const hasData = await pathExists4(hostData);
2359
- const hasConfig = await pathExists4(hostConfig);
3052
+ const hostHome = opts.hostHome ?? homedir11();
3053
+ const hostData = join17(hostHome, ".local", "share", "opencode");
3054
+ const hostConfig = join17(hostHome, ".config", "opencode");
3055
+ const hasData = await pathExists5(hostData);
3056
+ const hasConfig = await pathExists5(hostConfig);
2360
3057
  if (!hasData && !hasConfig) return emptyResult();
2361
3058
  const stageDir = await mkStageDir("opencode-static");
2362
3059
  let tarballPath = null;
@@ -2374,7 +3071,7 @@ async function stageOpencodeStaticForUpload(opts = {}) {
2374
3071
  ]);
2375
3072
  }
2376
3073
  if (hasConfig) {
2377
- const configStage = join14(stageDir, "config");
3074
+ const configStage = join17(stageDir, "config");
2378
3075
  const cfgBroken = await findBrokenSymlinks(hostConfig);
2379
3076
  await execa6("rsync", [
2380
3077
  "-a",
@@ -2392,25 +3089,25 @@ async function stageOpencodeStaticForUpload(opts = {}) {
2392
3089
  warnings: []
2393
3090
  };
2394
3091
  } catch (err) {
2395
- await rm5(stageDir, { recursive: true, force: true });
2396
- if (tarballPath) await rm5(tarballPath, { force: true });
3092
+ await rm7(stageDir, { recursive: true, force: true });
3093
+ if (tarballPath) await rm7(tarballPath, { force: true });
2397
3094
  throw err;
2398
3095
  }
2399
3096
  }
2400
3097
  async function stageOpencodeCredentialsForUpload(opts = {}) {
2401
- const hostHome = opts.hostHome ?? homedir10();
2402
- const cloudBackup = join14(hostHome, ".agentbox", "opencode-credentials.json");
2403
- if (await pathExists4(cloudBackup)) {
3098
+ const hostHome = opts.hostHome ?? homedir11();
3099
+ const cloudBackup = join17(hostHome, ".agentbox", "opencode-credentials.json");
3100
+ if (await pathExists5(cloudBackup)) {
2404
3101
  return stageSingleFileTarball("opencode-creds", cloudBackup, "auth.json");
2405
3102
  }
2406
- const hostAuth = join14(hostHome, ".local", "share", "opencode", "auth.json");
2407
- if (!await pathExists4(hostAuth)) return emptyResult();
3103
+ const hostAuth = join17(hostHome, ".local", "share", "opencode", "auth.json");
3104
+ if (!await pathExists5(hostAuth)) return emptyResult();
2408
3105
  return stageSingleFileTarball("opencode-creds", hostAuth, "auth.json");
2409
3106
  }
2410
3107
  async function stageOpencodeStateForUpload(opts = {}) {
2411
- const hostHome = opts.hostHome ?? homedir10();
2412
- const hostModel = join14(hostHome, ".local", "state", "opencode", "model.json");
2413
- if (!await pathExists4(hostModel)) return emptyResult();
3108
+ const hostHome = opts.hostHome ?? homedir11();
3109
+ const hostModel = join17(hostHome, ".local", "state", "opencode", "model.json");
3110
+ if (!await pathExists5(hostModel)) return emptyResult();
2414
3111
  return stageSingleFileTarball("opencode-state", hostModel, "model.json");
2415
3112
  }
2416
3113
  var CLAUDE_STATIC_BOX_DIR = "/home/vscode/.claude";
@@ -2435,7 +3132,7 @@ function preparedStatePathFor(provider) {
2435
3132
  if (!/^[A-Za-z0-9._-]+$/.test(provider)) {
2436
3133
  throw new Error(`invalid provider name for prepared-state: ${JSON.stringify(provider)}`);
2437
3134
  }
2438
- return pathResolve(homedir11(), ".agentbox", `${provider}-prepared.json`);
3135
+ return pathResolve(homedir12(), ".agentbox", `${provider}-prepared.json`);
2439
3136
  }
2440
3137
  function readPreparedStateRaw(provider) {
2441
3138
  const path = preparedStatePathFor(provider);
@@ -2448,14 +3145,14 @@ function readPreparedStateRaw(provider) {
2448
3145
  }
2449
3146
  function writePreparedStateRaw(provider, state) {
2450
3147
  const path = preparedStatePathFor(provider);
2451
- mkdirSync3(dirname8(path), { recursive: true });
3148
+ mkdirSync3(dirname10(path), { recursive: true });
2452
3149
  const body = JSON.stringify(state, null, 2) + "\n";
2453
3150
  const tmp = `${path}.tmp`;
2454
3151
  writeFileSync3(tmp, body, { mode: 384 });
2455
3152
  renameSync2(tmp, path);
2456
3153
  }
2457
3154
  async function sha256OfFile(path) {
2458
- const buf = await readFile9(path);
3155
+ const buf = await readFile10(path);
2459
3156
  return createHash3("sha256").update(buf).digest("hex");
2460
3157
  }
2461
3158
  async function computeContextSha256(files) {
@@ -2537,11 +3234,11 @@ import { fileURLToPath as fileURLToPath2 } from "url";
2537
3234
  import { execa as execa7 } from "execa";
2538
3235
  import { existsSync as existsSync5 } from "fs";
2539
3236
  import { fileURLToPath } from "url";
2540
- import { dirname as dirname9, resolve as resolve3 } from "path";
3237
+ import { dirname as dirname11, resolve as resolve3 } from "path";
2541
3238
  var DEFAULT_BOX_IMAGE = "agentbox/box:dev";
2542
3239
  async function resolveClaudeInstallMode() {
2543
3240
  try {
2544
- const { loadEffectiveConfig } = await import("./dist-2BTJQUJS.js");
3241
+ const { loadEffectiveConfig } = await import("./dist-T5MXBZGP.js");
2545
3242
  const cfg = await loadEffectiveConfig(process.cwd());
2546
3243
  return cfg.effective.box.claudeInstall;
2547
3244
  } catch {
@@ -2552,7 +3249,7 @@ var BOX_IMAGE_REGISTRY = "ghcr.io/madarco/agentbox/box";
2552
3249
  function registryRefForSha(sha, registry = BOX_IMAGE_REGISTRY) {
2553
3250
  return `${registry}:sha-${sha.slice(0, 16)}`;
2554
3251
  }
2555
- var here = dirname9(fileURLToPath(import.meta.url));
3252
+ var here = dirname11(fileURLToPath(import.meta.url));
2556
3253
  function resolveDockerBuild() {
2557
3254
  const override = process.env.AGENTBOX_DOCKER_CONTEXT;
2558
3255
  if (override && existsSync5(resolve3(override, "Dockerfile.box"))) {
@@ -2655,7 +3352,7 @@ async function buildImage(opts = {}) {
2655
3352
  return ref;
2656
3353
  }
2657
3354
  async function pullOrBuild(ref, fingerprint, opts = {}) {
2658
- const { writePreparedDockerState: writePreparedDockerState2 } = await import("./prepared-state-BUO75YLZ-PW64VQMT.js");
3355
+ const { writePreparedDockerState: writePreparedDockerState2 } = await import("./prepared-state-BUO75YLZ-RQRFFBJW.js");
2659
3356
  const registry = opts.registry ?? BOX_IMAGE_REGISTRY;
2660
3357
  const allowPull = opts.allowPull !== false;
2661
3358
  if (allowPull && registry && fingerprint) {
@@ -2682,7 +3379,7 @@ async function pullOrBuild(ref, fingerprint, opts = {}) {
2682
3379
  return { source: "built" };
2683
3380
  }
2684
3381
  async function ensureImage(ref = DEFAULT_BOX_IMAGE, opts = {}) {
2685
- const { computeDockerContextFingerprint: computeDockerContextFingerprint2, readPreparedDockerState: readPreparedDockerState2, preparedMatches: preparedMatches2 } = await import("./prepared-state-BUO75YLZ-PW64VQMT.js");
3382
+ const { computeDockerContextFingerprint: computeDockerContextFingerprint2, readPreparedDockerState: readPreparedDockerState2, preparedMatches: preparedMatches2 } = await import("./prepared-state-BUO75YLZ-RQRFFBJW.js");
2686
3383
  const claudeInstall = opts.claudeInstall ?? await resolveClaudeInstallMode();
2687
3384
  const rawFingerprint = await computeDockerContextFingerprint2({
2688
3385
  contextDir: opts.contextDir
@@ -2732,7 +3429,7 @@ function classifyDockerBaseFreshness(input) {
2732
3429
  return { state: "fresh" };
2733
3430
  }
2734
3431
  async function evaluateDockerBaseFreshness(opts = {}) {
2735
- const { computeDockerContextFingerprint: computeDockerContextFingerprint2, readPreparedDockerState: readPreparedDockerState2 } = await import("./prepared-state-BUO75YLZ-PW64VQMT.js");
3432
+ const { computeDockerContextFingerprint: computeDockerContextFingerprint2, readPreparedDockerState: readPreparedDockerState2 } = await import("./prepared-state-BUO75YLZ-RQRFFBJW.js");
2736
3433
  const ref = opts.ref ?? DEFAULT_BOX_IMAGE;
2737
3434
  const imagePresent = await imageExists(ref);
2738
3435
  if (!imagePresent) return { state: "unprepared" };
@@ -2832,6 +3529,9 @@ export {
2832
3529
  ensureCloudSshAlias,
2833
3530
  autoWriteSshConfig,
2834
3531
  mintSshKey,
3532
+ parseInboundSpec,
3533
+ resolveInboundSources,
3534
+ describeInbound,
2835
3535
  scratchBranchName,
2836
3536
  boxGitCheckout,
2837
3537
  boxGitNewBranch,
@@ -2852,6 +3552,29 @@ export {
2852
3552
  pluginProviderNames,
2853
3553
  pluginForProvider,
2854
3554
  renderCarryEntries,
3555
+ AGENT_SYNC_SPECS,
3556
+ resolveAgentSpec,
3557
+ referencedPluginVersionKeys,
3558
+ claudeInventoryScript,
3559
+ parseClaudeInventory,
3560
+ computeClaudePullPlan,
3561
+ writeClaudeMergedRegistries,
3562
+ pullClaudeExtrasViaTransport,
3563
+ CODEX_PULL_ITEMS,
3564
+ OPENCODE_PULL_DATA_ITEMS,
3565
+ OPENCODE_PULL_CONFIG_ITEMS,
3566
+ pullCodexConfigViaTransport,
3567
+ pullOpencodeConfigViaTransport,
3568
+ agentBoxConfigDir,
3569
+ claudeStagedItems,
3570
+ codexStagedItems,
3571
+ opencodeStagedItems,
3572
+ stageItemsViaTransport,
3573
+ makeStagingDir,
3574
+ removeStagingDir,
3575
+ transportSettingsTarget,
3576
+ propagateStagedSettings,
3577
+ planPropagateTargets,
2855
3578
  makeSyncContext,
2856
3579
  DEFAULT_ENV_PATTERNS,
2857
3580
  ENV_PRUNE_DIRS,
@@ -2871,6 +3594,10 @@ export {
2871
3594
  hostClaudeBackupExpired,
2872
3595
  hostBackupHasCredentials,
2873
3596
  extractCredentials,
3597
+ shouldAcceptCredentialUpdate,
3598
+ writeCredentialBackup,
3599
+ readCredentialBackup,
3600
+ pushCredentialToBox,
2874
3601
  resyncWorkspace,
2875
3602
  makeHostGitPorts,
2876
3603
  BOX_WORKFLOWS_DIR,
@@ -2885,6 +3612,7 @@ export {
2885
3612
  setInstallMethodNative,
2886
3613
  MINIMAL_TRUSTED_CODEX_CONFIG,
2887
3614
  sanitizeCodexConfigForBox,
3615
+ mergeCodexConfigForBox,
2888
3616
  stageClaudeJsonOnlyForUpload,
2889
3617
  stageClaudeStaticForUpload,
2890
3618
  stageClaudeCredentialsForUpload,
@@ -2922,4 +3650,4 @@ export {
2922
3650
  writePreparedDockerState,
2923
3651
  preparedMatches
2924
3652
  };
2925
- //# sourceMappingURL=chunk-JYEZ6Q5M.js.map
3653
+ //# sourceMappingURL=chunk-DEDTPG2D.js.map