@remnic/core 10.0.173 → 10.0.174

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 (267) hide show
  1. package/dist/access-admin-ops-surface.js +71 -70
  2. package/dist/access-cli.js +71 -70
  3. package/dist/access-cli.js.map +1 -1
  4. package/dist/access-coding-context-resolution.js +3 -3
  5. package/dist/access-extraction-force-flush-preempt.js +71 -70
  6. package/dist/access-extraction-force-flush.js +71 -70
  7. package/dist/access-http-briefing.js +71 -70
  8. package/dist/access-http-query.js +71 -70
  9. package/dist/access-http.js +71 -70
  10. package/dist/access-identity-continuity-surface.js +71 -70
  11. package/dist/access-lcm-surface.js +71 -70
  12. package/dist/access-mcp.js +71 -70
  13. package/dist/access-memory-search-fanout.js +3 -3
  14. package/dist/access-observe-objective-state.js +2 -2
  15. package/dist/access-observe-write-surface.js +71 -70
  16. package/dist/access-offline-manifest.js +6 -6
  17. package/dist/access-operations-batch.js +71 -70
  18. package/dist/access-operations.js +71 -70
  19. package/dist/access-recall-concurrency.js +71 -70
  20. package/dist/access-recall-diagnostics.js +4 -4
  21. package/dist/access-recall-response.js +71 -70
  22. package/dist/access-recall-surface.js +71 -70
  23. package/dist/access-service.js +71 -70
  24. package/dist/active-memory-bridge.js +3 -3
  25. package/dist/active-recall.js +7 -7
  26. package/dist/{auto-sync-ACP5U5A3.js → auto-sync-IUKNPMNI.js} +5 -5
  27. package/dist/briefing.js +6 -6
  28. package/dist/buffer.js +5 -5
  29. package/dist/calibration.js +3 -3
  30. package/dist/capabilities.d.ts +5 -3
  31. package/dist/capabilities.d.ts.map +1 -1
  32. package/dist/capabilities.js +1 -1
  33. package/dist/causal-consolidation.js +7 -7
  34. package/dist/{chunk-A2XFG462.js → chunk-27BH67PT.js} +2 -2
  35. package/dist/{chunk-SA2YALFU.js → chunk-2GQVYLQK.js} +2 -2
  36. package/dist/{chunk-YVXM5QFL.js → chunk-2LWXBERZ.js} +2 -2
  37. package/dist/{chunk-XJTRIHTH.js → chunk-2WITFW6F.js} +3 -3
  38. package/dist/{chunk-YRD525ZO.js → chunk-3FEQNKMB.js} +3 -3
  39. package/dist/{chunk-QKBFVLDH.js → chunk-4ACKO4U2.js} +2 -2
  40. package/dist/{chunk-PQIFYBUX.js → chunk-4PBHMJRC.js} +2 -2
  41. package/dist/{chunk-LH57QATU.js → chunk-4WOEEMGK.js} +3 -3
  42. package/dist/{chunk-W35ICLYZ.js → chunk-5MTKGNZ5.js} +3 -3
  43. package/dist/{chunk-5PHOU5QI.js → chunk-5OBYISRA.js} +2 -2
  44. package/dist/{chunk-NDPS6OU2.js → chunk-63FIQIER.js} +2 -2
  45. package/dist/{chunk-7SNEJNA3.js → chunk-6OMSYPOL.js} +4 -4
  46. package/dist/{chunk-YSATDEBY.js → chunk-A6JDNYXE.js} +2 -2
  47. package/dist/{chunk-ETTV5F53.js → chunk-AM6H7BIY.js} +2 -2
  48. package/dist/{chunk-SOQOUZ2Y.js → chunk-ASWECJXS.js} +4 -4
  49. package/dist/{chunk-LAOJHOTG.js → chunk-BN5SK2RZ.js} +2 -2
  50. package/dist/{chunk-ESG6ITGP.js → chunk-CA5MRHBP.js} +2 -2
  51. package/dist/{chunk-JFMMEHVG.js → chunk-CWOMCAUE.js} +2 -2
  52. package/dist/{chunk-GUF2JKG5.js → chunk-DMPZABKG.js} +2 -2
  53. package/dist/{chunk-JVBAPAWZ.js → chunk-DPPIBEGC.js} +2 -2
  54. package/dist/{chunk-QRCE77YX.js → chunk-EXGY5TPU.js} +4 -4
  55. package/dist/{chunk-2OAFPBQB.js → chunk-FDXLO6CX.js} +3 -3
  56. package/dist/{chunk-YN2DQ2D6.js → chunk-FE43YKNJ.js} +2 -2
  57. package/dist/{chunk-ZYP4YEEI.js → chunk-G6V32Q4F.js} +2 -2
  58. package/dist/{chunk-LXSDEPEK.js → chunk-GFOLOYAR.js} +2 -2
  59. package/dist/{chunk-E53NLIAP.js → chunk-H4KIMZJD.js} +3 -3
  60. package/dist/{chunk-C6S353AG.js → chunk-HAB7LLE7.js} +2 -2
  61. package/dist/{chunk-RHQL2RIM.js → chunk-HB2PRTXX.js} +2 -2
  62. package/dist/{chunk-ZJ3CEAJD.js → chunk-IHB3JO4B.js} +2 -2
  63. package/dist/{chunk-QKAFFVSO.js → chunk-IO4AAVYZ.js} +2 -2
  64. package/dist/{chunk-EXYT52NR.js → chunk-IOBQMVVL.js} +2 -2
  65. package/dist/{chunk-7G5NTS7F.js → chunk-J66ZJW5U.js} +2 -2
  66. package/dist/{chunk-SAPC7N43.js → chunk-KMOH6W5B.js} +5 -5
  67. package/dist/{chunk-4AKPTHOO.js → chunk-KNYUEYB6.js} +2 -2
  68. package/dist/{chunk-KW4XA7GM.js → chunk-KPLKABGR.js} +2 -2
  69. package/dist/{chunk-TNRCDMQT.js → chunk-KQ473UMU.js} +2 -2
  70. package/dist/{chunk-LMJVP5CM.js → chunk-KUCMDUEZ.js} +2 -2
  71. package/dist/{chunk-EBI6FI5U.js → chunk-L3DDKXQJ.js} +4 -4
  72. package/dist/{chunk-YY5UXARJ.js → chunk-LKXW6W42.js} +3 -3
  73. package/dist/{chunk-PXY2B7BG.js → chunk-MEB4NJO7.js} +2 -2
  74. package/dist/{chunk-QCFZDYYG.js → chunk-MLNDSATI.js} +2 -2
  75. package/dist/{chunk-5JD4DXQX.js → chunk-MNDIM6JB.js} +3 -1
  76. package/dist/chunk-MNDIM6JB.js.map +1 -0
  77. package/dist/{chunk-C5LWPYS3.js → chunk-MOWZCAKS.js} +3 -1
  78. package/dist/{chunk-C5LWPYS3.js.map → chunk-MOWZCAKS.js.map} +1 -1
  79. package/dist/{chunk-SX4BR26Y.js → chunk-NT7JD6D6.js} +2 -2
  80. package/dist/{chunk-JNBSTHVT.js → chunk-NTR72OL5.js} +4 -4
  81. package/dist/{chunk-RK7SE3BL.js → chunk-NWZEDYHT.js} +2 -2
  82. package/dist/{chunk-Q7OKGBZY.js → chunk-OK3X3TBR.js} +2 -2
  83. package/dist/{chunk-X5MFCZDL.js → chunk-OWBI5477.js} +3 -3
  84. package/dist/{chunk-3MOL7YE7.js → chunk-OWD365QW.js} +6 -6
  85. package/dist/{chunk-L5EE2CXU.js → chunk-OY3IULYL.js} +2 -2
  86. package/dist/{chunk-5JCYPBY5.js → chunk-PDMGJH4K.js} +2 -2
  87. package/dist/{chunk-4LVQSHHN.js → chunk-QVXRE66C.js} +9 -9
  88. package/dist/{chunk-H6TCS5XX.js → chunk-RASE4TEF.js} +2 -2
  89. package/dist/{chunk-UFX24WNJ.js → chunk-RSUNBJ4I.js} +10 -10
  90. package/dist/{chunk-4E2Z44CV.js → chunk-SNI526DD.js} +2 -2
  91. package/dist/{chunk-QXTKN25V.js → chunk-SVXUH3FP.js} +2 -2
  92. package/dist/{chunk-BJOQQCYC.js → chunk-TOQK5A4Y.js} +3 -3
  93. package/dist/{chunk-BFZFNXOC.js → chunk-TQXKUQFX.js} +2 -2
  94. package/dist/{chunk-BGSYM3SH.js → chunk-U4ECSKQE.js} +3 -3
  95. package/dist/{chunk-Y65XX5PC.js → chunk-UBQ2ZOWA.js} +4 -4
  96. package/dist/{chunk-6VFMEBXY.js → chunk-V6MN37WG.js} +7 -7
  97. package/dist/{chunk-KSIDZDW3.js → chunk-V6UFCV6T.js} +194 -109
  98. package/dist/chunk-V6UFCV6T.js.map +1 -0
  99. package/dist/{chunk-5MA6ZQ4Z.js → chunk-VBQ3FIS2.js} +2 -2
  100. package/dist/{chunk-BVRZSI7Q.js → chunk-VN3RYYMS.js} +2 -2
  101. package/dist/chunk-VOVSZYCP.js +581 -0
  102. package/dist/chunk-VOVSZYCP.js.map +1 -0
  103. package/dist/{chunk-OGQL7QC7.js → chunk-WKNMKV52.js} +4 -4
  104. package/dist/{chunk-YE77U5HZ.js → chunk-WTFHZQXM.js} +4 -4
  105. package/dist/{chunk-UBG65KEY.js → chunk-WTYVXUKQ.js} +3 -3
  106. package/dist/{chunk-4DLGKTM6.js → chunk-XKFL2WQO.js} +2 -2
  107. package/dist/{chunk-WF2LYKOB.js → chunk-Y2LZW3EQ.js} +2 -2
  108. package/dist/{chunk-WECKZ3KT.js → chunk-Y6FJDJUK.js} +4 -4
  109. package/dist/{chunk-W2UV6VE3.js → chunk-ZKXNSPGQ.js} +2 -2
  110. package/dist/cli.js +71 -70
  111. package/dist/coding/export-okf-codegraph.js +8 -8
  112. package/dist/compounding/engine.js +8 -8
  113. package/dist/compounding/preference-consolidator.js +7 -571
  114. package/dist/compounding/preference-consolidator.js.map +1 -1
  115. package/dist/config.js +7 -7
  116. package/dist/connectors/codex-materialize-runner.js +6 -6
  117. package/dist/connectors/index.js +7 -7
  118. package/dist/contradiction/index.js +3 -3
  119. package/dist/{contradiction-scan-DTQFAW22.js → contradiction-scan-QSGW4CMA.js} +3 -3
  120. package/dist/convergence-refresh.js +8 -8
  121. package/dist/corpus-watermark.js +8 -8
  122. package/dist/day-summary.js +2 -2
  123. package/dist/embedding-fallback.js +2 -2
  124. package/dist/entity-recall-reads.js +2 -2
  125. package/dist/entity-retrieval.js +7 -7
  126. package/dist/explicit-capture.js +71 -70
  127. package/dist/extraction-judge.js +3 -3
  128. package/dist/extraction-normalization.js +3 -3
  129. package/dist/extraction-prompt.js +2 -2
  130. package/dist/extraction.js +16 -16
  131. package/dist/{first-start-migration-PPPP54X6.js → first-start-migration-CCZ5SM3V.js} +2 -2
  132. package/dist/harmonic-retrieval.js +6 -6
  133. package/dist/index.js +71 -70
  134. package/dist/local-llm.js +2 -2
  135. package/dist/location/index.js +7 -7
  136. package/dist/maintenance/memory-governance.js +6 -6
  137. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +6 -6
  138. package/dist/maintenance/rebuild-memory-projection-runner.js +8 -8
  139. package/dist/maintenance/rebuild-memory-projection.js +7 -7
  140. package/dist/namespaces/migrate.js +7 -7
  141. package/dist/namespaces/principal.js +2 -2
  142. package/dist/namespaces/search.js +4 -4
  143. package/dist/namespaces/storage.js +6 -6
  144. package/dist/offline-sync-impression-drain.js +5 -5
  145. package/dist/operator-doctor-corpus.js +9 -9
  146. package/dist/operator-toolkit.js +17 -17
  147. package/dist/orchestration/backlog-scheduler.js +72 -71
  148. package/dist/orchestration/backlog-scheduler.js.map +1 -1
  149. package/dist/orchestration/buffer-drain-runner.js +72 -71
  150. package/dist/orchestration/compounding-recall-sections.d.ts +17 -0
  151. package/dist/orchestration/compounding-recall-sections.d.ts.map +1 -0
  152. package/dist/orchestration/compression-guideline-coordinator.js +2 -2
  153. package/dist/orchestration/maintenance.js +19 -19
  154. package/dist/orchestration/recall-internal.d.ts.map +1 -1
  155. package/dist/orchestrator.d.ts.map +1 -1
  156. package/dist/orchestrator.js +71 -70
  157. package/dist/recall-attempt-timing.js +3 -3
  158. package/dist/recall-navigation.js +71 -70
  159. package/dist/recall-phase2-timing.d.ts +1 -1
  160. package/dist/recall-phase2-timing.d.ts.map +1 -1
  161. package/dist/recall-phase2-timing.js +1 -1
  162. package/dist/recall-timings.js +2 -2
  163. package/dist/recall-why-service.js +5 -5
  164. package/dist/recall-why.js +3 -3
  165. package/dist/rerank-outcome.js +2 -2
  166. package/dist/{resolution-CV6QEYEZ.js → resolution-RWIGFH2W.js} +4 -4
  167. package/dist/resume-bundles.js +8 -8
  168. package/dist/search/embed-helper.js +2 -2
  169. package/dist/search/factory.js +3 -3
  170. package/dist/search/index.js +3 -3
  171. package/dist/semantic-consolidation.js +7 -7
  172. package/dist/semantic-rule-promotion.js +6 -6
  173. package/dist/semantic-rule-verifier.js +6 -6
  174. package/dist/shared-context/manager.js +2 -2
  175. package/dist/source-agent-qualifier.js +11 -11
  176. package/dist/standup/build.js +6 -6
  177. package/dist/storage.js +5 -5
  178. package/dist/summarizer.js +3 -3
  179. package/dist/support-passport/index.js +3 -3
  180. package/dist/{tier-stats-XWJSVEHC.js → tier-stats-DXIBRUZH.js} +2 -2
  181. package/dist/transfer/export-okf.js +6 -6
  182. package/dist/verified-recall.js +6 -6
  183. package/dist/who-knows-cli.js +7 -7
  184. package/dist/who-knows.js +6 -6
  185. package/package.json +2 -2
  186. package/src/capabilities.test.ts +6 -4
  187. package/src/capabilities.ts +7 -7
  188. package/src/irc-preference-recall.test.ts +85 -0
  189. package/src/orchestration/compounding-recall-sections.ts +134 -0
  190. package/src/orchestration/recall-internal.ts +34 -48
  191. package/src/orchestrator.ts +0 -3
  192. package/src/recall-phase2-timing.ts +2 -0
  193. package/dist/chunk-5JD4DXQX.js.map +0 -1
  194. package/dist/chunk-KSIDZDW3.js.map +0 -1
  195. /package/dist/{auto-sync-ACP5U5A3.js.map → auto-sync-IUKNPMNI.js.map} +0 -0
  196. /package/dist/{chunk-A2XFG462.js.map → chunk-27BH67PT.js.map} +0 -0
  197. /package/dist/{chunk-SA2YALFU.js.map → chunk-2GQVYLQK.js.map} +0 -0
  198. /package/dist/{chunk-YVXM5QFL.js.map → chunk-2LWXBERZ.js.map} +0 -0
  199. /package/dist/{chunk-XJTRIHTH.js.map → chunk-2WITFW6F.js.map} +0 -0
  200. /package/dist/{chunk-YRD525ZO.js.map → chunk-3FEQNKMB.js.map} +0 -0
  201. /package/dist/{chunk-QKBFVLDH.js.map → chunk-4ACKO4U2.js.map} +0 -0
  202. /package/dist/{chunk-PQIFYBUX.js.map → chunk-4PBHMJRC.js.map} +0 -0
  203. /package/dist/{chunk-LH57QATU.js.map → chunk-4WOEEMGK.js.map} +0 -0
  204. /package/dist/{chunk-W35ICLYZ.js.map → chunk-5MTKGNZ5.js.map} +0 -0
  205. /package/dist/{chunk-5PHOU5QI.js.map → chunk-5OBYISRA.js.map} +0 -0
  206. /package/dist/{chunk-NDPS6OU2.js.map → chunk-63FIQIER.js.map} +0 -0
  207. /package/dist/{chunk-7SNEJNA3.js.map → chunk-6OMSYPOL.js.map} +0 -0
  208. /package/dist/{chunk-YSATDEBY.js.map → chunk-A6JDNYXE.js.map} +0 -0
  209. /package/dist/{chunk-ETTV5F53.js.map → chunk-AM6H7BIY.js.map} +0 -0
  210. /package/dist/{chunk-SOQOUZ2Y.js.map → chunk-ASWECJXS.js.map} +0 -0
  211. /package/dist/{chunk-LAOJHOTG.js.map → chunk-BN5SK2RZ.js.map} +0 -0
  212. /package/dist/{chunk-ESG6ITGP.js.map → chunk-CA5MRHBP.js.map} +0 -0
  213. /package/dist/{chunk-JFMMEHVG.js.map → chunk-CWOMCAUE.js.map} +0 -0
  214. /package/dist/{chunk-GUF2JKG5.js.map → chunk-DMPZABKG.js.map} +0 -0
  215. /package/dist/{chunk-JVBAPAWZ.js.map → chunk-DPPIBEGC.js.map} +0 -0
  216. /package/dist/{chunk-QRCE77YX.js.map → chunk-EXGY5TPU.js.map} +0 -0
  217. /package/dist/{chunk-2OAFPBQB.js.map → chunk-FDXLO6CX.js.map} +0 -0
  218. /package/dist/{chunk-YN2DQ2D6.js.map → chunk-FE43YKNJ.js.map} +0 -0
  219. /package/dist/{chunk-ZYP4YEEI.js.map → chunk-G6V32Q4F.js.map} +0 -0
  220. /package/dist/{chunk-LXSDEPEK.js.map → chunk-GFOLOYAR.js.map} +0 -0
  221. /package/dist/{chunk-E53NLIAP.js.map → chunk-H4KIMZJD.js.map} +0 -0
  222. /package/dist/{chunk-C6S353AG.js.map → chunk-HAB7LLE7.js.map} +0 -0
  223. /package/dist/{chunk-RHQL2RIM.js.map → chunk-HB2PRTXX.js.map} +0 -0
  224. /package/dist/{chunk-ZJ3CEAJD.js.map → chunk-IHB3JO4B.js.map} +0 -0
  225. /package/dist/{chunk-QKAFFVSO.js.map → chunk-IO4AAVYZ.js.map} +0 -0
  226. /package/dist/{chunk-EXYT52NR.js.map → chunk-IOBQMVVL.js.map} +0 -0
  227. /package/dist/{chunk-7G5NTS7F.js.map → chunk-J66ZJW5U.js.map} +0 -0
  228. /package/dist/{chunk-SAPC7N43.js.map → chunk-KMOH6W5B.js.map} +0 -0
  229. /package/dist/{chunk-4AKPTHOO.js.map → chunk-KNYUEYB6.js.map} +0 -0
  230. /package/dist/{chunk-KW4XA7GM.js.map → chunk-KPLKABGR.js.map} +0 -0
  231. /package/dist/{chunk-TNRCDMQT.js.map → chunk-KQ473UMU.js.map} +0 -0
  232. /package/dist/{chunk-LMJVP5CM.js.map → chunk-KUCMDUEZ.js.map} +0 -0
  233. /package/dist/{chunk-EBI6FI5U.js.map → chunk-L3DDKXQJ.js.map} +0 -0
  234. /package/dist/{chunk-YY5UXARJ.js.map → chunk-LKXW6W42.js.map} +0 -0
  235. /package/dist/{chunk-PXY2B7BG.js.map → chunk-MEB4NJO7.js.map} +0 -0
  236. /package/dist/{chunk-QCFZDYYG.js.map → chunk-MLNDSATI.js.map} +0 -0
  237. /package/dist/{chunk-SX4BR26Y.js.map → chunk-NT7JD6D6.js.map} +0 -0
  238. /package/dist/{chunk-JNBSTHVT.js.map → chunk-NTR72OL5.js.map} +0 -0
  239. /package/dist/{chunk-RK7SE3BL.js.map → chunk-NWZEDYHT.js.map} +0 -0
  240. /package/dist/{chunk-Q7OKGBZY.js.map → chunk-OK3X3TBR.js.map} +0 -0
  241. /package/dist/{chunk-X5MFCZDL.js.map → chunk-OWBI5477.js.map} +0 -0
  242. /package/dist/{chunk-3MOL7YE7.js.map → chunk-OWD365QW.js.map} +0 -0
  243. /package/dist/{chunk-L5EE2CXU.js.map → chunk-OY3IULYL.js.map} +0 -0
  244. /package/dist/{chunk-5JCYPBY5.js.map → chunk-PDMGJH4K.js.map} +0 -0
  245. /package/dist/{chunk-4LVQSHHN.js.map → chunk-QVXRE66C.js.map} +0 -0
  246. /package/dist/{chunk-H6TCS5XX.js.map → chunk-RASE4TEF.js.map} +0 -0
  247. /package/dist/{chunk-UFX24WNJ.js.map → chunk-RSUNBJ4I.js.map} +0 -0
  248. /package/dist/{chunk-4E2Z44CV.js.map → chunk-SNI526DD.js.map} +0 -0
  249. /package/dist/{chunk-QXTKN25V.js.map → chunk-SVXUH3FP.js.map} +0 -0
  250. /package/dist/{chunk-BJOQQCYC.js.map → chunk-TOQK5A4Y.js.map} +0 -0
  251. /package/dist/{chunk-BFZFNXOC.js.map → chunk-TQXKUQFX.js.map} +0 -0
  252. /package/dist/{chunk-BGSYM3SH.js.map → chunk-U4ECSKQE.js.map} +0 -0
  253. /package/dist/{chunk-Y65XX5PC.js.map → chunk-UBQ2ZOWA.js.map} +0 -0
  254. /package/dist/{chunk-6VFMEBXY.js.map → chunk-V6MN37WG.js.map} +0 -0
  255. /package/dist/{chunk-5MA6ZQ4Z.js.map → chunk-VBQ3FIS2.js.map} +0 -0
  256. /package/dist/{chunk-BVRZSI7Q.js.map → chunk-VN3RYYMS.js.map} +0 -0
  257. /package/dist/{chunk-OGQL7QC7.js.map → chunk-WKNMKV52.js.map} +0 -0
  258. /package/dist/{chunk-YE77U5HZ.js.map → chunk-WTFHZQXM.js.map} +0 -0
  259. /package/dist/{chunk-UBG65KEY.js.map → chunk-WTYVXUKQ.js.map} +0 -0
  260. /package/dist/{chunk-4DLGKTM6.js.map → chunk-XKFL2WQO.js.map} +0 -0
  261. /package/dist/{chunk-WF2LYKOB.js.map → chunk-Y2LZW3EQ.js.map} +0 -0
  262. /package/dist/{chunk-WECKZ3KT.js.map → chunk-Y6FJDJUK.js.map} +0 -0
  263. /package/dist/{chunk-W2UV6VE3.js.map → chunk-ZKXNSPGQ.js.map} +0 -0
  264. /package/dist/{contradiction-scan-DTQFAW22.js.map → contradiction-scan-QSGW4CMA.js.map} +0 -0
  265. /package/dist/{first-start-migration-PPPP54X6.js.map → first-start-migration-CCZ5SM3V.js.map} +0 -0
  266. /package/dist/{resolution-CV6QEYEZ.js.map → resolution-RWIGFH2W.js.map} +0 -0
  267. /package/dist/{tier-stats-XWJSVEHC.js.map → tier-stats-DXIBRUZH.js.map} +0 -0
