@remnic/core 9.45.4 → 9.46.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 (460) hide show
  1. package/dist/access-admin-ops-surface.d.ts +10 -10
  2. package/dist/access-admin-ops-surface.js +30 -29
  3. package/dist/access-authorization-probe.d.ts +10 -10
  4. package/dist/access-authorization-probe.js +31 -30
  5. package/dist/access-boundary.d.ts +10 -10
  6. package/dist/access-boundary.js +30 -29
  7. package/dist/access-cli.js +91 -87
  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 +10 -10
  11. package/dist/access-extraction-force-flush.js +30 -29
  12. package/dist/access-health-types.d.ts +1 -1
  13. package/dist/access-http-lcm-compaction.d.ts +10 -10
  14. package/dist/access-http-lifecycle-flush.d.ts +10 -10
  15. package/dist/access-http-offline-stream.d.ts +10 -10
  16. package/dist/access-http-offline-stream.js +1 -1
  17. package/dist/access-http-query.js +30 -29
  18. package/dist/access-http.d.ts +10 -11
  19. package/dist/access-http.js +42 -41
  20. package/dist/access-identity-continuity-surface.d.ts +8 -8
  21. package/dist/access-identity-continuity-surface.js +30 -29
  22. package/dist/access-lcm-surface.d.ts +10 -10
  23. package/dist/access-lcm-surface.js +30 -29
  24. package/dist/access-mcp.d.ts +10 -10
  25. package/dist/access-mcp.js +36 -35
  26. package/dist/access-memory-search-fanout.d.ts +2 -2
  27. package/dist/{access-namespace-preflight-CWUDwB4M.d.ts → access-namespace-preflight--H6HwN85.d.ts} +1 -1
  28. package/dist/access-namespace-preflight.d.ts +3 -3
  29. package/dist/access-namespace-preflight.js +30 -29
  30. package/dist/access-observe-write-surface.d.ts +10 -10
  31. package/dist/access-observe-write-surface.js +30 -29
  32. package/dist/access-offline-manifest.d.ts +8 -8
  33. package/dist/access-operations-batch.js +31 -30
  34. package/dist/access-operations.d.ts +13 -13
  35. package/dist/access-operations.js +35 -34
  36. package/dist/access-recall-concurrency.d.ts +10 -10
  37. package/dist/access-recall-concurrency.js +30 -29
  38. package/dist/access-recall-response.d.ts +10 -10
  39. package/dist/access-recall-response.js +30 -29
  40. package/dist/access-recall-surface.d.ts +10 -10
  41. package/dist/access-recall-surface.js +30 -29
  42. package/dist/access-schema.d.ts +84 -84
  43. package/dist/access-service-helpers.d.ts +10 -10
  44. package/dist/{access-service-CsU-ljFD.d.ts → access-service-loJadYd7.d.ts} +7 -7
  45. package/dist/access-service.d.ts +10 -10
  46. package/dist/access-service.js +30 -29
  47. package/dist/access-surface-catalog.d.ts +10 -10
  48. package/dist/access-wearables-meetings-surface.d.ts +3 -3
  49. package/dist/action-confidence.d.ts +1 -1
  50. package/dist/active-memory-bridge.d.ts +1 -1
  51. package/dist/active-recall.d.ts +1 -1
  52. package/dist/adapters/index.js +4 -4
  53. package/dist/adapters/registry.js +2 -2
  54. package/dist/ambient-provenance.d.ts +109 -0
  55. package/dist/ambient-provenance.js +22 -0
  56. package/dist/ambient-provenance.js.map +1 -0
  57. package/dist/{auto-sync-UPTUVE4X.js → auto-sync-7O6RP2RT.js} +3 -2
  58. package/dist/{auto-sync-UPTUVE4X.js.map → auto-sync-7O6RP2RT.js.map} +1 -1
  59. package/dist/behavior-learner.d.ts +1 -1
  60. package/dist/behavior-signals.d.ts +1 -1
  61. package/dist/bootstrap.d.ts +8 -8
  62. package/dist/briefing.d.ts +2 -2
  63. package/dist/briefing.js +6 -5
  64. package/dist/buffer-surprise-report.d.ts +1 -1
  65. package/dist/buffer-turn-helpers.d.ts +1 -1
  66. package/dist/buffer-turn-helpers.js +1 -1
  67. package/dist/buffer.d.ts +2 -2
  68. package/dist/buffer.js +5 -5
  69. package/dist/bulk-import/index.d.ts +3 -3
  70. package/dist/calibration.d.ts +1 -1
  71. package/dist/capabilities.d.ts +1 -1
  72. package/dist/{catalog-bctMURhN.d.ts → catalog-Iwbk9h5E.d.ts} +1 -1
  73. package/dist/causal-behavior.d.ts +1 -1
  74. package/dist/causal-consolidation.d.ts +1 -1
  75. package/dist/causal-consolidation.js +7 -6
  76. package/dist/causal-consolidation.js.map +1 -1
  77. package/dist/causal-trajectory-graph.d.ts +1 -1
  78. package/dist/{chunk-7RZJWZ46.js → chunk-227UFSEQ.js} +5 -5
  79. package/dist/{chunk-ER7W6H4T.js → chunk-2AD5SXO4.js} +5 -2
  80. package/dist/chunk-2AD5SXO4.js.map +1 -0
  81. package/dist/{chunk-XSFHWBQO.js → chunk-2DSUT7DZ.js} +10 -64
  82. package/dist/{chunk-XSFHWBQO.js.map → chunk-2DSUT7DZ.js.map} +1 -1
  83. package/dist/{chunk-DZPFMQZ7.js → chunk-3S63QIFQ.js} +1 -1
  84. package/dist/chunk-3S63QIFQ.js.map +1 -0
  85. package/dist/{chunk-UQWIKLQK.js → chunk-47J4EDGR.js} +9 -9
  86. package/dist/{chunk-5SNZSWWR.js → chunk-5LRDM4R7.js} +42 -42
  87. package/dist/{chunk-7YERSTN7.js → chunk-5R6S4DJZ.js} +7 -7
  88. package/dist/{chunk-C26TE27X.js → chunk-5VQPZ4GV.js} +3 -3
  89. package/dist/{chunk-U2VLVBBH.js → chunk-64BHFFKZ.js} +3 -3
  90. package/dist/{chunk-AJQ57VV3.js → chunk-6H744ZBH.js} +4 -4
  91. package/dist/chunk-6H744ZBH.js.map +1 -0
  92. package/dist/{chunk-7CITSYSH.js → chunk-7T4TOGMS.js} +2 -2
  93. package/dist/{chunk-ZMAYKGPN.js → chunk-7YQ6ESEA.js} +12 -41
  94. package/dist/chunk-7YQ6ESEA.js.map +1 -0
  95. package/dist/{chunk-YMAQDHQM.js → chunk-BDNL34CT.js} +2 -2
  96. package/dist/{chunk-GQL52GQ5.js → chunk-CDKHKZL5.js} +15 -12
  97. package/dist/chunk-CDKHKZL5.js.map +1 -0
  98. package/dist/{chunk-WGP57SR3.js → chunk-CK5KOVHW.js} +3 -2
  99. package/dist/{chunk-WGP57SR3.js.map → chunk-CK5KOVHW.js.map} +1 -1
  100. package/dist/{chunk-JH6BPLOP.js → chunk-E4FOAENZ.js} +4 -4
  101. package/dist/{chunk-ZFGZ6PZ2.js → chunk-FULKGK7P.js} +2 -2
  102. package/dist/{chunk-BGHFOD5A.js → chunk-HJ3SVHUW.js} +3 -3
  103. package/dist/{chunk-TYISDI6B.js → chunk-HXXTXLKA.js} +2 -2
  104. package/dist/{chunk-FZP32336.js → chunk-IDE5AR5W.js} +53 -31
  105. package/dist/chunk-IDE5AR5W.js.map +1 -0
  106. package/dist/{chunk-7SHJHPTY.js → chunk-ILBLZ5Y5.js} +2 -2
  107. package/dist/chunk-J7T4MX7P.js +131 -0
  108. package/dist/chunk-J7T4MX7P.js.map +1 -0
  109. package/dist/{chunk-DSUAAZZX.js → chunk-JFO5QZ7N.js} +2 -2
  110. package/dist/{chunk-EJHEWCGQ.js → chunk-KA47C7BF.js} +2 -2
  111. package/dist/{chunk-NUEQKLNB.js → chunk-KMWYZTIE.js} +2 -2
  112. package/dist/{chunk-TQ4GD737.js → chunk-L7G72WY4.js} +2 -2
  113. package/dist/{chunk-CLB32OHM.js → chunk-LI7OE7G6.js} +2 -2
  114. package/dist/{chunk-TN76AKO3.js → chunk-M2INOSTA.js} +2 -2
  115. package/dist/{chunk-DYVMXPCF.js → chunk-M32URQXV.js} +665 -614
  116. package/dist/chunk-M32URQXV.js.map +1 -0
  117. package/dist/{chunk-WQIHRA5F.js → chunk-N3LL5NEU.js} +2 -2
  118. package/dist/{chunk-HFPASSFV.js → chunk-P2OTGMTR.js} +2 -2
  119. package/dist/{chunk-Y7HRYCNW.js → chunk-PFJXPOD4.js} +2 -2
  120. package/dist/{chunk-MDISBSYA.js → chunk-PKCLQ7KM.js} +43 -143
  121. package/dist/chunk-PKCLQ7KM.js.map +1 -0
  122. package/dist/chunk-QW27DOHG.js +84 -0
  123. package/dist/chunk-QW27DOHG.js.map +1 -0
  124. package/dist/{chunk-ZI32MKDW.js → chunk-RCU25Z66.js} +32 -35
  125. package/dist/chunk-RCU25Z66.js.map +1 -0
  126. package/dist/{chunk-2QSZNTDO.js → chunk-RKNJBZ55.js} +4 -4
  127. package/dist/{chunk-QCECHYZL.js → chunk-RVO6TCTU.js} +6 -6
  128. package/dist/{chunk-D3I2MCN7.js → chunk-RVPTS4U5.js} +3 -3
  129. package/dist/{chunk-W3IC7QOY.js → chunk-RVYVMQK4.js} +3 -3
  130. package/dist/chunk-S2HLHAZ4.js +16 -0
  131. package/dist/chunk-S2HLHAZ4.js.map +1 -0
  132. package/dist/{chunk-2MRHJNWL.js → chunk-ST5IEK3H.js} +2 -2
  133. package/dist/{chunk-O4KMGRXE.js → chunk-SXWHN7GC.js} +2 -2
  134. package/dist/{chunk-KXEFRMCF.js → chunk-T6JRMVOV.js} +2 -2
  135. package/dist/{chunk-R5RFK3CB.js → chunk-U6JGQ37L.js} +2 -2
  136. package/dist/{chunk-UV72DEZD.js → chunk-UYUYZ4WY.js} +36 -10
  137. package/dist/chunk-UYUYZ4WY.js.map +1 -0
  138. package/dist/{chunk-EITZHSX6.js → chunk-V5FE3UAI.js} +2 -2
  139. package/dist/chunk-VL35ZFSZ.js +102 -0
  140. package/dist/chunk-VL35ZFSZ.js.map +1 -0
  141. package/dist/{chunk-NTOIP2E6.js → chunk-W2ZSNIBP.js} +2 -2
  142. package/dist/{chunk-QVSBTCVP.js → chunk-WHWDBTCJ.js} +2 -2
  143. package/dist/{chunk-5CEECY6P.js → chunk-WOC6DXP5.js} +3 -3
  144. package/dist/{chunk-XTAUXTDO.js → chunk-XBMJ35IP.js} +2 -2
  145. package/dist/{chunk-VOUOLGIP.js → chunk-YRFAYOFQ.js} +11 -13
  146. package/dist/chunk-YRFAYOFQ.js.map +1 -0
  147. package/dist/{chunk-P7NGM24P.js → chunk-YWCOJOUI.js} +2 -2
  148. package/dist/{chunk-6NNNURLK.js → chunk-Z54EM5YZ.js} +4 -4
  149. package/dist/{chunk-ULVR5KG7.js → chunk-ZDAYWJV6.js} +2 -2
  150. package/dist/chunk-ZDAYWJV6.js.map +1 -0
  151. package/dist/{cli-BBHDtG36.d.ts → cli-D_RcqXfZ.d.ts} +5 -5
  152. package/dist/cli.d.ts +12 -12
  153. package/dist/cli.js +61 -60
  154. package/dist/compat/checks.js +1 -1
  155. package/dist/compounding/engine.d.ts +2 -2
  156. package/dist/compounding/engine.js +6 -5
  157. package/dist/compounding/preference-consolidator.d.ts +1 -1
  158. package/dist/compression-optimizer.d.ts +1 -1
  159. package/dist/config.d.ts +1 -1
  160. package/dist/connectors/codex-materialize-runner.d.ts +1 -1
  161. package/dist/connectors/codex-materialize-runner.js +6 -5
  162. package/dist/connectors/codex-materialize.d.ts +1 -1
  163. package/dist/connectors/index.d.ts +1 -1
  164. package/dist/connectors/index.js +6 -5
  165. package/dist/consolidation-provenance-check.d.ts +2 -2
  166. package/dist/consolidation-undo.d.ts +2 -2
  167. package/dist/contradiction/index.d.ts +2 -2
  168. package/dist/converge-config.d.ts +1 -1
  169. package/dist/convergence-refresh.d.ts +2 -2
  170. package/dist/convergence-refresh.js +8 -7
  171. package/dist/conversation-index/backend.d.ts +1 -1
  172. package/dist/conversation-index/backend.js +2 -2
  173. package/dist/conversation-index/chunker.d.ts +1 -1
  174. package/dist/conversation-index/faiss-adapter.d.ts +1 -1
  175. package/dist/conversation-index/indexer.d.ts +1 -1
  176. package/dist/conversation-index/search.d.ts +1 -1
  177. package/dist/corpus-watermark.d.ts +1 -1
  178. package/dist/corpus-watermark.js +17 -16
  179. package/dist/day-summary.d.ts +1 -1
  180. package/dist/delinearize.d.ts +1 -1
  181. package/dist/direct-answer-wiring.d.ts +1 -1
  182. package/dist/direct-answer.d.ts +1 -1
  183. package/dist/embedding-fallback.d.ts +1 -1
  184. package/dist/enrichment/index.d.ts +1 -1
  185. package/dist/entity-retrieval.d.ts +2 -2
  186. package/dist/entity-retrieval.js +6 -5
  187. package/dist/entity-schema.d.ts +1 -1
  188. package/dist/explicit-capture.d.ts +8 -8
  189. package/dist/external-wiki-access.d.ts +10 -10
  190. package/dist/external-wiki-access.js +33 -32
  191. package/dist/external-wiki-cli.js +4 -90
  192. package/dist/external-wiki-cli.js.map +1 -1
  193. package/dist/external-wiki-collection-registration.d.ts +1 -1
  194. package/dist/external-wiki-collection.d.ts +1 -1
  195. package/dist/external-wiki-mcp-tools.d.ts +10 -10
  196. package/dist/external-wiki-search.js +2 -2
  197. package/dist/external-wiki.d.ts +1 -5
  198. package/dist/external-wiki.js +1 -3
  199. package/dist/extraction-error-classification.d.ts +1 -1
  200. package/dist/extraction-faithfulness.d.ts +1 -1
  201. package/dist/extraction-judge-telemetry.d.ts +1 -1
  202. package/dist/extraction-judge-training.d.ts +1 -1
  203. package/dist/extraction-judge.d.ts +1 -1
  204. package/dist/extraction-liveness.d.ts +1 -1
  205. package/dist/extraction-prompt.d.ts +36 -0
  206. package/dist/extraction-prompt.js +16 -0
  207. package/dist/extraction-prompt.js.map +1 -0
  208. package/dist/extraction-source-grounding-rules.d.ts +1 -1
  209. package/dist/extraction-source-grounding.d.ts +1 -1
  210. package/dist/extraction.d.ts +6 -14
  211. package/dist/extraction.js +13 -10
  212. package/dist/fallback-llm.d.ts +1 -1
  213. package/dist/{first-start-migration-F2QJD66E.js → first-start-migration-ZSHEFEI3.js} +10 -12
  214. package/dist/{first-start-migration-F2QJD66E.js.map → first-start-migration-ZSHEFEI3.js.map} +1 -1
  215. package/dist/graph-dashboard-diff.d.ts +1 -1
  216. package/dist/graph-dashboard-key.d.ts +1 -1
  217. package/dist/graph-dashboard-parser.d.ts +1 -1
  218. package/dist/graph-edge-reinforcement.d.ts +1 -1
  219. package/dist/graph-snapshot.d.ts +1 -1
  220. package/dist/graph.d.ts +1 -1
  221. package/dist/importance.d.ts +1 -1
  222. package/dist/importers/index.d.ts +1 -1
  223. package/dist/in-flight-reads.d.ts +1 -1
  224. package/dist/index.d.ts +701 -697
  225. package/dist/index.js +133 -128
  226. package/dist/intent.d.ts +1 -1
  227. package/dist/lcm/engine.d.ts +1 -1
  228. package/dist/lcm/engine.js +2 -2
  229. package/dist/lcm/index.d.ts +1 -1
  230. package/dist/lcm/index.js +2 -2
  231. package/dist/lcm/tools.d.ts +1 -1
  232. package/dist/lifecycle.d.ts +1 -1
  233. package/dist/live-connectors-runner.d.ts +1 -1
  234. package/dist/local-llm.d.ts +1 -1
  235. package/dist/local-model-endpoint.d.ts +1 -1
  236. package/dist/maintenance/memory-governance.d.ts +1 -1
  237. package/dist/maintenance/memory-governance.js +6 -5
  238. package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +2 -2
  239. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +6 -5
  240. package/dist/maintenance/rebuild-memory-projection.d.ts +2 -2
  241. package/dist/maintenance/rebuild-memory-projection.js +7 -6
  242. package/dist/{maintenance-D2mveyCd.d.ts → maintenance-DQrL93Uu.d.ts} +3 -3
  243. package/dist/mcp-memory-inspector-app.d.ts +10 -10
  244. package/dist/memory-action-policy.d.ts +1 -1
  245. package/dist/memory-cache.d.ts +1 -1
  246. package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
  247. package/dist/memory-projection-store.d.ts +1 -1
  248. package/dist/memory-provenance.d.ts +1 -1
  249. package/dist/memory-snapshot.d.ts +10 -0
  250. package/dist/memory-snapshot.js +8 -0
  251. package/dist/memory-snapshot.js.map +1 -0
  252. package/dist/memory-worth-outcomes.d.ts +2 -2
  253. package/dist/models-json.d.ts +1 -1
  254. package/dist/namespaces/migrate.d.ts +3 -3
  255. package/dist/namespaces/migrate.js +16 -15
  256. package/dist/namespaces/principal.d.ts +1 -1
  257. package/dist/namespaces/search.d.ts +1 -1
  258. package/dist/namespaces/search.js +9 -9
  259. package/dist/namespaces/storage.d.ts +3 -3
  260. package/dist/namespaces/storage.js +6 -5
  261. package/dist/native-knowledge.d.ts +1 -1
  262. package/dist/offline-sync-impression-drain.d.ts +1 -1
  263. package/dist/operator-doctor-corpus.d.ts +1 -1
  264. package/dist/operator-doctor-corpus.js +18 -17
  265. package/dist/operator-doctor-replica.d.ts +1 -1
  266. package/dist/operator-toolkit.d.ts +3 -3
  267. package/dist/operator-toolkit.js +22 -21
  268. package/dist/orchestration/compression-guideline-coordinator.d.ts +2 -2
  269. package/dist/orchestration/maintenance.d.ts +4 -4
  270. package/dist/orchestration/maintenance.js +11 -10
  271. package/dist/{orchestrator-DJYlwiUv.d.ts → orchestrator-LPGegii3.d.ts} +8 -8
  272. package/dist/orchestrator.d.ts +8 -8
  273. package/dist/orchestrator.js +93 -89
  274. package/dist/patterns-cli.d.ts +1 -1
  275. package/dist/{pipeline-CNjY4wk3.d.ts → pipeline-1h2GpiHP.d.ts} +1 -1
  276. package/dist/policy-runtime.d.ts +1 -1
  277. package/dist/proactive-contention.d.ts +1 -1
  278. package/dist/provenance.d.ts +1 -1
  279. package/dist/{qmd-C0UDZidt.d.ts → qmd-UdwoF71D.d.ts} +1 -1
  280. package/dist/qmd-preflight.d.ts +2 -2
  281. package/dist/qmd-recall-cache.d.ts +1 -1
  282. package/dist/qmd.d.ts +2 -2
  283. package/dist/qmd.js +4 -4
  284. package/dist/recall-concurrency-config.d.ts +1 -1
  285. package/dist/recall-disclosure-escalation.d.ts +1 -1
  286. package/dist/recall-explain-renderer.d.ts +1 -1
  287. package/dist/recall-explain-renderer.js +3 -3
  288. package/dist/recall-memory-map.d.ts +1 -1
  289. package/dist/recall-planner-llm.d.ts +1 -1
  290. package/dist/recall-state.d.ts +1 -1
  291. package/dist/recall-tag-filter.d.ts +1 -1
  292. package/dist/recall-timings.d.ts +1 -1
  293. package/dist/recall-xray-cli.d.ts +1 -1
  294. package/dist/recall-xray-cli.js +4 -4
  295. package/dist/recall-xray-renderer.d.ts +1 -1
  296. package/dist/recall-xray-renderer.js +3 -3
  297. package/dist/recall-xray.d.ts +1 -1
  298. package/dist/recall-xray.js +2 -2
  299. package/dist/reconcile/cursor.d.ts +1 -1
  300. package/dist/reconcile/manifest.d.ts +1 -1
  301. package/dist/reconcile/plan.d.ts +1 -1
  302. package/dist/replay/normalizers/chatgpt.d.ts +1 -1
  303. package/dist/replay/normalizers/claude.d.ts +1 -1
  304. package/dist/replay/normalizers/openclaw.d.ts +1 -1
  305. package/dist/replay/normalizers/shared.d.ts +1 -1
  306. package/dist/replay/runner.d.ts +1 -1
  307. package/dist/replay/types.d.ts +1 -1
  308. package/dist/replica-divergence.d.ts +1 -1
  309. package/dist/replica-peers-config.d.ts +1 -1
  310. package/dist/resolve-auth-token.d.ts +1 -1
  311. package/dist/retrieval-agents.d.ts +2 -2
  312. package/dist/retrieval-tiers.d.ts +1 -1
  313. package/dist/routing/engine.d.ts +1 -1
  314. package/dist/routing/store.d.ts +1 -1
  315. package/dist/salvage-envelope.d.ts +1 -1
  316. package/dist/schemas.d.ts +76 -76
  317. package/dist/{scope-profiles-BJzp2F5A.d.ts → scope-profiles-APjhSe-w.d.ts} +1 -1
  318. package/dist/sdk-compat.js.map +1 -1
  319. package/dist/search/embed-helper.d.ts +1 -1
  320. package/dist/search/factory.d.ts +1 -1
  321. package/dist/search/factory.js +8 -8
  322. package/dist/search/index.d.ts +1 -1
  323. package/dist/search/index.js +14 -14
  324. package/dist/search/lancedb-backend.d.ts +1 -1
  325. package/dist/search/meilisearch-backend.d.ts +1 -1
  326. package/dist/search/noop-backend.d.ts +1 -1
  327. package/dist/search/orama-backend.d.ts +1 -1
  328. package/dist/search/port.d.ts +1 -1
  329. package/dist/search/remote-backend.d.ts +1 -1
  330. package/dist/{semantic-consolidation-D4KAZO2G.d.ts → semantic-consolidation-CrySDbk3.d.ts} +1 -1
  331. package/dist/semantic-consolidation.d.ts +2 -2
  332. package/dist/semantic-consolidation.js +7 -6
  333. package/dist/semantic-rule-promotion.js +6 -5
  334. package/dist/semantic-rule-verifier.d.ts +1 -1
  335. package/dist/semantic-rule-verifier.js +6 -5
  336. package/dist/{service-BeDxSqE-.d.ts → service-DJ0LDyuN.d.ts} +2 -2
  337. package/dist/session-observer-bands.d.ts +1 -1
  338. package/dist/session-observer-state.d.ts +1 -1
  339. package/dist/shared-context/manager.d.ts +9 -9
  340. package/dist/signal.d.ts +1 -1
  341. package/dist/source-agent-qualifier.d.ts +4 -1
  342. package/dist/source-agent-qualifier.js +10 -9
  343. package/dist/{storage-DfjxusTE.d.ts → storage-y340tYKb.d.ts} +5 -2
  344. package/dist/storage.d.ts +2 -2
  345. package/dist/storage.js +5 -4
  346. package/dist/summarizer.d.ts +1 -1
  347. package/dist/summary-snapshot.d.ts +1 -1
  348. package/dist/temporal-supersession.d.ts +2 -2
  349. package/dist/temporal-timeline-recall.d.ts +1 -1
  350. package/dist/temporal-validity.d.ts +1 -1
  351. package/dist/threading.d.ts +1 -1
  352. package/dist/tier-migration.d.ts +2 -2
  353. package/dist/tier-migration.js +1 -1
  354. package/dist/tier-routing.d.ts +1 -1
  355. package/dist/topics.d.ts +1 -1
  356. package/dist/transcript.d.ts +1 -1
  357. package/dist/transfer/types.d.ts +66 -66
  358. package/dist/trust-score-stage.d.ts +1 -1
  359. package/dist/trust-score.d.ts +1 -1
  360. package/dist/{types-yX_FwERf.d.ts → types-D_Au9qJO.d.ts} +13 -2
  361. package/dist/types.d.ts +1 -1
  362. package/dist/types.js +1 -1
  363. package/dist/utility-runtime.d.ts +1 -1
  364. package/dist/verified-recall.js +6 -5
  365. package/dist/write-envelope.d.ts +1 -1
  366. package/package.json +2 -12
  367. package/src/access-http-offline-stream.ts +1 -0
  368. package/src/access-http.ts +0 -57
  369. package/src/access-operations-batch.ts +1 -1
  370. package/src/access-service-observe-lcm-parity.test.ts +45 -20
  371. package/src/access-service.ts +3 -4
  372. package/src/ambient-provenance.test.ts +510 -0
  373. package/src/ambient-provenance.ts +229 -0
  374. package/src/buffer-turn-helpers.ts +17 -1
  375. package/src/compat/checks.test.ts +45 -1
  376. package/src/compat/checks.ts +16 -16
  377. package/src/external-wiki-cli.ts +28 -20
  378. package/src/external-wiki-search.test.ts +68 -2
  379. package/src/external-wiki.ts +12 -38
  380. package/src/extraction-prompt.ts +142 -0
  381. package/src/extraction.ts +37 -148
  382. package/src/index.ts +1 -5
  383. package/src/maintenance/first-start-migration.ts +11 -11
  384. package/src/meetings/memory-gen.test.ts +51 -0
  385. package/src/meetings/memory-gen.ts +36 -8
  386. package/src/meetings/summary-extractor.ts +4 -2
  387. package/src/memory-snapshot.ts +15 -0
  388. package/src/orchestration/recall-internal.ts +5 -148
  389. package/src/orchestration/recall-profile-storage.ts +194 -0
  390. package/src/orchestration/recall-search-pipeline.ts +13 -182
  391. package/src/orchestration/recall-search-prefilter.ts +254 -0
  392. package/src/orchestration/session-context.ts +1 -1
  393. package/src/orchestrator.ts +1 -1
  394. package/src/sdk-compat.ts +2 -4
  395. package/src/source-agent-qualifier.ts +3 -0
  396. package/src/storage-contract/cache-coherence.test.ts +99 -0
  397. package/src/storage-fact-hash-index-defer.test.ts +14 -7
  398. package/src/storage.ts +47 -48
  399. package/src/testing/subjects/first-start-tier-migration.test.ts +75 -0
  400. package/src/testing/subjects/recall-profile-storage.test.ts +362 -0
  401. package/src/testing/subjects/recall-search-prefilter.test.ts +365 -0
  402. package/src/tier-migration.ts +10 -12
  403. package/src/types.ts +2 -2
  404. package/src/wearables/memory-gen.test.ts +82 -0
  405. package/src/wearables/memory-gen.ts +54 -5
  406. package/src/wearables/trust.ts +19 -2
  407. package/dist/chunk-AJQ57VV3.js.map +0 -1
  408. package/dist/chunk-DYVMXPCF.js.map +0 -1
  409. package/dist/chunk-DZPFMQZ7.js.map +0 -1
  410. package/dist/chunk-ER7W6H4T.js.map +0 -1
  411. package/dist/chunk-FZP32336.js.map +0 -1
  412. package/dist/chunk-GQL52GQ5.js.map +0 -1
  413. package/dist/chunk-MDISBSYA.js.map +0 -1
  414. package/dist/chunk-ULVR5KG7.js.map +0 -1
  415. package/dist/chunk-UV72DEZD.js.map +0 -1
  416. package/dist/chunk-VOUOLGIP.js.map +0 -1
  417. package/dist/chunk-ZI32MKDW.js.map +0 -1
  418. package/dist/chunk-ZMAYKGPN.js.map +0 -1
  419. package/dist/legacy-hook-compat.d.ts +0 -3
  420. package/dist/legacy-hook-compat.js +0 -36
  421. package/dist/legacy-hook-compat.js.map +0 -1
  422. package/src/legacy-hook-compat.test.ts +0 -20
  423. package/src/legacy-hook-compat.ts +0 -45
  424. /package/dist/{chunk-7RZJWZ46.js.map → chunk-227UFSEQ.js.map} +0 -0
  425. /package/dist/{chunk-UQWIKLQK.js.map → chunk-47J4EDGR.js.map} +0 -0
  426. /package/dist/{chunk-5SNZSWWR.js.map → chunk-5LRDM4R7.js.map} +0 -0
  427. /package/dist/{chunk-7YERSTN7.js.map → chunk-5R6S4DJZ.js.map} +0 -0
  428. /package/dist/{chunk-C26TE27X.js.map → chunk-5VQPZ4GV.js.map} +0 -0
  429. /package/dist/{chunk-U2VLVBBH.js.map → chunk-64BHFFKZ.js.map} +0 -0
  430. /package/dist/{chunk-7CITSYSH.js.map → chunk-7T4TOGMS.js.map} +0 -0
  431. /package/dist/{chunk-YMAQDHQM.js.map → chunk-BDNL34CT.js.map} +0 -0
  432. /package/dist/{chunk-JH6BPLOP.js.map → chunk-E4FOAENZ.js.map} +0 -0
  433. /package/dist/{chunk-ZFGZ6PZ2.js.map → chunk-FULKGK7P.js.map} +0 -0
  434. /package/dist/{chunk-BGHFOD5A.js.map → chunk-HJ3SVHUW.js.map} +0 -0
  435. /package/dist/{chunk-TYISDI6B.js.map → chunk-HXXTXLKA.js.map} +0 -0
  436. /package/dist/{chunk-7SHJHPTY.js.map → chunk-ILBLZ5Y5.js.map} +0 -0
  437. /package/dist/{chunk-DSUAAZZX.js.map → chunk-JFO5QZ7N.js.map} +0 -0
  438. /package/dist/{chunk-EJHEWCGQ.js.map → chunk-KA47C7BF.js.map} +0 -0
  439. /package/dist/{chunk-NUEQKLNB.js.map → chunk-KMWYZTIE.js.map} +0 -0
  440. /package/dist/{chunk-TQ4GD737.js.map → chunk-L7G72WY4.js.map} +0 -0
  441. /package/dist/{chunk-CLB32OHM.js.map → chunk-LI7OE7G6.js.map} +0 -0
  442. /package/dist/{chunk-TN76AKO3.js.map → chunk-M2INOSTA.js.map} +0 -0
  443. /package/dist/{chunk-WQIHRA5F.js.map → chunk-N3LL5NEU.js.map} +0 -0
  444. /package/dist/{chunk-HFPASSFV.js.map → chunk-P2OTGMTR.js.map} +0 -0
  445. /package/dist/{chunk-Y7HRYCNW.js.map → chunk-PFJXPOD4.js.map} +0 -0
  446. /package/dist/{chunk-2QSZNTDO.js.map → chunk-RKNJBZ55.js.map} +0 -0
  447. /package/dist/{chunk-QCECHYZL.js.map → chunk-RVO6TCTU.js.map} +0 -0
  448. /package/dist/{chunk-D3I2MCN7.js.map → chunk-RVPTS4U5.js.map} +0 -0
  449. /package/dist/{chunk-W3IC7QOY.js.map → chunk-RVYVMQK4.js.map} +0 -0
  450. /package/dist/{chunk-2MRHJNWL.js.map → chunk-ST5IEK3H.js.map} +0 -0
  451. /package/dist/{chunk-O4KMGRXE.js.map → chunk-SXWHN7GC.js.map} +0 -0
  452. /package/dist/{chunk-KXEFRMCF.js.map → chunk-T6JRMVOV.js.map} +0 -0
  453. /package/dist/{chunk-R5RFK3CB.js.map → chunk-U6JGQ37L.js.map} +0 -0
  454. /package/dist/{chunk-EITZHSX6.js.map → chunk-V5FE3UAI.js.map} +0 -0
  455. /package/dist/{chunk-NTOIP2E6.js.map → chunk-W2ZSNIBP.js.map} +0 -0
  456. /package/dist/{chunk-QVSBTCVP.js.map → chunk-WHWDBTCJ.js.map} +0 -0
  457. /package/dist/{chunk-5CEECY6P.js.map → chunk-WOC6DXP5.js.map} +0 -0
  458. /package/dist/{chunk-XTAUXTDO.js.map → chunk-XBMJ35IP.js.map} +0 -0
  459. /package/dist/{chunk-P7NGM24P.js.map → chunk-YWCOJOUI.js.map} +0 -0
  460. /package/dist/{chunk-6NNNURLK.js.map → chunk-Z54EM5YZ.js.map} +0 -0
