audit-tools 0.55.20 → 0.56.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (784) hide show
  1. package/dist/audit/cli/auditStep.d.ts.map +1 -1
  2. package/dist/audit/cli/auditStep.js +6 -8
  3. package/dist/audit/cli/auditStep.js.map +1 -1
  4. package/dist/audit/cli/charterExtractionPrompt.d.ts +2 -4
  5. package/dist/audit/cli/charterExtractionPrompt.d.ts.map +1 -1
  6. package/dist/audit/cli/charterExtractionPrompt.js +15 -0
  7. package/dist/audit/cli/charterExtractionPrompt.js.map +1 -1
  8. package/dist/audit/cli/cleanup.js +2 -2
  9. package/dist/audit/cli/cleanup.js.map +1 -1
  10. package/dist/audit/cli/cleanupCommand.d.ts.map +1 -1
  11. package/dist/audit/cli/cleanupCommand.js +11 -10
  12. package/dist/audit/cli/cleanupCommand.js.map +1 -1
  13. package/dist/audit/cli/conceptualDispatch.d.ts.map +1 -1
  14. package/dist/audit/cli/conceptualDispatch.js +26 -20
  15. package/dist/audit/cli/conceptualDispatch.js.map +1 -1
  16. package/dist/audit/cli/confirmIntentStep.d.ts.map +1 -1
  17. package/dist/audit/cli/confirmIntentStep.js +3 -5
  18. package/dist/audit/cli/confirmIntentStep.js.map +1 -1
  19. package/dist/audit/cli/dispatch/hostHandoff.d.ts.map +1 -1
  20. package/dist/audit/cli/dispatch/hostHandoff.js +46 -68
  21. package/dist/audit/cli/dispatch/hostHandoff.js.map +1 -1
  22. package/dist/audit/cli/explainTaskCommand.d.ts.map +1 -1
  23. package/dist/audit/cli/explainTaskCommand.js +3 -2
  24. package/dist/audit/cli/explainTaskCommand.js.map +1 -1
  25. package/dist/audit/cli/fanoutLanes.d.ts.map +1 -1
  26. package/dist/audit/cli/fanoutLanes.js +7 -6
  27. package/dist/audit/cli/fanoutLanes.js.map +1 -1
  28. package/dist/audit/cli/laneSubmissions.d.ts +0 -13
  29. package/dist/audit/cli/laneSubmissions.d.ts.map +1 -1
  30. package/dist/audit/cli/laneSubmissions.js +28 -19
  31. package/dist/audit/cli/laneSubmissions.js.map +1 -1
  32. package/dist/audit/cli/laneValidators.d.ts +7 -1
  33. package/dist/audit/cli/laneValidators.d.ts.map +1 -1
  34. package/dist/audit/cli/laneValidators.js +15 -10
  35. package/dist/audit/cli/laneValidators.js.map +1 -1
  36. package/dist/audit/cli/lineIndex.d.ts.map +1 -1
  37. package/dist/audit/cli/lineIndex.js +4 -3
  38. package/dist/audit/cli/lineIndex.js.map +1 -1
  39. package/dist/audit/cli/nextStepCommand.d.ts.map +1 -1
  40. package/dist/audit/cli/nextStepCommand.js +6 -7
  41. package/dist/audit/cli/nextStepCommand.js.map +1 -1
  42. package/dist/audit/cli/nextStepHelpers.d.ts +29 -17
  43. package/dist/audit/cli/nextStepHelpers.d.ts.map +1 -1
  44. package/dist/audit/cli/nextStepHelpers.js +75 -130
  45. package/dist/audit/cli/nextStepHelpers.js.map +1 -1
  46. package/dist/audit/cli/recoverSubmissionCommand.d.ts.map +1 -1
  47. package/dist/audit/cli/recoverSubmissionCommand.js +5 -4
  48. package/dist/audit/cli/recoverSubmissionCommand.js.map +1 -1
  49. package/dist/audit/cli/resynthesizeCommand.d.ts.map +1 -1
  50. package/dist/audit/cli/resynthesizeCommand.js +3 -1
  51. package/dist/audit/cli/resynthesizeCommand.js.map +1 -1
  52. package/dist/audit/cli/reviewRun.d.ts +0 -6
  53. package/dist/audit/cli/reviewRun.d.ts.map +1 -1
  54. package/dist/audit/cli/reviewRun.js +11 -18
  55. package/dist/audit/cli/reviewRun.js.map +1 -1
  56. package/dist/audit/cli/reviewSubmission.d.ts.map +1 -1
  57. package/dist/audit/cli/reviewSubmission.js +16 -8
  58. package/dist/audit/cli/reviewSubmission.js.map +1 -1
  59. package/dist/audit/cli/semanticReviewStep.d.ts +5 -5
  60. package/dist/audit/cli/semanticReviewStep.d.ts.map +1 -1
  61. package/dist/audit/cli/semanticReviewStep.js +5 -0
  62. package/dist/audit/cli/semanticReviewStep.js.map +1 -1
  63. package/dist/audit/cli/statusCommand.d.ts.map +1 -1
  64. package/dist/audit/cli/statusCommand.js +3 -2
  65. package/dist/audit/cli/statusCommand.js.map +1 -1
  66. package/dist/audit/cli/steps.d.ts +11 -11
  67. package/dist/audit/cli/steps.d.ts.map +1 -1
  68. package/dist/audit/cli/steps.js +11 -11
  69. package/dist/audit/cli/steps.js.map +1 -1
  70. package/dist/audit/cli/submitCommand.d.ts.map +1 -1
  71. package/dist/audit/cli/submitCommand.js +9 -4
  72. package/dist/audit/cli/submitCommand.js.map +1 -1
  73. package/dist/audit/cli/submitGateResult.d.ts.map +1 -1
  74. package/dist/audit/cli/submitGateResult.js +2 -1
  75. package/dist/audit/cli/submitGateResult.js.map +1 -1
  76. package/dist/audit/cli/unacceptResultsCommand.d.ts +3 -2
  77. package/dist/audit/cli/unacceptResultsCommand.d.ts.map +1 -1
  78. package/dist/audit/cli/unacceptResultsCommand.js +8 -6
  79. package/dist/audit/cli/unacceptResultsCommand.js.map +1 -1
  80. package/dist/audit/cli/validateResultsCommand.d.ts.map +1 -1
  81. package/dist/audit/cli/validateResultsCommand.js +5 -4
  82. package/dist/audit/cli/validateResultsCommand.js.map +1 -1
  83. package/dist/audit/cli.d.ts +0 -2
  84. package/dist/audit/cli.d.ts.map +1 -1
  85. package/dist/audit/cli.js +2 -2
  86. package/dist/audit/cli.js.map +1 -1
  87. package/dist/audit/decompose/buildStructureDecomposition.d.ts.map +1 -1
  88. package/dist/audit/decompose/buildStructureDecomposition.js +5 -5
  89. package/dist/audit/decompose/buildStructureDecomposition.js.map +1 -1
  90. package/dist/audit/extractors/analyzers/merge.d.ts.map +1 -1
  91. package/dist/audit/extractors/analyzers/merge.js +4 -11
  92. package/dist/audit/extractors/analyzers/merge.js.map +1 -1
  93. package/dist/audit/extractors/analyzers/typescript.d.ts.map +1 -1
  94. package/dist/audit/extractors/analyzers/typescript.js +3 -14
  95. package/dist/audit/extractors/analyzers/typescript.js.map +1 -1
  96. package/dist/audit/extractors/browserExtension.d.ts.map +1 -1
  97. package/dist/audit/extractors/browserExtension.js +3 -2
  98. package/dist/audit/extractors/browserExtension.js.map +1 -1
  99. package/dist/audit/extractors/commentDecomposition.d.ts +1 -1
  100. package/dist/audit/extractors/commentDecomposition.d.ts.map +1 -1
  101. package/dist/audit/extractors/commentDecomposition.js +16 -33
  102. package/dist/audit/extractors/commentDecomposition.js.map +1 -1
  103. package/dist/audit/extractors/dataStateCoupling.d.ts +4 -0
  104. package/dist/audit/extractors/dataStateCoupling.d.ts.map +1 -1
  105. package/dist/audit/extractors/dataStateCoupling.js +26 -12
  106. package/dist/audit/extractors/dataStateCoupling.js.map +1 -1
  107. package/dist/audit/extractors/designAssessment.js +1 -1
  108. package/dist/audit/extractors/designAssessment.js.map +1 -1
  109. package/dist/audit/extractors/disposition.d.ts.map +1 -1
  110. package/dist/audit/extractors/disposition.js +24 -40
  111. package/dist/audit/extractors/disposition.js.map +1 -1
  112. package/dist/audit/extractors/docsDigest.js +1 -1
  113. package/dist/audit/extractors/docsDigest.js.map +1 -1
  114. package/dist/audit/extractors/flows.d.ts.map +1 -1
  115. package/dist/audit/extractors/flows.js +23 -19
  116. package/dist/audit/extractors/flows.js.map +1 -1
  117. package/dist/audit/extractors/fsIntake.d.ts.map +1 -1
  118. package/dist/audit/extractors/fsIntake.js +8 -5
  119. package/dist/audit/extractors/fsIntake.js.map +1 -1
  120. package/dist/audit/extractors/gitHistory.d.ts +6 -6
  121. package/dist/audit/extractors/gitHistory.d.ts.map +1 -1
  122. package/dist/audit/extractors/gitHistory.js +6 -6
  123. package/dist/audit/extractors/gitHistory.js.map +1 -1
  124. package/dist/audit/extractors/graph.d.ts +3 -1
  125. package/dist/audit/extractors/graph.d.ts.map +1 -1
  126. package/dist/audit/extractors/graph.js +15 -17
  127. package/dist/audit/extractors/graph.js.map +1 -1
  128. package/dist/audit/extractors/graphManifestEdges/packageJson.d.ts.map +1 -1
  129. package/dist/audit/extractors/graphManifestEdges/packageJson.js +23 -40
  130. package/dist/audit/extractors/graphManifestEdges/packageJson.js.map +1 -1
  131. package/dist/audit/extractors/graphPathUtils.d.ts +9 -0
  132. package/dist/audit/extractors/graphPathUtils.d.ts.map +1 -1
  133. package/dist/audit/extractors/graphPathUtils.js +35 -16
  134. package/dist/audit/extractors/graphPathUtils.js.map +1 -1
  135. package/dist/audit/extractors/graphRoutes.d.ts.map +1 -1
  136. package/dist/audit/extractors/graphRoutes.js +3 -7
  137. package/dist/audit/extractors/graphRoutes.js.map +1 -1
  138. package/dist/audit/extractors/graphSignals.d.ts.map +1 -1
  139. package/dist/audit/extractors/graphSignals.js +40 -29
  140. package/dist/audit/extractors/graphSignals.js.map +1 -1
  141. package/dist/audit/extractors/graphSuites.d.ts.map +1 -1
  142. package/dist/audit/extractors/graphSuites.js +4 -7
  143. package/dist/audit/extractors/graphSuites.js.map +1 -1
  144. package/dist/audit/extractors/graphTestSources.d.ts.map +1 -1
  145. package/dist/audit/extractors/graphTestSources.js +3 -10
  146. package/dist/audit/extractors/graphTestSources.js.map +1 -1
  147. package/dist/audit/extractors/pathPatterns.d.ts +4 -2
  148. package/dist/audit/extractors/pathPatterns.d.ts.map +1 -1
  149. package/dist/audit/extractors/pathPatterns.js +13 -21
  150. package/dist/audit/extractors/pathPatterns.js.map +1 -1
  151. package/dist/audit/extractors/risk.d.ts.map +1 -1
  152. package/dist/audit/extractors/risk.js +7 -7
  153. package/dist/audit/extractors/risk.js.map +1 -1
  154. package/dist/audit/extractors/surfaces.d.ts.map +1 -1
  155. package/dist/audit/extractors/surfaces.js +3 -9
  156. package/dist/audit/extractors/surfaces.js.map +1 -1
  157. package/dist/audit/io/artifacts.d.ts +1 -3
  158. package/dist/audit/io/artifacts.d.ts.map +1 -1
  159. package/dist/audit/io/artifacts.js +9 -9
  160. package/dist/audit/io/artifacts.js.map +1 -1
  161. package/dist/audit/io/rollover.d.ts.map +1 -1
  162. package/dist/audit/io/rollover.js +0 -1
  163. package/dist/audit/io/rollover.js.map +1 -1
  164. package/dist/audit/io/runArtifacts.d.ts +30 -2
  165. package/dist/audit/io/runArtifacts.d.ts.map +1 -1
  166. package/dist/audit/io/runArtifacts.js +23 -23
  167. package/dist/audit/io/runArtifacts.js.map +1 -1
  168. package/dist/audit/io/runSnapshot.js +2 -2
  169. package/dist/audit/io/runSnapshot.js.map +1 -1
  170. package/dist/audit/io/toolingManifest.d.ts.map +1 -1
  171. package/dist/audit/io/toolingManifest.js +7 -9
  172. package/dist/audit/io/toolingManifest.js.map +1 -1
  173. package/dist/audit/orchestrator/advance.d.ts +6 -0
  174. package/dist/audit/orchestrator/advance.d.ts.map +1 -1
  175. package/dist/audit/orchestrator/advance.js +70 -95
  176. package/dist/audit/orchestrator/advance.js.map +1 -1
  177. package/dist/audit/orchestrator/architectureDiscovery.d.ts +6 -2
  178. package/dist/audit/orchestrator/architectureDiscovery.d.ts.map +1 -1
  179. package/dist/audit/orchestrator/architectureDiscovery.js +19 -14
  180. package/dist/audit/orchestrator/architectureDiscovery.js.map +1 -1
  181. package/dist/audit/orchestrator/artifactMetadata.d.ts.map +1 -1
  182. package/dist/audit/orchestrator/artifactMetadata.js +12 -15
  183. package/dist/audit/orchestrator/artifactMetadata.js.map +1 -1
  184. package/dist/audit/orchestrator/auditTaskUtils.d.ts +13 -0
  185. package/dist/audit/orchestrator/auditTaskUtils.d.ts.map +1 -1
  186. package/dist/audit/orchestrator/auditTaskUtils.js +10 -3
  187. package/dist/audit/orchestrator/auditTaskUtils.js.map +1 -1
  188. package/dist/audit/orchestrator/autoFixExecutor.d.ts.map +1 -1
  189. package/dist/audit/orchestrator/autoFixExecutor.js +2 -8
  190. package/dist/audit/orchestrator/autoFixExecutor.js.map +1 -1
  191. package/dist/audit/orchestrator/charterClarificationExecutor.d.ts +4 -2
  192. package/dist/audit/orchestrator/charterClarificationExecutor.d.ts.map +1 -1
  193. package/dist/audit/orchestrator/charterClarificationExecutor.js +12 -20
  194. package/dist/audit/orchestrator/charterClarificationExecutor.js.map +1 -1
  195. package/dist/audit/orchestrator/charterComparisonExecutor.d.ts.map +1 -1
  196. package/dist/audit/orchestrator/charterComparisonExecutor.js +5 -9
  197. package/dist/audit/orchestrator/charterComparisonExecutor.js.map +1 -1
  198. package/dist/audit/orchestrator/charterExtractionExecutor.d.ts +5 -0
  199. package/dist/audit/orchestrator/charterExtractionExecutor.d.ts.map +1 -1
  200. package/dist/audit/orchestrator/charterExtractionExecutor.js +10 -5
  201. package/dist/audit/orchestrator/charterExtractionExecutor.js.map +1 -1
  202. package/dist/audit/orchestrator/charterFidelityPacket.d.ts.map +1 -1
  203. package/dist/audit/orchestrator/charterFidelityPacket.js +1 -2
  204. package/dist/audit/orchestrator/charterFidelityPacket.js.map +1 -1
  205. package/dist/audit/orchestrator/charterPacketArchive.d.ts.map +1 -1
  206. package/dist/audit/orchestrator/charterPacketArchive.js +11 -7
  207. package/dist/audit/orchestrator/charterPacketArchive.js.map +1 -1
  208. package/dist/audit/orchestrator/charterPackets.d.ts.map +1 -1
  209. package/dist/audit/orchestrator/charterPackets.js +30 -69
  210. package/dist/audit/orchestrator/charterPackets.js.map +1 -1
  211. package/dist/audit/orchestrator/dependencyMap.d.ts +0 -1
  212. package/dist/audit/orchestrator/dependencyMap.d.ts.map +1 -1
  213. package/dist/audit/orchestrator/dependencyMap.js +0 -7
  214. package/dist/audit/orchestrator/dependencyMap.js.map +1 -1
  215. package/dist/audit/orchestrator/dependencySlices.d.ts +20 -0
  216. package/dist/audit/orchestrator/dependencySlices.d.ts.map +1 -1
  217. package/dist/audit/orchestrator/dependencySlices.js +20 -20
  218. package/dist/audit/orchestrator/dependencySlices.js.map +1 -1
  219. package/dist/audit/orchestrator/designReviewProjection.d.ts +1 -3
  220. package/dist/audit/orchestrator/designReviewProjection.d.ts.map +1 -1
  221. package/dist/audit/orchestrator/designReviewProjection.js +8 -2
  222. package/dist/audit/orchestrator/designReviewProjection.js.map +1 -1
  223. package/dist/audit/orchestrator/designReviewPrompt.d.ts +2 -11
  224. package/dist/audit/orchestrator/designReviewPrompt.d.ts.map +1 -1
  225. package/dist/audit/orchestrator/designReviewPrompt.js +10 -25
  226. package/dist/audit/orchestrator/designReviewPrompt.js.map +1 -1
  227. package/dist/audit/orchestrator/designReviewSnapshot.d.ts.map +1 -1
  228. package/dist/audit/orchestrator/designReviewSnapshot.js +1 -2
  229. package/dist/audit/orchestrator/designReviewSnapshot.js.map +1 -1
  230. package/dist/audit/orchestrator/designReviewTask.d.ts.map +1 -1
  231. package/dist/audit/orchestrator/designReviewTask.js +2 -2
  232. package/dist/audit/orchestrator/designReviewTask.js.map +1 -1
  233. package/dist/audit/orchestrator/edgeReasoning.d.ts.map +1 -1
  234. package/dist/audit/orchestrator/edgeReasoning.js +1 -3
  235. package/dist/audit/orchestrator/edgeReasoning.js.map +1 -1
  236. package/dist/audit/orchestrator/executorResult.d.ts +3 -32
  237. package/dist/audit/orchestrator/executorResult.d.ts.map +1 -1
  238. package/dist/audit/orchestrator/executorRunners.d.ts.map +1 -1
  239. package/dist/audit/orchestrator/executorRunners.js +33 -43
  240. package/dist/audit/orchestrator/executorRunners.js.map +1 -1
  241. package/dist/audit/orchestrator/executors.d.ts +34 -0
  242. package/dist/audit/orchestrator/executors.d.ts.map +1 -1
  243. package/dist/audit/orchestrator/executors.js +19 -4
  244. package/dist/audit/orchestrator/executors.js.map +1 -1
  245. package/dist/audit/orchestrator/fileIntegrity.d.ts.map +1 -1
  246. package/dist/audit/orchestrator/fileIntegrity.js +4 -3
  247. package/dist/audit/orchestrator/fileIntegrity.js.map +1 -1
  248. package/dist/audit/orchestrator/flowPlanning.d.ts.map +1 -1
  249. package/dist/audit/orchestrator/flowPlanning.js +2 -2
  250. package/dist/audit/orchestrator/flowPlanning.js.map +1 -1
  251. package/dist/audit/orchestrator/flowRequeue.d.ts.map +1 -1
  252. package/dist/audit/orchestrator/flowRequeue.js +2 -3
  253. package/dist/audit/orchestrator/flowRequeue.js.map +1 -1
  254. package/dist/audit/orchestrator/graphEnrichmentExecutor.d.ts.map +1 -1
  255. package/dist/audit/orchestrator/graphEnrichmentExecutor.js +5 -18
  256. package/dist/audit/orchestrator/graphEnrichmentExecutor.js.map +1 -1
  257. package/dist/audit/orchestrator/hostInputPause.d.ts +4 -20
  258. package/dist/audit/orchestrator/hostInputPause.d.ts.map +1 -1
  259. package/dist/audit/orchestrator/hostInputPause.js +4 -3
  260. package/dist/audit/orchestrator/hostInputPause.js.map +1 -1
  261. package/dist/audit/orchestrator/ingestionExecutors.d.ts.map +1 -1
  262. package/dist/audit/orchestrator/ingestionExecutors.js +5 -17
  263. package/dist/audit/orchestrator/ingestionExecutors.js.map +1 -1
  264. package/dist/audit/orchestrator/intentCheckpointExecutor.d.ts +1 -2
  265. package/dist/audit/orchestrator/intentCheckpointExecutor.d.ts.map +1 -1
  266. package/dist/audit/orchestrator/intentCheckpointExecutor.js +42 -53
  267. package/dist/audit/orchestrator/intentCheckpointExecutor.js.map +1 -1
  268. package/dist/audit/orchestrator/intentCheckpointGate.d.ts +1 -1
  269. package/dist/audit/orchestrator/intentCheckpointGate.d.ts.map +1 -1
  270. package/dist/audit/orchestrator/intentCheckpointGate.js +12 -8
  271. package/dist/audit/orchestrator/intentCheckpointGate.js.map +1 -1
  272. package/dist/audit/orchestrator/intentEquivalenceExecutor.d.ts.map +1 -1
  273. package/dist/audit/orchestrator/intentEquivalenceExecutor.js +13 -22
  274. package/dist/audit/orchestrator/intentEquivalenceExecutor.js.map +1 -1
  275. package/dist/audit/orchestrator/lineCounts.d.ts +2 -0
  276. package/dist/audit/orchestrator/lineCounts.d.ts.map +1 -1
  277. package/dist/audit/orchestrator/lineCounts.js +4 -0
  278. package/dist/audit/orchestrator/lineCounts.js.map +1 -1
  279. package/dist/audit/orchestrator/obligationPolicy.d.ts.map +1 -1
  280. package/dist/audit/orchestrator/obligationPolicy.js +46 -48
  281. package/dist/audit/orchestrator/obligationPolicy.js.map +1 -1
  282. package/dist/audit/orchestrator/pendingTasks.d.ts.map +1 -1
  283. package/dist/audit/orchestrator/pendingTasks.js +4 -3
  284. package/dist/audit/orchestrator/pendingTasks.js.map +1 -1
  285. package/dist/audit/orchestrator/planningExecutors.d.ts.map +1 -1
  286. package/dist/audit/orchestrator/planningExecutors.js +5 -1
  287. package/dist/audit/orchestrator/planningExecutors.js.map +1 -1
  288. package/dist/audit/orchestrator/requeue.d.ts.map +1 -1
  289. package/dist/audit/orchestrator/requeue.js +2 -2
  290. package/dist/audit/orchestrator/requeue.js.map +1 -1
  291. package/dist/audit/orchestrator/requeueCommand.d.ts.map +1 -1
  292. package/dist/audit/orchestrator/requeueCommand.js +13 -21
  293. package/dist/audit/orchestrator/requeueCommand.js.map +1 -1
  294. package/dist/audit/orchestrator/resultIngestion.d.ts.map +1 -1
  295. package/dist/audit/orchestrator/resultIngestion.js +3 -4
  296. package/dist/audit/orchestrator/resultIngestion.js.map +1 -1
  297. package/dist/audit/orchestrator/reviewPacketGraphContext.js +1 -1
  298. package/dist/audit/orchestrator/reviewPacketGraphContext.js.map +1 -1
  299. package/dist/audit/orchestrator/reviewPacketGraphEdges.d.ts +2 -8
  300. package/dist/audit/orchestrator/reviewPacketGraphEdges.d.ts.map +1 -1
  301. package/dist/audit/orchestrator/reviewPacketGraphEdges.js +6 -38
  302. package/dist/audit/orchestrator/reviewPacketGraphEdges.js.map +1 -1
  303. package/dist/audit/orchestrator/reviewPacketMetrics.d.ts.map +1 -1
  304. package/dist/audit/orchestrator/reviewPacketMetrics.js +7 -68
  305. package/dist/audit/orchestrator/reviewPacketMetrics.js.map +1 -1
  306. package/dist/audit/orchestrator/reviewPacketShared.d.ts +0 -2
  307. package/dist/audit/orchestrator/reviewPacketShared.d.ts.map +1 -1
  308. package/dist/audit/orchestrator/reviewPacketShared.js.map +1 -1
  309. package/dist/audit/orchestrator/reviewPacketSizing.d.ts +1 -3
  310. package/dist/audit/orchestrator/reviewPacketSizing.d.ts.map +1 -1
  311. package/dist/audit/orchestrator/reviewPacketSizing.js +3 -13
  312. package/dist/audit/orchestrator/reviewPacketSizing.js.map +1 -1
  313. package/dist/audit/orchestrator/reviewPackets.d.ts +7 -8
  314. package/dist/audit/orchestrator/reviewPackets.d.ts.map +1 -1
  315. package/dist/audit/orchestrator/reviewPackets.js +17 -32
  316. package/dist/audit/orchestrator/reviewPackets.js.map +1 -1
  317. package/dist/audit/orchestrator/runtimeValidation.js +2 -2
  318. package/dist/audit/orchestrator/runtimeValidation.js.map +1 -1
  319. package/dist/audit/orchestrator/scope.d.ts.map +1 -1
  320. package/dist/audit/orchestrator/scope.js +3 -2
  321. package/dist/audit/orchestrator/scope.js.map +1 -1
  322. package/dist/audit/orchestrator/scopeIndexBaseline.d.ts.map +1 -1
  323. package/dist/audit/orchestrator/scopeIndexBaseline.js +1 -2
  324. package/dist/audit/orchestrator/scopeIndexBaseline.js.map +1 -1
  325. package/dist/audit/orchestrator/selectiveDeepening/conflict.d.ts.map +1 -1
  326. package/dist/audit/orchestrator/selectiveDeepening/conflict.js +2 -2
  327. package/dist/audit/orchestrator/selectiveDeepening/conflict.js.map +1 -1
  328. package/dist/audit/orchestrator/selectiveDeepening/findingFollowup.d.ts +3 -5
  329. package/dist/audit/orchestrator/selectiveDeepening/findingFollowup.d.ts.map +1 -1
  330. package/dist/audit/orchestrator/selectiveDeepening/findingFollowup.js +8 -6
  331. package/dist/audit/orchestrator/selectiveDeepening/findingFollowup.js.map +1 -1
  332. package/dist/audit/orchestrator/selectiveDeepening/highRiskClean.d.ts.map +1 -1
  333. package/dist/audit/orchestrator/selectiveDeepening/highRiskClean.js +15 -11
  334. package/dist/audit/orchestrator/selectiveDeepening/highRiskClean.js.map +1 -1
  335. package/dist/audit/orchestrator/selectiveDeepening/index.d.ts +3 -3
  336. package/dist/audit/orchestrator/selectiveDeepening/index.d.ts.map +1 -1
  337. package/dist/audit/orchestrator/selectiveDeepening/index.js +50 -77
  338. package/dist/audit/orchestrator/selectiveDeepening/index.js.map +1 -1
  339. package/dist/audit/orchestrator/selectiveDeepening/lensVerification.d.ts.map +1 -1
  340. package/dist/audit/orchestrator/selectiveDeepening/lensVerification.js +27 -18
  341. package/dist/audit/orchestrator/selectiveDeepening/lensVerification.js.map +1 -1
  342. package/dist/audit/orchestrator/selectiveDeepening/runtimeValidation.d.ts +1 -2
  343. package/dist/audit/orchestrator/selectiveDeepening/runtimeValidation.d.ts.map +1 -1
  344. package/dist/audit/orchestrator/selectiveDeepening/runtimeValidation.js +6 -3
  345. package/dist/audit/orchestrator/selectiveDeepening/runtimeValidation.js.map +1 -1
  346. package/dist/audit/orchestrator/selectiveDeepening/shared.d.ts +12 -9
  347. package/dist/audit/orchestrator/selectiveDeepening/shared.d.ts.map +1 -1
  348. package/dist/audit/orchestrator/selectiveDeepening/shared.js +15 -35
  349. package/dist/audit/orchestrator/selectiveDeepening/shared.js.map +1 -1
  350. package/dist/audit/orchestrator/selectiveDeepening/stewardFollowup.d.ts.map +1 -1
  351. package/dist/audit/orchestrator/selectiveDeepening/stewardFollowup.js +9 -16
  352. package/dist/audit/orchestrator/selectiveDeepening/stewardFollowup.js.map +1 -1
  353. package/dist/audit/orchestrator/staleness.d.ts.map +1 -1
  354. package/dist/audit/orchestrator/staleness.js +40 -36
  355. package/dist/audit/orchestrator/staleness.js.map +1 -1
  356. package/dist/audit/orchestrator/state.d.ts.map +1 -1
  357. package/dist/audit/orchestrator/state.js +16 -17
  358. package/dist/audit/orchestrator/state.js.map +1 -1
  359. package/dist/audit/orchestrator/structureExecutors.d.ts.map +1 -1
  360. package/dist/audit/orchestrator/structureExecutors.js +5 -4
  361. package/dist/audit/orchestrator/structureExecutors.js.map +1 -1
  362. package/dist/audit/orchestrator/taskAffinityGraph.d.ts.map +1 -1
  363. package/dist/audit/orchestrator/taskAffinityGraph.js +19 -15
  364. package/dist/audit/orchestrator/taskAffinityGraph.js.map +1 -1
  365. package/dist/audit/orchestrator/taskBuilder.d.ts.map +1 -1
  366. package/dist/audit/orchestrator/taskBuilder.js +2 -3
  367. package/dist/audit/orchestrator/taskBuilder.js.map +1 -1
  368. package/dist/audit/orchestrator/trivialAudit.d.ts.map +1 -1
  369. package/dist/audit/orchestrator/trivialAudit.js +2 -1
  370. package/dist/audit/orchestrator/trivialAudit.js.map +1 -1
  371. package/dist/audit/reporting/mergeFindings.d.ts.map +1 -1
  372. package/dist/audit/reporting/mergeFindings.js +6 -4
  373. package/dist/audit/reporting/mergeFindings.js.map +1 -1
  374. package/dist/audit/reporting/synthesis.d.ts.map +1 -1
  375. package/dist/audit/reporting/synthesis.js +5 -10
  376. package/dist/audit/reporting/synthesis.js.map +1 -1
  377. package/dist/audit/reporting/workBlocks.d.ts +0 -1
  378. package/dist/audit/reporting/workBlocks.d.ts.map +1 -1
  379. package/dist/audit/reporting/workBlocks.js +8 -15
  380. package/dist/audit/reporting/workBlocks.js.map +1 -1
  381. package/dist/audit/systemic/reviewFileMap.js +2 -2
  382. package/dist/audit/systemic/reviewFileMap.js.map +1 -1
  383. package/dist/audit/systemic/secondOrderAdversaryPrompt.d.ts.map +1 -1
  384. package/dist/audit/systemic/secondOrderAdversaryPrompt.js +2 -2
  385. package/dist/audit/systemic/secondOrderAdversaryPrompt.js.map +1 -1
  386. package/dist/audit/systemic/systemicChallengeLoop.js +3 -3
  387. package/dist/audit/systemic/systemicChallengeLoop.js.map +1 -1
  388. package/dist/audit/types/reviewPlanning.d.ts +10 -8
  389. package/dist/audit/types/reviewPlanning.d.ts.map +1 -1
  390. package/dist/audit/types/reviewPlanning.js +3 -1
  391. package/dist/audit/types/reviewPlanning.js.map +1 -1
  392. package/dist/remediate/contractPipeline/executionPlan.d.ts +3 -0
  393. package/dist/remediate/contractPipeline/executionPlan.d.ts.map +1 -1
  394. package/dist/remediate/contractPipeline/executionPlan.js +27 -22
  395. package/dist/remediate/contractPipeline/executionPlan.js.map +1 -1
  396. package/dist/remediate/contractPipeline/runtimePlanAuthority.d.ts +1 -0
  397. package/dist/remediate/contractPipeline/runtimePlanAuthority.d.ts.map +1 -1
  398. package/dist/remediate/contractPipeline/runtimePlanAuthority.js +4 -3
  399. package/dist/remediate/contractPipeline/runtimePlanAuthority.js.map +1 -1
  400. package/dist/remediate/dedup/crossLensDedup.d.ts +0 -2
  401. package/dist/remediate/dedup/crossLensDedup.d.ts.map +1 -1
  402. package/dist/remediate/dedup/crossLensDedup.js +1 -4
  403. package/dist/remediate/dedup/crossLensDedup.js.map +1 -1
  404. package/dist/remediate/droppedFindingsRecord.d.ts.map +1 -1
  405. package/dist/remediate/droppedFindingsRecord.js +3 -1
  406. package/dist/remediate/droppedFindingsRecord.js.map +1 -1
  407. package/dist/remediate/index.d.ts +2 -3
  408. package/dist/remediate/index.d.ts.map +1 -1
  409. package/dist/remediate/index.js +51 -27
  410. package/dist/remediate/index.js.map +1 -1
  411. package/dist/remediate/intake.d.ts +9 -8
  412. package/dist/remediate/intake.d.ts.map +1 -1
  413. package/dist/remediate/intake.js +9 -5
  414. package/dist/remediate/intake.js.map +1 -1
  415. package/dist/remediate/intakeSelection.js +3 -3
  416. package/dist/remediate/intakeSelection.js.map +1 -1
  417. package/dist/remediate/intent/intentOrdering.d.ts +10 -9
  418. package/dist/remediate/intent/intentOrdering.d.ts.map +1 -1
  419. package/dist/remediate/intent/intentOrdering.js +10 -9
  420. package/dist/remediate/intent/intentOrdering.js.map +1 -1
  421. package/dist/remediate/intent/intentPersistence.d.ts +1 -0
  422. package/dist/remediate/intent/intentPersistence.d.ts.map +1 -1
  423. package/dist/remediate/intent/intentPersistence.js +18 -10
  424. package/dist/remediate/intent/intentPersistence.js.map +1 -1
  425. package/dist/remediate/phases/close.d.ts +16 -15
  426. package/dist/remediate/phases/close.d.ts.map +1 -1
  427. package/dist/remediate/phases/close.js +172 -163
  428. package/dist/remediate/phases/close.js.map +1 -1
  429. package/dist/remediate/phases/closeVerifyAnalyzerLeads.js +1 -1
  430. package/dist/remediate/phases/closeVerifyAnalyzerLeads.js.map +1 -1
  431. package/dist/remediate/phases/closeVerifyHeadEvidence.d.ts.map +1 -1
  432. package/dist/remediate/phases/closeVerifyHeadEvidence.js +11 -11
  433. package/dist/remediate/phases/closeVerifyHeadEvidence.js.map +1 -1
  434. package/dist/remediate/phases/closeVerifyLandingGates.d.ts +6 -0
  435. package/dist/remediate/phases/closeVerifyLandingGates.d.ts.map +1 -1
  436. package/dist/remediate/phases/closeVerifyLandingGates.js +10 -6
  437. package/dist/remediate/phases/closeVerifyLandingGates.js.map +1 -1
  438. package/dist/remediate/phases/grounding.d.ts +1 -1
  439. package/dist/remediate/phases/grounding.d.ts.map +1 -1
  440. package/dist/remediate/phases/triage.d.ts.map +1 -1
  441. package/dist/remediate/phases/triage.js +19 -25
  442. package/dist/remediate/phases/triage.js.map +1 -1
  443. package/dist/remediate/phases/triageConformance.d.ts.map +1 -1
  444. package/dist/remediate/phases/triageConformance.js +11 -15
  445. package/dist/remediate/phases/triageConformance.js.map +1 -1
  446. package/dist/remediate/review/autonomousGate.d.ts +5 -5
  447. package/dist/remediate/review/autonomousGate.d.ts.map +1 -1
  448. package/dist/remediate/review/autonomousGate.js +5 -0
  449. package/dist/remediate/review/autonomousGate.js.map +1 -1
  450. package/dist/remediate/review/reviewGate.d.ts.map +1 -1
  451. package/dist/remediate/review/reviewGate.js +12 -11
  452. package/dist/remediate/review/reviewGate.js.map +1 -1
  453. package/dist/remediate/riskSignal.d.ts +0 -1
  454. package/dist/remediate/riskSignal.d.ts.map +1 -1
  455. package/dist/remediate/riskSignal.js.map +1 -1
  456. package/dist/remediate/state/decisionConsumption.d.ts +2 -0
  457. package/dist/remediate/state/decisionConsumption.d.ts.map +1 -1
  458. package/dist/remediate/state/decisionConsumption.js +12 -10
  459. package/dist/remediate/state/decisionConsumption.js.map +1 -1
  460. package/dist/remediate/state/itemStatus.d.ts +3 -3
  461. package/dist/remediate/state/itemStatus.js +5 -5
  462. package/dist/remediate/state/store.d.ts +4 -3
  463. package/dist/remediate/state/store.d.ts.map +1 -1
  464. package/dist/remediate/state/store.js +11 -24
  465. package/dist/remediate/state/store.js.map +1 -1
  466. package/dist/remediate/state/types.d.ts +2 -2
  467. package/dist/remediate/state/types.d.ts.map +1 -1
  468. package/dist/remediate/state/types.js +12 -14
  469. package/dist/remediate/state/types.js.map +1 -1
  470. package/dist/remediate/steps/clarificationResolution.d.ts.map +1 -1
  471. package/dist/remediate/steps/clarificationResolution.js +4 -2
  472. package/dist/remediate/steps/clarificationResolution.js.map +1 -1
  473. package/dist/remediate/steps/contractPipeline.d.ts.map +1 -1
  474. package/dist/remediate/steps/contractPipeline.js +26 -23
  475. package/dist/remediate/steps/contractPipeline.js.map +1 -1
  476. package/dist/remediate/steps/contractPipelinePrompts.d.ts +1 -1
  477. package/dist/remediate/steps/contractPipelinePrompts.d.ts.map +1 -1
  478. package/dist/remediate/steps/contractPipelinePrompts.js +3 -2
  479. package/dist/remediate/steps/contractPipelinePrompts.js.map +1 -1
  480. package/dist/remediate/steps/dispatch/contractConformanceReview.d.ts +8 -3
  481. package/dist/remediate/steps/dispatch/contractConformanceReview.d.ts.map +1 -1
  482. package/dist/remediate/steps/dispatch/contractConformanceReview.js +15 -12
  483. package/dist/remediate/steps/dispatch/contractConformanceReview.js.map +1 -1
  484. package/dist/remediate/steps/dispatch/hostContracts.d.ts +2 -0
  485. package/dist/remediate/steps/dispatch/hostContracts.d.ts.map +1 -1
  486. package/dist/remediate/steps/dispatch/hostContracts.js +6 -3
  487. package/dist/remediate/steps/dispatch/hostContracts.js.map +1 -1
  488. package/dist/remediate/steps/dispatch/hostCorroboration.d.ts +11 -12
  489. package/dist/remediate/steps/dispatch/hostCorroboration.d.ts.map +1 -1
  490. package/dist/remediate/steps/dispatch/hostCorroboration.js +13 -6
  491. package/dist/remediate/steps/dispatch/hostCorroboration.js.map +1 -1
  492. package/dist/remediate/steps/dispatch/hostHandoff.d.ts +5 -7
  493. package/dist/remediate/steps/dispatch/hostHandoff.d.ts.map +1 -1
  494. package/dist/remediate/steps/dispatch/hostHandoff.js +162 -265
  495. package/dist/remediate/steps/dispatch/hostHandoff.js.map +1 -1
  496. package/dist/remediate/steps/dispatch/requiredTests.d.ts +18 -0
  497. package/dist/remediate/steps/dispatch/requiredTests.d.ts.map +1 -1
  498. package/dist/remediate/steps/dispatch/requiredTests.js +9 -11
  499. package/dist/remediate/steps/dispatch/requiredTests.js.map +1 -1
  500. package/dist/remediate/steps/finalGate.d.ts +1 -1
  501. package/dist/remediate/steps/finalGate.d.ts.map +1 -1
  502. package/dist/remediate/steps/finalGate.js +12 -12
  503. package/dist/remediate/steps/finalGate.js.map +1 -1
  504. package/dist/remediate/steps/frictionCloseout.d.ts.map +1 -1
  505. package/dist/remediate/steps/frictionCloseout.js +0 -1
  506. package/dist/remediate/steps/frictionCloseout.js.map +1 -1
  507. package/dist/remediate/steps/gateCommands.d.ts +5 -10
  508. package/dist/remediate/steps/gateCommands.d.ts.map +1 -1
  509. package/dist/remediate/steps/gateCommands.js +8 -12
  510. package/dist/remediate/steps/gateCommands.js.map +1 -1
  511. package/dist/remediate/steps/intakeResolver.d.ts +5 -7
  512. package/dist/remediate/steps/intakeResolver.d.ts.map +1 -1
  513. package/dist/remediate/steps/intakeResolver.js +30 -33
  514. package/dist/remediate/steps/intakeResolver.js.map +1 -1
  515. package/dist/remediate/steps/nextStep.d.ts +1 -1
  516. package/dist/remediate/steps/nextStep.d.ts.map +1 -1
  517. package/dist/remediate/steps/nextStep.js +134 -158
  518. package/dist/remediate/steps/nextStep.js.map +1 -1
  519. package/dist/remediate/steps/prompts.d.ts +4 -30
  520. package/dist/remediate/steps/prompts.d.ts.map +1 -1
  521. package/dist/remediate/steps/prompts.js +5 -114
  522. package/dist/remediate/steps/prompts.js.map +1 -1
  523. package/dist/remediate/steps/recoverIngest.d.ts +5 -13
  524. package/dist/remediate/steps/recoverIngest.d.ts.map +1 -1
  525. package/dist/remediate/steps/recoverIngest.js +20 -26
  526. package/dist/remediate/steps/recoverIngest.js.map +1 -1
  527. package/dist/remediate/steps/stepWriter.d.ts +5 -4
  528. package/dist/remediate/steps/stepWriter.d.ts.map +1 -1
  529. package/dist/remediate/steps/stepWriter.js +8 -5
  530. package/dist/remediate/steps/stepWriter.js.map +1 -1
  531. package/dist/remediate/steps/submitGateResult.d.ts +0 -5
  532. package/dist/remediate/steps/submitGateResult.d.ts.map +1 -1
  533. package/dist/remediate/steps/submitGateResult.js +8 -8
  534. package/dist/remediate/steps/submitGateResult.js.map +1 -1
  535. package/dist/remediate/steps/types.d.ts +1 -1
  536. package/dist/remediate/steps/types.d.ts.map +1 -1
  537. package/dist/remediate/steps/types.js +0 -1
  538. package/dist/remediate/steps/types.js.map +1 -1
  539. package/dist/remediate/validation/artifacts.d.ts.map +1 -1
  540. package/dist/remediate/validation/artifacts.js +11 -9
  541. package/dist/remediate/validation/artifacts.js.map +1 -1
  542. package/dist/remediate/validation/remediationState.d.ts +0 -2
  543. package/dist/remediate/validation/remediationState.d.ts.map +1 -1
  544. package/dist/remediate/validation/remediationState.js +9 -46
  545. package/dist/remediate/validation/remediationState.js.map +1 -1
  546. package/dist/shared/accessMemory.d.ts +3 -9
  547. package/dist/shared/accessMemory.d.ts.map +1 -1
  548. package/dist/shared/accessMemory.js +2 -4
  549. package/dist/shared/accessMemory.js.map +1 -1
  550. package/dist/shared/affinityArtifacts.d.ts.map +1 -1
  551. package/dist/shared/affinityArtifacts.js +5 -7
  552. package/dist/shared/affinityArtifacts.js.map +1 -1
  553. package/dist/shared/agentReflections.d.ts.map +1 -1
  554. package/dist/shared/agentReflections.js +11 -14
  555. package/dist/shared/agentReflections.js.map +1 -1
  556. package/dist/shared/analyzers/binaryAcquisition.d.ts.map +1 -1
  557. package/dist/shared/analyzers/binaryAcquisition.js +2 -1
  558. package/dist/shared/analyzers/binaryAcquisition.js.map +1 -1
  559. package/dist/shared/analyzers/candidates.js +1 -1
  560. package/dist/shared/analyzers/candidates.js.map +1 -1
  561. package/dist/shared/analyzers/clippy.d.ts +2 -25
  562. package/dist/shared/analyzers/clippy.d.ts.map +1 -1
  563. package/dist/shared/analyzers/clippy.js +1 -17
  564. package/dist/shared/analyzers/clippy.js.map +1 -1
  565. package/dist/shared/analyzers/normalizeExternal.d.ts +0 -15
  566. package/dist/shared/analyzers/normalizeExternal.d.ts.map +1 -1
  567. package/dist/shared/analyzers/normalizeExternal.js +2 -1
  568. package/dist/shared/analyzers/normalizeExternal.js.map +1 -1
  569. package/dist/shared/analyzers/rubocop.d.ts +1 -19
  570. package/dist/shared/analyzers/rubocop.d.ts.map +1 -1
  571. package/dist/shared/analyzers/rubocop.js +0 -23
  572. package/dist/shared/analyzers/rubocop.js.map +1 -1
  573. package/dist/shared/artifactFreshness.d.ts.map +1 -1
  574. package/dist/shared/artifactFreshness.js +4 -6
  575. package/dist/shared/artifactFreshness.js.map +1 -1
  576. package/dist/shared/chunkByBudget.d.ts +1 -24
  577. package/dist/shared/chunkByBudget.d.ts.map +1 -1
  578. package/dist/shared/chunkByBudget.js +2 -13
  579. package/dist/shared/chunkByBudget.js.map +1 -1
  580. package/dist/shared/compareCodeUnits.d.ts +2 -0
  581. package/dist/shared/compareCodeUnits.d.ts.map +1 -1
  582. package/dist/shared/compareCodeUnits.js +5 -0
  583. package/dist/shared/compareCodeUnits.js.map +1 -1
  584. package/dist/shared/contentKey.d.ts.map +1 -1
  585. package/dist/shared/contentKey.js +3 -1
  586. package/dist/shared/contentKey.js.map +1 -1
  587. package/dist/shared/countBy.d.ts.map +1 -1
  588. package/dist/shared/countBy.js +4 -3
  589. package/dist/shared/countBy.js.map +1 -1
  590. package/dist/shared/decompose/charterExtraction.d.ts.map +1 -1
  591. package/dist/shared/decompose/charterExtraction.js +11 -20
  592. package/dist/shared/decompose/charterExtraction.js.map +1 -1
  593. package/dist/shared/decompose/consensus.d.ts.map +1 -1
  594. package/dist/shared/decompose/consensus.js +4 -12
  595. package/dist/shared/decompose/consensus.js.map +1 -1
  596. package/dist/shared/decompose/contentCoherence.d.ts.map +1 -1
  597. package/dist/shared/decompose/contentCoherence.js +12 -15
  598. package/dist/shared/decompose/contentCoherence.js.map +1 -1
  599. package/dist/shared/decompose/modularity.d.ts.map +1 -1
  600. package/dist/shared/decompose/modularity.js +7 -19
  601. package/dist/shared/decompose/modularity.js.map +1 -1
  602. package/dist/shared/decompose/systemicChallenge.d.ts +8 -0
  603. package/dist/shared/decompose/systemicChallenge.d.ts.map +1 -1
  604. package/dist/shared/decompose/systemicChallenge.js +8 -8
  605. package/dist/shared/decompose/systemicChallenge.js.map +1 -1
  606. package/dist/shared/findingIdentitySignature.d.ts +6 -1
  607. package/dist/shared/findingIdentitySignature.d.ts.map +1 -1
  608. package/dist/shared/findingIdentitySignature.js +8 -6
  609. package/dist/shared/findingIdentitySignature.js.map +1 -1
  610. package/dist/shared/findingSimilarity.d.ts.map +1 -1
  611. package/dist/shared/findingSimilarity.js +9 -14
  612. package/dist/shared/findingSimilarity.js.map +1 -1
  613. package/dist/shared/findings/dedupe.d.ts.map +1 -1
  614. package/dist/shared/findings/dedupe.js +1 -10
  615. package/dist/shared/findings/dedupe.js.map +1 -1
  616. package/dist/shared/friction/captureFrictionEvent.d.ts +1 -1
  617. package/dist/shared/friction/captureFrictionEvent.d.ts.map +1 -1
  618. package/dist/shared/friction/frictionRecord.d.ts.map +1 -1
  619. package/dist/shared/friction/frictionRecord.js +3 -2
  620. package/dist/shared/friction/frictionRecord.js.map +1 -1
  621. package/dist/shared/friction/stepBoundaryCapture.d.ts +1 -2
  622. package/dist/shared/friction/stepBoundaryCapture.d.ts.map +1 -1
  623. package/dist/shared/friction/stepBoundaryCapture.js.map +1 -1
  624. package/dist/shared/friction/triage.d.ts.map +1 -1
  625. package/dist/shared/friction/triage.js +4 -3
  626. package/dist/shared/friction/triage.js.map +1 -1
  627. package/dist/shared/git.d.ts +2 -10
  628. package/dist/shared/git.d.ts.map +1 -1
  629. package/dist/shared/git.js +6 -17
  630. package/dist/shared/git.js.map +1 -1
  631. package/dist/shared/graph/graphPaths.d.ts +2 -5
  632. package/dist/shared/graph/graphPaths.d.ts.map +1 -1
  633. package/dist/shared/graph/graphPaths.js +5 -6
  634. package/dist/shared/graph/graphPaths.js.map +1 -1
  635. package/dist/shared/index.d.ts +41 -61
  636. package/dist/shared/index.d.ts.map +1 -1
  637. package/dist/shared/index.js +25 -7
  638. package/dist/shared/index.js.map +1 -1
  639. package/dist/shared/intent/pathScope.d.ts +5 -0
  640. package/dist/shared/intent/pathScope.d.ts.map +1 -1
  641. package/dist/shared/intent/pathScope.js +17 -8
  642. package/dist/shared/intent/pathScope.js.map +1 -1
  643. package/dist/shared/io/auditToolsPaths.d.ts +9 -16
  644. package/dist/shared/io/auditToolsPaths.d.ts.map +1 -1
  645. package/dist/shared/io/auditToolsPaths.js +9 -18
  646. package/dist/shared/io/auditToolsPaths.js.map +1 -1
  647. package/dist/shared/io/frictionCapture.d.ts.map +1 -1
  648. package/dist/shared/io/frictionCapture.js +3 -2
  649. package/dist/shared/io/frictionCapture.js.map +1 -1
  650. package/dist/shared/io/stepContractWriter.d.ts.map +1 -1
  651. package/dist/shared/io/stepContractWriter.js +10 -8
  652. package/dist/shared/io/stepContractWriter.js.map +1 -1
  653. package/dist/shared/mcp/submitServer.d.ts.map +1 -1
  654. package/dist/shared/mcp/submitServer.js +21 -29
  655. package/dist/shared/mcp/submitServer.js.map +1 -1
  656. package/dist/shared/observability/rootLogObservations.d.ts.map +1 -1
  657. package/dist/shared/observability/rootLogObservations.js +3 -2
  658. package/dist/shared/observability/rootLogObservations.js.map +1 -1
  659. package/dist/shared/parsing/toml.d.ts.map +1 -1
  660. package/dist/shared/parsing/toml.js +3 -4
  661. package/dist/shared/parsing/toml.js.map +1 -1
  662. package/dist/shared/reporting/auditDeliverable.d.ts.map +1 -1
  663. package/dist/shared/reporting/auditDeliverable.js +6 -15
  664. package/dist/shared/reporting/auditDeliverable.js.map +1 -1
  665. package/dist/shared/reporting/lensCoverage.d.ts.map +1 -1
  666. package/dist/shared/reporting/lensCoverage.js +4 -5
  667. package/dist/shared/reporting/lensCoverage.js.map +1 -1
  668. package/dist/shared/reporting/markdown.d.ts +3 -0
  669. package/dist/shared/reporting/markdown.d.ts.map +1 -0
  670. package/dist/shared/reporting/markdown.js +6 -0
  671. package/dist/shared/reporting/markdown.js.map +1 -0
  672. package/dist/shared/sessionConfig.d.ts.map +1 -1
  673. package/dist/shared/sessionConfig.js +3 -7
  674. package/dist/shared/sessionConfig.js.map +1 -1
  675. package/dist/shared/submission/handRecovery.d.ts.map +1 -1
  676. package/dist/shared/submission/handRecovery.js +3 -2
  677. package/dist/shared/submission/handRecovery.js.map +1 -1
  678. package/dist/shared/submission/hostResultOutcomes.d.ts +1 -1
  679. package/dist/shared/submission/hostResultOutcomes.js +2 -2
  680. package/dist/shared/submission/hostResultOutcomes.js.map +1 -1
  681. package/dist/shared/submission/submissionClassifier.d.ts.map +1 -1
  682. package/dist/shared/submission/submissionClassifier.js +4 -3
  683. package/dist/shared/submission/submissionClassifier.js.map +1 -1
  684. package/dist/shared/submission/submissionIdentity.d.ts.map +1 -1
  685. package/dist/shared/submission/submissionIdentity.js +3 -1
  686. package/dist/shared/submission/submissionIdentity.js.map +1 -1
  687. package/dist/shared/submission/submissionLedger.d.ts +1 -0
  688. package/dist/shared/submission/submissionLedger.d.ts.map +1 -1
  689. package/dist/shared/submission/submissionLedger.js +9 -5
  690. package/dist/shared/submission/submissionLedger.js.map +1 -1
  691. package/dist/shared/tooling/allowlistedExec.d.ts.map +1 -1
  692. package/dist/shared/tooling/allowlistedExec.js +35 -67
  693. package/dist/shared/tooling/allowlistedExec.js.map +1 -1
  694. package/dist/shared/tooling/analyzerDeps.d.ts.map +1 -1
  695. package/dist/shared/tooling/analyzerDeps.js +2 -1
  696. package/dist/shared/tooling/analyzerDeps.js.map +1 -1
  697. package/dist/shared/tooling/exec.d.ts +1 -1
  698. package/dist/shared/tooling/exec.d.ts.map +1 -1
  699. package/dist/shared/tooling/exec.js +3 -2
  700. package/dist/shared/tooling/exec.js.map +1 -1
  701. package/dist/shared/tooling/landingGates.d.ts +3 -3
  702. package/dist/shared/tooling/landingGates.js +3 -3
  703. package/dist/shared/tooling/ownedProcessLifecycle.d.ts +0 -1
  704. package/dist/shared/tooling/ownedProcessLifecycle.d.ts.map +1 -1
  705. package/dist/shared/tooling/ownedProcessLifecycle.js +1 -1
  706. package/dist/shared/tooling/ownedProcessLifecycle.js.map +1 -1
  707. package/dist/shared/tooling/projectTestAdmission.d.ts +7 -12
  708. package/dist/shared/tooling/projectTestAdmission.d.ts.map +1 -1
  709. package/dist/shared/tooling/projectTestAdmission.js.map +1 -1
  710. package/dist/shared/tooling/testCommand.d.ts +0 -14
  711. package/dist/shared/tooling/testCommand.d.ts.map +1 -1
  712. package/dist/shared/tooling/testCommand.js +2 -3
  713. package/dist/shared/tooling/testCommand.js.map +1 -1
  714. package/dist/shared/tooling/windowsOwnedJob.d.ts +2 -1
  715. package/dist/shared/tooling/windowsOwnedJob.d.ts.map +1 -1
  716. package/dist/shared/types/accessMemory.d.ts +3 -19
  717. package/dist/shared/types/accessMemory.d.ts.map +1 -1
  718. package/dist/shared/types/accessMemory.js +3 -19
  719. package/dist/shared/types/accessMemory.js.map +1 -1
  720. package/dist/shared/types/intentCheckpoint.d.ts.map +1 -1
  721. package/dist/shared/types/intentCheckpoint.js +2 -1
  722. package/dist/shared/types/intentCheckpoint.js.map +1 -1
  723. package/dist/shared/types/lens.d.ts +5 -0
  724. package/dist/shared/types/lens.d.ts.map +1 -1
  725. package/dist/shared/types/lens.js +13 -0
  726. package/dist/shared/types/lens.js.map +1 -1
  727. package/dist/shared/types/remediationOutcome.d.ts +10 -0
  728. package/dist/shared/types/remediationOutcome.d.ts.map +1 -1
  729. package/dist/shared/types/remediationOutcome.js +3 -0
  730. package/dist/shared/types/remediationOutcome.js.map +1 -1
  731. package/dist/shared/validation/contractConstructionSites.d.ts.map +1 -1
  732. package/dist/shared/validation/contractConstructionSites.js +2 -1
  733. package/dist/shared/validation/contractConstructionSites.js.map +1 -1
  734. package/dist/shared/validation/findingGrounding.d.ts +2 -1
  735. package/dist/shared/validation/findingGrounding.d.ts.map +1 -1
  736. package/dist/shared/validation/findingGrounding.js +9 -5
  737. package/dist/shared/validation/findingGrounding.js.map +1 -1
  738. package/dist/shared/validation/findingsReport.d.ts +6 -0
  739. package/dist/shared/validation/findingsReport.d.ts.map +1 -1
  740. package/dist/shared/validation/findingsReport.js +29 -19
  741. package/dist/shared/validation/findingsReport.js.map +1 -1
  742. package/docs/audit-pkg/contracts.md +73 -6
  743. package/docs/audit-pkg/operator-guide.md +10 -2
  744. package/docs/audit-pkg/product.md +1 -1
  745. package/package.json +1 -3
  746. package/remediate-code.mjs +13 -5
  747. package/scripts/audit/postinstall.mjs +6 -21
  748. package/scripts/remediate/postinstall.mjs +2 -17
  749. package/scripts/shared/install-host-assets.mjs +11 -3
  750. package/scripts/shared/primitives.mjs +14 -3
  751. package/wrapper/audit-code-wrapper-build.mjs +21 -18
  752. package/wrapper/audit-code-wrapper-install-hosts.mjs +6 -120
  753. package/wrapper/audit-code-wrapper-lib.mjs +28 -42
  754. package/wrapper/audit-code-wrapper-opencode.mjs +11 -24
  755. package/wrapper/installer-verb-help.mjs +21 -8
  756. package/wrapper/remediate-code-wrapper-install-hosts.mjs +15 -130
  757. package/wrapper/remediate-code-wrapper-opencode.mjs +11 -24
  758. package/wrapper/repo-root.mjs +2 -2
  759. package/wrapper/shared-install-hosts.mjs +119 -0
  760. package/wrapper/shared-project-opencode.mjs +22 -0
  761. package/dist/audit/io/runArtifactTypes.d.ts +0 -8
  762. package/dist/audit/io/runArtifactTypes.d.ts.map +0 -1
  763. package/dist/audit/io/runArtifactTypes.js +0 -2
  764. package/dist/audit/io/runArtifactTypes.js.map +0 -1
  765. package/dist/audit/orchestrator/accessMemory.d.ts +0 -35
  766. package/dist/audit/orchestrator/accessMemory.d.ts.map +0 -1
  767. package/dist/audit/orchestrator/accessMemory.js +0 -54
  768. package/dist/audit/orchestrator/accessMemory.js.map +0 -1
  769. package/dist/audit/orchestrator/reviewPacketGraph.d.ts +0 -4
  770. package/dist/audit/orchestrator/reviewPacketGraph.d.ts.map +0 -1
  771. package/dist/audit/orchestrator/reviewPacketGraph.js +0 -7
  772. package/dist/audit/orchestrator/reviewPacketGraph.js.map +0 -1
  773. package/dist/shared/continuityScore.d.ts +0 -13
  774. package/dist/shared/continuityScore.d.ts.map +0 -1
  775. package/dist/shared/continuityScore.js +0 -164
  776. package/dist/shared/continuityScore.js.map +0 -1
  777. package/dist/shared/graph/directedCycles.d.ts +0 -61
  778. package/dist/shared/graph/directedCycles.d.ts.map +0 -1
  779. package/dist/shared/graph/directedCycles.js +0 -190
  780. package/dist/shared/graph/directedCycles.js.map +0 -1
  781. package/dist/shared/io/pathIdentity.d.ts +0 -26
  782. package/dist/shared/io/pathIdentity.d.ts.map +0 -1
  783. package/dist/shared/io/pathIdentity.js +0 -50
  784. package/dist/shared/io/pathIdentity.js.map +0 -1
