@madarco/agentbox 0.22.2 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (179) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/dist/{_cloud-attach-Y5WZ7F53.js → _cloud-attach-RFPLNACE.js} +4 -4
  3. package/dist/{chunk-BMCT3LBE.js → chunk-6OQENOJZ.js} +8 -8
  4. package/dist/{chunk-ES2DDCAC.js → chunk-CKC3CP7Y.js} +284 -154
  5. package/dist/chunk-CKC3CP7Y.js.map +1 -0
  6. package/dist/{chunk-AYNGC4Z5.js → chunk-ERMU7RMK.js} +43 -58
  7. package/dist/{chunk-AYNGC4Z5.js.map → chunk-ERMU7RMK.js.map} +1 -1
  8. package/dist/chunk-G3H2L3O2.js +0 -0
  9. package/dist/{chunk-3KAWXDQ4.js → chunk-JXDSSSXS.js} +3 -3
  10. package/dist/{chunk-S4OWE3UD.js → chunk-L5SOSNQI.js} +3 -3
  11. package/dist/{chunk-V2NCCC2B.js → chunk-Q626V2YX.js} +2 -2
  12. package/dist/{chunk-5DZTXHLQ.js → chunk-QGL734YX.js} +169 -52
  13. package/dist/chunk-QGL734YX.js.map +1 -0
  14. package/dist/chunk-QT3SHMLY.js +0 -0
  15. package/dist/{chunk-7HAGPF4X.js → chunk-QVWGQJV6.js} +2 -2
  16. package/dist/chunk-WJFZJZIM.js +0 -0
  17. package/dist/cloud-poller-SUNA6ZQC-7M5LJHHE.js +0 -0
  18. package/dist/dist-2BTJQUJS.js +0 -0
  19. package/dist/{dist-SJRMFVRV.js → dist-GEHCZJCS.js} +5 -5
  20. package/dist/{dist-AN5NUXA5.js → dist-GJCIKH2C.js} +5 -5
  21. package/dist/{dist-FNAGMTUI.js → dist-JFUUDAI3.js} +17 -3
  22. package/dist/{dist-VOVN64Y2.js → dist-W5476E2U.js} +5 -5
  23. package/dist/{dist-K5GASNBV.js → dist-Z3GSHEFO.js} +7 -6
  24. package/dist/index.js +391 -215
  25. package/dist/index.js.map +1 -1
  26. package/dist/{prepared-state-5FIGV4BE-WPHOEDA6.js → prepared-state-LW2PKTEQ-5YMKG7UN.js} +2 -2
  27. package/package.json +28 -27
  28. package/runtime/_shared/agentbox-checkpoint-cleanup +0 -0
  29. package/runtime/_shared/agentbox-dockerd-start +0 -0
  30. package/runtime/_shared/agentbox-open +0 -0
  31. package/runtime/_shared/agentbox-portless-trust +0 -0
  32. package/runtime/_shared/agentbox-vnc-start +0 -0
  33. package/runtime/_shared/ctl.cjs +3 -1
  34. package/runtime/_shared/gh-shim +0 -0
  35. package/runtime/_shared/git-shim +0 -0
  36. package/runtime/_shared/linear-shim +0 -0
  37. package/runtime/_shared/ntn-shim +0 -0
  38. package/runtime/docker/Dockerfile.box +12 -0
  39. package/runtime/docker/packages/ctl/dist/bin.cjs +3 -1
  40. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-checkpoint-cleanup +0 -0
  41. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-dockerd-start +0 -0
  42. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-open +0 -0
  43. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-portless-trust +0 -0
  44. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-sshd-start +44 -0
  45. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-vnc-start +0 -0
  46. package/runtime/docker/packages/sandbox-docker/scripts/chromium-resolver +0 -0
  47. package/runtime/docker/packages/sandbox-docker/scripts/gh-shim +0 -0
  48. package/runtime/docker/packages/sandbox-docker/scripts/git-shim +0 -0
  49. package/runtime/docker/packages/sandbox-docker/scripts/linear-shim +0 -0
  50. package/runtime/docker/packages/sandbox-docker/scripts/ntn-shim +0 -0
  51. package/runtime/e2b/agentbox-checkpoint-cleanup +0 -0
  52. package/runtime/e2b/agentbox-dockerd-start +0 -0
  53. package/runtime/e2b/agentbox-open +0 -0
  54. package/runtime/e2b/agentbox-vnc-start +0 -0
  55. package/runtime/e2b/ctl.cjs +3 -1
  56. package/runtime/e2b/gh-shim +0 -0
  57. package/runtime/e2b/git-shim +0 -0
  58. package/runtime/e2b/linear-shim +0 -0
  59. package/runtime/e2b/ntn-shim +0 -0
  60. package/runtime/e2b/scripts/build-template.sh +0 -0
  61. package/runtime/hetzner/agentbox-checkpoint-cleanup +0 -0
  62. package/runtime/hetzner/agentbox-dockerd-start +0 -0
  63. package/runtime/hetzner/agentbox-open +0 -0
  64. package/runtime/hetzner/agentbox-portless-trust +0 -0
  65. package/runtime/hetzner/agentbox-vnc-start +0 -0
  66. package/runtime/hetzner/ctl.cjs +3 -1
  67. package/runtime/hetzner/gh-shim +0 -0
  68. package/runtime/hetzner/git-shim +0 -0
  69. package/runtime/hetzner/linear-shim +0 -0
  70. package/runtime/hetzner/ntn-shim +0 -0
  71. package/runtime/hetzner/scripts/install-box.sh +0 -0
  72. package/runtime/hub/apps/hub/.next/BUILD_ID +1 -1
  73. package/runtime/hub/apps/hub/.next/app-path-routes-manifest.json +2 -0
  74. package/runtime/hub/apps/hub/.next/build-manifest.json +3 -3
  75. package/runtime/hub/apps/hub/.next/routes-manifest.json +14 -0
  76. package/runtime/hub/apps/hub/.next/server/app/(auth)/signin/page_client-reference-manifest.js +1 -1
  77. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/open/route/app-paths-manifest.json +3 -0
  78. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/open/route/build-manifest.json +9 -0
  79. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/open/route/server-reference-manifest.json +4 -0
  80. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/open/route.js +9 -0
  81. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/open/route.js.map +5 -0
  82. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/open/route.js.nft.json +1 -0
  83. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/open/route_client-reference-manifest.js +3 -0
  84. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/open-targets/route/app-paths-manifest.json +3 -0
  85. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/open-targets/route/build-manifest.json +9 -0
  86. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/open-targets/route/server-reference-manifest.json +4 -0
  87. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/open-targets/route.js +8 -0
  88. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/open-targets/route.js.map +5 -0
  89. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/open-targets/route.js.nft.json +1 -0
  90. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/open-targets/route_client-reference-manifest.js +3 -0
  91. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page_client-reference-manifest.js +1 -1
  92. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page_client-reference-manifest.js +1 -1
  93. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
  94. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page_client-reference-manifest.js +1 -1
  95. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page_client-reference-manifest.js +1 -1
  96. package/runtime/hub/apps/hub/.next/server/app/_global-error.html +1 -1
  97. package/runtime/hub/apps/hub/.next/server/app/_global-error.rsc +1 -1
  98. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  99. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  100. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  101. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  102. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  103. package/runtime/hub/apps/hub/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  104. package/runtime/hub/apps/hub/.next/server/app-paths-manifest.json +2 -0
  105. package/runtime/hub/apps/hub/.next/server/chunks/0ssw__next-internal_server_app_(dashboard)_api_v1_open-targets_route_actions_1z-vd4m.js +3 -0
  106. package/runtime/hub/apps/hub/.next/server/chunks/1jcg_server_app_(dashboard)_api_v1_boxes_[id]_open_route_actions_1agwl8h.js +3 -0
  107. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0keu6we._.js +1 -1
  108. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0ql4fjo._.js +1 -1
  109. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0vs8fma._.js +1 -1
  110. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0w9ud8u._.js +1 -1
  111. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0yhb0gc._.js +1 -1
  112. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1-0flwc._.js +3 -0
  113. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1a50b07._.js +3 -0
  114. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1bqbkd5._.js +2 -2
  115. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1dn_3i1._.js +1 -1
  116. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1hqla7-._.js +1 -1
  117. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1js2jdv._.js +1 -1
  118. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1nepkp-._.js +1 -1
  119. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1q5bqse._.js +1 -1
  120. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1qa4a0v._.js +2 -2
  121. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1thipug._.js +3 -0
  122. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1v9om6g._.js +1 -1
  123. package/runtime/hub/apps/hub/.next/server/chunks/_06f2faq._.js +1 -1
  124. package/runtime/hub/apps/hub/.next/server/chunks/_0f3molr._.js +3 -0
  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/chunks/ssr/apps_hub_app_(dashboard)_boxes_[id]_page_tsx_1-j_972._.js +1 -1
  128. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_app_(dashboard)_boxes_components_box-table_tsx_0a9pyn_._.js +1 -1
  129. package/runtime/hub/apps/hub/.next/server/functions-config-manifest.json +2 -0
  130. package/runtime/hub/apps/hub/.next/server/middleware-build-manifest.js +3 -3
  131. package/runtime/hub/apps/hub/.next/server/pages/500.html +1 -1
  132. package/runtime/hub/apps/hub/.next/static/chunks/1py5tlz57h7ra.js +1 -0
  133. package/runtime/hub/apps/hub/.next/static/chunks/{3y2c7woqhtx9s.js → 23fswvjrabu89.js} +1 -1
  134. package/runtime/hub/apps/hub/.next/static/chunks/3nedwutnzpdis.css +3 -0
  135. package/runtime/hub/apps/hub/.next/static/chunks/3p86ecqhr_7yy.js +1 -0
  136. package/runtime/hub/apps/hub/.next/static/chunks/3qof5hg87qf5n.js +1 -0
  137. package/runtime/hub/apps/hub/{chunk-673QOHSR.js → chunk-6HD4PARX.js} +9 -9
  138. package/runtime/hub/apps/hub/{chunk-7J6ZFTT4.js → chunk-JQFB2CNA.js} +132 -16
  139. package/runtime/hub/apps/hub/{chunk-5XQ3T3W2.js → chunk-K6RA5GJI.js} +231 -126
  140. package/runtime/hub/apps/hub/{dist-GCALYJN7.js → dist-3HR4RIPE.js} +17 -3
  141. package/runtime/hub/apps/hub/{dist-EI54M5DP.js → dist-7GNKBKFV.js} +29 -42
  142. package/runtime/hub/apps/hub/{dist-MOCUH2OC.js → dist-JWVTVHBT.js} +4 -4
  143. package/runtime/hub/apps/hub/{dist-LYTWBTUL.js → dist-OUNL2TCW.js} +4 -4
  144. package/runtime/hub/apps/hub/{dist-K7WHNDZB.js → dist-TOHA4OA5.js} +4 -4
  145. package/runtime/hub/apps/hub/{prepared-state-5FIGV4BE-D2HJEY2L.js → prepared-state-LW2PKTEQ-7BCXARGA.js} +1 -1
  146. package/runtime/hub/apps/hub/server.js +105 -24
  147. package/runtime/relay/bin.cjs +3 -1
  148. package/runtime/vercel/agentbox-checkpoint-cleanup +0 -0
  149. package/runtime/vercel/agentbox-dockerd-start +0 -0
  150. package/runtime/vercel/agentbox-open +0 -0
  151. package/runtime/vercel/agentbox-vnc-start +0 -0
  152. package/runtime/vercel/ctl.cjs +3 -1
  153. package/runtime/vercel/gh-shim +0 -0
  154. package/runtime/vercel/git-shim +0 -0
  155. package/runtime/vercel/linear-shim +0 -0
  156. package/runtime/vercel/ntn-shim +0 -0
  157. package/runtime/vercel/scripts/provision.sh +0 -0
  158. package/LICENSE +0 -21
  159. package/dist/chunk-5DZTXHLQ.js.map +0 -1
  160. package/dist/chunk-ES2DDCAC.js.map +0 -1
  161. package/runtime/hub/apps/hub/.next/static/chunks/0dx4alyqu7cq1.css +0 -3
  162. package/runtime/hub/apps/hub/.next/static/chunks/332lo0ac7l2wv.js +0 -1
  163. package/runtime/hub/apps/hub/.next/static/chunks/3gdqmzzl34ilu.js +0 -1
  164. package/runtime/hub/apps/hub/.next/static/chunks/44exu5uemf-ev.js +0 -1
  165. /package/dist/{_cloud-attach-Y5WZ7F53.js.map → _cloud-attach-RFPLNACE.js.map} +0 -0
  166. /package/dist/{chunk-BMCT3LBE.js.map → chunk-6OQENOJZ.js.map} +0 -0
  167. /package/dist/{chunk-3KAWXDQ4.js.map → chunk-JXDSSSXS.js.map} +0 -0
  168. /package/dist/{chunk-S4OWE3UD.js.map → chunk-L5SOSNQI.js.map} +0 -0
  169. /package/dist/{chunk-V2NCCC2B.js.map → chunk-Q626V2YX.js.map} +0 -0
  170. /package/dist/{chunk-7HAGPF4X.js.map → chunk-QVWGQJV6.js.map} +0 -0
  171. /package/dist/{dist-SJRMFVRV.js.map → dist-GEHCZJCS.js.map} +0 -0
  172. /package/dist/{dist-AN5NUXA5.js.map → dist-GJCIKH2C.js.map} +0 -0
  173. /package/dist/{dist-FNAGMTUI.js.map → dist-JFUUDAI3.js.map} +0 -0
  174. /package/dist/{dist-K5GASNBV.js.map → dist-W5476E2U.js.map} +0 -0
  175. /package/dist/{dist-VOVN64Y2.js.map → dist-Z3GSHEFO.js.map} +0 -0
  176. /package/dist/{prepared-state-5FIGV4BE-WPHOEDA6.js.map → prepared-state-LW2PKTEQ-5YMKG7UN.js.map} +0 -0
  177. /package/runtime/hub/apps/hub/.next/static/{zT1paOSXMJpAPsZ1dFK2V → 6WtaFwavHBpin3eT7-HjR}/_buildManifest.js +0 -0
  178. /package/runtime/hub/apps/hub/.next/static/{zT1paOSXMJpAPsZ1dFK2V → 6WtaFwavHBpin3eT7-HjR}/_clientMiddlewareManifest.js +0 -0
  179. /package/runtime/hub/apps/hub/.next/static/{zT1paOSXMJpAPsZ1dFK2V → 6WtaFwavHBpin3eT7-HjR}/_ssgManifest.js +0 -0
