@holmes-lab/holmes-kit 0.39.0 → 0.40.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 (325) hide show
  1. package/CHANGELOG.md +578 -6
  2. package/README.md +120 -41
  3. package/dist/.build-id +1 -1
  4. package/dist/holmes/admission/core/admission-policy.d.ts +37 -0
  5. package/dist/holmes/admission/core/admission-policy.js +147 -0
  6. package/dist/holmes/admission/core/bounded-reader.d.ts +56 -0
  7. package/dist/holmes/admission/core/bounded-reader.js +135 -0
  8. package/dist/holmes/admission/core/change-classifier.d.ts +34 -0
  9. package/dist/holmes/admission/core/change-classifier.js +278 -0
  10. package/dist/holmes/admission/core/config-loader.d.ts +30 -0
  11. package/dist/holmes/admission/core/config-loader.js +145 -0
  12. package/dist/holmes/admission/core/event-judgement.d.ts +37 -0
  13. package/dist/holmes/admission/core/event-judgement.js +251 -0
  14. package/dist/holmes/admission/core/path-rules.d.ts +35 -0
  15. package/dist/holmes/admission/core/path-rules.js +88 -0
  16. package/dist/holmes/admission/core/pin.d.ts +7 -0
  17. package/dist/holmes/admission/core/pin.js +29 -0
  18. package/dist/holmes/admission/core/ports.d.ts +48 -0
  19. package/dist/holmes/admission/core/ports.js +11 -0
  20. package/dist/holmes/admission/core/range-resolver.d.ts +32 -0
  21. package/dist/holmes/admission/core/range-resolver.js +51 -0
  22. package/dist/holmes/admission/core/self-containment.d.ts +1 -0
  23. package/dist/holmes/admission/core/self-containment.js +125 -0
  24. package/dist/holmes/admission/core/signature-source.d.ts +9 -0
  25. package/dist/holmes/admission/core/signature-source.js +4 -0
  26. package/dist/holmes/admission/core/transition-planner.d.ts +15 -0
  27. package/dist/holmes/admission/core/transition-planner.js +14 -0
  28. package/dist/holmes/admission/core/verdict.d.ts +38 -0
  29. package/dist/holmes/admission/core/verdict.js +17 -0
  30. package/dist/holmes/admission/core/wiring.d.ts +44 -0
  31. package/dist/holmes/admission/core/wiring.js +618 -0
  32. package/dist/holmes/admission/forge/git-object-port.d.ts +4 -0
  33. package/dist/holmes/admission/forge/git-object-port.js +132 -0
  34. package/dist/holmes/assoc/assoc-arm.d.ts +1 -1
  35. package/dist/holmes/assoc/assoc-arm.js +1 -1
  36. package/dist/holmes/cli/agents.d.ts +8 -0
  37. package/dist/holmes/cli/agents.js +9 -5
  38. package/dist/holmes/cli/approve-cli.d.ts +2 -0
  39. package/dist/holmes/cli/approve-cli.js +392 -0
  40. package/dist/holmes/cli/approve-ref.d.ts +13 -7
  41. package/dist/holmes/cli/approve-ref.js +30 -10
  42. package/dist/holmes/cli/approve-status.d.ts +26 -2
  43. package/dist/holmes/cli/approve-status.js +98 -18
  44. package/dist/holmes/cli/approve-watch.d.ts +5 -0
  45. package/dist/holmes/cli/approve-watch.js +10 -5
  46. package/dist/holmes/cli/approve.d.ts +49 -13
  47. package/dist/holmes/cli/approve.js +249 -67
  48. package/dist/holmes/cli/attest.js +2 -1
  49. package/dist/holmes/cli/autonomy.d.ts +4 -1
  50. package/dist/holmes/cli/autonomy.js +17 -10
  51. package/dist/holmes/cli/codex-oracle.d.ts +11 -0
  52. package/dist/holmes/cli/codex-oracle.js +5 -1
  53. package/dist/holmes/cli/codex-toml.d.ts +10 -0
  54. package/dist/holmes/cli/codex-toml.js +36 -2
  55. package/dist/holmes/cli/doctor-boundary.d.ts +76 -0
  56. package/dist/holmes/cli/doctor-boundary.js +308 -0
  57. package/dist/holmes/cli/doctor-locks.d.ts +15 -0
  58. package/dist/holmes/cli/doctor-locks.js +119 -0
  59. package/dist/holmes/cli/doctor.d.ts +2 -0
  60. package/dist/holmes/cli/doctor.js +34 -5
  61. package/dist/holmes/cli/flags.d.ts +23 -0
  62. package/dist/holmes/cli/flags.js +89 -0
  63. package/dist/holmes/cli/index.d.ts +5 -1
  64. package/dist/holmes/cli/index.js +226 -442
  65. package/dist/holmes/cli/init.js +33 -0
  66. package/dist/holmes/cli/interactive-prompt.d.ts +39 -2
  67. package/dist/holmes/cli/interactive-prompt.js +98 -16
  68. package/dist/holmes/cli/lock-recover.d.ts +5 -0
  69. package/dist/holmes/cli/lock-recover.js +126 -0
  70. package/dist/holmes/cli/mcp-processes.js +1 -1
  71. package/dist/holmes/cli/release-docs.js +1 -1
  72. package/dist/holmes/cli/run-exec.d.ts +141 -0
  73. package/dist/holmes/cli/run-exec.js +1435 -0
  74. package/dist/holmes/cli/run-provision.d.ts +3 -1
  75. package/dist/holmes/cli/run-provision.js +255 -44
  76. package/dist/holmes/cli/run-wiring.d.ts +69 -0
  77. package/dist/holmes/cli/run-wiring.js +270 -0
  78. package/dist/holmes/cli/run.d.ts +21 -0
  79. package/dist/holmes/cli/run.js +341 -92
  80. package/dist/holmes/cli/runtime-binding-approval.js +32 -19
  81. package/dist/holmes/cli/screen-safe.d.ts +3 -92
  82. package/dist/holmes/cli/screen-safe.js +18 -756
  83. package/dist/holmes/config/config.d.ts +19 -0
  84. package/dist/holmes/config/config.js +18 -3
  85. package/dist/holmes/cpg/foundation/language-matrix.js +2 -2
  86. package/dist/holmes/cpg/import-resolver.js +1 -1
  87. package/dist/holmes/governance/approval-decisions.d.ts +47 -0
  88. package/dist/holmes/governance/approval-decisions.js +29 -0
  89. package/dist/holmes/governance/approval-grants.d.ts +220 -1
  90. package/dist/holmes/governance/approval-grants.js +612 -33
  91. package/dist/holmes/governance/approval-queue.d.ts +26 -0
  92. package/dist/holmes/governance/approval-queue.js +109 -11
  93. package/dist/holmes/governance/approval-spend.d.ts +95 -0
  94. package/dist/holmes/governance/approval-spend.js +191 -0
  95. package/dist/holmes/governance/autonomous-shell.d.ts +61 -0
  96. package/dist/holmes/governance/autonomous-shell.js +332 -0
  97. package/dist/holmes/governance/autonomy.d.ts +12 -0
  98. package/dist/holmes/governance/autonomy.js +51 -15
  99. package/dist/holmes/governance/constitution.d.ts +5 -0
  100. package/dist/holmes/governance/constitution.js +32 -12
  101. package/dist/holmes/governance/full-autonomy.d.ts +10 -0
  102. package/dist/holmes/governance/full-autonomy.js +103 -7
  103. package/dist/holmes/governance/harness-catalog.d.ts +103 -0
  104. package/dist/holmes/governance/harness-catalog.js +348 -0
  105. package/dist/holmes/governance/human-channel.d.ts +38 -0
  106. package/dist/holmes/governance/human-channel.js +49 -0
  107. package/dist/holmes/governance/install-manifest.d.ts +22 -0
  108. package/dist/holmes/governance/install-manifest.js +160 -0
  109. package/dist/holmes/governance/ledger-rechain.js +2 -0
  110. package/dist/holmes/governance/ledger-store.conformance.d.ts +7 -1
  111. package/dist/holmes/governance/ledger-store.conformance.js +66 -0
  112. package/dist/holmes/governance/ledger-store.d.ts +88 -11
  113. package/dist/holmes/governance/ledger-store.js +186 -8
  114. package/dist/holmes/governance/provenance-chain.d.ts +16 -4
  115. package/dist/holmes/governance/provenance-chain.js +19 -4
  116. package/dist/holmes/governance/provenance-ledger.d.ts +6 -3
  117. package/dist/holmes/governance/provenance-ledger.js +53 -18
  118. package/dist/holmes/governance/push-gate-runner.d.ts +2 -0
  119. package/dist/holmes/governance/push-gate-runner.js +50 -9
  120. package/dist/holmes/governance/push-gate.d.ts +13 -2
  121. package/dist/holmes/governance/push-gate.js +106 -14
  122. package/dist/holmes/governance/recorded-pairs.d.ts +96 -0
  123. package/dist/holmes/governance/recorded-pairs.js +522 -0
  124. package/dist/holmes/governance/replica-id.d.ts +1 -1
  125. package/dist/holmes/governance/replica-id.js +1 -1
  126. package/dist/holmes/governance/spec-seam.d.ts +59 -0
  127. package/dist/holmes/governance/spec-seam.js +587 -0
  128. package/dist/holmes/governance/spend-kinds.d.ts +16 -0
  129. package/dist/holmes/governance/spend-kinds.js +18 -0
  130. package/dist/holmes/guardrail/advisory-line.d.ts +102 -0
  131. package/dist/holmes/guardrail/advisory-line.js +718 -0
  132. package/dist/holmes/guardrail/decision-ledger.d.ts +2 -1
  133. package/dist/holmes/guardrail/decision-ledger.js +2 -1
  134. package/dist/holmes/guardrail/impact-gate.d.ts +7 -0
  135. package/dist/holmes/guardrail/impact-gate.js +33 -6
  136. package/dist/holmes/guardrail/line-continuation.d.ts +8 -0
  137. package/dist/holmes/guardrail/line-continuation.js +39 -0
  138. package/dist/holmes/guardrail/operator-person.d.ts +28 -4
  139. package/dist/holmes/guardrail/operator-person.js +57 -11
  140. package/dist/holmes/guardrail/refusal-codes.d.ts +8 -3
  141. package/dist/holmes/guardrail/refusal-codes.js +64 -10
  142. package/dist/holmes/guardrail/risk-classifier.d.ts +15 -9
  143. package/dist/holmes/guardrail/risk-classifier.js +228 -16
  144. package/dist/holmes/guardrail/risk-gate.d.ts +2 -8
  145. package/dist/holmes/guardrail/risk-gate.js +7 -34
  146. package/dist/holmes/guardrail/risk-types.d.ts +10 -0
  147. package/dist/holmes/guardrail/run-plan-scope.js +3 -1
  148. package/dist/holmes/guardrail/run-refusals.js +24 -8
  149. package/dist/holmes/guardrail/run-stages.d.ts +5 -0
  150. package/dist/holmes/guardrail/run-stages.js +25 -5
  151. package/dist/holmes/guardrail/scope-judgment.js +1 -1
  152. package/dist/holmes/guardrail/shell-words.js +24 -3
  153. package/dist/holmes/guardrail/unresolved-write.d.ts +40 -0
  154. package/dist/holmes/guardrail/unresolved-write.js +556 -0
  155. package/dist/holmes/guardrail/write-target.d.ts +3 -0
  156. package/dist/holmes/guardrail/write-target.js +26 -5
  157. package/dist/holmes/hooks/pre-tool-use.d.ts +116 -1
  158. package/dist/holmes/hooks/pre-tool-use.js +1176 -170
  159. package/dist/holmes/hooks/rtm-refresh-child.d.ts +1 -1
  160. package/dist/holmes/hooks/rtm-refresh-child.js +1 -1
  161. package/dist/holmes/hooks/session-start.js +17 -1
  162. package/dist/holmes/hooks/stop.d.ts +23 -0
  163. package/dist/holmes/hooks/stop.js +86 -33
  164. package/dist/holmes/mcp/approval-adapters.js +3 -1
  165. package/dist/holmes/mcp/approval-commit.js +3 -2
  166. package/dist/holmes/mcp/approval-policy.d.ts +2 -1
  167. package/dist/holmes/mcp/approval-policy.js +3 -1
  168. package/dist/holmes/mcp/handlers/adoption.d.ts +1 -1
  169. package/dist/holmes/mcp/handlers/approval-ask.d.ts +3 -0
  170. package/dist/holmes/mcp/handlers/approval-ask.js +18 -7
  171. package/dist/holmes/mcp/handlers/entity-integration.d.ts +3 -3
  172. package/dist/holmes/mcp/handlers/entity-integration.js +29 -11
  173. package/dist/holmes/mcp/handlers/entity-renumber.d.ts +4 -4
  174. package/dist/holmes/mcp/handlers/entity-renumber.js +29 -11
  175. package/dist/holmes/mcp/handlers/entity-store.d.ts +2 -2
  176. package/dist/holmes/mcp/handlers/entity-store.js +133 -59
  177. package/dist/holmes/mcp/handlers/maintenance-analysis.d.ts +13 -0
  178. package/dist/holmes/mcp/handlers/maintenance-analysis.js +59 -2
  179. package/dist/holmes/mcp/handlers/operator-inspection.d.ts +9 -5
  180. package/dist/holmes/mcp/handlers/operator-inspection.js +79 -16
  181. package/dist/holmes/mcp/handlers/phase-queries.d.ts +1 -1
  182. package/dist/holmes/mcp/handlers/requirement-triage.d.ts +4 -4
  183. package/dist/holmes/mcp/handlers/review-evidence.d.ts +2 -2
  184. package/dist/holmes/mcp/handlers/review-evidence.js +35 -11
  185. package/dist/holmes/mcp/handlers/review-queries.d.ts +5 -0
  186. package/dist/holmes/mcp/handlers/review-queries.js +8 -1
  187. package/dist/holmes/mcp/handlers/review-verdict.d.ts +3 -0
  188. package/dist/holmes/mcp/handlers/review-verdict.js +10 -3
  189. package/dist/holmes/mcp/handlers/risk-assessment.d.ts +7 -2
  190. package/dist/holmes/mcp/handlers/risk-assessment.js +34 -12
  191. package/dist/holmes/mcp/handlers/runtime-binding-tool.d.ts +2 -2
  192. package/dist/holmes/mcp/handlers/slice-orchestration.d.ts +6 -1
  193. package/dist/holmes/mcp/handlers/slice-orchestration.js +14 -1
  194. package/dist/holmes/mcp/handlers/spec-approval.d.ts +15 -3
  195. package/dist/holmes/mcp/handlers/spec-approval.js +32 -5
  196. package/dist/holmes/mcp/handlers/spec-authoring.d.ts +2 -2
  197. package/dist/holmes/mcp/handlers/spec-authoring.js +19 -2
  198. package/dist/holmes/mcp/handlers/spec-lifecycle.d.ts +11 -38
  199. package/dist/holmes/mcp/handlers/spec-lifecycle.js +441 -94
  200. package/dist/holmes/mcp/handlers/spec-queries.d.ts +2 -2
  201. package/dist/holmes/mcp/handlers/taint-screening.d.ts +1 -1
  202. package/dist/holmes/mcp/handlers/taint-screening.js +2 -2
  203. package/dist/holmes/mcp/handlers/test-execution.d.ts +471 -4
  204. package/dist/holmes/mcp/handlers/test-execution.js +199 -21
  205. package/dist/holmes/mcp/handlers/workspace-queries.d.ts +2 -2
  206. package/dist/holmes/mcp/handlers.d.ts +557 -82
  207. package/dist/holmes/mcp/handlers.js +74 -23
  208. package/dist/holmes/mcp/harness-attestation.d.ts +78 -5
  209. package/dist/holmes/mcp/harness-attestation.js +325 -53
  210. package/dist/holmes/mcp/maintenance-analyze.d.ts +6 -1
  211. package/dist/holmes/mcp/maintenance-analyze.js +13 -11
  212. package/dist/holmes/mcp/maintenance-evidence.d.ts +9 -0
  213. package/dist/holmes/mcp/maintenance-evidence.js +35 -3
  214. package/dist/holmes/mcp/requirement-triage-evidence.js +22 -13
  215. package/dist/holmes/mcp/server-staleness.js +1 -1
  216. package/dist/holmes/mcp/server.js +9 -8
  217. package/dist/holmes/mcp/spec-id-guard.js +1 -1
  218. package/dist/holmes/mcp/tool-schemas.d.ts +13 -0
  219. package/dist/holmes/mcp/tool-schemas.js +42 -9
  220. package/dist/holmes/project/act-root.d.ts +19 -0
  221. package/dist/holmes/project/act-root.js +100 -0
  222. package/dist/holmes/project/baseline.d.ts +15 -2
  223. package/dist/holmes/project/baseline.js +14 -8
  224. package/dist/holmes/project/bounded-group.d.ts +47 -0
  225. package/dist/holmes/project/bounded-group.js +140 -0
  226. package/dist/holmes/project/bounded-io.d.ts +51 -2
  227. package/dist/holmes/project/bounded-io.js +140 -6
  228. package/dist/holmes/project/change-source.d.ts +4 -0
  229. package/dist/holmes/project/change-source.js +14 -6
  230. package/dist/holmes/project/instance-id.d.ts +10 -0
  231. package/dist/holmes/project/instance-id.js +233 -0
  232. package/dist/holmes/project/machine-identity.d.ts +25 -0
  233. package/dist/holmes/project/machine-identity.js +133 -0
  234. package/dist/holmes/project/owned-lock.d.ts +84 -0
  235. package/dist/holmes/project/owned-lock.js +263 -0
  236. package/dist/holmes/project/plain-lock-fs.d.ts +2 -0
  237. package/dist/holmes/project/plain-lock-fs.js +126 -0
  238. package/dist/holmes/project/request-lock.d.ts +85 -0
  239. package/dist/holmes/project/request-lock.js +459 -0
  240. package/dist/holmes/project/root.d.ts +12 -4
  241. package/dist/holmes/project/root.js +29 -8
  242. package/dist/holmes/project/run-records.d.ts +19 -0
  243. package/dist/holmes/project/run-records.js +94 -12
  244. package/dist/holmes/project/screen-text.d.ts +94 -0
  245. package/dist/holmes/project/screen-text.js +763 -0
  246. package/dist/holmes/project/spend-lock.d.ts +82 -0
  247. package/dist/holmes/project/spend-lock.js +413 -0
  248. package/dist/holmes/refresh/freshness-coordinator.d.ts +1 -1
  249. package/dist/holmes/refresh/freshness-coordinator.js +1 -1
  250. package/dist/holmes/review/condition-hunk-replay.js +4 -2
  251. package/dist/holmes/review/confidence-calibration.d.ts +1 -1
  252. package/dist/holmes/review/confidence-calibration.js +1 -1
  253. package/dist/holmes/review/content-verify.js +1 -1
  254. package/dist/holmes/review/evidence-mode.d.ts +21 -0
  255. package/dist/holmes/review/evidence-mode.js +33 -0
  256. package/dist/holmes/review/head-worktree.d.ts +55 -0
  257. package/dist/holmes/review/head-worktree.js +329 -0
  258. package/dist/holmes/review/hop-ablation.d.ts +4 -4
  259. package/dist/holmes/review/hop-ablation.js +5 -5
  260. package/dist/holmes/review/mrp.js +13 -3
  261. package/dist/holmes/review/point-in-time-replay.js +12 -3
  262. package/dist/holmes/review/rank-diagnosis.d.ts +2 -2
  263. package/dist/holmes/review/rank-diagnosis.js +1 -1
  264. package/dist/holmes/review/replay-corpus.d.ts +10 -4
  265. package/dist/holmes/review/replay-corpus.js +25 -9
  266. package/dist/holmes/review/requirement-triage.js +2 -2
  267. package/dist/holmes/review/run-provenance.d.ts +45 -0
  268. package/dist/holmes/review/run-provenance.js +314 -0
  269. package/dist/holmes/review/semantic-arm.d.ts +3 -3
  270. package/dist/holmes/review/semantic-arm.js +3 -3
  271. package/dist/holmes/review/test-evidence.d.ts +174 -0
  272. package/dist/holmes/review/test-evidence.js +330 -2
  273. package/dist/holmes/review/test-outcomes.js +3 -1
  274. package/dist/holmes/review/test-reports.d.ts +94 -0
  275. package/dist/holmes/review/test-reports.js +382 -0
  276. package/dist/holmes/review/test-runner.d.ts +180 -58
  277. package/dist/holmes/review/test-runner.js +560 -324
  278. package/dist/holmes/review/test-selection-breadth.js +2 -2
  279. package/dist/holmes/review/test-units.d.ts +159 -0
  280. package/dist/holmes/review/test-units.js +814 -0
  281. package/dist/holmes/review/verdicts.d.ts +105 -8
  282. package/dist/holmes/review/verdicts.js +640 -36
  283. package/dist/holmes/rtm/anchor-census.d.ts +9 -0
  284. package/dist/holmes/rtm/anchor-census.js +151 -0
  285. package/dist/holmes/rtm/anchor-ids.d.ts +25 -1
  286. package/dist/holmes/rtm/anchor-ids.js +45 -2
  287. package/dist/holmes/rtm/comment-ranges.d.ts +2 -0
  288. package/dist/holmes/rtm/comment-ranges.js +104 -0
  289. package/dist/holmes/rtm/counted-tests.d.ts +1 -0
  290. package/dist/holmes/rtm/counted-tests.js +63 -0
  291. package/dist/holmes/rtm/impact-advisory.d.ts +1 -1
  292. package/dist/holmes/rtm/known-defects.js +1 -1
  293. package/dist/holmes/rtm/localize.js +1 -1
  294. package/dist/holmes/rtm/taint-benchmark.d.ts +1 -1
  295. package/dist/holmes/rtm/taint-vocabulary.d.ts +1 -1
  296. package/dist/holmes/rtm/test-scope.d.ts +31 -0
  297. package/dist/holmes/rtm/test-scope.js +166 -5
  298. package/dist/holmes/rtm/trace-gaps.js +1 -1
  299. package/dist/holmes/runtime/dispatch.d.ts +10 -0
  300. package/dist/holmes/runtime/dispatch.js +12 -1
  301. package/dist/holmes/semantic/cloud-usage.d.ts +1 -1
  302. package/dist/holmes/semantic/cloud-usage.js +1 -1
  303. package/dist/holmes/semantic/unreadable-paths.d.ts +1 -1
  304. package/dist/holmes/semantic/unreadable-paths.js +1 -1
  305. package/dist/holmes/spec/approval-blockers.js +1 -1
  306. package/dist/holmes/spec/entity-store.d.ts +6 -1
  307. package/dist/holmes/spec/entity-store.js +16 -2
  308. package/dist/holmes/spec/entity-transaction.d.ts +7 -2
  309. package/dist/holmes/spec/entity-transaction.js +87 -170
  310. package/dist/holmes/spec/spec-store.d.ts +12 -6
  311. package/dist/holmes/spec/spec-store.js +4 -2
  312. package/dist/holmes/spec/spec-types.js +1 -1
  313. package/dist/holmes/spec/succession-guard.d.ts +56 -0
  314. package/dist/holmes/spec/succession-guard.js +187 -0
  315. package/dist/holmes/spec/succession.d.ts +70 -0
  316. package/dist/holmes/spec/succession.js +171 -0
  317. package/dist/holmes/spec/transition-policy.d.ts +2 -2
  318. package/docs/install-guide.md +9 -3
  319. package/docs/language-support.md +78 -0
  320. package/package.json +4 -3
  321. package/playbooks/author-slice/PLAYBOOK.md +1 -1
  322. package/playbooks/promote-slice/PLAYBOOK.md +5 -1
  323. package/playbooks/publish/PLAYBOOK.md +47 -34
  324. package/dist/holmes/review/manual-baseline.d.ts +0 -209
  325. package/dist/holmes/review/manual-baseline.js +0 -2847