@@ -1,3 +1,4 @@
1
+ import { intakePaths } from "../../intake.js";
1
2
  import { admitRemediationDirtyBaseline } from "../../state/dirtyBaseline.js";
2
3
  import { DecisionApplicationReceiptSchema } from "../../state/decisionConsumption.js";
3
4
  import { recordHostRootLogBoundary } from "../../../shared/observability/rootLogObservations.js";
@@ -5,7 +6,7 @@ import { AcceptedConformanceReviewSchema } from "../../../shared/types/reviewInd
5
6
  import { corroborateHostResult, corroborateNoChangeClaim } from "./hostCorroboration.js";
6
7
  import { runRequiredTest, rerunRequiredTests, requiredTestIssue, requiredTestVerdictKey } from "./requiredTests.js";
7
8
  import { readIntentCheckpoint } from "../../../shared/types/intentCheckpoint.js";
8
- import { checkContractConformance, conformanceReviewPaths } from "./contractConformanceReview.js";
9
+ import { checkContractConformance, conformanceIssue, conformanceReviewPaths } from "./contractConformanceReview.js";
9
10
  import { executionPlanReferenceIssues } from "../../../shared/types/executionPlan.js";
10
11
  import { executionPlanContextIssues } from "../../contractPipeline/executionPlan.js";
