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
@@ -6,13 +6,14 @@ import { contentSha256 } from "../../shared/submission/hostHandoffCore.js";
6
6
  import { AcceptedConformanceReviewSchema, ContractReviewOutcomeSchema } from "../../shared/types/reviewIndependence.js";
7
7
  import { archiveConformanceSubjects, assertSuccessfulConformance } from "./triageConformance.js";
8
8
  import { readContractReviewOutcomes } from "./closeReviewProvenance.js";
9
- import { dirname, extname, isAbsolute, join, relative } from "node:path";
9
+ import { extname, isAbsolute, join, relative } from "node:path";
10
10
  import { readFileSync, existsSync } from "node:fs";
11
- import { AGENT_FEEDBACK_FILENAME, normalizeRepoPath, parseReflectionsNdjson, readOptionalJsonFile, readOptionalTextFile, renderProcessFeedbackSection, reportDiscardedReflections, stagedAndUntracked, writeJsonFile, writeTextFile, RemediationOutcomeStatusSchema, REMEDIATION_OUTCOMES_CONTRACT_VERSION, countBy, commandLeavesDeclaredShape, parseCommandString, runTrackedAsync, compareCodeUnits, runAdmittedProjectTestCommand, runAdmittedProjectE2eCommand, readSubmissionLedger, assertValidRemediationOutcomesReport, } from "audit-tools/shared";
11
+ import { AGENT_FEEDBACK_FILENAME, normalizeRepoPath, parseReflectionsNdjson, readOptionalJsonFile, readOptionalTextFile, renderProcessFeedbackSection, reportDiscardedReflections, stagedAndUntracked, writeJsonFile, writeTextFile, RemediationOutcomeStatusSchema, REMEDIATION_OUTCOMES_CONTRACT_VERSION, countBy, commandLeavesDeclaredShape, parseCommandString, runTrackedAsync, compareCodeUnits, runAdmittedProjectTestCommand, runAdmittedProjectE2eCommand, readSubmissionLedger, assertValidRemediationOutcomesReport, archiveFrictionRecords, normalizeRepoRelPath, outputDirFor, toPosixPath, uniqueSorted, REMEDIATION_OUTCOMES_FILENAME, REMEDIATION_REPORT_FILENAME, } from "audit-tools/shared";
12
+ import { errorMessage } from "../../shared/io/json.js";
12
13
  import { CONTRACT_PIPELINE_VERIFICATION_REPORT_VERSION } from "audit-tools/shared";
13
14
  import { FAILURE_OUTPUT_TAIL_CHARS } from "./constants.js";
14
15
  import { verifyAnalyzerLeads } from "./closeVerifyAnalyzerLeads.js";
15
- import { verifyLandingGates, } from "./closeVerifyLandingGates.js";
16
+ import { admittedFailureOutput, verifyLandingGates, } from "./closeVerifyLandingGates.js";
16
17
  import { bindSourceVerification, verifyHeadEvidenceAgainstFindings, } from "./closeVerifyHeadEvidence.js";
17
18
  import { intakePaths, readSourceManifest } from "../intake.js";
18
19
  import { isAuditFindingsReport } from "./plan.js";
@@ -33,6 +34,12 @@ import { runCloseAcceptance } from "./closeAcceptance.js";
33
34
  const OUTCOME_KEYS = [
34
35
  ...RemediationOutcomeStatusSchema.options,
35
36
  ];
37
+ /** Source and request outcomes that leave the run unfinished. */
38
+ const UNFINISHED_OUTCOMES = new Set(["blocked", "pending", "deferred"]);
39
+ /** An item status that needs no more work: verified complete, or skipped. */
40
+ function isSettledStatus(status) {
41
+ return isVerifiedCompleteStatus(status) || isSkipStatus(status);
42
+ }
36
43
  /**
37
44
  * Retry-oriented final status per outcome (see RemediationOutcomeFinalStatus).
38
45
  * `verified_already_fixed` (CDC-25) joins `resolved`/`verified_no_change`
@@ -96,9 +103,11 @@ export async function readRunRecoveryFacts(artifactsDir, state) {
96
103
  try {
97
104
  ledger = await readSubmissionLedger(artifactsDir);
98
105
  }
99
- catch {
100
- return { ...NO_RECOVERY };
106
+ catch (error) {
107
+ return { ...NO_RECOVERY, read_error: errorMessage(error) };
101
108
  }
109
+ if (ledger.read_error !== undefined)
110
+ return { ...NO_RECOVERY, read_error: ledger.read_error };
102
111
  const marksFor = (kind) => ledger
103
112
  .filter((event) => event.kind === kind && (runId === undefined || event.run_id === runId))
104
113
  .map((event) => ({
@@ -118,11 +127,7 @@ export async function readRunRecoveryFacts(artifactsDir, state) {
118
127
  dropped_lines: ledger.dropped.length,
119
128
  };
120
129
  }
121
- /**
122
- * Phase 7B — capture one outcome per finding (lens, affected file types, how it
123
- * landed, rework count, closing status). Surface only: the auditor does not
124
- * consume this automatically.
125
- */
130
+ /** The reason a closing action of `none` committed nothing, or that an action failed; otherwise undefined. */
126
131
  function closingStatusReason(closingResult) {
127
132
  if (closingResult.status === "skipped" && closingResult.action === "none") {
128
133
  return "closing action is 'none' — no commit/push/publish configured";
@@ -222,6 +227,11 @@ function reportHeadEvidence(outcome, runLogger) {
222
227
  });
223
228
  }
224
229
  }
