@remnic/core 9.17.1 → 9.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (379) hide show
  1. package/dist/access-admin-ops-surface.d.ts +8 -8
  2. package/dist/access-admin-ops-surface.js +18 -18
  3. package/dist/access-boundary.d.ts +8 -8
  4. package/dist/access-boundary.js +18 -18
  5. package/dist/access-cli.js +52 -52
  6. package/dist/access-http.d.ts +8 -8
  7. package/dist/access-http.js +23 -23
  8. package/dist/access-identity-continuity-surface.d.ts +6 -6
  9. package/dist/access-identity-continuity-surface.js +18 -18
  10. package/dist/access-lcm-surface.d.ts +8 -8
  11. package/dist/access-lcm-surface.js +18 -18
  12. package/dist/access-mcp.d.ts +8 -8
  13. package/dist/access-mcp.js +22 -22
  14. package/dist/access-memory-search-fanout.d.ts +2 -2
  15. package/dist/access-memory-search-fanout.js +3 -3
  16. package/dist/{access-namespace-preflight-_yxq3PYy.d.ts → access-namespace-preflight-BsawJa-L.d.ts} +1 -1
  17. package/dist/access-namespace-preflight.d.ts +3 -3
  18. package/dist/access-namespace-preflight.js +18 -18
  19. package/dist/access-observe-write-surface.d.ts +8 -8
  20. package/dist/access-observe-write-surface.js +18 -18
  21. package/dist/access-operations-batch.js +20 -20
  22. package/dist/access-operations.d.ts +11 -11
  23. package/dist/access-operations.js +21 -21
  24. package/dist/access-recall-concurrency.d.ts +8 -8
  25. package/dist/access-recall-concurrency.js +18 -18
  26. package/dist/access-recall-response.d.ts +8 -8
  27. package/dist/access-recall-response.js +18 -18
  28. package/dist/access-recall-surface.d.ts +8 -8
  29. package/dist/access-recall-surface.js +18 -18
  30. package/dist/access-schema.d.ts +76 -76
  31. package/dist/{access-service-CSm242ks.d.ts → access-service-DLuVnV6a.d.ts} +6 -6
  32. package/dist/access-service.d.ts +8 -8
  33. package/dist/access-service.js +18 -18
  34. package/dist/access-surface-catalog.d.ts +8 -8
  35. package/dist/action-confidence.d.ts +1 -1
  36. package/dist/active-memory-bridge.d.ts +1 -1
  37. package/dist/active-memory-bridge.js +3 -3
  38. package/dist/active-recall.d.ts +1 -1
  39. package/dist/active-recall.js +1 -1
  40. package/dist/behavior-learner.d.ts +1 -1
  41. package/dist/behavior-signals.d.ts +1 -1
  42. package/dist/bootstrap.d.ts +6 -6
  43. package/dist/briefing.d.ts +2 -2
  44. package/dist/briefing.js +6 -6
  45. package/dist/buffer-surprise-report.d.ts +1 -1
  46. package/dist/buffer.d.ts +2 -2
  47. package/dist/buffer.js +2 -2
  48. package/dist/bulk-import/index.d.ts +3 -3
  49. package/dist/calibration.d.ts +1 -1
  50. package/dist/capabilities.d.ts +4 -3
  51. package/dist/capabilities.js +1 -1
  52. package/dist/{catalog-9qLG_2OV.d.ts → catalog-O6P8694A.d.ts} +1 -1
  53. package/dist/causal-behavior.d.ts +1 -1
  54. package/dist/causal-consolidation.d.ts +1 -1
  55. package/dist/causal-consolidation.js +7 -7
  56. package/dist/causal-trajectory-graph.d.ts +1 -1
  57. package/dist/{chunk-BV5WMSIJ.js → chunk-2AJ72VVS.js} +3 -3
  58. package/dist/{chunk-755Q3DGF.js → chunk-2H7OEVPO.js} +2 -2
  59. package/dist/{chunk-TG6IHVE2.js → chunk-354T54RR.js} +2 -2
  60. package/dist/{chunk-347WD2LE.js → chunk-3CSX3ETE.js} +2 -1
  61. package/dist/chunk-3CSX3ETE.js.map +1 -0
  62. package/dist/{chunk-KGKYTCDO.js → chunk-3LZSS77C.js} +3 -3
  63. package/dist/{chunk-EA2H5LML.js → chunk-44DUJETW.js} +2 -2
  64. package/dist/{chunk-WQ2I6ODB.js → chunk-5MFHOX5T.js} +3 -3
  65. package/dist/{chunk-JECBQBEX.js → chunk-B7GROTXD.js} +2 -2
  66. package/dist/{chunk-6WAFYNVT.js → chunk-BJJAX3IZ.js} +2 -2
  67. package/dist/{chunk-IZHXSLO7.js → chunk-CH3BRJ3P.js} +2 -2
  68. package/dist/{chunk-L3HAUO7K.js → chunk-D5H3B36B.js} +2 -2
  69. package/dist/{chunk-AWT7SCWQ.js → chunk-DQCUBRTZ.js} +2 -2
  70. package/dist/{chunk-WIUYMCPL.js → chunk-DR65EEXG.js} +15 -15
  71. package/dist/{chunk-7LXSPIVG.js → chunk-EZFVVEQG.js} +4 -4
  72. package/dist/{chunk-S2FSBU4H.js → chunk-FCCMFVS6.js} +2 -2
  73. package/dist/{chunk-2OH3ZRYH.js → chunk-FL7MNSH3.js} +7 -6
  74. package/dist/chunk-FL7MNSH3.js.map +1 -0
  75. package/dist/{chunk-QDTEH6BS.js → chunk-HCNG42P3.js} +2 -2
  76. package/dist/{chunk-V57NLO5P.js → chunk-HKF5VASQ.js} +11 -4
  77. package/dist/chunk-HKF5VASQ.js.map +1 -0
  78. package/dist/{chunk-7YJLCNPF.js → chunk-HRREDJSL.js} +204 -170
  79. package/dist/chunk-HRREDJSL.js.map +1 -0
  80. package/dist/{chunk-7ON2JW73.js → chunk-IKMAO55B.js} +2 -2
  81. package/dist/{chunk-B57BIBXI.js → chunk-IU3XJAQM.js} +3 -3
  82. package/dist/{chunk-RFDD3B7W.js → chunk-JGUXPJUQ.js} +2 -2
  83. package/dist/{chunk-KQED7RCV.js → chunk-KOFVOVJG.js} +22 -22
  84. package/dist/{chunk-7PK4W4RN.js → chunk-KUF7OIFK.js} +3 -3
  85. package/dist/{chunk-QCLQ4BGA.js → chunk-MJYYXODM.js} +3 -3
  86. package/dist/{chunk-C2RMQRPN.js → chunk-MLW3J7IC.js} +3 -3
  87. package/dist/{chunk-7VZWZVYG.js → chunk-MQVINOJQ.js} +3 -3
  88. package/dist/{chunk-BCNVNUQG.js → chunk-OFQUY5NZ.js} +12 -4
  89. package/dist/chunk-OFQUY5NZ.js.map +1 -0
  90. package/dist/{chunk-52EFQMQC.js → chunk-OOJQ6ID5.js} +30 -30
  91. package/dist/{chunk-F7BWFIDK.js → chunk-OZSL2QZC.js} +65 -4
  92. package/dist/chunk-OZSL2QZC.js.map +1 -0
  93. package/dist/{chunk-LMVAIZR5.js → chunk-PLRDZ2OO.js} +5 -9
  94. package/dist/chunk-PLRDZ2OO.js.map +1 -0
  95. package/dist/{chunk-BIRPR5N7.js → chunk-Q55XM4SU.js} +2 -2
  96. package/dist/{chunk-7O2C2OOF.js → chunk-QEEMLGCO.js} +7 -7
  97. package/dist/{chunk-ANEUPF6O.js → chunk-QH6CS6XJ.js} +2 -2
  98. package/dist/{chunk-SCCO46KZ.js → chunk-RDQGLJRR.js} +3 -2
  99. package/dist/chunk-RDQGLJRR.js.map +1 -0
  100. package/dist/{chunk-BGBPDAIN.js → chunk-RPOOJPMB.js} +6 -6
  101. package/dist/{chunk-I6ODVWQB.js → chunk-S5HCKQ7Q.js} +2 -2
  102. package/dist/{chunk-QDNE35FU.js → chunk-SB4OKS6C.js} +3 -3
  103. package/dist/{chunk-B6NCHYAK.js → chunk-SQEDDWAM.js} +4 -4
  104. package/dist/{chunk-K2B2TMF3.js → chunk-U7D5HWNG.js} +2 -2
  105. package/dist/{chunk-XSBUROEB.js → chunk-UGH6VPPO.js} +2 -2
  106. package/dist/{chunk-G2WCVFDC.js → chunk-UVSDFM7R.js} +4 -4
  107. package/dist/{chunk-AFH7PIFU.js → chunk-VSVX777Y.js} +2 -2
  108. package/dist/{chunk-B6P3QDBF.js → chunk-W3DJOT22.js} +2 -2
  109. package/dist/{chunk-AE7WMV4V.js → chunk-WMLHJ5UW.js} +2 -2
  110. package/dist/{chunk-N7DK67GZ.js → chunk-WYL5ODHJ.js} +1 -1
  111. package/dist/chunk-WYL5ODHJ.js.map +1 -0
  112. package/dist/{chunk-GBT4TFV7.js → chunk-X6E5WAGX.js} +9 -9
  113. package/dist/{chunk-VZC7ORJE.js → chunk-X7GOH7Y6.js} +2 -2
  114. package/dist/{chunk-6QYST5XN.js → chunk-XY7QPJDA.js} +2 -2
  115. package/dist/{chunk-WIS5JTJR.js → chunk-Y4JHE2ML.js} +2 -2
  116. package/dist/{chunk-SESF64QR.js → chunk-YUWFASAK.js} +4 -4
  117. package/dist/{chunk-BZ52BJ6C.js → chunk-YWJBAHTY.js} +2 -2
  118. package/dist/{cli-BLZHYY2A.d.ts → cli-0dQHR6e6.d.ts} +5 -5
  119. package/dist/cli.d.ts +10 -10
  120. package/dist/cli.js +36 -36
  121. package/dist/compounding/engine.d.ts +2 -2
  122. package/dist/compounding/engine.js +7 -7
  123. package/dist/compounding/preference-consolidator.d.ts +1 -1
  124. package/dist/compression-optimizer.d.ts +1 -1
  125. package/dist/config.d.ts +1 -1
  126. package/dist/config.js +1 -1
  127. package/dist/connectors/codex-materialize-runner.d.ts +1 -1
  128. package/dist/connectors/codex-materialize-runner.js +6 -6
  129. package/dist/connectors/codex-materialize.d.ts +1 -1
  130. package/dist/connectors/index.d.ts +1 -1
  131. package/dist/connectors/index.js +7 -7
  132. package/dist/consolidation-provenance-check.d.ts +2 -2
  133. package/dist/consolidation-undo.d.ts +2 -2
  134. package/dist/contradiction/index.d.ts +2 -2
  135. package/dist/contradiction/index.js +2 -2
  136. package/dist/{contradiction-scan-RJBABNRH.js → contradiction-scan-HMF7CNKD.js} +3 -3
  137. package/dist/conversation-index/backend.d.ts +1 -1
  138. package/dist/conversation-index/chunker.d.ts +1 -1
  139. package/dist/conversation-index/faiss-adapter.d.ts +1 -1
  140. package/dist/conversation-index/indexer.d.ts +1 -1
  141. package/dist/conversation-index/search.d.ts +1 -1
  142. package/dist/day-summary.d.ts +1 -1
  143. package/dist/day-summary.js +2 -2
  144. package/dist/delinearize.d.ts +1 -1
  145. package/dist/direct-answer-wiring.d.ts +1 -1
  146. package/dist/direct-answer.d.ts +1 -1
  147. package/dist/embedding-fallback.d.ts +1 -1
  148. package/dist/embedding-fallback.js +2 -2
  149. package/dist/enrichment/index.d.ts +1 -1
  150. package/dist/entity-retrieval.d.ts +2 -2
  151. package/dist/entity-retrieval.js +6 -6
  152. package/dist/entity-schema.d.ts +1 -1
  153. package/dist/explicit-capture.d.ts +6 -6
  154. package/dist/explicit-capture.js +2 -2
  155. package/dist/extraction-faithfulness.d.ts +1 -1
  156. package/dist/extraction-judge-telemetry.d.ts +1 -1
  157. package/dist/extraction-judge-training.d.ts +1 -1
  158. package/dist/extraction-judge.d.ts +1 -1
  159. package/dist/extraction.d.ts +1 -1
  160. package/dist/extraction.js +4 -4
  161. package/dist/fallback-llm.d.ts +1 -1
  162. package/dist/{first-start-migration-CSRHCJIQ.js → first-start-migration-LEXL3XYL.js} +2 -2
  163. package/dist/graph-dashboard-diff.d.ts +1 -1
  164. package/dist/graph-dashboard-key.d.ts +1 -1
  165. package/dist/graph-dashboard-parser.d.ts +1 -1
  166. package/dist/graph-edge-reinforcement.d.ts +1 -1
  167. package/dist/graph-snapshot.d.ts +1 -1
  168. package/dist/graph.d.ts +1 -1
  169. package/dist/importance.d.ts +1 -1
  170. package/dist/importers/index.d.ts +1 -1
  171. package/dist/in-flight-reads.d.ts +1 -1
  172. package/dist/index.d.ts +420 -420
  173. package/dist/index.js +52 -52
  174. package/dist/intent.d.ts +1 -1
  175. package/dist/lcm/engine.d.ts +1 -1
  176. package/dist/lcm/index.d.ts +1 -1
  177. package/dist/lcm/tools.d.ts +1 -1
  178. package/dist/lifecycle.d.ts +1 -1
  179. package/dist/live-connectors-runner.d.ts +1 -1
  180. package/dist/local-llm.d.ts +1 -1
  181. package/dist/local-llm.js +2 -2
  182. package/dist/local-model-endpoint.d.ts +1 -1
  183. package/dist/maintenance/memory-governance.d.ts +1 -1
  184. package/dist/maintenance/memory-governance.js +6 -6
  185. package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +2 -2
  186. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +6 -6
  187. package/dist/maintenance/rebuild-memory-projection.d.ts +26 -8
  188. package/dist/maintenance/rebuild-memory-projection.js +7 -7
  189. package/dist/mcp-memory-inspector-app.d.ts +8 -8
  190. package/dist/memory-action-policy.d.ts +1 -1
  191. package/dist/memory-cache.d.ts +1 -1
  192. package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
  193. package/dist/memory-projection-store.d.ts +3 -2
  194. package/dist/memory-projection-store.js +3 -1
  195. package/dist/memory-provenance.d.ts +1 -1
  196. package/dist/memory-worth-outcomes.d.ts +2 -2
  197. package/dist/models-json.d.ts +1 -1
  198. package/dist/namespaces/migrate.d.ts +3 -3
  199. package/dist/namespaces/migrate.js +10 -10
  200. package/dist/namespaces/principal.d.ts +1 -1
  201. package/dist/namespaces/principal.js +2 -2
  202. package/dist/namespaces/search.d.ts +1 -1
  203. package/dist/namespaces/search.js +4 -4
  204. package/dist/namespaces/storage.d.ts +3 -3
  205. package/dist/namespaces/storage.js +6 -6
  206. package/dist/native-knowledge.d.ts +1 -1
  207. package/dist/offline-sync-impression-drain.d.ts +1 -1
  208. package/dist/offline-sync-impression-drain.js +4 -4
  209. package/dist/operator-toolkit.d.ts +2 -2
  210. package/dist/operator-toolkit.js +16 -16
  211. package/dist/orchestration/compression-guideline-coordinator.d.ts +2 -2
  212. package/dist/orchestration/compression-guideline-coordinator.js +2 -2
  213. package/dist/orchestration/maintenance.d.ts +4 -3
  214. package/dist/orchestration/maintenance.js +15 -11
  215. package/dist/{orchestrator-CplS9U3U.d.ts → orchestrator-B8ickLkd.d.ts} +5 -5
  216. package/dist/orchestrator.d.ts +6 -6
  217. package/dist/orchestrator.js +52 -52
  218. package/dist/patterns-cli.d.ts +1 -1
  219. package/dist/{pipeline-DB4CbFqo.d.ts → pipeline-B669unGm.d.ts} +1 -1
  220. package/dist/policy-runtime.d.ts +1 -1
  221. package/dist/proactive-contention.d.ts +1 -1
  222. package/dist/provenance.d.ts +1 -1
  223. package/dist/{purge-IRF47ZTX.js → purge-YSGX5BOG.js} +2 -2
  224. package/dist/{qmd-BxZmOLHq.d.ts → qmd-D0PVXmea.d.ts} +1 -1
  225. package/dist/qmd-preflight.d.ts +2 -2
  226. package/dist/qmd-recall-cache.d.ts +1 -1
  227. package/dist/qmd.d.ts +2 -2
  228. package/dist/recall-concurrency-config.d.ts +1 -1
  229. package/dist/recall-disclosure-escalation.d.ts +1 -1
  230. package/dist/recall-explain-renderer.d.ts +1 -1
  231. package/dist/recall-explain-renderer.js +3 -3
  232. package/dist/recall-memory-map.d.ts +1 -1
  233. package/dist/recall-planner-llm.d.ts +1 -1
  234. package/dist/recall-state.d.ts +1 -1
  235. package/dist/recall-tag-filter.d.ts +1 -1
  236. package/dist/recall-timings.d.ts +1 -1
  237. package/dist/recall-xray-cli.d.ts +1 -1
  238. package/dist/recall-xray-cli.js +4 -4
  239. package/dist/recall-xray-renderer.d.ts +1 -1
  240. package/dist/recall-xray-renderer.js +3 -3
  241. package/dist/recall-xray.d.ts +1 -1
  242. package/dist/recall-xray.js +2 -2
  243. package/dist/replay/normalizers/chatgpt.d.ts +1 -1
  244. package/dist/replay/normalizers/claude.d.ts +1 -1
  245. package/dist/replay/normalizers/openclaw.d.ts +1 -1
  246. package/dist/replay/normalizers/shared.d.ts +1 -1
  247. package/dist/replay/runner.d.ts +1 -1
  248. package/dist/replay/types.d.ts +1 -1
  249. package/dist/resolve-auth-token.d.ts +1 -1
  250. package/dist/resume-bundles.js +2 -2
  251. package/dist/retrieval-agents.d.ts +2 -2
  252. package/dist/retrieval-tiers.d.ts +1 -1
  253. package/dist/routing/engine.d.ts +1 -1
  254. package/dist/routing/store.d.ts +1 -1
  255. package/dist/salvage-envelope.d.ts +1 -1
  256. package/dist/schemas.d.ts +76 -76
  257. package/dist/{scope-profiles-NsQQo1Lt.d.ts → scope-profiles-BOp3gSzp.d.ts} +1 -1
  258. package/dist/search/embed-helper.d.ts +1 -1
  259. package/dist/search/embed-helper.js +2 -2
  260. package/dist/search/factory.d.ts +1 -1
  261. package/dist/search/factory.js +3 -3
  262. package/dist/search/index.d.ts +1 -1
  263. package/dist/search/index.js +3 -3
  264. package/dist/search/lancedb-backend.d.ts +1 -1
  265. package/dist/search/meilisearch-backend.d.ts +1 -1
  266. package/dist/search/noop-backend.d.ts +1 -1
  267. package/dist/search/orama-backend.d.ts +1 -1
  268. package/dist/search/port.d.ts +1 -1
  269. package/dist/search/remote-backend.d.ts +1 -1
  270. package/dist/{semantic-consolidation-DW85h30n.d.ts → semantic-consolidation-C7SZNzUJ.d.ts} +1 -1
  271. package/dist/semantic-consolidation.d.ts +2 -2
  272. package/dist/semantic-consolidation.js +7 -7
  273. package/dist/semantic-rule-promotion.js +6 -6
  274. package/dist/semantic-rule-verifier.d.ts +1 -1
  275. package/dist/semantic-rule-verifier.js +6 -6
  276. package/dist/session-observer-bands.d.ts +1 -1
  277. package/dist/session-observer-state.d.ts +1 -1
  278. package/dist/shared-context/manager.d.ts +11 -11
  279. package/dist/shared-context/manager.js +2 -2
  280. package/dist/signal.d.ts +1 -1
  281. package/dist/{storage-o5BTAa8d.d.ts → storage-CJ_Fia4H.d.ts} +1 -1
  282. package/dist/storage-guards.d.ts +6 -2
  283. package/dist/storage-guards.js +3 -1
  284. package/dist/storage.d.ts +2 -2
  285. package/dist/storage.js +5 -5
  286. package/dist/summarizer.d.ts +1 -1
  287. package/dist/summarizer.js +3 -3
  288. package/dist/summary-snapshot.d.ts +1 -1
  289. package/dist/temporal-supersession.d.ts +2 -2
  290. package/dist/temporal-timeline-recall.d.ts +1 -1
  291. package/dist/temporal-validity.d.ts +1 -1
  292. package/dist/threading.d.ts +1 -1
  293. package/dist/tier-migration.d.ts +2 -2
  294. package/dist/tier-routing.d.ts +1 -1
  295. package/dist/{tier-stats-QEJSPFV2.js → tier-stats-XKD7SXYY.js} +2 -2
  296. package/dist/topics.d.ts +1 -1
  297. package/dist/transcript.d.ts +1 -1
  298. package/dist/transfer/types.d.ts +66 -66
  299. package/dist/trust-score-stage.d.ts +1 -1
  300. package/dist/trust-score.d.ts +1 -1
  301. package/dist/{types-V3dT-pen.d.ts → types-GeWGXq9E.d.ts} +18 -0
  302. package/dist/types.d.ts +1 -1
  303. package/dist/types.js +1 -1
  304. package/dist/utility-runtime.d.ts +1 -1
  305. package/dist/verified-recall.js +6 -6
  306. package/dist/write-envelope.d.ts +1 -1
  307. package/package.json +2 -2
  308. package/src/capabilities.test.ts +1 -0
  309. package/src/capabilities.ts +4 -1
  310. package/src/config.test.ts +33 -0
  311. package/src/config.ts +7 -3
  312. package/src/maintenance/projection-support.ts +56 -0
  313. package/src/maintenance/rebuild-memory-lifecycle-ledger.ts +2 -7
  314. package/src/maintenance/rebuild-memory-projection.ts +7 -10
  315. package/src/memory-projection-store.ts +1 -1
  316. package/src/orchestration/maintenance.test.ts +116 -0
  317. package/src/orchestration/maintenance.ts +16 -0
  318. package/src/orchestration/projection-rebuild-schedule.ts +115 -0
  319. package/src/storage-guards.ts +19 -2
  320. package/src/storage-memory-lifecycle-ledger.test.ts +32 -0
  321. package/src/storage.ts +15 -1
  322. package/src/testing/subjects/memory-projection.test.ts +78 -0
  323. package/src/types.ts +20 -0
  324. package/dist/chunk-2OH3ZRYH.js.map +0 -1
  325. package/dist/chunk-347WD2LE.js.map +0 -1
  326. package/dist/chunk-7YJLCNPF.js.map +0 -1
  327. package/dist/chunk-BCNVNUQG.js.map +0 -1
  328. package/dist/chunk-F7BWFIDK.js.map +0 -1
  329. package/dist/chunk-LMVAIZR5.js.map +0 -1
  330. package/dist/chunk-N7DK67GZ.js.map +0 -1
  331. package/dist/chunk-SCCO46KZ.js.map +0 -1
  332. package/dist/chunk-V57NLO5P.js.map +0 -1
  333. /package/dist/{chunk-BV5WMSIJ.js.map → chunk-2AJ72VVS.js.map} +0 -0
  334. /package/dist/{chunk-755Q3DGF.js.map → chunk-2H7OEVPO.js.map} +0 -0
  335. /package/dist/{chunk-TG6IHVE2.js.map → chunk-354T54RR.js.map} +0 -0
  336. /package/dist/{chunk-KGKYTCDO.js.map → chunk-3LZSS77C.js.map} +0 -0
  337. /package/dist/{chunk-EA2H5LML.js.map → chunk-44DUJETW.js.map} +0 -0
  338. /package/dist/{chunk-WQ2I6ODB.js.map → chunk-5MFHOX5T.js.map} +0 -0
  339. /package/dist/{chunk-JECBQBEX.js.map → chunk-B7GROTXD.js.map} +0 -0
  340. /package/dist/{chunk-6WAFYNVT.js.map → chunk-BJJAX3IZ.js.map} +0 -0
  341. /package/dist/{chunk-IZHXSLO7.js.map → chunk-CH3BRJ3P.js.map} +0 -0
  342. /package/dist/{chunk-L3HAUO7K.js.map → chunk-D5H3B36B.js.map} +0 -0
  343. /package/dist/{chunk-AWT7SCWQ.js.map → chunk-DQCUBRTZ.js.map} +0 -0
  344. /package/dist/{chunk-WIUYMCPL.js.map → chunk-DR65EEXG.js.map} +0 -0
  345. /package/dist/{chunk-7LXSPIVG.js.map → chunk-EZFVVEQG.js.map} +0 -0
  346. /package/dist/{chunk-S2FSBU4H.js.map → chunk-FCCMFVS6.js.map} +0 -0
  347. /package/dist/{chunk-QDTEH6BS.js.map → chunk-HCNG42P3.js.map} +0 -0
  348. /package/dist/{chunk-7ON2JW73.js.map → chunk-IKMAO55B.js.map} +0 -0
  349. /package/dist/{chunk-B57BIBXI.js.map → chunk-IU3XJAQM.js.map} +0 -0
  350. /package/dist/{chunk-RFDD3B7W.js.map → chunk-JGUXPJUQ.js.map} +0 -0
  351. /package/dist/{chunk-KQED7RCV.js.map → chunk-KOFVOVJG.js.map} +0 -0
  352. /package/dist/{chunk-7PK4W4RN.js.map → chunk-KUF7OIFK.js.map} +0 -0
  353. /package/dist/{chunk-QCLQ4BGA.js.map → chunk-MJYYXODM.js.map} +0 -0
  354. /package/dist/{chunk-C2RMQRPN.js.map → chunk-MLW3J7IC.js.map} +0 -0
  355. /package/dist/{chunk-7VZWZVYG.js.map → chunk-MQVINOJQ.js.map} +0 -0
  356. /package/dist/{chunk-52EFQMQC.js.map → chunk-OOJQ6ID5.js.map} +0 -0
  357. /package/dist/{chunk-BIRPR5N7.js.map → chunk-Q55XM4SU.js.map} +0 -0
  358. /package/dist/{chunk-7O2C2OOF.js.map → chunk-QEEMLGCO.js.map} +0 -0
  359. /package/dist/{chunk-ANEUPF6O.js.map → chunk-QH6CS6XJ.js.map} +0 -0
  360. /package/dist/{chunk-BGBPDAIN.js.map → chunk-RPOOJPMB.js.map} +0 -0
  361. /package/dist/{chunk-I6ODVWQB.js.map → chunk-S5HCKQ7Q.js.map} +0 -0
  362. /package/dist/{chunk-QDNE35FU.js.map → chunk-SB4OKS6C.js.map} +0 -0
  363. /package/dist/{chunk-B6NCHYAK.js.map → chunk-SQEDDWAM.js.map} +0 -0
  364. /package/dist/{chunk-K2B2TMF3.js.map → chunk-U7D5HWNG.js.map} +0 -0
  365. /package/dist/{chunk-XSBUROEB.js.map → chunk-UGH6VPPO.js.map} +0 -0
  366. /package/dist/{chunk-G2WCVFDC.js.map → chunk-UVSDFM7R.js.map} +0 -0
  367. /package/dist/{chunk-AFH7PIFU.js.map → chunk-VSVX777Y.js.map} +0 -0
  368. /package/dist/{chunk-B6P3QDBF.js.map → chunk-W3DJOT22.js.map} +0 -0
  369. /package/dist/{chunk-AE7WMV4V.js.map → chunk-WMLHJ5UW.js.map} +0 -0
  370. /package/dist/{chunk-GBT4TFV7.js.map → chunk-X6E5WAGX.js.map} +0 -0
  371. /package/dist/{chunk-VZC7ORJE.js.map → chunk-X7GOH7Y6.js.map} +0 -0
  372. /package/dist/{chunk-6QYST5XN.js.map → chunk-XY7QPJDA.js.map} +0 -0
  373. /package/dist/{chunk-WIS5JTJR.js.map → chunk-Y4JHE2ML.js.map} +0 -0
  374. /package/dist/{chunk-SESF64QR.js.map → chunk-YUWFASAK.js.map} +0 -0
  375. /package/dist/{chunk-BZ52BJ6C.js.map → chunk-YWJBAHTY.js.map} +0 -0
  376. /package/dist/{contradiction-scan-RJBABNRH.js.map → contradiction-scan-HMF7CNKD.js.map} +0 -0
  377. /package/dist/{first-start-migration-CSRHCJIQ.js.map → first-start-migration-LEXL3XYL.js.map} +0 -0
  378. /package/dist/{purge-IRF47ZTX.js.map → purge-YSGX5BOG.js.map} +0 -0
  379. /package/dist/{tier-stats-QEJSPFV2.js.map → tier-stats-XKD7SXYY.js.map} +0 -0
