@outerlayer/cli 0.7.0 → 0.8.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 +16 -0
- package/README.md +5 -5
- package/dist/{build-JF5UOWKJ.js → build-MS34XEGN.js} +2 -1
- package/dist/build-info.json +1 -1
- package/dist/builder-G52A6GW2.js +13 -0
- package/dist/{check-ASZL5BEO.js → check-FOF3PUKI.js} +21 -18
- package/dist/{chunk-2VO25HHO.js → chunk-3S4P55NE.js} +2 -2
- package/dist/{chunk-MQPRB5K7.js → chunk-4A5E2G4E.js} +6 -6
- package/dist/{chunk-PUN7LMNS.js → chunk-4ACZCY4I.js} +2 -2
- package/dist/{chunk-DGAIVMMN.js → chunk-5QLNZGAQ.js} +2 -2
- package/dist/chunk-5TNS3PL7.js +263 -0
- package/dist/chunk-7RQ73DLO.js +23 -0
- package/dist/{chunk-AJKEHABI.js → chunk-7VNURP6M.js} +248 -50
- package/dist/{chunk-6ZZHWY2Z.js → chunk-AIL2R4SI.js} +1 -1
- package/dist/{chunk-7FTNIAHS.js → chunk-AX23QKHS.js} +7 -3
- package/dist/{chunk-E4PIFIC3.js → chunk-CM5QTKM4.js} +58 -149
- package/dist/chunk-CX22S5BA.js +45 -0
- package/dist/{chunk-D6FXM5OW.js → chunk-GAYWY4GI.js} +8 -8
- package/dist/{chunk-AII7CKTH.js → chunk-IJBVPLZZ.js} +54 -16
- package/dist/{chunk-SSU747O6.js → chunk-ILEA3YHM.js} +1 -1
- package/dist/{chunk-6IYLDODX.js → chunk-IRCBTGWF.js} +4 -4
- package/dist/{chunk-OUUINEYB.js → chunk-JKIWMRFH.js} +1 -1
- package/dist/{chunk-X2FSFU4C.js → chunk-K35RW5HP.js} +2 -2
- package/dist/{chunk-6QWV3YDJ.js → chunk-NALVDFIS.js} +2 -2
- package/dist/{chunk-Q5G2ODUZ.js → chunk-OEK4JEB3.js} +33 -4
- package/dist/chunk-PTW6W5NR.js +127 -0
- package/dist/{chunk-DTXOJDEH.js → chunk-PWBILI5P.js} +3 -2
- package/dist/{chunk-CEBIA5FD.js → chunk-TTNFGMHO.js} +42 -50
- package/dist/{chunk-AQ54MKSQ.js → chunk-TUUMW4TC.js} +2 -2
- package/dist/{chunk-774HEQL6.js → chunk-U3GOI2B4.js} +91 -8
- package/dist/{chunk-F6GFZXZ3.js → chunk-UXYLWVTQ.js} +1 -18
- package/dist/{cli-LEVCGAQV.js → cli-AOJPAVFX.js} +94 -68
- package/dist/{command-FLSYCGIB.js → command-SY3SVLAI.js} +31 -16
- package/dist/{config-I3TVFYLH.js → config-Z3USDBLU.js} +3 -2
- package/dist/{connect-cmd-MJMUONDY.js → connect-cmd-PNZ6IJLJ.js} +2 -2
- package/dist/{dist-PXBSA7QX.js → dist-3ZTZF2TP.js} +1 -1
- package/dist/docker-676FD3CQ.js +15 -0
- package/dist/{doctor-FVDT3KJZ.js → doctor-WR6TRPSU.js} +36 -13
- package/dist/{emit-artifact-cmd-7RPMRSVP.js → emit-artifact-cmd-AVM4YXMQ.js} +4 -4
- package/dist/{emit-criteria-cmd-MKI7WETO.js → emit-criteria-cmd-LDBE4YDS.js} +3 -3
- package/dist/{emit-finding-cmd-RMLGZASB.js → emit-finding-cmd-6R5WBPCH.js} +3 -3
- package/dist/{emit-result-cmd-MTXAZ2GV.js → emit-result-cmd-2DMN6O6U.js} +4 -4
- package/dist/index.js +1 -1
- package/dist/{init-BACXESVV.js → init-KDK5QLQZ.js} +13 -10
- package/dist/{init-VLW7H6RW.js → init-R2FJ5KNS.js} +22 -15
- package/dist/{init-cmd-VJFB5L7X.js → init-cmd-BYZYAJ5P.js} +5 -5
- package/dist/{install-NMAPLLBQ.js → install-FHTVJZS6.js} +5 -4
- package/dist/{install-cmd-B5SEU3G7.js → install-cmd-DCF7TVXD.js} +2 -1
- package/dist/{loop-D3243JKT.js → loop-AG3PLXPO.js} +21 -18
- package/dist/{machine-EB3GEVI4.js → machine-LV6WBRRK.js} +12 -9
- package/dist/{session-sender-LMACEJJS.js → session-sender-Q5HAMOL2.js} +3 -3
- package/dist/{status-F4THTJJK.js → status-HH4OSOHR.js} +15 -12
- package/dist/{sync-cmd-M6JA3OEE.js → sync-cmd-CAEPJR7B.js} +2 -2
- package/dist/{watch-NB5TGPEZ.js → watch-LAAZFBHH.js} +2 -2
- package/dist/{work-claim-cmd-UHMWOS3G.js → work-claim-cmd-ARIYZARE.js} +8 -7
- package/dist/{work-cmd-6UMCFTAW.js → work-cmd-B3FOXZAL.js} +4 -4
- package/dist/{work-comment-cmd-E4LEUIXZ.js → work-comment-cmd-O5WGRI6K.js} +4 -4
- package/dist/{work-open-pr-cmd-OPZWGSEQ.js → work-open-pr-cmd-M6CQW7KW.js} +5 -5
- package/dist/{work-pr-cmd-IDIAFFRU.js → work-pr-cmd-C4YEGKD6.js} +4 -4
- package/package.json +1 -1
- package/dist/docker-NEGDLU6D.js +0 -7
- package/dist/{agent-setup-TXLDY5RV.js → agent-setup-C7PLRXZO.js} +1 -1
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { readDefaultBranchHead, cloneRepository, buildRepositoryImage
|
|
3
|
+
import { readDefaultBranchHead, cloneRepository, buildRepositoryImage } from './chunk-TTNFGMHO.js';
|
|
4
4
|
import { startTimeOf, isSameProcess } from './chunk-N5FOE5PS.js';
|
|
5
5
|
import { currentCliBuild } from './chunk-OGFGZQA3.js';
|
|
6
|
-
import { createDockerHost, childEnvironment, spawnRun } from './chunk-
|
|
6
|
+
import { createDockerHost, childEnvironment, spawnRun } from './chunk-U3GOI2B4.js';
|
|
7
7
|
import { RecipeError } from './chunk-QOZKPLVJ.js';
|
|
8
|
+
import { builderSpec, runnerLabelValue, RUNNER_LABEL, BUILD_LABEL, prepareRunArgs, containerRunArgs, containerExecArgs } from './chunk-5TNS3PL7.js';
|
|
9
|
+
import { CLAUDE_CODE_VERSION, firecrackerArch, MICROVM_ARCHES, DEFAULT_BASE_IMAGE, GUEST_HELPER_SHA256, GUEST_ASSETS_BASE_URL, GUEST_KERNEL_SHA256, FIRECRACKER_BINARY_SHA256, FIRECRACKER_SHA256, FIRECRACKER_VERSION, GUEST_ASSETS_VERSION } from './chunk-CX22S5BA.js';
|
|
8
10
|
import { execCapture } from './chunk-ZOAEPWGL.js';
|
|
9
11
|
import { GUEST_CID } from './chunk-R7STSBLC.js';
|
|
10
|
-
import { WorkCommandError, postJson } from './chunk-
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
12
|
+
import { WorkCommandError, postJson } from './chunk-5QLNZGAQ.js';
|
|
13
|
+
import { hostAllowed } from './chunk-UXYLWVTQ.js';
|
|
14
|
+
import { parseDuKilobytes } from './chunk-7RQ73DLO.js';
|
|
15
|
+
import { RELAY_PORT, CHECKOUT_DIR, JOB_MOUNT, claudeCredential, buildEnvironment, startBuildServices, checkEnvironment, AGENT_CREDENTIAL_MISSING } from './chunk-OD2VTIHN.js';
|
|
13
16
|
import { defaultGitRunner, materializeContext } from './chunk-5FWNEQNZ.js';
|
|
14
17
|
import { readContextManifest, readSourceCache } from './chunk-ZZXLM64C.js';
|
|
15
18
|
import { signingFetchFor } from './chunk-BCLJSQCV.js';
|
|
16
19
|
import { signerFor } from './chunk-M5POMKKW.js';
|
|
17
|
-
import { rootfsPathFor, diskTemplatesDir, RUNNER_FILE_MODE, stagedContextDir, contextHomeDir, ghConfigDir, runnerDirOfBuild, spoolDir, mirrorDir, buildDir,
|
|
18
|
-
import { relative, join, dirname,
|
|
19
|
-
import { readFileSync, existsSync, mkdirSync, chmodSync, truncateSync, rmSync, writeFileSync, accessSync, constants, readdirSync, statSync, rmdirSync,
|
|
20
|
+
import { rootfsPathFor, diskTemplatesDir, RUNNER_FILE_MODE, stagedContextDir, contextHomeDir, ghConfigDir, runnerDirOfBuild, spoolDir, mirrorDir, buildDir, RUNNER_DIR_MODE, vmAssetsDir } from './chunk-ZM2IMMYN.js';
|
|
21
|
+
import { relative, join, dirname, basename } from 'path';
|
|
22
|
+
import { readFileSync, existsSync, mkdirSync, chmodSync, truncateSync, rmSync, writeFileSync, accessSync, constants, readdirSync, statSync, rmdirSync, renameSync, lstatSync, unlinkSync, openSync, closeSync, mkdtempSync, createWriteStream, createReadStream } from 'fs';
|
|
20
23
|
import { spawnSync, spawn } from 'child_process';
|
|
21
|
-
import {
|
|
24
|
+
import { randomBytes, createHash } from 'crypto';
|
|
22
25
|
import { createServer, request } from 'http';
|
|
23
26
|
import { request as request$1 } from 'https';
|
|
24
27
|
import { Transform } from 'stream';
|
|
@@ -86,7 +89,7 @@ function isRetryable(err) {
|
|
|
86
89
|
}
|
|
87
90
|
async function retrySend(send, deps = {}) {
|
|
88
91
|
const now = deps.now ?? (() => /* @__PURE__ */ new Date());
|
|
89
|
-
const sleep = deps.sleep ?? ((ms) => new Promise((
|
|
92
|
+
const sleep = deps.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
90
93
|
const windowMs = deps.windowMs ?? RETRY_WINDOW_MS;
|
|
91
94
|
const startedMs = now().getTime();
|
|
92
95
|
let attempts = 0;
|
|
@@ -466,119 +469,6 @@ function lifecycleSteps(lifecycle) {
|
|
|
466
469
|
function lifecycleFailureReason(step, exitCode) {
|
|
467
470
|
return `lifecycle command ${step.name} (${step.source}) exited ${exitCode}`;
|
|
468
471
|
}
|
|
469
|
-
var BUILD_LABEL = "ai.outerlayer.build";
|
|
470
|
-
var RUNNER_LABEL = "ai.outerlayer.runner";
|
|
471
|
-
function resolvedRunnerDir(configPath) {
|
|
472
|
-
try {
|
|
473
|
-
return realpathSync(runnerDir(configPath));
|
|
474
|
-
} catch {
|
|
475
|
-
try {
|
|
476
|
-
return join(realpathSync(dirname(resolve(configPath))), "runner");
|
|
477
|
-
} catch {
|
|
478
|
-
return resolve(runnerDir(configPath));
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
function runnerLabelValue(configPath) {
|
|
483
|
-
return createHash("sha256").update(resolvedRunnerDir(configPath)).digest("hex").slice(0, 12);
|
|
484
|
-
}
|
|
485
|
-
function hardened(input) {
|
|
486
|
-
const { memory, cpus, pids } = input.limits;
|
|
487
|
-
return [
|
|
488
|
-
"--label",
|
|
489
|
-
`${BUILD_LABEL}=${input.buildId}`,
|
|
490
|
-
"--label",
|
|
491
|
-
`${RUNNER_LABEL}=${input.runnerId}`,
|
|
492
|
-
"--network",
|
|
493
|
-
"none",
|
|
494
|
-
"--cap-drop",
|
|
495
|
-
"ALL",
|
|
496
|
-
"--security-opt",
|
|
497
|
-
"no-new-privileges",
|
|
498
|
-
"--read-only",
|
|
499
|
-
"--user",
|
|
500
|
-
input.user,
|
|
501
|
-
// The same figure for swap as for memory leaves the container none.
|
|
502
|
-
"--memory",
|
|
503
|
-
memory,
|
|
504
|
-
"--memory-swap",
|
|
505
|
-
memory,
|
|
506
|
-
"--cpus",
|
|
507
|
-
String(cpus),
|
|
508
|
-
"--pids-limit",
|
|
509
|
-
String(pids)
|
|
510
|
-
];
|
|
511
|
-
}
|
|
512
|
-
function mountPath(path) {
|
|
513
|
-
if (/[",]/.test(path)) throw new Error(`${path} holds a comma or a quote, which a Docker mount cannot carry; move the runner's config file`);
|
|
514
|
-
return path;
|
|
515
|
-
}
|
|
516
|
-
function containerRunArgs(input) {
|
|
517
|
-
return [
|
|
518
|
-
"--detach",
|
|
519
|
-
"--name",
|
|
520
|
-
input.container,
|
|
521
|
-
...hardened(input),
|
|
522
|
-
"--mount",
|
|
523
|
-
`type=volume,src=${input.volume},dst=/build`,
|
|
524
|
-
// `/tmp` is a directory of the same volume, so it is measured and limited with the rest of the build.
|
|
525
|
-
"--mount",
|
|
526
|
-
`type=volume,src=${input.volume},dst=/tmp,volume-subpath=tmp`,
|
|
527
|
-
"--mount",
|
|
528
|
-
`type=bind,src=${mountPath(input.buildDir)},dst=${JOB_MOUNT},readonly`,
|
|
529
|
-
"--entrypoint",
|
|
530
|
-
"/opt/outerlayer/bin/tini",
|
|
531
|
-
input.image,
|
|
532
|
-
"--",
|
|
533
|
-
"/opt/outerlayer/bin/node",
|
|
534
|
-
"/opt/outerlayer/cli/dist/index.js",
|
|
535
|
-
"broker-relay",
|
|
536
|
-
"--port",
|
|
537
|
-
String(RELAY_PORT),
|
|
538
|
-
"--socket",
|
|
539
|
-
`${JOB_MOUNT}/tunnel.sock`,
|
|
540
|
-
...Array.from({ length: input.destinations ?? 0 }, (_unused, index) => [
|
|
541
|
-
"--forward",
|
|
542
|
-
`${DESTINATION_BASE_PORT + index}=${JOB_MOUNT}/dest-${index}.sock`
|
|
543
|
-
]).flat(),
|
|
544
|
-
...input.builtIns === true ? [
|
|
545
|
-
"--forward",
|
|
546
|
-
`${GATEWAY_PORT}=${JOB_MOUNT}/${GATEWAY_SOCKET}`,
|
|
547
|
-
"--forward",
|
|
548
|
-
`${CLAUDE_PORT}=${JOB_MOUNT}/${CLAUDE_SOCKET}`
|
|
549
|
-
] : []
|
|
550
|
-
];
|
|
551
|
-
}
|
|
552
|
-
function prepareRunArgs(input) {
|
|
553
|
-
return [
|
|
554
|
-
"--rm",
|
|
555
|
-
...hardened(input),
|
|
556
|
-
"--mount",
|
|
557
|
-
`type=volume,src=${input.volume},dst=/build`,
|
|
558
|
-
"--entrypoint",
|
|
559
|
-
"mkdir",
|
|
560
|
-
input.image,
|
|
561
|
-
"-p",
|
|
562
|
-
"-m",
|
|
563
|
-
"1777",
|
|
564
|
-
"/build/tmp",
|
|
565
|
-
"/build/home",
|
|
566
|
-
"/build/work"
|
|
567
|
-
];
|
|
568
|
-
}
|
|
569
|
-
function containerExecArgs(input) {
|
|
570
|
-
const literals = Object.keys(input.env.literals).sort().flatMap((name) => ["-e", `${name}=${input.env.literals[name]}`]);
|
|
571
|
-
const passed = Object.keys(input.env.passed).filter((name) => input.env.passed[name] !== void 0).sort().flatMap((name) => ["-e", name]);
|
|
572
|
-
return [
|
|
573
|
-
"-u",
|
|
574
|
-
input.user,
|
|
575
|
-
...input.workdir === void 0 ? [] : ["-w", input.workdir],
|
|
576
|
-
...literals,
|
|
577
|
-
...passed,
|
|
578
|
-
input.container,
|
|
579
|
-
...input.argv
|
|
580
|
-
];
|
|
581
|
-
}
|
|
582
472
|
var AssetError = class extends Error {
|
|
583
473
|
constructor(file, message) {
|
|
584
474
|
super(message);
|
|
@@ -719,7 +609,7 @@ function converterArgs(dest, extra, script) {
|
|
|
719
609
|
}
|
|
720
610
|
var firstLine2 = (text) => text.trim().split("\n")[0] ?? "";
|
|
721
611
|
function exportInto(container, converter) {
|
|
722
|
-
return new Promise((
|
|
612
|
+
return new Promise((resolve, reject) => {
|
|
723
613
|
const exporter = spawn("docker", ["export", container], { stdio: ["ignore", "pipe", "pipe"], env: childEnvironment(process.env) });
|
|
724
614
|
const writer = spawn("docker", converter, { stdio: ["pipe", "ignore", "pipe"], env: childEnvironment(process.env) });
|
|
725
615
|
const errors = [];
|
|
@@ -736,7 +626,7 @@ function exportInto(container, converter) {
|
|
|
736
626
|
if (code !== 0 && failure === void 0) failure = `${name} exited ${code}`;
|
|
737
627
|
exits += 1;
|
|
738
628
|
if (exits < 2) return;
|
|
739
|
-
if (failure === void 0)
|
|
629
|
+
if (failure === void 0) resolve();
|
|
740
630
|
else reject(new Error(`${failure}: ${firstLine2(errors.join("\n"))}`));
|
|
741
631
|
};
|
|
742
632
|
exporter.once("exit", (code) => done("docker export", code));
|
|
@@ -885,7 +775,7 @@ function createFirecrackerHost(options = {}) {
|
|
|
885
775
|
const failed = new Promise((_resolve, reject) => child.once("error", reject));
|
|
886
776
|
const pid = child.pid;
|
|
887
777
|
if (pid === void 0) return await failed;
|
|
888
|
-
exits.set(pid, new Promise((
|
|
778
|
+
exits.set(pid, new Promise((resolve) => child.once("exit", () => resolve())));
|
|
889
779
|
child.unref();
|
|
890
780
|
const start = startTimeOf(pid);
|
|
891
781
|
if (start === null) throw new Error(`${command} exited as soon as it started; its console is at ${input.consolePath}`);
|
|
@@ -902,8 +792,8 @@ function createFirecrackerHost(options = {}) {
|
|
|
902
792
|
}
|
|
903
793
|
const exited = exits.get(vm.pid);
|
|
904
794
|
const deadline = Date.now() + STOP_WAIT_MS;
|
|
905
|
-
if (exited !== void 0) await Promise.race([exited, new Promise((
|
|
906
|
-
while (alive(vm) && Date.now() < deadline) await new Promise((
|
|
795
|
+
if (exited !== void 0) await Promise.race([exited, new Promise((resolve) => setTimeout(resolve, STOP_WAIT_MS))]);
|
|
796
|
+
while (alive(vm) && Date.now() < deadline) await new Promise((resolve) => setTimeout(resolve, POLL_MS));
|
|
907
797
|
exits.delete(vm.pid);
|
|
908
798
|
},
|
|
909
799
|
alive
|
|
@@ -913,7 +803,7 @@ function createFirecrackerHost(options = {}) {
|
|
|
913
803
|
// src/runner/microvm/host.ts
|
|
914
804
|
function createMicroVmPorts(over = {}) {
|
|
915
805
|
return {
|
|
916
|
-
assets: over.assets ?? ((
|
|
806
|
+
assets: over.assets ?? ((runnerDir) => ensureAssets({ runnerDir })),
|
|
917
807
|
rootfs: over.rootfs ?? createRootfsHost(),
|
|
918
808
|
firecracker: over.firecracker ?? createFirecrackerHost(),
|
|
919
809
|
cgroup: over.cgroup ?? realCgroupPort(),
|
|
@@ -926,6 +816,10 @@ var aborted = () => ({ ok: false, reason: "", aborted: true });
|
|
|
926
816
|
function firstLine3(text) {
|
|
927
817
|
return text.trim().split("\n")[0] ?? "";
|
|
928
818
|
}
|
|
819
|
+
function gitErrorLine(text) {
|
|
820
|
+
const lines = text.split("\n").map((line) => line.trim()).filter((line) => line !== "");
|
|
821
|
+
return lines.find((line) => /^(fatal|error):/.test(line)) ?? lines.at(-1) ?? "";
|
|
822
|
+
}
|
|
929
823
|
function adoptionFailureReason(result) {
|
|
930
824
|
const line = result.stdout.trim().split("\n").at(-1) ?? "";
|
|
931
825
|
try {
|
|
@@ -940,7 +834,10 @@ async function runBuildSteps(input) {
|
|
|
940
834
|
const rewrite = await exec(["git", "config", "--global", `url.http://127.0.0.1:${RELAY_PORT}/github.com/.insteadOf`, "https://github.com/"], "/build/work");
|
|
941
835
|
if (rewrite.status !== 0) return { ok: false, reason: `configuring the build's git remote failed (exit ${rewrite.status})` };
|
|
942
836
|
const clone = await exec(["git", "clone", "--filter=blob:none", "--single-branch", `https://github.com/${repository}.git`, CHECKOUT_DIR], "/build/work");
|
|
943
|
-
if (clone.status !== 0)
|
|
837
|
+
if (clone.status !== 0) {
|
|
838
|
+
const detail = gitErrorLine(clone.stderr);
|
|
839
|
+
return { ok: false, reason: `the clone of ${repository} failed (exit ${clone.status})${detail === "" ? "" : `: ${detail}`}` };
|
|
840
|
+
}
|
|
944
841
|
try {
|
|
945
842
|
const prepared = await prepareBranch({
|
|
946
843
|
workdir: CHECKOUT_DIR,
|
|
@@ -1155,9 +1052,9 @@ async function git(args, cwd, env, input) {
|
|
|
1155
1052
|
if (size < maxOutputBytes) out.push(chunk);
|
|
1156
1053
|
size += chunk.length;
|
|
1157
1054
|
});
|
|
1158
|
-
const closed = new Promise((
|
|
1055
|
+
const closed = new Promise((resolve, reject) => {
|
|
1159
1056
|
child.once("error", reject);
|
|
1160
|
-
child.once("close", (status) =>
|
|
1057
|
+
child.once("close", (status) => resolve(status));
|
|
1161
1058
|
});
|
|
1162
1059
|
if (input !== void 0) {
|
|
1163
1060
|
await pipeline(input, child.stdin).catch(() => void 0);
|
|
@@ -1354,14 +1251,14 @@ async function drain(req) {
|
|
|
1354
1251
|
}
|
|
1355
1252
|
}
|
|
1356
1253
|
function readPrefix(req, gzip) {
|
|
1357
|
-
return new Promise((
|
|
1254
|
+
return new Promise((resolve, reject) => {
|
|
1358
1255
|
const held = [];
|
|
1359
1256
|
const finish = (section) => {
|
|
1360
1257
|
req.off("data", onData);
|
|
1361
1258
|
req.off("end", onEnd);
|
|
1362
1259
|
req.off("error", reject);
|
|
1363
1260
|
req.pause();
|
|
1364
|
-
|
|
1261
|
+
resolve({ held, section });
|
|
1365
1262
|
};
|
|
1366
1263
|
const onData = (chunk) => {
|
|
1367
1264
|
held.push(chunk);
|
|
@@ -1375,19 +1272,19 @@ function readPrefix(req, gzip) {
|
|
|
1375
1272
|
});
|
|
1376
1273
|
}
|
|
1377
1274
|
function readBody(req, limit) {
|
|
1378
|
-
return new Promise((
|
|
1275
|
+
return new Promise((resolve, reject) => {
|
|
1379
1276
|
const chunks = [];
|
|
1380
1277
|
let size = 0;
|
|
1381
1278
|
req.on("data", (chunk) => {
|
|
1382
1279
|
size += chunk.length;
|
|
1383
1280
|
if (size > limit) {
|
|
1384
1281
|
req.pause();
|
|
1385
|
-
|
|
1282
|
+
resolve(void 0);
|
|
1386
1283
|
return;
|
|
1387
1284
|
}
|
|
1388
1285
|
chunks.push(chunk);
|
|
1389
1286
|
});
|
|
1390
|
-
req.once("end", () =>
|
|
1287
|
+
req.once("end", () => resolve(Buffer.concat(chunks)));
|
|
1391
1288
|
req.once("error", reject);
|
|
1392
1289
|
});
|
|
1393
1290
|
}
|
|
@@ -1400,7 +1297,7 @@ function createGitRemote(options) {
|
|
|
1400
1297
|
const { route, res } = input;
|
|
1401
1298
|
const url = new URL(`${gitUrl}/${route.owner}/${route.name}.git/${route.kind === "info-refs" ? "info/refs" : route.kind === "lfs-batch" ? "info/lfs/objects/batch" : `git-${route.kind}`}${route.search === "" ? "" : `?${route.search}`}`);
|
|
1402
1299
|
const send = url.protocol === "https:" ? request$1 : request;
|
|
1403
|
-
return new Promise((
|
|
1300
|
+
return new Promise((resolve) => {
|
|
1404
1301
|
const upstream = send(url, { method: input.method, headers: { ...input.headers, connection: "close" } }, (answer) => {
|
|
1405
1302
|
const headers = {};
|
|
1406
1303
|
for (const [name, value] of Object.entries(answer.headers)) {
|
|
@@ -1422,18 +1319,18 @@ function createGitRemote(options) {
|
|
|
1422
1319
|
});
|
|
1423
1320
|
answer.once("end", () => {
|
|
1424
1321
|
res.end();
|
|
1425
|
-
|
|
1322
|
+
resolve();
|
|
1426
1323
|
});
|
|
1427
1324
|
answer.once("error", () => {
|
|
1428
1325
|
res.destroy();
|
|
1429
|
-
|
|
1326
|
+
resolve();
|
|
1430
1327
|
});
|
|
1431
1328
|
});
|
|
1432
1329
|
upstream.on("error", (err) => {
|
|
1433
1330
|
log(`could not reach GitHub for ${route.kind}: ${err.message}`);
|
|
1434
1331
|
if (res.headersSent) res.destroy();
|
|
1435
1332
|
else plain(res, 502, "the runner could not reach GitHub\n");
|
|
1436
|
-
|
|
1333
|
+
resolve();
|
|
1437
1334
|
});
|
|
1438
1335
|
res.once("close", () => upstream.destroy());
|
|
1439
1336
|
input.feed(upstream);
|
|
@@ -1728,7 +1625,7 @@ async function startTunnel(socketPath, opts = {}) {
|
|
|
1728
1625
|
if (Buffer.byteLength(socketPath) > MAX_SOCKET_PATH_BYTES) {
|
|
1729
1626
|
throw new Error(`${socketPath} is too long for a Unix socket; keep the runner's config file nearer the root of the filesystem`);
|
|
1730
1627
|
}
|
|
1731
|
-
const
|
|
1628
|
+
const resolve = opts.resolve ?? systemResolve;
|
|
1732
1629
|
const openConnection = opts.connect ?? ((t) => connect({ host: t.address, port: t.port }));
|
|
1733
1630
|
const ownAddresses = opts.hostAddresses ?? systemHostAddresses;
|
|
1734
1631
|
const connectTimeoutMs = opts.connectTimeoutMs ?? CONNECT_TIMEOUT_MS;
|
|
@@ -1812,7 +1709,7 @@ async function startTunnel(socketPath, opts = {}) {
|
|
|
1812
1709
|
}
|
|
1813
1710
|
let addresses;
|
|
1814
1711
|
try {
|
|
1815
|
-
addresses = await
|
|
1712
|
+
addresses = await resolve(host);
|
|
1816
1713
|
} catch {
|
|
1817
1714
|
return { ok: false, status: 502, body: `could not resolve ${host}
|
|
1818
1715
|
` };
|
|
@@ -1991,13 +1888,14 @@ function createContainerRuntime(opts = {}) {
|
|
|
1991
1888
|
configPath: build.configPath,
|
|
1992
1889
|
cli: cli ?? currentCliBuild(),
|
|
1993
1890
|
readToken: build.readToken,
|
|
1994
|
-
guestHelper: build.guestHelper
|
|
1891
|
+
guestHelper: build.guestHelper,
|
|
1892
|
+
log: build.log
|
|
1995
1893
|
},
|
|
1996
|
-
{ host: opts.imageHost ?? createDockerHost() }
|
|
1894
|
+
{ host: opts.imageHost ?? createDockerHost({ builder: builderSpec(build.configPath, build.buildMemory, opts.hostEnv ?? process.env) }) }
|
|
1997
1895
|
)),
|
|
1998
1896
|
startTunnel: opts.startTunnel ?? startTunnel,
|
|
1999
1897
|
tunnelOptions: opts.tunnelOptions,
|
|
2000
|
-
sleep: opts.sleep ?? ((ms) => new Promise((
|
|
1898
|
+
sleep: opts.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms))),
|
|
2001
1899
|
hostEnv: opts.hostEnv ?? process.env,
|
|
2002
1900
|
credentials: opts.credentials ?? /* @__PURE__ */ new Map(),
|
|
2003
1901
|
github: { gitUrl: opts.github?.gitUrl ?? "https://github.com", apiUrl: opts.github?.apiUrl ?? "https://api.github.com" },
|
|
@@ -2068,7 +1966,17 @@ async function obtainImage(input) {
|
|
|
2068
1966
|
};
|
|
2069
1967
|
}
|
|
2070
1968
|
try {
|
|
2071
|
-
return {
|
|
1969
|
+
return {
|
|
1970
|
+
ok: true,
|
|
1971
|
+
built: await runtime.buildImage({
|
|
1972
|
+
repository,
|
|
1973
|
+
configPath: config.configPath,
|
|
1974
|
+
buildMemory: config.build?.memory ?? "8g",
|
|
1975
|
+
readToken,
|
|
1976
|
+
guestHelper: input.guestHelper,
|
|
1977
|
+
log: (line) => log.line(`${tag} ${line}`)
|
|
1978
|
+
})
|
|
1979
|
+
};
|
|
2072
1980
|
} catch (err) {
|
|
2073
1981
|
if (err instanceof RecipeError && err.code === "build_in_progress" && (input.now?.() ?? /* @__PURE__ */ new Date()).getTime() < input.deadlineMs) {
|
|
2074
1982
|
log.line(`${tag} waiting for another build of ${repository}'s image`);
|
|
@@ -2077,7 +1985,8 @@ async function obtainImage(input) {
|
|
|
2077
1985
|
}
|
|
2078
1986
|
if (err instanceof RecipeError) {
|
|
2079
1987
|
log.error(`${tag} image build for ${repository} failed: ${err.code}: ${err.message}`);
|
|
2080
|
-
|
|
1988
|
+
const says = err.code === "image_build_out_of_memory" || err.code === "image_builder_unavailable";
|
|
1989
|
+
return { ok: false, reason: says ? err.message : err.code };
|
|
2081
1990
|
}
|
|
2082
1991
|
return { ok: false, reason: `the image build failed: ${describeCallFailure(err)}` };
|
|
2083
1992
|
}
|
|
@@ -2474,4 +2383,4 @@ async function startCheckContainer(input) {
|
|
|
2474
2383
|
};
|
|
2475
2384
|
}
|
|
2476
2385
|
|
|
2477
|
-
export { ADDED_USER, AgentUserError, AssetError,
|
|
2386
|
+
export { ADDED_USER, AgentUserError, AssetError, BuildTokens, GH_CONFIG_YML, MIN_ENGINE_MAJOR, classifyRefusal, cleanupContainer, containerCommandLine, containerSenderCommand, createBuildDisk, createContainerRuntime, createRunnerLog, deleteBuildDisk, describeCallFailure, ensureRootfs, ensureTunnel, formatClock, formatDuration, ghHostsYml, gitRemoteFor, isLiteralAddress, keepGhConfigCurrent, lifecycleFailureReason, lifecycleSteps, machineConfig, measureDisk, obtainImage, outOfMemoryReason, prepareBranch, provisionContainer, refusalCode, relativeToRunner, removeStagedContext, resolveAgentUser, retrySend, runBuildSteps, senderSignalScript, setUpRunnerCgroup, shellQuote, shortClaim, signalInContainer, stageGovernedContext, startCheckContainer, startServicesFor, stopContainer, syncInContainer };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
|
|
4
|
+
createRequire(import.meta.url);
|
|
5
|
+
|
|
6
|
+
// src/runner/image/pins.ts
|
|
7
|
+
var CLAUDE_CODE_VERSION = "2.1.284";
|
|
8
|
+
var DEFAULT_BASE_IMAGE = "ubuntu:24.04@sha256:008173c23f95b170204355c12626cb5a965d779a7e1283b09e9cffbb1bf33ca3";
|
|
9
|
+
var NODE_IMAGE = "node:22-bookworm-slim@sha256:43ac6c60b8f89723f746e8a92ce91abd5017e627ce1ddfe4238355d3a30b772c";
|
|
10
|
+
var BUILDKIT_IMAGE = "moby/buildkit:v0.33.1@sha256:cec9f139f45e93c5c69c60f8b07cfad9f43f4ef6b6a6cd917527fea5ff2e3dea";
|
|
11
|
+
var GH_VERSION = "2.101.0";
|
|
12
|
+
var GH_SHA256 = {
|
|
13
|
+
amd64: "9bca2d1c16825f109907a23307628a2f0698fbf99662b73a5cf0b020293072b8",
|
|
14
|
+
arm64: "b57e8063f18862647c9d22727c32e9da1b963f8bf9db648fe123a6975695640f"
|
|
15
|
+
};
|
|
16
|
+
var TINI_VERSION = "0.19.0";
|
|
17
|
+
var TINI_SHA256 = {
|
|
18
|
+
amd64: "c5b0666b4cb676901f90dfcb37106783c5fe2077b04590973b885950611b30ee",
|
|
19
|
+
arm64: "eae1d3aa50c48fb23b8cbdf4e369d0910dfc538566bfd09df89a774aa84a48b9"
|
|
20
|
+
};
|
|
21
|
+
var MICROVM_ARCHES = ["x86_64"];
|
|
22
|
+
function firecrackerArch(nodeArch) {
|
|
23
|
+
return nodeArch === "x64" ? "x86_64" : nodeArch === "arm64" ? "aarch64" : nodeArch;
|
|
24
|
+
}
|
|
25
|
+
var FIRECRACKER_VERSION = "1.13.1";
|
|
26
|
+
var FIRECRACKER_SHA256 = {
|
|
27
|
+
x86_64: "59450b9171ff2ebdf2f9a25be3a248a7ba79fb6371aec51a9d6d8eefca7b4faf"
|
|
28
|
+
};
|
|
29
|
+
var FIRECRACKER_BINARY_SHA256 = {
|
|
30
|
+
x86_64: "7d3924e0c8761edafbf85cb2a94c268ffad249644a40fd02d4e15cde4c206f6e"
|
|
31
|
+
};
|
|
32
|
+
var GUEST_ASSETS_VERSION = "1";
|
|
33
|
+
var GUEST_ASSETS_BASE_URL = `https://github.com/outerlayerai/guest-assets/releases/download/guest-${GUEST_ASSETS_VERSION}`;
|
|
34
|
+
var GUEST_KERNEL_SHA256 = {
|
|
35
|
+
x86_64: "5a2d716d301615c69fefc2f9574954e838269f14d5e8b0d1bad88b680cd372ee"
|
|
36
|
+
};
|
|
37
|
+
var GUEST_HELPER_SHA256 = {
|
|
38
|
+
x86_64: "4175e89ae8cb633113b5f69ef8b6e206093954411fe53edf86357bc1b7e822f9"
|
|
39
|
+
};
|
|
40
|
+
function guestAssetsPinned(arch) {
|
|
41
|
+
const zero = "0".repeat(64);
|
|
42
|
+
return GUEST_KERNEL_SHA256[arch] !== zero && GUEST_HELPER_SHA256[arch] !== zero;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { BUILDKIT_IMAGE, CLAUDE_CODE_VERSION, DEFAULT_BASE_IMAGE, FIRECRACKER_BINARY_SHA256, FIRECRACKER_SHA256, FIRECRACKER_VERSION, GH_SHA256, GH_VERSION, GUEST_ASSETS_BASE_URL, GUEST_ASSETS_VERSION, GUEST_HELPER_SHA256, GUEST_KERNEL_SHA256, MICROVM_ARCHES, NODE_IMAGE, TINI_SHA256, TINI_VERSION, firecrackerArch, guestAssetsPinned };
|
|
@@ -21970,14 +21970,14 @@ var ModelRegistryImpl = class {
|
|
|
21970
21970
|
};
|
|
21971
21971
|
var models_default = {
|
|
21972
21972
|
version: "1.0.0",
|
|
21973
|
-
generatedAt: "2026-10-
|
|
21973
|
+
generatedAt: "2026-10-05T04:49:52.578Z",
|
|
21974
21974
|
sources: {
|
|
21975
21975
|
litellm: {
|
|
21976
|
-
fetchedAt: "2026-10-
|
|
21976
|
+
fetchedAt: "2026-10-05T04:49:52.578Z",
|
|
21977
21977
|
modelCount: 1887
|
|
21978
21978
|
},
|
|
21979
21979
|
openrouter: {
|
|
21980
|
-
fetchedAt: "2026-10-
|
|
21980
|
+
fetchedAt: "2026-10-05T04:49:52.578Z",
|
|
21981
21981
|
modelCount: 198
|
|
21982
21982
|
}
|
|
21983
21983
|
},
|
|
@@ -43490,12 +43490,12 @@ var models_default = {
|
|
|
43490
43490
|
"top_p"
|
|
43491
43491
|
],
|
|
43492
43492
|
pricing: {
|
|
43493
|
-
inputCostPerToken:
|
|
43494
|
-
outputCostPerToken:
|
|
43493
|
+
inputCostPerToken: 29e-8,
|
|
43494
|
+
outputCostPerToken: 114e-8
|
|
43495
43495
|
},
|
|
43496
43496
|
context: {
|
|
43497
43497
|
maxInputTokens: 163840,
|
|
43498
|
-
maxOutputTokens:
|
|
43498
|
+
maxOutputTokens: 115200
|
|
43499
43499
|
},
|
|
43500
43500
|
capabilities: {
|
|
43501
43501
|
functionCalling: true,
|
|
@@ -52756,8 +52756,8 @@ var models_default = {
|
|
|
52756
52756
|
"max_tokens"
|
|
52757
52757
|
],
|
|
52758
52758
|
pricing: {
|
|
52759
|
-
inputCostPerToken:
|
|
52760
|
-
outputCostPerToken:
|
|
52759
|
+
inputCostPerToken: 2e-6,
|
|
52760
|
+
outputCostPerToken: 1e-5
|
|
52761
52761
|
},
|
|
52762
52762
|
context: {
|
|
52763
52763
|
maxInputTokens: 105e4,
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
3
|
import { fetchVersionMeta, npmVersion, npmSupportsProvenance, fetchTarballDigest, fetchProvenance, installVersion, auditSignatures } from './chunk-ABIWDUMS.js';
|
|
4
|
-
import {
|
|
5
|
-
import { LEASE_SECONDS, releaseLease, isUnfinished, setStage, jobEnv, runHook, describeHookEnd, provisionMicroVm, deliverCommitHooks, provisionProcess, provisionEnvironment, readProvisionOut, resolveHostBuild, workdirProblem, listenOnBroker, hostEnvironment, hostCommandEnvironment, execArgv, microVmCommandLine, runCommand, execCommandLine, startSender, startHostServices, finishJob, isGroupAlive, outcomeFromExitCode, isTimedOut, readCpuUsec, isIdle, stopOrphanedMicroVms, unfinishedJobs, listAdoptableJobs, retryFailedReleases, recoverLostJobs, hookLimitsFor, needsRenew, renewLease, RENEW_INTERVAL_SECONDS, ALREADY_RELEASED } from './chunk-AJKEHABI.js';
|
|
4
|
+
import { LEASE_SECONDS, releaseLease, isUnfinished, setStage, jobEnv, runHook, describeHookEnd, provisionMicroVm, deliverCommitHooks, provisionProcess, provisionEnvironment, readProvisionOut, resolveHostBuild, workdirProblem, listenOnBroker, hostEnvironment, hostCommandEnvironment, execArgv, microVmCommandLine, runCommand, execCommandLine, startSender, startHostServices, finishJob, isGroupAlive, outcomeFromExitCode, isTimedOut, readCpuUsec, isIdle, stopOrphanedMicroVms, unfinishedJobs, listAdoptableJobs, retryFailedReleases, recoverLostJobs, hookLimitsFor, needsRenew, renewLease, RENEW_INTERVAL_SECONDS, ALREADY_RELEASED } from './chunk-7VNURP6M.js';
|
|
6
5
|
import { writeJobFile, readJobFile, readJobFileChecked } from './chunk-T6OIJQRT.js';
|
|
7
6
|
import { RUNNER_PROTOCOL } from './chunk-AIW6GLET.js';
|
|
8
7
|
import { readHousekeepingRecord, writeHousekeepingRecord } from './chunk-UGP76IZ5.js';
|
|
9
|
-
import { placeholderQueues, placeholderProblem } from './chunk-
|
|
8
|
+
import { placeholderQueues, placeholderProblem } from './chunk-IRCBTGWF.js';
|
|
9
|
+
import { readMarker, currentVersion, removeMarker, writeMarker, entryIn, versionDir, switchCurrent, cleanVersions, isInLayout, startedThroughCurrent, stagingDir } from './chunk-TI7B7UEO.js';
|
|
10
10
|
import { freeBytes, formatBytes } from './chunk-YYYRBYWG.js';
|
|
11
11
|
import { RepoFilter } from './chunk-TBT347UY.js';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
12
|
+
import { describeCallFailure, retrySend, shortClaim, relativeToRunner, formatDuration, provisionContainer, lifecycleSteps, lifecycleFailureReason, prepareBranch, containerCommandLine, BuildTokens, classifyRefusal, refusalCode, measureDisk, createRunnerLog, setUpRunnerCgroup, ensureTunnel, keepGhConfigCurrent, createContainerRuntime, formatClock } from './chunk-CM5QTKM4.js';
|
|
13
|
+
import { checkFit } from './chunk-JKIWMRFH.js';
|
|
14
14
|
import { startTimeOf, claimPidFile, readPidFile, isSameProcess, releasePidFile } from './chunk-N5FOE5PS.js';
|
|
15
|
-
import { spawnRun } from './chunk-
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
15
|
+
import { spawnRun } from './chunk-U3GOI2B4.js';
|
|
16
|
+
import { builderName, runnerLabelValue, ensureFailureCount, builderSpec, ensureBuilder, BUILD_LABEL, RUNNER_LABEL } from './chunk-5TNS3PL7.js';
|
|
17
|
+
import { isSignatureRefusal, WorkCommandError, getJson, postJson } from './chunk-5QLNZGAQ.js';
|
|
18
|
+
import { isBuiltinContainer, isBuiltinVm, isBuiltinProcess, loadRunnerConfig, checkHooks, builtinKind } from './chunk-PWBILI5P.js';
|
|
19
|
+
import { exceedsDisk } from './chunk-7RQ73DLO.js';
|
|
19
20
|
import { sharedUserEnvironment, JOB_MOUNT, claudeCredential } from './chunk-OD2VTIHN.js';
|
|
20
21
|
import { parseClaimIdentity } from './chunk-HKMPVPO7.js';
|
|
21
22
|
import { resolveVersion } from './chunk-RA3O54FC.js';
|
|
@@ -37,7 +38,7 @@ function openKvm() {
|
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
function realBlockedProbes() {
|
|
40
|
-
return { env: process.env, kvm: openKvm, totalMemoryBytes: totalmem };
|
|
41
|
+
return { env: process.env, kvm: openKvm, totalMemoryBytes: totalmem, imageBuilder: "unknown" };
|
|
41
42
|
}
|
|
42
43
|
var DEFAULT_BUILD_MEMORY = "8g";
|
|
43
44
|
function checkBlocked(config, probes) {
|
|
@@ -61,6 +62,13 @@ function checkBlocked(config, probes) {
|
|
|
61
62
|
reason: "the runner cannot open /dev/kvm, so builtin:vm cannot start a microVM. Add the runner's account to the kvm group, then restart the service, because a service reads its groups only when it starts"
|
|
62
63
|
};
|
|
63
64
|
}
|
|
65
|
+
if (kind === "container" || kind === "vm") {
|
|
66
|
+
const builder = probes.imageBuilder;
|
|
67
|
+
if (builder === "unknown") {
|
|
68
|
+
return { reason: "the runner is still preparing its image builder, the container that limits image builds to runner.build.memory, so it claims nothing yet" };
|
|
69
|
+
}
|
|
70
|
+
if (builder !== "usable") return { reason: `${builder.problem}. The runner takes work again once its image builder works` };
|
|
71
|
+
}
|
|
64
72
|
if (kind !== "own" && claudeCredential(probes.env) === void 0) {
|
|
65
73
|
return {
|
|
66
74
|
reason: "there is no Claude credential in the runner's environment. Put CLAUDE_CODE_OAUTH_TOKEN (from `claude setup-token`) or ANTHROPIC_API_KEY in the runner.env beside the config, then restart the service"
|
|
@@ -671,8 +679,9 @@ function createHousekeepingDocker(deps) {
|
|
|
671
679
|
if (result.status !== 0) throw failure(result, `docker rmi ${id}`);
|
|
672
680
|
},
|
|
673
681
|
async builderPrune(keepBytes) {
|
|
674
|
-
const result = await run("docker", ["
|
|
675
|
-
if (result.status !== 0
|
|
682
|
+
const result = await run("docker", ["buildx", "prune", "--builder", deps.builder, "--force", "--max-used-space", String(keepBytes)]);
|
|
683
|
+
if (result.status !== 0 && /no builder .* found/i.test(result.stderr)) return { freedBytes: 0 };
|
|
684
|
+
if (result.status !== 0) throw failure(result, "docker buildx prune");
|
|
676
685
|
return { freedBytes: parsePrunedBytes(result.stdout) };
|
|
677
686
|
}
|
|
678
687
|
};
|
|
@@ -843,7 +852,7 @@ async function runHousekeeping(options) {
|
|
|
843
852
|
try {
|
|
844
853
|
const pruned = await docker.builderPrune(options.buildCacheMax);
|
|
845
854
|
freed += pruned.freedBytes;
|
|
846
|
-
log.line(`housekeeping: pruned the build cache down to ${formatBytes(options.buildCacheMax)}, freed ${formatBytes(pruned.freedBytes)}`);
|
|
855
|
+
log.line(`housekeeping: pruned the image builder's build cache down to ${formatBytes(options.buildCacheMax)}, freed ${formatBytes(pruned.freedBytes)}`);
|
|
847
856
|
} catch (err) {
|
|
848
857
|
log.error(`housekeeping: the build cache could not be pruned: ${describeCallFailure(err)}`);
|
|
849
858
|
}
|
|
@@ -1137,10 +1146,39 @@ async function tick(state) {
|
|
|
1137
1146
|
}
|
|
1138
1147
|
await sendTickHeartbeat(state, state.lastWorkRequest);
|
|
1139
1148
|
}
|
|
1149
|
+
function imageBuilderState(state) {
|
|
1150
|
+
const kind = builtinKind(state.config.hooks.provision);
|
|
1151
|
+
if (kind !== "container" && kind !== "vm") return "usable";
|
|
1152
|
+
if (state.deps.container?.buildImage !== void 0 || state.deps.container?.imageHost !== void 0) return "usable";
|
|
1153
|
+
const memory = state.config.build?.memory ?? "8g";
|
|
1154
|
+
let probe = state.imageBuilder;
|
|
1155
|
+
if (probe === void 0 || probe.memory !== memory) probe = state.imageBuilder = { memory, at: 0, running: false };
|
|
1156
|
+
if (probe.result?.ok === true && !probe.running && probe.failures !== void 0 && ensureFailureCount() !== probe.failures) probe.result = void 0;
|
|
1157
|
+
const nowMs = nowOf(state).getTime();
|
|
1158
|
+
const recheckMs = 10 * 6e4;
|
|
1159
|
+
const due = !probe.running && (probe.result === void 0 || !probe.result.ok || nowMs - probe.at >= recheckMs);
|
|
1160
|
+
if (due) {
|
|
1161
|
+
const checking = probe;
|
|
1162
|
+
checking.running = true;
|
|
1163
|
+
const spec = builderSpec(state.config.configPath, memory, state.deps.container?.hostEnv ?? process.env);
|
|
1164
|
+
const check = state.deps.builderProbe ?? ((s) => ensureBuilder(spawnRun, s, { bootstrap: true }));
|
|
1165
|
+
void check(spec).catch((err) => ({ ok: false, problem: `the image builder could not be checked: ${describeCallFailure(err)}` })).then((result2) => {
|
|
1166
|
+
checking.result = result2;
|
|
1167
|
+
checking.failures = ensureFailureCount();
|
|
1168
|
+
checking.at = nowOf(state).getTime();
|
|
1169
|
+
checking.running = false;
|
|
1170
|
+
if (result2.ok && state.blocked !== void 0 && state.pollTimerSeconds !== void 0) void tick(state);
|
|
1171
|
+
});
|
|
1172
|
+
}
|
|
1173
|
+
const result = probe.result;
|
|
1174
|
+
if (result === void 0) return "unknown";
|
|
1175
|
+
return result.ok ? "usable" : { problem: result.problem };
|
|
1176
|
+
}
|
|
1140
1177
|
function holdWhenBlocked(state) {
|
|
1141
1178
|
const probes = {
|
|
1142
1179
|
...realBlockedProbes(),
|
|
1143
1180
|
...state.deps.container?.hostEnv === void 0 ? {} : { env: state.deps.container.hostEnv },
|
|
1181
|
+
...state.deps.blocked?.imageBuilder === void 0 ? { imageBuilder: imageBuilderState(state) } : {},
|
|
1144
1182
|
...state.deps.blocked
|
|
1145
1183
|
};
|
|
1146
1184
|
const blocked = checkBlocked(state.config, probes);
|
|
@@ -1194,7 +1232,7 @@ async function housekeepingPass(state) {
|
|
|
1194
1232
|
state.housekeepingRunning = true;
|
|
1195
1233
|
try {
|
|
1196
1234
|
state.deps.housekeeping ??= {};
|
|
1197
|
-
state.deps.housekeeping.docker ??= createHousekeepingDocker({ runnerId: runnerLabelValue(state.config.configPath) });
|
|
1235
|
+
state.deps.housekeeping.docker ??= createHousekeepingDocker({ runnerId: runnerLabelValue(state.config.configPath), builder: builderName(state.config.configPath) });
|
|
1198
1236
|
const result = await runHousekeeping({
|
|
1199
1237
|
configPath: state.config.configPath,
|
|
1200
1238
|
keepDays: config.jobsKeepDays,
|
|
@@ -1268,7 +1306,7 @@ var CLAIM_REFUSAL_CODES = new Set(
|
|
|
1268
1306
|
"pull_request_from_fork pull_request_on_default_branch pull_request_ambiguous branch_claimed_elsewhere".split(" ")
|
|
1269
1307
|
);
|
|
1270
1308
|
async function tryClaimAndStart(state, item, queue) {
|
|
1271
|
-
const { postJson: postJson2 } = await import('./work-cmd-
|
|
1309
|
+
const { postJson: postJson2 } = await import('./work-cmd-B3FOXZAL.js');
|
|
1272
1310
|
const log = logOf(state);
|
|
1273
1311
|
const hostKey = await loadHostKey(state.config.configPath);
|
|
1274
1312
|
const claim = await retrySend(
|
|
@@ -1992,7 +2030,7 @@ async function start(configPath, deps = { fetchImpl: fetch }) {
|
|
|
1992
2030
|
const outcome = await onStartUnderMarker({
|
|
1993
2031
|
configPath,
|
|
1994
2032
|
own: ownVersionOf(deps),
|
|
1995
|
-
check: update.check ? () => update.check(configPath) : async () => (await import('./check-
|
|
2033
|
+
check: update.check ? () => update.check(configPath) : async () => (await import('./check-FOF3PUKI.js')).runRunnerCheck(configPath, { fetchImpl: deps.fetchImpl }),
|
|
1996
2034
|
now: () => (deps.now ?? (() => /* @__PURE__ */ new Date()))().getTime(),
|
|
1997
2035
|
log
|
|
1998
2036
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
3
|
import { sanitizeTerminal } from './chunk-ZYHKJKSU.js';
|
|
4
|
-
import { remoteLookupFailed } from './chunk-
|
|
4
|
+
import { remoteLookupFailed } from './chunk-GAYWY4GI.js';
|
|
5
5
|
import { DEFAULT_DASHBOARD } from './chunk-USO2DKBD.js';
|
|
6
6
|
import { resolveGatewayCredentials } from './chunk-BOLTI6LR.js';
|
|
7
7
|
import { readCloudConfig } from './chunk-EABW6AJQ.js';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { isPlaceholderCommand } from './chunk-
|
|
4
|
-
import { describeCallFailure } from './chunk-
|
|
5
|
-
import { WorkCommandError, getJson } from './chunk-
|
|
3
|
+
import { isPlaceholderCommand } from './chunk-NALVDFIS.js';
|
|
4
|
+
import { describeCallFailure } from './chunk-CM5QTKM4.js';
|
|
5
|
+
import { WorkCommandError, getJson } from './chunk-5QLNZGAQ.js';
|
|
6
6
|
import { sanitizeTerminal } from './chunk-ZYHKJKSU.js';
|
|
7
|
-
import { builtinKind } from './chunk-
|
|
7
|
+
import { builtinKind } from './chunk-PWBILI5P.js';
|
|
8
8
|
import { CLAUDE_CREDENTIAL_VARIABLES, claudeCredential } from './chunk-OD2VTIHN.js';
|
|
9
9
|
import { signerFor } from './chunk-M5POMKKW.js';
|
|
10
10
|
|