@remnic/core 9.3.684 → 9.3.685

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 (297) hide show
  1. package/dist/access-boundary.d.ts +3 -2
  2. package/dist/access-boundary.js +23 -23
  3. package/dist/access-cli.js +67 -67
  4. package/dist/access-http.d.ts +3 -2
  5. package/dist/access-http.js +26 -26
  6. package/dist/access-mcp.d.ts +3 -2
  7. package/dist/access-mcp.js +25 -25
  8. package/dist/access-operations.d.ts +3 -2
  9. package/dist/access-operations.js +24 -24
  10. package/dist/{access-service-D-siI-xJ.d.ts → access-service-DeKrlYU_.d.ts} +1 -10
  11. package/dist/access-service.d.ts +3 -2
  12. package/dist/access-service.js +22 -22
  13. package/dist/access-surface-catalog.d.ts +3 -2
  14. package/dist/active-recall.js +2 -2
  15. package/dist/{auto-sync-5CJBJMPZ.js → auto-sync-NUQWSFQD.js} +7 -7
  16. package/dist/bootstrap.d.ts +2 -1
  17. package/dist/bootstrap.js +2 -2
  18. package/dist/boxes.js +2 -2
  19. package/dist/briefing.js +3 -3
  20. package/dist/buffer.js +2 -2
  21. package/dist/calibration.js +4 -4
  22. package/dist/catalog-COqWZlZ6.d.ts +456 -0
  23. package/dist/causal-behavior.js +4 -4
  24. package/dist/causal-chain.js +4 -4
  25. package/dist/causal-consolidation.js +11 -11
  26. package/dist/causal-retrieval.js +4 -4
  27. package/dist/causal-trajectory-graph.js +1 -1
  28. package/dist/causal-trajectory.js +1 -1
  29. package/dist/{chunk-ROHLEUTH.js → chunk-2KAYTPPT.js} +10 -10
  30. package/dist/{chunk-NHQGDVJF.js → chunk-2SJCWLQD.js} +3 -3
  31. package/dist/{chunk-YTWNKQ2G.js → chunk-3FC6LW6T.js} +2 -2
  32. package/dist/{chunk-XEA4Z7JU.js → chunk-4FE2K57M.js} +3 -3
  33. package/dist/{chunk-WI7JKV2T.js → chunk-4N3TFFPH.js} +2 -2
  34. package/dist/{chunk-BTVX7ZXZ.js → chunk-4NFVPDIL.js} +4 -4
  35. package/dist/{chunk-OUWAQVDJ.js → chunk-5CEJH5ZN.js} +2 -2
  36. package/dist/{chunk-6QM24CP7.js → chunk-6GJS4BFH.js} +2 -2
  37. package/dist/{chunk-J2FBJ63F.js → chunk-6O6A6YUO.js} +4 -4
  38. package/dist/{chunk-HQ6NIBL6.js → chunk-7FL4CNPV.js} +2 -2
  39. package/dist/{chunk-5VDJMYTF.js → chunk-7WWURLG6.js} +3 -3
  40. package/dist/{chunk-QWRC7GIO.js → chunk-A4HH2EWA.js} +5 -5
  41. package/dist/{chunk-4SKKVWLQ.js → chunk-AGJH5ISO.js} +2 -2
  42. package/dist/{chunk-2L3KLWOV.js → chunk-B43NZNMG.js} +54 -92
  43. package/dist/chunk-B43NZNMG.js.map +1 -0
  44. package/dist/{chunk-WRE3JPAW.js → chunk-B4XVLHJA.js} +3 -3
  45. package/dist/{chunk-53FDU4CE.js → chunk-BLIWOONZ.js} +39 -36
  46. package/dist/chunk-BLIWOONZ.js.map +1 -0
  47. package/dist/{chunk-AJU4PJGY.js → chunk-BVKCV2ZY.js} +2 -2
  48. package/dist/{chunk-5N5DXYDW.js → chunk-BZISAF67.js} +7 -8
  49. package/dist/chunk-BZISAF67.js.map +1 -0
  50. package/dist/{chunk-DQY7NJ5L.js → chunk-CTOQEZSN.js} +2 -2
  51. package/dist/{chunk-7OGJQP7T.js → chunk-DCWIQFNA.js} +4 -4
  52. package/dist/{chunk-MHQC2WU2.js → chunk-DKTSR7EK.js} +2 -2
  53. package/dist/{chunk-RN7MUWON.js → chunk-EHISUJFN.js} +2 -2
  54. package/dist/{chunk-WLEB7WCG.js → chunk-EO5QWINU.js} +2 -2
  55. package/dist/{chunk-XKXKSQU7.js → chunk-EXM3CQTZ.js} +2 -2
  56. package/dist/{chunk-M3FWYURP.js → chunk-FE6DQUNJ.js} +9 -9
  57. package/dist/{chunk-LCC5EZTT.js → chunk-FIVDN2SM.js} +4 -4
  58. package/dist/{chunk-452WDNFO.js → chunk-GG6AJN7A.js} +2 -2
  59. package/dist/{chunk-2IBGHRIO.js → chunk-GS55WYRL.js} +3 -3
  60. package/dist/{chunk-IBTZEBUD.js → chunk-HYNHLBKA.js} +2 -2
  61. package/dist/{chunk-3EVIMVQU.js → chunk-IIDSFFE5.js} +2 -2
  62. package/dist/{chunk-EVWIEEKZ.js → chunk-IQ7WCZRW.js} +2 -2
  63. package/dist/{chunk-B5XMS73R.js → chunk-IQVQJJL7.js} +2 -2
  64. package/dist/{chunk-OXNOINIP.js → chunk-JPCKLFWK.js} +22 -23
  65. package/dist/{chunk-OXNOINIP.js.map → chunk-JPCKLFWK.js.map} +1 -1
  66. package/dist/{chunk-6RHNCKHG.js → chunk-K43PI6DQ.js} +2 -2
  67. package/dist/{chunk-OIF36KGD.js → chunk-KCQA46NR.js} +2 -2
  68. package/dist/{chunk-2LDBXPLB.js → chunk-KF74X62T.js} +1 -1
  69. package/dist/{chunk-MAV46GWQ.js → chunk-KYYL4U6X.js} +2 -2
  70. package/dist/{chunk-6GC5SGFE.js → chunk-L24JROPR.js} +2 -2
  71. package/dist/{chunk-Q5ZU3RNY.js → chunk-LQ6JI4VH.js} +2 -2
  72. package/dist/{chunk-GWKCEM3S.js → chunk-MCQDSY4G.js} +3 -3
  73. package/dist/{chunk-HP5FMB6L.js → chunk-MDJURR27.js} +2 -2
  74. package/dist/{chunk-2ODBA7MQ.js → chunk-NU3CSQ4H.js} +5 -5
  75. package/dist/chunk-NU3CSQ4H.js.map +1 -0
  76. package/dist/{chunk-T2PO5MUF.js → chunk-O7GOFAM3.js} +2 -2
  77. package/dist/{chunk-Z2OXSMZK.js → chunk-OBXTMFZQ.js} +3 -3
  78. package/dist/{chunk-5OE4PYY5.js → chunk-OFUULUSY.js} +8 -9
  79. package/dist/{chunk-5OE4PYY5.js.map → chunk-OFUULUSY.js.map} +1 -1
  80. package/dist/{chunk-K6ZN34WC.js → chunk-OV4D5T7V.js} +3 -3
  81. package/dist/{chunk-OMLIFZ4I.js → chunk-PH3HOKYW.js} +2 -2
  82. package/dist/{chunk-FYEVFGJD.js → chunk-PK6RGRSD.js} +2 -2
  83. package/dist/{chunk-C3IW2F5Z.js → chunk-PLBIPT6I.js} +2 -2
  84. package/dist/{chunk-QY7YA7OL.js → chunk-PNLCEFE4.js} +2 -2
  85. package/dist/{chunk-AGRPGAKR.js → chunk-PONNZ54D.js} +2 -2
  86. package/dist/{chunk-XZ4WBBB5.js → chunk-PWFWCGOO.js} +2 -2
  87. package/dist/{chunk-XWEXT4XU.js → chunk-QANVLERJ.js} +4 -4
  88. package/dist/{chunk-W4RVMTHR.js → chunk-QRDOSYOR.js} +2 -2
  89. package/dist/{chunk-6IMKOIZ6.js → chunk-R6OVFAX6.js} +2 -2
  90. package/dist/{chunk-JOASJWQR.js → chunk-SANZHXY2.js} +2 -2
  91. package/dist/{chunk-7DTASS5T.js → chunk-SJHM6I4J.js} +2 -2
  92. package/dist/{chunk-3MY4W5V4.js → chunk-SQGPGC76.js} +11 -21
  93. package/dist/{chunk-3MY4W5V4.js.map → chunk-SQGPGC76.js.map} +1 -1
  94. package/dist/{chunk-M6BVYHBU.js → chunk-STOEE37X.js} +4 -4
  95. package/dist/{chunk-GKKAXVAJ.js → chunk-U33LWTQQ.js} +1 -7
  96. package/dist/chunk-U33LWTQQ.js.map +1 -0
  97. package/dist/{chunk-LXH3DIF2.js → chunk-U7D7NP4J.js} +2 -2
  98. package/dist/{chunk-DRD2Q7HQ.js → chunk-UFS7OXGL.js} +2 -2
  99. package/dist/{chunk-H3HDXD3U.js → chunk-UPTZYUYJ.js} +2 -2
  100. package/dist/{chunk-3Z7NPD5T.js → chunk-UTYBJR7M.js} +2 -2
  101. package/dist/{chunk-LN4YGHTM.js → chunk-UUH4YQOF.js} +2 -2
  102. package/dist/{chunk-6VF75M3X.js → chunk-VGUOEDTU.js} +2 -2
  103. package/dist/{chunk-44VFF3BB.js → chunk-VILEUJXC.js} +2 -2
  104. package/dist/{chunk-7SI52C65.js → chunk-VL7DP3OW.js} +2 -2
  105. package/dist/{chunk-7DHTMOND.js → chunk-VQ34TERH.js} +2 -2
  106. package/dist/{chunk-6VMIHVGO.js → chunk-VX6OBUDW.js} +2 -2
  107. package/dist/{chunk-EW5KFXHL.js → chunk-WDXCNJSF.js} +7 -7
  108. package/dist/{chunk-FMEKEF47.js → chunk-WIHPNY65.js} +79 -3
  109. package/dist/chunk-WIHPNY65.js.map +1 -0
  110. package/dist/{chunk-X6IRLNOO.js → chunk-WIWPSQYU.js} +2 -2
  111. package/dist/{chunk-DOCTITOP.js → chunk-WRFKZEO6.js} +2 -2
  112. package/dist/{chunk-E6ZDCOHM.js → chunk-XBZQRZ6G.js} +2 -2
  113. package/dist/{chunk-7YX23JBA.js → chunk-XHYGJVXL.js} +2 -2
  114. package/dist/{chunk-JD4SCARD.js → chunk-YN4ZT4CW.js} +1 -1
  115. package/dist/{chunk-YXWAILM4.js → chunk-YOI3ELXF.js} +2 -2
  116. package/dist/{chunk-XCAZF7KQ.js → chunk-ZA2S2VLL.js} +2 -2
  117. package/dist/{chunk-BEUDU7Y4.js → chunk-ZCWIH4LH.js} +2 -2
  118. package/dist/{chunk-V25ZAOSB.js → chunk-ZPTISBQU.js} +5 -5
  119. package/dist/{cli-ooj6JQBS.d.ts → cli-D3-Q5Uod.d.ts} +2 -2
  120. package/dist/cli.d.ts +4 -3
  121. package/dist/cli.js +44 -44
  122. package/dist/compounding/engine.js +4 -4
  123. package/dist/compounding/preference-consolidator.js +1 -1
  124. package/dist/config.js +2 -2
  125. package/dist/connectors/codex-materialize-runner.js +4 -4
  126. package/dist/connectors/codex-materialize.js +2 -2
  127. package/dist/connectors/index.js +5 -5
  128. package/dist/contradiction/index.js +3 -3
  129. package/dist/{contradiction-scan-AZTGFMPY.js → contradiction-scan-HWGEOUDS.js} +3 -3
  130. package/dist/conversation-index/backend.js +5 -5
  131. package/dist/conversation-index/cleanup.js +2 -2
  132. package/dist/conversation-index/faiss-adapter.js +2 -2
  133. package/dist/conversation-index/indexer.js +2 -2
  134. package/dist/conversation-index/search.js +2 -2
  135. package/dist/day-summary.js +2 -2
  136. package/dist/embedding-fallback.js +2 -2
  137. package/dist/entity-retrieval.js +4 -4
  138. package/dist/explicit-capture.d.ts +2 -1
  139. package/dist/explicit-capture.js +1 -1
  140. package/dist/extraction-judge-telemetry.js +2 -2
  141. package/dist/extraction-judge-training.js +2 -2
  142. package/dist/extraction-judge.js +5 -5
  143. package/dist/extraction.js +9 -9
  144. package/dist/fallback-llm.js +4 -4
  145. package/dist/{graph-edge-decay-KSVJGCZW.js → graph-edge-decay-D7OESCBR.js} +2 -2
  146. package/dist/graph-snapshot.js +2 -2
  147. package/dist/graph.js +1 -1
  148. package/dist/index.d.ts +5 -4
  149. package/dist/index.js +80 -80
  150. package/dist/lcm/archive.js +2 -2
  151. package/dist/lcm/engine.js +5 -5
  152. package/dist/lcm/index.js +5 -5
  153. package/dist/lcm/schema.js +2 -2
  154. package/dist/lcm/summarizer.js +3 -3
  155. package/dist/local-llm.js +2 -2
  156. package/dist/logger.js +1 -1
  157. package/dist/maintenance/memory-governance.js +3 -3
  158. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +3 -3
  159. package/dist/maintenance/rebuild-memory-projection.js +5 -5
  160. package/dist/mcp-memory-inspector-app.d.ts +3 -2
  161. package/dist/model-registry.js +2 -2
  162. package/dist/models-json.js +2 -2
  163. package/dist/namespaces/migrate.d.ts +1 -0
  164. package/dist/namespaces/migrate.js +16 -16
  165. package/dist/namespaces/search.js +13 -13
  166. package/dist/namespaces/storage.d.ts +42 -1
  167. package/dist/namespaces/storage.js +3 -3
  168. package/dist/native-knowledge.js +2 -2
  169. package/dist/negative.js +2 -2
  170. package/dist/operator-toolkit.js +22 -22
  171. package/dist/{orchestrator-DIDDvwDw.d.ts → orchestrator-CA6ouzBn.d.ts} +3 -464
  172. package/dist/orchestrator.d.ts +2 -1
  173. package/dist/orchestrator.js +61 -61
  174. package/dist/profiling.js +2 -2
  175. package/dist/qmd.js +2 -2
  176. package/dist/recall-planner-llm.js +4 -4
  177. package/dist/recall-qos.js +2 -2
  178. package/dist/recall-state.js +2 -2
  179. package/dist/relevance.js +2 -2
  180. package/dist/{resolution-IDTEBJFS.js → resolution-MN36NW5P.js} +3 -3
  181. package/dist/resolve-provider-secret.js +2 -2
  182. package/dist/resume-bundles.js +4 -4
  183. package/dist/retrieval-agents.js +2 -2
  184. package/dist/routing/store.js +2 -2
  185. package/dist/search/embed-helper.js +2 -2
  186. package/dist/search/factory.js +12 -12
  187. package/dist/search/index.js +12 -12
  188. package/dist/search/lancedb-backend.js +2 -2
  189. package/dist/search/meilisearch-backend.js +2 -2
  190. package/dist/search/orama-backend.js +2 -2
  191. package/dist/search/remote-backend.js +2 -2
  192. package/dist/semantic-consolidation.js +5 -5
  193. package/dist/semantic-rule-promotion.js +3 -3
  194. package/dist/semantic-rule-verifier.js +3 -3
  195. package/dist/session-observer-state.js +2 -2
  196. package/dist/session-transcript-migration.js +2 -2
  197. package/dist/shared-context/manager.js +2 -2
  198. package/dist/storage.d.ts +4 -0
  199. package/dist/storage.js +2 -2
  200. package/dist/summarizer.js +7 -7
  201. package/dist/temporal-supersession.js +2 -2
  202. package/dist/threading.js +2 -2
  203. package/dist/transcript.js +2 -2
  204. package/dist/verified-recall.js +4 -4
  205. package/package.json +2 -2
  206. package/src/access-http.ts +1 -1
  207. package/src/access-mcp.ts +1 -1
  208. package/src/access-service.ts +1 -11
  209. package/src/cli.ts +1 -1
  210. package/src/explicit-capture.ts +3 -12
  211. package/src/logger.ts +13 -4
  212. package/src/namespaces/catalog.test.ts +2 -2
  213. package/src/namespaces/storage.ts +81 -0
  214. package/src/orchestrator.ts +22 -64
  215. package/src/storage.ts +36 -36
  216. package/dist/chunk-2L3KLWOV.js.map +0 -1
  217. package/dist/chunk-2ODBA7MQ.js.map +0 -1
  218. package/dist/chunk-53FDU4CE.js.map +0 -1
  219. package/dist/chunk-5N5DXYDW.js.map +0 -1
  220. package/dist/chunk-FMEKEF47.js.map +0 -1
  221. package/dist/chunk-GKKAXVAJ.js.map +0 -1
  222. /package/dist/{auto-sync-5CJBJMPZ.js.map → auto-sync-NUQWSFQD.js.map} +0 -0
  223. /package/dist/{chunk-ROHLEUTH.js.map → chunk-2KAYTPPT.js.map} +0 -0
  224. /package/dist/{chunk-NHQGDVJF.js.map → chunk-2SJCWLQD.js.map} +0 -0
  225. /package/dist/{chunk-YTWNKQ2G.js.map → chunk-3FC6LW6T.js.map} +0 -0
  226. /package/dist/{chunk-XEA4Z7JU.js.map → chunk-4FE2K57M.js.map} +0 -0
  227. /package/dist/{chunk-WI7JKV2T.js.map → chunk-4N3TFFPH.js.map} +0 -0
  228. /package/dist/{chunk-BTVX7ZXZ.js.map → chunk-4NFVPDIL.js.map} +0 -0
  229. /package/dist/{chunk-OUWAQVDJ.js.map → chunk-5CEJH5ZN.js.map} +0 -0
  230. /package/dist/{chunk-6QM24CP7.js.map → chunk-6GJS4BFH.js.map} +0 -0
  231. /package/dist/{chunk-J2FBJ63F.js.map → chunk-6O6A6YUO.js.map} +0 -0
  232. /package/dist/{chunk-HQ6NIBL6.js.map → chunk-7FL4CNPV.js.map} +0 -0
  233. /package/dist/{chunk-5VDJMYTF.js.map → chunk-7WWURLG6.js.map} +0 -0
  234. /package/dist/{chunk-QWRC7GIO.js.map → chunk-A4HH2EWA.js.map} +0 -0
  235. /package/dist/{chunk-4SKKVWLQ.js.map → chunk-AGJH5ISO.js.map} +0 -0
  236. /package/dist/{chunk-WRE3JPAW.js.map → chunk-B4XVLHJA.js.map} +0 -0
  237. /package/dist/{chunk-AJU4PJGY.js.map → chunk-BVKCV2ZY.js.map} +0 -0
  238. /package/dist/{chunk-DQY7NJ5L.js.map → chunk-CTOQEZSN.js.map} +0 -0
  239. /package/dist/{chunk-7OGJQP7T.js.map → chunk-DCWIQFNA.js.map} +0 -0
  240. /package/dist/{chunk-MHQC2WU2.js.map → chunk-DKTSR7EK.js.map} +0 -0
  241. /package/dist/{chunk-RN7MUWON.js.map → chunk-EHISUJFN.js.map} +0 -0
  242. /package/dist/{chunk-WLEB7WCG.js.map → chunk-EO5QWINU.js.map} +0 -0
  243. /package/dist/{chunk-XKXKSQU7.js.map → chunk-EXM3CQTZ.js.map} +0 -0
  244. /package/dist/{chunk-M3FWYURP.js.map → chunk-FE6DQUNJ.js.map} +0 -0
  245. /package/dist/{chunk-LCC5EZTT.js.map → chunk-FIVDN2SM.js.map} +0 -0
  246. /package/dist/{chunk-452WDNFO.js.map → chunk-GG6AJN7A.js.map} +0 -0
  247. /package/dist/{chunk-2IBGHRIO.js.map → chunk-GS55WYRL.js.map} +0 -0
  248. /package/dist/{chunk-IBTZEBUD.js.map → chunk-HYNHLBKA.js.map} +0 -0
  249. /package/dist/{chunk-3EVIMVQU.js.map → chunk-IIDSFFE5.js.map} +0 -0
  250. /package/dist/{chunk-EVWIEEKZ.js.map → chunk-IQ7WCZRW.js.map} +0 -0
  251. /package/dist/{chunk-B5XMS73R.js.map → chunk-IQVQJJL7.js.map} +0 -0
  252. /package/dist/{chunk-6RHNCKHG.js.map → chunk-K43PI6DQ.js.map} +0 -0
  253. /package/dist/{chunk-OIF36KGD.js.map → chunk-KCQA46NR.js.map} +0 -0
  254. /package/dist/{chunk-2LDBXPLB.js.map → chunk-KF74X62T.js.map} +0 -0
  255. /package/dist/{chunk-MAV46GWQ.js.map → chunk-KYYL4U6X.js.map} +0 -0
  256. /package/dist/{chunk-6GC5SGFE.js.map → chunk-L24JROPR.js.map} +0 -0
  257. /package/dist/{chunk-Q5ZU3RNY.js.map → chunk-LQ6JI4VH.js.map} +0 -0
  258. /package/dist/{chunk-GWKCEM3S.js.map → chunk-MCQDSY4G.js.map} +0 -0
  259. /package/dist/{chunk-HP5FMB6L.js.map → chunk-MDJURR27.js.map} +0 -0
  260. /package/dist/{chunk-T2PO5MUF.js.map → chunk-O7GOFAM3.js.map} +0 -0
  261. /package/dist/{chunk-Z2OXSMZK.js.map → chunk-OBXTMFZQ.js.map} +0 -0
  262. /package/dist/{chunk-K6ZN34WC.js.map → chunk-OV4D5T7V.js.map} +0 -0
  263. /package/dist/{chunk-OMLIFZ4I.js.map → chunk-PH3HOKYW.js.map} +0 -0
  264. /package/dist/{chunk-FYEVFGJD.js.map → chunk-PK6RGRSD.js.map} +0 -0
  265. /package/dist/{chunk-C3IW2F5Z.js.map → chunk-PLBIPT6I.js.map} +0 -0
  266. /package/dist/{chunk-QY7YA7OL.js.map → chunk-PNLCEFE4.js.map} +0 -0
  267. /package/dist/{chunk-AGRPGAKR.js.map → chunk-PONNZ54D.js.map} +0 -0
  268. /package/dist/{chunk-XZ4WBBB5.js.map → chunk-PWFWCGOO.js.map} +0 -0
  269. /package/dist/{chunk-XWEXT4XU.js.map → chunk-QANVLERJ.js.map} +0 -0
  270. /package/dist/{chunk-W4RVMTHR.js.map → chunk-QRDOSYOR.js.map} +0 -0
  271. /package/dist/{chunk-6IMKOIZ6.js.map → chunk-R6OVFAX6.js.map} +0 -0
  272. /package/dist/{chunk-JOASJWQR.js.map → chunk-SANZHXY2.js.map} +0 -0
  273. /package/dist/{chunk-7DTASS5T.js.map → chunk-SJHM6I4J.js.map} +0 -0
  274. /package/dist/{chunk-M6BVYHBU.js.map → chunk-STOEE37X.js.map} +0 -0
  275. /package/dist/{chunk-LXH3DIF2.js.map → chunk-U7D7NP4J.js.map} +0 -0
  276. /package/dist/{chunk-DRD2Q7HQ.js.map → chunk-UFS7OXGL.js.map} +0 -0
  277. /package/dist/{chunk-H3HDXD3U.js.map → chunk-UPTZYUYJ.js.map} +0 -0
  278. /package/dist/{chunk-3Z7NPD5T.js.map → chunk-UTYBJR7M.js.map} +0 -0
  279. /package/dist/{chunk-LN4YGHTM.js.map → chunk-UUH4YQOF.js.map} +0 -0
  280. /package/dist/{chunk-6VF75M3X.js.map → chunk-VGUOEDTU.js.map} +0 -0
  281. /package/dist/{chunk-44VFF3BB.js.map → chunk-VILEUJXC.js.map} +0 -0
  282. /package/dist/{chunk-7SI52C65.js.map → chunk-VL7DP3OW.js.map} +0 -0
  283. /package/dist/{chunk-7DHTMOND.js.map → chunk-VQ34TERH.js.map} +0 -0
  284. /package/dist/{chunk-6VMIHVGO.js.map → chunk-VX6OBUDW.js.map} +0 -0
  285. /package/dist/{chunk-EW5KFXHL.js.map → chunk-WDXCNJSF.js.map} +0 -0
  286. /package/dist/{chunk-X6IRLNOO.js.map → chunk-WIWPSQYU.js.map} +0 -0
  287. /package/dist/{chunk-DOCTITOP.js.map → chunk-WRFKZEO6.js.map} +0 -0
  288. /package/dist/{chunk-E6ZDCOHM.js.map → chunk-XBZQRZ6G.js.map} +0 -0
  289. /package/dist/{chunk-7YX23JBA.js.map → chunk-XHYGJVXL.js.map} +0 -0
  290. /package/dist/{chunk-JD4SCARD.js.map → chunk-YN4ZT4CW.js.map} +0 -0
  291. /package/dist/{chunk-YXWAILM4.js.map → chunk-YOI3ELXF.js.map} +0 -0
  292. /package/dist/{chunk-XCAZF7KQ.js.map → chunk-ZA2S2VLL.js.map} +0 -0
  293. /package/dist/{chunk-BEUDU7Y4.js.map → chunk-ZCWIH4LH.js.map} +0 -0
  294. /package/dist/{chunk-V25ZAOSB.js.map → chunk-ZPTISBQU.js.map} +0 -0
  295. /package/dist/{contradiction-scan-AZTGFMPY.js.map → contradiction-scan-HWGEOUDS.js.map} +0 -0
  296. /package/dist/{graph-edge-decay-KSVJGCZW.js.map → graph-edge-decay-D7OESCBR.js.map} +0 -0
  297. /package/dist/{resolution-IDTEBJFS.js.map → resolution-MN36NW5P.js.map} +0 -0
