@lannguyensi/harness 0.64.0 → 1.0.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 (710) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/README.md +46 -42
  3. package/dist/cli/add/index.js +17 -21
  4. package/dist/cli/add/index.js.map +1 -1
  5. package/dist/cli/adopt/derive.d.ts +2 -2
  6. package/dist/cli/adopt/derive.js +2 -19
  7. package/dist/cli/adopt/derive.js.map +1 -1
  8. package/dist/cli/adopt/index.d.ts +1 -1
  9. package/dist/cli/adopt/index.js +1 -12
  10. package/dist/cli/adopt/index.js.map +1 -1
  11. package/dist/cli/apply/apply.d.ts +20 -35
  12. package/dist/cli/apply/apply.js +61 -136
  13. package/dist/cli/apply/apply.js.map +1 -1
  14. package/dist/cli/apply/generate-codex-config.js +10 -58
  15. package/dist/cli/apply/generate-codex-config.js.map +1 -1
  16. package/dist/cli/apply/generate-memory-index.js +1 -2
  17. package/dist/cli/apply/generate-memory-index.js.map +1 -1
  18. package/dist/cli/apply/generate-opencode-config.d.ts +2 -10
  19. package/dist/cli/apply/generate-opencode-config.js +74 -113
  20. package/dist/cli/apply/generate-opencode-config.js.map +1 -1
  21. package/dist/cli/apply/generate-settings.d.ts +11 -64
  22. package/dist/cli/apply/generate-settings.js +27 -132
  23. package/dist/cli/apply/generate-settings.js.map +1 -1
  24. package/dist/cli/apply/index.d.ts +1 -1
  25. package/dist/cli/apply/index.js +1 -1
  26. package/dist/cli/apply/index.js.map +1 -1
  27. package/dist/cli/apply/install-codex-config.d.ts +153 -1
  28. package/dist/cli/apply/install-codex-config.js +445 -70
  29. package/dist/cli/apply/install-codex-config.js.map +1 -1
  30. package/dist/cli/apply/next-steps.d.ts +7 -0
  31. package/dist/cli/apply/next-steps.js +13 -1
  32. package/dist/cli/apply/next-steps.js.map +1 -1
  33. package/dist/cli/bounded-stdin.d.ts +0 -23
  34. package/dist/cli/bounded-stdin.js +2 -49
  35. package/dist/cli/bounded-stdin.js.map +1 -1
  36. package/dist/cli/describe.d.ts +1 -1
  37. package/dist/cli/describe.js +0 -3
  38. package/dist/cli/describe.js.map +1 -1
  39. package/dist/cli/diff/engine.d.ts +0 -11
  40. package/dist/cli/diff/engine.js +1 -17
  41. package/dist/cli/diff/engine.js.map +1 -1
  42. package/dist/cli/diff/index.js +14 -25
  43. package/dist/cli/diff/index.js.map +1 -1
  44. package/dist/cli/doctor/claude-mcp.d.ts +4 -19
  45. package/dist/cli/doctor/claude-mcp.js +11 -22
  46. package/dist/cli/doctor/claude-mcp.js.map +1 -1
  47. package/dist/cli/doctor/codex.d.ts +12 -14
  48. package/dist/cli/doctor/codex.js +31 -144
  49. package/dist/cli/doctor/codex.js.map +1 -1
  50. package/dist/cli/doctor/format.js +23 -345
  51. package/dist/cli/doctor/format.js.map +1 -1
  52. package/dist/cli/doctor/hook-liveness.d.ts +56 -0
  53. package/dist/cli/doctor/hook-liveness.js +455 -0
  54. package/dist/cli/doctor/hook-liveness.js.map +1 -0
  55. package/dist/cli/doctor/index.d.ts +13 -87
  56. package/dist/cli/doctor/index.js +57 -713
  57. package/dist/cli/doctor/index.js.map +1 -1
  58. package/dist/cli/doctor/opencode.d.ts +2 -1
  59. package/dist/cli/doctor/opencode.js.map +1 -1
  60. package/dist/cli/doctor/types.d.ts +21 -387
  61. package/dist/cli/doctor/types.js.map +1 -1
  62. package/dist/cli/drain-stdio.d.ts +31 -0
  63. package/dist/cli/drain-stdio.js +76 -0
  64. package/dist/cli/drain-stdio.js.map +1 -0
  65. package/dist/cli/export.d.ts +3 -1
  66. package/dist/cli/export.js +7 -16
  67. package/dist/cli/export.js.map +1 -1
  68. package/dist/cli/gate/codex-disable.d.ts +29 -0
  69. package/dist/cli/gate/codex-disable.js +195 -0
  70. package/dist/cli/gate/codex-disable.js.map +1 -0
  71. package/dist/cli/gate/codex-enable.d.ts +41 -0
  72. package/dist/cli/gate/codex-enable.js +127 -0
  73. package/dist/cli/gate/codex-enable.js.map +1 -0
  74. package/dist/cli/gate/codex-snapshot.d.ts +208 -0
  75. package/dist/cli/gate/codex-snapshot.js +402 -0
  76. package/dist/cli/gate/codex-snapshot.js.map +1 -0
  77. package/dist/cli/gate/disable.d.ts +9 -0
  78. package/dist/cli/gate/disable.js +263 -28
  79. package/dist/cli/gate/disable.js.map +1 -1
  80. package/dist/cli/gate/enable.d.ts +26 -6
  81. package/dist/cli/gate/enable.js +152 -80
  82. package/dist/cli/gate/enable.js.map +1 -1
  83. package/dist/cli/gate/link-chain.d.ts +53 -0
  84. package/dist/cli/gate/link-chain.js +122 -0
  85. package/dist/cli/gate/link-chain.js.map +1 -0
  86. package/dist/cli/gate/snapshot.d.ts +289 -12
  87. package/dist/cli/gate/snapshot.js +481 -22
  88. package/dist/cli/gate/snapshot.js.map +1 -1
  89. package/dist/cli/index.d.ts +0 -9
  90. package/dist/cli/index.js +9 -2131
  91. package/dist/cli/index.js.map +1 -1
  92. package/dist/cli/init/composer.d.ts +3 -6
  93. package/dist/cli/init/composer.js +6 -370
  94. package/dist/cli/init/composer.js.map +1 -1
  95. package/dist/cli/init/dependencies.d.ts +1 -2
  96. package/dist/cli/init/dependencies.js +4 -80
  97. package/dist/cli/init/dependencies.js.map +1 -1
  98. package/dist/cli/init/detect.js +5 -4
  99. package/dist/cli/init/detect.js.map +1 -1
  100. package/dist/cli/init/interactive.d.ts +1 -23
  101. package/dist/cli/init/interactive.js +33 -247
  102. package/dist/cli/init/interactive.js.map +1 -1
  103. package/dist/cli/init/profiles.d.ts +2 -2
  104. package/dist/cli/init/profiles.js +51 -245
  105. package/dist/cli/init/profiles.js.map +1 -1
  106. package/dist/cli/init/templates.d.ts +2 -37
  107. package/dist/cli/init/templates.js +25 -1237
  108. package/dist/cli/init/templates.js.map +1 -1
  109. package/dist/cli/list.d.ts +1 -1
  110. package/dist/cli/list.js +1 -38
  111. package/dist/cli/list.js.map +1 -1
  112. package/dist/cli/loader.d.ts +15 -1
  113. package/dist/cli/loader.js +56 -39
  114. package/dist/cli/loader.js.map +1 -1
  115. package/dist/cli/main.js +7 -2
  116. package/dist/cli/main.js.map +1 -1
  117. package/dist/cli/migrate-home/index.js +2 -2
  118. package/dist/cli/migrate-home/index.js.map +1 -1
  119. package/dist/cli/pack/add.js +1 -1
  120. package/dist/cli/pack/add.js.map +1 -1
  121. package/dist/cli/pack/hook-bootstrap.d.ts +5 -164
  122. package/dist/cli/pack/hook-bootstrap.js +15 -291
  123. package/dist/cli/pack/hook-bootstrap.js.map +1 -1
  124. package/dist/cli/pack/hook-branch-protection.d.ts +28 -21
  125. package/dist/cli/pack/hook-branch-protection.js +365 -340
  126. package/dist/cli/pack/hook-branch-protection.js.map +1 -1
  127. package/dist/cli/pack/index.d.ts +0 -1
  128. package/dist/cli/pack/index.js +0 -1
  129. package/dist/cli/pack/index.js.map +1 -1
  130. package/dist/cli/pack/list.js +1 -6
  131. package/dist/cli/pack/list.js.map +1 -1
  132. package/dist/cli/pack/mutate.d.ts +7 -9
  133. package/dist/cli/pack/mutate.js +6 -9
  134. package/dist/cli/pack/mutate.js.map +1 -1
  135. package/dist/cli/pack/reseed.d.ts +2 -2
  136. package/dist/cli/pack/reseed.js +16 -22
  137. package/dist/cli/pack/reseed.js.map +1 -1
  138. package/dist/cli/{delegate/register.d.ts → register-gate-group.d.ts} +1 -1
  139. package/dist/cli/register-gate-group.js +348 -0
  140. package/dist/cli/register-gate-group.js.map +1 -0
  141. package/dist/cli/register-inspect-group.d.ts +6 -0
  142. package/dist/cli/register-inspect-group.js +189 -0
  143. package/dist/cli/register-inspect-group.js.map +1 -0
  144. package/dist/cli/register-operator-lifecycle.d.ts +1 -1
  145. package/dist/cli/register-operator-lifecycle.js +3 -100
  146. package/dist/cli/register-operator-lifecycle.js.map +1 -1
  147. package/dist/cli/register-pack-group.d.ts +5 -0
  148. package/dist/cli/register-pack-group.js +134 -0
  149. package/dist/cli/register-pack-group.js.map +1 -0
  150. package/dist/cli/{register-audit-group.d.ts → register-setup-group.d.ts} +1 -1
  151. package/dist/cli/register-setup-group.js +495 -0
  152. package/dist/cli/register-setup-group.js.map +1 -0
  153. package/dist/cli/remove/index.d.ts +0 -14
  154. package/dist/cli/remove/index.js +2 -115
  155. package/dist/cli/remove/index.js.map +1 -1
  156. package/dist/cli/remove/mutate.d.ts +0 -2
  157. package/dist/cli/remove/mutate.js +1 -19
  158. package/dist/cli/remove/mutate.js.map +1 -1
  159. package/dist/cli/remove/register.js +2 -19
  160. package/dist/cli/remove/register.js.map +1 -1
  161. package/dist/cli/shell-quote.d.ts +7 -0
  162. package/dist/cli/shell-quote.js +17 -0
  163. package/dist/cli/shell-quote.js.map +1 -0
  164. package/dist/cli/uninstall/index.d.ts +4 -2
  165. package/dist/cli/uninstall/index.js +15 -7
  166. package/dist/cli/uninstall/index.js.map +1 -1
  167. package/dist/cli/uninstall/register.js +6 -4
  168. package/dist/cli/uninstall/register.js.map +1 -1
  169. package/dist/cli/uninstall/snapshot.d.ts +15 -0
  170. package/dist/cli/uninstall/snapshot.js +38 -0
  171. package/dist/cli/uninstall/snapshot.js.map +1 -1
  172. package/dist/cli/validate/checks.d.ts +0 -77
  173. package/dist/cli/validate/checks.js +3 -1049
  174. package/dist/cli/validate/checks.js.map +1 -1
  175. package/dist/cli/validate/index.js +19 -15
  176. package/dist/cli/validate/index.js.map +1 -1
  177. package/dist/index.d.ts +0 -3
  178. package/dist/index.js +0 -3
  179. package/dist/index.js.map +1 -1
  180. package/dist/io/claude-mcp.d.ts +1 -1
  181. package/dist/io/claude-mcp.js +27 -14
  182. package/dist/io/claude-mcp.js.map +1 -1
  183. package/dist/io/harness-lock.js +2 -2
  184. package/dist/io/harness-lock.js.map +1 -1
  185. package/dist/io/lock.d.ts +0 -26
  186. package/dist/io/lock.js +10 -27
  187. package/dist/io/lock.js.map +1 -1
  188. package/dist/io/merge-settings.js +6 -4
  189. package/dist/io/merge-settings.js.map +1 -1
  190. package/dist/io/project-name.d.ts +22 -39
  191. package/dist/io/project-name.js +25 -42
  192. package/dist/io/project-name.js.map +1 -1
  193. package/dist/io/read-regular-file.d.ts +103 -40
  194. package/dist/io/read-regular-file.js +196 -35
  195. package/dist/io/read-regular-file.js.map +1 -1
  196. package/dist/io/restart-hints.js +3 -6
  197. package/dist/io/restart-hints.js.map +1 -1
  198. package/dist/io/version-compare.d.ts +1 -3
  199. package/dist/io/version-compare.js +1 -3
  200. package/dist/io/version-compare.js.map +1 -1
  201. package/dist/io/write-regular-file.d.ts +30 -0
  202. package/dist/io/write-regular-file.js +85 -0
  203. package/dist/io/write-regular-file.js.map +1 -0
  204. package/dist/overrides/index.d.ts +1 -0
  205. package/dist/overrides/index.js +1 -0
  206. package/dist/overrides/index.js.map +1 -1
  207. package/dist/overrides/merge-layers.d.ts +43 -0
  208. package/dist/overrides/merge-layers.js +76 -0
  209. package/dist/overrides/merge-layers.js.map +1 -0
  210. package/dist/overrides/merge.d.ts +16 -0
  211. package/dist/overrides/merge.js +21 -8
  212. package/dist/overrides/merge.js.map +1 -1
  213. package/dist/policy-packs/builtin/branch-protection-runtime.d.ts +4 -69
  214. package/dist/policy-packs/builtin/branch-protection-runtime.js +12 -84
  215. package/dist/policy-packs/builtin/branch-protection-runtime.js.map +1 -1
  216. package/dist/policy-packs/builtin/branch-protection.d.ts +7 -30
  217. package/dist/policy-packs/builtin/branch-protection.js +56 -89
  218. package/dist/policy-packs/builtin/branch-protection.js.map +1 -1
  219. package/dist/policy-packs/config-check.d.ts +7 -5
  220. package/dist/policy-packs/config-check.js +2 -2
  221. package/dist/policy-packs/config-check.js.map +1 -1
  222. package/dist/policy-packs/expand.d.ts +1 -3
  223. package/dist/policy-packs/expand.js +5 -42
  224. package/dist/policy-packs/expand.js.map +1 -1
  225. package/dist/policy-packs/index.d.ts +3 -3
  226. package/dist/policy-packs/index.js +2 -2
  227. package/dist/policy-packs/index.js.map +1 -1
  228. package/dist/policy-packs/registry.d.ts +9 -38
  229. package/dist/policy-packs/registry.js +5 -65
  230. package/dist/policy-packs/registry.js.map +1 -1
  231. package/dist/policy-packs/runtime.d.ts +0 -4
  232. package/dist/policy-packs/runtime.js +9 -22
  233. package/dist/policy-packs/runtime.js.map +1 -1
  234. package/dist/policy-packs/types.d.ts +0 -19
  235. package/dist/policy-packs/ux-compare.d.ts +1 -11
  236. package/dist/policy-packs/ux-compare.js +6 -42
  237. package/dist/policy-packs/ux-compare.js.map +1 -1
  238. package/dist/policy-packs/ux-drift-check.d.ts +5 -5
  239. package/dist/policy-packs/ux-drift-check.js +17 -22
  240. package/dist/policy-packs/ux-drift-check.js.map +1 -1
  241. package/dist/policy-packs/version-check.d.ts +5 -26
  242. package/dist/policy-packs/version-check.js +19 -74
  243. package/dist/policy-packs/version-check.js.map +1 -1
  244. package/dist/probes/memory.d.ts +1 -1
  245. package/dist/probes/memory.js +1 -1
  246. package/dist/probes/memory.js.map +1 -1
  247. package/dist/runtime/agent-facing.d.ts +9 -0
  248. package/dist/runtime/agent-facing.js +28 -14
  249. package/dist/runtime/agent-facing.js.map +1 -1
  250. package/dist/runtime/bounded-text.d.ts +15 -0
  251. package/dist/runtime/bounded-text.js +27 -0
  252. package/dist/runtime/bounded-text.js.map +1 -0
  253. package/dist/runtime/git-branch.d.ts +125 -0
  254. package/dist/runtime/git-branch.js +381 -0
  255. package/dist/runtime/git-branch.js.map +1 -0
  256. package/dist/runtime/hermetic-spawn-guard.d.ts +2 -2
  257. package/dist/runtime/hermetic-spawn-guard.js +24 -34
  258. package/dist/runtime/hermetic-spawn-guard.js.map +1 -1
  259. package/dist/runtime/home-dir.js +3 -2
  260. package/dist/runtime/home-dir.js.map +1 -1
  261. package/dist/runtime/tool-name-aliases.d.ts +0 -6
  262. package/dist/runtime/tool-name-aliases.js +5 -18
  263. package/dist/runtime/tool-name-aliases.js.map +1 -1
  264. package/dist/schema/grounding.d.ts +7 -54
  265. package/dist/schema/grounding.js +10 -12
  266. package/dist/schema/grounding.js.map +1 -1
  267. package/dist/schema/hooks.d.ts +39 -136
  268. package/dist/schema/hooks.js +3 -6
  269. package/dist/schema/hooks.js.map +1 -1
  270. package/dist/schema/index.d.ts +114 -3828
  271. package/dist/schema/index.js +41 -80
  272. package/dist/schema/index.js.map +1 -1
  273. package/dist/schema/memory.d.ts +54 -131
  274. package/dist/schema/memory.js +2 -2
  275. package/dist/schema/memory.js.map +1 -1
  276. package/dist/schema/policy-packs.d.ts +3 -45
  277. package/dist/schema/policy-packs.js +7 -13
  278. package/dist/schema/policy-packs.js.map +1 -1
  279. package/dist/schema/policy-ux.d.ts +7 -0
  280. package/dist/schema/policy-ux.js +18 -0
  281. package/dist/schema/policy-ux.js.map +1 -0
  282. package/dist/schema/removed-keys.d.ts +185 -0
  283. package/dist/schema/removed-keys.js +531 -0
  284. package/dist/schema/removed-keys.js.map +1 -0
  285. package/dist/schema/tools.d.ts +30 -268
  286. package/dist/schema/tools.js +4 -4
  287. package/dist/schema/tools.js.map +1 -1
  288. package/package.json +5 -16
  289. package/dist/cli/approve/branch-protection.d.ts +0 -69
  290. package/dist/cli/approve/branch-protection.js +0 -144
  291. package/dist/cli/approve/branch-protection.js.map +0 -1
  292. package/dist/cli/approve/risk.d.ts +0 -112
  293. package/dist/cli/approve/risk.js +0 -197
  294. package/dist/cli/approve/risk.js.map +0 -1
  295. package/dist/cli/approve/stdin-report.d.ts +0 -57
  296. package/dist/cli/approve/stdin-report.js +0 -145
  297. package/dist/cli/approve/stdin-report.js.map +0 -1
  298. package/dist/cli/approve/understanding.d.ts +0 -410
  299. package/dist/cli/approve/understanding.js +0 -996
  300. package/dist/cli/approve/understanding.js.map +0 -1
  301. package/dist/cli/audit.d.ts +0 -80
  302. package/dist/cli/audit.js +0 -252
  303. package/dist/cli/audit.js.map +0 -1
  304. package/dist/cli/delegate/index.d.ts +0 -76
  305. package/dist/cli/delegate/index.js +0 -444
  306. package/dist/cli/delegate/index.js.map +0 -1
  307. package/dist/cli/delegate/register.js +0 -90
  308. package/dist/cli/delegate/register.js.map +0 -1
  309. package/dist/cli/doctor/auto-approve-mode.d.ts +0 -37
  310. package/dist/cli/doctor/auto-approve-mode.js +0 -80
  311. package/dist/cli/doctor/auto-approve-mode.js.map +0 -1
  312. package/dist/cli/doctor/bypass-without-auto-approve.d.ts +0 -38
  313. package/dist/cli/doctor/bypass-without-auto-approve.js +0 -95
  314. package/dist/cli/doctor/bypass-without-auto-approve.js.map +0 -1
  315. package/dist/cli/doctor/codex-config-drift.d.ts +0 -28
  316. package/dist/cli/doctor/codex-config-drift.js +0 -240
  317. package/dist/cli/doctor/codex-config-drift.js.map +0 -1
  318. package/dist/cli/doctor/expire-on-tool-match.d.ts +0 -15
  319. package/dist/cli/doctor/expire-on-tool-match.js +0 -58
  320. package/dist/cli/doctor/expire-on-tool-match.js.map +0 -1
  321. package/dist/cli/doctor/rogue-ledger.d.ts +0 -53
  322. package/dist/cli/doctor/rogue-ledger.js +0 -153
  323. package/dist/cli/doctor/rogue-ledger.js.map +0 -1
  324. package/dist/cli/doctor/session-start-preflight-setup-version.d.ts +0 -83
  325. package/dist/cli/doctor/session-start-preflight-setup-version.js +0 -114
  326. package/dist/cli/doctor/session-start-preflight-setup-version.js.map +0 -1
  327. package/dist/cli/doctor/settings-drift.d.ts +0 -25
  328. package/dist/cli/doctor/settings-drift.js +0 -213
  329. package/dist/cli/doctor/settings-drift.js.map +0 -1
  330. package/dist/cli/doctor/toolchain-parity.d.ts +0 -63
  331. package/dist/cli/doctor/toolchain-parity.js +0 -154
  332. package/dist/cli/doctor/toolchain-parity.js.map +0 -1
  333. package/dist/cli/doctor/ug-auto-approvals.d.ts +0 -40
  334. package/dist/cli/doctor/ug-auto-approvals.js +0 -91
  335. package/dist/cli/doctor/ug-auto-approvals.js.map +0 -1
  336. package/dist/cli/doctor/ug-delegations.d.ts +0 -26
  337. package/dist/cli/doctor/ug-delegations.js +0 -121
  338. package/dist/cli/doctor/ug-delegations.js.map +0 -1
  339. package/dist/cli/doctor/ug-inflight.d.ts +0 -35
  340. package/dist/cli/doctor/ug-inflight.js +0 -57
  341. package/dist/cli/doctor/ug-inflight.js.map +0 -1
  342. package/dist/cli/doctor/understanding-mode-env.d.ts +0 -51
  343. package/dist/cli/doctor/understanding-mode-env.js +0 -98
  344. package/dist/cli/doctor/understanding-mode-env.js.map +0 -1
  345. package/dist/cli/dry-run.d.ts +0 -58
  346. package/dist/cli/dry-run.js +0 -283
  347. package/dist/cli/dry-run.js.map +0 -1
  348. package/dist/cli/enriched-event.d.ts +0 -35
  349. package/dist/cli/enriched-event.js +0 -60
  350. package/dist/cli/enriched-event.js.map +0 -1
  351. package/dist/cli/event-input.d.ts +0 -28
  352. package/dist/cli/event-input.js +0 -73
  353. package/dist/cli/event-input.js.map +0 -1
  354. package/dist/cli/explain-action.d.ts +0 -25
  355. package/dist/cli/explain-action.js +0 -57
  356. package/dist/cli/explain-action.js.map +0 -1
  357. package/dist/cli/explain-policy.d.ts +0 -147
  358. package/dist/cli/explain-policy.js +0 -248
  359. package/dist/cli/explain-policy.js.map +0 -1
  360. package/dist/cli/explain.d.ts +0 -31
  361. package/dist/cli/explain.js +0 -159
  362. package/dist/cli/explain.js.map +0 -1
  363. package/dist/cli/gc/index.d.ts +0 -63
  364. package/dist/cli/gc/index.js +0 -566
  365. package/dist/cli/gc/index.js.map +0 -1
  366. package/dist/cli/pack/approve-escape.d.ts +0 -19
  367. package/dist/cli/pack/approve-escape.js +0 -190
  368. package/dist/cli/pack/approve-escape.js.map +0 -1
  369. package/dist/cli/pack/auto-approve-path.d.ts +0 -146
  370. package/dist/cli/pack/auto-approve-path.js +0 -462
  371. package/dist/cli/pack/auto-approve-path.js.map +0 -1
  372. package/dist/cli/pack/hook-codex-post-tool-use.d.ts +0 -25
  373. package/dist/cli/pack/hook-codex-post-tool-use.js +0 -160
  374. package/dist/cli/pack/hook-codex-post-tool-use.js.map +0 -1
  375. package/dist/cli/pack/hook-codex-pre-tool-use.d.ts +0 -48
  376. package/dist/cli/pack/hook-codex-pre-tool-use.js +0 -474
  377. package/dist/cli/pack/hook-codex-pre-tool-use.js.map +0 -1
  378. package/dist/cli/pack/hook-codex-stop.d.ts +0 -35
  379. package/dist/cli/pack/hook-codex-stop.js +0 -329
  380. package/dist/cli/pack/hook-codex-stop.js.map +0 -1
  381. package/dist/cli/pack/hook-codex-user-prompt-submit.d.ts +0 -24
  382. package/dist/cli/pack/hook-codex-user-prompt-submit.js +0 -93
  383. package/dist/cli/pack/hook-codex-user-prompt-submit.js.map +0 -1
  384. package/dist/cli/pack/hook-post-merge-gate-record.d.ts +0 -37
  385. package/dist/cli/pack/hook-post-merge-gate-record.js +0 -190
  386. package/dist/cli/pack/hook-post-merge-gate-record.js.map +0 -1
  387. package/dist/cli/pack/hook-post-merge-gate.d.ts +0 -34
  388. package/dist/cli/pack/hook-post-merge-gate.js +0 -277
  389. package/dist/cli/pack/hook-post-merge-gate.js.map +0 -1
  390. package/dist/cli/pack/hook-post-tool-use.d.ts +0 -45
  391. package/dist/cli/pack/hook-post-tool-use.js +0 -137
  392. package/dist/cli/pack/hook-post-tool-use.js.map +0 -1
  393. package/dist/cli/pack/hook-pre-tool-use.d.ts +0 -92
  394. package/dist/cli/pack/hook-pre-tool-use.js +0 -1328
  395. package/dist/cli/pack/hook-pre-tool-use.js.map +0 -1
  396. package/dist/cli/pack/hook-runtime-reality.d.ts +0 -63
  397. package/dist/cli/pack/hook-runtime-reality.js +0 -210
  398. package/dist/cli/pack/hook-runtime-reality.js.map +0 -1
  399. package/dist/cli/pack/hook-solution-acceptance-writeguard.d.ts +0 -32
  400. package/dist/cli/pack/hook-solution-acceptance-writeguard.js +0 -438
  401. package/dist/cli/pack/hook-solution-acceptance-writeguard.js.map +0 -1
  402. package/dist/cli/pack/hook-solution-acceptance.d.ts +0 -157
  403. package/dist/cli/pack/hook-solution-acceptance.js +0 -530
  404. package/dist/cli/pack/hook-solution-acceptance.js.map +0 -1
  405. package/dist/cli/pack/hook-stay-in-scope.d.ts +0 -37
  406. package/dist/cli/pack/hook-stay-in-scope.js +0 -128
  407. package/dist/cli/pack/hook-stay-in-scope.js.map +0 -1
  408. package/dist/cli/pack/hook-subagent-start.d.ts +0 -23
  409. package/dist/cli/pack/hook-subagent-start.js +0 -88
  410. package/dist/cli/pack/hook-subagent-start.js.map +0 -1
  411. package/dist/cli/pack/hook-subagent-stop.d.ts +0 -19
  412. package/dist/cli/pack/hook-subagent-stop.js +0 -41
  413. package/dist/cli/pack/hook-subagent-stop.js.map +0 -1
  414. package/dist/cli/pack/hook-track-active-claim.d.ts +0 -27
  415. package/dist/cli/pack/hook-track-active-claim.js +0 -275
  416. package/dist/cli/pack/hook-track-active-claim.js.map +0 -1
  417. package/dist/cli/pack/transcript-report-scan.d.ts +0 -71
  418. package/dist/cli/pack/transcript-report-scan.js +0 -359
  419. package/dist/cli/pack/transcript-report-scan.js.map +0 -1
  420. package/dist/cli/pack/understanding-report-schema-hint.d.ts +0 -26
  421. package/dist/cli/pack/understanding-report-schema-hint.js +0 -120
  422. package/dist/cli/pack/understanding-report-schema-hint.js.map +0 -1
  423. package/dist/cli/pack/upgrade.d.ts +0 -32
  424. package/dist/cli/pack/upgrade.js +0 -273
  425. package/dist/cli/pack/upgrade.js.map +0 -1
  426. package/dist/cli/pause/index.d.ts +0 -113
  427. package/dist/cli/pause/index.js +0 -251
  428. package/dist/cli/pause/index.js.map +0 -1
  429. package/dist/cli/pause-check.d.ts +0 -22
  430. package/dist/cli/pause-check.js +0 -54
  431. package/dist/cli/pause-check.js.map +0 -1
  432. package/dist/cli/policy/intercept.d.ts +0 -233
  433. package/dist/cli/policy/intercept.js +0 -1022
  434. package/dist/cli/policy/intercept.js.map +0 -1
  435. package/dist/cli/policy/risk-envelope-enrichment.d.ts +0 -40
  436. package/dist/cli/policy/risk-envelope-enrichment.js +0 -110
  437. package/dist/cli/policy/risk-envelope-enrichment.js.map +0 -1
  438. package/dist/cli/record/index.d.ts +0 -81
  439. package/dist/cli/record/index.js +0 -348
  440. package/dist/cli/record/index.js.map +0 -1
  441. package/dist/cli/register-audit-group.js +0 -91
  442. package/dist/cli/register-audit-group.js.map +0 -1
  443. package/dist/cli/resolve-env.d.ts +0 -32
  444. package/dist/cli/resolve-env.js +0 -46
  445. package/dist/cli/resolve-env.js.map +0 -1
  446. package/dist/cli/session-export/index.d.ts +0 -46
  447. package/dist/cli/session-export/index.js +0 -169
  448. package/dist/cli/session-export/index.js.map +0 -1
  449. package/dist/cli/session-export/redact.d.ts +0 -22
  450. package/dist/cli/session-export/redact.js +0 -47
  451. package/dist/cli/session-export/redact.js.map +0 -1
  452. package/dist/cli/session-export/transcript.d.ts +0 -24
  453. package/dist/cli/session-export/transcript.js +0 -164
  454. package/dist/cli/session-export/transcript.js.map +0 -1
  455. package/dist/cli/session-start/branch-check.d.ts +0 -18
  456. package/dist/cli/session-start/branch-check.js +0 -140
  457. package/dist/cli/session-start/branch-check.js.map +0 -1
  458. package/dist/cli/session-start/index.d.ts +0 -121
  459. package/dist/cli/session-start/index.js +0 -591
  460. package/dist/cli/session-start/index.js.map +0 -1
  461. package/dist/cli/session-start/shared-options.d.ts +0 -103
  462. package/dist/cli/session-start/shared-options.js +0 -107
  463. package/dist/cli/session-start/shared-options.js.map +0 -1
  464. package/dist/cli/session-start/stale-base-check.d.ts +0 -46
  465. package/dist/cli/session-start/stale-base-check.js +0 -352
  466. package/dist/cli/session-start/stale-base-check.js.map +0 -1
  467. package/dist/cli/session-start/toolchain-parity.d.ts +0 -267
  468. package/dist/cli/session-start/toolchain-parity.js +0 -797
  469. package/dist/cli/session-start/toolchain-parity.js.map +0 -1
  470. package/dist/cli/smoke/assertions.d.ts +0 -46
  471. package/dist/cli/smoke/assertions.js +0 -170
  472. package/dist/cli/smoke/assertions.js.map +0 -1
  473. package/dist/cli/smoke/index.d.ts +0 -76
  474. package/dist/cli/smoke/index.js +0 -245
  475. package/dist/cli/smoke/index.js.map +0 -1
  476. package/dist/cli/smoke/runner.d.ts +0 -55
  477. package/dist/cli/smoke/runner.js +0 -134
  478. package/dist/cli/smoke/runner.js.map +0 -1
  479. package/dist/cli/smoke/stream-parser.d.ts +0 -65
  480. package/dist/cli/smoke/stream-parser.js +0 -115
  481. package/dist/cli/smoke/stream-parser.js.map +0 -1
  482. package/dist/cli/test-risk.d.ts +0 -27
  483. package/dist/cli/test-risk.js +0 -38
  484. package/dist/cli/test-risk.js.map +0 -1
  485. package/dist/io/display-path.d.ts +0 -11
  486. package/dist/io/display-path.js +0 -29
  487. package/dist/io/display-path.js.map +0 -1
  488. package/dist/io/duration.d.ts +0 -5
  489. package/dist/io/duration.js +0 -50
  490. package/dist/io/duration.js.map +0 -1
  491. package/dist/io/extract.d.ts +0 -79
  492. package/dist/io/extract.js +0 -226
  493. package/dist/io/extract.js.map +0 -1
  494. package/dist/io/ledger-record.d.ts +0 -83
  495. package/dist/io/ledger-record.js +0 -301
  496. package/dist/io/ledger-record.js.map +0 -1
  497. package/dist/io/read-json-dir-entries.d.ts +0 -36
  498. package/dist/io/read-json-dir-entries.js +0 -48
  499. package/dist/io/read-json-dir-entries.js.map +0 -1
  500. package/dist/io/safe-json-parse.d.ts +0 -5
  501. package/dist/io/safe-json-parse.js +0 -21
  502. package/dist/io/safe-json-parse.js.map +0 -1
  503. package/dist/policies/index.d.ts +0 -5
  504. package/dist/policies/index.js +0 -6
  505. package/dist/policies/index.js.map +0 -1
  506. package/dist/policies/ledger-client.d.ts +0 -113
  507. package/dist/policies/ledger-client.js +0 -500
  508. package/dist/policies/ledger-client.js.map +0 -1
  509. package/dist/policies/producers.d.ts +0 -12
  510. package/dist/policies/producers.js +0 -61
  511. package/dist/policies/producers.js.map +0 -1
  512. package/dist/policies/requires.d.ts +0 -75
  513. package/dist/policies/requires.js +0 -240
  514. package/dist/policies/requires.js.map +0 -1
  515. package/dist/policies/timestamp.d.ts +0 -14
  516. package/dist/policies/timestamp.js +0 -36
  517. package/dist/policies/timestamp.js.map +0 -1
  518. package/dist/policy-packs/builtin/permission-profiles.d.ts +0 -11
  519. package/dist/policy-packs/builtin/permission-profiles.js +0 -74
  520. package/dist/policy-packs/builtin/permission-profiles.js.map +0 -1
  521. package/dist/policy-packs/builtin/post-merge-gate-runtime.d.ts +0 -286
  522. package/dist/policy-packs/builtin/post-merge-gate-runtime.js +0 -397
  523. package/dist/policy-packs/builtin/post-merge-gate-runtime.js.map +0 -1
  524. package/dist/policy-packs/builtin/post-merge-gate.d.ts +0 -56
  525. package/dist/policy-packs/builtin/post-merge-gate.js +0 -347
  526. package/dist/policy-packs/builtin/post-merge-gate.js.map +0 -1
  527. package/dist/policy-packs/builtin/solution-acceptance-reconnect.d.ts +0 -50
  528. package/dist/policy-packs/builtin/solution-acceptance-reconnect.js +0 -151
  529. package/dist/policy-packs/builtin/solution-acceptance-reconnect.js.map +0 -1
  530. package/dist/policy-packs/builtin/solution-acceptance-runtime.d.ts +0 -323
  531. package/dist/policy-packs/builtin/solution-acceptance-runtime.js +0 -672
  532. package/dist/policy-packs/builtin/solution-acceptance-runtime.js.map +0 -1
  533. package/dist/policy-packs/builtin/solution-acceptance.d.ts +0 -45
  534. package/dist/policy-packs/builtin/solution-acceptance.js +0 -226
  535. package/dist/policy-packs/builtin/solution-acceptance.js.map +0 -1
  536. package/dist/policy-packs/builtin/understanding-before-execution/active-claim.d.ts +0 -25
  537. package/dist/policy-packs/builtin/understanding-before-execution/active-claim.js +0 -94
  538. package/dist/policy-packs/builtin/understanding-before-execution/active-claim.js.map +0 -1
  539. package/dist/policy-packs/builtin/understanding-before-execution/auto-approve-default.d.ts +0 -35
  540. package/dist/policy-packs/builtin/understanding-before-execution/auto-approve-default.js +0 -86
  541. package/dist/policy-packs/builtin/understanding-before-execution/auto-approve-default.js.map +0 -1
  542. package/dist/policy-packs/builtin/understanding-before-execution/auto-approve.d.ts +0 -210
  543. package/dist/policy-packs/builtin/understanding-before-execution/auto-approve.js +0 -361
  544. package/dist/policy-packs/builtin/understanding-before-execution/auto-approve.js.map +0 -1
  545. package/dist/policy-packs/builtin/understanding-before-execution/delegation-markers.d.ts +0 -304
  546. package/dist/policy-packs/builtin/understanding-before-execution/delegation-markers.js +0 -734
  547. package/dist/policy-packs/builtin/understanding-before-execution/delegation-markers.js.map +0 -1
  548. package/dist/policy-packs/builtin/understanding-before-execution/expiry-reason.d.ts +0 -36
  549. package/dist/policy-packs/builtin/understanding-before-execution/expiry-reason.js +0 -73
  550. package/dist/policy-packs/builtin/understanding-before-execution/expiry-reason.js.map +0 -1
  551. package/dist/policy-packs/builtin/understanding-before-execution/index.d.ts +0 -19
  552. package/dist/policy-packs/builtin/understanding-before-execution/index.js +0 -83
  553. package/dist/policy-packs/builtin/understanding-before-execution/index.js.map +0 -1
  554. package/dist/policy-packs/builtin/understanding-before-execution/inflight-records.d.ts +0 -135
  555. package/dist/policy-packs/builtin/understanding-before-execution/inflight-records.js +0 -643
  556. package/dist/policy-packs/builtin/understanding-before-execution/inflight-records.js.map +0 -1
  557. package/dist/policy-packs/builtin/understanding-before-execution/ledger.d.ts +0 -25
  558. package/dist/policy-packs/builtin/understanding-before-execution/ledger.js +0 -56
  559. package/dist/policy-packs/builtin/understanding-before-execution/ledger.js.map +0 -1
  560. package/dist/policy-packs/builtin/understanding-before-execution/lifecycle.d.ts +0 -20
  561. package/dist/policy-packs/builtin/understanding-before-execution/lifecycle.js +0 -106
  562. package/dist/policy-packs/builtin/understanding-before-execution/lifecycle.js.map +0 -1
  563. package/dist/policy-packs/builtin/understanding-before-execution/markers.d.ts +0 -126
  564. package/dist/policy-packs/builtin/understanding-before-execution/markers.js +0 -245
  565. package/dist/policy-packs/builtin/understanding-before-execution/markers.js.map +0 -1
  566. package/dist/policy-packs/builtin/understanding-before-execution/measured-permission-modes.d.ts +0 -29
  567. package/dist/policy-packs/builtin/understanding-before-execution/measured-permission-modes.js +0 -82
  568. package/dist/policy-packs/builtin/understanding-before-execution/measured-permission-modes.js.map +0 -1
  569. package/dist/policy-packs/builtin/understanding-before-execution/permission-mode-observations.d.ts +0 -71
  570. package/dist/policy-packs/builtin/understanding-before-execution/permission-mode-observations.js +0 -175
  571. package/dist/policy-packs/builtin/understanding-before-execution/permission-mode-observations.js.map +0 -1
  572. package/dist/policy-packs/builtin/understanding-before-execution/persisted-reports.d.ts +0 -625
  573. package/dist/policy-packs/builtin/understanding-before-execution/persisted-reports.js +0 -1076
  574. package/dist/policy-packs/builtin/understanding-before-execution/persisted-reports.js.map +0 -1
  575. package/dist/policy-packs/builtin/understanding-before-execution/post-tool-use-boundary.d.ts +0 -128
  576. package/dist/policy-packs/builtin/understanding-before-execution/post-tool-use-boundary.js +0 -213
  577. package/dist/policy-packs/builtin/understanding-before-execution/post-tool-use-boundary.js.map +0 -1
  578. package/dist/policy-packs/builtin/understanding-before-execution/stay-in-scope-config.d.ts +0 -129
  579. package/dist/policy-packs/builtin/understanding-before-execution/stay-in-scope-config.js +0 -166
  580. package/dist/policy-packs/builtin/understanding-before-execution/stay-in-scope-config.js.map +0 -1
  581. package/dist/policy-packs/builtin/understanding-before-execution/task-markers.d.ts +0 -164
  582. package/dist/policy-packs/builtin/understanding-before-execution/task-markers.js +0 -275
  583. package/dist/policy-packs/builtin/understanding-before-execution/task-markers.js.map +0 -1
  584. package/dist/policy-packs/builtin/understanding-before-execution-runtime.d.ts +0 -1
  585. package/dist/policy-packs/builtin/understanding-before-execution-runtime.js +0 -10
  586. package/dist/policy-packs/builtin/understanding-before-execution-runtime.js.map +0 -1
  587. package/dist/policy-packs/builtin/understanding-before-execution.d.ts +0 -526
  588. package/dist/policy-packs/builtin/understanding-before-execution.js +0 -1078
  589. package/dist/policy-packs/builtin/understanding-before-execution.js.map +0 -1
  590. package/dist/policy-packs/permission-translator.d.ts +0 -9
  591. package/dist/policy-packs/permission-translator.js +0 -76
  592. package/dist/policy-packs/permission-translator.js.map +0 -1
  593. package/dist/runtime/action-envelope.d.ts +0 -64
  594. package/dist/runtime/action-envelope.js +0 -46
  595. package/dist/runtime/action-envelope.js.map +0 -1
  596. package/dist/runtime/approval-signing.d.ts +0 -111
  597. package/dist/runtime/approval-signing.js +0 -384
  598. package/dist/runtime/approval-signing.js.map +0 -1
  599. package/dist/runtime/bash-match-facts.d.ts +0 -60
  600. package/dist/runtime/bash-match-facts.js +0 -196
  601. package/dist/runtime/bash-match-facts.js.map +0 -1
  602. package/dist/runtime/bash-match-registry.d.ts +0 -112
  603. package/dist/runtime/bash-match-registry.js +0 -406
  604. package/dist/runtime/bash-match-registry.js.map +0 -1
  605. package/dist/runtime/bash-prefix-parse.d.ts +0 -31
  606. package/dist/runtime/bash-prefix-parse.js +0 -576
  607. package/dist/runtime/bash-prefix-parse.js.map +0 -1
  608. package/dist/runtime/command-normalize.d.ts +0 -658
  609. package/dist/runtime/command-normalize.js +0 -2410
  610. package/dist/runtime/command-normalize.js.map +0 -1
  611. package/dist/runtime/deletion-target-resolve.d.ts +0 -28
  612. package/dist/runtime/deletion-target-resolve.js +0 -1078
  613. package/dist/runtime/deletion-target-resolve.js.map +0 -1
  614. package/dist/runtime/destructive-shell-floor.d.ts +0 -19
  615. package/dist/runtime/destructive-shell-floor.js +0 -611
  616. package/dist/runtime/destructive-shell-floor.js.map +0 -1
  617. package/dist/runtime/environment-resolver.d.ts +0 -36
  618. package/dist/runtime/environment-resolver.js +0 -138
  619. package/dist/runtime/environment-resolver.js.map +0 -1
  620. package/dist/runtime/git-context.d.ts +0 -201
  621. package/dist/runtime/git-context.js +0 -422
  622. package/dist/runtime/git-context.js.map +0 -1
  623. package/dist/runtime/index.d.ts +0 -12
  624. package/dist/runtime/index.js +0 -13
  625. package/dist/runtime/index.js.map +0 -1
  626. package/dist/runtime/intercept.d.ts +0 -623
  627. package/dist/runtime/intercept.js +0 -1384
  628. package/dist/runtime/intercept.js.map +0 -1
  629. package/dist/runtime/kube-context.d.ts +0 -16
  630. package/dist/runtime/kube-context.js +0 -63
  631. package/dist/runtime/kube-context.js.map +0 -1
  632. package/dist/runtime/kubectl-target-parse.d.ts +0 -31
  633. package/dist/runtime/kubectl-target-parse.js +0 -249
  634. package/dist/runtime/kubectl-target-parse.js.map +0 -1
  635. package/dist/runtime/ledger-add.d.ts +0 -16
  636. package/dist/runtime/ledger-add.js +0 -150
  637. package/dist/runtime/ledger-add.js.map +0 -1
  638. package/dist/runtime/ledger-writer.d.ts +0 -27
  639. package/dist/runtime/ledger-writer.js +0 -46
  640. package/dist/runtime/ledger-writer.js.map +0 -1
  641. package/dist/runtime/pause-sentinel.d.ts +0 -60
  642. package/dist/runtime/pause-sentinel.js +0 -156
  643. package/dist/runtime/pause-sentinel.js.map +0 -1
  644. package/dist/runtime/pending-approval.d.ts +0 -23
  645. package/dist/runtime/pending-approval.js +0 -67
  646. package/dist/runtime/pending-approval.js.map +0 -1
  647. package/dist/runtime/read-only-bash.d.ts +0 -141
  648. package/dist/runtime/read-only-bash.js +0 -2204
  649. package/dist/runtime/read-only-bash.js.map +0 -1
  650. package/dist/runtime/recovery-git-commit.d.ts +0 -22
  651. package/dist/runtime/recovery-git-commit.js +0 -284
  652. package/dist/runtime/recovery-git-commit.js.map +0 -1
  653. package/dist/runtime/reject-malformed-session-id.d.ts +0 -8
  654. package/dist/runtime/reject-malformed-session-id.js +0 -16
  655. package/dist/runtime/reject-malformed-session-id.js.map +0 -1
  656. package/dist/runtime/risk-classifier.d.ts +0 -38
  657. package/dist/runtime/risk-classifier.js +0 -311
  658. package/dist/runtime/risk-classifier.js.map +0 -1
  659. package/dist/runtime/session-id.d.ts +0 -113
  660. package/dist/runtime/session-id.js +0 -193
  661. package/dist/runtime/session-id.js.map +0 -1
  662. package/dist/runtime/shell-word.d.ts +0 -62
  663. package/dist/runtime/shell-word.js +0 -410
  664. package/dist/runtime/shell-word.js.map +0 -1
  665. package/dist/runtime/task-providers/agent-tasks.d.ts +0 -105
  666. package/dist/runtime/task-providers/agent-tasks.js +0 -247
  667. package/dist/runtime/task-providers/agent-tasks.js.map +0 -1
  668. package/dist/runtime/when-eval.d.ts +0 -62
  669. package/dist/runtime/when-eval.js +0 -212
  670. package/dist/runtime/when-eval.js.map +0 -1
  671. package/dist/runtime/workflow-policies.d.ts +0 -207
  672. package/dist/runtime/workflow-policies.js +0 -596
  673. package/dist/runtime/workflow-policies.js.map +0 -1
  674. package/dist/schema/audit.d.ts +0 -71
  675. package/dist/schema/audit.js +0 -32
  676. package/dist/schema/audit.js.map +0 -1
  677. package/dist/schema/doctor.d.ts +0 -25
  678. package/dist/schema/doctor.js +0 -23
  679. package/dist/schema/doctor.js.map +0 -1
  680. package/dist/schema/environments.d.ts +0 -215
  681. package/dist/schema/environments.js +0 -101
  682. package/dist/schema/environments.js.map +0 -1
  683. package/dist/schema/extract.d.ts +0 -9
  684. package/dist/schema/extract.js +0 -86
  685. package/dist/schema/extract.js.map +0 -1
  686. package/dist/schema/permission-profiles.d.ts +0 -2292
  687. package/dist/schema/permission-profiles.js +0 -60
  688. package/dist/schema/permission-profiles.js.map +0 -1
  689. package/dist/schema/policies.d.ts +0 -974
  690. package/dist/schema/policies.js +0 -298
  691. package/dist/schema/policies.js.map +0 -1
  692. package/dist/schema/requires.d.ts +0 -131
  693. package/dist/schema/requires.js +0 -88
  694. package/dist/schema/requires.js.map +0 -1
  695. package/dist/schema/risk.d.ts +0 -144
  696. package/dist/schema/risk.js +0 -194
  697. package/dist/schema/risk.js.map +0 -1
  698. package/dist/schema/session-start-preflight.d.ts +0 -10
  699. package/dist/schema/session-start-preflight.js +0 -106
  700. package/dist/schema/session-start-preflight.js.map +0 -1
  701. package/dist/schema/stale-base-check.d.ts +0 -18
  702. package/dist/schema/stale-base-check.js +0 -37
  703. package/dist/schema/stale-base-check.js.map +0 -1
  704. package/dist/schema/toolchain-parity.d.ts +0 -21
  705. package/dist/schema/toolchain-parity.js +0 -48
  706. package/dist/schema/toolchain-parity.js.map +0 -1
  707. package/dist/schema/workflows.d.ts +0 -519
  708. package/dist/schema/workflows.js +0 -81
  709. package/dist/schema/workflows.js.map +0 -1
  710. package/scripts/runtime-reality-docker-probe.mjs +0 -71
