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,3 +1,4 @@
1
+ // sites-pinned: tests/audit/next-step-helpers.test.ts, tests/audit/charter-emit-order.test.ts, tests/audit/executor-registry-sync.test.ts, tests/audit/pipeline-integration.test.ts
1
2
  /**
2
3
  * Extracted helpers for the next-step command.
3
4
  *
@@ -8,14 +9,14 @@
8
9
  import { randomUUID } from "node:crypto";
9
10
  import { mkdir, readFile, unlink } from "node:fs/promises";
10
11
  import { join, relative } from "node:path";
11
- import { advance, describeStoppedFold, RunLogger, compareCodeUnits, hashContent, isFileMissingError, isJsonParseError, isRecord, readJsonFile, readTrailingSubmissionRefusals, persistAnalyzerConsent, persistAnalyzerSettings, writeJsonFile, } from "audit-tools/shared";
12
+ import { advance, describeStoppedFold, RunLogger, compareCodeUnits, hashContent, isFileMissingError, isJsonParseError, isMissingObservation, isRecord, readJsonFile, readSubmissionIngestHistory, readTrailingSubmissionRefusals, persistAnalyzerConsent, persistAnalyzerSettings, writeJsonFile, } from "audit-tools/shared";
12
13
  import { loadArtifactBundle, promoteFinalAuditReport, } from "../io/artifacts.js";
13
14
  import { auditReportPath, groundDesignFindings, laneAssetsDir, promotedAuditReportPath, } from "audit-tools/shared";
14
15
  import { charterExtractionKindsForCeiling } from "./charterExtractionPrompt.js";
15
16
  import { archiveCharterPackets } from "../orchestrator/charterPacketArchive.js";
16
17
  import { LANE_SUBMISSION_SCHEMAS, charterLaneSchema, describeSubmissionShapeMismatch, unwrapSubmissionArray, } from "./laneValidators.js";
17
- import { ConceptualJudgeSubmissionSchema, buildConceptualReviewAdjudication, deriveConceptualVerificationStatus, loadConceptualPerspectiveFindings, MalformedConceptualPerspectivesError, readConceptualReviewRoundManifest, } from "../types/conceptualAdjudication.js";
18
- import { advanceAudit, engineMaxTransitions, findExecutorFailure, runSingleAdvanceStep, MAX_DRAIN_STEPS, } from "../orchestrator/advance.js";
18
+ import { ConceptualJudgeSubmissionSchema, buildConceptualReviewAdjudication, deriveConceptualVerificationStatus, loadConceptualPerspectiveFindings, MalformedConceptualPerspectivesError, readConceptualReviewRoundManifest, suppliedToolVerdictIssue, } from "../types/conceptualAdjudication.js";
19
+ import { advanceAudit, engineMaxTransitions, findExecutorFailure, runSingleAdvanceStep, startAdvanceHeartbeat, MAX_DRAIN_STEPS, } from "../orchestrator/advance.js";
19
20
  import { buildDesignReviewSnapshot, isDesignReviewStale, } from "../orchestrator/designReviewSnapshot.js";
20
21
  import { computeStaleArtifacts, emitStalenessRecord, isMetadataMigrationStaleness, resetStalenessDedup, } from "../orchestrator/staleness.js";
21
22
  import { commitFold, createFoldTransaction, markSubmissionApplied, describeQuarantineLocation, quarantineLocationPhrase, quarantineSubmissionFile, quarantineSurvivalNote, recoverStagedSubmissions, stageLaneSubmission, } from "./foldTransaction.js";
@@ -99,7 +100,8 @@ const NEXT_STEP_RETURN_KIND_TABLE = {
99
100
  design_review_contract: true,
100
101
  design_review_conceptual: true,
101
102
  charter_extraction: true,
102
- charter_delta: true,
103
+ charter_comparison: true,
104
+ charter_fidelity: true,
103
105
  charter_clarification: true,
104
106
  systemic_challenge: true,
105
107
  confirm_intent: true,
@@ -408,7 +410,10 @@ export async function handleGraphEnrichmentBranch(params, bundle, state, analyze
408
410
  * - `design_review_contract` → only contract pass still needed.
409
411
  * - `design_review_conceptual` → only conceptual pass still needed.
410
412
  *
411
- * Also handles legacy `design-review-findings.json` for backward compatibility.
413
+ * Exactly these two passes exist. The pre-split combined submission
414
+ * (`design-review-findings.json`) is retired: it is neither polled here nor
415
+ * translated anywhere, and a pre-split directory is re-asked for both current
416
+ * passes (see `orchestrator/state.ts`).
412
417
  */
413
418
  /** Whether a completed design-review pass has gone stale vs. its snapshot. */