@@ -0,0 +1,456 @@
1
+ import { P as PluginConfig } from './types-Dm5xxVrr.js';
2
+
3
+ /**
4
+ * Rebuildable namespace catalog (issue #1499).
5
+ *
6
+ * Purpose: a downstream, rebuildable metadata index that lets Remnic ENUMERATE
7
+ * the configured and dynamically-created namespaces that exist or should be
8
+ * maintained. Filesystem memory remains the single source of truth; the catalog
9
+ * is derived metadata and can always be reconstructed from disk.
10
+ *
11
+ * Storage format: `<memoryDir>/state/namespaces.jsonl` — an append-and-compact
12
+ * JSON-lines log. We chose this over per-namespace sidecar files because:
13
+ * - touches (markRead/markWrite/markMaintenance) are cheap single appends;
14
+ * - it is naturally audit-friendly (the raw log preserves touch history);
15
+ * - a single file makes enumeration trivial (no directory walk per call);
16
+ * - last-record-wins compaction folds the log into the current state on read,
17
+ * and `rebuildFromDisk` rewrites it atomically (temp file + rename).
18
+ *
19
+ * SECURITY:
20
+ * - The catalog stores ONLY metadata (namespace names, kinds, timestamps,
21
+ * resolved storage dirs). It NEVER holds raw memory content or secrets.
22
+ * - Catalog presence grants NO authorization. Read/write access still flows
23
+ * through the namespace policies in `principal.ts`; this module never makes
24
+ * an access decision.
25
+ * - All namespace tokens are validated with `isSafeRouteNamespace` (except the
26
+ * configured default namespace, which is exempt at the routing layer) and
27
+ * every storage dir is contained under `<memoryDir>/namespaces`.
28
+ * - `rebuildFromDisk` rejects/reports symlinked roots that escape the memory
29
+ * root rather than trusting them.
30
+ *
31
+ * LIFECYCLE: catalog write failures must NEVER crash a primary memory op.
32
+ * Callers should wrap touch calls in try/catch (or rely on the internal
33
+ * failure-tolerant append). The internal serialized write chain recovers from
34
+ * rejection so one failed append cannot poison subsequent writes.
35
+ */
36
+ type NamespaceKind = "default" | "self" | "shared" | "project" | "branch" | "team-project" | "explicit" | "legacy";
37
+ type NamespaceDiscoverySource = "config" | "write" | "read" | "scan" | "migration";
38
+ interface NamespaceRecord {
39
+ namespace: string;
40
+ identityToken: string;
41
+ kind: NamespaceKind;
42
+ principal?: string;
43
+ projectId?: string;
44
+ branch?: string;
45
+ parentNamespace?: string;
46
+ createdAt: string;
47
+ lastReadAt?: string;
48
+ lastWriteAt?: string;
49
+ lastMaintenanceAt?: Record<string, string>;
50
+ storageDir: string;
51
+ discoveredBy: NamespaceDiscoverySource;
52
+ }
53
+ interface NamespaceCatalogFilter {
54
+ kind?: NamespaceKind;
55
+ discoveredBy?: NamespaceDiscoverySource;
56
+ /** Only include namespaces written since this instant (inclusive lower bound). */
57
+ writtenSince?: Date;
58
+ }
59
+ interface NamespaceTouchMetadata {
60
+ discoveredBy?: NamespaceDiscoverySource;
61
+ kind?: NamespaceKind;
62
+ principal?: string;
63
+ projectId?: string;
64
+ branch?: string;
65
+ parentNamespace?: string;
66
+ /** Explicit storage dir (when the caller already resolved it). */
67
+ storageDir?: string;
68
+ /** Override the touch timestamp (mainly for tests / migration replay). */
69
+ at?: Date;
70
+ }
71
+ interface NamespaceCatalogSkippedRoot {
72
+ token: string;
73
+ reason: "symlink" | "escape" | "unsafe" | "error";
74
+ detail?: string;
75
+ }
76
+ interface NamespaceCatalogRebuildResult {
77
+ dryRun: boolean;
78
+ records: NamespaceRecord[];
79
+ /** Roots reported as ambiguous/unsafe rather than silently misclassified. */
80
+ skipped: NamespaceCatalogSkippedRoot[];
81
+ /**
82
+ * Whether the rebuild actually rewrote the on-disk catalog (round 6, codex P2
83
+ * / cursor Medium — NBn3n/NBsGG). `false` for a dry-run, AND for an `--apply`
84
+ * that could NOT acquire the cross-process rebuild lock within the bounded wait
85
+ * (it ran compute-only to avoid clobbering a concurrent lock holder). Callers
86
+ * (CLI) must NOT report unqualified success when `applied` is false for a
87
+ * non-dry-run — the catalog was left unchanged and a retry is needed.
88
+ */
89
+ applied: boolean;
90
+ }
91
+ declare class NamespaceCatalog {
92
+ private readonly config;
93
+ private readonly memoryDir;
94
+ private readonly stateDir;
95
+ private readonly catalogPath;
96
+ private readonly rebuildLockPath;
97
+ private readonly lockOwnerId;
98
+ private writeChain;
99
+ protected onTouchCriticalSectionForTest?: () => Promise<void>;
100
+ protected onRebuildBeforeRenameForTest?: () => Promise<void>;
101
+ protected onRebuildAfterScanForTest?: () => Promise<void>;
102
+ protected onBeforeBreakStaleUnlinkForTest?: () => Promise<void>;
103
+ private readonly defaultNamespaceIdentity;
104
+ constructor(config: PluginConfig);
105
+ /** Whether the catalog is active (namespaces enabled and catalog not opted out). */
106
+ get enabled(): boolean;
107
+ /**
108
+ * Sanitize a record at the enumeration boundary (round 5, cursor Medium + codex
109
+ * P2; round 6 — NDXHe). Reads return whatever is in `namespaces.jsonl` after
110
+ * schema checks only, so a tampered or pre-fix row could surface unsafe data to
111
+ * maintenance/QMD until a rewrite occurs. Two distinct defenses:
112
+ *
113
+ * 1. UNSAFE NAMESPACE NAME (NGZqr, codex P2): an unsafe non-default namespace
114
+ * (e.g. `../evil`, a name with separators, or >64 chars) is REJECTED outright
115
+ * — return `null` so the caller drops it. The disk SCAN and the hot touch
116
+ * path both reject such names with the SAME default-exempt `isSafeRouteNamespace`
117
+ * gate, so the read boundary MUST agree, or `listNamespaces()`/`getNamespaceRecord()`
118
+ * would expose a namespace those paths reject (note `isStorageDirForNamespace`
119
+ * can still build a tokenized root even for `../evil`, so storageDir sanitation
120
+ * alone does not catch it). The default namespace is exempt (it may be a
121
+ * non-route literal), matching every other validation site.
122
+ *
123
+ * 2. UNSAFE storageDir: for an otherwise-valid namespace, apply the SAME contract
124
+ * as the write path — full containment (`isContainedStorageDir`: lexical +
125
+ * symlink/realpath) AND namespace ownership (`isStorageDirForNamespace`). When
126
+ * a record fails EITHER check we substitute the trusted resolved-and-safe root
127
+ * for that namespace (rule 42: read and write stay symmetric).
128
+ */
129
+ private sanitizeRecordForRead;
130
+ private storageRootOwnershipRank;
131
+ private configuredNamespaceIdentities;
132
+ private preferStorageRootOwner;
133
+ private dropDuplicateStorageRootAliases;
134
+ private loadSanitizedRecords;
135
+ listNamespaces(filter?: NamespaceCatalogFilter): Promise<NamespaceRecord[]>;
136
+ getNamespaceRecord(namespace: string): Promise<NamespaceRecord | null>;
137
+ markRead(namespace: string, metadata?: NamespaceTouchMetadata): Promise<void>;
138
+ markWrite(namespace: string, metadata?: NamespaceTouchMetadata): Promise<void>;
139
+ markMaintenance(namespace: string, jobName: string, at?: Date): Promise<void>;
140
+ /**
141
+ * Register namespaces known purely from config (default, shared, explicit
142
+ * policies). Source `config`. Cheap and idempotent.
143
+ */
144
+ registerConfiguredNamespaces(): Promise<void>;
145
+ /**
146
+ * Register a namespace whose storage was just resolved by the router. Used as
147
+ * the router's integration hook (`discoveredBy: config`). Storage dir is
148
+ * provided so we do not re-resolve it. Failure-tolerant. Returns whether the
149
+ * registration actually APPENDED (round 6, codex P2 — NEFoX), so the router's
150
+ * resolve-hook dedup only marks a namespace notified when it truly persisted —
151
+ * a dropped append (disabled catalog or rebuild-lock-timeout drop) returns
152
+ * `false` and is retried on the next resolve.
153
+ */
154
+ registerResolved(namespace: string, storageDir: string): Promise<boolean>;
155
+ /**
156
+ * Generic register/touch without changing read/write timestamps unless the
157
+ * source implies it. Validates the namespace and resolves a storage dir.
158
+ * Returns whether the touch actually appended.
159
+ */
160
+ private register;
161
+ private validateNamespace;
162
+ /**
163
+ * Resolve the on-disk storage dir for a namespace WITHOUT trusting caller
164
+ * input. The default namespace may use the legacy memoryDir root; everything
165
+ * else lives under `<memoryDir>/namespaces/<token>`. Containment is enforced
166
+ * by rejecting separators/parent-refs in the token.
167
+ */
168
+ private resolveStorageDir;
169
+ private namespaceTokenDir;
170
+ /**
171
+ * Whether a candidate storage dir is LEXICALLY contained: it is either the
172
+ * legacy default root (`memoryDir`) or a strict descendant of
173
+ * `<memoryDir>/namespaces/`. The router legitimately resolves a namespace to
174
+ * EITHER the tokenized dir or a legacy raw-name dir under `namespaces/`, so we
175
+ * accept any contained child rather than a single exact token path. This is a
176
+ * pure string check — symlink escape is checked separately via realpath.
177
+ */
178
+ private isLexicallyContained;
179
+ /**
180
+ * Whether a candidate storage dir satisfies the catalog containment contract,
181
+ * including SYMLINK-escape rejection (round 5, codex P2). A lexically-contained
182
+ * path that is actually a symlink to an outside directory would let maintenance
183
+ * or QMD follow it outside `memoryDir`. We mirror `rebuildFromDisk`'s posture:
184
+ * the path must be lexically contained AND, if it exists on disk, neither the
185
+ * path itself a symlink nor its realpath escaping the memory root. Non-existent
186
+ * paths pass the realpath stage (nothing to follow yet) but still must be
187
+ * lexically contained.
188
+ */
189
+ private isContainedStorageDir;
190
+ /**
191
+ * Reject a candidate whose path crosses a SYMLINKED ancestor strictly between
192
+ * memoryDir and the leaf (codex NVuq5). `realpath`-based containment accepts a
193
+ * symlinked `<memoryDir>/namespaces` that currently resolves back inside
194
+ * memoryDir, but the disk scanner rejects such a root and a later retarget would
195
+ * escape the memory tree — so refuse it here too. The leaf itself is
196
+ * symlink-checked by the caller; this walks only the intermediate ancestors.
197
+ */
198
+ private hasSymlinkedAncestor;
199
+ /**
200
+ * Walk up from a not-yet-existing candidate to the nearest ancestor that exists
201
+ * on disk and verify its realpath stays inside `memoryReal` (round 6, codex P2
202
+ * — NDo79). Rejects a non-existent leaf whose existing parent chain escapes
203
+ * memoryDir via a symlink. Stops at memoryDir's resolved root.
204
+ *
205
+ * The nearest existing ancestor must also be a DIRECTORY (NHIdt, codex P2): if
206
+ * an existing parent such as `<memoryDir>/namespaces` is a regular FILE (or
207
+ * socket/fifo), `realpath(parent)` still succeeds and resolves inside memoryDir,
208
+ * so a containment-only check would ACCEPT a leaf that can never be created — you
209
+ * cannot mkdir a child under a file. We `lstat` the nearest existing ancestor and
210
+ * reject when it is not a directory, mirroring the leaf non-directory rejection
211
+ * (NF21i) and the disk scan, so every containment consumer agrees.
212
+ */
213
+ private isNearestExistingAncestorContained;
214
+ /**
215
+ * Resolve the storage dir to persist for a touch, validating any caller-
216
+ * provided `metadata.storageDir` against the catalog containment contract
217
+ * (round 4 + round 5, codex P2). `markWrite`/`registerResolved` accept an
218
+ * explicit storageDir, but persisting it verbatim would let a bad hook or
219
+ * external consumer write an arbitrary path — including one outside `memoryDir`
220
+ * or a symlink that escapes it — into the catalog, handing maintenance/QMD an
221
+ * unsafe root. We accept an explicit (or previously-stored) dir ONLY when it
222
+ * stays contained under memoryDir (lexically AND via realpath); otherwise we
223
+ * drop it and fall back to the trusted resolved dir.
224
+ */
225
+ private resolveTouchStorageDir;
226
+ /**
227
+ * Whether `candidate` is a legitimate storage root FOR `namespace` (round 6,
228
+ * codex P2 — NDATT). Accepts the namespace's router-resolved root, its canonical
229
+ * lexical tokenized dir, and (for the default namespace only) memoryDir. This
230
+ * prevents a contained-but-CROSS-NAMESPACE path — another namespace's tree, or
231
+ * memoryDir for a non-default namespace — from being persisted as this
232
+ * namespace's root. Compared on resolved (absolute) paths.
233
+ */
234
+ private isStorageDirForNamespace;
235
+ /**
236
+ * Resolve the canonical storage dir for a namespace as the LIVE ROUTER would,
237
+ * but NEVER return a path that escapes the memory root.
238
+ *
239
+ * Router alignment (round 4, cursor Medium): a read/register touch with no
240
+ * explicit storageDir previously used the lexical `resolveStorageDir`, which
241
+ * always picks `<memoryDir>/namespaces/<token>` (or `memoryDir` for the
242
+ * default). That diverges from `NamespaceStorageRouter`, which can route to a
243
+ * legacy raw-name dir or a migrated default root — so a recall touch could
244
+ * record a contained-but-WRONG root that maintenance/rebuild then targets. We
245
+ * now delegate to the shared `resolveNamespaceStorageRoot` (the very helper the
246
+ * router uses) so the catalog records the same on-disk root the router serves.
247
+ *
248
+ * Containment (round 5, codex P2): the resolved path can still be a symlink
249
+ * escaping memoryDir, so we run the full (lexical + realpath) containment
250
+ * contract. When it FAILS we fall back to a NAMESPACE-SPECIFIC safe root, NOT
251
+ * a blanket `memoryDir`. Recording `memoryDir` for a non-default namespace
252
+ * would point enumeration/maintenance at the DEFAULT namespace's tree (round 5,
253
+ * cursor/codex Medium/P2) — a cross-namespace fanout error. The correct safe
254
+ * root is the namespace's own lexical tokenized dir
255
+ * (`<memoryDir>/namespaces/<token>`), which is always contained and is that
256
+ * namespace's canonical location (we record the lexical PATH as metadata; we do
257
+ * not follow the escaping symlink). Only the default namespace — or a token so
258
+ * unsafe even the lexical dir cannot be built — falls back to `memoryDir`.
259
+ */
260
+ private resolveSafeStorageDir;
261
+ /**
262
+ * The namespace-specific contained fallback root, used when the router-resolved
263
+ * root fails containment (round 5, cursor/codex Medium/P2).
264
+ *
265
+ * Preference order:
266
+ * 1. The namespace's OWN lexical tokenized dir (`namespaces/<token>`) — so a
267
+ * non-default namespace is NOT pointed at the DEFAULT namespace's `memoryDir`
268
+ * tree (which would misdirect maintenance fanout). Returned only when the
269
+ * token dir itself stays CONTAINED (it is not a symlink, and its realpath
270
+ * does not escape memoryDir — e.g. via a symlinked `namespaces/` parent).
271
+ * 2. `memoryDir` as a LAST resort — for the default namespace, an unsafe token
272
+ * that cannot build a contained path, OR the irreparable case where the
273
+ * token dir's realpath escapes the root (so even its lexical path resolves
274
+ * outside). NF21m note (codex P2): we deliberately do NOT record the lexical
275
+ * token dir in that irreparable case — its realpath escapes memoryDir, and
276
+ * the NDo79 contract REQUIRES that an escaping path is never persisted (a
277
+ * later mkdir/maintenance/QMD op would follow it outside the root). Since no
278
+ * contained namespace-specific path exists, containment wins: `memoryDir` is
279
+ * the only safe root left. A namespace whose token dir's realpath escapes is
280
+ * an irreparable on-disk state; recording the contained default root is
281
+ * strictly safer than persisting an escaping one. The common case where the
282
+ * token dir IS contained is handled by branch 1, so a healthy non-default
283
+ * namespace never reaches `memoryDir`.
284
+ */
285
+ private safeFallbackStorageDir;
286
+ /**
287
+ * Re-check, NOW, whether a namespace's storage root currently EXISTS on disk
288
+ * with the SAME safety the directory scan uses (NFJV8, codex P2).
289
+ *
290
+ * The rebuild's final re-merge runs under the held lock and folds the freshly
291
+ * re-read log (`latest`) into the scanned `rebuilt` set. A namespace present in
292
+ * `latest` (a live touch row) but ABSENT from `rebuilt` is normally PURGED as
293
+ * deleted (the NATqU "disk scan is authoritative" rule). But there is a TOCTOU
294
+ * window: a dynamic namespace can be CREATED on disk AFTER `rebuildFromDisk()`
295
+ * already enumerated `namespaces/` but BEFORE this re-merge. The scan snapshot
296
+ * missed its new root, yet a gateway `markWrite` already appended a row for it.
297
+ * Blindly purging that row would rewrite the catalog WITHOUT a live namespace
298
+ * that now has data on disk, so `writtenSince`/maintenance/QMD consumers miss
299
+ * it until another touch or rebuild.
300
+ *
301
+ * So before purging, we re-resolve the namespace's safe storage root (the same
302
+ * router-aligned, containment-checked path the scan would have catalogued) and
303
+ * confirm it is a real, contained, non-symlink directory that actually holds
304
+ * memory data RIGHT NOW. If so the namespace was created-after-scan and is LIVE
305
+ * — KEEP its row. This is the precise inverse of NATqU and does NOT reintroduce
306
+ * it: a touch on a REMOVED root re-checks as ABSENT (no data on disk) and is
307
+ * still purged; only a root that EXISTS on a fresh re-check is kept.
308
+ *
309
+ * Mirrors the per-entry scan checks (symlink rejection + realpath containment +
310
+ * `hasMemoryData`) so a symlinked/escaping root is never resurrected.
311
+ */
312
+ private liveStorageRootExistsForRebuild;
313
+ /**
314
+ * Record a namespace touch. Returns whether the touch actually APPENDED to the
315
+ * log (round 6, codex P2 — NEFoX): a disabled catalog or a dropped append (the
316
+ * NAUf7 rebuild-lock-timeout drop) returns `false`, so callers (e.g. the router
317
+ * resolve-hook dedup) can avoid marking a dropped registration as completed and
318
+ * suppressing its retry.
319
+ */
320
+ private touch;
321
+ rebuildFromDisk(options?: {
322
+ dryRun?: boolean;
323
+ }): Promise<NamespaceCatalogRebuildResult>;
324
+ /**
325
+ * Body of `rebuildFromDisk`, run inside a single `queueCritical` turn. MUST
326
+ * only be invoked from within the serialized chain so the load and the
327
+ * rewrite are atomic with respect to concurrent touches (in-process).
328
+ *
329
+ * `wantMutate` is true for an `--apply` (the caller intends to rewrite). The
330
+ * cross-process file lock is acquired LATE — only around the final
331
+ * load→merge→rename window (NFgCT, codex P2) — never across the disk scan, so a
332
+ * long scan does not force concurrent gateway touches to wait (and drop their
333
+ * append). Whether the rewrite actually happened is reported via the result's
334
+ * `applied`: true only when `wantMutate` AND the lock was acquired.
335
+ */
336
+ private rebuildInsideChain;
337
+ /**
338
+ * Final load→merge→rename window of a rebuild, factored out so the caller can
339
+ * run it WITHIN the cross-process file lock (NFgCT, codex P2) without holding
340
+ * that lock across the preceding disk scan. Re-reads the latest on-disk state,
341
+ * folds concurrent touches, then (when `canMutate`) atomically rewrites the log.
342
+ *
343
+ * `canMutate` records that the cross-process lock was actually held. The
344
+ * re-merge + rewrite run only when it is true — a dry-run, or an unlocked apply
345
+ * (lock-acquisition timeout), computes records but does NOT rename, so it can
346
+ * never clobber a concurrent lock holder's window. `applied` mirrors `canMutate`.
347
+ */
348
+ private finishRebuild;
349
+ /**
350
+ * Run `fn` while HOLDING the shared cross-process advisory lock (round 5, codex
351
+ * P2; generalized round 7 — NEZkA). This is the SINGLE mutex shared by BOTH the
352
+ * touch read→merge→append window AND the rebuild final load→merge→rename window,
353
+ * so a touch and a rebuild in different processes are mutually exclusive over
354
+ * their respective critical sections — closing the check-then-append gap where a
355
+ * polled-only touch could append into a rebuild's load→rename window.
356
+ *
357
+ * Acquisition is atomic via `open(..., "wx")`. A lock older than
358
+ * `REBUILD_LOCK_STALE_MS` is treated as a crashed holder and broken. After
359
+ * `REBUILD_LOCK_MAX_WAIT_MS` of contention we proceed best-effort WITHOUT the
360
+ * lock rather than block forever. The lock is always released in `finally`.
361
+ *
362
+ * IN-PROCESS SAFETY: every caller invokes this from inside (or wrapping) the
363
+ * per-process `queueCritical` chain, which serializes all catalog mutations in
364
+ * THIS process. So within one process only one logical holder attempts OS-lock
365
+ * acquisition at a time — the file lock is never self-contended in-process, and
366
+ * the lock is acquired and released within a single in-process turn. The file
367
+ * lock adds only the missing CROSS-process exclusion.
368
+ *
369
+ * HEARTBEAT (round 5, cursor/codex Medium/P2): while WE hold the lock a timer
370
+ * refreshes its mtime every `REBUILD_LOCK_HEARTBEAT_MS`, so a legitimately long
371
+ * holder (> `REBUILD_LOCK_STALE_MS`) is not treated as a crashed holder and
372
+ * unlinked by another process — which would let overlapping windows lose
373
+ * appends. Heartbeat failures are swallowed; the timer is always cleared in
374
+ * `finally`.
375
+ *
376
+ * ACQUISITION RESULT (round 6, codex P2 — NBPmY): `fn` receives whether WE
377
+ * actually hold the lock. When acquisition TIMED OUT (another holder is active),
378
+ * a MUTATING rebuild must NOT perform its load/rename window unlocked, and a
379
+ * touch must NOT append unlocked — both would recreate the lost-append race. The
380
+ * caller uses `acquired` to run compute-only (rebuild) or DROP the append
381
+ * (touch) when unlocked.
382
+ */
383
+ private withHeldCatalogLock;
384
+ /** Try to acquire the rebuild lock; returns true if WE created it. */
385
+ private acquireRebuildLock;
386
+ /**
387
+ * Remove the lock file if its mtime is older than the stale threshold.
388
+ *
389
+ * REPLACEMENT-SAFE (NG7Bg, codex P2): a plain `stat` → `unlink` has a TOCTOU
390
+ * window — two processes can both observe the SAME stale lock; one removes it and
391
+ * creates a FRESH lock, and the other's later `unlink` then deletes that fresh
392
+ * holder's ACTIVE lock based on the stale identity it read earlier, leaving the
393
+ * fresh holder running its critical section with no visible lock and reopening the
394
+ * lost-update race the mutex prevents. We therefore capture the lock's IDENTITY
395
+ * (its full content line: `<pid> <owner-uuid> <iso>`) when we judge it stale, then
396
+ * RE-READ immediately before unlinking and only remove it when the content is
397
+ * byte-identical AND still stale. A replacement lock has a different owner id /
398
+ * timestamp, so its content differs and we leave it untouched. We never unlink a
399
+ * lock whose mtime is now fresh (a heartbeat refreshed it) or whose identity
400
+ * changed (a replacement was created). This is best-effort: any mismatch/vanish
401
+ * simply skips the break and the caller polls again.
402
+ */
403
+ private breakStaleRebuildLock;
404
+ /**
405
+ * Whether the rebuild lock file was written by THIS instance (round 6, codex
406
+ * P2 — NBsGP). Matches the per-instance owner id, NOT just `process.pid`: two
407
+ * NamespaceCatalog instances in the same process share a PID, so a PID-only
408
+ * check would wrongly treat instance A's lock as self-held by instance B and
409
+ * let B's touch skip the wait and append into A's rebuild window. Falls back to
410
+ * the legacy PID-only form for lock files written before owner ids existed.
411
+ */
412
+ private rebuildLockHeldBySelf;
413
+ /**
414
+ * Merge a prior record's preserved metadata (timestamps, principal hints)
415
+ * onto a freshly-discovered record. Disk-derived fields (storageDir, kind)
416
+ * take precedence from the new record.
417
+ *
418
+ * PROVENANCE (round 3, cursor Low): `discoveredBy` and `createdAt` are
419
+ * CREATION-ONLY — identical to the touch path's invariant. A rebuild must NOT
420
+ * reset a namespace first seen via a `write`/`read` touch back to `config`
421
+ * just because it is also listed in policies. So when a prior record exists we
422
+ * carry its `discoveredBy` forward; only brand-new records keep the fresh
423
+ * (config/scan) provenance.
424
+ */
425
+ private mergeForRebuild;
426
+ /** Load the JSONL log and fold it into current state (last-record-wins). */
427
+ private loadCompacted;
428
+ /**
429
+ * Serialize an arbitrary read-modify-write critical section through the single
430
+ * write chain. Every catalog mutation (touch read+merge+append, full rewrite)
431
+ * runs through this so they are mutually exclusive: a touch always reads the
432
+ * latest persisted state before appending, and a rebuild rewrite cannot
433
+ * interleave with a touch's append. The chain recovers from rejection
434
+ * (CLAUDE.md rule #40) — one failed section never poisons subsequent ones —
435
+ * while still surfacing the error to that section's awaited promise.
436
+ */
437
+ private queueCritical;
438
+ /**
439
+ * Append a single record to the JSONL log WITHOUT re-serializing through the
440
+ * write chain. MUST only be called from inside a `queueCritical(...)` section
441
+ * (which already holds the serialized turn); calling it directly would bypass
442
+ * the read-before-append ordering that prevents lost-field races.
443
+ */
444
+ private appendUnchained;
445
+ /**
446
+ * Atomic temp-file + rename rewrite (CLAUDE.md rule #54: write temp, then
447
+ * rename — never delete-before-write) WITHOUT re-entering the write chain.
448
+ * MUST only be called from inside a `queueCritical(...)` turn (e.g. the
449
+ * rebuild critical section, which already holds the serialized turn so its
450
+ * load and rewrite are atomic against concurrent touches). Re-entering the
451
+ * chain from within a held turn would deadlock.
452
+ */
453
+ private rewriteUnchained;
454
+ }
455
+
456
+ export { NamespaceCatalog as N, type NamespaceCatalogFilter as a, type NamespaceCatalogRebuildResult as b, type NamespaceCatalogSkippedRoot as c, type NamespaceDiscoverySource as d, type NamespaceKind as e, type NamespaceRecord as f, type NamespaceTouchMetadata as g };
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  readChainIndex,
3
3
  resolveChainsDir