@@ -275,53 +275,59 @@ import { execa } from "execa";
275
275
  import { readdir, stat as stat2 } from "fs/promises";
276
276
  import { join as join2 } from "path";
277
277
  import { promises as fs } from "fs";
278
+ import { homedir as homedir3 } from "os";
279
+ import { dirname as dirname3, join as join4 } from "path";
280
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
278
281
  import { homedir as homedir2 } from "os";
279
282
  import { dirname as dirname22, join as join3 } from "path";
280
- import { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "fs";
281
- import { homedir as homedir3 } from "os";
282
- import { dirname as dirname3, resolve } from "path";
283
- import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
284
- import { mkdir as mkdir2, open as open2, readFile as readFile2, rename as rename2, rm as rm2, stat as stat3, writeFile as writeFile2 } from "fs/promises";
283
+ import { mkdir as mkdir2, readFile as readFile2 } from "fs/promises";
284
+ import { join as join5, resolve } from "path";
285
+ import { execa as execa2 } from "execa";
286
+ import { chmodSync, existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync2, renameSync, writeFileSync as writeFileSync2 } from "fs";
285
287
  import { homedir as homedir4 } from "os";
286
- import { dirname as dirname4, join as join4 } from "path";
288
+ import { dirname as dirname4, resolve as resolve22 } from "path";
289
+ import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
290
+ import { mkdir as mkdir3, open as open2, readFile as readFile3, rename as rename2, rm as rm2, stat as stat3, writeFile as writeFile2 } from "fs/promises";
291
+ import { homedir as homedir5 } from "os";
292
+ import { dirname as dirname5, join as join6 } from "path";
287
293
  import { setTimeout as delay2 } from "timers/promises";
288
- import { mkdtemp, readFile as readFile3, writeFile as writeFile3 } from "fs/promises";
294
+ import { mkdtemp, readFile as readFile4, writeFile as writeFile3 } from "fs/promises";
289
295
  import { tmpdir } from "os";
290
- import { basename as basename2, join as join5 } from "path";
291
- import { join as join6 } from "path";
292
- import { homedir as homedir5 } from "os";
296
+ import { basename as basename2, join as join7 } from "path";
297
+ import { join as join8 } from "path";
298
+ import { homedir as homedir6 } from "os";
293
299
  import { mkdtemp as mkdtemp2, rm as rm3 } from "fs/promises";
294
300
  import { tmpdir as tmpdir2 } from "os";
295
- import { join as join7 } from "path";
296
- import { execa as execa2 } from "execa";
301
+ import { join as join9 } from "path";
302
+ import { execa as execa3 } from "execa";
297
303
  import { readdir as readdir2, stat as stat4 } from "fs/promises";
298
- import { homedir as homedir6 } from "os";
299
- import { join as join8 } from "path";
304
+ import { homedir as homedir7 } from "os";
305
+ import { join as join10 } from "path";
300
306
  import { readdir as readdir3, realpath as realpath2, stat as stat5 } from "fs/promises";
301
- import { isAbsolute, join as join9, relative } from "path";
307
+ import { isAbsolute, join as join11, relative } from "path";
302
308
  import { stat as stat6 } from "fs/promises";
303
- import { chmod, mkdir as mkdir3, readFile as readFile4, writeFile as writeFile4 } from "fs/promises";
304
- import { dirname as dirname5 } from "path";
309
+ import { chmod, mkdir as mkdir4, readFile as readFile5, writeFile as writeFile4 } from "fs/promises";
310
+ import { dirname as dirname6 } from "path";
305
311
  import { createHash } from "crypto";
306
- import { readFile as readFile5 } from "fs/promises";
307
- import { join as join10 } from "path";
308
- import { execa as execa3 } from "execa";
309
- import { createHash as createHash2 } from "crypto";
310
- import { copyFile, mkdir as mkdir4, mkdtemp as mkdtemp3, readdir as readdir4, readFile as readFile6, rm as rm4, stat as stat7 } from "fs/promises";
311
- import { homedir as homedir7, tmpdir as tmpdir3 } from "os";
312
- import { basename as basename22, dirname as dirname6, join as join11 } from "path";
312
+ import { readFile as readFile6 } from "fs/promises";
313
+ import { join as join12 } from "path";
313
314
  import { execa as execa4 } from "execa";
314
- import { copyFile as copyFile2, mkdtemp as mkdtemp4, readdir as readdir5, readFile as readFile7, rm as rm5, stat as stat8, writeFile as writeFile5 } from "fs/promises";
315
- import { homedir as homedir9, tmpdir as tmpdir4 } from "os";
316
- import { basename as basename3, join as join12, relative as relative2 } from "path";
315
+ 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";
317
319
  import { execa as execa5 } from "execa";
318
- import { homedir as homedir8 } from "os";
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";
323
+ import { execa as execa6 } from "execa";
324
+ import { homedir as homedir9 } from "os";
319
325
  import { parse, stringify } from "smol-toml";
320
326
  import { createHash as createHash3 } from "crypto";
321
- import { existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync3, renameSync as renameSync2, writeFileSync as writeFileSync2 } from "fs";
322
- import { readFile as readFile8 } from "fs/promises";
323
- import { homedir as homedir10 } from "os";
324
- import { dirname as dirname7, resolve as pathResolve } from "path";
327
+ 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";
325
331
  var STATE_DIR = join(homedir(), ".agentbox");
326
332
  var STATE_FILE = join(STATE_DIR, "state.json");
327
333
  var EMPTY = { version: 1, boxes: [] };
@@ -380,6 +386,8 @@ async function readState(path = STATE_FILE) {
380
386
  if ((b.provider ?? "docker") === "docker" && !b.docker) {
381
387
  b.docker = projectDockerFields(b);
382
388
  }
389
+ const legacySsh = b.cloud?.ssh;
390
+ if (!b.ssh && legacySsh) b.ssh = legacySsh;
383
391
  }
384
392
  return parsed;
385
393
  } catch (err) {
@@ -435,9 +443,7 @@ async function recordBoxSsh(boxId, ssh, path = STATE_FILE) {
435
443
  await mutateState(
436
444
  (state) => ({
437
445
  version: 1,
438
- boxes: state.boxes.map(
439
- (b) => b.id === boxId && b.cloud ? { ...b, cloud: { ...b.cloud, ssh } } : b
440
- )
446
+ boxes: state.boxes.map((b) => b.id === boxId ? { ...b, ssh } : b)
441
447
  }),
442
448
  path
443
449
  );
@@ -584,14 +590,83 @@ var GitWorktreeError = class extends Error {
584
590
  function hostOpenCommand() {
585
591
  return process.platform === "linux" ? "xdg-open" : "open";
586
592
  }
593
+ function claudeSettingsPath() {
594
+ return join3(homedir2(), ".claude", "settings.json");
595
+ }
596
+ function claudeSshEntryFor(alias, boxName) {
597
+ return {
598
+ id: `agentbox-${alias}`,
599
+ name: `AgentBox: ${boxName}`,
600
+ sshHost: alias,
601
+ startDirectory: "/workspace"
602
+ };
603
+ }
604
+ function readSettings(path) {
605
+ if (!existsSync(path)) return {};
606
+ let parsed;
607
+ try {
608
+ parsed = JSON.parse(readFileSync(path, "utf8"));
609
+ } catch (err) {
610
+ throw new Error(
611
+ `${path} exists but is not valid JSON (${err instanceof Error ? err.message : String(err)}) \u2014 not touching it. Fix the file and retry.`
612
+ );
613
+ }
614
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
615
+ throw new Error(`${path} is not a JSON object \u2014 not touching it. Fix the file and retry.`);
616
+ }
617
+ return parsed;
618
+ }
619
+ function writeSettings(path, settings) {
620
+ mkdirSync(dirname22(path), { recursive: true });
621
+ writeFileSync(path, JSON.stringify(settings, null, 2) + "\n");
622
+ }
623
+ function entryId(e) {
624
+ if (e !== null && typeof e === "object" && typeof e.id === "string") {
625
+ return e.id;
626
+ }
627
+ return void 0;
628
+ }
629
+ function upsertClaudeSshConfig(entry) {
630
+ const path = claudeSettingsPath();
631
+ const settings = readSettings(path);
632
+ const configs = Array.isArray(settings.sshConfigs) ? settings.sshConfigs : [];
633
+ const idx = configs.findIndex((e) => entryId(e) === entry.id);
634
+ if (idx >= 0) {
635
+ configs[idx] = entry;
636
+ } else {
637
+ configs.push(entry);
638
+ }
639
+ settings.sshConfigs = configs;
640
+ writeSettings(path, settings);
641
+ }
642
+ function pruneOrphanClaudeSshConfigs(liveAliases) {
643
+ return removeClaudeSshConfigs(
644
+ (id) => id.startsWith("agentbox-") && !liveAliases.has(id.slice("agentbox-".length))
645
+ );
646
+ }
647
+ function removeClaudeSshConfigs(predicate) {
648
+ const path = claudeSettingsPath();
649
+ if (!existsSync(path)) return 0;
650
+ const settings = readSettings(path);
651
+ if (!Array.isArray(settings.sshConfigs)) return 0;
652
+ const kept = settings.sshConfigs.filter((e) => {
653
+ const id = entryId(e);
654
+ return id === void 0 || !predicate(id);
655
+ });
656
+ const removed = settings.sshConfigs.length - kept.length;
657
+ if (removed === 0) return 0;
658
+ settings.sshConfigs = kept;
659
+ writeSettings(path, settings);
660
+ return removed;
661
+ }
587
662
  function sshConfigPath() {
588
- return join3(homedir2(), ".ssh", "config");
663
+ return join4(homedir3(), ".ssh", "config");
589
664
  }
590
665
  function agentboxSshConfigPath() {
591
- return join3(homedir2(), ".agentbox", "ssh", "config");
666
+ return join4(homedir3(), ".agentbox", "ssh", "config");
592
667
  }
593
668
  function stateFilePath() {
594
- return join3(homedir2(), ".agentbox", "state.json");
669
+ return join4(homedir3(), ".agentbox", "state.json");
595
670
  }
596
671
  var INCLUDE_BEGIN = "# BEGIN agentbox ssh include";
597
672
  var INCLUDE_END = "# END agentbox ssh include";
@@ -619,6 +694,9 @@ function buildBlock(opts) {
619
694
  ` HostName ${opts.hostname}`,
620
695
  ` User ${opts.user}`
621
696
  ];
697
+ if (opts.port) {
698
+ lines.push(` Port ${String(opts.port)}`);
699
+ }
622
700
  if (opts.identityFile) {
623
701
  lines.push(` IdentityFile ${opts.identityFile}`);
624
702
  lines.push(` IdentitiesOnly yes`);
@@ -641,7 +719,7 @@ function hasIncludeBlock(contents) {
641
719
  }
642
720
  async function ensureSshInclude() {
643
721
  const path = sshConfigPath();
644
- await fs.mkdir(join3(homedir2(), ".ssh"), { recursive: true, mode: 448 });
722
+ await fs.mkdir(join4(homedir3(), ".ssh"), { recursive: true, mode: 448 });
645
723
  const existing = stripLegacyInlineBlocks(await readFileOrEmpty(path));
646
724
  let next = existing;
647
725
  if (!hasIncludeBlock(existing)) {
@@ -659,23 +737,28 @@ async function syncAgentboxSshConfig(statePath = stateFilePath()) {
659
737
  const state = await readState(statePath);
660
738
  const blocks = [];
661
739
  for (const box of state.boxes) {
662
- const ssh = box.cloud?.ssh;
740
+ const ssh = box.ssh;
663
741
  if (!ssh) continue;
664
742
  blocks.push(
665
743
  buildBlock({
666
744
  alias: agentboxAliasFor(box.name),
667
745
  hostname: ssh.host,
668
746
  user: ssh.user,
669
- identityFile: ssh.identityFile
747
+ identityFile: ssh.identityFile,
748
+ port: ssh.port
670
749
  })
671
750
  );
672
751
  }
673
752
  const header = "# Managed by agentbox \u2014 regenerated on box create/start/destroy.\n# Do not edit; changes are overwritten. Disable with `agentbox config set ssh.autoConfig false`.\n\n";
674
753
  const path = agentboxSshConfigPath();
675
- await fs.mkdir(dirname22(path), { recursive: true, mode: 448 });
754
+ await fs.mkdir(dirname3(path), { recursive: true, mode: 448 });
676
755
  await fs.writeFile(path, header + blocks.join("\n"), { mode: 384 });
677
756
  await fs.chmod(path, 384);
678
757
  await ensureSshInclude();
758
+ try {
759
+ pruneOrphanClaudeSshConfigs(new Set(state.boxes.map((b) => agentboxAliasFor(b.name))));
760
+ } catch {
761
+ }
679
762
  }
680
763
  async function hasUnmanagedHostConflict(alias) {
681
764
  const contents = stripLegacyInlineBlocks(await readFileOrEmpty(sshConfigPath()));
@@ -769,6 +852,21 @@ async function autoWriteSshConfig(box, provider, enabled, logWarn) {
769
852
  );
770
853
  }
771
854
  }
855
+ async function mintSshKey(targetDir, comment) {
856
+ const dir = resolve(targetDir);
857
+ const priv = join5(dir, "id_ed25519");
858
+ const pub = `${priv}.pub`;
859
+ await mkdir2(dir, { recursive: true, mode: 448 });
860
+ const existing = await readFile2(pub, "utf8").catch(() => null);
861
+ if (existing !== null) {
862
+ return { dir, privatePath: priv, publicPath: pub, publicKey: existing.trim() };
863
+ }
864
+ await execa2("ssh-keygen", ["-t", "ed25519", "-N", "", "-C", comment, "-f", priv, "-q"], {
865
+ stdio: "pipe"
866
+ });
867
+ const publicKey = (await readFile2(pub, "utf8")).trim();
868
+ return { dir, privatePath: priv, publicPath: pub, publicKey };
869
+ }
772
870
  var BOX_WORKSPACE = "/workspace";
773
871
  function run(provider, box, argv) {
774
872
  return provider.exec(box, argv, { cwd: BOX_WORKSPACE });
@@ -844,17 +942,17 @@ function errSummary(err) {
844
942
  return err instanceof Error ? firstLine(err.message) : String(err);
845
943
  }
846
944
  function secretsEnvPath() {
847
- return resolve(homedir3(), ".agentbox", "secrets.env");
945
+ return resolve22(homedir4(), ".agentbox", "secrets.env");
848
946
  }
849
947
  function writeManagedSecrets(managedKeys, record) {
850
948
  for (const k of managedKeys) delete process.env[k];
851
949
  for (const [k, v] of Object.entries(record)) process.env[k] = v;
852
950
  const path = secretsEnvPath();
853
- mkdirSync(dirname3(path), { recursive: true });
951
+ mkdirSync2(dirname4(path), { recursive: true });
854
952
  let existing = "";
855
- if (existsSync(path)) {
953
+ if (existsSync2(path)) {
856
954
  try {
857
- existing = readFileSync(path, "utf8");
955
+ existing = readFileSync2(path, "utf8");
858
956
  } catch {
859
957
  existing = "";
860
958
  }
@@ -870,7 +968,7 @@ function writeManagedSecrets(managedKeys, record) {
870
968
  const body = (kept ? `${kept}
871
969
  ` : "") + lines.join("\n") + "\n";
872
970
  const tmp = `${path}.tmp`;
873
- writeFileSync(tmp, body, { mode: 384 });
971
+ writeFileSync2(tmp, body, { mode: 384 });
874
972
  try {
875
973
  chmodSync(tmp, 384);
876
974
  } catch {
@@ -881,8 +979,8 @@ function writeManagedSecrets(managedKeys, record) {
881
979
  } catch {
882
980
  }
883
981
  }
884
- var PLUGINS_FILE = join4(homedir4(), ".agentbox", "plugins.json");
885
- var SUPPORTED_SDK_API_VERSIONS = [1];
982
+ var PLUGINS_FILE = join6(homedir5(), ".agentbox", "plugins.json");
983
+ var SUPPORTED_SDK_API_VERSIONS = [1, 2];
886
984
  function isSupportedApiVersion(v) {
887
985
  return SUPPORTED_SDK_API_VERSIONS.includes(v);
888
986
  }
@@ -892,7 +990,7 @@ var LOCK_ACQUIRE_TIMEOUT_MS2 = 2e4;
892
990
  var LOCK_RETRY_MS2 = 25;
893
991
  async function withFileLock(path, fn) {
894
992
  const lockPath = `${path}.lock`;
895
- await mkdir2(dirname4(path), { recursive: true });
993
+ await mkdir3(dirname5(path), { recursive: true });
896
994
  const deadline = Date.now() + LOCK_ACQUIRE_TIMEOUT_MS2;
897
995
  let held = false;
898
996
  while (!held) {
@@ -933,8 +1031,8 @@ function normalize2(raw) {
933
1031
  }
934
1032
  function readPluginRegistrySync(path = PLUGINS_FILE) {
935
1033
  try {
936
- if (!existsSync2(path)) return { ...EMPTY2 };
937
- return normalize2(JSON.parse(readFileSync2(path, "utf8")));
1034
+ if (!existsSync3(path)) return { ...EMPTY2 };
1035
+ return normalize2(JSON.parse(readFileSync3(path, "utf8")));
938
1036
  } catch {
939
1037
  return { ...EMPTY2 };
940
1038
  }
@@ -942,7 +1040,7 @@ function readPluginRegistrySync(path = PLUGINS_FILE) {
942
1040
  async function readForWrite(path) {
943
1041
  let raw;
944
1042
  try {
945
- raw = await readFile2(path, "utf8");
1043
+ raw = await readFile3(path, "utf8");
946
1044
  } catch (err) {
947
1045
  if (err.code === "ENOENT") return { ...EMPTY2 };
948
1046
  throw err;
@@ -964,7 +1062,7 @@ async function readForWrite(path) {
964
1062
  return p;
965
1063
  }
966
1064
  async function writeRegistry(file, path = PLUGINS_FILE) {
967
- await mkdir2(dirname4(path), { recursive: true });
1065
+ await mkdir3(dirname5(path), { recursive: true });
968
1066
  const tmp = `${path}.tmp.${String(process.pid)}.${String(Date.now())}`;
969
1067
  await writeFile2(tmp, JSON.stringify(file, null, 2) + "\n", "utf8");
970
1068
  await rename2(tmp, path);
@@ -1011,21 +1109,21 @@ function wantsRender(e) {
1011
1109
  async function renderCarryEntries(entries, ctx, onLog) {
1012
1110
  if (!entries.some(wantsRender)) return entries;
1013
1111
  const context = carryPlaceholderContext(ctx);
1014
- const stage = await mkdtemp(join5(tmpdir(), "agentbox-carry-render-"));
1112
+ const stage = await mkdtemp(join7(tmpdir(), "agentbox-carry-render-"));
1015
1113
  const out = [];
1016
1114
  for (const [i, entry] of entries.entries()) {
1017
1115
  if (!wantsRender(entry)) {
1018
1116
  out.push(entry);
1019
1117
  continue;
1020
1118
  }
1021
- const content = await readFile3(entry.absSrc, "utf8");
1119
+ const content = await readFile4(entry.absSrc, "utf8");
1022
1120
  const rendered = applyReplacements(content, {
1023
1121
  env: entry.replaceEnvs,
1024
1122
  rules: entry.replace,
1025
1123
  context,
1026
1124
  onWarn: (msg) => onLog?.(`carry: ${entry.rawSrc}: ${msg}`)
1027
1125
  });
1028
- const tmp = join5(stage, `${String(i)}-${basename2(entry.absSrc)}`);
1126
+ const tmp = join7(stage, `${String(i)}-${basename2(entry.absSrc)}`);
1029
1127
  await writeFile3(tmp, rendered, "utf8");
1030
1128
  out.push({ ...entry, absSrc: tmp, bytes: Buffer.byteLength(rendered) });
1031
1129
  const what = [
@@ -1081,7 +1179,7 @@ var AGENT_SYNC_SPECS = [
1081
1179
  credential: {
1082
1180
  boxRelPath: ".credentials.json",
1083
1181
  boxAbsPath: `${CLAUDE_BOX_DIR}/.credentials.json`,
1084
- hostBackup: join6(STATE_DIR, "claude-credentials.json"),
1182
+ hostBackup: join8(STATE_DIR, "claude-credentials.json"),
1085
1183
  cloudMountPath: "/home/vscode/.agentbox-creds/claude",
1086
1184
  cloudSubpath: "claude/",
1087
1185
  realShape: "claude-oauth"
@@ -1141,7 +1239,7 @@ var AGENT_SYNC_SPECS = [
1141
1239
  credential: {
1142
1240
  boxRelPath: "auth.json",
1143
1241
  boxAbsPath: `${CODEX_BOX_DIR}/auth.json`,
1144
- hostBackup: join6(STATE_DIR, "codex-credentials.json"),
1242
+ hostBackup: join8(STATE_DIR, "codex-credentials.json"),
1145
1243
  cloudMountPath: "/home/vscode/.agentbox-creds/codex",
1146
1244
  cloudSubpath: "codex/",
1147
1245
  realShape: "nonempty-json"
@@ -1192,7 +1290,7 @@ var AGENT_SYNC_SPECS = [
1192
1290
  credential: {
1193
1291
  boxRelPath: "auth.json",
1194
1292
  boxAbsPath: `${OPENCODE_BOX_DIR}/auth.json`,
1195
- hostBackup: join6(STATE_DIR, "opencode-credentials.json"),
1293
+ hostBackup: join8(STATE_DIR, "opencode-credentials.json"),
1196
1294
  cloudMountPath: "/home/vscode/.agentbox-creds/opencode",
1197
1295
  cloudSubpath: "opencode/",
1198
1296
  realShape: "nonempty-json"
@@ -1226,7 +1324,7 @@ function makeSyncContext(init) {
1226
1324
  hostWorkspace: init.hostWorkspace,
1227
1325
  projectRoot: init.projectRoot ?? init.hostWorkspace,
1228
1326
  boxWorkspace: init.boxWorkspace ?? "/workspace",
1229
- hostHome: init.hostHome ?? homedir5(),
1327
+ hostHome: init.hostHome ?? homedir6(),
1230
1328
  onLog: init.onLog ?? (() => {
1231
1329
  })
1232
1330
  };
@@ -1284,7 +1382,7 @@ function buildHostEnvFindArgs(patterns) {
1284
1382
  }
1285
1383
  async function findEnvFilesForTar(workspaceDir, patterns) {
1286
1384
  if (patterns.length === 0) return [];
1287
- const found = await execa2("find", buildHostEnvFindArgs(patterns).slice(1), {
1385
+ const found = await execa3("find", buildHostEnvFindArgs(patterns).slice(1), {
1288
1386
  cwd: workspaceDir,
1289
1387
  reject: false
1290
1388
  });
@@ -1298,10 +1396,10 @@ async function scanHostEnvFiles(workspaceDir, patterns) {
1298
1396
  async function pushEnvFiles(ctx, transport, patterns) {
1299
1397
  const list = await findEnvFilesForTar(ctx.hostWorkspace, patterns);
1300
1398
  if (list.length === 0) return { copied: 0 };
1301
- const stage = await mkdtemp2(join7(tmpdir2(), "agentbox-envfiles-"));
1302
- const localTar = join7(stage, "envfiles.tar");
1399
+ const stage = await mkdtemp2(join9(tmpdir2(), "agentbox-envfiles-"));
1400
+ const localTar = join9(stage, "envfiles.tar");
1303
1401
  try {
1304
- const packed = await execa2(
1402
+ const packed = await execa3(
1305
1403
  "tar",
1306
1404
  ["-C", ctx.hostWorkspace, "--null", "-T", "-", "-cf", localTar],
1307
1405
  { input: list.join("\0"), reject: false }
@@ -1371,9 +1469,9 @@ function encodeClaudeProjectsKey(absPath) {
1371
1469
  return absPath.replace(/[^a-zA-Z0-9]/g, "-");
1372
1470
  }
1373
1471
  var BOX_CLAUDE_PROJECT_DIR = "/home/vscode/.claude/projects/-workspace";
1374
- async function resolveClaudeMemoryDir(hostWorkspace, hostHome = homedir6()) {
1472
+ async function resolveClaudeMemoryDir(hostWorkspace, hostHome = homedir7()) {
1375
1473
  if (hostWorkspace.length === 0) return null;
1376
- const memDir = join8(
1474
+ const memDir = join10(
1377
1475
  hostHome,
1378
1476
  ".claude",
1379
1477
  "projects",
@@ -1416,8 +1514,8 @@ async function findUnsyncableSymlinks(root, reachableRoots) {
1416
1514
  return;
1417
1515
  }
1418
1516
  for (const ent of entries) {
1419
- const realFull = join9(realDir, ent.name);
1420
- const virtualFull = virtualDir ? join9(virtualDir, ent.name) : ent.name;
1517
+ const realFull = join11(realDir, ent.name);
1518
+ const virtualFull = virtualDir ? join11(virtualDir, ent.name) : ent.name;
1421
1519
  if (ent.isSymbolicLink()) {
1422
1520
  let real;
1423
1521
  try {
@@ -1495,7 +1593,7 @@ function isRealAgentCredential(agent, text) {
1495
1593
  }
1496
1594
  async function hostClaudeBackupExpired(path = CLAUDE_HOST_BACKUP, now = Date.now()) {
1497
1595
  try {
1498
- const parsed = JSON.parse(await readFile4(path, "utf8"));
1596
+ const parsed = JSON.parse(await readFile5(path, "utf8"));
1499
1597
  const exp = parsed?.claudeAiOauth?.expiresAt;
1500
1598
  return typeof exp === "number" && Number.isFinite(exp) && exp < now;
1501
1599
  } catch {
@@ -1504,7 +1602,7 @@ async function hostClaudeBackupExpired(path = CLAUDE_HOST_BACKUP, now = Date.now
1504
1602
  }
1505
1603
  async function hostBackupHasCredentials(path = CLAUDE_HOST_BACKUP) {
1506
1604
  try {
1507
- const parsed = JSON.parse(await readFile4(path, "utf8"));
1605
+ const parsed = JSON.parse(await readFile5(path, "utf8"));
1508
1606
  const rt = parsed?.claudeAiOauth?.refreshToken;
1509
1607
  return typeof rt === "string" && rt.length > 0;
1510
1608
  } catch {
@@ -1520,7 +1618,7 @@ async function extractCredentials(transport, opts = {}) {
1520
1618
  try {
1521
1619
  const text = await transport.readText(spec.credential.boxAbsPath);
1522
1620
  if (!text || !isRealAgentCredential(spec.id, text)) continue;
1523
- await mkdir3(dirname5(hostBackup), { recursive: true });
1621
+ await mkdir4(dirname6(hostBackup), { recursive: true });
1524
1622
  await writeFile4(hostBackup, text, { mode: 384 });
1525
1623
  await chmod(hostBackup, 384).catch(() => {
1526
1624
  });
@@ -1661,20 +1759,20 @@ async function resyncWorkspace(worktrees, ports, onLog) {
1661
1759
  function makeHostGitPorts() {
1662
1760
  return {
1663
1761
  async resolveHostRef(hostMain) {
1664
- const hostBranchProbe = await execa3(
1762
+ const hostBranchProbe = await execa4(
1665
1763
  "git",
1666
1764
  ["-C", hostMain, "symbolic-ref", "--short", "-q", "HEAD"],
1667
1765
  { reject: false }
1668
1766
  );
1669
- const hostRef = hostBranchProbe.exitCode === 0 && hostBranchProbe.stdout.trim() ? hostBranchProbe.stdout.trim() : (await execa3("git", ["-C", hostMain, "rev-parse", "HEAD"], { reject: false })).stdout.trim();
1767
+ const hostRef = hostBranchProbe.exitCode === 0 && hostBranchProbe.stdout.trim() ? hostBranchProbe.stdout.trim() : (await execa4("git", ["-C", hostMain, "rev-parse", "HEAD"], { reject: false })).stdout.trim();
1670
1768
  return hostRef || null;
1671
1769
  },
1672
1770
  async createHostStash(hostMain) {
1673
- const stash = await execa3("git", ["-C", hostMain, "stash", "create"], { reject: false });
1771
+ const stash = await execa4("git", ["-C", hostMain, "stash", "create"], { reject: false });
1674
1772
  return stash.exitCode === 0 ? stash.stdout.trim() || null : null;
1675
1773
  },
1676
1774
  async listHostUntracked(hostMain) {
1677
- const untracked = await execa3(
1775
+ const untracked = await execa4(
1678
1776
  "git",
1679
1777
  ["-C", hostMain, "ls-files", "--others", "--exclude-standard", "-z"],
1680
1778
  { reject: false }
@@ -1682,10 +1780,10 @@ function makeHostGitPorts() {
1682
1780
  return untracked.exitCode === 0 ? splitNul(untracked.stdout) : [];
1683
1781
  },
1684
1782
  async hashHostFile(hostMain, relPath) {
1685
- return createHash("sha256").update(await readFile5(join10(hostMain, relPath))).digest("hex");
1783
+ return createHash("sha256").update(await readFile6(join12(hostMain, relPath))).digest("hex");
1686
1784
  },
1687
1785
  async packHostFiles(hostMain, relPaths) {
1688
- const tarOut = await execa3("tar", ["-C", hostMain, "--null", "-T", "-", "-cf", "-"], {
1786
+ const tarOut = await execa4("tar", ["-C", hostMain, "--null", "-T", "-", "-cf", "-"], {
1689
1787
  input: relPaths.join("\0"),
1690
1788
  encoding: "buffer",
1691
1789
  reject: false
@@ -1715,7 +1813,7 @@ async function walkFiles(root, prefix = "") {
1715
1813
  const out = [];
1716
1814
  for (const ent of entries) {
1717
1815
  const rel = prefix ? `${prefix}/${ent.name}` : ent.name;
1718
- const full = join11(root, ent.name);
1816
+ const full = join13(root, ent.name);
1719
1817
  if (ent.isDirectory()) {
1720
1818
  out.push(...await walkFiles(full, rel));
1721
1819
  } else if (ent.isFile()) {
@@ -1731,7 +1829,7 @@ async function walkFiles(root, prefix = "") {
1731
1829
  return out;
1732
1830
  }
1733
1831
  async function hashFile(absPath) {
1734
- const buf = await readFile6(absPath);
1832
+ const buf = await readFile7(absPath);
1735
1833
  return createHash2("sha256").update(buf).digest("hex");
1736
1834
  }
1737
1835
  async function buildHostSet(name, hostDir, boxDst) {
@@ -1739,12 +1837,12 @@ async function buildHostSet(name, hostDir, boxDst) {
1739
1837
  const rels = await walkFiles(hostDir);
1740
1838
  const files = {};
1741
1839
  for (const rel of rels) {
1742
- files[rel] = await hashFile(join11(hostDir, rel));
1840
+ files[rel] = await hashFile(join13(hostDir, rel));
1743
1841
  }
1744
1842
  return { dst: boxDst, files, hostDir };
1745
1843
  }
1746
- async function buildHostSyncManifest(workspacePath, hostHome = homedir7()) {
1747
- const workflowsDir = join11(hostHome, ".claude", "workflows");
1844
+ async function buildHostSyncManifest(workspacePath, hostHome = homedir8()) {
1845
+ const workflowsDir = join13(hostHome, ".claude", "workflows");
1748
1846
  const workflowsHost = await pathExists3(workflowsDir) ? workflowsDir : null;
1749
1847
  const memoryHost = await resolveClaudeMemoryDir(workspacePath, hostHome);
1750
1848
  const [workflows, memory] = await Promise.all([
@@ -1766,7 +1864,7 @@ function computeSyncDelta(host, box) {
1766
1864
  uploads.push({
1767
1865
  set: name,
1768
1866
  rel,
1769
- absSrc: join11(hostSet.hostDir, rel),
1867
+ absSrc: join13(hostSet.hostDir, rel),
1770
1868
  dst: `${hostSet.dst}/${rel}`
1771
1869
  });
1772
1870
  }
@@ -1785,16 +1883,16 @@ async function stageDynamicSyncTarball(uploads) {
1785
1883
  return { tarballPath: null, cleanup: async () => {
1786
1884
  } };
1787
1885
  }
1788
- const stageDir = await mkdtemp3(join11(tmpdir3(), "agentbox-dynsync-stage-"));
1886
+ const stageDir = await mkdtemp3(join13(tmpdir3(), "agentbox-dynsync-stage-"));
1789
1887
  let tarballPath = null;
1790
1888
  try {
1791
1889
  for (const up of uploads) {
1792
- const target = join11(stageDir, up.set, up.rel);
1793
- await mkdir4(dirname6(target), { recursive: true });
1890
+ const target = join13(stageDir, up.set, up.rel);
1891
+ await mkdir5(dirname7(target), { recursive: true });
1794
1892
  await copyFile(up.absSrc, target);
1795
1893
  }
1796
- tarballPath = join11(tmpdir3(), `agentbox-dynsync-${basename22(stageDir)}.tar.gz`);
1797
- await execa4("tar", ["-czf", tarballPath, "-C", stageDir, "."], {
1894
+ tarballPath = join13(tmpdir3(), `agentbox-dynsync-${basename22(stageDir)}.tar.gz`);
1895
+ await execa5("tar", ["-czf", tarballPath, "-C", stageDir, "."], {
1798
1896
  env: { ...process.env, COPYFILE_DISABLE: "1" }
1799
1897
  });
1800
1898
  const tp = tarballPath;
@@ -1927,7 +2025,7 @@ var BOX_WORKSPACE2 = "/workspace";
1927
2025
  var MINIMAL_TRUSTED_CODEX_CONFIG = `[projects."${BOX_WORKSPACE2}"]
1928
2026
  trust_level = "trusted"
1929
2027
  `;
1930
- function sanitizeCodexConfigForBox(tomlText, hostHome = homedir8()) {
2028
+ function sanitizeCodexConfigForBox(tomlText, hostHome = homedir9()) {
1931
2029
  const cfg = parse(tomlText);
1932
2030
  let changed = false;
1933
2031
  if (isRecord(cfg["mcp_servers"])) {
@@ -1995,7 +2093,7 @@ async function findBrokenSymlinks(root) {
1995
2093
  return;
1996
2094
  }
1997
2095
  for (const ent of entries) {
1998
- const full = join12(dir, ent.name);
2096
+ const full = join14(dir, ent.name);
1999
2097
  if (ent.isSymbolicLink()) {
2000
2098
  try {
2001
2099
  await stat8(full);
@@ -2011,15 +2109,15 @@ async function findBrokenSymlinks(root) {
2011
2109
  return broken;
2012
2110
  }
2013
2111
  async function mkStageDir(prefix) {
2014
- return mkdtemp4(join12(tmpdir4(), `agentbox-${prefix}-stage-`));
2112
+ return mkdtemp4(join14(tmpdir4(), `agentbox-${prefix}-stage-`));
2015
2113
  }
2016
2114
  function emptyResult(warnings = []) {
2017
2115
  return { tarballPath: null, cleanup: async () => {
2018
2116
  }, warnings };
2019
2117
  }
2020
2118
  async function tarballFromDir(stageDir, agent) {
2021
- const tarballPath = join12(tmpdir4(), `agentbox-${agent}-${basename3(stageDir)}.tar.gz`);
2022
- await execa5("tar", ["-czf", tarballPath, "-C", stageDir, "."], {
2119
+ const tarballPath = join14(tmpdir4(), `agentbox-${agent}-${basename3(stageDir)}.tar.gz`);
2120
+ await execa6("tar", ["-czf", tarballPath, "-C", stageDir, "."], {
2023
2121
  env: { ...process.env, COPYFILE_DISABLE: "1" }
2024
2122
  });
2025
2123
  return tarballPath;
@@ -2035,7 +2133,7 @@ async function stageSingleFileTarball(agent, sourcePath, tarballEntryName) {
2035
2133
  const stageDir = await mkStageDir(agent);
2036
2134
  let tarballPath = null;
2037
2135
  try {
2038
- await copyFile2(sourcePath, join12(stageDir, tarballEntryName));
2136
+ await copyFile2(sourcePath, join14(stageDir, tarballEntryName));
2039
2137
  tarballPath = await tarballFromDir(stageDir, agent);
2040
2138
  return {
2041
2139
  tarballPath,
@@ -2051,11 +2149,11 @@ async function stageSingleFileTarball(agent, sourcePath, tarballEntryName) {
2051
2149
  var CLAUDE_STATIC_EXCLUDES = resolveAgentSpec("claude").staticPaths[0]?.exclude ?? [];
2052
2150
  async function buildBoxClaudeJsonFromHost(opts) {
2053
2151
  const { hostHome, hostWorkspace } = opts;
2054
- const hostClaudeJson = join12(hostHome, ".claude.json");
2152
+ const hostClaudeJson = join14(hostHome, ".claude.json");
2055
2153
  let working;
2056
2154
  if (await pathExists4(hostClaudeJson)) {
2057
2155
  try {
2058
- working = JSON.parse(await readFile7(hostClaudeJson, "utf8"));
2156
+ working = JSON.parse(await readFile8(hostClaudeJson, "utf8"));
2059
2157
  } catch {
2060
2158
  working = null;
2061
2159
  }
@@ -2086,7 +2184,7 @@ async function buildBoxClaudeJsonFromHost(opts) {
2086
2184
  return working;
2087
2185
  }
2088
2186
  async function stageClaudeJsonOnlyForUpload(opts = {}) {
2089
- const hostHome = opts.hostHome ?? homedir9();
2187
+ const hostHome = opts.hostHome ?? homedir10();
2090
2188
  const stageDir = await mkStageDir("claude-json-only");
2091
2189
  let tarballPath = null;
2092
2190
  try {
@@ -2094,7 +2192,7 @@ async function stageClaudeJsonOnlyForUpload(opts = {}) {
2094
2192
  hostHome,
2095
2193
  hostWorkspace: opts.hostWorkspace
2096
2194
  });
2097
- await writeFile5(join12(stageDir, "_claude.json"), JSON.stringify(claudeJson, null, 2));
2195
+ await writeFile5(join14(stageDir, "_claude.json"), JSON.stringify(claudeJson, null, 2));
2098
2196
  tarballPath = await tarballFromDir(stageDir, "claude-json-only");
2099
2197
  return {
2100
2198
  tarballPath,
@@ -2108,8 +2206,8 @@ async function stageClaudeJsonOnlyForUpload(opts = {}) {
2108
2206
  }
2109
2207
  }
2110
2208
  async function stageClaudeStaticForUpload(opts = {}) {
2111
- const hostHome = opts.hostHome ?? homedir9();
2112
- const hostClaude = join12(hostHome, ".claude");
2209
+ const hostHome = opts.hostHome ?? homedir10();
2210
+ const hostClaude = join14(hostHome, ".claude");
2113
2211
  if (!await pathExists4(hostClaude)) return emptyResult();
2114
2212
  const stageDir = await mkStageDir("claude-static");
2115
2213
  let tarballPath = null;
@@ -2119,17 +2217,17 @@ async function stageClaudeStaticForUpload(opts = {}) {
2119
2217
  ...CLAUDE_STATIC_EXCLUDES.map((p) => `--exclude=${p}`),
2120
2218
  ...broken.map((r) => `--exclude=/${r}`)
2121
2219
  ];
2122
- await execa5("rsync", [
2220
+ await execa6("rsync", [
2123
2221
  "-a",
2124
2222
  "--copy-unsafe-links",
2125
2223
  ...excludes,
2126
2224
  `${hostClaude}/`,
2127
2225
  `${stageDir}/`
2128
2226
  ]);
2129
- const settingsPath = join12(stageDir, "settings.json");
2227
+ const settingsPath = join14(stageDir, "settings.json");
2130
2228
  if (await pathExists4(settingsPath)) {
2131
2229
  try {
2132
- const parsed = JSON.parse(await readFile7(settingsPath, "utf8"));
2230
+ const parsed = JSON.parse(await readFile8(settingsPath, "utf8"));
2133
2231
  const filtered = filterHostHooks(parsed, hostHome);
2134
2232
  if (filtered.removedCommands.length > 0) {
2135
2233
  await writeFile5(settingsPath, JSON.stringify(filtered.data, null, 2));
@@ -2141,15 +2239,15 @@ async function stageClaudeStaticForUpload(opts = {}) {
2141
2239
  hostHome,
2142
2240
  hostWorkspace: opts.hostWorkspace
2143
2241
  });
2144
- await writeFile5(join12(stageDir, "_claude.json"), JSON.stringify(claudeJson, null, 2));
2145
- const pluginsDir = join12(stageDir, "plugins");
2242
+ await writeFile5(join14(stageDir, "_claude.json"), JSON.stringify(claudeJson, null, 2));
2243
+ const pluginsDir = join14(stageDir, "plugins");
2146
2244
  if (await pathExists4(pluginsDir)) {
2147
2245
  try {
2148
2246
  const entries = await readdir5(pluginsDir, { withFileTypes: true });
2149
2247
  for (const ent of entries) {
2150
2248
  if (!ent.isFile() || !ent.name.endsWith(".json")) continue;
2151
- const file = join12(pluginsDir, ent.name);
2152
- const raw = await readFile7(file, "utf8");
2249
+ const file = join14(pluginsDir, ent.name);
2250
+ const raw = await readFile8(file, "utf8");
2153
2251
  const replaced = raw.split(`${hostHome}/.claude/plugins/`).join("/home/vscode/.claude/plugins/");
2154
2252
  if (replaced !== raw) await writeFile5(file, replaced);
2155
2253
  }
@@ -2177,20 +2275,20 @@ var CODEX_KEYCHAIN_WARNING = 'codex: ~/.codex/auth.json missing. On macOS the co
2177
2275
  async function sanitizeStagedCodexConfig(configPath, hostHome) {
2178
2276
  try {
2179
2277
  if (!await pathExists4(configPath)) return;
2180
- const { text, changed } = sanitizeCodexConfigForBox(await readFile7(configPath, "utf8"), hostHome);
2278
+ const { text, changed } = sanitizeCodexConfigForBox(await readFile8(configPath, "utf8"), hostHome);
2181
2279
  if (changed) await writeFile5(configPath, text);
2182
2280
  } catch {
2183
2281
  }
2184
2282
  }
2185
2283
  async function stageCodexStaticForUpload(opts = {}) {
2186
- const hostHome = opts.hostHome ?? homedir9();
2187
- const hostCodex = join12(hostHome, ".codex");
2284
+ const hostHome = opts.hostHome ?? homedir10();
2285
+ const hostCodex = join14(hostHome, ".codex");
2188
2286
  if (!await pathExists4(hostCodex)) return emptyResult();
2189
2287
  const stageDir = await mkStageDir("codex-static");
2190
2288
  let tarballPath = null;
2191
2289
  try {
2192
2290
  const codexBroken = await findBrokenSymlinks(hostCodex);
2193
- await execa5("rsync", [
2291
+ await execa6("rsync", [
2194
2292
  "-a",
2195
2293
  "-L",
2196
2294
  ...codexBroken.map((r) => `--exclude=/${r}`),
@@ -2198,7 +2296,7 @@ async function stageCodexStaticForUpload(opts = {}) {
2198
2296
  `${hostCodex}/`,
2199
2297
  `${stageDir}/`
2200
2298
  ]);
2201
- await sanitizeStagedCodexConfig(join12(stageDir, "config.toml"), hostHome);
2299
+ await sanitizeStagedCodexConfig(join14(stageDir, "config.toml"), hostHome);
2202
2300
  tarballPath = await tarballFromDir(stageDir, "codex-static");
2203
2301
  return {
2204
2302
  tarballPath,
@@ -2212,14 +2310,14 @@ async function stageCodexStaticForUpload(opts = {}) {
2212
2310
  }
2213
2311
  }
2214
2312
  async function stageAgentsStaticForUpload(opts = {}) {
2215
- const hostHome = opts.hostHome ?? homedir9();
2216
- const hostAgents = join12(hostHome, ".agents");
2313
+ const hostHome = opts.hostHome ?? homedir10();
2314
+ const hostAgents = join14(hostHome, ".agents");
2217
2315
  if (!await pathExists4(hostAgents)) return emptyResult();
2218
2316
  const stageDir = await mkStageDir("agents-static");
2219
2317
  let tarballPath = null;
2220
2318
  try {
2221
2319
  const broken = await findBrokenSymlinks(hostAgents);
2222
- await execa5("rsync", [
2320
+ await execa6("rsync", [
2223
2321
  "-a",
2224
2322
  "-L",
2225
2323
  ...broken.map((r) => `--exclude=/${r}`),
@@ -2239,20 +2337,20 @@ async function stageAgentsStaticForUpload(opts = {}) {
2239
2337
  }
2240
2338
  }
2241
2339
  async function stageCodexCredentialsForUpload(opts = {}) {
2242
- const hostHome = opts.hostHome ?? homedir9();
2243
- const cloudBackup = join12(hostHome, ".agentbox", "codex-credentials.json");
2340
+ const hostHome = opts.hostHome ?? homedir10();
2341
+ const cloudBackup = join14(hostHome, ".agentbox", "codex-credentials.json");
2244
2342
  if (await pathExists4(cloudBackup)) {
2245
2343
  return stageSingleFileTarball("codex-creds", cloudBackup, "auth.json");
2246
2344
  }
2247
- const hostAuth = join12(hostHome, ".codex", "auth.json");
2345
+ const hostAuth = join14(hostHome, ".codex", "auth.json");
2248
2346
  if (!await pathExists4(hostAuth)) return emptyResult([CODEX_KEYCHAIN_WARNING]);
2249
2347
  return stageSingleFileTarball("codex-creds", hostAuth, "auth.json");
2250
2348
  }
2251
2349
  var OPENCODE_DATA_EXCLUDES = resolveAgentSpec("opencode").staticPaths[0]?.exclude ?? [];
2252
2350
  async function stageOpencodeStaticForUpload(opts = {}) {
2253
- const hostHome = opts.hostHome ?? homedir9();
2254
- const hostData = join12(hostHome, ".local", "share", "opencode");
2255
- const hostConfig = join12(hostHome, ".config", "opencode");
2351
+ const hostHome = opts.hostHome ?? homedir10();
2352
+ const hostData = join14(hostHome, ".local", "share", "opencode");
2353
+ const hostConfig = join14(hostHome, ".config", "opencode");
2256
2354
  const hasData = await pathExists4(hostData);
2257
2355
  const hasConfig = await pathExists4(hostConfig);
2258
2356
  if (!hasData && !hasConfig) return emptyResult();
@@ -2261,7 +2359,7 @@ async function stageOpencodeStaticForUpload(opts = {}) {
2261
2359
  try {
2262
2360
  if (hasData) {
2263
2361
  const dataBroken = await findBrokenSymlinks(hostData);
2264
- await execa5("rsync", [
2362
+ await execa6("rsync", [
2265
2363
  "-a",
2266
2364
  "-L",
2267
2365
  ...dataBroken.map((r) => `--exclude=/${r}`),
@@ -2271,9 +2369,9 @@ async function stageOpencodeStaticForUpload(opts = {}) {
2271
2369
  ]);
2272
2370
  }
2273
2371
  if (hasConfig) {
2274
- const configStage = join12(stageDir, "config");
2372
+ const configStage = join14(stageDir, "config");
2275
2373
  const cfgBroken = await findBrokenSymlinks(hostConfig);
2276
- await execa5("rsync", [
2374
+ await execa6("rsync", [
2277
2375
  "-a",
2278
2376
  "-L",
2279
2377
  ...cfgBroken.map((r) => `--exclude=/${r}`),
@@ -2294,18 +2392,18 @@ async function stageOpencodeStaticForUpload(opts = {}) {
2294
2392
  }
2295
2393
  }
2296
2394
  async function stageOpencodeCredentialsForUpload(opts = {}) {
2297
- const hostHome = opts.hostHome ?? homedir9();
2298
- const cloudBackup = join12(hostHome, ".agentbox", "opencode-credentials.json");
2395
+ const hostHome = opts.hostHome ?? homedir10();
2396
+ const cloudBackup = join14(hostHome, ".agentbox", "opencode-credentials.json");
2299
2397
  if (await pathExists4(cloudBackup)) {
2300
2398
  return stageSingleFileTarball("opencode-creds", cloudBackup, "auth.json");
2301
2399
  }
2302
- const hostAuth = join12(hostHome, ".local", "share", "opencode", "auth.json");
2400
+ const hostAuth = join14(hostHome, ".local", "share", "opencode", "auth.json");
2303
2401
  if (!await pathExists4(hostAuth)) return emptyResult();
2304
2402
  return stageSingleFileTarball("opencode-creds", hostAuth, "auth.json");
2305
2403
  }
2306
2404
  async function stageOpencodeStateForUpload(opts = {}) {
2307
- const hostHome = opts.hostHome ?? homedir9();
2308
- const hostModel = join12(hostHome, ".local", "state", "opencode", "model.json");
2405
+ const hostHome = opts.hostHome ?? homedir10();
2406
+ const hostModel = join14(hostHome, ".local", "state", "opencode", "model.json");
2309
2407
  if (!await pathExists4(hostModel)) return emptyResult();
2310
2408
  return stageSingleFileTarball("opencode-state", hostModel, "model.json");
2311
2409
  }
@@ -2331,27 +2429,27 @@ function preparedStatePathFor(provider) {
2331
2429
  if (!/^[A-Za-z0-9._-]+$/.test(provider)) {
2332
2430
  throw new Error(`invalid provider name for prepared-state: ${JSON.stringify(provider)}`);
2333
2431
  }
2334
- return pathResolve(homedir10(), ".agentbox", `${provider}-prepared.json`);
2432
+ return pathResolve(homedir11(), ".agentbox", `${provider}-prepared.json`);
2335
2433
  }
2336
2434
  function readPreparedStateRaw(provider) {
2337
2435
  const path = preparedStatePathFor(provider);
2338
- if (!existsSync3(path)) return null;
2436
+ if (!existsSync4(path)) return null;
2339
2437
  try {
2340
- return JSON.parse(readFileSync3(path, "utf8"));
2438
+ return JSON.parse(readFileSync4(path, "utf8"));
2341
2439
  } catch {
2342
2440
  return null;
2343
2441
  }
2344
2442
  }
2345
2443
  function writePreparedStateRaw(provider, state) {
2346
2444
  const path = preparedStatePathFor(provider);
2347
- mkdirSync2(dirname7(path), { recursive: true });
2445
+ mkdirSync3(dirname8(path), { recursive: true });
2348
2446
  const body = JSON.stringify(state, null, 2) + "\n";
2349
2447
  const tmp = `${path}.tmp`;
2350
- writeFileSync2(tmp, body, { mode: 384 });
2448
+ writeFileSync3(tmp, body, { mode: 384 });
2351
2449
  renameSync2(tmp, path);
2352
2450
  }
2353
2451
  async function sha256OfFile(path) {
2354
- const buf = await readFile8(path);
2452
+ const buf = await readFile9(path);
2355
2453
  return createHash3("sha256").update(buf).digest("hex");
2356
2454
  }
2357
2455
  async function computeContextSha256(files) {
@@ -2420,20 +2518,20 @@ function resolveContextFilesFrom(fileMap, opts) {
2420
2518
  pathResolve(opts.contextDir, paths.staged),
2421
2519
  pathResolve(opts.devRoot, paths.dev)
2422
2520
  ];
2423
- const hit = candidates.find((p) => existsSync3(p));
2521
+ const hit = candidates.find((p) => existsSync4(p));
2424
2522
  if (!hit) return null;
2425
2523
  out.push({ rel, abs: hit });
2426
2524
  }
2427
2525
  return out;
2428
2526
  }
2429
2527
 
2430
- // ../../packages/sandbox-docker/dist/chunk-HAYZZFAH.js
2431
- import { dirname as dirname23, resolve as resolve22 } from "path";
2528
+ // ../../packages/sandbox-docker/dist/chunk-BSXR4H44.js
2529
+ import { dirname as dirname23, resolve as resolve23 } from "path";
2432
2530
  import { fileURLToPath as fileURLToPath2 } from "url";
2433
- import { execa as execa6 } from "execa";
2434
- import { existsSync as existsSync4 } from "fs";
2531
+ import { execa as execa7 } from "execa";
2532
+ import { existsSync as existsSync5 } from "fs";
2435
2533
  import { fileURLToPath } from "url";
2436
- import { dirname as dirname8, resolve as resolve3 } from "path";
2534
+ import { dirname as dirname9, resolve as resolve3 } from "path";
2437
2535
  var DEFAULT_BOX_IMAGE = "agentbox/box:dev";
2438
2536
  async function resolveClaudeInstallMode() {
2439
2537
  try {
@@ -2448,14 +2546,14 @@ var BOX_IMAGE_REGISTRY = "ghcr.io/madarco/agentbox/box";
2448
2546
  function registryRefForSha(sha, registry = BOX_IMAGE_REGISTRY) {
2449
2547
  return `${registry}:sha-${sha.slice(0, 16)}`;
2450
2548
  }
2451
- var here = dirname8(fileURLToPath(import.meta.url));
2549
+ var here = dirname9(fileURLToPath(import.meta.url));
2452
2550
  function resolveDockerBuild() {
2453
2551
  const override = process.env.AGENTBOX_DOCKER_CONTEXT;
2454
- if (override && existsSync4(resolve3(override, "Dockerfile.box"))) {
2552
+ if (override && existsSync5(resolve3(override, "Dockerfile.box"))) {
2455
2553
  return { dockerfile: resolve3(override, "Dockerfile.box"), context: override };
2456
2554
  }
2457
2555
  const staged = resolve3(here, "..", "runtime", "docker");
2458
- if (existsSync4(resolve3(staged, "Dockerfile.box"))) {
2556
+ if (existsSync5(resolve3(staged, "Dockerfile.box"))) {
2459
2557
  return { dockerfile: resolve3(staged, "Dockerfile.box"), context: staged };
2460
2558
  }
2461
2559
  const packageRoot = resolve3(here, "..");
@@ -2468,11 +2566,11 @@ var { dockerfile: DOCKERFILE_PATH_RESOLVED, context: BUILD_CONTEXT_DIR_RESOLVED
2468
2566
  var DOCKERFILE_PATH = DOCKERFILE_PATH_RESOLVED;
2469
2567
  var BUILD_CONTEXT_DIR = BUILD_CONTEXT_DIR_RESOLVED;
2470
2568
  async function imageExists(ref) {
2471
- const result = await execa6("docker", ["image", "inspect", ref], { reject: false });
2569
+ const result = await execa7("docker", ["image", "inspect", ref], { reject: false });
2472
2570
  return result.exitCode === 0;
2473
2571
  }
2474
2572
  async function pullImage(target, opts = {}) {
2475
- const subprocess = execa6("docker", ["pull", target], {
2573
+ const subprocess = execa7("docker", ["pull", target], {
2476
2574
  stderr: "pipe",
2477
2575
  stdout: "pipe",
2478
2576
  reject: false
@@ -2491,10 +2589,10 @@ async function pullImage(target, opts = {}) {
2491
2589
  return result.exitCode === 0;
2492
2590
  }
2493
2591
  async function tagImage(source, target) {
2494
- await execa6("docker", ["tag", source, target]);
2592
+ await execa7("docker", ["tag", source, target]);
2495
2593
  }
2496
2594
  async function imageInfo(ref = DEFAULT_BOX_IMAGE) {
2497
- const result = await execa6(
2595
+ const result = await execa7(
2498
2596
  "docker",
2499
2597
  ["image", "inspect", "--format", "{{.Size}}|{{.Created}}", ref],
2500
2598
  { reject: false }
@@ -2521,7 +2619,7 @@ async function buildImage(opts = {}) {
2521
2619
  if (process.env.AGENTBOX === "1") {
2522
2620
  args.splice(1, 0, "--network=host");
2523
2621
  }
2524
- const subprocess = execa6("docker", args, {
2622
+ const subprocess = execa7("docker", args, {
2525
2623
  stderr: "pipe",
2526
2624
  stdout: "pipe"
2527
2625
  });
@@ -2539,7 +2637,7 @@ async function buildImage(opts = {}) {
2539
2637
  return ref;
2540
2638
  }
2541
2639
  async function pullOrBuild(ref, fingerprint, opts = {}) {
2542
- const { writePreparedDockerState: writePreparedDockerState2 } = await import("./prepared-state-5FIGV4BE-WPHOEDA6.js");
2640
+ const { writePreparedDockerState: writePreparedDockerState2 } = await import("./prepared-state-LW2PKTEQ-5YMKG7UN.js");
2543
2641
  const registry = opts.registry ?? BOX_IMAGE_REGISTRY;
2544
2642
  const allowPull = opts.allowPull !== false;
2545
2643
  if (allowPull && registry && fingerprint) {
@@ -2566,7 +2664,7 @@ async function pullOrBuild(ref, fingerprint, opts = {}) {
2566
2664
  return { source: "built" };
2567
2665
  }
2568
2666
  async function ensureImage(ref = DEFAULT_BOX_IMAGE, opts = {}) {
2569
- const { computeDockerContextFingerprint: computeDockerContextFingerprint2, readPreparedDockerState: readPreparedDockerState2, preparedMatches: preparedMatches2 } = await import("./prepared-state-5FIGV4BE-WPHOEDA6.js");
2667
+ const { computeDockerContextFingerprint: computeDockerContextFingerprint2, readPreparedDockerState: readPreparedDockerState2, preparedMatches: preparedMatches2 } = await import("./prepared-state-LW2PKTEQ-5YMKG7UN.js");
2570
2668
  const claudeInstall = opts.claudeInstall ?? await resolveClaudeInstallMode();
2571
2669
  const rawFingerprint = await computeDockerContextFingerprint2({
2572
2670
  contextDir: opts.contextDir
@@ -2603,11 +2701,36 @@ async function ensureImage(ref = DEFAULT_BOX_IMAGE, opts = {}) {
2603
2701
  });
2604
2702
  return { ref, built: source === "built", reason };
2605
2703
  }
2704
+ function classifyDockerBaseFreshness(input) {
2705
+ if (!input.imagePresent) return { state: "unprepared" };
2706
+ if (!input.fingerprint) return { state: "unknown" };
2707
+ if (!input.stampedSha) return { state: "stale", reason: "no docker-prepared.json on disk" };
2708
+ if (input.stampedSha !== input.fingerprint) {
2709
+ return {
2710
+ state: "stale",
2711
+ reason: `build context changed (was ${input.stampedSha.slice(0, 12)}, now ${input.fingerprint.slice(0, 12)})`
2712
+ };
2713
+ }
2714
+ return { state: "fresh" };
2715
+ }
2716
+ async function evaluateDockerBaseFreshness(opts = {}) {
2717
+ const { computeDockerContextFingerprint: computeDockerContextFingerprint2, readPreparedDockerState: readPreparedDockerState2 } = await import("./prepared-state-LW2PKTEQ-5YMKG7UN.js");
2718
+ const ref = opts.ref ?? DEFAULT_BOX_IMAGE;
2719
+ const imagePresent = await imageExists(ref);
2720
+ if (!imagePresent) return { state: "unprepared" };
2721
+ const claudeInstall = opts.claudeInstall ?? await resolveClaudeInstallMode();
2722
+ const raw = await computeDockerContextFingerprint2({ contextDir: opts.contextDir });
2723
+ return classifyDockerBaseFreshness({
2724
+ imagePresent,
2725
+ fingerprint: raw ? claudeInstallFingerprint(raw.contextSha256, claudeInstall) : null,
2726
+ stampedSha: readPreparedDockerState2()?.base?.contextSha256 ?? null
2727
+ });
2728
+ }
2606
2729
  var SCHEMA = 1;
2607
2730
  function resolveContextFiles(opts = {}) {
2608
2731
  const ctx = opts.contextDir ?? BUILD_CONTEXT_DIR;
2609
2732
  const here2 = dirname23(fileURLToPath2(import.meta.url));
2610
- const packageRoot = resolve22(here2, "..");
2733
+ const packageRoot = resolve23(here2, "..");
2611
2734
  return resolveContextFilesFrom(DOCKER_CONTEXT_FILE_MAP, {
2612
2735
  contextDir: ctx,
2613
2736
  devRoot: packageRoot
@@ -2679,6 +2802,9 @@ export {
2679
2802
  pickFreshBranch,
2680
2803
  GitWorktreeError,
2681
2804
  hostOpenCommand,
2805
+ claudeSettingsPath,
2806
+ claudeSshEntryFor,
2807
+ upsertClaudeSshConfig,
2682
2808
  agentboxSshConfigPath,
2683
2809
  agentboxAliasFor,
2684
2810
  syncAgentboxSshConfig,
@@ -2687,6 +2813,7 @@ export {
2687
2813
  resolveCloudSshTarget,
2688
2814
  ensureCloudSshAlias,
2689
2815
  autoWriteSshConfig,
2816
+ mintSshKey,
2690
2817
  scratchBranchName,
2691
2818
  boxGitCheckout,
2692
2819
  boxGitNewBranch,
@@ -2762,16 +2889,19 @@ export {
2762
2889
  BOX_IMAGE_REGISTRY,
2763
2890
  registryRefForSha,
2764
2891
  DOCKERFILE_PATH,
2892
+ BUILD_CONTEXT_DIR,
2765
2893
  imageExists,
2766
2894
  pullImage,
2767
2895
  tagImage,
2768
2896
  imageInfo,
2769
2897
  pullOrBuild,
2770
2898
  ensureImage,
2899
+ classifyDockerBaseFreshness,
2900
+ evaluateDockerBaseFreshness,
2771
2901
  resolveContextFiles,
2772
2902
  computeDockerContextFingerprint,
2773
2903
  readPreparedDockerState,
2774
2904
  writePreparedDockerState,
2775
2905
  preparedMatches
2776
2906
  };
2777
- //# sourceMappingURL=chunk-ES2DDCAC.js.map
2907
+ //# sourceMappingURL=chunk-CKC3CP7Y.js.map