@remnic/core 1.0.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 (551) hide show
  1. package/dist/abstraction-nodes.d.ts +52 -0
  2. package/dist/abstraction-nodes.js +15 -0
  3. package/dist/abstraction-nodes.js.map +1 -0
  4. package/dist/access-cli.d.ts +5 -0
  5. package/dist/access-cli.js +308 -0
  6. package/dist/access-cli.js.map +1 -0
  7. package/dist/access-http.d.ts +158 -0
  8. package/dist/access-http.js +32 -0
  9. package/dist/access-http.js.map +1 -0
  10. package/dist/access-idempotency.d.ts +31 -0
  11. package/dist/access-idempotency.js +11 -0
  12. package/dist/access-idempotency.js.map +1 -0
  13. package/dist/access-mcp.d.ts +76 -0
  14. package/dist/access-mcp.js +8 -0
  15. package/dist/access-mcp.js.map +1 -0
  16. package/dist/access-schema.d.ts +266 -0
  17. package/dist/access-schema.js +29 -0
  18. package/dist/access-schema.js.map +1 -0
  19. package/dist/access-service.d.ts +614 -0
  20. package/dist/access-service.js +32 -0
  21. package/dist/access-service.js.map +1 -0
  22. package/dist/behavior-learner.d.ts +16 -0
  23. package/dist/behavior-learner.js +124 -0
  24. package/dist/behavior-learner.js.map +1 -0
  25. package/dist/behavior-signals.d.ts +15 -0
  26. package/dist/behavior-signals.js +11 -0
  27. package/dist/behavior-signals.js.map +1 -0
  28. package/dist/bootstrap.d.ts +46 -0
  29. package/dist/bootstrap.js +9 -0
  30. package/dist/bootstrap.js.map +1 -0
  31. package/dist/boxes.d.ts +93 -0
  32. package/dist/boxes.js +14 -0
  33. package/dist/boxes.js.map +1 -0
  34. package/dist/buffer.d.ts +22 -0
  35. package/dist/buffer.js +9 -0
  36. package/dist/buffer.js.map +1 -0
  37. package/dist/calibration.d.ts +81 -0
  38. package/dist/calibration.js +239 -0
  39. package/dist/calibration.js.map +1 -0
  40. package/dist/causal-behavior.d.ts +79 -0
  41. package/dist/causal-behavior.js +190 -0
  42. package/dist/causal-behavior.js.map +1 -0
  43. package/dist/causal-chain.d.ts +61 -0
  44. package/dist/causal-chain.js +24 -0
  45. package/dist/causal-chain.js.map +1 -0
  46. package/dist/causal-consolidation.d.ts +71 -0
  47. package/dist/causal-consolidation.js +211 -0
  48. package/dist/causal-consolidation.js.map +1 -0
  49. package/dist/causal-retrieval.d.ts +44 -0
  50. package/dist/causal-retrieval.js +184 -0
  51. package/dist/causal-retrieval.js.map +1 -0
  52. package/dist/causal-trajectory-graph.d.ts +13 -0
  53. package/dist/causal-trajectory-graph.js +59 -0
  54. package/dist/causal-trajectory-graph.js.map +1 -0
  55. package/dist/causal-trajectory.d.ts +68 -0
  56. package/dist/causal-trajectory.js +18 -0
  57. package/dist/causal-trajectory.js.map +1 -0
  58. package/dist/chunk-2CJCWDMR.js +87 -0
  59. package/dist/chunk-2CJCWDMR.js.map +1 -0
  60. package/dist/chunk-2NMMFZ5T.js +216 -0
  61. package/dist/chunk-2NMMFZ5T.js.map +1 -0
  62. package/dist/chunk-2PO5ZRKV.js +103 -0
  63. package/dist/chunk-2PO5ZRKV.js.map +1 -0
  64. package/dist/chunk-3QKK7QOS.js +154 -0
  65. package/dist/chunk-3QKK7QOS.js.map +1 -0
  66. package/dist/chunk-3SLRNYNG.js +26 -0
  67. package/dist/chunk-3SLRNYNG.js.map +1 -0
  68. package/dist/chunk-4A24LIM2.js +68 -0
  69. package/dist/chunk-4A24LIM2.js.map +1 -0
  70. package/dist/chunk-6HZ6AO2P.js +164 -0
  71. package/dist/chunk-6HZ6AO2P.js.map +1 -0
  72. package/dist/chunk-763GUIOU.js +302 -0
  73. package/dist/chunk-763GUIOU.js.map +1 -0
  74. package/dist/chunk-AAI7JARD.js +173 -0
  75. package/dist/chunk-AAI7JARD.js.map +1 -0
  76. package/dist/chunk-B7LOFDVE.js +112 -0
  77. package/dist/chunk-B7LOFDVE.js.map +1 -0
  78. package/dist/chunk-BDFZXRSO.js +318 -0
  79. package/dist/chunk-BDFZXRSO.js.map +1 -0
  80. package/dist/chunk-BOUYNNYD.js +707 -0
  81. package/dist/chunk-BOUYNNYD.js.map +1 -0
  82. package/dist/chunk-BRK4ODMI.js +60 -0
  83. package/dist/chunk-BRK4ODMI.js.map +1 -0
  84. package/dist/chunk-C6QPK5GG.js +111 -0
  85. package/dist/chunk-C6QPK5GG.js.map +1 -0
  86. package/dist/chunk-C7VW7C3F.js +117 -0
  87. package/dist/chunk-C7VW7C3F.js.map +1 -0
  88. package/dist/chunk-CDW777AI.js +621 -0
  89. package/dist/chunk-CDW777AI.js.map +1 -0
  90. package/dist/chunk-CULXMQJH.js +185 -0
  91. package/dist/chunk-CULXMQJH.js.map +1 -0
  92. package/dist/chunk-CXWFUJR2.js +1203 -0
  93. package/dist/chunk-CXWFUJR2.js.map +1 -0
  94. package/dist/chunk-DGXUHMOV.js +61 -0
  95. package/dist/chunk-DGXUHMOV.js.map +1 -0
  96. package/dist/chunk-DM2T26WE.js +61 -0
  97. package/dist/chunk-DM2T26WE.js.map +1 -0
  98. package/dist/chunk-DORBM6OB.js +81 -0
  99. package/dist/chunk-DORBM6OB.js.map +1 -0
  100. package/dist/chunk-DT5TVLJE.js +32 -0
  101. package/dist/chunk-DT5TVLJE.js.map +1 -0
  102. package/dist/chunk-EEQLFRUM.js +89 -0
  103. package/dist/chunk-EEQLFRUM.js.map +1 -0
  104. package/dist/chunk-EQINRHYR.js +672 -0
  105. package/dist/chunk-EQINRHYR.js.map +1 -0
  106. package/dist/chunk-ESSMF2FR.js +146 -0
  107. package/dist/chunk-ESSMF2FR.js.map +1 -0
  108. package/dist/chunk-ETOW6ACV.js +158 -0
  109. package/dist/chunk-ETOW6ACV.js.map +1 -0
  110. package/dist/chunk-FYIYMQ5N.js +221 -0
  111. package/dist/chunk-FYIYMQ5N.js.map +1 -0
  112. package/dist/chunk-G3AG3KZN.js +78 -0
  113. package/dist/chunk-G3AG3KZN.js.map +1 -0
  114. package/dist/chunk-GJR6D6KC.js +61 -0
  115. package/dist/chunk-GJR6D6KC.js.map +1 -0
  116. package/dist/chunk-GPGBSNKM.js +380 -0
  117. package/dist/chunk-GPGBSNKM.js.map +1 -0
  118. package/dist/chunk-H63EDPFJ.js +57 -0
  119. package/dist/chunk-H63EDPFJ.js.map +1 -0
  120. package/dist/chunk-HG2NKWR2.js +185 -0
  121. package/dist/chunk-HG2NKWR2.js.map +1 -0
  122. package/dist/chunk-HL4DB7TO.js +13 -0
  123. package/dist/chunk-HL4DB7TO.js.map +1 -0
  124. package/dist/chunk-HLBYLYRD.js +346 -0
  125. package/dist/chunk-HLBYLYRD.js.map +1 -0
  126. package/dist/chunk-HLXVTBF3.js +109 -0
  127. package/dist/chunk-HLXVTBF3.js.map +1 -0
  128. package/dist/chunk-IFFFR3MR.js +68 -0
  129. package/dist/chunk-IFFFR3MR.js.map +1 -0
  130. package/dist/chunk-ISY75RLM.js +1027 -0
  131. package/dist/chunk-ISY75RLM.js.map +1 -0
  132. package/dist/chunk-IZME7KW2.js +1886 -0
  133. package/dist/chunk-IZME7KW2.js.map +1 -0
  134. package/dist/chunk-J3BT33K7.js +720 -0
  135. package/dist/chunk-J3BT33K7.js.map +1 -0
  136. package/dist/chunk-J47FNDR7.js +113 -0
  137. package/dist/chunk-J47FNDR7.js.map +1 -0
  138. package/dist/chunk-JWPLJLDU.js +63 -0
  139. package/dist/chunk-JWPLJLDU.js.map +1 -0
  140. package/dist/chunk-K6WK37A6.js +865 -0
  141. package/dist/chunk-K6WK37A6.js.map +1 -0
  142. package/dist/chunk-KL4CP4SB.js +130 -0
  143. package/dist/chunk-KL4CP4SB.js.map +1 -0
  144. package/dist/chunk-KT4NEUNF.js +315 -0
  145. package/dist/chunk-KT4NEUNF.js.map +1 -0
  146. package/dist/chunk-KWBU5S5U.js +42 -0
  147. package/dist/chunk-KWBU5S5U.js.map +1 -0
  148. package/dist/chunk-L5RPWGFK.js +59 -0
  149. package/dist/chunk-L5RPWGFK.js.map +1 -0
  150. package/dist/chunk-L7WO3MZ4.js +128 -0
  151. package/dist/chunk-L7WO3MZ4.js.map +1 -0
  152. package/dist/chunk-LIRZNNUP.js +74 -0
  153. package/dist/chunk-LIRZNNUP.js.map +1 -0
  154. package/dist/chunk-LK6SGL53.js +22 -0
  155. package/dist/chunk-LK6SGL53.js.map +1 -0
  156. package/dist/chunk-LOBRX7VD.js +200 -0
  157. package/dist/chunk-LOBRX7VD.js.map +1 -0
  158. package/dist/chunk-LPSF4OQH.js +47 -0
  159. package/dist/chunk-LPSF4OQH.js.map +1 -0
  160. package/dist/chunk-LU3GQNDQ.js +152 -0
  161. package/dist/chunk-LU3GQNDQ.js.map +1 -0
  162. package/dist/chunk-M5KEYE5E.js +350 -0
  163. package/dist/chunk-M5KEYE5E.js.map +1 -0
  164. package/dist/chunk-M62O4P4T.js +41 -0
  165. package/dist/chunk-M62O4P4T.js.map +1 -0
  166. package/dist/chunk-MARWOCVP.js +48 -0
  167. package/dist/chunk-MARWOCVP.js.map +1 -0
  168. package/dist/chunk-MDDAA2AO.js +925 -0
  169. package/dist/chunk-MDDAA2AO.js.map +1 -0
  170. package/dist/chunk-MWGVGUIS.js +198 -0
  171. package/dist/chunk-MWGVGUIS.js.map +1 -0
  172. package/dist/chunk-N5AKDXAI.js +74 -0
  173. package/dist/chunk-N5AKDXAI.js.map +1 -0
  174. package/dist/chunk-NGAVDO7E.js +115 -0
  175. package/dist/chunk-NGAVDO7E.js.map +1 -0
  176. package/dist/chunk-NTTLPF7F.js +283 -0
  177. package/dist/chunk-NTTLPF7F.js.map +1 -0
  178. package/dist/chunk-ONRU4L2N.js +240 -0
  179. package/dist/chunk-ONRU4L2N.js.map +1 -0
  180. package/dist/chunk-ORZMT74A.js +209 -0
  181. package/dist/chunk-ORZMT74A.js.map +1 -0
  182. package/dist/chunk-OTAVQCSF.js +268 -0
  183. package/dist/chunk-OTAVQCSF.js.map +1 -0
  184. package/dist/chunk-PGK3VUHN.js +160 -0
  185. package/dist/chunk-PGK3VUHN.js.map +1 -0
  186. package/dist/chunk-Q6FETXJA.js +1362 -0
  187. package/dist/chunk-Q6FETXJA.js.map +1 -0
  188. package/dist/chunk-QANCTXQF.js +271 -0
  189. package/dist/chunk-QANCTXQF.js.map +1 -0
  190. package/dist/chunk-QCCCQT3O.js +189 -0
  191. package/dist/chunk-QCCCQT3O.js.map +1 -0
  192. package/dist/chunk-QDOSNLB4.js +1048 -0
  193. package/dist/chunk-QDOSNLB4.js.map +1 -0
  194. package/dist/chunk-QFQVZOGA.js +2168 -0
  195. package/dist/chunk-QFQVZOGA.js.map +1 -0
  196. package/dist/chunk-QPKFPHOO.js +178 -0
  197. package/dist/chunk-QPKFPHOO.js.map +1 -0
  198. package/dist/chunk-QSVPYQPG.js +268 -0
  199. package/dist/chunk-QSVPYQPG.js.map +1 -0
  200. package/dist/chunk-QWUUMMIK.js +3045 -0
  201. package/dist/chunk-QWUUMMIK.js.map +1 -0
  202. package/dist/chunk-QY2BHY5O.js +2378 -0
  203. package/dist/chunk-QY2BHY5O.js.map +1 -0
  204. package/dist/chunk-SCHEKPYH.js +349 -0
  205. package/dist/chunk-SCHEKPYH.js.map +1 -0
  206. package/dist/chunk-SCU65EZI.js +15 -0
  207. package/dist/chunk-SCU65EZI.js.map +1 -0
  208. package/dist/chunk-T4WRIV2C.js +170 -0
  209. package/dist/chunk-T4WRIV2C.js.map +1 -0
  210. package/dist/chunk-TKO4HZCK.js +1852 -0
  211. package/dist/chunk-TKO4HZCK.js.map +1 -0
  212. package/dist/chunk-TP4FZJIZ.js +93 -0
  213. package/dist/chunk-TP4FZJIZ.js.map +1 -0
  214. package/dist/chunk-TPB3I2AC.js +403 -0
  215. package/dist/chunk-TPB3I2AC.js.map +1 -0
  216. package/dist/chunk-TVVVQQAK.js +1431 -0
  217. package/dist/chunk-TVVVQQAK.js.map +1 -0
  218. package/dist/chunk-U4PV25RD.js +14 -0
  219. package/dist/chunk-U4PV25RD.js.map +1 -0
  220. package/dist/chunk-UCYSTFZR.js +284 -0
  221. package/dist/chunk-UCYSTFZR.js.map +1 -0
  222. package/dist/chunk-UHGBNIOS.js +205 -0
  223. package/dist/chunk-UHGBNIOS.js.map +1 -0
  224. package/dist/chunk-UIYZ5T3I.js +108 -0
  225. package/dist/chunk-UIYZ5T3I.js.map +1 -0
  226. package/dist/chunk-UV2FO7J4.js +747 -0
  227. package/dist/chunk-UV2FO7J4.js.map +1 -0
  228. package/dist/chunk-UZB5KHKX.js +63 -0
  229. package/dist/chunk-UZB5KHKX.js.map +1 -0
  230. package/dist/chunk-V3RXWQIE.js +626 -0
  231. package/dist/chunk-V3RXWQIE.js.map +1 -0
  232. package/dist/chunk-V4YC4LUK.js +444 -0
  233. package/dist/chunk-V4YC4LUK.js.map +1 -0
  234. package/dist/chunk-VEWZZM3H.js +133 -0
  235. package/dist/chunk-VEWZZM3H.js.map +1 -0
  236. package/dist/chunk-WWIQTB2Y.js +98 -0
  237. package/dist/chunk-WWIQTB2Y.js.map +1 -0
  238. package/dist/chunk-X7XN6YU4.js +24 -0
  239. package/dist/chunk-X7XN6YU4.js.map +1 -0
  240. package/dist/chunk-XKECPATV.js +202 -0
  241. package/dist/chunk-XKECPATV.js.map +1 -0
  242. package/dist/chunk-XYIK4LF6.js +75 -0
  243. package/dist/chunk-XYIK4LF6.js.map +1 -0
  244. package/dist/chunk-Y27UJK6V.js +39 -0
  245. package/dist/chunk-Y27UJK6V.js.map +1 -0
  246. package/dist/chunk-Y4Z4I6WK.js +9 -0
  247. package/dist/chunk-Y4Z4I6WK.js.map +1 -0
  248. package/dist/chunk-YAPUAHAY.js +10761 -0
  249. package/dist/chunk-YAPUAHAY.js.map +1 -0
  250. package/dist/chunk-YAZNBMNF.js +92 -0
  251. package/dist/chunk-YAZNBMNF.js.map +1 -0
  252. package/dist/chunk-YCN4BVDK.js +66 -0
  253. package/dist/chunk-YCN4BVDK.js.map +1 -0
  254. package/dist/chunk-YNCQ7E4M.js +388 -0
  255. package/dist/chunk-YNCQ7E4M.js.map +1 -0
  256. package/dist/chunk-YNI4S5WT.js +143 -0
  257. package/dist/chunk-YNI4S5WT.js.map +1 -0
  258. package/dist/chunk-YRMVARQP.js +406 -0
  259. package/dist/chunk-YRMVARQP.js.map +1 -0
  260. package/dist/chunk-Z5AAYHUC.js +79 -0
  261. package/dist/chunk-Z5AAYHUC.js.map +1 -0
  262. package/dist/chunk-Z5LAYHGJ.js +15 -0
  263. package/dist/chunk-Z5LAYHGJ.js.map +1 -0
  264. package/dist/chunk-ZJLY4QSU.js +823 -0
  265. package/dist/chunk-ZJLY4QSU.js.map +1 -0
  266. package/dist/chunk-ZKYI7UVO.js +276 -0
  267. package/dist/chunk-ZKYI7UVO.js.map +1 -0
  268. package/dist/chunk-ZPKBYX2F.js +297 -0
  269. package/dist/chunk-ZPKBYX2F.js.map +1 -0
  270. package/dist/chunking.d.ts +48 -0
  271. package/dist/chunking.js +11 -0
  272. package/dist/chunking.js.map +1 -0
  273. package/dist/cli.d.ts +1162 -0
  274. package/dist/cli.js +7187 -0
  275. package/dist/cli.js.map +1 -0
  276. package/dist/commitment-ledger.d.ts +83 -0
  277. package/dist/commitment-ledger.js +19 -0
  278. package/dist/commitment-ledger.js.map +1 -0
  279. package/dist/compression-optimizer.d.ts +37 -0
  280. package/dist/compression-optimizer.js +13 -0
  281. package/dist/compression-optimizer.js.map +1 -0
  282. package/dist/config.d.ts +6 -0
  283. package/dist/config.js +12 -0
  284. package/dist/config.js.map +1 -0
  285. package/dist/cue-anchors.d.ts +50 -0
  286. package/dist/cue-anchors.js +15 -0
  287. package/dist/cue-anchors.js.map +1 -0
  288. package/dist/dashboard-runtime.d.ts +46 -0
  289. package/dist/dashboard-runtime.js +10 -0
  290. package/dist/dashboard-runtime.js.map +1 -0
  291. package/dist/day-summary.d.ts +6 -0
  292. package/dist/day-summary.js +10 -0
  293. package/dist/day-summary.js.map +1 -0
  294. package/dist/delinearize.d.ts +34 -0
  295. package/dist/delinearize.js +11 -0
  296. package/dist/delinearize.js.map +1 -0
  297. package/dist/embedding-fallback.d.ts +22 -0
  298. package/dist/embedding-fallback.js +8 -0
  299. package/dist/embedding-fallback.js.map +1 -0
  300. package/dist/engine-P26JFSVY.js +19 -0
  301. package/dist/engine-P26JFSVY.js.map +1 -0
  302. package/dist/entity-retrieval.d.ts +23 -0
  303. package/dist/entity-retrieval.js +24 -0
  304. package/dist/entity-retrieval.js.map +1 -0
  305. package/dist/evals.d.ts +282 -0
  306. package/dist/evals.js +32 -0
  307. package/dist/evals.js.map +1 -0
  308. package/dist/explicit-capture.d.ts +60 -0
  309. package/dist/explicit-capture.js +23 -0
  310. package/dist/explicit-capture.js.map +1 -0
  311. package/dist/extraction.d.ts +141 -0
  312. package/dist/extraction.js +22 -0
  313. package/dist/extraction.js.map +1 -0
  314. package/dist/fallback-llm.d.ts +95 -0
  315. package/dist/fallback-llm.js +12 -0
  316. package/dist/fallback-llm.js.map +1 -0
  317. package/dist/graph-dashboard-diff.d.ts +12 -0
  318. package/dist/graph-dashboard-diff.js +8 -0
  319. package/dist/graph-dashboard-diff.js.map +1 -0
  320. package/dist/graph-dashboard-key.d.ts +5 -0
  321. package/dist/graph-dashboard-key.js +7 -0
  322. package/dist/graph-dashboard-key.js.map +1 -0
  323. package/dist/graph-dashboard-parser.d.ts +20 -0
  324. package/dist/graph-dashboard-parser.js +8 -0
  325. package/dist/graph-dashboard-parser.js.map +1 -0
  326. package/dist/graph.d.ts +157 -0
  327. package/dist/graph.js +27 -0
  328. package/dist/graph.js.map +1 -0
  329. package/dist/harmonic-retrieval.d.ts +27 -0
  330. package/dist/harmonic-retrieval.js +12 -0
  331. package/dist/harmonic-retrieval.js.map +1 -0
  332. package/dist/himem.d.ts +23 -0
  333. package/dist/himem.js +7 -0
  334. package/dist/himem.js.map +1 -0
  335. package/dist/hygiene.d.ts +24 -0
  336. package/dist/hygiene.js +9 -0
  337. package/dist/hygiene.js.map +1 -0
  338. package/dist/identity-continuity.d.ts +17 -0
  339. package/dist/identity-continuity.js +19 -0
  340. package/dist/identity-continuity.js.map +1 -0
  341. package/dist/importance.d.ts +25 -0
  342. package/dist/importance.js +11 -0
  343. package/dist/importance.js.map +1 -0
  344. package/dist/index.d.ts +923 -0
  345. package/dist/index.js +2512 -0
  346. package/dist/index.js.map +1 -0
  347. package/dist/intent.d.ts +8 -0
  348. package/dist/intent.js +13 -0
  349. package/dist/intent.js.map +1 -0
  350. package/dist/json-extract.d.ts +14 -0
  351. package/dist/json-extract.js +9 -0
  352. package/dist/json-extract.js.map +1 -0
  353. package/dist/json-store.d.ts +5 -0
  354. package/dist/json-store.js +11 -0
  355. package/dist/json-store.js.map +1 -0
  356. package/dist/legacy-hook-compat.d.ts +3 -0
  357. package/dist/legacy-hook-compat.js +35 -0
  358. package/dist/legacy-hook-compat.js.map +1 -0
  359. package/dist/lifecycle.d.ts +52 -0
  360. package/dist/lifecycle.js +21 -0
  361. package/dist/lifecycle.js.map +1 -0
  362. package/dist/local-llm.d.ts +154 -0
  363. package/dist/local-llm.js +10 -0
  364. package/dist/local-llm.js.map +1 -0
  365. package/dist/logger.d.ts +15 -0
  366. package/dist/logger.js +9 -0
  367. package/dist/logger.js.map +1 -0
  368. package/dist/memory-action-policy.d.ts +13 -0
  369. package/dist/memory-action-policy.js +7 -0
  370. package/dist/memory-action-policy.js.map +1 -0
  371. package/dist/memory-cache.d.ts +35 -0
  372. package/dist/memory-cache.js +37 -0
  373. package/dist/memory-cache.js.map +1 -0
  374. package/dist/memory-lifecycle-ledger-utils.d.ts +13 -0
  375. package/dist/memory-lifecycle-ledger-utils.js +23 -0
  376. package/dist/memory-lifecycle-ledger-utils.js.map +1 -0
  377. package/dist/memory-projection-format.d.ts +4 -0
  378. package/dist/memory-projection-format.js +9 -0
  379. package/dist/memory-projection-format.js.map +1 -0
  380. package/dist/memory-projection-store-NxMkbocT.d.ts +221 -0
  381. package/dist/memory-projection-store.d.ts +3 -0
  382. package/dist/memory-projection-store.js +31 -0
  383. package/dist/memory-projection-store.js.map +1 -0
  384. package/dist/model-registry.d.ts +60 -0
  385. package/dist/model-registry.js +8 -0
  386. package/dist/model-registry.js.map +1 -0
  387. package/dist/native-knowledge.d.ts +94 -0
  388. package/dist/native-knowledge.js +26 -0
  389. package/dist/native-knowledge.js.map +1 -0
  390. package/dist/negative.d.ts +26 -0
  391. package/dist/negative.js +8 -0
  392. package/dist/negative.js.map +1 -0
  393. package/dist/objective-state-writers.d.ts +22 -0
  394. package/dist/objective-state-writers.js +313 -0
  395. package/dist/objective-state-writers.js.map +1 -0
  396. package/dist/objective-state.d.ts +75 -0
  397. package/dist/objective-state.js +17 -0
  398. package/dist/objective-state.js.map +1 -0
  399. package/dist/openai-chat-compat.d.ts +13 -0
  400. package/dist/openai-chat-compat.js +11 -0
  401. package/dist/openai-chat-compat.js.map +1 -0
  402. package/dist/operator-toolkit.d.ts +304 -0
  403. package/dist/operator-toolkit.js +41 -0
  404. package/dist/operator-toolkit.js.map +1 -0
  405. package/dist/opik-exporter.d.ts +72 -0
  406. package/dist/opik-exporter.js +361 -0
  407. package/dist/opik-exporter.js.map +1 -0
  408. package/dist/orchestrator-zTa-Qo-1.d.ts +1104 -0
  409. package/dist/orchestrator.d.ts +21 -0
  410. package/dist/orchestrator.js +145 -0
  411. package/dist/orchestrator.js.map +1 -0
  412. package/dist/policy-runtime.d.ts +37 -0
  413. package/dist/policy-runtime.js +13 -0
  414. package/dist/policy-runtime.js.map +1 -0
  415. package/dist/port-C1GZFv8h.d.ts +41 -0
  416. package/dist/profiling.d.ts +80 -0
  417. package/dist/profiling.js +10 -0
  418. package/dist/profiling.js.map +1 -0
  419. package/dist/qmd-recall-cache.d.ts +29 -0
  420. package/dist/qmd-recall-cache.js +13 -0
  421. package/dist/qmd-recall-cache.js.map +1 -0
  422. package/dist/qmd.d.ts +105 -0
  423. package/dist/qmd.js +13 -0
  424. package/dist/qmd.js.map +1 -0
  425. package/dist/recall-qos.d.ts +33 -0
  426. package/dist/recall-qos.js +10 -0
  427. package/dist/recall-qos.js.map +1 -0
  428. package/dist/recall-query-policy.d.ts +20 -0
  429. package/dist/recall-query-policy.js +11 -0
  430. package/dist/recall-query-policy.js.map +1 -0
  431. package/dist/recall-state.d.ts +113 -0
  432. package/dist/recall-state.js +12 -0
  433. package/dist/recall-state.js.map +1 -0
  434. package/dist/recall-tokenization.d.ts +4 -0
  435. package/dist/recall-tokenization.js +9 -0
  436. package/dist/recall-tokenization.js.map +1 -0
  437. package/dist/reconstruct.d.ts +16 -0
  438. package/dist/reconstruct.js +7 -0
  439. package/dist/reconstruct.js.map +1 -0
  440. package/dist/release-changelog.d.ts +7 -0
  441. package/dist/release-changelog.js +30 -0
  442. package/dist/release-changelog.js.map +1 -0
  443. package/dist/relevance.d.ts +18 -0
  444. package/dist/relevance.js +8 -0
  445. package/dist/relevance.js.map +1 -0
  446. package/dist/rerank.d.ts +57 -0
  447. package/dist/rerank.js +11 -0
  448. package/dist/rerank.js.map +1 -0
  449. package/dist/resolve-provider-secret.d.ts +16 -0
  450. package/dist/resolve-provider-secret.js +11 -0
  451. package/dist/resolve-provider-secret.js.map +1 -0
  452. package/dist/resume-bundles.d.ts +66 -0
  453. package/dist/resume-bundles.js +27 -0
  454. package/dist/resume-bundles.js.map +1 -0
  455. package/dist/retrieval-agents.d.ts +129 -0
  456. package/dist/retrieval-agents.js +23 -0
  457. package/dist/retrieval-agents.js.map +1 -0
  458. package/dist/retrieval.d.ts +19 -0
  459. package/dist/retrieval.js +10 -0
  460. package/dist/retrieval.js.map +1 -0
  461. package/dist/sanitize.d.ts +9 -0
  462. package/dist/sanitize.js +9 -0
  463. package/dist/sanitize.js.map +1 -0
  464. package/dist/schemas.d.ts +688 -0
  465. package/dist/schemas.js +51 -0
  466. package/dist/schemas.js.map +1 -0
  467. package/dist/sdk-compat.d.ts +21 -0
  468. package/dist/sdk-compat.js +28 -0
  469. package/dist/sdk-compat.js.map +1 -0
  470. package/dist/semantic-consolidation.d.ts +42 -0
  471. package/dist/semantic-consolidation.js +12 -0
  472. package/dist/semantic-consolidation.js.map +1 -0
  473. package/dist/semantic-rule-promotion.d.ts +28 -0
  474. package/dist/semantic-rule-promotion.js +17 -0
  475. package/dist/semantic-rule-promotion.js.map +1 -0
  476. package/dist/semantic-rule-verifier.d.ts +19 -0
  477. package/dist/semantic-rule-verifier.js +18 -0
  478. package/dist/semantic-rule-verifier.js.map +1 -0
  479. package/dist/session-integrity.d.ts +67 -0
  480. package/dist/session-integrity.js +11 -0
  481. package/dist/session-integrity.js.map +1 -0
  482. package/dist/session-observer-bands.d.ts +6 -0
  483. package/dist/session-observer-bands.js +9 -0
  484. package/dist/session-observer-bands.js.map +1 -0
  485. package/dist/session-observer-state.d.ts +40 -0
  486. package/dist/session-observer-state.js +11 -0
  487. package/dist/session-observer-state.js.map +1 -0
  488. package/dist/signal.d.ts +6 -0
  489. package/dist/signal.js +9 -0
  490. package/dist/signal.js.map +1 -0
  491. package/dist/storage.d.ts +453 -0
  492. package/dist/storage.js +24 -0
  493. package/dist/storage.js.map +1 -0
  494. package/dist/store-contract.d.ts +10 -0
  495. package/dist/store-contract.js +21 -0
  496. package/dist/store-contract.js.map +1 -0
  497. package/dist/summarizer.d.ts +35 -0
  498. package/dist/summarizer.js +17 -0
  499. package/dist/summarizer.js.map +1 -0
  500. package/dist/summary-snapshot.d.ts +8 -0
  501. package/dist/summary-snapshot.js +13 -0
  502. package/dist/summary-snapshot.js.map +1 -0
  503. package/dist/temporal-index.d.ts +139 -0
  504. package/dist/temporal-index.js +29 -0
  505. package/dist/temporal-index.js.map +1 -0
  506. package/dist/threading.d.ts +62 -0
  507. package/dist/threading.js +8 -0
  508. package/dist/threading.js.map +1 -0
  509. package/dist/tier-migration.d.ts +44 -0
  510. package/dist/tier-migration.js +7 -0
  511. package/dist/tier-migration.js.map +1 -0
  512. package/dist/tier-routing.d.ts +21 -0
  513. package/dist/tier-routing.js +10 -0
  514. package/dist/tier-routing.js.map +1 -0
  515. package/dist/tmt.d.ts +79 -0
  516. package/dist/tmt.js +29 -0
  517. package/dist/tmt.js.map +1 -0
  518. package/dist/tokens.d.ts +24 -0
  519. package/dist/tokens.js +21 -0
  520. package/dist/tokens.js.map +1 -0
  521. package/dist/topics.d.ts +29 -0
  522. package/dist/topics.js +9 -0
  523. package/dist/topics.js.map +1 -0
  524. package/dist/transcript.d.ts +171 -0
  525. package/dist/transcript.js +9 -0
  526. package/dist/transcript.js.map +1 -0
  527. package/dist/trust-zones.d.ts +170 -0
  528. package/dist/trust-zones.js +32 -0
  529. package/dist/trust-zones.js.map +1 -0
  530. package/dist/types.d.ts +1243 -0
  531. package/dist/types.js +9 -0
  532. package/dist/types.js.map +1 -0
  533. package/dist/utility-learner.d.ts +59 -0
  534. package/dist/utility-learner.js +17 -0
  535. package/dist/utility-learner.js.map +1 -0
  536. package/dist/utility-runtime.d.ts +21 -0
  537. package/dist/utility-runtime.js +16 -0
  538. package/dist/utility-runtime.js.map +1 -0
  539. package/dist/utility-telemetry.d.ts +68 -0
  540. package/dist/utility-telemetry.js +17 -0
  541. package/dist/utility-telemetry.js.map +1 -0
  542. package/dist/verified-recall.d.ts +17 -0
  543. package/dist/verified-recall.js +19 -0
  544. package/dist/verified-recall.js.map +1 -0
  545. package/dist/version-utils.d.ts +4 -0
  546. package/dist/version-utils.js +7 -0
  547. package/dist/version-utils.js.map +1 -0
  548. package/dist/work-product-ledger.d.ts +65 -0
  549. package/dist/work-product-ledger.js +18 -0
  550. package/dist/work-product-ledger.js.map +1 -0
  551. package/package.json +58 -0