@@ -7,7 +7,7 @@ import {
7
7
  listCodegraphProjects,
8
8
  parseDecisionRecord,
9
9
  resolveCodegraphDbPath
10
- } from "../chunk-NDPS6OU2.js";
10
+ } from "../chunk-63FIQIER.js";
11
11
  import {
12
12
  OKF_EXPORT_VERSION,
13
13
  lintOkfDir,
@@ -24,21 +24,21 @@ import "../chunk-FEHIOYML.js";
24
24
  import "../chunk-P32IDSHD.js";
25
25
  import {
26
26
  StorageManager
27
- } from "../chunk-X5MFCZDL.js";
27
+ } from "../chunk-OWBI5477.js";
28
28
  import "../chunk-QGVCFVX6.js";
29
29
  import "../chunk-UHVXE24Y.js";
30
30
  import "../chunk-BL7WULM5.js";
31
31
  import "../chunk-7F7HRJI2.js";
32
32
  import "../chunk-G6OFEGUR.js";
33
- import "../chunk-W35ICLYZ.js";
34
- import "../chunk-BJOQQCYC.js";
33
+ import "../chunk-5MTKGNZ5.js";
34
+ import "../chunk-TOQK5A4Y.js";
35
35
  import "../chunk-3DJ6R4CC.js";
