audit-tools 0.55.20 → 0.56.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (784) hide show
  1. package/dist/audit/cli/auditStep.d.ts.map +1 -1
  2. package/dist/audit/cli/auditStep.js +6 -8
  3. package/dist/audit/cli/auditStep.js.map +1 -1
  4. package/dist/audit/cli/charterExtractionPrompt.d.ts +2 -4
  5. package/dist/audit/cli/charterExtractionPrompt.d.ts.map +1 -1
  6. package/dist/audit/cli/charterExtractionPrompt.js +15 -0
  7. package/dist/audit/cli/charterExtractionPrompt.js.map +1 -1
  8. package/dist/audit/cli/cleanup.js +2 -2
  9. package/dist/audit/cli/cleanup.js.map +1 -1
  10. package/dist/audit/cli/cleanupCommand.d.ts.map +1 -1
  11. package/dist/audit/cli/cleanupCommand.js +11 -10
  12. package/dist/audit/cli/cleanupCommand.js.map +1 -1
  13. package/dist/audit/cli/conceptualDispatch.d.ts.map +1 -1
  14. package/dist/audit/cli/conceptualDispatch.js +26 -20
  15. package/dist/audit/cli/conceptualDispatch.js.map +1 -1
  16. package/dist/audit/cli/confirmIntentStep.d.ts.map +1 -1
  17. package/dist/audit/cli/confirmIntentStep.js +3 -5
  18. package/dist/audit/cli/confirmIntentStep.js.map +1 -1
  19. package/dist/audit/cli/dispatch/hostHandoff.d.ts.map +1 -1
  20. package/dist/audit/cli/dispatch/hostHandoff.js +46 -68
  21. package/dist/audit/cli/dispatch/hostHandoff.js.map +1 -1
  22. package/dist/audit/cli/explainTaskCommand.d.ts.map +1 -1
  23. package/dist/audit/cli/explainTaskCommand.js +3 -2
  24. package/dist/audit/cli/explainTaskCommand.js.map +1 -1
  25. package/dist/audit/cli/fanoutLanes.d.ts.map +1 -1
  26. package/dist/audit/cli/fanoutLanes.js +7 -6
  27. package/dist/audit/cli/fanoutLanes.js.map +1 -1
  28. package/dist/audit/cli/laneSubmissions.d.ts +0 -13
  29. package/dist/audit/cli/laneSubmissions.d.ts.map +1 -1
  30. package/dist/audit/cli/laneSubmissions.js +28 -19
  31. package/dist/audit/cli/laneSubmissions.js.map +1 -1
  32. package/dist/audit/cli/laneValidators.d.ts +7 -1
  33. package/dist/audit/cli/laneValidators.d.ts.map +1 -1
  34. package/dist/audit/cli/laneValidators.js +15 -10
  35. package/dist/audit/cli/laneValidators.js.map +1 -1
  36. package/dist/audit/cli/lineIndex.d.ts.map +1 -1
  37. package/dist/audit/cli/lineIndex.js +4 -3
  38. package/dist/audit/cli/lineIndex.js.map +1 -1
  39. package/dist/audit/cli/nextStepCommand.d.ts.map +1 -1
  40. package/dist/audit/cli/nextStepCommand.js +6 -7
  41. package/dist/audit/cli/nextStepCommand.js.map +1 -1
  42. package/dist/audit/cli/nextStepHelpers.d.ts +29 -17
  43. package/dist/audit/cli/nextStepHelpers.d.ts.map +1 -1
  44. package/dist/audit/cli/nextStepHelpers.js +75 -130
  45. package/dist/audit/cli/nextStepHelpers.js.map +1 -1
  46. package/dist/audit/cli/recoverSubmissionCommand.d.ts.map +1 -1
  47. package/dist/audit/cli/recoverSubmissionCommand.js +5 -4
  48. package/dist/audit/cli/recoverSubmissionCommand.js.map +1 -1
  49. package/dist/audit/cli/resynthesizeCommand.d.ts.map +1 -1
  50. package/dist/audit/cli/resynthesizeCommand.js +3 -1
  51. package/dist/audit/cli/resynthesizeCommand.js.map +1 -1
  52. package/dist/audit/cli/reviewRun.d.ts +0 -6
  53. package/dist/audit/cli/reviewRun.d.ts.map +1 -1
  54. package/dist/audit/cli/reviewRun.js +11 -18
  55. package/dist/audit/cli/reviewRun.js.map +1 -1
  56. package/dist/audit/cli/reviewSubmission.d.ts.map +1 -1
  57. package/dist/audit/cli/reviewSubmission.js +16 -8
  58. package/dist/audit/cli/reviewSubmission.js.map +1 -1
  59. package/dist/audit/cli/semanticReviewStep.d.ts +5 -5
  60. package/dist/audit/cli/semanticReviewStep.d.ts.map +1 -1
  61. package/dist/audit/cli/semanticReviewStep.js +5 -0
  62. package/dist/audit/cli/semanticReviewStep.js.map +1 -1
  63. package/dist/audit/cli/statusCommand.d.ts.map +1 -1
  64. package/dist/audit/cli/statusCommand.js +3 -2
  65. package/dist/audit/cli/statusCommand.js.map +1 -1
  66. package/dist/audit/cli/steps.d.ts +11 -11
  67. package/dist/audit/cli/steps.d.ts.map +1 -1
  68. package/dist/audit/cli/steps.js +11 -11
  69. package/dist/audit/cli/steps.js.map +1 -1
  70. package/dist/audit/cli/submitCommand.d.ts.map +1 -1
  71. package/dist/audit/cli/submitCommand.js +9 -4
  72. package/dist/audit/cli/submitCommand.js.map +1 -1
  73. package/dist/audit/cli/submitGateResult.d.ts.map +1 -1
  74. package/dist/audit/cli/submitGateResult.js +2 -1
  75. package/dist/audit/cli/submitGateResult.js.map +1 -1
  76. package/dist/audit/cli/unacceptResultsCommand.d.ts +3 -2
  77. package/dist/audit/cli/unacceptResultsCommand.d.ts.map +1 -1
  78. package/dist/audit/cli/unacceptResultsCommand.js +8 -6
  79. package/dist/audit/cli/unacceptResultsCommand.js.map +1 -1
  80. package/dist/audit/cli/validateResultsCommand.d.ts.map +1 -1
  81. package/dist/audit/cli/validateResultsCommand.js +5 -4
  82. package/dist/audit/cli/validateResultsCommand.js.map +1 -1
  83. package/dist/audit/cli.d.ts +0 -2
  84. package/dist/audit/cli.d.ts.map +1 -1
  85. package/dist/audit/cli.js +2 -2
  86. package/dist/audit/cli.js.map +1 -1
  87. package/dist/audit/decompose/buildStructureDecomposition.d.ts.map +1 -1
  88. package/dist/audit/decompose/buildStructureDecomposition.js +5 -5
  89. package/dist/audit/decompose/buildStructureDecomposition.js.map +1 -1
  90. package/dist/audit/extractors/analyzers/merge.d.ts.map +1 -1
  91. package/dist/audit/extractors/analyzers/merge.js +4 -11
  92. package/dist/audit/extractors/analyzers/merge.js.map +1 -1
  93. package/dist/audit/extractors/analyzers/typescript.d.ts.map +1 -1
  94. package/dist/audit/extractors/analyzers/typescript.js +3 -14
  95. package/dist/audit/extractors/analyzers/typescript.js.map +1 -1
  96. package/dist/audit/extractors/browserExtension.d.ts.map +1 -1
  97. package/dist/audit/extractors/browserExtension.js +3 -2
  98. package/dist/audit/extractors/browserExtension.js.map +1 -1
  99. package/dist/audit/extractors/commentDecomposition.d.ts +1 -1
  100. package/dist/audit/extractors/commentDecomposition.d.ts.map +1 -1
  101. package/dist/audit/extractors/commentDecomposition.js +16 -33
  102. package/dist/audit/extractors/commentDecomposition.js.map +1 -1
  103. package/dist/audit/extractors/dataStateCoupling.d.ts +4 -0
  104. package/dist/audit/extractors/dataStateCoupling.d.ts.map +1 -1
  105. package/dist/audit/extractors/dataStateCoupling.js +26 -12
  106. package/dist/audit/extractors/dataStateCoupling.js.map +1 -1
  107. package/dist/audit/extractors/designAssessment.js +1 -1
  108. package/dist/audit/extractors/designAssessment.js.map +1 -1
  109. package/dist/audit/extractors/disposition.d.ts.map +1 -1
  110. package/dist/audit/extractors/disposition.js +24 -40
  111. package/dist/audit/extractors/disposition.js.map +1 -1
  112. package/dist/audit/extractors/docsDigest.js +1 -1
  113. package/dist/audit/extractors/docsDigest.js.map +1 -1
  114. package/dist/audit/extractors/flows.d.ts.map +1 -1
  115. package/dist/audit/extractors/flows.js +23 -19
  116. package/dist/audit/extractors/flows.js.map +1 -1
  117. package/dist/audit/extractors/fsIntake.d.ts.map +1 -1
  118. package/dist/audit/extractors/fsIntake.js +8 -5
  119. package/dist/audit/extractors/fsIntake.js.map +1 -1
  120. package/dist/audit/extractors/gitHistory.d.ts +6 -6
  121. package/dist/audit/extractors/gitHistory.d.ts.map +1 -1
  122. package/dist/audit/extractors/gitHistory.js +6 -6
  123. package/dist/audit/extractors/gitHistory.js.map +1 -1
  124. package/dist/audit/extractors/graph.d.ts +3 -1
  125. package/dist/audit/extractors/graph.d.ts.map +1 -1
  126. package/dist/audit/extractors/graph.js +15 -17
  127. package/dist/audit/extractors/graph.js.map +1 -1
  128. package/dist/audit/extractors/graphManifestEdges/packageJson.d.ts.map +1 -1
  129. package/dist/audit/extractors/graphManifestEdges/packageJson.js +23 -40
  130. package/dist/audit/extractors/graphManifestEdges/packageJson.js.map +1 -1
  131. package/dist/audit/extractors/graphPathUtils.d.ts +9 -0
  132. package/dist/audit/extractors/graphPathUtils.d.ts.map +1 -1
  133. package/dist/audit/extractors/graphPathUtils.js +35 -16
  134. package/dist/audit/extractors/graphPathUtils.js.map +1 -1
  135. package/dist/audit/extractors/graphRoutes.d.ts.map +1 -1
  136. package/dist/audit/extractors/graphRoutes.js +3 -7
  137. package/dist/audit/extractors/graphRoutes.js.map +1 -1
  138. package/dist/audit/extractors/graphSignals.d.ts.map +1 -1
  139. package/dist/audit/extractors/graphSignals.js +40 -29
  140. package/dist/audit/extractors/graphSignals.js.map +1 -1
  141. package/dist/audit/extractors/graphSuites.d.ts.map +1 -1
  142. package/dist/audit/extractors/graphSuites.js +4 -7
  143. package/dist/audit/extractors/graphSuites.js.map +1 -1
  144. package/dist/audit/extractors/graphTestSources.d.ts.map +1 -1
  145. package/dist/audit/extractors/graphTestSources.js +3 -10
  146. package/dist/audit/extractors/graphTestSources.js.map +1 -1
  147. package/dist/audit/extractors/pathPatterns.d.ts +4 -2
  148. package/dist/audit/extractors/pathPatterns.d.ts.map +1 -1
  149. package/dist/audit/extractors/pathPatterns.js +13 -21
  150. package/dist/audit/extractors/pathPatterns.js.map +1 -1
  151. package/dist/audit/extractors/risk.d.ts.map +1 -1
  152. package/dist/audit/extractors/risk.js +7 -7
  153. package/dist/audit/extractors/risk.js.map +1 -1
  154. package/dist/audit/extractors/surfaces.d.ts.map +1 -1
  155. package/dist/audit/extractors/surfaces.js +3 -9
  156. package/dist/audit/extractors/surfaces.js.map +1 -1
  157. package/dist/audit/io/artifacts.d.ts +1 -3
  158. package/dist/audit/io/artifacts.d.ts.map +1 -1
  159. package/dist/audit/io/artifacts.js +9 -9
  160. package/dist/audit/io/artifacts.js.map +1 -1
  161. package/dist/audit/io/rollover.d.ts.map +1 -1
  162. package/dist/audit/io/rollover.js +0 -1
  163. package/dist/audit/io/rollover.js.map +1 -1
  164. package/dist/audit/io/runArtifacts.d.ts +30 -2
  165. package/dist/audit/io/runArtifacts.d.ts.map +1 -1
  166. package/dist/audit/io/runArtifacts.js +23 -23
  167. package/dist/audit/io/runArtifacts.js.map +1 -1
  168. package/dist/audit/io/runSnapshot.js +2 -2
  169. package/dist/audit/io/runSnapshot.js.map +1 -1
  170. package/dist/audit/io/toolingManifest.d.ts.map +1 -1
  171. package/dist/audit/io/toolingManifest.js +7 -9
  172. package/dist/audit/io/toolingManifest.js.map +1 -1
  173. package/dist/audit/orchestrator/advance.d.ts +6 -0
  174. package/dist/audit/orchestrator/advance.d.ts.map +1 -1
  175. package/dist/audit/orchestrator/advance.js +70 -95
  176. package/dist/audit/orchestrator/advance.js.map +1 -1
  177. package/dist/audit/orchestrator/architectureDiscovery.d.ts +6 -2
  178. package/dist/audit/orchestrator/architectureDiscovery.d.ts.map +1 -1
  179. package/dist/audit/orchestrator/architectureDiscovery.js +19 -14
  180. package/dist/audit/orchestrator/architectureDiscovery.js.map +1 -1
  181. package/dist/audit/orchestrator/artifactMetadata.d.ts.map +1 -1
  182. package/dist/audit/orchestrator/artifactMetadata.js +12 -15
  183. package/dist/audit/orchestrator/artifactMetadata.js.map +1 -1
  184. package/dist/audit/orchestrator/auditTaskUtils.d.ts +13 -0
  185. package/dist/audit/orchestrator/auditTaskUtils.d.ts.map +1 -1
  186. package/dist/audit/orchestrator/auditTaskUtils.js +10 -3
  187. package/dist/audit/orchestrator/auditTaskUtils.js.map +1 -1
  188. package/dist/audit/orchestrator/autoFixExecutor.d.ts.map +1 -1
  189. package/dist/audit/orchestrator/autoFixExecutor.js +2 -8
  190. package/dist/audit/orchestrator/autoFixExecutor.js.map +1 -1
  191. package/dist/audit/orchestrator/charterClarificationExecutor.d.ts +4 -2
  192. package/dist/audit/orchestrator/charterClarificationExecutor.d.ts.map +1 -1
  193. package/dist/audit/orchestrator/charterClarificationExecutor.js +12 -20
  194. package/dist/audit/orchestrator/charterClarificationExecutor.js.map +1 -1
  195. package/dist/audit/orchestrator/charterComparisonExecutor.d.ts.map +1 -1
  196. package/dist/audit/orchestrator/charterComparisonExecutor.js +5 -9
  197. package/dist/audit/orchestrator/charterComparisonExecutor.js.map +1 -1
  198. package/dist/audit/orchestrator/charterExtractionExecutor.d.ts +5 -0
  199. package/dist/audit/orchestrator/charterExtractionExecutor.d.ts.map +1 -1
  200. package/dist/audit/orchestrator/charterExtractionExecutor.js +10 -5
  201. package/dist/audit/orchestrator/charterExtractionExecutor.js.map +1 -1
  202. package/dist/audit/orchestrator/charterFidelityPacket.d.ts.map +1 -1
  203. package/dist/audit/orchestrator/charterFidelityPacket.js +1 -2
  204. package/dist/audit/orchestrator/charterFidelityPacket.js.map +1 -1
  205. package/dist/audit/orchestrator/charterPacketArchive.d.ts.map +1 -1
  206. package/dist/audit/orchestrator/charterPacketArchive.js +11 -7
  207. package/dist/audit/orchestrator/charterPacketArchive.js.map +1 -1
  208. package/dist/audit/orchestrator/charterPackets.d.ts.map +1 -1
  209. package/dist/audit/orchestrator/charterPackets.js +30 -69
  210. package/dist/audit/orchestrator/charterPackets.js.map +1 -1
  211. package/dist/audit/orchestrator/dependencyMap.d.ts +0 -1
  212. package/dist/audit/orchestrator/dependencyMap.d.ts.map +1 -1
  213. package/dist/audit/orchestrator/dependencyMap.js +0 -7
  214. package/dist/audit/orchestrator/dependencyMap.js.map +1 -1
  215. package/dist/audit/orchestrator/dependencySlices.d.ts +20 -0
  216. package/dist/audit/orchestrator/dependencySlices.d.ts.map +1 -1
  217. package/dist/audit/orchestrator/dependencySlices.js +20 -20
  218. package/dist/audit/orchestrator/dependencySlices.js.map +1 -1
  219. package/dist/audit/orchestrator/designReviewProjection.d.ts +1 -3
  220. package/dist/audit/orchestrator/designReviewProjection.d.ts.map +1 -1
  221. package/dist/audit/orchestrator/designReviewProjection.js +8 -2
  222. package/dist/audit/orchestrator/designReviewProjection.js.map +1 -1
  223. package/dist/audit/orchestrator/designReviewPrompt.d.ts +2 -11
  224. package/dist/audit/orchestrator/designReviewPrompt.d.ts.map +1 -1
  225. package/dist/audit/orchestrator/designReviewPrompt.js +10 -25
  226. package/dist/audit/orchestrator/designReviewPrompt.js.map +1 -1
  227. package/dist/audit/orchestrator/designReviewSnapshot.d.ts.map +1 -1
  228. package/dist/audit/orchestrator/designReviewSnapshot.js +1 -2
  229. package/dist/audit/orchestrator/designReviewSnapshot.js.map +1 -1
  230. package/dist/audit/orchestrator/designReviewTask.d.ts.map +1 -1
  231. package/dist/audit/orchestrator/designReviewTask.js +2 -2
  232. package/dist/audit/orchestrator/designReviewTask.js.map +1 -1
  233. package/dist/audit/orchestrator/edgeReasoning.d.ts.map +1 -1
  234. package/dist/audit/orchestrator/edgeReasoning.js +1 -3
  235. package/dist/audit/orchestrator/edgeReasoning.js.map +1 -1
  236. package/dist/audit/orchestrator/executorResult.d.ts +3 -32
  237. package/dist/audit/orchestrator/executorResult.d.ts.map +1 -1
  238. package/dist/audit/orchestrator/executorRunners.d.ts.map +1 -1
  239. package/dist/audit/orchestrator/executorRunners.js +33 -43
  240. package/dist/audit/orchestrator/executorRunners.js.map +1 -1
  241. package/dist/audit/orchestrator/executors.d.ts +34 -0
  242. package/dist/audit/orchestrator/executors.d.ts.map +1 -1
  243. package/dist/audit/orchestrator/executors.js +19 -4
  244. package/dist/audit/orchestrator/executors.js.map +1 -1
  245. package/dist/audit/orchestrator/fileIntegrity.d.ts.map +1 -1
  246. package/dist/audit/orchestrator/fileIntegrity.js +4 -3
  247. package/dist/audit/orchestrator/fileIntegrity.js.map +1 -1
  248. package/dist/audit/orchestrator/flowPlanning.d.ts.map +1 -1
  249. package/dist/audit/orchestrator/flowPlanning.js +2 -2
  250. package/dist/audit/orchestrator/flowPlanning.js.map +1 -1
  251. package/dist/audit/orchestrator/flowRequeue.d.ts.map +1 -1
  252. package/dist/audit/orchestrator/flowRequeue.js +2 -3
  253. package/dist/audit/orchestrator/flowRequeue.js.map +1 -1
  254. package/dist/audit/orchestrator/graphEnrichmentExecutor.d.ts.map +1 -1
  255. package/dist/audit/orchestrator/graphEnrichmentExecutor.js +5 -18
  256. package/dist/audit/orchestrator/graphEnrichmentExecutor.js.map +1 -1
  257. package/dist/audit/orchestrator/hostInputPause.d.ts +4 -20
  258. package/dist/audit/orchestrator/hostInputPause.d.ts.map +1 -1
  259. package/dist/audit/orchestrator/hostInputPause.js +4 -3
  260. package/dist/audit/orchestrator/hostInputPause.js.map +1 -1
  261. package/dist/audit/orchestrator/ingestionExecutors.d.ts.map +1 -1
  262. package/dist/audit/orchestrator/ingestionExecutors.js +5 -17
  263. package/dist/audit/orchestrator/ingestionExecutors.js.map +1 -1
  264. package/dist/audit/orchestrator/intentCheckpointExecutor.d.ts +1 -2
  265. package/dist/audit/orchestrator/intentCheckpointExecutor.d.ts.map +1 -1
  266. package/dist/audit/orchestrator/intentCheckpointExecutor.js +42 -53
  267. package/dist/audit/orchestrator/intentCheckpointExecutor.js.map +1 -1
  268. package/dist/audit/orchestrator/intentCheckpointGate.d.ts +1 -1
  269. package/dist/audit/orchestrator/intentCheckpointGate.d.ts.map +1 -1
  270. package/dist/audit/orchestrator/intentCheckpointGate.js +12 -8
  271. package/dist/audit/orchestrator/intentCheckpointGate.js.map +1 -1
  272. package/dist/audit/orchestrator/intentEquivalenceExecutor.d.ts.map +1 -1
  273. package/dist/audit/orchestrator/intentEquivalenceExecutor.js +13 -22
  274. package/dist/audit/orchestrator/intentEquivalenceExecutor.js.map +1 -1
  275. package/dist/audit/orchestrator/lineCounts.d.ts +2 -0
  276. package/dist/audit/orchestrator/lineCounts.d.ts.map +1 -1
  277. package/dist/audit/orchestrator/lineCounts.js +4 -0
  278. package/dist/audit/orchestrator/lineCounts.js.map +1 -1
  279. package/dist/audit/orchestrator/obligationPolicy.d.ts.map +1 -1
  280. package/dist/audit/orchestrator/obligationPolicy.js +46 -48
  281. package/dist/audit/orchestrator/obligationPolicy.js.map +1 -1
  282. package/dist/audit/orchestrator/pendingTasks.d.ts.map +1 -1
  283. package/dist/audit/orchestrator/pendingTasks.js +4 -3
  284. package/dist/audit/orchestrator/pendingTasks.js.map +1 -1
  285. package/dist/audit/orchestrator/planningExecutors.d.ts.map +1 -1
  286. package/dist/audit/orchestrator/planningExecutors.js +5 -1
  287. package/dist/audit/orchestrator/planningExecutors.js.map +1 -1
  288. package/dist/audit/orchestrator/requeue.d.ts.map +1 -1
  289. package/dist/audit/orchestrator/requeue.js +2 -2
  290. package/dist/audit/orchestrator/requeue.js.map +1 -1
  291. package/dist/audit/orchestrator/requeueCommand.d.ts.map +1 -1
  292. package/dist/audit/orchestrator/requeueCommand.js +13 -21
  293. package/dist/audit/orchestrator/requeueCommand.js.map +1 -1
  294. package/dist/audit/orchestrator/resultIngestion.d.ts.map +1 -1
  295. package/dist/audit/orchestrator/resultIngestion.js +3 -4
  296. package/dist/audit/orchestrator/resultIngestion.js.map +1 -1
  297. package/dist/audit/orchestrator/reviewPacketGraphContext.js +1 -1
  298. package/dist/audit/orchestrator/reviewPacketGraphContext.js.map +1 -1
  299. package/dist/audit/orchestrator/reviewPacketGraphEdges.d.ts +2 -8
  300. package/dist/audit/orchestrator/reviewPacketGraphEdges.d.ts.map +1 -1
  301. package/dist/audit/orchestrator/reviewPacketGraphEdges.js +6 -38
  302. package/dist/audit/orchestrator/reviewPacketGraphEdges.js.map +1 -1
  303. package/dist/audit/orchestrator/reviewPacketMetrics.d.ts.map +1 -1
  304. package/dist/audit/orchestrator/reviewPacketMetrics.js +7 -68
  305. package/dist/audit/orchestrator/reviewPacketMetrics.js.map +1 -1
  306. package/dist/audit/orchestrator/reviewPacketShared.d.ts +0 -2
  307. package/dist/audit/orchestrator/reviewPacketShared.d.ts.map +1 -1
  308. package/dist/audit/orchestrator/reviewPacketShared.js.map +1 -1
  309. package/dist/audit/orchestrator/reviewPacketSizing.d.ts +1 -3
  310. package/dist/audit/orchestrator/reviewPacketSizing.d.ts.map +1 -1
  311. package/dist/audit/orchestrator/reviewPacketSizing.js +3 -13
  312. package/dist/audit/orchestrator/reviewPacketSizing.js.map +1 -1
  313. package/dist/audit/orchestrator/reviewPackets.d.ts +7 -8
  314. package/dist/audit/orchestrator/reviewPackets.d.ts.map +1 -1
  315. package/dist/audit/orchestrator/reviewPackets.js +17 -32
  316. package/dist/audit/orchestrator/reviewPackets.js.map +1 -1
  317. package/dist/audit/orchestrator/runtimeValidation.js +2 -2
  318. package/dist/audit/orchestrator/runtimeValidation.js.map +1 -1
  319. package/dist/audit/orchestrator/scope.d.ts.map +1 -1
  320. package/dist/audit/orchestrator/scope.js +3 -2
  321. package/dist/audit/orchestrator/scope.js.map +1 -1
  322. package/dist/audit/orchestrator/scopeIndexBaseline.d.ts.map +1 -1
  323. package/dist/audit/orchestrator/scopeIndexBaseline.js +1 -2
  324. package/dist/audit/orchestrator/scopeIndexBaseline.js.map +1 -1
  325. package/dist/audit/orchestrator/selectiveDeepening/conflict.d.ts.map +1 -1
  326. package/dist/audit/orchestrator/selectiveDeepening/conflict.js +2 -2
  327. package/dist/audit/orchestrator/selectiveDeepening/conflict.js.map +1 -1
  328. package/dist/audit/orchestrator/selectiveDeepening/findingFollowup.d.ts +3 -5
  329. package/dist/audit/orchestrator/selectiveDeepening/findingFollowup.d.ts.map +1 -1
  330. package/dist/audit/orchestrator/selectiveDeepening/findingFollowup.js +8 -6
  331. package/dist/audit/orchestrator/selectiveDeepening/findingFollowup.js.map +1 -1
  332. package/dist/audit/orchestrator/selectiveDeepening/highRiskClean.d.ts.map +1 -1
  333. package/dist/audit/orchestrator/selectiveDeepening/highRiskClean.js +15 -11
  334. package/dist/audit/orchestrator/selectiveDeepening/highRiskClean.js.map +1 -1
  335. package/dist/audit/orchestrator/selectiveDeepening/index.d.ts +3 -3
  336. package/dist/audit/orchestrator/selectiveDeepening/index.d.ts.map +1 -1
  337. package/dist/audit/orchestrator/selectiveDeepening/index.js +50 -77
  338. package/dist/audit/orchestrator/selectiveDeepening/index.js.map +1 -1
  339. package/dist/audit/orchestrator/selectiveDeepening/lensVerification.d.ts.map +1 -1
  340. package/dist/audit/orchestrator/selectiveDeepening/lensVerification.js +27 -18
  341. package/dist/audit/orchestrator/selectiveDeepening/lensVerification.js.map +1 -1
  342. package/dist/audit/orchestrator/selectiveDeepening/runtimeValidation.d.ts +1 -2
  343. package/dist/audit/orchestrator/selectiveDeepening/runtimeValidation.d.ts.map +1 -1
  344. package/dist/audit/orchestrator/selectiveDeepening/runtimeValidation.js +6 -3
  345. package/dist/audit/orchestrator/selectiveDeepening/runtimeValidation.js.map +1 -1
  346. package/dist/audit/orchestrator/selectiveDeepening/shared.d.ts +12 -9
  347. package/dist/audit/orchestrator/selectiveDeepening/shared.d.ts.map +1 -1
  348. package/dist/audit/orchestrator/selectiveDeepening/shared.js +15 -35
  349. package/dist/audit/orchestrator/selectiveDeepening/shared.js.map +1 -1
  350. package/dist/audit/orchestrator/selectiveDeepening/stewardFollowup.d.ts.map +1 -1
  351. package/dist/audit/orchestrator/selectiveDeepening/stewardFollowup.js +9 -16
  352. package/dist/audit/orchestrator/selectiveDeepening/stewardFollowup.js.map +1 -1
  353. package/dist/audit/orchestrator/staleness.d.ts.map +1 -1
  354. package/dist/audit/orchestrator/staleness.js +40 -36
  355. package/dist/audit/orchestrator/staleness.js.map +1 -1
  356. package/dist/audit/orchestrator/state.d.ts.map +1 -1
  357. package/dist/audit/orchestrator/state.js +16 -17
  358. package/dist/audit/orchestrator/state.js.map +1 -1
  359. package/dist/audit/orchestrator/structureExecutors.d.ts.map +1 -1
  360. package/dist/audit/orchestrator/structureExecutors.js +5 -4
  361. package/dist/audit/orchestrator/structureExecutors.js.map +1 -1
  362. package/dist/audit/orchestrator/taskAffinityGraph.d.ts.map +1 -1
  363. package/dist/audit/orchestrator/taskAffinityGraph.js +19 -15
  364. package/dist/audit/orchestrator/taskAffinityGraph.js.map +1 -1
  365. package/dist/audit/orchestrator/taskBuilder.d.ts.map +1 -1
  366. package/dist/audit/orchestrator/taskBuilder.js +2 -3
  367. package/dist/audit/orchestrator/taskBuilder.js.map +1 -1
  368. package/dist/audit/orchestrator/trivialAudit.d.ts.map +1 -1
  369. package/dist/audit/orchestrator/trivialAudit.js +2 -1
  370. package/dist/audit/orchestrator/trivialAudit.js.map +1 -1
  371. package/dist/audit/reporting/mergeFindings.d.ts.map +1 -1
  372. package/dist/audit/reporting/mergeFindings.js +6 -4
  373. package/dist/audit/reporting/mergeFindings.js.map +1 -1
  374. package/dist/audit/reporting/synthesis.d.ts.map +1 -1
  375. package/dist/audit/reporting/synthesis.js +5 -10
  376. package/dist/audit/reporting/synthesis.js.map +1 -1
  377. package/dist/audit/reporting/workBlocks.d.ts +0 -1
  378. package/dist/audit/reporting/workBlocks.d.ts.map +1 -1
  379. package/dist/audit/reporting/workBlocks.js +8 -15
  380. package/dist/audit/reporting/workBlocks.js.map +1 -1
  381. package/dist/audit/systemic/reviewFileMap.js +2 -2
  382. package/dist/audit/systemic/reviewFileMap.js.map +1 -1
  383. package/dist/audit/systemic/secondOrderAdversaryPrompt.d.ts.map +1 -1
  384. package/dist/audit/systemic/secondOrderAdversaryPrompt.js +2 -2
  385. package/dist/audit/systemic/secondOrderAdversaryPrompt.js.map +1 -1
  386. package/dist/audit/systemic/systemicChallengeLoop.js +3 -3
  387. package/dist/audit/systemic/systemicChallengeLoop.js.map +1 -1
  388. package/dist/audit/types/reviewPlanning.d.ts +10 -8
  389. package/dist/audit/types/reviewPlanning.d.ts.map +1 -1
  390. package/dist/audit/types/reviewPlanning.js +3 -1
  391. package/dist/audit/types/reviewPlanning.js.map +1 -1
  392. package/dist/remediate/contractPipeline/executionPlan.d.ts +3 -0
  393. package/dist/remediate/contractPipeline/executionPlan.d.ts.map +1 -1
  394. package/dist/remediate/contractPipeline/executionPlan.js +27 -22
  395. package/dist/remediate/contractPipeline/executionPlan.js.map +1 -1
  396. package/dist/remediate/contractPipeline/runtimePlanAuthority.d.ts +1 -0
  397. package/dist/remediate/contractPipeline/runtimePlanAuthority.d.ts.map +1 -1
  398. package/dist/remediate/contractPipeline/runtimePlanAuthority.js +4 -3
  399. package/dist/remediate/contractPipeline/runtimePlanAuthority.js.map +1 -1
  400. package/dist/remediate/dedup/crossLensDedup.d.ts +0 -2
  401. package/dist/remediate/dedup/crossLensDedup.d.ts.map +1 -1
  402. package/dist/remediate/dedup/crossLensDedup.js +1 -4
  403. package/dist/remediate/dedup/crossLensDedup.js.map +1 -1
  404. package/dist/remediate/droppedFindingsRecord.d.ts.map +1 -1
  405. package/dist/remediate/droppedFindingsRecord.js +3 -1
  406. package/dist/remediate/droppedFindingsRecord.js.map +1 -1
  407. package/dist/remediate/index.d.ts +2 -3
  408. package/dist/remediate/index.d.ts.map +1 -1
  409. package/dist/remediate/index.js +51 -27
  410. package/dist/remediate/index.js.map +1 -1
  411. package/dist/remediate/intake.d.ts +9 -8
  412. package/dist/remediate/intake.d.ts.map +1 -1
  413. package/dist/remediate/intake.js +9 -5
  414. package/dist/remediate/intake.js.map +1 -1
  415. package/dist/remediate/intakeSelection.js +3 -3
  416. package/dist/remediate/intakeSelection.js.map +1 -1
  417. package/dist/remediate/intent/intentOrdering.d.ts +10 -9
  418. package/dist/remediate/intent/intentOrdering.d.ts.map +1 -1
  419. package/dist/remediate/intent/intentOrdering.js +10 -9
  420. package/dist/remediate/intent/intentOrdering.js.map +1 -1
  421. package/dist/remediate/intent/intentPersistence.d.ts +1 -0
  422. package/dist/remediate/intent/intentPersistence.d.ts.map +1 -1
  423. package/dist/remediate/intent/intentPersistence.js +18 -10
  424. package/dist/remediate/intent/intentPersistence.js.map +1 -1
  425. package/dist/remediate/phases/close.d.ts +16 -15
  426. package/dist/remediate/phases/close.d.ts.map +1 -1
  427. package/dist/remediate/phases/close.js +172 -163
  428. package/dist/remediate/phases/close.js.map +1 -1
  429. package/dist/remediate/phases/closeVerifyAnalyzerLeads.js +1 -1
  430. package/dist/remediate/phases/closeVerifyAnalyzerLeads.js.map +1 -1
  431. package/dist/remediate/phases/closeVerifyHeadEvidence.d.ts.map +1 -1
  432. package/dist/remediate/phases/closeVerifyHeadEvidence.js +11 -11
  433. package/dist/remediate/phases/closeVerifyHeadEvidence.js.map +1 -1
  434. package/dist/remediate/phases/closeVerifyLandingGates.d.ts +6 -0
  435. package/dist/remediate/phases/closeVerifyLandingGates.d.ts.map +1 -1
  436. package/dist/remediate/phases/closeVerifyLandingGates.js +10 -6
  437. package/dist/remediate/phases/closeVerifyLandingGates.js.map +1 -1
  438. package/dist/remediate/phases/grounding.d.ts +1 -1
  439. package/dist/remediate/phases/grounding.d.ts.map +1 -1
  440. package/dist/remediate/phases/triage.d.ts.map +1 -1
  441. package/dist/remediate/phases/triage.js +19 -25
  442. package/dist/remediate/phases/triage.js.map +1 -1
  443. package/dist/remediate/phases/triageConformance.d.ts.map +1 -1
  444. package/dist/remediate/phases/triageConformance.js +11 -15
  445. package/dist/remediate/phases/triageConformance.js.map +1 -1
  446. package/dist/remediate/review/autonomousGate.d.ts +5 -5
  447. package/dist/remediate/review/autonomousGate.d.ts.map +1 -1
  448. package/dist/remediate/review/autonomousGate.js +5 -0
  449. package/dist/remediate/review/autonomousGate.js.map +1 -1
  450. package/dist/remediate/review/reviewGate.d.ts.map +1 -1
  451. package/dist/remediate/review/reviewGate.js +12 -11
  452. package/dist/remediate/review/reviewGate.js.map +1 -1
  453. package/dist/remediate/riskSignal.d.ts +0 -1
  454. package/dist/remediate/riskSignal.d.ts.map +1 -1
  455. package/dist/remediate/riskSignal.js.map +1 -1
  456. package/dist/remediate/state/decisionConsumption.d.ts +2 -0
  457. package/dist/remediate/state/decisionConsumption.d.ts.map +1 -1
  458. package/dist/remediate/state/decisionConsumption.js +12 -10
  459. package/dist/remediate/state/decisionConsumption.js.map +1 -1
  460. package/dist/remediate/state/itemStatus.d.ts +3 -3
  461. package/dist/remediate/state/itemStatus.js +5 -5
  462. package/dist/remediate/state/store.d.ts +4 -3
  463. package/dist/remediate/state/store.d.ts.map +1 -1
  464. package/dist/remediate/state/store.js +11 -24
  465. package/dist/remediate/state/store.js.map +1 -1
  466. package/dist/remediate/state/types.d.ts +2 -2
  467. package/dist/remediate/state/types.d.ts.map +1 -1
  468. package/dist/remediate/state/types.js +12 -14
  469. package/dist/remediate/state/types.js.map +1 -1
  470. package/dist/remediate/steps/clarificationResolution.d.ts.map +1 -1
  471. package/dist/remediate/steps/clarificationResolution.js +4 -2
  472. package/dist/remediate/steps/clarificationResolution.js.map +1 -1
  473. package/dist/remediate/steps/contractPipeline.d.ts.map +1 -1
  474. package/dist/remediate/steps/contractPipeline.js +26 -23
  475. package/dist/remediate/steps/contractPipeline.js.map +1 -1
  476. package/dist/remediate/steps/contractPipelinePrompts.d.ts +1 -1
  477. package/dist/remediate/steps/contractPipelinePrompts.d.ts.map +1 -1
  478. package/dist/remediate/steps/contractPipelinePrompts.js +3 -2
  479. package/dist/remediate/steps/contractPipelinePrompts.js.map +1 -1
  480. package/dist/remediate/steps/dispatch/contractConformanceReview.d.ts +8 -3
  481. package/dist/remediate/steps/dispatch/contractConformanceReview.d.ts.map +1 -1
  482. package/dist/remediate/steps/dispatch/contractConformanceReview.js +15 -12
  483. package/dist/remediate/steps/dispatch/contractConformanceReview.js.map +1 -1
  484. package/dist/remediate/steps/dispatch/hostContracts.d.ts +2 -0
  485. package/dist/remediate/steps/dispatch/hostContracts.d.ts.map +1 -1
  486. package/dist/remediate/steps/dispatch/hostContracts.js +6 -3
  487. package/dist/remediate/steps/dispatch/hostContracts.js.map +1 -1
  488. package/dist/remediate/steps/dispatch/hostCorroboration.d.ts +11 -12
  489. package/dist/remediate/steps/dispatch/hostCorroboration.d.ts.map +1 -1
  490. package/dist/remediate/steps/dispatch/hostCorroboration.js +13 -6
  491. package/dist/remediate/steps/dispatch/hostCorroboration.js.map +1 -1
  492. package/dist/remediate/steps/dispatch/hostHandoff.d.ts +5 -7
  493. package/dist/remediate/steps/dispatch/hostHandoff.d.ts.map +1 -1
  494. package/dist/remediate/steps/dispatch/hostHandoff.js +162 -265
  495. package/dist/remediate/steps/dispatch/hostHandoff.js.map +1 -1
  496. package/dist/remediate/steps/dispatch/requiredTests.d.ts +18 -0
  497. package/dist/remediate/steps/dispatch/requiredTests.d.ts.map +1 -1
  498. package/dist/remediate/steps/dispatch/requiredTests.js +9 -11
  499. package/dist/remediate/steps/dispatch/requiredTests.js.map +1 -1
  500. package/dist/remediate/steps/finalGate.d.ts +1 -1
  501. package/dist/remediate/steps/finalGate.d.ts.map +1 -1
  502. package/dist/remediate/steps/finalGate.js +12 -12
  503. package/dist/remediate/steps/finalGate.js.map +1 -1
  504. package/dist/remediate/steps/frictionCloseout.d.ts.map +1 -1
  505. package/dist/remediate/steps/frictionCloseout.js +0 -1
  506. package/dist/remediate/steps/frictionCloseout.js.map +1 -1
  507. package/dist/remediate/steps/gateCommands.d.ts +5 -10
  508. package/dist/remediate/steps/gateCommands.d.ts.map +1 -1
  509. package/dist/remediate/steps/gateCommands.js +8 -12
  510. package/dist/remediate/steps/gateCommands.js.map +1 -1
  511. package/dist/remediate/steps/intakeResolver.d.ts +5 -7
  512. package/dist/remediate/steps/intakeResolver.d.ts.map +1 -1
  513. package/dist/remediate/steps/intakeResolver.js +30 -33
  514. package/dist/remediate/steps/intakeResolver.js.map +1 -1
  515. package/dist/remediate/steps/nextStep.d.ts +1 -1
  516. package/dist/remediate/steps/nextStep.d.ts.map +1 -1
  517. package/dist/remediate/steps/nextStep.js +134 -158
  518. package/dist/remediate/steps/nextStep.js.map +1 -1
  519. package/dist/remediate/steps/prompts.d.ts +4 -30
  520. package/dist/remediate/steps/prompts.d.ts.map +1 -1
  521. package/dist/remediate/steps/prompts.js +5 -114
  522. package/dist/remediate/steps/prompts.js.map +1 -1
  523. package/dist/remediate/steps/recoverIngest.d.ts +5 -13
  524. package/dist/remediate/steps/recoverIngest.d.ts.map +1 -1
  525. package/dist/remediate/steps/recoverIngest.js +20 -26
  526. package/dist/remediate/steps/recoverIngest.js.map +1 -1
  527. package/dist/remediate/steps/stepWriter.d.ts +5 -4
  528. package/dist/remediate/steps/stepWriter.d.ts.map +1 -1
  529. package/dist/remediate/steps/stepWriter.js +8 -5
  530. package/dist/remediate/steps/stepWriter.js.map +1 -1
  531. package/dist/remediate/steps/submitGateResult.d.ts +0 -5
  532. package/dist/remediate/steps/submitGateResult.d.ts.map +1 -1
  533. package/dist/remediate/steps/submitGateResult.js +8 -8
  534. package/dist/remediate/steps/submitGateResult.js.map +1 -1
  535. package/dist/remediate/steps/types.d.ts +1 -1
  536. package/dist/remediate/steps/types.d.ts.map +1 -1
  537. package/dist/remediate/steps/types.js +0 -1
  538. package/dist/remediate/steps/types.js.map +1 -1
  539. package/dist/remediate/validation/artifacts.d.ts.map +1 -1
  540. package/dist/remediate/validation/artifacts.js +11 -9
  541. package/dist/remediate/validation/artifacts.js.map +1 -1
  542. package/dist/remediate/validation/remediationState.d.ts +0 -2
  543. package/dist/remediate/validation/remediationState.d.ts.map +1 -1
  544. package/dist/remediate/validation/remediationState.js +9 -46
  545. package/dist/remediate/validation/remediationState.js.map +1 -1
  546. package/dist/shared/accessMemory.d.ts +3 -9
  547. package/dist/shared/accessMemory.d.ts.map +1 -1
  548. package/dist/shared/accessMemory.js +2 -4
  549. package/dist/shared/accessMemory.js.map +1 -1
  550. package/dist/shared/affinityArtifacts.d.ts.map +1 -1
  551. package/dist/shared/affinityArtifacts.js +5 -7
  552. package/dist/shared/affinityArtifacts.js.map +1 -1
  553. package/dist/shared/agentReflections.d.ts.map +1 -1
  554. package/dist/shared/agentReflections.js +11 -14
  555. package/dist/shared/agentReflections.js.map +1 -1
  556. package/dist/shared/analyzers/binaryAcquisition.d.ts.map +1 -1
  557. package/dist/shared/analyzers/binaryAcquisition.js +2 -1
  558. package/dist/shared/analyzers/binaryAcquisition.js.map +1 -1
  559. package/dist/shared/analyzers/candidates.js +1 -1
  560. package/dist/shared/analyzers/candidates.js.map +1 -1
  561. package/dist/shared/analyzers/clippy.d.ts +2 -25
  562. package/dist/shared/analyzers/clippy.d.ts.map +1 -1
  563. package/dist/shared/analyzers/clippy.js +1 -17
  564. package/dist/shared/analyzers/clippy.js.map +1 -1
  565. package/dist/shared/analyzers/normalizeExternal.d.ts +0 -15
  566. package/dist/shared/analyzers/normalizeExternal.d.ts.map +1 -1
  567. package/dist/shared/analyzers/normalizeExternal.js +2 -1
  568. package/dist/shared/analyzers/normalizeExternal.js.map +1 -1
  569. package/dist/shared/analyzers/rubocop.d.ts +1 -19
  570. package/dist/shared/analyzers/rubocop.d.ts.map +1 -1
  571. package/dist/shared/analyzers/rubocop.js +0 -23
  572. package/dist/shared/analyzers/rubocop.js.map +1 -1
  573. package/dist/shared/artifactFreshness.d.ts.map +1 -1
  574. package/dist/shared/artifactFreshness.js +4 -6
  575. package/dist/shared/artifactFreshness.js.map +1 -1
  576. package/dist/shared/chunkByBudget.d.ts +1 -24
  577. package/dist/shared/chunkByBudget.d.ts.map +1 -1
  578. package/dist/shared/chunkByBudget.js +2 -13
  579. package/dist/shared/chunkByBudget.js.map +1 -1
  580. package/dist/shared/compareCodeUnits.d.ts +2 -0
  581. package/dist/shared/compareCodeUnits.d.ts.map +1 -1
  582. package/dist/shared/compareCodeUnits.js +5 -0
  583. package/dist/shared/compareCodeUnits.js.map +1 -1
  584. package/dist/shared/contentKey.d.ts.map +1 -1
  585. package/dist/shared/contentKey.js +3 -1
  586. package/dist/shared/contentKey.js.map +1 -1
  587. package/dist/shared/countBy.d.ts.map +1 -1
  588. package/dist/shared/countBy.js +4 -3
  589. package/dist/shared/countBy.js.map +1 -1
  590. package/dist/shared/decompose/charterExtraction.d.ts.map +1 -1
  591. package/dist/shared/decompose/charterExtraction.js +11 -20
  592. package/dist/shared/decompose/charterExtraction.js.map +1 -1
  593. package/dist/shared/decompose/consensus.d.ts.map +1 -1
  594. package/dist/shared/decompose/consensus.js +4 -12
  595. package/dist/shared/decompose/consensus.js.map +1 -1
  596. package/dist/shared/decompose/contentCoherence.d.ts.map +1 -1
  597. package/dist/shared/decompose/contentCoherence.js +12 -15
  598. package/dist/shared/decompose/contentCoherence.js.map +1 -1
  599. package/dist/shared/decompose/modularity.d.ts.map +1 -1
  600. package/dist/shared/decompose/modularity.js +7 -19
  601. package/dist/shared/decompose/modularity.js.map +1 -1
  602. package/dist/shared/decompose/systemicChallenge.d.ts +8 -0
  603. package/dist/shared/decompose/systemicChallenge.d.ts.map +1 -1
  604. package/dist/shared/decompose/systemicChallenge.js +8 -8
  605. package/dist/shared/decompose/systemicChallenge.js.map +1 -1
  606. package/dist/shared/findingIdentitySignature.d.ts +6 -1
  607. package/dist/shared/findingIdentitySignature.d.ts.map +1 -1
  608. package/dist/shared/findingIdentitySignature.js +8 -6
  609. package/dist/shared/findingIdentitySignature.js.map +1 -1
  610. package/dist/shared/findingSimilarity.d.ts.map +1 -1
  611. package/dist/shared/findingSimilarity.js +9 -14
  612. package/dist/shared/findingSimilarity.js.map +1 -1
  613. package/dist/shared/findings/dedupe.d.ts.map +1 -1
  614. package/dist/shared/findings/dedupe.js +1 -10
  615. package/dist/shared/findings/dedupe.js.map +1 -1
  616. package/dist/shared/friction/captureFrictionEvent.d.ts +1 -1
  617. package/dist/shared/friction/captureFrictionEvent.d.ts.map +1 -1
  618. package/dist/shared/friction/frictionRecord.d.ts.map +1 -1
  619. package/dist/shared/friction/frictionRecord.js +3 -2
  620. package/dist/shared/friction/frictionRecord.js.map +1 -1
  621. package/dist/shared/friction/stepBoundaryCapture.d.ts +1 -2
  622. package/dist/shared/friction/stepBoundaryCapture.d.ts.map +1 -1
  623. package/dist/shared/friction/stepBoundaryCapture.js.map +1 -1
  624. package/dist/shared/friction/triage.d.ts.map +1 -1
  625. package/dist/shared/friction/triage.js +4 -3
  626. package/dist/shared/friction/triage.js.map +1 -1
  627. package/dist/shared/git.d.ts +2 -10
  628. package/dist/shared/git.d.ts.map +1 -1
  629. package/dist/shared/git.js +6 -17
  630. package/dist/shared/git.js.map +1 -1
  631. package/dist/shared/graph/graphPaths.d.ts +2 -5
  632. package/dist/shared/graph/graphPaths.d.ts.map +1 -1
  633. package/dist/shared/graph/graphPaths.js +5 -6
  634. package/dist/shared/graph/graphPaths.js.map +1 -1
  635. package/dist/shared/index.d.ts +41 -61
  636. package/dist/shared/index.d.ts.map +1 -1
  637. package/dist/shared/index.js +25 -7
  638. package/dist/shared/index.js.map +1 -1
  639. package/dist/shared/intent/pathScope.d.ts +5 -0
  640. package/dist/shared/intent/pathScope.d.ts.map +1 -1
  641. package/dist/shared/intent/pathScope.js +17 -8
  642. package/dist/shared/intent/pathScope.js.map +1 -1
  643. package/dist/shared/io/auditToolsPaths.d.ts +9 -16
  644. package/dist/shared/io/auditToolsPaths.d.ts.map +1 -1
  645. package/dist/shared/io/auditToolsPaths.js +9 -18
  646. package/dist/shared/io/auditToolsPaths.js.map +1 -1
  647. package/dist/shared/io/frictionCapture.d.ts.map +1 -1
  648. package/dist/shared/io/frictionCapture.js +3 -2
  649. package/dist/shared/io/frictionCapture.js.map +1 -1
  650. package/dist/shared/io/stepContractWriter.d.ts.map +1 -1
  651. package/dist/shared/io/stepContractWriter.js +10 -8
  652. package/dist/shared/io/stepContractWriter.js.map +1 -1
  653. package/dist/shared/mcp/submitServer.d.ts.map +1 -1
  654. package/dist/shared/mcp/submitServer.js +21 -29
  655. package/dist/shared/mcp/submitServer.js.map +1 -1
  656. package/dist/shared/observability/rootLogObservations.d.ts.map +1 -1
  657. package/dist/shared/observability/rootLogObservations.js +3 -2
  658. package/dist/shared/observability/rootLogObservations.js.map +1 -1
  659. package/dist/shared/parsing/toml.d.ts.map +1 -1
  660. package/dist/shared/parsing/toml.js +3 -4
  661. package/dist/shared/parsing/toml.js.map +1 -1
  662. package/dist/shared/reporting/auditDeliverable.d.ts.map +1 -1
  663. package/dist/shared/reporting/auditDeliverable.js +6 -15
  664. package/dist/shared/reporting/auditDeliverable.js.map +1 -1
  665. package/dist/shared/reporting/lensCoverage.d.ts.map +1 -1
  666. package/dist/shared/reporting/lensCoverage.js +4 -5
  667. package/dist/shared/reporting/lensCoverage.js.map +1 -1
  668. package/dist/shared/reporting/markdown.d.ts +3 -0
  669. package/dist/shared/reporting/markdown.d.ts.map +1 -0
  670. package/dist/shared/reporting/markdown.js +6 -0
  671. package/dist/shared/reporting/markdown.js.map +1 -0
  672. package/dist/shared/sessionConfig.d.ts.map +1 -1
  673. package/dist/shared/sessionConfig.js +3 -7
  674. package/dist/shared/sessionConfig.js.map +1 -1
  675. package/dist/shared/submission/handRecovery.d.ts.map +1 -1
  676. package/dist/shared/submission/handRecovery.js +3 -2
  677. package/dist/shared/submission/handRecovery.js.map +1 -1
  678. package/dist/shared/submission/hostResultOutcomes.d.ts +1 -1
  679. package/dist/shared/submission/hostResultOutcomes.js +2 -2
  680. package/dist/shared/submission/hostResultOutcomes.js.map +1 -1
  681. package/dist/shared/submission/submissionClassifier.d.ts.map +1 -1
  682. package/dist/shared/submission/submissionClassifier.js +4 -3
  683. package/dist/shared/submission/submissionClassifier.js.map +1 -1
  684. package/dist/shared/submission/submissionIdentity.d.ts.map +1 -1
  685. package/dist/shared/submission/submissionIdentity.js +3 -1
  686. package/dist/shared/submission/submissionIdentity.js.map +1 -1
  687. package/dist/shared/submission/submissionLedger.d.ts +1 -0
  688. package/dist/shared/submission/submissionLedger.d.ts.map +1 -1
  689. package/dist/shared/submission/submissionLedger.js +9 -5
  690. package/dist/shared/submission/submissionLedger.js.map +1 -1
  691. package/dist/shared/tooling/allowlistedExec.d.ts.map +1 -1
  692. package/dist/shared/tooling/allowlistedExec.js +35 -67
  693. package/dist/shared/tooling/allowlistedExec.js.map +1 -1
  694. package/dist/shared/tooling/analyzerDeps.d.ts.map +1 -1
  695. package/dist/shared/tooling/analyzerDeps.js +2 -1
  696. package/dist/shared/tooling/analyzerDeps.js.map +1 -1
  697. package/dist/shared/tooling/exec.d.ts +1 -1
  698. package/dist/shared/tooling/exec.d.ts.map +1 -1
  699. package/dist/shared/tooling/exec.js +3 -2
  700. package/dist/shared/tooling/exec.js.map +1 -1
  701. package/dist/shared/tooling/landingGates.d.ts +3 -3
  702. package/dist/shared/tooling/landingGates.js +3 -3
  703. package/dist/shared/tooling/ownedProcessLifecycle.d.ts +0 -1
  704. package/dist/shared/tooling/ownedProcessLifecycle.d.ts.map +1 -1
  705. package/dist/shared/tooling/ownedProcessLifecycle.js +1 -1
  706. package/dist/shared/tooling/ownedProcessLifecycle.js.map +1 -1
  707. package/dist/shared/tooling/projectTestAdmission.d.ts +7 -12
  708. package/dist/shared/tooling/projectTestAdmission.d.ts.map +1 -1
  709. package/dist/shared/tooling/projectTestAdmission.js.map +1 -1
  710. package/dist/shared/tooling/testCommand.d.ts +0 -14
  711. package/dist/shared/tooling/testCommand.d.ts.map +1 -1
  712. package/dist/shared/tooling/testCommand.js +2 -3
  713. package/dist/shared/tooling/testCommand.js.map +1 -1
  714. package/dist/shared/tooling/windowsOwnedJob.d.ts +2 -1
  715. package/dist/shared/tooling/windowsOwnedJob.d.ts.map +1 -1
  716. package/dist/shared/types/accessMemory.d.ts +3 -19
  717. package/dist/shared/types/accessMemory.d.ts.map +1 -1
  718. package/dist/shared/types/accessMemory.js +3 -19
  719. package/dist/shared/types/accessMemory.js.map +1 -1
  720. package/dist/shared/types/intentCheckpoint.d.ts.map +1 -1
  721. package/dist/shared/types/intentCheckpoint.js +2 -1
  722. package/dist/shared/types/intentCheckpoint.js.map +1 -1
  723. package/dist/shared/types/lens.d.ts +5 -0
  724. package/dist/shared/types/lens.d.ts.map +1 -1
  725. package/dist/shared/types/lens.js +13 -0
  726. package/dist/shared/types/lens.js.map +1 -1
  727. package/dist/shared/types/remediationOutcome.d.ts +10 -0
  728. package/dist/shared/types/remediationOutcome.d.ts.map +1 -1
  729. package/dist/shared/types/remediationOutcome.js +3 -0
  730. package/dist/shared/types/remediationOutcome.js.map +1 -1
  731. package/dist/shared/validation/contractConstructionSites.d.ts.map +1 -1
  732. package/dist/shared/validation/contractConstructionSites.js +2 -1
  733. package/dist/shared/validation/contractConstructionSites.js.map +1 -1
  734. package/dist/shared/validation/findingGrounding.d.ts +2 -1
  735. package/dist/shared/validation/findingGrounding.d.ts.map +1 -1
  736. package/dist/shared/validation/findingGrounding.js +9 -5
  737. package/dist/shared/validation/findingGrounding.js.map +1 -1
  738. package/dist/shared/validation/findingsReport.d.ts +6 -0
  739. package/dist/shared/validation/findingsReport.d.ts.map +1 -1
  740. package/dist/shared/validation/findingsReport.js +29 -19
  741. package/dist/shared/validation/findingsReport.js.map +1 -1
  742. package/docs/audit-pkg/contracts.md +73 -6
  743. package/docs/audit-pkg/operator-guide.md +10 -2
  744. package/docs/audit-pkg/product.md +1 -1
  745. package/package.json +1 -3
  746. package/remediate-code.mjs +13 -5
  747. package/scripts/audit/postinstall.mjs +6 -21
  748. package/scripts/remediate/postinstall.mjs +2 -17
  749. package/scripts/shared/install-host-assets.mjs +11 -3
  750. package/scripts/shared/primitives.mjs +14 -3
  751. package/wrapper/audit-code-wrapper-build.mjs +21 -18
  752. package/wrapper/audit-code-wrapper-install-hosts.mjs +6 -120
  753. package/wrapper/audit-code-wrapper-lib.mjs +28 -42
  754. package/wrapper/audit-code-wrapper-opencode.mjs +11 -24
  755. package/wrapper/installer-verb-help.mjs +21 -8
  756. package/wrapper/remediate-code-wrapper-install-hosts.mjs +15 -130
  757. package/wrapper/remediate-code-wrapper-opencode.mjs +11 -24
  758. package/wrapper/repo-root.mjs +2 -2
  759. package/wrapper/shared-install-hosts.mjs +119 -0
  760. package/wrapper/shared-project-opencode.mjs +22 -0
  761. package/dist/audit/io/runArtifactTypes.d.ts +0 -8
  762. package/dist/audit/io/runArtifactTypes.d.ts.map +0 -1
  763. package/dist/audit/io/runArtifactTypes.js +0 -2
  764. package/dist/audit/io/runArtifactTypes.js.map +0 -1
  765. package/dist/audit/orchestrator/accessMemory.d.ts +0 -35
  766. package/dist/audit/orchestrator/accessMemory.d.ts.map +0 -1
  767. package/dist/audit/orchestrator/accessMemory.js +0 -54
  768. package/dist/audit/orchestrator/accessMemory.js.map +0 -1
  769. package/dist/audit/orchestrator/reviewPacketGraph.d.ts +0 -4
  770. package/dist/audit/orchestrator/reviewPacketGraph.d.ts.map +0 -1
  771. package/dist/audit/orchestrator/reviewPacketGraph.js +0 -7
  772. package/dist/audit/orchestrator/reviewPacketGraph.js.map +0 -1
  773. package/dist/shared/continuityScore.d.ts +0 -13
  774. package/dist/shared/continuityScore.d.ts.map +0 -1
  775. package/dist/shared/continuityScore.js +0 -164
  776. package/dist/shared/continuityScore.js.map +0 -1
  777. package/dist/shared/graph/directedCycles.d.ts +0 -61
  778. package/dist/shared/graph/directedCycles.d.ts.map +0 -1
  779. package/dist/shared/graph/directedCycles.js +0 -190
  780. package/dist/shared/graph/directedCycles.js.map +0 -1
  781. package/dist/shared/io/pathIdentity.d.ts +0 -26
  782. package/dist/shared/io/pathIdentity.d.ts.map +0 -1
  783. package/dist/shared/io/pathIdentity.js +0 -50
  784. package/dist/shared/io/pathIdentity.js.map +0 -1
