@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.
- package/CHANGELOG.md +56 -0
- package/dist/{_cloud-attach-Y5WZ7F53.js → _cloud-attach-RFPLNACE.js} +4 -4
- package/dist/{chunk-BMCT3LBE.js → chunk-6OQENOJZ.js} +8 -8
- package/dist/{chunk-ES2DDCAC.js → chunk-CKC3CP7Y.js} +284 -154
- package/dist/chunk-CKC3CP7Y.js.map +1 -0
- package/dist/{chunk-AYNGC4Z5.js → chunk-ERMU7RMK.js} +43 -58
- package/dist/{chunk-AYNGC4Z5.js.map → chunk-ERMU7RMK.js.map} +1 -1
- package/dist/chunk-G3H2L3O2.js +0 -0
- package/dist/{chunk-3KAWXDQ4.js → chunk-JXDSSSXS.js} +3 -3
- package/dist/{chunk-S4OWE3UD.js → chunk-L5SOSNQI.js} +3 -3
- package/dist/{chunk-V2NCCC2B.js → chunk-Q626V2YX.js} +2 -2
- package/dist/{chunk-5DZTXHLQ.js → chunk-QGL734YX.js} +169 -52
- package/dist/chunk-QGL734YX.js.map +1 -0
- package/dist/chunk-QT3SHMLY.js +0 -0
- package/dist/{chunk-7HAGPF4X.js → chunk-QVWGQJV6.js} +2 -2
- package/dist/chunk-WJFZJZIM.js +0 -0
- package/dist/cloud-poller-SUNA6ZQC-7M5LJHHE.js +0 -0
- package/dist/dist-2BTJQUJS.js +0 -0
- package/dist/{dist-SJRMFVRV.js → dist-GEHCZJCS.js} +5 -5
- package/dist/{dist-AN5NUXA5.js → dist-GJCIKH2C.js} +5 -5
- package/dist/{dist-FNAGMTUI.js → dist-JFUUDAI3.js} +17 -3
- package/dist/{dist-VOVN64Y2.js → dist-W5476E2U.js} +5 -5
- package/dist/{dist-K5GASNBV.js → dist-Z3GSHEFO.js} +7 -6
- package/dist/index.js +391 -215
- package/dist/index.js.map +1 -1
- package/dist/{prepared-state-5FIGV4BE-WPHOEDA6.js → prepared-state-LW2PKTEQ-5YMKG7UN.js} +2 -2
- package/package.json +28 -27
- package/runtime/_shared/agentbox-checkpoint-cleanup +0 -0
- package/runtime/_shared/agentbox-dockerd-start +0 -0
- package/runtime/_shared/agentbox-open +0 -0
- package/runtime/_shared/agentbox-portless-trust +0 -0
- package/runtime/_shared/agentbox-vnc-start +0 -0
- package/runtime/_shared/ctl.cjs +3 -1
- package/runtime/_shared/gh-shim +0 -0
- package/runtime/_shared/git-shim +0 -0
- package/runtime/_shared/linear-shim +0 -0
- package/runtime/_shared/ntn-shim +0 -0
- package/runtime/docker/Dockerfile.box +12 -0
- package/runtime/docker/packages/ctl/dist/bin.cjs +3 -1
- package/runtime/docker/packages/sandbox-docker/scripts/agentbox-checkpoint-cleanup +0 -0
- package/runtime/docker/packages/sandbox-docker/scripts/agentbox-dockerd-start +0 -0
- package/runtime/docker/packages/sandbox-docker/scripts/agentbox-open +0 -0
- package/runtime/docker/packages/sandbox-docker/scripts/agentbox-portless-trust +0 -0
- package/runtime/docker/packages/sandbox-docker/scripts/agentbox-sshd-start +44 -0
- package/runtime/docker/packages/sandbox-docker/scripts/agentbox-vnc-start +0 -0
- package/runtime/docker/packages/sandbox-docker/scripts/chromium-resolver +0 -0
- package/runtime/docker/packages/sandbox-docker/scripts/gh-shim +0 -0
- package/runtime/docker/packages/sandbox-docker/scripts/git-shim +0 -0
- package/runtime/docker/packages/sandbox-docker/scripts/linear-shim +0 -0
- package/runtime/docker/packages/sandbox-docker/scripts/ntn-shim +0 -0
- package/runtime/e2b/agentbox-checkpoint-cleanup +0 -0
- package/runtime/e2b/agentbox-dockerd-start +0 -0
- package/runtime/e2b/agentbox-open +0 -0
- package/runtime/e2b/agentbox-vnc-start +0 -0
- package/runtime/e2b/ctl.cjs +3 -1
- package/runtime/e2b/gh-shim +0 -0
- package/runtime/e2b/git-shim +0 -0
- package/runtime/e2b/linear-shim +0 -0
- package/runtime/e2b/ntn-shim +0 -0
- package/runtime/e2b/scripts/build-template.sh +0 -0
- package/runtime/hetzner/agentbox-checkpoint-cleanup +0 -0
- package/runtime/hetzner/agentbox-dockerd-start +0 -0
- package/runtime/hetzner/agentbox-open +0 -0
- package/runtime/hetzner/agentbox-portless-trust +0 -0
- package/runtime/hetzner/agentbox-vnc-start +0 -0
- package/runtime/hetzner/ctl.cjs +3 -1
- package/runtime/hetzner/gh-shim +0 -0
- package/runtime/hetzner/git-shim +0 -0
- package/runtime/hetzner/linear-shim +0 -0
- package/runtime/hetzner/ntn-shim +0 -0
- package/runtime/hetzner/scripts/install-box.sh +0 -0
- package/runtime/hub/apps/hub/.next/BUILD_ID +1 -1
- package/runtime/hub/apps/hub/.next/app-path-routes-manifest.json +2 -0
- package/runtime/hub/apps/hub/.next/build-manifest.json +3 -3
- package/runtime/hub/apps/hub/.next/routes-manifest.json +14 -0
- package/runtime/hub/apps/hub/.next/server/app/(auth)/signin/page_client-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/open/route/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/open/route/build-manifest.json +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/open/route/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/open/route.js +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/open/route.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/open/route.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/boxes/[id]/open/route_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/open-targets/route/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/open-targets/route/build-manifest.json +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/open-targets/route/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/open-targets/route.js +8 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/open-targets/route.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/open-targets/route.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/open-targets/route_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page_client-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page_client-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page_client-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page_client-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.html +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/app-paths-manifest.json +2 -0
- 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
- package/runtime/hub/apps/hub/.next/server/chunks/1jcg_server_app_(dashboard)_api_v1_boxes_[id]_open_route_actions_1agwl8h.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0keu6we._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0ql4fjo._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0vs8fma._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0w9ud8u._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0yhb0gc._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1-0flwc._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1a50b07._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1bqbkd5._.js +2 -2
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1dn_3i1._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1hqla7-._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1js2jdv._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1nepkp-._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1q5bqse._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1qa4a0v._.js +2 -2
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1thipug._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1v9om6g._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/_06f2faq._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/_0f3molr._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0ro6vh6._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_0b_hsjl._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_app_(dashboard)_boxes_[id]_page_tsx_1-j_972._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_app_(dashboard)_boxes_components_box-table_tsx_0a9pyn_._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/functions-config-manifest.json +2 -0
- package/runtime/hub/apps/hub/.next/server/middleware-build-manifest.js +3 -3
- package/runtime/hub/apps/hub/.next/server/pages/500.html +1 -1
- package/runtime/hub/apps/hub/.next/static/chunks/1py5tlz57h7ra.js +1 -0
- package/runtime/hub/apps/hub/.next/static/chunks/{3y2c7woqhtx9s.js → 23fswvjrabu89.js} +1 -1
- package/runtime/hub/apps/hub/.next/static/chunks/3nedwutnzpdis.css +3 -0
- package/runtime/hub/apps/hub/.next/static/chunks/3p86ecqhr_7yy.js +1 -0
- package/runtime/hub/apps/hub/.next/static/chunks/3qof5hg87qf5n.js +1 -0
- package/runtime/hub/apps/hub/{chunk-673QOHSR.js → chunk-6HD4PARX.js} +9 -9
- package/runtime/hub/apps/hub/{chunk-7J6ZFTT4.js → chunk-JQFB2CNA.js} +132 -16
- package/runtime/hub/apps/hub/{chunk-5XQ3T3W2.js → chunk-K6RA5GJI.js} +231 -126
- package/runtime/hub/apps/hub/{dist-GCALYJN7.js → dist-3HR4RIPE.js} +17 -3
- package/runtime/hub/apps/hub/{dist-EI54M5DP.js → dist-7GNKBKFV.js} +29 -42
- package/runtime/hub/apps/hub/{dist-MOCUH2OC.js → dist-JWVTVHBT.js} +4 -4
- package/runtime/hub/apps/hub/{dist-LYTWBTUL.js → dist-OUNL2TCW.js} +4 -4
- package/runtime/hub/apps/hub/{dist-K7WHNDZB.js → dist-TOHA4OA5.js} +4 -4
- package/runtime/hub/apps/hub/{prepared-state-5FIGV4BE-D2HJEY2L.js → prepared-state-LW2PKTEQ-7BCXARGA.js} +1 -1
- package/runtime/hub/apps/hub/server.js +105 -24
- package/runtime/relay/bin.cjs +3 -1
- package/runtime/vercel/agentbox-checkpoint-cleanup +0 -0
- package/runtime/vercel/agentbox-dockerd-start +0 -0
- package/runtime/vercel/agentbox-open +0 -0
- package/runtime/vercel/agentbox-vnc-start +0 -0
- package/runtime/vercel/ctl.cjs +3 -1
- package/runtime/vercel/gh-shim +0 -0
- package/runtime/vercel/git-shim +0 -0
- package/runtime/vercel/linear-shim +0 -0
- package/runtime/vercel/ntn-shim +0 -0
- package/runtime/vercel/scripts/provision.sh +0 -0
- package/LICENSE +0 -21
- package/dist/chunk-5DZTXHLQ.js.map +0 -1
- package/dist/chunk-ES2DDCAC.js.map +0 -1
- package/runtime/hub/apps/hub/.next/static/chunks/0dx4alyqu7cq1.css +0 -3
- package/runtime/hub/apps/hub/.next/static/chunks/332lo0ac7l2wv.js +0 -1
- package/runtime/hub/apps/hub/.next/static/chunks/3gdqmzzl34ilu.js +0 -1
- package/runtime/hub/apps/hub/.next/static/chunks/44exu5uemf-ev.js +0 -1
- /package/dist/{_cloud-attach-Y5WZ7F53.js.map → _cloud-attach-RFPLNACE.js.map} +0 -0
- /package/dist/{chunk-BMCT3LBE.js.map → chunk-6OQENOJZ.js.map} +0 -0
- /package/dist/{chunk-3KAWXDQ4.js.map → chunk-JXDSSSXS.js.map} +0 -0
- /package/dist/{chunk-S4OWE3UD.js.map → chunk-L5SOSNQI.js.map} +0 -0
- /package/dist/{chunk-V2NCCC2B.js.map → chunk-Q626V2YX.js.map} +0 -0
- /package/dist/{chunk-7HAGPF4X.js.map → chunk-QVWGQJV6.js.map} +0 -0
- /package/dist/{dist-SJRMFVRV.js.map → dist-GEHCZJCS.js.map} +0 -0
- /package/dist/{dist-AN5NUXA5.js.map → dist-GJCIKH2C.js.map} +0 -0
- /package/dist/{dist-FNAGMTUI.js.map → dist-JFUUDAI3.js.map} +0 -0
- /package/dist/{dist-K5GASNBV.js.map → dist-W5476E2U.js.map} +0 -0
- /package/dist/{dist-VOVN64Y2.js.map → dist-Z3GSHEFO.js.map} +0 -0
- /package/dist/{prepared-state-5FIGV4BE-WPHOEDA6.js.map → prepared-state-LW2PKTEQ-5YMKG7UN.js.map} +0 -0
- /package/runtime/hub/apps/hub/.next/static/{zT1paOSXMJpAPsZ1dFK2V → 6WtaFwavHBpin3eT7-HjR}/_buildManifest.js +0 -0
- /package/runtime/hub/apps/hub/.next/static/{zT1paOSXMJpAPsZ1dFK2V → 6WtaFwavHBpin3eT7-HjR}/_clientMiddlewareManifest.js +0 -0
- /package/runtime/hub/apps/hub/.next/static/{zT1paOSXMJpAPsZ1dFK2V → 6WtaFwavHBpin3eT7-HjR}/_ssgManifest.js +0 -0
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
import {
|
|
13
13
|
AmbiguousBoxError,
|
|
14
14
|
BOX_HOME,
|
|
15
|
+
BUILD_CONTEXT_DIR,
|
|
15
16
|
BoxNotFoundError,
|
|
16
17
|
DEFAULT_BOX_IMAGE,
|
|
17
18
|
DEFAULT_ENV_PATTERNS,
|
|
@@ -39,6 +40,7 @@ import {
|
|
|
39
40
|
imageInfo,
|
|
40
41
|
makeHostGitPorts,
|
|
41
42
|
makeSyncContext,
|
|
43
|
+
mintSshKey,
|
|
42
44
|
parseReplaceRules,
|
|
43
45
|
parseReplacements,
|
|
44
46
|
pickFreshBranch,
|
|
@@ -57,8 +59,9 @@ import {
|
|
|
57
59
|
sanitizeCodexConfigForBox,
|
|
58
60
|
seedAgentsVolume,
|
|
59
61
|
setInstallMethodNative,
|
|
62
|
+
syncAgentboxSshConfig,
|
|
60
63
|
trustWorkspace
|
|
61
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-CKC3CP7Y.js";
|
|
62
65
|
|
|
63
66
|
// ../../packages/sandbox-docker/dist/index.js
|
|
64
67
|
import { spawnSync } from "child_process";
|
|
@@ -100,7 +103,7 @@ import { execa as execa9 } from "execa";
|
|
|
100
103
|
import { mkdir as mkdir7, stat as stat7 } from "fs/promises";
|
|
101
104
|
import { homedir as homedir10 } from "os";
|
|
102
105
|
import { basename as basename4, join as join12, resolve as resolve4 } from "path";
|
|
103
|
-
import { execa as
|
|
106
|
+
import { execa as execa16 } from "execa";
|
|
104
107
|
|
|
105
108
|
// ../../packages/ctl/dist/index.js
|
|
106
109
|
import { readFile as readFile2 } from "fs/promises";
|
|
@@ -984,22 +987,23 @@ async function loadCarrySection(path) {
|
|
|
984
987
|
|
|
985
988
|
// ../../packages/sandbox-docker/dist/index.js
|
|
986
989
|
import { randomBytes as randomBytes3 } from "crypto";
|
|
990
|
+
import { execa as execa10 } from "execa";
|
|
987
991
|
import { existsSync as existsSync2 } from "fs";
|
|
988
992
|
import { readFile as readFile42 } from "fs/promises";
|
|
989
993
|
import { homedir as homedir6 } from "os";
|
|
990
994
|
import { join as join8 } from "path";
|
|
991
|
-
import { execa as execa10 } from "execa";
|
|
992
995
|
import { execa as execa11 } from "execa";
|
|
996
|
+
import { execa as execa12 } from "execa";
|
|
993
997
|
import { mkdir as mkdir4, readdir as readdir32, rm as rm3, stat as stat5 } from "fs/promises";
|
|
994
998
|
import { homedir as homedir7, platform } from "os";
|
|
995
999
|
import { join as join9, resolve as resolve2 } from "path";
|
|
996
1000
|
import { mkdir as mkdir5, mkdtemp as mkdtemp3, readFile as readFile5, readdir as readdir4, rm as rm4, writeFile as writeFile22 } from "fs/promises";
|
|
997
1001
|
import { homedir as homedir8, tmpdir as tmpdir3 } from "os";
|
|
998
1002
|
import { basename as basename3, join as join10 } from "path";
|
|
999
|
-
import { execa as execa12 } from "execa";
|
|
1000
|
-
import { stat as stat6 } from "fs/promises";
|
|
1001
1003
|
import { execa as execa13 } from "execa";
|
|
1004
|
+
import { stat as stat6 } from "fs/promises";
|
|
1002
1005
|
import { execa as execa14 } from "execa";
|
|
1006
|
+
import { execa as execa15 } from "execa";
|
|
1003
1007
|
import { spawn } from "child_process";
|
|
1004
1008
|
import { randomBytes as randomBytes22 } from "crypto";
|
|
1005
1009
|
import { existsSync as existsSync3, openSync } from "fs";
|
|
@@ -2054,15 +2058,15 @@ async function takeQueueLoginCode(id) {
|
|
|
2054
2058
|
var FAILURE_BACKOFF_MS = 5 * 6e4;
|
|
2055
2059
|
|
|
2056
2060
|
// ../../packages/sandbox-docker/dist/index.js
|
|
2057
|
-
import { execa as
|
|
2061
|
+
import { execa as execa18 } from "execa";
|
|
2058
2062
|
import { readdir as readdir6, rm as rm6, stat as stat8 } from "fs/promises";
|
|
2059
2063
|
import { join as join14 } from "path";
|
|
2060
|
-
import { execa as
|
|
2064
|
+
import { execa as execa17 } from "execa";
|
|
2061
2065
|
import { join as join13 } from "path";
|
|
2062
2066
|
import { homedir as homedir11 } from "os";
|
|
2063
2067
|
import { join as join15 } from "path";
|
|
2064
|
-
import { execa as execa18 } from "execa";
|
|
2065
2068
|
import { execa as execa19 } from "execa";
|
|
2069
|
+
import { execa as execa20 } from "execa";
|
|
2066
2070
|
import { spawn as spawn2 } from "child_process";
|
|
2067
2071
|
import { existsSync as existsSync4, openSync as openSync2 } from "fs";
|
|
2068
2072
|
import { mkdir as mkdir8, readFile as readFile7, unlink as unlink22, writeFile as writeFile4 } from "fs/promises";
|
|
@@ -5628,6 +5632,53 @@ function buildVncUrls(record, engine) {
|
|
|
5628
5632
|
}
|
|
5629
5633
|
return urls;
|
|
5630
5634
|
}
|
|
5635
|
+
var SSH_CONTAINER_PORT = 22;
|
|
5636
|
+
async function launchSshdDaemon(container, timeoutMs = 5e3) {
|
|
5637
|
+
const result = await execInBox(container, ["/usr/local/bin/agentbox-sshd-start"], {
|
|
5638
|
+
user: "root",
|
|
5639
|
+
detach: true
|
|
5640
|
+
});
|
|
5641
|
+
if (result.exitCode !== 0) {
|
|
5642
|
+
return { up: false, reason: `docker exec failed: ${result.stderr || result.stdout}` };
|
|
5643
|
+
}
|
|
5644
|
+
const deadline = Date.now() + timeoutMs;
|
|
5645
|
+
while (Date.now() < deadline) {
|
|
5646
|
+
const probe = await execInBox(
|
|
5647
|
+
container,
|
|
5648
|
+
["bash", "-lc", "(echo > /dev/tcp/127.0.0.1/22) 2>/dev/null"],
|
|
5649
|
+
{ user: "vscode" }
|
|
5650
|
+
);
|
|
5651
|
+
if (probe.exitCode === 0) return { up: true };
|
|
5652
|
+
await new Promise((r) => setTimeout(r, 150));
|
|
5653
|
+
}
|
|
5654
|
+
return { up: false, reason: `sshd did not bind 22 within ${String(timeoutMs)}ms` };
|
|
5655
|
+
}
|
|
5656
|
+
async function installAuthorizedKey(container, publicKey) {
|
|
5657
|
+
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";
|
|
5658
|
+
const result = await execa10(
|
|
5659
|
+
"docker",
|
|
5660
|
+
["exec", "--user", "root", "-i", container, "sh", "-c", script],
|
|
5661
|
+
{ input: publicKey.endsWith("\n") ? publicKey : `${publicKey}
|
|
5662
|
+
`, reject: false }
|
|
5663
|
+
);
|
|
5664
|
+
if (result.exitCode !== 0) {
|
|
5665
|
+
return {
|
|
5666
|
+
ok: false,
|
|
5667
|
+
reason: `docker exec failed (exit ${String(result.exitCode)}): ${(result.stderr ?? "").toString().slice(0, 400)}`
|
|
5668
|
+
};
|
|
5669
|
+
}
|
|
5670
|
+
return { ok: true };
|
|
5671
|
+
}
|
|
5672
|
+
async function setUpBoxSshd(container, sshDir, comment) {
|
|
5673
|
+
const key = await mintSshKey(sshDir, comment);
|
|
5674
|
+
const installed = await installAuthorizedKey(container, key.publicKey);
|
|
5675
|
+
if (!installed.ok) {
|
|
5676
|
+
return { sshHostPort: null, identityFile: key.privatePath, up: false, reason: installed.reason };
|
|
5677
|
+
}
|
|
5678
|
+
const launch = await launchSshdDaemon(container);
|
|
5679
|
+
const sshHostPort = await publishedHostPort(container, SSH_CONTAINER_PORT);
|
|
5680
|
+
return { sshHostPort, identityFile: key.privatePath, up: launch.up, reason: launch.reason };
|
|
5681
|
+
}
|
|
5631
5682
|
var WEB_CONTAINER_PORT = 80;
|
|
5632
5683
|
var PORTLESS_BIN = "portless";
|
|
5633
5684
|
var SUB_VERSION = ["--version"];
|
|
@@ -5639,7 +5690,7 @@ var cached = null;
|
|
|
5639
5690
|
async function detectPortless() {
|
|
5640
5691
|
if (cached !== null) return cached;
|
|
5641
5692
|
try {
|
|
5642
|
-
const ver = await
|
|
5693
|
+
const ver = await execa11(PORTLESS_BIN, SUB_VERSION, { reject: false });
|
|
5643
5694
|
if (ver.exitCode !== 0) {
|
|
5644
5695
|
cached = { installed: false, proxyRunning: false };
|
|
5645
5696
|
return cached;
|
|
@@ -5659,7 +5710,7 @@ function resetPortlessCache() {
|
|
|
5659
5710
|
}
|
|
5660
5711
|
async function portlessAlias(name, port) {
|
|
5661
5712
|
try {
|
|
5662
|
-
const r = await
|
|
5713
|
+
const r = await execa11(PORTLESS_BIN, [SUB_ALIAS, name, String(port)], { reject: false });
|
|
5663
5714
|
return r.exitCode === 0;
|
|
5664
5715
|
} catch {
|
|
5665
5716
|
return false;
|
|
@@ -5667,7 +5718,7 @@ async function portlessAlias(name, port) {
|
|
|
5667
5718
|
}
|
|
5668
5719
|
async function portlessUnalias(name) {
|
|
5669
5720
|
try {
|
|
5670
|
-
const r = await
|
|
5721
|
+
const r = await execa11(PORTLESS_BIN, [SUB_ALIAS, SUB_ALIAS_REMOVE, name], { reject: false });
|
|
5671
5722
|
return r.exitCode === 0;
|
|
5672
5723
|
} catch {
|
|
5673
5724
|
return false;
|
|
@@ -5676,7 +5727,7 @@ async function portlessUnalias(name) {
|
|
|
5676
5727
|
async function portlessGetUrl(name) {
|
|
5677
5728
|
const fallback = `https://${name}.localhost`;
|
|
5678
5729
|
try {
|
|
5679
|
-
const r = await
|
|
5730
|
+
const r = await execa11(PORTLESS_BIN, [SUB_GET, name], { reject: false });
|
|
5680
5731
|
const out = (r.stdout ?? "").trim();
|
|
5681
5732
|
if (r.exitCode === 0 && /^https?:\/\//.test(out)) return out;
|
|
5682
5733
|
} catch {
|
|
@@ -5720,7 +5771,7 @@ function portlessBrowserEnv(boxName, opts) {
|
|
|
5720
5771
|
}
|
|
5721
5772
|
async function installPortless() {
|
|
5722
5773
|
try {
|
|
5723
|
-
const r = await
|
|
5774
|
+
const r = await execa11("npm", ["install", "-g", "portless"], { reject: false });
|
|
5724
5775
|
return r.exitCode === 0;
|
|
5725
5776
|
} catch {
|
|
5726
5777
|
return false;
|
|
@@ -5728,7 +5779,7 @@ async function installPortless() {
|
|
|
5728
5779
|
}
|
|
5729
5780
|
async function startPortlessProxy() {
|
|
5730
5781
|
try {
|
|
5731
|
-
const r = await
|
|
5782
|
+
const r = await execa11(
|
|
5732
5783
|
PORTLESS_BIN,
|
|
5733
5784
|
["proxy", "start", "--no-tls", "-p", String(PORTLESS_PROXY_PORT)],
|
|
5734
5785
|
{ reject: false }
|
|
@@ -5740,7 +5791,7 @@ async function startPortlessProxy() {
|
|
|
5740
5791
|
}
|
|
5741
5792
|
async function resolvePortlessBin() {
|
|
5742
5793
|
try {
|
|
5743
|
-
const r = await
|
|
5794
|
+
const r = await execa11("command", ["-v", PORTLESS_BIN], { reject: false, shell: true });
|
|
5744
5795
|
const out = (r.stdout ?? "").trim();
|
|
5745
5796
|
if (r.exitCode === 0 && out.startsWith("/")) return out;
|
|
5746
5797
|
} catch {
|
|
@@ -5760,14 +5811,14 @@ async function startPortlessProxyRoot() {
|
|
|
5760
5811
|
const q = shellSingleQuote(bin);
|
|
5761
5812
|
const shellCmd = `${q} proxy start && ${q} trust`;
|
|
5762
5813
|
const script = `do shell script "${escapeForAppleScript(shellCmd)}" with administrator privileges with prompt "AgentBox wants to start the Portless proxy on port 443."`;
|
|
5763
|
-
const r2 = await
|
|
5814
|
+
const r2 = await execa11("osascript", ["-e", script], { reject: false });
|
|
5764
5815
|
if (r2.exitCode === 0) return "started";
|
|
5765
5816
|
if (/User canceled|-128/i.test(r2.stderr ?? "")) return "cancelled";
|
|
5766
5817
|
return "failed";
|
|
5767
5818
|
}
|
|
5768
|
-
const r = await
|
|
5819
|
+
const r = await execa11(bin, ["proxy", "start"], { reject: false, stdio: "inherit" });
|
|
5769
5820
|
if (r.exitCode !== 0) return "failed";
|
|
5770
|
-
await
|
|
5821
|
+
await execa11(bin, ["trust"], { reject: false, stdio: "inherit" });
|
|
5771
5822
|
return "started";
|
|
5772
5823
|
} catch {
|
|
5773
5824
|
return "failed";
|
|
@@ -5817,7 +5868,7 @@ async function resolvePortlessHostStateDir(override) {
|
|
|
5817
5868
|
async function isProxyRunning() {
|
|
5818
5869
|
if (await findLivePortlessStateDir() !== null) return true;
|
|
5819
5870
|
try {
|
|
5820
|
-
const r = await
|
|
5871
|
+
const r = await execa11("pgrep", ["-f", "portless proxy"], { reject: false });
|
|
5821
5872
|
return r.exitCode === 0 && (r.stdout ?? "").trim().length > 0;
|
|
5822
5873
|
} catch {
|
|
5823
5874
|
return false;
|
|
@@ -5873,7 +5924,7 @@ async function createSnapshot(opts) {
|
|
|
5873
5924
|
const excluded = opts.excluded ?? EXCLUDE_DIRS;
|
|
5874
5925
|
await mkdir4(SNAPSHOTS_ROOT, { recursive: true });
|
|
5875
5926
|
const cpArgs = platform() === "darwin" ? ["-cR"] : ["-R"];
|
|
5876
|
-
await
|
|
5927
|
+
await execa12("cp", [...cpArgs, `${source}/`, destination]);
|
|
5877
5928
|
const toPrune = await findExcludedDirs(destination, excluded);
|
|
5878
5929
|
await Promise.all(toPrune.map((p) => rm3(p, { recursive: true, force: true })));
|
|
5879
5930
|
return { destination, prunedPaths: toPrune };
|
|
@@ -5998,7 +6049,7 @@ async function runCleanup(container, log) {
|
|
|
5998
6049
|
}
|
|
5999
6050
|
}
|
|
6000
6051
|
async function inspectImageConfig(imageRef) {
|
|
6001
|
-
const r = await
|
|
6052
|
+
const r = await execa13("docker", ["image", "inspect", imageRef], { reject: false });
|
|
6002
6053
|
if (r.exitCode !== 0) {
|
|
6003
6054
|
throw new CheckpointError(`docker image inspect ${imageRef} failed`, r.stdout, r.stderr);
|
|
6004
6055
|
}
|
|
@@ -6074,14 +6125,14 @@ async function createCheckpoint(opts) {
|
|
|
6074
6125
|
await runCleanup(box.container, log);
|
|
6075
6126
|
if (type === "layered") {
|
|
6076
6127
|
log(`docker commit ${box.container} -> ${tag} (layered)`);
|
|
6077
|
-
const r = await
|
|
6128
|
+
const r = await execa13("docker", ["commit", box.container, tag], { reject: false });
|
|
6078
6129
|
if (r.exitCode !== 0) {
|
|
6079
6130
|
throw new CheckpointError(`docker commit failed for ${box.container}`, r.stdout, r.stderr);
|
|
6080
6131
|
}
|
|
6081
6132
|
} else {
|
|
6082
6133
|
log(`docker commit ${box.container} -> <intermediate> (flattened path)`);
|
|
6083
6134
|
const intermediate = `${tag}-intermediate`;
|
|
6084
|
-
const commit = await
|
|
6135
|
+
const commit = await execa13("docker", ["commit", box.container, intermediate], {
|
|
6085
6136
|
reject: false
|
|
6086
6137
|
});
|
|
6087
6138
|
if (commit.exitCode !== 0) {
|
|
@@ -6126,7 +6177,7 @@ async function createCheckpoint(opts) {
|
|
|
6126
6177
|
}
|
|
6127
6178
|
async function flattenImage(sourceTag, destTag, log) {
|
|
6128
6179
|
const tmpName = `agentbox-flatten-${Date.now().toString(36)}`;
|
|
6129
|
-
const create = await
|
|
6180
|
+
const create = await execa13(
|
|
6130
6181
|
"docker",
|
|
6131
6182
|
["create", "--name", tmpName, sourceTag, "sleep", "0"],
|
|
6132
6183
|
{ reject: false }
|
|
@@ -6138,7 +6189,7 @@ async function flattenImage(sourceTag, destTag, log) {
|
|
|
6138
6189
|
try {
|
|
6139
6190
|
const rootfsPath = join10(scratch, "rootfs.tar");
|
|
6140
6191
|
log(`exporting rootfs of ${sourceTag} to ${rootfsPath}`);
|
|
6141
|
-
const exp = await
|
|
6192
|
+
const exp = await execa13("docker", ["export", "-o", rootfsPath, tmpName], { reject: false });
|
|
6142
6193
|
if (exp.exitCode !== 0) {
|
|
6143
6194
|
throw new CheckpointError(`docker export failed`, exp.stdout, exp.stderr);
|
|
6144
6195
|
}
|
|
@@ -6151,7 +6202,7 @@ async function flattenImage(sourceTag, destTag, log) {
|
|
|
6151
6202
|
];
|
|
6152
6203
|
await writeFile22(join10(scratch, "Dockerfile"), lines.join("\n") + "\n", "utf8");
|
|
6153
6204
|
log(`building flattened ${destTag} from rootfs.tar (FROM scratch)`);
|
|
6154
|
-
const build = await
|
|
6205
|
+
const build = await execa13(
|
|
6155
6206
|
"docker",
|
|
6156
6207
|
["build", "-t", destTag, "-f", join10(scratch, "Dockerfile"), scratch],
|
|
6157
6208
|
{ reject: false }
|
|
@@ -6160,7 +6211,7 @@ async function flattenImage(sourceTag, destTag, log) {
|
|
|
6160
6211
|
throw new CheckpointError(`flatten docker build failed`, build.stdout, build.stderr);
|
|
6161
6212
|
}
|
|
6162
6213
|
} finally {
|
|
6163
|
-
await
|
|
6214
|
+
await execa13("docker", ["rm", "-f", tmpName], { reject: false });
|
|
6164
6215
|
await rm4(scratch, { recursive: true, force: true });
|
|
6165
6216
|
}
|
|
6166
6217
|
}
|
|
@@ -6205,7 +6256,7 @@ async function pathExists4(p) {
|
|
|
6205
6256
|
}
|
|
6206
6257
|
async function writeBoxEnvFile(container, env) {
|
|
6207
6258
|
const body = formatBoxEnvBody(env);
|
|
6208
|
-
const result = await
|
|
6259
|
+
const result = await execa14(
|
|
6209
6260
|
"docker",
|
|
6210
6261
|
["exec", "--user", "root", "-i", container, "sh", "-c", "umask 022 && cat > /etc/agentbox/box.env"],
|
|
6211
6262
|
{ input: body, reject: false }
|
|
@@ -6229,7 +6280,7 @@ function shellSingleQuote2(s) {
|
|
|
6229
6280
|
return `'${s.replace(/'/g, `'\\''`)}'`;
|
|
6230
6281
|
}
|
|
6231
6282
|
async function ensureHomeOwnedByVscode(container) {
|
|
6232
|
-
await
|
|
6283
|
+
await execa15(
|
|
6233
6284
|
"docker",
|
|
6234
6285
|
[
|
|
6235
6286
|
"exec",
|
|
@@ -6901,8 +6952,8 @@ async function ensureAgentboxTasksFile(container, services, opts = {}) {
|
|
|
6901
6952
|
return { status: "wrote" };
|
|
6902
6953
|
}
|
|
6903
6954
|
async function writeFileInBox(container, path, content) {
|
|
6904
|
-
const { execa:
|
|
6905
|
-
const result = await
|
|
6955
|
+
const { execa: execa21 } = await import("execa");
|
|
6956
|
+
const result = await execa21(
|
|
6906
6957
|
"docker",
|
|
6907
6958
|
["exec", "-i", "--user", "vscode", container, "sh", "-c", `cat > ${shellQuote(path)}`],
|
|
6908
6959
|
{ input: content, reject: false }
|
|
@@ -6943,7 +6994,7 @@ async function pathExists5(p) {
|
|
|
6943
6994
|
}
|
|
6944
6995
|
async function trustInBoxPortlessCa(container, log) {
|
|
6945
6996
|
const script = "agentbox-portless-trust /home/vscode/.portless/ca.pem >/dev/null 2>&1 || true; echo 'export NODE_EXTRA_CA_CERTS=/usr/local/share/ca-certificates/agentbox-portless-ca.crt' > /etc/profile.d/agentbox-portless-ca.sh 2>/dev/null || true";
|
|
6946
|
-
const r = await
|
|
6997
|
+
const r = await execa16(
|
|
6947
6998
|
"docker",
|
|
6948
6999
|
["exec", "--user", "root", container, "bash", "-lc", script],
|
|
6949
7000
|
{ reject: false }
|
|
@@ -7270,6 +7321,9 @@ async function createBox(opts) {
|
|
|
7270
7321
|
const webPortMappings = [
|
|
7271
7322
|
{ hostPort: 0, containerPort: WEB_CONTAINER_PORT, hostIp: "127.0.0.1" }
|
|
7272
7323
|
];
|
|
7324
|
+
const sshPortMappings = [
|
|
7325
|
+
{ hostPort: 0, containerPort: SSH_CONTAINER_PORT, hostIp: "127.0.0.1" }
|
|
7326
|
+
];
|
|
7273
7327
|
const agentboxEnv = {
|
|
7274
7328
|
AGENTBOX: "1",
|
|
7275
7329
|
AGENTBOX_BOX_NAME: name,
|
|
@@ -7319,6 +7373,8 @@ async function createBox(opts) {
|
|
|
7319
7373
|
vncContainerPort: vncEnabled ? VNC_CONTAINER_PORT : void 0,
|
|
7320
7374
|
vncPassword,
|
|
7321
7375
|
webContainerPort: WEB_CONTAINER_PORT,
|
|
7376
|
+
sshEnabled: true,
|
|
7377
|
+
sshContainerPort: SSH_CONTAINER_PORT,
|
|
7322
7378
|
dockerVolume,
|
|
7323
7379
|
dockerCacheShared: dockerCacheShared || void 0,
|
|
7324
7380
|
projectRoot: opts.projectRoot,
|
|
@@ -7333,7 +7389,7 @@ async function createBox(opts) {
|
|
|
7333
7389
|
image: imageRef,
|
|
7334
7390
|
extraVolumes,
|
|
7335
7391
|
limits: effectiveLimits,
|
|
7336
|
-
portMappings: [...vncPortMappings, ...webPortMappings],
|
|
7392
|
+
portMappings: [...vncPortMappings, ...webPortMappings, ...sshPortMappings],
|
|
7337
7393
|
env: {
|
|
7338
7394
|
AGENTBOX_BOX_ID: id,
|
|
7339
7395
|
...agentboxEnv,
|
|
@@ -7372,7 +7428,7 @@ async function createBox(opts) {
|
|
|
7372
7428
|
} catch (err) {
|
|
7373
7429
|
if (opts.useBranch !== void 0) {
|
|
7374
7430
|
log(`seedWorkspace failed for --use-branch ${opts.useBranch}; cleaning up the box`);
|
|
7375
|
-
await
|
|
7431
|
+
await execa16("docker", ["rm", "-f", containerName], { reject: false });
|
|
7376
7432
|
await removeBoxRecord(id);
|
|
7377
7433
|
for (const w of gitWorktreeRecords) {
|
|
7378
7434
|
await removeInBoxWorktree({
|
|
@@ -7425,7 +7481,7 @@ async function createBox(opts) {
|
|
|
7425
7481
|
else log(`agentbox-ctl daemon did not become reachable: ${ctl.reason}`);
|
|
7426
7482
|
if (opts.withPlaywright) {
|
|
7427
7483
|
log("installing @playwright/cli@latest (--with-playwright)");
|
|
7428
|
-
const result = await
|
|
7484
|
+
const result = await execa16(
|
|
7429
7485
|
"docker",
|
|
7430
7486
|
[
|
|
7431
7487
|
"exec",
|
|
@@ -7489,6 +7545,16 @@ async function createBox(opts) {
|
|
|
7489
7545
|
`web port reserved on host 127.0.0.1:${String(webHostPort)} (forwards to the web service once agentbox.yaml sets a service expose:)`
|
|
7490
7546
|
);
|
|
7491
7547
|
}
|
|
7548
|
+
const ssh = await setUpBoxSshd(
|
|
7549
|
+
containerName,
|
|
7550
|
+
join12(boxDir, "ssh"),
|
|
7551
|
+
`agentbox-${name}-${id}`
|
|
7552
|
+
);
|
|
7553
|
+
if (ssh.up && ssh.sshHostPort) {
|
|
7554
|
+
log(`sshd up on host 127.0.0.1:${String(ssh.sshHostPort)} (loopback-only)`);
|
|
7555
|
+
} else {
|
|
7556
|
+
log(`sshd did not come up: ${ssh.reason ?? "unknown"} (open/SSH unavailable; docker exec still works)`);
|
|
7557
|
+
}
|
|
7492
7558
|
let portlessAliasName;
|
|
7493
7559
|
let portlessUrl;
|
|
7494
7560
|
let portlessVncAliasName;
|
|
@@ -7539,12 +7605,25 @@ async function createBox(opts) {
|
|
|
7539
7605
|
carry: carrySummary,
|
|
7540
7606
|
vncHostPort: vncHostPort ?? void 0,
|
|
7541
7607
|
webHostPort: webHostPort ?? void 0,
|
|
7608
|
+
sshHostPort: ssh.sshHostPort ?? void 0,
|
|
7609
|
+
// Only advertise an ssh-config alias when sshd actually bound (`up`). Docker
|
|
7610
|
+
// publishes the -p 0:22 host port regardless, so gating on the port alone
|
|
7611
|
+
// would point `~/.ssh/config` at a dead loopback port when sshd failed to
|
|
7612
|
+
// start. A later `start`/`open` re-runs setUpBoxSshd and records it once up.
|
|
7613
|
+
ssh: ssh.up && ssh.sshHostPort ? { host: "127.0.0.1", user: "vscode", identityFile: ssh.identityFile, port: ssh.sshHostPort } : void 0,
|
|
7542
7614
|
portlessAlias: portlessAliasName,
|
|
7543
7615
|
portlessUrl,
|
|
7544
7616
|
portlessVncAlias: portlessVncAliasName,
|
|
7545
7617
|
portlessVncUrl
|
|
7546
7618
|
};
|
|
7547
7619
|
await recordBox(record);
|
|
7620
|
+
if (record.ssh) {
|
|
7621
|
+
try {
|
|
7622
|
+
await syncAgentboxSshConfig();
|
|
7623
|
+
} catch (err) {
|
|
7624
|
+
log(`ssh-config sync failed (best-effort): ${err instanceof Error ? err.message : String(err)}`);
|
|
7625
|
+
}
|
|
7626
|
+
}
|
|
7548
7627
|
return { record, imageBuilt: built, resync: resyncResult };
|
|
7549
7628
|
}
|
|
7550
7629
|
var DEFAULT_SHELL_SESSION = "shell";
|
|
@@ -7593,7 +7672,7 @@ function parseShellSessionList(stdout) {
|
|
|
7593
7672
|
return out;
|
|
7594
7673
|
}
|
|
7595
7674
|
async function listShellSessions(container, user) {
|
|
7596
|
-
const res = await
|
|
7675
|
+
const res = await execa17(
|
|
7597
7676
|
"docker",
|
|
7598
7677
|
[
|
|
7599
7678
|
"exec",
|
|
@@ -7617,7 +7696,7 @@ async function startShellSession(opts) {
|
|
|
7617
7696
|
const login = opts.login !== false;
|
|
7618
7697
|
const term = process.env["TERM"] ?? "xterm-256color";
|
|
7619
7698
|
const cmd = login ? "bash -l" : "bash";
|
|
7620
|
-
const result = await
|
|
7699
|
+
const result = await execa17(
|
|
7621
7700
|
"docker",
|
|
7622
7701
|
[
|
|
7623
7702
|
"exec",
|
|
@@ -7658,7 +7737,7 @@ function buildShellSessionAttachArgv(container, sessionName, user) {
|
|
|
7658
7737
|
}
|
|
7659
7738
|
async function shellSessionInfo(container, sessionName, user) {
|
|
7660
7739
|
const name = sessionName ?? DEFAULT_SHELL_SESSION;
|
|
7661
|
-
const has = await
|
|
7740
|
+
const has = await execa17(
|
|
7662
7741
|
"docker",
|
|
7663
7742
|
["exec", "--user", user ?? CONTAINER_USER, container, "tmux", "has-session", "-t", name],
|
|
7664
7743
|
{ reject: false }
|
|
@@ -7666,7 +7745,7 @@ async function shellSessionInfo(container, sessionName, user) {
|
|
|
7666
7745
|
return { running: has.exitCode === 0, sessionName: name };
|
|
7667
7746
|
}
|
|
7668
7747
|
async function killShellSession(container, sessionName, user) {
|
|
7669
|
-
const res = await
|
|
7748
|
+
const res = await execa17(
|
|
7670
7749
|
"docker",
|
|
7671
7750
|
[
|
|
7672
7751
|
"exec",
|
|
@@ -7868,6 +7947,27 @@ async function resyncBox(idOrName, onLog) {
|
|
|
7868
7947
|
const hadConflicts = repos.some((r) => r.mergeConflicts.length > 0 || r.overlaySkipped.length > 0);
|
|
7869
7948
|
return { repos, hadConflicts };
|
|
7870
7949
|
}
|
|
7950
|
+
async function refreshBoxSshd(box) {
|
|
7951
|
+
if (!box.sshEnabled) return box;
|
|
7952
|
+
const ssh = await setUpBoxSshd(
|
|
7953
|
+
box.container,
|
|
7954
|
+
join14(boxRunDirFor(box), "ssh"),
|
|
7955
|
+
`agentbox-${box.name}-${box.id}`
|
|
7956
|
+
);
|
|
7957
|
+
if (!ssh.up || !ssh.sshHostPort) return box;
|
|
7958
|
+
const port = ssh.sshHostPort;
|
|
7959
|
+
const changed = port !== box.sshHostPort || box.ssh?.port !== port;
|
|
7960
|
+
box.sshHostPort = port;
|
|
7961
|
+
box.ssh = { host: "127.0.0.1", user: "vscode", identityFile: ssh.identityFile, port };
|
|
7962
|
+
if (changed) {
|
|
7963
|
+
await recordBox(box);
|
|
7964
|
+
try {
|
|
7965
|
+
await syncAgentboxSshConfig();
|
|
7966
|
+
} catch {
|
|
7967
|
+
}
|
|
7968
|
+
}
|
|
7969
|
+
return box;
|
|
7970
|
+
}
|
|
7871
7971
|
async function startBox(idOrName) {
|
|
7872
7972
|
const box = await resolveBox(idOrName);
|
|
7873
7973
|
for (const w of box.gitWorktrees ?? []) {
|
|
@@ -7913,6 +8013,7 @@ async function startBox(idOrName) {
|
|
|
7913
8013
|
await recordBox(box);
|
|
7914
8014
|
}
|
|
7915
8015
|
}
|
|
8016
|
+
await refreshBoxSshd(box);
|
|
7916
8017
|
if (box.portlessAlias && box.webHostPort || box.portlessVncAlias && box.vncHostPort) {
|
|
7917
8018
|
try {
|
|
7918
8019
|
const portless = await detectPortless();
|
|
@@ -7970,7 +8071,7 @@ async function getBoxHostPaths(idOrName) {
|
|
|
7970
8071
|
}
|
|
7971
8072
|
async function dirSizeBytes(path) {
|
|
7972
8073
|
try {
|
|
7973
|
-
const result = await
|
|
8074
|
+
const result = await execa18("du", ["-sk", path], { reject: false });
|
|
7974
8075
|
if (result.exitCode !== 0) return null;
|
|
7975
8076
|
const sizeKb = Number.parseInt((result.stdout ?? "").split(/\s+/)[0] ?? "", 10);
|
|
7976
8077
|
if (Number.isNaN(sizeKb)) return null;
|
|
@@ -8096,6 +8197,12 @@ async function destroyBox(idOrName, opts = {}) {
|
|
|
8096
8197
|
} catch {
|
|
8097
8198
|
}
|
|
8098
8199
|
await removeBoxRecord(box.id);
|
|
8200
|
+
if (box.ssh) {
|
|
8201
|
+
try {
|
|
8202
|
+
await syncAgentboxSshConfig();
|
|
8203
|
+
} catch {
|
|
8204
|
+
}
|
|
8205
|
+
}
|
|
8099
8206
|
return { record: box, removedContainer, removedVolumes, removedSnapshot };
|
|
8100
8207
|
}
|
|
8101
8208
|
async function listSnapshotDirs() {
|
|
@@ -8115,7 +8222,7 @@ async function listBoxDirs() {
|
|
|
8115
8222
|
}
|
|
8116
8223
|
}
|
|
8117
8224
|
async function listCheckpointImageTags() {
|
|
8118
|
-
const r = await
|
|
8225
|
+
const r = await execa18(
|
|
8119
8226
|
"docker",
|
|
8120
8227
|
["image", "ls", "--format", "{{.Repository}}:{{.Tag}}", `${CHECKPOINT_IMAGE_PREFIX}*`],
|
|
8121
8228
|
{ reject: false }
|
|
@@ -8225,7 +8332,7 @@ async function pruneBoxes(opts = {}) {
|
|
|
8225
8332
|
} catch {
|
|
8226
8333
|
}
|
|
8227
8334
|
try {
|
|
8228
|
-
await
|
|
8335
|
+
await execa18("docker", ["image", "rm", RELAY_IMAGE_REF], { reject: false });
|
|
8229
8336
|
} catch {
|
|
8230
8337
|
}
|
|
8231
8338
|
try {
|
|
@@ -8287,7 +8394,7 @@ function splitPair(raw) {
|
|
|
8287
8394
|
return [parts[0].trim(), parts[1].trim()];
|
|
8288
8395
|
}
|
|
8289
8396
|
async function duBytes(path) {
|
|
8290
|
-
const result = await
|
|
8397
|
+
const result = await execa19("du", ["-sk", path], { reject: false });
|
|
8291
8398
|
if (result.exitCode !== 0) return null;
|
|
8292
8399
|
const kb = Number.parseInt((result.stdout ?? "").split(/\s+/)[0] ?? "", 10);
|
|
8293
8400
|
return Number.isNaN(kb) ? null : kb * 1024;
|
|
@@ -8300,7 +8407,7 @@ async function volumeSizeBytes(name) {
|
|
|
8300
8407
|
const sz = await duBytes(live);
|
|
8301
8408
|
if (sz !== null) return sz;
|
|
8302
8409
|
}
|
|
8303
|
-
const df = await
|
|
8410
|
+
const df = await execa19(
|
|
8304
8411
|
"docker",
|
|
8305
8412
|
["system", "df", "-v", "--format", "{{json .Volumes}}"],
|
|
8306
8413
|
{ reject: false }
|
|
@@ -8321,7 +8428,7 @@ async function volumeSizeBytes(name) {
|
|
|
8321
8428
|
return null;
|
|
8322
8429
|
}
|
|
8323
8430
|
async function imageBytes(tag) {
|
|
8324
|
-
const r = await
|
|
8431
|
+
const r = await execa19("docker", ["image", "inspect", tag, "--format", "{{.Size}}"], {
|
|
8325
8432
|
reject: false
|
|
8326
8433
|
});
|
|
8327
8434
|
if (r.exitCode !== 0) return null;
|
|
@@ -8332,7 +8439,7 @@ async function projectCheckpointImageBytes(projectRoot, name) {
|
|
|
8332
8439
|
return imageBytes(checkpointImageTag(projectRoot, name));
|
|
8333
8440
|
}
|
|
8334
8441
|
async function allCheckpointImagesBytes() {
|
|
8335
|
-
const r = await
|
|
8442
|
+
const r = await execa19(
|
|
8336
8443
|
"docker",
|
|
8337
8444
|
[
|
|
8338
8445
|
"image",
|
|
@@ -8384,7 +8491,7 @@ function reconcileLimits(persisted, dockerJson) {
|
|
|
8384
8491
|
};
|
|
8385
8492
|
}
|
|
8386
8493
|
async function containerWritableBytes(container) {
|
|
8387
|
-
const r = await
|
|
8494
|
+
const r = await execa19(
|
|
8388
8495
|
"docker",
|
|
8389
8496
|
["ps", "-a", "--filter", `name=^${container}$`, "--format", "{{.Size}}", "--size"],
|
|
8390
8497
|
{ reject: false }
|
|
@@ -8431,7 +8538,7 @@ async function boxResourceStats(record) {
|
|
|
8431
8538
|
if (await inspectContainerStatus(record.container) !== "running") {
|
|
8432
8539
|
return base;
|
|
8433
8540
|
}
|
|
8434
|
-
const proc = await
|
|
8541
|
+
const proc = await execa19(
|
|
8435
8542
|
"docker",
|
|
8436
8543
|
["stats", "--no-stream", "--format", "{{json .}}", record.container],
|
|
8437
8544
|
{ reject: false }
|
|
@@ -8637,7 +8744,7 @@ var dockerProvider = {
|
|
|
8637
8744
|
};
|
|
8638
8745
|
async function probeVersion(bin, args = ["--version"]) {
|
|
8639
8746
|
try {
|
|
8640
|
-
const r = await
|
|
8747
|
+
const r = await execa20(bin, args, { reject: false });
|
|
8641
8748
|
if (r.exitCode !== 0) return null;
|
|
8642
8749
|
const out = `${r.stdout ?? ""}${r.stderr ?? ""}`.trim().split("\n")[0] ?? "";
|
|
8643
8750
|
return out.length > 0 ? out : bin;
|
|
@@ -8659,7 +8766,7 @@ async function dockerChecks() {
|
|
|
8659
8766
|
];
|
|
8660
8767
|
}
|
|
8661
8768
|
const cliRes = { label: "docker cli", status: "ok", detail: cli };
|
|
8662
|
-
const info = await
|
|
8769
|
+
const info = await execa20("docker", ["info"], { reject: false });
|
|
8663
8770
|
if (info.exitCode !== 0) {
|
|
8664
8771
|
const permDenied = `${info.stderr ?? ""}`.toLowerCase().includes("permission denied");
|
|
8665
8772
|
let hint;
|
|
@@ -8880,7 +8987,12 @@ async function spawnHub(hubServer, cliEntry, log, portlessEnabled) {
|
|
|
8880
8987
|
NODE_ENV: "production",
|
|
8881
8988
|
AGENTBOX_CLI_ENTRY: cliEntry,
|
|
8882
8989
|
// The hub is the localhost profile (token gate); bind loopback.
|
|
8883
|
-
AGENTBOX_HUB_HOST: HOST
|
|
8990
|
+
AGENTBOX_HUB_HOST: HOST,
|
|
8991
|
+
// The hub bundle ships no staged docker build context of its own, so its
|
|
8992
|
+
// in-process docker base-freshness check couldn't fingerprint (degrading
|
|
8993
|
+
// to 'unknown'). Hand it the CLI's resolved context so hub-side
|
|
8994
|
+
// fingerprints match what the create/prepare workers compute.
|
|
8995
|
+
AGENTBOX_DOCKER_CONTEXT: BUILD_CONTEXT_DIR
|
|
8884
8996
|
}
|
|
8885
8997
|
});
|
|
8886
8998
|
child.unref();
|
|
@@ -9137,6 +9249,10 @@ export {
|
|
|
9137
9249
|
generateVncPassword,
|
|
9138
9250
|
VNC_CONTAINER_PORT,
|
|
9139
9251
|
buildVncUrls,
|
|
9252
|
+
SSH_CONTAINER_PORT,
|
|
9253
|
+
launchSshdDaemon,
|
|
9254
|
+
installAuthorizedKey,
|
|
9255
|
+
setUpBoxSshd,
|
|
9140
9256
|
PORTLESS_PROXY_PORT,
|
|
9141
9257
|
detectPortless,
|
|
9142
9258
|
resetPortlessCache,
|
|
@@ -9212,6 +9328,7 @@ export {
|
|
|
9212
9328
|
unpauseBox,
|
|
9213
9329
|
stopBox,
|
|
9214
9330
|
resyncBox,
|
|
9331
|
+
refreshBoxSshd,
|
|
9215
9332
|
startBox,
|
|
9216
9333
|
openBoxInFinder,
|
|
9217
9334
|
getBoxHostPaths,
|
|
@@ -9235,4 +9352,4 @@ export {
|
|
|
9235
9352
|
browserSessionActive,
|
|
9236
9353
|
ensureBoxBrowser
|
|
9237
9354
|
};
|
|
9238
|
-
//# sourceMappingURL=chunk-
|
|
9355
|
+
//# sourceMappingURL=chunk-QGL734YX.js.map
|