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,14 +1,89 @@
1
+ // sites-pinned: tests/audit/host-handoff.test.ts
2
+ // (the steward-lane verification contract: the lane-aware prompt, the one
3
+ // optional envelope key, the refusal of that key on a lane whose contract never
4
+ // asked for it, the enforcement of every property the prompt states, and the
5
+ // task-bindings version bump whose refusal names the remedy)
1
6
  import { mkdir } from "node:fs/promises";
2
7
  import { join } from "node:path";
3
- import { createMemoizedSourceReader, appendSubmissionEvent, SUBMISSION_LEDGER_EVENT_CONTRACT_VERSION, bindingIdentity, compareCodeUnits, contentSha256, firstDuplicateIdentity, hasExactKeys, hostHandoffResultPath, isFileMissingError, isRecord, isSha256, parseAllWorkloadItems, parseWorkloadEnvelope, promptSha256, enrichMissingSubmissionIssues, readTrailingSubmissionRefusals, readJsonFile, repoRelativePath, requireNonEmptyString, resolveContainedPath, resolveHostHandoffPaths, resultMapIdentity, scanBoundSubmission, siblingLockPath, sameStrings, stableStringify, verifyFindingGrounding, withFileLock, writeBlockedStepContract, writeJsonFile, } from "audit-tools/shared";
8
+ import { createMemoizedSourceReader, appendSubmissionEvent, SUBMISSION_LEDGER_EVENT_CONTRACT_VERSION, bindingIdentity, compareCodeUnits, contentSha256, firstDuplicateIdentity, hasExactKeys, hostHandoffResultPath, identityFailureDiagnostic, isFileMissingError, isRecord, isSha256, LaneDemandSchema, parseAllWorkloadItems, parseWorkloadEnvelope, promptSha256, enrichMissingSubmissionIssues, readTrailingSubmissionRefusals, readJsonFile, repoRelativePath, requireNonEmptyString, resolveContainedPath, resolveHostHandoffPaths, resultMapIdentity, scanBoundSubmission, siblingLockPath, sameStrings, stableStringify, verifyFindingGrounding, withFileLock, writeBlockedStepContract, writeJsonFile, } from "audit-tools/shared";
4
9
  import { findingContractPromptLines } from "../../contracts/findingContractPrompt.js";
5
- import { WorkerFindingSchema } from "../../contracts/workerSchemas.js";
10
+ import { WORKER_REFUSED_FINDING_VERDICTS, WorkerFindingSchema, } from "../../contracts/workerSchemas.js";
6
11
  import { AuditResultSchema } from "../../types.js";
7
- import { validateOneAuditResult, formatAuditResultIssues, } from "../../validation/auditResults.js";
8
- const WORKLOAD_CONTRACT_VERSION = "audit-host-workload/v1alpha1";
12
+ import { validateOneAuditResult, formatAuditResultIssues,
13
+ // THE ONE CONTAINMENT RULE, shared with the batch door: this boundary and
14
+ // `validateVerification` build their allowed set through the same function, so
15
+ // they cannot disagree about which `file_paths` entries are inside the packet.
16
+ verificationAllowedPaths, normalizeCoveragePath, } from "../../validation/auditResults.js";
17
+ import { reviewWaveClosedPath } from "../../io/runArtifacts.js";
18
+ // The lane token itself is single-sourced where the steward lane is minted:
19
+ // `LENS_VERIFICATION_TAG` (`orchestrator/selectiveDeepening/shared.ts`). Every
20
+ // reader compiles against that one declaration, so a rename moves them together
21
+ // rather than leaving two literals that agree only until one is edited — which
22
+ // is what a hand-copied literal here produced, twice (this boundary and the
23
+ // audit-results validator).
24
+ import { LENS_VERIFICATION_TAG, } from "../../orchestrator/selectiveDeepening/shared.js";
25
+ // v1alpha2 (the emitted-lane demand ranking): each work item's `metadata`
26
+ // carries the shared `demand` ranking (size / complexity / risk) beside its
27
+ // token estimate, in place of the retired `{complexity, risk}` pair whose
28
+ // `risk` was the task's coarsely bucketed dispatch PRIORITY rather than a
29
+ // likelihood×stakes estimate. A v1alpha1 document refuses closed as stale —
30
+ // re-prepare. Same one-cut precedent as the remediation twin's v1alpha2
31
+ // (`REMEDIATION_HOST_WORKLOAD_CONTRACT_VERSION`, commit ed033294): the shape
32
+ // changed, so the version names the shape that is actually on disk.
33
+ const WORKLOAD_CONTRACT_VERSION = "audit-host-workload/v1alpha2";
9
34
  const RESULT_MAP_CONTRACT_VERSION = "audit-host-result-map/v1alpha1";
10
35
  const RESULT_CONTRACT_VERSION = "audit-host-result/v1alpha1";