@@ -1,37 +1,40 @@
1
+ import { backtickList } from "../../shared/reporting/markdown.js";
1
2
  import { readPlanClarificationResolutions, planClarificationRefusal, pausedClarifications } from "./clarificationResolution.js";
2
3
  import { admitRemediationDirtyBaseline, RemediationDirtyBaselineError } from "../state/dirtyBaseline.js";
3
- import { readDecisionSnapshot, decisionContextDigest } from "../state/decisionConsumption.js";
4
+ import { CLARIFICATION_RESOLUTION_FILENAME, TRIAGE_RESOLUTION_FILENAME, readDecisionSnapshot, decisionContextDigest } from "../state/decisionConsumption.js";
4
5
  import { RemediationPlanAuthorityError } from "../contractPipeline/runtimePlanAuthority.js";
5
6
  import { reopenStaleTriageSuccesses } from "../phases/triageConformance.js";
6
7
  import { stateRunId, requireStateRunId, currentHostBoundaryState } from "../state/runIdentity.js";
7
8
  import { presentReportStep } from "./frictionCloseout.js";
8
9
  import { reviewFilterDispositionsPath, persistReviewFilterDispositions } from "../review/filterDispositions.js";
9
- import { INTENT_INTERPRETATION_FILENAME, readPersistedIntentInterpretationSync, readOrRepairIntentInterpretation } from "../intent/intentPersistence.js";
10
+ import { intentInterpretationPath, readPersistedIntentInterpretationSync, readOrRepairIntentInterpretation } from "../intent/intentPersistence.js";
10
11
  import { requestedFindingSelection, renderFindingSelection } from "../intakeSelection.js";
