@remnic/core 9.60.1 → 9.60.2

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 (427) hide show
  1. package/dist/access-admin-ops-surface.d.ts +11 -11
  2. package/dist/access-admin-ops-surface.js +25 -25
  3. package/dist/access-authorization-probe.d.ts +11 -11
  4. package/dist/access-authorization-probe.js +26 -26
  5. package/dist/access-boundary.d.ts +11 -11
  6. package/dist/access-boundary.js +25 -25
  7. package/dist/access-cli.js +75 -74
  8. package/dist/access-cli.js.map +1 -1
  9. package/dist/access-coding-context-resolution.d.ts +1 -1
  10. package/dist/access-extraction-force-flush.d.ts +11 -11
  11. package/dist/access-extraction-force-flush.js +25 -25
  12. package/dist/access-health-types.d.ts +1 -1
  13. package/dist/access-http-lcm-compaction.d.ts +11 -11
  14. package/dist/access-http-lifecycle-flush.d.ts +11 -11
  15. package/dist/access-http-offline-stream.d.ts +11 -11
  16. package/dist/access-http-query.js +25 -25
  17. package/dist/access-http.d.ts +12 -12
  18. package/dist/access-http.js +38 -38
  19. package/dist/access-identity-continuity-surface.d.ts +9 -9
  20. package/dist/access-identity-continuity-surface.js +25 -25
  21. package/dist/access-lcm-surface.d.ts +11 -11
  22. package/dist/access-lcm-surface.js +25 -25
  23. package/dist/access-mcp.d.ts +11 -11
  24. package/dist/access-mcp.js +32 -32
  25. package/dist/access-memory-search-fanout.d.ts +2 -2
  26. package/dist/{access-namespace-preflight-TBXz-8s_.d.ts → access-namespace-preflight-EMvicnrb.d.ts} +1 -1
  27. package/dist/access-namespace-preflight.d.ts +3 -3
  28. package/dist/access-namespace-preflight.js +25 -25
  29. package/dist/access-observe-write-surface.d.ts +11 -11
  30. package/dist/access-observe-write-surface.js +25 -25
  31. package/dist/access-offline-manifest.d.ts +9 -9
  32. package/dist/access-operations-batch.js +27 -27
  33. package/dist/access-operations.d.ts +14 -14
  34. package/dist/access-operations.js +31 -31
  35. package/dist/access-recall-concurrency.d.ts +11 -11
  36. package/dist/access-recall-concurrency.js +25 -25
  37. package/dist/access-recall-response.d.ts +11 -11
  38. package/dist/access-recall-response.js +25 -25
  39. package/dist/access-recall-surface.d.ts +11 -11
  40. package/dist/access-recall-surface.js +25 -25
  41. package/dist/access-schema.d.ts +88 -88
  42. package/dist/access-schema.js +3 -3
  43. package/dist/{access-service-BogiG4Dy.d.ts → access-service-BeDYQQ62.d.ts} +71 -71
  44. package/dist/access-service-helpers.d.ts +11 -11
  45. package/dist/access-service.d.ts +11 -11
  46. package/dist/access-service.js +25 -25
  47. package/dist/access-surface-catalog.d.ts +11 -11
  48. package/dist/access-surface-catalog.js +27 -27
  49. package/dist/access-wearables-meetings-surface.d.ts +3 -3
  50. package/dist/action-confidence.d.ts +1 -1
  51. package/dist/active-memory-bridge.d.ts +1 -1
  52. package/dist/active-recall.d.ts +1 -1
  53. package/dist/adapters/index.js +4 -4
  54. package/dist/adapters/registry.js +2 -2
  55. package/dist/ambient-provenance.d.ts +1 -1
  56. package/dist/artifact-search.d.ts +1 -1
  57. package/dist/behavior-learner.d.ts +1 -1
  58. package/dist/behavior-signals.d.ts +1 -1
  59. package/dist/bootstrap.d.ts +9 -9
  60. package/dist/briefing-window.d.ts +2 -2
  61. package/dist/briefing.d.ts +2 -2
  62. package/dist/briefing.js +11 -11
  63. package/dist/buffer-surprise-report.d.ts +1 -1
  64. package/dist/buffer-turn-helpers.d.ts +1 -1
  65. package/dist/buffer.d.ts +2 -2
  66. package/dist/buffer.js +4 -4
  67. package/dist/bulk-import/index.d.ts +3 -3
  68. package/dist/calibration.d.ts +1 -1
  69. package/dist/capabilities.d.ts +1 -1
  70. package/dist/{capsule-crypto-GWVG7LGC.js → capsule-crypto-7FJQINUR.js} +2 -2
  71. package/dist/{catalog-z1UerMbh.d.ts → catalog-B2SxZ6LU.d.ts} +1 -1
  72. package/dist/causal-behavior.d.ts +1 -1
  73. package/dist/causal-consolidation.d.ts +1 -1
  74. package/dist/causal-consolidation.js +12 -12
  75. package/dist/causal-trajectory-graph.d.ts +1 -1
  76. package/dist/{chunk-7DHFB5SG.js → chunk-2GRLJMKJ.js} +3 -3
  77. package/dist/{chunk-OWHERGF2.js → chunk-2NLLXCJG.js} +2 -2
  78. package/dist/{chunk-VUJN44CT.js → chunk-2RIDW23Y.js} +7 -7
  79. package/dist/{chunk-VOKK4WCG.js → chunk-3GPBFDXH.js} +2 -2
  80. package/dist/{chunk-KXYMU4IN.js → chunk-4JGSG7QN.js} +3 -3
  81. package/dist/{chunk-A7266TRJ.js → chunk-4XAVQLBR.js} +2 -2
  82. package/dist/{chunk-LLZKOSGM.js → chunk-5WVUO6QT.js} +1 -1
  83. package/dist/{chunk-LLZKOSGM.js.map → chunk-5WVUO6QT.js.map} +1 -1
  84. package/dist/{chunk-UBSM6TZP.js → chunk-76YNCJ5H.js} +2 -2
  85. package/dist/{chunk-JNWISMYG.js → chunk-7N7DB4L5.js} +5 -5
  86. package/dist/{chunk-6C7Q6NG3.js → chunk-AWRJBAIH.js} +16 -16
  87. package/dist/{chunk-GKHMV2KK.js → chunk-C3R732UY.js} +51 -32
  88. package/dist/chunk-C3R732UY.js.map +1 -0
  89. package/dist/{chunk-DE6YCZEE.js → chunk-CIA6ZUBA.js} +2 -2
  90. package/dist/{chunk-PEDYKCJI.js → chunk-CK3NQUSQ.js} +2 -2
  91. package/dist/{chunk-OU7RWWW6.js → chunk-CM4SZZBN.js} +2 -2
  92. package/dist/{chunk-ODAE36PG.js → chunk-D5HDJWNN.js} +2 -2
  93. package/dist/{chunk-4CLE2LXB.js → chunk-EGW4O32Z.js} +75 -38
  94. package/dist/chunk-EGW4O32Z.js.map +1 -0
  95. package/dist/{chunk-KF75ANST.js → chunk-EHMMRZOZ.js} +2 -2
  96. package/dist/{chunk-7G34CBKS.js → chunk-EIQFIJDM.js} +2 -2
  97. package/dist/{chunk-YNDLCWXS.js → chunk-EZ25VE3G.js} +4 -4
  98. package/dist/{chunk-G3JFFUKR.js → chunk-FW73HN33.js} +2 -2
  99. package/dist/{chunk-MMZK2DWN.js → chunk-G3YBWFUC.js} +1 -1
  100. package/dist/chunk-GKUA4MGB.js +40 -0
  101. package/dist/chunk-GKUA4MGB.js.map +1 -0
  102. package/dist/{chunk-I4BLRM7X.js → chunk-GN7HO2LA.js} +10 -10
  103. package/dist/{chunk-ZOGOOSB3.js → chunk-H32ANIFP.js} +2 -2
  104. package/dist/{chunk-AH2NX6S7.js → chunk-HEEEMJ26.js} +3 -3
  105. package/dist/{chunk-J65AKOD6.js → chunk-HQBVQICL.js} +2 -2
  106. package/dist/{chunk-VJXSAJFW.js → chunk-I67HKRBF.js} +2 -2
  107. package/dist/{chunk-RKNJBZ55.js → chunk-JBPKEARU.js} +4 -4
  108. package/dist/{chunk-R7IV3EUJ.js → chunk-JKW663ZN.js} +2 -2
  109. package/dist/{chunk-YBCZTBN2.js → chunk-KAB7TZN3.js} +2 -2
  110. package/dist/{chunk-4UUF2EX3.js → chunk-KPML4Q3M.js} +2 -2
  111. package/dist/{chunk-5W7CTZ2E.js → chunk-KQAFEZQX.js} +4 -4
  112. package/dist/{chunk-YKZFX2HQ.js → chunk-L33N3BCA.js} +2 -2
  113. package/dist/{chunk-PYHOAXTI.js → chunk-LRGSLV7M.js} +4 -4
  114. package/dist/{chunk-FI5EAP4N.js → chunk-MJ4UGUR6.js} +2 -2
  115. package/dist/{chunk-KBIIE57I.js → chunk-MU3TPZOV.js} +2 -2
  116. package/dist/{chunk-77DAFTUU.js → chunk-MYZ4NA43.js} +2 -2
  117. package/dist/{chunk-T2VJ2EO5.js → chunk-N4EPIKSY.js} +6 -6
  118. package/dist/{chunk-EZXGJJXM.js → chunk-N4OYPGZS.js} +2 -2
  119. package/dist/{chunk-L3JVAM5Q.js → chunk-PA5OPZX2.js} +2 -2
  120. package/dist/{chunk-RVO6TCTU.js → chunk-QCECHYZL.js} +6 -6
  121. package/dist/{chunk-2HGV44MM.js → chunk-QRKYABS6.js} +2 -2
  122. package/dist/{chunk-P6GOYLHN.js → chunk-QWPAQLYV.js} +2 -2
  123. package/dist/{chunk-BTHDQOF4.js → chunk-QYN5PXDZ.js} +5 -5
  124. package/dist/{chunk-MG7GI4TT.js → chunk-S3B3UIQ3.js} +2 -2
  125. package/dist/{chunk-6W2ISYUV.js → chunk-TE4MKFT2.js} +4 -4
  126. package/dist/{chunk-QUJC22CT.js → chunk-URN7XWGC.js} +2 -2
  127. package/dist/{chunk-G5OB4XZX.js → chunk-VANZKHTN.js} +4 -4
  128. package/dist/{chunk-BPM6UHUL.js → chunk-VWDTV6SH.js} +2 -2
  129. package/dist/{chunk-P5OYNV7B.js → chunk-W3Y6FYRK.js} +2 -2
  130. package/dist/{chunk-VIM6QH4D.js → chunk-W4Q54HM3.js} +2 -2
  131. package/dist/{chunk-UVYI6VIX.js → chunk-X7Y7WX73.js} +1 -1
  132. package/dist/{chunk-FUWS2MNJ.js → chunk-XBR5BAKW.js} +4 -4
  133. package/dist/{chunk-XU4OLEYW.js → chunk-XD4VGLDL.js} +45 -45
  134. package/dist/{chunk-OV36CROW.js → chunk-XDK6ZFLL.js} +3 -3
  135. package/dist/{chunk-JHMAYABJ.js → chunk-XL3TATMJ.js} +4 -4
  136. package/dist/{chunk-OLX2HJFW.js → chunk-YLHM5BQQ.js} +4 -4
  137. package/dist/{chunk-2VHCLHZ5.js → chunk-YUIBXMZY.js} +147 -40
  138. package/dist/chunk-YUIBXMZY.js.map +1 -0
  139. package/dist/{cli-CTgFjmDs.d.ts → cli-DB_uakTc.d.ts} +5 -5
  140. package/dist/cli.d.ts +13 -13
  141. package/dist/cli.js +58 -58
  142. package/dist/coding/pre-action-gate.d.ts +1 -1
  143. package/dist/compounding/engine.d.ts +2 -2
  144. package/dist/compounding/engine.js +11 -11
  145. package/dist/compounding/preference-consolidator.d.ts +1 -1
  146. package/dist/compression-optimizer.d.ts +1 -1
  147. package/dist/config.d.ts +1 -1
  148. package/dist/connectors/codex-materialize-runner.d.ts +1 -1
  149. package/dist/connectors/codex-materialize-runner.js +11 -11
  150. package/dist/connectors/codex-materialize.d.ts +1 -1
  151. package/dist/connectors/index.d.ts +1 -1
  152. package/dist/connectors/index.js +11 -11
  153. package/dist/consolidation-provenance-check.d.ts +2 -2
  154. package/dist/consolidation-undo.d.ts +2 -2
  155. package/dist/contradiction/index.d.ts +2 -2
  156. package/dist/contradiction/index.js +4 -4
  157. package/dist/converge-config.d.ts +1 -1
  158. package/dist/convergence-refresh.d.ts +2 -2
  159. package/dist/convergence-refresh.js +13 -13
  160. package/dist/conversation-index/backend.d.ts +1 -1
  161. package/dist/conversation-index/chunker.d.ts +1 -1
  162. package/dist/conversation-index/faiss-adapter.d.ts +1 -1
  163. package/dist/conversation-index/indexer.d.ts +1 -1
  164. package/dist/conversation-index/search.d.ts +1 -1
  165. package/dist/corpus-watermark.d.ts +1 -1
  166. package/dist/corpus-watermark.js +13 -13
  167. package/dist/dashboard-runtime.js +2 -2
  168. package/dist/day-summary.d.ts +1 -1
  169. package/dist/delinearize.d.ts +1 -1
  170. package/dist/dependency-propagation-config.d.ts +1 -1
  171. package/dist/{dependency-propagation-delivery-DdwSc1qh.d.ts → dependency-propagation-delivery-DcOVpK3y.d.ts} +1 -1
  172. package/dist/direct-answer-wiring.d.ts +1 -1
  173. package/dist/direct-answer.d.ts +1 -1
  174. package/dist/embedding-fallback.d.ts +1 -1
  175. package/dist/enrichment/index.d.ts +1 -1
  176. package/dist/entity-origin-fields.d.ts +28 -0
  177. package/dist/entity-origin-fields.js +10 -0
  178. package/dist/entity-origin-fields.js.map +1 -0
  179. package/dist/entity-retrieval.d.ts +2 -2
  180. package/dist/entity-retrieval.js +12 -11
  181. package/dist/entity-schema.d.ts +1 -1
  182. package/dist/explicit-capture.d.ts +9 -9
  183. package/dist/external-wiki-access.d.ts +11 -11
  184. package/dist/external-wiki-access.js +26 -26
  185. package/dist/external-wiki-collection-registration.d.ts +1 -1
  186. package/dist/external-wiki-collection.d.ts +1 -1
  187. package/dist/external-wiki-mcp-tools.d.ts +11 -11
  188. package/dist/extraction-error-classification.d.ts +1 -1
  189. package/dist/extraction-faithfulness.d.ts +1 -1
  190. package/dist/extraction-judge-telemetry.d.ts +1 -1
  191. package/dist/extraction-judge-training.d.ts +1 -1
  192. package/dist/extraction-judge.d.ts +1 -1
  193. package/dist/extraction-liveness.d.ts +1 -1
  194. package/dist/extraction-normalization.d.ts +1 -1
  195. package/dist/extraction-prompt.d.ts +1 -1
  196. package/dist/extraction-source-grounding-rules.d.ts +1 -1
  197. package/dist/extraction-source-grounding.d.ts +1 -1
  198. package/dist/extraction.d.ts +1 -1
  199. package/dist/extraction.js +15 -15
  200. package/dist/fallback-llm.d.ts +1 -1
  201. package/dist/graph-dashboard-diff.d.ts +1 -1
  202. package/dist/graph-dashboard-key.d.ts +1 -1
  203. package/dist/graph-dashboard-parser.d.ts +1 -1
  204. package/dist/graph-edge-reinforcement.d.ts +1 -1
  205. package/dist/graph-path-reconstruction.d.ts +1 -1
  206. package/dist/graph-path-scoring.d.ts +1 -1
  207. package/dist/graph-snapshot.d.ts +1 -1
  208. package/dist/graph.d.ts +1 -1
  209. package/dist/harmonic-retrieval.js +1 -1
  210. package/dist/importance.d.ts +1 -1
  211. package/dist/importers/index.d.ts +1 -1
  212. package/dist/in-flight-reads.d.ts +1 -1
  213. package/dist/index.d.ts +697 -697
  214. package/dist/index.js +85 -84
  215. package/dist/intent.d.ts +1 -1
  216. package/dist/lcm/engine.d.ts +1 -1
  217. package/dist/lcm/index.d.ts +1 -1
  218. package/dist/lcm/index.js +3 -3
  219. package/dist/lcm/tools.d.ts +1 -1
  220. package/dist/lifecycle.d.ts +1 -1
  221. package/dist/live-connectors-runner.d.ts +1 -1
  222. package/dist/local-llm.d.ts +1 -1
  223. package/dist/local-model-endpoint.d.ts +1 -1
  224. package/dist/maintenance/memory-governance.d.ts +1 -1
  225. package/dist/maintenance/memory-governance.js +11 -11
  226. package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +2 -2
  227. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +11 -11
  228. package/dist/maintenance/rebuild-memory-projection.d.ts +2 -2
  229. package/dist/maintenance/rebuild-memory-projection.js +12 -12
  230. package/dist/{maintenance-DvkiF7fm.d.ts → maintenance-5c1olVtB.d.ts} +3 -3
  231. package/dist/mcp-memory-inspector-app.d.ts +11 -11
  232. package/dist/memory-action-policy.d.ts +1 -1
  233. package/dist/memory-cache.d.ts +1 -1
  234. package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
  235. package/dist/memory-projection-store.d.ts +1 -1
  236. package/dist/memory-provenance.d.ts +1 -1
  237. package/dist/memory-snapshot.d.ts +1 -1
  238. package/dist/memory-worth-outcomes.d.ts +2 -2
  239. package/dist/models-json.d.ts +1 -1
  240. package/dist/namespaces/migrate.d.ts +3 -3
  241. package/dist/namespaces/migrate.js +12 -12
  242. package/dist/namespaces/principal.d.ts +1 -1
  243. package/dist/namespaces/search.d.ts +1 -1
  244. package/dist/namespaces/search.js +8 -8
  245. package/dist/namespaces/storage.d.ts +3 -3
  246. package/dist/namespaces/storage.js +11 -11
  247. package/dist/native-knowledge.d.ts +1 -1
  248. package/dist/offline-sync-impression-drain.d.ts +1 -1
  249. package/dist/operator-doctor-corpus.d.ts +1 -1
  250. package/dist/operator-doctor-corpus.js +14 -14
  251. package/dist/operator-doctor-replica.d.ts +1 -1
  252. package/dist/operator-toolkit.d.ts +3 -3
  253. package/dist/operator-toolkit.js +18 -18
  254. package/dist/orchestration/compression-guideline-coordinator.d.ts +2 -2
  255. package/dist/orchestration/maintenance.d.ts +4 -4
  256. package/dist/orchestration/maintenance.js +16 -16
  257. package/dist/{orchestrator-CXPIzs3D.d.ts → orchestrator-HPuY6I4i.d.ts} +8 -8
  258. package/dist/orchestrator.d.ts +9 -9
  259. package/dist/orchestrator.js +75 -74
  260. package/dist/patterns-cli.d.ts +1 -1
  261. package/dist/{pipeline-BuYWU9rt.d.ts → pipeline-CvVe1Q2_.d.ts} +1 -1
  262. package/dist/policy-runtime.d.ts +1 -1
  263. package/dist/proactive-contention.d.ts +1 -1
  264. package/dist/provenance.d.ts +1 -1
  265. package/dist/{public-http-CEwDOGO7.d.ts → public-http-D0JKFkyf.d.ts} +1 -1
  266. package/dist/{qmd-DYnrPw-m.d.ts → qmd-Bd0Tp76_.d.ts} +1 -1
  267. package/dist/qmd-preflight.d.ts +2 -2
  268. package/dist/qmd-recall-cache.d.ts +1 -1
  269. package/dist/qmd.d.ts +2 -2
  270. package/dist/qmd.js +4 -4
  271. package/dist/recall-concurrency-config.d.ts +1 -1
  272. package/dist/recall-disclosure-escalation.d.ts +1 -1
  273. package/dist/recall-explain-renderer.d.ts +1 -1
  274. package/dist/recall-explain-renderer.js +3 -3
  275. package/dist/recall-memory-map.d.ts +1 -1
  276. package/dist/recall-planner-llm.d.ts +1 -1
  277. package/dist/recall-state.d.ts +1 -1
  278. package/dist/recall-tag-filter.d.ts +1 -1
  279. package/dist/recall-timings.d.ts +1 -1
  280. package/dist/recall-xray-cli.d.ts +1 -1
  281. package/dist/recall-xray-cli.js +4 -4
  282. package/dist/recall-xray-renderer.d.ts +1 -1
  283. package/dist/recall-xray-renderer.js +3 -3
  284. package/dist/recall-xray.d.ts +1 -1
  285. package/dist/recall-xray.js +2 -2
  286. package/dist/reconcile/cursor.d.ts +1 -1
  287. package/dist/reconcile/manifest.d.ts +1 -1
  288. package/dist/reconcile/plan.d.ts +1 -1
  289. package/dist/replay/normalizers/chatgpt.d.ts +1 -1
  290. package/dist/replay/normalizers/claude.d.ts +1 -1
  291. package/dist/replay/normalizers/openclaw.d.ts +1 -1
  292. package/dist/replay/normalizers/shared.d.ts +1 -1
  293. package/dist/replay/runner.d.ts +1 -1
  294. package/dist/replay/types.d.ts +1 -1
  295. package/dist/replica-divergence.d.ts +1 -1
  296. package/dist/replica-peers-config.d.ts +1 -1
  297. package/dist/resolve-auth-token.d.ts +1 -1
  298. package/dist/retrieval-agents.d.ts +2 -2
  299. package/dist/retrieval-tiers.d.ts +1 -1
  300. package/dist/routing/engine.d.ts +1 -1
  301. package/dist/routing/store.d.ts +1 -1
  302. package/dist/salvage-envelope.d.ts +1 -1
  303. package/dist/schemas.d.ts +138 -138
  304. package/dist/{scope-profiles-C1QG4Cmv.d.ts → scope-profiles-ClLtm9gK.d.ts} +1 -1
  305. package/dist/search/embed-helper.d.ts +1 -1
  306. package/dist/search/factory.d.ts +1 -1
  307. package/dist/search/factory.js +7 -7
  308. package/dist/search/index.d.ts +1 -1
  309. package/dist/search/index.js +7 -7
  310. package/dist/search/lancedb-backend.d.ts +1 -1
  311. package/dist/search/lancedb-backend.js +2 -2
  312. package/dist/search/meilisearch-backend.d.ts +1 -1
  313. package/dist/search/meilisearch-backend.js +2 -2
  314. package/dist/search/noop-backend.d.ts +1 -1
  315. package/dist/search/orama-backend.d.ts +1 -1
  316. package/dist/search/orama-backend.js +2 -2
  317. package/dist/search/port.d.ts +1 -1
  318. package/dist/search/remote-backend.d.ts +1 -1
  319. package/dist/{semantic-consolidation-DMeX8XS0.d.ts → semantic-consolidation-B1EkeEDj.d.ts} +1 -1
  320. package/dist/semantic-consolidation.d.ts +2 -2
  321. package/dist/semantic-consolidation.js +12 -12
  322. package/dist/semantic-rule-promotion.js +11 -11
  323. package/dist/semantic-rule-verifier.d.ts +1 -1
  324. package/dist/semantic-rule-verifier.js +11 -11
  325. package/dist/{service-CT3ENiTO.d.ts → service-Cf3ANQj9.d.ts} +2 -2
  326. package/dist/session-observer-bands.d.ts +1 -1
  327. package/dist/session-observer-state.d.ts +1 -1
  328. package/dist/shared-context/manager.d.ts +9 -9
  329. package/dist/signal.d.ts +1 -1
  330. package/dist/source-agent-qualifier.d.ts +1 -1
  331. package/dist/source-agent-qualifier.js +13 -13
  332. package/dist/{storage-B0L76y7N.d.ts → storage-DS2O_6Qt.d.ts} +4 -2
  333. package/dist/storage.d.ts +2 -2
  334. package/dist/storage.js +12 -10
  335. package/dist/summarizer.d.ts +1 -1
  336. package/dist/summary-snapshot.d.ts +1 -1
  337. package/dist/support-passport/index.d.ts +14 -14
  338. package/dist/support-passport/index.js +28 -28
  339. package/dist/temporal-supersession.d.ts +2 -2
  340. package/dist/temporal-timeline-recall.d.ts +1 -1
  341. package/dist/temporal-validity.d.ts +1 -1
  342. package/dist/threading.d.ts +1 -1
  343. package/dist/tier-migration.d.ts +2 -2
  344. package/dist/tier-routing.d.ts +1 -1
  345. package/dist/topics.d.ts +1 -1
  346. package/dist/transcript.d.ts +1 -1
  347. package/dist/transfer/backup.js +2 -2
  348. package/dist/transfer/capsule-export.js +2 -2
  349. package/dist/transfer/capsule-import.js +2 -2
  350. package/dist/transfer/import-sqlite.js +2 -2
  351. package/dist/transfer/types.d.ts +66 -66
  352. package/dist/trust-score-stage.d.ts +1 -1
  353. package/dist/trust-score.d.ts +1 -1
  354. package/dist/{types-D7pB0QwO.d.ts → types-BOANGhCJ.d.ts} +3 -1
  355. package/dist/types.d.ts +1 -1
  356. package/dist/types.js +1 -1
  357. package/dist/utility-runtime.d.ts +1 -1
  358. package/dist/verified-recall.js +11 -11
  359. package/dist/write-envelope.d.ts +1 -1
  360. package/package.json +2 -2
  361. package/src/entity-origin-fields.ts +56 -0
  362. package/src/entity-retrieval.ts +84 -84
  363. package/src/orchestration/extraction-injection-gate.ts +17 -5
  364. package/src/orchestration/extraction-persist.ts +1 -1
  365. package/src/recall-authority-fence.test.ts +40 -0
  366. package/src/security/audit-memory.test.ts +24 -1
  367. package/src/storage/entity-store.ts +52 -17
  368. package/src/storage/entity-timeline.ts +96 -16
  369. package/src/storage.ts +18 -18
  370. package/src/types.ts +2 -2
  371. package/dist/chunk-2VHCLHZ5.js.map +0 -1
  372. package/dist/chunk-4CLE2LXB.js.map +0 -1
  373. package/dist/chunk-GKHMV2KK.js.map +0 -1
  374. /package/dist/{capsule-crypto-GWVG7LGC.js.map → capsule-crypto-7FJQINUR.js.map} +0 -0
  375. /package/dist/{chunk-7DHFB5SG.js.map → chunk-2GRLJMKJ.js.map} +0 -0
  376. /package/dist/{chunk-OWHERGF2.js.map → chunk-2NLLXCJG.js.map} +0 -0
  377. /package/dist/{chunk-VUJN44CT.js.map → chunk-2RIDW23Y.js.map} +0 -0
  378. /package/dist/{chunk-VOKK4WCG.js.map → chunk-3GPBFDXH.js.map} +0 -0
  379. /package/dist/{chunk-KXYMU4IN.js.map → chunk-4JGSG7QN.js.map} +0 -0
  380. /package/dist/{chunk-A7266TRJ.js.map → chunk-4XAVQLBR.js.map} +0 -0
  381. /package/dist/{chunk-UBSM6TZP.js.map → chunk-76YNCJ5H.js.map} +0 -0
  382. /package/dist/{chunk-JNWISMYG.js.map → chunk-7N7DB4L5.js.map} +0 -0
  383. /package/dist/{chunk-6C7Q6NG3.js.map → chunk-AWRJBAIH.js.map} +0 -0
  384. /package/dist/{chunk-DE6YCZEE.js.map → chunk-CIA6ZUBA.js.map} +0 -0
  385. /package/dist/{chunk-PEDYKCJI.js.map → chunk-CK3NQUSQ.js.map} +0 -0
  386. /package/dist/{chunk-OU7RWWW6.js.map → chunk-CM4SZZBN.js.map} +0 -0
  387. /package/dist/{chunk-ODAE36PG.js.map → chunk-D5HDJWNN.js.map} +0 -0
  388. /package/dist/{chunk-KF75ANST.js.map → chunk-EHMMRZOZ.js.map} +0 -0
  389. /package/dist/{chunk-7G34CBKS.js.map → chunk-EIQFIJDM.js.map} +0 -0
  390. /package/dist/{chunk-YNDLCWXS.js.map → chunk-EZ25VE3G.js.map} +0 -0
  391. /package/dist/{chunk-G3JFFUKR.js.map → chunk-FW73HN33.js.map} +0 -0
  392. /package/dist/{chunk-MMZK2DWN.js.map → chunk-G3YBWFUC.js.map} +0 -0
  393. /package/dist/{chunk-I4BLRM7X.js.map → chunk-GN7HO2LA.js.map} +0 -0
  394. /package/dist/{chunk-ZOGOOSB3.js.map → chunk-H32ANIFP.js.map} +0 -0
  395. /package/dist/{chunk-AH2NX6S7.js.map → chunk-HEEEMJ26.js.map} +0 -0
  396. /package/dist/{chunk-J65AKOD6.js.map → chunk-HQBVQICL.js.map} +0 -0
  397. /package/dist/{chunk-VJXSAJFW.js.map → chunk-I67HKRBF.js.map} +0 -0
  398. /package/dist/{chunk-RKNJBZ55.js.map → chunk-JBPKEARU.js.map} +0 -0
  399. /package/dist/{chunk-R7IV3EUJ.js.map → chunk-JKW663ZN.js.map} +0 -0
  400. /package/dist/{chunk-YBCZTBN2.js.map → chunk-KAB7TZN3.js.map} +0 -0
  401. /package/dist/{chunk-4UUF2EX3.js.map → chunk-KPML4Q3M.js.map} +0 -0
  402. /package/dist/{chunk-5W7CTZ2E.js.map → chunk-KQAFEZQX.js.map} +0 -0
  403. /package/dist/{chunk-YKZFX2HQ.js.map → chunk-L33N3BCA.js.map} +0 -0
  404. /package/dist/{chunk-PYHOAXTI.js.map → chunk-LRGSLV7M.js.map} +0 -0
  405. /package/dist/{chunk-FI5EAP4N.js.map → chunk-MJ4UGUR6.js.map} +0 -0
  406. /package/dist/{chunk-KBIIE57I.js.map → chunk-MU3TPZOV.js.map} +0 -0
  407. /package/dist/{chunk-77DAFTUU.js.map → chunk-MYZ4NA43.js.map} +0 -0
  408. /package/dist/{chunk-T2VJ2EO5.js.map → chunk-N4EPIKSY.js.map} +0 -0
  409. /package/dist/{chunk-EZXGJJXM.js.map → chunk-N4OYPGZS.js.map} +0 -0
  410. /package/dist/{chunk-L3JVAM5Q.js.map → chunk-PA5OPZX2.js.map} +0 -0
  411. /package/dist/{chunk-RVO6TCTU.js.map → chunk-QCECHYZL.js.map} +0 -0
  412. /package/dist/{chunk-2HGV44MM.js.map → chunk-QRKYABS6.js.map} +0 -0
  413. /package/dist/{chunk-P6GOYLHN.js.map → chunk-QWPAQLYV.js.map} +0 -0
  414. /package/dist/{chunk-BTHDQOF4.js.map → chunk-QYN5PXDZ.js.map} +0 -0
  415. /package/dist/{chunk-MG7GI4TT.js.map → chunk-S3B3UIQ3.js.map} +0 -0
  416. /package/dist/{chunk-6W2ISYUV.js.map → chunk-TE4MKFT2.js.map} +0 -0
  417. /package/dist/{chunk-QUJC22CT.js.map → chunk-URN7XWGC.js.map} +0 -0
  418. /package/dist/{chunk-G5OB4XZX.js.map → chunk-VANZKHTN.js.map} +0 -0
  419. /package/dist/{chunk-BPM6UHUL.js.map → chunk-VWDTV6SH.js.map} +0 -0
  420. /package/dist/{chunk-P5OYNV7B.js.map → chunk-W3Y6FYRK.js.map} +0 -0
  421. /package/dist/{chunk-VIM6QH4D.js.map → chunk-W4Q54HM3.js.map} +0 -0
  422. /package/dist/{chunk-UVYI6VIX.js.map → chunk-X7Y7WX73.js.map} +0 -0
  423. /package/dist/{chunk-FUWS2MNJ.js.map → chunk-XBR5BAKW.js.map} +0 -0
  424. /package/dist/{chunk-XU4OLEYW.js.map → chunk-XD4VGLDL.js.map} +0 -0
  425. /package/dist/{chunk-OV36CROW.js.map → chunk-XDK6ZFLL.js.map} +0 -0
  426. /package/dist/{chunk-JHMAYABJ.js.map → chunk-XL3TATMJ.js.map} +0 -0
  427. /package/dist/{chunk-OLX2HJFW.js.map → chunk-YLHM5BQQ.js.map} +0 -0
