audit-tools 0.52.5 → 0.53.0

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 (347) hide show
  1. package/dist/audit/cli/auditStep.d.ts +1 -1
  2. package/dist/audit/cli/dispatch/hostHandoff.d.ts +2 -0
  3. package/dist/audit/cli/dispatch/hostHandoff.d.ts.map +1 -1
  4. package/dist/audit/cli/dispatch/hostHandoff.js +1 -1
  5. package/dist/audit/cli/dispatch/hostHandoff.js.map +1 -1
  6. package/dist/audit/cli/dispatch/packetFilter.d.ts +1 -1
  7. package/dist/audit/cli/dispatch/packetFilter.d.ts.map +1 -1
  8. package/dist/audit/cli/dispatch/packetFilter.js +1 -1
  9. package/dist/audit/cli/dispatch/packetFilter.js.map +1 -1
  10. package/dist/audit/cli/nextStepCommand.d.ts.map +1 -1
  11. package/dist/audit/cli/nextStepCommand.js +42 -20
  12. package/dist/audit/cli/nextStepCommand.js.map +1 -1
  13. package/dist/audit/cli/nextStepHelpers.d.ts +3 -3
  14. package/dist/audit/cli/nextStepHelpers.d.ts.map +1 -1
  15. package/dist/audit/cli/nextStepHelpers.js +50 -75
  16. package/dist/audit/cli/nextStepHelpers.js.map +1 -1
  17. package/dist/audit/cli/prompts.d.ts +1 -2
  18. package/dist/audit/cli/prompts.d.ts.map +1 -1
  19. package/dist/audit/cli/prompts.js +2 -12
  20. package/dist/audit/cli/prompts.js.map +1 -1
  21. package/dist/audit/cli/sampleRunCommand.d.ts +2 -2
  22. package/dist/audit/cli/semanticReviewStep.d.ts +11 -2
  23. package/dist/audit/cli/semanticReviewStep.d.ts.map +1 -1
  24. package/dist/audit/cli/semanticReviewStep.js +14 -10
  25. package/dist/audit/cli/semanticReviewStep.js.map +1 -1
  26. package/dist/audit/contracts/workerSchemas.d.ts +14 -14
  27. package/dist/audit/contracts/wrapperResponse.d.ts +6 -6
  28. package/dist/audit/extractors/graphRoutes.d.ts.map +1 -1
  29. package/dist/audit/extractors/graphRoutes.js +1 -3
  30. package/dist/audit/extractors/graphRoutes.js.map +1 -1
  31. package/dist/audit/io/artifacts.d.ts.map +1 -1
  32. package/dist/audit/io/artifacts.js +2 -3
  33. package/dist/audit/io/artifacts.js.map +1 -1
  34. package/dist/audit/orchestrator/architectureDiscovery.d.ts +11 -0
  35. package/dist/audit/orchestrator/architectureDiscovery.d.ts.map +1 -0
  36. package/dist/audit/orchestrator/architectureDiscovery.js +174 -0
  37. package/dist/audit/orchestrator/architectureDiscovery.js.map +1 -0
  38. package/dist/audit/orchestrator/designReviewProjection.d.ts +2 -6
  39. package/dist/audit/orchestrator/designReviewProjection.d.ts.map +1 -1
  40. package/dist/audit/orchestrator/designReviewProjection.js +2 -6
  41. package/dist/audit/orchestrator/designReviewProjection.js.map +1 -1
  42. package/dist/audit/orchestrator/designReviewSnapshot.d.ts +2 -3
  43. package/dist/audit/orchestrator/designReviewSnapshot.d.ts.map +1 -1
  44. package/dist/audit/orchestrator/designReviewSnapshot.js +2 -3
  45. package/dist/audit/orchestrator/designReviewSnapshot.js.map +1 -1
  46. package/dist/audit/orchestrator/executorRunners.d.ts.map +1 -1
  47. package/dist/audit/orchestrator/executorRunners.js +1 -22
  48. package/dist/audit/orchestrator/executorRunners.js.map +1 -1
  49. package/dist/audit/orchestrator/executors.d.ts.map +1 -1
  50. package/dist/audit/orchestrator/executors.js +1 -13
  51. package/dist/audit/orchestrator/executors.js.map +1 -1
  52. package/dist/audit/orchestrator/nextStep.d.ts +2 -28
  53. package/dist/audit/orchestrator/nextStep.d.ts.map +1 -1
  54. package/dist/audit/orchestrator/nextStep.js +5 -37
  55. package/dist/audit/orchestrator/nextStep.js.map +1 -1
  56. package/dist/audit/orchestrator/obligationDerive.d.ts +2 -3
  57. package/dist/audit/orchestrator/obligationDerive.d.ts.map +1 -1
  58. package/dist/audit/orchestrator/obligationDerive.js +2 -3
  59. package/dist/audit/orchestrator/obligationDerive.js.map +1 -1
  60. package/dist/audit/orchestrator/pendingTasks.d.ts +2 -0
  61. package/dist/audit/orchestrator/pendingTasks.d.ts.map +1 -1
  62. package/dist/audit/orchestrator/pendingTasks.js +5 -1
  63. package/dist/audit/orchestrator/pendingTasks.js.map +1 -1
  64. package/dist/audit/orchestrator/planningExecutors.d.ts.map +1 -1
  65. package/dist/audit/orchestrator/planningExecutors.js +9 -0
  66. package/dist/audit/orchestrator/planningExecutors.js.map +1 -1
  67. package/dist/audit/orchestrator/requeueCommand.d.ts +1 -1
  68. package/dist/audit/orchestrator/resultBaseline.d.ts +5 -5
  69. package/dist/audit/orchestrator/resultBaseline.d.ts.map +1 -1
  70. package/dist/audit/orchestrator/resultBaseline.js +24 -47
  71. package/dist/audit/orchestrator/resultBaseline.js.map +1 -1
  72. package/dist/audit/orchestrator/selectiveDeepening/findingFollowup.d.ts.map +1 -1
  73. package/dist/audit/orchestrator/selectiveDeepening/findingFollowup.js +2 -0
  74. package/dist/audit/orchestrator/selectiveDeepening/findingFollowup.js.map +1 -1
  75. package/dist/audit/orchestrator/state.d.ts.map +1 -1
  76. package/dist/audit/orchestrator/state.js +2 -0
  77. package/dist/audit/orchestrator/state.js.map +1 -1
  78. package/dist/audit/orchestrator/synthesisExecutors.d.ts.map +1 -1
  79. package/dist/audit/orchestrator/synthesisExecutors.js +3 -0
  80. package/dist/audit/orchestrator/synthesisExecutors.js.map +1 -1
  81. package/dist/audit/types/auditState.d.ts +6 -6
  82. package/dist/audit/types/flowCoverage.d.ts +6 -6
  83. package/dist/audit/types.d.ts +12 -12
  84. package/dist/remediate/contractPipeline/executionPlan.d.ts +1908 -0
  85. package/dist/remediate/contractPipeline/executionPlan.d.ts.map +1 -0
  86. package/dist/remediate/contractPipeline/executionPlan.js +467 -0
  87. package/dist/remediate/contractPipeline/executionPlan.js.map +1 -0
  88. package/dist/remediate/contractPipeline/runtimePlanAuthority.d.ts +12 -0
  89. package/dist/remediate/contractPipeline/runtimePlanAuthority.d.ts.map +1 -0
  90. package/dist/remediate/contractPipeline/runtimePlanAuthority.js +41 -0
  91. package/dist/remediate/contractPipeline/runtimePlanAuthority.js.map +1 -0
  92. package/dist/remediate/dedup/crossLensDedup.d.ts +3 -16
  93. package/dist/remediate/dedup/crossLensDedup.d.ts.map +1 -1
  94. package/dist/remediate/dedup/crossLensDedup.js +2 -32
  95. package/dist/remediate/dedup/crossLensDedup.js.map +1 -1
  96. package/dist/remediate/index.d.ts +2 -19
  97. package/dist/remediate/index.d.ts.map +1 -1
  98. package/dist/remediate/index.js +22 -138
  99. package/dist/remediate/index.js.map +1 -1
  100. package/dist/remediate/intake.d.ts +10 -10
  101. package/dist/remediate/intent/intentOrdering.d.ts +6 -8
  102. package/dist/remediate/intent/intentOrdering.d.ts.map +1 -1
  103. package/dist/remediate/intent/intentOrdering.js +24 -47
  104. package/dist/remediate/intent/intentOrdering.js.map +1 -1
  105. package/dist/remediate/phases/close.d.ts +25 -17
  106. package/dist/remediate/phases/close.d.ts.map +1 -1
  107. package/dist/remediate/phases/close.js +278 -218
  108. package/dist/remediate/phases/close.js.map +1 -1
  109. package/dist/remediate/phases/closeAcceptance.d.ts +42 -0
  110. package/dist/remediate/phases/closeAcceptance.d.ts.map +1 -0
  111. package/dist/remediate/phases/closeAcceptance.js +66 -0
  112. package/dist/remediate/phases/closeAcceptance.js.map +1 -0
  113. package/dist/remediate/phases/closeReviewProvenance.d.ts +1 -1
  114. package/dist/remediate/phases/closeReviewProvenance.d.ts.map +1 -1
  115. package/dist/remediate/phases/closeReviewProvenance.js +9 -8
  116. package/dist/remediate/phases/closeReviewProvenance.js.map +1 -1
  117. package/dist/remediate/phases/closeVerifyAnalyzerLeads.d.ts.map +1 -1
  118. package/dist/remediate/phases/closeVerifyAnalyzerLeads.js +11 -9
  119. package/dist/remediate/phases/closeVerifyAnalyzerLeads.js.map +1 -1
  120. package/dist/remediate/phases/closeVerifyHeadEvidence.d.ts +21 -86
  121. package/dist/remediate/phases/closeVerifyHeadEvidence.d.ts.map +1 -1
  122. package/dist/remediate/phases/closeVerifyHeadEvidence.js +30 -19
  123. package/dist/remediate/phases/closeVerifyHeadEvidence.js.map +1 -1
  124. package/dist/remediate/phases/plan.d.ts +3 -60
  125. package/dist/remediate/phases/plan.d.ts.map +1 -1
  126. package/dist/remediate/phases/plan.js +3 -227
  127. package/dist/remediate/phases/plan.js.map +1 -1
  128. package/dist/remediate/phases/triage.d.ts.map +1 -1
  129. package/dist/remediate/phases/triage.js +19 -30
  130. package/dist/remediate/phases/triage.js.map +1 -1
  131. package/dist/remediate/riskSignal.d.ts +9 -43
  132. package/dist/remediate/riskSignal.d.ts.map +1 -1
  133. package/dist/remediate/riskSignal.js +7 -28
  134. package/dist/remediate/riskSignal.js.map +1 -1
  135. package/dist/remediate/state/disposition.d.ts +2 -1
  136. package/dist/remediate/state/disposition.d.ts.map +1 -1
  137. package/dist/remediate/state/disposition.js +37 -1
  138. package/dist/remediate/state/disposition.js.map +1 -1
  139. package/dist/remediate/state/runIdentity.d.ts +2 -13
  140. package/dist/remediate/state/runIdentity.d.ts.map +1 -1
  141. package/dist/remediate/state/runIdentity.js +3 -13
  142. package/dist/remediate/state/runIdentity.js.map +1 -1
  143. package/dist/remediate/state/store.d.ts +12 -36
  144. package/dist/remediate/state/store.d.ts.map +1 -1
  145. package/dist/remediate/state/store.js +58 -150
  146. package/dist/remediate/state/store.js.map +1 -1
  147. package/dist/remediate/state/types.d.ts +406 -504
  148. package/dist/remediate/state/types.d.ts.map +1 -1
  149. package/dist/remediate/state/types.js +24 -104
  150. package/dist/remediate/state/types.js.map +1 -1
  151. package/dist/remediate/steps/contractPipeline.d.ts +7 -661
  152. package/dist/remediate/steps/contractPipeline.d.ts.map +1 -1
  153. package/dist/remediate/steps/contractPipeline.js +259 -3854
  154. package/dist/remediate/steps/contractPipeline.js.map +1 -1
  155. package/dist/remediate/steps/contractPipelinePrompts.d.ts +20 -142
  156. package/dist/remediate/steps/contractPipelinePrompts.d.ts.map +1 -1
  157. package/dist/remediate/steps/contractPipelinePrompts.js +48 -581
  158. package/dist/remediate/steps/contractPipelinePrompts.js.map +1 -1
  159. package/dist/remediate/steps/dispatch/contractConformanceReview.d.ts +4 -1
  160. package/dist/remediate/steps/dispatch/contractConformanceReview.d.ts.map +1 -1
  161. package/dist/remediate/steps/dispatch/contractConformanceReview.js +6 -3
  162. package/dist/remediate/steps/dispatch/contractConformanceReview.js.map +1 -1
  163. package/dist/remediate/steps/dispatch/hostContracts.d.ts +1 -1
  164. package/dist/remediate/steps/dispatch/hostContracts.d.ts.map +1 -1
  165. package/dist/remediate/steps/dispatch/hostHandoff.d.ts +4 -21
  166. package/dist/remediate/steps/dispatch/hostHandoff.d.ts.map +1 -1
  167. package/dist/remediate/steps/dispatch/hostHandoff.js +161 -383
  168. package/dist/remediate/steps/dispatch/hostHandoff.js.map +1 -1
  169. package/dist/remediate/steps/finalGate.d.ts +34 -0
  170. package/dist/remediate/steps/finalGate.d.ts.map +1 -1
  171. package/dist/remediate/steps/finalGate.js +44 -4
  172. package/dist/remediate/steps/finalGate.js.map +1 -1
  173. package/dist/remediate/steps/frictionCloseout.d.ts +1 -30
  174. package/dist/remediate/steps/frictionCloseout.d.ts.map +1 -1
  175. package/dist/remediate/steps/frictionCloseout.js +6 -99
  176. package/dist/remediate/steps/frictionCloseout.js.map +1 -1
  177. package/dist/remediate/steps/nextStep.d.ts +2 -15
  178. package/dist/remediate/steps/nextStep.d.ts.map +1 -1
  179. package/dist/remediate/steps/nextStep.js +255 -1028
  180. package/dist/remediate/steps/nextStep.js.map +1 -1
  181. package/dist/remediate/steps/prompts.js +12 -12
  182. package/dist/remediate/steps/prompts.js.map +1 -1
  183. package/dist/remediate/steps/stepUtils.d.ts +1 -1
  184. package/dist/remediate/steps/stepUtils.d.ts.map +1 -1
  185. package/dist/remediate/steps/types.d.ts +1 -1
  186. package/dist/remediate/steps/types.d.ts.map +1 -1
  187. package/dist/remediate/steps/types.js +1 -1
  188. package/dist/remediate/steps/types.js.map +1 -1
  189. package/dist/remediate/types/options.d.ts +9 -0
  190. package/dist/remediate/types/options.d.ts.map +1 -1
  191. package/dist/remediate/validation/artifacts.d.ts.map +1 -1
  192. package/dist/remediate/validation/artifacts.js +10 -56
  193. package/dist/remediate/validation/artifacts.js.map +1 -1
  194. package/dist/remediate/validation/remediationState.d.ts +2 -2
  195. package/dist/remediate/validation/remediationState.d.ts.map +1 -1
  196. package/dist/remediate/validation/remediationState.js +17 -77
  197. package/dist/remediate/validation/remediationState.js.map +1 -1
  198. package/dist/remediate/validation/verificationReport.d.ts +3 -0
  199. package/dist/remediate/validation/verificationReport.d.ts.map +1 -0
  200. package/dist/remediate/validation/verificationReport.js +28 -0
  201. package/dist/remediate/validation/verificationReport.js.map +1 -0
  202. package/dist/shared/analyzers/types.d.ts +10 -10
  203. package/dist/shared/engine/obligationEngine.d.ts +2 -2
  204. package/dist/shared/friction/triage.d.ts +7 -28
  205. package/dist/shared/friction/triage.d.ts.map +1 -1
  206. package/dist/shared/friction/triage.js +7 -28
  207. package/dist/shared/friction/triage.js.map +1 -1
  208. package/dist/shared/graph/orderedReachability.js +1 -1
  209. package/dist/shared/graph/orderedReachability.js.map +1 -1
  210. package/dist/shared/index.d.ts +5 -6
  211. package/dist/shared/index.d.ts.map +1 -1
  212. package/dist/shared/index.js +3 -4
  213. package/dist/shared/index.js.map +1 -1
  214. package/dist/shared/loopCorePaths.d.ts.map +1 -1
  215. package/dist/shared/loopCorePaths.js +6 -0
  216. package/dist/shared/loopCorePaths.js.map +1 -1
  217. package/dist/shared/prompts.d.ts +1 -2
  218. package/dist/shared/prompts.d.ts.map +1 -1
  219. package/dist/shared/prompts.js +1 -2
  220. package/dist/shared/prompts.js.map +1 -1
  221. package/dist/shared/reReview/projectionDiff.d.ts.map +1 -1
  222. package/dist/shared/reReview/projectionDiff.js +6 -14
  223. package/dist/shared/reReview/projectionDiff.js.map +1 -1
  224. package/dist/shared/types/executionPlan.d.ts +416 -0
  225. package/dist/shared/types/executionPlan.d.ts.map +1 -0
  226. package/dist/shared/types/executionPlan.js +132 -0
  227. package/dist/shared/types/executionPlan.js.map +1 -0
  228. package/dist/shared/types/remediationOutcome.d.ts +1378 -12
  229. package/dist/shared/types/remediationOutcome.d.ts.map +1 -1
  230. package/dist/shared/types/remediationOutcome.js +29 -1
  231. package/dist/shared/types/remediationOutcome.js.map +1 -1
  232. package/dist/shared/types/{contractPipeline/verification.d.ts → verificationReport.d.ts} +9 -37
  233. package/dist/shared/types/verificationReport.d.ts.map +1 -0
  234. package/dist/shared/types/verificationReport.js +4 -0
  235. package/dist/shared/types/verificationReport.js.map +1 -0
  236. package/dist/shared/validation/findingGrounding.d.ts +3 -5
  237. package/dist/shared/validation/findingGrounding.d.ts.map +1 -1
  238. package/dist/shared/validation/findingGrounding.js +4 -7
  239. package/dist/shared/validation/findingGrounding.js.map +1 -1
  240. package/package.json +1 -1
  241. package/dist/remediate/contractPipeline/artifactNames.d.ts +0 -8
  242. package/dist/remediate/contractPipeline/artifactNames.d.ts.map +0 -1
  243. package/dist/remediate/contractPipeline/artifactNames.js +0 -28
  244. package/dist/remediate/contractPipeline/artifactNames.js.map +0 -1
  245. package/dist/remediate/contractPipeline/artifactStore.d.ts +0 -219
  246. package/dist/remediate/contractPipeline/artifactStore.d.ts.map +0 -1
  247. package/dist/remediate/contractPipeline/artifactStore.js +0 -436
  248. package/dist/remediate/contractPipeline/artifactStore.js.map +0 -1
  249. package/dist/remediate/contractPipeline/changeClassification.d.ts +0 -130
  250. package/dist/remediate/contractPipeline/changeClassification.d.ts.map +0 -1
  251. package/dist/remediate/contractPipeline/changeClassification.js +0 -446
  252. package/dist/remediate/contractPipeline/changeClassification.js.map +0 -1
  253. package/dist/remediate/contractPipeline/contractReviewBinding.d.ts +0 -28
  254. package/dist/remediate/contractPipeline/contractReviewBinding.d.ts.map +0 -1
  255. package/dist/remediate/contractPipeline/contractReviewBinding.js +0 -75
  256. package/dist/remediate/contractPipeline/contractReviewBinding.js.map +0 -1
  257. package/dist/remediate/contractPipeline/counterexampleFingerprint.d.ts +0 -27
  258. package/dist/remediate/contractPipeline/counterexampleFingerprint.d.ts.map +0 -1
  259. package/dist/remediate/contractPipeline/counterexampleFingerprint.js +0 -37
  260. package/dist/remediate/contractPipeline/counterexampleFingerprint.js.map +0 -1
  261. package/dist/remediate/contractPipeline/cyclicSeamResolution.d.ts +0 -131
  262. package/dist/remediate/contractPipeline/cyclicSeamResolution.d.ts.map +0 -1
  263. package/dist/remediate/contractPipeline/cyclicSeamResolution.js +0 -257
  264. package/dist/remediate/contractPipeline/cyclicSeamResolution.js.map +0 -1
  265. package/dist/remediate/contractPipeline/derive.d.ts +0 -173
  266. package/dist/remediate/contractPipeline/derive.d.ts.map +0 -1
  267. package/dist/remediate/contractPipeline/derive.js +0 -477
  268. package/dist/remediate/contractPipeline/derive.js.map +0 -1
  269. package/dist/remediate/contractPipeline/finalizedContractFields.d.ts +0 -50
  270. package/dist/remediate/contractPipeline/finalizedContractFields.d.ts.map +0 -1
  271. package/dist/remediate/contractPipeline/finalizedContractFields.js +0 -77
  272. package/dist/remediate/contractPipeline/finalizedContractFields.js.map +0 -1
  273. package/dist/remediate/contractPipeline/idRegistry.d.ts +0 -144
  274. package/dist/remediate/contractPipeline/idRegistry.d.ts.map +0 -1
  275. package/dist/remediate/contractPipeline/idRegistry.js +0 -214
  276. package/dist/remediate/contractPipeline/idRegistry.js.map +0 -1
  277. package/dist/remediate/contractPipeline/obligationKinds.d.ts +0 -27
  278. package/dist/remediate/contractPipeline/obligationKinds.d.ts.map +0 -1
  279. package/dist/remediate/contractPipeline/obligationKinds.js +0 -18
  280. package/dist/remediate/contractPipeline/obligationKinds.js.map +0 -1
  281. package/dist/remediate/contractPipeline/phaseCut.d.ts +0 -125
  282. package/dist/remediate/contractPipeline/phaseCut.d.ts.map +0 -1
  283. package/dist/remediate/contractPipeline/phaseCut.js +0 -339
  284. package/dist/remediate/contractPipeline/phaseCut.js.map +0 -1
  285. package/dist/remediate/contractPipeline/phaseCutArtifact.d.ts +0 -31
  286. package/dist/remediate/contractPipeline/phaseCutArtifact.d.ts.map +0 -1
  287. package/dist/remediate/contractPipeline/phaseCutArtifact.js +0 -48
  288. package/dist/remediate/contractPipeline/phaseCutArtifact.js.map +0 -1
  289. package/dist/remediate/contractPipeline/repairState.d.ts +0 -110
  290. package/dist/remediate/contractPipeline/repairState.d.ts.map +0 -1
  291. package/dist/remediate/contractPipeline/repairState.js +0 -185
  292. package/dist/remediate/contractPipeline/repairState.js.map +0 -1
  293. package/dist/remediate/contractPipeline/reviewSnapshot.d.ts +0 -79
  294. package/dist/remediate/contractPipeline/reviewSnapshot.d.ts.map +0 -1
  295. package/dist/remediate/contractPipeline/reviewSnapshot.js +0 -140
  296. package/dist/remediate/contractPipeline/reviewSnapshot.js.map +0 -1
  297. package/dist/remediate/contractPipeline/semanticProjection.d.ts +0 -64
  298. package/dist/remediate/contractPipeline/semanticProjection.d.ts.map +0 -1
  299. package/dist/remediate/contractPipeline/semanticProjection.js +0 -136
  300. package/dist/remediate/contractPipeline/semanticProjection.js.map +0 -1
  301. package/dist/remediate/contractPipeline/sketchSource.d.ts +0 -194
  302. package/dist/remediate/contractPipeline/sketchSource.d.ts.map +0 -1
  303. package/dist/remediate/contractPipeline/sketchSource.js +0 -262
  304. package/dist/remediate/contractPipeline/sketchSource.js.map +0 -1
  305. package/dist/remediate/contractPipeline/testPlanCarry.d.ts +0 -17
  306. package/dist/remediate/contractPipeline/testPlanCarry.d.ts.map +0 -1
  307. package/dist/remediate/contractPipeline/testPlanCarry.js +0 -72
  308. package/dist/remediate/contractPipeline/testPlanCarry.js.map +0 -1
  309. package/dist/remediate/steps/dispatch/marshal.d.ts +0 -7
  310. package/dist/remediate/steps/dispatch/marshal.d.ts.map +0 -1
  311. package/dist/remediate/steps/dispatch/marshal.js +0 -11
  312. package/dist/remediate/steps/dispatch/marshal.js.map +0 -1
  313. package/dist/remediate/validation/contractPipeline.d.ts +0 -35
  314. package/dist/remediate/validation/contractPipeline.d.ts.map +0 -1
  315. package/dist/remediate/validation/contractPipeline.js +0 -613
  316. package/dist/remediate/validation/contractPipeline.js.map +0 -1
  317. package/dist/remediate/validation/contractPipelineGates.d.ts +0 -272
  318. package/dist/remediate/validation/contractPipelineGates.d.ts.map +0 -1
  319. package/dist/remediate/validation/contractPipelineGates.js +0 -1397
  320. package/dist/remediate/validation/contractPipelineGates.js.map +0 -1
  321. package/dist/shared/types/contractPipeline/design.d.ts +0 -79
  322. package/dist/shared/types/contractPipeline/design.d.ts.map +0 -1
  323. package/dist/shared/types/contractPipeline/design.js +0 -16
  324. package/dist/shared/types/contractPipeline/design.js.map +0 -1
  325. package/dist/shared/types/contractPipeline/goal.d.ts +0 -41
  326. package/dist/shared/types/contractPipeline/goal.d.ts.map +0 -1
  327. package/dist/shared/types/contractPipeline/goal.js +0 -10
  328. package/dist/shared/types/contractPipeline/goal.js.map +0 -1
  329. package/dist/shared/types/contractPipeline/implementation.d.ts +0 -118
  330. package/dist/shared/types/contractPipeline/implementation.d.ts.map +0 -1
  331. package/dist/shared/types/contractPipeline/implementation.js +0 -13
  332. package/dist/shared/types/contractPipeline/implementation.js.map +0 -1
  333. package/dist/shared/types/contractPipeline/obligations.d.ts +0 -283
  334. package/dist/shared/types/contractPipeline/obligations.d.ts.map +0 -1
  335. package/dist/shared/types/contractPipeline/obligations.js +0 -84
  336. package/dist/shared/types/contractPipeline/obligations.js.map +0 -1
  337. package/dist/shared/types/contractPipeline/verification.d.ts.map +0 -1
  338. package/dist/shared/types/contractPipeline/verification.js +0 -10
  339. package/dist/shared/types/contractPipeline/verification.js.map +0 -1
  340. package/dist/shared/types/contractPipeline.d.ts +0 -48
  341. package/dist/shared/types/contractPipeline.d.ts.map +0 -1
  342. package/dist/shared/types/contractPipeline.js +0 -32
  343. package/dist/shared/types/contractPipeline.js.map +0 -1
  344. package/dist/shared/types/obligationLedger.d.ts +0 -39
  345. package/dist/shared/types/obligationLedger.d.ts.map +0 -1
  346. package/dist/shared/types/obligationLedger.js +0 -49
  347. package/dist/shared/types/obligationLedger.js.map +0 -1
