agentic-qe 3.8.13 → 3.9.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 (359) hide show
  1. package/.claude/skills/skills-manifest.json +1 -1
  2. package/CHANGELOG.md +48 -0
  3. package/dist/adapters/a2ui/integration/agui-sync.js +2 -1
  4. package/dist/audit/witness-chain.js +15 -3
  5. package/dist/boot/fast-paths.d.ts +24 -0
  6. package/dist/boot/fast-paths.js +43 -0
  7. package/dist/boot/parallel-prefetch.d.ts +26 -0
  8. package/dist/boot/parallel-prefetch.js +36 -0
  9. package/dist/cli/bundle.js +12 -9431
  10. package/dist/cli/chunks/adapter-WBR5NXS3.js +2 -0
  11. package/dist/cli/chunks/agent-booster-wasm-PQYB7VRU.js +2 -0
  12. package/dist/cli/chunks/agent-handler-QDAB5NQS.js +33 -0
  13. package/dist/cli/chunks/aqe-learning-engine-TK4JQCGT.js +2 -0
  14. package/dist/cli/chunks/audit-S7JUYYVP.js +3 -0
  15. package/dist/cli/chunks/base-2WXOSMBQ.js +2 -0
  16. package/dist/cli/chunks/better-sqlite3-7KY2RDXO.js +2 -0
  17. package/dist/cli/chunks/brain-handler-PPEGDCN4.js +68 -0
  18. package/dist/cli/chunks/branch-enumerator-XK4V5W7L.js +7 -0
  19. package/dist/cli/chunks/browser-PALA5PL3.js +4 -0
  20. package/dist/cli/chunks/browser-workflow-42F7GK5T.js +2 -0
  21. package/dist/cli/chunks/chunk-24FKIJNC.js +15 -0
  22. package/dist/cli/chunks/chunk-263XS447.js +2 -0
  23. package/dist/cli/chunks/chunk-2BZFNEN2.js +4 -0
  24. package/dist/cli/chunks/chunk-2E5NQNSU.js +180 -0
  25. package/dist/cli/chunks/chunk-2I7J3O6V.js +2 -0
  26. package/dist/cli/chunks/chunk-3ADGXLTM.js +14 -0
  27. package/dist/cli/chunks/chunk-3IHG3WOY.js +12 -0
  28. package/dist/cli/chunks/chunk-3IUNFTIF.js +2 -0
  29. package/dist/cli/chunks/chunk-3JPRUND5.js +2 -0
  30. package/dist/cli/chunks/chunk-3NZLZHJI.js +2 -0
  31. package/dist/cli/chunks/chunk-3THRQEZ2.js +95 -0
  32. package/dist/cli/chunks/chunk-3ZOONQG6.js +2 -0
  33. package/dist/cli/chunks/chunk-4B6NCELM.js +2 -0
  34. package/dist/cli/chunks/chunk-4I2IOUS4.js +2 -0
  35. package/dist/cli/chunks/chunk-4VBTXZRM.js +2 -0
  36. package/dist/cli/chunks/chunk-4VUPRTVX.js +3 -0
  37. package/dist/cli/chunks/chunk-4YOMLWEK.js +70 -0
  38. package/dist/cli/chunks/chunk-4YS3IJ45.js +2 -0
  39. package/dist/cli/chunks/chunk-5SKGFSKD.js +2 -0
  40. package/dist/cli/chunks/chunk-5T2ZQWKF.js +27 -0
  41. package/dist/cli/chunks/chunk-62ADTHV7.js +2 -0
  42. package/dist/cli/chunks/chunk-6EOS7KX2.js +2 -0
  43. package/dist/cli/chunks/chunk-6SVX4DJC.js +6 -0
  44. package/dist/cli/chunks/chunk-72WOAVK6.js +2 -0
  45. package/dist/cli/chunks/chunk-7R6YMLVS.js +3 -0
  46. package/dist/cli/chunks/chunk-7VDBAVTY.js +2 -0
  47. package/dist/cli/chunks/chunk-AFLLQ5PP.js +15 -0
  48. package/dist/cli/chunks/chunk-AKE543X2.js +2 -0
  49. package/dist/cli/chunks/chunk-B36CDR4U.js +2 -0
  50. package/dist/cli/chunks/chunk-B6LLWYQ6.js +2 -0
  51. package/dist/cli/chunks/chunk-BDIEMZ22.js +91 -0
  52. package/dist/cli/chunks/chunk-BGXNSCXX.js +4 -0
  53. package/dist/cli/chunks/chunk-BLBRY5UD.js +2 -0
  54. package/dist/cli/chunks/chunk-BPWXXEH2.js +3029 -0
  55. package/dist/cli/chunks/chunk-BR26T7ZS.js +180 -0
  56. package/dist/cli/chunks/chunk-BTREG4IW.js +2 -0
  57. package/dist/cli/chunks/chunk-BULKFVYX.js +2 -0
  58. package/dist/cli/chunks/chunk-BXAXGEFC.js +24 -0
  59. package/dist/cli/chunks/chunk-CL6POIX4.js +2 -0
  60. package/dist/cli/chunks/chunk-CS2KS7LP.js +2 -0
  61. package/dist/cli/chunks/chunk-CWFB6BSA.js +316 -0
  62. package/dist/cli/chunks/chunk-DRT3WKQW.js +2 -0
  63. package/dist/cli/chunks/chunk-EHDQJQ6Y.js +27 -0
  64. package/dist/cli/chunks/chunk-ESVQ6MEB.js +2 -0
  65. package/dist/cli/chunks/chunk-FEKY7T6Q.js +2 -0
  66. package/dist/cli/chunks/chunk-FGA7VIFR.js +7 -0
  67. package/dist/cli/chunks/chunk-FIA6X7UL.js +2 -0
  68. package/dist/cli/chunks/chunk-GAOJV3OX.js +2 -0
  69. package/dist/cli/chunks/chunk-GKNNSCLC.js +5 -0
  70. package/dist/cli/chunks/chunk-GPQ57KA4.js +2 -0
  71. package/dist/cli/chunks/chunk-GRUUQAR6.js +2 -0
  72. package/dist/cli/chunks/chunk-HRO6OZQD.js +2 -0
  73. package/dist/cli/chunks/chunk-HY6PMO5W.js +66 -0
  74. package/dist/cli/chunks/chunk-IAV2JMIX.js +167 -0
  75. package/dist/cli/chunks/chunk-IFNIIK34.js +21 -0
  76. package/dist/cli/chunks/chunk-IGJPMN4I.js +3 -0
  77. package/dist/cli/chunks/chunk-J3KWWR6Z.js +1 -0
  78. package/dist/cli/chunks/chunk-JBANAPWG.js +2 -0
  79. package/dist/cli/chunks/chunk-JJO7Y4H3.js +604 -0
  80. package/dist/cli/chunks/chunk-JRYGQO2W.js +2 -0
  81. package/dist/cli/chunks/chunk-JXM26HEE.js +2 -0
  82. package/dist/cli/chunks/chunk-JZSDOIXA.js +2 -0
  83. package/dist/cli/chunks/chunk-KP5NUODU.js +3 -0
  84. package/dist/cli/chunks/chunk-LHJQD2VU.js +750 -0
  85. package/dist/cli/chunks/chunk-LNQIY6BP.js +2 -0
  86. package/dist/cli/chunks/chunk-MDUHYUHF.js +2 -0
  87. package/dist/cli/chunks/chunk-MV6CMOJQ.js +65 -0
  88. package/dist/cli/chunks/chunk-MZOFWJTM.js +2 -0
  89. package/dist/cli/chunks/chunk-N2NS2PHA.js +45 -0
  90. package/dist/cli/chunks/chunk-N4TL73TH.js +314 -0
  91. package/dist/cli/chunks/chunk-N5UXCLFI.js +2 -0
  92. package/dist/cli/chunks/chunk-NZ2VCPN4.js +2 -0
  93. package/dist/cli/chunks/chunk-OF4D7MYI.js +2 -0
  94. package/dist/cli/chunks/chunk-OI5NGQO2.js +2 -0
  95. package/dist/cli/chunks/chunk-OLHKGP35.js +2 -0
  96. package/dist/cli/chunks/chunk-QOVHWZEP.js +1 -0
  97. package/dist/cli/chunks/chunk-RFSN6IDA.js +79 -0
  98. package/dist/cli/chunks/chunk-RTGGL7D7.js +4 -0
  99. package/dist/cli/chunks/chunk-RU5WAHB7.js +3 -0
  100. package/dist/cli/chunks/chunk-SUSEVMZT.js +2 -0
  101. package/dist/cli/chunks/chunk-TLHP5EII.js +2 -0
  102. package/dist/cli/chunks/chunk-TWUWL5EJ.js +2 -0
  103. package/dist/cli/chunks/chunk-U5RN7YQW.js +2 -0
  104. package/dist/cli/chunks/chunk-UFUVUO3J.js +2 -0
  105. package/dist/cli/chunks/chunk-UQHYFOBX.js +16 -0
  106. package/dist/cli/chunks/chunk-VOS4NQSF.js +2 -0
  107. package/dist/cli/chunks/chunk-VSVXUTJN.js +256 -0
  108. package/dist/cli/chunks/chunk-WBQSXPBI.js +2 -0
  109. package/dist/cli/chunks/chunk-WGMPEW2T.js +2 -0
  110. package/dist/cli/chunks/chunk-WIEC7VKK.js +2 -0
  111. package/dist/cli/chunks/chunk-WJ3DLOXF.js +14 -0
  112. package/dist/cli/chunks/chunk-X3KI6JOY.js +9 -0
  113. package/dist/cli/chunks/chunk-X5IJGWYG.js +2 -0
  114. package/dist/cli/chunks/chunk-XIBDETCS.js +146 -0
  115. package/dist/cli/chunks/chunk-XLRQYLWW.js +2 -0
  116. package/dist/cli/chunks/chunk-XO6PVK2P.js +3 -0
  117. package/dist/cli/chunks/chunk-XRE2HCWG.js +3 -0
  118. package/dist/cli/chunks/chunk-XT2V2322.js +2 -0
  119. package/dist/cli/chunks/chunk-Y7BHKZFJ.js +18 -0
  120. package/dist/cli/chunks/chunk-YAGODYIG.js +59 -0
  121. package/dist/cli/chunks/chunk-YANUP2RO.js +2 -0
  122. package/dist/cli/chunks/chunk-YPFOCNOE.js +30 -0
  123. package/dist/cli/chunks/chunk-YR6ZZGH7.js +81 -0
  124. package/dist/cli/chunks/chunk-YVA65UZL.js +2 -0
  125. package/dist/cli/chunks/chunk-YW2THB5Q.js +2 -0
  126. package/dist/cli/chunks/chunk-ZAPS3UGQ.js +20 -0
  127. package/dist/cli/chunks/chunk-ZDATDCYN.js +2 -0
  128. package/dist/cli/chunks/ci-J374KDLI.js +81 -0
  129. package/dist/cli/chunks/ci-output-7JN7F6CI.js +2 -0
  130. package/dist/cli/chunks/claude-flow-setup-245JLJCN.js +2 -0
  131. package/dist/cli/chunks/client-MCSNSH2C.js +2 -0
  132. package/dist/cli/chunks/cline-installer-LBA2M5N3.js +4 -0
  133. package/dist/cli/chunks/code-U4N4WONM.js +38 -0
  134. package/dist/cli/chunks/code-index-extractor-A57Z6BO4.js +3 -0
  135. package/dist/cli/chunks/codex-installer-UXMK2N4T.js +8 -0
  136. package/dist/cli/chunks/completions-W66BSCOE.js +1364 -0
  137. package/dist/cli/chunks/complexity-analyzer-AB4OZARV.js +2 -0
  138. package/dist/cli/chunks/continuedev-installer-LRFZ2SJM.js +14 -0
  139. package/dist/cli/chunks/copilot-installer-CQ3JYBIB.js +3 -0
  140. package/dist/cli/chunks/cost-tracker-4F723RB6.js +2 -0
  141. package/dist/cli/chunks/coverage-4PUEQXAY.js +27 -0
  142. package/dist/cli/chunks/cross-domain-router-OWR5IJ5G.js +2 -0
  143. package/dist/cli/chunks/cursor-installer-JZEDEDHA.js +3 -0
  144. package/dist/cli/chunks/daemon-B7TWGHXQ.js +19 -0
  145. package/dist/cli/chunks/dag-attention-scheduler-JWO6XI6A.js +2 -0
  146. package/dist/cli/chunks/detect-L6ZZHUSX.js +2 -0
  147. package/dist/cli/chunks/domain-handler-FT5FLZWL.js +25 -0
  148. package/dist/cli/chunks/domain-transfer-5Y4FGJAJ.js +2 -0
  149. package/dist/cli/chunks/dream-4TDBIYED.js +2 -0
  150. package/dist/cli/chunks/esm-node-2PKHKOTS.js +2 -0
  151. package/dist/cli/chunks/eval-GHMPFGWV.js +15 -0
  152. package/dist/cli/chunks/fast-paths-B3R647KN.js +2 -0
  153. package/dist/cli/chunks/feature-flags-DWS7ARSX.js +2 -0
  154. package/dist/cli/chunks/feature-flags-IVQ3AL4Q.js +2 -0
  155. package/dist/cli/chunks/file-discovery-QFPA6GMV.js +2 -0
  156. package/dist/cli/chunks/fleet-EKOKMOMW.js +43 -0
  157. package/dist/cli/chunks/gnn-wrapper-OYC55N5E.js +2 -0
  158. package/dist/cli/chunks/heartbeat-handler-MBBS4IBU.js +48 -0
  159. package/dist/cli/chunks/heartbeat-scheduler-XDGMOT7X.js +2 -0
  160. package/dist/cli/chunks/hnsw-index-YO7CT23I.js +2 -0
  161. package/dist/cli/chunks/hnswlib-node-56YWVXFE.js +2 -0
  162. package/dist/cli/chunks/hooks-L5VLZGEK.js +101 -0
  163. package/dist/cli/chunks/hypergraph-engine-A4Y2ZRAG.js +2 -0
  164. package/dist/cli/chunks/hypergraph-handler-3HDGB5SZ.js +35 -0
  165. package/dist/cli/chunks/impact-analyzer-UEIGXSZ4.js +2 -0
  166. package/dist/cli/chunks/init-handler-JDET6WUN.js +68 -0
  167. package/dist/cli/chunks/init-wizard-JWZUGIPJ.js +2 -0
  168. package/dist/cli/chunks/kernel-YNDTVKIW.js +2 -0
  169. package/dist/cli/chunks/kilocode-installer-GZZG5AFW.js +4 -0
  170. package/dist/cli/chunks/kiro-installer-IWNY5TKH.js +74 -0
  171. package/dist/cli/chunks/knowledge-graph-NGJKFTSN.js +2 -0
  172. package/dist/cli/chunks/learning-722ZNSZ6.js +107 -0
  173. package/dist/cli/chunks/llm-router-DNAV746L.js +30 -0
  174. package/dist/cli/chunks/load-Y3GCUFM4.js +2 -0
  175. package/dist/cli/chunks/load-test-GZUBXFF3.js +2 -0
  176. package/dist/cli/chunks/mcp-LKPIBZ3W.js +2 -0
  177. package/dist/cli/chunks/memory-L57MLFOP.js +32 -0
  178. package/dist/cli/chunks/memory-backend-3NQIZUXE.js +2 -0
  179. package/dist/cli/chunks/memory-handlers-MDZQ7HVW.js +2 -0
  180. package/dist/cli/chunks/opencode-installer-4HUB36H5.js +3 -0
  181. package/dist/cli/chunks/orchestrator-QHSBB2UC.js +371 -0
  182. package/dist/cli/chunks/pipeline-D3QER35Z.js +19 -0
  183. package/dist/cli/chunks/platform-T4E7Q3RD.js +2 -0
  184. package/dist/cli/chunks/plugin-JHW2YPRC.js +27 -0
  185. package/dist/cli/chunks/prime-radiant-advanced-wasm-G7CFNNQV.js +2 -0
  186. package/dist/cli/chunks/protocol-executor-SPUVRDWT.js +2 -0
  187. package/dist/cli/chunks/protocol-handler-2BQQ4HDM.js +20 -0
  188. package/dist/cli/chunks/prove-UQ6JFT73.js +3 -0
  189. package/dist/cli/chunks/qe-reasoning-bank-3HBK2FVD.js +2 -0
  190. package/dist/cli/chunks/quality-JRZYMC77.js +7 -0
  191. package/dist/cli/chunks/queen-coordinator-RW3NKO5A.js +2 -0
  192. package/dist/cli/chunks/real-embeddings-GK63VF35.js +2 -0
  193. package/dist/cli/chunks/roocode-installer-F4E2LAYR.js +4 -0
  194. package/dist/cli/chunks/router-RJGHWDQ3.js +2 -0
  195. package/dist/cli/chunks/routing-feedback-ZXBXFKX6.js +2 -0
  196. package/dist/cli/chunks/routing-handler-VNKFUUGB.js +20 -0
  197. package/dist/cli/chunks/ruvector-commands-2TLNHC3A.js +8 -0
  198. package/dist/cli/chunks/rvf-dual-writer-MQW2SJLT.js +2 -0
  199. package/dist/cli/chunks/rvf-native-adapter-LKFKTMUN.js +2 -0
  200. package/dist/cli/chunks/safe-db-G22E5ROA.js +2 -0
  201. package/dist/cli/chunks/schedule-Y7VVCPYV.js +2 -0
  202. package/dist/cli/chunks/scheduler-AUQIFQB7.js +2 -0
  203. package/dist/cli/chunks/security-EBEG2OPU.js +14 -0
  204. package/dist/cli/chunks/shared-rvf-dual-writer-BVSCQAFS.js +2 -0
  205. package/dist/cli/chunks/sqlite-persistence-JAVHUGGL.js +2 -0
  206. package/dist/cli/chunks/status-handler-VZ32M4G4.js +45 -0
  207. package/dist/cli/chunks/structural-health-K6LRCKV6.js +2 -0
  208. package/dist/cli/chunks/sync-MHSHNLIM.js +23 -0
  209. package/dist/cli/chunks/task-handler-JNOIBZ2G.js +49 -0
  210. package/dist/cli/chunks/task-handlers-P5DSUKND.js +2 -0
  211. package/dist/cli/chunks/test-DO22BNIL.js +33 -0
  212. package/dist/cli/chunks/test-scheduling-VLRQZEFL.js +15 -0
  213. package/dist/cli/chunks/token-bootstrap-4VJKGVMK.js +2 -0
  214. package/dist/cli/chunks/token-usage-LG3PXRXH.js +25 -0
  215. package/dist/cli/chunks/transformers-GY7SIKEU.js +2 -0
  216. package/dist/cli/chunks/tree-sitter-wasm-parser-FT2KB66N.js +2 -0
  217. package/dist/cli/chunks/types-QJGNBKP2.js +2 -0
  218. package/dist/cli/chunks/unified-memory-XYGENQUT.js +2 -0
  219. package/dist/cli/chunks/unified-memory-hnsw-MVEGQBF3.js +2 -0
  220. package/dist/cli/chunks/unified-persistence-PFRCWEUG.js +2 -0
  221. package/dist/cli/chunks/validate-VQCRSVNQ.js +21 -0
  222. package/dist/cli/chunks/validate-swarm-A5DHAWTP.js +14 -0
  223. package/dist/cli/chunks/vibium-RZBSL4EB.js +2 -0
  224. package/dist/cli/chunks/visual-security-V47BLGJM.js +2 -0
  225. package/dist/cli/chunks/web-tree-sitter-7C4NXEOF.js +2 -0
  226. package/dist/cli/chunks/windsurf-installer-ES3KPQG3.js +7 -0
  227. package/dist/cli/chunks/witness-chain-BR63P4A7.js +2 -0
  228. package/dist/cli/chunks/workflow-JETHX4ML.js +51 -0
  229. package/dist/cli/chunks/workflow-orchestrator-7PZMX3JZ.js +2 -0
  230. package/dist/cli/chunks/wrappers-WP5RH745.js +2 -0
  231. package/dist/cli/commands/daemon.d.ts +13 -0
  232. package/dist/cli/commands/daemon.js +224 -0
  233. package/dist/cli/commands/hooks-handlers/hooks-shared.js +2 -1
  234. package/dist/cli/commands/plugin.d.ts +12 -0
  235. package/dist/cli/commands/plugin.js +135 -0
  236. package/dist/cli/commands/workflow.d.ts +10 -0
  237. package/dist/cli/commands/workflow.js +587 -0
  238. package/dist/cli/handlers/brain-handler.js +13 -8
  239. package/dist/cli/handlers/heartbeat-handler.d.ts +1 -0
  240. package/dist/cli/handlers/heartbeat-handler.js +20 -10
  241. package/dist/cli/handlers/hypergraph-handler.js +3 -3
  242. package/dist/cli/handlers/init-handler.js +10 -9
  243. package/dist/cli/handlers/interfaces.d.ts +4 -4
  244. package/dist/cli/index.js +159 -638
  245. package/dist/cli/lazy-registry.d.ts +27 -0
  246. package/dist/cli/lazy-registry.js +70 -0
  247. package/dist/context/compaction/context-budget.d.ts +71 -0
  248. package/dist/context/compaction/context-budget.js +120 -0
  249. package/dist/context/compaction/index.d.ts +96 -0
  250. package/dist/context/compaction/index.js +259 -0
  251. package/dist/context/compaction/llm-caller-adapter.d.ts +14 -0
  252. package/dist/context/compaction/llm-caller-adapter.js +47 -0
  253. package/dist/context/compaction/tier1-microcompact.d.ts +33 -0
  254. package/dist/context/compaction/tier1-microcompact.js +47 -0
  255. package/dist/context/compaction/tier2-session-summary.d.ts +72 -0
  256. package/dist/context/compaction/tier2-session-summary.js +172 -0
  257. package/dist/context/compaction/tier3-llm-compact.d.ts +65 -0
  258. package/dist/context/compaction/tier3-llm-compact.js +166 -0
  259. package/dist/context/compaction/tier4-reactive.d.ts +54 -0
  260. package/dist/context/compaction/tier4-reactive.js +129 -0
  261. package/dist/coordination/consensus/providers/claude-provider.d.ts +1 -0
  262. package/dist/coordination/consensus/providers/claude-provider.js +23 -3
  263. package/dist/domains/test-generation/generators/base-test-generator.d.ts +1 -1
  264. package/dist/domains/test-generation/generators/base-test-generator.js +11 -11
  265. package/dist/domains/test-generation/generators/go-test-generator.js +12 -12
  266. package/dist/domains/test-generation/generators/junit5-generator.js +9 -9
  267. package/dist/domains/test-generation/generators/kotlin-junit-generator.js +10 -10
  268. package/dist/domains/test-generation/generators/pytest-generator.js +8 -8
  269. package/dist/domains/test-generation/generators/swift-testing-generator.js +8 -8
  270. package/dist/domains/test-generation/generators/test-value-helpers.d.ts +20 -0
  271. package/dist/domains/test-generation/generators/test-value-helpers.js +48 -0
  272. package/dist/domains/test-generation/generators/xunit-generator.js +11 -11
  273. package/dist/hooks/cross-phase-hooks.d.ts +11 -0
  274. package/dist/hooks/cross-phase-hooks.js +73 -9
  275. package/dist/hooks/security/config-snapshot.d.ts +21 -0
  276. package/dist/hooks/security/config-snapshot.js +33 -0
  277. package/dist/hooks/security/exit-codes.d.ts +28 -0
  278. package/dist/hooks/security/exit-codes.js +33 -0
  279. package/dist/hooks/security/index.d.ts +15 -0
  280. package/dist/hooks/security/index.js +15 -0
  281. package/dist/hooks/security/ssrf-guard.d.ts +25 -0
  282. package/dist/hooks/security/ssrf-guard.js +69 -0
  283. package/dist/index.d.ts +1 -1
  284. package/dist/index.js +1 -2
  285. package/dist/init/init-wizard-hooks.js +15 -1
  286. package/dist/init/phases/07-hooks.js +2 -2
  287. package/dist/init/settings-merge.js +3 -7
  288. package/dist/kernel/kernel.js +35 -0
  289. package/dist/kernel/memory-backend.js +3 -1
  290. package/dist/mcp/bundle.js +416 -362
  291. package/dist/mcp/entry.js +132 -77
  292. package/dist/mcp/http-server.js +4 -1
  293. package/dist/mcp/index.d.ts +2 -2
  294. package/dist/mcp/index.js +5 -4
  295. package/dist/mcp/middleware/batch-executor.d.ts +46 -0
  296. package/dist/mcp/middleware/batch-executor.js +150 -0
  297. package/dist/mcp/middleware/microcompact.d.ts +97 -0
  298. package/dist/mcp/middleware/microcompact.js +179 -0
  299. package/dist/mcp/middleware/middleware-chain.d.ts +37 -0
  300. package/dist/mcp/middleware/middleware-chain.js +60 -0
  301. package/dist/mcp/protocol-server.d.ts +16 -0
  302. package/dist/mcp/protocol-server.js +140 -36
  303. package/dist/mcp/services/session-durability-middleware.d.ts +22 -0
  304. package/dist/mcp/services/session-durability-middleware.js +64 -0
  305. package/dist/mcp/services/session-resume.d.ts +29 -0
  306. package/dist/mcp/services/session-resume.js +221 -0
  307. package/dist/mcp/services/session-store.d.ts +84 -0
  308. package/dist/mcp/services/session-store.js +163 -0
  309. package/dist/mcp/tool-registry.d.ts +9 -0
  310. package/dist/mcp/tool-registry.js +30 -1
  311. package/dist/mcp/types.d.ts +1 -0
  312. package/dist/plugins/cache.d.ts +44 -0
  313. package/dist/plugins/cache.js +149 -0
  314. package/dist/plugins/index.d.ts +15 -0
  315. package/dist/plugins/index.js +15 -0
  316. package/dist/plugins/lifecycle.d.ts +67 -0
  317. package/dist/plugins/lifecycle.js +175 -0
  318. package/dist/plugins/manifest.d.ts +45 -0
  319. package/dist/plugins/manifest.js +173 -0
  320. package/dist/plugins/resolver.d.ts +37 -0
  321. package/dist/plugins/resolver.js +80 -0
  322. package/dist/plugins/security.d.ts +23 -0
  323. package/dist/plugins/security.js +125 -0
  324. package/dist/plugins/sources/github.d.ts +17 -0
  325. package/dist/plugins/sources/github.js +77 -0
  326. package/dist/plugins/sources/local.d.ts +20 -0
  327. package/dist/plugins/sources/local.js +32 -0
  328. package/dist/plugins/sources/npm.d.ts +18 -0
  329. package/dist/plugins/sources/npm.js +82 -0
  330. package/dist/shared/llm/retry.d.ts +5 -2
  331. package/dist/shared/llm/retry.js +7 -3
  332. package/dist/shared/prompt-cache-latch.d.ts +41 -0
  333. package/dist/shared/prompt-cache-latch.js +63 -0
  334. package/dist/shared/retry-engine.d.ts +77 -0
  335. package/dist/shared/retry-engine.js +194 -0
  336. package/dist/workers/daemon.d.ts +8 -0
  337. package/dist/workers/daemon.js +13 -0
  338. package/dist/workers/quality-daemon/ci-monitor.d.ts +55 -0
  339. package/dist/workers/quality-daemon/ci-monitor.js +147 -0
  340. package/dist/workers/quality-daemon/coverage-delta.d.ts +72 -0
  341. package/dist/workers/quality-daemon/coverage-delta.js +135 -0
  342. package/dist/workers/quality-daemon/git-watcher.d.ts +51 -0
  343. package/dist/workers/quality-daemon/git-watcher.js +209 -0
  344. package/dist/workers/quality-daemon/index.d.ts +119 -0
  345. package/dist/workers/quality-daemon/index.js +343 -0
  346. package/dist/workers/quality-daemon/nightly-consolidation.d.ts +74 -0
  347. package/dist/workers/quality-daemon/nightly-consolidation.js +136 -0
  348. package/dist/workers/quality-daemon/notification-service.d.ts +67 -0
  349. package/dist/workers/quality-daemon/notification-service.js +178 -0
  350. package/dist/workers/quality-daemon/persistent-memory.d.ts +31 -0
  351. package/dist/workers/quality-daemon/persistent-memory.js +30 -0
  352. package/dist/workers/quality-daemon/priority-queue.d.ts +97 -0
  353. package/dist/workers/quality-daemon/priority-queue.js +126 -0
  354. package/dist/workers/quality-daemon/test-suggester.d.ts +50 -0
  355. package/dist/workers/quality-daemon/test-suggester.js +121 -0
  356. package/dist/workers/worker-manager.js +2 -1
  357. package/package.json +1 -1
  358. package/dist/mcp/server.d.ts +0 -46
  359. package/dist/mcp/server.js +0 -802
