harness-everything 1.3.0 → 1.3.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.
Files changed (216) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/AGENTS.md +1 -1
  4. package/CHANGELOG.md +14 -0
  5. package/behavioral-evals/ledger-pairs/README.md +53 -0
  6. package/behavioral-evals/ledger-pairs/arm.js +359 -0
  7. package/behavioral-evals/ledger-pairs/fixture.js +138 -0
  8. package/behavioral-evals/ledger-pairs/preflight.js +96 -0
  9. package/behavioral-evals/ledger-pairs/score.js +155 -0
  10. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/README.md +108 -0
  11. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/agy/pair-1-baseline/arm-plan.json +14 -0
  12. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/agy/pair-1-baseline/arm-result.json +35 -0
  13. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/agy/pair-1-treatment/arm-plan.json +14 -0
  14. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/agy/pair-1-treatment/arm-result.json +35 -0
  15. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/agy/pair-2-baseline/arm-plan.json +14 -0
  16. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/agy/pair-2-baseline/arm-result.json +35 -0
  17. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/agy/pair-2-treatment/arm-plan.json +14 -0
  18. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/agy/pair-2-treatment/arm-result.json +35 -0
  19. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/agy/pair-3-baseline/arm-plan.json +14 -0
  20. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/agy/pair-3-baseline/arm-result.json +35 -0
  21. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/agy/pair-3-treatment/arm-plan.json +14 -0
  22. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/agy/pair-3-treatment/arm-result.json +35 -0
  23. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/agy/pair-4-baseline/arm-plan.json +14 -0
  24. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/agy/pair-4-baseline/arm-result.json +28 -0
  25. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/agy/pair-4-treatment/arm-plan.json +14 -0
  26. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/agy/pair-4-treatment/arm-result.json +35 -0
  27. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/codex/pair-1-baseline/arm-plan.json +13 -0
  28. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/codex/pair-1-baseline/arm-result.json +56 -0
  29. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/codex/pair-1-treatment/arm-plan.json +13 -0
  30. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/codex/pair-1-treatment/arm-result.json +56 -0
  31. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/codex/pair-2-baseline/arm-plan.json +13 -0
  32. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/codex/pair-2-baseline/arm-result.json +56 -0
  33. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/codex/pair-2-treatment/arm-plan.json +13 -0
  34. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/codex/pair-2-treatment/arm-result.json +56 -0
  35. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/codex/pair-3-baseline/arm-plan.json +13 -0
  36. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/codex/pair-3-baseline/arm-result.json +49 -0
  37. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/codex/pair-3-treatment/arm-plan.json +13 -0
  38. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/codex/pair-3-treatment/arm-result.json +49 -0
  39. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/codex/pair-4-baseline/arm-plan.json +13 -0
  40. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/codex/pair-4-baseline/arm-result.json +49 -0
  41. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/codex/pair-4-treatment/arm-plan.json +13 -0
  42. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/codex/pair-4-treatment/arm-result.json +56 -0
  43. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/opencode/pair-1-baseline/arm-plan.json +14 -0
  44. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/opencode/pair-1-baseline/arm-result.json +44 -0
  45. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/opencode/pair-1-baseline/receipt.jsonl +17 -0
  46. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/opencode/pair-1-treatment/arm-plan.json +14 -0
  47. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/opencode/pair-1-treatment/arm-result.json +41 -0
  48. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/opencode/pair-1-treatment/receipt.jsonl +58 -0
  49. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/opencode/pair-2-baseline/arm-plan.json +14 -0
  50. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/opencode/pair-2-baseline/arm-result.json +50 -0
  51. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/opencode/pair-2-baseline/receipt.jsonl +101 -0
  52. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/opencode/pair-2-treatment/arm-plan.json +14 -0
  53. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/opencode/pair-2-treatment/arm-result.json +44 -0
  54. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/opencode/pair-2-treatment/receipt.jsonl +29 -0
  55. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/opencode/pair-3-baseline/arm-plan.json +14 -0
  56. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/opencode/pair-3-baseline/arm-result.json +44 -0
  57. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/opencode/pair-3-baseline/receipt.jsonl +23 -0
  58. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/opencode/pair-3-treatment/arm-plan.json +14 -0
  59. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/opencode/pair-3-treatment/arm-result.json +34 -0
  60. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/opencode/pair-3-treatment/receipt.jsonl +24 -0
  61. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/opencode/pair-4-baseline/arm-plan.json +14 -0
  62. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/opencode/pair-4-baseline/arm-result.json +47 -0
  63. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/opencode/pair-4-baseline/receipt.jsonl +69 -0
  64. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/opencode/pair-4-treatment/arm-plan.json +14 -0
  65. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/opencode/pair-4-treatment/arm-result.json +44 -0
  66. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/opencode/pair-4-treatment/receipt.jsonl +65 -0
  67. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/run-order.sh +18 -0
  68. package/benchmarks/results/live-host/ledger-pairs-2026-11-28/score.json +1032 -0
  69. package/benchmarks/results/live-host/opencode-2026-11-28-397-turn-export/README.md +50 -0
  70. package/benchmarks/results/live-host/opencode-2026-11-28-397-turn-export/collect-rerun.txt +3 -0
  71. package/benchmarks/results/live-host/opencode-2026-11-28-397-turn-export/export-report.json +22 -0
  72. package/benchmarks/results/live-host/opencode-2026-11-28-397-turn-export/host-version.txt +1 -0
  73. package/benchmarks/results/live-host/opencode-2026-11-28-397-turn-export/import-report-1.json +18 -0
  74. package/benchmarks/results/live-host/opencode-2026-11-28-397-turn-export/import-report-2.json +18 -0
  75. package/benchmarks/results/live-host/opencode-2026-11-28-397-turn-export/labels-observed-excerpt.jsonl +2 -0
  76. package/benchmarks/results/live-host/opencode-2026-11-28-397-turn-export/observations-index-excerpt.json +26 -0
  77. package/benchmarks/results/live-host/opencode-2026-11-28-397-turn-export/plugin-load-lines.txt +1 -0
  78. package/benchmarks/results/live-host/opencode-2026-11-28-450-steering-trace/README.md +46 -0
  79. package/benchmarks/results/live-host/opencode-2026-11-28-450-steering-trace/observations-index-excerpt.json +16 -0
  80. package/benchmarks/results/live-host/opencode-2026-11-28-450-steering-trace/plugin-load-lines.txt +2 -0
  81. package/benchmarks/results/live-host/opencode-2026-11-28-450-steering-trace/run-marks.txt +6 -0
  82. package/benchmarks/results/live-host/opencode-2026-11-28-450-steering-trace/steering-probe.js +16 -0
  83. package/benchmarks/results/live-host/opencode-2026-11-28-450-steering-trace/steering-trace.jsonl +167 -0
  84. package/ci/archive/325-prep/README.md +9 -2
  85. package/ci/archive/325-prep/doc-reconciliation-red.js +34 -8
  86. package/ci/fixtures/553-t2a/body-edit/base/.agents/harness-everything/project-docs.json +11 -0
  87. package/ci/fixtures/553-t2a/body-edit/base/docs/a.md +6 -0
  88. package/ci/fixtures/553-t2a/body-edit/base/docs/b.md +1 -0
  89. package/ci/fixtures/553-t2a/body-edit/candidate/docs/a.md +6 -0
  90. package/ci/fixtures/553-t2c/derived-regenerate-must/base/docs/adr/EVID-001-verify-all-evidence.md +11 -0
  91. package/ci/fixtures/553-t2c/derived-regenerate-must/base/docs/governed-index.md +19 -0
  92. package/ci/fixtures/553-t2c/derived-regenerate-must/candidate/docs/adr/EVID-001-verify-all-evidence.md +11 -0
  93. package/ci/fixtures/553-t2c/derived-regenerate-must/candidate/docs/governed-index.md +19 -0
  94. package/ci/fixtures/553-t2c/derived-regenerate-must/config.json +17 -0
  95. package/ci/fixtures/doc-obligations/derive/regression-pins.json +153 -0
  96. package/ci/fixtures/state-persist-post-tool-use/harness.js +206 -0
  97. package/ci/fixtures/state-persist-post-tool-use/off-handoff-golden.json +16 -0
  98. package/ci/fixtures/state-persist-post-tool-use/payload-post-tool-use-success.json +13 -0
  99. package/ci/fixtures/stop/fail-session-writes.js +109 -0
  100. package/ci/fixtures/workflow-contract/cases.json +3355 -0
  101. package/ci/fixtures/workflow-contract/wiring-cases.json +560 -0
  102. package/ci/lib/doc-reconciliation-prep-fixtures.js +4 -9
  103. package/ci/mechanism-2an-workflow-replay.test.js +324 -0
  104. package/ci/mechanism-2ax-doc-lifecycle.test.js +132 -0
  105. package/ci/mechanism-325-3a-doc-evidence.test.js +73 -0
  106. package/ci/mechanism-325-3a-doc-obligations.test.js +61 -0
  107. package/ci/mechanism-325-3b-preparation.test.js +208 -49
  108. package/ci/mechanism-325-3b-s1-review.test.js +20 -828
  109. package/ci/mechanism-325-3b-s3-providers.test.js +59 -0
  110. package/ci/mechanism-325-f3-derived-views.test.js +140 -0
  111. package/ci/mechanism-332-fable-directive.test.js +180 -0
  112. package/ci/mechanism-341-opencode-lane.test.js +164 -284
  113. package/ci/mechanism-35-verification-contract.test.js +246 -0
  114. package/ci/mechanism-365-step-edit-accounting.test.js +5 -6
  115. package/ci/mechanism-383-doc-glob-line-terminators.test.js +0 -30
  116. package/ci/mechanism-397-opencode-observations.test.js +151 -18
  117. package/ci/mechanism-552-ledger-pairs.test.js +159 -0
  118. package/ci/mechanism-553-e1-unhook-credit.test.js +328 -0
  119. package/ci/mechanism-553-p2a-claude-hooks.test.js +98 -0
  120. package/ci/mechanism-553-p3-plan-start.test.js +212 -0
  121. package/ci/mechanism-553-state-persist-post-tool-use.test.js +307 -0
  122. package/ci/mechanism-553-stop.test.js +427 -0
  123. package/ci/mechanism-553-t2a-derive.test.js +110 -0
  124. package/ci/mechanism-553-t2c-derive.test.js +94 -0
  125. package/ci/mechanism-e1-derived-regenerate.test.js +45 -206
  126. package/ci/mechanism-outline-sanitizer.test.js +0 -8
  127. package/ci/mechanism-pr-a-conflict-check.test.js +38 -305
  128. package/ci/mechanism-prb-outline-review.test.js +101 -3283
  129. package/ci/router-workflow-plan.test.js +61 -21
  130. package/docs/adr/DOCS-006-reconciliation-pilot.md +4 -2
  131. package/docs/adr/DOCS-008-obligation-abstraction-bounded-consumer.md +3 -3
  132. package/docs/doc-workflow-reconciliation.md +17 -2
  133. package/docs/document-lifecycle.md +6 -2
  134. package/docs/platform-capabilities.md +63 -16
  135. package/docs/platform-compatibility.json +5 -5
  136. package/harness-everything/SKILL.md +1 -1
  137. package/harness-everything/scripts/routing-keywords.json +0 -2
  138. package/harness-everything/scripts/tier-router.js +105 -11
  139. package/hooks/hooks.json +0 -46
  140. package/hooks/scripts/lib/workflow-obligations.js +0 -55
  141. package/hooks/scripts/state-persist.js +7 -95
  142. package/hooks/scripts/workflow-disposition.js +0 -2
  143. package/hooks/scripts/workflow-stop-gate.js +17 -30
  144. package/opencode-plugin/index.mjs +6 -70
  145. package/opencode-plugin/plugin.json +1 -1
  146. package/package.json +1 -1
  147. package/plugins/harness-everything/.antigravity-plugin/plugin.json +1 -1
  148. package/plugins/harness-everything/.codex-plugin/plugin.json +1 -1
  149. package/plugins/harness-everything/hooks/scripts/lib/workflow-obligations.js +0 -55
  150. package/plugins/harness-everything/hooks/scripts/state-persist.js +7 -95
  151. package/plugins/harness-everything/hooks/scripts/workflow-disposition.js +0 -2
  152. package/plugins/harness-everything/hooks/scripts/workflow-stop-gate.js +17 -30
  153. package/plugins/harness-everything/plugin.json +1 -1
  154. package/plugins/harness-everything/rules/AGENTS.md +1 -1
  155. package/plugins/harness-everything/skills/harness-everything/SKILL.md +1 -1
  156. package/plugins/harness-everything/skills/harness-everything/scripts/routing-keywords.json +0 -2
  157. package/plugins/harness-everything/skills/harness-everything/scripts/tier-router.js +105 -11
  158. package/sbom.cdx.json +7 -7
  159. package/ci/fixtures/doc-obligations/reconciliation-s1/cases.json +0 -6854
  160. package/ci/fixtures/doc-obligations/reconciliation-s1/fail-session-writes.js +0 -116
  161. package/ci/fixtures/doc-obligations/reconciliation-s2a/harness.js +0 -507
  162. package/ci/fixtures/doc-obligations/reconciliation-s2a/run13-workflow-requirements.json +0 -42
  163. package/ci/fixtures/doc-obligations/reconciliation-s2a/vectors.json +0 -617
  164. package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/harness.js +0 -415
  165. package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/payload-post-tool-use-success-minimal.json +0 -9
  166. package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/payload-subagent-start.json +0 -7
  167. package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/payload-subagent-stop-freetext-reject.json +0 -11
  168. package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/payload-subagent-stop-reject.json +0 -11
  169. package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/payload-subagent-stop.json +0 -11
  170. package/ci/fixtures/doc-obligations/reconciliation-s2b/capture/payload-task-result.json +0 -19
  171. package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/off-capture-only.json +0 -99
  172. package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/off-legacy.json +0 -67
  173. package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/on-concurrent-writers.json +0 -62
  174. package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/on-lookalikes-runtime-mutations.json +0 -67
  175. package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/on-malformed.json +0 -85
  176. package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/on-normal-session.json +0 -74
  177. package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/on-runtime-drift-later-npm-test.json +0 -58
  178. package/ci/fixtures/doc-obligations/reconciliation-s2b/corpus/on-valid-direct-quoted-review.json +0 -85
  179. package/ci/fixtures/doc-obligations/reconciliation-s2b/f4/cases.json +0 -2267
  180. package/ci/fixtures/doc-obligations/reconciliation-s2b/wiring/cases.json +0 -1110
  181. package/ci/lib/doc-reconciliation-file-spy.js +0 -23
  182. package/ci/lib/doc-reconciliation-qualification-preload.js +0 -37
  183. package/ci/lib/doc-reconciliation-replay.js +0 -104
  184. package/ci/lib/doc-reconciliation-staged-tree.js +0 -102
  185. package/ci/mechanism-325-3b-h1-qualification.test.js +0 -206
  186. package/ci/mechanism-325-3b-s1.test.js +0 -188
  187. package/ci/mechanism-325-3b-s2a-core.test.js +0 -840
  188. package/ci/mechanism-325-3b-s2a-producer.test.js +0 -564
  189. package/ci/mechanism-325-3b-s2b-capture.test.js +0 -566
  190. package/ci/mechanism-325-3b-s2b-wiring.test.js +0 -679
  191. package/ci/mechanism-325-f4-invariants.test.js +0 -606
  192. package/ci/mechanism-325-f4-projections.test.js +0 -392
  193. package/ci/mechanism-325-f4-qualification.test.js +0 -228
  194. package/ci/mechanism-325-f4-trust-boundary.test.js +0 -880
  195. package/ci/mechanism-e1-dependency-artifact-scope.test.js +0 -657
  196. package/hooks/scripts/lib/doc-reconciliation-capture.sanitized.jsonl +0 -26
  197. package/hooks/scripts/lib/doc-reconciliation-core.js +0 -336
  198. package/hooks/scripts/lib/doc-reconciliation-events.js +0 -292
  199. package/hooks/scripts/lib/doc-reconciliation-outline-capture.sanitized.jsonl +0 -24
  200. package/hooks/scripts/lib/doc-reconciliation-pilot.js +0 -482
  201. package/hooks/scripts/lib/doc-reconciliation-producer.js +0 -468
  202. package/hooks/scripts/lib/doc-reconciliation-provider.js +0 -3304
  203. package/hooks/scripts/lib/doc-reconciliation-qualification.json +0 -54
  204. package/hooks/scripts/w6-state-operations.js +0 -239
  205. package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-capture.sanitized.jsonl +0 -26
  206. package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-core.js +0 -336
  207. package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-events.js +0 -292
  208. package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-outline-capture.sanitized.jsonl +0 -24
  209. package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-pilot.js +0 -482
  210. package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-producer.js +0 -468
  211. package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-provider.js +0 -3304
  212. package/plugins/harness-everything/hooks/scripts/lib/doc-reconciliation-qualification.json +0 -54
  213. package/plugins/harness-everything/hooks/scripts/w6-state-operations.js +0 -239
  214. package/scripts/system-one-eval-laya.js +0 -112
  215. /package/ci/fixtures/{doc-obligations/reconciliation-s2b/capture → state-persist-post-tool-use}/payload-post-tool-use-failure.json +0 -0
  216. /package/ci/fixtures/{doc-obligations/reconciliation-s2b/wiring → workflow-contract}/legacy-off-golden.json +0 -0
