agentic-qe 3.9.18 → 3.9.19

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 (301) hide show
  1. package/.claude/helpers/statusline-v3.cjs +1 -1
  2. package/.claude/skills/skills-manifest.json +1 -1
  3. package/CHANGELOG.md +34 -0
  4. package/assets/skills/skills-manifest.json +1 -1
  5. package/dist/cli/bundle.js +5 -5
  6. package/dist/cli/chunks/adapter-5NI3IO42.js +2 -0
  7. package/dist/cli/chunks/{agent-booster-wasm-RJHBIG5V.js → agent-booster-wasm-HVBKHNIS.js} +2 -2
  8. package/dist/cli/chunks/{agent-handler-CXS6EE2V.js → agent-handler-XNBDYRSJ.js} +2 -2
  9. package/dist/cli/chunks/{agent-memory-branch-7NV5DD5A.js → agent-memory-branch-YCVTQEMJ.js} +2 -2
  10. package/dist/cli/chunks/aqe-learning-engine-JOUK5HMO.js +2 -0
  11. package/dist/cli/chunks/{audit-3NWGSPJW.js → audit-6C2PE7OY.js} +2 -2
  12. package/dist/cli/chunks/base-DCAB7AHK.js +2 -0
  13. package/dist/cli/chunks/{better-sqlite3-NXOMSJDC.js → better-sqlite3-HZPCHUQU.js} +2 -2
  14. package/dist/cli/chunks/{brain-handler-6N5WWZVA.js → brain-handler-OV75Q2NM.js} +3 -3
  15. package/dist/cli/chunks/{branch-enumerator-I7UTOCAW.js → branch-enumerator-QW6D42HJ.js} +2 -2
  16. package/dist/cli/chunks/{browser-6VOFWA52.js → browser-5BA7Q7OR.js} +2 -2
  17. package/dist/cli/chunks/browser-workflow-A4UV73SZ.js +2 -0
  18. package/dist/cli/chunks/{chunk-QTUTQLOY.js → chunk-255CWHTF.js} +2 -2
  19. package/dist/cli/chunks/{chunk-DC3PADV3.js → chunk-2SIQ742L.js} +1 -1
  20. package/dist/cli/chunks/{chunk-XTCV5UOJ.js → chunk-2SSDY6OE.js} +2 -2
  21. package/dist/cli/chunks/{chunk-BFM47L3X.js → chunk-2WJLEZKP.js} +2 -2
  22. package/dist/cli/chunks/{chunk-QW2RFI73.js → chunk-2WM4NYM5.js} +2 -2
  23. package/dist/cli/chunks/{chunk-YNVVRND7.js → chunk-2XATUQIG.js} +2 -2
  24. package/dist/cli/chunks/{chunk-ENYQUSSK.js → chunk-3546SG2L.js} +2 -2
  25. package/dist/cli/chunks/{chunk-XBWVHO6G.js → chunk-37DTXQ6P.js} +2 -2
  26. package/dist/cli/chunks/{chunk-4ELLGWTS.js → chunk-3HQ4AZDH.js} +2 -2
  27. package/dist/cli/chunks/{chunk-PM77Z4PR.js → chunk-3X3QQZ7Q.js} +2 -2
  28. package/dist/cli/chunks/{chunk-RGLCMGNZ.js → chunk-44SPMVML.js} +2 -2
  29. package/dist/cli/chunks/{chunk-6KTF7QB3.js → chunk-5KGFDNYI.js} +2 -2
  30. package/dist/cli/chunks/{chunk-6IBFYVLK.js → chunk-5LXWEAEJ.js} +2 -2
  31. package/dist/cli/chunks/{chunk-UNPTSPAO.js → chunk-5MGRZ4YD.js} +2 -2
  32. package/dist/cli/chunks/{chunk-6ZMQL3U6.js → chunk-5R2DUR3A.js} +2 -2
  33. package/dist/cli/chunks/{chunk-MDCTQOUJ.js → chunk-5X2AUPK2.js} +1 -1
  34. package/dist/cli/chunks/{chunk-G2H4W7NN.js → chunk-6BRUQTC7.js} +1 -1
  35. package/dist/cli/chunks/{chunk-DQCWNCOT.js → chunk-7IV2RK5M.js} +2 -2
  36. package/dist/cli/chunks/{chunk-EN2A2CVT.js → chunk-7WMHLBNZ.js} +1 -1
  37. package/dist/cli/chunks/{chunk-HLXPD4Y2.js → chunk-AEET2WOI.js} +65 -65
  38. package/dist/cli/chunks/{chunk-AGPZVE6B.js → chunk-AG7J7DTM.js} +2 -2
  39. package/dist/cli/chunks/{chunk-X2T4TI7D.js → chunk-ALYUJEYA.js} +2 -2
  40. package/dist/cli/chunks/{chunk-ZHA5Z5V4.js → chunk-AOASQYOO.js} +1 -1
  41. package/dist/cli/chunks/{chunk-D7SS56EG.js → chunk-AZKVGH5I.js} +2 -2
  42. package/dist/cli/chunks/{chunk-2A4JCRAW.js → chunk-B2EHSFUW.js} +2 -2
  43. package/dist/cli/chunks/{chunk-KMHGQD76.js → chunk-B65GTWF3.js} +2 -2
  44. package/dist/cli/chunks/{chunk-S2XBAOXE.js → chunk-BB3KUX6C.js} +1 -1
  45. package/dist/cli/chunks/{chunk-ZWR4PZ4Z.js → chunk-BFBR2ZZJ.js} +2 -2
  46. package/dist/cli/chunks/{chunk-7ZIKFJ6X.js → chunk-BGTYOZRK.js} +2 -2
  47. package/dist/cli/chunks/{chunk-IJPTWPXG.js → chunk-BOUCIIUI.js} +1 -1
  48. package/dist/cli/chunks/{chunk-ZJEVL5O3.js → chunk-C5YFCM2H.js} +2 -2
  49. package/dist/cli/chunks/{chunk-MBGWDELE.js → chunk-CYLQTVIA.js} +2 -2
  50. package/dist/cli/chunks/{chunk-7OGUAZGJ.js → chunk-D2EHD2KF.js} +1 -1
  51. package/dist/cli/chunks/{chunk-MLVVYUFS.js → chunk-D74RGYKI.js} +1 -1
  52. package/dist/cli/chunks/{chunk-WKQSZTU6.js → chunk-DAPBSAVT.js} +2 -2
  53. package/dist/cli/chunks/{chunk-I3POPZT5.js → chunk-DZS7XQ2Z.js} +2 -2
  54. package/dist/cli/chunks/{chunk-R3U3ARVJ.js → chunk-EW5TQQBR.js} +2 -2
  55. package/dist/cli/chunks/{chunk-YQL6JH2Y.js → chunk-EZZJ5XD6.js} +2 -2
  56. package/dist/cli/chunks/{chunk-BGSYFAEJ.js → chunk-FJJLNCSL.js} +3 -3
  57. package/dist/cli/chunks/{chunk-VZO5I23B.js → chunk-FL2DMHOQ.js} +1 -1
  58. package/dist/cli/chunks/{chunk-7XLTLFP5.js → chunk-FNVA7U7X.js} +2 -2
  59. package/dist/cli/chunks/{chunk-JGNVI5UB.js → chunk-FPVXXQVX.js} +3 -3
  60. package/dist/cli/chunks/{chunk-VRHKEJR6.js → chunk-FT3MAIRW.js} +3 -3
  61. package/dist/cli/chunks/{chunk-J7BG55VG.js → chunk-G2V4GMPR.js} +3 -3
  62. package/dist/cli/chunks/{chunk-MJ7UYPGY.js → chunk-GJ5FON37.js} +2 -2
  63. package/dist/cli/chunks/{chunk-KYLE6ZSC.js → chunk-GL742O2V.js} +4 -4
  64. package/dist/cli/chunks/{chunk-6BGSH2YR.js → chunk-GVDLCJC5.js} +1 -1
  65. package/dist/cli/chunks/{chunk-AZGESIFV.js → chunk-GYDE5TCN.js} +1 -1
  66. package/dist/cli/chunks/{chunk-IS2PMHB5.js → chunk-GYESQBDU.js} +2 -2
  67. package/dist/cli/chunks/{chunk-BSQTOKNR.js → chunk-H4QM37XS.js} +1 -1
  68. package/dist/cli/chunks/{chunk-K5NFP7B5.js → chunk-HCSTXZYE.js} +2 -2
  69. package/dist/cli/chunks/{chunk-A26GU6YU.js → chunk-HJ7CRPZY.js} +1 -1
  70. package/dist/cli/chunks/{chunk-H5JZZH2C.js → chunk-HQFREZRX.js} +2 -2
  71. package/dist/cli/chunks/{chunk-HZKY5KPB.js → chunk-HVNW3TZS.js} +1 -1
  72. package/dist/cli/chunks/{chunk-BXTHB2A2.js → chunk-I3JRRFVT.js} +2 -2
  73. package/dist/cli/chunks/{chunk-P6HIDCTQ.js → chunk-IG2RCBHJ.js} +1 -1
  74. package/dist/cli/chunks/{chunk-WMJCFDTA.js → chunk-IPLQPBJA.js} +2 -2
  75. package/dist/cli/chunks/{chunk-DOSDUAVZ.js → chunk-IV74GAZN.js} +2 -2
  76. package/dist/cli/chunks/{chunk-EZN7QMOZ.js → chunk-J7F65KKG.js} +4 -4
  77. package/dist/cli/chunks/{chunk-SQHM6WUF.js → chunk-JCPJG2KU.js} +3 -3
  78. package/dist/cli/chunks/{chunk-XSLKR2DM.js → chunk-JLX35EPX.js} +2 -2
  79. package/dist/cli/chunks/{chunk-FDDB7QTM.js → chunk-JYHZK44T.js} +1 -1
  80. package/dist/cli/chunks/{chunk-F7XU7KZL.js → chunk-K554X3T4.js} +2 -2
  81. package/dist/cli/chunks/{chunk-Z4YHL4JU.js → chunk-KTDGHN2J.js} +1 -1
  82. package/dist/cli/chunks/{chunk-WH7ZOJCF.js → chunk-KU7OXAFY.js} +1 -1
  83. package/dist/cli/chunks/{chunk-UPP5V7Y3.js → chunk-LDBHCOM3.js} +2 -2
  84. package/dist/cli/chunks/{chunk-4666TC3P.js → chunk-LTE3CDOY.js} +2 -2
  85. package/dist/cli/chunks/{chunk-V2N7KWT7.js → chunk-M6EP724N.js} +1 -1
  86. package/dist/cli/chunks/{chunk-LVABI4OA.js → chunk-MIQAFOFO.js} +1 -1
  87. package/dist/cli/chunks/{chunk-JD6KE6DJ.js → chunk-MMVSIESL.js} +2 -2
  88. package/dist/cli/chunks/{chunk-JMK5OCWL.js → chunk-MN4366PQ.js} +2 -2
  89. package/dist/cli/chunks/{chunk-DCB2VUYM.js → chunk-MTHO6A3V.js} +1 -1
  90. package/dist/cli/chunks/{chunk-TPL3CBMS.js → chunk-N2PLNYEV.js} +1 -1
  91. package/dist/cli/chunks/{chunk-CCM7MBLA.js → chunk-NBBIA3QA.js} +2 -2
  92. package/dist/cli/chunks/{chunk-KFITGSW3.js → chunk-NMYZSZHW.js} +2 -2
  93. package/dist/cli/chunks/{chunk-5SZLQCFP.js → chunk-NPSWRGNT.js} +2 -2
  94. package/dist/cli/chunks/{chunk-BADBKGZE.js → chunk-NXO7CT5K.js} +2 -2
  95. package/dist/cli/chunks/{chunk-BRWWIY6O.js → chunk-O5ZP3CBF.js} +2 -2
  96. package/dist/cli/chunks/{chunk-RI3NTZ2I.js → chunk-O6UMETOH.js} +2 -2
  97. package/dist/cli/chunks/{chunk-3GA7M5NK.js → chunk-OEQCZBBM.js} +2 -2
  98. package/dist/cli/chunks/{chunk-VW7FKTFO.js → chunk-P6EYD4V3.js} +2 -2
  99. package/dist/cli/chunks/{chunk-QTNDHCZ7.js → chunk-PS72GF4R.js} +3 -3
  100. package/dist/cli/chunks/{chunk-UFGFV4BO.js → chunk-PUUTYV32.js} +2 -2
  101. package/dist/cli/chunks/{chunk-4BIWQLD3.js → chunk-QOK4TIE4.js} +2 -2
  102. package/dist/cli/chunks/chunk-R5IL3XD5.js +69 -0
  103. package/dist/cli/chunks/{chunk-JZTB35EQ.js → chunk-RL5CBCBV.js} +1 -1
  104. package/dist/cli/chunks/{chunk-CSYQKVZY.js → chunk-SKDDAPBV.js} +1 -1
  105. package/dist/cli/chunks/{chunk-QGSELG75.js → chunk-SKNHAGYP.js} +2 -2
  106. package/dist/cli/chunks/{chunk-YZIOM7JL.js → chunk-SLDYG7LC.js} +2 -2
  107. package/dist/cli/chunks/{chunk-6G3RNT5H.js → chunk-SRKBR4DU.js} +2 -2
  108. package/dist/cli/chunks/{chunk-4U2JKV44.js → chunk-TCUIYIZ4.js} +1 -1
  109. package/dist/cli/chunks/{chunk-BY44ODHD.js → chunk-TMAIHTE3.js} +4 -4
  110. package/dist/cli/chunks/{chunk-RPT7HCMH.js → chunk-TXCOK5DC.js} +2 -2
  111. package/dist/cli/chunks/{chunk-ODGACHEZ.js → chunk-U257SS7D.js} +2 -2
  112. package/dist/cli/chunks/{chunk-AMRUZ6XG.js → chunk-U2WMCNNR.js} +2 -2
  113. package/dist/cli/chunks/{chunk-B6BAK2JI.js → chunk-UIASVDYG.js} +2 -2
  114. package/dist/cli/chunks/{chunk-VXQK4GKV.js → chunk-V7ZPTEP7.js} +1 -1
  115. package/dist/cli/chunks/{chunk-27MW2RFA.js → chunk-VHG67L7O.js} +2 -2
  116. package/dist/cli/chunks/{chunk-NBQW7MXF.js → chunk-VLQYU7ZQ.js} +1 -1
  117. package/dist/cli/chunks/{chunk-RHYGRUNU.js → chunk-VPDZTMMB.js} +3 -3
  118. package/dist/cli/chunks/{chunk-3DLD7OMF.js → chunk-VRGXYOIN.js} +1 -1
  119. package/dist/cli/chunks/{chunk-JZG23IPV.js → chunk-VSI45JCP.js} +1 -1
  120. package/dist/cli/chunks/{chunk-OXL6JSVR.js → chunk-VWWLJBRA.js} +8 -8
  121. package/dist/cli/chunks/{chunk-WC5A7C5L.js → chunk-VXUIIZNG.js} +1 -1
  122. package/dist/cli/chunks/{chunk-FTIHPDWV.js → chunk-W3IO4FQ5.js} +2 -2
  123. package/dist/cli/chunks/{chunk-FKNYOKIK.js → chunk-WULMXLNN.js} +1 -1
  124. package/dist/cli/chunks/{chunk-ZURHHRSA.js → chunk-WZUQT2BE.js} +2 -2
  125. package/dist/cli/chunks/{chunk-TFUWIKGZ.js → chunk-XF32XZMY.js} +2 -2
  126. package/dist/cli/chunks/{chunk-KV6PIOHN.js → chunk-XKD6AFY5.js} +1 -1
  127. package/dist/cli/chunks/{chunk-6QSB4XOL.js → chunk-XP4T7CZY.js} +2 -2
  128. package/dist/cli/chunks/{chunk-5ROA7KOT.js → chunk-XQZ63XSL.js} +1 -1
  129. package/dist/cli/chunks/{chunk-54TOOHER.js → chunk-XXHJKAE6.js} +2 -2
  130. package/dist/cli/chunks/{chunk-7GGSUXVM.js → chunk-Y3GX66VZ.js} +2 -2
  131. package/dist/cli/chunks/{chunk-JBW2A2O6.js → chunk-YXLQJ226.js} +2 -2
  132. package/dist/cli/chunks/chunk-Z2E5DTKX.js +2 -0
  133. package/dist/cli/chunks/{ci-LYAVZLM3.js → ci-FTZE4PD3.js} +2 -2
  134. package/dist/cli/chunks/{ci-output-L7TR2NCN.js → ci-output-C3ORCIHU.js} +2 -2
  135. package/dist/cli/chunks/{circuit-breaker-AQOGJGKI.js → circuit-breaker-GS5OTOJZ.js} +2 -2
  136. package/dist/cli/chunks/{claude-flow-setup-SO2ZN26K.js → claude-flow-setup-RWOFP5L2.js} +2 -2
  137. package/dist/cli/chunks/client-UTNF2C5K.js +2 -0
  138. package/dist/cli/chunks/{cline-installer-XCXFH4UR.js → cline-installer-D7RGRAUH.js} +2 -2
  139. package/dist/cli/chunks/{code-3Z2HMS5I.js → code-HBDMMYHY.js} +2 -2
  140. package/dist/cli/chunks/{code-index-extractor-KE362AJX.js → code-index-extractor-B2KUPAEH.js} +2 -2
  141. package/dist/cli/chunks/{codex-installer-GTD3GFTF.js → codex-installer-MPXV4AOD.js} +2 -2
  142. package/dist/cli/chunks/{completions-EDCXRRJO.js → completions-QJS6QOZQ.js} +2 -2
  143. package/dist/cli/chunks/{complexity-analyzer-QMN3V6D3.js → complexity-analyzer-YQQXWZIL.js} +2 -2
  144. package/dist/cli/chunks/{continuedev-installer-U6HN376C.js → continuedev-installer-Z6PBKYMB.js} +2 -2
  145. package/dist/cli/chunks/{copilot-installer-54PZIREM.js → copilot-installer-RWVD44CV.js} +2 -2
  146. package/dist/cli/chunks/{cost-tracker-33O475QA.js → cost-tracker-DFPBFYWL.js} +2 -2
  147. package/dist/cli/chunks/{coverage-B7E545AJ.js → coverage-DYST26FK.js} +3 -3
  148. package/dist/cli/chunks/cross-domain-router-FCM34JOR.js +2 -0
  149. package/dist/cli/chunks/{cursor-installer-LKKSPZUM.js → cursor-installer-LL6UWKTZ.js} +2 -2
  150. package/dist/cli/chunks/{daemon-DVOHWXUR.js → daemon-6PIHFZNR.js} +3 -3
  151. package/dist/cli/chunks/{dag-attention-scheduler-EQOHQBUG.js → dag-attention-scheduler-WS3HJW4F.js} +2 -2
  152. package/dist/cli/chunks/{detect-OCB2XT6C.js → detect-J4OITSUD.js} +2 -2
  153. package/dist/cli/chunks/{dist-node-HSG4QK4G.js → dist-node-QSLD5K6K.js} +2 -2
  154. package/dist/cli/chunks/{domain-handler-USGF4CIG.js → domain-handler-BD53QZ4Q.js} +2 -2
  155. package/dist/cli/chunks/{domain-transfer-OUERZRGL.js → domain-transfer-VZBWINQL.js} +2 -2
  156. package/dist/cli/chunks/dream-6KCS7EWS.js +2 -0
  157. package/dist/cli/chunks/embed-and-insert-pattern-5UAFXNDX.js +3 -0
  158. package/dist/cli/chunks/{eval-LHYXXWFK.js → eval-GBKU6VTD.js} +2 -2
  159. package/dist/cli/chunks/{fast-paths-UTK7BN63.js → fast-paths-MYZ6GITZ.js} +2 -2
  160. package/dist/cli/chunks/{feature-flags-XB6ALB3X.js → feature-flags-2WVV66AO.js} +2 -2
  161. package/dist/cli/chunks/{feature-flags-XEP6B4GN.js → feature-flags-6ALWBTHS.js} +2 -2
  162. package/dist/cli/chunks/{file-discovery-O4DUCNHK.js → file-discovery-FOYCPGD6.js} +2 -2
  163. package/dist/cli/chunks/{fleet-37NGGRJI.js → fleet-JROEDHAT.js} +3 -3
  164. package/dist/cli/chunks/{gnn-wrapper-5E7T3IQX.js → gnn-wrapper-KAXTFFEE.js} +2 -2
  165. package/dist/cli/chunks/{heartbeat-handler-Q44PCI7K.js → heartbeat-handler-PG24CBMQ.js} +4 -4
  166. package/dist/cli/chunks/{heartbeat-scheduler-6JPB2AQS.js → heartbeat-scheduler-LSS3RD6E.js} +2 -2
  167. package/dist/cli/chunks/hnsw-adapter-PG6O67CQ.js +2 -0
  168. package/dist/cli/chunks/hnsw-index-AHYZHLNZ.js +2 -0
  169. package/dist/cli/chunks/{hnsw-legacy-bridge-B55GGQYA.js → hnsw-legacy-bridge-HYH4AJAO.js} +2 -2
  170. package/dist/cli/chunks/{hnswlib-node-B3D2XIL5.js → hnswlib-node-WTTST5LC.js} +2 -2
  171. package/dist/cli/chunks/hooks-RDZSAFQG.js +214 -0
  172. package/dist/cli/chunks/{hybrid-router-RV34PYQD.js → hybrid-router-HNPS6EFL.js} +2 -2
  173. package/dist/cli/chunks/{hypergraph-engine-FT5YK5RF.js → hypergraph-engine-JUFXRXCC.js} +2 -2
  174. package/dist/cli/chunks/{hypergraph-handler-EUS6MIYW.js → hypergraph-handler-YFRF53TF.js} +3 -3
  175. package/dist/cli/chunks/impact-analyzer-USAJVJY5.js +2 -0
  176. package/dist/cli/chunks/{init-handler-3MV32TKZ.js → init-handler-P4W5F57S.js} +6 -6
  177. package/dist/cli/chunks/init-wizard-GL7LAZID.js +2 -0
  178. package/dist/cli/chunks/kernel-2YAIESTR.js +2 -0
  179. package/dist/cli/chunks/{kilocode-installer-RZPRXQI2.js → kilocode-installer-5VWY4DMH.js} +2 -2
  180. package/dist/cli/chunks/{kiro-installer-BGDBNZHI.js → kiro-installer-PZC3BQII.js} +2 -2
  181. package/dist/cli/chunks/knowledge-graph-QSIYZRAG.js +2 -0
  182. package/dist/cli/chunks/{learning-KNEBWLEZ.js → learning-4OH4ZG25.js} +3 -3
  183. package/dist/cli/chunks/{llm-router-Q2VQPOQ3.js → llm-router-LZBR6SZQ.js} +4 -4
  184. package/dist/cli/chunks/{load-RL53SYBD.js → load-SPWP6VB3.js} +2 -2
  185. package/dist/cli/chunks/load-test-UEHSHLVN.js +2 -0
  186. package/dist/cli/chunks/{mcp-GTINFFUF.js → mcp-QYPQMM7L.js} +2 -2
  187. package/dist/cli/chunks/{memory-STPMUUAK.js → memory-54ILJMWQ.js} +5 -5
  188. package/dist/cli/chunks/memory-backend-4NE4ADPG.js +2 -0
  189. package/dist/cli/chunks/{memory-handlers-LWX3LPVF.js → memory-handlers-YK7H5UCX.js} +2 -2
  190. package/dist/cli/chunks/{multi-model-executor-36ZYYDA6.js → multi-model-executor-XAOAVPPI.js} +2 -2
  191. package/dist/cli/chunks/{opencode-installer-KTCQKS2K.js → opencode-installer-CNS4XMUF.js} +2 -2
  192. package/dist/cli/chunks/{orchestrator-6EGOOXQG.js → orchestrator-SSEMSKUI.js} +6 -6
  193. package/dist/cli/chunks/{pipeline-WSLAIOYC.js → pipeline-DS3AENTB.js} +2 -2
  194. package/dist/cli/chunks/{platform-MNUN663B.js → platform-BL6LH5NF.js} +2 -2
  195. package/dist/cli/chunks/{plugin-PLDTG4A2.js → plugin-FNXPEQ2C.js} +2 -2
  196. package/dist/cli/chunks/{prime-radiant-advanced-wasm-B4UFONWB.js → prime-radiant-advanced-wasm-E6S6BGNA.js} +2 -2
  197. package/dist/cli/chunks/protocol-executor-YI4HNXND.js +2 -0
  198. package/dist/cli/chunks/{protocol-handler-VAVLLAI2.js → protocol-handler-D4WIUU3W.js} +2 -2
  199. package/dist/cli/chunks/{prove-WVNPDWUC.js → prove-OLB3PKW6.js} +2 -2
  200. package/dist/cli/chunks/{provider-manager-VJF4D6AW.js → provider-manager-GKTQ75DT.js} +2 -2
  201. package/dist/cli/chunks/qe-reasoning-bank-ANBAXQXC.js +2 -0
  202. package/dist/cli/chunks/{quality-LTMHVQBG.js → quality-ZYJVYTUL.js} +2 -2
  203. package/dist/cli/chunks/queen-coordinator-MYYUSWVX.js +2 -0
  204. package/dist/cli/chunks/{real-embeddings-6ACQACTM.js → real-embeddings-SKJRHLCS.js} +2 -2
  205. package/dist/cli/chunks/{roocode-installer-T5ZWC3SS.js → roocode-installer-WZGKOLWE.js} +2 -2
  206. package/dist/cli/chunks/router-RYCLZ7A4.js +2 -0
  207. package/dist/cli/chunks/routing-feedback-5KSRG2UI.js +2 -0
  208. package/dist/cli/chunks/{routing-handler-Y2O2I2HM.js → routing-handler-4GIMINCI.js} +2 -2
  209. package/dist/cli/chunks/{ruvector-commands-F2V36B4W.js → ruvector-commands-YZONXZ2W.js} +2 -2
  210. package/dist/cli/chunks/{rvf-dual-writer-R6CNMPQD.js → rvf-dual-writer-WSS5GF54.js} +2 -2
  211. package/dist/cli/chunks/{rvf-migration-adapter-IDVOB3LN.js → rvf-migration-adapter-WS4HHVEU.js} +2 -2
  212. package/dist/cli/chunks/{rvf-migration-coordinator-VM4AMFZG.js → rvf-migration-coordinator-6BY5GI47.js} +2 -2
  213. package/dist/cli/chunks/rvf-native-adapter-NEIOLJRF.js +2 -0
  214. package/dist/cli/chunks/safe-db-3JQP4EPU.js +2 -0
  215. package/dist/cli/chunks/schedule-2QKCL64E.js +2 -0
  216. package/dist/cli/chunks/scheduler-FMOP45FC.js +2 -0
  217. package/dist/cli/chunks/{security-WQ7YMR6M.js → security-HCNOL2K3.js} +3 -3
  218. package/dist/cli/chunks/shared-rvf-adapter-BMFIVWMJ.js +2 -0
  219. package/dist/cli/chunks/{shared-rvf-dual-writer-HYI64CBX.js → shared-rvf-dual-writer-QRNLSDS7.js} +2 -2
  220. package/dist/cli/chunks/sqlite-persistence-I5RYLFOE.js +2 -0
  221. package/dist/cli/chunks/{status-handler-BH2WCMPA.js → status-handler-QXZ442MY.js} +2 -2
  222. package/dist/cli/chunks/{structural-health-XWX6FKVF.js → structural-health-OFYZ3Z4A.js} +2 -2
  223. package/dist/cli/chunks/{sync-PRDGCHE2.js → sync-J4BG65NF.js} +2 -2
  224. package/dist/cli/chunks/{task-handler-YFHFBMHO.js → task-handler-UBSFCKK3.js} +2 -2
  225. package/dist/cli/chunks/{task-handlers-4OQRADMG.js → task-handlers-JFUT2FQ7.js} +2 -2
  226. package/dist/cli/chunks/{test-ZBTQ4Z66.js → test-WTNAHJHH.js} +4 -4
  227. package/dist/cli/chunks/{test-scheduling-F47Y3KNO.js → test-scheduling-QREBYRGW.js} +3 -3
  228. package/dist/cli/chunks/{token-bootstrap-XOGAEQPG.js → token-bootstrap-HE5H77OL.js} +2 -2
  229. package/dist/cli/chunks/{token-usage-2KZ7WE5J.js → token-usage-V5B6K3JL.js} +2 -2
  230. package/dist/cli/chunks/{transformers-KCJ7PWZ4.js → transformers-HIVMQP4O.js} +2 -2
  231. package/dist/cli/chunks/{tree-sitter-wasm-parser-H6DL2DFA.js → tree-sitter-wasm-parser-WP2SF2M5.js} +2 -2
  232. package/dist/cli/chunks/{types-633TMIO3.js → types-7ZBTAO5Z.js} +2 -2
  233. package/dist/cli/chunks/unified-memory-2ETCY22B.js +2 -0
  234. package/dist/cli/chunks/unified-memory-hnsw-OALJW537.js +2 -0
  235. package/dist/cli/chunks/unified-persistence-SQMP7A3O.js +2 -0
  236. package/dist/cli/chunks/{upgrade-CH742GRF.js → upgrade-WIFAJDBG.js} +2 -2
  237. package/dist/cli/chunks/{validate-44WH3CKE.js → validate-W63V36GA.js} +2 -2
  238. package/dist/cli/chunks/{validate-swarm-W2A7CUM7.js → validate-swarm-CK5BM3YY.js} +2 -2
  239. package/dist/cli/chunks/{vibium-B25MIEBK.js → vibium-MJCCO36E.js} +2 -2
  240. package/dist/cli/chunks/visual-security-JUJPF2QO.js +2 -0
  241. package/dist/cli/chunks/{web-tree-sitter-B54K47HF.js → web-tree-sitter-ESERXLPK.js} +2 -2
  242. package/dist/cli/chunks/{windsurf-installer-EWL7COTI.js → windsurf-installer-FDWQ5BWI.js} +2 -2
  243. package/dist/cli/chunks/{witness-chain-DWNP7VR6.js → witness-chain-L5KSYE2S.js} +2 -2
  244. package/dist/cli/chunks/witness-chain-QJVKAAZT.js +2 -0
  245. package/dist/cli/chunks/{workflow-LT2J7U23.js → workflow-34GYJDFW.js} +4 -4
  246. package/dist/cli/chunks/workflow-orchestrator-WXB2RVVW.js +2 -0
  247. package/dist/cli/chunks/{wrappers-OAZ6MKXO.js → wrappers-VGKEBQLW.js} +2 -2
  248. package/dist/cli/commands/hooks-handlers/command-hooks.js +104 -11
  249. package/dist/cli/commands/hooks-handlers/hooks-dream-learning.d.ts +98 -0
  250. package/dist/cli/commands/hooks-handlers/hooks-dream-learning.js +285 -1
  251. package/dist/cli/commands/hooks-handlers/hooks-shared.d.ts +20 -1
  252. package/dist/cli/commands/hooks-handlers/hooks-shared.js +35 -3
  253. package/dist/cli/commands/hooks-handlers/routing-hooks.js +15 -5
  254. package/dist/cli/commands/hooks-handlers/task-hooks.js +216 -5
  255. package/dist/coordination/task-executor.js +11 -2
  256. package/dist/init/phases/07-hooks.js +2 -2
  257. package/dist/integrations/ruvector/hypergraph-engine.js +63 -4
  258. package/dist/integrations/ruvector/hypergraph-schema.d.ts +6 -2
  259. package/dist/learning/embed-and-insert-pattern.d.ts +36 -0
  260. package/dist/learning/embed-and-insert-pattern.js +52 -0
  261. package/dist/learning/pattern-store.d.ts +8 -0
  262. package/dist/learning/pattern-store.js +66 -43
  263. package/dist/mcp/bundle.js +333 -327
  264. package/dist/mcp/entry.js +21 -1
  265. package/dist/workers/workers/learning-consolidation.js +6 -1
  266. package/package.json +1 -1
  267. package/dist/cli/chunks/adapter-C7AKAAPC.js +0 -2
  268. package/dist/cli/chunks/aqe-learning-engine-7P3AXQNO.js +0 -2
  269. package/dist/cli/chunks/base-GIDVLEPA.js +0 -2
  270. package/dist/cli/chunks/browser-workflow-DAUS4Z5V.js +0 -2
  271. package/dist/cli/chunks/chunk-4XYQJ4LQ.js +0 -2
  272. package/dist/cli/chunks/chunk-NKOLFLXF.js +0 -66
  273. package/dist/cli/chunks/client-LIKTMSIP.js +0 -2
  274. package/dist/cli/chunks/cross-domain-router-SSBT32Q3.js +0 -2
  275. package/dist/cli/chunks/dream-FAHB6BWB.js +0 -2
  276. package/dist/cli/chunks/hnsw-adapter-GQM3ONQE.js +0 -2
  277. package/dist/cli/chunks/hnsw-index-XF3NY4R4.js +0 -2
  278. package/dist/cli/chunks/hooks-MOBQSJLJ.js +0 -101
  279. package/dist/cli/chunks/impact-analyzer-V6PBIMZH.js +0 -2
  280. package/dist/cli/chunks/init-wizard-7ROJWLEO.js +0 -2
  281. package/dist/cli/chunks/kernel-AOUBGDXU.js +0 -2
  282. package/dist/cli/chunks/knowledge-graph-SJA3YGMQ.js +0 -2
  283. package/dist/cli/chunks/load-test-NSHIGHCV.js +0 -2
  284. package/dist/cli/chunks/memory-backend-SZAYMQVP.js +0 -2
  285. package/dist/cli/chunks/protocol-executor-22KKAYX2.js +0 -2
  286. package/dist/cli/chunks/qe-reasoning-bank-N7ZXOAEN.js +0 -2
  287. package/dist/cli/chunks/queen-coordinator-BC54OCHH.js +0 -2
  288. package/dist/cli/chunks/router-YTQZRTIB.js +0 -2
  289. package/dist/cli/chunks/routing-feedback-AASAMEUY.js +0 -2
  290. package/dist/cli/chunks/rvf-native-adapter-VHIHJOPA.js +0 -2
  291. package/dist/cli/chunks/safe-db-NVEBL662.js +0 -2
  292. package/dist/cli/chunks/schedule-KVUFE56T.js +0 -2
  293. package/dist/cli/chunks/scheduler-6GRLJZ2A.js +0 -2
  294. package/dist/cli/chunks/shared-rvf-adapter-XORIDF3Q.js +0 -2
  295. package/dist/cli/chunks/sqlite-persistence-25TDMX6G.js +0 -2
  296. package/dist/cli/chunks/unified-memory-BTX45KY5.js +0 -2
  297. package/dist/cli/chunks/unified-memory-hnsw-MMHMQ4CP.js +0 -2
  298. package/dist/cli/chunks/unified-persistence-GA7HKYZC.js +0 -2
  299. package/dist/cli/chunks/visual-security-HPF5HCYF.js +0 -2
  300. package/dist/cli/chunks/witness-chain-LROQLFND.js +0 -2
  301. package/dist/cli/chunks/workflow-orchestrator-VFRKGG5Y.js +0 -2
