@remnic/core 9.3.683 → 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 (440) hide show
  1. package/dist/access-boundary.d.ts +5 -4
  2. package/dist/access-boundary.js +27 -26
  3. package/dist/access-cli.js +75 -75
  4. package/dist/access-http.d.ts +5 -4
  5. package/dist/access-http.js +32 -31
  6. package/dist/access-mcp.d.ts +5 -4
  7. package/dist/access-mcp.js +29 -28
  8. package/dist/access-operations.d.ts +5 -4
  9. package/dist/access-operations.js +28 -27
  10. package/dist/{access-service-DvA6jyHL.d.ts → access-service-DeKrlYU_.d.ts} +2 -11
  11. package/dist/access-service.d.ts +5 -4
  12. package/dist/access-service.js +26 -25
  13. package/dist/access-surface-catalog.d.ts +5 -4
  14. package/dist/action-confidence.d.ts +1 -1
  15. package/dist/active-memory-bridge.d.ts +1 -1
  16. package/dist/active-recall.d.ts +1 -1
  17. package/dist/active-recall.js +3 -3
  18. package/dist/adapters/index.js +4 -4
  19. package/dist/adapters/registry.js +2 -2
  20. package/dist/{auto-sync-5CJBJMPZ.js → auto-sync-NUQWSFQD.js} +7 -7
  21. package/dist/behavior-learner.d.ts +1 -1
  22. package/dist/behavior-signals.d.ts +1 -1
  23. package/dist/bootstrap.d.ts +4 -3
  24. package/dist/bootstrap.js +2 -2
  25. package/dist/boxes.js +2 -2
  26. package/dist/briefing.d.ts +1 -1
  27. package/dist/briefing.js +5 -4
  28. package/dist/buffer-surprise-report.d.ts +1 -1
  29. package/dist/buffer.d.ts +1 -1
  30. package/dist/buffer.js +2 -2
  31. package/dist/calibration.d.ts +1 -1
  32. package/dist/calibration.js +4 -4
  33. package/dist/capabilities.d.ts +1 -1
  34. package/dist/catalog-COqWZlZ6.d.ts +456 -0
  35. package/dist/causal-behavior.d.ts +1 -1
  36. package/dist/causal-behavior.js +4 -4
  37. package/dist/causal-chain.js +4 -4
  38. package/dist/causal-consolidation.d.ts +1 -1
  39. package/dist/causal-consolidation.js +13 -12
  40. package/dist/causal-consolidation.js.map +1 -1
  41. package/dist/causal-retrieval.js +4 -4
  42. package/dist/causal-trajectory-graph.js +1 -1
  43. package/dist/causal-trajectory.js +1 -1
  44. package/dist/{chunk-UJDV2NLT.js → chunk-2KAYTPPT.js} +12 -12
  45. package/dist/{chunk-QUA2JPH2.js → chunk-2SJCWLQD.js} +3 -3
  46. package/dist/{chunk-YTWNKQ2G.js → chunk-3FC6LW6T.js} +2 -2
  47. package/dist/{chunk-I75DF4FZ.js → chunk-4FE2K57M.js} +3 -3
  48. package/dist/{chunk-L5MUA6Q7.js → chunk-4N3TFFPH.js} +2 -2
  49. package/dist/{chunk-BTVX7ZXZ.js → chunk-4NFVPDIL.js} +4 -4
  50. package/dist/{chunk-OUWAQVDJ.js → chunk-5CEJH5ZN.js} +2 -2
  51. package/dist/{chunk-IUZWBCJX.js → chunk-6GJS4BFH.js} +10 -7
  52. package/dist/chunk-6GJS4BFH.js.map +1 -0
  53. package/dist/{chunk-UAODC6GJ.js → chunk-6O6A6YUO.js} +4 -4
  54. package/dist/{chunk-HQ6NIBL6.js → chunk-7FL4CNPV.js} +2 -2
  55. package/dist/{chunk-5VDJMYTF.js → chunk-7WWURLG6.js} +3 -3
  56. package/dist/{chunk-QWRC7GIO.js → chunk-A4HH2EWA.js} +5 -5
  57. package/dist/{chunk-4SKKVWLQ.js → chunk-AGJH5ISO.js} +2 -2
  58. package/dist/{chunk-APJQ6UEA.js → chunk-AGNBY3VG.js} +4 -4
  59. package/dist/{chunk-I3HSKQT7.js → chunk-B43NZNMG.js} +68 -106
  60. package/dist/chunk-B43NZNMG.js.map +1 -0
  61. package/dist/{chunk-NQMBSSWW.js → chunk-B4XVLHJA.js} +3 -3
  62. package/dist/{chunk-GSTYVG5L.js → chunk-BFVPIKDY.js} +3 -3
  63. package/dist/{chunk-TY5NT3T3.js → chunk-BLIWOONZ.js} +51 -43
  64. package/dist/chunk-BLIWOONZ.js.map +1 -0
  65. package/dist/{chunk-AJU4PJGY.js → chunk-BVKCV2ZY.js} +2 -2
  66. package/dist/{chunk-QVWM4C24.js → chunk-BZISAF67.js} +9 -10
  67. package/dist/chunk-BZISAF67.js.map +1 -0
  68. package/dist/{chunk-EG4TCVMU.js → chunk-CTOQEZSN.js} +2 -2
  69. package/dist/{chunk-7OGJQP7T.js → chunk-DCWIQFNA.js} +4 -4
  70. package/dist/{chunk-MHQC2WU2.js → chunk-DKTSR7EK.js} +2 -2
  71. package/dist/{chunk-RN7MUWON.js → chunk-EHISUJFN.js} +2 -2
  72. package/dist/{chunk-WLEB7WCG.js → chunk-EO5QWINU.js} +2 -2
  73. package/dist/{chunk-XKXKSQU7.js → chunk-EXM3CQTZ.js} +2 -2
  74. package/dist/{chunk-TOQEZ63C.js → chunk-FE6DQUNJ.js} +9 -9
  75. package/dist/{chunk-LCC5EZTT.js → chunk-FIVDN2SM.js} +4 -4
  76. package/dist/{chunk-452WDNFO.js → chunk-GG6AJN7A.js} +2 -2
  77. package/dist/{chunk-O2WELT5C.js → chunk-GS55WYRL.js} +3 -3
  78. package/dist/{chunk-OHX52AOS.js → chunk-GTDH3IUH.js} +2 -2
  79. package/dist/{chunk-IBTZEBUD.js → chunk-HYNHLBKA.js} +2 -2
  80. package/dist/{chunk-V254FAT5.js → chunk-IIDSFFE5.js} +2 -2
  81. package/dist/{chunk-EVWIEEKZ.js → chunk-IQ7WCZRW.js} +2 -2
  82. package/dist/{chunk-B5XMS73R.js → chunk-IQVQJJL7.js} +2 -2
  83. package/dist/{chunk-M4I3TREG.js → chunk-JPCKLFWK.js} +29 -30
  84. package/dist/{chunk-M4I3TREG.js.map → chunk-JPCKLFWK.js.map} +1 -1
  85. package/dist/{chunk-6RHNCKHG.js → chunk-K43PI6DQ.js} +2 -2
  86. package/dist/{chunk-OIF36KGD.js → chunk-KCQA46NR.js} +2 -2
  87. package/dist/{chunk-2LDBXPLB.js → chunk-KF74X62T.js} +1 -1
  88. package/dist/{chunk-MAV46GWQ.js → chunk-KYYL4U6X.js} +2 -2
  89. package/dist/{chunk-6GC5SGFE.js → chunk-L24JROPR.js} +2 -2
  90. package/dist/{chunk-6VP3YUCS.js → chunk-LLONI6PY.js} +2 -2
  91. package/dist/{chunk-Q5ZU3RNY.js → chunk-LQ6JI4VH.js} +2 -2
  92. package/dist/{chunk-ODWI5XU2.js → chunk-MCQDSY4G.js} +3 -3
  93. package/dist/{chunk-HP5FMB6L.js → chunk-MDJURR27.js} +2 -2
  94. package/dist/{chunk-FMSDA2D3.js → chunk-NGFEWFNK.js} +1 -1
  95. package/dist/chunk-NGFEWFNK.js.map +1 -0
  96. package/dist/{chunk-2ODBA7MQ.js → chunk-NU3CSQ4H.js} +5 -5
  97. package/dist/chunk-NU3CSQ4H.js.map +1 -0
  98. package/dist/{chunk-T2PO5MUF.js → chunk-O7GOFAM3.js} +2 -2
  99. package/dist/{chunk-Z2OXSMZK.js → chunk-OBXTMFZQ.js} +3 -3
  100. package/dist/{chunk-FDSOMA6M.js → chunk-OFUULUSY.js} +8 -9
  101. package/dist/{chunk-FDSOMA6M.js.map → chunk-OFUULUSY.js.map} +1 -1
  102. package/dist/{chunk-KV6CX4ON.js → chunk-OV4D5T7V.js} +3 -3
  103. package/dist/{chunk-KACIOX42.js → chunk-PH3HOKYW.js} +2 -2
  104. package/dist/{chunk-NHFXF4ZO.js → chunk-PK6RGRSD.js} +2 -2
  105. package/dist/{chunk-C3IW2F5Z.js → chunk-PLBIPT6I.js} +2 -2
  106. package/dist/{chunk-QY7YA7OL.js → chunk-PNLCEFE4.js} +2 -2
  107. package/dist/{chunk-AGRPGAKR.js → chunk-PONNZ54D.js} +2 -2
  108. package/dist/{chunk-XZ4WBBB5.js → chunk-PWFWCGOO.js} +2 -2
  109. package/dist/{chunk-G7Z3C2X6.js → chunk-QANVLERJ.js} +4 -4
  110. package/dist/{chunk-W4RVMTHR.js → chunk-QRDOSYOR.js} +2 -2
  111. package/dist/{chunk-6IMKOIZ6.js → chunk-R6OVFAX6.js} +2 -2
  112. package/dist/{chunk-2QSZNTDO.js → chunk-RKNJBZ55.js} +4 -4
  113. package/dist/{chunk-JOASJWQR.js → chunk-SANZHXY2.js} +2 -2
  114. package/dist/{chunk-7DTASS5T.js → chunk-SJHM6I4J.js} +2 -2
  115. package/dist/{chunk-H4BDNIKQ.js → chunk-SQGPGC76.js} +14 -24
  116. package/dist/{chunk-H4BDNIKQ.js.map → chunk-SQGPGC76.js.map} +1 -1
  117. package/dist/{chunk-B2B2IHUH.js → chunk-STOEE37X.js} +4 -4
  118. package/dist/{chunk-GKKAXVAJ.js → chunk-U33LWTQQ.js} +1 -7
  119. package/dist/chunk-U33LWTQQ.js.map +1 -0
  120. package/dist/{chunk-GNAMDNGT.js → chunk-U7D7NP4J.js} +5 -5
  121. package/dist/{chunk-DRD2Q7HQ.js → chunk-UFS7OXGL.js} +2 -2
  122. package/dist/{chunk-H3HDXD3U.js → chunk-UPTZYUYJ.js} +2 -2
  123. package/dist/{chunk-3IND7N4X.js → chunk-UTYBJR7M.js} +2 -2
  124. package/dist/{chunk-LN4YGHTM.js → chunk-UUH4YQOF.js} +2 -2
  125. package/dist/{chunk-6VF75M3X.js → chunk-VGUOEDTU.js} +2 -2
  126. package/dist/{chunk-44VFF3BB.js → chunk-VILEUJXC.js} +2 -2
  127. package/dist/{chunk-7SI52C65.js → chunk-VL7DP3OW.js} +2 -2
  128. package/dist/{chunk-7DHTMOND.js → chunk-VQ34TERH.js} +2 -2
  129. package/dist/{chunk-H6PMGMNP.js → chunk-VX6OBUDW.js} +2 -2
  130. package/dist/{chunk-EW5KFXHL.js → chunk-WDXCNJSF.js} +7 -7
  131. package/dist/{chunk-ARLRTZZZ.js → chunk-WIHPNY65.js} +79 -3
  132. package/dist/chunk-WIHPNY65.js.map +1 -0
  133. package/dist/{chunk-X6IRLNOO.js → chunk-WIWPSQYU.js} +2 -2
  134. package/dist/{chunk-DOCTITOP.js → chunk-WRFKZEO6.js} +2 -2
  135. package/dist/{chunk-E6ZDCOHM.js → chunk-XBZQRZ6G.js} +2 -2
  136. package/dist/{chunk-7YX23JBA.js → chunk-XHYGJVXL.js} +2 -2
  137. package/dist/{chunk-JD4SCARD.js → chunk-YN4ZT4CW.js} +1 -1
  138. package/dist/{chunk-YXWAILM4.js → chunk-YOI3ELXF.js} +2 -2
  139. package/dist/{chunk-XCAZF7KQ.js → chunk-ZA2S2VLL.js} +2 -2
  140. package/dist/{chunk-BEUDU7Y4.js → chunk-ZCWIH4LH.js} +2 -2
  141. package/dist/chunk-ZPQVJEVQ.js +184 -0
  142. package/dist/chunk-ZPQVJEVQ.js.map +1 -0
  143. package/dist/{chunk-WEPMT6SC.js → chunk-ZPTISBQU.js} +8 -8
  144. package/dist/{cli-feUe-x3I.d.ts → cli-D3-Q5Uod.d.ts} +3 -3
  145. package/dist/cli.d.ts +6 -5
  146. package/dist/cli.js +54 -54
  147. package/dist/compounding/engine.d.ts +1 -1
  148. package/dist/compounding/engine.js +6 -5
  149. package/dist/compounding/preference-consolidator.d.ts +1 -1
  150. package/dist/compounding/preference-consolidator.js +1 -1
  151. package/dist/compression-optimizer.d.ts +1 -1
  152. package/dist/config.d.ts +1 -1
  153. package/dist/config.js +3 -3
  154. package/dist/connectors/codex-materialize-runner.d.ts +1 -1
  155. package/dist/connectors/codex-materialize-runner.js +6 -5
  156. package/dist/connectors/codex-materialize.d.ts +1 -1
  157. package/dist/connectors/codex-materialize.js +2 -2
  158. package/dist/connectors/index.d.ts +1 -1
  159. package/dist/connectors/index.js +9 -9
  160. package/dist/consolidation-provenance-check.d.ts +1 -1
  161. package/dist/consolidation-undo.d.ts +1 -1
  162. package/dist/contradiction/index.d.ts +1 -1
  163. package/dist/contradiction/index.js +3 -3
  164. package/dist/{contradiction-scan-AZTGFMPY.js → contradiction-scan-HWGEOUDS.js} +3 -3
  165. package/dist/conversation-index/backend.d.ts +1 -1
  166. package/dist/conversation-index/backend.js +5 -5
  167. package/dist/conversation-index/chunker.d.ts +1 -1
  168. package/dist/conversation-index/cleanup.js +2 -2
  169. package/dist/conversation-index/faiss-adapter.d.ts +1 -1
  170. package/dist/conversation-index/faiss-adapter.js +2 -2
  171. package/dist/conversation-index/indexer.d.ts +1 -1
  172. package/dist/conversation-index/indexer.js +2 -2
  173. package/dist/conversation-index/search.d.ts +1 -1
  174. package/dist/conversation-index/search.js +2 -2
  175. package/dist/day-summary.d.ts +1 -1
  176. package/dist/day-summary.js +2 -2
  177. package/dist/delinearize.d.ts +1 -1
  178. package/dist/direct-answer-wiring.d.ts +1 -1
  179. package/dist/direct-answer.d.ts +1 -1
  180. package/dist/embedding-fallback.d.ts +1 -1
  181. package/dist/embedding-fallback.js +2 -2
  182. package/dist/enrichment/index.d.ts +1 -1
  183. package/dist/entity-retrieval.d.ts +1 -1
  184. package/dist/entity-retrieval.js +7 -5
  185. package/dist/entity-schema.d.ts +1 -1
  186. package/dist/explicit-capture.d.ts +4 -3
  187. package/dist/explicit-capture.js +1 -1
  188. package/dist/extraction-judge-telemetry.d.ts +1 -1
  189. package/dist/extraction-judge-telemetry.js +2 -2
  190. package/dist/extraction-judge-training.d.ts +1 -1
  191. package/dist/extraction-judge-training.js +2 -2
  192. package/dist/extraction-judge.d.ts +1 -1
  193. package/dist/extraction-judge.js +5 -5
  194. package/dist/extraction.d.ts +1 -1
  195. package/dist/extraction.js +9 -9
  196. package/dist/fallback-llm.d.ts +1 -1
  197. package/dist/fallback-llm.js +4 -4
  198. package/dist/{first-start-migration-FF7YFGRP.js → first-start-migration-PG5HBC3K.js} +4 -4
  199. package/dist/{graph-edge-decay-KSVJGCZW.js → graph-edge-decay-D7OESCBR.js} +2 -2
  200. package/dist/graph-snapshot.js +2 -2
  201. package/dist/graph.js +1 -1
  202. package/dist/identity-continuity.d.ts +1 -1
  203. package/dist/importance.d.ts +1 -1
  204. package/dist/index.d.ts +9 -8
  205. package/dist/index.js +112 -112
  206. package/dist/intent.d.ts +1 -1
  207. package/dist/lcm/archive.js +2 -2
  208. package/dist/lcm/engine.d.ts +1 -1
  209. package/dist/lcm/engine.js +5 -5
  210. package/dist/lcm/index.d.ts +1 -1
  211. package/dist/lcm/index.js +8 -8
  212. package/dist/lcm/schema.js +2 -2
  213. package/dist/lcm/summarizer.js +3 -3
  214. package/dist/lcm/tools.d.ts +1 -1
  215. package/dist/lifecycle.d.ts +1 -1
  216. package/dist/live-connectors-runner.d.ts +1 -1
  217. package/dist/local-llm.d.ts +1 -1
  218. package/dist/local-llm.js +2 -2
  219. package/dist/logger.js +1 -1
  220. package/dist/maintenance/memory-governance.d.ts +1 -1
  221. package/dist/maintenance/memory-governance.js +6 -4
  222. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +6 -4
  223. package/dist/maintenance/rebuild-memory-projection.js +8 -6
  224. package/dist/mcp-memory-inspector-app.d.ts +5 -4
  225. package/dist/memory-action-policy.d.ts +1 -1
  226. package/dist/memory-cache.d.ts +1 -1
  227. package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
  228. package/dist/memory-projection-store.d.ts +1 -1
  229. package/dist/memory-provenance.d.ts +1 -1
  230. package/dist/memory-worth-outcomes.d.ts +1 -1
  231. package/dist/model-registry.js +2 -2
  232. package/dist/models-json.d.ts +1 -1
  233. package/dist/models-json.js +2 -2
  234. package/dist/namespaces/migrate.d.ts +2 -1
  235. package/dist/namespaces/migrate.js +18 -17
  236. package/dist/namespaces/principal.d.ts +1 -1
  237. package/dist/namespaces/search.d.ts +1 -1
  238. package/dist/namespaces/search.js +13 -13
  239. package/dist/namespaces/storage.d.ts +43 -2
  240. package/dist/namespaces/storage.js +6 -4
  241. package/dist/native-knowledge.d.ts +1 -1
  242. package/dist/native-knowledge.js +2 -2
  243. package/dist/negative.js +2 -2
  244. package/dist/operator-toolkit.d.ts +1 -1
  245. package/dist/operator-toolkit.js +24 -24
  246. package/dist/{orchestrator-7zPqGupX.d.ts → orchestrator-CA6ouzBn.d.ts} +5 -466
  247. package/dist/orchestrator.d.ts +4 -3
  248. package/dist/orchestrator.js +68 -67
  249. package/dist/patterns-cli.d.ts +1 -1
  250. package/dist/policy-runtime.d.ts +1 -1
  251. package/dist/profiling.js +2 -2
  252. package/dist/provenance.d.ts +94 -0
  253. package/dist/provenance.js +17 -0
  254. package/dist/qmd-recall-cache.d.ts +1 -1
  255. package/dist/qmd.d.ts +1 -1
  256. package/dist/qmd.js +2 -2
  257. package/dist/recall-disclosure-escalation.d.ts +1 -1
  258. package/dist/recall-explain-renderer.d.ts +1 -1
  259. package/dist/recall-explain-renderer.js +3 -3
  260. package/dist/recall-planner-llm.d.ts +1 -1
  261. package/dist/recall-planner-llm.js +4 -4
  262. package/dist/recall-qos.js +2 -2
  263. package/dist/recall-state.d.ts +1 -1
  264. package/dist/recall-state.js +2 -2
  265. package/dist/recall-tag-filter.d.ts +1 -1
  266. package/dist/recall-xray-cli.d.ts +1 -1
  267. package/dist/recall-xray-cli.js +4 -4
  268. package/dist/recall-xray-renderer.d.ts +1 -1
  269. package/dist/recall-xray-renderer.js +3 -3
  270. package/dist/recall-xray.d.ts +1 -1
  271. package/dist/recall-xray.js +2 -2
  272. package/dist/relevance.js +2 -2
  273. package/dist/{resolution-IDTEBJFS.js → resolution-MN36NW5P.js} +3 -3
  274. package/dist/resolution-MN36NW5P.js.map +1 -0
  275. package/dist/resolve-auth-token.d.ts +1 -1
  276. package/dist/resolve-provider-secret.js +2 -2
  277. package/dist/resume-bundles.js +5 -5
  278. package/dist/retrieval-agents.d.ts +1 -1
  279. package/dist/retrieval-agents.js +2 -2
  280. package/dist/retrieval-tiers.d.ts +1 -1
  281. package/dist/routing/engine.d.ts +1 -1
  282. package/dist/routing/store.d.ts +1 -1
  283. package/dist/routing/store.js +2 -2
  284. package/dist/search/embed-helper.d.ts +1 -1
  285. package/dist/search/embed-helper.js +2 -2
  286. package/dist/search/factory.d.ts +1 -1
  287. package/dist/search/factory.js +12 -12
  288. package/dist/search/index.d.ts +1 -1
  289. package/dist/search/index.js +14 -14
  290. package/dist/search/lancedb-backend.d.ts +1 -1
  291. package/dist/search/lancedb-backend.js +2 -2
  292. package/dist/search/meilisearch-backend.d.ts +1 -1
  293. package/dist/search/meilisearch-backend.js +2 -2
  294. package/dist/search/noop-backend.d.ts +1 -1
  295. package/dist/search/orama-backend.d.ts +1 -1
  296. package/dist/search/orama-backend.js +2 -2
  297. package/dist/search/port.d.ts +1 -1
  298. package/dist/search/remote-backend.d.ts +1 -1
  299. package/dist/search/remote-backend.js +2 -2
  300. package/dist/{semantic-consolidation-BX9Z9_aK.d.ts → semantic-consolidation-CWch5uM7.d.ts} +1 -1
  301. package/dist/semantic-consolidation.d.ts +2 -2
  302. package/dist/semantic-consolidation.js +7 -6
  303. package/dist/semantic-rule-promotion.js +6 -4
  304. package/dist/semantic-rule-verifier.d.ts +1 -1
  305. package/dist/semantic-rule-verifier.js +6 -4
  306. package/dist/session-observer-bands.d.ts +1 -1
  307. package/dist/session-observer-state.d.ts +1 -1
  308. package/dist/session-observer-state.js +2 -2
  309. package/dist/session-transcript-migration.js +2 -2
  310. package/dist/shared-context/manager.d.ts +1 -1
  311. package/dist/shared-context/manager.js +2 -2
  312. package/dist/signal.d.ts +1 -1
  313. package/dist/storage.d.ts +5 -1
  314. package/dist/storage.js +5 -3
  315. package/dist/summarizer.d.ts +1 -1
  316. package/dist/summarizer.js +7 -7
  317. package/dist/summary-snapshot.d.ts +1 -1
  318. package/dist/temporal-supersession.d.ts +1 -1
  319. package/dist/temporal-supersession.js +2 -2
  320. package/dist/temporal-validity.d.ts +1 -1
  321. package/dist/threading.d.ts +1 -1
  322. package/dist/threading.js +2 -2
  323. package/dist/tier-migration.d.ts +1 -1
  324. package/dist/tier-routing.d.ts +1 -1
  325. package/dist/topics.d.ts +1 -1
  326. package/dist/transcript.d.ts +1 -1
  327. package/dist/transcript.js +2 -2
  328. package/dist/transfer/import-sqlite.js +2 -2
  329. package/dist/{types-D3pm4NhH.d.ts → types-Dm5xxVrr.d.ts} +61 -1
  330. package/dist/types.d.ts +1 -1
  331. package/dist/types.js +1 -1
  332. package/dist/utility-runtime.d.ts +1 -1
  333. package/dist/verified-recall.js +7 -5
  334. package/package.json +2 -2
  335. package/src/access-http.ts +1 -1
  336. package/src/access-mcp.ts +1 -1
  337. package/src/access-service.ts +1 -11
  338. package/src/cli.ts +1 -1
  339. package/src/config.test.ts +112 -0
  340. package/src/config.ts +5 -5
  341. package/src/explicit-capture.ts +3 -12
  342. package/src/logger.ts +13 -4
  343. package/src/namespaces/catalog.test.ts +2 -2
  344. package/src/namespaces/storage.ts +81 -0
  345. package/src/orchestrator.ts +22 -64
  346. package/src/provenance-frontmatter.test.ts +596 -0
  347. package/src/provenance.ts +305 -0
  348. package/src/storage.ts +41 -41
  349. package/src/types.ts +76 -0
  350. package/dist/chunk-2ODBA7MQ.js.map +0 -1
  351. package/dist/chunk-ARLRTZZZ.js.map +0 -1
  352. package/dist/chunk-FMSDA2D3.js.map +0 -1
  353. package/dist/chunk-GKKAXVAJ.js.map +0 -1
  354. package/dist/chunk-I3HSKQT7.js.map +0 -1
  355. package/dist/chunk-IUZWBCJX.js.map +0 -1
  356. package/dist/chunk-PHK3HARR.js +0 -32
  357. package/dist/chunk-PHK3HARR.js.map +0 -1
  358. package/dist/chunk-QVWM4C24.js.map +0 -1
  359. package/dist/chunk-TY5NT3T3.js.map +0 -1
  360. /package/dist/{auto-sync-5CJBJMPZ.js.map → auto-sync-NUQWSFQD.js.map} +0 -0
  361. /package/dist/{chunk-UJDV2NLT.js.map → chunk-2KAYTPPT.js.map} +0 -0
  362. /package/dist/{chunk-QUA2JPH2.js.map → chunk-2SJCWLQD.js.map} +0 -0
  363. /package/dist/{chunk-YTWNKQ2G.js.map → chunk-3FC6LW6T.js.map} +0 -0
  364. /package/dist/{chunk-I75DF4FZ.js.map → chunk-4FE2K57M.js.map} +0 -0
  365. /package/dist/{chunk-L5MUA6Q7.js.map → chunk-4N3TFFPH.js.map} +0 -0
  366. /package/dist/{chunk-BTVX7ZXZ.js.map → chunk-4NFVPDIL.js.map} +0 -0
  367. /package/dist/{chunk-OUWAQVDJ.js.map → chunk-5CEJH5ZN.js.map} +0 -0
  368. /package/dist/{chunk-UAODC6GJ.js.map → chunk-6O6A6YUO.js.map} +0 -0
  369. /package/dist/{chunk-HQ6NIBL6.js.map → chunk-7FL4CNPV.js.map} +0 -0
  370. /package/dist/{chunk-5VDJMYTF.js.map → chunk-7WWURLG6.js.map} +0 -0
  371. /package/dist/{chunk-QWRC7GIO.js.map → chunk-A4HH2EWA.js.map} +0 -0
  372. /package/dist/{chunk-4SKKVWLQ.js.map → chunk-AGJH5ISO.js.map} +0 -0
  373. /package/dist/{chunk-APJQ6UEA.js.map → chunk-AGNBY3VG.js.map} +0 -0
  374. /package/dist/{chunk-NQMBSSWW.js.map → chunk-B4XVLHJA.js.map} +0 -0
  375. /package/dist/{chunk-GSTYVG5L.js.map → chunk-BFVPIKDY.js.map} +0 -0
  376. /package/dist/{chunk-AJU4PJGY.js.map → chunk-BVKCV2ZY.js.map} +0 -0
  377. /package/dist/{chunk-EG4TCVMU.js.map → chunk-CTOQEZSN.js.map} +0 -0
  378. /package/dist/{chunk-7OGJQP7T.js.map → chunk-DCWIQFNA.js.map} +0 -0
  379. /package/dist/{chunk-MHQC2WU2.js.map → chunk-DKTSR7EK.js.map} +0 -0
  380. /package/dist/{chunk-RN7MUWON.js.map → chunk-EHISUJFN.js.map} +0 -0
  381. /package/dist/{chunk-WLEB7WCG.js.map → chunk-EO5QWINU.js.map} +0 -0
  382. /package/dist/{chunk-XKXKSQU7.js.map → chunk-EXM3CQTZ.js.map} +0 -0
  383. /package/dist/{chunk-TOQEZ63C.js.map → chunk-FE6DQUNJ.js.map} +0 -0
  384. /package/dist/{chunk-LCC5EZTT.js.map → chunk-FIVDN2SM.js.map} +0 -0
  385. /package/dist/{chunk-452WDNFO.js.map → chunk-GG6AJN7A.js.map} +0 -0
  386. /package/dist/{chunk-O2WELT5C.js.map → chunk-GS55WYRL.js.map} +0 -0
  387. /package/dist/{chunk-OHX52AOS.js.map → chunk-GTDH3IUH.js.map} +0 -0
  388. /package/dist/{chunk-IBTZEBUD.js.map → chunk-HYNHLBKA.js.map} +0 -0
  389. /package/dist/{chunk-V254FAT5.js.map → chunk-IIDSFFE5.js.map} +0 -0
  390. /package/dist/{chunk-EVWIEEKZ.js.map → chunk-IQ7WCZRW.js.map} +0 -0
  391. /package/dist/{chunk-B5XMS73R.js.map → chunk-IQVQJJL7.js.map} +0 -0
  392. /package/dist/{chunk-6RHNCKHG.js.map → chunk-K43PI6DQ.js.map} +0 -0
  393. /package/dist/{chunk-OIF36KGD.js.map → chunk-KCQA46NR.js.map} +0 -0
  394. /package/dist/{chunk-2LDBXPLB.js.map → chunk-KF74X62T.js.map} +0 -0
  395. /package/dist/{chunk-MAV46GWQ.js.map → chunk-KYYL4U6X.js.map} +0 -0
  396. /package/dist/{chunk-6GC5SGFE.js.map → chunk-L24JROPR.js.map} +0 -0
  397. /package/dist/{chunk-6VP3YUCS.js.map → chunk-LLONI6PY.js.map} +0 -0
  398. /package/dist/{chunk-Q5ZU3RNY.js.map → chunk-LQ6JI4VH.js.map} +0 -0
  399. /package/dist/{chunk-ODWI5XU2.js.map → chunk-MCQDSY4G.js.map} +0 -0
  400. /package/dist/{chunk-HP5FMB6L.js.map → chunk-MDJURR27.js.map} +0 -0
  401. /package/dist/{chunk-T2PO5MUF.js.map → chunk-O7GOFAM3.js.map} +0 -0
  402. /package/dist/{chunk-Z2OXSMZK.js.map → chunk-OBXTMFZQ.js.map} +0 -0
  403. /package/dist/{chunk-KV6CX4ON.js.map → chunk-OV4D5T7V.js.map} +0 -0
  404. /package/dist/{chunk-KACIOX42.js.map → chunk-PH3HOKYW.js.map} +0 -0
  405. /package/dist/{chunk-NHFXF4ZO.js.map → chunk-PK6RGRSD.js.map} +0 -0
  406. /package/dist/{chunk-C3IW2F5Z.js.map → chunk-PLBIPT6I.js.map} +0 -0
  407. /package/dist/{chunk-QY7YA7OL.js.map → chunk-PNLCEFE4.js.map} +0 -0
  408. /package/dist/{chunk-AGRPGAKR.js.map → chunk-PONNZ54D.js.map} +0 -0
  409. /package/dist/{chunk-XZ4WBBB5.js.map → chunk-PWFWCGOO.js.map} +0 -0
  410. /package/dist/{chunk-G7Z3C2X6.js.map → chunk-QANVLERJ.js.map} +0 -0
  411. /package/dist/{chunk-W4RVMTHR.js.map → chunk-QRDOSYOR.js.map} +0 -0
  412. /package/dist/{chunk-6IMKOIZ6.js.map → chunk-R6OVFAX6.js.map} +0 -0
  413. /package/dist/{chunk-2QSZNTDO.js.map → chunk-RKNJBZ55.js.map} +0 -0
  414. /package/dist/{chunk-JOASJWQR.js.map → chunk-SANZHXY2.js.map} +0 -0
  415. /package/dist/{chunk-7DTASS5T.js.map → chunk-SJHM6I4J.js.map} +0 -0
  416. /package/dist/{chunk-B2B2IHUH.js.map → chunk-STOEE37X.js.map} +0 -0
  417. /package/dist/{chunk-GNAMDNGT.js.map → chunk-U7D7NP4J.js.map} +0 -0
  418. /package/dist/{chunk-DRD2Q7HQ.js.map → chunk-UFS7OXGL.js.map} +0 -0
  419. /package/dist/{chunk-H3HDXD3U.js.map → chunk-UPTZYUYJ.js.map} +0 -0
  420. /package/dist/{chunk-3IND7N4X.js.map → chunk-UTYBJR7M.js.map} +0 -0
  421. /package/dist/{chunk-LN4YGHTM.js.map → chunk-UUH4YQOF.js.map} +0 -0
  422. /package/dist/{chunk-6VF75M3X.js.map → chunk-VGUOEDTU.js.map} +0 -0
  423. /package/dist/{chunk-44VFF3BB.js.map → chunk-VILEUJXC.js.map} +0 -0
  424. /package/dist/{chunk-7SI52C65.js.map → chunk-VL7DP3OW.js.map} +0 -0
  425. /package/dist/{chunk-7DHTMOND.js.map → chunk-VQ34TERH.js.map} +0 -0
  426. /package/dist/{chunk-H6PMGMNP.js.map → chunk-VX6OBUDW.js.map} +0 -0
  427. /package/dist/{chunk-EW5KFXHL.js.map → chunk-WDXCNJSF.js.map} +0 -0
  428. /package/dist/{chunk-X6IRLNOO.js.map → chunk-WIWPSQYU.js.map} +0 -0
  429. /package/dist/{chunk-DOCTITOP.js.map → chunk-WRFKZEO6.js.map} +0 -0
  430. /package/dist/{chunk-E6ZDCOHM.js.map → chunk-XBZQRZ6G.js.map} +0 -0
  431. /package/dist/{chunk-7YX23JBA.js.map → chunk-XHYGJVXL.js.map} +0 -0
  432. /package/dist/{chunk-JD4SCARD.js.map → chunk-YN4ZT4CW.js.map} +0 -0
  433. /package/dist/{chunk-YXWAILM4.js.map → chunk-YOI3ELXF.js.map} +0 -0
  434. /package/dist/{chunk-XCAZF7KQ.js.map → chunk-ZA2S2VLL.js.map} +0 -0
  435. /package/dist/{chunk-BEUDU7Y4.js.map → chunk-ZCWIH4LH.js.map} +0 -0
  436. /package/dist/{chunk-WEPMT6SC.js.map → chunk-ZPTISBQU.js.map} +0 -0
  437. /package/dist/{contradiction-scan-AZTGFMPY.js.map → contradiction-scan-HWGEOUDS.js.map} +0 -0
  438. /package/dist/{first-start-migration-FF7YFGRP.js.map → first-start-migration-PG5HBC3K.js.map} +0 -0
  439. /package/dist/{graph-edge-decay-KSVJGCZW.js.map → graph-edge-decay-D7OESCBR.js.map} +0 -0
  440. /package/dist/{resolution-IDTEBJFS.js.map → provenance.js.map} +0 -0
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  SharedFeedbackEntrySchema,
3
3
  resolveSharedContextDir
