@remnic/core 1.0.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (385) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -0
  3. package/dist/abort-error.d.ts +32 -0
  4. package/dist/abort-error.js +11 -0
  5. package/dist/access-cli.d.ts +13 -3
  6. package/dist/access-cli.js +96 -80
  7. package/dist/access-cli.js.map +1 -1
  8. package/dist/access-http.d.ts +12 -4
  9. package/dist/access-http.js +25 -18
  10. package/dist/access-mcp.d.ts +32 -4
  11. package/dist/access-mcp.js +16 -1
  12. package/dist/access-schema.d.ts +28 -28
  13. package/dist/access-schema.js +1 -1
  14. package/dist/access-service-HmO1Trrx.d.ts +732 -0
  15. package/dist/access-service.d.ts +15 -601
  16. package/dist/access-service.js +21 -15
  17. package/dist/active-memory-bridge.d.ts +66 -0
  18. package/dist/active-memory-bridge.js +11 -0
  19. package/dist/active-memory-bridge.js.map +1 -0
  20. package/dist/active-recall.d.ts +96 -0
  21. package/dist/active-recall.js +308 -0
  22. package/dist/active-recall.js.map +1 -0
  23. package/dist/behavior-learner.js +1 -1
  24. package/dist/bootstrap.d.ts +6 -3
  25. package/dist/bootstrap.js +2 -2
  26. package/dist/boxes.js +2 -2
  27. package/dist/briefing.d.ts +169 -0
  28. package/dist/briefing.js +52 -0
  29. package/dist/briefing.js.map +1 -0
  30. package/dist/buffer.d.ts +19 -5
  31. package/dist/buffer.js +2 -2
  32. package/dist/calibration.js +6 -6
  33. package/dist/causal-behavior.js +5 -5
  34. package/dist/causal-chain.js +3 -3
  35. package/dist/causal-consolidation.d.ts +22 -2
  36. package/dist/causal-consolidation.js +36 -9
  37. package/dist/causal-consolidation.js.map +1 -1
  38. package/dist/causal-retrieval.js +6 -6
  39. package/dist/causal-trajectory-graph.js +1 -1
  40. package/dist/causal-trajectory.d.ts +14 -1
  41. package/dist/causal-trajectory.js +5 -1
  42. package/dist/{chunk-KWBU5S5U.js → chunk-2ODBA7MQ.js} +9 -3
  43. package/dist/chunk-2ODBA7MQ.js.map +1 -0
  44. package/dist/{chunk-ZJLY4QSU.js → chunk-37UIFYWO.js} +130 -6
  45. package/dist/chunk-37UIFYWO.js.map +1 -0
  46. package/dist/chunk-3PG3H5TD.js +7 -0
  47. package/dist/chunk-3PG3H5TD.js.map +1 -0
  48. package/dist/{chunk-NTTLPF7F.js → chunk-3QFQGRHO.js} +5 -5
  49. package/dist/{chunk-QDOSNLB4.js → chunk-3QHL5ABG.js} +17 -15
  50. package/dist/chunk-3QHL5ABG.js.map +1 -0
  51. package/dist/{chunk-6UJQNRIO.js → chunk-3SV6CQHO.js} +92 -33
  52. package/dist/chunk-3SV6CQHO.js.map +1 -0
  53. package/dist/{chunk-U4PV25RD.js → chunk-3WHVNEN7.js} +1 -1
  54. package/dist/chunk-3WHVNEN7.js.map +1 -0
  55. package/dist/{chunk-XUHI52HK.js → chunk-44ICJRF3.js} +98 -10
  56. package/dist/chunk-44ICJRF3.js.map +1 -0
  57. package/dist/{chunk-HG2NKWR2.js → chunk-47UU5PU2.js} +49 -10
  58. package/dist/chunk-47UU5PU2.js.map +1 -0
  59. package/dist/chunk-4DJQYKMN.js +187 -0
  60. package/dist/chunk-4DJQYKMN.js.map +1 -0
  61. package/dist/chunk-4KAN3GZ3.js +225 -0
  62. package/dist/chunk-4KAN3GZ3.js.map +1 -0
  63. package/dist/chunk-4LACOVZX.js +813 -0
  64. package/dist/chunk-4LACOVZX.js.map +1 -0
  65. package/dist/{chunk-ORZMT74A.js → chunk-4NRAJUDS.js} +11 -1
  66. package/dist/chunk-4NRAJUDS.js.map +1 -0
  67. package/dist/{chunk-B7LOFDVE.js → chunk-4WMCPJWX.js} +8 -3
  68. package/dist/chunk-4WMCPJWX.js.map +1 -0
  69. package/dist/{chunk-G3AG3KZN.js → chunk-5IZL4DCV.js} +2 -2
  70. package/dist/{chunk-BRK4ODMI.js → chunk-5NPGSAVB.js} +2 -2
  71. package/dist/{chunk-QANCTXQF.js → chunk-6LX5ORAS.js} +3 -3
  72. package/dist/chunk-6MKAMLQL.js +16 -0
  73. package/dist/chunk-6MKAMLQL.js.map +1 -0
  74. package/dist/{chunk-ESSMF2FR.js → chunk-6PFRXT4K.js} +15 -6
  75. package/dist/chunk-6PFRXT4K.js.map +1 -0
  76. package/dist/{chunk-UIYZ5T3I.js → chunk-6UJ47TVX.js} +8 -8
  77. package/dist/chunk-6ZH4TU6I.js +245 -0
  78. package/dist/chunk-6ZH4TU6I.js.map +1 -0
  79. package/dist/{chunk-L5RPWGFK.js → chunk-7DHTMOND.js} +2 -2
  80. package/dist/{chunk-L7WO3MZ4.js → chunk-7ECD5ATE.js} +2 -2
  81. package/dist/{chunk-Q6FETXJA.js → chunk-7SEAZFFB.js} +2 -2
  82. package/dist/{chunk-V4YC4LUK.js → chunk-7WQ6SLIE.js} +175 -63
  83. package/dist/chunk-7WQ6SLIE.js.map +1 -0
  84. package/dist/chunk-ALXMCZEU.js +332 -0
  85. package/dist/chunk-ALXMCZEU.js.map +1 -0
  86. package/dist/{chunk-TVVVQQAK.js → chunk-BLKTA7MM.js} +58 -24
  87. package/dist/chunk-BLKTA7MM.js.map +1 -0
  88. package/dist/{chunk-SCHEKPYH.js → chunk-C2EFFULQ.js} +1 -1
  89. package/dist/{chunk-GJR6D6KC.js → chunk-D654IBA6.js} +2 -2
  90. package/dist/{chunk-OTFNI3OO.js → chunk-DEPL3635.js} +1828 -401
  91. package/dist/chunk-DEPL3635.js.map +1 -0
  92. package/dist/{chunk-UYSKNO6E.js → chunk-DHHP2Z4X.js} +15 -4
  93. package/dist/chunk-DHHP2Z4X.js.map +1 -0
  94. package/dist/{chunk-UV2FO7J4.js → chunk-E6K4NIEU.js} +2 -2
  95. package/dist/{chunk-T4WRIV2C.js → chunk-EABGC2TL.js} +2 -2
  96. package/dist/chunk-EJI5XIBB.js +232 -0
  97. package/dist/chunk-EJI5XIBB.js.map +1 -0
  98. package/dist/{chunk-ONRU4L2N.js → chunk-FEMOX5AD.js} +2 -2
  99. package/dist/{chunk-IFFFR3MR.js → chunk-FSFEQI74.js} +3 -3
  100. package/dist/chunk-G4SK7DSQ.js +121 -0
  101. package/dist/chunk-G4SK7DSQ.js.map +1 -0
  102. package/dist/{chunk-WWIQTB2Y.js → chunk-GGD5W7TB.js} +9 -2
  103. package/dist/chunk-GGD5W7TB.js.map +1 -0
  104. package/dist/{chunk-QWUUMMIK.js → chunk-GV6NLQ4X.js} +1355 -80
  105. package/dist/chunk-GV6NLQ4X.js.map +1 -0
  106. package/dist/{chunk-2PO5ZRKV.js → chunk-GZCUW5IC.js} +16 -3
  107. package/dist/chunk-GZCUW5IC.js.map +1 -0
  108. package/dist/{chunk-AAI7JARD.js → chunk-HMDCOMYU.js} +8 -11
  109. package/dist/chunk-HMDCOMYU.js.map +1 -0
  110. package/dist/chunk-IQT3XTKW.js +121 -0
  111. package/dist/chunk-IQT3XTKW.js.map +1 -0
  112. package/dist/{chunk-J3BT33K7.js → chunk-ITRLGI2T.js} +5 -5
  113. package/dist/{chunk-BDFZXRSO.js → chunk-J4IYOZZ5.js} +15 -2
  114. package/dist/chunk-J4IYOZZ5.js.map +1 -0
  115. package/dist/{chunk-J47FNDR7.js → chunk-JIU55F3X.js} +7 -7
  116. package/dist/{chunk-MDDAA2AO.js → chunk-JL2PU6AI.js} +17 -6
  117. package/dist/chunk-JL2PU6AI.js.map +1 -0
  118. package/dist/{chunk-ZKYI7UVO.js → chunk-JR4ZC3G4.js} +2 -2
  119. package/dist/{chunk-UCYSTFZR.js → chunk-JRNQ3RNA.js} +2 -2
  120. package/dist/{chunk-GPGBSNKM.js → chunk-K4FLSOR5.js} +2 -2
  121. package/dist/chunk-KVE7R4CG.js +320 -0
  122. package/dist/chunk-KVE7R4CG.js.map +1 -0
  123. package/dist/chunk-LAYN4LDC.js +267 -0
  124. package/dist/chunk-LAYN4LDC.js.map +1 -0
  125. package/dist/{chunk-ISY75RLM.js → chunk-MBJHSA7F.js} +344 -7
  126. package/dist/chunk-MBJHSA7F.js.map +1 -0
  127. package/dist/{chunk-PGK3VUHN.js → chunk-MTLYEMJB.js} +3 -2
  128. package/dist/chunk-MTLYEMJB.js.map +1 -0
  129. package/dist/{chunk-QY2BHY5O.js → chunk-MVTHXUBX.js} +297 -34
  130. package/dist/chunk-MVTHXUBX.js.map +1 -0
  131. package/dist/{chunk-LP47L3ZX.js → chunk-N42IWANG.js} +5 -5
  132. package/dist/{chunk-YNI4S5WT.js → chunk-N53K2EXC.js} +2 -2
  133. package/dist/{chunk-763GUIOU.js → chunk-NBNN5GOB.js} +2 -2
  134. package/dist/{chunk-CXWFUJR2.js → chunk-NQEVYWX6.js} +195 -5
  135. package/dist/chunk-NQEVYWX6.js.map +1 -0
  136. package/dist/{chunk-KL4CP4SB.js → chunk-O5ETUNBT.js} +17 -5
  137. package/dist/chunk-O5ETUNBT.js.map +1 -0
  138. package/dist/{chunk-OOSWAUYB.js → chunk-ODWDQNRE.js} +2 -2
  139. package/dist/chunk-OIT5QGG4.js +80 -0
  140. package/dist/chunk-OIT5QGG4.js.map +1 -0
  141. package/dist/{chunk-HLBYLYRD.js → chunk-PAORGQRI.js} +70 -13
  142. package/dist/chunk-PAORGQRI.js.map +1 -0
  143. package/dist/chunk-PVGDJXVK.js +21 -0
  144. package/dist/chunk-PVGDJXVK.js.map +1 -0
  145. package/dist/{chunk-OTAVQCSF.js → chunk-PYXS46O7.js} +2 -2
  146. package/dist/chunk-QDW3E4RD.js +108 -0
  147. package/dist/chunk-QDW3E4RD.js.map +1 -0
  148. package/dist/{chunk-YNCQ7E4M.js → chunk-QDYXG4CS.js} +4 -3
  149. package/dist/chunk-QDYXG4CS.js.map +1 -0
  150. package/dist/{chunk-HLXVTBF3.js → chunk-QNJMBKFK.js} +3 -2
  151. package/dist/chunk-QNJMBKFK.js.map +1 -0
  152. package/dist/{chunk-4A24LIM2.js → chunk-S75M5ZRK.js} +2 -2
  153. package/dist/chunk-SYUK3VLY.js +789 -0
  154. package/dist/chunk-SYUK3VLY.js.map +1 -0
  155. package/dist/{chunk-QCCCQT3O.js → chunk-TBBDFYXW.js} +2 -2
  156. package/dist/chunk-TBBDFYXW.js.map +1 -0
  157. package/dist/chunk-U66YHYC7.js +31 -0
  158. package/dist/chunk-U66YHYC7.js.map +1 -0
  159. package/dist/{chunk-MWGVGUIS.js → chunk-UEYA6UC7.js} +36 -4
  160. package/dist/chunk-UEYA6UC7.js.map +1 -0
  161. package/dist/{chunk-M5KEYE5E.js → chunk-URB2WSKZ.js} +2 -2
  162. package/dist/chunk-UVJFDP7P.js +202 -0
  163. package/dist/chunk-UVJFDP7P.js.map +1 -0
  164. package/dist/chunk-W6SL7OFG.js +180 -0
  165. package/dist/chunk-W6SL7OFG.js.map +1 -0
  166. package/dist/chunk-WBSAYXVI.js +7945 -0
  167. package/dist/chunk-WBSAYXVI.js.map +1 -0
  168. package/dist/{chunk-M5ZBBBJI.js → chunk-XZ2TIKGC.js} +39 -9
  169. package/dist/chunk-XZ2TIKGC.js.map +1 -0
  170. package/dist/chunk-Y4FHOFJ2.js +140 -0
  171. package/dist/chunk-Y4FHOFJ2.js.map +1 -0
  172. package/dist/chunk-YDBIWGNI.js +298 -0
  173. package/dist/chunk-YDBIWGNI.js.map +1 -0
  174. package/dist/chunk-YNB73F22.js +137 -0
  175. package/dist/chunk-YNB73F22.js.map +1 -0
  176. package/dist/{chunk-IZME7KW2.js → chunk-ZVBB3T7V.js} +31 -12
  177. package/dist/chunk-ZVBB3T7V.js.map +1 -0
  178. package/dist/chunking.js +1 -1
  179. package/dist/citations.d.ts +67 -0
  180. package/dist/citations.js +13 -0
  181. package/dist/citations.js.map +1 -0
  182. package/dist/cli-BneVIEvh.d.ts +1240 -0
  183. package/dist/cli.d.ts +32 -1147
  184. package/dist/cli.js +150 -7092
  185. package/dist/cli.js.map +1 -1
  186. package/dist/codex-materialize-CQlLTzke.d.ts +139 -0
  187. package/dist/codex-thread-key.d.ts +3 -0
  188. package/dist/codex-thread-key.js +7 -0
  189. package/dist/codex-thread-key.js.map +1 -0
  190. package/dist/config.js +3 -2
  191. package/dist/connectors/codex/instructions.md +160 -0
  192. package/dist/connectors/codex/resources/namespace-cheatsheet.md +48 -0
  193. package/dist/contradiction-review-WIUBAR52.js +21 -0
  194. package/dist/contradiction-review-WIUBAR52.js.map +1 -0
  195. package/dist/contradiction-scan-GR33PONM.js +376 -0
  196. package/dist/contradiction-scan-GR33PONM.js.map +1 -0
  197. package/dist/day-summary.d.ts +7 -2
  198. package/dist/day-summary.js +5 -2
  199. package/dist/direct-answer-wiring.d.ts +77 -0
  200. package/dist/direct-answer-wiring.js +75 -0
  201. package/dist/direct-answer-wiring.js.map +1 -0
  202. package/dist/direct-answer.d.ts +106 -0
  203. package/dist/direct-answer.js +10 -0
  204. package/dist/direct-answer.js.map +1 -0
  205. package/dist/embedding-fallback.d.ts +96 -2
  206. package/dist/embedding-fallback.js +6 -4
  207. package/dist/{engine-2A6J4XEX.js → engine-5TIQBYZR.js} +10 -7
  208. package/dist/engine-5TIQBYZR.js.map +1 -0
  209. package/dist/entity-retrieval.d.ts +3 -2
  210. package/dist/entity-retrieval.js +10 -7
  211. package/dist/entity-schema.d.ts +11 -0
  212. package/dist/entity-schema.js +19 -0
  213. package/dist/entity-schema.js.map +1 -0
  214. package/dist/explicit-capture.d.ts +6 -3
  215. package/dist/explicit-capture.js +2 -2
  216. package/dist/extraction-judge.d.ts +66 -0
  217. package/dist/extraction-judge.js +18 -0
  218. package/dist/extraction-judge.js.map +1 -0
  219. package/dist/extraction.d.ts +1 -0
  220. package/dist/extraction.js +12 -10
  221. package/dist/fallback-llm.d.ts +11 -2
  222. package/dist/fallback-llm.js +4 -4
  223. package/dist/graph.js +1 -1
  224. package/dist/harmonic-retrieval.js +2 -1
  225. package/dist/importance.d.ts +11 -1
  226. package/dist/importance.js +3 -1
  227. package/dist/index.d.ts +1027 -9
  228. package/dist/index.js +3303 -349
  229. package/dist/index.js.map +1 -1
  230. package/dist/intent.d.ts +2 -1
  231. package/dist/intent.js +3 -1
  232. package/dist/lifecycle.js +1 -1
  233. package/dist/local-llm.d.ts +10 -3
  234. package/dist/local-llm.js +2 -2
  235. package/dist/logger.d.ts +1 -1
  236. package/dist/logger.js +1 -1
  237. package/dist/memory-cache.d.ts +2 -2
  238. package/dist/memory-cache.js +1 -1
  239. package/dist/{memory-projection-store-NxMkbocT.d.ts → memory-projection-store-DeSXPh1j.d.ts} +1 -1
  240. package/dist/memory-projection-store.d.ts +1 -1
  241. package/dist/model-registry.js +2 -2
  242. package/dist/models-json.js +2 -2
  243. package/dist/native-knowledge.js +2 -2
  244. package/dist/negative.js +2 -2
  245. package/dist/operator-toolkit.js +20 -15
  246. package/dist/{orchestrator-zTa-Qo-1.d.ts → orchestrator-DRYA6_lW.d.ts} +273 -9
  247. package/dist/orchestrator.d.ts +6 -3
  248. package/dist/orchestrator.js +76 -63
  249. package/dist/page-versioning.d.ts +77 -0
  250. package/dist/page-versioning.js +15 -0
  251. package/dist/page-versioning.js.map +1 -0
  252. package/dist/plugin-id.d.ts +37 -0
  253. package/dist/plugin-id.js +11 -0
  254. package/dist/plugin-id.js.map +1 -0
  255. package/dist/policy-runtime.js +2 -2
  256. package/dist/profiling.js +2 -2
  257. package/dist/qmd.d.ts +5 -2
  258. package/dist/qmd.js +4 -3
  259. package/dist/recall-audit.d.ts +20 -0
  260. package/dist/recall-audit.js +50 -0
  261. package/dist/recall-audit.js.map +1 -0
  262. package/dist/recall-mmr.d.ts +152 -0
  263. package/dist/recall-mmr.js +17 -0
  264. package/dist/recall-mmr.js.map +1 -0
  265. package/dist/recall-qos.js +2 -2
  266. package/dist/recall-state.d.ts +28 -1
  267. package/dist/recall-state.js +2 -2
  268. package/dist/relevance.js +2 -2
  269. package/dist/resolution-QBTDHTG7.js +100 -0
  270. package/dist/resolution-QBTDHTG7.js.map +1 -0
  271. package/dist/resolve-provider-secret.d.ts +24 -1
  272. package/dist/resolve-provider-secret.js +4 -2
  273. package/dist/resume-bundles.js +6 -5
  274. package/dist/retrieval-agents.js +2 -2
  275. package/dist/retrieval.js +2 -2
  276. package/dist/schemas.d.ts +412 -54
  277. package/dist/schemas.js +3 -1
  278. package/dist/sdk-compat.d.ts +2 -0
  279. package/dist/sdk-compat.js +6 -3
  280. package/dist/sdk-compat.js.map +1 -1
  281. package/dist/semantic-chunking.d.ts +87 -0
  282. package/dist/semantic-chunking.js +20 -0
  283. package/dist/semantic-chunking.js.map +1 -0
  284. package/dist/semantic-consolidation-DrvSYRdB.d.ts +119 -0
  285. package/dist/semantic-consolidation.d.ts +4 -42
  286. package/dist/semantic-consolidation.js +23 -2
  287. package/dist/semantic-rule-promotion.js +9 -6
  288. package/dist/semantic-rule-verifier.js +10 -7
  289. package/dist/session-observer-state.js +2 -2
  290. package/dist/session-toggles.d.ts +22 -0
  291. package/dist/session-toggles.js +116 -0
  292. package/dist/session-toggles.js.map +1 -0
  293. package/dist/skills-registry.d.ts +47 -0
  294. package/dist/skills-registry.js +48 -0
  295. package/dist/skills-registry.js.map +1 -0
  296. package/dist/source-attribution.d.ts +169 -0
  297. package/dist/source-attribution.js +27 -0
  298. package/dist/source-attribution.js.map +1 -0
  299. package/dist/storage.d.ts +171 -10
  300. package/dist/storage.js +16 -5
  301. package/dist/summarizer.js +7 -7
  302. package/dist/temporal-supersession.d.ts +127 -0
  303. package/dist/temporal-supersession.js +20 -0
  304. package/dist/temporal-supersession.js.map +1 -0
  305. package/dist/threading.js +2 -2
  306. package/dist/tier-migration.d.ts +2 -1
  307. package/dist/tier-routing.js +2 -2
  308. package/dist/tokens.d.ts +21 -1
  309. package/dist/tokens.js +5 -1
  310. package/dist/transcript.js +2 -2
  311. package/dist/types-DJhqDJUV.d.ts +50 -0
  312. package/dist/types.d.ts +529 -3
  313. package/dist/types.js +1 -1
  314. package/dist/utility-learner.js +2 -2
  315. package/dist/utility-runtime.js +3 -3
  316. package/dist/verified-recall.js +11 -8
  317. package/dist/whitespace.d.ts +4 -0
  318. package/dist/whitespace.js +9 -0
  319. package/dist/whitespace.js.map +1 -0
  320. package/package.json +14 -8
  321. package/dist/chunk-2CJCWDMR.js +0 -87
  322. package/dist/chunk-2CJCWDMR.js.map +0 -1
  323. package/dist/chunk-2PO5ZRKV.js.map +0 -1
  324. package/dist/chunk-6UJQNRIO.js.map +0 -1
  325. package/dist/chunk-AAI7JARD.js.map +0 -1
  326. package/dist/chunk-B7LOFDVE.js.map +0 -1
  327. package/dist/chunk-BDFZXRSO.js.map +0 -1
  328. package/dist/chunk-CXWFUJR2.js.map +0 -1
  329. package/dist/chunk-DORBM6OB.js +0 -81
  330. package/dist/chunk-DORBM6OB.js.map +0 -1
  331. package/dist/chunk-ESSMF2FR.js.map +0 -1
  332. package/dist/chunk-HG2NKWR2.js.map +0 -1
  333. package/dist/chunk-HLBYLYRD.js.map +0 -1
  334. package/dist/chunk-HLXVTBF3.js.map +0 -1
  335. package/dist/chunk-ISY75RLM.js.map +0 -1
  336. package/dist/chunk-IZME7KW2.js.map +0 -1
  337. package/dist/chunk-KL4CP4SB.js.map +0 -1
  338. package/dist/chunk-KWBU5S5U.js.map +0 -1
  339. package/dist/chunk-M5ZBBBJI.js.map +0 -1
  340. package/dist/chunk-MDDAA2AO.js.map +0 -1
  341. package/dist/chunk-MWGVGUIS.js.map +0 -1
  342. package/dist/chunk-ORZMT74A.js.map +0 -1
  343. package/dist/chunk-OTFNI3OO.js.map +0 -1
  344. package/dist/chunk-PGK3VUHN.js.map +0 -1
  345. package/dist/chunk-QCCCQT3O.js.map +0 -1
  346. package/dist/chunk-QDOSNLB4.js.map +0 -1
  347. package/dist/chunk-QPKFPHOO.js +0 -178
  348. package/dist/chunk-QPKFPHOO.js.map +0 -1
  349. package/dist/chunk-QWUUMMIK.js.map +0 -1
  350. package/dist/chunk-QY2BHY5O.js.map +0 -1
  351. package/dist/chunk-TVVVQQAK.js.map +0 -1
  352. package/dist/chunk-U4PV25RD.js.map +0 -1
  353. package/dist/chunk-UYSKNO6E.js.map +0 -1
  354. package/dist/chunk-V4YC4LUK.js.map +0 -1
  355. package/dist/chunk-WWIQTB2Y.js.map +0 -1
  356. package/dist/chunk-XUHI52HK.js.map +0 -1
  357. package/dist/chunk-YNCQ7E4M.js.map +0 -1
  358. package/dist/chunk-ZJLY4QSU.js.map +0 -1
  359. /package/dist/{engine-2A6J4XEX.js.map → abort-error.js.map} +0 -0
  360. /package/dist/{chunk-NTTLPF7F.js.map → chunk-3QFQGRHO.js.map} +0 -0
  361. /package/dist/{chunk-G3AG3KZN.js.map → chunk-5IZL4DCV.js.map} +0 -0
  362. /package/dist/{chunk-BRK4ODMI.js.map → chunk-5NPGSAVB.js.map} +0 -0
  363. /package/dist/{chunk-QANCTXQF.js.map → chunk-6LX5ORAS.js.map} +0 -0
  364. /package/dist/{chunk-UIYZ5T3I.js.map → chunk-6UJ47TVX.js.map} +0 -0
  365. /package/dist/{chunk-L5RPWGFK.js.map → chunk-7DHTMOND.js.map} +0 -0
  366. /package/dist/{chunk-L7WO3MZ4.js.map → chunk-7ECD5ATE.js.map} +0 -0
  367. /package/dist/{chunk-Q6FETXJA.js.map → chunk-7SEAZFFB.js.map} +0 -0
  368. /package/dist/{chunk-SCHEKPYH.js.map → chunk-C2EFFULQ.js.map} +0 -0
  369. /package/dist/{chunk-GJR6D6KC.js.map → chunk-D654IBA6.js.map} +0 -0
  370. /package/dist/{chunk-UV2FO7J4.js.map → chunk-E6K4NIEU.js.map} +0 -0
  371. /package/dist/{chunk-T4WRIV2C.js.map → chunk-EABGC2TL.js.map} +0 -0
  372. /package/dist/{chunk-ONRU4L2N.js.map → chunk-FEMOX5AD.js.map} +0 -0
  373. /package/dist/{chunk-IFFFR3MR.js.map → chunk-FSFEQI74.js.map} +0 -0
  374. /package/dist/{chunk-J3BT33K7.js.map → chunk-ITRLGI2T.js.map} +0 -0
  375. /package/dist/{chunk-J47FNDR7.js.map → chunk-JIU55F3X.js.map} +0 -0
  376. /package/dist/{chunk-ZKYI7UVO.js.map → chunk-JR4ZC3G4.js.map} +0 -0
  377. /package/dist/{chunk-UCYSTFZR.js.map → chunk-JRNQ3RNA.js.map} +0 -0
  378. /package/dist/{chunk-GPGBSNKM.js.map → chunk-K4FLSOR5.js.map} +0 -0
  379. /package/dist/{chunk-LP47L3ZX.js.map → chunk-N42IWANG.js.map} +0 -0
  380. /package/dist/{chunk-YNI4S5WT.js.map → chunk-N53K2EXC.js.map} +0 -0
  381. /package/dist/{chunk-763GUIOU.js.map → chunk-NBNN5GOB.js.map} +0 -0
  382. /package/dist/{chunk-OOSWAUYB.js.map → chunk-ODWDQNRE.js.map} +0 -0
  383. /package/dist/{chunk-OTAVQCSF.js.map → chunk-PYXS46O7.js.map} +0 -0
  384. /package/dist/{chunk-4A24LIM2.js.map → chunk-S75M5ZRK.js.map} +0 -0
  385. /package/dist/{chunk-M5KEYE5E.js.map → chunk-URB2WSKZ.js.map} +0 -0
