@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,28 @@
1
+ import type { EngineHooks } from '@backendkit-labs/agent-core';
2
+ import type { Orchestrator } from './orchestration/orchestrator';
3
+ import type { OrchestrationResult } from './orchestration/types';
4
+ import type { QAService } from './qa/qa-service';
5
+ export interface CodingPipelineHooksOptions {
6
+ /** Classifies the task before the run (intent, risk, gates, agent pipeline) and drives the FSM. */
7
+ orchestrator: Orchestrator;
8
+ /** Reviews the final answer and records the QA gate. Without it only the brief and the classification apply. */
9
+ qaService?: QAService;
10
+ /** What `beforeRun` does when the orchestrator throws. 'closed' (default) fails the run; 'open' warns and runs without gates. */
11
+ failureMode?: 'closed' | 'open';
12
+ /** Skips the automatic QA review even when `qaService` is set. */
13
+ noQA?: boolean;
14
+ /** Called with every QA review. */
15
+ onQAReview?: (review: string) => void;
16
+ /** Agent that receives the orchestration brief. Default: the agent that starts the turn. */
17
+ defaultAgentId?: string;
18
+ }
19
+ /** The orchestration brief for the default agent: which specialists to use, in what order, and which gates apply. */
20
+ export declare function buildOrchestrationBrief(result: OrchestrationResult): string;
21
+ /**
22
+ * The coding pipeline (orchestrator + QA gates) as engine hooks (SPEC-0015 F1):
23
+ * - `beforeRun` classifies the task; the result lives in the turn's state.
24
+ * - `systemPrompt` gives the default agent the brief.
25
+ * - `afterTurn` advances the required gates and asks for a pass of the `qa-engineer` agent (or reviews inline).
26
+ */
27
+ export declare function codingPipelineHooks(opts: CodingPipelineHooksOptions): EngineHooks;
28
+ //# sourceMappingURL=coding-pipeline-hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coding-pipeline-hooks.d.ts","sourceRoot":"","sources":["../../src/pipeline/coding-pipeline-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAc,MAAM,6BAA6B,CAAC;AAC3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAWjD,MAAM,WAAW,0BAA0B;IACvC,mGAAmG;IACnG,YAAY,EAAE,YAAY,CAAC;IAC3B,gHAAgH;IAChH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,iIAAiI;IACjI,WAAW,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IAChC,kEAAkE;IAClE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,mCAAmC;IACnC,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,4FAA4F;IAC5F,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,qHAAqH;AACrH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,mBAAmB,GAAG,MAAM,CAkC3E;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,0BAA0B,GAAG,WAAW,CAiDjF"}
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildOrchestrationBrief = buildOrchestrationBrief;
4
+ exports.codingPipelineHooks = codingPipelineHooks;
5
+ const qa_orchestrator_1 = require("./qa-orchestrator");
6
+ const STATE_KEY = 'coding-pipeline.orchestration';
7
+ /** The orchestration brief for the default agent: which specialists to use, in what order, and which gates apply. */
8
+ function buildOrchestrationBrief(result) {
9
+ const { task, selectedAgents, agentPipeline, requiredGates } = result;
10
+ const lines = ['## Orchestrator Analysis — Current Task'];
11
+ const domains = task.domains.length > 0 ? task.domains.join(', ') : 'general';
12
+ lines.push(`**Intent:** ${task.actionType} | **Risk:** ${task.riskLevel} | **Domains:** ${domains}`);
13
+ // Only surface non-trivial agent selections (skip sole-fallback case)
14
+ const nonFallback = selectedAgents.filter(a => !(a.agentId === 'general' && a.score <= 50));
15
+ if (nonFallback.length > 0) {
16
+ lines.push('\n**Recommended agents for this task (highest priority first):**');
17
+ for (const a of nonFallback) {
18
+ lines.push(`- ${a.agentId} — ${a.reason}`);
19
+ }
20
+ lines.push('\nWhen delegating via ask_agent, prioritize the agents listed above. ' +
21
+ 'Do not delegate to unlisted agents unless the task explicitly requires it.');
22
+ }
23
+ if (agentPipeline && agentPipeline.length > 0) {
24
+ lines.push('\n**Suggested execution pipeline (respect this order):**');
25
+ agentPipeline.forEach((phase, i) => {
26
+ lines.push(`${i + 1}. [${phase.phase}] ${phase.agentId} — ${phase.purpose}`);
27
+ });
28
+ }
29
+ if (requiredGates.length > 0) {
30
+ lines.push(`\n**Required gates before commit:** ${requiredGates.join(', ')}`);
31
+ lines.push('Ensure each gate is satisfied before considering the task complete.');
32
+ }
33
+ return lines.join('\n');
34
+ }
35
+ /**
36
+ * The coding pipeline (orchestrator + QA gates) as engine hooks (SPEC-0015 F1):
37
+ * - `beforeRun` classifies the task; the result lives in the turn's state.
38
+ * - `systemPrompt` gives the default agent the brief.
39
+ * - `afterTurn` advances the required gates and asks for a pass of the `qa-engineer` agent (or reviews inline).
40
+ */
41
+ function codingPipelineHooks(opts) {
42
+ const get = (ctx) => ctx.state.get(STATE_KEY);
43
+ return {
44
+ name: 'coding-pipeline',
45
+ async beforeRun(ctx) {
46
+ try {
47
+ ctx.state.set(STATE_KEY, await opts.orchestrator.orchestrate(ctx.input));
48
+ }
49
+ catch (err) {
50
+ const reason = err instanceof Error ? err.message : String(err);
51
+ if ((opts.failureMode ?? 'closed') === 'closed') {
52
+ throw new Error(`Orchestrator failed; refusing to run without its gates: ${reason}`);
53
+ }
54
+ ctx.emit({ type: 'system', level: 'warn', text: `[Orchestrator] failed (${reason}); running without classification or gates` });
55
+ }
56
+ },
57
+ systemPrompt(ctx, profile) {
58
+ const result = get(ctx);
59
+ if (!result || profile.id !== (opts.defaultAgentId ?? ctx.principal.agentId))
60
+ return undefined;
61
+ return buildOrchestrationBrief(result);
62
+ },
63
+ async afterTurn(ctx, turn) {
64
+ const result = get(ctx);
65
+ if (!result || !opts.qaService)
66
+ return undefined;
67
+ const qaAgentId = ctx.hasAgent('qa-engineer') ? 'qa-engineer' : undefined;
68
+ const qaCtx = {
69
+ clean: turn.text,
70
+ orchestrationResult: result,
71
+ orchestrator: opts.orchestrator,
72
+ qaService: opts.qaService,
73
+ effectiveAgentId: turn.profile.id,
74
+ hasAgent: ctx.hasAgent,
75
+ qaAgentId,
76
+ noQA: opts.noQA,
77
+ onQAReview: opts.onQAReview,
78
+ };
79
+ await (0, qa_orchestrator_1.advanceRequiredGates)(qaCtx);
80
+ const qa = (0, qa_orchestrator_1.activateQaEngineerIfNeeded)(qaCtx);
81
+ if (qa)
82
+ return { action: 'continue', agentId: qa.agentId, message: qa.message };
83
+ if (qaAgentId && turn.profile.id === qaAgentId)
84
+ await (0, qa_orchestrator_1.processQaEngineerResponse)(qaCtx);
85
+ else
86
+ await (0, qa_orchestrator_1.processInlineQaReview)(qaCtx);
87
+ return undefined;
88
+ },
89
+ };
90
+ }
91
+ //# sourceMappingURL=coding-pipeline-hooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coding-pipeline-hooks.js","sourceRoot":"","sources":["../../src/pipeline/coding-pipeline-hooks.ts"],"names":[],"mappings":";;AA8BA,0DAkCC;AAQD,kDAiDC;AArHD,uDAM2B;AAE3B,MAAM,SAAS,GAAG,+BAA+B,CAAC;AAiBlD,qHAAqH;AACrH,SAAgB,uBAAuB,CAAC,MAA2B;IAC/D,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,GAAG,MAAM,CAAC;IAEtE,MAAM,KAAK,GAAa,CAAC,yCAAyC,CAAC,CAAC;IAEpE,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CA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export type { CodingPipelineHooksOptions } from './coding-pipeline-hooks';
3
+ export * from './orchestration';
4
+ export { QAService } from './qa/qa-service';
5
+ export type { QAServiceOptions, QAReviewResult } from './qa/qa-service';
6
+ export { AuditHook } from './reflection/hooks/audit-hook';
7
+ export { AgentHook } from './reflection/hooks/agent-hook';
8
+ export { TestHook } from './reflection/hooks/test-hook';
9
+ export { CommitHook } from './reflection/hooks/commit-hook';
10
+ export { BootstrapHook } from './reflection/hooks/bootstrap-hook';
11
+ export { HistoricalLoader } from './reflection/historical-loader';
12
+ export { LessonsMemoGenerator } from './reflection/lessons-memo-generator';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pipeline/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvF,YAAY,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAG1E,cAAc,iBAAiB,CAAC;AAGhC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGxE,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ // The coding pipeline: task classification (intent, domains, risk, policies, FSM), QA gates and the engine
3
+ // hooks that apply them (SPEC-0015). Import from '@backendkit-labs/agent-coding/pipeline'.
4
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ var desc = Object.getOwnPropertyDescriptor(m, k);
7
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
+ desc = { enumerable: true, get: function() { return m[k]; } };
9
+ }
10
+ Object.defineProperty(o, k2, desc);
11
+ }) : (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ o[k2] = m[k];
14
+ }));
15
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
17
+ };
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.LessonsMemoGenerator = exports.HistoricalLoader = exports.BootstrapHook = exports.CommitHook = exports.TestHook = exports.AgentHook = exports.AuditHook = exports.QAService = exports.buildOrchestrationBrief = exports.codingPipelineHooks = void 0;
20
+ // Engine hooks
21
+ var coding_pipeline_hooks_1 = require("./coding-pipeline-hooks");
22
+ Object.defineProperty(exports, "codingPipelineHooks", { enumerable: true, get: function () { return coding_pipeline_hooks_1.codingPipelineHooks; } });
23
+ Object.defineProperty(exports, "buildOrchestrationBrief", { enumerable: true, get: function () { return coding_pipeline_hooks_1.buildOrchestrationBrief; } });
24
+ // Orchestrator, FSM, audit
25
+ __exportStar(require("./orchestration"), exports);
26
+ // QA
27
+ var qa_service_1 = require("./qa/qa-service");
28
+ Object.defineProperty(exports, "QAService", { enumerable: true, get: function () { return qa_service_1.QAService; } });
29
+ // Learning hooks tied to the pipeline's audit trail
30
+ var audit_hook_1 = require("./reflection/hooks/audit-hook");
31
+ Object.defineProperty(exports, "AuditHook", { enumerable: true, get: function () { return audit_hook_1.AuditHook; } });
32
+ var agent_hook_1 = require("./reflection/hooks/agent-hook");
33
+ Object.defineProperty(exports, "AgentHook", { enumerable: true, get: function () { return agent_hook_1.AgentHook; } });
34
+ var test_hook_1 = require("./reflection/hooks/test-hook");
35
+ Object.defineProperty(exports, "TestHook", { enumerable: true, get: function () { return test_hook_1.TestHook; } });
36
+ var commit_hook_1 = require("./reflection/hooks/commit-hook");
37
+ Object.defineProperty(exports, "CommitHook", { enumerable: true, get: function () { return commit_hook_1.CommitHook; } });
38
+ var bootstrap_hook_1 = require("./reflection/hooks/bootstrap-hook");
39
+ Object.defineProperty(exports, "BootstrapHook", { enumerable: true, get: function () { return bootstrap_hook_1.BootstrapHook; } });
40
+ var historical_loader_1 = require("./reflection/historical-loader");
41
+ Object.defineProperty(exports, "HistoricalLoader", { enumerable: true, get: function () { return historical_loader_1.HistoricalLoader; } });
42
+ var lessons_memo_generator_1 = require("./reflection/lessons-memo-generator");
43
+ Object.defineProperty(exports, "LessonsMemoGenerator", { enumerable: true, get: function () { return lessons_memo_generator_1.LessonsMemoGenerator; } });
44
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/pipeline/index.ts"],"names":[],"mappings":";AAAA,2GAA2G;AAC3G,2FAA2F;;;;;;;;;;;;;;;;;AAE3F,eAAe;AACf,iEAAuF;AAA9E,4HAAA,mBAAmB,OAAA;AAAE,gIAAA,uBAAuB,OAAA;AAGrD,2BAA2B;AAC3B,kDAAgC;AAEhC,KAAK;AACL,8CAA4C;AAAnC,uGAAA,SAAS,OAAA;AAGlB,oDAAoD;AACpD,4DAA0D;AAAjD,uGAAA,SAAS,OAAA;AAClB,4DAA0D;AAAjD,uGAAA,SAAS,OAAA;AAClB,0DAAwD;AAA/C,qGAAA,QAAQ,OAAA;AACjB,8DAA4D;AAAnD,yGAAA,UAAU,OAAA;AACnB,oEAAkE;AAAzD,+GAAA,aAAa,OAAA;AACtB,oEAAkE;AAAzD,qHAAA,gBAAgB,OAAA;AACzB,8EAA2E;AAAlE,8HAAA,oBAAoB,OAAA"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Regression test: agent IDs emitted by policy-engine and gate-resolver must
3
+ * match the canonical IDs registered in profiles (no "-agent" suffix).
4
+ *
5
+ * Background: policy-engine and gate-resolver previously used 'architecture-agent'
6
+ * and 'security-agent' while profiles register 'architecture' and 'security'.
7
+ * That mismatch caused duplicate entries in selectAgents() and potential
8
+ * "Agent not found" errors on LLM delegation (AgentEngine.ts:657).
9
+ */
10
+ export {};
11
+ //# sourceMappingURL=agent-id-consistency.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-id-consistency.test.d.ts","sourceRoot":"","sources":["../../../../src/pipeline/orchestration/__tests__/agent-id-consistency.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ /**
3
+ * Regression test: agent IDs emitted by policy-engine and gate-resolver must
4
+ * match the canonical IDs registered in profiles (no "-agent" suffix).
5
+ *
6
+ * Background: policy-engine and gate-resolver previously used 'architecture-agent'
7
+ * and 'security-agent' while profiles register 'architecture' and 'security'.
8
+ * That mismatch caused duplicate entries in selectAgents() and potential
9
+ * "Agent not found" errors on LLM delegation (AgentEngine.ts:657).
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const policy_engine_1 = require("../policy-engine");
13
+ const gate_resolver_1 = require("../gate-resolver");
14
+ const task_context_1 = require("../task-context");
15
+ const types_1 = require("../types");
16
+ // ── Canonical IDs registered by coding profiles ──────────────────────────────
17
+ const CANONICAL_IDS = new Set([
18
+ 'general', 'coder', 'backend', 'frontend',
19
+ 'qa-engineer', 'security', 'architecture',
20
+ 'infrastructure', 'data', 'project-manager',
21
+ ]);
22
+ function hasAgentSuffix(id) {
23
+ return id.endsWith('-agent');
24
+ }
25
+ // ── Helpers ───────────────────────────────────────────────────────────────────
26
+ function taskWith(overrides) {
27
+ return { ...(0, task_context_1.createTaskContext)('test'), status: 'classified', ...overrides };
28
+ }
29
+ function emptyPolicy() {
30
+ return { mustInclude: [], requiredGates: [], mustExecute: [], customGates: [], appliedRules: [] };
31
+ }
32
+ // ── Tests ─────────────────────────────────────────────────────────────────────
33
+ describe('agent ID consistency — no -agent suffix', () => {
34
+ describe('evaluatePolicies DEFAULT_RULES', () => {
35
+ const cases = [
36
+ { label: 'actionType=design', task: { actionType: 'design' } },
37
+ { label: 'actionType=security_audit', task: { actionType: 'security_audit' } },
38
+ { label: 'riskLevel=high', task: { riskLevel: 'high' } },
39
+ { label: 'riskLevel=critical', task: { riskLevel: 'critical' } },
40
+ { label: 'domain=security', task: { domains: ['security'] } },
41
+ {
42
+ label: 'breaking_change=true',
43
+ task: { riskFactors: { breaking_change: true, security_sensitive: false, cross_service_impact: false, db_transactional: false, production_critical: false, complexity: 5 } },
44
+ },
45
+ {
46
+ label: 'security_sensitive=true',
47
+ task: { riskFactors: { breaking_change: false, security_sensitive: true, cross_service_impact: false, db_transactional: false, production_critical: false, complexity: 5 } },
48
+ },
49
+ {
50
+ label: 'cross_service_impact=true',
51
+ task: { riskFactors: { breaking_change: false, security_sensitive: false, cross_service_impact: true, db_transactional: false, production_critical: false, complexity: 5 } },
52
+ },
53
+ ];
54
+ test.each(cases)('$label: mustInclude uses canonical IDs', ({ task }) => {
55
+ const result = (0, policy_engine_1.evaluatePolicies)(taskWith(task));
56
+ for (const id of result.mustInclude) {
57
+ expect(hasAgentSuffix(id)).toBe(false);
58
+ expect(CANONICAL_IDS.has(id)).toBe(true);
59
+ }
60
+ });
61
+ });
62
+ describe('resolveGates pipeline agentIds', () => {
63
+ it('security review phase uses canonical id', () => {
64
+ const task = taskWith({ requiresSecurityReview: true });
65
+ const { pipeline } = (0, gate_resolver_1.resolveGates)(task, emptyPolicy(), (0, types_1.defaultOrchestratorConfig)(), [
66
+ { agentId: 'backend', score: 80, reason: 'domain' },
67
+ ]);
68
+ const ids = pipeline.map(p => p.agentId);
69
+ expect(ids).not.toContain('security-agent');
70
+ expect(ids).toContain('security');
71
+ });
72
+ it('architecture review phase uses canonical id', () => {
73
+ const task = taskWith({ requiresArchitectureReview: true });
74
+ const { pipeline } = (0, gate_resolver_1.resolveGates)(task, emptyPolicy(), (0, types_1.defaultOrchestratorConfig)(), [
75
+ { agentId: 'backend', score: 80, reason: 'domain' },
76
+ ]);
77
+ const ids = pipeline.map(p => p.agentId);
78
+ expect(ids).not.toContain('architecture-agent');
79
+ expect(ids).toContain('architecture');
80
+ });
81
+ it('qa verify phase uses canonical id', () => {
82
+ const task = taskWith({ requiresQaApproval: true });
83
+ const { pipeline } = (0, gate_resolver_1.resolveGates)(task, emptyPolicy(), (0, types_1.defaultOrchestratorConfig)(), [
84
+ { agentId: 'backend', score: 80, reason: 'domain' },
85
+ ]);
86
+ const ids = pipeline.map(p => p.agentId);
87
+ expect(ids).not.toContain('qa-agent');
88
+ expect(ids).toContain('qa-engineer');
89
+ });
90
+ it('no pipeline entry uses a -agent suffix', () => {
91
+ const task = taskWith({
92
+ requiresSecurityReview: true,
93
+ requiresArchitectureReview: true,
94
+ requiresQaApproval: true,
95
+ });
96
+ const { pipeline } = (0, gate_resolver_1.resolveGates)(task, emptyPolicy(), (0, types_1.defaultOrchestratorConfig)(), [
97
+ { agentId: 'backend', score: 80, reason: 'domain' },
98
+ ]);
99
+ for (const phase of pipeline) {
100
+ expect(hasAgentSuffix(phase.agentId)).toBe(false);
101
+ }
102
+ });
103
+ });
104
+ });
105
+ //# sourceMappingURL=agent-id-consistency.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-id-consistency.test.js","sourceRoot":"","sources":["../../../../src/pipeline/orchestration/__tests__/agent-id-consistency.test.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AAEH,oDAAoD;AACpD,oDAAgD;AAChD,kDAAsE;AACtE,oCAAqD;AAGrD,gFAAgF;AAChF,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC;IAC1B,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU;IACzC,aAAa,EAAE,UAAU,EAAE,cAAc;IACzC,gBA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{"version":3,"file":"fsm-commit-skipped.test.d.ts","sourceRoot":"","sources":["../../../../src/pipeline/orchestration/__tests__/fsm-commit-skipped.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const fsm_1 = require("../fsm");
4
+ const task_context_1 = require("../task-context");
5
+ describe('TaskFSM — commit_skipped → commit_allowed', () => {
6
+ it('is reachable: the transition is listed and no guard blocks it', () => {
7
+ const fsm = new fsm_1.TaskFSM();
8
+ let task = (0, task_context_1.createTaskContext)('commit sin cambios');
9
+ task = (0, task_context_1.transitionTask)(task, 'commit_planning');
10
+ task = (0, task_context_1.transitionTask)(task, 'commit_skipped');
11
+ const result = fsm.transition(task, 'commit_allowed');
12
+ expect(result.allowed).toBe(true);
13
+ expect(result.task?.status).toBe('commit_allowed');
14
+ });
15
+ it('still refuses commit_allowed from states that never earned it', () => {
16
+ const fsm = new fsm_1.TaskFSM();
17
+ const task = (0, task_context_1.transitionTask)((0, task_context_1.createTaskContext)('x'), 'classified');
18
+ expect(fsm.transition(task, 'commit_allowed').allowed).toBe(false);
19
+ });
20
+ });
21
+ //# sourceMappingURL=fsm-commit-skipped.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fsm-commit-skipped.test.js","sourceRoot":"","sources":["../../../../src/pipeline/orchestration/__tests__/fsm-commit-skipped.test.ts"],"names":[],"mappings":";;AAAA,gCAAiC;AACjC,kDAAoE;AAEpE,QAAQ,CAAC,2CAA2C,EAAE,GAAG,EAAE;IACvD,EAAE,CAAC,+DAA+D,EAAE,GAAG,EAAE;QACrE,MAAM,GAAG,GAAG,IAAI,aAAO,EAAE,CAAC;QAC1B,IAAI,IAAI,GAAG,IAAA,gCAAiB,EAAC,oBAAoB,CAAC,CAAC;QACnD,IAAI,GAAG,IAAA,6BAAc,EAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;QAC/C,IAAI,GAAG,IAAA,6BAAc,EAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;QAC9C,MAAM,MAAM,GAAG,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;QACtD,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+DAA+D,EAAE,GAAG,EAAE;QACrE,MAAM,GAAG,GAAG,IAAI,aAAO,EAAE,CAAC;QAC1B,MAAM,IAAI,GAAG,IAAA,6BAAc,EAAC,IAAA,gCAAiB,EAAC,GAAG,CAAC,EAAE,YAAY,CAAC,CAAC;QAClE,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Tests for getCriticalPath / hasPassedGate (H-002).
3
+ *
4
+ * The previous implementation used linear index comparison which gave false
5
+ * positives: a task at 'implementation' that went classified→implementation
6
+ * (skipping design_review) was incorrectly reported as having passed design_review.
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=fsm-critical-path.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fsm-critical-path.test.d.ts","sourceRoot":"","sources":["../../../../src/pipeline/orchestration/__tests__/fsm-critical-path.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ /**
3
+ * Tests for getCriticalPath / hasPassedGate (H-002).
4
+ *
5
+ * The previous implementation used linear index comparison which gave false
6
+ * positives: a task at 'implementation' that went classified→implementation
7
+ * (skipping design_review) was incorrectly reported as having passed design_review.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ const fsm_1 = require("../fsm");
11
+ const task_context_1 = require("../task-context");
12
+ function task(status, flags = {}) {
13
+ return {
14
+ ...(0, task_context_1.createTaskContext)('test'),
15
+ status,
16
+ requiresArchitectureReview: flags.requiresArchitectureReview ?? false,
17
+ requiresSecurityReview: flags.requiresSecurityReview ?? false,
18
+ requiresQaApproval: flags.requiresQaApproval ?? false,
19
+ };
20
+ }
21
+ describe('getCriticalPath (H-002)', () => {
22
+ const fsm = new fsm_1.TaskFSM();
23
+ it('returns only current status when already at commit_allowed', () => {
24
+ expect(fsm.getCriticalPath(task('commit_allowed'))).toEqual(['commit_allowed']);
25
+ });
26
+ it('returns only current status when rejected', () => {
27
+ expect(fsm.getCriticalPath(task('rejected'))).toEqual(['rejected']);
28
+ });
29
+ it('task with no gates: new → classified → implementation → approved → commit_allowed', () => {
30
+ const path = fsm.getCriticalPath(task('new'));
31
+ expect(path).toContain('classified');
32
+ expect(path).toContain('approved');
33
+ expect(path).toContain('commit_allowed');
34
+ expect(path).not.toContain('design_review');
35
+ expect(path).not.toContain('security_review');
36
+ expect(path).not.toContain('qa_review');
37
+ });
38
+ // ── The core H-002 bug: false positive on hasPassedGate ──────────────────
39
+ it('task at implementation with requiresArchitectureReview still needs design_review in path', () => {
40
+ // classified → implementation is allowed by FSM (guard only blocks
41
+ // non-classified/non-design_review sources), so implementation does NOT
42
+ // guarantee design_review was visited.
43
+ const t = task('implementation', { requiresArchitectureReview: true });
44
+ const path = fsm.getCriticalPath(t);
45
+ expect(path).toContain('design_review');
46
+ });
47
+ it('task at security_review with requiresArchitectureReview still needs design_review in path', () => {
48
+ const t = task('security_review', { requiresArchitectureReview: true });
49
+ const path = fsm.getCriticalPath(t);
50
+ expect(path).toContain('design_review');
51
+ });
52
+ it('task at implementation with requiresSecurityReview still needs security_review in path', () => {
53
+ const t = task('implementation', { requiresSecurityReview: true });
54
+ const path = fsm.getCriticalPath(t);
55
+ expect(path).toContain('security_review');
56
+ });
57
+ it('task at implementation with requiresQaApproval still needs qa_review in path', () => {
58
+ const t = task('implementation', { requiresQaApproval: true });
59
+ const path = fsm.getCriticalPath(t);
60
+ expect(path).toContain('qa_review');
61
+ });
62
+ // ── Correct true positives: post-approval guarantees all gates done ───────
63
+ it('task at approved no longer needs qa_review in path', () => {
64
+ const t = task('approved', { requiresQaApproval: true });
65
+ const path = fsm.getCriticalPath(t);
66
+ expect(path).not.toContain('qa_review');
67
+ });
68
+ it('task at commit_planning no longer needs any gate in path', () => {
69
+ const t = task('commit_planning', {
70
+ requiresArchitectureReview: true,
71
+ requiresSecurityReview: true,
72
+ requiresQaApproval: true,
73
+ });
74
+ const path = fsm.getCriticalPath(t);
75
+ expect(path).not.toContain('design_review');
76
+ expect(path).not.toContain('security_review');
77
+ expect(path).not.toContain('qa_review');
78
+ });
79
+ // ── FSM guard: security_review guarantees when requiresSecurityReview ─────
80
+ it('task at qa_review with requiresSecurityReview no longer needs security_review in path', () => {
81
+ // FSM guard: requiresSecurityReview && to=qa_review && status≠security_review → blocked
82
+ // So if task is at qa_review AND requiresSecurityReview, security_review was visited.
83
+ const t = task('qa_review', { requiresSecurityReview: true });
84
+ const path = fsm.getCriticalPath(t);
85
+ expect(path).not.toContain('security_review');
86
+ });
87
+ it('task at qa_review WITHOUT requiresSecurityReview: security_review correctly absent from path', () => {
88
+ const t = task('qa_review', { requiresSecurityReview: false });
89
+ const path = fsm.getCriticalPath(t);
90
+ expect(path).not.toContain('security_review');
91
+ });
92
+ it('path always ends with approved and commit_allowed for in-progress tasks', () => {
93
+ const t = task('classified', { requiresQaApproval: true });
94
+ const path = fsm.getCriticalPath(t);
95
+ const last = path[path.length - 1];
96
+ const secondLast = path[path.length - 2];
97
+ expect(last).toBe('commit_allowed');
98
+ expect(secondLast).toBe('approved');
99
+ });
100
+ });
101
+ //# sourceMappingURL=fsm-critical-path.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fsm-critical-path.test.js","sourceRoot":"","sources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.ts","sourceRoot":"","sources":["../../../../src/pipeline/orchestration/__tests__/fsm-rework-and-regression.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const fsm_1 = require("../fsm");
4
+ const task_context_1 = require("../task-context");
5
+ const inQaReview = () => {
6
+ let t = (0, task_context_1.createTaskContext)('x');
7
+ for (const s of ['classified', 'implementation', 'qa_review'])
8
+ t = (0, task_context_1.transitionTask)(t, s);
9
+ return t;
10
+ };
11
+ describe('TaskFSM — approved no longer regresses to implementation', () => {
12
+ it('refuses approved → implementation but still allows rework_required', () => {
13
+ const fsm = new fsm_1.TaskFSM();
14
+ const approved = (0, task_context_1.transitionTask)(inQaReview(), 'approved');
15
+ expect(fsm.transition(approved, 'implementation').allowed).toBe(false);
16
+ expect(fsm.getAvailableTransitions('approved')).not.toContain('implementation');
17
+ });
18
+ });
19
+ describe('TaskFSM — rework cap', () => {
20
+ const cycle = (fsm, task) => {
21
+ const back = fsm.transition(task, 'rework_required');
22
+ if (!back.allowed)
23
+ return back;
24
+ return fsm.transition((0, task_context_1.transitionTask)(back.task, 'qa_review'), 'rework_required');
25
+ };
26
+ it('counts each entry into rework_required', () => {
27
+ const fsm = new fsm_1.TaskFSM();
28
+ const r = fsm.transition(inQaReview(), 'rework_required');
29
+ expect(r.task?.reworkCount).toBe(1);
30
+ });
31
+ it('refuses the transition once the default limit is reached, with a clear error', () => {
32
+ const fsm = new fsm_1.TaskFSM();
33
+ let task = inQaReview();
34
+ for (let i = 0; i < fsm_1.DEFAULT_MAX_REWORK; i++) {
35
+ const r = fsm.transition(task, 'rework_required');
36
+ expect(r.allowed).toBe(true);
37
+ task = (0, task_context_1.transitionTask)(r.task, 'qa_review');
38
+ }
39
+ const over = fsm.transition(task, 'rework_required');
40
+ expect(over.allowed).toBe(false);
41
+ expect(over.error).toMatch(/Límite de rework alcanzado \(5\)/);
42
+ expect(fsm.transition(task, 'rejected').allowed).toBe(true);
43
+ });
44
+ it('the limit is configurable', () => {
45
+ const fsm = new fsm_1.TaskFSM({ maxRework: 1 });
46
+ const first = fsm.transition(inQaReview(), 'rework_required');
47
+ expect(first.allowed).toBe(true);
48
+ expect(cycle(fsm, first.task).allowed).toBe(false);
49
+ });
50
+ it('a task never reworked starts at zero (field is optional for existing callers)', () => {
51
+ expect(inQaReview().reworkCount).toBeUndefined();
52
+ });
53
+ });
54
+ //# sourceMappingURL=fsm-rework-and-regression.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fsm-rework-and-regression.test.js","sourceRoot":"","sources":["../../../../src/pipeline/orchestration/__tests__/fsm-rework-and-regression.test.ts"],"names":[],"mappings":";;AAAA,gCAAqD;AACrD,kDAAoE;AAGpE,MAAM,UAAU,GAAG,GAAgB,EAAE;IACjC,IAAI,CAAC,GAAG,IAAA,gCAAiB,EAAC,GAAG,CAAC,CAAC;IAC/B,KAAK,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,gBAAgB,EAAE,WAAW,CAAU;QAAE,CAAC,GAAG,IAAA,6BAAc,EAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACjG,OAAO,CAAC,CAAC;AACb,CAAC,CAAC;AAEF,QAAQ,CAAC,0DAA0D,EAAE,GAAG,EAAE;IACtE,EAAE,CAAC,oEAAoE,EAAE,GAAG,EAAE;QAC1E,MAAM,GAAG,GAAG,IAAI,aAAO,EAAE,CAAC;QAC1B,MAAM,QAAQ,GAAG,IAAA,6BAAc,EAAC,UAAU,EAAE,EAAE,UAAU,CAAC,CAAC;QAC1D,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACvE,MAAM,CAAC,GAAG,CAAC,uBAAuB,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;IACpF,CAAC,CAAC,CAA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AAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;QACrD,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACjC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,kCAAkC,CAAC,CAAC;QAC/D,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;QACjC,MAAM,GAAG,GAAG,IAAI,aAAO,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC;QAC1C,MAAM,KAAK,GAAG,GAAG,CAAC,UAAU,CAAC,UAAU,EAAE,EAAE,iBAAiB,CAAC,CAAC;QAC9D,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,IAAK,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+EAA+E,EAAE,GAAG,EAAE;QACrF,MAAM,CAAC,UAAU,EAAE,CAAC,WAAW,CAAC,CAAC,aAAa,EAAE,CAAC;IACrD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=intent-detector-llm.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intent-detector-llm.test.d.ts","sourceRoot":"","sources":["../../../../src/pipeline/orchestration/__tests__/intent-detector-llm.test.ts"],"names":[],"mappings":""}