@@ -43,7 +43,7 @@ exports.openArtifacts = openArtifacts;
43
43
  exports.closeOpenArtifacts = closeOpenArtifacts;
44
44
  exports.scopeCauses = scopeCauses;
45
45
  exports.computeCalibration = computeCalibration;
46
- // @implements A-SPEC-744, A-SPEC-740, A-SPEC-724.1, A-SPEC-271, A-SPEC-278.3
46
+ // @implements A-SPEC-744, A-SPEC-740, A-SPEC-724.1, A-SPEC-271, A-SPEC-278.3, A-SPEC-293.1, A-SPEC-333.9
47
47
  // @implements A-SPEC-268
48
48
  const fs = __importStar(require("node:fs"));
49
49
  const path = __importStar(require("node:path"));
@@ -86,6 +86,8 @@ function intakeRecord(intake) {
86
86
  const out = {};
87
87
  if (typeof intake.request === 'string')
88
88
  out.request = intake.request.slice(0, exports.INTAKE_REQUEST_MAX);
89
+ if (intake.changedFilesSource)
90
+ out.changedFilesSource = intake.changedFilesSource;
89
91
  if (Array.isArray(intake.changedFiles)) {
90
92
  const files = [];
91
93
  for (const raw of intake.changedFiles) {
@@ -136,6 +138,7 @@ function artifactFrom(analysis, recordedAt, fileDigests = {}, intake) {
136
138
  impactedFiles: [...analysis.impacts.impactedFiles],
137
139
  securityAssessed: analysis.constraints.security.assessed,
138
140
  compatibilityAssessed: analysis.constraints.compatibility.assessed,
141
+ architectureTouched: [...(analysis.testScope.architectureTouched ?? [])],
139
142
  },
140
143
  };
141
144
  }
@@ -171,7 +174,9 @@ function writeArtifact(dir, artifact) {
171
174
  // corruption, and refusing to write here would strand the directory in its broken state.
172
175
  }
173
176
  }