36
36
  import "../chunk-66DUCUOC.js";
37
37
  import "../chunk-CYEPCZN5.js";
38
38
  import "../chunk-DLR3SBOM.js";
39
39
  import "../chunk-YCK26VSL.js";
40
40
  import "../chunk-WNEVEMJ3.js";
41
- import "../chunk-EXYT52NR.js";
41
+ import "../chunk-IOBQMVVL.js";
42
42
  import "../chunk-Y5NLBXPV.js";
43
43
  import "../chunk-TFA6HPOA.js";
44
44
  import "../chunk-F4TWWUMP.js";
@@ -118,7 +118,7 @@ import {
118
118
  import "../chunk-5GKPFL3S.js";
119
119
  import "../chunk-JAKIDQB2.js";
120
120
  import "../chunk-IDYYGOOQ.js";
121
- import "../chunk-2OAFPBQB.js";
121
+ import "../chunk-FDXLO6CX.js";
122
122
  import "../chunk-QJBULLKG.js";
123
123
  import "../chunk-NKAGGDSL.js";
124
124
  import "../chunk-AIF6V2OX.js";
@@ -153,10 +153,10 @@ import "../chunk-XZ66U5M3.js";
153
153
  import "../chunk-LQWOFU6L.js";
154
154
  import "../chunk-EBV6VXKF.js";
155
155
  import "../chunk-P7FMDTKL.js";
156
- import "../chunk-ESG6ITGP.js";
156
+ import "../chunk-CA5MRHBP.js";
157
157
  import "../chunk-PCXDUHQH.js";
158
158
  import "../chunk-VUFL7X3H.js";
159
- import "../chunk-C5LWPYS3.js";
159
+ import "../chunk-MOWZCAKS.js";
160
160
  import "../chunk-X4OZMANG.js";
161
161
  import "../chunk-R2MBW2S4.js";
162
162
  import "../chunk-NTS2RCQK.js";
@@ -1,25 +1,25 @@
1
1
  import {
2
2
  CompoundingEngine,
3
3
  defaultTierMigrationCycleBudget
4
- } from "../chunk-SAPC7N43.js";
5
- import "../chunk-JVBAPAWZ.js";
4
+ } from "../chunk-KMOH6W5B.js";
5
+ import "../chunk-DPPIBEGC.js";
6
6
  import "../chunk-5CO5G4MN.js";
