@outerlayer/cli 0.34.1-next.20261029191024 → 0.34.1-next.20261029194956

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist/build-info.json +1 -1
  2. package/dist/{check-A6QEWYRN.js → check-ET6SHA6E.js} +6 -6
  3. package/dist/{chunk-A6QFXRUU.js → chunk-73IJ5PMZ.js} +6 -6
  4. package/dist/{chunk-HJSNFVKX.js → chunk-AL2LHM4B.js} +3 -3
  5. package/dist/{chunk-E3R62JBJ.js → chunk-DGMOTHFM.js} +1 -1
  6. package/dist/chunk-HKTYIHLZ.js +287 -0
  7. package/dist/{chunk-I4TEZU2E.js → chunk-HQTZGH4P.js} +1 -1
  8. package/dist/{chunk-F7CYWR7J.js → chunk-N7NDTX22.js} +1 -1
  9. package/dist/{chunk-Y5CPIOBF.js → chunk-R4DVA45E.js} +7 -1
  10. package/dist/{chunk-VE3UM4HU.js → chunk-UY5XJIJC.js} +1 -1
  11. package/dist/{chunk-2WXFXI36.js → chunk-ZLNNIRMH.js} +1 -1
  12. package/dist/{cli-NWOZT6B5.js → cli-BIUIERG2.js} +21 -21
  13. package/dist/{command-WQG2Y6MV.js → command-N2SBQGYR.js} +3 -276
  14. package/dist/{container-start-MMTUO3JR.js → container-start-S7DEKQFO.js} +4 -4
  15. package/dist/{doctor-N5R5YUEC.js → doctor-KJT3VOXC.js} +25 -5
  16. package/dist/{host-checks-5YDTGG6B.js → host-checks-LIZKBSGH.js} +2 -2
  17. package/dist/index.js +1 -1
  18. package/dist/{init-M6GSCMJM.js → init-O6PJ5VFU.js} +1 -1
  19. package/dist/{init-7ZFHIK5W.js → init-XHZRN7M6.js} +1 -1
  20. package/dist/{init-cmd-RBRSD4US.js → init-cmd-LDYOMR2V.js} +1 -1
  21. package/dist/{loop-72U5FJPH.js → loop-C3B2UQHJ.js} +6 -6
  22. package/dist/{machine-FQNIDAC5.js → machine-L5EBOAQK.js} +1 -1
  23. package/dist/{runner-key-HU542TOA.js → runner-key-ECXF2WPY.js} +1 -1
  24. package/dist/{status-YOGCWUOD.js → status-WBSVJDBI.js} +2 -2
  25. package/dist/{update-steps-VI2KVXG6.js → update-steps-QP4NXMZA.js} +3 -3
  26. package/dist/{work-proofs-cmd-BSNVSO7A.js → work-proofs-cmd-3IQSWSNT.js} +1 -1
  27. package/dist/{work-proofs-record-LV5UTB3H.js → work-proofs-record-LE4M664P.js} +1 -1
  28. package/package.json +1 -1
@@ -1 +1 @@
1
- {"id":"2026-10-29T19:14:45.640Z+46d915f","root":"/home/runner/work/outerlayer/outerlayer","pkg":"outerlayer"}
1
+ {"id":"2026-10-29T19:56:13.837Z+d978329","root":"/home/runner/work/outerlayer/outerlayer","pkg":"outerlayer"}
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { probeCredentials } from './chunk-A6QFXRUU.js';
3
+ import { probeCredentials } from './chunk-73IJ5PMZ.js';
4
4
  import './chunk-ZI7JENTB.js';
5
5
  import './chunk-3JVYMD4G.js';
6
6
  import './chunk-E7R2GIAW.js';
7
- import './chunk-E3R62JBJ.js';
8
- import './chunk-I4TEZU2E.js';
9
- import './chunk-F7CYWR7J.js';
7
+ import './chunk-DGMOTHFM.js';
8
+ import './chunk-HQTZGH4P.js';
9
+ import './chunk-N7NDTX22.js';
10
10
  import './chunk-YC5KTX7D.js';
11
11
  import './chunk-FJ7KTNMD.js';
12
12
  import './chunk-LW2A24IA.js';
@@ -19,12 +19,12 @@ import './chunk-HXCUMPPY.js';
19
19
  import './chunk-RO2XIOEN.js';
20
20
  import './chunk-EBFU4YCI.js';
21
21
  import './chunk-AAGU5FJF.js';
22
- import { fleetConfigProblem, managedProblems, managedFactsOf, askFleetMachine } from './chunk-2WXFXI36.js';
22
+ import { fleetConfigProblem, managedProblems, managedFactsOf, askFleetMachine } from './chunk-ZLNNIRMH.js';
23
23
  import './chunk-7R655ODT.js';
24
24
  import './chunk-TBT347UY.js';
25
25
  import { findServiceUnit } from './chunk-HTJR62XR.js';
26
26
  import './chunk-Q7ZHL6FY.js';
27
- import { placeholderQueues, placeholderProblem, permissionModeProblems, permissionModeProblem, HELPER_ENV, helperSocketPath, probeHelper, needsClaudeCredential, claudeCredentialCheck, claimPermissionProblem, formerSkillQueues, formerSkillProblem } from './chunk-Y5CPIOBF.js';
27
+ import { placeholderQueues, placeholderProblem, permissionModeProblems, permissionModeProblem, HELPER_ENV, helperSocketPath, probeHelper, needsClaudeCredential, claudeCredentialCheck, claimPermissionProblem, formerSkillQueues, formerSkillProblem } from './chunk-R4DVA45E.js';
28
28
  import './chunk-2PGI6RDE.js';
29
29
  import './chunk-5ESKQSQP.js';
30
30
  import './chunk-F26I6GKL.js';
@@ -3,17 +3,17 @@ import { createRequire } from 'node:module';
3
3
  import { readHousekeepingRecord, writeHousekeepingRecord } from './chunk-ZI7JENTB.js';
