@madarco/agentbox 0.22.2 → 0.23.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/dist/{_cloud-attach-Y5WZ7F53.js → _cloud-attach-HGP3MQEG.js} +4 -4
  3. package/dist/{chunk-BMCT3LBE.js → chunk-4AV2L2KY.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-FNAGMTUI.js → dist-JFUUDAI3.js} +17 -3
  21. package/dist/{dist-VOVN64Y2.js → dist-W5476E2U.js} +5 -5
  22. package/dist/{dist-AN5NUXA5.js → dist-X3O3HEYD.js} +8 -6
  23. package/dist/{dist-AN5NUXA5.js.map → dist-X3O3HEYD.js.map} +1 -1
  24. package/dist/{dist-K5GASNBV.js → dist-Z3GSHEFO.js} +7 -6
  25. package/dist/index.js +427 -227
  26. package/dist/index.js.map +1 -1
  27. package/dist/{prepared-state-5FIGV4BE-WPHOEDA6.js → prepared-state-LW2PKTEQ-5YMKG7UN.js} +2 -2
  28. package/package.json +28 -27
  29. package/runtime/_shared/agentbox-checkpoint-cleanup +0 -0
  30. package/runtime/_shared/agentbox-dockerd-start +0 -0
  31. package/runtime/_shared/agentbox-open +0 -0
  32. package/runtime/_shared/agentbox-portless-trust +0 -0
  33. package/runtime/_shared/agentbox-vnc-start +0 -0
  34. package/runtime/_shared/ctl.cjs +3 -1
  35. package/runtime/_shared/gh-shim +0 -0
  36. package/runtime/_shared/git-shim +0 -0
  37. package/runtime/_shared/linear-shim +0 -0
  38. package/runtime/_shared/ntn-shim +0 -0
  39. package/runtime/docker/Dockerfile.box +12 -0
  40. package/runtime/docker/packages/ctl/dist/bin.cjs +3 -1
  41. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-checkpoint-cleanup +0 -0
  42. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-dockerd-start +0 -0
  43. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-open +0 -0
  44. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-portless-trust +0 -0
  45. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-sshd-start +44 -0
  46. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-vnc-start +0 -0
  47. package/runtime/docker/packages/sandbox-docker/scripts/chromium-resolver +0 -0
  48. package/runtime/docker/packages/sandbox-docker/scripts/gh-shim +0 -0
  49. package/runtime/docker/packages/sandbox-docker/scripts/git-shim +0 -0
  50. package/runtime/docker/packages/sandbox-docker/scripts/linear-shim +0 -0
  51. package/runtime/docker/packages/sandbox-docker/scripts/ntn-shim +0 -0
  52. package/runtime/e2b/agentbox-checkpoint-cleanup +0 -0
  53. package/runtime/e2b/agentbox-dockerd-start +0 -0
  54. package/runtime/e2b/agentbox-open +0 -0
  55. package/runtime/e2b/agentbox-vnc-start +0 -0
  56. package/runtime/e2b/ctl.cjs +3 -1
  57. package/runtime/e2b/gh-shim +0 -0
  58. package/runtime/e2b/git-shim +0 -0
  59. package/runtime/e2b/linear-shim +0 -0
  60. package/runtime/e2b/ntn-shim +0 -0
  61. package/runtime/e2b/scripts/build-template.sh +0 -0
  62. package/runtime/hetzner/agentbox-checkpoint-cleanup +0 -0
  63. package/runtime/hetzner/agentbox-dockerd-start +0 -0
  64. package/runtime/hetzner/agentbox-open +0 -0
  65. package/runtime/hetzner/agentbox-portless-trust +0 -0
  66. package/runtime/hetzner/agentbox-vnc-start +0 -0
  67. package/runtime/hetzner/ctl.cjs +3 -1
  68. package/runtime/hetzner/gh-shim +0 -0
  69. package/runtime/hetzner/git-shim +0 -0
  70. package/runtime/hetzner/linear-shim +0 -0
  71. package/runtime/hetzner/ntn-shim +0 -0
  72. package/runtime/hetzner/scripts/install-box.sh +0 -0
  73. package/runtime/hub/apps/hub/.next/BUILD_ID +1 -1
  74. package/runtime/hub/apps/hub/.next/app-path-routes-manifest.json +2 -0
  75. package/runtime/hub/apps/hub/.next/build-manifest.json +3 -3
  76. package/runtime/hub/apps/hub/.next/routes-manifest.json +14 -0
  77. package/runtime/hub/apps/hub/.next/server/app/(auth)/signin/page_client-reference-manifest.js +1 -1
  78. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/open/route/app-paths-manifest.json +3 -0
  79. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/open/route/build-manifest.json +9 -0
  80. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/open/route/server-reference-manifest.json +4 -0
  81. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/open/route.js +9 -0
  82. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/open/route.js.map +5 -0
  83. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/open/route.js.nft.json +1 -0
  84. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/open/route_client-reference-manifest.js +3 -0
  85. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/open-targets/route/app-paths-manifest.json +3 -0
  86. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/open-targets/route/build-manifest.json +9 -0
  87. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/open-targets/route/server-reference-manifest.json +4 -0
  88. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/open-targets/route.js +8 -0
  89. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/open-targets/route.js.map +5 -0
  90. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/open-targets/route.js.nft.json +1 -0
  91. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/open-targets/route_client-reference-manifest.js +3 -0
  92. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page_client-reference-manifest.js +1 -1
  93. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page_client-reference-manifest.js +1 -1
  94. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
  95. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page_client-reference-manifest.js +1 -1
  96. package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page_client-reference-manifest.js +1 -1
  97. package/runtime/hub/apps/hub/.next/server/app/_global-error.html +1 -1
  98. package/runtime/hub/apps/hub/.next/server/app/_global-error.rsc +1 -1
  99. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  100. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  101. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  102. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  103. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  104. package/runtime/hub/apps/hub/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  105. package/runtime/hub/apps/hub/.next/server/app-paths-manifest.json +2 -0
  106. 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
  107. package/runtime/hub/apps/hub/.next/server/chunks/1jcg_server_app_(dashboard)_api_v1_boxes_[id]_open_route_actions_1agwl8h.js +3 -0
  108. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0keu6we._.js +1 -1
  109. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0ql4fjo._.js +1 -1
  110. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0vs8fma._.js +1 -1
  111. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0w9ud8u._.js +1 -1
  112. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0yhb0gc._.js +1 -1
  113. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1-0flwc._.js +3 -0
  114. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1a50b07._.js +3 -0
  115. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1bqbkd5._.js +2 -2
  116. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1d6mtlk._.js +1 -1
  117. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1dn_3i1._.js +1 -1
  118. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1hqla7-._.js +1 -1
  119. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1js2jdv._.js +1 -1
  120. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1nepkp-._.js +1 -1
  121. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1q5bqse._.js +1 -1
  122. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1qa4a0v._.js +2 -2
  123. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1thipug._.js +3 -0
  124. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1v9om6g._.js +1 -1
  125. package/runtime/hub/apps/hub/.next/server/chunks/_06f2faq._.js +1 -1
  126. package/runtime/hub/apps/hub/.next/server/chunks/_0f3molr._.js +3 -0
  127. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0ro6vh6._.js +1 -1
  128. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_0b_hsjl._.js +1 -1
  129. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_app_(dashboard)_boxes_[id]_page_tsx_1-j_972._.js +1 -1
  130. package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_app_(dashboard)_boxes_components_box-table_tsx_0a9pyn_._.js +1 -1
  131. package/runtime/hub/apps/hub/.next/server/functions-config-manifest.json +2 -0
  132. package/runtime/hub/apps/hub/.next/server/middleware-build-manifest.js +3 -3
  133. package/runtime/hub/apps/hub/.next/server/pages/500.html +1 -1
  134. package/runtime/hub/apps/hub/.next/static/chunks/0joh_xsiowfc4.js +1 -0
  135. package/runtime/hub/apps/hub/.next/static/chunks/1py5tlz57h7ra.js +1 -0
  136. package/runtime/hub/apps/hub/.next/static/chunks/3p86ecqhr_7yy.js +1 -0
  137. package/runtime/hub/apps/hub/.next/static/chunks/3qof5hg87qf5n.js +1 -0
  138. package/runtime/hub/apps/hub/.next/static/chunks/3rm29i8e-lb25.css +3 -0
  139. package/runtime/hub/apps/hub/{chunk-673QOHSR.js → chunk-6HD4PARX.js} +9 -9
  140. package/runtime/hub/apps/hub/{chunk-7J6ZFTT4.js → chunk-JQFB2CNA.js} +132 -16
  141. package/runtime/hub/apps/hub/{chunk-5XQ3T3W2.js → chunk-K6RA5GJI.js} +231 -126
  142. package/runtime/hub/apps/hub/{dist-GCALYJN7.js → dist-3HR4RIPE.js} +17 -3
  143. package/runtime/hub/apps/hub/{dist-EI54M5DP.js → dist-7GNKBKFV.js} +29 -42
  144. package/runtime/hub/apps/hub/{dist-MOCUH2OC.js → dist-JWVTVHBT.js} +4 -4
  145. package/runtime/hub/apps/hub/{dist-K7WHNDZB.js → dist-L2MMBH7P.js} +7 -5
  146. package/runtime/hub/apps/hub/{dist-LYTWBTUL.js → dist-OUNL2TCW.js} +4 -4
  147. package/runtime/hub/apps/hub/{prepared-state-5FIGV4BE-D2HJEY2L.js → prepared-state-LW2PKTEQ-7BCXARGA.js} +1 -1
  148. package/runtime/hub/apps/hub/server.js +105 -24
  149. package/runtime/relay/bin.cjs +3 -1
  150. package/runtime/vercel/agentbox-checkpoint-cleanup +0 -0
  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 +3 -1
  155. package/runtime/vercel/gh-shim +0 -0
  156. package/runtime/vercel/git-shim +0 -0
  157. package/runtime/vercel/linear-shim +0 -0
  158. package/runtime/vercel/ntn-shim +0 -0
  159. package/runtime/vercel/scripts/provision.sh +0 -0
  160. package/LICENSE +0 -21
  161. package/dist/chunk-5DZTXHLQ.js.map +0 -1
  162. package/dist/chunk-ES2DDCAC.js.map +0 -1
  163. package/runtime/hub/apps/hub/.next/static/chunks/0dx4alyqu7cq1.css +0 -3
  164. package/runtime/hub/apps/hub/.next/static/chunks/332lo0ac7l2wv.js +0 -1
  165. package/runtime/hub/apps/hub/.next/static/chunks/3gdqmzzl34ilu.js +0 -1
  166. package/runtime/hub/apps/hub/.next/static/chunks/3y2c7woqhtx9s.js +0 -1
  167. package/runtime/hub/apps/hub/.next/static/chunks/44exu5uemf-ev.js +0 -1
  168. /package/dist/{_cloud-attach-Y5WZ7F53.js.map → _cloud-attach-HGP3MQEG.js.map} +0 -0
  169. /package/dist/{chunk-BMCT3LBE.js.map → chunk-4AV2L2KY.js.map} +0 -0
  170. /package/dist/{chunk-3KAWXDQ4.js.map → chunk-JXDSSSXS.js.map} +0 -0
  171. /package/dist/{chunk-S4OWE3UD.js.map → chunk-L5SOSNQI.js.map} +0 -0
  172. /package/dist/{chunk-V2NCCC2B.js.map → chunk-Q626V2YX.js.map} +0 -0
  173. /package/dist/{chunk-7HAGPF4X.js.map → chunk-QVWGQJV6.js.map} +0 -0
  174. /package/dist/{dist-SJRMFVRV.js.map → dist-GEHCZJCS.js.map} +0 -0
  175. /package/dist/{dist-FNAGMTUI.js.map → dist-JFUUDAI3.js.map} +0 -0
  176. /package/dist/{dist-K5GASNBV.js.map → dist-W5476E2U.js.map} +0 -0
  177. /package/dist/{dist-VOVN64Y2.js.map → dist-Z3GSHEFO.js.map} +0 -0
  178. /package/dist/{prepared-state-5FIGV4BE-WPHOEDA6.js.map → prepared-state-LW2PKTEQ-5YMKG7UN.js.map} +0 -0
  179. /package/runtime/hub/apps/hub/.next/static/{zT1paOSXMJpAPsZ1dFK2V → mcWRLSGubwKk9p3RFz2-Q}/_buildManifest.js +0 -0
  180. /package/runtime/hub/apps/hub/.next/static/{zT1paOSXMJpAPsZ1dFK2V → mcWRLSGubwKk9p3RFz2-Q}/_clientMiddlewareManifest.js +0 -0
  181. /package/runtime/hub/apps/hub/.next/static/{zT1paOSXMJpAPsZ1dFK2V → mcWRLSGubwKk9p3RFz2-Q}/_ssgManifest.js +0 -0