@@ -23,11 +23,11 @@ import {
23
23
  import {
24
24
  assertMemoryFrontmatterId,
25
25
  warnProjectionFallback
26
- } from "./chunk-V57NLO5P.js";
26
+ } from "./chunk-HKF5VASQ.js";
27
27
  import {
28
28
  SPECULATIVE_TTL_DAYS,
29
29
  confidenceTier
30
- } from "./chunk-N7DK67GZ.js";
30
+ } from "./chunk-WYL5ODHJ.js";
31
31
  import {
32
32
  appendLifecycleEventsSerialized,
33
33
  drainPendingLifecycleLedgerForSync,
@@ -60,12 +60,13 @@ import {
60
60
  } from "./chunk-SCU65EZI.js";
61
61
  import {
62
62
  markProjectedMemoryPathInvalid,
63
+ openProjectionReadonly,
63
64
  readProjectedGovernanceRecord,
64
65
  readProjectedMemoryBrowse,
65
66
  readProjectedMemoryState,
66
67
  readProjectedMemoryTimeline,
67
68
  updateProjectedMemoryPath
68
- } from "./chunk-347WD2LE.js";
69
+ } from "./chunk-3CSX3ETE.js";
69
70
  import {
70
71
  rotateMarkdownFileToArchive
71
72
  } from "./chunk-DM2T26WE.js";
