@madarco/agentbox 0.26.0 → 0.27.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 +44 -0
- package/README.md +1 -1
- package/dist/{_cloud-attach-7WRQH6XZ.js → _cloud-attach-WDGM6FL5.js} +4 -4
- package/dist/{chunk-UIFL7F2G.js → chunk-26IKZRTT.js} +2 -2
- package/dist/{chunk-DJQMK4RN.js → chunk-HR7NHH5J.js} +14 -9
- package/dist/chunk-HR7NHH5J.js.map +1 -0
- package/dist/{chunk-K5KOLYIL.js → chunk-IDH5A4RR.js} +2 -2
- package/dist/{chunk-ZY7M7MXH.js → chunk-JE6UI5YR.js} +10 -10
- package/dist/{chunk-7ZZAZPYX.js → chunk-KWOEUFVA.js} +2 -2
- package/dist/{chunk-BA2VLJVU.js → chunk-LL7NCMUU.js} +3 -3
- package/dist/{chunk-I2OAJS3L.js → chunk-NEF6MDJO.js} +4 -4
- package/dist/{chunk-I2OAJS3L.js.map → chunk-NEF6MDJO.js.map} +1 -1
- package/dist/{dist-YA7EXBGG.js → chunk-SJ75AIA2.js} +486 -92
- package/dist/chunk-SJ75AIA2.js.map +1 -0
- package/dist/{chunk-PK2QF4IR.js → chunk-UJEH2NJT.js} +27 -14
- package/dist/chunk-UJEH2NJT.js.map +1 -0
- package/dist/{chunk-DQHMDDAT.js → chunk-V5XXJH63.js} +2 -2
- package/dist/{dist-DTNYMBQ5.js → dist-FTKS2GI4.js} +5 -5
- package/dist/{dist-5IICYSR6.js → dist-KQTMCVME.js} +5 -5
- package/dist/{dist-5IICYSR6.js.map → dist-KQTMCVME.js.map} +1 -1
- package/dist/{dist-AR5CHRSV.js → dist-O3LKOIE7.js} +5 -5
- package/dist/{dist-POVRY7HO.js → dist-OO52HARR.js} +3 -3
- package/dist/{dist-K4LNH3EC.js → dist-TSFVB7AI.js} +5 -5
- package/dist/{dist-XYY6SIKG.js → dist-WVYAURMF.js} +5 -5
- package/dist/dist-Z6L5MM5D.js +46 -0
- package/dist/index.js +401 -219
- package/dist/index.js.map +1 -1
- package/dist/{prepared-state-75DIZ55S-W6NU3S3B.js → prepared-state-75DIZ55S-TNJXWMXV.js} +2 -2
- package/dist/prepared-state-75DIZ55S-TNJXWMXV.js.map +1 -0
- package/package.json +8 -8
- package/runtime/hub/apps/hub/.next/BUILD_ID +1 -1
- package/runtime/hub/apps/hub/.next/app-path-routes-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/build-manifest.json +3 -3
- package/runtime/hub/apps/hub/.next/routes-manifest.json +22 -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/docs/route.js +2 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/docs/route.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/bake/route/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/bake/route/build-manifest.json +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/bake/route/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/bake/route.js +8 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/bake/route.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/bake/route.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/bake/route_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/route/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/route/build-manifest.json +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/route/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/route.js +8 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/route.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/route.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/[alias]/route_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/route/app-paths-manifest.json +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/route/build-manifest.json +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/route/server-reference-manifest.json +4 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/route.js +9 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/route.js.map +5 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/route.js.nft.json +1 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/hosts/route_client-reference-manifest.js +3 -0
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/openapi.json/route.js +2 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/api/v1/openapi.json/route.js.nft.json +1 -1
- 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.js.nft.json +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.js.nft.json +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.js.nft.json +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.js.nft.json +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 +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/044u_hub__next-internal_server_app_(dashboard)_api_v1_hosts_route_actions_0b_404_.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/0web_next-internal_server_app_(dashboard)_api_v1_hosts_[alias]_route_actions_0swypy5.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/1jcg_server_app_(dashboard)_api_v1_hosts_[alias]_bake_route_actions_1-_pu3n.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0a7djvw._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0bmro0b._.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]__0t4qmv-._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0xh14bo._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__13ioh5z._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1h4xycg._.js +3 -0
- 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]__1md9kdw._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/_1bng7w9._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/apps_hub_app_(dashboard)_api_v1_lib_openapi_ts_1yokmzt._.js +14 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_1uccfbf._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/_03s-ah2._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0r4px38._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/_18w2zeh._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_0od97-d._.js +3 -0
- 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/chunks/ssr/apps_hub_app_(dashboard)_settings_page_tsx_0hv6n82._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/functions-config-manifest.json +3 -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/0xdtiy_m2ygv8.js +1 -0
- package/runtime/hub/apps/hub/.next/static/chunks/1_ur0im1g7_s9.js +1 -0
- package/runtime/hub/apps/hub/.next/static/chunks/26rwu1f2gzemi.js +1 -0
- package/runtime/hub/apps/hub/.next/static/chunks/3v6kx35_lwjs8.js +1 -0
- package/runtime/hub/apps/hub/.next/static/chunks/{3dfjrxx-dy644.css → 42uysd_max-yq.css} +1 -1
- package/runtime/hub/apps/hub/.next/static/chunks/44j61g8lm9nvw.js +1 -0
- package/runtime/hub/apps/hub/{chunk-BARD2DI6.js → chunk-EHBJKZCL.js} +13 -8
- package/runtime/hub/apps/hub/{chunk-4QY2VZCF.js → chunk-RXYOWSSN.js} +19 -13
- package/runtime/hub/apps/hub/{chunk-XZZXPEVV.js → chunk-YJ5MJOXK.js} +1 -1
- package/runtime/hub/apps/hub/{dist-3ENKQN5G.js → dist-3I7KUI6W.js} +3 -3
- package/runtime/hub/apps/hub/{dist-WAZKGVYL.js → dist-6FPPUSWZ.js} +2 -2
- package/runtime/hub/apps/hub/{dist-NNBELNA7.js → dist-DX6IYMAH.js} +300 -109
- package/runtime/hub/apps/hub/{dist-RJJ2SDYO.js → dist-G6TXUSPZ.js} +3 -3
- package/runtime/hub/apps/hub/{dist-AE6IV4FV.js → dist-GTVVXCBP.js} +3 -3
- package/runtime/hub/apps/hub/{dist-6VGJOQYK.js → dist-JG45OFT2.js} +3 -3
- package/runtime/hub/apps/hub/{dist-TU7D6UTB.js → dist-LYDHYTP2.js} +3 -3
- package/runtime/hub/apps/hub/{prepared-state-75DIZ55S-NYEDSU2U.js → prepared-state-75DIZ55S-2IFNUHHM.js} +1 -1
- package/runtime/hub/apps/hub/server.js +136 -19
- package/dist/chunk-DJQMK4RN.js.map +0 -1
- package/dist/chunk-PK2QF4IR.js.map +0 -1
- package/dist/chunk-ZYKNSHOH.js +0 -259
- package/dist/chunk-ZYKNSHOH.js.map +0 -1
- package/dist/dist-YA7EXBGG.js.map +0 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1bqbkd5._.js +0 -14
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1qa4a0v._.js +0 -14
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/_09gdzmo._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0tgpglr._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/_1laion6._.js +0 -3
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_0b_hsjl._.js +0 -3
- package/runtime/hub/apps/hub/.next/static/chunks/1c5w3kqosumog.js +0 -1
- package/runtime/hub/apps/hub/.next/static/chunks/1o3ot_9-8jgzc.js +0 -1
- package/runtime/hub/apps/hub/.next/static/chunks/1z4elhg8gyq98.js +0 -1
- package/runtime/hub/apps/hub/.next/static/chunks/3uq9hf-roasav.js +0 -1
- /package/dist/{_cloud-attach-7WRQH6XZ.js.map → _cloud-attach-WDGM6FL5.js.map} +0 -0
- /package/dist/{chunk-UIFL7F2G.js.map → chunk-26IKZRTT.js.map} +0 -0
- /package/dist/{chunk-K5KOLYIL.js.map → chunk-IDH5A4RR.js.map} +0 -0
- /package/dist/{chunk-ZY7M7MXH.js.map → chunk-JE6UI5YR.js.map} +0 -0
- /package/dist/{chunk-7ZZAZPYX.js.map → chunk-KWOEUFVA.js.map} +0 -0
- /package/dist/{chunk-BA2VLJVU.js.map → chunk-LL7NCMUU.js.map} +0 -0
- /package/dist/{chunk-DQHMDDAT.js.map → chunk-V5XXJH63.js.map} +0 -0
- /package/dist/{dist-DTNYMBQ5.js.map → dist-FTKS2GI4.js.map} +0 -0
- /package/dist/{dist-AR5CHRSV.js.map → dist-O3LKOIE7.js.map} +0 -0
- /package/dist/{dist-POVRY7HO.js.map → dist-OO52HARR.js.map} +0 -0
- /package/dist/{dist-K4LNH3EC.js.map → dist-TSFVB7AI.js.map} +0 -0
- /package/dist/{dist-XYY6SIKG.js.map → dist-WVYAURMF.js.map} +0 -0
- /package/dist/{prepared-state-75DIZ55S-W6NU3S3B.js.map → dist-Z6L5MM5D.js.map} +0 -0
- /package/runtime/hub/apps/hub/.next/static/{mrhWWwzD3oh05le9SRnlA → S-yw9-SVffiEHRGm85NzP}/_buildManifest.js +0 -0
- /package/runtime/hub/apps/hub/.next/static/{mrhWWwzD3oh05le9SRnlA → S-yw9-SVffiEHRGm85NzP}/_clientMiddlewareManifest.js +0 -0
- /package/runtime/hub/apps/hub/.next/static/{mrhWWwzD3oh05le9SRnlA → S-yw9-SVffiEHRGm85NzP}/_ssgManifest.js +0 -0
|
@@ -1,4 +1,11 @@
|
|
|
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
|
+
BD,
|
|
4
|
+
L,
|
|
5
|
+
me,
|
|
6
|
+
ue,
|
|
7
|
+
v
|
|
8
|
+
} from "./chunk-CKBHQ7OI.js";
|
|
2
9
|
import {
|
|
3
10
|
CLOUD_VNC_PORT,
|
|
4
11
|
CLOUD_WEB_PROXY_PORT,
|
|
@@ -13,11 +20,11 @@ import {
|
|
|
13
20
|
renderInnerCommand,
|
|
14
21
|
resolveCloudCheckpoint,
|
|
15
22
|
writeCloudCheckpointManifest
|
|
16
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-EHBJKZCL.js";
|
|
17
24
|
import {
|
|
18
25
|
detectPortless,
|
|
19
26
|
portlessDoctorRow
|
|
20
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-YJ5MJOXK.js";
|
|
21
28
|
import "./chunk-3LAHFDJF.js";
|
|
22
29
|
import {
|
|
23
30
|
BOX_IMAGE_REGISTRY,
|
|
@@ -36,18 +43,26 @@ import {
|
|
|
36
43
|
sshExec,
|
|
37
44
|
sshOptArgs,
|
|
38
45
|
writePreparedStateRaw
|
|
39
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-RXYOWSSN.js";
|
|
40
47
|
import {
|
|
41
48
|
execa
|
|
42
49
|
} from "./chunk-UDZ3VXRF.js";
|
|
43
50
|
import {
|
|
44
51
|
hashProjectPath,
|
|
45
52
|
loadEffectiveConfig,
|
|
46
|
-
sanitizeMnemonic
|
|
53
|
+
sanitizeMnemonic,
|
|
54
|
+
setConfigValue
|
|
47
55
|
} from "./chunk-QSMPSV5Z.js";
|
|
48
56
|
import "./chunk-OG4KH2FZ.js";
|
|
49
57
|
|
|
50
|
-
// ../../packages/sandbox-remote-docker/dist/chunk-
|
|
58
|
+
// ../../packages/sandbox-remote-docker/dist/chunk-SMGJ34CX.js
|
|
59
|
+
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "fs";
|
|
60
|
+
import { homedir } from "os";
|
|
61
|
+
import { dirname, resolve as pathResolve } from "path";
|
|
62
|
+
import { createReadStream } from "fs";
|
|
63
|
+
import { rm } from "fs/promises";
|
|
64
|
+
import { tmpdir } from "os";
|
|
65
|
+
import { join } from "path";
|
|
51
66
|
function containerNameFor(boxName) {
|
|
52
67
|
return `agentbox-${boxName}`;
|
|
53
68
|
}
|
|
@@ -114,33 +129,114 @@ function sshTargetFor(target, controlPath) {
|
|
|
114
129
|
...controlPath !== void 0 ? { controlPath } : {}
|
|
115
130
|
};
|
|
116
131
|
}
|
|
132
|
+
var SCHEMA = 1;
|
|
133
|
+
var ALIAS_RE = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
134
|
+
function isValidAlias(alias) {
|
|
135
|
+
return ALIAS_RE.test(alias);
|
|
136
|
+
}
|
|
137
|
+
function assertValidAlias(alias) {
|
|
138
|
+
if (!isValidAlias(alias)) {
|
|
139
|
+
throw new Error(
|
|
140
|
+
`invalid host alias ${JSON.stringify(alias)} \u2014 use a plain name (letters, digits, \`.\`, \`_\`, \`-\`; no \`@\`, \`:\`, \`/\` or spaces)`
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
function registryPath() {
|
|
145
|
+
return pathResolve(homedir(), ".agentbox", "remote-docker-hosts.json");
|
|
146
|
+
}
|
|
147
|
+
function readHostsRegistry() {
|
|
148
|
+
const path = registryPath();
|
|
149
|
+
if (!existsSync(path)) return null;
|
|
150
|
+
let raw;
|
|
151
|
+
try {
|
|
152
|
+
raw = JSON.parse(readFileSync(path, "utf8"));
|
|
153
|
+
} catch {
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
if (raw === null || typeof raw !== "object") return null;
|
|
157
|
+
const parsed = raw;
|
|
158
|
+
if (parsed.schema !== SCHEMA || typeof parsed.hosts !== "object" || parsed.hosts === null) {
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
return { schema: SCHEMA, hosts: parsed.hosts };
|
|
162
|
+
}
|
|
163
|
+
function writeHostsRegistry(reg) {
|
|
164
|
+
const path = registryPath();
|
|
165
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
166
|
+
const body = JSON.stringify({ schema: SCHEMA, hosts: reg.hosts }, null, 2) + "\n";
|
|
167
|
+
const tmp = `${path}.tmp`;
|
|
168
|
+
writeFileSync(tmp, body, { mode: 384 });
|
|
169
|
+
renameSync(tmp, path);
|
|
170
|
+
}
|
|
171
|
+
function getHostAlias(alias) {
|
|
172
|
+
return readHostsRegistry()?.hosts[alias];
|
|
173
|
+
}
|
|
174
|
+
function listHostAliases() {
|
|
175
|
+
const reg = readHostsRegistry();
|
|
176
|
+
if (!reg) return [];
|
|
177
|
+
return Object.entries(reg.hosts).sort(([a], [b]) => a.localeCompare(b)).map(([alias, entry]) => ({ alias, entry }));
|
|
178
|
+
}
|
|
179
|
+
function upsertHostAlias(alias, ssh) {
|
|
180
|
+
const reg = readHostsRegistry() ?? { schema: SCHEMA, hosts: {} };
|
|
181
|
+
const existing = reg.hosts[alias];
|
|
182
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
183
|
+
reg.hosts[alias] = existing ? { ...existing, ssh, updatedAt: now } : { ssh, createdAt: now };
|
|
184
|
+
writeHostsRegistry(reg);
|
|
185
|
+
}
|
|
186
|
+
function removeHostAlias(alias) {
|
|
187
|
+
const reg = readHostsRegistry();
|
|
188
|
+
if (!reg || !(alias in reg.hosts)) return false;
|
|
189
|
+
const hosts = { ...reg.hosts };
|
|
190
|
+
delete hosts[alias];
|
|
191
|
+
writeHostsRegistry({ schema: SCHEMA, hosts });
|
|
192
|
+
return true;
|
|
193
|
+
}
|
|
194
|
+
function resolveConnection(ref) {
|
|
195
|
+
return getHostAlias(ref)?.ssh ?? ref;
|
|
196
|
+
}
|
|
197
|
+
function requireHostAlias(ref) {
|
|
198
|
+
const entry = getHostAlias(ref);
|
|
199
|
+
if (!entry) {
|
|
200
|
+
throw new Error(
|
|
201
|
+
`no such remote-docker host alias ${JSON.stringify(ref)} \u2014 register it with \`agentbox remote-docker add <name> <[user@]host[:port]>\``
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
return entry;
|
|
205
|
+
}
|
|
206
|
+
function dialTarget(target) {
|
|
207
|
+
const resolved = resolveConnection(target.spec);
|
|
208
|
+
return resolved === target.spec ? target : parseRemoteTarget(resolved);
|
|
209
|
+
}
|
|
117
210
|
var tunnels = new SshTunnelManager("remote-docker");
|
|
118
211
|
async function ensureTunnel(sandboxId, target) {
|
|
212
|
+
const dial = dialTarget(target);
|
|
119
213
|
if (!tunnels.has(sandboxId)) {
|
|
120
214
|
try {
|
|
121
215
|
await tunnels.open({
|
|
122
216
|
boxId: sandboxId,
|
|
123
|
-
vpsHost:
|
|
124
|
-
...
|
|
125
|
-
...
|
|
217
|
+
vpsHost: dial.host,
|
|
218
|
+
...dial.user !== void 0 ? { vpsUser: dial.user } : {},
|
|
219
|
+
...dial.port !== void 0 ? { port: dial.port } : {}
|
|
126
220
|
});
|
|
127
221
|
} catch (err) {
|
|
128
222
|
const msg = err instanceof Error ? err.message : String(err);
|
|
223
|
+
const where = dial.spec === target.spec ? `"${target.spec}"` : `"${target.spec}" (${dial.spec})`;
|
|
129
224
|
throw new Error(
|
|
130
|
-
`remote-docker: cannot SSH to
|
|
225
|
+
`remote-docker: cannot SSH to ${where}. Check that \`ssh ${dial.spec} true\` works from this machine (the provider uses your own ~/.ssh/config, agent and known_hosts \u2014 it mints no keys).
|
|
131
226
|
${msg}`
|
|
132
227
|
);
|
|
133
228
|
}
|
|
134
229
|
}
|
|
135
230
|
const controlPath = tunnels.controlPath(sandboxId);
|
|
136
|
-
return sshTargetFor(
|
|
231
|
+
return sshTargetFor(dial, controlPath);
|
|
137
232
|
}
|
|
138
233
|
async function refreshTunnel(sandboxId, target) {
|
|
234
|
+
const dial = dialTarget(target);
|
|
139
235
|
await tunnels.refresh({
|
|
140
236
|
boxId: sandboxId,
|
|
141
|
-
vpsHost:
|
|
142
|
-
...
|
|
143
|
-
...
|
|
237
|
+
vpsHost: dial.host,
|
|
238
|
+
...dial.user !== void 0 ? { vpsUser: dial.user } : {},
|
|
239
|
+
...dial.port !== void 0 ? { port: dial.port } : {}
|
|
144
240
|
});
|
|
145
241
|
}
|
|
146
242
|
async function dockerOnRemote(target, argv, opts = {}) {
|
|
@@ -163,8 +259,8 @@ function dockerExecArgv(container, command, opts = {}) {
|
|
|
163
259
|
if (opts.interactive) argv.push("-i");
|
|
164
260
|
if (opts.user) argv.push("-u", opts.user);
|
|
165
261
|
if (opts.cwd) argv.push("-w", opts.cwd);
|
|
166
|
-
for (const [k,
|
|
167
|
-
argv.push("-e", `${k}=${
|
|
262
|
+
for (const [k, v2] of Object.entries(opts.env ?? {})) {
|
|
263
|
+
argv.push("-e", `${k}=${v2}`);
|
|
168
264
|
}
|
|
169
265
|
argv.push(container, "bash", "-lc", command);
|
|
170
266
|
return argv;
|
|
@@ -209,17 +305,21 @@ async function probeRemoteEngine(spec) {
|
|
|
209
305
|
try {
|
|
210
306
|
target = sshTargetFor(parseRemoteTarget(spec));
|
|
211
307
|
} catch (err) {
|
|
212
|
-
|
|
308
|
+
const detail = err instanceof Error ? err.message : String(err);
|
|
309
|
+
return { ok: false, steps: [{ label: "ssh", ok: false, detail }], error: detail };
|
|
213
310
|
}
|
|
214
311
|
const reach = await sshExec({ ...target, options: { ConnectTimeout: "10" } }, "true", {
|
|
215
312
|
timeoutMs: 2e4
|
|
216
313
|
});
|
|
217
314
|
if (reach.exitCode !== 0) {
|
|
315
|
+
const detail = `cannot SSH to ${spec}: ${reach.stderr.trim() || `exit ${String(reach.exitCode)}`}`;
|
|
218
316
|
return {
|
|
219
317
|
ok: false,
|
|
220
|
-
|
|
318
|
+
steps: [{ label: "ssh", ok: false, detail, hint: `\`ssh ${spec} true\` must work from here` }],
|
|
319
|
+
error: detail
|
|
221
320
|
};
|
|
222
321
|
}
|
|
322
|
+
const sshStep = { label: "ssh", ok: true, detail: `reachable (${spec})` };
|
|
223
323
|
const res = await dockerOnRemote(
|
|
224
324
|
target,
|
|
225
325
|
["version", "--format", "{{.Server.Version}}|{{.Server.Arch}}|{{.Server.Os}}"],
|
|
@@ -229,56 +329,22 @@ async function probeRemoteEngine(spec) {
|
|
|
229
329
|
);
|
|
230
330
|
if (res.exitCode !== 0) {
|
|
231
331
|
const err = res.stderr.trim() || res.stdout.trim();
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
|
|
332
|
+
const notFound = /command not found|not found/i.test(err);
|
|
333
|
+
const detail = notFound ? `\`docker\` is not on ${spec}'s login-shell PATH (${err}). Install Docker there, or add it to the remote user's profile.` : `docker on ${spec} is not answering: ${err}`;
|
|
334
|
+
return {
|
|
335
|
+
ok: false,
|
|
336
|
+
steps: [sshStep, { label: "docker", ok: false, detail }],
|
|
337
|
+
error: detail
|
|
338
|
+
};
|
|
239
339
|
}
|
|
240
340
|
const [version = "", arch = "", os = ""] = res.stdout.trim().split("|");
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
function readPreparedState() {
|
|
246
|
-
const raw = readPreparedStateRaw(PROVIDER);
|
|
247
|
-
if (raw === null || typeof raw !== "object") return null;
|
|
248
|
-
const parsed = raw;
|
|
249
|
-
if (parsed.schema !== SCHEMA || typeof parsed.hosts !== "object" || parsed.hosts === null) {
|
|
250
|
-
return null;
|
|
251
|
-
}
|
|
252
|
-
return { schema: SCHEMA, hosts: parsed.hosts };
|
|
253
|
-
}
|
|
254
|
-
function recordPreparedHost(host, fields) {
|
|
255
|
-
const stamp = readCliStamp();
|
|
256
|
-
const existing = readPreparedState();
|
|
257
|
-
const next = {
|
|
258
|
-
schema: SCHEMA,
|
|
259
|
-
hosts: {
|
|
260
|
-
...existing?.hosts ?? {},
|
|
261
|
-
[host]: {
|
|
262
|
-
imageRef: fields.imageRef,
|
|
263
|
-
contextSha256: fields.contextSha256,
|
|
264
|
-
...stamp.cliVersion ? { cliVersion: stamp.cliVersion } : {},
|
|
265
|
-
...stamp.cliCommit ? { cliCommit: stamp.cliCommit } : {},
|
|
266
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
267
|
-
}
|
|
268
|
-
}
|
|
341
|
+
const dockerStep = {
|
|
342
|
+
label: "docker",
|
|
343
|
+
ok: true,
|
|
344
|
+
detail: `${version} (${os}/${arch})`
|
|
269
345
|
};
|
|
270
|
-
|
|
346
|
+
return { ok: true, steps: [sshStep, dockerStep], version, arch, os };
|
|
271
347
|
}
|
|
272
|
-
|
|
273
|
-
// ../../packages/sandbox-remote-docker/dist/index.js
|
|
274
|
-
import { basename } from "path";
|
|
275
|
-
import { createReadStream as createReadStream2, createWriteStream } from "fs";
|
|
276
|
-
import { mkdir } from "fs/promises";
|
|
277
|
-
import { dirname } from "path";
|
|
278
|
-
import { createReadStream } from "fs";
|
|
279
|
-
import { rm } from "fs/promises";
|
|
280
|
-
import { tmpdir } from "os";
|
|
281
|
-
import { join } from "path";
|
|
282
348
|
function remoteImageRef(contextSha256) {
|
|
283
349
|
return `agentbox/box:${contextSha256.slice(0, 16)}`;
|
|
284
350
|
}
|
|
@@ -369,6 +435,75 @@ async function buildOnRemote(target, ref, opts) {
|
|
|
369
435
|
await rm(tarPath, { force: true });
|
|
370
436
|
}
|
|
371
437
|
}
|
|
438
|
+
var SCHEMA2 = 1;
|
|
439
|
+
var PROVIDER = "remote-docker";
|
|
440
|
+
function readPreparedState() {
|
|
441
|
+
const raw = readPreparedStateRaw(PROVIDER);
|
|
442
|
+
if (raw === null || typeof raw !== "object") return null;
|
|
443
|
+
const parsed = raw;
|
|
444
|
+
if (parsed.schema !== SCHEMA2 || typeof parsed.hosts !== "object" || parsed.hosts === null) {
|
|
445
|
+
return null;
|
|
446
|
+
}
|
|
447
|
+
return { schema: SCHEMA2, hosts: parsed.hosts };
|
|
448
|
+
}
|
|
449
|
+
function removePreparedHost(host) {
|
|
450
|
+
const existing = readPreparedState();
|
|
451
|
+
if (!existing || !(host in existing.hosts)) return false;
|
|
452
|
+
const hosts = { ...existing.hosts };
|
|
453
|
+
delete hosts[host];
|
|
454
|
+
writePreparedStateRaw(PROVIDER, { schema: SCHEMA2, hosts });
|
|
455
|
+
return true;
|
|
456
|
+
}
|
|
457
|
+
function recordPreparedHost(host, fields) {
|
|
458
|
+
const stamp = readCliStamp();
|
|
459
|
+
const existing = readPreparedState();
|
|
460
|
+
const next = {
|
|
461
|
+
schema: SCHEMA2,
|
|
462
|
+
hosts: {
|
|
463
|
+
...existing?.hosts ?? {},
|
|
464
|
+
[host]: {
|
|
465
|
+
imageRef: fields.imageRef,
|
|
466
|
+
contextSha256: fields.contextSha256,
|
|
467
|
+
...stamp.cliVersion ? { cliVersion: stamp.cliVersion } : {},
|
|
468
|
+
...stamp.cliCommit ? { cliCommit: stamp.cliCommit } : {},
|
|
469
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
};
|
|
473
|
+
writePreparedStateRaw(PROVIDER, next);
|
|
474
|
+
}
|
|
475
|
+
async function prepareRemoteDocker(opts) {
|
|
476
|
+
const log = opts.onLog ?? (() => {
|
|
477
|
+
});
|
|
478
|
+
const spec = (opts.host ?? "").trim();
|
|
479
|
+
if (!spec) {
|
|
480
|
+
throw new Error(
|
|
481
|
+
"remote-docker: prepare needs a host alias \u2014 `agentbox prepare --provider docker:<alias>`, or set `box.remoteDockerHost`."
|
|
482
|
+
);
|
|
483
|
+
}
|
|
484
|
+
requireHostAlias(spec);
|
|
485
|
+
const remote = parseRemoteTarget(spec);
|
|
486
|
+
const target = await ensureTunnel(`engine:${remote.spec}`, remote);
|
|
487
|
+
log(`[prepare] ensuring the box image on ${remote.spec}`);
|
|
488
|
+
const res = await ensureRemoteImage(target, {
|
|
489
|
+
...opts.claudeInstall ? { claudeInstall: opts.claudeInstall } : {},
|
|
490
|
+
...opts.registry !== void 0 ? { registry: opts.registry } : {},
|
|
491
|
+
...opts.allowPull !== void 0 ? { allowPull: opts.allowPull } : {},
|
|
492
|
+
...opts.force ? { force: true } : {},
|
|
493
|
+
onLog: log
|
|
494
|
+
});
|
|
495
|
+
if (res.contextSha256) {
|
|
496
|
+
recordPreparedHost(remote.spec, { imageRef: res.ref, contextSha256: res.contextSha256 });
|
|
497
|
+
}
|
|
498
|
+
log(`[prepare] ${remote.spec} ready \u2014 ${res.ref} (${res.source})`);
|
|
499
|
+
return {};
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
// ../../packages/sandbox-remote-docker/dist/index.js
|
|
503
|
+
import { basename } from "path";
|
|
504
|
+
import { createReadStream as createReadStream2, createWriteStream } from "fs";
|
|
505
|
+
import { mkdir } from "fs/promises";
|
|
506
|
+
import { dirname as dirname2 } from "path";
|
|
372
507
|
var BACKEND_NAME = "remote-docker";
|
|
373
508
|
var SNAPSHOT_SEP = "#";
|
|
374
509
|
function makeSnapshotName(host, imageRef) {
|
|
@@ -468,8 +603,8 @@ function buildRunArgv(opts) {
|
|
|
468
603
|
for (const port of opts.ports) {
|
|
469
604
|
argv.push("-p", `127.0.0.1:0:${String(port)}`);
|
|
470
605
|
}
|
|
471
|
-
for (const [k,
|
|
472
|
-
argv.push("-e", `${k}=${
|
|
606
|
+
for (const [k, v2] of Object.entries(opts.env)) {
|
|
607
|
+
argv.push("-e", `${k}=${v2}`);
|
|
473
608
|
}
|
|
474
609
|
argv.push(opts.image, "sleep", "infinity");
|
|
475
610
|
return argv;
|
|
@@ -477,14 +612,15 @@ function buildRunArgv(opts) {
|
|
|
477
612
|
var remoteDockerBackend = {
|
|
478
613
|
name: BACKEND_NAME,
|
|
479
614
|
async provision(req) {
|
|
480
|
-
const
|
|
615
|
+
const log2 = req.onLog ?? (() => {
|
|
481
616
|
});
|
|
482
617
|
const spec = (req.host ?? "").trim();
|
|
483
618
|
if (!spec) {
|
|
484
619
|
throw new Error(
|
|
485
|
-
"remote-docker: no
|
|
620
|
+
"remote-docker: no host. Register one with `agentbox remote-docker add <alias> <[user@]host[:port]>`, then use `agentbox docker:<alias> \u2026` / `--remote-host <alias>` / `box.remoteDockerHost`."
|
|
486
621
|
);
|
|
487
622
|
}
|
|
623
|
+
requireHostAlias(spec);
|
|
488
624
|
const remote = parseRemoteTarget(spec);
|
|
489
625
|
const container = containerNameFor(req.name);
|
|
490
626
|
const sandboxId = makeSandboxId(remote.spec, container);
|
|
@@ -505,7 +641,7 @@ var remoteDockerBackend = {
|
|
|
505
641
|
} else {
|
|
506
642
|
const ensured = await ensureRemoteImage(target, {
|
|
507
643
|
imageRef: req.image && req.image !== "agentbox/box:dev" ? req.image : void 0,
|
|
508
|
-
onLog:
|
|
644
|
+
onLog: log2
|
|
509
645
|
});
|
|
510
646
|
image = ensured.ref;
|
|
511
647
|
}
|
|
@@ -514,7 +650,7 @@ var remoteDockerBackend = {
|
|
|
514
650
|
await dockerOnRemoteOrThrow(target, ["volume", "create", dockerVolume]);
|
|
515
651
|
const nestedEngine = await remoteIsNested(target);
|
|
516
652
|
if (nestedEngine) {
|
|
517
|
-
|
|
653
|
+
log2("[provision] remote engine is itself an AgentBox box \u2014 running the box init as root");
|
|
518
654
|
}
|
|
519
655
|
const argv = buildRunArgv({
|
|
520
656
|
container,
|
|
@@ -526,7 +662,7 @@ var remoteDockerBackend = {
|
|
|
526
662
|
...cpu !== void 0 ? { cpu } : {},
|
|
527
663
|
...memory !== void 0 ? { memory } : {}
|
|
528
664
|
});
|
|
529
|
-
|
|
665
|
+
log2(`[provision] docker run ${container} on ${remote.spec}`);
|
|
530
666
|
await dockerOnRemoteOrThrow(target, argv, { timeoutMs: 3e5 });
|
|
531
667
|
return {
|
|
532
668
|
sandboxId,
|
|
@@ -639,7 +775,7 @@ var remoteDockerBackend = {
|
|
|
639
775
|
},
|
|
640
776
|
async downloadFile(h, remotePath, localPath) {
|
|
641
777
|
const ctx = await ctxFor(h);
|
|
642
|
-
await mkdir(
|
|
778
|
+
await mkdir(dirname2(localPath), { recursive: true });
|
|
643
779
|
await pipeFileFromContainer(
|
|
644
780
|
ctx.target,
|
|
645
781
|
ctx.container,
|
|
@@ -818,7 +954,7 @@ async function buildRemoteDockerAttach(box, kind, opts = {}) {
|
|
|
818
954
|
"-lc",
|
|
819
955
|
inner
|
|
820
956
|
];
|
|
821
|
-
const remoteCommand = `docker ${quoteShellArgv(dockerArgv)}
|
|
957
|
+
const remoteCommand = loginShell(`docker ${quoteShellArgv(dockerArgv)}`);
|
|
822
958
|
const argv = [
|
|
823
959
|
"ssh",
|
|
824
960
|
...sshOptArgs(target),
|
|
@@ -869,61 +1005,49 @@ async function resolveBoxSshTarget(box) {
|
|
|
869
1005
|
port,
|
|
870
1006
|
user: CONTAINER_USER,
|
|
871
1007
|
identityFile: key.privatePath,
|
|
872
|
-
|
|
1008
|
+
// The box id bakes an alias; ssh on THIS host can't resolve an AgentBox
|
|
1009
|
+
// alias, so the ProxyJump must be the alias's real connection string.
|
|
1010
|
+
proxyJump: resolveConnection(remote.spec)
|
|
873
1011
|
};
|
|
874
1012
|
}
|
|
875
|
-
async function prepareRemoteDocker(opts) {
|
|
876
|
-
const log = opts.onLog ?? (() => {
|
|
877
|
-
});
|
|
878
|
-
const spec = (opts.host ?? "").trim();
|
|
879
|
-
if (!spec) {
|
|
880
|
-
throw new Error(
|
|
881
|
-
"remote-docker: prepare needs an SSH destination \u2014 `agentbox prepare --provider docker:<host>`, or set `box.remoteDockerHost`."
|
|
882
|
-
);
|
|
883
|
-
}
|
|
884
|
-
const remote = parseRemoteTarget(spec);
|
|
885
|
-
const target = await ensureTunnel(`engine:${remote.spec}`, remote);
|
|
886
|
-
log(`[prepare] ensuring the box image on ${remote.spec}`);
|
|
887
|
-
const res = await ensureRemoteImage(target, {
|
|
888
|
-
...opts.claudeInstall ? { claudeInstall: opts.claudeInstall } : {},
|
|
889
|
-
...opts.registry !== void 0 ? { registry: opts.registry } : {},
|
|
890
|
-
...opts.allowPull !== void 0 ? { allowPull: opts.allowPull } : {},
|
|
891
|
-
...opts.force ? { force: true } : {},
|
|
892
|
-
onLog: log
|
|
893
|
-
});
|
|
894
|
-
if (res.contextSha256) {
|
|
895
|
-
recordPreparedHost(remote.spec, { imageRef: res.ref, contextSha256: res.contextSha256 });
|
|
896
|
-
}
|
|
897
|
-
log(`[prepare] ${remote.spec} ready \u2014 ${res.ref} (${res.source})`);
|
|
898
|
-
return {};
|
|
899
|
-
}
|
|
900
1013
|
async function doctorChecks() {
|
|
901
1014
|
try {
|
|
902
1015
|
const cfg = await loadEffectiveConfig(process.cwd());
|
|
903
|
-
const
|
|
904
|
-
if (!
|
|
1016
|
+
const alias = (cfg.effective.box.remoteDockerHost || "").trim();
|
|
1017
|
+
if (!alias) {
|
|
905
1018
|
return [
|
|
906
1019
|
{
|
|
907
1020
|
label: "remote engine",
|
|
908
1021
|
status: "warn",
|
|
909
|
-
detail: "no default
|
|
910
|
-
hint: "`agentbox
|
|
1022
|
+
detail: "no default host alias set",
|
|
1023
|
+
hint: "`agentbox remote-docker add <alias> <[user@]host[:port]>`"
|
|
911
1024
|
}
|
|
912
1025
|
];
|
|
913
1026
|
}
|
|
914
|
-
const
|
|
1027
|
+
const entry = getHostAlias(alias);
|
|
1028
|
+
if (!entry) {
|
|
1029
|
+
return [
|
|
1030
|
+
{
|
|
1031
|
+
label: "remote engine",
|
|
1032
|
+
status: "warn",
|
|
1033
|
+
detail: `host alias '${alias}' is not registered`,
|
|
1034
|
+
hint: `\`agentbox remote-docker add ${alias} <[user@]host[:port]>\``
|
|
1035
|
+
}
|
|
1036
|
+
];
|
|
1037
|
+
}
|
|
1038
|
+
const probe = await probeRemoteEngine(entry.ssh);
|
|
915
1039
|
const engineRes = probe.ok ? {
|
|
916
1040
|
label: "remote engine",
|
|
917
1041
|
status: "ok",
|
|
918
|
-
detail: `${
|
|
1042
|
+
detail: `${alias} \u2192 ${entry.ssh} \u2014 docker ${probe.version} (${probe.os}/${probe.arch})`
|
|
919
1043
|
} : {
|
|
920
1044
|
label: "remote engine",
|
|
921
1045
|
status: "fail",
|
|
922
|
-
detail: probe.error,
|
|
923
|
-
hint: `check that \`ssh ${
|
|
1046
|
+
detail: probe.error ?? "unusable",
|
|
1047
|
+
hint: `check that \`ssh ${entry.ssh} true\` works and docker is installed there`
|
|
924
1048
|
};
|
|
925
1049
|
const prepared = readPreparedState();
|
|
926
|
-
const baked = prepared?.hosts[
|
|
1050
|
+
const baked = prepared?.hosts[alias];
|
|
927
1051
|
const imageRes = baked ? {
|
|
928
1052
|
label: "box image",
|
|
929
1053
|
status: "ok",
|
|
@@ -932,7 +1056,7 @@ async function doctorChecks() {
|
|
|
932
1056
|
label: "box image",
|
|
933
1057
|
status: "warn",
|
|
934
1058
|
detail: "not baked on this host yet",
|
|
935
|
-
hint: `\`agentbox prepare --provider docker:${
|
|
1059
|
+
hint: `\`agentbox prepare --provider docker:${alias}\` (otherwise the first create bakes it)`
|
|
936
1060
|
};
|
|
937
1061
|
const portlessRes = portlessDoctorRow(await detectPortless());
|
|
938
1062
|
return [engineRes, imageRes, portlessRes];
|
|
@@ -940,6 +1064,64 @@ async function doctorChecks() {
|
|
|
940
1064
|
return [{ label: "remote engine", status: "warn", detail: errSummary(err) }];
|
|
941
1065
|
}
|
|
942
1066
|
}
|
|
1067
|
+
async function interactiveRegisterHost() {
|
|
1068
|
+
if (!process.stdin.isTTY) {
|
|
1069
|
+
v.warn(
|
|
1070
|
+
"remote-docker needs a host \u2014 run `agentbox remote-docker add <alias> <[user@]host[:port]>` to register one"
|
|
1071
|
+
);
|
|
1072
|
+
return null;
|
|
1073
|
+
}
|
|
1074
|
+
const alias = await ue({
|
|
1075
|
+
message: "Name this remote host (a short alias)",
|
|
1076
|
+
placeholder: "buildbox",
|
|
1077
|
+
validate: (value) => {
|
|
1078
|
+
const v2 = (value ?? "").trim();
|
|
1079
|
+
if (!v2) return "required";
|
|
1080
|
+
try {
|
|
1081
|
+
assertValidAlias(v2);
|
|
1082
|
+
} catch (err) {
|
|
1083
|
+
return err instanceof Error ? err.message : String(err);
|
|
1084
|
+
}
|
|
1085
|
+
if (getHostAlias(v2)) return `'${v2}' is already registered`;
|
|
1086
|
+
return void 0;
|
|
1087
|
+
}
|
|
1088
|
+
});
|
|
1089
|
+
if (BD(alias)) return null;
|
|
1090
|
+
const name = alias.trim();
|
|
1091
|
+
for (; ; ) {
|
|
1092
|
+
const ssh = await ue({
|
|
1093
|
+
message: "SSH connection (an ~/.ssh/config alias or [user@]host[:port])",
|
|
1094
|
+
placeholder: "user@host",
|
|
1095
|
+
validate: (value) => (value ?? "").trim() ? void 0 : "required"
|
|
1096
|
+
});
|
|
1097
|
+
if (BD(ssh)) return null;
|
|
1098
|
+
const conn = ssh.trim();
|
|
1099
|
+
const s = L();
|
|
1100
|
+
s.start(`probing ${conn}`);
|
|
1101
|
+
const res = await probeRemoteEngine(conn);
|
|
1102
|
+
if (!res.ok) {
|
|
1103
|
+
s.stop(`${conn}: unusable`);
|
|
1104
|
+
v.error(res.error ?? "remote engine unusable");
|
|
1105
|
+
const retry = await me({
|
|
1106
|
+
message: "Try a different SSH connection?",
|
|
1107
|
+
initialValue: true
|
|
1108
|
+
});
|
|
1109
|
+
if (BD(retry) || !retry) return null;
|
|
1110
|
+
continue;
|
|
1111
|
+
}
|
|
1112
|
+
s.stop(`${conn}: docker ${res.version} (${res.os}/${res.arch})`);
|
|
1113
|
+
upsertHostAlias(name, conn);
|
|
1114
|
+
v.success(`registered '${name}' \u2192 ${conn}`);
|
|
1115
|
+
await setConfigValue("global", "box.remoteDockerHost", name, process.cwd(), { raw: true });
|
|
1116
|
+
const hostCount = listHostAliases().length;
|
|
1117
|
+
if (hostCount > 1) {
|
|
1118
|
+
v.info(
|
|
1119
|
+
`you have ${String(hostCount)} remote hosts \u2014 run \`agentbox docker:${name} claude\` to use this one`
|
|
1120
|
+
);
|
|
1121
|
+
}
|
|
1122
|
+
return name;
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
943
1125
|
var cloudProvider = createCloudProvider(remoteDockerBackend, {
|
|
944
1126
|
// Empty on purpose. The cloud default (2 cpu / 4 GB) would silently cap a box
|
|
945
1127
|
// on a 32-core workstation; a remote engine is the user's own machine, so a
|
|
@@ -1007,11 +1189,20 @@ var providerModule = {
|
|
|
1007
1189
|
};
|
|
1008
1190
|
export {
|
|
1009
1191
|
BACKEND_NAME,
|
|
1192
|
+
getHostAlias,
|
|
1193
|
+
interactiveRegisterHost,
|
|
1194
|
+
isValidAlias,
|
|
1195
|
+
listHostAliases,
|
|
1010
1196
|
listOnHost,
|
|
1011
1197
|
parseRemoteTarget,
|
|
1012
1198
|
parseSandboxId,
|
|
1013
1199
|
probeRemoteEngine,
|
|
1014
1200
|
providerModule,
|
|
1201
|
+
readHostsRegistry,
|
|
1202
|
+
readPreparedState,
|
|
1015
1203
|
remoteDockerBackend,
|
|
1016
|
-
remoteDockerProvider
|
|
1204
|
+
remoteDockerProvider,
|
|
1205
|
+
removeHostAlias,
|
|
1206
|
+
removePreparedHost,
|
|
1207
|
+
upsertHostAlias
|
|
1017
1208
|
};
|
|
@@ -18,8 +18,8 @@ import {
|
|
|
18
18
|
renderInnerCommand,
|
|
19
19
|
resolveCloudCheckpoint,
|
|
20
20
|
writeCloudCheckpointManifest
|
|
21
|
-
} from "./chunk-
|
|
22
|
-
import "./chunk-
|
|
21
|
+
} from "./chunk-EHBJKZCL.js";
|
|
22
|
+
import "./chunk-YJ5MJOXK.js";
|
|
23
23
|
import "./chunk-3LAHFDJF.js";
|
|
24
24
|
import {
|
|
25
25
|
UserFacingError,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
stageAllAgentStatic,
|
|
35
35
|
writeManagedSecrets,
|
|
36
36
|
writePreparedStateRaw
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-RXYOWSSN.js";
|
|
38
38
|
import "./chunk-UDZ3VXRF.js";
|
|
39
39
|
import "./chunk-QSMPSV5Z.js";
|
|
40
40
|
import "./chunk-OG4KH2FZ.js";
|
|
@@ -21,8 +21,8 @@ import {
|
|
|
21
21
|
renderInnerCommand,
|
|
22
22
|
resolveCloudCheckpoint,
|
|
23
23
|
writeCloudCheckpointManifest
|
|
24
|
-
} from "./chunk-
|
|
25
|
-
import "./chunk-
|
|
24
|
+
} from "./chunk-EHBJKZCL.js";
|
|
25
|
+
import "./chunk-YJ5MJOXK.js";
|
|
26
26
|
import "./chunk-3LAHFDJF.js";
|
|
27
27
|
import {
|
|
28
28
|
UserFacingError,
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
stageOpencodeStaticForUpload,
|
|
40
40
|
writeManagedSecrets,
|
|
41
41
|
writePreparedStateRaw
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-RXYOWSSN.js";
|
|
43
43
|
import {
|
|
44
44
|
execa
|
|
45
45
|
} from "./chunk-UDZ3VXRF.js";
|
|
@@ -20,8 +20,8 @@ import {
|
|
|
20
20
|
resolveCloudCheckpoint,
|
|
21
21
|
seedAgentStaticIntoCloudBox,
|
|
22
22
|
writeCloudCheckpointManifest
|
|
23
|
-
} from "./chunk-
|
|
24
|
-
import "./chunk-
|
|
23
|
+
} from "./chunk-EHBJKZCL.js";
|
|
24
|
+
import "./chunk-YJ5MJOXK.js";
|
|
25
25
|
import "./chunk-3LAHFDJF.js";
|
|
26
26
|
import {
|
|
27
27
|
BOX_IMAGE_REGISTRY,
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
stageAllAgentStatic,
|
|
38
38
|
writeManagedSecrets,
|
|
39
39
|
writePreparedStateRaw
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-RXYOWSSN.js";
|
|
41
41
|
import "./chunk-UDZ3VXRF.js";
|
|
42
42
|
import {
|
|
43
43
|
DAYTONA_VM_REGION,
|