@@ -28,6 +28,7 @@ import {
28
28
  type MeetingsDayFactGenResult,
29
29
  } from "./memory-generator.js";
30
30
  import { computeTrustScore, decideSmart, type TrustEvidence } from "../wearables/trust.js";
31
+ import { isHighImpactPersonalFact } from "../ambient-provenance.js";
31
32
  import { describeErrorForOperator } from "../wearables/errors.js";
32
33
  import type { MeetingRecord, MeetingsConfig } from "./types.js";
33
34
 
@@ -61,7 +62,10 @@ export function composeMeetingEpisodeContent(record: MeetingRecord): string {
61
62
  /**
62
63
  * Write the deterministic episode memory for one meeting. Idempotent: skips
63
64
  * when an identical episode already exists. Returns true when a new episode was
64
- * written. The episode is `active` (a recall anchor, not a trust-gated claim).
65
+ * written. The episode is `active` (a recall anchor, not a trust-gated claim)
66
+ * UNLESS its provider-derived title is itself a personal claim — that title
67
+ * comes from the same ambient audio the summary layer already guards, so it
68
+ * gets the same treatment rather than riding in on the anchor (#2294).
65
69
  */
66
70
  export async function writeMeetingEpisodeMemory(
67
71
  record: MeetingRecord,
@@ -92,10 +96,23 @@ export async function writeMeetingEpisodeMemory(
92
96
  if (envelope.salvageNotes.length > 0) {
93
97
  log.warn(`meeting episode write salvaged invalid fields: ${envelope.salvageNotes.join("; ")}`);
94
98
  }
99
+ // Two reasons an episode is not a trusted anchor. (1) Only the title is
100
+ // provider-derived, so the classifier reads the TITLE alone — never our own
101
+ // deterministic rendering of id, clock, attendees, and sources. (2) An
102
+ // `audio` detection is a heuristic over speech alone with no corroborating
103
+ // app span, so fifteen minutes of television with two voices produces an
104
+ // episode asserting a meeting happened, with the show's speakers listed as
105
+ // attendees. `app+audio` and `provider` records carry that corroboration and
106
+ // stay active (#2294).
107
+ const titleIsPersonalClaim =
108
+ record.title !== undefined &&
109
+ record.title.length > 0 &&
110
+ isHighImpactPersonalFact({ category: "fact", content: record.title });
111
+ const uncorroboratedDetection = record.detectionSource === "audio";
95
112
  await writer.writeSealedMemory(envelope, {
96
113
  importance: scoreImportance(content, "moment", [MEETING_SOURCE_PREFIX]),
97
114
  contentHashSource: content,
98
- status: "active",
115
+ status: titleIsPersonalClaim || uncorroboratedDetection ? "pending_review" : "active",
99
116
  memoryKind: "episode",
100
117
  });
101
118
  return true;
@@ -241,14 +258,22 @@ function resolveMeetingFactOutcome(
241
258
  config: MeetingsConfig,
242
259
  trust: number,
243
260
  judgeVerdict: "accept" | "reject" | "defer" | undefined,
261
+ claim: { category: string; content: string },
244
262
  ): "active" | "review" | "drop" {
245
263
  if (config.summaryMode === "review") {
246
264
  return judgeVerdict === "reject" ? "drop" : "review";
247
265
  }
248
- return decideSmart(trust, judgeVerdict, {
249
- autoApproveTrust: config.autoApproveTrust,
250
- reviewTrust: config.reviewTrust,
251
- }).outcome;
266
+ // A meeting transcript is the same always-on capture audio a wearable
267
+ // records, so it carries the same contamination risk — and the extractor
268
+ // hands decisions and commitments a fixed 0.8 confidence, which clears the
269
+ // default band on a judge accept alone. A high-impact personal claim tops
270
+ // out in the review queue here too (#2294).
271
+ return decideSmart(
272
+ trust,
273
+ judgeVerdict,
274
+ { autoApproveTrust: config.autoApproveTrust, reviewTrust: config.reviewTrust },
275
+ { capAtReview: isHighImpactPersonalFact(claim) },
276
+ ).outcome;
252
277
  }
253
278
 
254
279
  /**
@@ -321,7 +346,7 @@ export async function generateMeetingSummaryFacts(
321
346
  judgeVerdict,
322
347
  evidence,
323
348
  });
324
- const outcome = resolveMeetingFactOutcome(config, trust, judgeVerdict);
349
+ const outcome = resolveMeetingFactOutcome(config, trust, judgeVerdict, candidate);
325
350
  if (outcome === "drop") {
326
351
  result.dropped++;
327
352
  continue;
@@ -353,7 +378,10 @@ export async function generateMeetingSummaryFacts(
353
378
  sourceTrust: config.sourceTrust,
354
379
  evidence,
355
380
  });
356
- const outcome = resolveMeetingFactOutcome(config, summaryTrust, undefined);
381
+ const outcome = resolveMeetingFactOutcome(config, summaryTrust, undefined, {
382
+ category: "fact",
383
+ content: summaryText,
384
+ });
357
385
  if (outcome === "drop") {
358
386
  result.dropped++;
359
387
  } else {
@@ -16,6 +16,7 @@
16
16
  */
17
17
 
18
18
  import { getVerdictKind, type JudgeBatchResult, type JudgeCandidate } from "../extraction-judge.js";
19
+ import { AMBIENT_CAPTURE_PROMPT_RULE } from "../ambient-provenance.js";
19
20
  import { log } from "../logger.js";
20
21
  import type {
21
22
  MeetingFactCandidate,
@@ -38,7 +39,7 @@ export interface MeetingSummaryChatClient {
38
39
  ): Promise<{ content: string } | null>;
39
40
  }
40
41
 
41
- const SUMMARY_SYSTEM_PROMPT = `You are a meeting scribe extracting DURABLE memory from a meeting transcript and its on-screen context.
42
+ export const SUMMARY_SYSTEM_PROMPT = `You are a meeting scribe extracting DURABLE memory from a meeting transcript and its on-screen context.
42
43
 
43
44
  Return ONLY a single JSON object, no prose, no code fences, in exactly this shape:
44
45
  {
@@ -52,7 +53,8 @@ Rules:
52
53
  - decisions: concrete choices the group made. Omit hypotheticals and discussion that led nowhere.
53
54
  - commitments: owner-bearing action items only. If there is no clear owner, omit it.
54
55
  - openQuestions: genuinely unresolved questions, not rhetorical asides.
55
- - Prefer fewer, higher-quality items. Use [] for any empty list. Never invent content the transcript does not support.`;
56
+ - Prefer fewer, higher-quality items. Use [] for any empty list. Never invent content the transcript does not support.
57
+ ${AMBIENT_CAPTURE_PROMPT_RULE}`;
56
58
 
57
59
  const DECISION_CONFIDENCE = 0.8;
58
60
  const COMMITMENT_CONFIDENCE = 0.8;
@@ -0,0 +1,15 @@
1
+ import type { MemoryFile } from "./types.js";
2
+
3
+ function sortSnapshotObject(_key: string, candidate: unknown): unknown {
4
+ if (candidate === null || typeof candidate !== "object" || Array.isArray(candidate)) return candidate;
5
+ return Object.keys(candidate)
6
+ .sort()
7
+ .reduce<Record<string, unknown>>((sorted, key) => {
8
+ sorted[key] = (candidate as Record<string, unknown>)[key];
9
+ return sorted;
10
+ }, {});
11
+ }
12
+
13
+ export function createMemorySnapshot(memory: MemoryFile): string {
14
+ return JSON.stringify([memory.frontmatter, memory.content], sortSnapshotObject);
15
+ }
@@ -102,6 +102,7 @@ import {
102
102
  type RecallResultPartitionSink,
103
103
  } from "./recall-rerank-coordinator.js";
104
104
  import type { RecallInternalDeps } from "./recall-internal-deps.js";
105
+ import { resolveCompositeProfileStorage } from "./recall-profile-storage.js";
105
106
 
106
107
  export class RecallInternalCoordinator {
107
108
  constructor(
@@ -686,154 +687,10 @@ export class RecallInternalCoordinator {
686
687
  const profileStorages = await Promise.all(
687
688
  profileStorageNamespaces.map((namespace) => this.deps.storageRouter.storageFor(namespace)),
688
689
  );
689
- const emptyProfileStorage = new Proxy(
690
- { dir: path.join(this.deps.config.memoryDir, ".empty-scope-profile") } as any,
691
- {
692
- get(target, prop: string | symbol) {
693
- if (prop in target) return target[prop];
694
- if (prop === "readProfile") return async () => "";
695
- if (
696
- prop === "readQuestions" ||
697
- prop === "listEntityNames" ||
698
- prop === "readContinuityIncidents"
699
- )
700
- return async () => [];
701
- if (
702
- prop === "readIdentityAnchor" ||
703
- prop === "readIdentityImprovementLoops"
704
- )
705
- return async () => "";
706
- if (prop === "readEntity" || prop === "readMemoryByPath")
707
- return async () => null;
708
- return async () => [];
709
- },
710
- },
711
- );
712
- const profileStorage =
713
- profileStorages.length <= 1
714
- ? profileStorages[0] ?? emptyProfileStorage
715
- : new Proxy(profileStorages[0] as any, {
716
- get(target, prop: string | symbol) {
717
- if (prop === "readProfile") {
718
- return async () => {
719
- for (const storage of profileStorages) {
720
- const profile = await storage.readProfile();
721
- if (profile.trim().length > 0) return profile;
722
- }
723
- return "";
724
- };
725
- }
726
- if (prop === "readQuestions") {
727
- return async (...args: any[]) => {
728
- const merged: any[] = [];
729
- const seen = new Set<string>();
730
- const priorityOf = (question: any): number => {
731
- const priority = Number(question?.priority ?? 0);
732
- return Number.isFinite(priority) ? priority : 0;
733
- };
734
- for (const storage of profileStorages) {
735
- const questions = await (storage.readQuestions as any)(...args);
736
- for (const question of questions) {
737
- const key = typeof question === "string" ? question : JSON.stringify(question);
738
- if (seen.has(key)) continue;
739
- seen.add(key);
740
- merged.push(question);
741
- }
742
- }
743
- return merged.sort(
744
- (left, right) =>
745
- priorityOf(right) - priorityOf(left) ||
746
- String(left?.id ?? "").localeCompare(String(right?.id ?? "")),
747
- );
748
- };
749
- }
750
- if (prop === "readIdentityAnchor") {
751
- return async () => {
752
- for (const storage of profileStorages) {
753
- const anchor = (await storage.readIdentityAnchor()) ?? "";
754
- if (anchor.trim().length > 0) return anchor;
755
- }
756
- return "";
757
- };
758
- }
759
- if (prop === "readIdentityImprovementLoops") {
760
- return async () => {
761
- const sections: string[] = [];
762
- const seen = new Set<string>();
763
- for (const storage of profileStorages) {
764
- const loops = ((await storage.readIdentityImprovementLoops()) ?? "").trim();
765
- if (!loops || seen.has(loops)) continue;
766
- seen.add(loops);
767
- sections.push(loops);
768
- }
769
- return sections.join("\n\n");
770
- };
771
- }
772
- if (prop === "readContinuityIncidents") {
773
- return async (...args: any[]) => {
774
- const limit = typeof args[0] === "number" && Number.isFinite(args[0]) ? Math.max(0, args[0]) : undefined;
775
- const incidents: any[] = [];
776
- const seen = new Set<string>();
777
- const incidentTime = (incident: any): number => {
778
- const raw = incident?.updatedAt ?? incident?.openedAt ?? incident?.createdAt;
779
- const parsed = typeof raw === "string" ? Date.parse(raw) : Number.NaN;
780
- return Number.isFinite(parsed) ? parsed : 0;
781
- };
782
- for (const storage of profileStorages) {
783
- for (const incident of await (storage.readContinuityIncidents as any)(...args)) {
784
- const key = JSON.stringify(incident);
785
- if (seen.has(key)) continue;
786
- seen.add(key);
787
- incidents.push(incident);
788
- }
789
- }
790
- incidents.sort(
791
- (left, right) =>
792
- incidentTime(right) - incidentTime(left) ||
793
- String(left?.id ?? "").localeCompare(String(right?.id ?? "")),
794
- );
795
- return limit === undefined ? incidents : incidents.slice(0, limit);
796
- };
797
- }
798
- if (prop === "listEntityNames") {
799
- return async (...args: any[]) => {
800
- const names = new Set<string>();
801
- for (const storage of profileStorages) {
802
- for (const name of await (storage.listEntityNames as any)(...args)) names.add(name);
803
- }
804
- return [...names];
805
- };
806
- }
807
- if (prop === "readEntity" || prop === "readMemoryByPath") {
808
- return async (...args: any[]) => {
809
- for (const storage of profileStorages) {
810
- const value = await (storage as any)[prop](...args);
811
- if (value) return value;
812
- }
813
- return null;
814
- };
815
- }
816
- if (prop === "readAllMemories") {
817
- return async (...args: any[]) => {
818
- const memories: any[] = [];
819
- const seen = new Set<string>();
820
- for (const storage of profileStorages) {
821
- for (const memory of await (storage.readAllMemories as any)(...args)) {
822
- const key = String(memory?.path ?? memory?.frontmatter?.id ?? JSON.stringify(memory));
823
- if (seen.has(key)) continue;
824
- seen.add(key);
825
- memories.push(memory);
826
- }
827
- }
828
- return memories;
829
- };
830
- }
831
- return target[prop];
832
- },
833
- });
834
- const profileStorageDirs = Array.from(
835
- new Set(profileStorages.map((storage) => storage.dir).filter((dir): dir is string => typeof dir === "string" && dir.length > 0)),
836
- );
690
+ const { profileStorage, profileStorageDirs } = resolveCompositeProfileStorage({
691
+ profileStorages,
692
+ memoryDir: this.deps.config.memoryDir,
693
+ });
837
694
 
838
695
  // --- Phase 1: Launch ALL independent data fetches in parallel ---
839
696
  throwIfRecallAborted(options.abortSignal);
@@ -0,0 +1,194 @@
1
+ /**
2
+ * Composite profile storage proxy for recall orchestration — extracted from
3
+ * recall-internal.ts (issue #1526, seam 18).
4
+ */
5
+
6
+ import path from "node:path";
7
+ import type { StorageManager } from "../index.js";
8
+
9
+ export interface CompositeProfileStorageOptions {
10
+ profileStorages: StorageManager[];
11
+ memoryDir: string;
12
+ }
13
+
14
+ export interface CompositeProfileStorageResult {
15
+ profileStorage: StorageManager;
16
+ profileStorageDirs: string[];
17
+ }
18
+
19
+ /**
20
+ * Creates a composite profile storage proxy over multiple namespace storage instances.
21
+ * When multiple storages exist, methods aggregate results across all instances.
22
+ * When storages is empty, returns a safe empty fallback storage.
23
+ */
24
+ export function resolveCompositeProfileStorage(
25
+ options: CompositeProfileStorageOptions,
26
+ ): CompositeProfileStorageResult {
27
+ const { profileStorages, memoryDir } = options;
28
+
29
+ const emptyProfileStorage = new Proxy(
30
+ { dir: path.join(memoryDir, ".empty-scope-profile") } as unknown as StorageManager,
31
+ {
32
+ get(target, prop: string | symbol) {
33
+ if (prop in target) return Reflect.get(target, prop);
34
+ if (prop === "readProfile") return async () => "";
35
+ if (
36
+ prop === "readQuestions" ||
37
+ prop === "listEntityNames" ||
38
+ prop === "readContinuityIncidents"
39
+ )
40
+ return async () => [];
41
+ if (
42
+ prop === "readIdentityAnchor" ||
43
+ prop === "readIdentityImprovementLoops"
44
+ )
45
+ return async () => "";
46
+ if (prop === "readEntity" || prop === "readMemoryByPath")
47
+ return async () => null;
48
+ return async () => [];
49
+ },
50
+ },
51
+ );
52
+
53
+ const profileStorage =
54
+ profileStorages.length <= 1
55
+ ? profileStorages[0] ?? emptyProfileStorage
56
+ : new Proxy(profileStorages[0] as StorageManager, {
57
+ get(target, prop: string | symbol) {
58
+ if (prop === "readProfile") {
59
+ return async () => {
60
+ for (const storage of profileStorages) {
61
+ const profile = await storage.readProfile();
62
+ if (profile.trim().length > 0) return profile;
63
+ }
64
+ return "";
65
+ };
66
+ }
67
+ if (prop === "readQuestions") {
68
+ return async (...args: unknown[]) => {
69
+ const merged: unknown[] = [];
70
+ const seen = new Set<string>();
71
+ const priorityOf = (question: unknown): number => {
72
+ const priority = Number((question as Record<string, unknown>)?.priority ?? 0);
73
+ return Number.isFinite(priority) ? priority : 0;
74
+ };
75
+ for (const storage of profileStorages) {
76
+ const readFn = (storage as unknown as Record<string, (...a: unknown[]) => Promise<unknown[]>>).readQuestions;
77
+ const questions = await readFn.call(storage, ...args);
78
+ for (const question of questions) {
79
+ const key = typeof question === "string" ? question : JSON.stringify(question);
80
+ if (seen.has(key)) continue;
81
+ seen.add(key);
82
+ merged.push(question);
83
+ }
84
+ }
85
+ return merged.sort(
86
+ (left, right) =>
87
+ priorityOf(right) - priorityOf(left) ||
88
+ String((left as Record<string, unknown>)?.id ?? "").localeCompare(String((right as Record<string, unknown>)?.id ?? "")),
89
+ );
90
+ };
91
+ }
92
+ if (prop === "readIdentityAnchor") {
93
+ return async () => {
94
+ for (const storage of profileStorages) {
95
+ const anchor = (await storage.readIdentityAnchor()) ?? "";
96
+ if (anchor.trim().length > 0) return anchor;
97
+ }
98
+ return "";
99
+ };
100
+ }
101
+ if (prop === "readIdentityImprovementLoops") {
102
+ return async () => {
103
+ const sections: string[] = [];
104
+ const seen = new Set<string>();
105
+ for (const storage of profileStorages) {
106
+ const loops = ((await storage.readIdentityImprovementLoops()) ?? "").trim();
107
+ if (!loops || seen.has(loops)) continue;
108
+ seen.add(loops);
109
+ sections.push(loops);
110
+ }
111
+ return sections.join("\n\n");
112
+ };
113
+ }
114
+ if (prop === "readContinuityIncidents") {
115
+ return async (...args: unknown[]) => {
116
+ const limit = typeof args[0] === "number" && Number.isFinite(args[0]) ? Math.max(0, args[0]) : undefined;
117
+ const incidents: unknown[] = [];
118
+ const seen = new Set<string>();
119
+ const incidentTime = (incident: unknown): number => {
120
+ const incObj = incident as Record<string, unknown>;
121
+ const raw = incObj?.updatedAt ?? incObj?.openedAt ?? incObj?.createdAt;
122
+ const parsed = typeof raw === "string" ? Date.parse(raw) : Number.NaN;
123
+ return Number.isFinite(parsed) ? parsed : 0;
124
+ };
125
+ for (const storage of profileStorages) {
126
+ const readFn = (storage as unknown as Record<string, (...a: unknown[]) => Promise<unknown[]>>).readContinuityIncidents;
127
+ for (const incident of await readFn.call(storage, ...args)) {
128
+ const key = JSON.stringify(incident);
129
+ if (seen.has(key)) continue;
130
+ seen.add(key);
131
+ incidents.push(incident);
132
+ }
133
+ }
134
+ incidents.sort(
135
+ (left, right) =>
136
+ incidentTime(right) - incidentTime(left) ||
137
+ String((left as Record<string, unknown>)?.id ?? "").localeCompare(String((right as Record<string, unknown>)?.id ?? "")),
138
+ );
139
+ return limit === undefined ? incidents : incidents.slice(0, limit);
140
+ };
141
+ }
142
+ if (prop === "listEntityNames") {
143
+ return async (...args: unknown[]) => {
144
+ const names = new Set<string>();
145
+ for (const storage of profileStorages) {
146
+ const listFn = (storage as unknown as Record<string, (...a: unknown[]) => Promise<string[]>>).listEntityNames;
147
+ for (const name of await listFn.call(storage, ...args)) names.add(name);
148
+ }
149
+ return [...names];
150
+ };
151
+ }
152
+ if (prop === "readEntity" || prop === "readMemoryByPath") {
153
+ return async (...args: unknown[]) => {
154
+ for (const storage of profileStorages) {
155
+ const methodFn = (storage as unknown as Record<string, (...a: unknown[]) => Promise<unknown>>)[prop as string];
156
+ if (methodFn) {
157
+ const value = await methodFn.call(storage, ...args);
158
+ if (value) return value;
159
+ }
160
+ }
161
+ return null;
162
+ };
163
+ }
164
+ if (prop === "readAllMemories") {
165
+ return async (...args: unknown[]) => {
166
+ const memories: unknown[] = [];
167
+ const seen = new Set<string>();
168
+ for (const storage of profileStorages) {
169
+ const readFn = (storage as unknown as Record<string, (...a: unknown[]) => Promise<unknown[]>>).readAllMemories;
170
+ for (const memory of await readFn.call(storage, ...args)) {
171
+ const memObj = memory as Record<string, unknown>;
172
+ const key = String(memObj?.path ?? (memObj?.frontmatter as Record<string, unknown>)?.id ?? JSON.stringify(memory));
173
+ if (seen.has(key)) continue;
174
+ seen.add(key);
175
+ memories.push(memory);
176
+ }
177
+ }
178
+ return memories;
179
+ };
180
+ }
181
+ return Reflect.get(target, prop);
182
+ },
183
+ });
184
+
185
+ const profileStorageDirs = Array.from(
186
+ new Set(
187
+ profileStorages
188
+ .map((storage) => storage.dir)
189
+ .filter((dir): dir is string => typeof dir === "string" && dir.length > 0),
190
+ ),
191
+ );
192
+
193
+ return { profileStorage, profileStorageDirs };
194
+ }