harness-everything 0.57.0 → 0.57.2
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 +13 -0
- package/ci/mechanism-394-codex-ledger-lesson.test.js +5 -0
- package/ci/mechanism-394-ledger-match.test.js +92 -3
- package/ci/mechanism-394-opencode-ledger-lesson.test.js +16 -4
- package/hooks/scripts/codex-ledger-lesson.js +3 -1
- package/hooks/scripts/lib/ledger-match.js +59 -10
- package/opencode-plugin/index.mjs +6 -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/scripts/codex-ledger-lesson.js +3 -1
- package/plugins/harness-everything/hooks/scripts/lib/ledger-match.js +59 -10
- 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.2",
|
|
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.2",
|
|
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.2](https://github.com/dyphn1/Harness-everything/compare/v0.57.1...v0.57.2) (2026-11-22)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
* **ledger:** match bounded compound commit commands ([3d513ec](https://github.com/dyphn1/Harness-everything/commit/3d513ec32ae1b31068bb208d79535277bc494b03))
|
|
10
|
+
* **ledger:** require a known command outcome ([572b065](https://github.com/dyphn1/Harness-everything/commit/572b065bd5977d97d385b19714af85307cf5f63f))
|
|
11
|
+
|
|
12
|
+
## [0.57.1](https://github.com/dyphn1/Harness-everything/compare/v0.57.0...v0.57.1) (2026-11-22)
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* **ledger:** accept empty git config values ([6788ab7](https://github.com/dyphn1/Harness-everything/commit/6788ab7be7e31ee1dde84e8cddd8c96826cf4113))
|
|
17
|
+
|
|
5
18
|
## [0.57.0](https://github.com/dyphn1/Harness-everything/compare/v0.56.1...v0.57.0) (2026-11-21)
|
|
6
19
|
|
|
7
20
|
### Features
|
|
@@ -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');
|
|
@@ -14,6 +14,7 @@ try {
|
|
|
14
14
|
} catch (error) {
|
|
15
15
|
if (error.code !== 'MODULE_NOT_FOUND') throw error;
|
|
16
16
|
}
|
|
17
|
+
const packagedMatcher = require('../plugins/harness-everything/hooks/scripts/lib/ledger-match.js');
|
|
17
18
|
|
|
18
19
|
const ROOT = path.resolve(__dirname, '..');
|
|
19
20
|
const ERRORS_SYNC = path.join(ROOT, 'scripts', 'errors-sync.js');
|
|
@@ -121,15 +122,20 @@ test('exports the conservative git commit executable/subcommand normalizer', ()
|
|
|
121
122
|
'git status',
|
|
122
123
|
'git merge origin/main',
|
|
123
124
|
'sudo git commit',
|
|
124
|
-
'git commit && echo done',
|
|
125
125
|
'"git commit"'
|
|
126
126
|
]) assert.equal(matcher.normalizeGitCommitCommand(command), null, command);
|
|
127
|
-
|
|
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), {
|
|
128
133
|
tool: 'shell', executable: 'git', subcommand: 'commit'
|
|
129
|
-
});
|
|
134
|
+
}, command);
|
|
130
135
|
for (const command of [
|
|
131
136
|
'git -C x commit',
|
|
132
137
|
'git -c user.name=Harness commit',
|
|
138
|
+
'git -c core.pager= commit',
|
|
133
139
|
'git --git-dir=/repo/.git commit',
|
|
134
140
|
'git --work-tree=/repo commit',
|
|
135
141
|
'git --no-pager commit',
|
|
@@ -143,6 +149,8 @@ test('exports the conservative git commit executable/subcommand normalizer', ()
|
|
|
143
149
|
'git -C x',
|
|
144
150
|
'git -c',
|
|
145
151
|
'git -c user.name commit',
|
|
152
|
+
'git -c =x commit',
|
|
153
|
+
'git -c = commit',
|
|
146
154
|
'git -c =Harness commit',
|
|
147
155
|
'git --git-dir= commit',
|
|
148
156
|
'git --work-tree= commit',
|
|
@@ -152,6 +160,42 @@ test('exports the conservative git commit executable/subcommand normalizer', ()
|
|
|
152
160
|
]) assert.equal(matcher.normalizeGitCommitCommand(command), null, command);
|
|
153
161
|
});
|
|
154
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
|
+
|
|
189
|
+
test('source and packaged matchers accept an empty Git config value', () => {
|
|
190
|
+
const expected = { tool: 'shell', executable: 'git', subcommand: 'commit' };
|
|
191
|
+
for (const implementation of [matcher, packagedMatcher]) {
|
|
192
|
+
assert.deepEqual(implementation.normalizeGitCommitCommand('git -c core.pager= commit'), expected);
|
|
193
|
+
assert.equal(implementation.normalizeGitCommitCommand('git -c =x commit'), null);
|
|
194
|
+
assert.equal(implementation.normalizeGitCommitCommand('git -c = commit'), null);
|
|
195
|
+
assert.equal(implementation.normalizeGitCommitCommand('git -c user.name commit'), null);
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
|
|
155
199
|
test('a direct git commit selects the real E-0003 record at action', () => {
|
|
156
200
|
const result = select(input({ event: { phase: 'action', tool: 'shell', command: 'git commit', outcome: { failed: 'unknown' } } }));
|
|
157
201
|
assert.deepEqual(result.ids, ['E-0003']);
|
|
@@ -168,6 +212,30 @@ test('a direct git commit selects the real E-0003 record at action', () => {
|
|
|
168
212
|
assert.deepEqual(withArgs.ids, ['E-0003']);
|
|
169
213
|
});
|
|
170
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
|
+
|
|
171
239
|
test('a failed commit with captured commitlint output selects again at failure', () => {
|
|
172
240
|
const base = input();
|
|
173
241
|
const action = select(base);
|
|
@@ -183,6 +251,27 @@ test('a failed commit with captured commitlint output selects again at failure',
|
|
|
183
251
|
assert.deepEqual(emptySubject.ids, ['E-0003']);
|
|
184
252
|
});
|
|
185
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
|
+
|
|
186
275
|
test('the real generator and runtime accept quoted identity and match scalars', () => {
|
|
187
276
|
const root = workspace('generated quoted record');
|
|
188
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);
|
|
@@ -157,6 +157,8 @@ test('OpenCode V2 carries real ledger matches through the source and packaged co
|
|
|
157
157
|
other: workspace,
|
|
158
158
|
separateWorkspace: otherWorkspace,
|
|
159
159
|
noLedger: emptyWorkspace,
|
|
160
|
+
masked: workspace,
|
|
161
|
+
unknownExit: workspace,
|
|
160
162
|
disposal: workspace,
|
|
161
163
|
sessionCleanup: workspace,
|
|
162
164
|
};
|
|
@@ -193,7 +195,17 @@ test('OpenCode V2 carries real ledger matches through the source and packaged co
|
|
|
193
195
|
|
|
194
196
|
await toolCall(harness, 'other', 'other-action', 'completed', COMMITLINT, 0);
|
|
195
197
|
assert.equal((await context(harness, 'other')).match(/Cue:\n/g)?.length, 1,
|
|
196
|
-
'
|
|
198
|
+
'a direct command with diagnostic-looking output and zero exit remains action-only');
|
|
199
|
+
|
|
200
|
+
await toolCall(harness, 'masked', 'masked-action', 'completed', COMMITLINT, 0,
|
|
201
|
+
'git commit -m "Bad Subject"; echo "$?"');
|
|
202
|
+
assert.equal((await context(harness, 'masked')).match(/Cue:\n/g)?.length, 2,
|
|
203
|
+
'a precise commitlint diagnostic recovers a commit failure masked by a compound shell exit');
|
|
204
|
+
|
|
205
|
+
await toolCall(harness, 'unknownExit', 'unknown-exit-action', 'completed', COMMITLINT, null,
|
|
206
|
+
'git commit -m "Bad Subject"; echo "$?"');
|
|
207
|
+
assert.equal((await context(harness, 'unknownExit')).match(/Cue:\n/g)?.length, 1,
|
|
208
|
+
'a completed compound command without metadata.exit remains action-only');
|
|
197
209
|
|
|
198
210
|
await toolCall(harness, 'separateWorkspace', 'workspace-action', 'completed', COMMITLINT, 1);
|
|
199
211
|
assert.equal((await context(harness, 'separateWorkspace')).match(/Cue:\n/g)?.length, 2,
|
|
@@ -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);
|
|
@@ -204,7 +242,7 @@ function normalizeShellCommand(command) {
|
|
|
204
242
|
} else if (option === '-c') {
|
|
205
243
|
const setting = tokens[index++];
|
|
206
244
|
const equals = setting?.indexOf('=');
|
|
207
|
-
if (!setting || equals < 1
|
|
245
|
+
if (!setting || equals < 1) return null;
|
|
208
246
|
} else if (option === '--no-pager' || option === '-P') {
|
|
209
247
|
continue;
|
|
210
248
|
} else if (option.startsWith('--git-dir=')) {
|
|
@@ -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) {
|
|
@@ -1280,14 +1280,16 @@ 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 : undefined
|
|
1286
1287
|
const failureOutput = errorOutput ?? resultOutput
|
|
1287
1288
|
if (event.tool === "bash" && failureOutput !== undefined && typeof event.input?.command === "string") {
|
|
1288
1289
|
queueLedgerLesson(pendingLedgerLessons, binding.workspace, event.sessionID, {
|
|
1289
1290
|
phase: "failure", tool: "shell", command: event.input.command,
|
|
1290
|
-
outcome: { failed: true
|
|
1291
|
+
outcome: { failed: event.status === "error" || resultFailed ? true : resultExit === null ? "unknown" : false,
|
|
1292
|
+
output: failureOutput },
|
|
1291
1293
|
})
|
|
1292
1294
|
}
|
|
1293
1295
|
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);
|
|
@@ -204,7 +242,7 @@ function normalizeShellCommand(command) {
|
|
|
204
242
|
} else if (option === '-c') {
|
|
205
243
|
const setting = tokens[index++];
|
|
206
244
|
const equals = setting?.indexOf('=');
|
|
207
|
-
if (!setting || equals < 1
|
|
245
|
+
if (!setting || equals < 1) return null;
|
|
208
246
|
} else if (option === '--no-pager' || option === '-P') {
|
|
209
247
|
continue;
|
|
210
248
|
} else if (option.startsWith('--git-dir=')) {
|
|
@@ -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.2",
|
|
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:2f7a7614-ee66-5c86-af90-b40f26ceb805",
|
|
6
6
|
"version": 1,
|
|
7
7
|
"metadata": {
|
|
8
|
-
"timestamp": "2026-11-
|
|
8
|
+
"timestamp": "2026-11-22T09:17:44.283Z",
|
|
9
9
|
"tools": [
|
|
10
10
|
{
|
|
11
11
|
"vendor": "Harness Everything",
|
|
12
12
|
"name": "generate-sbom.js",
|
|
13
|
-
"version": "0.57.
|
|
13
|
+
"version": "0.57.2"
|
|
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.2",
|
|
19
19
|
"name": "harness-everything",
|
|
20
|
-
"version": "0.57.
|
|
21
|
-
"purl": "pkg:npm/harness-everything@0.57.
|
|
20
|
+
"version": "0.57.2",
|
|
21
|
+
"purl": "pkg:npm/harness-everything@0.57.2"
|
|
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.2",
|
|
2037
2037
|
"dependsOn": [
|
|
2038
2038
|
"pkg:npm/%40commitlint/cli@19.8.1",
|
|
2039
2039
|
"pkg:npm/%40commitlint/config-conventional@19.8.1",
|