@@ -0,0 +1,707 @@
1
+ // src/memory-projection-store.ts
2
+ import path from "path";
3
+ import { readFileSync } from "fs";
4
+
5
+ // src/runtime/better-sqlite.ts
6
+ import { createRequire } from "module";
7
+ var cachedCtor = null;
8
+ function loadBetterSqlite3() {
9
+ if (cachedCtor) return cachedCtor;
10
+ const require2 = createRequire(import.meta.url);
11
+ try {
12
+ const loaded = require2("better-sqlite3");
13
+ const ctor = typeof loaded === "function" ? loaded : loaded.default;
14
+ if (typeof ctor !== "function") {
15
+ throw new Error("module did not export a constructor");
16
+ }
17
+ cachedCtor = ctor;
18
+ return ctor;
19
+ } catch (error) {
20
+ const detail = error instanceof Error && error.message.length > 0 ? ` (${error.message})` : "";
21
+ throw new Error(
22
+ "better-sqlite3 is unavailable. Rebuild it in the plugin install with `npm rebuild better-sqlite3 --build-from-source` before using SQLite-backed Engram features" + detail,
23
+ { cause: error instanceof Error ? error : void 0 }
24
+ );
25
+ }
26
+ }
27
+ function openBetterSqlite3(file, options) {
28
+ const Database = loadBetterSqlite3();
29
+ return new Database(file, options);
30
+ }
31
+
32
+ // src/memory-projection-store.ts
33
+ var MEMORY_PROJECTION_SCHEMA_VERSION = 2;
34
+ function getMemoryProjectionPath(memoryDir) {
35
+ return path.join(memoryDir, "state", "memory-projection.sqlite");
36
+ }
37
+ function listTableColumns(db, tableName) {
38
+ try {
39
+ const rows = db.prepare(`PRAGMA table_info(${tableName})`).all();
40
+ return new Set(rows.map((row) => row.name).filter((name) => typeof name === "string"));
41
+ } catch {
42
+ return /* @__PURE__ */ new Set();
43
+ }
44
+ }
45
+ function migrateMemoryCurrentTable(db) {
46
+ const columns = listTableColumns(db, "memory_current");
47
+ if (columns.size === 0) return;
48
+ if (!columns.has("tags_json")) {
49
+ db.exec(`ALTER TABLE memory_current ADD COLUMN tags_json TEXT NOT NULL DEFAULT '[]'`);
50
+ }
51
+ if (!columns.has("preview_text")) {
52
+ db.exec(`ALTER TABLE memory_current ADD COLUMN preview_text TEXT NOT NULL DEFAULT ''`);
53
+ }
54
+ }
55
+ function memoryCurrentRequiresMigration(db) {
56
+ const columns = listTableColumns(db, "memory_current");
57
+ return columns.size > 0 && (!columns.has("tags_json") || !columns.has("preview_text"));
58
+ }
59
+ function migrateProjectionSchemaIfNeeded(memoryDir) {
60
+ const dbPath = getMemoryProjectionPath(memoryDir);
61
+ try {
62
+ const db = openBetterSqlite3(dbPath, { fileMustExist: true });
63
+ try {
64
+ if (!memoryCurrentRequiresMigration(db)) return;
65
+ initializeMemoryProjectionDb(db);
66
+ } finally {
67
+ db.close();
68
+ }
69
+ } catch {
70
+ }
71
+ }
72
+ function memoryCurrentSelectExpressions(db) {
73
+ const columns = listTableColumns(db, "memory_current");
74
+ return {
75
+ tagsJson: columns.has("tags_json") ? "tags_json" : `'[]' AS tags_json`,
76
+ previewText: columns.has("preview_text") ? "preview_text" : `'' AS preview_text`
77
+ };
78
+ }
79
+ function initializeMemoryProjectionDb(db) {
80
+ db.exec(`
81
+ CREATE TABLE IF NOT EXISTS meta (
82
+ key TEXT PRIMARY KEY,
83
+ value TEXT NOT NULL
84
+ );
85
+
86
+ CREATE TABLE IF NOT EXISTS memory_current (
87
+ memory_id TEXT PRIMARY KEY,
88
+ category TEXT NOT NULL,
89
+ status TEXT NOT NULL,
90
+ lifecycle_state TEXT,
91
+ path_rel TEXT NOT NULL,
92
+ created_at TEXT NOT NULL,
93
+ updated_at TEXT NOT NULL,
94
+ archived_at TEXT,
95
+ superseded_at TEXT,
96
+ entity_ref TEXT,
97
+ source TEXT NOT NULL,
98
+ confidence REAL NOT NULL,
99
+ confidence_tier TEXT NOT NULL,
100
+ memory_kind TEXT,
101
+ access_count INTEGER,
102
+ last_accessed TEXT,
103
+ tags_json TEXT NOT NULL DEFAULT '[]',
104
+ preview_text TEXT NOT NULL DEFAULT ''
105
+ );
106
+
107
+ CREATE INDEX IF NOT EXISTS idx_memory_current_status
108
+ ON memory_current(status);
109
+
110
+ CREATE INDEX IF NOT EXISTS idx_memory_current_category
111
+ ON memory_current(category);
112
+
113
+ CREATE INDEX IF NOT EXISTS idx_memory_current_updated
114
+ ON memory_current(updated_at DESC);
115
+
116
+ CREATE TABLE IF NOT EXISTS memory_timeline (
117
+ event_id TEXT PRIMARY KEY,
118
+ memory_id TEXT NOT NULL,
119
+ event_type TEXT NOT NULL,
120
+ timestamp TEXT NOT NULL,
121
+ event_order INTEGER NOT NULL,
122
+ actor TEXT NOT NULL,
123
+ reason_code TEXT,
124
+ rule_version TEXT NOT NULL,
125
+ related_memory_ids_json TEXT,
126
+ before_json TEXT,
127
+ after_json TEXT,
128
+ correlation_id TEXT
129
+ );
130
+
131
+ CREATE INDEX IF NOT EXISTS idx_memory_timeline_memory_ts
132
+ ON memory_timeline(memory_id, timestamp, event_order);
133
+
134
+ CREATE TABLE IF NOT EXISTS memory_entity_mentions (
135
+ memory_id TEXT NOT NULL,
136
+ entity_ref TEXT NOT NULL,
137
+ mention_source TEXT NOT NULL,
138
+ created_at TEXT NOT NULL,
139
+ updated_at TEXT NOT NULL,
140
+ PRIMARY KEY (memory_id, entity_ref, mention_source)
141
+ );
142
+
143
+ CREATE INDEX IF NOT EXISTS idx_memory_entity_mentions_entity
144
+ ON memory_entity_mentions(entity_ref, updated_at DESC);
145
+
146
+ CREATE TABLE IF NOT EXISTS native_knowledge_chunks (
147
+ chunk_id TEXT PRIMARY KEY,
148
+ source_path TEXT NOT NULL,
149
+ title TEXT NOT NULL,
150
+ source_kind TEXT NOT NULL,
151
+ start_line INTEGER NOT NULL,
152
+ end_line INTEGER NOT NULL,
153
+ derived_date TEXT,
154
+ session_key TEXT,
155
+ workflow_key TEXT,
156
+ author TEXT,
157
+ agent TEXT,
158
+ namespace TEXT,
159
+ privacy_class TEXT,
160
+ source_hash TEXT,
161
+ preview_text TEXT NOT NULL
162
+ );
163
+
164
+ CREATE INDEX IF NOT EXISTS idx_native_knowledge_source_kind
165
+ ON native_knowledge_chunks(source_kind);
166
+
167
+ CREATE INDEX IF NOT EXISTS idx_native_knowledge_namespace
168
+ ON native_knowledge_chunks(namespace);
169
+
170
+ CREATE TABLE IF NOT EXISTS memory_review_runs (
171
+ run_id TEXT PRIMARY KEY,
172
+ created_at TEXT NOT NULL,
173
+ mode TEXT NOT NULL,
174
+ summary_json TEXT NOT NULL,
175
+ metrics_json TEXT NOT NULL,
176
+ applied_actions_json TEXT NOT NULL,
177
+ report_markdown TEXT NOT NULL
178
+ );
179
+
180
+ CREATE INDEX IF NOT EXISTS idx_memory_review_runs_created
181
+ ON memory_review_runs(created_at DESC);
182
+
183
+ CREATE TABLE IF NOT EXISTS memory_review_queue (
184
+ entry_id TEXT PRIMARY KEY,
185
+ run_id TEXT NOT NULL,
186
+ memory_id TEXT NOT NULL,
187
+ path TEXT NOT NULL,
188
+ reason_code TEXT NOT NULL,
189
+ severity TEXT NOT NULL,
190
+ suggested_action TEXT NOT NULL,
191
+ suggested_status TEXT,
192
+ related_memory_ids_json TEXT NOT NULL
193
+ );
194
+
195
+ CREATE INDEX IF NOT EXISTS idx_memory_review_queue_run
196
+ ON memory_review_queue(run_id, reason_code, memory_id);
197
+
198
+ CREATE TABLE IF NOT EXISTS memory_review_actions (
199
+ row_key TEXT PRIMARY KEY,
200
+ run_id TEXT NOT NULL,
201
+ action TEXT NOT NULL,
202
+ memory_id TEXT NOT NULL,
203
+ reason_code TEXT NOT NULL,
204
+ before_status TEXT NOT NULL,
205
+ after_status TEXT,
206
+ original_path TEXT NOT NULL,
207
+ current_path TEXT NOT NULL
208
+ );
209
+
210
+ CREATE INDEX IF NOT EXISTS idx_memory_review_actions_run
211
+ ON memory_review_actions(run_id, memory_id);
212
+ `);
213
+ migrateMemoryCurrentTable(db);
214
+ db.prepare("INSERT OR REPLACE INTO meta(key, value) VALUES (?, ?)").run("schemaVersion", String(MEMORY_PROJECTION_SCHEMA_VERSION));
215
+ }
216
+ function openProjectionReadonly(memoryDir) {
217
+ const dbPath = getMemoryProjectionPath(memoryDir);
218
+ try {
219
+ return openBetterSqlite3(dbPath, { readonly: true, fileMustExist: true });
220
+ } catch {
221
+ return null;
222
+ }
223
+ }
224
+ function withProjectionReadonly(memoryDir, reader) {
225
+ const db = openProjectionReadonly(memoryDir);
226
+ if (!db) return null;
227
+ let needsMigration = false;
228
+ try {
229
+ needsMigration = memoryCurrentRequiresMigration(db);
230
+ return reader(db);
231
+ } catch {
232
+ return null;
233
+ } finally {
234
+ db.close();
235
+ if (needsMigration) {
236
+ migrateProjectionSchemaIfNeeded(memoryDir);
237
+ }
238
+ }
239
+ }
240
+ function parseStringArray(value) {
241
+ if (typeof value !== "string" || value.length === 0) return [];
242
+ try {
243
+ const parsed = JSON.parse(value);
244
+ return Array.isArray(parsed) ? parsed.filter((entry) => typeof entry === "string") : [];
245
+ } catch {
246
+ return [];
247
+ }
248
+ }
249
+ function parseJsonObject(value) {
250
+ if (typeof value !== "string" || value.length === 0) return void 0;
251
+ try {
252
+ return JSON.parse(value);
253
+ } catch {
254
+ return void 0;
255
+ }
256
+ }
257
+ function parseCurrentRow(memoryDir, row) {
258
+ if (!row) return null;
259
+ if (typeof row.memory_id !== "string" || typeof row.category !== "string" || typeof row.status !== "string" || typeof row.path_rel !== "string" || typeof row.created_at !== "string" || typeof row.updated_at !== "string" || typeof row.source !== "string" || typeof row.confidence !== "number" || typeof row.confidence_tier !== "string") {
260
+ return null;
261
+ }
262
+ return {
263
+ memoryId: row.memory_id,
264
+ category: row.category,
265
+ status: row.status,
266
+ lifecycleState: typeof row.lifecycle_state === "string" ? row.lifecycle_state : void 0,
267
+ path: path.join(memoryDir, row.path_rel),
268
+ pathRel: row.path_rel,
269
+ created: row.created_at,
270
+ updated: row.updated_at,
271
+ archivedAt: typeof row.archived_at === "string" ? row.archived_at : void 0,
272
+ supersededAt: typeof row.superseded_at === "string" ? row.superseded_at : void 0,
273
+ entityRef: typeof row.entity_ref === "string" ? row.entity_ref : void 0,
274
+ source: row.source,
275
+ confidence: row.confidence,
276
+ confidenceTier: row.confidence_tier,
277
+ memoryKind: typeof row.memory_kind === "string" ? row.memory_kind : void 0,
278
+ accessCount: typeof row.access_count === "number" ? row.access_count : void 0,
279
+ lastAccessed: typeof row.last_accessed === "string" ? row.last_accessed : void 0,
280
+ tags: parseStringArray(row.tags_json),
281
+ preview: typeof row.preview_text === "string" ? row.preview_text : ""
282
+ };
283
+ }
284
+ function parseTimelineRows(rows) {
285
+ const out = [];
286
+ for (const row of rows) {
287
+ if (typeof row.event_id !== "string" || typeof row.memory_id !== "string" || typeof row.event_type !== "string" || typeof row.timestamp !== "string" || typeof row.actor !== "string" || typeof row.rule_version !== "string") {
288
+ continue;
289
+ }
290
+ out.push({
291
+ eventId: row.event_id,
292
+ memoryId: row.memory_id,
293
+ eventType: row.event_type,
294
+ timestamp: row.timestamp,
295
+ actor: row.actor,
296
+ reasonCode: typeof row.reason_code === "string" ? row.reason_code : void 0,
297
+ ruleVersion: row.rule_version,
298
+ relatedMemoryIds: parseStringArray(row.related_memory_ids_json),
299
+ before: parseJsonObject(row.before_json),
300
+ after: parseJsonObject(row.after_json),
301
+ correlationId: typeof row.correlation_id === "string" ? row.correlation_id : void 0
302
+ });
303
+ }
304
+ return out;
305
+ }
306
+ function readProjectedMemoryState(memoryDir, memoryId) {
307
+ return withProjectionReadonly(memoryDir, (db) => {
308
+ const currentSelect = memoryCurrentSelectExpressions(db);
309
+ const row = db.prepare(
310
+ `
311
+ SELECT
312
+ memory_id,
313
+ category,
314
+ status,
315
+ lifecycle_state,
316
+ path_rel,
317
+ created_at,
318
+ updated_at,
319
+ archived_at,
320
+ superseded_at,
321
+ entity_ref,
322
+ source,
323
+ confidence,
324
+ confidence_tier,
325
+ memory_kind,
326
+ access_count,
327
+ last_accessed,
328
+ ${currentSelect.tagsJson},
329
+ ${currentSelect.previewText}
330
+ FROM memory_current
331
+ WHERE memory_id = ?
332
+ `
333
+ ).get(memoryId);
334
+ return parseCurrentRow(memoryDir, row);
335
+ });
336
+ }
337
+ function readProjectedMemoryTimeline(memoryDir, memoryId, limit) {
338
+ const db = openProjectionReadonly(memoryDir);
339
+ if (!db) return null;
340
+ try {
341
+ const rows = db.prepare(
342
+ `
343
+ SELECT * FROM (
344
+ SELECT
345
+ event_id,
346
+ memory_id,
347
+ event_type,
348
+ timestamp,
349
+ event_order,
350
+ actor,
351
+ reason_code,
352
+ rule_version,
353
+ related_memory_ids_json,
354
+ before_json,
355
+ after_json,
356
+ correlation_id
357
+ FROM memory_timeline
358
+ WHERE memory_id = ?
359
+ ORDER BY timestamp DESC, event_order DESC
360
+ LIMIT ?
361
+ )
362
+ ORDER BY timestamp ASC, event_order ASC
363
+ `
364
+ ).all(memoryId, limit);
365
+ if (rows.length === 0) return null;
366
+ return parseTimelineRows(rows);
367
+ } catch {
368
+ return null;
369
+ } finally {
370
+ db.close();
371
+ }
372
+ }
373
+ function readProjectedMemoryBrowse(memoryDir, options) {
374
+ return withProjectionReadonly(memoryDir, (db) => {
375
+ const normalizedQuery = options.query?.trim().toLowerCase() ?? "";
376
+ const currentSelect = memoryCurrentSelectExpressions(db);
377
+ const whereClauses = [];
378
+ const params = [];
379
+ if (options.status) {
380
+ whereClauses.push("status = ?");
381
+ params.push(options.status);
382
+ }
383
+ if (options.category) {
384
+ whereClauses.push("category = ?");
385
+ params.push(options.category);
386
+ }
387
+ const sort = options.sort ?? "updated_desc";
388
+ const orderBySql = (() => {
389
+ switch (sort) {
390
+ case "updated_asc":
391
+ return "updated_at ASC, created_at ASC, memory_id ASC";
392
+ case "created_desc":
393
+ return "created_at DESC, updated_at DESC, memory_id ASC";
394
+ case "created_asc":
395
+ return "created_at ASC, updated_at ASC, memory_id ASC";
396
+ case "updated_desc":
397
+ default:
398
+ return "updated_at DESC, created_at DESC, memory_id ASC";
399
+ }
400
+ })();
401
+ const whereSql = whereClauses.length > 0 ? `WHERE ${whereClauses.join(" AND ")}` : "";
402
+ if (normalizedQuery) {
403
+ const allRows = db.prepare(`
404
+ SELECT
405
+ memory_id,
406
+ path_rel,
407
+ category,
408
+ status,
409
+ created_at,
410
+ updated_at,
411
+ entity_ref,
412
+ ${currentSelect.tagsJson},
413
+ ${currentSelect.previewText}
414
+ FROM memory_current
415
+ ${whereSql}
416
+ ORDER BY ${orderBySql}
417
+ `).all(...params);
418
+ const filtered = allRows.filter((row) => {
419
+ if (typeof row.memory_id !== "string" || typeof row.path_rel !== "string") return false;
420
+ const preview = typeof row.preview_text === "string" ? row.preview_text.toLowerCase() : "";
421
+ const category = typeof row.category === "string" ? row.category.toLowerCase() : "";
422
+ const entityRef = typeof row.entity_ref === "string" ? row.entity_ref.toLowerCase() : "";
423
+ const tags = typeof row.tags_json === "string" ? row.tags_json.toLowerCase() : "";
424
+ if (preview.includes(normalizedQuery) || category.includes(normalizedQuery) || entityRef.includes(normalizedQuery) || tags.includes(normalizedQuery)) {
425
+ return true;
426
+ }
427
+ try {
428
+ const filePath = path.join(memoryDir, row.path_rel);
429
+ const content = readFileSync(filePath, "utf-8").toLowerCase();
430
+ return content.includes(normalizedQuery);
431
+ } catch {
432
+ return false;
433
+ }
434
+ });
435
+ const pageRows = filtered.slice(options.offset, options.offset + options.limit);
436
+ return {
437
+ total: filtered.length,
438
+ memories: pageRows.filter(
439
+ (row) => typeof row.memory_id === "string" && typeof row.path_rel === "string" && typeof row.category === "string" && typeof row.status === "string"
440
+ ).map((row) => ({
441
+ id: row.memory_id,
442
+ path: path.join(memoryDir, row.path_rel),
443
+ category: row.category,
444
+ status: row.status,
445
+ created: typeof row.created_at === "string" ? row.created_at : void 0,
446
+ updated: typeof row.updated_at === "string" ? row.updated_at : void 0,
447
+ tags: parseStringArray(row.tags_json),
448
+ entityRef: typeof row.entity_ref === "string" ? row.entity_ref : void 0,
449
+ preview: typeof row.preview_text === "string" ? row.preview_text : ""
450
+ }))
451
+ };
452
+ }
453
+ const totalRow = db.prepare(`SELECT COUNT(*) AS total FROM memory_current ${whereSql}`).get(...params);
454
+ const rows = db.prepare(`
455
+ SELECT
456
+ memory_id,
457
+ path_rel,
458
+ category,
459
+ status,
460
+ created_at,
461
+ updated_at,
462
+ entity_ref,
463
+ ${currentSelect.tagsJson},
464
+ ${currentSelect.previewText}
465
+ FROM memory_current
466
+ ${whereSql}
467
+ ORDER BY ${orderBySql}
468
+ LIMIT ? OFFSET ?
469
+ `).all(...params, options.limit, options.offset);
470
+ return {
471
+ total: typeof totalRow?.total === "number" ? totalRow.total : 0,
472
+ memories: rows.filter(
473
+ (row) => typeof row.memory_id === "string" && typeof row.path_rel === "string" && typeof row.category === "string" && typeof row.status === "string"
474
+ ).map((row) => ({
475
+ id: row.memory_id,
476
+ path: path.join(memoryDir, row.path_rel),
477
+ category: row.category,
478
+ status: row.status,
479
+ created: typeof row.created_at === "string" ? row.created_at : void 0,
480
+ updated: typeof row.updated_at === "string" ? row.updated_at : void 0,
481
+ tags: parseStringArray(row.tags_json),
482
+ entityRef: typeof row.entity_ref === "string" ? row.entity_ref : void 0,
483
+ preview: typeof row.preview_text === "string" ? row.preview_text : ""
484
+ }))
485
+ };
486
+ });
487
+ }
488
+ function readProjectedEntityMentions(memoryDir, memoryIds) {
489
+ const db = openProjectionReadonly(memoryDir);
490
+ if (!db) return null;
491
+ try {
492
+ const rows = db.prepare(`
493
+ SELECT
494
+ memory_id,
495
+ entity_ref,
496
+ mention_source,
497
+ created_at,
498
+ updated_at
499
+ FROM memory_entity_mentions
500
+ ORDER BY entity_ref ASC, updated_at DESC, memory_id ASC
501
+ `).all();
502
+ return rows.filter(
503
+ (row) => typeof row.memory_id === "string" && typeof row.entity_ref === "string" && typeof row.mention_source === "string" && typeof row.created_at === "string" && typeof row.updated_at === "string" && (!memoryIds || memoryIds.has(row.memory_id))
504
+ ).map((row) => ({
505
+ memoryId: row.memory_id,
506
+ entityRef: row.entity_ref,
507
+ mentionSource: row.mention_source,
508
+ created: row.created_at,
509
+ updated: row.updated_at
510
+ }));
511
+ } catch {
512
+ return null;
513
+ } finally {
514
+ db.close();
515
+ }
516
+ }
517
+ function readProjectedNativeKnowledgeChunks(memoryDir) {
518
+ const db = openProjectionReadonly(memoryDir);
519
+ if (!db) return null;
520
+ try {
521
+ const rows = db.prepare(`
522
+ SELECT
523
+ chunk_id,
524
+ source_path,
525
+ title,
526
+ source_kind,
527
+ start_line,
528
+ end_line,
529
+ derived_date,
530
+ session_key,
531
+ workflow_key,
532
+ author,
533
+ agent,
534
+ namespace,
535
+ privacy_class,
536
+ source_hash,
537
+ preview_text
538
+ FROM native_knowledge_chunks
539
+ ORDER BY source_kind ASC, source_path ASC, start_line ASC
540
+ `).all();
541
+ return rows.filter(
542
+ (row) => typeof row.chunk_id === "string" && typeof row.source_path === "string" && typeof row.title === "string" && typeof row.source_kind === "string" && typeof row.start_line === "number" && typeof row.end_line === "number" && typeof row.preview_text === "string"
543
+ ).map((row) => ({
544
+ chunkId: row.chunk_id,
545
+ sourcePath: row.source_path,
546
+ title: row.title,
547
+ sourceKind: row.source_kind,
548
+ startLine: row.start_line,
549
+ endLine: row.end_line,
550
+ derivedDate: typeof row.derived_date === "string" ? row.derived_date : void 0,
551
+ sessionKey: typeof row.session_key === "string" ? row.session_key : void 0,
552
+ workflowKey: typeof row.workflow_key === "string" ? row.workflow_key : void 0,
553
+ author: typeof row.author === "string" ? row.author : void 0,
554
+ agent: typeof row.agent === "string" ? row.agent : void 0,
555
+ namespace: typeof row.namespace === "string" ? row.namespace : void 0,
556
+ privacyClass: typeof row.privacy_class === "string" ? row.privacy_class : void 0,
557
+ sourceHash: typeof row.source_hash === "string" ? row.source_hash : void 0,
558
+ preview: row.preview_text
559
+ }));
560
+ } catch {
561
+ return null;
562
+ } finally {
563
+ db.close();
564
+ }
565
+ }
566
+ function readProjectedLatestReviewQueue(memoryDir) {
567
+ const db = openProjectionReadonly(memoryDir);
568
+ if (!db) return null;
569
+ try {
570
+ const latestRunId = db.prepare(`SELECT value FROM meta WHERE key = 'latestGovernanceRunId'`).get()?.value ?? db.prepare(`SELECT run_id AS value FROM memory_review_runs ORDER BY created_at DESC LIMIT 1`).get()?.value;
571
+ if (!latestRunId) {
572
+ return { found: false };
573
+ }
574
+ const runRow = db.prepare(`
575
+ SELECT
576
+ run_id,
577
+ summary_json,
578
+ metrics_json,
579
+ applied_actions_json,
580
+ report_markdown
581
+ FROM memory_review_runs
582
+ WHERE run_id = ?
583
+ `).get(latestRunId);
584
+ if (!runRow || typeof runRow.run_id !== "string") {
585
+ return { found: false };
586
+ }
587
+ const queueRows = db.prepare(`
588
+ SELECT
589
+ entry_id,
590
+ memory_id,
591
+ path,
592
+ reason_code,
593
+ severity,
594
+ suggested_action,
595
+ suggested_status,
596
+ related_memory_ids_json
597
+ FROM memory_review_queue
598
+ WHERE run_id = ?
599
+ ORDER BY reason_code ASC, memory_id ASC
600
+ `).all(latestRunId);
601
+ const actionRows = db.prepare(`
602
+ SELECT
603
+ row_key,
604
+ action,
605
+ memory_id,
606
+ reason_code,
607
+ before_status,
608
+ after_status,
609
+ original_path,
610
+ current_path
611
+ FROM memory_review_actions
612
+ WHERE run_id = ?
613
+ ORDER BY memory_id ASC, action ASC
614
+ `).all(latestRunId);
615
+ const reviewQueue = queueRows.filter(
616
+ (row) => typeof row.entry_id === "string" && typeof row.memory_id === "string" && typeof row.path === "string" && typeof row.reason_code === "string" && typeof row.severity === "string" && typeof row.suggested_action === "string"
617
+ ).map((row) => ({
618
+ entryId: row.entry_id,
619
+ memoryId: row.memory_id,
620
+ path: row.path,
621
+ reasonCode: row.reason_code,
622
+ severity: row.severity,
623
+ suggestedAction: row.suggested_action,
624
+ suggestedStatus: typeof row.suggested_status === "string" ? row.suggested_status : void 0,
625
+ relatedMemoryIds: parseStringArray(row.related_memory_ids_json)
626
+ }));
627
+ return {
628
+ found: true,
629
+ runId: latestRunId,
630
+ summary: parseJsonObject(runRow.summary_json),
631
+ metrics: parseJsonObject(runRow.metrics_json),
632
+ reviewQueue,
633
+ appliedActions: actionRows.length > 0 ? actionRows.filter(
634
+ (row) => typeof row.action === "string" && typeof row.memory_id === "string" && typeof row.reason_code === "string" && typeof row.before_status === "string" && typeof row.original_path === "string" && typeof row.current_path === "string"
635
+ ).map((row) => ({
636
+ action: row.action,
637
+ memoryId: row.memory_id,
638
+ reasonCode: row.reason_code,
639
+ beforeStatus: row.before_status,
640
+ afterStatus: typeof row.after_status === "string" ? row.after_status : void 0,
641
+ originalPath: row.original_path,
642
+ currentPath: row.current_path
643
+ })) : parseJsonObject(runRow.applied_actions_json) ?? [],
644
+ report: typeof runRow.report_markdown === "string" ? runRow.report_markdown : void 0
645
+ };
646
+ } catch {
647
+ return null;
648
+ } finally {
649
+ db.close();
650
+ }
651
+ }
652
+ function readProjectedGovernanceRecord(memoryDir) {
653
+ const snapshot = readProjectedLatestReviewQueue(memoryDir);
654
+ if (!snapshot?.found || !snapshot.runId) return null;
655
+ return {
656
+ runId: snapshot.runId,
657
+ summary: snapshot.summary ?? {},
658
+ metrics: snapshot.metrics ?? {},
659
+ reviewQueueRows: (snapshot.reviewQueue ?? []).map((entry) => ({
660
+ runId: snapshot.runId,
661
+ entryId: entry.entryId,
662
+ memoryId: entry.memoryId,
663
+ path: entry.path,
664
+ reasonCode: entry.reasonCode,
665
+ severity: entry.severity,
666
+ suggestedAction: entry.suggestedAction,
667
+ suggestedStatus: entry.suggestedStatus,
668
+ relatedMemoryIds: [...entry.relatedMemoryIds]
669
+ })),
670
+ appliedActionRows: (snapshot.appliedActions ?? []).map((action) => ({
671
+ runId: snapshot.runId,
672
+ rowKey: [
673
+ action.action,
674
+ action.memoryId,
675
+ action.reasonCode,
676
+ action.originalPath,
677
+ action.currentPath
678
+ ].join("::"),
679
+ action: action.action,
680
+ memoryId: action.memoryId,
681
+ reasonCode: action.reasonCode,
682
+ beforeStatus: action.beforeStatus,
683
+ afterStatus: action.afterStatus,
684
+ originalPath: action.originalPath,
685
+ currentPath: action.currentPath
686
+ })),
687
+ report: snapshot.report ?? ""
688
+ };
689
+ }
690
+
691
+ export {
692
+ openBetterSqlite3,
693
+ MEMORY_PROJECTION_SCHEMA_VERSION,
694
+ getMemoryProjectionPath,
695
+ memoryCurrentSelectExpressions,
696
+ initializeMemoryProjectionDb,
697
+ parseCurrentRow,
698
+ parseTimelineRows,
699
+ readProjectedMemoryState,
700
+ readProjectedMemoryTimeline,
701
+ readProjectedMemoryBrowse,
702
+ readProjectedEntityMentions,
703
+ readProjectedNativeKnowledgeChunks,
704
+ readProjectedLatestReviewQueue,
705
+ readProjectedGovernanceRecord
706
+ };
707
+ //# sourceMappingURL=chunk-BOUYNNYD.js.map