11
12
  import { parseCommandString } from "../../shared/tooling/commandShape.js";
12
13
  // sites-pinned: tests/remediate/path-a-source-provenance.test.ts, tests/remediate/path-a-phantom-source.test.ts, tests/remediate/next-step-replan-safety.test.ts, tests/remediate/close-plan-authority.test.ts, tests/remediate/friction-capture-closeout.test.ts, tests/remediate/next-step-lifecycle.test.ts, tests/remediate/next-step-pipeline-dispatch.test.ts, tests/remediate/next-step-outcomes-contract.test.ts, tests/remediate/integration-pipeline.test.ts, tests/remediate/outcomes-roundtrip.test.ts, tests/remediate/phase-close.test.ts, tests/remediate/grounding.test.ts, tests/remediate/clarification-round-contract.test.ts, tests/remediate/next-step-review-gate.test.ts, tests/remediate/n-r04-intent-checkpoint.test.ts, tests/remediate/final-gate-red-pause.test.ts, tests/remediate/deferred-clarification.test.ts, tests/remediate/intake-mixed-audit-provenance.test.ts
13
14
  // (the free-form branch's write
14
15
  // scope is normalized — a backslash-spelled citation no longer wedges prepare)
15
16
  import { AUDIT_TOOLS_DIRNAME } from "../../shared/io/auditToolsPaths.js";
