audit-tools 0.52.4 → 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 (348) 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/remediate-code.mjs +16 -3
  242. package/dist/remediate/contractPipeline/artifactNames.d.ts +0 -8
  243. package/dist/remediate/contractPipeline/artifactNames.d.ts.map +0 -1
  244. package/dist/remediate/contractPipeline/artifactNames.js +0 -28
  245. package/dist/remediate/contractPipeline/artifactNames.js.map +0 -1
  246. package/dist/remediate/contractPipeline/artifactStore.d.ts +0 -219
  247. package/dist/remediate/contractPipeline/artifactStore.d.ts.map +0 -1
  248. package/dist/remediate/contractPipeline/artifactStore.js +0 -436
  249. package/dist/remediate/contractPipeline/artifactStore.js.map +0 -1
  250. package/dist/remediate/contractPipeline/changeClassification.d.ts +0 -130
  251. package/dist/remediate/contractPipeline/changeClassification.d.ts.map +0 -1
  252. package/dist/remediate/contractPipeline/changeClassification.js +0 -446
  253. package/dist/remediate/contractPipeline/changeClassification.js.map +0 -1
  254. package/dist/remediate/contractPipeline/contractReviewBinding.d.ts +0 -28
  255. package/dist/remediate/contractPipeline/contractReviewBinding.d.ts.map +0 -1
  256. package/dist/remediate/contractPipeline/contractReviewBinding.js +0 -75
  257. package/dist/remediate/contractPipeline/contractReviewBinding.js.map +0 -1
  258. package/dist/remediate/contractPipeline/counterexampleFingerprint.d.ts +0 -27
  259. package/dist/remediate/contractPipeline/counterexampleFingerprint.d.ts.map +0 -1
  260. package/dist/remediate/contractPipeline/counterexampleFingerprint.js +0 -37
  261. package/dist/remediate/contractPipeline/counterexampleFingerprint.js.map +0 -1
  262. package/dist/remediate/contractPipeline/cyclicSeamResolution.d.ts +0 -131
  263. package/dist/remediate/contractPipeline/cyclicSeamResolution.d.ts.map +0 -1
  264. package/dist/remediate/contractPipeline/cyclicSeamResolution.js +0 -257
  265. package/dist/remediate/contractPipeline/cyclicSeamResolution.js.map +0 -1
  266. package/dist/remediate/contractPipeline/derive.d.ts +0 -173
  267. package/dist/remediate/contractPipeline/derive.d.ts.map +0 -1
  268. package/dist/remediate/contractPipeline/derive.js +0 -477
  269. package/dist/remediate/contractPipeline/derive.js.map +0 -1
  270. package/dist/remediate/contractPipeline/finalizedContractFields.d.ts +0 -50
  271. package/dist/remediate/contractPipeline/finalizedContractFields.d.ts.map +0 -1
  272. package/dist/remediate/contractPipeline/finalizedContractFields.js +0 -77
  273. package/dist/remediate/contractPipeline/finalizedContractFields.js.map +0 -1
  274. package/dist/remediate/contractPipeline/idRegistry.d.ts +0 -144
  275. package/dist/remediate/contractPipeline/idRegistry.d.ts.map +0 -1
  276. package/dist/remediate/contractPipeline/idRegistry.js +0 -214
  277. package/dist/remediate/contractPipeline/idRegistry.js.map +0 -1
  278. package/dist/remediate/contractPipeline/obligationKinds.d.ts +0 -27
  279. package/dist/remediate/contractPipeline/obligationKinds.d.ts.map +0 -1
  280. package/dist/remediate/contractPipeline/obligationKinds.js +0 -18
  281. package/dist/remediate/contractPipeline/obligationKinds.js.map +0 -1
  282. package/dist/remediate/contractPipeline/phaseCut.d.ts +0 -125
  283. package/dist/remediate/contractPipeline/phaseCut.d.ts.map +0 -1
  284. package/dist/remediate/contractPipeline/phaseCut.js +0 -339
  285. package/dist/remediate/contractPipeline/phaseCut.js.map +0 -1
  286. package/dist/remediate/contractPipeline/phaseCutArtifact.d.ts +0 -31
  287. package/dist/remediate/contractPipeline/phaseCutArtifact.d.ts.map +0 -1
  288. package/dist/remediate/contractPipeline/phaseCutArtifact.js +0 -48
  289. package/dist/remediate/contractPipeline/phaseCutArtifact.js.map +0 -1
  290. package/dist/remediate/contractPipeline/repairState.d.ts +0 -110
  291. package/dist/remediate/contractPipeline/repairState.d.ts.map +0 -1
  292. package/dist/remediate/contractPipeline/repairState.js +0 -185
  293. package/dist/remediate/contractPipeline/repairState.js.map +0 -1
  294. package/dist/remediate/contractPipeline/reviewSnapshot.d.ts +0 -79
  295. package/dist/remediate/contractPipeline/reviewSnapshot.d.ts.map +0 -1
  296. package/dist/remediate/contractPipeline/reviewSnapshot.js +0 -140
  297. package/dist/remediate/contractPipeline/reviewSnapshot.js.map +0 -1
  298. package/dist/remediate/contractPipeline/semanticProjection.d.ts +0 -64
  299. package/dist/remediate/contractPipeline/semanticProjection.d.ts.map +0 -1
  300. package/dist/remediate/contractPipeline/semanticProjection.js +0 -136
  301. package/dist/remediate/contractPipeline/semanticProjection.js.map +0 -1
  302. package/dist/remediate/contractPipeline/sketchSource.d.ts +0 -194
  303. package/dist/remediate/contractPipeline/sketchSource.d.ts.map +0 -1
  304. package/dist/remediate/contractPipeline/sketchSource.js +0 -262
  305. package/dist/remediate/contractPipeline/sketchSource.js.map +0 -1
  306. package/dist/remediate/contractPipeline/testPlanCarry.d.ts +0 -17
  307. package/dist/remediate/contractPipeline/testPlanCarry.d.ts.map +0 -1
  308. package/dist/remediate/contractPipeline/testPlanCarry.js +0 -72
  309. package/dist/remediate/contractPipeline/testPlanCarry.js.map +0 -1
  310. package/dist/remediate/steps/dispatch/marshal.d.ts +0 -7
  311. package/dist/remediate/steps/dispatch/marshal.d.ts.map +0 -1
  312. package/dist/remediate/steps/dispatch/marshal.js +0 -11
  313. package/dist/remediate/steps/dispatch/marshal.js.map +0 -1
  314. package/dist/remediate/validation/contractPipeline.d.ts +0 -35
  315. package/dist/remediate/validation/contractPipeline.d.ts.map +0 -1
  316. package/dist/remediate/validation/contractPipeline.js +0 -613
  317. package/dist/remediate/validation/contractPipeline.js.map +0 -1
  318. package/dist/remediate/validation/contractPipelineGates.d.ts +0 -272
  319. package/dist/remediate/validation/contractPipelineGates.d.ts.map +0 -1
  320. package/dist/remediate/validation/contractPipelineGates.js +0 -1397
  321. package/dist/remediate/validation/contractPipelineGates.js.map +0 -1
  322. package/dist/shared/types/contractPipeline/design.d.ts +0 -79
  323. package/dist/shared/types/contractPipeline/design.d.ts.map +0 -1
  324. package/dist/shared/types/contractPipeline/design.js +0 -16
  325. package/dist/shared/types/contractPipeline/design.js.map +0 -1
  326. package/dist/shared/types/contractPipeline/goal.d.ts +0 -41
  327. package/dist/shared/types/contractPipeline/goal.d.ts.map +0 -1
  328. package/dist/shared/types/contractPipeline/goal.js +0 -10
  329. package/dist/shared/types/contractPipeline/goal.js.map +0 -1
  330. package/dist/shared/types/contractPipeline/implementation.d.ts +0 -118
  331. package/dist/shared/types/contractPipeline/implementation.d.ts.map +0 -1
  332. package/dist/shared/types/contractPipeline/implementation.js +0 -13
  333. package/dist/shared/types/contractPipeline/implementation.js.map +0 -1
  334. package/dist/shared/types/contractPipeline/obligations.d.ts +0 -283
  335. package/dist/shared/types/contractPipeline/obligations.d.ts.map +0 -1
  336. package/dist/shared/types/contractPipeline/obligations.js +0 -84
  337. package/dist/shared/types/contractPipeline/obligations.js.map +0 -1
  338. package/dist/shared/types/contractPipeline/verification.d.ts.map +0 -1
  339. package/dist/shared/types/contractPipeline/verification.js +0 -10
  340. package/dist/shared/types/contractPipeline/verification.js.map +0 -1
  341. package/dist/shared/types/contractPipeline.d.ts +0 -48
  342. package/dist/shared/types/contractPipeline.d.ts.map +0 -1
  343. package/dist/shared/types/contractPipeline.js +0 -32
  344. package/dist/shared/types/contractPipeline.js.map +0 -1
  345. package/dist/shared/types/obligationLedger.d.ts +0 -39
  346. package/dist/shared/types/obligationLedger.d.ts.map +0 -1
  347. package/dist/shared/types/obligationLedger.js +0 -49
  348. package/dist/shared/types/obligationLedger.js.map +0 -1