4
- } from "./chunk-DRD2Q7HQ.js";
4
+ } from "./chunk-UFS7OXGL.js";
5
5
  import {
6
6
  StorageManager
7
- } from "./chunk-TY5NT3T3.js";
7
+ } from "./chunk-BLIWOONZ.js";
8
8
  import {
9
9
  parseContinuityImprovementLoops
10
10
  } from "./chunk-LDXUBPMO.js";
@@ -13,7 +13,7 @@ import {
13
13
  } from "./chunk-FVQJYWH7.js";
14
14
  import {
15
15
  log
16
- } from "./chunk-2ODBA7MQ.js";
16
+ } from "./chunk-NU3CSQ4H.js";
17
17
 
18
18
  // src/compounding/engine.ts
19
19
  import { createHash } from "crypto";
@@ -1261,4 +1261,4 @@ export {
1261
1261
  defaultTierMigrationCycleBudget,
1262
1262
  CompoundingEngine
1263
1263
  };
1264
- //# sourceMappingURL=chunk-B2B2IHUH.js.map
1264
+ //# sourceMappingURL=chunk-STOEE37X.js.map
@@ -321,9 +321,6 @@ async function persistExplicitCapture(orchestrator, candidate, source) {
321
321
  expiresAt: candidate.expiresAt,
322
322
  source: source === "inline" ? "explicit-inline" : "explicit"
323
323
  });