@@ -0,0 +1,47 @@
1
+ /**
2
+ * skills-registry.ts
3
+ *
4
+ * Built-in Remnic procedural memory skills — the canonical SKILL.md sources
5
+ * shipped with the monorepo. Consumers (e.g. the Codex materializer in #378)
6
+ * read this registry to discover which skills to materialize into
7
+ * `~/.codex/memories/skills/<slug>/SKILL.md`.
8
+ *
9
+ * This module is intentionally free of Codex/Claude Code host coupling —
10
+ * it only exposes the static metadata each host needs.
11
+ */
12
+ /**
13
+ * A single procedural-memory skill source that Remnic ships.
14
+ *
15
+ * - `slug` is the canonical folder name under `skills/` and the file on disk
16
+ * must live at `<pluginRoot>/skills/<slug>/SKILL.md`.
17
+ * - `staticPath`, when set, points at a pre-authored SKILL.md on disk.
18
+ * - `generator`, when set, produces a SKILL.md body at materialization time.
19
+ * Exactly one of `staticPath` or `generator` should be provided.
20
+ * - `disableModelInvocation` mirrors the `disable-model-invocation` frontmatter
21
+ * key and indicates a skill that writes or mutates state and therefore
22
+ * should not be auto-invoked by a model without explicit opt-in.
23
+ */
24
+ interface RemnicSkillSource {
25
+ slug: string;
26
+ staticPath?: string;
27
+ generator?: () => Promise<string>;
28
+ disableModelInvocation: boolean;
29
+ }
30
+ /**
31
+ * Validate a Remnic skill slug. Rules:
32
+ *
33
+ * - lowercase letters, digits, and `-` only
34
+ * - must start with a letter or digit
35
+ * - 1–64 characters
36
+ *
37
+ * This is the same shape the Codex skills directory expects.
38
+ */
39
+ declare function isValidSkillSlug(slug: string): boolean;
40
+ /**
41
+ * The canonical list of Remnic procedural memory skills shipped with the
42
+ * monorepo. The Codex materializer (#378) copies these into
43
+ * `~/.codex/memories/skills/<slug>/SKILL.md`.
44
+ */
45
+ declare const BUILTIN_SKILLS: RemnicSkillSource[];
46
+
47
+ export { BUILTIN_SKILLS, type RemnicSkillSource, isValidSkillSlug };
@@ -0,0 +1,48 @@
1
+ // src/skills-registry.ts
2
+ import { fileURLToPath } from "url";
3
+ import { dirname, resolve } from "path";
4
+ function isValidSkillSlug(slug) {
5
+ return /^[a-z0-9](?:[a-z0-9]|-(?=[a-z0-9])){0,63}$/.test(slug);
6
+ }
7
+ var HERE = dirname(fileURLToPath(import.meta.url));
8
+ var PLUGIN_CODEX_SKILLS_DIR = resolve(HERE, "..", "..", "plugin-codex", "skills");
9
+ function codexSkillPath(slug) {
10
+ return resolve(PLUGIN_CODEX_SKILLS_DIR, slug, "SKILL.md");
11
+ }
12
+ var BUILTIN_SKILLS = [
13
+ {
14
+ slug: "remnic-memory-workflow",
15
+ staticPath: codexSkillPath("remnic-memory-workflow"),
16
+ disableModelInvocation: true
17
+ },
18
+ {
19
+ slug: "remnic-recall",
20
+ staticPath: codexSkillPath("remnic-recall"),
21
+ disableModelInvocation: false
22
+ },
23
+ {
24
+ slug: "remnic-remember",
25
+ staticPath: codexSkillPath("remnic-remember"),
26
+ disableModelInvocation: true
27
+ },
28
+ {
29
+ slug: "remnic-search",
30
+ staticPath: codexSkillPath("remnic-search"),
31
+ disableModelInvocation: false
32
+ },
33
+ {
34
+ slug: "remnic-entities",
35
+ staticPath: codexSkillPath("remnic-entities"),
36
+ disableModelInvocation: false
37
+ },
38
+ {
39
+ slug: "remnic-status",
40
+ staticPath: codexSkillPath("remnic-status"),
41
+ disableModelInvocation: false
42
+ }
43
+ ];
44
+ export {
45
+ BUILTIN_SKILLS,
46
+ isValidSkillSlug
47
+ };
48
+ //# sourceMappingURL=skills-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/skills-registry.ts"],"sourcesContent":["/**\n * skills-registry.ts\n *\n * Built-in Remnic procedural memory skills — the canonical SKILL.md sources\n * shipped with the monorepo. Consumers (e.g. the Codex materializer in #378)\n * read this registry to discover which skills to materialize into\n * `~/.codex/memories/skills/<slug>/SKILL.md`.\n *\n * This module is intentionally free of Codex/Claude Code host coupling —\n * it only exposes the static metadata each host needs.\n */\n\nimport { fileURLToPath } from \"node:url\";\nimport { dirname, resolve } from \"node:path\";\n\n/**\n * A single procedural-memory skill source that Remnic ships.\n *\n * - `slug` is the canonical folder name under `skills/` and the file on disk\n * must live at `<pluginRoot>/skills/<slug>/SKILL.md`.\n * - `staticPath`, when set, points at a pre-authored SKILL.md on disk.\n * - `generator`, when set, produces a SKILL.md body at materialization time.\n * Exactly one of `staticPath` or `generator` should be provided.\n * - `disableModelInvocation` mirrors the `disable-model-invocation` frontmatter\n * key and indicates a skill that writes or mutates state and therefore\n * should not be auto-invoked by a model without explicit opt-in.\n */\nexport interface RemnicSkillSource {\n slug: string;\n staticPath?: string;\n generator?: () => Promise<string>;\n disableModelInvocation: boolean;\n}\n\n/**\n * Validate a Remnic skill slug. Rules:\n *\n * - lowercase letters, digits, and `-` only\n * - must start with a letter or digit\n * - 1–64 characters\n *\n * This is the same shape the Codex skills directory expects.\n */\nexport function isValidSkillSlug(slug: string): boolean {\n // Must start with alphanumeric; each dash must be followed by alphanumeric\n // (no trailing dashes, no consecutive dashes); 1–64 characters total.\n return /^[a-z0-9](?:[a-z0-9]|-(?=[a-z0-9])){0,63}$/.test(slug);\n}\n\n// ---------------------------------------------------------------------------\n// Built-in skill paths — resolved relative to this source file.\n// ---------------------------------------------------------------------------\n//\n// This file lives at `packages/remnic-core/src/skills-registry.ts`.\n// After tsup build it lives at `packages/remnic-core/dist/skills-registry.js`.\n// In both cases, the shipped skill sources live four levels up at\n// `packages/plugin-codex/skills/<slug>/SKILL.md`.\n//\n// We compute the absolute path from the current module so that callers in any\n// cwd can resolve the files.\n\nconst HERE = dirname(fileURLToPath(import.meta.url));\nconst PLUGIN_CODEX_SKILLS_DIR = resolve(HERE, \"..\", \"..\", \"plugin-codex\", \"skills\");\n\nfunction codexSkillPath(slug: string): string {\n return resolve(PLUGIN_CODEX_SKILLS_DIR, slug, \"SKILL.md\");\n}\n\n/**\n * The canonical list of Remnic procedural memory skills shipped with the\n * monorepo. The Codex materializer (#378) copies these into\n * `~/.codex/memories/skills/<slug>/SKILL.md`.\n */\nexport const BUILTIN_SKILLS: RemnicSkillSource[] = [\n {\n slug: \"remnic-memory-workflow\",\n staticPath: codexSkillPath(\"remnic-memory-workflow\"),\n disableModelInvocation: true,\n },\n {\n slug: \"remnic-recall\",\n staticPath: codexSkillPath(\"remnic-recall\"),\n disableModelInvocation: false,\n },\n {\n slug: \"remnic-remember\",\n staticPath: codexSkillPath(\"remnic-remember\"),\n disableModelInvocation: true,\n },\n {\n slug: \"remnic-search\",\n staticPath: codexSkillPath(\"remnic-search\"),\n disableModelInvocation: false,\n },\n {\n slug: \"remnic-entities\",\n staticPath: codexSkillPath(\"remnic-entities\"),\n disableModelInvocation: false,\n },\n {\n slug: \"remnic-status\",\n staticPath: codexSkillPath(\"remnic-status\"),\n disableModelInvocation: false,\n },\n];\n"],"mappings":";AAYA,SAAS,qBAAqB;AAC9B,SAAS,SAAS,eAAe;AA8B1B,SAAS,iBAAiB,MAAuB;AAGtD,SAAO,6CAA6C,KAAK,IAAI;AAC/D;AAcA,IAAM,OAAO,QAAQ,cAAc,YAAY,GAAG,CAAC;AACnD,IAAM,0BAA0B,QAAQ,MAAM,MAAM,MAAM,gBAAgB,QAAQ;AAElF,SAAS,eAAe,MAAsB;AAC5C,SAAO,QAAQ,yBAAyB,MAAM,UAAU;AAC1D;AAOO,IAAM,iBAAsC;AAAA,EACjD;AAAA,IACE,MAAM;AAAA,IACN,YAAY,eAAe,wBAAwB;AAAA,IACnD,wBAAwB;AAAA,EAC1B;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,YAAY,eAAe,eAAe;AAAA,IAC1C,wBAAwB;AAAA,EAC1B;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,YAAY,eAAe,iBAAiB;AAAA,IAC5C,wBAAwB;AAAA,EAC1B;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,YAAY,eAAe,eAAe;AAAA,IAC1C,wBAAwB;AAAA,EAC1B;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,YAAY,eAAe,iBAAiB;AAAA,IAC5C,wBAAwB;AAAA,EAC1B;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,YAAY,eAAe,eAAe;AAAA,IAC1C,wBAAwB;AAAA,EAC1B;AACF;","names":[]}
@@ -0,0 +1,169 @@
1
+ /**
2
+ * Inline Source Attribution Protocol (issue #369)
3
+ *
4
+ * Extracted facts carry provenance inline inside the fact body, so the
5
+ * citation survives prompt injection, copy/paste, and LLM quoting. This
6
+ * complements — never replaces — the YAML frontmatter provenance stored on
7
+ * disk.
8
+ *
9
+ * Default format (matches issue #369 proposal):
10
+ *
11
+ * The foo service uses Redis for rate limiting. [Source: agent=planner, session=abc123, ts=2026-04-10T14:25:07Z]
12
+ *
13
+ * Key properties:
14
+ * - Inline (part of the body, not metadata).
15
+ * - Compact (typically <80 chars of overhead per fact).
16
+ * - Machine-parseable by a single regex.
17
+ * - Opt-in via `inlineSourceAttributionEnabled` config flag (default off
18
+ * for backwards compatibility with existing downstream consumers).
19
+ * - Legacy facts without a citation remain fully readable.
20
+ *
21
+ * The format template is configurable via `inlineSourceAttributionFormat`
22
+ * with supported placeholders:
23
+ *
24
+ * {agent} — principal / agent identifier
25
+ * {session} — full session key (colon-delimited)
26
+ * {sessionId} — short stable session id (trailing component)
27
+ * {ts} — extraction timestamp (ISO 8601)
28
+ * {date} — extraction date (YYYY-MM-DD)
29
+ *
30
+ * Any privacy-sensitive identifiers should be normalized before being passed
31
+ * to `formatCitation` — the helper treats them as opaque strings.
32
+ */
33
+ /** Default citation format template (matches issue #369). */
34
+ declare const DEFAULT_CITATION_FORMAT = "[Source: agent={agent}, session={sessionId}, ts={ts}]";
35
+ /** Sentinel value used when a provenance field is missing. */
36
+ declare const CITATION_UNKNOWN = "unknown";
37
+ interface CitationContext {
38
+ /** Principal / agent identifier (e.g. resolved via resolvePrincipal). */
39
+ agent?: string;
40
+ /** Full session key (e.g. "agent:planner:main"). */
41
+ session?: string;
42
+ /**
43
+ * Opaque short session id. Derived from the trailing component of the
44
+ * session key when not provided explicitly. Use this for compact formats
45
+ * that do not need the full colon-delimited session key.
46
+ */
47
+ sessionId?: string;
48
+ /** Extraction timestamp as an ISO 8601 string. */
49
+ ts?: string;
50
+ }
51
+ interface ParsedCitation {
52
+ /** Agent identifier parsed from the citation (never crashes on malformed input). */
53
+ agent?: string;
54
+ /** Session identifier parsed from the citation. */
55
+ session?: string;
56
+ /** Extraction timestamp parsed from the citation. */
57
+ ts?: string;
58
+ /** The full matched citation substring. */
59
+ raw: string;
60
+ }
61
+ /**
62
+ * Derive a short session id from a full session key.
63
+ * Falls back to the raw session string if no colon is present.
64
+ */
65
+ declare function deriveSessionId(session: string | undefined): string | undefined;
66
+ /**
67
+ * Format an inline citation tag using the provided template.
68
+ *
69
+ * Missing context fields fall back to {@link CITATION_UNKNOWN} — the caller
70
+ * should always get a non-empty, parseable tag.
71
+ *
72
+ * Uses a single-pass substitution so that values which themselves contain
73
+ * placeholder syntax (e.g. an agent literally named `"{ts}"`) cannot be
74
+ * re-interpreted by subsequent replacement steps. Each placeholder slot
75
+ * receives exactly one lookup and the substituted value is treated as
76
+ * terminal text, not template source.
77
+ */
78
+ declare function formatCitation(ctx: CitationContext, template?: string): string;
79
+ /**
80
+ * Returns true if the text already carries at least one citation marker.
81
+ * Safe to call on any string — never throws.
82
+ */
83
+ declare function hasCitation(text: string): boolean;
84
+ /**
85
+ * Returns true if `text` already carries a citation produced by `template`
86
+ * **or** by the default `[Source: ...]` format (for facts that were tagged
87
+ * before a config change).
88
+ *
89
+ * Use this instead of {@link hasCitation} whenever the caller has access to
90
+ * the configured `inlineSourceAttributionFormat`.
91
+ *
92
+ * All-placeholder templates such as `{agent}{sessionId}` have no literal
93
+ * content to anchor on and therefore cannot be reliably detected without
94
+ * dedicated sentinel markers. In that case the function returns `false` —
95
+ * callers that need idempotent dedup for such templates should either adopt
96
+ * a template with literal delimiters (recommended) or rely on the default
97
+ * `[Source: ...]` marker detection which is always available via
98
+ * {@link hasCitation}.
99
+ */
100
+ declare function hasCitationForTemplate(text: string, template: string): boolean;
101
+ /**
102
+ * Attach an inline citation to fact text.
103
+ *
104
+ * If the text already has a citation — either the default `[Source: ...]`
105
+ * marker or one produced by the configured template — it is returned unchanged.
106
+ * Existing provenance is respected and never overwritten. Otherwise the
107
+ * citation is appended to the trimmed text with a single space separator,
108
+ * which keeps the marker visually adjacent to the fact body.
109
+ */
110
+ declare function attachCitation(text: string, ctx: CitationContext, template?: string): string;
111
+ /**
112
+ * Parse a single inline citation from a piece of text. Returns the first
113
+ * citation encountered or `null` when none is present. Malformed citations
114
+ * do not throw — fields that cannot be parsed simply remain `undefined`.
115
+ */
116
+ declare function parseCitation(text: string): ParsedCitation | null;
117
+ /**
118
+ * Parse every citation embedded in the text. Always returns an array; empty
119
+ * when none are present.
120
+ */
121
+ declare function parseAllCitations(text: string): ParsedCitation[];
122
+ /**
123
+ * Remove all inline citations from a piece of text.
124
+ *
125
+ * Callers that want the raw fact body (for dedup hashing, display, or
126
+ * comparison) should use this helper instead of hand-rolled regexes so the
127
+ * whole codebase agrees on the citation syntax.
128
+ *
129
+ * Finding 2 fix: when the input contains no citation marker, the input is
130
+ * returned byte-for-byte unchanged. When a citation IS removed, whitespace
131
+ * normalization is applied only at each join seam (the single space between
132
+ * the preceding text and where the citation was), rather than across the
133
+ * entire string. This preserves markdown hard-break spacing, aligned text,
134
+ * and code-like snippets in fact bodies that happen to carry a citation.
135
+ *
136
+ * Implementation: each citation match is replaced by its "seam fix" — the
137
+ * content before the match has its trailing whitespace trimmed and then a
138
+ * single space is appended if any text remains, collapsing only the gap
139
+ * left by the removed marker. Whitespace elsewhere in the body is untouched.
140
+ */
141
+ declare function stripCitation(text: string): string;
142
+ /**
143
+ * Strip an inline citation from text using a specific template regex.
144
+ *
145
+ * This is the template-aware counterpart to {@link stripCitation}. When the
146
+ * caller holds the configured `inlineSourceAttributionFormat`, use this
147
+ * function to strip citations produced by that template — including custom
148
+ * templates that differ from the default `[Source: ...]` pattern.
149
+ *
150
+ * Behaviour:
151
+ * - If the text has a **default-format** citation, delegates to
152
+ * {@link stripCitation} (always safe).
153
+ * - If the text has a **custom-template** citation detected by
154
+ * `hasCitationForTemplate`, builds the template regex and removes every
155
+ * occurrence (citations are appended at the end of the fact body by
156
+ * {@link attachCitation}).
157
+ * - All-placeholder templates (no literal prefix/suffix/separator) cannot
158
+ * produce a reliable matcher. `hasCitationForTemplate` already returns
159
+ * `false` for such templates, so this function never attempts to strip an
160
+ * undetectable citation. The text is returned unchanged when no citation
161
+ * is detected.
162
+ * - If no citation is detected for the given template, returns the text
163
+ * unchanged.
164
+ *
165
+ * @returns The stripped text (or the original text when no citation is found).
166
+ */
167
+ declare function stripCitationForTemplate(text: string, template: string): string;
168
+
169
+ export { CITATION_UNKNOWN, type CitationContext, DEFAULT_CITATION_FORMAT, type ParsedCitation, attachCitation, deriveSessionId, formatCitation, hasCitation, hasCitationForTemplate, parseAllCitations, parseCitation, stripCitation, stripCitationForTemplate };
@@ -0,0 +1,27 @@
1
+ import {
2
+ CITATION_UNKNOWN,
3
+ DEFAULT_CITATION_FORMAT,
4
+ attachCitation,
5
+ deriveSessionId,
6
+ formatCitation,
7
+ hasCitation,
8
+ hasCitationForTemplate,
9
+ parseAllCitations,
10
+ parseCitation,
11
+ stripCitation,
12
+ stripCitationForTemplate
13
+ } from "./chunk-4KAN3GZ3.js";
14
+ export {
15
+ CITATION_UNKNOWN,
16
+ DEFAULT_CITATION_FORMAT,
17
+ attachCitation,
18
+ deriveSessionId,
19
+ formatCitation,
20
+ hasCitation,
21
+ hasCitationForTemplate,
22
+ parseAllCitations,
23
+ parseCitation,
24
+ stripCitation,
25
+ stripCitationForTemplate
26
+ };
27
+ //# sourceMappingURL=source-attribution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/dist/storage.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { MemoryCategory, ImportanceScore, MemoryLink, MemoryFrontmatter, MemoryFile, BufferState, MetaState, MemoryActionEvent, MemoryLifecycleEvent, BehaviorSignalEvent, CompressionGuidelineOptimizerState, ContinuityIncidentOpenInput, ContinuityIncidentRecord, ContinuityIncidentCloseInput, ContinuityImprovementLoop, ContinuityLoopUpsertInput, ContinuityLoopReviewInput, FileHygieneConfig, EntityRelationship, EntityActivityEntry, EntityFile, PluginConfig, AccessTrackingEntry, MemoryProjectionCurrentState, MemorySummary, TopicScore } from './types.js';
2
- import { P as ProjectedMemoryBrowseOptions, i as ProjectedMemoryBrowsePage, j as readProjectedGovernanceRecord } from './memory-projection-store-NxMkbocT.js';
1
+ import { VersioningConfig } from './page-versioning.js';
2
+ import { PluginConfig, MemoryCategory, ImportanceScore, MemoryLink, MemoryFrontmatter, MemoryStatus, MemoryFile, EntityStructuredSection, BufferState, MetaState, MemoryActionEvent, MemoryLifecycleEvent, BehaviorSignalEvent, CompressionGuidelineOptimizerState, ContinuityIncidentOpenInput, ContinuityIncidentRecord, ContinuityIncidentCloseInput, ContinuityImprovementLoop, ContinuityLoopUpsertInput, ContinuityLoopReviewInput, FileHygieneConfig, EntityRelationship, EntityActivityEntry, EntityFile, AccessTrackingEntry, MemoryProjectionCurrentState, MemorySummary, TopicScore } from './types.js';
3
+ import { P as ProjectedMemoryBrowseOptions, a as ProjectedMemoryBrowsePage, b as readProjectedGovernanceRecord } from './memory-projection-store-DeSXPh1j.js';
3
4
  import 'better-sqlite3';
