@backendkit-labs/agent-coding 0.28.5 → 0.30.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 (466) hide show
  1. package/README.md +4 -0
  2. package/dist/__tests__/cli-baseline.test.d.ts +2 -0
  3. package/dist/__tests__/cli-baseline.test.d.ts.map +1 -0
  4. package/dist/__tests__/cli-baseline.test.js +114 -0
  5. package/dist/__tests__/cli-baseline.test.js.map +1 -0
  6. package/dist/__tests__/context-hooks.test.d.ts +2 -0
  7. package/dist/__tests__/context-hooks.test.d.ts.map +1 -0
  8. package/dist/__tests__/context-hooks.test.js +21 -0
  9. package/dist/__tests__/context-hooks.test.js.map +1 -0
  10. package/dist/__tests__/createCodingEngine.forwarding.test.js +2 -1
  11. package/dist/__tests__/createCodingEngine.forwarding.test.js.map +1 -1
  12. package/dist/__tests__/sandbox.test.js +1 -1
  13. package/dist/__tests__/sandbox.test.js.map +1 -1
  14. package/dist/__tests__/workspace-trust.test.js +7 -5
  15. package/dist/__tests__/workspace-trust.test.js.map +1 -1
  16. package/dist/agents/AgentLoader.d.ts.map +1 -1
  17. package/dist/agents/AgentLoader.js +2 -1
  18. package/dist/agents/AgentLoader.js.map +1 -1
  19. package/dist/cli/agent-discovery/AgentPackageLoader.d.ts +22 -0
  20. package/dist/cli/agent-discovery/AgentPackageLoader.d.ts.map +1 -0
  21. package/dist/cli/agent-discovery/AgentPackageLoader.js +100 -0
  22. package/dist/cli/agent-discovery/AgentPackageLoader.js.map +1 -0
  23. package/dist/cli/agent-discovery/RemoteAgentRegistry.d.ts +31 -0
  24. package/dist/cli/agent-discovery/RemoteAgentRegistry.d.ts.map +1 -0
  25. package/dist/cli/agent-discovery/RemoteAgentRegistry.js +106 -0
  26. package/dist/cli/agent-discovery/RemoteAgentRegistry.js.map +1 -0
  27. package/dist/cli/agent-discovery/__tests__/RemoteAgentRegistry.ssrf.test.d.ts +2 -0
  28. package/dist/cli/agent-discovery/__tests__/RemoteAgentRegistry.ssrf.test.d.ts.map +1 -0
  29. package/dist/cli/agent-discovery/__tests__/RemoteAgentRegistry.ssrf.test.js +34 -0
  30. package/dist/cli/agent-discovery/__tests__/RemoteAgentRegistry.ssrf.test.js.map +1 -0
  31. package/dist/cli/agent-discovery/__tests__/discoverAgents.test.d.ts +2 -0
  32. package/dist/cli/agent-discovery/__tests__/discoverAgents.test.d.ts.map +1 -0
  33. package/dist/cli/agent-discovery/__tests__/discoverAgents.test.js +147 -0
  34. package/dist/cli/agent-discovery/__tests__/discoverAgents.test.js.map +1 -0
  35. package/dist/cli/agent-discovery/__tests__/download-guard.test.d.ts +2 -0
  36. package/dist/cli/agent-discovery/__tests__/download-guard.test.d.ts.map +1 -0
  37. package/dist/cli/agent-discovery/__tests__/download-guard.test.js +47 -0
  38. package/dist/cli/agent-discovery/__tests__/download-guard.test.js.map +1 -0
  39. package/dist/cli/agent-discovery/discoverAgents.d.ts +21 -0
  40. package/dist/cli/agent-discovery/discoverAgents.d.ts.map +1 -0
  41. package/dist/cli/agent-discovery/discoverAgents.js +74 -0
  42. package/dist/cli/agent-discovery/discoverAgents.js.map +1 -0
  43. package/dist/cli/agent-discovery/download-guard.d.ts +20 -0
  44. package/dist/cli/agent-discovery/download-guard.d.ts.map +1 -0
  45. package/dist/cli/agent-discovery/download-guard.js +84 -0
  46. package/dist/cli/agent-discovery/download-guard.js.map +1 -0
  47. package/dist/cli/agent-discovery/index.d.ts +5 -0
  48. package/dist/cli/agent-discovery/index.d.ts.map +1 -0
  49. package/dist/cli/agent-discovery/index.js +12 -0
  50. package/dist/cli/agent-discovery/index.js.map +1 -0
  51. package/dist/cli/agent-discovery/types.d.ts +48 -0
  52. package/dist/cli/agent-discovery/types.d.ts.map +1 -0
  53. package/dist/cli/agent-discovery/types.js +3 -0
  54. package/dist/cli/agent-discovery/types.js.map +1 -0
  55. package/dist/cli/bootstrap/GlobalSeed.d.ts +46 -0
  56. package/dist/cli/bootstrap/GlobalSeed.d.ts.map +1 -0
  57. package/dist/cli/bootstrap/GlobalSeed.js +285 -0
  58. package/dist/cli/bootstrap/GlobalSeed.js.map +1 -0
  59. package/dist/cli/bootstrap/config.d.ts +24 -0
  60. package/dist/cli/bootstrap/config.d.ts.map +1 -0
  61. package/dist/cli/bootstrap/config.js +71 -0
  62. package/dist/cli/bootstrap/config.js.map +1 -0
  63. package/dist/cli/checkpoint/index.d.ts +17 -0
  64. package/dist/cli/checkpoint/index.d.ts.map +1 -0
  65. package/dist/cli/checkpoint/index.js +207 -0
  66. package/dist/cli/checkpoint/index.js.map +1 -0
  67. package/dist/cli/commands/builtin.d.ts +7 -0
  68. package/dist/cli/commands/builtin.d.ts.map +1 -0
  69. package/dist/cli/commands/builtin.js +962 -0
  70. package/dist/cli/commands/builtin.js.map +1 -0
  71. package/dist/cli/context/__tests__/formatPipeline.test.d.ts +2 -0
  72. package/dist/cli/context/__tests__/formatPipeline.test.d.ts.map +1 -0
  73. package/dist/cli/context/__tests__/formatPipeline.test.js +25 -0
  74. package/dist/cli/context/__tests__/formatPipeline.test.js.map +1 -0
  75. package/dist/cli/context/index.d.ts +8 -0
  76. package/dist/cli/context/index.d.ts.map +1 -0
  77. package/dist/cli/context/index.js +8 -0
  78. package/dist/cli/context/index.js.map +1 -0
  79. package/dist/cli/context/pipeline.d.ts +46 -0
  80. package/dist/cli/context/pipeline.d.ts.map +1 -0
  81. package/dist/cli/context/pipeline.js +112 -0
  82. package/dist/cli/context/pipeline.js.map +1 -0
  83. package/dist/cli/context/stages/stage-instructions.d.ts +12 -0
  84. package/dist/cli/context/stages/stage-instructions.d.ts.map +1 -0
  85. package/dist/cli/context/stages/stage-instructions.js +76 -0
  86. package/dist/cli/context/stages/stage-instructions.js.map +1 -0
  87. package/dist/cli/context/stages/stage-lessons.d.ts +13 -0
  88. package/dist/cli/context/stages/stage-lessons.d.ts.map +1 -0
  89. package/dist/cli/context/stages/stage-lessons.js +83 -0
  90. package/dist/cli/context/stages/stage-lessons.js.map +1 -0
  91. package/dist/cli/context/stages/stage-manifest.d.ts +11 -0
  92. package/dist/cli/context/stages/stage-manifest.d.ts.map +1 -0
  93. package/dist/cli/context/stages/stage-manifest.js +62 -0
  94. package/dist/cli/context/stages/stage-manifest.js.map +1 -0
  95. package/dist/cli/context/stages/stage-project.d.ts +10 -0
  96. package/dist/cli/context/stages/stage-project.d.ts.map +1 -0
  97. package/dist/cli/context/stages/stage-project.js +55 -0
  98. package/dist/cli/context/stages/stage-project.js.map +1 -0
  99. package/dist/cli/context/stages/stage-session.d.ts +12 -0
  100. package/dist/cli/context/stages/stage-session.d.ts.map +1 -0
  101. package/dist/cli/context/stages/stage-session.js +69 -0
  102. package/dist/cli/context/stages/stage-session.js.map +1 -0
  103. package/dist/cli/file-sources.d.ts +17 -0
  104. package/dist/cli/file-sources.d.ts.map +1 -0
  105. package/dist/cli/file-sources.js +42 -0
  106. package/dist/cli/file-sources.js.map +1 -0
  107. package/dist/cli/index.d.ts +26 -0
  108. package/dist/cli/index.d.ts.map +1 -0
  109. package/dist/cli/index.js +55 -0
  110. package/dist/cli/index.js.map +1 -0
  111. package/dist/cli/skills/__tests__/SkillLoader.test.d.ts +2 -0
  112. package/dist/cli/skills/__tests__/SkillLoader.test.d.ts.map +1 -0
  113. package/dist/cli/skills/__tests__/SkillLoader.test.js +285 -0
  114. package/dist/cli/skills/__tests__/SkillLoader.test.js.map +1 -0
  115. package/dist/cli/skills/__tests__/SkillManager.safety.test.d.ts +2 -0
  116. package/dist/cli/skills/__tests__/SkillManager.safety.test.d.ts.map +1 -0
  117. package/dist/cli/skills/__tests__/SkillManager.safety.test.js +87 -0
  118. package/dist/cli/skills/__tests__/SkillManager.safety.test.js.map +1 -0
  119. package/dist/cli/skills/__tests__/stack.test.d.ts +2 -0
  120. package/dist/cli/skills/__tests__/stack.test.d.ts.map +1 -0
  121. package/dist/cli/skills/__tests__/stack.test.js +81 -0
  122. package/dist/cli/skills/__tests__/stack.test.js.map +1 -0
  123. package/dist/cli/skills/loader.d.ts +42 -0
  124. package/dist/cli/skills/loader.d.ts.map +1 -0
  125. package/dist/cli/skills/loader.js +158 -0
  126. package/dist/cli/skills/loader.js.map +1 -0
  127. package/dist/cli/skills/manager.d.ts +97 -0
  128. package/dist/cli/skills/manager.d.ts.map +1 -0
  129. package/dist/cli/skills/manager.js +304 -0
  130. package/dist/cli/skills/manager.js.map +1 -0
  131. package/dist/cli/skills/parse-md-skill.d.ts +14 -0
  132. package/dist/cli/skills/parse-md-skill.d.ts.map +1 -0
  133. package/dist/cli/skills/parse-md-skill.js +86 -0
  134. package/dist/cli/skills/parse-md-skill.js.map +1 -0
  135. package/dist/cli/skills/providers/github.d.ts +21 -0
  136. package/dist/cli/skills/providers/github.d.ts.map +1 -0
  137. package/dist/cli/skills/providers/github.js +146 -0
  138. package/dist/cli/skills/providers/github.js.map +1 -0
  139. package/dist/cli/skills/providers/index.d.ts +6 -0
  140. package/dist/cli/skills/providers/index.d.ts.map +1 -0
  141. package/dist/cli/skills/providers/index.js +12 -0
  142. package/dist/cli/skills/providers/index.js.map +1 -0
  143. package/dist/cli/skills/providers/local.d.ts +16 -0
  144. package/dist/cli/skills/providers/local.d.ts.map +1 -0
  145. package/dist/cli/skills/providers/local.js +91 -0
  146. package/dist/cli/skills/providers/local.js.map +1 -0
  147. package/dist/cli/skills/providers/obsidian.d.ts +31 -0
  148. package/dist/cli/skills/providers/obsidian.d.ts.map +1 -0
  149. package/dist/cli/skills/providers/obsidian.js +141 -0
  150. package/dist/cli/skills/providers/obsidian.js.map +1 -0
  151. package/dist/cli/skills/providers/skills-sh.d.ts +32 -0
  152. package/dist/cli/skills/providers/skills-sh.d.ts.map +1 -0
  153. package/dist/cli/skills/providers/skills-sh.js +53 -0
  154. package/dist/cli/skills/providers/skills-sh.js.map +1 -0
  155. package/dist/cli/skills/providers/types.d.ts +25 -0
  156. package/dist/cli/skills/providers/types.d.ts.map +1 -0
  157. package/dist/cli/skills/providers/types.js +3 -0
  158. package/dist/cli/skills/providers/types.js.map +1 -0
  159. package/dist/cli/skills/safe-name.d.ts +2 -0
  160. package/dist/cli/skills/safe-name.d.ts.map +1 -0
  161. package/dist/cli/skills/safe-name.js +22 -0
  162. package/dist/cli/skills/safe-name.js.map +1 -0
  163. package/dist/cli/skills/stack.d.ts +3 -0
  164. package/dist/cli/skills/stack.d.ts.map +1 -0
  165. package/dist/cli/skills/stack.js +64 -0
  166. package/dist/cli/skills/stack.js.map +1 -0
  167. package/dist/cli/skills/types.d.ts +28 -0
  168. package/dist/cli/skills/types.d.ts.map +1 -0
  169. package/dist/cli/skills/types.js +3 -0
  170. package/dist/cli/skills/types.js.map +1 -0
  171. package/dist/cli/trust/__tests__/workspace-trust.test.d.ts +2 -0
  172. package/dist/cli/trust/__tests__/workspace-trust.test.d.ts.map +1 -0
  173. package/dist/cli/trust/__tests__/workspace-trust.test.js +252 -0
  174. package/dist/cli/trust/__tests__/workspace-trust.test.js.map +1 -0
  175. package/dist/cli/trust/workspace-trust.d.ts +49 -0
  176. package/dist/cli/trust/workspace-trust.d.ts.map +1 -0
  177. package/dist/cli/trust/workspace-trust.js +163 -0
  178. package/dist/cli/trust/workspace-trust.js.map +1 -0
  179. package/dist/cli/workspace/index.d.ts +68 -0
  180. package/dist/cli/workspace/index.d.ts.map +1 -0
  181. package/dist/cli/workspace/index.js +231 -0
  182. package/dist/cli/workspace/index.js.map +1 -0
  183. package/dist/context-hooks.d.ts +11 -0
  184. package/dist/context-hooks.d.ts.map +1 -0
  185. package/dist/context-hooks.js +23 -0
  186. package/dist/context-hooks.js.map +1 -0
  187. package/dist/context-services.d.ts +12 -0
  188. package/dist/context-services.d.ts.map +1 -0
  189. package/dist/context-services.js +20 -0
  190. package/dist/context-services.js.map +1 -0
  191. package/dist/index.d.ts +5 -1
  192. package/dist/index.d.ts.map +1 -1
  193. package/dist/index.js +26 -12
  194. package/dist/index.js.map +1 -1
  195. package/dist/orchestration/capability-matrix.d.ts +1 -1
  196. package/dist/orchestration/capability-matrix.d.ts.map +1 -1
  197. package/dist/pipeline/__tests__/AgentEngine.orchestratorFailure.test.d.ts +2 -0
  198. package/dist/pipeline/__tests__/AgentEngine.orchestratorFailure.test.d.ts.map +1 -0
  199. package/dist/pipeline/__tests__/AgentEngine.orchestratorFailure.test.js +42 -0
  200. package/dist/pipeline/__tests__/AgentEngine.orchestratorFailure.test.js.map +1 -0
  201. package/dist/pipeline/__tests__/coding-pipeline-hooks.test.d.ts +2 -0
  202. package/dist/pipeline/__tests__/coding-pipeline-hooks.test.d.ts.map +1 -0
  203. package/dist/pipeline/__tests__/coding-pipeline-hooks.test.js +64 -0
  204. package/dist/pipeline/__tests__/coding-pipeline-hooks.test.js.map +1 -0
  205. package/dist/pipeline/__tests__/engine-brief.test.d.ts +2 -0
  206. package/dist/pipeline/__tests__/engine-brief.test.d.ts.map +1 -0
  207. package/dist/pipeline/__tests__/engine-brief.test.js +159 -0
  208. package/dist/pipeline/__tests__/engine-brief.test.js.map +1 -0
  209. package/dist/pipeline/__tests__/qa-orchestrator.test.d.ts +2 -0
  210. package/dist/pipeline/__tests__/qa-orchestrator.test.d.ts.map +1 -0
  211. package/dist/pipeline/__tests__/qa-orchestrator.test.js +276 -0
  212. package/dist/pipeline/__tests__/qa-orchestrator.test.js.map +1 -0
  213. package/dist/pipeline/coding-pipeline-hooks.d.ts +28 -0
  214. package/dist/pipeline/coding-pipeline-hooks.d.ts.map +1 -0
  215. package/dist/pipeline/coding-pipeline-hooks.js +91 -0
  216. package/dist/pipeline/coding-pipeline-hooks.js.map +1 -0
  217. package/dist/pipeline/index.d.ts +13 -0
  218. package/dist/pipeline/index.d.ts.map +1 -0
  219. package/dist/pipeline/index.js +44 -0
  220. package/dist/pipeline/index.js.map +1 -0
  221. package/dist/pipeline/orchestration/__tests__/agent-id-consistency.test.d.ts +11 -0
  222. package/dist/pipeline/orchestration/__tests__/agent-id-consistency.test.d.ts.map +1 -0
  223. package/dist/pipeline/orchestration/__tests__/agent-id-consistency.test.js +105 -0
  224. package/dist/pipeline/orchestration/__tests__/agent-id-consistency.test.js.map +1 -0
  225. package/dist/pipeline/orchestration/__tests__/fsm-commit-skipped.test.d.ts +2 -0
  226. package/dist/pipeline/orchestration/__tests__/fsm-commit-skipped.test.d.ts.map +1 -0
  227. package/dist/pipeline/orchestration/__tests__/fsm-commit-skipped.test.js +21 -0
  228. package/dist/pipeline/orchestration/__tests__/fsm-commit-skipped.test.js.map +1 -0
  229. package/dist/pipeline/orchestration/__tests__/fsm-critical-path.test.d.ts +9 -0
  230. package/dist/pipeline/orchestration/__tests__/fsm-critical-path.test.d.ts.map +1 -0
  231. package/dist/pipeline/orchestration/__tests__/fsm-critical-path.test.js +101 -0
  232. package/dist/pipeline/orchestration/__tests__/fsm-critical-path.test.js.map +1 -0
  233. package/dist/pipeline/orchestration/__tests__/fsm-rework-and-regression.test.d.ts +2 -0
  234. package/dist/pipeline/orchestration/__tests__/fsm-rework-and-regression.test.d.ts.map +1 -0
  235. package/dist/pipeline/orchestration/__tests__/fsm-rework-and-regression.test.js +54 -0
  236. package/dist/pipeline/orchestration/__tests__/fsm-rework-and-regression.test.js.map +1 -0
  237. package/dist/pipeline/orchestration/__tests__/intent-detector-llm.test.d.ts +2 -0
  238. package/dist/pipeline/orchestration/__tests__/intent-detector-llm.test.d.ts.map +1 -0
  239. package/dist/pipeline/orchestration/__tests__/intent-detector-llm.test.js +57 -0
  240. package/dist/pipeline/orchestration/__tests__/intent-detector-llm.test.js.map +1 -0
  241. package/dist/pipeline/orchestration/__tests__/intent-detector-scores.test.d.ts +9 -0
  242. package/dist/pipeline/orchestration/__tests__/intent-detector-scores.test.d.ts.map +1 -0
  243. package/dist/pipeline/orchestration/__tests__/intent-detector-scores.test.js +43 -0
  244. package/dist/pipeline/orchestration/__tests__/intent-detector-scores.test.js.map +1 -0
  245. package/dist/pipeline/orchestration/__tests__/reflection-cycle.test.d.ts +10 -0
  246. package/dist/pipeline/orchestration/__tests__/reflection-cycle.test.d.ts.map +1 -0
  247. package/dist/pipeline/orchestration/__tests__/reflection-cycle.test.js +264 -0
  248. package/dist/pipeline/orchestration/__tests__/reflection-cycle.test.js.map +1 -0
  249. package/dist/pipeline/orchestration/audit/audit-ci-blocker.d.ts +31 -0
  250. package/dist/pipeline/orchestration/audit/audit-ci-blocker.d.ts.map +1 -0
  251. package/dist/pipeline/orchestration/audit/audit-ci-blocker.js +120 -0
  252. package/dist/pipeline/orchestration/audit/audit-ci-blocker.js.map +1 -0
  253. package/dist/pipeline/orchestration/audit/audit-finding-tracer.d.ts +33 -0
  254. package/dist/pipeline/orchestration/audit/audit-finding-tracer.d.ts.map +1 -0
  255. package/dist/pipeline/orchestration/audit/audit-finding-tracer.js +126 -0
  256. package/dist/pipeline/orchestration/audit/audit-finding-tracer.js.map +1 -0
  257. package/dist/pipeline/orchestration/audit/audit-lessons-learned.d.ts +27 -0
  258. package/dist/pipeline/orchestration/audit/audit-lessons-learned.d.ts.map +1 -0
  259. package/dist/pipeline/orchestration/audit/audit-lessons-learned.js +155 -0
  260. package/dist/pipeline/orchestration/audit/audit-lessons-learned.js.map +1 -0
  261. package/dist/pipeline/orchestration/audit/audit-pending-issues.d.ts +21 -0
  262. package/dist/pipeline/orchestration/audit/audit-pending-issues.d.ts.map +1 -0
  263. package/dist/pipeline/orchestration/audit/audit-pending-issues.js +110 -0
  264. package/dist/pipeline/orchestration/audit/audit-pending-issues.js.map +1 -0
  265. package/dist/pipeline/orchestration/audit/audit-reflection-bridge.d.ts +39 -0
  266. package/dist/pipeline/orchestration/audit/audit-reflection-bridge.d.ts.map +1 -0
  267. package/dist/pipeline/orchestration/audit/audit-reflection-bridge.js +65 -0
  268. package/dist/pipeline/orchestration/audit/audit-reflection-bridge.js.map +1 -0
  269. package/dist/pipeline/orchestration/audit/audit-report-renderer.d.ts +30 -0
  270. package/dist/pipeline/orchestration/audit/audit-report-renderer.d.ts.map +1 -0
  271. package/dist/pipeline/orchestration/audit/audit-report-renderer.js +249 -0
  272. package/dist/pipeline/orchestration/audit/audit-report-renderer.js.map +1 -0
  273. package/dist/pipeline/orchestration/audit/audit-report-version-manager.d.ts +52 -0
  274. package/dist/pipeline/orchestration/audit/audit-report-version-manager.d.ts.map +1 -0
  275. package/dist/pipeline/orchestration/audit/audit-report-version-manager.js +144 -0
  276. package/dist/pipeline/orchestration/audit/audit-report-version-manager.js.map +1 -0
  277. package/dist/pipeline/orchestration/audit/audit-silent-gates-buffer.d.ts +37 -0
  278. package/dist/pipeline/orchestration/audit/audit-silent-gates-buffer.d.ts.map +1 -0
  279. package/dist/pipeline/orchestration/audit/audit-silent-gates-buffer.js +129 -0
  280. package/dist/pipeline/orchestration/audit/audit-silent-gates-buffer.js.map +1 -0
  281. package/dist/pipeline/orchestration/audit/index.d.ts +17 -0
  282. package/dist/pipeline/orchestration/audit/index.d.ts.map +1 -0
  283. package/dist/pipeline/orchestration/audit/index.js +26 -0
  284. package/dist/pipeline/orchestration/audit/index.js.map +1 -0
  285. package/dist/pipeline/orchestration/audit/types.d.ts +79 -0
  286. package/dist/pipeline/orchestration/audit/types.d.ts.map +1 -0
  287. package/dist/pipeline/orchestration/audit/types.js +10 -0
  288. package/dist/pipeline/orchestration/audit/types.js.map +1 -0
  289. package/dist/pipeline/orchestration/audit-reporter.d.ts +133 -0
  290. package/dist/pipeline/orchestration/audit-reporter.d.ts.map +1 -0
  291. package/dist/pipeline/orchestration/audit-reporter.js +322 -0
  292. package/dist/pipeline/orchestration/audit-reporter.js.map +1 -0
  293. package/dist/pipeline/orchestration/config-loader.d.ts +51 -0
  294. package/dist/pipeline/orchestration/config-loader.d.ts.map +1 -0
  295. package/dist/pipeline/orchestration/config-loader.js +215 -0
  296. package/dist/pipeline/orchestration/config-loader.js.map +1 -0
  297. package/dist/pipeline/orchestration/domain-detector.d.ts +36 -0
  298. package/dist/pipeline/orchestration/domain-detector.d.ts.map +1 -0
  299. package/dist/pipeline/orchestration/domain-detector.js +157 -0
  300. package/dist/pipeline/orchestration/domain-detector.js.map +1 -0
  301. package/dist/pipeline/orchestration/fsm.d.ts +92 -0
  302. package/dist/pipeline/orchestration/fsm.d.ts.map +1 -0
  303. package/dist/pipeline/orchestration/fsm.js +243 -0
  304. package/dist/pipeline/orchestration/fsm.js.map +1 -0
  305. package/dist/pipeline/orchestration/gate-resolver.d.ts +52 -0
  306. package/dist/pipeline/orchestration/gate-resolver.d.ts.map +1 -0
  307. package/dist/pipeline/orchestration/gate-resolver.js +120 -0
  308. package/dist/pipeline/orchestration/gate-resolver.js.map +1 -0
  309. package/dist/pipeline/orchestration/index.d.ts +16 -0
  310. package/dist/pipeline/orchestration/index.d.ts.map +1 -0
  311. package/dist/pipeline/orchestration/index.js +32 -0
  312. package/dist/pipeline/orchestration/index.js.map +1 -0
  313. package/dist/pipeline/orchestration/intent-detector.d.ts +37 -0
  314. package/dist/pipeline/orchestration/intent-detector.d.ts.map +1 -0
  315. package/dist/pipeline/orchestration/intent-detector.js +248 -0
  316. package/dist/pipeline/orchestration/intent-detector.js.map +1 -0
  317. package/dist/pipeline/orchestration/keyword-match.d.ts +17 -0
  318. package/dist/pipeline/orchestration/keyword-match.d.ts.map +1 -0
  319. package/dist/pipeline/orchestration/keyword-match.js +26 -0
  320. package/dist/pipeline/orchestration/keyword-match.js.map +1 -0
  321. package/dist/pipeline/orchestration/orchestrator.d.ts +158 -0
  322. package/dist/pipeline/orchestration/orchestrator.d.ts.map +1 -0
  323. package/dist/pipeline/orchestration/orchestrator.js +414 -0
  324. package/dist/pipeline/orchestration/orchestrator.js.map +1 -0
  325. package/dist/pipeline/orchestration/policy-engine.d.ts +54 -0
  326. package/dist/pipeline/orchestration/policy-engine.d.ts.map +1 -0
  327. package/dist/pipeline/orchestration/policy-engine.js +278 -0
  328. package/dist/pipeline/orchestration/policy-engine.js.map +1 -0
  329. package/dist/pipeline/orchestration/risk-scorer.d.ts +38 -0
  330. package/dist/pipeline/orchestration/risk-scorer.d.ts.map +1 -0
  331. package/dist/pipeline/orchestration/risk-scorer.js +145 -0
  332. package/dist/pipeline/orchestration/risk-scorer.js.map +1 -0
  333. package/dist/pipeline/orchestration/task-context.d.ts +205 -0
  334. package/dist/pipeline/orchestration/task-context.d.ts.map +1 -0
  335. package/dist/pipeline/orchestration/task-context.js +162 -0
  336. package/dist/pipeline/orchestration/task-context.js.map +1 -0
  337. package/dist/pipeline/orchestration/types.d.ts +111 -0
  338. package/dist/pipeline/orchestration/types.d.ts.map +1 -0
  339. package/dist/pipeline/orchestration/types.js +37 -0
  340. package/dist/pipeline/orchestration/types.js.map +1 -0
  341. package/dist/pipeline/qa/__tests__/QAService.test.d.ts +2 -0
  342. package/dist/pipeline/qa/__tests__/QAService.test.d.ts.map +1 -0
  343. package/dist/pipeline/qa/__tests__/QAService.test.js +170 -0
  344. package/dist/pipeline/qa/__tests__/QAService.test.js.map +1 -0
  345. package/dist/pipeline/qa/__tests__/QAService.verdict.test.d.ts +2 -0
  346. package/dist/pipeline/qa/__tests__/QAService.verdict.test.d.ts.map +1 -0
  347. package/dist/pipeline/qa/__tests__/QAService.verdict.test.js +39 -0
  348. package/dist/pipeline/qa/__tests__/QAService.verdict.test.js.map +1 -0
  349. package/dist/pipeline/qa/index.d.ts +3 -0
  350. package/dist/pipeline/qa/index.d.ts.map +1 -0
  351. package/dist/pipeline/qa/index.js +6 -0
  352. package/dist/pipeline/qa/index.js.map +1 -0
  353. package/dist/pipeline/qa/qa-service.d.ts +33 -0
  354. package/dist/pipeline/qa/qa-service.d.ts.map +1 -0
  355. package/dist/pipeline/qa/qa-service.js +239 -0
  356. package/dist/pipeline/qa/qa-service.js.map +1 -0
  357. package/dist/pipeline/qa-orchestrator.d.ts +60 -0
  358. package/dist/pipeline/qa-orchestrator.d.ts.map +1 -0
  359. package/dist/pipeline/qa-orchestrator.js +177 -0
  360. package/dist/pipeline/qa-orchestrator.js.map +1 -0
  361. package/dist/pipeline/reflection/domains/agent-domain.d.ts +40 -0
  362. package/dist/pipeline/reflection/domains/agent-domain.d.ts.map +1 -0
  363. package/dist/pipeline/reflection/domains/agent-domain.js +161 -0
  364. package/dist/pipeline/reflection/domains/agent-domain.js.map +1 -0
  365. package/dist/pipeline/reflection/domains/audit-domain.d.ts +46 -0
  366. package/dist/pipeline/reflection/domains/audit-domain.d.ts.map +1 -0
  367. package/dist/pipeline/reflection/domains/audit-domain.js +241 -0
  368. package/dist/pipeline/reflection/domains/audit-domain.js.map +1 -0
  369. package/dist/pipeline/reflection/domains/bootstrap-domain.d.ts +40 -0
  370. package/dist/pipeline/reflection/domains/bootstrap-domain.d.ts.map +1 -0
  371. package/dist/pipeline/reflection/domains/bootstrap-domain.js +156 -0
  372. package/dist/pipeline/reflection/domains/bootstrap-domain.js.map +1 -0
  373. package/dist/pipeline/reflection/domains/commit-domain.d.ts +40 -0
  374. package/dist/pipeline/reflection/domains/commit-domain.d.ts.map +1 -0
  375. package/dist/pipeline/reflection/domains/commit-domain.js +174 -0
  376. package/dist/pipeline/reflection/domains/commit-domain.js.map +1 -0
  377. package/dist/pipeline/reflection/domains/test-domain.d.ts +40 -0
  378. package/dist/pipeline/reflection/domains/test-domain.d.ts.map +1 -0
  379. package/dist/pipeline/reflection/domains/test-domain.js +194 -0
  380. package/dist/pipeline/reflection/domains/test-domain.js.map +1 -0
  381. package/dist/pipeline/reflection/historical-loader.d.ts +105 -0
  382. package/dist/pipeline/reflection/historical-loader.d.ts.map +1 -0
  383. package/dist/pipeline/reflection/historical-loader.js +462 -0
  384. package/dist/pipeline/reflection/historical-loader.js.map +1 -0
  385. package/dist/pipeline/reflection/hooks/agent-hook.d.ts +72 -0
  386. package/dist/pipeline/reflection/hooks/agent-hook.d.ts.map +1 -0
  387. package/dist/pipeline/reflection/hooks/agent-hook.js +98 -0
  388. package/dist/pipeline/reflection/hooks/agent-hook.js.map +1 -0
  389. package/dist/pipeline/reflection/hooks/audit-hook.d.ts +72 -0
  390. package/dist/pipeline/reflection/hooks/audit-hook.d.ts.map +1 -0
  391. package/dist/pipeline/reflection/hooks/audit-hook.js +112 -0
  392. package/dist/pipeline/reflection/hooks/audit-hook.js.map +1 -0
  393. package/dist/pipeline/reflection/hooks/bootstrap-hook.d.ts +71 -0
  394. package/dist/pipeline/reflection/hooks/bootstrap-hook.d.ts.map +1 -0
  395. package/dist/pipeline/reflection/hooks/bootstrap-hook.js +97 -0
  396. package/dist/pipeline/reflection/hooks/bootstrap-hook.js.map +1 -0
  397. package/dist/pipeline/reflection/hooks/commit-hook.d.ts +63 -0
  398. package/dist/pipeline/reflection/hooks/commit-hook.d.ts.map +1 -0
  399. package/dist/pipeline/reflection/hooks/commit-hook.js +90 -0
  400. package/dist/pipeline/reflection/hooks/commit-hook.js.map +1 -0
  401. package/dist/pipeline/reflection/hooks/test-hook.d.ts +65 -0
  402. package/dist/pipeline/reflection/hooks/test-hook.d.ts.map +1 -0
  403. package/dist/pipeline/reflection/hooks/test-hook.js +99 -0
  404. package/dist/pipeline/reflection/hooks/test-hook.js.map +1 -0
  405. package/dist/pipeline/reflection/lessons-memo-generator.d.ts +60 -0
  406. package/dist/pipeline/reflection/lessons-memo-generator.d.ts.map +1 -0
  407. package/dist/pipeline/reflection/lessons-memo-generator.js +286 -0
  408. package/dist/pipeline/reflection/lessons-memo-generator.js.map +1 -0
  409. package/dist/store/ProjectStore.d.ts +1 -1
  410. package/dist/store/ProjectStore.d.ts.map +1 -1
  411. package/dist/store/ProjectStore.js +2 -1
  412. package/dist/store/ProjectStore.js.map +1 -1
  413. package/dist/store/types.d.ts +28 -0
  414. package/dist/store/types.d.ts.map +1 -0
  415. package/dist/store/types.js +3 -0
  416. package/dist/store/types.js.map +1 -0
  417. package/dist/tools/__tests__/command-parser.test.js +1 -1
  418. package/dist/tools/__tests__/command-parser.test.js.map +1 -1
  419. package/dist/tools/__tests__/declared-facts.test.d.ts +2 -0
  420. package/dist/tools/__tests__/declared-facts.test.d.ts.map +1 -0
  421. package/dist/tools/__tests__/declared-facts.test.js +21 -0
  422. package/dist/tools/__tests__/declared-facts.test.js.map +1 -0
  423. package/dist/tools/__tests__/package-install.test.d.ts +2 -0
  424. package/dist/tools/__tests__/package-install.test.d.ts.map +1 -0
  425. package/dist/tools/__tests__/package-install.test.js +56 -0
  426. package/dist/tools/__tests__/package-install.test.js.map +1 -0
  427. package/dist/tools/__tests__/save-tools.secrets.test.js +1 -1
  428. package/dist/tools/__tests__/save-tools.secrets.test.js.map +1 -1
  429. package/dist/tools/edit-file.d.ts.map +1 -1
  430. package/dist/tools/edit-file.js +1 -0
  431. package/dist/tools/edit-file.js.map +1 -1
  432. package/dist/tools/list-directory.d.ts.map +1 -1
  433. package/dist/tools/list-directory.js +1 -0
  434. package/dist/tools/list-directory.js.map +1 -1
  435. package/dist/tools/package-install.d.ts +11 -0
  436. package/dist/tools/package-install.d.ts.map +1 -0
  437. package/dist/tools/package-install.js +112 -0
  438. package/dist/tools/package-install.js.map +1 -0
  439. package/dist/tools/read-file.d.ts.map +1 -1
  440. package/dist/tools/read-file.js +1 -0
  441. package/dist/tools/read-file.js.map +1 -1
  442. package/dist/tools/run-command.d.ts.map +1 -1
  443. package/dist/tools/run-command.js +5 -1
  444. package/dist/tools/run-command.js.map +1 -1
  445. package/dist/tools/save-audit.d.ts.map +1 -1
  446. package/dist/tools/save-audit.js +7 -6
  447. package/dist/tools/save-audit.js.map +1 -1
  448. package/dist/tools/save-context.d.ts.map +1 -1
  449. package/dist/tools/save-context.js +3 -2
  450. package/dist/tools/save-context.js.map +1 -1
  451. package/dist/tools/save-learning.d.ts.map +1 -1
  452. package/dist/tools/save-learning.js +4 -3
  453. package/dist/tools/save-learning.js.map +1 -1
  454. package/dist/tools/save-user-preference.d.ts.map +1 -1
  455. package/dist/tools/save-user-preference.js +3 -2
  456. package/dist/tools/save-user-preference.js.map +1 -1
  457. package/dist/tools/search-files.d.ts.map +1 -1
  458. package/dist/tools/search-files.js +1 -0
  459. package/dist/tools/search-files.js.map +1 -1
  460. package/dist/tools/update-session.d.ts.map +1 -1
  461. package/dist/tools/update-session.js +3 -2
  462. package/dist/tools/update-session.js.map +1 -1
  463. package/dist/tools/write-file.d.ts.map +1 -1
  464. package/dist/tools/write-file.js +1 -0
  465. package/dist/tools/write-file.js.map +1 -1
  466. package/package.json +71 -44
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const intent_detector_1 = require("../intent-detector");
4
+ const agent_core_1 = require("@backendkit-labs/agent-core");
5
+ /** SPEC-0001 §5 (ADR-0003): the LLM tie-breaker answers a schema-checked object, no regex. */
6
+ // No keyword in the text, so the LLM classifier is the one that decides.
7
+ const NO_SIGNAL = 'zzz qqq xxx';
8
+ function client(answers) {
9
+ const calls = [];
10
+ const c = {
11
+ async chat(messages, _tools, _temperature, options) {
12
+ calls.push({ messages: messages.map(m => ({ ...m })), options });
13
+ return { content: answers.shift() ?? null };
14
+ },
15
+ };
16
+ return { c, calls };
17
+ }
18
+ describe('intent-detector LLM classification', () => {
19
+ it('reads the action from a JSON object', async () => {
20
+ const { c, calls } = client(['{"action":"design"}']);
21
+ const r = await (0, intent_detector_1.detectIntent)(NO_SIGNAL, c);
22
+ expect(r).toMatchObject({ actionType: 'design', method: 'llm' });
23
+ expect(r.scores.design).toBeGreaterThanOrEqual(3);
24
+ expect(calls[0].options?.responseFormat?.name).toBe('response');
25
+ expect(JSON.stringify(calls[0].options?.responseFormat?.schema)).toContain('design');
26
+ });
27
+ it('does not depend on the exact formatting of the JSON', async () => {
28
+ const { c } = client(['```json\n{ "action" : "implementation" }\n```']);
29
+ expect((await (0, intent_detector_1.detectIntent)(NO_SIGNAL, c)).actionType).toBe('implementation');
30
+ });
31
+ it('a response that is not JSON gets one corrective retry, then falls back to unknown', async () => {
32
+ const { c, calls } = client(['I think this is a design task', 'still not json']);
33
+ const r = await (0, intent_detector_1.detectIntent)(NO_SIGNAL, c);
34
+ expect(r.actionType).toBe('unknown');
35
+ expect(r.method).toBe('llm');
36
+ expect(calls).toHaveLength(2);
37
+ });
38
+ it('recovers when the retry is valid', async () => {
39
+ const { c, calls } = client(['no idea', '{"action":"design"}']);
40
+ expect((await (0, intent_detector_1.detectIntent)(NO_SIGNAL, c)).actionType).toBe('design');
41
+ expect(calls).toHaveLength(2);
42
+ });
43
+ it('an action outside the allowed list is rejected', async () => {
44
+ const { c } = client(['{"action":"banana"}', '{"action":"banana"}']);
45
+ expect((await (0, intent_detector_1.detectIntent)(NO_SIGNAL, c)).actionType).toBe('unknown');
46
+ });
47
+ it('adaptProviderToLLMClient forwards the chat options to the provider', async () => {
48
+ let received;
49
+ const provider = {
50
+ async chat(_m, _t, cb, options) { received = options; cb.onChunk?.('{"action":"design"}'); cb.onDone({ role: 'assistant', content: null }); },
51
+ };
52
+ const r = await (0, intent_detector_1.detectIntent)(NO_SIGNAL, (0, agent_core_1.adaptProviderToLLMClient)(provider));
53
+ expect(r.actionType).toBe('design');
54
+ expect(received?.responseFormat?.type).toBe('json_schema');
55
+ });
56
+ });
57
+ //# sourceMappingURL=intent-detector-llm.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intent-detector-llm.test.js","sourceRoot":"","sources":["../../../../src/pipeline/orchestration/__tests__/intent-detector-llm.test.ts"],"names":[],"mappings":";;AAAA,wDAAsE;AACtE,4DAAuE;AAGvE,8FAA8F;AAE9F,yEAAyE;AACzE,MAAM,SAAS,GAAG,aAAa,CAAC;AAEhC,SAAS,MAAM,CAAC,OAAiB;IAC7B,MAAM,KAAK,GAAyF,EAAE,CAAC;IACvG,MAAM,CAAC,GAAkB;QACrB,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO;YAC9C,KAAK,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;YACjE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,IAAI,IAAI,EAAE,CAAC;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E,EAAE,EAAE,EAAE,EAAE,OAAO,IAAI,QAAQ,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;SAChJ,CAAC;QACF,MAAM,CAAC,GAAG,MAAM,IAAA,8BAAY,EAAC,SAAS,EAAE,IAAA,qCAAwB,EAAC,QAAQ,CAAC,CAAC,CAAC;QAC5E,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACpC,MAAM,CAAC,QAAQ,EAAE,cAAc,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Tests for computeKeywordScores cap (H-006).
3
+ *
4
+ * Previously scores accumulated without limit. A long text mentioning many
5
+ * implementation keywords could score 30-40, dwarfing the 2-point margin
6
+ * used to declare a clear winner. The fix caps each action at MAX_KEYWORD_SCORE=15.
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=intent-detector-scores.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intent-detector-scores.test.d.ts","sourceRoot":"","sources":["../../../../src/pipeline/orchestration/__tests__/intent-detector-scores.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ /**
3
+ * Tests for computeKeywordScores cap (H-006).
4
+ *
5
+ * Previously scores accumulated without limit. A long text mentioning many
6
+ * implementation keywords could score 30-40, dwarfing the 2-point margin
7
+ * used to declare a clear winner. The fix caps each action at MAX_KEYWORD_SCORE=15.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ const intent_detector_1 = require("../intent-detector");
11
+ describe('computeKeywordScores — MAX_KEYWORD_SCORE cap (H-006)', () => {
12
+ it('no score exceeds 15 regardless of how many matching keywords are in the text', async () => {
13
+ // A text that repeats many implementation keywords
14
+ const longText = Array(20).fill('implementar develop build create add feature endpoint api').join(' ');
15
+ const result = await (0, intent_detector_1.detectIntent)(longText);
16
+ for (const [action, score] of Object.entries(result.scores)) {
17
+ expect(score).toBeLessThanOrEqual(15);
18
+ }
19
+ });
20
+ it('confidence is always in [0, 1] even with highly keyword-dense input', async () => {
21
+ const dense = Array(30).fill('fix bug error corregir arreglar problema').join(' ');
22
+ const result = await (0, intent_detector_1.detectIntent)(dense);
23
+ expect(result.confidence).toBeGreaterThanOrEqual(0);
24
+ expect(result.confidence).toBeLessThanOrEqual(1);
25
+ });
26
+ it('discriminates correctly between two competing categories at high keyword density', async () => {
27
+ // Even when both implementation and bugfix have many keywords, the margin
28
+ // logic still works because both are capped and their relative scores remain meaningful.
29
+ const text = 'implementar fix bug error desarrollar codigo endpoint corregir';
30
+ const result = await (0, intent_detector_1.detectIntent)(text);
31
+ // The winner must have a score <= MAX and confidence in [0,1]
32
+ const winnerScore = result.scores[result.actionType] ?? 0;
33
+ expect(winnerScore).toBeLessThanOrEqual(15);
34
+ expect(result.confidence).toBeLessThanOrEqual(1);
35
+ });
36
+ it('a short focused text still classifies correctly after capping', async () => {
37
+ const result = await (0, intent_detector_1.detectIntent)('implementar nuevo endpoint REST');
38
+ // Should classify as implementation or similar, not garbage
39
+ expect(result.actionType).toBeTruthy();
40
+ expect(result.confidence).toBeGreaterThan(0);
41
+ });
42
+ });
43
+ //# sourceMappingURL=intent-detector-scores.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intent-detector-scores.test.js","sourceRoot":"","sources":["../../../../src/pipeline/orchestration/__tests__/intent-detector-scores.test.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAEH,wDAAkD;AAElD,QAAQ,CAAC,sDAAsD,EAAE,GAAG,EAAE;IAClE,EAAE,CAAC,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CAAC,CAAC;QAC5C,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+DAA+D,EAAE,KAAK,IAAI,EAAE;QAC3E,MAAM,MAAM,GAAG,MAAM,IAAA,8BAAY,EAAC,iCAAiC,CAAC,CAAC;QACrE,4DAA4D;QAC5D,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,UAAU,EAAE,CAAC;QACvC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Integration test: PolicyPromoter → manifest.yaml → Orchestrator.loadManifestPolicyRules → applyPolicies
3
+ *
4
+ * Verifies the closed feedback loop:
5
+ * 1. ReflectionEngine promotes a detected pattern to manifest.yaml via PolicyPromoter
6
+ * 2. Orchestrator reads manifest.yaml on every orchestrate() call (PolicyStep)
7
+ * 3. The promoted rule fires for matching input and enriches the task context
8
+ */
9
+ export {};
10
+ //# sourceMappingURL=reflection-cycle.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reflection-cycle.test.d.ts","sourceRoot":"","sources":["../../../../src/pipeline/orchestration/__tests__/reflection-cycle.test.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
@@ -0,0 +1,264 @@
1
+ "use strict";
2
+ /**
3
+ * Integration test: PolicyPromoter → manifest.yaml → Orchestrator.loadManifestPolicyRules → applyPolicies
4
+ *
5
+ * Verifies the closed feedback loop:
6
+ * 1. ReflectionEngine promotes a detected pattern to manifest.yaml via PolicyPromoter
7
+ * 2. Orchestrator reads manifest.yaml on every orchestrate() call (PolicyStep)
8
+ * 3. The promoted rule fires for matching input and enriches the task context
9
+ */
10
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ var desc = Object.getOwnPropertyDescriptor(m, k);
13
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
14
+ desc = { enumerable: true, get: function() { return m[k]; } };
15
+ }
16
+ Object.defineProperty(o, k2, desc);
17
+ }) : (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ o[k2] = m[k];
20
+ }));
21
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
22
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
23
+ }) : function(o, v) {
24
+ o["default"] = v;
25
+ });
26
+ var __importStar = (this && this.__importStar) || (function () {
27
+ var ownKeys = function(o) {
28
+ ownKeys = Object.getOwnPropertyNames || function (o) {
29
+ var ar = [];
30
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
31
+ return ar;
32
+ };
33
+ return ownKeys(o);
34
+ };
35
+ return function (mod) {
36
+ if (mod && mod.__esModule) return mod;
37
+ var result = {};
38
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
39
+ __setModuleDefault(result, mod);
40
+ return result;
41
+ };
42
+ })();
43
+ Object.defineProperty(exports, "__esModule", { value: true });
44
+ const os = __importStar(require("os"));
45
+ const path = __importStar(require("path"));
46
+ const fs = __importStar(require("fs/promises"));
47
+ const yaml = __importStar(require("yaml"));
48
+ const agent_core_1 = require("@backendkit-labs/agent-core");
49
+ const orchestrator_1 = require("../orchestrator");
50
+ const policy_engine_1 = require("../policy-engine");
51
+ // ── Fixtures ──────────────────────────────────────────────────────────────────
52
+ let tmpHome;
53
+ const APP_NAME = 'test-reflection-app';
54
+ beforeEach(async () => {
55
+ tmpHome = await fs.mkdtemp(path.join(os.tmpdir(), 'reflection-cycle-'));
56
+ process.env.USERPROFILE = tmpHome;
57
+ process.env.HOME = tmpHome;
58
+ });
59
+ afterEach(async () => {
60
+ await fs.rm(tmpHome, { recursive: true, force: true });
61
+ delete process.env.USERPROFILE;
62
+ delete process.env.HOME;
63
+ });
64
+ function manifestPath() {
65
+ return path.join(tmpHome, `.${APP_NAME}`, 'manifest.yaml');
66
+ }
67
+ function makePattern(overrides = {}) {
68
+ return {
69
+ domain: 'audit',
70
+ failureType: 'security_vulnerability',
71
+ count: 4,
72
+ severity: 'high',
73
+ firstSeen: new Date().toISOString(),
74
+ lastSeen: new Date().toISOString(),
75
+ recordIds: [],
76
+ dominantDimension: 'security',
77
+ dominantGate: 'qa',
78
+ recommendedAction: 'Add security review',
79
+ promotedToPolicy: false,
80
+ ...overrides,
81
+ };
82
+ }
83
+ /** Minimal orchestrator config with only policyEngine enabled (no LLM steps). */
84
+ const MINIMAL_CONFIG = {
85
+ features: {
86
+ intentDetection: false,
87
+ domainDetection: false,
88
+ riskScoring: false,
89
+ policyEngine: true,
90
+ fsm: false,
91
+ qaGate: false,
92
+ commitGate: false,
93
+ },
94
+ riskThresholds: { low: 10, medium: 30, high: 60, critical: 80 },
95
+ riskWeights: {
96
+ breaking_change: 25,
97
+ security_sensitive: 30,
98
+ cross_service_impact: 20,
99
+ db_transactional: 15,
100
+ production_critical: 25,
101
+ complexity: 1,
102
+ },
103
+ };
104
+ // ── PolicyPromoter ────────────────────────────────────────────────────────────
105
+ describe('PolicyPromoter — writes manifest.yaml', () => {
106
+ it('creates manifest.yaml with a policyRules entry', async () => {
107
+ const promoter = new agent_core_1.PolicyPromoter({ appName: APP_NAME });
108
+ const rule = await promoter.promote(makePattern());
109
+ expect(rule.id).toMatch(/^POL-AUDI-\d+$/);
110
+ expect(rule.autoGenerated).toBe(true);
111
+ const content = await fs.readFile(manifestPath(), 'utf-8');
112
+ const manifest = yaml.parse(content);
113
+ expect(manifest.policyRules).toHaveLength(1);
114
+ expect(manifest.policyRules[0].id).toBe(rule.id);
115
+ });
116
+ it('promoted rule has if.keywords derived from the failureType', async () => {
117
+ const promoter = new agent_core_1.PolicyPromoter({ appName: APP_NAME });
118
+ const rule = await promoter.promote(makePattern({ failureType: 'security_vulnerability' }));
119
+ // Keywords for 'security_vulnerability' include 'auth', 'jwt', 'seguridad'
120
+ expect(rule.if.keywords).toBeDefined();
121
+ expect(rule.if.keywords.length).toBeGreaterThan(0);
122
+ });
123
+ it('idempotent — promoting same pattern twice updates, does not duplicate', async () => {
124
+ const promoter = new agent_core_1.PolicyPromoter({ appName: APP_NAME });
125
+ const rule1 = await promoter.promote(makePattern({ failureType: 'jest_timeout', domain: 'test' }));
126
+ await promoter.promote(makePattern({ failureType: 'jest_timeout', domain: 'test' }), rule1.id);
127
+ const manifest = await promoter.readManifest();
128
+ const rules = manifest.policyRules ?? [];
129
+ expect(rules.filter(r => r.id === rule1.id)).toHaveLength(1);
130
+ });
131
+ it('accumulates multiple distinct patterns as separate rules', async () => {
132
+ const promoter = new agent_core_1.PolicyPromoter({ appName: APP_NAME });
133
+ await promoter.promote(makePattern({ failureType: 'missing_rollback' }));
134
+ await promoter.promote(makePattern({ domain: 'test', failureType: 'coverage_below_threshold', severity: 'medium' }));
135
+ const rules = await promoter.getExistingRules();
136
+ expect(rules).toHaveLength(2);
137
+ });
138
+ it('updateOutcome records success/failure counts', async () => {
139
+ const promoter = new agent_core_1.PolicyPromoter({ appName: APP_NAME });
140
+ const rule = await promoter.promote(makePattern({ failureType: 'missing_logging', severity: 'medium' }));
141
+ await promoter.updateOutcome(rule.id, 'success');
142
+ await promoter.updateOutcome(rule.id, 'failure');
143
+ await promoter.updateOutcome(rule.id, 'success');
144
+ const updated = await promoter.getRuleById(rule.id);
145
+ expect(updated?.outcomes?.success).toBe(2);
146
+ expect(updated?.outcomes?.failure).toBe(1);
147
+ });
148
+ it('removeRule deletes a rule by id', async () => {
149
+ const promoter = new agent_core_1.PolicyPromoter({ appName: APP_NAME });
150
+ const rule = await promoter.promote(makePattern());
151
+ await promoter.removeRule(rule.id);
152
+ const rules = await promoter.getExistingRules();
153
+ expect(rules.find(r => r.id === rule.id)).toBeUndefined();
154
+ });
155
+ });
156
+ // ── Orchestrator reads manifest on each orchestrate() ─────────────────────────
157
+ describe('Orchestrator — loadManifestPolicyRules picks up promoted rules', () => {
158
+ it('applies a manifest rule with keyword matching to the user input', async () => {
159
+ // Write a rule directly to manifest.yaml
160
+ const manifestDir = path.join(tmpHome, `.${APP_NAME}`);
161
+ await fs.mkdir(manifestDir, { recursive: true });
162
+ const rule = {
163
+ id: 'POL-AUDI-001',
164
+ name: 'Test Security Rule',
165
+ if: { keywords: ['vulnerabilidad-test-unica', 'test-security-keyword'] },
166
+ then: { requireQaApproval: true, mustInclude: ['security-agent'] },
167
+ trigger: { domain: 'audit', pattern: 'security_vulnerability', minOccurrences: 3 },
168
+ autoGenerated: true,
169
+ createdAt: new Date().toISOString(),
170
+ engineVersion: '1.0.0',
171
+ };
172
+ await fs.writeFile(path.join(manifestDir, 'manifest.yaml'), yaml.stringify({ policyRules: [rule] }));
173
+ const orchestrator = new orchestrator_1.Orchestrator({ appName: APP_NAME, config: MINIMAL_CONFIG });
174
+ const result = await orchestrator.orchestrate('hay una vulnerabilidad-test-unica en el sistema');
175
+ // The promoted rule must fire: qa approval + security agent
176
+ expect(result.task.requiresQaApproval).toBe(true);
177
+ expect(result.selectedAgents.some(a => a.agentId === 'security-agent')).toBe(true);
178
+ });
179
+ it('does not fire a rule when input has no matching keyword', async () => {
180
+ const manifestDir = path.join(tmpHome, `.${APP_NAME}`);
181
+ await fs.mkdir(manifestDir, { recursive: true });
182
+ const rule = {
183
+ id: 'POL-AUDI-001',
184
+ name: 'Specific keyword rule',
185
+ if: { keywords: ['keyword-muy-especifico-xyz'] },
186
+ then: { requireQaApproval: true },
187
+ trigger: { domain: 'audit', pattern: 'security_vulnerability', minOccurrences: 3 },
188
+ autoGenerated: true,
189
+ createdAt: new Date().toISOString(),
190
+ engineVersion: '1.0.0',
191
+ };
192
+ await fs.writeFile(path.join(manifestDir, 'manifest.yaml'), yaml.stringify({ policyRules: [rule] }));
193
+ const orchestrator = new orchestrator_1.Orchestrator({ appName: APP_NAME, config: MINIMAL_CONFIG });
194
+ const result = await orchestrator.orchestrate('write a unit test for the login feature');
195
+ const manifestRuleFired = result.appliedPolicies.some(p => p.rule.includes('keyword-muy-especifico-xyz'));
196
+ expect(manifestRuleFired).toBe(false);
197
+ });
198
+ it('does not throw when manifest does not exist — returns empty rules', async () => {
199
+ const orchestrator = new orchestrator_1.Orchestrator({ appName: APP_NAME, config: MINIMAL_CONFIG });
200
+ // No manifest file written — should silently return []
201
+ await expect(orchestrator.orchestrate('simple question')).resolves.toBeDefined();
202
+ });
203
+ it('picks up newly promoted rules on subsequent orchestrate() calls (no caching)', async () => {
204
+ const promoter = new agent_core_1.PolicyPromoter({ appName: APP_NAME });
205
+ const orchestrator = new orchestrator_1.Orchestrator({ appName: APP_NAME, config: MINIMAL_CONFIG });
206
+ // First call — no rules yet
207
+ await expect(orchestrator.orchestrate('transaccion y rollback')).resolves.toBeDefined();
208
+ // Promote a pattern after the first call
209
+ await promoter.promote(makePattern({ failureType: 'missing_rollback' }));
210
+ // Second call — manifest now has the rule; it should load fresh
211
+ const after = await orchestrator.orchestrate('transaccion y rollback');
212
+ expect(after).toBeDefined();
213
+ // Verify the manifest was written with one rule
214
+ const rules = await promoter.getExistingRules();
215
+ expect(rules).toHaveLength(1);
216
+ });
217
+ });
218
+ // ── evaluatePolicies — unit tests for keyword matching ────────────────────────
219
+ describe('evaluatePolicies — keyword matching in manifest-derived rules', () => {
220
+ it('fires a keyword-based rule when input contains a matching keyword', () => {
221
+ const { createTaskContext } = require('../task-context');
222
+ const task = createTaskContext('quiero revisar el jwt token');
223
+ const rules = [
224
+ {
225
+ if: { keywords: ['jwt', 'auth', 'oauth'] },
226
+ then: { requireQaApproval: true, mustInclude: ['security-agent'] },
227
+ },
228
+ ];
229
+ const result = (0, policy_engine_1.evaluatePolicies)(task, rules, 'quiero revisar el jwt token');
230
+ expect(result.requiredGates).toContain('qa');
231
+ expect(result.mustInclude).toContain('security-agent');
232
+ });
233
+ it('does not fire when input has no matching keyword', () => {
234
+ const { createTaskContext } = require('../task-context');
235
+ const task = createTaskContext('refactor the pagination logic');
236
+ const rules = [
237
+ {
238
+ if: { keywords: ['jwt', 'auth', 'oauth'] },
239
+ then: { requireQaApproval: true, mustInclude: ['security-agent'] },
240
+ },
241
+ ];
242
+ const result = (0, policy_engine_1.evaluatePolicies)(task, rules, 'refactor the pagination logic');
243
+ expect(result.mustInclude).not.toContain('security-agent');
244
+ });
245
+ it('keyword matching is case-insensitive', () => {
246
+ const { createTaskContext } = require('../task-context');
247
+ const task = createTaskContext('fix JWT validation');
248
+ const rules = [{ if: { keywords: ['jwt'] }, then: { requireQaApproval: true } }];
249
+ const result = (0, policy_engine_1.evaluatePolicies)(task, rules, 'fix JWT validation');
250
+ expect(result.requiredGates).toContain('qa');
251
+ });
252
+ it('applies multiple rules when all conditions match', () => {
253
+ const { createTaskContext } = require('../task-context');
254
+ const task = createTaskContext('security auth review');
255
+ const rules = [
256
+ { if: { keywords: ['auth'] }, then: { mustInclude: ['security-agent'] } },
257
+ { if: { keywords: ['review'] }, then: { mustInclude: ['qa-engineer'] } },
258
+ ];
259
+ const result = (0, policy_engine_1.evaluatePolicies)(task, rules, 'security auth review');
260
+ expect(result.mustInclude).toContain('security-agent');
261
+ expect(result.mustInclude).toContain('qa-engineer');
262
+ });
263
+ });
264
+ //# sourceMappingURL=reflection-cycle.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reflection-cycle.test.js","sourceRoot":"","sources":["../../../../src/pipeline/orchestration/__tests__/reflection-cycle.test.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,2CAA6B;AAC7B,gDAAkC;AAClC,2CAA6B;AAC7B,4DAA6D;AAC7D,kDAA+C;AAC/C,oDAAoD;AAIpD,iFAAiF;AAEjF,IAAI,OAAe,CAAC;AACpB,MAAM,QAAQ,GA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AAC;QAEjF,MAAM,MAAM,GAAG,IAAA,gCAAgB,EAAC,IAAI,EAAE,KAAK,EAAE,oBAAoB,CAAC,CAAC;QACnE,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE;QACxD,MAAM,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;QACzD,MAAM,IAAI,GAAG,iBAAiB,CAAC,sBAAsB,CAAC,CAAC;QACvD,MAAM,KAAK,GAAG;YACV,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,WAAW,EAAE,CAAC,gBAAgB,CAAC,EAAE,EAAE;YACzE,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,WAAW,EAAE,CAAC,aAAa,CAAC,EAAE,EAAE;SAC3E,CAAC;QAEF,MAAM,MAAM,GAAG,IAAA,gCAAgB,EAAC,IAAI,EAAE,KAAK,EAAE,sBAAsB,CAAC,CAAC;QACrE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;QACvD,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @description AuditCiBlocker — Bloqueo de deploys en CI/CD.
3
+ *
4
+ * Verifica si hay hallazgos críticos/altos sin resolver y genera
5
+ * reportes de estado para pipelines de CI/CD.
6
+ *
7
+ * Útil para:
8
+ * - `audit check --block-on-critical` en CI
9
+ * - Generar reportes de estado para GitHub Actions / GitLab CI
10
+ * - Fallar el pipeline si hay issues abiertos
11
+ */
12
+ import { GateRecord, CiReport } from './types';
13
+ export declare class AuditCiBlocker {
14
+ private docsDir;
15
+ constructor(docsDir: string);
16
+ /**
17
+ * @description Verifica si hay hallazgos críticos/altos sin resolver.
18
+ * Busca tanto en memoria como en disco.
19
+ * Si retorna true, el pipeline CI/CD debe fallar.
20
+ *
21
+ * @param gates - Gates en memoria para verificar
22
+ */
23
+ hasCriticalOpenFindings(gates: GateRecord[]): Promise<boolean>;
24
+ /**
25
+ * @description Genera reporte de estado para CI/CD.
26
+ *
27
+ * @param gates - Gates en memoria para analizar
28
+ */
29
+ generateCiReport(gates: GateRecord[]): Promise<CiReport>;
30
+ }
31
+ //# sourceMappingURL=audit-ci-blocker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-ci-blocker.d.ts","sourceRoot":"","sources":["../../../../src/pipeline/orchestration/audit/audit-ci-blocker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,EAAE,UAAU,EAAgB,QAAQ,EAAE,MAAM,SAAS,CAAC;AAI7D,qBAAa,cAAc;IACzB,OAAO,CAAC,OAAO,CAAS;gBAEZ,OAAO,EAAE,MAAM;IAI3B;;;;;;OAMG;IACG,uBAAuB,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IA2BpE;;;;OAIG;IACG,gBAAgB,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC;CA0B/D"}
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ /**
3
+ * @description AuditCiBlocker — Bloqueo de deploys en CI/CD.
4
+ *
5
+ * Verifica si hay hallazgos críticos/altos sin resolver y genera
6
+ * reportes de estado para pipelines de CI/CD.
7
+ *
8
+ * Útil para:
9
+ * - `audit check --block-on-critical` en CI
10
+ * - Generar reportes de estado para GitHub Actions / GitLab CI
11
+ * - Fallar el pipeline si hay issues abiertos
12
+ */
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || (function () {
30
+ var ownKeys = function(o) {
31
+ ownKeys = Object.getOwnPropertyNames || function (o) {
32
+ var ar = [];
33
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
34
+ return ar;
35
+ };
36
+ return ownKeys(o);
37
+ };
38
+ return function (mod) {
39
+ if (mod && mod.__esModule) return mod;
40
+ var result = {};
41
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
42
+ __setModuleDefault(result, mod);
43
+ return result;
44
+ };
45
+ })();
46
+ Object.defineProperty(exports, "__esModule", { value: true });
47
+ exports.AuditCiBlocker = void 0;
48
+ const path = __importStar(require("path"));
49
+ const fs = __importStar(require("fs/promises"));
50
+ // ── AuditCiBlocker ───────────────────────────────────────────────────────────
51
+ class AuditCiBlocker {
52
+ docsDir;
53
+ constructor(docsDir) {
54
+ this.docsDir = docsDir;
55
+ }
56
+ /**
57
+ * @description Verifica si hay hallazgos críticos/altos sin resolver.
58
+ * Busca tanto en memoria como en disco.
59
+ * Si retorna true, el pipeline CI/CD debe fallar.
60
+ *
61
+ * @param gates - Gates en memoria para verificar
62
+ */
63
+ async hasCriticalOpenFindings(gates) {
64
+ try {
65
+ const files = await fs.readdir(this.docsDir);
66
+ // Buscar pending issues activos
67
+ if (files.some(f => f.startsWith('pending-issues') && f.endsWith('.md')))
68
+ return true;
69
+ // Buscar en informes finales y gates persistidos
70
+ for (const file of files) {
71
+ if (!file.endsWith('.md') || file.startsWith('auto-gates'))
72
+ continue;
73
+ const content = await fs.readFile(path.join(this.docsDir, file), 'utf-8');
74
+ const criticalMatches = (content.match(/\*\*(Crítica|Alta)\*\*/g) ?? []).length;
75
+ const resolvedMatches = (content.match(/Resuelto en commit/g) ?? []).length;
76
+ if (criticalMatches > resolvedMatches)
77
+ return true;
78
+ }
79
+ // Buscar en memoria
80
+ if (gates.some(g => g.hallazgos.some(h => (h.severidad === 'critical' || h.severidad === 'high') && !h.resolvedByCommit)))
81
+ return true;
82
+ return false;
83
+ }
84
+ catch {
85
+ return false;
86
+ }
87
+ }
88
+ /**
89
+ * @description Genera reporte de estado para CI/CD.
90
+ *
91
+ * @param gates - Gates en memoria para analizar
92
+ */
93
+ async generateCiReport(gates) {
94
+ const criticalOpen = [];
95
+ const highOpen = [];
96
+ for (const gate of gates) {
97
+ for (const h of gate.hallazgos) {
98
+ if (!h.resolvedByCommit) {
99
+ if (h.severidad === 'critical')
100
+ criticalOpen.push(h);
101
+ else if (h.severidad === 'high')
102
+ highOpen.push(h);
103
+ }
104
+ }
105
+ }
106
+ const ok = criticalOpen.length === 0 && highOpen.length === 0;
107
+ const message = ok
108
+ ? '✅ No open critical or high findings. Deploy allowed.'
109
+ : `❌ ${criticalOpen.length} critical and ${highOpen.length} high finding(s) unresolved. Deploy blocked.`;
110
+ return {
111
+ ok,
112
+ criticalCount: criticalOpen.length,
113
+ highCount: highOpen.length,
114
+ findings: [...criticalOpen, ...highOpen],
115
+ message,
116
+ };
117
+ }
118
+ }
119
+ exports.AuditCiBlocker = AuditCiBlocker;
120
+ //# sourceMappingURL=audit-ci-blocker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-ci-blocker.js","sourceRoot":"","sources":["../../../../src/pipeline/orch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YAAY,EAAE,GAAG,QAAQ,CAAC;YACxC,OAAO;SACR,CAAC;IACJ,CAAC;CACF;AAxED,wCAwEC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @description AuditFindingTracer — Trazabilidad hallazgo → commit.
3
+ *
4
+ * Permite marcar hallazgos de auditoría como resueltos, asociándolos
5
+ * con un commit SHA específico. Busca tanto en memoria como en disco
6
+ * para actualizar los registros persistidos.
7
+ */
8
+ import { GateRecord } from './types';
9
+ export declare class AuditFindingTracer {
10
+ private docsDir;
11
+ constructor(docsDir: string);
12
+ /**
13
+ * @description Marca un hallazgo como resuelto en memoria y en disco.
14
+ *
15
+ * @param gates - Lista de gates en memoria donde buscar
16
+ * @param findingId - ID del hallazgo a marcar
17
+ * @param commitHash - SHA del commit que lo resuelve
18
+ * @param commitMessage - Mensaje del commit (opcional)
19
+ * @returns true si se encontró y marcó el hallazgo
20
+ */
21
+ markResolved(gates: GateRecord[], findingId: string, commitHash: string, commitMessage?: string): Promise<boolean>;
22
+ /**
23
+ * @description Marca hallazgos como resueltos buscando por archivos modificados
24
+ * en el commit. Útil para hook post-commit.
25
+ *
26
+ * @param gates - Lista de gates en memoria
27
+ * @param commitHash - SHA del commit
28
+ * @param modifiedFiles - Archivos modificados en el commit
29
+ * @returns Cantidad de hallazgos resueltos
30
+ */
31
+ markResolvedByFiles(gates: GateRecord[], commitHash: string, modifiedFiles: string[]): Promise<number>;
32
+ }
33
+ //# sourceMappingURL=audit-finding-tracer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-finding-tracer.d.ts","sourceRoot":"","sources":["../../../../src/pipeline/orchestration/audit/audit-finding-tracer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,UAAU,EAAgB,MAAM,SAAS,CAAC;AAanD,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,OAAO,CAAS;gBAEZ,OAAO,EAAE,MAAM;IAI3B;;;;;;;;OAQG;IACG,YAAY,CAChB,KAAK,EAAE,UAAU,EAAE,EACnB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,aAAa,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,OAAO,CAAC;IAqCnB;;;;;;;;OAQG;IACG,mBAAmB,CACvB,KAAK,EAAE,UAAU,EAAE,EACnB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EAAE,GACtB,OAAO,CAAC,MAAM,CAAC;CAanB"}