@@ -7,6 +7,13 @@
7
7
  */
8
8
  import { createStdioTransport, JSON_RPC_ERRORS, } from './transport';
9
9
  import { createToolRegistry } from './tool-registry';
10
+ import { MiddlewareChain } from './middleware/middleware-chain';
11
+ import { createMicrocompactMiddleware } from './middleware/microcompact';
12
+ import { SessionStore } from './services/session-store';
13
+ import { createSessionDurabilityMiddleware } from './services/session-durability-middleware';
14
+ import { withRetry } from '../shared/retry-engine';
15
+ import { CompactionPipeline } from '../context/compaction';
16
+ import { createLLMCompactCaller } from '../context/compaction/llm-caller-adapter';
10
17
  // AG-UI EventAdapter for streaming events
11
18
  import { createEventAdapter, } from '../adapters/ag-ui/index.js';
12
19
  import { handleFleetInit, handleFleetStatus, handleFleetHealth, handleAQEHealth, disposeFleet, handleTaskSubmit, handleTaskList, handleTaskStatus, handleTaskCancel, handleTaskOrchestrate,
@@ -29,6 +36,9 @@ import { registerMissingQETools } from './qe-tool-bridge.js';
29
36
  import { getConnectionPool, initializeConnectionPool, shutdownConnectionPool, } from './connection-pool';
30
37
  import { getLoadBalancer, } from './load-balancer';
31
38
  import { getPerformanceMonitor, } from './performance-monitor';
39
+ import { createRequire } from 'module';
40
+ const _require = createRequire(import.meta.url);
41
+ const _pkg = _require('../../package.json');
32
42
  // ============================================================================
33
43
  // MCP Protocol Server
34
44
  // ============================================================================
@@ -45,13 +55,19 @@ export class MCPProtocolServer {
45
55
  monitor = getPerformanceMonitor();
46
56
  // AG-UI EventAdapter for streaming events to HTTP clients
47
57
  eventAdapter;
58
+ // IMP-00: Middleware chain for pre/post tool-call hooks
59
+ middlewareChain;
60
+ // IMP-04: Session durability store
61
+ sessionStore;
62
+ // IMP-08: 4-tier context compaction pipeline
63
+ compactionPipeline;
48
64
  // Connection recovery state
49
65
  reconnecting = false;
50
66
  pendingRequests = [];
51
67
  constructor(config = {}) {
52
68
  this.config = {
53
69
  name: config.name ?? 'agentic-qe-v3',
54
- version: config.version ?? '3.0.0',
70
+ version: config.version ?? _pkg.version,
55
71
  transport: config.transport ?? 'stdio',
56
72
  maxRequestSize: config.maxRequestSize ?? 10 * 1024 * 1024,
57
73
  };
@@ -61,6 +77,23 @@ export class MCPProtocolServer {
61
77
  this.registry = createToolRegistry();
62
78
  // Initialize AG-UI EventAdapter for streaming
63
79
  this.eventAdapter = createEventAdapter();
80
+ // IMP-00: Initialize middleware chain
81
+ this.middlewareChain = new MiddlewareChain();
82
+ // IMP-04: Initialize session store and register durability middleware
83
+ this.sessionStore = new SessionStore();
84
+ this.sessionStore.startSession();
85
+ this.middlewareChain.register(createSessionDurabilityMiddleware(this.sessionStore));
86
+ // IMP-01: Register microcompact middleware for stale result eviction
87
+ // Extract the engine so it can be shared with IMP-08's Tier 1
88
+ const microcompact = createMicrocompactMiddleware();
89
+ this.middlewareChain.register(microcompact.middleware);
90
+ // IMP-08: Initialize 4-tier compaction pipeline with shared microcompact engine
91
+ // and LLM caller for Tier 3 (falls back to extractive if no API key)
92
+ this.compactionPipeline = new CompactionPipeline({
93
+ sharedMicrocompactEngine: microcompact.engine,
94
+ llmCaller: createLLMCompactCaller(),
95
+ });
96
+ this.middlewareChain.register(this.compactionPipeline.createMiddleware());
64
97
  // Register all tools
65
98
  this.registerAllTools();
66
99
  }
@@ -116,52 +149,61 @@ export class MCPProtocolServer {
116
149
  if (this.reconnecting)
117
150
  return;
118
151
  this.reconnecting = true;
119
- const maxAttempts = 3;
120
- const baseDelay = 1000; // 1s, 2s, 4s
121
- for (let attempt = 0; attempt < maxAttempts; attempt++) {
122
- const delay = baseDelay * Math.pow(2, attempt);
123
- console.error(`[MCP] Reconnect attempt ${attempt + 1}/${maxAttempts} in ${delay}ms...`);
124
- await new Promise(r => setTimeout(r, delay));
125
- try {
126
- this.transport.reconnect();
127
- console.error(`[MCP] Reconnected after ${attempt + 1} attempt(s)`);
128
- this.reconnecting = false;
129
- // Replay any buffered requests
130
- const buffered = [...this.pendingRequests];
131
- this.pendingRequests = [];
132
- for (const { resolve, request } of buffered) {
133
- try {
134
- const result = await this.handleRequest(request);
135
- resolve(result);
136
- }
137
- catch (err) {
138
- console.error(`[MCP] Failed to replay buffered request: ${request.method}`);
139
- }
152
+ try {
153
+ // IMP-03: Use unified retry engine instead of hardcoded loop
154
+ const { attempts } = await withRetry(async () => { this.transport.reconnect(); }, {
155
+ maxAttempts: 3,
156
+ baseDelayMs: 1000,
157
+ maxDelayMs: 8000,
158
+ jitterFraction: 0.25,
159
+ onRetry: (attempt, _error, delayMs) => {
160
+ console.error(`[MCP] Reconnect attempt ${attempt + 1}/3 in ${Math.round(delayMs)}ms...`);
161
+ },
162
+ });
163
+ console.error(`[MCP] Reconnected after ${attempts} attempt(s)`);
164
+ this.reconnecting = false;
165
+ // Replay any buffered requests
166
+ const buffered = [...this.pendingRequests];
167
+ this.pendingRequests = [];
168
+ for (const { resolve, request } of buffered) {
169
+ try {
170
+ const result = await this.handleRequest(request);
171
+ resolve(result);
172
+ }
173
+ catch (err) {
174
+ console.error(`[MCP] Failed to replay buffered request: ${request.method}`);
140
175
  }
141
- return;
142
- }
143
- catch (err) {
144
- console.error(`[MCP] Reconnect attempt ${attempt + 1} failed: ${err instanceof Error ? err.message : err}`);
145
176
  }
146
177
  }
147
- this.reconnecting = false;
148
- console.error('[MCP] All reconnect attempts failed. Tools unavailable until transport is restored.');
149
- // Reject all buffered requests
150
- const buffered = [...this.pendingRequests];
151
- this.pendingRequests = [];
152
- for (const { reject } of buffered) {
153
- reject(new Error('MCP connection lost and reconnect failed'));
178
+ catch {
179
+ this.reconnecting = false;
180
+ console.error('[MCP] All reconnect attempts failed. Tools unavailable until transport is restored.');
181
+ // Reject all buffered requests
182
+ const buffered = [...this.pendingRequests];
183
+ this.pendingRequests = [];
184
+ for (const { reject } of buffered) {
185
+ reject(new Error('MCP connection lost and reconnect failed'));
186
+ }
154
187
  }
155
188
  }
156
189
  /**
157
190
  * Stop the MCP server
158
191
  */
159
192
  async stop() {
193
+ this.sessionStore.close(); // IMP-04: Flush session before shutdown
160
194
  this.transport.stop();
161
195
  await disposeFleet();
162
196
  await shutdownConnectionPool();
163
197
  console.error('[MCP] Server stopped');
164
198
  }
199
+ /** IMP-00: Register a middleware into the tool-call chain. */
200
+ registerMiddleware(mw) {
201
+ this.middlewareChain.register(mw);
202
+ }
203
+ /** IMP-00: Get registered middleware (for testing/introspection). */
204
+ getMiddleware() {
205
+ return this.middlewareChain.getRegistered();
206
+ }
165
207
  /**
166
208
  * Get server capabilities
167
209
  */
@@ -171,6 +213,12 @@ export class MCPProtocolServer {
171
213
  logging: {},
172
214
  };
173
215
  }
216
+ /**
217
+ * Get registered tool definitions (for testing and introspection)
218
+ */
219
+ getToolDefinitions() {
220
+ return Array.from(this.tools.values()).map(entry => entry.definition);
221
+ }
174
222
  /**
175
223
  * Get server info
176
224
  */
@@ -300,13 +348,24 @@ export class MCPProtocolServer {
300
348
  toolName: name,
301
349
  timestamp: new Date().toISOString(),
302
350
  });
351
+ // IMP-00: Build middleware context
352
+ const ctx = {
353
+ toolName: name,
354
+ params: args,
355
+ timestamp: Date.now(),
356
+ metadata: { stepId },
357
+ };
303
358
  try {
304
- const result = await tool.handler(args);
359
+ // IMP-00: Execute pre-tool-call middleware
360
+ const processedCtx = await this.middlewareChain.executePreHooks(ctx);
361
+ const result = await tool.handler(processedCtx.params);
305
362
  success = true;
363
+ // IMP-00: Execute post-tool-result middleware
364
+ const processedResult = await this.middlewareChain.executePostHooks(processedCtx, result);
306
365
  // Emit AG-UI result event for tool completion
307
366
  this.eventAdapter.adapt({
308
367
  success: true,
309
- data: result,
368
+ data: processedResult,
310
369
  metadata: {
311
370
  executionTime: performance.now() - startTime,
312
371
  requestId: stepId,
@@ -316,13 +375,29 @@ export class MCPProtocolServer {
316
375
  content: [
317
376
  {
318
377
  type: 'text',
319
- text: JSON.stringify(result, null, 2),
378
+ text: JSON.stringify(processedResult, null, 2),
320
379
  },
321
380
  ],
322
381
  };
323
382
  }
324
383
  catch (err) {
325
384
  const error = err;
385
+ // IMP-08: Detect context overflow (413) and trigger reactive compaction
386
+ const errorMsg = error.message || '';
387
+ const is413 = errorMsg.includes('413')
388
+ || errorMsg.includes('context_length_exceeded')
389
+ || errorMsg.includes('maximum context length')
390
+ || errorMsg.includes('too many tokens');
391
+ if (is413) {
392
+ try {
393
+ await this.compactionPipeline.handleOverflow('status_413');
394
+ }
395
+ catch {
396
+ // Compaction failed — continue with error response
397
+ }
398
+ }
399
+ // IMP-00: Execute error middleware
400
+ await this.middlewareChain.executeErrorHooks(ctx, error);
326
401
  // Emit AG-UI result event for tool failure
327
402
  this.eventAdapter.adapt({
328
403
  success: false,
@@ -371,6 +446,7 @@ export class MCPProtocolServer {
371
446
  name: 'fleet_status',
372
447
  description: 'Get fleet status: agents, tasks, health, and learning stats. Example: fleet_status({ verbose: true })',
373
448
  category: 'core',
449
+ isConcurrencySafe: true,
374
450
  parameters: [
375
451
  { name: 'verbose', type: 'boolean', description: 'Include detailed information', default: false },
376
452
  ],
@@ -382,6 +458,7 @@ export class MCPProtocolServer {
382
458
  name: 'fleet_health',
383
459
  description: 'Check fleet and per-domain health status with load metrics. Example: fleet_health({ domain: "test-generation" })',
384
460
  category: 'core',
461
+ isConcurrencySafe: true,
385
462
  parameters: [
386
463
  { name: 'domain', type: 'string', description: 'Specific domain to check' },
387
464
  ],
@@ -407,6 +484,7 @@ export class MCPProtocolServer {
407
484
  name: 'task_list',
408
485
  description: 'List tasks with optional status/limit filtering. Example: task_list({ status: "running", limit: 10 })',
409
486
  category: 'task',
487
+ isConcurrencySafe: true,
410
488
  parameters: [
411
489
  { name: 'status', type: 'string', description: 'Filter by status' },
412
490
  { name: 'limit', type: 'number', description: 'Maximum results', default: 50 },
@@ -419,6 +497,7 @@ export class MCPProtocolServer {
419
497
  name: 'task_status',
420
498
  description: 'Get detailed status, progress, and result of a specific task. Example: task_status({ taskId: "abc-123" })',
421
499
  category: 'task',
500
+ isConcurrencySafe: true,
422
501
  parameters: [
423
502
  { name: 'taskId', type: 'string', description: 'Task ID', required: true },
424
503
  ],
@@ -454,6 +533,7 @@ export class MCPProtocolServer {
454
533
  name: 'agent_list',
455
534
  description: 'List all active agents, optionally filtered by domain. Example: agent_list({ domain: "test-generation" })',
456
535
  category: 'agent',
536
+ isConcurrencySafe: true,
457
537
  parameters: [
458
538
  { name: 'domain', type: 'string', description: 'Filter by domain' },
459
539
  ],
@@ -477,6 +557,7 @@ export class MCPProtocolServer {
477
557
  name: 'agent_metrics',
478
558
  description: 'Get CPU, memory, and task performance metrics for agents. Example: agent_metrics({ agentId: "agent-1" })',
479
559
  category: 'agent',
560
+ isConcurrencySafe: true,
480
561
  parameters: [
481
562
  { name: 'agentId', type: 'string', description: 'Specific agent ID' },
482
563
  ],
@@ -488,6 +569,7 @@ export class MCPProtocolServer {
488
569
  name: 'agent_status',
489
570
  description: 'Get detailed status and current task of a specific agent. Example: agent_status({ agentId: "agent-1" })',
490
571
  category: 'agent',
572
+ isConcurrencySafe: true,
491
573
  parameters: [
492
574
  { name: 'agentId', type: 'string', description: 'Agent ID', required: true },
493
575
  ],
@@ -500,6 +582,7 @@ export class MCPProtocolServer {
500
582
  name: 'team_list',
501
583
  description: 'List all active domain teams and their agent counts. Example: team_list({ domain: "coverage-analysis" })',
502
584
  category: 'agent',
585
+ isConcurrencySafe: true,
503
586
  parameters: [
504
587
  { name: 'domain', type: 'string', description: 'Filter by domain' },
505
588
  ],
@@ -511,6 +594,7 @@ export class MCPProtocolServer {
511
594
  name: 'team_health',
512
595
  description: 'Get team health, agent utilization, and consensus status for a domain. Example: team_health({ domain: "security-compliance" })',
513
596
  category: 'agent',
597
+ isConcurrencySafe: true,
514
598
  parameters: [
515
599
  { name: 'domain', type: 'string', description: 'Domain to check', required: true },
516
600
  ],
@@ -599,6 +683,7 @@ export class MCPProtocolServer {
599
683
  name: 'coverage_analyze_sublinear',
600
684
  description: 'Analyze code coverage with O(log n) sublinear algorithm and ML-powered gap detection. Example: coverage_analyze_sublinear({ target: "src/", detectGaps: true })',
601
685
  category: 'domain',
686
+ isConcurrencySafe: true,
602
687
  parameters: [
603
688
  { name: 'target', type: 'string', description: 'Target path to analyze' },
604
689
  { name: 'detectGaps', type: 'boolean', description: 'Detect coverage gaps', default: true },
@@ -612,6 +697,7 @@ export class MCPProtocolServer {
612
697
  name: 'quality_assess',
613
698
  description: 'Assess code quality metrics and optionally run a pass/fail quality gate. Example: quality_assess({ runGate: true })',
614
699
  category: 'domain',
700
+ isConcurrencySafe: true,
615
701
  parameters: [
616
702
  { name: 'runGate', type: 'boolean', description: 'Run quality gate evaluation', default: false },
617
703
  ],
@@ -676,6 +762,7 @@ export class MCPProtocolServer {
676
762
  name: 'defect_predict',
677
763
  description: 'Predict potential defects using AI analysis of code complexity and change history. Example: defect_predict({ target: "src/auth/" })',
678
764
  category: 'domain',
765
+ isConcurrencySafe: true,
679
766
  parameters: [
680
767
  { name: 'target', type: 'string', description: 'Target path' },
681
768
  ],
@@ -688,6 +775,7 @@ export class MCPProtocolServer {
688
775
  name: 'requirements_validate',
689
776
  description: 'Validate requirements for completeness and generate BDD scenarios. Example: requirements_validate({ requirementsPath: "docs/requirements.md" })',
690
777
  category: 'domain',
778
+ isConcurrencySafe: true,
691
779
  parameters: [
692
780
  { name: 'requirementsPath', type: 'string', description: 'Path to requirements' },
693
781
  ],
@@ -700,6 +788,7 @@ export class MCPProtocolServer {
700
788
  name: 'code_index',
701
789
  description: 'Index source code into the knowledge graph for dependency and impact analysis. Example: code_index({ target: "src/" })',
702
790
  category: 'domain',
791
+ isConcurrencySafe: true,
703
792
  parameters: [
704
793
  { name: 'target', type: 'string', description: 'Target path' },
705
794
  ],
@@ -725,6 +814,7 @@ export class MCPProtocolServer {
725
814
  name: 'memory_retrieve',
726
815
  description: 'Retrieve a value by key from memory. Example: memory_retrieve({ key: "pattern-auth", namespace: "patterns" })',
727
816
  category: 'memory',
817
+ isConcurrencySafe: true,
728
818
  parameters: [
729
819
  { name: 'key', type: 'string', description: 'Memory key', required: true },
730
820
  { name: 'namespace', type: 'string', description: 'Memory namespace', default: 'default' },
@@ -737,6 +827,7 @@ export class MCPProtocolServer {
737
827
  name: 'memory_query',
738
828
  description: 'Query memory using glob patterns or HNSW semantic vector search. Example: memory_query({ pattern: "auth*", namespace: "patterns" }) or memory_query({ pattern: "authentication best practices", semantic: true })',
739
829
  category: 'memory',
830
+ isConcurrencySafe: true,
740
831
  parameters: [
741
832
  { name: 'pattern', type: 'string', description: 'Key pattern (glob) or natural language query (for semantic search)' },
742
833
  { name: 'namespace', type: 'string', description: 'Memory namespace' },
@@ -762,6 +853,7 @@ export class MCPProtocolServer {
762
853
  name: 'memory_usage',
763
854
  description: 'Get memory usage statistics: entry counts, namespaces, and storage size. Example: memory_usage({})',
764
855
  category: 'memory',
856
+ isConcurrencySafe: true,
765
857
  parameters: [],
766
858
  },
767
859
  handler: () => handleMemoryUsage(),
@@ -804,6 +896,7 @@ export class MCPProtocolServer {
804
896
  name: 'routing_metrics',
805
897
  description: 'Get model routing statistics: tier distribution, cost savings, and routing log. Example: routing_metrics({ includeLog: true, logLimit: 20 })',
806
898
  category: 'routing',
899
+ isConcurrencySafe: true,
807
900
  parameters: [
808
901
  { name: 'includeLog', type: 'boolean', description: 'Include routing log entries', default: false },
809
902
  { name: 'logLimit', type: 'number', description: 'Max log entries to return', default: 100 },
@@ -816,6 +909,7 @@ export class MCPProtocolServer {
816
909
  name: 'routing_economics',
817
910
  description: 'Get economic routing report: tier efficiency, budget status, cost-per-quality analysis, and savings opportunities. Example: routing_economics({ taskComplexity: 0.5 })',
818
911
  category: 'routing',
912
+ isConcurrencySafe: true,
819
913
  parameters: [
820
914
  { name: 'taskComplexity', type: 'number', description: 'Task complexity score 0-1 for tier scoring (default: 0.5)', default: 0.5 },
821
915
  ],
@@ -828,6 +922,7 @@ export class MCPProtocolServer {
828
922
  name: 'infra_healing_status',
829
923
  description: 'Get infrastructure self-healing status: detected failures, recovery stats, and failing services. Example: infra_healing_status({ verbose: true })',
830
924
  category: 'infra-healing',
925
+ isConcurrencySafe: true,
831
926
  parameters: [
832
927
  { name: 'verbose', type: 'boolean', description: 'Include detailed observation data', default: false },
833
928
  ],
@@ -877,6 +972,7 @@ export class MCPProtocolServer {
877
972
  name: 'cross_phase_query',
878
973
  description: 'Query cross-phase signals by loop type with optional filters',
879
974
  category: 'cross-phase',
975
+ isConcurrencySafe: true,
880
976
  parameters: [
881
977
  { name: 'loop', type: 'string', description: 'Feedback loop type', required: true, enum: ['strategic', 'tactical', 'operational', 'quality-criteria'] },
882
978
  { name: 'maxAge', type: 'string', description: 'Maximum signal age (e.g., "30d", "24h")' },
@@ -926,6 +1022,7 @@ export class MCPProtocolServer {
926
1022
  name: 'cross_phase_stats',
927
1023
  description: 'Get cross-phase memory statistics (total signals, by loop, by namespace)',
928
1024
  category: 'cross-phase',
1025
+ isConcurrencySafe: true,
929
1026
  parameters: [],
930
1027
  },
931
1028
  handler: () => handleCrossPhaseStats(),
@@ -935,6 +1032,7 @@ export class MCPProtocolServer {
935
1032
  name: 'format_signals',
936
1033
  description: 'Format cross-phase signals for injection into agent prompts',
937
1034
  category: 'cross-phase',
1035
+ isConcurrencySafe: true,
938
1036
  parameters: [
939
1037
  { name: 'signals', type: 'array', description: 'Signals to format', required: true },
940
1038
  ],
@@ -1001,6 +1099,7 @@ export class MCPProtocolServer {
1001
1099
  name: 'pipeline_list',
1002
1100
  description: 'List all loaded YAML pipelines. Example: pipeline_list({})',
1003
1101
  category: 'coordination',
1102
+ isConcurrencySafe: true,
1004
1103
  parameters: [],
1005
1104
  },
1006
1105
  handler: (params) => handlePipelineList(params),
@@ -1010,6 +1109,7 @@ export class MCPProtocolServer {
1010
1109
  name: 'pipeline_validate',
1011
1110
  description: 'Validate a YAML pipeline definition without loading it. Example: pipeline_validate({ yaml: "name: test\\nsteps: ..." })',
1012
1111
  category: 'coordination',
1112
+ isConcurrencySafe: true,
1013
1113
  parameters: [
1014
1114
  { name: 'yaml', type: 'string', description: 'YAML pipeline definition to validate', required: true },
1015
1115
  { name: 'variables', type: 'object', description: 'Variable substitutions for validation' },
@@ -1025,18 +1125,21 @@ export class MCPProtocolServer {
1025
1125
  name: 'session_cache_stats',
1026
1126
  description: 'Get session operation cache statistics: hit rate, cache size, tokens saved via O(1) fingerprint reuse. Example: session_cache_stats({})',
1027
1127
  category: 'learning',
1128
+ isConcurrencySafe: true,
1028
1129
  parameters: [],
1029
1130
  },
1030
1131
  handler: async () => {
1031
1132
  try {
1032
1133
  const { getSessionCache } = await import('../optimization/session-cache.js');
1033
1134
  const stats = getSessionCache().getStats();
1135
+ const compactionStats = this.compactionPipeline.getStats();
1034
1136
  return {
1035
1137
  success: true,
1036
1138
  data: {
1037
1139
  ...stats,
1038
1140
  hitRatePercent: `${(stats.hitRate * 100).toFixed(1)}%`,
1039
1141
  description: 'Session cache provides O(1) exact-match lookups before HNSW similarity search',
1142
+ compaction: compactionStats,
1040
1143
  },
1041
1144
  };
1042
1145
  }
@@ -1056,6 +1159,7 @@ export class MCPProtocolServer {
1056
1159
  name: 'aqe_health',
1057
1160
  description: 'Check AQE server health: returns status, loaded domains, memory stats, HNSW index status, and pattern count. Example: aqe_health({})',
1058
1161
  category: 'core',
1162
+ isConcurrencySafe: true,
1059
1163
  parameters: [],
1060
1164
  },
1061
1165
  handler: () => handleAQEHealth(),
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Agentic QE v3 - Session Durability Middleware
3
+ *
4
+ * IMP-04: Transcript-First Session Durability
5
+ * Middleware factory that registers pre/post/error hooks on the
6
+ * MiddlewareChain to log every tool call lifecycle event into
7
+ * the SessionStore.
8
+ *
9
+ * @module mcp/services/session-durability-middleware
10
+ */
11
+ import type { ToolMiddleware } from '../middleware/middleware-chain';
12
+ import type { SessionStore } from './session-store';
13
+ /**
14
+ * Creates a ToolMiddleware that appends session entries for every
15
+ * tool call, result, and error. Registers at priority 50.
16
+ *
17
+ * - preToolCall: appends a `tool_call` entry with state='running'
18
+ * - postToolResult: appends a `tool_result` entry with state='idle'
19
+ * - onError: appends an `error` entry with state='requires_action'
20
+ */
21
+ export declare function createSessionDurabilityMiddleware(store: SessionStore): ToolMiddleware;
22
+ //# sourceMappingURL=session-durability-middleware.d.ts.map
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Agentic QE v3 - Session Durability Middleware
3
+ *
4
+ * IMP-04: Transcript-First Session Durability
5
+ * Middleware factory that registers pre/post/error hooks on the
6
+ * MiddlewareChain to log every tool call lifecycle event into
7
+ * the SessionStore.
8
+ *
9
+ * @module mcp/services/session-durability-middleware
10
+ */
11
+ // ============================================================================
12
+ // Middleware Factory
13
+ // ============================================================================
14
+ /**
15
+ * Creates a ToolMiddleware that appends session entries for every
16
+ * tool call, result, and error. Registers at priority 50.
17
+ *
18
+ * - preToolCall: appends a `tool_call` entry with state='running'
19
+ * - postToolResult: appends a `tool_result` entry with state='idle'
20
+ * - onError: appends an `error` entry with state='requires_action'
21
+ */
22
+ export function createSessionDurabilityMiddleware(store) {
23
+ const disabled = process.env.AQE_SESSION_DURABILITY === 'false';
24
+ return {
25
+ name: 'session-durability',
26
+ priority: 50,
27
+ async preToolCall(context) {
28
+ if (disabled)
29
+ return context;
30
+ store.append({
31
+ timestamp: context.timestamp,
32
+ type: 'tool_call',
33
+ toolName: context.toolName,
34
+ params: context.params,
35
+ state: 'running',
36
+ });
37
+ return context;
38
+ },
39
+ async postToolResult(context, result) {
40
+ if (disabled)
41
+ return result;
42
+ store.append({
43
+ timestamp: Date.now(),
44
+ type: 'tool_result',
45
+ toolName: context.toolName,
46
+ result,
47
+ state: 'idle',
48
+ });
49
+ return result;
50
+ },
51
+ async onError(context, error) {
52
+ if (disabled)
53
+ return;
54
+ store.append({
55
+ timestamp: Date.now(),
56
+ type: 'error',
57
+ toolName: context.toolName,
58
+ result: { message: error.message, stack: error.stack },
59
+ state: 'requires_action',
60
+ });
61
+ },
62
+ };
63
+ }
64
+ //# sourceMappingURL=session-durability-middleware.js.map
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Agentic QE v3 - Session Resume Service
3
+ *
4
+ * IMP-04: Transcript-First Session Durability
5
+ * Reads an existing JSONL session file by sampling the head (first 4KB)
6
+ * and tail (last 64KB) to reconstruct metadata and recent entries
7
+ * without reading the entire file.
8
+ *
9
+ * @module mcp/services/session-resume
10
+ */
11
+ import type { SessionEntry, SessionMetadata } from './session-store';
12
+ export interface SessionResumeResult {
13
+ metadata: SessionMetadata;
14
+ recentEntries: SessionEntry[];
15
+ lastState: 'idle' | 'running' | 'requires_action';
16
+ canResume: boolean;
17
+ }
18
+ /**
19
+ * Resume a session from a JSONL file.
20
+ *
21
+ * Reads the first 4KB (head) to extract session start metadata and
22
+ * the last 64KB (tail) to get recent entries. Parses JSONL lines,
23
+ * reconstructs the parentUuid linked list, and returns metadata +
24
+ * recent entries + resume capability.
25
+ *
26
+ * Corrupt or incomplete lines are skipped gracefully.
27
+ */
28
+ export declare function resumeSession(filePath: string): SessionResumeResult;
29
+ //# sourceMappingURL=session-resume.d.ts.map