4
- } from "./chunk-BTVX7ZXZ.js";
5
- import "./chunk-HQ6NIBL6.js";
4
+ } from "./chunk-4NFVPDIL.js";
5
+ import "./chunk-7FL4CNPV.js";
6
6
  import {
7
7
  resolveCausalTrajectoryStoreDir
8
- } from "./chunk-JD4SCARD.js";
8
+ } from "./chunk-YN4ZT4CW.js";
9
9
  import {
10
10
  log
11
- } from "./chunk-2ODBA7MQ.js";
11
+ } from "./chunk-NU3CSQ4H.js";
12
12
  import {
13
13
  normalizeRecallTokens
14
14
  } from "./chunk-ZBJMUXZH.js";
@@ -6,10 +6,10 @@ import {
6
6
  stitchCausalChain,
7
7
  validateCausalEdge,
8
8
  writeChainIndex
9
- } from "./chunk-BTVX7ZXZ.js";
10
- import "./chunk-HQ6NIBL6.js";
11
- import "./chunk-JD4SCARD.js";
12
- import "./chunk-2ODBA7MQ.js";
9
+ } from "./chunk-4NFVPDIL.js";
10
+ import "./chunk-7FL4CNPV.js";
11
+ import "./chunk-YN4ZT4CW.js";
12
+ import "./chunk-NU3CSQ4H.js";
13
13
  import "./chunk-ZBJMUXZH.js";