174
- writeAtomic(file, `${JSON.stringify(merged, null, 2)}\n`);
177
+ const text = `${JSON.stringify(merged, null, 2)}\n`;
178
+ writeAtomic(file, text);
179
+ recordPersisted(dir, merged.digest, text); // @implements A-SPEC-792.28
175
180
  return file;
176
181
  }
177
182
  function readArtifacts(dir) {
@@ -233,9 +238,36 @@ function recordOutcome(dir, digest, outcome, recordedAt) {
233
238
  ...(classification ? { actualClassification: classification } : {}),
234
239
  },
235
240
  };
236
- writeAtomic(file, `${JSON.stringify(updated, null, 2)}\n`);
241
+ const text = `${JSON.stringify(updated, null, 2)}\n`;
242
+ writeAtomic(file, text);
243
+ recordPersisted(dir, updated.digest, text); // @implements A-SPEC-792.28 — the outcome changes the content: recorded again
237
244
  return updated;
238
245
  }
246
+ /**
247
+ * @implements A-SPEC-792.28 — the tool's own record of each write: the evidence digest and the file's content hash, on
248
+ * the workspace's provenance ledger (`<root>/.ax/ledger`, two levels above `.ax/evidence/maintenance`). Best effort: a
249
+ * ledger that cannot take the line leaves the file unproven for autonomous staging, never the write failed.
250
+ */
251
+ function recordPersisted(dir, digest, text) {
252
+ try {
253
+ // only beside a real `<root>/.ax/evidence/maintenance`, into a ledger that already exists: a writer pointed at any
254
+ // other directory must create nothing above it (measured: a test's evidence dir made a ledger in the temp root's parent)
255
+ const abs = path.resolve(dir);
256
+ const ax = path.dirname(path.dirname(abs));
257
+ const ledgerDir = path.join(ax, 'ledger');
258
+ if (path.basename(abs) !== 'maintenance' || path.basename(path.dirname(abs)) !== 'evidence' || path.basename(ax) !== '.ax')
259
+ return;
260
+ if (!fs.existsSync(ledgerDir) || !fs.lstatSync(ledgerDir).isDirectory())
261
+ return;
262
+ const { FileLedgerStore } = require('../governance/ledger-store');
263
+ const content = require('node:crypto').createHash('sha256').update(text).digest('hex');
264
+ new FileLedgerStore(ledgerDir).append({
265
+ ts: new Date().toISOString(), actor: 'holmes-kit', kind: 'analysis-persisted', summary: `analysis evidence ${digest.slice(0, 19)} written`,
266
+ inputs: [digest, `content:${content}`],
267
+ });
268
+ }
269
+ catch { /* unproven, not failed */ }
270
+ }
239
271
  // @implements A-SPEC-578.4