414
419
  function passIsStale(bundle, pass) {
@@ -573,6 +578,23 @@ async function consumeConceptualSubmission(artifactsDir, tx) {
573
578
  if (incoming.status === "quarantined") {
574
579
  return { ...incoming, lane };
575
580
  }
581
+ // BEFORE the schema parse, deliberately. The schema omits
582
+ // `verification_status` from every submitted finding, so a supplied value is
583
+ // stripped SILENTLY by the parse below — and the check that names the field
584
+ // lived only inside `buildConceptualReviewAdjudication`, which is reached with
585
+ // the ALREADY-PARSED submission. It therefore never fired here, and a judge
586
+ // could supply the field this whole vocabulary derives and be told nothing.
587
+ // Refusing it at the gate is what makes the naming reach the production path.
588
+ const suppliedStatus = suppliedToolVerdictIssue(incoming.value);
589
+ if (suppliedStatus !== null) {
590
+ const quarantinePath = await quarantineMisshapedSubmission(artifactsDir, incoming.path, lane, suppliedStatus);
591
+ return {
592
+ status: "quarantined",
593
+ quarantinePath,
594
+ lane,
595
+ reason: suppliedStatus,
596
+ };
597
+ }
576
598
  const parsed = ConceptualJudgeSubmissionSchema.safeParse(incoming.value);
577
599
  if (!parsed.success) {
578
600
  const quarantinePath = await quarantineMisshapedSubmission(artifactsDir, incoming.path, lane, parsed.error);
@@ -606,9 +628,19 @@ async function consumeConceptualSubmission(artifactsDir, tx) {
606
628
  generatedAt: new Date().toISOString(),
607
629
  });
608
630
  const refusals = await readTrailingSubmissionRefusals(artifactsDir, manifest.perspectives.map((p) => laneSubmissionId(p.lane_id)), { runId: AUDIT_GATE_SUBMISSION_SCOPE });
631
+ // ONE ledger read for this batch. `readTrailingSubmissionRefusals` above
632
+ // already paid for a scan; reusing ITS map as the accepted-history view
633
+ // would be wrong (it holds refusals, not acceptances) and re-reading per
634
+ // perspective would scan the ledger once per lane. So the shared view is
635
+ // taken here, and the refusal question above keeps its own reader — the two
636
+ // ask different questions and a single scan answering both would have to
637
+ // reimplement each.
638
+ const perspectiveHistory = await readSubmissionIngestHistory(artifactsDir, {
639
+ runId: AUDIT_GATE_SUBMISSION_SCOPE,
640
+ });
609
641
  for (const perspective of manifest.perspectives) {
610
642
  if (refusals.has(laneSubmissionId(perspective.lane_id))) {
611
- await recordLaneOutcome(artifactsDir, perspective.lane_id, { kind: "accepted" });
643
+ await recordLaneOutcome(artifactsDir, perspective.lane_id, { kind: "accepted" }, perspectiveHistory);
612
644
  }
613
645
  }
614
646
  // THE observation boundary for this round's perspective lanes. The tool
@@ -825,7 +857,7 @@ export async function handleDesignReviewBranch(params, bundle, state, tx) {
825
857
  if (consumed) {
826
858
  // A review changes the assessment's content, not its structural baseline.
827
859
  // Only a newly produced adjudication may bind the new assessment revision;
828
- // a contract/legacy update must leave an older adjudication stale.
860
+ // a contract-only update must leave an older adjudication stale.
829
861
  next.artifact_metadata = computeArtifactMetadata(next, bundle.artifact_metadata, conceptualAdjudication !== undefined && conceptualAdjudication !== bundle.conceptual_review_adjudication
830
862
  ? ["conceptual_review_adjudication.json"]
831
863
  : []);
@@ -867,32 +899,15 @@ export async function handleDesignReviewBranch(params, bundle, state, tx) {
867
899
  reason,
868
900
  }) ?? assessment;
869
901
  };
870
- // Legacy: consume the old combined findings submission. Tolerant-unwrap or
871
- // quarantine (never a bare unconditional delete) — see the block comment above.
872
- const legacyResult = await consumeArraySubmission(params.artifactsDir, GATE_LANES.design_review_legacy, tx);
873
- if (legacyResult.status === "quarantined") {
874
- assessment =
875
- withRejectedDesignReviewSubmission(assessment, "legacy", legacyResult) ??
876
- assessment;
877
- return { action: "continue", bundle: carried() };
878
- }
879
- if (legacyResult.status === "ok") {
880
- if (assessment) {
881
- assessment = {
882
- ...assessment,
883
- review_findings: groundDesignFindings(legacyResult.value, bundle.repo_manifest),
884
- reviewed: true,
885
- rejected_submissions: (assessment.rejected_submissions ?? []).filter((r) => r.pass !== "legacy"),
886
- };
887
- consumed = true;
888
- markSubmissionApplied(tx, legacyResult.path);
889
- return { action: "continue", bundle: carried() };
890
- }
891
- await holdWithoutTarget("legacy", GATE_LANES.design_review_legacy, legacyResult.path);
892
- return { action: "continue", bundle: carried() };
893
- }
894
- // absent: fall through to the contract/conceptual check.
895
- // New: consume contract-findings and/or conceptual-findings independently.
902
+ // Only the two CURRENT passes are polled. The pre-split combined-findings lane
903
+ // (`design_review_legacy`) was retired: it was a third judgment type that no
904
+ // longer corresponds to anything the tool emits, and leaving it polled meant a
905
+ // directory written by the pre-split release kept satisfying a pass the modern
906
+ // tool never asked for. A resumed pre-split run now leaves BOTH modern
907
+ // obligations unmet and is re-asked for each pass in its current shape — never
908
+ // translated from the old lane. See the invalidation at load —
909
+ // `designReviewPassState` in `orchestrator/state.ts`, which reads only the two
910
+ // modern per-pass flags and never the retired combined one.
896
911
  const contractResult = await consumeArraySubmission(params.artifactsDir, GATE_LANES.design_review_contract, tx);
897
912
  const conceptualResult = await consumeConceptualSubmission(params.artifactsDir, tx);
898
913
  if (contractResult.status === "quarantined") {
@@ -1036,6 +1051,7 @@ export async function handleSynthesisNarrativeBranch(params, bundle, state, tx)
1036
1051
  artifactsDir: p.artifactsDir,
1037
1052
  preferredExecutor: "synthesis_narrative_executor",
1038
1053
  narrativeResultsPath: path,
1054
+ scopeIndexMemo: p.scopeIndexMemo,
1039
1055
  }, foldBundle),
1040
1056
  // Narrative disabled: omit (run the deterministic omit executor below).
1041
1057
  // Single-sourced with the plan draw's classifier (obligationPolicy.ts).
@@ -1068,6 +1084,7 @@ export async function handleIntentEquivalenceBranch(params, bundle, state, tx) {
1068
1084
  artifactsDir: params.artifactsDir,
1069
1085
  preferredExecutor: "intent_equivalence_executor",
1070
1086
  intentEquivalenceVerdictPath: incoming.path,
1087
+ scopeIndexMemo: params.scopeIndexMemo,
1071
1088
  }, bundle);