17
+ import { errorMessage } from "../../shared/io/json.js";
16
18
  import { loadRemediateSessionConfig } from "./sessionConfigLoad.js";
17
19
  import { existsSync, statSync } from "node:fs";
18
20
  import { mkdir, readFile, rename } from "node:fs/promises";
19
21
  import { dirname, join, resolve } from "node:path";
20
- import { StateStore, OPERATOR_LIFECYCLE_FILENAME } from "../state/store.js";
22
+ import { StateStore, PHASE_LOCK_FILENAME, STATE_FILENAME, OPERATOR_LIFECYCLE_FILENAME } from "../state/store.js";
21
23
  // IO / validation / rendering helpers
22
24
  import { discardOnSchemaVersionMismatch, applyGuidanceFile, applyGuidanceText, readOptionalJsonFile, stagedAndUntracked, writeJsonFile, stableStringify, writeTextFile, buildAuditDeliverablePair, auditReadOf, isRecord, renderIngestReportLines, withFsRetry, RunLogger, coerceJsonObjectArg, renderPromptCommand, headCommit, hashContent, projectAuditFindingsReportSubset,
23
25
  // obligation engine + intent
24
26
  interpretFreeFormIntent, unresolvedFromClauses, advance, describeStoppedFold, linkFrictionRunIds,
25
27
  // domain constants
26
- LENSES, SEVERITIES, CLOSING_ACTIONS, detectProjectFacts, isClosingAction, neutralProjectFacts, } from "audit-tools/shared";
28
+ LENSES, SEVERITIES, CLOSING_ACTIONS, countBy, detectProjectFacts, isClosingAction, neutralProjectFacts, } from "audit-tools/shared";
27
29
  import { buildCoverageLedger } from "../phases/plan.js";
