harness-everything 1.2.0 → 1.2.1
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 +7 -0
- package/ci/mechanism-496-local-error-store.test.js +188 -5
- package/ci/mechanism-498-local-store-scan.test.js +13 -1
- package/hooks/scripts/lib/local-errors.js +24 -7
- package/opencode-plugin/plugin.json +1 -1
- package/package.json +1 -1
- package/plugins/harness-everything/.antigravity-plugin/plugin.json +1 -1
- package/plugins/harness-everything/.codex-plugin/plugin.json +1 -1
- package/plugins/harness-everything/hooks/scripts/lib/local-errors.js +24 -7
- 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": "1.2.
|
|
13
|
+
"version": "1.2.1",
|
|
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": "1.2.
|
|
4
|
+
"version": "1.2.1",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Miya Daniel"
|
|
7
7
|
},
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project are documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.2.1](https://github.com/dyphn1/Harness-everything/compare/v1.2.0...v1.2.1) (2026-11-26)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
* **errors:** drop the claude exit-code wrapper from generic signatures ([#527](https://github.com/dyphn1/Harness-everything/issues/527)) ([c221b73](https://github.com/dyphn1/Harness-everything/commit/c221b73ac0fb819b4da9a5120ecf16db00ddeae0)), closes [#526](https://github.com/dyphn1/Harness-everything/issues/526)
|
|
10
|
+
* **errors:** reject cross-kind provisional ids and unscoped store reads ([#527](https://github.com/dyphn1/Harness-everything/issues/527)) ([e33ce07](https://github.com/dyphn1/Harness-everything/commit/e33ce07e817a6598bb93af371316656af7ce5f7f)), closes [#498](https://github.com/dyphn1/Harness-everything/issues/498)
|
|
11
|
+
|
|
5
12
|
## [1.2.0](https://github.com/dyphn1/Harness-everything/compare/v1.1.1...v1.2.0) (2026-11-25)
|
|
6
13
|
|
|
7
14
|
### Features
|
|
@@ -214,10 +214,98 @@ test('per-workspace and total retention/size bounds are enforced', () => {
|
|
|
214
214
|
}, { env: s.env, limits });
|
|
215
215
|
assert.strictEqual(r.status, 'appended');
|
|
216
216
|
}
|
|
217
|
-
const all =
|
|
217
|
+
const all = [
|
|
218
|
+
...localErrors.listRecords({ env: s.env, workspaceRoot: s.repoA }),
|
|
219
|
+
...localErrors.listRecords({ env: s.env, workspaceRoot: s.repoB }),
|
|
220
|
+
];
|
|
218
221
|
assert.strictEqual(all.length, 3, 'total cap keeps at most 3 records across workspaces');
|
|
219
222
|
});
|
|
220
223
|
|
|
224
|
+
test('same-workspace cross-kind IDs reject the lesson and preserve retries', () => {
|
|
225
|
+
const s = makeSandbox();
|
|
226
|
+
const occurrenceInput = {
|
|
227
|
+
workspaceRoot: s.repoA,
|
|
228
|
+
host: 'claude',
|
|
229
|
+
sessionKey: 'cross-kind-session',
|
|
230
|
+
toolUseId: 'cross-kind-tool-use',
|
|
231
|
+
command: 'npm test',
|
|
232
|
+
exitCode: 1,
|
|
233
|
+
output: 'npm ERR! code 1',
|
|
234
|
+
};
|
|
235
|
+
const occurrence = localErrors.appendOccurrence(occurrenceInput, { env: s.env });
|
|
236
|
+
assert.strictEqual(occurrence.status, 'appended');
|
|
237
|
+
|
|
238
|
+
const indexPath = path.join(s.store, localErrors.INDEX_FILE);
|
|
239
|
+
const before = fs.readFileSync(indexPath);
|
|
240
|
+
assert.throws(() => localErrors.addProvisionalLesson({
|
|
241
|
+
workspaceRoot: s.repoA,
|
|
242
|
+
provisionalId: occurrence.record.provisionalId,
|
|
243
|
+
signature: 'v1-git-cross-kind-lesson',
|
|
244
|
+
match: { actions: [{ tool: 'shell', executable: 'git', subcommand: 'commit' }] },
|
|
245
|
+
lesson: 'Keep failure IDs unique within their workspace.',
|
|
246
|
+
}, { env: s.env }), /invalid provisionalId: already in use in this workspace/);
|
|
247
|
+
assert.deepStrictEqual(fs.readFileSync(indexPath), before,
|
|
248
|
+
'rejecting a lesson collision leaves the store bytes unchanged');
|
|
249
|
+
|
|
250
|
+
const occurrenceRetry = localErrors.appendOccurrence(occurrenceInput, { env: s.env });
|
|
251
|
+
assert.strictEqual(occurrenceRetry.status, 'duplicate', 'same-kind occurrence retries still dedupe');
|
|
252
|
+
const lessonInput = {
|
|
253
|
+
workspaceRoot: s.repoA,
|
|
254
|
+
provisionalId: 'same-kind-lesson',
|
|
255
|
+
signature: 'v1-git-same-kind-lesson',
|
|
256
|
+
match: { actions: [{ tool: 'shell', executable: 'git', subcommand: 'commit' }] },
|
|
257
|
+
lesson: 'A same-kind lesson retry stays idempotent.',
|
|
258
|
+
};
|
|
259
|
+
assert.strictEqual(localErrors.addProvisionalLesson(lessonInput, { env: s.env }).status, 'appended');
|
|
260
|
+
assert.strictEqual(localErrors.addProvisionalLesson(lessonInput, { env: s.env }).status, 'duplicate',
|
|
261
|
+
'same-kind lesson retries still dedupe');
|
|
262
|
+
|
|
263
|
+
const sameIdOtherWorkspace = localErrors.addProvisionalLesson({
|
|
264
|
+
...lessonInput,
|
|
265
|
+
workspaceRoot: s.repoB,
|
|
266
|
+
provisionalId: occurrence.record.provisionalId,
|
|
267
|
+
}, { env: s.env });
|
|
268
|
+
assert.strictEqual(sameIdOtherWorkspace.status, 'appended',
|
|
269
|
+
'the same raw ID remains available in another workspace');
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
test('same-workspace cross-kind IDs reject the occurrence using its deterministic writer ID', () => {
|
|
273
|
+
const s = makeSandbox();
|
|
274
|
+
const occurrenceInput = {
|
|
275
|
+
workspaceRoot: s.repoA,
|
|
276
|
+
host: 'claude',
|
|
277
|
+
sessionKey: 'reverse-cross-kind-session',
|
|
278
|
+
toolUseId: 'reverse-cross-kind-tool-use',
|
|
279
|
+
command: 'npm test',
|
|
280
|
+
exitCode: 1,
|
|
281
|
+
output: 'npm ERR! code 1',
|
|
282
|
+
};
|
|
283
|
+
const probeStore = path.join(s.dir, 'probe-store');
|
|
284
|
+
fs.mkdirSync(probeStore);
|
|
285
|
+
const deterministicOccurrence = localErrors.appendOccurrence(occurrenceInput, {
|
|
286
|
+
env: s.env,
|
|
287
|
+
root: probeStore,
|
|
288
|
+
});
|
|
289
|
+
assert.strictEqual(deterministicOccurrence.status, 'appended');
|
|
290
|
+
|
|
291
|
+
const lesson = localErrors.addProvisionalLesson({
|
|
292
|
+
workspaceRoot: s.repoA,
|
|
293
|
+
provisionalId: deterministicOccurrence.record.provisionalId,
|
|
294
|
+
signature: 'v1-git-reverse-cross-kind-lesson',
|
|
295
|
+
match: { actions: [{ tool: 'shell', executable: 'git', subcommand: 'commit' }] },
|
|
296
|
+
lesson: 'A lesson may not claim a future occurrence ID.',
|
|
297
|
+
}, { env: s.env });
|
|
298
|
+
assert.strictEqual(lesson.status, 'appended');
|
|
299
|
+
|
|
300
|
+
const indexPath = path.join(s.store, localErrors.INDEX_FILE);
|
|
301
|
+
const before = fs.readFileSync(indexPath);
|
|
302
|
+
const rejected = localErrors.appendOccurrence(occurrenceInput, { env: s.env });
|
|
303
|
+
assert.strictEqual(rejected.status, 'invalid');
|
|
304
|
+
assert.strictEqual(rejected.error, 'provisional-id-in-use');
|
|
305
|
+
assert.deepStrictEqual(fs.readFileSync(indexPath), before,
|
|
306
|
+
'rejecting an occurrence collision leaves the store bytes unchanged');
|
|
307
|
+
});
|
|
308
|
+
|
|
221
309
|
test('lock contention returns fail-open without throwing and leaves index untouched', () => {
|
|
222
310
|
const s = makeSandbox();
|
|
223
311
|
const lockFile = path.join(s.store, '.index.lock');
|
|
@@ -443,6 +531,82 @@ test('real failure signature fixtures are stable across volatile details and div
|
|
|
443
531
|
assert.notStrictEqual(multiA, npm1, 'multi-family output must not collapse to first single-family match');
|
|
444
532
|
});
|
|
445
533
|
|
|
534
|
+
test('Claude exit-code wrapper preserves the shared v1 signature and stored excerpts', () => {
|
|
535
|
+
const s = makeSandbox();
|
|
536
|
+
const captureDir = path.join(ROOT, 'benchmarks/results/live-host/multi-host-2026-11-25-496-capture');
|
|
537
|
+
const claudeCapture = JSON.parse(fs.readFileSync(path.join(captureDir, 'claude-records.json'), 'utf8'))[0];
|
|
538
|
+
const opencodeCapture = JSON.parse(fs.readFileSync(path.join(captureDir, 'opencode-records.json'), 'utf8'))[0];
|
|
539
|
+
const expected = 'v1-shell-generic-b6246d9928fe';
|
|
540
|
+
|
|
541
|
+
const appendCapture = (capture, id) => localErrors.appendOccurrence({
|
|
542
|
+
workspaceRoot: s.repoA,
|
|
543
|
+
host: capture.host,
|
|
544
|
+
sessionKey: `session-${id}`,
|
|
545
|
+
toolUseId: `tool-${id}`,
|
|
546
|
+
commandClass: capture.commandClass,
|
|
547
|
+
exitCode: capture.exitCode,
|
|
548
|
+
output: capture.outputExcerpt,
|
|
549
|
+
}, { env: s.env });
|
|
550
|
+
|
|
551
|
+
const claude = appendCapture(claudeCapture, 'claude');
|
|
552
|
+
const opencode = appendCapture(opencodeCapture, 'opencode');
|
|
553
|
+
assert.strictEqual(claude.status, 'appended');
|
|
554
|
+
assert.strictEqual(opencode.status, 'appended');
|
|
555
|
+
assert.strictEqual(claude.record.signature, expected, 'Claude and OpenCode share the existing OpenCode v1 key');
|
|
556
|
+
assert.strictEqual(opencode.record.signature, expected);
|
|
557
|
+
assert.strictEqual(claude.record.outputExcerpt, claudeCapture.outputExcerpt, 'Claude excerpt keeps its wrapper line');
|
|
558
|
+
assert.strictEqual(claude.record.exitCode, null, 'text does not supply a structured exit code');
|
|
559
|
+
assert.strictEqual(opencode.record.outputExcerpt, opencodeCapture.outputExcerpt);
|
|
560
|
+
|
|
561
|
+
const signature = (output, host = 'claude') => localErrors.normalizeSignature(
|
|
562
|
+
{ commandClass: 'shell', output },
|
|
563
|
+
{ host }
|
|
564
|
+
);
|
|
565
|
+
const failure = opencodeCapture.outputExcerpt;
|
|
566
|
+
assert.strictEqual(signature(`Exit code 1\r\n${failure}`), expected, 'CRLF wrapper is removed for Claude');
|
|
567
|
+
assert.notStrictEqual(
|
|
568
|
+
signature(`Exit code 1\nExit code 2\n${failure}`),
|
|
569
|
+
signature(`Exit code 2\n${failure}`),
|
|
570
|
+
'only one leading wrapper line is removed'
|
|
571
|
+
);
|
|
572
|
+
assert.notStrictEqual(
|
|
573
|
+
signature(`${failure}Exit code 2\npermission denied`),
|
|
574
|
+
signature(`${failure}permission denied`),
|
|
575
|
+
'an interior header-like line remains part of the fallback signature'
|
|
576
|
+
);
|
|
577
|
+
|
|
578
|
+
const wrapped = `Exit code 1\n${failure}`;
|
|
579
|
+
assert.strictEqual(
|
|
580
|
+
signature(wrapped, 'opencode'),
|
|
581
|
+
localErrors.normalizeSignature({ commandClass: 'shell', output: wrapped }),
|
|
582
|
+
'non-Claude behavior is unchanged'
|
|
583
|
+
);
|
|
584
|
+
assert.notStrictEqual(signature('command not found: jq'), expected, 'unrelated generic failures stay distinct');
|
|
585
|
+
assert.strictEqual(
|
|
586
|
+
localErrors.normalizeSignature({
|
|
587
|
+
command: 'git commit',
|
|
588
|
+
output: 'Exit code 1\r\n✖ subject must be lower-case [subject-case]',
|
|
589
|
+
}, { host: 'claude' }),
|
|
590
|
+
'v1-git-commitlint-subject-case',
|
|
591
|
+
'named diagnostics are classified before fallback normalization'
|
|
592
|
+
);
|
|
593
|
+
|
|
594
|
+
const legacyInput = {
|
|
595
|
+
workspaceRoot: s.repoA,
|
|
596
|
+
host: 'claude',
|
|
597
|
+
sessionKey: 'legacy-session',
|
|
598
|
+
toolUseId: 'legacy-tool',
|
|
599
|
+
commandClass: 'shell',
|
|
600
|
+
exitCode: null,
|
|
601
|
+
output: claudeCapture.outputExcerpt,
|
|
602
|
+
};
|
|
603
|
+
const legacy = localErrors.appendOccurrence({ ...legacyInput, signature: claudeCapture.signature }, { env: s.env });
|
|
604
|
+
const replay = localErrors.appendOccurrence(legacyInput, { env: s.env });
|
|
605
|
+
assert.strictEqual(legacy.status, 'appended');
|
|
606
|
+
assert.strictEqual(replay.status, 'duplicate');
|
|
607
|
+
assert.strictEqual(replay.record.signature, claudeCapture.signature, 'replay retains the previously stored signature');
|
|
608
|
+
});
|
|
609
|
+
|
|
446
610
|
test('D1b row 1: issueUrl with userinfo is rejected and leaves index bytes unchanged', () => {
|
|
447
611
|
const s = makeSandbox();
|
|
448
612
|
const validMatch = {
|
|
@@ -671,16 +835,35 @@ test('D1b row 6: workspace-scoped reads and matcher-supplied bounded reader look
|
|
|
671
835
|
|
|
672
836
|
const keyA = addedA.record.workspaceKey;
|
|
673
837
|
const keyB = addedB.record.workspaceKey;
|
|
838
|
+
const signatures = (records) => records.map(record => record.signature).sort();
|
|
839
|
+
|
|
840
|
+
// Missing or unrecognized selectors never enumerate the shared store.
|
|
841
|
+
assert.deepStrictEqual(localErrors.listRecords({ env: s.env }), []);
|
|
842
|
+
assert.deepStrictEqual(localErrors.listRecords({ env: s.env, workspacePath: s.repoA }), []);
|
|
843
|
+
assert.deepStrictEqual(localErrors.listRecords({ env: s.env, root: s.store }), []);
|
|
844
|
+
assert.deepStrictEqual(localErrors.listRecords({
|
|
845
|
+
env: { ...s.env, HARNESS_WORKSPACE_ROOT: s.repoA },
|
|
846
|
+
}), [], 'environment-only workspace identity is not a read scope');
|
|
674
847
|
|
|
675
848
|
// Normal workspace-scoped read works.
|
|
676
849
|
const byRoot = localErrors.listRecords({ env: s.env, workspaceRoot: s.repoA });
|
|
677
|
-
assert.
|
|
678
|
-
assert.strictEqual(byRoot[0].signature, 'v1-git-read-a');
|
|
850
|
+
assert.deepStrictEqual(signatures(byRoot), ['v1-git-read-a']);
|
|
679
851
|
|
|
680
852
|
// Matcher-supplied key works for bounded read lookup.
|
|
681
853
|
const byKey = localErrors.listRecords({ env: s.env, workspaceKey: keyA });
|
|
682
|
-
assert.
|
|
683
|
-
|
|
854
|
+
assert.deepStrictEqual(signatures(byKey), ['v1-git-read-a']);
|
|
855
|
+
|
|
856
|
+
// Matching explicit root plus key works; the top-level root remains the store location.
|
|
857
|
+
assert.deepStrictEqual(signatures(localErrors.listRecords({
|
|
858
|
+
env: s.env,
|
|
859
|
+
workspaceRoot: s.repoA,
|
|
860
|
+
workspaceKey: keyA,
|
|
861
|
+
})), ['v1-git-read-a']);
|
|
862
|
+
assert.deepStrictEqual(signatures(localErrors.listRecords({
|
|
863
|
+
env: s.env,
|
|
864
|
+
root: s.store,
|
|
865
|
+
workspaceKey: keyA,
|
|
866
|
+
})), ['v1-git-read-a']);
|
|
684
867
|
|
|
685
868
|
// Disagreeing root + key on read returns empty.
|
|
686
869
|
assert.deepStrictEqual(localErrors.listRecords({ env: s.env, workspaceRoot: s.repoA, workspaceKey: keyB }), []);
|
|
@@ -298,8 +298,20 @@ addOccurrence(workspaceB, 'workspace-b-occurrence', 'harness', 6);
|
|
|
298
298
|
const collisionOccurrence = addOccurrence(workspaceCollision, 'collision-occurrence', 'harness', 7);
|
|
299
299
|
const collisionRawId = collisionOccurrence.provisionalId;
|
|
300
300
|
PRIVATE_VALUES.push(collisionRawId);
|
|
301
|
-
const collisionLesson = addLesson(
|
|
301
|
+
const collisionLesson = addLesson(
|
|
302
|
+
workspaceCollision, 'collision-lesson', 'project', ACTIONS.commit, `${collisionRawId}-lesson`
|
|
303
|
+
);
|
|
302
304
|
addLesson(workspaceB, 'collision-id-other-workspace', 'harness', ACTIONS.commit, collisionRawId);
|
|
305
|
+
const collisionFixtureFile = path.join(STORE, localErrors.INDEX_FILE);
|
|
306
|
+
const collisionFixtureIndex = JSON.parse(fs.readFileSync(collisionFixtureFile, 'utf8'));
|
|
307
|
+
const collisionFixtureLesson = collisionFixtureIndex.records.find(record =>
|
|
308
|
+
record.kind === 'provisional-lesson' &&
|
|
309
|
+
record.workspaceKey === collisionLesson.workspaceKey &&
|
|
310
|
+
record.provisionalId === collisionLesson.provisionalId
|
|
311
|
+
);
|
|
312
|
+
assert.ok(collisionFixtureLesson, 'positive control: the lesson exists before creating a legacy collision');
|
|
313
|
+
collisionFixtureLesson.provisionalId = collisionRawId;
|
|
314
|
+
fs.writeFileSync(collisionFixtureFile, `${JSON.stringify(collisionFixtureIndex)}\n`);
|
|
303
315
|
const distinctLesson = addLesson(workspaceCollision, 'distinct-lesson-signature', 'harness', ACTIONS.commit, 'distinct-lesson-id');
|
|
304
316
|
const distinctOccurrence = addOccurrence(workspaceCollision, 'distinct-occurrence-signature', 'harness', 8);
|
|
305
317
|
PRIVATE_VALUES.push(distinctOccurrence.provisionalId);
|
|
@@ -153,7 +153,10 @@ function normalizeSignature(input, options = {}) {
|
|
|
153
153
|
// Order-independent composite for ambiguous multi-family output (E-0027).
|
|
154
154
|
suffix = `multi-${observations.sha(families.join(','), 8)}`;
|
|
155
155
|
} else {
|
|
156
|
-
const
|
|
156
|
+
const fallbackOutput = options.host === 'claude'
|
|
157
|
+
? redacted.replace(/^Exit code [0-9]+\r?\n/, '')
|
|
158
|
+
: redacted;
|
|
159
|
+
const normalized = normalizeFallbackText(fallbackOutput);
|
|
157
160
|
suffix = normalized ? `generic-${observations.sha(normalized, 12)}` : 'unknown';
|
|
158
161
|
}
|
|
159
162
|
|
|
@@ -403,7 +406,7 @@ function appendOccurrence(input, options = {}) {
|
|
|
403
406
|
const outputExcerpt = observations.tailBytes(redactedOutput, limits.maxExcerptBytes);
|
|
404
407
|
const signature = typeof input.signature === 'string' && validIdentifier(input.signature)
|
|
405
408
|
? input.signature
|
|
406
|
-
: normalizeSignature({ commandClass, output: redactedOutput }, { env });
|
|
409
|
+
: normalizeSignature({ commandClass, output: redactedOutput }, { env, host });
|
|
407
410
|
const exitCode = Number.isInteger(input.exitCode) ? input.exitCode : null;
|
|
408
411
|
const matchedLedgerIds = normalizeMatchedLedgerIds(input.matchedLedgerIds);
|
|
409
412
|
const destination = normalizeDestination(input.destination, false);
|
|
@@ -435,6 +438,7 @@ function appendOccurrence(input, options = {}) {
|
|
|
435
438
|
? options.lockTimeoutMs : limits.defaultLockTimeoutMs;
|
|
436
439
|
|
|
437
440
|
let outcome = null;
|
|
441
|
+
let failureReason = null;
|
|
438
442
|
let saved = record;
|
|
439
443
|
const locked = observations.withLock(root, () => {
|
|
440
444
|
const index = loadIndex(file);
|
|
@@ -452,6 +456,13 @@ function appendOccurrence(input, options = {}) {
|
|
|
452
456
|
return;
|
|
453
457
|
}
|
|
454
458
|
}
|
|
459
|
+
const collision = index.records.some(r => r && r.kind !== 'occurrence' &&
|
|
460
|
+
r.workspaceKey === workspaceKey && r.provisionalId === provisionalId);
|
|
461
|
+
if (collision) {
|
|
462
|
+
outcome = 'invalid';
|
|
463
|
+
failureReason = 'provisional-id-in-use';
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
455
466
|
index.records.push(record);
|
|
456
467
|
enforceBounds(index, workspaceKey, limits, now);
|
|
457
468
|
observations.writeJsonAtomic(file, index);
|
|
@@ -459,6 +470,7 @@ function appendOccurrence(input, options = {}) {
|
|
|
459
470
|
}, { timeoutMs: lockTimeoutMs });
|
|
460
471
|
|
|
461
472
|
if (!locked) return { status: 'lock-timeout', record: null };
|
|
473
|
+
if (failureReason) return { status: 'invalid', record: null, error: failureReason };
|
|
462
474
|
return { status: outcome || 'appended', record: saved };
|
|
463
475
|
} catch (error) {
|
|
464
476
|
return { status: 'error', record: null, error: error && error.message ? error.message : String(error) };
|
|
@@ -528,6 +540,9 @@ function addProvisionalLesson(input, options = {}) {
|
|
|
528
540
|
saved = existing;
|
|
529
541
|
return;
|
|
530
542
|
}
|
|
543
|
+
const collision = index.records.some(r => r && r.kind !== 'provisional-lesson' &&
|
|
544
|
+
r.workspaceKey === workspaceKey && r.provisionalId === provisionalId);
|
|
545
|
+
if (collision) throw new Error('invalid provisionalId: already in use in this workspace');
|
|
531
546
|
index.records.push(record);
|
|
532
547
|
enforceBounds(index, workspaceKey, limits, now);
|
|
533
548
|
observations.writeJsonAtomic(file, index);
|
|
@@ -544,12 +559,12 @@ function listRecords(options = {}) {
|
|
|
544
559
|
const limits = effectiveLimits(options.limits);
|
|
545
560
|
const now = Number.isFinite(options.now) ? options.now : Date.now();
|
|
546
561
|
const { file } = getStorePath({ root: options.root, env });
|
|
547
|
-
const index = loadIndex(file);
|
|
548
562
|
let targetWorkspace = null;
|
|
549
|
-
const
|
|
563
|
+
const scopeOptions = { ...options, root: undefined };
|
|
564
|
+
const workspaceRoot = extractWorkspacePath(scopeOptions);
|
|
550
565
|
const hasSuppliedKey = options.workspaceKey !== undefined && options.workspaceKey !== null && options.workspaceKey !== '';
|
|
551
|
-
if (
|
|
552
|
-
const canonicalKey = resolveCanonicalWorkspaceKey(
|
|
566
|
+
if (workspaceRoot) {
|
|
567
|
+
const canonicalKey = resolveCanonicalWorkspaceKey({ workspaceRoot }, { env });
|
|
553
568
|
if (!canonicalKey) return [];
|
|
554
569
|
if (hasSuppliedKey) {
|
|
555
570
|
if (!isBoundedWorkspaceKey(options.workspaceKey) || options.workspaceKey.trim() !== canonicalKey) {
|
|
@@ -561,10 +576,12 @@ function listRecords(options = {}) {
|
|
|
561
576
|
if (!isBoundedWorkspaceKey(options.workspaceKey)) return [];
|
|
562
577
|
targetWorkspace = options.workspaceKey.trim();
|
|
563
578
|
}
|
|
579
|
+
if (!targetWorkspace) return [];
|
|
580
|
+
const index = loadIndex(file);
|
|
564
581
|
let records = index.records.filter(record => {
|
|
565
582
|
if (!isObject(record)) return false;
|
|
566
583
|
if (!withinRetention(record, now, limits.retentionMs)) return false;
|
|
567
|
-
if (
|
|
584
|
+
if (record.workspaceKey !== targetWorkspace) return false;
|
|
568
585
|
if (options.kind && record.kind !== options.kind) return false;
|
|
569
586
|
if (options.destination && record.destination !== options.destination) return false;
|
|
570
587
|
if (options.signature && record.signature !== options.signature) return false;
|
package/package.json
CHANGED
|
@@ -153,7 +153,10 @@ function normalizeSignature(input, options = {}) {
|
|
|
153
153
|
// Order-independent composite for ambiguous multi-family output (E-0027).
|
|
154
154
|
suffix = `multi-${observations.sha(families.join(','), 8)}`;
|
|
155
155
|
} else {
|
|
156
|
-
const
|
|
156
|
+
const fallbackOutput = options.host === 'claude'
|
|
157
|
+
? redacted.replace(/^Exit code [0-9]+\r?\n/, '')
|
|
158
|
+
: redacted;
|
|
159
|
+
const normalized = normalizeFallbackText(fallbackOutput);
|
|
157
160
|
suffix = normalized ? `generic-${observations.sha(normalized, 12)}` : 'unknown';
|
|
158
161
|
}
|
|
159
162
|
|
|
@@ -403,7 +406,7 @@ function appendOccurrence(input, options = {}) {
|
|
|
403
406
|
const outputExcerpt = observations.tailBytes(redactedOutput, limits.maxExcerptBytes);
|
|
404
407
|
const signature = typeof input.signature === 'string' && validIdentifier(input.signature)
|
|
405
408
|
? input.signature
|
|
406
|
-
: normalizeSignature({ commandClass, output: redactedOutput }, { env });
|
|
409
|
+
: normalizeSignature({ commandClass, output: redactedOutput }, { env, host });
|
|
407
410
|
const exitCode = Number.isInteger(input.exitCode) ? input.exitCode : null;
|
|
408
411
|
const matchedLedgerIds = normalizeMatchedLedgerIds(input.matchedLedgerIds);
|
|
409
412
|
const destination = normalizeDestination(input.destination, false);
|
|
@@ -435,6 +438,7 @@ function appendOccurrence(input, options = {}) {
|
|
|
435
438
|
? options.lockTimeoutMs : limits.defaultLockTimeoutMs;
|
|
436
439
|
|
|
437
440
|
let outcome = null;
|
|
441
|
+
let failureReason = null;
|
|
438
442
|
let saved = record;
|
|
439
443
|
const locked = observations.withLock(root, () => {
|
|
440
444
|
const index = loadIndex(file);
|
|
@@ -452,6 +456,13 @@ function appendOccurrence(input, options = {}) {
|
|
|
452
456
|
return;
|
|
453
457
|
}
|
|
454
458
|
}
|
|
459
|
+
const collision = index.records.some(r => r && r.kind !== 'occurrence' &&
|
|
460
|
+
r.workspaceKey === workspaceKey && r.provisionalId === provisionalId);
|
|
461
|
+
if (collision) {
|
|
462
|
+
outcome = 'invalid';
|
|
463
|
+
failureReason = 'provisional-id-in-use';
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
455
466
|
index.records.push(record);
|
|
456
467
|
enforceBounds(index, workspaceKey, limits, now);
|
|
457
468
|
observations.writeJsonAtomic(file, index);
|
|
@@ -459,6 +470,7 @@ function appendOccurrence(input, options = {}) {
|
|
|
459
470
|
}, { timeoutMs: lockTimeoutMs });
|
|
460
471
|
|
|
461
472
|
if (!locked) return { status: 'lock-timeout', record: null };
|
|
473
|
+
if (failureReason) return { status: 'invalid', record: null, error: failureReason };
|
|
462
474
|
return { status: outcome || 'appended', record: saved };
|
|
463
475
|
} catch (error) {
|
|
464
476
|
return { status: 'error', record: null, error: error && error.message ? error.message : String(error) };
|
|
@@ -528,6 +540,9 @@ function addProvisionalLesson(input, options = {}) {
|
|
|
528
540
|
saved = existing;
|
|
529
541
|
return;
|
|
530
542
|
}
|
|
543
|
+
const collision = index.records.some(r => r && r.kind !== 'provisional-lesson' &&
|
|
544
|
+
r.workspaceKey === workspaceKey && r.provisionalId === provisionalId);
|
|
545
|
+
if (collision) throw new Error('invalid provisionalId: already in use in this workspace');
|
|
531
546
|
index.records.push(record);
|
|
532
547
|
enforceBounds(index, workspaceKey, limits, now);
|
|
533
548
|
observations.writeJsonAtomic(file, index);
|
|
@@ -544,12 +559,12 @@ function listRecords(options = {}) {
|
|
|
544
559
|
const limits = effectiveLimits(options.limits);
|
|
545
560
|
const now = Number.isFinite(options.now) ? options.now : Date.now();
|
|
546
561
|
const { file } = getStorePath({ root: options.root, env });
|
|
547
|
-
const index = loadIndex(file);
|
|
548
562
|
let targetWorkspace = null;
|
|
549
|
-
const
|
|
563
|
+
const scopeOptions = { ...options, root: undefined };
|
|
564
|
+
const workspaceRoot = extractWorkspacePath(scopeOptions);
|
|
550
565
|
const hasSuppliedKey = options.workspaceKey !== undefined && options.workspaceKey !== null && options.workspaceKey !== '';
|
|
551
|
-
if (
|
|
552
|
-
const canonicalKey = resolveCanonicalWorkspaceKey(
|
|
566
|
+
if (workspaceRoot) {
|
|
567
|
+
const canonicalKey = resolveCanonicalWorkspaceKey({ workspaceRoot }, { env });
|
|
553
568
|
if (!canonicalKey) return [];
|
|
554
569
|
if (hasSuppliedKey) {
|
|
555
570
|
if (!isBoundedWorkspaceKey(options.workspaceKey) || options.workspaceKey.trim() !== canonicalKey) {
|
|
@@ -561,10 +576,12 @@ function listRecords(options = {}) {
|
|
|
561
576
|
if (!isBoundedWorkspaceKey(options.workspaceKey)) return [];
|
|
562
577
|
targetWorkspace = options.workspaceKey.trim();
|
|
563
578
|
}
|
|
579
|
+
if (!targetWorkspace) return [];
|
|
580
|
+
const index = loadIndex(file);
|
|
564
581
|
let records = index.records.filter(record => {
|
|
565
582
|
if (!isObject(record)) return false;
|
|
566
583
|
if (!withinRetention(record, now, limits.retentionMs)) return false;
|
|
567
|
-
if (
|
|
584
|
+
if (record.workspaceKey !== targetWorkspace) return false;
|
|
568
585
|
if (options.kind && record.kind !== options.kind) return false;
|
|
569
586
|
if (options.destination && record.destination !== options.destination) return false;
|
|
570
587
|
if (options.signature && record.signature !== options.signature) return false;
|
|
@@ -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": "1.2.
|
|
4
|
+
"version": "1.2.1",
|
|
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:4d2c7e1b-2804-5ea7-9a87-bee3a22e4e60",
|
|
6
6
|
"version": 1,
|
|
7
7
|
"metadata": {
|
|
8
|
-
"timestamp": "2026-11-
|
|
8
|
+
"timestamp": "2026-11-26T01:54:59.250Z",
|
|
9
9
|
"tools": [
|
|
10
10
|
{
|
|
11
11
|
"vendor": "Harness Everything",
|
|
12
12
|
"name": "generate-sbom.js",
|
|
13
|
-
"version": "1.2.
|
|
13
|
+
"version": "1.2.1"
|
|
14
14
|
}
|
|
15
15
|
],
|
|
16
16
|
"component": {
|
|
17
17
|
"type": "application",
|
|
18
|
-
"bom-ref": "pkg:npm/harness-everything@1.2.
|
|
18
|
+
"bom-ref": "pkg:npm/harness-everything@1.2.1",
|
|
19
19
|
"name": "harness-everything",
|
|
20
|
-
"version": "1.2.
|
|
21
|
-
"purl": "pkg:npm/harness-everything@1.2.
|
|
20
|
+
"version": "1.2.1",
|
|
21
|
+
"purl": "pkg:npm/harness-everything@1.2.1"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"components": [
|
|
@@ -2033,7 +2033,7 @@
|
|
|
2033
2033
|
]
|
|
2034
2034
|
},
|
|
2035
2035
|
{
|
|
2036
|
-
"ref": "pkg:npm/harness-everything@1.2.
|
|
2036
|
+
"ref": "pkg:npm/harness-everything@1.2.1",
|
|
2037
2037
|
"dependsOn": [
|
|
2038
2038
|
"pkg:npm/%40commitlint/cli@19.8.1",
|
|
2039
2039
|
"pkg:npm/%40commitlint/config-conventional@19.8.1",
|