@@ -4,11 +4,86 @@
4
4
  *
5
5
  * Handles file guardian and Bash command lifecycle hooks.
6
6
  */
7
+ import { existsSync, readFileSync } from 'node:fs';
8
+ import { randomUUID } from 'node:crypto';
7
9
  import chalk from 'chalk';
8
10
  import path from 'node:path';
9
11
  import { QE_HOOK_EVENTS } from '../../../learning/qe-hooks.js';
10
- import { findProjectRoot } from '../../../kernel/unified-memory.js';
11
- import { getHooksSystem, createHybridBackendWithTimeout, incrementDreamExperience, persistCommandExperience, printJson, printSuccess, printError, } from './hooks-shared.js';
12
+ import { findProjectRoot, getUnifiedMemory } from '../../../kernel/unified-memory.js';
13
+ import { applyHookBusyTimeout, getHooksSystem, createHybridBackendWithTimeout, incrementDreamExperience, persistCommandExperience, printJson, printSuccess, printError, } from './hooks-shared.js';
14
+ /**
15
+ * Detect test framework from a Bash command. Returns null when no recognized
16
+ * framework is invoked.
17
+ */
18
+ function detectTestFramework(command) {
19
+ if (/\bjest\b/i.test(command))
20
+ return 'jest';
21
+ if (/\bvitest\b/i.test(command))
22
+ return 'vitest';
23
+ if (/\bpytest\b/i.test(command))
24
+ return 'pytest';
25
+ if (/\bmocha\b/i.test(command))
26
+ return 'mocha';
27
+ return null;
28
+ }
29
+ /**
30
+ * Persist test_outcomes (patch 070) and coverage_sessions (patch 170) for a
31
+ * test-framework command. Best-effort — failures are logged at debug level.
32
+ */
33
+ async function persistTestAndCoverage(opts) {
34
+ try {
35
+ const um = getUnifiedMemory();
36
+ if (!um.isInitialized()) {
37
+ await um.initialize();
38
+ }
39
+ const db = um.getDatabase();
40
+ applyHookBusyTimeout(db);
41
+ const language = opts.framework === 'pytest' ? 'python' : 'javascript';
42
+ const cmdSlug = opts.command.split(/\s+/).slice(0, 3).join('-').slice(0, 80);
43
+ db.prepare(`
44
+ INSERT INTO test_outcomes (
45
+ id, test_id, test_name, generated_by, framework, language, domain,
46
+ passed, execution_time_ms, maintainability_score, created_at
47
+ ) VALUES (?, ?, ?, 'cli-hook-post-command', ?, ?, 'test-execution',
48
+ ?, ?, 0.5, datetime('now'))
49
+ `).run(`to-${Date.now()}-${randomUUID().slice(0, 8)}`, `cmd:${cmdSlug}`, opts.command.slice(0, 200), opts.framework, language, opts.success ? 1 : 0, opts.durationMs);
50
+ // Patch 170: parse Istanbul coverage summary if it exists. Reuses the
51
+ // previous after_* values as before_* so coverage delta is calculable.
52
+ try {
53
+ const summaryPath = path.join(process.cwd(), 'coverage', 'coverage-summary.json');
54
+ if (existsSync(summaryPath)) {
55
+ const summary = JSON.parse(readFileSync(summaryPath, 'utf-8'));
56
+ const total = summary.total ?? {};
57
+ const afterLines = Number(total.lines?.pct ?? 0);
58
+ const afterBranches = Number(total.branches?.pct ?? 0);
59
+ const afterFunctions = Number(total.functions?.pct ?? 0);
60
+ const prev = db.prepare(`
61
+ SELECT after_lines, after_branches, after_functions
62
+ FROM coverage_sessions
63
+ WHERE target_path = ?
64
+ ORDER BY created_at DESC
65
+ LIMIT 1
66
+ `).get(process.cwd());
67
+ const nowIso = new Date().toISOString();
68
+ db.prepare(`
69
+ INSERT INTO coverage_sessions (
70
+ id, target_path, agent_id, technique,
71
+ before_lines, before_branches, before_functions,
72
+ after_lines, after_branches, after_functions,
73
+ tests_generated, tests_passed, duration_ms,
74
+ started_at, completed_at
75
+ ) VALUES (?, ?, 'cli-hook-post-command', ?, ?, ?, ?, ?, ?, ?, 0, ?, ?, ?, ?)
76
+ `).run(`cs-${Date.now()}-${randomUUID().slice(0, 8)}`, process.cwd(), opts.framework, prev?.after_lines ?? 0, prev?.after_branches ?? 0, prev?.after_functions ?? 0, afterLines, afterBranches, afterFunctions, opts.success ? 1 : 0, opts.durationMs, nowIso, nowIso);
77
+ }
78
+ }
79
+ catch (covErr) {
80
+ console.error(chalk.dim(`[hooks] coverage_sessions: ${covErr instanceof Error ? covErr.message : 'unknown'}`));
81
+ }
82
+ }
83
+ catch (error) {
84
+ console.error(chalk.dim(`[hooks] test_outcomes: ${error instanceof Error ? error.message : 'unknown'}`));
85
+ }
86
+ }
12
87
  /**
13
88
  * Register guard, pre-command, and post-command subcommands on the hooks command.
14
89
  */