@@ -1,18 +1,8 @@
1
1
  import { createRequire as __cr } from 'node:module'; import { fileURLToPath as __f } from 'node:url'; import { dirname as __d } from 'node:path'; const require = __cr(import.meta.url); const __filename = __f(import.meta.url); const __dirname = __d(__filename);
2
- import {
3
- BUILT_IN_DEFAULTS,
4
- GLOBAL_CONFIG_FILE,
5
- hashProjectPath,
6
- loadEffectiveConfig,
7
- parseUserConfig,
8
- projectDirSegment,
9
- require_dist,
10
- sanitizeMnemonic,
11
- setConfigValue
12
- } from "./chunk-EXQCBM5Q.js";
13
2
  import {
14
3
  AmbiguousBoxError,
15
4
  BOX_HOME,
5
+ BUILD_CONTEXT_DIR,
16
6
  BoxNotFoundError,
17
7
  DEFAULT_BOX_IMAGE,
18
8
  DEFAULT_ENV_PATTERNS,
@@ -46,6 +36,7 @@ import {
46
36
  looksLikeSecret,
47
37
  makeHostGitPorts,
48
38
  makeSyncContext,
39
+ mintSshKey,
49
40
  parseDownloadKind,
50
41
  parseReplacements,
51
42
  pickFreshBranch,
@@ -71,12 +62,24 @@ import {
71
62
  sanitizeGitArgs,
72
63
  seedAgentsVolume,
73
64
  setInstallMethodNative,
65
+ syncAgentboxSshConfig,
74
66
  trustWorkspace,
75
67
  upstreamRef
76
- } from "./chunk-5XQ3T3W2.js";
68
+ } from "./chunk-K6RA5GJI.js";
77
69
  import {
78
70
  execa
79
71
  } from "./chunk-EFW34I43.js";
72
+ import {
73
+ BUILT_IN_DEFAULTS,
74
+ GLOBAL_CONFIG_FILE,
75
+ hashProjectPath,
76
+ loadEffectiveConfig,
77
+ parseUserConfig,
78
+ projectDirSegment,
79
+ require_dist,
80
+ sanitizeMnemonic,
81
+ setConfigValue
82
+ } from "./chunk-EXQCBM5Q.js";
80
83
  import {
81
84
  __toESM
82
85
  } from "./chunk-TZFWAJVB.js";
@@ -9090,6 +9093,53 @@ function buildVncUrls(record, engine) {
9090
9093
  }
9091
9094
  return urls;
9092
9095
  }
