audit-tools 0.28.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 (1476) hide show
  1. package/README.audit.md +223 -0
  2. package/README.md +42 -0
  3. package/README.remediate.md +113 -0
  4. package/audit-code-wrapper-build.mjs +185 -0
  5. package/audit-code-wrapper-install-hosts.mjs +1079 -0
  6. package/audit-code-wrapper-install-renderers.mjs +58 -0
  7. package/audit-code-wrapper-io.mjs +155 -0
  8. package/audit-code-wrapper-legacy.mjs +125 -0
  9. package/audit-code-wrapper-lib.mjs +314 -0
  10. package/audit-code-wrapper-opencode.mjs +241 -0
  11. package/audit-code.mjs +12 -0
  12. package/dispatch/lens-definitions.json +46 -0
  13. package/dispatch/merge-results.mjs +110 -0
  14. package/dispatch/validate-result.mjs +59 -0
  15. package/dispatch/validate.mjs +16 -0
  16. package/dist/audit/adapters/coverageSummary.d.ts +9 -0
  17. package/dist/audit/adapters/coverageSummary.d.ts.map +1 -0
  18. package/dist/audit/adapters/coverageSummary.js +18 -0
  19. package/dist/audit/adapters/coverageSummary.js.map +1 -0
  20. package/dist/audit/adapters/eslint.d.ts +14 -0
  21. package/dist/audit/adapters/eslint.d.ts.map +1 -0
  22. package/dist/audit/adapters/eslint.js +28 -0
  23. package/dist/audit/adapters/eslint.js.map +1 -0
  24. package/dist/audit/adapters/normalizeExternal.d.ts +13 -0
  25. package/dist/audit/adapters/normalizeExternal.d.ts.map +1 -0
  26. package/dist/audit/adapters/normalizeExternal.js +44 -0
  27. package/dist/audit/adapters/normalizeExternal.js.map +1 -0
  28. package/dist/audit/adapters/npmAudit.d.ts +16 -0
  29. package/dist/audit/adapters/npmAudit.d.ts.map +1 -0
  30. package/dist/audit/adapters/npmAudit.js +24 -0
  31. package/dist/audit/adapters/npmAudit.js.map +1 -0
  32. package/dist/audit/adapters/semgrep.d.ts +23 -0
  33. package/dist/audit/adapters/semgrep.d.ts.map +1 -0
  34. package/dist/audit/adapters/semgrep.js +40 -0
  35. package/dist/audit/adapters/semgrep.js.map +1 -0
  36. package/dist/audit/cli/advanceAuditCommand.d.ts +2 -0
  37. package/dist/audit/cli/advanceAuditCommand.d.ts.map +1 -0
  38. package/dist/audit/cli/advanceAuditCommand.js +95 -0
  39. package/dist/audit/cli/advanceAuditCommand.js.map +1 -0
  40. package/dist/audit/cli/args.d.ts +95 -0
  41. package/dist/audit/cli/args.d.ts.map +1 -0
  42. package/dist/audit/cli/args.js +274 -0
  43. package/dist/audit/cli/args.js.map +1 -0
  44. package/dist/audit/cli/auditStep.d.ts +34 -0
  45. package/dist/audit/cli/auditStep.d.ts.map +1 -0
  46. package/dist/audit/cli/auditStep.js +162 -0
  47. package/dist/audit/cli/auditStep.js.map +1 -0
  48. package/dist/audit/cli/cleanup.d.ts +12 -0
  49. package/dist/audit/cli/cleanup.d.ts.map +1 -0
  50. package/dist/audit/cli/cleanup.js +44 -0
  51. package/dist/audit/cli/cleanup.js.map +1 -0
  52. package/dist/audit/cli/cleanupCommand.d.ts +2 -0
  53. package/dist/audit/cli/cleanupCommand.d.ts.map +1 -0
  54. package/dist/audit/cli/cleanupCommand.js +25 -0
  55. package/dist/audit/cli/cleanupCommand.js.map +1 -0
  56. package/dist/audit/cli/conceptualDispatch.d.ts +74 -0
  57. package/dist/audit/cli/conceptualDispatch.d.ts.map +1 -0
  58. package/dist/audit/cli/conceptualDispatch.js +118 -0
  59. package/dist/audit/cli/conceptualDispatch.js.map +1 -0
  60. package/dist/audit/cli/confirmIntentStep.d.ts +25 -0
  61. package/dist/audit/cli/confirmIntentStep.d.ts.map +1 -0
  62. package/dist/audit/cli/confirmIntentStep.js +210 -0
  63. package/dist/audit/cli/confirmIntentStep.js.map +1 -0
  64. package/dist/audit/cli/dispatch/packetFilter.d.ts +102 -0
  65. package/dist/audit/cli/dispatch/packetFilter.d.ts.map +1 -0
  66. package/dist/audit/cli/dispatch/packetFilter.js +148 -0
  67. package/dist/audit/cli/dispatch/packetFilter.js.map +1 -0
  68. package/dist/audit/cli/dispatch/packetPrompt.d.ts +48 -0
  69. package/dist/audit/cli/dispatch/packetPrompt.d.ts.map +1 -0
  70. package/dist/audit/cli/dispatch/packetPrompt.js +258 -0
  71. package/dist/audit/cli/dispatch/packetPrompt.js.map +1 -0
  72. package/dist/audit/cli/dispatch/paths.d.ts +7 -0
  73. package/dist/audit/cli/dispatch/paths.d.ts.map +1 -0
  74. package/dist/audit/cli/dispatch/paths.js +38 -0
  75. package/dist/audit/cli/dispatch/paths.js.map +1 -0
  76. package/dist/audit/cli/dispatch/quotaPool.d.ts +75 -0
  77. package/dist/audit/cli/dispatch/quotaPool.d.ts.map +1 -0
  78. package/dist/audit/cli/dispatch/quotaPool.js +163 -0
  79. package/dist/audit/cli/dispatch/quotaPool.js.map +1 -0
  80. package/dist/audit/cli/dispatch/tierRouting.d.ts +36 -0
  81. package/dist/audit/cli/dispatch/tierRouting.d.ts.map +1 -0
  82. package/dist/audit/cli/dispatch/tierRouting.js +121 -0
  83. package/dist/audit/cli/dispatch/tierRouting.js.map +1 -0
  84. package/dist/audit/cli/dispatch/types.d.ts +90 -0
  85. package/dist/audit/cli/dispatch/types.d.ts.map +1 -0
  86. package/dist/audit/cli/dispatch/types.js +15 -0
  87. package/dist/audit/cli/dispatch/types.js.map +1 -0
  88. package/dist/audit/cli/dispatch.d.ts +29 -0
  89. package/dist/audit/cli/dispatch.d.ts.map +1 -0
  90. package/dist/audit/cli/dispatch.js +303 -0
  91. package/dist/audit/cli/dispatch.js.map +1 -0
  92. package/dist/audit/cli/dispatchStatusCommand.d.ts +2 -0
  93. package/dist/audit/cli/dispatchStatusCommand.d.ts.map +1 -0
  94. package/dist/audit/cli/dispatchStatusCommand.js +81 -0
  95. package/dist/audit/cli/dispatchStatusCommand.js.map +1 -0
  96. package/dist/audit/cli/envelope.d.ts +50 -0
  97. package/dist/audit/cli/envelope.d.ts.map +1 -0
  98. package/dist/audit/cli/envelope.js +69 -0
  99. package/dist/audit/cli/envelope.js.map +1 -0
  100. package/dist/audit/cli/explainTaskCommand.d.ts +2 -0
  101. package/dist/audit/cli/explainTaskCommand.d.ts.map +1 -0
  102. package/dist/audit/cli/explainTaskCommand.js +34 -0
  103. package/dist/audit/cli/explainTaskCommand.js.map +1 -0
  104. package/dist/audit/cli/importExternalAnalyzerCommand.d.ts +2 -0
  105. package/dist/audit/cli/importExternalAnalyzerCommand.d.ts.map +1 -0
  106. package/dist/audit/cli/importExternalAnalyzerCommand.js +25 -0
  107. package/dist/audit/cli/importExternalAnalyzerCommand.js.map +1 -0
  108. package/dist/audit/cli/ingestResultsCommand.d.ts +2 -0
  109. package/dist/audit/cli/ingestResultsCommand.d.ts.map +1 -0
  110. package/dist/audit/cli/ingestResultsCommand.js +42 -0
  111. package/dist/audit/cli/ingestResultsCommand.js.map +1 -0
  112. package/dist/audit/cli/intakeCommand.d.ts +2 -0
  113. package/dist/audit/cli/intakeCommand.d.ts.map +1 -0
  114. package/dist/audit/cli/intakeCommand.js +18 -0
  115. package/dist/audit/cli/intakeCommand.js.map +1 -0
  116. package/dist/audit/cli/lineIndex.d.ts +5 -0
  117. package/dist/audit/cli/lineIndex.d.ts.map +1 -0
  118. package/dist/audit/cli/lineIndex.js +70 -0
  119. package/dist/audit/cli/lineIndex.js.map +1 -0
  120. package/dist/audit/cli/mergeAndIngestCommand.d.ts +46 -0
  121. package/dist/audit/cli/mergeAndIngestCommand.d.ts.map +1 -0
  122. package/dist/audit/cli/mergeAndIngestCommand.js +541 -0
  123. package/dist/audit/cli/mergeAndIngestCommand.js.map +1 -0
  124. package/dist/audit/cli/nextStepCommand.d.ts +22 -0
  125. package/dist/audit/cli/nextStepCommand.d.ts.map +1 -0
  126. package/dist/audit/cli/nextStepCommand.js +531 -0
  127. package/dist/audit/cli/nextStepCommand.js.map +1 -0
  128. package/dist/audit/cli/nextStepHelpers.d.ts +303 -0
  129. package/dist/audit/cli/nextStepHelpers.d.ts.map +1 -0
  130. package/dist/audit/cli/nextStepHelpers.js +861 -0
  131. package/dist/audit/cli/nextStepHelpers.js.map +1 -0
  132. package/dist/audit/cli/paths.d.ts +2 -0
  133. package/dist/audit/cli/paths.d.ts.map +1 -0
  134. package/dist/audit/cli/paths.js +10 -0
  135. package/dist/audit/cli/paths.js.map +1 -0
  136. package/dist/audit/cli/planCommand.d.ts +2 -0
  137. package/dist/audit/cli/planCommand.d.ts.map +1 -0
  138. package/dist/audit/cli/planCommand.js +17 -0
  139. package/dist/audit/cli/planCommand.js.map +1 -0
  140. package/dist/audit/cli/prepareDispatchCommand.d.ts +2 -0
  141. package/dist/audit/cli/prepareDispatchCommand.d.ts.map +1 -0
  142. package/dist/audit/cli/prepareDispatchCommand.js +37 -0
  143. package/dist/audit/cli/prepareDispatchCommand.js.map +1 -0
  144. package/dist/audit/cli/prompts.d.ts +54 -0
  145. package/dist/audit/cli/prompts.d.ts.map +1 -0
  146. package/dist/audit/cli/prompts.js +324 -0
  147. package/dist/audit/cli/prompts.js.map +1 -0
  148. package/dist/audit/cli/quotaCommand.d.ts +2 -0
  149. package/dist/audit/cli/quotaCommand.d.ts.map +1 -0
  150. package/dist/audit/cli/quotaCommand.js +64 -0
  151. package/dist/audit/cli/quotaCommand.js.map +1 -0
  152. package/dist/audit/cli/requeueCommand.d.ts +2 -0
  153. package/dist/audit/cli/requeueCommand.d.ts.map +1 -0
  154. package/dist/audit/cli/requeueCommand.js +11 -0
  155. package/dist/audit/cli/requeueCommand.js.map +1 -0
  156. package/dist/audit/cli/resynthesizeCommand.d.ts +2 -0
  157. package/dist/audit/cli/resynthesizeCommand.d.ts.map +1 -0
  158. package/dist/audit/cli/resynthesizeCommand.js +57 -0
  159. package/dist/audit/cli/resynthesizeCommand.js.map +1 -0
  160. package/dist/audit/cli/reviewRun.d.ts +57 -0
  161. package/dist/audit/cli/reviewRun.d.ts.map +1 -0
  162. package/dist/audit/cli/reviewRun.js +180 -0
  163. package/dist/audit/cli/reviewRun.js.map +1 -0
  164. package/dist/audit/cli/rollingAuditDispatch.d.ts +119 -0
  165. package/dist/audit/cli/rollingAuditDispatch.d.ts.map +1 -0
  166. package/dist/audit/cli/rollingAuditDispatch.js +264 -0
  167. package/dist/audit/cli/rollingAuditDispatch.js.map +1 -0
  168. package/dist/audit/cli/sampleRunCommand.d.ts +2 -0
  169. package/dist/audit/cli/sampleRunCommand.d.ts.map +1 -0
  170. package/dist/audit/cli/sampleRunCommand.js +106 -0
  171. package/dist/audit/cli/sampleRunCommand.js.map +1 -0
  172. package/dist/audit/cli/semanticReviewStep.d.ts +23 -0
  173. package/dist/audit/cli/semanticReviewStep.d.ts.map +1 -0
  174. package/dist/audit/cli/semanticReviewStep.js +123 -0
  175. package/dist/audit/cli/semanticReviewStep.js.map +1 -0
  176. package/dist/audit/cli/statusCommand.d.ts +2 -0
  177. package/dist/audit/cli/statusCommand.d.ts.map +1 -0
  178. package/dist/audit/cli/statusCommand.js +133 -0
  179. package/dist/audit/cli/statusCommand.js.map +1 -0
  180. package/dist/audit/cli/steps.d.ts +204 -0
  181. package/dist/audit/cli/steps.d.ts.map +1 -0
  182. package/dist/audit/cli/steps.js +105 -0
  183. package/dist/audit/cli/steps.js.map +1 -0
  184. package/dist/audit/cli/submitPacketCommand.d.ts +2 -0
  185. package/dist/audit/cli/submitPacketCommand.d.ts.map +1 -0
  186. package/dist/audit/cli/submitPacketCommand.js +126 -0
  187. package/dist/audit/cli/submitPacketCommand.js.map +1 -0
  188. package/dist/audit/cli/synthesizeCommand.d.ts +2 -0
  189. package/dist/audit/cli/synthesizeCommand.d.ts.map +1 -0
  190. package/dist/audit/cli/synthesizeCommand.js +16 -0
  191. package/dist/audit/cli/synthesizeCommand.js.map +1 -0
  192. package/dist/audit/cli/updateRuntimeValidationCommand.d.ts +2 -0
  193. package/dist/audit/cli/updateRuntimeValidationCommand.d.ts.map +1 -0
  194. package/dist/audit/cli/updateRuntimeValidationCommand.js +17 -0
  195. package/dist/audit/cli/updateRuntimeValidationCommand.js.map +1 -0
  196. package/dist/audit/cli/validateCommand.d.ts +2 -0
  197. package/dist/audit/cli/validateCommand.d.ts.map +1 -0
  198. package/dist/audit/cli/validateCommand.js +42 -0
  199. package/dist/audit/cli/validateCommand.js.map +1 -0
  200. package/dist/audit/cli/validateResultCommand.d.ts +2 -0
  201. package/dist/audit/cli/validateResultCommand.d.ts.map +1 -0
  202. package/dist/audit/cli/validateResultCommand.js +92 -0
  203. package/dist/audit/cli/validateResultCommand.js.map +1 -0
  204. package/dist/audit/cli/validateResultsCommand.d.ts +2 -0
  205. package/dist/audit/cli/validateResultsCommand.d.ts.map +1 -0
  206. package/dist/audit/cli/validateResultsCommand.js +32 -0
  207. package/dist/audit/cli/validateResultsCommand.js.map +1 -0
  208. package/dist/audit/cli/waveManifest.d.ts +41 -0
  209. package/dist/audit/cli/waveManifest.d.ts.map +1 -0
  210. package/dist/audit/cli/waveManifest.js +42 -0
  211. package/dist/audit/cli/waveManifest.js.map +1 -0
  212. package/dist/audit/cli/workerResult.d.ts +19 -0
  213. package/dist/audit/cli/workerResult.d.ts.map +1 -0
  214. package/dist/audit/cli/workerResult.js +43 -0
  215. package/dist/audit/cli/workerResult.js.map +1 -0
  216. package/dist/audit/cli/workerRunCommand.d.ts +16 -0
  217. package/dist/audit/cli/workerRunCommand.d.ts.map +1 -0
  218. package/dist/audit/cli/workerRunCommand.js +132 -0
  219. package/dist/audit/cli/workerRunCommand.js.map +1 -0
  220. package/dist/audit/cli.d.ts +21 -0
  221. package/dist/audit/cli.d.ts.map +1 -0
  222. package/dist/audit/cli.js +137 -0
  223. package/dist/audit/cli.js.map +1 -0
  224. package/dist/audit/contracts/workerSchemas.d.ts +1448 -0
  225. package/dist/audit/contracts/workerSchemas.d.ts.map +1 -0
  226. package/dist/audit/contracts/workerSchemas.js +117 -0
  227. package/dist/audit/contracts/workerSchemas.js.map +1 -0
  228. package/dist/audit/contracts/wrapperResponse.d.ts +316 -0
  229. package/dist/audit/contracts/wrapperResponse.d.ts.map +1 -0
  230. package/dist/audit/contracts/wrapperResponse.js +96 -0
  231. package/dist/audit/contracts/wrapperResponse.js.map +1 -0
  232. package/dist/audit/coverage.d.ts +11 -0
  233. package/dist/audit/coverage.d.ts.map +1 -0
  234. package/dist/audit/coverage.js +78 -0
  235. package/dist/audit/coverage.js.map +1 -0
  236. package/dist/audit/extractors/analyzers/css.d.ts +3 -0
  237. package/dist/audit/extractors/analyzers/css.d.ts.map +1 -0
  238. package/dist/audit/extractors/analyzers/css.js +102 -0
  239. package/dist/audit/extractors/analyzers/css.js.map +1 -0
  240. package/dist/audit/extractors/analyzers/html.d.ts +3 -0
  241. package/dist/audit/extractors/analyzers/html.d.ts.map +1 -0
  242. package/dist/audit/extractors/analyzers/html.js +93 -0
  243. package/dist/audit/extractors/analyzers/html.js.map +1 -0
  244. package/dist/audit/extractors/analyzers/merge.d.ts +15 -0
  245. package/dist/audit/extractors/analyzers/merge.d.ts.map +1 -0
  246. package/dist/audit/extractors/analyzers/merge.js +86 -0
  247. package/dist/audit/extractors/analyzers/merge.js.map +1 -0
  248. package/dist/audit/extractors/analyzers/python.d.ts +3 -0
  249. package/dist/audit/extractors/analyzers/python.d.ts.map +1 -0
  250. package/dist/audit/extractors/analyzers/python.js +105 -0
  251. package/dist/audit/extractors/analyzers/python.js.map +1 -0
  252. package/dist/audit/extractors/analyzers/registry.d.ts +34 -0
  253. package/dist/audit/extractors/analyzers/registry.d.ts.map +1 -0
  254. package/dist/audit/extractors/analyzers/registry.js +82 -0
  255. package/dist/audit/extractors/analyzers/registry.js.map +1 -0
  256. package/dist/audit/extractors/analyzers/resourceUrl.d.ts +8 -0
  257. package/dist/audit/extractors/analyzers/resourceUrl.d.ts.map +1 -0
  258. package/dist/audit/extractors/analyzers/resourceUrl.js +26 -0
  259. package/dist/audit/extractors/analyzers/resourceUrl.js.map +1 -0
  260. package/dist/audit/extractors/analyzers/sql.d.ts +3 -0
  261. package/dist/audit/extractors/analyzers/sql.d.ts.map +1 -0
  262. package/dist/audit/extractors/analyzers/sql.js +23 -0
  263. package/dist/audit/extractors/analyzers/sql.js.map +1 -0
  264. package/dist/audit/extractors/analyzers/treeSitter.d.ts +44 -0
  265. package/dist/audit/extractors/analyzers/treeSitter.d.ts.map +1 -0
  266. package/dist/audit/extractors/analyzers/treeSitter.js +148 -0
  267. package/dist/audit/extractors/analyzers/treeSitter.js.map +1 -0
  268. package/dist/audit/extractors/analyzers/types.d.ts +54 -0
  269. package/dist/audit/extractors/analyzers/types.d.ts.map +1 -0
  270. package/dist/audit/extractors/analyzers/types.js +2 -0
  271. package/dist/audit/extractors/analyzers/types.js.map +1 -0
  272. package/dist/audit/extractors/analyzers/typescript.d.ts +3 -0
  273. package/dist/audit/extractors/analyzers/typescript.d.ts.map +1 -0
  274. package/dist/audit/extractors/analyzers/typescript.js +279 -0
  275. package/dist/audit/extractors/analyzers/typescript.js.map +1 -0
  276. package/dist/audit/extractors/browserExtension.d.ts +12 -0
  277. package/dist/audit/extractors/browserExtension.d.ts.map +1 -0
  278. package/dist/audit/extractors/browserExtension.js +388 -0
  279. package/dist/audit/extractors/browserExtension.js.map +1 -0
  280. package/dist/audit/extractors/bucketing.d.ts +12 -0
  281. package/dist/audit/extractors/bucketing.d.ts.map +1 -0
  282. package/dist/audit/extractors/bucketing.js +56 -0
  283. package/dist/audit/extractors/bucketing.js.map +1 -0
  284. package/dist/audit/extractors/designAssessment.d.ts +10 -0
  285. package/dist/audit/extractors/designAssessment.d.ts.map +1 -0
  286. package/dist/audit/extractors/designAssessment.js +280 -0
  287. package/dist/audit/extractors/designAssessment.js.map +1 -0
  288. package/dist/audit/extractors/disposition.d.ts +76 -0
  289. package/dist/audit/extractors/disposition.d.ts.map +1 -0
  290. package/dist/audit/extractors/disposition.js +265 -0
  291. package/dist/audit/extractors/disposition.js.map +1 -0
  292. package/dist/audit/extractors/fileInventory.d.ts +8 -0
  293. package/dist/audit/extractors/fileInventory.d.ts.map +1 -0
  294. package/dist/audit/extractors/fileInventory.js +36 -0
  295. package/dist/audit/extractors/fileInventory.js.map +1 -0
  296. package/dist/audit/extractors/flows.d.ts +9 -0
  297. package/dist/audit/extractors/flows.d.ts.map +1 -0
  298. package/dist/audit/extractors/flows.js +111 -0
  299. package/dist/audit/extractors/flows.js.map +1 -0
  300. package/dist/audit/extractors/fsIntake.d.ts +9 -0
  301. package/dist/audit/extractors/fsIntake.d.ts.map +1 -0
  302. package/dist/audit/extractors/fsIntake.js +95 -0
  303. package/dist/audit/extractors/fsIntake.js.map +1 -0
  304. package/dist/audit/extractors/graph.d.ts +11 -0
  305. package/dist/audit/extractors/graph.d.ts.map +1 -0
  306. package/dist/audit/extractors/graph.js +472 -0
  307. package/dist/audit/extractors/graph.js.map +1 -0
  308. package/dist/audit/extractors/graphManifestEdges/cargo.d.ts +15 -0
  309. package/dist/audit/extractors/graphManifestEdges/cargo.d.ts.map +1 -0
  310. package/dist/audit/extractors/graphManifestEdges/cargo.js +74 -0
  311. package/dist/audit/extractors/graphManifestEdges/cargo.js.map +1 -0
  312. package/dist/audit/extractors/graphManifestEdges/go.d.ts +6 -0
  313. package/dist/audit/extractors/graphManifestEdges/go.d.ts.map +1 -0
  314. package/dist/audit/extractors/graphManifestEdges/go.js +152 -0
  315. package/dist/audit/extractors/graphManifestEdges/go.js.map +1 -0
  316. package/dist/audit/extractors/graphManifestEdges/index.d.ts +9 -0
  317. package/dist/audit/extractors/graphManifestEdges/index.d.ts.map +1 -0
  318. package/dist/audit/extractors/graphManifestEdges/index.js +12 -0
  319. package/dist/audit/extractors/graphManifestEdges/index.js.map +1 -0
  320. package/dist/audit/extractors/graphManifestEdges/jsonc.d.ts +4 -0
  321. package/dist/audit/extractors/graphManifestEdges/jsonc.d.ts.map +1 -0
  322. package/dist/audit/extractors/graphManifestEdges/jsonc.js +98 -0
  323. package/dist/audit/extractors/graphManifestEdges/jsonc.js.map +1 -0
  324. package/dist/audit/extractors/graphManifestEdges/maven.d.ts +4 -0
  325. package/dist/audit/extractors/graphManifestEdges/maven.d.ts.map +1 -0
  326. package/dist/audit/extractors/graphManifestEdges/maven.js +74 -0
  327. package/dist/audit/extractors/graphManifestEdges/maven.js.map +1 -0
  328. package/dist/audit/extractors/graphManifestEdges/packageJson.d.ts +20 -0
  329. package/dist/audit/extractors/graphManifestEdges/packageJson.d.ts.map +1 -0
  330. package/dist/audit/extractors/graphManifestEdges/packageJson.js +205 -0
  331. package/dist/audit/extractors/graphManifestEdges/packageJson.js.map +1 -0
  332. package/dist/audit/extractors/graphManifestEdges/pnpm.d.ts +10 -0
  333. package/dist/audit/extractors/graphManifestEdges/pnpm.d.ts.map +1 -0
  334. package/dist/audit/extractors/graphManifestEdges/pnpm.js +18 -0
  335. package/dist/audit/extractors/graphManifestEdges/pnpm.js.map +1 -0
  336. package/dist/audit/extractors/graphManifestEdges/pyproject.d.ts +4 -0
  337. package/dist/audit/extractors/graphManifestEdges/pyproject.d.ts.map +1 -0
  338. package/dist/audit/extractors/graphManifestEdges/pyproject.js +45 -0
  339. package/dist/audit/extractors/graphManifestEdges/pyproject.js.map +1 -0
  340. package/dist/audit/extractors/graphManifestEdges/toml.d.ts +25 -0
  341. package/dist/audit/extractors/graphManifestEdges/toml.d.ts.map +1 -0
  342. package/dist/audit/extractors/graphManifestEdges/toml.js +49 -0
  343. package/dist/audit/extractors/graphManifestEdges/toml.js.map +1 -0
  344. package/dist/audit/extractors/graphManifestEdges/typescript.d.ts +4 -0
  345. package/dist/audit/extractors/graphManifestEdges/typescript.d.ts.map +1 -0
  346. package/dist/audit/extractors/graphManifestEdges/typescript.js +57 -0
  347. package/dist/audit/extractors/graphManifestEdges/typescript.js.map +1 -0
  348. package/dist/audit/extractors/graphManifestEdges/workspace.d.ts +11 -0
  349. package/dist/audit/extractors/graphManifestEdges/workspace.d.ts.map +1 -0
  350. package/dist/audit/extractors/graphManifestEdges/workspace.js +73 -0
  351. package/dist/audit/extractors/graphManifestEdges/workspace.js.map +1 -0
  352. package/dist/audit/extractors/graphManifestEdges/yaml.d.ts +24 -0
  353. package/dist/audit/extractors/graphManifestEdges/yaml.d.ts.map +1 -0
  354. package/dist/audit/extractors/graphManifestEdges/yaml.js +57 -0
  355. package/dist/audit/extractors/graphManifestEdges/yaml.js.map +1 -0
  356. package/dist/audit/extractors/graphManifestEdges/yamlPaths.d.ts +5 -0
  357. package/dist/audit/extractors/graphManifestEdges/yamlPaths.d.ts.map +1 -0
  358. package/dist/audit/extractors/graphManifestEdges/yamlPaths.js +75 -0
  359. package/dist/audit/extractors/graphManifestEdges/yamlPaths.js.map +1 -0
  360. package/dist/audit/extractors/graphPathUtils.d.ts +34 -0
  361. package/dist/audit/extractors/graphPathUtils.d.ts.map +1 -0
  362. package/dist/audit/extractors/graphPathUtils.js +174 -0
  363. package/dist/audit/extractors/graphPathUtils.js.map +1 -0
  364. package/dist/audit/extractors/graphPythonImports.d.ts +19 -0
  365. package/dist/audit/extractors/graphPythonImports.d.ts.map +1 -0
  366. package/dist/audit/extractors/graphPythonImports.js +318 -0
  367. package/dist/audit/extractors/graphPythonImports.js.map +1 -0
  368. package/dist/audit/extractors/graphRoutes.d.ts +13 -0
  369. package/dist/audit/extractors/graphRoutes.d.ts.map +1 -0
  370. package/dist/audit/extractors/graphRoutes.js +447 -0
  371. package/dist/audit/extractors/graphRoutes.js.map +1 -0
  372. package/dist/audit/extractors/graphSuites.d.ts +5 -0
  373. package/dist/audit/extractors/graphSuites.d.ts.map +1 -0
  374. package/dist/audit/extractors/graphSuites.js +248 -0
  375. package/dist/audit/extractors/graphSuites.js.map +1 -0
  376. package/dist/audit/extractors/graphTestSources.d.ts +3 -0
  377. package/dist/audit/extractors/graphTestSources.d.ts.map +1 -0
  378. package/dist/audit/extractors/graphTestSources.js +103 -0
  379. package/dist/audit/extractors/graphTestSources.js.map +1 -0
  380. package/dist/audit/extractors/ignore.d.ts +2 -0
  381. package/dist/audit/extractors/ignore.d.ts.map +1 -0
  382. package/dist/audit/extractors/ignore.js +18 -0
  383. package/dist/audit/extractors/ignore.js.map +1 -0
  384. package/dist/audit/extractors/languageMap.generated.d.ts +2 -0
  385. package/dist/audit/extractors/languageMap.generated.d.ts.map +1 -0
  386. package/dist/audit/extractors/languageMap.generated.js +1456 -0
  387. package/dist/audit/extractors/languageMap.generated.js.map +1 -0
  388. package/dist/audit/extractors/pathPatterns.d.ts +55 -0
  389. package/dist/audit/extractors/pathPatterns.d.ts.map +1 -0
  390. package/dist/audit/extractors/pathPatterns.js +303 -0
  391. package/dist/audit/extractors/pathPatterns.js.map +1 -0
  392. package/dist/audit/extractors/risk.d.ts +5 -0
  393. package/dist/audit/extractors/risk.d.ts.map +1 -0
  394. package/dist/audit/extractors/risk.js +54 -0
  395. package/dist/audit/extractors/risk.js.map +1 -0
  396. package/dist/audit/extractors/surfaces.d.ts +10 -0
  397. package/dist/audit/extractors/surfaces.d.ts.map +1 -0
  398. package/dist/audit/extractors/surfaces.js +49 -0
  399. package/dist/audit/extractors/surfaces.js.map +1 -0
  400. package/dist/audit/index.d.ts +2 -0
  401. package/dist/audit/index.d.ts.map +1 -0
  402. package/dist/audit/index.js +3 -0
  403. package/dist/audit/index.js.map +1 -0
  404. package/dist/audit/io/artifacts.d.ts +152 -0
  405. package/dist/audit/io/artifacts.d.ts.map +1 -0
  406. package/dist/audit/io/artifacts.js +239 -0
  407. package/dist/audit/io/artifacts.js.map +1 -0
  408. package/dist/audit/io/runArtifactTypes.d.ts +19 -0
  409. package/dist/audit/io/runArtifactTypes.d.ts.map +1 -0
  410. package/dist/audit/io/runArtifactTypes.js +2 -0
  411. package/dist/audit/io/runArtifactTypes.js.map +1 -0
  412. package/dist/audit/io/runArtifacts.d.ts +33 -0
  413. package/dist/audit/io/runArtifacts.d.ts.map +1 -0
  414. package/dist/audit/io/runArtifacts.js +254 -0
  415. package/dist/audit/io/runArtifacts.js.map +1 -0
  416. package/dist/audit/io/toolingManifest.d.ts +4 -0
  417. package/dist/audit/io/toolingManifest.d.ts.map +1 -0
  418. package/dist/audit/io/toolingManifest.js +79 -0
  419. package/dist/audit/io/toolingManifest.js.map +1 -0
  420. package/dist/audit/orchestrator/advance.d.ts +5 -0
  421. package/dist/audit/orchestrator/advance.d.ts.map +1 -0
  422. package/dist/audit/orchestrator/advance.js +172 -0
  423. package/dist/audit/orchestrator/advance.js.map +1 -0
  424. package/dist/audit/orchestrator/advanceTypes.d.ts +50 -0
  425. package/dist/audit/orchestrator/advanceTypes.d.ts.map +1 -0
  426. package/dist/audit/orchestrator/advanceTypes.js +2 -0
  427. package/dist/audit/orchestrator/advanceTypes.js.map +1 -0
  428. package/dist/audit/orchestrator/artifactFreshness.d.ts +4 -0
  429. package/dist/audit/orchestrator/artifactFreshness.d.ts.map +1 -0
  430. package/dist/audit/orchestrator/artifactFreshness.js +99 -0
  431. package/dist/audit/orchestrator/artifactFreshness.js.map +1 -0
  432. package/dist/audit/orchestrator/artifactMetadata.d.ts +6 -0
  433. package/dist/audit/orchestrator/artifactMetadata.d.ts.map +1 -0
  434. package/dist/audit/orchestrator/artifactMetadata.js +98 -0
  435. package/dist/audit/orchestrator/artifactMetadata.js.map +1 -0
  436. package/dist/audit/orchestrator/auditTaskUtils.d.ts +10 -0
  437. package/dist/audit/orchestrator/auditTaskUtils.d.ts.map +1 -0
  438. package/dist/audit/orchestrator/auditTaskUtils.js +53 -0
  439. package/dist/audit/orchestrator/auditTaskUtils.js.map +1 -0
  440. package/dist/audit/orchestrator/autoFixExecutor.d.ts +4 -0
  441. package/dist/audit/orchestrator/autoFixExecutor.d.ts.map +1 -0
  442. package/dist/audit/orchestrator/autoFixExecutor.js +152 -0
  443. package/dist/audit/orchestrator/autoFixExecutor.js.map +1 -0
  444. package/dist/audit/orchestrator/chunking.d.ts +6 -0
  445. package/dist/audit/orchestrator/chunking.d.ts.map +1 -0
  446. package/dist/audit/orchestrator/chunking.js +14 -0
  447. package/dist/audit/orchestrator/chunking.js.map +1 -0
  448. package/dist/audit/orchestrator/dependencyMap.d.ts +74 -0
  449. package/dist/audit/orchestrator/dependencyMap.d.ts.map +1 -0
  450. package/dist/audit/orchestrator/dependencyMap.js +193 -0
  451. package/dist/audit/orchestrator/dependencyMap.js.map +1 -0
  452. package/dist/audit/orchestrator/designReviewProjection.d.ts +66 -0
  453. package/dist/audit/orchestrator/designReviewProjection.d.ts.map +1 -0
  454. package/dist/audit/orchestrator/designReviewProjection.js +215 -0
  455. package/dist/audit/orchestrator/designReviewProjection.js.map +1 -0
  456. package/dist/audit/orchestrator/designReviewPrompt.d.ts +82 -0
  457. package/dist/audit/orchestrator/designReviewPrompt.d.ts.map +1 -0
  458. package/dist/audit/orchestrator/designReviewPrompt.js +474 -0
  459. package/dist/audit/orchestrator/designReviewPrompt.js.map +1 -0
  460. package/dist/audit/orchestrator/designReviewSnapshot.d.ts +69 -0
  461. package/dist/audit/orchestrator/designReviewSnapshot.d.ts.map +1 -0
  462. package/dist/audit/orchestrator/designReviewSnapshot.js +135 -0
  463. package/dist/audit/orchestrator/designReviewSnapshot.js.map +1 -0
  464. package/dist/audit/orchestrator/edgeReasoning.d.ts +40 -0
  465. package/dist/audit/orchestrator/edgeReasoning.d.ts.map +1 -0
  466. package/dist/audit/orchestrator/edgeReasoning.js +126 -0
  467. package/dist/audit/orchestrator/edgeReasoning.js.map +1 -0
  468. package/dist/audit/orchestrator/executorResult.d.ts +71 -0
  469. package/dist/audit/orchestrator/executorResult.d.ts.map +1 -0
  470. package/dist/audit/orchestrator/executorResult.js +2 -0
  471. package/dist/audit/orchestrator/executorResult.js.map +1 -0
  472. package/dist/audit/orchestrator/executorRunners.d.ts +34 -0
  473. package/dist/audit/orchestrator/executorRunners.d.ts.map +1 -0
  474. package/dist/audit/orchestrator/executorRunners.js +85 -0
  475. package/dist/audit/orchestrator/executorRunners.js.map +1 -0
  476. package/dist/audit/orchestrator/executors.d.ts +13 -0
  477. package/dist/audit/orchestrator/executors.d.ts.map +1 -0
  478. package/dist/audit/orchestrator/executors.js +114 -0
  479. package/dist/audit/orchestrator/executors.js.map +1 -0
  480. package/dist/audit/orchestrator/fileAnchors.d.ts +33 -0
  481. package/dist/audit/orchestrator/fileAnchors.d.ts.map +1 -0
  482. package/dist/audit/orchestrator/fileAnchors.js +242 -0
  483. package/dist/audit/orchestrator/fileAnchors.js.map +1 -0
  484. package/dist/audit/orchestrator/fileIntegrity.d.ts +9 -0
  485. package/dist/audit/orchestrator/fileIntegrity.d.ts.map +1 -0
  486. package/dist/audit/orchestrator/fileIntegrity.js +58 -0
  487. package/dist/audit/orchestrator/fileIntegrity.js.map +1 -0
  488. package/dist/audit/orchestrator/flowCoverage.d.ts +5 -0
  489. package/dist/audit/orchestrator/flowCoverage.d.ts.map +1 -0
  490. package/dist/audit/orchestrator/flowCoverage.js +46 -0
  491. package/dist/audit/orchestrator/flowCoverage.js.map +1 -0
  492. package/dist/audit/orchestrator/flowPlanning.d.ts +8 -0
  493. package/dist/audit/orchestrator/flowPlanning.d.ts.map +1 -0
  494. package/dist/audit/orchestrator/flowPlanning.js +65 -0
  495. package/dist/audit/orchestrator/flowPlanning.js.map +1 -0
  496. package/dist/audit/orchestrator/flowRequeue.d.ts +6 -0
  497. package/dist/audit/orchestrator/flowRequeue.d.ts.map +1 -0
  498. package/dist/audit/orchestrator/flowRequeue.js +73 -0
  499. package/dist/audit/orchestrator/flowRequeue.js.map +1 -0
  500. package/dist/audit/orchestrator/graphEnrichmentExecutor.d.ts +30 -0
  501. package/dist/audit/orchestrator/graphEnrichmentExecutor.d.ts.map +1 -0
  502. package/dist/audit/orchestrator/graphEnrichmentExecutor.js +227 -0
  503. package/dist/audit/orchestrator/graphEnrichmentExecutor.js.map +1 -0
  504. package/dist/audit/orchestrator/ingestionExecutors.d.ts +10 -0
  505. package/dist/audit/orchestrator/ingestionExecutors.d.ts.map +1 -0
  506. package/dist/audit/orchestrator/ingestionExecutors.js +262 -0
  507. package/dist/audit/orchestrator/ingestionExecutors.js.map +1 -0
  508. package/dist/audit/orchestrator/intakeExecutors.d.ts +26 -0
  509. package/dist/audit/orchestrator/intakeExecutors.d.ts.map +1 -0
  510. package/dist/audit/orchestrator/intakeExecutors.js +138 -0
  511. package/dist/audit/orchestrator/intakeExecutors.js.map +1 -0
  512. package/dist/audit/orchestrator/intentCheckpointExecutor.d.ts +89 -0
  513. package/dist/audit/orchestrator/intentCheckpointExecutor.d.ts.map +1 -0
  514. package/dist/audit/orchestrator/intentCheckpointExecutor.js +264 -0
  515. package/dist/audit/orchestrator/intentCheckpointExecutor.js.map +1 -0
  516. package/dist/audit/orchestrator/intentInterpreter.d.ts +49 -0
  517. package/dist/audit/orchestrator/intentInterpreter.d.ts.map +1 -0
  518. package/dist/audit/orchestrator/intentInterpreter.js +110 -0
  519. package/dist/audit/orchestrator/intentInterpreter.js.map +1 -0
  520. package/dist/audit/orchestrator/lensSelection.d.ts +35 -0
  521. package/dist/audit/orchestrator/lensSelection.d.ts.map +1 -0
  522. package/dist/audit/orchestrator/lensSelection.js +81 -0
  523. package/dist/audit/orchestrator/lensSelection.js.map +1 -0
  524. package/dist/audit/orchestrator/localCommands.d.ts +16 -0
  525. package/dist/audit/orchestrator/localCommands.d.ts.map +1 -0
  526. package/dist/audit/orchestrator/localCommands.js +113 -0
  527. package/dist/audit/orchestrator/localCommands.js.map +1 -0
  528. package/dist/audit/orchestrator/nextStep.d.ts +12 -0
  529. package/dist/audit/orchestrator/nextStep.d.ts.map +1 -0
  530. package/dist/audit/orchestrator/nextStep.js +63 -0
  531. package/dist/audit/orchestrator/nextStep.js.map +1 -0
  532. package/dist/audit/orchestrator/partitionTaskGraph.d.ts +32 -0
  533. package/dist/audit/orchestrator/partitionTaskGraph.d.ts.map +1 -0
  534. package/dist/audit/orchestrator/partitionTaskGraph.js +98 -0
  535. package/dist/audit/orchestrator/partitionTaskGraph.js.map +1 -0
  536. package/dist/audit/orchestrator/planning.d.ts +5 -0
  537. package/dist/audit/orchestrator/planning.d.ts.map +1 -0
  538. package/dist/audit/orchestrator/planning.js +81 -0
  539. package/dist/audit/orchestrator/planning.js.map +1 -0
  540. package/dist/audit/orchestrator/planningExecutors.d.ts +21 -0
  541. package/dist/audit/orchestrator/planningExecutors.d.ts.map +1 -0
  542. package/dist/audit/orchestrator/planningExecutors.js +228 -0
  543. package/dist/audit/orchestrator/planningExecutors.js.map +1 -0
  544. package/dist/audit/orchestrator/providerConfirmation.d.ts +21 -0
  545. package/dist/audit/orchestrator/providerConfirmation.d.ts.map +1 -0
  546. package/dist/audit/orchestrator/providerConfirmation.js +54 -0
  547. package/dist/audit/orchestrator/providerConfirmation.js.map +1 -0
  548. package/dist/audit/orchestrator/requeue.d.ts +4 -0
  549. package/dist/audit/orchestrator/requeue.d.ts.map +1 -0
  550. package/dist/audit/orchestrator/requeue.js +33 -0
  551. package/dist/audit/orchestrator/requeue.js.map +1 -0
  552. package/dist/audit/orchestrator/requeueCommand.d.ts +32 -0
  553. package/dist/audit/orchestrator/requeueCommand.d.ts.map +1 -0
  554. package/dist/audit/orchestrator/requeueCommand.js +45 -0
  555. package/dist/audit/orchestrator/requeueCommand.js.map +1 -0
  556. package/dist/audit/orchestrator/requeueUtils.d.ts +14 -0
  557. package/dist/audit/orchestrator/requeueUtils.d.ts.map +1 -0
  558. package/dist/audit/orchestrator/requeueUtils.js +22 -0
  559. package/dist/audit/orchestrator/requeueUtils.js.map +1 -0
  560. package/dist/audit/orchestrator/resultIngestion.d.ts +18 -0
  561. package/dist/audit/orchestrator/resultIngestion.d.ts.map +1 -0
  562. package/dist/audit/orchestrator/resultIngestion.js +63 -0
  563. package/dist/audit/orchestrator/resultIngestion.js.map +1 -0
  564. package/dist/audit/orchestrator/reviewPacketGraph.d.ts +5 -0
  565. package/dist/audit/orchestrator/reviewPacketGraph.d.ts.map +1 -0
  566. package/dist/audit/orchestrator/reviewPacketGraph.js +11 -0
  567. package/dist/audit/orchestrator/reviewPacketGraph.js.map +1 -0
  568. package/dist/audit/orchestrator/reviewPacketGraphClustering.d.ts +4 -0
  569. package/dist/audit/orchestrator/reviewPacketGraphClustering.d.ts.map +1 -0
  570. package/dist/audit/orchestrator/reviewPacketGraphClustering.js +481 -0
  571. package/dist/audit/orchestrator/reviewPacketGraphClustering.js.map +1 -0
  572. package/dist/audit/orchestrator/reviewPacketGraphContext.d.ts +10 -0
  573. package/dist/audit/orchestrator/reviewPacketGraphContext.d.ts.map +1 -0
  574. package/dist/audit/orchestrator/reviewPacketGraphContext.js +95 -0
  575. package/dist/audit/orchestrator/reviewPacketGraphContext.js.map +1 -0
  576. package/dist/audit/orchestrator/reviewPacketGraphEdges.d.ts +23 -0
  577. package/dist/audit/orchestrator/reviewPacketGraphEdges.d.ts.map +1 -0
  578. package/dist/audit/orchestrator/reviewPacketGraphEdges.js +169 -0
  579. package/dist/audit/orchestrator/reviewPacketGraphEdges.js.map +1 -0
  580. package/dist/audit/orchestrator/reviewPacketMetrics.d.ts +17 -0
  581. package/dist/audit/orchestrator/reviewPacketMetrics.d.ts.map +1 -0
  582. package/dist/audit/orchestrator/reviewPacketMetrics.js +322 -0
  583. package/dist/audit/orchestrator/reviewPacketMetrics.js.map +1 -0
  584. package/dist/audit/orchestrator/reviewPacketSizing.d.ts +27 -0
  585. package/dist/audit/orchestrator/reviewPacketSizing.d.ts.map +1 -0
  586. package/dist/audit/orchestrator/reviewPacketSizing.js +64 -0
  587. package/dist/audit/orchestrator/reviewPacketSizing.js.map +1 -0
  588. package/dist/audit/orchestrator/reviewPackets.d.ts +54 -0
  589. package/dist/audit/orchestrator/reviewPackets.d.ts.map +1 -0
  590. package/dist/audit/orchestrator/reviewPackets.js +318 -0
  591. package/dist/audit/orchestrator/reviewPackets.js.map +1 -0
  592. package/dist/audit/orchestrator/rollingDispatch.d.ts +45 -0
  593. package/dist/audit/orchestrator/rollingDispatch.d.ts.map +1 -0
  594. package/dist/audit/orchestrator/rollingDispatch.js +103 -0
  595. package/dist/audit/orchestrator/rollingDispatch.js.map +1 -0
  596. package/dist/audit/orchestrator/runtimeCommand.d.ts +10 -0
  597. package/dist/audit/orchestrator/runtimeCommand.d.ts.map +1 -0
  598. package/dist/audit/orchestrator/runtimeCommand.js +129 -0
  599. package/dist/audit/orchestrator/runtimeCommand.js.map +1 -0
  600. package/dist/audit/orchestrator/runtimeValidation.d.ts +13 -0
  601. package/dist/audit/orchestrator/runtimeValidation.d.ts.map +1 -0
  602. package/dist/audit/orchestrator/runtimeValidation.js +94 -0
  603. package/dist/audit/orchestrator/runtimeValidation.js.map +1 -0
  604. package/dist/audit/orchestrator/runtimeValidationUpdate.d.ts +3 -0
  605. package/dist/audit/orchestrator/runtimeValidationUpdate.d.ts.map +1 -0
  606. package/dist/audit/orchestrator/runtimeValidationUpdate.js +57 -0
  607. package/dist/audit/orchestrator/runtimeValidationUpdate.js.map +1 -0
  608. package/dist/audit/orchestrator/scope.d.ts +75 -0
  609. package/dist/audit/orchestrator/scope.d.ts.map +1 -0
  610. package/dist/audit/orchestrator/scope.js +268 -0
  611. package/dist/audit/orchestrator/scope.js.map +1 -0
  612. package/dist/audit/orchestrator/selectiveDeepening/conflict.d.ts +9 -0
  613. package/dist/audit/orchestrator/selectiveDeepening/conflict.d.ts.map +1 -0
  614. package/dist/audit/orchestrator/selectiveDeepening/conflict.js +72 -0
  615. package/dist/audit/orchestrator/selectiveDeepening/conflict.js.map +1 -0
  616. package/dist/audit/orchestrator/selectiveDeepening/findingFollowup.d.ts +11 -0
  617. package/dist/audit/orchestrator/selectiveDeepening/findingFollowup.d.ts.map +1 -0
  618. package/dist/audit/orchestrator/selectiveDeepening/findingFollowup.js +53 -0
  619. package/dist/audit/orchestrator/selectiveDeepening/findingFollowup.js.map +1 -0
  620. package/dist/audit/orchestrator/selectiveDeepening/highRiskClean.d.ts +8 -0
  621. package/dist/audit/orchestrator/selectiveDeepening/highRiskClean.d.ts.map +1 -0
  622. package/dist/audit/orchestrator/selectiveDeepening/highRiskClean.js +46 -0
  623. package/dist/audit/orchestrator/selectiveDeepening/highRiskClean.js.map +1 -0
  624. package/dist/audit/orchestrator/selectiveDeepening/index.d.ts +25 -0
  625. package/dist/audit/orchestrator/selectiveDeepening/index.d.ts.map +1 -0
  626. package/dist/audit/orchestrator/selectiveDeepening/index.js +157 -0
  627. package/dist/audit/orchestrator/selectiveDeepening/index.js.map +1 -0
  628. package/dist/audit/orchestrator/selectiveDeepening/lensVerification.d.ts +13 -0
  629. package/dist/audit/orchestrator/selectiveDeepening/lensVerification.d.ts.map +1 -0
  630. package/dist/audit/orchestrator/selectiveDeepening/lensVerification.js +269 -0
  631. package/dist/audit/orchestrator/selectiveDeepening/lensVerification.js.map +1 -0
  632. package/dist/audit/orchestrator/selectiveDeepening/runtimeValidation.d.ts +14 -0
  633. package/dist/audit/orchestrator/selectiveDeepening/runtimeValidation.d.ts.map +1 -0
  634. package/dist/audit/orchestrator/selectiveDeepening/runtimeValidation.js +58 -0
  635. package/dist/audit/orchestrator/selectiveDeepening/runtimeValidation.js.map +1 -0
  636. package/dist/audit/orchestrator/selectiveDeepening/shared.d.ts +42 -0
  637. package/dist/audit/orchestrator/selectiveDeepening/shared.d.ts.map +1 -0
  638. package/dist/audit/orchestrator/selectiveDeepening/shared.js +121 -0
  639. package/dist/audit/orchestrator/selectiveDeepening/shared.js.map +1 -0
  640. package/dist/audit/orchestrator/selectiveDeepening/stewardFollowup.d.ts +7 -0
  641. package/dist/audit/orchestrator/selectiveDeepening/stewardFollowup.d.ts.map +1 -0
  642. package/dist/audit/orchestrator/selectiveDeepening/stewardFollowup.js +73 -0
  643. package/dist/audit/orchestrator/selectiveDeepening/stewardFollowup.js.map +1 -0
  644. package/dist/audit/orchestrator/selectiveDeepening.d.ts +3 -0
  645. package/dist/audit/orchestrator/selectiveDeepening.d.ts.map +1 -0
  646. package/dist/audit/orchestrator/selectiveDeepening.js +7 -0
  647. package/dist/audit/orchestrator/selectiveDeepening.js.map +1 -0
  648. package/dist/audit/orchestrator/staleness.d.ts +3 -0
  649. package/dist/audit/orchestrator/staleness.d.ts.map +1 -0
  650. package/dist/audit/orchestrator/staleness.js +102 -0
  651. package/dist/audit/orchestrator/staleness.js.map +1 -0
  652. package/dist/audit/orchestrator/state.d.ts +4 -0
  653. package/dist/audit/orchestrator/state.d.ts.map +1 -0
  654. package/dist/audit/orchestrator/state.js +158 -0
  655. package/dist/audit/orchestrator/state.js.map +1 -0
  656. package/dist/audit/orchestrator/structureExecutors.d.ts +6 -0
  657. package/dist/audit/orchestrator/structureExecutors.d.ts.map +1 -0
  658. package/dist/audit/orchestrator/structureExecutors.js +116 -0
  659. package/dist/audit/orchestrator/structureExecutors.js.map +1 -0
  660. package/dist/audit/orchestrator/syntaxResolutionExecutor.d.ts +4 -0
  661. package/dist/audit/orchestrator/syntaxResolutionExecutor.d.ts.map +1 -0
  662. package/dist/audit/orchestrator/syntaxResolutionExecutor.js +260 -0
  663. package/dist/audit/orchestrator/syntaxResolutionExecutor.js.map +1 -0
  664. package/dist/audit/orchestrator/synthesisExecutors.d.ts +13 -0
  665. package/dist/audit/orchestrator/synthesisExecutors.d.ts.map +1 -0
  666. package/dist/audit/orchestrator/synthesisExecutors.js +107 -0
  667. package/dist/audit/orchestrator/synthesisExecutors.js.map +1 -0
  668. package/dist/audit/orchestrator/taskAffinityGraph.d.ts +154 -0
  669. package/dist/audit/orchestrator/taskAffinityGraph.d.ts.map +1 -0
  670. package/dist/audit/orchestrator/taskAffinityGraph.js +216 -0
  671. package/dist/audit/orchestrator/taskAffinityGraph.js.map +1 -0
  672. package/dist/audit/orchestrator/taskBuilder.d.ts +43 -0
  673. package/dist/audit/orchestrator/taskBuilder.d.ts.map +1 -0
  674. package/dist/audit/orchestrator/taskBuilder.js +355 -0
  675. package/dist/audit/orchestrator/taskBuilder.js.map +1 -0
  676. package/dist/audit/orchestrator/trivialAudit.d.ts +5 -0
  677. package/dist/audit/orchestrator/trivialAudit.d.ts.map +1 -0
  678. package/dist/audit/orchestrator/trivialAudit.js +50 -0
  679. package/dist/audit/orchestrator/trivialAudit.js.map +1 -0
  680. package/dist/audit/orchestrator/unionFind.d.ts +8 -0
  681. package/dist/audit/orchestrator/unionFind.d.ts.map +1 -0
  682. package/dist/audit/orchestrator/unionFind.js +43 -0
  683. package/dist/audit/orchestrator/unionFind.js.map +1 -0
  684. package/dist/audit/orchestrator/unitBuilder.d.ts +8 -0
  685. package/dist/audit/orchestrator/unitBuilder.d.ts.map +1 -0
  686. package/dist/audit/orchestrator/unitBuilder.js +171 -0
  687. package/dist/audit/orchestrator/unitBuilder.js.map +1 -0
  688. package/dist/audit/orchestrator.d.ts +7 -0
  689. package/dist/audit/orchestrator.d.ts.map +1 -0
  690. package/dist/audit/orchestrator.js +68 -0
  691. package/dist/audit/orchestrator.js.map +1 -0
  692. package/dist/audit/prompts/renderWorkerPrompt.d.ts +3 -0
  693. package/dist/audit/prompts/renderWorkerPrompt.d.ts.map +1 -0
  694. package/dist/audit/prompts/renderWorkerPrompt.js +87 -0
  695. package/dist/audit/prompts/renderWorkerPrompt.js.map +1 -0
  696. package/dist/audit/providers/claudeCodeProvider.d.ts +11 -0
  697. package/dist/audit/providers/claudeCodeProvider.d.ts.map +1 -0
  698. package/dist/audit/providers/claudeCodeProvider.js +23 -0
  699. package/dist/audit/providers/claudeCodeProvider.js.map +1 -0
  700. package/dist/audit/providers/constants.d.ts +2 -0
  701. package/dist/audit/providers/constants.d.ts.map +1 -0
  702. package/dist/audit/providers/constants.js +2 -0
  703. package/dist/audit/providers/constants.js.map +1 -0
  704. package/dist/audit/providers/index.d.ts +14 -0
  705. package/dist/audit/providers/index.d.ts.map +1 -0
  706. package/dist/audit/providers/index.js +21 -0
  707. package/dist/audit/providers/index.js.map +1 -0
  708. package/dist/audit/providers/opencodeProvider.d.ts +5 -0
  709. package/dist/audit/providers/opencodeProvider.d.ts.map +1 -0
  710. package/dist/audit/providers/opencodeProvider.js +10 -0
  711. package/dist/audit/providers/opencodeProvider.js.map +1 -0
  712. package/dist/audit/quota/discoveredLimits.d.ts +27 -0
  713. package/dist/audit/quota/discoveredLimits.d.ts.map +1 -0
  714. package/dist/audit/quota/discoveredLimits.js +91 -0
  715. package/dist/audit/quota/discoveredLimits.js.map +1 -0
  716. package/dist/audit/quota/headerExtraction.d.ts +9 -0
  717. package/dist/audit/quota/headerExtraction.d.ts.map +1 -0
  718. package/dist/audit/quota/headerExtraction.js +148 -0
  719. package/dist/audit/quota/headerExtraction.js.map +1 -0
  720. package/dist/audit/quota/headerExtractors/claudeCodeHeaderExtractor.d.ts +7 -0
  721. package/dist/audit/quota/headerExtractors/claudeCodeHeaderExtractor.d.ts.map +1 -0
  722. package/dist/audit/quota/headerExtractors/claudeCodeHeaderExtractor.js +27 -0
  723. package/dist/audit/quota/headerExtractors/claudeCodeHeaderExtractor.js.map +1 -0
  724. package/dist/audit/quota/headerExtractors/genericHeaderExtractor.d.ts +10 -0
  725. package/dist/audit/quota/headerExtractors/genericHeaderExtractor.d.ts.map +1 -0
  726. package/dist/audit/quota/headerExtractors/genericHeaderExtractor.js +8 -0
  727. package/dist/audit/quota/headerExtractors/genericHeaderExtractor.js.map +1 -0
  728. package/dist/audit/quota/headerExtractors/index.d.ts +6 -0
  729. package/dist/audit/quota/headerExtractors/index.d.ts.map +1 -0
  730. package/dist/audit/quota/headerExtractors/index.js +11 -0
  731. package/dist/audit/quota/headerExtractors/index.js.map +1 -0
  732. package/dist/audit/quota/hostLimits.d.ts +8 -0
  733. package/dist/audit/quota/hostLimits.d.ts.map +1 -0
  734. package/dist/audit/quota/hostLimits.js +9 -0
  735. package/dist/audit/quota/hostLimits.js.map +1 -0
  736. package/dist/audit/quota/index.d.ts +383 -0
  737. package/dist/audit/quota/index.d.ts.map +1 -0
  738. package/dist/audit/quota/index.js +45 -0
  739. package/dist/audit/quota/index.js.map +1 -0
  740. package/dist/audit/reporting/findingIdentity.d.ts +34 -0
  741. package/dist/audit/reporting/findingIdentity.d.ts.map +1 -0
  742. package/dist/audit/reporting/findingIdentity.js +64 -0
  743. package/dist/audit/reporting/findingIdentity.js.map +1 -0
  744. package/dist/audit/reporting/findingRanks.d.ts +2 -0
  745. package/dist/audit/reporting/findingRanks.d.ts.map +1 -0
  746. package/dist/audit/reporting/findingRanks.js +7 -0
  747. package/dist/audit/reporting/findingRanks.js.map +1 -0
  748. package/dist/audit/reporting/mergeFindings.d.ts +6 -0
  749. package/dist/audit/reporting/mergeFindings.d.ts.map +1 -0
  750. package/dist/audit/reporting/mergeFindings.js +326 -0
  751. package/dist/audit/reporting/mergeFindings.js.map +1 -0
  752. package/dist/audit/reporting/synthesis.d.ts +124 -0
  753. package/dist/audit/reporting/synthesis.d.ts.map +1 -0
  754. package/dist/audit/reporting/synthesis.js +369 -0
  755. package/dist/audit/reporting/synthesis.js.map +1 -0
  756. package/dist/audit/reporting/synthesisNarrativePrompt.d.ts +8 -0
  757. package/dist/audit/reporting/synthesisNarrativePrompt.d.ts.map +1 -0
  758. package/dist/audit/reporting/synthesisNarrativePrompt.js +66 -0
  759. package/dist/audit/reporting/synthesisNarrativePrompt.js.map +1 -0
  760. package/dist/audit/reporting/workBlocks.d.ts +10 -0
  761. package/dist/audit/reporting/workBlocks.d.ts.map +1 -0
  762. package/dist/audit/reporting/workBlocks.js +154 -0
  763. package/dist/audit/reporting/workBlocks.js.map +1 -0
  764. package/dist/audit/supervisor/operatorHandoff.d.ts +65 -0
  765. package/dist/audit/supervisor/operatorHandoff.d.ts.map +1 -0
  766. package/dist/audit/supervisor/operatorHandoff.js +277 -0
  767. package/dist/audit/supervisor/operatorHandoff.js.map +1 -0
  768. package/dist/audit/supervisor/runLedger.d.ts +4 -0
  769. package/dist/audit/supervisor/runLedger.d.ts.map +1 -0
  770. package/dist/audit/supervisor/runLedger.js +118 -0
  771. package/dist/audit/supervisor/runLedger.js.map +1 -0
  772. package/dist/audit/supervisor/sessionConfig.d.ts +12 -0
  773. package/dist/audit/supervisor/sessionConfig.d.ts.map +1 -0
  774. package/dist/audit/supervisor/sessionConfig.js +49 -0
  775. package/dist/audit/supervisor/sessionConfig.js.map +1 -0
  776. package/dist/audit/types/activeDispatch.d.ts +36 -0
  777. package/dist/audit/types/activeDispatch.d.ts.map +1 -0
  778. package/dist/audit/types/activeDispatch.js +3 -0
  779. package/dist/audit/types/activeDispatch.js.map +1 -0
  780. package/dist/audit/types/analyzerCapability.d.ts +17 -0
  781. package/dist/audit/types/analyzerCapability.d.ts.map +1 -0
  782. package/dist/audit/types/analyzerCapability.js +2 -0
  783. package/dist/audit/types/analyzerCapability.js.map +1 -0
  784. package/dist/audit/types/artifactMetadata.d.ts +9 -0
  785. package/dist/audit/types/artifactMetadata.d.ts.map +1 -0
  786. package/dist/audit/types/artifactMetadata.js +2 -0
  787. package/dist/audit/types/artifactMetadata.js.map +1 -0
  788. package/dist/audit/types/auditScope.d.ts +58 -0
  789. package/dist/audit/types/auditScope.d.ts.map +1 -0
  790. package/dist/audit/types/auditScope.js +15 -0
  791. package/dist/audit/types/auditScope.js.map +1 -0
  792. package/dist/audit/types/auditState.d.ts +18 -0
  793. package/dist/audit/types/auditState.d.ts.map +1 -0
  794. package/dist/audit/types/auditState.js +2 -0
  795. package/dist/audit/types/auditState.js.map +1 -0
  796. package/dist/audit/types/designAssessment.d.ts +22 -0
  797. package/dist/audit/types/designAssessment.d.ts.map +1 -0
  798. package/dist/audit/types/designAssessment.js +8 -0
  799. package/dist/audit/types/designAssessment.js.map +1 -0
  800. package/dist/audit/types/externalAnalyzer.d.ts +225 -0
  801. package/dist/audit/types/externalAnalyzer.d.ts.map +1 -0
  802. package/dist/audit/types/externalAnalyzer.js +56 -0
  803. package/dist/audit/types/externalAnalyzer.js.map +1 -0
  804. package/dist/audit/types/flowCoverage.d.ts +16 -0
  805. package/dist/audit/types/flowCoverage.d.ts.map +1 -0
  806. package/dist/audit/types/flowCoverage.js +6 -0
  807. package/dist/audit/types/flowCoverage.js.map +1 -0
  808. package/dist/audit/types/reviewPlanning.d.ts +513 -0
  809. package/dist/audit/types/reviewPlanning.d.ts.map +1 -0
  810. package/dist/audit/types/reviewPlanning.js +109 -0
  811. package/dist/audit/types/reviewPlanning.js.map +1 -0
  812. package/dist/audit/types/runtimeValidation.d.ts +155 -0
  813. package/dist/audit/types/runtimeValidation.d.ts.map +1 -0
  814. package/dist/audit/types/runtimeValidation.js +52 -0
  815. package/dist/audit/types/runtimeValidation.js.map +1 -0
  816. package/dist/audit/types/synthesisNarrative.d.ts +8 -0
  817. package/dist/audit/types/synthesisNarrative.d.ts.map +1 -0
  818. package/dist/audit/types/synthesisNarrative.js +6 -0
  819. package/dist/audit/types/synthesisNarrative.js.map +1 -0
  820. package/dist/audit/types/toolingManifest.d.ts +8 -0
  821. package/dist/audit/types/toolingManifest.d.ts.map +1 -0
  822. package/dist/audit/types/toolingManifest.js +2 -0
  823. package/dist/audit/types/toolingManifest.js.map +1 -0
  824. package/dist/audit/types/workerResult.d.ts +14 -0
  825. package/dist/audit/types/workerResult.d.ts.map +1 -0
  826. package/dist/audit/types/workerResult.js +2 -0
  827. package/dist/audit/types/workerResult.js.map +1 -0
  828. package/dist/audit/types/workerSession.d.ts +28 -0
  829. package/dist/audit/types/workerSession.d.ts.map +1 -0
  830. package/dist/audit/types/workerSession.js +5 -0
  831. package/dist/audit/types/workerSession.js.map +1 -0
  832. package/dist/audit/types.d.ts +1077 -0
  833. package/dist/audit/types.d.ts.map +1 -0
  834. package/dist/audit/types.js +160 -0
  835. package/dist/audit/types.js.map +1 -0
  836. package/dist/audit/validation/anchorGrounding.d.ts +49 -0
  837. package/dist/audit/validation/anchorGrounding.d.ts.map +1 -0
  838. package/dist/audit/validation/anchorGrounding.js +183 -0
  839. package/dist/audit/validation/anchorGrounding.js.map +1 -0
  840. package/dist/audit/validation/artifacts.d.ts +4 -0
  841. package/dist/audit/validation/artifacts.d.ts.map +1 -0
  842. package/dist/audit/validation/artifacts.js +313 -0
  843. package/dist/audit/validation/artifacts.js.map +1 -0
  844. package/dist/audit/validation/auditResults.d.ts +16 -0
  845. package/dist/audit/validation/auditResults.d.ts.map +1 -0
  846. package/dist/audit/validation/auditResults.js +619 -0
  847. package/dist/audit/validation/auditResults.js.map +1 -0
  848. package/dist/audit/validation/designFindingGrounding.d.ts +33 -0
  849. package/dist/audit/validation/designFindingGrounding.d.ts.map +1 -0
  850. package/dist/audit/validation/designFindingGrounding.js +43 -0
  851. package/dist/audit/validation/designFindingGrounding.js.map +1 -0
  852. package/dist/audit/validation/quoteGrounding.d.ts +18 -0
  853. package/dist/audit/validation/quoteGrounding.d.ts.map +1 -0
  854. package/dist/audit/validation/quoteGrounding.js +18 -0
  855. package/dist/audit/validation/quoteGrounding.js.map +1 -0
  856. package/dist/audit/validation/sessionConfig.d.ts +8 -0
  857. package/dist/audit/validation/sessionConfig.d.ts.map +1 -0
  858. package/dist/audit/validation/sessionConfig.js +334 -0
  859. package/dist/audit/validation/sessionConfig.js.map +1 -0
  860. package/dist/remediate/contractPipeline/artifactStore.d.ts +58 -0
  861. package/dist/remediate/contractPipeline/artifactStore.d.ts.map +1 -0
  862. package/dist/remediate/contractPipeline/artifactStore.js +201 -0
  863. package/dist/remediate/contractPipeline/artifactStore.js.map +1 -0
  864. package/dist/remediate/contractPipeline/cyclicSeamResolution.d.ts +68 -0
  865. package/dist/remediate/contractPipeline/cyclicSeamResolution.d.ts.map +1 -0
  866. package/dist/remediate/contractPipeline/cyclicSeamResolution.js +151 -0
  867. package/dist/remediate/contractPipeline/cyclicSeamResolution.js.map +1 -0
  868. package/dist/remediate/contractPipeline/derive.d.ts +88 -0
  869. package/dist/remediate/contractPipeline/derive.d.ts.map +1 -0
  870. package/dist/remediate/contractPipeline/derive.js +216 -0
  871. package/dist/remediate/contractPipeline/derive.js.map +1 -0
  872. package/dist/remediate/contractPipeline/idRegistry.d.ts +49 -0
  873. package/dist/remediate/contractPipeline/idRegistry.d.ts.map +1 -0
  874. package/dist/remediate/contractPipeline/idRegistry.js +57 -0
  875. package/dist/remediate/contractPipeline/idRegistry.js.map +1 -0
  876. package/dist/remediate/contractPipeline/reviewSnapshot.d.ts +52 -0
  877. package/dist/remediate/contractPipeline/reviewSnapshot.d.ts.map +1 -0
  878. package/dist/remediate/contractPipeline/reviewSnapshot.js +116 -0
  879. package/dist/remediate/contractPipeline/reviewSnapshot.js.map +1 -0
  880. package/dist/remediate/contractPipeline/semanticProjection.d.ts +46 -0
  881. package/dist/remediate/contractPipeline/semanticProjection.d.ts.map +1 -0
  882. package/dist/remediate/contractPipeline/semanticProjection.js +102 -0
  883. package/dist/remediate/contractPipeline/semanticProjection.js.map +1 -0
  884. package/dist/remediate/coverage/findingLedger.d.ts +99 -0
  885. package/dist/remediate/coverage/findingLedger.d.ts.map +1 -0
  886. package/dist/remediate/coverage/findingLedger.js +110 -0
  887. package/dist/remediate/coverage/findingLedger.js.map +1 -0
  888. package/dist/remediate/dedup/crossLensDedup.d.ts +9 -0
  889. package/dist/remediate/dedup/crossLensDedup.d.ts.map +1 -0
  890. package/dist/remediate/dedup/crossLensDedup.js +191 -0
  891. package/dist/remediate/dedup/crossLensDedup.js.map +1 -0
  892. package/dist/remediate/dispatch/amendmentClaim.d.ts +41 -0
  893. package/dist/remediate/dispatch/amendmentClaim.d.ts.map +1 -0
  894. package/dist/remediate/dispatch/amendmentClaim.js +60 -0
  895. package/dist/remediate/dispatch/amendmentClaim.js.map +1 -0
  896. package/dist/remediate/dispatch/ownershipRegistry.d.ts +97 -0
  897. package/dist/remediate/dispatch/ownershipRegistry.d.ts.map +1 -0
  898. package/dist/remediate/dispatch/ownershipRegistry.js +217 -0
  899. package/dist/remediate/dispatch/ownershipRegistry.js.map +1 -0
  900. package/dist/remediate/findingFilter.d.ts +42 -0
  901. package/dist/remediate/findingFilter.d.ts.map +1 -0
  902. package/dist/remediate/findingFilter.js +62 -0
  903. package/dist/remediate/findingFilter.js.map +1 -0
  904. package/dist/remediate/index.d.ts +45 -0
  905. package/dist/remediate/index.d.ts.map +1 -0
  906. package/dist/remediate/index.js +434 -0
  907. package/dist/remediate/index.js.map +1 -0
  908. package/dist/remediate/intake.d.ts +168 -0
  909. package/dist/remediate/intake.d.ts.map +1 -0
  910. package/dist/remediate/intake.js +340 -0
  911. package/dist/remediate/intake.js.map +1 -0
  912. package/dist/remediate/intent/checkpointFilter.d.ts +14 -0
  913. package/dist/remediate/intent/checkpointFilter.d.ts.map +1 -0
  914. package/dist/remediate/intent/checkpointFilter.js +111 -0
  915. package/dist/remediate/intent/checkpointFilter.js.map +1 -0
  916. package/dist/remediate/phases/close.d.ts +32 -0
  917. package/dist/remediate/phases/close.d.ts.map +1 -0
  918. package/dist/remediate/phases/close.js +992 -0
  919. package/dist/remediate/phases/close.js.map +1 -0
  920. package/dist/remediate/phases/constants.d.ts +3 -0
  921. package/dist/remediate/phases/constants.d.ts.map +1 -0
  922. package/dist/remediate/phases/constants.js +3 -0
  923. package/dist/remediate/phases/constants.js.map +1 -0
  924. package/dist/remediate/phases/grounding.d.ts +77 -0
  925. package/dist/remediate/phases/grounding.d.ts.map +1 -0
  926. package/dist/remediate/phases/grounding.js +153 -0
  927. package/dist/remediate/phases/grounding.js.map +1 -0
  928. package/dist/remediate/phases/plan.d.ts +113 -0
  929. package/dist/remediate/phases/plan.d.ts.map +1 -0
  930. package/dist/remediate/phases/plan.js +988 -0
  931. package/dist/remediate/phases/plan.js.map +1 -0
  932. package/dist/remediate/phases/triage.d.ts +4 -0
  933. package/dist/remediate/phases/triage.d.ts.map +1 -0
  934. package/dist/remediate/phases/triage.js +175 -0
  935. package/dist/remediate/phases/triage.js.map +1 -0
  936. package/dist/remediate/phases/workerTasks.d.ts +21 -0
  937. package/dist/remediate/phases/workerTasks.d.ts.map +1 -0
  938. package/dist/remediate/phases/workerTasks.js +31 -0
  939. package/dist/remediate/phases/workerTasks.js.map +1 -0
  940. package/dist/remediate/providers/claudeCodeProvider.d.ts +12 -0
  941. package/dist/remediate/providers/claudeCodeProvider.d.ts.map +1 -0
  942. package/dist/remediate/providers/claudeCodeProvider.js +24 -0
  943. package/dist/remediate/providers/claudeCodeProvider.js.map +1 -0
  944. package/dist/remediate/providers/constants.d.ts +2 -0
  945. package/dist/remediate/providers/constants.d.ts.map +1 -0
  946. package/dist/remediate/providers/constants.js +2 -0
  947. package/dist/remediate/providers/constants.js.map +1 -0
  948. package/dist/remediate/providers/index.d.ts +15 -0
  949. package/dist/remediate/providers/index.d.ts.map +1 -0
  950. package/dist/remediate/providers/index.js +22 -0
  951. package/dist/remediate/providers/index.js.map +1 -0
  952. package/dist/remediate/providers/opencodeProvider.d.ts +5 -0
  953. package/dist/remediate/providers/opencodeProvider.d.ts.map +1 -0
  954. package/dist/remediate/providers/opencodeProvider.js +10 -0
  955. package/dist/remediate/providers/opencodeProvider.js.map +1 -0
  956. package/dist/remediate/quota/hostLimits.d.ts +8 -0
  957. package/dist/remediate/quota/hostLimits.d.ts.map +1 -0
  958. package/dist/remediate/quota/hostLimits.js +9 -0
  959. package/dist/remediate/quota/hostLimits.js.map +1 -0
  960. package/dist/remediate/quota/index.d.ts +8 -0
  961. package/dist/remediate/quota/index.d.ts.map +1 -0
  962. package/dist/remediate/quota/index.js +12 -0
  963. package/dist/remediate/quota/index.js.map +1 -0
  964. package/dist/remediate/review/reviewGate.d.ts +72 -0
  965. package/dist/remediate/review/reviewGate.d.ts.map +1 -0
  966. package/dist/remediate/review/reviewGate.js +112 -0
  967. package/dist/remediate/review/reviewGate.js.map +1 -0
  968. package/dist/remediate/review/reviewNecessity.d.ts +53 -0
  969. package/dist/remediate/review/reviewNecessity.d.ts.map +1 -0
  970. package/dist/remediate/review/reviewNecessity.js +129 -0
  971. package/dist/remediate/review/reviewNecessity.js.map +1 -0
  972. package/dist/remediate/state/closingActions.d.ts +3 -0
  973. package/dist/remediate/state/closingActions.d.ts.map +1 -0
  974. package/dist/remediate/state/closingActions.js +10 -0
  975. package/dist/remediate/state/closingActions.js.map +1 -0
  976. package/dist/remediate/state/itemStatus.d.ts +40 -0
  977. package/dist/remediate/state/itemStatus.d.ts.map +1 -0
  978. package/dist/remediate/state/itemStatus.js +138 -0
  979. package/dist/remediate/state/itemStatus.js.map +1 -0
  980. package/dist/remediate/state/store.d.ts +65 -0
  981. package/dist/remediate/state/store.d.ts.map +1 -0
  982. package/dist/remediate/state/store.js +141 -0
  983. package/dist/remediate/state/store.js.map +1 -0
  984. package/dist/remediate/state/types.d.ts +766 -0
  985. package/dist/remediate/state/types.d.ts.map +1 -0
  986. package/dist/remediate/state/types.js +122 -0
  987. package/dist/remediate/state/types.js.map +1 -0
  988. package/dist/remediate/steps/contractPipeline.d.ts +173 -0
  989. package/dist/remediate/steps/contractPipeline.d.ts.map +1 -0
  990. package/dist/remediate/steps/contractPipeline.js +1229 -0
  991. package/dist/remediate/steps/contractPipeline.js.map +1 -0
  992. package/dist/remediate/steps/contractPipelinePrompts.d.ts +72 -0
  993. package/dist/remediate/steps/contractPipelinePrompts.d.ts.map +1 -0
  994. package/dist/remediate/steps/contractPipelinePrompts.js +438 -0
  995. package/dist/remediate/steps/contractPipelinePrompts.js.map +1 -0
  996. package/dist/remediate/steps/dispatch.d.ts +434 -0
  997. package/dist/remediate/steps/dispatch.d.ts.map +1 -0
  998. package/dist/remediate/steps/dispatch.js +2180 -0
  999. package/dist/remediate/steps/dispatch.js.map +1 -0
  1000. package/dist/remediate/steps/intakeResolver.d.ts +32 -0
  1001. package/dist/remediate/steps/intakeResolver.d.ts.map +1 -0
  1002. package/dist/remediate/steps/intakeResolver.js +310 -0
  1003. package/dist/remediate/steps/intakeResolver.js.map +1 -0
  1004. package/dist/remediate/steps/leanFastPath.d.ts +49 -0
  1005. package/dist/remediate/steps/leanFastPath.d.ts.map +1 -0
  1006. package/dist/remediate/steps/leanFastPath.js +151 -0
  1007. package/dist/remediate/steps/leanFastPath.js.map +1 -0
  1008. package/dist/remediate/steps/nextStep.d.ts +323 -0
  1009. package/dist/remediate/steps/nextStep.d.ts.map +1 -0
  1010. package/dist/remediate/steps/nextStep.js +2721 -0
  1011. package/dist/remediate/steps/nextStep.js.map +1 -0
  1012. package/dist/remediate/steps/prompts.d.ts +26 -0
  1013. package/dist/remediate/steps/prompts.d.ts.map +1 -0
  1014. package/dist/remediate/steps/prompts.js +370 -0
  1015. package/dist/remediate/steps/prompts.js.map +1 -0
  1016. package/dist/remediate/steps/providerNodeDispatch.d.ts +42 -0
  1017. package/dist/remediate/steps/providerNodeDispatch.d.ts.map +1 -0
  1018. package/dist/remediate/steps/providerNodeDispatch.js +100 -0
  1019. package/dist/remediate/steps/providerNodeDispatch.js.map +1 -0
  1020. package/dist/remediate/steps/rollingSession.d.ts +84 -0
  1021. package/dist/remediate/steps/rollingSession.d.ts.map +1 -0
  1022. package/dist/remediate/steps/rollingSession.js +147 -0
  1023. package/dist/remediate/steps/rollingSession.js.map +1 -0
  1024. package/dist/remediate/steps/stepUtils.d.ts +63 -0
  1025. package/dist/remediate/steps/stepUtils.d.ts.map +1 -0
  1026. package/dist/remediate/steps/stepUtils.js +117 -0
  1027. package/dist/remediate/steps/stepUtils.js.map +1 -0
  1028. package/dist/remediate/steps/stepWriter.d.ts +27 -0
  1029. package/dist/remediate/steps/stepWriter.d.ts.map +1 -0
  1030. package/dist/remediate/steps/stepWriter.js +37 -0
  1031. package/dist/remediate/steps/stepWriter.js.map +1 -0
  1032. package/dist/remediate/steps/types.d.ts +83 -0
  1033. package/dist/remediate/steps/types.d.ts.map +1 -0
  1034. package/dist/remediate/steps/types.js +6 -0
  1035. package/dist/remediate/steps/types.js.map +1 -0
  1036. package/dist/remediate/types/options.d.ts +6 -0
  1037. package/dist/remediate/types/options.d.ts.map +1 -0
  1038. package/dist/remediate/types/options.js +2 -0
  1039. package/dist/remediate/types/options.js.map +1 -0
  1040. package/dist/remediate/types/workerSession.d.ts +36 -0
  1041. package/dist/remediate/types/workerSession.d.ts.map +1 -0
  1042. package/dist/remediate/types/workerSession.js +13 -0
  1043. package/dist/remediate/types/workerSession.js.map +1 -0
  1044. package/dist/remediate/utils/commands.d.ts +17 -0
  1045. package/dist/remediate/utils/commands.d.ts.map +1 -0
  1046. package/dist/remediate/utils/commands.js +26 -0
  1047. package/dist/remediate/utils/commands.js.map +1 -0
  1048. package/dist/remediate/utils/fileIntegrity.d.ts +27 -0
  1049. package/dist/remediate/utils/fileIntegrity.d.ts.map +1 -0
  1050. package/dist/remediate/utils/fileIntegrity.js +201 -0
  1051. package/dist/remediate/utils/fileIntegrity.js.map +1 -0
  1052. package/dist/remediate/utils/hostAssets.d.ts +18 -0
  1053. package/dist/remediate/utils/hostAssets.d.ts.map +1 -0
  1054. package/dist/remediate/utils/hostAssets.js +31 -0
  1055. package/dist/remediate/utils/hostAssets.js.map +1 -0
  1056. package/dist/remediate/validation/artifacts.d.ts +9 -0
  1057. package/dist/remediate/validation/artifacts.d.ts.map +1 -0
  1058. package/dist/remediate/validation/artifacts.js +316 -0
  1059. package/dist/remediate/validation/artifacts.js.map +1 -0
  1060. package/dist/remediate/validation/contractPipeline.d.ts +36 -0
  1061. package/dist/remediate/validation/contractPipeline.d.ts.map +1 -0
  1062. package/dist/remediate/validation/contractPipeline.js +569 -0
  1063. package/dist/remediate/validation/contractPipeline.js.map +1 -0
  1064. package/dist/remediate/validation/contractPipelineGates.d.ts +161 -0
  1065. package/dist/remediate/validation/contractPipelineGates.d.ts.map +1 -0
  1066. package/dist/remediate/validation/contractPipelineGates.js +739 -0
  1067. package/dist/remediate/validation/contractPipelineGates.js.map +1 -0
  1068. package/dist/remediate/validation/remediationState.d.ts +8 -0
  1069. package/dist/remediate/validation/remediationState.d.ts.map +1 -0
  1070. package/dist/remediate/validation/remediationState.js +187 -0
  1071. package/dist/remediate/validation/remediationState.js.map +1 -0
  1072. package/dist/shared/agentReflections.d.ts +61 -0
  1073. package/dist/shared/agentReflections.d.ts.map +1 -0
  1074. package/dist/shared/agentReflections.js +180 -0
  1075. package/dist/shared/agentReflections.js.map +1 -0
  1076. package/dist/shared/concurrency.d.ts +16 -0
  1077. package/dist/shared/concurrency.d.ts.map +1 -0
  1078. package/dist/shared/concurrency.js +34 -0
  1079. package/dist/shared/concurrency.js.map +1 -0
  1080. package/dist/shared/contracts.d.ts +2 -0
  1081. package/dist/shared/contracts.d.ts.map +1 -0
  1082. package/dist/shared/contracts.js +2 -0
  1083. package/dist/shared/contracts.js.map +1 -0
  1084. package/dist/shared/dispatch/rollingDispatch.d.ts +192 -0
  1085. package/dist/shared/dispatch/rollingDispatch.d.ts.map +1 -0
  1086. package/dist/shared/dispatch/rollingDispatch.js +389 -0
  1087. package/dist/shared/dispatch/rollingDispatch.js.map +1 -0
  1088. package/dist/shared/dispatch/tierRank.d.ts +53 -0
  1089. package/dist/shared/dispatch/tierRank.d.ts.map +1 -0
  1090. package/dist/shared/dispatch/tierRank.js +69 -0
  1091. package/dist/shared/dispatch/tierRank.js.map +1 -0
  1092. package/dist/shared/engine/obligationEngine.d.ts +159 -0
  1093. package/dist/shared/engine/obligationEngine.d.ts.map +1 -0
  1094. package/dist/shared/engine/obligationEngine.js +124 -0
  1095. package/dist/shared/engine/obligationEngine.js.map +1 -0
  1096. package/dist/shared/findingIdentitySignature.d.ts +82 -0
  1097. package/dist/shared/findingIdentitySignature.d.ts.map +1 -0
  1098. package/dist/shared/findingIdentitySignature.js +114 -0
  1099. package/dist/shared/findingIdentitySignature.js.map +1 -0
  1100. package/dist/shared/git.d.ts +18 -0
  1101. package/dist/shared/git.d.ts.map +1 -0
  1102. package/dist/shared/git.js +63 -0
  1103. package/dist/shared/git.js.map +1 -0
  1104. package/dist/shared/hash.d.ts +16 -0
  1105. package/dist/shared/hash.d.ts.map +1 -0
  1106. package/dist/shared/hash.js +36 -0
  1107. package/dist/shared/hash.js.map +1 -0
  1108. package/dist/shared/hostAssets.d.ts +40 -0
  1109. package/dist/shared/hostAssets.d.ts.map +1 -0
  1110. package/dist/shared/hostAssets.js +110 -0
  1111. package/dist/shared/hostAssets.js.map +1 -0
  1112. package/dist/shared/ids.d.ts +18 -0
  1113. package/dist/shared/ids.d.ts.map +1 -0
  1114. package/dist/shared/ids.js +27 -0
  1115. package/dist/shared/ids.js.map +1 -0
  1116. package/dist/shared/index.d.ts +150 -0
  1117. package/dist/shared/index.d.ts.map +1 -0
  1118. package/dist/shared/index.js +112 -0
  1119. package/dist/shared/index.js.map +1 -0
  1120. package/dist/shared/intent/clauseInterpreter.d.ts +84 -0
  1121. package/dist/shared/intent/clauseInterpreter.d.ts.map +1 -0
  1122. package/dist/shared/intent/clauseInterpreter.js +183 -0
  1123. package/dist/shared/intent/clauseInterpreter.js.map +1 -0
  1124. package/dist/shared/intent/freeFormIntentInterpreter.d.ts +46 -0
  1125. package/dist/shared/intent/freeFormIntentInterpreter.d.ts.map +1 -0
  1126. package/dist/shared/intent/freeFormIntentInterpreter.js +126 -0
  1127. package/dist/shared/intent/freeFormIntentInterpreter.js.map +1 -0
  1128. package/dist/shared/intent/sharedIntentData.d.ts +16 -0
  1129. package/dist/shared/intent/sharedIntentData.d.ts.map +1 -0
  1130. package/dist/shared/intent/sharedIntentData.js +38 -0
  1131. package/dist/shared/intent/sharedIntentData.js.map +1 -0
  1132. package/dist/shared/io/auditToolsPaths.d.ts +36 -0
  1133. package/dist/shared/io/auditToolsPaths.d.ts.map +1 -0
  1134. package/dist/shared/io/auditToolsPaths.js +47 -0
  1135. package/dist/shared/io/auditToolsPaths.js.map +1 -0
  1136. package/dist/shared/io/json.d.ts +30 -0
  1137. package/dist/shared/io/json.d.ts.map +1 -0
  1138. package/dist/shared/io/json.js +183 -0
  1139. package/dist/shared/io/json.js.map +1 -0
  1140. package/dist/shared/io/stepContractWriter.d.ts +103 -0
  1141. package/dist/shared/io/stepContractWriter.d.ts.map +1 -0
  1142. package/dist/shared/io/stepContractWriter.js +85 -0
  1143. package/dist/shared/io/stepContractWriter.js.map +1 -0
  1144. package/dist/shared/observability/runLog.d.ts +37 -0
  1145. package/dist/shared/observability/runLog.d.ts.map +1 -0
  1146. package/dist/shared/observability/runLog.js +40 -0
  1147. package/dist/shared/observability/runLog.js.map +1 -0
  1148. package/dist/shared/opencodePermissions.d.ts +49 -0
  1149. package/dist/shared/opencodePermissions.d.ts.map +1 -0
  1150. package/dist/shared/opencodePermissions.js +118 -0
  1151. package/dist/shared/opencodePermissions.js.map +1 -0
  1152. package/dist/shared/parsing/stringAwareScanner.d.ts +32 -0
  1153. package/dist/shared/parsing/stringAwareScanner.d.ts.map +1 -0
  1154. package/dist/shared/parsing/stringAwareScanner.js +51 -0
  1155. package/dist/shared/parsing/stringAwareScanner.js.map +1 -0
  1156. package/dist/shared/prompts.d.ts +47 -0
  1157. package/dist/shared/prompts.d.ts.map +1 -0
  1158. package/dist/shared/prompts.js +41 -0
  1159. package/dist/shared/prompts.js.map +1 -0
  1160. package/dist/shared/providers/claudeCodeProvider.d.ts +56 -0
  1161. package/dist/shared/providers/claudeCodeProvider.d.ts.map +1 -0
  1162. package/dist/shared/providers/claudeCodeProvider.js +67 -0
  1163. package/dist/shared/providers/claudeCodeProvider.js.map +1 -0
  1164. package/dist/shared/providers/codexProvider.d.ts +37 -0
  1165. package/dist/shared/providers/codexProvider.d.ts.map +1 -0
  1166. package/dist/shared/providers/codexProvider.js +79 -0
  1167. package/dist/shared/providers/codexProvider.js.map +1 -0
  1168. package/dist/shared/providers/constants.d.ts +4 -0
  1169. package/dist/shared/providers/constants.d.ts.map +1 -0
  1170. package/dist/shared/providers/constants.js +4 -0
  1171. package/dist/shared/providers/constants.js.map +1 -0
  1172. package/dist/shared/providers/localSubprocessProvider.d.ts +10 -0
  1173. package/dist/shared/providers/localSubprocessProvider.d.ts.map +1 -0
  1174. package/dist/shared/providers/localSubprocessProvider.js +20 -0
  1175. package/dist/shared/providers/localSubprocessProvider.js.map +1 -0
  1176. package/dist/shared/providers/openAiCompatibleProvider.d.ts +62 -0
  1177. package/dist/shared/providers/openAiCompatibleProvider.d.ts.map +1 -0
  1178. package/dist/shared/providers/openAiCompatibleProvider.js +333 -0
  1179. package/dist/shared/providers/openAiCompatibleProvider.js.map +1 -0
  1180. package/dist/shared/providers/opencodeLaunch.d.ts +28 -0
  1181. package/dist/shared/providers/opencodeLaunch.d.ts.map +1 -0
  1182. package/dist/shared/providers/opencodeLaunch.js +39 -0
  1183. package/dist/shared/providers/opencodeLaunch.js.map +1 -0
  1184. package/dist/shared/providers/opencodeProvider.d.ts +19 -0
  1185. package/dist/shared/providers/opencodeProvider.d.ts.map +1 -0
  1186. package/dist/shared/providers/opencodeProvider.js +41 -0
  1187. package/dist/shared/providers/opencodeProvider.js.map +1 -0
  1188. package/dist/shared/providers/providerConfirmation.d.ts +56 -0
  1189. package/dist/shared/providers/providerConfirmation.d.ts.map +1 -0
  1190. package/dist/shared/providers/providerConfirmation.js +195 -0
  1191. package/dist/shared/providers/providerConfirmation.js.map +1 -0
  1192. package/dist/shared/providers/providerDiagnostics.d.ts +11 -0
  1193. package/dist/shared/providers/providerDiagnostics.d.ts.map +1 -0
  1194. package/dist/shared/providers/providerDiagnostics.js +28 -0
  1195. package/dist/shared/providers/providerDiagnostics.js.map +1 -0
  1196. package/dist/shared/providers/providerFactory.d.ts +72 -0
  1197. package/dist/shared/providers/providerFactory.d.ts.map +1 -0
  1198. package/dist/shared/providers/providerFactory.js +246 -0
  1199. package/dist/shared/providers/providerFactory.js.map +1 -0
  1200. package/dist/shared/providers/providerKeyedFactory.d.ts +14 -0
  1201. package/dist/shared/providers/providerKeyedFactory.d.ts.map +1 -0
  1202. package/dist/shared/providers/providerKeyedFactory.js +16 -0
  1203. package/dist/shared/providers/providerKeyedFactory.js.map +1 -0
  1204. package/dist/shared/providers/spawnLoggedCommand.d.ts +10 -0
  1205. package/dist/shared/providers/spawnLoggedCommand.d.ts.map +1 -0
  1206. package/dist/shared/providers/spawnLoggedCommand.js +304 -0
  1207. package/dist/shared/providers/spawnLoggedCommand.js.map +1 -0
  1208. package/dist/shared/providers/subprocessTemplateProvider.d.ts +19 -0
  1209. package/dist/shared/providers/subprocessTemplateProvider.d.ts.map +1 -0
  1210. package/dist/shared/providers/subprocessTemplateProvider.js +91 -0
  1211. package/dist/shared/providers/subprocessTemplateProvider.js.map +1 -0
  1212. package/dist/shared/providers/types.d.ts +43 -0
  1213. package/dist/shared/providers/types.d.ts.map +1 -0
  1214. package/dist/shared/providers/types.js +2 -0
  1215. package/dist/shared/providers/types.js.map +1 -0
  1216. package/dist/shared/providers/workerTaskLaunch.d.ts +32 -0
  1217. package/dist/shared/providers/workerTaskLaunch.d.ts.map +1 -0
  1218. package/dist/shared/providers/workerTaskLaunch.js +27 -0
  1219. package/dist/shared/providers/workerTaskLaunch.js.map +1 -0
  1220. package/dist/shared/quota/antigravityQuotaSource.d.ts +44 -0
  1221. package/dist/shared/quota/antigravityQuotaSource.d.ts.map +1 -0
  1222. package/dist/shared/quota/antigravityQuotaSource.js +101 -0
  1223. package/dist/shared/quota/antigravityQuotaSource.js.map +1 -0
  1224. package/dist/shared/quota/capacity.d.ts +283 -0
  1225. package/dist/shared/quota/capacity.d.ts.map +1 -0
  1226. package/dist/shared/quota/capacity.js +290 -0
  1227. package/dist/shared/quota/capacity.js.map +1 -0
  1228. package/dist/shared/quota/claudeCodeJsonLines.d.ts +15 -0
  1229. package/dist/shared/quota/claudeCodeJsonLines.d.ts.map +1 -0
  1230. package/dist/shared/quota/claudeCodeJsonLines.js +34 -0
  1231. package/dist/shared/quota/claudeCodeJsonLines.js.map +1 -0
  1232. package/dist/shared/quota/claudeOAuthQuotaSource.d.ts +56 -0
  1233. package/dist/shared/quota/claudeOAuthQuotaSource.d.ts.map +1 -0
  1234. package/dist/shared/quota/claudeOAuthQuotaSource.js +136 -0
  1235. package/dist/shared/quota/claudeOAuthQuotaSource.js.map +1 -0
  1236. package/dist/shared/quota/codexQuotaSource.d.ts +49 -0
  1237. package/dist/shared/quota/codexQuotaSource.d.ts.map +1 -0
  1238. package/dist/shared/quota/codexQuotaSource.js +96 -0
  1239. package/dist/shared/quota/codexQuotaSource.js.map +1 -0
  1240. package/dist/shared/quota/compositeQuotaSource.d.ts +29 -0
  1241. package/dist/shared/quota/compositeQuotaSource.d.ts.map +1 -0
  1242. package/dist/shared/quota/compositeQuotaSource.js +58 -0
  1243. package/dist/shared/quota/compositeQuotaSource.js.map +1 -0
  1244. package/dist/shared/quota/copilotQuotaSource.d.ts +57 -0
  1245. package/dist/shared/quota/copilotQuotaSource.d.ts.map +1 -0
  1246. package/dist/shared/quota/copilotQuotaSource.js +141 -0
  1247. package/dist/shared/quota/copilotQuotaSource.js.map +1 -0
  1248. package/dist/shared/quota/errorParsers/claudeCodeErrorParser.d.ts +7 -0
  1249. package/dist/shared/quota/errorParsers/claudeCodeErrorParser.d.ts.map +1 -0
  1250. package/dist/shared/quota/errorParsers/claudeCodeErrorParser.js +33 -0
  1251. package/dist/shared/quota/errorParsers/claudeCodeErrorParser.js.map +1 -0
  1252. package/dist/shared/quota/errorParsers/genericErrorParser.d.ts +10 -0
  1253. package/dist/shared/quota/errorParsers/genericErrorParser.d.ts.map +1 -0
  1254. package/dist/shared/quota/errorParsers/genericErrorParser.js +8 -0
  1255. package/dist/shared/quota/errorParsers/genericErrorParser.js.map +1 -0
  1256. package/dist/shared/quota/errorParsers/index.d.ts +6 -0
  1257. package/dist/shared/quota/errorParsers/index.d.ts.map +1 -0
  1258. package/dist/shared/quota/errorParsers/index.js +16 -0
  1259. package/dist/shared/quota/errorParsers/index.js.map +1 -0
  1260. package/dist/shared/quota/errorParsing.d.ts +8 -0
  1261. package/dist/shared/quota/errorParsing.d.ts.map +1 -0
  1262. package/dist/shared/quota/errorParsing.js +129 -0
  1263. package/dist/shared/quota/errorParsing.js.map +1 -0
  1264. package/dist/shared/quota/fileLock.d.ts +9 -0
  1265. package/dist/shared/quota/fileLock.d.ts.map +1 -0
  1266. package/dist/shared/quota/fileLock.js +202 -0
  1267. package/dist/shared/quota/fileLock.js.map +1 -0
  1268. package/dist/shared/quota/hostLimits.d.ts +16 -0
  1269. package/dist/shared/quota/hostLimits.d.ts.map +1 -0
  1270. package/dist/shared/quota/hostLimits.js +57 -0
  1271. package/dist/shared/quota/hostLimits.js.map +1 -0
  1272. package/dist/shared/quota/httpQuotaSource.d.ts +87 -0
  1273. package/dist/shared/quota/httpQuotaSource.d.ts.map +1 -0
  1274. package/dist/shared/quota/httpQuotaSource.js +90 -0
  1275. package/dist/shared/quota/httpQuotaSource.js.map +1 -0
  1276. package/dist/shared/quota/learnedQuotaSource.d.ts +8 -0
  1277. package/dist/shared/quota/learnedQuotaSource.d.ts.map +1 -0
  1278. package/dist/shared/quota/learnedQuotaSource.js +26 -0
  1279. package/dist/shared/quota/learnedQuotaSource.js.map +1 -0
  1280. package/dist/shared/quota/limits.d.ts +35 -0
  1281. package/dist/shared/quota/limits.d.ts.map +1 -0
  1282. package/dist/shared/quota/limits.js +110 -0
  1283. package/dist/shared/quota/limits.js.map +1 -0
  1284. package/dist/shared/quota/openCodeQuotaSource.d.ts +18 -0
  1285. package/dist/shared/quota/openCodeQuotaSource.d.ts.map +1 -0
  1286. package/dist/shared/quota/openCodeQuotaSource.js +84 -0
  1287. package/dist/shared/quota/openCodeQuotaSource.js.map +1 -0
  1288. package/dist/shared/quota/quotaSource.d.ts +29 -0
  1289. package/dist/shared/quota/quotaSource.d.ts.map +1 -0
  1290. package/dist/shared/quota/quotaSource.js +12 -0
  1291. package/dist/shared/quota/quotaSource.js.map +1 -0
  1292. package/dist/shared/quota/rollingEngine.d.ts +130 -0
  1293. package/dist/shared/quota/rollingEngine.d.ts.map +1 -0
  1294. package/dist/shared/quota/rollingEngine.js +153 -0
  1295. package/dist/shared/quota/rollingEngine.js.map +1 -0
  1296. package/dist/shared/quota/scheduler.d.ts +94 -0
  1297. package/dist/shared/quota/scheduler.d.ts.map +1 -0
  1298. package/dist/shared/quota/scheduler.js +313 -0
  1299. package/dist/shared/quota/scheduler.js.map +1 -0
  1300. package/dist/shared/quota/slidingWindow.d.ts +5 -0
  1301. package/dist/shared/quota/slidingWindow.d.ts.map +1 -0
  1302. package/dist/shared/quota/slidingWindow.js +29 -0
  1303. package/dist/shared/quota/slidingWindow.js.map +1 -0
  1304. package/dist/shared/quota/state.d.ts +27 -0
  1305. package/dist/shared/quota/state.d.ts.map +1 -0
  1306. package/dist/shared/quota/state.js +204 -0
  1307. package/dist/shared/quota/state.js.map +1 -0
  1308. package/dist/shared/quota/types.d.ts +109 -0
  1309. package/dist/shared/quota/types.d.ts.map +1 -0
  1310. package/dist/shared/quota/types.js +56 -0
  1311. package/dist/shared/quota/types.js.map +1 -0
  1312. package/dist/shared/reReview/projectionDiff.d.ts +65 -0
  1313. package/dist/shared/reReview/projectionDiff.d.ts.map +1 -0
  1314. package/dist/shared/reReview/projectionDiff.js +144 -0
  1315. package/dist/shared/reReview/projectionDiff.js.map +1 -0
  1316. package/dist/shared/rolling/pausedState.d.ts +109 -0
  1317. package/dist/shared/rolling/pausedState.d.ts.map +1 -0
  1318. package/dist/shared/rolling/pausedState.js +100 -0
  1319. package/dist/shared/rolling/pausedState.js.map +1 -0
  1320. package/dist/shared/tokens.d.ts +24 -0
  1321. package/dist/shared/tokens.d.ts.map +1 -0
  1322. package/dist/shared/tokens.js +54 -0
  1323. package/dist/shared/tokens.js.map +1 -0
  1324. package/dist/shared/tooling/allowlistedExec.d.ts +45 -0
  1325. package/dist/shared/tooling/allowlistedExec.d.ts.map +1 -0
  1326. package/dist/shared/tooling/allowlistedExec.js +340 -0
  1327. package/dist/shared/tooling/allowlistedExec.js.map +1 -0
  1328. package/dist/shared/tooling/analyzerDeps.d.ts +65 -0
  1329. package/dist/shared/tooling/analyzerDeps.d.ts.map +1 -0
  1330. package/dist/shared/tooling/analyzerDeps.js +130 -0
  1331. package/dist/shared/tooling/analyzerDeps.js.map +1 -0
  1332. package/dist/shared/tooling/exec.d.ts +99 -0
  1333. package/dist/shared/tooling/exec.d.ts.map +1 -0
  1334. package/dist/shared/tooling/exec.js +217 -0
  1335. package/dist/shared/tooling/exec.js.map +1 -0
  1336. package/dist/shared/tooling/repoConventions.d.ts +23 -0
  1337. package/dist/shared/tooling/repoConventions.d.ts.map +1 -0
  1338. package/dist/shared/tooling/repoConventions.js +177 -0
  1339. package/dist/shared/tooling/repoConventions.js.map +1 -0
  1340. package/dist/shared/tooling/testCommand.d.ts +17 -0
  1341. package/dist/shared/tooling/testCommand.d.ts.map +1 -0
  1342. package/dist/shared/tooling/testCommand.js +106 -0
  1343. package/dist/shared/tooling/testCommand.js.map +1 -0
  1344. package/dist/shared/types/accessDeclaration.d.ts +16 -0
  1345. package/dist/shared/types/accessDeclaration.d.ts.map +1 -0
  1346. package/dist/shared/types/accessDeclaration.js +9 -0
  1347. package/dist/shared/types/accessDeclaration.js.map +1 -0
  1348. package/dist/shared/types/contractPipeline/design.d.ts +74 -0
  1349. package/dist/shared/types/contractPipeline/design.d.ts.map +1 -0
  1350. package/dist/shared/types/contractPipeline/design.js +10 -0
  1351. package/dist/shared/types/contractPipeline/design.js.map +1 -0
  1352. package/dist/shared/types/contractPipeline/goal.d.ts +41 -0
  1353. package/dist/shared/types/contractPipeline/goal.d.ts.map +1 -0
  1354. package/dist/shared/types/contractPipeline/goal.js +10 -0
  1355. package/dist/shared/types/contractPipeline/goal.js.map +1 -0
  1356. package/dist/shared/types/contractPipeline/implementation.d.ts +64 -0
  1357. package/dist/shared/types/contractPipeline/implementation.d.ts.map +1 -0
  1358. package/dist/shared/types/contractPipeline/implementation.js +8 -0
  1359. package/dist/shared/types/contractPipeline/implementation.js.map +1 -0
  1360. package/dist/shared/types/contractPipeline/obligations.d.ts +141 -0
  1361. package/dist/shared/types/contractPipeline/obligations.d.ts.map +1 -0
  1362. package/dist/shared/types/contractPipeline/obligations.js +16 -0
  1363. package/dist/shared/types/contractPipeline/obligations.js.map +1 -0
  1364. package/dist/shared/types/contractPipeline/verification.d.ts +64 -0
  1365. package/dist/shared/types/contractPipeline/verification.d.ts.map +1 -0
  1366. package/dist/shared/types/contractPipeline/verification.js +10 -0
  1367. package/dist/shared/types/contractPipeline/verification.js.map +1 -0
  1368. package/dist/shared/types/contractPipeline.d.ts +36 -0
  1369. package/dist/shared/types/contractPipeline.d.ts.map +1 -0
  1370. package/dist/shared/types/contractPipeline.js +31 -0
  1371. package/dist/shared/types/contractPipeline.js.map +1 -0
  1372. package/dist/shared/types/disposition.d.ts +46 -0
  1373. package/dist/shared/types/disposition.d.ts.map +1 -0
  1374. package/dist/shared/types/disposition.js +22 -0
  1375. package/dist/shared/types/disposition.js.map +1 -0
  1376. package/dist/shared/types/finding.d.ts +1463 -0
  1377. package/dist/shared/types/finding.d.ts.map +1 -0
  1378. package/dist/shared/types/finding.js +234 -0
  1379. package/dist/shared/types/finding.js.map +1 -0
  1380. package/dist/shared/types/flows.d.ts +84 -0
  1381. package/dist/shared/types/flows.d.ts.map +1 -0
  1382. package/dist/shared/types/flows.js +23 -0
  1383. package/dist/shared/types/flows.js.map +1 -0
  1384. package/dist/shared/types/graph.d.ts +359 -0
  1385. package/dist/shared/types/graph.d.ts.map +1 -0
  1386. package/dist/shared/types/graph.js +38 -0
  1387. package/dist/shared/types/graph.js.map +1 -0
  1388. package/dist/shared/types/intentCheckpoint.d.ts +95 -0
  1389. package/dist/shared/types/intentCheckpoint.d.ts.map +1 -0
  1390. package/dist/shared/types/intentCheckpoint.js +2 -0
  1391. package/dist/shared/types/intentCheckpoint.js.map +1 -0
  1392. package/dist/shared/types/intentInterpretation.d.ts +57 -0
  1393. package/dist/shared/types/intentInterpretation.d.ts.map +1 -0
  1394. package/dist/shared/types/intentInterpretation.js +20 -0
  1395. package/dist/shared/types/intentInterpretation.js.map +1 -0
  1396. package/dist/shared/types/lens.d.ts +38 -0
  1397. package/dist/shared/types/lens.d.ts.map +1 -0
  1398. package/dist/shared/types/lens.js +80 -0
  1399. package/dist/shared/types/lens.js.map +1 -0
  1400. package/dist/shared/types/obligationLedger.d.ts +35 -0
  1401. package/dist/shared/types/obligationLedger.d.ts.map +1 -0
  1402. package/dist/shared/types/obligationLedger.js +77 -0
  1403. package/dist/shared/types/obligationLedger.js.map +1 -0
  1404. package/dist/shared/types/providerConfirmation.d.ts +51 -0
  1405. package/dist/shared/types/providerConfirmation.d.ts.map +1 -0
  1406. package/dist/shared/types/providerConfirmation.js +19 -0
  1407. package/dist/shared/types/providerConfirmation.js.map +1 -0
  1408. package/dist/shared/types/remediationOutcome.d.ts +41 -0
  1409. package/dist/shared/types/remediationOutcome.d.ts.map +1 -0
  1410. package/dist/shared/types/remediationOutcome.js +7 -0
  1411. package/dist/shared/types/remediationOutcome.js.map +1 -0
  1412. package/dist/shared/types/risk.d.ts +52 -0
  1413. package/dist/shared/types/risk.d.ts.map +1 -0
  1414. package/dist/shared/types/risk.js +17 -0
  1415. package/dist/shared/types/risk.js.map +1 -0
  1416. package/dist/shared/types/rollingDispatch.d.ts +61 -0
  1417. package/dist/shared/types/rollingDispatch.d.ts.map +1 -0
  1418. package/dist/shared/types/rollingDispatch.js +19 -0
  1419. package/dist/shared/types/rollingDispatch.js.map +1 -0
  1420. package/dist/shared/types/runLedger.d.ts +18 -0
  1421. package/dist/shared/types/runLedger.d.ts.map +1 -0
  1422. package/dist/shared/types/runLedger.js +7 -0
  1423. package/dist/shared/types/runLedger.js.map +1 -0
  1424. package/dist/shared/types/sessionConfig.d.ts +294 -0
  1425. package/dist/shared/types/sessionConfig.d.ts.map +1 -0
  1426. package/dist/shared/types/sessionConfig.js +44 -0
  1427. package/dist/shared/types/sessionConfig.js.map +1 -0
  1428. package/dist/shared/types/stepContract.d.ts +10 -0
  1429. package/dist/shared/types/stepContract.d.ts.map +1 -0
  1430. package/dist/shared/types/stepContract.js +4 -0
  1431. package/dist/shared/types/stepContract.js.map +1 -0
  1432. package/dist/shared/types/surfaces.d.ts +73 -0
  1433. package/dist/shared/types/surfaces.d.ts.map +1 -0
  1434. package/dist/shared/types/surfaces.js +21 -0
  1435. package/dist/shared/types/surfaces.js.map +1 -0
  1436. package/dist/shared/validation/basic.d.ts +24 -0
  1437. package/dist/shared/validation/basic.d.ts.map +1 -0
  1438. package/dist/shared/validation/basic.js +57 -0
  1439. package/dist/shared/validation/basic.js.map +1 -0
  1440. package/dist/shared/validation/findingGrounding.d.ts +45 -0
  1441. package/dist/shared/validation/findingGrounding.d.ts.map +1 -0
  1442. package/dist/shared/validation/findingGrounding.js +103 -0
  1443. package/dist/shared/validation/findingGrounding.js.map +1 -0
  1444. package/dist/shared/validation/findingsReport.d.ts +42 -0
  1445. package/dist/shared/validation/findingsReport.d.ts.map +1 -0
  1446. package/dist/shared/validation/findingsReport.js +76 -0
  1447. package/dist/shared/validation/findingsReport.js.map +1 -0
  1448. package/dist/shared/validation/sessionConfig.d.ts +22 -0
  1449. package/dist/shared/validation/sessionConfig.d.ts.map +1 -0
  1450. package/dist/shared/validation/sessionConfig.js +38 -0
  1451. package/dist/shared/validation/sessionConfig.js.map +1 -0
  1452. package/docs/audit-pkg/contracts.md +227 -0
  1453. package/docs/audit-pkg/development.md +112 -0
  1454. package/docs/audit-pkg/history.md +66 -0
  1455. package/docs/audit-pkg/operator-guide.md +204 -0
  1456. package/docs/audit-pkg/product.md +119 -0
  1457. package/docs/audit-pkg/release.md +131 -0
  1458. package/opencode.json +159 -0
  1459. package/package.json +104 -0
  1460. package/remediate-code.mjs +116 -0
  1461. package/schemas/audit_result.schema.json +510 -0
  1462. package/schemas/audit_results.schema.json +514 -0
  1463. package/schemas/audit_task.schema.json +127 -0
  1464. package/schemas/finding.schema.json +261 -0
  1465. package/schemas/lens.schema.json +19 -0
  1466. package/scripts/audit/postinstall.mjs +385 -0
  1467. package/scripts/postinstall.mjs +24 -0
  1468. package/scripts/remediate/postinstall.mjs +387 -0
  1469. package/skills/audit-code/SKILL.md +166 -0
  1470. package/skills/audit-code/agents/openai.yaml +4 -0
  1471. package/skills/audit-code/audit-code.prompt.md +112 -0
  1472. package/skills/audit-code/opencode-command-template.txt +13 -0
  1473. package/skills/remediate-code/SKILL.md +90 -0
  1474. package/skills/remediate-code/agents/openai.yaml +4 -0
  1475. package/skills/remediate-code/remediate-code.prompt.md +94 -0
  1476. package/templates/AGENTS.remediate-code.md +6 -0