@@ -211,15 +286,33 @@ export function registerCommandHooks(hooks) {
211
286
  feedback: `Command: ${command}, exit: ${exitCode}`,
212
287
  });
213
288
  patternsLearned = 1;
214
- // Persist as captured experience
215
- await persistCommandExperience({
216
- task: `bash: ${command}`,
217
- agent: 'cli-hook',
218
- domain,
219
- success,
220
- source: 'cli-hook-post-command',
221
- });
222
- experienceRecorded = true;
289
+ // Persist as captured experience — gated to test/build/lint commands
290
+ // so non-test Bash (git, ls, etc.) doesn't flood captured_experiences
291
+ // with low-success-rate noise that dilutes pattern signal.
292
+ // reasoningBank.recordOutcome above is the broader metric path and
293
+ // stays unconditional.
294
+ if (isTestCmd || isBuildCmd || isLintCmd) {
295
+ await persistCommandExperience({
296
+ task: `bash: ${command}`,
297
+ agent: 'cli-hook',
298
+ domain,
299
+ success,
300
+ source: 'cli-hook-post-command',
301
+ });
302
+ experienceRecorded = true;
303
+ }
304
+ // Patches 070 + 170: when a recognized test framework ran, write
305
+ // test_outcomes and (if Istanbul coverage summary is present) a
306
+ // coverage_sessions row. Best-effort.
307
+ const framework = detectTestFramework(command);
308
+ if (framework) {
309
+ await persistTestAndCoverage({
310
+ command,
311
+ framework,
312
+ success,
313
+ durationMs: 0, // post-command does not currently track exec time
314
+ });
315
+ }
223
316
  // Increment dream experience counter