9096
+ var SSH_CONTAINER_PORT = 22;
9097
+ async function launchSshdDaemon(container, timeoutMs = 5e3) {
9098
+ const result = await execInBox(container, ["/usr/local/bin/agentbox-sshd-start"], {
9099
+ user: "root",
9100
+ detach: true
9101
+ });
9102
+ if (result.exitCode !== 0) {
9103
+ return { up: false, reason: `docker exec failed: ${result.stderr || result.stdout}` };
9104
+ }
9105
+ const deadline = Date.now() + timeoutMs;
9106
+ while (Date.now() < deadline) {
9107
+ const probe = await execInBox(
9108
+ container,
9109
+ ["bash", "-lc", "(echo > /dev/tcp/127.0.0.1/22) 2>/dev/null"],
9110
+ { user: "vscode" }
9111
+ );
9112
+ if (probe.exitCode === 0) return { up: true };
9113
+ await new Promise((r) => setTimeout(r, 150));
9114
+ }
9115
+ return { up: false, reason: `sshd did not bind 22 within ${String(timeoutMs)}ms` };
9116
+ }
9117
+ async function installAuthorizedKey(container, publicKey) {
9118
+ const script = "set -e; install -d -m 700 -o vscode -g vscode /home/vscode/.ssh; cat > /home/vscode/.ssh/authorized_keys; chown vscode:vscode /home/vscode/.ssh/authorized_keys; chmod 600 /home/vscode/.ssh/authorized_keys";
9119
+ const result = await execa(
9120
+ "docker",
9121
+ ["exec", "--user", "root", "-i", container, "sh", "-c", script],
9122
+ { input: publicKey.endsWith("\n") ? publicKey : `${publicKey}
9123
+ `, reject: false }
9124
+ );
9125
+ if (result.exitCode !== 0) {
9126
+ return {
9127
+ ok: false,
9128
+ reason: `docker exec failed (exit ${String(result.exitCode)}): ${(result.stderr ?? "").toString().slice(0, 400)}`
9129
+ };
9130
+ }
9131
+ return { ok: true };
9132
+ }
9133
+ async function setUpBoxSshd(container, sshDir, comment) {
9134
+ const key = await mintSshKey(sshDir, comment);
9135
+ const installed = await installAuthorizedKey(container, key.publicKey);
9136
+ if (!installed.ok) {
9137
+ return { sshHostPort: null, identityFile: key.privatePath, up: false, reason: installed.reason };
9138
+ }
9139
+ const launch = await launchSshdDaemon(container);
9140
+ const sshHostPort = await publishedHostPort(container, SSH_CONTAINER_PORT);
9141
+ return { sshHostPort, identityFile: key.privatePath, up: launch.up, reason: launch.reason };
9142
+ }
9093
9143
  var WEB_CONTAINER_PORT = 80;
