audit-tools 0.52.5 → 0.54.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 (384) hide show
  1. package/dist/audit/cli/auditStep.d.ts +1 -1
  2. package/dist/audit/cli/conceptualDispatch.d.ts +2 -2
  3. package/dist/audit/cli/conceptualDispatch.d.ts.map +1 -1
  4. package/dist/audit/cli/conceptualDispatch.js +6 -5
  5. package/dist/audit/cli/conceptualDispatch.js.map +1 -1
  6. package/dist/audit/cli/confirmIntentStep.d.ts.map +1 -1
  7. package/dist/audit/cli/confirmIntentStep.js +3 -16
  8. package/dist/audit/cli/confirmIntentStep.js.map +1 -1
  9. package/dist/audit/cli/dispatch/hostHandoff.d.ts +2 -0
  10. package/dist/audit/cli/dispatch/hostHandoff.d.ts.map +1 -1
  11. package/dist/audit/cli/dispatch/hostHandoff.js +22 -1
  12. package/dist/audit/cli/dispatch/hostHandoff.js.map +1 -1
  13. package/dist/audit/cli/dispatch/packetFilter.d.ts +1 -1
  14. package/dist/audit/cli/dispatch/packetFilter.d.ts.map +1 -1
  15. package/dist/audit/cli/dispatch/packetFilter.js +1 -1
  16. package/dist/audit/cli/dispatch/packetFilter.js.map +1 -1
  17. package/dist/audit/cli/functionalPreflight.d.ts.map +1 -1
  18. package/dist/audit/cli/functionalPreflight.js +6 -3
  19. package/dist/audit/cli/functionalPreflight.js.map +1 -1
  20. package/dist/audit/cli/nextStepCommand.d.ts.map +1 -1
  21. package/dist/audit/cli/nextStepCommand.js +57 -34
  22. package/dist/audit/cli/nextStepCommand.js.map +1 -1
  23. package/dist/audit/cli/nextStepHelpers.d.ts +3 -3
  24. package/dist/audit/cli/nextStepHelpers.d.ts.map +1 -1
  25. package/dist/audit/cli/nextStepHelpers.js +52 -77
  26. package/dist/audit/cli/nextStepHelpers.js.map +1 -1
  27. package/dist/audit/cli/prompts.d.ts +1 -2
  28. package/dist/audit/cli/prompts.d.ts.map +1 -1
  29. package/dist/audit/cli/prompts.js +2 -12
  30. package/dist/audit/cli/prompts.js.map +1 -1
  31. package/dist/audit/cli/sampleRunCommand.d.ts +2 -2
  32. package/dist/audit/cli/semanticReviewStep.d.ts +11 -2
  33. package/dist/audit/cli/semanticReviewStep.d.ts.map +1 -1
  34. package/dist/audit/cli/semanticReviewStep.js +14 -10
  35. package/dist/audit/cli/semanticReviewStep.js.map +1 -1
  36. package/dist/audit/contracts/workerSchemas.d.ts +14 -14
  37. package/dist/audit/contracts/wrapperResponse.d.ts +6 -6
  38. package/dist/audit/extractors/graphRoutes.d.ts.map +1 -1
  39. package/dist/audit/extractors/graphRoutes.js +1 -3
  40. package/dist/audit/extractors/graphRoutes.js.map +1 -1
  41. package/dist/audit/io/artifacts.d.ts.map +1 -1
  42. package/dist/audit/io/artifacts.js +2 -3
  43. package/dist/audit/io/artifacts.js.map +1 -1
  44. package/dist/audit/orchestrator/advance.d.ts.map +1 -1
  45. package/dist/audit/orchestrator/advance.js +21 -1
  46. package/dist/audit/orchestrator/advance.js.map +1 -1
  47. package/dist/audit/orchestrator/architectureDiscovery.d.ts +25 -0
  48. package/dist/audit/orchestrator/architectureDiscovery.d.ts.map +1 -0
  49. package/dist/audit/orchestrator/architectureDiscovery.js +193 -0
  50. package/dist/audit/orchestrator/architectureDiscovery.js.map +1 -0
  51. package/dist/audit/orchestrator/dependencyMap.d.ts +20 -0
  52. package/dist/audit/orchestrator/dependencyMap.d.ts.map +1 -1
  53. package/dist/audit/orchestrator/dependencyMap.js +47 -0
  54. package/dist/audit/orchestrator/dependencyMap.js.map +1 -1
  55. package/dist/audit/orchestrator/dependencySlices.d.ts.map +1 -1
  56. package/dist/audit/orchestrator/dependencySlices.js +37 -3
  57. package/dist/audit/orchestrator/dependencySlices.js.map +1 -1
  58. package/dist/audit/orchestrator/designReviewProjection.d.ts +2 -6
  59. package/dist/audit/orchestrator/designReviewProjection.d.ts.map +1 -1
  60. package/dist/audit/orchestrator/designReviewProjection.js +2 -6
  61. package/dist/audit/orchestrator/designReviewProjection.js.map +1 -1
  62. package/dist/audit/orchestrator/designReviewPrompt.d.ts +2 -2
  63. package/dist/audit/orchestrator/designReviewPrompt.js +2 -2
  64. package/dist/audit/orchestrator/designReviewSnapshot.d.ts +2 -3
  65. package/dist/audit/orchestrator/designReviewSnapshot.d.ts.map +1 -1
  66. package/dist/audit/orchestrator/designReviewSnapshot.js +2 -3
  67. package/dist/audit/orchestrator/designReviewSnapshot.js.map +1 -1
  68. package/dist/audit/orchestrator/executorRunners.d.ts.map +1 -1
  69. package/dist/audit/orchestrator/executorRunners.js +1 -22
  70. package/dist/audit/orchestrator/executorRunners.js.map +1 -1
  71. package/dist/audit/orchestrator/executors.d.ts.map +1 -1
  72. package/dist/audit/orchestrator/executors.js +0 -12
  73. package/dist/audit/orchestrator/executors.js.map +1 -1
  74. package/dist/audit/orchestrator/ingestionExecutors.d.ts.map +1 -1
  75. package/dist/audit/orchestrator/ingestionExecutors.js +38 -37
  76. package/dist/audit/orchestrator/ingestionExecutors.js.map +1 -1
  77. package/dist/audit/orchestrator/nextStep.d.ts +2 -28
  78. package/dist/audit/orchestrator/nextStep.d.ts.map +1 -1
  79. package/dist/audit/orchestrator/nextStep.js +4 -37
  80. package/dist/audit/orchestrator/nextStep.js.map +1 -1
  81. package/dist/audit/orchestrator/obligationDerive.d.ts +2 -3
  82. package/dist/audit/orchestrator/obligationDerive.d.ts.map +1 -1
  83. package/dist/audit/orchestrator/obligationDerive.js +2 -3
  84. package/dist/audit/orchestrator/obligationDerive.js.map +1 -1
  85. package/dist/audit/orchestrator/pendingTasks.d.ts +2 -0
  86. package/dist/audit/orchestrator/pendingTasks.d.ts.map +1 -1
  87. package/dist/audit/orchestrator/pendingTasks.js +5 -1
  88. package/dist/audit/orchestrator/pendingTasks.js.map +1 -1
  89. package/dist/audit/orchestrator/planningExecutors.d.ts.map +1 -1
  90. package/dist/audit/orchestrator/planningExecutors.js +9 -0
  91. package/dist/audit/orchestrator/planningExecutors.js.map +1 -1
  92. package/dist/audit/orchestrator/requeueCommand.d.ts +1 -1
  93. package/dist/audit/orchestrator/resultBaseline.d.ts +5 -5
  94. package/dist/audit/orchestrator/resultBaseline.d.ts.map +1 -1
  95. package/dist/audit/orchestrator/resultBaseline.js +24 -47
  96. package/dist/audit/orchestrator/resultBaseline.js.map +1 -1
  97. package/dist/audit/orchestrator/selectiveDeepening/findingFollowup.d.ts.map +1 -1
  98. package/dist/audit/orchestrator/selectiveDeepening/findingFollowup.js +2 -0
  99. package/dist/audit/orchestrator/selectiveDeepening/findingFollowup.js.map +1 -1
  100. package/dist/audit/orchestrator/staleness.d.ts.map +1 -1
  101. package/dist/audit/orchestrator/staleness.js +14 -10
  102. package/dist/audit/orchestrator/staleness.js.map +1 -1
  103. package/dist/audit/orchestrator/state.js +1 -1
  104. package/dist/audit/orchestrator/state.js.map +1 -1
  105. package/dist/audit/orchestrator/synthesisExecutors.d.ts.map +1 -1
  106. package/dist/audit/orchestrator/synthesisExecutors.js +3 -0
  107. package/dist/audit/orchestrator/synthesisExecutors.js.map +1 -1
  108. package/dist/audit/types/auditState.d.ts +6 -6
  109. package/dist/audit/types/flowCoverage.d.ts +6 -6
  110. package/dist/audit/types.d.ts +24 -13
  111. package/dist/audit/types.d.ts.map +1 -1
  112. package/dist/audit/types.js +92 -11
  113. package/dist/audit/types.js.map +1 -1
  114. package/dist/remediate/contractPipeline/executionPlan.d.ts +1908 -0
  115. package/dist/remediate/contractPipeline/executionPlan.d.ts.map +1 -0
  116. package/dist/remediate/contractPipeline/executionPlan.js +467 -0
  117. package/dist/remediate/contractPipeline/executionPlan.js.map +1 -0
  118. package/dist/remediate/contractPipeline/runtimePlanAuthority.d.ts +12 -0
  119. package/dist/remediate/contractPipeline/runtimePlanAuthority.d.ts.map +1 -0
  120. package/dist/remediate/contractPipeline/runtimePlanAuthority.js +41 -0
  121. package/dist/remediate/contractPipeline/runtimePlanAuthority.js.map +1 -0
  122. package/dist/remediate/dedup/crossLensDedup.d.ts +3 -16
  123. package/dist/remediate/dedup/crossLensDedup.d.ts.map +1 -1
  124. package/dist/remediate/dedup/crossLensDedup.js +2 -32
  125. package/dist/remediate/dedup/crossLensDedup.js.map +1 -1
  126. package/dist/remediate/index.d.ts +2 -19
  127. package/dist/remediate/index.d.ts.map +1 -1
  128. package/dist/remediate/index.js +22 -138
  129. package/dist/remediate/index.js.map +1 -1
  130. package/dist/remediate/intake.d.ts +10 -10
  131. package/dist/remediate/intent/intentOrdering.d.ts +6 -8
  132. package/dist/remediate/intent/intentOrdering.d.ts.map +1 -1
  133. package/dist/remediate/intent/intentOrdering.js +24 -47
  134. package/dist/remediate/intent/intentOrdering.js.map +1 -1
  135. package/dist/remediate/phases/close.d.ts +25 -17
  136. package/dist/remediate/phases/close.d.ts.map +1 -1
  137. package/dist/remediate/phases/close.js +278 -218
  138. package/dist/remediate/phases/close.js.map +1 -1
  139. package/dist/remediate/phases/closeAcceptance.d.ts +42 -0
  140. package/dist/remediate/phases/closeAcceptance.d.ts.map +1 -0
  141. package/dist/remediate/phases/closeAcceptance.js +66 -0
  142. package/dist/remediate/phases/closeAcceptance.js.map +1 -0
  143. package/dist/remediate/phases/closeReviewProvenance.d.ts +1 -1
  144. package/dist/remediate/phases/closeReviewProvenance.d.ts.map +1 -1
  145. package/dist/remediate/phases/closeReviewProvenance.js +9 -8
  146. package/dist/remediate/phases/closeReviewProvenance.js.map +1 -1
  147. package/dist/remediate/phases/closeVerifyAnalyzerLeads.d.ts.map +1 -1
  148. package/dist/remediate/phases/closeVerifyAnalyzerLeads.js +11 -9
  149. package/dist/remediate/phases/closeVerifyAnalyzerLeads.js.map +1 -1
  150. package/dist/remediate/phases/closeVerifyHeadEvidence.d.ts +21 -86
  151. package/dist/remediate/phases/closeVerifyHeadEvidence.d.ts.map +1 -1
  152. package/dist/remediate/phases/closeVerifyHeadEvidence.js +30 -19
  153. package/dist/remediate/phases/closeVerifyHeadEvidence.js.map +1 -1
  154. package/dist/remediate/phases/plan.d.ts +3 -60
  155. package/dist/remediate/phases/plan.d.ts.map +1 -1
  156. package/dist/remediate/phases/plan.js +3 -227
  157. package/dist/remediate/phases/plan.js.map +1 -1
  158. package/dist/remediate/phases/triage.d.ts.map +1 -1
  159. package/dist/remediate/phases/triage.js +19 -30
  160. package/dist/remediate/phases/triage.js.map +1 -1
  161. package/dist/remediate/riskSignal.d.ts +9 -43
  162. package/dist/remediate/riskSignal.d.ts.map +1 -1
  163. package/dist/remediate/riskSignal.js +7 -28
  164. package/dist/remediate/riskSignal.js.map +1 -1
  165. package/dist/remediate/state/disposition.d.ts +2 -1
  166. package/dist/remediate/state/disposition.d.ts.map +1 -1
  167. package/dist/remediate/state/disposition.js +37 -1
  168. package/dist/remediate/state/disposition.js.map +1 -1
  169. package/dist/remediate/state/runIdentity.d.ts +2 -13
  170. package/dist/remediate/state/runIdentity.d.ts.map +1 -1
  171. package/dist/remediate/state/runIdentity.js +3 -13
  172. package/dist/remediate/state/runIdentity.js.map +1 -1
  173. package/dist/remediate/state/store.d.ts +12 -36
  174. package/dist/remediate/state/store.d.ts.map +1 -1
  175. package/dist/remediate/state/store.js +58 -150
  176. package/dist/remediate/state/store.js.map +1 -1
  177. package/dist/remediate/state/types.d.ts +406 -504
  178. package/dist/remediate/state/types.d.ts.map +1 -1
  179. package/dist/remediate/state/types.js +24 -104
  180. package/dist/remediate/state/types.js.map +1 -1
  181. package/dist/remediate/steps/contractPipeline.d.ts +7 -661
  182. package/dist/remediate/steps/contractPipeline.d.ts.map +1 -1
  183. package/dist/remediate/steps/contractPipeline.js +264 -3851
  184. package/dist/remediate/steps/contractPipeline.js.map +1 -1
  185. package/dist/remediate/steps/contractPipelinePrompts.d.ts +20 -142
  186. package/dist/remediate/steps/contractPipelinePrompts.d.ts.map +1 -1
  187. package/dist/remediate/steps/contractPipelinePrompts.js +48 -581
  188. package/dist/remediate/steps/contractPipelinePrompts.js.map +1 -1
  189. package/dist/remediate/steps/dispatch/contractConformanceReview.d.ts +4 -1
  190. package/dist/remediate/steps/dispatch/contractConformanceReview.d.ts.map +1 -1
  191. package/dist/remediate/steps/dispatch/contractConformanceReview.js +6 -3
  192. package/dist/remediate/steps/dispatch/contractConformanceReview.js.map +1 -1
  193. package/dist/remediate/steps/dispatch/hostContracts.d.ts +1 -1
  194. package/dist/remediate/steps/dispatch/hostContracts.d.ts.map +1 -1
  195. package/dist/remediate/steps/dispatch/hostHandoff.d.ts +4 -21
  196. package/dist/remediate/steps/dispatch/hostHandoff.d.ts.map +1 -1
  197. package/dist/remediate/steps/dispatch/hostHandoff.js +161 -383
  198. package/dist/remediate/steps/dispatch/hostHandoff.js.map +1 -1
  199. package/dist/remediate/steps/finalGate.d.ts +34 -0
  200. package/dist/remediate/steps/finalGate.d.ts.map +1 -1
  201. package/dist/remediate/steps/finalGate.js +44 -4
  202. package/dist/remediate/steps/finalGate.js.map +1 -1
  203. package/dist/remediate/steps/frictionCloseout.d.ts +1 -30
  204. package/dist/remediate/steps/frictionCloseout.d.ts.map +1 -1
  205. package/dist/remediate/steps/frictionCloseout.js +6 -99
  206. package/dist/remediate/steps/frictionCloseout.js.map +1 -1
  207. package/dist/remediate/steps/nextStep.d.ts +2 -15
  208. package/dist/remediate/steps/nextStep.d.ts.map +1 -1
  209. package/dist/remediate/steps/nextStep.js +254 -1042
  210. package/dist/remediate/steps/nextStep.js.map +1 -1
  211. package/dist/remediate/steps/prompts.js +16 -16
  212. package/dist/remediate/steps/prompts.js.map +1 -1
  213. package/dist/remediate/steps/stepUtils.d.ts +1 -1
  214. package/dist/remediate/steps/stepUtils.d.ts.map +1 -1
  215. package/dist/remediate/steps/types.d.ts +1 -1
  216. package/dist/remediate/steps/types.d.ts.map +1 -1
  217. package/dist/remediate/steps/types.js +1 -1
  218. package/dist/remediate/steps/types.js.map +1 -1
  219. package/dist/remediate/types/options.d.ts +9 -0
  220. package/dist/remediate/types/options.d.ts.map +1 -1
  221. package/dist/remediate/validation/artifacts.d.ts.map +1 -1
  222. package/dist/remediate/validation/artifacts.js +10 -56
  223. package/dist/remediate/validation/artifacts.js.map +1 -1
  224. package/dist/remediate/validation/remediationState.d.ts +2 -2
  225. package/dist/remediate/validation/remediationState.d.ts.map +1 -1
  226. package/dist/remediate/validation/remediationState.js +17 -77
  227. package/dist/remediate/validation/remediationState.js.map +1 -1
  228. package/dist/remediate/validation/verificationReport.d.ts +3 -0
  229. package/dist/remediate/validation/verificationReport.d.ts.map +1 -0
  230. package/dist/remediate/validation/verificationReport.js +28 -0
  231. package/dist/remediate/validation/verificationReport.js.map +1 -0
  232. package/dist/shared/analyzers/types.d.ts +10 -10
  233. package/dist/shared/engine/obligationEngine.d.ts +2 -2
  234. package/dist/shared/friction/triage.d.ts +7 -28
  235. package/dist/shared/friction/triage.d.ts.map +1 -1
  236. package/dist/shared/friction/triage.js +7 -28
  237. package/dist/shared/friction/triage.js.map +1 -1
  238. package/dist/shared/graph/orderedReachability.js +1 -1
  239. package/dist/shared/graph/orderedReachability.js.map +1 -1
  240. package/dist/shared/index.d.ts +5 -6
  241. package/dist/shared/index.d.ts.map +1 -1
  242. package/dist/shared/index.js +3 -4
  243. package/dist/shared/index.js.map +1 -1
  244. package/dist/shared/loopCorePaths.d.ts.map +1 -1
  245. package/dist/shared/loopCorePaths.js +37 -5
  246. package/dist/shared/loopCorePaths.js.map +1 -1
  247. package/dist/shared/prompts.d.ts +24 -10
  248. package/dist/shared/prompts.d.ts.map +1 -1
  249. package/dist/shared/prompts.js +27 -13
  250. package/dist/shared/prompts.js.map +1 -1
  251. package/dist/shared/reReview/projectionDiff.d.ts.map +1 -1
  252. package/dist/shared/reReview/projectionDiff.js +6 -14
  253. package/dist/shared/reReview/projectionDiff.js.map +1 -1
  254. package/dist/shared/types/executionPlan.d.ts +416 -0
  255. package/dist/shared/types/executionPlan.d.ts.map +1 -0
  256. package/dist/shared/types/executionPlan.js +132 -0
  257. package/dist/shared/types/executionPlan.js.map +1 -0
  258. package/dist/shared/types/remediationOutcome.d.ts +1378 -12
  259. package/dist/shared/types/remediationOutcome.d.ts.map +1 -1
  260. package/dist/shared/types/remediationOutcome.js +29 -1
  261. package/dist/shared/types/remediationOutcome.js.map +1 -1
  262. package/dist/shared/types/{contractPipeline/verification.d.ts → verificationReport.d.ts} +9 -37
  263. package/dist/shared/types/verificationReport.d.ts.map +1 -0
  264. package/dist/shared/types/verificationReport.js +4 -0
  265. package/dist/shared/types/verificationReport.js.map +1 -0
  266. package/dist/shared/validation/findingGrounding.d.ts +3 -5
  267. package/dist/shared/validation/findingGrounding.d.ts.map +1 -1
  268. package/dist/shared/validation/findingGrounding.js +4 -7
  269. package/dist/shared/validation/findingGrounding.js.map +1 -1
  270. package/package.json +2 -1
  271. package/scripts/shared/primitives.mjs +20 -0
  272. package/skills/audit-code/SKILL.md +5 -12
  273. package/skills/audit-code/audit-code.prompt.md +5 -8
  274. package/skills/audit-code/opencode-command-template.txt +2 -2
  275. package/skills/remediate-code/SKILL.md +5 -7
  276. package/skills/remediate-code/remediate-code.prompt.md +5 -5
  277. package/dispatch/lens-definitions.json +0 -46
  278. package/dist/remediate/contractPipeline/artifactNames.d.ts +0 -8
  279. package/dist/remediate/contractPipeline/artifactNames.d.ts.map +0 -1
  280. package/dist/remediate/contractPipeline/artifactNames.js +0 -28
  281. package/dist/remediate/contractPipeline/artifactNames.js.map +0 -1
  282. package/dist/remediate/contractPipeline/artifactStore.d.ts +0 -219
  283. package/dist/remediate/contractPipeline/artifactStore.d.ts.map +0 -1
  284. package/dist/remediate/contractPipeline/artifactStore.js +0 -436
  285. package/dist/remediate/contractPipeline/artifactStore.js.map +0 -1
  286. package/dist/remediate/contractPipeline/changeClassification.d.ts +0 -130
  287. package/dist/remediate/contractPipeline/changeClassification.d.ts.map +0 -1
  288. package/dist/remediate/contractPipeline/changeClassification.js +0 -446
  289. package/dist/remediate/contractPipeline/changeClassification.js.map +0 -1
  290. package/dist/remediate/contractPipeline/contractReviewBinding.d.ts +0 -28
  291. package/dist/remediate/contractPipeline/contractReviewBinding.d.ts.map +0 -1
  292. package/dist/remediate/contractPipeline/contractReviewBinding.js +0 -75
  293. package/dist/remediate/contractPipeline/contractReviewBinding.js.map +0 -1
  294. package/dist/remediate/contractPipeline/counterexampleFingerprint.d.ts +0 -27
  295. package/dist/remediate/contractPipeline/counterexampleFingerprint.d.ts.map +0 -1
  296. package/dist/remediate/contractPipeline/counterexampleFingerprint.js +0 -37
  297. package/dist/remediate/contractPipeline/counterexampleFingerprint.js.map +0 -1
  298. package/dist/remediate/contractPipeline/cyclicSeamResolution.d.ts +0 -131
  299. package/dist/remediate/contractPipeline/cyclicSeamResolution.d.ts.map +0 -1
  300. package/dist/remediate/contractPipeline/cyclicSeamResolution.js +0 -257
  301. package/dist/remediate/contractPipeline/cyclicSeamResolution.js.map +0 -1
  302. package/dist/remediate/contractPipeline/derive.d.ts +0 -173
  303. package/dist/remediate/contractPipeline/derive.d.ts.map +0 -1
  304. package/dist/remediate/contractPipeline/derive.js +0 -477
  305. package/dist/remediate/contractPipeline/derive.js.map +0 -1
  306. package/dist/remediate/contractPipeline/finalizedContractFields.d.ts +0 -50
  307. package/dist/remediate/contractPipeline/finalizedContractFields.d.ts.map +0 -1
  308. package/dist/remediate/contractPipeline/finalizedContractFields.js +0 -77
  309. package/dist/remediate/contractPipeline/finalizedContractFields.js.map +0 -1
  310. package/dist/remediate/contractPipeline/idRegistry.d.ts +0 -144
  311. package/dist/remediate/contractPipeline/idRegistry.d.ts.map +0 -1
  312. package/dist/remediate/contractPipeline/idRegistry.js +0 -214
  313. package/dist/remediate/contractPipeline/idRegistry.js.map +0 -1
  314. package/dist/remediate/contractPipeline/obligationKinds.d.ts +0 -27
  315. package/dist/remediate/contractPipeline/obligationKinds.d.ts.map +0 -1
  316. package/dist/remediate/contractPipeline/obligationKinds.js +0 -18
  317. package/dist/remediate/contractPipeline/obligationKinds.js.map +0 -1
  318. package/dist/remediate/contractPipeline/phaseCut.d.ts +0 -125
  319. package/dist/remediate/contractPipeline/phaseCut.d.ts.map +0 -1
  320. package/dist/remediate/contractPipeline/phaseCut.js +0 -339
  321. package/dist/remediate/contractPipeline/phaseCut.js.map +0 -1
  322. package/dist/remediate/contractPipeline/phaseCutArtifact.d.ts +0 -31
  323. package/dist/remediate/contractPipeline/phaseCutArtifact.d.ts.map +0 -1
  324. package/dist/remediate/contractPipeline/phaseCutArtifact.js +0 -48
  325. package/dist/remediate/contractPipeline/phaseCutArtifact.js.map +0 -1
  326. package/dist/remediate/contractPipeline/repairState.d.ts +0 -110
  327. package/dist/remediate/contractPipeline/repairState.d.ts.map +0 -1
  328. package/dist/remediate/contractPipeline/repairState.js +0 -185
  329. package/dist/remediate/contractPipeline/repairState.js.map +0 -1
  330. package/dist/remediate/contractPipeline/reviewSnapshot.d.ts +0 -79
  331. package/dist/remediate/contractPipeline/reviewSnapshot.d.ts.map +0 -1
  332. package/dist/remediate/contractPipeline/reviewSnapshot.js +0 -140
  333. package/dist/remediate/contractPipeline/reviewSnapshot.js.map +0 -1
  334. package/dist/remediate/contractPipeline/semanticProjection.d.ts +0 -64
  335. package/dist/remediate/contractPipeline/semanticProjection.d.ts.map +0 -1
  336. package/dist/remediate/contractPipeline/semanticProjection.js +0 -136
  337. package/dist/remediate/contractPipeline/semanticProjection.js.map +0 -1
  338. package/dist/remediate/contractPipeline/sketchSource.d.ts +0 -194
  339. package/dist/remediate/contractPipeline/sketchSource.d.ts.map +0 -1
  340. package/dist/remediate/contractPipeline/sketchSource.js +0 -262
  341. package/dist/remediate/contractPipeline/sketchSource.js.map +0 -1
  342. package/dist/remediate/contractPipeline/testPlanCarry.d.ts +0 -17
  343. package/dist/remediate/contractPipeline/testPlanCarry.d.ts.map +0 -1
  344. package/dist/remediate/contractPipeline/testPlanCarry.js +0 -72
  345. package/dist/remediate/contractPipeline/testPlanCarry.js.map +0 -1
  346. package/dist/remediate/steps/dispatch/marshal.d.ts +0 -7
  347. package/dist/remediate/steps/dispatch/marshal.d.ts.map +0 -1
  348. package/dist/remediate/steps/dispatch/marshal.js +0 -11
  349. package/dist/remediate/steps/dispatch/marshal.js.map +0 -1
  350. package/dist/remediate/validation/contractPipeline.d.ts +0 -35
  351. package/dist/remediate/validation/contractPipeline.d.ts.map +0 -1
  352. package/dist/remediate/validation/contractPipeline.js +0 -613
  353. package/dist/remediate/validation/contractPipeline.js.map +0 -1
  354. package/dist/remediate/validation/contractPipelineGates.d.ts +0 -272
  355. package/dist/remediate/validation/contractPipelineGates.d.ts.map +0 -1
  356. package/dist/remediate/validation/contractPipelineGates.js +0 -1397
  357. package/dist/remediate/validation/contractPipelineGates.js.map +0 -1
  358. package/dist/shared/types/contractPipeline/design.d.ts +0 -79
  359. package/dist/shared/types/contractPipeline/design.d.ts.map +0 -1
  360. package/dist/shared/types/contractPipeline/design.js +0 -16
  361. package/dist/shared/types/contractPipeline/design.js.map +0 -1
  362. package/dist/shared/types/contractPipeline/goal.d.ts +0 -41
  363. package/dist/shared/types/contractPipeline/goal.d.ts.map +0 -1
  364. package/dist/shared/types/contractPipeline/goal.js +0 -10
  365. package/dist/shared/types/contractPipeline/goal.js.map +0 -1
  366. package/dist/shared/types/contractPipeline/implementation.d.ts +0 -118
  367. package/dist/shared/types/contractPipeline/implementation.d.ts.map +0 -1
  368. package/dist/shared/types/contractPipeline/implementation.js +0 -13
  369. package/dist/shared/types/contractPipeline/implementation.js.map +0 -1
  370. package/dist/shared/types/contractPipeline/obligations.d.ts +0 -283
  371. package/dist/shared/types/contractPipeline/obligations.d.ts.map +0 -1
  372. package/dist/shared/types/contractPipeline/obligations.js +0 -84
  373. package/dist/shared/types/contractPipeline/obligations.js.map +0 -1
  374. package/dist/shared/types/contractPipeline/verification.d.ts.map +0 -1
  375. package/dist/shared/types/contractPipeline/verification.js +0 -10
  376. package/dist/shared/types/contractPipeline/verification.js.map +0 -1
  377. package/dist/shared/types/contractPipeline.d.ts +0 -48
  378. package/dist/shared/types/contractPipeline.d.ts.map +0 -1
  379. package/dist/shared/types/contractPipeline.js +0 -32
  380. package/dist/shared/types/contractPipeline.js.map +0 -1
  381. package/dist/shared/types/obligationLedger.d.ts +0 -39
  382. package/dist/shared/types/obligationLedger.d.ts.map +0 -1
  383. package/dist/shared/types/obligationLedger.js +0 -49
  384. package/dist/shared/types/obligationLedger.js.map +0 -1