28
30
  import { runTriagePhase } from "../phases/triage.js";
29
- import { runClosePhase } from "../phases/close.js";
31
+ import { retryIncompleteCloseReport, runClosePhase } from "../phases/close.js";
30
32
  import { hasBoundRemediationSubmission, ingestRemediationHostResults, hostDependencyLevels, permanentlyDeadPendingUnits, prepareRemediationHostHandoff, RemediationHostPreparationError, remediationIssueRemedy } from "./dispatch/hostHandoff.js";
33
+ import { RETIRED_DISPATCH_SHAPE_MESSAGE } from "./dispatch/hostContracts.js";
31
34
  import { FileLockTimeoutError, withFileLock, } from "../../shared/io/fileLock.js";
32
35
  import { AUDIT_FINDINGS_FILENAME, AUDIT_REPORT_FILENAME, auditArtifactsDir, auditFindingsPath, auditReportPath, promotedAuditFindingsPath, promotedAuditReportPath, remediationArtifactsDir, remediationRequiredTestLogsDir, } from "../../shared/io/auditToolsPaths.js";
33
36
  import { callerWorkingDirectory, discoverRepoRoot, resolveRepoRoot, } from "../../shared/io/repoRoot.js";
34
- import { writeCurrentStep } from "./stepWriter.js";
37
+ import { randomRunId, writeCurrentStep } from "./stepWriter.js";
35
38
  import { isTerminalStatus, isVerifiedCompleteStatus, } from "../state/itemStatus.js";
36
39
  import { applyIntentOrdering } from "../intent/intentOrdering.js";
37
40
  import { resolveIntakeStep } from "./intakeResolver.js";
