harness-everything 0.56.0 → 0.57.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/CHANGELOG.md +23 -0
- package/benchmarks/results/live-host/claude-2026-11-21-ledger-lesson/README.md +33 -0
- package/benchmarks/results/live-host/claude-2026-11-21-ledger-lesson/trace.jsonl +13 -0
- package/ci/fixtures/394-claude-ledger-lesson/post-tool-use-failure.json +13 -0
- package/ci/fixtures/394-claude-ledger-lesson/pre-tool-use.json +10 -0
- package/ci/fixtures/394-codex-ledger-lesson/post-tool-use-failure.json +17 -0
- package/ci/fixtures/394-codex-ledger-lesson/post-tool-use-success.json +17 -0
- package/ci/fixtures/394-codex-ledger-lesson/post-tool-use-unknown.json +15 -0
- package/ci/fixtures/394-codex-ledger-lesson/pre-tool-use.json +12 -0
- package/ci/fixtures/394-ledger-match/commitlint-empty-subject.txt +5 -0
- package/ci/fixtures/394-ledger-match/commitlint-subject-case.txt +5 -0
- package/ci/fixtures/394-ledger-match/provisional-candidates.json +20 -0
- package/ci/fixtures/394-ledger-match/quoted-match-record.md +25 -0
- package/ci/fixtures/468-dispatch/runner.js +30 -4
- package/ci/mechanism-394-claude-ledger-lesson.test.js +176 -0
- package/ci/mechanism-394-codex-ledger-lesson.test.js +203 -0
- package/ci/mechanism-394-ledger-match.test.js +507 -0
- package/ci/mechanism-394-opencode-ledger-lesson.test.js +232 -0
- package/ci/mechanism-468-dispatch-cli.test.js +143 -5
- package/ci/mechanism-errors-sync-root.test.js +86 -4
- package/ci/mechanism-report-writer.test.js +13 -1
- package/docs/adr/ROUTE-001-error-lesson-delivery.md +52 -49
- package/docs/error-handling/details/c8-dispatch-cli.md +8 -4
- package/docs/governed-index.md +1 -1
- package/docs/platform-capabilities.md +4 -0
- package/hooks/hooks.json +22 -0
- package/hooks/scripts/codex-ledger-lesson.js +82 -0
- package/hooks/scripts/ledger-lesson.js +94 -0
- package/hooks/scripts/lib/ledger-match.js +452 -0
- package/opencode-plugin/index.mjs +113 -4
- 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/hooks.json +24 -0
- package/plugins/harness-everything/hooks/scripts/codex-ledger-lesson.js +82 -0
- package/plugins/harness-everything/hooks/scripts/ledger-lesson.js +94 -0
- package/plugins/harness-everything/hooks/scripts/lib/ledger-match.js +452 -0
- package/plugins/harness-everything/plugin.json +1 -1
- package/sbom.cdx.json +7 -7
- package/scripts/dispatch.js +31 -7
- package/scripts/errors-sync.js +63 -2
- package/scripts/report-writer.js +4 -2
package/sbom.cdx.json
CHANGED
|
@@ -2,23 +2,23 @@
|
|
|
2
2
|
"$schema": "https://cyclonedx.org/schema/bom-1.7.schema.json",
|
|
3
3
|
"bomFormat": "CycloneDX",
|
|
4
4
|
"specVersion": "1.7",
|
|
5
|
-
"serialNumber": "urn:uuid:
|
|
5
|
+
"serialNumber": "urn:uuid:2131acf7-9d59-5a11-b9a7-17ab1d7a663c",
|
|
6
6
|
"version": 1,
|
|
7
7
|
"metadata": {
|
|
8
|
-
"timestamp": "2026-11-
|
|
8
|
+
"timestamp": "2026-11-21T18:48:38.599Z",
|
|
9
9
|
"tools": [
|
|
10
10
|
{
|
|
11
11
|
"vendor": "Harness Everything",
|
|
12
12
|
"name": "generate-sbom.js",
|
|
13
|
-
"version": "0.
|
|
13
|
+
"version": "0.57.0"
|
|
14
14
|
}
|
|
15
15
|
],
|
|
16
16
|
"component": {
|
|
17
17
|
"type": "application",
|
|
18
|
-
"bom-ref": "pkg:npm/harness-everything@0.
|
|
18
|
+
"bom-ref": "pkg:npm/harness-everything@0.57.0",
|
|
19
19
|
"name": "harness-everything",
|
|
20
|
-
"version": "0.
|
|
21
|
-
"purl": "pkg:npm/harness-everything@0.
|
|
20
|
+
"version": "0.57.0",
|
|
21
|
+
"purl": "pkg:npm/harness-everything@0.57.0"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"components": [
|
|
@@ -2033,7 +2033,7 @@
|
|
|
2033
2033
|
]
|
|
2034
2034
|
},
|
|
2035
2035
|
{
|
|
2036
|
-
"ref": "pkg:npm/harness-everything@0.
|
|
2036
|
+
"ref": "pkg:npm/harness-everything@0.57.0",
|
|
2037
2037
|
"dependsOn": [
|
|
2038
2038
|
"pkg:npm/%40commitlint/cli@19.8.1",
|
|
2039
2039
|
"pkg:npm/%40commitlint/config-conventional@19.8.1",
|
package/scripts/dispatch.js
CHANGED
|
@@ -6,8 +6,9 @@ const fs = require('node:fs');
|
|
|
6
6
|
const path = require('node:path');
|
|
7
7
|
|
|
8
8
|
const REPORT_WRITER = path.join(__dirname, 'report-writer.js');
|
|
9
|
-
const USAGE = 'Usage: dispatch --runner <codex|opencode> --model <id> --packet <path> --worktree <path> --scratch <absolute-path> --report <path> [--dry-run] [--json] [--help]';
|
|
10
|
-
const VALUE_OPTIONS = new Set(['--runner', '--model', '--packet', '--worktree', '--scratch', '--report']);
|
|
9
|
+
const USAGE = 'Usage: dispatch --runner <codex|opencode> --model <id> --packet <path> --worktree <path> --scratch <absolute-path> --report <path> [--effort <low|medium|high|xhigh>] [--dry-run] [--json] [--help]';
|
|
10
|
+
const VALUE_OPTIONS = new Set(['--runner', '--model', '--packet', '--worktree', '--scratch', '--report', '--effort']);
|
|
11
|
+
const CODEX_EFFORTS = new Set(['low', 'medium', 'high', 'xhigh']);
|
|
11
12
|
let evidencePaths = {};
|
|
12
13
|
|
|
13
14
|
class DispatchFailure extends Error {
|
|
@@ -116,6 +117,9 @@ function validateInput(options) {
|
|
|
116
117
|
const model = options['--model'];
|
|
117
118
|
if (!['codex', 'opencode'].includes(runner)) fail(10, 'INVALID_INPUT', 'input', '--runner must be codex or opencode');
|
|
118
119
|
if (!model || !model.trim()) fail(10, 'INVALID_INPUT', 'input', '--model must be a nonempty id');
|
|
120
|
+
const effort = options['--effort'];
|
|
121
|
+
if (effort !== undefined && runner !== 'codex') fail(10, 'INVALID_INPUT', 'input', '--effort is only supported for codex');
|
|
122
|
+
if (effort !== undefined && !CODEX_EFFORTS.has(effort)) fail(10, 'INVALID_INPUT', 'input', '--effort must be low, medium, high, or xhigh');
|
|
119
123
|
for (const flag of ['--packet', '--worktree', '--scratch', '--report']) {
|
|
120
124
|
if (!options[flag]) fail(10, 'INVALID_INPUT', 'input', `missing required option: ${flag}`);
|
|
121
125
|
}
|
|
@@ -133,7 +137,7 @@ function validateInput(options) {
|
|
|
133
137
|
}
|
|
134
138
|
if (fs.existsSync(report)) fail(10, 'INVALID_INPUT', 'input', '--report already exists; choose a fresh report path');
|
|
135
139
|
const scratch = validateScratch(options['--scratch']);
|
|
136
|
-
return { runner, model: model.trim(), packet, worktree, scratch, report };
|
|
140
|
+
return { runner, model: model.trim(), effort, packet, worktree, scratch, report };
|
|
137
141
|
}
|
|
138
142
|
|
|
139
143
|
function response(options, outcome, evidence = evidencePaths, input) {
|
|
@@ -148,6 +152,7 @@ function response(options, outcome, evidence = evidencePaths, input) {
|
|
|
148
152
|
const model = input?.model ?? options['--model'];
|
|
149
153
|
if (runner === 'codex' || runner === 'opencode') result.runner = runner;
|
|
150
154
|
if (model) result.model = model;
|
|
155
|
+
if (input?.effort) result.effort = input.effort;
|
|
151
156
|
if (outcome.argv) result.argv = outcome.argv;
|
|
152
157
|
if (outcome.cwd) result.cwd = outcome.cwd;
|
|
153
158
|
const paths = Object.fromEntries(Object.entries(evidence).filter(([, value]) => value && fs.existsSync(value)));
|
|
@@ -185,7 +190,7 @@ function runChild(command, args, worktree, scratch, logPath, timeout, appendLog
|
|
|
185
190
|
|
|
186
191
|
function runnerArgs(input, prompt, outputPath) {
|
|
187
192
|
if (input.runner === 'codex') {
|
|
188
|
-
return ['exec', '-m', input.model, '-s', 'workspace-write', '-C', input.worktree, '-o', outputPath, prompt];
|
|
193
|
+
return ['exec', '-m', input.model, ...(input.effort ? ['-c', `model_reasoning_effort="${input.effort}"`] : []), '-s', 'workspace-write', '-C', input.worktree, '-o', outputPath, prompt];
|
|
189
194
|
}
|
|
190
195
|
return ['run', '--auto', '-m', input.model, prompt];
|
|
191
196
|
}
|
|
@@ -201,6 +206,21 @@ const READINESS_DIAGNOSTICS = {
|
|
|
201
206
|
],
|
|
202
207
|
};
|
|
203
208
|
|
|
209
|
+
// A Harness host appends one hidden turn-label line to every final message (docs/routing.md).
|
|
210
|
+
function withoutHostLabel(text) {
|
|
211
|
+
const lines = text.split(/\r?\n/);
|
|
212
|
+
const last = lines[lines.length - 1];
|
|
213
|
+
const match = /^<!-- harness-label (\{.*\}) -->$/.exec(last);
|
|
214
|
+
if (!match || lines.length < 2) return text;
|
|
215
|
+
try {
|
|
216
|
+
const value = JSON.parse(match[1]);
|
|
217
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) return text;
|
|
218
|
+
} catch {
|
|
219
|
+
return text;
|
|
220
|
+
}
|
|
221
|
+
return lines.slice(0, -1).join('\n').trim();
|
|
222
|
+
}
|
|
223
|
+
|
|
204
224
|
function readinessDiagnostic(runner, stderr) {
|
|
205
225
|
const output = stderr.replace(/\u001b\[[0-?]*[ -/]*[@-~]/g, '');
|
|
206
226
|
const lines = output.split(/\r?\n/);
|
|
@@ -210,7 +230,7 @@ function readinessDiagnostic(runner, stderr) {
|
|
|
210
230
|
|
|
211
231
|
function readiness(input, paths) {
|
|
212
232
|
const outputPath = input.runner === 'codex' ? paths.readinessOutput : null;
|
|
213
|
-
const prompt = 'Reply
|
|
233
|
+
const prompt = 'Reply with the single word READY';
|
|
214
234
|
const result = runChild(input.runner, runnerArgs(input, prompt, outputPath), input.worktree, input.scratch, paths.readinessLog, 120000);
|
|
215
235
|
if (result.status !== 0) {
|
|
216
236
|
const diagnostic = Number.isInteger(result.status) && result.status !== 0 && !result.signal && !result.error
|
|
@@ -222,13 +242,17 @@ function readiness(input, paths) {
|
|
|
222
242
|
const answer = input.runner === 'codex'
|
|
223
243
|
? (fs.existsSync(outputPath) ? fs.readFileSync(outputPath, 'utf8').trim() : '')
|
|
224
244
|
: result.stdout.trim();
|
|
225
|
-
|
|
245
|
+
const reply = withoutHostLabel(answer);
|
|
246
|
+
if (reply !== 'READY' && reply !== 'READY.') fail(12, 'NOT_READY', 'readiness', 'Readiness failed. Keep the available child evidence.');
|
|
226
247
|
}
|
|
227
248
|
|
|
228
249
|
function reportedStatus(raw) {
|
|
229
250
|
const lines = raw.split(/\r?\n/);
|
|
230
251
|
if (lines.at(-1) === '') lines.pop();
|
|
231
|
-
if (lines.at(-1)?.startsWith('<!-- harness-label '))
|
|
252
|
+
if (lines.at(-1)?.startsWith('<!-- harness-label ')) {
|
|
253
|
+
lines.pop();
|
|
254
|
+
while (lines.length && lines.at(-1).trim() === '') lines.pop(); // live codex -o: blank line before the label
|
|
255
|
+
}
|
|
232
256
|
const line = lines.at(-1) || '';
|
|
233
257
|
if (line === 'STATUS: DONE') return { status: 'DONE' };
|
|
234
258
|
const blocked = /^STATUS: BLOCKED: (.+)$/.exec(line);
|
package/scripts/errors-sync.js
CHANGED
|
@@ -17,6 +17,59 @@ const RECORD = /^E-\d{4}-[a-z0-9-]+\.md$/;
|
|
|
17
17
|
const REQUIRED = ['id', 'signature', 'class', 'scope', 'status'];
|
|
18
18
|
const SCOPES = new Set(['in', 'out', 'unresolved']);
|
|
19
19
|
const STATUSES = new Set(['open', 'lesson', 'mechanism']);
|
|
20
|
+
const MATCH_ID = /^[a-z0-9][a-z0-9_-]{0,63}$/;
|
|
21
|
+
|
|
22
|
+
function hasExactKeys(value, expected) {
|
|
23
|
+
const keys = Object.keys(value).sort();
|
|
24
|
+
return keys.length === expected.length && keys.every((key, index) => key === expected[index]);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function isMatchId(value) {
|
|
28
|
+
return typeof value === 'string' && MATCH_ID.test(value);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function parseMatch(match, file) {
|
|
32
|
+
if (!match || typeof match !== 'object' || Array.isArray(match)
|
|
33
|
+
|| Object.keys(match).length === 0 || Object.keys(match).some(key => !['actions', 'failures'].includes(key))) {
|
|
34
|
+
throw new Error(`${file}: invalid match: expected actions and/or failures only`);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const parsed = {};
|
|
38
|
+
for (const phase of ['actions', 'failures']) {
|
|
39
|
+
if (!Object.prototype.hasOwnProperty.call(match, phase)) continue;
|
|
40
|
+
const rules = match[phase];
|
|
41
|
+
if (!Array.isArray(rules) || rules.length < 1 || rules.length > 8) {
|
|
42
|
+
throw new Error(`${file}: invalid match.${phase}: expected 1 to 8 rules`);
|
|
43
|
+
}
|
|
44
|
+
parsed[phase] = rules.map((rule, index) => {
|
|
45
|
+
const failure = phase === 'failures';
|
|
46
|
+
const keys = failure
|
|
47
|
+
? ['diagnostics', 'executable', 'subcommand', 'tool']
|
|
48
|
+
: ['executable', 'subcommand', 'tool'];
|
|
49
|
+
if (!rule || typeof rule !== 'object' || Array.isArray(rule) || !hasExactKeys(rule, keys)) {
|
|
50
|
+
throw new Error(`${file}: invalid match.${phase}[${index}]: rule keys must be exactly ${keys.join(', ')}`);
|
|
51
|
+
}
|
|
52
|
+
if (rule.tool !== 'shell') throw new Error(`${file}: invalid match.${phase}[${index}].tool: expected shell`);
|
|
53
|
+
if (!isMatchId(rule.executable)) {
|
|
54
|
+
throw new Error(`${file}: invalid match.${phase}[${index}].executable: expected a lowercase literal id of 1 to 64 characters`);
|
|
55
|
+
}
|
|
56
|
+
if (!isMatchId(rule.subcommand)) {
|
|
57
|
+
throw new Error(`${file}: invalid match.${phase}[${index}].subcommand: expected a lowercase literal id of 1 to 64 characters`);
|
|
58
|
+
}
|
|
59
|
+
const parsedRule = { tool: 'shell', executable: rule.executable, subcommand: rule.subcommand };
|
|
60
|
+
if (failure) {
|
|
61
|
+
const diagnostics = rule.diagnostics;
|
|
62
|
+
if (!Array.isArray(diagnostics) || diagnostics.length < 1 || diagnostics.length > 16
|
|
63
|
+
|| !diagnostics.every(isMatchId) || new Set(diagnostics).size !== diagnostics.length) {
|
|
64
|
+
throw new Error(`${file}: invalid match.failures[${index}].diagnostics: expected 1 to 16 unique lowercase literal ids of 1 to 64 characters`);
|
|
65
|
+
}
|
|
66
|
+
parsedRule.diagnostics = [...diagnostics];
|
|
67
|
+
}
|
|
68
|
+
return parsedRule;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
return parsed;
|
|
72
|
+
}
|
|
20
73
|
|
|
21
74
|
function errorsDirectory(root) {
|
|
22
75
|
const resolvedRoot = path.resolve(root);
|
|
@@ -62,7 +115,8 @@ function parseRecord(file, dir = DIR) {
|
|
|
62
115
|
const text = fs.readFileSync(path.join(dir, file), 'utf8').replace(/\r\n/g, '\n');
|
|
63
116
|
const match = /^---\n([\s\S]*?)\n---\n/.exec(text);
|
|
64
117
|
if (!match) throw new Error(`${file}: missing YAML frontmatter`);
|
|
65
|
-
const
|
|
118
|
+
const rawFrontmatter = match[1].replace(/\r\n?/g, '\n');
|
|
119
|
+
const meta = yaml.load(rawFrontmatter);
|
|
66
120
|
if (!meta || typeof meta !== 'object') throw new Error(`${file}: frontmatter is not a mapping`);
|
|
67
121
|
for (const key of REQUIRED) {
|
|
68
122
|
if (meta[key] === undefined || meta[key] === null || meta[key] === '') throw new Error(`${file}: missing ${key}`);
|
|
@@ -71,7 +125,7 @@ function parseRecord(file, dir = DIR) {
|
|
|
71
125
|
if (!SCOPES.has(meta.scope)) throw new Error(`${file}: scope must be in, out or unresolved`);
|
|
72
126
|
if (!STATUSES.has(meta.status)) throw new Error(`${file}: status must be open, lesson or mechanism`);
|
|
73
127
|
const episodes = Array.isArray(meta.episodes) ? meta.episodes : [];
|
|
74
|
-
|
|
128
|
+
const record = {
|
|
75
129
|
id: meta.id,
|
|
76
130
|
signature: meta.signature,
|
|
77
131
|
class: meta.class,
|
|
@@ -81,6 +135,7 @@ function parseRecord(file, dir = DIR) {
|
|
|
81
135
|
sites: Array.isArray(meta.sites) ? meta.sites : [],
|
|
82
136
|
violates: meta.violates || null,
|
|
83
137
|
mechanism_ref: meta.mechanism_ref || null,
|
|
138
|
+
...(Object.prototype.hasOwnProperty.call(meta, 'match') ? { match: parseMatch(meta.match, file) } : {}),
|
|
84
139
|
episodes: episodes.length,
|
|
85
140
|
rounds: episodes.map(e => ({
|
|
86
141
|
episode: e.episode || null,
|
|
@@ -90,6 +145,12 @@ function parseRecord(file, dir = DIR) {
|
|
|
90
145
|
})),
|
|
91
146
|
file: path.posix.join('.agents/harness-everything/errors', file),
|
|
92
147
|
};
|
|
148
|
+
if (record.match) {
|
|
149
|
+
record.matchBinding = crypto.createHash('sha256').update(JSON.stringify([
|
|
150
|
+
rawFrontmatter, record.id, record.signature, record.file, record.match
|
|
151
|
+
])).digest('hex');
|
|
152
|
+
}
|
|
153
|
+
return record;
|
|
93
154
|
}
|
|
94
155
|
|
|
95
156
|
function renderDirectory(dir) {
|
package/scripts/report-writer.js
CHANGED
|
@@ -130,10 +130,12 @@ function extractCodexBody(raw, expectedStatus) {
|
|
|
130
130
|
if (controls.length > 1) error(`raw output must contain exactly one STATUS line; found ${controls.length}`);
|
|
131
131
|
if (controls.length === 1) {
|
|
132
132
|
const statusIndex = lines.indexOf(controls[0]);
|
|
133
|
-
|
|
133
|
+
let terminalIndex = lines.length - (strippedLabel ? 2 : 1);
|
|
134
|
+
// Live codex -o output (2026-11-21) puts one blank line between STATUS and the host label.
|
|
135
|
+
while (strippedLabel && terminalIndex > 0 && lines[terminalIndex].value.trim() === '') terminalIndex -= 1;
|
|
134
136
|
if (statusIndex !== terminalIndex) error('raw STATUS must be terminal or immediately before the host label');
|
|
135
137
|
if (controls[0].value !== expectedStatus) error('raw terminal STATUS does not match the requested status');
|
|
136
|
-
if (strippedLabel && !controls[0].eol) error('host label must be on
|
|
138
|
+
if (strippedLabel && !controls[0].eol) error('host label must be on a line after STATUS');
|
|
137
139
|
bodyEnd = controls[0].start;
|
|
138
140
|
}
|
|
139
141
|
|