324
- if (typeof orchestrator.recordCatalogWrite === "function") {
325
- orchestrator.recordCatalogWrite(resolvedNamespace, storage.dir);
326
- }
327
324
  const created = (/* @__PURE__ */ new Date()).toISOString();
328
325
  const event = {
329
326
  eventId: `mle-${randomUUID()}`,
@@ -411,9 +408,6 @@ async function queueExplicitCaptureForReview(orchestrator, input, source, error)
411
408
  });
412
409
  }
413
410
  } finally {
414
- if (typeof orchestrator.recordCatalogWrite === "function") {
415
- orchestrator.recordCatalogWrite(queueNamespace, storage.dir);
416
- }
417
411
  }
418
412
  const event = {
419
413
  eventId: `mle-${randomUUID()}`,
@@ -444,4 +438,4 @@ export {
444
438
  shouldSkipImplicitExtraction,
445
439
  shouldProcessInlineExplicitCapture
446
440
  };
447
- //# sourceMappingURL=chunk-GKKAXVAJ.js.map
441
+ //# sourceMappingURL=chunk-U33LWTQQ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/explicit-capture.ts"],"sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport type { Orchestrator } from \"./orchestrator.js\";\nimport { isSafeRouteNamespace } from \"./routing/engine.js\";\nimport { sanitizeMemoryContent } from \"./sanitize.js\";\nimport { ContentHashIndex } from \"./storage.js\";\nimport type { CaptureMode, MemoryCategory, MemoryLifecycleEvent, PluginConfig } from \"./types.js\";\n\nexport type ExplicitCaptureInput = {\n content: string;\n category?: string;\n confidence?: number;\n namespace?: string;\n tags?: string[];\n entityRef?: string;\n ttl?: string;\n sourceReason?: string;\n};\n\nexport type ValidExplicitCapture = {\n content: string;\n category: MemoryCategory;\n confidence: number;\n namespace?: string;\n tags: string[];\n entityRef?: string;\n expiresAt?: string;\n sourceReason?: string;\n /**\n * When true, `namespace` was already resolved AND authorized by the caller\n * (the access service's `resolveCodingScopedWriteNamespace`, which auth-checks\n * the base and derives a session-owned `project-*` overlay). The persist /\n * queue layer then routes to it directly instead of re-validating against the\n * static policy allow-list — which would otherwise reject legitimately-derived\n * dynamic project namespaces (#1434). Callers that do NOT pre-authorize the\n * namespace must leave this unset so the allow-list guard still applies.\n */\n namespacePreResolved?: boolean;\n};\n\nexport type ExplicitCaptureSource = \"memory_store\" | \"memory_capture\" | \"suggestion_submit\" | \"inline\";\ntype ExplicitCaptureValidationMode = \"legacy_tool\" | \"strict_explicit\";\n\n// Bounded body {0,100000} instead of an unbounded lazy *? so scanning for the\n// closing tag cannot backtrack polynomially on unterminated <memory_note>\n// markup in hostile turn text (CodeQL js/polynomial-redos). 100 000 chars far\n// exceeds any real inline note, so matching is behavior-preserving; the outer\n// \\s* groups were also dropped (body absorbs whitespace; captures are trimmed).\nconst INLINE_NOTE_RE = /<memory_note>([\\s\\S]{0,100000}?)<\\/memory_note>/gi;\nconst INLINE_NOTE_MARKUP_RE = /<memory_note>[\\s\\S]{0,100000}?<\\/memory_note>/i;\nconst INLINE_ALLOWED_CATEGORIES = new Set<MemoryCategory>([\n \"fact\",\n \"preference\",\n \"correction\",\n \"entity\",\n \"decision\",\n \"relationship\",\n \"principle\",\n \"commitment\",\n \"moment\",\n \"skill\",\n \"rule\",\n \"procedure\",\n \"reasoning_trace\",\n]);\n\nconst SECRET_PATTERNS: RegExp[] = [\n /\\bsk-[A-Za-z0-9]{16,}\\b/,\n /\\bAKIA[0-9A-Z]{16}\\b/,\n /\\bBearer\\s+[A-Za-z0-9._-]{16,}\\b/i,\n /\\b(?:api[_-]?key|secret|token|password|passwd)\\s*[:=]\\s*[^\\s]{8,}\\b/i,\n /\\b(?:authorization)\\s*:\\s*[^\\s]{8,}\\b/i,\n];\nconst SECRET_REDACTION_PATTERNS: Array<{ pattern: RegExp; replacement: string }> = [\n { pattern: /\\bsk-[A-Za-z0-9]{16,}\\b/g, replacement: \"[redacted openai key]\" },\n { pattern: /\\bAKIA[0-9A-Z]{16}\\b/g, replacement: \"[redacted aws key]\" },\n { pattern: /\\bBearer\\s+[A-Za-z0-9._-]{16,}\\b/gi, replacement: \"Bearer [redacted token]\" },\n {\n pattern: /\\b(?:api[_-]?key|secret|token|password|passwd)\\s*[:=]\\s*[^\\s]{8,}\\b/gi,\n replacement: \"[redacted credential]\",\n },\n {\n pattern: /\\b(?:authorization)\\s*:\\s*[^\\s]{8,}\\b/gi,\n replacement: \"authorization: [redacted credential]\",\n },\n];\nconst EXPLICIT_CAPTURE_REVIEW_TAGS = [\"explicit-capture\", \"queued-review\"];\n\nfunction explicitCaptureActor(source: ExplicitCaptureSource): string {\n switch (source) {\n case \"inline\":\n return \"inline.memory_note\";\n case \"memory_store\":\n return \"tool.memory_store\";\n case \"suggestion_submit\":\n return \"tool.suggestion_submit\";\n default:\n return \"tool.memory_capture\";\n }\n}\n\nfunction asTrimmed(value: string | undefined): string | undefined {\n const trimmed = value?.trim();\n return trimmed && trimmed.length > 0 ? trimmed : undefined;\n}\n\nfunction normalizeCaptureContent(value: string): string {\n return value\n .toLowerCase()\n .replace(/\\s+/g, \" \")\n .trim();\n}\n\nfunction redactSecrets(value: string): string {\n let redacted = value;\n for (const { pattern, replacement } of SECRET_REDACTION_PATTERNS) {\n redacted = redacted.replace(pattern, replacement);\n }\n return redacted;\n}\n\nfunction containsSecretLikeValue(value: string): boolean {\n return SECRET_PATTERNS.some((pattern) => pattern.test(value));\n}\n\nfunction assertNoSecretLikeMetadata(field: string, value: string | undefined): void {\n const trimmed = asTrimmed(value);\n if (trimmed && containsSecretLikeValue(trimmed)) {\n throw new Error(`${field} appears to contain a secret or credential`);\n }\n}\n\nfunction assertNoSecretLikeMetadataList(field: string, values: string[] | undefined): void {\n for (const value of values ?? []) {\n assertNoSecretLikeMetadata(field, value);\n }\n}\n\nfunction sanitizeReviewText(value: string | undefined, fallback: string): string {\n const redacted = redactSecrets(asTrimmed(value) ?? fallback);\n const sanitized = sanitizeMemoryContent(redacted);\n const safe = sanitized.text.trim();\n return safe.length > 0 ? safe : fallback;\n}\n\nfunction sanitizeReviewMetadata(value: string | undefined): string | undefined {\n const trimmed = asTrimmed(value);\n if (!trimmed) return undefined;\n return sanitizeReviewText(trimmed, \"[redacted]\");\n}\n\nfunction sanitizeReviewTags(tags: string[] | undefined): string[] {\n return Array.from(new Set((tags ?? [])\n .map((tag) => sanitizeReviewMetadata(tag))\n .filter((tag): tag is string => typeof tag === \"string\" && tag.length > 0)));\n}\n\nfunction normalizeExplicitCaptureError(error: unknown): string {\n if (error instanceof Error && error.message.trim().length > 0) return error.message.trim();\n const rendered = String(error).trim();\n return rendered.length > 0 ? rendered : \"explicit capture failed\";\n}\n\nfunction resolveExplicitCaptureReviewNamespace(\n orchestrator: Orchestrator,\n namespace: string | undefined,\n): string | undefined {\n const normalized = asTrimmed(namespace);\n if (!normalized) return undefined;\n return resolveExplicitCaptureNamespace(orchestrator, normalized);\n}\n\nfunction resolveExplicitCaptureNamespace(\n orchestrator: Orchestrator,\n namespace: string | undefined,\n): string | undefined {\n const normalized = asTrimmed(namespace);\n if (!normalized) return undefined;\n if (!orchestrator.config.namespacesEnabled) {\n if (normalized !== orchestrator.config.defaultNamespace) {\n throw new Error(`unsupported namespace: ${normalized}`);\n }\n return normalized;\n }\n const allowed = new Set([\n orchestrator.config.defaultNamespace,\n orchestrator.config.sharedNamespace,\n ...orchestrator.config.namespacePolicies.map((policy) => policy.name),\n ].map((value) => value.trim()).filter(Boolean));\n if (!allowed.has(normalized)) {\n throw new Error(`unsupported namespace: ${normalized}`);\n }\n return normalized;\n}\n\nfunction parseExplicitCaptureTtl(ttl: string | undefined): string | undefined {\n const raw = asTrimmed(ttl);\n if (!raw) return undefined;\n\n const absoluteMs = Date.parse(raw);\n if (Number.isFinite(absoluteMs)) {\n return new Date(absoluteMs).toISOString();\n }\n\n const relative = raw.match(/^(\\d+)\\s*([mhdw])$/i);\n if (!relative) {\n throw new Error(\"ttl must be an ISO-8601 timestamp or relative duration like 30m, 12h, 7d, or 2w\");\n }\n\n const amount = Number.parseInt(relative[1] ?? \"\", 10);\n const unit = (relative[2] ?? \"\").toLowerCase();\n if (!Number.isFinite(amount) || amount <= 0) {\n throw new Error(\"ttl duration must be a positive integer\");\n }\n\n const multiplier =\n unit === \"m\" ? 60_000\n : unit === \"h\" ? 60 * 60_000\n : unit === \"d\" ? 24 * 60 * 60_000\n : 7 * 24 * 60 * 60_000;\n return new Date(Date.now() + amount * multiplier).toISOString();\n}\n\nfunction parseInlineConfidence(value: string): number {\n const trimmed = value.trim();\n if (!/^[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?$/i.test(trimmed)) {\n return Number.NaN;\n }\n const parsed = Number(trimmed);\n return Number.isFinite(parsed) ? parsed : Number.NaN;\n}\n\nfunction parseInlineNote(block: string): ExplicitCaptureInput | null {\n const lines = block.replace(/\\r/g, \"\").split(\"\\n\");\n const note: Partial<ExplicitCaptureInput> = {};\n let idx = 0;\n\n while (idx < lines.length) {\n const rawLine = lines[idx] ?? \"\";\n const line = rawLine.trim();\n idx += 1;\n if (line.length === 0) continue;\n const colonIdx = line.indexOf(\":\");\n if (colonIdx < 0) continue;\n const key = line.slice(0, colonIdx).trim();\n const value = line.slice(colonIdx + 1).trim();\n\n if (key === \"content\" && value === \"|\") {\n const contentLines: string[] = [];\n while (idx < lines.length) {\n const next = lines[idx] ?? \"\";\n if (next.startsWith(\" \") || next.startsWith(\"\\t\")) {\n contentLines.push(next.replace(/^( |\\t)/, \"\"));\n idx += 1;\n continue;\n }\n if (next.trim().length === 0) {\n contentLines.push(\"\");\n idx += 1;\n continue;\n }\n break;\n }\n note.content = contentLines.join(\"\\n\").trim();\n continue;\n }\n\n switch (key) {\n case \"content\":\n note.content = value;\n break;\n case \"category\":\n note.category = value;\n break;\n case \"confidence\":\n note.confidence = parseInlineConfidence(value);\n break;\n case \"namespace\":\n note.namespace = value;\n break;\n case \"tags\":\n note.tags = value\n .split(\",\")\n .map((entry) => entry.trim())\n .filter(Boolean);\n break;\n case \"entityRef\":\n note.entityRef = value;\n break;\n case \"ttl\":\n note.ttl = value;\n break;\n case \"sourceReason\":\n note.sourceReason = value;\n break;\n default:\n break;\n }\n }\n\n return asTrimmed(note.content) ? (note as ExplicitCaptureInput) : null;\n}\n\nexport function parseInlineExplicitCaptureNotes(text: string): ExplicitCaptureInput[] {\n const notes: ExplicitCaptureInput[] = [];\n for (const match of text.matchAll(INLINE_NOTE_RE)) {\n const parsed = parseInlineNote(match[1] ?? \"\");\n if (parsed) notes.push(parsed);\n }\n return notes;\n}\n\nexport function hasInlineExplicitCaptureMarkup(text: string): boolean {\n return INLINE_NOTE_MARKUP_RE.test(text);\n}\n\nexport function stripInlineExplicitCaptureNotes(text: string): string {\n return text.replace(INLINE_NOTE_RE, \"\").trim();\n}\n\nexport function validateExplicitCaptureInput(\n input: ExplicitCaptureInput,\n mode: ExplicitCaptureValidationMode = \"strict_explicit\",\n): ValidExplicitCapture {\n const content = asTrimmed(input.content);\n if (!content) throw new Error(\"content is required\");\n if (mode === \"strict_explicit\") {\n if (content.length < 10) throw new Error(\"content must be at least 10 characters\");\n if (content.length > 4000) throw new Error(\"content must be 4000 characters or fewer\");\n }\n if (/<memory_note>/i.test(content) || /<\\/memory_note>/i.test(content)) {\n throw new Error(\"nested memory_note blocks are not allowed\");\n }\n\n const category = (asTrimmed(input.category) ?? \"fact\") as MemoryCategory;\n if (!INLINE_ALLOWED_CATEGORIES.has(category)) {\n throw new Error(`unsupported category: ${input.category ?? category}`);\n }\n\n const sanitized = sanitizeMemoryContent(content);\n if (!sanitized.clean) {\n throw new Error(\"content failed memory sanitization\");\n }\n for (const pattern of SECRET_PATTERNS) {\n if (pattern.test(content)) {\n throw new Error(\"content appears to contain a secret or credential\");\n }\n }\n assertNoSecretLikeMetadata(\"sourceReason\", input.sourceReason);\n assertNoSecretLikeMetadata(\"entityRef\", input.entityRef);\n assertNoSecretLikeMetadata(\"ttl\", input.ttl);\n assertNoSecretLikeMetadataList(\"tags\", input.tags);\n\n if (input.confidence !== undefined && !Number.isFinite(input.confidence)) {\n throw new Error(\"confidence must be a finite number\");\n }\n const confidence = input.confidence === undefined ? 0.95 : Number(input.confidence);\n if (confidence < 0 || confidence > 1) {\n throw new Error(\"confidence must be between 0 and 1\");\n }\n const requestedNamespace = asTrimmed(input.namespace);\n if (requestedNamespace && !isSafeRouteNamespace(requestedNamespace)) {\n throw new Error(`unsafe namespace: ${requestedNamespace}`);\n }\n const expiresAt = parseExplicitCaptureTtl(input.ttl);\n\n return {\n content,\n category,\n confidence,\n namespace: asTrimmed(input.namespace),\n tags: Array.from(new Set((input.tags ?? []).map((tag) => tag.trim()).filter(Boolean))),\n entityRef: asTrimmed(input.entityRef),\n expiresAt,\n sourceReason: asTrimmed(input.sourceReason),\n };\n}\n\nasync function findDuplicateExplicitCapture(\n orchestrator: Orchestrator,\n resolvedNamespace: string | undefined,\n candidate: ValidExplicitCapture,\n): Promise<string | null> {\n const storage = await orchestrator.getStorage(resolvedNamespace);\n if (\n candidate.category === \"fact\"\n && typeof (storage as { hasFactContentHash?: (content: string) => Promise<boolean> }).hasFactContentHash === \"function\"\n ) {\n try {\n const hasHash = await (storage as { hasFactContentHash: (content: string) => Promise<boolean> }).hasFactContentHash(\n candidate.content,\n );\n if (!hasHash) {\n const authoritative =\n typeof (storage as { isFactContentHashAuthoritative?: () => Promise<boolean> | boolean }).isFactContentHashAuthoritative\n === \"function\"\n ? await (storage as { isFactContentHashAuthoritative: () => Promise<boolean> | boolean })\n .isFactContentHashAuthoritative()\n : false;\n if (authoritative) return null;\n }\n } catch (err) {\n // Fail open: hash index is only an optimization, so fall back to the full corpus scan.\n void err;\n }\n }\n const existing = await storage.readAllMemories();\n const normalizedCandidate = normalizeCaptureContent(candidate.content);\n const match = existing.find((memory) => {\n const status = memory.frontmatter.status ?? \"active\";\n if (status !== \"active\") return false;\n if (memory.frontmatter.category !== candidate.category) return false;\n return normalizeCaptureContent(memory.content) === normalizedCandidate;\n });\n return match?.frontmatter.id ?? null;\n}\n\nexport async function persistExplicitCapture(\n orchestrator: Orchestrator,\n candidate: ValidExplicitCapture,\n source: ExplicitCaptureSource,\n): Promise<{ id: string; duplicateOf?: string }> {\n const resolvedNamespace = candidate.namespacePreResolved\n ? asTrimmed(candidate.namespace)\n : resolveExplicitCaptureNamespace(orchestrator, candidate.namespace);\n const duplicateOf = await findDuplicateExplicitCapture(orchestrator, resolvedNamespace, candidate);\n if (duplicateOf) {\n return { id: duplicateOf, duplicateOf };\n }\n\n const storage = await orchestrator.getStorage(resolvedNamespace);\n const id = await storage.writeMemory(candidate.category, candidate.content, {\n confidence: candidate.confidence,\n tags: candidate.tags,\n entityRef: candidate.entityRef,\n expiresAt: candidate.expiresAt,\n source: source === \"inline\" ? \"explicit-inline\" : \"explicit\",\n });\n // #1522: catalog touch handled at the storage chokepoint — the StorageManager's\n // post-write hook records the namespace touch automatically.\n\n const created = new Date().toISOString();\n const event: MemoryLifecycleEvent = {\n eventId: `mle-${randomUUID()}`,\n memoryId: id,\n eventType: \"explicit_capture_accepted\",\n timestamp: created,\n actor: explicitCaptureActor(source),\n reasonCode: candidate.sourceReason,\n ruleVersion: \"explicit-capture.v1\",\n };\n await storage.appendMemoryLifecycleEvents([event]);\n\n return { id };\n}\n\nfunction buildExplicitCaptureReviewContent(input: ExplicitCaptureInput, reason: string): string {\n const requestedContent = asTrimmed(input.content);\n const safeContent = sanitizeReviewText(requestedContent, \"[empty explicit capture]\");\n const safeCategory = sanitizeReviewMetadata(input.category);\n const safeNamespace = sanitizeReviewMetadata(input.namespace);\n const safeEntityRef = sanitizeReviewMetadata(input.entityRef);\n const safeTtl = sanitizeReviewMetadata(input.ttl);\n const safeSourceReason = sanitizeReviewMetadata(input.sourceReason);\n const safeTags = sanitizeReviewTags(input.tags);\n const lines = [\n \"Explicit capture queued for review.\",\n \"\",\n `Reason: ${reason}`,\n \"\",\n \"Submitted content:\",\n safeContent,\n ];\n const metadata = [\n safeCategory ? `Requested category: ${safeCategory}` : undefined,\n safeNamespace ? `Requested namespace: ${safeNamespace}` : undefined,\n safeEntityRef ? `Requested entityRef: ${safeEntityRef}` : undefined,\n safeTtl ? `Requested ttl: ${safeTtl}` : undefined,\n safeSourceReason ? `Requested sourceReason: ${safeSourceReason}` : undefined,\n safeTags.length > 0 ? `Requested tags: ${safeTags.join(\", \")}` : undefined,\n ].filter((entry): entry is string => typeof entry === \"string\" && entry.length > 0);\n if (metadata.length > 0) {\n lines.push(\"\", ...metadata);\n }\n return lines.join(\"\\n\");\n}\n\nasync function findQueuedExplicitCaptureDuplicate(\n orchestrator: Orchestrator,\n namespace: string | undefined,\n content: string,\n): Promise<string | null> {\n const storage = await orchestrator.getStorage(namespace);\n const existing = await storage.readAllMemories();\n const normalized = normalizeCaptureContent(content);\n const match = existing.find((memory) => {\n const status = memory.frontmatter.status ?? \"active\";\n if (status !== \"pending_review\") return false;\n if (!(memory.frontmatter.tags ?? []).includes(\"queued-review\")) return false;\n return normalizeCaptureContent(memory.content) === normalized;\n });\n return match?.frontmatter.id ?? null;\n}\n\nexport async function queueExplicitCaptureForReview(\n orchestrator: Orchestrator,\n input: ExplicitCaptureInput,\n source: ExplicitCaptureSource,\n error: unknown,\n): Promise<{ id: string; duplicateOf?: string }> {\n const reason = sanitizeReviewText(normalizeExplicitCaptureError(error), \"explicit capture failed\");\n const requestedNamespace = asTrimmed(input.namespace);\n // A caller-pre-authorized namespace (e.g. a session-owned project overlay\n // from the access service) routes directly; otherwise apply the static\n // policy allow-list guard (#1434).\n const queueNamespace = (input as { namespacePreResolved?: boolean }).namespacePreResolved\n ? requestedNamespace\n : resolveExplicitCaptureReviewNamespace(orchestrator, requestedNamespace);\n const content = buildExplicitCaptureReviewContent(input, reason);\n const duplicateOf = await findQueuedExplicitCaptureDuplicate(orchestrator, queueNamespace, content);\n if (duplicateOf) {\n return { id: duplicateOf, duplicateOf };\n }\n\n const requestedCategory = asTrimmed(input.category);\n const reviewCategory = requestedCategory && INLINE_ALLOWED_CATEGORIES.has(requestedCategory as MemoryCategory)\n ? requestedCategory as MemoryCategory\n : \"fact\";\n const requestedTags = sanitizeReviewTags(input.tags);\n const storage = await orchestrator.getStorage(queueNamespace);\n const id = await storage.writeMemory(reviewCategory, content, {\n confidence: 0.2,\n tags: Array.from(new Set([...EXPLICIT_CAPTURE_REVIEW_TAGS, ...requestedTags])),\n entityRef: sanitizeReviewMetadata(input.entityRef),\n source: source === \"inline\" ? \"explicit-inline-review\" : \"explicit-review\",\n });\n try {\n const created = await storage.getMemoryById(id);\n if (created) {\n await storage.writeMemoryFrontmatter(created, {\n status: \"pending_review\",\n updated: new Date().toISOString(),\n }, {\n actor: explicitCaptureActor(source),\n reasonCode: reason,\n ruleVersion: \"explicit-capture.v1\",\n });\n }\n } finally {\n // Record the catalog write touch (issue #1499, round 5/6 codex P2; NIhUg).\n // A queued review capture writes memory to the namespace's root (the DEFAULT\n // root when undefined), so its `lastWriteAt` must reflect the write once\n // `writeMemory` returns an id. If the later pending-review frontmatter update\n // fails, the memory file is still durable and must not disappear from\n // writtenSince/maintenance scheduling. Guarded optional hook (rule #33).\n // #1522: catalog touch handled at the storage chokepoint.\n }\n const event: MemoryLifecycleEvent = {\n eventId: `mle-${randomUUID()}`,\n memoryId: id,\n eventType: \"explicit_capture_queued\",\n timestamp: new Date().toISOString(),\n actor: explicitCaptureActor(source),\n reasonCode: reason,\n ruleVersion: \"explicit-capture.v1\",\n };\n await storage.appendMemoryLifecycleEvents([event]);\n return { id };\n}\n\nexport function shouldSkipImplicitExtraction(cfg: Pick<PluginConfig, \"captureMode\">): boolean {\n return cfg.captureMode === \"explicit\";\n}\n\nexport function shouldProcessInlineExplicitCapture(cfg: Pick<PluginConfig, \"captureMode\">): boolean {\n return cfg.captureMode !== \"implicit\";\n}\n"],"mappings":";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A2B;AAAA,EAC3D,CAAC;AACD,MAAI;AACF,UAAM,UAAU,MAAM,QAAQ,cAAc,EAAE;AAC9C,QAAI,SAAS;AACX,YAAM,QAAQ,uBAAuB,SAAS;AAAA,QAC5C,QAAQ;AAAA,QACR,UAAS,oBAAI,KAAK,GAAE,YAAY;AAAA,MAClC,GAAG;AAAA,QACD,OAAO,qBAAqB,MAAM;AAAA,QAClC,YAAY;AAAA,QACZ,aAAa;AAAA,MACf,CAAC;AAAA,IACH;AAAA,EACF,UAAE;AAAA,EAQF;AACA,QAAM,QAA8B;AAAA,IAClC,SAAS,OAAO,WAAW,CAAC;AAAA,IAC5B,UAAU;AAAA,IACV,WAAW;AAAA,IACX,YAAW,oBAAI,KAAK,GAAE,YAAY;AAAA,IAClC,OAAO,qBAAqB,MAAM;AAAA,IAClC,YAAY;AAAA,IACZ,aAAa;AAAA,EACf;AACA,QAAM,QAAQ,4BAA4B,CAAC,KAAK,CAAC;AACjD,SAAO,EAAE,GAAG;AACd;AAEO,SAAS,6BAA6B,KAAiD;AAC5F,SAAO,IAAI,gBAAgB;AAC7B;AAEO,SAAS,mCAAmC,KAAiD;AAClG,SAAO,IAAI,gBAAgB;AAC7B;","names":[]}
@@ -6,9 +6,6 @@ import {
6
6
  revokeToken,
7
7
  saveTokenStore
8
8
  } from "./chunk-UG274TNV.js";
9
- import {
10
- coerceInstallExtension
11
- } from "./chunk-PHK3HARR.js";
12
9
  import {
13
10
  getConnectorsDir,
14
11
  getRegistryPath
@@ -16,6 +13,9 @@ import {
16
13
  import {
17
14
  launchProcessSync
18
15
  } from "./chunk-O75CRYGF.js";
16
+ import {
17
+ coerceInstallExtension
18
+ } from "./chunk-ZPQVJEVQ.js";
19
19
  import {
20
20
  expandTildePath
21
21
  } from "./chunk-EYIEWJNI.js";
@@ -26,7 +26,7 @@ import {
26
26
  } from "./chunk-JUC24CTX.js";
27
27
  import {
28
28
  log
29
- } from "./chunk-2ODBA7MQ.js";
29
+ } from "./chunk-NU3CSQ4H.js";
30
30
 
31
31
  // src/connectors/index.ts
32
32
  import fs2 from "fs";
@@ -2254,4 +2254,4 @@ export {
2254
2254
  resolveWeCloneProxyConfigPath,
2255
2255
  buildWeCloneProxyConfig
2256
2256
  };
2257
- //# sourceMappingURL=chunk-GNAMDNGT.js.map
2257
+ //# sourceMappingURL=chunk-U7D7NP4J.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-EYIEWJNI.js";
4
4
  import {
5
5
  log
6
- } from "./chunk-2ODBA7MQ.js";
6
+ } from "./chunk-NU3CSQ4H.js";
7
7
 
8
8
  // src/shared-context/manager.ts
9
9
  import { randomUUID } from "crypto";
@@ -701,4 +701,4 @@ export {
701
701
  resolveSharedContextDir,
702
702
  SharedContextManager
703
703
  };
704
- //# sourceMappingURL=chunk-DRD2Q7HQ.js.map
704
+ //# sourceMappingURL=chunk-UFS7OXGL.js.map
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-JUC24CTX.js";
8
8
  import {
9
9
  log
10
- } from "./chunk-2ODBA7MQ.js";
10
+ } from "./chunk-NU3CSQ4H.js";
11
11
 
