@outerlayer/cli 0.34.0-next.20261028105453 → 0.34.0-next.20261028122415
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-info.json +1 -1
- package/dist/{check-LMUTXMTY.js → check-FWRVWOVY.js} +5 -5
- package/dist/{work-proofs-record-BCY52YK3.js → chunk-BEGMZKMG.js} +176 -497
- package/dist/{chunk-6WU2D2CY.js → chunk-SX3LYSWR.js} +1 -1
- package/dist/{chunk-JNFLO6DA.js → chunk-U3O7MULV.js} +4 -4
- package/dist/{chunk-6UHU7DHT.js → chunk-UDMFRKFJ.js} +1 -1
- package/dist/{chunk-6YIWAOHM.js → chunk-UKEIJKCH.js} +22 -9
- package/dist/{chunk-ITS67SH7.js → chunk-YGU43DH4.js} +13 -4
- package/dist/{cli-6YAN2USY.js → cli-K7AWWU6C.js} +10 -10
- package/dist/{container-start-RWW7L5LC.js → container-start-XGKAKLUD.js} +4 -4
- package/dist/{host-checks-77FAAR2A.js → host-checks-L4GX6F3H.js} +2 -2
- package/dist/index.js +1 -1
- package/dist/{loop-QZV7AR3F.js → loop-GQLSSBQB.js} +5 -5
- package/dist/{status-QPV75ZNS.js → status-EP6QSFRY.js} +2 -2
- package/dist/{update-steps-YY3DZ5NW.js → update-steps-BJB7NL6L.js} +3 -3
- package/dist/{work-proofs-cmd-R53HHZJB.js → work-proofs-cmd-RYQ7Y6KO.js} +2 -2
- package/dist/work-proofs-record-IC3RWDDQ.js +509 -0
- package/package.json +1 -1
- package/skill-pack/maintained/outerlayer-build/scripts/criterion-citations.mjs +44 -4
- package/dist/chunk-6CK2OC4Q.js +0 -152
package/dist/chunk-6CK2OC4Q.js
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire } from 'node:module';
|
|
3
|
-
import { resolvePackRoot } from './chunk-OVNF4LLC.js';
|
|
4
|
-
import { CHECK_ITEM_REASON_MAX_LENGTH, CheckItemsSchema } from './chunk-DINRXUQA.js';
|
|
5
|
-
import { createHash } from 'crypto';
|
|
6
|
-
import { join } from 'path';
|
|
7
|
-
import { pathToFileURL } from 'url';
|
|
8
|
-
|
|
9
|
-
createRequire(import.meta.url);
|
|
10
|
-
var ARTIFACT_PROOF_REASON = "Its declared artifact proves it; the judge does not judge artifacts.";
|
|
11
|
-
var NO_CITING_TEST_REASON = "No test cites this criterion, and it declares no artifact proof.";
|
|
12
|
-
var NO_VERDICT_REASON = "The judge gave no result for this criterion.";
|
|
13
|
-
function criterionInputs(input) {
|
|
14
|
-
const paths = [...new Set((input.citations[input.criterion.id] ?? []).map((citation) => citation.path))].sort();
|
|
15
|
-
const hash = createHash("sha256");
|
|
16
|
-
const part = (text) => {
|
|
17
|
-
hash.update(`${Buffer.byteLength(text)}:`);
|
|
18
|
-
hash.update(text);
|
|
19
|
-
};
|
|
20
|
-
part("judge-criterion-v1");
|
|
21
|
-
part(input.brief);
|
|
22
|
-
part(input.criterion.id);
|
|
23
|
-
part(input.criterion.text);
|
|
24
|
-
part(input.criterion.proof ?? "");
|
|
25
|
-
for (const path of paths) {
|
|
26
|
-
part(path);
|
|
27
|
-
part(input.testFiles.get(path) ?? "");
|
|
28
|
-
}
|
|
29
|
-
return hash.digest("hex");
|
|
30
|
-
}
|
|
31
|
-
var HTTPS_LINK = /^https:\/\/\S+$/;
|
|
32
|
-
function refsFor(id, citations) {
|
|
33
|
-
const refs = (citations[id] ?? []).slice(0, 20).map((citation) => ({
|
|
34
|
-
path: citation.path,
|
|
35
|
-
line: citation.line,
|
|
36
|
-
// Only an https link becomes an href on a page; any other is left off rather than refusing the check.
|
|
37
|
-
...HTTPS_LINK.test(citation.href ?? "") ? { href: citation.href } : {}
|
|
38
|
-
}));
|
|
39
|
-
return refs.length === 0 ? void 0 : refs;
|
|
40
|
-
}
|
|
41
|
-
function planCriteria(input) {
|
|
42
|
-
const previousById = new Map(input.previous.map((item) => [item.id, item]));
|
|
43
|
-
const settled = [];
|
|
44
|
-
const toJudge = [];
|
|
45
|
-
for (const criterion of input.criteria) {
|
|
46
|
-
const inputs = input.inputs.get(criterion.id);
|
|
47
|
-
const base = { id: criterion.id, criterion: criterion.id, ...inputs === void 0 ? {} : { inputs } };
|
|
48
|
-
const refs = refsFor(criterion.id, input.citations);
|
|
49
|
-
if (criterion.proof !== null) {
|
|
50
|
-
settled.push({ ...base, result: "skipped", reason: ARTIFACT_PROOF_REASON });
|
|
51
|
-
continue;
|
|
52
|
-
}
|
|
53
|
-
if (refs === void 0) {
|
|
54
|
-
settled.push({ ...base, result: "fail", reason: NO_CITING_TEST_REASON });
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
const kept = previousById.get(criterion.id);
|
|
58
|
-
if (kept !== void 0 && inputs !== void 0 && kept.inputs === inputs && (kept.result === "pass" || kept.result === "fail")) {
|
|
59
|
-
settled.push({ ...base, result: kept.result, ...kept.reason === void 0 ? {} : { reason: kept.reason }, refs });
|
|
60
|
-
continue;
|
|
61
|
-
}
|
|
62
|
-
toJudge.push(criterion);
|
|
63
|
-
}
|
|
64
|
-
return { settled, toJudge };
|
|
65
|
-
}
|
|
66
|
-
var MAX_ANSWER_ENTRIES = 500;
|
|
67
|
-
function readAnswer(raw) {
|
|
68
|
-
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return { ok: false, problem: "expected an object" };
|
|
69
|
-
const { result, items } = raw;
|
|
70
|
-
if (result !== void 0 && result !== "pass" && result !== "fail") return { ok: false, problem: 'result: must be "pass" or "fail"' };
|
|
71
|
-
if (items !== void 0 && !Array.isArray(items)) return { ok: false, problem: "items: must be an array" };
|
|
72
|
-
const entries = items ?? [];
|
|
73
|
-
if (entries.length > MAX_ANSWER_ENTRIES) return { ok: false, problem: `items: at most ${MAX_ANSWER_ENTRIES} entries` };
|
|
74
|
-
const read = [];
|
|
75
|
-
for (const [index, entry] of entries.entries()) {
|
|
76
|
-
const { id, result: itemResult, reason } = typeof entry === "object" && entry !== null ? entry : {};
|
|
77
|
-
if (typeof id !== "string" || id === "" || id.length > 200) return { ok: false, problem: `items.${index}.id: must be text of 1 to 200 characters` };
|
|
78
|
-
if (itemResult !== "pass" && itemResult !== "fail") return { ok: false, problem: `items.${index}.result: must be "pass" or "fail"` };
|
|
79
|
-
if (reason !== void 0 && typeof reason !== "string") return { ok: false, problem: `items.${index}.reason: must be text` };
|
|
80
|
-
read.push({ id, result: itemResult, ...reason === void 0 ? {} : { reason } });
|
|
81
|
-
}
|
|
82
|
-
return { ok: true, answer: { ...result === void 0 ? {} : { result }, items: read } };
|
|
83
|
-
}
|
|
84
|
-
function parseJudgeAnswer(text) {
|
|
85
|
-
if (text === void 0 || text.trim() === "") return void 0;
|
|
86
|
-
let raw;
|
|
87
|
-
try {
|
|
88
|
-
raw = JSON.parse(text);
|
|
89
|
-
} catch {
|
|
90
|
-
return { ok: false, reason: "the judge's items.json is not JSON" };
|
|
91
|
-
}
|
|
92
|
-
const read = readAnswer(raw);
|
|
93
|
-
return read.ok ? read : { ok: false, reason: `the judge's items.json does not match its shape: ${read.problem}` };
|
|
94
|
-
}
|
|
95
|
-
function oneLineReason(text) {
|
|
96
|
-
if (text === void 0) return void 0;
|
|
97
|
-
const line = text.replace(/\s+/g, " ").trim();
|
|
98
|
-
if (line === "") return void 0;
|
|
99
|
-
return line.length <= CHECK_ITEM_REASON_MAX_LENGTH ? line : `${line.slice(0, CHECK_ITEM_REASON_MAX_LENGTH - 1)}\u2026`;
|
|
100
|
-
}
|
|
101
|
-
function judgedItems(input) {
|
|
102
|
-
return input.toJudge.map((criterion) => {
|
|
103
|
-
const said = input.results.get(criterion.id);
|
|
104
|
-
const inputs = input.inputs.get(criterion.id);
|
|
105
|
-
const refs = refsFor(criterion.id, input.citations);
|
|
106
|
-
const reason = said === void 0 ? NO_VERDICT_REASON : oneLineReason(said.reason);
|
|
107
|
-
return {
|
|
108
|
-
id: criterion.id,
|
|
109
|
-
criterion: criterion.id,
|
|
110
|
-
result: said?.result ?? "fail",
|
|
111
|
-
...reason === void 0 ? {} : { reason },
|
|
112
|
-
...refs === void 0 ? {} : { refs },
|
|
113
|
-
...inputs === void 0 || said === void 0 ? {} : { inputs }
|
|
114
|
-
};
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
function inCriteriaOrder(items, criteria) {
|
|
118
|
-
const order = new Map(criteria.map((criterion, index) => [criterion.id, index]));
|
|
119
|
-
return [...items].sort((a, b) => (order.get(a.id) ?? Number.MAX_SAFE_INTEGER) - (order.get(b.id) ?? Number.MAX_SAFE_INTEGER));
|
|
120
|
-
}
|
|
121
|
-
function itemsSentence(items, noun) {
|
|
122
|
-
const failing = items.filter((item) => item.result === "fail").map((item) => item.id);
|
|
123
|
-
if (failing.length === 0) return void 0;
|
|
124
|
-
return `${failing.length} of ${items.length} ${items.length === 1 ? noun.one : noun.many} not satisfied: ${failing.join(", ")}`;
|
|
125
|
-
}
|
|
126
|
-
var MAX_TEST_FILES = 2e4;
|
|
127
|
-
var MAX_TEST_FILE_BYTES = 1024 * 1024;
|
|
128
|
-
async function loadCitationFinder() {
|
|
129
|
-
return await import(pathToFileURL(join(resolvePackRoot(), "maintained", "outerlayer-build", "scripts", "criterion-citations.mjs")).href);
|
|
130
|
-
}
|
|
131
|
-
function criteriaOf(workItem) {
|
|
132
|
-
const criteria = Object(Object(workItem).criteria);
|
|
133
|
-
if (!Array.isArray(criteria.items)) return void 0;
|
|
134
|
-
const drafted = criteria.drafted === true;
|
|
135
|
-
const items = [];
|
|
136
|
-
for (const entry of criteria.items) {
|
|
137
|
-
const { id, text, proof } = Object(entry);
|
|
138
|
-
if (typeof id !== "string" || typeof text !== "string") continue;
|
|
139
|
-
items.push({ id, text, proof: typeof proof === "string" ? proof : null, drafted });
|
|
140
|
-
}
|
|
141
|
-
return items.length === 0 ? void 0 : items;
|
|
142
|
-
}
|
|
143
|
-
function hostItemsOf(workItem, name) {
|
|
144
|
-
const checks = Object(workItem).checks;
|
|
145
|
-
if (!Array.isArray(checks)) return [];
|
|
146
|
-
const check = checks.find((entry) => Object(entry).name === name);
|
|
147
|
-
if (check?.source !== "host") return [];
|
|
148
|
-
const parsed = CheckItemsSchema.safeParse(check.items);
|
|
149
|
-
return parsed.success ? parsed.data : [];
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
export { MAX_TEST_FILES, MAX_TEST_FILE_BYTES, NO_CITING_TEST_REASON, NO_VERDICT_REASON, criteriaOf, criterionInputs, hostItemsOf, inCriteriaOrder, itemsSentence, judgedItems, loadCitationFinder, oneLineReason, parseJudgeAnswer, planCriteria };
|