@outerlayer/cli 0.34.0-next.20261026145838 → 0.34.0-next.20261026182624
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/README.md +6 -0
- package/dist/{agent-setup-FNDKCPUP.js → agent-setup-WOEZELVB.js} +6 -6
- package/dist/{bridge-YJBB4YA3.js → bridge-F5FBQSPZ.js} +2 -2
- package/dist/{build-ZJK6CPNH.js → build-UDOBVX5J.js} +7 -7
- package/dist/{build-disk-7HS4UF7O.js → build-disk-C3WIAHCL.js} +6 -6
- package/dist/build-info.json +1 -1
- package/dist/{builder-MHZKDI4H.js → builder-YNXWVH2V.js} +5 -5
- package/dist/{check-4W4QUBMP.js → check-G2K76NEM.js} +39 -38
- package/dist/{chunk-2ILU7UAU.js → chunk-3VZTNXK5.js} +1 -1
- package/dist/{chunk-4YFMNF5Y.js → chunk-4J2FF5HZ.js} +3 -3
- package/dist/{chunk-CAQCDYKF.js → chunk-5JGPTYLT.js} +2 -2
- package/dist/chunk-6D7H5DMZ.js +152 -0
- package/dist/{chunk-OGPEHSNW.js → chunk-6KFJIU73.js} +1 -1
- package/dist/{chunk-3EJBI5JW.js → chunk-7FQYTM7M.js} +1 -1
- package/dist/{chunk-3N77LUQI.js → chunk-7QAJQDHS.js} +1 -1
- package/dist/{chunk-SI6WDF3U.js → chunk-CFFVCI2I.js} +1 -1
- package/dist/{chunk-7P3H4RY2.js → chunk-CNZRUVZ5.js} +102 -36
- package/dist/{chunk-WMNPKBX5.js → chunk-ELO5XEES.js} +4 -4
- package/dist/{chunk-PP6OX4OT.js → chunk-EPFFYDNX.js} +5 -5
- package/dist/{chunk-CY5TCVBS.js → chunk-ERTIEYDG.js} +6 -6
- package/dist/{chunk-35JMYSUD.js → chunk-EUQZAH2W.js} +2 -2
- package/dist/{chunk-WHDS6MEG.js → chunk-GHFI5GBF.js} +3 -3
- package/dist/{chunk-PXGU3GKY.js → chunk-GJ4KBHBD.js} +1 -1
- package/dist/chunk-GYVMMU3U.js +321 -0
- package/dist/{chunk-VVOSUGEF.js → chunk-H47VGSCW.js} +4 -4
- package/dist/{chunk-TFPNPS4Q.js → chunk-HOUFCUMH.js} +1 -1
- package/dist/{chunk-7JE2WFNK.js → chunk-HVPW272H.js} +3 -3
- package/dist/{chunk-M3ME6TLQ.js → chunk-HVQMIZ22.js} +4 -4
- package/dist/{chunk-7DXVL7TN.js → chunk-IO2BBKG4.js} +3 -3
- package/dist/{chunk-UONH72CJ.js → chunk-IWVGALDC.js} +2 -2
- package/dist/{chunk-ZP7GKJSM.js → chunk-JC6AQ6PC.js} +39 -6
- package/dist/{chunk-6JZXIWX7.js → chunk-JKNOJKVD.js} +34 -9
- package/dist/{chunk-GEQT3RPN.js → chunk-JSZRBQY3.js} +3 -3
- package/dist/{chunk-MOI2KDLH.js → chunk-L5VHGRQE.js} +1 -1
- package/dist/{chunk-SKVA4KWD.js → chunk-LD3BHLK7.js} +3 -3
- package/dist/{chunk-YNMVVQOQ.js → chunk-LQHCNXPK.js} +1 -1
- package/dist/{chunk-PWSUNS6Y.js → chunk-LTN2YFLR.js} +99 -31
- package/dist/{chunk-YHKU2NOZ.js → chunk-LTYBHCL4.js} +1 -1
- package/dist/{chunk-PAK5P2ND.js → chunk-MH6QLXUO.js} +1 -1
- package/dist/{chunk-OS7DJOQJ.js → chunk-MN3PP45X.js} +1 -1
- package/dist/{chunk-25GRRBTH.js → chunk-NHEU5CON.js} +1 -1
- package/dist/{chunk-IM6IL3F4.js → chunk-OQT7RT5I.js} +3 -3
- package/dist/{chunk-KRTD2F3I.js → chunk-P3CHDKXD.js} +3 -3
- package/dist/{chunk-63IVRRIO.js → chunk-P3NPTFLF.js} +3 -3
- package/dist/{chunk-GC5PVMIJ.js → chunk-RR3VDM7M.js} +3 -3
- package/dist/{chunk-G4W4B33M.js → chunk-SDAEXUIX.js} +25 -10
- package/dist/{chunk-SYVRBBLW.js → chunk-SDELQEG4.js} +1 -1
- package/dist/{chunk-AE3OTPUU.js → chunk-SZU4YCBH.js} +964 -1056
- package/dist/{chunk-FDJPDZSR.js → chunk-TS3EFB7S.js} +1 -1
- package/dist/{chunk-EMH2LNIE.js → chunk-V2VJYK46.js} +4 -4
- package/dist/{chunk-KAVZAB3E.js → chunk-VEJWLQ4G.js} +10 -10
- package/dist/{chunk-XTYYF6P7.js → chunk-VUQKGBIQ.js} +14 -7
- package/dist/{chunk-3RLKILPT.js → chunk-WE4C3ODP.js} +2 -2
- package/dist/{chunk-QEIA5Q35.js → chunk-XL2MPORM.js} +4 -4
- package/dist/{chunk-VGRCZE6U.js → chunk-XSFR76J7.js} +3 -3
- package/dist/{chunk-UMYYYF7B.js → chunk-YL3RWW7X.js} +1 -1
- package/dist/{chunk-GSSVJNP2.js → chunk-Z7WMU3RA.js} +3 -2
- package/dist/{chunk-3EHDZTRT.js → chunk-ZIKZZ4LK.js} +3 -3
- package/dist/{claude-launcher-OQZNW7XJ.js → claude-launcher-6KGANL7E.js} +1 -1
- package/dist/{cli-PFWJD5QM.js → cli-5KY3TE3S.js} +114 -112
- package/dist/{command-CM22HPN5.js → command-VQPQDPCZ.js} +24 -24
- package/dist/{config-W2XWNR4C.js → config-WSZIWPP4.js} +7 -7
- package/dist/{connect-cmd-TOWE4P45.js → connect-cmd-LI34HS5Q.js} +6 -6
- package/dist/{container-start-D2OEPMUO.js → container-start-XRR4VC5Z.js} +31 -30
- package/dist/{context-show-cmd-5UJUWBJL.js → context-show-cmd-X27GMOT6.js} +7 -7
- package/dist/{control-plane-launch-XBGHM7DB.js → control-plane-launch-74EIIB5Z.js} +5 -5
- package/dist/dist-HVXLUMRV.js +7 -0
- package/dist/{docker-GA63DVME.js → docker-KZ3OQTPW.js} +5 -5
- package/dist/{doctor-GVWQBHBC.js → doctor-KPKLFIJH.js} +24 -24
- package/dist/{emit-artifact-cmd-TUOLSGHB.js → emit-artifact-cmd-BJICHW2E.js} +11 -11
- package/dist/{emit-criteria-cmd-VEUMA7MZ.js → emit-criteria-cmd-MUWPT25P.js} +8 -8
- package/dist/{emit-demo-cmd-YLEZB6FG.js → emit-demo-cmd-YQN7VKQH.js} +12 -12
- package/dist/{emit-finding-cmd-BX3FWGSX.js → emit-finding-cmd-NPBWVY44.js} +8 -8
- package/dist/{emit-result-cmd-AYXGCIPR.js → emit-result-cmd-7CJZZQGK.js} +10 -10
- package/dist/{emit-step-cmd-CU6GQ3WW.js → emit-step-cmd-ZPLHZAMA.js} +8 -8
- package/dist/{exec-client-QB4OZRGM.js → exec-client-LXHTMVIB.js} +3 -3
- package/dist/find-unit-UKH6JH4S.js +18 -0
- package/dist/{findings-cmd-G4V4M3PO.js → findings-cmd-DZ4ESTHX.js} +8 -8
- package/dist/{fleet-readiness-NJYTQYTA.js → fleet-readiness-YSI4NOHT.js} +5 -5
- package/dist/{governing-source-JQV3ZKD7.js → governing-source-JPRMOB3O.js} +10 -10
- package/dist/{guest-init-IF5LXGUL.js → guest-init-WWL2WL7R.js} +4 -4
- package/dist/{hook-fast-GPUL7T77.js → hook-fast-6EW2MGA2.js} +1 -1
- package/dist/host-checks-NDXNYOMA.js +75 -0
- package/dist/{pending-ERXWVLLG.js → host-key-TSOKVSZX.js} +3 -3
- package/dist/{image-tag-SEMBVB5D.js → image-tag-BTXKIH73.js} +3 -3
- package/dist/index.js +4 -4
- package/dist/{init-FY3HP73H.js → init-MN3MNG7V.js} +21 -21
- package/dist/{init-3NT4YX2X.js → init-V6Y2VNKW.js} +21 -21
- package/dist/{init-cmd-RXHHEAOT.js → init-cmd-QCWLJDIF.js} +11 -11
- package/dist/{init-update-RHS6HWLI.js → init-update-GTFLPDEL.js} +9 -9
- package/dist/{install-cmd-5H6M2KJ7.js → install-cmd-RGO7NWKP.js} +5 -5
- package/dist/{logs-6CMB3DO6.js → logs-LEVH6VAI.js} +2 -2
- package/dist/{loop-V3GED2WX.js → loop-NGFNQF3Y.js} +38 -37
- package/dist/{machine-HLZLH327.js → machine-XG54XYYZ.js} +21 -21
- package/dist/{mcp-serve-cmd-MWGIN6YL.js → mcp-serve-cmd-4O5INM77.js} +4 -4
- package/dist/{paths-T2DEBI62.js → paths-AQ47ZRHK.js} +2 -2
- package/dist/{host-key-5RU322O3.js → pending-UWFDVFOA.js} +3 -3
- package/dist/{pidfile-EAD2OEM7.js → pidfile-PCG2H5T4.js} +3 -3
- package/dist/{record-IMXQNHPB.js → record-SVCNFCGQ.js} +3 -3
- package/dist/{runner-env-V52JUOD5.js → runner-env-YPXWTNP3.js} +9 -9
- package/dist/{runner-identity-J4NCBSBU.js → runner-identity-XPZO3TG4.js} +5 -5
- package/dist/{runner-key-ZUHMQCHZ.js → runner-key-B5EJH25Z.js} +21 -21
- package/dist/{session-sender-XDKMK4SF.js → session-sender-XED7CKHP.js} +11 -11
- package/dist/{spec-cmd-XQV7EIJW.js → spec-cmd-TRXAGQYM.js} +9 -9
- package/dist/{status-ZJJEJ52D.js → status-WQ53MWC3.js} +29 -28
- package/dist/{sync-cmd-BG2M536W.js → sync-cmd-UQVENF25.js} +10 -10
- package/dist/{update-steps-I5JLERXS.js → update-steps-IQVAL64Y.js} +30 -29
- package/dist/{watch-7A63565I.js → watch-EZGDDRTQ.js} +10 -10
- package/dist/{work-claim-cmd-OVPMBIRR.js → work-claim-cmd-YSAJ7DAK.js} +14 -14
- package/dist/{work-cmd-KVFRK24I.js → work-cmd-V5FHLWJM.js} +8 -8
- package/dist/{work-comment-cmd-GC3WAFM7.js → work-comment-cmd-KLEMDYI4.js} +9 -9
- package/dist/{work-demo-cmd-IOB5UDGQ.js → work-demo-cmd-XYRKFP4G.js} +8 -8
- package/dist/{work-logs-cmd-7II6D2JJ.js → work-logs-cmd-DOGPK7Q6.js} +8 -8
- package/dist/{work-open-pr-cmd-FYKRKCDL.js → work-open-pr-cmd-UAUEEP3V.js} +9 -9
- package/dist/{work-pr-cmd-KP3RI7TV.js → work-pr-cmd-LYWL7ZLF.js} +8 -8
- package/dist/{work-proofs-cmd-TVU6QFZN.js → work-proofs-cmd-YMMDAA6W.js} +11 -9
- package/dist/{work-proofs-record-XANZE3K4.js → work-proofs-record-NUCWR7ZJ.js} +17 -15
- package/dist/{work-stop-cmd-5V3DV3HJ.js → work-stop-cmd-MRLJEQRP.js} +8 -8
- package/package.json +1 -1
- package/skill-pack/maintained/outerlayer-amend/SKILL.md +2 -1
- package/skill-pack/maintained/outerlayer-build/SKILL.md +3 -1
- package/skill-pack/maintained/outerlayer-build/references/evidence.md +9 -3
- package/dist/chunk-YZ375YBI.js +0 -151
- package/dist/dist-IOPJIQWK.js +0 -7
- package/dist/find-unit-GGBRYOSO.js +0 -18
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
import { criteriaOf, loadCitationFinder, hostItemsOf, MAX_TEST_FILE_BYTES, MAX_TEST_FILES, criterionInputs, NO_CITING_TEST_REASON, NO_VERDICT_REASON, planCriteria } from './chunk-6D7H5DMZ.js';
|
|
4
|
+
import { WorkCommandError, resolveCredentials, getJson } from './chunk-JKNOJKVD.js';
|
|
5
|
+
import { C } from './chunk-ANPNT6PM.js';
|
|
6
|
+
import { sanitizeTerminal } from './chunk-MECW77XP.js';
|
|
7
|
+
import { defaultFetch } from './chunk-7QAJQDHS.js';
|
|
8
|
+
import { resolveRepoIdentity } from './chunk-Z7WMU3RA.js';
|
|
9
|
+
import { parseWorkItemEnv } from './chunk-T2Q7ISPE.js';
|
|
10
|
+
import { parseTrackerNumber, trackerNumberError } from './chunk-WZBHBH3J.js';
|
|
11
|
+
import { readDeliveryRecord } from './chunk-YQR6E6OV.js';
|
|
12
|
+
import { inferArtifactKind, mediaTypeForArtifactPath, WORK_ITEM_COMMENT_MAX_BODY_LENGTH } from './chunk-EOTMDIYC.js';
|
|
13
|
+
import { createHash } from 'crypto';
|
|
14
|
+
import { spawnSync } from 'child_process';
|
|
15
|
+
import { existsSync, statSync, readFileSync } from 'fs';
|
|
16
|
+
import { resolve, dirname } from 'path';
|
|
17
|
+
|
|
18
|
+
createRequire(import.meta.url);
|
|
19
|
+
function kindProblem(declared, file) {
|
|
20
|
+
if (declared === "test") return "a test proof is recorded by CI, not by --record";
|
|
21
|
+
const kind = inferArtifactKind(mediaTypeForArtifactPath(file));
|
|
22
|
+
return kind === declared ? void 0 : `the kinds differ: the file is a ${kind}, but the criterion declares a ${declared} proof`;
|
|
23
|
+
}
|
|
24
|
+
function proofsCommentBody(head, lines) {
|
|
25
|
+
const header = `These proofs are not current at ${head.slice(0, 7)}:`;
|
|
26
|
+
const rows = lines.map((line) => `- ${line.id} (${line.proof}): ${line.reason}`);
|
|
27
|
+
const fits = (count2) => {
|
|
28
|
+
const left = rows.length - count2;
|
|
29
|
+
return [header, ...rows.slice(0, count2), ...left > 0 ? [`and ${left} more.`] : []].join("\n");
|
|
30
|
+
};
|
|
31
|
+
let count = rows.length;
|
|
32
|
+
while (count > 0 && fits(count).length > WORK_ITEM_COMMENT_MAX_BODY_LENGTH) count -= 1;
|
|
33
|
+
return fits(count);
|
|
34
|
+
}
|
|
35
|
+
function proofsCommentId(item, head, lines) {
|
|
36
|
+
const list = [...lines].sort((a, b) => a.id < b.id ? -1 : a.id > b.id ? 1 : 0).map((line) => [line.id, line.proof, line.reason]);
|
|
37
|
+
const digest = createHash("sha256").update(JSON.stringify([item, head.toLowerCase(), list])).digest("hex");
|
|
38
|
+
return `proofs-${digest.slice(0, 32)}`;
|
|
39
|
+
}
|
|
40
|
+
function repositoryName(repository) {
|
|
41
|
+
return repository.replace(/\.git$/, "").split("/").filter((part) => part !== "").slice(-2).join("/").toLowerCase();
|
|
42
|
+
}
|
|
43
|
+
function ownPullRequest(pullRequests, requested, checkoutRepository) {
|
|
44
|
+
if (requested !== void 0) return { pr: requested };
|
|
45
|
+
const here = checkoutRepository === void 0 ? void 0 : repositoryName(checkoutRepository);
|
|
46
|
+
const open = pullRequests.filter(
|
|
47
|
+
(pr) => pr.state === "open" && typeof pr.prNumber === "number" && (here === void 0 || repositoryName(pr.repository ?? "") === here)
|
|
48
|
+
);
|
|
49
|
+
if (open.length > 1) return { ambiguous: open.map((pr) => pr.prNumber) };
|
|
50
|
+
return { pr: open[0]?.prNumber };
|
|
51
|
+
}
|
|
52
|
+
var NO_BRIEF = "";
|
|
53
|
+
var GITHUB_BLOB = /^https:\/\/github\.com\/[^/]+\/[^/]+\/blob\/([0-9a-f]{7,64})\//;
|
|
54
|
+
function commitOf(refs) {
|
|
55
|
+
for (const ref of refs) {
|
|
56
|
+
const match = GITHUB_BLOB.exec(ref.href ?? "");
|
|
57
|
+
if (match !== null) return match[1];
|
|
58
|
+
}
|
|
59
|
+
return void 0;
|
|
60
|
+
}
|
|
61
|
+
function unprovenCriteria(input) {
|
|
62
|
+
const { criteria, finder } = input;
|
|
63
|
+
const citations = finder.buildCitations({ ids: criteria.map((c) => c.id), files: [...input.headFiles], repository: null, sha: null });
|
|
64
|
+
const headTexts = new Map(input.headFiles.map((file) => [file.path, file.contents]));
|
|
65
|
+
const inputs = new Map(criteria.map((c) => [c.id, criterionInputs({ brief: NO_BRIEF, criterion: c, citations, testFiles: headTexts })]));
|
|
66
|
+
const notes = [];
|
|
67
|
+
const commits = /* @__PURE__ */ new Map();
|
|
68
|
+
const previous = /* @__PURE__ */ new Map();
|
|
69
|
+
const filesByCommit = /* @__PURE__ */ new Map();
|
|
70
|
+
for (const item of input.items) {
|
|
71
|
+
const criterion = criteria.find((c) => c.id === item.id);
|
|
72
|
+
if (criterion === void 0 || item.result !== "fail" || item.inputs === void 0) continue;
|
|
73
|
+
if (item.reason === NO_CITING_TEST_REASON || item.reason === NO_VERDICT_REASON) continue;
|
|
74
|
+
const commit = item.refs === void 0 ? void 0 : commitOf(item.refs);
|
|
75
|
+
if (commit === void 0) {
|
|
76
|
+
notes.push(`the links of ${item.id} name no commit`);
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
if (!filesByCommit.has(commit)) filesByCommit.set(commit, input.testFilesAt(commit));
|
|
80
|
+
const files = filesByCommit.get(commit);
|
|
81
|
+
if (files === void 0) {
|
|
82
|
+
notes.push(`this checkout does not hold ${item.id}'s cited tests at ${commit.slice(0, 7)}`);
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
const judgedCitations = finder.buildCitations({ ids: [item.id], files: [...files], repository: null, sha: null });
|
|
86
|
+
const judged = new Map(files.map((file) => [file.path, file.contents]));
|
|
87
|
+
commits.set(item.id, commit);
|
|
88
|
+
previous.set(item.id, { ...item, inputs: criterionInputs({ brief: NO_BRIEF, criterion, citations: judgedCitations, testFiles: judged }) });
|
|
89
|
+
}
|
|
90
|
+
const plan = planCriteria({ criteria, citations, inputs, previous: [...previous.values()] });
|
|
91
|
+
const settled = new Map(plan.settled.map((item) => [item.id, item]));
|
|
92
|
+
const entries = [];
|
|
93
|
+
for (const criterion of criteria) {
|
|
94
|
+
const item = settled.get(criterion.id);
|
|
95
|
+
if (item === void 0 || item.result !== "fail") continue;
|
|
96
|
+
if (item.refs === void 0) entries.push({ id: criterion.id, proof: null, state: "uncited" });
|
|
97
|
+
else entries.push({ id: criterion.id, proof: null, state: "failed", commit: commits.get(criterion.id) ?? "", reason: item.reason ?? "no reason recorded" });
|
|
98
|
+
}
|
|
99
|
+
return { entries, notes };
|
|
100
|
+
}
|
|
101
|
+
function git(cwd, args, input) {
|
|
102
|
+
const run = spawnSync("git", args, { cwd, input, maxBuffer: 268435456 });
|
|
103
|
+
if (run.status !== 0) throw new Error(`git ${args[0]} failed`);
|
|
104
|
+
return run.stdout;
|
|
105
|
+
}
|
|
106
|
+
function readObjects(cwd, specs) {
|
|
107
|
+
const out = git(cwd, ["cat-file", "--batch"], `${specs.join("\n")}
|
|
108
|
+
`);
|
|
109
|
+
const texts = [];
|
|
110
|
+
let at = 0;
|
|
111
|
+
for (let n = 0; n < specs.length; n += 1) {
|
|
112
|
+
const end = out.indexOf(10, at);
|
|
113
|
+
const header = out.subarray(at, end).toString("utf8");
|
|
114
|
+
at = end + 1;
|
|
115
|
+
const match = /^[0-9a-f]+ blob (\d+)$/.exec(header);
|
|
116
|
+
if (match === null) {
|
|
117
|
+
texts.push(void 0);
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
const size = Number(match[1]);
|
|
121
|
+
texts.push(out.subarray(at, at + size).toString("utf8"));
|
|
122
|
+
at += size + 1;
|
|
123
|
+
}
|
|
124
|
+
return texts;
|
|
125
|
+
}
|
|
126
|
+
function testFilesAt(cwd, head, isTest) {
|
|
127
|
+
try {
|
|
128
|
+
const listing = git(cwd, ["ls-tree", "-r", "-l", "-z", head]);
|
|
129
|
+
const picked = /* @__PURE__ */ new Map();
|
|
130
|
+
for (const entry of listing.toString("utf8").split("\0")) {
|
|
131
|
+
const match = /^(\d+) blob ([0-9a-f]+)\s+(\d+)\t(.*)$/s.exec(entry);
|
|
132
|
+
if (match === null || !match[1].startsWith("100") || Number(match[3]) > MAX_TEST_FILE_BYTES || !isTest.test(match[4])) continue;
|
|
133
|
+
if (picked.size >= MAX_TEST_FILES) break;
|
|
134
|
+
picked.set(match[4], match[2]);
|
|
135
|
+
}
|
|
136
|
+
const paths = [...picked.keys()];
|
|
137
|
+
const texts = readObjects(cwd, [...picked.values()]);
|
|
138
|
+
return paths.flatMap((path, n) => texts[n] === void 0 ? [] : [{ path, contents: texts[n] }]);
|
|
139
|
+
} catch {
|
|
140
|
+
return void 0;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
function checkoutPlaces(cwd) {
|
|
144
|
+
for (let dir = resolve(cwd); ; dir = dirname(dir)) {
|
|
145
|
+
const dotGit = resolve(dir, ".git");
|
|
146
|
+
try {
|
|
147
|
+
if (statSync(dotGit).isDirectory()) return { root: dir, common: dotGit };
|
|
148
|
+
const named = /^gitdir:\s*(.+)$/m.exec(readFileSync(dotGit, "utf8"))?.[1]?.trim();
|
|
149
|
+
if (named === void 0) return void 0;
|
|
150
|
+
const gitDir = resolve(dir, named);
|
|
151
|
+
let common = gitDir;
|
|
152
|
+
try {
|
|
153
|
+
common = resolve(gitDir, readFileSync(resolve(gitDir, "commondir"), "utf8").trim());
|
|
154
|
+
} catch {
|
|
155
|
+
}
|
|
156
|
+
return { root: dir, common };
|
|
157
|
+
} catch {
|
|
158
|
+
}
|
|
159
|
+
if (dirname(dir) === dir) return void 0;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
async function judgeCheckName(cwd) {
|
|
163
|
+
const places = checkoutPlaces(cwd);
|
|
164
|
+
if (places === void 0) return {};
|
|
165
|
+
const delivered = readDeliveryRecord(places.common);
|
|
166
|
+
const dir = delivered?.dir ?? places.root;
|
|
167
|
+
if (!existsSync(dir)) return { note: `the governed context at ${dir} is not readable` };
|
|
168
|
+
const { checksIn, isJudgeCheck } = await import('./host-checks-NDXNYOMA.js');
|
|
169
|
+
const quiet = { line: () => void 0, error: () => void 0 };
|
|
170
|
+
const check = checksIn(dir, quiet, "").checks.find((c) => isJudgeCheck(c) && c.judge.subjects === "criteria");
|
|
171
|
+
return check === void 0 ? {} : { name: check.name };
|
|
172
|
+
}
|
|
173
|
+
async function findUnproven(input) {
|
|
174
|
+
try {
|
|
175
|
+
const found = await judgeCheckName(input.cwd);
|
|
176
|
+
if (found.name === void 0) return { entries: [], notes: found.note === void 0 ? [] : [found.note] };
|
|
177
|
+
const criteria = criteriaOf(input.item);
|
|
178
|
+
if (criteria === void 0) return { entries: [], notes: [] };
|
|
179
|
+
const finder = await loadCitationFinder();
|
|
180
|
+
const headFiles = testFilesAt(input.cwd, input.head, finder.TEST_FILE);
|
|
181
|
+
if (headFiles === void 0) return { entries: [], notes: [`the test files at ${input.head.slice(0, 7)} cannot be read`] };
|
|
182
|
+
const items = hostItemsOf(input.item, found.name);
|
|
183
|
+
const result = unprovenCriteria({
|
|
184
|
+
criteria,
|
|
185
|
+
finder,
|
|
186
|
+
headFiles,
|
|
187
|
+
items,
|
|
188
|
+
testFilesAt: (commit) => testFilesAt(input.cwd, commit, finder.TEST_FILE)
|
|
189
|
+
});
|
|
190
|
+
const check = Object(input.item).checks?.find((c) => Object(c).name === found.name);
|
|
191
|
+
if (check?.source === "host" && check.result === "fail" && items.length === 0) result.notes.unshift("the gateway returned no check items for the judge's result");
|
|
192
|
+
return result;
|
|
193
|
+
} catch (err) {
|
|
194
|
+
return { entries: [], notes: [err instanceof Error ? err.message : String(err)] };
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// src/work-proofs-cmd.ts
|
|
199
|
+
function liveHead(pr) {
|
|
200
|
+
if (pr.state !== "open" && pr.state !== "merged" || typeof pr.headSha !== "string" || pr.headSha === "") return void 0;
|
|
201
|
+
return pr.headSha.toLowerCase();
|
|
202
|
+
}
|
|
203
|
+
function otherPullRequestHeads(pullRequests, ownPr, checkoutRepository) {
|
|
204
|
+
const here = checkoutRepository === void 0 ? void 0 : repositoryName(checkoutRepository);
|
|
205
|
+
const heads = /* @__PURE__ */ new Set();
|
|
206
|
+
for (const pr of pullRequests) {
|
|
207
|
+
const head = liveHead(pr);
|
|
208
|
+
if (head === void 0) continue;
|
|
209
|
+
const isOwn = ownPr !== void 0 && pr.prNumber === ownPr && (here === void 0 || repositoryName(pr.repository ?? "") === here);
|
|
210
|
+
if (!isOwn) heads.add(head);
|
|
211
|
+
}
|
|
212
|
+
return heads;
|
|
213
|
+
}
|
|
214
|
+
function classifyProofs(data, checkoutHead) {
|
|
215
|
+
const heads = /* @__PURE__ */ new Set();
|
|
216
|
+
if (checkoutHead !== void 0 && checkoutHead !== "") heads.add(checkoutHead.toLowerCase());
|
|
217
|
+
data.pullRequests?.forEach((pr) => {
|
|
218
|
+
const head = liveHead(pr);
|
|
219
|
+
if (head !== void 0) heads.add(head);
|
|
220
|
+
});
|
|
221
|
+
return classifyProofsAt(data, heads);
|
|
222
|
+
}
|
|
223
|
+
function classifyProofsAt(data, heads) {
|
|
224
|
+
const entries = [];
|
|
225
|
+
for (const criterion of data.criteria?.items ?? []) {
|
|
226
|
+
if (criterion.proof === null || criterion.proof === "test") continue;
|
|
227
|
+
const newest = criterion.newestProof;
|
|
228
|
+
if (newest === null || newest === void 0) {
|
|
229
|
+
entries.push({ id: criterion.id, proof: criterion.proof, state: "missing", commit: null });
|
|
230
|
+
} else if (newest.commitSha !== null && heads.has(newest.commitSha.toLowerCase())) {
|
|
231
|
+
entries.push({ id: criterion.id, proof: criterion.proof, state: "current", commit: newest.commitSha });
|
|
232
|
+
} else {
|
|
233
|
+
entries.push({ id: criterion.id, proof: criterion.proof, state: "out-of-date", commit: newest.commitSha });
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return entries;
|
|
237
|
+
}
|
|
238
|
+
var STATE_LABEL = { current: "current", "out-of-date": "out of date", missing: "missing" };
|
|
239
|
+
function renderEntry(e) {
|
|
240
|
+
const id = sanitizeTerminal(e.id);
|
|
241
|
+
if (e.state === "uncited") {
|
|
242
|
+
return `${id} none uncited No test at HEAD cites it. Put ${id} in a test's title or in a comment above the test, as in // proves ${id}`;
|
|
243
|
+
}
|
|
244
|
+
if (e.state === "failed") {
|
|
245
|
+
return `${id} none failed ${sanitizeTerminal(e.commit)} The judge failed it: ${sanitizeTerminal(e.reason)} No test that cites it has changed since. Change a test that cites ${id}.`;
|
|
246
|
+
}
|
|
247
|
+
return `${id} ${sanitizeTerminal(e.proof)} ${STATE_LABEL[e.state]} ${sanitizeTerminal(e.commit ?? "no commit")}`;
|
|
248
|
+
}
|
|
249
|
+
function render(entries, notes, json) {
|
|
250
|
+
if (json) return JSON.stringify(entries);
|
|
251
|
+
const lines = entries.length === 0 ? ["No criterion declares a proof other than test."] : entries.map(renderEntry);
|
|
252
|
+
if (notes.length > 0) lines.push(`The command could not check the judge's results: ${notes.map(sanitizeTerminal).join("; ")}.`);
|
|
253
|
+
return lines.join("\n");
|
|
254
|
+
}
|
|
255
|
+
function resolveProofsItem(opts) {
|
|
256
|
+
const env = opts.env ?? process.env;
|
|
257
|
+
let item;
|
|
258
|
+
if (opts.item !== void 0) {
|
|
259
|
+
item = parseTrackerNumber(opts.item);
|
|
260
|
+
if (item === void 0) throw new WorkCommandError(trackerNumberError("--item", opts.item));
|
|
261
|
+
} else if (env.OUTERLAYER_WORK !== void 0) {
|
|
262
|
+
const parsed = parseWorkItemEnv(env.OUTERLAYER_WORK);
|
|
263
|
+
if (!("number" in parsed)) throw new WorkCommandError(parsed.reason);
|
|
264
|
+
item = parsed.number;
|
|
265
|
+
}
|
|
266
|
+
if (item === void 0) {
|
|
267
|
+
throw new WorkCommandError("no work item. Pass --item <number>, or set OUTERLAYER_WORK to the item's number.");
|
|
268
|
+
}
|
|
269
|
+
return item;
|
|
270
|
+
}
|
|
271
|
+
async function runWorkProofs(opts) {
|
|
272
|
+
const item = resolveProofsItem(opts);
|
|
273
|
+
const creds = resolveCredentials(opts);
|
|
274
|
+
const { data } = await getJson(creds.url, `/v1/work-items/${item}`, creds.apiKey, creds.appId, opts.fetchImpl ?? defaultFetch);
|
|
275
|
+
const body = data;
|
|
276
|
+
const items = body.criteria?.items ?? [];
|
|
277
|
+
if (items.some((c) => c.proof !== null && c.proof !== "test" && !("newestProof" in c))) {
|
|
278
|
+
throw new WorkCommandError(
|
|
279
|
+
"the gateway does not report each criterion's newest proof. Update the gateway, then run this again."
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
const checkoutHead = opts.checkoutHead ?? resolveRepoIdentity(opts.cwd ?? process.cwd()).commitSha;
|
|
283
|
+
if (!checkoutHead) {
|
|
284
|
+
throw new WorkCommandError("cannot read the checkout's HEAD. Run this inside the git checkout, or pass the head explicitly.");
|
|
285
|
+
}
|
|
286
|
+
const declared = classifyProofs(body, checkoutHead);
|
|
287
|
+
const unproven = await findUnproven({ item: body, cwd: opts.cwd ?? process.cwd(), head: checkoutHead });
|
|
288
|
+
const entries = [...declared, ...unproven.entries];
|
|
289
|
+
const json = opts.json === true;
|
|
290
|
+
const output = render(entries, json ? [] : unproven.notes, json);
|
|
291
|
+
if (!opts.quiet) {
|
|
292
|
+
process.stdout.write(output + "\n");
|
|
293
|
+
if (json && unproven.notes.length > 0) process.stderr.write(`The command could not check the judge's results: ${unproven.notes.join("; ")}.
|
|
294
|
+
`);
|
|
295
|
+
}
|
|
296
|
+
const inRunnerBuild = (opts.env ?? process.env).OUTERLAYER_JOB_DIR !== void 0;
|
|
297
|
+
const declaredCurrent = declared.every((e) => e.state === "current");
|
|
298
|
+
return { entries, output, exitCode: declaredCurrent && !(inRunnerBuild && unproven.entries.length > 0) ? 0 : 1 };
|
|
299
|
+
}
|
|
300
|
+
async function runWorkProofsCommand(opts) {
|
|
301
|
+
try {
|
|
302
|
+
if (opts.record) {
|
|
303
|
+
const { runWorkProofsRecord } = await import('./work-proofs-record-NUCWR7ZJ.js');
|
|
304
|
+
const result2 = await runWorkProofsRecord(opts);
|
|
305
|
+
process.exitCode = result2.exitCode;
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
const result = await runWorkProofs(opts);
|
|
309
|
+
process.exitCode = result.exitCode;
|
|
310
|
+
} catch (err) {
|
|
311
|
+
if (err instanceof WorkCommandError) {
|
|
312
|
+
process.stderr.write(`${C.red}\u2717${C.reset} ${err.message}
|
|
313
|
+
`);
|
|
314
|
+
process.exitCode = 2;
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
throw err;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export { classifyProofs, classifyProofsAt, kindProblem, otherPullRequestHeads, ownPullRequest, proofsCommentBody, proofsCommentId, resolveProofsItem, runWorkProofs, runWorkProofsCommand };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { RecipeError, locateRecipe, readRecipe, assertBuildable, runnerLabelValue, writeSanitizedRecipe, classifyProperties, SANITIZED_NAME } from './chunk-
|
|
3
|
+
import { RecipeError, locateRecipe, readRecipe, assertBuildable, runnerLabelValue, writeSanitizedRecipe, classifyProperties, SANITIZED_NAME } from './chunk-HVQMIZ22.js';
|
|
4
4
|
import { GH_VERSION, VOICE_PACK_FILES, VOICE_PACK_VERSION, FFMPEG_STATIC, FFMPEG_BUILD_TAG, GH_SHA256, TINI_SHA256, TINI_VERSION, CLAUDE_CODE_VERSION, NODE_IMAGE, DEFAULT_BASE_IMAGE, MEDIA_PINS, PLAYWRIGHT_VERSION } from './chunk-4UPET3R7.js';
|
|
5
|
-
import { claimPidFile, RunnerAlreadyRunningError, releasePidFile } from './chunk-
|
|
5
|
+
import { claimPidFile, RunnerAlreadyRunningError, releasePidFile } from './chunk-LQHCNXPK.js';
|
|
6
6
|
import { startTimeOf } from './chunk-JBJTC3UU.js';
|
|
7
|
-
import { RUNNER_DIR_MODE, RUNNER_FILE_MODE, repoCacheDir, imagesDir, imageBuildLogsDir, attemptStamp, runnerDir, rootfsPathFor } from './chunk-
|
|
8
|
-
import { PROXY_WARNING_FLAG, withGitConfig, tokenHeader } from './chunk-
|
|
7
|
+
import { RUNNER_DIR_MODE, RUNNER_FILE_MODE, repoCacheDir, imagesDir, imageBuildLogsDir, attemptStamp, runnerDir, rootfsPathFor } from './chunk-GJ4KBHBD.js';
|
|
8
|
+
import { PROXY_WARNING_FLAG, withGitConfig, tokenHeader } from './chunk-SDAEXUIX.js';
|
|
9
9
|
import { RELAY_ID, RELAY_USER } from './chunk-MESOOLF4.js';
|
|
10
10
|
import { mkdirSync, rmSync, writeFileSync, existsSync, mkdtempSync, cpSync, readFileSync, readdirSync, lstatSync, readlinkSync } from 'fs';
|
|
11
11
|
import { tmpdir } from 'os';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { RUNNER_DIR_MODE, RUNNER_FILE_MODE } from './chunk-
|
|
3
|
+
import { RUNNER_DIR_MODE, RUNNER_FILE_MODE } from './chunk-GJ4KBHBD.js';
|
|
4
4
|
import { readFileSync, existsSync, rmSync, mkdirSync, writeFileSync, renameSync } from 'fs';
|
|
5
5
|
import { join } from 'path';
|
|
6
6
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { DEFAULT_UNIT_NAME } from './chunk-
|
|
4
|
-
import { RUNNER_FILE_MODE } from './chunk-
|
|
5
|
-
import { claudeEnvPath, withoutCredentialLines, parseRunnerEnv } from './chunk-
|
|
3
|
+
import { DEFAULT_UNIT_NAME } from './chunk-V2VJYK46.js';
|
|
4
|
+
import { RUNNER_FILE_MODE } from './chunk-GJ4KBHBD.js';
|
|
5
|
+
import { claudeEnvPath, withoutCredentialLines, parseRunnerEnv } from './chunk-SDAEXUIX.js';
|
|
6
6
|
import { existsSync, readFileSync, writeFileSync, renameSync, rmSync } from 'fs';
|
|
7
7
|
import { join, dirname } from 'path';
|
|
8
8
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
3
|
import { BUILDKIT_IMAGE } from './chunk-4UPET3R7.js';
|
|
4
|
-
import { ensureHostKey } from './chunk-
|
|
5
|
-
import { compareVersions } from './chunk-
|
|
6
|
-
import { RUNNER_DIR_MODE, RUNNER_FILE_MODE, runnerDir, jobsDir } from './chunk-
|
|
7
|
-
import { CLAUDE_PORT, JOB_MOUNT, GATEWAY_PORT, GATEWAY_SOCKET, CLAUDE_SOCKET, RELAY_PORT, DESTINATION_BASE_PORT } from './chunk-
|
|
4
|
+
import { ensureHostKey } from './chunk-L5VHGRQE.js';
|
|
5
|
+
import { compareVersions } from './chunk-Z7WMU3RA.js';
|
|
6
|
+
import { RUNNER_DIR_MODE, RUNNER_FILE_MODE, runnerDir, jobsDir } from './chunk-GJ4KBHBD.js';
|
|
7
|
+
import { CLAUDE_PORT, JOB_MOUNT, GATEWAY_PORT, GATEWAY_SOCKET, CLAUDE_SOCKET, RELAY_PORT, DESTINATION_BASE_PORT } from './chunk-SDAEXUIX.js';
|
|
8
8
|
import { JOIN_DIR, RELAY_ID, JOIN_SOCKET, TARGET_GATEWAY, TARGET_CLAUDE, destinationTarget, RELAY_USER } from './chunk-MESOOLF4.js';
|
|
9
9
|
import { createHash } from 'crypto';
|
|
10
10
|
import { existsSync, readdirSync, readFileSync, lstatSync, realpathSync, writeFileSync, mkdirSync, createWriteStream, rmSync, chmodSync, renameSync } from 'fs';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { fetchFactories, selectFactory, saveFactoryConnection, autoConnectedLine } from './chunk-
|
|
4
|
-
import { resolveGatewayCredentials } from './chunk-
|
|
3
|
+
import { fetchFactories, selectFactory, saveFactoryConnection, autoConnectedLine } from './chunk-EUQZAH2W.js';
|
|
4
|
+
import { resolveGatewayCredentials } from './chunk-7QAJQDHS.js';
|
|
5
5
|
import { readCloudConfig } from './chunk-PJDQPF5N.js';
|
|
6
6
|
import { findGitDirs, readRepoConnection } from './chunk-BJ3KTMDH.js';
|
|
7
|
-
import { resolveRepoIdentity } from './chunk-
|
|
7
|
+
import { resolveRepoIdentity } from './chunk-Z7WMU3RA.js';
|
|
8
8
|
import { cliInvocation } from './chunk-CRB3POP4.js';
|
|
9
9
|
import { homeFromEnv } from './chunk-VNVZDWO3.js';
|
|
10
10
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { parseSize, BUILD_LABEL, RUNNER_LABEL, runnerLabelValue } from './chunk-
|
|
4
|
-
import { buildsDir, rootfsDir, runnerDir, imagesDir, builderCacheDiskPath } from './chunk-
|
|
3
|
+
import { parseSize, BUILD_LABEL, RUNNER_LABEL, runnerLabelValue } from './chunk-HVQMIZ22.js';
|
|
4
|
+
import { buildsDir, rootfsDir, runnerDir, imagesDir, builderCacheDiskPath } from './chunk-GJ4KBHBD.js';
|
|
5
5
|
import { spawnSync } from 'child_process';
|
|
6
6
|
import { statfsSync, statSync, existsSync, readdirSync } from 'fs';
|
|
7
7
|
import { dirname, join } from 'path';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { placeholderQueues, placeholderProblem } from './chunk-
|
|
4
|
-
import { checkFit } from './chunk-
|
|
5
|
-
import { builtinKind, imageBuildOf, keepsHostBuilder } from './chunk-
|
|
6
|
-
import { realBuildDiskProbe, checkDiskFit, DEFAULT_CACHE_DISK, DEFAULT_BUILD_DISK } from './chunk-
|
|
3
|
+
import { placeholderQueues, placeholderProblem } from './chunk-CNZRUVZ5.js';
|
|
4
|
+
import { checkFit, RUNNER_RESERVE_BYTES } from './chunk-V2VJYK46.js';
|
|
5
|
+
import { builtinKind, imageBuildOf, keepsHostBuilder } from './chunk-ZIKZZ4LK.js';
|
|
6
|
+
import { realBuildDiskProbe, checkDiskFit, DEFAULT_CACHE_DISK, DEFAULT_BUILD_DISK } from './chunk-IWVGALDC.js';
|
|
7
7
|
import { builderDiskPinned } from './chunk-4UPET3R7.js';
|
|
8
|
-
import { FORWARDED_CLAUDE_CREDENTIAL_VARIABLES, claudeCredentialVariablesSet, claudeCredential, claudeEnvPath, parseRunnerEnv
|
|
8
|
+
import { BUILD_SLICE_MEMORY_ENV, FORWARDED_CLAUDE_CREDENTIAL_VARIABLES, claudeCredentialVariablesSet, claudeCredential, claudeEnvPath, parseRunnerEnv } from './chunk-SDAEXUIX.js';
|
|
9
9
|
import { closeSync, openSync, constants, readFileSync } from 'fs';
|
|
10
10
|
import { join, dirname } from 'path';
|
|
11
11
|
import { totalmem } from 'os';
|
|
@@ -156,5 +156,38 @@ function checkBlockedWithSlots(config, probes) {
|
|
|
156
156
|
}
|
|
157
157
|
return { slots };
|
|
158
158
|
}
|
|
159
|
+
var GIB = 1024 ** 3;
|
|
160
|
+
function largeBuildMemoryBytes() {
|
|
161
|
+
return 16 * GIB;
|
|
162
|
+
}
|
|
163
|
+
var LARGE_BUILD_DISK_BYTES = 3e10;
|
|
164
|
+
function checkManagedRoom(input) {
|
|
165
|
+
const availableBytes = input.sliceBytes ?? Math.max(0, input.totalMemoryBytes - RUNNER_RESERVE_BYTES);
|
|
166
|
+
if (input.runningMemoryBytes + largeBuildMemoryBytes() > availableBytes) {
|
|
167
|
+
const where = input.sliceBytes === void 0 ? "the host's memory less the runner's reserve" : "the memory limit of the runner's build slice";
|
|
168
|
+
return {
|
|
169
|
+
fits: false,
|
|
170
|
+
resource: "memory",
|
|
171
|
+
reason: `one more Large build needs ${gib(largeBuildMemoryBytes())} of memory, and the running builds hold ${gib(input.runningMemoryBytes)} of the ${gib(availableBytes)} in ${where}`
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
if (input.freeDiskBytes !== void 0) {
|
|
175
|
+
const diskBytes = input.freeDiskBytes + input.heldDiskBytes;
|
|
176
|
+
if (input.runningDiskBytes + LARGE_BUILD_DISK_BYTES > diskBytes) {
|
|
177
|
+
return {
|
|
178
|
+
fits: false,
|
|
179
|
+
resource: "disk",
|
|
180
|
+
reason: `one more Large build needs a ${gb(LARGE_BUILD_DISK_BYTES)} build disk beside the ${gb(input.runningDiskBytes)} the running builds' disks may grow to, and the runner's file system has ${gb(diskBytes)} free or held by them`
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return { fits: true };
|
|
185
|
+
}
|
|
186
|
+
function gib(bytes) {
|
|
187
|
+
return `${(bytes / GIB).toFixed(1)} GiB`;
|
|
188
|
+
}
|
|
189
|
+
function gb(bytes) {
|
|
190
|
+
return `${(bytes / 1e9).toFixed(1)} GB`;
|
|
191
|
+
}
|
|
159
192
|
|
|
160
|
-
export { checkBlockedWithSlots, managedFactsOf, managedProblems, realBlockedProbes };
|
|
193
|
+
export { LARGE_BUILD_DISK_BYTES, checkBlockedWithSlots, checkManagedRoom, largeBuildMemoryBytes, managedFactsOf, managedProblems, realBlockedProbes, sliceMemoryOf };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
3
|
import { detectActiveSession } from './chunk-IP7BIBXJ.js';
|
|
4
|
-
import { autoConnect } from './chunk-
|
|
5
|
-
import { workPageUrl } from './chunk-
|
|
4
|
+
import { autoConnect } from './chunk-IO2BBKG4.js';
|
|
5
|
+
import { workPageUrl } from './chunk-EUQZAH2W.js';
|
|
6
6
|
import { C } from './chunk-ANPNT6PM.js';
|
|
7
7
|
import { sanitizeTerminal } from './chunk-MECW77XP.js';
|
|
8
|
-
import { resolveGatewayCredentials, unauthorizedMessage, defaultFetch } from './chunk-
|
|
9
|
-
import { signRunnerRequest } from './chunk-
|
|
8
|
+
import { resolveGatewayCredentials, unauthorizedMessage, defaultFetch } from './chunk-7QAJQDHS.js';
|
|
9
|
+
import { signRunnerRequest } from './chunk-L5VHGRQE.js';
|
|
10
10
|
import { readRepoConnection } from './chunk-BJ3KTMDH.js';
|
|
11
|
-
import { resolveRepoIdentity } from './chunk-
|
|
11
|
+
import { resolveRepoIdentity } from './chunk-Z7WMU3RA.js';
|
|
12
12
|
import { parseTrackerNumber, trackerNumberError } from './chunk-WZBHBH3J.js';
|
|
13
13
|
import { homeFromEnv } from './chunk-VNVZDWO3.js';
|
|
14
14
|
|
|
@@ -379,6 +379,21 @@ function tokenWarning(data) {
|
|
|
379
379
|
return `
|
|
380
380
|
${C.yellow}!${C.reset} a container host will fail this build: ${why}`;
|
|
381
381
|
}
|
|
382
|
+
var RUNNER_KINDS = ["managed", "self-hosted"];
|
|
383
|
+
function isManagedRefusal(code) {
|
|
384
|
+
return code === "managed_builds_off" || code === "managed_credential_missing";
|
|
385
|
+
}
|
|
386
|
+
function parseRunnerKind(raw) {
|
|
387
|
+
if (raw === void 0) return void 0;
|
|
388
|
+
const kind = RUNNER_KINDS.find((k) => k === raw);
|
|
389
|
+
if (kind === void 0) throw new WorkCommandError(`--runner takes ${RUNNER_KINDS.join(" or ")}, not "${sanitizeTerminal(raw)}"`);
|
|
390
|
+
return kind;
|
|
391
|
+
}
|
|
392
|
+
function runnerLabel(data, named) {
|
|
393
|
+
const kind = data.runner === "managed" || data.runner === "self-hosted" ? data.runner : named;
|
|
394
|
+
if (kind !== "managed" && named === void 0) return "";
|
|
395
|
+
return ` ${C.dim}\xB7${C.reset} on a ${kind} runner`;
|
|
396
|
+
}
|
|
382
397
|
function itemLabel(data) {
|
|
383
398
|
return data.number != null ? `item #${data.number}` : `item ${sanitizeTerminal(String(data.workItemId))}`;
|
|
384
399
|
}
|
|
@@ -401,6 +416,10 @@ async function runWorkBuild(opts) {
|
|
|
401
416
|
"--instructions applies to host builds: with --local you build the item yourself, so give your instructions in your own session"
|
|
402
417
|
);
|
|
403
418
|
}
|
|
419
|
+
const runner = parseRunnerKind(opts.runner);
|
|
420
|
+
if (opts.local && runner !== void 0) {
|
|
421
|
+
throw new WorkCommandError("--runner applies to host builds: with --local you build the item yourself, so no runner takes it");
|
|
422
|
+
}
|
|
404
423
|
await connectIfOneFits(opts);
|
|
405
424
|
const { url, apiKey, appId } = resolveCredentials(opts);
|
|
406
425
|
const fetchImpl = opts.fetchImpl ?? defaultFetch;
|
|
@@ -428,15 +447,21 @@ async function runWorkBuild(opts) {
|
|
|
428
447
|
return { data: data2, output: output2 };
|
|
429
448
|
}
|
|
430
449
|
const instructions = opts.instructions !== void 0 ? { instructions: opts.instructions } : {};
|
|
431
|
-
const body = itemNumber !== void 0 ? { workItemId: String(itemNumber), note: opts.note, ...instructions, ...facts } : {
|
|
450
|
+
const body = itemNumber !== void 0 ? { workItemId: String(itemNumber), note: opts.note, ...instructions, runner, ...facts } : {
|
|
432
451
|
subject: resolveWorkSubject({ issue: opts.issue, tracker: opts.tracker, repo: opts.repo, cwd }),
|
|
433
452
|
note: opts.note,
|
|
434
453
|
...instructions,
|
|
454
|
+
runner,
|
|
435
455
|
...facts
|
|
436
456
|
};
|
|
437
|
-
const { data } = await postJsonWithRetry(url, "/v1/work-items/build", apiKey, appId, body, fetchImpl, retries, sleep)
|
|
457
|
+
const { data } = await postJsonWithRetry(url, "/v1/work-items/build", apiKey, appId, body, fetchImpl, retries, sleep).catch((err) => {
|
|
458
|
+
if (err instanceof WorkCommandError && isManagedRefusal(err.code)) {
|
|
459
|
+
throw new WorkCommandError(`${err.message} (${err.code})`, false, err.status, err.code);
|
|
460
|
+
}
|
|
461
|
+
throw err;
|
|
462
|
+
});
|
|
438
463
|
const page = itemPageUrl(home, cwd, appId, data.workItemId, data.number);
|
|
439
|
-
const output = opts.json ? JSON.stringify(data) : `${C.green}\u2713${C.reset} build requested ${C.dim}\xB7${C.reset} ${itemLabel(data)}${"subject" in body ? ` (${issueLabel(body.subject)})` : ""} ${C.dim}\xB7${C.reset} by ${data.attestor}` + (page !== void 0 ? `
|
|
464
|
+
const output = opts.json ? JSON.stringify(data) : `${C.green}\u2713${C.reset} build requested ${C.dim}\xB7${C.reset} ${itemLabel(data)}${"subject" in body ? ` (${issueLabel(body.subject)})` : ""}${runnerLabel(data, runner)} ${C.dim}\xB7${C.reset} by ${data.attestor}` + (page !== void 0 ? `
|
|
440
465
|
${page}` : "") + tokenWarning(data);
|
|
441
466
|
if (!opts.quiet) process.stdout.write(output + "\n");
|
|
442
467
|
return { data, output };
|
|
@@ -446,7 +471,7 @@ async function runWorkLinkSession(opts) {
|
|
|
446
471
|
return await linkSession(opts);
|
|
447
472
|
} catch (err) {
|
|
448
473
|
if (opts.logFailures) {
|
|
449
|
-
const { logHookError } = await import('./hook-fast-
|
|
474
|
+
const { logHookError } = await import('./hook-fast-6EW2MGA2.js');
|
|
450
475
|
const reason = err instanceof Error ? err.message : String(err);
|
|
451
476
|
logHookError(opts.home ?? homeFromEnv(opts.env ?? process.env), new Error(`work link-session #${opts.number} failed: ${reason}`));
|
|
452
477
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { resolveCredentials, postJson, getJson } from './chunk-
|
|
3
|
+
import { resolveCredentials, postJson, getJson } from './chunk-JKNOJKVD.js';
|
|
4
4
|
import { detectActiveSession } from './chunk-IP7BIBXJ.js';
|
|
5
5
|
import { C } from './chunk-ANPNT6PM.js';
|
|
6
6
|
import { sanitizeTerminal } from './chunk-MECW77XP.js';
|
|
7
|
-
import { defaultFetch } from './chunk-
|
|
8
|
-
import { resolveRepoIdentity } from './chunk-
|
|
7
|
+
import { defaultFetch } from './chunk-7QAJQDHS.js';
|
|
8
|
+
import { resolveRepoIdentity } from './chunk-Z7WMU3RA.js';
|
|
9
9
|
import { parseTrackerNumber, trackerNumberError } from './chunk-WZBHBH3J.js';
|
|
10
10
|
import { homeFromEnv } from './chunk-VNVZDWO3.js';
|
|
11
11
|
import { randomUUID } from 'crypto';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { hostKeyPath, runnerDir, RUNNER_DIR_MODE, RUNNER_FILE_MODE } from './chunk-
|
|
3
|
+
import { hostKeyPath, runnerDir, RUNNER_DIR_MODE, RUNNER_FILE_MODE } from './chunk-GJ4KBHBD.js';
|
|
4
4
|
import { generateKeyPairSync, createPrivateKey, createPublicKey, sign } from 'crypto';
|
|
5
5
|
import { existsSync, mkdirSync, writeFileSync, readFileSync } from 'fs';
|
|
6
6
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { LiveUploader } from './chunk-
|
|
4
|
-
import { spoolDir } from './chunk-
|
|
5
|
-
import { CaptureDaemon } from './chunk-
|
|
3
|
+
import { LiveUploader } from './chunk-VUQKGBIQ.js';
|
|
4
|
+
import { spoolDir } from './chunk-NHEU5CON.js';
|
|
5
|
+
import { CaptureDaemon } from './chunk-Z7WMU3RA.js';
|
|
6
6
|
import { parseWorkItemEnv } from './chunk-T2Q7ISPE.js';
|
|
7
7
|
import { homeFromEnv } from './chunk-VNVZDWO3.js';
|
|
8
8
|
import { mkdirSync, writeFileSync, rmSync } from 'fs';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
3
|
import { isSameProcess } from './chunk-JBJTC3UU.js';
|
|
4
|
-
import { RUNNER_DIR_MODE, RUNNER_FILE_MODE } from './chunk-
|
|
4
|
+
import { RUNNER_DIR_MODE, RUNNER_FILE_MODE } from './chunk-GJ4KBHBD.js';
|
|
5
5
|
import { existsSync, readFileSync, mkdirSync, writeFileSync, rmSync } from 'fs';
|
|
6
6
|
import { dirname } from 'path';
|
|
7
7
|
|