11
12
  import { assertApprovedRuntimePlan as assertCurrentPlanAuthority, RemediationPlanAuthorityError } from "../../contractPipeline/runtimePlanAuthority.js";
@@ -14,17 +15,13 @@ import { assertApprovedRuntimePlan as assertCurrentPlanAuthority, RemediationPla
14
15
  // host-handoff: the "landing gates" block fails when the close-owns-the-gates prompt line
15
16
  // or the id-glossary write scope is reverted.
16
17
  import { mkdir } from "node:fs/promises";
17
- import { isAbsolute, join } from "node:path";
18
+ import { isAbsolute } from "node:path";
18
19
  import { headCommit, commandLeavesDeclaredShape, SUBMISSION_ISSUE_REMEDY, WORKLOAD_ISSUE_REMEDY, bindWorkerPrompt, deriveResultId, SUBMISSION_LEDGER_EVENT_CONTRACT_VERSION, appendSubmissionEvent, enrichMissingSubmissionIssues, isMissingObservation, compareCodeUnits, contentSha256, deriveLaneDemand, estimateTokensFromBytes, discoverLandingGates, hasExactKeys, identityFailureDiagnostic, hostHandoffResultPath, workerPromptPath, idsAreStrictlyAscending, isCommit, isGitRepo, isRecord, isSha256, LaneDemandSchema, normalizeRepoPath, parseAllWorkloadItems, parseWorkloadEnvelope, readSubmissionDocument, readJsonFile, readSubmissionLedger, readTrailingSubmissionRefusals, recoveryMarkMatches, recordHostResultOutcomes, repoRelativePath, resolveContainedPath, resolveHostHandoffPaths, sameStrings, scanBoundSubmission, SEVERITIES, severityRank, stringArray, stableStringify, writeJsonFile, writeTextFile, } from "audit-tools/shared";
20
+ import { errorMessage } from "../../../shared/io/json.js";
19
21
  import { REMEDIATION_STATE_CONTRACT_VERSION, } from "../../state/store.js";
20
22
  import { REMEDIATION_HOST_HANDOFF_RECORD_V1ALPHA2, REMEDIATION_HOST_SCOPE_SEMANTICS, RemediationHostHandoffRecordSchema, ConformanceReviewBindingSchema, RemediationPlanSchema, isClarificationCategory, } from "../../state/types.js";
21
23
  import { ITEM_STATUSES, isTerminalStatus, isVerifiedCompleteStatus, } from "../../state/itemStatus.js";
22
24
  import { REMEDIATION_HOST_DECISION_CONTRACT_VERSION as DECISION_CONTRACT_VERSION, REMEDIATION_HOST_RESULT_CONTRACT_VERSION as RESULT_CONTRACT_VERSION, REMEDIATION_HOST_WORKLOAD_CONTRACT_VERSION as WORKLOAD_CONTRACT_VERSION, } from "../types.js";
23
- // The state contract version is the STORE's declaration, not a second literal
24
- // here. It used to be private to this module — and the module then supplied it
25
- // to its own parser at the call site below, so the check it performed was
26
- // "does the constant equal itself".
27
- const STATE_CONTRACT_VERSION = REMEDIATION_STATE_CONTRACT_VERSION;
28
25
  /** A recognized preparation defect, emitted as a bounded repair step by next-step. */
29
26
  export class RemediationHostPreparationError extends Error {
30
27
  code;
@@ -127,7 +124,7 @@ function hasOnlyKnownKeys(value, known) {
127
124
  function parseCurrentState(value) {
128
125
  if (!isRecord(value) ||
129
126
  !hasOnlyKnownKeys(value, CURRENT_STATE_KEYS) ||
130
- value.contract_version !== STATE_CONTRACT_VERSION ||
127
+ value.contract_version !== REMEDIATION_STATE_CONTRACT_VERSION ||
131
128
  value.status !== "implementing") {
132
129
  return null;
133
130
  }
@@ -146,11 +143,8 @@ function parseCurrentState(value) {
146
143
  if (parsedHandoff.data.conformance_policy_sha256 !== undefined &&
147
144
  (value.conformance_review === undefined || contentSha256(value.conformance_review) !== parsedHandoff.data.conformance_policy_sha256))
148
145
  return null;
149
- const ids = parsedHandoff.data.work_item_ids;
150
- if (new Set(ids).size !== ids.length ||
151
- ids.some((id, index) => index > 0 && compareCodeUnits(ids[index - 1], id) >= 0)) {
146
+ if (!idsAreStrictlyAscending(parsedHandoff.data.work_item_ids))
152
147
  return null;
153
- }
154
148
  }
155
149
  const unitIds = new Set(parsedPlan.data.units.map(unit => unit.id));
156
150
  if (unitIds.size !== parsedPlan.data.units.length)
@@ -178,13 +172,6 @@ async function assertApprovedRuntimePlan(artifactsDir, state) {
178
172
  throw new RemediationHostPreparationError(error.code, error.message);
179
173
  }
180
174
  }
181
- function normalizeDeclaredPath(root, candidate, label) {
182
- if (candidate.length === 0 || isAbsolute(candidate)) {
183
- throw new Error(`${label} must be a non-empty repository-relative path`);
184
- }
185
- const normalized = repoRelativePath(root, candidate, label);
186
- return candidate.endsWith("/") ? `${normalized}/` : normalized;
187
- }
188
175
  /**
189
176
  * A block that arrived outside the shape this boundary CONSUMES.
190
177
  *
@@ -223,34 +210,35 @@ class BlockContractError extends Error {
223
210
  function assertBlockContract(root, block) {
224
211
  for (const raw of block.allowed_files) {
225
212
  if (typeof raw !== "string" || raw.trim().length === 0) {
226
- throw new BlockContractError(block.id, "touched_files carries an empty entry");
213
+ throw new BlockContractError(block.id, "allowed_files carries an empty entry");
227
214
  }
228
215
  if (isAbsolute(raw)) {
229
- throw new BlockContractError(block.id, `touched_files entry ${JSON.stringify(raw)} is absolute, not repository-relative`);
216
+ throw new BlockContractError(block.id, `allowed_files entry ${JSON.stringify(raw)} is absolute, not repository-relative`);
230
217
  }
231
218
  let normalized;
232
219
  try {
233
- normalized = normalizeDeclaredPath(root, raw, `${block.id}.touched_files[]`);
220
+ const relative = repoRelativePath(root, raw, `${block.id}.allowed_files[]`);
221
+ normalized = raw.endsWith("/") ? `${relative}/` : relative;
234
222
  }
235
223
  catch {
236
- throw new BlockContractError(block.id, `touched_files entry ${JSON.stringify(raw)} does not resolve beneath the repository root`);
224
+ throw new BlockContractError(block.id, `allowed_files entry ${JSON.stringify(raw)} does not resolve beneath the repository root`);
237
225
  }
238
226
  if (normalized !== raw) {
239
- throw new BlockContractError(block.id, `touched_files entry ${JSON.stringify(raw)} is not in normalized repo-relative form ` +
227
+ throw new BlockContractError(block.id, `allowed_files entry ${JSON.stringify(raw)} is not in normalized repo-relative form ` +
240
228
  `(${JSON.stringify(normalized)})`);
241
229
  }
242
230
  }
243
231
  for (const command of block.required_tests ?? []) {
244
232
  if (typeof command !== "string" || command.trim().length === 0) {
245
- throw new BlockContractError(block.id, "targeted_commands carries an empty command");
233
+ throw new BlockContractError(block.id, "required_tests carries an empty command");
246
234
  }
247
235
  // THE declared-command-shape rule (`audit-tools/shared`), not a local copy:
248
236
  // the producer that promotes these commands and the triage path that also
249
237
  // spawns them ask the same predicate, so a command cannot clear one boundary
250
238
  // and dead-end at another.
251
239
  if (commandLeavesDeclaredShape(command)) {
252
- throw new BlockContractError(block.id, `targeted_command ${JSON.stringify(command)} leaves the declared shape — it chains, ` +
253
- "redirects or substitutes, and this boundary executes commands verbatim through a shell");
240
+ throw new BlockContractError(block.id, `required_tests entry ${JSON.stringify(command)} leaves the declared shape — it chains, ` +
241
+ "redirects or substitutes, and required tests must be executable as a single argv without a shell");
254
242
  }
255
243
  }
256
244
  }
@@ -313,25 +301,6 @@ function planBlockIssues(root, state) {
313
301
  }
314
302
  return issues;
315
303
  }
316
- /**
317
- * The classified "cannot prepare" message for a producer defect that reached the
318
- * build path as a throw. Aggregates the whole plan scan so an operator sees
319
- * EVERY malformed block, not just the first one the builder tripped on.
320
- *
321
- * The THROWER is attributed by name, not by whether the scan happened to find
322
- * anything. Falling back only on an EMPTY scan silently dropped the raised error
323
- * whenever the scan named some OTHER block — a plan with one ghost dependency
324
- * elsewhere was enough to make the message describe a block that did not throw
325
- * and omit the one that did.
326
- */
327
- function cannotPrepareMessage(root, state, raised) {
328
- const scanned = planBlockIssues(root, state);
329
- const messages = scanned.map((issue) => issue.message);
330
- if (!scanned.some((issue) => issue.work_item_id === raised.blockId)) {
331
- messages.push(raised.message);
332
- }
333
- return `Cannot prepare a remediation host workload: ${messages.join("; ")}`;
334
- }
335
304
  function resolveBoundaryPaths(params) {
336
305
  // The remediate draw's run dir carries the `implement` lane segment — its
337
306
  // runs directory also holds triage/closing lanes — which the core takes as a
@@ -527,9 +496,8 @@ function renderResultTemplate(item) {
527
496
  * The score is the WORST severity in the block, with the count of same-or-worse
528
497
  * findings nudging it up — a block of many high-severity findings is above a
529
498
  * block with one. Deterministic (no clock, no sampling) and bounded by
530
- * construction. A block whose findings are all absent from the plan contributes
531
- * nothing, so an unresolvable block honestly ranks `low` rather than being
532
- * guessed at.
499
+ * construction. A block with no source findings contributes nothing, so it
500
+ * ranks `low` rather than being guessed at.
533
501
  */
534
502
  export function severityRiskWeight(severity) {
535
503
  // DERIVED from the shared tuple, never a second copy of it. This used to be a
@@ -560,10 +528,8 @@ export function severityRiskWeight(severity) {
560
528
  ? 1
561
529
  : (severityRank(severity) - 1) / ladder;
562
530
  }
563
- function blockRiskScore(state, block) {
564
- const scores = block.source_finding_ids
565
- .map((findingId) => state.plan.findings.find((entry) => entry.id === findingId)?.severity)
566
- .flatMap((severity) => severity === undefined ? [] : [severityRiskWeight(severity)]);
531
+ function blockRiskScore(findings) {
532
+ const scores = findings.flatMap(({ severity }) => severity === undefined ? [] : [severityRiskWeight(severity)]);
567
533
  if (scores.length === 0)
568
534
  return 0;
569
535
  const worst = Math.max(...scores);
@@ -606,7 +572,7 @@ function buildWorkItem(paths, runId, unit, baselineCommit, state) {
606
572
  allowed_files: [...unit.allowed_files], baseline_commit: baselineCommit,
607
573
  obligation_ids: obligationIds, prompt: { text: prompt.text, sha256: prompt.sha256 },
608
574
  required_tests: [...unit.required_tests], result_path: resultPath,
609
- demand: deriveLaneDemand({ tokenEstimate, fileCount: unit.allowed_files.length, riskScore: blockRiskScore(state, unit) }),
575
+ demand: deriveLaneDemand({ tokenEstimate, fileCount: unit.allowed_files.length, riskScore: blockRiskScore(sourceFindings) }),
610
576
  token_estimate: tokenEstimate,
611
577
  };
612
578
  }
@@ -646,14 +612,10 @@ function parseWorkItem(value, paths, runId, state, expectedBaselineCommit) {
646
612
  typeof value.id !== "string" ||
647
613
  !LaneDemandSchema.safeParse(value.demand).success ||
648
614
  !isCommit(value.baseline_commit) ||
649
- !Array.isArray(value.source_finding_ids) ||
650
- !value.source_finding_ids.every((entry) => typeof entry === "string") ||
651
- !Array.isArray(value.obligation_ids) ||
652
- !value.obligation_ids.every((entry) => typeof entry === "string") ||
653
- !Array.isArray(value.allowed_files) ||
654
- !value.allowed_files.every((entry) => typeof entry === "string") ||
655
- !Array.isArray(value.required_tests) ||
656
- !value.required_tests.every((entry) => typeof entry === "string") ||
615
+ stringArray(value.source_finding_ids) === null ||
616
+ stringArray(value.obligation_ids) === null ||
617
+ stringArray(value.allowed_files) === null ||
618
+ stringArray(value.required_tests) === null ||
657
619
  typeof value.result_path !== "string" ||
658
620
  !Number.isInteger(value.token_estimate) ||
659
621
  Number(value.token_estimate) < 0 ||
@@ -769,10 +731,7 @@ export async function submitRemediationHostResult(params) {
769
731
  workItemId: workItem.id,
770
732
  resultPath: workItem.result_path,
771
733
  source: params.source,
772
- parse: (value) => {
773
- const result = parseResult(value, params.runId, workItem);
774
- return result.ok ? { ok: true, parsed: result } : { ok: false, check: result.check, detail: result.reason };
775
- },
734
+ parse: scanParser(params.runId, workItem),
776
735
  resultId: (result) => result.result.result_id,
777
736
  seen: () => false,
778
737
  messages: remediationScanMessages,
@@ -800,6 +759,13 @@ const remediationScanMessages = {
800
759
  contractInvalid: (detail) => detail,
801
760
  duplicate: (resultId) => `result_id ${resultId} is duplicated in this workload`,
802
761
  };
762
+ /** {@link parseResult} in the shape {@link scanBoundSubmission} takes. */
763
+ function scanParser(runId, workItem) {
764
+ return (value) => {
765
+ const result = parseResult(value, runId, workItem);
766
+ return result.ok ? { ok: true, parsed: result } : { ok: false, check: result.check, detail: result.reason };
767
+ };
768
+ }
803
769
  function parseResult(value, runId, workItem) {
804
770
  if (isRecord(value) && value.contract_version === DECISION_CONTRACT_VERSION) {
805
771
  // Envelope first, identity second: one message (the host repairs the same
@@ -940,27 +906,6 @@ function parseResult(value, runId, workItem) {
940
906
  result: value,
941
907
  };
942
908
  }
943
- /**
944
- * Pre-computed required-test verdicts, keyed by `root` + command: `null` =
945
- * green, a string = the failure detail.
946
- *
947
- * This is the recovery path's ANSWER TABLE, not a lazy cache. A required-test
948
- * rerun is a `spawnSync`, which blocks the event loop for its whole duration —
949
- * so running one inside the state lock would starve the lock's own heartbeat
950
- * timer and let a second acquirer reclaim the lock as stale mid-hold. The
951
- * recovery verb therefore runs every distinct command ONCE, up front and
952
- * unlocked ({@link precomputeRecoveryTestVerdicts}), and hands the finished
953
- * table to the locked phase, which only ever READS it.
954
- *
955
- * Two consequences are deliberate. A command absent from the table is treated
956
- * as FAILED, never spawned — fail-closed is the only answer that keeps the
957
- * no-spawn-under-the-lock property mechanical rather than remembered. And the
958
- * table is recovery-only: a `targeted_command` is host-authored and need not be
959
- * idempotent (one that appends to a log, bumps a counter, or is flaky produces
960
- * a genuinely different second run), so collapsing spawns is a behavior change.
961
- * The normal lane passes `null` and stays byte-identical to the pre-recovery
962
- * behavior — every command spawns once per work item, exactly as before.
963
- */
964
909
  /**
965
910
  * The MINTED verdict table: a Map subclass that exists only inside this module.
966
911
  *
@@ -988,7 +933,7 @@ function isMintedVerdictTable(value) {
988
933
  * by HEAD alone. HEAD says the TREE has not moved; it says nothing about whether
989
934
  * the RUN's own state changed underneath those unlocked spawns — and a
990
935
  * concurrent state writer can settle items without touching a single commit.
991
- * The verdict table phase 1 computed is keyed on which findings were PENDING
936
+ * The verdict table phase 1 computed is keyed on which work items were PENDING
992
937
  * (`precomputeRecoveryTestVerdicts` filters on exactly that), so once the
993
938
  * frontier moves, a command the table no longer covers reads as
994
939
  * `required_test_failed` — a bookkeeping race reported as the host's work being
@@ -1000,7 +945,7 @@ function isMintedVerdictTable(value) {
1000
945
  * - the binding record's own parts (run, baseline, workload digest, item ids),
1001
946
  * which the ordinary workload-integrity check would also catch — kept here so
1002
947
  * this guard is the one place that says "the frontier moved";
1003
- * - the sorted set of work items with at least one still-PENDING finding, which
948
+ * - the sorted set of work items still PENDING, which
1004
949
  * is what the verdict table is actually keyed on. This is the residual's real
1005
950
  * shape, and no digest in the state tracks it.
1006
951
  *
@@ -1022,11 +967,11 @@ export function workloadBindingIdentity(state) {
1022
967
  ]);
1023
968
  }
1024
969
  /**
1025
- * The bound work item ids with at least one finding still `pending`, sorted.
970
+ * The bound work item ids whose item is still `pending`, sorted.
1026
971
  *
1027
972
  * Derived from the STATE alone — the workload document is not read, because the
1028
973
  * caller may be comparing a snapshot whose workload file is no longer on disk
1029
- * (which is one of the situations this guard exists to refuse). A finding with
974
+ * (which is one of the situations this guard exists to refuse). A work item with
1030
975
  * no item record is NOT counted: the state is corrupt in that case, and the
1031
976
  * ingest's own parse refuses it with a better message than this guard could.
1032
977
  */
@@ -1044,8 +989,7 @@ function unresolvedFrontierWorkItemIds(state, record) {
1044
989
  * return the finished verdict table. Call this OUTSIDE the state lock — that is
1045
990
  * the entire point (see {@link RemediationRequiredTestVerdicts}).
1046
991
  *
1047
- * Candidates are the work items with at least one still-pending finding whose
1048
- * result file is present and parses as JSON; an item with no result file is
992
+ * Candidates are the still-pending work items whose result file is present and parses as JSON; an item with no result file is
1049
993
  * refused before its tests would ever run, so spawning for it is pure cost. The
1050
994
  * filter is deliberately generous otherwise — over-inclusion costs one spawn,
1051
995
  * while under-inclusion becomes a fail-closed refusal of a good result.
@@ -1143,39 +1087,21 @@ export async function prepareRemediationHostHandoff(params) {
1143
1087
  const planIssues = planBlockIssues(paths.root, state);
1144
1088
  if (planIssues.length)
1145
1089
  throw new RemediationHostPreparationError("plan_repair_required", planIssues.map(issue => issue.message).join("; "));
1146
- let workload;
1147
- try {
1148
- workload = buildCanonicalWorkload({
1149
- paths,
1150
- state,
1151
- runId: params.runId,
1152
- baselineCommit,
1153
- ...(existingRecord
1154
- ? { workItemIds: existingRecord.work_item_ids }
1155
- : {}),
1156
- });
1157
- }
1158
- catch (error) {
1159
- // A malformed block ON the frontier reaches this as a raw BlockContractError
1160
- // — an uncaught throw whose stack says nothing about which producer wrote the
1161
- // bad block, and which every retry reproduces. Re-raised in the SAME
1162
- // classified aggregate form the empty-workload branch below uses, so both
1163
- // producer-defect exits read alike.
1164
- if (!(error instanceof BlockContractError))
1165
- throw error;
1166
- throw new RemediationHostPreparationError("plan_repair_required", cannotPrepareMessage(paths.root, state, error));
1167
- }
1090
+ // The scan above covers every block the build below can reach (the bound ids,
1091
+ // or the pending level-0 frontier), so a malformed block or a missing
1092
+ // prerequisite has already been refused by name: the build cannot raise a
1093
+ // BlockContractError, and an empty workload is genuinely empty.
1094
+ const workload = buildCanonicalWorkload({
1095
+ paths,
1096
+ state,
1097
+ runId: params.runId,
1098
+ baselineCommit,
1099
+ ...(existingRecord
1100
+ ? { workItemIds: existingRecord.work_item_ids }
1101
+ : {}),
1102
+ });
1168
1103
  if (workload.work_items.length === 0) {
1169
- // Name the producer defect when it is the cause. An empty level 0 that is
1170
- // really "every candidate block declares a prerequisite that does not
1171
- // exist" used to surface as a bare "empty workload", sending the operator
1172
- // to look at scheduling rather than at the plan.
1173
- const blocked = planBlockIssues(paths.root, state);
1174
- throw new RemediationHostPreparationError("plan_repair_required", blocked.length === 0
1175
- ? "Cannot prepare an empty remediation host workload"
1176
- : `Cannot prepare a remediation host workload: ${blocked
1177
- .map((issue) => issue.message)
1178
- .join("; ")}`);
1104
+ throw new RemediationHostPreparationError("plan_repair_required", "Cannot prepare an empty remediation host workload");
1179
1105
  }
1180
1106
  const workloadDigest = contentSha256(workload);
1181
1107
  // A binding whose workload file an earlier contract version wrote is
@@ -1201,7 +1127,7 @@ export async function prepareRemediationHostHandoff(params) {
1201
1127
  throw new Error("The conformance review has begun but the trusted run policy is missing. Restore the run state before continuing; review cannot be silently disabled.");
1202
1128
  }
1203
1129
  }
1204
- const checkpoint = await readIntentCheckpoint(join(paths.artifactsDir, "intent_checkpoint.json"));
1130
+ const checkpoint = await readIntentCheckpoint(intakePaths(paths.artifactsDir).intentCheckpoint);
1205
1131
  conformanceReview = { run_id: params.runId, enabled: checkpoint?.conformance_review === true,
1206
1132
  ...(checkpoint ? { checkpoint_sha256: contentSha256(checkpoint) } : {}) };
1207
1133
  }
@@ -1321,7 +1247,6 @@ export async function ingestRemediationHostResults(params) {
1321
1247
  workItemOutcomes: new Map(),
1322
1248
  resultIds: new Set(),
1323
1249
  landedFiles: new Set(nextState.applied_edit_surface ?? []),
1324
- settledFindingIds: new Set(),
1325
1250
  recordedRecoveryMarks: null,
1326
1251
  };
1327
1252
  const verdicts = await executeHostVerificationReruns(validated.ctx, acc);
@@ -1350,16 +1275,30 @@ async function recordAndEnrichHostIssues(artifactsDir, runId, issues, acceptedId
1350
1275
  /**
1351
1276
  * Phase 1 — the whole-bundle gates, up to the schedulable frontier.
1352
1277
  *
1353
- * Returns either a populated context or ONE OF THREE finished summaries. The
1354
- * three do not agree on `pending_work_item_ids` — the read failure and the
1355
- * canonical parse failure return the binding's own item ids, the trusted-binding
1356
- * refusal returns the empty list — so folding any two together is a silent
1357
- * behavior change. Each is pinned by a test that asserts the pending list, not
1358
- * just the code.
1278
+ * Returns either a populated context or ONE OF FOUR finished summaries. The
1279
+ * four do not agree on `pending_work_item_ids` — the read failure, the stale
1280
+ * workload and the canonical parse failure return the binding's own item ids,
1281
+ * the trusted-binding refusal returns the empty list — so each exit passes its
1282
+ * own list and folding the lists together is a silent behavior change. Each is
1283
+ * pinned by a test that asserts the pending list, not just the code.
1359
1284
  */
1360
1285
  async function validateHostResultBundle(input) {
1361
1286
  const { state, nextState, paths } = input;
1362
1287
  const issues = [];
1288
+ // The finished summary of an exit that accepted nothing. The pending list is
1289
+ // the caller's, because the exits do not agree on it (see above).
1290
+ const noAcceptance = (pendingWorkItemIds) => ({
1291
+ kind: "summary",
1292
+ summary: {
1293
+ accepted_count: 0,
1294
+ completed_work_item_ids: [],
1295
+ pending_work_item_ids: pendingWorkItemIds,
1296
+ issues,
1297
+ work_item_outcomes: new Map(),
1298
+ state_changed: false,
1299
+ state: nextState,
1300
+ },
1301
+ });
1363
1302
  const workloadRead = await readSubmissionDocument(paths.workloadPath);
1364
1303
  if (workloadRead.kind !== "value") {
1365
1304
  if (state.host_handoff) {
@@ -1373,18 +1312,7 @@ async function validateHostResultBundle(input) {
1373
1312
  : `the workload file is not valid JSON: ${workloadRead.detail}`,
1374
1313
  });
1375
1314
  }
1376
- return {
1377
- kind: "summary",
1378
- summary: {
1379
- accepted_count: 0,
1380
- completed_work_item_ids: [],
1381
- pending_work_item_ids: state.host_handoff?.work_item_ids ?? [],
1382
- issues,
1383
- work_item_outcomes: new Map(),
1384
- state_changed: false,
1385
- state: nextState,
1386
- },
1387
- };
1315
+ return noAcceptance(state.host_handoff?.work_item_ids ?? []);
1388
1316
  }
1389
1317
  // Producer-side plan defects are reported BEFORE the workload is parsed: a
1390
1318
  // block with an unresolvable dependency or an unnormalized write scope makes
@@ -1406,18 +1334,7 @@ async function validateHostResultBundle(input) {
1406
1334
  check: "workload_binding",
1407
1335
  message: "a git-backed remediation workload requires the tool-owned host_handoff state binding",
1408
1336
  });
1409
- return {
1410
- kind: "summary",
1411
- summary: {
1412
- accepted_count: 0,
1413
- completed_work_item_ids: [],
1414
- pending_work_item_ids: [],
1415
- issues,
1416
- work_item_outcomes: new Map(),
1417
- state_changed: false,
1418
- state: nextState,
1419
- },
1420
- };
1337
+ return noAcceptance([]);
1421
1338
  }
1422
1339
  // A workload an EARLIER contract version wrote is not a defect in it: the
1423
1340
  // tool changed underneath a live binding. It is reported as stale — no host
@@ -1429,18 +1346,7 @@ async function validateHostResultBundle(input) {
1429
1346
  check: "workload_binding",
1430
1347
  message: "the workload file was written under an earlier contract version; the tool writes it again",
1431
1348
  });
1432
- return {
1433
- kind: "summary",
1434
- summary: {
1435
- accepted_count: 0,
1436
- completed_work_item_ids: [],
1437
- pending_work_item_ids: state.host_handoff.work_item_ids,
1438
- issues,
1439
- work_item_outcomes: new Map(),
1440
- state_changed: false,
1441
- state: nextState,
1442
- },
1443
- };
1349
+ return noAcceptance(state.host_handoff.work_item_ids);
1444
1350
  }
1445
1351
  const workload = parseWorkload(workloadRead.value, paths, input.runId, state);
1446
1352
  if (!workload) {
@@ -1452,18 +1358,7 @@ async function validateHostResultBundle(input) {
1452
1358
  check: "workload_binding",
1453
1359
  message: "the workload does not match its canonical state shape and persisted digest binding",
1454
1360
  });
1455
- return {
1456
- kind: "summary",
1457
- summary: {
1458
- accepted_count: 0,
1459
- completed_work_item_ids: [],
1460
- pending_work_item_ids: state.host_handoff?.work_item_ids ?? [],
1461
- issues,
1462
- work_item_outcomes: new Map(),
1463
- state_changed: false,
1464
- state: nextState,
1465
- },
1466
- };
1361
+ return noAcceptance(state.host_handoff?.work_item_ids ?? []);
1467
1362
  }
1468
1363
  return {
1469
1364
  kind: "context",
@@ -1489,14 +1384,6 @@ async function validateHostResultBundle(input) {
1489
1384
  },
1490
1385
  };
1491
1386
  }
1492
- /**
1493
- * Phase 2 — per-item verification. Writes NOTHING to `ctx.nextState`.
1494
- *
1495
- * Iterates the effective workload in order and emits one verdict per ACCEPTED
1496
- * item; a refusal pushes its classified issue and continues. The ledger mark
1497
- * for a recovery acceptance still goes down before that item's verdict is
1498
- * emitted, so no acceptance can outrun its record.
1499
- */
1500
1387
  /**
1501
1388
  * Did a corroborated commit already land for this work item, even though no
1502
1389
  * result file is at its bound path?
@@ -1504,12 +1391,9 @@ async function validateHostResultBundle(input) {
1504
1391
  * Ground truth, not a claim: `host_landed_commit` is written only after
1505
1392
  * `corroborateHostResult` verified the commit resolves, is reachable from HEAD,
1506
1393
  * and that its mechanically derived diff lies within the item's write scope.
1507
- * Anything less is not a landing.
1508
- *
1509
- * ANY finding of the item counts, because the commit is attributed per FINDING
1510
- * and a work item is a bundle of them: a commit for one of its findings is work
1511
- * this item did, which is exactly what the host needs to know before rewriting
1512
- * the result from scratch.
1394
+ * Anything less is not a landing. A landed commit is work this item did, which
1395
+ * is exactly what the host needs to know before rewriting the result from
1396
+ * scratch.
1513
1397
  */
1514
1398
  function hasLandedCommitFor(state, workItem) {
1515
1399
  return typeof state.items[workItem.id]?.host_landed_commit === "string";
@@ -1517,22 +1401,29 @@ function hasLandedCommitFor(state, workItem) {
1517
1401
  async function requiredConformanceReview(ctx, workItem, result) {
1518
1402
  if (!ctx.state.conformance_review?.enabled)
1519
1403
  return { ok: true };
1404
+ const unit = ctx.state.plan.units.find(candidate => candidate.id === workItem.id);
1520
1405
  return checkContractConformance({
1521
1406
  root: ctx.paths.root, artifactsDir: ctx.paths.artifactsDir, runId: ctx.runId,
1522
1407
  item: workItem, result,
1523
1408
  requirements: ctx.state.plan.requirements.filter(requirement => workItem.obligation_ids.includes(requirement.id)),
1524
- unit: ctx.state.plan.units.find(unit => unit.id === workItem.id),
1409
+ unit,
1525
1410
  revision: ctx.state.plan.review_revision_sha256,
1526
- counterexamples: (ctx.state.plan.review_counterexamples ?? []).filter(example => ctx.state.plan.units.find(unit => unit.id === workItem.id).addresses_counterexample_ids.includes(example.id)),
1411
+ counterexamples: (ctx.state.plan.review_counterexamples ?? []).filter(example => unit.addresses_counterexample_ids.includes(example.id)),
1527
1412
  });
1528
1413
  }
1414
+ /**
1415
+ * Phase 2 — per-item verification. Writes NOTHING to `ctx.nextState`.
1416
+ *
1417
+ * Iterates the effective workload in order and emits one verdict per ACCEPTED
1418
+ * item; a refusal pushes its classified issue and continues. The ledger mark
1419
+ * for a recovery acceptance still goes down before that item's verdict is
1420
+ * emitted, so no acceptance can outrun its record.
1421
+ */
1529
1422
  async function executeHostVerificationReruns(ctx, acc) {
1530
1423
  const { paths, nextState, state } = ctx;
1531
1424
  const verdicts = [];
1532
1425
  for (const workItem of ctx.effectiveWorkload.work_items) {
1533
- const pendingItems = [workItem.id].filter((findingId) => nextState.items[findingId]?.status === "pending" &&
1534
- !acc.settledFindingIds.has(findingId));
1535
- if (pendingItems.length === 0)
1426
+ if (nextState.items[workItem.id]?.status !== "pending")
1536
1427
  continue;
1537
1428
  if (!ctx.eligibleIds.has(workItem.id)) {
1538
1429
  acc.issues.push({
@@ -1548,12 +1439,7 @@ async function executeHostVerificationReruns(ctx, acc) {
1548
1439
  artifactsDir: paths.artifactsDir,
1549
1440
  workItemId: workItem.id,
1550
1441
  resultPath: workItem.result_path,
1551
- parse: (value) => {
1552
- const result = parseResult(value, ctx.runId, workItem);
1553
- return result.ok
1554
- ? { ok: true, parsed: result }
1555
- : { ok: false, check: result.check, detail: result.reason };
1556
- },
1442
+ parse: scanParser(ctx.runId, workItem),
1557
1443
  resultId: (result) => result.result.result_id,
1558
1444
  seen: (resultId) => acc.resultIds.has(resultId),
1559
1445
  messages: remediationScanMessages,
@@ -1581,6 +1467,16 @@ async function executeHostVerificationReruns(ctx, acc) {
1581
1467
  }
1582
1468
  const parsed = scan.parsed;
1583
1469
  const resultId = parsed.result.result_id;
1470
+ const reviewFirst = state.conformance_review?.enabled === true && !ctx.recovery;
1471
+ const reviewHead = reviewFirst ? await headCommit(paths.root) : null;
1472
+ const checkReview = async () => {
1473
+ // Both the structural preflight and execution must target the checkout
1474
+ // for which we ask the reviewer to inspect the bound result.
1475
+ if (reviewFirst && await headCommit(paths.root) !== reviewHead) {
1476
+ return conformanceIssue(conformanceReviewPaths(paths.artifactsDir, ctx.runId, workItem.id), workItem.id, "conformance_review_required", "Repository HEAD changed during result verification. Re-run next-step on the reviewed checkout.");
1477
+ }
1478
+ return requiredConformanceReview(ctx, workItem, parsed.result);
1479
+ };
1584
1480
  acc.resultIds.add(resultId);
1585
1481
  if (parsed.kind === "decision") {
1586
1482
  const result = parsed.result;
@@ -1617,6 +1513,13 @@ async function executeHostVerificationReruns(ctx, acc) {
1617
1513
  });
1618
1514
  continue;
1619
1515
  }
1516
+ if (reviewFirst) {
1517
+ const review = await checkReview();
1518
+ if (!review.ok) {
1519
+ acc.issues.push(review.issue);
1520
+ continue;
1521
+ }
1522
+ }
1620
1523
  const failedTests = await rerunRequiredTests(paths.root, workItem.required_tests, ctx.requiredTestVerdicts);
1621
1524
  if (failedTests.length > 0) {
1622
1525
  acc.issues.push(requiredTestIssue(workItem, failedTests));
@@ -1624,17 +1527,14 @@ async function executeHostVerificationReruns(ctx, acc) {
1624
1527
  }
1625
1528
  }
1626
1529
  const review = outcome.status === "resolved_no_change"
1627
- ? await requiredConformanceReview(ctx, workItem, result) : { ok: true };
1530
+ ? await checkReview() : { ok: true };
1628
1531
  if (!review.ok) {
1629
1532
  acc.issues.push(review.issue);
1630
1533
  continue;
1631
1534
  }
1632
- for (const findingId of pendingItems)
1633
- acc.settledFindingIds.add(findingId);
1634
1535
  verdicts.push({
1635
1536
  kind: "decision",
1636
1537
  workItem,
1637
- pendingItems,
1638
1538
  at: new Date().toISOString(),
1639
1539
  outcome,
1640
1540
  conformance_review: review.receipt,
@@ -1660,8 +1560,13 @@ async function executeHostVerificationReruns(ctx, acc) {
1660
1560
  result,
1661
1561
  verdicts: ctx.requiredTestVerdicts,
1662
1562
  recovery: ctx.recovery,
1563
+ ...(reviewFirst ? { beforeRequiredTests: checkReview } : {}),
1663
1564
  });
1664
1565
  if (!corroborated.ok) {
1566
+ if (corroborated.reviewIssue) {
1567
+ acc.issues.push(corroborated.reviewIssue);
1568
+ continue;
1569
+ }
1665
1570
  acc.issues.push({
1666
1571
  code: corroborated.code,
1667
1572
  check: corroborated.check,
@@ -1671,7 +1576,7 @@ async function executeHostVerificationReruns(ctx, acc) {
1671
1576
  });
1672
1577
  continue;
1673
1578
  }
1674
- const review = await requiredConformanceReview(ctx, workItem, result);
1579
+ const review = await checkReview();
1675
1580
  if (!review.ok) {
1676
1581
  acc.issues.push(review.issue);
1677
1582
  continue;
@@ -1723,18 +1628,15 @@ async function executeHostVerificationReruns(ctx, acc) {
1723
1628
  work_item_id: workItem.id,
1724
1629
  result_path: workItem.result_path,
1725
1630
  message: "the recovery acceptance could not be recorded on the submission ledger, so it " +
1726
- `was refused: ${error instanceof Error ? error.message : String(error)}`,
1631
+ `was refused: ${errorMessage(error)}`,
1727
1632
  });
1728
1633
  continue;
1729
1634
  }
1730
1635
  }
1731
- for (const findingId of pendingItems)
1732
- acc.settledFindingIds.add(findingId);
1733
1636
  verdicts.push({
1734
1637
  kind: "landed",
1735
1638
  conformance_review: review.receipt,
1736
1639
  workItem,
1737
- pendingItems,
1738
1640
  at: new Date().toISOString(),
1739
1641
  landedCommit: result.landed_commit,
1740
1642
  changedFiles: corroborated.changedFiles,
@@ -1751,73 +1653,68 @@ async function executeHostVerificationReruns(ctx, acc) {
1751
1653
  *
1752
1654
  * Infallible given the verdicts: every refusal was already classified in
1753
1655
  * phase 2, so nothing here can reject. Verdicts apply in workload order, which
1754
- * is the order they were emitted, so a finding two items share is written the
1755
- * same way it was before the phases were separated.
1656
+ * is the order they were emitted, and each writes only its own work item's
1657
+ * state (the workload's ids are unique).
1756
1658
  */
1757
1659
  function commitRemediationStateUpdates(ctx, acc, verdicts, issues) {
1758
1660
  const { nextState } = ctx;
1759
1661
  for (const verdict of verdicts) {
1662
+ const item = nextState.items[verdict.workItem.id];
1760
1663
  if (verdict.kind === "decision") {
1761
1664
  const outcome = verdict.outcome;
1762
- for (const findingId of verdict.pendingItems) {
1763
- const item = nextState.items[findingId];
1764
- if (verdict.conformance_review)
1765
- item.conformance_review = verdict.conformance_review;
1766
- else
1767
- delete item.conformance_review;
1768
- item.started_at ??= verdict.at;
1769
- if (outcome.status === "resolved_no_change") {
1770
- item.status = "resolved_no_change";
1771
- item.completed_at = verdict.at;
1772
- item.host_result_evidence = [...outcome.evidence];
1773
- delete item.failure_reason;
1774
- }
1775
- else if (outcome.status === "blocked") {
1776
- item.status = "blocked";
1777
- item.completed_at = verdict.at;
1778
- item.failure_reason = outcome.failure_reason;
1779
- }
1780
- else {
1781
- item.status = "needs_clarification";
1782
- delete item.completed_at;
1783
- item.failure_reason = outcome.question;
1784
- // The question lives on the item (its one home): the clarification
1785
- // round lists every paused item, so no answer can erase another's.
1786
- item.clarification_question = {
1787
- category: isClarificationCategory(outcome.category)
1788
- ? outcome.category
1789
- : "scope_of_fix",
1790
- description: outcome.question,
1791
- };
1792
- }
1793
- }
1794
- continue;
1795
- }
1796
- for (const findingId of verdict.pendingItems) {
1797
- const item = nextState.items[findingId];
1798
1665
  if (verdict.conformance_review)
1799
1666
  item.conformance_review = verdict.conformance_review;
1800
1667
  else
1801
1668
  delete item.conformance_review;
1802
- item.status = "resolved";
1803
1669
  item.started_at ??= verdict.at;
1804
- item.completed_at = verdict.at;
1805
- // The corroborated outcome is PERSISTED per item, not just folded into the
1806
- // run-wide `applied_edit_surface`, so the attribution survives the process
1807
- // that observed it — and read back by `hasLandedCommitFor` on the next
1808
- // ingest, which is how an item whose edits landed but whose result file
1809
- // never arrived is told apart from one that was never attempted.
1810
- item.host_landed_commit = verdict.landedCommit;
1811
- item.host_landed_files = [...verdict.changedFiles];
1812
- delete item.failure_reason;
1813
- delete item.host_result_evidence;
1670
+ if (outcome.status === "resolved_no_change") {
1671
+ item.status = "resolved_no_change";
1672
+ item.completed_at = verdict.at;
1673
+ item.host_result_evidence = [...outcome.evidence];
1674
+ delete item.failure_reason;
1675
+ }
1676
+ else if (outcome.status === "blocked") {
1677
+ item.status = "blocked";
1678
+ item.completed_at = verdict.at;
1679
+ item.failure_reason = outcome.failure_reason;
1680
+ }
1681
+ else {
1682
+ item.status = "needs_clarification";
1683
+ delete item.completed_at;
1684
+ item.failure_reason = outcome.question;
1685
+ // The question lives on the item (its one home): the clarification
1686
+ // round lists every paused item, so no answer can erase another's.
1687
+ item.clarification_question = {
1688
+ category: isClarificationCategory(outcome.category)
1689
+ ? outcome.category
1690
+ : "scope_of_fix",
1691
+ description: outcome.question,
1692
+ };
1693
+ }
1694
+ continue;
1814
1695
  }
1696
+ if (verdict.conformance_review)
1697
+ item.conformance_review = verdict.conformance_review;
1698
+ else
1699
+ delete item.conformance_review;
1700
+ item.status = "resolved";
1701
+ item.started_at ??= verdict.at;
1702
+ item.completed_at = verdict.at;
1703
+ // The corroborated outcome is PERSISTED per item, not just folded into the
1704
+ // run-wide `applied_edit_surface`, so the attribution survives the process
1705
+ // that observed it — and read back by `hasLandedCommitFor` on the next
1706
+ // ingest, which is how an item whose edits landed but whose result file
1707
+ // never arrived is told apart from one that was never attempted.
1708
+ item.host_landed_commit = verdict.landedCommit;
1709
+ item.host_landed_files = [...verdict.changedFiles];
1710
+ delete item.failure_reason;
1711
+ delete item.host_result_evidence;
1815
1712
  }
1816
1713
  if (acc.completed.length > 0) {
1817
1714
  nextState.applied_edit_surface = [...acc.landedFiles].sort(compareCodeUnits);
1818
1715
  }
1819
1716
  const pendingWorkItemIds = ctx.effectiveWorkload.work_items
1820
- .filter((workItem) => [workItem.id].some((findingId) => nextState.items[findingId]?.status === "pending"))
1717
+ .filter((workItem) => nextState.items[workItem.id]?.status === "pending")
1821
1718
  .map((workItem) => workItem.id);
1822
1719
  let stateChanged = acc.completed.length > 0;
1823
1720
  if (nextState.host_handoff && pendingWorkItemIds.length === 0) {