12
12
  // src/local-llm.ts
13
13
  import fs from "fs";
@@ -1072,4 +1072,4 @@ var LocalLlmClient = class _LocalLlmClient {
1072
1072
  export {
1073
1073
  LocalLlmClient
1074
1074
  };
1075
- //# sourceMappingURL=chunk-H3HDXD3U.js.map
1075
+ //# sourceMappingURL=chunk-UPTZYUYJ.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  StorageManager
3
- } from "./chunk-TY5NT3T3.js";
3
+ } from "./chunk-BLIWOONZ.js";
4
4
 
5
5
  // src/semantic-rule-promotion.ts
6
6
  import { createHash, randomUUID } from "crypto";
@@ -529,4 +529,4 @@ export {
529
529
  setSemanticRulePromotionTestHooks,
530
530
  promoteSemanticRuleFromMemory
531
531
  };
532
- //# sourceMappingURL=chunk-3IND7N4X.js.map
532
+ //# sourceMappingURL=chunk-UTYBJR7M.js.map
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-JUC24CTX.js";
8
8
  import {
9
9
  log
10
- } from "./chunk-2ODBA7MQ.js";
10
+ } from "./chunk-NU3CSQ4H.js";
11
11
 
12
12
  // src/connectors/codex-materialize.ts
13
13
  import {
@@ -694,4 +694,4 @@ export {
694
694
  truncateToTokenBudget,
695
695
  describeMemoriesDir
696
696
  };
697
- //# sourceMappingURL=chunk-LN4YGHTM.js.map
697
+ //# sourceMappingURL=chunk-UUH4YQOF.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-H3FZVNRN.js";
4
4
  import {
5
5
  log
6
- } from "./chunk-2ODBA7MQ.js";
6
+ } from "./chunk-NU3CSQ4H.js";
7
7
 
