harness-everything 0.57.1 → 0.57.3
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 +15 -0
- package/ci/mechanism-394-codex-ledger-lesson.test.js +5 -0
- package/ci/mechanism-394-ledger-match.test.js +78 -3
- package/ci/mechanism-394-opencode-ledger-lesson.test.js +50 -4
- package/hooks/scripts/codex-ledger-lesson.js +3 -1
- package/hooks/scripts/lib/ledger-match.js +58 -9
- package/opencode-plugin/index.mjs +10 -7
- 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/codex-ledger-lesson.js +3 -1
- package/plugins/harness-everything/hooks/scripts/lib/ledger-match.js +58 -9
- package/plugins/harness-everything/plugin.json +1 -1
- package/sbom.cdx.json +7 -7
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"name": "harness-everything",
|
|
11
11
|
"source": "./",
|
|
12
12
|
"description": "Harness OS: an orchestrated agent operating system — tier routing, circuit breaker guardrails, verification gates, WAL session memory, and self-evolving workspace rules.",
|
|
13
|
-
"version": "0.57.
|
|
13
|
+
"version": "0.57.3",
|
|
14
14
|
"author": {
|
|
15
15
|
"name": "Miya Daniel"
|
|
16
16
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "harness-everything",
|
|
3
3
|
"description": "Harness OS: an orchestrated agent operating system — tier routing, circuit breaker guardrails, verification gates, WAL session memory, and self-evolving workspace rules.",
|
|
4
|
-
"version": "0.57.
|
|
4
|
+
"version": "0.57.3",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Miya Daniel"
|
|
7
7
|
},
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project are documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.57.3](https://github.com/dyphn1/Harness-everything/compare/v0.57.2...v0.57.3) (2026-11-22)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
* **opencode:** deliver ledger lessons for the live v2 shell tool ([d74ca22](https://github.com/dyphn1/Harness-everything/commit/d74ca22021ccb41b6877d6eaa6673f6af61cfe65)), closes [#509](https://github.com/dyphn1/Harness-everything/issues/509)
|
|
10
|
+
|
|
11
|
+
## [0.57.2](https://github.com/dyphn1/Harness-everything/compare/v0.57.1...v0.57.2) (2026-11-22)
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* **ledger:** match bounded compound commit commands ([3d513ec](https://github.com/dyphn1/Harness-everything/commit/3d513ec32ae1b31068bb208d79535277bc494b03))
|
|
16
|
+
* **ledger:** require a known command outcome ([572b065](https://github.com/dyphn1/Harness-everything/commit/572b065bd5977d97d385b19714af85307cf5f63f))
|
|
17
|
+
|
|
5
18
|
## [0.57.1](https://github.com/dyphn1/Harness-everything/compare/v0.57.0...v0.57.1) (2026-11-22)
|
|
6
19
|
|
|
7
20
|
### Bug Fixes
|
|
@@ -177,6 +190,8 @@ All notable changes to this project are documented in this file.
|
|
|
177
190
|
|
|
178
191
|
## [Unreleased]
|
|
179
192
|
|
|
193
|
+
- OpenCode V2: accept the live `shell` tool name alongside `bash` for ledger lesson injection and turn observations, with live-shape mechanism rows (#509).
|
|
194
|
+
|
|
180
195
|
- Error-ledger lesson injection (#394): ledger records gain optional `match` rules; a shared matcher carries matched Cue/Lesson text into Claude Code, Codex and OpenCode V2 context at a `git commit` action and its commitlint failure (mechanism evidence; OpenCode V1 delivery unchecked). ROUTE-001 is superseded.
|
|
181
196
|
|
|
182
197
|
- Retired the Rule-of-3 failure-count breaker on Claude Code, Codex and OpenCode (#394). Hooks no longer count same-signature failures, block tools, demand a reflection report or offer `harness:reset`; legacy breaker state is ignored. Zoom-out is agent-initiated: an agent may reassess on a first meaningful failure and may keep iterating while attempts produce new evidence. Error-ledger lesson injection remains planned under #394.
|
|
@@ -171,6 +171,11 @@ function carrierRoundTrip(run, name) {
|
|
|
171
171
|
success.tool_response.stderr = COMMITLINT_OUTPUT;
|
|
172
172
|
assert.equal(run('PostToolUse', success), '', 'successful exit stays silent even with diagnostic-looking output');
|
|
173
173
|
|
|
174
|
+
const masked = payload('post-tool-use-success.json', root, `${name}-masked-session`);
|
|
175
|
+
masked.tool_input.command = 'git commit -m "Bad Subject"; echo "$?"';
|
|
176
|
+
masked.tool_response.stdout = COMMITLINT_OUTPUT;
|
|
177
|
+
context(run('PostToolUse', masked), 'PostToolUse');
|
|
178
|
+
|
|
174
179
|
const unknown = payload('post-tool-use-unknown.json', root, `${name}-unknown-session`);
|
|
175
180
|
unknown.tool_response.stderr = COMMITLINT_OUTPUT;
|
|
176
181
|
assert.equal(run('PostToolUse', unknown), '', 'unknown exit stays silent despite commitlint-looking output');
|
|
@@ -122,12 +122,16 @@ test('exports the conservative git commit executable/subcommand normalizer', ()
|
|
|
122
122
|
'git status',
|
|
123
123
|
'git merge origin/main',
|
|
124
124
|
'sudo git commit',
|
|
125
|
-
'git commit && echo done',
|
|
126
125
|
'"git commit"'
|
|
127
126
|
]) assert.equal(matcher.normalizeGitCommitCommand(command), null, command);
|
|
128
|
-
|
|
127
|
+
for (const command of [
|
|
128
|
+
'git commit && echo done',
|
|
129
|
+
'echo before; git -C x commit --amend',
|
|
130
|
+
'git -c user.name=Harness commit || echo rejected',
|
|
131
|
+
"git commit -m 'message; with separator'"
|
|
132
|
+
]) assert.deepEqual(matcher.normalizeGitCommitCommand(command), {
|
|
129
133
|
tool: 'shell', executable: 'git', subcommand: 'commit'
|
|
130
|
-
});
|
|
134
|
+
}, command);
|
|
131
135
|
for (const command of [
|
|
132
136
|
'git -C x commit',
|
|
133
137
|
'git -c user.name=Harness commit',
|
|
@@ -156,6 +160,32 @@ test('exports the conservative git commit executable/subcommand normalizer', ()
|
|
|
156
160
|
]) assert.equal(matcher.normalizeGitCommitCommand(command), null, command);
|
|
157
161
|
});
|
|
158
162
|
|
|
163
|
+
test('source and packaged matchers bound simple command sequences and reject unsupported syntax', () => {
|
|
164
|
+
const expected = { tool: 'shell', executable: 'git', subcommand: 'commit' };
|
|
165
|
+
const supported = [
|
|
166
|
+
'git commit; echo "$?"',
|
|
167
|
+
'echo before && git -C x commit --amend',
|
|
168
|
+
'git commit || echo failed',
|
|
169
|
+
"git commit -m 'message; with separator'"
|
|
170
|
+
];
|
|
171
|
+
const unsupported = [
|
|
172
|
+
"echo 'git commit; echo done'",
|
|
173
|
+
'git commit | cat',
|
|
174
|
+
'cat | git commit',
|
|
175
|
+
'(git commit)',
|
|
176
|
+
'git commit <<EOF\nmessage\nEOF',
|
|
177
|
+
'git commit;',
|
|
178
|
+
'; git commit',
|
|
179
|
+
'git commit;; echo done',
|
|
180
|
+
Array.from({ length: 17 }, (_, index) => index === 8 ? 'git commit' : 'echo x').join(';'),
|
|
181
|
+
`${'echo x; '.repeat(1400)}git commit`
|
|
182
|
+
];
|
|
183
|
+
for (const implementation of [matcher, packagedMatcher]) {
|
|
184
|
+
for (const command of supported) assert.deepEqual(implementation.normalizeGitCommitCommand(command), expected, command);
|
|
185
|
+
for (const command of unsupported) assert.equal(implementation.normalizeGitCommitCommand(command), null, command);
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
|
|
159
189
|
test('source and packaged matchers accept an empty Git config value', () => {
|
|
160
190
|
const expected = { tool: 'shell', executable: 'git', subcommand: 'commit' };
|
|
161
191
|
for (const implementation of [matcher, packagedMatcher]) {
|
|
@@ -182,6 +212,30 @@ test('a direct git commit selects the real E-0003 record at action', () => {
|
|
|
182
212
|
assert.deepEqual(withArgs.ids, ['E-0003']);
|
|
183
213
|
});
|
|
184
214
|
|
|
215
|
+
test('simple command segments select commit lessons without matching quoted text or wrappers', () => {
|
|
216
|
+
for (const command of [
|
|
217
|
+
'git commit -m "docs: probe"; echo "$?"',
|
|
218
|
+
'echo before && git -C x commit --amend',
|
|
219
|
+
'git status || git commit'
|
|
220
|
+
]) {
|
|
221
|
+
const result = select(input({
|
|
222
|
+
event: { phase: 'action', tool: 'shell', command, outcome: { failed: 'unknown' } }
|
|
223
|
+
}));
|
|
224
|
+
assert.deepEqual(result?.ids, ['E-0003'], command);
|
|
225
|
+
}
|
|
226
|
+
for (const command of [
|
|
227
|
+
"echo 'git commit; echo done'",
|
|
228
|
+
'git commit | cat',
|
|
229
|
+
'(git commit)',
|
|
230
|
+
'git commit <<EOF\nmessage\nEOF',
|
|
231
|
+
'env git commit'
|
|
232
|
+
]) {
|
|
233
|
+
assert.equal(select(input({
|
|
234
|
+
event: { phase: 'action', tool: 'shell', command, outcome: { failed: 'unknown' } }
|
|
235
|
+
})), null, command);
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
|
|
185
239
|
test('a failed commit with captured commitlint output selects again at failure', () => {
|
|
186
240
|
const base = input();
|
|
187
241
|
const action = select(base);
|
|
@@ -197,6 +251,27 @@ test('a failed commit with captured commitlint output selects again at failure',
|
|
|
197
251
|
assert.deepEqual(emptySubject.ids, ['E-0003']);
|
|
198
252
|
});
|
|
199
253
|
|
|
254
|
+
test('failure lessons require a known outcome and an exact diagnostic', () => {
|
|
255
|
+
const direct = 'git commit -m "Bad Subject"';
|
|
256
|
+
const compound = `${direct}; echo "$?"`;
|
|
257
|
+
const cases = [
|
|
258
|
+
{ command: compound, failed: false, output: COMMITLINT_OUTPUT, expected: ['E-0003'] },
|
|
259
|
+
{ command: compound, failed: true, output: COMMITLINT_OUTPUT, expected: ['E-0003'] },
|
|
260
|
+
{ command: compound, failed: 'unknown', output: COMMITLINT_OUTPUT, expected: null },
|
|
261
|
+
{ command: direct, failed: false, output: COMMITLINT_OUTPUT, expected: null },
|
|
262
|
+
{ command: compound, failed: false, output: 'fatal: unrelated output', expected: null },
|
|
263
|
+
{ command: compound, failed: true, output: 'fatal: unrelated output', expected: null },
|
|
264
|
+
];
|
|
265
|
+
for (const implementation of [matcher, packagedMatcher]) {
|
|
266
|
+
for (const { command, failed, output, expected } of cases) {
|
|
267
|
+
const result = implementation.matchLedgerLessons(input({
|
|
268
|
+
event: { phase: 'failure', tool: 'shell', command, outcome: { failed, output } }
|
|
269
|
+
}));
|
|
270
|
+
assert.deepEqual(result?.ids ?? null, expected, JSON.stringify({ command, failed, output }));
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
|
|
200
275
|
test('the real generator and runtime accept quoted identity and match scalars', () => {
|
|
201
276
|
const root = workspace('generated quoted record');
|
|
202
277
|
const ledger = path.join(root, '.agents', 'harness-everything', 'errors');
|
|
@@ -101,8 +101,8 @@ function createV2Context(sessionWorkspaces, pluginFile = PLUGIN) {
|
|
|
101
101
|
}));
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
async function toolCall(harness, sessionID, id, status = 'completed', output = 'ok', exit = 0
|
|
105
|
-
|
|
104
|
+
async function toolCall(harness, sessionID, id, status = 'completed', output = 'ok', exit = 0,
|
|
105
|
+
command = 'git commit -m "docs(errors): Bad Case"') {
|
|
106
106
|
const before = { tool: 'bash', sessionID, agent: 'build', messageID: `message-${id}`, id, input: { command } };
|
|
107
107
|
const beforeSnapshot = structuredClone(before);
|
|
108
108
|
assert.equal(await harness.toolHooks.get('execute.before')(before), undefined);
|
|
@@ -113,7 +113,7 @@ async function toolCall(harness, sessionID, id, status = 'completed', output = '
|
|
|
113
113
|
status,
|
|
114
114
|
...(status === 'error'
|
|
115
115
|
? { error: { name: 'ToolError', message: output } }
|
|
116
|
-
: { result: { output, metadata: { exit } } }),
|
|
116
|
+
: { result: { output, metadata: exit === null ? {} : { exit } } }),
|
|
117
117
|
};
|
|
118
118
|
const afterSnapshot = structuredClone(after);
|
|
119
119
|
assert.equal(await harness.toolHooks.get('execute.after')(after), undefined);
|
|
@@ -156,7 +156,11 @@ test('OpenCode V2 carries real ledger matches through the source and packaged co
|
|
|
156
156
|
same: workspace,
|
|
157
157
|
other: workspace,
|
|
158
158
|
separateWorkspace: otherWorkspace,
|
|
159
|
+
shellAction: workspace,
|
|
160
|
+
shellFailure: workspace,
|
|
159
161
|
noLedger: emptyWorkspace,
|
|
162
|
+
masked: workspace,
|
|
163
|
+
unknownExit: workspace,
|
|
160
164
|
disposal: workspace,
|
|
161
165
|
sessionCleanup: workspace,
|
|
162
166
|
};
|
|
@@ -193,12 +197,54 @@ test('OpenCode V2 carries real ledger matches through the source and packaged co
|
|
|
193
197
|
|
|
194
198
|
await toolCall(harness, 'other', 'other-action', 'completed', COMMITLINT, 0);
|
|
195
199
|
assert.equal((await context(harness, 'other')).match(/Cue:\n/g)?.length, 1,
|
|
196
|
-
'
|
|
200
|
+
'a direct command with diagnostic-looking output and zero exit remains action-only');
|
|
201
|
+
|
|
202
|
+
await toolCall(harness, 'masked', 'masked-action', 'completed', COMMITLINT, 0,
|
|
203
|
+
'git commit -m "Bad Subject"; echo "$?"');
|
|
204
|
+
assert.equal((await context(harness, 'masked')).match(/Cue:\n/g)?.length, 2,
|
|
205
|
+
'a precise commitlint diagnostic recovers a commit failure masked by a compound shell exit');
|
|
206
|
+
|
|
207
|
+
await toolCall(harness, 'unknownExit', 'unknown-exit-action', 'completed', COMMITLINT, null,
|
|
208
|
+
'git commit -m "Bad Subject"; echo "$?"');
|
|
209
|
+
assert.equal((await context(harness, 'unknownExit')).match(/Cue:\n/g)?.length, 1,
|
|
210
|
+
'a completed compound command without metadata.exit remains action-only');
|
|
197
211
|
|
|
198
212
|
await toolCall(harness, 'separateWorkspace', 'workspace-action', 'completed', COMMITLINT, 1);
|
|
199
213
|
assert.equal((await context(harness, 'separateWorkspace')).match(/Cue:\n/g)?.length, 2,
|
|
200
214
|
'a completed tool result with nonzero metadata.exit and captured diagnostics selects failure too');
|
|
201
215
|
|
|
216
|
+
// Live OpenCode 2.1.4 shape (E-0006/E-0008): tool "shell", input carries workdir,
|
|
217
|
+
// after-result carries metadata.exit and commitlint output.
|
|
218
|
+
const shellCommand = 'git -C x commit -m "docs(errors): Bad Case"';
|
|
219
|
+
const shellBase = { tool: 'shell', agent: 'build', messageID: 'message-shell', input: { command: shellCommand, workdir: workspace } };
|
|
220
|
+
|
|
221
|
+
const shellActionEvent = { ...shellBase, sessionID: 'shellAction', id: 'shell-action' };
|
|
222
|
+
const shellActionSnapshot = structuredClone(shellActionEvent);
|
|
223
|
+
assert.equal(await harness.toolHooks.get('execute.before')(shellActionEvent), undefined);
|
|
224
|
+
assert.deepEqual(shellActionEvent, shellActionSnapshot, 'execute.before does not change a live shell tool request');
|
|
225
|
+
assert.equal((await context(harness, 'shellAction')).match(/Cue:\n/g)?.length, 1,
|
|
226
|
+
'a live shell action event delivers the action lesson');
|
|
227
|
+
|
|
228
|
+
const shellFailureBefore = { ...shellBase, sessionID: 'shellFailure', id: 'shell-failure-before' };
|
|
229
|
+
assert.equal(await harness.toolHooks.get('execute.before')(shellFailureBefore), undefined);
|
|
230
|
+
const shellFailureAfter = {
|
|
231
|
+
...shellFailureBefore,
|
|
232
|
+
id: 'shell-failure-after',
|
|
233
|
+
status: 'completed',
|
|
234
|
+
result: {
|
|
235
|
+
output: { exit: 1, truncated: false, output: COMMITLINT, status: 'completed' },
|
|
236
|
+
content: [{ type: 'text', text: COMMITLINT }],
|
|
237
|
+
metadata: { status: 'completed', truncated: false, exit: 1 },
|
|
238
|
+
},
|
|
239
|
+
};
|
|
240
|
+
const shellFailureSnapshot = structuredClone(shellFailureAfter);
|
|
241
|
+
assert.equal(await harness.toolHooks.get('execute.after')(shellFailureAfter), undefined);
|
|
242
|
+
assert.deepEqual(shellFailureAfter, shellFailureSnapshot, 'execute.after does not change a live shell tool result');
|
|
243
|
+
const shellDelivered = await context(harness, 'shellFailure');
|
|
244
|
+
assert.equal((shellDelivered.match(/Cue:\n/g) || []).length, 2,
|
|
245
|
+
'live shell action and failure events deliver both lessons');
|
|
246
|
+
assert.match(shellDelivered, /subject-case/, 'the failure lesson carries the commitlint diagnostic');
|
|
247
|
+
|
|
202
248
|
await toolCall(harness, 'noLedger', 'no-ledger-action');
|
|
203
249
|
assert.equal(await context(harness, 'noLedger'), 'base system', 'an unrelated workspace without a ledger is silent');
|
|
204
250
|
|
|
@@ -19,7 +19,9 @@ function eventFor(payload) {
|
|
|
19
19
|
const result = readCodexToolOutcome(payload);
|
|
20
20
|
const failed = result.outcome === 'failure' ? true : result.outcome === 'success' ? false : 'unknown';
|
|
21
21
|
const outcome = { failed };
|
|
22
|
-
|
|
22
|
+
// Exact ledger diagnostics can identify a masked failure only when the host
|
|
23
|
+
// provides a structured exit outcome. Opaque text-only responses stay unknown.
|
|
24
|
+
if (result.outcome !== 'unknown') outcome.output = [result.stderr, result.stdout].filter(Boolean).join('\n');
|
|
23
25
|
return { phase: 'failure', tool: 'shell', command, outcome };
|
|
24
26
|
}
|
|
25
27
|
|
|
@@ -12,6 +12,7 @@ const LIMITS = Object.freeze({
|
|
|
12
12
|
sourceBytes: 64 * 1024,
|
|
13
13
|
candidateText: 4096,
|
|
14
14
|
command: 8192,
|
|
15
|
+
commandSegments: 16,
|
|
15
16
|
output: 32 * 1024,
|
|
16
17
|
reminders: 2,
|
|
17
18
|
reminderChars: 1500
|
|
@@ -189,6 +190,43 @@ function words(command) {
|
|
|
189
190
|
return tokens;
|
|
190
191
|
}
|
|
191
192
|
|
|
193
|
+
// Recognize only a bounded top-level sequence. Wrappers, pipelines, redirects,
|
|
194
|
+
// subshells, and heredocs stay unsupported; quoted separators remain arguments.
|
|
195
|
+
function splitSimpleCommandSegments(command) {
|
|
196
|
+
if (typeof command !== 'string' || command.length > LIMITS.command || /[\r\n\0]/.test(command)) return null;
|
|
197
|
+
const segments = [];
|
|
198
|
+
let quote = null;
|
|
199
|
+
let start = 0;
|
|
200
|
+
for (let index = 0; index < command.length; index += 1) {
|
|
201
|
+
const char = command[index];
|
|
202
|
+
if (quote) {
|
|
203
|
+
if (char === quote) quote = null;
|
|
204
|
+
else if (char === '\\' && quote === '"' && index + 1 < command.length) index += 1;
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
if (char === '"' || char === "'") { quote = char; continue; }
|
|
208
|
+
if (char === '\\' && index + 1 < command.length) { index += 1; continue; }
|
|
209
|
+
if ('<>()`'.includes(char)) return null;
|
|
210
|
+
let separatorLength = 0;
|
|
211
|
+
if (char === ';') separatorLength = 1;
|
|
212
|
+
else if (char === '&' || char === '|') {
|
|
213
|
+
if (command[index + 1] !== char || command[index + 2] === char) return null;
|
|
214
|
+
separatorLength = 2;
|
|
215
|
+
}
|
|
216
|
+
if (!separatorLength) continue;
|
|
217
|
+
const segment = command.slice(start, index).trim();
|
|
218
|
+
if (!segment || segments.length >= LIMITS.commandSegments - 1) return null;
|
|
219
|
+
segments.push(segment);
|
|
220
|
+
index += separatorLength - 1;
|
|
221
|
+
start = index + 1;
|
|
222
|
+
}
|
|
223
|
+
if (quote) return null;
|
|
224
|
+
const finalSegment = command.slice(start).trim();
|
|
225
|
+
if (!finalSegment || segments.length >= LIMITS.commandSegments) return null;
|
|
226
|
+
segments.push(finalSegment);
|
|
227
|
+
return segments;
|
|
228
|
+
}
|
|
229
|
+
|
|
192
230
|
function normalizeShellCommand(command) {
|
|
193
231
|
try {
|
|
194
232
|
const tokens = words(command);
|
|
@@ -224,8 +262,13 @@ function normalizeShellCommand(command) {
|
|
|
224
262
|
}
|
|
225
263
|
|
|
226
264
|
function normalizeGitCommitCommand(command) {
|
|
227
|
-
const
|
|
228
|
-
|
|
265
|
+
const segments = splitSimpleCommandSegments(command);
|
|
266
|
+
if (!segments) return null;
|
|
267
|
+
for (const segment of segments) {
|
|
268
|
+
const invocation = normalizeShellCommand(segment);
|
|
269
|
+
if (invocation?.executable === 'git' && invocation.subcommand === 'commit') return invocation;
|
|
270
|
+
}
|
|
271
|
+
return null;
|
|
229
272
|
}
|
|
230
273
|
|
|
231
274
|
function normalizeEvent(event) {
|
|
@@ -233,8 +276,13 @@ function normalizeEvent(event) {
|
|
|
233
276
|
!isObject(event.outcome) || ![true, false, 'unknown'].includes(event.outcome.failed) ||
|
|
234
277
|
(event.outcome.output !== undefined && typeof event.outcome.output !== 'string') ||
|
|
235
278
|
(event.phase === 'failure' && event.outcome.output && event.outcome.output.length > LIMITS.output)) return null;
|
|
236
|
-
const
|
|
237
|
-
|
|
279
|
+
const segments = splitSimpleCommandSegments(event.command);
|
|
280
|
+
if (!segments) return null;
|
|
281
|
+
const invocations = segments.map(normalizeShellCommand).filter(Boolean);
|
|
282
|
+
return invocations.length
|
|
283
|
+
? { phase: event.phase, tool: 'shell', command: event.command, outcome: event.outcome,
|
|
284
|
+
invocations, compound: segments.length > 1 }
|
|
285
|
+
: null;
|
|
238
286
|
}
|
|
239
287
|
|
|
240
288
|
function ruleMatches(rule, invocation) {
|
|
@@ -251,11 +299,12 @@ function hasDiagnostic(output, diagnostics) {
|
|
|
251
299
|
|
|
252
300
|
function eventMatches(match, event) {
|
|
253
301
|
if (!match) return false;
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
302
|
+
const matchesInvocation = rule => event.invocations.some(invocation => ruleMatches(rule, invocation));
|
|
303
|
+
if (event.phase === 'action') return Boolean(match.actions?.some(matchesInvocation));
|
|
304
|
+
if (typeof event.outcome.output !== 'string') return false;
|
|
305
|
+
return Boolean(match.failures?.some(rule => matchesInvocation(rule) &&
|
|
306
|
+
hasDiagnostic(event.outcome.output, rule.diagnostics) &&
|
|
307
|
+
(event.outcome.failed === true || (event.outcome.failed === false && event.compound))));
|
|
259
308
|
}
|
|
260
309
|
|
|
261
310
|
function validProvisionalCandidate(candidate) {
|
|
@@ -211,7 +211,7 @@ function observeOpenCodeTool(event, workspace) {
|
|
|
211
211
|
const observations = systemOneObservations()
|
|
212
212
|
if (!observations || !observations.enabled() || !event?.sessionID) return
|
|
213
213
|
const args = isRecord(event.input) ? event.input : {}
|
|
214
|
-
const names = { edit: "Edit", write: "Write", apply_patch: "apply_patch", bash: "shell", skill: "Skill", read: "Read", task: "Task" }
|
|
214
|
+
const names = { edit: "Edit", write: "Write", apply_patch: "apply_patch", bash: "shell", shell: "shell", skill: "Skill", read: "Read", task: "Task" }
|
|
215
215
|
const toolInput = {
|
|
216
216
|
...args,
|
|
217
217
|
file_path: args.filePath || args.file_path || args.path,
|
|
@@ -1259,7 +1259,7 @@ export default {
|
|
|
1259
1259
|
const binding = await bindingForSession(event?.sessionID)
|
|
1260
1260
|
if (events.signal.aborted || !binding?.workspace) return
|
|
1261
1261
|
retryLedgerReleases()
|
|
1262
|
-
if (event.tool === "bash" && typeof event.input?.command === "string") {
|
|
1262
|
+
if ((event.tool === "bash" || event.tool === "shell") && typeof event.input?.command === "string") {
|
|
1263
1263
|
queueLedgerLesson(pendingLedgerLessons, binding.workspace, event.sessionID, {
|
|
1264
1264
|
phase: "action", tool: "shell", command: event.input.command, outcome: { failed: "unknown" },
|
|
1265
1265
|
})
|
|
@@ -1280,14 +1280,17 @@ export default {
|
|
|
1280
1280
|
? typeof event.error === "string" ? event.error
|
|
1281
1281
|
: typeof event.error?.message === "string" ? event.error.message : undefined
|
|
1282
1282
|
: undefined
|
|
1283
|
-
const
|
|
1284
|
-
|
|
1285
|
-
const
|
|
1283
|
+
const resultExit = event.status === "completed" && Number.isFinite(event.result?.metadata?.exit)
|
|
1284
|
+
? event.result.metadata.exit : null
|
|
1285
|
+
const resultFailed = resultExit !== null && resultExit !== 0
|
|
1286
|
+
const resultOutput = typeof event.result?.output === "string" ? event.result.output
|
|
1287
|
+
: typeof event.result?.output?.output === "string" ? event.result.output.output : undefined
|
|
1286
1288
|
const failureOutput = errorOutput ?? resultOutput
|
|
1287
|
-
if (event.tool === "bash" && failureOutput !== undefined && typeof event.input?.command === "string") {
|
|
1289
|
+
if ((event.tool === "bash" || event.tool === "shell") && failureOutput !== undefined && typeof event.input?.command === "string") {
|
|
1288
1290
|
queueLedgerLesson(pendingLedgerLessons, binding.workspace, event.sessionID, {
|
|
1289
1291
|
phase: "failure", tool: "shell", command: event.input.command,
|
|
1290
|
-
outcome: { failed: true
|
|
1292
|
+
outcome: { failed: event.status === "error" || resultFailed ? true : resultExit === null ? "unknown" : false,
|
|
1293
|
+
output: failureOutput },
|
|
1291
1294
|
})
|
|
1292
1295
|
}
|
|
1293
1296
|
if (prompt?.status === "resolved" && prompt.workspace) observeOpenCodeTool(event, prompt.workspace)
|
package/package.json
CHANGED
|
@@ -19,7 +19,9 @@ function eventFor(payload) {
|
|
|
19
19
|
const result = readCodexToolOutcome(payload);
|
|
20
20
|
const failed = result.outcome === 'failure' ? true : result.outcome === 'success' ? false : 'unknown';
|
|
21
21
|
const outcome = { failed };
|
|
22
|
-
|
|
22
|
+
// Exact ledger diagnostics can identify a masked failure only when the host
|
|
23
|
+
// provides a structured exit outcome. Opaque text-only responses stay unknown.
|
|
24
|
+
if (result.outcome !== 'unknown') outcome.output = [result.stderr, result.stdout].filter(Boolean).join('\n');
|
|
23
25
|
return { phase: 'failure', tool: 'shell', command, outcome };
|
|
24
26
|
}
|
|
25
27
|
|
|
@@ -12,6 +12,7 @@ const LIMITS = Object.freeze({
|
|
|
12
12
|
sourceBytes: 64 * 1024,
|
|
13
13
|
candidateText: 4096,
|
|
14
14
|
command: 8192,
|
|
15
|
+
commandSegments: 16,
|
|
15
16
|
output: 32 * 1024,
|
|
16
17
|
reminders: 2,
|
|
17
18
|
reminderChars: 1500
|
|
@@ -189,6 +190,43 @@ function words(command) {
|
|
|
189
190
|
return tokens;
|
|
190
191
|
}
|
|
191
192
|
|
|
193
|
+
// Recognize only a bounded top-level sequence. Wrappers, pipelines, redirects,
|
|
194
|
+
// subshells, and heredocs stay unsupported; quoted separators remain arguments.
|
|
195
|
+
function splitSimpleCommandSegments(command) {
|
|
196
|
+
if (typeof command !== 'string' || command.length > LIMITS.command || /[\r\n\0]/.test(command)) return null;
|
|
197
|
+
const segments = [];
|
|
198
|
+
let quote = null;
|
|
199
|
+
let start = 0;
|
|
200
|
+
for (let index = 0; index < command.length; index += 1) {
|
|
201
|
+
const char = command[index];
|
|
202
|
+
if (quote) {
|
|
203
|
+
if (char === quote) quote = null;
|
|
204
|
+
else if (char === '\\' && quote === '"' && index + 1 < command.length) index += 1;
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
if (char === '"' || char === "'") { quote = char; continue; }
|
|
208
|
+
if (char === '\\' && index + 1 < command.length) { index += 1; continue; }
|
|
209
|
+
if ('<>()`'.includes(char)) return null;
|
|
210
|
+
let separatorLength = 0;
|
|
211
|
+
if (char === ';') separatorLength = 1;
|
|
212
|
+
else if (char === '&' || char === '|') {
|
|
213
|
+
if (command[index + 1] !== char || command[index + 2] === char) return null;
|
|
214
|
+
separatorLength = 2;
|
|
215
|
+
}
|
|
216
|
+
if (!separatorLength) continue;
|
|
217
|
+
const segment = command.slice(start, index).trim();
|
|
218
|
+
if (!segment || segments.length >= LIMITS.commandSegments - 1) return null;
|
|
219
|
+
segments.push(segment);
|
|
220
|
+
index += separatorLength - 1;
|
|
221
|
+
start = index + 1;
|
|
222
|
+
}
|
|
223
|
+
if (quote) return null;
|
|
224
|
+
const finalSegment = command.slice(start).trim();
|
|
225
|
+
if (!finalSegment || segments.length >= LIMITS.commandSegments) return null;
|
|
226
|
+
segments.push(finalSegment);
|
|
227
|
+
return segments;
|
|
228
|
+
}
|
|
229
|
+
|
|
192
230
|
function normalizeShellCommand(command) {
|
|
193
231
|
try {
|
|
194
232
|
const tokens = words(command);
|
|
@@ -224,8 +262,13 @@ function normalizeShellCommand(command) {
|
|
|
224
262
|
}
|
|
225
263
|
|
|
226
264
|
function normalizeGitCommitCommand(command) {
|
|
227
|
-
const
|
|
228
|
-
|
|
265
|
+
const segments = splitSimpleCommandSegments(command);
|
|
266
|
+
if (!segments) return null;
|
|
267
|
+
for (const segment of segments) {
|
|
268
|
+
const invocation = normalizeShellCommand(segment);
|
|
269
|
+
if (invocation?.executable === 'git' && invocation.subcommand === 'commit') return invocation;
|
|
270
|
+
}
|
|
271
|
+
return null;
|
|
229
272
|
}
|
|
230
273
|
|
|
231
274
|
function normalizeEvent(event) {
|
|
@@ -233,8 +276,13 @@ function normalizeEvent(event) {
|
|
|
233
276
|
!isObject(event.outcome) || ![true, false, 'unknown'].includes(event.outcome.failed) ||
|
|
234
277
|
(event.outcome.output !== undefined && typeof event.outcome.output !== 'string') ||
|
|
235
278
|
(event.phase === 'failure' && event.outcome.output && event.outcome.output.length > LIMITS.output)) return null;
|
|
236
|
-
const
|
|
237
|
-
|
|
279
|
+
const segments = splitSimpleCommandSegments(event.command);
|
|
280
|
+
if (!segments) return null;
|
|
281
|
+
const invocations = segments.map(normalizeShellCommand).filter(Boolean);
|
|
282
|
+
return invocations.length
|
|
283
|
+
? { phase: event.phase, tool: 'shell', command: event.command, outcome: event.outcome,
|
|
284
|
+
invocations, compound: segments.length > 1 }
|
|
285
|
+
: null;
|
|
238
286
|
}
|
|
239
287
|
|
|
240
288
|
function ruleMatches(rule, invocation) {
|
|
@@ -251,11 +299,12 @@ function hasDiagnostic(output, diagnostics) {
|
|
|
251
299
|
|
|
252
300
|
function eventMatches(match, event) {
|
|
253
301
|
if (!match) return false;
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
302
|
+
const matchesInvocation = rule => event.invocations.some(invocation => ruleMatches(rule, invocation));
|
|
303
|
+
if (event.phase === 'action') return Boolean(match.actions?.some(matchesInvocation));
|
|
304
|
+
if (typeof event.outcome.output !== 'string') return false;
|
|
305
|
+
return Boolean(match.failures?.some(rule => matchesInvocation(rule) &&
|
|
306
|
+
hasDiagnostic(event.outcome.output, rule.diagnostics) &&
|
|
307
|
+
(event.outcome.failed === true || (event.outcome.failed === false && event.compound))));
|
|
259
308
|
}
|
|
260
309
|
|
|
261
310
|
function validProvisionalCandidate(candidate) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
|
|
3
3
|
"name": "harness-everything",
|
|
4
|
-
"version": "0.57.
|
|
4
|
+
"version": "0.57.3",
|
|
5
5
|
"description": "Invariant-first engineering harness for routing, verification, and failure recovery while preserving agent autonomy.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Miya Daniel",
|
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:cadf10de-ed81-59f9-b32f-b78c544ccd16",
|
|
6
6
|
"version": 1,
|
|
7
7
|
"metadata": {
|
|
8
|
-
"timestamp": "2026-11-
|
|
8
|
+
"timestamp": "2026-11-22T16:47:26.168Z",
|
|
9
9
|
"tools": [
|
|
10
10
|
{
|
|
11
11
|
"vendor": "Harness Everything",
|
|
12
12
|
"name": "generate-sbom.js",
|
|
13
|
-
"version": "0.57.
|
|
13
|
+
"version": "0.57.3"
|
|
14
14
|
}
|
|
15
15
|
],
|
|
16
16
|
"component": {
|
|
17
17
|
"type": "application",
|
|
18
|
-
"bom-ref": "pkg:npm/harness-everything@0.57.
|
|
18
|
+
"bom-ref": "pkg:npm/harness-everything@0.57.3",
|
|
19
19
|
"name": "harness-everything",
|
|
20
|
-
"version": "0.57.
|
|
21
|
-
"purl": "pkg:npm/harness-everything@0.57.
|
|
20
|
+
"version": "0.57.3",
|
|
21
|
+
"purl": "pkg:npm/harness-everything@0.57.3"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"components": [
|
|
@@ -2033,7 +2033,7 @@
|
|
|
2033
2033
|
]
|
|
2034
2034
|
},
|
|
2035
2035
|
{
|
|
2036
|
-
"ref": "pkg:npm/harness-everything@0.57.
|
|
2036
|
+
"ref": "pkg:npm/harness-everything@0.57.3",
|
|
2037
2037
|
"dependsOn": [
|
|
2038
2038
|
"pkg:npm/%40commitlint/cli@19.8.1",
|
|
2039
2039
|
"pkg:npm/%40commitlint/config-conventional@19.8.1",
|