@remnic/core 10.0.172 → 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
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  canReadNamespace,
3
3
  defaultNamespaceForPrincipal
4
- } from "./chunk-ESG6ITGP.js";
4
+ } from "./chunk-CA5MRHBP.js";
5
5
  import {
6
6
  EngramAccessInputError
7
7
  } from "./chunk-MGKCKY7X.js";
@@ -207,4 +207,4 @@ export {
207
207
  runScopedMemorySearch,
208
208
  memorySearchThroughScope
209
209
  };
210
- //# sourceMappingURL=chunk-5MA6ZQ4Z.js.map
210
+ //# sourceMappingURL=chunk-VBQ3FIS2.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  EXTRACTION_RESPONSE_PLACEHOLDERS
3
- } from "./chunk-YN2DQ2D6.js";
3
+ } from "./chunk-FE43YKNJ.js";
4
4
  import {
5
5
  normalizeRecallTokens
6
6
  } from "./chunk-YCVB7X56.js";
@@ -69,4 +69,4 @@ export {
69
69
  extractionAttributes,
70
70
  extractionCueAnchors
71
71
  };
72
- //# sourceMappingURL=chunk-BVRZSI7Q.js.map
72
+ //# sourceMappingURL=chunk-VN3RYYMS.js.map
@@ -0,0 +1,581 @@
1
+ import {
2
+ log
3
+ } from "./chunk-3WCASNQZ.js";
4
+
5
+ // src/compounding/preference-consolidator.ts
6
+ var PREFERENCE_EXTRACTORS = [
7
+ // "Avoids X" / negated use/work/code statements → negative preference
8
+ {
9
+ 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,
10
+ transform: (match) => {
11
+ const subject = match[1].replace(/\.$/, "").trim();
12
+ return `The user would not prefer ${subject}`;
13
+ }
14
+ },
15
+ // "Would like to X" / "like to X" → preference for doing X
16
+ {
17
+ pattern: /\blikes?\s+to\s+([^.!?]+?)(?:\s+(?:for|when|in|over)\s+([^.!?]+?))?(?=[.!?]|$)/im,
18
+ transform: (match) => {
19
+ const action = match[1].replace(/\.$/, "").trim();
20
+ const context = match[2] ? ` for ${match[2].replace(/\.$/, "").trim()}` : "";
21
+ return `The user prefers to ${action}${context}`;
22
+ }
23
+ },
24
+ // Direct preference statements
25
+ {
26
+ pattern: /\b(?:prefers?|enjoys?|likes|loves?|loving|favou?rs?)\s+(.+?)(?:\s+(?:for|when|in|over)\s+(.+?))?$/im,
27
+ transform: (match) => {
28
+ const subject = match[1].replace(/\.$/, "").trim();
29
+ const context = match[2] ? ` for ${match[2].replace(/\.$/, "").trim()}` : "";
30
+ return `The user prefers ${subject}${context}`;
31
+ }
32
+ },
33
+ // "Uses X for Y" → preference for X in Y context
34
+ {
35
+ pattern: /(?:uses?|works?\s+(?:with|in)|codes?\s+(?:in|with))\s+([^.!?]+?)(?:\s+(?:for|to|when)\s+([^.!?]+?))?(?=[.!?]|$)/i,
36
+ transform: (match) => {
37
+ const tool = match[1].replace(/\s+/g, " ").replace(/\.$/, "").trim();
38
+ const context = match[2] ? ` for ${match[2].replace(/\s+/g, " ").replace(/\.$/, "").trim()}` : "";
39
+ return `The user prefers to use ${tool}${context}`;
40
+ }
41
+ },
42
+ // "Interested in X" → preference for X-related content
43
+ {
44
+ pattern: /(?:interested\s+in|passionate\s+about|focused\s+on|specializes?\s+in)\s+(.+?)$/im,
45
+ transform: (match) => {
46
+ const subject = match[1].replace(/\.$/, "").trim();
47
+ return `The user would prefer content related to ${subject}`;
48
+ }
49
+ },
50
+ // "X is preferred" / "prefers X over Y"
51
+ {
52
+ pattern: /(.+?)\s+is\s+preferred(?:\s+over\s+(.+?))?$/im,
53
+ transform: (match) => {
54
+ const preferred = match[1].replace(/\.$/, "").trim();
55
+ const over = match[2] ? `. They would not prefer ${match[2].replace(/\.$/, "").trim()}` : "";
56
+ return `The user would prefer ${preferred}${over}`;
57
+ }
58
+ }
59
+ ];
60
+ 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;
61
+ var FACT_USE_CONTEXT_PATTERN = /\b(?:uses?|works?\s+(?:with|in)|codes?\s+(?:in|with))\b[^.!?]+\b(?:for|to|when)\b/i;
62
+ 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;
63
+ 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;
64
+ 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;
65
+ 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;
66
+ function replacementPreferenceClause(content) {
67
+ const match = REPLACEMENT_PREFERENCE_CLAUSE_PATTERN.exec(content);
68
+ if (!match) return null;
69
+ const clause = content.slice(match.index + match[0].length).trim();
70
+ return clause.replace(/[.!?]+$/, "").trim().length > 0 ? clause : null;
71
+ }
72
+ function fallbackPreferenceStatement(content, category) {
73
+ const trimmed = content.trim().replace(/\.$/, "");
74
+ if (/^the\s+user/i.test(trimmed)) {
75
+ return trimmed;
76
+ }
77
+ if (category === "correction") {
78
+ return `The user corrected that: ${trimmed}. This indicates a preference that should be respected.`;
79
+ }
80
+ if (category === "preference") {
81
+ if (/style|approach|method|workflow|process|manner/i.test(trimmed)) {
82
+ return `The user would prefer this approach: ${trimmed}`;
83
+ }
84
+ return `The user prefers: ${trimmed}`;
85
+ }
86
+ return `The user prefers: ${trimmed}`;
87
+ }
88
+ function extractKeywords(text) {
89
+ const stopWords = /* @__PURE__ */ new Set([
90
+ "the",
91
+ "a",
92
+ "an",
93
+ "is",
94
+ "are",
95
+ "was",
96
+ "were",
97
+ "be",
98
+ "been",
99
+ "being",
100
+ "have",
101
+ "has",
102
+ "had",
103
+ "do",
104
+ "does",
105
+ "did",
106
+ "will",
107
+ "would",
108
+ "shall",
109
+ "should",
110
+ "may",
111
+ "might",
112
+ "can",
113
+ "could",
114
+ "must",
115
+ "ought",
116
+ "to",
117
+ "of",
118
+ "in",
119
+ "for",
120
+ "on",
121
+ "with",
122
+ "at",
123
+ "by",
124
+ "from",
125
+ "as",
126
+ "into",
127
+ "through",
128
+ "during",
129
+ "before",
130
+ "after",
131
+ "above",
132
+ "below",
133
+ "between",
134
+ "but",
135
+ "and",
136
+ "or",
137
+ "not",
138
+ "no",
139
+ "nor",
140
+ "so",
141
+ "yet",
142
+ "both",
143
+ "either",
144
+ "neither",
145
+ "each",
146
+ "every",
147
+ "all",
148
+ "any",
149
+ "few",
150
+ "more",
151
+ "most",
152
+ "other",
153
+ "some",
154
+ "such",
155
+ "than",
156
+ "too",
157
+ "very",
158
+ "that",
159
+ "this",
160
+ "these",
161
+ "those",
162
+ "user",
163
+ "prefer",
164
+ "prefers",
165
+ "preferred",
166
+ "would",
167
+ "like",
168
+ "likes",
169
+ "use",
170
+ "uses",
171
+ "using",
172
+ "used",
173
+ "content",
174
+ "related"
175
+ ]);
176
+ return text.toLowerCase().replace(/[^a-z0-9\s-]/g, " ").split(/\s+/).filter((w) => w.length > 2 && !stopWords.has(w)).slice(0, 10);
177
+ }
178
+ function consolidatePreferences(memories, opts) {
179
+ const maxPreferences = opts?.maxPreferences ?? 20;
180
+ const includeCorrections = opts?.includeCorrections ?? true;
181
+ const minConfidence = opts?.minConfidence ?? 0.3;
182
+ const relevantCategories = includeCorrections ? ["preference", "correction"] : ["preference"];
183
+ const relevant = memories.filter((m) => {
184
+ if (!relevantCategories.includes(m.frontmatter.category)) return false;
185
+ if (m.frontmatter.status && m.frontmatter.status !== "active") return false;
186
+ if ((m.frontmatter.confidence ?? 0) < minConfidence) return false;
187
+ if (!m.content || m.content.trim().length < 10) return false;
188
+ return true;
189
+ });
190
+ const preferenceFactMemories = memories.filter((m) => {
191
+ if (m.frontmatter.category !== "fact") return false;
192
+ if (m.frontmatter.status && m.frontmatter.status !== "active") return false;
193
+ if ((m.frontmatter.confidence ?? 0) < minConfidence) return false;
194
+ return FACT_PREFERENCE_LANGUAGE_PATTERN.test(m.content) || FACT_USE_CONTEXT_PATTERN.test(m.content);
195
+ });
196
+ const allRelevant = [...relevant, ...preferenceFactMemories];
197
+ if (allRelevant.length === 0) {
198
+ return { preferences: [], recallSection: null };
199
+ }
200
+ const seen = /* @__PURE__ */ new Set();
201
+ const deduped = allRelevant.filter((m) => {
202
+ const key = m.content.trim().toLowerCase().slice(0, 80);
203
+ if (seen.has(key)) return false;
204
+ seen.add(key);
205
+ return true;
206
+ });
207
+ deduped.sort((a, b) => {
208
+ const confDiff = (b.frontmatter.confidence ?? 0) - (a.frontmatter.confidence ?? 0);
209
+ if (confDiff !== 0) return confDiff;
210
+ return b.frontmatter.created.localeCompare(a.frontmatter.created);
211
+ });
212
+ const preferences = [];
213
+ for (const mem of deduped.slice(0, maxPreferences * 2)) {
214
+ const content = mem.content.trim();
215
+ const hasDoubleNegatedAversion = DOUBLE_NEGATED_AVERSION_PATTERN.test(content);
216
+ const hasWithdrawnPreference = WITHDRAWN_PREFERENCE_PATTERN.test(content);
217
+ const strippedContent = hasDoubleNegatedAversion ? content.replace(DOUBLE_NEGATED_AVERSION_GLOBAL_PATTERN, " ").trim() : content;
218
+ const replacementContent = hasWithdrawnPreference ? replacementPreferenceClause(strippedContent) : null;
219
+ const extractionContent = replacementContent ?? strippedContent;
220
+ let statement = null;
221
+ for (const extractor of PREFERENCE_EXTRACTORS) {
222
+ const match = extractionContent.match(extractor.pattern);
223
+ if (match) {
224
+ statement = extractor.transform(match, extractionContent);
225
+ break;
226
+ }
227
+ }
228
+ if (!statement && hasDoubleNegatedAversion) {
229
+ continue;
230
+ }
231
+ if (!statement) {
232
+ statement = fallbackPreferenceStatement(replacementContent ?? content, mem.frontmatter.category);
233
+ }
234
+ if (statement.length < 20 && !replacementContent) continue;
235
+ const keywords = extractKeywords(statement);
236
+ preferences.push({
237
+ statement,
238
+ sourceIds: [mem.frontmatter.id],
239
+ category: mem.frontmatter.category,
240
+ confidence: mem.frontmatter.confidence ?? 0.7,
241
+ keywords
242
+ });
243
+ }
244
+ const finalPreferences = preferences.slice(0, maxPreferences);
245
+ if (finalPreferences.length === 0) {
246
+ return { preferences: [], recallSection: null };
247
+ }
248
+ const recallSection = buildPreferenceRecallSection(finalPreferences);
249
+ return { preferences: finalPreferences, recallSection };
250
+ }
251
+ function buildPreferenceRecallSection(preferences) {
252
+ if (preferences.length === 0) return "";
253
+ const lines = [
254
+ "## User Preferences (Consolidated)",
255
+ "",
256
+ "Known preferences and corrections learned from previous interactions:",
257
+ ""
258
+ ];
259
+ for (const pref of preferences) {
260
+ const confPct = Math.round(pref.confidence * 100);
261
+ lines.push(`- ${pref.statement} _(confidence: ${confPct}%)_`);
262
+ }
263
+ lines.push("");
264
+ return lines.join("\n");
265
+ }
266
+ function scorePreferencesForQuery(preferences, query) {
267
+ const queryTokens = new Set(
268
+ query.toLowerCase().replace(/[^a-z0-9\s-]/g, " ").split(/\s+/).filter((w) => w.length > 2)
269
+ );
270
+ return preferences.map((pref) => {
271
+ let score = 0;
272
+ const exactMatched = /* @__PURE__ */ new Set();
273
+ for (const kw of pref.keywords) {
274
+ if (queryTokens.has(kw)) {
275
+ score += 1;
276
+ exactMatched.add(kw);
277
+ }
278
+ }
279
+ for (const kw of pref.keywords) {
280
+ if (exactMatched.has(kw)) continue;
281
+ for (const qt of queryTokens) {
282
+ if (kw.startsWith(qt) || qt.startsWith(kw)) score += 0.5;
283
+ }
284
+ }
285
+ const stmtLower = pref.statement.toLowerCase();
286
+ for (const qt of queryTokens) {
287
+ if (stmtLower.includes(qt)) score += 0.3;
288
+ }
289
+ score *= pref.confidence;
290
+ return { preference: pref, score };
291
+ }).sort((a, b) => b.score - a.score);
292
+ }
293
+ function buildQueryAwarePreferenceSection(preferences, query, maxItems = 10) {
294
+ const scored = scorePreferencesForQuery(preferences, query);
295
+ const relevant = scored.filter((s) => s.score > 0).slice(0, maxItems);
296
+ if (relevant.length === 0) {
297
+ const topByConfidence = preferences.slice(0, Math.min(5, maxItems)).map((p) => ({ preference: p, score: p.confidence }));
298
+ if (topByConfidence.length === 0) return null;
299
+ return buildPreferenceRecallSection(topByConfidence.map((s) => s.preference));
300
+ }
301
+ return buildPreferenceRecallSection(relevant.map((s) => s.preference));
302
+ }
303
+ var CONVERSATION_PREFERENCE_PATTERNS = [
304
+ {
305
+ // "I prefer X", "I really enjoy X", "I always like X", etc.
306
+ // Excludes negation words: "I don't like X" should NOT match.
307
+ 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/,
308
+ extract: (content) => {
309
+ const results = [];
310
+ 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;
311
+ let m;
312
+ while ((m = re.exec(content)) !== null) {
313
+ const subject = m[2].trim().replace(/\s+/g, " ");
314
+ if (subject.length > 2 && subject.length < 200) {
315
+ results.push({ verb: m[1], subject });
316
+ }
317
+ }
318
+ return results;
319
+ }
320
+ },
321
+ {
322
+ // "I use X", "I usually work with X", "I code in X"
323
+ 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/,
324
+ extract: (content) => {
325
+ const results = [];
326
+ 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;
327
+ let m;
328
+ while ((m = re.exec(content)) !== null) {
329
+ const subject = m[2].trim().replace(/\s+/g, " ");
330
+ if (subject.length > 2 && subject.length < 200) {
331
+ results.push({ verb: "use", subject });
332
+ }
333
+ }
334
+ return results;
335
+ }
336
+ },
337
+ {
338
+ // "my favorite X", "my preferred X", "my go-to X", "my favorite is X"
339
+ detect: /\bmy\s+(?:favorite|favourite|preferred|go-to)\b/i,
340
+ extract: (content) => {
341
+ const results = [];
342
+ const isRe = /\bmy\s+(?:favorite|favourite|preferred|go-to)\s+is\s+(.+?)(?:\.|,|!|\?|$)/gi;
343
+ let m;
344
+ while ((m = isRe.exec(content)) !== null) {
345
+ const what = m[1].trim();
346
+ if (what.length > 2 && what.length < 200) {
347
+ results.push({ verb: "favorite", subject: what.replace(/\s+/g, " ") });
348
+ }
349
+ }
350
+ const nounRe = /\bmy\s+(?:favorite|favourite|preferred|go-to)\s+(?!is\b)(.+?)(?:\.|,|!|\?|$)/gi;
351
+ while ((m = nounRe.exec(content)) !== null) {
352
+ const what = m[1].trim();
353
+ if (what.length > 2 && what.length < 200) {
354
+ results.push({ verb: "favorite", subject: what.replace(/\s+/g, " ") });
355
+ }
356
+ }
357
+ return results;
358
+ }
359
+ },
360
+ {
361
+ // "I'd rather X", "I would prefer X"
362
+ detect: /\b(?:I'd|I\s+would)\s+(?:rather|prefer)\b/i,
363
+ extract: (content) => {
364
+ const results = [];
365
+ const re = /\b(?:I'd|I\s+would)\s+(?:rather|prefer)\s+(.+?)(?:\.|,|!|\?|$)/gi;
366
+ let m;
367
+ while ((m = re.exec(content)) !== null) {
368
+ const subject = m[1].trim().replace(/\s+/g, " ");
369
+ if (subject.length > 2 && subject.length < 200) {
370
+ results.push({ verb: "would prefer", subject });
371
+ }
372
+ }
373
+ return results;
374
+ }
375
+ },
376
+ {
377
+ // "I'm a fan of X", "I'm into X", "I'm fond of X", "I'm interested in X"
378
+ detect: /\bI'?m\s+(?:a\s+fan\s+of|into|fond\s+of|interested\s+in|passionate\s+about)\b/i,
379
+ extract: (content) => {
380
+ const results = [];
381
+ const re = /\bI'?m\s+(?:a\s+fan\s+of|into|fond\s+of|interested\s+in|passionate\s+about)\s+(.+?)(?:\.|,|!|\?|$)/gi;
382
+ let m;
383
+ while ((m = re.exec(content)) !== null) {
384
+ const subject = m[1].trim().replace(/\s+/g, " ");
385
+ if (subject.length > 2 && subject.length < 200) {
386
+ results.push({ verb: "interested in", subject });
387
+ }
388
+ }
389
+ return results;
390
+ }
391
+ }
392
+ ];
393
+ function formatPreferenceStatement(verb, subject) {
394
+ const s = subject.replace(/\s+/g, " ").trim();
395
+ switch (verb) {
396
+ case "use":
397
+ return `The user prefers to use ${s}`;
398
+ case "enjoy":
399
+ return `The user enjoys ${s}`;
400
+ case "love":
401
+ return `The user loves ${s}`;
402
+ case "interested in":
403
+ return `The user is interested in ${s}`;
404
+ case "favorite":
405
+ return `The user's favorite is ${s}`;
406
+ case "would prefer":
407
+ return `The user would prefer ${s}`;
408
+ default:
409
+ return `The user prefers ${s}`;
410
+ }
411
+ }
412
+ function extractNamedEntities(text) {
413
+ const entities = [];
414
+ const seen = /* @__PURE__ */ new Set();
415
+ const properNounRe = /\b([A-Z][a-z]+(?:\s+[A-Z][a-z]+)+)\b/g;
416
+ let m;
417
+ while ((m = properNounRe.exec(text)) !== null) {
418
+ const entity = m[1].trim();
419
+ const key = entity.toLowerCase();
420
+ if (!seen.has(key) && entity.length > 3) {
421
+ seen.add(key);
422
+ entities.push(entity);
423
+ }
424
+ }
425
+ const productRe = /\b([A-Z][a-zA-Z]+(?:\s+[A-Z0-9][a-zA-Z0-9]*)+)\b/g;
426
+ while ((m = productRe.exec(text)) !== null) {
427
+ const entity = m[1].trim();
428
+ const key = entity.toLowerCase();
429
+ if (!seen.has(key) && entity.length > 3) {
430
+ seen.add(key);
431
+ entities.push(entity);
432
+ }
433
+ }
434
+ const toolRe = /\b(Adobe\s+\w+(?:\s+\w+)?|Google\s+\w+|Microsoft\s+\w+|Apple\s+\w+)\b/gi;
435
+ while ((m = toolRe.exec(text)) !== null) {
436
+ const entity = m[1].trim();
437
+ const key = entity.toLowerCase();
438
+ if (!seen.has(key)) {
439
+ seen.add(key);
440
+ entities.push(entity);
441
+ }
442
+ }
443
+ return entities;
444
+ }
445
+ function extractQueryIntent(query) {
446
+ const intentPatterns = [
447
+ /(?:can you|could you|please)\s+(recommend|suggest|advise|help|find|show|give|provide|point|share)\b/i,
448
+ /(?:any|some)\s+(recommendations?|suggestions?|tips?|ideas?|advice)\b/i,
449
+ /\b(recommend|suggest|advise)\s+(?:me|some|a|an)/i
450
+ ];
451
+ for (const p of intentPatterns) {
452
+ const m = query.match(p);
453
+ if (m) return m[1].toLowerCase().replace(/s$/, "");
454
+ }
455
+ return null;
456
+ }
457
+ function formatExpandedPreference(verb, subject, queryIntent, sourceContext) {
458
+ const s = subject.replace(/\s+/g, " ").trim();
459
+ const statements = [];
460
+ statements.push(formatPreferenceStatement(verb, s));
461
+ statements.push(`The user would prefer ${s}`);
462
+ if (queryIntent) {
463
+ statements.push(`The user would prefer responses that ${queryIntent} ${s}`);
464
+ statements.push(`The user would prefer responses that suggest ${s}`);
465
+ statements.push(`The user would prefer responses that suggest resources specifically tailored to ${s}`);
466
+ statements.push(`The user would prefer suggestions of ${s}`);
467
+ statements.push(`The user would prefer suggestions related to ${s}`);
468
+ }
469
+ statements.push(`They might not prefer general alternatives unrelated to ${s}`);
470
+ if (verb === "interested in" || verb === "enjoy" || verb === "love") {
471
+ statements.push(`The user would be interested in content related to ${s}`);
472
+ statements.push(`The user would prefer content related to ${s}`);
473
+ }
474
+ return statements;
475
+ }
476
+ async function synthesizePreferencesFromLcm(lcmEngine, query, sessionId, maxPrefs = 20) {
477
+ const results = await lcmEngine.searchContextFull(query, 30, sessionId);
478
+ const userMessages = results.filter((r) => r.role === "user");
479
+ if (userMessages.length === 0) {
480
+ log.debug("[irc] synthesizePreferencesFromLcm: no user messages found");
481
+ return null;
482
+ }
483
+ const queryIntent = extractQueryIntent(query);
484
+ const preferences = [];
485
+ const seenSubjects = /* @__PURE__ */ new Set();
486
+ for (const msg of userMessages) {
487
+ let hasPreferenceSignal = false;
488
+ for (const pattern of CONVERSATION_PREFERENCE_PATTERNS) {
489
+ if (!pattern.detect.test(msg.content)) continue;
490
+ hasPreferenceSignal = true;
491
+ const extracted = pattern.extract(msg.content);
492
+ for (const { verb, subject } of extracted) {
493
+ if (subject.length < 4 || /^(to|for|in|with|on|at|the|a|an)\s/i.test(subject)) continue;
494
+ const key = subject.toLowerCase().slice(0, 80);
495
+ if (seenSubjects.has(key)) continue;
496
+ seenSubjects.add(key);
497
+ const expandedStatements = formatExpandedPreference(
498
+ verb,
499
+ subject,
500
+ queryIntent,
501
+ msg.content
502
+ );
503
+ preferences.push({
504
+ statements: expandedStatements,
505
+ source: msg.content.length > 200 ? msg.content.slice(0, 200) + "..." : msg.content
506
+ });
507
+ if (preferences.length >= maxPrefs) break;
508
+ }
509
+ }
510
+ if (hasPreferenceSignal || /prefer|enjoy|like|love|interested|passionate|favorite/i.test(msg.content)) {
511
+ const entities = extractNamedEntities(msg.content);
512
+ for (const entity of entities) {
513
+ const key = entity.toLowerCase().slice(0, 80);
514
+ if (seenSubjects.has(key)) continue;
515
+ seenSubjects.add(key);
516
+ const expandedStatements = formatExpandedPreference(
517
+ "prefer",
518
+ entity,
519
+ queryIntent,
520
+ msg.content
521
+ );
522
+ preferences.push({
523
+ statements: expandedStatements,
524
+ source: msg.content.length > 200 ? msg.content.slice(0, 200) + "..." : msg.content
525
+ });
526
+ if (preferences.length >= maxPrefs) break;
527
+ }
528
+ }
529
+ if (preferences.length >= maxPrefs) break;
530
+ }
531
+ if (preferences.length === 0) {
532
+ log.debug("[irc] synthesizePreferencesFromLcm: no preference signals detected");
533
+ return null;
534
+ }
535
+ const lines = [
536
+ "## User Preferences (from Conversation History)",
537
+ ""
538
+ ];
539
+ for (const pref of preferences) {
540
+ for (const stmt of pref.statements) {
541
+ lines.push(`- ${stmt}`);
542
+ }
543
+ lines.push(` _Source: "${pref.source}"_`);
544
+ }
545
+ lines.push("");
546
+ log.debug(
547
+ `[irc] synthesizePreferencesFromLcm: ${preferences.length} preference(s) from ${userMessages.length} messages`
548
+ );
549
+ return lines.join("\n");
550
+ }
551
+ async function augmentWithCausalPreferences(existingPreferences, options) {
552
+ try {
553
+ const { extractCausalBehaviorSignals, synthesizeCausalPreferences } = await import("./causal-behavior.js");
554
+ const signals = await extractCausalBehaviorSignals({
555
+ memoryDir: options.memoryDir,
556
+ causalTrajectoryStoreDir: options.causalTrajectoryStoreDir,
557
+ config: {
558
+ minFrequency: options.behaviorMinFrequency,
559
+ minSessions: options.behaviorMinSessions,
560
+ confidenceThreshold: options.behaviorConfidenceThreshold
561
+ }
562
+ });
563
+ if (signals.length === 0) return existingPreferences;
564
+ const causalPreferences = synthesizeCausalPreferences(signals, options.behaviorConfidenceThreshold);
565
+ if (causalPreferences.length === 0) return existingPreferences;
566
+ log.debug(`[cmc] augmented preferences with ${causalPreferences.length} causal behavior preference(s)`);
567
+ return [...existingPreferences, ...causalPreferences];
568
+ } catch (error) {
569
+ log.warn(`[cmc] causal preference augmentation failed (non-fatal): ${error instanceof Error ? error.message : String(error)}`);
570
+ return existingPreferences;
571
+ }
572
+ }
573
+
574
+ export {
575
+ consolidatePreferences,
576
+ scorePreferencesForQuery,
577
+ buildQueryAwarePreferenceSection,
578
+ synthesizePreferencesFromLcm,
579
+ augmentWithCausalPreferences
580
+ };
581
+ //# sourceMappingURL=chunk-VOVSZYCP.js.map