@@ -1,677 +1,23 @@
1
- import { type ConceptualCritiqueRepairTarget } from "../../shared/types/contractPipeline/design.js";
2
- import { type ValidationIssue, type JudgeReport, type WorkBlock, type WorkBlockSeam, type AuditRead } from "audit-tools/shared";
3
- import { OBLIGATION_KIND_PRIORITY, type ObligationKind } from "../contractPipeline/obligationKinds.js";
4
- import { readIntakeRiskSignal, type AdversarialDepth } from "../riskSignal.js";
5
- import type { JudgeRepairTarget } from "audit-tools/shared";
6
- import { type ContractPipelineCrossGateInputs, type GateOutcome } from "../validation/contractPipelineGates.js";
7
- import type { ContractPipelineArtifactName } from "../contractPipeline/artifactStore.js";
8
1
  import type { RemediationStep } from "./types.js";
9
- import { intakePaths } from "../intake.js";
10
- /**
11
- * Runaway backstop for the judge↔repair loop — the LOUD exception path, NOT the
12
- * normal terminator. The loop normally terminates by *convergence*: it keeps
13
- * repairing only while each round surfaces a genuinely NEW accepted counterexample
14
- * (real progress), reaches a fixpoint when the judge approves, and escalates to the
15
- * user the moment a round re-accepts an already-addressed counterexample without
16
- * progress (a stall/oscillation). This ceiling exists only so a pathological run
17
- * that keeps minting brand-new accepted counterexamples forever cannot loop without
18
- * bound; hitting it is itself an escalation (loud), never a silent proceed. It is
19
- * deliberately generous — a genuinely deep but converging design (each round a new
20
- * real defect) must not be cut mid-convergence (the failure mode of the former N=2).
21
- */
22
- export declare const MAX_CONTRACT_REPAIR_ITERATIONS = 8;
23
- /** Maximum implementation_dag regenerations after traceability rejections. */
24
- export declare const MAX_DAG_REGENERATION_ATTEMPTS = 2;
25
- /**
26
- * Maximum LLM cycle-break resolution attempts before routing to user-decision
27
- * (and, if that also fails, to `blocked`).
28
- */
29
- export declare const MAX_CYCLIC_SEAM_RESOLUTION_ATTEMPTS = 2;
30
- export interface CyclicSeamRepairState {
31
- schema_version: "remediate-code-contract-pipeline/cyclic-seam-repair-state/v1alpha1";
32
- /**
33
- * Each attempt to resolve the detected cycles (keyed by obligation_ledger
34
- * hash). `recheck_reason` records WHY the re-check rejected an attempt, so the
35
- * next resolution prompt can state it instead of re-asking for the same claim
36
- * and burning the attempt cap on an unexplained retry.
37
- */
38
- attempts: {
39
- ledger_hash: string;
40
- at: string;
41
- recheck_passed: boolean;
42
- recheck_reason?: string;
43
- }[];
44
- /** Whether a user-decision step has been emitted. */
45
- user_decision_emitted: boolean;
46
- }
47
- export declare function readCyclicSeamRepairState(artifactsDir: string): Promise<CyclicSeamRepairState>;
48
- export declare function writeCyclicSeamRepairState(artifactsDir: string, state: CyclicSeamRepairState): Promise<void>;
49
- /** Outcome of an archive attempt. */
50
- export interface ArchiveOutcome {
51
- /**
52
- * Timestamped history path the original was moved to, or undefined when the
53
- * source did not exist (nothing to archive).
54
- */
55
- archivedPath?: string;
56
- /**
57
- * True when the original path is now free for a fresh Write (the move
58
- * succeeded, or there was nothing to archive). False when the move failed and
59
- * the original was preserved in place — the caller must NOT assume the path is
60
- * re-authorable.
61
- */
62
- originalFree: boolean;
63
- }
64
- /**
65
- * Archive an artifact into `<contract>/history/` instead of deleting it, so a
66
- * repair loop never silently destroys an LLM output. Two disjoint files exist
67
- * per artifact (D3): the host's plain INPUT (`<name>.input.json` — the LLM
68
- * emission) and the tool's canonical envelope (`<name>.json` — regenerable
69
- * bookkeeping). On a stale/invalid re-emit BOTH are moved to history: the input
70
- * to preserve the LLM output AND free its path for a fresh host Write, the
71
- * canonical so the completion gate (`contractArtifactExists`) re-fires and the
72
- * producing phase re-emits. The returned `archivedPath` references the input
73
- * archive when present (what the host re-authors), else the canonical archive.
74
- * A tool-derived artifact with no input file (e.g. a merged-shard artifact)
75
- * archives only its canonical envelope. If any move throws, the rest are left
76
- * in place (`originalFree: false`) rather than silently dropped. `renameFn` is a
77
- * DI seam so a failed history move is testable.
78
- */
79
- export declare function archiveContractArtifact(artifactsDir: string, name: ContractPipelineArtifactName, label: "stale" | "invalid", renameFn?: (from: string, to: string) => Promise<void>): Promise<ArchiveOutcome>;
80
- /**
81
- * The explicit re-author signpost appended to every inline rejection re-emit:
82
- * the prior output was archived, so the worker must Write a fresh complete
83
- * artifact at the ORIGINAL path — never Edit the previous (now-archived) file.
84
- */
85
- export declare function rejectionRewriteInstruction(archived: {
86
- archivedPath?: string;
87
- originalFree?: boolean;
88
- } | string | undefined): string;
89
- export interface ContractIngestionResult {
90
- /** Raw worker payloads that validated and were wrapped into envelopes. */
91
- ingested: ContractPipelineArtifactName[];
92
- /** Raw worker payloads that failed validation (archived; phase re-emitted). */
93
- invalid: {
94
- name: ContractPipelineArtifactName;
95
- issues: ValidationIssue[];
96
- unavailable?: boolean;
97
- }[];
98
- /** Previously reviewed context changed; freshness work must run upstream-first. */
99
- stale?: ContractPipelineArtifactName[];
100
- }
101
- /**
102
- * Derive validated canonical envelopes from the host's plain INPUT files (D3).
103
- * The host writes the bare payload the role schema describes to
104
- * `<name>.input.json`; the tool reads it here, validates it, and writes the
105
- * content-hash envelope to the canonical `<name>.json` — the host's input file
106
- * is never mutated in place. CP_ARTIFACT_NAMES is dependency-ordered, so
107
- * dependencies are enveloped before their dependents and dependency hashes are
108
- * always available.
109
- */
110
- export declare function ingestContractArtifacts(artifactsDir: string, adversarialDepth?: AdversarialDepth): Promise<ContractIngestionResult>;
111
- export interface ContractPipelineCheckResult {
112
- /** True when the contract pipeline should handle the next step. */
113
- shouldHandleContractPipeline: boolean;
114
- /** True when all pipeline phases (up to implementation_dag) are complete. */
115
- pipelineComplete: boolean;
116
- }
117
- /**
118
- * Determine whether the contract pipeline should be entered for this run.
119
- * The pipeline is entered for ALL intake source types (structured_audit,
120
- * document, conversation) when an extracted-plan.json has not yet been
121
- * produced. Path A (structured_audit) seeds the pipeline via a path_a_seed.json
122
- * before the first phase step, so goal_normalization and context_collection
123
- * prompts can reference the auditor findings.
124
- */
125
- export declare function shouldEnterContractPipeline(artifactsDir: string, _intakeSourceType: string | undefined): ContractPipelineCheckResult;
126
- /** Return the first pipeline phase whose output artifact does not exist. */
127
- export declare function nextMissingContractPhase(artifactsDir: string): string | null;
2
+ export { readApprovedExecutionPlan } from "../contractPipeline/executionPlan.js";
128
3
  export interface ContractPipelineStepOptions {
129
4
  root: string;
130
5
  artifactsDir: string;
131
6
  runId: string;
132
7
  sourcePaths?: string[];
133
- /**
134
- * The same DI seam {@link archiveContractArtifact} already exposes, lifted to
135
- * the entry point so a FAILED history move is reachable from an end-to-end
136
- * test. Undefined uses `node:fs/promises` rename, so production behavior is
137
- * unchanged. It exists because the archive-failure branch (COR-114e4941) is a
138
- * correctness gate whose whole point is what the pipeline does when the move
139
- * does not succeed — a branch no fixture can reach by arranging files.
140
- */
141
- renameFn?: (from: string, to: string) => Promise<void>;
142
- }
143
- export interface PathASeed {
144
- schema_version: "remediate-code-contract-pipeline/path-a-seed/v1alpha2";
145
- /** Absolute path to the audit-findings.json source file. */
146
- audit_findings_path: string;
147
- /** Number of findings in the report. */
148
- finding_count: number;
149
- /** Short per-finding summaries (id + title + lens). */
150
- findings_summary: Array<{
151
- id: string;
152
- title: string;
153
- lens: string;
154
- }>;
155
- /** Repo-relative paths cited as affected_files across all findings. */
156
- affected_files: string[];
157
- /** Auditor-produced bounded work topology. */
158
- work_blocks: WorkBlock[];
159
- /** Explicit cross-block overlaps; required seams must be prepared before refactors. */
160
- work_block_seams: WorkBlockSeam[];
161
- /**
162
- * Seed source-digest binding. One sha256 per source path the seed was built
163
- * FROM, recorded at seed-build time: the audit-findings file itself plus every
164
- * `affected_files` path that existed on disk. `buildNextContractPipelineStep`
165
- * re-hashes each on entry and refuses when one no longer matches, instead of
166
- * spending a whole design pipeline on content that no longer holds the
167
- * findings the seed enumerates.
168
- *
169
- * OPTIONAL for READING, always written for WRITING: a seed persisted before
170
- * this field existed carries none, and an absent list binds nothing rather
171
- * than blocking a run mid-flight. Paths are stored exactly as the seed knows
172
- * them — the findings path absolute, `affected_files` repo-relative — and the
173
- * verifier resolves a relative entry against the repo root it is handed.
174
- */
175
- source_digests?: Array<{
176
- path: string;
177
- sha256: string;
178
- }>;
179
- created_at: string;
180
- }
181
- /**
182
- * Write a Path-A seed file from a parsed audit-findings report.
183
- * The seed is written once (idempotent: skipped when it already exists).
184
- * goal_normalization and context_collection prompts detect the seed and
185
- * include its contents so every pipeline node traces to an auditor finding.
186
- */
187
- export declare function writePathASeedFromFindings(artifactsDir: string, auditFindingsPath: string, auditFindings: unknown): Promise<void>;
188
- /** One seed-recorded source path whose content no longer matches its digest. */
189
- export interface SeedSourceDigestMismatch {
190
- path: string;
191
- expected: string;
192
- /** The path's current sha256, or `null` when it is no longer readable. */
193
- actual: string | null;
194
- }
195
- /**
196
- * The tool-named accept lane for seed-source drift — the file an OPERATOR writes
197
- * to record "this drift is reviewed and does not invalidate the findings".
198
- *
199
- * A digest is a whole-file byte binding, so it moves for changes no finding is
200
- * about: a release `version` bump in `package.json` moves the digest of every
201
- * finding that cited `package.json` and blocked the run. The alarm was right
202
- * that SOMETHING moved and wrong about whether the findings still held — there
203
- * was no way to say so, and the run's remaining options were re-auditing or
204
- * deleting the seed.
205
- *
206
- * WHY THE ACCEPT IS AN OPERATOR FILE AND NOT A DERIVED VERDICT. The tempting
207
- * mechanical predicate is "do the drifted file's cited locations still exist"
208
- * (line N still present). It is unsound in the direction that matters: a finding
209
- * asserting "the config parser returns null on malformed input" cites line 42,
210
- * and rewriting that line to throw leaves line 42 present, the digest
211
- * moved, and the finding FALSE — the predicate accepts and the run designs
212
- * against a claim the code no longer makes. That inference cannot be made from
213
- * line counts by a language-neutral tool, and a predicate that is right about
214
- * version bumps and wrong about behaviour changes is worse than no predicate:
215
- * it silently converts "the alarm fired" into "the alarm was satisfied". So the
216
- * judgment stays where it can actually be made — with the operator, recorded,
217
- * and attributable — and the tool enforces only the shape of the record.
218
- */
219
- export interface SeedSourceAcceptance {
220
- /** The seed-recorded source path this decision covers (repo-relative). */
221
- path: string;
222
- /** Why the drift does not invalidate the findings. Required, non-empty. */
223
- rationale: string;
224
- /**
225
- * Who decided. Attributable identity, like the counterexample waiver and the
226
- * loop-core review attestation — no mechanical channel can prove WHO decided,
227
- * so the record names the decider rather than pretending to verify them.
228
- */
229
- accepted_by: string;
8
+ forceRevision?: boolean;
230
9
  }
