@remnic/core 1.0.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (385) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -0
  3. package/dist/abort-error.d.ts +32 -0
  4. package/dist/abort-error.js +11 -0
  5. package/dist/access-cli.d.ts +13 -3
  6. package/dist/access-cli.js +96 -80
  7. package/dist/access-cli.js.map +1 -1
  8. package/dist/access-http.d.ts +12 -4
  9. package/dist/access-http.js +25 -18
  10. package/dist/access-mcp.d.ts +32 -4
  11. package/dist/access-mcp.js +16 -1
  12. package/dist/access-schema.d.ts +28 -28
  13. package/dist/access-schema.js +1 -1
  14. package/dist/access-service-HmO1Trrx.d.ts +732 -0
  15. package/dist/access-service.d.ts +15 -601
  16. package/dist/access-service.js +21 -15
  17. package/dist/active-memory-bridge.d.ts +66 -0
  18. package/dist/active-memory-bridge.js +11 -0
  19. package/dist/active-memory-bridge.js.map +1 -0
  20. package/dist/active-recall.d.ts +96 -0
  21. package/dist/active-recall.js +308 -0
  22. package/dist/active-recall.js.map +1 -0
  23. package/dist/behavior-learner.js +1 -1
  24. package/dist/bootstrap.d.ts +6 -3
  25. package/dist/bootstrap.js +2 -2
  26. package/dist/boxes.js +2 -2
  27. package/dist/briefing.d.ts +169 -0
  28. package/dist/briefing.js +52 -0
  29. package/dist/briefing.js.map +1 -0
  30. package/dist/buffer.d.ts +19 -5
  31. package/dist/buffer.js +2 -2
  32. package/dist/calibration.js +6 -6
  33. package/dist/causal-behavior.js +5 -5
  34. package/dist/causal-chain.js +3 -3
  35. package/dist/causal-consolidation.d.ts +22 -2
  36. package/dist/causal-consolidation.js +36 -9
  37. package/dist/causal-consolidation.js.map +1 -1
  38. package/dist/causal-retrieval.js +6 -6
  39. package/dist/causal-trajectory-graph.js +1 -1
  40. package/dist/causal-trajectory.d.ts +14 -1
  41. package/dist/causal-trajectory.js +5 -1
  42. package/dist/{chunk-KWBU5S5U.js → chunk-2ODBA7MQ.js} +9 -3
  43. package/dist/chunk-2ODBA7MQ.js.map +1 -0
  44. package/dist/{chunk-ZJLY4QSU.js → chunk-37UIFYWO.js} +130 -6
  45. package/dist/chunk-37UIFYWO.js.map +1 -0
  46. package/dist/chunk-3PG3H5TD.js +7 -0
  47. package/dist/chunk-3PG3H5TD.js.map +1 -0
  48. package/dist/{chunk-NTTLPF7F.js → chunk-3QFQGRHO.js} +5 -5
  49. package/dist/{chunk-QDOSNLB4.js → chunk-3QHL5ABG.js} +17 -15
  50. package/dist/chunk-3QHL5ABG.js.map +1 -0
  51. package/dist/{chunk-6UJQNRIO.js → chunk-3SV6CQHO.js} +92 -33
  52. package/dist/chunk-3SV6CQHO.js.map +1 -0
  53. package/dist/{chunk-U4PV25RD.js → chunk-3WHVNEN7.js} +1 -1
  54. package/dist/chunk-3WHVNEN7.js.map +1 -0
  55. package/dist/{chunk-XUHI52HK.js → chunk-44ICJRF3.js} +98 -10
  56. package/dist/chunk-44ICJRF3.js.map +1 -0
  57. package/dist/{chunk-HG2NKWR2.js → chunk-47UU5PU2.js} +49 -10
  58. package/dist/chunk-47UU5PU2.js.map +1 -0
  59. package/dist/chunk-4DJQYKMN.js +187 -0
  60. package/dist/chunk-4DJQYKMN.js.map +1 -0
  61. package/dist/chunk-4KAN3GZ3.js +225 -0
  62. package/dist/chunk-4KAN3GZ3.js.map +1 -0
  63. package/dist/chunk-4LACOVZX.js +813 -0
  64. package/dist/chunk-4LACOVZX.js.map +1 -0
  65. package/dist/{chunk-ORZMT74A.js → chunk-4NRAJUDS.js} +11 -1
  66. package/dist/chunk-4NRAJUDS.js.map +1 -0
  67. package/dist/{chunk-B7LOFDVE.js → chunk-4WMCPJWX.js} +8 -3
  68. package/dist/chunk-4WMCPJWX.js.map +1 -0
  69. package/dist/{chunk-G3AG3KZN.js → chunk-5IZL4DCV.js} +2 -2
  70. package/dist/{chunk-BRK4ODMI.js → chunk-5NPGSAVB.js} +2 -2
  71. package/dist/{chunk-QANCTXQF.js → chunk-6LX5ORAS.js} +3 -3
  72. package/dist/chunk-6MKAMLQL.js +16 -0
  73. package/dist/chunk-6MKAMLQL.js.map +1 -0
  74. package/dist/{chunk-ESSMF2FR.js → chunk-6PFRXT4K.js} +15 -6
  75. package/dist/chunk-6PFRXT4K.js.map +1 -0
  76. package/dist/{chunk-UIYZ5T3I.js → chunk-6UJ47TVX.js} +8 -8
  77. package/dist/chunk-6ZH4TU6I.js +245 -0
  78. package/dist/chunk-6ZH4TU6I.js.map +1 -0
  79. package/dist/{chunk-L5RPWGFK.js → chunk-7DHTMOND.js} +2 -2
  80. package/dist/{chunk-L7WO3MZ4.js → chunk-7ECD5ATE.js} +2 -2
  81. package/dist/{chunk-Q6FETXJA.js → chunk-7SEAZFFB.js} +2 -2
  82. package/dist/{chunk-V4YC4LUK.js → chunk-7WQ6SLIE.js} +175 -63
  83. package/dist/chunk-7WQ6SLIE.js.map +1 -0
  84. package/dist/chunk-ALXMCZEU.js +332 -0
  85. package/dist/chunk-ALXMCZEU.js.map +1 -0
  86. package/dist/{chunk-TVVVQQAK.js → chunk-BLKTA7MM.js} +58 -24
  87. package/dist/chunk-BLKTA7MM.js.map +1 -0
  88. package/dist/{chunk-SCHEKPYH.js → chunk-C2EFFULQ.js} +1 -1
  89. package/dist/{chunk-GJR6D6KC.js → chunk-D654IBA6.js} +2 -2
  90. package/dist/{chunk-OTFNI3OO.js → chunk-DEPL3635.js} +1828 -401
  91. package/dist/chunk-DEPL3635.js.map +1 -0
  92. package/dist/{chunk-UYSKNO6E.js → chunk-DHHP2Z4X.js} +15 -4
  93. package/dist/chunk-DHHP2Z4X.js.map +1 -0
  94. package/dist/{chunk-UV2FO7J4.js → chunk-E6K4NIEU.js} +2 -2
  95. package/dist/{chunk-T4WRIV2C.js → chunk-EABGC2TL.js} +2 -2
  96. package/dist/chunk-EJI5XIBB.js +232 -0
  97. package/dist/chunk-EJI5XIBB.js.map +1 -0
  98. package/dist/{chunk-ONRU4L2N.js → chunk-FEMOX5AD.js} +2 -2
  99. package/dist/{chunk-IFFFR3MR.js → chunk-FSFEQI74.js} +3 -3
  100. package/dist/chunk-G4SK7DSQ.js +121 -0
  101. package/dist/chunk-G4SK7DSQ.js.map +1 -0
  102. package/dist/{chunk-WWIQTB2Y.js → chunk-GGD5W7TB.js} +9 -2
  103. package/dist/chunk-GGD5W7TB.js.map +1 -0
  104. package/dist/{chunk-QWUUMMIK.js → chunk-GV6NLQ4X.js} +1355 -80
  105. package/dist/chunk-GV6NLQ4X.js.map +1 -0
  106. package/dist/{chunk-2PO5ZRKV.js → chunk-GZCUW5IC.js} +16 -3
  107. package/dist/chunk-GZCUW5IC.js.map +1 -0
  108. package/dist/{chunk-AAI7JARD.js → chunk-HMDCOMYU.js} +8 -11
  109. package/dist/chunk-HMDCOMYU.js.map +1 -0
  110. package/dist/chunk-IQT3XTKW.js +121 -0
  111. package/dist/chunk-IQT3XTKW.js.map +1 -0
  112. package/dist/{chunk-J3BT33K7.js → chunk-ITRLGI2T.js} +5 -5
  113. package/dist/{chunk-BDFZXRSO.js → chunk-J4IYOZZ5.js} +15 -2
  114. package/dist/chunk-J4IYOZZ5.js.map +1 -0
  115. package/dist/{chunk-J47FNDR7.js → chunk-JIU55F3X.js} +7 -7
  116. package/dist/{chunk-MDDAA2AO.js → chunk-JL2PU6AI.js} +17 -6
  117. package/dist/chunk-JL2PU6AI.js.map +1 -0
  118. package/dist/{chunk-ZKYI7UVO.js → chunk-JR4ZC3G4.js} +2 -2
  119. package/dist/{chunk-UCYSTFZR.js → chunk-JRNQ3RNA.js} +2 -2
  120. package/dist/{chunk-GPGBSNKM.js → chunk-K4FLSOR5.js} +2 -2
  121. package/dist/chunk-KVE7R4CG.js +320 -0
  122. package/dist/chunk-KVE7R4CG.js.map +1 -0
  123. package/dist/chunk-LAYN4LDC.js +267 -0
  124. package/dist/chunk-LAYN4LDC.js.map +1 -0
  125. package/dist/{chunk-ISY75RLM.js → chunk-MBJHSA7F.js} +344 -7
  126. package/dist/chunk-MBJHSA7F.js.map +1 -0
  127. package/dist/{chunk-PGK3VUHN.js → chunk-MTLYEMJB.js} +3 -2
  128. package/dist/chunk-MTLYEMJB.js.map +1 -0
  129. package/dist/{chunk-QY2BHY5O.js → chunk-MVTHXUBX.js} +297 -34
  130. package/dist/chunk-MVTHXUBX.js.map +1 -0
  131. package/dist/{chunk-LP47L3ZX.js → chunk-N42IWANG.js} +5 -5
  132. package/dist/{chunk-YNI4S5WT.js → chunk-N53K2EXC.js} +2 -2
  133. package/dist/{chunk-763GUIOU.js → chunk-NBNN5GOB.js} +2 -2
  134. package/dist/{chunk-CXWFUJR2.js → chunk-NQEVYWX6.js} +195 -5
  135. package/dist/chunk-NQEVYWX6.js.map +1 -0
  136. package/dist/{chunk-KL4CP4SB.js → chunk-O5ETUNBT.js} +17 -5
  137. package/dist/chunk-O5ETUNBT.js.map +1 -0
  138. package/dist/{chunk-OOSWAUYB.js → chunk-ODWDQNRE.js} +2 -2
  139. package/dist/chunk-OIT5QGG4.js +80 -0
  140. package/dist/chunk-OIT5QGG4.js.map +1 -0
  141. package/dist/{chunk-HLBYLYRD.js → chunk-PAORGQRI.js} +70 -13
  142. package/dist/chunk-PAORGQRI.js.map +1 -0
  143. package/dist/chunk-PVGDJXVK.js +21 -0
  144. package/dist/chunk-PVGDJXVK.js.map +1 -0
  145. package/dist/{chunk-OTAVQCSF.js → chunk-PYXS46O7.js} +2 -2
  146. package/dist/chunk-QDW3E4RD.js +108 -0
  147. package/dist/chunk-QDW3E4RD.js.map +1 -0
  148. package/dist/{chunk-YNCQ7E4M.js → chunk-QDYXG4CS.js} +4 -3
  149. package/dist/chunk-QDYXG4CS.js.map +1 -0
  150. package/dist/{chunk-HLXVTBF3.js → chunk-QNJMBKFK.js} +3 -2
  151. package/dist/chunk-QNJMBKFK.js.map +1 -0
  152. package/dist/{chunk-4A24LIM2.js → chunk-S75M5ZRK.js} +2 -2
  153. package/dist/chunk-SYUK3VLY.js +789 -0
  154. package/dist/chunk-SYUK3VLY.js.map +1 -0
  155. package/dist/{chunk-QCCCQT3O.js → chunk-TBBDFYXW.js} +2 -2
  156. package/dist/chunk-TBBDFYXW.js.map +1 -0
  157. package/dist/chunk-U66YHYC7.js +31 -0
  158. package/dist/chunk-U66YHYC7.js.map +1 -0
  159. package/dist/{chunk-MWGVGUIS.js → chunk-UEYA6UC7.js} +36 -4
  160. package/dist/chunk-UEYA6UC7.js.map +1 -0
  161. package/dist/{chunk-M5KEYE5E.js → chunk-URB2WSKZ.js} +2 -2
  162. package/dist/chunk-UVJFDP7P.js +202 -0
  163. package/dist/chunk-UVJFDP7P.js.map +1 -0
  164. package/dist/chunk-W6SL7OFG.js +180 -0
  165. package/dist/chunk-W6SL7OFG.js.map +1 -0
  166. package/dist/chunk-WBSAYXVI.js +7945 -0
  167. package/dist/chunk-WBSAYXVI.js.map +1 -0
  168. package/dist/{chunk-M5ZBBBJI.js → chunk-XZ2TIKGC.js} +39 -9
  169. package/dist/chunk-XZ2TIKGC.js.map +1 -0
  170. package/dist/chunk-Y4FHOFJ2.js +140 -0
  171. package/dist/chunk-Y4FHOFJ2.js.map +1 -0
  172. package/dist/chunk-YDBIWGNI.js +298 -0
  173. package/dist/chunk-YDBIWGNI.js.map +1 -0
  174. package/dist/chunk-YNB73F22.js +137 -0
  175. package/dist/chunk-YNB73F22.js.map +1 -0
  176. package/dist/{chunk-IZME7KW2.js → chunk-ZVBB3T7V.js} +31 -12
  177. package/dist/chunk-ZVBB3T7V.js.map +1 -0
  178. package/dist/chunking.js +1 -1
  179. package/dist/citations.d.ts +67 -0
  180. package/dist/citations.js +13 -0
  181. package/dist/citations.js.map +1 -0
  182. package/dist/cli-BneVIEvh.d.ts +1240 -0
  183. package/dist/cli.d.ts +32 -1147
  184. package/dist/cli.js +150 -7092
  185. package/dist/cli.js.map +1 -1
  186. package/dist/codex-materialize-CQlLTzke.d.ts +139 -0
  187. package/dist/codex-thread-key.d.ts +3 -0
  188. package/dist/codex-thread-key.js +7 -0
  189. package/dist/codex-thread-key.js.map +1 -0
  190. package/dist/config.js +3 -2
  191. package/dist/connectors/codex/instructions.md +160 -0
  192. package/dist/connectors/codex/resources/namespace-cheatsheet.md +48 -0
  193. package/dist/contradiction-review-WIUBAR52.js +21 -0
  194. package/dist/contradiction-review-WIUBAR52.js.map +1 -0
  195. package/dist/contradiction-scan-GR33PONM.js +376 -0
  196. package/dist/contradiction-scan-GR33PONM.js.map +1 -0
  197. package/dist/day-summary.d.ts +7 -2
  198. package/dist/day-summary.js +5 -2
  199. package/dist/direct-answer-wiring.d.ts +77 -0
  200. package/dist/direct-answer-wiring.js +75 -0
  201. package/dist/direct-answer-wiring.js.map +1 -0
  202. package/dist/direct-answer.d.ts +106 -0
  203. package/dist/direct-answer.js +10 -0
  204. package/dist/direct-answer.js.map +1 -0
  205. package/dist/embedding-fallback.d.ts +96 -2
  206. package/dist/embedding-fallback.js +6 -4
  207. package/dist/{engine-2A6J4XEX.js → engine-5TIQBYZR.js} +10 -7
  208. package/dist/engine-5TIQBYZR.js.map +1 -0
  209. package/dist/entity-retrieval.d.ts +3 -2
  210. package/dist/entity-retrieval.js +10 -7
  211. package/dist/entity-schema.d.ts +11 -0
  212. package/dist/entity-schema.js +19 -0
  213. package/dist/entity-schema.js.map +1 -0
  214. package/dist/explicit-capture.d.ts +6 -3
  215. package/dist/explicit-capture.js +2 -2
  216. package/dist/extraction-judge.d.ts +66 -0
  217. package/dist/extraction-judge.js +18 -0
  218. package/dist/extraction-judge.js.map +1 -0
  219. package/dist/extraction.d.ts +1 -0
  220. package/dist/extraction.js +12 -10
  221. package/dist/fallback-llm.d.ts +11 -2
  222. package/dist/fallback-llm.js +4 -4
  223. package/dist/graph.js +1 -1
  224. package/dist/harmonic-retrieval.js +2 -1
  225. package/dist/importance.d.ts +11 -1
  226. package/dist/importance.js +3 -1
  227. package/dist/index.d.ts +1027 -9
  228. package/dist/index.js +3303 -349
  229. package/dist/index.js.map +1 -1
  230. package/dist/intent.d.ts +2 -1
  231. package/dist/intent.js +3 -1
  232. package/dist/lifecycle.js +1 -1
  233. package/dist/local-llm.d.ts +10 -3
  234. package/dist/local-llm.js +2 -2
  235. package/dist/logger.d.ts +1 -1
  236. package/dist/logger.js +1 -1
  237. package/dist/memory-cache.d.ts +2 -2
  238. package/dist/memory-cache.js +1 -1
  239. package/dist/{memory-projection-store-NxMkbocT.d.ts → memory-projection-store-DeSXPh1j.d.ts} +1 -1
  240. package/dist/memory-projection-store.d.ts +1 -1
  241. package/dist/model-registry.js +2 -2
  242. package/dist/models-json.js +2 -2
  243. package/dist/native-knowledge.js +2 -2
  244. package/dist/negative.js +2 -2
  245. package/dist/operator-toolkit.js +20 -15
  246. package/dist/{orchestrator-zTa-Qo-1.d.ts → orchestrator-DRYA6_lW.d.ts} +273 -9
  247. package/dist/orchestrator.d.ts +6 -3
  248. package/dist/orchestrator.js +76 -63
  249. package/dist/page-versioning.d.ts +77 -0
  250. package/dist/page-versioning.js +15 -0
  251. package/dist/page-versioning.js.map +1 -0
  252. package/dist/plugin-id.d.ts +37 -0
  253. package/dist/plugin-id.js +11 -0
  254. package/dist/plugin-id.js.map +1 -0
  255. package/dist/policy-runtime.js +2 -2
  256. package/dist/profiling.js +2 -2
  257. package/dist/qmd.d.ts +5 -2
  258. package/dist/qmd.js +4 -3
  259. package/dist/recall-audit.d.ts +20 -0
  260. package/dist/recall-audit.js +50 -0
  261. package/dist/recall-audit.js.map +1 -0
  262. package/dist/recall-mmr.d.ts +152 -0
  263. package/dist/recall-mmr.js +17 -0
  264. package/dist/recall-mmr.js.map +1 -0
  265. package/dist/recall-qos.js +2 -2
  266. package/dist/recall-state.d.ts +28 -1
  267. package/dist/recall-state.js +2 -2
  268. package/dist/relevance.js +2 -2
  269. package/dist/resolution-QBTDHTG7.js +100 -0
  270. package/dist/resolution-QBTDHTG7.js.map +1 -0
  271. package/dist/resolve-provider-secret.d.ts +24 -1
  272. package/dist/resolve-provider-secret.js +4 -2
  273. package/dist/resume-bundles.js +6 -5
  274. package/dist/retrieval-agents.js +2 -2
  275. package/dist/retrieval.js +2 -2
  276. package/dist/schemas.d.ts +412 -54
  277. package/dist/schemas.js +3 -1
  278. package/dist/sdk-compat.d.ts +2 -0
  279. package/dist/sdk-compat.js +6 -3
  280. package/dist/sdk-compat.js.map +1 -1
  281. package/dist/semantic-chunking.d.ts +87 -0
  282. package/dist/semantic-chunking.js +20 -0
  283. package/dist/semantic-chunking.js.map +1 -0
  284. package/dist/semantic-consolidation-DrvSYRdB.d.ts +119 -0
  285. package/dist/semantic-consolidation.d.ts +4 -42
  286. package/dist/semantic-consolidation.js +23 -2
  287. package/dist/semantic-rule-promotion.js +9 -6
  288. package/dist/semantic-rule-verifier.js +10 -7
  289. package/dist/session-observer-state.js +2 -2
  290. package/dist/session-toggles.d.ts +22 -0
  291. package/dist/session-toggles.js +116 -0
  292. package/dist/session-toggles.js.map +1 -0
  293. package/dist/skills-registry.d.ts +47 -0
  294. package/dist/skills-registry.js +48 -0
  295. package/dist/skills-registry.js.map +1 -0
  296. package/dist/source-attribution.d.ts +169 -0
  297. package/dist/source-attribution.js +27 -0
  298. package/dist/source-attribution.js.map +1 -0
  299. package/dist/storage.d.ts +171 -10
  300. package/dist/storage.js +16 -5
  301. package/dist/summarizer.js +7 -7
  302. package/dist/temporal-supersession.d.ts +127 -0
  303. package/dist/temporal-supersession.js +20 -0
  304. package/dist/temporal-supersession.js.map +1 -0
  305. package/dist/threading.js +2 -2
  306. package/dist/tier-migration.d.ts +2 -1
  307. package/dist/tier-routing.js +2 -2
  308. package/dist/tokens.d.ts +21 -1
  309. package/dist/tokens.js +5 -1
  310. package/dist/transcript.js +2 -2
  311. package/dist/types-DJhqDJUV.d.ts +50 -0
  312. package/dist/types.d.ts +529 -3
  313. package/dist/types.js +1 -1
  314. package/dist/utility-learner.js +2 -2
  315. package/dist/utility-runtime.js +3 -3
  316. package/dist/verified-recall.js +11 -8
  317. package/dist/whitespace.d.ts +4 -0
  318. package/dist/whitespace.js +9 -0
  319. package/dist/whitespace.js.map +1 -0
  320. package/package.json +14 -8
  321. package/dist/chunk-2CJCWDMR.js +0 -87
  322. package/dist/chunk-2CJCWDMR.js.map +0 -1
  323. package/dist/chunk-2PO5ZRKV.js.map +0 -1
  324. package/dist/chunk-6UJQNRIO.js.map +0 -1
  325. package/dist/chunk-AAI7JARD.js.map +0 -1
  326. package/dist/chunk-B7LOFDVE.js.map +0 -1
  327. package/dist/chunk-BDFZXRSO.js.map +0 -1
  328. package/dist/chunk-CXWFUJR2.js.map +0 -1
  329. package/dist/chunk-DORBM6OB.js +0 -81
  330. package/dist/chunk-DORBM6OB.js.map +0 -1
  331. package/dist/chunk-ESSMF2FR.js.map +0 -1
  332. package/dist/chunk-HG2NKWR2.js.map +0 -1
  333. package/dist/chunk-HLBYLYRD.js.map +0 -1
  334. package/dist/chunk-HLXVTBF3.js.map +0 -1
  335. package/dist/chunk-ISY75RLM.js.map +0 -1
  336. package/dist/chunk-IZME7KW2.js.map +0 -1
  337. package/dist/chunk-KL4CP4SB.js.map +0 -1
  338. package/dist/chunk-KWBU5S5U.js.map +0 -1
  339. package/dist/chunk-M5ZBBBJI.js.map +0 -1
  340. package/dist/chunk-MDDAA2AO.js.map +0 -1
  341. package/dist/chunk-MWGVGUIS.js.map +0 -1
  342. package/dist/chunk-ORZMT74A.js.map +0 -1
  343. package/dist/chunk-OTFNI3OO.js.map +0 -1
  344. package/dist/chunk-PGK3VUHN.js.map +0 -1
  345. package/dist/chunk-QCCCQT3O.js.map +0 -1
  346. package/dist/chunk-QDOSNLB4.js.map +0 -1
  347. package/dist/chunk-QPKFPHOO.js +0 -178
  348. package/dist/chunk-QPKFPHOO.js.map +0 -1
  349. package/dist/chunk-QWUUMMIK.js.map +0 -1
  350. package/dist/chunk-QY2BHY5O.js.map +0 -1
  351. package/dist/chunk-TVVVQQAK.js.map +0 -1
  352. package/dist/chunk-U4PV25RD.js.map +0 -1
  353. package/dist/chunk-UYSKNO6E.js.map +0 -1
  354. package/dist/chunk-V4YC4LUK.js.map +0 -1
  355. package/dist/chunk-WWIQTB2Y.js.map +0 -1
  356. package/dist/chunk-XUHI52HK.js.map +0 -1
  357. package/dist/chunk-YNCQ7E4M.js.map +0 -1
  358. package/dist/chunk-ZJLY4QSU.js.map +0 -1
  359. /package/dist/{engine-2A6J4XEX.js.map → abort-error.js.map} +0 -0
  360. /package/dist/{chunk-NTTLPF7F.js.map → chunk-3QFQGRHO.js.map} +0 -0
  361. /package/dist/{chunk-G3AG3KZN.js.map → chunk-5IZL4DCV.js.map} +0 -0
  362. /package/dist/{chunk-BRK4ODMI.js.map → chunk-5NPGSAVB.js.map} +0 -0
  363. /package/dist/{chunk-QANCTXQF.js.map → chunk-6LX5ORAS.js.map} +0 -0
  364. /package/dist/{chunk-UIYZ5T3I.js.map → chunk-6UJ47TVX.js.map} +0 -0
  365. /package/dist/{chunk-L5RPWGFK.js.map → chunk-7DHTMOND.js.map} +0 -0
  366. /package/dist/{chunk-L7WO3MZ4.js.map → chunk-7ECD5ATE.js.map} +0 -0
  367. /package/dist/{chunk-Q6FETXJA.js.map → chunk-7SEAZFFB.js.map} +0 -0
  368. /package/dist/{chunk-SCHEKPYH.js.map → chunk-C2EFFULQ.js.map} +0 -0
  369. /package/dist/{chunk-GJR6D6KC.js.map → chunk-D654IBA6.js.map} +0 -0
  370. /package/dist/{chunk-UV2FO7J4.js.map → chunk-E6K4NIEU.js.map} +0 -0
  371. /package/dist/{chunk-T4WRIV2C.js.map → chunk-EABGC2TL.js.map} +0 -0
  372. /package/dist/{chunk-ONRU4L2N.js.map → chunk-FEMOX5AD.js.map} +0 -0
  373. /package/dist/{chunk-IFFFR3MR.js.map → chunk-FSFEQI74.js.map} +0 -0
  374. /package/dist/{chunk-J3BT33K7.js.map → chunk-ITRLGI2T.js.map} +0 -0
  375. /package/dist/{chunk-J47FNDR7.js.map → chunk-JIU55F3X.js.map} +0 -0
  376. /package/dist/{chunk-ZKYI7UVO.js.map → chunk-JR4ZC3G4.js.map} +0 -0
  377. /package/dist/{chunk-UCYSTFZR.js.map → chunk-JRNQ3RNA.js.map} +0 -0
  378. /package/dist/{chunk-GPGBSNKM.js.map → chunk-K4FLSOR5.js.map} +0 -0
  379. /package/dist/{chunk-LP47L3ZX.js.map → chunk-N42IWANG.js.map} +0 -0
  380. /package/dist/{chunk-YNI4S5WT.js.map → chunk-N53K2EXC.js.map} +0 -0
  381. /package/dist/{chunk-763GUIOU.js.map → chunk-NBNN5GOB.js.map} +0 -0
  382. /package/dist/{chunk-OOSWAUYB.js.map → chunk-ODWDQNRE.js.map} +0 -0
  383. /package/dist/{chunk-OTAVQCSF.js.map → chunk-PYXS46O7.js.map} +0 -0
  384. /package/dist/{chunk-4A24LIM2.js.map → chunk-S75M5ZRK.js.map} +0 -0
  385. /package/dist/{chunk-M5KEYE5E.js.map → chunk-URB2WSKZ.js.map} +0 -0