@@ -261,6 +261,65 @@ for (const leg of LEGS) {
261
261
  }
262
262
  }
263
263
 
264
+ // ---- H1: A / B / omitted advisory provider judgment (moved from 325-3b-h1-qualification) ------------------------------
265
+ // Same three inputs and the same exact-array assertion as the retired H1 qualification suite.
266
+ const H1_PROVIDER_CASES = [
267
+ {
268
+ id: 'A',
269
+ input: {
270
+ activeStep: { id: 'verify-docs', stepType: 'verification' },
271
+ neededCapabilities: ['doc-lint'],
272
+ availableProviderMetadata: [
273
+ { providerId: 'fixture-lint-a', capabilities: ['doc-lint'], stepTypes: ['verification'], requiresHostCapabilities: ['execution-events'], locator: { kind: 'tool', id: 'fixture-lint-a' } }
274
+ ],
275
+ hostCapabilities: ['execution-events']
276
+ },
277
+ suggestions: [{ capability: 'doc-lint', providerId: 'fixture-lint-a', availability: 'available', reason: R_OK }],
278
+ unavailable: []
279
+ },
280
+ {
281
+ id: 'B',
282
+ input: {
283
+ activeStep: { id: 'verify-docs', stepType: 'verification' },
284
+ neededCapabilities: ['doc-lint'],
285
+ availableProviderMetadata: [
286
+ { providerId: 'fixture-lint-b', capabilities: ['doc-lint'], stepTypes: ['verification'], requiresHostCapabilities: ['execution-events'], locator: { kind: 'tool', id: 'fixture-lint-b' } }
287
+ ],
288
+ hostCapabilities: ['execution-events']
289
+ },
290
+ suggestions: [{ capability: 'doc-lint', providerId: 'fixture-lint-b', availability: 'available', reason: R_OK }],
291
+ unavailable: []
292
+ },
293
+ {
294
+ id: 'omitted',
295
+ input: {
296
+ activeStep: { id: 'verify-docs', stepType: 'verification' },
297
+ neededCapabilities: ['doc-lint'],
298
+ availableProviderMetadata: [],
299
+ hostCapabilities: []
300
+ },
301
+ suggestions: [],
302
+ unavailable: [{ capability: 'doc-lint', reason: NO_META }]
303
+ }
304
+ ];
305
+
306
+ for (const leg of LEGS) {
307
+ const { mod, error } = loadLeg(leg);
308
+ for (const item of H1_PROVIDER_CASES) {
309
+ const id = `H1.${leg.name}.${item.id}.provider-suggestion`;
310
+ if (error) { record('FAIL', id, leg.name, error); continue; }
311
+ try {
312
+ const out = mod.suggestDocProviders(cloneJson(item.input));
313
+ if (JSON.stringify(out.suggestions) !== JSON.stringify(item.suggestions) || JSON.stringify(out.unavailable) !== JSON.stringify(item.unavailable)) {
314
+ throw new Error(`suggestions=${stable(out.suggestions)}, unavailable=${stable(out.unavailable)}`);
315
+ }
316
+ record('PASS', id, leg.name);
317
+ } catch (error) {
318
+ record('FAIL', id, leg.name, error.message.split('\n')[0]);
319
+ }
320
+ }
321
+ }
322
+
264
323
  // ---- Output shape: no channel that could remove or waive a capability -----------------------------------------------