14
14
  import "./chunk-A2IYSXDQ.js";
15
15
  import "./chunk-LPSF4OQH.js";
@@ -1,29 +1,29 @@
1
1
  import {
2
2
  readChainIndex,
3
3
  resolveChainsDir
4
- } from "./chunk-BTVX7ZXZ.js";
4
+ } from "./chunk-4NFVPDIL.js";
5
5
  import {
6
6
  buildExtensionsBlockForConsolidation
7
- } from "./chunk-2IBGHRIO.js";
7
+ } from "./chunk-GS55WYRL.js";
8
8
  import {
9
9
  runPostConsolidationMaterialize
10
- } from "./chunk-XWEXT4XU.js";
11
- import "./chunk-LN4YGHTM.js";
10
+ } from "./chunk-QANVLERJ.js";
11
+ import "./chunk-UUH4YQOF.js";
12
12
  import "./chunk-JLNBQWZ2.js";
13
13
  import "./chunk-3UXOZBHV.js";
14
- import "./chunk-HQ6NIBL6.js";
14
+ import "./chunk-7FL4CNPV.js";
15
15
  import {
16
16
  FallbackLlmClient,
17
17
  fallbackLlmRuntimeContextFromConfig
18
- } from "./chunk-LCC5EZTT.js";
19
- import "./chunk-B5XMS73R.js";
18
+ } from "./chunk-FIVDN2SM.js";
19
+ import "./chunk-IQVQJJL7.js";
20
20
  import "./chunk-L2EXJQJP.js";