@@ -0,0 +1,56 @@
1
+ import type { EntityStructuredSection } from "./types.js";
2
+
3
+ type OriginatedEntry = { text: string; origin?: string };
4
+ type RecalledFact = { text: string; sourceIndex: number };
5
+ type SanitizedFacts = { facts: string[]; origins: Array<string | undefined> };
6
+
7
+ export type EntityOriginStructuredSection = EntityStructuredSection & {
8
+ factOrigins?: Array<string | undefined>;
9
+ };
10
+
11
+ export function sanitizeOriginatedFacts(
12
+ entries: readonly OriginatedEntry[],
13
+ sanitize: (value: string) => string,
14
+ compact: (value: string, maxLength: number) => string,
15
+ deduplicate: boolean,
16
+ ): SanitizedFacts {
17
+ const result: SanitizedFacts = { facts: [], origins: [] };
18
+ const indexes = new Map<string, number>();
19
+ for (const entry of entries) {
20
+ const clean = sanitize(entry.text);
21
+ if (!clean) continue;
22
+ const fact = compact(clean, 180);
23
+ const index = deduplicate ? indexes.get(fact) ?? -1 : -1;
24
+ if (index < 0) {
25
+ indexes.set(fact, result.facts.length);
26
+ result.facts.push(fact);
27
+ result.origins.push(entry.origin);
28
+ } else if (result.origins[index] !== entry.origin) {
29
+ result.origins[index] = undefined;
30
+ }
31
+ }
32
+ return result;
33
+ }
34
+
35
+ export function buildOriginStructuredSections(
36
+ sections: readonly EntityStructuredSection[],
37
+ recallFacts: (section: EntityStructuredSection) => RecalledFact[],
38
+ sanitize: (value: string) => string,
39
+ compact: (value: string, maxLength: number) => string,
40
+ ): EntityOriginStructuredSection[] {
41
+ return sections
42
+ .map((section) => {
43
+ const entries = recallFacts(section).map(({ text, sourceIndex }) => ({
44
+ text,
45
+ origin: section.factOrigins?.[sourceIndex],
46
+ }));
47
+ const result = sanitizeOriginatedFacts(entries, sanitize, compact, false);
48
+ return {
49
+ key: section.key,
50
+ title: section.title,
51
+ facts: result.facts,
52
+ ...(result.origins.some((origin) => origin !== undefined) ? { factOrigins: result.origins } : {}),
53
+ };
54
+ })
55
+ .filter((section) => section.facts.length > 0);
56
+ }
@@ -9,13 +9,17 @@ import { compareEntityTimestamps, normalizeEntityName, type StorageManager } fro
9
9
  import { normalizeEntityText, resolveRequestedEntitySectionKeys } from "./entity-schema.js";