231
- /** The tool-named host lane: the operator's drift acceptances land here. */
232
- export declare function seedSourceAcceptancesPath(artifactsDir: string): string;
233
- /**
234
- * Read the operator's acceptances, keyed by the same path normalization the
235
- * mismatch side uses. A malformed entry is DROPPED, never widened: an acceptance
236
- * missing its rationale or its decider records no decision, and treating it as
237
- * one would turn a shape defect into a silent bypass of the alarm.
238
- */
239
- export declare function readSeedSourceAcceptances(artifactsDir: string): Promise<Map<string, SeedSourceAcceptance>>;
240
- /**
241
- * The seed paths the operator's acceptance file covers, applied to the drifted
242
- * set under the ONE path normalization both sides share; everything else blocks.
243
- *
244
- * This is the accept path and it is deliberately the ONLY automatic one: the
245
- * gate cannot tell a benign drift from a falsifying one, and the one predicate
246
- * that claimed to (cited line counts) was unsound — see {@link SeedSourceAcceptance}.
247
- */
248
- export declare function partitionSeedSourceDrift(artifactsDir: string, mismatches: readonly SeedSourceDigestMismatch[]): Promise<{
249
- accepted: Array<SeedSourceAcceptance & {
250
- mismatch: SeedSourceDigestMismatch;
251
- }>;
252
- blocking: SeedSourceDigestMismatch[];
253
- }>;
254
- /**
255
- * Seed source-digest binding — re-hash every path the path_a seed recorded and
256
- * report the ones that moved. Pure over (root, seed): the caller decides what a
257
- * mismatch means, so this is directly red-green testable without a pipeline.
258
- *
259
- * A seed with no `source_digests` (written before the field existed) binds
260
- * nothing and yields no mismatches.
261
- */
262
- export declare function detectSeedSourceDigestMismatches(root: string, seed: PathASeed | undefined): Promise<SeedSourceDigestMismatch[]>;
263
- /**
264
- * When a judge report omits `repair_directive`, infer the repair target from
265
- * the failing classifications. Post-redesign the default is
266
- * `finalized_module_contracts` (not `design_spec`).
267
- */
268
- type ExtendedRepairTarget = Exclude<JudgeRepairTarget, "design_spec">;
269
- /**
270
- * Infer the most appropriate repair target from judge classifications when no
271
- * explicit repair_directive is provided. Examines only accepted classifications
272
- * and keyword-matches their rationale text.
273
- *
274
- * Priority (first match wins):
275
- * obligation/ledger/invariant/constraint keywords → obligation_ledger
276
- * assessment/finding/gap keywords → contract_assessment_report
277
- * fallback → finalized_module_contracts
278
- */
279
- export declare function inferRepairTarget(classifications: JudgeReport["classifications"] | undefined): ExtendedRepairTarget;
280
- type JudgeGate = {
281
- kind: "proceed";
282
- } | {
283
- kind: "escalate";
284
- reason: "stall" | "runaway" | "invalid_waivers";
285
- /** Accepted counterexample ids still standing — waived ones excluded. */
286
- outstanding: string[];
287
- note: string;
288
- /** Present only for reason "invalid_waivers": why the file was refused. */
289
- waiverIssues?: string[];
290
- } | {
291
- kind: "repair";
292
- directive: {
293
- target: ExtendedRepairTarget;
294
- instruction: string;
295
- };
296
- judgeHash: string;
297
- acceptedCeIds: string[];
298
- addressedCeFingerprints: string[];
299
- };
300
- /**
301
- * Decide whether implementation planning may proceed. Convergence-terminated,
302
- * NOT capped at an arbitrary count:
303
- * - approved verdict ⇒ proceed (the fixpoint);
304
- * - a needs_repair verdict that surfaces a NEW accepted counterexample (one not
305
- * already addressed by a prior repair) ⇒ repair (genuine progress);
306
- * - a needs_repair verdict whose accepted counterexamples were ALL already
307
- * addressed ⇒ escalate (stall/oscillation — the repair loop is not converging,
308
- * surface the outstanding counterexamples to the user instead of silently
309
- * shipping residual risk or looping);
310
- * - the runaway backstop (MAX_CONTRACT_REPAIR_ITERATIONS) ⇒ escalate (loud).
311
- * The former fixed N=2 cap that proceeded-with-residual-risk at an arbitrary count
312
- * is gone: a deep-but-converging run is no longer cut mid-convergence, and a
313
- * genuinely non-converging run is surfaced rather than buried.
314
- */
315
- export declare function evaluateJudgeGate(artifactsDir: string): Promise<JudgeGate>;
316
- type CritiqueGate = {
317
- kind: "proceed";
318
- } | {
319
- kind: "escalate";
320
- reason: "stall" | "runaway" | "unsupported_target";
321
- blocking: string[];
322
- note: string;
323
- } | {
324
- kind: "repair";
325
- critiqueHash: string;
326
- blockingIds: string[];
327
- target: ConceptualCritiqueRepairTarget;
328
- };
329
- /**
330
- * Decide whether the pipeline may advance past the conceptual-design critique.
331
- *
332
- * The routing signal is MECHANICAL and derived only from the critique items: a
333
- * critique carrying ANY `severity: "blocking"` item means the design is not
334
- * approved and must be repaired — regardless of the author-stated `verdict`
335
- * string. This closes the contradictory-combo gap: a critique that marks items
336
- * `blocking` while declaring `approved` / `approved_with_concerns` (which the
337
- * pipeline previously waved through, since only a judge verdict ever gated
338
- * anything) no longer silently proceeds. Enforce-in-tooling: the verdict label
339
- * is advisory display; the blocking-item set is the contract.
340
- *
341
- * Convergence-terminated, mirroring {@link evaluateJudgeGate}: the first blocking
342
- * critique ⇒ repair its declared owner (legacy: `finalized_module_contracts`); repairing it
343
- * re-stales and re-emits the critique (it depends on the finalized contracts), so
344
- * a clean re-critique ⇒ proceed (the fixpoint). A fresh critique whose blocking
345
- * ids were ALL already addressed by a prior repair, with none new ⇒ escalate
346
- * (stall — the design loop is not converging) rather than repair forever; the
347
- * runaway backstop also escalates (loud).
348
- */
349
- export declare function evaluateCritiqueGate(artifactsDir: string): Promise<CritiqueGate>;
350
- export interface DagTraceabilityResult {
351
- ok: boolean;
352
- violations: string[];
353
- }
354
- /**
355
- * The traceability invariant: no implementation_dag node may exist without
356
- * tracing to an obligation from the ledger (satisfies_obligations or
357
- * verification_obligation_ids) or to a judge-accepted counterexample
358
- * (addresses_counterexamples). Untraceable nodes are unattributable work — the
359
- * exact thing the contract pipeline exists to prevent.
360
- */
361
- export declare function validateImplementationDagTraceability(artifactsDir: string): Promise<DagTraceabilityResult>;
362
- export interface ContractObligationsGateResult {
363
- ok: boolean;
364
- violations: string[];
365
- }
366
- /**
367
- * Run the fail-closed contract-obligation gates against the persisted contract
368
- * artifacts: paired obligations, evidence threading, source-scoped digest
369
- * coverage, and INV-CO-12 reconciliation derivation.
370
- *
371
- * Branch on `evaluated` before trusting emptiness. This no longer flattens four `ValidationIssue[]`
372
- * into one array, where a gate that never RAN and a gate that ran CLEAN both
373
- * contributed nothing and were indistinguishable. It consumes the shared
374
- * gate-outcome record and branches on `evaluated` first: at this boundary every
375
- * phase artifact exists, so a skipped gate is a violation, not a pass. See
376
- * {@link consumeGateOutcomes} for the per-boundary `required` policy and the one
377
- * declared exception (`digest_coverage`).
378
- */
379
- export declare function evaluateContractObligationsPromotionGate(artifactsDir: string, root?: string, inputs?: ContractPipelineCrossGateInputs): Promise<ContractObligationsGateResult>;
380
- /**
381
- * Pre-adversarial structural floor (S5). The subset of the contract-obligation
382
- * gates whose inputs all exist by the time the critic phase is reached
383
- * (paired-obligation coverage, source-scoped digest coverage, and seam
384
- * reconciliation derivation — none of which need the judge verdict or the
385
- * implementation_dag). Running them BEFORE the expensive critic/judge loop means
386
- * the adversarial phases only ever see structurally-sound obligations, tests, and
387
- * contracts, and a structural gap is re-emitted to the precise responsible phase
388
- * instead of being discovered at promotion (after the adversarial budget is spent)
389
- * and re-emitted to the wrong phase. The full {@link evaluateContractObligationsPromotionGate}
390
- * — including the evidence-threading check that needs the judge + DAG — still runs
391
- * at promotion as the fail-closed backstop; this gate never replaces it.
392
- *
393
- * Returns the first failing gate's responsible phase + rendered error lines, or
394
- * null when the structural floor is clean. Branches on each outcome's
395
- * `evaluated` before its empty issue list is allowed to mean clean
396
- * (the branch-on-evaluated rule); `contract_finalization`, `seam_reconciliation`
397
- * and `test_validator_plan` all precede `critic` in the phase order, so a
398
- * skipped gate here is a malformed payload rather than an absent one.
399
- */
400
- export declare function evaluatePreCriticStructuralGate(artifactsDir: string, root?: string, inputs?: ContractPipelineCrossGateInputs): Promise<{
401
- phase: "contract_finalization" | "test_validator_plan";
402
- errorLines: string[];
403
- } | null>;
404
- /**
405
- * Promotion-backstop citation grounding over the promoted extracted-plan
406
- * findings. Returns rendered violation lines, or null when every finding grounds.
407
- */
408
- export declare function evaluatePromotedPlanCitationGrounding(artifactsDir: string, repoRoot: string): Promise<{
409
- violations: string[];
410
- } | null>;
411
- /** The phase(s) that fan out per module, and the artifact each produces. */
412
- declare const PARALLEL_MODULE_PHASES: {
413
- readonly module_contract_drafting: "module_contracts";
414
- };
415
- type ParallelModulePhase = keyof typeof PARALLEL_MODULE_PHASES;
416
- export declare function isParallelModulePhase(phase: string): phase is ParallelModulePhase;
417
- /**
418
- * Resolve the adversarial-depth dial for a run (extracted from
419
- * buildNextContractPipelineStep for testability; behavior-preserving).
420
- *
421
- * The depth derives from the intake risk signal (the slice-2 shared signal).
422
- * Escalate-on-evidence (optimistic-start): the run begins at the cheap intake
423
- * tier; once decomposition reveals the work's actual shape, the tier is raised
424
- * for THIS and every subsequent next-step. The raise is idempotent + convergent
425
- * (escalateRiskSignal no-ops once the tier already covers the evidence), and the
426
- * signal is rewritten only on a real raise. Absent signal ⇒ undefined ⇒ the
427
- * renderer applies its fail-safe full depth (floor is `light`, never off).
428
- */
429
10
  export declare function resolveAdversarialDepth(artifactsDir: string): Promise<{
430
- riskSignal: Awaited<ReturnType<typeof readIntakeRiskSignal>>;
431
- adversarialDepth: AdversarialDepth | undefined;
11
+ riskSignal: import("../riskSignal.js").IntakeRiskSignal | undefined;
12
+ adversarialDepth: import("../riskSignal.js").AdversarialDepth;
432
13
  }>;