21
- import "./chunk-7SI52C65.js";
21
+ import "./chunk-VL7DP3OW.js";
22
22
  import "./chunk-RK6F44Y6.js";
23
23
  import {
24
24
  resolveCausalTrajectoryStoreDir
25
- } from "./chunk-JD4SCARD.js";
26
- import "./chunk-53FDU4CE.js";
25
+ } from "./chunk-YN4ZT4CW.js";
26
+ import "./chunk-BLIWOONZ.js";
27
27
  import "./chunk-M7XQSUBB.js";
28
28
  import "./chunk-5UZXUTVO.js";
29
29
  import "./chunk-5GPPACXK.js";
@@ -52,7 +52,7 @@ import "./chunk-EYIEWJNI.js";
52
52
  import "./chunk-JUC24CTX.js";
53
53
  import {
54
54
  log
55
- } from "./chunk-2ODBA7MQ.js";
55
+ } from "./chunk-NU3CSQ4H.js";
56
56
  import "./chunk-ZBJMUXZH.js";
57
57
  import {
58
58
  isRecord
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  readChainIndex,
3
3
  resolveChainsDir
4
- } from "./chunk-BTVX7ZXZ.js";
5
- import "./chunk-HQ6NIBL6.js";
4
+ } from "./chunk-4NFVPDIL.js";
5
+ import "./chunk-7FL4CNPV.js";
6
6
  import {
7
7
  readCausalTrajectoryRecords,
8
8
  searchCausalTrajectories
9
- } from "./chunk-JD4SCARD.js";
9
+ } from "./chunk-YN4ZT4CW.js";
10
10
  import {
11
11
  log
12
- } from "./chunk-2ODBA7MQ.js";
12
+ } from "./chunk-NU3CSQ4H.js";
13
13
  import "./chunk-ZBJMUXZH.js";