7
- import "../chunk-LH57QATU.js";
8
- import "../chunk-X5MFCZDL.js";
7
+ import "../chunk-4WOEEMGK.js";
8
+ import "../chunk-OWBI5477.js";
9
9
  import "../chunk-QGVCFVX6.js";
10
10
  import "../chunk-UHVXE24Y.js";
11
11
  import "../chunk-BL7WULM5.js";
12
12
  import "../chunk-7F7HRJI2.js";
13
13
  import "../chunk-G6OFEGUR.js";
14
- import "../chunk-W35ICLYZ.js";
15
- import "../chunk-BJOQQCYC.js";
14
+ import "../chunk-5MTKGNZ5.js";
15
+ import "../chunk-TOQK5A4Y.js";
16
16
  import "../chunk-3DJ6R4CC.js";
17
17
  import "../chunk-66DUCUOC.js";
18
18
  import "../chunk-CYEPCZN5.js";
19
19
  import "../chunk-DLR3SBOM.js";
20
20
  import "../chunk-YCK26VSL.js";
21
21
  import "../chunk-WNEVEMJ3.js";
22
- import "../chunk-EXYT52NR.js";
22
+ import "../chunk-IOBQMVVL.js";
23
23
  import "../chunk-Y5NLBXPV.js";
24
24
  import "../chunk-TFA6HPOA.js";
25
25
  import "../chunk-F4TWWUMP.js";
@@ -99,7 +99,7 @@ import "../chunk-EBV6VXKF.js";
99
99
  import "../chunk-P7FMDTKL.js";
100
100
  import "../chunk-PCXDUHQH.js";
101
101
  import "../chunk-VUFL7X3H.js";
102
- import "../chunk-C5LWPYS3.js";
102
+ import "../chunk-MOWZCAKS.js";
103
103
  import "../chunk-X4OZMANG.js";
104
104
  import "../chunk-R2MBW2S4.js";
105
105
  import "../chunk-NTS2RCQK.js";
@@ -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,