@@ -1,185 +0,0 @@
1
- // sites-pinned: tests/remediate/contract-pipeline-artifact-store.test.ts, tests/remediate/critique-gate.test.ts, tests/remediate/contract-pipeline-adversarial.test.ts
2
- /**
3
- * Contract-pipeline repair-state ledger + counterexample waivers.
4
- *
5
- * Moved out of steps/contractPipeline.ts (open-bugs.md:108) so every consumer
6
- * of the ledger — the judge gate that folds and reads waivers, the
7
- * cross-artifact validation sweep, and the CLI self-check — imports ONE home
8
- * instead of the steps module re-exporting its private state.
9
- *
10
- * The WAIVER lane is the recorded owner-resolution verb the judge escalation
11
- * used to lack: when the judge↔repair loop stalls on a counterexample the
12
- * contract schema cannot satisfy, the operator records "accepted as a known
13
- * limitation" through a tool-named file (`counterexample-waivers.json`) the
14
- * gate validates, folds into this ledger, and consumes. A waiver lives in the
15
- * run's artifact tree and dies with the run — per-run choices are never
16
- * persisted beyond their run. The record carries `waived_by`: like the
17
- * loop-core review attestation, it is ATTRIBUTABLE, not proof of a human —
18
- * no mechanical channel can prove who decided, so the record names the
19
- * decider instead of pretending to verify them.
20
- */
21
- import { mkdir, rm } from "node:fs/promises";
22
- import { join } from "node:path";
23
- import { isRecord, readOptionalJsonFile, writeJsonFile, } from "audit-tools/shared";
24
- import { contractPipelineDir } from "./artifactStore.js";
25
- import { counterexampleFingerprint } from "./counterexampleFingerprint.js";
26
- function repairStatePath(artifactsDir) {
27
- return join(contractPipelineDir(artifactsDir), "repair-state.json");
28
- }
29
- export async function readRepairState(artifactsDir) {
30
- const state = await readOptionalJsonFile(repairStatePath(artifactsDir));
31
- return (state ?? {
32
- schema_version: "remediate-code-contract-pipeline/repair-state/v1alpha1",
33
- repairs: [],
34
- critique_repairs: [],
35
- dag_regenerations: [],
36
- });
37
- }
38
- export async function writeRepairState(artifactsDir, state) {
39
- await mkdir(contractPipelineDir(artifactsDir), { recursive: true });
40
- await writeJsonFile(repairStatePath(artifactsDir), state);
41
- }
42
- // ── Counterexample waivers ────────────────────────────────────────────────────
43
- const COUNTEREXAMPLE_WAIVERS_FILE = "counterexample-waivers.json";
44
- /** The tool-named host lane: the operator's waiver decisions land here. */
45
- export function counterexampleWaiversPath(artifactsDir) {
46
- return join(contractPipelineDir(artifactsDir), COUNTEREXAMPLE_WAIVERS_FILE);
47
- }
48
- /** id → live counterexample entry, from a (possibly absent) artifact payload. */
49
- export function counterexamplesByIdOf(counterexamplePayload) {
50
- const byId = new Map();
51
- if (!isRecord(counterexamplePayload) || !Array.isArray(counterexamplePayload.counterexamples)) {
52
- return byId;
53
- }
54
- for (const ce of counterexamplePayload.counterexamples) {
55
- if (isRecord(ce) && typeof ce.id === "string" && ce.id.length > 0) {
56
- byId.set(ce.id, ce);
57
- }
58
- }
59
- return byId;
60
- }
61
- /**
62
- * Content-keyed identity for a counterexample id: `fp:<fingerprint>` when the
63
- * id resolves against the live artifact, `id:<raw>` otherwise. The ONE keying
64
- * both the convergence gate and the waiver ledger use.
65
- */
66
- export function counterexampleKeyOf(counterexamplesById, rawId) {
67
- const ce = counterexamplesById.get(rawId);
68
- return ce ? `fp:${counterexampleFingerprint(ce)}` : `id:${rawId}`;
69
- }
70
- /** Judge-accepted counterexample ids from a raw judge-report payload. */
71
- function acceptedIdsOfJudgePayload(judgeReportPayload) {
72
- if (!isRecord(judgeReportPayload) || !Array.isArray(judgeReportPayload.classifications)) {
73
- return [];
74
- }
75
- const ids = [];
76
- for (const cls of judgeReportPayload.classifications) {
77
- if (isRecord(cls) &&
78
- cls.classification === "accepted" &&
79
- typeof cls.counterexample_id === "string" &&
80
- cls.counterexample_id.length > 0) {
81
- ids.push(cls.counterexample_id);
82
- }
83
- }
84
- return ids;
85
- }
86
- /** The subset of `acceptedIds` covered by recorded waivers (fingerprint-first, raw-id fallback). */
87
- export function waivedAcceptedIds(state, counterexamplesById, acceptedIds) {
88
- const waivers = state.waivers ?? [];
89
- if (waivers.length === 0)
90
- return new Set();
91
- const keys = new Set(waivers.map((w) => w.key));
92
- const rawIds = new Set(waivers.map((w) => w.ce_id));
93
- return new Set(acceptedIds.filter((id) => keys.has(counterexampleKeyOf(counterexamplesById, id)) || rawIds.has(id)));
94
- }
95
- /**
96
- * Payload-level convenience for the cross-gate callers: which of the CURRENT
97
- * judge report's accepted counterexample ids are waived in the ledger.
98
- */
99
- export function waivedJudgeAcceptedIds(state, judgeReportPayload, counterexamplePayload) {
100
- return waivedAcceptedIds(state, counterexamplesByIdOf(counterexamplePayload), acceptedIdsOfJudgePayload(judgeReportPayload));
101
- }
102
- /**
103
- * Fold the host-written waiver file into the ledger — all-or-nothing.
104
- *
105
- * Absent file: no-op. Any invalid entry (malformed JSON, missing/empty
106
- * `ce_id` / `rationale` / `waived_by`, or a `ce_id` that matches neither a
107
- * live counterexample nor a judge-accepted id) refuses the WHOLE file: nothing
108
- * is applied, the file stays in place, and the issues are returned for the
109
- * blocked step to name — an invalid decision record must never half-apply.
110
- * Valid entries are deduped by content key, appended to `state.waivers`,
111
- * persisted, and the file is consumed (deleted).
112
- */
113
- export async function foldCounterexampleWaivers(artifactsDir, context) {
114
- const path = counterexampleWaiversPath(artifactsDir);
115
- let raw;
116
- try {
117
- raw = await readOptionalJsonFile(path);
118
- }
119
- catch {
120
- return {
121
- issues: [
122
- `${COUNTEREXAMPLE_WAIVERS_FILE} is not valid JSON. Fix or delete the file; nothing was applied.`,
123
- ],
124
- folded: 0,
125
- };
126
- }
127
- if (raw === undefined || raw === null)
128
- return { issues: [], folded: 0 };
129
- const issues = [];
130
- const entries = [];
131
- if (!isRecord(raw) || !Array.isArray(raw.waivers)) {
132
- issues.push(`${COUNTEREXAMPLE_WAIVERS_FILE} must be an object with a "waivers" array.`);
133
- }
134
- else {
135
- for (const [i, entry] of raw.waivers.entries()) {
136
- if (!isRecord(entry)) {
137
- issues.push(`waivers[${i}] must be an object.`);
138
- continue;
139
- }
140
- const ceId = typeof entry.ce_id === "string" ? entry.ce_id.trim() : "";
141
- const rationale = typeof entry.rationale === "string" ? entry.rationale.trim() : "";
142
- const waivedBy = typeof entry.waived_by === "string" ? entry.waived_by.trim() : "";
143
- if (ceId.length === 0)
144
- issues.push(`waivers[${i}].ce_id must be a non-empty string.`);
145
- if (rationale.length === 0) {
146
- issues.push(`waivers[${i}].rationale must be a non-empty string — a waiver with no reason is not a decision record.`);
147
- }
148
- if (waivedBy.length === 0) {
149
- issues.push(`waivers[${i}].waived_by must name who decided (attributable identity).`);
150
- }
151
- if (ceId.length > 0 &&
152
- !context.counterexamplesById.has(ceId) &&
153
- !context.judgeAcceptedIds.has(ceId)) {
154
- issues.push(`waivers[${i}].ce_id "${ceId}" matches neither a live counterexample nor a judge-accepted id — nothing to waive by that name.`);
155
- }
156
- if (ceId.length > 0 && rationale.length > 0 && waivedBy.length > 0) {
157
- entries.push({ ce_id: ceId, rationale, waived_by: waivedBy });
158
- }
159
- }
160
- }
161
- if (issues.length > 0)
162
- return { issues, folded: 0 };
163
- const state = await readRepairState(artifactsDir);
164
- const existing = new Set((state.waivers ?? []).map((w) => w.key));
165
- let folded = 0;
166
- for (const entry of entries) {
167
- const key = counterexampleKeyOf(context.counterexamplesById, entry.ce_id);
168
- if (existing.has(key))
169
- continue;
170
- existing.add(key);
171
- (state.waivers ??= []).push({
172
- ce_id: entry.ce_id,
173
- key,
174
- rationale: entry.rationale,
175
- waived_by: entry.waived_by,
176
- waived_at: new Date().toISOString(),
177
- });
178
- folded += 1;
179
- }
180
- if (folded > 0)
181
- await writeRepairState(artifactsDir, state);
182
- await rm(path, { force: true });
183
- return { issues: [], folded };
184
- }
185
- //# sourceMappingURL=repairState.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"repairState.js","sourceRoot":"","sources":["../../../src/remediate/contractPipeline/repairState.ts"],"names":[],"mappings":"AAAA,uKAAuK;AACvK;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CA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G,CAAC,CAAC;IACf,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,MAAM,GAAG,GAAG,mBAAmB,CAAC,OAAO,CAAC,mBAAmB,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;QAC1E,IAAI,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,SAAS;QAChC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAClB,CAAC,KAAK,CAAC,OAAO,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC;YAC1B,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,GAAG;YACH,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACpC,CAAC,CAAC;QACH,MAAM,IAAI,CAAC,CAAC;IACd,CAAC;IACD,IAAI,MAAM,GAAG,CAAC;QAAE,MAAM,gBAAgB,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;IAC5D,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAChC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC;AAChC,CAAC"}
@@ -1,79 +0,0 @@
1
- import { diffProjections } from "audit-tools/shared";
2
- export { diffProjections };
3
- import { type ContractPipelineArtifactName } from "./artifactStore.js";
4
- import { reviewSnapshotFilePath } from "./artifactStore.js";
5
- /** The verdict-bearing review artifacts whose re-run is expensive (diff-eligible). */
6
- export declare const REVIEW_ARTIFACTS: ReadonlySet<ContractPipelineArtifactName>;
7
- export declare function isReviewArtifact(name: ContractPipelineArtifactName): boolean;
8
- declare const SNAPSHOT_SCHEMA_VERSION: "remediate-code-contract-pipeline/review-snapshot/v1alpha1";
9
- export interface ReviewSnapshot {
10
- schema_version: typeof SNAPSHOT_SCHEMA_VERSION;
11
- artifact_name: ContractPipelineArtifactName;
12
- /**
13
- * Where this snapshot lives on disk. Carried ON the record so the re-review
14
- * prompt can name the file the prior verdict is readable from — the reviewer
15
- * is an independent lane that reads the files it is given and has no memory of
16
- * the prior round, so a verdict that exists only as pasted prompt prose is not
17
- * readable to it. Present on every snapshot `captureReviewSnapshot` writes;
18
- * optional for READING because a snapshot persisted by a build that predates
19
- * the field is still a valid prior verdict, and refusing to read it would cost
20
- * a full re-review for a purely presentational gap.
21
- */
22
- path?: string;
23
- /** ISO-8601 capture time (caller-supplied for deterministic tests). */
24
- reviewed_at: string;
25
- /** The verdict payload this review emitted — what a re-review re-affirms. */
26
- prior_payload: unknown;
27
- /** Semantic projection of each upstream dependency at review time. */
28
- reviewed_inputs: Partial<Record<ContractPipelineArtifactName, unknown>>;
29
- }
30
- /**
31
- * Re-exported rather than re-derived: the ARCHIVE boundary (`archiveContractArtifact`,
32
- * which drops the snapshot of an artifact it rejects) must reach this path from a
33
- * module that cannot import this one without a cycle. Two copies of the same
34
- * `join` is the shape that drifts, so the path lives in `artifactStore` beside
35
- * the other artifact-path helpers and this module consumes it.
36
- */
37
- export declare const reviewSnapshotPath: typeof reviewSnapshotFilePath;
38
- export declare function reviewSnapshotExists(artifactsDir: string, name: ContractPipelineArtifactName): boolean;
39
- /**
40
- * Read a review snapshot, or null when none is usable.
41
- *
42
- * A snapshot is REGENERABLE state — one written under another schema version is
43
- * discarded rather than reinterpreted, which costs one full re-review (the
44
- * behaviour when no snapshot exists) instead of diffing a prior verdict against
45
- * inputs projected under different semantics.
46
- */
47
- export declare function readReviewSnapshot(artifactsDir: string, name: ContractPipelineArtifactName): Promise<ReviewSnapshot | null>;
48
- /**
49
- * Capture a review snapshot for a freshly-produced review artifact: the semantic
50
- * projection of each current upstream dependency plus the review's own payload.
51
- * No-op for non-review artifacts. The dependency envelopes are read from disk, so
52
- * this must run after the upstreams are enveloped (always true post-ingest).
53
- */
54
- export declare function captureReviewSnapshot(artifactsDir: string, name: ContractPipelineArtifactName, payload: unknown, reviewedAt: string): Promise<void>;
55
- export interface ReReviewDelta {
56
- /** Per-dependency diff lines, keyed by dependency name; empty for unchanged. */
57
- changedInputs: {
58
- dep: ContractPipelineArtifactName;
59
- lines: string[];
60
- }[];
61
- /** True when no upstream projection actually changed (re-affirm verbatim). */
62
- allUnchanged: boolean;
63
- }
64
- /**
65
- * Compute the re-review delta for a review phase against its snapshot: which
66
- * upstream dependencies changed (by semantic projection) since the prior verdict,
67
- * and the field-level diff for each. Dependencies present now but absent in the
68
- * snapshot (or vice-versa) are reported as wholesale add/remove diffs.
69
- */
70
- export declare function computeReReviewDelta(artifactsDir: string, name: ContractPipelineArtifactName, snapshot: ReviewSnapshot): Promise<ReReviewDelta>;
71
- /**
72
- * Render the diff-based re-review section appended to a review phase's re-emit
73
- * prompt. Carries the prior verdict and the precise changed-since-last-review
74
- * delta, and instructs the worker to re-affirm the prior verdict when the delta
75
- * does not affect it, or revise only the affected items otherwise. Delegates the
76
- * prompt body to the shared `renderDiffReReviewSection` (single-sourced shape).
77
- */
78
- export declare function renderReReviewSection(_name: ContractPipelineArtifactName, snapshot: ReviewSnapshot, delta: ReReviewDelta): string;
79
- //# sourceMappingURL=reviewSnapshot.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reviewSnapshot.d.ts","sourceRoot":"","sources":["../../../src/remediate/contractPipeline/reviewSnapshot.ts"],"names":[],"mappings":"AAuBA,OAAO,EACL,eAAe,EAKhB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,OAAO,EAIL,KAAK,4BAA4B,EAClC,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAG5D,sFAAsF;AACtF,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,4BAA4B,CAKrE,CAAC;AAEH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,4BAA4B,GAAG,OAAO,CAE5E;AAED,QAAA,MA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AK,EAAE,4BAA4B,EACnC,QAAQ,EAAE,cAAc,EACxB,KAAK,EAAE,aAAa,GACnB,MAAM,CAgBR"}
@@ -1,140 +0,0 @@
1
- /**
2
- * Diff-based re-review for the contract pipeline (B2).
3
- *
4
- * Friction: when an upstream artifact genuinely changes, the verdict-bearing
5
- * review phases (conceptual critique, contract assessment, adversarial critic,
6
- * adversarial judge) re-run as FULL passes — the host must burn another ~100-190k
7
- * token critic/judge subagent (or hand-re-emit the prior verdict) even when the
8
- * change touches only a small part of what the review reasoned about.
9
- *
10
- * Fix: when a review artifact is produced, snapshot the SEMANTIC PROJECTIONS of
11
- * the exact upstreams it reviewed plus its own verdict. On a later staleness
12
- * re-emit of that phase, diff the snapshot's inputs against the current upstream
13
- * projections and hand the worker (a) its prior verdict and (b) the precise
14
- * changed-since-last-review delta — so it confirms "prior verdict still holds"
15
- * cheaply when the delta does not affect it, and revises only the affected items
16
- * otherwise. This is enforced by the tool (the re-emit prompt carries the delta),
17
- * never left to the host to remember.
18
- *
19
- * Snapshots are bounded to the review phases — the only ones whose re-run is an
20
- * expensive verdict, not a deterministic/scaffolded restructuring.
21
- */
22
- import { existsSync } from "node:fs";
23
- import { mkdir } from "node:fs/promises";
24
- import { diffProjections, discardOnSchemaVersionMismatch, readOptionalJsonFile, renderDiffReReviewSection, writeJsonFile, } from "audit-tools/shared";
25
- export { diffProjections };
26
- import { DEPENDENCY_MAP, readContractArtifact, reviewSnapshotDirPath, } from "./artifactStore.js";
27
- // The path helper is IMPORTED and re-exported (the archive boundary reaches the
28
- // same file from a module that cannot import this one), so the two can never
29
- // disagree about where a snapshot lives.
30
- import { reviewSnapshotFilePath } from "./artifactStore.js";
31
- import { semanticProjection } from "./semanticProjection.js";
32
- /** The verdict-bearing review artifacts whose re-run is expensive (diff-eligible). */
33
- export const REVIEW_ARTIFACTS = new Set([
34
- "conceptual_design_critique",
35
- "contract_assessment_report",
36
- "counterexample",
37
- "judge_report",
38
- ]);
39
- export function isReviewArtifact(name) {
40
- return REVIEW_ARTIFACTS.has(name);
41
- }
42
- const SNAPSHOT_SCHEMA_VERSION = "remediate-code-contract-pipeline/review-snapshot/v1alpha1";
43
- /**
44
- * Re-exported rather than re-derived: the ARCHIVE boundary (`archiveContractArtifact`,
45
- * which drops the snapshot of an artifact it rejects) must reach this path from a
46
- * module that cannot import this one without a cycle. Two copies of the same
47
- * `join` is the shape that drifts, so the path lives in `artifactStore` beside
48
- * the other artifact-path helpers and this module consumes it.
49
- */
50
- export const reviewSnapshotPath = reviewSnapshotFilePath;
51
- function reviewSnapshotDir(artifactsDir) {
52
- return reviewSnapshotDirPath(artifactsDir);
53
- }
54
- export function reviewSnapshotExists(artifactsDir, name) {
55
- return existsSync(reviewSnapshotPath(artifactsDir, name));
56
- }
57
- /**
58
- * Read a review snapshot, or null when none is usable.
59
- *
60
- * A snapshot is REGENERABLE state — one written under another schema version is
61
- * discarded rather than reinterpreted, which costs one full re-review (the
62
- * behaviour when no snapshot exists) instead of diffing a prior verdict against
63
- * inputs projected under different semantics.
64
- */
65
- export async function readReviewSnapshot(artifactsDir, name) {
66
- return (discardOnSchemaVersionMismatch(await readOptionalJsonFile(reviewSnapshotPath(artifactsDir, name)), SNAPSHOT_SCHEMA_VERSION) ?? null);
67
- }
68
- /**
69
- * Capture a review snapshot for a freshly-produced review artifact: the semantic
70
- * projection of each current upstream dependency plus the review's own payload.
71
- * No-op for non-review artifacts. The dependency envelopes are read from disk, so
72
- * this must run after the upstreams are enveloped (always true post-ingest).
73
- */
74
- export async function captureReviewSnapshot(artifactsDir, name, payload, reviewedAt) {
75
- if (!isReviewArtifact(name))
76
- return;
77
- const reviewed_inputs = {};
78
- for (const dep of DEPENDENCY_MAP[name]) {
79
- const depEnvelope = await readContractArtifact(artifactsDir, dep);
80
- if (depEnvelope) {
81
- reviewed_inputs[dep] = semanticProjection(dep, depEnvelope.payload);
82
- }
83
- }
84
- const path = reviewSnapshotPath(artifactsDir, name);
85
- const snapshot = {
86
- schema_version: SNAPSHOT_SCHEMA_VERSION,
87
- artifact_name: name,
88
- path,
89
- reviewed_at: reviewedAt,
90
- prior_payload: payload,
91
- reviewed_inputs,
92
- };
93
- await mkdir(reviewSnapshotDir(artifactsDir), { recursive: true });
94
- await writeJsonFile(path, snapshot);
95
- }
96
- /**
97
- * Compute the re-review delta for a review phase against its snapshot: which
98
- * upstream dependencies changed (by semantic projection) since the prior verdict,
99
- * and the field-level diff for each. Dependencies present now but absent in the
100
- * snapshot (or vice-versa) are reported as wholesale add/remove diffs.
101
- */
102
- export async function computeReReviewDelta(artifactsDir, name, snapshot) {
103
- const changedInputs = [];
104
- for (const dep of DEPENDENCY_MAP[name]) {
105
- const depEnvelope = await readContractArtifact(artifactsDir, dep);
106
- const current = depEnvelope
107
- ? semanticProjection(dep, depEnvelope.payload)
108
- : undefined;
109
- const prior = snapshot.reviewed_inputs[dep];
110
- const lines = diffProjections(prior, current);
111
- if (lines.length > 0)
112
- changedInputs.push({ dep, lines });
113
- }
114
- return { changedInputs, allUnchanged: changedInputs.length === 0 };
115
- }
116
- /**
117
- * Render the diff-based re-review section appended to a review phase's re-emit
118
- * prompt. Carries the prior verdict and the precise changed-since-last-review
119
- * delta, and instructs the worker to re-affirm the prior verdict when the delta
120
- * does not affect it, or revise only the affected items otherwise. Delegates the
121
- * prompt body to the shared `renderDiffReReviewSection` (single-sourced shape).
122
- */
123
- export function renderReReviewSection(_name, snapshot, delta) {
124
- return renderDiffReReviewSection({
125
- priorPayload: snapshot.prior_payload,
126
- changedInputs: delta.changedInputs.map((entry) => ({
127
- label: entry.dep,
128
- lines: entry.lines,
129
- })),
130
- allUnchanged: delta.allUnchanged,
131
- subjectNoun: "artifact",
132
- // Naming the file is what makes the prior verdict READABLE to the reviewer:
133
- // the independent review lane is told to read the artifact files it is
134
- // given, and a verdict living only inside the prompt's prose is not one of
135
- // them. The path is the snapshot this section was rendered from, so the
136
- // named file and the pasted payload cannot disagree.
137
- priorVerdictPath: snapshot.path,
138
- });
139
- }
140
- //# sourceMappingURL=reviewSnapshot.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reviewSnapshot.js","sourceRoot":"","sources":["../../../src/remediate/contractPipeline/reviewSnapshot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EACL,eAAe,EACf,8BAA8B,EAC9B,oBAAoB,EACpB,yBAAyB,EACzB,aAAa,GACd,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,qBAAqB,GAEtB,MAAM,oBAAoB,CAAC;AAC5B,gFAAgF;AAChF,6EAA6E;AAC7E,yCAAyC;AACzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,sFAAsF;AACtF,MAAM,CAAC,MAAM,gBAAgB,GAA8C,IAAI,GAAG,CAAC;IACjF,4BAA4B;IAC5B,4BAA4B;IAC5B,gBAAgB;IAChB,cAAc;CACf,CAAC,CAAC;AAEH,MAAM,UAAU,gBAAgB,CAAC,IAAkC;IACjE,OAAO,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,uBAAuB,GAC3B,2DAAoE,CAAC;AAwBvE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,sBAAsB,CAAC;AAEzD,SAAS,iBAAiB,CAAC,YAAoB;IAC7C,OAAO,qBAAqB,CAAC,YAAY,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,YAAoB,EACpB,IAAkC;IAElC,OAAO,UAAU,CAAC,kBAAkB,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC,CA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ract-pipeline staleness (B3).
3
- *
4
- * The staleness DAG used to key every dependency on the upstream's RAW payload
5
- * content hash, so any byte change to an upstream — a reworded rationale, a
6
- * regenerated `created_at` stamp, a reordered list — re-staled the entire
7
- * downstream chain and forced a full (often LLM-driven) re-authoring of
8
- * artifacts whose load-bearing inputs had not actually changed. That is the
9
- * exact friction B3 names: "an edit to finalized_module_contracts re-stales
10
- * obligation_ledger → test_validator_plan → contract_assessment even when the
11
- * obligation set is unchanged."
12
- *
13
- * The fix is to make staleness content/semantics-aware: a dependency is recorded
14
- * and compared by the hash of its *semantic projection* — only the structure a
15
- * downstream actually consumes — not its raw bytes. A cosmetic upstream edit
16
- * projects to the same value, so downstreams stay fresh; a real change to the
17
- * load-bearing structure (a new module invariant, a changed interface) projects
18
- * differently and correctly re-stales.
19
- *
20
- * This mirrors audit-code's `normalizeForMetadataHash`
21
- * (`src/shared/artifactFreshness.ts`): strip non-semantic provenance fields
22
- * universally, then apply a per-artifact structural projection. The two
23
- * orchestrators stay in conceptual parity (semantic-projection staleness) while
24
- * each owns the projection table for its own artifact set.
25
- */
26
- import { stableStringifyProjection } from "audit-tools/shared";
27
- import type { ContractPipelineArtifactName } from "./artifactNames.js";
28
- import { DERIVABLE_MODULE_CONTRACT_FIELDS } from "./finalizedContractFields.js";
29
- export { stableStringifyProjection };
30
- /**
31
- * The module-contract fields that are load-bearing for ALL downstreams, at BOTH
32
- * layers (the intermediate `module_contracts` draft and the
33
- * `finalized_module_contracts`). These are the fields the deterministic
34
- * consumers read: `deriveObligationLedger` derives the obligation set and
35
- * test-plan premises from them, and `buildBaselineSymbolCorpus`
36
- * (`contractPipeline/changeClassification.ts`) additionally builds the
37
- * change-vs-addition corpus from the declared interface surface — `inputs`,
38
- * `outputs`, `side_effects`, `validation_boundary` — so a side_effects-only
39
- * edit is exactly as load-bearing as an interface edit and re-stales the
40
- * obligation_ledger like any other consumed field (CP-NODE-19). Never the
41
- * surrounding rationale/narrative/seam prose: a pure-prose edit leaves the
42
- * whole obligation-bearing chain fresh, while a changed interface, a new
43
- * invariant, or a changed side effect correctly re-stales it.
44
- */
45
- export { DERIVABLE_MODULE_CONTRACT_FIELDS };
46
- /**
47
- * Project a contract-pipeline artifact payload to only its load-bearing
48
- * structure for downstream-staleness purposes. The universal provenance strip
49
- * applies to every artifact; both module-contract artifacts
50
- * (`module_contracts` and `finalized_module_contracts`) additionally project
51
- * their `module_contracts` entries to the derivable fields. Artifacts with no
52
- * special case fall back to the provenance-stripped payload (conservative:
53
- * behaves like the raw payload minus stamps).
54
- *
55
- * Non-object payloads pass through unchanged.
56
- */
57
- export declare function semanticProjection(name: ContractPipelineArtifactName, payload: unknown): unknown;
58
- /**
59
- * The order-independent stable serialization used to hash a projection is the
60
- * shared `stableStringifyProjection` (re-exported above) — single-sourced in
61
- * `audit-tools/shared` so audit-code and remediate-code hash projections
62
- * identically.
63
- */
64
- //# sourceMappingURL=semanticProjection.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"semanticProjection.d.ts","sourceRoot":"","sources":["../../../src/remediate/contractPipeline/semanticProjection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAAY,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,gCAAgC,EAAE,MAAM,8BAA8B,CAAC;AAEhF,OAAO,EAAE,yBAAyB,EAAE,CAAC;AAWrC;;;;;;;;;;;;;;GAcG;AAKH,OAAO,EAAE,gCAAgC,EAAE,CAAC;AAgD5C;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,4BAA4B,EAClC,OAAO,EAAE,OAAO,GACf,OAAO,CAyBT;AAED;;;;;GAKG"}
@@ -1,136 +0,0 @@
1
- /**
2
- * Semantic projection for contract-pipeline staleness (B3).
3
- *
4
- * The staleness DAG used to key every dependency on the upstream's RAW payload
5
- * content hash, so any byte change to an upstream — a reworded rationale, a
6
- * regenerated `created_at` stamp, a reordered list — re-staled the entire
7
- * downstream chain and forced a full (often LLM-driven) re-authoring of
8
- * artifacts whose load-bearing inputs had not actually changed. That is the
9
- * exact friction B3 names: "an edit to finalized_module_contracts re-stales
10
- * obligation_ledger → test_validator_plan → contract_assessment even when the
11
- * obligation set is unchanged."
12
- *
13
- * The fix is to make staleness content/semantics-aware: a dependency is recorded
14
- * and compared by the hash of its *semantic projection* — only the structure a
15
- * downstream actually consumes — not its raw bytes. A cosmetic upstream edit
16
- * projects to the same value, so downstreams stay fresh; a real change to the
17
- * load-bearing structure (a new module invariant, a changed interface) projects
18
- * differently and correctly re-stales.
19
- *
20
- * This mirrors audit-code's `normalizeForMetadataHash`
21
- * (`src/shared/artifactFreshness.ts`): strip non-semantic provenance fields
22
- * universally, then apply a per-artifact structural projection. The two
23
- * orchestrators stay in conceptual parity (semantic-projection staleness) while
24
- * each owns the projection table for its own artifact set.
25
- */
26
- import { isRecord, stableStringifyProjection } from "audit-tools/shared";
27
- import { DERIVABLE_MODULE_CONTRACT_FIELDS } from "./finalizedContractFields.js";
28
- export { stableStringifyProjection };
29
- /**
30
- * Non-semantic top-level fields stripped from EVERY artifact before projecting.
31
- * These are provenance (wall-clock stamps), never meaning: re-deriving the
32
- * obligation ledger or re-emitting any artifact mints a fresh `created_at`, and
33
- * without stripping it the artifact's hash churns on every rebuild and
34
- * perpetually re-stales its downstreams — a finalization-oscillation hazard.
35
- */
36
- const UNIVERSAL_NON_SEMANTIC_FIELDS = ["created_at", "generated_at"];
37
- /**
38
- * The module-contract fields that are load-bearing for ALL downstreams, at BOTH
39
- * layers (the intermediate `module_contracts` draft and the
40
- * `finalized_module_contracts`). These are the fields the deterministic
41
- * consumers read: `deriveObligationLedger` derives the obligation set and
42
- * test-plan premises from them, and `buildBaselineSymbolCorpus`
43
- * (`contractPipeline/changeClassification.ts`) additionally builds the
44
- * change-vs-addition corpus from the declared interface surface — `inputs`,
45
- * `outputs`, `side_effects`, `validation_boundary` — so a side_effects-only
46
- * edit is exactly as load-bearing as an interface edit and re-stales the
47
- * obligation_ledger like any other consumed field (CP-NODE-19). Never the
48
- * surrounding rationale/narrative/seam prose: a pure-prose edit leaves the
49
- * whole obligation-bearing chain fresh, while a changed interface, a new
50
- * invariant, or a changed side effect correctly re-stales it.
51
- */
52
- // The projection's field list is the COPIED half of the ONE module-contract
53
- // vocabulary (`finalizedContractFields.ts`) — see that module for why
54
- // `seam_adjustments` (DERIVED at finalization, read by no deterministic
55
- // consumer) is excluded: a re-agreed seam must not re-stale the ledger.
56
- export { DERIVABLE_MODULE_CONTRACT_FIELDS };
57
- function stripFields(record, fields) {
58
- const drop = new Set(fields);
59
- return Object.fromEntries(Object.entries(record).filter(([key]) => !drop.has(key)));
60
- }
61
- function projectModuleContract(value, fields) {
62
- const record = isRecord(value) ? value : {};
63
- const out = {};
64
- for (const field of fields) {
65
- // Skip ABSENT fields rather than projecting them as undefined: a projection
66
- // must be stable across a JSON round-trip (the review snapshot stores its
67
- // reviewed_inputs as JSON, and JSON.stringify drops undefined values), so
68
- // `side_effects: undefined` on the live side would read as an ADDED field
69
- // against the round-tripped snapshot and fabricate a re-review delta.
70
- if (record[field] === undefined)
71
- continue;
72
- out[field] = record[field];
73
- }
74
- return out;
75
- }
76
- /**
77
- * Collapse cosmetic whitespace in every projected string (trim + runs → single
78
- * space), recursively. A reflow / trailing-space / indentation edit to a contract
79
- * field is not a semantic change, but without this it churns the projection hash
80
- * and re-stales the downstream chain. Safe: the downstream gates/derivers match on
81
- * word boundaries and substrings, which whitespace normalization never alters.
82
- */
83
- function normalizeWhitespaceDeep(value) {
84
- if (typeof value === "string")
85
- return value.replace(/\s+/g, " ").trim();
86
- if (Array.isArray(value))
87
- return value.map(normalizeWhitespaceDeep);
88
- if (isRecord(value)) {
89
- const out = {};
90
- for (const [key, v] of Object.entries(value))
91
- out[key] = normalizeWhitespaceDeep(v);
92
- return out;
93
- }
94
- return value;
95
- }
96
- /**
97
- * Project a contract-pipeline artifact payload to only its load-bearing
98
- * structure for downstream-staleness purposes. The universal provenance strip
99
- * applies to every artifact; both module-contract artifacts
100
- * (`module_contracts` and `finalized_module_contracts`) additionally project
101
- * their `module_contracts` entries to the derivable fields. Artifacts with no
102
- * special case fall back to the provenance-stripped payload (conservative:
103
- * behaves like the raw payload minus stamps).
104
- *
105
- * Non-object payloads pass through unchanged.
106
- */
107
- export function semanticProjection(name, payload) {
108
- if (!isRecord(payload))
109
- return payload;
110
- const stripped = stripFields(payload, UNIVERSAL_NON_SEMANTIC_FIELDS);
111
- // Both the intermediate `module_contracts` and the `finalized_module_contracts`
112
- // carry the same module-entry shape; narrow each entry to the derivable fields —
113
- // including `side_effects`, which the baseline symbol corpus reads at both
114
- // layers. A reworded per-module rationale / a tweaked non-derivable array
115
- // (seam_adjustments / neighbor_needs) projects identically while a changed
116
- // interface / new invariant / side effect does not. Keep every top-level field
117
- // (contract_version, goal_id, …): the narrowing is per-entry, so any top-level
118
- // field a downstream might read still participates in staleness.
119
- if (name === "finalized_module_contracts" || name === "module_contracts") {
120
- if (Array.isArray(stripped.module_contracts)) {
121
- return normalizeWhitespaceDeep({
122
- ...stripped,
123
- module_contracts: stripped.module_contracts.map((entry) => projectModuleContract(entry, DERIVABLE_MODULE_CONTRACT_FIELDS)),
124
- });
125
- }
126
- return normalizeWhitespaceDeep(stripped);
127
- }
128
- return normalizeWhitespaceDeep(stripped);
129
- }
130
- /**
131
- * The order-independent stable serialization used to hash a projection is the
132
- * shared `stableStringifyProjection` (re-exported above) — single-sourced in
133
- * `audit-tools/shared` so audit-code and remediate-code hash projections
134
- * identically.
135
- */
136
- //# sourceMappingURL=semanticProjection.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"semanticProjection.js","sourceRoot":"","sources":["../../../src/remediate/contractPipeline/semanticProjection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAAE,Q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