@outerlayer/cli 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/README.md +9 -0
- package/dist/{agent-setup-IFH3FB5X.js → agent-setup-USZ2SAXC.js} +2 -2
- package/dist/build-info.json +1 -1
- package/dist/{check-4Q33B5ZE.js → check-CCVPBN7A.js} +24 -14
- package/dist/{chunk-WOBNRVQT.js → chunk-3DEVYTNQ.js} +1 -1
- package/dist/{chunk-F4NU4H3V.js → chunk-43J3M6KB.js} +95 -11
- package/dist/{chunk-W7UTFZDH.js → chunk-4NLKY4WR.js} +2 -2
- package/dist/{lima-XN65D7GN.js → chunk-77MM5RYD.js} +0 -1
- package/dist/{chunk-D2KWEAN6.js → chunk-7DBI6SNT.js} +1 -1
- package/dist/{chunk-ZXBITXTS.js → chunk-AIW6GLET.js} +1 -1
- package/dist/{chunk-EX6M5JPR.js → chunk-ANK2B36Y.js} +131 -15
- package/dist/{chunk-RMAZ2NWA.js → chunk-BNMCXPG7.js} +14 -2
- package/dist/{chunk-UFFXNXLQ.js → chunk-FA2BOX4O.js} +31 -29
- package/dist/chunk-FBTE2A2X.js +38 -0
- package/dist/{chunk-DVDEBNQJ.js → chunk-GQD22KKN.js} +17 -6
- package/dist/{chunk-BCJNHMZT.js → chunk-HHJDN6AU.js} +18 -3
- package/dist/{chunk-JLDZTG3A.js → chunk-IASWYRVG.js} +1 -1
- package/dist/{install-cmd-7WXOIFDO.js → chunk-JWOQNNN2.js} +0 -1
- package/dist/{chunk-H4CK2YK4.js → chunk-MIGEDH5P.js} +16 -8
- package/dist/{chunk-CHLVJNTE.js → chunk-MXB5VB4Y.js} +17 -5
- package/dist/chunk-NQXFAGHU.js +211 -0
- package/dist/chunk-OUUINEYB.js +27 -0
- package/dist/{chunk-OR6AEEDO.js → chunk-PMAMOSTP.js} +3 -3
- package/dist/{chunk-RTXKYLCA.js → chunk-RBOMWNOG.js} +1 -1
- package/dist/{chunk-T52PKE2Y.js → chunk-RZSF5B46.js} +149 -7
- package/dist/chunk-T6OIJQRT.js +31 -0
- package/dist/{chunk-EGABNHZG.js → chunk-UMFWVGJO.js} +148 -18
- package/dist/{chunk-UWH5DSUP.js → chunk-VMJ3MMBX.js} +203 -80
- package/dist/chunk-ZILGTTY6.js +75 -0
- package/dist/{cli-LHSUYYMI.js → cli-7WCNPBYC.js} +134 -61
- package/dist/command-ARFK3OYF.js +162 -0
- package/dist/{connect-cmd-OJBFHZWP.js → connect-cmd-PCESZLTR.js} +4 -4
- package/dist/{context-adopt-UMA4O5NY.js → context-adopt-G5JAELE7.js} +2 -2
- package/dist/{context-materialize-G2FUFC72.js → context-materialize-3HLPZAF6.js} +2 -2
- package/dist/{dist-WDV7U7UJ.js → dist-RDLP4GGJ.js} +1 -1
- package/dist/{doctor-MOA3RIEP.js → doctor-VOMYOHQU.js} +32 -12
- package/dist/{emit-artifact-cmd-FDWYKURA.js → emit-artifact-cmd-TBF46VXZ.js} +6 -7
- package/dist/{emit-criteria-cmd-OCXHLK34.js → emit-criteria-cmd-3427XKFW.js} +3 -3
- package/dist/{emit-finding-cmd-POW7PKIA.js → emit-finding-cmd-GSI75K36.js} +3 -3
- package/dist/{emit-result-cmd-ID35SH53.js → emit-result-cmd-3PRQKB55.js} +6 -7
- package/dist/{hook-fast-EYENPK6F.js → hook-fast-NJBBZQ5Q.js} +1 -1
- package/dist/index.js +3 -2
- package/dist/{init-2IPOIXJV.js → init-OHYFIKZD.js} +26 -55
- package/dist/{init-FYDJAKTM.js → init-WVR4BZQ4.js} +8 -8
- package/dist/{init-cmd-KLIDRVXQ.js → init-cmd-HMFNIFPI.js} +7 -7
- package/dist/inspect-XAUSB7L3.js +63 -0
- package/dist/install-DSUZE2TJ.js +13 -0
- package/dist/install-cmd-453C7IZT.js +8 -0
- package/dist/lima-7NPCNGWT.js +6 -0
- package/dist/{loop-NEBUGD2Q.js → loop-UAJB34KA.js} +24 -11
- package/dist/{machine-ECU3QCZD.js → machine-2JOWGRSZ.js} +7 -7
- package/dist/session-sender-ED26V45B.js +28 -0
- package/dist/{status-CLATHCTQ.js → status-6WNXX2O7.js} +22 -8
- package/dist/{sync-cmd-SWQ5KLPL.js → sync-cmd-YONVGUYS.js} +6 -7
- package/dist/{watch-3YW6Z3DQ.js → watch-HHKAF26L.js} +6 -7
- package/dist/{work-claim-cmd-3OPWA77E.js → work-claim-cmd-LXBZTMJA.js} +5 -5
- package/dist/{work-cmd-NUR4CAG6.js → work-cmd-OVNF44FY.js} +3 -3
- package/dist/{work-comment-cmd-6TTTYGHM.js → work-comment-cmd-6DGQNTAH.js} +3 -3
- package/dist/{work-launch-YI4CJDAP.js → work-launch-R5HTAP6X.js} +1 -1
- package/dist/{work-open-pr-cmd-KZ7QQFLD.js → work-open-pr-cmd-FCZHFHZS.js} +4 -4
- package/dist/{work-pr-cmd-QNUBE6IQ.js → work-pr-cmd-QJJVHZDC.js} +2 -2
- package/package.json +2 -1
- package/dist/chunk-ZOC7JSYC.js +0 -83
- package/dist/{chunk-XDDW4FRS.js → chunk-OIRNH6UO.js} +1 -1
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
import { runRunnerInstall } from './chunk-JWOQNNN2.js';
|
|
4
|
+
import { execStartCommand } from './chunk-YYYXRJUW.js';
|
|
5
|
+
import { readJobFile } from './chunk-T6OIJQRT.js';
|
|
6
|
+
import { installService, uninstallService, realTaskScheduler } from './chunk-NQXFAGHU.js';
|
|
7
|
+
import './chunk-FBTE2A2X.js';
|
|
8
|
+
import './chunk-OUUINEYB.js';
|
|
9
|
+
import { writeLaunchAgent, launchAgentPath } from './chunk-LF6MLJCY.js';
|
|
10
|
+
import { detectMachine } from './chunk-RBOMWNOG.js';
|
|
11
|
+
import './chunk-RZSF5B46.js';
|
|
12
|
+
import './chunk-Z62HNKEJ.js';
|
|
13
|
+
import './chunk-N5FOE5PS.js';
|
|
14
|
+
import './chunk-OGFGZQA3.js';
|
|
15
|
+
import './chunk-774HEQL6.js';
|
|
16
|
+
import './chunk-QOZKPLVJ.js';
|
|
17
|
+
import './chunk-W4SQCOZU.js';
|
|
18
|
+
import './chunk-B2G7JHHB.js';
|
|
19
|
+
import './chunk-BNMCXPG7.js';
|
|
20
|
+
import './chunk-BFESLKPP.js';
|
|
21
|
+
import './chunk-3DEVYTNQ.js';
|
|
22
|
+
import './chunk-ANK2B36Y.js';
|
|
23
|
+
import { runnerVmOf, loadRunnerConfig } from './chunk-3DD6AOWC.js';
|
|
24
|
+
import './chunk-F6GFZXZ3.js';
|
|
25
|
+
import './chunk-AUFG23AA.js';
|
|
26
|
+
import { realLima } from './chunk-77MM5RYD.js';
|
|
27
|
+
import './chunk-WZBHBH3J.js';
|
|
28
|
+
import './chunk-OIRNH6UO.js';
|
|
29
|
+
import './chunk-ZJSNLVCE.js';
|
|
30
|
+
import './chunk-WIOZAJ2W.js';
|
|
31
|
+
import './chunk-WO2BXCTQ.js';
|
|
32
|
+
import './chunk-EMY4I27X.js';
|
|
33
|
+
import './chunk-BCLJSQCV.js';
|
|
34
|
+
import './chunk-BOLTI6LR.js';
|
|
35
|
+
import './chunk-EABW6AJQ.js';
|
|
36
|
+
import './chunk-RA3O54FC.js';
|
|
37
|
+
import './chunk-M5POMKKW.js';
|
|
38
|
+
import './chunk-ZM2IMMYN.js';
|
|
39
|
+
import './chunk-XCCLFVXM.js';
|
|
40
|
+
import './chunk-BJ3KTMDH.js';
|
|
41
|
+
import './chunk-VNVZDWO3.js';
|
|
42
|
+
import './chunk-Z5GEFMRW.js';
|
|
43
|
+
import { userInfo, totalmem } from 'os';
|
|
44
|
+
import { rmSync, existsSync, readdirSync, readFileSync } from 'fs';
|
|
45
|
+
import { spawnSync } from 'child_process';
|
|
46
|
+
import { join } from 'path';
|
|
47
|
+
|
|
48
|
+
createRequire(import.meta.url);
|
|
49
|
+
async function serviceInVm(lima, instance, action, options) {
|
|
50
|
+
const limactl = lima.locate();
|
|
51
|
+
if (limactl === void 0) {
|
|
52
|
+
return { ok: false, lines: ["limactl is not installed, and the runner's service lives in the Linux VM it manages. Install Lima with `brew install lima`."] };
|
|
53
|
+
}
|
|
54
|
+
const ran = await lima.shell(instance, ["outerlayer", "runner", action, "--service", ...options.extraArgs ?? []]);
|
|
55
|
+
const lines = [...ran.stdout.split("\n"), ...ran.stderr.split("\n")].map((line) => line.trim()).filter((line) => line !== "");
|
|
56
|
+
if (ran.status !== 0) return { ok: false, lines: lines.length > 0 ? lines : [`outerlayer runner ${action} --service failed in the VM ${instance} with exit status ${ran.status}`] };
|
|
57
|
+
if (action === "install") {
|
|
58
|
+
const path = writeLaunchAgent(options.home, limactl, instance);
|
|
59
|
+
lines.push(`the VM ${instance} starts at login through ${path}`);
|
|
60
|
+
} else {
|
|
61
|
+
rmSync(launchAgentPath(options.home), { force: true });
|
|
62
|
+
lines.push("removed the launch agent that started the VM at login");
|
|
63
|
+
}
|
|
64
|
+
return { ok: true, lines };
|
|
65
|
+
}
|
|
66
|
+
var WSL_CONF = "/etc/wsl.conf";
|
|
67
|
+
function readText(path) {
|
|
68
|
+
try {
|
|
69
|
+
return readFileSync(path, "utf8");
|
|
70
|
+
} catch {
|
|
71
|
+
return void 0;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function sudoWrite(path, text) {
|
|
75
|
+
const result = spawnSync("sudo", ["tee", path], { input: text, stdio: ["pipe", "ignore", "inherit"] });
|
|
76
|
+
if (result.status !== 0) throw new Error(`sudo tee ${path} failed with exit status ${result.status}`);
|
|
77
|
+
}
|
|
78
|
+
function realSystemd() {
|
|
79
|
+
return {
|
|
80
|
+
running: () => existsSync("/run/systemd/system"),
|
|
81
|
+
read: readText,
|
|
82
|
+
write: sudoWrite,
|
|
83
|
+
remove: (path) => {
|
|
84
|
+
spawnSync("sudo", ["rm", "-f", path], { stdio: ["inherit", "ignore", "inherit"] });
|
|
85
|
+
},
|
|
86
|
+
systemctl: (args, options) => {
|
|
87
|
+
const result = options?.sudo === true ? spawnSync("sudo", ["systemctl", ...args], { encoding: "utf8", stdio: ["inherit", "pipe", "inherit"] }) : spawnSync("systemctl", args, { encoding: "utf8" });
|
|
88
|
+
return { status: result.status ?? -1, stdout: result.stdout ?? "" };
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function realWslConf() {
|
|
93
|
+
return { read: () => readText(WSL_CONF), write: (text) => sudoWrite(WSL_CONF, text) };
|
|
94
|
+
}
|
|
95
|
+
function buildsRunningIn(runnerDirPath) {
|
|
96
|
+
const jobs = join(runnerDirPath, "jobs");
|
|
97
|
+
if (!existsSync(jobs)) return false;
|
|
98
|
+
try {
|
|
99
|
+
return readdirSync(jobs, { withFileTypes: true }).some((entry) => {
|
|
100
|
+
if (!entry.isDirectory()) return false;
|
|
101
|
+
const job = readJobFile(join(jobs, entry.name, "job.json"));
|
|
102
|
+
return job === null || job.outcome === void 0 && job.endedAt === void 0;
|
|
103
|
+
});
|
|
104
|
+
} catch {
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
function realServiceDeps() {
|
|
109
|
+
const platform = detectMachine().platform;
|
|
110
|
+
return {
|
|
111
|
+
platform,
|
|
112
|
+
say: (line) => process.stdout.write(`running: ${line}
|
|
113
|
+
`),
|
|
114
|
+
systemd: realSystemd(),
|
|
115
|
+
...platform === "wsl2" ? { tasks: realTaskScheduler(), wslConf: realWslConf(), distro: process.env.WSL_DISTRO_NAME } : {},
|
|
116
|
+
usableMemoryBytes: totalmem(),
|
|
117
|
+
buildsRunning: buildsRunningIn
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// src/runner/service/command.ts
|
|
122
|
+
function vmArgs(input) {
|
|
123
|
+
return [...input.print === true ? ["--print"] : [], ...input.replace === true ? ["--replace"] : [], ...input.user === void 0 ? [] : ["--user", input.user], ...input.unitName === void 0 ? [] : ["--unit-name", input.unitName]];
|
|
124
|
+
}
|
|
125
|
+
async function installServiceCommand(input, deps = {}) {
|
|
126
|
+
const vm = runnerVmOf(input.configPath);
|
|
127
|
+
if (vm !== void 0) {
|
|
128
|
+
const result = await serviceInVm((deps.lima ?? realLima)(), vm.instance, "install", { home: input.home, extraArgs: vmArgs(input) });
|
|
129
|
+
return { ok: result.ok, state: "vm", lines: result.lines };
|
|
130
|
+
}
|
|
131
|
+
const config = loadRunnerConfig(input.configPath);
|
|
132
|
+
if (input.print !== true && input.layoutInstalled !== true) {
|
|
133
|
+
runRunnerInstall({ configPath: input.configPath, entryPath: input.entryPath, nodePath: input.nodePath });
|
|
134
|
+
}
|
|
135
|
+
const outcome = installService(
|
|
136
|
+
{
|
|
137
|
+
configPath: input.configPath,
|
|
138
|
+
hooks: config.hooks,
|
|
139
|
+
concurrency: config.concurrency,
|
|
140
|
+
buildMemory: config.build?.memory ?? "8g",
|
|
141
|
+
timeLimitMinutes: config.timeLimitMinutes,
|
|
142
|
+
execStart: execStartCommand(input.configPath, input.nodePath),
|
|
143
|
+
user: input.user ?? userInfo().username,
|
|
144
|
+
unitName: input.unitName,
|
|
145
|
+
print: input.print,
|
|
146
|
+
replace: input.replace
|
|
147
|
+
},
|
|
148
|
+
(deps.service ?? realServiceDeps)()
|
|
149
|
+
);
|
|
150
|
+
return { ok: outcome.ok, state: outcome.state, lines: outcome.lines, unit: outcome.unit };
|
|
151
|
+
}
|
|
152
|
+
async function uninstallServiceCommand(input, deps = {}) {
|
|
153
|
+
const vm = runnerVmOf(input.configPath);
|
|
154
|
+
if (vm !== void 0) {
|
|
155
|
+
const result = await serviceInVm((deps.lima ?? realLima)(), vm.instance, "uninstall", { home: input.home, extraArgs: input.unitName === void 0 ? [] : ["--unit-name", input.unitName] });
|
|
156
|
+
return { ok: result.ok, state: "vm", lines: result.lines };
|
|
157
|
+
}
|
|
158
|
+
const outcome = uninstallService({ configPath: input.configPath, unitName: input.unitName }, (deps.service ?? realServiceDeps)());
|
|
159
|
+
return { ok: outcome.ok, state: outcome.state, lines: outcome.lines };
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export { installServiceCommand, uninstallServiceCommand };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
export { promptOnTerminal, realConnectDeps, runConnect, runConnectCommand } from './chunk-
|
|
4
|
-
import './chunk-
|
|
5
|
-
import './chunk-
|
|
6
|
-
import './chunk-
|
|
3
|
+
export { promptOnTerminal, realConnectDeps, runConnect, runConnectCommand } from './chunk-PMAMOSTP.js';
|
|
4
|
+
import './chunk-7DBI6SNT.js';
|
|
5
|
+
import './chunk-3DEVYTNQ.js';
|
|
6
|
+
import './chunk-ANK2B36Y.js';
|
|
7
7
|
import './chunk-USO2DKBD.js';
|
|
8
8
|
import './chunk-N6LURUEF.js';
|
|
9
9
|
import './chunk-YRYMNBGQ.js';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { defaultGitRunner, hasSymlinkComponent } from './chunk-
|
|
3
|
+
import { defaultGitRunner, hasSymlinkComponent } from './chunk-OIRNH6UO.js';
|
|
4
|
+
import './chunk-ZJSNLVCE.js';
|
|
4
5
|
import { writeContextManifest, writePinIfChanged, touchLastCheck, clearDegraded, writeSourceCache, SOURCE_CACHE_TTL_SUCCESS_MS, writeBuildHold } from './chunk-WIOZAJ2W.js';
|
|
5
6
|
import './chunk-WO2BXCTQ.js';
|
|
6
7
|
import './chunk-EMY4I27X.js';
|
|
7
|
-
import './chunk-ZJSNLVCE.js';
|
|
8
8
|
import './chunk-BCLJSQCV.js';
|
|
9
9
|
import './chunk-BOLTI6LR.js';
|
|
10
10
|
import './chunk-EABW6AJQ.js';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
export { defaultGitRunner, hasSymlinkComponent, materializeContext, parseOwnerRepo, parseRemoteHost, resolveGitCommonDir } from './chunk-
|
|
3
|
+
export { defaultGitRunner, hasSymlinkComponent, materializeContext, parseOwnerRepo, parseRemoteHost, resolveGitCommonDir } from './chunk-OIRNH6UO.js';
|
|
4
|
+
import './chunk-ZJSNLVCE.js';
|
|
4
5
|
import './chunk-WIOZAJ2W.js';
|
|
5
6
|
import './chunk-WO2BXCTQ.js';
|
|
6
7
|
import './chunk-EMY4I27X.js';
|
|
7
|
-
import './chunk-ZJSNLVCE.js';
|
|
8
8
|
import './chunk-BCLJSQCV.js';
|
|
9
9
|
import './chunk-BOLTI6LR.js';
|
|
10
10
|
import './chunk-EABW6AJQ.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
export { CaptureDaemon, PRICE_TABLE_SOURCE, SECRET_PATTERNS, SOURCE_ADAPTERS, SUPPORTED_VERSIONS, StatuslineAggregator, WARNING_CODES, claudeCodeAdapter, codexAdapter, codexSessionIdFromPath, compareVersions, completePrefix, computeStatuslineState, costOfUsage, cursorAdapter, cursorChatIdFromPath, defaultCodexSessionsDir, defaultCursorChatsDir, defaultCursorProjectsDir, defaultProjectsDir, defaultRawDir, enrichSessionRepo, findCodexRollouts, findCursorChats, findTranscripts, isNewerThanSupported, isPriceKnown, normalizeErrorSignature, normalizeRemote, parseCodexRollout, parseCursorChat, parseTranscript, readStatuslineState, readSyncWatermarkMs, remoteLookupFailed, resolvePrice, resolveRepoIdentity, rootChildIds, scanAll, scrubDeep, scrubText, sessionIdFromPath, setCustomScrubbers, setLocalIdentity, setRepoRoot, statuslineStatePath, tailTranscript, workspacesByHash, writeStatuslineState } from './chunk-
|
|
3
|
+
export { CaptureDaemon, PRICE_TABLE_SOURCE, SECRET_PATTERNS, SOURCE_ADAPTERS, SUPPORTED_VERSIONS, StatuslineAggregator, WARNING_CODES, claudeCodeAdapter, codexAdapter, codexSessionIdFromPath, compareVersions, completePrefix, computeStatuslineState, costOfUsage, cursorAdapter, cursorChatIdFromPath, defaultCodexSessionsDir, defaultCursorChatsDir, defaultCursorProjectsDir, defaultProjectsDir, defaultRawDir, enrichSessionRepo, findCodexRollouts, findCursorChats, findTranscripts, isNewerThanSupported, isPriceKnown, normalizeErrorSignature, normalizeRemote, parseCodexRollout, parseCursorChat, parseTranscript, readStatuslineState, readSyncWatermarkMs, remoteLookupFailed, resolvePrice, resolveRepoIdentity, rootChildIds, scanAll, scrubDeep, scrubText, sessionIdFromPath, setCustomScrubbers, setLocalIdentity, setRepoRoot, statuslineStatePath, tailTranscript, workspacesByHash, writeStatuslineState } from './chunk-ANK2B36Y.js';
|
|
4
4
|
import './chunk-Z5GEFMRW.js';
|
|
5
5
|
|
|
6
6
|
createRequire(import.meta.url);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { needsClaudeCredential, claudeCredentialCheck, missingPermissionOf, missingPermissionFix } from './chunk-
|
|
3
|
+
import { needsClaudeCredential, claudeCredentialCheck, missingPermissionOf, missingPermissionFix } from './chunk-MXB5VB4Y.js';
|
|
4
4
|
import { freeBytes, formatBytes } from './chunk-YYYRBYWG.js';
|
|
5
5
|
import { RepoFilter } from './chunk-TBT347UY.js';
|
|
6
|
-
import './chunk-
|
|
7
|
-
import { detectMachine, supportsContainerBuilds, describeMachineDocker, reachDockerStep, supportsMicroVmBuilds, microVmArchSupported, microVmAssetsPinned } from './chunk-
|
|
8
|
-
import { MIN_ENGINE_MAJOR } from './chunk-
|
|
6
|
+
import './chunk-4NLKY4WR.js';
|
|
7
|
+
import { detectMachine, supportsContainerBuilds, describeMachineDocker, reachDockerStep, supportsMicroVmBuilds, microVmArchSupported, microVmAssetsPinned } from './chunk-RBOMWNOG.js';
|
|
8
|
+
import { MIN_ENGINE_MAJOR } from './chunk-RZSF5B46.js';
|
|
9
9
|
import { CLAUDE_CODE_VERSION } from './chunk-Z62HNKEJ.js';
|
|
10
10
|
import './chunk-N5FOE5PS.js';
|
|
11
11
|
import './chunk-OGFGZQA3.js';
|
|
@@ -13,19 +13,19 @@ import { resolveDevcontainerCli } from './chunk-774HEQL6.js';
|
|
|
13
13
|
import { locateRecipe, assertBuildable, readRecipe, RecipeError } from './chunk-QOZKPLVJ.js';
|
|
14
14
|
import './chunk-W4SQCOZU.js';
|
|
15
15
|
import './chunk-B2G7JHHB.js';
|
|
16
|
-
import { getJson, WorkCommandError, signatureRefusalMessage } from './chunk-
|
|
16
|
+
import { getJson, WorkCommandError, signatureRefusalMessage } from './chunk-BNMCXPG7.js';
|
|
17
17
|
import './chunk-BFESLKPP.js';
|
|
18
|
-
import './chunk-
|
|
19
|
-
import { compareVersions } from './chunk-
|
|
18
|
+
import './chunk-3DEVYTNQ.js';
|
|
19
|
+
import { compareVersions } from './chunk-ANK2B36Y.js';
|
|
20
20
|
import { builtinKind } from './chunk-3DD6AOWC.js';
|
|
21
21
|
import { parseSize } from './chunk-F6GFZXZ3.js';
|
|
22
22
|
import './chunk-AUFG23AA.js';
|
|
23
23
|
import './chunk-WZBHBH3J.js';
|
|
24
|
-
import { defaultGitRunner } from './chunk-
|
|
24
|
+
import { defaultGitRunner } from './chunk-OIRNH6UO.js';
|
|
25
|
+
import './chunk-ZJSNLVCE.js';
|
|
25
26
|
import './chunk-WIOZAJ2W.js';
|
|
26
27
|
import './chunk-WO2BXCTQ.js';
|
|
27
28
|
import './chunk-EMY4I27X.js';
|
|
28
|
-
import './chunk-ZJSNLVCE.js';
|
|
29
29
|
import { defaultFetch } from './chunk-BCLJSQCV.js';
|
|
30
30
|
import './chunk-BOLTI6LR.js';
|
|
31
31
|
import './chunk-EABW6AJQ.js';
|
|
@@ -46,8 +46,17 @@ createRequire(import.meta.url);
|
|
|
46
46
|
// src/runner/microvm/doctor.ts
|
|
47
47
|
var GIB = 1024 ** 3;
|
|
48
48
|
var gib = (bytes) => `${Number((bytes / GIB).toFixed(1))} GiB`;
|
|
49
|
-
function kvmCheck(machine) {
|
|
49
|
+
function kvmCheck(machine, service) {
|
|
50
50
|
const name = "KVM";
|
|
51
|
+
if (service?.hasKvmGroup !== void 0 && machine.kvm?.state !== "absent" && machine.kvm !== void 0) {
|
|
52
|
+
if (service.hasKvmGroup) return { name, status: "pass", detail: `the service ${service.unit} has the group that owns /dev/kvm, so each build runs in a microVM of its own` };
|
|
53
|
+
return {
|
|
54
|
+
name,
|
|
55
|
+
status: "fail",
|
|
56
|
+
detail: `the service ${service.unit} cannot open /dev/kvm: its main process is not in the kvm group, so every build fails at provision, even if this shell can open it`,
|
|
57
|
+
fix: `sudo usermod -aG ${machine.kvm.group ?? "kvm"} <the service's account>, then restart the service: sudo systemctl restart ${service.unit}. A service reads its groups only when it starts`
|
|
58
|
+
};
|
|
59
|
+
}
|
|
51
60
|
const kvm = machine.kvm;
|
|
52
61
|
if (kvm?.state === "usable") return { name, status: "pass", detail: "this user can open /dev/kvm, so each build runs in a microVM of its own" };
|
|
53
62
|
if (kvm?.state === "no-permission") {
|
|
@@ -88,6 +97,16 @@ function memoryCheck(input) {
|
|
|
88
97
|
fix: "lower runner.concurrency or runner.build.memory, or run the runner on a host with more memory"
|
|
89
98
|
};
|
|
90
99
|
}
|
|
100
|
+
function delegationCheck(service) {
|
|
101
|
+
const name = "MicroVM memory limit";
|
|
102
|
+
if (service.delegate !== false) return { name, status: "pass", detail: `the service ${service.unit} is delegated its cgroup, so each microVM build gets a memory limit of its own` };
|
|
103
|
+
return {
|
|
104
|
+
name,
|
|
105
|
+
status: "warn",
|
|
106
|
+
detail: `the service ${service.unit} does not set Delegate=yes, so microVM builds have no limit of their own: one build that uses too much memory can take the others with it`,
|
|
107
|
+
fix: "run `outerlayer runner install --service --replace` to write the unit this CLI generates, which sets Delegate=yes"
|
|
108
|
+
};
|
|
109
|
+
}
|
|
91
110
|
|
|
92
111
|
// src/runner/image/doctor.ts
|
|
93
112
|
var LATEST_URL = "https://registry.npmjs.org/@anthropic-ai/claude-code/latest";
|
|
@@ -419,11 +438,12 @@ async function runnerHostChecks(env) {
|
|
|
419
438
|
},
|
|
420
439
|
...env.hooks === void 0 ? [] : [isolationCheck(env.machine ?? detectMachine(), env.hooks)],
|
|
421
440
|
...env.hooks !== void 0 && builtinKind(env.hooks.provision) === "vm" ? [
|
|
422
|
-
kvmCheck(env.machine ?? detectMachine()),
|
|
441
|
+
kvmCheck(env.machine ?? detectMachine(), env.service),
|
|
442
|
+
...env.service === void 0 ? [] : [delegationCheck(env.service)],
|
|
423
443
|
...env.runner === void 0 ? [] : [memoryCheck({ concurrency: env.runner.concurrency, buildMemory: env.runner.buildMemory, hostMemory: env.hostMemory ?? totalmem() })]
|
|
424
444
|
] : [],
|
|
425
445
|
...env.runner?.minFreeDisk === void 0 ? [] : [freeDiskCheck(env.configPath, env.runner.minFreeDisk, env.freeBytes ?? freeBytes)],
|
|
426
|
-
...env.hooks !== void 0 && needsClaudeCredential(env.hooks) ? [claudeCredentialCheck(env.env ?? process.env, { shell: true })] : [],
|
|
446
|
+
...env.hooks !== void 0 && needsClaudeCredential(env.hooks) ? [claudeCredentialCheck(env.env ?? process.env, env.service === void 0 ? { shell: true } : { service: { unit: env.service.unit, variables: env.service.credentialVariables } })] : [],
|
|
427
447
|
...env.gateway === void 0 ? [] : [await hostKeyBindingCheck(env.configPath, env.gateway, env.fetchImpl ?? defaultFetch)],
|
|
428
448
|
...env.gateway === void 0 || env.hooks === void 0 || !["container", "vm"].includes(builtinKind(env.hooks.provision)) ? [] : [await controlPlaneAccessCheck({ ...env, gateway: env.gateway }, env.fetchImpl ?? defaultFetch)],
|
|
429
449
|
devcontainerRunnable() ? { name: "Devcontainer CLI", status: "pass", detail: "installed beside the outerlayer CLI" } : {
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { staleBuildRefusal, staleBuildWarning } from './chunk-
|
|
4
|
-
import {
|
|
5
|
-
import { launchRefusalForSession } from './chunk-BCJNHMZT.js';
|
|
3
|
+
import { staleBuildRefusal, staleBuildWarning, detectCi } from './chunk-UMFWVGJO.js';
|
|
4
|
+
import { launchRefusalForSession } from './chunk-HHJDN6AU.js';
|
|
6
5
|
import './chunk-TBT347UY.js';
|
|
7
6
|
import './chunk-F7CU5ABH.js';
|
|
8
7
|
import './chunk-BKO6JEZI.js';
|
|
9
8
|
import { detectActiveSession } from './chunk-BFESLKPP.js';
|
|
10
|
-
import { readEffectiveArtifactSpoolState, localArtifactIds, isArtifactTombstoned, artifactBlobsDir, appendArtifactRecord, artifactsSpoolPath, findPendingArtifactRecord, appendArtifactTombstone } from './chunk-
|
|
11
|
-
import { ARTIFACT_MAX_CAPTION_LENGTH, ArtifactCriterionIdSchema, ARTIFACT_MAX_FILENAME_LENGTH, mediaTypeForArtifactPath, inferArtifactKind, resolveRepoIdentity, ARTIFACT_MAX_REPLACES_TARGETS, parseTestSelector, parseJunit, bindTests } from './chunk-
|
|
9
|
+
import { readEffectiveArtifactSpoolState, localArtifactIds, isArtifactTombstoned, artifactBlobsDir, appendArtifactRecord, artifactsSpoolPath, findPendingArtifactRecord, appendArtifactTombstone } from './chunk-3DEVYTNQ.js';
|
|
10
|
+
import { ARTIFACT_MAX_CAPTION_LENGTH, ArtifactCriterionIdSchema, ARTIFACT_MAX_FILENAME_LENGTH, mediaTypeForArtifactPath, inferArtifactKind, resolveRepoIdentity, ARTIFACT_MAX_REPLACES_TARGETS, parseTestSelector, parseJunit, bindTests } from './chunk-ANK2B36Y.js';
|
|
12
11
|
import './chunk-YRYMNBGQ.js';
|
|
13
|
-
import './chunk-
|
|
12
|
+
import './chunk-GQD22KKN.js';
|
|
14
13
|
import { parseTrackerNumber, trackerNumberError } from './chunk-WZBHBH3J.js';
|
|
15
14
|
import './chunk-5QRP3MVS.js';
|
|
16
15
|
import './chunk-ZJSNLVCE.js';
|
|
@@ -19,7 +18,7 @@ import { resolveGatewayCredentials, unauthorizedMessage } from './chunk-BOLTI6LR
|
|
|
19
18
|
import './chunk-EABW6AJQ.js';
|
|
20
19
|
import './chunk-M5POMKKW.js';
|
|
21
20
|
import './chunk-ZM2IMMYN.js';
|
|
22
|
-
import './chunk-
|
|
21
|
+
import './chunk-FA2BOX4O.js';
|
|
23
22
|
import './chunk-XCCLFVXM.js';
|
|
24
23
|
import './chunk-BJ3KTMDH.js';
|
|
25
24
|
import { homeFromEnv } from './chunk-VNVZDWO3.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { launchRefusalForSession } from './chunk-
|
|
3
|
+
import { launchRefusalForSession } from './chunk-HHJDN6AU.js';
|
|
4
4
|
import { detectActiveSession } from './chunk-BFESLKPP.js';
|
|
5
|
-
import { resolveRepoIdentity, CriteriaListSchema } from './chunk-
|
|
6
|
-
import { launchedItemForSession } from './chunk-
|
|
5
|
+
import { resolveRepoIdentity, CriteriaListSchema } from './chunk-ANK2B36Y.js';
|
|
6
|
+
import { launchedItemForSession } from './chunk-GQD22KKN.js';
|
|
7
7
|
import { parseTrackerNumber, trackerNumberError } from './chunk-WZBHBH3J.js';
|
|
8
8
|
import { defaultFetch } from './chunk-BCLJSQCV.js';
|
|
9
9
|
import { resolveGatewayCredentials, unauthorizedMessage } from './chunk-BOLTI6LR.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { launchRefusalForSession } from './chunk-
|
|
3
|
+
import { launchRefusalForSession } from './chunk-HHJDN6AU.js';
|
|
4
4
|
import { detectActiveSession } from './chunk-BFESLKPP.js';
|
|
5
|
-
import { FindingBatchSchema, resolveRepoIdentity } from './chunk-
|
|
6
|
-
import { launchedItemForSession } from './chunk-
|
|
5
|
+
import { FindingBatchSchema, resolveRepoIdentity } from './chunk-ANK2B36Y.js';
|
|
6
|
+
import { launchedItemForSession } from './chunk-GQD22KKN.js';
|
|
7
7
|
import { parseTrackerNumber, trackerNumberError } from './chunk-WZBHBH3J.js';
|
|
8
8
|
import { readLatestProvenanceForSession } from './chunk-ZJSNLVCE.js';
|
|
9
9
|
import { defaultFetch } from './chunk-BCLJSQCV.js';
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import './chunk-
|
|
4
|
-
import {
|
|
5
|
-
import { launchRefusalForSession } from './chunk-BCJNHMZT.js';
|
|
3
|
+
import { detectCi } from './chunk-UMFWVGJO.js';
|
|
4
|
+
import { launchRefusalForSession } from './chunk-HHJDN6AU.js';
|
|
6
5
|
import './chunk-TBT347UY.js';
|
|
7
6
|
import './chunk-F7CU5ABH.js';
|
|
8
7
|
import './chunk-BKO6JEZI.js';
|
|
9
8
|
import { detectActiveSession } from './chunk-BFESLKPP.js';
|
|
10
|
-
import './chunk-
|
|
11
|
-
import { EmittedNameSchema, EMITTED_RESULT_MAX_LINK_LENGTH, EMITTED_RESULTS, EMITTED_RESULT_MAX_BODY_LENGTH, resolveRepoIdentity } from './chunk-
|
|
9
|
+
import './chunk-3DEVYTNQ.js';
|
|
10
|
+
import { EmittedNameSchema, EMITTED_RESULT_MAX_LINK_LENGTH, EMITTED_RESULTS, EMITTED_RESULT_MAX_BODY_LENGTH, resolveRepoIdentity } from './chunk-ANK2B36Y.js';
|
|
12
11
|
import './chunk-YRYMNBGQ.js';
|
|
13
|
-
import './chunk-
|
|
12
|
+
import './chunk-GQD22KKN.js';
|
|
14
13
|
import { parseTrackerNumber, trackerNumberError } from './chunk-WZBHBH3J.js';
|
|
15
14
|
import './chunk-5QRP3MVS.js';
|
|
16
15
|
import './chunk-ZJSNLVCE.js';
|
|
@@ -19,7 +18,7 @@ import { resolveGatewayCredentials, unauthorizedMessage } from './chunk-BOLTI6LR
|
|
|
19
18
|
import './chunk-EABW6AJQ.js';
|
|
20
19
|
import './chunk-M5POMKKW.js';
|
|
21
20
|
import './chunk-ZM2IMMYN.js';
|
|
22
|
-
import './chunk-
|
|
21
|
+
import './chunk-FA2BOX4O.js';
|
|
23
22
|
import './chunk-XCCLFVXM.js';
|
|
24
23
|
import './chunk-BJ3KTMDH.js';
|
|
25
24
|
import { homeFromEnv } from './chunk-VNVZDWO3.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
export { AUTO_SYNC_DEBOUNCE_MS, WORK_LEASE_RENEW_DEBOUNCE_MS, WORK_LINK_RETRIES, contextPossiblyGoverned, handleWorkLaunch, handleWorkSessionEnd, hookFiredMarkerPath, maybeAutoSync, maybeRenewWorkLease, runHookFast, spoolDir } from './chunk-
|
|
3
|
+
export { AUTO_SYNC_DEBOUNCE_MS, WORK_LEASE_RENEW_DEBOUNCE_MS, WORK_LINK_RETRIES, contextPossiblyGoverned, handleWorkLaunch, handleWorkSessionEnd, hookFiredMarkerPath, logHookError, maybeAutoSync, maybeRenewWorkLease, recordLinkExitFailure, runHookFast, spoolDir } from './chunk-FA2BOX4O.js';
|
|
4
4
|
import './chunk-XCCLFVXM.js';
|
|
5
5
|
import './chunk-BJ3KTMDH.js';
|
|
6
6
|
import './chunk-VNVZDWO3.js';
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ createRequire(import.meta.url);
|
|
|
6
6
|
// src/index.ts
|
|
7
7
|
var argv = process.argv.slice(2);
|
|
8
8
|
if (argv[0] === "hook") {
|
|
9
|
-
const { runHookFast } = await import('./hook-fast-
|
|
9
|
+
const { runHookFast } = await import('./hook-fast-NJBBZQ5Q.js');
|
|
10
10
|
await runHookFast(argv[1]);
|
|
11
11
|
process.exit(0);
|
|
12
12
|
}
|
|
@@ -21,5 +21,6 @@ if (argv[0] === "statusline") {
|
|
|
21
21
|
await runStatuslineFast(argv.slice(1));
|
|
22
22
|
process.exit(0);
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
(await import('./hook-fast-NJBBZQ5Q.js')).recordLinkExitFailure(argv);
|
|
25
|
+
var { runCli } = await import('./cli-7WCNPBYC.js');
|
|
25
26
|
await runCli(process.argv);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import {
|
|
3
|
+
import { VM_SERVICE_NAME } from './chunk-FBTE2A2X.js';
|
|
4
|
+
import { checkFit, RUNNER_RESERVE_BYTES } from './chunk-OUUINEYB.js';
|
|
4
5
|
import { writeLaunchAgent } from './chunk-LF6MLJCY.js';
|
|
5
|
-
import { readConfigObject, RunnerInitError
|
|
6
|
-
import './chunk-
|
|
7
|
-
import './chunk-
|
|
6
|
+
import { readConfigObject, RunnerInitError } from './chunk-4NLKY4WR.js';
|
|
7
|
+
import './chunk-RBOMWNOG.js';
|
|
8
|
+
import './chunk-RZSF5B46.js';
|
|
8
9
|
import './chunk-Z62HNKEJ.js';
|
|
9
10
|
import './chunk-N5FOE5PS.js';
|
|
10
11
|
import './chunk-OGFGZQA3.js';
|
|
@@ -12,19 +13,19 @@ import './chunk-774HEQL6.js';
|
|
|
12
13
|
import './chunk-QOZKPLVJ.js';
|
|
13
14
|
import './chunk-W4SQCOZU.js';
|
|
14
15
|
import './chunk-B2G7JHHB.js';
|
|
15
|
-
import './chunk-
|
|
16
|
+
import './chunk-BNMCXPG7.js';
|
|
16
17
|
import './chunk-BFESLKPP.js';
|
|
17
|
-
import './chunk-
|
|
18
|
-
import './chunk-
|
|
18
|
+
import './chunk-3DEVYTNQ.js';
|
|
19
|
+
import './chunk-ANK2B36Y.js';
|
|
19
20
|
import { resolveBuild } from './chunk-3DD6AOWC.js';
|
|
20
21
|
import { parseSize } from './chunk-F6GFZXZ3.js';
|
|
21
22
|
import './chunk-AUFG23AA.js';
|
|
22
23
|
import './chunk-WZBHBH3J.js';
|
|
23
|
-
import './chunk-
|
|
24
|
+
import './chunk-OIRNH6UO.js';
|
|
25
|
+
import './chunk-ZJSNLVCE.js';
|
|
24
26
|
import './chunk-WIOZAJ2W.js';
|
|
25
27
|
import './chunk-WO2BXCTQ.js';
|
|
26
28
|
import './chunk-EMY4I27X.js';
|
|
27
|
-
import './chunk-ZJSNLVCE.js';
|
|
28
29
|
import './chunk-BCLJSQCV.js';
|
|
29
30
|
import './chunk-BOLTI6LR.js';
|
|
30
31
|
import './chunk-EABW6AJQ.js';
|
|
@@ -39,43 +40,22 @@ import { readFileSync, writeFileSync, existsSync, rmSync } from 'fs';
|
|
|
39
40
|
|
|
40
41
|
createRequire(import.meta.url);
|
|
41
42
|
|
|
42
|
-
// src/runner/vm/service.ts
|
|
43
|
-
var VM_SERVICE_NAME = "outerlayer-runner";
|
|
44
|
-
var STOP_MARGIN_MINUTES = 10;
|
|
45
|
-
function runnerUnit(unit) {
|
|
46
|
-
const dir = `${unit.home}/.outerlayer`;
|
|
47
|
-
return `[Unit]
|
|
48
|
-
Description=OuterLayer runner
|
|
49
|
-
After=network-online.target docker.service
|
|
50
|
-
Wants=network-online.target
|
|
51
|
-
Requires=docker.service
|
|
52
|
-
|
|
53
|
-
[Service]
|
|
54
|
-
User=${unit.user}
|
|
55
|
-
ExecStart=${unit.execStart}
|
|
56
|
-
EnvironmentFile=-${dir}/runner.env
|
|
57
|
-
Restart=on-failure
|
|
58
|
-
RestartForceExitStatus=75
|
|
59
|
-
RestartSec=30
|
|
60
|
-
KillSignal=SIGTERM
|
|
61
|
-
KillMode=mixed
|
|
62
|
-
TimeoutStopSec=${unit.timeLimitMinutes + STOP_MARGIN_MINUTES}min
|
|
63
|
-
|
|
64
|
-
[Install]
|
|
65
|
-
WantedBy=multi-user.target
|
|
66
|
-
`;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
43
|
// src/runner/vm/sizing.ts
|
|
70
44
|
var GIB = 1024 ** 3;
|
|
71
45
|
var EXTRA_CPUS = 1;
|
|
72
|
-
var
|
|
46
|
+
var GUEST_MEMORY_SHARE = 0.95;
|
|
73
47
|
var EXTRA_DISK_GIB = 30;
|
|
74
48
|
var gib = (size) => parseSize(size) / GIB;
|
|
49
|
+
function guestUsableBytes(memoryGiB) {
|
|
50
|
+
return Math.floor(memoryGiB * GIB * GUEST_MEMORY_SHARE);
|
|
51
|
+
}
|
|
52
|
+
function wantedMemoryGiB(build, concurrency) {
|
|
53
|
+
return Math.ceil((gib(build.memory) * concurrency + RUNNER_RESERVE_BYTES / GIB) / GUEST_MEMORY_SHARE);
|
|
54
|
+
}
|
|
75
55
|
function sizeVm(build, concurrency, host) {
|
|
76
56
|
return {
|
|
77
57
|
cpus: Math.max(1, Math.min(Math.ceil(build.cpus * concurrency) + EXTRA_CPUS, host.cpus)),
|
|
78
|
-
memoryGiB: Math.max(1, Math.min(
|
|
58
|
+
memoryGiB: Math.max(1, Math.min(wantedMemoryGiB(build, concurrency), Math.floor(host.memoryBytes / GIB))),
|
|
79
59
|
diskGiB: Math.ceil(gib(build.disk) * concurrency) + EXTRA_DISK_GIB
|
|
80
60
|
};
|
|
81
61
|
}
|
|
@@ -85,15 +65,9 @@ var VM_INSTANCE = "outerlayer-runner";
|
|
|
85
65
|
var VmInitError = class extends Error {
|
|
86
66
|
};
|
|
87
67
|
var MIN_NODE_MAJOR = 22;
|
|
88
|
-
var DEFAULT_TIME_LIMIT_MINUTES = 480;
|
|
89
68
|
var TARBALL_IN_VM = "/tmp/outerlayer-cli.tgz";
|
|
90
69
|
var NODE_VERSION = /^v(\d+)\./;
|
|
91
70
|
var quote = (text) => `'${text.replace(/'/g, `'\\''`)}'`;
|
|
92
|
-
function commandsAreReal(block) {
|
|
93
|
-
const commands = block?.commands ?? {};
|
|
94
|
-
const given = [commands.implement, commands.amend].filter((command) => typeof command === "string");
|
|
95
|
-
return given.length > 0 && given.every((command) => !isPlaceholderCommand(command));
|
|
96
|
-
}
|
|
97
71
|
async function runVmInit(configPath, deps) {
|
|
98
72
|
const { lima } = deps;
|
|
99
73
|
const instance = deps.instance ?? VM_INSTANCE;
|
|
@@ -130,8 +104,11 @@ async function runVmInit(configPath, deps) {
|
|
|
130
104
|
}
|
|
131
105
|
const build = resolveBuild(configPath, carried.build);
|
|
132
106
|
const concurrency = typeof carried.concurrency === "number" ? carried.concurrency : 1;
|
|
133
|
-
const timeLimitMinutes = typeof carried.timeLimitMinutes === "number" ? carried.timeLimitMinutes : DEFAULT_TIME_LIMIT_MINUTES;
|
|
134
107
|
const size = sizeVm(build, concurrency, { cpus: deps.hostCpus, memoryBytes: deps.hostMemoryBytes });
|
|
108
|
+
const fit = checkFit({ concurrency, buildMemory: build.memory, usableBytes: guestUsableBytes(size.memoryGiB) });
|
|
109
|
+
if (!fit.fits) {
|
|
110
|
+
throw new RunnerInitError(`${configPath}: the VM this Mac can give the runner is ${size.memoryGiB} GiB, and ${fit.message}. Lower runner.concurrency or runner.build.memory, then run this again.`);
|
|
111
|
+
}
|
|
135
112
|
const leftBehind = `The VM ${instance} was left as it is; delete it with \`limactl delete --force ${instance}\` to start over.`;
|
|
136
113
|
const failed = (what, result) => new VmInitError(`${what} failed: ${result.stderr.trim() || result.stdout.trim() || `exit status ${result.status}`}. ${leftBehind}`);
|
|
137
114
|
const sh = async (argv, stdin) => {
|
|
@@ -172,13 +149,7 @@ async function runVmInit(configPath, deps) {
|
|
|
172
149
|
...block === void 0 ? {} : { runner: carried }
|
|
173
150
|
};
|
|
174
151
|
const innerOut = await sh(["sg", "docker", "-c", `${quote(outerlayer)} runner init --config-stdin --config ${quote(vmConfig)}`], JSON.stringify(handoff));
|
|
175
|
-
await sh(["sh", "-c", `${quote(outerlayer)} runner install --config ${quote(vmConfig)}`]);
|
|
176
|
-
const nodePath = (await sh(["sh", "-c", "command -v node"])).trim();
|
|
177
|
-
const execStart = execStartCommand(vmConfig, nodePath);
|
|
178
|
-
await sh(["sudo", "tee", `/etc/systemd/system/${VM_SERVICE_NAME}.service`], runnerUnit({ user, home, execStart, timeLimitMinutes }));
|
|
179
|
-
await sh(["sudo", "systemctl", "daemon-reload"]);
|
|
180
|
-
const enabled = commandsAreReal(block);
|
|
181
|
-
if (enabled) await sh(["sudo", "systemctl", "enable", "--now", VM_SERVICE_NAME]);
|
|
152
|
+
const installOut = await sh(["sh", "-c", `${quote(outerlayer)} runner install --service --config ${quote(vmConfig)}`]);
|
|
182
153
|
let agent;
|
|
183
154
|
let hadHostKey;
|
|
184
155
|
try {
|
|
@@ -193,7 +164,6 @@ async function runVmInit(configPath, deps) {
|
|
|
193
164
|
}
|
|
194
165
|
return {
|
|
195
166
|
instance,
|
|
196
|
-
enabled,
|
|
197
167
|
lines: [
|
|
198
168
|
`created the Linux VM ${instance}: ${size.cpus} CPUs, ${size.memoryGiB} GiB memory, ${size.diskGiB} GiB disk`,
|
|
199
169
|
...innerOut.split("\n").map((line) => line.trim()).filter((line) => line !== ""),
|
|
@@ -201,8 +171,9 @@ async function runVmInit(configPath, deps) {
|
|
|
201
171
|
`moved the runner key into the VM: apiKey and runner are gone from ${configPath}`,
|
|
202
172
|
...hadHostKey ? ["deleted this Mac's old host key. If the runner key was bound to it, a member uses Clear host key on the API keys page before the VM's first claim"] : [],
|
|
203
173
|
"run outerlayer login again to use capture on this Mac, with a key that is not the runner key",
|
|
204
|
-
|
|
205
|
-
|
|
174
|
+
...installOut.split("\n").map((line) => line.trim()).filter((line) => line !== ""),
|
|
175
|
+
`put CLAUDE_CODE_OAUTH_TOKEN in ${home}/.outerlayer/runner.env inside the VM, then restart the runner so it reads the file: limactl shell ${instance} sudo systemctl restart ${VM_SERVICE_NAME}`,
|
|
176
|
+
`the runner claims nothing while a command in the VM's config is still the placeholder or the credential is missing; its host entry says why. Check it with: limactl shell ${instance} outerlayer runner status`
|
|
206
177
|
]
|
|
207
178
|
};
|
|
208
179
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
export { PLACEHOLDER_MARKER, RunnerInitError, isPlaceholderCommand, readConfigObject, runRunnerInit } from './chunk-
|
|
4
|
-
import './chunk-
|
|
5
|
-
import './chunk-
|
|
3
|
+
export { PLACEHOLDER_MARKER, RunnerInitError, isPlaceholderCommand, readConfigObject, runRunnerInit } from './chunk-4NLKY4WR.js';
|
|
4
|
+
import './chunk-RBOMWNOG.js';
|
|
5
|
+
import './chunk-RZSF5B46.js';
|
|
6
6
|
import './chunk-Z62HNKEJ.js';
|
|
7
7
|
import './chunk-N5FOE5PS.js';
|
|
8
8
|
import './chunk-OGFGZQA3.js';
|
|
@@ -10,18 +10,18 @@ import './chunk-774HEQL6.js';
|
|
|
10
10
|
import './chunk-QOZKPLVJ.js';
|
|
11
11
|
import './chunk-W4SQCOZU.js';
|
|
12
12
|
import './chunk-B2G7JHHB.js';
|
|
13
|
-
import './chunk-
|
|
13
|
+
import './chunk-BNMCXPG7.js';
|
|
14
14
|
import './chunk-BFESLKPP.js';
|
|
15
|
-
import './chunk-
|
|
16
|
-
import './chunk-
|
|
15
|
+
import './chunk-3DEVYTNQ.js';
|
|
16
|
+
import './chunk-ANK2B36Y.js';
|
|
17
17
|
import './chunk-F6GFZXZ3.js';
|
|
18
18
|
import './chunk-AUFG23AA.js';
|
|
19
19
|
import './chunk-WZBHBH3J.js';
|
|
20
|
-
import './chunk-
|
|
20
|
+
import './chunk-OIRNH6UO.js';
|
|
21
|
+
import './chunk-ZJSNLVCE.js';
|
|
21
22
|
import './chunk-WIOZAJ2W.js';
|
|
22
23
|
import './chunk-WO2BXCTQ.js';
|
|
23
24
|
import './chunk-EMY4I27X.js';
|
|
24
|
-
import './chunk-ZJSNLVCE.js';
|
|
25
25
|
import './chunk-BCLJSQCV.js';
|
|
26
26
|
import './chunk-BOLTI6LR.js';
|
|
27
27
|
import './chunk-EABW6AJQ.js';
|