@remnic/core 9.65.6 → 9.65.7

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 (506) hide show
  1. package/dist/access-admin-ops-surface.d.ts +11 -11
  2. package/dist/access-admin-ops-surface.js +31 -31
  3. package/dist/access-audit.js +2 -2
  4. package/dist/access-authorization-probe.d.ts +11 -11
  5. package/dist/access-authorization-probe.js +32 -32
  6. package/dist/access-boundary.d.ts +11 -11
  7. package/dist/access-boundary.js +31 -31
  8. package/dist/access-cli.js +111 -106
  9. package/dist/access-cli.js.map +1 -1
  10. package/dist/access-coding-context-resolution.d.ts +1 -1
  11. package/dist/access-extraction-force-flush.d.ts +11 -11
  12. package/dist/access-extraction-force-flush.js +31 -31
  13. package/dist/access-health-types.d.ts +1 -1
  14. package/dist/access-http-lcm-compaction.d.ts +11 -11
  15. package/dist/access-http-lifecycle-flush.d.ts +11 -11
  16. package/dist/access-http-offline-stream.d.ts +11 -11
  17. package/dist/access-http-query.d.ts +2 -2
  18. package/dist/access-http-query.js +33 -33
  19. package/dist/access-http.d.ts +13 -18
  20. package/dist/access-http.js +50 -48
  21. package/dist/access-identity-continuity-surface.d.ts +9 -9
  22. package/dist/access-identity-continuity-surface.js +31 -31
  23. package/dist/access-lcm-surface.d.ts +11 -11
  24. package/dist/access-lcm-surface.js +31 -31
  25. package/dist/access-mcp-output-schemas.js +1 -1
  26. package/dist/access-mcp.d.ts +11 -11
  27. package/dist/access-mcp.js +42 -40
  28. package/dist/access-memory-search-fanout.d.ts +2 -2
  29. package/dist/{access-namespace-preflight-D_6mo8ms.d.ts → access-namespace-preflight-8VYKmRX0.d.ts} +1 -1
  30. package/dist/access-namespace-preflight.d.ts +3 -3
  31. package/dist/access-namespace-preflight.js +31 -31
  32. package/dist/access-observe-write-surface.d.ts +11 -11
  33. package/dist/access-observe-write-surface.js +31 -31
  34. package/dist/access-offline-manifest.d.ts +9 -9
  35. package/dist/access-operations-batch.js +34 -34
  36. package/dist/access-operations.d.ts +12 -12
  37. package/dist/access-operations.js +39 -37
  38. package/dist/access-recall-concurrency.d.ts +11 -11
  39. package/dist/access-recall-concurrency.js +31 -31
  40. package/dist/access-recall-response.d.ts +11 -11
  41. package/dist/access-recall-response.js +31 -31
  42. package/dist/access-recall-surface.d.ts +11 -11
  43. package/dist/access-recall-surface.js +31 -31
  44. package/dist/access-schema.js +3 -3
  45. package/dist/{access-service-sbiNS5UB.d.ts → access-service-Crk__Git.d.ts} +8 -8
  46. package/dist/access-service-helpers.d.ts +11 -11
  47. package/dist/access-service.d.ts +11 -11
  48. package/dist/access-service.js +31 -31
  49. package/dist/access-surface-catalog.d.ts +11 -11
  50. package/dist/access-surface-catalog.js +43 -33
  51. package/dist/access-surface-catalog.js.map +1 -1
  52. package/dist/access-wearables-meetings-surface.d.ts +3 -3
  53. package/dist/action-confidence.d.ts +1 -1
  54. package/dist/active-memory-bridge.d.ts +1 -1
  55. package/dist/active-recall.d.ts +1 -1
  56. package/dist/active-recall.js +4 -4
  57. package/dist/adapters/index.js +4 -4
  58. package/dist/adapters/registry.js +2 -2
  59. package/dist/ambient-provenance.d.ts +1 -1
  60. package/dist/artifact-search.d.ts +1 -1
  61. package/dist/behavior-learner.d.ts +1 -1
  62. package/dist/behavior-signals.d.ts +1 -1
  63. package/dist/bootstrap.d.ts +9 -9
  64. package/dist/briefing-window.d.ts +2 -2
  65. package/dist/briefing.d.ts +2 -2
  66. package/dist/briefing.js +10 -10
  67. package/dist/buffer-surprise-report.d.ts +1 -1
  68. package/dist/buffer-turn-helpers.d.ts +1 -1
  69. package/dist/buffer.d.ts +2 -2
  70. package/dist/bulk-import/index.d.ts +3 -3
  71. package/dist/calibration.d.ts +1 -1
  72. package/dist/capabilities.d.ts +1 -1
  73. package/dist/{capsule-crypto-GWVG7LGC.js → capsule-crypto-7FJQINUR.js} +2 -2
  74. package/dist/{catalog-DO_7zfkv.d.ts → catalog-DybwVNW3.d.ts} +1 -1
  75. package/dist/causal-behavior.d.ts +1 -1
  76. package/dist/causal-behavior.js +2 -2
  77. package/dist/causal-chain.js +2 -2
  78. package/dist/causal-consolidation.d.ts +1 -1
  79. package/dist/causal-consolidation.js +13 -13
  80. package/dist/causal-retrieval.js +2 -2
  81. package/dist/causal-trajectory-graph.d.ts +1 -1
  82. package/dist/causal-trajectory-graph.js +2 -2
  83. package/dist/causal-trajectory.js +1 -1
  84. package/dist/{chunk-OWHERGF2.js → chunk-2NLLXCJG.js} +2 -2
  85. package/dist/{chunk-NZPFCP5A.js → chunk-2PSX5BJU.js} +2 -2
  86. package/dist/chunk-3BCULS4U.js +1093 -0
  87. package/dist/chunk-3BCULS4U.js.map +1 -0
  88. package/dist/{chunk-W6J4POB6.js → chunk-3RI5Y7KU.js} +2 -2
  89. package/dist/{chunk-H7BZBSP6.js → chunk-52II7PB6.js} +4 -4
  90. package/dist/{chunk-IF4EY26E.js → chunk-5DH6PG4B.js} +2 -2
  91. package/dist/{chunk-M4AHBM72.js → chunk-5HERQ5FX.js} +10 -10
  92. package/dist/{chunk-IRXMJLTW.js → chunk-5HK3CJAR.js} +2 -2
  93. package/dist/{chunk-XAWIL7TC.js → chunk-5S4LQOPE.js} +2 -2
  94. package/dist/{chunk-IDQ6DKXC.js → chunk-5VPQSRQO.js} +3 -3
  95. package/dist/{chunk-ROEAEANL.js → chunk-6CPUQ5D6.js} +10 -10
  96. package/dist/{chunk-SR7JIRAR.js → chunk-7F27PCSN.js} +2 -2
  97. package/dist/{chunk-7OZSHBWK.js → chunk-7TCGNUVP.js} +2 -2
  98. package/dist/{chunk-KBOG7FJV.js → chunk-7WR462EM.js} +2 -2
  99. package/dist/{chunk-AYAZWXJI.js → chunk-A32YEQAM.js} +2 -2
  100. package/dist/{chunk-5GIZM4RX.js → chunk-ACOC27BB.js} +2 -2
  101. package/dist/{chunk-5W7MKXMU.js → chunk-AFR6AIM4.js} +144 -78
  102. package/dist/chunk-AFR6AIM4.js.map +1 -0
  103. package/dist/{chunk-OMZLBT4B.js → chunk-ANJXPFRS.js} +47 -26
  104. package/dist/chunk-ANJXPFRS.js.map +1 -0
  105. package/dist/{chunk-FC7TIRFS.js → chunk-AX7UXCHJ.js} +6 -1
  106. package/dist/chunk-AX7UXCHJ.js.map +1 -0
  107. package/dist/{chunk-6LS5OX3U.js → chunk-BJTHRFFC.js} +6 -6
  108. package/dist/chunk-BWGCOLEL.js +61 -0
  109. package/dist/chunk-BWGCOLEL.js.map +1 -0
  110. package/dist/{chunk-PGW64IFQ.js → chunk-CFGU52XJ.js} +2 -2
  111. package/dist/{chunk-DPNXADEI.js → chunk-D4QVPP3G.js} +2 -2
  112. package/dist/{chunk-2RXUZVPU.js → chunk-EOHKUWXW.js} +2 -2
  113. package/dist/{chunk-YNDLCWXS.js → chunk-EZ25VE3G.js} +4 -4
  114. package/dist/{chunk-ZK4BFABK.js → chunk-F635GAL7.js} +4 -4
  115. package/dist/{chunk-HWVNYNIV.js → chunk-F6QHHRWP.js} +2 -2
  116. package/dist/{chunk-YUTTMSC7.js → chunk-FMQ4MOQO.js} +89 -26
  117. package/dist/chunk-FMQ4MOQO.js.map +1 -0
  118. package/dist/{chunk-LDBFXD4F.js → chunk-FP7YTTVO.js} +3 -1
  119. package/dist/chunk-FP7YTTVO.js.map +1 -0
  120. package/dist/{chunk-O4BAGJDN.js → chunk-GEPACVWN.js} +2 -2
  121. package/dist/{chunk-XZBXINXZ.js → chunk-GIC6BASP.js} +4 -4
  122. package/dist/{chunk-PP7R754B.js → chunk-GPFZFCRN.js} +1 -1
  123. package/dist/{chunk-LSYD7GHZ.js → chunk-GTSVEEP3.js} +2 -2
  124. package/dist/{chunk-RQ2EQRRR.js → chunk-I4343FIA.js} +79 -6
  125. package/dist/chunk-I4343FIA.js.map +1 -0
  126. package/dist/{chunk-YWBOOBDP.js → chunk-I7EX6KSH.js} +58 -58
  127. package/dist/{chunk-3I22VWB3.js → chunk-IP4ZNT4U.js} +2 -2
  128. package/dist/{chunk-AXGFOFNY.js → chunk-IY7UXD3J.js} +2 -2
  129. package/dist/{chunk-6FUMA6AA.js → chunk-JAQXUGLN.js} +2 -2
  130. package/dist/{chunk-RKNJBZ55.js → chunk-JBPKEARU.js} +4 -4
  131. package/dist/chunk-JCCWJHOP.js +240 -0
  132. package/dist/chunk-JCCWJHOP.js.map +1 -0
  133. package/dist/{chunk-5W7CTZ2E.js → chunk-KQAFEZQX.js} +4 -4
  134. package/dist/{chunk-D2YNNDML.js → chunk-KWIGDKM2.js} +2 -2
  135. package/dist/{chunk-2JHRCWHT.js → chunk-LLQCM2U2.js} +85 -85
  136. package/dist/{chunk-OLBZ2WGG.js → chunk-LTBKKSCX.js} +2 -2
  137. package/dist/{chunk-RACZB5HT.js → chunk-N37X5RU7.js} +4 -4
  138. package/dist/{chunk-FEO2CDXR.js → chunk-NG3MBQV4.js} +2 -2
  139. package/dist/{chunk-AG46P24C.js → chunk-NNBZS3DY.js} +4 -4
  140. package/dist/{chunk-JGG5HVI2.js → chunk-OPGL46PX.js} +2 -2
  141. package/dist/{chunk-OUKBMQ2O.js → chunk-PD66CVSD.js} +2 -2
  142. package/dist/{chunk-7SSRXEZJ.js → chunk-PDDSFELN.js} +2 -2
  143. package/dist/{chunk-MVIYRRVJ.js → chunk-PMVPCZJZ.js} +5 -5
  144. package/dist/{chunk-D35XLYQ7.js → chunk-RGCF4XNH.js} +9 -9
  145. package/dist/{chunk-PNAGNVGK.js → chunk-RQE4TITU.js} +35 -30
  146. package/dist/chunk-RQE4TITU.js.map +1 -0
  147. package/dist/{chunk-X2DWBWOX.js → chunk-S3K2CIK5.js} +2 -2
  148. package/dist/{chunk-TWBQQ3FT.js → chunk-SEA6M7SS.js} +2 -2
  149. package/dist/{chunk-DYO24BNB.js → chunk-SVVIASVX.js} +2 -2
  150. package/dist/{chunk-7K5Q6COX.js → chunk-TVVEYCNW.js} +4 -4
  151. package/dist/{chunk-4K7IW3F7.js → chunk-UD7UNYRD.js} +34 -3
  152. package/dist/chunk-UD7UNYRD.js.map +1 -0
  153. package/dist/chunk-ULM7JCDH.js +154 -0
  154. package/dist/chunk-ULM7JCDH.js.map +1 -0
  155. package/dist/{chunk-NLUCDKLT.js → chunk-VKCAHCBI.js} +2 -2
  156. package/dist/{chunk-BXXOPKT5.js → chunk-VXVZ2GM3.js} +2 -2
  157. package/dist/chunk-W2UOAATB.js +521 -0
  158. package/dist/chunk-W2UOAATB.js.map +1 -0
  159. package/dist/{chunk-JFWZRUKP.js → chunk-WTOZBZNN.js} +3 -3
  160. package/dist/{chunk-UVYI6VIX.js → chunk-X7Y7WX73.js} +1 -1
  161. package/dist/{chunk-5TG4MU2U.js → chunk-YKWFK7XA.js} +5 -5
  162. package/dist/{chunk-BIJAWZYW.js → chunk-YMOPYG3K.js} +6 -6
  163. package/dist/{chunk-XUZ5CIEE.js → chunk-YRVAKONL.js} +1 -1
  164. package/dist/{chunk-53MZQEBD.js → chunk-YWSQD2IB.js} +2 -2
  165. package/dist/{chunk-US4IRASK.js → chunk-Z4U3UN56.js} +2 -2
  166. package/dist/{chunk-QMZY3GG6.js → chunk-ZAOHJDKH.js} +3 -3
  167. package/dist/{chunk-ZXUZ54Z5.js → chunk-ZIJDI4CP.js} +2 -2
  168. package/dist/{cli-Bfgo0n1L.d.ts → cli-B322UMvB.d.ts} +5 -5
  169. package/dist/cli.d.ts +13 -13
  170. package/dist/cli.js +75 -74
  171. package/dist/coding/pre-action-gate.d.ts +1 -1
  172. package/dist/coding/pre-action-gate.js +2 -2
  173. package/dist/compounding/engine.d.ts +2 -2
  174. package/dist/compounding/engine.js +10 -10
  175. package/dist/compounding/preference-consolidator.d.ts +1 -1
  176. package/dist/compression-optimizer.d.ts +1 -1
  177. package/dist/config.d.ts +1 -1
  178. package/dist/config.js +4 -4
  179. package/dist/connectors/codex-materialize-runner.d.ts +1 -1
  180. package/dist/connectors/codex-materialize-runner.js +10 -10
  181. package/dist/connectors/codex-materialize.d.ts +1 -1
  182. package/dist/connectors/index.d.ts +1 -1
  183. package/dist/connectors/index.js +10 -10
  184. package/dist/consolidation-provenance-check.d.ts +2 -2
  185. package/dist/consolidation-undo.d.ts +2 -2
  186. package/dist/contradiction/index.d.ts +3 -3
  187. package/dist/converge-config.d.ts +1 -1
  188. package/dist/convergence-refresh.d.ts +2 -2
  189. package/dist/convergence-refresh.js +12 -12
  190. package/dist/conversation-index/backend.d.ts +1 -1
  191. package/dist/conversation-index/chunker.d.ts +1 -1
  192. package/dist/conversation-index/faiss-adapter.d.ts +1 -1
  193. package/dist/conversation-index/indexer.d.ts +1 -1
  194. package/dist/conversation-index/search.d.ts +1 -1
  195. package/dist/corpus-watermark.d.ts +1 -1
  196. package/dist/corpus-watermark.js +12 -12
  197. package/dist/cross-lingual-recall.d.ts +1 -1
  198. package/dist/dashboard-runtime.js +2 -2
  199. package/dist/day-summary.d.ts +1 -1
  200. package/dist/delinearize.d.ts +1 -1
  201. package/dist/dependency-propagation-config.d.ts +1 -1
  202. package/dist/{dependency-propagation-delivery-D23_x-s5.d.ts → dependency-propagation-delivery-BGcNairQ.d.ts} +1 -1
  203. package/dist/direct-answer-wiring.d.ts +1 -1
  204. package/dist/direct-answer.d.ts +1 -1
  205. package/dist/embedding-fallback.d.ts +1 -1
  206. package/dist/enrichment/index.d.ts +1 -1
  207. package/dist/entity-origin-fields.d.ts +1 -1
  208. package/dist/entity-retrieval.d.ts +2 -2
  209. package/dist/entity-retrieval.js +10 -10
  210. package/dist/entity-schema.d.ts +1 -1
  211. package/dist/episodic-context.d.ts +1 -1
  212. package/dist/eval-trajectory-contracts.d.ts +256 -0
  213. package/dist/eval-trajectory-contracts.js +56 -0
  214. package/dist/eval-trajectory-store.d.ts +39 -0
  215. package/dist/eval-trajectory-store.js +19 -0
  216. package/dist/eval-trajectory-store.js.map +1 -0
  217. package/dist/eval-trajectory.d.ts +67 -0
  218. package/dist/eval-trajectory.js +46 -0
  219. package/dist/eval-trajectory.js.map +1 -0
  220. package/dist/event-order-recall.js +2 -2
  221. package/dist/explicit-capture.d.ts +9 -9
  222. package/dist/external-wiki-access.d.ts +11 -11
  223. package/dist/external-wiki-access.js +32 -32
  224. package/dist/external-wiki-collection-registration.d.ts +1 -1
  225. package/dist/external-wiki-collection.d.ts +1 -1
  226. package/dist/external-wiki-mcp-tools.d.ts +11 -11
  227. package/dist/extraction-error-classification.d.ts +1 -1
  228. package/dist/extraction-faithfulness.d.ts +1 -1
  229. package/dist/extraction-judge-telemetry.d.ts +1 -1
  230. package/dist/extraction-judge-training.d.ts +1 -1
  231. package/dist/extraction-judge.d.ts +1 -1
  232. package/dist/extraction-liveness.d.ts +1 -1
  233. package/dist/extraction-normalization.d.ts +1 -1
  234. package/dist/extraction-prompt.d.ts +1 -1
  235. package/dist/extraction-source-grounding-rules.d.ts +1 -1
  236. package/dist/extraction-source-grounding.d.ts +1 -1
  237. package/dist/extraction.d.ts +1 -1
  238. package/dist/extraction.js +12 -12
  239. package/dist/fallback-llm.d.ts +1 -1
  240. package/dist/graph-dashboard-diff.d.ts +1 -1
  241. package/dist/graph-dashboard-key.d.ts +1 -1
  242. package/dist/graph-dashboard-parser.d.ts +1 -1
  243. package/dist/{graph-edge-decay-FXGELBFA.js → graph-edge-decay-A4SDFMMS.js} +4 -4
  244. package/dist/graph-edge-decay-A4SDFMMS.js.map +1 -0
  245. package/dist/graph-edge-reinforcement.d.ts +1 -1
  246. package/dist/graph-path-reconstruction.d.ts +1 -1
  247. package/dist/graph-path-scoring.d.ts +1 -1
  248. package/dist/graph-snapshot.d.ts +1 -1
  249. package/dist/graph-snapshot.js +3 -3
  250. package/dist/graph.d.ts +1 -1
  251. package/dist/graph.js +3 -3
  252. package/dist/harmonic-retrieval.js +1 -1
  253. package/dist/importance.d.ts +1 -1
  254. package/dist/importers/index.d.ts +1 -1
  255. package/dist/in-flight-reads.d.ts +1 -1
  256. package/dist/{index--QhGIXF2.d.ts → index-By2QUAMh.d.ts} +2 -2
  257. package/dist/index.d.ts +26 -23
  258. package/dist/index.js +184 -142
  259. package/dist/intent.d.ts +1 -1
  260. package/dist/lcm/engine.d.ts +1 -1
  261. package/dist/lcm/engine.js +4 -4
  262. package/dist/lcm/index.d.ts +1 -1
  263. package/dist/lcm/index.js +13 -13
  264. package/dist/lcm/tools.d.ts +1 -1
  265. package/dist/lifecycle.d.ts +1 -1
  266. package/dist/live-connectors-runner.d.ts +1 -1
  267. package/dist/local-llm.d.ts +1 -1
  268. package/dist/local-model-endpoint.d.ts +1 -1
  269. package/dist/location/index.d.ts +128 -1
  270. package/dist/location/index.js +60 -750
  271. package/dist/location/index.js.map +1 -1
  272. package/dist/maintenance/memory-governance.d.ts +1 -1
  273. package/dist/maintenance/memory-governance.js +10 -10
  274. package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +2 -2
  275. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +10 -10
  276. package/dist/maintenance/rebuild-memory-projection.d.ts +2 -2
  277. package/dist/maintenance/rebuild-memory-projection.js +11 -11
  278. package/dist/{maintenance-PFvY1Pw_.d.ts → maintenance-Dm2McrIx.d.ts} +4 -3
  279. package/dist/mcp-memory-inspector-app.d.ts +11 -11
  280. package/dist/mcp-read-only-tools.js +1 -1
  281. package/dist/memory-action-policy.d.ts +1 -1
  282. package/dist/memory-cache.d.ts +1 -1
  283. package/dist/memory-controller.d.ts +1 -1
  284. package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
  285. package/dist/memory-projection-store.d.ts +1 -1
  286. package/dist/memory-provenance.d.ts +1 -1
  287. package/dist/memory-snapshot.d.ts +1 -1
  288. package/dist/memory-subject-cli.d.ts +11 -11
  289. package/dist/memory-subject.d.ts +11 -11
  290. package/dist/memory-worth-outcomes.d.ts +47 -3
  291. package/dist/memory-worth-outcomes.js +5 -3
  292. package/dist/models-json.d.ts +1 -1
  293. package/dist/namespaces/migrate.d.ts +3 -3
  294. package/dist/namespaces/migrate.js +11 -11
  295. package/dist/namespaces/principal.d.ts +1 -1
  296. package/dist/namespaces/search.d.ts +1 -1
  297. package/dist/namespaces/search.js +7 -7
  298. package/dist/namespaces/storage.d.ts +3 -3
  299. package/dist/namespaces/storage.js +10 -10
  300. package/dist/native-knowledge.d.ts +1 -1
  301. package/dist/offline-sync-impression-drain.d.ts +1 -1
  302. package/dist/operator-doctor-corpus.d.ts +1 -1
  303. package/dist/operator-doctor-corpus.js +13 -13
  304. package/dist/operator-doctor-replica.d.ts +1 -1
  305. package/dist/operator-toolkit.d.ts +3 -3
  306. package/dist/operator-toolkit.js +24 -24
  307. package/dist/orchestration/compression-guideline-coordinator.d.ts +2 -2
  308. package/dist/orchestration/maintenance.d.ts +4 -4
  309. package/dist/orchestration/maintenance.js +18 -16
  310. package/dist/{orchestrator-4wzJrPVm.d.ts → orchestrator-Co1DyfuP.d.ts} +8 -8
  311. package/dist/orchestrator.d.ts +9 -9
  312. package/dist/orchestrator.js +111 -106
  313. package/dist/patterns-cli.d.ts +1 -1
  314. package/dist/{pipeline-CgXgdIrF.d.ts → pipeline-DotMnb6y.d.ts} +1 -1
  315. package/dist/policy-runtime.d.ts +1 -1
  316. package/dist/proactive-contention.d.ts +1 -1
  317. package/dist/provenance.d.ts +1 -1
  318. package/dist/{public-http-BP3VQDl5.d.ts → public-http-PJRtnSi-.d.ts} +1 -1
  319. package/dist/{qmd-BppGGxsi.d.ts → qmd-BP0n11fR.d.ts} +1 -1
  320. package/dist/qmd-preflight.d.ts +2 -2
  321. package/dist/qmd-recall-cache.d.ts +1 -1
  322. package/dist/qmd.d.ts +2 -2
  323. package/dist/recall-concurrency-config.d.ts +1 -1
  324. package/dist/recall-disclosure-escalation.d.ts +1 -1
  325. package/dist/recall-explain-renderer.d.ts +1 -1
  326. package/dist/recall-memory-map.d.ts +1 -1
  327. package/dist/recall-planner-llm.d.ts +1 -1
  328. package/dist/recall-state.d.ts +1 -1
  329. package/dist/recall-tag-filter.d.ts +1 -1
  330. package/dist/recall-timings.d.ts +1 -1
  331. package/dist/recall-xray-cli.d.ts +1 -1
  332. package/dist/recall-xray-renderer.d.ts +1 -1
  333. package/dist/recall-xray.d.ts +1 -1
  334. package/dist/reconcile/cursor.d.ts +1 -1
  335. package/dist/reconcile/manifest.d.ts +1 -1
  336. package/dist/reconcile/plan.d.ts +1 -1
  337. package/dist/replay/normalizers/chatgpt.d.ts +1 -1
  338. package/dist/replay/normalizers/claude.d.ts +1 -1
  339. package/dist/replay/normalizers/openclaw.d.ts +1 -1
  340. package/dist/replay/normalizers/shared.d.ts +1 -1
  341. package/dist/replay/runner.d.ts +1 -1
  342. package/dist/replay/types.d.ts +1 -1
  343. package/dist/replica-divergence.d.ts +1 -1
  344. package/dist/replica-peers-config.d.ts +1 -1
  345. package/dist/resolve-auth-token.d.ts +1 -1
  346. package/dist/resume-bundles.js +5 -5
  347. package/dist/retrieval-agents.d.ts +2 -2
  348. package/dist/retrieval-tiers.d.ts +1 -1
  349. package/dist/routing/engine.d.ts +1 -1
  350. package/dist/routing/store.d.ts +1 -1
  351. package/dist/salvage-envelope.d.ts +1 -1
  352. package/dist/{scope-profiles-ChZUtxDU.d.ts → scope-profiles-6ChZKTy-.d.ts} +1 -1
  353. package/dist/search/embed-helper.d.ts +1 -1
  354. package/dist/search/factory.d.ts +1 -1
  355. package/dist/search/factory.js +6 -6
  356. package/dist/search/index.d.ts +1 -1
  357. package/dist/search/index.js +10 -10
  358. package/dist/search/lancedb-backend.d.ts +1 -1
  359. package/dist/search/lancedb-backend.js +2 -2
  360. package/dist/search/meilisearch-backend.d.ts +1 -1
  361. package/dist/search/meilisearch-backend.js +2 -2
  362. package/dist/search/noop-backend.d.ts +1 -1
  363. package/dist/search/orama-backend.d.ts +1 -1
  364. package/dist/search/orama-backend.js +2 -2
  365. package/dist/search/port.d.ts +1 -1
  366. package/dist/search/remote-backend.d.ts +1 -1
  367. package/dist/{semantic-consolidation-mSPwQSmF.d.ts → semantic-consolidation-DziYcW5J.d.ts} +1 -1
  368. package/dist/semantic-consolidation.d.ts +2 -2
  369. package/dist/semantic-consolidation.js +11 -11
  370. package/dist/semantic-rule-promotion.js +10 -10
  371. package/dist/semantic-rule-verifier.d.ts +1 -1
  372. package/dist/semantic-rule-verifier.js +10 -10
  373. package/dist/{service-BICWLwSP.d.ts → service-C7rIBuK_.d.ts} +2 -2
  374. package/dist/session-observer-bands.d.ts +1 -1
  375. package/dist/session-observer-state.d.ts +1 -1
  376. package/dist/shared-context/manager.d.ts +1 -1
  377. package/dist/signal.d.ts +1 -1
  378. package/dist/source-agent-qualifier.d.ts +1 -1
  379. package/dist/source-agent-qualifier.js +10 -10
  380. package/dist/{storage-B7urx1K3.d.ts → storage-B1hEx8Xg.d.ts} +1 -1
  381. package/dist/storage.d.ts +2 -2
  382. package/dist/storage.js +9 -9
  383. package/dist/subject-config.d.ts +1 -1
  384. package/dist/summarizer.d.ts +1 -1
  385. package/dist/summary-snapshot.d.ts +1 -1
  386. package/dist/support-passport/index.d.ts +14 -14
  387. package/dist/support-passport/index.js +34 -34
  388. package/dist/temporal-supersession.d.ts +2 -2
  389. package/dist/temporal-timeline-recall.d.ts +1 -1
  390. package/dist/temporal-validity.d.ts +1 -1
  391. package/dist/threading.d.ts +1 -1
  392. package/dist/tier-migration.d.ts +2 -2
  393. package/dist/tier-routing.d.ts +1 -1
  394. package/dist/topics.d.ts +1 -1
  395. package/dist/transcript.d.ts +1 -1
  396. package/dist/transfer/backup.js +2 -2
  397. package/dist/transfer/capsule-export.js +2 -2
  398. package/dist/transfer/capsule-import.js +2 -2
  399. package/dist/trust-score-stage.d.ts +1 -1
  400. package/dist/trust-score.d.ts +1 -1
  401. package/dist/{types-ETU5N6nB.d.ts → types-BHDNxGTT.d.ts} +1 -1
  402. package/dist/types.d.ts +1 -1
  403. package/dist/utility-runtime.d.ts +1 -1
  404. package/dist/verified-recall.js +10 -10
  405. package/dist/who-knows-cli.d.ts +11 -11
  406. package/dist/who-knows-cli.js +11 -11
  407. package/dist/who-knows.d.ts +11 -11
  408. package/dist/who-knows.js +10 -10
  409. package/dist/write-envelope.d.ts +1 -1
  410. package/package.json +2 -2
  411. package/src/access-boundary.ts +5 -0
  412. package/src/access-http.ts +15 -16
  413. package/src/access-mcp-output-schemas.ts +5 -0
  414. package/src/access-mcp.ts +6 -6
  415. package/src/access-operations.ts +2 -0
  416. package/src/access-surface-catalog.ts +10 -0
  417. package/src/eval-trajectory-contracts.ts +411 -0
  418. package/src/eval-trajectory-store.ts +306 -0
  419. package/src/eval-trajectory.test.ts +534 -0
  420. package/src/eval-trajectory.ts +773 -0
  421. package/src/index.ts +2 -0
  422. package/src/location/access-operations.ts +84 -0
  423. package/src/location/http-glue.test.ts +100 -0
  424. package/src/location/http-glue.ts +85 -0
  425. package/src/location/index.ts +3 -0
  426. package/src/location/mcp-tools.ts +82 -0
  427. package/src/location/provider-setup.test.ts +106 -0
  428. package/src/location/provider-setup.ts +103 -0
  429. package/src/location/scheduler.test.ts +113 -0
  430. package/src/location/scheduler.ts +98 -0
  431. package/src/location/surfaces.test.ts +241 -0
  432. package/src/location/surfaces.ts +329 -0
  433. package/src/maintenance/day-summary-cron.ts +45 -0
  434. package/src/mcp-read-only-tools.ts +2 -0
  435. package/src/memory-worth-outcomes.test.ts +53 -18
  436. package/src/memory-worth-outcomes.ts +91 -9
  437. package/src/orchestration/maintenance.ts +22 -30
  438. package/src/wearables/http-glue.ts +28 -0
  439. package/dist/chunk-4K7IW3F7.js.map +0 -1
  440. package/dist/chunk-5W7MKXMU.js.map +0 -1
  441. package/dist/chunk-FC7TIRFS.js.map +0 -1
  442. package/dist/chunk-LDBFXD4F.js.map +0 -1
  443. package/dist/chunk-OMZLBT4B.js.map +0 -1
  444. package/dist/chunk-PNAGNVGK.js.map +0 -1
  445. package/dist/chunk-RQ2EQRRR.js.map +0 -1
  446. package/dist/chunk-YUTTMSC7.js.map +0 -1
  447. /package/dist/{capsule-crypto-GWVG7LGC.js.map → capsule-crypto-7FJQINUR.js.map} +0 -0
  448. /package/dist/{chunk-OWHERGF2.js.map → chunk-2NLLXCJG.js.map} +0 -0
  449. /package/dist/{chunk-NZPFCP5A.js.map → chunk-2PSX5BJU.js.map} +0 -0
  450. /package/dist/{chunk-W6J4POB6.js.map → chunk-3RI5Y7KU.js.map} +0 -0
  451. /package/dist/{chunk-H7BZBSP6.js.map → chunk-52II7PB6.js.map} +0 -0
  452. /package/dist/{chunk-IF4EY26E.js.map → chunk-5DH6PG4B.js.map} +0 -0
  453. /package/dist/{chunk-M4AHBM72.js.map → chunk-5HERQ5FX.js.map} +0 -0
  454. /package/dist/{chunk-IRXMJLTW.js.map → chunk-5HK3CJAR.js.map} +0 -0
  455. /package/dist/{chunk-XAWIL7TC.js.map → chunk-5S4LQOPE.js.map} +0 -0
  456. /package/dist/{chunk-IDQ6DKXC.js.map → chunk-5VPQSRQO.js.map} +0 -0
  457. /package/dist/{chunk-ROEAEANL.js.map → chunk-6CPUQ5D6.js.map} +0 -0
  458. /package/dist/{chunk-SR7JIRAR.js.map → chunk-7F27PCSN.js.map} +0 -0
  459. /package/dist/{chunk-7OZSHBWK.js.map → chunk-7TCGNUVP.js.map} +0 -0
  460. /package/dist/{chunk-KBOG7FJV.js.map → chunk-7WR462EM.js.map} +0 -0
  461. /package/dist/{chunk-AYAZWXJI.js.map → chunk-A32YEQAM.js.map} +0 -0
  462. /package/dist/{chunk-5GIZM4RX.js.map → chunk-ACOC27BB.js.map} +0 -0
  463. /package/dist/{chunk-6LS5OX3U.js.map → chunk-BJTHRFFC.js.map} +0 -0
  464. /package/dist/{chunk-PGW64IFQ.js.map → chunk-CFGU52XJ.js.map} +0 -0
  465. /package/dist/{chunk-DPNXADEI.js.map → chunk-D4QVPP3G.js.map} +0 -0
  466. /package/dist/{chunk-2RXUZVPU.js.map → chunk-EOHKUWXW.js.map} +0 -0
  467. /package/dist/{chunk-YNDLCWXS.js.map → chunk-EZ25VE3G.js.map} +0 -0
  468. /package/dist/{chunk-ZK4BFABK.js.map → chunk-F635GAL7.js.map} +0 -0
  469. /package/dist/{chunk-HWVNYNIV.js.map → chunk-F6QHHRWP.js.map} +0 -0
  470. /package/dist/{chunk-O4BAGJDN.js.map → chunk-GEPACVWN.js.map} +0 -0
  471. /package/dist/{chunk-XZBXINXZ.js.map → chunk-GIC6BASP.js.map} +0 -0
  472. /package/dist/{chunk-PP7R754B.js.map → chunk-GPFZFCRN.js.map} +0 -0
  473. /package/dist/{chunk-LSYD7GHZ.js.map → chunk-GTSVEEP3.js.map} +0 -0
  474. /package/dist/{chunk-YWBOOBDP.js.map → chunk-I7EX6KSH.js.map} +0 -0
  475. /package/dist/{chunk-3I22VWB3.js.map → chunk-IP4ZNT4U.js.map} +0 -0
  476. /package/dist/{chunk-AXGFOFNY.js.map → chunk-IY7UXD3J.js.map} +0 -0
  477. /package/dist/{chunk-6FUMA6AA.js.map → chunk-JAQXUGLN.js.map} +0 -0
  478. /package/dist/{chunk-RKNJBZ55.js.map → chunk-JBPKEARU.js.map} +0 -0
  479. /package/dist/{chunk-5W7CTZ2E.js.map → chunk-KQAFEZQX.js.map} +0 -0
  480. /package/dist/{chunk-D2YNNDML.js.map → chunk-KWIGDKM2.js.map} +0 -0
  481. /package/dist/{chunk-2JHRCWHT.js.map → chunk-LLQCM2U2.js.map} +0 -0
  482. /package/dist/{chunk-OLBZ2WGG.js.map → chunk-LTBKKSCX.js.map} +0 -0
  483. /package/dist/{chunk-RACZB5HT.js.map → chunk-N37X5RU7.js.map} +0 -0
  484. /package/dist/{chunk-FEO2CDXR.js.map → chunk-NG3MBQV4.js.map} +0 -0
  485. /package/dist/{chunk-AG46P24C.js.map → chunk-NNBZS3DY.js.map} +0 -0
  486. /package/dist/{chunk-JGG5HVI2.js.map → chunk-OPGL46PX.js.map} +0 -0
  487. /package/dist/{chunk-OUKBMQ2O.js.map → chunk-PD66CVSD.js.map} +0 -0
  488. /package/dist/{chunk-7SSRXEZJ.js.map → chunk-PDDSFELN.js.map} +0 -0
  489. /package/dist/{chunk-MVIYRRVJ.js.map → chunk-PMVPCZJZ.js.map} +0 -0
  490. /package/dist/{chunk-D35XLYQ7.js.map → chunk-RGCF4XNH.js.map} +0 -0
  491. /package/dist/{chunk-X2DWBWOX.js.map → chunk-S3K2CIK5.js.map} +0 -0
  492. /package/dist/{chunk-TWBQQ3FT.js.map → chunk-SEA6M7SS.js.map} +0 -0
  493. /package/dist/{chunk-DYO24BNB.js.map → chunk-SVVIASVX.js.map} +0 -0
  494. /package/dist/{chunk-7K5Q6COX.js.map → chunk-TVVEYCNW.js.map} +0 -0
  495. /package/dist/{chunk-NLUCDKLT.js.map → chunk-VKCAHCBI.js.map} +0 -0
  496. /package/dist/{chunk-BXXOPKT5.js.map → chunk-VXVZ2GM3.js.map} +0 -0
  497. /package/dist/{chunk-JFWZRUKP.js.map → chunk-WTOZBZNN.js.map} +0 -0
  498. /package/dist/{chunk-UVYI6VIX.js.map → chunk-X7Y7WX73.js.map} +0 -0
  499. /package/dist/{chunk-5TG4MU2U.js.map → chunk-YKWFK7XA.js.map} +0 -0
  500. /package/dist/{chunk-BIJAWZYW.js.map → chunk-YMOPYG3K.js.map} +0 -0
  501. /package/dist/{chunk-XUZ5CIEE.js.map → chunk-YRVAKONL.js.map} +0 -0
  502. /package/dist/{chunk-53MZQEBD.js.map → chunk-YWSQD2IB.js.map} +0 -0
  503. /package/dist/{chunk-US4IRASK.js.map → chunk-Z4U3UN56.js.map} +0 -0
  504. /package/dist/{chunk-QMZY3GG6.js.map → chunk-ZAOHJDKH.js.map} +0 -0
  505. /package/dist/{chunk-ZXUZ54Z5.js.map → chunk-ZIJDI4CP.js.map} +0 -0
  506. /package/dist/{graph-edge-decay-FXGELBFA.js.map → eval-trajectory-contracts.js.map} +0 -0