224
317
  const projectRoot = findProjectRoot();
225
318
  const dataDir = path.join(projectRoot, '.agentic-qe');
@@ -47,6 +47,104 @@ export declare function persistCommandExperience(opts: {
47
47
  durationMs?: number;
48
48
  source: string;
49
49
  }): Promise<void>;
50
+ /**
51
+ * Bridge payload written by pre-task into kv_store namespace='task-bridge'.
52
+ * Read by persistTaskOutcome to fan out per-pattern apps + derive q-learning state.
53
+ */
54
+ export interface TaskBridgePayload {
55
+ selectedPatternIds: string[];
56
+ agent: string | null;
57
+ description: string;
58
+ taskType: string;
59
+ priority: string;
60
+ domain: string;
61
+ complexityBucket: number;
62
+ estimatedTokenSavings: number;
63
+ ts: number;
64
+ }
65
+ /**
66
+ * Result of persistTaskOutcome — surfaces fields the q-learning post-task
67
+ * integration needs (patch 280 / Stream F).
68
+ */
69
+ export interface TaskOutcomeResult {
70
+ /** captured_experiences row id (FK target for experience_applications) */
71
+ experienceId: string;
72
+ /** Outcome quality computed via the 6-dim formula */
73
+ qualityScore: number;
74
+ /** Bridge payload that was consumed (null if no bridge entry found) */
75
+ bridge: TaskBridgePayload | null;
76
+ /** Number of multi-step siblings stitched into the trajectory (0 if single-step) */
77
+ stitchedSiblings: number;
78
+ /** Number of dream_insights rows whose applied counter was incremented */
79
+ insightsApplied: number;
80
+ }
81
+ /**
82
+ * Persist a Task() outcome through the full experience pipeline.
83
+ *
84
+ * Pipeline rolled into one helper that:
85
+ *
86
+ * 1. Writes captured_experiences (source='cli-hook-post-task')
87
+ * 2. Reads kv_store task-bridge (selectedPatternIds + estimatedTokenSavings)
88
+ * 3. Writes experience_applications: 1 base row + 1 per pattern_id (160/300)
89
+ * 4. Deletes the bridge entry to prevent double-consumption
90
+ * 5. Writes a single-step qe_trajectories row (120)
91
+ * 6. Looks for sibling captured_experiences with task LIKE '%:taskId' in the
92
+ * last hour; if ≥2, creates a multi-step traj-multi-... row and marks
93
+ * siblings consolidated_into = traj-multi-id (180)
94
+ * 7. Increments dream_insights.applied for top-3 most-recent actionable rows
95
+ * when the task succeeded (110)
96
+ *
97
+ * All steps run inside a single transaction so partial failures don't leave
98
+ * inconsistent state. Returns the experience_id and derived fields for the
99
+ * q-learning post-task integration (Stream F / patch 280).
100
+ */
101
+ export declare function persistTaskOutcome(opts: {
102
+ taskId: string;
103
+ agent: string;
104
+ domain?: string;
105
+ success: boolean;
106
+ durationMs?: number;
107
+ }): Promise<TaskOutcomeResult>;
108
+ /**
109
+ * Q-learning Bellman update for the hook-router state-action pair.
110
+ *
111
+ * Aligned to ADR-061/087:
112
+ * - algorithm='q-learning' (not 'asymmetric-hebbian'; that label is for
113
+ * ReasoningBank confidence updates, not Q-learning)
114
+ * - agent_id='aqe-hook-router' (per-instance partition; persistent-q-router
115
+ * convention so we don't collide with canonical RuVector q-router writes
116
+ * at agent_id='q-router')
117
+ * - state_key='${taskType}|${priority}|${domain}|${complexityBucket}'
118
+ * (structural; see q-learning-router.ts:591)
119
+ * - action_key=agent name chosen
120
+ * - id='q-learning:aqe-hook-router:${stateKey}:${actionKey}'
121
+ *
122
+ * Update: Q ← Q + α(r + γ·max_a' Q(s',a') − Q) with α=0.1, γ=0.9.
123
+ * Reward: success +0.1, failure −1.0 (asymmetric per ADR-061).
124
+ *
125
+ * Best-effort — failures swallowed to keep post-task hook responsive.
126
+ */
127
+ export declare function updateHookRouterQValue(opts: {
128
+ taskType: string;
129
+ priority: string;
130
+ domain: string;
131
+ complexityBucket: number;
132
+ agent: string;
133
+ success: boolean;
134
+ }): Promise<void>;
135
+ /**
136
+ * Update the routing_outcomes sentinel row that pre-task wrote with
137
+ * quality=-1, success=0. Patch 150: applies the 6-dim outcome quality and
138
+ * success bit to the most-recent pending sentinel matching the agent.
139
+ *
140
+ * Best-effort — no-op when no sentinel found.
141
+ */
142
+ export declare function updateRoutingOutcomeQuality(opts: {
143
+ agent: string;
144
+ success: boolean;
145
+ durationMs: number;
146
+ qualityScore: number;
147
+ }): Promise<void>;
50
148
  /**
51
149
  * Lightweight experience-to-pattern consolidation.
52
150
  * Aggregates captured_experiences by domain+agent, and for clusters that meet
@@ -128,6 +128,10 @@ export async function persistCommandExperience(opts) {
128
128
  await um.initialize();
129
129
  }
130
130
  const db = um.getDatabase();
131
+ try {
132
+ db.pragma('busy_timeout = 60000');
133
+ }
134
+ catch { /* hook-side patient timeout (ADR-001 / patch 260) */ }
131
135
  const id = `cli-${Date.now()}-${randomUUID().slice(0, 8)}`;
