harness-everything 1.3.0 → 1.3.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.
Files changed (125) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +6 -0
  4. package/ci/archive/325-prep/README.md +9 -2
  5. package/ci/archive/325-prep/doc-reconciliation-red.js +34 -8
  6. package/ci/fixtures/553-t2a/body-edit/base/.agents/harness-everything/project-docs.json +11 -0
  7. package/ci/fixtures/553-t2a/body-edit/base/docs/a.md +6 -0
  8. package/ci/fixtures/553-t2a/body-edit/base/docs/b.md +1 -0
  9. package/ci/fixtures/553-t2a/body-edit/candidate/docs/a.md +6 -0
  10. package/ci/fixtures/553-t2c/derived-regenerate-must/base/docs/adr/EVID-001-verify-all-evidence.md +11 -0
  11. package/ci/fixtures/553-t2c/derived-regenerate-must/base/docs/governed-index.md +19 -0
  12. package/ci/fixtures/553-t2c/derived-regenerate-must/candidate/docs/adr/EVID-001-verify-all-evidence.md +11 -0
  13. package/ci/fixtures/553-t2c/derived-regenerate-must/candidate/docs/governed-index.md +19 -0
  14. package/ci/fixtures/553-t2c/derived-regenerate-must/config.json +17 -0
  15. package/ci/fixtures/doc-obligations/derive/regression-pins.json +153 -0
  16. package/ci/fixtures/state-persist-post-tool-use/harness.js +206 -0
  17. package/ci/fixtures/state-persist-post-tool-use/off-handoff-golden.json +16 -0
  18. package/ci/fixtures/state-persist-post-tool-use/payload-post-tool-use-success.json +13 -0
  19. package/ci/fixtures/stop/fail-session-writes.js +109 -0
  20. package/ci/fixtures/workflow-contract/cases.json +3355 -0
  21. package/ci/fixtures/workflow-contract/wiring-cases.json +560 -0
  22. package/ci/lib/doc-reconciliation-prep-fixtures.js +4 -9
  23. package/ci/mechanism-2an-workflow-replay.test.js +324 -0
  24. package/ci/mechanism-2ax-doc-lifecycle.test.js +132 -0
  25. package/ci/mechanism-325-3a-doc-evidence.test.js +73 -0
  26. package/ci/mechanism-325-3a-doc-obligations.test.js +61 -0
  27. package/ci/mechanism-325-3b-preparation.test.js +208 -49
  28. package/ci/mechanism-325-3b-s1-review.test.js +20 -828
  29. package/ci/mechanism-325-3b-s3-providers.test.js +59 -0
  30. package/ci/mechanism-325-f3-derived-views.test.js +140 -0
  31. package/ci/mechanism-341-opencode-lane.test.js +164 -284
  32. package/ci/mechanism-35-verification-contract.test.js +246 -0
  33. package/ci/mechanism-365-step-edit-accounting.test.js +5 -6
  34. package/ci/mechanism-383-doc-glob-line-terminators.test.js +0 -30
  35. package/ci/mechanism-397-opencode-observations.test.js +151 -18
  36. package/ci/mechanism-553-e1-unhook-credit.test.js +328 -0
  37. package/ci/mechanism-553-p2a-claude-hooks.test.js +98 -0
  38. package/ci/mechanism-553-p3-plan-start.test.js +212 -0
  39. package/ci/mechanism-553-state-persist-post-tool-use.test.js +307 -0
  40. package/ci/mechanism-553-stop.test.js +427 -0
  41. package/ci/mechanism-553-t2a-derive.test.js +110 -0
  42. package/ci/mechanism-553-t2c-derive.test.js +94 -0
  43. package/ci/mechanism-e1-derived-regenerate.test.js +45 -206
  44. package/ci/mechanism-outline-sanitizer.test.js +0 -8
  45. package/ci/mechanism-pr-a-conflict-check.test.js +38 -305
  46. package/ci/mechanism-prb-outline-review.test.js +101 -3283
  47. package/docs/adr/DOCS-006-reconciliation-pilot.md +4 -2
  48. package/docs/adr/DOCS-008-obligation-abstraction-bounded-consumer.md +3 -3
  49. package/docs/doc-workflow-reconciliation.md +17 -2
  50. package/docs/document-lifecycle.md +6 -2
  51. package/docs/platform-capabilities.md +35 -5
  52. package/hooks/hooks.json +0 -46
  53. package/hooks/scripts/lib/workflow-obligations.js +0 -55
  54. package/hooks/scripts/state-persist.js +7 -95
  55. package/hooks/scripts/workflow-disposition.js +0 -2
  56. package/hooks/scripts/workflow-stop-gate.js +17 -30
  57. package/opencode-plugin/index.mjs +6 -70
  58. package/opencode-plugin/plugin.json +1 -1
  59. package/package.json +1 -1
  60. package/plugins/harness-everything/.antigravity-plugin/plugin.json +1 -1
  61. package/plugins/harness-everything/.codex-plugin/plugin.json +1 -1
  62. package/plugins/harness-everything/hooks/scripts/lib/workflow-obligations.js +0 -55
  63. package/plugins/harness-everything/hooks/scripts/state-persist.js +7 -95
  64. package/plugins/harness-everything/hooks/scripts/workflow-disposition.js +0 -2
  65. package/plugins/harness-everything/hooks/scripts/workflow-stop-gate.js +17 -30
  66. package/plugins/harness-everything/plugin.json +1 -1
  67. package/sbom.cdx.json +7 -7
  68. package/ci/fixtures/doc-obligations/reconciliation-s1/cases.json +0 -6854
  69. package/ci/fixtures/doc-obligations/reconciliation-s1/fail-session-writes.js +0 -116
  70. package/ci/fixtures/doc-obligations/reconciliation-s2a/harness.js +0 -507
  71. package/ci/fixtures/doc-obligations/reconciliation-s2a/run13-workflow-requirements.json +0 -42
  72. package/ci/fixtures/doc-obligations/reconciliation-s2a/vectors.json +0 -617
  73. package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/harness.js +0 -415
  74. package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/payload-post-tool-use-success-minimal.json +0 -9
  75. package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/payload-subagent-start.json +0 -7
  76. package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/payload-subagent-stop-freetext-reject.json +0 -11
  77. package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/payload-subagent-stop-reject.json +0 -11
  78. package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/payload-subagent-stop.json +0 -11
  79. package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/payload-task-result.json +0 -19
  80. package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/off-capture-only.json +0 -99
  81. package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/off-legacy.json +0 -67
  82. package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/on-concurrent-writers.json +0 -62
  83. package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/on-lookalikes-runtime-mutations.json +0 -67
  84. package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/on-malformed.json +0 -85
  85. package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/on-normal-session.json +0 -74
  86. package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/on-runtime-drift-later-npm-test.json +0 -58
  87. package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/on-valid-direct-quoted-review.json +0 -85
  88. package/ci/fixtures/doc-obligations/reconciliation-s2b/f4/cases.json +0 -2267
  89. package/ci/fixtures/doc-obligations/reconciliation-s2b/wiring/cases.json +0 -1110
  90. package/ci/lib/doc-reconciliation-file-spy.js +0 -23
  91. package/ci/lib/doc-reconciliation-qualification-preload.js +0 -37
  92. package/ci/lib/doc-reconciliation-replay.js +0 -104
  93. package/ci/lib/doc-reconciliation-staged-tree.js +0 -102
  94. package/ci/mechanism-325-3b-h1-qualification.test.js +0 -206
  95. package/ci/mechanism-325-3b-s1.test.js +0 -188
  96. package/ci/mechanism-325-3b-s2a-core.test.js +0 -840
  97. package/ci/mechanism-325-3b-s2a-producer.test.js +0 -564
  98. package/ci/mechanism-325-3b-s2b-capture.test.js +0 -566
  99. package/ci/mechanism-325-3b-s2b-wiring.test.js +0 -679
  100. package/ci/mechanism-325-f4-invariants.test.js +0 -606
  101. package/ci/mechanism-325-f4-projections.test.js +0 -392
  102. package/ci/mechanism-325-f4-qualification.test.js +0 -228
  103. package/ci/mechanism-325-f4-trust-boundary.test.js +0 -880
  104. package/ci/mechanism-e1-dependency-artifact-scope.test.js +0 -657
  105. package/hooks/scripts/lib/doc-reconciliation-capture.sanitized.jsonl +0 -26
  106. package/hooks/scripts/lib/doc-reconciliation-core.js +0 -336
  107. package/hooks/scripts/lib/doc-reconciliation-events.js +0 -292
  108. package/hooks/scripts/lib/doc-reconciliation-outline-capture.sanitized.jsonl +0 -24
  109. package/hooks/scripts/lib/doc-reconciliation-pilot.js +0 -482
  110. package/hooks/scripts/lib/doc-reconciliation-producer.js +0 -468
  111. package/hooks/scripts/lib/doc-reconciliation-provider.js +0 -3304
  112. package/hooks/scripts/lib/doc-reconciliation-qualification.json +0 -54
  113. package/hooks/scripts/w6-state-operations.js +0 -239
  114. package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-capture.sanitized.jsonl +0 -26
  115. package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-core.js +0 -336
  116. package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-events.js +0 -292
  117. package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-outline-capture.sanitized.jsonl +0 -24
  118. package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-pilot.js +0 -482
  119. package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-producer.js +0 -468
  120. package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-provider.js +0 -3304
  121. package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-qualification.json +0 -54
  122. package/plugins/harness-everything/hooks/scripts/w6-state-operations.js +0 -239
  123. package/scripts/system-one-eval-laya.js +0 -112
  124. /package/ci/fixtures/{doc-obligations/reconciliation-s2b/capture → state-persist-post-tool-use}/payload-post-tool-use-failure.json +0 -0
  125. /package/ci/fixtures/{doc-obligations/reconciliation-s2b/wiring → workflow-contract}/legacy-off-golden.json +0 -0
