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,446 +0,0 @@
1
- // sites-pinned: tests/remediate/change-classification-backtracking.test.ts, tests/remediate/dc5.test.ts, tests/audit/scanner-linear-boundaries.test.ts
2
- // <!-- comment-symbol-exempt: names deliberately-retired symbols; this block records that history -->
3
- /**
4
- * DC-5 — obligation change-vs-addition classification + paired/scoped negative
5
- * test-spec gate (single source).
6
- *
7
- * Two latent failure modes this module closes:
8
- *
9
- * CE-013 (render-only misclassification): the paired-obligation gate used to
10
- * force EVERY testable obligation to carry a positive+negative pair, with no
11
- * notion of whether the obligation changes prior behavior or adds new
12
- * behavior. A pure addition has no behavior to regress, so pairing it is
13
- * burden without signal — and, worse, the "classification" lived only in the
14
- * prompt prose (render-only), never as a recorded, checkable verdict. This
15
- * module classifies each obligation *deterministically first* (does it touch
16
- * a symbol/file that already exists?) and records the verdict on the ledger,
17
- * so an LLM may confirm/override but the result is never silent.
18
- *
19
- * CE-006 (unscoped repo-wide-grep negative): a behavior-CHANGE obligation's
20
- * negative half could be satisfied by an assertion that greps the whole repo
21
- * ("no file anywhere contains X") — which rots immediately and proves nothing
22
- * about the changed symbol. The negative must be SCOPED to the changed
23
- * symbol/file. The scope check is a structural PREDICATE over the assertion
24
- * (it must name an anchor AND must not be an unscoped global scan), not a
25
- * keyword match — keyword matching alone is exactly what let the unscoped
26
- * negative through.
27
- *
28
- * Single-source invariant (mirrors `derive.ts`): the deriver, the test-plan
29
- * derivation gate (`validatePairedObligations`), and the `mergeImplementResults`
30
- * verify gate ALL classify and pair through the helpers here. No parallel logic.
31
- */
32
- import { isRecord } from "audit-tools/shared";
33
- // ── Symbol extraction ─────────────────────────────────────────────────────────
34
- /**
35
- * Identifier-like tokens (camelCase / snake_case / dotted / path-ish) that name a
36
- * code symbol or file. Length >= 3 so single letters and noise are ignored.
37
- * Used both to pull candidate symbols out of an obligation description and to
38
- * build the baseline corpus of pre-existing symbols.
39
- */
40
- const SYMBOL_TOKEN_PATTERN = /[A-Za-z_$][A-Za-z0-9_$./-]{2,}/g;
41
- /** Common English words that look identifier-ish but never name a symbol. */
42
- const SYMBOL_STOPWORDS = new Set([
43
- "the", "and", "for", "with", "that", "this", "must", "not", "its", "via",
44
- "per", "into", "when", "then", "than", "from", "module", "function", "value",
45
- "input", "output", "inputs", "outputs", "should", "shall", "handle", "failure",
46
- "mode", "implement", "contract", "boundary", "validation", "every", "each",
47
- "obligation", "behavior", "behaviour", "existing", "new", "add", "change",
48
- ]);
49
- /** Extract candidate symbol/file tokens from free text (lowercased, de-noised). */
50
- export function extractSymbolTokens(text) {
51
- if (typeof text !== "string" || text.length === 0)
52
- return [];
53
- const out = new Set();
54
- for (const raw of text.match(SYMBOL_TOKEN_PATTERN) ?? []) {
55
- let start = 0;
56
- let end = raw.length;
57
- while (start < end && "./-".includes(raw[start]))
58
- start++;
59
- while (end > start && "./-".includes(raw[end - 1]))
60
- end--;
61
- const token = raw.slice(start, end).toLowerCase();
62
- if (token.length < 3)
63
- continue;
64
- if (SYMBOL_STOPWORDS.has(token))
65
- continue;
66
- // <!-- comment-symbol-exempt: names deliberately-retired symbols; this block records that history -->
67
- // A token must carry a "code-ish" shape — a case hump, an underscore, a dot,
68
- // a slash, or a digit — so a plain prose word ("rejects") is not mistaken for
69
- // a symbol while `writeRecord`, `flush_buffer`, `src/a.ts`, `O_1` are kept.
70
- if (/[A-Z]/.test(raw.slice(1)) || /[_./\-0-9]/.test(token)) {
71
- out.add(token);
72
- }
73
- }
74
- return [...out];
75
- }
76
- /**
77
- * Build the baseline corpus of pre-existing symbol/file tokens from the finalized
78
- * module contracts. A symbol present here already exists, so an obligation that
79
- * references it is *changing* existing behavior rather than adding new behavior.
80
- *
81
- * The corpus is drawn from the declared interface surface (inputs / outputs /
82
- * side_effects / validation_boundary) plus each module name — the things the
83
- * contract says already exist at the seam.
84
- */
85
- export function buildBaselineSymbolCorpus(finalizedModuleContracts) {
86
- const corpus = new Set();
87
- const record = isRecord(finalizedModuleContracts) ? finalizedModuleContracts : {};
88
- const modules = Array.isArray(record.module_contracts) ? record.module_contracts : [];
89
- for (const mod of modules) {
90
- if (!isRecord(mod))
91
- continue;
92
- if (typeof mod.name === "string") {
93
- for (const t of extractSymbolTokens(mod.name))
94
- corpus.add(t);
95
- }
96
- for (const field of ["inputs", "outputs", "side_effects"]) {
97
- if (!Array.isArray(mod[field]))
98
- continue;
99
- for (const entry of mod[field]) {
100
- if (typeof entry !== "string")
101
- continue;
102
- for (const t of extractSymbolTokens(entry))
103
- corpus.add(t);
104
- }
105
- }
106
- if (typeof mod.validation_boundary === "string") {
107
- for (const t of extractSymbolTokens(mod.validation_boundary))
108
- corpus.add(t);
109
- }
110
- }
111
- return corpus;
112
- }
113
- // ── Deterministic classification (FIRST pass) ──────────────────────────────────
114
- // <!-- comment-symbol-exempt: names deliberately-retired symbols; this block records that history -->
115
- /**
116
- * Classify one obligation change-vs-addition deterministically.
117
- *
118
- * Heuristic: the obligation *touches an existing symbol* when any symbol token in
119
- * its description is present in the baseline corpus of pre-existing symbols. Such
120
- * an obligation is a behavior CHANGE; otherwise it is a pure ADDITION.
121
- *
122
- * The matched tokens become `touched_symbols` — the scope anchors a paired
123
- * negative assertion must name. This is the deterministic FIRST pass; an LLM may
124
- * confirm or override it via `applyLlmConfirmation`, and the override is recorded.
125
- */
126
- export function classifyObligationChange(description, baselineSymbols) {
127
- const tokens = extractSymbolTokens(description);
128
- const touched = tokens.filter((t) => baselineSymbols.has(t));
129
- if (touched.length > 0) {
130
- return {
131
- change_kind: "change",
132
- touched_symbols: touched,
133
- determined_by: "touches_existing_symbol",
134
- };
135
- }
136
- return {
137
- change_kind: "addition",
138
- touched_symbols: [],
139
- determined_by: "no_existing_symbol",
140
- };
141
- }
142
- // ── Anti-rot scope predicate (CE-006) ──────────────────────────────────────────
143
- /**
144
- * Markers of an UNSCOPED, repo-wide negative assertion — a grep/scan over the
145
- * whole tree that names no specific symbol and rots the moment any unrelated file
146
- * matches. Presence of one of these (without an offsetting scope anchor) is what
147
- * the predicate rejects. This is a STRUCTURAL signal about the assertion's shape,
148
- * distinct from polarity keywords.
149
- */
150
- const UNSCOPED_GLOBAL_SCAN_PATTERN = /\b(?:repo[\s-]?wide|whole\s+repo|entire\s+(?:repo|codebase|tree)|across\s+the\s+(?:repo|codebase|tree)|any\s+file|no\s+file\s+(?:anywhere|in\s+the\s+repo)|anywhere\s+in\s+the\s+(?:repo|codebase|tree)|grep\s+(?:the\s+)?(?:repo|codebase|tree))\b/i;
151
- /**
152
- * Negation cues that, in the SAME clause immediately before a global-scan phrase,
153
- * mark it as DESCRIPTIVE contrast ("scoped to X, *not* an unscoped repo-wide
154
- * check") rather than the assertion's actual action. Flagging the literal words
155
- * "repo-wide" regardless of negation is exactly what forced hosts to euphemise a
156
- * legitimately-scoped negative — the CE-006 false-positive. Only an AFFIRMATIVE
157
- * scan (the scan is the check) disqualifies scoping.
158
- */
159
- const SCAN_NEGATION_CUE = /\b(?:not|never|no\s+longer|rather\s+than|instead\s+of|without|avoids?|avoiding|isn'?t|aren'?t|doesn'?t|don'?t|won'?t)\b/i;
160
- /**
161
- * True when the assertion uses a global-scan phrase AFFIRMATIVELY — the scan is
162
- * the check it performs, not a contrast clause describing what it deliberately
163
- * avoids. Each scan match is judged by its own clause (text back to the nearest
164
- * `. ; , — --` boundary): a negation cue in that clause makes the mention
165
- * descriptive and non-disqualifying; an unqualified scan disqualifies. This is a
166
- * structural read of the assertion's action, not a bare keyword veto on the words.
167
- */
168
- function usesAffirmativeGlobalScan(assertion) {
169
- // Scan clause boundaries and negation cues once. Repeated mentions in one
170
- // clause share its first negation offset rather than rescanning prefixes.
171
- const events = new RegExp(`${SCAN_NEGATION_CUE.source}|[.;,]|—|--`, "gi");
172
- const scans = new RegExp(UNSCOPED_GLOBAL_SCAN_PATTERN.source, "gi");
173
- let event = events.exec(assertion);
174
- let negated = false;
175
- for (const match of assertion.matchAll(scans)) {
176
- while (event && event.index < match.index) {
177
- negated = !/^(?:[.;,]|—|--)$/.test(event[0]);
178
- event = events.exec(assertion);
179
- }
180
- if (!negated)
181
- return true;
182
- }
183
- return false;
184
- }
185
- /** Match a scope anchor as a whole word/path fragment inside an assertion. */
186
- function assertionNamesAnchor(assertion, anchor) {
187
- if (anchor.length < 3)
188
- return false;
189
- const escaped = anchor.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
190
- // Word/path boundary: the anchor is not glued to surrounding identifier chars.
191
- return new RegExp(`(?<![A-Za-z0-9_$])${escaped}(?![A-Za-z0-9_$])`, "i").test(assertion);
192
- }
193
- /**
194
- * A negative assertion for a behavior-CHANGE obligation is SCOPED when it names
195
- * at least one of the change's anchors (the touched symbol/file) AND does not
196
- * perform an affirmative unscoped repo-wide scan. Naming an anchor is necessary
197
- * but not sufficient: an assertion that both names the symbol and says "grep the
198
- * whole repo" is still rejected, because the scan, not the symbol, is what it
199
- * actually checks. A merely DESCRIPTIVE mention of a global scan ("scoped to X,
200
- * not an unscoped repo-wide check") does NOT disqualify — the veto reads the
201
- * assertion's action, not the literal words, so a host need not euphemise (CE-006).
202
- *
203
- * Returns true when the assertion is acceptably scoped to the change.
204
- */
205
- export function negativeAssertionIsScoped(assertion, anchors) {
206
- if (typeof assertion !== "string" || assertion.length === 0)
207
- return false;
208
- if (usesAffirmativeGlobalScan(assertion))
209
- return false;
210
- return anchors.some((a) => assertionNamesAnchor(assertion, a));
211
- }
212
- // ── Polarity detection (shared with the legacy keyword gate) ───────────────────
213
- /** Phrases that mark a negative/failure assertion (paired-obligation half). */
214
- export const NEGATIVE_ASSERTION_PATTERN = /\b(rejects?|rejected|throws?|errors?|fails?|failure|invalid|disallows?|forbidden|refuses?|must not|does not|should not|cannot|never|negative|missing|absent|empty)\b/i;
215
- /** Phrases that mark a positive/satisfied assertion (paired-obligation half). */
216
- export const POSITIVE_ASSERTION_PATTERN = /\b(accept|accepted|allow|allowed|succeed|succeeds|returns?|produces?|valid|present|satisfies|satisfied|passes?|emits?|writes?|equal|equals|matches?)\b/i;
217
- /**
218
- * Multi-segment identifier tokens (obligation ids `OBL-AUTH-fail-session`, kebab/
219
- * snake symbols, dotted/sliced paths `src/x/plan.ts`, `a::b`). A keyword regex
220
- * `\b`-boundary still fires on a polarity word delimited by `-`/`_`/`.`/`/`/`:`
221
- * inside such a token (e.g. `fail` in `OBL-AUTH-fail-session`), flipping a positive
222
- * assertion that merely *cites* an id. These carry no prose polarity, so mask them
223
- * before keyword classification. A run must have at least one internal delimiter to
224
- * qualify — ordinary prose words (no internal `-_./:`) are left untouched, as are
225
- * multiword phrases like "does not" (space-separated, not a single token).
226
- *
227
- * SCANNED, NOT MATCHED — and the reason is a measured quadratic, not taste. The
228
- * obvious regex here is `[A-Za-z0-9]+(?:[-_/.:]+[A-Za-z0-9]+)+`, and on a long
229
- * UNBROKEN alphanumeric run it is Θ(n²): the engine starts at every position and
230
- * each start consumes the rest of the run before the (absent) delimiter fails the
231
- * whole match, so a 16,000-char run took 3.36 SECONDS (measured on the `word-run`
232
- * family: 44/186/741/3360ms across 2k/4k/8k/16k, a clean 4×-per-doubling). An
233
- * assertion arrives from a host-authored test plan with no length bound, so the
234
- * input class is reachable.
235
- *
236
- * Restructuring the regex does NOT fix it: the failure is the per-start-position
237
- * rescan, so a possessive/atomic leading run only replaces an O(n) giveback with
238
- * an O(n) take, and a lookahead made of the same character class still has to
239
- * scan the run to fail. A single forward pass over a two-character-class grammar
240
- * is the linear form, and the grammar is tiny and fully ours. Same replacement
241
- * semantics as the regex it replaces, pinned by
242
- * `tests/remediate/change-classification-backtracking.test.ts`.
243
- */
244
- function isAsciiAlphanumeric(code) {
245
- return ((code >= 48 && code <= 57) || // 0-9
246
- (code >= 65 && code <= 90) || // A-Z
247
- (code >= 97 && code <= 122) // a-z
248
- );
249
- }
250
- /** The token's internal delimiters: `-`, `_`, `/`, `.`, `:`. */
251
- function isIdentifierDelimiter(code) {
252
- return (code === 45 || // -
253
- code === 95 || // _
254
- code === 47 || // /
255
- code === 46 || // .
256
- code === 58 // :
257
- );
258
- }
259
- /**
260
- * Blank out identifier tokens so their embedded words don't leak polarity.
261
- *
262
- * One left-to-right pass, O(n) — and the pass must SKIP, not step, on failure.
263
- * The regex's token is `alnum+ (delimiter+ alnum+)+`: it starts and ends on an
264
- * alphanumeric and contains at least one delimiter that is FOLLOWED by an
265
- * alphanumeric. So a maximal run of `alnum|delimiter` that holds no such
266
- * delimiter-then-alphanumeric pair cannot contain a token starting anywhere
267
- * inside it, and the scan jumps past the whole run in one step. Emitting the
268
- * leading character and re-entering would rescan the rest of the run at every
269
- * position — the same quadratic the regex had, merely relocated.
270
- *
271
- * On a match the replacement ends at the LAST alphanumeric of the run, leaving
272
- * any trailing delimiters in place, which is exactly where the regex's greedy
273
- * match ended.
274
- */
275
- function stripIdentifierTokens(assertion) {
276
- const out = [];
277
- const length = assertion.length;
278
- let index = 0;
279
- while (index < length) {
280
- if (!isAsciiAlphanumeric(assertion.charCodeAt(index))) {
281
- out.push(assertion[index]);
282
- index += 1;
283
- continue;
284
- }
285
- // Extend over the maximal alphanumeric/delimiter run, tracking whether a
286
- // delimiter has been followed by an alphanumeric (the qualifying shape).
287
- let cursor = index;
288
- let lastAlphanumeric = index;
289
- let sawDelimiter = false;
290
- let qualifies = false;
291
- while (cursor < length) {
292
- const current = assertion.charCodeAt(cursor);
293
- if (isAsciiAlphanumeric(current)) {
294
- if (sawDelimiter)
295
- qualifies = true;
296
- lastAlphanumeric = cursor;
297
- cursor += 1;
298
- continue;
299
- }
300
- if (isIdentifierDelimiter(current)) {
301
- sawDelimiter = true;
302
- cursor += 1;
303
- continue;
304
- }
305
- break;
306
- }
307
- if (qualifies) {
308
- out.push(" ");
309
- index = lastAlphanumeric + 1;
310
- continue;
311
- }
312
- // No token can begin inside this run — copy it through verbatim and resume
313
- // after it.
314
- out.push(assertion.slice(index, cursor));
315
- index = cursor;
316
- }
317
- return out.join("");
318
- }
319
- /**
320
- * Classify one assertion's polarity. An explicit `POSITIVE:` / `NEGATIVE:` label
321
- * is authoritative and skips the keyword fallback (so "POSITIVE: must not exceed
322
- * N" counts only as positive). Unlabeled assertions fall through to the keyword
323
- * regexes, which may match both polarities — run against an identifier-masked copy
324
- * so a polarity word embedded in a cited id (e.g. `fail` in `OBL-AUTH-fail-session`)
325
- * doesn't misclassify the assertion.
326
- */
327
- export function assertionPolarity(assertion) {
328
- const label = /^\s*(POSITIVE|NEGATIVE)\s*:/i.exec(assertion);
329
- if (label) {
330
- return label[1].toUpperCase() === "POSITIVE" ? "positive" : "negative";
331
- }
332
- const prose = stripIdentifierTokens(assertion);
333
- const neg = NEGATIVE_ASSERTION_PATTERN.test(prose);
334
- const pos = POSITIVE_ASSERTION_PATTERN.test(prose);
335
- if (neg && pos)
336
- return "both";
337
- if (neg)
338
- return "negative";
339
- if (pos)
340
- return "positive";
341
- return "none";
342
- }
343
- /**
344
- * Evaluate the paired positive+scoped-negative requirement for a behavior-CHANGE
345
- * obligation. `anchors` are the change's scope anchors (touched symbols/file).
346
- *
347
- * - A positive half is any assertion with positive polarity.
348
- * - A negative half counts ONLY when it is scoped to the change (CE-006): an
349
- * unscoped repo-wide negative does not satisfy the negative requirement.
350
- * `negativeUnscoped` is reported when the sole negative(s) failed scoping, so
351
- * the diagnostic distinguishes "no negative at all" from "negative not scoped".
352
- */
353
- export function evaluatePairing(assertions, anchors) {
354
- let hasPositive = false;
355
- let hasScopedNegative = false;
356
- let hasAnyNegative = false;
357
- for (const assertion of assertions) {
358
- if (typeof assertion !== "string")
359
- continue;
360
- const polarity = assertionPolarity(assertion);
361
- if (polarity === "positive" || polarity === "both")
362
- hasPositive = true;
363
- if (polarity === "negative" || polarity === "both") {
364
- hasAnyNegative = true;
365
- if (negativeAssertionIsScoped(assertion, anchors))
366
- hasScopedNegative = true;
367
- }
368
- }
369
- return {
370
- ok: hasPositive && hasScopedNegative,
371
- hasPositive,
372
- hasNegative: hasScopedNegative,
373
- negativeUnscoped: hasAnyNegative && !hasScopedNegative,
374
- };
375
- }
376
- // ── Defensive read + anchor derivation (used by the gates) ─────────────────────
377
- /**
378
- * Read an obligation's `change_classification` from a raw, untrusted payload.
379
- * Returns the narrowed classification, or `undefined` only when the field is
380
- * genuinely ABSENT — a truly unclassified obligation (e.g. a structural one), which
381
- * the gates already treat as a CHANGE (fail-closed) at the consumer.
382
- *
383
- * A classification that is PRESENT but CORRUPT (not a record, or an unrecognized
384
- * `change_kind`) is read as a fail-closed CHANGE rather than `undefined` (INV-IR-4):
385
- * a dropped or garbled classification can never relax the paired-test requirement
386
- * and can never let incremental item-scoping (contract-incremental-reconvergence)
387
- * carry a changed item forward as if it were an unchanged addition.
388
- */
389
- export function readObligationChangeClassification(obligation) {
390
- if (!isRecord(obligation))
391
- return undefined;
392
- // Distinguish "absent" (no field → undefined, consumers stay fail-closed) from
393
- // "present but corrupt" (field exists → an explicit fail-closed CHANGE verdict).
394
- if (!("change_classification" in obligation))
395
- return undefined;
396
- const cls = obligation.change_classification;
397
- const failClosedChange = (touched_symbols) => ({
398
- change_kind: "change",
399
- touched_symbols,
400
- determined_by: "touches_existing_symbol",
401
- });
402
- if (!isRecord(cls))
403
- return failClosedChange([]);
404
- if (cls.change_kind !== "change" && cls.change_kind !== "addition") {
405
- const touched = Array.isArray(cls.touched_symbols)
406
- ? cls.touched_symbols.filter((t) => typeof t === "string")
407
- : [];
408
- return failClosedChange(touched);
409
- }
410
- const touched = Array.isArray(cls.touched_symbols)
411
- ? cls.touched_symbols.filter((t) => typeof t === "string")
412
- : [];
413
- const determinedBy = cls.determined_by === "touches_existing_symbol" ||
414
- cls.determined_by === "no_existing_symbol" ||
415
- cls.determined_by === "llm_confirmed" ||
416
- cls.determined_by === "llm_override"
417
- ? cls.determined_by
418
- : "touches_existing_symbol";
419
- return {
420
- change_kind: cls.change_kind,
421
- touched_symbols: touched,
422
- determined_by: determinedBy,
423
- ...(typeof cls.rationale === "string" ? { rationale: cls.rationale } : {}),
424
- };
425
- }
426
- /**
427
- * The scope anchors a paired negative must name for one obligation. Prefers the
428
- * classification's recorded `touched_symbols`; falls back to the obligation id
429
- * plus any symbol tokens in its description when the classification carries none
430
- * (e.g. an unclassified obligation treated as a fail-closed change). Always
431
- * non-empty when the id is a real id, so a fail-closed change still has a concrete
432
- * anchor to scope against rather than vacuously accepting any negative.
433
- */
434
- export function obligationScopeAnchors(obligationId, description, classification) {
435
- if (classification && classification.touched_symbols.length > 0) {
436
- return classification.touched_symbols;
437
- }
438
- const anchors = new Set();
439
- if (typeof obligationId === "string" && obligationId.length >= 3) {
440
- anchors.add(obligationId.toLowerCase());
441
- }
442
- for (const t of extractSymbolTokens(description))
443
- anchors.add(t);
444
- return [...anchors];
445
- }
446
- //# sourceMappingURL=changeClassification.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"changeClassification.js","sourceRoot":"","sources":["../../../src/remediate/contractPipeline/changeClassification.ts"],"names":[],"mappings":"AAAA,uJAAuJ;AACvJ,sGAAsG;AACtG;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,EAAE,QAAQ,EAAuC,MAAM,oBAAoB,CAAC;AAEnF,iFAAiF;AAEjF;;;;;GAKG;AACH,MAAM,oBAAoB,GAAG,iCAAiC,CAAC;AAE/D,6EAA6E;AAC7E,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC;IAC/B,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK;IACxE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO;IAC5E,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS;IAC9E,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM;IAC1E,YAAY,EAAE,UAA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,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC3E,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CACpC,YAAoB,EACpB,WAAmB,EACnB,cAA0D;IAE1D,IAAI,cAAc,IAAI,cAAc,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAChE,OAAO,cAAc,CAAC,eAAe,CAAC;IACxC,CAAC;IACD,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAClC,IAAI,OAAO,YAAY,KAAK,QAAQ,IAAI,YAAY,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;QACjE,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,CAAC;IAC1C,CAAC;IACD,KAAK,MAAM,CAAC,IAAI,mBAAmB,CAAC,WAAW,CAAC;QAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACjE,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC;AACtB,CAAC"}
@@ -1,28 +0,0 @@
1
- import { type ReviewRequirement, type ReviewSubmissionFailureCode, type ContractReviewDeclaration } from "../../shared/types/reviewIndependence.js";
2
- import { type ContractPipelineArtifactName } from "./artifactStore.js";
3
- export declare function contractReviewBindingPath(artifactsDir: string, name: ContractPipelineArtifactName): string;
4
- /** Tool-owned expectation, separate from the worker's declared review envelope. */
5
- export declare function bindContractReviewPrompt(params: {
6
- artifactsDir: string;
7
- artifact: ContractPipelineArtifactName;
8
- role: string;
9
- emissionId: string;
10
- requirement: ReviewRequirement;
11
- prompt: string;
12
- }): Promise<string>;
13
- export declare function validateContractReviewInput(params: {
14
- artifactsDir: string;
15
- artifact: ContractPipelineArtifactName;
16
- role: string;
17
- requirement: ReviewRequirement;
18
- raw: unknown;
19
- }): Promise<{
20
- ok: true;
21
- payload: unknown;
22
- provenance?: ContractReviewDeclaration;
23
- } | {
24
- ok: false;
25
- issue: string;
26
- code: ReviewSubmissionFailureCode | "dependency_stale";
27
- }>;
28
- //# sourceMappingURL=contractReviewBinding.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"contractReviewBinding.d.ts","sourceRoot":"","sources":["../../../src/remediate/contractPipeline/contractReviewBinding.ts"],"names":[],"mappings":"AAQA,OAAO,EAA0D,KAAK,iBAAiB,EAAE,KAAK,2BAA2B,EAAE,KAAK,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AAC5M,OAAO,EAA6D,KAAK,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAalI,wBAAgB,yBAAyB,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,4BAA4B,GAAG,MAAM,CAE1G;AAOD,mFAAmF;AACnF,wBAAsB,wBAAwB,CAAC,MAAM,EAAE;IACrD,YAAY,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,4BAA4B,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAC3E,UAAU,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,iBAAiB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;CACpE,GAAG,OAAO,CAAC,MAAM,CAAC,CAyBlB;AAED,wBAAsB,2BAA2B,CAAC,MAAM,EAAE;IACxD,YAAY,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,4BAA4B,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAC3E,WAAW,EAAE,iBAAiB,CAAC;IAAC,GAAG,EAAE,OAAO,CAAC;CAC9C,GAAG,OAAO,CAAC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,yBAAyB,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,2BAA2B,GAAG,kBAAkB,CAAA;CAAE,CAAC,CAgBzK"}
@@ -1,75 +0,0 @@
1
- // sites-pinned: tests/remediate/contract-review-independence.test.ts, tests/remediate/contract-pipeline-adversarial.test.ts
2
- import { join } from "node:path";
3
- import { z } from "zod";
4
- import { bindWorkerPrompt } from "../../shared/submission/workerPromptBinding.js";
5
- import { writeJsonFile } from "../../shared/io/json.js";
6
- import { readSubmissionDocument } from "../../shared/submission/submissionClassifier.js";
7
- import { hashContent } from "../../shared/hash.js";
8
- import { stableStringify } from "../../shared/stableStringify.js";
9
- import { ReviewRequirementSchema, parseReviewSubmissionEnvelope } from "../../shared/types/reviewIndependence.js";
10
- import { DEPENDENCY_MAP, contractPipelineDir, readContractArtifact } from "./artifactStore.js";
11
- const BindingSchema = z.object({
12
- contract_version: z.literal("contract-review-binding/v1"),
13
- artifact_name: z.string(),
14
- role: z.string(),
15
- emission_id: z.string(),
16
- requirement: ReviewRequirementSchema,
17
- prompt_sha256: z.string().regex(/^[0-9a-f]{64}$/u),
18
- source_prompt_sha256: z.string().regex(/^[0-9a-f]{64}$/u),
19
- dependency_hashes: z.record(z.string(), z.string().nullable()),
20
- }).strict();
21
- export function contractReviewBindingPath(artifactsDir, name) {
22
- return join(contractPipelineDir(artifactsDir), `${name}.review-binding.json`);
23
- }
24
- async function dependencyHashes(artifactsDir, name) {
25
- const pairs = await Promise.all(DEPENDENCY_MAP[name].map(async (dep) => [dep, (await readContractArtifact(artifactsDir, dep))?.content_hash ?? null]));
26
- return Object.fromEntries(pairs);
27
- }
28
- /** Tool-owned expectation, separate from the worker's declared review envelope. */
29
- export async function bindContractReviewPrompt(params) {
30
- if (params.requirement === "ordinary")
31
- return params.prompt;
32
- const dependencies = await dependencyHashes(params.artifactsDir, params.artifact);
33
- const sourcePromptHash = hashContent(params.prompt);
34
- const priorRead = await readSubmissionDocument(contractReviewBindingPath(params.artifactsDir, params.artifact));
35
- const prior = BindingSchema.safeParse(priorRead.kind === "value" ? priorRead.value : undefined);
36
- const sameTask = prior.success && prior.data.artifact_name === params.artifact && prior.data.role === params.role &&
37
- prior.data.requirement === params.requirement && prior.data.source_prompt_sha256 === sourcePromptHash &&
38
- stableStringify(prior.data.dependency_hashes) === stableStringify(dependencies);
39
- const emissionId = sameTask ? prior.data.emission_id : params.emissionId;
40
- const context = { artifact_name: params.artifact, role: params.role, emission_id: emissionId, requirement: params.requirement, dependency_hashes: dependencies };
41
- const body = `${params.prompt}\n\n## Bound review submission\n\nThe domain schema above is the inner result. Submit the complete review envelope below to the named output path, not a raw artifact.\nReview context: ${stableStringify(context)}`;
42
- const bound = bindWorkerPrompt(body, prompt_sha256 => [
43
- "```json",
44
- JSON.stringify({ contract_version: "review-submission/v1", prompt_sha256,
45
- review: { mode: params.requirement === "degraded_allowed" ? "degraded" : "independent", reason: "<how the review context meets the required policy>" },
46
- result: { "<artifact fields>": "<complete domain object using the schema above>" },
47
- }, null, 2),
48
- "```",
49
- "If the required review context is unavailable, declare mode unavailable with the reason. Do not silently replace required independent review with self-review.",
50
- ].join("\n"));
51
- await writeJsonFile(contractReviewBindingPath(params.artifactsDir, params.artifact), {
52
- contract_version: "contract-review-binding/v1", ...context, prompt_sha256: bound.sha256, source_prompt_sha256: sourcePromptHash,
53
- });
54
- return bound.text;
55
- }
56
- export async function validateContractReviewInput(params) {
57
- if (params.requirement === "ordinary")
58
- return { ok: true, payload: params.raw };
59
- const read = await readSubmissionDocument(contractReviewBindingPath(params.artifactsDir, params.artifact));
60
- const parsed = BindingSchema.safeParse(read.kind === "value" ? read.value : undefined);
61
- if (!parsed.success || parsed.data.artifact_name !== params.artifact || parsed.data.role !== params.role || parsed.data.requirement !== params.requirement) {
62
- return { ok: false, code: "binding_missing", issue: "This required review has no current tool-issued role/policy binding. Re-emit the role and use its bound review-submission/v1 envelope." };
63
- }
64
- const binding = parsed.data;
65
- if (stableStringify(binding.dependency_hashes) !== stableStringify(await dependencyHashes(params.artifactsDir, params.artifact))) {
66
- return { ok: false, code: "dependency_stale", issue: "The inputs reviewed by this submission have changed. Re-emit the review against the current dependency content before accepting it." };
67
- }
68
- const submission = parseReviewSubmissionEnvelope(params.raw, { requirement: params.requirement, promptSha256: binding.prompt_sha256 });
69
- if (!submission.ok)
70
- return submission;
71
- return { ok: true, payload: submission.result, provenance: {
72
- requirement: params.requirement, prompt_sha256: binding.prompt_sha256, review: submission.review,
73
- } };
74
- }
75
- //# sourceMappingURL=contractReviewBinding.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"contractReviewBinding.js","sourceRoot":"","sources":["../../../src/remediate/contractPipeline/contractReviewBinding.ts"],"names":[],"mappings":"AAAA,4HAA4H;AAC5H,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iDAAiD,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,6BAA6B,EAA4F,MAAM,0CAA0C,CAAC;AAC5M,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,oBAAoB,EAAqC,MAAM,oBAAoB,CAAC;AAElI,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7B,gBAAgB,EAAE,CAAC,CAAC,OAAO,CAAC,4BAA4B,CAAC;IACzD,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;IACzB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,WAAW,EAAE,uBAAuB;IACpC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC;IAClD,oBAAo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IAC5B,IAAI,eAAe,CAAC,OAAO,CAAC,iBAAiB,CAAC,KAAK,eAAe,CAAC,MAAM,gBAAgB,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;QACjI,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,qIAAqI,EAAE,CAAC;IAC/L,CAAC;IACD,MAAM,UAAU,GAAG,6BAA6B,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,YAAY,EAAE,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IACvI,IAAI,CAAC,UAAU,CAAC,EAAE;QAAE,OAAO,UAAU,CAAC;IACtC,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE;YACzD,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,aAAa,EAAE,OAAO,CAAC,aAAa,EAAE,MAAM,EAAE,UAAU,CAAC,MAAO;SAClG,EAAE,CAAC;AACN,CAAC"}
@@ -1,27 +0,0 @@
1
- /**
2
- * Content fingerprint for a counterexample.
3
- *
4
- * The judge↔repair convergence gate ({@link evaluateJudgeGate} in
5
- * `../steps/contractPipeline.js`) must detect genuine re-occurrence of the
6
- * same unrepaired defect across independent adversarial rounds. The
7
- * reviewer-supplied counterexample `id` is free text (see
8
- * `Counterexample.id` in `audit-tools/shared`'s obligations types) and is NOT
9
- * a stable cross-round identity: two independent critic rounds each commonly
10
- * label their genuinely-distinct top counterexample "CE-001" (the prompt
11
- * schema's own example value). Keying convergence on the raw id string then
12
- * misreads "two different CEs that happen to share a label" as "the same CE
13
- * re-accepted after a repair" and falsely escalates a stall while a real new
14
- * defect is being correctly repaired.
15
- *
16
- * This fingerprint keys on CONTENT instead: the tool-constrained
17
- * `violated_obligation_ids` vocabulary (sorted, normalized) paired with the
18
- * normalized `claim` prose, falling back to the normalized claim alone when
19
- * no obligations are cited. Mirrors the derivation style of
20
- * `src/shared/findingIdentitySignature.ts` (tiered stable fields, aggressive
21
- * title normalization, truncated content hash) rather than introducing a
22
- * second identity convention.
23
- */
24
- import { type Counterexample } from "audit-tools/shared";
25
- /** Deterministic, content-derived identity for a counterexample. */
26
- export declare function counterexampleFingerprint(ce: Counterexample): string;
27
- //# sourceMappingURL=counterexampleFingerprint.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"counterexampleFingerprint.d.ts","sourceRoot":"","sources":["../../../src/remediate/contractPipeline/counterexampleFingerprint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAA+B,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEtF,oEAAoE;AACpE,wBAAgB,yBAAyB,CAAC,EAAE,EAAE,cAAc,GAAG,MAAM,CAWpE"}