@remnic/core 10.0.173 → 10.0.175

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 (347) hide show
  1. package/dist/access-admin-ops-surface.js +103 -101
  2. package/dist/access-audit.js +2 -2
  3. package/dist/access-cli.js +103 -101
  4. package/dist/access-cli.js.map +1 -1
  5. package/dist/access-coding-context-resolution.js +3 -3
  6. package/dist/access-extraction-force-flush-preempt.js +103 -101
  7. package/dist/access-extraction-force-flush.js +103 -101
  8. package/dist/access-http-briefing.js +103 -101
  9. package/dist/access-http-query.js +103 -101
  10. package/dist/access-http.js +103 -101
  11. package/dist/access-identity-continuity-surface.js +103 -101
  12. package/dist/access-lcm-surface.js +103 -101
  13. package/dist/access-mcp.js +103 -101
  14. package/dist/access-memory-search-fanout.js +3 -3
  15. package/dist/access-observe-objective-state.js +2 -2
  16. package/dist/access-observe-write-surface.js +103 -101
  17. package/dist/access-offline-manifest.js +6 -6
  18. package/dist/access-operations-batch.js +103 -101
  19. package/dist/access-operations.js +103 -101
  20. package/dist/access-recall-concurrency.js +103 -101
  21. package/dist/access-recall-diagnostics.js +4 -4
  22. package/dist/access-recall-response.js +103 -101
  23. package/dist/access-recall-surface.js +103 -101
  24. package/dist/access-service.js +103 -101
  25. package/dist/active-memory-bridge.js +3 -3
  26. package/dist/active-recall.js +18 -17
  27. package/dist/active-recall.js.map +1 -1
  28. package/dist/adapters/index.js +4 -4
  29. package/dist/adapters/registry.js +2 -2
  30. package/dist/{auto-sync-ACP5U5A3.js → auto-sync-IUKNPMNI.js} +5 -5
  31. package/dist/briefing.js +16 -15
  32. package/dist/buffer.js +12 -11
  33. package/dist/calibration.js +3 -3
  34. package/dist/capabilities.d.ts +5 -3
  35. package/dist/capabilities.d.ts.map +1 -1
  36. package/dist/capabilities.js +1 -1
  37. package/dist/causal-consolidation.js +17 -16
  38. package/dist/causal-consolidation.js.map +1 -1
  39. package/dist/{chunk-QKAFFVSO.js → chunk-2EKXMZ6E.js} +2 -2
  40. package/dist/{chunk-YVXM5QFL.js → chunk-2LWXBERZ.js} +2 -2
  41. package/dist/{chunk-BJOQQCYC.js → chunk-2LXROA34.js} +8 -8
  42. package/dist/{chunk-XJTRIHTH.js → chunk-2WITFW6F.js} +3 -3
  43. package/dist/{chunk-IUM3VSHI.js → chunk-2WREX7KD.js} +10 -1
  44. package/dist/chunk-2WREX7KD.js.map +1 -0
  45. package/dist/{chunk-WF2LYKOB.js → chunk-2ZWTTXMV.js} +3 -3
  46. package/dist/{chunk-YRD525ZO.js → chunk-3FEQNKMB.js} +3 -3
  47. package/dist/{chunk-ZJ3CEAJD.js → chunk-3FS6IVSU.js} +2 -2
  48. package/dist/{chunk-Y65XX5PC.js → chunk-3SP7EZWA.js} +5 -5
  49. package/dist/{chunk-PQIFYBUX.js → chunk-4GI2IGUK.js} +2 -2
  50. package/dist/{chunk-HHVK2JRE.js → chunk-4TPU36X4.js} +2 -2
  51. package/dist/{chunk-GUF2JKG5.js → chunk-4TZOOUMK.js} +2 -2
  52. package/dist/{chunk-5PHOU5QI.js → chunk-5OBYISRA.js} +2 -2
  53. package/dist/{chunk-W35ICLYZ.js → chunk-5RBHL5TF.js} +122 -42
  54. package/dist/chunk-5RBHL5TF.js.map +1 -0
  55. package/dist/{chunk-NDPS6OU2.js → chunk-63FIQIER.js} +2 -2
  56. package/dist/{chunk-HR3DKJCU.js → chunk-6SROXED4.js} +2 -2
  57. package/dist/{chunk-EBI6FI5U.js → chunk-76LDFLAG.js} +4 -4
  58. package/dist/{chunk-5RONA5FF.js → chunk-7DFJ4JX2.js} +4 -4
  59. package/dist/{chunk-Q7OKGBZY.js → chunk-7L73PLRG.js} +2 -2
  60. package/dist/{chunk-YSATDEBY.js → chunk-A6JDNYXE.js} +2 -2
  61. package/dist/{chunk-OGQL7QC7.js → chunk-AQ6V47Q7.js} +4 -4
  62. package/dist/{chunk-E53NLIAP.js → chunk-B4ZA2PZC.js} +3 -3
  63. package/dist/{chunk-DLR3SBOM.js → chunk-B7GZL7PR.js} +2 -2
  64. package/dist/{chunk-XYNUEXLC.js → chunk-BAMF6J4W.js} +4 -4
  65. package/dist/{chunk-ESG6ITGP.js → chunk-CA5MRHBP.js} +2 -2
  66. package/dist/{chunk-JFMMEHVG.js → chunk-CWOMCAUE.js} +2 -2
  67. package/dist/{chunk-JNBSTHVT.js → chunk-CXIBBZ6N.js} +4 -4
  68. package/dist/{chunk-KSIDZDW3.js → chunk-DIXXS4HS.js} +239 -154
  69. package/dist/chunk-DIXXS4HS.js.map +1 -0
  70. package/dist/{chunk-3DJ6R4CC.js → chunk-DLPS5YP3.js} +2 -2
  71. package/dist/{chunk-JVBAPAWZ.js → chunk-DPPIBEGC.js} +2 -2
  72. package/dist/{chunk-UFX24WNJ.js → chunk-DWQAMPLW.js} +10 -10
  73. package/dist/{chunk-7SNEJNA3.js → chunk-F2XXZR6A.js} +4 -4
  74. package/dist/{chunk-3MOL7YE7.js → chunk-FDAXNHEX.js} +6 -6
  75. package/dist/{chunk-CY2C5LM4.js → chunk-FDLPNFKE.js} +2 -2
  76. package/dist/{chunk-2OAFPBQB.js → chunk-FDXLO6CX.js} +3 -3
  77. package/dist/{chunk-YN2DQ2D6.js → chunk-FE43YKNJ.js} +2 -2
  78. package/dist/{chunk-KAGLV5KH.js → chunk-FTQF3G3B.js} +2 -2
  79. package/dist/{chunk-SA2YALFU.js → chunk-FTV2C3CA.js} +2 -2
  80. package/dist/{chunk-B7HYXVME.js → chunk-FZF7JX76.js} +1 -1
  81. package/dist/chunk-FZF7JX76.js.map +1 -0
  82. package/dist/{chunk-ZYP4YEEI.js → chunk-G6V32Q4F.js} +2 -2
  83. package/dist/{chunk-W2UV6VE3.js → chunk-G77MHQFZ.js} +2 -2
  84. package/dist/{chunk-LXSDEPEK.js → chunk-GFOLOYAR.js} +2 -2
  85. package/dist/{chunk-66DUCUOC.js → chunk-GGQ3CJVH.js} +2 -2
  86. package/dist/{chunk-C6S353AG.js → chunk-HAB7LLE7.js} +2 -2
  87. package/dist/{chunk-LAOJHOTG.js → chunk-HHKUWNHQ.js} +2 -2
  88. package/dist/{chunk-SAPC7N43.js → chunk-HOTAHSO3.js} +5 -5
  89. package/dist/{chunk-L5EE2CXU.js → chunk-IFXQGDMG.js} +2 -2
  90. package/dist/{chunk-EXYT52NR.js → chunk-IOBQMVVL.js} +2 -2
  91. package/dist/{chunk-7G5NTS7F.js → chunk-J66ZJW5U.js} +2 -2
  92. package/dist/{chunk-X5MFCZDL.js → chunk-JUROR7PB.js} +3 -3
  93. package/dist/{chunk-QKBFVLDH.js → chunk-JXYFXVPB.js} +2 -2
  94. package/dist/{chunk-4AKPTHOO.js → chunk-KNYUEYB6.js} +2 -2
  95. package/dist/{chunk-TNRCDMQT.js → chunk-KQ473UMU.js} +2 -2
  96. package/dist/{chunk-LMJVP5CM.js → chunk-KUCMDUEZ.js} +2 -2
  97. package/dist/{chunk-SOQOUZ2Y.js → chunk-KYPFQO43.js} +6 -6
  98. package/dist/{chunk-LH57QATU.js → chunk-KZBE4KBZ.js} +3 -3
  99. package/dist/{chunk-PXY2B7BG.js → chunk-MEB4NJO7.js} +2 -2
  100. package/dist/{chunk-6VFMEBXY.js → chunk-MFJM35R7.js} +7 -7
  101. package/dist/{chunk-QCFZDYYG.js → chunk-MLNDSATI.js} +2 -2
  102. package/dist/{chunk-5JD4DXQX.js → chunk-MNDIM6JB.js} +3 -1
  103. package/dist/chunk-MNDIM6JB.js.map +1 -0
  104. package/dist/{chunk-C5LWPYS3.js → chunk-MOWZCAKS.js} +3 -1
  105. package/dist/{chunk-C5LWPYS3.js.map → chunk-MOWZCAKS.js.map} +1 -1
  106. package/dist/{chunk-SX4BR26Y.js → chunk-NT7JD6D6.js} +2 -2
  107. package/dist/{chunk-RK7SE3BL.js → chunk-NWZEDYHT.js} +2 -2
  108. package/dist/{chunk-YY5UXARJ.js → chunk-OTE5E44O.js} +3 -3
  109. package/dist/{chunk-KW4XA7GM.js → chunk-P3SMXKFR.js} +2 -2
  110. package/dist/{chunk-A2XFG462.js → chunk-PCLTJUOY.js} +2 -2
  111. package/dist/{chunk-5JCYPBY5.js → chunk-PDMGJH4K.js} +2 -2
  112. package/dist/{chunk-H6TCS5XX.js → chunk-RASE4TEF.js} +2 -2
  113. package/dist/{chunk-JDH2BA2P.js → chunk-RXAWE76Y.js} +2 -2
  114. package/dist/{chunk-IXI6S2VJ.js → chunk-S45VECVD.js} +29 -2
  115. package/dist/chunk-S45VECVD.js.map +1 -0
  116. package/dist/{chunk-QXTKN25V.js → chunk-SVXUH3FP.js} +2 -2
  117. package/dist/{chunk-YE77U5HZ.js → chunk-T3NEDSLZ.js} +4 -4
  118. package/dist/{chunk-BFZFNXOC.js → chunk-TQXKUQFX.js} +2 -2
  119. package/dist/{chunk-BGSYM3SH.js → chunk-U4ECSKQE.js} +3 -3
  120. package/dist/{chunk-RHQL2RIM.js → chunk-V425GW5W.js} +2 -2
  121. package/dist/{chunk-4DLGKTM6.js → chunk-V5FCMJW4.js} +2 -2
  122. package/dist/{chunk-5MA6ZQ4Z.js → chunk-VBQ3FIS2.js} +2 -2
  123. package/dist/{chunk-BVRZSI7Q.js → chunk-VN3RYYMS.js} +2 -2
  124. package/dist/chunk-VOVSZYCP.js +581 -0
  125. package/dist/chunk-VOVSZYCP.js.map +1 -0
  126. package/dist/{chunk-4E2Z44CV.js → chunk-VR6NF6VX.js} +2 -2
  127. package/dist/{chunk-QRCE77YX.js → chunk-W3O3OEQ7.js} +4 -4
  128. package/dist/{chunk-UBG65KEY.js → chunk-WTYVXUKQ.js} +3 -3
  129. package/dist/chunk-XBJOO7G5.js +87 -0
  130. package/dist/chunk-XBJOO7G5.js.map +1 -0
  131. package/dist/{chunk-WECKZ3KT.js → chunk-Y6FJDJUK.js} +4 -4
  132. package/dist/{chunk-ETTV5F53.js → chunk-YMNPQMHA.js} +2 -2
  133. package/dist/{chunk-4LVQSHHN.js → chunk-ZBDTOWGX.js} +9 -9
  134. package/dist/{chunk-YCK26VSL.js → chunk-ZMEEOLQG.js} +2 -2
  135. package/dist/{chunk-R2AJAAHJ.js → chunk-ZNHLUYIT.js} +90 -16
  136. package/dist/chunk-ZNHLUYIT.js.map +1 -0
  137. package/dist/{chunk-DAOMWGO2.js → chunk-ZX5N5D6M.js} +4 -4
  138. package/dist/cli.js +103 -101
  139. package/dist/coding/export-okf-codegraph.js +18 -17
  140. package/dist/coding/export-okf-codegraph.js.map +1 -1
  141. package/dist/compounding/engine.js +18 -17
  142. package/dist/compounding/preference-consolidator.js +7 -571
  143. package/dist/compounding/preference-consolidator.js.map +1 -1
  144. package/dist/config.js +18 -17
  145. package/dist/connectors/codex-materialize-runner.js +16 -15
  146. package/dist/connectors/index.js +17 -16
  147. package/dist/contradiction/index.js +3 -3
  148. package/dist/{contradiction-scan-DTQFAW22.js → contradiction-scan-QSGW4CMA.js} +3 -3
  149. package/dist/convergence-refresh.js +18 -17
  150. package/dist/corpus-watermark.js +18 -17
  151. package/dist/day-summary.js +2 -2
  152. package/dist/embedding-fallback.js +2 -2
  153. package/dist/entity-recall-reads.js +2 -2
  154. package/dist/entity-retrieval.js +17 -16
  155. package/dist/explicit-capture.js +103 -101
  156. package/dist/extraction-judge.js +3 -3
  157. package/dist/extraction-normalization.js +3 -3
  158. package/dist/extraction-prompt.js +2 -2
  159. package/dist/extraction.js +27 -26
  160. package/dist/{first-start-migration-PPPP54X6.js → first-start-migration-TCPK2I7J.js} +5 -5
  161. package/dist/harmonic-retrieval.js +16 -15
  162. package/dist/index.js +135 -133
  163. package/dist/lcm/index.js +3 -3
  164. package/dist/local-llm.js +2 -2
  165. package/dist/location/index.js +17 -16
  166. package/dist/maintenance/memory-governance.js +16 -15
  167. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +16 -15
  168. package/dist/maintenance/rebuild-memory-projection-runner.js +18 -17
  169. package/dist/maintenance/rebuild-memory-projection.js +17 -16
  170. package/dist/memory-browse.js +9 -8
  171. package/dist/namespaces/migrate.js +17 -16
  172. package/dist/namespaces/principal.js +2 -2
  173. package/dist/namespaces/search.d.ts +5 -1
  174. package/dist/namespaces/search.d.ts.map +1 -1
  175. package/dist/namespaces/search.js +14 -13
  176. package/dist/namespaces/storage.js +16 -15
  177. package/dist/offline-sync-impression-drain.js +5 -5
  178. package/dist/operator-doctor-corpus.js +19 -18
  179. package/dist/operator-toolkit.js +28 -27
  180. package/dist/orchestration/backlog-scheduler.js +104 -102
  181. package/dist/orchestration/backlog-scheduler.js.map +1 -1
  182. package/dist/orchestration/buffer-drain-runner.js +104 -102
  183. package/dist/orchestration/compounding-recall-sections.d.ts +17 -0
  184. package/dist/orchestration/compounding-recall-sections.d.ts.map +1 -0
  185. package/dist/orchestration/compression-guideline-coordinator.js +2 -2
  186. package/dist/orchestration/maintenance.js +29 -28
  187. package/dist/orchestration/recall-internal.d.ts.map +1 -1
  188. package/dist/orchestrator.d.ts.map +1 -1
  189. package/dist/orchestrator.js +103 -101
  190. package/dist/qmd-daemon-session.d.ts +8 -0
  191. package/dist/qmd-daemon-session.d.ts.map +1 -1
  192. package/dist/qmd-daemon-session.js +1 -1
  193. package/dist/qmd-health-metadata.d.ts +39 -0
  194. package/dist/qmd-health-metadata.d.ts.map +1 -0
  195. package/dist/qmd-health-metadata.js +12 -0
  196. package/dist/qmd-status.d.ts.map +1 -1
  197. package/dist/qmd-status.js +1 -1
  198. package/dist/qmd.d.ts +5 -1
  199. package/dist/qmd.d.ts.map +1 -1
  200. package/dist/qmd.js +8 -7
  201. package/dist/recall-attempt-timing.js +3 -3
  202. package/dist/recall-composition-decision.js +2 -2
  203. package/dist/recall-navigation.js +103 -101
  204. package/dist/recall-phase2-timing.d.ts +1 -1
  205. package/dist/recall-phase2-timing.d.ts.map +1 -1
  206. package/dist/recall-phase2-timing.js +1 -1
  207. package/dist/recall-state-view-admission.js +9 -8
  208. package/dist/recall-timings.js +2 -2
  209. package/dist/recall-why-service.js +13 -12
  210. package/dist/recall-why.js +3 -3
  211. package/dist/rerank-outcome.js +2 -2
  212. package/dist/{resolution-CV6QEYEZ.js → resolution-RWIGFH2W.js} +4 -4
  213. package/dist/resolution-RWIGFH2W.js.map +1 -0
  214. package/dist/resume-bundles.js +21 -20
  215. package/dist/search/embed-helper.js +2 -2
  216. package/dist/search/factory.js +13 -12
  217. package/dist/search/index.js +13 -12
  218. package/dist/search/lancedb-backend.js +2 -2
  219. package/dist/search/meilisearch-backend.js +2 -2
  220. package/dist/search/orama-backend.js +2 -2
  221. package/dist/search/port.d.ts +21 -0
  222. package/dist/search/port.d.ts.map +1 -1
  223. package/dist/search/port.js +1 -1
  224. package/dist/search/remote-backend.js +2 -2
  225. package/dist/semantic-consolidation.js +17 -16
  226. package/dist/semantic-rule-promotion.js +16 -15
  227. package/dist/semantic-rule-verifier.js +16 -15
  228. package/dist/shared-context/manager.js +2 -2
  229. package/dist/source-agent-qualifier.js +22 -21
  230. package/dist/standup/build.js +16 -15
  231. package/dist/storage.js +15 -14
  232. package/dist/summarizer.js +3 -3
  233. package/dist/support-passport/index.js +3 -3
  234. package/dist/{tier-stats-XWJSVEHC.js → tier-stats-DXIBRUZH.js} +2 -2
  235. package/dist/transcript.js +2 -2
  236. package/dist/transfer/export-okf.js +16 -15
  237. package/dist/verified-recall.js +16 -15
  238. package/dist/who-knows-cli.js +17 -16
  239. package/dist/who-knows.js +16 -15
  240. package/package.json +2 -2
  241. package/src/capabilities.test.ts +6 -4
  242. package/src/capabilities.ts +7 -7
  243. package/src/irc-preference-recall.test.ts +85 -0
  244. package/src/namespaces/search.test.ts +320 -4
  245. package/src/namespaces/search.ts +147 -51
  246. package/src/orchestration/compounding-recall-sections.ts +134 -0
  247. package/src/orchestration/recall-internal.ts +34 -48
  248. package/src/orchestrator.ts +0 -3
  249. package/src/qmd-client.test.ts +34 -3
  250. package/src/qmd-daemon-session.ts +34 -1
  251. package/src/qmd-health-metadata.test.ts +493 -0
  252. package/src/qmd-health-metadata.ts +95 -0
  253. package/src/qmd-status.ts +10 -1
  254. package/src/qmd.ts +83 -3
  255. package/src/recall-phase2-timing.ts +2 -0
  256. package/src/search/port.ts +23 -0
  257. package/dist/chunk-5JD4DXQX.js.map +0 -1
  258. package/dist/chunk-B7HYXVME.js.map +0 -1
  259. package/dist/chunk-IUM3VSHI.js.map +0 -1
  260. package/dist/chunk-IXI6S2VJ.js.map +0 -1
  261. package/dist/chunk-KSIDZDW3.js.map +0 -1
  262. package/dist/chunk-R2AJAAHJ.js.map +0 -1
  263. package/dist/chunk-W35ICLYZ.js.map +0 -1
  264. /package/dist/{auto-sync-ACP5U5A3.js.map → auto-sync-IUKNPMNI.js.map} +0 -0
  265. /package/dist/{chunk-QKAFFVSO.js.map → chunk-2EKXMZ6E.js.map} +0 -0
  266. /package/dist/{chunk-YVXM5QFL.js.map → chunk-2LWXBERZ.js.map} +0 -0
  267. /package/dist/{chunk-BJOQQCYC.js.map → chunk-2LXROA34.js.map} +0 -0
  268. /package/dist/{chunk-XJTRIHTH.js.map → chunk-2WITFW6F.js.map} +0 -0
  269. /package/dist/{chunk-WF2LYKOB.js.map → chunk-2ZWTTXMV.js.map} +0 -0
  270. /package/dist/{chunk-YRD525ZO.js.map → chunk-3FEQNKMB.js.map} +0 -0
  271. /package/dist/{chunk-ZJ3CEAJD.js.map → chunk-3FS6IVSU.js.map} +0 -0
  272. /package/dist/{chunk-Y65XX5PC.js.map → chunk-3SP7EZWA.js.map} +0 -0
  273. /package/dist/{chunk-PQIFYBUX.js.map → chunk-4GI2IGUK.js.map} +0 -0
  274. /package/dist/{chunk-HHVK2JRE.js.map → chunk-4TPU36X4.js.map} +0 -0
  275. /package/dist/{chunk-GUF2JKG5.js.map → chunk-4TZOOUMK.js.map} +0 -0
  276. /package/dist/{chunk-5PHOU5QI.js.map → chunk-5OBYISRA.js.map} +0 -0
  277. /package/dist/{chunk-NDPS6OU2.js.map → chunk-63FIQIER.js.map} +0 -0
  278. /package/dist/{chunk-HR3DKJCU.js.map → chunk-6SROXED4.js.map} +0 -0
  279. /package/dist/{chunk-EBI6FI5U.js.map → chunk-76LDFLAG.js.map} +0 -0
  280. /package/dist/{chunk-5RONA5FF.js.map → chunk-7DFJ4JX2.js.map} +0 -0
  281. /package/dist/{chunk-Q7OKGBZY.js.map → chunk-7L73PLRG.js.map} +0 -0
  282. /package/dist/{chunk-YSATDEBY.js.map → chunk-A6JDNYXE.js.map} +0 -0
  283. /package/dist/{chunk-OGQL7QC7.js.map → chunk-AQ6V47Q7.js.map} +0 -0
  284. /package/dist/{chunk-E53NLIAP.js.map → chunk-B4ZA2PZC.js.map} +0 -0
  285. /package/dist/{chunk-DLR3SBOM.js.map → chunk-B7GZL7PR.js.map} +0 -0
  286. /package/dist/{chunk-XYNUEXLC.js.map → chunk-BAMF6J4W.js.map} +0 -0
  287. /package/dist/{chunk-ESG6ITGP.js.map → chunk-CA5MRHBP.js.map} +0 -0
  288. /package/dist/{chunk-JFMMEHVG.js.map → chunk-CWOMCAUE.js.map} +0 -0
  289. /package/dist/{chunk-JNBSTHVT.js.map → chunk-CXIBBZ6N.js.map} +0 -0
  290. /package/dist/{chunk-3DJ6R4CC.js.map → chunk-DLPS5YP3.js.map} +0 -0
  291. /package/dist/{chunk-JVBAPAWZ.js.map → chunk-DPPIBEGC.js.map} +0 -0
  292. /package/dist/{chunk-UFX24WNJ.js.map → chunk-DWQAMPLW.js.map} +0 -0
  293. /package/dist/{chunk-7SNEJNA3.js.map → chunk-F2XXZR6A.js.map} +0 -0
  294. /package/dist/{chunk-3MOL7YE7.js.map → chunk-FDAXNHEX.js.map} +0 -0
  295. /package/dist/{chunk-CY2C5LM4.js.map → chunk-FDLPNFKE.js.map} +0 -0
  296. /package/dist/{chunk-2OAFPBQB.js.map → chunk-FDXLO6CX.js.map} +0 -0
  297. /package/dist/{chunk-YN2DQ2D6.js.map → chunk-FE43YKNJ.js.map} +0 -0
  298. /package/dist/{chunk-KAGLV5KH.js.map → chunk-FTQF3G3B.js.map} +0 -0
  299. /package/dist/{chunk-SA2YALFU.js.map → chunk-FTV2C3CA.js.map} +0 -0
  300. /package/dist/{chunk-ZYP4YEEI.js.map → chunk-G6V32Q4F.js.map} +0 -0
  301. /package/dist/{chunk-W2UV6VE3.js.map → chunk-G77MHQFZ.js.map} +0 -0
  302. /package/dist/{chunk-LXSDEPEK.js.map → chunk-GFOLOYAR.js.map} +0 -0
  303. /package/dist/{chunk-66DUCUOC.js.map → chunk-GGQ3CJVH.js.map} +0 -0
  304. /package/dist/{chunk-C6S353AG.js.map → chunk-HAB7LLE7.js.map} +0 -0
  305. /package/dist/{chunk-LAOJHOTG.js.map → chunk-HHKUWNHQ.js.map} +0 -0
  306. /package/dist/{chunk-SAPC7N43.js.map → chunk-HOTAHSO3.js.map} +0 -0
  307. /package/dist/{chunk-L5EE2CXU.js.map → chunk-IFXQGDMG.js.map} +0 -0
  308. /package/dist/{chunk-EXYT52NR.js.map → chunk-IOBQMVVL.js.map} +0 -0
  309. /package/dist/{chunk-7G5NTS7F.js.map → chunk-J66ZJW5U.js.map} +0 -0
  310. /package/dist/{chunk-X5MFCZDL.js.map → chunk-JUROR7PB.js.map} +0 -0
  311. /package/dist/{chunk-QKBFVLDH.js.map → chunk-JXYFXVPB.js.map} +0 -0
  312. /package/dist/{chunk-4AKPTHOO.js.map → chunk-KNYUEYB6.js.map} +0 -0
  313. /package/dist/{chunk-TNRCDMQT.js.map → chunk-KQ473UMU.js.map} +0 -0
  314. /package/dist/{chunk-LMJVP5CM.js.map → chunk-KUCMDUEZ.js.map} +0 -0
  315. /package/dist/{chunk-SOQOUZ2Y.js.map → chunk-KYPFQO43.js.map} +0 -0
  316. /package/dist/{chunk-LH57QATU.js.map → chunk-KZBE4KBZ.js.map} +0 -0
  317. /package/dist/{chunk-PXY2B7BG.js.map → chunk-MEB4NJO7.js.map} +0 -0
  318. /package/dist/{chunk-6VFMEBXY.js.map → chunk-MFJM35R7.js.map} +0 -0
  319. /package/dist/{chunk-QCFZDYYG.js.map → chunk-MLNDSATI.js.map} +0 -0
  320. /package/dist/{chunk-SX4BR26Y.js.map → chunk-NT7JD6D6.js.map} +0 -0
  321. /package/dist/{chunk-RK7SE3BL.js.map → chunk-NWZEDYHT.js.map} +0 -0
  322. /package/dist/{chunk-YY5UXARJ.js.map → chunk-OTE5E44O.js.map} +0 -0
  323. /package/dist/{chunk-KW4XA7GM.js.map → chunk-P3SMXKFR.js.map} +0 -0
  324. /package/dist/{chunk-A2XFG462.js.map → chunk-PCLTJUOY.js.map} +0 -0
  325. /package/dist/{chunk-5JCYPBY5.js.map → chunk-PDMGJH4K.js.map} +0 -0
  326. /package/dist/{chunk-H6TCS5XX.js.map → chunk-RASE4TEF.js.map} +0 -0
  327. /package/dist/{chunk-JDH2BA2P.js.map → chunk-RXAWE76Y.js.map} +0 -0
  328. /package/dist/{chunk-QXTKN25V.js.map → chunk-SVXUH3FP.js.map} +0 -0
  329. /package/dist/{chunk-YE77U5HZ.js.map → chunk-T3NEDSLZ.js.map} +0 -0
  330. /package/dist/{chunk-BFZFNXOC.js.map → chunk-TQXKUQFX.js.map} +0 -0
  331. /package/dist/{chunk-BGSYM3SH.js.map → chunk-U4ECSKQE.js.map} +0 -0
  332. /package/dist/{chunk-RHQL2RIM.js.map → chunk-V425GW5W.js.map} +0 -0
  333. /package/dist/{chunk-4DLGKTM6.js.map → chunk-V5FCMJW4.js.map} +0 -0
  334. /package/dist/{chunk-5MA6ZQ4Z.js.map → chunk-VBQ3FIS2.js.map} +0 -0
  335. /package/dist/{chunk-BVRZSI7Q.js.map → chunk-VN3RYYMS.js.map} +0 -0
  336. /package/dist/{chunk-4E2Z44CV.js.map → chunk-VR6NF6VX.js.map} +0 -0
  337. /package/dist/{chunk-QRCE77YX.js.map → chunk-W3O3OEQ7.js.map} +0 -0
  338. /package/dist/{chunk-UBG65KEY.js.map → chunk-WTYVXUKQ.js.map} +0 -0
  339. /package/dist/{chunk-WECKZ3KT.js.map → chunk-Y6FJDJUK.js.map} +0 -0
  340. /package/dist/{chunk-ETTV5F53.js.map → chunk-YMNPQMHA.js.map} +0 -0
  341. /package/dist/{chunk-4LVQSHHN.js.map → chunk-ZBDTOWGX.js.map} +0 -0
  342. /package/dist/{chunk-YCK26VSL.js.map → chunk-ZMEEOLQG.js.map} +0 -0
  343. /package/dist/{chunk-DAOMWGO2.js.map → chunk-ZX5N5D6M.js.map} +0 -0
  344. /package/dist/{contradiction-scan-DTQFAW22.js.map → contradiction-scan-QSGW4CMA.js.map} +0 -0
  345. /package/dist/{first-start-migration-PPPP54X6.js.map → first-start-migration-TCPK2I7J.js.map} +0 -0
  346. /package/dist/{resolution-CV6QEYEZ.js.map → qmd-health-metadata.js.map} +0 -0
  347. /package/dist/{tier-stats-XWJSVEHC.js.map → tier-stats-DXIBRUZH.js.map} +0 -0
