audit-tools 0.51.7 → 0.51.9

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 (665) hide show
  1. package/dist/audit/clarification/blastRadius.d.ts +17 -16
  2. package/dist/audit/clarification/blastRadius.d.ts.map +1 -1
  3. package/dist/audit/clarification/blastRadius.js +48 -44
  4. package/dist/audit/clarification/blastRadius.js.map +1 -1
  5. package/dist/audit/clarification/dials.d.ts +4 -4
  6. package/dist/audit/clarification/dials.d.ts.map +1 -1
  7. package/dist/audit/clarification/dials.js +1 -0
  8. package/dist/audit/clarification/dials.js.map +1 -1
  9. package/dist/audit/clarification/partition.d.ts +12 -21
  10. package/dist/audit/clarification/partition.d.ts.map +1 -1
  11. package/dist/audit/clarification/partition.js +52 -59
  12. package/dist/audit/clarification/partition.js.map +1 -1
  13. package/dist/audit/clarification/riskGate.d.ts +2 -2
  14. package/dist/audit/clarification/riskGate.d.ts.map +1 -1
  15. package/dist/audit/clarification/riskGate.js +1 -0
  16. package/dist/audit/clarification/riskGate.js.map +1 -1
  17. package/dist/audit/clarification/voiQueue.d.ts +3 -3
  18. package/dist/audit/clarification/voiQueue.d.ts.map +1 -1
  19. package/dist/audit/clarification/voiQueue.js +1 -0
  20. package/dist/audit/clarification/voiQueue.js.map +1 -1
  21. package/dist/audit/cli/auditStep.d.ts +14 -2
  22. package/dist/audit/cli/auditStep.d.ts.map +1 -1
  23. package/dist/audit/cli/auditStep.js +13 -5
  24. package/dist/audit/cli/auditStep.js.map +1 -1
  25. package/dist/audit/cli/charterClarificationPrompt.d.ts +6 -9
  26. package/dist/audit/cli/charterClarificationPrompt.d.ts.map +1 -1
  27. package/dist/audit/cli/charterClarificationPrompt.js +35 -47
  28. package/dist/audit/cli/charterClarificationPrompt.js.map +1 -1
  29. package/dist/audit/cli/charterComparisonPrompt.d.ts +14 -0
  30. package/dist/audit/cli/charterComparisonPrompt.d.ts.map +1 -0
  31. package/dist/audit/cli/charterComparisonPrompt.js +111 -0
  32. package/dist/audit/cli/charterComparisonPrompt.js.map +1 -0
  33. package/dist/audit/cli/charterExtractionPrompt.d.ts +14 -17
  34. package/dist/audit/cli/charterExtractionPrompt.d.ts.map +1 -1
  35. package/dist/audit/cli/charterExtractionPrompt.js +81 -104
  36. package/dist/audit/cli/charterExtractionPrompt.js.map +1 -1
  37. package/dist/audit/cli/charterFidelityPrompt.d.ts +14 -0
  38. package/dist/audit/cli/charterFidelityPrompt.d.ts.map +1 -0
  39. package/dist/audit/cli/charterFidelityPrompt.js +58 -0
  40. package/dist/audit/cli/charterFidelityPrompt.js.map +1 -0
  41. package/dist/audit/cli/conceptualDispatch.d.ts +39 -6
  42. package/dist/audit/cli/conceptualDispatch.d.ts.map +1 -1
  43. package/dist/audit/cli/conceptualDispatch.js +59 -12
  44. package/dist/audit/cli/conceptualDispatch.js.map +1 -1
  45. package/dist/audit/cli/confirmIntentStep.d.ts.map +1 -1
  46. package/dist/audit/cli/confirmIntentStep.js +46 -2
  47. package/dist/audit/cli/confirmIntentStep.js.map +1 -1
  48. package/dist/audit/cli/dispatch/hostHandoff.d.ts +18 -6
  49. package/dist/audit/cli/dispatch/hostHandoff.d.ts.map +1 -1
  50. package/dist/audit/cli/dispatch/hostHandoff.js +525 -67
  51. package/dist/audit/cli/dispatch/hostHandoff.js.map +1 -1
  52. package/dist/audit/cli/fanoutLanes.d.ts +24 -0
  53. package/dist/audit/cli/fanoutLanes.d.ts.map +1 -1
  54. package/dist/audit/cli/fanoutLanes.js +9 -1
  55. package/dist/audit/cli/fanoutLanes.js.map +1 -1
  56. package/dist/audit/cli/foldTransaction.d.ts.map +1 -1
  57. package/dist/audit/cli/foldTransaction.js +14 -3
  58. package/dist/audit/cli/foldTransaction.js.map +1 -1
  59. package/dist/audit/cli/forceSynthesisCommand.d.ts.map +1 -1
  60. package/dist/audit/cli/forceSynthesisCommand.js +4 -1
  61. package/dist/audit/cli/forceSynthesisCommand.js.map +1 -1
  62. package/dist/audit/cli/intakeCommand.d.ts.map +1 -1
  63. package/dist/audit/cli/intakeCommand.js +1 -0
  64. package/dist/audit/cli/intakeCommand.js.map +1 -1
  65. package/dist/audit/cli/laneSubmissions.d.ts +18 -12
  66. package/dist/audit/cli/laneSubmissions.d.ts.map +1 -1
  67. package/dist/audit/cli/laneSubmissions.js +40 -4
  68. package/dist/audit/cli/laneSubmissions.js.map +1 -1
  69. package/dist/audit/cli/laneValidators.d.ts.map +1 -1
  70. package/dist/audit/cli/laneValidators.js +14 -14
  71. package/dist/audit/cli/laneValidators.js.map +1 -1
  72. package/dist/audit/cli/nextStepCommand.d.ts +7 -0
  73. package/dist/audit/cli/nextStepCommand.d.ts.map +1 -1
  74. package/dist/audit/cli/nextStepCommand.js +206 -31
  75. package/dist/audit/cli/nextStepCommand.js.map +1 -1
  76. package/dist/audit/cli/nextStepHelpers.d.ts +92 -28
  77. package/dist/audit/cli/nextStepHelpers.d.ts.map +1 -1
  78. package/dist/audit/cli/nextStepHelpers.js +363 -126
  79. package/dist/audit/cli/nextStepHelpers.js.map +1 -1
  80. package/dist/audit/cli/prompts.d.ts +10 -0
  81. package/dist/audit/cli/prompts.d.ts.map +1 -1
  82. package/dist/audit/cli/prompts.js +3 -1
  83. package/dist/audit/cli/prompts.js.map +1 -1
  84. package/dist/audit/cli/reviewRun.d.ts +12 -0
  85. package/dist/audit/cli/reviewRun.d.ts.map +1 -1
  86. package/dist/audit/cli/reviewRun.js +242 -29
  87. package/dist/audit/cli/reviewRun.js.map +1 -1
  88. package/dist/audit/cli/sampleRunCommand.d.ts +12 -4
  89. package/dist/audit/cli/sampleRunCommand.d.ts.map +1 -1
  90. package/dist/audit/cli/semanticReviewStep.d.ts +9 -0
  91. package/dist/audit/cli/semanticReviewStep.d.ts.map +1 -1
  92. package/dist/audit/cli/semanticReviewStep.js +71 -30
  93. package/dist/audit/cli/semanticReviewStep.js.map +1 -1
  94. package/dist/audit/cli/statusCommand.d.ts.map +1 -1
  95. package/dist/audit/cli/statusCommand.js +29 -66
  96. package/dist/audit/cli/statusCommand.js.map +1 -1
  97. package/dist/audit/cli/stepScaffold.d.ts +43 -2
  98. package/dist/audit/cli/stepScaffold.d.ts.map +1 -1
  99. package/dist/audit/cli/stepScaffold.js +24 -10
  100. package/dist/audit/cli/stepScaffold.js.map +1 -1
  101. package/dist/audit/cli/steps.d.ts +52 -29
  102. package/dist/audit/cli/steps.d.ts.map +1 -1
  103. package/dist/audit/cli/steps.js +44 -14
  104. package/dist/audit/cli/steps.js.map +1 -1
  105. package/dist/audit/cli/synthesizeCommand.d.ts.map +1 -1
  106. package/dist/audit/cli/synthesizeCommand.js +4 -1
  107. package/dist/audit/cli/synthesizeCommand.js.map +1 -1
  108. package/dist/audit/contracts/workerSchemas.d.ts +65 -16
  109. package/dist/audit/contracts/workerSchemas.d.ts.map +1 -1
  110. package/dist/audit/contracts/workerSchemas.js +89 -8
  111. package/dist/audit/contracts/workerSchemas.js.map +1 -1
  112. package/dist/audit/contracts/wrapperResponse.d.ts +14 -21
  113. package/dist/audit/contracts/wrapperResponse.d.ts.map +1 -1
  114. package/dist/audit/contracts/wrapperResponse.js +0 -1
  115. package/dist/audit/contracts/wrapperResponse.js.map +1 -1
  116. package/dist/audit/decompose/findings.d.ts.map +1 -1
  117. package/dist/audit/decompose/findings.js +10 -2
  118. package/dist/audit/decompose/findings.js.map +1 -1
  119. package/dist/audit/extractors/designAssessment.d.ts.map +1 -1
  120. package/dist/audit/extractors/designAssessment.js +13 -4
  121. package/dist/audit/extractors/designAssessment.js.map +1 -1
  122. package/dist/audit/extractors/disposition.d.ts.map +1 -1
  123. package/dist/audit/extractors/disposition.js +17 -5
  124. package/dist/audit/extractors/disposition.js.map +1 -1
  125. package/dist/audit/extractors/graph.d.ts +1 -1
  126. package/dist/audit/extractors/graph.js +1 -1
  127. package/dist/audit/extractors/graphRoutes.d.ts.map +1 -1
  128. package/dist/audit/extractors/graphRoutes.js +224 -17
  129. package/dist/audit/extractors/graphRoutes.js.map +1 -1
  130. package/dist/audit/extractors/leadLineage.d.ts +10 -0
  131. package/dist/audit/extractors/leadLineage.d.ts.map +1 -0
  132. package/dist/audit/extractors/leadLineage.js +44 -0
  133. package/dist/audit/extractors/leadLineage.js.map +1 -0
  134. package/dist/audit/io/artifacts.d.ts.map +1 -1
  135. package/dist/audit/io/artifacts.js +25 -8
  136. package/dist/audit/io/artifacts.js.map +1 -1
  137. package/dist/audit/io/runArtifacts.d.ts +76 -1
  138. package/dist/audit/io/runArtifacts.d.ts.map +1 -1
  139. package/dist/audit/io/runArtifacts.js +113 -20
  140. package/dist/audit/io/runArtifacts.js.map +1 -1
  141. package/dist/audit/io/toolingManifest.d.ts +15 -0
  142. package/dist/audit/io/toolingManifest.d.ts.map +1 -1
  143. package/dist/audit/io/toolingManifest.js +158 -11
  144. package/dist/audit/io/toolingManifest.js.map +1 -1
  145. package/dist/audit/orchestrator/advance.d.ts.map +1 -1
  146. package/dist/audit/orchestrator/advance.js +30 -4
  147. package/dist/audit/orchestrator/advance.js.map +1 -1
  148. package/dist/audit/orchestrator/advanceTypes.d.ts +28 -5
  149. package/dist/audit/orchestrator/advanceTypes.d.ts.map +1 -1
  150. package/dist/audit/orchestrator/artifactMetadata.d.ts.map +1 -1
  151. package/dist/audit/orchestrator/artifactMetadata.js +39 -1
  152. package/dist/audit/orchestrator/artifactMetadata.js.map +1 -1
  153. package/dist/audit/orchestrator/auditTaskUtils.d.ts.map +1 -1
  154. package/dist/audit/orchestrator/auditTaskUtils.js +4 -1
  155. package/dist/audit/orchestrator/auditTaskUtils.js.map +1 -1
  156. package/dist/audit/orchestrator/charterClarificationExecutor.d.ts +11 -17
  157. package/dist/audit/orchestrator/charterClarificationExecutor.d.ts.map +1 -1
  158. package/dist/audit/orchestrator/charterClarificationExecutor.js +61 -93
  159. package/dist/audit/orchestrator/charterClarificationExecutor.js.map +1 -1
  160. package/dist/audit/orchestrator/charterComparisonExecutor.d.ts +24 -0
  161. package/dist/audit/orchestrator/charterComparisonExecutor.d.ts.map +1 -0
  162. package/dist/audit/orchestrator/charterComparisonExecutor.js +110 -0
  163. package/dist/audit/orchestrator/charterComparisonExecutor.js.map +1 -0
  164. package/dist/audit/orchestrator/charterExtractionExecutor.d.ts +34 -20
  165. package/dist/audit/orchestrator/charterExtractionExecutor.d.ts.map +1 -1
  166. package/dist/audit/orchestrator/charterExtractionExecutor.js +80 -106
  167. package/dist/audit/orchestrator/charterExtractionExecutor.js.map +1 -1
  168. package/dist/audit/orchestrator/charterFidelityExecutor.d.ts +20 -0
  169. package/dist/audit/orchestrator/charterFidelityExecutor.d.ts.map +1 -0
  170. package/dist/audit/orchestrator/charterFidelityExecutor.js +76 -0
  171. package/dist/audit/orchestrator/charterFidelityExecutor.js.map +1 -0
  172. package/dist/audit/orchestrator/charterFidelityPacket.d.ts +7 -0
  173. package/dist/audit/orchestrator/charterFidelityPacket.d.ts.map +1 -0
  174. package/dist/audit/orchestrator/charterFidelityPacket.js +68 -0
  175. package/dist/audit/orchestrator/charterFidelityPacket.js.map +1 -0
  176. package/dist/audit/orchestrator/dependencyMap.d.ts.map +1 -1
  177. package/dist/audit/orchestrator/dependencyMap.js +9 -8
  178. package/dist/audit/orchestrator/dependencyMap.js.map +1 -1
  179. package/dist/audit/orchestrator/dependencySlices.d.ts.map +1 -1
  180. package/dist/audit/orchestrator/dependencySlices.js +7 -6
  181. package/dist/audit/orchestrator/dependencySlices.js.map +1 -1
  182. package/dist/audit/orchestrator/designReviewProjection.d.ts.map +1 -1
  183. package/dist/audit/orchestrator/designReviewProjection.js +7 -0
  184. package/dist/audit/orchestrator/designReviewProjection.js.map +1 -1
  185. package/dist/audit/orchestrator/designReviewPrompt.d.ts.map +1 -1
  186. package/dist/audit/orchestrator/designReviewPrompt.js +58 -19
  187. package/dist/audit/orchestrator/designReviewPrompt.js.map +1 -1
  188. package/dist/audit/orchestrator/executorRunners.d.ts.map +1 -1
  189. package/dist/audit/orchestrator/executorRunners.js +6 -2
  190. package/dist/audit/orchestrator/executorRunners.js.map +1 -1
  191. package/dist/audit/orchestrator/executors.d.ts.map +1 -1
  192. package/dist/audit/orchestrator/executors.js +22 -8
  193. package/dist/audit/orchestrator/executors.js.map +1 -1
  194. package/dist/audit/orchestrator/hostInputPause.js +1 -0
  195. package/dist/audit/orchestrator/hostInputPause.js.map +1 -1
  196. package/dist/audit/orchestrator/intentCheckpointExecutor.d.ts +40 -0
  197. package/dist/audit/orchestrator/intentCheckpointExecutor.d.ts.map +1 -1
  198. package/dist/audit/orchestrator/intentCheckpointExecutor.js +32 -2
  199. package/dist/audit/orchestrator/intentCheckpointExecutor.js.map +1 -1
  200. package/dist/audit/orchestrator/intentCheckpointGate.d.ts +5 -3
  201. package/dist/audit/orchestrator/intentCheckpointGate.d.ts.map +1 -1
  202. package/dist/audit/orchestrator/intentCheckpointGate.js +34 -5
  203. package/dist/audit/orchestrator/intentCheckpointGate.js.map +1 -1
  204. package/dist/audit/orchestrator/intentEquivalenceExecutor.d.ts +2 -2
  205. package/dist/audit/orchestrator/intentInterpreter.d.ts +1 -1
  206. package/dist/audit/orchestrator/intentInterpreter.js +1 -1
  207. package/dist/audit/orchestrator/nextStep.d.ts.map +1 -1
  208. package/dist/audit/orchestrator/nextStep.js +3 -1
  209. package/dist/audit/orchestrator/nextStep.js.map +1 -1
  210. package/dist/audit/orchestrator/obligationPolicy.d.ts +2 -1
  211. package/dist/audit/orchestrator/obligationPolicy.d.ts.map +1 -1
  212. package/dist/audit/orchestrator/obligationPolicy.js +19 -7
  213. package/dist/audit/orchestrator/obligationPolicy.js.map +1 -1
  214. package/dist/audit/orchestrator/partitionTaskGraph.d.ts.map +1 -1
  215. package/dist/audit/orchestrator/partitionTaskGraph.js +1 -0
  216. package/dist/audit/orchestrator/partitionTaskGraph.js.map +1 -1
  217. package/dist/audit/orchestrator/resultIngestion.d.ts.map +1 -1
  218. package/dist/audit/orchestrator/resultIngestion.js +3 -1
  219. package/dist/audit/orchestrator/resultIngestion.js.map +1 -1
  220. package/dist/audit/orchestrator/runtimeCommand.d.ts +72 -0
  221. package/dist/audit/orchestrator/runtimeCommand.d.ts.map +1 -1
  222. package/dist/audit/orchestrator/runtimeCommand.js +177 -20
  223. package/dist/audit/orchestrator/runtimeCommand.js.map +1 -1
  224. package/dist/audit/orchestrator/scopeIndexBaseline.d.ts +56 -0
  225. package/dist/audit/orchestrator/scopeIndexBaseline.d.ts.map +1 -0
  226. package/dist/audit/orchestrator/scopeIndexBaseline.js +114 -0
  227. package/dist/audit/orchestrator/scopeIndexBaseline.js.map +1 -0
  228. package/dist/audit/orchestrator/staleness.d.ts +70 -1
  229. package/dist/audit/orchestrator/staleness.d.ts.map +1 -1
  230. package/dist/audit/orchestrator/staleness.js +171 -21
  231. package/dist/audit/orchestrator/staleness.js.map +1 -1
  232. package/dist/audit/orchestrator/state.d.ts.map +1 -1
  233. package/dist/audit/orchestrator/state.js +49 -25
  234. package/dist/audit/orchestrator/state.js.map +1 -1
  235. package/dist/audit/orchestrator/structureExecutors.d.ts.map +1 -1
  236. package/dist/audit/orchestrator/structureExecutors.js +7 -5
  237. package/dist/audit/orchestrator/structureExecutors.js.map +1 -1
  238. package/dist/audit/orchestrator/syntaxResolutionExecutor.d.ts.map +1 -1
  239. package/dist/audit/orchestrator/syntaxResolutionExecutor.js +1 -0
  240. package/dist/audit/orchestrator/syntaxResolutionExecutor.js.map +1 -1
  241. package/dist/audit/orchestrator/systemicChallengeExecutor.d.ts +13 -2
  242. package/dist/audit/orchestrator/systemicChallengeExecutor.d.ts.map +1 -1
  243. package/dist/audit/orchestrator/systemicChallengeExecutor.js +166 -12
  244. package/dist/audit/orchestrator/systemicChallengeExecutor.js.map +1 -1
  245. package/dist/audit/reporting/mergeFindings.d.ts.map +1 -1
  246. package/dist/audit/reporting/mergeFindings.js +6 -5
  247. package/dist/audit/reporting/mergeFindings.js.map +1 -1
  248. package/dist/audit/reporting/synthesis.d.ts +117 -0
  249. package/dist/audit/reporting/synthesis.d.ts.map +1 -1
  250. package/dist/audit/reporting/synthesis.js +277 -10
  251. package/dist/audit/reporting/synthesis.js.map +1 -1
  252. package/dist/audit/supervisor/operatorHandoff.d.ts +0 -2
  253. package/dist/audit/supervisor/operatorHandoff.d.ts.map +1 -1
  254. package/dist/audit/supervisor/operatorHandoff.js +0 -3
  255. package/dist/audit/supervisor/operatorHandoff.js.map +1 -1
  256. package/dist/audit/systemic/coveredThemes.d.ts +28 -0
  257. package/dist/audit/systemic/coveredThemes.d.ts.map +1 -0
  258. package/dist/audit/systemic/coveredThemes.js +52 -0
  259. package/dist/audit/systemic/coveredThemes.js.map +1 -0
  260. package/dist/audit/systemic/reviewFileMap.d.ts +81 -0
  261. package/dist/audit/systemic/reviewFileMap.d.ts.map +1 -0
  262. package/dist/audit/systemic/reviewFileMap.js +169 -0
  263. package/dist/audit/systemic/reviewFileMap.js.map +1 -0
  264. package/dist/audit/systemic/secondOrderAdversaryPrompt.d.ts.map +1 -1
  265. package/dist/audit/systemic/secondOrderAdversaryPrompt.js +149 -26
  266. package/dist/audit/systemic/secondOrderAdversaryPrompt.js.map +1 -1
  267. package/dist/audit/systemic/systemicChallengeLoop.d.ts +44 -4
  268. package/dist/audit/systemic/systemicChallengeLoop.d.ts.map +1 -1
  269. package/dist/audit/systemic/systemicChallengeLoop.js +114 -10
  270. package/dist/audit/systemic/systemicChallengeLoop.js.map +1 -1
  271. package/dist/audit/types/auditState.d.ts +6 -6
  272. package/dist/audit/types/charterClarification.d.ts +9 -4
  273. package/dist/audit/types/charterClarification.d.ts.map +1 -1
  274. package/dist/audit/types/charterRegister.d.ts +48 -93
  275. package/dist/audit/types/charterRegister.d.ts.map +1 -1
  276. package/dist/audit/types/charterRegister.js +15 -26
  277. package/dist/audit/types/charterRegister.js.map +1 -1
  278. package/dist/audit/types/conceptualAdjudication.d.ts +88 -18
  279. package/dist/audit/types/conceptualAdjudication.d.ts.map +1 -1
  280. package/dist/audit/types/conceptualAdjudication.js +77 -16
  281. package/dist/audit/types/conceptualAdjudication.js.map +1 -1
  282. package/dist/audit/types/designAssessment.d.ts +8 -6
  283. package/dist/audit/types/designAssessment.d.ts.map +1 -1
  284. package/dist/audit/types/reviewPlanning.d.ts +2 -2
  285. package/dist/audit/types/systemicChallenge.d.ts +43 -7
  286. package/dist/audit/types/systemicChallenge.d.ts.map +1 -1
  287. package/dist/audit/types.d.ts +71 -10
  288. package/dist/audit/types.d.ts.map +1 -1
  289. package/dist/audit/types.js +23 -2
  290. package/dist/audit/types.js.map +1 -1
  291. package/dist/audit/validation/auditResults.d.ts +30 -0
  292. package/dist/audit/validation/auditResults.d.ts.map +1 -1
  293. package/dist/audit/validation/auditResults.js +50 -8
  294. package/dist/audit/validation/auditResults.js.map +1 -1
  295. package/dist/audit/validation/ingestIssueCodes.d.ts +1 -1
  296. package/dist/audit/validation/ingestIssueCodes.d.ts.map +1 -1
  297. package/dist/audit/validation/ingestIssueCodes.js +14 -0
  298. package/dist/audit/validation/ingestIssueCodes.js.map +1 -1
  299. package/dist/remediate/contractPipeline/artifactStore.d.ts +97 -2
  300. package/dist/remediate/contractPipeline/artifactStore.d.ts.map +1 -1
  301. package/dist/remediate/contractPipeline/artifactStore.js +163 -9
  302. package/dist/remediate/contractPipeline/artifactStore.js.map +1 -1
  303. package/dist/remediate/contractPipeline/changeClassification.d.ts.map +1 -1
  304. package/dist/remediate/contractPipeline/changeClassification.js +93 -3
  305. package/dist/remediate/contractPipeline/changeClassification.js.map +1 -1
  306. package/dist/remediate/contractPipeline/cyclicSeamResolution.d.ts.map +1 -1
  307. package/dist/remediate/contractPipeline/cyclicSeamResolution.js +31 -0
  308. package/dist/remediate/contractPipeline/cyclicSeamResolution.js.map +1 -1
  309. package/dist/remediate/contractPipeline/derive.d.ts +0 -14
  310. package/dist/remediate/contractPipeline/derive.d.ts.map +1 -1
  311. package/dist/remediate/contractPipeline/derive.js +52 -24
  312. package/dist/remediate/contractPipeline/derive.js.map +1 -1
  313. package/dist/remediate/contractPipeline/finalizedContractFields.d.ts +50 -0
  314. package/dist/remediate/contractPipeline/finalizedContractFields.d.ts.map +1 -0
  315. package/dist/remediate/contractPipeline/finalizedContractFields.js +77 -0
  316. package/dist/remediate/contractPipeline/finalizedContractFields.js.map +1 -0
  317. package/dist/remediate/contractPipeline/idRegistry.d.ts +85 -0
  318. package/dist/remediate/contractPipeline/idRegistry.d.ts.map +1 -1
  319. package/dist/remediate/contractPipeline/idRegistry.js +147 -0
  320. package/dist/remediate/contractPipeline/idRegistry.js.map +1 -1
  321. package/dist/remediate/contractPipeline/phaseCut.d.ts +13 -16
  322. package/dist/remediate/contractPipeline/phaseCut.d.ts.map +1 -1
  323. package/dist/remediate/contractPipeline/phaseCut.js +15 -30
  324. package/dist/remediate/contractPipeline/phaseCut.js.map +1 -1
  325. package/dist/remediate/contractPipeline/reviewSnapshot.d.ts +20 -1
  326. package/dist/remediate/contractPipeline/reviewSnapshot.d.ts.map +1 -1
  327. package/dist/remediate/contractPipeline/reviewSnapshot.js +23 -7
  328. package/dist/remediate/contractPipeline/reviewSnapshot.js.map +1 -1
  329. package/dist/remediate/contractPipeline/semanticProjection.d.ts +17 -0
  330. package/dist/remediate/contractPipeline/semanticProjection.d.ts.map +1 -1
  331. package/dist/remediate/contractPipeline/semanticProjection.js +6 -9
  332. package/dist/remediate/contractPipeline/semanticProjection.js.map +1 -1
  333. package/dist/remediate/contractPipeline/sketchSource.d.ts +183 -0
  334. package/dist/remediate/contractPipeline/sketchSource.d.ts.map +1 -0
  335. package/dist/remediate/contractPipeline/sketchSource.js +255 -0
  336. package/dist/remediate/contractPipeline/sketchSource.js.map +1 -0
  337. package/dist/remediate/findingFilter.d.ts.map +1 -1
  338. package/dist/remediate/findingFilter.js +1 -0
  339. package/dist/remediate/findingFilter.js.map +1 -1
  340. package/dist/remediate/index.d.ts +81 -0
  341. package/dist/remediate/index.d.ts.map +1 -1
  342. package/dist/remediate/index.js +162 -53
  343. package/dist/remediate/index.js.map +1 -1
  344. package/dist/remediate/intake.d.ts +43 -0
  345. package/dist/remediate/intake.d.ts.map +1 -1
  346. package/dist/remediate/intake.js +82 -13
  347. package/dist/remediate/intake.js.map +1 -1
  348. package/dist/remediate/phases/close.d.ts +33 -2
  349. package/dist/remediate/phases/close.d.ts.map +1 -1
  350. package/dist/remediate/phases/close.js +227 -13
  351. package/dist/remediate/phases/close.js.map +1 -1
  352. package/dist/remediate/phases/closeVerifyHeadEvidence.d.ts +154 -0
  353. package/dist/remediate/phases/closeVerifyHeadEvidence.d.ts.map +1 -0
  354. package/dist/remediate/phases/closeVerifyHeadEvidence.js +242 -0
  355. package/dist/remediate/phases/closeVerifyHeadEvidence.js.map +1 -0
  356. package/dist/remediate/state/runStatus.d.ts +35 -0
  357. package/dist/remediate/state/runStatus.d.ts.map +1 -0
  358. package/dist/remediate/state/runStatus.js +46 -0
  359. package/dist/remediate/state/runStatus.js.map +1 -0
  360. package/dist/remediate/state/store.d.ts +52 -2
  361. package/dist/remediate/state/store.d.ts.map +1 -1
  362. package/dist/remediate/state/store.js +124 -21
  363. package/dist/remediate/state/store.js.map +1 -1
  364. package/dist/remediate/state/types.d.ts +83 -13
  365. package/dist/remediate/state/types.d.ts.map +1 -1
  366. package/dist/remediate/steps/contractPipeline.d.ts +65 -1
  367. package/dist/remediate/steps/contractPipeline.d.ts.map +1 -1
  368. package/dist/remediate/steps/contractPipeline.js +302 -85
  369. package/dist/remediate/steps/contractPipeline.js.map +1 -1
  370. package/dist/remediate/steps/contractPipelinePrompts.d.ts.map +1 -1
  371. package/dist/remediate/steps/contractPipelinePrompts.js +58 -21
  372. package/dist/remediate/steps/contractPipelinePrompts.js.map +1 -1
  373. package/dist/remediate/steps/dispatch/hostHandoff.d.ts +87 -2
  374. package/dist/remediate/steps/dispatch/hostHandoff.d.ts.map +1 -1
  375. package/dist/remediate/steps/dispatch/hostHandoff.js +344 -44
  376. package/dist/remediate/steps/dispatch/hostHandoff.js.map +1 -1
  377. package/dist/remediate/steps/finalGate.d.ts +109 -5
  378. package/dist/remediate/steps/finalGate.d.ts.map +1 -1
  379. package/dist/remediate/steps/finalGate.js +135 -27
  380. package/dist/remediate/steps/finalGate.js.map +1 -1
  381. package/dist/remediate/steps/gateCommands.d.ts +167 -0
  382. package/dist/remediate/steps/gateCommands.d.ts.map +1 -1
  383. package/dist/remediate/steps/gateCommands.js +428 -1
  384. package/dist/remediate/steps/gateCommands.js.map +1 -1
  385. package/dist/remediate/steps/intakeResolver.d.ts +2 -13
  386. package/dist/remediate/steps/intakeResolver.d.ts.map +1 -1
  387. package/dist/remediate/steps/intakeResolver.js +22 -4
  388. package/dist/remediate/steps/intakeResolver.js.map +1 -1
  389. package/dist/remediate/steps/nextStep.d.ts +44 -40
  390. package/dist/remediate/steps/nextStep.d.ts.map +1 -1
  391. package/dist/remediate/steps/nextStep.js +501 -106
  392. package/dist/remediate/steps/nextStep.js.map +1 -1
  393. package/dist/remediate/steps/stepWriter.d.ts +1 -1
  394. package/dist/remediate/steps/stepWriter.d.ts.map +1 -1
  395. package/dist/remediate/steps/stepWriter.js +1 -0
  396. package/dist/remediate/steps/stepWriter.js.map +1 -1
  397. package/dist/remediate/steps/types.d.ts +32 -1
  398. package/dist/remediate/steps/types.d.ts.map +1 -1
  399. package/dist/remediate/steps/types.js +1 -0
  400. package/dist/remediate/steps/types.js.map +1 -1
  401. package/dist/remediate/types/options.d.ts +8 -0
  402. package/dist/remediate/types/options.d.ts.map +1 -1
  403. package/dist/remediate/utils/fileIntegrity.d.ts +8 -0
  404. package/dist/remediate/utils/fileIntegrity.d.ts.map +1 -1
  405. package/dist/remediate/utils/fileIntegrity.js +12 -1
  406. package/dist/remediate/utils/fileIntegrity.js.map +1 -1
  407. package/dist/remediate/validation/artifacts.d.ts +1 -1
  408. package/dist/remediate/validation/artifacts.d.ts.map +1 -1
  409. package/dist/remediate/validation/artifacts.js +19 -2
  410. package/dist/remediate/validation/artifacts.js.map +1 -1
  411. package/dist/remediate/validation/contractPipeline.d.ts.map +1 -1
  412. package/dist/remediate/validation/contractPipeline.js +26 -39
  413. package/dist/remediate/validation/contractPipeline.js.map +1 -1
  414. package/dist/remediate/validation/contractPipelineGates.d.ts +18 -1
  415. package/dist/remediate/validation/contractPipelineGates.d.ts.map +1 -1
  416. package/dist/remediate/validation/contractPipelineGates.js +33 -5
  417. package/dist/remediate/validation/contractPipelineGates.js.map +1 -1
  418. package/dist/shared/analyzers/acquisitionEngine.d.ts +83 -5
  419. package/dist/shared/analyzers/acquisitionEngine.d.ts.map +1 -1
  420. package/dist/shared/analyzers/acquisitionEngine.js +46 -14
  421. package/dist/shared/analyzers/acquisitionEngine.js.map +1 -1
  422. package/dist/shared/analyzers/binaryAcquisition.d.ts +35 -2
  423. package/dist/shared/analyzers/binaryAcquisition.d.ts.map +1 -1
  424. package/dist/shared/analyzers/binaryAcquisition.js +5 -5
  425. package/dist/shared/analyzers/binaryAcquisition.js.map +1 -1
  426. package/dist/shared/analyzers/candidates.d.ts.map +1 -1
  427. package/dist/shared/analyzers/candidates.js +1 -0
  428. package/dist/shared/analyzers/candidates.js.map +1 -1
  429. package/dist/shared/analyzers/clippy.d.ts +9 -1
  430. package/dist/shared/analyzers/clippy.d.ts.map +1 -1
  431. package/dist/shared/analyzers/clippy.js +10 -2
  432. package/dist/shared/analyzers/clippy.js.map +1 -1
  433. package/dist/shared/analyzers/normalizeExternal.d.ts.map +1 -1
  434. package/dist/shared/analyzers/normalizeExternal.js +1 -0
  435. package/dist/shared/analyzers/normalizeExternal.js.map +1 -1
  436. package/dist/shared/analyzers/rubocop.d.ts +7 -1
  437. package/dist/shared/analyzers/rubocop.d.ts.map +1 -1
  438. package/dist/shared/analyzers/rubocop.js +8 -2
  439. package/dist/shared/analyzers/rubocop.js.map +1 -1
  440. package/dist/shared/analyzers/types.d.ts +24 -24
  441. package/dist/shared/analyzers/types.d.ts.map +1 -1
  442. package/dist/shared/analyzers/types.js +15 -0
  443. package/dist/shared/analyzers/types.js.map +1 -1
  444. package/dist/shared/artifactFreshness.d.ts.map +1 -1
  445. package/dist/shared/artifactFreshness.js +42 -7
  446. package/dist/shared/artifactFreshness.js.map +1 -1
  447. package/dist/shared/chunkByBudget.d.ts.map +1 -1
  448. package/dist/shared/chunkByBudget.js.map +1 -1
  449. package/dist/shared/continuityScore.d.ts.map +1 -1
  450. package/dist/shared/continuityScore.js +12 -4
  451. package/dist/shared/continuityScore.js.map +1 -1
  452. package/dist/shared/decompose/charterClarification.d.ts +49 -45
  453. package/dist/shared/decompose/charterClarification.d.ts.map +1 -1
  454. package/dist/shared/decompose/charterClarification.js +50 -57
  455. package/dist/shared/decompose/charterClarification.js.map +1 -1
  456. package/dist/shared/decompose/charterExtraction.d.ts +616 -342
  457. package/dist/shared/decompose/charterExtraction.d.ts.map +1 -1
  458. package/dist/shared/decompose/charterExtraction.js +590 -488
  459. package/dist/shared/decompose/charterExtraction.js.map +1 -1
  460. package/dist/shared/decompose/contentCoherence.d.ts +36 -2
  461. package/dist/shared/decompose/contentCoherence.d.ts.map +1 -1
  462. package/dist/shared/decompose/contentCoherence.js +45 -5
  463. package/dist/shared/decompose/contentCoherence.js.map +1 -1
  464. package/dist/shared/decompose/modularity.d.ts +98 -1
  465. package/dist/shared/decompose/modularity.d.ts.map +1 -1
  466. package/dist/shared/decompose/modularity.js +89 -8
  467. package/dist/shared/decompose/modularity.js.map +1 -1
  468. package/dist/shared/decompose/systemicChallenge.d.ts +111 -0
  469. package/dist/shared/decompose/systemicChallenge.d.ts.map +1 -1
  470. package/dist/shared/decompose/systemicChallenge.js +28 -0
  471. package/dist/shared/decompose/systemicChallenge.js.map +1 -1
  472. package/dist/shared/engine/obligationEngine.d.ts +2 -2
  473. package/dist/shared/engine/obligationEngine.d.ts.map +1 -1
  474. package/dist/shared/engine/obligationEngine.js +8 -2
  475. package/dist/shared/engine/obligationEngine.js.map +1 -1
  476. package/dist/shared/findingSimilarity.d.ts +8 -0
  477. package/dist/shared/findingSimilarity.d.ts.map +1 -1
  478. package/dist/shared/findingSimilarity.js +10 -3
  479. package/dist/shared/findingSimilarity.js.map +1 -1
  480. package/dist/shared/findings/dedupe.d.ts +15 -0
  481. package/dist/shared/findings/dedupe.d.ts.map +1 -1
  482. package/dist/shared/findings/dedupe.js +137 -1
  483. package/dist/shared/findings/dedupe.js.map +1 -1
  484. package/dist/shared/friction/frictionRecord.d.ts.map +1 -1
  485. package/dist/shared/friction/frictionRecord.js +14 -1
  486. package/dist/shared/friction/frictionRecord.js.map +1 -1
  487. package/dist/shared/friction/triage.d.ts +4 -0
  488. package/dist/shared/friction/triage.d.ts.map +1 -1
  489. package/dist/shared/friction/triage.js +41 -29
  490. package/dist/shared/friction/triage.js.map +1 -1
  491. package/dist/shared/git.d.ts +14 -0
  492. package/dist/shared/git.d.ts.map +1 -1
  493. package/dist/shared/git.js +22 -0
  494. package/dist/shared/git.js.map +1 -1
  495. package/dist/shared/index.d.ts +42 -38
  496. package/dist/shared/index.d.ts.map +1 -1
  497. package/dist/shared/index.js +35 -23
  498. package/dist/shared/index.js.map +1 -1
  499. package/dist/shared/intent/clauseBoundaries.d.ts +75 -0
  500. package/dist/shared/intent/clauseBoundaries.d.ts.map +1 -0
  501. package/dist/shared/intent/clauseBoundaries.js +134 -0
  502. package/dist/shared/intent/clauseBoundaries.js.map +1 -0
  503. package/dist/shared/intent/clauseInterpreter.d.ts +11 -5
  504. package/dist/shared/intent/clauseInterpreter.d.ts.map +1 -1
  505. package/dist/shared/intent/clauseInterpreter.js +16 -41
  506. package/dist/shared/intent/clauseInterpreter.js.map +1 -1
  507. package/dist/shared/intent/freeFormIntentInterpreter.d.ts +11 -0
  508. package/dist/shared/intent/freeFormIntentInterpreter.d.ts.map +1 -1
  509. package/dist/shared/intent/freeFormIntentInterpreter.js +31 -17
  510. package/dist/shared/intent/freeFormIntentInterpreter.js.map +1 -1
  511. package/dist/shared/io/fileLock.d.ts.map +1 -1
  512. package/dist/shared/io/fileLock.js +18 -6
  513. package/dist/shared/io/fileLock.js.map +1 -1
  514. package/dist/shared/io/frictionCapture.d.ts +25 -5
  515. package/dist/shared/io/frictionCapture.d.ts.map +1 -1
  516. package/dist/shared/io/frictionCapture.js +30 -9
  517. package/dist/shared/io/frictionCapture.js.map +1 -1
  518. package/dist/shared/io/schemaVersion.d.ts +4 -3
  519. package/dist/shared/io/schemaVersion.d.ts.map +1 -1
  520. package/dist/shared/io/schemaVersion.js +27 -4
  521. package/dist/shared/io/schemaVersion.js.map +1 -1
  522. package/dist/shared/io/stepContractWriter.d.ts +38 -4
  523. package/dist/shared/io/stepContractWriter.d.ts.map +1 -1
  524. package/dist/shared/io/stepContractWriter.js +59 -1
  525. package/dist/shared/io/stepContractWriter.js.map +1 -1
  526. package/dist/shared/loopCorePaths.d.ts.map +1 -1
  527. package/dist/shared/loopCorePaths.js +8 -0
  528. package/dist/shared/loopCorePaths.js.map +1 -1
  529. package/dist/shared/opencodePermissions.d.ts +27 -3
  530. package/dist/shared/opencodePermissions.d.ts.map +1 -1
  531. package/dist/shared/opencodePermissions.js +77 -26
  532. package/dist/shared/opencodePermissions.js.map +1 -1
  533. package/dist/shared/prompts.d.ts +12 -1
  534. package/dist/shared/prompts.d.ts.map +1 -1
  535. package/dist/shared/prompts.js +11 -1
  536. package/dist/shared/prompts.js.map +1 -1
  537. package/dist/shared/reReview/projectionDiff.d.ts +13 -0
  538. package/dist/shared/reReview/projectionDiff.d.ts.map +1 -1
  539. package/dist/shared/reReview/projectionDiff.js +1 -1
  540. package/dist/shared/reReview/projectionDiff.js.map +1 -1
  541. package/dist/shared/reporting/findingDisplay.d.ts +7 -0
  542. package/dist/shared/reporting/findingDisplay.d.ts.map +1 -1
  543. package/dist/shared/reporting/findingDisplay.js +8 -1
  544. package/dist/shared/reporting/findingDisplay.js.map +1 -1
  545. package/dist/shared/steps/stepEmissionScaffold.d.ts +15 -3
  546. package/dist/shared/steps/stepEmissionScaffold.d.ts.map +1 -1
  547. package/dist/shared/steps/stepEmissionScaffold.js +8 -6
  548. package/dist/shared/steps/stepEmissionScaffold.js.map +1 -1
  549. package/dist/shared/submission/hostHandoffCore.d.ts +37 -12
  550. package/dist/shared/submission/hostHandoffCore.d.ts.map +1 -1
  551. package/dist/shared/submission/hostHandoffCore.js +81 -18
  552. package/dist/shared/submission/hostHandoffCore.js.map +1 -1
  553. package/dist/shared/submission/hostResultOutcomes.d.ts +70 -1
  554. package/dist/shared/submission/hostResultOutcomes.d.ts.map +1 -1
  555. package/dist/shared/submission/hostResultOutcomes.js +66 -1
  556. package/dist/shared/submission/hostResultOutcomes.js.map +1 -1
  557. package/dist/shared/submission/submissionLedger.d.ts +86 -1
  558. package/dist/shared/submission/submissionLedger.d.ts.map +1 -1
  559. package/dist/shared/submission/submissionLedger.js +108 -0
  560. package/dist/shared/submission/submissionLedger.js.map +1 -1
  561. package/dist/shared/submission/submissionScan.d.ts.map +1 -1
  562. package/dist/shared/submission/submissionScan.js +1 -0
  563. package/dist/shared/submission/submissionScan.js.map +1 -1
  564. package/dist/shared/tooling/analyzerDeps.d.ts +14 -0
  565. package/dist/shared/tooling/analyzerDeps.d.ts.map +1 -1
  566. package/dist/shared/tooling/analyzerDeps.js +23 -0
  567. package/dist/shared/tooling/analyzerDeps.js.map +1 -1
  568. package/dist/shared/tooling/commandShape.d.ts +35 -1
  569. package/dist/shared/tooling/commandShape.d.ts.map +1 -1
  570. package/dist/shared/tooling/commandShape.js +66 -4
  571. package/dist/shared/tooling/commandShape.js.map +1 -1
  572. package/dist/shared/tooling/exec.d.ts +62 -4
  573. package/dist/shared/tooling/exec.d.ts.map +1 -1
  574. package/dist/shared/tooling/exec.js +127 -8
  575. package/dist/shared/tooling/exec.js.map +1 -1
  576. package/dist/shared/types/charter.d.ts +674 -156
  577. package/dist/shared/types/charter.d.ts.map +1 -1
  578. package/dist/shared/types/charter.js +172 -118
  579. package/dist/shared/types/charter.js.map +1 -1
  580. package/dist/shared/types/closingActions.d.ts +25 -0
  581. package/dist/shared/types/closingActions.d.ts.map +1 -1
  582. package/dist/shared/types/closingActions.js +26 -0
  583. package/dist/shared/types/closingActions.js.map +1 -1
  584. package/dist/shared/types/contractPipeline/obligations.d.ts +63 -2
  585. package/dist/shared/types/contractPipeline/obligations.d.ts.map +1 -1
  586. package/dist/shared/types/contractPipeline/obligations.js +51 -0
  587. package/dist/shared/types/contractPipeline/obligations.js.map +1 -1
  588. package/dist/shared/types/contractPipeline.d.ts +1 -0
  589. package/dist/shared/types/contractPipeline.d.ts.map +1 -1
  590. package/dist/shared/types/contractPipeline.js +1 -0
  591. package/dist/shared/types/contractPipeline.js.map +1 -1
  592. package/dist/shared/types/contractPropertyShapes.d.ts +34 -0
  593. package/dist/shared/types/contractPropertyShapes.d.ts.map +1 -0
  594. package/dist/shared/types/contractPropertyShapes.js +255 -0
  595. package/dist/shared/types/contractPropertyShapes.js.map +1 -0
  596. package/dist/shared/types/finding.d.ts +376 -18
  597. package/dist/shared/types/finding.d.ts.map +1 -1
  598. package/dist/shared/types/finding.js +111 -0
  599. package/dist/shared/types/finding.js.map +1 -1
  600. package/dist/shared/types/intentCheckpoint.d.ts +214 -2
  601. package/dist/shared/types/intentCheckpoint.d.ts.map +1 -1
  602. package/dist/shared/types/intentCheckpoint.js +273 -0
  603. package/dist/shared/types/intentCheckpoint.js.map +1 -1
  604. package/dist/shared/types/intentInterpretation.d.ts +1 -1
  605. package/dist/shared/types/intentInterpretation.js +1 -1
  606. package/dist/shared/types/remediationOutcome.d.ts +294 -30
  607. package/dist/shared/types/remediationOutcome.d.ts.map +1 -1
  608. package/dist/shared/types/remediationOutcome.js +96 -7
  609. package/dist/shared/types/remediationOutcome.js.map +1 -1
  610. package/dist/shared/types/stepContract.d.ts +47 -0
  611. package/dist/shared/types/stepContract.d.ts.map +1 -1
  612. package/dist/shared/types/stepContract.js +113 -0
  613. package/dist/shared/types/stepContract.js.map +1 -1
  614. package/dist/shared/validation/charterGate.d.ts +13 -28
  615. package/dist/shared/validation/charterGate.d.ts.map +1 -1
  616. package/dist/shared/validation/charterGate.js +13 -35
  617. package/dist/shared/validation/charterGate.js.map +1 -1
  618. package/dist/shared/validation/contractConstructionSites.d.ts +116 -0
  619. package/dist/shared/validation/contractConstructionSites.d.ts.map +1 -0
  620. package/dist/shared/validation/contractConstructionSites.js +277 -0
  621. package/dist/shared/validation/contractConstructionSites.js.map +1 -0
  622. package/dist/shared/validation/designFindingGrounding.d.ts +33 -4
  623. package/dist/shared/validation/designFindingGrounding.d.ts.map +1 -1
  624. package/dist/shared/validation/designFindingGrounding.js +40 -6
  625. package/dist/shared/validation/designFindingGrounding.js.map +1 -1
  626. package/dist/shared/validation/findingGrounding.d.ts.map +1 -1
  627. package/dist/shared/validation/findingGrounding.js +11 -1
  628. package/dist/shared/validation/findingGrounding.js.map +1 -1
  629. package/dist/shared/validation/findingsReport.d.ts.map +1 -1
  630. package/dist/shared/validation/findingsReport.js +5 -0
  631. package/dist/shared/validation/findingsReport.js.map +1 -1
  632. package/docs/audit-pkg/contracts.md +8 -2
  633. package/opencode.json +29 -29
  634. package/package.json +16 -3
  635. package/schemas/audit-code-v1alpha1.schema.json +0 -4
  636. package/scripts/audit/postinstall.mjs +81 -96
  637. package/scripts/remediate/postinstall.mjs +43 -83
  638. package/scripts/shared/host-asset-plan.mjs +176 -0
  639. package/scripts/shared/install-host-assets.mjs +44 -1
  640. package/scripts/shared/primitives.mjs +89 -0
  641. package/skills/audit-code/SKILL.md +4 -4
  642. package/skills/audit-code/audit-code.prompt.md +14 -10
  643. package/skills/remediate-code/SKILL.md +9 -5
  644. package/skills/remediate-code/remediate-code.prompt.md +11 -4
  645. package/wrapper/audit-code-wrapper-build.mjs +6 -3
  646. package/dist/audit/cli/charterDeltaPrompt.d.ts +0 -18
  647. package/dist/audit/cli/charterDeltaPrompt.d.ts.map +0 -1
  648. package/dist/audit/cli/charterDeltaPrompt.js +0 -150
  649. package/dist/audit/cli/charterDeltaPrompt.js.map +0 -1
  650. package/dist/audit/orchestrator/charterDeltaExecutor.d.ts +0 -24
  651. package/dist/audit/orchestrator/charterDeltaExecutor.d.ts.map +0 -1
  652. package/dist/audit/orchestrator/charterDeltaExecutor.js +0 -128
  653. package/dist/audit/orchestrator/charterDeltaExecutor.js.map +0 -1
  654. package/dist/audit/supervisor/runLedger.d.ts +0 -3
  655. package/dist/audit/supervisor/runLedger.d.ts.map +0 -1
  656. package/dist/audit/supervisor/runLedger.js +0 -69
  657. package/dist/audit/supervisor/runLedger.js.map +0 -1
  658. package/dist/shared/types/executionRecord.d.ts +0 -58
  659. package/dist/shared/types/executionRecord.d.ts.map +0 -1
  660. package/dist/shared/types/executionRecord.js +0 -26
  661. package/dist/shared/types/executionRecord.js.map +0 -1
  662. package/dist/shared/types/runLedger.d.ts +0 -17
  663. package/dist/shared/types/runLedger.d.ts.map +0 -1
  664. package/dist/shared/types/runLedger.js +0 -7
  665. package/dist/shared/types/runLedger.js.map +0 -1
