@holmes-lab/holmes-kit 0.39.0 → 0.40.0

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 (298) hide show
  1. package/CHANGELOG.md +344 -6
  2. package/README.md +54 -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 +202 -424
  65. package/dist/holmes/cli/init.js +33 -0
  66. package/dist/holmes/cli/lock-recover.d.ts +5 -0
  67. package/dist/holmes/cli/lock-recover.js +126 -0
  68. package/dist/holmes/cli/mcp-processes.js +1 -1
  69. package/dist/holmes/cli/release-docs.js +1 -1
  70. package/dist/holmes/cli/run-exec.d.ts +141 -0
  71. package/dist/holmes/cli/run-exec.js +1435 -0
  72. package/dist/holmes/cli/run-provision.d.ts +3 -1
  73. package/dist/holmes/cli/run-provision.js +255 -44
  74. package/dist/holmes/cli/run-wiring.d.ts +69 -0
  75. package/dist/holmes/cli/run-wiring.js +270 -0
  76. package/dist/holmes/cli/run.d.ts +21 -0
  77. package/dist/holmes/cli/run.js +341 -92
  78. package/dist/holmes/cli/runtime-binding-approval.js +32 -19
  79. package/dist/holmes/cli/screen-safe.d.ts +3 -92
  80. package/dist/holmes/cli/screen-safe.js +18 -756
  81. package/dist/holmes/config/config.d.ts +2 -0
  82. package/dist/holmes/config/config.js +5 -2
  83. package/dist/holmes/cpg/foundation/language-matrix.js +2 -2
  84. package/dist/holmes/cpg/import-resolver.js +1 -1
  85. package/dist/holmes/governance/approval-decisions.d.ts +47 -0
  86. package/dist/holmes/governance/approval-decisions.js +29 -0
  87. package/dist/holmes/governance/approval-grants.d.ts +220 -1
  88. package/dist/holmes/governance/approval-grants.js +612 -33
  89. package/dist/holmes/governance/approval-queue.d.ts +26 -0
  90. package/dist/holmes/governance/approval-queue.js +109 -11
  91. package/dist/holmes/governance/approval-spend.d.ts +95 -0
  92. package/dist/holmes/governance/approval-spend.js +191 -0
  93. package/dist/holmes/governance/autonomous-shell.d.ts +61 -0
  94. package/dist/holmes/governance/autonomous-shell.js +332 -0
  95. package/dist/holmes/governance/autonomy.d.ts +5 -0
  96. package/dist/holmes/governance/autonomy.js +16 -11
  97. package/dist/holmes/governance/constitution.d.ts +5 -0
  98. package/dist/holmes/governance/constitution.js +32 -12
  99. package/dist/holmes/governance/full-autonomy.d.ts +10 -0
  100. package/dist/holmes/governance/full-autonomy.js +103 -7
  101. package/dist/holmes/governance/harness-catalog.d.ts +103 -0
  102. package/dist/holmes/governance/harness-catalog.js +348 -0
  103. package/dist/holmes/governance/human-channel.d.ts +38 -0
  104. package/dist/holmes/governance/human-channel.js +49 -0
  105. package/dist/holmes/governance/install-manifest.d.ts +22 -0
  106. package/dist/holmes/governance/install-manifest.js +160 -0
  107. package/dist/holmes/governance/ledger-rechain.js +2 -0
  108. package/dist/holmes/governance/ledger-store.conformance.d.ts +7 -1
  109. package/dist/holmes/governance/ledger-store.conformance.js +66 -0
  110. package/dist/holmes/governance/ledger-store.d.ts +88 -11
  111. package/dist/holmes/governance/ledger-store.js +186 -8
  112. package/dist/holmes/governance/provenance-chain.d.ts +16 -4
  113. package/dist/holmes/governance/provenance-chain.js +19 -4
  114. package/dist/holmes/governance/provenance-ledger.d.ts +6 -3
  115. package/dist/holmes/governance/provenance-ledger.js +53 -18
  116. package/dist/holmes/governance/push-gate-runner.js +11 -7
  117. package/dist/holmes/governance/recorded-pairs.d.ts +96 -0
  118. package/dist/holmes/governance/recorded-pairs.js +522 -0
  119. package/dist/holmes/governance/replica-id.d.ts +1 -1
  120. package/dist/holmes/governance/replica-id.js +1 -1
  121. package/dist/holmes/governance/spec-seam.d.ts +59 -0
  122. package/dist/holmes/governance/spec-seam.js +587 -0
  123. package/dist/holmes/governance/spend-kinds.d.ts +16 -0
  124. package/dist/holmes/governance/spend-kinds.js +18 -0
  125. package/dist/holmes/guardrail/decision-ledger.d.ts +2 -1
  126. package/dist/holmes/guardrail/decision-ledger.js +2 -1
  127. package/dist/holmes/guardrail/impact-gate.d.ts +1 -0
  128. package/dist/holmes/guardrail/impact-gate.js +1 -1
  129. package/dist/holmes/guardrail/line-continuation.d.ts +8 -0
  130. package/dist/holmes/guardrail/line-continuation.js +39 -0
  131. package/dist/holmes/guardrail/operator-person.d.ts +28 -4
  132. package/dist/holmes/guardrail/operator-person.js +57 -11
  133. package/dist/holmes/guardrail/refusal-codes.d.ts +8 -3
  134. package/dist/holmes/guardrail/refusal-codes.js +64 -10
  135. package/dist/holmes/guardrail/risk-classifier.d.ts +15 -9
  136. package/dist/holmes/guardrail/risk-classifier.js +228 -16
  137. package/dist/holmes/guardrail/risk-gate.d.ts +2 -8
  138. package/dist/holmes/guardrail/risk-gate.js +7 -34
  139. package/dist/holmes/guardrail/risk-types.d.ts +10 -0
  140. package/dist/holmes/guardrail/run-plan-scope.js +3 -1
  141. package/dist/holmes/guardrail/run-refusals.js +24 -8
  142. package/dist/holmes/guardrail/run-stages.d.ts +5 -0
  143. package/dist/holmes/guardrail/run-stages.js +25 -5
  144. package/dist/holmes/guardrail/scope-judgment.js +1 -1
  145. package/dist/holmes/guardrail/shell-words.js +24 -3
  146. package/dist/holmes/guardrail/unresolved-write.d.ts +40 -0
  147. package/dist/holmes/guardrail/unresolved-write.js +556 -0
  148. package/dist/holmes/guardrail/write-target.d.ts +3 -0
  149. package/dist/holmes/guardrail/write-target.js +26 -5
  150. package/dist/holmes/hooks/pre-tool-use.d.ts +105 -1
  151. package/dist/holmes/hooks/pre-tool-use.js +1134 -167
  152. package/dist/holmes/hooks/rtm-refresh-child.d.ts +1 -1
  153. package/dist/holmes/hooks/rtm-refresh-child.js +1 -1
  154. package/dist/holmes/hooks/stop.d.ts +23 -0
  155. package/dist/holmes/hooks/stop.js +86 -33
  156. package/dist/holmes/mcp/approval-adapters.js +3 -1
  157. package/dist/holmes/mcp/approval-commit.js +3 -2
  158. package/dist/holmes/mcp/approval-policy.d.ts +2 -1
  159. package/dist/holmes/mcp/approval-policy.js +3 -1
  160. package/dist/holmes/mcp/handlers/adoption.d.ts +1 -1
  161. package/dist/holmes/mcp/handlers/approval-ask.d.ts +3 -0
  162. package/dist/holmes/mcp/handlers/approval-ask.js +18 -7
  163. package/dist/holmes/mcp/handlers/entity-integration.d.ts +3 -3
  164. package/dist/holmes/mcp/handlers/entity-integration.js +29 -11
  165. package/dist/holmes/mcp/handlers/entity-renumber.d.ts +4 -4
  166. package/dist/holmes/mcp/handlers/entity-renumber.js +29 -11
  167. package/dist/holmes/mcp/handlers/entity-store.d.ts +2 -2
  168. package/dist/holmes/mcp/handlers/entity-store.js +133 -59
  169. package/dist/holmes/mcp/handlers/operator-inspection.d.ts +9 -5
  170. package/dist/holmes/mcp/handlers/operator-inspection.js +79 -16
  171. package/dist/holmes/mcp/handlers/phase-queries.d.ts +1 -1
  172. package/dist/holmes/mcp/handlers/requirement-triage.d.ts +4 -4
  173. package/dist/holmes/mcp/handlers/review-evidence.d.ts +2 -2
  174. package/dist/holmes/mcp/handlers/review-evidence.js +35 -11
  175. package/dist/holmes/mcp/handlers/review-queries.d.ts +5 -0
  176. package/dist/holmes/mcp/handlers/review-queries.js +8 -1
  177. package/dist/holmes/mcp/handlers/review-verdict.d.ts +3 -0
  178. package/dist/holmes/mcp/handlers/review-verdict.js +10 -3
  179. package/dist/holmes/mcp/handlers/risk-assessment.d.ts +7 -2
  180. package/dist/holmes/mcp/handlers/risk-assessment.js +34 -12
  181. package/dist/holmes/mcp/handlers/runtime-binding-tool.d.ts +2 -2
  182. package/dist/holmes/mcp/handlers/slice-orchestration.d.ts +6 -1
  183. package/dist/holmes/mcp/handlers/slice-orchestration.js +14 -1
  184. package/dist/holmes/mcp/handlers/spec-approval.d.ts +15 -3
  185. package/dist/holmes/mcp/handlers/spec-approval.js +32 -5
  186. package/dist/holmes/mcp/handlers/spec-authoring.d.ts +2 -2
  187. package/dist/holmes/mcp/handlers/spec-authoring.js +19 -2
  188. package/dist/holmes/mcp/handlers/spec-lifecycle.d.ts +11 -38
  189. package/dist/holmes/mcp/handlers/spec-lifecycle.js +441 -94
  190. package/dist/holmes/mcp/handlers/spec-queries.d.ts +2 -2
  191. package/dist/holmes/mcp/handlers/taint-screening.d.ts +1 -1
  192. package/dist/holmes/mcp/handlers/taint-screening.js +2 -2
  193. package/dist/holmes/mcp/handlers/test-execution.d.ts +1 -1
  194. package/dist/holmes/mcp/handlers/workspace-queries.d.ts +2 -2
  195. package/dist/holmes/mcp/handlers.d.ts +89 -79
  196. package/dist/holmes/mcp/handlers.js +69 -22
  197. package/dist/holmes/mcp/harness-attestation.d.ts +78 -5
  198. package/dist/holmes/mcp/harness-attestation.js +325 -53
  199. package/dist/holmes/mcp/maintenance-analyze.d.ts +1 -1
  200. package/dist/holmes/mcp/maintenance-analyze.js +9 -9
  201. package/dist/holmes/mcp/maintenance-evidence.js +31 -2
  202. package/dist/holmes/mcp/requirement-triage-evidence.js +22 -13
  203. package/dist/holmes/mcp/server-staleness.js +1 -1
  204. package/dist/holmes/mcp/server.js +9 -8
  205. package/dist/holmes/mcp/spec-id-guard.js +1 -1
  206. package/dist/holmes/mcp/tool-schemas.d.ts +13 -0
  207. package/dist/holmes/mcp/tool-schemas.js +29 -2
  208. package/dist/holmes/project/act-root.d.ts +19 -0
  209. package/dist/holmes/project/act-root.js +100 -0
  210. package/dist/holmes/project/baseline.js +4 -3
  211. package/dist/holmes/project/bounded-group.d.ts +47 -0
  212. package/dist/holmes/project/bounded-group.js +140 -0
  213. package/dist/holmes/project/bounded-io.d.ts +50 -2
  214. package/dist/holmes/project/bounded-io.js +138 -6
  215. package/dist/holmes/project/change-source.js +2 -2
  216. package/dist/holmes/project/instance-id.d.ts +10 -0
  217. package/dist/holmes/project/instance-id.js +233 -0
  218. package/dist/holmes/project/machine-identity.d.ts +25 -0
  219. package/dist/holmes/project/machine-identity.js +133 -0
  220. package/dist/holmes/project/owned-lock.d.ts +84 -0
  221. package/dist/holmes/project/owned-lock.js +263 -0
  222. package/dist/holmes/project/plain-lock-fs.d.ts +2 -0
  223. package/dist/holmes/project/plain-lock-fs.js +126 -0
  224. package/dist/holmes/project/request-lock.d.ts +85 -0
  225. package/dist/holmes/project/request-lock.js +459 -0
  226. package/dist/holmes/project/root.d.ts +12 -4
  227. package/dist/holmes/project/root.js +26 -7
  228. package/dist/holmes/project/run-records.d.ts +19 -0
  229. package/dist/holmes/project/run-records.js +94 -12
  230. package/dist/holmes/project/screen-text.d.ts +94 -0
  231. package/dist/holmes/project/screen-text.js +763 -0
  232. package/dist/holmes/project/spend-lock.d.ts +82 -0
  233. package/dist/holmes/project/spend-lock.js +413 -0
  234. package/dist/holmes/refresh/freshness-coordinator.d.ts +1 -1
  235. package/dist/holmes/refresh/freshness-coordinator.js +1 -1
  236. package/dist/holmes/review/condition-hunk-replay.js +4 -2
  237. package/dist/holmes/review/confidence-calibration.d.ts +1 -1
  238. package/dist/holmes/review/confidence-calibration.js +1 -1
  239. package/dist/holmes/review/content-verify.js +1 -1
  240. package/dist/holmes/review/hop-ablation.d.ts +4 -4
  241. package/dist/holmes/review/hop-ablation.js +5 -5
  242. package/dist/holmes/review/point-in-time-replay.js +12 -3
  243. package/dist/holmes/review/rank-diagnosis.d.ts +2 -2
  244. package/dist/holmes/review/rank-diagnosis.js +1 -1
  245. package/dist/holmes/review/replay-corpus.d.ts +10 -4
  246. package/dist/holmes/review/replay-corpus.js +25 -9
  247. package/dist/holmes/review/requirement-triage.js +2 -2
  248. package/dist/holmes/review/semantic-arm.d.ts +3 -3
  249. package/dist/holmes/review/semantic-arm.js +3 -3
  250. package/dist/holmes/review/test-outcomes.js +3 -1
  251. package/dist/holmes/review/test-runner.d.ts +11 -0
  252. package/dist/holmes/review/test-runner.js +31 -10
  253. package/dist/holmes/review/test-selection-breadth.js +2 -2
  254. package/dist/holmes/review/verdicts.d.ts +105 -8
  255. package/dist/holmes/review/verdicts.js +640 -36
  256. package/dist/holmes/rtm/anchor-census.d.ts +9 -0
  257. package/dist/holmes/rtm/anchor-census.js +151 -0
  258. package/dist/holmes/rtm/anchor-ids.d.ts +25 -1
  259. package/dist/holmes/rtm/anchor-ids.js +45 -2
  260. package/dist/holmes/rtm/comment-ranges.d.ts +2 -0
  261. package/dist/holmes/rtm/comment-ranges.js +104 -0
  262. package/dist/holmes/rtm/counted-tests.d.ts +1 -0
  263. package/dist/holmes/rtm/counted-tests.js +63 -0
  264. package/dist/holmes/rtm/impact-advisory.d.ts +1 -1
  265. package/dist/holmes/rtm/known-defects.js +1 -1
  266. package/dist/holmes/rtm/localize.js +1 -1
  267. package/dist/holmes/rtm/taint-benchmark.d.ts +1 -1
  268. package/dist/holmes/rtm/taint-vocabulary.d.ts +1 -1
  269. package/dist/holmes/rtm/test-scope.d.ts +31 -0
  270. package/dist/holmes/rtm/test-scope.js +166 -5
  271. package/dist/holmes/rtm/trace-gaps.js +1 -1
  272. package/dist/holmes/runtime/dispatch.d.ts +10 -0
  273. package/dist/holmes/runtime/dispatch.js +12 -1
  274. package/dist/holmes/semantic/cloud-usage.d.ts +1 -1
  275. package/dist/holmes/semantic/cloud-usage.js +1 -1
  276. package/dist/holmes/semantic/unreadable-paths.d.ts +1 -1
  277. package/dist/holmes/semantic/unreadable-paths.js +1 -1
  278. package/dist/holmes/spec/approval-blockers.js +1 -1
  279. package/dist/holmes/spec/entity-store.d.ts +6 -1
  280. package/dist/holmes/spec/entity-store.js +16 -2
  281. package/dist/holmes/spec/entity-transaction.d.ts +7 -2
  282. package/dist/holmes/spec/entity-transaction.js +87 -170
  283. package/dist/holmes/spec/spec-store.d.ts +12 -6
  284. package/dist/holmes/spec/spec-store.js +4 -2
  285. package/dist/holmes/spec/spec-types.js +1 -1
  286. package/dist/holmes/spec/succession-guard.d.ts +56 -0
  287. package/dist/holmes/spec/succession-guard.js +187 -0
  288. package/dist/holmes/spec/succession.d.ts +70 -0
  289. package/dist/holmes/spec/succession.js +171 -0
  290. package/dist/holmes/spec/transition-policy.d.ts +2 -2
  291. package/docs/install-guide.md +9 -3
  292. package/docs/language-support.md +78 -0
  293. package/package.json +4 -3
  294. package/playbooks/author-slice/PLAYBOOK.md +1 -1
  295. package/playbooks/promote-slice/PLAYBOOK.md +5 -1
  296. package/playbooks/publish/PLAYBOOK.md +45 -33
  297. package/dist/holmes/review/manual-baseline.d.ts +0 -209
  298. package/dist/holmes/review/manual-baseline.js +0 -2847
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.HandlerRefusal = void 0;
36
+ exports.HOST_APPROVAL_PROBE = exports.HandlerRefusal = void 0;
37
37
  exports.fetchJson = fetchJson;
