@remnic/core 9.26.0 → 9.28.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 (440) hide show
  1. package/dist/access-admin-ops-surface.d.ts +13 -10
  2. package/dist/access-admin-ops-surface.js +43 -38
  3. package/dist/access-audit.js +2 -2
  4. package/dist/access-authorization-probe.d.ts +13 -10
  5. package/dist/access-authorization-probe.js +44 -39
  6. package/dist/access-boundary.d.ts +13 -10
  7. package/dist/access-boundary.js +43 -38
  8. package/dist/access-cli.js +100 -94
  9. package/dist/access-cli.js.map +1 -1
  10. package/dist/access-health-types.d.ts +10 -1
  11. package/dist/access-http-lcm-compaction.d.ts +13 -10
  12. package/dist/access-http.d.ts +13 -10
  13. package/dist/access-http.js +53 -48
  14. package/dist/access-identity-continuity-surface.d.ts +9 -8
  15. package/dist/access-identity-continuity-surface.js +43 -38
  16. package/dist/access-lcm-surface.d.ts +13 -10
  17. package/dist/access-lcm-surface.js +43 -38
  18. package/dist/access-mcp.d.ts +13 -10
  19. package/dist/access-mcp.js +48 -43
  20. package/dist/access-memory-search-fanout.d.ts +2 -2
  21. package/dist/{access-namespace-preflight-wRSZEO5V.d.ts → access-namespace-preflight-BiQ_-iUJ.d.ts} +1 -1
  22. package/dist/access-namespace-preflight.d.ts +3 -3
  23. package/dist/access-namespace-preflight.js +43 -38
  24. package/dist/access-observe-write-surface.d.ts +13 -10
  25. package/dist/access-observe-write-surface.js +43 -38
  26. package/dist/access-operations-batch.js +45 -40
  27. package/dist/access-operations.d.ts +16 -13
  28. package/dist/access-operations.js +47 -42
  29. package/dist/access-recall-concurrency.d.ts +13 -10
  30. package/dist/access-recall-concurrency.js +43 -38
  31. package/dist/access-recall-response.d.ts +13 -10
  32. package/dist/access-recall-response.js +43 -38
  33. package/dist/access-recall-surface.d.ts +13 -10
  34. package/dist/access-recall-surface.js +43 -38
  35. package/dist/access-schema.d.ts +80 -80
  36. package/dist/access-schema.js +4 -4
  37. package/dist/{access-service-DL8FJnTj.d.ts → access-service-CXkIgcGh.d.ts} +12 -8
  38. package/dist/access-service.d.ts +13 -10
  39. package/dist/access-service.js +43 -38
  40. package/dist/access-surface-catalog.d.ts +13 -10
  41. package/dist/access-wearables-meetings-surface.d.ts +4 -3
  42. package/dist/action-confidence.d.ts +1 -1
  43. package/dist/active-memory-bridge.d.ts +1 -1
  44. package/dist/active-recall.d.ts +1 -1
  45. package/dist/active-recall.js +4 -2
  46. package/dist/active-recall.js.map +1 -1
  47. package/dist/adapters/index.js +7 -7
  48. package/dist/adapters/registry.js +3 -3
  49. package/dist/behavior-learner.d.ts +1 -1
  50. package/dist/behavior-signals.d.ts +1 -1
  51. package/dist/bootstrap.d.ts +9 -8
  52. package/dist/briefing.d.ts +3 -2
  53. package/dist/briefing.js +12 -10
  54. package/dist/buffer-surprise-report.d.ts +1 -1
  55. package/dist/buffer.d.ts +3 -2
  56. package/dist/bulk-import/index.d.ts +3 -3
  57. package/dist/calibration.d.ts +1 -1
  58. package/dist/capabilities.d.ts +1 -1
  59. package/dist/{capsule-crypto-YO5QJ6L3.js → capsule-crypto-7FJQINUR.js} +2 -2
  60. package/dist/{catalog-BLLxZ5L5.d.ts → catalog-Bouj8Gfg.d.ts} +1 -1
  61. package/dist/causal-behavior.d.ts +1 -1
  62. package/dist/causal-consolidation.d.ts +1 -1
  63. package/dist/causal-consolidation.js +13 -11
  64. package/dist/causal-consolidation.js.map +1 -1
  65. package/dist/causal-trajectory-graph.d.ts +1 -1
  66. package/dist/{chunk-7RZJWZ46.js → chunk-227UFSEQ.js} +5 -5
  67. package/dist/{chunk-VGEH3STZ.js → chunk-2BEJ4XCF.js} +2 -2
  68. package/dist/{chunk-LIIQPDFN.js → chunk-2FYNLDKJ.js} +24 -3
  69. package/dist/chunk-2FYNLDKJ.js.map +1 -0
  70. package/dist/{chunk-BXLOS5AJ.js → chunk-2NLLXCJG.js} +2 -2
  71. package/dist/{chunk-6NNNURLK.js → chunk-2PHX3I5C.js} +8 -8
  72. package/dist/{chunk-YN4AUGNF.js → chunk-2TQ2UFKH.js} +65 -60
  73. package/dist/chunk-2TQ2UFKH.js.map +1 -0
  74. package/dist/{chunk-XAAIUXJO.js → chunk-3BSJBIZ3.js} +2 -2
  75. package/dist/{chunk-JCVQV6QX.js → chunk-3UOSVTFR.js} +11 -11
  76. package/dist/{chunk-AJ7QCSIS.js → chunk-7CPOZH6Y.js} +2 -2
  77. package/dist/{chunk-EXM2Q555.js → chunk-AHFZXUZM.js} +7 -5
  78. package/dist/chunk-AHFZXUZM.js.map +1 -0
  79. package/dist/{chunk-M2KGXXTL.js → chunk-ALTP3MFS.js} +2 -2
  80. package/dist/{chunk-77CNV7DY.js → chunk-BLAKS3CP.js} +4 -4
  81. package/dist/{chunk-FE5FKTCI.js → chunk-BR4UFMLO.js} +2 -2
  82. package/dist/chunk-CVILPI77.js +432 -0
  83. package/dist/chunk-CVILPI77.js.map +1 -0
  84. package/dist/{chunk-H2PBM562.js → chunk-DKQM5Q6Q.js} +2 -2
  85. package/dist/{chunk-CSXHRAJJ.js → chunk-EG64LXKL.js} +3 -3
  86. package/dist/{chunk-PTN6UAUA.js → chunk-ES36HTSC.js} +4 -4
  87. package/dist/{chunk-WMDRLTNA.js → chunk-EZWWCN7I.js} +2 -2
  88. package/dist/{chunk-XKGPIWGI.js → chunk-FBZTWUK5.js} +5 -5
  89. package/dist/{chunk-GJJBPI6I.js → chunk-FOCEI3TN.js} +6 -3
  90. package/dist/chunk-FOCEI3TN.js.map +1 -0
  91. package/dist/{chunk-Y6E37WRG.js → chunk-GJPCP5CA.js} +2 -2
  92. package/dist/{chunk-IHMXPG4P.js → chunk-GQSMYXKL.js} +6 -4
  93. package/dist/{chunk-IHMXPG4P.js.map → chunk-GQSMYXKL.js.map} +1 -1
  94. package/dist/{chunk-TGQ2NTWH.js → chunk-IJ6WHMFB.js} +16 -2
  95. package/dist/{chunk-TGQ2NTWH.js.map → chunk-IJ6WHMFB.js.map} +1 -1
  96. package/dist/{chunk-VDX2J7OX.js → chunk-IPLYGWQF.js} +6 -6
  97. package/dist/{chunk-XNUBF6RF.js → chunk-IYT632D5.js} +3 -3
  98. package/dist/{chunk-2QSZNTDO.js → chunk-JBPKEARU.js} +7 -7
  99. package/dist/{chunk-67DSDRUB.js → chunk-JIF3VRKQ.js} +8 -8
  100. package/dist/{chunk-V25OWXAC.js → chunk-JQ7T5VDC.js} +1 -1
  101. package/dist/chunk-JQ7T5VDC.js.map +1 -0
  102. package/dist/{chunk-MIFF37NN.js → chunk-KKBTBUVT.js} +2 -2
  103. package/dist/{chunk-ZHP4SUPB.js → chunk-LIHC3T43.js} +2 -2
  104. package/dist/{chunk-PX7VDW7R.js → chunk-MJPV4LBH.js} +79 -79
  105. package/dist/{chunk-PX7VDW7R.js.map → chunk-MJPV4LBH.js.map} +1 -1
  106. package/dist/{chunk-UGH6VPPO.js → chunk-MWTMTW2T.js} +2 -2
  107. package/dist/{chunk-F6LSNPPB.js → chunk-MXJ3VP6S.js} +6 -6
  108. package/dist/{chunk-KPWLZBXZ.js → chunk-NBNDVNJ2.js} +186 -25
  109. package/dist/chunk-NBNDVNJ2.js.map +1 -0
  110. package/dist/{chunk-M5EPMNS4.js → chunk-P2CLYN6H.js} +2 -2
  111. package/dist/{chunk-7XXCIO6X.js → chunk-PXQM2HOG.js} +13 -6
  112. package/dist/{chunk-7XXCIO6X.js.map → chunk-PXQM2HOG.js.map} +1 -1
  113. package/dist/{chunk-UZK7VVPD.js → chunk-Q5VJUNXA.js} +1858 -272
  114. package/dist/chunk-Q5VJUNXA.js.map +1 -0
  115. package/dist/{chunk-KGTD2KZJ.js → chunk-Q6YJW6KE.js} +2 -2
  116. package/dist/{chunk-X3SQYAPP.js → chunk-R372P2EH.js} +2 -2
  117. package/dist/{chunk-HBVOJNV4.js → chunk-RKXZ7P4V.js} +3 -3
  118. package/dist/chunk-RMMVQQA6.js +70 -0
  119. package/dist/chunk-RMMVQQA6.js.map +1 -0
  120. package/dist/{chunk-E6EAB4J6.js → chunk-S24E4MBQ.js} +14 -14
  121. package/dist/chunk-S24E4MBQ.js.map +1 -0
  122. package/dist/{chunk-RYHWZ52A.js → chunk-S2BBISHU.js} +4 -4
  123. package/dist/{chunk-LLISELSY.js → chunk-TBMRQZDY.js} +2 -2
  124. package/dist/{chunk-FMLKOL2Z.js → chunk-TC3VNKGX.js} +4 -4
  125. package/dist/{chunk-7K5Q6COX.js → chunk-TVVEYCNW.js} +4 -4
  126. package/dist/{chunk-2XP3PWL3.js → chunk-UR5SIN7H.js} +53 -35
  127. package/dist/chunk-UR5SIN7H.js.map +1 -0
  128. package/dist/{chunk-NKDVXEFU.js → chunk-VFNI3RPT.js} +2 -2
  129. package/dist/chunk-VNA7W7QF.js +134 -0
  130. package/dist/chunk-VNA7W7QF.js.map +1 -0
  131. package/dist/{chunk-PQPSZICJ.js → chunk-VYYNBJXH.js} +5 -5
  132. package/dist/chunk-WNIUPHWV.js +152 -0
  133. package/dist/chunk-WNIUPHWV.js.map +1 -0
  134. package/dist/chunk-WRJVB3C2.js +118 -0
  135. package/dist/chunk-WRJVB3C2.js.map +1 -0
  136. package/dist/{chunk-SN3ZESWQ.js → chunk-WVVK2RFM.js} +6 -6
  137. package/dist/{chunk-DQEMWVMT.js → chunk-X7Y7WX73.js} +1 -1
  138. package/dist/{chunk-4KKV7W62.js → chunk-YOBNCD3Z.js} +6 -6
  139. package/dist/chunk-YXZG5TVN.js +40 -0
  140. package/dist/chunk-YXZG5TVN.js.map +1 -0
  141. package/dist/{chunk-4DJQYKMN.js → chunk-ZIKENA2C.js} +2 -2
  142. package/dist/chunk-ZIKENA2C.js.map +1 -0
  143. package/dist/{chunk-SK3EYPKC.js → chunk-ZN4UZWMT.js} +2 -2
  144. package/dist/{cli-BoouX6LX.d.ts → cli-DJbkaZBU.d.ts} +5 -5
  145. package/dist/cli.d.ts +14 -12
  146. package/dist/cli.js +79 -74
  147. package/dist/compounding/engine.d.ts +3 -2
  148. package/dist/compounding/engine.js +12 -10
  149. package/dist/compounding/preference-consolidator.d.ts +1 -1
  150. package/dist/compression-optimizer.d.ts +1 -1
  151. package/dist/config.d.ts +1 -1
  152. package/dist/config.js +4 -2
  153. package/dist/connectors/codex-materialize-runner.d.ts +1 -1
  154. package/dist/connectors/codex-materialize-runner.js +12 -10
  155. package/dist/connectors/codex-materialize.d.ts +1 -1
  156. package/dist/connectors/index.d.ts +1 -1
  157. package/dist/connectors/index.js +12 -10
  158. package/dist/consolidation-provenance-check.d.ts +3 -2
  159. package/dist/consolidation-undo.d.ts +3 -2
  160. package/dist/contradiction/index.d.ts +3 -2
  161. package/dist/conversation-index/backend.d.ts +1 -1
  162. package/dist/conversation-index/backend.js +2 -2
  163. package/dist/conversation-index/chunker.d.ts +1 -1
  164. package/dist/conversation-index/faiss-adapter.d.ts +1 -1
  165. package/dist/conversation-index/indexer.d.ts +1 -1
  166. package/dist/conversation-index/search.d.ts +1 -1
  167. package/dist/corpus-watermark.d.ts +15 -2
  168. package/dist/corpus-watermark.js +25 -21
  169. package/dist/day-summary.d.ts +1 -1
  170. package/dist/delinearize.d.ts +1 -1
  171. package/dist/direct-answer-wiring.d.ts +1 -1
  172. package/dist/direct-answer.d.ts +1 -1
  173. package/dist/embedding-fallback.d.ts +1 -1
  174. package/dist/enrichment/index.d.ts +1 -1
  175. package/dist/entity-id-normalization.d.ts +4 -0
  176. package/dist/entity-id-normalization.js +10 -0
  177. package/dist/entity-id-normalization.js.map +1 -0
  178. package/dist/entity-retrieval-boundaries.d.ts +3 -0
  179. package/dist/entity-retrieval-boundaries.js +8 -0
  180. package/dist/entity-retrieval-boundaries.js.map +1 -0
  181. package/dist/entity-retrieval.d.ts +3 -2
  182. package/dist/entity-retrieval.js +13 -10
  183. package/dist/entity-schema.d.ts +1 -1
  184. package/dist/entity-schema.js +1 -1
  185. package/dist/explicit-capture.d.ts +9 -8
  186. package/dist/extraction-error-classification.d.ts +1 -1
  187. package/dist/extraction-faithfulness.d.ts +1 -1
  188. package/dist/extraction-judge-telemetry.d.ts +1 -1
  189. package/dist/extraction-judge-training.d.ts +1 -1
  190. package/dist/extraction-judge.d.ts +1 -1
  191. package/dist/extraction-liveness.d.ts +1 -1
  192. package/dist/extraction.d.ts +1 -1
  193. package/dist/fallback-llm.d.ts +1 -1
  194. package/dist/{first-start-migration-LEXL3XYL.js → first-start-migration-BKNGOFED.js} +4 -4
  195. package/dist/graph-dashboard-diff.d.ts +1 -1
  196. package/dist/graph-dashboard-key.d.ts +1 -1
  197. package/dist/graph-dashboard-parser.d.ts +1 -1
  198. package/dist/graph-edge-reinforcement.d.ts +1 -1
  199. package/dist/graph-snapshot.d.ts +1 -1
  200. package/dist/graph.d.ts +1 -1
  201. package/dist/importance.d.ts +1 -1
  202. package/dist/importers/index.d.ts +1 -1
  203. package/dist/in-flight-reads.d.ts +1 -1
  204. package/dist/index.d.ts +409 -407
  205. package/dist/index.js +147 -141
  206. package/dist/intent.d.ts +1 -1
  207. package/dist/lcm/engine.d.ts +1 -1
  208. package/dist/lcm/engine.js +3 -3
  209. package/dist/lcm/index.d.ts +1 -1
  210. package/dist/lcm/index.js +9 -9
  211. package/dist/lcm/tools.d.ts +1 -1
  212. package/dist/lifecycle.d.ts +1 -1
  213. package/dist/live-connectors-runner.d.ts +1 -1
  214. package/dist/local-llm.d.ts +1 -1
  215. package/dist/local-model-endpoint.d.ts +1 -1
  216. package/dist/maintenance/memory-governance.d.ts +1 -1
  217. package/dist/maintenance/memory-governance.js +12 -10
  218. package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +3 -2
  219. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +12 -10
  220. package/dist/maintenance/rebuild-memory-projection.d.ts +3 -2
  221. package/dist/maintenance/rebuild-memory-projection.js +13 -11
  222. package/dist/{maintenance-DD22oIx9.d.ts → maintenance-DveW6azo.d.ts} +3 -3
  223. package/dist/mcp-memory-inspector-app.d.ts +13 -10
  224. package/dist/memory-action-policy.d.ts +1 -1
  225. package/dist/memory-cache.d.ts +1 -1
  226. package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
  227. package/dist/memory-projection-mutations.d.ts +4 -0
  228. package/dist/memory-projection-mutations.js +15 -0
  229. package/dist/memory-projection-mutations.js.map +1 -0
  230. package/dist/memory-projection-store.d.ts +1 -1
  231. package/dist/memory-provenance.d.ts +1 -1
  232. package/dist/memory-worth-outcomes.d.ts +3 -2
  233. package/dist/models-json.d.ts +1 -1
  234. package/dist/namespaces/migrate.d.ts +4 -3
  235. package/dist/namespaces/migrate.js +22 -20
  236. package/dist/namespaces/principal.d.ts +1 -1
  237. package/dist/namespaces/search.d.ts +1 -1
  238. package/dist/namespaces/search.js +9 -9
  239. package/dist/namespaces/storage.d.ts +4 -3
  240. package/dist/namespaces/storage.js +12 -10
  241. package/dist/native-knowledge.d.ts +1 -1
  242. package/dist/offline-sync-impression-drain.d.ts +1 -1
  243. package/dist/offline-sync-impression-drain.js +3 -3
  244. package/dist/operator-doctor-corpus.d.ts +22 -3
  245. package/dist/operator-doctor-corpus.js +32 -22
  246. package/dist/operator-doctor-replica.d.ts +52 -0
  247. package/dist/operator-doctor-replica.js +15 -0
  248. package/dist/operator-doctor-replica.js.map +1 -0
  249. package/dist/operator-toolkit.d.ts +7 -3
  250. package/dist/operator-toolkit.js +33 -27
  251. package/dist/orchestration/compression-guideline-coordinator.d.ts +3 -2
  252. package/dist/orchestration/maintenance.d.ts +5 -4
  253. package/dist/orchestration/maintenance.js +17 -15
  254. package/dist/{orchestrator-CFJ_TG6D.d.ts → orchestrator-Cvlgpe6I.d.ts} +7 -7
  255. package/dist/orchestrator.d.ts +9 -8
  256. package/dist/orchestrator.js +99 -93
  257. package/dist/patterns-cli.d.ts +1 -1
  258. package/dist/{pipeline-Bq5zU6Bp.d.ts → pipeline-BveYVaz7.d.ts} +1 -1
  259. package/dist/policy-runtime.d.ts +1 -1
  260. package/dist/proactive-contention.d.ts +1 -1
  261. package/dist/provenance.d.ts +1 -1
  262. package/dist/{qmd-3ILJkC70.d.ts → qmd-CLWDsbYR.d.ts} +1 -1
  263. package/dist/qmd-preflight.d.ts +2 -2
  264. package/dist/qmd-recall-cache.d.ts +1 -1
  265. package/dist/qmd.d.ts +2 -2
  266. package/dist/recall-concurrency-config.d.ts +1 -1
  267. package/dist/recall-disclosure-escalation.d.ts +1 -1
  268. package/dist/recall-explain-renderer.d.ts +1 -1
  269. package/dist/recall-explain-renderer.js +3 -3
  270. package/dist/recall-memory-map.d.ts +1 -1
  271. package/dist/recall-planner-llm.d.ts +1 -1
  272. package/dist/recall-state.d.ts +1 -1
  273. package/dist/recall-state.js +2 -2
  274. package/dist/recall-tag-filter.d.ts +1 -1
  275. package/dist/recall-timings.d.ts +1 -1
  276. package/dist/recall-xray-cli.d.ts +1 -1
  277. package/dist/recall-xray-cli.js +4 -4
  278. package/dist/recall-xray-renderer.d.ts +1 -1
  279. package/dist/recall-xray-renderer.js +3 -3
  280. package/dist/recall-xray.d.ts +1 -1
  281. package/dist/recall-xray.js +2 -2
  282. package/dist/replay/normalizers/chatgpt.d.ts +1 -1
  283. package/dist/replay/normalizers/claude.d.ts +1 -1
  284. package/dist/replay/normalizers/openclaw.d.ts +1 -1
  285. package/dist/replay/normalizers/shared.d.ts +1 -1
  286. package/dist/replay/runner.d.ts +1 -1
  287. package/dist/replay/types.d.ts +1 -1
  288. package/dist/replica-divergence.d.ts +279 -0
  289. package/dist/replica-divergence.js +28 -0
  290. package/dist/replica-divergence.js.map +1 -0
  291. package/dist/replica-peers-config.d.ts +5 -0
  292. package/dist/replica-peers-config.js +13 -0
  293. package/dist/replica-peers-config.js.map +1 -0
  294. package/dist/resolve-auth-token.d.ts +21 -2
  295. package/dist/resolve-auth-token.js +5 -1
  296. package/dist/resume-bundles.js +5 -3
  297. package/dist/retrieval-agents.d.ts +2 -2
  298. package/dist/retrieval-tiers.d.ts +1 -1
  299. package/dist/routing/engine.d.ts +1 -1
  300. package/dist/routing/store.d.ts +1 -1
  301. package/dist/salvage-envelope.d.ts +1 -1
  302. package/dist/schemas.d.ts +76 -76
  303. package/dist/{scope-profiles-D0-ff4xT.d.ts → scope-profiles-BVf3DZ7z.d.ts} +1 -1
  304. package/dist/search/embed-helper.d.ts +1 -1
  305. package/dist/search/factory.d.ts +1 -1
  306. package/dist/search/factory.js +8 -8
  307. package/dist/search/index.d.ts +1 -1
  308. package/dist/search/index.js +13 -13
  309. package/dist/search/lancedb-backend.d.ts +1 -1
  310. package/dist/search/lancedb-backend.js +2 -2
  311. package/dist/search/meilisearch-backend.d.ts +1 -1
  312. package/dist/search/meilisearch-backend.js +2 -2
  313. package/dist/search/noop-backend.d.ts +1 -1
  314. package/dist/search/orama-backend.d.ts +1 -1
  315. package/dist/search/orama-backend.js +2 -2
  316. package/dist/search/port.d.ts +1 -1
  317. package/dist/search/remote-backend.d.ts +1 -1
  318. package/dist/{semantic-consolidation-4Tfh7c1g.d.ts → semantic-consolidation-DXLV47y2.d.ts} +1 -1
  319. package/dist/semantic-consolidation.d.ts +2 -2
  320. package/dist/semantic-consolidation.js +13 -11
  321. package/dist/semantic-rule-promotion.js +12 -10
  322. package/dist/semantic-rule-verifier.d.ts +1 -1
  323. package/dist/semantic-rule-verifier.js +12 -10
  324. package/dist/{service-Z8uzoAST.d.ts → service-DbgPTeMJ.d.ts} +2 -2
  325. package/dist/session-observer-bands.d.ts +1 -1
  326. package/dist/session-observer-state.d.ts +1 -1
  327. package/dist/shared-context/manager.d.ts +9 -9
  328. package/dist/signal.d.ts +1 -1
  329. package/dist/{storage-BZVMn8yJ.d.ts → storage-DOzTm8wG.d.ts} +13 -22
  330. package/dist/storage.d.ts +3 -2
  331. package/dist/storage.js +13 -10
  332. package/dist/summarizer.d.ts +1 -1
  333. package/dist/summary-snapshot.d.ts +1 -1
  334. package/dist/temporal-supersession.d.ts +3 -2
  335. package/dist/temporal-timeline-recall.d.ts +1 -1
  336. package/dist/temporal-validity.d.ts +1 -1
  337. package/dist/threading.d.ts +1 -1
  338. package/dist/tier-migration.d.ts +3 -2
  339. package/dist/tier-routing.d.ts +1 -1
  340. package/dist/topics.d.ts +1 -1
  341. package/dist/transcript.d.ts +1 -1
  342. package/dist/transfer/autodetect.js +1 -1
  343. package/dist/transfer/backup.js +2 -2
  344. package/dist/transfer/capsule-export.js +3 -3
  345. package/dist/transfer/capsule-import.js +2 -2
  346. package/dist/transfer/types.d.ts +66 -66
  347. package/dist/trust-score-stage.d.ts +1 -1
  348. package/dist/trust-score.d.ts +1 -1
  349. package/dist/{types-DHBxIF0s.d.ts → types-BA7W-_xy.d.ts} +53 -4
  350. package/dist/types.d.ts +1 -1
  351. package/dist/types.js +1 -1
  352. package/dist/utility-runtime.d.ts +1 -1
  353. package/dist/verified-recall.js +12 -10
  354. package/dist/write-envelope.d.ts +1 -1
  355. package/package.json +2 -2
  356. package/src/access-health-types.ts +8 -0
  357. package/src/access-http.test.ts +4 -0
  358. package/src/access-service-health.test.ts +23 -0
  359. package/src/access-service.ts +27 -4
  360. package/src/cli.ts +9 -7
  361. package/src/config.ts +2 -1
  362. package/src/corpus-watermark.test.ts +21 -0
  363. package/src/corpus-watermark.ts +25 -3
  364. package/src/entity-id-normalization.ts +55 -0
  365. package/src/entity-retrieval-boundaries.ts +134 -0
  366. package/src/entity-retrieval.ts +253 -27
  367. package/src/entity-schema.ts +2 -1
  368. package/src/memory-projection-mutations.ts +132 -0
  369. package/src/namespaces/storage.ts +5 -3
  370. package/src/operator-doctor-corpus.ts +41 -0
  371. package/src/operator-doctor-replica.test.ts +261 -0
  372. package/src/operator-doctor-replica.ts +129 -0
  373. package/src/operator-toolkit.ts +5 -4
  374. package/src/orchestration/orchestrator-init.ts +2 -2
  375. package/src/replica-divergence.test.ts +1475 -0
  376. package/src/replica-divergence.ts +910 -0
  377. package/src/replica-peers-config.ts +250 -0
  378. package/src/resolve-auth-token.ts +38 -0
  379. package/src/storage/entity-canonical-id-migration-adapter.ts +72 -0
  380. package/src/storage/entity-canonical-id-migration-runner.ts +68 -0
  381. package/src/storage/entity-canonical-id-migration.ts +904 -0
  382. package/src/storage/entity-store.ts +44 -0
  383. package/src/storage/memory-frontmatter-metadata.ts +17 -0
  384. package/src/storage/memory-migration-serialization.ts +37 -0
  385. package/src/storage/memory-read-store.ts +3 -2
  386. package/src/storage/profile-header.ts +898 -0
  387. package/src/storage-profile-timestamp.test.ts +3358 -0
  388. package/src/storage.ts +73 -77
  389. package/src/testing/subjects/profile-header-write.test.ts +71 -0
  390. package/src/types.ts +3 -3
  391. package/dist/chunk-2XP3PWL3.js.map +0 -1
  392. package/dist/chunk-4DJQYKMN.js.map +0 -1
  393. package/dist/chunk-E6EAB4J6.js.map +0 -1
  394. package/dist/chunk-EXM2Q555.js.map +0 -1
  395. package/dist/chunk-GJJBPI6I.js.map +0 -1
  396. package/dist/chunk-KPWLZBXZ.js.map +0 -1
  397. package/dist/chunk-LIIQPDFN.js.map +0 -1
  398. package/dist/chunk-UZK7VVPD.js.map +0 -1
  399. package/dist/chunk-V25OWXAC.js.map +0 -1
  400. package/dist/chunk-YN4AUGNF.js.map +0 -1
  401. /package/dist/{capsule-crypto-YO5QJ6L3.js.map → capsule-crypto-7FJQINUR.js.map} +0 -0
  402. /package/dist/{chunk-7RZJWZ46.js.map → chunk-227UFSEQ.js.map} +0 -0
  403. /package/dist/{chunk-VGEH3STZ.js.map → chunk-2BEJ4XCF.js.map} +0 -0
  404. /package/dist/{chunk-BXLOS5AJ.js.map → chunk-2NLLXCJG.js.map} +0 -0
  405. /package/dist/{chunk-6NNNURLK.js.map → chunk-2PHX3I5C.js.map} +0 -0
  406. /package/dist/{chunk-XAAIUXJO.js.map → chunk-3BSJBIZ3.js.map} +0 -0
  407. /package/dist/{chunk-JCVQV6QX.js.map → chunk-3UOSVTFR.js.map} +0 -0
  408. /package/dist/{chunk-AJ7QCSIS.js.map → chunk-7CPOZH6Y.js.map} +0 -0
  409. /package/dist/{chunk-M2KGXXTL.js.map → chunk-ALTP3MFS.js.map} +0 -0
  410. /package/dist/{chunk-77CNV7DY.js.map → chunk-BLAKS3CP.js.map} +0 -0
  411. /package/dist/{chunk-FE5FKTCI.js.map → chunk-BR4UFMLO.js.map} +0 -0
  412. /package/dist/{chunk-H2PBM562.js.map → chunk-DKQM5Q6Q.js.map} +0 -0
  413. /package/dist/{chunk-CSXHRAJJ.js.map → chunk-EG64LXKL.js.map} +0 -0
  414. /package/dist/{chunk-PTN6UAUA.js.map → chunk-ES36HTSC.js.map} +0 -0
  415. /package/dist/{chunk-WMDRLTNA.js.map → chunk-EZWWCN7I.js.map} +0 -0
  416. /package/dist/{chunk-XKGPIWGI.js.map → chunk-FBZTWUK5.js.map} +0 -0
  417. /package/dist/{chunk-Y6E37WRG.js.map → chunk-GJPCP5CA.js.map} +0 -0
  418. /package/dist/{chunk-VDX2J7OX.js.map → chunk-IPLYGWQF.js.map} +0 -0
  419. /package/dist/{chunk-XNUBF6RF.js.map → chunk-IYT632D5.js.map} +0 -0
  420. /package/dist/{chunk-2QSZNTDO.js.map → chunk-JBPKEARU.js.map} +0 -0
  421. /package/dist/{chunk-67DSDRUB.js.map → chunk-JIF3VRKQ.js.map} +0 -0
  422. /package/dist/{chunk-MIFF37NN.js.map → chunk-KKBTBUVT.js.map} +0 -0
  423. /package/dist/{chunk-ZHP4SUPB.js.map → chunk-LIHC3T43.js.map} +0 -0
  424. /package/dist/{chunk-UGH6VPPO.js.map → chunk-MWTMTW2T.js.map} +0 -0
  425. /package/dist/{chunk-F6LSNPPB.js.map → chunk-MXJ3VP6S.js.map} +0 -0
  426. /package/dist/{chunk-M5EPMNS4.js.map → chunk-P2CLYN6H.js.map} +0 -0
  427. /package/dist/{chunk-KGTD2KZJ.js.map → chunk-Q6YJW6KE.js.map} +0 -0
  428. /package/dist/{chunk-X3SQYAPP.js.map → chunk-R372P2EH.js.map} +0 -0
  429. /package/dist/{chunk-HBVOJNV4.js.map → chunk-RKXZ7P4V.js.map} +0 -0
  430. /package/dist/{chunk-RYHWZ52A.js.map → chunk-S2BBISHU.js.map} +0 -0
  431. /package/dist/{chunk-LLISELSY.js.map → chunk-TBMRQZDY.js.map} +0 -0
  432. /package/dist/{chunk-FMLKOL2Z.js.map → chunk-TC3VNKGX.js.map} +0 -0
  433. /package/dist/{chunk-7K5Q6COX.js.map → chunk-TVVEYCNW.js.map} +0 -0
  434. /package/dist/{chunk-NKDVXEFU.js.map → chunk-VFNI3RPT.js.map} +0 -0
  435. /package/dist/{chunk-PQPSZICJ.js.map → chunk-VYYNBJXH.js.map} +0 -0
  436. /package/dist/{chunk-SN3ZESWQ.js.map → chunk-WVVK2RFM.js.map} +0 -0
  437. /package/dist/{chunk-DQEMWVMT.js.map → chunk-X7Y7WX73.js.map} +0 -0
  438. /package/dist/{chunk-4KKV7W62.js.map → chunk-YOBNCD3Z.js.map} +0 -0
  439. /package/dist/{chunk-SK3EYPKC.js.map → chunk-ZN4UZWMT.js.map} +0 -0
  440. /package/dist/{first-start-migration-LEXL3XYL.js.map → first-start-migration-BKNGOFED.js.map} +0 -0