@@ -5,37 +5,21 @@ import { parseProbedVersion, compareVersionFloor } from "../../io/version-compar
5
5
  import { resolveGeneratedDir } from "../../io/generated-dir.js";
6
6
  import { inspectMemory, projectRejectionWarns } from "../../probes/memory.js";
7
7
  import { RealMcpProbe, probeAll, } from "../../probes/mcp.js";
8
+ import { formatPostureWarning, } from "../../schema/index.js";
8
9
  import { EVIDENCE_LEDGER_DB_ENV, GROUNDING_MCP_SERVER_NAME, } from "../apply/generate-settings.js";
9
10
  import { parsePackSource } from "../../policy-packs/source.js";
10
11
  import { resolveBuiltin } from "../../policy-packs/registry.js";
11
- import { expandPolicyPacks } from "../../policy-packs/index.js";
12
12
  import { checkPolicyPackConfigs } from "../../policy-packs/config-check.js";
13
13
  import { checkPolicyPackVersions } from "../../policy-packs/version-check.js";
14
14
  import { checkPolicyPackUxDrift } from "../../policy-packs/ux-drift-check.js";
15
15
  import { selectRuntime } from "../apply/apply.js";
16
16
  import { lastApplyPath, readLastApply } from "../../io/last-apply.js";