4
4
  import { decideInstalledSwitch } from './chunk-3JVYMD4G.js';
5
5
  import { fetchVersionMeta, npmVersion, npmSupportsProvenance, fetchTarballDigest, fetchProvenance, installVersion, auditSignatures } from './chunk-E7R2GIAW.js';
6
- import { reportFailedStart, fitImageBuildMemory } from './chunk-E3R62JBJ.js';
7
- import { renderUpdateSteps } from './chunk-I4TEZU2E.js';
8
- import { releaseLease, isUnfinished, setStage, jobEnv, runHook, describeHookEnd, provisionMicroVm, deliverCommitHooks, provisionProcess, readProvisionOut, workdirProblem, MICROVM_COMMAND_DIR, commandLogOffset, startMicroVmCommand, microVmCommandLine, runCommand, startSender, finishJob, sampleGuest, foldSample, isContainerTracked, isMicroVmTracked, probeMicroVmCommand, probeCommand, appendCommandLog, judgeProbe, EXIT_CODE_FILE, isTracked, isGroupAlive, outcomeFromExitCode, isTimedOut, readCpuUsec, isIdle, stopOrphanedMicroVms, unfinishedJobs, listUnreadableJobs, listAdoptableJobs, retryFailedReleases, recoverLostJobs, GUEST_USAGE_INTERVAL_MS, hookLimitsFor, AttemptLogBook, microVmOomKills, needsRenew, renewLease, RENEW_INTERVAL_SECONDS, listTrackedJobs, restartSender, serveLease, vmAlive, writeGuestGhConfig, ALREADY_RELEASED, inTeardown } from './chunk-F7CYWR7J.js';
6
+ import { reportFailedStart, fitImageBuildMemory } from './chunk-DGMOTHFM.js';
7
+ import { renderUpdateSteps } from './chunk-HQTZGH4P.js';
8
+ import { releaseLease, isUnfinished, setStage, jobEnv, runHook, describeHookEnd, provisionMicroVm, deliverCommitHooks, provisionProcess, readProvisionOut, workdirProblem, MICROVM_COMMAND_DIR, commandLogOffset, startMicroVmCommand, microVmCommandLine, runCommand, startSender, finishJob, sampleGuest, foldSample, isContainerTracked, isMicroVmTracked, probeMicroVmCommand, probeCommand, appendCommandLog, judgeProbe, EXIT_CODE_FILE, isTracked, isGroupAlive, outcomeFromExitCode, isTimedOut, readCpuUsec, isIdle, stopOrphanedMicroVms, unfinishedJobs, listUnreadableJobs, listAdoptableJobs, retryFailedReleases, recoverLostJobs, GUEST_USAGE_INTERVAL_MS, hookLimitsFor, AttemptLogBook, microVmOomKills, needsRenew, renewLease, RENEW_INTERVAL_SECONDS, listTrackedJobs, restartSender, serveLease, vmAlive, writeGuestGhConfig, ALREADY_RELEASED, inTeardown } from './chunk-N7NDTX22.js';
9
9
  import { RUNNER_PROTOCOL } from './chunk-FJ7KTNMD.js';
10
10
  import { writeFleetState } from './chunk-LW2A24IA.js';
11
11
  import { writePendingUpdate } from './chunk-SHPCVBT3.js';
12
12
  import { JOB_STATE_FORMAT, readsJobState, jobStateFormatOf } from './chunk-ZVB57WI6.js';
13
- import { fleetConfigProblem, realBlockedProbes, sliceMemoryOf, checkBlockedWithSlots, largeBuildMemoryBytes, LARGE_BUILD_DISK_BYTES, checkManagedRoom, createHousekeepingDocker, housekeepingDockerIfReachable, KIND_LABEL, RECIPE_KEY_LABEL, askFleetMachine } from './chunk-2WXFXI36.js';
13
+ import { fleetConfigProblem, realBlockedProbes, sliceMemoryOf, checkBlockedWithSlots, largeBuildMemoryBytes, LARGE_BUILD_DISK_BYTES, checkManagedRoom, createHousekeepingDocker, housekeepingDockerIfReachable, KIND_LABEL, RECIPE_KEY_LABEL, askFleetMachine } from './chunk-ZLNNIRMH.js';
14
14
  import { writeMarker, readMarker, currentVersion, removeMarker, isInLayout, startedThroughCurrent, entryIn, versionDir, switchCurrent, cleanVersions, stagingDir } from './chunk-7R655ODT.js';
15
15
  import { RepoFilter } from './chunk-TBT347UY.js';
16
- import { leaseTimeLeftMs, createContainerRuntime, withTunnelLog, LEASE_SECONDS, itemTag, itemScope, attemptNote, fetchManagedClaudeKey, holdManagedClaudeKey, fetchManagedBuildSettings, holdManagedBuildSettings, needsBuildSkill, provisionContainer, leaseExpiresAtMs, deliverContainerHooks, provisionEnvironment, resolveHostBuild, listenOnBroker, hostEnvironment, deliverExecMaven, runWithSpawn, hostCommandEnvironment, lifecycleSteps, execArgv, lifecycleFailureReason, decideHostBuildSkill, prepareBranch, currentSkillCommand, formerSkillProblem, containerCommandExec, execCommandLine, startHostServices, HELPER_ENV, setUpRunnerCgroup, sweepImageBuilders, usableCpus, stoppedHelperReason, measureDisk, parseCpuList, ensureTunnel, keepGhConfigCurrent, filesAreCopied, savedStatesDir, readRecords, removeOldestUntil, ensureNetworkReady, managedBuildSettingsFor, ADOPTED_FETCH_RETRY_WINDOW_MS, gitRemoteFor, startServicesFor, createLeaseChannel, selectStaleIncomplete, selectExpired, selectToFit, removeSavedState } from './chunk-Y5CPIOBF.js';
16
+ import { leaseTimeLeftMs, createContainerRuntime, withTunnelLog, LEASE_SECONDS, itemTag, itemScope, attemptNote, fetchManagedClaudeKey, holdManagedClaudeKey, fetchManagedBuildSettings, holdManagedBuildSettings, needsBuildSkill, provisionContainer, leaseExpiresAtMs, deliverContainerHooks, provisionEnvironment, resolveHostBuild, listenOnBroker, hostEnvironment, deliverExecMaven, runWithSpawn, hostCommandEnvironment, lifecycleSteps, execArgv, lifecycleFailureReason, decideHostBuildSkill, prepareBranch, currentSkillCommand, formerSkillProblem, containerCommandExec, execCommandLine, startHostServices, HELPER_ENV, setUpRunnerCgroup, sweepImageBuilders, usableCpus, stoppedHelperReason, measureDisk, parseCpuList, ensureTunnel, keepGhConfigCurrent, filesAreCopied, savedStatesDir, readRecords, removeOldestUntil, ensureNetworkReady, managedBuildSettingsFor, ADOPTED_FETCH_RETRY_WINDOW_MS, gitRemoteFor, startServicesFor, createLeaseChannel, selectStaleIncomplete, selectExpired, selectToFit, removeSavedState } from './chunk-R4DVA45E.js';
17
17
  import { claimPidFile, releasePidFile, writePidFile, readPidFile } from './chunk-AUVJMR3P.js';