@@ -0,0 +1,13 @@
1
+ {
2
+ "session_id": "r2c1-sess-a",
3
+ "prompt_id": "550e8400-e29b-41d4-a716-446655440000",
4
+ "transcript_path": "/tmp/r2c1/transcript-a.jsonl",
5
+ "cwd": "/tmp/r2c1-ws",
6
+ "permission_mode": "default",
7
+ "hook_event_name": "PostToolUse",
8
+ "tool_name": "Bash",
9
+ "tool_input": { "command": "npm test", "description": "Run test suite" },
10
+ "tool_response": { "stdout": "ok", "stderr": "", "interrupted": false, "isImage": false },
11
+ "tool_use_id": "toolu_r2c1_a",
12
+ "duration_ms": 12
13
+ }
@@ -0,0 +1,109 @@
1
+ 'use strict';
2
+
3
+ // Test preload for real Stop hooks: reject writes whose target is inside one
4
+ // selected session directory while leaving reads and unrelated writes alone.
5
+ // The migration suite passes the target with HARNESS_STOP_TEST_SESSION_DIR.
6
+
7
+ const fs = require('node:fs');
8
+ const path = require('node:path');
9
+
10
+ (function install() {
11
+ const sessionDirectory = process.env.HARNESS_STOP_TEST_SESSION_DIR;
12
+ if (!sessionDirectory) return;
13
+ let resolvedDirectory;
14
+ try { resolvedDirectory = path.resolve(sessionDirectory); } catch (_) { return; }
15
+ if (!resolvedDirectory || resolvedDirectory === path.parse(resolvedDirectory).root) return;
16
+
17
+ function unwritable(target) {
18
+ if (target === undefined || target === null) return false;
19
+ try {
20
+ const resolved = path.resolve(String(target));
21
+ const relative = path.relative(resolvedDirectory, resolved);
22
+ return relative === '' || (!relative.startsWith('..' + path.sep) && relative !== '..' && !path.isAbsolute(relative));
23
+ } catch (_) { return false; }
24
+ }
25
+
26
+ function denied(method, target) {
27
+ const error = new Error(`EACCES: permission denied, ${method} ${target} (simulated session store write failure)`);
28
+ error.code = 'EACCES';
29
+ error.errno = -13;
30
+ error.syscall = method;
31
+ error.path = String(target);
32
+ return error;
33
+ }
34
+
35
+ const originalWriteFileSync = fs.writeFileSync;
36
+ fs.writeFileSync = function (file, ...rest) {
37
+ if (unwritable(file)) throw denied('write', file);
38
+ return originalWriteFileSync.call(fs, file, ...rest);
39
+ };
40
+
41
+ const originalRenameSync = fs.renameSync;
42
+ fs.renameSync = function (from, to, ...rest) {
43
+ if (unwritable(from) || unwritable(to)) throw denied('rename', from);
44
+ return originalRenameSync.call(fs, from, to, ...rest);
45
+ };
46
+
47
+ const originalOpenSync = fs.openSync;
48
+ fs.openSync = function (file, flags, ...rest) {
49
+ const value = String(flags || 'r');
50
+ if (unwritable(file) && (value.startsWith('w') || value.startsWith('a') || value.includes('+') || value.includes('x'))) {
51
+ throw denied('open', file);
52
+ }
53
+ return originalOpenSync.call(fs, file, flags, ...rest);
54
+ };
55
+
56
+ const originalUnlinkSync = fs.unlinkSync;
57
+ fs.unlinkSync = function (file, ...rest) {
58
+ if (unwritable(file)) throw denied('unlink', file);
59
+ return originalUnlinkSync.call(fs, file, ...rest);
60
+ };
61
+
62
+ const callback = args => typeof args[args.length - 1] === 'function' ? args[args.length - 1] : () => {};
63
+ const originalWriteFile = fs.writeFile;
64
+ fs.writeFile = function (file, data, ...rest) {
65
+ const done = callback(rest);
66
+ if (unwritable(file)) return process.nextTick(() => done(denied('write', file)));
67
+ return originalWriteFile.call(fs, file, data, ...rest);
68
+ };
69
+
70
+ const originalRename = fs.rename;
71
+ fs.rename = function (from, to, ...rest) {
72
+ const done = callback(rest);
73
+ if (unwritable(from) || unwritable(to)) return process.nextTick(() => done(denied('rename', from)));
74
+ return originalRename.call(fs, from, to, ...rest);
75
+ };
76
+
77
+ const originalUnlink = fs.unlink;
78
+ fs.unlink = function (file, ...rest) {
79
+ const done = callback(rest);
80
+ if (unwritable(file)) return process.nextTick(() => done(denied('unlink', file)));
81
+ return originalUnlink.call(fs, file, ...rest);
82
+ };
83
+
84
+ const promises = fs.promises;
85
+ if (!promises) return;
86
+ const originalPromisesWriteFile = promises.writeFile;
87
+ promises.writeFile = function (file, data, ...rest) {
88
+ if (unwritable(file)) return Promise.reject(denied('write', file));
89
+ return originalPromisesWriteFile.call(promises, file, data, ...rest);
90
+ };
91
+ const originalPromisesRename = promises.rename;
92
+ promises.rename = function (from, to, ...rest) {
93
+ if (unwritable(from) || unwritable(to)) return Promise.reject(denied('rename', from));
94
+ return originalPromisesRename.call(promises, from, to, ...rest);
95
+ };
96
+ const originalPromisesUnlink = promises.unlink;
97
+ promises.unlink = function (file, ...rest) {
98
+ if (unwritable(file)) return Promise.reject(denied('unlink', file));
99
+ return originalPromisesUnlink.call(promises, file, ...rest);
100
+ };
101
+ const originalPromisesOpen = promises.open;
102
+ promises.open = function (file, flags, ...rest) {
103
+ const value = String(flags || 'r');
104
+ if (unwritable(file) && (value.startsWith('w') || value.startsWith('a') || value.includes('+') || value.includes('x'))) {
105
+ return Promise.reject(denied('open', file));
106
+ }
107
+ return originalPromisesOpen.call(promises, file, flags, ...rest);
108
+ };
109
+ })();