433
- /**
434
- * Everything a gate is handed. Assembled once per invocation, then passed to
435
- * every gate in the walk, so each gate is a module-level function that can be
436
- * called and tested on its own.
437
- *
438
- * Two fields are deliberately MUTABLE, each written by exactly one gate:
439
- * • `artifactsSettled` — set by the staleness gate once this invocation's own
440
- * ingestion + archive pass has run. {@link readCrossGatePayloads} REFUSES
441
- * before it is set, which is how the branch-on-evaluated invariant's freshness
442
- * half is enforced mechanically instead of by a caller remembering to
443
- * re-read: a payload cached from before the pass is unrepresentable.
444
- * • `nextPhase` — the phase frontier, resolved AFTER the archive pass because
445
- * archiving a stale artifact re-opens its producing phase.
446
- */
447
- export interface ContractGateContext {
448
- readonly options: ContractPipelineStepOptions;
449
- readonly root: string;
450
- readonly artifactsDir: string;
451
- readonly runId: string;
452
- readonly sourcePaths?: string[];
453
- readonly paths: ReturnType<typeof intakePaths>;
454
- readonly artifactPaths: Partial<Record<ContractPipelineArtifactName, string>>;
455
- readonly artifactReadPaths: Partial<Record<ContractPipelineArtifactName, string>>;
456
- /** Present only for structured_audit (path-A) runs. */
457
- readonly pathASeedPath?: string;
458
- readonly riskSignal: Awaited<ReturnType<typeof readIntakeRiskSignal>>;
459
- readonly adversarialDepth: AdversarialDepth | undefined;
460
- artifactsSettled: boolean;
461
- nextPhase: string | null;
462
- }
463
- /** The verdict a call site derives from a subset of the shared gate outcomes. */
464
- export interface CrossGateVerdict {
465
- ok: boolean;
466
- violations: string[];
467
- }
468
- /**
469
- * Consume a subset of the shared cross-gate outcomes, branching on `evaluated`
470
- * BEFORE an empty `issues` array is allowed to mean "clean".
471
- *
472
- * `required` is DECLARED PER CALL SITE, as data, because "did not run" means
473
- * different things at different boundaries. At a boundary whose upstream phase
474
- * order guarantees the gate's input exists, a skip is a refusal — its empty
475
- * issue list is proof of nothing. Earlier in the pipeline the same skip means
476
- * "not applicable yet", and the gate is simply not required there.
477
- *
478
- * THE UNCOVERED HALF, stated rather than implied: `digest_coverage` is the one
479
- * gate of the eight whose skip is a DOMAIN non-applicability (a source that is
480
- * not finding-enumerable) rather than a missing payload, so no boundary lists
481
- * it as required and a genuinely absent finding-enumeration file for an
482
- * enumerable source still skips silently. Closing that needs the gate module to
483
- * expose its enumerability predicate — an edit outside this work item's write
484
- * scope.
485
- */
486
- export declare function consumeGateOutcomes(outcomes: readonly GateOutcome[], selected: readonly GateOutcome["gate"][], required: ReadonlySet<GateOutcome["gate"]>): CrossGateVerdict;
487
- /**
488
- * The ONE worker prompt for cyclic-seam resolution. The gate emits it for each
489
- * attempt, and every generic re-emit of the phase (a refused ingestion, a stale
490
- * archive, a goal-id mismatch) emits it too — a second, shorter text used to
491
- * reach the worker on those re-emits and left out the ledger rewrite that the
492
- * re-check requires, so the retry was refused for a rule it was never told.
493
- *
494
- * The worker writes only `resolved`: `no_cycles` is the tool's own record, and
495
- * the re-check refuses any record while the ledger still has a cycle.
496
- */
497
- export declare function renderCyclicSeamResolutionPrompt(params: {
498
- cycleDescriptions: string;
499
- ledgerInputPath: string;
500
- outputPath: string;
501
- extraSection?: string;
502
- }): string;
503
- /**
504
- * The gate walk order, exported so a drift guard reads the real set instead of
505
- * reconstructing one by reflecting over a chain of `if` statements.
506
- *
507
- * This and the scaffold's `handledKeys` are BOTH `Object.keys` of the SAME
508
- * object literal, and the walk consumes `handledKeys` directly — so the two
509
- * agree by construction, not by a test that compares them. No such test exists,
510
- * and none is needed: there is no second list to drift from.
511
- */
512
- export declare const CONTRACT_PIPELINE_GATE_ORDER: readonly string[];
513
- /**
514
- * Build and write the next contract-pipeline step.
515
- * Returns null when the pipeline is complete and the extracted plan is ready.
516
- */
14
+ export declare function writePathASeedFromFindings(artifactsDir: string, sourcePath: string, payload: unknown): Promise<void>;
15
+ /** One author/revision loop, with independent review over the executable plan itself. */
517
16
  export declare function buildNextContractPipelineStep(options: ContractPipelineStepOptions): Promise<RemediationStep | null>;
