harness-everything 0.51.0 → 0.53.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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.github/workflows/ci.yml +23 -0
- package/CHANGELOG.md +54 -0
- package/benchmarks/results/doc-evidence-e1/cycle-2026-11-11-a-evid-001.md +123 -0
- package/benchmarks/results/doc-evidence-e1/cycle-2026-11-11-b-route-001.md +130 -0
- package/benchmarks/results/live-host/opencode-2026-11-15-workspace/README.md +7 -0
- package/benchmarks/results/live-host/opencode-2026-11-15-workspace/live-workspace-probe.js +16 -0
- package/benchmarks/results/live-host/opencode-2026-11-15-workspace/live-workspace-trace-2026-11-15.jsonl +4 -0
- package/ci/mechanism-2am-observations-session-import.test.js +4 -1
- package/ci/mechanism-2n-opencode-plugin.test.js +1 -1
- package/ci/mechanism-2p-opencode-v2-entrypoint.test.js +18 -3
- package/ci/mechanism-338-opencode-async.test.js +20 -3
- package/ci/mechanism-34-observations.test.js +127 -23
- package/ci/mechanism-341-opencode-lane.test.js +7 -1
- package/ci/mechanism-349-ci-change-scope.test.js +260 -0
- package/ci/mechanism-397-cycle-import.test.js +399 -0
- package/ci/mechanism-397-host-acceptance.test.js +119 -0
- package/ci/mechanism-397-opencode-observations.test.js +1922 -0
- package/ci/mechanism-handoff-file.test.js +121 -0
- package/ci/mechanism-system-one-contract.test.js +9 -2
- package/ci/mechanism-system-one-curves.test.js +223 -0
- package/ci/mechanism-system-one-cycle.test.js +1204 -0
- package/ci/mechanism-system-one-evaluation.test.js +32 -5
- package/ci/mechanism-system-one-handoff-input.test.js +208 -0
- package/ci/mechanism-system-one-install.test.js +202 -77
- package/ci/mechanism-system-one-live.test.js +361 -0
- package/ci/mechanism-system-one-relevance.test.js +11 -1
- package/ci/mechanism-system-one-train.test.js +136 -53
- package/ci/system-one-adapter-test.py +331 -0
- package/ci/system-one-train-test.py +116 -24
- package/docs/adr/EVID-001.md +123 -0
- package/docs/adr/ROUTE-001-error-lesson-delivery.md +305 -0
- package/docs/governed-index.md +2 -0
- package/docs/platform-capabilities.md +13 -6
- package/docs/routing.md +2 -2
- package/docs/system-one-cycle.md +77 -0
- package/docs/system-one-observations.md +43 -11
- package/docs/system-one-routing.md +163 -115
- package/docs/system-one-suggestion-gates.md +6 -8
- package/docs/system-one-training.md +44 -7
- package/docs/workflow-runtime.md +19 -0
- package/harness-everything/SKILL.md +1 -1
- package/harness-everything/scripts/kernel-router.js +2 -1
- package/harness-everything/scripts/system-one/contract.js +19 -15
- package/harness-everything/scripts/system-one/cua_adapter.py +211 -17
- package/harness-everything/scripts/system-one/evaluate.js +4 -9
- package/harness-everything/scripts/system-one/handoff-input.js +76 -0
- package/harness-everything/scripts/system-one/install.js +281 -113
- package/harness-everything/scripts/system-one/manifest.js +58 -0
- package/harness-everything/scripts/system-one/provider.js +96 -2
- package/harness-everything/scripts/system-one/resident.js +47 -1
- package/harness-everything/scripts/system-one/router.js +80 -1
- package/harness-everything/scripts/tier-router.js +21 -6
- package/hooks/scripts/lib/observations.js +48 -7
- package/opencode-plugin/README.md +22 -8
- package/opencode-plugin/index.mjs +424 -44
- package/opencode-plugin/plugin.json +1 -1
- package/package.json +1 -1
- package/plugins/harness-everything/.codex-plugin/plugin.json +1 -1
- package/plugins/harness-everything/hooks/scripts/lib/observations.js +48 -7
- package/plugins/harness-everything/plugin.json +1 -1
- package/plugins/harness-everything/scripts/handoff-file.js +223 -0
- package/plugins/harness-everything/skills/harness-everything/SKILL.md +1 -1
- package/plugins/harness-everything/skills/harness-everything/scripts/kernel-router.js +2 -1
- package/plugins/harness-everything/skills/harness-everything/scripts/system-one/contract.js +19 -15
- package/plugins/harness-everything/skills/harness-everything/scripts/system-one/cua_adapter.py +211 -17
- package/plugins/harness-everything/skills/harness-everything/scripts/system-one/evaluate.js +4 -9
- package/plugins/harness-everything/skills/harness-everything/scripts/system-one/handoff-input.js +76 -0
- package/plugins/harness-everything/skills/harness-everything/scripts/system-one/install.js +281 -113
- package/plugins/harness-everything/skills/harness-everything/scripts/system-one/manifest.js +58 -0
- package/plugins/harness-everything/skills/harness-everything/scripts/system-one/provider.js +96 -2
- package/plugins/harness-everything/skills/harness-everything/scripts/system-one/resident.js +47 -1
- package/plugins/harness-everything/skills/harness-everything/scripts/system-one/router.js +80 -1
- package/plugins/harness-everything/skills/harness-everything/scripts/tier-router.js +21 -6
- package/sbom.cdx.json +7 -7
- package/scripts/ci-change-scope.js +59 -0
- package/scripts/handoff-file.js +223 -0
- package/scripts/sync-openai-plugin.js +4 -0
- package/scripts/system-one-calibrate.js +108 -41
- package/scripts/system-one-curves.js +472 -0
- package/scripts/system-one-cycle/adjudication-input.js +65 -0
- package/scripts/system-one-cycle/build.js +165 -0
- package/scripts/system-one-cycle/collect.js +67 -0
- package/scripts/system-one-cycle/common.js +175 -0
- package/scripts/system-one-cycle/engines.js +62 -0
- package/scripts/system-one-cycle/evaluate.js +73 -0
- package/scripts/system-one-cycle/judge.js +106 -0
- package/scripts/system-one-cycle/label.js +59 -0
- package/scripts/system-one-cycle/package.js +173 -0
- package/scripts/system-one-cycle/score.py +111 -0
- package/scripts/system-one-cycle/train.js +136 -0
- package/scripts/system-one-cycle.js +136 -0
- package/scripts/system-one-observations-export.js +58 -6
- package/scripts/system-one-observations-import-store.js +128 -0
- package/scripts/system-one-observations-review.js +4 -5
- package/scripts/system-one-train.py +117 -61
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const path = require('node:path');
|
|
4
|
+
const { readJsonl, writeJsonl, assertPrivateDataDir } = require('./common');
|
|
5
|
+
const { CATALOGS } = require('../../harness-everything/scripts/system-one/catalogs');
|
|
6
|
+
|
|
7
|
+
const TIERS = new Set(['tier1', 'tier2', 'tier3']);
|
|
8
|
+
const INTENTS = new Set(CATALOGS.intent.map(option => option.id));
|
|
9
|
+
|
|
10
|
+
function intentDisagrees(self, lunaIntent) {
|
|
11
|
+
return Array.isArray(self?.intents) && lunaIntent !== undefined && (self.intents[0] ?? null) !== lunaIntent;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function buildAdjudicationInput({ dataDir }) {
|
|
15
|
+
const privateDir = assertPrivateDataDir(dataDir);
|
|
16
|
+
const training = path.join(privateDir, 'training');
|
|
17
|
+
const prompts = readJsonl(path.join(training, 'observed', 'prompts-observed.jsonl'));
|
|
18
|
+
const index = (rows, file) => {
|
|
19
|
+
const map = new Map();
|
|
20
|
+
for (const row of rows) {
|
|
21
|
+
if (typeof row?.id !== 'string' || !row.id || map.has(row.id)) throw new Error(`${path.basename(file)} has an invalid or duplicate id`);
|
|
22
|
+
map.set(row.id, row);
|
|
23
|
+
}
|
|
24
|
+
return map;
|
|
25
|
+
};
|
|
26
|
+
const observedFile = path.join(training, 'observed', 'labels-observed.jsonl');
|
|
27
|
+
const lunaFile = path.join(training, 'relabel-luna', 'labels.jsonl');
|
|
28
|
+
const lunaIntentFile = path.join(training, 'relabel-luna', 'labels-intent.jsonl');
|
|
29
|
+
const observed = index(readJsonl(observedFile, true), observedFile);
|
|
30
|
+
const luna = index(readJsonl(lunaFile), lunaFile);
|
|
31
|
+
const lunaIntents = index(readJsonl(lunaIntentFile), lunaIntentFile);
|
|
32
|
+
const rows = [];
|
|
33
|
+
const seen = new Set();
|
|
34
|
+
|
|
35
|
+
for (const prompt of prompts) {
|
|
36
|
+
if (typeof prompt?.id !== 'string' || !prompt.id) throw new Error('observed prompt is missing an id');
|
|
37
|
+
if (seen.has(prompt.id)) throw new Error('duplicate observed prompt id');
|
|
38
|
+
seen.add(prompt.id);
|
|
39
|
+
const self = observed.get(prompt.id);
|
|
40
|
+
const textLabel = luna.get(prompt.id);
|
|
41
|
+
const intentLabel = lunaIntents.get(prompt.id);
|
|
42
|
+
if (!self || self.tier === undefined || !textLabel) continue;
|
|
43
|
+
if ((self.tier !== null && !TIERS.has(self.tier)) || (textLabel.gold !== null && !TIERS.has(textLabel.gold))) {
|
|
44
|
+
throw new Error('invalid tier label for adjudication input');
|
|
45
|
+
}
|
|
46
|
+
if (intentLabel && (!Object.hasOwn(intentLabel, 'gold') || (intentLabel.gold !== null && !INTENTS.has(intentLabel.gold)))) {
|
|
47
|
+
throw new Error('invalid intent label for adjudication input');
|
|
48
|
+
}
|
|
49
|
+
const hasSelfIntent = Array.isArray(self.intents);
|
|
50
|
+
const selfIntent = hasSelfIntent ? (self.intents[0] ?? null) : null;
|
|
51
|
+
if (selfIntent !== null && !INTENTS.has(selfIntent)) throw new Error('invalid self intent for adjudication input');
|
|
52
|
+
const tierDisagrees = self.tier !== textLabel.gold;
|
|
53
|
+
const intentsDisagree = intentLabel && intentDisagrees(self, intentLabel.gold);
|
|
54
|
+
if (tierDisagrees || intentsDisagree) {
|
|
55
|
+
if (typeof prompt.text !== 'string' || !prompt.text) throw new Error('observed prompt is missing text');
|
|
56
|
+
rows.push({ id: prompt.id, text: prompt.text, selfTier: self.tier, lunaTier: textLabel.gold,
|
|
57
|
+
...(intentsDisagree ? { selfIntent, lunaIntent: intentLabel.gold } : {}) });
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
writeJsonl(path.join(training, 'adjudication', 'input.jsonl'), rows);
|
|
62
|
+
return { candidates: rows.length };
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
module.exports = { buildAdjudicationInput, intentDisagrees };
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('node:fs');
|
|
4
|
+
const path = require('node:path');
|
|
5
|
+
const { REPO, readJsonl, writeJsonl, writeJson, assertPrivateDataDir, isSyntheticBuildDataDir } = require('./common');
|
|
6
|
+
const { intentDisagrees } = require('./adjudication-input');
|
|
7
|
+
const { CATALOGS, validSecondary } = require('../../harness-everything/scripts/system-one/catalogs');
|
|
8
|
+
|
|
9
|
+
const TIERS = new Set(['tier1', 'tier2', 'tier3']);
|
|
10
|
+
const DROP_REASONS = ['no-majority', 'no-vote', 'intent-no-majority', 'holdout-overlap', 'split-overlap'];
|
|
11
|
+
|
|
12
|
+
function indexById(rows, file) {
|
|
13
|
+
const map = new Map();
|
|
14
|
+
for (const row of rows) {
|
|
15
|
+
if (typeof row?.id !== 'string' || !row.id) throw new Error(`${path.basename(file)} has a row without an id`);
|
|
16
|
+
if (map.has(row.id)) throw new Error(`${path.basename(file)} has duplicate id ${row.id}`);
|
|
17
|
+
map.set(row.id, row);
|
|
18
|
+
}
|
|
19
|
+
return map;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function requireTier(value, file) {
|
|
23
|
+
if (value !== null && !TIERS.has(value)) throw new Error(`${path.basename(file)} has an invalid tier label`);
|
|
24
|
+
return value;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function requirePrompt(row, file) {
|
|
28
|
+
for (const key of ['id', 'family', 'source', 'split', 'text']) {
|
|
29
|
+
if (typeof row?.[key] !== 'string' || !row[key]) throw new Error(`${path.basename(file)} has a row without a string ${key}`);
|
|
30
|
+
}
|
|
31
|
+
if (!['train', 'validation'].includes(row.split)) throw new Error(`${path.basename(file)} has an invalid split`);
|
|
32
|
+
return { id: row.id, family: row.family, source: row.source, split: row.split, text: row.text };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function holdoutTexts(file) {
|
|
36
|
+
const corpus = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
37
|
+
if (!Array.isArray(corpus?.cases)) throw new Error(`${path.basename(file)} has no cases array`);
|
|
38
|
+
return corpus.cases.map((row, index) => {
|
|
39
|
+
if (typeof row?.request?.context !== 'string') throw new Error(`${path.basename(file)} cases[${index}] is missing request.context`);
|
|
40
|
+
return row.request.context;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const normalize = text => text.toLowerCase().replace(/[\p{P}\p{S}]+/gu, ' ').replace(/\s+/gu, ' ').trim();
|
|
45
|
+
|
|
46
|
+
function defaultHoldouts() {
|
|
47
|
+
const dir = path.join(REPO, 'benchmarks', 'fixtures');
|
|
48
|
+
return ['system-one-holdout.json', 'system-one-intent-holdout.json'].map(file => path.join(dir, file));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function buildDataset({ dataDir, holdoutFiles = defaultHoldouts(), outDir, validityOutDir }) {
|
|
52
|
+
const privateDir = assertPrivateDataDir(dataDir, { allowSyntheticBuildRoot: true, create: false });
|
|
53
|
+
const syntheticBuildRoot = isSyntheticBuildDataDir(privateDir);
|
|
54
|
+
const outputDir = outDir === undefined ? path.join(privateDir, 'training', 'v1') : outDir;
|
|
55
|
+
const validityOutputDir = validityOutDir === undefined ? path.join(privateDir, 'training', 'v1-validity') : validityOutDir;
|
|
56
|
+
outDir = assertPrivateDataDir(outputDir, {
|
|
57
|
+
allowSyntheticBuildRoot: syntheticBuildRoot, create: false,
|
|
58
|
+
});
|
|
59
|
+
validityOutDir = assertPrivateDataDir(validityOutputDir, {
|
|
60
|
+
allowSyntheticBuildRoot: syntheticBuildRoot, create: false,
|
|
61
|
+
});
|
|
62
|
+
const training = path.join(privateDir, 'training');
|
|
63
|
+
const promptFile = path.join(training, 'observed', 'prompts-observed.jsonl');
|
|
64
|
+
const selfFile = path.join(training, 'observed', 'labels-observed.jsonl');
|
|
65
|
+
const lunaFile = path.join(training, 'relabel-luna', 'labels.jsonl');
|
|
66
|
+
const intentFile = path.join(training, 'relabel-luna', 'labels-intent.jsonl');
|
|
67
|
+
const consensusFile = path.join(training, 'adjudication', 'consensus.jsonl');
|
|
68
|
+
const promptRows = readJsonl(promptFile);
|
|
69
|
+
if (syntheticBuildRoot && (!promptRows.length || promptRows.some(row => typeof row.text !== 'string' || !row.text.toLowerCase().includes('synthetic')))) {
|
|
70
|
+
throw new Error('repository-local build input must contain only synthetic fixture rows');
|
|
71
|
+
}
|
|
72
|
+
const selfLabels = indexById(readJsonl(selfFile, true), selfFile);
|
|
73
|
+
const luna = indexById(readJsonl(lunaFile), lunaFile);
|
|
74
|
+
const intents = indexById(readJsonl(intentFile), intentFile);
|
|
75
|
+
const votes = indexById(readJsonl(consensusFile, true), consensusFile);
|
|
76
|
+
const heldOut = new Set(holdoutFiles.flatMap(holdoutTexts).map(normalize));
|
|
77
|
+
const seenIds = new Set();
|
|
78
|
+
const candidates = [];
|
|
79
|
+
const droppedByReason = Object.fromEntries(DROP_REASONS.map(reason => [reason, 0]));
|
|
80
|
+
|
|
81
|
+
for (const row of promptRows) {
|
|
82
|
+
const prompt = requirePrompt(row, promptFile);
|
|
83
|
+
if (seenIds.has(prompt.id)) throw new Error(`duplicate prompt id ${prompt.id}`);
|
|
84
|
+
seenIds.add(prompt.id);
|
|
85
|
+
const textLabel = luna.get(prompt.id);
|
|
86
|
+
const intentLabel = intents.get(prompt.id);
|
|
87
|
+
if (!textLabel || !intentLabel) throw new Error(`text-only labels are missing for id ${prompt.id}`);
|
|
88
|
+
let gold = requireTier(textLabel.gold, lunaFile);
|
|
89
|
+
const self = selfLabels.get(prompt.id);
|
|
90
|
+
|
|
91
|
+
if (self && self.tier !== undefined && requireTier(self.tier, selfFile) !== gold) {
|
|
92
|
+
const vote = votes.get(prompt.id);
|
|
93
|
+
if (!vote) { droppedByReason['no-vote']++; continue; }
|
|
94
|
+
if (!['majority', 'unanimous'].includes(vote.status)) { droppedByReason['no-majority']++; continue; }
|
|
95
|
+
gold = requireTier(vote.consensus, consensusFile);
|
|
96
|
+
}
|
|
97
|
+
if (gold === 'tier1' && self?.contradictions?.includes('tier1-with-writes')) gold = 'tier2';
|
|
98
|
+
let intentGold = intentLabel.gold;
|
|
99
|
+
let secondary = Array.isArray(intentLabel.secondary) ? intentLabel.secondary : [];
|
|
100
|
+
if ((intentGold !== null && !CATALOGS.intent.some(option => option.id === intentGold)) || !validSecondary('intent', intentGold, secondary)) {
|
|
101
|
+
throw new Error(`${path.basename(intentFile)} has an invalid intent label`);
|
|
102
|
+
}
|
|
103
|
+
let intent = { gold: intentGold, secondary };
|
|
104
|
+
if (self && intentDisagrees(self, intentGold)) {
|
|
105
|
+
const vote = votes.get(prompt.id);
|
|
106
|
+
if (!['majority', 'unanimous'].includes(vote?.intentStatus)) {
|
|
107
|
+
droppedByReason['intent-no-majority']++;
|
|
108
|
+
intent = null;
|
|
109
|
+
} else {
|
|
110
|
+
intentGold = vote.intentConsensus;
|
|
111
|
+
secondary = intentGold === null ? [] : secondary.filter(value => value !== intentGold);
|
|
112
|
+
if ((intentGold !== null && !CATALOGS.intent.some(option => option.id === intentGold))
|
|
113
|
+
|| !validSecondary('intent', intentGold, secondary)) {
|
|
114
|
+
throw new Error(`${path.basename(consensusFile)} has an invalid intent consensus`);
|
|
115
|
+
}
|
|
116
|
+
intent = { gold: intentGold, secondary };
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (gold === null && intent) intent = { gold: null, secondary: [] };
|
|
120
|
+
|
|
121
|
+
candidates.push({ prompt, gold, validityGold: textLabel.gold,
|
|
122
|
+
intent });
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const validationText = new Set(candidates.filter(row => row.prompt.split === 'validation').map(row => normalize(row.prompt.text)));
|
|
126
|
+
const retained = [];
|
|
127
|
+
for (const row of candidates) {
|
|
128
|
+
const normalized = normalize(row.prompt.text);
|
|
129
|
+
if (heldOut.has(normalized)) droppedByReason['holdout-overlap']++;
|
|
130
|
+
else if (row.prompt.split === 'train' && validationText.has(normalized)) droppedByReason['split-overlap']++;
|
|
131
|
+
else retained.push(row);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const prompts = retained.map(row => row.prompt);
|
|
135
|
+
const labels = retained.map(row => ({ id: row.prompt.id, gold: row.gold }));
|
|
136
|
+
const validityLabels = retained.map(row => ({ id: row.prompt.id, gold: row.validityGold }));
|
|
137
|
+
const intentRows = retained.filter(row => row.intent).map(row => ({ id: row.prompt.id, ...row.intent }));
|
|
138
|
+
const ids = new Set(prompts.map(row => row.id));
|
|
139
|
+
if (ids.size !== prompts.length || labels.some(row => !ids.has(row.id)) || validityLabels.some(row => !ids.has(row.id)) || intentRows.some(row => !ids.has(row.id))) {
|
|
140
|
+
throw new Error('output id integrity check failed');
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const count = values => Object.fromEntries([...new Set(values)].sort().map(value => [value, values.filter(item => item === value).length]));
|
|
144
|
+
const report = {
|
|
145
|
+
schemaVersion: 1,
|
|
146
|
+
rows: prompts.length,
|
|
147
|
+
split: count(prompts.map(row => row.split)),
|
|
148
|
+
tier: Object.fromEntries(['tier1', 'tier2', 'tier3'].map(value => [value, labels.filter(row => row.gold === value).length])),
|
|
149
|
+
invalid: validityLabels.filter(row => row.gold === null).length,
|
|
150
|
+
tierNull: labels.filter(row => row.gold === null).length,
|
|
151
|
+
droppedByReason,
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
outDir = assertPrivateDataDir(outDir, { allowSyntheticBuildRoot: syntheticBuildRoot });
|
|
155
|
+
validityOutDir = assertPrivateDataDir(validityOutDir, { allowSyntheticBuildRoot: syntheticBuildRoot });
|
|
156
|
+
writeJsonl(path.join(outDir, 'prompts.jsonl'), prompts);
|
|
157
|
+
writeJsonl(path.join(outDir, 'labels.jsonl'), labels);
|
|
158
|
+
writeJsonl(path.join(outDir, 'labels-intent.jsonl'), intentRows);
|
|
159
|
+
writeJsonl(path.join(validityOutDir, 'prompts.jsonl'), prompts);
|
|
160
|
+
writeJsonl(path.join(validityOutDir, 'labels.jsonl'), validityLabels);
|
|
161
|
+
writeJson(path.join(outDir, 'report.json'), report);
|
|
162
|
+
return report;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
module.exports = { buildDataset, defaultHoldouts, holdoutTexts, normalize };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('node:fs');
|
|
4
|
+
const path = require('node:path');
|
|
5
|
+
const { REPO, readJsonl, writeJsonl, writeJson, runNode, assertPrivateDataDir } = require('./common');
|
|
6
|
+
const observations = require('../../hooks/scripts/lib/observations');
|
|
7
|
+
const { importStore } = require('../system-one-observations-import-store');
|
|
8
|
+
|
|
9
|
+
function collect({ dataDir, since, sessionsDir }) {
|
|
10
|
+
const privateDir = assertPrivateDataDir(dataDir);
|
|
11
|
+
if (typeof since !== 'string' || !/^\d{4}-\d{2}-\d{2}$/.test(since)) throw new Error('collect requires --since YYYY-MM-DD');
|
|
12
|
+
const training = path.join(privateDir, 'training');
|
|
13
|
+
const store = path.join(training, 'observation-store');
|
|
14
|
+
const observed = path.join(training, 'observed');
|
|
15
|
+
const importer = path.join(REPO, 'scripts', 'system-one-observations-import-codex-sessions.js');
|
|
16
|
+
const exporter = path.join(REPO, 'scripts', 'system-one-observations-export.js');
|
|
17
|
+
const importArgs = ['--store', store, '--since', since];
|
|
18
|
+
if (sessionsDir) importArgs.push('--sessions', sessionsDir);
|
|
19
|
+
const importStartedAt = new Date().toISOString();
|
|
20
|
+
let codexStatus = 'ok';
|
|
21
|
+
try { runNode(importer, importArgs); }
|
|
22
|
+
catch { codexStatus = 'error'; }
|
|
23
|
+
const live = importStore({ sourceRoot: observations.storeRoot(), store, since });
|
|
24
|
+
const importReportFile = path.join(observed, 'import-report.json');
|
|
25
|
+
writeJson(importReportFile, {
|
|
26
|
+
schemaVersion: 1,
|
|
27
|
+
run: { startedAt: importStartedAt },
|
|
28
|
+
sources: { live: live.source, codex: { status: codexStatus } },
|
|
29
|
+
byHost: live.byHost,
|
|
30
|
+
});
|
|
31
|
+
if (codexStatus !== 'ok' || live.source.status === 'error') {
|
|
32
|
+
throw new Error('observation import incomplete; see import-report.json');
|
|
33
|
+
}
|
|
34
|
+
runNode(exporter, ['--store', store, '--out', observed, '--self-report-only', '--since', since]);
|
|
35
|
+
|
|
36
|
+
const promptsFile = path.join(observed, 'prompts-observed.jsonl');
|
|
37
|
+
const labelsFile = path.join(observed, 'labels-observed.jsonl');
|
|
38
|
+
const prompts = readJsonl(promptsFile).map(row => {
|
|
39
|
+
for (const key of ['id', 'family', 'source', 'split', 'text']) {
|
|
40
|
+
if (typeof row?.[key] !== 'string') throw new Error(`collected row is missing ${key}`);
|
|
41
|
+
}
|
|
42
|
+
return { id: row.id, family: row.family, source: row.source, split: row.split, text: row.text };
|
|
43
|
+
});
|
|
44
|
+
const labels = readJsonl(labelsFile).map(row => ({
|
|
45
|
+
id: row.id,
|
|
46
|
+
tier: row.tier ?? null,
|
|
47
|
+
intents: Array.isArray(row.intents) ? row.intents : [],
|
|
48
|
+
host: row.host ?? null,
|
|
49
|
+
behaviorEvidence: row.behaviorEvidence || 'unobserved',
|
|
50
|
+
contradictions: Array.isArray(row.contradictions) ? row.contradictions : [],
|
|
51
|
+
}));
|
|
52
|
+
writeJsonl(promptsFile, prompts);
|
|
53
|
+
writeJsonl(labelsFile, labels);
|
|
54
|
+
const exportReportFile = path.join(observed, 'export-report.json');
|
|
55
|
+
const exported = JSON.parse(fs.readFileSync(exportReportFile, 'utf8'));
|
|
56
|
+
writeJson(exportReportFile, Object.fromEntries(['schemaVersion', 'records', 'exported', 'skippedBeforeSince', 'skippedUnlabeled',
|
|
57
|
+
'skippedNoText', 'validationRows', 'withSelfReport', 'hostAcceptance'].filter(key => Object.hasOwn(exported, key)).map(key => [key, exported[key]])));
|
|
58
|
+
for (const dir of [training, path.dirname(store), store, observed]) {
|
|
59
|
+
try { fs.chmodSync(dir, 0o700); } catch { /* Windows does not expose POSIX modes. */ }
|
|
60
|
+
}
|
|
61
|
+
for (const file of [promptsFile, labelsFile, path.join(observed, 'export-report.json'), importReportFile]) {
|
|
62
|
+
try { if (fs.existsSync(file)) fs.chmodSync(file, 0o600); } catch { /* Windows does not expose POSIX modes. */ }
|
|
63
|
+
}
|
|
64
|
+
return { prompts: prompts.length, selfLabels: labels.length, since };
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
module.exports = { collect };
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('node:fs');
|
|
4
|
+
const path = require('node:path');
|
|
5
|
+
const { spawnSync } = require('node:child_process');
|
|
6
|
+
|
|
7
|
+
const REPO = path.resolve(__dirname, '../..');
|
|
8
|
+
const STEPS = ['collect', 'label', 'judge', 'build', 'train', 'evaluate', 'package', 'publish'];
|
|
9
|
+
|
|
10
|
+
function readJsonl(file, optional = false) {
|
|
11
|
+
if (optional && !fs.existsSync(file)) return [];
|
|
12
|
+
return fs.readFileSync(file, 'utf8').split(/\r?\n/).filter(Boolean).map((line, index) => {
|
|
13
|
+
try { return JSON.parse(line); }
|
|
14
|
+
catch { throw new Error(`${path.basename(file)} line ${index + 1} is not valid JSON`); }
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function writeJsonl(file, rows, { append = false } = {}) {
|
|
19
|
+
fs.mkdirSync(path.dirname(file), { recursive: true, mode: 0o700 });
|
|
20
|
+
const body = rows.map(row => JSON.stringify(row)).join('\n') + (rows.length ? '\n' : '');
|
|
21
|
+
if (append) fs.appendFileSync(file, body, { mode: 0o600 });
|
|
22
|
+
else fs.writeFileSync(file, body, { mode: 0o600 });
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function writeJson(file, value) {
|
|
26
|
+
fs.mkdirSync(path.dirname(file), { recursive: true, mode: 0o700 });
|
|
27
|
+
fs.writeFileSync(file, `${JSON.stringify(value, null, 2)}\n`, { mode: 0o600 });
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function parseFlags(args) {
|
|
31
|
+
const flags = {};
|
|
32
|
+
for (let i = 0; i < args.length; i++) {
|
|
33
|
+
const token = args[i];
|
|
34
|
+
if (!token.startsWith('--')) throw new Error('unexpected positional argument');
|
|
35
|
+
const key = token.slice(2);
|
|
36
|
+
const value = args[i + 1] && !args[i + 1].startsWith('--') ? args[++i] : true;
|
|
37
|
+
if (Object.hasOwn(flags, key)) flags[key] = Array.isArray(flags[key]) ? [...flags[key], value] : [flags[key], value];
|
|
38
|
+
else flags[key] = value;
|
|
39
|
+
}
|
|
40
|
+
return flags;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function flag(flags, name, fallback) {
|
|
44
|
+
const value = flags[name];
|
|
45
|
+
return value === undefined ? fallback : Array.isArray(value) ? value.at(-1) : value;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function required(flags, name) {
|
|
49
|
+
const value = flag(flags, name);
|
|
50
|
+
if (typeof value !== 'string' || !value.trim()) throw new Error(`--${name} is required`);
|
|
51
|
+
return value;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function dataPath(dataDir, ...parts) {
|
|
55
|
+
return path.join(path.resolve(dataDir), ...parts);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function readState(dataDir) {
|
|
59
|
+
const file = dataPath(dataDir, 'cycle-state.json');
|
|
60
|
+
if (!fs.existsSync(file)) return { schemaVersion: 1, steps: {} };
|
|
61
|
+
const state = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
62
|
+
if (state.schemaVersion !== 1 || !state.steps || typeof state.steps !== 'object') throw new Error('invalid cycle-state.json');
|
|
63
|
+
return state;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function stepComplete(dataDir, step) {
|
|
67
|
+
const entry = readState(dataDir).steps[step];
|
|
68
|
+
return !!entry && typeof entry.completedAt === 'string'
|
|
69
|
+
&& (!Array.isArray(entry.outputs) || entry.outputs.every(file => fs.existsSync(dataPath(dataDir, file))));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function markStep(dataDir, step, outputs = []) {
|
|
73
|
+
const state = readState(dataDir);
|
|
74
|
+
state.steps[step] = { completedAt: new Date().toISOString(), outputs };
|
|
75
|
+
writeJson(dataPath(dataDir, 'cycle-state.json'), state);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function runNode(script, args, { cwd = REPO, env = process.env } = {}) {
|
|
79
|
+
const result = spawnSync(process.execPath, [script, ...args], { cwd, env, stdio: 'ignore', windowsHide: true });
|
|
80
|
+
if (result.error || result.status !== 0) throw new Error(`${path.basename(script)} failed${result.status === null ? '' : ` (${result.status})`}`);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function canonicalDestination(destination) {
|
|
84
|
+
let current = path.resolve(destination);
|
|
85
|
+
const missing = [];
|
|
86
|
+
while (true) {
|
|
87
|
+
try { return path.join(fs.realpathSync.native(current), ...missing.reverse()); }
|
|
88
|
+
catch (error) {
|
|
89
|
+
if (error.code !== 'ENOENT') throw error;
|
|
90
|
+
let exists = false;
|
|
91
|
+
try { fs.lstatSync(current); exists = true; }
|
|
92
|
+
catch (statError) { if (statError.code !== 'ENOENT') throw statError; }
|
|
93
|
+
if (exists) throw error;
|
|
94
|
+
const parent = path.dirname(current);
|
|
95
|
+
if (parent === current) throw error;
|
|
96
|
+
missing.push(path.basename(current));
|
|
97
|
+
current = parent;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function isWithin(root, target) {
|
|
103
|
+
const relative = path.relative(root, target);
|
|
104
|
+
return relative === '' || (!relative.startsWith(`..${path.sep}`) && relative !== '..' && !path.isAbsolute(relative));
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function isSyntheticBuildDataDir(target, repo = fs.realpathSync.native(REPO)) {
|
|
108
|
+
const relative = path.relative(repo, target);
|
|
109
|
+
return relative.startsWith(`.s1-work${path.sep}`) && !path.isAbsolute(relative);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function assertPrivateDataDir(dataDir, { allowSyntheticBuildRoot = false, create = true } = {}) {
|
|
113
|
+
const repo = fs.realpathSync.native(REPO);
|
|
114
|
+
const assertAllowed = target => {
|
|
115
|
+
if (isWithin(repo, target) && !(allowSyntheticBuildRoot && isSyntheticBuildDataDir(target, repo))) {
|
|
116
|
+
throw new Error('private cycle data must be stored outside the repository');
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
let target = canonicalDestination(dataDir);
|
|
120
|
+
assertAllowed(target);
|
|
121
|
+
if (create) {
|
|
122
|
+
fs.mkdirSync(dataDir, { recursive: true, mode: 0o700 });
|
|
123
|
+
target = canonicalDestination(dataDir);
|
|
124
|
+
assertAllowed(target);
|
|
125
|
+
if (process.platform !== 'win32') fs.chmodSync(target, 0o700);
|
|
126
|
+
}
|
|
127
|
+
return target;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function assertPrivateHistoryFile(file) {
|
|
131
|
+
if (typeof file !== 'string' || !file.trim()) throw new Error('private history path must be nonempty');
|
|
132
|
+
let target;
|
|
133
|
+
try { target = canonicalDestination(file); }
|
|
134
|
+
catch { throw new Error('invalid private history path'); }
|
|
135
|
+
const repo = fs.realpathSync.native(REPO);
|
|
136
|
+
if (isWithin(repo, target)) throw new Error('private history must be stored outside the repository');
|
|
137
|
+
try {
|
|
138
|
+
if (!fs.statSync(target).isFile()) throw new Error('private history path must name a file');
|
|
139
|
+
} catch (error) {
|
|
140
|
+
if (error.code !== 'ENOENT') throw error;
|
|
141
|
+
}
|
|
142
|
+
return target;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function appendPrivateHistory(file, text) {
|
|
146
|
+
const target = assertPrivateHistoryFile(file);
|
|
147
|
+
fs.mkdirSync(path.dirname(target), { recursive: true, mode: 0o700 });
|
|
148
|
+
let separator = '';
|
|
149
|
+
try {
|
|
150
|
+
const fd = fs.openSync(assertPrivateHistoryFile(target), 'r');
|
|
151
|
+
try {
|
|
152
|
+
const size = fs.fstatSync(fd).size;
|
|
153
|
+
if (size) {
|
|
154
|
+
const lastByte = Buffer.alloc(1);
|
|
155
|
+
fs.readSync(fd, lastByte, 0, 1, size - 1);
|
|
156
|
+
if (lastByte[0] !== 0x0a) separator = '\n';
|
|
157
|
+
}
|
|
158
|
+
} finally {
|
|
159
|
+
fs.closeSync(fd);
|
|
160
|
+
}
|
|
161
|
+
} catch (error) {
|
|
162
|
+
if (error.code !== 'ENOENT') throw error;
|
|
163
|
+
}
|
|
164
|
+
fs.appendFileSync(assertPrivateHistoryFile(target), `${separator}${text}`, { encoding: 'utf8', mode: 0o600 });
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function resultSummary(step, details) {
|
|
168
|
+
return { step, ...details };
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
module.exports = {
|
|
172
|
+
REPO, STEPS, readJsonl, writeJsonl, writeJson, parseFlags, flag, required, dataPath,
|
|
173
|
+
readState, stepComplete, markStep, runNode, assertPrivateDataDir, assertPrivateHistoryFile,
|
|
174
|
+
appendPrivateHistory, isSyntheticBuildDataDir, resultSummary,
|
|
175
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('node:fs');
|
|
4
|
+
const os = require('node:os');
|
|
5
|
+
const path = require('node:path');
|
|
6
|
+
const { spawn } = require('node:child_process');
|
|
7
|
+
|
|
8
|
+
const MAX_OUTPUT = 2 * 1024 * 1024;
|
|
9
|
+
|
|
10
|
+
function capture(command, args, prompt, { cwd = process.cwd(), env = process.env, shell = false } = {}) {
|
|
11
|
+
return new Promise((resolve, reject) => {
|
|
12
|
+
let output = '';
|
|
13
|
+
let settled = false;
|
|
14
|
+
const child = spawn(command, args, { cwd, env, shell, windowsHide: true, stdio: ['pipe', 'pipe', 'ignore'] });
|
|
15
|
+
const finish = (error, value) => {
|
|
16
|
+
if (settled) return;
|
|
17
|
+
settled = true;
|
|
18
|
+
clearTimeout(timer);
|
|
19
|
+
if (error) reject(error); else resolve(value);
|
|
20
|
+
};
|
|
21
|
+
const timer = setTimeout(() => { child.kill(); finish(new Error('engine-timeout')); }, 600000);
|
|
22
|
+
child.on('error', () => finish(new Error('engine-unavailable')));
|
|
23
|
+
child.stdout.on('data', chunk => {
|
|
24
|
+
output += chunk;
|
|
25
|
+
if (Buffer.byteLength(output, 'utf8') > MAX_OUTPUT) {
|
|
26
|
+
child.kill(); finish(new Error('engine-output-limit'));
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
child.on('close', code => code === 0 ? finish(null, output) : finish(new Error('engine-failed')));
|
|
30
|
+
child.stdin.end(prompt);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async function runStructured(engine, prompt, schema, { model } = {}) {
|
|
35
|
+
if (engine === 'luna') {
|
|
36
|
+
const temp = fs.mkdtempSync(path.join(os.tmpdir(), 'system-one-cycle-engine-'));
|
|
37
|
+
const schemaFile = path.join(temp, 'schema.json');
|
|
38
|
+
const outputFile = path.join(temp, 'reply.json');
|
|
39
|
+
fs.writeFileSync(schemaFile, JSON.stringify(typeof schema === 'string' ? JSON.parse(schema) : schema));
|
|
40
|
+
try {
|
|
41
|
+
await capture('codex', [
|
|
42
|
+
'exec', '--model', model || 'gpt-6-luna', '-c', 'model_reasoning_effort=high', '--sandbox', 'read-only',
|
|
43
|
+
'--skip-git-repo-check', '--ephemeral', '--ignore-user-config', '--output-schema', schemaFile,
|
|
44
|
+
'-o', outputFile, '-C', temp, '-',
|
|
45
|
+
], prompt, { cwd: temp, shell: process.platform === 'win32' });
|
|
46
|
+
return JSON.parse(fs.readFileSync(outputFile, 'utf8'));
|
|
47
|
+
} catch {
|
|
48
|
+
throw new Error('luna-engine-failed');
|
|
49
|
+
} finally {
|
|
50
|
+
fs.rmSync(temp, { recursive: true, force: true });
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (engine === 'opencode') {
|
|
55
|
+
const output = await capture('opencode', ['run', '--title', 'system-one-cycle-judge', 'Return only the JSON object requested on standard input.'],
|
|
56
|
+
prompt, { shell: process.platform === 'win32' });
|
|
57
|
+
try { return JSON.parse(output.trim()); } catch { throw new Error('engine-invalid-json'); }
|
|
58
|
+
}
|
|
59
|
+
throw new Error('unknown-label-engine');
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
module.exports = { runStructured };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('node:fs');
|
|
4
|
+
const path = require('node:path');
|
|
5
|
+
const { spawnSync } = require('node:child_process');
|
|
6
|
+
const { REPO, dataPath, writeJson, assertPrivateDataDir, assertPrivateHistoryFile } = require('./common');
|
|
7
|
+
const { buildVersion } = require('./package');
|
|
8
|
+
const { TASKS } = require('./train');
|
|
9
|
+
const { validateVersionManifest } = require('../../harness-everything/scripts/system-one/manifest');
|
|
10
|
+
|
|
11
|
+
const HOLDOUTS = { validity: 'system-one-holdout.json', tier: 'system-one-holdout.json', intent: 'system-one-intent-holdout.json' };
|
|
12
|
+
|
|
13
|
+
function runProcess(command, args) {
|
|
14
|
+
const result = spawnSync(command, args, { cwd: REPO, stdio: 'ignore', windowsHide: true,
|
|
15
|
+
env: { ...process.env, HARNESS_SYSTEM_ONE_NODE: process.execPath } });
|
|
16
|
+
if (result.error || result.status !== 0) throw new Error(`${path.basename(command)} failed${result.status === null ? '' : ` (${result.status})`}`);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function pythonExecutable() {
|
|
20
|
+
return process.env.PYTHON || (process.platform === 'win32' ? 'python' : 'python3');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function recordEvaluation(manifestFile, version) {
|
|
24
|
+
const manifest = JSON.parse(fs.readFileSync(manifestFile, 'utf8'));
|
|
25
|
+
validateVersionManifest(manifest, version);
|
|
26
|
+
manifest.evaluation = 'evaluation/curves.json';
|
|
27
|
+
validateVersionManifest(manifest, version);
|
|
28
|
+
writeJson(manifestFile, manifest);
|
|
29
|
+
return manifest;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function evaluateCycle({ dataDir, version, history: historyOption }) {
|
|
33
|
+
const privateDir = assertPrivateDataDir(dataDir);
|
|
34
|
+
const history = assertPrivateHistoryFile(historyOption === undefined
|
|
35
|
+
? dataPath(privateDir, 'training', 'history.jsonl') : historyOption);
|
|
36
|
+
const source = dataPath(privateDir, 'training', 'runs', version);
|
|
37
|
+
const versionDir = dataPath(privateDir, 'training', 'candidates', version);
|
|
38
|
+
const evaluationDir = path.join(versionDir, 'evaluation');
|
|
39
|
+
const curvesFile = path.join(evaluationDir, 'curves.json');
|
|
40
|
+
const trendFile = path.join(evaluationDir, 'trend.json');
|
|
41
|
+
const curvesScript = path.join(REPO, 'scripts', 'system-one-curves.js');
|
|
42
|
+
if (!fs.existsSync(curvesScript)) throw new Error('contract C curves CLI is not available in this checkout');
|
|
43
|
+
if (fs.existsSync(curvesFile) && fs.existsSync(trendFile)) {
|
|
44
|
+
runProcess(process.execPath, [curvesScript, '--version', version, '--version-dir', versionDir,
|
|
45
|
+
'--history', history, '--out', evaluationDir, '--resume-curves', curvesFile]);
|
|
46
|
+
const manifestFile = path.join(versionDir, 'manifest.json');
|
|
47
|
+
recordEvaluation(manifestFile, version);
|
|
48
|
+
const trend = JSON.parse(fs.readFileSync(trendFile, 'utf8'));
|
|
49
|
+
return { version, verdict: trend.verdict, compared: trend.compared.length, resumed: true };
|
|
50
|
+
}
|
|
51
|
+
buildVersion({ dataDir: privateDir, version, sourceDir: source, versionDir });
|
|
52
|
+
|
|
53
|
+
fs.mkdirSync(evaluationDir, { recursive: true, mode: 0o700 });
|
|
54
|
+
const scoreScript = path.join(__dirname, 'score.py');
|
|
55
|
+
const holdoutDir = path.join(REPO, 'benchmarks', 'fixtures');
|
|
56
|
+
const curvesArgs = ['--version', version, '--version-dir', versionDir];
|
|
57
|
+
for (const task of TASKS) {
|
|
58
|
+
const heldOut = path.join(holdoutDir, HOLDOUTS[task]);
|
|
59
|
+
const scores = path.join(evaluationDir, `${task}-holdout-scores.jsonl`);
|
|
60
|
+
runProcess(pythonExecutable(), [scoreScript, '--weights', path.join(versionDir, `${task}.safetensors`), '--holdout', heldOut, '--task', task, '--out', scores]);
|
|
61
|
+
curvesArgs.push('--val-scores', `${task}=${path.join(source, task, 'val-scores.jsonl')}`);
|
|
62
|
+
curvesArgs.push('--holdout-scores', `${task}=${scores}`);
|
|
63
|
+
}
|
|
64
|
+
curvesArgs.push('--history', history, '--out', evaluationDir);
|
|
65
|
+
runProcess(process.execPath, [curvesScript, ...curvesArgs]);
|
|
66
|
+
|
|
67
|
+
const manifestFile = path.join(versionDir, 'manifest.json');
|
|
68
|
+
recordEvaluation(manifestFile, version);
|
|
69
|
+
const trend = JSON.parse(fs.readFileSync(path.join(evaluationDir, 'trend.json'), 'utf8'));
|
|
70
|
+
return { version, verdict: trend.verdict, compared: trend.compared.length };
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
module.exports = { evaluateCycle, HOLDOUTS };
|