@outerlayer/cli 0.36.0-next.20261031112440 → 0.36.0-next.20261031161320
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{build-KM6UILOZ.js → build-XZGB4JPQ.js} +5 -5
- package/dist/{build-disk-GCEB5EJC.js → build-disk-YLQT3UHL.js} +4 -4
- package/dist/build-info.json +1 -1
- package/dist/{builder-NRPJGNXU.js → builder-TS3QFXN4.js} +3 -3
- package/dist/{caller-XHNAY4E2.js → caller-VHISEQAD.js} +6 -6
- package/dist/{check-MENIW2MN.js → check-ARDGJYVM.js} +17 -17
- package/dist/{chunk-OPF6OJAT.js → chunk-27DQ3DDF.js} +3 -3
- package/dist/{chunk-4PH4DVV4.js → chunk-46OBCATR.js} +4 -0
- package/dist/{chunk-MMDGO77D.js → chunk-4NMAJYYE.js} +1 -1
- package/dist/{chunk-FRDYAKH3.js → chunk-4RSTPRMH.js} +2 -2
- package/dist/{chunk-PJZKKFQO.js → chunk-6O33JZ3X.js} +2 -2
- package/dist/{chunk-K2YG2HZN.js → chunk-7SDVHXP7.js} +10 -10
- package/dist/{chunk-TV5ITSVY.js → chunk-CIUD3436.js} +1 -1
- package/dist/{chunk-3QLHEGXK.js → chunk-H3S5LJI2.js} +3 -3
- package/dist/{chunk-AVJWMOEY.js → chunk-IGHAPIKZ.js} +1 -1
- package/dist/{chunk-MVSC7GCE.js → chunk-IP7F4CQH.js} +2 -2
- package/dist/{chunk-25GQP6NR.js → chunk-JVQYYVDS.js} +282 -108
- package/dist/{chunk-H3MLZ4EA.js → chunk-KB5B6ZT5.js} +1 -1
- package/dist/{chunk-3YRJUX6J.js → chunk-LXYWSGEW.js} +1 -1
- package/dist/{chunk-VJYNMGCE.js → chunk-MR5MAX77.js} +2 -2
- package/dist/{chunk-34YFGWHR.js → chunk-NRTRPGCW.js} +1 -1
- package/dist/{chunk-7SO2VHTQ.js → chunk-OUPQTA7N.js} +2 -2
- package/dist/{chunk-4AMSCAHT.js → chunk-PGWK2FH5.js} +5 -5
- package/dist/{chunk-LESWXCKZ.js → chunk-RUK7QHSH.js} +4 -4
- package/dist/{chunk-5AJZGYWC.js → chunk-SK7ZXQIV.js} +1 -1
- package/dist/{chunk-6T2JWCSZ.js → chunk-TXJMHMPO.js} +4 -4
- package/dist/{chunk-BFF6AJXM.js → chunk-VHR3WQTP.js} +3 -3
- package/dist/{cli-TAFO3WOQ.js → cli-YLO3M2X4.js} +47 -47
- package/dist/{command-TRSFSBT5.js → command-IANIXN6N.js} +13 -13
- package/dist/{config-YCQV3OQK.js → config-FF3E73ZE.js} +5 -5
- package/dist/{container-start-UY2YVY3L.js → container-start-EUTOX4EU.js} +14 -14
- package/dist/{demo-record-cmd-NUGDPXWS.js → demo-record-cmd-Y57UWBCX.js} +3 -3
- package/dist/{demo-voice-cmd-QAH7KPVO.js → demo-voice-cmd-QFVATHAQ.js} +2 -2
- package/dist/{docker-2247NBIK.js → docker-6QIZVYF3.js} +3 -3
- package/dist/{doctor-VVFPHFS4.js → doctor-VSPDIR6T.js} +14 -14
- package/dist/{emit-demo-cmd-V7CP333I.js → emit-demo-cmd-ZYMLB5R5.js} +2 -2
- package/dist/{exec-client-UHL7WPDO.js → exec-client-FGGPQSYQ.js} +1 -1
- package/dist/{find-unit-FEYD4IHC.js → find-unit-EX5ETHGL.js} +7 -7
- package/dist/{host-checks-TX22YEFD.js → host-checks-3QBPJLSG.js} +12 -12
- package/dist/index.js +1 -1
- package/dist/{init-IYL3YXEM.js → init-5QYRPZ63.js} +12 -12
- package/dist/{init-36AY3ZQZ.js → init-JLOGNKPC.js} +12 -12
- package/dist/{init-cmd-JK2OGQU5.js → init-cmd-NDXN2XPU.js} +1 -1
- package/dist/{loop-U72FDFQR.js → loop-I7ZM4CEZ.js} +16 -16
- package/dist/{machine-S2TYJJPP.js → machine-7NYF2WBI.js} +12 -12
- package/dist/{runner-env-OPRWKIKI.js → runner-env-LWKAYARL.js} +7 -7
- package/dist/{runner-identity-OY75LG6G.js → runner-identity-WUAQLGRY.js} +3 -3
- package/dist/{runner-key-6WN67PRU.js → runner-key-VVLYZFP6.js} +12 -12
- package/dist/{status-WCQG6SX4.js → status-I3TV7ZZV.js} +12 -12
- package/dist/{update-steps-BOKCWGQ6.js → update-steps-VOSUXXMS.js} +13 -13
- package/dist/{work-claim-cmd-2A6D5EYO.js → work-claim-cmd-KG3VBBZ2.js} +5 -5
- package/dist/{work-proofs-cmd-RPVVD2SC.js → work-proofs-cmd-74Z72ZG6.js} +1 -1
- package/dist/{work-proofs-record-ULCY5QEP.js → work-proofs-record-LT7UXHNZ.js} +3 -3
- package/package.json +1 -1
|
@@ -8,23 +8,23 @@ import { senderPidfile } from './chunk-5UBNSGK3.js';
|
|
|
8
8
|
import { installScrubContext } from './chunk-XTVVKNRP.js';
|
|
9
9
|
import { readsJobState, READ_JOB_STATE_FORMATS, jobStateFormatOf } from './chunk-ZVB57WI6.js';
|
|
10
10
|
import { runnerImageVersion } from './chunk-ALEUIS35.js';
|
|
11
|
-
import { hasStoredCredential, AGENT_COMMANDS, storeClaudeCredential, credentialFromStdin, isAgentName } from './chunk-
|
|
11
|
+
import { hasStoredCredential, AGENT_COMMANDS, storeClaudeCredential, credentialFromStdin, isAgentName } from './chunk-NRTRPGCW.js';
|
|
12
12
|
import { receiveFiles } from './chunk-NN33FYXG.js';
|
|
13
|
-
import { readDefaultBranchFiles, readDefaultBranchHead, cloneRepository, buildRepositoryImage, fetchCommit, readBranchHead, diffBetween, prepareImageBuild, KEY_PREFIX, TAG_HOST, SHARED_OWNER, SHARED_NAME, universalBase, metadataFromLabels, writeRecord } from './chunk-
|
|
14
|
-
import { FETCHED_DIR, toolsDockerfile, FETCHED_FFMPEG, FETCHED_GH, FETCHED_TINI, FETCHED_HEADLESS_SHELL, FETCHED_PLAYWRIGHT_FFMPEG, FETCHED_VOICE_DIR } from './chunk-
|
|
13
|
+
import { readDefaultBranchFiles, readDefaultBranchHead, cloneRepository, buildRepositoryImage, fetchCommit, readBranchHead, diffBetween, prepareImageBuild, KEY_PREFIX, TAG_HOST, SHARED_OWNER, SHARED_NAME, universalBase, metadataFromLabels, writeRecord } from './chunk-RUK7QHSH.js';
|
|
14
|
+
import { FETCHED_DIR, toolsDockerfile, FETCHED_FFMPEG, FETCHED_GH, FETCHED_TINI, FETCHED_HEADLESS_SHELL, FETCHED_PLAYWRIGHT_FFMPEG, FETCHED_VOICE_DIR } from './chunk-KB5B6ZT5.js';
|
|
15
15
|
import { currentCliBuild } from './chunk-OGFGZQA3.js';
|
|
16
|
-
import { vmExecArgs, runExec, execCapture, waitForAgent } from './chunk-
|
|
16
|
+
import { vmExecArgs, runExec, execCapture, waitForAgent } from './chunk-46OBCATR.js';
|
|
17
17
|
import { describeCallFailure, shortClaim, retrySend, commandWithShim, logStamp, createRunnerLog, formatDuration, removeKeptContext, formatClock, stageGovernedContext, keptContextTree, removeStagedContext, WORKFLOW_PERMISSION_REASON, refusalCode, resolveGoverningSource, prefetchGovernedContext, controlPlaneTokenFailure, keepStagedContext, pinnedSourceOf, shimScript } from './chunk-LZ7PAU55.js';
|
|
18
18
|
import { HELPER_PATH, HELPER_RECORD, DOCKERD_LOG } from './chunk-55PYF6S2.js';
|
|
19
19
|
import { isSameProcess, startTimeOf } from './chunk-JBJTC3UU.js';
|
|
20
20
|
import { socketPathProblem, vsockLinks, linkVsockSockets, GUEST_CID, LEASE_LINK } from './chunk-UZGQT6OF.js';
|
|
21
21
|
import { writeDockerClientConfig } from './chunk-MKSZHT6S.js';
|
|
22
|
-
import { claimCalls, spoolHomeFor, itemCalls, claimItem, leftByRunnerKey } from './chunk-
|
|
23
|
-
import { runnerCredentialProblem, builtinKind, keyRunnerFactory, optionalEgress, isBuiltinContainer, isBuiltinProcess, isBuiltinVm, egressSummary, DEFAULT_CHECK_TIME_LIMIT_MINUTES, DEFAULT_SETUP_MINUTES, allowHostProblem, systemClock, emptyEgressCounts, hostAllowed, imageBuildOf, DEFAULT_SAVED_STATE_MAX_BYTES } from './chunk-
|
|
24
|
-
import { formatBytes, volumeBytes, allocatedBytes, DEFAULT_CACHE_DISK, DEFAULT_BUILD_DISK } from './chunk-
|
|
25
|
-
import { writeJobFile, readJobFile, spawnRun, RUNNER_LABEL, BUILD_LABEL, NETWORK_HELPER_MEMORY, createDockerHost, builderSpec, containerExecArgs, childEnvironment, readDu, withAnswerProtocol, judgeCommand, MAX_REPORT_BYTES, readJobFileChecked, NETWORK_READY_FILE, networkHelperName, runnerLabelValue, prepareRunArgs, containerRunArgs, JUDGE_MAX_TURNS, parseSize, homeCopyRunArgs, networkHelperRunArgs, JUDGE_DIR, HASH_ARGV, parseProgramHash, identityScript, identityArgs, parseIdentity, mountableHome, homeCopyScript, homeCopyArgs, COMMAND_DIR, JUDGE_PROGRAM, MAX_ITEMS_BYTES, JUDGE_ITEMS, JUDGE_REPORT, identityRunArgs, SAVED_STATE_LABEL } from './chunk-
|
|
26
|
-
import { universalImagePending, RecipeError, writeSanitizedRecipe, classifyProperties, DOCKER_FEATURE } from './chunk-
|
|
27
|
-
import { firecrackerArch, MICROVM_ARCHES, FIRECRACKER_VERSION, hostHelperPinned, builderDiskPinned, guestAssetsPinned, GUEST_HELPER_SHA256, GUEST_ASSETS_BASE_URL, GUEST_KERNEL_SHA256, JAILER_BINARY_SHA256, FIRECRACKER_BINARY_SHA256, FIRECRACKER_SHA256, GUEST_ASSETS_VERSION, BUILDER_DISK_VERSION, networkHelperPinned, NETWORK_HELPER_SHA256, universalImagePinned, UNIVERSAL_IMAGE, FFMPEG_STATIC, FFMPEG_BUILD_TAG, GH_SHA256, GH_VERSION, TINI_SHA256, TINI_VERSION, HEADLESS_SHELL, HEADLESS_SHELL_BASE_URL, PLAYWRIGHT_FFMPEG, PLAYWRIGHT_FFMPEG_BASE_URL, VOICE_PACK_FILES, BUILDER_DISK_SHA256, BUILDER_DISK_BASE_URL, DEFAULT_BASE_IMAGE, CLAUDE_CODE_VERSION } from './chunk-
|
|
22
|
+
import { claimCalls, spoolHomeFor, itemCalls, claimItem, leftByRunnerKey } from './chunk-LXYWSGEW.js';
|
|
23
|
+
import { runnerCredentialProblem, builtinKind, keyRunnerFactory, optionalEgress, isBuiltinContainer, isBuiltinProcess, isBuiltinVm, egressSummary, DEFAULT_CHECK_TIME_LIMIT_MINUTES, DEFAULT_SETUP_MINUTES, allowHostProblem, systemClock, emptyEgressCounts, hostAllowed, imageBuildOf, DEFAULT_SAVED_STATE_MAX_BYTES } from './chunk-H3S5LJI2.js';
|
|
24
|
+
import { formatBytes, volumeBytes, allocatedBytes, DEFAULT_CACHE_DISK, DEFAULT_BUILD_DISK, freeBytes } from './chunk-IGHAPIKZ.js';
|
|
25
|
+
import { writeJobFile, readJobFile, spawnRun, RUNNER_LABEL, BUILD_LABEL, NETWORK_HELPER_MEMORY, createDockerHost, builderSpec, containerExecArgs, childEnvironment, readDu, withAnswerProtocol, judgeCommand, MAX_REPORT_BYTES, readJobFileChecked, NETWORK_READY_FILE, networkHelperName, runnerLabelValue, prepareRunArgs, containerRunArgs, JUDGE_MAX_TURNS, parseSize, homeCopyRunArgs, networkHelperRunArgs, JUDGE_DIR, HASH_ARGV, parseProgramHash, identityScript, identityArgs, parseIdentity, mountableHome, homeCopyScript, homeCopyArgs, COMMAND_DIR, JUDGE_PROGRAM, MAX_ITEMS_BYTES, JUDGE_ITEMS, JUDGE_REPORT, identityRunArgs, SAVED_STATE_LABEL } from './chunk-6O33JZ3X.js';
|
|
26
|
+
import { universalImagePending, RecipeError, writeSanitizedRecipe, classifyProperties, DOCKER_FEATURE } from './chunk-CIUD3436.js';
|
|
27
|
+
import { firecrackerArch, MICROVM_ARCHES, FIRECRACKER_VERSION, hostHelperPinned, builderDiskPinned, guestAssetsPinned, GUEST_HELPER_SHA256, GUEST_ASSETS_BASE_URL, GUEST_KERNEL_SHA256, JAILER_BINARY_SHA256, FIRECRACKER_BINARY_SHA256, FIRECRACKER_SHA256, GUEST_ASSETS_VERSION, BUILDER_DISK_VERSION, networkHelperPinned, NETWORK_HELPER_SHA256, universalImagePinned, UNIVERSAL_IMAGE, FFMPEG_STATIC, FFMPEG_BUILD_TAG, GH_SHA256, GH_VERSION, TINI_SHA256, TINI_VERSION, HEADLESS_SHELL, HEADLESS_SHELL_BASE_URL, PLAYWRIGHT_FFMPEG, PLAYWRIGHT_FFMPEG_BASE_URL, VOICE_PACK_FILES, BUILDER_DISK_SHA256, BUILDER_DISK_BASE_URL, DEFAULT_BASE_IMAGE, CLAUDE_CODE_VERSION } from './chunk-OUPQTA7N.js';
|
|
28
28
|
import { postJson, WorkCommandError, getJson, isSignatureRefusal } from './chunk-S6OD32NC.js';
|
|
29
29
|
import { sanitizeTerminal, planArtifactUpload } from './chunk-3PQTOKML.js';
|
|
30
30
|
import { readCloudConfig } from './chunk-HWVMRETT.js';
|
|
@@ -673,6 +673,40 @@ function createContainerHost(deps = {}) {
|
|
|
673
673
|
}
|
|
674
674
|
};
|
|
675
675
|
}
|
|
676
|
+
var CANNOT_CLONE = /* @__PURE__ */ new Set(["ENOTSUP", "EOPNOTSUPP", "EXDEV", "EINVAL", "ENOSYS"]);
|
|
677
|
+
var MAX_STDERR_BYTES = 2e3;
|
|
678
|
+
var reflink = (from, to) => copyFileSync(from, to, constants.COPYFILE_EXCL | constants.COPYFILE_FICLONE_FORCE);
|
|
679
|
+
function sparseCopy(from, to, start) {
|
|
680
|
+
return new Promise((resolve2, reject) => {
|
|
681
|
+
const child = start("cp", ["--sparse=always", "--", from, to], { stdio: ["ignore", "ignore", "pipe"] });
|
|
682
|
+
let stderr = "";
|
|
683
|
+
child.stderr.on("data", (chunk) => void (stderr = (stderr + chunk.toString()).slice(0, MAX_STDERR_BYTES)));
|
|
684
|
+
child.on("error", (err) => reject(new Error(`cp could not start: ${err.message}`)));
|
|
685
|
+
child.on("close", (status) => {
|
|
686
|
+
if (status === 0) return resolve2();
|
|
687
|
+
const line2 = stderr.split("\n").find((text2) => text2.trim() !== "")?.trim() ?? "";
|
|
688
|
+
reject(new Error(`copying the disk failed (cp exit ${status}${line2 === "" ? "" : `: ${line2}`})`));
|
|
689
|
+
});
|
|
690
|
+
});
|
|
691
|
+
}
|
|
692
|
+
async function copyDiskFile(from, to, deps = {}) {
|
|
693
|
+
const partial = `${to}.partial`;
|
|
694
|
+
rmSync(partial, { force: true });
|
|
695
|
+
try {
|
|
696
|
+
try {
|
|
697
|
+
(deps.clone ?? reflink)(from, partial);
|
|
698
|
+
} catch (err) {
|
|
699
|
+
if (!CANNOT_CLONE.has(err.code ?? "")) throw err;
|
|
700
|
+
rmSync(partial, { force: true });
|
|
701
|
+
await sparseCopy(from, partial, deps.spawn ?? spawn);
|
|
702
|
+
}
|
|
703
|
+
renameSync(partial, to);
|
|
704
|
+
} catch (err) {
|
|
705
|
+
rmSync(partial, { force: true });
|
|
706
|
+
throw err;
|
|
707
|
+
}
|
|
708
|
+
chmodSync(to, RUNNER_FILE_MODE);
|
|
709
|
+
}
|
|
676
710
|
|
|
677
711
|
// src/runner/microvm/disks.ts
|
|
678
712
|
function fillRootDisk() {
|
|
@@ -838,16 +872,20 @@ async function ensureRootfs(input) {
|
|
|
838
872
|
return path;
|
|
839
873
|
}
|
|
840
874
|
async function createBuildDisk(input) {
|
|
841
|
-
const template = join(diskTemplatesDir(input.runnerDir), `${input.bytes}.ext4`);
|
|
842
|
-
if (!existsSync(template)) {
|
|
843
|
-
const { uid, gid } = ids();
|
|
844
|
-
await madeAtomically(template, (temp) => input.host.makeTemplate({ bytes: input.bytes, dest: temp, uid: Number(uid), gid: Number(gid), memoryBytes: input.memoryBytes }));
|
|
845
|
-
}
|
|
846
875
|
mkdirSync(dirname(input.dest), { recursive: true });
|
|
847
|
-
if (input.
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
876
|
+
if (input.source !== void 0) {
|
|
877
|
+
await (input.host.copyDisk ?? copyDiskFile)(input.source, input.dest);
|
|
878
|
+
} else {
|
|
879
|
+
const template = join(diskTemplatesDir(input.runnerDir), `${input.bytes}.ext4`);
|
|
880
|
+
if (!existsSync(template)) {
|
|
881
|
+
const { uid, gid } = ids();
|
|
882
|
+
await madeAtomically(template, (temp) => input.host.makeTemplate({ bytes: input.bytes, dest: temp, uid: Number(uid), gid: Number(gid), memoryBytes: input.memoryBytes }));
|
|
883
|
+
}
|
|
884
|
+
if (input.host.copyTemplate) input.host.copyTemplate(template, input.dest);
|
|
885
|
+
else {
|
|
886
|
+
const copied = spawnSync("cp", ["--sparse=always", template, input.dest], { encoding: "utf8" });
|
|
887
|
+
if (copied.status !== 0) throw new Error(`copying the empty build disk failed: ${firstLine(copied.stderr)}`);
|
|
888
|
+
}
|
|
851
889
|
}
|
|
852
890
|
chmodSync(input.dest, RUNNER_FILE_MODE);
|
|
853
891
|
truncateSync(input.dest, input.bytes);
|
|
@@ -1172,6 +1210,7 @@ function helperSocketPath(unitName) {
|
|
|
1172
1210
|
}
|
|
1173
1211
|
var START_TIMEOUT_MS = 12e4;
|
|
1174
1212
|
var DISCARD_TIMEOUT_MS = 11 * 6e4;
|
|
1213
|
+
var COPY_TIMEOUT_MS = 11 * 6e4;
|
|
1175
1214
|
var DEFAULT_REQUEST_TIMEOUT_MS = 3e4;
|
|
1176
1215
|
var MAX_REPLY_BYTES = 1024 * 1024;
|
|
1177
1216
|
function ask(socketPath, request, timeoutMs) {
|
|
@@ -1232,6 +1271,10 @@ function helperClient(socketPath, options = {}) {
|
|
|
1232
1271
|
async discard(build) {
|
|
1233
1272
|
const reply = await ask(socketPath, { v: 1, op: "discard", build }, DISCARD_TIMEOUT_MS);
|
|
1234
1273
|
return { freedBytes: typeof reply.freedBytes === "number" ? reply.freedBytes : 0 };
|
|
1274
|
+
},
|
|
1275
|
+
async copy(build) {
|
|
1276
|
+
const reply = await ask(socketPath, { v: 1, op: "copy", build }, COPY_TIMEOUT_MS);
|
|
1277
|
+
return { copiedBytes: typeof reply.copiedBytes === "number" ? reply.copiedBytes : 0 };
|
|
1235
1278
|
}
|
|
1236
1279
|
};
|
|
1237
1280
|
}
|
|
@@ -2560,7 +2603,7 @@ function writeRecord2(dir, record) {
|
|
|
2560
2603
|
function isRecord(value) {
|
|
2561
2604
|
if (typeof value !== "object" || value === null) return false;
|
|
2562
2605
|
const r = value;
|
|
2563
|
-
return typeof r.id === "string" && (r.kind === "volume" || r.kind === "tar") && typeof r.savedAt === "string" && Number.isFinite(Date.parse(r.savedAt)) && typeof r.bytes === "number" && typeof r.baseKey === "string" && typeof r.key === "string" && typeof r.fileHashes === "object" && r.fileHashes !== null && typeof r.complete === "boolean";
|
|
2606
|
+
return typeof r.id === "string" && (r.kind === "volume" || r.kind === "tar" || r.kind === "disk") && typeof r.savedAt === "string" && Number.isFinite(Date.parse(r.savedAt)) && typeof r.bytes === "number" && typeof r.baseKey === "string" && typeof r.key === "string" && typeof r.fileHashes === "object" && r.fileHashes !== null && typeof r.complete === "boolean";
|
|
2564
2607
|
}
|
|
2565
2608
|
function readRecords(dir) {
|
|
2566
2609
|
let names;
|
|
@@ -2584,6 +2627,46 @@ function deleteRecord(dir, id) {
|
|
|
2584
2627
|
rmSync(join(dir, `${id}.json`), { force: true });
|
|
2585
2628
|
}
|
|
2586
2629
|
|
|
2630
|
+
// src/runner/saved-state/remove.ts
|
|
2631
|
+
async function removeSavedState(record, deps) {
|
|
2632
|
+
if (record.kind === "volume" && record.volume !== void 0) {
|
|
2633
|
+
const result = await deps.removeVolume(record.volume);
|
|
2634
|
+
if (result !== void 0 && result.status !== 0) {
|
|
2635
|
+
const line2 = (result.stderr ?? "").trim().split("\n").filter((text2) => text2.trim() !== "").at(-1);
|
|
2636
|
+
throw new Error(`Docker could not remove volume ${record.volume} (exit ${result.status}${line2 === void 0 ? "" : `: ${line2}`})`);
|
|
2637
|
+
}
|
|
2638
|
+
}
|
|
2639
|
+
if ((record.kind === "tar" || record.kind === "disk") && record.path !== void 0) {
|
|
2640
|
+
rmSync(`${record.path}.partial`, { force: true });
|
|
2641
|
+
rmSync(record.path, { force: true });
|
|
2642
|
+
}
|
|
2643
|
+
deleteRecord(deps.dir, record.id);
|
|
2644
|
+
}
|
|
2645
|
+
async function removeOldestUntil(input) {
|
|
2646
|
+
const removed = [];
|
|
2647
|
+
for (const record of oldestFirst(input.records)) {
|
|
2648
|
+
if (input.enough()) break;
|
|
2649
|
+
try {
|
|
2650
|
+
await removeSavedState(record, input.deps);
|
|
2651
|
+
removed.push(record);
|
|
2652
|
+
input.log(`removed saved state ${record.id} from ${record.savedAt}`);
|
|
2653
|
+
} catch (err) {
|
|
2654
|
+
input.log(`could not remove saved state ${record.id}: ${describeCallFailure(err)}`);
|
|
2655
|
+
}
|
|
2656
|
+
}
|
|
2657
|
+
return removed;
|
|
2658
|
+
}
|
|
2659
|
+
async function removeSuperseded(input) {
|
|
2660
|
+
for (const old of input.records.filter((record) => record.complete && record.key === input.made.key && record.id !== input.made.id && Date.parse(record.savedAt) < Date.parse(input.made.savedAt))) {
|
|
2661
|
+
try {
|
|
2662
|
+
await removeSavedState(old, input.deps);
|
|
2663
|
+
input.log(`removed saved state ${old.id}, saved state ${input.made.id} replaces it`);
|
|
2664
|
+
} catch (err) {
|
|
2665
|
+
input.log(`could not remove saved state ${old.id}: ${describeCallFailure(err)}`);
|
|
2666
|
+
}
|
|
2667
|
+
}
|
|
2668
|
+
}
|
|
2669
|
+
|
|
2587
2670
|
// src/runner/saved-state/plan.ts
|
|
2588
2671
|
function savedStateBase(report) {
|
|
2589
2672
|
const digest = report.recipe === "default" ? report.base?.digest : void 0;
|
|
@@ -2628,6 +2711,15 @@ async function planSavedState(input) {
|
|
|
2628
2711
|
diskBytes: parseSize(config.build?.disk ?? DEFAULT_BUILD_DISK) ?? 0
|
|
2629
2712
|
});
|
|
2630
2713
|
const found = lookup(readRecords(savedStatesDir(root)), key, input.now.getTime());
|
|
2714
|
+
if (found.kind !== "none" && found.record.kind === "tar") {
|
|
2715
|
+
try {
|
|
2716
|
+
await removeSavedState(found.record, { dir: savedStatesDir(root), removeVolume: async () => void 0 });
|
|
2717
|
+
log(`saved state ${found.record.id} is a tar file, which this runner no longer restores; removed it; starting from a fresh disk`);
|
|
2718
|
+
} catch (err) {
|
|
2719
|
+
log(`saved state ${found.record.id} is a tar file, which this runner no longer restores, and it could not be removed: ${describeCallFailure(err)}; starting from a fresh disk`);
|
|
2720
|
+
}
|
|
2721
|
+
return { key, keyCommits };
|
|
2722
|
+
}
|
|
2631
2723
|
if (found.kind === "usable" && input.allowRestore) {
|
|
2632
2724
|
log(`starting from saved state ${found.record.id}, saved ${formatDuration(found.ageMs)} ago`);
|
|
2633
2725
|
return { key, keyCommits, restore: { record: found.record, ageMs: found.ageMs } };
|
|
@@ -2645,44 +2737,6 @@ function unread(reason, log) {
|
|
|
2645
2737
|
log(`this build starts from no saved state and saves none: ${reason}`);
|
|
2646
2738
|
return { keyCommits: {}, noSave: `its key files could not be read: ${reason}` };
|
|
2647
2739
|
}
|
|
2648
|
-
async function removeSavedState(record, deps) {
|
|
2649
|
-
if (record.kind === "volume" && record.volume !== void 0) {
|
|
2650
|
-
const result = await deps.removeVolume(record.volume);
|
|
2651
|
-
if (result !== void 0 && result.status !== 0) {
|
|
2652
|
-
const line2 = (result.stderr ?? "").trim().split("\n").filter((text2) => text2.trim() !== "").at(-1);
|
|
2653
|
-
throw new Error(`Docker could not remove volume ${record.volume} (exit ${result.status}${line2 === void 0 ? "" : `: ${line2}`})`);
|
|
2654
|
-
}
|
|
2655
|
-
}
|
|
2656
|
-
if (record.kind === "tar" && record.path !== void 0) {
|
|
2657
|
-
rmSync(`${record.path}.partial`, { force: true });
|
|
2658
|
-
rmSync(record.path, { force: true });
|
|
2659
|
-
}
|
|
2660
|
-
deleteRecord(deps.dir, record.id);
|
|
2661
|
-
}
|
|
2662
|
-
async function removeOldestUntil(input) {
|
|
2663
|
-
const removed = [];
|
|
2664
|
-
for (const record of oldestFirst(input.records)) {
|
|
2665
|
-
if (input.enough()) break;
|
|
2666
|
-
try {
|
|
2667
|
-
await removeSavedState(record, input.deps);
|
|
2668
|
-
removed.push(record);
|
|
2669
|
-
input.log(`removed saved state ${record.id} from ${record.savedAt}`);
|
|
2670
|
-
} catch (err) {
|
|
2671
|
-
input.log(`could not remove saved state ${record.id}: ${describeCallFailure(err)}`);
|
|
2672
|
-
}
|
|
2673
|
-
}
|
|
2674
|
-
return removed;
|
|
2675
|
-
}
|
|
2676
|
-
async function removeSuperseded(input) {
|
|
2677
|
-
for (const old of input.records.filter((record) => record.complete && record.key === input.made.key && record.id !== input.made.id && Date.parse(record.savedAt) < Date.parse(input.made.savedAt))) {
|
|
2678
|
-
try {
|
|
2679
|
-
await removeSavedState(old, input.deps);
|
|
2680
|
-
input.log(`removed saved state ${old.id}, saved state ${input.made.id} replaces it`);
|
|
2681
|
-
} catch (err) {
|
|
2682
|
-
input.log(`could not remove saved state ${old.id}: ${describeCallFailure(err)}`);
|
|
2683
|
-
}
|
|
2684
|
-
}
|
|
2685
|
-
}
|
|
2686
2740
|
|
|
2687
2741
|
// src/runner/saved-state/provision.ts
|
|
2688
2742
|
var isRetryFresh = (value) => typeof value === "object" && value !== null && "retryFresh" in value;
|
|
@@ -2738,17 +2792,103 @@ async function discardUnusableState(input) {
|
|
|
2738
2792
|
function settleFailedSteps(steps, on) {
|
|
2739
2793
|
return steps.restoreFailed === true ? on.giveUp(steps.reason) : on.bail(steps.reason, steps.aborted === true);
|
|
2740
2794
|
}
|
|
2795
|
+
var FREEZE_DEADLINE_SECONDS = 12 * 60;
|
|
2796
|
+
function freezeScript() {
|
|
2797
|
+
return [
|
|
2798
|
+
"deadline=$1",
|
|
2799
|
+
`exec 3< <(exec setsid bash -c 'main=$1; end=$((SECONDS + $2)); echo ready; exec >/dev/null; while kill -0 "$main" 2>/dev/null && [ "$SECONDS" -lt "$end" ]; do sleep 1; done; fsfreeze -u /build 2>/dev/null' watcher "$$" "$deadline" </dev/null 2>/dev/null)`,
|
|
2800
|
+
"watcher=$!",
|
|
2801
|
+
'read -r -t 30 -u 3 ready && [ "$ready" = ready ] || exit 6',
|
|
2802
|
+
"exec 3<&-",
|
|
2803
|
+
'fsfreeze -f /build || { kill "$watcher" 2>/dev/null; exit 3; }',
|
|
2804
|
+
"echo frozen",
|
|
2805
|
+
// A line `thaw` is the runner's request. The end of the input, or the deadline, is a thaw the runner did not ask for.
|
|
2806
|
+
'if read -r -t "$deadline" line && [ "$line" = thaw ]; then',
|
|
2807
|
+
' if fsfreeze -u /build; then kill "$watcher" 2>/dev/null; echo thawed; exit 0; fi',
|
|
2808
|
+
" exit 4",
|
|
2809
|
+
"fi",
|
|
2810
|
+
"fsfreeze -u /build 2>/dev/null",
|
|
2811
|
+
'kill "$watcher" 2>/dev/null',
|
|
2812
|
+
"echo thawed early",
|
|
2813
|
+
"exit 5"
|
|
2814
|
+
].join("\n");
|
|
2815
|
+
}
|
|
2741
2816
|
var failureText = (status, stderr) => {
|
|
2742
2817
|
const line2 = stderr.trim().split("\n").at(-1) ?? "";
|
|
2743
2818
|
return `exit ${status}${line2 === "" ? "" : `: ${line2}`}`;
|
|
2744
2819
|
};
|
|
2745
|
-
async function
|
|
2820
|
+
async function freezeGuest(guest, deadlineSeconds = FREEZE_DEADLINE_SECONDS) {
|
|
2821
|
+
const stdin = new PassThrough();
|
|
2822
|
+
const lines = [];
|
|
2823
|
+
let pending = "";
|
|
2824
|
+
let stderr = "";
|
|
2825
|
+
let thawRequested = false;
|
|
2826
|
+
let thawedBeforeAsked = false;
|
|
2827
|
+
let thawedAfterAsked = false;
|
|
2828
|
+
let notify = () => void 0;
|
|
2829
|
+
const onLine = (line2) => {
|
|
2830
|
+
lines.push(line2);
|
|
2831
|
+
if (line2.startsWith("thawed")) {
|
|
2832
|
+
if (line2 === "thawed early" || !thawRequested) thawedBeforeAsked = true;
|
|
2833
|
+
else thawedAfterAsked = true;
|
|
2834
|
+
}
|
|
2835
|
+
notify();
|
|
2836
|
+
};
|
|
2837
|
+
const ended = guest.stream(["bash", "-c", freezeScript(), "freeze", String(deadlineSeconds)], {
|
|
2838
|
+
stdin,
|
|
2839
|
+
onStdout: (chunk) => {
|
|
2840
|
+
pending += chunk.toString();
|
|
2841
|
+
for (let end = pending.indexOf("\n"); end !== -1; end = pending.indexOf("\n")) {
|
|
2842
|
+
onLine(pending.slice(0, end).trim());
|
|
2843
|
+
pending = pending.slice(end + 1);
|
|
2844
|
+
}
|
|
2845
|
+
},
|
|
2846
|
+
onStderr: (chunk) => void (stderr = (stderr + chunk.toString()).slice(-400))
|
|
2847
|
+
}).then(
|
|
2848
|
+
(result) => ({ done: true, status: result.status }),
|
|
2849
|
+
(err) => ({ done: true, error: describeCallFailure(err) })
|
|
2850
|
+
);
|
|
2851
|
+
const frozen = new Promise((resolve2) => {
|
|
2852
|
+
notify = () => {
|
|
2853
|
+
if (lines.includes("frozen")) resolve2("frozen");
|
|
2854
|
+
};
|
|
2855
|
+
});
|
|
2856
|
+
const first = await Promise.race([frozen, ended]);
|
|
2857
|
+
if (first !== "frozen") {
|
|
2858
|
+
stdin.end();
|
|
2859
|
+
return { ok: false, reason: "error" in first ? `the guest could not freeze /build: ${first.error}` : `the guest could not freeze /build (${failureText(first.status, stderr)})` };
|
|
2860
|
+
}
|
|
2861
|
+
return {
|
|
2862
|
+
ok: true,
|
|
2863
|
+
session: {
|
|
2864
|
+
async thaw() {
|
|
2865
|
+
thawRequested = true;
|
|
2866
|
+
stdin.end("thaw\n");
|
|
2867
|
+
const result = await ended;
|
|
2868
|
+
if ("error" in result) return { ok: false, reason: `the freeze command's connection failed: ${result.error}` };
|
|
2869
|
+
if (thawedBeforeAsked) return { ok: false, reason: "the freeze command thawed /build before the runner asked" };
|
|
2870
|
+
if (!thawedAfterAsked) return { ok: false, reason: `the freeze command did not say it thawed /build (${failureText(result.status, stderr)})` };
|
|
2871
|
+
if (result.status !== 0) return { ok: false, reason: `the freeze command ended badly after it thawed /build (${failureText(result.status, stderr)})` };
|
|
2872
|
+
return { ok: true };
|
|
2873
|
+
}
|
|
2874
|
+
}
|
|
2875
|
+
};
|
|
2876
|
+
}
|
|
2877
|
+
|
|
2878
|
+
// src/runner/saved-state/microvm.ts
|
|
2879
|
+
var HELPER_COPY_NAME = "saved-state.ext4";
|
|
2880
|
+
var failureText2 = (status, stderr) => {
|
|
2881
|
+
const line2 = stderr.trim().split("\n").at(-1) ?? "";
|
|
2882
|
+
return `exit ${status}${line2 === "" ? "" : `: ${line2}`}`;
|
|
2883
|
+
};
|
|
2884
|
+
async function saveMicroVmDiskState(input) {
|
|
2746
2885
|
const id = randomBytes(6).toString("hex");
|
|
2747
|
-
const path = join(input.dir, `${id}.
|
|
2886
|
+
const path = join(input.dir, `${id}.ext4`);
|
|
2748
2887
|
const partial = `${path}.partial`;
|
|
2888
|
+
const helperCopy = join(input.buildDir, HELPER_COPY_NAME);
|
|
2749
2889
|
const record = {
|
|
2750
2890
|
id,
|
|
2751
|
-
kind: "
|
|
2891
|
+
kind: "disk",
|
|
2752
2892
|
path,
|
|
2753
2893
|
savedAt: input.now.toISOString(),
|
|
2754
2894
|
bytes: 0,
|
|
@@ -2759,52 +2899,64 @@ async function saveMicroVmState(input) {
|
|
|
2759
2899
|
complete: false
|
|
2760
2900
|
};
|
|
2761
2901
|
const discard = (reason) => {
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2902
|
+
for (const file of [partial, path, helperCopy]) {
|
|
2903
|
+
try {
|
|
2904
|
+
rmSync(file, { force: true });
|
|
2905
|
+
} catch {
|
|
2906
|
+
}
|
|
2907
|
+
}
|
|
2908
|
+
try {
|
|
2909
|
+
deleteRecord(input.dir, id);
|
|
2910
|
+
} catch {
|
|
2911
|
+
}
|
|
2765
2912
|
return { ok: false, reason };
|
|
2766
2913
|
};
|
|
2914
|
+
let session;
|
|
2767
2915
|
try {
|
|
2916
|
+
const { savedStateMax } = input.limits;
|
|
2917
|
+
if (savedStateMax === "off") return { ok: false, reason: "runner.housekeeping.savedStateMax is off" };
|
|
2768
2918
|
const stopped = await input.guest.run(["/bin/sh", "-c", guestStopScript()]);
|
|
2769
|
-
if (stopped.status !== 0) return { ok: false, reason: `the guest's processes could not be stopped (${
|
|
2919
|
+
if (stopped.status !== 0) return { ok: false, reason: `the guest's processes could not be stopped (${failureText2(stopped.status, stopped.stderr)})` };
|
|
2770
2920
|
const flushed = await input.guest.run(["sync", "-f", "/build"]);
|
|
2771
|
-
if (flushed.status !== 0) return { ok: false, reason: `the build disk could not be flushed (${
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2921
|
+
if (flushed.status !== 0) return { ok: false, reason: `the build disk could not be flushed (${failureText2(flushed.status, flushed.stderr)})` };
|
|
2922
|
+
const allocated = allocatedBytes(input.buildDisk);
|
|
2923
|
+
if (allocated > savedStateMax) {
|
|
2924
|
+
return { ok: false, reason: `the build disk holds ${formatBytes(allocated)}, more than the ${formatBytes(savedStateMax)} of runner.housekeeping.savedStateMax` };
|
|
2925
|
+
}
|
|
2926
|
+
const free = input.limits.freeBytes(input.dir);
|
|
2927
|
+
if (free !== void 0 && free - allocated < input.limits.minFreeDisk) {
|
|
2928
|
+
return { ok: false, reason: `a copy of ${formatBytes(allocated)} would leave ${formatBytes(Math.max(0, free - allocated))} free, less than the ${formatBytes(input.limits.minFreeDisk)} of runner.housekeeping.minFreeDisk` };
|
|
2929
|
+
}
|
|
2930
|
+
const frozen = await (input.freeze ?? ((guest) => freezeGuest(guest)))(input.guest);
|
|
2931
|
+
if (!frozen.ok) return { ok: false, reason: frozen.reason };
|
|
2932
|
+
session = frozen.session;
|
|
2933
|
+
let copyFailure;
|
|
2777
2934
|
try {
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2935
|
+
mkdirSync(input.dir, { recursive: true, mode: 448 });
|
|
2936
|
+
writeRecord2(input.dir, record);
|
|
2937
|
+
if (input.helper !== void 0) {
|
|
2938
|
+
await input.helper.copy(input.buildId);
|
|
2939
|
+
renameSync(helperCopy, path);
|
|
2940
|
+
} else {
|
|
2941
|
+
await (input.copyDisk ?? copyDiskFile)(input.buildDisk, partial);
|
|
2942
|
+
renameSync(partial, path);
|
|
2943
|
+
}
|
|
2944
|
+
} catch (err) {
|
|
2945
|
+
copyFailure = err instanceof HelperRefusal && err.code === "bad-request" ? `${err.message}; run \`outerlayer runner install --service --replace\` to install the root helper that goes with this release` : `the build disk could not be copied: ${describeCallFailure(err)}`;
|
|
2946
|
+
}
|
|
2947
|
+
session = void 0;
|
|
2948
|
+
const thawed = await frozen.session.thaw();
|
|
2949
|
+
if (copyFailure !== void 0) return discard(copyFailure);
|
|
2950
|
+
if (!thawed.ok) return discard(thawed.reason);
|
|
2951
|
+
chmodSync(path, RUNNER_FILE_MODE);
|
|
2952
|
+
const done = { ...record, bytes: statSync(path).blocks * 512, complete: true };
|
|
2788
2953
|
writeRecord2(input.dir, done);
|
|
2789
2954
|
return { ok: true, record: done };
|
|
2790
2955
|
} catch (err) {
|
|
2956
|
+
if (session !== void 0) await session.thaw().catch(() => void 0);
|
|
2791
2957
|
return discard(`the state could not be saved: ${describeCallFailure(err)}`);
|
|
2792
2958
|
}
|
|
2793
2959
|
}
|
|
2794
|
-
async function restoreMicroVmState(input) {
|
|
2795
|
-
const { path } = input.record;
|
|
2796
|
-
if (path === void 0 || !existsSync(path)) return { ok: false, reason: "the saved tar file is gone" };
|
|
2797
|
-
try {
|
|
2798
|
-
let stderr = "";
|
|
2799
|
-
const result = await input.guest.stream(["tar", "-x", "--numeric-owner", "-C", "/build"], {
|
|
2800
|
-
stdin: createReadStream(path),
|
|
2801
|
-
onStderr: (chunk) => void (stderr = (stderr + chunk.toString()).slice(-400))
|
|
2802
|
-
});
|
|
2803
|
-
return result.status === 0 ? { ok: true } : { ok: false, reason: `tar could not unpack the saved state (${failureText(result.status, stderr)})` };
|
|
2804
|
-
} catch (err) {
|
|
2805
|
-
return { ok: false, reason: `the saved state could not be unpacked: ${describeCallFailure(err)}` };
|
|
2806
|
-
}
|
|
2807
|
-
}
|
|
2808
2960
|
var EVAL_INPUT_NAME = "eval-input";
|
|
2809
2961
|
var TRANSCRIPT_ROOT = "/build/home/.claude/projects";
|
|
2810
2962
|
var MAX_TRANSCRIPT_BYTES = 7 * 1024 * 1024;
|
|
@@ -3554,7 +3706,18 @@ async function provisionMicroVmOnce(input, allowRestore) {
|
|
|
3554
3706
|
if (helper === void 0 && config.managed === true) return bail(MANAGED_UNJAILED_REASON);
|
|
3555
3707
|
try {
|
|
3556
3708
|
if (helper === void 0) linkVsockSockets({ buildDir: buildDir2, vsockPath: state.vsockPath, links: served });
|
|
3557
|
-
|
|
3709
|
+
const restore = plan.restore?.record;
|
|
3710
|
+
if (restore !== void 0 && (restore.kind !== "disk" || restore.path === void 0)) return giveUpState(`the saved state is a ${restore.kind}, not a disk this runner can copy; provisioning the build again from a fresh disk`);
|
|
3711
|
+
const restoreStartedAt = Date.now();
|
|
3712
|
+
try {
|
|
3713
|
+
await createBuildDisk({ host: vm.rootfs, runnerDir: runnerDirPath, bytes: limits2.diskBytes, dest: state.buildDisk, memoryBytes: limits2.memoryBytes, source: restore?.path });
|
|
3714
|
+
} catch (err) {
|
|
3715
|
+
if (restore !== void 0) return giveUpState(`the saved disk could not be copied: ${describeCallFailure(err)}`);
|
|
3716
|
+
throw err;
|
|
3717
|
+
}
|
|
3718
|
+
if (restore?.path !== void 0) {
|
|
3719
|
+
tagged(`restored saved state ${restore.id}: ${formatBytes(allocatedBytes(restore.path))} allocated, copied in ${formatDuration(Date.now() - restoreStartedAt)}`);
|
|
3720
|
+
}
|
|
3558
3721
|
writeFileSync(
|
|
3559
3722
|
configPath,
|
|
3560
3723
|
JSON.stringify(
|
|
@@ -3670,8 +3833,6 @@ async function provisionMicroVmOnce(input, allowRestore) {
|
|
|
3670
3833
|
if (plan.restore !== void 0) {
|
|
3671
3834
|
const changed = userIdChangedReason(plan.restore.record.agentUid, agentUid);
|
|
3672
3835
|
if (changed !== void 0) return giveUpState(changed);
|
|
3673
|
-
const restored = await restoreMicroVmState({ guest, record: plan.restore.record });
|
|
3674
|
-
if (!restored.ok) return giveUpState(restored.reason);
|
|
3675
3836
|
}
|
|
3676
3837
|
const tools = await asRoot(runtime, state, ["cat", "/opt/outerlayer/tools.json"]);
|
|
3677
3838
|
const agentVersion = agentVersionOf(tools.status === 0 ? tools.stdout : "");
|
|
@@ -3685,7 +3846,20 @@ async function provisionMicroVmOnce(input, allowRestore) {
|
|
|
3685
3846
|
if (failure3 !== void 0) return bail(failure3);
|
|
3686
3847
|
}
|
|
3687
3848
|
const saveState = () => saveAndPrune({
|
|
3688
|
-
save: () =>
|
|
3849
|
+
save: () => saveMicroVmDiskState({
|
|
3850
|
+
guest,
|
|
3851
|
+
dir: savedStatesPath,
|
|
3852
|
+
buildId,
|
|
3853
|
+
buildDisk: state.buildDisk,
|
|
3854
|
+
buildDir: buildDir2,
|
|
3855
|
+
helper,
|
|
3856
|
+
limits: { savedStateMax: savedStateMaxOf(config), minFreeDisk: config.housekeeping?.minFreeDisk ?? 0, freeBytes },
|
|
3857
|
+
...vm.rootfs.copyDisk === void 0 ? {} : { copyDisk: vm.rootfs.copyDisk.bind(vm.rootfs) },
|
|
3858
|
+
key: plan.key,
|
|
3859
|
+
agentUid,
|
|
3860
|
+
now: clockOf(input.now)(),
|
|
3861
|
+
log: tagged
|
|
3862
|
+
}),
|
|
3689
3863
|
dir: savedStatesPath,
|
|
3690
3864
|
removeVolume: async () => void 0,
|
|
3691
3865
|
log: tagged
|
|
@@ -7781,13 +7955,13 @@ function removeStaleBuilderCaches(options, nowMs) {
|
|
|
7781
7955
|
return freed;
|
|
7782
7956
|
}
|
|
7783
7957
|
var E2FSCK_TIMEOUT_MS = 6e5;
|
|
7784
|
-
var
|
|
7958
|
+
var MAX_STDERR_BYTES2 = 8192;
|
|
7785
7959
|
var SBIN = "/usr/sbin:/sbin";
|
|
7786
7960
|
function e2fsckRunner(run = runWithSpawn(), env = process.env) {
|
|
7787
7961
|
return async (file, args) => {
|
|
7788
7962
|
const result = await run(file, args, { ...env, PATH: `${env.PATH ?? "/usr/bin:/bin"}:${SBIN}` }, E2FSCK_TIMEOUT_MS);
|
|
7789
7963
|
if (result.error !== void 0) throw result.error;
|
|
7790
|
-
return { status: result.status, stderr: result.stderr.slice(0,
|
|
7964
|
+
return { status: result.status, stderr: result.stderr.slice(0, MAX_STDERR_BYTES2) };
|
|
7791
7965
|
};
|
|
7792
7966
|
}
|
|
7793
7967
|
function firstLine6(text2) {
|
|
@@ -8470,7 +8644,7 @@ function helperArgs(input) {
|
|
|
8470
8644
|
}
|
|
8471
8645
|
var SAVE_SCRIPT = `set -e; cp -a ${SAVED_FOLDERS.map((name) => `/from/${name}`).join(" ")} /to/; du -sk /to | cut -f1`;
|
|
8472
8646
|
var RESTORE_SCRIPT = `set -e; cp -a ${SAVED_FOLDERS.map((name) => `/from/${name}`).join(" ")} /to/`;
|
|
8473
|
-
function
|
|
8647
|
+
function failureText3(result) {
|
|
8474
8648
|
const line2 = result.stderr.trim().split("\n").at(-1) ?? "";
|
|
8475
8649
|
return `exit ${result.status}${line2 === "" ? "" : `: ${line2}`}`;
|
|
8476
8650
|
}
|
|
@@ -8493,7 +8667,7 @@ async function saveContainerState(input) {
|
|
|
8493
8667
|
const discard = async (reason) => {
|
|
8494
8668
|
const removed = await host.removeVolume(volume).catch((err) => ({ status: -1, stderr: describeCallFailure(err) }));
|
|
8495
8669
|
if (removed.status !== 0) {
|
|
8496
|
-
input.log(`the volume ${volume} could not be removed (${
|
|
8670
|
+
input.log(`the volume ${volume} could not be removed (${failureText3({ status: removed.status, stderr: removed.stderr })}); its record stays so a later pass retries`);
|
|
8497
8671
|
return { ok: false, reason };
|
|
8498
8672
|
}
|
|
8499
8673
|
deleteRecord(input.dir, id);
|
|
@@ -8502,15 +8676,15 @@ async function saveContainerState(input) {
|
|
|
8502
8676
|
try {
|
|
8503
8677
|
const noEnv = { literals: {}, passed: {} };
|
|
8504
8678
|
const stopped = await host.exec({ container: input.container, user: input.agentUser, env: noEnv, argv: ["sh", "-c", stopProcessesScript()] });
|
|
8505
|
-
if (stopped.status !== 0) return { ok: false, reason: `the build's processes could not be stopped (${
|
|
8679
|
+
if (stopped.status !== 0) return { ok: false, reason: `the build's processes could not be stopped (${failureText3(stopped)})` };
|
|
8506
8680
|
input.log(`${stopped.stdout.trim() || "stopped 0"} process${stopped.stdout.trim() === "stopped 1" ? "" : "es"} before saving the state`);
|
|
8507
8681
|
const flushed = await host.exec({ container: input.container, user: input.agentUser, env: noEnv, argv: ["sync"] });
|
|
8508
|
-
if (flushed.status !== 0) return { ok: false, reason: `the build's disk could not be flushed (${
|
|
8682
|
+
if (flushed.status !== 0) return { ok: false, reason: `the build's disk could not be flushed (${failureText3(flushed)})` };
|
|
8509
8683
|
writeRecord2(input.dir, record);
|
|
8510
8684
|
const created = await host.createVolume(volume, { [SAVED_STATE_LABEL]: id, [RUNNER_LABEL]: input.runnerId });
|
|
8511
|
-
if (created.status !== 0) return await discard(`the volume for the saved state could not be made (${
|
|
8685
|
+
if (created.status !== 0) return await discard(`the volume for the saved state could not be made (${failureText3(created)})`);
|
|
8512
8686
|
const copied = await host.run(helperArgs({ image: input.image, from: input.buildVolume, to: volume, script: SAVE_SCRIPT, runnerId: input.runnerId }), { logPath: input.logPath });
|
|
8513
|
-
if (copied.status !== 0) return await discard(`the copy into the saved state failed (${
|
|
8687
|
+
if (copied.status !== 0) return await discard(`the copy into the saved state failed (${failureText3(copied)})`);
|
|
8514
8688
|
const kilobytes = Number(copied.stdout.trim().split("\n").at(-1));
|
|
8515
8689
|
const done = { ...record, bytes: Number.isFinite(kilobytes) ? kilobytes * 1024 : 0, complete: true };
|
|
8516
8690
|
writeRecord2(input.dir, done);
|
|
@@ -8522,7 +8696,7 @@ async function saveContainerState(input) {
|
|
|
8522
8696
|
async function restoreContainerState(input) {
|
|
8523
8697
|
try {
|
|
8524
8698
|
const copied = await input.host.run(helperArgs({ image: input.image, from: input.savedVolume, to: input.targetVolume, script: RESTORE_SCRIPT, runnerId: input.runnerId }), { logPath: input.logPath });
|
|
8525
|
-
if (copied.status !== 0) return { ok: false, reason: `the saved volume could not be copied (${
|
|
8699
|
+
if (copied.status !== 0) return { ok: false, reason: `the saved volume could not be copied (${failureText3(copied)})` };
|
|
8526
8700
|
return { ok: true };
|
|
8527
8701
|
} catch (err) {
|
|
8528
8702
|
return { ok: false, reason: `the saved volume could not be copied: ${describeCallFailure(err)}` };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { GH_VERSION, VOICE_PACK_FILES, VOICE_PACK_VERSION, FFMPEG_STATIC, FFMPEG_BUILD_TAG, GH_SHA256, TINI_SHA256, TINI_VERSION, HEADLESS_SHELL_REVISION, HEADLESS_SHELL_BASE_URL, PLAYWRIGHT_FFMPEG_BASE_URL, PLAYWRIGHT_FFMPEG_REVISION, HEADLESS_SHELL, PLAYWRIGHT_FFMPEG, PLAYWRIGHT_VERSION } from './chunk-
|
|
3
|
+
import { GH_VERSION, VOICE_PACK_FILES, VOICE_PACK_VERSION, FFMPEG_STATIC, FFMPEG_BUILD_TAG, GH_SHA256, TINI_SHA256, TINI_VERSION, HEADLESS_SHELL_REVISION, HEADLESS_SHELL_BASE_URL, PLAYWRIGHT_FFMPEG_BASE_URL, PLAYWRIGHT_FFMPEG_REVISION, HEADLESS_SHELL, PLAYWRIGHT_FFMPEG, PLAYWRIGHT_VERSION } from './chunk-OUPQTA7N.js';
|
|
4
4
|
import { PROXY_WARNING_FLAG } from './chunk-GANAOCHR.js';
|
|
5
5
|
import { RELAY_ID, RELAY_USER } from './chunk-MESOOLF4.js';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { keyRunnerFactory, RunnerConfigError } from './chunk-
|
|
3
|
+
import { keyRunnerFactory, RunnerConfigError } from './chunk-H3S5LJI2.js';
|
|
4
4
|
import { orgHomeDir } from './chunk-WT7J2627.js';
|
|
5
5
|
|
|
6
6
|
createRequire(import.meta.url);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { stripTerminalControls } from './chunk-
|
|
3
|
+
import { stripTerminalControls } from './chunk-JVQYYVDS.js';
|
|
4
4
|
import { tagToPull, imageTag, pullInstruction, readUpdateStatus, runnerImageVersion } from './chunk-ALEUIS35.js';
|
|
5
5
|
import { readFileSync } from 'fs';
|
|
6
6
|
|
|
@@ -55,7 +55,7 @@ function envNamesOf(row, imageEnv) {
|
|
|
55
55
|
return [...new Set(names)].sort();
|
|
56
56
|
}
|
|
57
57
|
async function readOwnContainer(deps = {}) {
|
|
58
|
-
const run = deps.run ?? (await import('./docker-
|
|
58
|
+
const run = deps.run ?? (await import('./docker-6QIZVYF3.js')).spawnRun;
|
|
59
59
|
const ids = candidateIds(deps.env ?? process.env, deps.readFile ?? ((path) => readFileSync(path, "utf8")));
|
|
60
60
|
if (ids.length === 0) return { ok: false, reason: "the runner cannot tell which container it runs in: HOSTNAME is empty and /proc/self/mountinfo names none" };
|
|
61
61
|
let problem = "";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { DEFAULT_UNIT_NAME } from './chunk-
|
|
3
|
+
import { DEFAULT_UNIT_NAME } from './chunk-IP7F4CQH.js';
|
|
4
4
|
import { RUNNER_FILE_MODE } from './chunk-WT7J2627.js';
|
|
5
5
|
import { claudeEnvPath, withoutCredentialLines, parseRunnerEnv } from './chunk-GANAOCHR.js';
|
|
6
6
|
import { existsSync, readFileSync, writeFileSync, renameSync, rmSync } from 'fs';
|
|
@@ -51,10 +51,10 @@ function networkHelperPinned(arch, hashes = NETWORK_HELPER_SHA256) {
|
|
|
51
51
|
var JAILER_BINARY_SHA256 = {
|
|
52
52
|
x86_64: "65ef226e96f0ceda55ba643f445801ef2cc0ea667ef67cad8ac4f406c9c8434f"
|
|
53
53
|
};
|
|
54
|
-
var HOST_HELPER_ASSETS_VERSION = "
|
|
54
|
+
var HOST_HELPER_ASSETS_VERSION = "17";
|
|
55
55
|
var HOST_HELPER_BASE_URL = `https://github.com/outerlayerai/guest-assets/releases/download/guest-${HOST_HELPER_ASSETS_VERSION}`;
|
|
56
56
|
var HOST_HELPER_SHA256 = {
|
|
57
|
-
x86_64: "
|
|
57
|
+
x86_64: "0cd70e76a462212ed334b90edefb3dc1e4c584f93af7d990dbc801b67884f29f"
|
|
58
58
|
};
|
|
59
59
|
var HOST_HELPER_SLICE_SINCE = 15;
|
|
60
60
|
function hostHelperSupportsSlice(version = HOST_HELPER_ASSETS_VERSION) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { placeholderQueues, placeholderProblem } from './chunk-
|
|
4
|
-
import { checkFit, RUNNER_RESERVE_BYTES } from './chunk-
|
|
5
|
-
import { isBuiltinVm, builtinKind, EGRESS_SWITCHABLE_KEYS, imageBuildOf, keepsHostBuilder } from './chunk-
|
|
6
|
-
import { realBuildDiskProbe, checkDiskFit, DEFAULT_CACHE_DISK, DEFAULT_BUILD_DISK } from './chunk-
|
|
7
|
-
import { builderDiskPinned } from './chunk-
|
|
3
|
+
import { placeholderQueues, placeholderProblem } from './chunk-JVQYYVDS.js';
|
|
4
|
+
import { checkFit, RUNNER_RESERVE_BYTES } from './chunk-IP7F4CQH.js';
|
|
5
|
+
import { isBuiltinVm, builtinKind, EGRESS_SWITCHABLE_KEYS, imageBuildOf, keepsHostBuilder } from './chunk-H3S5LJI2.js';
|
|
6
|
+
import { realBuildDiskProbe, checkDiskFit, DEFAULT_CACHE_DISK, DEFAULT_BUILD_DISK } from './chunk-IGHAPIKZ.js';
|
|
7
|
+
import { builderDiskPinned } from './chunk-OUPQTA7N.js';
|
|
8
8
|
import { getJson, WorkCommandError } from './chunk-S6OD32NC.js';
|
|
9
9
|
import { ensureHostKey } from './chunk-4DJZSNVT.js';
|
|
10
10
|
import { BUILD_SLICE_MEMORY_ENV, FORWARDED_CLAUDE_CREDENTIAL_VARIABLES, claudeCredentialVariablesSet, claudeCredential, claudeEnvPath, parseRunnerEnv } from './chunk-GANAOCHR.js';
|