1072
1089
  markSubmissionApplied(tx, incoming.path);
1073
1090
  return { action: "continue", bundle: applied.updated_bundle };
@@ -1103,6 +1120,7 @@ export async function handleCriticalFlowFallbackBranch(params, bundle, state, tx
1103
1120
  artifactsDir: p.artifactsDir,
1104
1121
  preferredExecutor: "critical_flow_fallback_executor",
1105
1122
  criticalFlowFallbackResultsPath: path,
1123
+ scopeIndexMemo: p.scopeIndexMemo,
1106
1124
  }, foldBundle),
1107
1125
  // Never omit: the obligation is only reached when the deterministic bar
1108
1126
  // failed, and the host is always available to author the enrichment.
@@ -1127,16 +1145,15 @@ export async function handleCharterExtractionBranch(params, bundle, state, tx) {
1127
1145
  if (charterExtractionOmits(bundle)) {
1128
1146
  return { action: "run_omit" };
1129
1147
  }
1130
- // Per-kind blind lanes (design resolution 2): one submission file per kind,
1131
- // each validated at THIS chokepoint — schema shape + kind purity (a lane may
1132
- // only carry its own kind; anything else is a mis-routed submission) + scope
1133
- // grounding (design resolution 4: every teleology node's file scope must be
1134
- // repo paths — a lane citing files the repo does not contain is refused
1135
- // whole, naming them, never silently narrowed). An invalid lane is
1136
- // quarantined loudly and the step re-emits naming it; valid lanes stay on
1137
- // disk untouched (K-of-N resume), and only when EVERY lane is present and
1138
- // valid does the tool merge them into the single submission the executor
1139
- // ingests (`assembleCharters` joins teleologies by file-set overlap).
1148
+ // Per-kind blind lanes (design resolution 2): one goal-DAG submission file per
1149
+ // kind, each validated at THIS chokepoint — schema shape + kind purity (a lane
1150
+ // may only carry its own kind; anything else is a mis-routed submission). An
1151
+ // invalid lane is quarantined loudly and the step re-emits naming it; valid
1152
+ // lanes stay on disk untouched (K-of-N resume), and only when EVERY lane is
1153
+ // present and valid does the tool merge them into the single submission the
1154
+ // executor ingests (`assembleLaneGraph` per lane: cycles refused, levels
1155
+ // derived, scopes grounded against the repo universe with every unknown file
1156
+ // named — never silently narrowed).
1140
1157
  const kinds = charterExtractionKindsForCeiling(ceiling);
1141
1158
  const universe = new Set((bundle.repo_manifest?.files ?? []).map((file) => file.path));
1142
1159
  const laneValues = new Map();
@@ -1172,7 +1189,7 @@ export async function handleCharterExtractionBranch(params, bundle, state, tx) {
1172
1189
  // would make a later staleness-triggered re-extraction read them as fresh
1173
1190
  // results and silently skip re-authoring.
1174
1191
  const merged = {
1175
- nodes: kinds.flatMap((kind) => laneValues.get(kind).value.nodes),
1192
+ lanes: kinds.map((kind) => laneValues.get(kind).value),
1176
1193
  };
1177
1194
  // The merged submission is TOOL-written, so it lives with the other lane
1178
1195
  // assets rather than under `submissions/` (which holds only what a host
@@ -1184,6 +1201,7 @@ export async function handleCharterExtractionBranch(params, bundle, state, tx) {
1184
1201
  artifactsDir: params.artifactsDir,
1185
1202
  preferredExecutor: "charter_extraction_executor",
1186
1203
  charterSubmissionPath: mergedPath,
1204
+ scopeIndexMemo: params.scopeIndexMemo,
1187
1205
  }, bundle);
1188
1206
  await unlink(mergedPath).catch(() => { });
1189
1207
  for (const lane of laneValues.values()) {
@@ -1216,30 +1234,47 @@ export async function handleCharterExtractionBranch(params, bundle, state, tx) {
1216
1234
  return { action: "return", result: { kind: "charter_extraction", state, bundle } };
1217
1235
  }
1218
1236
  /**
1219
- * Handle the `charter_delta_executor` submission-polling block (Phase C.2 —
1220
- * the INDEPENDENT delta-miner). Mirrors the charter-extraction branch:
1221
- * - a pending `charter_delta` lane submission → route+gate it via the preferred
1222
- * executor (ingest), then `continue`;
1223
- * - otherwise, when the register is NOT `deltas_pending` (extraction omitted, or
1224
- * found no subsystems to mine) → `run_omit` (the deterministic executor settles
1225
- * the register — no host turn);
1226
- * - a `deltas_pending` register with no submission yet → `return` the host step
1227
- * that renders the charter-delta prompt for the independent miner.
1237
+ * Handle the `charter_comparison_executor` submission-polling block (steps 2–3
1238
+ * — the comparison reader). Mirrors the charter-extraction branch:
1239
+ * - a pending `charter_comparison` lane submission → assemble + pre-check it
1240
+ * via the preferred executor (ingest), then `continue`;
1241
+ * - otherwise, when the register is NOT `comparison_pending` → `run_omit`;
1242
+ * - a `comparison_pending` register with no submission yet → `return` the host
1243
+ * step that renders the comparison prompt.
1244
+ */
1245
+ export async function handleCharterComparisonBranch(params, bundle, state, tx) {
1246
+ return runOmittableGate({
1247
+ kind: "charter_comparison",
1248
+ lane: GATE_LANES.charter_comparison,
1249
+ schema: LANE_SUBMISSION_SCHEMAS[GATE_LANES.charter_comparison],
1250
+ apply: (_value, path, p, foldBundle) => runAuditStepUnlocked({
1251
+ root: p.root,
1252
+ artifactsDir: p.artifactsDir,
1253
+ preferredExecutor: "charter_comparison_executor",
1254
+ charterComparisonSubmissionPath: path,
1255
+ scopeIndexMemo: p.scopeIndexMemo,
1256
+ }, foldBundle),
1257
+ shouldOmit: (b) => !(b.charter_register?.comparison_pending === true),
1258
+ }, params, bundle, state, tx);
1259
+ }
1260
+ /**
1261
+ * Handle the `charter_fidelity_executor` submission-polling block (step 4 — the
1262
+ * separate fidelity lane). Same three arms as the comparison branch, keyed on
1263
+ * `fidelity_pending`.
1228
1264
  */
1229
- export async function handleCharterDeltaBranch(params, bundle, state, tx) {
1265
+ export async function handleCharterFidelityBranch(params, bundle, state, tx) {
1230
1266
  return runOmittableGate({
1231
- kind: "charter_delta",
1232
- lane: GATE_LANES.charter_delta,
1233
- schema: LANE_SUBMISSION_SCHEMAS[GATE_LANES.charter_delta],
1267
+ kind: "charter_fidelity",
1268
+ lane: GATE_LANES.charter_fidelity,
1269
+ schema: LANE_SUBMISSION_SCHEMAS[GATE_LANES.charter_fidelity],
1234
1270
  apply: (_value, path, p, foldBundle) => runAuditStepUnlocked({
1235
1271
  root: p.root,
1236
1272
  artifactsDir: p.artifactsDir,
1237
- preferredExecutor: "charter_delta_executor",
1238
- charterDeltaSubmissionPath: path,
1273
+ preferredExecutor: "charter_fidelity_executor",
1274
+ charterFidelitySubmissionPath: path,
1275
+ scopeIndexMemo: p.scopeIndexMemo,
1239
1276
  }, foldBundle),
1240
- // Nothing to mine (extraction omitted or no subsystems): settle
1241
- // deterministically, no host turn.
1242
- shouldOmit: (b) => !(b.charter_register?.deltas_pending === true),
1277
+ shouldOmit: (b) => !(b.charter_register?.fidelity_pending === true),
1243
1278
  }, params, bundle, state, tx);
1244
1279
  }
1245
1280
  /**
@@ -1266,6 +1301,7 @@ export async function handleCharterClarificationBranch(params, bundle, state, tx
1266
1301
  artifactsDir: p.artifactsDir,
1267
1302
  preferredExecutor: "charter_clarification_executor",
1268
1303
  clarificationAnswersPath: path,
1304
+ scopeIndexMemo: p.scopeIndexMemo,
1269
1305
  }, foldBundle),
1270
1306
  // The omit predicate is single-sourced with the plan draw's classifier
1271
1307
  // (obligationPolicy.ts) — the two draws must agree on the boundary.
@@ -1302,6 +1338,7 @@ export async function handleSystemicChallengeBranch(params, bundle, state, tx) {
1302
1338
  systemicChallengeSubmissionHash: staged.contentHash === undefined
1303
1339
  ? undefined
1304
1340
  : hashContent(`${lane}\n${staged.contentHash}`),
1341
+ scopeIndexMemo: p.scopeIndexMemo,
1305
1342
  }, foldBundle),
1306
1343
  // Single-sourced with the plan draw's classifier (obligationPolicy.ts).
1307
1344
  shouldOmit: systemicChallengeOmits,
@@ -1345,6 +1382,8 @@ export async function executeAndRecord(params, analyzers, decision, index, lastS
1345
1382
  since: params.since,
1346
1383
  lineIndex: indexes.lineIndex,
1347
1384
  sizeIndex: indexes.sizeIndex,
1385
+ // ONE git-index probe per fold (see `ScopeIndexMemo`).
1386
+ scopeIndexMemo: params.scopeIndexMemo,
1348
1387
  });
1349
1388
  await writeJsonFile(join(params.artifactsDir, "steps", "deterministic-progress.json"), {
1350
1389
  iteration: index + 1,
@@ -1514,10 +1553,68 @@ export async function checkFinalizationCycle(ctx) {
1514
1553
  "obligations are erroneously invalidating each other.",
1515
1554
  };
1516
1555
  }
1517
- const EMPTY_FOLD_ADVISORIES = {
1518
- ingestIssues: [],
1519
- validationWarnings: [],
1520
- };
1556
+ /**
1557
+ * A FRESH empty carry — a factory, never a shared constant. The carry is
1558
+ * MUTATED in place (`mergeFoldAdvisoriesInto` appends to both arrays), so two
1559
+ * holders that received the same object would alias: the persistent carry is
1560
+ * read as `emptyFoldAdvisories()`, merged into, and persisted, and a shared
1561
+ * constant would mean the "empty" sentinel itself grew the advisories — after
1562
+ * which every `writePendingAdvisories(emptyFoldAdvisories())` call is no longer
1563
+ * empty, stops deleting the file, and re-states the advisory on EVERY later
1564
+ * emission. That is not hypothetical: it is what a shallow spread of the
1565
+ * constant did, and it turned the once-only property into once-per-emission.
1566
+ */
1567
+ function emptyFoldAdvisories() {
1568
+ return { ingestIssues: [], validationWarnings: [] };
1569
+ }
1570
+ /** `<artifactsDir>/steps/pending-advisories.json` — the drainable prompt carry. */
1571
+ function pendingAdvisoriesPath(artifactsDir) {
1572
+ return join(artifactsDir, "steps", "pending-advisories.json");
1573
+ }
1574
+ /**
1575
+ * Read the persisted carry. Lenient by design: an absent or unreadable file is
1576
+ * an empty carry, because this is a PROMPT convenience over a ledger that
1577
+ * remains authoritative — a bookkeeping file must never be able to fail the
1578
+ * call it decorates. Shape-checked rather than schema-parsed for the same
1579
+ * reason: unrecognized entries are dropped, never thrown on.
1580
+ */
1581
+ async function readPendingAdvisories(artifactsDir) {
1582
+ let raw;
1583
+ try {
1584
+ raw = JSON.parse(await readFile(pendingAdvisoriesPath(artifactsDir), "utf8"));
1585
+ }
1586
+ catch {
1587
+ return emptyFoldAdvisories();
1588
+ }
1589
+ if (!isRecord(raw))
1590
+ return emptyFoldAdvisories();
1591
+ const take = (value) => (Array.isArray(value) ? value : []);
1592
+ return {
1593
+ ingestIssues: take(raw.ingestIssues),
1594
+ validationWarnings: take(raw.validationWarnings),
1595
+ };
1596
+ }
1597
+ /**
1598
+ * Persist the carry, or DELETE it when empty. Deleting rather than writing an
1599
+ * empty object is what keeps presence a signal: a later fold reads "nothing
1600
+ * pending" from absence, and no reader has to distinguish `[]` from "not yet
1601
+ * written".
1602
+ */
1603
+ async function writePendingAdvisories(artifactsDir, advisories) {
1604
+ const path = pendingAdvisoriesPath(artifactsDir);
1605
+ if (advisories.ingestIssues.length === 0 &&
1606
+ advisories.validationWarnings.length === 0) {
1607
+ try {
1608
+ await unlink(path);
1609
+ }
1610
+ catch (error) {
1611
+ if (!isFileMissingError(error))
1612
+ throw error;
1613
+ }
1614
+ return;
1615
+ }
1616
+ await writeJsonFile(path, advisories);
1617
+ }
1521
1618
  /**
1522
1619
  * Append one fold iteration's advisories to the pending carry. Dedupe by
1523
1620
  * identity signature keeps an issue the SAME ingest re-classifies on a later
@@ -1540,16 +1637,20 @@ function mergeFoldAdvisoriesInto(carried, fresh) {
1540
1637
  carried.validationWarnings.push(warning);
1541
1638
  }
1542
1639
  }
1543
- /** Drain the carry: what the NEXT emission must state, now consumed. */
1544
- function takeFoldAdvisories(ref) {
1640
+ /**
1641
+ * Drain the carry: what the NEXT emission must state, now consumed. Clears the
1642
+ * in-memory ref AND the persisted copy TOGETHER, so the once-only property holds
1643
+ * across a call boundary exactly as it does within one call — a ref cleared
1644
+ * without the file would re-state on the next call, and a file left behind after
1645
+ * a render would do the same.
1646
+ */
1647
+ async function takeFoldAdvisories(artifactsDir, ref) {
1545
1648
  const taken = {
1546
1649
  ingestIssues: ref.value.ingestIssues,
1547
1650
  validationWarnings: ref.value.validationWarnings,
1548
1651
  };
1549
- ref.value = {
1550
- ingestIssues: [...EMPTY_FOLD_ADVISORIES.ingestIssues],
1551
- validationWarnings: [...EMPTY_FOLD_ADVISORIES.validationWarnings],
1552
- };
1652
+ ref.value = emptyFoldAdvisories();
1653
+ await writePendingAdvisories(artifactsDir, emptyFoldAdvisories());
1553
1654
  return taken;
1554
1655
  }
1555
1656
  /** Content identity of one advisory, across both channels. */
@@ -1738,12 +1839,24 @@ export function buildAuditObligations() {
1738
1839
  }
1739
1840
  return { kind: "transition", state: branch.bundle };
1740
1841
  },
1741
- // Charter delta-mining (Phase C.2): consume the delta lane submission,
1742
- // settle deterministically when the register is not deltas_pending, or
1743
- // emit the independent delta-miner's host step.
1744
- charter_delta_current: async (bundle, ctx) => {
1842
+ // Charter comparison (steps 2–3): consume the comparison submission, settle
1843
+ // deterministically when the register is not comparison_pending, or emit the
1844
+ // comparison reader's host step.
1845
+ charter_comparison_current: async (bundle, ctx) => {
1745
1846
  const state = deriveAuditState(bundle, { emitStaleness: false });
1746
- const branch = await handleCharterDeltaBranch(ctx.params, bundle, state, ctx.tx);
1847
+ const branch = await handleCharterComparisonBranch(ctx.params, bundle, state, ctx.tx);
1848
+ if (branch.action === "return") {
1849
+ return { kind: "emit", step: branch.result, state: bundle };
1850
+ }
1851
+ if (branch.action === "run_omit") {
1852
+ return runDeterministicExecutor(bundle, ctx);
1853
+ }
1854
+ return { kind: "transition", state: branch.bundle };
1855
+ },
1856
+ // Charter fidelity (step 4): the separate lane's verdicts, or the settle.
1857
+ charter_fidelity_current: async (bundle, ctx) => {
1858
+ const state = deriveAuditState(bundle, { emitStaleness: false });
1859
+ const branch = await handleCharterFidelityBranch(ctx.params, bundle, state, ctx.tx);
1747
1860
  if (branch.action === "return") {
1748
1861
  return { kind: "emit", step: branch.result, state: bundle };
1749
1862
  }
@@ -1878,7 +1991,16 @@ async function runHostDelegationObligation(bundle, ctx) {
1878
1991
  }
1879
1992
  catch (error) {
1880
1993
  // No handoff exists on the first visit, or prepare was interrupted before
1881
- // all binding artifacts landed. Re-preparing below restores it exactly.
1994
+ // all binding artifacts landed. Re-preparing below restores it exactly:
1995
+ // the prepare writes the workload, result map and binding set together,
1996
+ // so a partial trio is overwritten whole.
1997
+ //
1998
+ // A STALE binding set is deliberately NOT in this class and must not be
1999
+ // added to it: the ingest already classifies it and returns an issue
2000
+ // WITHOUT throwing (see `StaleAuditHostTaskBindingsError`), precisely so
2001
+ // the fold reaches the re-prepare below instead of aborting here. An
2002
+ // error that arrives at this line was not classified by the ingest, and
2003
+ // swallowing it would turn an unreadable handoff into a silent one.
1882
2004
  if (!isFileMissingError(error))
1883
2005
  throw error;
1884
2006
  }
@@ -1913,15 +2035,20 @@ async function runHostDelegationObligation(bundle, ctx) {
1913
2035
  issues: ingestIssues,
1914
2036
  validationWarnings,
1915
2037
  });
2038
+ // PERSIST with the merge, not at the emission: the transition below can
2039
+ // end the call (the budget cap), and an emission-only write would lose
2040
+ // exactly the advisory a call-ending transition produced — the case this
2041
+ // carry exists to cover.
2042
+ await writePendingAdvisories(ctx.params.artifactsDir, ctx.foldAdvisoriesRef.value);
1916
2043
  return { kind: "transition", state: ingested.updated_bundle };
1917
2044
  }
1918
2045
  }
1919
2046
  // The UNLOCKED variant: the fold already holds the artifact-tree lock, and
1920
- // `withFileLock` is non-reentrant — the locking `ensureSemanticReviewRun`
1921
- // here would be a deterministic FileLockTimeoutError on the audit loop's
1922
- // most common exit path. Its blocked core state rides the emit's `state`
1923
- // below, so the fold's single commit persists it (the pause's own persist
1924
- // was the split's other half).
2047
+ // `withFileLock` is non-reentrant — taking the artifact-tree hold here would
2048
+ // be a deterministic FileLockTimeoutError on the audit loop's most common
2049
+ // exit path. Its blocked core state rides the emit's `state` below, so the
2050
+ // fold's single commit persists it (the pause's own persist was the split's
2051
+ // other half).
1925
2052
  const review = await ensureSemanticReviewRunUnlocked({
1926
2053
  root: ctx.params.root,
1927
2054
  artifactsDir: ctx.params.artifactsDir,
@@ -1931,37 +2058,89 @@ async function runHostDelegationObligation(bundle, ctx) {
1931
2058
  selfCliPath: ctx.params.selfCliPath,
1932
2059
  timeoutMs: ctx.params.timeoutMs,
1933
2060
  });
1934
- // Consume whatever earlier fold iterations of THIS call carried: each
1935
- // advisory is stated on exactly one emitted step (never duplicated on later
1936
- // folds), and an emit with nothing carried renders only what THIS ingest saw.
1937
- const carried = takeFoldAdvisories(ctx.foldAdvisoriesRef);
1938
- const emitted = {
1939
- kind: "semantic_review",
1940
- selectedExecutor: decision.selected_executor,
1941
- ...review,
1942
- ...(ingestIssues.length > 0 ? { ingestIssues } : {}),
1943
- ...(validationWarnings.length > 0 ? { validationWarnings } : {}),
1944
- };
2061
+ // What THIS ingest saw. Deliberately NOT drained here: the carried advisories
2062
+ // are taken at the fold's single emission boundary (`runDeterministicForNextStep`),
2063
+ // which every emitted step kind passes through — draining at this obligation
2064
+ // would state them only for a semantic-review emission and silently drop them
2065
+ // the moment the run's next step happened to be a different kind
2066
+ // (design_review_conceptual, charter_*, synthesis_narrative…).
1945
2067
  return {
1946
2068
  kind: "emit",
1947
- step: carried.ingestIssues.length > 0 || carried.validationWarnings.length > 0
1948
- ? {
1949
- ...emitted,
1950
- ingestIssues: [
1951
- ...ingestIssues,
1952
- ...carried.ingestIssues,
1953
- ],
1954
- validationWarnings: [
1955
- ...validationWarnings,
1956
- ...carried.validationWarnings,
1957
- ],
1958
- }
1959
- : emitted,
2069
+ step: {
2070
+ kind: "semantic_review",
2071
+ selectedExecutor: decision.selected_executor,
2072
+ ...review,
2073
+ ...(ingestIssues.length > 0 ? { ingestIssues } : {}),
2074
+ ...(validationWarnings.length > 0 ? { validationWarnings } : {}),
2075
+ },
1960
2076
  // The pause's blocked core state — the fold's single commit persists it
1961
2077
  // (the locking variant's own write was the other half of the split).
1962
2078
  state: review.bundle,
1963
2079
  };
1964
2080
  }
2081
+ /**
2082
+ * State the fold's carried advisories on the step about to be emitted, and
2083
+ * DRAIN them.
2084
+ *
2085
+ * THE single emission-boundary drain. It lives here, not at any one obligation,
2086
+ * because the property is "stated on exactly one emitted step, whichever call
2087
+ * and whichever step kind emits it": a carry produced by a call-ending
2088
+ * transition must survive to a later fold, and that fold's step may be ANY
2089
+ * kind. Hanging the drain off the semantic-review obligation made it correct
2090
+ * only for as long as the next step happened to be a semantic review.
2091
+ *
2092
+ * Advisories are only ever RENDERED by the semantic-review step today (the
2093
+ * other kinds carry no advisory channel), so a carry drained onto one of them
2094
+ * still reaches the operator — as a stated line in this step's prompt — rather
2095
+ * than being lost. A step with nothing carried is returned untouched.
2096
+ */
2097
+ async function withFoldAdvisories(step, ctx) {
2098
+ const carried = await takeFoldAdvisories(ctx.params.artifactsDir, ctx.foldAdvisoriesRef);
2099
+ if (carried.ingestIssues.length === 0 &&
2100
+ carried.validationWarnings.length === 0) {
2101
+ return step;
2102
+ }
2103
+ if (step.kind !== "semantic_review") {
2104
+ return {
2105
+ ...step,
2106
+ advisoryNotice: renderCarriedAdvisoryLines(carried),
2107
+ };
2108
+ }
2109
+ return {
2110
+ ...step,
2111
+ ingestIssues: [...(step.ingestIssues ?? []), ...carried.ingestIssues],
2112
+ validationWarnings: [
2113
+ ...(step.validationWarnings ?? []),
2114
+ ...carried.validationWarnings,
2115
+ ],
2116
+ };
2117
+ }
2118
+ /**
2119
+ * The advisory lines a step that carries no advisory CHANNEL still states. A
2120
+ * carried advisory is never dropped on the floor because the run happened to
2121
+ * move on to a different step kind — it is rendered as text, in the same
2122
+ * wording the semantic-review step's own sections use.
2123
+ */
2124
+ function renderCarriedAdvisoryLines(carried) {
2125
+ const lines = [];
2126
+ // The SAME missing/rejected split the semantic-review step renders, because a
2127
+ // carried advisory and the step's own issues are the same fact reaching the
2128
+ // operator through two different channels; they must not disagree on shape.
2129
+ const describe = (issue) => `${issue.work_item_id ? `\`${issue.work_item_id}\` (${issue.code}): ` : `${issue.code}: `}` +
2130
+ `${issue.message}${issue.result_path ? ` (\`${issue.result_path}\`)` : ""}`;
2131
+ const missing = carried.ingestIssues.filter(isMissingObservation);
2132
+ const refused = carried.ingestIssues.filter((issue) => !isMissingObservation(issue));
2133
+ if (missing.length > 0) {
2134
+ lines.push("## Results not yet written", "", ...missing.map((issue) => `- ${describe(issue)}`), "");
2135
+ }
2136
+ if (refused.length > 0) {
2137
+ lines.push("## Result status requiring attention", "", ...refused.map((issue) => `- ${describe(issue)}`), "");
2138
+ }
2139
+ if (carried.validationWarnings.length > 0) {
2140
+ lines.push("## Advisory notes on accepted results", "", ...carried.validationWarnings.map((warning) => `- \`${warning.work_item_id}\` was ACCEPTED; advisory: ${warning.message}`), "");
2141
+ }
2142
+ return lines;
2143
+ }
1965
2144
  /** Emit the no-executor blocked step (the hand loop's `!selected_executor` arm). */