11
- const TASK_BINDINGS_CONTRACT_VERSION = "audit-host-task-bindings/v1alpha1";
36
+ /**
37
+ * The result envelope's REQUIRED key set. Named rather than inlined because the
38
+ * parse and the refusal message both enumerate it, and the one OPTIONAL key
39
+ * (`verification`) is added to the expected set only when the submission
40
+ * actually carries it — so "exactly these keys, plus at most one optional
41
+ * field" is one statement instead of a second hand-maintained list.
42
+ */
43
+ const AUDIT_RESULT_ENVELOPE_KEYS = [
44
+ "contract_version",
45
+ "file_coverage",
46
+ "findings",
47
+ "prompt_sha256",
48
+ "result_id",
49
+ "run_id",
50
+ "work_item_id",
51
+ ];
52
+ /**
53
+ * v1alpha2 adds the per-item `tags` lane stamp. The version moves with the shape
54
+ * because a binding set is READ BACK at ingest, after the pause — a binding
55
+ * written by the previous code carries no `tags`, and the lane gate below reads
56
+ * that field, so under one version string the old set would be refused by a
57
+ * generic parse error on a run the host had already executed.
58
+ *
59
+ * Moving the version (rather than defaulting an absent `tags` to `[]`) makes
60
+ * that case FAIL CLOSED with a message that names what happens next:
61
+ * `parseTaskBindings` throws {@link StaleAuditHostTaskBindingsError}, the ingest
62
+ * returns it as a classified issue, and the fold walks on to re-prepare the
63
+ * whole workload under the current version. Defaulting was
64
+ * the other option and was rejected here because it would silently judge an
65
+ * old-shape item against the BASE per-file lane: that happens to be correct today
66
+ * only because the only lane with a divergent contract is the steward lane, which
67
+ * did not exist when the old binding was written — an argument that decays the
68
+ * moment a second lane diverges, and that would leave a mis-laned item reporting
69
+ * success.
70
+ */
71
+ const TASK_BINDINGS_CONTRACT_VERSION = "audit-host-task-bindings/v1alpha2";
72
+ /**
73
+ * The remedy a version mismatch carries. The failure is recoverable, and the
74
+ * recoverable move is not guessable from the shape ("unexpected field" reads as
75
+ * a corrupt file, which invites an operator to hand-edit bindings).
76
+ *
77
+ * It names ONLY what the tool then does, because that is now all there is to do:
78
+ * the fold classifies a stale binding set ({@link StaleAuditHostTaskBindingsError})
79
+ * and continues to `prepareAuditHostHandoff`, which rewrites the whole set under
80
+ * the current version in the SAME `next-step` call that read it. So the host is
81
+ * not asked to do anything, and the sentence must not read as an instruction to
82
+ * re-run anything by hand.
83
+ */
84
+ const TASK_BINDINGS_VERSION_REMEDY = "the same `next-step` re-prepares the workload under the current contract version " +
85
+ "and rewrites this bindings file; results already accepted are not re-ingested";
86
+ const REVIEW_WAVE_CLOSED_CONTRACT_VERSION = "audit-review-wave-closed/v1alpha1";
12
87
  const ACCEPTED_RESULTS_CONTRACT_VERSION = "audit-host-accepted-results/v1alpha1";
13
88
  /**
14
89
  * The audit draw's boundary paths: the SHARED resolution (run-id grammar,
@@ -79,7 +154,10 @@ async function writeAcceptedResults(paths, ledger) {
79
154
  * a divergence between them would have been silent on both sides.
80
155
  */
81
156
  function resultPathFor(paths, workItemId) {
82
- return hostHandoffResultPath({ root: paths.root, artifactsDir: paths.artifactsDir, runDir: paths.runDir, resultDir: paths.resultDir, workloadPath: paths.workloadPath }, workItemId);
157
+ // `ResolvedBoundaryPaths` is a superset of the core's `HostHandoffPaths`, so
158
+ // the core shape passes through whole — no re-flattening step that could drop
159
+ // a field the shared rule later starts reading.
160
+ return hostHandoffResultPath(paths, workItemId);
83
161
  }