230
+ /**
231
+ * Phase 7B — capture one outcome per finding (lens, affected file types, how it
232
+ * landed, rework count, closing status). Surface only: the auditor does not
233
+ * consume this automatically.
234
+ */
225
235
  export function buildRemediationOutcomesReport(state, closingResult,
226
236
  // Defaults to ABSENT so every existing caller keeps compiling AND keeps
227
237
  // telling the truth: a caller that supplies no gate outcome is a run with no
@@ -243,7 +253,7 @@ recovery = NO_RECOVERY, contractReviews = []) {
243
253
  rework_count: item?.rework_count ?? 0,
244
254
  ...(item?.host_landed_commit ? { landed_commit: item.host_landed_commit } : {}),
245
255
  ...(item?.host_landed_files ? { landed_files: [...item.host_landed_files] } : {}),
246
- ...(item?.failure_reason ? { reason: item.failure_reason } : !item ? { reason: "No execution state was recorded for this reviewed unit." } : !isVerifiedCompleteStatus(item.status) && !isSkipStatus(item.status) ? { reason: `Execution unit remains ${item.status}.` } : {}),
256
+ ...(item?.failure_reason ? { reason: item.failure_reason } : !item ? { reason: "No execution state was recorded for this reviewed unit." } : !isSettledStatus(item.status) ? { reason: `Execution unit remains ${item.status}.` } : {}),
247
257
  ...(item?.conformance_review ? { conformance_review: AcceptedConformanceReviewSchema.parse(item.conformance_review) } : {}),
248
258
  ...(item?.started_at ? { started_at: item.started_at } : {}),
249
259
  ...(item?.completed_at ? { completed_at: item.completed_at } : {}),
@@ -254,7 +264,7 @@ recovery = NO_RECOVERY, contractReviews = []) {
254
264
  if (state.plan?.request || requestDisposition) {
255
265
  const units = state.plan?.units ?? [];
256
266
  const items = units.map(unit => state.items?.[unit.id]);
257
- const settled = items.length > 0 && items.every(item => item && (isVerifiedCompleteStatus(item.status) || isSkipStatus(item.status)));
267
+ const settled = items.length > 0 && items.every(item => item && isSettledStatus(item.status));
258
268
  const skipped = items.filter(item => item && isSkipStatus(item.status));
259
269
  const status = requestDisposition?.status ??
260
270
  (items.some(item => !item || isUnsuccessfulEndStatus(item.status)) ? "blocked" :
@@ -283,7 +293,7 @@ recovery = NO_RECOVERY, contractReviews = []) {
283
293
  const linked = units.map(unit => state.items?.[unit.id]);
284
294
  const coverage = state.plan_coverage?.entries.find(entry => entry.finding_id === finding.id);
285
295
  const coverageDrop = coverage && DROP_REASON_BY_DISPOSITION[coverage.disposition];
286
- const settledWithOwnerSkip = linked.length > 0 && linked.every(item => item && (isVerifiedCompleteStatus(item.status) || isSkipStatus(item.status))) && linked.some(item => item && isSkipStatus(item.status));
296
+ const settledWithOwnerSkip = linked.length > 0 && linked.every(item => item && isSettledStatus(item.status)) && linked.some(item => item && isSkipStatus(item.status));
287
297
  const unitOwnerDisposition = settledWithOwnerSkip ? {
288
298
  status: linked.every(item => item?.status === "deemed_inappropriate") ? "declined" : "ignored",
289
299
  reason: linked.filter(item => item && isSkipStatus(item.status)).map(item => item.failure_reason ?? "Owner declined this execution unit").join("; "),
@@ -378,11 +388,9 @@ recovery = NO_RECOVERY, contractReviews = []) {
378
388
  }
379
389
  }
380
390
  }
381
- const fileExts = [
382
- ...new Set((finding?.affected_files ?? [])
383
- .map((file) => extname(file.path).toLowerCase())
384
- .filter((ext) => ext.length > 0)),
385
- ].sort();
391
+ const fileExts = uniqueSorted((finding?.affected_files ?? [])
392
+ .map((file) => extname(file.path).toLowerCase())
393
+ .filter((ext) => ext.length > 0));
386
394
  const durationMs = durationBetweenMs(item.started_at, item.completed_at);
387
395
  const isSuccessfulOutcome = outcome === "resolved" ||
388
396
  outcome === "verified_no_change" ||
@@ -719,8 +727,8 @@ function resolveEditSurfaceManifest(state) {
719
727
  * tool output rather than swept out by the blanket `.audit-tools/` exclude.
720
728
  */
721
729
  function toolDeliverablePaths(options) {
722
- const outputDir = dirname(options.artifactsDir);
723
- return ["remediation-report.md", "remediation-outcomes.json"].map((name) => relative(options.root, join(outputDir, name)).replace(/\\/g, "/"));
730
+ const outputDir = outputDirFor(options.artifactsDir);
731
+ return [REMEDIATION_REPORT_FILENAME, REMEDIATION_OUTCOMES_FILENAME].map((name) => toPosixPath(relative(options.root, join(outputDir, name))));
724
732
  }
725
733
  /**
726
734
  * INVARIANT (V2 fix): remediation close must never commit files the run
@@ -816,7 +824,7 @@ export async function collectStagingFiles(root, manifest, deliverables = []) {
816
824
  * lowercased `normalizeRepoPath` remains the fold-fallback tier.
817
825
  */
818
826
  function repoPathExactKey(path) {
819
- return path.trim().replace(/\\/g, "/").replace(/^\.\//, "");
827
+ return normalizeRepoRelPath(path.trim());
820
828
  }
821
829
  /**
822
830
  * Generate a commit message derived from item summaries and finding titles.
@@ -1055,9 +1063,7 @@ export async function runCombinedTestSuite(state, options) {
1055
1063
  if (!state.plan?.test_command) {
1056
1064
  return { ran: false, passed: true, duration_ms: 0, output: "" };
1057
1065
  }
1058
- const suiteName = Array.isArray(state.plan.test_command)
1059
- ? state.plan.test_command.join(" ")
1060
- : state.plan.test_command;
1066
+ const suiteName = state.plan.test_command;
1061
1067
  if (commandLeavesDeclaredShape(suiteName)) {
1062
1068
  return {
1063
1069
  ran: false,
@@ -1082,12 +1088,7 @@ export async function runCombinedTestSuite(state, options) {
1082
1088
  exit_code: admitted.exit_code,
1083
1089
  suite_name: suiteName,
1084
1090
  duration_ms: Date.now() - startedAt,
1085
- output: passed
1086
- ? ""
1087
- : (admitted.spawn_error ?? admitted.output).trim().slice(-FAILURE_OUTPUT_TAIL_CHARS) ||
1088
- (admitted.timed_out
1089
- ? `default test command timed out after ${CLOSING_CHILD_DEADLINE_MS}ms`
1090
- : "default test command failed without output"),
1091
+ output: passed ? "" : admittedFailureOutput(admitted, "default test command", CLOSING_CHILD_DEADLINE_MS),
1091
1092
  };
1092
1093
  }
1093
1094
  // argv, never a shell string: the shape gate admits only single invocations,
@@ -1102,10 +1103,14 @@ export async function runCombinedTestSuite(state, options) {
1102
1103
  if (result.status === 0) {
1103
1104
  return { ran: true, passed: true, exit_code: result.status, suite_name: suiteName, duration_ms: durationMs, output: "" };
1104
1105
  }
1105
- const output = ((result.stdout?.toString() ?? "") + (result.stderr?.toString() ?? ""))
1106
+ const output = combinedOutputTail(result);
1107
+ return { ran: true, passed: false, exit_code: result.status, suite_name: suiteName, duration_ms: durationMs, output };
1108
+ }
1109
+ /** The tail of a tracked run's stdout then stderr, cut to `FAILURE_OUTPUT_TAIL_CHARS`. */
1110
+ function combinedOutputTail(result) {
1111
+ return ((result.stdout?.toString() ?? "") + (result.stderr?.toString() ?? ""))
1106
1112
  .trim()
1107
1113
  .slice(-FAILURE_OUTPUT_TAIL_CHARS);
1108
- return { ran: true, passed: false, exit_code: result.status, suite_name: suiteName, duration_ms: durationMs, output };
1109
1114
  }
1110
1115
  /**
1111
1116
  * Parse test output to extract implicated file paths. Looks for common test
@@ -1118,14 +1123,11 @@ function extractImplicatedPaths(testOutput) {
1118
1123
  const pathPattern = /(?:FAIL\s+|at\s+\S+\s+\(|●\s+)?([^\s()]+\.[a-z]{1,6})(?::\d+)?/g;
1119
1124
  let match;
1120
1125
  while ((match = pathPattern.exec(testOutput)) !== null) {
1121
- const candidate = match[1];
1122
- // Only keep plausible repo-relative paths (contain at least one slash or look like a file)
1123
- if (candidate.includes("/") || candidate.includes("\\") || /\.[a-z]{1,6}$/.test(candidate)) {
1124
- const normalized = safeAttributionPath(candidate);
1125
- if (normalized &&
1126
- !normalizeRepoPath(normalized).startsWith("node_modules/")) {
1127
- paths.add(normalized);
1128
- }
1126
+ // The capture always ends in `.<ext>`, so every candidate looks like a file.
1127
+ const normalized = safeAttributionPath(match[1]);
1128
+ if (normalized &&
1129
+ !normalizeRepoPath(normalized).startsWith("node_modules/")) {
1130
+ paths.add(normalized);
1129
1131
  }
1130
1132
  }
1131
1133
  return [...paths];
@@ -1137,10 +1139,7 @@ function extractImplicatedPaths(testOutput) {
1137
1139
  * of being collapsed into a different block's declared scope.
1138
1140
  */
1139
1141
  function safeAttributionPath(path) {
1140
- const normalized = path.trim().replace(/\\/g, "/");
1141
- const withoutLeadingDot = normalized.startsWith("./")
1142
- ? normalized.slice(2)
1143
- : normalized;
1142
+ const withoutLeadingDot = normalizeRepoRelPath(path.trim());
1144
1143
  return withoutLeadingDot
1145
1144
  .split("/")
1146
1145
  .some((segment) => segment === "." || segment === "..")
@@ -1171,20 +1170,20 @@ function touchedPathMatchesImplicated(tf, ip) {
1171
1170
  return a.endsWith(`/${b}`) || b.endsWith(`/${a}`);
1172
1171
  }
1173
1172
  /**
1174
- * On a combined-test failure, selectively re-block items whose touched_files
1173
+ * On a combined-test failure, selectively re-block items whose allowed files
1175
1174
  * overlap with the failing tests' implicated paths. When attribution is
1176
1175
  * ambiguous (no overlap found), falls back to re-blocking all resolved items.
1177
1176
  * Returns whether any item was blocked — the caller transitions back to triage.
1178
1177
  *
1179
- * The surface is read from the item's BLOCK (`block.touched_files`), which is
1180
- * REQUIRED on the block contract and is the same scope the host binds an
1181
- * implementer to. It previously read a per-item `item_spec.touched_files`;
1178
+ * The surface is read from the item's execution unit (`unit.allowed_files` on
1179
+ * the plan), which is the same scope the host binds an implementer to. It
1180
+ * previously read a per-item `item_spec.touched_files`;
1182
1181
  * nothing in production ever wrote an item_spec, so that expression was always
1183
1182
  * `[]`, attribution could never succeed, and the ambiguity fallback re-blocked
1184
- * EVERY resolved item on any combined-suite failure. Reading the block is what
1183
+ * EVERY resolved item on any combined-suite failure. Reading the unit is what
1185
1184
  * makes the attribution arm reachable at all.
1186
1185
  */
1187
- export function blockResolvedItemsOnCombinedFailure(state, testOutput) {
1186
+ export function blockResolvedItemsOnCombinedFailure(state, testOutput, suite = "Combined test suite") {
1188
1187
  const resolvedItems = Object.values(state.items ?? {}).filter((i) => isVerifiedCompleteStatus(i.status));
1189
1188
  if (resolvedItems.length === 0)
1190
1189
  return false;
@@ -1209,7 +1208,7 @@ export function blockResolvedItemsOnCombinedFailure(state, testOutput) {
1209
1208
  for (const item of toBlock) {
1210
1209
  item.status = "blocked";
1211
1210
  item.completed_at = now;
1212
- item.failure_reason = `Combined test suite failed after remediation. ${attributionNote}${testOutput ? `\n\nTest output:\n${testOutput}` : ""}`;
1211
+ item.failure_reason = `${suite} failed after remediation. ${attributionNote}${testOutput ? `\n\nTest output:\n${testOutput}` : ""}`;
1213
1212
  }
1214
1213
  return true;
1215
1214
  }
@@ -1246,12 +1245,7 @@ async function runE2eTests(state, options) {
1246
1245
  return {
1247
1246
  ran: true,
1248
1247
  passed,
1249
- output: passed
1250
- ? ""
1251
- : (admitted.spawn_error ?? admitted.output).trim().slice(-FAILURE_OUTPUT_TAIL_CHARS) ||
1252
- (admitted.timed_out
1253
- ? `default e2e command timed out after ${CLOSING_CHILD_DEADLINE_MS}ms`
1254
- : "default e2e command failed without output"),
1248
+ output: passed ? "" : admittedFailureOutput(admitted, "default e2e command", CLOSING_CHILD_DEADLINE_MS),
1255
1249
  };
1256
1250
  }
1257
1251
  const e2eResult = await runTrackedAsync(parseCommandString(state.plan.e2e_command), {
@@ -1261,10 +1255,7 @@ async function runE2eTests(state, options) {
1261
1255
  });
1262
1256
  const e2ePassed = e2eResult.status === 0;
1263
1257
  if (!e2ePassed) {
1264
- const e2eOutput = ((e2eResult.stdout?.toString() ?? "") +
1265
- (e2eResult.stderr?.toString() ?? ""))
1266
- .trim()
1267
- .slice(-FAILURE_OUTPUT_TAIL_CHARS);
1258
+ const e2eOutput = combinedOutputTail(e2eResult);
1268
1259
  console.warn("End-to-end tests failed after remediation. Transitioning to triage.");
1269
1260
  return { ran: true, passed: false, output: e2eOutput };
1270
1261
  }
@@ -1273,10 +1264,9 @@ async function runE2eTests(state, options) {
1273
1264
  }
1274
1265
  /**
1275
1266
  * Partition the terminal items into the report's resolved / verified-no-change
1276
- * / inappropriate / ignored buckets, pulling each resolved item's verification
1277
- * evidence from its `verify_code_against_documentation` result file when present.
1267
+ * / inappropriate / ignored buckets, using the evidence accepted with each unit.
1278
1268
  */
1279
- function collectReportEntries(state, options) {
1269
+ function collectReportEntries(state) {
1280
1270
  const entries = {
1281
1271
  resolved: [],
1282
1272
  verifiedNoChange: [],
@@ -1288,23 +1278,10 @@ function collectReportEntries(state, options) {
1288
1278
  if (isVerifiedCompleteStatus(item.status)) {
1289
1279
  const unit = state.plan?.units.find((u) => u.id === item.unit_id);
1290
1280
  const title = unit?.title ?? item.unit_id;
1291
- let verificationEvidence = item.host_result_evidence;
1292
- const verificationResultPath = join(options.artifactsDir, `result_${item.unit_id}_verify_code_against_documentation.json`);
1293
- if (existsSync(verificationResultPath)) {
1294
- try {
1295
- const verRes = JSON.parse(readFileSync(verificationResultPath, "utf8"));
1296
- if (Array.isArray(verRes.reason) && verRes.reason.length > 0) {
1297
- verificationEvidence = verRes.reason;
1298
- }
1299
- }
1300
- catch (error) {
1301
- console.warn(`Failed to parse verification result ${verificationResultPath}.`, error);
1302
- }
1303
- }
1304
1281
  const entry = {
1305
1282
  unit_id: item.unit_id,
1306
1283
  summary: title,
1307
- verification_evidence: verificationEvidence,
1284
+ verification_evidence: item.host_result_evidence,
1308
1285
  };
1309
1286
  if (item.status === "resolved_no_change") {
1310
1287
  entries.verifiedNoChange.push(entry);
@@ -1334,6 +1311,14 @@ function collectReportEntries(state, options) {
1334
1311
  }
1335
1312
  return entries;
1336
1313
  }
1314
+ /** One resolved or verified-no-change line of the report, with its verification lines. */
1315
+ function renderResolvedEntry(entry) {
1316
+ let text = `- **${entry.unit_id}**: ${entry.summary}\n`;
1317
+ for (const check of entry.verification_evidence ?? []) {
1318
+ text += ` - *Verification*: ${check}\n`;
1319
+ }
1320
+ return text;
1321
+ }
1337
1322
  /**
1338
1323
  * Render `remediation-report.md` from the partitioned entries, closing action,
1339
1324
  * e2e result, and per-finding outcomes. Pure string builder (no I/O).
@@ -1351,10 +1336,10 @@ export function buildRemediationReportMarkdown(state, entries, closingResult, e2
1351
1336
  const completedUnits = executionUnits.filter(unit => unit.status === "resolved" || unit.status === "resolved_no_change").length;
1352
1337
  const skippedUnits = executionUnits.filter(unit => unit.status === "ignored" || unit.status === "deemed_inappropriate").length;
1353
1338
  reportContent += `## Execution units\n\n${executionUnits.length} unit(s): ${completedUnits} verified complete, ${skippedUnits} skipped, ${executionUnits.length - completedUnits - skippedUnits} unfinished.\n\n`;
1354
- for (const unit of outcomesReport.execution_outcomes ?? []) {
1339
+ for (const unit of executionUnits) {
1355
1340
  reportContent += `- **${unit.unit_id}** ${unit.title}: ${unit.status}${unit.reason ? ` — ${unit.reason}` : ""}\n`;
1356
1341
  }
1357
- if (!(outcomesReport.execution_outcomes ?? []).length)
1342
+ if (!executionUnits.length)
1358
1343
  reportContent += "No execution units were required.\n";
1359
1344
  reportContent += "\n";
1360
1345
  // Host results are accepted only after the claimed commit is mechanically
@@ -1380,25 +1365,13 @@ export function buildRemediationReportMarkdown(state, entries, closingResult, e2
1380
1365
  reportContent += `None.\n`;
1381
1366
  }
1382
1367
  else {
1383
- for (const entry of entries.resolved) {
1384
- reportContent += `- **${entry.unit_id}**: ${entry.summary}\n`;
1385
- if (entry.verification_evidence) {
1386
- for (const check of entry.verification_evidence) {
1387
- reportContent += ` - *Verification*: ${check}\n`;
1388
- }
1389
- }
1390
- }
1368
+ for (const entry of entries.resolved)
1369
+ reportContent += renderResolvedEntry(entry);
1391
1370
  }
1392
1371
  if (entries.verifiedNoChange.length > 0) {
1393
1372
  reportContent += `\n## Verified Already Correct (no changes made)\n\n`;
1394
- for (const entry of entries.verifiedNoChange) {
1395
- reportContent += `- **${entry.unit_id}**: ${entry.summary}\n`;
1396
- if (entry.verification_evidence) {
1397
- for (const check of entry.verification_evidence) {
1398
- reportContent += ` - *Verification*: ${check}\n`;
1399
- }
1400
- }
1401
- }
1373
+ for (const entry of entries.verifiedNoChange)
1374
+ reportContent += renderResolvedEntry(entry);
1402
1375
  }
1403
1376
  if (entries.inappropriate.length > 0) {
1404
1377
  reportContent += `\n## Deemed Inappropriate\n\n`;
@@ -1412,7 +1385,8 @@ export function buildRemediationReportMarkdown(state, entries, closingResult, e2
1412
1385
  reportContent += `- **${entry.unit_id}**: ${entry.rationale}\n`;
1413
1386
  }
1414
1387
  }
1415
- const skippedByCheckpoint = (state.plan_coverage?.entries ?? []).filter((e) => e.disposition === "dropped_by_checkpoint");
1388
+ const coverageEntries = state.plan_coverage?.entries ?? [];
1389
+ const skippedByCheckpoint = coverageEntries.filter((e) => e.disposition === "dropped_by_checkpoint");
1416
1390
  if (skippedByCheckpoint.length > 0) {
1417
1391
  reportContent += `\n## Skipped by Intent Checkpoint\n\n`;
1418
1392
  reportContent += `${skippedByCheckpoint.length} finding(s) were excluded from remediation by the intent checkpoint (severity/lens/package/theme filters or excluded scope):\n`;
@@ -1420,7 +1394,7 @@ export function buildRemediationReportMarkdown(state, entries, closingResult, e2
1420
1394
  reportContent += `- **${entry.finding_id}**${entry.title ? `: ${entry.title}` : ""}\n`;
1421
1395
  }
1422
1396
  }
1423
- const droppedByGrounding = (state.plan_coverage?.entries ?? []).filter((e) => e.disposition === "dropped_phantom_paths");
1397
+ const droppedByGrounding = coverageEntries.filter((e) => e.disposition === "dropped_phantom_paths");
1424
1398
  if (droppedByGrounding.length > 0) {
1425
1399
  reportContent += `\n## Dropped by Grounding\n\n`;
1426
1400
  reportContent += `${droppedByGrounding.length} extracted finding(s) were dropped because every cited path was phantom (does not exist in this repository):\n`;
@@ -1429,7 +1403,7 @@ export function buildRemediationReportMarkdown(state, entries, closingResult, e2
1429
1403
  reportContent += `- **${entry.finding_id}**${entry.title ? `: ${entry.title}` : ""}${phantoms ? ` (cited: ${phantoms})` : ""}\n`;
1430
1404
  }
1431
1405
  }
1432
- const ungroundedEvidence = (state.plan_coverage?.entries ?? []).filter((e) => e.disposition === "planned" && e.evidence_grounded === false);
1406
+ const ungroundedEvidence = coverageEntries.filter((e) => e.disposition === "planned" && e.evidence_grounded === false);
1433
1407
  if (ungroundedEvidence.length > 0) {
1434
1408
  reportContent += `\n## Ungrounded Evidence\n\n`;
1435
1409
  reportContent += `${ungroundedEvidence.length} planned finding(s) carried no evidence citing a real repo path and were downgraded to low confidence:\n`;
@@ -1504,10 +1478,13 @@ export function buildRemediationReportMarkdown(state, entries, closingResult, e2
1504
1478
  ...outcomesReport.recovery.accepted_via_recovery,
1505
1479
  ...outcomesReport.recovery.recovered_by_hand,
1506
1480
  ];
1507
- if (marks.length === 0) {
1481
+ if (outcomesReport.recovery.read_error !== undefined) {
1482
+ reportContent += `Recovery report incomplete. The submission ledger could not be read: ${outcomesReport.recovery.read_error}\nRepair the ledger and run next-step to retry reporting.\n`;
1483
+ }
1484
+ else if (marks.length === 0 && outcomesReport.recovery.dropped_lines === 0) {
1508
1485
  reportContent += `None — no submission was readmitted; every accepted submission passed the normal lane's checks.\n`;
1509
1486
  }
1510
- else {
1487
+ else if (marks.length > 0) {
1511
1488
  reportContent += `${marks.length} submission(s) were READMITTED after the normal lane did not accept them. Findings fixed through a recovered submission are less corroborated than the rest of this run's:\n\n`;
1512
1489
  for (const mark of marks) {
1513
1490
  reportContent += `- \`${mark.submission_id}\` (lane \`${mark.lane}\`): ${recoveryLabel(mark.kind)}${mark.issue_code ? ` — \`${mark.issue_code}\`` : ""}\n`;
@@ -1521,7 +1498,12 @@ export function buildRemediationReportMarkdown(state, entries, closingResult, e2
1521
1498
  }
1522
1499
  const o = outcomesReport.by_outcome;
1523
1500
  reportContent += `\n## Remediation Outcomes\n\n`;
1524
- reportContent += `Of ${outcomesReport.total} finding(s): ${o.resolved} resolved, ${o.verified_no_change} verified already correct, ${o.inappropriate} deemed inappropriate, ${o.ignored} ignored, ${o.blocked} blocked, ${o.pending} pending, ${o.deferred} deferred.\n`;
1501
+ const labels = {
1502
+ resolved: "resolved", verified_no_change: "verified already correct", inappropriate: "deemed inappropriate",
1503
+ ignored: "ignored", blocked: "blocked", pending: "pending", deferred: "deferred",
1504
+ verified_already_fixed: "verified already fixed", refuted: "refuted",
1505
+ };
1506
+ reportContent += `Of ${outcomesReport.total} finding(s): ${OUTCOME_KEYS.map(key => `${o[key]} ${labels[key]}`).join(", ")}.\n`;
1525
1507
  const lensNames = Object.keys(outcomesReport.by_lens).sort();
1526
1508
  if (lensNames.length > 0) {
1527
1509
  reportContent += `\nBy lens:\n`;
@@ -1600,11 +1582,10 @@ export async function cleanupTempBranchesAndArtifacts(options, completeState, co
1600
1582
  // a failed final-state persist means a restart resumes from the PRE-close
1601
1583
  // state and re-runs closing actions (re-commit/re-push) with no operator
1602
1584
  // clue why. Surface it on the console and in the structured run log.
1603
- // kind:"error" — see the matching note on the branch-cleanup catch above:
1604
- // this is a run-level diagnostic (the final-state persist itself failed),
1605
- // never a per-finding outcome, so it must not share the "outcome" kind
1606
- // the per-finding loop below emits.
1607
- const reason = error instanceof Error ? error.message : String(error);
1585
+ // kind:"error": this is a run-level diagnostic (the final-state persist
1586
+ // itself failed), never a per-finding outcome, so it does not use the
1587
+ // "outcome" kind.
1588
+ const reason = errorMessage(error);
1608
1589
  console.warn(`Failed to persist the final remediation state — a resumed run may re-execute closing actions: ${reason}`);
1609
1590
  runLogger?.event({
1610
1591
  phase: "close",
@@ -1633,16 +1614,17 @@ export async function cleanupTempBranchesAndArtifacts(options, completeState, co
1633
1614
  // classification (see closingActionCompleted): success, or the skipped
1634
1615
  // action=none no-op — never a skipped non-none close.
1635
1616
  const closingCompleted = closingActionCompleted(closingResult);
1636
- const unresolvedSources = sourceOutcomes.outcomes.some(outcome => ["blocked", "pending", "deferred"].includes(outcome.outcome));
1637
- const unresolvedRequest = sourceOutcomes.request_outcome && ["blocked", "pending", "deferred"].includes(sourceOutcomes.request_outcome.status);
1617
+ const unresolvedSources = sourceOutcomes.outcomes.some(outcome => UNFINISHED_OUTCOMES.has(outcome.outcome));
1618
+ const unresolvedRequest = sourceOutcomes.request_outcome && UNFINISHED_OUTCOMES.has(sourceOutcomes.request_outcome.status);
1638
1619
  const unresolvedUnits = (completeState.plan?.units ?? []).some(unit => {
1639
1620
  const item = completeState.items?.[unit.id];
1640
- return !item || (!isVerifiedCompleteStatus(item.status) && !isSkipStatus(item.status));
1621
+ return !item || !isSettledStatus(item.status);
1641
1622
  });
1642
1623
  const fullyGreen = combinedTest.passed &&
1643
1624
  e2eResult.passed &&
1644
1625
  landingGates.passed &&
1645
1626
  closingCompleted &&
1627
+ sourceOutcomes.recovery.read_error === undefined &&
1646
1628
  !anyBlocked &&
1647
1629
  !unresolvedSources &&
1648
1630
  !unresolvedRequest &&
@@ -1653,7 +1635,7 @@ export async function cleanupTempBranchesAndArtifacts(options, completeState, co
1653
1635
  kind: "artifact_write",
1654
1636
  obligation: "closing",
1655
1637
  artifact: options.artifactsDir,
1656
- note: `Artifacts directory preserved for diagnosis (combinedTest.passed=${combinedTest.passed}, e2e.passed=${e2eResult.passed}, landingGates.passed=${landingGates.passed}, closing=${closingResult.status}, closingAction=${closingResult.action}, anyBlocked=${anyBlocked}, unresolvedSources=${unresolvedSources}, unresolvedUnits=${unresolvedUnits})`,
1638
+ note: `Artifacts directory preserved for diagnosis (combinedTest.passed=${combinedTest.passed}, e2e.passed=${e2eResult.passed}, landingGates.passed=${landingGates.passed}, closing=${closingResult.status}, closingAction=${closingResult.action}, anyBlocked=${anyBlocked}, unresolvedSources=${unresolvedSources}, unresolvedRequest=${Boolean(unresolvedRequest)}, unresolvedUnits=${unresolvedUnits}, recoveryReadError=${sourceOutcomes.recovery.read_error ?? "none"})`,
1657
1639
  });
1658
1640
  return {};
1659
1641
  }
@@ -1672,7 +1654,6 @@ export async function cleanupTempBranchesAndArtifacts(options, completeState, co
1672
1654
  // non-green close already preserves it — so the answer is to KEEP the
1673
1655
  // directory and say why, not to abort a close that has already written its
1674
1656
  // report.
1675
- const { archiveFrictionRecords, outputDirFor } = await import("audit-tools/shared");
1676
1657
  let archiveFailure = "friction archive listing failed";
1677
1658
  try {
1678
1659
  await archiveFrictionRecords({
@@ -1684,7 +1665,7 @@ export async function cleanupTempBranchesAndArtifacts(options, completeState, co
1684
1665
  await archiveConformanceSubjects(options.artifactsDir, outputDirFor(options.artifactsDir));
1685
1666
  }
1686
1667
  catch (error) {
1687
- const reason = error instanceof Error ? error.message : String(error);
1668
+ const reason = errorMessage(error);
1688
1669
  console.warn("Close-out evidence could not be archived, so the artifacts " +
1689
1670
  "directory is kept rather than deleted: " +
1690
1671
  reason);
@@ -1702,7 +1683,7 @@ export async function cleanupTempBranchesAndArtifacts(options, completeState, co
1702
1683
  await rm(options.artifactsDir, { recursive: true, force: true });
1703
1684
  }
1704
1685
  catch (error) {
1705
- const reason = error instanceof Error ? error.message : String(error);
1686
+ const reason = errorMessage(error);
1706
1687
  console.warn("Failed to clean up artifacts directory — manual removal may be needed.");
1707
1688
  runLogger?.event({
1708
1689
  phase: "close",
@@ -1716,16 +1697,10 @@ export async function cleanupTempBranchesAndArtifacts(options, completeState, co
1716
1697
  return {};
1717
1698
  }
1718
1699
  /**
1719
- * Build a VerificationReport from the post-remediation state. One
1720
- * FindingVerificationTrace per terminal finding, with trace entries for:
1721
- * - combined test suite result (task kind)
1722
- * - each item's verification evidence from result files (file kind)
1723
- * - closing action outcome (command kind)
1724
- *
1725
- * Overall status is "passed" when combined tests passed and all resolved
1726
- * items have at least one passing trace. "failed" otherwise.
1700
+ * Project accepted unit evidence onto the reviewed requirements and commands.
1701
+ * Each source finding includes its linked unit traces and its own recorded disposition.
1727
1702
  */
1728
- export function buildVerificationReport(state, options, closingResult, combinedTest) {
1703
+ export function buildVerificationReport(state, _options, closingResult, combinedTest, createdAt = new Date().toISOString()) {
1729
1704
  const units = (state.plan?.units ?? []).map(unit => {
1730
1705
  const item = state.items?.[unit.id];
1731
1706
  const passed = !!item && isVerifiedCompleteStatus(item.status) && combinedTest.passed;
@@ -1745,15 +1720,6 @@ export function buildVerificationReport(state, options, closingResult, combinedT
1745
1720
  trace_id: `${unit.id}:command:${i}`, kind: "command", label: command,
1746
1721
  evidence: [...(item?.host_result_evidence ?? [])], status: passed ? "passed" : "failed",
1747
1722
  });
1748
- const verificationResultPath = join(options.artifactsDir, `result_${unit.id}_verify_code_against_documentation.json`);
1749
- if (existsSync(verificationResultPath)) {
1750
- try {
1751
- const result = JSON.parse(readFileSync(verificationResultPath, "utf8"));
1752
- const evidence = Array.isArray(result.reason) ? result.reason.filter((v) => typeof v === "string") : [];
1753
- traces.push({ trace_id: `${unit.id}:verify-doc`, kind: "file", label: "verify_code_against_documentation", evidence, status: evidence.length ? "passed" : "failed" });
1754
- }
1755
- catch { /* malformed optional evidence cannot establish a passing trace */ }
1756
- }
1757
1723
  if (closingResult.action !== "none")
1758
1724
  traces.push({
1759
1725
  trace_id: `${unit.id}:closing`, kind: "command", label: `closing action: ${closingResult.action}`,
@@ -1773,9 +1739,9 @@ export function buildVerificationReport(state, options, closingResult, combinedT
1773
1739
  ...(outcome.reason ? [{ trace_id: `${outcome.finding_id}:source-disposition`, kind: "task", label: outcome.outcome, evidence: [outcome.reason], status: "failed" }] : []),
1774
1740
  ],
1775
1741
  overall_status: outcome.outcome === "ignored" || outcome.outcome === "inappropriate" ? "skipped"
1776
- : ["blocked", "pending", "deferred"].includes(outcome.outcome) ? "failed" : "passed",
1742
+ : UNFINISHED_OUTCOMES.has(outcome.outcome) ? "failed" : "passed",
1777
1743
  }));
1778
- const requestUnfinished = outcomeReport.request_outcome && ["blocked", "pending", "deferred"].includes(outcomeReport.request_outcome.status);
1744
+ const requestUnfinished = outcomeReport.request_outcome && UNFINISHED_OUTCOMES.has(outcomeReport.request_outcome.status);
1779
1745
  const overallPassed = !requestUnfinished && combinedTest.passed && closingActionCompleted(closingResult) &&
1780
1746
  units.every(unit => unit.overall_status !== "failed") && findings.every(finding => finding.overall_status !== "failed");
1781
1747
  return {
@@ -1783,7 +1749,7 @@ export function buildVerificationReport(state, options, closingResult, combinedT
1783
1749
  ...(state.plan?.goal_id ? { goal_id: state.plan.goal_id } : {}),
1784
1750
  findings, units,
1785
1751
  overall_status: overallPassed ? "passed" : "failed",
1786
- created_at: new Date().toISOString(),
1752
+ created_at: createdAt,
1787
1753
  };
1788
1754
  }
1789
1755
  // sites-pinned: tests/remediate/close-plan-authority.test.ts
@@ -1799,6 +1765,11 @@ async function assertClosingPlanAuthority(state, options) {
1799
1765
  throw new RemediationPlanAuthorityError(issues.join("; "));
1800
1766
  }
1801
1767
  export async function runClosePhase(state, options, runLogger) {
1768
+ const resumed = await retryIncompleteCloseReport(state, options, runLogger);
1769
+ if (resumed)
1770
+ return resumed;
1771
+ if (state.status === "complete")
1772
+ return state;
1802
1773
  admitRemediationDirtyBaseline(state);
1803
1774
  console.log("Running Close Phase...");
1804
1775
  if (!state.plan || !state.items || !state.closing_plan) {
@@ -1815,9 +1786,9 @@ export async function runClosePhase(state, options, runLogger) {
1815
1786
  // runLogger is actually wired, so it changes nothing for a caller that
1816
1787
  // doesn't ask for it.
1817
1788
  {
1818
- const findingIds = new Set((state.plan.units ?? []).map((unit) => unit.id));
1789
+ const unitIds = new Set((state.plan.units ?? []).map((unit) => unit.id));
1819
1790
  const itemIds = new Set(Object.keys(state.items));
1820
- const uncounted = [...findingIds].filter((id) => !itemIds.has(id));
1791
+ const uncounted = [...unitIds].filter((id) => !itemIds.has(id));
1821
1792
  if (uncounted.length > 0) {
1822
1793
  runLogger?.event({
1823
1794
  phase: "close",
@@ -1941,7 +1912,7 @@ export async function runClosePhase(state, options, runLogger) {
1941
1912
  const e2eResult = await runE2eTests(state, options);
1942
1913
  if (!e2eResult.passed) {
1943
1914
  console.log("End-to-end tests failed. Transitioning back to triage.");
1944
- if (blockResolvedItemsOnCombinedFailure(state, e2eResult.output)) {
1915
+ if (blockResolvedItemsOnCombinedFailure(state, e2eResult.output, "End-to-end tests")) {
1945
1916
  runLogger?.event({
1946
1917
  phase: "close",
1947
1918
  kind: "state",
@@ -1998,21 +1969,55 @@ export async function runClosePhase(state, options, runLogger) {
1998
1969
  // reporting success.
1999
1970
  console.log(`Executing closing action: ${state.closing_plan.action}`);
2000
1971
  const closingResult = await executeClosingAction(state, options);
2001
- await writeJsonFile(join(options.artifactsDir, "remediation-closing-result.json"), closingResult);
2002
- // 4. Generate remediation-report.md and remediation-report.json
2003
- const entries = collectReportEntries(state, options);
2004
- // Phase 7B: capture per-finding outcomes (surface only), carrying the run's
2005
- // tool-owned gate outcome so the report can say which of executed / scoped-out
2006
- // / disabled / absent this run actually was.
2007
- // The run's recovery record, read HERE — the single point from which both the
2008
- // outcomes contract and the markdown render take it. Read before
2009
- // `cleanupTempBranchesAndArtifacts`, which deletes the artifacts directory
2010
- // (and the ledger under it) on a green close; the value is THREADED into the
2011
- // builders rather than re-read by them, so neither can resurrect a deleted
2012
- // file. A read failure is stated, never laundered into a clean-looking empty
2013
- // set: the alternative makes "the ledger was unreadable" report as "this run
2014
- // was clean", which is the collapse the ledger exists to prevent.
1972
+ const context = {
1973
+ combinedTest, e2eResult, landingGates, contractReviews, endedAt: new Date().toISOString(),
1974
+ };
1975
+ // Persist the irreversible action's result and the facts needed to report it in
1976
+ // one atomic rename, before attempting any ledger read or report write.
1977
+ await writeJsonFile(join(options.artifactsDir, CLOSING_RESULT_FILENAME), {
1978
+ ...closingResult,
1979
+ pending_report: { verified_state: state, context, sha256: contentSha256([closingResult, state, context]) },
1980
+ });
1981
+ return reportRecordedClose(state, options, closingResult, context, runLogger, false);
1982
+ }
1983
+ // sites-pinned: tests/remediate/phase-close.test.ts
1984
+ const CLOSING_RESULT_FILENAME = "remediation-closing-result.json";
1985
+ /** Resume after the authorized action, including when a report write failed before state became complete. */
1986
+ export async function retryIncompleteCloseReport(state, options, runLogger) {
1987
+ const saved = await readOptionalJsonFile(join(options.artifactsDir, CLOSING_RESULT_FILENAME));
1988
+ if (!saved || !("pending_report" in saved))
1989
+ return;
1990
+ const { pending_report: retry, ...closingResult } = saved;
1991
+ const verified = retry?.verified_state;
1992
+ if (!retry || !verified?.plan || !state.plan || (state.status !== "complete" && state.status !== "closing") ||
1993
+ verified.plan.plan_id !== state.plan.plan_id || verified.started_at !== state.started_at ||
1994
+ verified.plan.review_revision_sha256 !== state.plan.review_revision_sha256 ||
1995
+ verified.closing_plan?.action !== state.closing_plan?.action) {
1996
+ throw new Error("Saved reporting retry does not match this remediation run and closing plan.");
1997
+ }
1998
+ if (retry.sha256 !== contentSha256([closingResult, verified, retry.context])) {
1999
+ throw new Error("Saved closing result or reporting inputs changed. Cannot retry reporting.");
2000
+ }
2001
+ return reportRecordedClose(verified, options, closingResult, retry.context, runLogger, true);
2002
+ }
2003
+ async function reportRecordedClose(state, options, closingResult, context, runLogger, reportingRetry) {
2015
2004
  const recovery = await readRunRecoveryFacts(options.artifactsDir, state);
2005
+ const completed = await finishCloseReport(state, options, closingResult, context, recovery, runLogger, reportingRetry);
2006
+ const resultPath = join(options.artifactsDir, CLOSING_RESULT_FILENAME);
2007
+ if (recovery.read_error === undefined && existsSync(resultPath)) {
2008
+ // A preserved run can still have its old closing state if the final state write failed.
2009
+ // Keep the action receipt available until a restart will see a completed state.
2010
+ const { StateStore } = await import("../state/store.js");
2011
+ const persisted = await new StateStore(options.artifactsDir).loadState();
2012
+ if (persisted?.status === "complete") {
2013
+ await writeJsonFile(resultPath, closingResult);
2014
+ }
2015
+ }
2016
+ return completed;
2017
+ }
2018
+ async function finishCloseReport(state, options, closingResult, { combinedTest, e2eResult, landingGates, contractReviews, endedAt }, recovery, runLogger, reportingRetry = false) {
2019
+ // 5. Generate remediation-report.md and remediation-outcomes.json
2020
+ const entries = collectReportEntries(state);
2016
2021
  // Hydrate original coverage-only sources before ANY outcome or verification
2017
2022
  // projection. Reading them after building outcomes silently loses excluded
2018
2023
  // originals from the otherwise self-contained source report.
@@ -2026,7 +2031,7 @@ export async function runClosePhase(state, options, runLogger) {
2026
2031
  // at close would be a duplicate — and `kind: "outcome"` at close means "one
2027
2032
  // per finding", which a run-level line would quietly break.
2028
2033
  // One run-log line per outcome, plus a summary line for the artifact write.
2029
- for (const outcome of outcomesReport.outcomes) {
2034
+ for (const outcome of reportingRetry ? [] : outcomesReport.outcomes) {
2030
2035
  runLogger?.event({
2031
2036
  phase: "close",
2032
2037
  kind: "outcome",
@@ -2034,7 +2039,6 @@ export async function runClosePhase(state, options, runLogger) {
2034
2039
  note: `${outcome.finding_id} [${outcome.lens}] → ${outcome.outcome} (rework ${outcome.rework_count})`,
2035
2040
  });
2036
2041
  }
2037
- const endedAt = new Date().toISOString();
2038
2042
  // Workers may have appended opt-in reflections during document/implement
2039
2043
  // dispatch; parse leniently (malformed lines skipped) and surface them in the
2040
2044
  // report. Workers own the file — it is read-only here.
@@ -2042,7 +2046,8 @@ export async function runClosePhase(state, options, runLogger) {
2042
2046
  const closeFeedback = feedbackText
2043
2047
  ? parseReflectionsNdjson(feedbackText)
2044
2048
  : { reflections: [], discarded: [] };
2045
- reportDiscardedReflections(closeFeedback.discarded, "remediate-code");
2049
+ if (!reportingRetry)
2050
+ reportDiscardedReflections(closeFeedback.discarded, "remediate-code");
2046
2051
  const reportContent = buildRemediationReportMarkdown(state, entries, closingResult, e2eResult.ran ? e2eResult.passed : undefined, outcomesReport, combinedTest, closeFeedback.reflections, landingGates);
2047
2052
  const outcomesFile = {
2048
2053
  ...outcomesReport,
@@ -2057,7 +2062,7 @@ export async function runClosePhase(state, options, runLogger) {
2057
2062
  },
2058
2063
  ...(e2eResult.ran ? { e2e_result: { passed: e2eResult.passed } } : {}),
2059
2064
  closing_result: {
2060
- action: state.closing_plan.action,
2065
+ action: closingResult.action,
2061
2066
  status: closingResult.status,
2062
2067
  commands: closingResult.commands,
2063
2068
  // Untouched-user-dirt set collectStagingFiles left alone (never staged) —
@@ -2076,17 +2081,21 @@ export async function runClosePhase(state, options, runLogger) {
2076
2081
  // here, BEFORE the write, so a refusal leaves none of the four artifacts
2077
2082
  // written for a consumer to find much later.
2078
2083
  assertValidRemediationOutcomesReport(outcomesFile);
2079
- const outputDir = dirname(options.artifactsDir);
2080
- // 5. Write verification_report.json for the contract pipeline closing phase.
2081
- const verificationReport = buildVerificationReport(state, options, closingResult, combinedTest);
2084
+ const outputDir = outputDirFor(options.artifactsDir);
2085
+ // 6. Write verification_report.json for the contract pipeline closing phase.
2086
+ const verificationReport = buildVerificationReport(state, options, closingResult, combinedTest, endedAt);
2082
2087
  const verificationReportPath = join(outputDir, "verification_report.json");
2083
2088
  const completeState = { ...state, status: "complete" };
2084
- await Promise.all([
2085
- writeTextFile(join(outputDir, "remediation-report.md"), reportContent),
2086
- writeJsonFile(join(outputDir, "remediation-outcomes.json"), outcomesFile),
2089
+ // Keep the phase lock until every in-flight write settles, including on a reporting retry.
2090
+ const writes = await Promise.allSettled([
2091
+ writeTextFile(join(outputDir, REMEDIATION_REPORT_FILENAME), reportContent),
2092
+ writeJsonFile(join(outputDir, REMEDIATION_OUTCOMES_FILENAME), outcomesFile),
2087
2093
  writeJsonFile(verificationReportPath, verificationReport),
2088
2094
  writeJsonFile(join(outputDir, "remediation-state.complete.json"), completeState),
2089
2095
  ]);
2096
+ const failure = writes.find(write => write.status === "rejected");
2097
+ if (failure)
2098
+ throw failure.reason;
2090
2099
  runLogger?.event({
2091
2100
  phase: "close",
2092
2101
  kind: "artifact_write",
@@ -2109,7 +2118,7 @@ export async function runClosePhase(state, options, runLogger) {
2109
2118
  note: "complete remediation state preserved for retry/recovery",
2110
2119
  });
2111
2120
  console.log("Remediation report generated.");
2112
- // 6. Clean up temporary branches and artifact directory (only when fully green).
2121
+ // 7. Persist the final state, then delete the artifacts directory (only when fully green).
2113
2122
  await cleanupTempBranchesAndArtifacts(options, completeState, combinedTest, e2eResult, closingResult, runLogger, landingGates, outcomesReport);
2114
2123
  return completeState;
2115
2124
  }