240
272
  /**
241
273
  * Predictions still waiting to be scored — the loop's missing second half.
@@ -42,7 +42,7 @@ exports.everSealedInLedger = everSealedInLedger;
42
42
  exports.validateTriageArtifact = validateTriageArtifact;
43
43
  exports.intakeHead = intakeHead;
44
44
  exports.validateRequirementIntake = validateRequirementIntake;
45
- // @implements A-SPEC-730, A-SPEC-729, A-SPEC-724, A-SPEC-719, A-SPEC-734, A-SPEC-719.6
45
+ // @implements A-SPEC-730, A-SPEC-729, A-SPEC-724, A-SPEC-719, A-SPEC-734, A-SPEC-719.6, A-SPEC-245.9, A-SPEC-222.10, A-SPEC-794.4
46
46
  // @implements A-SPEC-713
47
47
  /** Content-addressed, isolated persistence for advisory requirement triage results. */
48
48
  const crypto = __importStar(require("node:crypto"));
@@ -50,7 +50,9 @@ const fs = __importStar(require("node:fs"));
50
50
  const path = __importStar(require("node:path"));
51
51
  const freshness_coordinator_1 = require("../refresh/freshness-coordinator");
52
52
  const ledger_store_1 = require("../governance/ledger-store");
53
+ const recorded_pairs_1 = require("../governance/recorded-pairs");
53
54
  const provenance_chain_1 = require("../governance/provenance-chain");
55
+ const spend_kinds_1 = require("../governance/spend-kinds");
54
56
  const ledger_lock_1 = require("../governance/ledger-lock");
55
57
  const display_id_aliases_1 = require("../governance/display-id-aliases");
56
58
  const bounded_io_1 = require("../project/bounded-io");