132
136
  // Compute quality based on context rather than binary success/fail.
133
137
  // Duration-aware: fast successful ops get higher quality.
@@ -157,6 +161,276 @@ export async function persistCommandExperience(opts) {
157
161
  console.error(chalk.dim(`[hooks] persistCommandExperience: ${error instanceof Error ? error.message : 'unknown'}`));
158
162
  }
159
163
  }
164
+ /**
165
+ * Persist a Task() outcome through the full experience pipeline.
166
+ *
167
+ * Pipeline rolled into one helper that:
168
+ *
169
+ * 1. Writes captured_experiences (source='cli-hook-post-task')
170
+ * 2. Reads kv_store task-bridge (selectedPatternIds + estimatedTokenSavings)
171
+ * 3. Writes experience_applications: 1 base row + 1 per pattern_id (160/300)
172
+ * 4. Deletes the bridge entry to prevent double-consumption
173
+ * 5. Writes a single-step qe_trajectories row (120)
174
+ * 6. Looks for sibling captured_experiences with task LIKE '%:taskId' in the
175
+ * last hour; if ≥2, creates a multi-step traj-multi-... row and marks
176
+ * siblings consolidated_into = traj-multi-id (180)
177
+ * 7. Increments dream_insights.applied for top-3 most-recent actionable rows
178
+ * when the task succeeded (110)
179
+ *
180
+ * All steps run inside a single transaction so partial failures don't leave
181
+ * inconsistent state. Returns the experience_id and derived fields for the
182
+ * q-learning post-task integration (Stream F / patch 280).
183
+ */
184
+ export async function persistTaskOutcome(opts) {
185
+ const { getUnifiedMemory } = await import('../../../kernel/unified-memory.js');
186
+ const um = getUnifiedMemory();
187
+ if (!um.isInitialized()) {
188
+ await um.initialize();
189
+ }
190
+ const db = um.getDatabase();
191
+ try {
192
+ db.pragma('busy_timeout = 60000');
193
+ }
194
+ catch { /* hook-side patient timeout (ADR-001 / patch 260) */ }
195
+ const experienceId = `exp-${Date.now()}-${randomUUID().slice(0, 8)}`;
196
+ const taskField = `${opts.agent}:${opts.taskId}`;
197
+ const durationMs = opts.durationMs ?? 0;
198
+ // 6-dim outcome quality (patch 080/150 canonical formula)
199
+ // 0.25 * effectiveness + 0.325 baseline + 0.10 * duration_tier
200
+ // Other 4 dims default-0.5 weighted contribute via the 0.325 baseline term.
201
+ const successScore = opts.success ? 1 : 0;
202
+ const durationTier = durationMs < 100 ? 1.0 :
203
+ durationMs < 500 ? 0.8 :
204
+ durationMs < 2000 ? 0.6 :
205
+ durationMs < 5000 ? 0.4 :
206
+ durationMs < 10000 ? 0.2 : 0.1;
207
+ const qualityScore = 0.25 * successScore + 0.325 + 0.10 * durationTier;
208
+ let bridge = null;
209
+ let stitchedSiblings = 0;
210
+ let insightsApplied = 0;
211
+ const txn = db.transaction(() => {
212
+ // 1. captured_experiences row
213
+ db.prepare(`
214
+ INSERT INTO captured_experiences
215
+ (id, task, agent, domain, success, quality, duration_ms,
216
+ model_tier, started_at, completed_at, source)
217
+ VALUES (?, ?, ?, ?, ?, ?, ?, NULL, datetime('now'), datetime('now'), ?)
218
+ `).run(experienceId, taskField.slice(0, 500), opts.agent, opts.domain ?? 'general', opts.success ? 1 : 0, qualityScore, durationMs, 'cli-hook-post-task');
219
+ // 2. Base experience_applications row
220
+ db.prepare(`
221
+ INSERT INTO experience_applications
222
+ (id, experience_id, task, success, tokens_saved, feedback, applied_at)
223
+ VALUES (?, ?, ?, ?, ?, ?, datetime('now'))
224
+ `).run(`app-${Date.now()}-${randomUUID().slice(0, 8)}`, experienceId, taskField, opts.success ? 1 : 0, 0, `[Patch 060] post-task outcome: ${opts.success ? 'success' : 'failure'}`);
225
+ // 3. Read bridge → fan out per-pattern application rows + delete bridge
226
+ try {
227
+ const bridgeRow = db.prepare(`
228
+ SELECT key, value FROM kv_store
229
+ WHERE namespace = 'task-bridge'
230
+ AND (expires_at IS NULL OR expires_at > strftime('%s','now') * 1000)
231
+ ORDER BY created_at DESC
232
+ LIMIT 1
233
+ `).get();
234
+ if (bridgeRow?.value) {
235
+ try {
236
+ bridge = JSON.parse(bridgeRow.value);
237
+ }
238
+ catch {
239
+ bridge = null;
240
+ }
241
+ }
242
+ if (bridge && Array.isArray(bridge.selectedPatternIds) && bridge.selectedPatternIds.length > 0) {
243
+ const perPatternTokens = bridge.estimatedTokenSavings && bridge.selectedPatternIds.length
244
+ ? Math.round(bridge.estimatedTokenSavings / bridge.selectedPatternIds.length)
245
+ : 0;
246
+ const insertApp = db.prepare(`
247
+ INSERT INTO experience_applications
248
+ (id, experience_id, task, success, tokens_saved, feedback, applied_at)
249
+ VALUES (?, ?, ?, ?, ?, ?, datetime('now'))
250
+ `);
251
+ for (const patternId of bridge.selectedPatternIds) {
252
+ insertApp.run(`app-${Date.now()}-${randomUUID().slice(0, 8)}`, experienceId, `${taskField}:pattern:${patternId}`, opts.success ? 1 : 0, perPatternTokens, `[Patch 160+300] task-bridge pattern_id=${patternId} ts=${perPatternTokens}`);
253
+ }
254
+ // 4. Delete bridge entry (one-shot consumption)
255
+ if (bridgeRow) {
256
+ db.prepare(`DELETE FROM kv_store WHERE namespace='task-bridge' AND key = ?`).run(bridgeRow.key);
257
+ }
258
+ }
259
+ }
260
+ catch (bridgeErr) {
261
+ console.error(chalk.dim(`[hooks] post-task bridge: ${bridgeErr instanceof Error ? bridgeErr.message : 'unknown'}`));
262
+ }
263
+ // 5. Single-step qe_trajectories row
264
+ const trajId = `traj-${Date.now()}-${randomUUID().slice(0, 8)}`;
265
+ db.prepare(`
266
+ INSERT INTO qe_trajectories (id, task, agent, domain, started_at, ended_at, success, steps_json)
267
+ VALUES (?, ?, ?, ?, datetime('now'), datetime('now'), ?, ?)
268
+ `).run(trajId, taskField, opts.agent, opts.domain ?? 'general', opts.success ? 1 : 0, JSON.stringify([{ step: 1, task: opts.taskId, success: opts.success }]));
269
+ // 6. Multi-step stitch — siblings sharing the same suffix taskId in the
270
+ // last hour. Only fires when ≥2 unconsolidated siblings exist.
271
+ try {
272
+ const siblings = db.prepare(`
273
+ SELECT id, task, agent, success, started_at, completed_at
274
+ FROM captured_experiences
275
+ WHERE consolidated_into IS NULL
276
+ AND task LIKE ?
277
+ AND started_at > datetime('now', '-1 hour')
278
+ ORDER BY started_at ASC
279
+ `).all(`%:${opts.taskId}`);
280
+ if (siblings.length >= 2) {
281
+ const multiTrajId = `traj-multi-${Date.now()}-${randomUUID().slice(0, 8)}`;
282
+ const stepsJson = JSON.stringify(siblings.map((s, i) => ({
283
+ step: i + 1,
284
+ task: s.task,
285
+ agent: s.agent,
286
+ success: !!s.success,
287
+ started_at: s.started_at,
288
+ completed_at: s.completed_at,
289
+ })));
290
+ const allSuccess = siblings.every((s) => !!s.success);
291
+ db.prepare(`
292
+ INSERT INTO qe_trajectories (id, task, agent, domain, started_at, ended_at, success, steps_json)
293
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?)
294
+ `).run(multiTrajId, `multi:${opts.taskId}`, opts.agent, opts.domain ?? 'general', siblings[0].started_at, siblings[siblings.length - 1].completed_at, allSuccess ? 1 : 0, stepsJson);
295
+ const placeholders = siblings.map(() => '?').join(',');
296
+ db.prepare(`UPDATE captured_experiences SET consolidated_into = ? WHERE id IN (${placeholders})`).run(multiTrajId, ...siblings.map((s) => s.id));
297
+ stitchedSiblings = siblings.length;
298
+ }
299
+ }
300
+ catch (stitchErr) {
301
+ console.error(chalk.dim(`[hooks] post-task stitch: ${stitchErr instanceof Error ? stitchErr.message : 'unknown'}`));
302
+ }
303
+ // 7. dream_insights.applied counter — only on success
304
+ if (opts.success) {
305
+ try {
306
+ const result = db.prepare(`
307
+ UPDATE dream_insights
308
+ SET applied = COALESCE(applied, 0) + 1
309
+ WHERE id IN (
310
+ SELECT id FROM dream_insights
311
+ WHERE actionable = 1
312
+ ORDER BY created_at DESC
313
+ LIMIT 3
314
+ )
315
+ `).run();
316
+ insightsApplied = result.changes ?? 0;
317
+ }
318
+ catch {
319
+ // dream_insights may not exist on minimal schemas
320
+ }
321
+ }
322
+ });
323
+ try {
324
+ txn();
325
+ }
326
+ catch (error) {
327
+ console.error(chalk.dim(`[hooks] persistTaskOutcome txn: ${error instanceof Error ? error.message : 'unknown'}`));
328
+ }
329
+ return {
330
+ experienceId,
331
+ qualityScore,
332
+ bridge,
333
+ stitchedSiblings,
334
+ insightsApplied,
335
+ };
336
+ }
337
+ /**
338
+ * Q-learning Bellman update for the hook-router state-action pair.
339
+ *
340
+ * Aligned to ADR-061/087:
341
+ * - algorithm='q-learning' (not 'asymmetric-hebbian'; that label is for
342
+ * ReasoningBank confidence updates, not Q-learning)
343
+ * - agent_id='aqe-hook-router' (per-instance partition; persistent-q-router
344
+ * convention so we don't collide with canonical RuVector q-router writes
345
+ * at agent_id='q-router')
346
+ * - state_key='${taskType}|${priority}|${domain}|${complexityBucket}'
347
+ * (structural; see q-learning-router.ts:591)
348
+ * - action_key=agent name chosen
349
+ * - id='q-learning:aqe-hook-router:${stateKey}:${actionKey}'
350
+ *
351
+ * Update: Q ← Q + α(r + γ·max_a' Q(s',a') − Q) with α=0.1, γ=0.9.
352
+ * Reward: success +0.1, failure −1.0 (asymmetric per ADR-061).
353
+ *
354
+ * Best-effort — failures swallowed to keep post-task hook responsive.
355
+ */
356
+ export async function updateHookRouterQValue(opts) {
357
+ try {
358
+ const { getUnifiedMemory } = await import('../../../kernel/unified-memory.js');
359
+ const um = getUnifiedMemory();
360
+ if (!um.isInitialized()) {
361
+ await um.initialize();
362
+ }
363
+ const db = um.getDatabase();
364
+ try {
365
+ db.pragma('busy_timeout = 60000');
366
+ }
367
+ catch { /* hook-side patient timeout (ADR-001 / patch 260) */ }
368
+ const stateKey = `${opts.taskType}|${opts.priority}|${opts.domain || 'any'}|${opts.complexityBucket}`;
369
+ const actionKey = opts.agent;
370
+ const id = `q-learning:aqe-hook-router:${stateKey}:${actionKey}`;
371
+ const reward = opts.success ? 0.1 : -1.0;
372
+ const alpha = 0.1;
373
+ const gamma = 0.9;
374
+ const existing = db.prepare(`
375
+ SELECT q_value FROM rl_q_values WHERE id = ?
376
+ `).get(id);
377
+ const oldQ = (existing && typeof existing.q_value === 'number') ? existing.q_value : 0;
378
+ const futureRow = db.prepare(`
379
+ SELECT MAX(q_value) AS m FROM rl_q_values WHERE state_key = ?
380
+ `).get(stateKey);
381
+ const futureMaxQ = (futureRow && typeof futureRow.m === 'number') ? futureRow.m : 0;
382
+ // Bellman update
383
+ const newQ = oldQ + alpha * (reward + gamma * futureMaxQ - oldQ);
384
+ db.prepare(`
385
+ INSERT INTO rl_q_values
386
+ (id, algorithm, agent_id, state_key, action_key, q_value, visits, last_reward, domain, created_at, updated_at)
387
+ VALUES (?, 'q-learning', 'aqe-hook-router', ?, ?, ?, 1, ?, ?, datetime('now'), datetime('now'))
388
+ ON CONFLICT(algorithm, agent_id, state_key, action_key) DO UPDATE SET
389
+ q_value = excluded.q_value,
390
+ visits = visits + 1,
391
+ last_reward = excluded.last_reward,
392
+ updated_at = datetime('now')
393
+ `).run(id, stateKey, actionKey, newQ, reward, opts.domain || 'any');
394
+ }
395
+ catch (error) {
396
+ console.error(chalk.dim(`[hooks] q-learning update: ${error instanceof Error ? error.message : 'unknown'}`));
397
+ }
398
+ }
399
+ /**
400
+ * Update the routing_outcomes sentinel row that pre-task wrote with
401
+ * quality=-1, success=0. Patch 150: applies the 6-dim outcome quality and
402
+ * success bit to the most-recent pending sentinel matching the agent.
403
+ *
404
+ * Best-effort — no-op when no sentinel found.
405
+ */
406
+ export async function updateRoutingOutcomeQuality(opts) {
407
+ try {
408
+ const { getUnifiedMemory } = await import('../../../kernel/unified-memory.js');
409
+ const um = getUnifiedMemory();
410
+ if (!um.isInitialized()) {
411
+ await um.initialize();
412
+ }
413
+ const db = um.getDatabase();
414
+ try {
415
+ db.pragma('busy_timeout = 60000');
416
+ }
417
+ catch { /* hook-side patient timeout (ADR-001 / patch 260) */ }
418
+ db.prepare(`
419
+ UPDATE routing_outcomes
420
+ SET success = ?, quality_score = ?, duration_ms = ?
421
+ WHERE id IN (
422
+ SELECT id FROM routing_outcomes
423
+ WHERE quality_score = -1
424
+ AND created_at > datetime('now', '-30 minutes')
425
+ ORDER BY (CASE WHEN used_agent = ? THEN 0 ELSE 1 END), created_at DESC
426
+ LIMIT 1
427
+ )
428
+ `).run(opts.success ? 1 : 0, opts.qualityScore, opts.durationMs, opts.agent);
429
+ }
430
+ catch (error) {
431
+ console.error(chalk.dim(`[hooks] routing UPDATE: ${error instanceof Error ? error.message : 'unknown'}`));
432
+ }
433
+ }
160
434
  /**
161
435
  * Lightweight experience-to-pattern consolidation.
162
436
  * Aggregates captured_experiences by domain+agent, and for clusters that meet
@@ -170,6 +444,10 @@ export async function consolidateExperiencesToPatterns() {
170
444
  await um.initialize();
171
445
  }
172
446
  const db = um.getDatabase();
447
+ try {
448
+ db.pragma('busy_timeout = 60000');
449
+ }
450
+ catch { /* hook-side patient timeout (ADR-001 / patch 260) */ }
173
451
  // Ensure consolidation columns exist (may be missing on older DBs)