18
18
  import { startTimeOf, isSameProcess } from './chunk-JBJTC3UU.js';
19
19
  import { describeCallFailure, retrySend, shortClaim, relativeToRunner, formatDuration, resolveGoverningSource, BuildTokens, classifyRefusal, refusalCode, createRunnerLog, formatClock } from './chunk-QRDF5A3U.js';
@@ -3679,7 +3679,7 @@ async function startRunner(configPath, deps, startup) {
3679
3679
  check: update.check ? () => update.check(configPath) : async () => {
3680
3680
  const held = heldClaudeCredential();
3681
3681
  const env = held === void 0 ? process.env : { ...process.env, [held.variable]: held.value };
3682
- return (await import('./check-A6QEWYRN.js')).runRunnerCheck(configPath, { fetchImpl: deps.fetchImpl, env });
3682
+ return (await import('./check-ET6SHA6E.js')).runRunnerCheck(configPath, { fetchImpl: deps.fetchImpl, env });
3683
3683
  },
3684
3684
  now: () => (deps.now ?? (() => /* @__PURE__ */ new Date()))().getTime(),
3685
3685
  log
@@ -217,14 +217,14 @@ function governingDir(cwd) {
217
217
  async function testProofMode(cwd) {
218
218
  const dir = governingDir(cwd);
219
219
  if (dir === void 0) return "any";
220
- const { testProofIn } = await import('./host-checks-5YDTGG6B.js');
220
+ const { testProofIn } = await import('./host-checks-LIZKBSGH.js');
221
221
  return testProofIn(dir);
222
222
  }
223
223
  async function judgeCheckName(cwd) {
224
224
  const dir = governingDir(cwd);
225
225
  if (dir === void 0) return {};
226
226
  if (!existsSync(dir)) return { note: `the governed context at ${dir} is not readable` };
227
- const { checksIn, isJudgeCheck } = await import('./host-checks-5YDTGG6B.js');
227
+ const { checksIn, isJudgeCheck } = await import('./host-checks-LIZKBSGH.js');
228
228
  const quiet = { line: () => void 0, error: () => void 0 };
229
229
  const check = checksIn(dir, quiet, "").checks.find((c) => isJudgeCheck(c) && c.judge.subjects === "criteria");
230
230
  return check === void 0 ? {} : { name: check.name };
@@ -369,7 +369,7 @@ async function runWorkProofs(opts) {
369
369
  async function runWorkProofsCommand(opts) {
370
370
  try {
371
371
  if (opts.record) {
372
- const { runWorkProofsRecord } = await import('./work-proofs-record-LV5UTB3H.js');
372
+ const { runWorkProofsRecord } = await import('./work-proofs-record-LE4M664P.js');
373
373
  const result2 = await runWorkProofsRecord(opts);
374
374
  process.exitCode = result2.exitCode;
375
375
  return;
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { scrubReason, stripTerminalControls } from './chunk-F7CYWR7J.js';
3
+ import { scrubReason, stripTerminalControls } from './chunk-N7NDTX22.js';
4
4
  import { RunnerAlreadyRunningError, readPidFile } from './chunk-AUVJMR3P.js';
5
5
  import { isSameProcess } from './chunk-JBJTC3UU.js';
6
6
  import { checkFit, RUNNER_RESERVE_BYTES } from './chunk-BMMSKKVA.js';
@@ -0,0 +1,287 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire } from 'node:module';
3
+ import { helperSocketPath } from './chunk-R4DVA45E.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 };
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { stripTerminalControls } from './chunk-F7CYWR7J.js';
3
+ import { stripTerminalControls } from './chunk-N7NDTX22.js';
4
4
  import { tagToPull, imageTag, pullInstruction, readUpdateStatus, runnerImageVersion } from './chunk-SQGD4LYW.js';
5
5
  import { readFileSync } from 'fs';
6
6
 
@@ -8,7 +8,7 @@ import { zodProblem } from './chunk-I3LTIAOR.js';
8
8
  import { senderPidfile } from './chunk-HXCUMPPY.js';
9
9
  import { installScrubContext } from './chunk-RO2XIOEN.js';
10
10
  import { upgradedStarterText } from './chunk-Q7ZHL6FY.js';
11
- import { ADDED_USER, shellQuote, GH_CONFIG_YML, ghHostsYml, firstLine, provisionWithFreshFallback, itemTag, hasClaudeCredential, AssetError, obtainImage, taggedLog, planSavedState, clockOf, savedStateBase, savedStatesDir, ensureRootfs, makeBuildsDirPrivate, gitRemoteFor, startServicesFor, createLeaseChannel, createBuildDisk, machineConfig, startJailedInto, resolveAgentUser, AgentUserError, agentUidOf, userIdChangedReason, runBuildSteps, setupInputFor, runtimeStepInput, settleFailedSteps, keepRuntimeStep, keepMissingSetupScripts, createContainerRuntime, containerSenderCommand, hostCommandEnvironment, execArgv, signalInContainer, startHostServices, LEASE_SECONDS, itemScope, managedBuildSettingsFor, stopContainer, cleanupContainer, recordProofsInContainer, PROOFS_LOG, outOfMemoryReason, closeHostBuild, dropManagedClaudeKey, dropManagedBuildSettings, startCheckContainer, ranRuntimeStep, provisionRuntimes, lifecycleSteps, lifecycleFailureReason, runSetupScripts, writeEvalInput, DeliveryFailure, EVAL_INPUT_NAME, syncInContainer, copyTranscriptsFromContainer, senderAliveScript, discardUnusableState, MANAGED_UNJAILED_REASON, uidFromProbe, saveAndPrune, managedMachineLimits, withFactoryHosts, helperFirecrackerNote, said, managedClaudeKeyValuesFor, managedBuildSettingValuesFor, managedClaudeKeyValues, managedBuildSettingValues, stopJailed, deleteBuildDisk, RECORD_PROOFS_ARGV, managedClaudeKeyFor, ROOT_DISK_ID_PREFIX, copyTranscripts, writeRecord, containerJudgeEnvironment, deleteRecord, senderSignalScript, copyJudgeTree } from './chunk-Y5CPIOBF.js';
11
+ import { ADDED_USER, shellQuote, GH_CONFIG_YML, ghHostsYml, firstLine, provisionWithFreshFallback, itemTag, hasClaudeCredential, AssetError, obtainImage, taggedLog, planSavedState, clockOf, savedStateBase, savedStatesDir, ensureRootfs, makeBuildsDirPrivate, gitRemoteFor, startServicesFor, createLeaseChannel, createBuildDisk, machineConfig, startJailedInto, resolveAgentUser, AgentUserError, agentUidOf, userIdChangedReason, runBuildSteps, setupInputFor, runtimeStepInput, settleFailedSteps, keepRuntimeStep, keepMissingSetupScripts, createContainerRuntime, containerSenderCommand, hostCommandEnvironment, execArgv, signalInContainer, startHostServices, LEASE_SECONDS, itemScope, managedBuildSettingsFor, stopContainer, cleanupContainer, recordProofsInContainer, PROOFS_LOG, outOfMemoryReason, closeHostBuild, dropManagedClaudeKey, dropManagedBuildSettings, startCheckContainer, ranRuntimeStep, provisionRuntimes, lifecycleSteps, lifecycleFailureReason, runSetupScripts, writeEvalInput, DeliveryFailure, EVAL_INPUT_NAME, syncInContainer, copyTranscriptsFromContainer, senderAliveScript, discardUnusableState, MANAGED_UNJAILED_REASON, uidFromProbe, saveAndPrune, managedMachineLimits, withFactoryHosts, helperFirecrackerNote, said, managedClaudeKeyValuesFor, managedBuildSettingValuesFor, managedClaudeKeyValues, managedBuildSettingValues, stopJailed, deleteBuildDisk, RECORD_PROOFS_ARGV, managedClaudeKeyFor, ROOT_DISK_ID_PREFIX, copyTranscripts, writeRecord, containerJudgeEnvironment, deleteRecord, senderSignalScript, copyJudgeTree } from './chunk-R4DVA45E.js';
12
12
  import { fetchCommit, readBranchHead, diffBetween } from './chunk-5ESKQSQP.js';
13
13
  import { isSameProcess, startTimeOf } from './chunk-JBJTC3UU.js';
14
14
  import { waitForAgent, vmExecArgs } from './chunk-4PH4DVV4.js';
@@ -425,9 +425,15 @@ function fillRootDisk() {
425
425
  return [
426
426
  'used_kb=$(du -sk "$rootfs" | cut -f1)',
427
427
  'files=$(find "$rootfs" | wc -l)',
428
+ "inodes=$(( files + files / 4 + 4096 ))",
429
+ // Bytes per inode, at most the 64 MiB mke2fs accepts.
430
+ "ratio=$(( used_kb * 1024 / inodes ))",
431
+ '[ "$ratio" -le 67108864 ] || ratio=67108864',
428
432
  "total_kb=$(( used_kb * 2 + 262144 ))",
429
433
  'truncate -s "${total_kb}K" "/out/$OUT_NAME"',
430
- 'mke2fs -q -F -t ext4 -m 0 -N $(( files + files / 4 + 4096 )) -d "$rootfs" "/out/$OUT_NAME"'
434
+ // mke2fs takes at least 1 KiB per inode. Files that hold less data than that each, such as empty files, get a count.
435
+ 'if [ "$ratio" -ge 1024 ]; then inode_option="-i $ratio"; else inode_option="-N $inodes"; fi',
436
+ 'mke2fs -q -F -t ext4 -m 0 $inode_option -d "$rootfs" "/out/$OUT_NAME"'
431
437
  ];
432
438
  }
433
439
  function shrinkRootDisk() {
@@ -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-N5R5YUEC.js');
1227
+ const { runnerHostChecks } = await import('./doctor-KJT3VOXC.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 { placeholderQueues, placeholderProblem } from './chunk-Y5CPIOBF.js';
3
+ import { placeholderQueues, placeholderProblem } from './chunk-R4DVA45E.js';
4
4
  import { checkFit, RUNNER_RESERVE_BYTES } from './chunk-BMMSKKVA.js';
5
5
  import { isBuiltinVm, builtinKind, EGRESS_SWITCHABLE_KEYS, imageBuildOf, keepsHostBuilder } from './chunk-QJCXP4TA.js';
6
6
  import { realBuildDiskProbe, checkDiskFit, DEFAULT_CACHE_DISK, DEFAULT_BUILD_DISK, volumeBytes } from './chunk-UJTYMT7G.js';
@@ -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-VE3UM4HU.js';
3
+ import { gatherDoctorChecks, doctorExitCode, summarizeChecks, renderDoctorText, recordWrapped, recordUnwrapped, recordRemoval, readManifest, recordInstall, recordStatusline } from './chunk-UY5XJIJC.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-RBRSD4US.js')).applyShellFunctionFlag(opts.shellFunction, { home: homeFromEnv(), shellPath: process.env.SHELL }) : void 0;
3929
+ const shell = !opts.remove && opts.shellFunction !== void 0 ? (await import('./init-cmd-LDYOMR2V.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-RBRSD4US.js');
3935
+ const { runInitCommand } = await import('./init-cmd-LDYOMR2V.js');
3936
3936
  const code = await runInitCommand(
3937
3937
  { json: opts.json, factory: opts.factory, shellFunction: opts.shellFunction },
3938
3938
  {
@@ -5008,7 +5008,7 @@ differs from HEAD.
5008
5008
  fail(trackerNumberError("--pr", opts.pr));
5009
5009
  return;
5010
5010
  }
5011
- const { runWorkProofsCommand } = await import('./work-proofs-cmd-BSNVSO7A.js');
5011
+ const { runWorkProofsCommand } = await import('./work-proofs-cmd-3IQSWSNT.js');
5012
5012
  await runWorkProofsCommand({ ...opts, ...pr === void 0 ? {} : { pr } });
5013
5013
  });
5014
5014
  workCmd.command("list").description("List live work items for this factory").option("--stage <spec|build|review>", "filter by stage").option("--section <attention|waiting|flowing>", "filter by Queue section").option("--repo <owner/name>", "repository (default: the current checkout's remote)").option("--unclaimed", "only items with no live lease").option("--claimed", "only items with a live lease, held by a host or a local session").option("--startable", "only items a host can start: a build request, no open PR, no live lease").option("--needs <amend>", "only items with a thread waiting on an agent").option("--json", "machine-readable JSON output").option("--url <url>", "cloud base URL (or OUTERLAYER_URL / config)").addOption(apiKeyOption()).option("--app-id <id>", "factory id the key is bound to (or OUTERLAYER_APP_ID / config)").action(async (opts) => {
@@ -5155,7 +5155,7 @@ function registerRunnerCommands(program2) {
5155
5155
  const configOption = "the cloud config file to run against (default: ~/.outerlayer/config.json)";
5156
5156
  runnerCmd.command("start").description("Run the loop: claim work, run it, report, clean up, repeat").option("--config <path>", configOption).action(async (opts) => {
5157
5157
  const { defaultRunnerConfigPath, RunnerConfigError } = await import('./config-FVSPGZIO.js');
5158
- const { start, RunnerStartError } = await import('./loop-72U5FJPH.js');
5158
+ const { start, RunnerStartError } = await import('./loop-C3B2UQHJ.js');
5159
5159
  const { RunnerAlreadyRunningError } = await import('./pidfile-KQ2EJABZ.js');
5160
5160
  const configPath = opts.config ?? defaultRunnerConfigPath();
5161
5161
  try {
@@ -5174,8 +5174,8 @@ function registerRunnerCommands(program2) {
5174
5174
  "\nReads OUTERLAYER_URL, OUTERLAYER_APP_ID, OUTERLAYER_API_KEY, OUTERLAYER_RUNNER_NAME and one Claude credential\n(CLAUDE_CODE_OAUTH_TOKEN or ANTHROPIC_API_KEY) from the environment. OUTERLAYER_AGENT\nis optional and defaults to claude. On a later start it refuses variables that disagree with the config in the volume.\nThe image sets OUTERLAYER_RUNNER_IMAGE; outside the image, use `runner start`.\n"
5175
5175
  ).action(async () => {
5176
5176
  const { defaultRunnerConfigPath, RunnerConfigError } = await import('./config-FVSPGZIO.js');
5177
- const { containerStart } = await import('./container-start-MMTUO3JR.js');
5178
- const { start, RunnerStartError } = await import('./loop-72U5FJPH.js');
5177
+ const { containerStart } = await import('./container-start-S7DEKQFO.js');
5178
+ const { start, RunnerStartError } = await import('./loop-C3B2UQHJ.js');
5179
5179
  const { RunnerAlreadyRunningError } = await import('./pidfile-KQ2EJABZ.js');
5180
5180
  try {
5181
5181
  const result = await containerStart({
@@ -5199,14 +5199,14 @@ function registerRunnerCommands(program2) {
5199
5199
  ).action(async (opts) => {
5200
5200
  const { defaultRunnerConfigPath } = await import('./config-FVSPGZIO.js');
5201
5201
  const { runnerDir } = await import('./paths-7PC3K7C3.js');
5202
- const { runUpdateSteps } = await import('./update-steps-VI2KVXG6.js');
5202
+ const { runUpdateSteps } = await import('./update-steps-QP4NXMZA.js');
5203
5203
  const text = await runUpdateSteps({ runnerDirPath: runnerDir(opts.config ?? defaultRunnerConfigPath()) });
5204
5204
  process.stdout.write(`${text}
5205
5205
  `);
5206
5206
  });
5207
5207
  runnerCmd.command("check").description("Validate the config, the hooks and the key, and print the effective settings").option("--config <path>", configOption).action(async (opts) => {
5208
5208
  const { defaultRunnerConfigPath } = await import('./config-FVSPGZIO.js');
5209
- const { runRunnerCheck } = await import('./check-A6QEWYRN.js');
5209
+ const { runRunnerCheck } = await import('./check-ET6SHA6E.js');
5210
5210
  const configPath = opts.config ?? defaultRunnerConfigPath();
5211
5211
  const result = await runRunnerCheck(configPath);
5212
5212
  if (!result.ok) {
@@ -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-WQG2Y6MV.js')).cpusAreValid(buildCpusMax)) {
5243
+ if (buildCpusMax !== void 0 && !(await import('./command-N2SBQGYR.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-WQG2Y6MV.js');
5249
+ const { installServiceCommand } = await import('./command-N2SBQGYR.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-WQG2Y6MV.js');
5307
+ const { uninstallServiceCommand } = await import('./command-N2SBQGYR.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
  `);
@@ -5332,10 +5332,10 @@ already in claude.env is used.
5332
5332
  `
5333
5333
  ).action(async (opts) => {
5334
5334
  const { defaultRunnerConfigPath, RunnerConfigError } = await import('./config-FVSPGZIO.js');
5335
- const { prepareRunnerInit, runRunnerInit, RunnerInitError, writeRunnerInit } = await import('./init-M6GSCMJM.js');
5336
- const { obtainRunnerKey, runnerKeyLogin } = await import('./runner-key-HU542TOA.js');
5337
- const { detectMachine } = await import('./machine-FQNIDAC5.js');
5338
- const { chooseVm, runVmInit, VmInitError } = await import('./init-7ZFHIK5W.js');
5335
+ const { prepareRunnerInit, runRunnerInit, RunnerInitError, writeRunnerInit } = await import('./init-O6PJ5VFU.js');
5336
+ const { obtainRunnerKey, runnerKeyLogin } = await import('./runner-key-ECXF2WPY.js');
5337
+ const { detectMachine } = await import('./machine-L5EBOAQK.js');
5338
+ const { chooseVm, runVmInit, VmInitError } = await import('./init-XHZRN7M6.js');
5339
5339
  const { AGENT_COMMANDS, credentialFromStdin, isAgentName, restartForCredential, RunnerEnvError } = await import('./runner-env-HUZ2TMAK.js');
5340
5340
  const configPath = opts.config ?? defaultRunnerConfigPath();
5341
5341
  if (opts.agent !== void 0 && !isAgentName(opts.agent)) {
@@ -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-WQG2Y6MV.js');
5489
+ const { installServiceCommand } = await import('./command-N2SBQGYR.js');
5490
5490
  const service = await installServiceCommand({
5491
5491
  configPath,
5492
5492
  entryPath: process.argv[1] ?? "",
@@ -5616,7 +5616,7 @@ Next:
5616
5616
  });
5617
5617
  runnerCmd.command("stop").description("Take no more work; finish running jobs, then exit").option("--config <path>", "the cloud config file naming the runner to stop").option("--now", "end running jobs immediately, with outcome stopped").action(async (opts) => {
5618
5618
  const { defaultRunnerConfigPath } = await import('./config-FVSPGZIO.js');
5619
- const { requestStop } = await import('./loop-72U5FJPH.js');
5619
+ const { requestStop } = await import('./loop-C3B2UQHJ.js');
5620
5620
  const configPath = opts.config ?? defaultRunnerConfigPath();
5621
5621
  const { runnerImageVersion } = await import('./image-tag-JWATDMIZ.js');
5622
5622
  await requestStop(configPath, Boolean(opts.now), void 0, { image: runnerImageVersion() !== void 0 });
@@ -5624,8 +5624,8 @@ Next:
5624
5624
  runnerCmd.command("status").description("List running jobs; with --recent, finished ones too").option("--config <path>", "the cloud config file naming the runner to inspect").option("--recent", "also list finished jobs, newest first, capped at 20").option("--json", "machine-readable JSON output").action(async (opts) => {
5625
5625
  const { defaultRunnerConfigPath, loadRunnerConfig } = await import('./config-FVSPGZIO.js');
5626
5626
  const { jobsDir, runnerDir } = await import('./paths-7PC3K7C3.js');
5627
- const { listJobFiles, runnerProcessState } = await import('./loop-72U5FJPH.js');
5628
- const { renderStatus } = await import('./status-YOGCWUOD.js');
5627
+ const { listJobFiles, runnerProcessState } = await import('./loop-C3B2UQHJ.js');
5628
+ const { renderStatus } = await import('./status-WBSVJDBI.js');
5629
5629
  const { readHousekeepingRecord } = await import('./record-IHEF6C33.js');
5630
5630
  const path2 = await import('path');
5631
5631
  const configPath = opts.config ?? defaultRunnerConfigPath();
@@ -5691,7 +5691,7 @@ Next:
5691
5691
  });
5692
5692
  runnerCmd.command("logs").argument("<item>", "the work item's number in the factory, or a build's claim id").description("Print the newest attempt's log for one item or claim id").option("--config <path>", "the cloud config file naming the runner to inspect").option("-f, --follow", "keep printing as the log grows").action(async (itemArg, opts) => {
5693
5693
  const { defaultRunnerConfigPath } = await import('./config-FVSPGZIO.js');
5694
- const { listJobFiles } = await import('./loop-72U5FJPH.js');
5694
+ const { listJobFiles } = await import('./loop-C3B2UQHJ.js');
5695
5695
  const { describeAmbiguous, logPathFor, selectAttempt, tail, RunnerLogsError } = await import('./logs-3YRC7HRA.js');
5696
5696
  const configPath = opts.config ?? defaultRunnerConfigPath();
5697
5697
  const jobs = listJobFiles(configPath);
@@ -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-HKTYIHLZ.js';
4
5
  import './chunk-VNHBDHX7.js';
5
6
  import { currentLink, execStartCommand } from './chunk-7R655ODT.js';
6
- import { detectMachine, helperSocketPath, ensureFirecrackerAndJailer } from './chunk-Y5CPIOBF.js';
7
+ import { detectMachine, ensureFirecrackerAndJailer } from './chunk-R4DVA45E.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, UNIT_MARKER } from './chunk-BMMSKKVA.js';
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,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { reportFailedStart, BUILD_MEMORY_VARIABLE } from './chunk-E3R62JBJ.js';
4
- import { readOwnContainer } from './chunk-I4TEZU2E.js';
5
- import './chunk-F7CYWR7J.js';
3
+ import { reportFailedStart, BUILD_MEMORY_VARIABLE } from './chunk-DGMOTHFM.js';
4
+ import { readOwnContainer } from './chunk-HQTZGH4P.js';
5
+ import './chunk-N7NDTX22.js';
6
6
  import './chunk-YC5KTX7D.js';
7
7
  import './chunk-ZVB57WI6.js';
8
8
  import './chunk-H2GESWLW.js';
@@ -14,7 +14,7 @@ import './chunk-EBFU4YCI.js';
14
14
  import './chunk-AAGU5FJF.js';
15
15
  import './chunk-TBT347UY.js';
16
16
  import './chunk-Q7ZHL6FY.js';
17
- import { detectMachine, supportsContainerBuilds, MIN_ENGINE_MAJOR, describeMachineDocker, RunnerInitError, prepareRunnerInit, writeRunnerInit } from './chunk-Y5CPIOBF.js';
17
+ import { detectMachine, supportsContainerBuilds, MIN_ENGINE_MAJOR, describeMachineDocker, RunnerInitError, prepareRunnerInit, writeRunnerInit } from './chunk-R4DVA45E.js';
18
18
  import './chunk-2PGI6RDE.js';
19
19
  import './chunk-5ESKQSQP.js';
20
20
  import './chunk-F26I6GKL.js';
@@ -1,10 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { KIND_LABEL, managedProblems, fleetConfigProblem, askFleetMachine } from './chunk-2WXFXI36.js';
3
+ import { KIND_LABEL, managedProblems, fleetConfigProblem, askFleetMachine } from './chunk-ZLNNIRMH.js';
4
+ import { helperBinaryFor } from './chunk-HKTYIHLZ.js';
4
5
  import { launcherCheck } from './chunk-VNHBDHX7.js';
5
6
  import './chunk-7R655ODT.js';
6
7
  import { RepoFilter } from './chunk-TBT347UY.js';
7
- import { needsClaudeCredential, claudeCredentialCheck, detectMachine, supportsContainerBuilds, describeMachineDocker, MIN_ENGINE_MAJOR, reachDockerStep, supportsMicroVmBuilds, microVmArchSupported, microVmAssetsPinned, helperFirecrackerNote, probeHelper, helperSocketPath, firstLine, missingPermissionOf, missingPermissionFix } from './chunk-Y5CPIOBF.js';
8
+ import { needsClaudeCredential, claudeCredentialCheck, detectMachine, supportsContainerBuilds, describeMachineDocker, MIN_ENGINE_MAJOR, reachDockerStep, supportsMicroVmBuilds, microVmArchSupported, microVmAssetsPinned, helperFirecrackerNote, probeHelper, helperSocketPath, firstLine, missingPermissionOf, missingPermissionFix } from './chunk-R4DVA45E.js';
8
9
  import './chunk-2PGI6RDE.js';
9
10
  import './chunk-5ESKQSQP.js';
10
11
  import './chunk-F26I6GKL.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
- async function helperFactsOf(env) {
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) }),
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- export { MAX_CHECK_ITEMS_BYTES, checksIn, commandItems, isJudgeCheck, makeRecorder, readDefinitions, runHostChecks, testProofIn, timeoutAfter } from './chunk-F7CYWR7J.js';
3
+ export { MAX_CHECK_ITEMS_BYTES, checksIn, commandItems, isJudgeCheck, makeRecorder, readDefinitions, runHostChecks, testProofIn, timeoutAfter } from './chunk-N7NDTX22.js';
4
4
  import './chunk-YC5KTX7D.js';
5
5
  import './chunk-ZVB57WI6.js';
6
6
  import './chunk-H2GESWLW.js';
@@ -12,7 +12,7 @@ import './chunk-EBFU4YCI.js';
12
12
  import './chunk-AAGU5FJF.js';
13
13
  import './chunk-TBT347UY.js';
14
14
  import './chunk-Q7ZHL6FY.js';
15
- import './chunk-Y5CPIOBF.js';
15
+ import './chunk-R4DVA45E.js';
16
16
  import './chunk-2PGI6RDE.js';
17
17
  import './chunk-5ESKQSQP.js';
18
18
  import './chunk-F26I6GKL.js';
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-NWOZT6B5.js');
29
+ var { runCli } = await import('./cli-BIUIERG2.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
- export { PLACEHOLDER_MARKER, RunnerInitError, isPlaceholderCommand, prepareRunnerInit, readConfigObject, runRunnerInit, writeRunnerInit } from './chunk-Y5CPIOBF.js';
3
+ export { PLACEHOLDER_MARKER, RunnerInitError, isPlaceholderCommand, prepareRunnerInit, readConfigObject, runRunnerInit, writeRunnerInit } from './chunk-R4DVA45E.js';
4
4
  import './chunk-2PGI6RDE.js';
5
5
  import './chunk-5ESKQSQP.js';
6
6
  import './chunk-F26I6GKL.js';
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
3
  import { npmSupportsProvenance } from './chunk-E7R2GIAW.js';
4
- import { RunnerInitError, readConfigObject } from './chunk-Y5CPIOBF.js';
4
+ import { RunnerInitError, readConfigObject } from './chunk-R4DVA45E.js';
5
5
  import './chunk-2PGI6RDE.js';
6
6
  import './chunk-5ESKQSQP.js';
7
7
  import './chunk-F26I6GKL.js';
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { summarizeChecks, summaryText, renderDoctorText } from './chunk-VE3UM4HU.js';
3
+ import { summarizeChecks, summaryText, renderDoctorText } from './chunk-UY5XJIJC.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';
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- export { RunnerStartError, fleetKeepalive, leaseTimeLeftFor, listJobFiles, logUnusableHelper, probeBuild, probeCredentials, requestStop, runnerProcessState, runtimeOf, sampleUsage, start, tick, watchTick } from './chunk-A6QFXRUU.js';
3
+ export { RunnerStartError, fleetKeepalive, leaseTimeLeftFor, listJobFiles, logUnusableHelper, probeBuild, probeCredentials, requestStop, runnerProcessState, runtimeOf, sampleUsage, start, tick, watchTick } from './chunk-73IJ5PMZ.js';
4
4
  import './chunk-ZI7JENTB.js';
5
5
  import './chunk-3JVYMD4G.js';
6
6
  import './chunk-E7R2GIAW.js';
7
- import './chunk-E3R62JBJ.js';
8
- import './chunk-I4TEZU2E.js';
9
- import './chunk-F7CYWR7J.js';
7
+ import './chunk-DGMOTHFM.js';
8
+ import './chunk-HQTZGH4P.js';
9
+ import './chunk-N7NDTX22.js';
10
10
  import './chunk-YC5KTX7D.js';
11
11
  import './chunk-FJ7KTNMD.js';
12
12
  import './chunk-LW2A24IA.js';
@@ -19,11 +19,11 @@ import './chunk-HXCUMPPY.js';
19
19
  import './chunk-RO2XIOEN.js';
20
20
  import './chunk-EBFU4YCI.js';
21
21
  import './chunk-AAGU5FJF.js';
22
- import './chunk-2WXFXI36.js';
22
+ import './chunk-ZLNNIRMH.js';
23
23
  import './chunk-7R655ODT.js';
24
24
  import './chunk-TBT347UY.js';
25
25
  import './chunk-Q7ZHL6FY.js';
26
- import './chunk-Y5CPIOBF.js';
26
+ import './chunk-R4DVA45E.js';
27
27
  import './chunk-2PGI6RDE.js';
28
28
  import './chunk-5ESKQSQP.js';
29
29
  import './chunk-F26I6GKL.js';
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- export { describeMachineDocker, detectMachine, microVmArchSupported, microVmAssetsPinned, reachDockerStep, supportsContainerBuilds, supportsMicroVmBuilds } from './chunk-Y5CPIOBF.js';
3
+ export { describeMachineDocker, detectMachine, microVmArchSupported, microVmAssetsPinned, reachDockerStep, supportsContainerBuilds, supportsMicroVmBuilds } from './chunk-R4DVA45E.js';
4
4
  import './chunk-2PGI6RDE.js';
5
5
  import './chunk-5ESKQSQP.js';
6
6
  import './chunk-F26I6GKL.js';
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { readConfigObject, RunnerInitError } from './chunk-Y5CPIOBF.js';
3
+ import { readConfigObject, RunnerInitError } from './chunk-R4DVA45E.js';
4
4
  import './chunk-2PGI6RDE.js';
5
5
  import './chunk-5ESKQSQP.js';
6
6
  import './chunk-F26I6GKL.js';
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { isReadable, ALREADY_RELEASED, RENEW_INTERVAL_SECONDS } from './chunk-F7CYWR7J.js';
3
+ import { isReadable, ALREADY_RELEASED, RENEW_INTERVAL_SECONDS } from './chunk-N7NDTX22.js';
4
4
  import './chunk-YC5KTX7D.js';
5
5
  import { jobStateFormatOf } from './chunk-ZVB57WI6.js';
6
6
  import './chunk-H2GESWLW.js';
@@ -12,7 +12,7 @@ import './chunk-EBFU4YCI.js';
12
12
  import './chunk-AAGU5FJF.js';
13
13
  import './chunk-TBT347UY.js';
14
14
  import './chunk-Q7ZHL6FY.js';
15
- import { LEASE_SECONDS } from './chunk-Y5CPIOBF.js';
15
+ import { LEASE_SECONDS } from './chunk-R4DVA45E.js';
16
16
  import './chunk-2PGI6RDE.js';
17
17
  import './chunk-5ESKQSQP.js';
18
18
  import './chunk-F26I6GKL.js';
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- export { readOwnContainer, renderUpdateSteps, runUpdateSteps } from './chunk-I4TEZU2E.js';
4
- import './chunk-F7CYWR7J.js';
3
+ export { readOwnContainer, renderUpdateSteps, runUpdateSteps } from './chunk-HQTZGH4P.js';
4
+ import './chunk-N7NDTX22.js';
5
5
  import './chunk-YC5KTX7D.js';
6
6
  import './chunk-ZVB57WI6.js';
7
7
  import './chunk-H2GESWLW.js';
@@ -13,7 +13,7 @@ import './chunk-EBFU4YCI.js';
13
13
  import './chunk-AAGU5FJF.js';
14
14
  import './chunk-TBT347UY.js';
15
15
  import './chunk-Q7ZHL6FY.js';
16
- import './chunk-Y5CPIOBF.js';
16
+ import './chunk-R4DVA45E.js';
17
17
  import './chunk-2PGI6RDE.js';
18
18
  import './chunk-5ESKQSQP.js';
19
19
  import './chunk-F26I6GKL.js';
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- export { classifyProofs, classifyProofsAt, otherPullRequestHeads, resolveProofsItem, runWorkProofs, runWorkProofsCommand } from './chunk-HJSNFVKX.js';
3
+ export { classifyProofs, classifyProofsAt, otherPullRequestHeads, resolveProofsItem, runWorkProofs, runWorkProofsCommand } from './chunk-AL2LHM4B.js';
4
4
  import './chunk-YC5KTX7D.js';
5
5
  import './chunk-MTUV27NY.js';
6
6
  import './chunk-IP7BIBXJ.js';
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { resolveProofsItem, ownPullRequest, otherPullRequestHeads, classifyProofsAt, runWorkProofs, proofsCommentId, kindProblem, proofsCommentBody } from './chunk-HJSNFVKX.js';
3
+ import { resolveProofsItem, ownPullRequest, otherPullRequestHeads, classifyProofsAt, runWorkProofs, proofsCommentId, kindProblem, proofsCommentBody } from './chunk-AL2LHM4B.js';
4
4
  import { runnerMatcher } from './chunk-YC5KTX7D.js';
5
5
  import { runWorkComment } from './chunk-HJS267VR.js';
6
6
  import { runEmitDemo } from './chunk-23DAYPF5.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@outerlayer/cli",
3
- "version": "0.34.1-next.20261029191024",
3
+ "version": "0.34.1-next.20261029194956",
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.",