@remnic/core 9.65.6 → 9.65.8

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 (623) hide show
  1. package/dist/access-admin-ops-surface.d.ts +15 -13
  2. package/dist/access-admin-ops-surface.js +54 -54
  3. package/dist/access-audit.js +2 -2
  4. package/dist/access-authorization-probe.d.ts +15 -13
  5. package/dist/access-authorization-probe.js +55 -55
  6. package/dist/access-boundary.d.ts +15 -13
  7. package/dist/access-boundary.js +54 -54
  8. package/dist/access-cli.js +156 -148
  9. package/dist/access-cli.js.map +1 -1
  10. package/dist/access-coding-context-resolution.d.ts +2 -1
  11. package/dist/access-extraction-force-flush.d.ts +15 -13
  12. package/dist/access-extraction-force-flush.js +54 -54
  13. package/dist/access-health-types.d.ts +2 -1
  14. package/dist/access-http-lcm-compaction.d.ts +15 -13
  15. package/dist/access-http-lifecycle-flush.d.ts +15 -13
  16. package/dist/access-http-offline-stream.d.ts +15 -13
  17. package/dist/access-http-query.d.ts +3 -2
  18. package/dist/access-http-query.js +56 -56
  19. package/dist/access-http.d.ts +17 -20
  20. package/dist/access-http.js +75 -73
  21. package/dist/access-identity-continuity-surface.d.ts +13 -11
  22. package/dist/access-identity-continuity-surface.js +54 -54
  23. package/dist/access-lcm-surface.d.ts +15 -13
  24. package/dist/access-lcm-surface.js +54 -54
  25. package/dist/access-mcp-output-schemas.js +1 -1
  26. package/dist/access-mcp.d.ts +15 -13
  27. package/dist/access-mcp.js +66 -64
  28. package/dist/access-memory-search-fanout.d.ts +3 -2
  29. package/dist/{access-namespace-preflight-D_6mo8ms.d.ts → access-namespace-preflight-CpAOrS-9.d.ts} +1 -1
  30. package/dist/access-namespace-preflight.d.ts +4 -3
  31. package/dist/access-namespace-preflight.js +54 -54
  32. package/dist/access-observe-write-surface.d.ts +15 -13
  33. package/dist/access-observe-write-surface.js +54 -54
  34. package/dist/access-offline-manifest.d.ts +13 -11
  35. package/dist/access-offline-manifest.js +6 -6
  36. package/dist/access-operations-batch.js +58 -58
  37. package/dist/access-operations.d.ts +21 -19
  38. package/dist/access-operations.js +63 -61
  39. package/dist/access-recall-concurrency.d.ts +15 -13
  40. package/dist/access-recall-concurrency.js +54 -54
  41. package/dist/access-recall-response.d.ts +15 -13
  42. package/dist/access-recall-response.js +54 -54
  43. package/dist/access-recall-surface.d.ts +15 -13
  44. package/dist/access-recall-surface.js +54 -54
  45. package/dist/access-schema.d.ts +83 -83
  46. package/dist/access-schema.js +3 -3
  47. package/dist/{access-service-sbiNS5UB.d.ts → access-service-Diu61Cfv.d.ts} +72 -72
  48. package/dist/access-service-helpers.d.ts +15 -13
  49. package/dist/access-service.d.ts +15 -13
  50. package/dist/access-service.js +54 -54
  51. package/dist/access-surface-catalog.d.ts +15 -13
  52. package/dist/access-surface-catalog.js +66 -56
  53. package/dist/access-surface-catalog.js.map +1 -1
  54. package/dist/access-wearables-meetings-surface.d.ts +6 -3
  55. package/dist/action-confidence.d.ts +2 -1
  56. package/dist/active-context-config.d.ts +27 -0
  57. package/dist/active-context-config.js +14 -0
  58. package/dist/active-context-transform.d.ts +267 -0
  59. package/dist/active-context-transform.js +31 -0
  60. package/dist/active-memory-bridge.d.ts +2 -1
  61. package/dist/active-recall.d.ts +2 -1
  62. package/dist/active-recall.js +13 -12
  63. package/dist/active-recall.js.map +1 -1
  64. package/dist/adapters/index.js +4 -4
  65. package/dist/adapters/registry.js +2 -2
  66. package/dist/ambient-provenance.d.ts +2 -1
  67. package/dist/artifact-search.d.ts +2 -1
  68. package/dist/{auto-sync-XVMLL2RH.js → auto-sync-2YPITIWN.js} +6 -6
  69. package/dist/behavior-learner.d.ts +2 -1
  70. package/dist/behavior-signals.d.ts +2 -1
  71. package/dist/bootstrap.d.ts +13 -11
  72. package/dist/briefing-window.d.ts +5 -2
  73. package/dist/briefing.d.ts +5 -2
  74. package/dist/briefing.js +25 -25
  75. package/dist/buffer-surprise-report.d.ts +2 -1
  76. package/dist/buffer-turn-helpers.d.ts +2 -1
  77. package/dist/buffer.d.ts +5 -2
  78. package/dist/buffer.js +6 -6
  79. package/dist/bulk-import/index.d.ts +4 -3
  80. package/dist/calibration.d.ts +2 -1
  81. package/dist/capabilities.d.ts +2 -1
  82. package/dist/{capsule-crypto-GWVG7LGC.js → capsule-crypto-7FJQINUR.js} +2 -2
  83. package/dist/{catalog-DO_7zfkv.d.ts → catalog-9f-vEQLS.d.ts} +1 -1
  84. package/dist/causal-behavior.d.ts +4 -3
  85. package/dist/causal-behavior.js +2 -2
  86. package/dist/causal-chain.js +2 -2
  87. package/dist/causal-consolidation.d.ts +2 -1
  88. package/dist/causal-consolidation.js +28 -28
  89. package/dist/causal-retrieval.js +2 -2
  90. package/dist/causal-trajectory-graph.d.ts +2 -1
  91. package/dist/causal-trajectory-graph.js +2 -2
  92. package/dist/causal-trajectory.js +1 -1
  93. package/dist/{chunk-OWHERGF2.js → chunk-2NLLXCJG.js} +2 -2
  94. package/dist/{chunk-NZPFCP5A.js → chunk-2PSX5BJU.js} +2 -2
  95. package/dist/{chunk-RKNJBZ55.js → chunk-2QSZNTDO.js} +4 -4
  96. package/dist/{chunk-X2DWBWOX.js → chunk-3A2NJP2U.js} +2 -2
  97. package/dist/chunk-3BCULS4U.js +1093 -0
  98. package/dist/chunk-3BCULS4U.js.map +1 -0
  99. package/dist/{chunk-JGG5HVI2.js → chunk-3PKAS6VL.js} +2 -2
  100. package/dist/{chunk-LSYD7GHZ.js → chunk-3SZD4CYO.js} +3 -3
  101. package/dist/chunk-43HUVDTD.js +114 -0
  102. package/dist/chunk-43HUVDTD.js.map +1 -0
  103. package/dist/{chunk-5TG4MU2U.js → chunk-4F4AQFWL.js} +8 -8
  104. package/dist/{chunk-D35XLYQ7.js → chunk-4QEYREAV.js} +12 -12
  105. package/dist/{chunk-46WM6JX2.js → chunk-4ZWCQJNM.js} +5 -5
  106. package/dist/{chunk-DVYRD4HY.js → chunk-5ACCD4L7.js} +30 -1
  107. package/dist/chunk-5ACCD4L7.js.map +1 -0
  108. package/dist/{chunk-W6J4POB6.js → chunk-5DHKCO52.js} +2 -2
  109. package/dist/{chunk-IRXMJLTW.js → chunk-5HK3CJAR.js} +2 -2
  110. package/dist/{chunk-NLUCDKLT.js → chunk-5RWZH6PH.js} +2 -2
  111. package/dist/{chunk-H7BZBSP6.js → chunk-645WOU5I.js} +4 -4
  112. package/dist/{chunk-AYAZWXJI.js → chunk-76DIF5KT.js} +2 -2
  113. package/dist/{chunk-OPPBTPUU.js → chunk-7KQB4EBS.js} +4 -4
  114. package/dist/{chunk-I2HTKOOP.js → chunk-7VZFRUQU.js} +3 -3
  115. package/dist/{chunk-DPNXADEI.js → chunk-7WOWGRAU.js} +11 -7
  116. package/dist/chunk-7WOWGRAU.js.map +1 -0
  117. package/dist/{chunk-JCWY73FK.js → chunk-AHPIFKNG.js} +2 -2
  118. package/dist/{chunk-FC7TIRFS.js → chunk-AX7UXCHJ.js} +6 -1
  119. package/dist/chunk-AX7UXCHJ.js.map +1 -0
  120. package/dist/{chunk-3I22VWB3.js → chunk-AZMLH5UT.js} +2 -2
  121. package/dist/chunk-B32WYRXX.js +77 -0
  122. package/dist/chunk-B32WYRXX.js.map +1 -0
  123. package/dist/{chunk-JOEJG4SD.js → chunk-BEC4YBNA.js} +4 -4
  124. package/dist/chunk-BWGCOLEL.js +61 -0
  125. package/dist/chunk-BWGCOLEL.js.map +1 -0
  126. package/dist/{chunk-BXXOPKT5.js → chunk-CAMNRAJF.js} +2 -2
  127. package/dist/{chunk-C24UZSFW.js → chunk-CEH2AFXG.js} +6 -6
  128. package/dist/{chunk-YOXVZJFM.js → chunk-CFVTRUR3.js} +2 -2
  129. package/dist/{chunk-SVSRPG6M.js → chunk-CPA5NBHN.js} +2 -2
  130. package/dist/{chunk-7BEPVIH3.js → chunk-CRML27CO.js} +3 -3
  131. package/dist/{chunk-AXGFOFNY.js → chunk-DA7ITC5Z.js} +2 -2
  132. package/dist/{chunk-5W7MKXMU.js → chunk-DEACDKE3.js} +144 -78
  133. package/dist/chunk-DEACDKE3.js.map +1 -0
  134. package/dist/{chunk-FEO2CDXR.js → chunk-DPCXDG7G.js} +2 -2
  135. package/dist/{chunk-HZNYJN77.js → chunk-F3NVYTTA.js} +2 -2
  136. package/dist/{chunk-7SSRXEZJ.js → chunk-F7XUD3PL.js} +2 -2
  137. package/dist/{chunk-LDBFXD4F.js → chunk-FP7YTTVO.js} +3 -1
  138. package/dist/chunk-FP7YTTVO.js.map +1 -0
  139. package/dist/{chunk-XZBXINXZ.js → chunk-GIC6BASP.js} +4 -4
  140. package/dist/{chunk-PP7R754B.js → chunk-GPFZFCRN.js} +1 -1
  141. package/dist/{chunk-53MZQEBD.js → chunk-GTO56JY5.js} +2 -2
  142. package/dist/{chunk-RAIUTAZZ.js → chunk-H2YSH3DG.js} +2 -2
  143. package/dist/{chunk-HWVNYNIV.js → chunk-HMZKGHMD.js} +2 -2
  144. package/dist/{chunk-ZXUZ54Z5.js → chunk-HRHO3ZNG.js} +2 -2
  145. package/dist/{chunk-SDEPLF7V.js → chunk-IBJ6U753.js} +2 -2
  146. package/dist/chunk-JCCWJHOP.js +240 -0
  147. package/dist/chunk-JCCWJHOP.js.map +1 -0
  148. package/dist/{chunk-T3JQTCCO.js → chunk-JI7U6AS3.js} +4 -4
  149. package/dist/{chunk-TR7DGXGI.js → chunk-JOZUBF4A.js} +5 -5
  150. package/dist/{chunk-YWBOOBDP.js → chunk-JYSN42VN.js} +71 -71
  151. package/dist/{chunk-ZPUIRTIZ.js → chunk-KOLJJN5G.js} +12 -75
  152. package/dist/chunk-KOLJJN5G.js.map +1 -0
  153. package/dist/{chunk-5W7CTZ2E.js → chunk-KQAFEZQX.js} +4 -4
  154. package/dist/{chunk-D2YNNDML.js → chunk-KWIGDKM2.js} +2 -2
  155. package/dist/{chunk-YUTTMSC7.js → chunk-KZIF6XHX.js} +93 -30
  156. package/dist/chunk-KZIF6XHX.js.map +1 -0
  157. package/dist/chunk-LB7WCZHY.js +553 -0
  158. package/dist/chunk-LB7WCZHY.js.map +1 -0
  159. package/dist/{chunk-RIAM7DND.js → chunk-LDKPDODJ.js} +2 -2
  160. package/dist/{chunk-227UFSEQ.js → chunk-LEPOP46W.js} +4 -4
  161. package/dist/{chunk-2JHRCWHT.js → chunk-LKYIOCWL.js} +107 -107
  162. package/dist/{chunk-XAWIL7TC.js → chunk-LOXHYCVS.js} +2 -2
  163. package/dist/{chunk-OMZLBT4B.js → chunk-LPNCR4QK.js} +48 -27
  164. package/dist/chunk-LPNCR4QK.js.map +1 -0
  165. package/dist/{chunk-OLBZ2WGG.js → chunk-LTBKKSCX.js} +2 -2
  166. package/dist/{chunk-O4BAGJDN.js → chunk-MDD2RINF.js} +2 -2
  167. package/dist/{chunk-H63EDPFJ.js → chunk-MI2OTWV5.js} +15 -2
  168. package/dist/{chunk-H63EDPFJ.js.map → chunk-MI2OTWV5.js.map} +1 -1
  169. package/dist/{chunk-LBFFNDFM.js → chunk-MINHJ55X.js} +1 -1
  170. package/dist/chunk-MINHJ55X.js.map +1 -0
  171. package/dist/{chunk-ROEAEANL.js → chunk-MY2BC6UE.js} +15 -15
  172. package/dist/{chunk-RACZB5HT.js → chunk-N37X5RU7.js} +4 -4
  173. package/dist/{chunk-AG46P24C.js → chunk-NNBZS3DY.js} +4 -4
  174. package/dist/{chunk-PGW64IFQ.js → chunk-NPFUNWNX.js} +2 -2
  175. package/dist/{chunk-MFOSZUIT.js → chunk-NPIBN2VL.js} +2 -2
  176. package/dist/{chunk-IF4EY26E.js → chunk-OA2O2GJ4.js} +3 -3
  177. package/dist/{chunk-6FUMA6AA.js → chunk-ODU2CNNX.js} +2 -2
  178. package/dist/{chunk-PNAGNVGK.js → chunk-OXRRJXPR.js} +42 -37
  179. package/dist/chunk-OXRRJXPR.js.map +1 -0
  180. package/dist/{chunk-TWBQQ3FT.js → chunk-P36Z4JRA.js} +2 -2
  181. package/dist/{chunk-OUKBMQ2O.js → chunk-PD66CVSD.js} +2 -2
  182. package/dist/{chunk-MVIYRRVJ.js → chunk-PMVPCZJZ.js} +5 -5
  183. package/dist/{chunk-US4IRASK.js → chunk-PU56CXZA.js} +6 -6
  184. package/dist/{chunk-IDQ6DKXC.js → chunk-S5XOSTYM.js} +3 -3
  185. package/dist/{chunk-DYO24BNB.js → chunk-SEEJOGQX.js} +5 -5
  186. package/dist/{chunk-7OZSHBWK.js → chunk-SNOIKAHM.js} +2 -2
  187. package/dist/{chunk-SR7JIRAR.js → chunk-T6ILXUAH.js} +2 -2
  188. package/dist/{chunk-2RXUZVPU.js → chunk-T7XP6IZE.js} +2 -2
  189. package/dist/{chunk-KBOG7FJV.js → chunk-TFR3HG4K.js} +3 -3
  190. package/dist/{chunk-XUZ5CIEE.js → chunk-TUHBYJXL.js} +1 -1
  191. package/dist/{chunk-7K5Q6COX.js → chunk-TVVEYCNW.js} +4 -4
  192. package/dist/{chunk-ZK4BFABK.js → chunk-U7EW2W4W.js} +13 -13
  193. package/dist/{chunk-4K7IW3F7.js → chunk-UD7UNYRD.js} +34 -3
  194. package/dist/chunk-UD7UNYRD.js.map +1 -0
  195. package/dist/{chunk-VFYRYFLL.js → chunk-UEBDCMOO.js} +2 -2
  196. package/dist/{chunk-JFWZRUKP.js → chunk-UENKPWCS.js} +4 -4
  197. package/dist/{chunk-AAXJNINV.js → chunk-UL4MKZHI.js} +2 -2
  198. package/dist/chunk-ULM7JCDH.js +154 -0
  199. package/dist/chunk-ULM7JCDH.js.map +1 -0
  200. package/dist/{chunk-R2MZCYA6.js → chunk-UNUMFURP.js} +3 -3
  201. package/dist/{chunk-5GIZM4RX.js → chunk-UPFNQJC7.js} +2 -2
  202. package/dist/{chunk-W4BMEGQA.js → chunk-UTQUEHC7.js} +2 -2
  203. package/dist/{chunk-I32NKXE2.js → chunk-V4IDF3EZ.js} +2 -2
  204. package/dist/{chunk-6LS5OX3U.js → chunk-W2BAGGEW.js} +50 -18
  205. package/dist/chunk-W2BAGGEW.js.map +1 -0
  206. package/dist/chunk-W2UOAATB.js +521 -0
  207. package/dist/chunk-W2UOAATB.js.map +1 -0
  208. package/dist/{chunk-QMZY3GG6.js → chunk-WNXYT4MK.js} +3 -3
  209. package/dist/{chunk-UVYI6VIX.js → chunk-X7Y7WX73.js} +1 -1
  210. package/dist/{chunk-T42L3S6A.js → chunk-XBGHAAKR.js} +2 -2
  211. package/dist/{chunk-RQ2EQRRR.js → chunk-XNWXSGHS.js} +80 -7
  212. package/dist/chunk-XNWXSGHS.js.map +1 -0
  213. package/dist/{chunk-THG4GYIE.js → chunk-YEUXERJ6.js} +5 -5
  214. package/dist/{chunk-BIJAWZYW.js → chunk-YMOPYG3K.js} +6 -6
  215. package/dist/{chunk-M4AHBM72.js → chunk-Z3YEGSR4.js} +2 -2
  216. package/dist/{cli-Bfgo0n1L.d.ts → cli-O3F-ht3i.d.ts} +5 -5
  217. package/dist/cli.d.ts +17 -15
  218. package/dist/cli.js +106 -104
  219. package/dist/coding/pre-action-gate.d.ts +2 -1
  220. package/dist/coding/pre-action-gate.js +2 -2
  221. package/dist/compounding/engine.d.ts +5 -2
  222. package/dist/compounding/engine.js +26 -26
  223. package/dist/compounding/preference-consolidator.d.ts +4 -3
  224. package/dist/compression-optimizer.d.ts +2 -1
  225. package/dist/config-security.js +2 -2
  226. package/dist/config.d.ts +2 -1
  227. package/dist/config.js +13 -12
  228. package/dist/connectors/codex-materialize-runner.d.ts +2 -1
  229. package/dist/connectors/codex-materialize-runner.js +25 -25
  230. package/dist/connectors/codex-materialize.d.ts +2 -1
  231. package/dist/connectors/index.d.ts +2 -1
  232. package/dist/connectors/index.js +25 -25
  233. package/dist/consolidation-provenance-check.d.ts +5 -2
  234. package/dist/consolidation-provenance-check.js +2 -2
  235. package/dist/consolidation-undo.d.ts +5 -2
  236. package/dist/context-summary.d.ts +43 -0
  237. package/dist/context-summary.js +14 -0
  238. package/dist/context-summary.js.map +1 -0
  239. package/dist/contradiction/index.d.ts +6 -3
  240. package/dist/contradiction/index.js +5 -5
  241. package/dist/converge-config.d.ts +2 -1
  242. package/dist/convergence-refresh.d.ts +5 -2
  243. package/dist/convergence-refresh.js +28 -28
  244. package/dist/conversation-index/backend.d.ts +2 -1
  245. package/dist/conversation-index/backend.js +2 -2
  246. package/dist/conversation-index/chunker.d.ts +2 -1
  247. package/dist/conversation-index/faiss-adapter.d.ts +2 -1
  248. package/dist/conversation-index/indexer.d.ts +2 -1
  249. package/dist/conversation-index/search.d.ts +2 -1
  250. package/dist/corpus-watermark.d.ts +2 -1
  251. package/dist/corpus-watermark.js +27 -27
  252. package/dist/cross-lingual-recall.d.ts +2 -1
  253. package/dist/day-summary.d.ts +2 -1
  254. package/dist/delinearize.d.ts +2 -1
  255. package/dist/dependency-propagation-config.d.ts +2 -1
  256. package/dist/{dependency-propagation-delivery-D23_x-s5.d.ts → dependency-propagation-delivery-CL6RWXTA.d.ts} +1 -1
  257. package/dist/direct-answer-wiring.d.ts +2 -1
  258. package/dist/direct-answer.d.ts +2 -1
  259. package/dist/embedding-fallback.d.ts +2 -1
  260. package/dist/enrichment/index.d.ts +2 -1
  261. package/dist/entity-origin-fields.d.ts +2 -1
  262. package/dist/entity-retrieval.d.ts +5 -2
  263. package/dist/entity-retrieval.js +26 -26
  264. package/dist/entity-schema.d.ts +2 -1
  265. package/dist/episodic-context.d.ts +2 -1
  266. package/dist/eval-trajectory-contracts.d.ts +257 -0
  267. package/dist/eval-trajectory-contracts.js +56 -0
  268. package/dist/eval-trajectory-contracts.js.map +1 -0
  269. package/dist/eval-trajectory-store.d.ts +40 -0
  270. package/dist/eval-trajectory-store.js +19 -0
  271. package/dist/eval-trajectory-store.js.map +1 -0
  272. package/dist/eval-trajectory.d.ts +68 -0
  273. package/dist/eval-trajectory.js +46 -0
  274. package/dist/eval-trajectory.js.map +1 -0
  275. package/dist/event-order-recall.js +2 -2
  276. package/dist/explicit-capture.d.ts +13 -11
  277. package/dist/explicit-capture.js +6 -6
  278. package/dist/external-wiki-access.d.ts +15 -13
  279. package/dist/external-wiki-access.js +55 -55
  280. package/dist/external-wiki-collection-registration.d.ts +2 -1
  281. package/dist/external-wiki-collection.d.ts +2 -1
  282. package/dist/external-wiki-mcp-tools.d.ts +15 -13
  283. package/dist/extraction-error-classification.d.ts +2 -1
  284. package/dist/extraction-faithfulness.d.ts +2 -1
  285. package/dist/extraction-judge-telemetry.d.ts +2 -1
  286. package/dist/extraction-judge-training.d.ts +2 -1
  287. package/dist/extraction-judge.d.ts +2 -1
  288. package/dist/extraction-liveness.d.ts +2 -1
  289. package/dist/extraction-normalization.d.ts +2 -1
  290. package/dist/extraction-prompt.d.ts +2 -1
  291. package/dist/extraction-source-grounding-rules.d.ts +2 -1
  292. package/dist/extraction-source-grounding.d.ts +2 -1
  293. package/dist/extraction.d.ts +2 -1
  294. package/dist/extraction.js +33 -33
  295. package/dist/fallback-llm.d.ts +2 -1
  296. package/dist/{forget-SZ2BXDGF.js → forget-2AE4MDK3.js} +3 -3
  297. package/dist/graph-dashboard-diff.d.ts +2 -1
  298. package/dist/graph-dashboard-key.d.ts +2 -1
  299. package/dist/graph-dashboard-parser.d.ts +2 -1
  300. package/dist/{graph-edge-decay-FXGELBFA.js → graph-edge-decay-A4SDFMMS.js} +4 -4
  301. package/dist/graph-edge-decay-A4SDFMMS.js.map +1 -0
  302. package/dist/graph-edge-reinforcement.d.ts +2 -1
  303. package/dist/graph-path-reconstruction.d.ts +2 -1
  304. package/dist/graph-path-scoring.d.ts +2 -1
  305. package/dist/graph-snapshot.d.ts +2 -1
  306. package/dist/graph-snapshot.js +3 -3
  307. package/dist/graph.d.ts +2 -1
  308. package/dist/graph.js +3 -3
  309. package/dist/harmonic-retrieval.js +1 -1
  310. package/dist/importance.d.ts +2 -1
  311. package/dist/importers/index.d.ts +2 -1
  312. package/dist/in-flight-reads.d.ts +2 -1
  313. package/dist/{index--QhGIXF2.d.ts → index-C7Xep6S9.d.ts} +2 -2
  314. package/dist/index.d.ts +706 -701
  315. package/dist/index.js +271 -200
  316. package/dist/intent.d.ts +2 -1
  317. package/dist/lcm/engine.d.ts +3 -2
  318. package/dist/lcm/engine.js +3 -2
  319. package/dist/lcm/index.d.ts +4 -2
  320. package/dist/lcm/index.js +6 -5
  321. package/dist/lcm/summarizer.d.ts +4 -6
  322. package/dist/lcm/summarizer.js +2 -1
  323. package/dist/lcm/tools.d.ts +4 -3
  324. package/dist/lifecycle.d.ts +2 -1
  325. package/dist/live-connectors-runner.d.ts +2 -1
  326. package/dist/local-llm.d.ts +2 -1
  327. package/dist/local-model-endpoint.d.ts +2 -1
  328. package/dist/location/index.d.ts +128 -1
  329. package/dist/location/index.js +60 -750
  330. package/dist/location/index.js.map +1 -1
  331. package/dist/maintenance/memory-governance.d.ts +2 -1
  332. package/dist/maintenance/memory-governance.js +26 -26
  333. package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +5 -2
  334. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +25 -25
  335. package/dist/maintenance/rebuild-memory-projection.d.ts +5 -2
  336. package/dist/maintenance/rebuild-memory-projection.js +27 -27
  337. package/dist/{maintenance-PFvY1Pw_.d.ts → maintenance-CJ-xqFp0.d.ts} +4 -3
  338. package/dist/mcp-memory-inspector-app.d.ts +15 -13
  339. package/dist/mcp-read-only-tools.js +1 -1
  340. package/dist/memory-action-policy.d.ts +18 -2
  341. package/dist/memory-action-policy.js +3 -1
  342. package/dist/memory-cache.d.ts +2 -1
  343. package/dist/memory-controller.d.ts +2 -1
  344. package/dist/memory-controller.js +2 -2
  345. package/dist/memory-lifecycle-ledger-utils.d.ts +2 -1
  346. package/dist/memory-projection-store.d.ts +2 -1
  347. package/dist/memory-provenance.d.ts +2 -1
  348. package/dist/memory-snapshot.d.ts +2 -1
  349. package/dist/memory-subject-cli.d.ts +15 -13
  350. package/dist/memory-subject.d.ts +15 -13
  351. package/dist/memory-subject.js +3 -3
  352. package/dist/memory-worth-outcomes.d.ts +50 -3
  353. package/dist/memory-worth-outcomes.js +5 -3
  354. package/dist/models-json.d.ts +2 -1
  355. package/dist/namespaces/migrate.d.ts +6 -3
  356. package/dist/namespaces/migrate.js +26 -26
  357. package/dist/namespaces/principal.d.ts +2 -1
  358. package/dist/namespaces/search.d.ts +2 -1
  359. package/dist/namespaces/search.js +11 -11
  360. package/dist/namespaces/storage.d.ts +6 -3
  361. package/dist/namespaces/storage.js +25 -25
  362. package/dist/native-knowledge.d.ts +2 -1
  363. package/dist/offline-sync-impression-drain.d.ts +2 -1
  364. package/dist/offline-sync-impression-drain.js +2 -2
  365. package/dist/operator-doctor-corpus.d.ts +2 -1
  366. package/dist/operator-doctor-corpus.js +28 -28
  367. package/dist/operator-doctor-replica.d.ts +2 -1
  368. package/dist/operator-toolkit.d.ts +6 -3
  369. package/dist/operator-toolkit.js +45 -44
  370. package/dist/orchestration/compression-guideline-coordinator.d.ts +5 -2
  371. package/dist/orchestration/maintenance.d.ts +7 -4
  372. package/dist/orchestration/maintenance.js +34 -32
  373. package/dist/{orchestrator-4wzJrPVm.d.ts → orchestrator-BsntWxLy.d.ts} +8 -8
  374. package/dist/orchestrator.d.ts +13 -11
  375. package/dist/orchestrator.js +156 -148
  376. package/dist/patterns-cli.d.ts +2 -1
  377. package/dist/{pipeline-CgXgdIrF.d.ts → pipeline-CVoysPm2.d.ts} +1 -1
  378. package/dist/policy-runtime.d.ts +2 -1
  379. package/dist/proactive-contention.d.ts +2 -1
  380. package/dist/provenance.d.ts +2 -1
  381. package/dist/{public-http-BP3VQDl5.d.ts → public-http-CuOxlTC2.d.ts} +1 -1
  382. package/dist/{qmd-BppGGxsi.d.ts → qmd-DWMAGA5l.d.ts} +1 -1
  383. package/dist/qmd-preflight.d.ts +3 -2
  384. package/dist/qmd-recall-cache.d.ts +2 -1
  385. package/dist/qmd.d.ts +3 -2
  386. package/dist/qmd.js +4 -4
  387. package/dist/recall-concurrency-config.d.ts +2 -1
  388. package/dist/recall-disclosure-escalation.d.ts +2 -1
  389. package/dist/recall-explain-renderer.d.ts +2 -1
  390. package/dist/recall-explain-renderer.js +3 -3
  391. package/dist/recall-memory-map.d.ts +2 -1
  392. package/dist/recall-planner-llm.d.ts +2 -1
  393. package/dist/recall-state.d.ts +2 -1
  394. package/dist/recall-tag-filter.d.ts +2 -1
  395. package/dist/recall-timings.d.ts +2 -1
  396. package/dist/recall-xray-cli.d.ts +2 -1
  397. package/dist/recall-xray-cli.js +4 -4
  398. package/dist/recall-xray-renderer.d.ts +2 -1
  399. package/dist/recall-xray-renderer.js +3 -3
  400. package/dist/recall-xray.d.ts +2 -1
  401. package/dist/recall-xray.js +2 -2
  402. package/dist/reconcile/cursor.d.ts +2 -1
  403. package/dist/reconcile/manifest.d.ts +2 -1
  404. package/dist/reconcile/manifest.js +3 -3
  405. package/dist/reconcile/plan.d.ts +2 -1
  406. package/dist/replay/normalizers/chatgpt.d.ts +2 -1
  407. package/dist/replay/normalizers/claude.d.ts +2 -1
  408. package/dist/replay/normalizers/openclaw.d.ts +2 -1
  409. package/dist/replay/normalizers/shared.d.ts +2 -1
  410. package/dist/replay/runner.d.ts +2 -1
  411. package/dist/replay/types.d.ts +2 -1
  412. package/dist/replica-divergence.d.ts +2 -1
  413. package/dist/replica-peers-config.d.ts +2 -1
  414. package/dist/{resolution-4552BNRV.js → resolution-XWBPKYFB.js} +6 -6
  415. package/dist/resolution-XWBPKYFB.js.map +1 -0
  416. package/dist/resolve-auth-token.d.ts +2 -1
  417. package/dist/resume-bundles.js +14 -13
  418. package/dist/retrieval-agents.d.ts +3 -2
  419. package/dist/retrieval-tiers.d.ts +2 -1
  420. package/dist/routing/engine.d.ts +2 -1
  421. package/dist/routing/store.d.ts +2 -1
  422. package/dist/salvage-envelope.d.ts +2 -1
  423. package/dist/salvage-envelope.js +5 -5
  424. package/dist/schemas.d.ts +124 -124
  425. package/dist/{scope-profiles-ChZUtxDU.d.ts → scope-profiles-CPWkW_dI.d.ts} +1 -1
  426. package/dist/search/embed-helper.d.ts +2 -1
  427. package/dist/search/factory.d.ts +2 -1
  428. package/dist/search/factory.js +10 -10
  429. package/dist/search/index.d.ts +2 -1
  430. package/dist/search/index.js +15 -15
  431. package/dist/search/lancedb-backend.d.ts +2 -1
  432. package/dist/search/lancedb-backend.js +2 -2
  433. package/dist/search/meilisearch-backend.d.ts +2 -1
  434. package/dist/search/meilisearch-backend.js +2 -2
  435. package/dist/search/noop-backend.d.ts +2 -1
  436. package/dist/search/orama-backend.d.ts +2 -1
  437. package/dist/search/orama-backend.js +2 -2
  438. package/dist/search/port.d.ts +2 -1
  439. package/dist/search/remote-backend.d.ts +2 -1
  440. package/dist/{semantic-consolidation-mSPwQSmF.d.ts → semantic-consolidation-CNFVBXFc.d.ts} +1 -1
  441. package/dist/semantic-consolidation.d.ts +3 -2
  442. package/dist/semantic-consolidation.js +31 -31
  443. package/dist/semantic-rule-promotion.js +25 -25
  444. package/dist/semantic-rule-verifier.d.ts +2 -1
  445. package/dist/semantic-rule-verifier.js +25 -25
  446. package/dist/{service-BICWLwSP.d.ts → service-Bb-JIdQ0.d.ts} +2 -2
  447. package/dist/session-observer-bands.d.ts +2 -1
  448. package/dist/session-observer-state.d.ts +2 -1
  449. package/dist/shared-context/manager.d.ts +8 -7
  450. package/dist/signal.d.ts +2 -1
  451. package/dist/source-agent-qualifier.d.ts +2 -1
  452. package/dist/source-agent-qualifier.js +29 -29
  453. package/dist/{storage-B7urx1K3.d.ts → storage-CukrlNKk.d.ts} +4 -1
  454. package/dist/storage.d.ts +5 -2
  455. package/dist/storage.js +24 -24
  456. package/dist/subject-config.d.ts +2 -1
  457. package/dist/subject-config.js +4 -4
  458. package/dist/summarizer.d.ts +2 -1
  459. package/dist/summary-snapshot.d.ts +2 -1
  460. package/dist/support-passport/index.d.ts +18 -16
  461. package/dist/support-passport/index.js +57 -57
  462. package/dist/temporal-supersession.d.ts +3 -2
  463. package/dist/temporal-timeline-recall.d.ts +2 -1
  464. package/dist/temporal-validity.d.ts +2 -1
  465. package/dist/threading.d.ts +2 -1
  466. package/dist/tier-migration.d.ts +5 -2
  467. package/dist/tier-routing.d.ts +2 -1
  468. package/dist/topics.d.ts +2 -1
  469. package/dist/transcript.d.ts +2 -1
  470. package/dist/transfer/backup.js +2 -2
  471. package/dist/transfer/capsule-export.js +2 -2
  472. package/dist/transfer/capsule-import.js +2 -2
  473. package/dist/transfer/types.d.ts +78 -78
  474. package/dist/trust-score-stage.d.ts +2 -1
  475. package/dist/trust-score.d.ts +2 -1
  476. package/dist/{types-ETU5N6nB.d.ts → types-djxQlxJ7.d.ts} +3 -2
  477. package/dist/types.d.ts +2 -1
  478. package/dist/types.js +1 -1
  479. package/dist/utility-runtime.d.ts +2 -1
  480. package/dist/verified-recall.js +25 -25
  481. package/dist/who-knows-cli.d.ts +15 -13
  482. package/dist/who-knows-cli.js +26 -26
  483. package/dist/who-knows.d.ts +15 -13
  484. package/dist/who-knows.js +25 -25
  485. package/dist/write-envelope.d.ts +2 -1
  486. package/dist/write-envelope.js +4 -4
  487. package/package.json +22 -2
  488. package/src/access-boundary.ts +5 -0
  489. package/src/access-http.ts +15 -16
  490. package/src/access-mcp-output-schemas.ts +5 -0
  491. package/src/access-mcp.ts +6 -6
  492. package/src/access-operations.ts +2 -0
  493. package/src/access-surface-catalog.ts +10 -0
  494. package/src/active-context-config.ts +98 -0
  495. package/src/active-context-transform.test.ts +533 -0
  496. package/src/active-context-transform.ts +981 -0
  497. package/src/config.ts +3 -5
  498. package/src/context-summary.ts +182 -0
  499. package/src/eval-trajectory-contracts.ts +411 -0
  500. package/src/eval-trajectory-store.ts +306 -0
  501. package/src/eval-trajectory.test.ts +534 -0
  502. package/src/eval-trajectory.ts +773 -0
  503. package/src/index.ts +6 -11
  504. package/src/lcm/summarizer.ts +14 -93
  505. package/src/location/access-operations.ts +84 -0
  506. package/src/location/http-glue.test.ts +100 -0
  507. package/src/location/http-glue.ts +85 -0
  508. package/src/location/index.ts +3 -0
  509. package/src/location/mcp-tools.ts +82 -0
  510. package/src/location/provider-setup.test.ts +106 -0
  511. package/src/location/provider-setup.ts +103 -0
  512. package/src/location/scheduler.test.ts +113 -0
  513. package/src/location/scheduler.ts +98 -0
  514. package/src/location/surfaces.test.ts +241 -0
  515. package/src/location/surfaces.ts +329 -0
  516. package/src/maintenance/day-summary-cron.ts +45 -0
  517. package/src/mcp-read-only-tools.ts +2 -0
  518. package/src/memory-action-policy.ts +28 -0
  519. package/src/memory-worth-outcomes.test.ts +53 -18
  520. package/src/memory-worth-outcomes.ts +91 -9
  521. package/src/orchestration/maintenance.ts +22 -30
  522. package/src/storage/context-transform-ledger.ts +39 -0
  523. package/src/storage/secure-line-reader.ts +50 -1
  524. package/src/storage.ts +4 -1
  525. package/src/types.ts +2 -3
  526. package/src/wearables/http-glue.ts +28 -0
  527. package/dist/chunk-4K7IW3F7.js.map +0 -1
  528. package/dist/chunk-5W7MKXMU.js.map +0 -1
  529. package/dist/chunk-6LS5OX3U.js.map +0 -1
  530. package/dist/chunk-DPNXADEI.js.map +0 -1
  531. package/dist/chunk-DVYRD4HY.js.map +0 -1
  532. package/dist/chunk-FC7TIRFS.js.map +0 -1
  533. package/dist/chunk-LBFFNDFM.js.map +0 -1
  534. package/dist/chunk-LDBFXD4F.js.map +0 -1
  535. package/dist/chunk-OMZLBT4B.js.map +0 -1
  536. package/dist/chunk-PNAGNVGK.js.map +0 -1
  537. package/dist/chunk-RQ2EQRRR.js.map +0 -1
  538. package/dist/chunk-YUTTMSC7.js.map +0 -1
  539. package/dist/chunk-ZPUIRTIZ.js.map +0 -1
  540. /package/dist/{capsule-crypto-GWVG7LGC.js.map → active-context-config.js.map} +0 -0
  541. /package/dist/{graph-edge-decay-FXGELBFA.js.map → active-context-transform.js.map} +0 -0
  542. /package/dist/{auto-sync-XVMLL2RH.js.map → auto-sync-2YPITIWN.js.map} +0 -0
  543. /package/dist/{resolution-4552BNRV.js.map → capsule-crypto-7FJQINUR.js.map} +0 -0
  544. /package/dist/{chunk-OWHERGF2.js.map → chunk-2NLLXCJG.js.map} +0 -0
  545. /package/dist/{chunk-NZPFCP5A.js.map → chunk-2PSX5BJU.js.map} +0 -0
  546. /package/dist/{chunk-RKNJBZ55.js.map → chunk-2QSZNTDO.js.map} +0 -0
  547. /package/dist/{chunk-X2DWBWOX.js.map → chunk-3A2NJP2U.js.map} +0 -0
  548. /package/dist/{chunk-JGG5HVI2.js.map → chunk-3PKAS6VL.js.map} +0 -0
  549. /package/dist/{chunk-LSYD7GHZ.js.map → chunk-3SZD4CYO.js.map} +0 -0
  550. /package/dist/{chunk-5TG4MU2U.js.map → chunk-4F4AQFWL.js.map} +0 -0
  551. /package/dist/{chunk-D35XLYQ7.js.map → chunk-4QEYREAV.js.map} +0 -0
  552. /package/dist/{chunk-46WM6JX2.js.map → chunk-4ZWCQJNM.js.map} +0 -0
  553. /package/dist/{chunk-W6J4POB6.js.map → chunk-5DHKCO52.js.map} +0 -0
  554. /package/dist/{chunk-IRXMJLTW.js.map → chunk-5HK3CJAR.js.map} +0 -0
  555. /package/dist/{chunk-NLUCDKLT.js.map → chunk-5RWZH6PH.js.map} +0 -0
  556. /package/dist/{chunk-H7BZBSP6.js.map → chunk-645WOU5I.js.map} +0 -0
  557. /package/dist/{chunk-AYAZWXJI.js.map → chunk-76DIF5KT.js.map} +0 -0
  558. /package/dist/{chunk-OPPBTPUU.js.map → chunk-7KQB4EBS.js.map} +0 -0
  559. /package/dist/{chunk-I2HTKOOP.js.map → chunk-7VZFRUQU.js.map} +0 -0
  560. /package/dist/{chunk-JCWY73FK.js.map → chunk-AHPIFKNG.js.map} +0 -0
  561. /package/dist/{chunk-3I22VWB3.js.map → chunk-AZMLH5UT.js.map} +0 -0
  562. /package/dist/{chunk-JOEJG4SD.js.map → chunk-BEC4YBNA.js.map} +0 -0
  563. /package/dist/{chunk-BXXOPKT5.js.map → chunk-CAMNRAJF.js.map} +0 -0
  564. /package/dist/{chunk-C24UZSFW.js.map → chunk-CEH2AFXG.js.map} +0 -0
  565. /package/dist/{chunk-YOXVZJFM.js.map → chunk-CFVTRUR3.js.map} +0 -0
  566. /package/dist/{chunk-SVSRPG6M.js.map → chunk-CPA5NBHN.js.map} +0 -0
  567. /package/dist/{chunk-7BEPVIH3.js.map → chunk-CRML27CO.js.map} +0 -0
  568. /package/dist/{chunk-AXGFOFNY.js.map → chunk-DA7ITC5Z.js.map} +0 -0
  569. /package/dist/{chunk-FEO2CDXR.js.map → chunk-DPCXDG7G.js.map} +0 -0
  570. /package/dist/{chunk-HZNYJN77.js.map → chunk-F3NVYTTA.js.map} +0 -0
  571. /package/dist/{chunk-7SSRXEZJ.js.map → chunk-F7XUD3PL.js.map} +0 -0
  572. /package/dist/{chunk-XZBXINXZ.js.map → chunk-GIC6BASP.js.map} +0 -0
  573. /package/dist/{chunk-PP7R754B.js.map → chunk-GPFZFCRN.js.map} +0 -0
  574. /package/dist/{chunk-53MZQEBD.js.map → chunk-GTO56JY5.js.map} +0 -0
  575. /package/dist/{chunk-RAIUTAZZ.js.map → chunk-H2YSH3DG.js.map} +0 -0
  576. /package/dist/{chunk-HWVNYNIV.js.map → chunk-HMZKGHMD.js.map} +0 -0
  577. /package/dist/{chunk-ZXUZ54Z5.js.map → chunk-HRHO3ZNG.js.map} +0 -0
  578. /package/dist/{chunk-SDEPLF7V.js.map → chunk-IBJ6U753.js.map} +0 -0
  579. /package/dist/{chunk-T3JQTCCO.js.map → chunk-JI7U6AS3.js.map} +0 -0
  580. /package/dist/{chunk-TR7DGXGI.js.map → chunk-JOZUBF4A.js.map} +0 -0
  581. /package/dist/{chunk-YWBOOBDP.js.map → chunk-JYSN42VN.js.map} +0 -0
  582. /package/dist/{chunk-5W7CTZ2E.js.map → chunk-KQAFEZQX.js.map} +0 -0
  583. /package/dist/{chunk-D2YNNDML.js.map → chunk-KWIGDKM2.js.map} +0 -0
  584. /package/dist/{chunk-RIAM7DND.js.map → chunk-LDKPDODJ.js.map} +0 -0
  585. /package/dist/{chunk-227UFSEQ.js.map → chunk-LEPOP46W.js.map} +0 -0
  586. /package/dist/{chunk-2JHRCWHT.js.map → chunk-LKYIOCWL.js.map} +0 -0
  587. /package/dist/{chunk-XAWIL7TC.js.map → chunk-LOXHYCVS.js.map} +0 -0
  588. /package/dist/{chunk-OLBZ2WGG.js.map → chunk-LTBKKSCX.js.map} +0 -0
  589. /package/dist/{chunk-O4BAGJDN.js.map → chunk-MDD2RINF.js.map} +0 -0
  590. /package/dist/{chunk-ROEAEANL.js.map → chunk-MY2BC6UE.js.map} +0 -0
  591. /package/dist/{chunk-RACZB5HT.js.map → chunk-N37X5RU7.js.map} +0 -0
  592. /package/dist/{chunk-AG46P24C.js.map → chunk-NNBZS3DY.js.map} +0 -0
  593. /package/dist/{chunk-PGW64IFQ.js.map → chunk-NPFUNWNX.js.map} +0 -0
  594. /package/dist/{chunk-MFOSZUIT.js.map → chunk-NPIBN2VL.js.map} +0 -0
  595. /package/dist/{chunk-IF4EY26E.js.map → chunk-OA2O2GJ4.js.map} +0 -0
  596. /package/dist/{chunk-6FUMA6AA.js.map → chunk-ODU2CNNX.js.map} +0 -0
  597. /package/dist/{chunk-TWBQQ3FT.js.map → chunk-P36Z4JRA.js.map} +0 -0
  598. /package/dist/{chunk-OUKBMQ2O.js.map → chunk-PD66CVSD.js.map} +0 -0
  599. /package/dist/{chunk-MVIYRRVJ.js.map → chunk-PMVPCZJZ.js.map} +0 -0
  600. /package/dist/{chunk-US4IRASK.js.map → chunk-PU56CXZA.js.map} +0 -0
  601. /package/dist/{chunk-IDQ6DKXC.js.map → chunk-S5XOSTYM.js.map} +0 -0
  602. /package/dist/{chunk-DYO24BNB.js.map → chunk-SEEJOGQX.js.map} +0 -0
  603. /package/dist/{chunk-7OZSHBWK.js.map → chunk-SNOIKAHM.js.map} +0 -0
  604. /package/dist/{chunk-SR7JIRAR.js.map → chunk-T6ILXUAH.js.map} +0 -0
  605. /package/dist/{chunk-2RXUZVPU.js.map → chunk-T7XP6IZE.js.map} +0 -0
  606. /package/dist/{chunk-KBOG7FJV.js.map → chunk-TFR3HG4K.js.map} +0 -0
  607. /package/dist/{chunk-XUZ5CIEE.js.map → chunk-TUHBYJXL.js.map} +0 -0
  608. /package/dist/{chunk-7K5Q6COX.js.map → chunk-TVVEYCNW.js.map} +0 -0
  609. /package/dist/{chunk-ZK4BFABK.js.map → chunk-U7EW2W4W.js.map} +0 -0
  610. /package/dist/{chunk-VFYRYFLL.js.map → chunk-UEBDCMOO.js.map} +0 -0
  611. /package/dist/{chunk-JFWZRUKP.js.map → chunk-UENKPWCS.js.map} +0 -0
  612. /package/dist/{chunk-AAXJNINV.js.map → chunk-UL4MKZHI.js.map} +0 -0
  613. /package/dist/{chunk-R2MZCYA6.js.map → chunk-UNUMFURP.js.map} +0 -0
  614. /package/dist/{chunk-5GIZM4RX.js.map → chunk-UPFNQJC7.js.map} +0 -0
  615. /package/dist/{chunk-W4BMEGQA.js.map → chunk-UTQUEHC7.js.map} +0 -0
  616. /package/dist/{chunk-I32NKXE2.js.map → chunk-V4IDF3EZ.js.map} +0 -0
  617. /package/dist/{chunk-QMZY3GG6.js.map → chunk-WNXYT4MK.js.map} +0 -0
  618. /package/dist/{chunk-UVYI6VIX.js.map → chunk-X7Y7WX73.js.map} +0 -0
  619. /package/dist/{chunk-T42L3S6A.js.map → chunk-XBGHAAKR.js.map} +0 -0
  620. /package/dist/{chunk-THG4GYIE.js.map → chunk-YEUXERJ6.js.map} +0 -0
  621. /package/dist/{chunk-BIJAWZYW.js.map → chunk-YMOPYG3K.js.map} +0 -0
  622. /package/dist/{chunk-M4AHBM72.js.map → chunk-Z3YEGSR4.js.map} +0 -0
  623. /package/dist/{forget-SZ2BXDGF.js.map → forget-2AE4MDK3.js.map} +0 -0