@@ -0,0 +1,1229 @@
1
+ /**
2
+ * Contract-pipeline gate for ALL remediation starts (both paths).
3
+ *
4
+ * When intake is ready, next-step routes through the resumable
5
+ * contract_goal → context → design → critique → obligations → assessment →
6
+ * critic → judge → implementation DAG pipeline before producing an extracted
7
+ * plan that feeds the document/implement/close flow.
8
+ *
9
+ * Path A (structured audit-findings.json): a path_a_seed.json is written to
10
+ * the contract directory before the first phase step, so goal_normalization
11
+ * and context_collection prompts can reference the auditor findings directly.
12
+ * Path B (document/conversation): enters the pipeline directly from intake.
13
+ *
14
+ * Worker outputs are untrusted until validated: each invocation first ingests
15
+ * raw worker-written payloads into validated envelopes (recording dependency
16
+ * content hashes), then archives stale artifacts so the staleness DAG
17
+ * re-derives everything downstream of a repair. The adversarial critic →
18
+ * judge → repair loop lives across next-step invocations with its state in
19
+ * the contract artifacts plus repair-state.json; repairs are capped so a
20
+ * non-converging judge can never oscillate forever.
21
+ */
22
+ import { existsSync } from "node:fs";
23
+ import { mkdir, rename } from "node:fs/promises";
24
+ import { join } from "node:path";
25
+ import { writeJsonFile, readOptionalJsonFile, formatValidationIssues, isRecord, withFsRetry, } from "audit-tools/shared";
26
+ import { CP_ARTIFACT_NAMES, contractArtifactExists, contractArtifactFilePath, contractPipelineDir, detectStaleArtifacts, pathASeedFilePath, readContractArtifact, writeContractArtifact, } from "../contractPipeline/artifactStore.js";
27
+ import { detectCyclicSeamObligations, validateCycleBreak, } from "../contractPipeline/cyclicSeamResolution.js";
28
+ import { deriveObligationLedger, buildTestValidatorPlanScaffold, buildImplementationDagScaffold, acceptedCounterexampleIds, } from "../contractPipeline/derive.js";
29
+ import { ensureNodeId, toBlockId } from "../contractPipeline/idRegistry.js";
30
+ import { captureReviewSnapshot, computeReReviewDelta, isReviewArtifact, readReviewSnapshot, renderReReviewSection, reviewSnapshotExists, } from "../contractPipeline/reviewSnapshot.js";
31
+ import { renderContractPipelinePrompt, renderContractRepairPrompt, CONTRACT_PIPELINE_PHASE_ORDER, } from "./contractPipelinePrompts.js";
32
+ import { CONTRACT_PIPELINE_VALIDATORS, validateDesignSpecGates, validateGoalIdConsistency, validateImplementationDAGIntegrity, validatePairedObligations, validateEvidenceThreaded, validateDigestCoverage, validateReconciliationDerivation, deriveNodeModelTierFromNode, } from "../validation/contractPipeline.js";
33
+ import { writeCurrentStep } from "./stepWriter.js";
34
+ import { loaderCommand } from "./prompts.js";
35
+ import { intakePaths } from "../intake.js";
36
+ // ── Phase → artifact name mapping ─────────────────────────────────────────────
37
+ const PHASE_TO_ARTIFACT = {
38
+ goal_normalization: "goal_spec",
39
+ context_collection: "context_bundle",
40
+ decomposition: "module_decomposition",
41
+ module_contract_drafting: "module_contracts",
42
+ seam_reconciliation: "seam_reconciliation_report",
43
+ contract_finalization: "finalized_module_contracts",
44
+ critique: "conceptual_design_critique",
45
+ obligation_ledger: "obligation_ledger",
46
+ cyclic_seam_resolution: "cyclic_seam_resolution",
47
+ test_validator_plan: "test_validator_plan",
48
+ assessment: "contract_assessment_report",
49
+ critic: "counterexample",
50
+ judge: "judge_report",
51
+ implementation_planning: "implementation_dag",
52
+ closing: "verification_report",
53
+ };
54
+ /** Producing phase per artifact, for re-emitting a step after failed validation. */
55
+ const ARTIFACT_TO_PHASE = {
56
+ ...Object.fromEntries(Object.entries(PHASE_TO_ARTIFACT).map(([phase, artifact]) => [artifact, phase])),
57
+ };
58
+ // ── Phase → step kind mapping ──────────────────────────────────────────────────
59
+ const CONTRACT_STEP_KIND = "contract_pipeline";
60
+ const PRE_IMPLEMENTATION_PHASE_ORDER = CONTRACT_PIPELINE_PHASE_ORDER.filter((phase) => phase !== "closing");
61
+ // ── Bounded-loop caps ─────────────────────────────────────────────────────────
62
+ /**
63
+ * Maximum judge-ordered contract repairs per run. After the cap, the run
64
+ * proceeds to implementation planning with the unrepaired counterexamples
65
+ * carried as residual risks — an unbounded critic↔repair oscillation is the
66
+ * failure mode this exists to prevent.
67
+ */
68
+ export const MAX_CONTRACT_REPAIR_ITERATIONS = 2;
69
+ /** Maximum implementation_dag regenerations after traceability rejections. */
70
+ export const MAX_DAG_REGENERATION_ATTEMPTS = 2;
71
+ /**
72
+ * Maximum LLM cycle-break resolution attempts before routing to user-decision
73
+ * (and, if that also fails, to `blocked`).
74
+ */
75
+ export const MAX_CYCLIC_SEAM_RESOLUTION_ATTEMPTS = 2;
76
+ function repairStatePath(artifactsDir) {
77
+ return join(contractPipelineDir(artifactsDir), "repair-state.json");
78
+ }
79
+ async function readRepairState(artifactsDir) {
80
+ const state = await readOptionalJsonFile(repairStatePath(artifactsDir));
81
+ return (state ?? {
82
+ schema_version: "remediate-code-contract-pipeline/repair-state/v1alpha1",
83
+ repairs: [],
84
+ dag_regenerations: [],
85
+ });
86
+ }
87
+ async function writeRepairState(artifactsDir, state) {
88
+ await mkdir(contractPipelineDir(artifactsDir), { recursive: true });
89
+ await writeJsonFile(repairStatePath(artifactsDir), state);
90
+ }
91
+ function cyclicSeamRepairStatePath(artifactsDir) {
92
+ return join(contractPipelineDir(artifactsDir), "cyclic-seam-repair-state.json");
93
+ }
94
+ export async function readCyclicSeamRepairState(artifactsDir) {
95
+ const state = await readOptionalJsonFile(cyclicSeamRepairStatePath(artifactsDir));
96
+ return (state ?? {
97
+ schema_version: "remediate-code-contract-pipeline/cyclic-seam-repair-state/v1alpha1",
98
+ attempts: [],
99
+ user_decision_emitted: false,
100
+ });
101
+ }
102
+ export async function writeCyclicSeamRepairState(artifactsDir, state) {
103
+ await mkdir(contractPipelineDir(artifactsDir), { recursive: true });
104
+ await writeJsonFile(cyclicSeamRepairStatePath(artifactsDir), state);
105
+ }
106
+ // ── Envelope handling ─────────────────────────────────────────────────────────
107
+ function isEnvelope(value) {
108
+ return (isRecord(value) &&
109
+ typeof value.artifact_name === "string" &&
110
+ typeof value.content_hash === "string" &&
111
+ "payload" in value);
112
+ }
113
+ /** Payload of a stored artifact whether or not it has been enveloped yet. */
114
+ function envelopePayload(envelope) {
115
+ if (!envelope)
116
+ return undefined;
117
+ return isEnvelope(envelope) ? envelope.payload : envelope;
118
+ }
119
+ /**
120
+ * Render a pre-filled skeleton section (S3 scaffold) for the partially-derivable
121
+ * phases. The tool derives the structure/ids/cross-refs from the already-present
122
+ * obligation ledger and leaves only the judgment slots blank, so the worker fills
123
+ * sentences/commands rather than emitting a whole artifact from scratch. Returns
124
+ * undefined when there is nothing to scaffold (no testable obligations / no nodes).
125
+ */
126
+ async function buildScaffoldSection(phase, artifactsDir) {
127
+ const ledger = envelopePayload(await readContractArtifact(artifactsDir, "obligation_ledger"));
128
+ if (phase === "test_validator_plan") {
129
+ const scaffold = buildTestValidatorPlanScaffold(ledger);
130
+ if (scaffold.test_specs.length === 0)
131
+ return undefined;
132
+ const path = contractArtifactFilePath(artifactsDir, "test_validator_plan");
133
+ return `## Pre-filled Skeleton — fill only the blank slots
134
+
135
+ The obligation ledger was derived deterministically. Below is the test-plan skeleton: one spec per testable obligation, with \`obligation_id\`, \`name\`, and \`kind\` already filled. Fill ONLY each \`assertions\` array — every spec needs at least one positive (satisfied-path) assertion AND one negative (failure-path) assertion. Do not add, remove, or rename specs. If an obligation is genuinely untestable, replace its spec body with an \`inapplicable_claim\` citing its \`obligation_id\` and a falsifiable reason.
136
+
137
+ \`\`\`json
138
+ ${JSON.stringify(scaffold, null, 2)}
139
+ \`\`\`
140
+
141
+ Self-check before next-step: \`${loaderCommand(`validate-artifact --name test_validator_plan --file ${path}`)}\``;
142
+ }
143
+ if (phase === "implementation_planning") {
144
+ const judge = envelopePayload(await readContractArtifact(artifactsDir, "judge_report"));
145
+ const scaffold = buildImplementationDagScaffold(ledger, acceptedCounterexampleIds(judge));
146
+ if (scaffold.nodes.length === 0)
147
+ return undefined;
148
+ const path = contractArtifactFilePath(artifactsDir, "implementation_dag");
149
+ return `## Pre-filled Skeleton — fill only the blank slots
150
+
151
+ Below is the implementation-DAG skeleton: one node per obligation (covering every obligation and accepted counterexample). Fill ONLY each node's \`title\`, \`description\`, and \`targeted_commands\`. You MAY merge nodes that belong together and add real \`depends_on\`/\`edges\` ordering, as long as every obligation stays covered (in \`satisfies_obligations\` or \`verification_obligation_ids\`) and every accepted counterexample stays in some node's \`addresses_counterexamples\`.
152
+
153
+ \`\`\`json
154
+ ${JSON.stringify(scaffold, null, 2)}
155
+ \`\`\`
156
+
157
+ Self-check before next-step: \`${loaderCommand(`validate-artifact --name implementation_dag --file ${path}`)}\``;
158
+ }
159
+ return undefined;
160
+ }
161
+ /**
162
+ * Archive an artifact file into `<contract>/history/` instead of deleting it,
163
+ * so a repair loop never silently destroys an LLM output.
164
+ */
165
+ async function archiveContractArtifact(artifactsDir, name, label) {
166
+ const source = contractArtifactFilePath(artifactsDir, name);
167
+ if (!existsSync(source))
168
+ return;
169
+ const historyDir = join(contractPipelineDir(artifactsDir), "history");
170
+ await mkdir(historyDir, { recursive: true });
171
+ await withFsRetry(() => rename(source, join(historyDir, `${name}.${label}-${Date.now()}.json`)));
172
+ }
173
+ /**
174
+ * Wrap raw worker-written artifact payloads into validated envelopes. Workers
175
+ * write the bare payload the role schema describes; the envelope (content hash
176
+ * + dependency hashes) is the orchestrator's deterministic bookkeeping, added
177
+ * here. CP_ARTIFACT_NAMES is dependency-ordered, so dependencies are enveloped
178
+ * before their dependents and dependency hashes are always available.
179
+ */
180
+ export async function ingestContractArtifacts(artifactsDir) {
181
+ const ingested = [];
182
+ const invalid = [];
183
+ for (const name of CP_ARTIFACT_NAMES) {
184
+ const raw = await readOptionalJsonFile(contractArtifactFilePath(artifactsDir, name));
185
+ if (raw === undefined || raw === null || isEnvelope(raw))
186
+ continue;
187
+ const issues = CONTRACT_PIPELINE_VALIDATORS[name](raw, name).filter((issue) => issue.severity === "error");
188
+ if (issues.length > 0) {
189
+ invalid.push({ name, issues });
190
+ continue;
191
+ }
192
+ await writeContractArtifact(artifactsDir, name, raw);
193
+ ingested.push(name);
194
+ // Snapshot a freshly-produced review verdict + the upstreams it reviewed, so
195
+ // a later staleness re-emit can be diff-based (B2). No-op for non-review
196
+ // artifacts. Captured at ingest, when the upstreams are in the exact state
197
+ // the worker reviewed.
198
+ if (isReviewArtifact(name)) {
199
+ await captureReviewSnapshot(artifactsDir, name, raw, new Date().toISOString());
200
+ }
201
+ }
202
+ return { ingested, invalid };
203
+ }
204
+ /**
205
+ * Determine whether the contract pipeline should be entered for this run.
206
+ * The pipeline is entered for ALL intake source types (structured_audit,
207
+ * document, conversation) when an extracted-plan.json has not yet been
208
+ * produced. Path A (structured_audit) seeds the pipeline via a path_a_seed.json
209
+ * before the first phase step, so goal_normalization and context_collection
210
+ * prompts can reference the auditor findings.
211
+ */
212
+ export function shouldEnterContractPipeline(artifactsDir, _intakeSourceType) {
213
+ const paths = intakePaths(artifactsDir);
214
+ // If an extracted plan already exists, the pipeline has completed.
215
+ if (existsSync(paths.extractedPlan)) {
216
+ return { shouldHandleContractPipeline: false, pipelineComplete: true };
217
+ }
218
+ // Check whether the implementation_dag exists (pipeline complete, awaiting extraction).
219
+ if (contractArtifactExists(artifactsDir, "implementation_dag")) {
220
+ return { shouldHandleContractPipeline: true, pipelineComplete: true };
221
+ }
222
+ return { shouldHandleContractPipeline: true, pipelineComplete: false };
223
+ }
224
+ /** Return the first pipeline phase whose output artifact does not exist. */
225
+ export function nextMissingContractPhase(artifactsDir) {
226
+ for (const phase of PRE_IMPLEMENTATION_PHASE_ORDER) {
227
+ const artifactName = PHASE_TO_ARTIFACT[phase];
228
+ if (!artifactName)
229
+ continue;
230
+ if (!contractArtifactExists(artifactsDir, artifactName)) {
231
+ return phase;
232
+ }
233
+ }
234
+ return null;
235
+ }
236
+ /**
237
+ * Write a Path-A seed file from a parsed audit-findings report.
238
+ * The seed is written once (idempotent: skipped when it already exists).
239
+ * goal_normalization and context_collection prompts detect the seed and
240
+ * include its contents so every pipeline node traces to an auditor finding.
241
+ */
242
+ export async function writePathASeedFromFindings(artifactsDir, auditFindingsPath, auditFindings) {
243
+ const seedPath = pathASeedFilePath(artifactsDir);
244
+ if (existsSync(seedPath))
245
+ return; // idempotent
246
+ const findings = isRecord(auditFindings) && Array.isArray(auditFindings.findings)
247
+ ? auditFindings.findings
248
+ : [];
249
+ const affectedFilesSet = new Set();
250
+ const findingsSummary = [];
251
+ for (const f of findings) {
252
+ if (typeof f.id === "string" && typeof f.title === "string") {
253
+ findingsSummary.push({
254
+ id: f.id,
255
+ title: f.title,
256
+ lens: typeof f.lens === "string" ? f.lens : "correctness",
257
+ });
258
+ }
259
+ if (Array.isArray(f.affected_files)) {
260
+ for (const af of f.affected_files) {
261
+ if (typeof af.path === "string") {
262
+ affectedFilesSet.add(af.path);
263
+ }
264
+ }
265
+ }
266
+ }
267
+ const seed = {
268
+ schema_version: "remediate-code-contract-pipeline/path-a-seed/v1alpha1",
269
+ audit_findings_path: auditFindingsPath,
270
+ finding_count: findings.length,
271
+ findings_summary: findingsSummary,
272
+ affected_files: [...affectedFilesSet],
273
+ created_at: new Date().toISOString(),
274
+ };
275
+ await mkdir(contractPipelineDir(artifactsDir), { recursive: true });
276
+ await writeJsonFile(seedPath, seed);
277
+ }
278
+ /**
279
+ * Infer the most appropriate repair target from judge classifications when no
280
+ * explicit repair_directive is provided. Examines only accepted classifications
281
+ * and keyword-matches their rationale text.
282
+ *
283
+ * Priority (first match wins):
284
+ * obligation/ledger/invariant/constraint keywords → obligation_ledger
285
+ * assessment/finding/gap keywords → contract_assessment_report
286
+ * fallback → finalized_module_contracts
287
+ */
288
+ export function inferRepairTarget(classifications) {
289
+ const accepted = (classifications ?? []).filter((c) => c.classification === "accepted");
290
+ const text = accepted.map((c) => c.rationale).join(" ").toLowerCase();
291
+ if (/obligation|ledger|invariant violated|constraint/.test(text)) {
292
+ return "obligation_ledger";
293
+ }
294
+ if (/assessment|contract finding|gap identified/.test(text)) {
295
+ return "contract_assessment_report";
296
+ }
297
+ return "finalized_module_contracts";
298
+ }
299
+ function inferRepairDirective(judge) {
300
+ return {
301
+ target: inferRepairTarget(judge.classifications),
302
+ instruction: "Address every judge-accepted counterexample in the judge report's classifications.",
303
+ };
304
+ }
305
+ /**
306
+ * Decide whether implementation planning may proceed: an approved judge
307
+ * verdict proceeds; a failing verdict triggers one targeted repair per judge
308
+ * report, capped at MAX_CONTRACT_REPAIR_ITERATIONS — after the cap, the run
309
+ * proceeds with the unrepaired counterexamples recorded as residual risks.
310
+ */
311
+ async function evaluateJudgeGate(artifactsDir) {
312
+ const judgeEnvelope = await readContractArtifact(artifactsDir, "judge_report");
313
+ if (!judgeEnvelope)
314
+ return { kind: "proceed" };
315
+ const judge = envelopePayload(judgeEnvelope);
316
+ if (!judge || judge.verdict === "approved")
317
+ return { kind: "proceed" };
318
+ const repairState = await readRepairState(artifactsDir);
319
+ const judgeHash = judgeEnvelope.content_hash;
320
+ const alreadyHandled = repairState.repairs.some((repair) => repair.judge_hash === judgeHash);
321
+ if (!alreadyHandled && repairState.repairs.length >= MAX_CONTRACT_REPAIR_ITERATIONS) {
322
+ return {
323
+ kind: "proceed_residual",
324
+ note: `The judge verdict remains "needs_repair" after ${repairState.repairs.length} repair iteration(s) (the cap). Proceed anyway: treat every judge-accepted counterexample that remains unaddressed as a residual risk, and cover each one with an implementation or verification node.`,
325
+ };
326
+ }
327
+ // Map judge.repair_directive.target if present; if absent, infer from classifications.
328
+ const rawDirective = judge.repair_directive;
329
+ const directive = rawDirective
330
+ ? {
331
+ target: (rawDirective.target === "design_spec"
332
+ ? "finalized_module_contracts"
333
+ : rawDirective.target),
334
+ instruction: rawDirective.instruction,
335
+ }
336
+ : inferRepairDirective(judge);
337
+ return { kind: "repair", directive, judgeHash };
338
+ }
339
+ /**
340
+ * The traceability invariant: no implementation_dag node may exist without
341
+ * tracing to an obligation from the ledger (satisfies_obligations or
342
+ * verification_obligation_ids) or to a judge-accepted counterexample
343
+ * (addresses_counterexamples). Untraceable nodes are unattributable work — the
344
+ * exact thing the contract pipeline exists to prevent.
345
+ */
346
+ export async function validateImplementationDagTraceability(artifactsDir) {
347
+ const dag = envelopePayload(await readContractArtifact(artifactsDir, "implementation_dag"));
348
+ if (!dag) {
349
+ return { ok: false, violations: ["implementation_dag is missing."] };
350
+ }
351
+ const ledger = envelopePayload(await readContractArtifact(artifactsDir, "obligation_ledger"));
352
+ const judge = envelopePayload(await readContractArtifact(artifactsDir, "judge_report"));
353
+ const obligationIds = new Set((ledger?.obligations ?? []).map((obligation) => obligation.id));
354
+ const acceptedCounterexampleIds = new Set((judge?.classifications ?? [])
355
+ .filter((entry) => entry.classification === "accepted")
356
+ .map((entry) => entry.counterexample_id));
357
+ const violations = [];
358
+ const nodes = Array.isArray(dag.nodes) ? dag.nodes : [];
359
+ if (nodes.length === 0) {
360
+ violations.push("implementation_dag has no nodes; nothing would be implemented.");
361
+ }
362
+ for (const node of nodes) {
363
+ const tracedObligations = [
364
+ ...(node.satisfies_obligations ?? []),
365
+ ...(node.verification_obligation_ids ?? []),
366
+ ].filter((id) => obligationIds.has(id));
367
+ const tracedCounterexamples = (node.addresses_counterexamples ?? []).filter((id) => acceptedCounterexampleIds.has(id));
368
+ if (tracedObligations.length === 0 && tracedCounterexamples.length === 0) {
369
+ violations.push(`Node "${node.id}" traces to no obligation from the obligation ledger and no judge-accepted counterexample.`);
370
+ }
371
+ }
372
+ return { ok: violations.length === 0, violations };
373
+ }
374
+ /**
375
+ * Run the fail-closed contract-obligation gates against the persisted contract
376
+ * artifacts. Aggregates:
377
+ * - validatePairedObligations (obligation_ledger × test_validator_plan)
378
+ * - validateEvidenceThreaded (assessment × judge × implementation_dag)
379
+ * - validateDigestCoverage (goal_spec.source_type × finding-enumeration × ledger)
380
+ * - validateReconciliationDerivation (seam report × finalized contracts)
381
+ *
382
+ * Only error-severity issues fail the gate. Each gate is individually tolerant
383
+ * of an absent input artifact (the upstream phase order guarantees presence by
384
+ * the time this runs, except the source-scoped digest-coverage check which is
385
+ * vacuous for non-enumerable sources).
386
+ */
387
+ export async function evaluateContractObligationsPromotionGate(artifactsDir) {
388
+ const obligationLedger = envelopePayload(await readContractArtifact(artifactsDir, "obligation_ledger"));
389
+ const testValidatorPlan = envelopePayload(await readContractArtifact(artifactsDir, "test_validator_plan"));
390
+ const assessment = envelopePayload(await readContractArtifact(artifactsDir, "contract_assessment_report"));
391
+ const judge = envelopePayload(await readContractArtifact(artifactsDir, "judge_report"));
392
+ const dag = envelopePayload(await readContractArtifact(artifactsDir, "implementation_dag"));
393
+ const seamReport = envelopePayload(await readContractArtifact(artifactsDir, "seam_reconciliation_report"));
394
+ const finalizedContracts = envelopePayload(await readContractArtifact(artifactsDir, "finalized_module_contracts"));
395
+ const goalSpec = envelopePayload(await readContractArtifact(artifactsDir, "goal_spec"));
396
+ const sourceType = isRecord(goalSpec) && typeof goalSpec.source_type === "string"
397
+ ? goalSpec.source_type
398
+ : undefined;
399
+ const findingEnumeration = await readOptionalJsonFile(intakePaths(artifactsDir).findingEnumeration);
400
+ const issues = [
401
+ ...validatePairedObligations(obligationLedger, testValidatorPlan),
402
+ ...validateEvidenceThreaded(assessment, judge, dag),
403
+ ...validateDigestCoverage(sourceType, findingEnumeration, obligationLedger),
404
+ ...validateReconciliationDerivation(seamReport, finalizedContracts),
405
+ ].filter((issue) => issue.severity === "error");
406
+ return {
407
+ ok: issues.length === 0,
408
+ violations: issues.map((issue) => `[${issue.path}] ${issue.message}`),
409
+ };
410
+ }
411
+ /**
412
+ * Pre-adversarial structural floor (S5). The subset of the contract-obligation
413
+ * gates whose inputs all exist by the time the critic phase is reached
414
+ * (paired-obligation coverage, source-scoped digest coverage, and seam
415
+ * reconciliation derivation — none of which need the judge verdict or the
416
+ * implementation_dag). Running them BEFORE the expensive critic/judge loop means
417
+ * the adversarial phases only ever see structurally-sound obligations, tests, and
418
+ * contracts, and a structural gap is re-emitted to the precise responsible phase
419
+ * instead of being discovered at promotion (after the adversarial budget is spent)
420
+ * and re-emitted to the wrong phase. The full {@link evaluateContractObligationsPromotionGate}
421
+ * — including the evidence-threading check that needs the judge + DAG — still runs
422
+ * at promotion as the fail-closed backstop; this gate never replaces it.
423
+ *
424
+ * Returns the first failing gate's responsible phase + rendered error lines, or
425
+ * null when the structural floor is clean. Each underlying validator is tolerant
426
+ * of an absent input, so this is safe to call at the critic boundary.
427
+ */
428
+ export async function evaluatePreCriticStructuralGate(artifactsDir) {
429
+ const obligationLedger = envelopePayload(await readContractArtifact(artifactsDir, "obligation_ledger"));
430
+ const testValidatorPlan = envelopePayload(await readContractArtifact(artifactsDir, "test_validator_plan"));
431
+ const seamReport = envelopePayload(await readContractArtifact(artifactsDir, "seam_reconciliation_report"));
432
+ const finalizedContracts = envelopePayload(await readContractArtifact(artifactsDir, "finalized_module_contracts"));
433
+ const goalSpec = envelopePayload(await readContractArtifact(artifactsDir, "goal_spec"));
434
+ const sourceType = isRecord(goalSpec) && typeof goalSpec.source_type === "string"
435
+ ? goalSpec.source_type
436
+ : undefined;
437
+ const findingEnumeration = await readOptionalJsonFile(intakePaths(artifactsDir).findingEnumeration);
438
+ // Upstream-owned checks first: a derivation/coverage gap is fixed in the
439
+ // finalized contracts (the obligation ledger is derived from them).
440
+ const designErrors = [
441
+ ...validateReconciliationDerivation(seamReport, finalizedContracts),
442
+ ...validateDigestCoverage(sourceType, findingEnumeration, obligationLedger),
443
+ ].filter((issue) => issue.severity === "error");
444
+ if (designErrors.length > 0) {
445
+ return {
446
+ phase: "contract_finalization",
447
+ errorLines: designErrors.map((issue) => `- [${issue.path}] ${issue.message}`),
448
+ };
449
+ }
450
+ // A testable obligation without a paired spec is fixed in the test plan
451
+ // (skeleton-scaffolded from the derived ledger).
452
+ const testErrors = validatePairedObligations(obligationLedger, testValidatorPlan).filter((issue) => issue.severity === "error");
453
+ if (testErrors.length > 0) {
454
+ return {
455
+ phase: "test_validator_plan",
456
+ errorLines: testErrors.map((issue) => `- [${issue.path}] ${issue.message}`),
457
+ };
458
+ }
459
+ return null;
460
+ }
461
+ // ── Step builder ──────────────────────────────────────────────────────────────
462
+ /**
463
+ * Build and write the next contract-pipeline step.
464
+ * Returns null when the pipeline is complete and the extracted plan is ready.
465
+ */
466
+ export async function buildNextContractPipelineStep(options) {
467
+ const { root, artifactsDir, runId, sourcePaths } = options;
468
+ const cpDir = contractPipelineDir(artifactsDir);
469
+ const paths = intakePaths(artifactsDir);
470
+ // Detect the path-A seed file: present only for structured_audit runs.
471
+ const seedPath = pathASeedFilePath(artifactsDir);
472
+ const pathASeedPath = existsSync(seedPath) ? seedPath : undefined;
473
+ // Resolve artifact paths for the prompt renderers.
474
+ const artifactPaths = {};
475
+ for (const name of CP_ARTIFACT_NAMES) {
476
+ artifactPaths[name] = join(cpDir, `${name}.json`);
477
+ }
478
+ const buildStep = (params) => {
479
+ const nextCommand = loaderCommand("next-step");
480
+ const prompt = `${params.prompt}
481
+
482
+ After writing the output file, run:
483
+
484
+ \`${nextCommand}\`
485
+ `;
486
+ const stepArtifactPaths = {
487
+ output: params.outputPath,
488
+ };
489
+ for (const [k, v] of Object.entries(artifactPaths)) {
490
+ if (v && existsSync(v)) {
491
+ stepArtifactPaths[k] = v;
492
+ }
493
+ }
494
+ if (sourcePaths) {
495
+ stepArtifactPaths.source_manifest = paths.sourceManifest;
496
+ stepArtifactPaths.remediation_brief = paths.brief;
497
+ }
498
+ return writeCurrentStep({
499
+ stepKind: CONTRACT_STEP_KIND,
500
+ status: "ready",
501
+ runId,
502
+ repoRoot: root,
503
+ artifactsDir,
504
+ prompt,
505
+ allowedCommands: [nextCommand],
506
+ stopCondition: params.stopCondition,
507
+ artifactPaths: stepArtifactPaths,
508
+ });
509
+ };
510
+ const buildPhaseStep = (phase, extraSection) => {
511
+ const rendered = renderContractPipelinePrompt({
512
+ role: phase,
513
+ artifactPaths,
514
+ sourcePaths,
515
+ repoRoot: root,
516
+ pathASeedPath,
517
+ });
518
+ return buildStep({
519
+ prompt: extraSection ? `${rendered.prompt}\n${extraSection}` : rendered.prompt,
520
+ outputPath: rendered.outputPath,
521
+ stopCondition: `Stop after writing the contract-pipeline output for phase "${phase}" and running next-step.`,
522
+ });
523
+ };
524
+ const buildParallelModuleWaveStep = async (phase) => {
525
+ // For the parallel module phases, build a single step that notes the parallel
526
+ // wave nature. The actual wave dispatch is handled by the host reading the prompt.
527
+ // We emit a single agent step: the worker reads the module list and produces
528
+ // the aggregated artifact for all modules (since true parallel dispatch uses
529
+ // the waveScheduler from implement phase, not the contract pipeline).
530
+ // The prompt instructs the single agent to process all modules in sequence
531
+ // and emit the aggregated output — a pure contract-pipeline workaround for
532
+ // environments that do not support parallel sub-agents.
533
+ return buildPhaseStep(phase);
534
+ };
535
+ // 1. Ingest raw worker outputs into validated envelopes. An output that
536
+ // fails validation is archived and its producing phase re-emitted with
537
+ // the validation errors — LLM output is untrusted until validated.
538
+ const ingestion = await ingestContractArtifacts(artifactsDir);
539
+ if (ingestion.invalid.length > 0) {
540
+ const first = ingestion.invalid[0];
541
+ await archiveContractArtifact(artifactsDir, first.name, "invalid");
542
+ const phase = ARTIFACT_TO_PHASE[first.name] ?? "goal_normalization";
543
+ return buildPhaseStep(phase, `## Validation Errors From the Previous Attempt
544
+
545
+ The previous \`${first.name}\` output failed validation and was archived. Fix every issue below in the rewritten output:
546
+
547
+ ${formatValidationIssues(first.issues)}
548
+ `);
549
+ }
550
+ // 2. Archive stale artifacts so the staleness DAG re-derives everything
551
+ // downstream of a repaired (re-ingested) upstream artifact.
552
+ const staleness = await detectStaleArtifacts(artifactsDir);
553
+ for (const name of staleness.stale) {
554
+ await archiveContractArtifact(artifactsDir, name, "stale");
555
+ }
556
+ const nextPhase = nextMissingContractPhase(artifactsDir);
557
+ // 2.5. Goal-ID consistency gate (ARC-86b18f1b): every persisted artifact that
558
+ // carries a goal_id must agree on the same value. A mismatch means two
559
+ // runs were interleaved; re-emit the earliest mismatched phase so the
560
+ // worker can correct it.
561
+ {
562
+ const goalIdArtifacts = {};
563
+ for (const name of CP_ARTIFACT_NAMES) {
564
+ const env = await readContractArtifact(artifactsDir, name);
565
+ if (env)
566
+ goalIdArtifacts[name] = envelopePayload(env);
567
+ }
568
+ const goalIdIssues = validateGoalIdConsistency(goalIdArtifacts);
569
+ const goalIdErrors = goalIdIssues.filter((i) => i.severity === "error");
570
+ if (goalIdErrors.length > 0) {
571
+ // Re-emit the producing phase of the first mismatched artifact.
572
+ // issue.path is "<artifact_name>.goal_id"; extract the artifact name.
573
+ const firstPath = goalIdErrors[0]?.path ?? "";
574
+ const mismatchedArtifact = firstPath.replace(/\.goal_id$/, "");
575
+ const phase = ARTIFACT_TO_PHASE[mismatchedArtifact] ?? "goal_normalization";
576
+ await archiveContractArtifact(artifactsDir, mismatchedArtifact, "invalid");
577
+ return buildPhaseStep(phase, `## Goal-ID Consistency Error
578
+
579
+ Every contract-pipeline artifact must share the same goal_id. The following mismatch was detected:
580
+
581
+ ${goalIdErrors.map((i) => `- [${i.path}] ${i.message}`).join("\n")}
582
+
583
+ Rewrite the output so its goal_id matches the goal_id established in goal_spec.json.
584
+ `);
585
+ }
586
+ }
587
+ // 2.7. Deterministic artifact derivation (S1, contract-authoring determinism).
588
+ // The obligation ledger is a pure function of the finalized module
589
+ // contracts (every invariant/failure mode/module → an obligation), so it
590
+ // is generated by the tool rather than authored by an LLM phase: the
591
+ // structure can never be malformed, no judgment is spent on a mechanical
592
+ // restructuring, and a weak model is never asked to emit it from scratch.
593
+ // Mirrors the cyclic_seam no-cycles fast path — write the artifact, then
594
+ // re-derive the next phase.
595
+ if (nextPhase === "obligation_ledger") {
596
+ const finalizedPayload = envelopePayload(await readContractArtifact(artifactsDir, "finalized_module_contracts"));
597
+ const ledger = deriveObligationLedger(finalizedPayload);
598
+ await writeContractArtifact(artifactsDir, "obligation_ledger", ledger);
599
+ return buildNextContractPipelineStep(options);
600
+ }
601
+ // 3. Judge gate: implementation planning is reachable only through an
602
+ // approved verdict, a bounded targeted repair, or the repair cap.
603
+ if (nextPhase === "implementation_planning") {
604
+ const gate = await evaluateJudgeGate(artifactsDir);
605
+ if (gate.kind === "repair") {
606
+ const repairTarget = gate.directive.target;
607
+ const repairState = await readRepairState(artifactsDir);
608
+ if (!repairState.repairs.some((r) => r.judge_hash === gate.judgeHash)) {
609
+ repairState.repairs.push({
610
+ judge_hash: gate.judgeHash,
611
+ target: repairTarget,
612
+ at: new Date().toISOString(),
613
+ });
614
+ await writeRepairState(artifactsDir, repairState);
615
+ }
616
+ const rendered = renderContractRepairPrompt({
617
+ target: repairTarget,
618
+ instruction: gate.directive.instruction,
619
+ artifactPaths,
620
+ repoRoot: root,
621
+ });
622
+ return buildStep({
623
+ prompt: rendered.prompt,
624
+ outputPath: rendered.outputPath,
625
+ stopCondition: `Stop after rewriting "${repairTarget}" per the judge repair directive and running next-step.`,
626
+ });
627
+ }
628
+ if (gate.kind === "proceed_residual") {
629
+ return buildPhaseStep("implementation_planning", `## Repair Cap Reached — Residual Risks
630
+
631
+ ${gate.note}
632
+ `);
633
+ }
634
+ // gate.kind === "proceed": fall through to the normal phase step below.
635
+ }
636
+ // 4. All phases exist: enforce traceability + referential integrity, then
637
+ // convert the implementation_dag to an extracted plan.
638
+ if (!nextPhase) {
639
+ // 4a. DAG referential integrity + bidirectional coverage (ARC-86b18f1b-2).
640
+ // Run before the traceability check so specific referential violations
641
+ // are reported first (traceability is a superset check).
642
+ const dagPayload = envelopePayload(await readContractArtifact(artifactsDir, "implementation_dag"));
643
+ const ledgerPayload = envelopePayload(await readContractArtifact(artifactsDir, "obligation_ledger"));
644
+ const cePayload = envelopePayload(await readContractArtifact(artifactsDir, "counterexample"));
645
+ const judgePayload = envelopePayload(await readContractArtifact(artifactsDir, "judge_report"));
646
+ const integrityIssues = validateImplementationDAGIntegrity(dagPayload, ledgerPayload, cePayload, judgePayload);
647
+ const integrityErrors = integrityIssues.filter((i) => i.severity === "error");
648
+ if (integrityErrors.length > 0) {
649
+ const repairState = await readRepairState(artifactsDir);
650
+ if (repairState.dag_regenerations.length >= MAX_DAG_REGENERATION_ATTEMPTS) {
651
+ return writeCurrentStep({
652
+ stepKind: CONTRACT_STEP_KIND,
653
+ status: "blocked",
654
+ runId,
655
+ repoRoot: root,
656
+ artifactsDir,
657
+ prompt: `# Implementation DAG Failed Referential Integrity ${repairState.dag_regenerations.length + 1} Times
658
+
659
+ The implementation_dag repeatedly contains referential integrity or coverage violations:
660
+
661
+ ${integrityErrors.map((i) => `- [${i.path}] ${i.message}`).join("\n")}
662
+
663
+ Report this to the user and stop. The contract pipeline cannot promote a plan with integrity violations; the run needs a corrected implementation_dag or obligation_ledger.
664
+ `,
665
+ allowedCommands: [],
666
+ stopCondition: "Stop after reporting the integrity failure to the user.",
667
+ });
668
+ }
669
+ repairState.dag_regenerations.push({
670
+ violations: integrityErrors.map((i) => i.message),
671
+ at: new Date().toISOString(),
672
+ });
673
+ await writeRepairState(artifactsDir, repairState);
674
+ await archiveContractArtifact(artifactsDir, "implementation_dag", "invalid");
675
+ return buildPhaseStep("implementation_planning", `## Referential Integrity Errors From the Previous Attempt
676
+
677
+ The previous implementation_dag was rejected and archived due to referential integrity violations. Fix every issue below:
678
+
679
+ ${integrityErrors.map((i) => `- [${i.path}] ${i.message}`).join("\n")}
680
+ `);
681
+ }
682
+ const traceability = await validateImplementationDagTraceability(artifactsDir);
683
+ if (!traceability.ok) {
684
+ const repairState = await readRepairState(artifactsDir);
685
+ if (repairState.dag_regenerations.length >= MAX_DAG_REGENERATION_ATTEMPTS) {
686
+ return writeCurrentStep({
687
+ stepKind: CONTRACT_STEP_KIND,
688
+ status: "blocked",
689
+ runId,
690
+ repoRoot: root,
691
+ artifactsDir,
692
+ prompt: `# Implementation DAG Failed Traceability ${repairState.dag_regenerations.length + 1} Times
693
+
694
+ The implementation_dag repeatedly contains nodes that trace to no obligation and no judge-accepted counterexample:
695
+
696
+ ${traceability.violations.map((v) => `- ${v}`).join("\n")}
697
+
698
+ Report this to the user and stop. The contract pipeline cannot promote an untraceable plan; the run needs a corrected goal/design or manual intervention.
699
+ `,
700
+ allowedCommands: [],
701
+ stopCondition: "Stop after reporting the traceability failure to the user.",
702
+ });
703
+ }
704
+ repairState.dag_regenerations.push({
705
+ violations: traceability.violations,
706
+ at: new Date().toISOString(),
707
+ });
708
+ await writeRepairState(artifactsDir, repairState);
709
+ await archiveContractArtifact(artifactsDir, "implementation_dag", "invalid");
710
+ return buildPhaseStep("implementation_planning", `## Traceability Errors From the Previous Attempt
711
+
712
+ The previous implementation_dag was rejected and archived. Every node must trace to at least one obligation from the obligation ledger or one judge-accepted counterexample:
713
+
714
+ ${traceability.violations.map((v) => `- ${v}`).join("\n")}
715
+ `);
716
+ }
717
+ // 4c. Contract-obligations promotion gates (CP-BLOCK-N-contract-obligations):
718
+ // fail-closed cross-artifact checks that must pass before a plan is
719
+ // promoted — paired obligations, evidence threading, source-scoped
720
+ // digest coverage, and INV-CO-12 reconciliation derivation. Reuses the
721
+ // dag_regenerations cap: bounded re-emit of implementation_planning, then
722
+ // blocked. These are the invariants that keep the workflow correct
723
+ // regardless of host strength, so they are enforced here, never left to
724
+ // host discretion.
725
+ const obligationGate = await evaluateContractObligationsPromotionGate(artifactsDir);
726
+ if (!obligationGate.ok) {
727
+ const repairState = await readRepairState(artifactsDir);
728
+ if (repairState.dag_regenerations.length >= MAX_DAG_REGENERATION_ATTEMPTS) {
729
+ return writeCurrentStep({
730
+ stepKind: CONTRACT_STEP_KIND,
731
+ status: "blocked",
732
+ runId,
733
+ repoRoot: root,
734
+ artifactsDir,
735
+ prompt: `# Contract-Obligation Gates Failed ${repairState.dag_regenerations.length + 1} Times
736
+
737
+ The contract-obligation promotion gates repeatedly failed and the plan cannot be promoted:
738
+
739
+ ${obligationGate.violations.map((v) => `- ${v}`).join("\n")}
740
+
741
+ Report this to the user and stop. The contract pipeline cannot promote a plan that drops obligation coverage, evidence, or a reconciled seam; the run needs a corrected obligation_ledger, test_validator_plan, finalized_module_contracts, or implementation_dag.
742
+ `,
743
+ allowedCommands: [],
744
+ stopCondition: "Stop after reporting the contract-obligation gate failure to the user.",
745
+ });
746
+ }
747
+ repairState.dag_regenerations.push({
748
+ violations: obligationGate.violations,
749
+ at: new Date().toISOString(),
750
+ });
751
+ await writeRepairState(artifactsDir, repairState);
752
+ await archiveContractArtifact(artifactsDir, "implementation_dag", "invalid");
753
+ return buildPhaseStep("implementation_planning", `## Contract-Obligation Gate Errors From the Previous Attempt
754
+
755
+ The previous implementation_dag (and/or upstream contract artifacts) failed the fail-closed contract-obligation gates. Fix every issue below before the plan can be promoted:
756
+
757
+ ${obligationGate.violations.map((v) => `- ${v}`).join("\n")}
758
+ `);
759
+ }
760
+ await promoteImplementationDagToExtractedPlan(artifactsDir);
761
+ return null;
762
+ }
763
+ // 5a. Cyclic-seam resolution gate: runs after obligation_ledger is present and
764
+ // before assessment. Detects circular interface-definition obligations in
765
+ // the DAG of module contracts, then routes to an LLM resolution step when
766
+ // cycles are found. The resolution is re-checked by the same detector
767
+ // before being accepted. Cap: MAX_CYCLIC_SEAM_RESOLUTION_ATTEMPTS; on
768
+ // exhaustion, route to a user-decision step (then blocked if unresolved).
769
+ if (nextPhase === "cyclic_seam_resolution") {
770
+ const obligationLedgerPayload = envelopePayload(await readContractArtifact(artifactsDir, "obligation_ledger"));
771
+ // Build seam-obligation graph from obligation ledger: each obligation whose
772
+ // depends_on references other obligation IDs forms a seam-obligation node.
773
+ const obligationIds = new Set((obligationLedgerPayload?.obligations ?? []).map((o) => o.id));
774
+ const seamNodes = (obligationLedgerPayload?.obligations ?? []).map((obl) => ({
775
+ id: obl.id,
776
+ needs: (obl.depends_on ?? []).filter((dep) => obligationIds.has(dep)),
777
+ }));
778
+ const detectedCycles = detectCyclicSeamObligations(seamNodes);
779
+ const ledgerEnvelope = await readContractArtifact(artifactsDir, "obligation_ledger");
780
+ const ledgerHash = ledgerEnvelope?.content_hash ?? "unknown";
781
+ if (detectedCycles.length === 0) {
782
+ // No cycles — write the no_cycles artifact and let the pipeline proceed.
783
+ await writeContractArtifact(artifactsDir, "cyclic_seam_resolution", {
784
+ contract_version: "remediate-code-contract-pipeline/cyclic-seam-resolution/v1alpha1",
785
+ goal_id: obligationLedgerPayload?.goal_id ?? "",
786
+ cycles: [],
787
+ status: "no_cycles",
788
+ created_at: new Date().toISOString(),
789
+ });
790
+ // Re-derive next phase now that the artifact is written.
791
+ return buildNextContractPipelineStep(options);
792
+ }
793
+ // Cycles detected — check repair state.
794
+ const repairState = await readCyclicSeamRepairState(artifactsDir);
795
+ const attemptsForLedger = repairState.attempts.filter((a) => a.ledger_hash === ledgerHash);
796
+ // Check whether the existing cyclic_seam_resolution artifact (if any) has
797
+ // a re-check that passed — in that case the cycle is resolved; write the
798
+ // resolved artifact and proceed.
799
+ const existingResolution = envelopePayload(await readContractArtifact(artifactsDir, "cyclic_seam_resolution"));
800
+ if (existingResolution &&
801
+ (existingResolution.status === "resolved" ||
802
+ existingResolution.status === "no_cycles")) {
803
+ // The cyclic_seam_resolution artifact is already present and marked
804
+ // resolved/no_cycles — this branch should not normally be reached (the
805
+ // artifact exists so nextMissingContractPhase skips it), but guard anyway.
806
+ return buildNextContractPipelineStep(options);
807
+ }
808
+ if (attemptsForLedger.length >= MAX_CYCLIC_SEAM_RESOLUTION_ATTEMPTS &&
809
+ !repairState.user_decision_emitted) {
810
+ // Cap exhausted — emit user-decision step.
811
+ repairState.user_decision_emitted = true;
812
+ await writeCyclicSeamRepairState(artifactsDir, repairState);
813
+ const cycleDescriptions = detectedCycles
814
+ .map((c, i) => `Cycle ${i + 1}: [${c.members.join(", ")}]`)
815
+ .join("\n");
816
+ return writeCurrentStep({
817
+ stepKind: CONTRACT_STEP_KIND,
818
+ status: "blocked",
819
+ runId,
820
+ repoRoot: root,
821
+ artifactsDir,
822
+ prompt: `# Cyclic Seam Resolution — User Decision Required
823
+
824
+ The automatic cycle-break resolution reached its cap (${MAX_CYCLIC_SEAM_RESOLUTION_ATTEMPTS} attempt(s)) without producing a valid cycle-free obligation graph. The following obligation cycles remain unresolved:
825
+
826
+ ${cycleDescriptions}
827
+
828
+ **Choose one of the two sanctioned break strategies per cycle:**
829
+
830
+ 1. **Mediator module** — Introduce a third obligation/module that both sides depend on. The mediator owns the shared primitive; neither original module defines an interface for the other.
831
+ 2. **Single authority** — Designate one obligation/module as the definitive owner of the co-defined interface. The other becomes a consumer only. This is recorded as a named, scoped exception.
832
+
833
+ To proceed, manually rewrite \`${join(cpDir, "obligation_ledger.json")}\` so that no circular \`depends_on\` references exist, then delete \`${join(cpDir, "cyclic_seam_resolution.json")}\` and \`${cyclicSeamRepairStatePath(artifactsDir)}\` and re-run next-step.
834
+
835
+ If you choose to stop instead, this run will remain blocked.
836
+ `,
837
+ allowedCommands: [],
838
+ stopCondition: "Stop after presenting the user-decision prompt. Do not attempt further resolution.",
839
+ });
840
+ }
841
+ if (attemptsForLedger.length >= MAX_CYCLIC_SEAM_RESOLUTION_ATTEMPTS &&
842
+ repairState.user_decision_emitted) {
843
+ // User decision was emitted but cycles are still present — blocked.
844
+ const cycleDescriptions = detectedCycles
845
+ .map((c, i) => `Cycle ${i + 1}: [${c.members.join(", ")}]`)
846
+ .join("\n");
847
+ return writeCurrentStep({
848
+ stepKind: CONTRACT_STEP_KIND,
849
+ status: "blocked",
850
+ runId,
851
+ repoRoot: root,
852
+ artifactsDir,
853
+ prompt: `# Cyclic Seam Resolution — Blocked
854
+
855
+ Cycles in the obligation graph remain unresolved after the automatic cap and a user-decision step. The run cannot proceed without manual intervention.
856
+
857
+ ${cycleDescriptions}
858
+
859
+ Manually rewrite the obligation_ledger to remove circular depends_on references, delete the cyclic_seam_resolution artifact and cyclic-seam-repair-state.json, and re-run next-step.
860
+ `,
861
+ allowedCommands: [],
862
+ stopCondition: "Stop — the run is blocked on cyclic seam resolution.",
863
+ });
864
+ }
865
+ // Emit the LLM cyclic-seam-resolution step.
866
+ const cycleDescriptions = detectedCycles
867
+ .map((c, i) => `Cycle ${i + 1}: [${c.members.join(", ")}]`)
868
+ .join("\n");
869
+ const outputPath = join(cpDir, "cyclic_seam_resolution.json");
870
+ const nextCommand = loaderCommand("next-step");
871
+ repairState.attempts.push({
872
+ ledger_hash: ledgerHash,
873
+ at: new Date().toISOString(),
874
+ recheck_passed: false,
875
+ });
876
+ await writeCyclicSeamRepairState(artifactsDir, repairState);
877
+ return buildStep({
878
+ prompt: `# Cyclic Seam Resolution
879
+
880
+ Circular interface-definition obligations were detected in the obligation ledger. You must resolve every cycle using one of the two sanctioned strategies below, then write the resolution record.
881
+
882
+ ## Detected Cycles
883
+
884
+ ${cycleDescriptions}
885
+
886
+ ## Sanctioned Break Strategies
887
+
888
+ For each cycle, choose one:
889
+
890
+ 1. **Mediator module** — Introduce a third obligation/module that both sides depend on. The mediator owns the shared primitive; neither original module defines an interface for the other.
891
+ 2. **Single authority** — Designate one side as the definitive owner of the interface. The other becomes a consumer only. Record this as an explicit, scoped exception.
892
+
893
+ ## Required Inputs
894
+
895
+ - \`${join(cpDir, "obligation_ledger.json")}\` (obligation_ledger)
896
+
897
+ ## Your Task
898
+
899
+ Read the obligation_ledger. For each detected cycle, decide which break strategy to apply, verify mentally that the break does not re-introduce a cycle, then write the resolution record to exactly:
900
+
901
+ \`${outputPath}\`
902
+
903
+ \`\`\`json
904
+ {
905
+ "contract_version": "remediate-code-contract-pipeline/cyclic-seam-resolution/v1alpha1",
906
+ "goal_id": "<from obligation_ledger>",
907
+ "cycles": [
908
+ {
909
+ "members": ["<obligation-id>", "..."],
910
+ "break_strategy": "mediator | single_authority",
911
+ "resolution_description": "<what was changed and why>",
912
+ "exception_registration": "<if single_authority: the named scoped exception; otherwise null>"
913
+ }
914
+ ],
915
+ "status": "resolved",
916
+ "created_at": "<ISO-8601>"
917
+ }
918
+ \`\`\`
919
+
920
+ If after analysis you find the cycles are already broken (e.g. upon re-reading the ledger the depends_on edges do not actually form a cycle), set status to "no_cycles" and cycles to [].
921
+
922
+ **Stop after writing the output file.** Do not edit source files. Do not advance to the next pipeline step.
923
+
924
+ After writing the output file, run:
925
+
926
+ \`${nextCommand}\`
927
+ `,
928
+ outputPath,
929
+ stopCondition: 'Stop after writing the cyclic_seam_resolution output file and running next-step.',
930
+ });
931
+ }
932
+ // 5b. Cyclic-seam re-check: after the LLM writes the cyclic_seam_resolution
933
+ // artifact (status=resolved or no_cycles), verify the proposed break does
934
+ // not re-introduce a cycle. If it does, archive and re-emit the resolution
935
+ // step. This check runs as part of the ingestion/staleness pass — the
936
+ // artifact is validated structurally by the validator; here we run the
937
+ // graph re-check on the cycles array to confirm the break is sound.
938
+ // (Note: this pass runs only when cyclic_seam_resolution already exists
939
+ // and nextPhase is NOT cyclic_seam_resolution — i.e. the artifact was just
940
+ // ingested. We do a soft re-check here; if the break re-introduces a cycle,
941
+ // archive and loop back.)
942
+ {
943
+ const resolutionEnvelope = await readContractArtifact(artifactsDir, "cyclic_seam_resolution");
944
+ if (resolutionEnvelope) {
945
+ const resolution = envelopePayload(resolutionEnvelope);
946
+ if (resolution &&
947
+ resolution.status === "resolved" &&
948
+ Array.isArray(resolution.cycles) &&
949
+ resolution.cycles.length > 0) {
950
+ // Re-check: build the patched graph and verify no cycles remain.
951
+ const obligationLedgerPayload = envelopePayload(await readContractArtifact(artifactsDir, "obligation_ledger"));
952
+ const obligationIds = new Set((obligationLedgerPayload?.obligations ?? []).map((o) => o.id));
953
+ const seamNodes = (obligationLedgerPayload?.obligations ?? []).map((obl) => ({
954
+ id: obl.id,
955
+ needs: (obl.depends_on ?? []).filter((dep) => obligationIds.has(dep)),
956
+ }));
957
+ // For each cycle in the resolution, apply the stated break and re-check.
958
+ let recheckFailed = false;
959
+ for (const cycleRecord of resolution.cycles) {
960
+ if (!Array.isArray(cycleRecord.members))
961
+ continue;
962
+ const members = cycleRecord.members;
963
+ const mediatorId = cycleRecord.break_strategy === "mediator"
964
+ ? `_mediator_${members.join("_")}`
965
+ : null;
966
+ const validationResult = validateCycleBreak({ members }, seamNodes, mediatorId
967
+ ? { id: mediatorId, needs: [] }
968
+ : // single_authority: the designated owner keeps all edges;
969
+ // non-owner loses edges to cycle members — model as mediator=no-op.
970
+ { id: `_authority_${members.join("_")}`, needs: [] });
971
+ if (!validationResult.accepted) {
972
+ recheckFailed = true;
973
+ break;
974
+ }
975
+ }
976
+ if (recheckFailed) {
977
+ const ledgerEnvelope = await readContractArtifact(artifactsDir, "obligation_ledger");
978
+ const ledgerHash = ledgerEnvelope?.content_hash ?? "unknown";
979
+ const repairState = await readCyclicSeamRepairState(artifactsDir);
980
+ // Mark the last attempt as recheck_failed.
981
+ const last = repairState.attempts.at(-1);
982
+ if (last && last.ledger_hash === ledgerHash) {
983
+ last.recheck_passed = false;
984
+ }
985
+ await writeCyclicSeamRepairState(artifactsDir, repairState);
986
+ await archiveContractArtifact(artifactsDir, "cyclic_seam_resolution", "invalid");
987
+ // Re-enter to emit the next attempt or cap.
988
+ return buildNextContractPipelineStep(options);
989
+ }
990
+ }
991
+ }
992
+ }
993
+ // 5. Design-spec structural gates: run deterministic checks on the
994
+ // finalized_module_contracts (the "design" artifact) and obligation_ledger
995
+ // before emitting the adversarial critic phase. Error-severity gate failures
996
+ // re-emit the contract_finalization (design) phase so the worker can fix the
997
+ // structural issues before adversarial review begins. Warning-only results
998
+ // (e.g. circular obligation dependencies → N-R21) are appended as an
999
+ // advisory section to the critic prompt so the critic can take them into account.
1000
+ if (nextPhase === "critic") {
1001
+ // 5a. Design-spec structural gates on the finalized_module_contracts (the
1002
+ // "design" artifact) + obligation_ledger run first: a malformed design
1003
+ // artifact (error) re-emits the design phase, and a circular-obligation
1004
+ // dependency (warning) is appended to the critic prompt as advisory.
1005
+ const finalizedModuleContractsPayload = envelopePayload(await readContractArtifact(artifactsDir, "finalized_module_contracts"));
1006
+ const obligationLedgerPayload = envelopePayload(await readContractArtifact(artifactsDir, "obligation_ledger"));
1007
+ const gateIssues = validateDesignSpecGates(finalizedModuleContractsPayload, obligationLedgerPayload);
1008
+ const gateErrors = gateIssues.filter((issue) => issue.severity === "error");
1009
+ const gateWarnings = gateIssues.filter((issue) => issue.severity === "warning");
1010
+ if (gateErrors.length > 0) {
1011
+ // Re-emit the contract_finalization (design) phase with gate errors appended.
1012
+ const errorLines = gateErrors
1013
+ .map((issue) => `- [${issue.path}] ${issue.message}`)
1014
+ .join("\n");
1015
+ return buildPhaseStep("contract_finalization", `## Design Structural Gate Errors
1016
+
1017
+ The contract_finalization output failed deterministic structural gates. Fix every issue below before adversarial review can begin:
1018
+
1019
+ ${errorLines}
1020
+ `);
1021
+ }
1022
+ if (gateWarnings.length > 0) {
1023
+ const warningLines = gateWarnings
1024
+ .map((issue) => `- [${issue.path}] ${issue.message}`)
1025
+ .join("\n");
1026
+ return buildPhaseStep("critic", `## Advisory: Design Structural Warnings
1027
+
1028
+ The following structural issues were detected and should inform your adversarial review. They do not block the pipeline but may indicate areas of design fragility:
1029
+
1030
+ ${warningLines}
1031
+ `);
1032
+ }
1033
+ // 5b. Pre-adversarial structural floor (S5): once the design artifact itself
1034
+ // is clean, run the cheap cross-artifact checks whose inputs all exist by
1035
+ // the critic phase (paired-obligation coverage, source-scoped digest
1036
+ // coverage, seam reconciliation derivation) so the adversarial loop only
1037
+ // ever sees structurally-sound obligations/tests/contracts, and a gap is
1038
+ // re-emitted to the precise responsible phase instead of being discovered
1039
+ // at promotion after the adversarial budget is spent. evaluateContract
1040
+ // ObligationsPromotionGate stays the fail-closed backstop at promotion.
1041
+ const preCriticGate = await evaluatePreCriticStructuralGate(artifactsDir);
1042
+ if (preCriticGate) {
1043
+ return buildPhaseStep(preCriticGate.phase, `## Pre-Adversarial Structural Gate Errors
1044
+
1045
+ The ${preCriticGate.phase} output failed deterministic structural gates. Fix every issue below before adversarial review begins:
1046
+
1047
+ ${preCriticGate.errorLines.join("\n")}
1048
+ `);
1049
+ }
1050
+ }
1051
+ // Parallel-capable phases: module_contract_drafting and contract_finalization
1052
+ // both benefit from parallel per-module dispatch.
1053
+ if (nextPhase === "module_contract_drafting" || nextPhase === "contract_finalization") {
1054
+ return buildParallelModuleWaveStep(nextPhase);
1055
+ }
1056
+ // Skeleton-scaffolded phases (S3): the tool pre-fills structure/ids from the
1057
+ // derived obligation ledger so the worker fills only the judgment slots.
1058
+ if (nextPhase === "test_validator_plan" || nextPhase === "implementation_planning") {
1059
+ const scaffold = await buildScaffoldSection(nextPhase, artifactsDir);
1060
+ return buildPhaseStep(nextPhase, scaffold);
1061
+ }
1062
+ // Diff-based re-review (B2): when a verdict-bearing review phase is re-emitted
1063
+ // because an upstream changed, hand the worker its prior verdict + the precise
1064
+ // changed-since-last-review delta so it re-affirms cheaply or revises only the
1065
+ // affected items — never a blind full re-run. The section appears only when a
1066
+ // prior snapshot exists (i.e. this is a re-review, not first authoring).
1067
+ const reReviewSection = await buildReReviewSection(nextPhase, artifactsDir);
1068
+ return buildPhaseStep(nextPhase, reReviewSection);
1069
+ }
1070
+ /**
1071
+ * Build the diff-based re-review section for a review phase being re-emitted after
1072
+ * staleness, or undefined when this is not a re-review (non-review phase, or no
1073
+ * prior snapshot). See `reviewSnapshot.ts`.
1074
+ */
1075
+ async function buildReReviewSection(phase, artifactsDir) {
1076
+ const artifact = PHASE_TO_ARTIFACT[phase];
1077
+ if (!artifact || !isReviewArtifact(artifact))
1078
+ return undefined;
1079
+ if (!reviewSnapshotExists(artifactsDir, artifact))
1080
+ return undefined;
1081
+ const snapshot = await readReviewSnapshot(artifactsDir, artifact);
1082
+ if (!snapshot)
1083
+ return undefined;
1084
+ const delta = await computeReReviewDelta(artifactsDir, artifact, snapshot);
1085
+ return renderReReviewSection(artifact, snapshot, delta);
1086
+ }
1087
+ /** Priority order: higher index = higher priority (invariant is highest). */
1088
+ const OBLIGATION_KIND_PRIORITY = [
1089
+ "test",
1090
+ "structural",
1091
+ "behavioral",
1092
+ "invariant",
1093
+ ];
1094
+ function deriveObligationLensAndSeverity(kinds) {
1095
+ if (kinds.length === 0) {
1096
+ return { lens: "correctness", severity: "medium" };
1097
+ }
1098
+ // Pick the highest-priority kind.
1099
+ let topKind = kinds[0];
1100
+ for (const kind of kinds) {
1101
+ if (OBLIGATION_KIND_PRIORITY.indexOf(kind) >
1102
+ OBLIGATION_KIND_PRIORITY.indexOf(topKind)) {
1103
+ topKind = kind;
1104
+ }
1105
+ }
1106
+ const lensMap = {
1107
+ invariant: "security",
1108
+ behavioral: "correctness",
1109
+ structural: "architecture",
1110
+ test: "tests",
1111
+ };
1112
+ const severityMap = {
1113
+ invariant: "high",
1114
+ behavioral: "medium",
1115
+ structural: "low",
1116
+ test: "low",
1117
+ };
1118
+ return { lens: lensMap[topKind], severity: severityMap[topKind] };
1119
+ }
1120
+ /**
1121
+ * Convert a completed ImplementationDAG into the extracted-plan.json format
1122
+ * that the existing handlePendingExtractedPlan/applyPlanPipeline path consumes.
1123
+ */
1124
+ export async function promoteImplementationDagToExtractedPlan(artifactsDir) {
1125
+ const paths = intakePaths(artifactsDir);
1126
+ const dagEnvelope = await readContractArtifact(artifactsDir, "implementation_dag");
1127
+ if (!dagEnvelope)
1128
+ return;
1129
+ const dag = envelopePayload(dagEnvelope);
1130
+ // Load obligation_ledger for lens/severity derivation (graceful: may be absent).
1131
+ const ledgerPayload = envelopePayload(await readContractArtifact(artifactsDir, "obligation_ledger"));
1132
+ const obligationMap = new Map();
1133
+ if (ledgerPayload?.obligations) {
1134
+ for (const obl of ledgerPayload.obligations) {
1135
+ obligationMap.set(obl.id, obl.kind);
1136
+ }
1137
+ }
1138
+ const nodes = Array.isArray(dag?.nodes) ? dag.nodes : [];
1139
+ const findings = nodes.map((node, index) => {
1140
+ const id = ensureNodeId(node.id, index);
1141
+ const contractObligations = [...new Set(node.satisfies_obligations ?? [])];
1142
+ const verificationObligations = [
1143
+ ...new Set(node.verification_obligation_ids ?? []),
1144
+ ];
1145
+ const addressedCounterexamples = [
1146
+ ...new Set(node.addresses_counterexamples ?? []),
1147
+ ];
1148
+ const obligationEvidence = [
1149
+ ...contractObligations.map((obligationId) => `Satisfies contract obligation: ${obligationId}`),
1150
+ ...verificationObligations.map((obligationId) => `Verifies contract obligation: ${obligationId}`),
1151
+ ...addressedCounterexamples.map((counterexampleId) => `Addresses accepted counterexample: ${counterexampleId}`),
1152
+ ];
1153
+ // Derive lens and severity from obligation kinds; fall back when ledger absent.
1154
+ const satisfiedKinds = contractObligations
1155
+ .map((id) => obligationMap.get(id))
1156
+ .filter((k) => k !== undefined);
1157
+ const { lens, severity } = deriveObligationLensAndSeverity(satisfiedKinds);
1158
+ return {
1159
+ id,
1160
+ title: node.title ?? node.description ?? `Contract-pipeline task ${index + 1}`,
1161
+ category: "General",
1162
+ severity,
1163
+ confidence: "high",
1164
+ lens,
1165
+ summary: node.description ?? node.title ?? "",
1166
+ // output_files (declared write scope) takes priority over files_likely_touched.
1167
+ // Map each path to the { path } shape that Finding.affected_files expects.
1168
+ affected_files: (node.output_files ?? node.files_likely_touched ?? []).map((p) => ({ path: p })),
1169
+ evidence: obligationEvidence.length > 0
1170
+ ? obligationEvidence
1171
+ : [node.description ?? node.title ?? `Contract-pipeline task ${id}`],
1172
+ concrete_change: node.description ?? "",
1173
+ contract_goal_id: dag?.goal_id,
1174
+ contract_obligation_ids: contractObligations,
1175
+ verification_obligation_ids: verificationObligations,
1176
+ addresses_counterexamples: addressedCounterexamples,
1177
+ // Relative model rank for this node (small | standard | deep) derived from
1178
+ // complexity — never a model name (no-hardcoded-models invariant).
1179
+ model_tier: deriveNodeModelTierFromNode(node),
1180
+ targeted_commands: node.targeted_commands ?? [],
1181
+ preconditions: node.preconditions ?? [],
1182
+ expected_changes: node.expected_changes ?? "",
1183
+ };
1184
+ });
1185
+ // finding_id → { obligation_ids, node_ids } trace. Each promoted finding maps
1186
+ // 1:1 to a DAG node, so its node_ids are itself plus every node it depends on
1187
+ // (the upstream nodes whose output it builds on). obligation_ids unions the
1188
+ // satisfied and verification obligations. This is the auditable backward trace
1189
+ // from a remediation finding to the contract obligations it discharges.
1190
+ const nodeIdSet = new Set(nodes.map((n, i) => ensureNodeId(n.id, i)));
1191
+ const traceability = {};
1192
+ for (const [index, node] of nodes.entries()) {
1193
+ const id = ensureNodeId(node.id, index);
1194
+ const obligationIds = [
1195
+ ...new Set([
1196
+ ...(node.satisfies_obligations ?? []),
1197
+ ...(node.verification_obligation_ids ?? []),
1198
+ ]),
1199
+ ];
1200
+ const dependsOn = (node.depends_on ?? []).filter((dep) => nodeIdSet.has(dep));
1201
+ const nodeIds = [...new Set([id, ...dependsOn])];
1202
+ traceability[id] = { obligation_ids: obligationIds, node_ids: nodeIds };
1203
+ }
1204
+ const blocks = nodes.map((node, index) => {
1205
+ const nodeId = ensureNodeId(node.id, index);
1206
+ const deps = (node.depends_on ?? []).map((depId) => toBlockId(depId));
1207
+ return {
1208
+ block_id: toBlockId(nodeId),
1209
+ items: [nodeId],
1210
+ // INV-remediate-pipeline-02: a block with prerequisites is never
1211
+ // wave-dispatched as independent — parallel_safe derives from depends_on.
1212
+ parallel_safe: deps.length === 0,
1213
+ dependencies: deps,
1214
+ };
1215
+ });
1216
+ const extractedPlan = {
1217
+ plan_id: dag?.goal_id ?? `CP-PLAN-${Date.now()}`,
1218
+ goal_id: dag?.goal_id,
1219
+ findings,
1220
+ blocks,
1221
+ // finding_id → { obligation_ids, node_ids } backward trace.
1222
+ traceability,
1223
+ project_type: "unknown",
1224
+ candidate_closing_actions: ["none"],
1225
+ source: "contract_pipeline",
1226
+ };
1227
+ await writeJsonFile(paths.extractedPlan, extractedPlan);
1228
+ }
1229
+ //# sourceMappingURL=contractPipeline.js.map