@@ -124,17 +126,19 @@ function issueRequirementTriageEvidence(root, artifact) {
124
126
  * unobtainable lock is a refusal, never a silent pass.
125
127
  */
126
128
  function consumeRequirementTriageEvidence(root, digest, reqId) {
127
- const ledgerFile = (0, ledger_store_1.writerChainFile)(ledgerDirOf(root));
128
129
  const key = spendKeyOf(digest);
129
130
  try {
130
- const won = (0, provenance_chain_1.consumeNonceExclusively)(key, ledgerFile, {
131
- ts: new Date().toISOString(), actor: 'holmes-kit', kind: 'nonce-consumed',
132
- summary: `requirement triage evidence spent on ${reqId}`, inputs: [(0, provenance_chain_1.nonceFingerprint)(key)],
133
- }, { isNonceConsumed: (0, ledger_store_1.nonceConsumedIn)(ledgerFile) });
134
- return won ? { ok: true } : { ok: false, reason: SPENT };
131
+ // @implements A-SPEC-245.9 (1b-1) — spent under the workspace spend lock, across every replica chain
132
+ const { spendApprovals } = require('../governance/approval-spend');
133
+ const r = spendApprovals(root, [{ nonce: key, actor: 'holmes-kit', summary: `requirement triage evidence spent on ${reqId}`, rationale: reqId }], {});
134
+ if (r.ok)
135
+ return { ok: true };
136
+ return { ok: false, reason: r.reason === 'spent' ? SPENT
137
+ : r.reason === 'revoked' ? '새 REQ triage evidence was revoked — it admits nothing; re-run requirement_triage.' // A-SPEC-245.16
138
+ : `새 REQ triage evidence could not be confirmed as spent once (${r.reason}: a spend-conflict-detected row names it) — re-run requirement_triage.` };
135
139
  }
136
140
  catch (e) {
137
- const busy = e instanceof ledger_lock_1.LedgerLockError;
141
+ const busy = e instanceof ledger_lock_1.LedgerLockError || e?.code === 'lock-busy';
138
142
  return { ok: false, reason: busy
139
143
  ? `새 REQ triage evidence could not be spent (ledger busy: ${e.message}) — 다시 시도하십시오.`
140
144
  : `새 REQ triage evidence could not be spent (${e instanceof Error ? e.message : String(e)}) — the ledger could not record it; check it with holmes-kit doctor.` };
@@ -149,10 +153,10 @@ function hasRequirementIntakeRecord(root, reqId, digest) {
149
153
  if (typeof digest !== 'string' || !DIGEST.test(digest))
150
154
  return false;
151
155
  try {
152
- const store = new ledger_store_1.FileLedgerStore(ledgerDirOf(root));
156
+ const store = new recorded_pairs_1.TrustedLedgerStore(ledgerDirOf(root)); // A-SPEC-222.10 H-C: a proof, from trusted events
153
157
  const broken = new Set(store.verifyAll().broken.map((b) => b.replicaId));
154
158
  const fp = (0, provenance_chain_1.nonceFingerprint)(spendKeyOf(digest));
155
- return store.loadAll().some((e) => e.kind === 'nonce-consumed' && !broken.has(e.replicaId)
159
+ return store.loadAll().some((e) => e.kind === (0, spend_kinds_1.spendKind)('grant') && !broken.has(e.replicaId)
156
160
  && (e.inputs ?? []).includes(fp) && e.summary === `requirement triage evidence spent on ${reqId}`);
157
161
  }
158
162
  catch {
@@ -165,7 +169,7 @@ function hasRequirementIntakeRecord(root, reqId, digest) {
165
169
  */
166
170
  function everSealedInLedger(root, specId) {
167
171
  try {
168
- const store = new ledger_store_1.FileLedgerStore(ledgerDirOf(root));
172
+ const store = new recorded_pairs_1.TrustedLedgerStore(ledgerDirOf(root)); // A-SPEC-222.10 H-C: a proof, from trusted events
169
173
  const broken = new Set(store.verifyAll().broken.map((b) => b.replicaId));
170
174
  // @implements A-SPEC-729 (round 7) — the mark follows RECORDED renames, in ledger order: a sealed
171
175
  // REQ renumbered away freed its id, and an untriaged REQ renumbered onto it read as "sealed
@@ -279,12 +283,17 @@ function validateRequirementIntake(root, triageEvidence) {
279
283
  // must not have been spent on another REQ yet (the spend itself happens at the write).
280
284
  // Only a chain that VERIFIES counts (round 1: a planted `provenance.<x>.jsonl` minted issuance). With
281
285
  // HOLMES_LEDGER_KEY set, verification checks signatures, so a forged chain cannot pass.
286
+ // A-SPEC-222.10 H-C: issuance is a proof, so it is accepted only from trusted events; the raw rows only say where an
287
+ // untrusted record sits, so the refusal can name the repair (round 2 below)
282
288
  const store = new ledger_store_1.FileLedgerStore(ledgerDirOf(root));
283
289
  let issuedOn = [];
290
+ let trustedOn = new Set();
284
291
  let broken = new Map();
285
292
  let own = null;
286
293
  try {
287
- issuedOn = store.loadAll().filter((e) => e.kind === 'triage-issued' && (e.inputs ?? []).includes(evidence.digest)).map((e) => e.replicaId);
294
+ const issued = (e) => e.kind === 'triage-issued' && (e.inputs ?? []).includes(evidence.digest);
295
+ issuedOn = store.loadAll().filter(issued).map((e) => e.replicaId);
296
+ trustedOn = new Set(new recorded_pairs_1.TrustedLedgerStore(ledgerDirOf(root)).loadAll().filter(issued).map((e) => e.replicaId));
288
297
  broken = new Map(store.verifyAll().broken.map((b) => [b.replicaId, b.detail]));
289
298
  }
290
299
  catch (e) {
@@ -299,7 +308,7 @@ function validateRequirementIntake(root, triageEvidence) {
299
308
  catch {
300
309
  own = null;
301
310
  }
302
- const verified = issuedOn.filter((r) => !broken.has(r));
311
+ const verified = issuedOn.filter((r) => !broken.has(r) && trustedOn.has(r));
303
312
  if (verified.length === 0) {
304
313
  // Round 2: when the broken chain is this writer's OWN, re-triage would land on the same chain —
305
314
  // the only recovery is repairing the ledger, so the refusal says that instead.
@@ -43,7 +43,7 @@ exports.readMcpHeartbeats = readMcpHeartbeats;
43
43
  /**
44
44
  * Whether the install a running MCP server was loaded from has changed under it, and the server's heartbeat.
45
45
  *
46
- * Measured 2026-10-23 (D1): the jarvis session's holmes-kit MCP served v0.36.0 while the global install its `.mcp.json`
46
+ * Measured 2026-10-23 (D1): a consumer workspace session's holmes-kit MCP served v0.36.0 while the global install its `.mcp.json`
47
47
  * names was 0.38.0 — the process had started before the install was upgraded in place — so `approval_ask`,
48
48
  * `review_verdict` and `phase_check` were missing and nothing said so. A-SPEC-251.2 compares the WIRING with the CLI
49
49
  * (they matched); A-SPEC-156's basis compares the loaded build with the WORKSPACE's dist (a consumer has none).
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HOOK_ENFORCED_TOOLS = void 0;
4
- // @implements A-SPEC-720, A-SPEC-718, A-SPEC-625, A-SPEC-564.1, A-SPEC-732, A-SPEC-734, A-SPEC-751.3, A-SPEC-251.4, A-SPEC-779.7
4
+ // @implements A-SPEC-720, A-SPEC-718, A-SPEC-625, A-SPEC-564.1, A-SPEC-732, A-SPEC-734, A-SPEC-751.3, A-SPEC-251.4, A-SPEC-779.7, A-SPEC-732.4
5
5
  const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
6
6
  const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
7
7
  const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
@@ -51,15 +51,15 @@ const elicit = async (req) => {
51
51
  }
52
52
  };
53
53
  // @implements A-SPEC-732 (round 2) — who launched this server, asked once, on first need.
54
- const { attestHarness, systemProcLookup, dispatcherVerifier } = require('./harness-attestation');
55
54
  // @implements A-SPEC-751.3 — the operator runtime registry's dispatcher is a launcher (it sits between the harness and
56
- // this server on a registered machine); the path is the registry's fixed default, never taken from the request.
57
- const runtimeRegistryPath = require('node:path').join(require('node:os').homedir(), '.holmes', 'runtime', 'bindings.json');
55
+ // this server on a registered machine); its path is the registry's fixed default under this home.
56
+ // @implements A-SPEC-732.4 — built in one entry (serverAttestation), which the tests reach with their own home and env
57
+ const { serverAttestation } = require('./harness-attestation');
58
58
  let attested;
59
59
  const harnessAttestation = () => {
60
60
  if (attested === undefined) {
61
61
  try {
62
- attested = attestHarness(process.ppid, systemProcLookup(), 8, dispatcherVerifier(runtimeRegistryPath));
62
+ attested = serverAttestation(process.ppid, { env: process.env, home: require('node:os').homedir() });
63
63
  }
64
64
  catch {
65
65
  attested = { attested: false, chain: [], reason: 'the process table could not be read' };
@@ -171,8 +171,8 @@ const fullProfile = process.env.HOLMES_MCP_PROFILE === 'full';
171
171
  // clients can marshal complex (array/object) arguments; fall back to a
172
172
  // permissive stub only if a handler somehow lacks a schema (tool-schemas.test.ts
173
173
  // pins full 1:1 coverage, so the fallback should never fire in practice).
174
- const TOOLS = Object.keys(handlers)
175
- .filter((name) => fullProfile || !tool_schemas_1.HOOK_ENFORCED_TOOLS.has(name))
174
+ const wire = (0, tool_schemas_1.wireDispatch)(handlers, fullProfile); // @implements A-SPEC-792.25, A-SPEC-792.26
175
+ const TOOLS = wire.names
176
176
  .map((name) => {
177
177
  const def = tool_schemas_1.TOOL_SCHEMAS[name];
178
178
  return def
@@ -191,7 +191,8 @@ server.setRequestHandler(types_js_1.CallToolRequestSchema, async (req) => {
191
191
  // the prototype chain to a truthy non-handler and crash the new validation path (round-2 probe) —
192
192
  // pre-enforcement it silently "succeeded" by invoking Object. Both are wrong; unknown tool is true.
193
193
  const own = (o, k) => Object.prototype.hasOwnProperty.call(o, k) ? o[k] : undefined;
194
- const fn = own(handlers, req.params.name);
194
+ // @implements A-SPEC-792.25 — the same set ListTools serves: a hidden tool is an unknown tool on the wire
195
+ const fn = wire.handlerFor(req.params.name);
195
196
  const def = own(tool_schemas_1.TOOL_SCHEMAS, req.params.name);
196
197
  const args = req.params.arguments ?? {};
197
198
  const check = fn && def ? (0, validate_args_1.validateArgs)(req.params.name, def.inputSchema, args) : { ok: true };
@@ -27,7 +27,7 @@ const spec_id_2 = require("../spec/spec-id");
27
27
  * - base > maxBase+1(leap) → 거부, 다음 가용 번호를 문면과 필드에 댄다.
28
28
  */
29
29
  /** The id's number SPACE. @implements A-SPEC-571.1 — ADR keeps its own sequence so a decision
30
- * (jarvis's ADR-0001) neither blocks nor is blocked by the functional chain's max. Everything
30
+ * (a consumer workspace's ADR-0001) neither blocks nor is blocked by the functional chain's max. Everything
31
31
  * else shares one space, exactly as before. */
32
32
  function idSpaceOf(id) {
33
33
  return /^ADR-/.test(id.trim()) ? 'ADR' : 'functional';
@@ -17,4 +17,17 @@ export interface ToolSchema {
17
17
  };
18
18
  }
19
19
  export declare const HOOK_ENFORCED_TOOLS: Set<string>;
20
+ /**
21
+ * @implements A-SPEC-792.25 — the one set the wire serves: ListTools advertises it and CallTool dispatches it, so a
22
+ * hidden tool is an unknown tool on the wire (risk_check answered there while ListTools hid it, F1-e.0d).
23
+ */
24
+ export declare function isWireTool(name: string, fullProfile: boolean): boolean;
25
+ /**
26
+ * @implements A-SPEC-792.26 — the wire's one tool set: ListTools serves `names` and CallTool resolves through
27
+ * `handlerFor`, an exact own-property match within that set, so a hidden tool or a respelling of one is unknown to both.
28
+ */
29
+ export declare function wireDispatch<T>(handlers: Record<string, T>, fullProfile: boolean): {
30
+ names: string[];
31
+ handlerFor(name: string): T | undefined;
32
+ };
20
33
  export declare const TOOL_SCHEMAS: Record<string, ToolSchema>;
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TOOL_SCHEMAS = exports.HOOK_ENFORCED_TOOLS = void 0;
4
- // @implements A-SPEC-743, A-SPEC-736, A-SPEC-735, A-SPEC-729, A-SPEC-719, A-SPEC-720, A-SPEC-718, A-SPEC-703, A-SPEC-629, A-SPEC-628, A-SPEC-623, A-SPEC-277, A-SPEC-624, A-SPEC-627, A-SPEC-713, A-SPEC-774.25, A-SPEC-255.1
4
+ exports.isWireTool = isWireTool;
5
+ exports.wireDispatch = wireDispatch;
6
+ // @implements A-SPEC-128.2, A-SPEC-128.4, A-SPEC-128.5, A-SPEC-128.7, A-SPEC-128.10, A-SPEC-743,A-SPEC-736,A-SPEC-735, A-SPEC-729, A-SPEC-719, A-SPEC-720, A-SPEC-718, A-SPEC-703, A-SPEC-629, A-SPEC-628, A-SPEC-623, A-SPEC-277, A-SPEC-624, A-SPEC-627, A-SPEC-713, A-SPEC-774.25, A-SPEC-255.1, A-SPEC-466.1, A-SPEC-466.2, A-SPEC-466.3, A-SPEC-466.4, A-SPEC-466.6
5
7
  // @implements A-SPEC-495 — the maintenance_analyze description carries the semantic-evidence
6
8
  // consumer contract (sem-verify / semCos / semanticAlternates) beside the anti-prediction warning.
7
9
  // @implements A-SPEC-642
@@ -37,6 +39,22 @@ const ROOT_ANY = str('Absolute path to the project root. Version control is opti
37
39
  // at module scope, so anything importing it for this constant attaches to stdio. This module holds
38
40
  // the rest of the tool metadata and has no import side effects.
39
41
  exports.HOOK_ENFORCED_TOOLS = new Set(['phase_check', 'risk_check', 'rtm_check', 'spec_validate']);
42
+ /**
43
+ * @implements A-SPEC-792.25 — the one set the wire serves: ListTools advertises it and CallTool dispatches it, so a
44
+ * hidden tool is an unknown tool on the wire (risk_check answered there while ListTools hid it, F1-e.0d).
45
+ */
46
+ function isWireTool(name, fullProfile) {
47
+ return fullProfile || !exports.HOOK_ENFORCED_TOOLS.has(name);
48
+ }
49
+ /**
50
+ * @implements A-SPEC-792.26 — the wire's one tool set: ListTools serves `names` and CallTool resolves through
51
+ * `handlerFor`, an exact own-property match within that set, so a hidden tool or a respelling of one is unknown to both.
52
+ */
53
+ function wireDispatch(handlers, fullProfile) {
54
+ const names = Object.keys(handlers).filter((name) => isWireTool(name, fullProfile));
55
+ const set = new Set(names);
56
+ return { names, handlerFor: (name) => (set.has(name) && Object.prototype.hasOwnProperty.call(handlers, name) ? handlers[name] : undefined) };
57
+ }
40
58
  exports.TOOL_SCHEMAS = {
41
59
  approval_commit: {
42
60
  description: 'Complete a server-issued, one-use in-session approval continuation. This sensitive annotation asks the host to show its native tool confirmation; the server records arrival only as a host-gated continuation, never proof of a human response. Send the unmodified approvalIntent returned by the original refused action, then retry that original action. The server verifies challenge, kind, target, subject digest, workspace, session run and expiry; this tool never reads HOLMES_APPROVAL or writes configuration.',
@@ -170,6 +188,15 @@ exports.TOOL_SCHEMAS = {
170
188
  properties: {
171
189
  id: str('Id of the spec to retire.'),
172
190
  reason: str('Why it is being retired. Omitted from the document when blank; not required when the spec already carries superseded_by.'),
191
+ // @implements A-SPEC-222.4
192
+ supersededBy: str('On an ALREADY-outdated spec with no superseded_by: record this approved spec of the same kind as its successor (records spec-superseded), so an anchor can move to it. Refused, writing nothing, for a draft, another kind, or a spec that already names a different successor.'),
193
+ // @implements A-SPEC-222.5
194
+ directive: str('With supersededBy on a SEALED spec under an active full autonomy profile: the supervisor directive this retirement follows (a section title or message id). It is recorded; when every machine condition holds (sealed same-kind successor; an A-SPEC anchored nowhere or a T-SPEC whose successor is tested; no approved dependent outside the chain; not graded for a person; the successor covers what it covered) the spec is retired without an approval. Otherwise the refusal is today\'s, with autonomousRefused naming the failed condition.'),
195
+ also: {
196
+ type: 'array',
197
+ description: 'Further { id, supersededBy } pairs retired in the same autonomous act (a chain, e.g. the T-SPEC over the retired A-SPEC).',
198
+ items: { type: 'object', properties: { id: str('Id of the spec to retire.'), supersededBy: str('Its sealed successor.') }, required: ['id', 'supersededBy'] },
199
+ },
173
200
  root: str('Optional when the server is bound to a file store — the ledger location is derived from the store itself; if supplied it must resolve to the SAME project.'),
174
201
  },
175
202
  required: ['id'],
@@ -225,7 +252,7 @@ exports.TOOL_SCHEMAS = {
225
252
  },
226
253
  // @implements A-SPEC-718.4
227
254
  approval_ask: {
228
- description: "Ask the person to decide ONE pending approval request in this session's approval form — the id a refusal named (`[승인 대기 req-…]`), from the approval inbox or this machine's refusal log. The person chooses approve / deny / question; the answer is recorded exactly as the operator's grant, deny or question is recorded (actor `elicitation:<client>`), so after `granted` retry the refused act once. Returns { ok, id, kind, decision: granted|denied|held|undecided, nextAction }. Nothing is recorded without the person's answer: silence leaves the request pending. A request a run awaits is asked here too, from the interactive session (the run resumes on the grant). Refuses, recording nothing, from a run's own server, when the session cannot show a form (HOLMES_ELICIT=off, a server no harness launched, a client without forms), and for a shell/config/code-write request on a client not yet measured to wait for a person (only claude-code today).",
255
+ description: "Ask the person to decide ONE pending approval request in this session's approval form — the id a refusal named (`[승인 대기 req-…]`), from the approval inbox or this machine's refusal log. The person chooses approve / deny / question; the answer is recorded exactly as the operator's grant, deny or question is recorded (under the session's elicitation channel actor), so after `granted` retry the refused act once. Returns { ok, id, kind, decision: granted|denied|held|undecided, nextAction }. Nothing is recorded without the person's answer: silence leaves the request pending. A request a run awaits is asked here too, from the interactive session (the run resumes on the grant). Refuses, recording nothing, from a run's own server, when the session cannot show a form (HOLMES_ELICIT=off, a server no harness launched, a client without forms), and for a shell/config/code-write request on a client not yet measured to wait for a person (only claude-code today).",
229
256
  inputSchema: {
230
257
  type: 'object',
231
258
  properties: {
@@ -250,7 +277,7 @@ exports.TOOL_SCHEMAS = {
250
277
  },
251
278
  // @implements A-SPEC-102.9
252
279
  review_verdict: {
253
- description: "Ask the person for an independent review verdict on base..head in this session's approval form. approve records pass, deny records fail with the person's reason as the finding; the verdict is recorded as the person's (reviewer.person true, channel elicitation:<client>, independent true), so it satisfies the review gate without a separate terminal. Returns { ok, decision: pass|fail|undecided, independent? }. Silence, a question and an automatic decline record nothing. Refuses, recording nothing, inside a run, when the session cannot show a form, and on a client not yet measured to wait for a person (only claude-code today).",
280
+ description: "Ask the person for an independent review verdict on base..head in this session's approval form. approve records pass, deny records fail with the person's reason as the finding; the verdict is recorded as the person's (reviewer.person true, the elicitation channel, independent true), so it satisfies the review gate without a separate terminal. Returns { ok, decision: pass|fail|undecided, independent? }. Silence, a question and an automatic decline record nothing. Refuses, recording nothing, inside a run, when the session cannot show a form, and on a client not yet measured to wait for a person (only claude-code today).",
254
281
  inputSchema: {
255
282
  type: 'object',
256
283
  properties: {
@@ -417,18 +444,24 @@ exports.TOOL_SCHEMAS = {
417
444
  },
418
445
  },
419
446
  test_run: {
420
- description: 'Compute the intelligent regression scope, RUN the selected tier (jest or pytest), and record per-A-SPEC EXECUTION evidence. Scopes against a git range when given, otherwise against a baseline — so it works on a project with no version control. A passing run records the baseline the next run scopes against.',
447
+ description: 'Compute the intelligent regression scope, RUN the selected tier (jest or pytest), and record per-A-SPEC EXECUTION evidence. Scopes against a git range when given, otherwise against a baseline — so it works on a project with no version control. A passing FULL run records the baseline the next run scopes against, and the test evidence the push gate reads; a scoped run records only `.ax/ledger/scoped-evidence.json`.',
421
448
  inputSchema: {
422
449
  type: 'object',
423
450
  properties: {
424
451
  root: ROOT_ANY,
425
452
  base: str('Base rev (e.g. HEAD~1). Optional — omit to compare against a baseline.'),
426
453
  head: str('Head rev (e.g. HEAD). Optional — omit to compare against a baseline.'),
427
- since: str('Baseline label to compare against when no git range is given (default `last-green`, recorded by a passing test_run). Works with or without version control.'),
428
- mark: str('Baseline label to record when the run passes (default `last-green`). Nothing is recorded for a red or skipped run.'),
454
+ since: str('Baseline label to compare against when no git range is given (default `last-green`, recorded by a passing full test_run). Works with or without version control.'),
455
+ mark: str('Baseline label to record when a full run passes (default `last-green`). Nothing is recorded for a red, skipped or scoped run.'),
456
+ // @implements A-SPEC-128.4
457
+ full: bool('Run the whole suite, whatever changed — the run the push gate accepts as evidence. It runs every execution unit (the root, and each directory with its own build or runner configuration) in its own directory, over the files git sees minus ax.config.json testRun.excludeDirs (a slash makes an entry a root-relative path; without one it is a directory name). Afterwards every detected test must have run (notExecuted) and every build root with code must have an executed test (untestedCode). A refusal is fix-tests, collect, rerun or environment. The budget defaults to 120 minutes. Refused together with base/head or mutate.'),
429
458
  mutate: str('T-SPEC id (e.g. T-SPEC-129.1). When set, runs that spec’s declared `kills` mutations against the A-SPEC’s source and reports which SURVIVED — a discriminating-power gap. Selective, opt-in; the ordinary run is skipped.'),
459
+ workers: num('jest worker count, passed as `--maxWorkers`: an integer from 1 to 64; any other number is refused before the run, and null reads as omitted. Optional — omit to keep the project’s own setting. The answer’s `workers` is the count jest applied (null when none). Runners other than jest take no count; when a count was given and such a runner ran, the answer lists them in `workersIgnoredBy`; when nothing took it, `workersIgnored` says why (`mutate`, `no jest group`, `nothing ran`).'),
460
+ timeoutMinutes: num('The time budget in minutes for each runner child of the run (jest, the other adapters, a mutation’s jest run): an integer from 1 to 180; when omitted or null, 30, or 120 for a full: true run; any other number is refused before the run. A run with a child past it ends "not judged": it records no evidence, and a full run records a full attempt that the push gate refuses. The answer and the evidence carry the applied value.'),
430
461
  },
431
462
  required: ['root'],
463
+ // @implements A-SPEC-466.2 — an undeclared key (`maxWorkers`) is refused, never run with that key ignored
464
+ additionalProperties: false,
432
465
  },
433
466
  },
434
467
  issue_localize: {
@@ -544,7 +577,7 @@ exports.TOOL_SCHEMAS = {
544
577
  root: ROOT_ANY,
545
578
  base: str('Base git ref of the diff range. Optional — omit to compare against a baseline.'),
546
579
  head: str('Head git ref of the diff range. Optional — omit to compare against a baseline.'),
547
- since: str('Baseline label to compare against when no git range is given (default `last-green`, recorded by a passing test_run). Works with or without version control.'),
580
+ since: str('Baseline label to compare against when no git range is given (default `last-green`, recorded by a passing full test_run). Works with or without version control.'),
548
581
  },
549
582
  required: ['root'],
550
583
  },
@@ -565,7 +598,7 @@ exports.TOOL_SCHEMAS = {
565
598
  description: 'Compute the graph-scoped review scope for base..head (impacted specs/tests + unscanned changed files).',
566
599
  inputSchema: {
567
600
  type: 'object',
568
- properties: { root: ROOT_ANY, base: str('Base git ref. Optional — omit to compare against a baseline instead.'), head: str('Head git ref. Optional — omit to compare against a baseline instead.'), since: str('Baseline label to compare against when no git range is given (default `last-green`, recorded by a passing test_run). Works with or without version control.'), },
601
+ properties: { root: ROOT_ANY, base: str('Base git ref. Optional — omit to compare against a baseline instead.'), head: str('Head git ref. Optional — omit to compare against a baseline instead.'), since: str('Baseline label to compare against when no git range is given (default `last-green`, recorded by a passing full test_run). Works with or without version control.'), },
569
602
  required: ['root'],
570
603
  },
571
604
  },
@@ -577,7 +610,7 @@ exports.TOOL_SCHEMAS = {
577
610
  root: ROOT_ANY,
578
611
  base: str('Base git ref. Optional — omit to compare against a baseline instead.'),
579
612
  head: str('Head git ref. Optional — omit to compare against a baseline instead.'),
580
- since: str('Baseline label to compare against when no git range is given (default `last-green`, recorded by a passing test_run). Works with or without version control.'),
613
+ since: str('Baseline label to compare against when no git range is given (default `last-green`, recorded by a passing full test_run). Works with or without version control.'),
581
614
  budget: num('Optional token budget for the review package (default 4000).'),
582
615
  },
583
616
  required: ['root'],
@@ -0,0 +1,19 @@
1
+ /** `--target` when given, else `cwd`; the `.ax` project it belongs to, or the path itself when it belongs to none.
2
+ * @implements A-SPEC-102.31 (W7) — a `--target` that does not exist is returned resolved, never thrown: the act reports
3
+ * it as before, and the catalog of a root that cannot be resolved refuses the guarded acts. */
4
+ export declare function actRoot(flags: Record<string, string | boolean | undefined>, cwd?: string): string;
5
+ /** The search for projects under an autonomy scope: its depth and the directories it may read. */
6
+ export declare const SCOPE_SEARCH_LIMITS: {
7
+ readonly maxDepth: 16;
8
+ readonly maxDirs: 10000;
9
+ };
10
+ /**
11
+ * Every `.ax` project under `scope` (the scope's own included). autonomy full covers the whole subtree, so each project
12
+ * there is judged by its additions (A-SPEC-102.30, medium 2). Links are not followed, and `.git`, `node_modules` and
13
+ * `.ax` are not entered. A search past either limit, or a directory it cannot read, throws: the union could not be
14
+ * known, and the act is refused.
15
+ */
16
+ export declare function projectsUnder(scope: string, limits?: {
17
+ maxDepth: number;
18
+ maxDirs: number;
19
+ }): string[];
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.SCOPE_SEARCH_LIMITS = void 0;
37
+ exports.actRoot = actRoot;
38
+ exports.projectsUnder = projectsUnder;
39
+ // @implements A-SPEC-102.30, A-SPEC-102.31
40
+ /**
41
+ * The project an operator act works on, decided once. approve and lock recover act on the working directory when no
42
+ * `--target` is given (their usage says so); the guard was handed no root there, so `approve --grant` from inside a
43
+ * project judged without the project's additions while the queue it wrote was that project's (A and B, reproduced).
44
+ * The queue and the guard now take this one value.
45
+ */
46
+ const fs = __importStar(require("node:fs"));
47
+ const path = __importStar(require("node:path"));
48
+ const root_1 = require("./root");
49
+ /** `--target` when given, else `cwd`; the `.ax` project it belongs to, or the path itself when it belongs to none.
50
+ * @implements A-SPEC-102.31 (W7) — a `--target` that does not exist is returned resolved, never thrown: the act reports
51
+ * it as before, and the catalog of a root that cannot be resolved refuses the guarded acts. */
52
+ function actRoot(flags, cwd = process.cwd()) {
53
+ const dir = path.resolve(cwd, typeof flags.target === 'string' ? flags.target : '.');
54
+ try {
55
+ return (0, root_1.resolveProjectRoot)(dir, { includeGit: false }).root; // the `.ax` project, or the path itself, canonical
56
+ }
57
+ catch {
58
+ return dir;
59
+ }
60
+ }
61
+ /** The search for projects under an autonomy scope: its depth and the directories it may read. */
62
+ exports.SCOPE_SEARCH_LIMITS = { maxDepth: 16, maxDirs: 10_000 };
63
+ const NOT_ENTERED = new Set(['.git', 'node_modules', '.ax']);
64
+ /**
65
+ * Every `.ax` project under `scope` (the scope's own included). autonomy full covers the whole subtree, so each project
66
+ * there is judged by its additions (A-SPEC-102.30, medium 2). Links are not followed, and `.git`, `node_modules` and
67
+ * `.ax` are not entered. A search past either limit, or a directory it cannot read, throws: the union could not be
68
+ * known, and the act is refused.
69
+ */
70
+ function projectsUnder(scope, limits = exports.SCOPE_SEARCH_LIMITS) {
71
+ const found = [];
72
+ let read = 0;
73
+ const stack = [[path.resolve(scope), 0]];
74
+ while (stack.length > 0) {
75
+ const [dir, depth] = stack.pop();
76
+ if (++read > limits.maxDirs)
77
+ throw new Error(`more than ${limits.maxDirs} directories under ${scope}`);
78
+ let entries;
79
+ try {
80
+ entries = fs.readdirSync(dir, { withFileTypes: true });
81
+ }
82
+ catch (e) {
83
+ throw new Error(`${dir} cannot be read (${e.code ?? 'error'})`);
84
+ }
85
+ // @implements A-SPEC-102.31 — resolveProjectRoot's rule (a `.ax` directory, a link to one, the file system's case
86
+ // rule); the name compare missed `.AX` and a linked `.ax`. The search itself follows no link and enters no `.ax`
87
+ if ((0, root_1.isProjectDir)(dir))
88
+ found.push(dir);
89
+ for (const e of entries) {
90
+ if (!e.isDirectory())
91
+ continue;
92
+ if (NOT_ENTERED.has(e.name.toLowerCase()))
93
+ continue;
94
+ if (depth + 1 > limits.maxDepth)
95
+ throw new Error(`a search depth of ${limits.maxDepth} is passed under ${scope}`);
96
+ stack.push([path.join(dir, e.name), depth + 1]);
97
+ }
98
+ }
99
+ return found;
100
+ }
@@ -1,3 +1,4 @@
1
+ import { type FullMode } from '../review/evidence-mode';
1
2
  /**
2
3
  * A NAMED reference point: "the tree as it was when this label was taken".
3
4
  *
@@ -20,6 +21,16 @@ export interface Baseline {
20
21
  takenAt: string;
21
22
  /** Project-relative POSIX path -> content hash. */
22
23
  files: Record<string, string>;
24
+ /** @implements A-SPEC-128.2 — the run that verified this tree; absent before 128.2. Informational: trust reads the anchor. */
25
+ tier?: string;
26
+ mode?: string;
27
+ ranFileCount?: number;
28
+ }
29
+ /** @implements A-SPEC-128.2 — what a passing run says about itself when it records a baseline. */
30
+ export interface BaselineMeta {
31
+ tier: string;
32
+ mode: FullMode;
33
+ ranFileCount: number;
23
34
  }
24
35
  /**
25
36
  * @implements A-SPEC-134
@@ -30,7 +41,7 @@ export interface Baseline {
30
41
  */
31
42
  export declare function baselineDigest(files: Record<string, string>): string;
32
43
  /** Write (or replace) a labelled baseline. One label holds exactly one reference point. */
33
- export declare function writeBaseline(root: string, label: string, files: Record<string, string>): Baseline;
44
+ export declare function writeBaseline(root: string, label: string, files: Record<string, string>, meta?: BaselineMeta): Baseline;
34
45
  /**
35
46
  * @implements A-SPEC-134
36
47
  * Is this baseline still the one that was recorded? Recompute its digest from the on-disk files and
@@ -38,7 +49,9 @@ export declare function writeBaseline(root: string, label: string, files: Record
38
49
  * digest and no entry matches → false. A missing baseline or missing/unreadable chain → false:
39
50
  * cannot-verify is not permission to narrow (the caller degrades to full scope).
40
51
  */
41
- export declare function isBaselineTrusted(root: string, label: string, ledgerFile: string): boolean;
52
+ export declare function isBaselineTrusted(root: string, label: string, ledgerFile: string, opts?: {
53
+ requireMode?: FullMode;
54
+ }): boolean;
42
55
  /**
43
56
  * Read a baseline, or null when there is none.
44
57
  *
@@ -40,11 +40,12 @@ exports.isBaselineTrusted = isBaselineTrusted;
40
40
  exports.readBaseline = readBaseline;
41
41
  exports.shouldRecordBaseline = shouldRecordBaseline;
42
42
  exports.listBaselines = listBaselines;
43
- // @implements A-SPEC-128
43
+ // @implements A-SPEC-128, A-SPEC-222.10, A-SPEC-128.2, A-SPEC-128.4, A-SPEC-128.5
44
44
  const fs = __importStar(require("node:fs"));
45
45
  const path = __importStar(require("node:path"));
46
46
  const node_crypto_1 = require("node:crypto");
47
47
  const ledger_store_1 = require("../governance/ledger-store");
48
+ const evidence_mode_1 = require("../review/evidence-mode");
48
49
  /**
49
50
  * A NAMED reference point: "the tree as it was when this label was taken".
50
51
  *
@@ -87,14 +88,14 @@ function baselineDigest(files) {
87
88
  }
88
89
  const ledgerFor = (root) => path.join(root, '.ax', 'ledger', 'provenance.jsonl');
89
90
  /** Write (or replace) a labelled baseline. One label holds exactly one reference point. */
90
- function writeBaseline(root, label, files) {
91
+ function writeBaseline(root, label, files, meta) {
91
92
  assertLabel(label);
92
93
  // Keys sorted so the stored file is byte-stable for the same input; a diffable baseline is easier
93
94
  // to inspect, and instability here would show up as noise in any tooling that reads it.
94
95
  const sorted = {};
95
96
  for (const k of Object.keys(files).sort())
96
97
  sorted[k] = files[k];
97
- const baseline = { label, takenAt: new Date().toISOString(), files: sorted };
98
+ const baseline = { label, takenAt: new Date().toISOString(), files: sorted, ...(meta ?? {}) };
98
99
  fs.mkdirSync(path.dirname(fileFor(root, label)), { recursive: true });
99
100
  fs.writeFileSync(fileFor(root, label), `${JSON.stringify(baseline, null, 2)}\n`);
100
101
  // @implements A-SPEC-134
@@ -106,7 +107,9 @@ function writeBaseline(root, label, files) {
106
107
  new ledger_store_1.FileLedgerStore(path.dirname(ledgerFor(root))).append({
107
108
  ts: baseline.takenAt, actor: 'holmes-kit', kind: 'baseline-recorded',
108
109
  summary: `baseline ${label} recorded (${Object.keys(sorted).length} files)`,
109
- inputs: [label, baselineDigest(sorted)], rationale: '', authorization: '',
110
+ // @implements A-SPEC-128.2 — the run's mode rides on the chain, where a hand-edit of the file cannot reach it
111
+ // @implements A-SPEC-128.4 — the token comes from the one module that spells it
112
+ inputs: [label, baselineDigest(sorted), ...(meta ? [(0, evidence_mode_1.modeAnchor)(meta.mode)] : [])], rationale: '', authorization: '',
110
113
  });
111
114
  }
112
115
  catch { /* unanchored baseline degrades to untrusted on read, never throws the write */ }
@@ -119,7 +122,7 @@ function writeBaseline(root, label, files) {
119
122
  * digest and no entry matches → false. A missing baseline or missing/unreadable chain → false:
120
123
  * cannot-verify is not permission to narrow (the caller degrades to full scope).
121
124
  */
122
- function isBaselineTrusted(root, label, ledgerFile) {
125
+ function isBaselineTrusted(root, label, ledgerFile, opts = {}) {
123
126
  const baseline = readBaseline(root, label);
124
127
  if (!baseline)
125
128
  return false;
@@ -129,8 +132,9 @@ function isBaselineTrusted(root, label, ledgerFile) {
129
132
  // so scanning only the legacy file would fail to find an anchor this very process just wrote.
130
133
  let events;
131
134
  try {
132
- const { FileLedgerStore } = require('../governance/ledger-store');
133
- events = new FileLedgerStore(path.dirname(ledgerFile)).loadAll();
135
+ // @implements A-SPEC-222.10 — H-C: a trusted anchor only (it narrows the test scope)
136
+ const { TrustedLedgerStore } = require('../governance/recorded-pairs');
137
+ events = new TrustedLedgerStore(path.dirname(ledgerFile)).loadAll();
134
138
  }
135
139
  catch {
136
140
  return false;
@@ -153,7 +157,9 @@ function isBaselineTrusted(root, label, ledgerFile) {
153
157
  }
154
158
  for (const evt of events) {
155
159
  if (evt.kind === 'baseline-recorded' && Array.isArray(evt.inputs)
156
- && evt.inputs.includes(label) && evt.inputs.includes(digest))
160
+ && evt.inputs.includes(label) && evt.inputs.includes(digest)
161
+ // @implements A-SPEC-128.2 — a reader that narrows trusts only a tree a full run verified
162
+ && (!opts.requireMode || evt.inputs.includes((0, evidence_mode_1.modeAnchor)(opts.requireMode))))
157
163
  return true;
158
164
  }
159
165
  return false;