14
14
  import "./chunk-A2IYSXDQ.js";
15
15
  import "./chunk-LPSF4OQH.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  appendEdge
3
- } from "./chunk-2LDBXPLB.js";
3
+ } from "./chunk-KF74X62T.js";
4
4
  import "./chunk-2LSZVONP.js";
5
5
  import "./chunk-DEUNUKTD.js";
6
6
  import "./chunk-PZ5AY32C.js";
@@ -6,7 +6,7 @@ import {
6
6
  resolveCausalTrajectoryStoreDir,
7
7
  searchCausalTrajectories,
8
8
  validateCausalTrajectoryRecord
9
- } from "./chunk-JD4SCARD.js";
9
+ } from "./chunk-YN4ZT4CW.js";
10
10
  import "./chunk-ZBJMUXZH.js";
11
11
  import "./chunk-A2IYSXDQ.js";
12
12
  import "./chunk-LPSF4OQH.js";
@@ -1,33 +1,33 @@
1
1
  import {
2
2
  MeilisearchBackend
3
- } from "./chunk-DOCTITOP.js";
3
+ } from "./chunk-WRFKZEO6.js";
4
4
  import {
5
5
  NoopSearchBackend
6
6
  } from "./chunk-CYEPCZN5.js";
7
7
  import {
8
8
  OramaBackend
9
- } from "./chunk-Q5ZU3RNY.js";
9
+ } from "./chunk-LQ6JI4VH.js";
10
10
  import {
11
11
  RemoteSearchBackend
12
- } from "./chunk-JOASJWQR.js";
12
+ } from "./chunk-SANZHXY2.js";
13
13
  import {
14
14
  EmbedHelper
15
- } from "./chunk-RN7MUWON.js";
15
+ } from "./chunk-EHISUJFN.js";
16
16
  import {
17
17
  LanceDbBackend
18
- } from "./chunk-OUWAQVDJ.js";
18
+ } from "./chunk-5CEJH5ZN.js";
19
19
  import {
20
20
  createConversationIndexBackend
21
- } from "./chunk-7OGJQP7T.js";
21
+ } from "./chunk-DCWIQFNA.js";
22
22
  import {
23
23
  FaissConversationIndexAdapter
24
- } from "./chunk-E6ZDCOHM.js";
24
+ } from "./chunk-XBZQRZ6G.js";
25
25
  import {
26
26
  QmdClient
27
- } from "./chunk-6RHNCKHG.js";
27
+ } from "./chunk-K43PI6DQ.js";
28
28
  import {
29
29
  log
30
- } from "./chunk-2ODBA7MQ.js";
30
+ } from "./chunk-NU3CSQ4H.js";
31
31
 