8
8
  // src/bootstrap.ts
9
9
  import path from "path";
@@ -140,4 +140,4 @@ var BootstrapEngine = class {
140
140
  export {
141
141
  BootstrapEngine
142
142
  };
143
- //# sourceMappingURL=chunk-6VF75M3X.js.map
143
+ //# sourceMappingURL=chunk-VGUOEDTU.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-SFQ6QNL7.js";
4
4
  import {
5
5
  log
6
- } from "./chunk-2ODBA7MQ.js";
6
+ } from "./chunk-NU3CSQ4H.js";
7
7
 
8
8
  // src/recall-state.ts
9
9
  import { appendFile, mkdir, readFile, writeFile } from "fs/promises";
@@ -260,4 +260,4 @@ export {
260
260
  LastRecallStore,
261
261
  TierMigrationStatusStore
262
262
  };
263
- //# sourceMappingURL=chunk-44VFF3BB.js.map
263
+ //# sourceMappingURL=chunk-VILEUJXC.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  log
3
- } from "./chunk-2ODBA7MQ.js";
3
+ } from "./chunk-NU3CSQ4H.js";
4
4
 
5
5
  // src/models-json.ts
6
6
  import { join } from "path";
@@ -48,4 +48,4 @@ export {
48
48
  clearModelsJsonCache,
49
49
  __setModelsJsonForTest
50
50
  };