@@ -141,7 +142,7 @@ import {
141
142
  } from "./chunk-P7FMDTKL.js";
142
143
  import {
143
144
  resolveNamespaceCapabilities
144
- } from "./chunk-SCCO46KZ.js";
145
+ } from "./chunk-RDQGLJRR.js";
145
146
  import {
146
147
  isPathInsideStorageRoot
147
148
  } from "./chunk-FF4KLI5W.js";
@@ -167,6 +168,29 @@ import {
167
168
  log
168
169
  } from "./chunk-3WCASNQZ.js";
169
170
 
171
+ // src/maintenance/projection-support.ts
172
+ import path from "path";
173
+ function readProjectionRebuiltAt(memoryDir) {
174
+ const db = openProjectionReadonly(memoryDir);
175
+ if (!db) return null;
176
+ try {
177
+ const row = db.prepare("SELECT value FROM meta WHERE key = 'rebuiltAt'").get();
178
+ return typeof row?.value === "string" && row.value.length > 0 ? row.value : null;
179
+ } catch {
180
+ return null;
181
+ } finally {
182
+ db.close();
183
+ }
184
+ }
185
+ function assertInjectedStorageRooted(label, memoryDir, injected) {
186
+ if (injected && path.resolve(injected.dir) !== path.resolve(memoryDir)) {
187
+ throw new Error(
188
+ `${label}: storage.dir (${injected.dir}) must match memoryDir (${memoryDir})`
189
+ );
190
+ }
191
+ return injected;
192
+ }
193
+
170
194
  // src/storage.ts