17
- import { checkHookBudgetLedgerMargin, checkPolicyRiskWithoutEnvScope, checkSolutionAcceptanceKnobIgnored, checkSolutionAcceptanceProducer, checkTemplatePolicyDrift, checkTriggerBoundaryDrift, checkWorkflows, createDefaultGitIgnoreProbe, } from "../validate/checks.js";
18
- import { isDerivedPolicy } from "../../runtime/workflow-policies.js";
19
- import { resolveScopedProjectName } from "../../runtime/git-context.js";
20
- import { loadManifest, resolvePaths } from "../loader.js";
17
+ import { loadManifest } from "../loader.js";
21
18
  import { countCodexDiagnostics, findOnPath, runCodexTargetChecks, } from "./codex.js";
22
19
  import { countOpencodeDiagnostics, runOpencodeTargetChecks, } from "./opencode.js";
23
20
  import { checkNpmBinPath } from "./npm-bin-path.js";
24
- import { scanForRogueLedgers } from "./rogue-ledger.js";
25
21
  import { buildClaudeMcpRegistration } from "./claude-mcp.js";
26
- import { checkUnderstandingModeEnvDivergence, isUnderstandingPackEnabled, } from "./understanding-mode-env.js";
27
- import { checkAutoApproveMode } from "./auto-approve-mode.js";
28
- import { checkExpireOnToolMatch } from "./expire-on-tool-match.js";
29
- import { checkBypassWithoutAutoApprove } from "./bypass-without-auto-approve.js";
30
- import { checkSessionStartPreflightSetupVersion, } from "./session-start-preflight-setup-version.js";
31
- import { SESSION_START_PREFLIGHT_SETUP_BUILD_MIN_VERSION } from "../../schema/session-start-preflight.js";
32
- import { runDoctorToolchainParity, } from "./toolchain-parity.js";
33
- import { buildUgAutoApprovals, DEFAULT_RECENT_SESSIONS } from "./ug-auto-approvals.js";
34
- import { buildUgDelegations } from "./ug-delegations.js";
35
- import { buildUgInflight } from "./ug-inflight.js";
36
- import { buildSettingsDrift } from "./settings-drift.js";
37
- import { buildCodexConfigDrift, isCodexOptedIntoAutoApprove } from "./codex-config-drift.js";
38
- import { LOCK_BASENAME } from "../../io/harness-lock.js";
22
+ import { buildHookLiveness, countHookLiveness, livenessRuntimes } from "./hook-liveness.js";
39
23
  import { isDoctorTarget, KNOWN_DOCTOR_TARGETS, } from "./types.js";
