@outerlayer/cli 0.34.1-next.20261029191024 → 0.34.1-next.20261029194222
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/dist/build-info.json +1 -1
- package/dist/chunk-EMBL45WE.js +287 -0
- package/dist/{chunk-VE3UM4HU.js → chunk-UPGN7KCY.js} +1 -1
- package/dist/{cli-NWOZT6B5.js → cli-EFJXK3VB.js} +7 -7
- package/dist/{command-WQG2Y6MV.js → command-UGIOJSET.js} +3 -276
- package/dist/{doctor-N5R5YUEC.js → doctor-QDTZWUOX.js} +23 -3
- package/dist/index.js +1 -1
- package/dist/{init-cmd-RBRSD4US.js → init-cmd-IFUQBRNA.js} +1 -1
- package/package.json +1 -1
package/dist/build-info.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"id":"2026-10-29T19:
|
|
1
|
+
{"id":"2026-10-29T19:46:53.306Z+f3cda02","root":"/home/runner/work/outerlayer/outerlayer","pkg":"outerlayer"}
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
import { helperSocketPath } from './chunk-Y5CPIOBF.js';
|
|
4
|
+
import { UNIT_MARKER } from './chunk-BMMSKKVA.js';
|
|
5
|
+
import { runnerDir } from './chunk-YQHUCOUL.js';
|
|
6
|
+
import { createHash } from 'crypto';
|
|
7
|
+
import { join } from 'path';
|
|
8
|
+
|
|
9
|
+
createRequire(import.meta.url);
|
|
10
|
+
var LIBEXEC = "/usr/local/libexec/outerlayer";
|
|
11
|
+
var ETC = "/etc/outerlayer";
|
|
12
|
+
var UID_BASE = 2e9;
|
|
13
|
+
var UID_COUNT = 256;
|
|
14
|
+
var UID_ATTEMPTS = 8;
|
|
15
|
+
var UID_STEP = 65536;
|
|
16
|
+
function helperUnitFor(unitName) {
|
|
17
|
+
return `${unitName}-helper`;
|
|
18
|
+
}
|
|
19
|
+
function helperDirFor(unitName) {
|
|
20
|
+
return `${LIBEXEC}/${helperUnitFor(unitName)}`;
|
|
21
|
+
}
|
|
22
|
+
function helperBinaryFor(unitName) {
|
|
23
|
+
return `${helperDirFor(unitName)}/outerlayer-host-helper`;
|
|
24
|
+
}
|
|
25
|
+
function helperSocketFor(unitName) {
|
|
26
|
+
return helperSocketPath(unitName);
|
|
27
|
+
}
|
|
28
|
+
function helperConfigPathFor(unitName) {
|
|
29
|
+
return `${ETC}/${helperUnitFor(unitName)}.json`;
|
|
30
|
+
}
|
|
31
|
+
function helperUnitPathFor(unitName) {
|
|
32
|
+
return `/etc/systemd/system/${helperUnitFor(unitName)}.service`;
|
|
33
|
+
}
|
|
34
|
+
function sliceFor(unitName) {
|
|
35
|
+
return `${unitName}-builds.slice`;
|
|
36
|
+
}
|
|
37
|
+
function slicePathFor(unitName) {
|
|
38
|
+
return `/etc/systemd/system/${sliceFor(unitName)}`;
|
|
39
|
+
}
|
|
40
|
+
function sliceUnitText(unitName, limits) {
|
|
41
|
+
return `${UNIT_MARKER}
|
|
42
|
+
[Unit]
|
|
43
|
+
Description=OuterLayer builds of ${unitName}
|
|
44
|
+
|
|
45
|
+
[Slice]
|
|
46
|
+
${limits.memoryMaxBytes === void 0 ? "" : `MemoryMax=${limits.memoryMaxBytes}
|
|
47
|
+
MemorySwapMax=0
|
|
48
|
+
`}${limits.cpus === void 0 ? "" : `CPUQuota=${Math.round(limits.cpus * 100)}%
|
|
49
|
+
`}`;
|
|
50
|
+
}
|
|
51
|
+
function sha256Of(bytes) {
|
|
52
|
+
return createHash("sha256").update(bytes).digest("hex");
|
|
53
|
+
}
|
|
54
|
+
function helperUnitText(unitName) {
|
|
55
|
+
const unit = helperUnitFor(unitName);
|
|
56
|
+
return `${UNIT_MARKER}
|
|
57
|
+
[Unit]
|
|
58
|
+
Description=OuterLayer root helper: starts microVM builds under Firecracker's jailer
|
|
59
|
+
After=local-fs.target
|
|
60
|
+
|
|
61
|
+
[Service]
|
|
62
|
+
ExecStart=${helperBinaryFor(unitName)} --config ${helperConfigPathFor(unitName)}
|
|
63
|
+
RuntimeDirectory=${unit}
|
|
64
|
+
RuntimeDirectoryMode=0755
|
|
65
|
+
RuntimeDirectoryPreserve=yes
|
|
66
|
+
Restart=on-failure
|
|
67
|
+
RestartSec=5
|
|
68
|
+
KillMode=process
|
|
69
|
+
|
|
70
|
+
[Install]
|
|
71
|
+
WantedBy=multi-user.target
|
|
72
|
+
`;
|
|
73
|
+
}
|
|
74
|
+
function helperConfigText(input) {
|
|
75
|
+
const dir = helperDirFor(input.unitName);
|
|
76
|
+
return `${JSON.stringify(
|
|
77
|
+
{
|
|
78
|
+
runnerUid: input.uid,
|
|
79
|
+
runnerGid: input.gid,
|
|
80
|
+
buildsRoot: input.buildsRoot,
|
|
81
|
+
jailBase: input.jailBase,
|
|
82
|
+
stateDir: `/run/${helperUnitFor(input.unitName)}/state`,
|
|
83
|
+
socket: helperSocketFor(input.unitName),
|
|
84
|
+
uidBase: input.uidBase,
|
|
85
|
+
uidCount: UID_COUNT,
|
|
86
|
+
...input.slice ? { slice: sliceFor(input.unitName) } : {},
|
|
87
|
+
jailer: { path: `${dir}/jailer`, sha256: input.pins.jailer },
|
|
88
|
+
firecracker: { path: `${dir}/firecracker`, sha256: input.pins.firecracker },
|
|
89
|
+
firecrackerVersion: input.pins.firecrackerVersion
|
|
90
|
+
},
|
|
91
|
+
null,
|
|
92
|
+
2
|
|
93
|
+
)}
|
|
94
|
+
`;
|
|
95
|
+
}
|
|
96
|
+
function notInstalled(ok, lines) {
|
|
97
|
+
return { ok, installed: false, lines };
|
|
98
|
+
}
|
|
99
|
+
async function installHelper(request, deps) {
|
|
100
|
+
const { helper } = deps;
|
|
101
|
+
const lines = [];
|
|
102
|
+
const say = deps.say ?? ((line) => void lines.push(line));
|
|
103
|
+
const unit = helperUnitFor(request.unitName);
|
|
104
|
+
const dir = helperDirFor(request.unitName);
|
|
105
|
+
const configFile = helperConfigPathFor(request.unitName);
|
|
106
|
+
const without = "microVM builds run Firecracker as the runner's account, as they did before";
|
|
107
|
+
if (!deps.systemd.running()) return notInstalled(true, [`systemd is not running, so the root helper is not installed: ${without}`]);
|
|
108
|
+
if (helper.pins.helper === void 0) {
|
|
109
|
+
return notInstalled(true, [`this release of the CLI pins no root helper, so none is installed: ${without}`]);
|
|
110
|
+
}
|
|
111
|
+
const identity = helper.identity(request.user);
|
|
112
|
+
if (identity === void 0) return notInstalled(false, [`the account ${request.user} was not found, so the root helper was not installed`]);
|
|
113
|
+
const runner = runnerDir(request.configPath);
|
|
114
|
+
const buildsRoot = join(runner, "builds");
|
|
115
|
+
const jailBase = helper.jailBase(buildsRoot, request.unitName);
|
|
116
|
+
if (jailBase === void 0) {
|
|
117
|
+
return notInstalled(true, [
|
|
118
|
+
`no directory that only root can write, below only such directories, is on the same file system as ${buildsRoot}, so the root helper was not installed: it links each build's files into its jail, and a link cannot cross file systems. ${without}`
|
|
119
|
+
]);
|
|
120
|
+
}
|
|
121
|
+
const others = helper.helperRanges().filter((range) => range.helper !== unit);
|
|
122
|
+
const own = helper.helperRanges().find((range) => range.helper === unit);
|
|
123
|
+
const takerOf = (base) => {
|
|
124
|
+
const account = helper.uidRangeTaker(base, UID_COUNT);
|
|
125
|
+
if (account !== void 0) return account;
|
|
126
|
+
const rival = others.find((range) => base < range.uidBase + range.uidCount && range.uidBase < base + UID_COUNT);
|
|
127
|
+
return rival === void 0 ? void 0 : `the root helper ${rival.helper}`;
|
|
128
|
+
};
|
|
129
|
+
const tried = [];
|
|
130
|
+
let uidBase;
|
|
131
|
+
const candidates = own === void 0 ? Array.from({ length: UID_ATTEMPTS + 1 }, (_, i) => UID_BASE + i * UID_STEP) : [own.uidBase, ...Array.from({ length: UID_ATTEMPTS + 1 }, (_, i) => UID_BASE + i * UID_STEP)];
|
|
132
|
+
for (const base of candidates) {
|
|
133
|
+
const taker = takerOf(base);
|
|
134
|
+
if (taker === void 0) {
|
|
135
|
+
uidBase = base;
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
tried.push(`${base} to ${base + UID_COUNT - 1} is used by ${taker}`);
|
|
139
|
+
}
|
|
140
|
+
if (uidBase === void 0) {
|
|
141
|
+
return notInstalled(false, [`every range of ${UID_COUNT} user ids that was tried is taken (${tried.join("; ")}), so the root helper was not installed`]);
|
|
142
|
+
}
|
|
143
|
+
let assets;
|
|
144
|
+
let helperBytes;
|
|
145
|
+
try {
|
|
146
|
+
assets = await helper.assets(runner);
|
|
147
|
+
helperBytes = await helper.fetchHelper();
|
|
148
|
+
} catch (err) {
|
|
149
|
+
return notInstalled(false, [`the files for the root helper could not be had: ${err instanceof Error ? err.message : String(err)}`]);
|
|
150
|
+
}
|
|
151
|
+
if (sha256Of(helperBytes) !== helper.pins.helper) {
|
|
152
|
+
return notInstalled(false, [`the root helper that was downloaded has sha256 ${sha256Of(helperBytes)}, not the ${helper.pins.helper} this release pins, so it was not installed`]);
|
|
153
|
+
}
|
|
154
|
+
const config = helperConfigText({ unitName: request.unitName, uid: identity.uid, gid: identity.gid, buildsRoot, jailBase, uidBase, slice: request.slice !== void 0, pins: helper.pins });
|
|
155
|
+
const unitPath = helperUnitPathFor(request.unitName);
|
|
156
|
+
const existed = deps.systemd.read(unitPath) !== void 0;
|
|
157
|
+
const staged = helper.stage({ "outerlayer-host-helper": helperBytes, "helper.json": config });
|
|
158
|
+
const root = (argv) => {
|
|
159
|
+
say(`sudo ${argv.join(" ")}`);
|
|
160
|
+
const result = helper.root(argv);
|
|
161
|
+
if (result.status !== 0) lines.push(`sudo ${argv.join(" ")} failed with exit status ${result.status}`);
|
|
162
|
+
return result.status === 0;
|
|
163
|
+
};
|
|
164
|
+
const systemctl = (args) => {
|
|
165
|
+
say(`sudo systemctl ${args.join(" ")}`);
|
|
166
|
+
return deps.systemd.systemctl(args, { sudo: true }).status === 0;
|
|
167
|
+
};
|
|
168
|
+
const removeFiles = () => {
|
|
169
|
+
helper.root(["rm", "-rf", dir]);
|
|
170
|
+
helper.root(["rm", "-f", configFile]);
|
|
171
|
+
};
|
|
172
|
+
const discard = () => {
|
|
173
|
+
if (existed) systemctl(["disable", "--now", unit]);
|
|
174
|
+
if (deps.systemd.read(unitPath) !== void 0) {
|
|
175
|
+
deps.systemd.remove(unitPath);
|
|
176
|
+
systemctl(["daemon-reload"]);
|
|
177
|
+
}
|
|
178
|
+
removeFiles();
|
|
179
|
+
};
|
|
180
|
+
const removeNewSlice = () => {
|
|
181
|
+
if (deps.systemd.read(slicePathFor(request.unitName)) !== void 0) deps.systemd.remove(slicePathFor(request.unitName));
|
|
182
|
+
};
|
|
183
|
+
try {
|
|
184
|
+
const copies = [
|
|
185
|
+
{ from: join(staged.dir, "outerlayer-host-helper"), to: helperBinaryFor(request.unitName), pin: helper.pins.helper, what: "helper" },
|
|
186
|
+
{ from: assets.jailer, to: `${dir}/jailer`, pin: helper.pins.jailer, what: "jailer" },
|
|
187
|
+
{ from: assets.firecracker, to: `${dir}/firecracker`, pin: helper.pins.firecracker, what: "Firecracker" }
|
|
188
|
+
];
|
|
189
|
+
const ok = root(["install", "-d", "-o", "root", "-g", "root", "-m", "0755", dir]) && root(["install", "-d", "-o", "root", "-g", "root", "-m", "0755", ETC]) && root(["install", "-d", "-o", "root", "-g", "root", "-m", "0755", jailBase]) && copies.every((copy) => root(["install", "-o", "root", "-g", "root", "-m", "0755", copy.from, copy.to])) && root(["install", "-o", "root", "-g", "root", "-m", "0644", join(staged.dir, "helper.json"), configFile]);
|
|
190
|
+
if (!ok) {
|
|
191
|
+
if (existed) lines.push(`the root helper ${unit} is installed, so its files were left in place`);
|
|
192
|
+
else removeFiles();
|
|
193
|
+
return notInstalled(false, lines);
|
|
194
|
+
}
|
|
195
|
+
for (const copy of copies) {
|
|
196
|
+
const bytes = helper.readFile(copy.to);
|
|
197
|
+
if (bytes === void 0 || sha256Of(bytes) !== copy.pin) {
|
|
198
|
+
discard();
|
|
199
|
+
return notInstalled(false, [...lines, `the ${copy.what} copied to ${copy.to} is not the file this release pins, so the root helper was not installed`]);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
if (helper.readFile(configFile)?.toString("utf8") !== config) {
|
|
203
|
+
discard();
|
|
204
|
+
return notInstalled(false, [...lines, `the config copied to ${configFile} is not the one the installer wrote, so the root helper was not installed`]);
|
|
205
|
+
}
|
|
206
|
+
const writable = deps.accountCan === void 0 ? void 0 : [dir, ...copies.map((copy) => copy.to), configFile, ETC].find((path) => deps.accountCan(request.user, "-w", path));
|
|
207
|
+
if (writable !== void 0) {
|
|
208
|
+
discard();
|
|
209
|
+
return notInstalled(false, [...lines, `the account ${request.user} can write ${writable}, which root runs or reads, so the root helper was not installed`]);
|
|
210
|
+
}
|
|
211
|
+
} finally {
|
|
212
|
+
staged.remove();
|
|
213
|
+
}
|
|
214
|
+
const slicePath = slicePathFor(request.unitName);
|
|
215
|
+
try {
|
|
216
|
+
if (request.slice !== void 0) {
|
|
217
|
+
say(`sudo tee ${slicePath}`);
|
|
218
|
+
deps.systemd.write(slicePath, sliceUnitText(request.unitName, request.slice));
|
|
219
|
+
} else if (deps.systemd.read(slicePath)?.startsWith(UNIT_MARKER) === true) {
|
|
220
|
+
say(`sudo rm ${slicePath}`);
|
|
221
|
+
deps.systemd.remove(slicePath);
|
|
222
|
+
}
|
|
223
|
+
say(`sudo tee ${unitPath}`);
|
|
224
|
+
deps.systemd.write(unitPath, helperUnitText(request.unitName));
|
|
225
|
+
} catch (err) {
|
|
226
|
+
if (!existed) {
|
|
227
|
+
removeFiles();
|
|
228
|
+
removeNewSlice();
|
|
229
|
+
}
|
|
230
|
+
return notInstalled(false, [...lines, err instanceof Error ? err.message : String(err)]);
|
|
231
|
+
}
|
|
232
|
+
if (!systemctl(["daemon-reload"]) || !systemctl(["enable", "--now", unit]) || existed && !systemctl(["restart", unit])) {
|
|
233
|
+
if (!existed) {
|
|
234
|
+
discard();
|
|
235
|
+
removeNewSlice();
|
|
236
|
+
}
|
|
237
|
+
lines.push(`the unit ${unit} did not start, so the root helper is not running: ${without}`);
|
|
238
|
+
return notInstalled(false, lines);
|
|
239
|
+
}
|
|
240
|
+
lines.push(`installed and started the root helper ${unit}: it runs as root, starts each microVM build under Firecracker's jailer and does nothing else`);
|
|
241
|
+
return { ok: true, installed: true, lines };
|
|
242
|
+
}
|
|
243
|
+
function uninstallHelper(request, deps) {
|
|
244
|
+
const lines = [];
|
|
245
|
+
const say = deps.say ?? ((line) => void lines.push(line));
|
|
246
|
+
const unit = helperUnitFor(request.unitName);
|
|
247
|
+
const unitPath = helperUnitPathFor(request.unitName);
|
|
248
|
+
const configFile = helperConfigPathFor(request.unitName);
|
|
249
|
+
const dir = helperDirFor(request.unitName);
|
|
250
|
+
const config = deps.helper.readFile(configFile);
|
|
251
|
+
let jailBase;
|
|
252
|
+
if (config !== void 0) {
|
|
253
|
+
try {
|
|
254
|
+
jailBase = JSON.parse(config.toString("utf8")).jailBase;
|
|
255
|
+
} catch {
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
const systemctl = (args) => {
|
|
259
|
+
say(`sudo systemctl ${args.join(" ")}`);
|
|
260
|
+
deps.systemd.systemctl(args, { sudo: true });
|
|
261
|
+
};
|
|
262
|
+
const root = (argv) => {
|
|
263
|
+
say(`sudo ${argv.join(" ")}`);
|
|
264
|
+
deps.helper.root(argv);
|
|
265
|
+
};
|
|
266
|
+
const installed = deps.systemd.read(unitPath) !== void 0 || config !== void 0;
|
|
267
|
+
if (!installed) return { ok: true, installed: false, lines };
|
|
268
|
+
systemctl(["disable", "--now", unit]);
|
|
269
|
+
if (deps.systemd.read(unitPath) !== void 0) {
|
|
270
|
+
say(`sudo rm ${unitPath}`);
|
|
271
|
+
deps.systemd.remove(unitPath);
|
|
272
|
+
systemctl(["daemon-reload"]);
|
|
273
|
+
}
|
|
274
|
+
root(["rm", "-rf", dir]);
|
|
275
|
+
root(["rm", "-f", configFile]);
|
|
276
|
+
const slicePath = slicePathFor(request.unitName);
|
|
277
|
+
if (deps.systemd.read(slicePath)?.startsWith(UNIT_MARKER) === true) {
|
|
278
|
+
say(`sudo rm ${slicePath}`);
|
|
279
|
+
deps.systemd.remove(slicePath);
|
|
280
|
+
systemctl(["daemon-reload"]);
|
|
281
|
+
}
|
|
282
|
+
if (jailBase !== void 0) root(["rmdir", `${jailBase}/firecracker`, jailBase]);
|
|
283
|
+
lines.push(`removed the root helper ${unit}`);
|
|
284
|
+
return { ok: true, installed: false, lines };
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export { helperBinaryFor, helperSocketFor, helperUnitFor, installHelper, uninstallHelper };
|
|
@@ -1224,7 +1224,7 @@ async function gatherDoctorChecks() {
|
|
|
1224
1224
|
const { runnerVmCheck } = await import('./doctor-53F2PYY7.js');
|
|
1225
1225
|
checks.push(runnerVmCheck(configPath, { lima: realLima(), home: homeFromEnv(), instance: runnerVm.instance }));
|
|
1226
1226
|
} else if (hasRunnerBlock(configPath)) {
|
|
1227
|
-
const { runnerHostChecks } = await import('./doctor-
|
|
1227
|
+
const { runnerHostChecks } = await import('./doctor-QDTZWUOX.js');
|
|
1228
1228
|
const gateway = (() => {
|
|
1229
1229
|
try {
|
|
1230
1230
|
const loaded = loadRunnerConfig(configPath);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { gatherDoctorChecks, doctorExitCode, summarizeChecks, renderDoctorText, recordWrapped, recordUnwrapped, recordRemoval, readManifest, recordInstall, recordStatusline } from './chunk-
|
|
3
|
+
import { gatherDoctorChecks, doctorExitCode, summarizeChecks, renderDoctorText, recordWrapped, recordUnwrapped, recordRemoval, readManifest, recordInstall, recordStatusline } from './chunk-UPGN7KCY.js';
|
|
4
4
|
import './chunk-Q7ZHL6FY.js';
|
|
5
5
|
import './chunk-OHQMGLJP.js';
|
|
6
6
|
import './chunk-VQCAJUDV.js';
|
|
@@ -3926,13 +3926,13 @@ what CLIs older than ${FIRST_VERSION_READING_AGENTS_SKILLS} do. \`` + cliInvocat
|
|
|
3926
3926
|
if (changed.length > 0 && !opts.json) process.stdout.write(`Removed the claude function from ${changed.join(", ")}.
|
|
3927
3927
|
`);
|
|
3928
3928
|
}
|
|
3929
|
-
const shell = !opts.remove && opts.shellFunction !== void 0 ? (await import('./init-cmd-
|
|
3929
|
+
const shell = !opts.remove && opts.shellFunction !== void 0 ? (await import('./init-cmd-IFUQBRNA.js')).applyShellFunctionFlag(opts.shellFunction, { home: homeFromEnv(), shellPath: process.env.SHELL }) : void 0;
|
|
3930
3930
|
if (opts.json) writeJson(shell === void 0 ? outcome.result : { ...outcome.result, shellFunction: { outcome: shell.outcome, reason: shell.reason } });
|
|
3931
3931
|
else process.stdout.write(outcome.text + skillsLine + (shell?.text ?? ""));
|
|
3932
3932
|
return;
|
|
3933
3933
|
}
|
|
3934
3934
|
await installMachineSkillsForSetup();
|
|
3935
|
-
const { runInitCommand } = await import('./init-cmd-
|
|
3935
|
+
const { runInitCommand } = await import('./init-cmd-IFUQBRNA.js');
|
|
3936
3936
|
const code = await runInitCommand(
|
|
3937
3937
|
{ json: opts.json, factory: opts.factory, shellFunction: opts.shellFunction },
|
|
3938
3938
|
{
|
|
@@ -5240,13 +5240,13 @@ function registerRunnerCommands(program2) {
|
|
|
5240
5240
|
}
|
|
5241
5241
|
}
|
|
5242
5242
|
const buildCpusMax = opts.buildCpusMax === void 0 ? void 0 : Number(opts.buildCpusMax);
|
|
5243
|
-
if (buildCpusMax !== void 0 && !(await import('./command-
|
|
5243
|
+
if (buildCpusMax !== void 0 && !(await import('./command-UGIOJSET.js')).cpusAreValid(buildCpusMax)) {
|
|
5244
5244
|
fail(`--build-cpus-max ${opts.buildCpusMax} is not a number of CPUs from 0.01 to 1024.`);
|
|
5245
5245
|
return;
|
|
5246
5246
|
}
|
|
5247
5247
|
try {
|
|
5248
5248
|
if (opts.service === true) {
|
|
5249
|
-
const { installServiceCommand } = await import('./command-
|
|
5249
|
+
const { installServiceCommand } = await import('./command-UGIOJSET.js');
|
|
5250
5250
|
const result2 = await installServiceCommand({
|
|
5251
5251
|
configPath,
|
|
5252
5252
|
print: opts.print,
|
|
@@ -5304,7 +5304,7 @@ To keep it running, run ${C.yellow}${cliInvocation()} runner install --service${
|
|
|
5304
5304
|
return;
|
|
5305
5305
|
}
|
|
5306
5306
|
const { defaultRunnerConfigPath } = await import('./config-FVSPGZIO.js');
|
|
5307
|
-
const { uninstallServiceCommand } = await import('./command-
|
|
5307
|
+
const { uninstallServiceCommand } = await import('./command-UGIOJSET.js');
|
|
5308
5308
|
const result = await uninstallServiceCommand({ configPath: opts.config ?? defaultRunnerConfigPath(), unitName: opts.unitName, home: homeFromEnv() });
|
|
5309
5309
|
if (result.ok) for (const line of result.lines) process.stdout.write(`${C.green}\u2713${C.reset} ${line}
|
|
5310
5310
|
`);
|
|
@@ -5486,7 +5486,7 @@ ${C.yellow}The runner will not update itself: ${installErr.message}${C.reset}
|
|
|
5486
5486
|
let serviceUp = false;
|
|
5487
5487
|
let restart;
|
|
5488
5488
|
if (installedLayout) {
|
|
5489
|
-
const { installServiceCommand } = await import('./command-
|
|
5489
|
+
const { installServiceCommand } = await import('./command-UGIOJSET.js');
|
|
5490
5490
|
const service = await installServiceCommand({
|
|
5491
5491
|
configPath,
|
|
5492
5492
|
entryPath: process.argv[1] ?? "",
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
3
|
import { realOwnership, accountNamed, handOver, runRunnerInstall, launcherSummary, restartNote, accountIdentity } from './chunk-2F43WNKI.js';
|
|
4
|
+
import { installHelper, helperUnitFor, helperSocketFor, uninstallHelper } from './chunk-EMBL45WE.js';
|
|
4
5
|
import './chunk-VNHBDHX7.js';
|
|
5
6
|
import { currentLink, execStartCommand } from './chunk-7R655ODT.js';
|
|
6
|
-
import { detectMachine,
|
|
7
|
+
import { detectMachine, ensureFirecrackerAndJailer } from './chunk-Y5CPIOBF.js';
|
|
7
8
|
import './chunk-2PGI6RDE.js';
|
|
8
9
|
import './chunk-5ESKQSQP.js';
|
|
9
10
|
import './chunk-F26I6GKL.js';
|
|
@@ -16,7 +17,7 @@ import './chunk-QRDF5A3U.js';
|
|
|
16
17
|
import './chunk-SQGD4LYW.js';
|
|
17
18
|
import './chunk-TQMI335S.js';
|
|
18
19
|
import './chunk-WJPBZFSF.js';
|
|
19
|
-
import { unitNameProblem, DEFAULT_UNIT_NAME, checkFit, installService, uninstallService, realTaskScheduler
|
|
20
|
+
import { unitNameProblem, DEFAULT_UNIT_NAME, checkFit, installService, uninstallService, realTaskScheduler } from './chunk-BMMSKKVA.js';
|
|
20
21
|
import { realLima } from './chunk-77MM5RYD.js';
|
|
21
22
|
import { writeLaunchAgent, launchAgentPath } from './chunk-LF6MLJCY.js';
|
|
22
23
|
import './chunk-NFBWTJ3A.js';
|
|
@@ -60,284 +61,10 @@ import './chunk-MESOOLF4.js';
|
|
|
60
61
|
import './chunk-Z5GEFMRW.js';
|
|
61
62
|
import { userInfo, totalmem, tmpdir } from 'os';
|
|
62
63
|
import { dirname, join } from 'path';
|
|
63
|
-
import { createHash } from 'crypto';
|
|
64
64
|
import { rmSync, existsSync, readdirSync, mkdtempSync, writeFileSync, readFileSync, statSync, lstatSync } from 'fs';
|
|
65
65
|
import { spawnSync } from 'child_process';
|
|
66
66
|
|
|
67
67
|
createRequire(import.meta.url);
|
|
68
|
-
var LIBEXEC = "/usr/local/libexec/outerlayer";
|
|
69
|
-
var ETC = "/etc/outerlayer";
|
|
70
|
-
var UID_BASE = 2e9;
|
|
71
|
-
var UID_COUNT = 256;
|
|
72
|
-
var UID_ATTEMPTS = 8;
|
|
73
|
-
var UID_STEP = 65536;
|
|
74
|
-
function helperUnitFor(unitName) {
|
|
75
|
-
return `${unitName}-helper`;
|
|
76
|
-
}
|
|
77
|
-
function helperDirFor(unitName) {
|
|
78
|
-
return `${LIBEXEC}/${helperUnitFor(unitName)}`;
|
|
79
|
-
}
|
|
80
|
-
function helperSocketFor(unitName) {
|
|
81
|
-
return helperSocketPath(unitName);
|
|
82
|
-
}
|
|
83
|
-
function helperConfigPathFor(unitName) {
|
|
84
|
-
return `${ETC}/${helperUnitFor(unitName)}.json`;
|
|
85
|
-
}
|
|
86
|
-
function helperUnitPathFor(unitName) {
|
|
87
|
-
return `/etc/systemd/system/${helperUnitFor(unitName)}.service`;
|
|
88
|
-
}
|
|
89
|
-
function sliceFor(unitName) {
|
|
90
|
-
return `${unitName}-builds.slice`;
|
|
91
|
-
}
|
|
92
|
-
function slicePathFor(unitName) {
|
|
93
|
-
return `/etc/systemd/system/${sliceFor(unitName)}`;
|
|
94
|
-
}
|
|
95
|
-
function sliceUnitText(unitName, limits) {
|
|
96
|
-
return `${UNIT_MARKER}
|
|
97
|
-
[Unit]
|
|
98
|
-
Description=OuterLayer builds of ${unitName}
|
|
99
|
-
|
|
100
|
-
[Slice]
|
|
101
|
-
${limits.memoryMaxBytes === void 0 ? "" : `MemoryMax=${limits.memoryMaxBytes}
|
|
102
|
-
MemorySwapMax=0
|
|
103
|
-
`}${limits.cpus === void 0 ? "" : `CPUQuota=${Math.round(limits.cpus * 100)}%
|
|
104
|
-
`}`;
|
|
105
|
-
}
|
|
106
|
-
function sha256Of(bytes) {
|
|
107
|
-
return createHash("sha256").update(bytes).digest("hex");
|
|
108
|
-
}
|
|
109
|
-
function helperUnitText(unitName) {
|
|
110
|
-
const unit = helperUnitFor(unitName);
|
|
111
|
-
return `${UNIT_MARKER}
|
|
112
|
-
[Unit]
|
|
113
|
-
Description=OuterLayer root helper: starts microVM builds under Firecracker's jailer
|
|
114
|
-
After=local-fs.target
|
|
115
|
-
|
|
116
|
-
[Service]
|
|
117
|
-
ExecStart=${helperDirFor(unitName)}/outerlayer-host-helper --config ${helperConfigPathFor(unitName)}
|
|
118
|
-
RuntimeDirectory=${unit}
|
|
119
|
-
RuntimeDirectoryMode=0755
|
|
120
|
-
RuntimeDirectoryPreserve=yes
|
|
121
|
-
Restart=on-failure
|
|
122
|
-
RestartSec=5
|
|
123
|
-
KillMode=process
|
|
124
|
-
|
|
125
|
-
[Install]
|
|
126
|
-
WantedBy=multi-user.target
|
|
127
|
-
`;
|
|
128
|
-
}
|
|
129
|
-
function helperConfigText(input) {
|
|
130
|
-
const dir = helperDirFor(input.unitName);
|
|
131
|
-
return `${JSON.stringify(
|
|
132
|
-
{
|
|
133
|
-
runnerUid: input.uid,
|
|
134
|
-
runnerGid: input.gid,
|
|
135
|
-
buildsRoot: input.buildsRoot,
|
|
136
|
-
jailBase: input.jailBase,
|
|
137
|
-
stateDir: `/run/${helperUnitFor(input.unitName)}/state`,
|
|
138
|
-
socket: helperSocketFor(input.unitName),
|
|
139
|
-
uidBase: input.uidBase,
|
|
140
|
-
uidCount: UID_COUNT,
|
|
141
|
-
...input.slice ? { slice: sliceFor(input.unitName) } : {},
|
|
142
|
-
jailer: { path: `${dir}/jailer`, sha256: input.pins.jailer },
|
|
143
|
-
firecracker: { path: `${dir}/firecracker`, sha256: input.pins.firecracker },
|
|
144
|
-
firecrackerVersion: input.pins.firecrackerVersion
|
|
145
|
-
},
|
|
146
|
-
null,
|
|
147
|
-
2
|
|
148
|
-
)}
|
|
149
|
-
`;
|
|
150
|
-
}
|
|
151
|
-
function notInstalled(ok, lines) {
|
|
152
|
-
return { ok, installed: false, lines };
|
|
153
|
-
}
|
|
154
|
-
async function installHelper(request, deps) {
|
|
155
|
-
const { helper } = deps;
|
|
156
|
-
const lines = [];
|
|
157
|
-
const say = deps.say ?? ((line) => void lines.push(line));
|
|
158
|
-
const unit = helperUnitFor(request.unitName);
|
|
159
|
-
const dir = helperDirFor(request.unitName);
|
|
160
|
-
const configFile = helperConfigPathFor(request.unitName);
|
|
161
|
-
const without = "microVM builds run Firecracker as the runner's account, as they did before";
|
|
162
|
-
if (!deps.systemd.running()) return notInstalled(true, [`systemd is not running, so the root helper is not installed: ${without}`]);
|
|
163
|
-
if (helper.pins.helper === void 0) {
|
|
164
|
-
return notInstalled(true, [`this release of the CLI pins no root helper, so none is installed: ${without}`]);
|
|
165
|
-
}
|
|
166
|
-
const identity = helper.identity(request.user);
|
|
167
|
-
if (identity === void 0) return notInstalled(false, [`the account ${request.user} was not found, so the root helper was not installed`]);
|
|
168
|
-
const runner = runnerDir(request.configPath);
|
|
169
|
-
const buildsRoot = join(runner, "builds");
|
|
170
|
-
const jailBase = helper.jailBase(buildsRoot, request.unitName);
|
|
171
|
-
if (jailBase === void 0) {
|
|
172
|
-
return notInstalled(true, [
|
|
173
|
-
`no directory that only root can write, below only such directories, is on the same file system as ${buildsRoot}, so the root helper was not installed: it links each build's files into its jail, and a link cannot cross file systems. ${without}`
|
|
174
|
-
]);
|
|
175
|
-
}
|
|
176
|
-
const others = helper.helperRanges().filter((range) => range.helper !== unit);
|
|
177
|
-
const own = helper.helperRanges().find((range) => range.helper === unit);
|
|
178
|
-
const takerOf = (base) => {
|
|
179
|
-
const account = helper.uidRangeTaker(base, UID_COUNT);
|
|
180
|
-
if (account !== void 0) return account;
|
|
181
|
-
const rival = others.find((range) => base < range.uidBase + range.uidCount && range.uidBase < base + UID_COUNT);
|
|
182
|
-
return rival === void 0 ? void 0 : `the root helper ${rival.helper}`;
|
|
183
|
-
};
|
|
184
|
-
const tried = [];
|
|
185
|
-
let uidBase;
|
|
186
|
-
const candidates = own === void 0 ? Array.from({ length: UID_ATTEMPTS + 1 }, (_, i) => UID_BASE + i * UID_STEP) : [own.uidBase, ...Array.from({ length: UID_ATTEMPTS + 1 }, (_, i) => UID_BASE + i * UID_STEP)];
|
|
187
|
-
for (const base of candidates) {
|
|
188
|
-
const taker = takerOf(base);
|
|
189
|
-
if (taker === void 0) {
|
|
190
|
-
uidBase = base;
|
|
191
|
-
break;
|
|
192
|
-
}
|
|
193
|
-
tried.push(`${base} to ${base + UID_COUNT - 1} is used by ${taker}`);
|
|
194
|
-
}
|
|
195
|
-
if (uidBase === void 0) {
|
|
196
|
-
return notInstalled(false, [`every range of ${UID_COUNT} user ids that was tried is taken (${tried.join("; ")}), so the root helper was not installed`]);
|
|
197
|
-
}
|
|
198
|
-
let assets;
|
|
199
|
-
let helperBytes;
|
|
200
|
-
try {
|
|
201
|
-
assets = await helper.assets(runner);
|
|
202
|
-
helperBytes = await helper.fetchHelper();
|
|
203
|
-
} catch (err) {
|
|
204
|
-
return notInstalled(false, [`the files for the root helper could not be had: ${err instanceof Error ? err.message : String(err)}`]);
|
|
205
|
-
}
|
|
206
|
-
if (sha256Of(helperBytes) !== helper.pins.helper) {
|
|
207
|
-
return notInstalled(false, [`the root helper that was downloaded has sha256 ${sha256Of(helperBytes)}, not the ${helper.pins.helper} this release pins, so it was not installed`]);
|
|
208
|
-
}
|
|
209
|
-
const config = helperConfigText({ unitName: request.unitName, uid: identity.uid, gid: identity.gid, buildsRoot, jailBase, uidBase, slice: request.slice !== void 0, pins: helper.pins });
|
|
210
|
-
const unitPath = helperUnitPathFor(request.unitName);
|
|
211
|
-
const existed = deps.systemd.read(unitPath) !== void 0;
|
|
212
|
-
const staged = helper.stage({ "outerlayer-host-helper": helperBytes, "helper.json": config });
|
|
213
|
-
const root = (argv) => {
|
|
214
|
-
say(`sudo ${argv.join(" ")}`);
|
|
215
|
-
const result = helper.root(argv);
|
|
216
|
-
if (result.status !== 0) lines.push(`sudo ${argv.join(" ")} failed with exit status ${result.status}`);
|
|
217
|
-
return result.status === 0;
|
|
218
|
-
};
|
|
219
|
-
const systemctl = (args) => {
|
|
220
|
-
say(`sudo systemctl ${args.join(" ")}`);
|
|
221
|
-
return deps.systemd.systemctl(args, { sudo: true }).status === 0;
|
|
222
|
-
};
|
|
223
|
-
const removeFiles = () => {
|
|
224
|
-
helper.root(["rm", "-rf", dir]);
|
|
225
|
-
helper.root(["rm", "-f", configFile]);
|
|
226
|
-
};
|
|
227
|
-
const discard = () => {
|
|
228
|
-
if (existed) systemctl(["disable", "--now", unit]);
|
|
229
|
-
if (deps.systemd.read(unitPath) !== void 0) {
|
|
230
|
-
deps.systemd.remove(unitPath);
|
|
231
|
-
systemctl(["daemon-reload"]);
|
|
232
|
-
}
|
|
233
|
-
removeFiles();
|
|
234
|
-
};
|
|
235
|
-
const removeNewSlice = () => {
|
|
236
|
-
if (deps.systemd.read(slicePathFor(request.unitName)) !== void 0) deps.systemd.remove(slicePathFor(request.unitName));
|
|
237
|
-
};
|
|
238
|
-
try {
|
|
239
|
-
const copies = [
|
|
240
|
-
{ from: join(staged.dir, "outerlayer-host-helper"), to: `${dir}/outerlayer-host-helper`, pin: helper.pins.helper, what: "helper" },
|
|
241
|
-
{ from: assets.jailer, to: `${dir}/jailer`, pin: helper.pins.jailer, what: "jailer" },
|
|
242
|
-
{ from: assets.firecracker, to: `${dir}/firecracker`, pin: helper.pins.firecracker, what: "Firecracker" }
|
|
243
|
-
];
|
|
244
|
-
const ok = root(["install", "-d", "-o", "root", "-g", "root", "-m", "0755", dir]) && root(["install", "-d", "-o", "root", "-g", "root", "-m", "0755", ETC]) && root(["install", "-d", "-o", "root", "-g", "root", "-m", "0755", jailBase]) && copies.every((copy) => root(["install", "-o", "root", "-g", "root", "-m", "0755", copy.from, copy.to])) && root(["install", "-o", "root", "-g", "root", "-m", "0644", join(staged.dir, "helper.json"), configFile]);
|
|
245
|
-
if (!ok) {
|
|
246
|
-
if (existed) lines.push(`the root helper ${unit} is installed, so its files were left in place`);
|
|
247
|
-
else removeFiles();
|
|
248
|
-
return notInstalled(false, lines);
|
|
249
|
-
}
|
|
250
|
-
for (const copy of copies) {
|
|
251
|
-
const bytes = helper.readFile(copy.to);
|
|
252
|
-
if (bytes === void 0 || sha256Of(bytes) !== copy.pin) {
|
|
253
|
-
discard();
|
|
254
|
-
return notInstalled(false, [...lines, `the ${copy.what} copied to ${copy.to} is not the file this release pins, so the root helper was not installed`]);
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
if (helper.readFile(configFile)?.toString("utf8") !== config) {
|
|
258
|
-
discard();
|
|
259
|
-
return notInstalled(false, [...lines, `the config copied to ${configFile} is not the one the installer wrote, so the root helper was not installed`]);
|
|
260
|
-
}
|
|
261
|
-
const writable = deps.accountCan === void 0 ? void 0 : [dir, ...copies.map((copy) => copy.to), configFile, ETC].find((path) => deps.accountCan(request.user, "-w", path));
|
|
262
|
-
if (writable !== void 0) {
|
|
263
|
-
discard();
|
|
264
|
-
return notInstalled(false, [...lines, `the account ${request.user} can write ${writable}, which root runs or reads, so the root helper was not installed`]);
|
|
265
|
-
}
|
|
266
|
-
} finally {
|
|
267
|
-
staged.remove();
|
|
268
|
-
}
|
|
269
|
-
const slicePath = slicePathFor(request.unitName);
|
|
270
|
-
try {
|
|
271
|
-
if (request.slice !== void 0) {
|
|
272
|
-
say(`sudo tee ${slicePath}`);
|
|
273
|
-
deps.systemd.write(slicePath, sliceUnitText(request.unitName, request.slice));
|
|
274
|
-
} else if (deps.systemd.read(slicePath)?.startsWith(UNIT_MARKER) === true) {
|
|
275
|
-
say(`sudo rm ${slicePath}`);
|
|
276
|
-
deps.systemd.remove(slicePath);
|
|
277
|
-
}
|
|
278
|
-
say(`sudo tee ${unitPath}`);
|
|
279
|
-
deps.systemd.write(unitPath, helperUnitText(request.unitName));
|
|
280
|
-
} catch (err) {
|
|
281
|
-
if (!existed) {
|
|
282
|
-
removeFiles();
|
|
283
|
-
removeNewSlice();
|
|
284
|
-
}
|
|
285
|
-
return notInstalled(false, [...lines, err instanceof Error ? err.message : String(err)]);
|
|
286
|
-
}
|
|
287
|
-
if (!systemctl(["daemon-reload"]) || !systemctl(["enable", "--now", unit]) || existed && !systemctl(["restart", unit])) {
|
|
288
|
-
if (!existed) {
|
|
289
|
-
discard();
|
|
290
|
-
removeNewSlice();
|
|
291
|
-
}
|
|
292
|
-
lines.push(`the unit ${unit} did not start, so the root helper is not running: ${without}`);
|
|
293
|
-
return notInstalled(false, lines);
|
|
294
|
-
}
|
|
295
|
-
lines.push(`installed and started the root helper ${unit}: it runs as root, starts each microVM build under Firecracker's jailer and does nothing else`);
|
|
296
|
-
return { ok: true, installed: true, lines };
|
|
297
|
-
}
|
|
298
|
-
function uninstallHelper(request, deps) {
|
|
299
|
-
const lines = [];
|
|
300
|
-
const say = deps.say ?? ((line) => void lines.push(line));
|
|
301
|
-
const unit = helperUnitFor(request.unitName);
|
|
302
|
-
const unitPath = helperUnitPathFor(request.unitName);
|
|
303
|
-
const configFile = helperConfigPathFor(request.unitName);
|
|
304
|
-
const dir = helperDirFor(request.unitName);
|
|
305
|
-
const config = deps.helper.readFile(configFile);
|
|
306
|
-
let jailBase;
|
|
307
|
-
if (config !== void 0) {
|
|
308
|
-
try {
|
|
309
|
-
jailBase = JSON.parse(config.toString("utf8")).jailBase;
|
|
310
|
-
} catch {
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
const systemctl = (args) => {
|
|
314
|
-
say(`sudo systemctl ${args.join(" ")}`);
|
|
315
|
-
deps.systemd.systemctl(args, { sudo: true });
|
|
316
|
-
};
|
|
317
|
-
const root = (argv) => {
|
|
318
|
-
say(`sudo ${argv.join(" ")}`);
|
|
319
|
-
deps.helper.root(argv);
|
|
320
|
-
};
|
|
321
|
-
const installed = deps.systemd.read(unitPath) !== void 0 || config !== void 0;
|
|
322
|
-
if (!installed) return { ok: true, installed: false, lines };
|
|
323
|
-
systemctl(["disable", "--now", unit]);
|
|
324
|
-
if (deps.systemd.read(unitPath) !== void 0) {
|
|
325
|
-
say(`sudo rm ${unitPath}`);
|
|
326
|
-
deps.systemd.remove(unitPath);
|
|
327
|
-
systemctl(["daemon-reload"]);
|
|
328
|
-
}
|
|
329
|
-
root(["rm", "-rf", dir]);
|
|
330
|
-
root(["rm", "-f", configFile]);
|
|
331
|
-
const slicePath = slicePathFor(request.unitName);
|
|
332
|
-
if (deps.systemd.read(slicePath)?.startsWith(UNIT_MARKER) === true) {
|
|
333
|
-
say(`sudo rm ${slicePath}`);
|
|
334
|
-
deps.systemd.remove(slicePath);
|
|
335
|
-
systemctl(["daemon-reload"]);
|
|
336
|
-
}
|
|
337
|
-
if (jailBase !== void 0) root(["rmdir", `${jailBase}/firecracker`, jailBase]);
|
|
338
|
-
lines.push(`removed the root helper ${unit}`);
|
|
339
|
-
return { ok: true, installed: false, lines };
|
|
340
|
-
}
|
|
341
68
|
async function serviceInVm(lima, instance, action, options) {
|
|
342
69
|
const limactl = lima.locate();
|
|
343
70
|
if (limactl === void 0) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
3
|
import { KIND_LABEL, managedProblems, fleetConfigProblem, askFleetMachine } from './chunk-2WXFXI36.js';
|
|
4
|
+
import { helperBinaryFor } from './chunk-EMBL45WE.js';
|
|
4
5
|
import { launcherCheck } from './chunk-VNHBDHX7.js';
|
|
5
6
|
import './chunk-7R655ODT.js';
|
|
6
7
|
import { RepoFilter } from './chunk-TBT347UY.js';
|
|
@@ -23,7 +24,7 @@ import { builtinKind, keepsHostBuilder, allowHostProblem, MAX_ALLOW_HOSTS } from
|
|
|
23
24
|
import { realBuildDiskProbe, DEFAULT_BUILD_DISK, freeBytes, checkDiskFit, formatBytes } from './chunk-UJTYMT7G.js';
|
|
24
25
|
import { buildxState, spawnRun, parseSize, RUNNER_LABEL, runnerLabelValue } from './chunk-CQQWIWYG.js';
|
|
25
26
|
import { resolveDevcontainerCli, locateRecipe, assertBuildable, readRecipe, RecipeError } from './chunk-NGT2CCGM.js';
|
|
26
|
-
import { FIRECRACKER_VERSION, builderDiskPinned, CLAUDE_CODE_VERSION } from './chunk-PZN4L2DN.js';
|
|
27
|
+
import { HOST_HELPER_ASSETS_VERSION, FIRECRACKER_VERSION, HOST_HELPER_SHA256, builderDiskPinned, CLAUDE_CODE_VERSION } from './chunk-PZN4L2DN.js';
|
|
27
28
|
import { getJson, WorkCommandError, signatureRefusalMessage } from './chunk-MTUV27NY.js';
|
|
28
29
|
import './chunk-IP7BIBXJ.js';
|
|
29
30
|
import './chunk-L5GF2A43.js';
|
|
@@ -58,6 +59,7 @@ import { MIN_SYSTEMD, claudeCredentialVariablesSet } from './chunk-GANAOCHR.js';
|
|
|
58
59
|
import './chunk-MESOOLF4.js';
|
|
59
60
|
import './chunk-Z5GEFMRW.js';
|
|
60
61
|
import { spawnSync } from 'child_process';
|
|
62
|
+
import { createHash } from 'crypto';
|
|
61
63
|
import { existsSync, readdirSync, statSync, readFileSync, realpathSync } from 'fs';
|
|
62
64
|
import { totalmem, tmpdir } from 'os';
|
|
63
65
|
import { join, dirname, basename } from 'path';
|
|
@@ -419,6 +421,14 @@ function helperCheck(facts) {
|
|
|
419
421
|
fix: `run \`chmod 700 ${facts.writableBuildsDir}\``
|
|
420
422
|
};
|
|
421
423
|
}
|
|
424
|
+
if (facts.present && facts.staleHelper !== void 0) {
|
|
425
|
+
return {
|
|
426
|
+
name,
|
|
427
|
+
status: "warn",
|
|
428
|
+
detail: `the root helper at ${facts.staleHelper} is not the one this release pins, release guest-${HOST_HELPER_ASSETS_VERSION} of outerlayerai/guest-assets: the runner updates itself but never its root helper, so the helper refuses what only a newer helper does, such as giving a builder's cache disk space back to the host`,
|
|
429
|
+
fix: REINSTALL
|
|
430
|
+
};
|
|
431
|
+
}
|
|
422
432
|
if (facts.present && facts.firecracker !== FIRECRACKER_VERSION) {
|
|
423
433
|
return { name, status: "warn", detail: helperFirecrackerNote(facts.firecracker), fix: REINSTALL };
|
|
424
434
|
}
|
|
@@ -879,15 +889,25 @@ function runnerImageCheck(env) {
|
|
|
879
889
|
if (advice === void 0) return { name, status: "pass", detail: `runs ${imageTag(version)}` };
|
|
880
890
|
return advice.reason === "refused" ? { name, status: "fail", detail: `the factory refuses this runner as too old, so it claims nothing (image ${version})`, fix: pullInstruction(advice.tag) } : { name, status: "warn", detail: `the factory names a newer version than the ${version} this image runs`, fix: pullInstruction(advice.tag) };
|
|
881
891
|
}
|
|
882
|
-
|
|
892
|
+
function fileSha256Of(path) {
|
|
893
|
+
try {
|
|
894
|
+
return createHash("sha256").update(readFileSync(path)).digest("hex");
|
|
895
|
+
} catch {
|
|
896
|
+
return void 0;
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
async function helperFactsOf(env, machine) {
|
|
883
900
|
const probe = await (env.helper ?? (() => probeHelper(env.service === void 0 ? void 0 : helperSocketPath(env.service.unit))))();
|
|
884
901
|
if (!probe.ok) return { present: false, reason: probe.reason, detail: probe.detail };
|
|
885
902
|
const builds = buildsDir(env.configPath);
|
|
886
903
|
const stat = statSync(builds, { throwIfNoEntry: false });
|
|
904
|
+
const program = env.service === void 0 || !microVmArchSupported(machine) ? void 0 : helperBinaryFor(env.service.unit);
|
|
905
|
+
const installed = program === void 0 ? void 0 : (env.fileSha256 ?? fileSha256Of)(program);
|
|
887
906
|
return {
|
|
888
907
|
present: true,
|
|
889
908
|
firecracker: probe.firecracker,
|
|
890
909
|
...stat !== void 0 && (stat.mode & 18) !== 0 ? { writableBuildsDir: builds } : {},
|
|
910
|
+
...installed !== void 0 && installed !== HOST_HELPER_SHA256[machine.arch] ? { staleHelper: program } : {},
|
|
891
911
|
...env.service?.fdStoreMax === void 0 ? {} : { fdStoreMax: env.service.fdStoreMax },
|
|
892
912
|
...env.service?.startedWithStore === false ? { restartUnit: env.service.unit } : {},
|
|
893
913
|
...env.service?.systemdVersion === void 0 ? {} : { systemdVersion: env.service.systemdVersion }
|
|
@@ -969,7 +989,7 @@ async function runnerHostChecks(env) {
|
|
|
969
989
|
...env.hooks !== void 0 && builtinKind(env.hooks.provision) === "vm" ? [
|
|
970
990
|
kvmCheck(machine(), env.service),
|
|
971
991
|
...env.service === void 0 ? [] : [delegationCheck(env.service)],
|
|
972
|
-
helperCheck(await helperFactsOf(env)),
|
|
992
|
+
helperCheck(await helperFactsOf(env, machine())),
|
|
973
993
|
nestedVirtualizationCheck(env),
|
|
974
994
|
vmscapeCheck(env),
|
|
975
995
|
diskSharingCheck({ ...env, buildsDir: buildsDir(env.configPath) }),
|
package/dist/index.js
CHANGED
|
@@ -26,5 +26,5 @@ if (argv[0] === "claude") {
|
|
|
26
26
|
process.exit(await runClaudeLauncher(argv.slice(1)));
|
|
27
27
|
}
|
|
28
28
|
(await import('./hook-fast-OPHM3MRK.js')).recordLinkExitFailure(argv);
|
|
29
|
-
var { runCli } = await import('./cli-
|
|
29
|
+
var { runCli } = await import('./cli-EFJXK3VB.js');
|
|
30
30
|
await runCli(process.argv);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { summarizeChecks, summaryText, renderDoctorText } from './chunk-
|
|
3
|
+
import { summarizeChecks, summaryText, renderDoctorText } from './chunk-UPGN7KCY.js';
|
|
4
4
|
import './chunk-Q7ZHL6FY.js';
|
|
5
5
|
import { shellFunctionInstalled, removeShellFunction, installShellFunction, SHELL_FUNCTION_LINE } from './chunk-CJJDJ7AT.js';
|
|
6
6
|
import './chunk-OHQMGLJP.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@outerlayer/cli",
|
|
3
|
-
"version": "0.34.1-next.
|
|
3
|
+
"version": "0.34.1-next.20261029194222",
|
|
4
4
|
"description": "OuterLayer CLI — commands: init, claude, connect, doctor, login, logout, sync, daemon (alias: watch), emit, demo, findings, work, spec, runner, hooks, mcp, context. Capture and sync coding-agent sessions, and record proof of factory work.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Magu Studios, Inc.",
|