1966
2145
  async function emitNoExecutorBlocked(bundle, ctx, decision) {
1967
2146
  const state = decision.state;
@@ -1987,17 +2166,46 @@ function trackFoldBundle(obligations) {
1987
2166
  return obligations.map((obligation) => ({
1988
2167
  ...obligation,
1989
2168
  execute: async (bundle, ctx) => {
1990
- const outcome = await obligation.execute(bundle, ctx);
1991
- if (outcome.kind === "transition") {
1992
- ctx.currentBundleRef.value = outcome.state;
2169
+ // Liveness for the LONG deterministic drain (the >2min stale-artifact
2170
+ // re-extraction next-step that blew a caller timeout with no output). The
2171
+ // per-execution label is set HERE because this is the one place every fold
2172
+ // execution passes through, whatever it dispatches; `runSingleAdvanceStep`
2173
+ // then refines it to the selected obligation once the engine has picked
2174
+ // one, so a beat is never unattributed. `advanceAudit`'s heartbeat already
2175
+ // covers the un-forced `advanceAudit` path; the fold drives the shared
2176
+ // engine directly and so owns its own.
2177
+ ctx.heartbeat?.setLabel(obligation.id);
2178
+ const startedAt = Date.now();
2179
+ try {
2180
+ const outcome = await obligation.execute(bundle, ctx);
2181
+ if (outcome.kind === "transition") {
2182
+ ctx.currentBundleRef.value = outcome.state;
2183
+ }
2184
+ else if (outcome.state !== undefined) {
2185
+ ctx.currentBundleRef.value = outcome.state;
2186
+ }
2187
+ return outcome;
1993
2188
  }
1994
- else if (outcome.state !== undefined) {
1995
- ctx.currentBundleRef.value = outcome.state;
2189
+ finally {
2190
+ foldHeartbeatRecord(obligation.id, Date.now() - startedAt);
1996
2191
  }
1997
- return outcome;
1998
2192
  },
1999
2193
  }));
2000
2194
  }
2195
+ /**
2196
+ * One JSONL line naming an obligation the fold finished executing and how long
2197
+ * it took. Written to stderr beside the interval beat (same channel and shape as
2198
+ * `progress_heartbeat`, so one reader consumes both) and to the fold's run log
2199
+ * via its own logger when one is attached.
2200
+ */
2201
+ function foldHeartbeatRecord(obligation, durationMs) {
2202
+ process.stderr.write(JSON.stringify({
2203
+ kind: "progress_heartbeat",
2204
+ phase: obligation,
2205
+ duration_ms: durationMs,
2206
+ ts: new Date().toISOString(),
2207
+ }) + "\n");
2208
+ }
2001
2209
  // ── Coordinator ───────────────────────────────────────────────────────────────
2002
2210
  /**
2003
2211
  * Drive the deterministic fold for one `next-step` call.
@@ -2019,6 +2227,24 @@ function trackFoldBundle(obligations) {
2019
2227
  * terminal step (present_report when a report is rendered, else blocked).
2020
2228
  */
2021
2229
  export async function runDeterministicForNextStep(params) {
2230
+ // The heartbeat wraps the WHOLE call, throw path included: a drain that dies
2231
+ // halfway is exactly when a caller most needs to know how far it got, and the
2232
+ // interval beat has no other owner on this path (the fold drives the shared
2233
+ // engine directly rather than through `advanceAudit`).
2234
+ const heartbeat = startAdvanceHeartbeat();
2235
+ try {
2236
+ return await runDeterministicFold(params, heartbeat);
2237
+ }
2238
+ finally {
2239
+ heartbeat.stop();
2240
+ }
2241
+ }
2242
+ async function runDeterministicFold(params, heartbeat) {
2243
+ // THE fold's one git-index probe cache (`ScopeIndexMemo`). It is created here
2244
+ // and held on `params` — the object every dispatch path already shares, the
2245
+ // gate handlers included — so one `next-step` call spawns `git` once rather
2246
+ // than once per obligation execution.
2247
+ params.scopeIndexMemo = {};
2022
2248
  const analyzersRef = {
2023
2249
  value: params.analyzers,
2024
2250
  };
@@ -2058,12 +2284,8 @@ export async function runDeterministicForNextStep(params) {
2058
2284
  params,
2059
2285
  analyzersRef,
2060
2286
  lastSummaryRef: { value: "" },
2061
- foldAdvisoriesRef: {
2062
- value: {
2063
- ingestIssues: [...EMPTY_FOLD_ADVISORIES.ingestIssues],
2064
- validationWarnings: [...EMPTY_FOLD_ADVISORIES.validationWarnings],
2065
- },
2066
- },
2287
+ heartbeat,
2288
+ foldAdvisoriesRef: { value: emptyFoldAdvisories() },
2067
2289
  dispatchOrdinalRef: { value: 0 },
2068
2290
  dispatchedSignatures: new Set(),
2069
2291
  seenStateSignatures: new Set(),
@@ -2091,6 +2313,14 @@ export async function runDeterministicForNextStep(params) {
2091
2313
  const holdStartMs = Date.now();
2092
2314
  let chargedExecutions;
2093
2315
  await recoverStagedSubmissions(params.artifactsDir);
2316
+ // The PERSISTED carry, read back under the hold. A transition that ENDED
2317
+ // an earlier call left its advisories on disk for the next emission to
2318
+ // state, and that emission may be this call's — the ctx ref starts empty
2319
+ // per call, so without this read the durable half would be write-only and
2320
+ // the advisories would still die at the call boundary. Seeding the ref
2321
+ // (rather than merging at the emit site) keeps ONE drain point, so the
2322
+ // once-only property is the same one the in-call path already relies on.
2323
+ ctx.foldAdvisoriesRef.value = await readPendingAdvisories(params.artifactsDir);
2094
2324
  const startBundle = await loadArtifactBundle(params.artifactsDir);
2095
2325
  ctx.currentBundleRef.value = startBundle;
2096
2326
  try {
@@ -2141,14 +2371,21 @@ export async function runDeterministicForNextStep(params) {
2141
2371
  const finalStale = computeStaleArtifacts(outcome.state, { emit: false });
2142
2372
  emitStalenessRecord(finalStale, isMetadataMigrationStaleness(outcome.state)
2143
2373
  ? "metadata_schema_version_migration"
2144
- : undefined);
2374
+ : undefined, outcome.state);
2375
+ // THE emission boundary — the one place every emitted step kind passes
2376
+ // through. Draining the carry here, rather than at the semantic-review
2377
+ // obligation that produces most of it, is what makes "stated on exactly one
2378
+ // emitted step, WHICHEVER step that is" true for every kind. A terminal
2379
+ // intent is deliberately excluded: it is not a step, and the terminal
2380
+ // conversion below promotes and deletes the artifacts dir — the carry has
2381
+ // nowhere left to be stated, and the run is over.
2382
+ if (outcome.step && outcome.step.kind !== "terminal_intent") {
2383
+ return await withFoldAdvisories(outcome.step, ctx);
2384
+ }
2145
2385
  if (outcome.step) {
2146
- if (outcome.step.kind === "terminal_intent") {
2147
- // Guard terminals convert POST-commit, POST-hold: buildTerminalStep can
2148
- // promote, and promotion deletes artifactsDir.
2149
- return await buildTerminalStep(params, outcome.step.bundle, outcome.step.state, outcome.step.reason);
2150
- }
2151
- return outcome.step;
2386
+ // Guard terminals convert POST-commit, POST-hold: buildTerminalStep can
2387
+ // promote, and promotion deletes artifactsDir.
2388
+ return await buildTerminalStep(params, outcome.step.bundle, outcome.step.state, outcome.step.reason);
2152
2389
  }
2153
2390
  if (outcome.stopped === "budget") {
2154
2391
  // The pacing cap (MAX_DRAIN_STEPS charged executions), spent gracefully: