@remnic/core 1.0.3 → 1.1.1

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 (323) hide show
  1. package/dist/abort-error.d.ts +32 -0
  2. package/dist/abort-error.js +11 -0
  3. package/dist/access-audit.d.ts +56 -0
  4. package/dist/access-audit.js +9 -0
  5. package/dist/access-audit.js.map +1 -0
  6. package/dist/access-cli.js +72 -54
  7. package/dist/access-cli.js.map +1 -1
  8. package/dist/access-http.d.ts +16 -8
  9. package/dist/access-http.js +25 -17
  10. package/dist/access-mcp.d.ts +16 -8
  11. package/dist/access-mcp.js +28 -6
  12. package/dist/access-schema.d.ts +130 -39
  13. package/dist/access-schema.js +5 -1
  14. package/dist/access-service-Br8ZydTK.d.ts +827 -0
  15. package/dist/access-service.d.ts +20 -660
  16. package/dist/access-service.js +22 -14
  17. package/dist/bootstrap.d.ts +6 -3
  18. package/dist/briefing.d.ts +1 -0
  19. package/dist/briefing.js +6 -5
  20. package/dist/buffer-surprise-report.d.ts +70 -0
  21. package/dist/buffer-surprise-report.js +7 -0
  22. package/dist/buffer-surprise-report.js.map +1 -0
  23. package/dist/buffer-surprise.d.ts +98 -0
  24. package/dist/buffer-surprise.js +11 -0
  25. package/dist/buffer-surprise.js.map +1 -0
  26. package/dist/buffer.d.ts +100 -2
  27. package/dist/buffer.js +1 -1
  28. package/dist/calibration.js +5 -5
  29. package/dist/causal-behavior.js +4 -4
  30. package/dist/causal-chain.js +2 -2
  31. package/dist/causal-consolidation.js +17 -16
  32. package/dist/causal-consolidation.js.map +1 -1
  33. package/dist/causal-retrieval.js +4 -4
  34. package/dist/causal-trajectory.js +1 -1
  35. package/dist/{chunk-QNJMBKFK.js → chunk-2LGMW3DJ.js} +3 -2
  36. package/dist/chunk-2LGMW3DJ.js.map +1 -0
  37. package/dist/{chunk-QDYXG4CS.js → chunk-3FPTCC3Z.js} +4 -3
  38. package/dist/chunk-3FPTCC3Z.js.map +1 -0
  39. package/dist/chunk-3GPTTA4J.js +57 -0
  40. package/dist/chunk-3GPTTA4J.js.map +1 -0
  41. package/dist/{chunk-QKAH5B6E.js → chunk-3GXCSUXR.js} +94 -6
  42. package/dist/chunk-3GXCSUXR.js.map +1 -0
  43. package/dist/{chunk-POBPGDWI.js → chunk-3OGMS3PE.js} +2 -2
  44. package/dist/chunk-54V4BZWP.js +139 -0
  45. package/dist/chunk-54V4BZWP.js.map +1 -0
  46. package/dist/chunk-5JRF2PZA.js +67 -0
  47. package/dist/chunk-5JRF2PZA.js.map +1 -0
  48. package/dist/chunk-64NJRYU2.js +332 -0
  49. package/dist/chunk-64NJRYU2.js.map +1 -0
  50. package/dist/chunk-6AUUAZEX.js +150 -0
  51. package/dist/chunk-6AUUAZEX.js.map +1 -0
  52. package/dist/{chunk-HITJFT7E.js → chunk-7I7FKFZH.js} +28 -21
  53. package/dist/chunk-7I7FKFZH.js.map +1 -0
  54. package/dist/chunk-AJU4PJGY.js +126 -0
  55. package/dist/chunk-AJU4PJGY.js.map +1 -0
  56. package/dist/chunk-ASAITVLA.js +64 -0
  57. package/dist/chunk-ASAITVLA.js.map +1 -0
  58. package/dist/{chunk-X4WESCKA.js → chunk-B5WXLVDY.js} +187 -6
  59. package/dist/chunk-B5WXLVDY.js.map +1 -0
  60. package/dist/{chunk-RCICHSHL.js → chunk-BGJGXLZ7.js} +111 -2
  61. package/dist/{chunk-RCICHSHL.js.map → chunk-BGJGXLZ7.js.map} +1 -1
  62. package/dist/{chunk-OJFGVJS6.js → chunk-BK2EFTE2.js} +319 -18
  63. package/dist/chunk-BK2EFTE2.js.map +1 -0
  64. package/dist/chunk-C4SQJZAF.js +486 -0
  65. package/dist/chunk-C4SQJZAF.js.map +1 -0
  66. package/dist/{chunk-GJQPH5G3.js → chunk-CUPFXL3J.js} +2 -2
  67. package/dist/chunk-DF3RVK3X.js +119 -0
  68. package/dist/chunk-DF3RVK3X.js.map +1 -0
  69. package/dist/{chunk-PMB3WGDL.js → chunk-DFTTJYSO.js} +167 -7
  70. package/dist/chunk-DFTTJYSO.js.map +1 -0
  71. package/dist/chunk-DGVM5SFL.js +69 -0
  72. package/dist/chunk-DGVM5SFL.js.map +1 -0
  73. package/dist/chunk-EIR5VLIH.js +90 -0
  74. package/dist/chunk-EIR5VLIH.js.map +1 -0
  75. package/dist/{chunk-PAORGQRI.js → chunk-EPQJM2GC.js} +37 -23
  76. package/dist/chunk-EPQJM2GC.js.map +1 -0
  77. package/dist/{chunk-POMSFKTB.js → chunk-F5VP6YCB.js} +368 -10
  78. package/dist/chunk-F5VP6YCB.js.map +1 -0
  79. package/dist/{chunk-6ZH4TU6I.js → chunk-FAAFWE4G.js} +2 -1
  80. package/dist/chunk-FAAFWE4G.js.map +1 -0
  81. package/dist/{chunk-74JR4N5J.js → chunk-FVA6TGI3.js} +2 -2
  82. package/dist/chunk-GDFS42HT.js +206 -0
  83. package/dist/chunk-GDFS42HT.js.map +1 -0
  84. package/dist/{chunk-BKQJBXXX.js → chunk-GGD5W7TB.js} +2 -2
  85. package/dist/chunk-GGD5W7TB.js.map +1 -0
  86. package/dist/{chunk-V7XCAHIB.js → chunk-GKFXUTJ2.js} +508 -26
  87. package/dist/chunk-GKFXUTJ2.js.map +1 -0
  88. package/dist/{chunk-NSB3WSYS.js → chunk-HK3FGIEW.js} +278 -3
  89. package/dist/chunk-HK3FGIEW.js.map +1 -0
  90. package/dist/{chunk-AAI7JARD.js → chunk-HMDCOMYU.js} +8 -11
  91. package/dist/chunk-HMDCOMYU.js.map +1 -0
  92. package/dist/chunk-IISBCCWR.js +52 -0
  93. package/dist/chunk-IISBCCWR.js.map +1 -0
  94. package/dist/{chunk-YFYL2SIJ.js → chunk-INXV5JBT.js} +290 -46
  95. package/dist/chunk-INXV5JBT.js.map +1 -0
  96. package/dist/chunk-JBMSGZEQ.js +441 -0
  97. package/dist/chunk-JBMSGZEQ.js.map +1 -0
  98. package/dist/{chunk-UPMD5XND.js → chunk-JL2PU6AI.js} +16 -5
  99. package/dist/chunk-JL2PU6AI.js.map +1 -0
  100. package/dist/{chunk-J4IYOZZ5.js → chunk-JXS5PDQ7.js} +3 -1
  101. package/dist/chunk-JXS5PDQ7.js.map +1 -0
  102. package/dist/{chunk-AYPYCLR7.js → chunk-KUB6JU6H.js} +4 -4
  103. package/dist/chunk-KVBLZUKV.js +173 -0
  104. package/dist/chunk-KVBLZUKV.js.map +1 -0
  105. package/dist/chunk-LBLXEFWK.js +51 -0
  106. package/dist/chunk-LBLXEFWK.js.map +1 -0
  107. package/dist/{chunk-U2IQTSBY.js → chunk-LTCGGW2D.js} +1 -1
  108. package/dist/chunk-LTCGGW2D.js.map +1 -0
  109. package/dist/{chunk-UEYA6UC7.js → chunk-NZLQTHS5.js} +25 -2
  110. package/dist/chunk-NZLQTHS5.js.map +1 -0
  111. package/dist/chunk-PVGDJXVK.js +21 -0
  112. package/dist/chunk-PVGDJXVK.js.map +1 -0
  113. package/dist/chunk-PVPWZSSI.js +37 -0
  114. package/dist/chunk-PVPWZSSI.js.map +1 -0
  115. package/dist/{chunk-4NRAJUDS.js → chunk-RBBWYEFJ.js} +1 -1
  116. package/dist/chunk-RFYAYKTD.js +146 -0
  117. package/dist/chunk-RFYAYKTD.js.map +1 -0
  118. package/dist/{chunk-JROGC36Y.js → chunk-RGLL5SPU.js} +2 -2
  119. package/dist/{chunk-2VFW5K5U.js → chunk-S3EEFKNY.js} +103 -65
  120. package/dist/chunk-S3EEFKNY.js.map +1 -0
  121. package/dist/chunk-SOBJ6NEY.js +18 -0
  122. package/dist/chunk-SOBJ6NEY.js.map +1 -0
  123. package/dist/{chunk-MYQWXITD.js → chunk-SPI27QT6.js} +2 -2
  124. package/dist/chunk-TVVEYCNW.js +65 -0
  125. package/dist/chunk-TVVEYCNW.js.map +1 -0
  126. package/dist/chunk-ULYOGL6R.js +322 -0
  127. package/dist/chunk-ULYOGL6R.js.map +1 -0
  128. package/dist/{chunk-S4LX5EBI.js → chunk-VBVG2M5G.js} +64 -10
  129. package/dist/chunk-VBVG2M5G.js.map +1 -0
  130. package/dist/{chunk-KWP7T3DP.js → chunk-VDX363PS.js} +2 -2
  131. package/dist/{chunk-XMGSSBFX.js → chunk-VYM3VWOF.js} +1560 -244
  132. package/dist/chunk-VYM3VWOF.js.map +1 -0
  133. package/dist/{chunk-MTLYEMJB.js → chunk-WCLICCGB.js} +18 -3
  134. package/dist/chunk-WCLICCGB.js.map +1 -0
  135. package/dist/{chunk-ECKDIK5F.js → chunk-WVVA7F5A.js} +2 -2
  136. package/dist/chunk-X6GF3FX2.js +26 -0
  137. package/dist/chunk-X6GF3FX2.js.map +1 -0
  138. package/dist/{chunk-3QFQGRHO.js → chunk-XMHBH5H6.js} +4 -4
  139. package/dist/{chunk-KEG4GNGI.js → chunk-XZ2TIKGC.js} +38 -8
  140. package/dist/chunk-XZ2TIKGC.js.map +1 -0
  141. package/dist/chunk-Y4FHOFJ2.js +140 -0
  142. package/dist/chunk-Y4FHOFJ2.js.map +1 -0
  143. package/dist/chunk-YNB73F22.js +137 -0
  144. package/dist/chunk-YNB73F22.js.map +1 -0
  145. package/dist/{chunk-7PA4OZEU.js → chunk-YNQKWQT4.js} +55 -30
  146. package/dist/chunk-YNQKWQT4.js.map +1 -0
  147. package/dist/chunk-ZAIM4TUE.js +488 -0
  148. package/dist/chunk-ZAIM4TUE.js.map +1 -0
  149. package/dist/{chunk-BTY5RRRF.js → chunk-ZEM3OK2K.js} +5 -5
  150. package/dist/chunk-ZZTOURJI.js +91 -0
  151. package/dist/chunk-ZZTOURJI.js.map +1 -0
  152. package/dist/{cli-DwIBnp2g.d.ts → cli-BkeRaYfk.d.ts} +2 -2
  153. package/dist/cli.d.ts +13 -5
  154. package/dist/cli.js +45 -33
  155. package/dist/config.js +1 -1
  156. package/dist/consolidation-operator.d.ts +41 -0
  157. package/dist/consolidation-operator.js +11 -0
  158. package/dist/consolidation-operator.js.map +1 -0
  159. package/dist/consolidation-provenance-check.d.ts +68 -0
  160. package/dist/consolidation-provenance-check.js +9 -0
  161. package/dist/consolidation-provenance-check.js.map +1 -0
  162. package/dist/consolidation-undo.d.ts +123 -0
  163. package/dist/consolidation-undo.js +426 -0
  164. package/dist/consolidation-undo.js.map +1 -0
  165. package/dist/contradiction-review-WIUBAR52.js +21 -0
  166. package/dist/contradiction-review-WIUBAR52.js.map +1 -0
  167. package/dist/contradiction-scan-E3GJTI4F.js +412 -0
  168. package/dist/contradiction-scan-E3GJTI4F.js.map +1 -0
  169. package/dist/cross-namespace-budget.d.ts +133 -0
  170. package/dist/cross-namespace-budget.js +9 -0
  171. package/dist/cross-namespace-budget.js.map +1 -0
  172. package/dist/direct-answer-wiring.d.ts +77 -0
  173. package/dist/direct-answer-wiring.js +10 -0
  174. package/dist/direct-answer-wiring.js.map +1 -0
  175. package/dist/direct-answer.d.ts +106 -0
  176. package/dist/direct-answer.js +10 -0
  177. package/dist/direct-answer.js.map +1 -0
  178. package/dist/{engine-X7X3AAG3.js → engine-F3GOXGE5.js} +7 -6
  179. package/dist/engine-F3GOXGE5.js.map +1 -0
  180. package/dist/entity-retrieval.d.ts +1 -0
  181. package/dist/entity-retrieval.js +6 -5
  182. package/dist/explicit-capture.d.ts +6 -3
  183. package/dist/explicit-capture.js +2 -2
  184. package/dist/extraction-judge-telemetry.d.ts +113 -0
  185. package/dist/extraction-judge-telemetry.js +14 -0
  186. package/dist/extraction-judge-telemetry.js.map +1 -0
  187. package/dist/extraction-judge-training.d.ts +85 -0
  188. package/dist/extraction-judge-training.js +16 -0
  189. package/dist/extraction-judge-training.js.map +1 -0
  190. package/dist/extraction-judge.d.ts +124 -2
  191. package/dist/extraction-judge.js +11 -1
  192. package/dist/extraction.js +7 -6
  193. package/dist/fallback-llm.d.ts +11 -2
  194. package/dist/fallback-llm.js +2 -2
  195. package/dist/graph-recall.d.ts +100 -0
  196. package/dist/graph-recall.js +8 -0
  197. package/dist/graph-recall.js.map +1 -0
  198. package/dist/graph-retrieval.d.ts +271 -0
  199. package/dist/graph-retrieval.js +21 -0
  200. package/dist/graph-retrieval.js.map +1 -0
  201. package/dist/harmonic-retrieval.js +2 -1
  202. package/dist/importance.js +1 -1
  203. package/dist/index.d.ts +589 -138
  204. package/dist/index.js +531 -403
  205. package/dist/index.js.map +1 -1
  206. package/dist/intent.js +1 -1
  207. package/dist/local-llm.d.ts +10 -3
  208. package/dist/local-llm.js +1 -1
  209. package/dist/memory-worth-bench.d.ts +51 -0
  210. package/dist/memory-worth-bench.js +131 -0
  211. package/dist/memory-worth-bench.js.map +1 -0
  212. package/dist/memory-worth-filter.d.ts +128 -0
  213. package/dist/memory-worth-filter.js +10 -0
  214. package/dist/memory-worth-filter.js.map +1 -0
  215. package/dist/memory-worth-outcomes.d.ts +118 -0
  216. package/dist/memory-worth-outcomes.js +9 -0
  217. package/dist/memory-worth-outcomes.js.map +1 -0
  218. package/dist/memory-worth.d.ts +102 -0
  219. package/dist/memory-worth.js +7 -0
  220. package/dist/memory-worth.js.map +1 -0
  221. package/dist/operator-toolkit.d.ts +40 -1
  222. package/dist/operator-toolkit.js +24 -14
  223. package/dist/{orchestrator-B9kwlCep.d.ts → orchestrator-CmJ-NTdJ.d.ts} +254 -10
  224. package/dist/orchestrator.d.ts +6 -3
  225. package/dist/orchestrator.js +59 -48
  226. package/dist/page-versioning.d.ts +12 -1
  227. package/dist/page-versioning.js +5 -3
  228. package/dist/{port-C1GZFv8h.d.ts → port-BADbLZU5.d.ts} +2 -2
  229. package/dist/qmd-recall-cache.d.ts +1 -1
  230. package/dist/qmd.d.ts +5 -3
  231. package/dist/qmd.js +2 -1
  232. package/dist/reasoning-trace-recall.d.ts +90 -0
  233. package/dist/reasoning-trace-recall.js +13 -0
  234. package/dist/reasoning-trace-recall.js.map +1 -0
  235. package/dist/reasoning-trace-types.d.ts +54 -0
  236. package/dist/reasoning-trace-types.js +17 -0
  237. package/dist/reasoning-trace-types.js.map +1 -0
  238. package/dist/recall-audit-anomaly.d.ts +112 -0
  239. package/dist/recall-audit-anomaly.js +11 -0
  240. package/dist/recall-audit-anomaly.js.map +1 -0
  241. package/dist/recall-audit.js +5 -44
  242. package/dist/recall-audit.js.map +1 -1
  243. package/dist/recall-explain-renderer.d.ts +49 -0
  244. package/dist/recall-explain-renderer.js +18 -0
  245. package/dist/recall-explain-renderer.js.map +1 -0
  246. package/dist/recall-state.d.ts +39 -1
  247. package/dist/recall-state.js +1 -1
  248. package/dist/recall-xray-cli.d.ts +40 -0
  249. package/dist/recall-xray-cli.js +11 -0
  250. package/dist/recall-xray-cli.js.map +1 -0
  251. package/dist/recall-xray-renderer.d.ts +44 -0
  252. package/dist/recall-xray-renderer.js +18 -0
  253. package/dist/recall-xray-renderer.js.map +1 -0
  254. package/dist/recall-xray.d.ts +179 -0
  255. package/dist/recall-xray.js +13 -0
  256. package/dist/recall-xray.js.map +1 -0
  257. package/dist/resolution-QBTDHTG7.js +100 -0
  258. package/dist/resolution-QBTDHTG7.js.map +1 -0
  259. package/dist/resolve-provider-secret.d.ts +24 -1
  260. package/dist/resolve-provider-secret.js +3 -1
  261. package/dist/resume-bundles.js +6 -6
  262. package/dist/retrieval-agents.d.ts +1 -1
  263. package/dist/retrieval-tiers.d.ts +17 -0
  264. package/dist/retrieval-tiers.js +9 -0
  265. package/dist/retrieval-tiers.js.map +1 -0
  266. package/dist/schemas.d.ts +301 -45
  267. package/dist/schemas.js +1 -1
  268. package/dist/{semantic-consolidation-DrvSYRdB.d.ts → semantic-consolidation-CxJU6MJk.d.ts} +62 -1
  269. package/dist/semantic-consolidation.d.ts +2 -1
  270. package/dist/semantic-consolidation.js +20 -6
  271. package/dist/semantic-rule-promotion.js +6 -5
  272. package/dist/semantic-rule-verifier.js +6 -5
  273. package/dist/storage.d.ts +82 -1
  274. package/dist/storage.js +5 -4
  275. package/dist/summarizer.js +4 -4
  276. package/dist/temporal-supersession.d.ts +1 -0
  277. package/dist/tier-migration.d.ts +2 -1
  278. package/dist/types-DJhqDJUV.d.ts +50 -0
  279. package/dist/types.d.ts +309 -3
  280. package/dist/types.js +1 -1
  281. package/dist/verified-recall.js +6 -5
  282. package/package.json +1 -1
  283. package/dist/chunk-2VFW5K5U.js.map +0 -1
  284. package/dist/chunk-6ZH4TU6I.js.map +0 -1
  285. package/dist/chunk-7PA4OZEU.js.map +0 -1
  286. package/dist/chunk-AAI7JARD.js.map +0 -1
  287. package/dist/chunk-BKQJBXXX.js.map +0 -1
  288. package/dist/chunk-HITJFT7E.js.map +0 -1
  289. package/dist/chunk-J4IYOZZ5.js.map +0 -1
  290. package/dist/chunk-KEG4GNGI.js.map +0 -1
  291. package/dist/chunk-LAYN4LDC.js +0 -267
  292. package/dist/chunk-LAYN4LDC.js.map +0 -1
  293. package/dist/chunk-MTLYEMJB.js.map +0 -1
  294. package/dist/chunk-NSB3WSYS.js.map +0 -1
  295. package/dist/chunk-OJFGVJS6.js.map +0 -1
  296. package/dist/chunk-PAORGQRI.js.map +0 -1
  297. package/dist/chunk-PMB3WGDL.js.map +0 -1
  298. package/dist/chunk-POMSFKTB.js.map +0 -1
  299. package/dist/chunk-QDYXG4CS.js.map +0 -1
  300. package/dist/chunk-QKAH5B6E.js.map +0 -1
  301. package/dist/chunk-QNJMBKFK.js.map +0 -1
  302. package/dist/chunk-S4LX5EBI.js.map +0 -1
  303. package/dist/chunk-U2IQTSBY.js.map +0 -1
  304. package/dist/chunk-UEYA6UC7.js.map +0 -1
  305. package/dist/chunk-UPMD5XND.js.map +0 -1
  306. package/dist/chunk-UVJFDP7P.js +0 -202
  307. package/dist/chunk-UVJFDP7P.js.map +0 -1
  308. package/dist/chunk-V7XCAHIB.js.map +0 -1
  309. package/dist/chunk-X4WESCKA.js.map +0 -1
  310. package/dist/chunk-XMGSSBFX.js.map +0 -1
  311. package/dist/chunk-YFYL2SIJ.js.map +0 -1
  312. /package/dist/{engine-X7X3AAG3.js.map → abort-error.js.map} +0 -0
  313. /package/dist/{chunk-POBPGDWI.js.map → chunk-3OGMS3PE.js.map} +0 -0
  314. /package/dist/{chunk-GJQPH5G3.js.map → chunk-CUPFXL3J.js.map} +0 -0
  315. /package/dist/{chunk-74JR4N5J.js.map → chunk-FVA6TGI3.js.map} +0 -0
  316. /package/dist/{chunk-AYPYCLR7.js.map → chunk-KUB6JU6H.js.map} +0 -0
  317. /package/dist/{chunk-4NRAJUDS.js.map → chunk-RBBWYEFJ.js.map} +0 -0
  318. /package/dist/{chunk-JROGC36Y.js.map → chunk-RGLL5SPU.js.map} +0 -0
  319. /package/dist/{chunk-MYQWXITD.js.map → chunk-SPI27QT6.js.map} +0 -0
  320. /package/dist/{chunk-KWP7T3DP.js.map → chunk-VDX363PS.js.map} +0 -0
  321. /package/dist/{chunk-ECKDIK5F.js.map → chunk-WVVA7F5A.js.map} +0 -0
  322. /package/dist/{chunk-3QFQGRHO.js.map → chunk-XMHBH5H6.js.map} +0 -0
  323. /package/dist/{chunk-BTY5RRRF.js.map → chunk-ZEM3OK2K.js.map} +0 -0
@@ -26,106 +26,117 @@ import {
26
26
  sanitizeSessionKeyForFilename,
27
27
  shouldFilterLifecycleRecallCandidate,
28
28
  summarizeGraphShadowComparison
29
- } from "./chunk-XMGSSBFX.js";
30
- import "./chunk-JROGC36Y.js";
29
+ } from "./chunk-VYM3VWOF.js";
30
+ import "./chunk-RGLL5SPU.js";
31
+ import "./chunk-UHGBNIOS.js";
31
32
  import "./chunk-FSFEQI74.js";
32
33
  import "./chunk-W6SL7OFG.js";
33
34
  import "./chunk-Z5AAYHUC.js";
34
35
  import "./chunk-S75M5ZRK.js";
35
36
  import "./chunk-TPB3I2AC.js";
36
- import "./chunk-UHGBNIOS.js";
37
- import "./chunk-BTY5RRRF.js";
38
- import "./chunk-ETOW6ACV.js";
39
- import "./chunk-KVE7R4CG.js";
40
37
  import "./chunk-JR4ZC3G4.js";
38
+ import "./chunk-ZEM3OK2K.js";
39
+ import "./chunk-ETOW6ACV.js";
40
+ import "./chunk-5NPGSAVB.js";
41
41
  import "./chunk-C7VW7C3F.js";
42
42
  import "./chunk-K4FLSOR5.js";
43
43
  import "./chunk-V3RXWQIE.js";
44
44
  import "./chunk-5IZL4DCV.js";
45
+ import "./chunk-VBVG2M5G.js";
46
+ import "./chunk-KVBLZUKV.js";
47
+ import "./chunk-X7XN6YU4.js";
48
+ import "./chunk-ZZTOURJI.js";
45
49
  import "./chunk-YDBIWGNI.js";
46
50
  import "./chunk-7DHTMOND.js";
47
- import "./chunk-S4LX5EBI.js";
48
- import "./chunk-X7XN6YU4.js";
49
- import "./chunk-5NPGSAVB.js";
50
51
  import "./chunk-YCN4BVDK.js";
51
52
  import "./chunk-D654IBA6.js";
52
53
  import "./chunk-H63EDPFJ.js";
53
- import "./chunk-BKQJBXXX.js";
54
+ import "./chunk-3GPTTA4J.js";
55
+ import "./chunk-IISBCCWR.js";
56
+ import "./chunk-GGD5W7TB.js";
54
57
  import "./chunk-YAZNBMNF.js";
55
- import "./chunk-ALXMCZEU.js";
56
- import "./chunk-74JR4N5J.js";
57
- import "./chunk-LAYN4LDC.js";
58
- import "./chunk-2VFW5K5U.js";
59
- import "./chunk-UEYA6UC7.js";
58
+ import "./chunk-AJU4PJGY.js";
59
+ import "./chunk-DF3RVK3X.js";
60
+ import "./chunk-C4SQJZAF.js";
61
+ import "./chunk-S3EEFKNY.js";
62
+ import "./chunk-NZLQTHS5.js";
63
+ import "./chunk-54V4BZWP.js";
60
64
  import "./chunk-NBNN5GOB.js";
61
- import "./chunk-UPMD5XND.js";
62
65
  import "./chunk-FEMOX5AD.js";
66
+ import "./chunk-JL2PU6AI.js";
63
67
  import "./chunk-VEWZZM3H.js";
64
- import "./chunk-PAORGQRI.js";
68
+ import "./chunk-6AUUAZEX.js";
69
+ import "./chunk-Y4FHOFJ2.js";
70
+ import "./chunk-ALXMCZEU.js";
71
+ import "./chunk-FVA6TGI3.js";
72
+ import "./chunk-GZCUW5IC.js";
73
+ import "./chunk-EPQJM2GC.js";
65
74
  import "./chunk-PYXS46O7.js";
66
75
  import "./chunk-3QKK7QOS.js";
67
- import "./chunk-GJQPH5G3.js";
76
+ import "./chunk-CUPFXL3J.js";
68
77
  import "./chunk-JRNQ3RNA.js";
69
- import "./chunk-MYQWXITD.js";
78
+ import "./chunk-SPI27QT6.js";
70
79
  import "./chunk-CULXMQJH.js";
71
80
  import "./chunk-E6K4NIEU.js";
81
+ import "./chunk-7I7FKFZH.js";
82
+ import "./chunk-YRMVARQP.js";
83
+ import "./chunk-YNQKWQT4.js";
72
84
  import "./chunk-EABGC2TL.js";
73
85
  import "./chunk-LOBRX7VD.js";
74
- import "./chunk-HITJFT7E.js";
75
- import "./chunk-YRMVARQP.js";
76
- import "./chunk-7PA4OZEU.js";
77
- import "./chunk-J4IYOZZ5.js";
78
- import "./chunk-AAI7JARD.js";
86
+ import "./chunk-HMDCOMYU.js";
87
+ import "./chunk-JXS5PDQ7.js";
88
+ import "./chunk-LK6SGL53.js";
79
89
  import "./chunk-7SEAZFFB.js";
80
90
  import "./chunk-K6WK37A6.js";
81
- import "./chunk-LK6SGL53.js";
82
- import "./chunk-3PG3H5TD.js";
83
- import "./chunk-FYIYMQ5N.js";
84
- import "./chunk-2NMMFZ5T.js";
85
91
  import "./chunk-Z5LAYHGJ.js";
86
92
  import "./chunk-C6QPK5GG.js";
87
- import "./chunk-GZCUW5IC.js";
88
- import "./chunk-RCICHSHL.js";
89
- import "./chunk-EJI5XIBB.js";
90
93
  import "./chunk-C2EFFULQ.js";
94
+ import "./chunk-3PG3H5TD.js";
95
+ import "./chunk-FYIYMQ5N.js";
96
+ import "./chunk-2NMMFZ5T.js";
97
+ import "./chunk-KVE7R4CG.js";
91
98
  import "./chunk-4WMCPJWX.js";
99
+ import "./chunk-JBMSGZEQ.js";
100
+ import "./chunk-BGJGXLZ7.js";
101
+ import "./chunk-EJI5XIBB.js";
102
+ import "./chunk-3GXCSUXR.js";
103
+ import "./chunk-XZ2TIKGC.js";
104
+ import "./chunk-ODWDQNRE.js";
105
+ import "./chunk-Y27UJK6V.js";
106
+ import "./chunk-UZB5KHKX.js";
92
107
  import "./chunk-6HZ6AO2P.js";
93
108
  import "./chunk-JWPLJLDU.js";
94
109
  import "./chunk-N53K2EXC.js";
95
- import "./chunk-URB2WSKZ.js";
96
- import "./chunk-UVJFDP7P.js";
97
110
  import "./chunk-XYIK4LF6.js";
98
- import "./chunk-QKAH5B6E.js";
99
- import "./chunk-KEG4GNGI.js";
100
- import "./chunk-ODWDQNRE.js";
101
- import "./chunk-Y27UJK6V.js";
102
- import "./chunk-UZB5KHKX.js";
111
+ import "./chunk-URB2WSKZ.js";
112
+ import "./chunk-PVGDJXVK.js";
103
113
  import "./chunk-NGAVDO7E.js";
104
114
  import "./chunk-MARWOCVP.js";
105
115
  import "./chunk-EQINRHYR.js";
106
- import "./chunk-QDYXG4CS.js";
107
- import "./chunk-QNJMBKFK.js";
108
116
  import "./chunk-EEQLFRUM.js";
109
117
  import "./chunk-QDW3E4RD.js";
110
- import "./chunk-4NRAJUDS.js";
118
+ import "./chunk-3FPTCC3Z.js";
119
+ import "./chunk-2LGMW3DJ.js";
120
+ import "./chunk-RBBWYEFJ.js";
111
121
  import "./chunk-DT5TVLJE.js";
122
+ import "./chunk-N5AKDXAI.js";
112
123
  import "./chunk-TBBDFYXW.js";
113
- import "./chunk-DGXUHMOV.js";
114
- import "./chunk-LPSF4OQH.js";
115
- import "./chunk-POMSFKTB.js";
116
- import "./chunk-U2IQTSBY.js";
124
+ import "./chunk-F5VP6YCB.js";
125
+ import "./chunk-LTCGGW2D.js";
117
126
  import "./chunk-4KAN3GZ3.js";
118
- import "./chunk-6ZH4TU6I.js";
119
127
  import "./chunk-6PFRXT4K.js";
120
128
  import "./chunk-TP4FZJIZ.js";
121
129
  import "./chunk-SCU65EZI.js";
122
130
  import "./chunk-BOUYNNYD.js";
123
- import "./chunk-QSVPYQPG.js";
124
131
  import "./chunk-DM2T26WE.js";
132
+ import "./chunk-QSVPYQPG.js";
125
133
  import "./chunk-M62O4P4T.js";
126
134
  import "./chunk-4DJQYKMN.js";
135
+ import "./chunk-X6GF3FX2.js";
136
+ import "./chunk-FAAFWE4G.js";
127
137
  import "./chunk-2ODBA7MQ.js";
128
- import "./chunk-N5AKDXAI.js";
138
+ import "./chunk-DGXUHMOV.js";
139
+ import "./chunk-LPSF4OQH.js";
129
140
  export {
130
141
  Orchestrator,
131
142
  appendMemoryToGraphContext,
@@ -38,6 +38,17 @@ interface VersioningLogger {
38
38
  debug(msg: string): void;
39
39
  warn(msg: string): void;
40
40
  }
41
+ /**
42
+ * Derive a filesystem-safe sidecar key from a page path relative to memoryDir.
43
+ *
44
+ * `facts/2026-01-15/pref-001.md` -> `facts__2026-01-15__pref-001`
45
+ *
46
+ * Exported so the `remnic doctor` consolidation-provenance check (issue
47
+ * #561 PR 4) resolves snapshot locations using the canonical algorithm
48
+ * without re-implementing it — preventing silent drift if the key
49
+ * format ever changes.
50
+ */
51
+ declare function sidecarKey(pagePath: string): string;
41
52
  /**
42
53
  * Create a new version snapshot for a page.
43
54
  *
@@ -74,4 +85,4 @@ declare function revertToVersion(pagePath: string, versionId: string, config: Ve
74
85
  */
75
86
  declare function diffVersions(pagePath: string, v1: string, v2: string, config: VersioningConfig, memoryDir?: string): Promise<string>;
76
87
 
77
- export { type PageVersion, type VersionHistory, type VersionTrigger, type VersioningConfig, type VersioningLogger, createVersion, diffVersions, getVersion, listVersions, revertToVersion };
88
+ export { type PageVersion, type VersionHistory, type VersionTrigger, type VersioningConfig, type VersioningLogger, createVersion, diffVersions, getVersion, listVersions, revertToVersion, sidecarKey };
@@ -3,13 +3,15 @@ import {
3
3
  diffVersions,
4
4
  getVersion,
5
5
  listVersions,
6
- revertToVersion
7
- } from "./chunk-6ZH4TU6I.js";
6
+ revertToVersion,
7
+ sidecarKey
8
+ } from "./chunk-FAAFWE4G.js";
8
9
  export {
9
10
  createVersion,
10
11
  diffVersions,
11
12
  getVersion,
12
13
  listVersions,
13
- revertToVersion
14
+ revertToVersion,
15
+ sidecarKey
14
16
  };
15
17
  //# sourceMappingURL=page-versioning.js.map
@@ -31,8 +31,8 @@ interface SearchBackend {
31
31
  bm25Search(query: string, collection?: string, maxResults?: number, execution?: SearchExecutionOptions): Promise<SearchResult[]>;
32
32
  vectorSearch(query: string, collection?: string, maxResults?: number, execution?: SearchExecutionOptions): Promise<SearchResult[]>;
33
33
  hybridSearch(query: string, collection?: string, maxResults?: number, execution?: SearchExecutionOptions): Promise<SearchResult[]>;
34
- update(): Promise<void>;
35
- updateCollection(collection: string): Promise<void>;
34
+ update(execution?: SearchExecutionOptions): Promise<void>;
35
+ updateCollection(collection: string, execution?: SearchExecutionOptions): Promise<void>;
36
36
  embed(): Promise<void>;
37
37
  embedCollection(collection: string): Promise<void>;
38
38
  ensureCollection(memoryDir: string): Promise<"present" | "missing" | "unknown" | "skipped">;
@@ -1,5 +1,5 @@
1
1
  import { RecallPlanMode } from './types.js';
2
- import { a as SearchQueryOptions } from './port-C1GZFv8h.js';
2
+ import { a as SearchQueryOptions } from './port-BADbLZU5.js';
3
3
 
4
4
  type QmdRecallCacheSource = "fresh" | "stale";
5
5
  interface QmdRecallCacheHit<T> {
package/dist/qmd.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { QmdSearchResult, QmdSearchExplain } from './types.js';
2
- import { S as SearchBackend, a as SearchQueryOptions, b as SearchExecutionOptions } from './port-C1GZFv8h.js';
2
+ import { S as SearchBackend, a as SearchQueryOptions, b as SearchExecutionOptions } from './port-BADbLZU5.js';
3
3
 
4
4
  interface QmdClientOptions {
5
5
  slowLog?: {
@@ -32,6 +32,7 @@ declare class QmdClient implements SearchBackend {
32
32
  private lastCliProbeError;
33
33
  private daemonSession;
34
34
  private daemonAvailable;
35
+ private daemonSessionPath;
35
36
  private lastDaemonCheckAtMs;
36
37
  private readonly daemonEnabled;
37
38
  private readonly daemonRecheckIntervalMs;
@@ -50,6 +51,7 @@ declare class QmdClient implements SearchBackend {
50
51
  /** Debug string for troubleshooting availability issues. */
51
52
  debugStatus(): string;
52
53
  isDaemonMode(): boolean;
54
+ dispose(): void;
53
55
  /**
54
56
  * Record a daemon search success — resets the transient failure counter.
55
57
  */
@@ -97,8 +99,8 @@ declare class QmdClient implements SearchBackend {
97
99
  private bm25SearchViaSubprocess;
98
100
  private vsearchViaSubprocess;
99
101
  private searchGlobalViaSubprocess;
100
- update(signal?: AbortSignal): Promise<void>;
101
- updateCollection(collection: string): Promise<void>;
102
+ update(execution?: SearchExecutionOptions): Promise<void>;
103
+ updateCollection(collection: string, execution?: SearchExecutionOptions): Promise<void>;
102
104
  private runUpdateForCollection;
103
105
  embed(): Promise<void>;
104
106
  embedCollection(collection: string): Promise<void>;
package/dist/qmd.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import {
2
2
  QmdClient,
3
3
  parseQmdExplain
4
- } from "./chunk-7PA4OZEU.js";
4
+ } from "./chunk-YNQKWQT4.js";
5
5
  import "./chunk-LK6SGL53.js";
6
+ import "./chunk-PVGDJXVK.js";
6
7
  import "./chunk-MARWOCVP.js";
7
8
  import "./chunk-6PFRXT4K.js";
8
9
  import "./chunk-2ODBA7MQ.js";
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Reasoning-trace recall boost (issue #564 PR 3).
3
+ *
4
+ * Pure helpers for:
5
+ * - detecting whether a user query looks like a problem-solving ask
6
+ * ("how do I…", "step by step", etc.)
7
+ * - boosting stored reasoning_trace memories within a result list when that
8
+ * condition matches.
9
+ *
10
+ * Callers gate these helpers behind the `recallReasoningTraceBoostEnabled`
11
+ * config flag (default false); the helpers themselves are also no-ops when
12
+ * `enabled` is false so they can be safely chained into the recall pipeline.
13
+ */
14
+ /**
15
+ * Heuristic: does the incoming query read like the user wants a stored
16
+ * solution chain (reasoning trace)?
17
+ *
18
+ * Positive signals:
19
+ * - starts with "how do I", "how can I", "how would I", "how to"
20
+ * - contains "step by step", "walk me through", "work through"
21
+ * - contains "reasoning", "think through", "figure out", "debug"
22
+ * - explicitly mentions "trace" or "chain of thought"
23
+ *
24
+ * This is intentionally conservative — the boost is OFF by default, so false
25
+ * negatives are cheap, but false positives would shift retrieval for ordinary
26
+ * queries on an opt-in install.
27
+ */
28
+ declare function looksLikeProblemSolvingQuery(query: string): boolean;
29
+ /**
30
+ * Minimal shape the boost helper needs to read from a recall result. Matches
31
+ * QmdSearchResult as of issue #564 but kept structural so tests and future
32
+ * callers don't have to import orchestrator-level types.
33
+ */
34
+ interface BoostableResult {
35
+ path: string;
36
+ score: number;
37
+ docid?: string;
38
+ }
39
+ /**
40
+ * Path-based marker for memories that live in the dedicated
41
+ * reasoning-traces/ subtree. Using a path segment keeps this cheap: no
42
+ * frontmatter parsing or extra I/O is needed.
43
+ */
44
+ declare function isReasoningTracePath(candidatePath: string): boolean;
45
+ /**
46
+ * Default additive boost applied to a reasoning_trace candidate when the
47
+ * current query looks like a problem-solving ask.
48
+ *
49
+ * Chosen to be roughly the same magnitude as the existing CATEGORY_BOOSTS
50
+ * entry for reasoning_trace (0.09 in importance scoring), keeping the signal
51
+ * visible but not overwhelming stronger lexical/vector matches.
52
+ */
53
+ declare const DEFAULT_REASONING_TRACE_BOOST = 0.15;
54
+ interface ApplyReasoningTraceBoostOptions {
55
+ enabled: boolean;
56
+ query: string;
57
+ boost?: number;
58
+ }
59
+ /**
60
+ * Apply a score boost to results whose path sits under reasoning-traces/
61
+ * when the query looks like a problem-solving ask. Returns a new array;
62
+ * the input array is not mutated.
63
+ *
64
+ * Ordering policy: the helper walks the results in order, boosts every
65
+ * matching reasoning trace in place, then promotes each boosted trace
66
+ * upward PAST any non-boosted neighbor whose score is strictly lower
67
+ * than the trace's boosted score. Non-matching results keep their
68
+ * incoming relative order — so reranker-driven path ordering and any
69
+ * other upstream nudges on non-trace items are preserved. We do NOT
70
+ * re-sort the full list, which would wipe out rerank priority on
71
+ * non-trace items (whose numeric scores may have been left stale by the
72
+ * rerank pass). This matters because MMR runs immediately after and
73
+ * truncates to a topN window — globally re-sorting would silently drop
74
+ * reranker-promoted items below the cutoff.
75
+ *
76
+ * No-ops (returns a copy of the input unchanged) when:
77
+ * - `enabled` is false,
78
+ * - `query` is empty / not a problem-solving ask,
79
+ * - the result list contains no reasoning-trace paths.
80
+ *
81
+ * Note on legacy paths: this helper intentionally only matches paths
82
+ * under the dedicated `reasoning-traces/` subtree introduced by PR 3.
83
+ * Historical reasoning_trace memories (if any) written before that
84
+ * subtree existed were routed to `facts/<date>/` and are NOT
85
+ * boost-eligible. Operators upgrading across that boundary should run
86
+ * the migration CLI or rewrite old paths before enabling the boost.
87
+ */
88
+ declare function applyReasoningTraceBoost<R extends BoostableResult>(results: readonly R[], options: ApplyReasoningTraceBoostOptions): R[];
89
+
90
+ export { type ApplyReasoningTraceBoostOptions, type BoostableResult, DEFAULT_REASONING_TRACE_BOOST, applyReasoningTraceBoost, isReasoningTracePath, looksLikeProblemSolvingQuery };
@@ -0,0 +1,13 @@
1
+ import {
2
+ DEFAULT_REASONING_TRACE_BOOST,
3
+ applyReasoningTraceBoost,
4
+ isReasoningTracePath,
5
+ looksLikeProblemSolvingQuery
6
+ } from "./chunk-ZZTOURJI.js";
7
+ export {
8
+ DEFAULT_REASONING_TRACE_BOOST,
9
+ applyReasoningTraceBoost,
10
+ isReasoningTracePath,
11
+ looksLikeProblemSolvingQuery
12
+ };
13
+ //# sourceMappingURL=reasoning-trace-recall.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Reasoning-trace memory structural types (issue #564).
3
+ *
4
+ * Captures stored solution chains / chain-of-thought the user walked through
5
+ * to solve a problem. Traces have an ordered list of steps, a final answer,
6
+ * and an optional observed outcome.
7
+ */
8
+ interface ReasoningTraceStep {
9
+ /** 1-based ordinal within the trace. */
10
+ order: number;
11
+ /** Human-readable description of what happened at this step. */
12
+ description: string;
13
+ }
14
+ interface ReasoningTraceStructuredData {
15
+ steps: ReasoningTraceStep[];
16
+ finalAnswer: string;
17
+ /** Optional confirmation of how the answer played out in practice. */
18
+ observedOutcome?: string;
19
+ }
20
+ /** Normalize loose extraction JSON into ReasoningTraceStep records. */
21
+ declare function normalizeReasoningTraceSteps(raw: unknown): ReasoningTraceStep[];
22
+ /**
23
+ * Normalize a loose reasoningTrace object (e.g. coming back from the LLM) to
24
+ * a strict ReasoningTraceStructuredData shape. Returns null when the data is
25
+ * clearly incomplete (no steps or no final answer).
26
+ */
27
+ declare function normalizeReasoningTrace(raw: unknown): ReasoningTraceStructuredData | null;
28
+ /**
29
+ * Serialize a normalized reasoning trace into a human-readable markdown body.
30
+ * Output shape mirrors the procedure body format: ## Step N sections followed
31
+ * by final answer and optional observed outcome.
32
+ */
33
+ declare function buildReasoningTraceMarkdownBody(trace: ReasoningTraceStructuredData): string;
34
+ /**
35
+ * Combine a short title with the structured trace body. The title becomes the
36
+ * one-line content of the stored memory, and the full body is appended below.
37
+ */
38
+ declare function buildReasoningTracePersistBody(title: string, trace: ReasoningTraceStructuredData): string;
39
+ /**
40
+ * Best-effort parse of a reasoning-trace markdown body back into structured
41
+ * data. Returns null when the document does not look like a reasoning trace.
42
+ */
43
+ declare function parseReasoningTraceFromBody(content: string): ReasoningTraceStructuredData | null;
44
+ /**
45
+ * Heuristic detector for whether a user message contains a chain-of-thought /
46
+ * solution trace that should be extracted. This is intentionally conservative:
47
+ * we require at least two explicitly-ordered steps and some form of final
48
+ * answer / resolution. Used by the extraction pipeline to decide whether to
49
+ * even consider emitting a reasoning_trace fact, so false positives are more
50
+ * costly than false negatives.
51
+ */
52
+ declare function looksLikeReasoningTrace(message: string): boolean;
53
+
54
+ export { type ReasoningTraceStep, type ReasoningTraceStructuredData, buildReasoningTraceMarkdownBody, buildReasoningTracePersistBody, looksLikeReasoningTrace, normalizeReasoningTrace, normalizeReasoningTraceSteps, parseReasoningTraceFromBody };
@@ -0,0 +1,17 @@
1
+ import {
2
+ buildReasoningTraceMarkdownBody,
3
+ buildReasoningTracePersistBody,
4
+ looksLikeReasoningTrace,
5
+ normalizeReasoningTrace,
6
+ normalizeReasoningTraceSteps,
7
+ parseReasoningTraceFromBody
8
+ } from "./chunk-54V4BZWP.js";
9
+ export {
10
+ buildReasoningTraceMarkdownBody,
11
+ buildReasoningTracePersistBody,
12
+ looksLikeReasoningTrace,
13
+ normalizeReasoningTrace,
14
+ normalizeReasoningTraceSteps,
15
+ parseReasoningTraceFromBody
16
+ };
17
+ //# sourceMappingURL=reasoning-trace-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,112 @@
1
+ import { RecallAuditEntry } from './recall-audit.js';
2
+
3
+ /**
4
+ * Recall-audit anomaly detector (issue #565 PR 5/5).
5
+ *
6
+ * Given a sequence of `RecallAuditEntry` records for a single principal /
7
+ * session, classify the series and emit `AnomalyFlag`s for suspicious
8
+ * patterns. Intended to run on both:
9
+ *
10
+ * 1. The MCP / HTTP access layers — every `recall` / `memory_search` /
11
+ * `memory_timeline` call appends an audit entry and the detector is
12
+ * invoked against the tail of the series (streaming mode).
13
+ * 2. The existing Openclaw hook (already writes `transcripts/*.jsonl`) —
14
+ * the detector can be invoked out-of-band over the same entries.
15
+ *
16
+ * See the threat model §5 (gap: recall-audit was only on the Openclaw
17
+ * hook) and §6.3 (anomaly signals) for the patterns below.
18
+ *
19
+ * The module is pure: no I/O, no clock. Callers pass the entries +
20
+ * configured thresholds; the detector returns a deterministic classification.
21
+ *
22
+ * Patterns detected:
23
+ *
24
+ * - `repeat-query` — the same normalized query text issued more than N
25
+ * times in the window. Covers the ADAM "exploitation" phase where the
26
+ * attacker re-queries a high-signal token until it plateaus.
27
+ * - `namespace-walk` — the same principal's queries visit more than N
28
+ * distinct candidate memory namespaces in the window. Suggests the
29
+ * attacker is enumerating the namespace tree for leaks.
30
+ * - `high-cardinality-return` — a single recall surfaced more than N
31
+ * candidate memory IDs in one response. Covers the "one query, dump
32
+ * everything" exfiltration path.
33
+ * - `rapid-fire` — more than N recalls in the window irrespective of
34
+ * content. Blunt instrument; useful when nothing else fires.
35
+ *
36
+ * Each flag carries the entry indices that support it so an audit UI can
37
+ * highlight the underlying evidence.
38
+ */
39
+
40
+ type AnomalyKind = "repeat-query" | "namespace-walk" | "high-cardinality-return" | "rapid-fire";
41
+ type AnomalySeverity = "info" | "warn" | "alert";
42
+ interface AnomalyFlag {
43
+ kind: AnomalyKind;
44
+ severity: AnomalySeverity;
45
+ /** Human-readable rationale, e.g. `"query 'alex' repeated 12 times in 60s"`. */
46
+ message: string;
47
+ /** Indices into the supplied `entries` array that triggered the flag. */
48
+ entryIndices: number[];
49
+ /**
50
+ * Optional extra signal the caller can use to key metrics. For
51
+ * `repeat-query` this is the normalized query text; for
52
+ * `namespace-walk` it is the namespace count; etc.
53
+ */
54
+ signal?: string | number;
55
+ }
56
+ interface AnomalyDetectorConfig {
57
+ /** Detector feature-flag. Defaults to false — ships disabled. */
58
+ enabled?: boolean;
59
+ /**
60
+ * Rolling window in ms. The detector only considers entries whose `ts`
61
+ * falls within `[now - windowMs, now]`. Default 5 minutes.
62
+ */
63
+ windowMs?: number;
64
+ /**
65
+ * Threshold for `repeat-query`: a normalized query repeated more than
66
+ * this many times in the window trips the flag. Default 5.
67
+ */
68
+ repeatQueryLimit?: number;
69
+ /**
70
+ * Threshold for `namespace-walk`: more than this many distinct
71
+ * candidate namespaces in the window trips the flag. Default 3.
72
+ */
73
+ namespaceWalkLimit?: number;
74
+ /**
75
+ * Threshold for `high-cardinality-return`: more than this many
76
+ * `candidateMemoryIds` in a single entry trips the flag. Default 50.
77
+ */
78
+ highCardinalityReturnLimit?: number;
79
+ /**
80
+ * Threshold for `rapid-fire`: more than this many entries in the
81
+ * window trips the flag. Default 30. (Matches the default
82
+ * `recallCrossNamespaceBudgetHardLimit` from PR 4.)
83
+ */
84
+ rapidFireLimit?: number;
85
+ }
86
+ declare const DEFAULT_ANOMALY_DETECTOR_CONFIG: Required<AnomalyDetectorConfig>;
87
+ interface AnomalyDetectorInput {
88
+ entries: readonly RecallAuditEntry[];
89
+ /** Current time in epoch ms. Entries older than `now - windowMs` are ignored. */
90
+ now: number;
91
+ config?: AnomalyDetectorConfig;
92
+ }
93
+ interface AnomalyDetectorResult {
94
+ /** All flags ordered by descending severity then kind. */
95
+ flags: AnomalyFlag[];
96
+ /** Number of entries inside the active window (after filtering). */
97
+ windowEntryCount: number;
98
+ /** Window size actually used, in ms. */
99
+ windowMs: number;
100
+ }
101
+ /**
102
+ * Normalize query text so cosmetic variation doesn't defeat the
103
+ * repeat-query detector. Lowercase, collapse whitespace, trim.
104
+ */
105
+ declare function normalizeQueryText(raw: string): string;
106
+ /**
107
+ * Run the detector against a series of audit entries. Pure; no side
108
+ * effects.
109
+ */
110
+ declare function detectRecallAnomalies(input: AnomalyDetectorInput): AnomalyDetectorResult;
111
+
112
+ export { type AnomalyDetectorConfig, type AnomalyDetectorInput, type AnomalyDetectorResult, type AnomalyFlag, type AnomalyKind, type AnomalySeverity, DEFAULT_ANOMALY_DETECTOR_CONFIG, detectRecallAnomalies, normalizeQueryText };
@@ -0,0 +1,11 @@
1
+ import {
2
+ DEFAULT_ANOMALY_DETECTOR_CONFIG,
3
+ detectRecallAnomalies,
4
+ normalizeQueryText
5
+ } from "./chunk-RFYAYKTD.js";
6
+ export {
7
+ DEFAULT_ANOMALY_DETECTOR_CONFIG,
8
+ detectRecallAnomalies,
9
+ normalizeQueryText
10
+ };
11
+ //# sourceMappingURL=recall-audit-anomaly.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,47 +1,8 @@
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
- }
1
+ import {
2
+ appendRecallAuditEntry,
3
+ buildRecallAuditPath,
4
+ pruneRecallAuditEntries
5
+ } from "./chunk-LBLXEFWK.js";
45
6
  export {
46
7
  appendRecallAuditEntry,
47
8
  buildRecallAuditPath,
@@ -1 +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":[]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}