package/src/index.ts CHANGED
@@ -1461,5 +1461,7 @@ export type {
1461
1461
  export type { ResolvedScopeProfilePlan } from "./namespaces/scope-profiles.js";
1462
1462
  export * from "./maintenance/atomic-file.js";
1463
1463
 
1464
+ // Privacy-safe action-to-outcome trajectory eval (issue #2345)
1465
+ export * from "./eval-trajectory.js";
1464
1466
  export { MemoryControllerCoordinator, chooseAction, computeEvidenceReportHash, controllerConfigHash, evaluateActiveGates, hashControllerState, verifyEvidenceReport } from "./memory-controller.js";
1465
1467
  export type { ActiveContextAdapter, ActiveContextMessage, ActiveContextPlan, MemoryControllerActionFamily, MemoryControllerChoice, MemoryControllerConfig, MemoryControllerDeps, MemoryControllerEvent, MemoryControllerEvidence, MemoryControllerEvidenceReport, MemoryControllerExecutors, MemoryControllerMode, MemoryControllerPairedSeedEvidence, MemoryControllerReceipt, MemoryControllerRecorder, MemoryControllerReportReader, MemoryControllerRunResult, MemoryControllerState } from "./memory-controller.js";
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Location boundary operations (issue #2047) — the five `location_*`
3
+ * operations registered through the access boundary so MCP, HTTP, and any
4
+ * batch transport share one validated dispatch. Handlers are thin: they run
5
+ * the same `location/surfaces.ts` runners the CLI uses. Fleet-wide: location
6
+ * config and day files are machine-level (no namespace scoping).
7
+ */
8
+
9
+ import { z } from "zod";
10
+ import { defineOperation } from "../access-boundary.js";
11
+ import type { EngramAccessService } from "../access-service.js";
12
+ import {
13
+ parseLocationBackfillRange,
14
+ runLocationCheck,
15
+ runLocationDay,
16
+ runLocationStatus,
17
+ runLocationSync,
18
+ type LocationSurfaceDeps,
19
+ } from "./surfaces.js";
20
+
21
+ /** Zod shape shared by the location operations (null-for-absent tolerant). */
22
+ const dateField = z.union([z.string(), z.null()]).optional();
23
+ const daysField = z.union([z.number(), z.string(), z.null()]).optional();
24
+
25
+ function locationDeps(service: EngramAccessService): LocationSurfaceDeps {
26
+ return { config: service.configRef.location, memoryDir: service.memoryDir };
27
+ }
28
+
29
+ defineOperation({
30
+ name: "location_status",
31
+ description: "Location sync status (gates, providers, last sync, day counts).",
32
+ fleetWide: true,
33
+ schema: z.object({}).passthrough(),
34
+ handler: async (_input, ctx) => ({
35
+ result: await runLocationStatus(locationDeps(ctx.service)),
36
+ }),
37
+ });
38
+
39
+ defineOperation({
40
+ name: "location_check",
41
+ description: "Probe every enabled location provider.",
42
+ fleetWide: true,
43
+ schema: z.object({}).passthrough(),
44
+ handler: async (_input, ctx) => ({
45
+ result: await runLocationCheck(locationDeps(ctx.service)),
46
+ }),
47
+ });
48
+
49
+ defineOperation({
50
+ name: "location_sync",
51
+ description: "Sync location days (default window: syncDays ending yesterday).",
52
+ fleetWide: true,
53
+ schema: z.object({ date: dateField, days: daysField }).passthrough(),
54
+ handler: async (input, ctx) => ({
55
+ result: {
56
+ days: await runLocationSync(locationDeps(ctx.service), {
57
+ ...(input.date !== undefined && input.date !== null && input.date !== "" ? { endDate: input.date } : {}),
58
+ ...(input.days !== undefined && input.days !== null && input.days !== "" ? { days: Number(input.days) } : {}),
59
+ }),
60
+ },
61
+ }),
62
+ });
63
+
64
+ defineOperation({
65
+ name: "location_backfill",
66
+ description: "Sync an explicit historical day range (≤ 90 days).",
67
+ fleetWide: true,
68
+ schema: z.object({ from: dateField, to: dateField }).passthrough(),
69
+ handler: async (input, ctx) => {
70
+ const range = parseLocationBackfillRange(input.from, input.to);
71
+ return { result: { days: await runLocationSync(locationDeps(ctx.service), range) } };
72
+ },
73
+ });
74
+
75
+ defineOperation({
76
+ name: "location_day",
77
+ description: "Read one stored location day.",
78
+ fleetWide: true,
79
+ schema: z.object({ date: dateField }).passthrough(),
80
+ handler: async (input, ctx) => ({
81
+ result: await runLocationDay(locationDeps(ctx.service).memoryDir, input.date),
82
+ }),
83
+ });
84
+
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Location HTTP glue regression (issue #2047): the /engram/v1/location/...
3
+ * responders dispatch through the same boundary operations the MCP tools
4
+ * use — identical validation messages, 404 for unstored days, 200 otherwise.
5
+ */
6
+
7
+ import assert from "node:assert/strict";
8
+ import { mkdtemp, rm } from "node:fs/promises";
9
+ import { tmpdir } from "node:os";
10
+ import path from "node:path";
11
+ import test from "node:test";
12
+ import type { ServerResponse } from "node:http";
13
+
14
+ // Import the operations module so getOperation() has the location_* set.
15
+ import "../access-operations.js";
16
+ import { EngramAccessInputError } from "../access-errors.js";
17
+ import type { EngramAccessService } from "../access-service.js";
18
+ import { parseLocationConfig } from "./config.js";
19
+ import {
20
+ respondLocationBackfill,
21
+ respondLocationCheck,
22
+ respondLocationDay,
23
+ respondLocationStatus,
24
+ respondLocationSync,
25
+ } from "./http-glue.js";
26
+
27
+ const DUMMY_RES = {} as ServerResponse;
28
+
29
+ function makeService(memoryDir: string): EngramAccessService {
30
+ const config = {
31
+ location: parseLocationConfig({ enabled: true, timezone: "UTC", sources: [{ id: "reitti" }] }),
32
+ };
33
+ return { configRef: config, memoryDir } as unknown as EngramAccessService;
34
+ }
35
+
36
+ test("status and check respond 200 with the shared runner's disabled/empty semantics", async () => {
37
+ const memoryDir = await mkdtemp(path.join(tmpdir(), "remnic-location-http-"));
38
+ try {
39
+ const box: { s?: number; b?: unknown } = {};
40
+ const respondJson = (_res: ServerResponse, status: number, payload: unknown) => {
41
+ box.s = status;
42
+ box.b = payload;
43
+ };
44
+ const service = makeService(memoryDir);
45
+ await respondLocationStatus(DUMMY_RES, respondJson, service);
46
+ assert.equal(box.s, 200);
47
+ const report = box.b as { enabled: boolean; sources: Array<{ providerRegistered: boolean }> };
48
+ assert.equal(report.enabled, true);
49
+ assert.equal(report.sources[0]?.providerRegistered, false, "absent provider is a skip state");
50
+
51
+ await respondLocationCheck(DUMMY_RES, respondJson, service);
52
+ assert.equal(box.s, 200);
53
+ const check = box.b as { results: Array<{ id: string; ok: boolean; skipped?: string }> };
54
+ assert.deepEqual(check.results, [{ id: "reitti", ok: false, skipped: "provider-not-registered" }]);
55
+ } finally {
56
+ await rm(memoryDir, { recursive: true, force: true });
57
+ }
58
+ });
59
+
60
+ test("invalid sync/backfill/day inputs reject with the SAME messages as the CLI runner", async () => {
61
+ const memoryDir = await mkdtemp(path.join(tmpdir(), "remnic-location-http-invalid-"));
62
+ const service = makeService(memoryDir);
63
+ const respondJson = () => {};
64
+ try {
65
+ await assert.rejects(
66
+ () => respondLocationSync({ date: "2026-13-99" }, DUMMY_RES, respondJson, service),
67
+ (err: unknown) => err instanceof EngramAccessInputError && /date is required \(YYYY-MM-DD\)/.test(err.message),
68
+ );
69
+ await assert.rejects(
70
+ () => respondLocationSync({ days: 0 }, DUMMY_RES, respondJson, service),
71
+ (err: unknown) => err instanceof EngramAccessInputError && /days expects an integer from 1 to 90/.test(err.message),
72
+ );
73
+ await assert.rejects(
74
+ () => respondLocationBackfill({ from: "2026-08-10", to: "2026-08-01" }, DUMMY_RES, respondJson, service),
75
+ (err: unknown) => err instanceof EngramAccessInputError && /--from must not be after --to/.test(err.message),
76
+ );
77
+ await assert.rejects(
78
+ () => respondLocationDay(null, DUMMY_RES, respondJson, service),
79
+ (err: unknown) => err instanceof EngramAccessInputError && /date is required \(YYYY-MM-DD\)/.test(err.message),
80
+ );
81
+ } finally {
82
+ await rm(memoryDir, { recursive: true, force: true });
83
+ }
84
+ });
85
+
86
+ test("day responds 404 for an unstored day", async () => {
87
+ const memoryDir = await mkdtemp(path.join(tmpdir(), "remnic-location-http-day-"));
88
+ try {
89
+ const box: { s?: number; b?: unknown } = {};
90
+ const respondJson = (_res: ServerResponse, status: number, payload: unknown) => {
91
+ box.s = status;
92
+ box.b = payload;
93
+ };
94
+ await respondLocationDay("2026-08-16", DUMMY_RES, respondJson, makeService(memoryDir));
95
+ assert.equal(box.s, 404);
96
+ assert.equal((box.b as { found: boolean }).found, false, "unstored day is an explicit not-found");
97
+ } finally {
98
+ await rm(memoryDir, { recursive: true, force: true });
99
+ }
100
+ });
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Location HTTP route glue (issue #2047) — the `/engram/v1/location/...` (and
3
+ * `/remnic/v1/...` alias) route bodies, extracted so access-http.ts (size-
4
+ * grandfathered) keeps only thin route branches (same pattern as
5
+ * meetings/http-glue.ts). Every responder dispatches through the access
6
+ * boundary operation — the identical validated path the MCP tools use — so
7
+ * HTTP and MCP can never diverge on validation or error mapping.
8
+ * EngramAccessInputError bubbles to the global 400 handler; backend faults
9
+ * keep flowing to the global 500 handler.
10
+ */
11
+
12
+ import type { ServerResponse } from "node:http";
13
+ import { getOperation, type OperationName } from "../access-boundary.js";
14
+ import type { EngramAccessService } from "../access-service.js";
15
+
16
+ type RespondJson = (res: ServerResponse, status: number, payload: unknown) => void;
17
+
18
+ function requireLocationOperation(name: OperationName) {
19
+ const op = getOperation(name);
20
+ if (!op) {
21
+ throw new Error(`access-boundary: operation not registered: ${name}`);
22
+ }
23
+ return op;
24
+ }
25
+
26
+ export async function respondLocationStatus(
27
+ res: ServerResponse,
28
+ respondJson: RespondJson,
29
+ service: EngramAccessService,
30
+ ): Promise<void> {
31
+ const output = (await requireLocationOperation("location_status").run({}, { service })) as {
32
+ result: unknown;
33
+ };
34
+ respondJson(res, 200, output.result);
35
+ }
36
+
37
+ export async function respondLocationCheck(
38
+ res: ServerResponse,
39
+ respondJson: RespondJson,
40
+ service: EngramAccessService,
41
+ ): Promise<void> {
42
+ const output = (await requireLocationOperation("location_check").run({}, { service })) as {
43
+ result: unknown;
44
+ };
45
+ respondJson(res, 200, { results: output.result });
46
+ }
47
+
48
+ export async function respondLocationSync(
49
+ body: Record<string, unknown>,
50
+ res: ServerResponse,
51
+ respondJson: RespondJson,
52
+ service: EngramAccessService,
53
+ ): Promise<void> {
54
+ const output = (await requireLocationOperation("location_sync").run(
55
+ { date: body.date ?? null, days: body.days ?? null },
56
+ { service },
57
+ )) as { result: unknown };
58
+ respondJson(res, 200, output.result);
59
+ }
60
+
61
+ export async function respondLocationBackfill(
62
+ body: Record<string, unknown>,
63
+ res: ServerResponse,
64
+ respondJson: RespondJson,
65
+ service: EngramAccessService,
66
+ ): Promise<void> {
67
+ const output = (await requireLocationOperation("location_backfill").run(
68
+ { from: body.from ?? null, to: body.to ?? null },
69
+ { service },
70
+ )) as { result: unknown };
71
+ respondJson(res, 200, output.result);
72
+ }
73
+
74
+ export async function respondLocationDay(
75
+ date: string | null,
76
+ res: ServerResponse,
77
+ respondJson: RespondJson,
78
+ service: EngramAccessService,
79
+ ): Promise<void> {
80
+ const output = (await requireLocationOperation("location_day").run(
81
+ { date: date ?? null },
82
+ { service },
83
+ )) as { result: { found: boolean } & Record<string, unknown> };
84
+ respondJson(res, output.result.found ? 200 : 404, output.result);
85
+ }
@@ -13,4 +13,7 @@ export * from "./config.js";
13
13
  export * from "./intervals.js";
14
14
  export * from "./store.js";
15
15
  export * from "./pipeline.js";
16
+ export * from "./surfaces.js";
17
+ export * from "./provider-setup.js";
18
+ export * from "./scheduler.js";
16
19
  export * from "./cli.js";
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Location MCP tool definitions (issue #2047) — the five
3
+ * `engram.location_*` tool-def objects, extracted from access-mcp.ts so the
4
+ * surface file stays at its structural ceiling (same pattern as
5
+ * wearables/mcp-tools.ts). Spread back into `this.tools`
6
+ * (`...LOCATION_MCP_TOOLS`); MCP_MIGRATED_OPERATIONS + boundary dispatch
7
+ * stay inline in access-mcp.ts. Location is fleet-wide: no namespace arg
8
+ * (day files live under the memory root, outside every namespace).
9
+ */
10
+
11
+ import type { McpTool } from "../access-mcp.js";
12
+
13
+ export const LOCATION_MCP_TOOLS: McpTool[] = [
14
+ {
15
+ name: "engram.location_status",
16
+ description:
17
+ "Location sync status: master gate, timezone, per-source provider registration, last sync, and recent stored day counts. Never returns secrets, addresses, coordinates, or place labels.",
18
+ inputSchema: {
19
+ type: "object",
20
+ properties: {},
21
+ additionalProperties: false,
22
+ },
23
+ },
24
+ {
25
+ name: "engram.location_check",
26
+ description:
27
+ "Probe every enabled location provider (auth/connectivity). Reports ok/detail per source; a disabled master gate or source reports a skip reason, never an error.",
28
+ inputSchema: {
29
+ type: "object",
30
+ properties: {},
31
+ additionalProperties: false,
32
+ },
33
+ },
34
+ {
35
+ name: "engram.location_sync",
36
+ description:
37
+ "Sync local-day place observations from every enabled location provider (default: location.syncDays ending yesterday). Same shared runner as the CLI and HTTP surfaces; a forced sync never bypasses the enabled gates or validation. Returns per-day, per-source synced/skipped/failed results.",
38
+ inputSchema: {
39
+ type: "object",
40
+ properties: {
41
+ date: {
42
+ type: "string",
43
+ description: "Optional exclusive-window end day (YYYY-MM-DD, inclusive); defaults to yesterday in location.timezone.",
44
+ },
45
+ days: {
46
+ type: "integer",
47
+ minimum: 1,
48
+ maximum: 90,
49
+ description: "Optional window size (1..90); defaults to location.syncDays.",
50
+ },
51
+ },
52
+ additionalProperties: false,
53
+ },
54
+ },
55
+ {
56
+ name: "engram.location_backfill",
57
+ description:
58
+ "Sync an explicit historical day range (inclusive, capped at 90 days) for every enabled location provider. Same shared sync runner as location_sync; never makes an unbounded scan.",
59
+ inputSchema: {
60
+ type: "object",
61
+ properties: {
62
+ from: { type: "string", description: "Range start day (YYYY-MM-DD)." },
63
+ to: { type: "string", description: "Range end day (YYYY-MM-DD, inclusive)." },
64
+ },
65
+ required: ["from", "to"],
66
+ additionalProperties: false,
67
+ },
68
+ },
69
+ {
70
+ name: "engram.location_day",
71
+ description:
72
+ "Return one stored location day (place segments per source). Coordinates appear only when location.retainCoordinates is enabled; an unstored day returns found:false.",
73
+ inputSchema: {
74
+ type: "object",
75
+ properties: {
76
+ date: { type: "string", description: "Day to read (YYYY-MM-DD)." },
77
+ },
78
+ required: ["date"],
79
+ additionalProperties: false,
80
+ },
81
+ },
82
+ ];
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Provider setup regression (issue #2047): env-credential bootstrapping of
3
+ * optional provider packages — absent credentials or package are skips
4
+ * (never errors), tokens never reach logs, and registration is idempotent.
5
+ */
6
+
7
+ import assert from "node:assert/strict";
8
+ import test from "node:test";
9
+
10
+ import { parseLocationConfig } from "./config.js";
11
+ import { clearLocationProviders, getLocationProvider, registerLocationProvider } from "./registry.js";
12
+ import { ensureConfiguredLocationProviders, type LocationProviderEnv } from "./provider-setup.js";
13
+ import type { LocationProvider } from "./types.js";
14
+
15
+ const ENV: LocationProviderEnv = {
16
+ baseUrl: "https://reitti.example.invalid",
17
+ token: "secret-token",
18
+ authMode: "x-api-token",
19
+ };
20
+
21
+ function importModuleDouble(options: { registered: boolean; failWith?: Error }) {
22
+ const calls: Array<Record<string, unknown>> = [];
23
+ return {
24
+ calls,
25
+ importModule: async () => {
26
+ if (options.failWith) throw options.failWith;
27
+ return {
28
+ ensureReittiProviderRegistered: (opts: Record<string, unknown>) => {
29
+ calls.push(opts);
30
+ if (options.registered) {
31
+ registerLocationProvider({
32
+ id: "reitti",
33
+ displayName: "Reitti",
34
+ verify: async () => ({ ok: true }),
35
+ fetchObservations: async () => ({ observations: [], nextCursor: null }),
36
+ } satisfies LocationProvider);
37
+ return true;
38
+ }
39
+ return false;
40
+ },
41
+ };
42
+ },
43
+ };
44
+ }
45
+
46
+ test.afterEach(() => clearLocationProviders());
47
+
48
+ test("registers reitti from env credentials with timezone threaded through", async () => {
49
+ const config = parseLocationConfig({ enabled: true, timezone: "Europe/Berlin", sources: [{ id: "reitti" }] });
50
+ const loader = importModuleDouble({ registered: true });
51
+ const registered = await ensureConfiguredLocationProviders(config, { env: ENV, importModule: loader.importModule });
52
+ assert.deepEqual(registered, ["reitti"]);
53
+ assert.ok(getLocationProvider("reitti"));
54
+ assert.deepEqual(loader.calls, [
55
+ { baseUrl: ENV.baseUrl, token: ENV.token, timezone: "Europe/Berlin", authMode: "x-api-token" },
56
+ ]);
57
+
58
+ // Idempotent: a second call sees the registry and never re-imports.
59
+ const registeredAgain = await ensureConfiguredLocationProviders(config, { env: ENV, importModule: loader.importModule });
60
+ assert.deepEqual(registeredAgain, []);
61
+ assert.equal(loader.calls.length, 1);
62
+ });
63
+
64
+ test("missing credentials or disabled config stay unregistered — skip, not error", async () => {
65
+ const loader = importModuleDouble({ registered: true });
66
+ const disabled = parseLocationConfig({ enabled: false, sources: [{ id: "reitti" }] });
67
+ assert.deepEqual(await ensureConfiguredLocationProviders(disabled, { env: ENV, importModule: loader.importModule }), []);
68
+ assert.equal(loader.calls.length, 0, "disabled config never loads packages");
69
+
70
+ const missingToken = await ensureConfiguredLocationProviders(
71
+ parseLocationConfig({ enabled: true, sources: [{ id: "reitti" }] }),
72
+ { env: { baseUrl: ENV.baseUrl }, importModule: loader.importModule },
73
+ );
74
+ assert.deepEqual(missingToken, []);
75
+ assert.equal(loader.calls.length, 0, "missing token never loads packages");
76
+ assert.equal(getLocationProvider("reitti"), undefined);
77
+ });
78
+
79
+ test("optional package absent (module-not-found naming the specifier) is silent", async () => {
80
+ const config = parseLocationConfig({ enabled: true, sources: [{ id: "reitti" }] });
81
+ const registered = await ensureConfiguredLocationProviders(config, {
82
+ env: ENV,
83
+ importModule: async () => {
84
+ throw Object.assign(new Error("Cannot find module '@remnic/connector-reitti'"), { code: "ERR_MODULE_NOT_FOUND" });
85
+ },
86
+ });
87
+ assert.deepEqual(registered, []);
88
+ assert.equal(getLocationProvider("reitti"), undefined);
89
+ });
90
+
91
+ test("unknown provider ids and unknown sources are skipped without imports", async () => {
92
+ const loader = importModuleDouble({ registered: true });
93
+ const config = parseLocationConfig({ enabled: true, sources: [{ id: "future-provider" }, { id: "reitti", enabled: false }] });
94
+ assert.deepEqual(await ensureConfiguredLocationProviders(config, { env: ENV, importModule: loader.importModule }), []);
95
+ assert.equal(loader.calls.length, 0, "unknown + disabled sources never load packages");
96
+ });
97
+
98
+ test("invalid authMode falls back to the connector default (single header form)", async () => {
99
+ const loader = importModuleDouble({ registered: true });
100
+ const config = parseLocationConfig({ enabled: true, sources: [{ id: "reitti" }] });
101
+ await ensureConfiguredLocationProviders(config, {
102
+ env: { ...ENV, authMode: "both" },
103
+ importModule: loader.importModule,
104
+ });
105
+ assert.equal("authMode" in (loader.calls[0] ?? {}), false, "invalid mode must not be forwarded");
106
+ });
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Location provider bootstrapping (issue #2047).
3
+ *
4
+ * Core never statically imports a provider package (adapter-isolation test),
5
+ * so every surface calls this before status/check/sync: it registers
6
+ * configured providers from optional packages via computed-specifier dynamic
7
+ * imports, with credentials read from environment variables — tokens never
8
+ * enter config files, errors, or logs. A source whose package or credentials
9
+ * are absent stays unregistered and the pipeline reports
10
+ * `provider-not-registered`; that is a skip reason, never an error (the
11
+ * connector-reitti package's README contract).
12
+ */
13
+
14
+ import { readEnvVar } from "../runtime/env.js";
15
+ import { log } from "../logger.js";
16
+ import { getLocationProvider } from "./registry.js";
17
+ import type { LocationConfig } from "./types.js";
18
+
19
+ /** Environment shape the setup reads for the `reitti` source. */
20
+ export interface LocationProviderEnv {
21
+ baseUrl?: string;
22
+ token?: string;
23
+ authMode?: string;
24
+ }
25
+
26
+ export interface LocationProviderSetupDeps {
27
+ /** Injectable env (tests); defaults to REITTI_* process variables. */
28
+ env?: LocationProviderEnv;
29
+ /** Injectable module loader (tests); defaults to a dynamic import. */
30
+ importModule?: (specifier: string) => Promise<unknown>;
31
+ }
32
+
33
+ interface ReittiProviderModule {
34
+ ensureReittiProviderRegistered(options: {
35
+ baseUrl: string;
36
+ token: string;
37
+ timezone: string;
38
+ authMode?: "x-api-token" | "bearer";
39
+ }): boolean;
40
+ }
41
+
42
+ const loadFailuresWarned = new Set<string>();
43
+
44
+ function readReittiEnv(): LocationProviderEnv {
45
+ return {
46
+ baseUrl: readEnvVar("REITTI_BASE_URL"),
47
+ token: readEnvVar("REITTI_TOKEN"),
48
+ authMode: readEnvVar("REITTI_AUTH_MODE"),
49
+ };
50
+ }
51
+
52
+ /**
53
+ * Register every configured+enabled source's provider when its optional
54
+ * package and credentials are available. Idempotent; returns the ids this
55
+ * call registered. Never throws — a missing package or credential set is
56
+ * reported downstream as `provider-not-registered`.
57
+ */
58
+ export async function ensureConfiguredLocationProviders(
59
+ config: LocationConfig,
60
+ deps: LocationProviderSetupDeps = {},
61
+ ): Promise<string[]> {
62
+ const registered: string[] = [];
63
+ if (!config.enabled) return registered;
64
+ for (const source of config.sources) {
65
+ if (!source.enabled) continue;
66
+ if (getLocationProvider(source.id) !== undefined) continue;
67
+ // ponytail: only the `reitti` built-in exists today; add cases here as
68
+ // provider packages land — a registry table when there is more than one.
69
+ if (source.id !== "reitti") continue;
70
+ const env = deps.env ?? readReittiEnv();
71
+ const baseUrl = env.baseUrl?.trim();
72
+ const token = env.token?.trim();
73
+ if (!baseUrl || !token) continue;
74
+ const authMode =
75
+ env.authMode === "x-api-token" || env.authMode === "bearer" ? env.authMode : undefined;
76
+ const specifier = "@remnic/" + "connector-reitti";
77
+ const load = deps.importModule ?? ((s: string) => import(s));
78
+ try {
79
+ const mod = (await load(specifier)) as ReittiProviderModule;
80
+ if (
81
+ mod.ensureReittiProviderRegistered({
82
+ baseUrl,
83
+ token,
84
+ timezone: config.timezone,
85
+ ...(authMode !== undefined ? { authMode } : {}),
86
+ })
87
+ ) {
88
+ registered.push("reitti");
89
+ }
90
+ } catch (err) {
91
+ // Absent optional package is the common case (skip silently); a real
92
+ // load failure is worth one warn line, never credentials.
93
+ const message = err instanceof Error ? err.message : String(err);
94
+ if (!message.includes(specifier)) {
95
+ if (!loadFailuresWarned.has(specifier)) {
96
+ loadFailuresWarned.add(specifier);
97
+ log.warn(`location: failed to load optional provider package ${specifier}: ${message}`);
98
+ }
99
+ }
100
+ }
101
+ }
102
+ return registered;
103
+ }