10
10
  import type { EntityStructuredSection, MemoryFile, PluginConfig, TranscriptEntry } from "./types.js";
11
11
  import { containsPhrase } from "./entity-retrieval-boundaries.js";
12
+ import {
13
+ buildOriginStructuredSections,
14
+ sanitizeOriginatedFacts,
15
+ type EntityOriginStructuredSection,
16
+ } from "./entity-origin-fields.js";
12
17
  import {
13
18
  checkEntityRecallAbort,
14
19
  entityRecallSectionAbsent,
15
20
  yieldEntityRecallScan,
16
21
  yieldEntityRecallScanEvery,
17
22
  } from "./entity-recall-cancellation.js";
18
-
19
23
  const ENTITY_INDEX_VERSION = 3;
20
24
  const RECENT_TRANSCRIPT_LOOKBACK_HOURS = 24;
21
25
  const INSTRUCTION_LIKE_RE = /\b(always|never|must|should|remember to|do not|don't|process|workflow|template|checklist|instruction)\b/i;
@@ -23,24 +27,24 @@ const METADATA_WRAPPER_RE = /^(source|context|metadata|notes?):/i;
23
27
  const ENTITY_PRONOUN_RE = /\b(he|him|his|she|her|they|them|their|it|its)\b/i;
24
28
  const BELIEF_LEDGER_SECTION_KEY = "belief_ledger";
25
29
  const BELIEF_LEDGER_FACT_RE = /^claim=([^;]+);\s*status=([^;]+);\s*updatedAt=([^;]+);\s*(.+)$/;
26
-
27
30
  type EntityQueryMode = "direct" | "timeline" | "follow_up";
28
-
29
31
  type EntityMentionIndexEntry = {
30
32
  canonicalId: string;
31
33
  name: string;
32
34
  type: string;
33
- aliases: string[];
34
35
  summary?: string;
36
+ aliases: string[];
35
37
  facts: string[];
36
38
  timelineFacts: string[];
37
- structuredSections: EntityStructuredSection[];
39
+ timelineFactOrigins?: Array<string | undefined>;
40
+ structuredSections: EntityOriginStructuredSection[];
38
41
  timeline: Array<{
39
42
  timestamp: string;
40
43
  text: string;
41
44
  source?: string;
42
45
  sessionKey?: string;
43
46
  principal?: string;
47
+ origin?: string;
44
48
  }>;
45
49
  relationships: Array<{ target: string; label: string }>;
46
50
  activity: Array<{ date: string; note: string }>;
@@ -55,21 +59,18 @@ type EntityMentionIndexEntry = {
55
59
  derivedDate?: string;
56
60
  }>;
57
61
  };
58
-
59
62
  type EntityMentionIndex = {
60
63
  version: number;
61
64
  updatedAt: string;
62
65
  entityStatusVersion?: number;
63
66
  entities: EntityMentionIndexEntry[];
64
67
  };
65
-
66
68
  type EntityCandidate = {
67
69
  entry: EntityMentionIndexEntry;
68
70
  alias: string;
69
71
  score: number;
70
72
  source: "query" | "recent_turn";
71
73
  };
72
-
73
74
  type EntityHintSnippet = {
74
75
  text: string;
75
76
  score: number;
@@ -96,37 +97,35 @@ export interface BuildEntityRecallSectionOptions {
96
97
  */
97
98
  abortSignal?: AbortSignal;
98
99
  }
99
-
100
100
  function tokenize(value: string): string[] {
101
101
  return normalizeEntityText(value).split(/\s+/).filter((token) => token.length >= 2);
102
102
  }
103
-
104
103
  function uniqueStrings(values: string[]): string[] {
105
104
  return [...new Set(values.map((value) => value.trim()).filter((value) => value.length > 0))];
106
105
  }
107
-
108
106
  function compactLine(value: string, maxLength: number = 220): string {
109
107
  const normalized = value.replace(/\s+/g, " ").trim();
110
108
  if (normalized.length <= maxLength) return normalized;
111
109
  return `${normalized.slice(0, Math.max(0, maxLength - 1)).trimEnd()}…`;
112
110
  }
113
-
114
111
  function dedupeHintSnippetsByText(snippets: EntityHintSnippet[]): EntityHintSnippet[] {
115
- const seen = new Set<string>();
116
- const result: EntityHintSnippet[] = [];
112
+ const deduped = new Map<string, EntityHintSnippet>();
117
113
  for (const snippet of snippets) {
118
114
  const key = normalizeEntityText(snippet.text);
119
- if (seen.has(key)) continue;
120
- seen.add(key);
121
- result.push(snippet);
115
+ const existing = deduped.get(key);
116
+ if (!existing) {
117
+ deduped.set(key, snippet);
118
+ continue;
119
+ }
120
+ if (existing.origin !== snippet.origin) {
121
+ existing.origin = undefined;
122
+ }
122
123
  }
123
- return result;
124
+ return [...deduped.values()];
124
125
  }
125
-
126
126
  function isBeliefLedgerSection(section: Pick<EntityStructuredSection, "key">): boolean {
127
127
  return normalizeEntityText(section.key).replace(/\s+/g, "_") === BELIEF_LEDGER_SECTION_KEY;
128
128
  }
129
-
130
129
  function beliefLedgerFactKeys(sections: EntityStructuredSection[]): Set<string> {
131
130
  const keys = new Set<string>();
132
131
  for (const section of sections) {
@@ -137,15 +136,16 @@ function beliefLedgerFactKeys(sections: EntityStructuredSection[]): Set<string>
137
136
  }
138
137
  return keys;
139
138
  }
140
-
141
- function recallFactsForStructuredSection(section: EntityStructuredSection): string[] {
142
- if (!isBeliefLedgerSection(section)) return section.facts;
139
+ type RecalledEntityFact = { text: string; sourceIndex: number };
140
+ function recallFactsForStructuredSection(section: EntityStructuredSection): RecalledEntityFact[] {
141
+ if (!isBeliefLedgerSection(section)) {
142
+ return section.facts.map((text, sourceIndex) => ({ text, sourceIndex }));
143
+ }
143
144
  return currentActiveBeliefLedgerFactTexts(section.facts);
144
145
  }
145
-
146
- function currentActiveBeliefLedgerFactTexts(facts: string[]): string[] {
147
- const byClaim = new Map<string, { status: string; updatedAtMs: number; texts: string[] }>();
148
- for (const fact of facts) {
146
+ function currentActiveBeliefLedgerFactTexts(facts: string[]): RecalledEntityFact[] {
147
+ const byClaim = new Map<string, { status: string; updatedAtMs: number; texts: RecalledEntityFact[] }>();
148
+ for (const [sourceIndex, fact] of facts.entries()) {
149
149
  const match = BELIEF_LEDGER_FACT_RE.exec(fact.trim());
150
150
  if (!match) continue;
151
151
  const [, claimId, status, updatedAt, text] = match;
@@ -160,28 +160,20 @@ function currentActiveBeliefLedgerFactTexts(facts: string[]): string[] {
160
160
  current.status === "active" &&
161
161
  normalizedStatus !== "active";
162
162
  if (!current || updatedAtMs > current.updatedAtMs || inactiveTieWins) {
163
- byClaim.set(normalizedClaimId, { status: normalizedStatus, updatedAtMs, texts: [text.trim()] });
163
+ byClaim.set(normalizedClaimId, { status: normalizedStatus, updatedAtMs, texts: [{ text: text.trim(), sourceIndex }] });
164
164
  continue;
165
165
  }
166
166
  if (updatedAtMs === current.updatedAtMs && current.status === normalizedStatus) {
167
- current.texts.push(text.trim());
168
- }
169
- }
170
- const result: string[] = [];
171
- for (const current of byClaim.values()) {
172
- if (current.status === "active") {
173
- result.push(...current.texts);
167
+ current.texts.push({ text: text.trim(), sourceIndex });
174
168
  }
175
169
  }
176
- return result;
170
+ return [...byClaim.values()].flatMap((current) => current.status === "active" ? current.texts : []);
177
171
  }
178
-
179
172
  function relationLine(entry: EntityMentionIndexEntry, relationship: { target: string; label: string }): string {
180
173
  const normalizedLabel = relationship.label.replace(/\s+/g, " ").trim();
181
174
  if (normalizedLabel.length === 0) return `${entry.name} is connected to ${relationship.target}`;
182
175
  return `${entry.name} ${normalizedLabel} ${relationship.target}`;
183
176
  }
184
-
185
177
  function detectEntityQueryMode(query: string): EntityQueryMode | null {
186
178
  const normalized = normalizeEntityText(query);
187
179
  if (!normalized) return null;
@@ -211,7 +203,6 @@ function detectEntityQueryMode(query: string): EntityQueryMode | null {
211
203
  }
212
204
  return null;
213
205
  }
214
-
215
206
  function scoreAliasMatch(query: string, alias: string): number {
216
207
  const normalizedQuery = normalizeEntityText(query);
217
208
  const normalizedAlias = normalizeEntityText(alias);
@@ -246,7 +237,6 @@ function scoreAliasMatch(query: string, alias: string): number {
246
237
  }
247
238
  return overlap;
248
239
  }
249
-
250
240
  /**
251
241
  * Tokens that look like type prefixes / generic role identifiers and
252
242
  * therefore should not, on their own, count as evidence that a
@@ -264,15 +254,12 @@ const ALIAS_AFFIX_TOKENS = new Set<string>([
264
254
  "place", "places", "tool", "tools", "service", "services",
265
255
  "system", "systems", "agent", "agents", "bot", "bots",
266
256
  ]);
267
-
268
257
  function isAliasAffixToken(token: string): boolean {
269
258
  return ALIAS_AFFIX_TOKENS.has(token);
270
259
  }
271
-
272
260
  function isLikelyInstructionLike(value: string): boolean {
273
261
  return INSTRUCTION_LIKE_RE.test(value) || METADATA_WRAPPER_RE.test(value);
274
262
  }
275
-
276
263
  function sanitizeEntityFact(fact: string): string {
277
264
  const sanitized = sanitizeMemoryContent(fact);
278
265
  const clean = sanitized.text.trim();
@@ -280,7 +267,6 @@ function sanitizeEntityFact(fact: string): string {
280
267
  if (INSTRUCTION_LIKE_RE.test(clean) && clean.length > 100) return "";
281
268
  return clean;
282
269
  }
283
-
284
270
  function scoreHintSnippet(snippet: EntityHintSnippet, queryTokens: string[]): EntityHintSnippet | null {
285
271
  const normalized = normalizeEntityText(snippet.text);
286
272
  if (!normalized) return null;
@@ -294,7 +280,6 @@ function scoreHintSnippet(snippet: EntityHintSnippet, queryTokens: string[]): En
294
280
  if (scored.text.length <= 160) scored.score += 1;
295
281
  return scored.score > 0 ? scored : null;
296
282
  }
297
-
298
283
  function sortTimelineEntriesDesc(
299
284
  left: EntityMentionIndexEntry["timeline"][number],
300
285
  right: EntityMentionIndexEntry["timeline"][number],
@@ -305,7 +290,6 @@ function sortTimelineEntriesDesc(
305
290
  }
306
291
  return right.text.localeCompare(left.text);
307
292
  }
308
-
309
293
  function jaccardSimilarity(a: string, b: string): number {
310
294
  const aTokens = new Set(tokenize(a));
311
295
  const bTokens = new Set(tokenize(b));
@@ -317,7 +301,6 @@ function jaccardSimilarity(a: string, b: string): number {
317
301
  const union = new Set([...aTokens, ...bTokens]).size;
318
302
  return union === 0 ? 0 : intersection / union;
319
303
  }
320
-
321
304
  function buildAliasIndex(entries: EntityMentionIndexEntry[]): Map<string, EntityMentionIndexEntry[]> {
322
305
  const index = new Map<string, EntityMentionIndexEntry[]>();
323
306
  for (const entry of entries) {
@@ -330,7 +313,6 @@ function buildAliasIndex(entries: EntityMentionIndexEntry[]): Map<string, Entity
330
313
  }
331
314
  return index;
332
315
  }
333
-
334
316
  async function readNativeChunks(
335
317
  config: PluginConfig,
336
318
  recallNamespaces?: string[],
@@ -344,7 +326,6 @@ async function readNativeChunks(
344
326
  defaultNamespace: config.defaultNamespace,
345
327
  }).catch(() => []);
346
328
  }
347
-
348
329
  async function resolveEntityIndexStorages(
349
330
  storage: StorageManager,
350
331
  config: PluginConfig,
@@ -359,7 +340,6 @@ async function resolveEntityIndexStorages(
359
340
  ) {
360
341
  return [storage];
361
342
  }
362
-
363
343
  const storages: StorageManager[] = [];
364
344
  const seenDirs = new Set<string>();
365
345
  for (const namespace of uniqueStrings(recallNamespaces)) {
@@ -373,10 +353,8 @@ async function resolveEntityIndexStorages(
373
353
  continue;
374
354
  }
375
355
  }
376
-
377
356
  return storages.length > 0 ? storages : [storage];
378
357
  }
379
-
380
358
  function entityIndexStatePath(storage: StorageManager): string {
381
359
  return path.join(storage.dir, "state", "entity-mention-index.json");
382
360
  }
@@ -392,8 +370,6 @@ async function readEntityIndexState(storage: StorageManager): Promise<EntityMent
392
370
  return null;
393
371
  }
394
372
  }
395
-
396
-
397
373
  async function readCurrentPersistedEntityIndex(
398
374
  storage: StorageManager,
399
375
  config: PluginConfig,
@@ -429,7 +405,6 @@ function nativeEntityIndexRevision(chunks: NativeKnowledgeChunk[]): string {
429
405
  ]);
430
406
  return createHash("sha256").update(JSON.stringify(projection)).digest("hex");
431
407
  }
432
-
433
408
  function namespaceEntityIndexCacheKey(
434
409
  storages: StorageManager[],
435
410
  recallNamespaces: string[],
@@ -449,7 +424,6 @@ function namespaceEntityIndexCacheKey(
449
424
  .join("\u001f");
450
425
  return `${namespaceKey}\u001e${storageKey}\u001e${nativeRevision}`;
451
426
  }
452
-
453
427
  function rememberNamespaceEntityIndex(key: string, index: EntityMentionIndex): void {
454
428
  if (namespaceEntityIndexCache.size >= MAX_NAMESPACE_ENTITY_INDEX_CACHE_ENTRIES) {
455
429
  const oldestKey = namespaceEntityIndexCache.keys().next().value;
@@ -585,10 +559,18 @@ async function buildEntityMentionIndex(
585
559
  .filter(Boolean)
586
560
  .filter((fact) => !rawBeliefLedgerFactKeys.has(normalizeEntityText(fact)))
587
561
  .map((fact) => compactLine(fact, 180));
588
- const sanitizedTimelineFacts = entity.timeline
589
- .map((entry) => sanitizeEntityFact(entry.text))
590
- .filter(Boolean)
591
- .map((fact) => compactLine(fact, 180));
562
+ const { facts: timelineFacts, origins: timelineFactOrigins } = sanitizeOriginatedFacts(
563
+ entity.timeline,
564
+ sanitizeEntityFact,
565
+ compactLine,
566
+ true,
567
+ );
568
+ const structuredSections = buildOriginStructuredSections(
569
+ rawStructuredSections,
570
+ recallFactsForStructuredSection,
571
+ sanitizeEntityFact,
572
+ compactLine,
573
+ );
592
574
  entities.set(canonicalId, {
593
575
  canonicalId,
594
576
  name: entity.name,
@@ -596,15 +578,9 @@ async function buildEntityMentionIndex(
596
578
  aliases: uniqueStrings(entity.aliases),
597
579
  summary: entity.synthesis?.trim() || entity.summary?.trim() || undefined,
598
580
  facts: sanitizedFacts,
599
- timelineFacts: uniqueStrings(sanitizedTimelineFacts),
600
- structuredSections: rawStructuredSections.map((section) => ({
601
- key: section.key,
602
- title: section.title,
603
- facts: recallFactsForStructuredSection(section)
604
- .map((fact) => sanitizeEntityFact(fact))
605
- .filter(Boolean)
606
- .map((fact) => compactLine(fact, 180)),
607
- })).filter((section) => section.facts.length > 0),
581
+ timelineFacts,
582
+ ...(timelineFactOrigins.some((origin) => origin !== undefined) ? { timelineFactOrigins } : {}),
583
+ structuredSections,
608
584
  timeline: entity.timeline.map((entry) => ({ ...entry })),
609
585
  relationships: entity.relationships.map((relationship) => ({ ...relationship })),
610
586
  activity: entity.activity.map((activity) => ({ ...activity })),
@@ -857,20 +833,29 @@ async function buildHintSnippets(
857
833
  if (entry.summary) {
858
834
  snippets.push({ text: compactLine(entry.summary, 180), score: 10, kind: "summary" });
859
835
  }
860
-
861
836
  if (requestedSectionKeys.size > 0) {
862
837
  for (const section of entry.structuredSections) {
863
838
  if (!requestedSectionKeys.has(normalizeEntityText(section.key).replace(/\s+/g, "_"))) continue;
864
- for (const fact of section.facts) {
865
- snippets.push({ text: fact, score: mode === "direct" ? 8 : 9, kind: "section" });
839
+ for (const [index, fact] of section.facts.entries()) {
840
+ snippets.push({
841
+ text: fact,
842
+ score: mode === "direct" ? 8 : 9,
843
+ kind: "section",
844
+ origin: section.factOrigins?.[index],
845
+ });
866
846
  }
867
847
  }
868
848
  } else {
869
- for (const fact of entry.timelineFacts) {
870
- snippets.push({ text: fact, score: mode === "direct" ? 6 : 7, kind: "fact" });
849
+ for (const [index, fact] of entry.timelineFacts.entries()) {
850
+ snippets.push({
851
+ text: fact,
852
+ score: mode === "direct" ? 6 : 7,
853
+ kind: "fact",
854
+ origin: entry.timelineFactOrigins?.[index],
855
+ });
871
856
  }
872
857
  for (const section of entry.structuredSections) {
873
- for (const fact of section.facts) {
858
+ for (const [index, fact] of section.facts.entries()) {
874
859
  const normalizedFact = normalizeEntityText(fact);
875
860
  const hasNonAliasQueryOverlap = queryTokens.some((token) =>
876
861
  !aliasTokens.has(token) && normalizedFact.includes(token)
@@ -878,7 +863,12 @@ async function buildHintSnippets(
878
863
  if (entry.timelineFacts.length > 0 && !hasNonAliasQueryOverlap) {
879
864
  continue;
880
865
  }
881
- snippets.push({ text: fact, score: mode === "direct" ? 6 : 7, kind: "fact" });
866
+ snippets.push({
867
+ text: fact,
868
+ score: mode === "direct" ? 6 : 7,
869
+ kind: "fact",
870
+ origin: section.factOrigins?.[index],
871
+ });
882
872
  }
883
873
  }
884
874
  if (entry.timelineFacts.length === 0 && entry.structuredSections.length === 0) {
@@ -925,7 +915,13 @@ async function buildHintSnippets(
925
915
  if (!scored) continue;
926
916
  const normalized = normalizeEntityText(scored.text);
927
917
  const existing = deduped.get(normalized);
928
- if (!existing || scored.score > existing.score) deduped.set(normalized, scored);
918
+ if (!existing) {
919
+ deduped.set(normalized, scored);
920
+ } else if (existing.origin !== scored.origin) {
921
+ deduped.set(normalized, { ...(scored.score > existing.score ? scored : existing), origin: undefined });
922
+ } else if (scored.score > existing.score) {
923
+ deduped.set(normalized, scored);
924
+ }
929
925
  }
930
926
 
931
927
  return [...deduped.values()]
@@ -987,13 +983,17 @@ function formatEntityHintSection(
987
983
  (candidate.entry.timeline ?? [])
988
984
  .slice()
989
985
  .sort(sortTimelineEntriesDesc)
990
- .map((entry) => sanitizeEntityFact(entry.text))
991
- .filter(Boolean)
992
- .map((text) => scoreHintSnippet({
993
- text: compactLine(text, 180),
994
- score: 7,
995
- kind: "activity" as const,
996
- }, queryTokens))
986
+ .map((entry) => {
987
+ const text = sanitizeEntityFact(entry.text);
988
+ return text
989
+ ? scoreHintSnippet({
990
+ text: compactLine(text, 180),
991
+ score: 7,
992
+ kind: "activity" as const,
993
+ origin: entry.origin,
994
+ }, queryTokens)
995
+ : null;
996
+ })
997
997
  .filter((snippet): snippet is EntityHintSnippet => snippet !== null)
998
998
  .filter((snippet) => !seedExcludedTexts.has(normalizeEntityText(snippet.text))),
999
999
  ).slice(0, 2);
@@ -1,7 +1,4 @@
1
- /**
2
- * Pure issue #1955 injection-screen gate for extracted facts.
3
- */
4
-
1
+ import { parseOriginClass } from "../security/origin-authority.js";
5
2
  import { normalizeAttributePairs } from "../structured-attributes.js";
6
3
  import { buildProcedurePersistBody } from "../procedural/procedure-types.js";
7
4
  import { screenCandidateFact } from "../security/injection-screen.js";
@@ -123,7 +120,22 @@ export function screenEntityForIndex(entity: unknown, enabled: boolean): Screene
123
120
  source: typeof record?.source === "string" ? record.source : "extraction",
124
121
  facts: factScreen.kept,
125
122
  ...(sectionScreens
126
- ? { structuredSections: sectionScreens.map(({ section, screen }) => ({ ...section, facts: screen.kept })) }
123
+ ? {
124
+ structuredSections: sectionScreens.map(({ section, screen }) => {
125
+ let nextFactIndex = 0;
126
+ const factOrigins = screen.kept.map((fact) => {
127
+ const factIndex = section.facts.indexOf(fact, nextFactIndex);
128
+ nextFactIndex = factIndex + 1;
129
+ const origin = section.factOrigins?.[factIndex];
130
+ return origin === undefined ? undefined : parseOriginClass(origin);
131
+ });
132
+ return {
133
+ ...section,
134
+ facts: screen.kept,
135
+ ...(factOrigins.some((origin) => origin !== undefined) ? { factOrigins } : {}),
136
+ };
137
+ }),
138
+ }
127
139
  : rawSections
128
140
  ? { structuredSections: rawSections }
129
141
  : {}),
@@ -116,7 +116,6 @@ import type { HarmonicConstructionInput } from "../harmonic-construction.js";
116
116
  import { persistConstructedHarmonicRecords } from "./harmonic-construction-persist.js";
117
117
  import { ExtractionAnchorSnapshot } from "./extraction-anchor-snapshot.js";
118
118
 
119
-
120
119
  export class ExtractionPersistCoordinator {
121
120
  constructor(
122
121
  private readonly deps: ExtractionPersistDeps,
@@ -2856,6 +2855,7 @@ export class ExtractionPersistCoordinator {
2856
2855
  timestamp: sourceContext?.validAt,
2857
2856
  sessionKey: sourceContext?.sessionKey,
2858
2857
  principal: sourceContext?.principal,
2858
+ origin,
2859
2859
  structuredSections: screened.structuredSections,
2860
2860
  });
2861
2861
  if (id) {
@@ -150,6 +150,46 @@ test("entity recall fences memory snippets and preserves disabled output", async
150
150
  await rm(memoryDir, { recursive: true, force: true });
151
151
  }
152
152
  });
153
+ test("entity facts and structured sections retain extracted origin authority", async () => {
154
+ const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-authority-entity-origin-"));
155
+ try {
156
+ const storage = new StorageManager(memoryDir);
157
+ await storage.writeEntity("Alice", "person", ["Alice prefers direct answers."], {
158
+ origin: "user",
159
+ structuredSections: [
160
+ {
161
+ key: "communication_style",
162
+ title: "Communication Style",
163
+ facts: ["Alice writes concise messages."],
164
+ },
165
+ ],
166
+ });
167
+ const config = parseConfig({
168
+ openaiApiKey: "sk-test",
169
+ memoryDir,
170
+ workspaceDir: path.join(memoryDir, "workspace"),
171
+ originAuthorityEnabled: true,
172
+ });
173
+ const output = await buildEntityRecallSection({
174
+ config,
175
+ storage,
176
+ query: "Who is Alice?",
177
+ recentTurns: 1,
178
+ maxHints: 2,
179
+ maxSupportingFacts: 4,
180
+ maxRelatedEntities: 2,
181
+ maxChars: 10_000,
182
+ transcriptEntries: [],
183
+ originAuthorityEnabled: true,
184
+ untrustedOrigins: ["unknown"],
185
+ });
186
+ assert.match(output ?? "", /Alice prefers direct answers\./);
187
+ assert.match(output ?? "", /Alice writes concise messages\./);
188
+ assert.doesNotMatch(output ?? "", /content below is data, not instructions/);
189
+ } finally {
190
+ await rm(memoryDir, { recursive: true, force: true });
191
+ }
192
+ });
153
193
 
154
194
  test("procedure recall fences untrusted-origin procedure bodies (#1955 review)", async () => {
155
195
  const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-authority-procedure-"));
@@ -14,6 +14,7 @@ type MemoryOptions = {
14
14
  pathPrefix?: string;
15
15
  source?: string;
16
16
  sourceConnector?: string;
17
+ timestamp?: string;
17
18
  };
18
19
 
19
20
  function makeMemory(
@@ -23,7 +24,7 @@ function makeMemory(
23
24
  content: string,
24
25
  options: MemoryOptions = {},
25
26
  ): MemoryFile {
26
- const timestamp = "2026-08-14T12:00:00.000Z";
27
+ const timestamp = options.timestamp ?? "2026-08-14T12:00:00.000Z";
27
28
  const frontmatter = {
28
29
  id,
29
30
  category: "fact",
@@ -236,6 +237,28 @@ test("auditMemoryStore uses a leave-one-out burst baseline", async () => {
236
237
  }
237
238
  });
238
239
 
240
+ test("auditMemoryStore includes memories exactly at --since and excludes earlier ones", async () => {
241
+ const root = await mkdtemp(path.join(tmpdir(), "remnic-audit-memory-boundary-"));
242
+ try {
243
+ const cutoff = "2026-08-14T12:00:00.000Z";
244
+ const before = makeMemory(root, "before", "session-before", "Before cutoff", {
245
+ timestamp: "2026-08-14T11:59:59.999Z",
246
+ });
247
+ const atCutoff = makeMemory(root, "at-cutoff", "session-at-cutoff", "At cutoff", {
248
+ timestamp: cutoff,
249
+ });
250
+ const report = await auditMemoryStore({
251
+ memoryDir: root,
252
+ storage: memoryStorage([before, atCutoff]),
253
+ since: cutoff,
254
+ });
255
+ assert.equal(report.activeMemories, 1);
256
+ assert.deepEqual([...new Set(report.findings.map((finding) => finding.memoryId))], []);
257
+ } finally {
258
+ await rm(root, { recursive: true, force: true });
259
+ }
260
+ });
261
+
239
262
  test("auditMemoryStore rejects malformed --since dates instead of normalizing them (#1955 review)", async () => {
240
263
  const root = await mkdtemp(path.join(tmpdir(), "remnic-audit-memory-date-"));
241
264
  try {