@@ -1,11 +1,18 @@
1
+ // sites-pinned: tests/remediate/host-handoff-corroboration.test.ts
2
+ // (the bounded
3
+ // required-test failure message)
1
4
  import { mkdir } from "node:fs/promises";
2
5
  import { isAbsolute } from "node:path";
3
- import { AUDIT_TOOLS_DIRNAME, headCommit, commandLeavesDeclaredShape, FindingSchema, SUBMISSION_ISSUE_CODES, SUBMISSION_LEDGER_EVENT_CONTRACT_VERSION, appendSubmissionEvent, enrichMissingSubmissionIssues, compareCodeUnits, contentSha256, hasExactKeys, hostHandoffResultPath, idsAreStrictlyAscending, isCommit, isGitRepo, isRecord, isSha256, normalizeRepoPath, parseAllWorkloadItems, parseCommandString, parseWorkloadEnvelope, promptSha256, readSubmissionDocument, readSubmissionLedger, readTrailingSubmissionRefusals, recordHostResultOutcomes, repoRelativePath, resolveContainedPath, resolveHostHandoffPaths, resultIdentityIsBound, runTrackedAsync, sameStrings, scanBoundSubmission, stringArray, stableStringify, TRACKED_CHILD_DEADLINE_MS, writeJsonFile, } from "audit-tools/shared";
4
- import { StateStore } from "../../state/store.js";
6
+ import { AUDIT_TOOLS_DIRNAME, headCommit, commandLeavesDeclaredShape, FindingSchema, SUBMISSION_ISSUE_CODES, SUBMISSION_LEDGER_EVENT_CONTRACT_VERSION, appendSubmissionEvent, enrichMissingSubmissionIssues, isMissingObservation, compareCodeUnits, contentSha256, deriveLaneDemand, hasExactKeys, identityFailureDiagnostic, hostHandoffResultPath, idsAreStrictlyAscending, isCommit, isGitRepo, isRecord, isSha256, LaneDemandSchema, normalizeRepoPath, parseAllWorkloadItems, parseCommandString, parseWorkloadEnvelope, promptSha256, readSubmissionDocument, readSubmissionLedger, readTrailingSubmissionRefusals, recoveryMarkMatches, recordHostResultOutcomes, repoRelativePath, resolveContainedPath, resolveHostHandoffPaths, runTrackedAsync, sameStrings, scanBoundSubmission, SEVERITIES, severityRank, stringArray, stableStringify, TRACKED_CHILD_DEADLINE_MS, writeJsonFile, } from "audit-tools/shared";
7
+ import { REMEDIATION_STATE_CONTRACT_VERSION, StateStore, } from "../../state/store.js";
5
8
  import { REMEDIATION_HOST_HANDOFF_RECORD_V1ALPHA1, REMEDIATION_HOST_HANDOFF_RECORD_V1ALPHA2, REMEDIATION_HOST_SCOPE_SEMANTICS, RemediationHostHandoffRecordSchema, RemediationPlanSchema, isClarificationCategory, } from "../../state/types.js";