518
- /**
519
- * The obligation-kind vocabulary, in priority order (higher index = higher
520
- * priority; `invariant` is highest).
521
- *
522
- * MNT-114e4941-3: this used to be a THIRD independent copy of the vocabulary —
523
- * a local `type ObligationKind` union beside derive.ts's `TESTABLE_KINDS` and
524
- * contractPipelineGates.ts's `TESTABLE_OBLIGATION_KINDS`, with nothing forcing
525
- * the three to agree, while the ledger's own `obligation.kind` is typed as a
526
- * bare `string`. The consequence was not theoretical: an unrecognized kind was
527
- * CAST to this union, scored -1 by `indexOf`, and then indexed the lens map to
528
- * `undefined` — so a ledger kind outside these four promoted a finding with
529
- * `lens: undefined`.
530
- *
531
- * Membership and priority are now derived from the single definition list in
532
- * `contractPipeline/obligationKinds.ts`. An unrecognized kind is not dropped or
533
- * cast: it is routed through the shared `isTestablePhaseObligation` predicate.
534
- */
535
- export { OBLIGATION_KIND_PRIORITY };
536
- export type { ObligationKind };
537
- /**
538
- * Classify a raw ledger `kind` string (which the ledger types as a bare
539
- * `string`) into this module's vocabulary. A recognized kind maps to itself; an
540
- * unrecognized one is classified by the SHARED testability predicate rather
541
- * than guessed here — testable ⇒ `behavioral` (the testable default, so it
542
- * carries a real lens and a mid severity), otherwise ⇒ `structural`.
543
- */
544
- export declare function classifyObligationKind(kind: string): ObligationKind;
545
- /**
546
- * Normalize one block's declared write scope into repo-relative, forward-slashed,
547
- * unique, sorted paths, refusing outright anything that leaves the repository.
548
- *
549
- * Case is PRESERVED (`repoRelativePath`, not the lowercasing
550
- * `normalizeRepoPath`): this string is the write scope a host enforces against a
551
- * landed diff on a case-sensitive filesystem, so lowercasing it would make a
552
- * legitimate edit look out of scope. Lowercasing is used only as a MATCH key,
553
- * never as the stored value.
554
- *
555
- * The tracked-tree half is NOT here: see
556
- * {@link evaluatePromotedPlanWriteScope}, which runs at this same promotion
557
- * boundary with a bounded re-emit instead of an unrecoverable throw.
558
- */
559
17
  export interface BlockWriteScopeNormalization {
560
- /** The entries that normalized cleanly, repo-relative, unique and sorted. */
561
18
  touched_files: string[];
562
- /** One line per REFUSED entry. Non-empty ⇒ the caller must not promote. */
563
19
  refusals: string[];
564
20
  }