4
5
 
5
6
  interface ReextractJobRequest {
@@ -46,37 +47,92 @@ declare class ContentHashIndex {
46
47
  save(): Promise<void>;
47
48
  /** Remove a hash from the index (used when archiving/deleting). */
48
49
  remove(content: string): void;
50
+ /**
51
+ * Remove a pre-computed SHA-256 hash directly from the index without
52
+ * re-hashing. Use this when the caller already holds the stored hash
53
+ * (e.g. `memory.frontmatter.contentHash`) to avoid the double-hash bug
54
+ * where `remove(hash)` would compute `hash(hash)` and never match the
55
+ * entry.
56
+ */
57
+ removeByHash(hash: string): void;
58
+ /**
59
+ * Add a pre-computed SHA-256 hash directly to the index without re-hashing.
60
+ * Use this when the caller already holds the stored hash
61
+ * (e.g. `memory.frontmatter.contentHash`) so that the index records the raw
62
+ * content hash rather than re-hashing the citation-annotated body.
63
+ *
64
+ * @internal Only called from `StorageManager.ensureFactHashIndexAuthoritative`.
65
+ * Not part of the public API — prefer `add(content)` for external callers.
66
+ */
67
+ addByHash(hash: string): void;
49
68
  /** Normalize content and compute SHA-256 hash. */
50
69
  static normalizeContent(content: string): string;
51
70
  /** Normalize content and compute SHA-256 hash. */
52
71
  static computeHash(content: string): string;
53
72
  }
73
+ /**
74
+ * Render a structured-attributes map into a stable, canonical string fragment
75
+ * suitable for appending to enriched memory content before hashing.
76
+ *
77
+ * Normalization rules:
78
+ * - Keys are trimmed and lowercased (values are trimmed but preserve case)
79
+ * - Key-value pairs are sorted alphabetically by normalized key
80
+ * - Pairs are joined with "; " and rendered as "key: value"
81
+ *
82
+ * Using this helper at BOTH the write path (enrichedContent) and the
83
+ * dedup-lookup path (dedupContent) guarantees identical output regardless of
84
+ * the insertion order or casing used by the caller.
85
+ *
86
+ * @example
87
+ * normalizeAttributePairs({ foo: "bar", BAZ: "qux" })
88
+ * // → "baz: qux; foo: bar"
89
+ */
90
+ declare function normalizeAttributePairs(pairs: Record<string, string>): string;
91
+ declare function compareEntityTimestamps(left?: string, right?: string): number;
92
+ declare function fingerprintEntityStructuredFacts(entity: Pick<EntityFile, "structuredSections">): string | undefined;
93
+ declare function isEntitySynthesisStale(entity: EntityFile): boolean;
54
94
  /**
55
95
  * Parse an entity markdown file into a structured EntityFile.
56
96
  * Backward compatible: old files without new sections get empty arrays.
57
97
  */
58
- declare function parseEntityFile(content: string): EntityFile;
98
+ declare function parseEntityFile(content: string, entitySchemas?: PluginConfig["entitySchemas"]): EntityFile;
59
99
  /**
60
100
  * Serialize an EntityFile back to markdown.
61
- * Only emits sections that have content (except Facts which is always emitted).
101
+ * Writes the compiled-truth + timeline format while remaining parse-compatible
102
+ * with the legacy in-memory `summary` and `facts` fields.
62
103
  */
63
- declare function serializeEntityFile(entity: EntityFile): string;
104
+ declare function serializeEntityFile(entity: EntityFile, entitySchemas?: PluginConfig["entitySchemas"]): string;
64
105
  declare class StorageManager {
65
106
  private readonly baseDir;
107
+ private readonly entitySchemas?;
66
108
  private knowledgeIndexCache;
67
109
  private static readonly KNOWLEDGE_INDEX_CACHE_TTL_MS;
68
110
  private artifactIndexCache;
69
111
  private static readonly ARTIFACT_INDEX_CACHE_TTL_MS;
70
112
  private static readonly artifactWriteVersionByDir;
71
113
  private static readonly memoryStatusVersionByDir;
114
+ private static readonly coldWriteVersionByDir;
72
115
  private static readonly allMemoriesInFlight;
116
+ private static readonly COLD_SCAN_CACHE_TTL_MS;
117
+ private static readonly coldMemoriesCache;
73
118
  private static readonly QUESTIONS_CACHE_TTL_MS;
74
119
  private static readonly questionsCache;
75
120
  private factHashIndex;
76
121
  private factHashIndexLoadPromise;
77
122
  private factHashIndexAuthoritative;
78
123
  private factHashIndexAuthoritativePromise;
79
- constructor(baseDir: string);
124
+ /** Optional: set by the orchestrator after construction to enable template-aware citation stripping during legacy hash rebuild. */
125
+ citationTemplate: string;
126
+ /** Page-versioning configuration. Set by the orchestrator after construction. */
127
+ private _versioningConfig;
128
+ /** Set the page-versioning configuration. When `enabled` is false (default), all versioning calls are no-ops. */
129
+ setVersioningConfig(config: VersioningConfig): void;
130
+ /**
131
+ * Snapshot the current content of a page before overwriting.
132
+ * No-op when versioning is disabled or the file does not yet exist.
133
+ */
134
+ private snapshotBeforeWrite;
135
+ constructor(baseDir: string, entitySchemas?: PluginConfig["entitySchemas"]);
80
136
  /** The root directory of this storage instance. */
81
137
  get dir(): string;
82
138
  private identityFilePath;
@@ -89,8 +145,10 @@ declare class StorageManager {
89
145
  private getArtifactWriteVersion;
90
146
  private get factsDir();
91
147
  private get correctionsDir();
148
+ private get proceduresDir();
92
149
  private get entitiesDir();
93
150
  private get stateDir();
151
+ private get entitySynthesisQueuePath();
94
152
  private get factHashIndexReadyPath();
95
153
  private getFactHashIndex;
96
154
  private ensureFactHashIndexAuthoritative;
@@ -137,6 +195,19 @@ declare class StorageManager {
137
195
  memoryKind?: MemoryFrontmatter["memoryKind"];
138
196
  expiresAt?: string;
139
197
  structuredAttributes?: Record<string, string>;
198
+ /**
199
+ * When provided, this string is used as the source for the fact-content
200
+ * dedup hash index instead of the persisted body (`content`).
201
+ *
202
+ * Use this when the persisted body differs from the canonical fact text
203
+ * — for example when `content` is a citation-annotated variant of a raw
204
+ * fact. Passing the raw fact as `contentHashSource` ensures that
205
+ * `hasFactContentHash(rawFact)` returns `true` after the write, so
206
+ * subsequent extractions of the same logical fact are correctly deduped
207
+ * even when their citation timestamp differs.
208
+ */
209
+ contentHashSource?: string;
210
+ status?: MemoryStatus;
140
211
  }): Promise<string>;
141
212
  hasFactContentHash(content: string): Promise<boolean>;
142
213
  isFactContentHashAuthoritative(): Promise<boolean>;
@@ -153,7 +224,13 @@ declare class StorageManager {
153
224
  }): Promise<string>;
154
225
  private readAllArtifactsCached;
155
226
  searchArtifacts(query: string, maxResults: number): Promise<MemoryFile[]>;
156
- writeEntity(name: string, type: string, facts: string[]): Promise<string>;
227
+ writeEntity(name: string, type: string, facts: string[], options?: {
228
+ timestamp?: string;
229
+ source?: string;
230
+ sessionKey?: string;
231
+ principal?: string;
232
+ structuredSections?: EntityStructuredSection[];
233
+ }): Promise<string>;
157
234
  readProfile(): Promise<string>;
158
235
  writeProfile(content: string): Promise<void>;
159
236
  /**
@@ -177,8 +254,38 @@ declare class StorageManager {
177
254
  * (bypassing StorageManager.writeMemory) to avoid stale reads. */
178
255
  static clearAllStaticCaches(): void;
179
256
  /** Cancel any in-flight concurrent read so the next readAllMemories()
180
- * starts a fresh disk scan and sees the just-written data. */
257
+ * starts a fresh disk scan and sees the just-written data.
258
+ *
259
+ * Finding UvBq (PR #402 round-11): this method intentionally does NOT
260
+ * invalidate the cold-scan cache. Ordinary hot-tier writes (writeMemory)
261
+ * do not change cold-tier content, so evicting the cold cache on every hot
262
+ * write was defeating the burst-dedup optimisation — the cold cache was
263
+ * cleared before applyTemporalSupersession ran, causing a full cold-tree
264
+ * disk scan on every write in a burst. Cold cache invalidation is handled
265
+ * exclusively by invalidateColdMemoriesCache(), which is called only when
266
+ * cold content actually changes (hot→cold demotions, writeMemoryFileAtomic
267
+ * inside cold/, archiveMemory, etc.). */
181
268
  private invalidateAllMemoriesCache;
269
+ /**
270
+ * Invalidate the cold-scan cache for this storage root and bump the
271
+ * on-disk cold-version sentinel so that other processes (gateway, CLI) see
272
+ * the change immediately on their next readAllColdMemories() call.
273
+ *
274
+ * Must be called whenever a memory is written INTO the cold tier — hot→cold
275
+ * demotion, atomic writes inside cold/, archiving a cold memory, etc.
276
+ * NOT called on ordinary hot-tier writes (those don't change cold contents).
277
+ *
278
+ * Finding UvUy (PR #402 round-11): bumping the sentinel here makes the
279
+ * per-process in-memory cache safe across process boundaries.
280
+ */
281
+ private invalidateColdMemoriesCache;
282
+ /** Return the current cold-write version counter for this storage root.
283
+ * Reads the on-disk sentinel (state/cold-write.log) so it reflects writes
284
+ * made by other processes. */
285
+ private readColdWriteVersion;
286
+ /** Bump the on-disk cold-write version sentinel and update the in-process
287
+ * fallback map. Called by invalidateColdMemoriesCache(). */
288
+ private bumpColdWriteVersion;
182
289
  private normalizeMemoryReadBatchSize;
183
290
  private collectActiveMemoryPaths;
184
291
  private readParsedMemoriesFromPaths;
@@ -195,6 +302,32 @@ declare class StorageManager {
195
302
  filePaths: string[];
196
303
  }>;
197
304
  private _readAllMemoriesFromDisk;
305
+ /**
306
+ * Read all memories from the cold tier by scanning the entire cold/ root
307
+ * tree. Previously this only scanned cold/facts/ and cold/corrections/, but
308
+ * structuredAttributes can appear on any MemoryCategory (preference, decision,
309
+ * entity, etc.). Although buildTierMemoryPath currently routes all
310
+ * non-correction, non-artifact memories to cold/facts/, scanning the full
311
+ * coldRoot ensures correctness if that routing ever changes and guards against
312
+ * files placed in unexpected subdirectories during manual operations or future
313
+ * refactors.
314
+ *
315
+ * Broadened in PR #402 round-6 (Finding UTsP): scanning only facts/ and
316
+ * corrections/ was a narrower-than-necessary subset of the cold directory
317
+ * tree. Correctness trumps the minor performance difference — cold scans
318
+ * already happen at most once per supersession write.
319
+ *
320
+ * Used by applyTemporalSupersession so that memories already demoted to
321
+ * cold/ can still be marked superseded when a newer hot fact arrives.
322
+ *
323
+ * Cached with a TTL (Finding UOGi, PR #402 round-6): back-to-back
324
+ * structured-attribute writes in the same burst reuse the cached result
325
+ * instead of re-scanning the cold tree on every call. The cache is
326
+ * invalidated whenever a write calls invalidateAllMemoriesCache() (which
327
+ * covers any hot→cold demotion that changes cold-tier contents) and
328
+ * expires after COLD_SCAN_CACHE_TTL_MS as a safety net.
329
+ */
330
+ readAllColdMemories(): Promise<MemoryFile[]>;
198
331
  /**
199
332
  * Read archived memory markdown files under archive/.
200
333
  * Used by long-term recall fallback when hot recall has no hits.
@@ -340,9 +473,27 @@ declare class StorageManager {
340
473
  */
341
474
  addEntityAlias(name: string, alias: string): Promise<void>;
342
475
  /**
343
- * Set or update the summary of an entity file.
476
+ * Set or rewrite the synthesis layer of an entity file.
477
+ */
478
+ updateEntitySynthesis(name: string, synthesis: string, options?: {
479
+ entityUpdatedAt?: string;
480
+ synthesisStructuredFactCount?: number;
481
+ synthesisStructuredFactDigest?: string;
482
+ synthesisTimelineCount?: number;
483
+ updatedAt?: string;
484
+ incrementVersion?: boolean;
485
+ }): Promise<void>;
486
+ /**
487
+ * Backward-compatible alias for legacy callers/tests.
344
488
  */
345
489
  updateEntitySummary(name: string, summary: string): Promise<void>;
490
+ readEntitySynthesisQueue(): Promise<string[]>;
491
+ refreshEntitySynthesisQueue(): Promise<string[]>;
492
+ removeEntitySynthesisQueueEntries(entityNames: string[]): Promise<void>;
493
+ migrateEntityFilesToCompiledTruthTimeline(): Promise<{
494
+ total: number;
495
+ migrated: number;
496
+ }>;
346
497
  /**
347
498
  * Read all entity files and return lightweight EntityFile objects.
348
499
  * Parsing is fast (~50-100ms for ~1,800 files) since entity files are small.
@@ -386,6 +537,16 @@ declare class StorageManager {
386
537
  * Get a memory by its ID.
387
538
  */
388
539
  getMemoryById(id: string): Promise<MemoryFile | null>;
540
+ /**
541
+ * Check which of the given memory IDs actually exist on disk.
542
+ *
543
+ * Uses a lightweight directory scan (collectActiveMemoryPaths) that reads
544
+ * file names without parsing frontmatter — much cheaper than readAllMemories()
545
+ * for simple existence checks like citation usage tracking.
546
+ *
547
+ * Returns the subset of `ids` that correspond to real memory files.
548
+ */
549
+ filterExistingMemoryIds(ids: string[]): Promise<Set<string>>;
389
550
  getProjectedMemoryState(id: string): Promise<MemoryProjectionCurrentState | null>;
390
551
  browseProjectedMemories(options: ProjectedMemoryBrowseOptions): Promise<ProjectedMemoryBrowsePage | null>;
391
552
  getProjectedGovernanceRecord(): Promise<ReturnType<typeof readProjectedGovernanceRecord>>;
@@ -450,4 +611,4 @@ declare class StorageManager {
450
611
  private appendGeneratedMemoryLifecycleEventFailOpen;
451
612
  }
452
613
 
453
- export { ContentHashIndex, type MemoryLifecycleEventWriteOptions, type ReextractJobRequest, StorageManager, normalizeEntityName, parseEntityFile, serializeEntityFile };
614
+ export { ContentHashIndex, type MemoryLifecycleEventWriteOptions, type ReextractJobRequest, StorageManager, compareEntityTimestamps, fingerprintEntityStructuredFacts, isEntitySynthesisStale, normalizeAttributePairs, normalizeEntityName, parseEntityFile, serializeEntityFile };
package/dist/storage.js CHANGED
@@ -1,22 +1,33 @@
1
1
  import {
2
2
  ContentHashIndex,
3
3
  StorageManager,
4
+ compareEntityTimestamps,
5
+ fingerprintEntityStructuredFacts,
6
+ isEntitySynthesisStale,
7
+ normalizeAttributePairs,
4
8
  normalizeEntityName,
5
9
  parseEntityFile,
6
10
  serializeEntityFile
7
- } from "./chunk-QWUUMMIK.js";
8
- import "./chunk-U4PV25RD.js";
9
- import "./chunk-ESSMF2FR.js";
10
- import "./chunk-TP4FZJIZ.js";
11
+ } from "./chunk-GV6NLQ4X.js";
12
+ import "./chunk-3WHVNEN7.js";
13
+ import "./chunk-4KAN3GZ3.js";
14
+ import "./chunk-6ZH4TU6I.js";
11
15
  import "./chunk-SCU65EZI.js";
12
16
  import "./chunk-BOUYNNYD.js";
17
+ import "./chunk-6PFRXT4K.js";
18
+ import "./chunk-TP4FZJIZ.js";
13
19
  import "./chunk-DM2T26WE.js";
14
20
  import "./chunk-QSVPYQPG.js";
15
21
  import "./chunk-M62O4P4T.js";
16
- import "./chunk-KWBU5S5U.js";
22
+ import "./chunk-4DJQYKMN.js";
23
+ import "./chunk-2ODBA7MQ.js";
17
24
  export {
18
25
  ContentHashIndex,
19
26
  StorageManager,
27
+ compareEntityTimestamps,
28
+ fingerprintEntityStructuredFacts,
29
+ isEntitySynthesisStale,
30
+ normalizeAttributePairs,
20
31
  normalizeEntityName,
21
32
  parseEntityFile,
22
33
  serializeEntityFile
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  HourlySummarizer
3
- } from "./chunk-LP47L3ZX.js";
3
+ } from "./chunk-N42IWANG.js";
4
4
  import "./chunk-ETOW6ACV.js";
5
- import "./chunk-ONRU4L2N.js";
6
- import "./chunk-MDDAA2AO.js";
5
+ import "./chunk-FEMOX5AD.js";
6
+ import "./chunk-JL2PU6AI.js";
7
7
  import "./chunk-LK6SGL53.js";
8
- import "./chunk-XUHI52HK.js";
9
- import "./chunk-M5ZBBBJI.js";
10
- import "./chunk-OOSWAUYB.js";
8
+ import "./chunk-44ICJRF3.js";
9
+ import "./chunk-XZ2TIKGC.js";
11
10
  import "./chunk-Y27UJK6V.js";
11
+ import "./chunk-ODWDQNRE.js";
12
12
  import "./chunk-UZB5KHKX.js";
13
13
  import "./chunk-MARWOCVP.js";
14
- import "./chunk-KWBU5S5U.js";
14
+ import "./chunk-2ODBA7MQ.js";
15
15
  export {
16
16
  HourlySummarizer
17
17
  };