@@ -1,576 +1,12 @@
1
1
  import {
2
- log
3
- } from "../chunk-3WCASNQZ.js";
2
+ augmentWithCausalPreferences,
3
+ buildQueryAwarePreferenceSection,
4
+ consolidatePreferences,
5
+ scorePreferencesForQuery,
6
+ synthesizePreferencesFromLcm
7
+ } from "../chunk-VOVSZYCP.js";
8
+ import "../chunk-3WCASNQZ.js";
4
9
  import "../chunk-PZ5AY32C.js";
5
-
6
- // src/compounding/preference-consolidator.ts
7
- var PREFERENCE_EXTRACTORS = [
8
- // "Avoids X" / negated use/work/code statements → negative preference
9
- {
10
- pattern: /(?:avoids?|avoided|dislikes?|disliked|hates?|hated|does\s+not\s+(?:prefer|like|love|enjoy|favou?r)s?|doesn'?t\s+(?:prefer|like|love|enjoy|favou?r)s?|did\s+not\s+(?:prefer|like|love|enjoy|favou?r)s?|didn'?t\s+(?:prefer|like|love|enjoy|favou?r)s?|would\s+not\s+(?:prefer|like|love|enjoy|favou?r)s?|wouldn'?t\s+(?:prefer|like|love|enjoy|favou?r)s?|won'?t\s+(?:prefer|like|love|enjoy|favou?r)s?|never\s+(?:prefers?|likes?|loves?|enjoys?|favou?rs?)|no\s+longer\s+(?:prefers?|likes?|loves?|enjoys?|favou?rs?)|never\s+uses?|does\s+not\s+uses?|doesn'?t\s+uses?|does\s+not\s+use|doesn'?t\s+use|would\s+not\s+use|wouldn'?t\s+use|won'?t\s+use|never\s+works?\s+(?:with|in)|does\s+not\s+works?\s+(?:with|in)|doesn'?t\s+works?\s+(?:with|in)|would\s+not\s+works?\s+(?:with|in)|wouldn'?t\s+works?\s+(?:with|in)|won'?t\s+works?\s+(?:with|in)|never\s+codes?\s+(?:in|with)|does\s+not\s+codes?\s+(?:in|with)|doesn'?t\s+codes?\s+(?:in|with)|would\s+not\s+codes?\s+(?:in|with)|wouldn'?t\s+codes?\s+(?:in|with)|won'?t\s+codes?\s+(?:in|with)|refuses\s+to\s+(?:use|work\s+(?:with|in)|code\s+(?:in|with)))\s+([^.!?]+?)(?=\s+(?:(?:but|however|though|although|except|instead|rather)\b|and\s+(?:(?:now|currently|instead|rather)\b|(?=(?:prefer\w*|enjoy\w*|likes|like\s+to|loves?|loving|favou?r\w*|uses?|works?\s+(?:with|in)|codes?\s+(?:in|with)|interested\s+in|passionate\s+about|focused\s+on|specializ\w*)\b)))|[.!?]|$)/im,
11
- transform: (match) => {
12
- const subject = match[1].replace(/\.$/, "").trim();
13
- return `The user would not prefer ${subject}`;
14
- }
15
- },
16
- // "Would like to X" / "like to X" → preference for doing X
17
- {
18
- pattern: /\blikes?\s+to\s+([^.!?]+?)(?:\s+(?:for|when|in|over)\s+([^.!?]+?))?(?=[.!?]|$)/im,
19
- transform: (match) => {
20
- const action = match[1].replace(/\.$/, "").trim();
21
- const context = match[2] ? ` for ${match[2].replace(/\.$/, "").trim()}` : "";
22
- return `The user prefers to ${action}${context}`;
23
- }
24
- },
25
- // Direct preference statements
26
- {
27
- pattern: /\b(?:prefers?|enjoys?|likes|loves?|loving|favou?rs?)\s+(.+?)(?:\s+(?:for|when|in|over)\s+(.+?))?$/im,
28
- transform: (match) => {
29
- const subject = match[1].replace(/\.$/, "").trim();
30
- const context = match[2] ? ` for ${match[2].replace(/\.$/, "").trim()}` : "";
31
- return `The user prefers ${subject}${context}`;
32
- }
33
- },
34
- // "Uses X for Y" → preference for X in Y context
35
- {
36
- pattern: /(?:uses?|works?\s+(?:with|in)|codes?\s+(?:in|with))\s+([^.!?]+?)(?:\s+(?:for|to|when)\s+([^.!?]+?))?(?=[.!?]|$)/i,
37
- transform: (match) => {
38
- const tool = match[1].replace(/\s+/g, " ").replace(/\.$/, "").trim();
39
- const context = match[2] ? ` for ${match[2].replace(/\s+/g, " ").replace(/\.$/, "").trim()}` : "";
40
- return `The user prefers to use ${tool}${context}`;
41
- }
42
- },
43
- // "Interested in X" → preference for X-related content
44
- {
45
- pattern: /(?:interested\s+in|passionate\s+about|focused\s+on|specializes?\s+in)\s+(.+?)$/im,
46
- transform: (match) => {
47
- const subject = match[1].replace(/\.$/, "").trim();
48
- return `The user would prefer content related to ${subject}`;
49
- }
50
- },
51
- // "X is preferred" / "prefers X over Y"
52
- {
53
- pattern: /(.+?)\s+is\s+preferred(?:\s+over\s+(.+?))?$/im,
54
- transform: (match) => {
55
- const preferred = match[1].replace(/\.$/, "").trim();
56
- const over = match[2] ? `. They would not prefer ${match[2].replace(/\.$/, "").trim()}` : "";
57
- return `The user would prefer ${preferred}${over}`;
58
- }
59
- }
60
- ];
61
- var FACT_PREFERENCE_LANGUAGE_PATTERN = /\b(?:prefer\w*|enjoy\w*|likes|like\s+to|loves?|loving|favou?r\w*|avoid\w*|dislik\w*|hat(?:e|es|ed|ing)|interested\s+in|passionate\s+about|specializ\w*|go-to)\b/i;
62
- var FACT_USE_CONTEXT_PATTERN = /\b(?:uses?|works?\s+(?:with|in)|codes?\s+(?:in|with))\b[^.!?]+\b(?:for|to|when)\b/i;
63
- var DOUBLE_NEGATED_AVERSION_PATTERN = /\b(?:does\s+not|doesn'?t|did\s+not|didn'?t|never|no\s+longer)\s+(?:avoids?|avoided|dislikes?|disliked|hates?|hated)\b/i;
64
- var DOUBLE_NEGATED_AVERSION_GLOBAL_PATTERN = /\b(?:does\s+not|doesn'?t|did\s+not|didn'?t|never|no\s+longer)\s+(?:avoids?|avoided|dislikes?|disliked|hates?|hated)\b/gi;
65
- var WITHDRAWN_PREFERENCE_PATTERN = /\b(?:avoids?|avoided|dislikes?|disliked|hates?|hated|does\s+not\s+(?:prefer|like|love|enjoy|favou?r)s?|doesn'?t\s+(?:prefer|like|love|enjoy|favou?r)s?|did\s+not\s+(?:prefer|like|love|enjoy|favou?r)s?|didn'?t\s+(?:prefer|like|love|enjoy|favou?r)s?|would\s+not\s+(?:prefer|like|love|enjoy|favou?r)s?|wouldn'?t\s+(?:prefer|like|love|enjoy|favou?r)s?|won'?t\s+(?:prefer|like|love|enjoy|favou?r)s?|never\s+(?:prefers?|likes?|loves?|enjoys?|favou?rs?)|no\s+longer\s+(?:prefers?|likes?|loves?|enjoys?|favou?rs?))\b/i;
66
- var REPLACEMENT_PREFERENCE_CLAUSE_PATTERN = /\b(?:(?:but|however|though|although)\s+(?:now\s+|currently\s+|instead\s+|rather\s+)?|and\s+(?:now\s+|currently\s+|instead\s+|rather\s+)?)(?=(?:prefer\w*|enjoy\w*|likes|like\s+to|loves?|loving|favou?r\w*|uses?|works?\s+(?:with|in)|codes?\s+(?:in|with)|interested\s+in|passionate\s+about|focused\s+on|specializ\w*)\b)/i;
67
- function replacementPreferenceClause(content) {
68
- const match = REPLACEMENT_PREFERENCE_CLAUSE_PATTERN.exec(content);
69
- if (!match) return null;
70
- const clause = content.slice(match.index + match[0].length).trim();
71
- return clause.replace(/[.!?]+$/, "").trim().length > 0 ? clause : null;
72
- }
73
- function fallbackPreferenceStatement(content, category) {
74
- const trimmed = content.trim().replace(/\.$/, "");
75
- if (/^the\s+user/i.test(trimmed)) {
76
- return trimmed;
77
- }
78
- if (category === "correction") {
79
- return `The user corrected that: ${trimmed}. This indicates a preference that should be respected.`;
80
- }
81
- if (category === "preference") {
82
- if (/style|approach|method|workflow|process|manner/i.test(trimmed)) {
83
- return `The user would prefer this approach: ${trimmed}`;
84
- }
85
- return `The user prefers: ${trimmed}`;
86
- }
87
- return `The user prefers: ${trimmed}`;
88
- }
89
- function extractKeywords(text) {
90
- const stopWords = /* @__PURE__ */ new Set([
91
- "the",
92
- "a",
93
- "an",
94
- "is",
95
- "are",
96
- "was",
97
- "were",
98
- "be",
99
- "been",
100
- "being",
101
- "have",
102
- "has",
103
- "had",
104
- "do",
105
- "does",
106
- "did",
107
- "will",
108
- "would",
109
- "shall",
110
- "should",
111
- "may",
112
- "might",
113
- "can",
114
- "could",
115
- "must",
116
- "ought",
117
- "to",
118
- "of",
119
- "in",
120
- "for",
121
- "on",
122
- "with",
123
- "at",
124
- "by",
125
- "from",
126
- "as",
127
- "into",
128
- "through",
129
- "during",
130
- "before",
131
- "after",
132
- "above",
133
- "below",
134
- "between",
135
- "but",
136
- "and",
137
- "or",
138
- "not",
139
- "no",
140
- "nor",
141
- "so",
142
- "yet",
143
- "both",
144
- "either",
145
- "neither",
146
- "each",
147
- "every",
148
- "all",
149
- "any",
150
- "few",
151
- "more",
152
- "most",
153
- "other",
154
- "some",
155
- "such",
156
- "than",
157
- "too",
158
- "very",
159
- "that",
160
- "this",
161
- "these",
162
- "those",
163
- "user",
164
- "prefer",
165
- "prefers",
166
- "preferred",
167
- "would",
168
- "like",
169
- "likes",
170
- "use",
171
- "uses",
172
- "using",
173
- "used",
174
- "content",
175
- "related"
176
- ]);
177
- return text.toLowerCase().replace(/[^a-z0-9\s-]/g, " ").split(/\s+/).filter((w) => w.length > 2 && !stopWords.has(w)).slice(0, 10);
178
- }
179
- function consolidatePreferences(memories, opts) {
180
- const maxPreferences = opts?.maxPreferences ?? 20;
181
- const includeCorrections = opts?.includeCorrections ?? true;
182
- const minConfidence = opts?.minConfidence ?? 0.3;
183
- const relevantCategories = includeCorrections ? ["preference", "correction"] : ["preference"];
184
- const relevant = memories.filter((m) => {
185
- if (!relevantCategories.includes(m.frontmatter.category)) return false;
186
- if (m.frontmatter.status && m.frontmatter.status !== "active") return false;
187
- if ((m.frontmatter.confidence ?? 0) < minConfidence) return false;
188
- if (!m.content || m.content.trim().length < 10) return false;
189
- return true;
190
- });
191
- const preferenceFactMemories = memories.filter((m) => {
192
- if (m.frontmatter.category !== "fact") return false;
193
- if (m.frontmatter.status && m.frontmatter.status !== "active") return false;
194
- if ((m.frontmatter.confidence ?? 0) < minConfidence) return false;
195
- return FACT_PREFERENCE_LANGUAGE_PATTERN.test(m.content) || FACT_USE_CONTEXT_PATTERN.test(m.content);
196
- });
197
- const allRelevant = [...relevant, ...preferenceFactMemories];
198
- if (allRelevant.length === 0) {
199
- return { preferences: [], recallSection: null };
200
- }
201
- const seen = /* @__PURE__ */ new Set();
202
- const deduped = allRelevant.filter((m) => {
203
- const key = m.content.trim().toLowerCase().slice(0, 80);
204
- if (seen.has(key)) return false;
205
- seen.add(key);
206
- return true;
207
- });
208
- deduped.sort((a, b) => {
209
- const confDiff = (b.frontmatter.confidence ?? 0) - (a.frontmatter.confidence ?? 0);
210
- if (confDiff !== 0) return confDiff;
211
- return b.frontmatter.created.localeCompare(a.frontmatter.created);
212
- });
213
- const preferences = [];
214
- for (const mem of deduped.slice(0, maxPreferences * 2)) {
215
- const content = mem.content.trim();
216
- const hasDoubleNegatedAversion = DOUBLE_NEGATED_AVERSION_PATTERN.test(content);
217
- const hasWithdrawnPreference = WITHDRAWN_PREFERENCE_PATTERN.test(content);
218
- const strippedContent = hasDoubleNegatedAversion ? content.replace(DOUBLE_NEGATED_AVERSION_GLOBAL_PATTERN, " ").trim() : content;
219
- const replacementContent = hasWithdrawnPreference ? replacementPreferenceClause(strippedContent) : null;
220
- const extractionContent = replacementContent ?? strippedContent;
221
- let statement = null;
222
- for (const extractor of PREFERENCE_EXTRACTORS) {
223
- const match = extractionContent.match(extractor.pattern);
224
- if (match) {
225
- statement = extractor.transform(match, extractionContent);
226
- break;
227
- }
228
- }
229
- if (!statement && hasDoubleNegatedAversion) {
230
- continue;
231
- }
232
- if (!statement) {
233
- statement = fallbackPreferenceStatement(replacementContent ?? content, mem.frontmatter.category);
234
- }
235
- if (statement.length < 20 && !replacementContent) continue;
236
- const keywords = extractKeywords(statement);
237
- preferences.push({
238
- statement,
239
- sourceIds: [mem.frontmatter.id],
240
- category: mem.frontmatter.category,
241
- confidence: mem.frontmatter.confidence ?? 0.7,
242
- keywords
243
- });
244
- }
245
- const finalPreferences = preferences.slice(0, maxPreferences);
246
- if (finalPreferences.length === 0) {
247
- return { preferences: [], recallSection: null };
248
- }
249
- const recallSection = buildPreferenceRecallSection(finalPreferences);
250
- return { preferences: finalPreferences, recallSection };
251
- }
252
- function buildPreferenceRecallSection(preferences) {
253
- if (preferences.length === 0) return "";
254
- const lines = [
255
- "## User Preferences (Consolidated)",
256
- "",
257
- "Known preferences and corrections learned from previous interactions:",
258
- ""
259
- ];
260
- for (const pref of preferences) {
261
- const confPct = Math.round(pref.confidence * 100);
262
- lines.push(`- ${pref.statement} _(confidence: ${confPct}%)_`);
263
- }
264
- lines.push("");
265
- return lines.join("\n");
266
- }
267
- function scorePreferencesForQuery(preferences, query) {
268
- const queryTokens = new Set(
269
- query.toLowerCase().replace(/[^a-z0-9\s-]/g, " ").split(/\s+/).filter((w) => w.length > 2)
270
- );
271
- return preferences.map((pref) => {
272
- let score = 0;
273
- const exactMatched = /* @__PURE__ */ new Set();
274
- for (const kw of pref.keywords) {
275
- if (queryTokens.has(kw)) {
276
- score += 1;
277
- exactMatched.add(kw);
278
- }
279
- }
280
- for (const kw of pref.keywords) {
281
- if (exactMatched.has(kw)) continue;
282
- for (const qt of queryTokens) {
283
- if (kw.startsWith(qt) || qt.startsWith(kw)) score += 0.5;
284
- }
285
- }
286
- const stmtLower = pref.statement.toLowerCase();
287
- for (const qt of queryTokens) {
288
- if (stmtLower.includes(qt)) score += 0.3;
289
- }
290
- score *= pref.confidence;
291
- return { preference: pref, score };
292
- }).sort((a, b) => b.score - a.score);
293
- }
294
- function buildQueryAwarePreferenceSection(preferences, query, maxItems = 10) {
295
- const scored = scorePreferencesForQuery(preferences, query);
296
- const relevant = scored.filter((s) => s.score > 0).slice(0, maxItems);
297
- if (relevant.length === 0) {
298
- const topByConfidence = preferences.slice(0, Math.min(5, maxItems)).map((p) => ({ preference: p, score: p.confidence }));
299
- if (topByConfidence.length === 0) return null;
300
- return buildPreferenceRecallSection(topByConfidence.map((s) => s.preference));
301
- }
302
- return buildPreferenceRecallSection(relevant.map((s) => s.preference));
303
- }
304
- var CONVERSATION_PREFERENCE_PATTERNS = [
305
- {
306
- // "I prefer X", "I really enjoy X", "I always like X", etc.
307
- // Excludes negation words: "I don't like X" should NOT match.
308
- detect: /\b(?:I|i)\s+(?!don'?t\s|never\s|rarely\s|hardly\s|not\s|no\s)(?:\w+\s+)?(?:prefer|enjoy|like|love|favor)\b/,
309
- extract: (content) => {
310
- const results = [];
311
- const re = /\b[Ii]\s+(?!don'?t\s|never\s|rarely\s|hardly\s|not\s|no\s)(?:\w+\s+)?(prefer|enjoy|like|love|favor)\s+(.+?)(?:\.|,|!|\?|$)/g;
312
- let m;
313
- while ((m = re.exec(content)) !== null) {
314
- const subject = m[2].trim().replace(/\s+/g, " ");
315
- if (subject.length > 2 && subject.length < 200) {
316
- results.push({ verb: m[1], subject });
317
- }
318
- }
319
- return results;
320
- }
321
- },
322
- {
323
- // "I use X", "I usually work with X", "I code in X"
324
- detect: /\b(?:I|i)\s+(?!don'?t\s|never\s|rarely\s|hardly\s|not\s|no\s)(?:\w+\s+)?(?:use|work\s+with|code\s+in|program\s+in)\b/,
325
- extract: (content) => {
326
- const results = [];
327
- const re = /\b[Ii]\s+(?!don'?t\s|never\s|rarely\s|hardly\s|not\s|no\s)(?:\w+\s+)?(use|work\s+with|code\s+in|program\s+in)\s+(.+?)(?:\.|,|!|\?|$)/g;
328
- let m;
329
- while ((m = re.exec(content)) !== null) {
330
- const subject = m[2].trim().replace(/\s+/g, " ");
331
- if (subject.length > 2 && subject.length < 200) {
332
- results.push({ verb: "use", subject });
333
- }
334
- }
335
- return results;
336
- }
337
- },
338
- {
339
- // "my favorite X", "my preferred X", "my go-to X", "my favorite is X"
340
- detect: /\bmy\s+(?:favorite|favourite|preferred|go-to)\b/i,
341
- extract: (content) => {
342
- const results = [];
343
- const isRe = /\bmy\s+(?:favorite|favourite|preferred|go-to)\s+is\s+(.+?)(?:\.|,|!|\?|$)/gi;
344
- let m;
345
- while ((m = isRe.exec(content)) !== null) {
346
- const what = m[1].trim();
347
- if (what.length > 2 && what.length < 200) {
348
- results.push({ verb: "favorite", subject: what.replace(/\s+/g, " ") });
349
- }
350
- }
351
- const nounRe = /\bmy\s+(?:favorite|favourite|preferred|go-to)\s+(?!is\b)(.+?)(?:\.|,|!|\?|$)/gi;
352
- while ((m = nounRe.exec(content)) !== null) {
353
- const what = m[1].trim();
354
- if (what.length > 2 && what.length < 200) {
355
- results.push({ verb: "favorite", subject: what.replace(/\s+/g, " ") });
356
- }
357
- }
358
- return results;
359
- }
360
- },
361
- {
362
- // "I'd rather X", "I would prefer X"
363
- detect: /\b(?:I'd|I\s+would)\s+(?:rather|prefer)\b/i,
364
- extract: (content) => {
365
- const results = [];
366
- const re = /\b(?:I'd|I\s+would)\s+(?:rather|prefer)\s+(.+?)(?:\.|,|!|\?|$)/gi;
367
- let m;
368
- while ((m = re.exec(content)) !== null) {
369
- const subject = m[1].trim().replace(/\s+/g, " ");
370
- if (subject.length > 2 && subject.length < 200) {
371
- results.push({ verb: "would prefer", subject });
372
- }
373
- }
374
- return results;
375
- }
376
- },
377
- {
378
- // "I'm a fan of X", "I'm into X", "I'm fond of X", "I'm interested in X"
379
- detect: /\bI'?m\s+(?:a\s+fan\s+of|into|fond\s+of|interested\s+in|passionate\s+about)\b/i,
380
- extract: (content) => {
381
- const results = [];
382
- const re = /\bI'?m\s+(?:a\s+fan\s+of|into|fond\s+of|interested\s+in|passionate\s+about)\s+(.+?)(?:\.|,|!|\?|$)/gi;
383
- let m;
384
- while ((m = re.exec(content)) !== null) {
385
- const subject = m[1].trim().replace(/\s+/g, " ");
386
- if (subject.length > 2 && subject.length < 200) {
387
- results.push({ verb: "interested in", subject });
388
- }
389
- }
390
- return results;
391
- }
392
- }
393
- ];
394
- function formatPreferenceStatement(verb, subject) {
395
- const s = subject.replace(/\s+/g, " ").trim();
396
- switch (verb) {
397
- case "use":
398
- return `The user prefers to use ${s}`;
399
- case "enjoy":
400
- return `The user enjoys ${s}`;
401
- case "love":
402
- return `The user loves ${s}`;
403
- case "interested in":
404
- return `The user is interested in ${s}`;
405
- case "favorite":
406
- return `The user's favorite is ${s}`;
407
- case "would prefer":
408
- return `The user would prefer ${s}`;
409
- default:
410
- return `The user prefers ${s}`;
411
- }
412
- }
413
- function extractNamedEntities(text) {
414
- const entities = [];
415
- const seen = /* @__PURE__ */ new Set();
416
- const properNounRe = /\b([A-Z][a-z]+(?:\s+[A-Z][a-z]+)+)\b/g;
417
- let m;
418
- while ((m = properNounRe.exec(text)) !== null) {
419
- const entity = m[1].trim();
420
- const key = entity.toLowerCase();
421
- if (!seen.has(key) && entity.length > 3) {
422
- seen.add(key);
423
- entities.push(entity);
424
- }
425
- }
426
- const productRe = /\b([A-Z][a-zA-Z]+(?:\s+[A-Z0-9][a-zA-Z0-9]*)+)\b/g;
427
- while ((m = productRe.exec(text)) !== null) {
428
- const entity = m[1].trim();
429
- const key = entity.toLowerCase();
430
- if (!seen.has(key) && entity.length > 3) {
431
- seen.add(key);
432
- entities.push(entity);
433
- }
434
- }
435
- const toolRe = /\b(Adobe\s+\w+(?:\s+\w+)?|Google\s+\w+|Microsoft\s+\w+|Apple\s+\w+)\b/gi;
436
- while ((m = toolRe.exec(text)) !== null) {
437
- const entity = m[1].trim();
438
- const key = entity.toLowerCase();
439
- if (!seen.has(key)) {
440
- seen.add(key);
441
- entities.push(entity);
442
- }
443
- }
444
- return entities;
445
- }
446
- function extractQueryIntent(query) {
447
- const intentPatterns = [
448
- /(?:can you|could you|please)\s+(recommend|suggest|advise|help|find|show|give|provide|point|share)\b/i,
449
- /(?:any|some)\s+(recommendations?|suggestions?|tips?|ideas?|advice)\b/i,
450
- /\b(recommend|suggest|advise)\s+(?:me|some|a|an)/i
451
- ];
452
- for (const p of intentPatterns) {
453
- const m = query.match(p);
454
- if (m) return m[1].toLowerCase().replace(/s$/, "");
455
- }
456
- return null;
457
- }
458
- function formatExpandedPreference(verb, subject, queryIntent, sourceContext) {
459
- const s = subject.replace(/\s+/g, " ").trim();
460
- const statements = [];
461
- statements.push(formatPreferenceStatement(verb, s));
462
- statements.push(`The user would prefer ${s}`);
463
- if (queryIntent) {
464
- statements.push(`The user would prefer responses that ${queryIntent} ${s}`);
465
- statements.push(`The user would prefer responses that suggest ${s}`);
466
- statements.push(`The user would prefer responses that suggest resources specifically tailored to ${s}`);
467
- statements.push(`The user would prefer suggestions of ${s}`);
468
- statements.push(`The user would prefer suggestions related to ${s}`);
469
- }
470
- statements.push(`They might not prefer general alternatives unrelated to ${s}`);
471
- if (verb === "interested in" || verb === "enjoy" || verb === "love") {
472
- statements.push(`The user would be interested in content related to ${s}`);
473
- statements.push(`The user would prefer content related to ${s}`);
474
- }
475
- return statements;
476
- }
477
- async function synthesizePreferencesFromLcm(lcmEngine, query, sessionId, maxPrefs = 20) {
478
- const results = await lcmEngine.searchContextFull(query, 30, sessionId);
479
- const userMessages = results.filter((r) => r.role === "user");
480
- if (userMessages.length === 0) {
481
- log.debug("[irc] synthesizePreferencesFromLcm: no user messages found");
482
- return null;
483
- }
484
- const queryIntent = extractQueryIntent(query);
485
- const preferences = [];
486
- const seenSubjects = /* @__PURE__ */ new Set();
487
- for (const msg of userMessages) {
488
- let hasPreferenceSignal = false;
489
- for (const pattern of CONVERSATION_PREFERENCE_PATTERNS) {
490
- if (!pattern.detect.test(msg.content)) continue;
491
- hasPreferenceSignal = true;
492
- const extracted = pattern.extract(msg.content);
493
- for (const { verb, subject } of extracted) {
494
- if (subject.length < 4 || /^(to|for|in|with|on|at|the|a|an)\s/i.test(subject)) continue;
495
- const key = subject.toLowerCase().slice(0, 80);
496
- if (seenSubjects.has(key)) continue;
497
- seenSubjects.add(key);
498
- const expandedStatements = formatExpandedPreference(
499
- verb,
500
- subject,
501
- queryIntent,
502
- msg.content
503
- );
504
- preferences.push({
505
- statements: expandedStatements,
506
- source: msg.content.length > 200 ? msg.content.slice(0, 200) + "..." : msg.content
507
- });
508
- if (preferences.length >= maxPrefs) break;
509
- }
510
- }
511
- if (hasPreferenceSignal || /prefer|enjoy|like|love|interested|passionate|favorite/i.test(msg.content)) {
512
- const entities = extractNamedEntities(msg.content);
513
- for (const entity of entities) {
514
- const key = entity.toLowerCase().slice(0, 80);
515
- if (seenSubjects.has(key)) continue;
516
- seenSubjects.add(key);
517
- const expandedStatements = formatExpandedPreference(
518
- "prefer",
519
- entity,
520
- queryIntent,
521
- msg.content
522
- );
523
- preferences.push({
524
- statements: expandedStatements,
525
- source: msg.content.length > 200 ? msg.content.slice(0, 200) + "..." : msg.content
526
- });
527
- if (preferences.length >= maxPrefs) break;
528
- }
529
- }
530
- if (preferences.length >= maxPrefs) break;
531
- }
532
- if (preferences.length === 0) {
533
- log.debug("[irc] synthesizePreferencesFromLcm: no preference signals detected");
534
- return null;
535
- }
536
- const lines = [
537
- "## User Preferences (from Conversation History)",
538
- ""
539
- ];
540
- for (const pref of preferences) {
541
- for (const stmt of pref.statements) {
542
- lines.push(`- ${stmt}`);
543
- }
544
- lines.push(` _Source: "${pref.source}"_`);
545
- }
546
- lines.push("");
547
- log.debug(
548
- `[irc] synthesizePreferencesFromLcm: ${preferences.length} preference(s) from ${userMessages.length} messages`
549
- );
550
- return lines.join("\n");
551
- }
552
- async function augmentWithCausalPreferences(existingPreferences, options) {
553
- try {
554
- const { extractCausalBehaviorSignals, synthesizeCausalPreferences } = await import("../causal-behavior.js");
555
- const signals = await extractCausalBehaviorSignals({
556
- memoryDir: options.memoryDir,
557
- causalTrajectoryStoreDir: options.causalTrajectoryStoreDir,
558
- config: {
559
- minFrequency: options.behaviorMinFrequency,
560
- minSessions: options.behaviorMinSessions,
561
- confidenceThreshold: options.behaviorConfidenceThreshold
562
- }
563
- });
564
- if (signals.length === 0) return existingPreferences;
565
- const causalPreferences = synthesizeCausalPreferences(signals, options.behaviorConfidenceThreshold);
566
- if (causalPreferences.length === 0) return existingPreferences;
567
- log.debug(`[cmc] augmented preferences with ${causalPreferences.length} causal behavior preference(s)`);
568
- return [...existingPreferences, ...causalPreferences];
569
- } catch (error) {
570
- log.warn(`[cmc] causal preference augmentation failed (non-fatal): ${error instanceof Error ? error.message : String(error)}`);
571
- return existingPreferences;
572
- }
573
- }
574
10
  export {
575
11
  augmentWithCausalPreferences,
576
12
  buildQueryAwarePreferenceSection,