565
- export declare function normalizeBlockTouchedFiles(root: string, files: readonly string[], blockId: string): BlockWriteScopeNormalization;
566
- /**
567
- * The tracked-tree half of The normalized-write-scope invariant, run against
568
- * the PROMOTED plan so a violation takes the same bounded re-emit path the M-B3
569
- * citation gate takes, rather than throwing out of the promotion.
570
- *
571
- * It exists because the citation gate is NOT a superset: a finding grounds if
572
- * ANY cited path OR SYMBOL is real, so a node whose prose names a real symbol
573
- * can ground while its declared write scope is still fabricated — and the write
574
- * scope is what a host binds a worker to.
575
- *
576
- * A path that is not tracked but whose parent directory IS stays legal: a
577
- * remediation block legitimately creates new files, and dropping a declared
578
- * write target is the failure mode that strands an implementer with an
579
- * obligation it has no scope to discharge. Fail-open on an unreadable tree, as
580
- * the citation gate does.
581
- */
582
- export declare function evaluatePromotedPlanWriteScope(artifactsDir: string, root: string): Promise<{
583
- violations: string[];
584
- } | null>;
585
- /**
586
- * Tracked-tree parity for a POST-promotion write-scope widening
587
- * (open-bugs.md:110): a clarification scope delta must clear the same rule the
588
- * promotion gate enforced, or the delta lane becomes a bypass of it. Returns
589
- * violation lines; [] on an unreadable tree (fail-open, exactly as the
590
- * promotion gate degrades).
591
- */
21
+ export declare function normalizeBlockTouchedFiles(root: string, files: readonly string[], id: string): BlockWriteScopeNormalization;
592
22
  export declare function checkWriteScopePathsAgainstTrackedTree(root: string, paths: readonly string[], label: string): Promise<string[]>;