174
452
  const existingCols = new Set(db.prepare('PRAGMA table_info(captured_experiences)').all().map(c => c.name));
175
453
  const migrations = [
@@ -238,13 +516,19 @@ export async function consolidateExperiencesToPatterns() {
238
516
  const patternId = uuidv4();
239
517
  const confidence = Math.min(0.95, agg.avg_quality * 0.8 + agg.success_rate * 0.2);
240
518
  const qualityScore = confidence * 0.3 + (Math.min(agg.cnt, 100) / 100) * 0.2 + agg.success_rate * 0.5;
519
+ const description = `Auto-consolidated from ${agg.cnt} experiences. Agent: ${agg.agent}, success rate: ${(agg.success_rate * 100).toFixed(0)}%`;
520
+ const tags = (agg.sources || '').split(',').filter(Boolean);
241
521
  db.prepare(`
242
522
  INSERT INTO qe_patterns (
243
523
  id, pattern_type, qe_domain, domain, name, description,
244
524
  confidence, usage_count, success_rate, quality_score, tier,
245
525
  template_json, context_json, created_at, successful_uses
246
526
  ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, datetime('now'), ?)
247
- `).run(patternId, 'workflow', agg.domain, agg.domain, patternName, `Auto-consolidated from ${agg.cnt} experiences. Agent: ${agg.agent}, success rate: ${(agg.success_rate * 100).toFixed(0)}%`, confidence, agg.cnt, agg.success_rate, qualityScore, 'short-term', JSON.stringify({ type: 'workflow', content: `${agg.agent} pattern for ${agg.domain}`, variables: [] }), JSON.stringify({ tags: (agg.sources || '').split(','), sourceType: 'session-consolidation', extractedAt: new Date().toISOString() }), agg.successes);
527
+ `).run(patternId, 'workflow', agg.domain, agg.domain, patternName, description, confidence, agg.cnt, agg.success_rate, qualityScore, 'short-term', JSON.stringify({ type: 'workflow', content: `${agg.agent} pattern for ${agg.domain}`, variables: [] }), JSON.stringify({ tags, sourceType: 'session-consolidation', extractedAt: new Date().toISOString() }), agg.successes);
528
+ // Pair the qe_patterns row with an embedding so HNSW pattern recall
529
+ // doesn't see this as a "ghost" (ADR-058 embedding-locality). Fail-soft.
530
+ const { ensurePatternEmbedding } = await import('../../../learning/embed-and-insert-pattern.js');
531
+ await ensurePatternEmbedding(db, patternId, patternName, description, tags);
248
532
  created++;
249
533
  }
250
534
  // Mark experiences as processed
@@ -33,6 +33,25 @@ export declare function getHooksSystem(): Promise<{
33
33
  * Initialize the hooks system
34
34
  */
35
35
  export declare function initializeHooksSystem(): Promise<void>;
36
+ /**
37
+ * Hook-side busy_timeout (ADR-001 Option C / patch 260).
38
+ *
39
+ * Hooks fire from short-lived `npx aqe hooks ...` subprocesses. They open the
40
+ * shared memory.db while MCP-daemon workers may be holding the WAL write-lock
41
+ * for several seconds during dream-cycle / pattern-promotion. With the default
42
+ * 5s busy_timeout, hooks fail under contention. With 60s, they wait patiently
43
+ * — the hook subprocess exits as soon as it's done, so the longer timeout has
44
+ * no broader cost.
45
+ *
46
+ * Workers in MCP still use the platform default (5s) so they fail fast and
47
+ * retry on the next tick — they yield the lock to hooks under contention.
48
+ *
49
+ * This is per-connection: setting the pragma in a hook subprocess only affects
50
+ * that subprocess's connection, not the MCP daemon's.
51
+ */
52
+ export declare function applyHookBusyTimeout(db: {
53
+ pragma: (s: string) => void;
54
+ }): void;
36
55
  /**
37
56
  * Create hybrid backend with timeout protection
38
57
  *
@@ -48,5 +67,5 @@ export declare function printJson(data: unknown): void;
48
67
  export declare function printSuccess(message: string): void;
49
68
  export declare function printError(message: string): void;
50
69
  export declare function printGuidance(guidance: string[]): void;
51
- export { DREAM_STATE_KEY, DREAM_INTERVAL_MS, DREAM_EXPERIENCE_THRESHOLD, DREAM_MIN_GAP_MS, type DreamHookState, checkAndTriggerDream, incrementDreamExperience, persistCommandExperience, consolidateExperiencesToPatterns, } from './hooks-dream-learning.js';
70
+ export { DREAM_STATE_KEY, DREAM_INTERVAL_MS, DREAM_EXPERIENCE_THRESHOLD, DREAM_MIN_GAP_MS, type DreamHookState, type TaskBridgePayload, type TaskOutcomeResult, checkAndTriggerDream, incrementDreamExperience, persistCommandExperience, persistTaskOutcome, updateHookRouterQValue, updateRoutingOutcomeQuality, consolidateExperiencesToPatterns, } from './hooks-dream-learning.js';
52
71
  //# sourceMappingURL=hooks-shared.d.ts.map
@@ -117,6 +117,30 @@ export async function initializeHooksSystem() {
117
117
  state.initialized = true;
118
118
  }
119
119
  }
120
+ /**
121
+ * Hook-side busy_timeout (ADR-001 Option C / patch 260).
122
+ *
123
+ * Hooks fire from short-lived `npx aqe hooks ...` subprocesses. They open the
124
+ * shared memory.db while MCP-daemon workers may be holding the WAL write-lock
125
+ * for several seconds during dream-cycle / pattern-promotion. With the default
126
+ * 5s busy_timeout, hooks fail under contention. With 60s, they wait patiently
127
+ * — the hook subprocess exits as soon as it's done, so the longer timeout has
128
+ * no broader cost.
129
+ *
130
+ * Workers in MCP still use the platform default (5s) so they fail fast and
131
+ * retry on the next tick — they yield the lock to hooks under contention.
132
+ *
133
+ * This is per-connection: setting the pragma in a hook subprocess only affects
134
+ * that subprocess's connection, not the MCP daemon's.
135
+ */
136
+ export function applyHookBusyTimeout(db) {
137
+ try {
138
+ db.pragma('busy_timeout = 60000');
139
+ }
140
+ catch {
141
+ // No-op if pragma fails (mocked DBs in tests, etc.)
142
+ }
143
+ }
120
144
  /**
121
145
  * Create hybrid backend with timeout protection
122
146
  *
@@ -126,13 +150,21 @@ export async function initializeHooksSystem() {
126
150
  export async function createHybridBackendWithTimeout(dataDir) {
127
151
  const timeoutMs = 5000;
128
152
  // ADR-046: Use unified memory.db path - same as all other components
129
- // HybridMemoryBackend is a facade over UnifiedMemoryManager
153
+ // HybridMemoryBackend is a facade over UnifiedMemoryManager.
154
+ //
155
+ // ADR-001 Option C / patch 260: hooks open with a 60s busy_timeout so they
156
+ // wait patiently through worker bursts (dream-cycle / pattern-promotion
157
+ // can hold the WAL write-lock for several seconds). Hooks fire from a
158
+ // short-lived `npx aqe hooks ...` process — our 60s timeout here only
159
+ // affects the hook process; the MCP daemon's worker connections inherit
160
+ // the platform default (5s) so they fail fast and retry next tick,
161
+ // yielding the lock to hooks under contention.
130
162
  const backend = new HybridMemoryBackend({
131
163
  sqlite: {
132
164
  path: path.join(dataDir, 'memory.db'), // ADR-046: Unified storage
133
165
  walMode: true,
134
166
  poolSize: 3,
135
- busyTimeout: 5000,
167
+ busyTimeout: 60000,
136
168
  },
137
169
  // agentdb.path is ignored - vectors stored in unified memory.db
138
170
  enableFallback: true,
@@ -220,5 +252,5 @@ export function printGuidance(guidance) {
220
252
  // ============================================================================
221
253
  // Dream Scheduler & Learning — re-exported from hooks-dream-learning.ts
222
254
  // ============================================================================
223
- export { DREAM_STATE_KEY, DREAM_INTERVAL_MS, DREAM_EXPERIENCE_THRESHOLD, DREAM_MIN_GAP_MS, checkAndTriggerDream, incrementDreamExperience, persistCommandExperience, consolidateExperiencesToPatterns, } from './hooks-dream-learning.js';
255
+ export { DREAM_STATE_KEY, DREAM_INTERVAL_MS, DREAM_EXPERIENCE_THRESHOLD, DREAM_MIN_GAP_MS, checkAndTriggerDream, incrementDreamExperience, persistCommandExperience, persistTaskOutcome, updateHookRouterQValue, updateRoutingOutcomeQuality, consolidateExperiencesToPatterns, } from './hooks-dream-learning.js';
224
256
  //# sourceMappingURL=hooks-shared.js.map