51
- //# sourceMappingURL=chunk-7SI52C65.js.map
51
+ //# sourceMappingURL=chunk-VL7DP3OW.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  log
3
- } from "./chunk-2ODBA7MQ.js";
3
+ } from "./chunk-NU3CSQ4H.js";
4
4
 
5
5
  // src/recall-qos.ts
6
6
  function defaultTiming(metric) {
@@ -56,4 +56,4 @@ export {
56
56
  formatRecallSectionMetric,
57
57
  createRecallSectionMetricRecorder
58
58
  };
59
- //# sourceMappingURL=chunk-7DHTMOND.js.map
59
+ //# sourceMappingURL=chunk-VQ34TERH.js.map
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-SFQ6QNL7.js";
7
7
  import {
8
8
  StorageManager
9
- } from "./chunk-TY5NT3T3.js";
9
+ } from "./chunk-BLIWOONZ.js";
10
10
  import {
11
11
  buildLifecycleEventsForMemory,
12
12
  sortMemoryLifecycleEvents
@@ -74,4 +74,4 @@ export {
74
74
  backupExistingLedger,
75
75
  rebuildMemoryLifecycleLedger
76
76
  };
77
- //# sourceMappingURL=chunk-H6PMGMNP.js.map
77
+ //# sourceMappingURL=chunk-VX6OBUDW.js.map
@@ -15,10 +15,10 @@ import {
15
15
  } from "./chunk-54V4BZWP.js";
16
16
  import {
17
17
  ModelRegistry
18
- } from "./chunk-XZ4WBBB5.js";
18
+ } from "./chunk-PWFWCGOO.js";
19
19
  import {
20
20
  LocalLlmClient
21
- } from "./chunk-H3HDXD3U.js";
21
+ } from "./chunk-UPTZYUYJ.js";
22
22
  import {
23
23
  delinearize
24
24
  } from "./chunk-VEWZZM3H.js";
@@ -26,12 +26,12 @@ import {
26
26
  buildExtensionsFooterForSummary,
27
27
  formatDaySummaryMemories,
28
28
  loadDaySummaryPrompt
29
- } from "./chunk-WLEB7WCG.js";
29
+ } from "./chunk-EO5QWINU.js";
30
30
  import {
31
31
  FallbackLlmClient,
32
32
  fallbackLlmRuntimeContextFromConfig,
33
33
  gatewayTaskChainOptions
34
- } from "./chunk-LCC5EZTT.js";
34
+ } from "./chunk-FIVDN2SM.js";
35
35
  import {
36
36
  buildChatCompletionTokenLimit,
37
37
  shouldAssumeOpenAiChatCompletions
@@ -41,7 +41,7 @@ import {
41
41
  } from "./chunk-EI6V5UXY.js";
42
42
  import {
43
43
  ProfilingCollector
44
- } from "./chunk-QY7YA7OL.js";
44
+ } from "./chunk-PNLCEFE4.js";
45
45
  import {
46
46
  normalizeProcedureSteps
47
47
  } from "./chunk-QDW3E4RD.js";
@@ -53,7 +53,7 @@ import {
53
53
  } from "./chunk-RGMVMVMF.js";
54
54
  import {
55
55
  log
56
- } from "./chunk-2ODBA7MQ.js";
56
+ } from "./chunk-NU3CSQ4H.js";
57
57
 
58
58
  // src/extraction.ts
59
59
  import OpenAI from "openai";