@@ -0,0 +1,329 @@
1
+ /**
2
+ * Location surface runners (issue #2047) — ONE implementation shared by the
3
+ * CLI (`remnic location ...`), the MCP tools, the HTTP routes, and the
4
+ * scheduler, so no surface can fork validation or disabled/empty/failure
5
+ * semantics (same rule as the wearables runner). Parsing here is strict:
6
+ * unknown flags reject with the valid list, invalid values reject loudly.
7
+ */
8
+
9
+ import { EngramAccessInputError } from "../access-errors.js";
10
+ import {
11
+ checkLocationSources,
12
+ locationStatus,
13
+ syncLocation,
14
+ type LocationSourceCheckResult,
15
+ type LocationStatusReport,
16
+ } from "./cli.js";
17
+ import { isValidLocationDate } from "./intervals.js";
18
+ import type { LocationSourceSyncResult } from "./pipeline.js";
19
+ import { ensureConfiguredLocationProviders } from "./provider-setup.js";
20
+ import { parseLocationDaySummary, readLocationDay } from "./store.js";
21
+ import type { LocationConfig } from "./types.js";
22
+
23
+ export interface LocationSurfaceDeps {
24
+ config: LocationConfig;
25
+ memoryDir: string;
26
+ }
27
+
28
+ export interface LocationSyncRun {
29
+ date: string;
30
+ results: LocationSourceSyncResult[];
31
+ }
32
+
33
+ export type LocationSyncRuns = LocationSyncRun[];
34
+
35
+ export async function runLocationStatus(
36
+ deps: LocationSurfaceDeps,
37
+ ): Promise<LocationStatusReport> {
38
+ await ensureConfiguredLocationProviders(deps.config);
39
+ return locationStatus(deps.config, deps.memoryDir);
40
+ }
41
+
42
+ export async function runLocationCheck(
43
+ deps: LocationSurfaceDeps,
44
+ signal?: AbortSignal,
45
+ ): Promise<LocationSourceCheckResult[]> {
46
+ await ensureConfiguredLocationProviders(deps.config);
47
+ return checkLocationSources(deps.config, signal !== undefined ? { signal } : {});
48
+ }
49
+
50
+ export async function runLocationSync(
51
+ deps: LocationSurfaceDeps,
52
+ request: { endDate?: string; days?: number } = {},
53
+ ): Promise<LocationSyncRuns> {
54
+ await ensureConfiguredLocationProviders(deps.config);
55
+ const runs = await syncLocation({ ...deps, ...validatedSyncWindow(request) });
56
+ return runs as LocationSyncRuns;
57
+ }
58
+
59
+ export interface LocationDayView {
60
+ date: string;
61
+ found: boolean;
62
+ sources: string[];
63
+ observationCount: number;
64
+ body: string | null;
65
+ }
66
+
67
+ export async function runLocationDay(memoryDir: string, rawDate: unknown): Promise<LocationDayView> {
68
+ const date = requireLocationDate(rawDate, "date");
69
+ const body = await readLocationDay(memoryDir, date);
70
+ const summary = body === null ? null : parseLocationDaySummary(body);
71
+ return {
72
+ date,
73
+ found: body !== null,
74
+ sources: summary?.sources ?? [],
75
+ observationCount: summary?.observationCount ?? 0,
76
+ body,
77
+ };
78
+ }
79
+
80
+ // ---------------------------------------------------------------------------
81
+ // Shared validation (CLI, MCP, HTTP all reject identically)
82
+ // ---------------------------------------------------------------------------
83
+
84
+ function requireLocationDate(raw: unknown, label: string): string {
85
+ if (typeof raw !== "string" || !isValidLocationDate(raw)) {
86
+ throw new EngramAccessInputError(`location: ${label} is required (YYYY-MM-DD)`);
87
+ }
88
+ return raw;
89
+ }
90
+
91
+ function optionalLocationDays(raw: unknown): number | undefined {
92
+ if (raw === undefined || raw === null || raw === "") return undefined;
93
+ const parsed = typeof raw === "number" ? raw : Number(raw);
94
+ if (!Number.isInteger(parsed) || parsed < 1 || parsed > 90) {
95
+ throw new EngramAccessInputError("location: days expects an integer from 1 to 90");
96
+ }
97
+ return parsed;
98
+ }
99
+
100
+ function validatedSyncWindow(request: { endDate?: string; days?: number }): {
101
+ endDate?: string;
102
+ days?: number;
103
+ } {
104
+ const days = optionalLocationDays(request.days);
105
+ const endDate =
106
+ request.endDate === undefined || request.endDate === null || request.endDate === ""
107
+ ? undefined
108
+ : requireLocationDate(request.endDate, "date");
109
+ return { ...(endDate !== undefined ? { endDate } : {}), ...(days !== undefined ? { days } : {}) };
110
+ }
111
+
112
+ /** Day span between two inclusive local dates (from ≤ to, ≤ 90 days). */
113
+ export function parseLocationBackfillRange(
114
+ rawFrom: unknown,
115
+ rawTo: unknown,
116
+ ): { endDate: string; days: number } {
117
+ const from = requireLocationDate(rawFrom, "from");
118
+ const to = requireLocationDate(rawTo, "to");
119
+ const fromMs = Date.parse(`${from}T00:00:00Z`);
120
+ const toMs = Date.parse(`${to}T00:00:00Z`);
121
+ if (toMs < fromMs) {
122
+ throw new EngramAccessInputError("location: backfill --from must not be after --to");
123
+ }
124
+ const days = Math.round((toMs - fromMs) / 86_400_000) + 1;
125
+ if (days > 90) {
126
+ throw new EngramAccessInputError("location: backfill range is capped at 90 days");
127
+ }
128
+ return { endDate: to, days };
129
+ }
130
+
131
+ // ---------------------------------------------------------------------------
132
+ // CLI command (shared by every CLI host)
133
+ // ---------------------------------------------------------------------------
134
+
135
+ export interface LocationCliIo {
136
+ stdout: { write(chunk: string): unknown };
137
+ stderr: { write(chunk: string): unknown };
138
+ }
139
+
140
+ const USAGE = `Usage: location <command> [options]
141
+
142
+ Commands:
143
+ status Configured sources, registration, last sync
144
+ check Probe every enabled provider (auth/connectivity)
145
+ sync [options] Sync recent local days (default: config.syncDays
146
+ ending yesterday)
147
+ --date <YYYY-MM-DD> End the window on this day (inclusive)
148
+ --days <n> Window size, 1..90 (default: location.syncDays)
149
+ backfill --from <date> --to <date>
150
+ Sync an explicit historical range (≤ 90 days)
151
+ day <YYYY-MM-DD> Print one stored location day
152
+
153
+ Add --json to status/sync/backfill/day for machine-readable output.
154
+ Credentials for built-in providers come from the environment:
155
+ reitti: REITTI_BASE_URL, REITTI_TOKEN[, REITTI_AUTH_MODE=x-api-token|bearer]
156
+ `;
157
+
158
+ const VALUE_FLAGS = new Set(["--date", "--days", "--from", "--to"]);
159
+ const BOOLEAN_FLAGS = new Set(["--json"]);
160
+
161
+ interface ParsedCliFlags {
162
+ flags: Map<string, string | true>;
163
+ positional: string[];
164
+ }
165
+
166
+ function parseCliFlags(args: string[]): ParsedCliFlags {
167
+ const flags = new Map<string, string | true>();
168
+ const positional: string[] = [];
169
+ for (let index = 0; index < args.length; index++) {
170
+ const arg = args[index];
171
+ if (!arg.startsWith("--")) {
172
+ positional.push(arg);
173
+ continue;
174
+ }
175
+ if (BOOLEAN_FLAGS.has(arg)) {
176
+ flags.set(arg, true);
177
+ continue;
178
+ }
179
+ if (VALUE_FLAGS.has(arg)) {
180
+ const value = args[index + 1];
181
+ if (value === undefined || value.startsWith("--")) {
182
+ throw new EngramAccessInputError(`location: ${arg} requires a value`);
183
+ }
184
+ flags.set(arg, value);
185
+ index++;
186
+ continue;
187
+ }
188
+ throw new EngramAccessInputError(
189
+ `location: unknown flag '${arg}' — valid flags: ${[...VALUE_FLAGS, ...BOOLEAN_FLAGS].join(", ")}`,
190
+ );
191
+ }
192
+ return { flags, positional };
193
+ }
194
+
195
+ function flagString(parsed: ParsedCliFlags, name: string): string | undefined {
196
+ const value = parsed.flags.get(name);
197
+ return typeof value === "string" ? value : undefined;
198
+ }
199
+
200
+ function renderStatus(report: LocationStatusReport): string {
201
+ const lines = [
202
+ `Location: ${report.enabled ? "enabled" : "disabled"} (timezone ${report.timezone})`,
203
+ ];
204
+ if (report.sources.length === 0) {
205
+ lines.push("No sources configured. Add location.sources to the plugin config.");
206
+ return `${lines.join("\n")}\n`;
207
+ }
208
+ for (const source of report.sources) {
209
+ lines.push(
210
+ ` ${source.id}: ${source.enabled ? "enabled" : "disabled"}, ` +
211
+ `provider ${source.providerRegistered ? "registered" : "not registered"}, ` +
212
+ `${source.trackedDays} tracked day${source.trackedDays === 1 ? "" : "s"}, ` +
213
+ `last sync ${source.lastSyncedAtUtc ?? "never"}`,
214
+ );
215
+ }
216
+ if (report.recentDays.length > 0) {
217
+ lines.push(" recent days:");
218
+ for (const day of report.recentDays) {
219
+ lines.push(
220
+ ` ${day.date} ${day.observationCount} observation${day.observationCount === 1 ? "" : "s"} [${day.sources.join(", ")}]`,
221
+ );
222
+ }
223
+ }
224
+ return `${lines.join("\n")}\n`;
225
+ }
226
+
227
+ function anySourceFailed(runs: LocationSyncRuns): boolean {
228
+ return runs.some((run) => run.results.some((result) => result.status === "failed"));
229
+ }
230
+
231
+ function renderRuns(io: LocationCliIo, runs: LocationSyncRuns): void {
232
+ for (const run of runs) {
233
+ for (const result of run.results) {
234
+ io.stdout.write(
235
+ `${run.date} ${result.sourceId}: ${result.status}${result.error ? ` — ${result.error}` : ""} (${result.fetched} fetched)\n`,
236
+ );
237
+ }
238
+ }
239
+ }
240
+
241
+ /** Run a `remnic location ...` command; returns a process exit code. */
242
+ export async function runLocationCliCommand(
243
+ deps: LocationSurfaceDeps,
244
+ args: string[],
245
+ io: LocationCliIo,
246
+ ): Promise<number> {
247
+ const [command, ...rest] = args;
248
+ try {
249
+ switch (command) {
250
+ case undefined:
251
+ case "help":
252
+ case "--help": {
253
+ io.stdout.write(USAGE);
254
+ return command === undefined ? 1 : 0;
255
+ }
256
+ case "status": {
257
+ const parsed = parseCliFlags(rest);
258
+ const report = await runLocationStatus(deps);
259
+ if (parsed.flags.has("--json")) {
260
+ io.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
261
+ return 0;
262
+ }
263
+ io.stdout.write(renderStatus(report));
264
+ return 0;
265
+ }
266
+ case "check": {
267
+ const results = await runLocationCheck(deps);
268
+ for (const result of results) {
269
+ const skipped = result.skipped === undefined ? "" : ` (skipped: ${result.skipped})`;
270
+ io.stdout.write(
271
+ `${result.id}: ${result.ok ? "OK" : "FAILED"}${skipped}${result.detail ? ` — ${result.detail}` : ""}\n`,
272
+ );
273
+ }
274
+ return results.every((result) => result.ok) ? 0 : 1;
275
+ }
276
+ case "sync": {
277
+ const parsed = parseCliFlags(rest);
278
+ if (parsed.positional.length > 0) {
279
+ throw new EngramAccessInputError(
280
+ `location: unexpected argument '${parsed.positional[0]}' — sync takes flags only`,
281
+ );
282
+ }
283
+ const daysValue = flagString(parsed, "--days");
284
+ const runs = await runLocationSync(deps, {
285
+ endDate: flagString(parsed, "--date"),
286
+ ...(daysValue !== undefined ? { days: Number(daysValue) } : {}),
287
+ });
288
+ if (parsed.flags.has("--json")) {
289
+ io.stdout.write(`${JSON.stringify({ days: runs }, null, 2)}\n`);
290
+ } else {
291
+ renderRuns(io, runs);
292
+ }
293
+ return anySourceFailed(runs) ? 1 : 0;
294
+ }
295
+ case "backfill": {
296
+ const parsed = parseCliFlags(rest);
297
+ const range = parseLocationBackfillRange(flagString(parsed, "--from"), flagString(parsed, "--to"));
298
+ const runs = await runLocationSync(deps, range);
299
+ if (parsed.flags.has("--json")) {
300
+ io.stdout.write(`${JSON.stringify({ days: runs }, null, 2)}\n`);
301
+ } else {
302
+ renderRuns(io, runs);
303
+ }
304
+ return anySourceFailed(runs) ? 1 : 0;
305
+ }
306
+ case "day": {
307
+ const parsed = parseCliFlags(rest);
308
+ const date = parsed.positional[0] ?? flagString(parsed, "--date");
309
+ const view = await runLocationDay(deps.memoryDir, date);
310
+ if (!view.found) {
311
+ io.stderr.write(`No stored location day for ${view.date}.\n`);
312
+ return 1;
313
+ }
314
+ if (parsed.flags.has("--json")) {
315
+ io.stdout.write(`${JSON.stringify(view, null, 2)}\n`);
316
+ return 0;
317
+ }
318
+ io.stdout.write(`${view.body}\n`);
319
+ return 0;
320
+ }
321
+ default:
322
+ io.stderr.write(`location: unknown command '${command}'\n${USAGE}`);
323
+ return 1;
324
+ }
325
+ } catch (err) {
326
+ io.stderr.write(`${err instanceof Error ? err.message : String(err)}\n`);
327
+ return 1;
328
+ }
329
+ }
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Day-summary cron model resolution (extracted from
3
+ * orchestration/maintenance.ts in #2047 so that capped file keeps only
4
+ * scheduling wiring). Pure function of config — no I/O.
5
+ */
6
+
7
+ import type { PluginConfig } from "../types.js";
8
+
9
+ /**
10
+ * Resolve the cron-routing model + fallback chain. Only in gateway mode is
11
+ * summaryModel routable as an OpenClaw agentTurn model; in plugin mode it is
12
+ * a direct-client model id for Remnic's own LLM calls. Task-chain fallbacks
13
+ * attach only when the model matches the task-chain primary (a distinct
14
+ * override's fallbacks would be unrelated); gateway default models are
15
+ * appended as tail fallbacks (de-duped) so a task-chain outage doesn't stop
16
+ * the cron before reaching the gateway default chain.
17
+ */
18
+ export function resolveDaySummaryCronModel(config: PluginConfig): {
19
+ model?: string;
20
+ fallbacks: string[];
21
+ } {
22
+ const rawSummaryModel = config.summaryModel;
23
+ const taskPrimary = config.taskModelChain?.primary;
24
+ const isGateway = config.modelSource === "gateway";
25
+ const model = isGateway ? rawSummaryModel || taskPrimary || undefined : undefined;
26
+ const fallbacks: string[] = [];
27
+ if (model && taskPrimary && model === taskPrimary) {
28
+ const seen = new Set<string>(model ? [model] : []);
29
+ const addUnique = (value: string | undefined) => {
30
+ if (typeof value !== "string") return;
31
+ const trimmed = value.trim();
32
+ if (trimmed.length > 0 && !seen.has(trimmed)) {
33
+ seen.add(trimmed);
34
+ fallbacks.push(trimmed);
35
+ }
36
+ };
37
+ for (const fb of config.taskModelChain?.fallbacks ?? []) addUnique(fb);
38
+ const gwDefaults = config.gatewayConfig?.agents?.defaults?.model;
39
+ addUnique(gwDefaults?.primary);
40
+ if (Array.isArray(gwDefaults?.fallbacks)) {
41
+ for (const fb of gwDefaults.fallbacks) addUnique(fb);
42
+ }
43
+ }
44
+ return { ...(model ? { model } : {}), fallbacks };
45
+ }
@@ -23,6 +23,8 @@ export const MCP_READ_ONLY_TOOL_SUFFIXES: Readonly<Record<string, true>> = {
23
23
  transcript_day: true,
24
24
  transcript_search: true,
25
25
  transcript_memories: true,
26
+ location_status: true,
27
+ location_day: true,
26
28
  meetings_list: true,
27
29
  meetings_get: true,
28
30
  action_confidence: true,
@@ -78,3 +78,31 @@ export function evaluateMemoryActionPolicy(input: {
78
78
  eligibility,
79
79
  };
80
80
  }
81
+
82
+ /**
83
+ * Gate for active-context SUMMARY/FILTER plans (issue #2347). The single
84
+ * deny rule is the shared `contextCompressionActionsEnabled` gate — a closed
85
+ * gate returns `feature_disabled` before any selection or model work. LLM
86
+ * summaries carry their own cap gate (`activeContextTransformLlmEnabled`)
87
+ * resolved at plan time, not here.
88
+ */
89
+ export interface ActiveContextTransformPolicyResult {
90
+ decision: "allow" | "deny";
91
+ rationale: string;
92
+ }
93
+
94
+ export function evaluateActiveContextTransformPolicy(options: {
95
+ actionsEnabled: boolean;
96
+ operation: "SUMMARY" | "FILTER";
97
+ }): ActiveContextTransformPolicyResult {
98
+ if (!options.actionsEnabled) {
99
+ return {
100
+ decision: "deny",
101
+ rationale: "contextCompressionActionsEnabled=false",
102
+ };
103
+ }
104
+ return {
105
+ decision: "allow",
106
+ rationale: `${options.operation.toLowerCase()}_eligible`,
107
+ };
108
+ }
@@ -1,14 +1,15 @@
1
- import test from "node:test";
2
1
  import assert from "node:assert/strict";
2
+ import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
3
3
  import os from "node:os";
4
4
  import path from "node:path";
5
- import { mkdtemp, mkdir, rm, writeFile } from "node:fs/promises";
5
+ import test from "node:test";
6
6
 
7
- import { StorageManager } from "./storage.js";
8
7
  import {
9
- recordMemoryOutcome,
10
8
  memoryWorthOutcomeEligibleCategories,
9
+ recordMemoryOutcome,
10
+ toMemoryOutcomeObservation,
11
11
  } from "./memory-worth-outcomes.js";
12
+ import { StorageManager } from "./storage.js";
12
13
 
13
14
  /**
14
15
  * Issue #560 PR 3 — tests for the outcome signal pipeline.
@@ -27,7 +28,7 @@ import {
27
28
  async function writeFactFile(
28
29
  storage: StorageManager,
29
30
  body: string,
30
- extraFrontmatterLines: string[] = [],
31
+ extraFrontmatterLines: string[] = []
31
32
  ): Promise<{ id: string; filePath: string }> {
32
33
  const today = new Date().toISOString().slice(0, 10);
33
34
  const id = `fact-${Date.now()}-${Math.random().toString(36).slice(2)}`;
@@ -51,10 +52,7 @@ async function writeFactFile(
51
52
  return { id, filePath };
52
53
  }
53
54
 
54
- async function writeCorrectionFile(
55
- storage: StorageManager,
56
- body: string,
57
- ): Promise<{ id: string; filePath: string }> {
55
+ async function writeCorrectionFile(storage: StorageManager, body: string): Promise<{ id: string; filePath: string }> {
58
56
  const id = `correction-${Date.now()}-${Math.random().toString(36).slice(2)}`;
59
57
  const lines = [
60
58
  "---",
@@ -68,10 +66,7 @@ async function writeCorrectionFile(
68
66
  "tags: []",
69
67
  "---",
70
68
  ];
71
- const correctionsDir = path.join(
72
- (storage as unknown as { baseDir: string }).baseDir,
73
- "corrections",
74
- );
69
+ const correctionsDir = path.join((storage as unknown as { baseDir: string }).baseDir, "corrections");
75
70
  await mkdir(correctionsDir, { recursive: true });
76
71
  const filePath = path.join(correctionsDir, `${id}.md`);
77
72
  await writeFile(filePath, `${lines.join("\n")}\n\n${body}\n`, "utf-8");
@@ -140,10 +135,7 @@ test("consecutive outcomes accumulate independently", async () => {
140
135
  try {
141
136
  const storage = new StorageManager(dir);
142
137
  await storage.ensureDirectories();
143
- const { id, filePath } = await writeFactFile(storage, "Accumulating outcomes.", [
144
- "mw_success: 2",
145
- "mw_fail: 0",
146
- ]);
138
+ const { id, filePath } = await writeFactFile(storage, "Accumulating outcomes.", ["mw_success: 2", "mw_fail: 0"]);
147
139
 
148
140
  await recordMemoryOutcome(storage, { memoryPath: filePath, outcome: "success" });
149
141
  await recordMemoryOutcome(storage, { memoryPath: filePath, outcome: "failure" });
@@ -289,7 +281,7 @@ test("concurrent outcomes for the same memory do NOT lose updates", async () =>
289
281
 
290
282
  const N = 10;
291
283
  const calls = Array.from({ length: N }, () =>
292
- recordMemoryOutcome(storage, { memoryPath: filePath, outcome: "success" }),
284
+ recordMemoryOutcome(storage, { memoryPath: filePath, outcome: "success" })
293
285
  );
294
286
  const results = await Promise.all(calls);
295
287
 
@@ -318,3 +310,46 @@ test("eligible-category set is exactly {fact, procedure}", () => {
318
310
  assert.ok(eligible.has("fact"));
319
311
  assert.ok(eligible.has("procedure"));
320
312
  });
313
+
314
+ // ---------------------------------------------------------------------------
315
+ // Issue #2345 — pure MemoryOutcomeObservation view (no writes, no counters)
316
+ // ---------------------------------------------------------------------------
317
+
318
+ test("outcome facts with time and join data become observations", () => {
319
+ const view = toMemoryOutcomeObservation({
320
+ memoryId: "fact-1",
321
+ namespace: "test-ns",
322
+ outcome: "success",
323
+ observedAt: "2026-08-12T00:00:00.000Z",
324
+ joinId: "act-1",
325
+ });
326
+ assert.equal(view.status, "observed");
327
+ if (view.status === "observed") {
328
+ assert.equal(view.observation.schemaVersion, 1);
329
+ assert.equal(view.observation.observedAt, "2026-08-12T00:00:00.000Z");
330
+ assert.equal(view.observation.joinId, "act-1");
331
+ // Round-trips through public types (undefined optionals drop in JSON).
332
+ const roundTripped = JSON.parse(JSON.stringify(view.observation)) as Record<string, unknown>;
333
+ assert.equal(roundTripped.schemaVersion, 1);
334
+ assert.equal(roundTripped.memoryId, "fact-1");
335
+ assert.equal(roundTripped.joinId, "act-1");
336
+ }
337
+ });
338
+
339
+ test("counter-only rows stay missing_observation and never guess an action", () => {
340
+ const noTime = toMemoryOutcomeObservation({
341
+ memoryId: "fact-1",
342
+ namespace: "test-ns",
343
+ outcome: "success",
344
+ joinId: "act-1",
345
+ });
346
+ assert.deepEqual(noTime, { status: "missing_observation", memoryId: "fact-1", reason: "missing_observed_at" });
347
+
348
+ const noJoin = toMemoryOutcomeObservation({
349
+ memoryId: "fact-2",
350
+ namespace: "test-ns",
351
+ outcome: "failure",
352
+ observedAt: new Date("2026-08-12T00:00:00.000Z"),
353
+ });
354
+ assert.deepEqual(noJoin, { status: "missing_observation", memoryId: "fact-2", reason: "missing_join_data" });
355
+ });
@@ -86,7 +86,7 @@ function runSerialized<T>(key: string, task: () => Promise<T>): Promise<T> {
86
86
  },
87
87
  () => {
88
88
  if (outcomeLocks.get(key) === next) outcomeLocks.delete(key);
89
- },
89
+ }
90
90
  )
91
91
  .catch(() => {
92
92
  // Defensive no-op in case a hook inside the cleanup branches throws.
@@ -104,8 +104,10 @@ function runSerialized<T>(key: string, task: () => Promise<T>): Promise<T> {
104
104
  * imports from this file's peers. The two constants are validated by a
105
105
  * test to stay in lockstep.
106
106
  */
107
- const MEMORY_WORTH_OUTCOME_ELIGIBLE_CATEGORIES: ReadonlySet<MemoryFrontmatter["category"]> =
108
- new Set(["fact", "procedure"]);
107
+ const MEMORY_WORTH_OUTCOME_ELIGIBLE_CATEGORIES: ReadonlySet<MemoryFrontmatter["category"]> = new Set([
108
+ "fact",
109
+ "procedure",
110
+ ]);
109
111
 
110
112
  /**
111
113
  * Exported so downstream tests / operators can query the allowlist without
@@ -170,11 +172,7 @@ export type RecordMemoryOutcomeResult =
170
172
  }
171
173
  | {
172
174
  ok: false;
173
- reason:
174
- | "not_found"
175
- | "ineligible_category"
176
- | "invalid_outcome"
177
- | "invalid_path";
175
+ reason: "not_found" | "ineligible_category" | "invalid_outcome" | "invalid_path";
178
176
  message: string;
179
177
  };
180
178
 
@@ -208,7 +206,7 @@ function memoryIdFromPath(memoryPath: string): string | null {
208
206
  */
209
207
  export async function recordMemoryOutcome(
210
208
  storage: StorageManager,
211
- input: RecordMemoryOutcomeInput,
209
+ input: RecordMemoryOutcomeInput
212
210
  ): Promise<RecordMemoryOutcomeResult> {
213
211
  if (input.outcome !== "success" && input.outcome !== "failure") {
214
212
  return {
@@ -288,3 +286,87 @@ export async function recordMemoryOutcome(
288
286
  };
289
287
  });
290
288
  }
289
+
290
+ // ---------------------------------------------------------------------------
291
+ // Issue #2345 — pure outcome-observation view (no writes, no counter changes)
292
+ // ---------------------------------------------------------------------------
293
+
294
+ /**
295
+ * A Memory Worth outcome that carries WHEN it was observed and WHAT it can
296
+ * join to — the facts the trajectory evaluator needs and plain counter rows
297
+ * lack. `mw_success` / `mw_fail` totals have no timestamp or join ID, so they
298
+ * cannot participate in delayed action-to-outcome joins.
299
+ */
300
+ export interface MemoryOutcomeObservation {
301
+ schemaVersion: 1;
302
+ memoryId: string;
303
+ namespace: string;
304
+ outcome: MemoryOutcomeKind;
305
+ observedAt: string;
306
+ /** Stable join key shared with the action side (never free text). */
307
+ joinId?: string;
308
+ sessionKey?: string;
309
+ }
310
+
311
+ /**
312
+ * Discriminated view over outcome facts a caller can supply.
313
+ *
314
+ * - `missing_observation` — counter-only or incomplete rows. The evaluator
315
+ * must never guess the action behind an aggregate counter, so these stay
316
+ * visible as missing rather than being inferred.
317
+ */
318
+ export type MemoryOutcomeObservationView =
319
+ | { status: "observed"; observation: MemoryOutcomeObservation }
320
+ | { status: "missing_observation"; memoryId: string; reason: "missing_observed_at" | "missing_join_data" };
321
+
322
+ const OBSERVATION_ISO_RE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;
323
+
324
+ /**
325
+ * Build the pure observation view. Accepts exactly what a caller already
326
+ * knows; performs no storage reads and no writes, and does not alter the
327
+ * counter path — `recordMemoryOutcome` keeps its current behavior.
328
+ */
329
+ export function toMemoryOutcomeObservation(raw: {
330
+ memoryId: string;
331
+ namespace: string;
332
+ outcome: MemoryOutcomeKind;
333
+ observedAt?: unknown;
334
+ joinId?: unknown;
335
+ sessionKey?: unknown;
336
+ }): MemoryOutcomeObservationView {
337
+ if (
338
+ typeof raw.memoryId !== "string" ||
339
+ raw.memoryId.length === 0 ||
340
+ typeof raw.namespace !== "string" ||
341
+ raw.namespace.length === 0 ||
342
+ (raw.outcome !== "success" && raw.outcome !== "failure")
343
+ ) {
344
+ throw new Error("toMemoryOutcomeObservation requires memoryId, namespace, and outcome");
345
+ }
346
+ const observedAt =
347
+ typeof raw.observedAt === "string" && OBSERVATION_ISO_RE.test(raw.observedAt)
348
+ ? raw.observedAt
349
+ : raw.observedAt instanceof Date
350
+ ? raw.observedAt.toISOString()
351
+ : null;
352
+ if (observedAt === null) {
353
+ return { status: "missing_observation", memoryId: raw.memoryId, reason: "missing_observed_at" };
354
+ }
355
+ const joinId = typeof raw.joinId === "string" && raw.joinId.length > 0 ? raw.joinId : undefined;
356
+ const sessionKey = typeof raw.sessionKey === "string" && raw.sessionKey.length > 0 ? raw.sessionKey : undefined;
357
+ if (joinId === undefined && sessionKey === undefined) {
358
+ return { status: "missing_observation", memoryId: raw.memoryId, reason: "missing_join_data" };
359
+ }
360
+ return {
361
+ status: "observed",
362
+ observation: {
363
+ schemaVersion: 1,
364
+ memoryId: raw.memoryId,
365
+ namespace: raw.namespace,
366
+ outcome: raw.outcome,
367
+ observedAt,
368
+ joinId,
369
+ sessionKey,
370
+ },
371
+ };
372
+ }