6
9
  import { ITEM_STATUSES, isTerminalStatus, isVerifiedCompleteStatus, } from "../../state/itemStatus.js";
7
10
  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";
8
- const STATE_CONTRACT_VERSION = "remediate-code-state/v1alpha1";
11
+ // The state contract version is the STORE's declaration, not a second literal
12
+ // here. It used to be private to this module — and the module then supplied it
13
+ // to its own parser at the call site below, so the check it performed was
14
+ // "does the constant equal itself".
15
+ const STATE_CONTRACT_VERSION = REMEDIATION_STATE_CONTRACT_VERSION;
9
16
  /**
10
17
  * Remediation's issue vocabulary: the SHARED submission codes plus this draw's
11
18
  * own domain corroboration codes.
@@ -69,6 +76,14 @@ export const REMEDIATION_ISSUE_CODES = [
69
76
  * tree that is no longer current. The whole recovery aborts.
70
77
  */
71
78
  "tree_moved_between_phases",
79
+ /**
80
+ * The run's own WORKLOAD BINDING changed between the recovery verb's unlocked
81
+ * test phase and its locked write phase — the sibling of
82
+ * `tree_moved_between_phases` for a concurrent state writer that settles items
83
+ * and re-mints the binding without moving a commit. The pre-computed verdicts
84
+ * describe work that is no longer pending, so the whole recovery aborts.
85
+ */
86
+ "state_moved_between_phases",
72
87
  ];