9094
9144
  var PORTLESS_BIN = "portless";
9095
9145
  var SUB_VERSION = ["--version"];
@@ -10363,8 +10413,8 @@ async function ensureAgentboxTasksFile(container, services, opts = {}) {
10363
10413
  return { status: "wrote" };
10364
10414
  }
10365
10415
  async function writeFileInBox(container, path, content) {
10366
- const { execa: execa20 } = await import("./execa-4DLVNM6E.js");
10367
- const result = await execa20(
10416
+ const { execa: execa21 } = await import("./execa-4DLVNM6E.js");
10417
+ const result = await execa21(
10368
10418
  "docker",
10369
10419
  ["exec", "-i", "--user", "vscode", container, "sh", "-c", `cat > ${shellQuote2(path)}`],
10370
10420
  { input: content, reject: false }
@@ -10732,6 +10782,9 @@ async function createBox(opts) {
10732
10782
  const webPortMappings = [
10733
10783
  { hostPort: 0, containerPort: WEB_CONTAINER_PORT, hostIp: "127.0.0.1" }
10734
10784
  ];
10785
+ const sshPortMappings = [
10786
+ { hostPort: 0, containerPort: SSH_CONTAINER_PORT, hostIp: "127.0.0.1" }
10787
+ ];
10735
10788
  const agentboxEnv = {
10736
10789
  AGENTBOX: "1",
10737
10790
  AGENTBOX_BOX_NAME: name,
@@ -10781,6 +10834,8 @@ async function createBox(opts) {
10781
10834
  vncContainerPort: vncEnabled ? VNC_CONTAINER_PORT : void 0,
10782
10835
  vncPassword,
10783
10836
  webContainerPort: WEB_CONTAINER_PORT,
10837
+ sshEnabled: true,
10838
+ sshContainerPort: SSH_CONTAINER_PORT,
10784
10839
  dockerVolume,
10785
10840
  dockerCacheShared: dockerCacheShared || void 0,
10786
10841
  projectRoot: opts.projectRoot,
@@ -10795,7 +10850,7 @@ async function createBox(opts) {
10795
10850
  image: imageRef,
10796
10851
  extraVolumes,
10797
10852
  limits: effectiveLimits,
10798
- portMappings: [...vncPortMappings, ...webPortMappings],
10853
+ portMappings: [...vncPortMappings, ...webPortMappings, ...sshPortMappings],
10799
10854
  env: {
10800
10855
  AGENTBOX_BOX_ID: id,
10801
10856
  ...agentboxEnv,
@@ -10951,6 +11006,16 @@ async function createBox(opts) {
10951
11006
  `web port reserved on host 127.0.0.1:${String(webHostPort)} (forwards to the web service once agentbox.yaml sets a service expose:)`
10952
11007
  );
10953
11008
  }
11009
+ const ssh = await setUpBoxSshd(
11010
+ containerName,
11011
+ join12(boxDir, "ssh"),
11012
+ `agentbox-${name}-${id}`
11013
+ );
11014
+ if (ssh.up && ssh.sshHostPort) {
11015
+ log(`sshd up on host 127.0.0.1:${String(ssh.sshHostPort)} (loopback-only)`);
11016
+ } else {
11017
+ log(`sshd did not come up: ${ssh.reason ?? "unknown"} (open/SSH unavailable; docker exec still works)`);
11018
+ }
10954
11019
  let portlessAliasName;
10955
11020
  let portlessUrl;
10956
11021
  let portlessVncAliasName;
@@ -11001,12 +11066,25 @@ async function createBox(opts) {
11001
11066
  carry: carrySummary,
11002
11067
  vncHostPort: vncHostPort ?? void 0,
11003
11068
  webHostPort: webHostPort ?? void 0,
11069
+ sshHostPort: ssh.sshHostPort ?? void 0,
11070
+ // Only advertise an ssh-config alias when sshd actually bound (`up`). Docker
11071
+ // publishes the -p 0:22 host port regardless, so gating on the port alone
11072
+ // would point `~/.ssh/config` at a dead loopback port when sshd failed to
11073
+ // start. A later `start`/`open` re-runs setUpBoxSshd and records it once up.
11074
+ ssh: ssh.up && ssh.sshHostPort ? { host: "127.0.0.1", user: "vscode", identityFile: ssh.identityFile, port: ssh.sshHostPort } : void 0,
11004
11075
  portlessAlias: portlessAliasName,
11005
11076
  portlessUrl,
11006
11077
  portlessVncAlias: portlessVncAliasName,
11007
11078
  portlessVncUrl
11008
11079
  };
11009
11080
  await recordBox(record);
11081
+ if (record.ssh) {
11082
+ try {
11083
+ await syncAgentboxSshConfig();
11084
+ } catch (err) {
11085
+ log(`ssh-config sync failed (best-effort): ${err instanceof Error ? err.message : String(err)}`);
11086
+ }
11087
+ }
11010
11088
  return { record, imageBuilt: built, resync: resyncResult };
11011
11089
  }
11012
11090
  var DEFAULT_SHELL_SESSION = "shell";
@@ -11330,6 +11408,27 @@ async function resyncBox(idOrName, onLog) {
11330
11408
  const hadConflicts = repos.some((r) => r.mergeConflicts.length > 0 || r.overlaySkipped.length > 0);
11331
11409
  return { repos, hadConflicts };
11332
11410
  }
11411
+ async function refreshBoxSshd(box) {
11412
+ if (!box.sshEnabled) return box;
11413
+ const ssh = await setUpBoxSshd(
11414
+ box.container,
11415
+ join14(boxRunDirFor2(box), "ssh"),
11416
+ `agentbox-${box.name}-${box.id}`
11417
+ );
11418
+ if (!ssh.up || !ssh.sshHostPort) return box;
11419
+ const port = ssh.sshHostPort;
11420
+ const changed = port !== box.sshHostPort || box.ssh?.port !== port;
11421
+ box.sshHostPort = port;
11422
+ box.ssh = { host: "127.0.0.1", user: "vscode", identityFile: ssh.identityFile, port };
11423
+ if (changed) {
11424
+ await recordBox(box);
11425
+ try {
11426
+ await syncAgentboxSshConfig();
11427
+ } catch {
11428
+ }
11429
+ }
11430
+ return box;
11431
+ }
11333
11432
  async function startBox(idOrName) {
11334
11433
  const box = await resolveBox(idOrName);
11335
11434
  for (const w of box.gitWorktrees ?? []) {
@@ -11375,6 +11474,7 @@ async function startBox(idOrName) {
11375
11474
  await recordBox(box);
11376
11475
  }
11377
11476
  }
11477
+ await refreshBoxSshd(box);
11378
11478
  if (box.portlessAlias && box.webHostPort || box.portlessVncAlias && box.vncHostPort) {
11379
11479
  try {
11380
11480
  const portless = await detectPortless();
@@ -11558,6 +11658,12 @@ async function destroyBox(idOrName, opts = {}) {
11558
11658
  } catch {
11559
11659
  }
11560
11660
  await removeBoxRecord(box.id);
11661
+ if (box.ssh) {
11662
+ try {
11663
+ await syncAgentboxSshConfig();
11664
+ } catch {
11665
+ }
11666
+ }
11561
11667
  return { record: box, removedContainer, removedVolumes, removedSnapshot };
11562
11668
  }
11563
11669
  async function listSnapshotDirs() {
@@ -12342,7 +12448,12 @@ async function spawnHub(hubServer, cliEntry, log, portlessEnabled) {
12342
12448
  NODE_ENV: "production",
12343
12449
  AGENTBOX_CLI_ENTRY: cliEntry,
12344
12450
  // The hub is the localhost profile (token gate); bind loopback.
12345
- AGENTBOX_HUB_HOST: HOST
12451
+ AGENTBOX_HUB_HOST: HOST,
12452
+ // The hub bundle ships no staged docker build context of its own, so its
12453
+ // in-process docker base-freshness check couldn't fingerprint (degrading
12454
+ // to 'unknown'). Hand it the CLI's resolved context so hub-side
12455
+ // fingerprints match what the create/prepare workers compute.
12456
+ AGENTBOX_DOCKER_CONTEXT: BUILD_CONTEXT_DIR
12346
12457
  }
12347
12458
  });
12348
12459
  child.unref();
@@ -12583,6 +12694,10 @@ export {
12583
12694
  generateVncPassword,
12584
12695
  VNC_CONTAINER_PORT,
12585
12696
  buildVncUrls,
12697
+ SSH_CONTAINER_PORT,
12698
+ launchSshdDaemon,
12699
+ installAuthorizedKey,
12700
+ setUpBoxSshd,
12586
12701
  PORTLESS_PROXY_PORT,
12587
12702
  detectPortless,
12588
12703
  resetPortlessCache,
@@ -12658,6 +12773,7 @@ export {
12658
12773
  unpauseBox,
12659
12774
  stopBox,
12660
12775
  resyncBox,
12776
+ refreshBoxSshd,
12661
12777
  startBox,
12662
12778
  openBoxInFinder,
12663
12779
  getBoxHostPaths,