265
324
  assertPerLeg('output:exact-key-shapes-and-no-removal-channel', suggest => {
266
325
  const outputs = [
@@ -830,6 +830,146 @@ if (process.argv.includes('--mutation-probes')) {
830
830
  }
831
831
  }
832
832
 
833
+ // =====================================================================================================================
834
+ // Appended block (packet T2-C #553) — surviving CLI --derived-view controls moved from
835
+ // ci/mechanism-e1-derived-regenerate.test.js (wholeSeamFixture plain/derived comparison, matching
836
+ // digests/coverage + plain-check firebreak, stale no-overwrite, unsupported no-arbitrary-execution)
837
+ // on both source and packaged legs.
838
+ // =====================================================================================================================
839
+
840
+ const T2C_SOURCE = 'docs/adr/EVID-001-verify-all-evidence.md';
841
+ const T2C_VIEW = 'docs/governed-index.md';
842
+ const T2C_GENERATOR = 'node harness-everything/scripts/doc-lifecycle.js index --workspace . --config ' + CONFIG + ' --all';
843
+
844
+ function t2cSha(bytes) {
845
+ return crypto.createHash('sha256').update(bytes).digest('hex');
846
+ }
847
+
848
+ function t2cGit(ws, args) {
849
+ const env = { ...process.env, GIT_CONFIG_NOSYSTEM: '1' };
850
+ for (const key of Object.keys(env)) if (key.startsWith('GIT_')) delete env[key];
851
+ const r = spawnSync('git', ['-C', ws, ...args], { env, encoding: 'utf8' });
852
+ if (r.status !== 0) throw new Error(`git ${args.join(' ')} failed: ${truncate(r.stderr)}`);
853
+ return r.stdout.trim();
854
+ }
855
+
856
+ function t2cGenerateIndex(ws) {
857
+ const r = spawnSync(process.execPath, [
858
+ path.join(ws, 'harness-everything', 'scripts', 'doc-lifecycle.js'),
859
+ 'index', '--workspace', ws, '--config', CONFIG, '--all'
860
+ ], { cwd: ws, encoding: 'utf8' });
861
+ if (r.status !== 0) throw new Error(`lifecycle index generation failed: ${truncate(r.stderr)}`);
862
+ writeDoc(ws, T2C_VIEW, r.stdout);
863
+ }
864
+
865
+ function t2cDerivedFixture(leg, generator = T2C_GENERATOR) {
866
+ const ws = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'f3-t2c-derived-')));
867
+ tmpDirs.push(ws);
868
+ const config = {
869
+ governed: [{ path: 'docs/adr/*.md', role: 'adr' }],
870
+ domains: ['EVID'],
871
+ derived: [{ path: T2C_VIEW, generator }]
872
+ };
873
+ writeDoc(ws, CONFIG, JSON.stringify(config, null, 2) + '\n');
874
+ writeDoc(ws, T2C_SOURCE, '---\nid: EVID-001\nrole: adr\nstatus: proposed\n---\n\n# EVID-001\n\n## Decision\n\nRetain evidence identities for generated views.\n');
875
+ fs.mkdirSync(path.join(ws, 'harness-everything', 'scripts'), { recursive: true });
876
+ fs.copyFileSync(path.join(leg.dir, 'doc-lifecycle.js'), path.join(ws, 'harness-everything', 'scripts', 'doc-lifecycle.js'));
877
+ fs.copyFileSync(path.join(leg.dir, 'project-docs-resolver.js'), path.join(ws, 'harness-everything', 'scripts', 'project-docs-resolver.js'));
878
+ t2cGenerateIndex(ws);
879
+ return ws;
880
+ }
881
+
882
+ function t2cWholeSeamFixture(leg) {
883
+ const ws = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'f3-t2c-whole-seam-')));
884
+ tmpDirs.push(ws);
885
+ const config = {
886
+ governed: [{ path: 'docs/adr/*.md', role: 'adr' }],
887
+ domains: ['EVID'],
888
+ derived: [{ path: T2C_VIEW, generator: T2C_GENERATOR }]
889
+ };
890
+ const source = (status, text) => `---\nid: EVID-001\nrole: adr\nstatus: ${status}\n---\n\n# EVID-001\n\n## Decision\n\n${text}\n`;
891
+ writeDoc(ws, CONFIG, JSON.stringify(config, null, 2) + '\n');
892
+ writeDoc(ws, T2C_SOURCE, source('proposed', 'Baseline evidence identity.'));
893
+ fs.mkdirSync(path.join(ws, 'harness-everything', 'scripts'), { recursive: true });
894
+ fs.copyFileSync(path.join(leg.dir, 'doc-lifecycle.js'), path.join(ws, 'harness-everything', 'scripts', 'doc-lifecycle.js'));
895
+ fs.copyFileSync(path.join(leg.dir, 'project-docs-resolver.js'), path.join(ws, 'harness-everything', 'scripts', 'project-docs-resolver.js'));
896
+ t2cGenerateIndex(ws);
897
+ t2cGit(ws, ['init', '-q']);
898
+ t2cGit(ws, ['add', '-A']);
899
+ t2cGit(ws, ['-c', 'user.name=e1-fixture', '-c', 'user.email=e1-fixture@invalid', '-c', 'commit.gpgsign=false', 'commit', '-q', '--no-verify', '-m', 'baseline']);
900
+ writeDoc(ws, T2C_SOURCE, source('accepted', 'Candidate evidence identity.'));
901
+ t2cGenerateIndex(ws);
902
+ return ws;
903
+ }
904
+
905
+ function t2cRunCheck(leg, ws, withView = true) {
906
+ const args = ['--changed-path', T2C_SOURCE];
907
+ if (withView) args.push('--derived-view', T2C_VIEW);
908
+ return spawnIt(leg.dir, 'check', ['--workspace', ws, '--config', CONFIG, ...args], { cwd: ws });
909
+ }
910
+
911
+ assertPerLeg('case-t2c-1:whole-seam-plain-and-derived-cli', leg => {
912
+ const ws = t2cWholeSeamFixture(leg);
913
+ const plain = t2cRunCheck(leg, ws, false);
914
+ same(plain.status, 0, 'plain-check positive control exit');
915
+ const plainReport = jsonOut(plain);
916
+ same(plainReport.capabilities['derived-regenerate'], undefined, 'plain-check omits derived-regenerate');
917
+
918
+ const checked = t2cRunCheck(leg, ws, true);
919
+ same(checked.status, 0, 'registered --derived-view check exit');
920
+ const report = jsonOut(checked);
921
+ const projection = report.capabilities['derived-regenerate'];
922
+ same(projection.state, 'pass', 'derived-regenerate state');
923
+ same(projection.checkedPaths, [T2C_VIEW], 'derived-regenerate checkedPaths');
924
+ });
925
+
926
+ assertPerLeg('case-t2c-2:derived-view-matching-digests-coverage-and-plain-firebreak', leg => {
927
+ const matching = t2cDerivedFixture(leg);
928
+ const matchingBytes = fs.readFileSync(path.join(matching, T2C_VIEW));
929
+ const matchingRun = t2cRunCheck(leg, matching, true);
930
+ same(matchingRun.status, 0, `matching check exit: ${truncate(matchingRun.stderr)}`);
931
+ const matchingReport = jsonOut(matchingRun);
932
+ const positive = matchingReport.capabilities['derived-regenerate'];
933
+ same(positive.state, 'pass', 'positive state');
934
+ same(positive.checkedPaths, [T2C_VIEW], 'positive checkedPaths');
935
+ same(positive.binding.generation.state, 'pass', 'generation state');
936
+ same(positive.binding.comparison.state, 'equal', 'comparison state');
937
+ same(positive.binding.generation.outputDigest, t2cSha(matchingBytes), 'outputDigest');
938
+ same(positive.binding.comparison.targetDigest, t2cSha(matchingBytes), 'targetDigest');
939
+ same(positive.binding.sourceCorpus.complete, true, 'sourceCorpus complete');
940
+ same(positive.binding.sourceCorpus.paths, [T2C_SOURCE], 'sourceCorpus paths');
941
+ same(positive.binding.config.digest, t2cSha(fs.readFileSync(path.join(matching, CONFIG))), 'config digest');
942
+ same(matchingReport.coverage.unsupported.some(item => item.path === T2C_VIEW), false, 'coverage unsupported excludes verified view');
943
+
944
+ const plain = t2cRunCheck(leg, matching, false);
945
+ same(plain.status, 0, `plain firebreak exit: ${truncate(plain.stderr)}`);
946
+ same(jsonOut(plain).capabilities['derived-regenerate'], undefined, 'plain firebreak omits derived-regenerate');
947
+ });
948
+
949
+ assertPerLeg('case-t2c-3:derived-view-stale-no-overwrite', leg => {
950
+ const stale = t2cDerivedFixture(leg);
951
+ const staleTarget = path.join(stale, T2C_VIEW);
952
+ fs.appendFileSync(staleTarget, '\nmanual stale edit\n');
953
+ const staleBefore = fs.readFileSync(staleTarget);
954
+ const staleRun = t2cRunCheck(leg, stale, true);
955
+ same(staleRun.status, 0, `stale check exit: ${truncate(staleRun.stderr)}`);
956
+ const staleProjection = jsonOut(staleRun).capabilities['derived-regenerate'];
957
+ same(staleProjection.state, 'stale', 'stale projection state');
958
+ same(staleProjection.binding.generation.state, 'pass', 'stale generation state');
959
+ same(staleProjection.binding.comparison.state, 'stale', 'stale comparison state');
960
+ if (!fs.readFileSync(staleTarget).equals(staleBefore)) throw new Error('stale target must not be rewritten');
961
+ });
962
+
963
+ assertPerLeg('case-t2c-4:derived-view-unsupported-no-arbitrary-exec', leg => {
964
+ const unsupportedMarker = 'GENERATOR_MUST_NOT_RUN';
965
+ const unsupportedGenerator = 'node -e ' + JSON.stringify('require("fs").writeFileSync("' + unsupportedMarker + '","ran")');
966
+ const unsupported = t2cDerivedFixture(leg, unsupportedGenerator);
967
+ const unsupportedRun = t2cRunCheck(leg, unsupported, true);
968
+ const unsupportedProjection = jsonOut(unsupportedRun).capabilities['derived-regenerate'];
969
+ same(unsupportedProjection.state, 'unsupported', 'unsupported projection state');
970
+ same(fs.existsSync(path.join(unsupported, unsupportedMarker)), false, 'configured text must never be executed');
971
+ });
972
+
833
973
  // ---- Final summary (authoritative totals incl. the appended block) ---------------------------------------------------