@@ -1,110 +0,0 @@
1
- import { type Counterexample } from "audit-tools/shared";
2
- /** One recorded owner waiver: this counterexample is an accepted limitation of THIS run. */
3
- export interface CounterexampleWaiver {
4
- /** The counterexample id as the judge report / counterexample artifact names it. */
5
- ce_id: string;
6
- /**
7
- * Content-derived identity (`fp:<fingerprint>`, falling back to `id:<raw>`),
8
- * computed at fold time — the SAME keying the convergence gate uses, so a
9
- * waiver survives a re-derived counterexample artifact that re-labels the
10
- * same claim with a new id. A CHANGED claim gets a new fingerprint and
11
- * correctly re-surfaces: the waiver bound the claim, not the label.
12
- */
13
- key: string;
14
- /** Why this counterexample is accepted as a limitation. Required, non-empty. */
15
- rationale: string;
16
- /** Who decided. Attributable identity, not proof — see the module header. */
17
- waived_by: string;
18
- waived_at: string;
19
- }
20
- export interface ContractRepairState {
21
- schema_version: "remediate-code-contract-pipeline/repair-state/v1alpha1";
22
- /**
23
- * One entry per judge-ordered repair step emission (keyed by judge hash).
24
- * `accepted_ce_ids` records the judge-accepted counterexample ids this repair
25
- * was dispatched to address, for human debugging/display only.
26
- * `addressed_ce_fingerprints` is the CONTENT-keyed form the convergence gate
27
- * actually diffs against — see `counterexampleKeyOf`: raw reviewer
28
- * ids are not stable cross-round identity (two independent adversarial
29
- * rounds commonly both label their top counterexample "CE-001"), so the gate
30
- * resolves each accepted id against the live counterexample artifact and
31
- * keys on content (violated_obligation_ids + normalized claim) instead,
32
- * falling back to raw-id keying only when an id cannot be resolved. The
33
- * cumulative union of fingerprints across repairs is the "already-addressed"
34
- * set; a re-accepted (un-converged) counterexample is detected as a stall
35
- * rather than silently re-repaired. Entries written before this field
36
- * existed lack it — they default to `[]` (fail-open: at most one extra
37
- * repair round on an in-flight upgrade, never a false stall).
38
- */
39
- repairs: {
40
- judge_hash: string;
41
- target: string;
42
- at: string;
43
- accepted_ce_ids?: string[];
44
- addressed_ce_fingerprints?: string[];
45
- }[];
46
- /**
47
- * One entry per conceptual-design-critique-driven design repair (keyed by
48
- * critique hash). `blocking_ids` records the blocking critique-item ids the
49
- * repair was dispatched to address. Target-scoped history permits upstream-to-interface
50
- * progress without resetting the global iteration bound. The per-target union is the
51
- * "already-addressed" set the critique convergence gate diffs each fresh
52
- * critique against, so a re-raised (un-resolved) blocking concern is detected
53
- * as a stall rather than silently re-repaired forever.
54
- */
55
- critique_repairs: {
56
- critique_hash: string;
57
- at: string;
58
- blocking_ids: string[];
59
- target?: "finalized_module_contracts" | "module_decomposition";
60
- }[];
61
- /** One entry per implementation_dag traceability rejection. */
62
- dag_regenerations: {
63
- violations: string[];
64
- at: string;
65
- }[];
66
- /** Recorded owner waivers — absent on ledgers written before the verb existed. */
67
- waivers?: CounterexampleWaiver[];
68
- }
69
- export declare function readRepairState(artifactsDir: string): Promise<ContractRepairState>;
70
- export declare function writeRepairState(artifactsDir: string, state: ContractRepairState): Promise<void>;
71
- /** The tool-named host lane: the operator's waiver decisions land here. */
72
- export declare function counterexampleWaiversPath(artifactsDir: string): string;
73
- /** id → live counterexample entry, from a (possibly absent) artifact payload. */
74
- export declare function counterexamplesByIdOf(counterexamplePayload: unknown): Map<string, Counterexample>;
75
- /**
76
- * Content-keyed identity for a counterexample id: `fp:<fingerprint>` when the
77
- * id resolves against the live artifact, `id:<raw>` otherwise. The ONE keying
78
- * both the convergence gate and the waiver ledger use.
79
- */
80
- export declare function counterexampleKeyOf(counterexamplesById: ReadonlyMap<string, Counterexample>, rawId: string): string;
81
- /** The subset of `acceptedIds` covered by recorded waivers (fingerprint-first, raw-id fallback). */
82
- export declare function waivedAcceptedIds(state: ContractRepairState, counterexamplesById: ReadonlyMap<string, Counterexample>, acceptedIds: readonly string[]): Set<string>;
83
- /**
84
- * Payload-level convenience for the cross-gate callers: which of the CURRENT
85
- * judge report's accepted counterexample ids are waived in the ledger.
86
- */
87
- export declare function waivedJudgeAcceptedIds(state: ContractRepairState, judgeReportPayload: unknown, counterexamplePayload: unknown): Set<string>;
88
- /** Outcome of one waiver-file fold attempt. */
89
- export interface WaiverFold {
90
- /** Validation problems. Non-empty means NOTHING was applied and the file remains. */
91
- issues: string[];
92
- /** Newly recorded waivers (0 when the file is absent or everything was a duplicate). */
93
- folded: number;
94
- }
95
- /**
96
- * Fold the host-written waiver file into the ledger — all-or-nothing.
97
- *
98
- * Absent file: no-op. Any invalid entry (malformed JSON, missing/empty
99
- * `ce_id` / `rationale` / `waived_by`, or a `ce_id` that matches neither a
100
- * live counterexample nor a judge-accepted id) refuses the WHOLE file: nothing
101
- * is applied, the file stays in place, and the issues are returned for the
102
- * blocked step to name — an invalid decision record must never half-apply.
103
- * Valid entries are deduped by content key, appended to `state.waivers`,
104
- * persisted, and the file is consumed (deleted).
105
- */
106
- export declare function foldCounterexampleWaivers(artifactsDir: string, context: {
107
- counterexamplesById: ReadonlyMap<string, Counterexample>;
108
- judgeAcceptedIds: ReadonlySet<string>;
109
- }): Promise<WaiverFold>;
110
- //# sourceMappingURL=repairState.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"repairState.d.ts","sourceRoot":"","sources":["../../../src/remediate/contractPipeline/repairState.ts"],"names":[],"mappings":"AAsBA,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,oBAAoB,CAAC;AAI5B,4FAA4F;AAC5F,MAAM,WAAW,oBAAoB;IACnC,oFAAoF;IACpF,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;OAMG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ,gFAAgF;IAChF,SAAS,EAAE,MAAM,CAAC;IAClB,6EAA6E;IAC7E,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,cAAc,EAAE,wDAAwD,CAAC;IACzE;;;;;;;;;;;;;;;;OAgBG;IACH,O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cAAc,CAAC,EACxD,WAAW,EAAE,SAAS,MAAM,EAAE,GAC7B,GAAG,CAAC,MAAM,CAAC,CAUb;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,mBAAmB,EAC1B,kBAAkB,EAAE,OAAO,EAC3B,qBAAqB,EAAE,OAAO,GAC7B,GAAG,CAAC,MAAM,CAAC,CAMb;AAED,+CAA+C;AAC/C,MAAM,WAAW,UAAU;IACzB,qFAAqF;IACrF,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,wFAAwF;IACxF,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,yBAAyB,CAC7C,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE;IACP,mBAAmB,EAAE,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACzD,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACvC,GACA,OAAO,CAAC,UAAU,CAAC,CA0ErB"}
@@ -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,CAAC;AACjC,OAAO,EACL,QAAQ,EACR,oBAAoB,EACpB,aAAa,GAEd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AA+D3E,SAAS,eAAe,CAAC,YAAoB;IAC3C,OAAO,IAAI,CAAC,mBAAmB,CAAC,YAAY,CAAC,EAAE,mBAAmB,CAAC,CAAC;AACtE,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,YAAoB;IACxD,MAAM,KAAK,GAAG,MAAM,oBAAoB,CACtC,eAAe,CAAC,YAAY,CAAC,CAC9B,CAAC;IACF,OAAO,CACL,KAAK,IAAI;QACP,cAAc,EAAE,wDAAwD;QACxE,OAAO,EAAE,EAAE;QACX,gBAAgB,EAAE,EAAE;QACpB,iBAAiB,EAAE,EAAE;KACtB,CACF,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,YA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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,MAAM,uBAAuB,EAC3B,2DAAoE,CAAC;AAEvE,MAAM,WAAW,cAAc;IAC7B,cAAc,EAAE,OAAO,uBAAuB,CAAC;IAC/C,aAAa,EAAE,4BAA4B,CAAC;IAC5C;;;;;;;;;OASG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,WAAW,EAAE,MAAM,CAAC;IACpB,6EAA6E;IAC7E,aAAa,EAAE,OAAO,CAAC;IACvB,sEAAsE;IACtE,eAAe,EAAE,OAAO,CAAC,MAAM,CAAC,4BAA4B,EAAE,OAAO,CAAC,CAAC,CAAC;CACzE;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,+BAAyB,CAAC;AAMzD,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,4BAA4B,GACjC,OAAO,CAET;AAED;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CACtC,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,4BAA4B,GACjC,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAShC;AAED;;;;;GAKG;AACH,wBAAsB,qBAAqB,CACzC,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,4BAA4B,EAClC,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC,CAoBf;AAOD,MAAM,WAAW,aAAa;IAC5B,gFAAgF;IAChF,aAAa,EAAE;QAAE,GAAG,EAAE,4BAA4B,CAAC;QAAC,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE,EAAE,CAAC;IACxE,8EAA8E;IAC9E,YAAY,EAAE,OAAO,CAAC;CACvB;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,4BAA4B,EAClC,QAAQ,EAAE,cAAc,GACvB,OAAO,CAAC,aAAa,CAAC,CAYxB;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,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,CAA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C;AACrE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CACnC,KAAmC,EACnC,QAAwB,EACxB,KAAoB;IAEpB,OAAO,yBAAyB,CAAC;QAC/B,YAAY,EAAE,QAAQ,CAAC,aAAa;QACpC,aAAa,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YACjD,KAAK,EAAE,KAAK,CAAC,GAAG;YAChB,KAAK,EAAE,KAAK,CAAC,KAAK;SACnB,CAAC,CAAC;QACH,YAAY,EAAE,KAAK,CAAC,YAAY;QAChC,WAAW,EAAE,UAAU;QACvB,4EAA4E;QAC5E,uEAAuE;QACvE,2EAA2E;QAC3E,wEAAwE;QACxE,qDAAqD;QACrD,gBAAgB,EAAE,QAAQ,CAAC,IAAI;KAChC,CAAC,CAAC;AACL,CAAC"}
@@ -1,64 +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 { 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"}