@@ -10,12 +10,15 @@ import './negative.js';
10
10
  import './recall-state.js';
11
11
  import './session-observer-state.js';
12
12
  import './embedding-fallback.js';
13
- export { c as GraphRecallRankedResult, e as GraphRecallShadowComparison, G as GraphRecallSnapshot, I as IntentDebugSnapshot, O as Orchestrator, Q as QmdRecallSnapshot, f as RecallInvocationOptions, g as RecallModeDecision, h as appendMemoryToGraphContext, i as blendGraphExpandedRecallScore, j as buildCompressionGuidelinesMarkdown, k as buildMemoryPathById, l as computeArtifactCandidateFetchLimit, m as computeArtifactRecallLimit, n as computeQmdHybridFetchLimit, d as defaultWorkspaceDir, o as deriveTopicsFromExtraction, p as filterRecallCandidates, q as formatCompressionGuidelinesForRecall, r as graphPathRelativeToStorage, t as hasIdentityRecoveryIntent, u as isArtifactMemoryPath, v as lifecycleRecallScoreAdjustment, w as mergeArtifactRecallCandidates, x as mergeGraphExpandedResults, y as resolveEffectiveIdentityInjectionMode, z as resolveEffectiveRecallMode, A as resolvePersistedMemoryRelativePath, B as resolveRecallModeDecision, D as resolveRecentThreadMemoryPaths, s as sanitizeSessionKeyForFilename, E as shouldFilterLifecycleRecallCandidate, F as summarizeGraphShadowComparison } from './orchestrator-zTa-Qo-1.js';
13
+ export { l as GraphRecallRankedResult, m as GraphRecallShadowComparison, G as GraphRecallSnapshot, I as IntentDebugSnapshot, O as Orchestrator, Q as QmdRecallSnapshot, n as RecallInvocationOptions, o as RecallModeDecision, q as appendMemoryToGraphContext, r as blendGraphExpandedRecallScore, t as buildCompressionGuidelinesMarkdown, u as buildMemoryPathById, w as computeArtifactCandidateFetchLimit, x as computeArtifactRecallLimit, y as computeQmdHybridFetchLimit, z as dedupeEntitySynthesisEvidenceEntries, j as defaultWorkspaceDir, A as deriveTopicsFromExtraction, D as filterRecallCandidates, E as formatCompressionGuidelinesForRecall, F as graphPathRelativeToStorage, H as hasIdentityRecoveryIntent, J as isArtifactMemoryPath, K as lifecycleRecallScoreAdjustment, L as mergeArtifactRecallCandidates, M as mergeGraphExpandedResults, N as resolveEffectiveIdentityInjectionMode, P as resolveEffectiveRecallMode, S as resolvePersistedMemoryRelativePath, T as resolveRecallModeDecision, U as resolveRecentThreadMemoryPaths, s as sanitizeSessionKeyForFilename, V as shouldFilterLifecycleRecallCandidate, W as summarizeGraphShadowComparison } from './orchestrator-DRYA6_lW.js';
14
14
  import './types.js';
15
- import './semantic-consolidation.js';
15
+ import './semantic-consolidation-DrvSYRdB.js';
16
16
  import './policy-runtime.js';
17
17
  import './profiling.js';
18
- import './memory-projection-store-NxMkbocT.js';
18
+ import './page-versioning.js';
19
+ import './memory-projection-store-DeSXPh1j.js';
19
20
  import 'better-sqlite3';
20
21
  import './session-integrity.js';
21
22
  import 'zod';
23
+ import './codex-materialize-CQlLTzke.js';
24
+ import './logger.js';
@@ -7,6 +7,7 @@ import {
7
7
  computeArtifactCandidateFetchLimit,
8
8
  computeArtifactRecallLimit,
9
9
  computeQmdHybridFetchLimit,
10
+ dedupeEntitySynthesisEvidenceEntries,
10
11
  defaultWorkspaceDir,
11
12
  deriveTopicsFromExtraction,
12
13
  filterRecallCandidates,
@@ -25,96 +26,107 @@ import {
25
26
  sanitizeSessionKeyForFilename,
26
27
  shouldFilterLifecycleRecallCandidate,
27
28
  summarizeGraphShadowComparison
28
- } from "./chunk-OTFNI3OO.js";
29
- import "./chunk-UYSKNO6E.js";
30
- import "./chunk-IFFFR3MR.js";
31
- import "./chunk-Z5AAYHUC.js";
32
- import "./chunk-4A24LIM2.js";
33
- import "./chunk-TPB3I2AC.js";
29
+ } from "./chunk-DEPL3635.js";
30
+ import "./chunk-DHHP2Z4X.js";
34
31
  import "./chunk-UHGBNIOS.js";
35
- import "./chunk-ZKYI7UVO.js";
36
- import "./chunk-LP47L3ZX.js";
32
+ import "./chunk-FSFEQI74.js";
33
+ import "./chunk-N42IWANG.js";
37
34
  import "./chunk-ETOW6ACV.js";
38
- import "./chunk-GPGBSNKM.js";
39
- import "./chunk-V3RXWQIE.js";
40
- import "./chunk-G3AG3KZN.js";
41
- import "./chunk-2CJCWDMR.js";
42
- import "./chunk-HG2NKWR2.js";
35
+ import "./chunk-W6SL7OFG.js";
36
+ import "./chunk-Z5AAYHUC.js";
37
+ import "./chunk-S75M5ZRK.js";
38
+ import "./chunk-TPB3I2AC.js";
39
+ import "./chunk-JR4ZC3G4.js";
40
+ import "./chunk-KVE7R4CG.js";
43
41
  import "./chunk-X7XN6YU4.js";
44
- import "./chunk-BRK4ODMI.js";
42
+ import "./chunk-5NPGSAVB.js";
45
43
  import "./chunk-C7VW7C3F.js";
44
+ import "./chunk-K4FLSOR5.js";
45
+ import "./chunk-V3RXWQIE.js";
46
+ import "./chunk-5IZL4DCV.js";
46
47
  import "./chunk-YCN4BVDK.js";
47
- import "./chunk-L5RPWGFK.js";
48
- import "./chunk-GJR6D6KC.js";
48
+ import "./chunk-YDBIWGNI.js";
49
+ import "./chunk-7DHTMOND.js";
50
+ import "./chunk-47UU5PU2.js";
51
+ import "./chunk-D654IBA6.js";
49
52
  import "./chunk-H63EDPFJ.js";
50
- import "./chunk-WWIQTB2Y.js";
51
- import "./chunk-6UJQNRIO.js";
52
- import "./chunk-MWGVGUIS.js";
53
- import "./chunk-763GUIOU.js";
54
- import "./chunk-ONRU4L2N.js";
55
- import "./chunk-MDDAA2AO.js";
56
53
  import "./chunk-YAZNBMNF.js";
57
- import "./chunk-2PO5ZRKV.js";
54
+ import "./chunk-GGD5W7TB.js";
55
+ import "./chunk-LAYN4LDC.js";
56
+ import "./chunk-3SV6CQHO.js";
57
+ import "./chunk-UEYA6UC7.js";
58
+ import "./chunk-NBNN5GOB.js";
59
+ import "./chunk-FEMOX5AD.js";
60
+ import "./chunk-JL2PU6AI.js";
61
+ import "./chunk-GZCUW5IC.js";
58
62
  import "./chunk-VEWZZM3H.js";
59
- import "./chunk-QPKFPHOO.js";
60
- import "./chunk-V4YC4LUK.js";
61
- import "./chunk-HLBYLYRD.js";
62
- import "./chunk-OTAVQCSF.js";
63
+ import "./chunk-ALXMCZEU.js";
64
+ import "./chunk-7WQ6SLIE.js";
65
+ import "./chunk-PAORGQRI.js";
66
+ import "./chunk-6UJ47TVX.js";
67
+ import "./chunk-PYXS46O7.js";
63
68
  import "./chunk-3QKK7QOS.js";
64
- import "./chunk-UIYZ5T3I.js";
65
- import "./chunk-UCYSTFZR.js";
66
- import "./chunk-J47FNDR7.js";
69
+ import "./chunk-JRNQ3RNA.js";
70
+ import "./chunk-JIU55F3X.js";
67
71
  import "./chunk-CULXMQJH.js";
68
- import "./chunk-UV2FO7J4.js";
69
- import "./chunk-T4WRIV2C.js";
70
- import "./chunk-LOBRX7VD.js";
71
- import "./chunk-IZME7KW2.js";
72
+ import "./chunk-E6K4NIEU.js";
73
+ import "./chunk-ZVBB3T7V.js";
72
74
  import "./chunk-YRMVARQP.js";
73
- import "./chunk-TVVVQQAK.js";
74
- import "./chunk-BDFZXRSO.js";
75
+ import "./chunk-BLKTA7MM.js";
76
+ import "./chunk-EABGC2TL.js";
77
+ import "./chunk-LOBRX7VD.js";
78
+ import "./chunk-HMDCOMYU.js";
79
+ import "./chunk-J4IYOZZ5.js";
75
80
  import "./chunk-LK6SGL53.js";
76
- import "./chunk-AAI7JARD.js";
77
- import "./chunk-C6QPK5GG.js";
78
- import "./chunk-Q6FETXJA.js";
81
+ import "./chunk-7SEAZFFB.js";
79
82
  import "./chunk-K6WK37A6.js";
80
- import "./chunk-SCHEKPYH.js";
81
- import "./chunk-ORZMT74A.js";
82
- import "./chunk-B7LOFDVE.js";
83
+ import "./chunk-3PG3H5TD.js";
83
84
  import "./chunk-FYIYMQ5N.js";
84
85
  import "./chunk-2NMMFZ5T.js";
85
86
  import "./chunk-Z5LAYHGJ.js";
86
- import "./chunk-JWPLJLDU.js";
87
- import "./chunk-YNI4S5WT.js";
88
- import "./chunk-DORBM6OB.js";
89
- import "./chunk-XYIK4LF6.js";
90
- import "./chunk-XUHI52HK.js";
91
- import "./chunk-M5ZBBBJI.js";
92
- import "./chunk-OOSWAUYB.js";
87
+ import "./chunk-C6QPK5GG.js";
88
+ import "./chunk-SYUK3VLY.js";
89
+ import "./chunk-EJI5XIBB.js";
90
+ import "./chunk-44ICJRF3.js";
91
+ import "./chunk-XZ2TIKGC.js";
93
92
  import "./chunk-Y27UJK6V.js";
93
+ import "./chunk-ODWDQNRE.js";
94
94
  import "./chunk-UZB5KHKX.js";
95
- import "./chunk-M5KEYE5E.js";
95
+ import "./chunk-C2EFFULQ.js";
96
+ import "./chunk-4WMCPJWX.js";
97
+ import "./chunk-6HZ6AO2P.js";
98
+ import "./chunk-JWPLJLDU.js";
99
+ import "./chunk-N53K2EXC.js";
100
+ import "./chunk-URB2WSKZ.js";
101
+ import "./chunk-UVJFDP7P.js";
102
+ import "./chunk-XYIK4LF6.js";
103
+ import "./chunk-PVGDJXVK.js";
96
104
  import "./chunk-NGAVDO7E.js";
97
105
  import "./chunk-MARWOCVP.js";
98
- import "./chunk-N5AKDXAI.js";
99
106
  import "./chunk-EQINRHYR.js";
107
+ import "./chunk-QDYXG4CS.js";
108
+ import "./chunk-QNJMBKFK.js";
100
109
  import "./chunk-EEQLFRUM.js";
101
- import "./chunk-QWUUMMIK.js";
102
- import "./chunk-U4PV25RD.js";
103
- import "./chunk-ESSMF2FR.js";
104
- import "./chunk-TP4FZJIZ.js";
110
+ import "./chunk-QDW3E4RD.js";
111
+ import "./chunk-4NRAJUDS.js";
112
+ import "./chunk-DT5TVLJE.js";
113
+ import "./chunk-N5AKDXAI.js";
114
+ import "./chunk-TBBDFYXW.js";
115
+ import "./chunk-DGXUHMOV.js";
116
+ import "./chunk-LPSF4OQH.js";
117
+ import "./chunk-GV6NLQ4X.js";
118
+ import "./chunk-3WHVNEN7.js";
119
+ import "./chunk-4KAN3GZ3.js";
120
+ import "./chunk-6ZH4TU6I.js";
105
121
  import "./chunk-SCU65EZI.js";
106
122
  import "./chunk-BOUYNNYD.js";
123
+ import "./chunk-6PFRXT4K.js";
124
+ import "./chunk-TP4FZJIZ.js";
107
125
  import "./chunk-DM2T26WE.js";
108
126
  import "./chunk-QSVPYQPG.js";
109
- import "./chunk-YNCQ7E4M.js";
110
- import "./chunk-HLXVTBF3.js";
111
127
  import "./chunk-M62O4P4T.js";
112
- import "./chunk-DT5TVLJE.js";
113
- import "./chunk-KWBU5S5U.js";
114
- import "./chunk-DGXUHMOV.js";
115
- import "./chunk-LPSF4OQH.js";
116
- import "./chunk-6HZ6AO2P.js";
117
- import "./chunk-QCCCQT3O.js";
128
+ import "./chunk-4DJQYKMN.js";
129
+ import "./chunk-2ODBA7MQ.js";
118
130
  export {
119
131
  Orchestrator,
120
132
  appendMemoryToGraphContext,
@@ -124,6 +136,7 @@ export {
124
136
  computeArtifactCandidateFetchLimit,
125
137
  computeArtifactRecallLimit,
126
138
  computeQmdHybridFetchLimit,
139
+ dedupeEntitySynthesisEvidenceEntries,
127
140
  defaultWorkspaceDir,
128
141
  deriveTopicsFromExtraction,
129
142
  filterRecallCandidates,
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Page-level versioning with history and revert (issue #371).
3
+ *
4
+ * Provides snapshot-based versioning for memory files using a sidecar
5
+ * directory layout. Each memory page gets a `.versions/<pageName>/`
6
+ * subdirectory containing numbered snapshots and a `manifest.json` that
7
+ * records the version history.
8
+ *
9
+ * Storage layout:
10
+ * memoryDir/
11
+ * facts/preferences.md <- current file
12
+ * .versions/
13
+ * facts__preferences/
14
+ * manifest.json <- VersionHistory
15
+ * 1.md <- version 1 snapshot
16
+ * 2.md <- version 2 snapshot
17
+ */
18
+ interface PageVersion {
19
+ versionId: string;
20
+ timestamp: string;
21
+ contentHash: string;
22
+ sizeBytes: number;
23
+ trigger: VersionTrigger;
24
+ note?: string;
25
+ }
26
+ type VersionTrigger = "write" | "consolidation" | "revert" | "manual";
27
+ interface VersionHistory {
28
+ pagePath: string;
29
+ versions: PageVersion[];
30
+ currentVersion: string;
31
+ }
32
+ interface VersioningConfig {
33
+ enabled: boolean;
34
+ maxVersionsPerPage: number;
35
+ sidecarDir: string;
36
+ }
37
+ interface VersioningLogger {
38
+ debug(msg: string): void;
39
+ warn(msg: string): void;
40
+ }
41
+ /**
42
+ * Create a new version snapshot for a page.
43
+ *
44
+ * Call this BEFORE overwriting the current file so the previous content is
45
+ * preserved. If the file does not exist yet (first write), the provided
46
+ * `content` is snapshotted as version 1.
47
+ *
48
+ * Pruning: when the number of versions exceeds `config.maxVersionsPerPage`,
49
+ * the oldest snapshots (and their files) are removed.
50
+ */
51
+ declare function createVersion(pagePath: string, content: string, trigger: VersionTrigger, config: VersioningConfig, log?: VersioningLogger, note?: string, memoryDir?: string): Promise<PageVersion>;
52
+ /**
53
+ * List all versions for a page.
54
+ */
55
+ declare function listVersions(pagePath: string, config: VersioningConfig, memoryDir?: string): Promise<VersionHistory>;
56
+ /**
57
+ * Read the content of a specific version.
58
+ */
59
+ declare function getVersion(pagePath: string, versionId: string, config: VersioningConfig, memoryDir?: string): Promise<string>;
60
+ /**
61
+ * Revert a page to a previous version.
62
+ *
63
+ * 1. Reads the target version's content.
64
+ * 2. Snapshots the CURRENT content as a new version (trigger: "revert").
65
+ * 3. Writes the reverted content to the page file.
66
+ *
67
+ * Returns the newly created version entry for the revert snapshot.
68
+ */
69
+ declare function revertToVersion(pagePath: string, versionId: string, config: VersioningConfig, log?: VersioningLogger, memoryDir?: string): Promise<PageVersion>;
70
+ /**
71
+ * Simple line-based diff between two versions.
72
+ *
73
+ * Returns a unified-style diff string showing added (+) and removed (-) lines.
74
+ */
75
+ declare function diffVersions(pagePath: string, v1: string, v2: string, config: VersioningConfig, memoryDir?: string): Promise<string>;
76
+
77
+ export { type PageVersion, type VersionHistory, type VersionTrigger, type VersioningConfig, type VersioningLogger, createVersion, diffVersions, getVersion, listVersions, revertToVersion };
@@ -0,0 +1,15 @@
1
+ import {
2
+ createVersion,
3
+ diffVersions,
4
+ getVersion,
5
+ listVersions,
6
+ revertToVersion
7
+ } from "./chunk-6ZH4TU6I.js";
8
+ export {
9
+ createVersion,
10
+ diffVersions,
11
+ getVersion,
12
+ listVersions,
13
+ revertToVersion
14
+ };
15
+ //# sourceMappingURL=page-versioning.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Canonical plugin id for @remnic/plugin-openclaw.
3
+ *
4
+ * This is the identifier OpenClaw uses as a lookup key in plugins.slots.memory
5
+ * and plugins.entries.<id>. The legacy shim package @joshuaswarren/openclaw-engram
6
+ * intentionally uses a different id ("openclaw-engram") as a backwards-compat alias.
7
+ */
8
+ declare const PLUGIN_ID: "openclaw-remnic";
9
+ declare const LEGACY_PLUGIN_ID: "openclaw-engram";
10
+ /**
11
+ * Resolve the Remnic plugin entry from an OpenClaw-shaped config object.
12
+ *
13
+ * Lookup order:
14
+ * 1. `plugins.slots.memory` — but **only** when it resolves to a known
15
+ * Remnic plugin id; foreign slots are ignored so mixed-plugin installs
16
+ * do not accidentally apply another plugin's config to Remnic.
17
+ * 2. `preferredId` — the caller's own plugin id (e.g. `"openclaw-engram"` for
18
+ * the shim package); only consulted when no active slot overrides the choice.
19
+ * 3. `plugins.entries["openclaw-remnic"]`
20
+ * 4. `plugins.entries["openclaw-engram"]` (legacy backward-compat)
21
+ *
22
+ * Returns `undefined` when no Remnic entry is found.
23
+ *
24
+ * All five config-loader sites (loadPluginEntryFromFile, readPluginHooksPolicy,
25
+ * loadPluginConfig in access-cli.ts, loadCliPluginConfig in operator-toolkit.ts,
26
+ * and unwrapOpenClawEntry in materialize.cjs) delegate here so fallback order
27
+ * and guard logic are defined in exactly one place.
28
+ *
29
+ * @param raw - The raw OpenClaw config object.
30
+ * @param preferredId - The calling plugin's own id. When present and no
31
+ * `plugins.slots.memory` slot is set, this id is tried before the hardcoded
32
+ * `PLUGIN_ID`/`LEGACY_PLUGIN_ID` fallbacks. Ignored if it is not a known
33
+ * Remnic plugin id (safety guard against unexpected values).
34
+ */
35
+ declare function resolveRemnicPluginEntry(raw: unknown, preferredId?: string): Record<string, unknown> | undefined;
36
+
37
+ export { LEGACY_PLUGIN_ID, PLUGIN_ID, resolveRemnicPluginEntry };
@@ -0,0 +1,11 @@
1
+ import {
2
+ LEGACY_PLUGIN_ID,
3
+ PLUGIN_ID,
4
+ resolveRemnicPluginEntry
5
+ } from "./chunk-U66YHYC7.js";
6
+ export {
7
+ LEGACY_PLUGIN_ID,
8
+ PLUGIN_ID,
9
+ resolveRemnicPluginEntry
10
+ };
11
+ //# sourceMappingURL=plugin-id.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -2,9 +2,9 @@ import {
2
2
  PolicyRuntimeManager,
3
3
  readRuntimePolicySnapshot,
4
4
  sanitizeRuntimePolicyValues
5
- } from "./chunk-T4WRIV2C.js";
5
+ } from "./chunk-EABGC2TL.js";
6
6
  import "./chunk-6HZ6AO2P.js";
7
- import "./chunk-QCCCQT3O.js";
7
+ import "./chunk-TBBDFYXW.js";
8
8
  export {
9
9
  PolicyRuntimeManager,
10
10
  readRuntimePolicySnapshot,
package/dist/profiling.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  ProfilingCollector,
3
3
  formatProfileTraceAscii
4
- } from "./chunk-763GUIOU.js";
5
- import "./chunk-KWBU5S5U.js";
4
+ } from "./chunk-NBNN5GOB.js";
5
+ import "./chunk-2ODBA7MQ.js";
6
6
  export {
7
7
  ProfilingCollector,
8
8
  formatProfileTraceAscii
package/dist/qmd.d.ts CHANGED
@@ -17,9 +17,12 @@ declare class QmdClient implements SearchBackend {
17
17
  private readonly collection;
18
18
  private readonly maxResults;
19
19
  private available;
20
- private lastUpdateFailAtMs;
20
+ private _lastUpdateFailAtMs;
21
21
  private lastEmbedFailAtMs;
22
22
  private lastUpdateRunAtMs;
23
+ get lastUpdateFailedAtMs(): number | null;
24
+ get lastUpdateRanAtMs(): number | null;
25
+ resetUpdateThrottles(): void;
23
26
  private readonly updateTimeoutMs;
24
27
  private readonly updateMinIntervalMs;
25
28
  private readonly slowLog?;
@@ -94,7 +97,7 @@ declare class QmdClient implements SearchBackend {
94
97
  private bm25SearchViaSubprocess;
95
98
  private vsearchViaSubprocess;
96
99
  private searchGlobalViaSubprocess;
97
- update(): Promise<void>;
100
+ update(signal?: AbortSignal): Promise<void>;
98
101
  updateCollection(collection: string): Promise<void>;
99
102
  private runUpdateForCollection;
100
103
  embed(): Promise<void>;
package/dist/qmd.js CHANGED
@@ -1,11 +1,12 @@
1
1
  import {
2
2
  QmdClient,
3
3
  parseQmdExplain
4
- } from "./chunk-TVVVQQAK.js";
4
+ } from "./chunk-BLKTA7MM.js";
5
5
  import "./chunk-LK6SGL53.js";
6
+ import "./chunk-PVGDJXVK.js";
6
7
  import "./chunk-MARWOCVP.js";
7
- import "./chunk-ESSMF2FR.js";
8
- import "./chunk-KWBU5S5U.js";
8
+ import "./chunk-6PFRXT4K.js";
9
+ import "./chunk-2ODBA7MQ.js";
9
10
  export {
10
11
  QmdClient,
11
12
  parseQmdExplain
@@ -0,0 +1,20 @@
1
+ interface RecallAuditEntry {
2
+ ts: string;
3
+ sessionKey: string;
4
+ agentId: string;
5
+ trigger: string;
6
+ queryText: string;
7
+ candidateMemoryIds: string[];
8
+ summary: string | null;
9
+ injectedChars: number;
10
+ toggleState: "enabled" | "disabled-primary" | "disabled-secondary";
11
+ latencyMs?: number;
12
+ plannerMode?: string;
13
+ requestedMode?: string;
14
+ fallbackUsed?: boolean;
15
+ }
16
+ declare function buildRecallAuditPath(rootDir: string, ts: string, sessionKey: string): string;
17
+ declare function appendRecallAuditEntry(rootDir: string, entry: RecallAuditEntry): Promise<string>;
18
+ declare function pruneRecallAuditEntries(rootDir: string, retentionDays: number, now?: Date): Promise<string[]>;
19
+
20
+ export { type RecallAuditEntry, appendRecallAuditEntry, buildRecallAuditPath, pruneRecallAuditEntries };
@@ -0,0 +1,50 @@
1
+ // src/recall-audit.ts
2
+ import { appendFile, mkdir, readdir, rm } from "fs/promises";
3
+ import path from "path";
4
+ function formatIsoDate(ts) {
5
+ const normalized = new Date(ts);
6
+ if (Number.isNaN(normalized.getTime())) {
7
+ return (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
8
+ }
9
+ return normalized.toISOString().slice(0, 10);
10
+ }
11
+ function buildRecallAuditPath(rootDir, ts, sessionKey) {
12
+ const safeSessionKey = encodeURIComponent(sessionKey);
13
+ return path.join(rootDir, "transcripts", formatIsoDate(ts), `${safeSessionKey}.jsonl`);
14
+ }
15
+ async function appendRecallAuditEntry(rootDir, entry) {
16
+ const filePath = buildRecallAuditPath(rootDir, entry.ts, entry.sessionKey);
17
+ await mkdir(path.dirname(filePath), { recursive: true });
18
+ await appendFile(filePath, `${JSON.stringify(entry)}
19
+ `, "utf8");
20
+ return filePath;
21
+ }
22
+ async function pruneRecallAuditEntries(rootDir, retentionDays, now = /* @__PURE__ */ new Date()) {
23
+ const transcriptsDir = path.join(rootDir, "transcripts");
24
+ const removed = [];
25
+ const cutoff = new Date(now);
26
+ cutoff.setUTCHours(0, 0, 0, 0);
27
+ cutoff.setUTCDate(cutoff.getUTCDate() - Math.max(1, Math.floor(retentionDays)));
28
+ let entries;
29
+ try {
30
+ entries = await readdir(transcriptsDir, { withFileTypes: true });
31
+ } catch {
32
+ return removed;
33
+ }
34
+ for (const entry of entries) {
35
+ if (!entry.isDirectory()) continue;
36
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(entry.name)) continue;
37
+ const day = /* @__PURE__ */ new Date(`${entry.name}T00:00:00.000Z`);
38
+ if (Number.isNaN(day.getTime()) || day >= cutoff) continue;
39
+ const dirPath = path.join(transcriptsDir, entry.name);
40
+ await rm(dirPath, { recursive: true, force: true });
41
+ removed.push(dirPath);
42
+ }
43
+ return removed;
44
+ }
45
+ export {
46
+ appendRecallAuditEntry,
47
+ buildRecallAuditPath,
48
+ pruneRecallAuditEntries
49
+ };
50
+ //# sourceMappingURL=recall-audit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/recall-audit.ts"],"sourcesContent":["import type { Dirent } from \"node:fs\";\nimport { appendFile, mkdir, readdir, rm } from \"node:fs/promises\";\nimport path from \"node:path\";\n\nexport interface RecallAuditEntry {\n ts: string;\n sessionKey: string;\n agentId: string;\n trigger: string;\n queryText: string;\n candidateMemoryIds: string[];\n summary: string | null;\n injectedChars: number;\n toggleState: \"enabled\" | \"disabled-primary\" | \"disabled-secondary\";\n latencyMs?: number;\n plannerMode?: string;\n requestedMode?: string;\n fallbackUsed?: boolean;\n}\n\nfunction formatIsoDate(ts: string): string {\n const normalized = new Date(ts);\n if (Number.isNaN(normalized.getTime())) {\n return new Date().toISOString().slice(0, 10);\n }\n return normalized.toISOString().slice(0, 10);\n}\n\nexport function buildRecallAuditPath(rootDir: string, ts: string, sessionKey: string): string {\n const safeSessionKey = encodeURIComponent(sessionKey);\n return path.join(rootDir, \"transcripts\", formatIsoDate(ts), `${safeSessionKey}.jsonl`);\n}\n\nexport async function appendRecallAuditEntry(\n rootDir: string,\n entry: RecallAuditEntry,\n): Promise<string> {\n const filePath = buildRecallAuditPath(rootDir, entry.ts, entry.sessionKey);\n await mkdir(path.dirname(filePath), { recursive: true });\n await appendFile(filePath, `${JSON.stringify(entry)}\\n`, \"utf8\");\n return filePath;\n}\n\nexport async function pruneRecallAuditEntries(\n rootDir: string,\n retentionDays: number,\n now: Date = new Date(),\n): Promise<string[]> {\n const transcriptsDir = path.join(rootDir, \"transcripts\");\n const removed: string[] = [];\n const cutoff = new Date(now);\n cutoff.setUTCHours(0, 0, 0, 0);\n cutoff.setUTCDate(cutoff.getUTCDate() - Math.max(1, Math.floor(retentionDays)));\n let entries: Dirent[];\n try {\n entries = await readdir(transcriptsDir, { withFileTypes: true });\n } catch {\n return removed;\n }\n\n for (const entry of entries) {\n if (!entry.isDirectory()) continue;\n if (!/^\\d{4}-\\d{2}-\\d{2}$/.test(entry.name)) continue;\n const day = new Date(`${entry.name}T00:00:00.000Z`);\n if (Number.isNaN(day.getTime()) || day >= cutoff) continue;\n const dirPath = path.join(transcriptsDir, entry.name);\n await rm(dirPath, { recursive: true, force: true });\n removed.push(dirPath);\n }\n\n return removed;\n}\n"],"mappings":";AACA,SAAS,YAAY,OAAO,SAAS,UAAU;AAC/C,OAAO,UAAU;AAkBjB,SAAS,cAAc,IAAoB;AACzC,QAAM,aAAa,IAAI,KAAK,EAAE;AAC9B,MAAI,OAAO,MAAM,WAAW,QAAQ,CAAC,GAAG;AACtC,YAAO,oBAAI,KAAK,GAAE,YAAY,EAAE,MAAM,GAAG,EAAE;AAAA,EAC7C;AACA,SAAO,WAAW,YAAY,EAAE,MAAM,GAAG,EAAE;AAC7C;AAEO,SAAS,qBAAqB,SAAiB,IAAY,YAA4B;AAC5F,QAAM,iBAAiB,mBAAmB,UAAU;AACpD,SAAO,KAAK,KAAK,SAAS,eAAe,cAAc,EAAE,GAAG,GAAG,cAAc,QAAQ;AACvF;AAEA,eAAsB,uBACpB,SACA,OACiB;AACjB,QAAM,WAAW,qBAAqB,SAAS,MAAM,IAAI,MAAM,UAAU;AACzE,QAAM,MAAM,KAAK,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAK,CAAC;AACvD,QAAM,WAAW,UAAU,GAAG,KAAK,UAAU,KAAK,CAAC;AAAA,GAAM,MAAM;AAC/D,SAAO;AACT;AAEA,eAAsB,wBACpB,SACA,eACA,MAAY,oBAAI,KAAK,GACF;AACnB,QAAM,iBAAiB,KAAK,KAAK,SAAS,aAAa;AACvD,QAAM,UAAoB,CAAC;AAC3B,QAAM,SAAS,IAAI,KAAK,GAAG;AAC3B,SAAO,YAAY,GAAG,GAAG,GAAG,CAAC;AAC7B,SAAO,WAAW,OAAO,WAAW,IAAI,KAAK,IAAI,GAAG,KAAK,MAAM,aAAa,CAAC,CAAC;AAC9E,MAAI;AACJ,MAAI;AACF,cAAU,MAAM,QAAQ,gBAAgB,EAAE,eAAe,KAAK,CAAC;AAAA,EACjE,QAAQ;AACN,WAAO;AAAA,EACT;AAEA,aAAW,SAAS,SAAS;AAC3B,QAAI,CAAC,MAAM,YAAY,EAAG;AAC1B,QAAI,CAAC,sBAAsB,KAAK,MAAM,IAAI,EAAG;AAC7C,UAAM,MAAM,oBAAI,KAAK,GAAG,MAAM,IAAI,gBAAgB;AAClD,QAAI,OAAO,MAAM,IAAI,QAAQ,CAAC,KAAK,OAAO,OAAQ;AAClD,UAAM,UAAU,KAAK,KAAK,gBAAgB,MAAM,IAAI;AACpD,UAAM,GAAG,SAAS,EAAE,WAAW,MAAM,OAAO,KAAK,CAAC;AAClD,YAAQ,KAAK,OAAO;AAAA,EACtB;AAEA,SAAO;AACT;","names":[]}
@@ -0,0 +1,152 @@
1
+ /**
2
+ * Maximal Marginal Relevance (MMR) re-selection for recall candidates.
3
+ *
4
+ * After the reranker produces its ordered candidate list, we run an MMR pass
5
+ * over the top N candidates (per-section) so that a cluster of near-duplicate
6
+ * high-scoring facts cannot dominate the injected context.
7
+ *
8
+ * MMR(d) = λ * sim(d, query) − (1 − λ) * max_{d' ∈ selected} sim(d, d')
9
+ *
10
+ * - λ defaults to 0.7 (tilted toward relevance, with meaningful diversity).
11
+ * - Similarity uses cosine over pre-computed embeddings when available, and
12
+ * falls back to Jaccard over normalized tokens (lowercased alphanumerics)
13
+ * when embeddings are missing.
14
+ * - Per-section application is the caller's responsibility: pass each
15
+ * section's ordered candidate slice independently so one cluster in one
16
+ * section cannot starve another section.
17
+ *
18
+ * Pure, deterministic, no IO. Input arrays are never mutated.
19
+ */
20
+ /** Minimal candidate shape used by MMR. Callers may wrap their own records. */
21
+ interface MmrCandidate {
22
+ /** Stable identifier for the candidate. Only used for tie-breaking. */
23
+ id: string;
24
+ /** Text content used for the Jaccard similarity fallback. */
25
+ content: string;
26
+ /**
27
+ * Relevance score from the upstream ranker (e.g. rerank score or RRF).
28
+ * Used as the `sim(d, query)` term when no query embedding is available.
29
+ */
30
+ score: number;
31
+ /** Optional pre-computed embedding vector for cosine similarity. */
32
+ embedding?: readonly number[] | null;
33
+ }
34
+ interface ApplyMmrOptions<C extends MmrCandidate> {
35
+ /** Ordered candidate list (most relevant first). */
36
+ candidates: readonly C[];
37
+ /** Optional query embedding. If provided and candidates carry embeddings,
38
+ * relevance is measured by cosine similarity to the query. Otherwise
39
+ * candidate `score` is normalized and used. */
40
+ queryEmbedding?: readonly number[] | null;
41
+ /** λ ∈ [0, 1]. 1 = pure relevance, 0 = pure diversity. Default 0.7. */
42
+ lambda?: number;
43
+ /** Apply MMR only over the top N candidates. Default 40. */
44
+ topN?: number;
45
+ /** Maximum number of candidates to select. Default = candidates length. */
46
+ budget?: number;
47
+ }
48
+ interface MmrDiversityReport {
49
+ /**
50
+ * Total number of candidates MMR considered (the full input pool, pre-MMR).
51
+ * Previously this mirrored `kept` and was therefore uninformative; it now
52
+ * reflects the true pool size so `kept/considered` logs carry signal even
53
+ * though MMR is reorder-only.
54
+ */
55
+ considered: number;
56
+ /**
57
+ * Number of candidates present in the MMR output. With the current
58
+ * orchestrator pipeline MMR is reorder-only (no drops), so this is the
59
+ * same as `considered`. It's still reported separately so a future
60
+ * drop-mode MMR can distinguish them without another schema change.
61
+ */
62
+ kept: number;
63
+ /**
64
+ * Head-of-list positions whose candidate identity changed between the
65
+ * pre-MMR and post-MMR slices. This is the *actionable* diversity signal:
66
+ * it tells the caller how many of the top `sampleSize` results MMR
67
+ * promoted or demoted. Zero means MMR had no head-of-list effect; a value
68
+ * greater than zero means at least one diverse candidate was swapped in.
69
+ */
70
+ headReorderCount: number;
71
+ /** Average pairwise similarity of the head-of-list input slice (pre-MMR). */
72
+ avgPairwiseSimBefore: number;
73
+ /** Average pairwise similarity of the head-of-list MMR output slice. */
74
+ avgPairwiseSimAfter: number;
75
+ }
76
+ declare const DEFAULT_LAMBDA = 0.7;
77
+ declare const DEFAULT_TOP_N = 40;
78
+ /**
79
+ * Pure MMR re-selection over an ordered candidate list.
80
+ *
81
+ * Returns a new array — the input is never mutated. When `candidates.length`
82
+ * is `<= 1` or `budget <= 0`, a defensive copy is returned as a no-op.
83
+ */
84
+ declare function applyMmrToCandidates<C extends MmrCandidate>(opts: ApplyMmrOptions<C>): C[];
85
+ /**
86
+ * Summarize how much MMR reshuffled the head of the candidate list, for
87
+ * logging. Optional — callers can skip this if they don't care about metrics.
88
+ *
89
+ * IMPORTANT: `before` should be the score-ordered input (the same ordering the
90
+ * upstream reranker emitted, *not* the MMR output), and `after` should be the
91
+ * MMR-reordered list. Both are truncated to `sampleSize` before their pairwise
92
+ * similarity is averaged.
93
+ *
94
+ * The sample size intentionally defaults to a small number
95
+ * ({@link DEFAULT_DIVERSITY_SAMPLE_SIZE}) so that when the caller uses
96
+ * `budget >= candidates.length` (i.e. MMR only reorders without dropping), the
97
+ * head-of-list comparison still reflects whether MMR promoted diverse
98
+ * candidates. Passing a sample size `>= candidates.length` in that situation
99
+ * makes `avgPairwiseSimBefore` and `avgPairwiseSimAfter` trivially equal
100
+ * because pairwise similarity is order-independent.
101
+ */
102
+ declare function summarizeMmrDiversity<C extends MmrCandidate>(before: readonly C[], after: readonly C[], sampleSize?: number): MmrDiversityReport;
103
+ declare function normalizeTokens(text: string): Set<string>;
104
+ /**
105
+ * Minimum shape the recall-MMR orchestration helper expects from a result.
106
+ * Any richer result type (e.g. {@link QmdSearchResult}) satisfies this.
107
+ */
108
+ interface MmrRecallResult {
109
+ readonly docid?: string;
110
+ readonly path?: string;
111
+ readonly snippet?: string;
112
+ readonly score?: number;
113
+ }
114
+ interface ReorderRecallResultsOptions {
115
+ readonly lambda?: number;
116
+ readonly topN?: number;
117
+ /**
118
+ * Head-of-list sample size used by the diversity metric. Defaults to
119
+ * {@link DEFAULT_DIVERSITY_SAMPLE_SIZE}. Intentionally small so the metric
120
+ * reflects head-of-list changes even when `budget >= results.length`.
121
+ */
122
+ readonly diversitySampleSize?: number;
123
+ }
124
+ interface ReorderRecallResultsOutcome<R extends MmrRecallResult> {
125
+ readonly reordered: R[];
126
+ readonly diversity: MmrDiversityReport;
127
+ readonly lambda: number;
128
+ }
129
+ /**
130
+ * Apply MMR to an ordered list of recall results and return the reordered
131
+ * list plus a head-of-list diversity report.
132
+ *
133
+ * This helper is the single source of truth for the orchestrator's
134
+ * per-section MMR pass. It is pure and deterministic so it can be unit
135
+ * tested without constructing an Orchestrator.
136
+ *
137
+ * Key invariants:
138
+ * 1. **No silent drops.** Candidates are keyed by a stable unique key derived
139
+ * from `path` first, falling back to `docid`, and always suffixed with the
140
+ * candidate's original index. Two results that share a basename-style
141
+ * docid but differ in path are treated as distinct candidates and both
142
+ * survive the reorder.
143
+ * 2. **No mutation.** The input array is never mutated; a new array is
144
+ * returned.
145
+ * 3. **Diversity metric is meaningful.** The report compares the *head of
146
+ * list* before and after MMR using a small sample size, so it reflects
147
+ * whether MMR promoted diverse candidates even when
148
+ * `budget >= results.length`.
149
+ */
150
+ declare function reorderRecallResultsWithMmr<R extends MmrRecallResult>(results: readonly R[], options?: ReorderRecallResultsOptions): ReorderRecallResultsOutcome<R>;
151
+
152
+ export { type ApplyMmrOptions, DEFAULT_LAMBDA, DEFAULT_TOP_N, type MmrCandidate, type MmrDiversityReport, type MmrRecallResult, type ReorderRecallResultsOptions, type ReorderRecallResultsOutcome, applyMmrToCandidates, normalizeTokens, reorderRecallResultsWithMmr, summarizeMmrDiversity };