@@ -2328,4 +2328,4 @@ ${memoryList}` }
2328
2328
  export {
2329
2329
  ExtractionEngine
2330
2330
  };
2331
- //# sourceMappingURL=chunk-EW5KFXHL.js.map
2331
+ //# sourceMappingURL=chunk-WDXCNJSF.js.map
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-ZFXCQPNO.js";
5
5
  import {
6
6
  StorageManager
7
- } from "./chunk-TY5NT3T3.js";
7
+ } from "./chunk-BLIWOONZ.js";
8
8
  import {
9
9
  ALL_CATEGORY_DIRS
10
10
  } from "./chunk-VS2IYZRU.js";
@@ -96,13 +96,15 @@ async function resolveNamespaceStorageRoot(config, namespace) {
96
96
  return await exists(legacyRoot) ? legacyRoot : tokenizedRoot;
97
97
  }
98
98
  var NamespaceStorageRouter = class {
99
- constructor(config, hooks = {}) {
99
+ constructor(config, hooks = {}, catalog) {
100
100
  this.config = config;
101
101
  this.hooks = hooks;
102
+ this.catalog = catalog;
102
103
  this.defaultNamespaceIdentity = normalizeNamespaceIdentity(config.defaultNamespace);
103
104
  }
104
105
  config;
105
106
  hooks;
107
+ catalog;
106
108
  cache = /* @__PURE__ */ new Map();
107
109
  defaultNsRootResolved = null;
108
110
  // Dedup the resolve hook (round 6, cursor Medium — NCNL2). Recall/extraction
@@ -131,6 +133,9 @@ var NamespaceStorageRouter = class {
131
133
  // `whenResolveHooksSettled`). Entries are removed as each hook settles, so the
132
134
  // set holds at most one promise per concurrently-resolving namespace.
133
135
  pendingResolveHooks = /* @__PURE__ */ new Set();
136
+ // Pending post-write catalog touch promises (#1522). Like pendingResolveHooks,
137
+ // lets tests await fire-and-forget write touches deterministically.
138
+ pendingWriteTouches = /* @__PURE__ */ new Set();
134
139
  // Normalized (trimmed) default namespace identity (NH-FH). `storageFor`
135
140
  // normalizes its input, so default-namespace branches must compare against the
136
141
  // normalized config default too — otherwise a whitespace-padded configured
@@ -170,6 +175,7 @@ var NamespaceStorageRouter = class {
170
175
  }
171
176
  const sm = new StorageManager(root, this.config.entitySchemas);
172
177
  sm.citationTemplate = this.config.inlineSourceAttributionFormat;
178
+ this.bindCatalogWriteHook(sm, ns);
173
179
  this.cache.set(ns, sm);
174
180
  this.notifyResolved(ns, root);
175
181
  return sm;
@@ -213,6 +219,76 @@ var NamespaceStorageRouter = class {
213
219
  }
214
220
  }
215
221
  }
222
+ /**
223
+ * Install the post-write catalog touch hook on an externally-constructed
224
+ * StorageManager (issue #1522). Used by the orchestrator for the legacy
225
+ * default-namespace storage (`this.storage`) that bypasses the router.
226
+ */
227
+ bindCatalogWriteHook(sm, namespace) {
228
+ sm.onCatalogWrite = () => this.touchCatalogWrite(namespace, sm.dir);
229
+ }
230
+ /**
231
+ * Post-write catalog touch (issue #1522 chokepoint). Called by every
232
+ * StorageManager's post-write hook AFTER a successful write. Best-effort
233
+ * and failure-tolerant — a catalog error MUST NOT affect the primary write
234
+ * (gotcha #13, rule #40). Fire-and-forget by design.
235
+ */
236
+ touchCatalogWrite(namespace, storageDir) {
237
+ if (!this.catalog) return;
238
+ const touch = this.catalog.markWrite(namespace, { discoveredBy: "write", storageDir }).catch(() => void 0);
239
+ this.pendingWriteTouches.add(touch);
240
+ void touch.then(
241
+ () => {
242
+ this.pendingWriteTouches.delete(touch);
243
+ },
244
+ () => {
245
+ this.pendingWriteTouches.delete(touch);
246
+ }
247
+ );
248
+ }
249
+ /**
250
+ * Record a namespace read in the catalog (issue #1522 chokepoint move).
251
+ * Best-effort and failure-tolerant. Used by recall paths so the read touch
252
+ * lives in the storage layer, not at the caller.
253
+ */
254
+ recordRead(namespace, storageDir) {
255
+ if (!this.catalog) return;
256
+ const ns = normalizeNamespaceIdentity(namespace || this.config.defaultNamespace);
257
+ void this.catalog.markRead(ns, { discoveredBy: "read", storageDir }).catch(() => void 0);
258
+ }
259
+ /**
260
+ * Record a namespace write touch in the catalog (issue #1522). Best-effort
261
+ * and failure-tolerant. Used by consolidation/cleanup passes that may mutate
262
+ * the store via delete-only paths (e.g. entity-file merges, TTL cleanup) so
263
+ * the namespace's lastWriteAt stays fresh even when no explicit write went
264
+ * through the storage chokepoint. This is NOT a substitute for the chokepoint
265
+ * — it's a belt-and-suspenders for paths the chokepoint doesn't cover.
266
+ */
267
+ recordWrite(namespace, storageDir) {
268
+ if (!this.catalog) return;
269
+ const ns = normalizeNamespaceIdentity(namespace || this.config.defaultNamespace);
270
+ const touch = this.catalog.markWrite(ns, { discoveredBy: "write", storageDir }).catch(() => void 0);
271
+ this.pendingWriteTouches.add(touch);
272
+ void touch.then(
273
+ () => {
274
+ this.pendingWriteTouches.delete(touch);
275
+ },
276
+ () => {
277
+ this.pendingWriteTouches.delete(touch);
278
+ }
279
+ );
280
+ }
281
+ /**
282
+ * Resolve once every in-flight post-write catalog touch has settled (#1522).
283
+ * Mirrors `whenResolveHooksSettled()`: the StorageManager's post-write hook
284
+ * fires the catalog touch fire-and-forget, so tests asserting lastWriteAt
285
+ * moved should await this instead of racing a timer.
286
+ */
287
+ async whenWriteTouchesSettled() {
288
+ while (this.pendingWriteTouches.size > 0) {
289
+ await Promise.allSettled([...this.pendingWriteTouches]);
290
+ }
291
+ }
216
292
  /**
217
293
  * Resolve once every in-flight `onResolve` registration has settled.
218
294
  *
@@ -236,4 +312,4 @@ export {
236
312
  resolveNamespaceStorageRoot,
237
313
  NamespaceStorageRouter
238
314
  };
239
- //# sourceMappingURL=chunk-ARLRTZZZ.js.map
315
+ //# sourceMappingURL=chunk-WIHPNY65.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/namespaces/storage.ts"],"sourcesContent":["import path from \"node:path\";\nimport { access, lstat, readdir } from \"node:fs/promises\";\nimport { isSafeRouteNamespace } from \"../routing/engine.js\";\nimport { StorageManager } from \"../storage.js\";\nimport type { PluginConfig } from \"../types.js\";\nimport { ALL_CATEGORY_DIRS } from \"../utils/category-dir.js\";\nimport { namespaceIdentityToken, normalizeNamespaceIdentity } from \"./identity.js\";\nimport type { NamespaceCatalog } from \"./catalog.js\";\n\nasync function exists(p: string): Promise<boolean> {\n try {\n await access(p);\n return true;\n } catch {\n return false;\n }\n}\n\nasync function hasStoredEntries(p: string): Promise<boolean> {\n try {\n const entry = await lstat(p);\n if (entry.isSymbolicLink()) return true;\n if (!entry.isDirectory()) return true;\n const children = await readdir(p, { withFileTypes: true });\n for (const child of children) {\n const childPath = path.join(p, child.name);\n if (child.isSymbolicLink() || child.isFile()) return true;\n if (child.isDirectory() && (await hasStoredEntries(childPath))) return true;\n }\n return false;\n } catch {\n return false;\n }\n}\n\n// Build a per-namespace directory under `<memoryDir>/namespaces` and assert the\n// resolved path stays inside that base. Namespace identifiers can originate from\n// operator config (config.defaultNamespace) and request-derived routing, so this\n// containment check prevents directory traversal (CodeQL js/path-injection).\n// For safe segments this returns exactly `path.join(base, segment)`, so there is\n// no behavioral change for valid namespaces.\nfunction resolveNamespaceDir(memoryDir: string, segment: string): string {\n // Mirror isSafeRouteNamespace's separator/parent-ref rejection (without its\n // 64-char cap, so identity tokens still pass). Rejecting separators and \"..\"\n // up front keeps the value a single contained child of <memoryDir>/namespaces.\n if (\n segment.length === 0 ||\n segment.includes(\"/\") ||\n segment.includes(\"\\\\\") ||\n segment.includes(\"..\") ||\n path.isAbsolute(segment)\n ) {\n throw new Error(`unsafe namespace path segment: ${segment}`);\n }\n return path.join(memoryDir, \"namespaces\", segment);\n}\n\nconst LEGACY_NAMESPACE_CONTENT_CHILDREN = [\n ...ALL_CATEGORY_DIRS,\n \"entities\",\n \"artifacts\",\n \"identity\",\n \"config\",\n \"summaries\",\n \"profile.md\",\n] as const;\n\nconst LEGACY_NAMESPACE_RUNTIME_CHILDREN = [\"state\"] as const;\n\nasync function hasAnyLegacyData(\n rootDir: string,\n options: { includeRuntimeState?: boolean } = {},\n): Promise<boolean> {\n const children = options.includeRuntimeState === true\n ? [...LEGACY_NAMESPACE_CONTENT_CHILDREN, ...LEGACY_NAMESPACE_RUNTIME_CHILDREN]\n : LEGACY_NAMESPACE_CONTENT_CHILDREN;\n for (const child of children) {\n if (await hasStoredEntries(path.join(rootDir, child))) return true;\n }\n return false;\n}\n\nasync function hasAnyNamespaceStorageMarker(\n rootDir: string,\n options: { includeRuntimeState?: boolean } = {},\n): Promise<boolean> {\n const children = options.includeRuntimeState === true\n ? [...LEGACY_NAMESPACE_CONTENT_CHILDREN, ...LEGACY_NAMESPACE_RUNTIME_CHILDREN]\n : LEGACY_NAMESPACE_CONTENT_CHILDREN;\n for (const child of children) {\n if (await exists(path.join(rootDir, child))) return true;\n }\n return false;\n}\n\n/**\n * Storage routing for namespaces.\n *\n * Compatibility note:\n * - When namespaces are enabled, existing raw namespace roots are preserved.\n * New namespace roots use tokenized names under `memoryDir/namespaces/<token>`.\n * - The default namespace continues to use the legacy `memoryDir` root unless the caller\n * has created `memoryDir/namespaces/<defaultNamespace>` (in which case we use that).\n *\n * This avoids surprising \"lost memories\" when an install flips namespaces on without\n * migrating existing data.\n */\n/**\n * Optional hooks for the storage router. `onResolve` fires whenever a namespace's\n * storage is resolved/created, so a downstream consumer (e.g. the namespace\n * catalog, issue #1499) can register the namespace. The hook MUST NOT throw into\n * the router; the router invokes it defensively and a hook failure never affects\n * storage resolution.\n *\n * The hook MAY return (or resolve to) a boolean indicating whether the\n * registration actually PERSISTED (round 6, codex P2 — NEFoX). When it resolves\n * to `false` (a dropped/no-op registration), the router does NOT mark the\n * (namespace, storageDir) pair as notified, so the next resolve RETRIES it\n * instead of suppressing it forever. A `void`/`undefined` result is treated as\n * success (legacy hooks).\n */\nexport interface NamespaceStorageRouterHooks {\n onResolve?: (\n namespace: string,\n storageDir: string,\n ) => void | boolean | Promise<void | boolean>;\n}\n\n/**\n * Resolve the runtime storage root for the configured DEFAULT namespace.\n *\n * Shared between the live router (`NamespaceStorageRouter.defaultNamespaceRoot`)\n * and the rebuildable catalog (`NamespaceCatalog.rebuildFromDisk`) so the two\n * can never diverge (CLAUDE.md rule #22/#42 — read & write paths resolve through\n * the same logic). The contract is: while legacy memory data still lives\n * directly under `memoryDir`, the default root stays `memoryDir`; only once the\n * legacy root is empty and a `namespaces/<default|token>` dir holds data does\n * the default migrate into that tokenized/legacy-named dir.\n */\nexport async function resolveDefaultNamespaceRoot(config: PluginConfig): Promise<string> {\n if (!config.namespacesEnabled) {\n return config.memoryDir;\n }\n\n // Build the legacy default root from the NORMALIZED (trimmed) name so a\n // whitespace-padded `defaultNamespace` still finds the live `namespaces/default`\n // root (NIabe). `storageFor()` classifies the trimmed value as the default, and\n // the on-disk legacy dir is created under the trimmed name; using the raw spaced\n // name here would look for `namespaces/<spaced>` and miss the real root, falling\n // back to memoryDir/tokenized. `namespaceIdentityToken` already normalizes\n // internally, so the tokenized path is unaffected.\n const defaultIdentity = normalizeNamespaceIdentity(config.defaultNamespace);\n const legacyNsDir = resolveNamespaceDir(config.memoryDir, defaultIdentity);\n const tokenizedNsDir = resolveNamespaceDir(\n config.memoryDir,\n namespaceIdentityToken(config.defaultNamespace),\n );\n const tokenizedHasData =\n (await exists(tokenizedNsDir)) &&\n (await hasAnyNamespaceStorageMarker(tokenizedNsDir, { includeRuntimeState: true }));\n const nsDir = tokenizedHasData\n ? tokenizedNsDir\n : (await exists(legacyNsDir))\n ? legacyNsDir\n : tokenizedNsDir;\n return (await exists(nsDir)) && !(await hasAnyLegacyData(config.memoryDir))\n ? nsDir\n : config.memoryDir;\n}\n\n/**\n * Resolve the runtime storage root for ANY namespace exactly as the live router\n * would (`NamespaceStorageRouter.namespaceRoot`). Shared so the rebuildable\n * catalog records the SAME on-disk root the router routes to — a recall/read\n * touch must not guess `namespaces/<token>` when the router actually serves a\n * legacy raw-name dir or a migrated default root (CLAUDE.md rule #22/#42; round\n * 4, cursor Medium). The default namespace delegates to `resolveDefaultNamespaceRoot`;\n * every other namespace prefers the tokenized root when it has a storage marker,\n * else a legacy raw-name dir when present, else the tokenized root.\n */\nexport async function resolveNamespaceStorageRoot(\n config: PluginConfig,\n namespace: string,\n): Promise<string> {\n if (!config.namespacesEnabled) return config.memoryDir;\n // Compare on NORMALIZED identity so a whitespace-padded configured default name\n // still routes to the default root rather than a tokenized non-default dir\n // (NH-FH). The catalog keys records by the same normalized identity.\n if (normalizeNamespaceIdentity(namespace) === normalizeNamespaceIdentity(config.defaultNamespace)) {\n return resolveDefaultNamespaceRoot(config);\n }\n const legacyRoot = resolveNamespaceDir(config.memoryDir, namespace);\n const tokenizedRoot = resolveNamespaceDir(config.memoryDir, namespaceIdentityToken(namespace));\n if (\n (await exists(tokenizedRoot)) &&\n (await hasAnyNamespaceStorageMarker(tokenizedRoot, { includeRuntimeState: true }))\n ) {\n return tokenizedRoot;\n }\n return (await exists(legacyRoot)) ? legacyRoot : tokenizedRoot;\n}\n\nexport class NamespaceStorageRouter {\n private readonly cache = new Map<string, StorageManager>();\n private defaultNsRootResolved: string | null = null;\n // Dedup the resolve hook (round 6, cursor Medium — NCNL2). Recall/extraction\n // call `storageFor` repeatedly; firing `onResolve` (→ catalog loadCompacted +\n // append) on every cache hit grows `namespaces.jsonl` without bound between\n // rebuilds. We fire the hook only when the (namespace, storageDir) pair is new\n // or its dir changed, so a steady-state cache hit is a no-op for the catalog.\n private readonly notifiedResolved = new Map<string, string>();\n // In-flight resolve-hook dedup (NFJV-, codex P2). The catalog's `onResolve`\n // hook is ASYNC (it returns `registerResolved(...)`), so `notifiedResolved` is\n // only set after the hook's promise SETTLES. Without tracking the in-flight\n // window, a burst of `storageFor()` cache hits for the SAME namespace before\n // the first registration finishes would each pass the `notifiedResolved` guard\n // and fire their OWN `onResolve` — queueing N duplicate catalog touches + lock\n // acquisitions despite the once-per-namespace intent. We therefore record the\n // (namespace → storageDir) being registered BEFORE awaiting the hook so a\n // concurrent call for the same pair skips firing. On SUCCESS the pair is\n // promoted to `notifiedResolved` (future calls skip permanently); on `false`\n // (dropped touch — e.g. rebuild-lock timeout) OR rejection the in-flight marker\n // is CLEARED so a later `storageFor()` can RETRY the dropped registration. The\n // entry is always removed when the promise settles, so the map cannot grow\n // unbounded (one transient entry per concurrently-resolving namespace).\n private readonly inFlightResolved = new Map<string, string>();\n // Tracks every in-flight resolve-hook promise so callers can deterministically\n // await the fire-and-forget registrations that `storageFor()` kicks off (see\n // `whenResolveHooksSettled`). Entries are removed as each hook settles, so the\n // set holds at most one promise per concurrently-resolving namespace.\n private readonly pendingResolveHooks = new Set<Promise<unknown>>();\n // Pending post-write catalog touch promises (#1522). Like pendingResolveHooks,\n // lets tests await fire-and-forget write touches deterministically.\n private readonly pendingWriteTouches = new Set<Promise<unknown>>();\n\n // Normalized (trimmed) default namespace identity (NH-FH). `storageFor`\n // normalizes its input, so default-namespace branches must compare against the\n // normalized config default too — otherwise a whitespace-padded configured\n // default name routes the default namespace to a tokenized non-default root.\n private readonly defaultNamespaceIdentity: string;\n\n constructor(\n private readonly config: PluginConfig,\n private readonly hooks: NamespaceStorageRouterHooks = {},\n /** Catalog reference for post-write/read touches (issue #1522 chokepoint). */\n private readonly catalog?: NamespaceCatalog,\n ) {\n this.defaultNamespaceIdentity = normalizeNamespaceIdentity(config.defaultNamespace);\n }\n\n private async defaultNamespaceRoot(): Promise<string> {\n this.defaultNsRootResolved = await resolveDefaultNamespaceRoot(this.config);\n return this.defaultNsRootResolved;\n }\n\n private async namespaceRoot(namespace: string): Promise<string> {\n // NOTE: only used after defaultNamespaceRoot() resolution.\n if (!this.config.namespacesEnabled) return this.config.memoryDir;\n if (normalizeNamespaceIdentity(namespace) === this.defaultNamespaceIdentity) {\n return this.defaultNsRootResolved ?? this.config.memoryDir;\n }\n return resolveNamespaceStorageRoot(this.config, namespace);\n }\n\n async storageFor(namespace: string): Promise<StorageManager> {\n const ns = normalizeNamespaceIdentity(namespace || this.config.defaultNamespace);\n if (ns !== this.defaultNamespaceIdentity && !isSafeRouteNamespace(ns)) {\n throw new Error(`unsafe namespace: ${ns}`);\n }\n // Even when the default namespace is exempt from the check above, every\n // on-disk path is built through resolveNamespaceDir(), which rejects\n // traversal segments — so an unsafe configured default still cannot escape\n // <memoryDir>/namespaces (CodeQL js/path-injection).\n\n let root: string;\n if (ns === this.defaultNamespaceIdentity) {\n root = await this.defaultNamespaceRoot();\n const cached = this.cache.get(ns);\n if (cached && cached.dir === root) {\n this.notifyResolved(ns, root);\n return cached;\n }\n } else {\n const cached = this.cache.get(ns);\n root = await this.namespaceRoot(ns);\n if (cached && cached.dir === root) {\n this.notifyResolved(ns, root);\n return cached;\n }\n }\n\n const sm = new StorageManager(root, this.config.entitySchemas);\n // Propagate the inline-attribution template so that router-created storages\n // (used by extraction and shared-promotion paths) strip citations consistently,\n // matching the behaviour of the primary this.storage instance in the orchestrator.\n sm.citationTemplate = this.config.inlineSourceAttributionFormat;\n // #1522: install the post-write catalog touch at the chokepoint — every\n // successful write on this StorageManager records the namespace touch.\n this.bindCatalogWriteHook(sm, ns);\n this.cache.set(ns, sm);\n this.notifyResolved(ns, root);\n return sm;\n }\n\n /**\n * Fire the resolve hook defensively. A hook failure (e.g. a catalog write\n * error) MUST NOT crash storage resolution — see CLAUDE.md gotcha #13.\n */\n private notifyResolved(namespace: string, storageDir: string): void {\n const hook = this.hooks.onResolve;\n if (!hook) return;\n // Skip when we've already SUCCESSFULLY notified this exact (namespace,\n // storageDir) — a steady-state cache hit must not re-append to the catalog\n // log (NCNL2). A changed dir (rare: migration/realignment) still re-fires\n // once. We mark the pair as notified ONLY AFTER the hook succeeds, and CLEAR\n // it on failure, so a dropped registration (e.g. rebuild-lock timeout) is\n // RETRIED on the next cache hit instead of being suppressed forever (round 6,\n // cursor Medium — ND3EJ).\n if (this.notifiedResolved.get(namespace) === storageDir) return;\n // In-flight dedup (NFJV-, codex P2): if a registration for this exact\n // (namespace, storageDir) is already AWAITING its async hook, do not fire a\n // second one. Without this, concurrent cache-hit bursts before the first\n // append settles each pass the `notifiedResolved` guard above and queue\n // duplicate catalog touches/lock acquisitions. A pair with a DIFFERENT\n // in-flight dir (rare mid-migration realignment) still fires once.\n if (this.inFlightResolved.get(namespace) === storageDir) return;\n try {\n // Handle BOTH synchronous throws and asynchronous rejections (round 6,\n // codex P2 — NDo8C). The hook may be `async`; its rejected promise would\n // bypass this try/catch and, where unhandled rejections are fatal, crash\n // storage resolution. Mark the dedup pair as notified ONLY when the hook\n // resolves to a PERSISTED result (round 6, codex P2 — NEFoX): a result of\n // `false` means the registration was dropped/no-op (e.g. rebuild-lock\n // timeout), so we must NOT suppress its retry. `void`/`undefined` is treated\n // as success for legacy hooks. On rejection we leave it un-notified to retry.\n //\n // Record the in-flight marker BEFORE awaiting so concurrent calls for the\n // same pair skip (NFJV-). It is always cleared once the promise settles, so\n // the map holds at most one transient entry per concurrently-resolving\n // namespace and cannot grow unbounded.\n this.inFlightResolved.set(namespace, storageDir);\n const hookResult = Promise.resolve(hook(namespace, storageDir));\n // Track the in-flight promise so `whenResolveHooksSettled()` can await it.\n this.pendingResolveHooks.add(hookResult);\n hookResult.then(\n (persisted) => {\n // Clear the in-flight marker ONLY if it is still ours (a newer resolve\n // for a different dir may have replaced it).\n if (this.inFlightResolved.get(namespace) === storageDir) {\n this.inFlightResolved.delete(namespace);\n }\n if (persisted !== false) {\n this.notifiedResolved.set(namespace, storageDir);\n }\n // On `false` (dropped touch) we intentionally do NOT mark notified, so\n // a later `storageFor()` retries the registration. Clearing the\n // in-flight marker above is what re-enables that retry.\n this.pendingResolveHooks.delete(hookResult);\n },\n () => {\n // Registration failed — clear in-flight AND do NOT mark as notified, so\n // it is retried on the next cache hit.\n if (this.inFlightResolved.get(namespace) === storageDir) {\n this.inFlightResolved.delete(namespace);\n }\n if (this.notifiedResolved.get(namespace) === storageDir) {\n this.notifiedResolved.delete(namespace);\n }\n this.pendingResolveHooks.delete(hookResult);\n },\n );\n } catch {\n // Synchronous throw: clear any in-flight marker we just set and leave the\n // pair un-notified so a later resolve retries.\n if (this.inFlightResolved.get(namespace) === storageDir) {\n this.inFlightResolved.delete(namespace);\n }\n }\n }\n\n /**\n * Install the post-write catalog touch hook on an externally-constructed\n * StorageManager (issue #1522). Used by the orchestrator for the legacy\n * default-namespace storage (`this.storage`) that bypasses the router.\n */\n bindCatalogWriteHook(sm: StorageManager, namespace: string): void {\n sm.onCatalogWrite = () => this.touchCatalogWrite(namespace, sm.dir);\n }\n\n /**\n * Post-write catalog touch (issue #1522 chokepoint). Called by every\n * StorageManager's post-write hook AFTER a successful write. Best-effort\n * and failure-tolerant — a catalog error MUST NOT affect the primary write\n * (gotcha #13, rule #40). Fire-and-forget by design.\n */\n private touchCatalogWrite(namespace: string, storageDir: string): void {\n if (!this.catalog) return;\n const touch = this.catalog\n .markWrite(namespace, { discoveredBy: \"write\", storageDir })\n .catch(() => undefined);\n this.pendingWriteTouches.add(touch);\n void touch.then(\n () => { this.pendingWriteTouches.delete(touch); },\n () => { this.pendingWriteTouches.delete(touch); },\n );\n }\n\n /**\n * Record a namespace read in the catalog (issue #1522 chokepoint move).\n * Best-effort and failure-tolerant. Used by recall paths so the read touch\n * lives in the storage layer, not at the caller.\n */\n recordRead(namespace: string, storageDir?: string): void {\n if (!this.catalog) return;\n const ns = normalizeNamespaceIdentity(namespace || this.config.defaultNamespace);\n void this.catalog\n .markRead(ns, { discoveredBy: \"read\", storageDir })\n .catch(() => undefined);\n }\n /**\n * Record a namespace write touch in the catalog (issue #1522). Best-effort\n * and failure-tolerant. Used by consolidation/cleanup passes that may mutate\n * the store via delete-only paths (e.g. entity-file merges, TTL cleanup) so\n * the namespace's lastWriteAt stays fresh even when no explicit write went\n * through the storage chokepoint. This is NOT a substitute for the chokepoint\n * — it's a belt-and-suspenders for paths the chokepoint doesn't cover.\n */\n recordWrite(namespace: string, storageDir?: string): void {\n if (!this.catalog) return;\n const ns = normalizeNamespaceIdentity(namespace || this.config.defaultNamespace);\n const touch = this.catalog\n .markWrite(ns, { discoveredBy: \"write\", storageDir })\n .catch(() => undefined);\n this.pendingWriteTouches.add(touch);\n void touch.then(\n () => { this.pendingWriteTouches.delete(touch); },\n () => { this.pendingWriteTouches.delete(touch); },\n );\n }\n\n /**\n * Resolve once every in-flight post-write catalog touch has settled (#1522).\n * Mirrors `whenResolveHooksSettled()`: the StorageManager's post-write hook\n * fires the catalog touch fire-and-forget, so tests asserting lastWriteAt\n * moved should await this instead of racing a timer.\n */\n async whenWriteTouchesSettled(): Promise<void> {\n while (this.pendingWriteTouches.size > 0) {\n await Promise.allSettled([...this.pendingWriteTouches]);\n }\n }\n\n /**\n * Resolve once every in-flight `onResolve` registration has settled.\n *\n * `storageFor()` fires the resolve hook fire-and-forget, so its catalog side\n * effect (e.g. `registerResolved(...)`) is not observable the moment\n * `storageFor()` returns. Callers that must act on that side effect — notably\n * tests asserting the catalog was updated — should await this instead of\n * racing a timer. Resolves immediately when no hook is registered or nothing\n * is in flight. The loop re-checks because a settling hook could, in\n * principle, trigger a follow-on resolution.\n */\n async whenResolveHooksSettled(): Promise<void> {\n while (this.pendingResolveHooks.size > 0) {\n await Promise.allSettled([...this.pendingResolveHooks]);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,UAAU;AACjB,SAAS,QAAQ,OAAO,eAAe;AAQvC,eAAe,OAAO,GAA6B;AACjD,MAAI;AACF,UAAM,OAAO,CAAC;AACd,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,eAAe,iBAAiB,GAA6B;AAC3D,MAAI;AACF,UAAM,QAAQ,MAAM,MAAM,CAAC;AAC3B,QAAI,MAAM,eAAe,EA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oBAAoB,OAAO,KAAK;AAAA,MAAG;AAAA,IAClD;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,0BAAyC;AAC7C,WAAO,KAAK,oBAAoB,OAAO,GAAG;AACxC,YAAM,QAAQ,WAAW,CAAC,GAAG,KAAK,mBAAmB,CAAC;AAAA,IACxD;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAaA,MAAM,0BAAyC;AAC7C,WAAO,KAAK,oBAAoB,OAAO,GAAG;AACxC,YAAM,QAAQ,WAAW,CAAC,GAAG,KAAK,mBAAmB,CAAC;AAAA,IACxD;AAAA,EACF;AACF;","names":[]}
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-U3PN77QT.js";
4
4
  import {
5
5
  log
6
- } from "./chunk-2ODBA7MQ.js";
6
+ } from "./chunk-NU3CSQ4H.js";
7
7
 
8
8
  // src/routing/store.ts
9
9
  import { lstat, mkdir, readFile, realpath, rename, rm, rmdir, stat, writeFile } from "fs/promises";
@@ -306,4 +306,4 @@ var RoutingRulesStore = class {
306
306
  export {
307
307
  RoutingRulesStore
308
308
  };
309
- //# sourceMappingURL=chunk-X6IRLNOO.js.map
309
+ //# sourceMappingURL=chunk-WIWPSQYU.js.map
@@ -10,7 +10,7 @@ import {
10
10
  } from "./chunk-YNQ6DFSV.js";
11
11
  import {
12
12
  log
13
- } from "./chunk-2ODBA7MQ.js";
13
+ } from "./chunk-NU3CSQ4H.js";
14
14
 
15
15
  // src/search/meilisearch-backend.ts
16
16
  var MeilisearchBackend = class {
@@ -245,4 +245,4 @@ function isMeilisearchIndexNotFoundError(err) {
245
245
  export {
246
246
  MeilisearchBackend
247
247
  };
248
- //# sourceMappingURL=chunk-DOCTITOP.js.map
248
+ //# sourceMappingURL=chunk-WRFKZEO6.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-O75CRYGF.js";
4
4
  import {
5
5
  log
6
- } from "./chunk-2ODBA7MQ.js";
6
+ } from "./chunk-NU3CSQ4H.js";
7
7
 
8
8
  // src/conversation-index/faiss-adapter.ts
9
9
  import { fileURLToPath } from "url";
@@ -275,4 +275,4 @@ export {
275
275
  FaissConversationIndexAdapter,
276
276
  failOpenFaissHealth
277
277
  };
278
- //# sourceMappingURL=chunk-E6ZDCOHM.js.map
278
+ //# sourceMappingURL=chunk-XBZQRZ6G.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  log
3
- } from "./chunk-2ODBA7MQ.js";
3
+ } from "./chunk-NU3CSQ4H.js";
4
4
 
5
5
  // src/extraction-judge-training.ts
6
6
  import path from "path";
@@ -157,4 +157,4 @@ export {
157
157
  readJudgeTrainingPairs,
158
158
  isValidTrainingPair
159
159
  };
160
- //# sourceMappingURL=chunk-7YX23JBA.js.map
160
+ //# sourceMappingURL=chunk-XHYGJVXL.js.map
@@ -216,4 +216,4 @@ export {
216
216
  getCausalTrajectoryStoreStatus,
217
217
  searchCausalTrajectories
218
218
  };
219
- //# sourceMappingURL=chunk-JD4SCARD.js.map
219
+ //# sourceMappingURL=chunk-YN4ZT4CW.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  readAllEdges
3
- } from "./chunk-2LDBXPLB.js";
3
+ } from "./chunk-KF74X62T.js";
4
4
  import {
5
5
  readEdgeConfidence
6
6
  } from "./chunk-2LSZVONP.js";
@@ -162,4 +162,4 @@ export {
162
162
  parseGraphSnapshotSince,
163
163
  buildGraphSnapshot
164
164
  };
165
- //# sourceMappingURL=chunk-YXWAILM4.js.map
165
+ //# sourceMappingURL=chunk-YOI3ELXF.js.map