@@ -39,7 +42,7 @@ import { RUNTIME_RESIDUAL_DECLARATION, finalGateDisabledReason, finalGateRecordP
39
42
  import { renderGateAttribution, worktreeContentId, finalGateBinding, } from "./gateCommands.js";
40
43
  import { buildNextContractPipelineStep, readApprovedExecutionPlan, writePathASeedFromFindings, } from "./contractPipeline.js";
41
44
  import { compareCodeUnits } from "../../shared/compareCodeUnits.js";
42
- import { executionPlanPaths, readCanonicalPlan, readPlanSource, readPlanReviewHistory } from "../contractPipeline/executionPlan.js";
45
+ import { executionPlanPaths, readCanonicalPlan, readPlanSource } from "../contractPipeline/executionPlan.js";
43
46
  import { buildReviewRequest, applyReviewResolution, parseReviewResolution, REVIEW_REQUEST_SCHEMA_VERSION, } from "../review/reviewGate.js";
44
47
  import { buildAutonomousReviewDecision } from "../review/autonomousGate.js";
45
48
  import { runFindingFilterPass } from "../findingFilter.js";
@@ -52,8 +55,9 @@ import { clarificationPrompt, collectIntakeClarificationsPrompt, collectStarting
52
55
  // prompt copy. Previously these 11-lens / 5-severity lists were hand-copied as
53
56
  // backtick-quoted literals in three places in this file and would silently drift
54
57
  // from the canonical enum (the very drift `types/lens.ts` exists to prevent).
55
- const VALID_LENSES_PROSE = LENSES.map((lens) => `\`${lens}\``).join(", ");
56
- const VALID_SEVERITIES_PROSE = SEVERITIES.map((sev) => `\`${sev}\``).join(", ");
58
+ const VALID_LENSES_PROSE = backtickList(LENSES);
59
+ const VALID_SEVERITIES_PROSE = backtickList(SEVERITIES);
60
+ const VALID_CLOSING_ACTIONS_PROSE = backtickList(CLOSING_ACTIONS);
57
61
  const SESSION_INTENT_RESULT = Symbol("session-intent-result");
58
62
  function sessionIntentResult(options) {
59
63
  if (!(SESSION_INTENT_RESULT in options)) {
@@ -61,9 +65,6 @@ function sessionIntentResult(options) {
61
65
  }
62
66
  return options[SESSION_INTENT_RESULT];
63
67
  }
64
- function randomRunId(prefix = "RUN") {
65
- return `${prefix}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
66
- }
67
68
  function resolveRoot(root) {
68
69
  // The library-entry arm of the same two-arm resolution the CLI performs
69
70
  // (`resolveRootOption` in src/remediate/index.ts). A SUPPLIED root is honored
@@ -177,18 +178,6 @@ function resolveInputPaths(root, input) {
177
178
  allExisting,
178
179
  };
179
180
  }
180
- /**
181
- * True when a supplied `--input` is the SAME input the existing run was already
182
- * built from (its recorded intake source manifest is input-bound — `"input"`, or
183
- * `"mixed"` when a guidance file rode along — with an input path set equal to the
184
- * supplied paths; the guidance entry is not an input, so it is excluded from the
185
- * comparison). The `/remediate-code` loader re-passes the same `--input` on every
186
- * `next-step`; treating that unchanged input as a RESUME — not an
187
- * `input_conflict` — spares the host a needless resume/restart ack dance, while a
188
- * genuinely DIFFERENT input still trips the conflict gate. Enforced in the tool,
189
- * never by asking the loader to remember to drop the flag (a needed manual flag
190
- * is a bug signal).
191
- */
192
181
  /**
193
182
  * True when `candidatePath` (the best default-discovered input, e.g.
194
183
  * `.audit-tools/audit-findings.json`) was modified more recently than
@@ -209,6 +198,18 @@ function isDefaultCandidateFresherThanReport(candidatePath, reportPath) {
209
198
  return false;
210
199
  }
211
200
  }
201
+ /**
202
+ * True when a supplied `--input` is the SAME input the existing run was already
203
+ * built from (its recorded intake source manifest is input-bound — `"input"`, or
204
+ * `"mixed"` when a guidance file rode along — with an input path set equal to the
205
+ * supplied paths; the guidance entry is not an input, so it is excluded from the
206
+ * comparison). The `/remediate-code` loader re-passes the same `--input` on every
207
+ * `next-step`; treating that unchanged input as a RESUME — not an
208
+ * `input_conflict` — spares the host a needless resume/restart ack dance, while a
209
+ * genuinely DIFFERENT input still trips the conflict gate. Enforced in the tool,
210
+ * never by asking the loader to remember to drop the flag (a needed manual flag
211
+ * is a bug signal).
212
+ */
212
213
  function suppliedInputMatchesRun(inputResolution, manifest, boundSourcePaths = []) {
213
214
  if (!inputResolution.supplied)
214
215
  return false;
@@ -257,22 +258,20 @@ function sweepPermanentlyDeadBlocks(state) {
257
258
  let changed = false;
258
259
  const now = new Date().toISOString();
259
260
  for (const block of permanentlyDeadPendingUnits(state)) {
260
- for (const findingId of [block.id]) {
261
- const it = state.items?.[findingId];
262
- if (!it || it.status !== "pending")
263
- continue;
264
- it.status = "blocked";
265
- it.started_at ??= now;
266
- it.completed_at = now;
267
- it.failure_reason =
268
- it.failure_reason ??
269
- "A prerequisite can never reach a verified-complete disposition " +
270
- "(a dependency or lower-phase block was skipped, blocked, or abandoned; " +
271
- "a declared dependency resolves to no block; or the dependencies are " +
272
- "cyclic); the host handoff will not expose this node against an " +
273
- "upstream surface that never landed (INV-RS-01).";
274
- changed = true;
275
- }
261
+ const it = state.items?.[block.id];
262
+ if (!it || it.status !== "pending")
263
+ continue;
264
+ it.status = "blocked";
265
+ it.started_at ??= now;
266
+ it.completed_at = now;
267
+ it.failure_reason =
268
+ it.failure_reason ??
269
+ "A prerequisite can never reach a verified-complete disposition " +
270
+ "(a dependency or lower-phase block was skipped, blocked, or abandoned; " +
271
+ "a declared dependency resolves to no block; or the dependencies are " +
272
+ "cyclic); the host handoff will not expose this node against an " +
273
+ "upstream surface that never landed (INV-RS-01).";
274
+ changed = true;
276
275
  }
277
276
  return changed;
278
277
  }
@@ -285,7 +284,6 @@ function sweepPermanentlyDeadBlocks(state) {
285
284
  function hasUnansweredClarification(state) {
286
285
  return Object.values(state.items ?? {}).some((it) => it.status === "needs_clarification");
287
286
  }
288
- // Dependency-level partitioning is single-sourced with the host handoff boundary.
289
287
  /**
290
288
  * The phase ordinal whose UNTOUCHED entry a whole-repo test-suite gate must run
291
289
  * before, or null when no per-phase gate is due this pass (auto-phasing, T3 —
@@ -339,7 +337,7 @@ function allItemsTerminal(state) {
339
337
  return state.plan !== undefined && resolvedOrTerminalItems(state).length === items.length;
340
338
  }
341
339
  /**
342
- * Reorder a finalized plan by the checkpoint's interpreted intent.
340
+ * Reorder execution units using the checkpoint's interpreted intent. Preserve source finding order.
343
341
  *
344
342
  * The checkpoint persists the operator's `free_form_intent` verbatim; the
345
343
  * structured `InterpretedIntent` is derived from it by the single shared
@@ -355,31 +353,13 @@ async function applyCheckpointIntentOrdering(artifactsDir, plan) {
355
353
  // it, so an unreadable checkpoint degrades to "no intent" here rather than
356
354
  // failing the planning step. (Every other read site is a GATE and lets the
357
355
  // throw out — see `readIntentCheckpoint`.)
358
- const checkpoint = await readIntentCheckpoint(join(artifactsDir, "intent_checkpoint.json")).catch(() => undefined);
356
+ const checkpoint = await readIntentCheckpoint(intakePaths(artifactsDir).intentCheckpoint).catch(() => undefined);
359
357
  const freeForm = checkpoint?.free_form_intent;
360
358
  if (typeof freeForm !== "string" || freeForm.trim().length === 0)
361
359
  return plan;
362
360
  const ordered = applyIntentOrdering(plan.findings, plan.units, interpretFreeFormIntent(freeForm));
363
361
  return { ...plan, findings: ordered.findings, units: ordered.units };
364
362
  }
365
- /**
366
- * The write scope a free-form finding's `affected_files` implies, in the ONE
367
- * form the block contract accepts.
368
- *
369
- * The paths arriving here have been GROUNDED but never normalized: grounding
370
- * asks whether a path resolves to a real file (`existsSync`), and on Windows
371
- * `src\a.ts` does — so a Windows-spelled citation survives grounding and, copied
372
- * verbatim, becomes a `touched_files` entry `assertBlockContract` refuses. The
373
- * run then wedges at handoff preparation and every retry reproduces the refusal.
374
- *
375
- * It normalizes through the SAME shared `repoRelativePath` the handoff boundary
376
- * resolves declared entries with, so this producer's output is in the form its
377
- * consumer demands by construction rather than by a second, drifting rule. A
378
- * path that cannot be contained (`../outside.ts`) is DROPPED rather than
379
- * resolved: the block contract refuses it later anyway, and dropping it here
380
- * leaves the finding itself intact — grounding already decided which paths are
381
- * real, and this decides only how they are SPELLED.
382
- */
383
363
  /**
384
364
  * The closing plan the HOST chose on the confirmed checkpoint: its action, or
385
365
  * `none` when the field is absent, plus the argv a `custom` choice carries.
@@ -398,7 +378,7 @@ async function confirmedClosingPlan(artifactsDir) {
398
378
  // and never touches `readIntentCheckpointLenient`'s raw rejections: the value
399
379
  // returned is one the schema accepts, and `isClosingAction` / `customCommandOf`
400
380
  // are the point-of-use checks on top of it.
401
- const checkpoint = await readIntentCheckpoint(join(artifactsDir, "intent_checkpoint.json"), { lenient: true });
381
+ const checkpoint = await readIntentCheckpoint(intakePaths(artifactsDir).intentCheckpoint, { lenient: true });
402
382
  if (!checkpoint || checkpoint.confirmed_by !== "host")
403
383
  return { action: "none" };
404
384
  const chosen = checkpoint.closing_action;
@@ -419,7 +399,7 @@ function customCommandOf(checkpoint) {
419
399
  async function saveStateForPlan(artifactsDir, existing, plan, planCoverage) {
420
400
  const { host_handoff: _staleHostHandoff, conformance_review: priorConformance, ...carryForwardState } = existing;
421
401
  const items = {};
422
- const owner = await readOptionalJsonFile(join(executionPlanPaths(artifactsDir).directory, "owner-decision.json"));
402
+ const owner = await readOptionalJsonFile(executionPlanPaths(artifactsDir).ownerDecision);
423
403
  for (const unit of plan.units) {
424
404
  const prior = existing.plan?.units.find(entry => entry.id === unit.id);
425
405
  items[unit.id] = prior && stableStringify(prior) === stableStringify(unit) && existing.items?.[unit.id]
@@ -441,7 +421,7 @@ async function saveStateForPlan(artifactsDir, existing, plan, planCoverage) {
441
421
  await writeJsonFile(join(artifactsDir, "remediation_plan.json"), plan);
442
422
  return state;
443
423
  }
444
- async function forceReplanFromExistingIntake(root, artifactsDir, previous, runLogger) {
424
+ async function forceReplanFromExistingIntake(root, artifactsDir, previous) {
445
425
  admitRemediationDirtyBaseline(previous);
446
426
  const step = await buildNextContractPipelineStep({ root, artifactsDir, runId: requireStateRunId(previous), forceRevision: false });
447
427
  if (step)
@@ -449,7 +429,7 @@ async function forceReplanFromExistingIntake(root, artifactsDir, previous, runLo
449
429
  const approved = await readApprovedExecutionPlan(artifactsDir);
450
430
  if (!approved)
451
431
  return { kind: "blocked", reason: "Revise and independently approve the current executable plan before replanning. Accepted execution history is preserved." };
452
- const activated = await activateApprovedPlan(root, artifactsDir, previous, approved, runLogger, "existing_run");
432
+ const activated = await activateApprovedPlan(root, artifactsDir, previous, "existing_run");
453
433
  if (activated.kind === "blocked")
454
434
  return activated;
455
435
  // Activation already carries unchanged history and applies CURRENT owner
@@ -496,7 +476,7 @@ async function buildImplementDispatchStep(ctx) {
496
476
  state: boundaryState,
497
477
  });
498
478
  if (ingested === "unsupported_retired_state") {
499
- throw new Error("Remediation state uses a retired dispatch shape and cannot cross the host handoff boundary.");
479
+ throw new Error(RETIRED_DISPATCH_SHAPE_MESSAGE);
500
480
  }
501
481
  // DURABLY RECORD EVERY CLASSIFIED ISSUE BEFORE ANY EXIT PATH.
502
482
  //
@@ -574,7 +554,7 @@ async function buildImplementDispatchStep(ctx) {
574
554
  catch (error) {
575
555
  if (!(error instanceof RemediationHostPreparationError))
576
556
  throw error;
577
- const sourcePath = join(artifactsDir, "state.json");
557
+ const sourcePath = join(artifactsDir, STATE_FILENAME);
578
558
  const diagnosticsPath = join(artifactsDir, "steps", "handoff-repair.json");
579
559
  await writeJsonFile(diagnosticsPath, { code: error.code, message: error.message, source: sourcePath });
580
560
  const excerpt = error.message.length <= 3_000 ? error.message : `${error.message.slice(0, 3_000)}… [excerpt truncated]`;
@@ -584,7 +564,7 @@ async function buildImplementDispatchStep(ctx) {
584
564
  stepKind: "repair_handoff", status: "blocked", runId, repoRoot: root, artifactsDir,
585
565
  prompt: `# Repair the planning output before dispatch\n\n${excerpt}\n\nFull validation details: ${diagnosticsPath}\n\n` +
586
566
  `Owning source: ${sourcePath} (plan.units and its generated handoff binding).\n` +
587
- `Upstream planning input: ${join(artifactsDir, "extracted-plan.json")}.\n\n` +
567
+ `Upstream reviewed plan: ${executionPlanPaths(artifactsDir).canonical}.\n\n` +
588
568
  "The current run and completed work are preserved. This dispatch cannot safely repair its upstream producer. " +
589
569
  "Return the named validation errors to the planning producer; do not edit generated state, discard accepted work, or submit results under invalid bindings. " +
590
570
  "After the upstream producer has corrected the plan, run next-step again.\n",
@@ -596,7 +576,7 @@ async function buildImplementDispatchStep(ctx) {
596
576
  };
597
577
  }
598
578
  if (handoff === "unsupported_retired_state") {
599
- throw new Error("Remediation state uses a retired dispatch shape and cannot cross the host handoff boundary.");
579
+ throw new Error(RETIRED_DISPATCH_SHAPE_MESSAGE);
600
580
  }
601
581
  if (!state.conformance_review || state.host_handoff?.workload_sha256 !==
602
582
  handoff.handoff_record.workload_sha256) {
@@ -710,7 +690,13 @@ async function emitPlanRevisionBlockedStep(root, artifactsDir, blocked) {
710
690
  prompt: `# Executable plan requires attention\n\n${blocked.reason}\nThe current plan and accepted execution history are preserved. Revise the plan through its tool-issued submission and obtain fresh review before continuing.`,
711
691
  allowedCommands: [loaderCommand("next-step")], stopCondition: "Resolve the named plan/review issue before implementation.", artifactPaths: { execution_plan: executionPlanPaths(artifactsDir).canonical } });
712
692
  }
713
- async function activateApprovedPlan(root, artifactsDir, existing, _input, _runLogger, origin) {
693
+ /** A blocked activation is reported as its step; a planned one hands its state on. */
694
+ function settleActivation(root, artifactsDir, outcome) {
695
+ return outcome.kind === "blocked"
696
+ ? emitPlanRevisionBlockedStep(root, artifactsDir, outcome)
697
+ : outcome.state;
698
+ }
699
+ async function activateApprovedPlan(root, artifactsDir, existing, origin) {
714
700
  if (origin === "existing_run")
715
701
  admitRemediationDirtyBaseline(existing);
716
702
  else if ("run_start_dirty" in existing || "run_start_dirty_encoding" in existing)
@@ -726,7 +712,7 @@ async function activateApprovedPlan(root, artifactsDir, existing, _input, _runLo
726
712
  findings: source.findings,
727
713
  ...(source.request ? { request: source.request } : {}),
728
714
  review_revision_sha256: canonical.revision_sha256,
729
- review_counterexamples: (await readPlanReviewHistory(artifactsDir)).counterexamples.filter(example => canonical.plan.units.some(unit => unit.addresses_counterexample_ids.includes(example.id))),
715
+ review_counterexamples: approved.history.counterexamples.filter(example => canonical.plan.units.some(unit => unit.addresses_counterexample_ids.includes(example.id))),
730
716
  project_type: facts.project_type,
731
717
  candidate_closing_actions: facts.candidate_closing_actions,
732
718
  audit_read: source.audit_read,
@@ -1011,14 +997,12 @@ sourceAuditRead) {
1011
997
  `path=${findingsPath}`,
1012
998
  });
1013
999
  }
1014
- async function handleReadyIntakeContractPipeline(root, artifactsDir, options, runLogger, origin) {
1000
+ async function handleReadyIntakeContractPipeline(root, artifactsDir, options, origin) {
1015
1001
  // Resume the tool-owned plan without reconstructing completed intake.
1016
1002
  const earlyExtractedPlan = await readApprovedExecutionPlan(artifactsDir);
1017
1003
  if (earlyExtractedPlan && !existsSync(executionPlanPaths(artifactsDir).submission)) {
1018
- const outcome = await activateApprovedPlan(root, artifactsDir, { status: "pending" }, earlyExtractedPlan, runLogger, origin);
1019
- return outcome.kind === "blocked"
1020
- ? emitPlanRevisionBlockedStep(root, artifactsDir, outcome)
1021
- : outcome.state;
1004
+ const outcome = await activateApprovedPlan(root, artifactsDir, { status: "pending" }, origin);
1005
+ return settleActivation(root, artifactsDir, outcome);
1022
1006
  }
1023
1007
  if (await readPlanSource(artifactsDir)) {
1024
1008
  const step = await buildNextContractPipelineStep({
@@ -1029,10 +1013,8 @@ async function handleReadyIntakeContractPipeline(root, artifactsDir, options, ru
1029
1013
  const approved = await readApprovedExecutionPlan(artifactsDir);
1030
1014
  if (!approved)
1031
1015
  return null;
1032
- const outcome = await activateApprovedPlan(root, artifactsDir, { status: "pending" }, approved, runLogger, origin);
1033
- return outcome.kind === "blocked"
1034
- ? emitPlanRevisionBlockedStep(root, artifactsDir, outcome)
1035
- : outcome.state;
1016
+ const outcome = await activateApprovedPlan(root, artifactsDir, { status: "pending" }, origin);
1017
+ return settleActivation(root, artifactsDir, outcome);
1036
1018
  }
1037
1019
  const intake = await readIntakeArtifacts(artifactsDir);
1038
1020
  if (!intake.summary || !isIntakeReady(intake.summary)) {
@@ -1099,7 +1081,7 @@ async function handleReadyIntakeContractPipeline(root, artifactsDir, options, ru
1099
1081
  const auditFindings = await readAuditFindingsOnce();
1100
1082
  const originals = extractAuditFindings(auditFindings);
1101
1083
  if (originals.length > 0) {
1102
- const checkpoint = await readIntentCheckpoint(join(artifactsDir, "intent_checkpoint.json"));
1084
+ const checkpoint = await readIntentCheckpoint(intakePaths(artifactsDir).intentCheckpoint);
1103
1085
  const filter = await runFindingFilterPass(structuredClone(originals), {
1104
1086
  root,
1105
1087
  checkpoint: checkpoint ?? undefined,
@@ -1148,8 +1130,9 @@ async function handleReadyIntakeContractPipeline(root, artifactsDir, options, ru
1148
1130
  const approvedPayload = projectAuditFindingsReportSubset(auditFindings, approvedOriginals);
1149
1131
  let seedSourcePath = auditSource.path;
1150
1132
  if (gate.approved.length < originals.length) {
1151
- await mkdir(executionPlanPaths(artifactsDir).directory, { recursive: true });
1152
- seedSourcePath = join(executionPlanPaths(artifactsDir).directory, "approved-findings.json");
1133
+ const planDirectory = executionPlanPaths(artifactsDir).directory;
1134
+ await mkdir(planDirectory, { recursive: true });
1135
+ seedSourcePath = join(planDirectory, "approved-findings.json");
1153
1136
  await writeJsonFile(seedSourcePath, approvedPayload);
1154
1137
  reviewSourceSwap = { from: auditSource.path, to: seedSourcePath };
1155
1138
  }
@@ -1188,22 +1171,19 @@ async function handleReadyIntakeContractPipeline(root, artifactsDir, options, ru
1188
1171
  if (!extractedPlan) {
1189
1172
  return null;
1190
1173
  }
1191
- const outcome = await activateApprovedPlan(root, artifactsDir, { status: "pending" }, extractedPlan, runLogger, origin);
1192
- return outcome.kind === "blocked"
1193
- ? emitPlanRevisionBlockedStep(root, artifactsDir, outcome)
1194
- : outcome.state;
1174
+ const outcome = await activateApprovedPlan(root, artifactsDir, { status: "pending" }, origin);
1175
+ return settleActivation(root, artifactsDir, outcome);
1195
1176
  }
1196
- async function handlePendingIntake(root, artifactsDir, options, runLogger, origin) {
1177
+ async function handlePendingIntake(root, artifactsDir, options, origin) {
1197
1178
  // Existing source ownership survives pending review and approval invalidation.
1198
1179
  // The earlier confirm_intent obligation still guards this continuation.
1199
1180
  if (await readPlanSource(artifactsDir)) {
1200
- return handleReadyIntakeContractPipeline(root, artifactsDir, options, runLogger, origin);
1181
+ return handleReadyIntakeContractPipeline(root, artifactsDir, options, origin);
1201
1182
  }
1202
1183
  const inputResolution = resolveInputPaths(root, options.input);
1203
1184
  const intakeResult = await resolveIntakeStep({
1204
1185
  root,
1205
1186
  artifactsDir,
1206
- input: options.input,
1207
1187
  findingSelection: options,
1208
1188
  inputResolution,
1209
1189
  loaderCommand,
@@ -1216,7 +1196,7 @@ async function handlePendingIntake(root, artifactsDir, options, runLogger, origi
1216
1196
  return intakeResult.step;
1217
1197
  }
1218
1198
  // Intake is complete — route both paths through the contract pipeline.
1219
- return handleReadyIntakeContractPipeline(root, artifactsDir, options, runLogger, origin);
1199
+ return handleReadyIntakeContractPipeline(root, artifactsDir, options, origin);
1220
1200
  }
1221
1201
  async function handleNoState(root, artifactsDir) {
1222
1202
  const paths = intakePaths(artifactsDir);
@@ -1239,7 +1219,7 @@ async function handleInputConflict(root, artifactsDir, state, inputResolution, s
1239
1219
  const planId = state.plan?.plan_id ?? "(none)";
1240
1220
  const itemCount = state.items ? Object.keys(state.items).length : 0;
1241
1221
  const suppliedInline = inputResolution.checked.length > 0
1242
- ? inputResolution.checked.map((p) => `\`${p}\``).join(", ")
1222
+ ? backtickList(inputResolution.checked)
1243
1223
  : "(new intake source via `--guidance-file`)";
1244
1224
  const selectionPrompt = selectionConflict ? [
1245
1225
  "# Finding selection changed during an existing intake", "",
@@ -1283,7 +1263,7 @@ Stop after presenting this choice. Do not advance the run until the user decides
1283
1263
  ],
1284
1264
  stopCondition: "Stop after presenting the resume-vs-restart choice to the user.",
1285
1265
  artifactPaths: {
1286
- state_file: join(artifactsDir, "state.json"),
1266
+ state_file: join(artifactsDir, STATE_FILENAME),
1287
1267
  },
1288
1268
  });
1289
1269
  }
@@ -1319,12 +1299,14 @@ function applyClarificationActionToItem(item, res, now) {
1319
1299
  /**
1320
1300
  * Consume clarification_resolution.json for plan-phase clarifications.
1321
1301
  * Mirrors the triage resolution consume: reject_finding → terminal,
1322
- * clarified → re-open (pending) for implement dispatch. Archives the file.
1302
+ * clarified → re-open (pending) for implement dispatch. A refused file is
1303
+ * archived aside with nothing applied; an applied one is recorded in
1304
+ * `decision_applications`.
1323
1305
  */
1324
1306
  async function applyPlanClarificationResolution(root, artifactsDir, state, store) {
1325
1307
  if (!state.plan || !state.items)
1326
1308
  return { kind: "applied", state };
1327
- const resolutionPath = join(artifactsDir, "clarification_resolution.json");
1309
+ const resolutionPath = join(artifactsDir, CLARIFICATION_RESOLUTION_FILENAME);
1328
1310
  const inputSnapshot = await readDecisionSnapshot(resolutionPath);
1329
1311
  const contextDigest = decisionContextDigest(state);
1330
1312
  const parsed = await readPlanClarificationResolutions(resolutionPath, inputSnapshot?.bytes);
@@ -1362,7 +1344,7 @@ async function applyPlanClarificationResolution(root, artifactsDir, state, store
1362
1344
  delete state.host_handoff;
1363
1345
  if (!inputSnapshot)
1364
1346
  throw new Error("Clarification input changed during application; retry without accepting it.");
1365
- (state.decision_applications ??= []).push({ input: "clarification_resolution.json", input_sha256: inputSnapshot.sha256, input_identity_sha256: inputSnapshot.identity_sha256,
1347
+ (state.decision_applications ??= []).push({ input: CLARIFICATION_RESOLUTION_FILENAME, input_sha256: inputSnapshot.sha256, input_identity_sha256: inputSnapshot.identity_sha256,
1366
1348
  context_sha256: contextDigest, run_id: state.plan.plan_id, revision_sha256: state.plan.review_revision_sha256,
1367
1349
  applied_at: now, retry_results: [] });
1368
1350
  const remainingPending = state.plan.units.some((f) => state.items?.[f.id]?.status === "pending");
@@ -1389,7 +1371,7 @@ async function applyPlanClarificationResolution(root, artifactsDir, state, store
1389
1371
  return { kind: "applied", state };
1390
1372
  }
1391
1373
  async function handleWaitingForClarification(root, artifactsDir, state, refusal) {
1392
- const resolutionPath = join(artifactsDir, "clarification_resolution.json");
1374
+ const resolutionPath = join(artifactsDir, CLARIFICATION_RESOLUTION_FILENAME);
1393
1375
  return writeCurrentStep({
1394
1376
  stepKind: "collect_clarifications",
1395
1377
  status: "blocked",
@@ -1405,7 +1387,7 @@ async function handleWaitingForClarification(root, artifactsDir, state, refusal)
1405
1387
  });
1406
1388
  }
1407
1389
  async function handleWaitingForTriage(root, artifactsDir, state) {
1408
- const resolutionPath = join(artifactsDir, "triage_resolution.json");
1390
+ const resolutionPath = join(artifactsDir, TRIAGE_RESOLUTION_FILENAME);
1409
1391
  return writeCurrentStep({
1410
1392
  stepKind: "collect_triage",
1411
1393
  status: "blocked",
@@ -1422,20 +1404,11 @@ async function handleWaitingForTriage(root, artifactsDir, state) {
1422
1404
  });
1423
1405
  }
1424
1406
  /**
1425
- * Path-B (document / conversation) review-necessity gate, fired at the PLANNING
1426
- * point over the deduped/grounded node findings. Path A records its review
1427
- * decision at intake over the ORIGINAL findings — before the contract pipeline
1428
- * collapses them into DAG nodes (`runReviewApprovalGate`). Path B has no
1429
- * pre-pipeline finding set (its findings are DERIVED inside the pipeline), so it
1430
- * is gated here instead. The decision is applied to the existing plan state:
1431
- * declined nodes become a RECORDED terminal disposition (`ignored`) rather than
1432
- * being silently bulk-dispositioned inside a quality-tail node — the 2026-06-15
1433
- * failure this gate exists to prevent.
1434
- *
1435
- * The caller fires this only when `review_decision.json` is ABSENT, so Path A
1436
- * (decision already written at intake) never reaches it — no double review.
1437
- * Returns a halt step while awaiting the user's decision, or null to proceed
1438
- * (decision recorded, any declined nodes marked terminal).
1407
+ * The planning → implementing transition. Emits a blocked step when no approved
1408
+ * executable plan exists or its revision is not the one this run's plan was
1409
+ * reviewed at. Otherwise, when the dispatch frontier is empty, sweeps the
1410
+ * permanently dead blocks first; then sets `implementing`, saves, and
1411
+ * transitions.
1439
1412
  */
1440
1413
  async function handlePlanning(root, artifactsDir, state, store) {
1441
1414
  const approved = await readApprovedExecutionPlan(artifactsDir);
@@ -1602,6 +1575,10 @@ ${bindingBlock}
1602
1575
  }),
1603
1576
  };
1604
1577
  }
1578
+ function explicitFinalGateTestCommand(state) {
1579
+ return state.plan?.test_command && state.plan.test_command_source !== "project_facts"
1580
+ ? parseCommandString(state.plan.test_command) : undefined;
1581
+ }
1605
1582
  /**
1606
1583
  * Whole-repo test-suite gate at a foundations→consumers PHASE BOUNDARY (T3). Runs
1607
1584
  * the tool-owned final gate (INV-RS-10) INLINE before the next phase dispatches,
@@ -1619,10 +1596,6 @@ ${bindingBlock}
1619
1596
  * pass OR the gate is GREEN — in which case the caller proceeds to dispatch the
1620
1597
  * phase.
1621
1598
  */
1622
- function explicitFinalGateTestCommand(state) {
1623
- return state.plan?.test_command && state.plan.test_command_source !== "project_facts"
1624
- ? parseCommandString(state.plan.test_command) : undefined;
1625
- }
1626
1599
  async function runPhaseBoundaryGate(ctx) {
1627
1600
  const { root, artifactsDir, state, options, runLogger } = ctx;
1628
1601
  admitRemediationDirtyBaseline(state);
@@ -1635,13 +1608,14 @@ async function runPhaseBoundaryGate(ctx) {
1635
1608
  return null;
1636
1609
  const scope = `phase ${phase} boundary`;
1637
1610
  const where = `At the phase ${phase} boundary`;
1611
+ const gateKey = `phase_boundary_gate phase=${phase}`;
1638
1612
  const disabledReason = finalGateDisabledReason(options);
1639
1613
  if (disabledReason !== null) {
1640
1614
  await recordFinalGateOutcome({
1641
1615
  artifactsDir,
1642
1616
  state,
1643
1617
  scope,
1644
- gateKey: `phase_boundary_gate phase=${phase}`,
1618
+ gateKey,
1645
1619
  runLogger,
1646
1620
  outcome: "disabled",
1647
1621
  passed: false,
@@ -1660,7 +1634,6 @@ async function runPhaseBoundaryGate(ctx) {
1660
1634
  const tree = await worktreeContentId(root);
1661
1635
  const testCommand = explicitFinalGateTestCommand(state);
1662
1636
  const binding = finalGateBinding(root, testCommand);
1663
- const gateKey = `phase_boundary_gate phase=${phase}`;
1664
1637
  // THE CACHE. The fold re-enters this boundary on every next-step taken before
1665
1638
  // the next phase dispatches, and the floor is build + typecheck + the whole
1666
1639
  // suite — minutes, holding the phase lock. Re-running it on a tree that cannot
@@ -1720,7 +1693,7 @@ async function runPhaseBoundaryGate(ctx) {
1720
1693
  obligation: state.status,
1721
1694
  note: gateKey,
1722
1695
  });
1723
- const gate = await runToolOwnedFinalGate(root, { runner: options.finalGateRunner, testCommand: explicitFinalGateTestCommand(state) });
1696
+ const gate = await runToolOwnedFinalGate(root, { runner: options.finalGateRunner, testCommand });
1724
1697
  await writeFinalGateVerdict(artifactsDir, {
1725
1698
  scope,
1726
1699
  tree,
@@ -1763,13 +1736,11 @@ async function runPhaseBoundaryGate(ctx) {
1763
1736
  }
1764
1737
  async function handleAllTerminalTransition(state, store, root, artifactsDir) {
1765
1738
  // sites-pinned: tests/remediate/host-handoff-corroboration-obligations.test.ts
1766
- if (await reopenStaleTriageSuccesses(root, artifactsDir, state)) {
1767
- await store.saveState(state);
1768
- return { kind: "transition", state };
1739
+ if (!(await reopenStaleTriageSuccesses(root, artifactsDir, state))) {
1740
+ // Final acceptance belongs to the actual close execution, after preview
1741
+ // pauses. A transition carries no executable verification verdict.
1742
+ state.status = "closing";
1769
1743
  }
1770
- // Final acceptance belongs to the actual close execution, after preview
1771
- // pauses. A transition carries no executable verification verdict.
1772
- state.status = "closing";
1773
1744
  await store.saveState(state);
1774
1745
  return { kind: "transition", state };
1775
1746
  }
@@ -1854,7 +1825,7 @@ async function handleClosing(root, artifactsDir, state, runLogger, store, option
1854
1825
  async function handleZeroDocumentableFindings(root, artifactsDir, state) {
1855
1826
  const nextStepCommand = loaderCommand("next-step");
1856
1827
  const nextStepInputCommand = loaderCommand("next-step --input <path>");
1857
- const checkpointPath = join(artifactsDir, "intent_checkpoint.json");
1828
+ const checkpointPath = intakePaths(artifactsDir).intentCheckpoint;
1858
1829
  return writeCurrentStep({
1859
1830
  stepKind: "zero_documentable_findings",
1860
1831
  status: "blocked",
@@ -1916,7 +1887,7 @@ The deterministic fold ${stalled.cause}.
1916
1887
 
1917
1888
  - **Spinning obligation**: \`${stalled.spinning}\`
1918
1889
  - **Backstop that fired**: \`${stalled.stopped}\`
1919
- - **State file**: \`${join(artifactsDir, "state.json")}\`
1890
+ - **State file**: \`${join(artifactsDir, STATE_FILENAME)}\`
1920
1891
 
1921
1892
  An obligation is re-selecting without clearing its own actionable state, so the
1922
1893
  engine stopped the fold rather than looping forever. This is a blocking
@@ -1949,7 +1920,7 @@ async function handleUnhandledState(root, artifactsDir, state) {
1949
1920
  The remediation workflow reached a state it has no transition for.
1950
1921
 
1951
1922
  - **State status**: \`${state.status}\`
1952
- - **State file**: \`${join(artifactsDir, "state.json")}\`
1923
+ - **State file**: \`${join(artifactsDir, STATE_FILENAME)}\`
1953
1924
 
1954
1925
  ## Item Breakdown
1955
1926
 
@@ -1989,7 +1960,7 @@ export async function changeOperatorLifecycle(options) {
1989
1960
  const artifactsDir = resolveArtifactsDir(root, options.artifactsDir);
1990
1961
  await mkdir(artifactsDir, { recursive: true });
1991
1962
  const store = new StateStore(artifactsDir);
1992
- return withFileLock(join(artifactsDir, "phase.lock"), async () => {
1963
+ return withFileLock(join(artifactsDir, PHASE_LOCK_FILENAME), async () => {
1993
1964
  const control = await store.setOperatorLifecycleUnderPhaseLock(options.action, options.hostReport);
1994
1965
  return buildOperatorControlStep(root, artifactsDir, await store.loadState(), control);
1995
1966
  });
@@ -2008,7 +1979,7 @@ export async function decideNextStep(options = {}) {
2008
1979
  });
2009
1980
  const startedAt = Date.now();
2010
1981
  try {
2011
- const step = await decideNextStepLoop(internalOptions, runLogger);
1982
+ const step = await decideNextStepLoop(root, artifactsDir, internalOptions, runLogger);
2012
1983
  runLogger.event({
2013
1984
  phase: "next-step",
2014
1985
  kind: "step",
@@ -2023,7 +1994,7 @@ export async function decideNextStep(options = {}) {
2023
1994
  phase: "next-step",
2024
1995
  kind: "error",
2025
1996
  duration_ms: Date.now() - startedAt,
2026
- note: error instanceof Error ? error.message : String(error),
1997
+ note: errorMessage(error),
2027
1998
  });
2028
1999
  throw error;
2029
2000
  }
@@ -2032,10 +2003,7 @@ async function buildConfirmResumeOrRestartStep(ctx) {
2032
2003
  const { root, artifactsDir, state, ackPath } = ctx;
2033
2004
  const runId = stateRunId(state);
2034
2005
  const nextCommand = loaderCommand("next-step");
2035
- const itemsByStatus = {};
2036
- for (const item of Object.values(state.items ?? {})) {
2037
- itemsByStatus[item.status] = (itemsByStatus[item.status] ?? 0) + 1;
2038
- }
2006
+ const itemsByStatus = countBy(Object.values(state.items ?? {}), (item) => item.status);
2039
2007
  const statusLines = Object.entries(itemsByStatus)
2040
2008
  .map(([status, count]) => `- **${status}**: ${count}`)
2041
2009
  .join("\n");
@@ -2086,7 +2054,7 @@ async function buildConfirmResumeOrRestartStep(ctx) {
2086
2054
  allowedCommands: [nextCommand, loaderCommand("next-step --input <path>")],
2087
2055
  stopCondition: "Stop after presenting the resume/restart/merge choice to the user and writing the ack.",
2088
2056
  artifactPaths: {
2089
- state_file: join(artifactsDir, "state.json"),
2057
+ state_file: join(artifactsDir, STATE_FILENAME),
2090
2058
  confirm_resume_ack: ackPath,
2091
2059
  },
2092
2060
  });
@@ -2101,7 +2069,7 @@ function renderClosingActionSection(facts) {
2101
2069
  const candidateLines = facts.candidate_closing_actions
2102
2070
  .map((action) => `- \`${action}\` — ${facts.candidate_rationale[action] ?? ""}`)
2103
2071
  .join("\n");
2104
- const vocabulary = CLOSING_ACTIONS.map((action) => `\`${action}\``).join(", ");
2072
+ const vocabulary = VALID_CLOSING_ACTIONS_PROSE;
2105
2073
  return [
2106
2074
  "## Closing Action — you choose",
2107
2075
  "",
@@ -2116,7 +2084,7 @@ async function buildConfirmIntentStep(ctx) {
2116
2084
  const { root, artifactsDir, state } = ctx;
2117
2085
  const runId = stateRunId(state);
2118
2086
  const nextCommand = loaderCommand("next-step");
2119
- const checkpointPath = join(artifactsDir, "intent_checkpoint.json");
2087
+ const checkpointPath = intakePaths(artifactsDir).intentCheckpoint;
2120
2088
  // Read a checkpoint the host already wrote, if one exists.
2121
2089
  //
2122
2090
  // This is the GATE, and it reads LENIENTLY on purpose: a checkpoint whose
@@ -2149,7 +2117,7 @@ async function buildConfirmIntentStep(ctx) {
2149
2117
  ? (existing.closing_action ?? rejectedClosingAction?.value)
2150
2118
  : undefined;
2151
2119
  const refusal = rawChoice !== undefined && !isClosingAction(rawChoice)
2152
- ? `> **Refused:** \`closing_action\` ${JSON.stringify(rawChoice)} is not one of ${CLOSING_ACTIONS.map((a) => `\`${a}\``).join(", ")}. Rewrite the checkpoint with a valid value, or omit the field for \`none\`.\n`
2120
+ ? `> **Refused:** \`closing_action\` ${JSON.stringify(rawChoice)} is not one of ${VALID_CLOSING_ACTIONS_PROSE}. Rewrite the checkpoint with a valid value, or omit the field for \`none\`.\n`
2153
2121
  : rawChoice === "custom" && customCommandOf(existing) === null
2154
2122
  ? "> **Refused:** `closing_action` \"custom\" needs `closing_custom_command`, a non-empty argv array such as [\"npm\", \"run\", \"release\"]. Add it, or choose another action.\n"
2155
2123
  : "";
@@ -2306,11 +2274,11 @@ export function buildPreIntakeObligations(ctx, snapshot) {
2306
2274
  const { artifactsDir, inputResolution } = ctx;
2307
2275
  const { existingCheckpoint, rejectedCheckpointFields, resumeAck, entryState, suppliedInputUnchanged, sourceAlreadyBound, inputSelectionChanged, selectionAlreadyBound, selectedSourceChanged, guidanceFileSupplied } = snapshot;
2308
2276
  const ip = intakePaths(artifactsDir);
2309
- const checkpointPath = join(artifactsDir, "intent_checkpoint.json");
2277
+ const checkpointPath = ip.intentCheckpoint;
2310
2278
  const ackPath = join(artifactsDir, "confirm_resume_ack.json");
2311
2279
  /** The refused `closing_action`, if the schema dropped one — see the `fires` note. */
2312
2280
  const rejectedClosingAction = rejectedCheckpointFields.find((field) => field.key === "closing_action");
2313
- const interpretationPath = join(artifactsDir, INTENT_INTERPRETATION_FILENAME);
2281
+ const interpretationPath = intentInterpretationPath(artifactsDir);
2314
2282
  const reportPath = join(dirname(artifactsDir), "remediation-report.md");
2315
2283
  return [
2316
2284
  {
@@ -2397,11 +2365,12 @@ export function buildPreIntakeObligations(ctx, snapshot) {
2397
2365
  state.status !== "pending" &&
2398
2366
  state.status !== "complete" &&
2399
2367
  state.status !== "closing";
2368
+ const planPaths = executionPlanPaths(artifactsDir);
2400
2369
  const fires = invalidClosingAction ||
2401
2370
  (!existsSync(checkpointPath) &&
2402
2371
  (existsSync(ip.summary) ||
2403
- existsSync(executionPlanPaths(artifactsDir).canonical) ||
2404
- existsSync(executionPlanPaths(artifactsDir).source) ||
2372
+ existsSync(planPaths.canonical) ||
2373
+ existsSync(planPaths.source) ||
2405
2374
  activeRunState));
2406
2375
  return fires ? "missing" : "satisfied";
2407
2376
  },
@@ -2449,7 +2418,6 @@ export function buildPreIntakeObligations(ctx, snapshot) {
2449
2418
  if (unresolved.length === 0)
2450
2419
  return { kind: "transition", state };
2451
2420
  const nextCommand = loaderCommand("next-step");
2452
- const checkpointPath = join(artifactsDir, "intent_checkpoint.json");
2453
2421
  const clauseLines = unresolved
2454
2422
  .map((clause) => `- **${clause.clause_id}** — "${clause.text}"\n Question: ${clause.checkpoint_question}`)
2455
2423
  .join("\n");
@@ -2547,7 +2515,7 @@ Then run:
2547
2515
  id: "pending_intake",
2548
2516
  derive: (state) => (state == null ? "missing" : "satisfied"),
2549
2517
  execute: async (_state, c) => {
2550
- const outcome = await handlePendingIntake(c.root, c.artifactsDir, c.options, c.runLogger, "new_pre_edit_run");
2518
+ const outcome = await handlePendingIntake(c.root, c.artifactsDir, c.options, "new_pre_edit_run");
2551
2519
  if (outcome && "step_kind" in outcome) {
2552
2520
  return { kind: "emit", step: outcome };
2553
2521
  }
@@ -2571,8 +2539,8 @@ Then run:
2571
2539
  */
2572
2540
  export function buildMainObligations(ctx) {
2573
2541
  const { root, artifactsDir, options, runLogger, store } = ctx;
2574
- const clarificationResolutionPath = join(artifactsDir, "clarification_resolution.json");
2575
- const triageResolutionPath = join(artifactsDir, "triage_resolution.json");
2542
+ const clarificationResolutionPath = join(artifactsDir, CLARIFICATION_RESOLUTION_FILENAME);
2543
+ const triageResolutionPath = join(artifactsDir, TRIAGE_RESOLUTION_FILENAME);
2576
2544
  return [
2577
2545
  {
2578
2546
  id: "operator_plan_only",
@@ -2774,9 +2742,7 @@ export function buildMainObligations(ctx) {
2774
2742
  * `phase_busy` step; the advance re-loads under the lock, so a peer that
2775
2743
  * persisted between the two is never clobbered.
2776
2744
  */
2777
- async function decideNextStepLoop(options, runLogger) {
2778
- const root = resolveRoot(options.root);
2779
- const artifactsDir = resolveArtifactsDir(root, options.artifactsDir);
2745
+ async function decideNextStepLoop(root, artifactsDir, options, runLogger) {
2780
2746
  await mkdir(artifactsDir, { recursive: true });
2781
2747
  const store = new StateStore(artifactsDir);
2782
2748
  const entryState = await store.loadState();
@@ -2786,7 +2752,7 @@ async function decideNextStepLoop(options, runLogger) {
2786
2752
  obligation: entryState?.status ?? "pending",
2787
2753
  });
2788
2754
  try {
2789
- return await withFileLock(join(artifactsDir, "phase.lock"), () => advanceUnderPhaseLock({ root, artifactsDir, store, options, runLogger }), PHASE_LOCK_TIMEOUT_MS);
2755
+ return await withFileLock(join(artifactsDir, PHASE_LOCK_FILENAME), () => advanceUnderPhaseLock({ root, artifactsDir, store, options, runLogger }), PHASE_LOCK_TIMEOUT_MS);
2790
2756
  }
2791
2757
  catch (error) {
2792
2758
  if (error instanceof FileLockTimeoutError) {
@@ -2809,10 +2775,10 @@ async function advanceUnderPhaseLock(deps) {
2809
2775
  // Loaded FRESH under the mutex: a peer may have advanced and persisted state
2810
2776
  // between the entry read and this process winning the lock.
2811
2777
  let state = await store.loadState();
2812
- const reportOnlyRequest = state?.status === "complete" &&
2813
- options.input === undefined && options.severity === undefined && options.findingIds === undefined &&
2778
+ const bareRequest = options.input === undefined && options.severity === undefined && options.findingIds === undefined &&
2814
2779
  options.guidanceFile === undefined && options.guidanceText === undefined && options.verificationCommand === undefined &&
2815
2780
  options.guidanceFileSupplied !== true && options.forceReplan !== true && options.planOnly !== true && options.finalizeClosing !== true;
2781
+ const reportOnlyRequest = state?.status === "complete" && bareRequest;
2816
2782
  // Only a potential complete/report-only request may inspect plan freshness
2817
2783
  // before baseline admission. No authority write can precede this fence.
2818
2784
  if (state && !reportOnlyRequest)
@@ -2820,8 +2786,12 @@ async function advanceUnderPhaseLock(deps) {
2820
2786
  const currentCanonical = state?.plan ? await readCanonicalPlan(artifactsDir) : undefined;
2821
2787
  const pendingPlanSubmission = existsSync(executionPlanPaths(artifactsDir).submission);
2822
2788
  const revisionMismatch = Boolean(currentCanonical && currentCanonical.revision_sha256 !== state?.plan?.review_revision_sha256);
2823
- if (reportOnlyRequest && !pendingPlanSubmission && !revisionMismatch)
2789
+ const unchangedPlan = !pendingPlanSubmission && !revisionMismatch;
2790
+ // sites-pinned: tests/remediate/phase-close.test.ts
2791
+ if (state && reportOnlyRequest && unchangedPlan) {
2792
+ await retryIncompleteCloseReport(state, { root, artifactsDir }, runLogger);
2824
2793
  return handleComplete(root, artifactsDir, state);
2794
+ }
2825
2795
  if (state && reportOnlyRequest)
2826
2796
  admitRemediationDirtyBaseline(state);
2827
2797
  if (state)
@@ -2838,6 +2808,11 @@ async function advanceUnderPhaseLock(deps) {
2838
2808
  control = await store.setOperatorLifecycleUnderPhaseLock("pause", undefined, "plan-only");
2839
2809
  return buildOperatorControlStep(root, artifactsDir, state, control);
2840
2810
  }
2811
+ if (state?.status === "closing" && bareRequest && unchangedPlan) {
2812
+ const completed = await retryIncompleteCloseReport(state, { root, artifactsDir }, runLogger);
2813
+ if (completed)
2814
+ return handleComplete(root, artifactsDir, await store.loadState());
2815
+ }
2841
2816
  if (options.guidanceFile && options.guidanceText !== undefined)
2842
2817
  throw new Error("Choose --guidance or --guidance-file, not both.");
2843
2818
  const boundSource = await readPlanSource(artifactsDir);
@@ -2880,7 +2855,7 @@ async function advanceUnderPhaseLock(deps) {
2880
2855
  // transitions, never a recursive decideNextStepLoop), so this fires at most once.
2881
2856
  if (state != null && (options.forceReplan || pendingPlanSubmission || revisionMismatch)) {
2882
2857
  await countStep(state);
2883
- const replanOutcome = await forceReplanFromExistingIntake(root, artifactsDir, state, runLogger);
2858
+ const replanOutcome = await forceReplanFromExistingIntake(root, artifactsDir, state);
2884
2859
  // A discarded plan is REPORTED here, not collapsed into `state = null`. Once
2885
2860
  // it is null the loop can no longer tell "the plan was destroyed, and here is
2886
2861
  // why" from "there was never an input", and it emits the second.
@@ -2893,7 +2868,8 @@ async function advanceUnderPhaseLock(deps) {
2893
2868
  }
2894
2869
  // Pre-read the once-async signals the pre-intake derive()s consume
2895
2870
  // synchronously (no transition inside this advance call rewrites either file).
2896
- const checkpointPath = join(artifactsDir, "intent_checkpoint.json");
2871
+ const ip = intakePaths(artifactsDir);
2872
+ const checkpointPath = ip.intentCheckpoint;
2897
2873
  // LENIENT: this read feeds the pre-intake derive()s, whose confirmation
2898
2874
  // obligation is what REFUSES a malformed checkpoint by name and re-asks. A
2899
2875
  // strict read here would pre-empt that obligation with a thrown load error.
@@ -2927,14 +2903,14 @@ async function advanceUnderPhaseLock(deps) {
2927
2903
  // Whether a supplied `--input` matches the input the existing run was built
2928
2904
  // from — so re-passing the same `--input` (the loader does this each next-step)
2929
2905
  // resumes rather than tripping the input_conflict gate.
2930
- const sourceManifest = await readSourceManifest(intakePaths(artifactsDir).sourceManifest);
2906
+ const sourceManifest = await readSourceManifest(ip.sourceManifest);
2931
2907
  const requestedSelection = requestedFindingSelection(options);
2932
2908
  const recordedSelection = sourceManifest?.finding_selection;
2933
2909
  const selectedSourceChanged = recordedSelection !== undefined && (!existsSync(recordedSelection.source_path) ||
2934
2910
  hashContent(await readFile(recordedSelection.source_path, "utf8")) !== recordedSelection.source_hash);
2935
2911
  const inputSelectionChanged = selectedSourceChanged ||
2936
2912
  (requestedSelection !== undefined && JSON.stringify(requestedSelection) !== JSON.stringify(recordedSelection?.criteria));
2937
- const suppliedInputUnchanged = !inputSelectionChanged && suppliedInputMatchesRun(inputResolution, sourceManifest, boundSource?.sources.map(source => source.path).filter(path => resolve(path) !== resolve(intakePaths(artifactsDir).brief)));
2913
+ const suppliedInputUnchanged = !inputSelectionChanged && suppliedInputMatchesRun(inputResolution, sourceManifest, boundSource?.sources.map(source => source.path).filter(path => resolve(path) !== resolve(ip.brief)));
2938
2914
  // The linear pre-intake gates run as obligations through the shared advance
2939
2915
  // loop. An emit returns to the host; a transition re-scans within this call;
2940
2916
  // exhausting them (step === null) means the run is past intake and falls