32
32
  // src/search/factory.ts
33
33
  import path from "path";
@@ -170,4 +170,4 @@ export {
170
170
  createConversationSearchBackend,
171
171
  createConversationIndexRuntime
172
172
  };
173
- //# sourceMappingURL=chunk-ROHLEUTH.js.map
173
+ //# sourceMappingURL=chunk-2KAYTPPT.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  NamespaceStorageRouter
3
- } from "./chunk-FMEKEF47.js";
3
+ } from "./chunk-WIHPNY65.js";
4
4
  import {
5
5
  namespaceCollectionName
6
- } from "./chunk-DQY7NJ5L.js";
6
+ } from "./chunk-CTOQEZSN.js";
7
7
  import {
8
8
  namespaceIdentityFromToken,
9
9
  namespaceIdentityToken
@@ -204,4 +204,4 @@ export {
204
204
  verifyNamespaces,
205
205
  runNamespaceMigration
206
206
  };
207
- //# sourceMappingURL=chunk-NHQGDVJF.js.map
207
+ //# sourceMappingURL=chunk-2SJCWLQD.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-MDYG7VI7.js";
4
4
  import {
5
5
  log
6
- } from "./chunk-2ODBA7MQ.js";
6
+ } from "./chunk-NU3CSQ4H.js";
7
7
 
8
8
  // src/temporal-supersession.ts
9
9
  function normalizeSupersessionKey(raw) {
@@ -238,4 +238,4 @@ export {
238
238
  applyTemporalSupersession,
239
239
  shouldFilterSupersededFromRecall
240
240
  };
241
- //# sourceMappingURL=chunk-YTWNKQ2G.js.map
241
+ //# sourceMappingURL=chunk-3FC6LW6T.js.map