593
- /**
594
- * Refuse a targeted command that leaves the declared shape — a single
595
- * invocation with no shell chaining, substitution or redirection. Deliberately
596
- * ecosystem-neutral: this module never asserts WHICH runner is legitimate
597
- * (language-neutral by contract), only that the string handed to a shell cannot
598
- * do more than invoke one command.
599
- *
600
- * The RULE is not here. It is `commandLeavesDeclaredShape`
601
- * (`audit-tools/shared`), the one predicate the host-handoff consumer and the
602
- * triage re-verification spawn also ask. This function owns only the WORDING and
603
- * the refusals-as-data contract. It used to own a second, quote-BLIND regex
604
- * instead, and the two disagreed in both directions: `pytest -k 'not slow'`
605
- * cleared promotion and then dead-ended at the consumer as
606
- * `block_contract_invalid`, while `echo "a & b"` was refused here though the
607
- * consumer admits it.
608
- *
609
- * Refusals are RETURNED, never thrown: the promotion boundary turns them into
610
- * the same bounded re-emit every other promotion rejection takes, so a
611
- * malformed command re-emits implementation_planning instead of wedging every
612
- * subsequent next-step with an unclassified stack.
613
- */
614
- export interface BlockCommandNormalization {
615
- targeted_commands: string[];
616
- /** One line per REFUSED command. Non-empty ⇒ the caller must not promote. */
617
- refusals: string[];
618
- }
619
- export declare function normalizeBlockTargetedCommands(commands: readonly string[], blockId: string): BlockCommandNormalization;
620
- /**
621
- * Collect every write-scope and command refusal the promotion WOULD hit, before
622
- * a plan is written. Runs the same two normalizers over the same derived node
623
- * scope the promoter uses, so this pre-check and the promotion cannot disagree
624
- * about what is refusable — and the refusal reaches the host as the bounded
625
- * `implementation_planning` re-emit every other promotion rejection takes,
626
- * rather than as a thrown stack that wedges every subsequent next-step.
627
- */
628
- export declare function collectDagWriteScopeRefusals(artifactsDir: string, root: string): Promise<string[]>;
629
- /**
630
- * Path-A canonical-block membership validation, run BEFORE anything is promoted
631
- * (OBL-seam-prep-remediate-core-inv-2 / COR-114e4941). These are exactly the
632
- * checks the promoter itself performs while building its node→canonical-group
633
- * map — but there they THROW out of `promoteImplementationDagToExtractedPlan`,
634
- * an unclassified stack that wedged every subsequent next-step. Hoisted here so
635
- * an invalid `source_finding_ids` declaration takes the same bounded re-emit as
636
- * every other promotion rejection, with no gate having executed past it.
637
- *
638
- * The checks themselves are {@link evaluatePathACanonicalGroups} — the ONE body
639
- * both this gate and the promoter call, so the gate can never certify a DAG the
640
- * promoter then refuses.
641
- *
642
- * Returns one line per violation; empty means the DAG is promotable on this
643
- * axis (or Path A is not in play at all).
644
- */
645
- export declare function collectPathARefusals(artifactsDir: string): Promise<string[]>;
646
- /**
647
- * What the AUDIT read, for the run whose Path-A seed lives in `artifactsDir` —
648
- * the value plan application stamps onto `state.plan.audit_read`.
649
- *
650
- * Read by the TOOL from the seed's own source report, which passed the strict
651
- * shared validator (`projectApprovedFindings`) before it may answer. It never
652
- * rides `extracted-plan.json`: that file is host-writable, and the close
653
- * phase's evidence leg turns this commit into terminal dispositions, so a
654
- * host-supplied value would let a host author its own `refuted`.
655
- *
656
- * BOUND TO THE SEED'S OWN DIGEST. The seed recorded a sha256 of the source
657
- * report when it was built (`source_digests`); the bytes read here must hash to
658
- * it, so a report swapped afterwards — even for another VALID report — answers
659
- * `null`. The file is read ONCE and the same bytes are hashed and parsed. A seed
660
- * that carries no digest for its source binds nothing, and an unbound commit is
661
- * not one this function will vouch for.
662
- *
663
- * `null` — "no commit is known" — when there is no seed (the run did not start
664
- * from a findings report), the source is unbound, changed, unreadable or
665
- * invalid, or the report itself states `null`.
666
- */
667
- export declare function readSeedAuditRead(artifactsDir: string): Promise<AuditRead | null>;
668
- /**
669
- * Convert a completed ImplementationDAG into the extracted-plan.json format
670
- * that the existing handlePendingExtractedPlan/applyPlanPipeline path consumes.
671
- *
672
- * `root` defaults to the repository that owns `artifactsDir`, so the existing
673
- * one-argument callers keep working while the pipeline passes the run's real
674
- * root for write-scope normalization.
675
- */
676
- export declare function promoteImplementationDagToExtractedPlan(artifactsDir: string, root?: string): Promise<void>;
677
23
  //# sourceMappingURL=contractPipeline.d.ts.map