package/src/storage.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { readProjectionRebuiltAt } from "./maintenance/projection-support.js";
2
2
  import {
3
- access,
4
3
  lstat,
5
4
  readdir,
6
5
  readFile,
@@ -9,7 +8,6 @@ import {
9
8
  writeFile,
10
9
  mkdir,
11
10
  unlink,
12
- rename,
13
11
  appendFile,
14
12
  open,
15
13
  } from "node:fs/promises";
@@ -20,6 +18,7 @@ import path from "node:path";
20
18
  import { log } from "./logger.js";
21
19
  import { assertMemoryFrontmatterId, warnProjectionFallback } from "./storage-guards.js";
22
20
  import { MemoryReadStore } from "./storage/memory-read-store.js";
21
+ import { renderProfileWithLastUpdated } from "./storage/profile-header.js";
23
22
  import { readMaybeEncryptedLines, readMemoryActionEventRowsFromLines } from "./storage/secure-line-reader.js";
24
23
  import {
25
24
  appendLifecycleEventsSerialized,
@@ -34,10 +33,17 @@ import {
34
33
  import { selfDeps } from "./orchestration/self-deps.js";
35
34
  import { EntityStore } from "./storage/entity-store.js";
36
35
  import { IdentityContinuityStore } from "./storage/identity-continuity-store.js";
36
+ import * as entityMigration from "./storage/entity-canonical-id-migration.js";
37
+ import {
38
+ runLegacyEntityCanonicalIdMigration,
39
+ type EntityCanonicalIdMigrationHost,
40
+ } from "./storage/entity-canonical-id-migration-adapter.js";
41
+ import { EntityCanonicalIdMigrationRunner } from "./storage/entity-canonical-id-migration-runner.js";
42
+ import { rememberRawFrontmatter } from "./storage/memory-frontmatter-metadata.js";
43
+ import { createMemoryEntityRefSerializer } from "./storage/memory-migration-serialization.js";
44
+ export { normalizeEntityName } from "./entity-id-normalization.js";
37
45
  import { isErrnoCode } from "./utils/errno.js";
38
- import { withHeldFileLock } from "./utils/serialize-mutations.js";
39
- import { RECALL_FALLBACK_DIRS, getCategoryDir, categoryDirName } from "./utils/category-dir.js";
40
- import { assertPathInsideRoot } from "./utils/path-containment.js";
46
+ import { getCategoryDir, categoryDirName } from "./utils/category-dir.js";
41
47
  import { decodeYamlScalar } from "./utils/yaml-scalar.js";
42
48
  import {
43
49
  qmdCollectionPathParts,
@@ -1094,52 +1100,6 @@ function inferCurrentStateStatus(
1094
1100
  return inferMemoryStatus(frontmatter, pathRel, fallbackStatus);
1095
1101
  }
1096
1102
 
1097
- /** Built-in aliases for common structural normalizations (no personal data) */
1098
- const BUILTIN_ALIASES: Record<string, string> = {
1099
- openclaw: "openclaw",
1100
- "open-claw": "openclaw",
1101
- };
1102
-
1103
- /**
1104
- * Normalize an entity name to a canonical form.
1105
- * Strips non-alphanumeric chars, collapses hyphens, removes type prefix duplication.
1106
- * e.g. "My Project" → "my-project"
1107
- *
1108
- * Checks caller-provided user aliases first, then built-in aliases. Alias
1109
- * tables are instance state on StorageManager (issue #1534) — use
1110
- * `storageManager.normalizeEntityName(raw, type)` when normalizing within a
1111
- * store, or pass `storageManager.entityAliases` explicitly. Without an
1112
- * aliases argument only the built-in structural aliases apply.
1113
- */
1114
- export function normalizeEntityName(raw: string, type: string, aliases?: Readonly<Record<string, string>>): string {
1115
- // Strip type prefix if present (e.g. name="person-jane-doe", type="person")
1116
- const rawStr = typeof raw === "string" ? raw : "";
1117
- const typeStr = typeof type === "string" && type.trim().length > 0 ? type : "entity";
1118
-
1119
- let name = rawStr.toLowerCase().trim();
1120
- const typePrefix = `${typeStr.toLowerCase()}-`;
1121
- if (name.startsWith(typePrefix)) {
1122
- name = name.slice(typePrefix.length);
1123
- }
1124
-
1125
- // Replace non-alphanumeric with hyphens, collapse multiples, trim edges
1126
- let normalized = name
1127
- .replace(/[^a-z0-9]+/g, "-")
1128
- .replace(/-+/g, "-")
1129
- .replace(/^-|-$/g, "");
1130
-
1131
- // Check caller-provided user aliases first, then built-in. Own-property and
1132
- // string guards keep inherited object keys (e.g. an entity literally named
1133
- // "constructor") and malformed alias values from corrupting canonical ids.
1134
- const userAlias = aliases !== undefined && Object.hasOwn(aliases, normalized) ? aliases[normalized] : undefined;
1135
- if (typeof userAlias === "string" && userAlias.length > 0) {
1136
- normalized = userAlias;
1137
- } else if (Object.hasOwn(BUILTIN_ALIASES, normalized)) {
1138
- normalized = BUILTIN_ALIASES[normalized];
1139
- }
1140
-
1141
- return `${typeStr.toLowerCase()}-${normalized}`;
1142
- }
1143
1103
 
1144
1104
  /**
1145
1105
  * Simple Levenshtein distance between two strings.
@@ -2134,24 +2094,39 @@ export class StorageManager {
2134
2094
  * Set or clear the at-rest encryption key.
2135
2095
  *
2136
2096
  * Pass a 32-byte Buffer to enable encryption; pass null to clear
2137
- * (lock) the store. The caller is responsible for key lifecycle —
2097
+ * (lock) the store. The caller is responsible for key lifecycle —
2138
2098
  * this method does not zero the buffer on replacement; the keyring
2139
- * module (`keyring.ts`) owns zeroization.
2099
+ * module (`keyring.ts`) owns zeroization. The setter remains synchronous
2100
+ * for existing consumers; call `setSecureStoreKeyAndWait` when unlock must
2101
+ * await migration.
2140
2102
  */
2141
2103
  setSecureStoreKey(key: Buffer | null, encryptOnWrite = true): void {
2104
+ if (!this.applySecureStoreKey(key, encryptOnWrite) || key === null) return;
2105
+ void this.entityCanonicalIdMigration.triggerAfterUnlock().catch((error: unknown) => {
2106
+ log.warn(
2107
+ `secure-store unlock migration failed: ${error instanceof Error ? error.message : String(error)}`,
2108
+ );
2109
+ });
2110
+ }
2111
+
2112
+ public async setSecureStoreKeyAndWait(key: Buffer | null, encryptOnWrite = true): Promise<void> {
2113
+ if (!this.applySecureStoreKey(key, encryptOnWrite) || key === null) return;
2114
+ await this.entityCanonicalIdMigration.triggerAfterUnlock();
2115
+ }
2116
+
2117
+ private applySecureStoreKey(key: Buffer | null, encryptOnWrite: boolean): boolean {
2118
+ const sameKey =
2119
+ this._secureStoreKey === key ||
2120
+ (this._secureStoreKey !== null && key !== null && this._secureStoreKey.equals(key));
2121
+ if (sameKey && this._secureStoreEncryptOnWrite === encryptOnWrite) return false;
2122
+
2142
2123
  this._secureStoreKey = key;
2143
2124
  this._secureStoreEncryptOnWrite = encryptOnWrite;
2144
- // Route through the invalidation chokepoint (issue #1535): a key change
2145
- // (or store lock) must evict every cache layer that may hold content
2146
- // decrypted under the previous key, not just the entity layer.
2147
2125
  invalidateAllForDir(this.baseDir);
2148
2126
  this.invalidateKnowledgeIndexCache();
2149
- // A key change flips resolveWriteKey(), so a file's plain/encrypted class on
2150
- // the next full rewrite may differ from what was cached (issue #1909).
2151
2127
  this.secureFileEncryptionSniffCache.clear();
2152
- // Same rationale for the behavior-signals dedup key cache (issue #1909):
2153
- // drop it on a key change so a re-encrypted/re-decrypted ledger is reloaded.
2154
2128
  this.behaviorSignalsKeyCache = null;
2129
+ return true;
2155
2130
  }
2156
2131
 
2157
2132
  private getEntityCacheSecureStoreKey(): string {
@@ -2339,6 +2314,7 @@ export class StorageManager {
2339
2314
  // loadAliases() explicitly — every creation path must still get the
2340
2315
  // store's own aliases, never an empty or foreign table.
2341
2316
  this.loadAliasesSync();
2317
+ this.loadHistoricalEntityCanonicalIdsSync();
2342
2318
  }
2343
2319
 
2344
2320
  /** Set the process-wide hot-memories cache default (issue #1902). The
@@ -3596,9 +3572,17 @@ export class StorageManager {
3596
3572
  * store loaded last rewrite every other store's canonical entity ids.
3597
3573
  */
3598
3574
  private userAliases: Record<string, string> = {};
3599
-
3575
+ private historicalEntityCanonicalIds: Readonly<Record<string, string>> = {};
3576
+ private readonly entityCanonicalIdMigration = new EntityCanonicalIdMigrationRunner(
3577
+ () => !(this._secureStoreRequired && !this.isSecureStoreUnlocked()),
3578
+ () => this.runLegacyEntityCanonicalIdMigration(),
3579
+ () => entityMigration.getFingerprint(this.baseDir, this.entitiesDir, () => this.getCorpusScanVersion()),
3580
+ );
3600
3581
  normalizeEntityName(raw: string, type: string): string {
3601
- return this.entityStore.normalizeEntityName(raw, type);
3582
+ return entityMigration.resolveHistoricalEntityCanonicalId(
3583
+ this.entityStore.normalizeEntityName(raw, type),
3584
+ this.historicalEntityCanonicalIds,
3585
+ );
3602
3586
  }
3603
3587
 
3604
3588
  /**
@@ -3645,8 +3629,24 @@ export class StorageManager {
3645
3629
  log.debug("no config/aliases.json found — using built-in aliases only");
3646
3630
  }
3647
3631
  }
3632
+ private loadHistoricalEntityCanonicalIdsSync(): void {
3633
+ this.historicalEntityCanonicalIds = entityMigration.loadHistoricalEntityCanonicalIds(this.stateDir);
3634
+ }
3635
+
3636
+ private async runLegacyEntityCanonicalIdMigration(): Promise<string> {
3637
+ const completionFingerprint = await runLegacyEntityCanonicalIdMigration(
3638
+ this as unknown as EntityCanonicalIdMigrationHost,
3639
+ (content) => parseEntityFile(content, this.entitySchemas),
3640
+ (entity) => serializeEntityFile(entity, this.entitySchemas),
3641
+ createMemoryEntityRefSerializer(serializeFrontmatter),
3642
+ );
3643
+ this.loadHistoricalEntityCanonicalIdsSync();
3644
+ return completionFingerprint;
3645
+ }
3648
3646
 
3649
3647
  async ensureDirectories(): Promise<void> {
3648
+ await mkdir(this.baseDir, { recursive: true });
3649
+ await entityMigration.validateRoots(this.baseDir, this.entitiesDir, this.stateDir, this.archiveDir);
3650
3650
  const today = new Date().toISOString().slice(0, 10);
3651
3651
  await mkdir(path.join(this.factsDir, today), { recursive: true });
3652
3652
  await mkdir(path.join(this.proceduresDir, today), { recursive: true });
@@ -3661,6 +3661,7 @@ export class StorageManager {
3661
3661
  await mkdir(this.identityAuditsWeeklyDir, { recursive: true });
3662
3662
  await mkdir(this.identityAuditsMonthlyDir, { recursive: true });
3663
3663
  await mkdir(path.join(this.baseDir, "config"), { recursive: true });
3664
+ await this.entityCanonicalIdMigration.ensure();
3664
3665
  // Activate the corpus sentinel at setup (issue #1902, Cursor Medium): an
3665
3666
  // existing corpus predating this feature has a size-0/absent sentinel, which
3666
3667
  // getCachedMemories treats as a miss — so a read-heavy workload would never
@@ -3674,6 +3675,7 @@ export class StorageManager {
3674
3675
  if (this.hotMemoriesCacheEnabled && this.getMemoryCorpusVersion() === 0) {
3675
3676
  this.bumpMemoryCorpusVersion();
3676
3677
  }
3678
+ await this.entityCanonicalIdMigration.markDirectoriesInitialized();
3677
3679
  }
3678
3680
 
3679
3681
  /**
@@ -4251,15 +4253,13 @@ export class StorageManager {
4251
4253
  }
4252
4254
 
4253
4255
  async writeProfile(content: string): Promise<void> {
4256
+ const stampedContent = renderProfileWithLastUpdated(content, new Date().toISOString());
4254
4257
  await this.ensureDirectories();
4255
4258
  await this.snapshotBeforeWrite(this.profilePath, "consolidation");
4256
- await this.writeStorageSecureFile(this.profilePath, content);
4259
+ await this.writeStorageSecureFile(this.profilePath, stampedContent);
4257
4260
  log.debug("updated profile.md");
4258
4261
  }
4259
4262
 
4260
- /**
4261
- * Normalize a string for fuzzy profile dedup: lowercase, strip punctuation, collapse whitespace.
4262
- */
4263
4263
  private static normalizeForDedup(s: string): string {
4264
4264
  if (typeof s !== "string") return "";
4265
4265
  return s
@@ -4308,15 +4308,13 @@ export class StorageManager {
4308
4308
  const content = [
4309
4309
  "# Behavioral Profile",
4310
4310
  "",
4311
- `*Last updated: ${new Date().toISOString()}*`,
4312
- "",
4313
4311
  ...newBullets.map((b) => `- ${b}`),
4314
4312
  "",
4315
4313
  ].join("\n");
4316
4314
  await this.writeProfile(content);
4317
4315
  } else {
4318
- const updatedTimestamp = existing.replace(/\*Last updated:.*\*/, `*Last updated: ${new Date().toISOString()}*`);
4319
- const withBullets = updatedTimestamp.trimEnd() + "\n" + newBullets.map((b) => `- ${b}`).join("\n") + "\n";
4316
+ const withBullets =
4317
+ existing.trimEnd() + "\n" + newBullets.map((b) => `- ${b}`).join("\n") + "\n";
4320
4318
  await this.writeProfile(withBullets);
4321
4319
  }
4322
4320
  }
@@ -4685,7 +4683,7 @@ export class StorageManager {
4685
4683
  const raw = await readMaybeEncryptedFile(fullPath, this._secureStoreKey, this.baseDir);
4686
4684
  const parsed = parseFrontmatter(raw);
4687
4685
  if (!parsed) return null;
4688
- return {
4686
+ return rememberRawFrontmatter({
4689
4687
  path: fullPath,
4690
4688
  frontmatter: normalizeFrontmatterForPath(
4691
4689
  parsed.frontmatter,
@@ -4693,7 +4691,7 @@ export class StorageManager {
4693
4691
  parsed.content
4694
4692
  ),
4695
4693
  content: parsed.content,
4696
- } satisfies MemoryFile;
4694
+ } satisfies MemoryFile, raw);
4697
4695
  } catch (err) {
4698
4696
  // Re-throw store-locked errors so a locked encrypted store fails
4699
4697
  // loudly rather than appearing as an empty memory corpus (Cursor
@@ -4844,7 +4842,7 @@ export class StorageManager {
4844
4842
  const raw = await readMaybeEncryptedFile(fullPath, this._secureStoreKey, this.baseDir);
4845
4843
  const parsed = parseFrontmatter(raw);
4846
4844
  if (parsed) {
4847
- memories.push({
4845
+ memories.push(rememberRawFrontmatter({
4848
4846
  path: fullPath,
4849
4847
  frontmatter: normalizeFrontmatterForPath(
4850
4848
  parsed.frontmatter,
@@ -4852,7 +4850,7 @@ export class StorageManager {
4852
4850
  parsed.content
4853
4851
  ),
4854
4852
  content: parsed.content,
4855
- });
4853
+ }, raw));
4856
4854
  }
4857
4855
  } catch (err) {
4858
4856
  // Re-throw store-locked errors — a locked encrypted store
@@ -6136,9 +6134,6 @@ export class StorageManager {
6136
6134
  this.invalidateKnowledgeIndexCache();
6137
6135
  }
6138
6136
 
6139
- /**
6140
- * Add an alias to an entity file. Deduplicates.
6141
- */
6142
6137
  async addEntityAlias(name: string, alias: string): Promise<void> {
6143
6138
  const filePath = path.join(this.entitiesDir, `${name}.md`);
6144
6139
  let entity: EntityFile;
@@ -6157,6 +6152,7 @@ export class StorageManager {
6157
6152
  entity.updated = new Date().toISOString();
6158
6153
  await this.writeStorageSecureFile(filePath, serializeEntityFile(entity, this.entitySchemas));
6159
6154
  this.invalidateKnowledgeIndexCache();
6155
+ this.bumpMemoryStatusVersion();
6160
6156
  }
6161
6157
 
6162
6158
  async updateEntitySynthesis(
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Profile-header write-boundary subject for the lifecycle scenario matrix.
3
+ * Profile content is not session state, so only the session-end mutation row
4
+ * applies; the remaining canonical rows are explicit skips rather than false
5
+ * extraction-lifecycle coverage.
6
+ */
7
+
8
+ import assert from "node:assert/strict";
9
+
10
+ import { StorageManager } from "../../storage.js";
11
+ import { type LifecycleSubject, type MatrixRow, runLifecycleMatrix } from "../lifecycle-matrix.js";
12
+ import { cleanupDir, mkTempMemoryDir } from "../orchestrator-lite.js";
13
+
14
+ interface ProfileHeaderState {
15
+ dir: string;
16
+ storage: StorageManager;
17
+ writeStartedAt?: number;
18
+ }
19
+
20
+ const STALE_PROFILE = [
21
+ "# Behavioral Profile",
22
+ "",
23
+ "*Last updated: 2024-01-02T03:04:05.000Z*",
24
+ "",
25
+ "- Profile content survives the write boundary.",
26
+ "",
27
+ ].join("\n");
28
+
29
+ const subject: LifecycleSubject<ProfileHeaderState> = {
30
+ appliesTo(row: MatrixRow): boolean | string {
31
+ return row.id === "session-end"
32
+ ? true
33
+ : "profile writes have no provider, restart, or replay variants; direct profile tests cover those boundaries";
34
+ },
35
+
36
+ async setup(row: MatrixRow): Promise<ProfileHeaderState> {
37
+ const dir = await mkTempMemoryDir(`profile-header-${row.id}`);
38
+ try {
39
+ return { dir, storage: new StorageManager(dir) };
40
+ } catch (error) {
41
+ await cleanupDir(dir);
42
+ throw error;
43
+ }
44
+ },
45
+
46
+ async exercise(state: ProfileHeaderState): Promise<void> {
47
+ state.writeStartedAt = Date.now();
48
+ await state.storage.writeProfile(STALE_PROFILE);
49
+ },
50
+
51
+ async invariants(state: ProfileHeaderState): Promise<void> {
52
+ const profile = await state.storage.readProfile();
53
+ const headers = profile.match(/^\*Last updated: .*\*$/gm) ?? [];
54
+ assert.equal(headers.length, 1, "profile writes leave one canonical Last updated header");
55
+ assert.notEqual(headers[0], "*Last updated: 2024-01-02T03:04:05.000Z*");
56
+ assert.match(profile, /^# Behavioral Profile$/m);
57
+
58
+ const timestamp = headers[0]?.match(/^\*Last updated: ([^*]+)\*$/)?.[1];
59
+ assert.ok(timestamp, "the canonical header contains an ISO timestamp");
60
+ const updatedAt = Date.parse(timestamp);
61
+ assert.ok(Number.isFinite(updatedAt), "the profile header timestamp is parseable");
62
+ assert.ok(updatedAt >= (state.writeStartedAt ?? 0), "the header advances at the write boundary");
63
+ assert.ok(updatedAt <= Date.now(), "the header is not in the future");
64
+ },
65
+
66
+ async teardown(state: ProfileHeaderState): Promise<void> {
67
+ await cleanupDir(state.dir);
68
+ },
69
+ };
70
+
71
+ runLifecycleMatrix("profile-header-write", subject);
package/src/types.ts CHANGED
@@ -3,6 +3,7 @@ import type { MeetingsConfig } from "./meetings/types.js";
3
3
  import type { ActivityConfig } from "./activity/types.js";
4
4
  import type { WearablesConfig } from "./wearables/types.js";
5
5
  import type { ExtractionLivenessConfig } from "./extraction-liveness.js";
6
+ import type { ReplicaPeersConfig } from "./replica-peers-config.js";
6
7
 
7
8
  export type ReasoningEffort = "none" | "low" | "medium" | "high";
8
9
  export type TriggerMode = "smart" | "every_n" | "time_based";
@@ -1208,9 +1209,8 @@ export interface PluginConfig extends BoundedJsonlStateConfig {
1208
1209
  dreamsPhases: DreamsPhasesConfig;
1209
1210
  procedural: ProceduralConfig;
1210
1211
  extractionLiveness: ExtractionLivenessConfig;
1211
- /** Claim-level provenance spans (#1575); see `ProvenanceConfig` for defaults.
1212
- * PR 1 parses + persists only; extraction wiring lands in PR 2.
1213
- */
1212
+ replicaPeers: ReplicaPeersConfig;
1213
+ /** Claim-level provenance spans (#1575); see `ProvenanceConfig` for defaults. */
1214
1214
  provenance: ProvenanceConfig;
1215
1215
  /**
1216
1216
  * Wearable transcript ingestion (Limitless / Bee / Omi connectors).