40
24
  export { isDoctorTarget, KNOWN_DOCTOR_TARGETS };
41
25
  const HOME_PLACEHOLDER = "~";
@@ -342,8 +326,7 @@ function checkHookVersion(hook, versionProbe) {
342
326
  /**
343
327
  * Wraps a version probe with a per-full-argv cache, keyed on
344
328
  * `JSON.stringify(cmd)` so two commands sharing only `cmd[0]` (e.g.
345
- * `["understanding-gate", "--version"]` vs. `["understanding-gate",
346
- * "--check"]`) are never conflated into the same cache slot; only a
329
+ * `["some-bin", "--version"]` vs. `["some-bin", "--check"]`) are never conflated into the same cache slot; only a
347
330
  * byte-identical argv array is deduped. Exported standalone (task
348
331
  * ab634898) so this caching contract has its own focused
349
332
  * unit test independent of any particular pack's hook shape.
@@ -357,62 +340,6 @@ export function memoizeVersionProbe(probe) {
357
340
  return cache.get(key) ?? null;
358
341
  };
359
342
  }
360
- /**
361
- * Hook-level `min_version` floor on policy-pack-expanded hooks (task
362
- * ab634898). `checkHooks` above only walks `manifest.hooks[]`, but the
363
- * hooks Claude Code actually runs also include whatever
364
- * `expandPolicyPacks` contributes, e.g. understanding-before-execution's
365
- * UserPromptSubmit/Stop hooks, floored at understanding-gate 0.5.0
366
- * (see `src/policy-packs/builtin/understanding-before-execution.ts`).
367
- * Those pack-expanded hooks never reached `checkHookVersion`, so an
368
- * operator on an older understanding-gate saw a clean doctor report
369
- * even though the pause wiring (or the Understanding Report's 10th
370
- * section) was silently degraded below the declared floor.
371
- *
372
- * Reuses `checkHookVersion` verbatim so the warning wording matches the
373
- * manifest-hook case exactly. `versionProbe` is wrapped with a
374
- * per-command cache so two hooks that share one `version_command` (the
375
- * common case: user-prompt-submit and stop both probe
376
- * `understanding-gate --version`) spawn the underlying binary once, not
377
- * twice. Only below-floor / probe-failed / parse-failed results are
378
- * returned; a hook at or above its floor produces nothing, mirroring
379
- * the pack-level floor's "green ones produce nothing" contract
380
- * (`checkPolicyPackVersions`). Always warn, never error: the pack still
381
- * runs in degraded mode rather than failing outright.
382
- *
383
- * Expands against the runtime a plain `harness apply` would select
384
- * (`selectRuntime` in `src/cli/apply/apply.ts`: recorded in `.last-apply`,
385
- * inferred from its files, else the default), never `opts.target`:
386
- * `--target codex` / `--target opencode` additionally evaluate the
387
- * harness-side adapter health for that runtime, they do not change which
388
- * runtime is actually installed and running the hooks. Matches the
389
- * sibling pack-level check's `resolveBuiltin(pack, runtime)` further below
390
- * (task ab634898: keying this on `--target` produced a below-floor install
391
- * that showed no warning under `--target codex` and a spurious one under
392
- * `--target opencode`, where the pack never wires in the first place; task
393
- * 04b8abcf: expanding against the default instead of the applied runtime
394
- * made doctor and apply diverge on a codex-recorded machine).
395
- */
396
- function checkPolicyPackHookVersions(manifest, versionProbe, runtime) {
397
- const expansion = expandPolicyPacks(manifest, runtime);
398
- const dedupedProbe = memoizeVersionProbe(versionProbe);
399
- const gaps = [];
400
- for (const hook of expansion.hooks) {
401
- const version = checkHookVersion(hook, dedupedProbe);
402
- if (version && version.status === "warn" && hook.min_version) {
403
- gaps.push({
404
- name: hook.name,
405
- event: hook.event,
406
- declaredMinVersion: hook.min_version,
407
- kind: version.kind,
408
- actualVersion: version.actualVersion ?? null,
409
- versionCommand: hook.version_command ?? [],
410
- message: version.message,
411
- });
412
- }
413
- }
414
- return gaps;
415
- }
416
343
  function checkHooks(manifest, home, opts) {
417
344
  const versionProbe = opts.versionProbe ?? (() => null);
418
345
  return manifest.hooks.map((hook) => {
@@ -443,89 +370,15 @@ function checkHooks(manifest, home, opts) {
443
370
  return base({ status: "ok" });
444
371
  });
445
372
  }
446
- /** The literal prefix of a ledger tag — the part before the first `:`. */
447
- function ledgerTagPrefix(ledgerTag) {
448
- const colon = ledgerTag.indexOf(":");
449
- return colon === -1 ? ledgerTag : ledgerTag.slice(0, colon);
450
- }
451
- /**
452
- * Does any manifest hook plausibly *produce* `prefix`-tagged ledger
453
- * entries? The policy's own consumer hook (`policy.hook`) is excluded:
454
- * a gate that reads the tag cannot also be what satisfies it.
455
- *
456
- * "Plausibly produces" is a coarse substring match of the tag prefix
457
- * against the hook command — a producer is typically a SessionStart
458
- * runner like `agent-preflight` whose command names the domain. The
459
- * match is prefix-granular by necessity: the command is an opaque
460
- * shell string, and the full `preflight:${BRANCH}` tag never appears
461
- * in it literally. So the signal is asymmetric. "No producer found"
462
- * is reliable. "Producer found" is a heuristic that can give false
463
- * reassurance: a hook producing `preflight:${REPO}` will mask a
464
- * `preflight:${BRANCH}` gap, and a once-per-session producer will mask
465
- * a `within: 10m` window it cannot actually keep fresh. This check is
466
- * therefore a floor (it catches the total-absence case), not a proof
467
- * of satisfiability.
468
- */
469
- function hasProducerHook(manifest, policy, prefix) {
470
- // An empty prefix (a leading-colon tag like `:foo`) would
471
- // substring-match every hook command. Treat it as "no producer
472
- // identifiable" so the gap is surfaced rather than silently
473
- // suppressed by a vacuous match.
474
- if (prefix === "")
475
- return false;
476
- return manifest.hooks.some((h) => h.name !== policy.hook && h.command.includes(prefix));
477
- }
478
- function buildPolicies(manifest) {
479
- return manifest.policies.map((p) => {
480
- const report = {
481
- name: p.name,
482
- schemaValid: true,
483
- caveat: "schema valid; last-evaluated tracking ships in Phase 4",
484
- // F7 (review round 2): mark provenance so the rendered list can
485
- // append "(derived from workflows[])" instead of listing a
486
- // workflow-derived policy indistinguishably from a hand-authored
487
- // one. `doctor` loads via `loadManifest`, which now folds derived
488
- // policies in via `withDerivedPolicies` (F2), so this manifest's
489
- // `policies[]` already contains them.
490
- ...(isDerivedPolicy(p) ? { derived: true } : {}),
491
- };
492
- // Producer-gap check (task ce50df99): a `block` policy whose
493
- // required tag carries a `within` freshness window cannot stay
494
- // satisfied by a one-time action — it needs a recurring producer.
495
- // If no manifest hook produces the tag, the gate silently walls
496
- // off whatever it triggers on (the founding-incident lockout:
497
- // `preflight-before-investigation` blocking every `git status`).
498
- // Policies without `within` only need the tag to exist once, which
499
- // the normal review / PR workflow supplies, so they are not
500
- // flagged.
501
- //
502
- // Refinement (task f97e152f): a non-empty `producers:` array on
503
- // the policy itself is the schema's way of declaring the recovery
504
- // path. For example `dogfood-before-release` deliberately wants
505
- // the operator to record a manual smoke summary; an automatic
506
- // SessionStart producer would defeat the gate's purpose. When that
507
- // documented producer exists the warning would be a false positive
508
- // and is suppressed. The check still fires when both kinds are
509
- // absent. The `length === 0` clause is defensive: the schema
510
- // already enforces `producers: .min(1).optional()`, so a defined
511
- // array is guaranteed non-empty for any manifest that loaded.
512
- if (p.enforcement === "block" &&
513
- // operator_only: true (task 2cc73f55) policies declare no
514
- // requires: at all — there is no ledger_tag/within to go stale, so
515
- // there is nothing for a producer to keep fresh.
516
- p.requires !== undefined &&
517
- p.requires.within !== undefined &&
518
- (p.producers === undefined || p.producers.length === 0)) {
519
- const prefix = ledgerTagPrefix(p.requires.ledger_tag);
520
- if (!hasProducerHook(manifest, p, prefix)) {
521
- report.producerGap = {
522
- ledgerTag: p.requires.ledger_tag,
523
- within: p.requires.within,
524
- };
525
- }
526
- }
527
- return report;
528
- });
373
+ function packExpansionRuntimeReport(selection, warning) {
374
+ return {
375
+ ...(warning !== undefined ? { warning } : {}),
376
+ runtime: selection.runtime,
377
+ source: selection.runtimeSource,
378
+ ...(selection.previousRuntime !== undefined
379
+ ? { previousRuntime: selection.previousRuntime }
380
+ : {}),
381
+ };
529
382
  }
530
383
  /**
531
384
  * Declared-but-not-live policy pack check. `expandPolicyPacks` silently
@@ -537,37 +390,7 @@ function buildPolicies(manifest) {
537
390
  * Skipped (`enabled: false`) packs are NOT checked: they're not
538
391
  * expected to be live, and flagging them would flood the report.
539
392
  */
540
- /**
541
- * Sentinel "cannot tell" probe: shallow runs answer every ignoredness
542
- * question with `null` instead of spawning `git check-ignore`. Exported
543
- * (with the resolver below) so a test can pin the no-spawn contract by
544
- * identity instead of mocking `node:child_process`.
545
- */
546
- export const NULL_GIT_IGNORE_PROBE = () => null;
547
- /**
548
- * Probe resolution order: an explicit (test) probe always wins; `shallow`
549
- * degrades to the no-spawn sentinel, mirroring how the npm-bin probe and
550
- * MCP probes degrade; otherwise the real `git check-ignore` probe runs
551
- * against the process cwd.
552
- */
553
- export function resolveGitIgnoreProbe(opts) {
554
- if (opts.gitIgnoreProbe)
555
- return opts.gitIgnoreProbe;
556
- if (opts.shallow)
557
- return NULL_GIT_IGNORE_PROBE;
558
- return createDefaultGitIgnoreProbe();
559
- }
560
- function packExpansionRuntimeReport(selection, warning) {
561
- return {
562
- ...(warning !== undefined ? { warning } : {}),
563
- runtime: selection.runtime,
564
- source: selection.runtimeSource,
565
- ...(selection.previousRuntime !== undefined
566
- ? { previousRuntime: selection.previousRuntime }
567
- : {}),
568
- };
569
- }
570
- function buildPolicyPacks(manifest, versionProbe, gitIgnoreProbe, runtime) {
393
+ function buildPolicyPacks(manifest, runtime) {
571
394
  const unresolved = [];
572
395
  for (const pack of manifest.policy_packs) {
573
396
  if (!pack.enabled)
@@ -597,10 +420,10 @@ function buildPolicyPacks(manifest, versionProbe, gitIgnoreProbe, runtime) {
597
420
  configPath: issue.configPath,
598
421
  message: issue.message,
599
422
  }));
600
- const versionGaps = checkPolicyPackVersions(manifest, versionProbe).map((gap) => ({
423
+ const versionGaps = checkPolicyPackVersions(manifest).map((gap) => ({
601
424
  name: gap.packName,
602
425
  declaredMinVersion: gap.declaredMinVersion,
603
- actualVersion: gap.actualVersion,
426
+ actualVersion: null,
604
427
  message: gap.message,
605
428
  }));
606
429
  const uxDrift = checkPolicyPackUxDrift(manifest).map((drift) => ({
@@ -608,129 +431,7 @@ function buildPolicyPacks(manifest, versionProbe, gitIgnoreProbe, runtime) {
608
431
  fields: drift.fields,
609
432
  message: drift.message,
610
433
  }));
611
- // Same array as the producer check on purpose: countDiagnostics and the
612
- // renderers already tally / print `solutionAcceptance` by severity, so
613
- // the knob-ignored warning (task 24f6ceb9) inherits doctor parity with
614
- // `harness validate` for free — the #308 pattern.
615
- const solutionAcceptance = [
616
- ...checkSolutionAcceptanceProducer(manifest),
617
- ...checkSolutionAcceptanceKnobIgnored(manifest, gitIgnoreProbe),
618
- ];
619
- return { unresolved, configIssues, versionGaps, uxDrift, solutionAcceptance };
620
- }
621
- function buildWorkflows(manifest) {
622
- const entries = manifest.workflows.map((wf) => {
623
- const review = wf.steps.find((s) => s.kind === "review_subagent");
624
- const merge = wf.steps.find((s) => s.kind === "merge");
625
- return {
626
- name: wf.name,
627
- steps: wf.steps.length,
628
- reviewSpawn: review?.kind === "review_subagent" ? review.spawn : null,
629
- reviewTemplate: review?.kind === "review_subagent" ? (review.template ?? null) : null,
630
- mergeGate: merge?.kind === "merge" ? merge.gate : null,
631
- taskLabels: wf.when.task_label ?? [],
632
- };
633
- });
634
- // F3 (review round 2, 99f47307 Slice 1): doctor previously imported
635
- // validate's workflow-gate check nowhere, so a spawn: "required"
636
- // workflow with the merge gate unwired (or wired to the wrong hook
637
- // trigger, F5) showed green here even though `harness validate` errors
638
- // on it. Delegates to the shared `checkWorkflows` aggregate (review
639
- // round 3: the one list validate runs too, so the two cannot drift
640
- // again), mirroring `buildTemplateDrift` / `buildTriggerBoundaryDrift`.
641
- const workflowChecks = partitionDiagnosticsBySeverity(checkWorkflows(manifest));
642
- return {
643
- declared: manifest.workflows.length,
644
- templates: Object.keys(manifest.review_templates).length,
645
- entries,
646
- errors: workflowChecks.errors,
647
- warnings: workflowChecks.warnings,
648
- };
649
- }
650
- /**
651
- * Phase 7 #6 — Risk Gate wiring health. Counts the three Risk Gate
652
- * surfaces and flags the misconfigurations that make the gate inert or
653
- * silently fail-closed. Pure: manifest in, section out, no I/O.
654
- */
655
- function buildRiskGate(manifest) {
656
- const classifiers = manifest.risk.classifiers.length;
657
- const resolvers = manifest.environments.resolvers.length;
658
- const whenPolicies = manifest.policies.filter((p) => p.when !== undefined).length;
659
- const warnings = [];
660
- if (whenPolicies > 0 && classifiers === 0) {
661
- warnings.push(`${whenPolicies} policy(ies) declare \`when:\` but no \`risk.classifiers[]\` are declared; ` +
662
- `every action classifies as unclassified, so \`risk.*\` clauses match fail-closed ("unknown is not safe")`);
663
- }
664
- if (whenPolicies > 0 && resolvers === 0) {
665
- warnings.push(`${whenPolicies} policy(ies) declare \`when:\` but no \`environments.resolvers[]\` are declared; ` +
666
- `every action resolves to environment \`unknown\``);
667
- }
668
- if (whenPolicies === 0 && (classifiers > 0 || resolvers > 0)) {
669
- warnings.push("risk classifiers / environment resolvers are declared but no policy consumes them via `when:` — the Risk Gate is inert");
670
- }
671
- // Risk-clause policies that forgot to scope via `environment.name`.
672
- // Delegate to the shared validate check so doctor and `harness validate`
673
- // stay in parity (same logic, same clauses, same thresholds). The check
674
- // covers risk.severity_at_least, risk.category_in, AND action.reversible:
675
- // all three clauses fail-closed to matched=true on an unclassified action
676
- // per `runtime/when-eval.ts`. Map each Diagnostic message into a warning
677
- // string, mirroring the checkSolutionAcceptanceProducer pattern above.
678
- for (const diag of checkPolicyRiskWithoutEnvScope(manifest)) {
679
- warnings.push(diag.message);
680
- }
681
- return { classifiers, resolvers, whenPolicies, warnings };
682
- }
683
- /**
684
- * Template-policy drift (task adf037c1): shipped operator_only security
685
- * policies missing from an aged installed manifest. Delegates to the
686
- * shared validate check so `harness doctor` and `harness validate` stay
687
- * in parity. Each Diagnostic is a missing kill-switch defense and maps to
688
- * errorCount (see countDiagnostics), the doctor-convention signal that a
689
- * dogfood/CI run should fail until the manifest is caught up or the name
690
- * is explicitly acknowledged under doctor.ignore_template_drift.
691
- */
692
- /**
693
- * Splits a `Diagnostic[]` into the `{ errors, warnings }` message-array
694
- * shape every drift-style doctor section uses (task 037cfb7c review round
695
- * 3: `buildTemplateDrift` and `buildTriggerBoundaryDrift` had become
696
- * byte-identical bodies around two different `checkX(manifest)` calls;
697
- * this is the one place that split lives now).
698
- */
699
- function partitionDiagnosticsBySeverity(diags) {
700
- return {
701
- errors: diags.filter((d) => d.severity === "error").map((d) => d.message),
702
- warnings: diags.filter((d) => d.severity === "warning").map((d) => d.message),
703
- };
704
- }
705
- function buildTemplateDrift(manifest) {
706
- return partitionDiagnosticsBySeverity(checkTemplatePolicyDrift(manifest));
707
- }
708
- /**
709
- * Trigger-boundary drift (task 037cfb7c): shipped-by-name `bash_match`
710
- * triggers (hook- and policy-level) missing a boundary alternative the
711
- * template has, or missing a boundary group entirely. Doctor-only, like
712
- * `checkTemplatePolicyDrift` immediately above: `checkTriggerBoundaryDrift`
713
- * is deliberately not wired into validate's `runAssetChecks`, so
714
- * `harness validate` does not run it (only `harness doctor` does). Uses
715
- * the same `partitionDiagnosticsBySeverity` split as `buildTemplateDrift`
716
- * above: `checkTriggerBoundaryDrift` only emits `error`-severity
717
- * diagnostics today, but a future non-`error` diagnostic now surfaces in
718
- * `warnings` instead of being silently dropped.
719
- */
720
- function buildTriggerBoundaryDrift(manifest) {
721
- return partitionDiagnosticsBySeverity(checkTriggerBoundaryDrift(manifest));
722
- }
723
- /**
724
- * Hook-budget-vs-ledger-timeout margin (task d20a7e0c). Delegates to the
725
- * shared validate check so `harness doctor` and `harness validate` stay
726
- * in parity, mirroring `buildTemplateDrift` immediately above.
727
- * `checkHookBudgetLedgerMargin` only ever emits `error`-severity
728
- * diagnostics (an under-budgeted blocking hook is always a real
729
- * fail-open gap, never a stylistic warning), so every message maps
730
- * straight to `errors`.
731
- */
732
- function buildHookBudgetLedgerMargin(manifest) {
733
- return { errors: checkHookBudgetLedgerMargin(manifest).map((d) => d.message) };
434
+ return { unresolved, configIssues, versionGaps, uxDrift };
734
435
  }
735
436
  /**
736
437
  * Grounding wiring health (task 129e1b94). Only meaningful when an enabled
@@ -782,22 +483,16 @@ function buildGrounding(manifest, server, home) {
782
483
  catch {
783
484
  ledgerPathWritable = false;
784
485
  warnings.push(`evidence-ledger path ${ledgerPath} is not writable (and not creatable) — ` +
785
- `grounding-mcp cannot persist evidence; warn policies degrade non-blocking, ` +
786
- `block/require_approval policies DENY matching events (deny-degraded) while ` +
787
- `their evidence is unreadable (risk.degraded_fail_posture: fail_open restores ` +
788
- `the availability-first behaviour)`);
486
+ `grounding-mcp cannot persist evidence`);
789
487
  }
790
488
  return { ledgerPath, ledgerPathWritable, envOverride, warnings };
791
489
  }
792
- function manifestSection(manifest) {
490
+ function manifestSection(manifest, postureWarnings) {
793
491
  const topLevelKeys = [
794
492
  "grounding",
795
493
  "tools",
796
494
  "memory",
797
495
  "hooks",
798
- "policies",
799
- "workflows",
800
- "review_templates",
801
496
  ];
802
497
  const present = topLevelKeys.filter((k) => manifest[k] !== undefined).length;
803
498
  // Note: a corrupt manifest never reaches this point; loadManifest exits
@@ -806,7 +501,10 @@ function manifestSection(manifest) {
806
501
  // dropped. The exit-66-on-load path is the canonical signal.
807
502
  return {
808
503
  topLevelKeysPresent: present,
809
- warnings: [],
504
+ // Removed manifest keys / removed packs the load stripped and ignored,
505
+ // and sites that still call a removed command
506
+ // (src/schema/removed-keys.ts): each one is a warning here.
507
+ warnings: postureWarnings.map(formatPostureWarning),
810
508
  };
811
509
  }
812
510
  function countDiagnostics(report) {
@@ -845,57 +543,24 @@ function countDiagnostics(report) {
845
543
  if (h.version?.status === "warn")
846
544
  warningCount++;
847
545
  }
848
- for (const p of report.policies) {
849
- if (p.producerGap)
850
- warningCount++;
546
+ if (report.hookLiveness !== undefined) {
547
+ const liveness = countHookLiveness(report.hookLiveness);
548
+ errorCount += liveness.errorCount;
549
+ warningCount += liveness.warningCount;
851
550
  }
852
551
  errorCount += report.policyPacks.unresolved.length;
853
552
  errorCount += report.policyPacks.configIssues.length;
854
- // Pack-level min_version gaps are warn-not-error: the pack still
855
- // functions in degraded mode; only features gated on the newer
856
- // release are lost. Parallel to the hook-level version probe's
553
+ // Pack-level min_version gaps are warn-not-error: the pack itself works,
554
+ // only the declared floor cannot be enforced. Builtin packs ship with
555
+ // harness and have no probe, so today every gap is a
556
+ // `no_probe_registered` one. Parallel to the hook-level version probe's
857
557
  // `status: warn`.
858
558
  warningCount += report.policyPacks.versionGaps.length;
859
- // Hook-level min_version gaps on pack-expanded hooks (task ab634898):
860
- // always warn-not-error, mirroring both the pack-level floor above
861
- // and the manifest-declared hook floor in the `report.hooks` loop.
862
- warningCount += report.policyPackHookVersions.length;
863
- // Ux/producers drift is always warn: the pack still functions with the
559
+ // Ux drift is always warn: the pack still functions with the
864
560
  // stale wording, the operator is just missing a wording improvement.
865
561
  // Fix is opt-in (`harness pack reseed <name>`), so this never escalates
866
562
  // to an error the way an unresolved pack or a rejected config value does.
867
563
  warningCount += report.policyPacks.uxDrift.length;
868
- for (const d of report.policyPacks.solutionAcceptance) {
869
- if (d.severity === "error")
870
- errorCount++;
871
- else if (d.severity === "warning")
872
- warningCount++;
873
- }
874
- warningCount += report.riskGate.warnings.length;
875
- // Workflow gate wiring (F3) + weak-overlap (F1), review round 2,
876
- // 99f47307 Slice 1: an unwired/mis-wired merge gate is a real
877
- // silent-non-enforcement gap → errorCount; a weaker hand-authored
878
- // policy sharing the derived gate's surface is informational →
879
- // warningCount.
880
- errorCount += report.workflows.errors.length;
881
- warningCount += report.workflows.warnings.length;
882
- // Template-policy drift: each missing-or-downgraded shipped operator_only
883
- // security policy is a real defense gap → errorCount; stale opt-out
884
- // entries are warn-only (task adf037c1).
885
- errorCount += report.templateDrift.errors.length;
886
- warningCount += report.templateDrift.warnings.length;
887
- // Trigger-boundary drift (task 037cfb7c): every entry is a measured,
888
- // exploitable gate bypass (see checkTriggerBoundaryDrift's header),
889
- // mapped to errorCount, mirroring templateDrift.errors immediately
890
- // above; warnings mirrors templateDrift.warnings the same way (no
891
- // warning-severity diagnostic exists today, but the pathway is wired
892
- // so one would count instead of vanishing).
893
- errorCount += report.triggerBoundaryDrift.errors.length;
894
- warningCount += report.triggerBoundaryDrift.warnings.length;
895
- // Hook-budget-vs-ledger-timeout margin (task d20a7e0c): every entry is
896
- // a real fail-open gap, mirroring templateDrift.errors immediately
897
- // above.
898
- errorCount += report.hookBudgetLedgerMargin.errors.length;
899
564
  if (report.grounding !== undefined) {
900
565
  warningCount += report.grounding.warnings.length;
901
566
  }
@@ -910,58 +575,6 @@ function countDiagnostics(report) {
910
575
  }
911
576
  if (report.npmGlobalBin?.status === "warn")
912
577
  warningCount++;
913
- // Toolchain-parity drift (task 13919613): advisory-only, ALWAYS a
914
- // warning, never an error — a machine running a different Node/OW-Kit/
915
- // npm-global/MCP-set than a peer is a real drift signal worth flagging,
916
- // but never a hard failure the way a broken MCP server or a missing
917
- // required CLI is. `"skipped"` (--shallow) and `"no-peers"` (nothing to
918
- // compare yet) are informational states and contribute nothing here.
919
- if (report.toolchainParity) {
920
- for (const p of report.toolchainParity.peers) {
921
- if (p.status === "drift")
922
- warningCount++;
923
- }
924
- }
925
- // Understanding-gate mode env/config divergence (task 24abdecb):
926
- // always advisory, never an error — see understanding-mode-env.ts.
927
- if (report.understandingModeEnv)
928
- warningCount++;
929
- // ugAutoApprovals is informational only (ℹ), never contributes here.
930
- // ugDelegations is informational (ℹ) UNLESS it found an unreadable
931
- // file, in which case it rolls exactly one warning (ug-delegations.ts,
932
- // agent-tasks 37ad0b05), not one per unreadable file.
933
- if (report.ugDelegations && report.ugDelegations.unreadable > 0)
934
- warningCount++;
935
- // auto_approve configured outside grill_me (agent-tasks abfad738):
936
- // always advisory, never an error, see auto-approve-mode.ts.
937
- if (report.ugAutoApproveMode)
938
- warningCount++;
939
- // Explicit expire_on_tool_match with task_finish but without task_merge
940
- // (task 0c6b2cb9): always advisory, never an error, see
941
- // expire-on-tool-match.ts.
942
- if (report.ugExpireOnToolMatch)
943
- warningCount++;
944
- // bypassPermissions observed, auto_approve missing/mismatched (task
945
- // 8f637efd): always advisory, never an error, see
946
- // bypass-without-auto-approve.ts.
947
- if (report.ugBypassWithoutAutoApprove)
948
- warningCount++;
949
- // session_start_preflight.setup below the build-capable preflight
950
- // floor (task 6993d9b5): always advisory, never an error, see
951
- // session-start-preflight-setup-version.ts.
952
- if (report.sessionStartPreflightSetupVersion)
953
- warningCount++;
954
- // ugInflight is informational only (ℹ) and never contributes here: a
955
- // stale or skipped record is exactly what `harness gc` sweeps, not a
956
- // tampering signal (see ug-inflight.ts / types.ts). Placed after every
957
- // line this function's own docs citation anchors rather than beside
958
- // its ugDelegations sibling above, for the same reason format.ts's
959
- // ugInflight local moved: docs/decisions/2026-08-27-ug-auto-mode-approval.md
960
- // cites a line here by exact number.
961
- if (report.settingsDrift)
962
- warningCount += report.settingsDrift.warnings.length;
963
- if (report.codexConfigDrift)
964
- warningCount += report.codexConfigDrift.warnings.length;
965
578
  if (report.memory.routerExecutable && !report.memory.routerExecutable.exists)
966
579
  errorCount++;
967
580
  if (!report.memory.routerExecutable)
@@ -986,26 +599,18 @@ function countDiagnostics(report) {
986
599
  errorCount += opencodeCounts.errorCount;
987
600
  warningCount += opencodeCounts.warningCount;
988
601
  }
989
- warningCount += report.rogueLedgerDbs.length;
990
602
  return { errorCount, warningCount };
991
603
  }
992
604
  export async function doctor(opts = {}) {
993
- // PLAIN load (task c88461c1, review round 3, decision D-028): every
605
+ // PLAIN load (task c88461c1): every
994
606
  // check this report builds from `manifest` below -- MCP/CLI/hook
995
- // probes, memory, policies, policy packs, workflows, the risk gate,
996
- // template and trigger-boundary drift, grounding, and everything
997
- // else -- reads the base/machine/explicit-`--project` manifest only,
607
+ // probes, memory, policy packs,
608
+ // grounding, and everything else -- reads the base/machine/explicit-`--project` manifest only,
998
609
  // an explicit `opts.project` still wins outright but NOTHING is
999
- // derived from cwd here. This mirrors `harness policy intercept`
1000
- // (src/cli/policy/intercept.ts) and `harness dry-run`
1001
- // (src/cli/dry-run.ts), which never consult a derived project layer
1002
- // either, so `doctor` never reports this repo healthier or unhealthier
1003
- // than what actually enforces. Only `checkSessionStartPreflightSetupVersion`
1004
- // further down gets a project-scoped SECOND load: routing a derived
1005
- // layer through THIS one, unrelated load would let it silently reach
1006
- // every other check in this report, for zero benefit to the one key
1007
- // that needs it.
1008
- const { manifest, resolved } = loadManifest(opts);
610
+ // derived from cwd here, so `doctor` reports the same manifest from any
611
+ // directory and never reports this repo healthier or unhealthier than the
612
+ // machine-level install it describes.
613
+ const { manifest, resolved, warnings: postureWarnings } = loadManifest(opts);
1009
614
  const home = opts.homeOverride ?? opts.homeDir ?? os.homedir();
1010
615
  const probe = opts.mcpProbe ?? new RealMcpProbe();
1011
616
  // Resolved ahead of the MCP / CLI checks (moved up from its previous
@@ -1064,160 +669,14 @@ export async function doctor(opts = {}) {
1064
669
  ...(opts.pathEnv !== undefined ? { pathEnv: opts.pathEnv } : {}),
1065
670
  ...(opts.versionProbe !== undefined ? { versionProbe: opts.versionProbe } : {}),
1066
671
  });
1067
- // One memoized probe shared across every doctor check that spawns
1068
- // `<binary> --version` (task 6993d9b5, round 2 F3/F4): `checkHooks`,
1069
- // `buildPolicyPacks`, the policy-pack-expanded hook walk
1070
- // (`checkPolicyPackHookVersions`, which already deduped internally but
1071
- // started from its own fresh cache) and the new
1072
- // session_start_preflight.setup check below all probe the same
1073
- // `["preflight", "--version"]` argv on a `min_version: 0.6.0` manifest.
1074
- // Without a shared cache that argv would spawn once per caller, per
1075
- // `doctor` run. `memoizeVersionProbe` (above) already existed for
1076
- // this; it just was not wired to the callers that predate the new
1077
- // check.
672
+ // One memoized probe for `checkHooks`: two manifest hooks that share one
673
+ // `version_command` spawn the underlying binary once per `doctor` run
674
+ // (task 6993d9b5, task ab634898).
1078
675
  const dedupedVersionProbe = memoizeVersionProbe(opts.versionProbe ?? (() => null));
1079
676
  const hooks = checkHooks(manifest, home, { versionProbe: dedupedVersionProbe });
1080
- // task 6993d9b5: independent of the generic hooks[] min_version walk
1081
- // above, see session-start-preflight-setup-version.ts for why.
1082
- //
1083
- // Per-repo scoping (task c88461c1, review round 2, decision D-021b;
1084
- // scope narrowed to THIS check only, review round 3, decision D-028):
1085
- // an explicit `opts.project` still wins outright; otherwise derive
1086
- // the project name from `opts.cwd` (defaulting to `process.cwd()`)
1087
- // via the SAME shared `deriveProjectName` helper `harness
1088
- // session-start preflight` and `harness explain-policy` feed their
1089
- // own SECOND load from. Without this, the check judged only the
1090
- // base/machine-override value, so it could warn (or stay silent)
1091
- // against the WRONG effective value for a repo whose cwd-derived
1092
- // project layer flips `setup` the other way, the exact drift the
1093
- // producer (src/cli/session-start/index.ts) and `explain-policy` do
1094
- // not have, since both already derive from cwd for this same key.
1095
- // Deliberately a SEPARATE load from `manifest` above, not a reuse:
1096
- // that load feeds every OTHER check in this report and must stay
1097
- // project-unaware (see the doctor() top comment); folding a derived
1098
- // layer into it would let it silently reach checks it was never
1099
- // meant to touch.
1100
- //
1101
- // `sessionStartPreflightProjectName` (task c88461c1, review round 3
1102
- // residual; narrowed by task 1c4eb3ea's round 2, D-027 item 2) is
1103
- // carried onto the finding ONLY when the scoped load below actually
1104
- // RESOLVED a project layer file (`resolved.projectLayer !== null`,
1105
- // the same signal `resolvePaths` already returns), not merely
1106
- // whenever `deriveProjectName`/`opts.project` produced a name to
1107
- // TRY. Round 1 set this to the attempted name unconditionally, so
1108
- // the `(project: X)` suffix `format.ts` renders was byte-identical
1109
- // whether or not a layer actually existed on disk: `projectName` is
1110
- // present for every cwd inside any git work tree, layer or no
1111
- // layer, which made docs/CLI.md's "distinguishable from a
1112
- // base/machine-decided value" claim false. This version instead
1113
- // only names the project when the base/machine value was genuinely
1114
- // overridden by (or the failed load genuinely attempted) that
1115
- // project's own layer file.
1116
- //
1117
- // Best-effort: a config/parse failure here degrades to `setup:
1118
- // false` (review round 3 residual; task `1c4eb3ea`), matching the
1119
- // producer's own `setupEnabled` catch (`src/cli/session-start/
1120
- // index.ts`). Task 1c4eb3ea's round 2 (D-027 item 3) additionally
1121
- // reports this failure as its own `layer_unresolvable` warning
1122
- // (below) instead of going fully silent, but ONLY when a project
1123
- // layer FILE actually exists to be unresolvable about; a failure
1124
- // that instead comes from the base/machine layers (no project layer
1125
- // on disk for this cwd at all) stays silent here exactly as before,
1126
- // since attributing it to "the project layer" would be wrong and
1127
- // `doctor()`'s own top-level `loadManifest(opts)` call above already
1128
- // surfaces a genuine base/machine parse failure by throwing before
1129
- // this point is ever reached.
1130
- const attemptedSessionStartPreflightProjectName = resolveScopedProjectName({
1131
- project: opts.project,
1132
- cwd: opts.cwd ?? process.cwd(),
1133
- fallback: null,
1134
- });
1135
- const scopedLoadOpts = {
1136
- ...opts,
1137
- project: attemptedSessionStartPreflightProjectName ?? undefined,
1138
- };
1139
- let sessionStartPreflightManifest = manifest;
1140
- let sessionStartPreflightProjectName = null;
1141
- let sessionStartPreflightLayerUnresolvable;
1142
- try {
1143
- const scopedLoad = loadManifest(scopedLoadOpts);
1144
- sessionStartPreflightManifest = scopedLoad.manifest;
1145
- if (scopedLoad.resolved.projectLayer !== null) {
1146
- sessionStartPreflightProjectName = attemptedSessionStartPreflightProjectName;
1147
- }
1148
- }
1149
- catch (err) {
1150
- // This catch itself IS reached in every shipped run with a malformed
1151
- // (or unreadable) project layer for the attempted name; what is
1152
- // actually UNREACHABLE TODAY is only the `unresolvableLayerPath ===
1153
- // null` sub-path below (task `1c4eb3ea`, round 2 mutation-probe
1154
- // replay found the round-1 probe on that line now SURVIVES, traced
1155
- // to this invariant): `doctor()`'s own PLAIN, unscoped
1156
- // `loadManifest(opts)` call at the very top of this function already
1157
- // reads the base manifest and every applicable machine-override
1158
- // layer `scopedLoadOpts` below ALSO reads (`scopedLoadOpts` differs
1159
- // from `opts` ONLY by adding `project`); that call has already
1160
- // succeeded by the time this line runs (a base/machine parse failure
1161
- // would have made `doctor()` itself reject before this point), so a
1162
- // throw reaching this catch can only come from the project layer
1163
- // `scopedLoadOpts.project` adds. `resolvePaths(scopedLoadOpts).projectLayer`
1164
- // therefore always resolves non-null here in every real invocation;
1165
- // the null-check below exists only so a FUTURE change to that "plain
1166
- // load first" invariant fails safe (silent, matching the producer's
1167
- // own `setupEnabled` catch) instead of leaking a stale pre-failure
1168
- // value, not because any fixture in this task's own suite can
1169
- // exercise it: constructing one would require the scoped load to
1170
- // fail for a reason the already-successful plain load could not also
1171
- // have hit, which is structurally impossible given the two calls
1172
- // read the identical base/machine layers.
1173
- //
1174
- // The assignment right below is itself UNOBSERVABLE today, in BOTH
1175
- // sub-paths: whenever `unresolvableLayerPath !== null` (every real
1176
- // invocation, per the invariant above), this degraded value is
1177
- // discarded outright by the `??` below, in favor of
1178
- // `sessionStartPreflightLayerUnresolvable`; the currently-
1179
- // unreachable `unresolvableLayerPath === null` sub-path never even
1180
- // runs to consume it either. It stays as a best-effort fallback for
1181
- // that future-invariant-change case, matching the producer's own
1182
- // `setupEnabled` catch, not because any path today actually reads it.
1183
- sessionStartPreflightManifest = {
1184
- ...manifest,
1185
- session_start_preflight: { ...manifest.session_start_preflight, setup: false },
1186
- };
1187
- // Same call the producer's own diagnostic makes
1188
- // (src/cli/session-start/index.ts): only names/warns about the
1189
- // project layer when `resolvePaths` itself can resolve one for
1190
- // this attempted name; otherwise the thrown error came from the
1191
- // base/machine layers, unrelated to project scoping, and this
1192
- // scoped-load catch stays silent about it (see the comment above).
1193
- // Deliberately unguarded, unlike the producer's copy: `resolvePaths`
1194
- // throws only on the HARNESS_ALLOW_REAL_GENERATED_DIR test-safety
1195
- // path, which the plain load at the top of doctor() has already
1196
- // passed; if that plain-load-first invariant ever moves, this line
1197
- // throws instead of degrading silently, and the producer's try/catch
1198
- // is the shape to copy.
1199
- const unresolvableLayerPath = resolvePaths(scopedLoadOpts).projectLayer;
1200
- if (unresolvableLayerPath !== null) {
1201
- sessionStartPreflightProjectName = attemptedSessionStartPreflightProjectName;
1202
- const errMessage = err instanceof Error ? err.message : String(err);
1203
- const errFirstLine = errMessage.split("\n")[0];
1204
- sessionStartPreflightLayerUnresolvable = {
1205
- kind: "layer_unresolvable",
1206
- actualVersion: null,
1207
- requiredVersion: SESSION_START_PREFLIGHT_SETUP_BUILD_MIN_VERSION,
1208
- message: `session_start_preflight.setup: the project-scoped manifest load failed ` +
1209
- `(${errFirstLine}); the effective setup value for this repo could not be ` +
1210
- `determined (project layer: ${unresolvableLayerPath})`,
1211
- projectName: sessionStartPreflightProjectName,
1212
- };
1213
- }
1214
- }
1215
- const sessionStartPreflightSetupVersion = sessionStartPreflightLayerUnresolvable ??
1216
- checkSessionStartPreflightSetupVersion(sessionStartPreflightManifest, dedupedVersionProbe, sessionStartPreflightProjectName);
1217
677
  // generatedDir resolved the same way apply.ts / interactive.ts resolve
1218
- // it, so buildClaudeMcpRegistration's
1219
- // desired projection carries SOLUTION_VERDICT_SIGNING_KEY too, and so
1220
- // the runtime below is read from the very `.last-apply` apply reads.
678
+ // it, so the runtime below is read from the very `.last-apply` apply
679
+ // reads.
1221
680
  const generatedDir = resolveGeneratedDir({
1222
681
  ...(opts.homeDir !== undefined ? { homeDir: opts.homeDir } : {}),
1223
682
  manifestPath: resolved.base,
@@ -1225,10 +684,9 @@ export async function doctor(opts = {}) {
1225
684
  });
1226
685
  // The runtime a plain `harness apply` would select, through apply's own
1227
686
  // `selectRuntime` (recorded, inferred or default; `--target` is an
1228
- // apply flag, not a doctor input). Pack expansion below uses it, so
1229
- // doctor checks the hooks the machine actually gets (task 04b8abcf).
1230
- // A malformed `.last-apply` must not kill doctor (base doctor never read
1231
- // it unless the understanding pack was declared): fall back to the
687
+ // apply flag, not a doctor input). The declared-but-not-live pack check
688
+ // below resolves packs against it (task 04b8abcf).
689
+ // A malformed `.last-apply` must not kill doctor: fall back to the
1232
690
  // default selection and warn, naming the file.
1233
691
  let lastApplyRecord = null;
1234
692
  let lastApplyWarning;
@@ -1241,14 +699,7 @@ export async function doctor(opts = {}) {
1241
699
  "expanding policy packs against the default runtime";
1242
700
  }
1243
701
  const applyRuntime = selectRuntime(undefined, lastApplyRecord, false);
1244
- const policies = buildPolicies(manifest);
1245
- const policyPacks = buildPolicyPacks(manifest, dedupedVersionProbe, resolveGitIgnoreProbe(opts), applyRuntime.runtime);
1246
- const policyPackHookVersions = checkPolicyPackHookVersions(manifest, dedupedVersionProbe, applyRuntime.runtime);
1247
- const workflows = buildWorkflows(manifest);
1248
- const riskGate = buildRiskGate(manifest);
1249
- const templateDrift = buildTemplateDrift(manifest);
1250
- const triggerBoundaryDrift = buildTriggerBoundaryDrift(manifest);
1251
- const hookBudgetLedgerMargin = buildHookBudgetLedgerMargin(manifest);
702
+ const policyPacks = buildPolicyPacks(manifest, applyRuntime.runtime);
1252
703
  const groundingServer = manifest.tools.mcp.find((m) => m.name === GROUNDING_MCP_SERVER_NAME && m.enabled !== false) ?? null;
1253
704
  const grounding = groundingServer !== null
1254
705
  ? buildGrounding(manifest, groundingServer, home)
@@ -1262,108 +713,21 @@ export async function doctor(opts = {}) {
1262
713
  const claudeMcp = manifest.tools.mcp.length > 0
1263
714
  ? await buildClaudeMcpRegistration(manifest, {
1264
715
  home,
1265
- generatedDir,
1266
716
  shallow: !!opts.shallow,
1267
717
  ...(opts.claudeMcpExec !== undefined ? { claudeMcpExec: opts.claudeMcpExec } : {}),
1268
718
  ...(opts.envOverride !== undefined ? { env: opts.envOverride } : {}),
1269
719
  })
1270
720
  : undefined;
1271
- const understandingModeEnv = checkUnderstandingModeEnvDivergence(manifest, opts.envOverride ?? process.env);
1272
- const ugAutoApproveMode = checkAutoApproveMode(manifest);
1273
- const ugExpireOnToolMatch = checkExpireOnToolMatch(manifest);
1274
- // ADR docs/decisions/2026-08-27-ug-auto-mode-approval.md slice 1
1275
- // (agent-tasks 74b4b17d), "Audit and doctor": the auto-approval
1276
- // listing + last-N metric, and the settings-drift compensating
1277
- // control for threat model (c)'s defaultMode/hook-roster plant. Both
1278
- // gated on the pack being declared and enabled (same gate as
1279
- // `understandingModeEnv` above) — a manifest that never uses the pack
1280
- // has no auto-approval markers or auto-approve config to drift.
1281
- const recentSessionsWindow = opts.recentSessions ?? DEFAULT_RECENT_SESSIONS;
1282
- if (!Number.isInteger(recentSessionsWindow) || recentSessionsWindow < 1) {
1283
- throw new Error(`doctor: recentSessions must be an integer >= 1, got ${JSON.stringify(opts.recentSessions)}`);
1284
- }
1285
- const understandingPackEnabled = isUnderstandingPackEnabled(manifest);
1286
- const ugAutoApprovals = understandingPackEnabled
1287
- ? buildUgAutoApprovals(generatedDir, { recentSessions: recentSessionsWindow })
1288
- : undefined;
1289
- // Slice 3 (agent-tasks 37ad0b05), same "Audit and doctor"
1290
- // section: delegations-on-disk metric from `.delegations/`, gated on
1291
- // the same pack-enabled check, computed even when the directory is
1292
- // absent (`delegationsDirPresent: false`, `total: 0`), the render
1293
- // layer (format.ts) is what stays silent for that case, mirroring
1294
- // `ugAutoApprovals`'s own `approvalsDirPresent` gate; see
1295
- // ug-delegations.ts.
1296
- const ugDelegations = understandingPackEnabled
1297
- ? buildUgDelegations(generatedDir, { ...(opts.now !== undefined ? { now: opts.now } : {}) })
1298
- : undefined;
1299
- // Subagent-gate slice 1: in-flight-records-on-disk metric from
1300
- // `.inflight/`, same gate and "computed even when the directory is
1301
- // absent" posture as `ugDelegations` immediately above; see
1302
- // ug-inflight.ts.
1303
- const ugInflight = understandingPackEnabled
1304
- ? buildUgInflight(generatedDir, { ...(opts.now !== undefined ? { now: opts.now } : {}) })
1305
- : undefined;
1306
- // Task 8f637efd ("Amendment: install default"): bypassPermissions
1307
- // observed (hook-side) but auto_approve missing/mismatched. Same gate
1308
- // and same recentSessions window as ugAutoApprovals, reading a
1309
- // different on-disk directory (.permission-mode-observations/, not
1310
- // .approvals/).
1311
- const ugBypassWithoutAutoApprove = understandingPackEnabled
1312
- ? checkBypassWithoutAutoApprove(manifest, generatedDir, {
1313
- recentSessions: recentSessionsWindow,
1314
- })
1315
- : undefined;
1316
- // Shared option shape both drift checks below take (same manifest,
1317
- // same generated dir, same lock, same cwd/home/env resolution), one
1318
- // literal instead of two near-identical ones (`buildSettingsDrift` and
1319
- // `buildCodexConfigDrift` both accept exactly this shape).
1320
- const driftCheckOpts = {
1321
- generatedDir,
1322
- lockPath: path.join(path.dirname(resolved.base), LOCK_BASENAME),
1323
- cwd: opts.cwd ?? process.cwd(),
1324
- home,
1325
- env: opts.envOverride ?? process.env,
1326
- };
1327
- // Settings-drift additionally requires `harness.generated/` to exist:
1328
- // without at least one prior `harness apply`, there is no baseline to
1329
- // compare against and nothing this check owns an opinion about (a
1330
- // fresh manifest that declares the pack but has never been applied
1331
- // must stay exactly as quiet as today — see the doctor-understanding-
1332
- // mode-env fixture that already asserts a bare "Environment"-less
1333
- // report for that exact shape).
1334
- const settingsDrift = understandingPackEnabled && fs.existsSync(generatedDir)
1335
- ? buildSettingsDrift(driftCheckOpts)
1336
- : undefined;
1337
- // Codex counterpart of `settingsDrift` (follow-up of slice 2 of the
1338
- // same ADR, agent-tasks f59ea0eb). Gated on the pack's
1339
- // `auto_approve.harnesses` actually listing `codex` rather than on
1340
- // `understandingPackEnabled` alone, and NOT gated on
1341
- // `harness.generated/` existing: unlike `permissions.defaultMode`,
1342
- // `approval_policy = "never"` is a live risk the moment it is present,
1343
- // whether or not a `harness apply` has ever run for this manifest (see
1344
- // codex-config-drift.ts's module header).
1345
- const codexConfigDrift = isCodexOptedIntoAutoApprove(manifest)
1346
- ? buildCodexConfigDrift(driftCheckOpts)
1347
- : undefined;
1348
- // Toolchain-parity on-demand comparison (task 13919613). Gated purely on
1349
- // `toolchain_parity.enabled` — mirrors `grounding`'s "only when the
1350
- // feature is actually in use" gating, so a manifest that never opted
1351
- // into the SessionStart companion sees no section at all here either.
1352
- const toolchainParity = manifest.toolchain_parity.enabled
1353
- ? await runDoctorToolchainParity(manifest, {
1354
- shallow: !!opts.shallow,
1355
- ...(opts.now !== undefined ? { now: opts.now } : {}),
1356
- ...opts.toolchainParityOptions,
721
+ const manifestSec = manifestSection(manifest, postureWarnings);
722
+ const livenessTargets = livenessRuntimes(applyRuntime.runtime, opts.target);
723
+ const hookLiveness = livenessTargets.length > 0
724
+ ? buildHookLiveness(manifest, {
725
+ home,
726
+ env: opts.envOverride ?? process.env,
727
+ runtimes: livenessTargets,
728
+ ...(opts.codexLiveConfigPath !== undefined ? { codexConfigPath: opts.codexLiveConfigPath } : {}),
1357
729
  })
1358
730
  : undefined;
1359
- const manifestSec = manifestSection(manifest);
1360
- const rogueLedgerDbs = scanForRogueLedgers({
1361
- homeDir: opts.rogueLedgerScanOptions?.homeDir ?? home,
1362
- cwd: opts.rogueLedgerScanOptions?.cwd ?? process.cwd(),
1363
- ...(opts.rogueLedgerScanOptions?.fsInterface !== undefined
1364
- ? { fsInterface: opts.rogueLedgerScanOptions.fsInterface }
1365
- : {}),
1366
- });
1367
731
  const partial = {
1368
732
  manifestPath: resolved.base,
1369
733
  manifestVersion: manifest.version,
@@ -1373,32 +737,12 @@ export async function doctor(opts = {}) {
1373
737
  tools,
1374
738
  memory,
1375
739
  hooks,
1376
- policies,
740
+ ...(hookLiveness !== undefined ? { hookLiveness } : {}),
1377
741
  policyPacks,
1378
- policyPackHookVersions,
1379
742
  packExpansionRuntime: packExpansionRuntimeReport(applyRuntime, lastApplyWarning),
1380
- workflows,
1381
- riskGate,
1382
- templateDrift,
1383
- triggerBoundaryDrift,
1384
- hookBudgetLedgerMargin,
1385
743
  ...(grounding !== undefined ? { grounding } : {}),
1386
744
  ...(claudeMcp !== undefined ? { claudeMcp } : {}),
1387
- ...(toolchainParity !== undefined ? { toolchainParity } : {}),
1388
- rogueLedgerDbs,
1389
745
  ...(npmGlobalBin !== undefined ? { npmGlobalBin } : {}),
1390
- ...(understandingModeEnv !== undefined ? { understandingModeEnv } : {}),
1391
- ...(ugAutoApprovals !== undefined ? { ugAutoApprovals } : {}),
1392
- ...(ugDelegations !== undefined ? { ugDelegations } : {}),
1393
- ...(ugInflight !== undefined ? { ugInflight } : {}),
1394
- ...(ugBypassWithoutAutoApprove !== undefined ? { ugBypassWithoutAutoApprove } : {}),
1395
- ...(sessionStartPreflightSetupVersion !== undefined
1396
- ? { sessionStartPreflightSetupVersion }
1397
- : {}),
1398
- ...(ugAutoApproveMode !== undefined ? { ugAutoApproveMode } : {}),
1399
- ...(ugExpireOnToolMatch !== undefined ? { ugExpireOnToolMatch } : {}),
1400
- ...(settingsDrift !== undefined ? { settingsDrift } : {}),
1401
- ...(codexConfigDrift !== undefined ? { codexConfigDrift } : {}),
1402
746
  };
1403
747
  if (opts.target === "codex") {
1404
748
  const manifestDir = path.dirname(resolved.base);