834
974
 
835
975
  console.log(`\nF3 derived-views summary: ${passed} PASS, ${failed} FAIL, ${skipped} SKIP${failed ? `\nFAILED assertions (${failures.length}):\n ${failures.join('\n ')}` : ''}${failed === 0 && skipped > 0 ? ' (skips are environment-gated cases only)' : ''}`);
@@ -0,0 +1,180 @@
1
+ #!/usr/bin/env node
2
+ const assert = require('node:assert/strict');
3
+ const { spawnSync } = require('node:child_process');
4
+ const path = require('node:path');
5
+
6
+ const ROOT = path.resolve(__dirname, '..');
7
+ const ROUTER = path.join(ROOT, 'harness-everything', 'scripts', 'kernel-router.js');
8
+
9
+ function route(prompt) {
10
+ const result = spawnSync(process.execPath, [ROUTER], {
11
+ cwd: ROOT,
12
+ encoding: 'utf8',
13
+ input: JSON.stringify({ hook_event_name: 'UserPromptSubmit', prompt }),
14
+ env: { ...process.env, HARNESS_SYSTEM_ONE_MODE: 'off' },
15
+ });
16
+ assert.equal(result.status, 0, `${prompt}: router exits successfully\n${result.stderr}`);
17
+ const match = result.stdout.match(/ROUTER WORKFLOW PLAN \(JSON\): (\{[^\r\n]+\})/);
18
+ assert.ok(match, `${prompt}: real kernel entry emits workflow plan`);
19
+ return { ...JSON.parse(match[1]), routerOutput: result.stdout };
20
+ }
21
+
22
+ const mention = route('我記得有 fable-decision skill');
23
+ assert.notEqual(mention.strategy, 'fable-staged', 'a Fable skill mention does not select Fable');
24
+
25
+ for (const prompt of [
26
+ '不要用 fable,改 README 錯字',
27
+ '不要改用 fable 修 README 錯字',
28
+ 'Do not use fable, fix a typo in README.md',
29
+ 'Could you not use fable to fix a typo in README.md',
30
+ ]) {
31
+ const plan = route(prompt);
32
+ assert.notEqual(plan.strategy, 'fable-staged', `${prompt}: prohibition does not select Fable`);
33
+ assert.notEqual(plan.fallback.disposition, 'blocked', `${prompt}: prohibition alone does not conflict`);
34
+ }
35
+
36
+ const englishTypo = route('Fix a typo in README.md');
37
+ assert.equal(englishTypo.tier, 'tier1');
38
+ assert.equal(englishTypo.strategy, 'direct-single');
39
+
40
+ const zhExplicit = route('用 fable 跨專案實作這個功能');
41
+ assert.equal(zhExplicit.strategy, 'fable-staged', 'explicit Chinese request selects Fable');
42
+
43
+ for (const prompt of [
44
+ '改用 fable 修 README 錯字',
45
+ '幫我改用 fable 修 README 錯字',
46
+ '請改用 fable 修 README 錯字',
47
+ '麻煩改用 fable 修 README 錯字',
48
+ 'Could you use fable to fix a typo in README.md',
49
+ 'Would you please use fable to fix a typo in README.md',
50
+ ]) {
51
+ const plan = route(prompt);
52
+ assert.equal(plan.strategy, 'fable-staged', `${prompt}: explicit request selects Fable`);
53
+ assert.ok(plan.reasonCodes.includes('explicit-strategy-request'), `${prompt}: explicit request is recorded`);
54
+ }
55
+
56
+ for (const prompt of [
57
+ '改用 fable-staged 修 README 錯字',
58
+ '改用 fable on sonnet 修 README 錯字',
59
+ ]) {
60
+ const plan = route(prompt);
61
+ assert.equal(plan.strategy, 'fable-staged', `${prompt}: named strategy/profile remains selectable`);
62
+ assert.ok(plan.reasonCodes.includes('explicit-strategy-request'), `${prompt}: named request is recorded`);
63
+ if (prompt.includes('sonnet')) assert.ok(plan.routerOutput.includes('REQUESTED FABLE PROFILE: sonnet'));
64
+ }
65
+
66
+ const prohibitedMacro = route('Do not use fable; redesign the architecture across the repository');
67
+ assert.equal(prohibitedMacro.tier, 'tier3', 'real macro workload keeps its structural tier');
68
+ assert.equal(prohibitedMacro.strategy, 'iterative-single', 'prohibition downgrades to a single-agent topology');
69
+ assert.notEqual(prohibitedMacro.fallback.disposition, 'blocked', 'prohibition alone is not a conflict');
70
+
71
+ const prohibitedProfile = route('Do not use fable on opus to audit the entire repository architecture');
72
+ assert.equal(prohibitedProfile.strategy, 'iterative-single',
73
+ 'a negated profile invocation is not an explicit strategy request');
74
+ assert.ok(!prohibitedProfile.routerOutput.includes('REQUESTED FABLE PROFILE'),
75
+ 'a negated profile invocation is not treated as a requested model');
76
+ assert.ok(!prohibitedProfile.reasonCodes.includes('explicit-request-conflicts-with-prohibition'));
77
+
78
+ const contradiction = route('Use fable to redesign the architecture. Do not use fable for this task.');
79
+ assert.equal(contradiction.fallback.disposition, 'blocked', 'contradictory clauses remain blocked');
80
+ assert.ok(contradiction.reasonCodes.includes('explicit-request-conflicts-with-prohibition'));
81
+
82
+ for (const [prompt, strategy] of [
83
+ ['fable-staged audit the whole repository architecture', 'fable-staged'],
84
+ ['fable-parallel for independent read-only repository audits', 'fable-parallel'],
85
+ ]) {
86
+ assert.equal(route(prompt).strategy, strategy, `${prompt}: named topology remains selectable`);
87
+ }
88
+ assert.notEqual(route('Do not use fable-staged for this task').strategy, 'fable-staged',
89
+ 'negated named strategy is not an explicit request');
90
+
91
+ assert.equal(route('What is fable on sonnet? Return only JSON.').strategy, 'direct-single',
92
+ 'profile lookup remains a lookup');
93
+ assert.equal(route('改 README 錯字').tier, 'unclassified', 'Chinese typo stays bounded without new Tier 1 recognition');
94
+
95
+ for (const prompt of [
96
+ 'Never use fable, fix a typo in README.md',
97
+ 'Never use fable-mode, fix a typo in README.md',
98
+ 'Cannot use fable, fix a typo in README.md',
99
+ "Can't use fable, fix a typo in README.md",
100
+ 'Not use fable, fix a typo in README.md',
101
+ '別用 fable,改 README 錯字',
102
+ '別用 fable-mode,改 README 錯字',
103
+ '請勿使用 fable,改 README 錯字',
104
+ '勿用 fable,改 README 錯字',
105
+ '避免用 fable,改 README 錯字',
106
+ '停止使用 fable,改 README 錯字',
107
+ ]) {
108
+ const plan = route(prompt);
109
+ assert.notEqual(plan.strategy, 'fable-staged', `${prompt}: prohibition is not a request`);
110
+ assert.ok(!plan.reasonCodes.includes('explicit-strategy-request'), `${prompt}: no explicit request`);
111
+ assert.notEqual(plan.fallback.disposition, 'blocked', `${prompt}: prohibition is not a conflict`);
112
+ }
113
+
114
+ for (const prefix of ['Please', "Let's", 'Now', 'Could you', 'Could you please', 'Would you', 'Would you please', '請', '幫我', '麻煩']) {
115
+ for (const verb of ['use fable', 'run fable', 'enter fable', '使用 fable', '用 fable', '啟用 fable', '進入 fable', '執行 fable', '改用 fable']) {
116
+ assert.equal(route(`${prefix} ${verb} to redesign the repository architecture`).strategy, 'fable-staged',
117
+ `${prefix} + ${verb}: clause-leading request selects Fable`);
118
+ }
119
+ }
120
+
121
+ const englishNegationPrefixes = ['Do not', "Don't", 'Never', 'Cannot', "Can't", 'Not', 'No', 'Without'];
122
+ const englishNegationTargets = ['fable', 'fable-mode', 'use fable', 'use fable-mode', 'fable to fix a typo'];
123
+ const chineseNegationPrefixes = ['不要', '不需要', '無需', '無須', '不必', '毋須', '不用', '不會', '別', '勿', '請勿', '避免', '停止'];
124
+ const chineseNegationTargets = ['fable', '使用 fable', '用 fable', '啟用 fable', '進入 fable', '執行 fable'];
125
+ const negationMatrix = [
126
+ ...englishNegationPrefixes.flatMap(prefix => englishNegationTargets.map(target => `${prefix} ${target} to fix a typo in README.md`)),
127
+ ...chineseNegationPrefixes.flatMap(prefix => chineseNegationTargets.map(target => `${prefix}${target} 修 README 錯字`)),
128
+ ];
129
+ assert.equal(negationMatrix.length, 118, 'the class-level negation matrix covers 118 inputs');
130
+ for (const prompt of negationMatrix) {
131
+ const plan = route(prompt);
132
+ assert.notEqual(plan.strategy, 'fable-staged', `${prompt}: negation does not select Fable`);
133
+ assert.ok(!plan.reasonCodes.includes('explicit-strategy-request'), `${prompt}: negation is not an explicit request`);
134
+ assert.notEqual(plan.fallback.disposition, 'blocked', `${prompt}: negation alone is not a conflict`);
135
+ }
136
+
137
+ for (const prefix of ['please', "let's", 'now', '請', '幫我', '改用', '麻煩']) {
138
+ const plan = route(`${prefix} maybe use fable to fix a typo in README.md`);
139
+ assert.ok(!plan.reasonCodes.includes('explicit-strategy-request'), `${prefix}: unknown modifier is not explicit`);
140
+ assert.notEqual(plan.fallback.disposition, 'blocked', `${prefix}: unknown modifier is not a conflict`);
141
+ }
142
+
143
+ for (const prompt of [
144
+ 'Never use fable; redesign the architecture across the repository',
145
+ '請勿使用 fable;重構整個 repository architecture',
146
+ ]) {
147
+ const plan = route(prompt);
148
+ assert.equal(plan.tier, 'tier3', `${prompt}: structural tier remains`);
149
+ assert.equal(plan.strategy, 'iterative-single', `${prompt}: prohibition downgrades topology`);
150
+ assert.ok(plan.reasonCodes.includes('user-prohibited-fable'), `${prompt}: prohibition reason is visible`);
151
+ }
152
+
153
+ for (const prompt of [
154
+ 'Redesign the architecture across the entire repository',
155
+ '重構整個 repository architecture',
156
+ ]) {
157
+ const plan = route(prompt);
158
+ assert.equal(plan.tier, 'tier3', `${prompt}: structural tier remains without prohibition`);
159
+ assert.equal(plan.strategy, 'fable-staged', `${prompt}: positive control retains the Tier 3 default`);
160
+ }
161
+
162
+ for (const prompt of [
163
+ 'Do not use fable; use fable-parallel for this task',
164
+ 'Use fable-parallel; do not use fable for this task',
165
+ 'Cannot use fable on opus; fable on sonnet for this task',
166
+ 'Fable on sonnet; do not use fable for this task',
167
+ ]) {
168
+ const plan = route(prompt);
169
+ assert.equal(plan.fallback.disposition, 'blocked', `${prompt}: real contradiction remains blocked`);
170
+ }
171
+
172
+ assert.notEqual(route('I remember fable-staged; fix a typo in README.md').strategy, 'fable-staged');
173
+ const laterProfile = route('I remember fable on opus; use fable on sonnet for this task');
174
+ assert.equal(laterProfile.strategy, 'fable-staged');
175
+ assert.ok(laterProfile.routerOutput.includes('REQUESTED FABLE PROFILE: sonnet'));
176
+ const quotedSeparator = route('Use “fable; use fable on opus” as an example');
177
+ assert.notEqual(quotedSeparator.strategy, 'fable-staged');
178
+ assert.ok(!quotedSeparator.reasonCodes.includes('explicit-strategy-request'));
179
+
180
+ console.log('PASS: #332 Fable directive real-entry controls');