73
88
  const CURRENT_STATE_KEYS = new Set([
74
89
  "applied_edit_surface",
@@ -91,6 +106,12 @@ const CURRENT_ITEM_KEYS = new Set([
91
106
  "completed_at",
92
107
  "failure_context",
93
108
  "failure_reason",
109
+ // The corroborated landing this ingest itself writes on an accepted item (see
110
+ // RemediationItemState.host_landed_commit). Listed because this gate is an
111
+ // ALLOWLIST: without them the first ingest persists them and the very next
112
+ // one refuses the whole state as a retired shape it cannot parse.
113
+ "host_landed_commit",
114
+ "host_landed_files",
94
115
  "host_result_evidence",
95
116
  "finding_id",
96
117
  "incomplete_coverage_attempts",
@@ -395,18 +416,13 @@ function cannotPrepareMessage(root, state, raised) {
395
416
  function resolveBoundaryPaths(params) {
396
417
  // The remediate draw's run dir carries the `implement` lane segment — its
397
418
  // runs directory also holds triage/closing lanes — which the core takes as a
398
- // parameter rather than a fork.
399
- const core = resolveHostHandoffPaths({
419
+ // parameter rather than a fork. The core's whole result is returned: the draw
420
+ // adds no fields and re-derives none of the core's.
421
+ return resolveHostHandoffPaths({
400
422
  ...params,
401
423
  runDirSegments: ["implement"],
402
424
  runIdLabel: "remediation host run id",
403
425
  });
404
- return {
405
- root: core.root,
406
- artifactsDir: core.artifactsDir,
407
- workloadPath: core.workloadPath,
408
- resultDir: core.resultDir,
409
- };
410
426
  }
411
427
  /**
412
428
  * The bound path for one work item's submission — the SHARED rule, not a local
@@ -414,13 +430,7 @@ function resolveBoundaryPaths(params) {
414
430
  * divergence between them would have been silent on both sides.
415
431
  */
416
432
  function resultPathFor(paths, workItemId) {
417
- return hostHandoffResultPath({
418
- root: paths.root,
419
- artifactsDir: paths.artifactsDir,
420
- runDir: paths.workloadPath.slice(0, paths.workloadPath.length - "host-workload.json".length - 1),
421
- resultDir: paths.resultDir,
422
- workloadPath: paths.workloadPath,
423
- }, workItemId);
433
+ return hostHandoffResultPath(paths, workItemId);
424
434
  }
425
435
  /**
426
436
  * Resolve the submission validator the INGEST applies to one work item, plus
@@ -457,12 +467,13 @@ export async function remediationSubmissionBinding(params) {
457
467
  let validationWorkItem = workItem;
458
468
  try {
459
469
  const storedState = await new StateStore(paths.artifactsDir).loadState();
460
- const state = storedState
461
- ? parseCurrentState({
462
- ...storedState,
463
- contract_version: STATE_CONTRACT_VERSION,
464
- })
465
- : null;
470
+ // No version is supplied here. The store reads the state from disk and
471
+ // stamps the contract version it just VALIDATED, so `parseCurrentState`
472
+ // tests the value that was in the file. It used to be handed
473
+ // `STATE_CONTRACT_VERSION` from this line, which made the parser's version
474
+ // check compare a constant to itself and accept any state the store was
475
+ // willing to return.
476
+ const state = storedState ? parseCurrentState(storedState) : null;
466
477
  const canonicalWorkload = state
467
478
  ? parseWorkload(read.value, paths, params.runId, state)
468
479
  : null;
@@ -648,6 +659,63 @@ function buildPrompt(item) {
648
659
  `If no edit should land, write ${DECISION_CONTRACT_VERSION} instead with exactly contract_version, result_id, run_id, work_item_id, prompt_sha256, outcome. outcome must be one of: {status: resolved_no_change, evidence: [non-empty strings]}, {status: blocked, failure_reason: non-empty string}, or {status: needs_clarification, question: non-empty string, optional category}.`,
649
660
  ].join("\n");
650
661
  }
662
+ /**
663
+ * The remediate draw's risk score for one block, in `[0, 1]`.
664
+ *
665
+ * The per-mode INPUT to the shared ranking is what this draw's artifacts
666
+ * already carry: the severities of the findings the block addresses. A block
667
+ * fixing three `critical` findings is not the same dispatch as one fixing a
668
+ * single `info`, and before this it looked identical to the host.
669
+ *
670
+ * The score is the WORST severity in the block, with the count of same-or-worse
671
+ * findings nudging it up — a block of many high-severity findings is above a
672
+ * block with one. Deterministic (no clock, no sampling) and bounded by
673
+ * construction. A block whose findings are all absent from the plan contributes
674
+ * nothing, so an unresolvable block honestly ranks `low` rather than being
675
+ * guessed at.
676
+ */
677
+ export function severityRiskWeight(severity) {
678
+ // DERIVED from the shared tuple, never a second copy of it. This used to be a
679
+ // hand-written `Record<string, number>` — a second severity vocabulary beside
680
+ // the one `FindingSeveritySchema`/`SEVERITIES`/`severityRank` single-source in
681
+ // `src/shared/types/lens.ts` — read through `?? 0`. A severity added to the
682
+ // shared union fell through that fallback and weighted as ZERO, i.e. the
683
+ // safest possible rank, so a block of brand-new-critical findings dispatched
684
+ // as if it fixed nothing. The return type is the shared union, and `SEVERITIES`
685
+ // is the tuple it is DERIVED from, so that class of miss is now a type error
686
+ // rather than a silent downgrade.
687
+ //
688
+ // The scale is "how far up the severity ladder", 1 at the top and 0 at the
689
+ // bottom: ORDER is the shared fact, and this is only the scale applied to it.
690
+ // The values reproduce the hand-written table this replaced EXACTLY
691
+ // (1 / 0.75 / 0.5 / 0.25 / 0.1 for five tiers), so no emitted ranking moves.
692
+ //
693
+ // The bottom tier's floor is deliberate. Unguarded it would be 0 — the same
694
+ // weight as "this block's findings could not be resolved at all" — and those
695
+ // are different facts: a block that fixes `info` findings is a real, if
696
+ // smallest, dispatch, while an unresolvable block is a hole in the plan.
697
+ // Keeping the bottom off zero is what lets `blockRiskScore`'s corroboration
698
+ // bump distinguish them.
699
+ const ladder = SEVERITIES.length - 1;
700
+ return severity === "info"
701
+ ? 0.1
702
+ : ladder === 0
703
+ ? 1
704
+ : (severityRank(severity) - 1) / ladder;
705
+ }
706
+ function blockRiskScore(state, block) {
707
+ const scores = block.items
708
+ .map((findingId) => state.plan.findings.find((entry) => entry.id === findingId)?.severity)
709
+ .flatMap((severity) => severity === undefined ? [] : [severityRiskWeight(severity)]);
710
+ if (scores.length === 0)
711
+ return 0;
712
+ const worst = Math.max(...scores);
713
+ // Each additional finding at or above half the worst severity adds a tenth,
714
+ // capped: breadth within a severity band is real but must not outrank a
715
+ // genuinely worse finding.
716
+ const corroborating = scores.filter((score) => score >= worst / 2).length - 1;
717
+ return Math.min(1, worst + Math.max(0, corroborating) * 0.1);
718
+ }
651
719
  function buildFindingAssignments(state, block) {
652
720
  return block.items.map((findingId) => {
653
721
  const finding = state.plan.findings.find((entry) => entry.id === findingId);
@@ -703,6 +771,11 @@ function buildWorkItem(paths, block, baselineCommit, state) {
703
771
  prompt: { text: promptText, sha256: promptSha256(promptText) },
704
772
  required_tests: requiredTests,
705
773
  result_path: resultPath,
774
+ demand: deriveLaneDemand({
775
+ tokenEstimate: block.token_estimate ?? 0,
776
+ fileCount: allowedFiles.length,
777
+ riskScore: blockRiskScore(state, block),
778
+ }),
706
779
  token_estimate: block.token_estimate ?? 0,
707
780
  };
708
781
  }
@@ -730,6 +803,7 @@ function parseWorkItem(value, paths, state, expectedBaselineCommit) {
730
803
  !hasExactKeys(value, [
731
804
  "allowed_files",
732
805
  "baseline_commit",
806
+ "demand",
733
807
  "finding_ids",
734
808
  "id",
735
809
  "obligation_ids",
@@ -739,6 +813,7 @@ function parseWorkItem(value, paths, state, expectedBaselineCommit) {
739
813
  "token_estimate",
740
814
  ]) ||
741
815
  typeof value.id !== "string" ||
816
+ !LaneDemandSchema.safeParse(value.demand).success ||
742
817
  !isCommit(value.baseline_commit) ||
743
818
  !Array.isArray(value.finding_ids) ||
744
819
  !value.finding_ids.every((entry) => typeof entry === "string") ||
@@ -832,12 +907,17 @@ function parseResult(value, runId, workItem, root) {
832
907
  typeof value.outcome.status !== "string") {
833
908
  return invalidResult("result_envelope", "decision must match the exact current run, work-item, and prompt binding");
834
909
  }
835
- if (!resultIdentityIsBound(value, {
910
+ // The identity walk AND its vocabulary are the CORE's, so this refusal
911
+ // names the same broken component the audit draw names for the same
912
+ // submission — the shared sentence is appended to this draw's framing,
913
+ // which addresses a host repairing a remediation decision.
914
+ const decisionIdentityFailure = identityFailureDiagnostic(value, {
836
915
  runId,
837
916
  workItemId: workItem.id,
838
917
  promptSha256: workItem.prompt.sha256,
839
- })) {
840
- return invalidResult("identity_binding", "decision must match the exact current run, work-item, and prompt binding");
918
+ });
919
+ if (decisionIdentityFailure !== null) {
920
+ return invalidResult("identity_binding", `decision must match the exact current run, work-item, and prompt binding: ${decisionIdentityFailure}`);
841
921
  }
842
922
  const outcome = value.outcome;
843
923
  if (outcome.status === "resolved_no_change") {
@@ -892,12 +972,18 @@ function parseResult(value, runId, workItem, root) {
892
972
  value.contract_version !== RESULT_CONTRACT_VERSION) {
893
973
  return invalidResult("result_envelope", "result must match the exact current contract, run, work-item, and prompt binding");
894
974
  }
895
- if (!resultIdentityIsBound(value, {
975
+ // The identity walk AND its vocabulary are the CORE's, so the same broken
976
+ // submission is reported with the same named component whichever half of the
977
+ // pipeline reads it. Only the framing is this draw's — and the framing is the
978
+ // part that used to differ, producing two undifferentiated sentences that
979
+ // named no component at all.
980
+ const resultIdentityFailure = identityFailureDiagnostic(value, {
896
981
  runId,
897
982
  workItemId: workItem.id,
898
983
  promptSha256: workItem.prompt.sha256,
899
- })) {
900
- return invalidResult("identity_binding", "result must match the exact current contract, run, work-item, and prompt binding");
984
+ });
985
+ if (resultIdentityFailure !== null) {
986
+ return invalidResult("identity_binding", `result must match the exact current contract, run, work-item, and prompt binding: ${resultIdentityFailure}`);
901
987
  }
902
988
  const changedFiles = stringArray(value.changed_files);
903
989
  if (!changedFiles ||
@@ -1016,9 +1102,29 @@ async function gitCommitIsAncestor(root, ancestor, descendant) {
1016
1102
  * So orphanhood is the CONJUNCTION of two probes: `git for-each-ref --contains`
1017
1103
  * lists every branch/tag/remote ref whose history contains the commit (empty
1018
1104
  * output = no live ref keeps it), and the HEAD ancestry check rides alongside
1019
- * it because a detached HEAD is not a ref `for-each-ref` enumerates and would
1020
- * otherwise scan clean. A failed scan is not evidence of orphanhood — it fails
1021
- * closed, so a git that cannot answer never unlocks the relaxation.
1105
+ * it.
1106
+ *
1107
+ * A THIRD source of reachability sits outside `for-each-ref` entirely: the
1108
+ * HEADs of this repository's OTHER worktrees, checked into no ref at all. In a
1109
+ * linked worktree git DETACHES HEAD (or parks a per-worktree branch), so a
1110
+ * baseline that is the live HEAD of a sibling worktree — exactly the state a
1111
+ * parallel remediation lane is in — would be reported as contained by nothing,
1112
+ * i.e. orphaned, and the relaxation would be handed out for a commit the
1113
+ * repository is actively keeping. `git worktree list --porcelain` enumerates
1114
+ * every worktree with its current HEAD, so it is read and compared. The linked
1115
+ * worktree's own HEAD is included by this probe, which is why the ordinary
1116
+ * detached-HEAD case needs no separate arm.
1117
+ *
1118
+ * RESIDUAL, deliberately not closed: that probe compares HEAD for EQUALITY, so
1119
+ * it covers a worktree detached at the baseline ONLY when its HEAD *is* the
1120
+ * baseline. A sibling worktree detached at a DESCENDANT of the baseline — a
1121
+ * lane that landed further commits on top — keeps the baseline reachable while
1122
+ * matching no ref and no worktree HEAD, and is still reported orphaned. Closing
1123
+ * it means an ancestry probe per enumerated worktree HEAD; the residual is
1124
+ * stated here rather than left as an implied full cover.
1125
+ *
1126
+ * A failed scan is not evidence of orphanhood — any probe that cannot answer
1127
+ * fails closed, so a git that cannot answer never unlocks the relaxation.
1022
1128
  */
1023
1129
  async function gitCommitIsOrphaned(root, commit) {
1024
1130
  if (await gitCommitIsAncestor(root, commit, "HEAD"))
@@ -1026,7 +1132,18 @@ async function gitCommitIsOrphaned(root, commit) {
1026
1132
  const result = await runTrackedAsync(["git", "for-each-ref", "--contains", commit, "--format=%(refname)"], { cwd: root, encoding: "utf8", timeout: TRACKED_CHILD_DEADLINE_MS });
1027
1133
  if (result.error || result.status !== 0)
1028
1134
  return false;
1029
- return result.stdout.trim().length === 0;
1135
+ if (result.stdout.trim().length > 0)
1136
+ return false;
1137
+ // Reached only when no REF keeps the commit. Every worktree HEAD is then
1138
+ // checked, so the detached (and per-worktree-branch) HEADs git does not
1139
+ // enumerate as refs are still seen.
1140
+ const worktrees = await runTrackedAsync(["git", "worktree", "list", "--porcelain"], { cwd: root, encoding: "utf8", timeout: TRACKED_CHILD_DEADLINE_MS });
1141
+ if (worktrees.error || worktrees.status !== 0)
1142
+ return false;
1143
+ return !worktrees.stdout
1144
+ .split("\n")
1145
+ .filter((line) => line.startsWith("HEAD "))
1146
+ .some((line) => line.slice("HEAD ".length).trim() === commit);
1030
1147
  }
1031
1148
  async function gitChangedFilesOfCommit(root, commit) {
1032
1149
  const result = await runTrackedAsync([
@@ -1174,6 +1291,84 @@ async function corroborateNoChangeClaim(params) {
1174
1291
  }
1175
1292
  return { ok: true };
1176
1293
  }
1294
+ /**
1295
+ * The MINTED verdict table: a Map subclass that exists only inside this module.
1296
+ *
1297
+ * The type above says "a table of verdicts"; it cannot say "a table produced by
1298
+ * actually running the tests". A plain-JS caller at the package boundary — or a
1299
+ * `as unknown as` cast — can hand the ingest a hand-built map in which every
1300
+ * command reads `null`, i.e. green, without spawning anything. So the trust the
1301
+ * ingest needs is a RUNTIME property, and a module-private subclass is exactly
1302
+ * that: {@link precomputeRecoveryTestVerdicts} is the only code that can produce
1303
+ * one, and because the class is never exported, no other module can construct or
1304
+ * subclass it. A caller that wants a trusted table can still get one — by
1305
+ * calling the minter, which runs the tests, which is the whole point.
1306
+ */
1307
+ class MintedRequiredTestVerdicts extends Map {
1308
+ }
1309
+ /** Whether a caller-supplied verdict table came from {@link precomputeRecoveryTestVerdicts}. */
1310
+ function isMintedVerdictTable(value) {
1311
+ return value instanceof MintedRequiredTestVerdicts;
1312
+ }
1313
+ /**
1314
+ * The FRONTIER a recovery verdict table describes, as a comparable identity.
1315
+ *
1316
+ * The recovery verb splits into an unlocked phase that runs the required tests
1317
+ * and a locked phase that ingests their verdicts, and it used to bind the two
1318
+ * by HEAD alone. HEAD says the TREE has not moved; it says nothing about whether
1319
+ * the RUN's own state changed underneath those unlocked spawns — and a
1320
+ * concurrent state writer can settle items without touching a single commit.
1321
+ * The verdict table phase 1 computed is keyed on which findings were PENDING
1322
+ * (`precomputeRecoveryTestVerdicts` filters on exactly that), so once the
1323
+ * frontier moves, a command the table no longer covers reads as
1324
+ * `required_test_failed` — a bookkeeping race reported as the host's work being
1325
+ * wrong. Both halves of the comparison degrade safely: a mismatch refuses.
1326
+ *
1327
+ * So the identity carries three things, and each catches a writer the others
1328
+ * cannot:
1329
+ *
1330
+ * - the binding record's own parts (run, baseline, workload digest, item ids),
1331
+ * which the ordinary workload-integrity check would also catch — kept here so
1332
+ * this guard is the one place that says "the frontier moved";
1333
+ * - the sorted set of work items with at least one still-PENDING finding, which
1334
+ * is what the verdict table is actually keyed on. This is the residual's real
1335
+ * shape, and no digest in the state tracks it.
1336
+ *
1337
+ * `null` means "no binding", which is itself a distinct identity: a phase-1
1338
+ * snapshot with no handoff and a phase-2 read that grew one describe different
1339
+ * runs.
1340
+ */
1341
+ export function workloadBindingIdentity(state) {
1342
+ const record = state.host_handoff;
1343
+ if (!record)
1344
+ return null;
1345
+ const pendingWorkItemIds = unresolvedFrontierWorkItemIds(state, record);
1346
+ return JSON.stringify([
1347
+ record.run_id,
1348
+ record.baseline_commit,
1349
+ record.workload_sha256,
1350
+ [...record.work_item_ids].sort(compareCodeUnits),
1351
+ pendingWorkItemIds,
1352
+ ]);
1353
+ }
1354
+ /**
1355
+ * The bound work item ids with at least one finding still `pending`, sorted.
1356
+ *
1357
+ * Derived from the STATE alone — the workload document is not read, because the
1358
+ * caller may be comparing a snapshot whose workload file is no longer on disk
1359
+ * (which is one of the situations this guard exists to refuse). A finding with
1360
+ * no item record is NOT counted: the state is corrupt in that case, and the
1361
+ * ingest's own parse refuses it with a better message than this guard could.
1362
+ */
1363
+ function unresolvedFrontierWorkItemIds(state, record) {
1364
+ const items = state.items;
1365
+ const pendingBlockIds = new Set(Object.values(items)
1366
+ .filter((item) => item?.status === "pending")
1367
+ .map((item) => item.block_id));
1368
+ return [...record.work_item_ids]
1369
+ .filter((id) => pendingBlockIds.has(id))
1370
+ .sort(compareCodeUnits);
1371
+ }
1177
1372
  /**
1178
1373
  * Per-command deadline. A required test is host-authored and may legitimately be
1179
1374
  * a full suite, so the bound is generous; what changed is that hitting it is now
@@ -1186,6 +1381,24 @@ const REQUIRED_TEST_TIMEOUT_MS = 10 * 60 * 1_000;
1186
1381
  * into every rendered issue.
1187
1382
  */
1188
1383
  const CAPTURED_OUTPUT_LIMIT = 4_000;
1384
+ /**
1385
+ * The bound on the MESSAGE a required-test failure produces.
1386
+ *
1387
+ * `CAPTURED_OUTPUT_LIMIT` bounds one STREAM; the message is a different thing —
1388
+ * `requiredTestIssue` joins every failing command, and a work item may bind any
1389
+ * number of them, so the rendered message grew with the number of failures. A
1390
+ * message is a HOST-FACING delivery (it is rendered into the step prompt an
1391
+ * operator reads), so its size cannot be a function of how many commands
1392
+ * happened to fail.
1393
+ *
1394
+ * The bound TRUNCATES the excerpt and says so; it never drops the verdict. What
1395
+ * survives at the front is the part that identifies the failure — the command
1396
+ * and its outcome — and the marker tells the operator the rest was elided and
1397
+ * where to look instead.
1398
+ */
1399
+ export const REQUIRED_TEST_MESSAGE_LIMIT = 8_000;
1400
+ /** The marker that names an elided excerpt, so truncation is never silent. */
1401
+ const REQUIRED_TEST_TRUNCATION_MARKER = "… [excerpt truncated — re-run the command to see the full output]";
1189
1402
  /**
1190
1403
  * The spawn's raw capture buffer. Exceeding it does not truncate — node KILLS
1191
1404
  * the child — so the cap is a named constant the `output_overflow` message can
@@ -1363,6 +1576,13 @@ verdicts) {
1363
1576
  * `required_test_failed`.
1364
1577
  */
1365
1578
  function requiredTestIssue(workItem, failures) {
1579
+ // Bounded at the point the message is BUILT, not left to the caller: the
1580
+ // failure count is a property of the work item's bound commands, so bounding
1581
+ // anywhere downstream would still have carried an unbounded string through
1582
+ // state and into the ledger. See REQUIRED_TEST_MESSAGE_LIMIT.
1583
+ const body = `mechanical required-test rerun failed: ${failures
1584
+ .map(describeRequiredTestFailure)
1585
+ .join("; ")}`;
1366
1586
  return {
1367
1587
  code: failures.some((failure) => failure.outcome === "timed_out")
1368
1588
  ? "required_test_timed_out"
@@ -1372,11 +1592,22 @@ function requiredTestIssue(workItem, failures) {
1372
1592
  check: "test_evidence",
1373
1593
  work_item_id: workItem.id,
1374
1594
  result_path: workItem.result_path,
1375
- message: `mechanical required-test rerun failed: ${failures
1376
- .map(describeRequiredTestFailure)
1377
- .join("; ")}`,
1595
+ message: boundRequiredTestMessage(body),
1378
1596
  };
1379
1597
  }
1598
+ /**
1599
+ * Truncate a required-test failure message to {@link REQUIRED_TEST_MESSAGE_LIMIT},
1600
+ * marking the elision. The head is kept because it is what identifies the
1601
+ * failure — the command and its classified outcome — and the marker replaces
1602
+ * the tail rather than being appended past the cap, so the result is bounded by
1603
+ * construction.
1604
+ */
1605
+ function boundRequiredTestMessage(message) {
1606
+ if (message.length <= REQUIRED_TEST_MESSAGE_LIMIT)
1607
+ return message;
1608
+ const room = REQUIRED_TEST_MESSAGE_LIMIT - REQUIRED_TEST_TRUNCATION_MARKER.length;
1609
+ return `${message.slice(0, room)}${REQUIRED_TEST_TRUNCATION_MARKER}`;
1610
+ }
1380
1611
  /**
1381
1612
  * Run every required-test command a recovery ingest could need, ONCE each, and
1382
1613
  * return the finished verdict table. Call this OUTSIDE the state lock — that is
@@ -1393,7 +1624,7 @@ export async function precomputeRecoveryTestVerdicts(params) {
1393
1624
  if (!state)
1394
1625
  return "unsupported_retired_state";
1395
1626
  const paths = resolveBoundaryPaths(params);
1396
- const verdicts = new Map();
1627
+ const verdicts = new MintedRequiredTestVerdicts();
1397
1628
  const workloadRead = await readSubmissionDocument(paths.workloadPath);
1398
1629
  if (workloadRead.kind !== "value")
1399
1630
  return verdicts;
@@ -1415,7 +1646,7 @@ export async function precomputeRecoveryTestVerdicts(params) {
1415
1646
  }
1416
1647
  }
1417
1648
  for (const command of commands) {
1418
- verdicts.set(requiredTestVerdictKey(paths.root, command), await runRequiredTest(paths.root, command));
1649
+ verdicts.set(requiredTestVerdictKey(paths.root, command), await runRequiredTest(paths.root, command, params.requiredTestTimeoutMs));
1419
1650
  }
1420
1651
  return verdicts;
1421
1652
  }
@@ -1625,6 +1856,16 @@ export async function ingestRemediationHostResults(params) {
1625
1856
  const state = parseCurrentState(params.state);
1626
1857
  if (!state)
1627
1858
  return "unsupported_retired_state";
1859
+ // The verdict table is the ONE input whose validity the type system cannot
1860
+ // check: a hand-built map of all-green verdicts asserts tests ran that never
1861
+ // did. Refuse it up front — before any ledger append, any git probe, and any
1862
+ // acceptance — rather than letting the per-item loop read a fabricated table
1863
+ // as evidence. See MintedRequiredTestVerdicts.
1864
+ if (params.recovery !== undefined &&
1865
+ !isMintedVerdictTable(params.recovery.requiredTestVerdicts)) {
1866
+ throw new Error("recovery.requiredTestVerdicts must come from precomputeRecoveryTestVerdicts: " +
1867
+ "a caller-supplied verdict table asserts required tests ran that no runner produced");
1868
+ }
1628
1869
  const paths = resolveBoundaryPaths(params);
1629
1870
  const nextState = structuredClone(state);
1630
1871
  const validated = await validateHostResultBundle({
@@ -1641,6 +1882,7 @@ export async function ingestRemediationHostResults(params) {
1641
1882
  const acc = {
1642
1883
  issues: validated.issues,
1643
1884
  completed: [],
1885
+ workItemOutcomes: new Map(),
1644
1886
  resultIds: new Set(),
1645
1887
  landedFiles: new Set(nextState.applied_edit_surface ?? []),
1646
1888
  settledFindingIds: new Set(),
@@ -1697,6 +1939,7 @@ async function validateHostResultBundle(input) {
1697
1939
  completed_work_item_ids: [],
1698
1940
  pending_work_item_ids: state.host_handoff?.work_item_ids ?? [],
1699
1941
  issues,
1942
+ work_item_outcomes: new Map(),
1700
1943
  state_changed: false,
1701
1944
  state: nextState,
1702
1945
  },
@@ -1729,6 +1972,7 @@ async function validateHostResultBundle(input) {
1729
1972
  completed_work_item_ids: [],
1730
1973
  pending_work_item_ids: [],
1731
1974
  issues,
1975
+ work_item_outcomes: new Map(),
1732
1976
  state_changed: false,
1733
1977
  state: nextState,
1734
1978
  },
@@ -1751,6 +1995,7 @@ async function validateHostResultBundle(input) {
1751
1995
  completed_work_item_ids: [],
1752
1996
  pending_work_item_ids: state.host_handoff?.work_item_ids ?? [],
1753
1997
  issues,
1998
+ work_item_outcomes: new Map(),
1754
1999
  state_changed: false,
1755
2000
  state: nextState,
1756
2001
  },
@@ -1788,6 +2033,23 @@ async function validateHostResultBundle(input) {
1788
2033
  * for a recovery acceptance still goes down before that item's verdict is
1789
2034
  * emitted, so no acceptance can outrun its record.
1790
2035
  */
2036
+ /**
2037
+ * Did a corroborated commit already land for this work item, even though no
2038
+ * result file is at its bound path?
2039
+ *
2040
+ * Ground truth, not a claim: `host_landed_commit` is written only after
2041
+ * `corroborateHostResult` verified the commit resolves, is reachable from HEAD,
2042
+ * and that its mechanically derived diff equals the result's `changed_files`
2043
+ * within the item's write scope. Anything less is not a landing.
2044
+ *
2045
+ * ANY finding of the item counts, because the commit is attributed per FINDING
2046
+ * and a work item is a bundle of them: a commit for one of its findings is work
2047
+ * this item did, which is exactly what the host needs to know before rewriting
2048
+ * the result from scratch.
2049
+ */
2050
+ function hasLandedCommitFor(state, workItem) {
2051
+ return workItem.finding_ids.some((findingId) => typeof state.items[findingId]?.host_landed_commit === "string");
2052
+ }
1791
2053
  async function executeHostVerificationReruns(ctx, acc) {
1792
2054
  const { paths, nextState, state } = ctx;
1793
2055
  const verdicts = [];
@@ -1822,6 +2084,23 @@ async function executeHostVerificationReruns(ctx, acc) {
1822
2084
  });
1823
2085
  if (!scan.ok) {
1824
2086
  acc.issues.push(scan.issue);
2087
+ // A refusal is a REFUSAL — unless the refusal is "nothing is there", in
2088
+ // which case it says nothing about whether the host did the work. The run
2089
+ // holds a CORROBORATED commit for a settled item (see
2090
+ // `RemediationItemState.host_landed_commit`), and an item whose edits
2091
+ // landed but whose result is missing is PARTIAL PROGRESS the host must be
2092
+ // told about; it used to disappear as a bare missing-result line.
2093
+ // THREE-WAY, not two. "Nothing is at the bound path" is an OBSERVATION,
2094
+ // and it splits again on whether the run holds a corroborated commit for
2095
+ // this item: with one it is partial progress, without one it is simply
2096
+ // unfinished work. Only a REFUSAL of something that WAS written is
2097
+ // `rejected`. Collapsing the missing half into `rejected` would restore
2098
+ // exactly the conflation this split exists to end.
2099
+ acc.workItemOutcomes.set(workItem.id, !isMissingObservation(scan.issue)
2100
+ ? "rejected"
2101
+ : hasLandedCommitFor(nextState, workItem)
2102
+ ? "missing_result_with_commit"
2103
+ : "awaiting_result");
1825
2104
  continue;
1826
2105
  }
1827
2106
  const parsed = scan.parsed;
@@ -1921,13 +2200,12 @@ async function executeHostVerificationReruns(ctx, acc) {
1921
2200
  // (run, item): an item re-opened and later re-accepted from a
1922
2201
  // DIFFERENT landing is a different relaxed acceptance and earns its
1923
2202
  // own record. Only a retry of the SAME landing is a duplicate. The
1924
- // landed sha is matched inside the message because the shared event
1925
- // contract carries no commit field, and a 40-hex sha this writer
1926
- // itself emitted is an unambiguous token to match on.
2203
+ // landed commit is carried on the event as `landed_commit` and read
2204
+ // back through `recoveryMarkMatches` — prose is not an identity, and a
2205
+ // message reworded by any later edit silently un-deduped the mark.
1927
2206
  const landedCommit = result.commit_evidence.after;
1928
2207
  const alreadyMarked = acc.recordedRecoveryMarks.some((event) => event.run_id === ctx.runId &&
1929
- event.submission_id === workItem.id &&
1930
- (event.message ?? "").includes(landedCommit));
2208
+ recoveryMarkMatches(event, workItem.id, landedCommit));
1931
2209
  if (!alreadyMarked) {
1932
2210
  const event = {
1933
2211
  contract_version: SUBMISSION_LEDGER_EVENT_CONTRACT_VERSION,
@@ -1935,6 +2213,10 @@ async function executeHostVerificationReruns(ctx, acc) {
1935
2213
  submission_id: workItem.id,
1936
2214
  lane: workItem.id,
1937
2215
  kind: "accepted_via_recovery",
2216
+ // The structured half of this event's identity, beside the prose
2217
+ // that narrates it. `recoveryMarkMatches` reads THIS, never the
2218
+ // message below.
2219
+ landed_commit: landedCommit,
1938
2220
  // Derived from what was actually probed, never asserted: the
1939
2221
  // baseline was found in no ref and unreachable from HEAD.
1940
2222
  message: `accepted under recovery: the trusted baseline ${workItem.baseline_commit} is ` +
@@ -1965,6 +2247,8 @@ async function executeHostVerificationReruns(ctx, acc) {
1965
2247
  workItem,
1966
2248
  pendingItems,
1967
2249
  at: new Date().toISOString(),
2250
+ landedCommit: result.commit_evidence.after,
2251
+ changedFiles: corroborated.changedFiles,
1968
2252
  });
1969
2253
  for (const changedFile of corroborated.changedFiles) {
1970
2254
  acc.landedFiles.add(changedFile);
@@ -2024,6 +2308,13 @@ function commitRemediationStateUpdates(ctx, acc, verdicts, issues) {
2024
2308
  item.status = "resolved";
2025
2309
  item.started_at ??= verdict.at;
2026
2310
  item.completed_at = verdict.at;
2311
+ // The corroborated outcome is PERSISTED per item, not just folded into the
2312
+ // run-wide `applied_edit_surface`, so the attribution survives the process
2313
+ // that observed it — and read back by `hasLandedCommitFor` on the next
2314
+ // ingest, which is how an item whose edits landed but whose result file
2315
+ // never arrived is told apart from one that was never attempted.
2316
+ item.host_landed_commit = verdict.landedCommit;
2317
+ item.host_landed_files = [...verdict.changedFiles];
2027
2318
  delete item.failure_reason;
2028
2319
  delete item.host_result_evidence;
2029
2320
  }
@@ -2040,11 +2331,20 @@ function commitRemediationStateUpdates(ctx, acc, verdicts, issues) {
2040
2331
  delete nextState.host_handoff;
2041
2332
  stateChanged = true;
2042
2333
  }
2334
+ // Every remaining work item is `awaiting_result` unless the verify loop
2335
+ // already classified it: an item the loop never reached (a sibling's refusal
2336
+ // ended the pass early) is still genuinely unread, and "not read" is the
2337
+ // honest answer there — never a claim that something was refused.
2338
+ const workItemOutcomes = new Map();
2339
+ for (const workItem of ctx.effectiveWorkload.work_items) {
2340
+ workItemOutcomes.set(workItem.id, acc.workItemOutcomes.get(workItem.id) ?? "awaiting_result");
2341
+ }
2043
2342
  return {
2044
2343
  accepted_count: acc.completed.length,
2045
2344
  completed_work_item_ids: acc.completed,
2046
2345
  pending_work_item_ids: pendingWorkItemIds,
2047
2346
  issues,
2347
+ work_item_outcomes: workItemOutcomes,
2048
2348
  state_changed: stateChanged,
2049
2349
  state: nextState,
2050
2350
  };