171
195
  import {
172
196
  lstat as lstat2,
@@ -182,11 +206,11 @@ import {
182
206
  } from "fs/promises";
183
207
  import { appendFileSync, createReadStream, mkdirSync, readFileSync, statSync } from "fs";
184
208
  import { createHash as createHash4 } from "crypto";
185
- import path7 from "path";
209
+ import path8 from "path";
186
210
 
187
211
  // src/storage/memory-read-store.ts
188
212
  import { lstat, readdir, realpath, stat } from "fs/promises";
189
- import path from "path";
213
+ import path2 from "path";
190
214
  var MemoryReadStore = class {
191
215
  constructor(deps) {
192
216
  this.deps = deps;
@@ -214,7 +238,7 @@ var MemoryReadStore = class {
214
238
  if (!/^[a-z][a-z0-9-]{0,63}$/.test(source)) continue;
215
239
  let entries;
216
240
  try {
217
- entries = await readdir(path.join(this.deps.wearablesDir, source));
241
+ entries = await readdir(path2.join(this.deps.wearablesDir, source));
218
242
  } catch (err) {
219
243
  if (err.code === "ENOENT") continue;
220
244
  throw err;
@@ -245,7 +269,7 @@ var MemoryReadStore = class {
245
269
  try {
246
270
  const entries = await readdir(dir, { withFileTypes: true });
247
271
  for (const entry of entries) {
248
- const fullPath = path.join(dir, entry.name);
272
+ const fullPath = path2.join(dir, entry.name);
249
273
  if (entry.isDirectory()) {
250
274
  await readDir(fullPath);
251
275
  continue;
@@ -297,7 +321,7 @@ var MemoryReadStore = class {
297
321
  const subdirs = [];
298
322
  for (const entry of entries) {
299
323
  if (entry.isSymbolicLink()) continue;
300
- const fullPath = path.join(dir, entry.name);
324
+ const fullPath = path2.join(dir, entry.name);
301
325
  if (entry.isDirectory()) {
302
326
  subdirs.push(fullPath);
303
327
  } else if (entry.name.endsWith(".md")) {
@@ -313,7 +337,7 @@ var MemoryReadStore = class {
313
337
  }
314
338
  };
315
339
  for (const dir of RECALL_FALLBACK_DIRS) {
316
- await collectPaths(path.join(this.deps.baseDir, dir));
340
+ await collectPaths(path2.join(this.deps.baseDir, dir));
317
341
  }
318
342
  return filePaths;
319
343
  }
@@ -393,7 +417,7 @@ var MemoryReadStore = class {
393
417
  const entries = await readdir(dir, { withFileTypes: true });
394
418
  const subdirs = [];
395
419
  for (const entry of entries) {
396
- const fullPath = path.join(dir, entry.name);
420
+ const fullPath = path2.join(dir, entry.name);
397
421
  if (entry.isDirectory()) {
398
422
  subdirs.push(fullPath);
399
423
  } else if (entry.name.endsWith(".md")) {
@@ -427,11 +451,11 @@ var MemoryReadStore = class {
427
451
  content: parsed.content
428
452
  };
429
453
  }
430
- const normalizedPath = filePath.split(path.sep).join("/");
454
+ const normalizedPath = filePath.split(path2.sep).join("/");
431
455
  if (normalizedPath.includes("/entities/") && filePath.endsWith(".md")) {
432
456
  const entity = parseEntityFile(raw, this.deps.entitySchemas);
433
457
  if (!entity.name) return null;
434
- const nameWithoutExt = path.basename(filePath, ".md");
458
+ const nameWithoutExt = path2.basename(filePath, ".md");
435
459
  const fileMtime = entity.updated || await stat(filePath).then((s) => s.mtime.toISOString()).catch(() => (/* @__PURE__ */ new Date(0)).toISOString());
436
460
  return {
437
461
  path: filePath,
@@ -615,7 +639,7 @@ var MemoryReadStore = class {
615
639
  const questions = [];
616
640
  for (const file of files) {
617
641
  if (!file.endsWith(".md")) continue;
618
- const filePath = path.join(this.deps.questionsDir, file);
642
+ const filePath = path2.join(this.deps.questionsDir, file);
619
643
  const raw = await readMaybeEncryptedFile(filePath, this.deps._secureStoreKey, this.deps.baseDir);
620
644
  const parsed = this.deps.parseQuestionFile(raw, filePath);
621
645
  if (parsed) {
@@ -652,7 +676,7 @@ function selfDeps(self) {
652
676
 
653
677
  // src/storage/entity-store.ts
654
678
  import { readdir as readdir2, unlink } from "fs/promises";
655
- import path2 from "path";
679
+ import path3 from "path";
656
680
  var EntityStore = class {
657
681
  constructor(deps) {
658
682
  this.deps = deps;
@@ -680,7 +704,7 @@ var EntityStore = class {
680
704
  log.debug(`fuzzy match: "${normalized}" \u2192 existing "${match}"`);
681
705
  normalized = match;
682
706
  }
683
- const filePath = path2.join(this.deps.entitiesDir, `${normalized}.md`);
707
+ const filePath = path3.join(this.deps.entitiesDir, `${normalized}.md`);
684
708
  let entity = {
685
709
  name,
686
710
  type,
@@ -791,7 +815,7 @@ var EntityStore = class {
791
815
  * Set or rewrite the synthesis layer of an entity file.
792
816
  */
793
817
  async updateEntitySynthesis(name, synthesis, options = {}) {
794
- const filePath = path2.join(this.deps.entitiesDir, `${name}.md`);
818
+ const filePath = path3.join(this.deps.entitiesDir, `${name}.md`);
795
819
  let entity;
796
820
  try {
797
821
  const content = await this.deps.readStorageSecureFile(filePath);
@@ -843,7 +867,7 @@ var EntityStore = class {
843
867
  const results = await Promise.all(
844
868
  batch.map(async (entry) => {
845
869
  try {
846
- return await this.deps.readStorageSecureFile(path2.join(this.deps.entitiesDir, entry));
870
+ return await this.deps.readStorageSecureFile(path3.join(this.deps.entitiesDir, entry));
847
871
  } catch (err) {
848
872
  if (err instanceof SecureStoreLockedError) throw err;
849
873
  if (!isErrnoCode(err, "ENOENT")) throw err;
@@ -956,7 +980,7 @@ ${rows.join("\n")}
956
980
  extraSections: []
957
981
  };
958
982
  for (const file of files) {
959
- const filePath = path2.join(this.deps.entitiesDir, file);
983
+ const filePath = path3.join(this.deps.entitiesDir, file);
960
984
  try {
961
985
  const content = await this.deps.readStorageSecureFile(filePath);
962
986
  const parsed = parseEntityFile(content, this.deps.entitySchemas);
@@ -1087,10 +1111,10 @@ ${rows.join("\n")}
1087
1111
  }
1088
1112
  mergedEntity.created = mergedEntity.created || mergedEntity.updated || (/* @__PURE__ */ new Date()).toISOString();
1089
1113
  mergedEntity.updated = mergedEntity.updated || (/* @__PURE__ */ new Date()).toISOString();
1090
- const canonicalPath = path2.join(this.deps.entitiesDir, `${canonical}.md`);
1114
+ const canonicalPath = path3.join(this.deps.entitiesDir, `${canonical}.md`);
1091
1115
  await this.deps.writeStorageSecureFile(canonicalPath, serializeEntityFile(mergedEntity, this.deps.entitySchemas));
1092
1116
  for (const file of files) {
1093
- const filePath = path2.join(this.deps.entitiesDir, file);
1117
+ const filePath = path3.join(this.deps.entitiesDir, file);
1094
1118
  if (filePath !== canonicalPath) {
1095
1119
  try {
1096
1120
  await unlink(filePath);
@@ -1110,7 +1134,7 @@ ${rows.join("\n")}
1110
1134
 
1111
1135
  // src/storage/identity-continuity-store.ts
1112
1136
  import { readdir as readdir3 } from "fs/promises";
1113
- import path3 from "path";
1137
+ import path4 from "path";
1114
1138
  var IdentityContinuityStore = class {
1115
1139
  constructor(deps) {
1116
1140
  this.deps = deps;
@@ -1135,7 +1159,7 @@ var IdentityContinuityStore = class {
1135
1159
  const date = nowIso.slice(0, 10);
1136
1160
  const id = this.deps.generateId("incident");
1137
1161
  const incident = createContinuityIncidentRecord(id, input, nowIso);
1138
- const filePath = path3.join(this.deps.identityIncidentsDir, `${date}-${id}.md`);
1162
+ const filePath = path4.join(this.deps.identityIncidentsDir, `${date}-${id}.md`);
1139
1163
  await this.deps.writeStorageSecureFile(filePath, serializeContinuityIncident(incident));
1140
1164
  return { ...incident, filePath };
1141
1165
  }
@@ -1148,7 +1172,7 @@ var IdentityContinuityStore = class {
1148
1172
  const incidents = [];
1149
1173
  for (const file of candidates) {
1150
1174
  if (incidents.length >= cappedLimit) break;
1151
- const filePath = path3.join(this.deps.identityIncidentsDir, file);
1175
+ const filePath = path4.join(this.deps.identityIncidentsDir, file);
1152
1176
  try {
1153
1177
  const raw = await this.deps.readStorageSecureFile(filePath);
1154
1178
  const parsed = parseContinuityIncident(raw);
@@ -1179,7 +1203,7 @@ var IdentityContinuityStore = class {
1179
1203
  await this.deps.ensureDirectories();
1180
1204
  const safeKey = this.sanitizeIdentityAuditKey(key);
1181
1205
  const dir = period === "weekly" ? this.deps.identityAuditsWeeklyDir : this.deps.identityAuditsMonthlyDir;
1182
- const filePath = path3.join(dir, `${safeKey}.md`);
1206
+ const filePath = path4.join(dir, `${safeKey}.md`);
1183
1207
  await this.deps.writeStorageSecureFile(filePath, content);
1184
1208
  return filePath;
1185
1209
  }
@@ -1187,7 +1211,7 @@ var IdentityContinuityStore = class {
1187
1211
  try {
1188
1212
  const safeKey = this.sanitizeIdentityAuditKey(key);
1189
1213
  const dir = period === "weekly" ? this.deps.identityAuditsWeeklyDir : this.deps.identityAuditsMonthlyDir;
1190
- return await this.deps.readStorageSecureFile(path3.join(dir, `${safeKey}.md`));
1214
+ return await this.deps.readStorageSecureFile(path4.join(dir, `${safeKey}.md`));
1191
1215
  } catch (err) {
1192
1216
  if (err instanceof Error && err.message === "Invalid identity audit key") return null;
1193
1217
  if (!isErrnoCode(err, "ENOENT")) throw err;
@@ -1243,12 +1267,12 @@ var IdentityContinuityStore = class {
1243
1267
  const fileNames = await this.readContinuityIncidentFileNames();
1244
1268
  const directMatch = fileNames.find((name) => name.endsWith(`-${id}.md`));
1245
1269
  if (directMatch) {
1246
- const directPath = path3.join(this.deps.identityIncidentsDir, directMatch);
1270
+ const directPath = path4.join(this.deps.identityIncidentsDir, directMatch);
1247
1271
  const parsed = await this.readContinuityIncidentFile(directPath);
1248
1272
  if (parsed?.id === id) return directPath;
1249
1273
  }
1250
1274
  for (const fileName of fileNames) {
1251
- const filePath = path3.join(this.deps.identityIncidentsDir, fileName);
1275
+ const filePath = path4.join(this.deps.identityIncidentsDir, fileName);
1252
1276
  const parsed = await this.readContinuityIncidentFile(filePath);
1253
1277
  if (parsed?.id === id) return filePath;
1254
1278
  }
@@ -1278,9 +1302,9 @@ function decodeYamlScalar(value) {
1278
1302
  }
1279
1303
 
1280
1304
  // src/orchestration/qmd-result-resolver.ts
1281
- import path4 from "path";
1305
+ import path5 from "path";
1282
1306
  function qmdCollectionPathParts(resultPath) {
1283
- if (!resultPath || path4.isAbsolute(resultPath)) return null;
1307
+ if (!resultPath || path5.isAbsolute(resultPath)) return null;
1284
1308
  const normalized = resultPath.replace(/\\/g, "/").replace(/^\/+/, "");
1285
1309
  const slashIndex = normalized.indexOf("/");
1286
1310
  if (slashIndex <= 0 || slashIndex >= normalized.length - 1) return null;
@@ -1293,9 +1317,9 @@ function qmdCollectionPathParts(resultPath) {
1293
1317
  }
1294
1318
  function qmdResultPathCandidates(storageDir, resultPath) {
1295
1319
  const candidates = /* @__PURE__ */ new Set();
1296
- const storageRoot = path4.resolve(storageDir);
1320
+ const storageRoot = path5.resolve(storageDir);
1297
1321
  const addCandidate = (candidate) => {
1298
- const resolved = path4.resolve(candidate);
1322
+ const resolved = path5.resolve(candidate);
1299
1323
  if (isPathInsideStorageRoot(storageRoot, resolved)) {
1300
1324
  candidates.add(resolved);
1301
1325
  }
@@ -1303,18 +1327,18 @@ function qmdResultPathCandidates(storageDir, resultPath) {
1303
1327
  const addRelativeCandidates = (relativePath) => {
1304
1328
  const normalized = relativePath.replace(/\\/g, "/").replace(/^\/+/, "");
1305
1329
  if (!normalized) return;
1306
- addCandidate(path4.join(storageRoot, normalized));
1330
+ addCandidate(path5.join(storageRoot, normalized));
1307
1331
  if (/^\d{4}-\d{2}-\d{2}\//.test(normalized)) {
1308
- addCandidate(path4.join(storageRoot, "facts", normalized));
1332
+ addCandidate(path5.join(storageRoot, "facts", normalized));
1309
1333
  }
1310
1334
  };
1311
- if (path4.isAbsolute(resultPath)) {
1335
+ if (path5.isAbsolute(resultPath)) {
1312
1336
  addCandidate(resultPath);
1313
- const relative = path4.relative(storageRoot, path4.resolve(resultPath));
1314
- if (relative && !relative.startsWith("..") && !path4.isAbsolute(relative)) {
1315
- const normalized = relative.split(path4.sep).join("/");
1337
+ const relative = path5.relative(storageRoot, path5.resolve(resultPath));
1338
+ if (relative && !relative.startsWith("..") && !path5.isAbsolute(relative)) {
1339
+ const normalized = relative.split(path5.sep).join("/");
1316
1340
  if (/^\d{4}-\d{2}-\d{2}\//.test(normalized)) {
1317
- addCandidate(path4.join(storageRoot, "facts", normalized));
1341
+ addCandidate(path5.join(storageRoot, "facts", normalized));
1318
1342
  }
1319
1343
  }
1320
1344
  } else {
@@ -1349,7 +1373,7 @@ var QmdResultResolver = class {
1349
1373
  const seenStorageDirs = /* @__PURE__ */ new Set();
1350
1374
  const addStorage = (storage) => {
1351
1375
  const storageDir = storageDirOrNull(storage);
1352
- const storageKey = storageDir ? path4.resolve(storageDir) : `storage-without-dir-${storages.length}`;
1376
+ const storageKey = storageDir ? path5.resolve(storageDir) : `storage-without-dir-${storages.length}`;
1353
1377
  if (seenStorageDirs.has(storageKey)) return;
1354
1378
  seenStorageDirs.add(storageKey);
1355
1379
  storages.push(storage);
@@ -1379,7 +1403,7 @@ var QmdResultResolver = class {
1379
1403
  continue;
1380
1404
  }
1381
1405
  try {
1382
- const coldRoot = path4.join(storageDir, "cold");
1406
+ const coldRoot = path5.join(storageDir, "cold");
1383
1407
  for (const candidate of qmdResultPathCandidates(
1384
1408
  coldRoot,
1385
1409
  parts.relativePath
@@ -1438,9 +1462,9 @@ var QmdResultResolver = class {
1438
1462
  error: err.message
1439
1463
  });
1440
1464
  }
1441
- if (!path4.isAbsolute(resultPath)) return null;
1465
+ if (!path5.isAbsolute(resultPath)) return null;
1442
1466
  }
1443
- if (path4.isAbsolute(resultPath)) {
1467
+ if (path5.isAbsolute(resultPath)) {
1444
1468
  if (!fallbackStorageDir) {
1445
1469
  return await fallbackStorage.readMemoryByPath(resultPath);
1446
1470
  }
@@ -1480,7 +1504,7 @@ var QmdResultResolver = class {
1480
1504
  );
1481
1505
  if (!memory) return null;
1482
1506
  let ownerNamespace = null;
1483
- if (path4.isAbsolute(memory.path)) {
1507
+ if (path5.isAbsolute(memory.path)) {
1484
1508
  const ownerStorage = await this.storageForAbsoluteQmdResultPath(
1485
1509
  memory.path,
1486
1510
  fallbackStorage,
@@ -1504,17 +1528,17 @@ var QmdResultResolver = class {
1504
1528
  };
1505
1529
  }
1506
1530
  async storageForAbsoluteQmdResultPath(resultPath, fallbackStorage, recallNamespaces = []) {
1507
- const resolvedPath = path4.resolve(resultPath);
1531
+ const resolvedPath = path5.resolve(resultPath);
1508
1532
  const config = this.getConfig();
1509
- const memoryRoot = path4.resolve(config.memoryDir);
1510
- const namespacesRoot = path4.join(memoryRoot, "namespaces");
1533
+ const memoryRoot = path5.resolve(config.memoryDir);
1534
+ const namespacesRoot = path5.join(memoryRoot, "namespaces");
1511
1535
  const fallbackStorageDir = storageDirOrNull(fallbackStorage);
1512
1536
  const matches = [];
1513
1537
  const seenDirs = /* @__PURE__ */ new Set();
1514
1538
  const maybeAddStorage = (storage, namespace) => {
1515
1539
  const storageDir = storageDirOrNull(storage);
1516
1540
  if (!storageDir) return;
1517
- const candidateRoot = path4.resolve(storageDir);
1541
+ const candidateRoot = path5.resolve(storageDir);
1518
1542
  if (seenDirs.has(candidateRoot)) return;
1519
1543
  if (!isPathInsideStorageRoot(candidateRoot, resolvedPath)) return;
1520
1544
  if (candidateRoot === memoryRoot && isPathInsideStorageRoot(namespacesRoot, resolvedPath)) {
@@ -1532,7 +1556,7 @@ var QmdResultResolver = class {
1532
1556
  candidateNamespaces.add(ns);
1533
1557
  }
1534
1558
  if (isPathInsideStorageRoot(namespacesRoot, resolvedPath)) {
1535
- const relativeToNamespaces = path4.relative(namespacesRoot, resolvedPath);
1559
+ const relativeToNamespaces = path5.relative(namespacesRoot, resolvedPath);
1536
1560
  const [namespaceSegment] = relativeToNamespaces.split(/[\\/]/);
1537
1561
  if (namespaceSegment) {
1538
1562
  candidateNamespaces.add(
@@ -2181,7 +2205,7 @@ function fuseDay(date, inputs, options = {}) {
2181
2205
 
2182
2206
  // src/wearables/fusion/store.ts
2183
2207
  import { createHash as createHash2 } from "crypto";
2184
- import * as path5 from "path";
2208
+ import * as path6 from "path";
2185
2209
  var FUSION_KIND = "wearable-fusion";
2186
2210
  function hashFusionBody(conversations) {
2187
2211
  return createHash2("sha256").update(JSON.stringify(conversations), "utf-8").digest("hex");
@@ -2368,7 +2392,7 @@ var FusionArtifactStore = class {
2368
2392
  `invalid wearable fusion date '${String(date)}' \u2014 expected YYYY-MM-DD`
2369
2393
  );
2370
2394
  }
2371
- return path5.join(this.wearablesDir, FUSION_DIR_NAME, `${date}.md`);
2395
+ return path6.join(this.wearablesDir, FUSION_DIR_NAME, `${date}.md`);
2372
2396
  }
2373
2397
  async writeFusedDay(date, serialized) {
2374
2398
  const filePath = this.fusedDayPath(date);
@@ -2405,7 +2429,7 @@ var FusionArtifactStore = class {
2405
2429
  }
2406
2430
  /** List dates with stored fused artifacts, newest first. */
2407
2431
  async listFusedDays() {
2408
- const fusionDir = path5.join(this.wearablesDir, FUSION_DIR_NAME);
2432
+ const fusionDir = path6.join(this.wearablesDir, FUSION_DIR_NAME);
2409
2433
  await this.assertPathContained(fusionDir);
2410
2434
  let entries;
2411
2435
  try {
@@ -2449,10 +2473,10 @@ var FusionArtifactStore = class {
2449
2473
  try {
2450
2474
  rootReal = await this.io.realpath(this.memoryDir);
2451
2475
  } catch {
2452
- rootReal = path5.resolve(this.memoryDir);
2476
+ rootReal = path6.resolve(this.memoryDir);
2453
2477
  }
2454
2478
  await this.assertNoEscape(rootReal, this.wearablesDir);
2455
- await this.assertNoEscape(rootReal, path5.dirname(targetPath));
2479
+ await this.assertNoEscape(rootReal, path6.dirname(targetPath));
2456
2480
  await this.assertNoEscape(rootReal, targetPath);
2457
2481
  await this.assertFusionDirNotSymlinked();
2458
2482
  }
@@ -2466,7 +2490,7 @@ var FusionArtifactStore = class {
2466
2490
  * (a fresh write creates a real directory lexically under the root).
2467
2491
  */
2468
2492
  async assertFusionDirNotSymlinked() {
2469
- const fusionDir = path5.join(this.wearablesDir, FUSION_DIR_NAME);
2493
+ const fusionDir = path6.join(this.wearablesDir, FUSION_DIR_NAME);
2470
2494
  let stat4;
2471
2495
  try {
2472
2496
  stat4 = await this.io.lstat(fusionDir);
@@ -2996,7 +3020,7 @@ function isEntitySynthesisStale(entity) {
2996
3020
 
2997
3021
  // src/storage/content-hash-index.ts
2998
3022
  import { mkdir, stat as stat2 } from "fs/promises";
2999
- import path6 from "path";
3023
+ import path7 from "path";
3000
3024
  var CONTENT_HASH_INDEX_LOCK_STALE_MS = 3e4;
3001
3025
  var CONTENT_HASH_INDEX_RETRY_MAX_ATTEMPTS = 5;
3002
3026
  var CONTENT_HASH_INDEX_RETRY_BASE_MS = 500;
@@ -3056,8 +3080,8 @@ var ContentHashIndex = class _ContentHashIndex {
3056
3080
  * re-read on the hot path.
3057
3081
  */
3058
3082
  lastSyncedFingerprint = null;
3059
- constructor(stateDir, secureStoreKeyProvider = () => null, secureStoreWriteKeyProvider = secureStoreKeyProvider, memoryDir = path6.dirname(stateDir), lockOptions = {}) {
3060
- this.filePath = path6.join(stateDir, "fact-hashes.txt");
3083
+ constructor(stateDir, secureStoreKeyProvider = () => null, secureStoreWriteKeyProvider = secureStoreKeyProvider, memoryDir = path7.dirname(stateDir), lockOptions = {}) {
3084
+ this.filePath = path7.join(stateDir, "fact-hashes.txt");
3061
3085
  this.secureStoreKeyProvider = secureStoreKeyProvider;
3062
3086
  this.secureStoreWriteKeyProvider = secureStoreWriteKeyProvider;
3063
3087
  this.memoryDir = memoryDir;
@@ -3149,7 +3173,7 @@ var ContentHashIndex = class _ContentHashIndex {
3149
3173
  /** Persist index to disk if changed (plain whole-file overwrite). */
3150
3174
  async save() {
3151
3175
  if (!this.dirty) return;
3152
- await mkdir(path6.dirname(this.filePath), { recursive: true });
3176
+ await mkdir(path7.dirname(this.filePath), { recursive: true });
3153
3177
  const publishedAdded = new Set(this.added);
3154
3178
  const publishedRemoved = new Set(this.removed);
3155
3179
  const serialized = [...this.hashes].join("\n") + "\n";
@@ -3196,7 +3220,7 @@ var ContentHashIndex = class _ContentHashIndex {
3196
3220
  */
3197
3221
  async saveMergingWithDisk() {
3198
3222
  if (!this.dirty) return;
3199
- await mkdir(path6.dirname(this.filePath), { recursive: true });
3223
+ await mkdir(path7.dirname(this.filePath), { recursive: true });
3200
3224
  const publish = async () => {
3201
3225
  const publishedAdded = new Set(this.added);
3202
3226
  const publishedRemoved = new Set(this.removed);
@@ -3215,7 +3239,7 @@ var ContentHashIndex = class _ContentHashIndex {
3215
3239
  if (err instanceof SecureStoreLockedError) throw err;
3216
3240
  if (!isErrnoCode(err, "ENOENT")) throw err;
3217
3241
  }
3218
- await mkdir(path6.dirname(this.filePath), { recursive: true });
3242
+ await mkdir(path7.dirname(this.filePath), { recursive: true });
3219
3243
  await writeMaybeEncryptedFile(
3220
3244
  this.filePath,
3221
3245
  [...merged].join("\n") + "\n",
@@ -3282,7 +3306,7 @@ var ContentHashIndex = class _ContentHashIndex {
3282
3306
  * fired retry) simply yields `acquired=false` after the bounded wait.
3283
3307
  */
3284
3308
  async rebuildUnderLock(populate) {
3285
- await mkdir(path6.dirname(this.filePath), { recursive: true });
3309
+ await mkdir(path7.dirname(this.filePath), { recursive: true });
3286
3310
  let published = false;
3287
3311
  await withHeldFileLock(
3288
3312
  `${this.filePath}.lock`,
@@ -4083,17 +4107,17 @@ function inferEntityTypeFromContent(content) {
4083
4107
  }
4084
4108
  var KNOWN_ENTITY_FILENAME_PREFIXES = /* @__PURE__ */ new Set(["company", "other", "person", "place", "project", "tool", "topic"]);
4085
4109
  function inferEntityTypeFromFilename(pathRel) {
4086
- const basename = path7.basename(pathRel, ".md").toLowerCase();
4110
+ const basename = path8.basename(pathRel, ".md").toLowerCase();
4087
4111
  const separator = basename.indexOf("-");
4088
4112
  if (separator <= 0) return void 0;
4089
4113
  const candidate = basename.slice(0, separator);
4090
4114
  return KNOWN_ENTITY_FILENAME_PREFIXES.has(candidate) ? candidate : void 0;
4091
4115
  }
4092
4116
  function normalizeFrontmatterForPath(frontmatter, pathRel, content = "") {
4093
- const normalizedPath = pathRel.split(path7.sep).join("/");
4117
+ const normalizedPath = pathRel.split(path8.sep).join("/");
4094
4118
  let normalizedFrontmatter = frontmatter;
4095
4119
  if (normalizedPath === "entities" || normalizedPath.startsWith("entities/") || normalizedPath.includes("/entities/")) {
4096
- const basename = path7.basename(pathRel, ".md");
4120
+ const basename = path8.basename(pathRel, ".md");
4097
4121
  const inferredType = inferEntityTypeFromContent(content) || inferEntityTypeFromFilename(pathRel) || "entity";
4098
4122
  const existingTags = Array.isArray(frontmatter.tags) ? frontmatter.tags : [];
4099
4123
  normalizedFrontmatter = {
@@ -4759,8 +4783,8 @@ var StorageManager3 = class _StorageManager {
4759
4783
  }
4760
4784
  /** Whether `filePath` resolves to `stateDir` itself or a path contained in it. */
4761
4785
  isStateFilePath(filePath) {
4762
- const rel = path7.relative(this.stateDir, path7.resolve(filePath));
4763
- return rel === "" || !rel.startsWith("..") && !path7.isAbsolute(rel);
4786
+ const rel = path8.relative(this.stateDir, path8.resolve(filePath));
4787
+ return rel === "" || !rel.startsWith("..") && !path8.isAbsolute(rel);
4764
4788
  }
4765
4789
  // ── Tombstone store (issue #1579) ───────────────────────────────────────
4766
4790
  // Instance-scoped (rule 11) + namespace-scoped (rule 42) tombstone index.
@@ -4860,8 +4884,8 @@ var StorageManager3 = class _StorageManager {
4860
4884
  * /srv/cold/remnic), skipping the patch and stranding a stale hot entry.
4861
4885
  */
4862
4886
  isColdOrArchiveTierPath(p) {
4863
- const rel = path7.relative(this.baseDir, p);
4864
- return rel === "cold" || rel === "archive" || rel.startsWith(`cold${path7.sep}`) || rel.startsWith(`archive${path7.sep}`);
4887
+ const rel = path8.relative(this.baseDir, p);
4888
+ return rel === "cold" || rel === "archive" || rel.startsWith(`cold${path8.sep}`) || rel.startsWith(`archive${path8.sep}`);
4865
4889
  }
4866
4890
  /**
4867
4891
  * Mark the secure-store as required for this storage instance.
@@ -4948,7 +4972,7 @@ var StorageManager3 = class _StorageManager {
4948
4972
  void 0,
4949
4973
  this.baseDir
4950
4974
  );
4951
- const rel = path7.relative(this.baseDir, filePath).split(path7.sep).join("/");
4975
+ const rel = path8.relative(this.baseDir, filePath).split(path8.sep).join("/");
4952
4976
  return `${rel}:${version.versionId}`;
4953
4977
  } catch (err) {
4954
4978
  log.warn(
@@ -5028,13 +5052,13 @@ var StorageManager3 = class _StorageManager {
5028
5052
  }
5029
5053
  identityFilePath(workspaceDir, namespace) {
5030
5054
  const rawNamespace = typeof namespace === "string" ? namespace.trim() : "";
5031
- if (!rawNamespace) return path7.join(workspaceDir, "IDENTITY.md");
5055
+ if (!rawNamespace) return path8.join(workspaceDir, "IDENTITY.md");
5032
5056
  const safeNamespace = rawNamespace.replace(/[^a-zA-Z0-9._-]/g, "-");
5033
- return path7.join(workspaceDir, `IDENTITY.${safeNamespace}.md`);
5057
+ return path8.join(workspaceDir, `IDENTITY.${safeNamespace}.md`);
5034
5058
  }
5035
5059
  versionFilePath(kind) {
5036
5060
  const fileName = kind === "memory-status" ? ".memory-status-version.log" : kind === "artifact-write" ? ".artifact-write-version.log" : kind === "cold-write" ? ".cold-write-version.log" : ".memory-corpus-version.log";
5037
- return path7.join(this.stateDir, fileName);
5061
+ return path8.join(this.stateDir, fileName);
5038
5062
  }
5039
5063
  bumpSharedVersion(kind, fallbackMap) {
5040
5064
  const filePath = this.versionFilePath(kind);
@@ -5126,7 +5150,7 @@ var StorageManager3 = class _StorageManager {
5126
5150
  // memories.
5127
5151
  // -------------------------------------------------------------------------
5128
5152
  get wearablesDir() {
5129
- return path7.join(this.baseDir, WEARABLES_DIR_NAME);
5153
+ return path8.join(this.baseDir, WEARABLES_DIR_NAME);
5130
5154
  }
5131
5155
  /**
5132
5156
  * Resolve the on-disk path for a source/day transcript. Throws on
@@ -5142,7 +5166,7 @@ var StorageManager3 = class _StorageManager {
5142
5166
  if (!isValidTranscriptDate(date)) {
5143
5167
  throw new Error(`invalid wearable transcript date '${String(date)}' \u2014 expected YYYY-MM-DD`);
5144
5168
  }
5145
- return path7.join(this.wearablesDir, sourceId, `${date}.md`);
5169
+ return path8.join(this.wearablesDir, sourceId, `${date}.md`);
5146
5170
  }
5147
5171
  async writeWearableDayTranscript(sourceId, date, serialized) {
5148
5172
  const targetPath = this.wearableTranscriptPath(sourceId, date);
@@ -5240,25 +5264,25 @@ var StorageManager3 = class _StorageManager {
5240
5264
  });
5241
5265
  }
5242
5266
  get factsDir() {
5243
- return path7.join(this.baseDir, "facts");
5267
+ return path8.join(this.baseDir, "facts");
5244
5268
  }
5245
5269
  get correctionsDir() {
5246
- return path7.join(this.baseDir, "corrections");
5270
+ return path8.join(this.baseDir, "corrections");
5247
5271
  }
5248
5272
  get proceduresDir() {
5249
- return path7.join(this.baseDir, "procedures");
5273
+ return path8.join(this.baseDir, "procedures");
5250
5274
  }
5251
5275
  get reasoningTracesDir() {
5252
- return path7.join(this.baseDir, "reasoning-traces");
5276
+ return path8.join(this.baseDir, "reasoning-traces");
5253
5277
  }
5254
5278
  get entitiesDir() {
5255
- return path7.join(this.baseDir, "entities");
5279
+ return path8.join(this.baseDir, "entities");
5256
5280
  }
5257
5281
  resolveEntityFilePath(name) {
5258
5282
  if (typeof name !== "string") return null;
5259
- const filePath = path7.resolve(this.entitiesDir, `${name}.md`);
5260
- const relative = path7.relative(this.entitiesDir, filePath);
5261
- if (relative === "" || relative.startsWith("..") || path7.isAbsolute(relative)) {
5283
+ const filePath = path8.resolve(this.entitiesDir, `${name}.md`);
5284
+ const relative = path8.relative(this.entitiesDir, filePath);
5285
+ if (relative === "" || relative.startsWith("..") || path8.isAbsolute(relative)) {
5262
5286
  return null;
5263
5287
  }
5264
5288
  return filePath;
@@ -5279,10 +5303,10 @@ var StorageManager3 = class _StorageManager {
5279
5303
  });
5280
5304
  }
5281
5305
  assertManagedStoragePath(filePath, method) {
5282
- const resolved = path7.resolve(filePath);
5283
- const base = path7.resolve(this.baseDir);
5284
- const rel = path7.relative(base, resolved);
5285
- if (rel === "" || rel === ".." || rel.startsWith(`..${path7.sep}`) || path7.isAbsolute(rel)) {
5306
+ const resolved = path8.resolve(filePath);
5307
+ const base = path8.resolve(this.baseDir);
5308
+ const rel = path8.relative(base, resolved);
5309
+ if (rel === "" || rel === ".." || rel.startsWith(`..${path8.sep}`) || path8.isAbsolute(rel)) {
5286
5310
  throw new Error(`${method}: file path escapes memory dir`);
5287
5311
  }
5288
5312
  return resolved;
@@ -5294,7 +5318,7 @@ var StorageManager3 = class _StorageManager {
5294
5318
  async digestOfflineSyncFile(filePath) {
5295
5319
  const target = this.assertManagedStoragePath(filePath, "storage.digestOfflineSyncFile");
5296
5320
  const st = await stat3(target);
5297
- const relPath = path7.relative(this.baseDir, target).split(path7.sep).join("/");
5321
+ const relPath = path8.relative(this.baseDir, target).split(path8.sep).join("/");
5298
5322
  const cache = await this.loadOfflineSyncDigestCache();
5299
5323
  const cached = cache.get(relPath);
5300
5324
  if (cached && cached.statBytes === st.size && cached.mtimeMs === st.mtimeMs && cached.ctimeMs === st.ctimeMs && !cached.encrypted) {
@@ -5355,7 +5379,7 @@ var StorageManager3 = class _StorageManager {
5355
5379
  const bytes = typeof record.bytes === "number" ? record.bytes : NaN;
5356
5380
  const sha256 = typeof record.sha256 === "string" ? record.sha256 : "";
5357
5381
  const encrypted = record.encrypted === true;
5358
- if (cachePath.length === 0 || cachePath === ".." || cachePath.startsWith("../") || path7.isAbsolute(cachePath) || !Number.isFinite(statBytes) || !Number.isFinite(mtimeMs) || !Number.isFinite(ctimeMs) || !Number.isFinite(bytes) || !/^[a-f0-9]{64}$/i.test(sha256)) {
5382
+ if (cachePath.length === 0 || cachePath === ".." || cachePath.startsWith("../") || path8.isAbsolute(cachePath) || !Number.isFinite(statBytes) || !Number.isFinite(mtimeMs) || !Number.isFinite(ctimeMs) || !Number.isFinite(bytes) || !/^[a-f0-9]{64}$/i.test(sha256)) {
5359
5383
  continue;
5360
5384
  }
5361
5385
  cache.set(cachePath, { statBytes, mtimeMs, ctimeMs, encrypted, sha256, bytes });
@@ -5397,7 +5421,7 @@ var StorageManager3 = class _StorageManager {
5397
5421
  const cache = this.offlineSyncDigestCache;
5398
5422
  if (!cache) return;
5399
5423
  const entries = [...cache.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([entryPath, entry]) => ({ path: entryPath, ...entry }));
5400
- await mkdir2(path7.dirname(this.offlineSyncDigestCachePath), { recursive: true });
5424
+ await mkdir2(path8.dirname(this.offlineSyncDigestCachePath), { recursive: true });
5401
5425
  await writeFile(this.offlineSyncDigestCachePath, `${JSON.stringify({ version: 1, entries })}
5402
5426
  `, "utf-8");
5403
5427
  }).catch((err) => {
@@ -5442,10 +5466,10 @@ var StorageManager3 = class _StorageManager {
5442
5466
  this.invalidateAllMemoriesCache();
5443
5467
  this.invalidateKnowledgeIndexCache();
5444
5468
  this.factHashIndexAuthoritative = false;
5445
- if (filePath.includes(`${path7.sep}cold${path7.sep}`)) {
5469
+ if (filePath.includes(`${path8.sep}cold${path8.sep}`)) {
5446
5470
  this.invalidateColdMemoriesCache();
5447
5471
  }
5448
- if (filePath.includes(`${path7.sep}artifacts${path7.sep}`)) {
5472
+ if (filePath.includes(`${path8.sep}artifacts${path8.sep}`)) {
5449
5473
  this.bumpArtifactWriteVersion();
5450
5474
  }
5451
5475
  this.bumpMemoryStatusVersion();
@@ -5516,7 +5540,7 @@ var StorageManager3 = class _StorageManager {
5516
5540
  }
5517
5541
  async appendStorageSecureFileUnlocked(filePath, content) {
5518
5542
  const writeKey = this.resolveWriteKey();
5519
- await mkdir2(path7.dirname(filePath), { recursive: true });
5543
+ await mkdir2(path8.dirname(filePath), { recursive: true });
5520
5544
  if (writeKey === null) {
5521
5545
  try {
5522
5546
  if (await this.isEncryptedFileHeader(filePath)) {
@@ -5542,13 +5566,13 @@ var StorageManager3 = class _StorageManager {
5542
5566
  this.notifyCatalogWriteForPath(filePath);
5543
5567
  }
5544
5568
  get stateDir() {
5545
- return path7.join(this.baseDir, "state");
5569
+ return path8.join(this.baseDir, "state");
5546
5570
  }
5547
5571
  get offlineSyncDigestCachePath() {
5548
- return path7.join(this.baseDir, ".offline-sync", "digest-cache.v1.json");
5572
+ return path8.join(this.baseDir, ".offline-sync", "digest-cache.v1.json");
5549
5573
  }
5550
5574
  get entitySynthesisQueuePath() {
5551
- return path7.join(this.stateDir, "entity-synthesis-queue.json");
5575
+ return path8.join(this.stateDir, "entity-synthesis-queue.json");
5552
5576
  }
5553
5577
  // ── Tombstone store access (issue #1579) ─────────────────────────────────
5554
5578
  /**
@@ -5558,7 +5582,7 @@ var StorageManager3 = class _StorageManager {
5558
5582
  * helpers are injected into the store).
5559
5583
  */
5560
5584
  get tombstonesPath() {
5561
- return path7.join(this.stateDir, "tombstones.jsonl");
5585
+ return path8.join(this.stateDir, "tombstones.jsonl");
5562
5586
  }
5563
5587
  /**
5564
5588
  * Configure the tombstone invariant for this storage instance. Installed
@@ -5831,55 +5855,55 @@ var StorageManager3 = class _StorageManager {
5831
5855
  return null;
5832
5856
  }
5833
5857
  get questionsDir() {
5834
- return path7.join(this.baseDir, "questions");
5858
+ return path8.join(this.baseDir, "questions");
5835
5859
  }
5836
5860
  get artifactsDir() {
5837
- return path7.join(this.baseDir, "artifacts");
5861
+ return path8.join(this.baseDir, "artifacts");
5838
5862
  }
5839
5863
  get identityDir() {
5840
- return path7.join(this.baseDir, "identity");
5864
+ return path8.join(this.baseDir, "identity");
5841
5865
  }
5842
5866
  get identityAnchorPath() {
5843
- return path7.join(this.identityDir, "identity-anchor.md");
5867
+ return path8.join(this.identityDir, "identity-anchor.md");
5844
5868
  }
5845
5869
  get identityIncidentsDir() {
5846
- return path7.join(this.identityDir, "incidents");
5870
+ return path8.join(this.identityDir, "incidents");
5847
5871
  }
5848
5872
  get identityAuditsWeeklyDir() {
5849
- return path7.join(this.identityDir, "audits", "weekly");
5873
+ return path8.join(this.identityDir, "audits", "weekly");
5850
5874
  }
5851
5875
  get identityAuditsMonthlyDir() {
5852
- return path7.join(this.identityDir, "audits", "monthly");
5876
+ return path8.join(this.identityDir, "audits", "monthly");
5853
5877
  }
5854
5878
  get identityImprovementLoopsPath() {
5855
- return path7.join(this.identityDir, "improvement-loops.md");
5879
+ return path8.join(this.identityDir, "improvement-loops.md");
5856
5880
  }
5857
5881
  get identityReflectionsPath() {
5858
- return path7.join(this.identityDir, "reflections.md");
5882
+ return path8.join(this.identityDir, "reflections.md");
5859
5883
  }
5860
5884
  get profilePath() {
5861
- return path7.join(this.baseDir, "profile.md");
5885
+ return path8.join(this.baseDir, "profile.md");
5862
5886
  }
5863
5887
  get memoryActionsPath() {
5864
- return path7.join(this.stateDir, "memory-actions.jsonl");
5888
+ return path8.join(this.stateDir, "memory-actions.jsonl");
5865
5889
  }
5866
5890
  get memoryLifecycleLedgerPath() {
5867
- return path7.join(this.stateDir, "memory-lifecycle-ledger.jsonl");
5891
+ return path8.join(this.stateDir, "memory-lifecycle-ledger.jsonl");
5868
5892
  }
5869
5893
  get compressionGuidelinesPath() {
5870
- return path7.join(this.stateDir, "compression-guidelines.md");
5894
+ return path8.join(this.stateDir, "compression-guidelines.md");
5871
5895
  }
5872
5896
  get compressionGuidelineDraftPath() {
5873
- return path7.join(this.stateDir, "compression-guidelines.draft.md");
5897
+ return path8.join(this.stateDir, "compression-guidelines.draft.md");
5874
5898
  }
5875
5899
  get compressionGuidelineStatePath() {
5876
- return path7.join(this.stateDir, "compression-guideline-state.json");
5900
+ return path8.join(this.stateDir, "compression-guideline-state.json");
5877
5901
  }
5878
5902
  get compressionGuidelineDraftStatePath() {
5879
- return path7.join(this.stateDir, "compression-guideline-draft-state.json");
5903
+ return path8.join(this.stateDir, "compression-guideline-draft-state.json");
5880
5904
  }
5881
5905
  get behaviorSignalsPath() {
5882
- return path7.join(this.stateDir, "behavior-signals.jsonl");
5906
+ return path8.join(this.stateDir, "behavior-signals.jsonl");
5883
5907
  }
5884
5908
  /**
5885
5909
  * In-memory dedup key set for behavior-signals appends (issue #1909),
@@ -5911,7 +5935,7 @@ var StorageManager3 = class _StorageManager {
5911
5935
  * governance sweeps can treat it uniformly.
5912
5936
  */
5913
5937
  get bufferSurpriseLedgerPath() {
5914
- return path7.join(this.stateDir, "buffer-surprise-ledger.jsonl");
5938
+ return path8.join(this.stateDir, "buffer-surprise-ledger.jsonl");
5915
5939
  }
5916
5940
  /**
5917
5941
  * Entity alias table loaded from THIS store's config/aliases.json.
@@ -5942,7 +5966,7 @@ var StorageManager3 = class _StorageManager {
5942
5966
  this.loadAliasesSync();
5943
5967
  }
5944
5968
  loadAliasesSync() {
5945
- const aliasPath = path7.join(this.baseDir, "config", "aliases.json");
5969
+ const aliasPath = path8.join(this.baseDir, "config", "aliases.json");
5946
5970
  this.userAliases = {};
5947
5971
  try {
5948
5972
  const raw = readFileSync(aliasPath, "utf-8");
@@ -5965,9 +5989,9 @@ var StorageManager3 = class _StorageManager {
5965
5989
  }
5966
5990
  async ensureDirectories() {
5967
5991
  const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
5968
- await mkdir2(path7.join(this.factsDir, today), { recursive: true });
5969
- await mkdir2(path7.join(this.proceduresDir, today), { recursive: true });
5970
- await mkdir2(path7.join(this.reasoningTracesDir, today), { recursive: true });
5992
+ await mkdir2(path8.join(this.factsDir, today), { recursive: true });
5993
+ await mkdir2(path8.join(this.proceduresDir, today), { recursive: true });
5994
+ await mkdir2(path8.join(this.reasoningTracesDir, today), { recursive: true });
5971
5995
  await mkdir2(this.correctionsDir, { recursive: true });
5972
5996
  await mkdir2(this.entitiesDir, { recursive: true });
5973
5997
  await mkdir2(this.stateDir, { recursive: true });
@@ -5977,7 +6001,7 @@ var StorageManager3 = class _StorageManager {
5977
6001
  await mkdir2(this.identityIncidentsDir, { recursive: true });
5978
6002
  await mkdir2(this.identityAuditsWeeklyDir, { recursive: true });
5979
6003
  await mkdir2(this.identityAuditsMonthlyDir, { recursive: true });
5980
- await mkdir2(path7.join(this.baseDir, "config"), { recursive: true });
6004
+ await mkdir2(path8.join(this.baseDir, "config"), { recursive: true });
5981
6005
  if (this.hotMemoriesCacheEnabled && this.getMemoryCorpusVersion() === 0) {
5982
6006
  this.bumpMemoryCorpusVersion();
5983
6007
  }
@@ -5997,11 +6021,11 @@ var StorageManager3 = class _StorageManager {
5997
6021
  async resolveCategoryWritePath(category, id, today) {
5998
6022
  if (category === "correction") {
5999
6023
  await mkdir2(this.correctionsDir, { recursive: true });
6000
- return path7.join(this.correctionsDir, `${id}.md`);
6024
+ return path8.join(this.correctionsDir, `${id}.md`);
6001
6025
  }
6002
- const datedDir = path7.join(getCategoryDir(this.baseDir, category), today);
6026
+ const datedDir = path8.join(getCategoryDir(this.baseDir, category), today);
6003
6027
  await mkdir2(datedDir, { recursive: true });
6004
- return path7.join(datedDir, `${id}.md`);
6028
+ return path8.join(datedDir, `${id}.md`);
6005
6029
  }
6006
6030
  async writeMemory(category, content, options = {}) {
6007
6031
  await this.ensureDirectories();
@@ -6306,7 +6330,7 @@ ${sanitized.text}
6306
6330
  await this.ensureDirectories();
6307
6331
  const now = /* @__PURE__ */ new Date();
6308
6332
  const day = now.toISOString().slice(0, 10);
6309
- const dir = path7.join(this.artifactsDir, day);
6333
+ const dir = path8.join(this.artifactsDir, day);
6310
6334
  await mkdir2(dir, { recursive: true });
6311
6335
  const id = `artifact-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`;
6312
6336
  const fm = {
@@ -6331,7 +6355,7 @@ ${sanitized.text}
6331
6355
  log.warn(`artifact content rejected for ${id}; violations=${sanitized.violations.join(", ")}`);
6332
6356
  return "";
6333
6357
  }
6334
- const filePath = path7.join(dir, `${id}.md`);
6358
+ const filePath = path8.join(dir, `${id}.md`);
6335
6359
  await this.writeStorageSecureFile(filePath, `${serializeFrontmatter(fm)}
6336
6360
 
6337
6361
  ${sanitized.text}
@@ -6607,7 +6631,7 @@ ${sanitized.text}
6607
6631
  * per-process in-memory cache safe across process boundaries.
6608
6632
  */
6609
6633
  invalidateColdMemoriesCache() {
6610
- const coldRoot = path7.join(this.baseDir, "cold");
6634
+ const coldRoot = path8.join(this.baseDir, "cold");
6611
6635
  _StorageManager.coldMemoriesCache.delete(coldRoot);
6612
6636
  this.bumpColdWriteVersion();
6613
6637
  invalidateAllForDir(this.baseDir);
@@ -6699,7 +6723,7 @@ ${sanitized.text}
6699
6723
  const correctionPaths = [];
6700
6724
  const factPaths = [];
6701
6725
  for (const filePath of filePaths) {
6702
- if (filePath === this.correctionsDir || filePath.startsWith(`${this.correctionsDir}${path7.sep}`)) {
6726
+ if (filePath === this.correctionsDir || filePath.startsWith(`${this.correctionsDir}${path8.sep}`)) {
6703
6727
  correctionPaths.push(filePath);
6704
6728
  } else {
6705
6729
  factPaths.push(filePath);
@@ -6762,7 +6786,7 @@ ${sanitized.text}
6762
6786
  try {
6763
6787
  const entries = await readdir4(dir, { withFileTypes: true });
6764
6788
  for (const entry of entries) {
6765
- const fullPath = path7.join(dir, entry.name);
6789
+ const fullPath = path8.join(dir, entry.name);
6766
6790
  if (entry.isDirectory()) {
6767
6791
  await readDir(fullPath);
6768
6792
  } else if (entry.name.endsWith(".md")) {
@@ -6795,7 +6819,7 @@ ${sanitized.text}
6795
6819
  return this.memoryReadStore.readMemoryByPath(filePath);
6796
6820
  }
6797
6821
  resolveTierRootDir(tier) {
6798
- return tier === "cold" ? path7.join(this.baseDir, "cold") : this.baseDir;
6822
+ return tier === "cold" ? path8.join(this.baseDir, "cold") : this.baseDir;
6799
6823
  }
6800
6824
  resolveMemoryDateDir(memory) {
6801
6825
  const preferred = memory.frontmatter.created || memory.frontmatter.updated;
@@ -6810,13 +6834,13 @@ ${sanitized.text}
6810
6834
  buildTierMemoryPath(memory, tier) {
6811
6835
  const root = this.resolveTierRootDir(tier);
6812
6836
  if (this.isArtifactMemory(memory)) {
6813
- return path7.join(root, "artifacts", this.resolveMemoryDateDir(memory), `${memory.frontmatter.id}.md`);
6837
+ return path8.join(root, "artifacts", this.resolveMemoryDateDir(memory), `${memory.frontmatter.id}.md`);
6814
6838
  }
6815
6839
  if (memory.frontmatter.category === "correction") {
6816
- return path7.join(root, "corrections", `${memory.frontmatter.id}.md`);
6840
+ return path8.join(root, "corrections", `${memory.frontmatter.id}.md`);
6817
6841
  }
6818
6842
  const dir = categoryDirName(memory.frontmatter.category);
6819
- return path7.join(root, dir, this.resolveMemoryDateDir(memory), `${memory.frontmatter.id}.md`);
6843
+ return path8.join(root, dir, this.resolveMemoryDateDir(memory), `${memory.frontmatter.id}.md`);
6820
6844
  }
6821
6845
  async writeMemoryFileAtomic(targetPath, memory) {
6822
6846
  const fileContent = `${serializeFrontmatter(memory.frontmatter)}
@@ -6829,8 +6853,8 @@ ${memory.content}
6829
6853
  }
6830
6854
  async moveMemoryToPath(memory, targetPath) {
6831
6855
  await this.writeMemoryFileAtomic(targetPath, memory);
6832
- const sourcePath = path7.resolve(memory.path);
6833
- const destPath = path7.resolve(targetPath);
6856
+ const sourcePath = path8.resolve(memory.path);
6857
+ const destPath = path8.resolve(targetPath);
6834
6858
  if (sourcePath !== destPath) {
6835
6859
  try {
6836
6860
  await unlink2(memory.path);
@@ -6846,8 +6870,8 @@ ${memory.content}
6846
6870
  }
6847
6871
  async migrateMemoryToTier(memory, targetTier) {
6848
6872
  const targetPath = this.buildTierMemoryPath(memory, targetTier);
6849
- const sourcePath = path7.resolve(memory.path);
6850
- const destPath = path7.resolve(targetPath);
6873
+ const sourcePath = path8.resolve(memory.path);
6874
+ const destPath = path8.resolve(targetPath);
6851
6875
  if (sourcePath === destPath) {
6852
6876
  return { changed: false, targetPath };
6853
6877
  }
@@ -6874,7 +6898,7 @@ ${memory.content}
6874
6898
  return { changed: true, targetPath };
6875
6899
  }
6876
6900
  get archiveDir() {
6877
- return path7.join(this.baseDir, "archive");
6901
+ return path8.join(this.baseDir, "archive");
6878
6902
  }
6879
6903
  /**
6880
6904
  * Archive a memory by moving it from facts/ to archive/YYYY-MM-DD/.
@@ -6885,7 +6909,7 @@ ${memory.content}
6885
6909
  try {
6886
6910
  const now = lifecycle?.at ?? /* @__PURE__ */ new Date();
6887
6911
  const today = now.toISOString().slice(0, 10);
6888
- const destDir = path7.join(this.archiveDir, today);
6912
+ const destDir = path8.join(this.archiveDir, today);
6889
6913
  await mkdir2(destDir, { recursive: true });
6890
6914
  const updatedFm = {
6891
6915
  ...memory.frontmatter,
@@ -6897,7 +6921,7 @@ ${memory.content}
6897
6921
 
6898
6922
  ${memory.content}
6899
6923
  `;
6900
- const destPath = path7.join(destDir, path7.basename(memory.path));
6924
+ const destPath = path8.join(destDir, path8.basename(memory.path));
6901
6925
  await this.writeStorageSecureFile(destPath, fileContent);
6902
6926
  await unlink2(memory.path);
6903
6927
  markProjectedMemoryPathInvalid(this.baseDir, memory.frontmatter.id);
@@ -7045,7 +7069,7 @@ ${memory.content}
7045
7069
  `;
7046
7070
  await this.writeStorageSecureFile(memory.path, fileContent);
7047
7071
  await this.patchHotMemoriesCache({ addedPath: memory.path });
7048
- if (memory.path.includes(`${path7.sep}cold${path7.sep}`)) {
7072
+ if (memory.path.includes(`${path8.sep}cold${path8.sep}`)) {
7049
7073
  this.invalidateColdMemoriesCache();
7050
7074
  }
7051
7075
  try {
@@ -7116,7 +7140,7 @@ ${memory.content}
7116
7140
  return deleted;
7117
7141
  }
7118
7142
  async loadBuffer() {
7119
- const bufferPath = path7.join(this.stateDir, "buffer.json");
7143
+ const bufferPath = path8.join(this.stateDir, "buffer.json");
7120
7144
  try {
7121
7145
  const raw = await this.readStorageSecureFile(bufferPath);
7122
7146
  return JSON.parse(raw);
@@ -7128,11 +7152,11 @@ ${memory.content}
7128
7152
  }
7129
7153
  async saveBuffer(state) {
7130
7154
  await this.ensureDirectories();
7131
- const bufferPath = path7.join(this.stateDir, "buffer.json");
7155
+ const bufferPath = path8.join(this.stateDir, "buffer.json");
7132
7156
  await this.writeStorageSecureFile(bufferPath, JSON.stringify(state, null, 2));
7133
7157
  }
7134
7158
  async loadMeta() {
7135
- const metaPath = path7.join(this.stateDir, "meta.json");
7159
+ const metaPath = path8.join(this.stateDir, "meta.json");
7136
7160
  try {
7137
7161
  const raw = await this.readStorageSecureFile(metaPath);
7138
7162
  const parsed = JSON.parse(raw);
@@ -7165,7 +7189,7 @@ ${memory.content}
7165
7189
  }
7166
7190
  async saveMeta(state) {
7167
7191
  await this.ensureDirectories();
7168
- const metaPath = path7.join(this.stateDir, "meta.json");
7192
+ const metaPath = path8.join(this.stateDir, "meta.json");
7169
7193
  await this.writeStorageSecureFile(metaPath, JSON.stringify(state, null, 2));
7170
7194
  }
7171
7195
  async appendMemoryActionEvents(events) {
@@ -7232,7 +7256,7 @@ ${memory.content}
7232
7256
  },
7233
7257
  (payload) => this.appendStorageSecureFile(target, payload),
7234
7258
  async () => {
7235
- await mkdir2(path7.dirname(target), { recursive: true });
7259
+ await mkdir2(path8.dirname(target), { recursive: true });
7236
7260
  }
7237
7261
  );
7238
7262
  }
@@ -7330,7 +7354,7 @@ ${memory.content}
7330
7354
  async appendReextractJobs(events) {
7331
7355
  if (events.length === 0) return 0;
7332
7356
  await this.ensureDirectories();
7333
- const filePath = path7.join(this.stateDir, "reextract-jobs.jsonl");
7357
+ const filePath = path8.join(this.stateDir, "reextract-jobs.jsonl");
7334
7358
  const lines = events.map((event) => JSON.stringify(event)).join("\n") + "\n";
7335
7359
  try {
7336
7360
  await this.appendStorageSecureFile(filePath, lines);
@@ -7343,7 +7367,7 @@ ${memory.content}
7343
7367
  }
7344
7368
  async readReextractJobs(limit = 200) {
7345
7369
  const safeLimit = Number.isFinite(limit) ? Math.max(1, Math.min(1e3, Math.floor(limit))) : 200;
7346
- const filePath = path7.join(this.stateDir, "reextract-jobs.jsonl");
7370
+ const filePath = path8.join(this.stateDir, "reextract-jobs.jsonl");
7347
7371
  try {
7348
7372
  const raw = await this.readStorageSecureFile(filePath);
7349
7373
  const lines = raw.split("\n").filter((line) => line.trim().length > 0);
@@ -7573,7 +7597,7 @@ ${question}
7573
7597
 
7574
7598
  **Context:** ${context}
7575
7599
  `;
7576
- const filePath = path7.join(this.questionsDir, `${id}.md`);
7600
+ const filePath = path8.join(this.questionsDir, `${id}.md`);
7577
7601
  await this.writeStorageSecureFile(filePath, content);
7578
7602
  log.debug(`wrote question ${id} to ${filePath}`);
7579
7603
  this.invalidateQuestionsCache();
@@ -7591,7 +7615,7 @@ ${question}
7591
7615
  if (!match) return null;
7592
7616
  const frontmatterStr = match[1];
7593
7617
  const body = match[2].trim();
7594
- const id = this.extractFrontmatterValue(frontmatterStr, "id") ?? path7.basename(filePath, ".md");
7618
+ const id = this.extractFrontmatterValue(frontmatterStr, "id") ?? path8.basename(filePath, ".md");
7595
7619
  const created = this.extractFrontmatterValue(frontmatterStr, "created") ?? "";
7596
7620
  const priority = parseFloat(this.extractFrontmatterValue(frontmatterStr, "priority") ?? "0.5");
7597
7621
  const resolved = this.extractFrontmatterValue(frontmatterStr, "resolved") === "true";
@@ -7647,11 +7671,11 @@ ${question}
7647
7671
  } catch {
7648
7672
  }
7649
7673
  const hygiene = opts?.hygiene;
7650
- const rotateEnabled = hygiene?.enabled === true && hygiene.rotateEnabled === true && Array.isArray(hygiene.rotatePaths) && hygiene.rotatePaths.includes(path7.basename(identityPath));
7674
+ const rotateEnabled = hygiene?.enabled === true && hygiene.rotateEnabled === true && Array.isArray(hygiene.rotatePaths) && hygiene.rotatePaths.includes(path8.basename(identityPath));
7651
7675
  if (rotateEnabled) {
7652
7676
  const maxBytes = hygiene.rotateMaxBytes;
7653
7677
  if (existing.length > maxBytes) {
7654
- const archiveDir = path7.join(workspaceDir, hygiene.archiveDir);
7678
+ const archiveDir = path8.join(workspaceDir, hygiene.archiveDir);
7655
7679
  const { newContent } = await rotateMarkdownFileToArchive({
7656
7680
  filePath: identityPath,
7657
7681
  archiveDir,
@@ -7747,7 +7771,7 @@ ${reflection}
7747
7771
  * Deduplicates by target+label.
7748
7772
  */
7749
7773
  async addEntityRelationship(name, rel) {
7750
- const filePath = path7.join(this.entitiesDir, `${name}.md`);
7774
+ const filePath = path8.join(this.entitiesDir, `${name}.md`);
7751
7775
  let entity;
7752
7776
  try {
7753
7777
  const content = await this.readStorageSecureFile(filePath);
@@ -7770,7 +7794,7 @@ ${reflection}
7770
7794
  * Prepends to the beginning, prunes oldest entries beyond maxEntries.
7771
7795
  */
7772
7796
  async addEntityActivity(name, entry, maxEntries) {
7773
- const filePath = path7.join(this.entitiesDir, `${name}.md`);
7797
+ const filePath = path8.join(this.entitiesDir, `${name}.md`);
7774
7798
  let entity;
7775
7799
  try {
7776
7800
  const content = await this.readStorageSecureFile(filePath);
@@ -7793,7 +7817,7 @@ ${reflection}
7793
7817
  * Add an alias to an entity file. Deduplicates.
7794
7818
  */
7795
7819
  async addEntityAlias(name, alias) {
7796
- const filePath = path7.join(this.entitiesDir, `${name}.md`);
7820
+ const filePath = path8.join(this.entitiesDir, `${name}.md`);
7797
7821
  let entity;
7798
7822
  try {
7799
7823
  const content = await this.readStorageSecureFile(filePath);
@@ -7820,7 +7844,7 @@ ${reflection}
7820
7844
  const updatedAt = (/* @__PURE__ */ new Date()).toISOString();
7821
7845
  let synthesisTimelineCount;
7822
7846
  try {
7823
- const filePath = path7.join(this.entitiesDir, `${name}.md`);
7847
+ const filePath = path8.join(this.entitiesDir, `${name}.md`);
7824
7848
  const content = await this.readStorageSecureFile(filePath);
7825
7849
  synthesisTimelineCount = parseEntityFile(content, this.entitySchemas).timeline.length;
7826
7850
  } catch (err) {
@@ -7903,7 +7927,7 @@ ${reflection}
7903
7927
  if (!raw) continue;
7904
7928
  const serialized = serializeEntityFile(parseEntityFile(raw, this.entitySchemas), this.entitySchemas);
7905
7929
  if (raw.trimEnd() === serialized.trimEnd()) continue;
7906
- await this.writeStorageSecureFile(path7.join(this.entitiesDir, `${entityName}.md`), serialized);
7930
+ await this.writeStorageSecureFile(path8.join(this.entitiesDir, `${entityName}.md`), serialized);
7907
7931
  migrated += 1;
7908
7932
  }
7909
7933
  if (migrated > 0) {
@@ -7996,14 +8020,14 @@ ${reflection}
7996
8020
  if (entries.length === 0) return 0;
7997
8021
  const memories = await this.readAllMemories();
7998
8022
  const memoryMap = new Map(memories.map((m) => [m.frontmatter.id, m]));
7999
- const memoryPathMap = new Map(memories.map((m) => [path7.resolve(m.path), m]));
8023
+ const memoryPathMap = new Map(memories.map((m) => [path8.resolve(m.path), m]));
8000
8024
  let updated = 0;
8001
8025
  const prevVersion = this.getMemoryCorpusVersion();
8002
8026
  const keyId = this.hotCacheKeyId();
8003
8027
  const warm = this.hotMemoriesCacheEnabled && getCachedMemories(this.baseDir, prevVersion, keyId, this.hotCacheTtlMs()) !== null;
8004
8028
  const appliedPatches = /* @__PURE__ */ new Map();
8005
8029
  for (const entry of entries) {
8006
- const memory = entry.memoryPath ? memoryPathMap.get(path7.resolve(entry.memoryPath)) : memoryMap.get(entry.memoryId);
8030
+ const memory = entry.memoryPath ? memoryPathMap.get(path8.resolve(entry.memoryPath)) : memoryMap.get(entry.memoryId);
8007
8031
  if (!memory) continue;
8008
8032
  const newFm = {
8009
8033
  ...memory.frontmatter,
@@ -8019,7 +8043,7 @@ ${memory.content}
8019
8043
  if (warm) {
8020
8044
  updateCacheOnWrite(this.baseDir, { ...memory, frontmatter: newFm }, keyId);
8021
8045
  }
8022
- appliedPatches.set(path7.resolve(memory.path), {
8046
+ appliedPatches.set(path8.resolve(memory.path), {
8023
8047
  accessCount: entry.newCount,
8024
8048
  lastAccessed: entry.lastAccessed
8025
8049
  });
@@ -8035,7 +8059,7 @@ ${memory.content}
8035
8059
  const cur = getCachedMemories(this.baseDir, prevVersion, keyId);
8036
8060
  if (cur) {
8037
8061
  const reapplied = cur.map((m) => {
8038
- const patch = appliedPatches.get(path7.resolve(m.path));
8062
+ const patch = appliedPatches.get(path8.resolve(m.path));
8039
8063
  return patch ? { ...m, frontmatter: { ...m.frontmatter, accessCount: patch.accessCount, lastAccessed: patch.lastAccessed } } : m;
8040
8064
  });
8041
8065
  setCachedMemories(this.baseDir, reapplied, produced, keyId, this.hotCacheTtlMs());
@@ -8067,7 +8091,7 @@ ${memory.content}
8067
8091
  const pathsById = /* @__PURE__ */ new Map();
8068
8092
  const filePathsById = /* @__PURE__ */ new Map();
8069
8093
  for (const filePath of filePaths) {
8070
- const memoryId = path7.basename(filePath, ".md");
8094
+ const memoryId = path8.basename(filePath, ".md");
8071
8095
  if (!wantedIds.has(memoryId)) continue;
8072
8096
  const paths = filePathsById.get(memoryId) ?? [];
8073
8097
  paths.push(filePath);
@@ -8082,7 +8106,7 @@ ${memory.content}
8082
8106
  qmdResultPathCandidates(this.baseDir, preferredPath)
8083
8107
  );
8084
8108
  const directMatch = existingPaths.find(
8085
- (filePath) => directCandidates.has(path7.resolve(filePath))
8109
+ (filePath) => directCandidates.has(path8.resolve(filePath))
8086
8110
  );
8087
8111
  if (directMatch) {
8088
8112
  preferredMatches.push(directMatch);
@@ -8095,7 +8119,7 @@ ${memory.content}
8095
8119
  candidates.add(candidate);
8096
8120
  }
8097
8121
  }
8098
- const match = existingPaths.find((filePath) => candidates.has(path7.resolve(filePath)));
8122
+ const match = existingPaths.find((filePath) => candidates.has(path8.resolve(filePath)));
8099
8123
  if (match) preferredMatches.push(match);
8100
8124
  }
8101
8125
  if (preferredMatches.length > 0) {
@@ -8157,7 +8181,15 @@ ${memory.content}
8157
8181
  if (cappedLimit === 0) return [];
8158
8182
  const projected = readProjectedMemoryTimeline(this.baseDir, memoryId, cappedLimit);
8159
8183
  if (projected && projected.length > 0) return projected;
8160
- warnProjectionFallback(this.baseDir, "getMemoryTimeline");
8184
+ warnProjectionFallback(this.baseDir, "getMemoryTimeline", () => {
8185
+ const rebuiltAt = readProjectionRebuiltAt(this.baseDir);
8186
+ if (!rebuiltAt) return "projection never rebuilt";
8187
+ const ageMs = Date.now() - Date.parse(rebuiltAt);
8188
+ if (!Number.isFinite(ageMs)) return `projection rebuiltAt=${rebuiltAt}`;
8189
+ const ageMin = Math.max(0, Math.round(ageMs / 6e4));
8190
+ const age = ageMin >= 120 ? `${Math.round(ageMin / 60)}h` : `${ageMin}m`;
8191
+ return `projection ${age} stale, last rebuilt ${rebuiltAt}`;
8192
+ });
8161
8193
  return readBoundedLifecycleEventsFromLedger(
8162
8194
  this.memoryLifecycleLedgerPath,
8163
8195
  (p) => this.readStorageSecureFile(p),
@@ -8306,14 +8338,14 @@ Reason: ${reason}`;
8306
8338
  // Memory Summarization (Phase 4A)
8307
8339
  // ---------------------------------------------------------------------------
8308
8340
  get summariesDir() {
8309
- return path7.join(this.baseDir, "summaries");
8341
+ return path8.join(this.baseDir, "summaries");
8310
8342
  }
8311
8343
  /**
8312
8344
  * Write a memory summary.
8313
8345
  */
8314
8346
  async writeSummary(summary) {
8315
8347
  await mkdir2(this.summariesDir, { recursive: true });
8316
- const filePath = path7.join(this.summariesDir, `${summary.id}.json`);
8348
+ const filePath = path8.join(this.summariesDir, `${summary.id}.json`);
8317
8349
  await this.writeStorageSecureFile(filePath, JSON.stringify(summary, null, 2));
8318
8350
  log.debug(`wrote summary ${summary.id}`);
8319
8351
  }
@@ -8326,7 +8358,7 @@ Reason: ${reason}`;
8326
8358
  const summaries = [];
8327
8359
  for (const file of files) {
8328
8360
  if (!file.endsWith(".json")) continue;
8329
- const filePath = path7.join(this.summariesDir, file);
8361
+ const filePath = path8.join(this.summariesDir, file);
8330
8362
  const raw = await this.readStorageSecureFile(filePath);
8331
8363
  summaries.push(JSON.parse(raw));
8332
8364
  }
@@ -8388,7 +8420,7 @@ ${memory.content}
8388
8420
  * Save topic scores to meta.json.
8389
8421
  */
8390
8422
  async saveTopics(topics) {
8391
- const metaPath = path7.join(this.stateDir, "topics.json");
8423
+ const metaPath = path8.join(this.stateDir, "topics.json");
8392
8424
  await mkdir2(this.stateDir, { recursive: true });
8393
8425
  await this.writeStorageSecureFile(
8394
8426
  metaPath,
@@ -8400,7 +8432,7 @@ ${memory.content}
8400
8432
  * Load topic scores from meta.json.
8401
8433
  */
8402
8434
  async loadTopics() {
8403
- const metaPath = path7.join(this.stateDir, "topics.json");
8435
+ const metaPath = path8.join(this.stateDir, "topics.json");
8404
8436
  try {
8405
8437
  const raw = await this.readStorageSecureFile(metaPath);
8406
8438
  return JSON.parse(raw);
@@ -8478,6 +8510,8 @@ ${memory.content}
8478
8510
  };
8479
8511
 
8480
8512
  export {
8513
+ readProjectionRebuiltAt,
8514
+ assertInjectedStorageRooted,
8481
8515
  selfDeps,
8482
8516
  qmdCollectionPathParts,
8483
8517
  qmdResultPathCandidates,
@@ -8513,4 +8547,4 @@ export {
8513
8547
  isValidBufferSurpriseEvent,
8514
8548
  StorageManager3 as StorageManager
8515
8549
  };
8516
- //# sourceMappingURL=chunk-7YJLCNPF.js.map
8550
+ //# sourceMappingURL=chunk-HRREDJSL.js.map