38
38
  exports.isHandlerRefusal = isHandlerRefusal;
39
39
  exports.unreadableAmong = unreadableAmong;
@@ -176,6 +176,7 @@ function isHandlerRefusal(e) {
176
176
  const root_1 = require("../project/root");
177
177
  const change_source_1 = require("../project/change-source");
178
178
  const ignore_1 = require("../project/ignore");
179
+ const human_channel_1 = require("../governance/human-channel");
179
180
  // @implements A-SPEC-126
180
181
  const adr_refs_1 = require("../spec/adr-refs");
181
182
  // @implements A-SPEC-128
@@ -224,7 +225,7 @@ function resolveHandlerApproval(rootArg, store, envApproval, action, now) {
224
225
  const r = (0, approval_grants_1.resolveApproval)(root, envApproval, action, now);
225
226
  return r ? { ...r, root } : undefined;
226
227
  }
227
- function refusalQueueHint(rootArg, store, req, operation) {
228
+ function refusalQueueHint(rootArg, store, req, operation, noForm) {
228
229
  try {
229
230
  // The SpecStore interface carries no root; the file-backed store exposes one. A store without a
230
231
  // root files nothing — the queue lives on disk, and with no disk location there is nothing to do.
@@ -234,7 +235,13 @@ function refusalQueueHint(rootArg, store, req, operation) {
234
235
  return '';
235
236
  const root = projectRootOf(base);
236
237
  // @implements A-SPEC-770.12 — the request's title rides into the queue and into the line the operator reads.
237
- return (0, approval_queue_1.queueHint)(root, req, (0, operator_recovery_1.operatorRecovery)(root, req.target, operation, { label: (0, approval_queue_1.requestLabel)(req.kind, req.target, req.title) }));
238
+ const recovery = (0, operator_recovery_1.operatorRecovery)(root, req.target, operation, { label: (0, approval_queue_1.requestLabel)(req.kind, req.target, req.title) });
239
+ // @implements A-SPEC-792.23 — a session that cannot show a form is not sent to approval_ask (that line led an agent to
240
+ // the open route, review 19:2x); it is told the request waits and why no form appears here.
241
+ if (typeof noForm === 'string' && noForm !== '') {
242
+ return (0, approval_queue_1.queueHint)(root, req, { ...recovery, pendingHint: (id) => `\n[승인 대기 ${id}${(0, approval_queue_1.requestLabel)(req.kind, req.target, req.title)}]\nNo approval form can be shown in this session: ${noForm}.` });
243
+ }
244
+ return (0, approval_queue_1.queueHint)(root, req, recovery);
238
245
  }
239
246
  catch {
240
247
  return '';
@@ -568,6 +575,11 @@ function unreadableAmong(listed, created) {
568
575
  const present = new Set(listed.map((s) => s.id));
569
576
  return created.filter((id) => !present.has(id));
570
577
  }
578
+ /**
579
+ * @implements A-SPEC-792.26 — the in-process handle on the host-gated preparation, so a test can call it directly on a
580
+ * gated session (F1-e.0e f); a symbol key is skipped by every name-based listing, so the wire never sees it.
581
+ */
582
+ exports.HOST_APPROVAL_PROBE = Symbol('holmes.hostApprovalProbe');
571
583
  function makeHandlers(store, opts) {
572
584
  const raw = makeRawHandlers(store, opts);
573
585
  const wrapped = {};
@@ -602,6 +614,7 @@ function makeHandlers(store, opts) {
602
614
  return stale === null ? out : { ...out, serverStale: (0, server_staleness_1.staleNotice)(stale) };
603
615
  };
604
616
  }
617
+ wrapped[exports.HOST_APPROVAL_PROBE] = raw[exports.HOST_APPROVAL_PROBE];
605
618
  wrapped.basis_detail = async (a) => {
606
619
  const b = basisFor(a?.root, true);
607
620
  return { ...b, basis: (0, basis_1.basisDigest)(b) };
@@ -744,36 +757,67 @@ function makeRawHandlers(store, opts) {
744
757
  return HARNESS_NAMES[raw] ?? raw;
745
758
  };
746
759
  const attestation = () => {
760
+ // @implements A-SPEC-792.22 — a server with no attestation wired is not attested (it used to count as attested)
747
761
  try {
748
- return opts?.harnessAttestation?.() ?? { attested: true };
762
+ return opts?.harnessAttestation?.() ?? { attested: false, reason: 'no harness attestation is wired into this server' };
749
763
  }
750
764
  catch {
751
765
  return { attested: false, reason: 'the server could not tell who launched it' };
752
766
  }
753
767
  };
768
+ // @implements A-SPEC-792.21 — a harness whose form is not measured to wait for a person gets no form of any kind: under
769
+ // codex 0.164.0 the server's parent is the shared app-server daemon, so whichever daemon client answers decides (F1-e.0).
770
+ // @implements A-SPEC-792.23 — an allow-list: the client name and the attested harness must both be a harness whose form
771
+ // is measured to wait for a person (claude alone today); naming the ones to refuse let every other name through.
772
+ const MEASURED_FORM = new Set(['claude']);
773
+ const unmeasuredForm = () => {
774
+ const named = canonicalHarness();
775
+ if (!MEASURED_FORM.has(named))
776
+ return named;
777
+ const attested = attestation().harness;
778
+ return attested !== undefined && MEASURED_FORM.has(attested) ? null : (attested ?? 'unattested');
779
+ };
780
+ // @implements A-SPEC-792.22 — the one gate every in-session form passes: tryElicit, approval_ask and review_verdict.
781
+ // approval_ask asked an ELICITABLE_KINDS request on any client without it (F1-e.0b).
782
+ const formGate = () => {
783
+ if ((0, elicit_approval_1.elicitationDisabled)(process.env))
784
+ return 'this session cannot show an approval form (HOLMES_ELICIT is off)';
785
+ const at = attestation();
786
+ if (!at.attested)
787
+ return `this session cannot show an approval form (${at.reason ?? 'not launched by a harness'})`;
788
+ const form = unmeasuredForm();
789
+ return form === null ? null : `the ${form} form is not yet measured to wait for a person (A-SPEC-792.6)`;
790
+ };
754
791
  // @implements A-SPEC-732 (round 2) — no in-session route when the operator turned forms off or when
755
792
  // no harness launched this server: the queue is the only door.
756
- const approvalAdapter = () => ((0, elicit_approval_1.elicitationDisabled)(process.env) || !attestation().attested
793
+ // @implements A-SPEC-792.24 — and the host-gated continuation passes the same gate, for the attested harness: chosen by
794
+ // the self-claimed name, codex- and antigravity-attested sessions without a form sealed with no form call (F1-e.0c).
795
+ const attestedHarness = () => attestation().harness ?? 'unattested';
796
+ const approvalAdapter = () => (formGate() !== null
757
797
  ? (0, approval_adapters_1.selectApprovalAdapter)({ harness: 'unattested', formElicitation: false })
758
798
  : (0, approval_adapters_1.selectApprovalAdapter)({
759
- harness: canonicalHarness(),
799
+ harness: attestedHarness(),
760
800
  formElicitation: opts?.elicitationAvailable?.() ?? Boolean(opts?.elicit),
761
801
  }));
762
802
  const approvalWorkspace = (root) => projectRootOf(root ?? store.specsRoot);
763
803
  const prepareHostApproval = (input) => {
804
+ const gated = formGate(); // @implements A-SPEC-792.24
805
+ if (gated !== null)
806
+ throw new HandlerRefusal(`no host-gated continuation in this session: ${gated}`);
764
807
  // @implements A-SPEC-732 — `root` only resolves the workspace; it is not an intent field. Spreading
765
808
  // it in made a rootless call (the way harnesses call spec_approve) fail with "root is required".
766
809
  const intent = (0, approval_intent_1.createApprovalIntent)({
767
810
  kind: input.kind, target: input.target, subject: input.subject,
768
- workspace: approvalWorkspace(input.root), runId: approvalRunId, harness: canonicalHarness(),
811
+ workspace: approvalWorkspace(input.root), runId: approvalRunId, harness: attestedHarness(), // @implements A-SPEC-792.24
769
812
  });
770
813
  approvalContinuations.prepare(intent);
771
814
  return intent;
772
815
  };
773
- const consumeHostApproval = (input) => approvalContinuations.consumeForAction({
774
- kind: input.kind, target: input.target, subject: input.subject,
775
- workspace: approvalWorkspace(input.root), runId: approvalRunId,
776
- });
816
+ const consumeHostApproval = (input) => formGate() !== null ? undefined // @implements A-SPEC-792.24 — nothing is spent outside a gated session
817
+ : approvalContinuations.consumeForAction({
818
+ kind: input.kind, target: input.target, subject: input.subject,
819
+ workspace: approvalWorkspace(input.root), runId: approvalRunId,
820
+ });
777
821
  // @implements A-SPEC-100.2, A-SPEC-102.1, A-SPEC-111.1, A-SPEC-121.2, A-SPEC-121.3, A-SPEC-121.4, A-SPEC-128, A-SPEC-130, A-SPEC-131, A-SPEC-189, A-SPEC-233, A-SPEC-419, A-SPEC-433, A-SPEC-614
778
822
  // @implements A-SPEC-616, A-SPEC-100.2, A-SPEC-102.1, A-SPEC-121.2, A-SPEC-121.3, A-SPEC-128, A-SPEC-130, A-SPEC-189, A-SPEC-233, A-SPEC-419, A-SPEC-433, A-SPEC-534.5, A-SPEC-534.8, A-SPEC-578.4, A-SPEC-614
779
823
  const testExecution = (0, test_execution_1.createTestExecutionHandlers)({
@@ -864,10 +908,8 @@ function makeRawHandlers(store, opts) {
864
908
  // @implements A-SPEC-540.1 — operator opt-out: with HOLMES_ELICIT=off the server never shows the
865
909
  // in-client prompt, folding to the byte-identical `silent` (refuse+enqueue) path so claude/agy/
866
910
  // codex all converge on one out-of-band surface (holmes-kit approve). Unset ⇒ unchanged.
867
- if ((0, elicit_approval_1.elicitationDisabled)(process.env))
868
- return { kind: 'silent' };
869
- if (!attestation().attested)
870
- return { kind: 'silent' };
911
+ if (formGate() !== null)
912
+ return { kind: 'silent' }; // @implements A-SPEC-792.21, A-SPEC-792.22
871
913
  if (!opts?.elicit || !elicit_approval_1.ELICITABLE_KINDS.has(kind))
872
914
  return { kind: 'silent' };
873
915
  try {
@@ -893,6 +935,7 @@ function makeRawHandlers(store, opts) {
893
935
  elicit: opts?.elicit,
894
936
  clientName: () => opts?.clientName?.() ?? 'unknown',
895
937
  attestation,
938
+ formGate, // @implements A-SPEC-792.22
896
939
  env: () => process.env,
897
940
  serverInstance: () => opts?.serverInstance?.(), // @implements A-SPEC-779.7
898
941
  };
@@ -905,7 +948,7 @@ function makeRawHandlers(store, opts) {
905
948
  const elicitApproval = (reason) => {
906
949
  const chain = attestation().chain;
907
950
  return {
908
- actor: `elicitation:${opts?.clientName?.() ?? 'unknown'}`,
951
+ actor: (0, human_channel_1.humanChannelActor)('elicitation', attestedHarness()), // @implements A-SPEC-792.25 — the attested harness
909
952
  token: crypto.randomUUID(),
910
953
  // @implements A-SPEC-732 (round 2) — the attested launcher chain rides the audit line.
911
954
  rationale: `${reason ?? 'elicitation grant'}${chain && chain.length > 0 ? ` [launched by ${chain.join(' <- ')}]` : ''}`,
@@ -934,18 +977,19 @@ function makeRawHandlers(store, opts) {
934
977
  tryElicit,
935
978
  elicitApproval,
936
979
  resolveHandlerApproval: (root, approval, action, now) => resolveHandlerApproval(root, store, approval, action, now),
937
- refusalQueueHint: (root, request) => refusalQueueHint(root, store, request),
980
+ refusalQueueHint: (root, request) => refusalQueueHint(root, store, request, undefined, formGate()),
938
981
  });
939
982
  // @implements A-SPEC-622, A-SPEC-100.2, A-SPEC-128, A-SPEC-132, A-SPEC-133, A-SPEC-151, A-SPEC-188, A-SPEC-189, A-SPEC-244, A-SPEC-245
940
983
  const specApproval = (0, spec_approval_1.createSpecApprovalHandlers)({
941
984
  store, resolver, projectRootOf, cachedScan, tryElicit, elicitApproval, autonomousApproval,
942
985
  approvalAdapter,
943
- approvalHarness: canonicalHarness,
944
- approvalRouteNote: () => { const at = attestation(); return at.attested ? '' : `\n[in-session approval unavailable: ${at.reason ?? 'not launched by a harness'}]`; },
986
+ approvalHarness: attestedHarness, // @implements A-SPEC-792.24 — the recorded harness is the attested one
987
+ // @implements A-SPEC-792.21, A-SPEC-792.22, A-SPEC-792.24 — the note reads the gate instead of restating it
988
+ approvalRouteNote: () => { const gated = formGate(); return gated === null ? '' : `\n[in-session approval unavailable: ${gated}]`; },
945
989
  prepareHostApproval,
946
990
  consumeHostApproval,
947
991
  resolveHandlerApproval: (root, approval, action, now) => resolveHandlerApproval(root, store, approval, action, now),
948
- refusalQueueHint: (root, request) => refusalQueueHint(root, store, request, 'spec_approve'),
992
+ refusalQueueHint: (root, request) => refusalQueueHint(root, store, request, 'spec_approve', formGate()), // @implements A-SPEC-792.23
949
993
  foreignRootReason: (root) => foreignRootReason(store, root),
950
994
  ...(opts?.fullAutonomyHome ? { fullAutonomyHome: opts.fullAutonomyHome } : {}), // @implements A-SPEC-792.4
951
995
  });
@@ -997,7 +1041,8 @@ function makeRawHandlers(store, opts) {
997
1041
  store,
998
1042
  resolveLedgerRoot,
999
1043
  resolveHandlerApproval: (root, approval, action, now) => resolveHandlerApproval(root, store, approval, action, now),
1000
- refusalQueueHint: (root, request) => refusalQueueHint(root, store, request),
1044
+ refusalQueueHint: (root, request) => refusalQueueHint(root, store, request, undefined, formGate()),
1045
+ ...(opts?.fullAutonomyHome ? { fullAutonomyHome: opts.fullAutonomyHome } : {}), // @implements A-SPEC-222.5
1001
1046
  });
1002
1047
  const operatorInspection = (0, operator_inspection_1.createOperatorInspectionHandlers)({
1003
1048
  listSpecs: () => store.list(),
@@ -1009,7 +1054,7 @@ function makeRawHandlers(store, opts) {
1009
1054
  fetchJson,
1010
1055
  cachedScan, // @implements A-SPEC-663
1011
1056
  resolveHandlerApproval: (root, approval, action, now) => resolveHandlerApproval(root, store, approval, action, now),
1012
- refusalQueueHint: (root, request) => refusalQueueHint(root, store, request),
1057
+ refusalQueueHint: (root, request) => refusalQueueHint(root, store, request, undefined, formGate()),
1013
1058
  });
1014
1059
  // @implements A-SPEC-189, A-SPEC-100.2 — shared store/root capabilities retain phase contracts.
1015
1060
  const phaseQueries = (0, phase_queries_1.createPhaseQueryHandlers)({
@@ -1063,6 +1108,8 @@ function makeRawHandlers(store, opts) {
1063
1108
  : undefined,
1064
1109
  });
1065
1110
  return {
1111
+ // @implements A-SPEC-792.26 — reachable in process, never on the wire (a symbol is no tool name)
1112
+ [exports.HOST_APPROVAL_PROBE]: { prepareHostApproval },
1066
1113
  spec_create: specAuthoring.spec_create,
1067
1114
  spec_validate: specQueries.spec_validate,
1068
1115
  spec_upgrade: specAuthoring.spec_upgrade,
@@ -1,3 +1,4 @@
1
+ import * as fs from 'node:fs';
1
2
  import { spawnSync } from 'node:child_process';
2
3
  /** `image` is the real executable (symlinks resolved); absent when it could not be read. */
3
4
  export interface ProcRow {
@@ -5,8 +6,12 @@ export interface ProcRow {
5
6
  ppid: number;
6
7
  args: string;
7
8
  image?: string;
8
- /** The executable path on its own (`ps -o comm=`, Windows ExecutablePath) — unambiguous where args are not. */
9
+ /** The executable as `ps -o comm=` or Windows ExecutablePath gives it, read apart from the args. A-SPEC-732.12 — on
10
+ * macOS comm is argv[0], which the launcher chooses, so it is no independent executable path there (lsof's image is).
11
+ * A-SPEC-732.13 — on Linux it is the task name, which the process can set (PR_SET_NAME). */
9
12
  exe?: string;
13
+ /** A-SPEC-792.19 — why `image` is absent (lsof's failure), carried into the refusal. */
14
+ imageError?: string;
10
15
  /** A-SPEC-779.6 — creation time in ms, where the platform gives it (Windows CreationDate). */
11
16
  created?: number;
12
17
  }
@@ -19,8 +24,37 @@ export interface HarnessAttestation {
19
24
  harness?: string;
20
25
  reason?: string;
21
26
  }
22
- /** Exported for A-SPEC-102.8 (review independence walks the same names). */
23
- export declare function harnessOf(args: string, exe?: string): string | null;
27
+ /**
28
+ * @implements A-SPEC-732.2 — how a process may be claude through a version path; every caller names one. `layout`: the
29
+ * path may be anywhere (the operator and review-independence direction, where a false match only refuses more).
30
+ * `installed`: directly inside an install directory, by realpath (the attestation direction).
31
+ */
32
+ export type InstalledRule = {
33
+ kind: 'installed';
34
+ installDirs: readonly string[];
35
+ platform: NodeJS.Platform;
36
+ realpath?: (p: string) => string;
37
+ };
38
+ export type HarnessRule = {
39
+ kind: 'layout';
40
+ } | InstalledRule;
41
+ export declare const LAYOUT_RULE: HarnessRule;
42
+ /**
43
+ * @implements A-SPEC-732.1 — the directories a native Claude install keeps its versions in: `$XDG_DATA_HOME/claude/versions`
44
+ * when XDG_DATA_HOME is absolute, and `<home>/.local/share/claude/versions` (on Windows under the profile). `home` is an
45
+ * argument, so nothing here reads the process's own home.
46
+ */
47
+ export declare function nativeInstallDirs(env: NodeJS.ProcessEnv, home: string, platform?: NodeJS.Platform): string[];
48
+ /** The executable names only: argv0's, then exe's. */
49
+ export declare function harnessByName(args: string, exe?: string): string | null;
50
+ /** Exported for A-SPEC-102.8 (review independence walks the same names, under its own rule). */
51
+ export declare function harnessOf(args: string, exe: string | undefined, rule: HarnessRule): string | null;
52
+ /** @implements A-SPEC-732.3 (L-d) — `rule`, when given, is used as is, so the lookup's directories and these are one value. */
53
+ /** @implements A-SPEC-732.6 — the walk's rule is given: it builds no default install rule of its own (a path only tests used). */
54
+ export interface AttestOptions {
55
+ rule: InstalledRule;
56
+ statImage?: (p: string) => fs.Stats;
57
+ }
24
58
  /**
25
59
  * @implements A-SPEC-751.3 — is `script` one of the operator runtime registry's own MCP dispatcher files, unchanged
26
60
  * since its installation receipt. Measured 2026-10-04: A-SPEC-751 starts the server through
@@ -31,7 +65,34 @@ export declare function harnessOf(args: string, exe?: string): string | null;
31
65
  */
32
66
  export declare function dispatcherVerifier(registryPath: string): (script: string) => boolean;
33
67
  /** Walk up from `pid` (the server's parent) through launchers to a harness executable. */
34
- export declare function attestHarness(pid: number, lookup: ProcLookup, maxDepth?: number, isDispatcher?: (script: string) => boolean): HarnessAttestation;
68
+ export declare function attestHarness(pid: number, lookup: ProcLookup, maxDepth: number, isDispatcher: ((script: string) => boolean) | undefined, options: AttestOptions): HarnessAttestation;
69
+ /**
70
+ * @implements A-SPEC-732.3 (L-d, 19:16) — the live attestation the server runs: one InstalledRule, handed to the process
71
+ * lookup and the walk alike, its platform read from the rule only. The server called the two with separate defaults,
72
+ * equal today by accident. `deps` is for tests: the lookup maker and the stat.
73
+ */
74
+ export declare function liveAttestation(pid: number, isDispatcher: (script: string) => boolean, deps: {
75
+ rule: InstalledRule;
76
+ lookupOf?: typeof systemProcLookup;
77
+ statImage?: (p: string) => fs.Stats;
78
+ }): HarnessAttestation;
79
+ /**
80
+ * @implements A-SPEC-732.4 — the server's live attestation, in the one entry its tests reach: the install directories
81
+ * from `env` and `home`, the runtime registry's dispatcher under `home`, and the walk of `liveAttestation`. `server.ts`
82
+ * builds nothing else; home and env are arguments, so a test gives them (jest's process.env never reaches os.homedir()).
83
+ */
84
+ export declare function serverAttestation(ppid: number, ctx: {
85
+ env: NodeJS.ProcessEnv;
86
+ home: string;
87
+ platform?: NodeJS.Platform;
88
+ lookupOf?: typeof systemProcLookup;
89
+ statImage?: (p: string) => fs.Stats;
90
+ }): HarnessAttestation;
91
+ /**
92
+ * @implements A-SPEC-732.5 — the operator walk's process lookup, given the walk's own layout rule. verdicts.ts built it
93
+ * with `spawnSync` itself; every live lookup is now assembled here.
94
+ */
95
+ export declare function operatorLookup(make?: typeof systemProcLookup): ProcLookup;
35
96
  /**
36
97
  * The live process table: `ps` on POSIX, CIM through PowerShell on Windows. Null when unreadable.
37
98
  * @implements A-SPEC-779.6 — on Windows, PROC_GONE when the query answered with no row. Windows keeps an exited
@@ -40,4 +101,16 @@ export declare function attestHarness(pid: number, lookup: ProcLookup, maxDepth?
40
101
  * print GONE; only status 0 without a spawn error is believed. POSIX reparents an orphan to pid 1 and is unchanged.
41
102
  * `spawn` is injectable so the Windows branch is tested on every OS.
42
103
  */
43
- export declare function systemProcLookup(platform?: NodeJS.Platform, spawn?: typeof spawnSync): ProcLookup;
104
+ export declare function systemProcLookup(platform: NodeJS.Platform, spawn: typeof spawnSync, rule: HarnessRule): ProcLookup;
105
+ /**
106
+ * The real executable of `pid`: Linux `/proc/<pid>/exe`, macOS the `txt` descriptor from lsof, or why it could not be read.
107
+ * @implements A-SPEC-792.17 — lsof by absolute path: a server whose PATH lacks /usr/sbin found no lsof (measured).
108
+ * @implements A-SPEC-792.19 — lsof alone. `ps -o comm=` is argv[0] on macOS, chosen by the launcher, so standing it in
109
+ * for the image let `exec -a …/bin/claude /bin/sleep` attest whenever lsof gave no line (review 18:26, F2.1-a).
110
+ */
111
+ export declare function imageRead(pid: number, platform: NodeJS.Platform, env?: NodeJS.ProcessEnv, spawn?: typeof spawnSync): {
112
+ image: string;
113
+ } | {
114
+ reason: string;
115
+ };
116
+ export declare function imageOf(pid: number, platform: NodeJS.Platform, env?: NodeJS.ProcessEnv): string | undefined;