84
162
  function normalizeTask(task, root) {
85
163
  if (!isRecord(task)) {
@@ -91,8 +169,10 @@ function normalizeTask(task, root) {
91
169
  const lens = requireNonEmptyString(task.lens, `${taskId}.lens`);
92
170
  const rationale = requireNonEmptyString(task.rationale, `${taskId}.rationale`);
93
171
  const priority = requireNonEmptyString(task.priority, `${taskId}.priority`);
94
- const complexity = requireNonEmptyString(task.complexity, `${taskId}.complexity`);
95
- const risk = requireNonEmptyString(task.risk, `${taskId}.risk`);
172
+ // The demand ranking is validated by the SHARED schema, so a draw cannot
173
+ // admit a rank the other draw would refuse — and so the closed vocabulary has
174
+ // exactly one author.
175
+ const demand = LaneDemandSchema.parse(task.demand);
96
176
  if (!Number.isFinite(task.token_estimate) ||
97
177
  task.token_estimate < 0 ||
98
178
  !Number.isInteger(task.token_estimate)) {
@@ -134,11 +214,32 @@ function normalizeTask(task, root) {
134
214
  file_line_counts: Object.fromEntries(Object.entries(normalizedLineCounts).sort(([left], [right]) => compareCodeUnits(left, right))),
135
215
  rationale,
136
216
  priority,
137
- complexity,
138
- risk,
217
+ demand,
139
218
  token_estimate: task.token_estimate,
219
+ // Sorted and deduplicated so two spellings of the same lane cannot produce
220
+ // two work items that differ only in tag order (the prompt digest is a
221
+ // content hash of this shape, and an incidentally-ordered array is a churn
222
+ // source — see the stable-order rule).
223
+ ...(Array.isArray(task.tags)
224
+ ? { tags: [...new Set(task.tags)].sort(compareCodeUnits) }
225
+ : {}),
140
226
  };
141
227
  }
228
+ /**
229
+ * The lane tag whose contract asks for `verification` metadata — the shared
230
+ * {@link LENS_VERIFICATION_TAG}, imported rather than spelled again.
231
+ *
232
+ * WHAT THE IMPORT BUYS, exactly: every reader in this package that gates on the
233
+ * lane compiles against ONE declaration, so a rename of the constant moves all
234
+ * of them together at build time. It buys nothing at RUNTIME — no test catches a
235
+ * rename of the constant's VALUE, because a test can only compare the constant
236
+ * to itself. That is the whole claim, and it is enough: the failure the import
237
+ * removes is the one where two spellings drift apart in a source tree, which is
238
+ * what a hand-copied literal produced here.
239
+ */
240
+ function isVerificationLane(tags) {
241
+ return tags?.includes(LENS_VERIFICATION_TAG) ?? false;
242
+ }
142
243
  function buildPrompt(task, resultPath) {
143
244
  const assignment = stableStringify({
144
245
  file_line_counts: task.file_line_counts,
@@ -150,18 +251,179 @@ function buildPrompt(task, resultPath) {
150
251
  task_id: task.task_id,
151
252
  unit_id: task.unit_id,
152
253
  });
254
+ // LANE-AWARE, because the two lanes' contracts genuinely differ: the steward
255
+ // lane is INSTRUCTED (by its task rationale) to return verification metadata,
256
+ // and the base lane is not. Rendering one envelope sentence for both would
257
+ // either ask the base lane for a field its ingest discards, or tell the
258
+ // steward lane "exactly" a key set that refuses what its own instruction
259
+ // demands. The ask and the envelope are the same fact, so they are stated
260
+ // from the same predicate.
261
+ const verificationLane = isVerificationLane(task.tags);
153
262
  return [
154
263
  "Perform the bounded semantic audit work item below.",
155
264
  "Review every listed file and return one JSON object at the bound result path.",
156
265
  `Assignment: ${assignment}`,
157
- "Result contract: audit-host-result/v1alpha1 with exactly result_id, run_id, work_item_id, prompt_sha256, file_coverage, and findings in addition to contract_version.",
266
+ verificationLane
267
+ ? "Result contract: audit-host-result/v1alpha1 with exactly result_id, run_id, work_item_id, prompt_sha256, file_coverage, findings, and verification in addition to contract_version."
268
+ : "Result contract: audit-host-result/v1alpha1 with exactly result_id, run_id, work_item_id, prompt_sha256, file_coverage, and findings in addition to contract_version.",
158
269
  "Each file_coverage entry must contain exactly path, reviewed_lines, and total_lines.",
159
270
  // The finding contract is CARRIED, not referenced: it is rendered from the
160
271
  // very schema ingestion enforces, so a host never has to remember or fetch it.
161
272
  ...findingContractPromptLines(),
162
273
  "Do not supply a `grounding` field on any finding — grounding is computed by the tool at ingest by re-reading your cited quoted_text from disk, and a supplied one rejects the whole submission.",
274
+ ...(verificationLane ? verificationContractPromptLines() : []),
163
275
  ].join("\n");
164
276
  }
277
+ /**
278
+ * The `verification` contract rendered into a steward-lane work item's prompt.
279
+ *
280
+ * CARRIED for the same reason the finding contract is: the host cannot comply
281
+ * with a contract it is never shown, and this one is three-deep (booleans, three
282
+ * concern arrays, and an array of AuditTask-shaped follow-up suggestions whose
283
+ * `file_paths` must lie inside the packet boundary). Rendered from the schema
284
+ * ingestion enforces, so the prompt cannot describe a shape the parse refuses.
285
+ */
286
+ function verificationContractPromptLines() {
287
+ return [
288
+ "This work item is a LENS STEWARD VERIFICATION task, so it also accepts an optional `verification` object.",
289
+ `verification, when present, must contain exactly ${VERIFICATION_CONTRACT_KEYS.join(", ")} — all six, with no extra key: verified and needs_followup are booleans, concerns, coverage_concerns and confidence_concerns are arrays of non-empty strings (a genuine "nothing to report" is an empty array, not an omitted field), and followup_tasks is an array of objects.`,
290
+ `Each verification.followup_tasks entry must contain exactly ${VERIFICATION_FOLLOWUP_KEYS.join(", ")} — all six, with no extra key: file_paths is a non-empty array of non-empty repo-relative strings, each naming a file within THIS work item's file_coverage or packet boundary; lens must be the lens of THIS task; task_id, unit_id, pass_id and rationale must be non-empty strings.`,
291
+ "Set needs_followup true only when followup_tasks is non-empty — a follow-up request with no bounded task is refused.",
292
+ ];
293
+ }
294
+ /**
295
+ * The steward `verification` object's key set and its follow-up entry's key set,
296
+ * declared ONCE. Three statements read them — the prompt lines, the enforcement,
297
+ * and the refusal they share — because a second hand-maintained copy of a key
298
+ * list is exactly how a prompt and a parser drift apart, which is the defect
299
+ * class {@link verificationContractFailure} exists to close.
300
+ */
301
+ const VERIFICATION_CONTRACT_KEYS = [
302
+ "verified",
303
+ "needs_followup",
304
+ "concerns",
305
+ "coverage_concerns",
306
+ "confidence_concerns",
307
+ "followup_tasks",
308
+ ];
309
+ const VERIFICATION_FOLLOWUP_KEYS = [
310
+ "task_id",
311
+ "unit_id",
312
+ "pass_id",
313
+ "lens",
314
+ "file_paths",
315
+ "rationale",
316
+ ];
317
+ /** The exact-key-set refusal, shared by the object and its entries. */
318
+ function exactKeysFailure(label, present, expected) {
319
+ const extra = present.filter((key) => !expected.includes(key));
320
+ const missing = expected.filter((key) => !present.includes(key));
321
+ if (extra.length === 0 && missing.length === 0)
322
+ return null;
323
+ const broken = [
324
+ ...missing.map((key) => `missing ${key}`),
325
+ ...extra.map((key) => `unexpected ${key}`),
326
+ ];
327
+ return `${label} must contain exactly ${expected.join(", ")} (received: ${broken.join(", ")})`;
328
+ }
329
+ function isNonEmptyStringArray(value) {
330
+ return (Array.isArray(value) &&
331
+ value.every((entry) => typeof entry === "string" && entry.length > 0));
332
+ }
333
+ /**
334
+ * This door's inputs to the ONE containment rule
335
+ * ({@link verificationAllowedPaths}, `src/audit/validation/auditResults.ts`):
336
+ * the binding's file set (the work item's own boundary, persisted at prepare)
337
+ * plus the submitted envelope's coverage paths. No packet boundary here — the
338
+ * host door judges a single work item's own coverage, and the batch door is the
339
+ * one that sees siblings. Both build their set through the shared rule anyway,
340
+ * so a change to how a path is normalized or admitted reaches both.
341
+ */
342
+ function verificationAllowedPathsForEnvelope(binding, envelope) {
343
+ return verificationAllowedPaths({
344
+ assignedPaths: Object.keys(binding.file_line_counts),
345
+ coveragePaths: Array.isArray(envelope.file_coverage)
346
+ ? envelope.file_coverage.flatMap((entry) => isRecord(entry) && typeof entry.path === "string" ? [entry.path] : [])
347
+ : [],
348
+ });
349
+ }
350
+ /**
351
+ * Every property the steward prompt CLAIMS about the `verification` object,
352
+ * enforced at the host-result boundary — a claim the prompt makes and the
353
+ * envelope does not back is the exact failure the project rule bans. Returns
354
+ * the first broken property's refusal detail, or `null` when the object
355
+ * satisfies every stated rule.
356
+ *
357
+ * The rules mirror {@link verificationContractPromptLines} one-for-one:
358
+ * 1. `verification` must contain exactly its six keys — no extra, no missing.
359
+ * 2. `needs_followup` true ⇒ `followup_tasks` present and non-empty.
360
+ * 3. each `followup_tasks` entry must contain exactly its six keys, its
361
+ * `lens` equal to the task's lens, and each `file_paths` string inside the
362
+ * packet boundary.
363
+ *
364
+ * Reused over the shared `AuditVerificationSchema` deliberately: that schema is
365
+ * NON-STRICT (its arrays are optional, it drops unknown keys) because the
366
+ * follow-up builder tolerates a partial object and the follow-up-task shape
367
+ * (`AuditTaskSchema`) is a superset of what the prompt names. The prompt is the
368
+ * stricter claim, so the stricter check lives HERE, at the door that reads the
369
+ * field, rather than tightening a schema other readers lean on.
370
+ */
371
+ function verificationContractFailure(verification, binding, envelope) {
372
+ if (!isRecord(verification)) {
373
+ return `verification must be an object with exactly ${VERIFICATION_CONTRACT_KEYS.join(", ")}`;
374
+ }
375
+ const keysFailure = exactKeysFailure("verification", Object.keys(verification), VERIFICATION_CONTRACT_KEYS);
376
+ if (keysFailure !== null)
377
+ return keysFailure;
378
+ if (typeof verification.verified !== "boolean") {
379
+ return "verification.verified must be a boolean";
380
+ }
381
+ if (typeof verification.needs_followup !== "boolean") {
382
+ return "verification.needs_followup must be a boolean";
383
+ }
384
+ for (const field of ["concerns", "coverage_concerns", "confidence_concerns"]) {
385
+ if (!isNonEmptyStringArray(verification[field])) {
386
+ return `verification.${field} must be an array of non-empty strings`;
387
+ }
388
+ }
389
+ const followup = verification.followup_tasks;
390
+ if (!Array.isArray(followup)) {
391
+ return "verification.followup_tasks must be an array of objects";
392
+ }
393
+ if (verification.needs_followup === true && followup.length === 0) {
394
+ return "needs_followup is true but followup_tasks is empty — a follow-up request with no bounded task is refused";
395
+ }
396
+ const allowed = verificationAllowedPathsForEnvelope(binding, envelope);
397
+ for (let index = 0; index < followup.length; index++) {
398
+ const label = `verification.followup_tasks[${index}]`;
399
+ const entry = followup[index];
400
+ if (!isRecord(entry)) {
401
+ return `${label} must be an object`;
402
+ }
403
+ const entryKeysFailure = exactKeysFailure(label, Object.keys(entry), VERIFICATION_FOLLOWUP_KEYS);
404
+ if (entryKeysFailure !== null)
405
+ return entryKeysFailure;
406
+ for (const field of ["task_id", "unit_id", "pass_id", "rationale"]) {
407
+ if (typeof entry[field] !== "string" || entry[field].length === 0) {
408
+ return `${label}.${field} must be a non-empty string`;
409
+ }
410
+ }
411
+ if (entry.lens !== binding.lens) {
412
+ return `${label}.lens must equal the task's lens ` +
413
+ `(expected '${binding.lens}', got '${String(entry.lens)}')`;
414
+ }
415
+ if (!isNonEmptyStringArray(entry.file_paths) || entry.file_paths.length === 0) {
416
+ return `${label}.file_paths must be a non-empty array of non-empty strings`;
417
+ }
418
+ for (const path of entry.file_paths) {
419
+ if (!allowed.has(normalizeCoveragePath(path))) {
420
+ return `${label}.file_paths references '${path}', ` +
421
+ "which is outside this work item's file_coverage or packet boundary";
422
+ }
423
+ }
424
+ }
425
+ return null;
426
+ }
165
427
  function buildWorkItem(paths, task) {
166
428
  const resultPath = resultPathFor(paths, task.task_id);
167
429
  const promptText = buildPrompt(task, resultPath);
@@ -169,8 +431,7 @@ function buildWorkItem(paths, task) {
169
431
  id: task.task_id,
170
432
  lens: task.lens,
171
433
  metadata: {
172
- complexity: task.complexity,
173
- risk: task.risk,
434
+ demand: task.demand,
174
435
  token_estimate: task.token_estimate,
175
436
  },
176
437
  prompt: {
@@ -273,30 +534,48 @@ export async function prepareAuditHostHandoff(params) {
273
534
  pass_id: task.pass_id,
274
535
  lens: task.lens,
275
536
  file_line_counts: Object.fromEntries(item.scope.files.map((path) => [path, task.file_line_counts[path]])),
537
+ tags: [...(task.tags ?? [])],
276
538
  };
277
539
  }),
278
540
  };
279
541
  await mkdir(paths.resultDir, { recursive: true });
280
542
  await writeJsonFile(paths.taskBindingsPath, taskBindings);
281
- // The already-satisfied filter READS the ledger and the rewrite WRITES it, so
282
- // both sit inside the one acquisition — a prepare that snapshotted before a
283
- // concurrent ingest's additions must not replace them with its stale copy, and
284
- // it must not re-ask for a lane that ingest has meanwhile satisfied.
543
+ // Say out loud whether this wave has drained. The caller hands in the run's
544
+ // still-OWED partition, so an EMPTY one is the wave's own statement that every
545
+ // work item it published has been accepted — and that is the only evidence
546
+ // there is: from the review-run resolution, a fully-accepted wave and a wave
547
+ // with one lane still out look identical (both are "fewer pending than
548
+ // published"). The next wave's identity is derived from this, so it is written
549
+ // where the run itself lives and never inferred. A comment stating this does
550
+ // NOT survive; the marker is what does.
551
+ await writeJsonFile(reviewWaveClosedPath(params.artifactsDir, params.runId), {
552
+ contract_version: REVIEW_WAVE_CLOSED_CONTRACT_VERSION,
553
+ run_id: params.runId,
554
+ closed: allWorkItems.length === 0,
555
+ });
556
+ // What is PUBLISHED is every task this caller handed in. This boundary does
557
+ // not suppress work items the accepted ledger names, and deliberately so —
558
+ // the ledger records what ARRIVED, it never decides what is still OWED.
559
+ //
560
+ // A suppression filter used to sit here, keyed on the whole accepted set. It
561
+ // read as "do not re-ask for work already delivered", but the set it consulted
562
+ // was historical: a task that was accepted, re-planned, and is pending again
563
+ // stayed suppressed forever, so a re-opened item was silently invisible to
564
+ // replay — the one failure mode the ingest's own dedupe (fresh, per-binding,
565
+ // `bindingIdentity` over work item × prompt digest) already covers correctly.
566
+ // The ledger read and its paired rewrite still sit inside the one
567
+ // acquisition: a prepare that snapshotted before a concurrent ingest's
568
+ // additions must not replace them with its stale copy.
285
569
  return withAcceptedResultsLock(paths, params.logger, async (accepted) => {
286
- const acceptedBindings = new Set(accepted.entries.map(bindingIdentity));
287
- const workItems = allWorkItems.filter((item) => !acceptedBindings.has(bindingIdentity({
288
- work_item_id: item.id,
289
- prompt_sha256: item.prompt.sha256,
290
- })));
291
570
  const workload = {
292
571
  contract_version: WORKLOAD_CONTRACT_VERSION,
293
572
  run_id: params.runId,
294
- work_items: workItems,
573
+ work_items: allWorkItems,
295
574
  };
296
575
  const resultMap = {
297
576
  contract_version: RESULT_MAP_CONTRACT_VERSION,
298
577
  run_id: params.runId,
299
- entries: workItems.map((item) => ({
578
+ entries: allWorkItems.map((item) => ({
300
579
  work_item_id: item.id,
301
580
  prompt_sha256: item.prompt.sha256,
302
581
  result_path: item.result_path,
@@ -327,9 +606,8 @@ function parseWorkItem(value) {
327
606
  typeof value.lens !== "string" ||
328
607
  typeof value.result_path !== "string" ||
329
608
  !isRecord(value.metadata) ||
330
- !hasExactKeys(value.metadata, ["complexity", "risk", "token_estimate"]) ||
331
- typeof value.metadata.complexity !== "string" ||
332
- typeof value.metadata.risk !== "string" ||
609
+ !hasExactKeys(value.metadata, ["demand", "token_estimate"]) ||
610
+ !LaneDemandSchema.safeParse(value.metadata.demand).success ||
333
611
  !Number.isInteger(value.metadata.token_estimate) ||
334
612
  !isRecord(value.prompt) ||
335
613
  !hasExactKeys(value.prompt, ["sha256", "text"]) ||
@@ -346,6 +624,78 @@ function parseWorkItem(value) {
346
624
  }
347
625
  return value;
348
626
  }
627
+ /**
628
+ * A persisted workload this draw refuses as STALE — issued under a contract
629
+ * version this build no longer mints.
630
+ *
631
+ * A contract-version bump changes the work item's SHAPE (v1alpha1's
632
+ * `{complexity, risk}` metadata became v1alpha2's shared `demand` ranking), so
633
+ * the document on disk cannot be re-derived against the current builder and no
634
+ * submission can be accepted against it. The class is worth its own type
635
+ * because it has exactly ONE repair — re-prepare, which publishes a current
636
+ * workload — and a host holding a bound result path from the stale document
637
+ * must be told that rather than told its bytes are the wrong shape.
638
+ *
639
+ * Without this the whole class escaped as a bare `Invalid audit host work item`
640
+ * throw out of the fold: a message that named neither the version found, nor
641
+ * the version expected, nor the repair. The remediate twin took the same cut at
642
+ * its own v1alpha2 (`REMEDIATION_HOST_WORKLOAD_CONTRACT_VERSION`, ed033294),
643
+ * where a v1alpha1 document refuses closed the same way.
644
+ */
645
+ class StaleAuditHostWorkloadError extends Error {
646
+ found_contract_version;
647
+ expected_contract_version;
648
+ /** The registered ingestion check the refusal is attributable to. */
649
+ check = "workload_binding";
650
+ /** The audit issue vocabulary's name for this class of refusal. */
651
+ code = "workload_stale";
652
+ constructor(found_contract_version, expected_contract_version) {
653
+ super("the persisted audit host workload is STALE: it was issued under contract " +
654
+ `version ${JSON.stringify(found_contract_version)}, but this build mints ` +
655
+ `${expected_contract_version}. A version bump changes the work item shape, so the ` +
656
+ "document cannot be re-derived and no submission can be accepted against it — " +
657
+ "re-prepare the handoff to publish a current workload.");
658
+ this.found_contract_version = found_contract_version;
659
+ this.expected_contract_version = expected_contract_version;
660
+ this.name = "StaleAuditHostWorkloadError";
661
+ }
662
+ }
663
+ /**
664
+ * A persisted binding set this build no longer mints — the task-binding twin of
665
+ * {@link StaleAuditHostWorkloadError}, and classified by the same rule.
666
+ *
667
+ * It exists as a CLASS and not as a plain throw because of what the fold does
668
+ * with an uncaught error: `runHostDelegationObligation` rethrows everything that
669
+ * is not ENOENT, and it ingests BEFORE the one path that re-prepares
670
+ * (`ensureSemanticReviewRunUnlocked` → `renderSemanticReviewStep` →
671
+ * `prepareAuditHostHandoff`, the ONLY writer of this file). A bare throw
672
+ * therefore aborted the fold before the re-prepare, the blocked-step backstop
673
+ * wrote a blocked step, and every later `next-step` failed identically with the
674
+ * bindings file still at the old version — a wedge produced by a file the tool
675
+ * had written itself.
676
+ *
677
+ * Classified, the ingest returns it as an ISSUE and the fold walks on to the
678
+ * re-prepare in the SAME call, which rewrites the whole set at the current
679
+ * version. The stale file is then read by nothing.
680
+ */
681
+ class StaleAuditHostTaskBindingsError extends Error {
682
+ found_contract_version;
683
+ expected_contract_version;
684
+ /** The registered ingestion check the refusal is attributable to. */
685
+ check = "workload_binding";
686
+ /** The audit issue vocabulary's name for this class of refusal. */
687
+ code = "workload_stale";
688
+ constructor(found_contract_version, expected_contract_version) {
689
+ super("the persisted audit host task bindings are STALE: they were issued under " +
690
+ `contract version ${JSON.stringify(found_contract_version)}, but this build ` +
691
+ `mints ${expected_contract_version}. A version bump changes the binding SHAPE, ` +
692
+ "so the set cannot be re-derived and no submission bound against it can be " +
693
+ `accepted — ${TASK_BINDINGS_VERSION_REMEDY}.`);
694
+ this.found_contract_version = found_contract_version;
695
+ this.expected_contract_version = expected_contract_version;
696
+ this.name = "StaleAuditHostTaskBindingsError";
697
+ }
698
+ }
349
699
  function parseWorkload(value, runId) {
350
700
  // Envelope + all-items parsing is the CORE's scaffolding; the audit draw
351
701
  // selects only its own contract version and item parser.
@@ -354,11 +704,21 @@ function parseWorkload(value, runId) {
354
704
  runId,
355
705
  });
356
706
  if (!envelope.ok) {
357
- throw new Error("Invalid audit host workload");
707
+ // The core's envelope check is a conjunction, so it reports "wrong version",
708
+ // "wrong run" and "not a workload at all" identically. The STALE case is the
709
+ // one that must be separated — it is the one with a named repair — so the
710
+ // raw document's own version is read here, before the generic refusal, and
711
+ // any DIFFERENT version (present, but not ours) is classified as stale.
712
+ if (isRecord(value) &&
713
+ "contract_version" in value &&
714
+ value.contract_version !== WORKLOAD_CONTRACT_VERSION) {
715
+ throw new StaleAuditHostWorkloadError(value.contract_version, WORKLOAD_CONTRACT_VERSION);
716
+ }
717
+ throw bindingFailure("workload_binding", "Invalid audit host workload");
358
718
  }
359
719
  const workItems = parseAllWorkloadItems(envelope.rawItems, parseWorkItem);
360
720
  if (workItems === null) {
361
- throw new Error("Invalid audit host work item");
721
+ throw bindingFailure("workload_binding", "Invalid audit host work item");
362
722
  }
363
723
  return value;
364
724
  }
@@ -389,6 +749,7 @@ function parseTaskBinding(value) {
389
749
  "pass_id",
390
750
  "prompt_sha256",
391
751
  "result_path",
752
+ "tags",
392
753
  "unit_id",
393
754
  "work_item_id",
394
755
  ]) ||
@@ -398,6 +759,13 @@ function parseTaskBinding(value) {
398
759
  typeof value.unit_id !== "string" ||
399
760
  typeof value.pass_id !== "string" ||
400
761
  typeof value.lens !== "string" ||
762
+ // REQUIRED, and refused as a VERSION problem rather than a shape problem —
763
+ // see parseTaskBindings. A binding without the lane stamp cannot be judged:
764
+ // the lane decides which result contract this item's prompt carried, so an
765
+ // absent stamp is not a field to default, it is an item whose contract is
766
+ // unknown.
767
+ !Array.isArray(value.tags) ||
768
+ !value.tags.every((entry) => typeof entry === "string") ||
401
769
  !isRecord(value.file_line_counts) ||
402
770
  !Object.values(value.file_line_counts).every((count) => Number.isInteger(count) && count >= 0)) {
403
771
  return null;
@@ -407,11 +775,20 @@ function parseTaskBinding(value) {
407
775
  function parseTaskBindings(value, runId) {
408
776
  if (!isRecord(value) ||
409
777
  !hasExactKeys(value, ["contract_version", "entries", "run_id"]) ||
410
- value.contract_version !== TASK_BINDINGS_CONTRACT_VERSION ||
411
778
  value.run_id !== runId ||
412
779
  !Array.isArray(value.entries)) {
413
780
  throw new Error("Invalid audit host task bindings");
414
781
  }
782
+ // The VERSION is checked on its OWN, before the shape walk, so a binding set
783
+ // written under an older version is refused for THAT reason and carries the
784
+ // remedy. Folded into the predicate below it would be one more way to produce
785
+ // "Invalid audit host task bindings", which tells an operator nothing about
786
+ // what to do and reads as a corrupt file rather than a stale one. The class
787
+ // is what the ingest CLASSIFIES on (see `ingestAuditHostResults`) instead of
788
+ // letting the throw abort the fold before it re-prepares.
789
+ if (value.contract_version !== TASK_BINDINGS_CONTRACT_VERSION) {
790
+ throw new StaleAuditHostTaskBindingsError(value.contract_version, TASK_BINDINGS_CONTRACT_VERSION);
791
+ }
415
792
  const bindings = new Map();
416
793
  for (const rawEntry of value.entries) {
417
794
  const entry = parseTaskBinding(rawEntry);
@@ -475,27 +852,27 @@ function issueLocation(prefix, path) {
475
852
  function parseFindings(findings) {
476
853
  const parsedFindings = [];
477
854
  for (const [index, finding] of findings.entries()) {
478
- // S7: `grounding` is the TOOL's re-check of the worker's own quote — the one
479
- // bit ingestion exists to compute. A submission that supplies it is
480
- // self-certifying that bit, so it is REFUSED (never silently overwritten):
481
- // the host must see that the field is not its to send. Stated ahead of the
482
- // schema check because this message names the field as the WORKER's mistake;
483
- // the strict schema would report it only as an unrecognized key.
484
- if (isRecord(finding) && "grounding" in finding) {
485
- return {
486
- ok: false,
487
- detail: `findings[${index}].grounding: grounding is tool-computed at ingest and must not be supplied`,
488
- };
489
- }
490
- // The same refusal for the second tool-owned verdict: `verification_status`
491
- // is DERIVED at conceptual ingest from the judge's per-candidate claims, so a
492
- // worker-supplied value would bypass the derivation and be
493
- // un-cross-checkable against the adjudication record.
494
- if (isRecord(finding) && "verification_status" in finding) {
495
- return {
496
- ok: false,
497
- detail: `findings[${index}].verification_status: verification_status is tool-derived at ingest and must not be supplied`,
498
- };
855
+ // The TOOL-owned verdicts are REFUSED, never silently overwritten: the host
856
+ // must see that the field is not its to send, and a value the worker
857
+ // supplied for one of these is by construction a self-certification of the
858
+ // bit ingestion exists to compute. Stated ahead of the schema check because
859
+ // this message names the field as the WORKER's mistake; the strict schema
860
+ // would report it only as an unrecognized key.
861
+ //
862
+ // The list is the schema's own omit set (`WORKER_REFUSED_FINDING_VERDICTS`
863
+ // feeds both), so a verdict cannot be refused here and advertised there, or
864
+ // the reverse. `evidence_lane` is the load-bearing one: synthesis reads it
865
+ // to decide whether a `critical` was ever asked for an `evidence` array, so
866
+ // a supplied lane is a finding exempting ITSELF from the bar.
867
+ if (isRecord(finding)) {
868
+ for (const [verdict, reason] of Object.entries(WORKER_REFUSED_FINDING_VERDICTS)) {
869
+ if (verdict in finding) {
870
+ return {
871
+ ok: false,
872
+ detail: `findings[${index}].${verdict}: ${reason}`,
873
+ };
874
+ }
875
+ }
499
876
  }
500
877
  // The STRICT WORKER PROJECTION — the same contract the dispatch prompt
501
878
  // renders (`findingContractPromptLines`). Parsing the lenient base schema
@@ -518,30 +895,54 @@ function parseFindings(findings) {
518
895
  return { ok: true, findings: parsedFindings };
519
896
  }
520
897
  function parseHostResult(value, runId, item, binding) {
898
+ const hasVerification = isRecord(value) && Object.hasOwn(value, "verification");
521
899
  if (!isRecord(value) ||
522
900
  !hasExactKeys(value, [
523
- "contract_version",
524
- "file_coverage",
525
- "findings",
526
- "prompt_sha256",
527
- "result_id",
528
- "run_id",
529
- "work_item_id",
901
+ ...AUDIT_RESULT_ENVELOPE_KEYS,
902
+ // `verification` is the ONE optional key: required of no lane, asked of
903
+ // the steward lane, and refused when supplied to a lane whose contract
904
+ // never mentions it (see the lane check below). Every other key stays
905
+ // exact, so the envelope still admits nothing a host invents.
906
+ ...(hasVerification ? ["verification"] : []),
530
907
  ]) ||
531
908
  value.contract_version !== RESULT_CONTRACT_VERSION ||
532
909
  typeof value.result_id !== "string" ||
533
910
  value.result_id.length === 0) {
534
911
  return refuse("result_envelope", `result envelope is not ${RESULT_CONTRACT_VERSION} with exactly contract_version, ` +
535
- `result_id, run_id, work_item_id, prompt_sha256, file_coverage and findings`);
912
+ `result_id, run_id, work_item_id, prompt_sha256, file_coverage and findings` +
913
+ `${hasVerification ? ", and at most one verification object" : ""}`);
536
914
  }
537
- if (value.run_id !== runId) {
538
- return refuse("identity_binding", `identity binding: run_id is not this run's '${runId}'`);
915
+ // The identity walk is the CORE's, in the core's order AND in the core's
916
+ // words, so both draws report the same first-broken component, described the
917
+ // same way, for the same submission. Only the framing around it is this
918
+ // draw's. The per-component branches this replaced were a second vocabulary
919
+ // for the one classification — and they could not cover `result_id` at all,
920
+ // because the envelope check above already requires a non-empty one, so that
921
+ // component's failure had no branch and read as fully bound.
922
+ const identityFailure = identityFailureDiagnostic(value, {
923
+ runId,
924
+ workItemId: item.id,
925
+ promptSha256: item.prompt.sha256,
926
+ });
927
+ if (identityFailure !== null) {
928
+ return refuse("identity_binding", `identity binding: ${identityFailure}`);
539
929
  }
540
- if (value.work_item_id !== item.id) {
541
- return refuse("identity_binding", `identity binding: work_item_id is not '${item.id}'`);
930
+ // The lane gate. `verification` is admitted by the envelope so the steward
931
+ // lane can deliver what its own instruction asks for — but a base-lane work
932
+ // item's prompt never mentions it, so a submission carrying one is answering
933
+ // an ask that was never made. Refusing it HERE (rather than ignoring it) is
934
+ // what keeps the field from becoming a way to smuggle unattested metadata
935
+ // past a contract that does not describe it: `validateVerification` would
936
+ // merely WARN, and a warning on an accepted result is not a gate.
937
+ if (hasVerification && !isVerificationLane(binding.tags)) {
938
+ return refuse("result_envelope", "verification metadata was supplied for a work item whose contract does not request it; " +
939
+ "remove the field or submit it through a lens_verification work item");
542
940
  }
543
- if (value.prompt_sha256 !== item.prompt.sha256) {
544
- return refuse("identity_binding", "prompt binding: prompt_sha256 is not the sha256 of this work item's prompt");
941
+ if (hasVerification) {
942
+ const verificationFailure = verificationContractFailure(value.verification, binding, value);
943
+ if (verificationFailure !== null) {
944
+ return refuse("result_envelope", verificationFailure);
945
+ }
545
946
  }
546
947
  if (!Array.isArray(value.file_coverage)) {
547
948
  return refuse("file_coverage", "file coverage: file_coverage must be an array");
@@ -601,6 +1002,12 @@ function toAuditResult(result, binding) {
601
1002
  const findings = result.findings.map((finding) => ({
602
1003
  ...finding,
603
1004
  lens: finding.lens ?? binding.lens,
1005
+ // The LANE stamp, at the ingest that knows which contract the finding
1006
+ // arrived on — the per-file worker contract, since that is the only door
1007
+ // this module parses. Stamped rather than left absent so a reader never has
1008
+ // to decide whether an absent value is the per-file default or a finding
1009
+ // that predates the field (see `FindingEvidenceLaneSchema`).
1010
+ evidence_lane: "per-file-lane",
604
1011
  }));
605
1012
  const parsed = AuditResultSchema.safeParse({
606
1013
  task_id: binding.work_item_id,
@@ -608,6 +1015,7 @@ function toAuditResult(result, binding) {
608
1015
  pass_id: binding.pass_id,
609
1016
  lens: binding.lens,
610
1017
  file_coverage: result.file_coverage
1018
+ // construction-site: CoverageFileRecord
611
1019
  .map((coverage) => ({
612
1020
  path: coverage.path,
613
1021
  total_lines: coverage.total_lines,
@@ -616,6 +1024,13 @@ function toAuditResult(result, binding) {
616
1024
  findings,
617
1025
  reviewed_clean: result.findings.length === 0,
618
1026
  run_id: result.run_id,
1027
+ // Threaded through, not re-validated: `AuditResultSchema` declares
1028
+ // `verification` and the ONE validator (`validateVerification`, reached from
1029
+ // `validateAuditResults` at the caller) judges its interior. Validating it a
1030
+ // second time here would be a second rule that can drift from the first.
1031
+ ...(result.verification === undefined
1032
+ ? {}
1033
+ : { verification: result.verification }),
619
1034
  });
620
1035
  if (parsed.success)
621
1036
  return { ok: true, auditResult: parsed.data };
@@ -648,9 +1063,50 @@ function auditScanMessages(workItemId) {
648
1063
  export async function ingestAuditHostResults(params) {
649
1064
  const paths = resolveBoundaryPaths(params);
650
1065
  const accepted = await loadAcceptedResults(paths.acceptedLedgerPath, params.runId);
651
- const workload = parseWorkload(await readJsonFile(paths.workloadPath), params.runId);
1066
+ // A STALE persisted document is refused as a CLASSIFIED ISSUE, never as a
1067
+ // throw. These are the refusals with a named repair — re-prepare, which this
1068
+ // fold performs on its way to the next emission — so they must reach the host
1069
+ // as rendered diagnostics rather than as unclassified stacks out of the fold.
1070
+ // Nothing is accepted: a document this build did not mint cannot be
1071
+ // re-derived, so no submission has a binding to be judged against.
1072
+ //
1073
+ // The BINDING SET is in this class for one more reason than the workload is:
1074
+ // on the fold, a throw here lands BEFORE the one path that re-prepares, so it
1075
+ // wedges the run rather than surfacing anything (see
1076
+ // {@link StaleAuditHostTaskBindingsError}). A result the host already wrote
1077
+ // under the old bindings is therefore REFUSED as stale — it is never accepted
1078
+ // against the new contract, because the new contract's binding is what the
1079
+ // re-prepare mints, and the item is re-published under it.
1080
+ const stale = (error) => ({
1081
+ accepted_count: 0,
1082
+ accepted_results: accepted.entries.map((entry) => entry.audit_result),
1083
+ accepted_results_path: paths.acceptedResultsPath,
1084
+ completed_work_item_ids: [
1085
+ ...new Set(accepted.entries.map((entry) => entry.work_item_id)),
1086
+ ].sort(compareCodeUnits),
1087
+ issues: [error],
1088
+ raw_issues: [error],
1089
+ validation_warnings: [],
1090
+ });
1091
+ let workload;
1092
+ try {
1093
+ workload = parseWorkload(await readJsonFile(paths.workloadPath), params.runId);
1094
+ }
1095
+ catch (error) {
1096
+ if (!(error instanceof StaleAuditHostWorkloadError))
1097
+ throw error;
1098
+ return stale(error);
1099
+ }
652
1100
  const resultMap = parseResultMap(await readJsonFile(paths.resultMapPath), params.runId);
653
- const taskBindings = parseTaskBindings(await readJsonFile(paths.taskBindingsPath), params.runId);
1101
+ let taskBindings;
1102
+ try {
1103
+ taskBindings = parseTaskBindings(await readJsonFile(paths.taskBindingsPath), params.runId);
1104
+ }
1105
+ catch (error) {
1106
+ if (!(error instanceof StaleAuditHostTaskBindingsError))
1107
+ throw error;
1108
+ return stale(error);
1109
+ }
654
1110
  const items = validateHandoffBinding(paths, workload, resultMap, taskBindings);
655
1111
  const acceptedBindings = new Set(accepted.entries.map(bindingIdentity));
656
1112
  const resultIds = new Set(accepted.entries.map((entry) => entry.result_id));
@@ -757,6 +1213,8 @@ export async function ingestAuditHostResults(params) {
757
1213
  finding.grounding = await verifyFindingGrounding(paths.root, finding, readSource);
758
1214
  }
759
1215
  resultIds.add(result.result_id);
1216
+ // construction-site: AuditResult
1217
+ // construction-site: Finding (the `findings` array; `lens` defaults from the enclosing contract, already spread in)
760
1218
  additions.push({
761
1219
  work_item_id: entry.work_item_id,
762
1220
  prompt_sha256: entry.prompt_sha256,