@remnic/core 9.65.7 → 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 (512) hide show
  1. package/dist/access-admin-ops-surface.d.ts +15 -13
  2. package/dist/access-admin-ops-surface.js +42 -42
  3. package/dist/access-authorization-probe.d.ts +15 -13
  4. package/dist/access-authorization-probe.js +43 -43
  5. package/dist/access-boundary.d.ts +15 -13
  6. package/dist/access-boundary.js +42 -42
  7. package/dist/access-cli.js +143 -140
  8. package/dist/access-cli.js.map +1 -1
  9. package/dist/access-coding-context-resolution.d.ts +2 -1
  10. package/dist/access-extraction-force-flush.d.ts +15 -13
  11. package/dist/access-extraction-force-flush.js +42 -42
  12. package/dist/access-health-types.d.ts +2 -1
  13. package/dist/access-http-lcm-compaction.d.ts +15 -13
  14. package/dist/access-http-lifecycle-flush.d.ts +15 -13
  15. package/dist/access-http-offline-stream.d.ts +15 -13
  16. package/dist/access-http-query.d.ts +3 -2
  17. package/dist/access-http-query.js +44 -44
  18. package/dist/access-http.d.ts +16 -14
  19. package/dist/access-http.js +59 -59
  20. package/dist/access-identity-continuity-surface.d.ts +13 -11
  21. package/dist/access-identity-continuity-surface.js +42 -42
  22. package/dist/access-lcm-surface.d.ts +15 -13
  23. package/dist/access-lcm-surface.js +42 -42
  24. package/dist/access-mcp.d.ts +15 -13
  25. package/dist/access-mcp.js +49 -49
  26. package/dist/access-memory-search-fanout.d.ts +3 -2
  27. package/dist/{access-namespace-preflight-8VYKmRX0.d.ts → access-namespace-preflight-CpAOrS-9.d.ts} +1 -1
  28. package/dist/access-namespace-preflight.d.ts +4 -3
  29. package/dist/access-namespace-preflight.js +42 -42
  30. package/dist/access-observe-write-surface.d.ts +15 -13
  31. package/dist/access-observe-write-surface.js +42 -42
  32. package/dist/access-offline-manifest.d.ts +13 -11
  33. package/dist/access-offline-manifest.js +6 -6
  34. package/dist/access-operations-batch.js +45 -45
  35. package/dist/access-operations.d.ts +20 -18
  36. package/dist/access-operations.js +48 -48
  37. package/dist/access-recall-concurrency.d.ts +15 -13
  38. package/dist/access-recall-concurrency.js +42 -42
  39. package/dist/access-recall-response.d.ts +15 -13
  40. package/dist/access-recall-response.js +42 -42
  41. package/dist/access-recall-surface.d.ts +15 -13
  42. package/dist/access-recall-surface.js +42 -42
  43. package/dist/access-schema.d.ts +83 -83
  44. package/dist/{access-service-Crk__Git.d.ts → access-service-Diu61Cfv.d.ts} +71 -71
  45. package/dist/access-service-helpers.d.ts +15 -13
  46. package/dist/access-service.d.ts +15 -13
  47. package/dist/access-service.js +42 -42
  48. package/dist/access-surface-catalog.d.ts +15 -13
  49. package/dist/access-surface-catalog.js +44 -44
  50. package/dist/access-wearables-meetings-surface.d.ts +6 -3
  51. package/dist/action-confidence.d.ts +2 -1
  52. package/dist/active-context-config.d.ts +27 -0
  53. package/dist/active-context-config.js +14 -0
  54. package/dist/active-context-transform.d.ts +267 -0
  55. package/dist/active-context-transform.js +31 -0
  56. package/dist/active-context-transform.js.map +1 -0
  57. package/dist/active-memory-bridge.d.ts +2 -1
  58. package/dist/active-recall.d.ts +2 -1
  59. package/dist/active-recall.js +10 -9
  60. package/dist/active-recall.js.map +1 -1
  61. package/dist/adapters/index.js +7 -7
  62. package/dist/adapters/registry.js +3 -3
  63. package/dist/ambient-provenance.d.ts +2 -1
  64. package/dist/artifact-search.d.ts +2 -1
  65. package/dist/{auto-sync-XVMLL2RH.js → auto-sync-2YPITIWN.js} +6 -6
  66. package/dist/behavior-learner.d.ts +2 -1
  67. package/dist/behavior-signals.d.ts +2 -1
  68. package/dist/bootstrap.d.ts +13 -11
  69. package/dist/briefing-window.d.ts +5 -2
  70. package/dist/briefing.d.ts +5 -2
  71. package/dist/briefing.js +23 -23
  72. package/dist/buffer-surprise-report.d.ts +2 -1
  73. package/dist/buffer-turn-helpers.d.ts +2 -1
  74. package/dist/buffer.d.ts +5 -2
  75. package/dist/buffer.js +6 -6
  76. package/dist/bulk-import/index.d.ts +4 -3
  77. package/dist/calibration.d.ts +2 -1
  78. package/dist/capabilities.d.ts +2 -1
  79. package/dist/{catalog-DybwVNW3.d.ts → catalog-9f-vEQLS.d.ts} +1 -1
  80. package/dist/causal-behavior.d.ts +4 -3
  81. package/dist/causal-consolidation.d.ts +2 -1
  82. package/dist/causal-consolidation.js +24 -24
  83. package/dist/causal-trajectory-graph.d.ts +2 -1
  84. package/dist/{chunk-JBPKEARU.js → chunk-2QSZNTDO.js} +7 -7
  85. package/dist/{chunk-S3K2CIK5.js → chunk-3A2NJP2U.js} +2 -2
  86. package/dist/{chunk-OPGL46PX.js → chunk-3PKAS6VL.js} +2 -2
  87. package/dist/{chunk-GTSVEEP3.js → chunk-3SZD4CYO.js} +3 -3
  88. package/dist/chunk-43HUVDTD.js +114 -0
  89. package/dist/chunk-43HUVDTD.js.map +1 -0
  90. package/dist/{chunk-YKWFK7XA.js → chunk-4F4AQFWL.js} +7 -7
  91. package/dist/{chunk-RGCF4XNH.js → chunk-4QEYREAV.js} +9 -9
  92. package/dist/{chunk-46WM6JX2.js → chunk-4ZWCQJNM.js} +5 -5
  93. package/dist/{chunk-DVYRD4HY.js → chunk-5ACCD4L7.js} +30 -1
  94. package/dist/chunk-5ACCD4L7.js.map +1 -0
  95. package/dist/{chunk-3RI5Y7KU.js → chunk-5DHKCO52.js} +2 -2
  96. package/dist/{chunk-VKCAHCBI.js → chunk-5RWZH6PH.js} +2 -2
  97. package/dist/{chunk-52II7PB6.js → chunk-645WOU5I.js} +4 -4
  98. package/dist/{chunk-A32YEQAM.js → chunk-76DIF5KT.js} +2 -2
  99. package/dist/{chunk-OPPBTPUU.js → chunk-7KQB4EBS.js} +4 -4
  100. package/dist/{chunk-I2HTKOOP.js → chunk-7VZFRUQU.js} +3 -3
  101. package/dist/{chunk-D4QVPP3G.js → chunk-7WOWGRAU.js} +10 -6
  102. package/dist/chunk-7WOWGRAU.js.map +1 -0
  103. package/dist/{chunk-JCWY73FK.js → chunk-AHPIFKNG.js} +2 -2
  104. package/dist/{chunk-IP4ZNT4U.js → chunk-AZMLH5UT.js} +2 -2
  105. package/dist/chunk-B32WYRXX.js +77 -0
  106. package/dist/chunk-B32WYRXX.js.map +1 -0
  107. package/dist/{chunk-JOEJG4SD.js → chunk-BEC4YBNA.js} +4 -4
  108. package/dist/{chunk-VXVZ2GM3.js → chunk-CAMNRAJF.js} +2 -2
  109. package/dist/{chunk-C24UZSFW.js → chunk-CEH2AFXG.js} +6 -6
  110. package/dist/{chunk-YOXVZJFM.js → chunk-CFVTRUR3.js} +2 -2
  111. package/dist/{chunk-SVSRPG6M.js → chunk-CPA5NBHN.js} +2 -2
  112. package/dist/{chunk-7BEPVIH3.js → chunk-CRML27CO.js} +3 -3
  113. package/dist/{chunk-IY7UXD3J.js → chunk-DA7ITC5Z.js} +2 -2
  114. package/dist/{chunk-AFR6AIM4.js → chunk-DEACDKE3.js} +3 -3
  115. package/dist/{chunk-NG3MBQV4.js → chunk-DPCXDG7G.js} +2 -2
  116. package/dist/{chunk-HZNYJN77.js → chunk-F3NVYTTA.js} +2 -2
  117. package/dist/{chunk-PDDSFELN.js → chunk-F7XUD3PL.js} +2 -2
  118. package/dist/{chunk-YWSQD2IB.js → chunk-GTO56JY5.js} +2 -2
  119. package/dist/{chunk-RAIUTAZZ.js → chunk-H2YSH3DG.js} +2 -2
  120. package/dist/{chunk-F6QHHRWP.js → chunk-HMZKGHMD.js} +2 -2
  121. package/dist/{chunk-ZIJDI4CP.js → chunk-HRHO3ZNG.js} +2 -2
  122. package/dist/{chunk-SDEPLF7V.js → chunk-IBJ6U753.js} +2 -2
  123. package/dist/{chunk-T3JQTCCO.js → chunk-JI7U6AS3.js} +4 -4
  124. package/dist/{chunk-TR7DGXGI.js → chunk-JOZUBF4A.js} +5 -5
  125. package/dist/{chunk-I7EX6KSH.js → chunk-JYSN42VN.js} +55 -55
  126. package/dist/{chunk-ZPUIRTIZ.js → chunk-KOLJJN5G.js} +12 -75
  127. package/dist/chunk-KOLJJN5G.js.map +1 -0
  128. package/dist/{chunk-FMQ4MOQO.js → chunk-KZIF6XHX.js} +14 -14
  129. package/dist/chunk-LB7WCZHY.js +553 -0
  130. package/dist/chunk-LB7WCZHY.js.map +1 -0
  131. package/dist/{chunk-RIAM7DND.js → chunk-LDKPDODJ.js} +2 -2
  132. package/dist/{chunk-227UFSEQ.js → chunk-LEPOP46W.js} +4 -4
  133. package/dist/{chunk-LLQCM2U2.js → chunk-LKYIOCWL.js} +101 -101
  134. package/dist/{chunk-5S4LQOPE.js → chunk-LOXHYCVS.js} +2 -2
  135. package/dist/{chunk-ANJXPFRS.js → chunk-LPNCR4QK.js} +8 -8
  136. package/dist/{chunk-GEPACVWN.js → chunk-MDD2RINF.js} +2 -2
  137. package/dist/{chunk-H63EDPFJ.js → chunk-MI2OTWV5.js} +15 -2
  138. package/dist/{chunk-H63EDPFJ.js.map → chunk-MI2OTWV5.js.map} +1 -1
  139. package/dist/{chunk-LBFFNDFM.js → chunk-MINHJ55X.js} +1 -1
  140. package/dist/chunk-MINHJ55X.js.map +1 -0
  141. package/dist/{chunk-6CPUQ5D6.js → chunk-MY2BC6UE.js} +13 -13
  142. package/dist/{chunk-CFGU52XJ.js → chunk-NPFUNWNX.js} +2 -2
  143. package/dist/{chunk-MFOSZUIT.js → chunk-NPIBN2VL.js} +2 -2
  144. package/dist/{chunk-5DH6PG4B.js → chunk-OA2O2GJ4.js} +3 -3
  145. package/dist/{chunk-JAQXUGLN.js → chunk-ODU2CNNX.js} +2 -2
  146. package/dist/{chunk-RQE4TITU.js → chunk-OXRRJXPR.js} +32 -32
  147. package/dist/{chunk-SEA6M7SS.js → chunk-P36Z4JRA.js} +2 -2
  148. package/dist/{chunk-Z4U3UN56.js → chunk-PU56CXZA.js} +6 -6
  149. package/dist/{chunk-5VPQSRQO.js → chunk-S5XOSTYM.js} +3 -3
  150. package/dist/{chunk-SVVIASVX.js → chunk-SEEJOGQX.js} +5 -5
  151. package/dist/{chunk-7TCGNUVP.js → chunk-SNOIKAHM.js} +2 -2
  152. package/dist/{chunk-7F27PCSN.js → chunk-T6ILXUAH.js} +2 -2
  153. package/dist/{chunk-EOHKUWXW.js → chunk-T7XP6IZE.js} +2 -2
  154. package/dist/{chunk-7WR462EM.js → chunk-TFR3HG4K.js} +3 -3
  155. package/dist/{chunk-YRVAKONL.js → chunk-TUHBYJXL.js} +1 -1
  156. package/dist/{chunk-F635GAL7.js → chunk-U7EW2W4W.js} +10 -10
  157. package/dist/{chunk-VFYRYFLL.js → chunk-UEBDCMOO.js} +2 -2
  158. package/dist/{chunk-WTOZBZNN.js → chunk-UENKPWCS.js} +4 -4
  159. package/dist/{chunk-AAXJNINV.js → chunk-UL4MKZHI.js} +2 -2
  160. package/dist/{chunk-R2MZCYA6.js → chunk-UNUMFURP.js} +3 -3
  161. package/dist/{chunk-ACOC27BB.js → chunk-UPFNQJC7.js} +2 -2
  162. package/dist/{chunk-W4BMEGQA.js → chunk-UTQUEHC7.js} +2 -2
  163. package/dist/{chunk-I32NKXE2.js → chunk-V4IDF3EZ.js} +2 -2
  164. package/dist/{chunk-BJTHRFFC.js → chunk-W2BAGGEW.js} +51 -19
  165. package/dist/chunk-W2BAGGEW.js.map +1 -0
  166. package/dist/{chunk-ZAOHJDKH.js → chunk-WNXYT4MK.js} +3 -3
  167. package/dist/{chunk-T42L3S6A.js → chunk-XBGHAAKR.js} +2 -2
  168. package/dist/{chunk-I4343FIA.js → chunk-XNWXSGHS.js} +4 -4
  169. package/dist/{chunk-THG4GYIE.js → chunk-YEUXERJ6.js} +5 -5
  170. package/dist/{chunk-EZ25VE3G.js → chunk-YNDLCWXS.js} +4 -4
  171. package/dist/{chunk-5HERQ5FX.js → chunk-Z3YEGSR4.js} +10 -10
  172. package/dist/{cli-B322UMvB.d.ts → cli-O3F-ht3i.d.ts} +5 -5
  173. package/dist/cli.d.ts +17 -15
  174. package/dist/cli.js +92 -91
  175. package/dist/coding/pre-action-gate.d.ts +2 -1
  176. package/dist/compounding/engine.d.ts +5 -2
  177. package/dist/compounding/engine.js +24 -24
  178. package/dist/compounding/preference-consolidator.d.ts +4 -3
  179. package/dist/compression-optimizer.d.ts +2 -1
  180. package/dist/config-security.js +2 -2
  181. package/dist/config.d.ts +2 -1
  182. package/dist/config.js +10 -9
  183. package/dist/connectors/codex-materialize-runner.d.ts +2 -1
  184. package/dist/connectors/codex-materialize-runner.js +23 -23
  185. package/dist/connectors/codex-materialize.d.ts +2 -1
  186. package/dist/connectors/index.d.ts +2 -1
  187. package/dist/connectors/index.js +23 -23
  188. package/dist/consolidation-provenance-check.d.ts +5 -2
  189. package/dist/consolidation-provenance-check.js +2 -2
  190. package/dist/consolidation-undo.d.ts +5 -2
  191. package/dist/context-summary.d.ts +43 -0
  192. package/dist/context-summary.js +14 -0
  193. package/dist/context-summary.js.map +1 -0
  194. package/dist/contradiction/index.d.ts +6 -3
  195. package/dist/contradiction/index.js +5 -5
  196. package/dist/converge-config.d.ts +2 -1
  197. package/dist/convergence-refresh.d.ts +5 -2
  198. package/dist/convergence-refresh.js +26 -26
  199. package/dist/conversation-index/backend.d.ts +2 -1
  200. package/dist/conversation-index/backend.js +2 -2
  201. package/dist/conversation-index/chunker.d.ts +2 -1
  202. package/dist/conversation-index/faiss-adapter.d.ts +2 -1
  203. package/dist/conversation-index/indexer.d.ts +2 -1
  204. package/dist/conversation-index/search.d.ts +2 -1
  205. package/dist/corpus-watermark.d.ts +2 -1
  206. package/dist/corpus-watermark.js +25 -25
  207. package/dist/cross-lingual-recall.d.ts +2 -1
  208. package/dist/dashboard-runtime.js +2 -2
  209. package/dist/day-summary.d.ts +2 -1
  210. package/dist/delinearize.d.ts +2 -1
  211. package/dist/dependency-propagation-config.d.ts +2 -1
  212. package/dist/{dependency-propagation-delivery-BGcNairQ.d.ts → dependency-propagation-delivery-CL6RWXTA.d.ts} +1 -1
  213. package/dist/direct-answer-wiring.d.ts +2 -1
  214. package/dist/direct-answer.d.ts +2 -1
  215. package/dist/embedding-fallback.d.ts +2 -1
  216. package/dist/enrichment/index.d.ts +2 -1
  217. package/dist/entity-origin-fields.d.ts +2 -1
  218. package/dist/entity-retrieval.d.ts +5 -2
  219. package/dist/entity-retrieval.js +24 -24
  220. package/dist/entity-schema.d.ts +2 -1
  221. package/dist/episodic-context.d.ts +2 -1
  222. package/dist/eval-trajectory-contracts.d.ts +2 -1
  223. package/dist/eval-trajectory-store.d.ts +2 -1
  224. package/dist/eval-trajectory.d.ts +2 -1
  225. package/dist/event-order-recall.js +3 -3
  226. package/dist/explicit-capture.d.ts +13 -11
  227. package/dist/explicit-capture.js +6 -6
  228. package/dist/external-wiki-access.d.ts +15 -13
  229. package/dist/external-wiki-access.js +43 -43
  230. package/dist/external-wiki-collection-registration.d.ts +2 -1
  231. package/dist/external-wiki-collection.d.ts +2 -1
  232. package/dist/external-wiki-mcp-tools.d.ts +15 -13
  233. package/dist/extraction-error-classification.d.ts +2 -1
  234. package/dist/extraction-faithfulness.d.ts +2 -1
  235. package/dist/extraction-judge-telemetry.d.ts +2 -1
  236. package/dist/extraction-judge-training.d.ts +2 -1
  237. package/dist/extraction-judge.d.ts +2 -1
  238. package/dist/extraction-liveness.d.ts +2 -1
  239. package/dist/extraction-normalization.d.ts +2 -1
  240. package/dist/extraction-prompt.d.ts +2 -1
  241. package/dist/extraction-source-grounding-rules.d.ts +2 -1
  242. package/dist/extraction-source-grounding.d.ts +2 -1
  243. package/dist/extraction.d.ts +2 -1
  244. package/dist/extraction.js +31 -31
  245. package/dist/fallback-llm.d.ts +2 -1
  246. package/dist/{forget-SZ2BXDGF.js → forget-2AE4MDK3.js} +3 -3
  247. package/dist/graph-dashboard-diff.d.ts +2 -1
  248. package/dist/graph-dashboard-key.d.ts +2 -1
  249. package/dist/graph-dashboard-parser.d.ts +2 -1
  250. package/dist/graph-edge-reinforcement.d.ts +2 -1
  251. package/dist/graph-path-reconstruction.d.ts +2 -1
  252. package/dist/graph-path-scoring.d.ts +2 -1
  253. package/dist/graph-snapshot.d.ts +2 -1
  254. package/dist/graph.d.ts +2 -1
  255. package/dist/harmonic-retrieval.js +1 -1
  256. package/dist/importance.d.ts +2 -1
  257. package/dist/importers/index.d.ts +2 -1
  258. package/dist/in-flight-reads.d.ts +2 -1
  259. package/dist/{index-By2QUAMh.d.ts → index-C7Xep6S9.d.ts} +2 -2
  260. package/dist/index.d.ts +703 -701
  261. package/dist/index.js +225 -196
  262. package/dist/intent.d.ts +2 -1
  263. package/dist/lcm/engine.d.ts +3 -2
  264. package/dist/lcm/engine.js +5 -4
  265. package/dist/lcm/index.d.ts +4 -2
  266. package/dist/lcm/index.js +12 -11
  267. package/dist/lcm/summarizer.d.ts +4 -6
  268. package/dist/lcm/summarizer.js +2 -1
  269. package/dist/lcm/tools.d.ts +4 -3
  270. package/dist/lifecycle.d.ts +2 -1
  271. package/dist/live-connectors-runner.d.ts +2 -1
  272. package/dist/local-llm.d.ts +2 -1
  273. package/dist/local-model-endpoint.d.ts +2 -1
  274. package/dist/maintenance/memory-governance.d.ts +2 -1
  275. package/dist/maintenance/memory-governance.js +24 -24
  276. package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +5 -2
  277. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +23 -23
  278. package/dist/maintenance/rebuild-memory-projection.d.ts +5 -2
  279. package/dist/maintenance/rebuild-memory-projection.js +25 -25
  280. package/dist/{maintenance-Dm2McrIx.d.ts → maintenance-CJ-xqFp0.d.ts} +3 -3
  281. package/dist/mcp-memory-inspector-app.d.ts +15 -13
  282. package/dist/memory-action-policy.d.ts +18 -2
  283. package/dist/memory-action-policy.js +3 -1
  284. package/dist/memory-cache.d.ts +2 -1
  285. package/dist/memory-controller.d.ts +2 -1
  286. package/dist/memory-controller.js +2 -2
  287. package/dist/memory-lifecycle-ledger-utils.d.ts +2 -1
  288. package/dist/memory-projection-store.d.ts +2 -1
  289. package/dist/memory-provenance.d.ts +2 -1
  290. package/dist/memory-snapshot.d.ts +2 -1
  291. package/dist/memory-subject-cli.d.ts +15 -13
  292. package/dist/memory-subject.d.ts +15 -13
  293. package/dist/memory-subject.js +3 -3
  294. package/dist/memory-worth-outcomes.d.ts +5 -2
  295. package/dist/models-json.d.ts +2 -1
  296. package/dist/namespaces/migrate.d.ts +6 -3
  297. package/dist/namespaces/migrate.js +24 -24
  298. package/dist/namespaces/principal.d.ts +2 -1
  299. package/dist/namespaces/search.d.ts +2 -1
  300. package/dist/namespaces/search.js +9 -9
  301. package/dist/namespaces/storage.d.ts +6 -3
  302. package/dist/namespaces/storage.js +23 -23
  303. package/dist/native-knowledge.d.ts +2 -1
  304. package/dist/offline-sync-impression-drain.d.ts +2 -1
  305. package/dist/offline-sync-impression-drain.js +2 -2
  306. package/dist/operator-doctor-corpus.d.ts +2 -1
  307. package/dist/operator-doctor-corpus.js +26 -26
  308. package/dist/operator-doctor-replica.d.ts +2 -1
  309. package/dist/operator-toolkit.d.ts +6 -3
  310. package/dist/operator-toolkit.js +38 -37
  311. package/dist/orchestration/compression-guideline-coordinator.d.ts +5 -2
  312. package/dist/orchestration/maintenance.d.ts +7 -4
  313. package/dist/orchestration/maintenance.js +31 -31
  314. package/dist/{orchestrator-Co1DyfuP.d.ts → orchestrator-BsntWxLy.d.ts} +8 -8
  315. package/dist/orchestrator.d.ts +13 -11
  316. package/dist/orchestrator.js +143 -140
  317. package/dist/patterns-cli.d.ts +2 -1
  318. package/dist/{pipeline-DotMnb6y.d.ts → pipeline-CVoysPm2.d.ts} +1 -1
  319. package/dist/policy-runtime.d.ts +2 -1
  320. package/dist/proactive-contention.d.ts +2 -1
  321. package/dist/provenance.d.ts +2 -1
  322. package/dist/{public-http-PJRtnSi-.d.ts → public-http-CuOxlTC2.d.ts} +1 -1
  323. package/dist/{qmd-BP0n11fR.d.ts → qmd-DWMAGA5l.d.ts} +1 -1
  324. package/dist/qmd-preflight.d.ts +3 -2
  325. package/dist/qmd-recall-cache.d.ts +2 -1
  326. package/dist/qmd.d.ts +3 -2
  327. package/dist/qmd.js +4 -4
  328. package/dist/recall-concurrency-config.d.ts +2 -1
  329. package/dist/recall-disclosure-escalation.d.ts +2 -1
  330. package/dist/recall-explain-renderer.d.ts +2 -1
  331. package/dist/recall-explain-renderer.js +3 -3
  332. package/dist/recall-memory-map.d.ts +2 -1
  333. package/dist/recall-planner-llm.d.ts +2 -1
  334. package/dist/recall-state.d.ts +2 -1
  335. package/dist/recall-tag-filter.d.ts +2 -1
  336. package/dist/recall-timings.d.ts +2 -1
  337. package/dist/recall-xray-cli.d.ts +2 -1
  338. package/dist/recall-xray-cli.js +4 -4
  339. package/dist/recall-xray-renderer.d.ts +2 -1
  340. package/dist/recall-xray-renderer.js +3 -3
  341. package/dist/recall-xray.d.ts +2 -1
  342. package/dist/recall-xray.js +2 -2
  343. package/dist/reconcile/cursor.d.ts +2 -1
  344. package/dist/reconcile/manifest.d.ts +2 -1
  345. package/dist/reconcile/manifest.js +3 -3
  346. package/dist/reconcile/plan.d.ts +2 -1
  347. package/dist/replay/normalizers/chatgpt.d.ts +2 -1
  348. package/dist/replay/normalizers/claude.d.ts +2 -1
  349. package/dist/replay/normalizers/openclaw.d.ts +2 -1
  350. package/dist/replay/normalizers/shared.d.ts +2 -1
  351. package/dist/replay/runner.d.ts +2 -1
  352. package/dist/replay/types.d.ts +2 -1
  353. package/dist/replica-divergence.d.ts +2 -1
  354. package/dist/replica-peers-config.d.ts +2 -1
  355. package/dist/{resolution-4552BNRV.js → resolution-XWBPKYFB.js} +6 -6
  356. package/dist/resolution-XWBPKYFB.js.map +1 -0
  357. package/dist/resolve-auth-token.d.ts +2 -1
  358. package/dist/resume-bundles.js +11 -10
  359. package/dist/retrieval-agents.d.ts +3 -2
  360. package/dist/retrieval-tiers.d.ts +2 -1
  361. package/dist/routing/engine.d.ts +2 -1
  362. package/dist/routing/store.d.ts +2 -1
  363. package/dist/salvage-envelope.d.ts +2 -1
  364. package/dist/salvage-envelope.js +5 -5
  365. package/dist/schemas.d.ts +124 -124
  366. package/dist/{scope-profiles-6ChZKTy-.d.ts → scope-profiles-CPWkW_dI.d.ts} +1 -1
  367. package/dist/search/embed-helper.d.ts +2 -1
  368. package/dist/search/factory.d.ts +2 -1
  369. package/dist/search/factory.js +8 -8
  370. package/dist/search/index.d.ts +2 -1
  371. package/dist/search/index.js +14 -14
  372. package/dist/search/lancedb-backend.d.ts +2 -1
  373. package/dist/search/meilisearch-backend.d.ts +2 -1
  374. package/dist/search/noop-backend.d.ts +2 -1
  375. package/dist/search/orama-backend.d.ts +2 -1
  376. package/dist/search/port.d.ts +2 -1
  377. package/dist/search/remote-backend.d.ts +2 -1
  378. package/dist/{semantic-consolidation-DziYcW5J.d.ts → semantic-consolidation-CNFVBXFc.d.ts} +1 -1
  379. package/dist/semantic-consolidation.d.ts +3 -2
  380. package/dist/semantic-consolidation.js +29 -29
  381. package/dist/semantic-rule-promotion.js +23 -23
  382. package/dist/semantic-rule-verifier.d.ts +2 -1
  383. package/dist/semantic-rule-verifier.js +23 -23
  384. package/dist/{service-C7rIBuK_.d.ts → service-Bb-JIdQ0.d.ts} +2 -2
  385. package/dist/session-observer-bands.d.ts +2 -1
  386. package/dist/session-observer-state.d.ts +2 -1
  387. package/dist/shared-context/manager.d.ts +8 -7
  388. package/dist/signal.d.ts +2 -1
  389. package/dist/source-agent-qualifier.d.ts +2 -1
  390. package/dist/source-agent-qualifier.js +27 -27
  391. package/dist/{storage-B1hEx8Xg.d.ts → storage-CukrlNKk.d.ts} +4 -1
  392. package/dist/storage.d.ts +5 -2
  393. package/dist/storage.js +22 -22
  394. package/dist/subject-config.d.ts +2 -1
  395. package/dist/subject-config.js +4 -4
  396. package/dist/summarizer.d.ts +2 -1
  397. package/dist/summary-snapshot.d.ts +2 -1
  398. package/dist/support-passport/index.d.ts +18 -16
  399. package/dist/support-passport/index.js +45 -45
  400. package/dist/temporal-supersession.d.ts +3 -2
  401. package/dist/temporal-timeline-recall.d.ts +2 -1
  402. package/dist/temporal-validity.d.ts +2 -1
  403. package/dist/threading.d.ts +2 -1
  404. package/dist/tier-migration.d.ts +5 -2
  405. package/dist/tier-routing.d.ts +2 -1
  406. package/dist/topics.d.ts +2 -1
  407. package/dist/transcript.d.ts +2 -1
  408. package/dist/transfer/types.d.ts +78 -78
  409. package/dist/trust-score-stage.d.ts +2 -1
  410. package/dist/trust-score.d.ts +2 -1
  411. package/dist/{types-BHDNxGTT.d.ts → types-djxQlxJ7.d.ts} +2 -1
  412. package/dist/types.d.ts +2 -1
  413. package/dist/types.js +1 -1
  414. package/dist/utility-runtime.d.ts +2 -1
  415. package/dist/verified-recall.js +23 -23
  416. package/dist/who-knows-cli.d.ts +15 -13
  417. package/dist/who-knows-cli.js +24 -24
  418. package/dist/who-knows.d.ts +15 -13
  419. package/dist/who-knows.js +23 -23
  420. package/dist/write-envelope.d.ts +2 -1
  421. package/dist/write-envelope.js +4 -4
  422. package/package.json +22 -2
  423. package/src/active-context-config.ts +98 -0
  424. package/src/active-context-transform.test.ts +533 -0
  425. package/src/active-context-transform.ts +981 -0
  426. package/src/config.ts +3 -5
  427. package/src/context-summary.ts +182 -0
  428. package/src/index.ts +4 -11
  429. package/src/lcm/summarizer.ts +14 -93
  430. package/src/memory-action-policy.ts +28 -0
  431. package/src/storage/context-transform-ledger.ts +39 -0
  432. package/src/storage/secure-line-reader.ts +50 -1
  433. package/src/storage.ts +4 -1
  434. package/src/types.ts +2 -3
  435. package/dist/chunk-BJTHRFFC.js.map +0 -1
  436. package/dist/chunk-D4QVPP3G.js.map +0 -1
  437. package/dist/chunk-DVYRD4HY.js.map +0 -1
  438. package/dist/chunk-LBFFNDFM.js.map +0 -1
  439. package/dist/chunk-ZPUIRTIZ.js.map +0 -1
  440. /package/dist/{resolution-4552BNRV.js.map → active-context-config.js.map} +0 -0
  441. /package/dist/{auto-sync-XVMLL2RH.js.map → auto-sync-2YPITIWN.js.map} +0 -0
  442. /package/dist/{chunk-JBPKEARU.js.map → chunk-2QSZNTDO.js.map} +0 -0
  443. /package/dist/{chunk-S3K2CIK5.js.map → chunk-3A2NJP2U.js.map} +0 -0
  444. /package/dist/{chunk-OPGL46PX.js.map → chunk-3PKAS6VL.js.map} +0 -0
  445. /package/dist/{chunk-GTSVEEP3.js.map → chunk-3SZD4CYO.js.map} +0 -0
  446. /package/dist/{chunk-YKWFK7XA.js.map → chunk-4F4AQFWL.js.map} +0 -0
  447. /package/dist/{chunk-RGCF4XNH.js.map → chunk-4QEYREAV.js.map} +0 -0
  448. /package/dist/{chunk-46WM6JX2.js.map → chunk-4ZWCQJNM.js.map} +0 -0
  449. /package/dist/{chunk-3RI5Y7KU.js.map → chunk-5DHKCO52.js.map} +0 -0
  450. /package/dist/{chunk-VKCAHCBI.js.map → chunk-5RWZH6PH.js.map} +0 -0
  451. /package/dist/{chunk-52II7PB6.js.map → chunk-645WOU5I.js.map} +0 -0
  452. /package/dist/{chunk-A32YEQAM.js.map → chunk-76DIF5KT.js.map} +0 -0
  453. /package/dist/{chunk-OPPBTPUU.js.map → chunk-7KQB4EBS.js.map} +0 -0
  454. /package/dist/{chunk-I2HTKOOP.js.map → chunk-7VZFRUQU.js.map} +0 -0
  455. /package/dist/{chunk-JCWY73FK.js.map → chunk-AHPIFKNG.js.map} +0 -0
  456. /package/dist/{chunk-IP4ZNT4U.js.map → chunk-AZMLH5UT.js.map} +0 -0
  457. /package/dist/{chunk-JOEJG4SD.js.map → chunk-BEC4YBNA.js.map} +0 -0
  458. /package/dist/{chunk-VXVZ2GM3.js.map → chunk-CAMNRAJF.js.map} +0 -0
  459. /package/dist/{chunk-C24UZSFW.js.map → chunk-CEH2AFXG.js.map} +0 -0
  460. /package/dist/{chunk-YOXVZJFM.js.map → chunk-CFVTRUR3.js.map} +0 -0
  461. /package/dist/{chunk-SVSRPG6M.js.map → chunk-CPA5NBHN.js.map} +0 -0
  462. /package/dist/{chunk-7BEPVIH3.js.map → chunk-CRML27CO.js.map} +0 -0
  463. /package/dist/{chunk-IY7UXD3J.js.map → chunk-DA7ITC5Z.js.map} +0 -0
  464. /package/dist/{chunk-AFR6AIM4.js.map → chunk-DEACDKE3.js.map} +0 -0
  465. /package/dist/{chunk-NG3MBQV4.js.map → chunk-DPCXDG7G.js.map} +0 -0
  466. /package/dist/{chunk-HZNYJN77.js.map → chunk-F3NVYTTA.js.map} +0 -0
  467. /package/dist/{chunk-PDDSFELN.js.map → chunk-F7XUD3PL.js.map} +0 -0
  468. /package/dist/{chunk-YWSQD2IB.js.map → chunk-GTO56JY5.js.map} +0 -0
  469. /package/dist/{chunk-RAIUTAZZ.js.map → chunk-H2YSH3DG.js.map} +0 -0
  470. /package/dist/{chunk-F6QHHRWP.js.map → chunk-HMZKGHMD.js.map} +0 -0
  471. /package/dist/{chunk-ZIJDI4CP.js.map → chunk-HRHO3ZNG.js.map} +0 -0
  472. /package/dist/{chunk-SDEPLF7V.js.map → chunk-IBJ6U753.js.map} +0 -0
  473. /package/dist/{chunk-T3JQTCCO.js.map → chunk-JI7U6AS3.js.map} +0 -0
  474. /package/dist/{chunk-TR7DGXGI.js.map → chunk-JOZUBF4A.js.map} +0 -0
  475. /package/dist/{chunk-I7EX6KSH.js.map → chunk-JYSN42VN.js.map} +0 -0
  476. /package/dist/{chunk-FMQ4MOQO.js.map → chunk-KZIF6XHX.js.map} +0 -0
  477. /package/dist/{chunk-RIAM7DND.js.map → chunk-LDKPDODJ.js.map} +0 -0
  478. /package/dist/{chunk-227UFSEQ.js.map → chunk-LEPOP46W.js.map} +0 -0
  479. /package/dist/{chunk-LLQCM2U2.js.map → chunk-LKYIOCWL.js.map} +0 -0
  480. /package/dist/{chunk-5S4LQOPE.js.map → chunk-LOXHYCVS.js.map} +0 -0
  481. /package/dist/{chunk-ANJXPFRS.js.map → chunk-LPNCR4QK.js.map} +0 -0
  482. /package/dist/{chunk-GEPACVWN.js.map → chunk-MDD2RINF.js.map} +0 -0
  483. /package/dist/{chunk-6CPUQ5D6.js.map → chunk-MY2BC6UE.js.map} +0 -0
  484. /package/dist/{chunk-CFGU52XJ.js.map → chunk-NPFUNWNX.js.map} +0 -0
  485. /package/dist/{chunk-MFOSZUIT.js.map → chunk-NPIBN2VL.js.map} +0 -0
  486. /package/dist/{chunk-5DH6PG4B.js.map → chunk-OA2O2GJ4.js.map} +0 -0
  487. /package/dist/{chunk-JAQXUGLN.js.map → chunk-ODU2CNNX.js.map} +0 -0
  488. /package/dist/{chunk-RQE4TITU.js.map → chunk-OXRRJXPR.js.map} +0 -0
  489. /package/dist/{chunk-SEA6M7SS.js.map → chunk-P36Z4JRA.js.map} +0 -0
  490. /package/dist/{chunk-Z4U3UN56.js.map → chunk-PU56CXZA.js.map} +0 -0
  491. /package/dist/{chunk-5VPQSRQO.js.map → chunk-S5XOSTYM.js.map} +0 -0
  492. /package/dist/{chunk-SVVIASVX.js.map → chunk-SEEJOGQX.js.map} +0 -0
  493. /package/dist/{chunk-7TCGNUVP.js.map → chunk-SNOIKAHM.js.map} +0 -0
  494. /package/dist/{chunk-7F27PCSN.js.map → chunk-T6ILXUAH.js.map} +0 -0
  495. /package/dist/{chunk-EOHKUWXW.js.map → chunk-T7XP6IZE.js.map} +0 -0
  496. /package/dist/{chunk-7WR462EM.js.map → chunk-TFR3HG4K.js.map} +0 -0
  497. /package/dist/{chunk-YRVAKONL.js.map → chunk-TUHBYJXL.js.map} +0 -0
  498. /package/dist/{chunk-F635GAL7.js.map → chunk-U7EW2W4W.js.map} +0 -0
  499. /package/dist/{chunk-VFYRYFLL.js.map → chunk-UEBDCMOO.js.map} +0 -0
  500. /package/dist/{chunk-WTOZBZNN.js.map → chunk-UENKPWCS.js.map} +0 -0
  501. /package/dist/{chunk-AAXJNINV.js.map → chunk-UL4MKZHI.js.map} +0 -0
  502. /package/dist/{chunk-R2MZCYA6.js.map → chunk-UNUMFURP.js.map} +0 -0
  503. /package/dist/{chunk-ACOC27BB.js.map → chunk-UPFNQJC7.js.map} +0 -0
  504. /package/dist/{chunk-W4BMEGQA.js.map → chunk-UTQUEHC7.js.map} +0 -0
  505. /package/dist/{chunk-I32NKXE2.js.map → chunk-V4IDF3EZ.js.map} +0 -0
  506. /package/dist/{chunk-ZAOHJDKH.js.map → chunk-WNXYT4MK.js.map} +0 -0
  507. /package/dist/{chunk-T42L3S6A.js.map → chunk-XBGHAAKR.js.map} +0 -0
  508. /package/dist/{chunk-I4343FIA.js.map → chunk-XNWXSGHS.js.map} +0 -0
  509. /package/dist/{chunk-THG4GYIE.js.map → chunk-YEUXERJ6.js.map} +0 -0
  510. /package/dist/{chunk-EZ25VE3G.js.map → chunk-YNDLCWXS.js.map} +0 -0
  511. /package/dist/{chunk-5HERQ5FX.js.map → chunk-Z3YEGSR4.js.map} +0 -0
  512. /package/dist/{forget-SZ2BXDGF.js.map → forget-2AE4MDK3.js.map} +0 -0
package/src/config.ts CHANGED
@@ -43,12 +43,10 @@ import { parseExtractionLivenessConfig } from "./extraction-liveness.js";
43
43
  import { parseReplicaPeersConfig } from "./replica-peers-config.js";
44
44
  import { parseDependencyPropagationConfig } from "./dependency-propagation-config.js";
45
45
  import { parseProceduralMaintenanceConfig } from "./procedural/maintenance-config.js";
46
+ import { parseActiveContextFields } from "./active-context-config.js";
46
47
  import { parseSkillProjectionConfig } from "./procedural/skill-projection.js";
47
48
  import { parseDriftDetectionConfig } from "./preferences/drift-config.js";
48
- import {
49
- parseContradictionLocalizationConfig,
50
- parseContradictionScanConfig,
51
- } from "./contradiction-config.js";
49
+ import { parseContradictionLocalizationConfig, parseContradictionScanConfig } from "./contradiction-config.js";
52
50
  import { parseGraphPathScoringConfig } from "./graph-path-scoring-config.js";
53
51
  import { hasLegacyConnectorEntries } from "./connectors/paths.js";
54
52
  import {
@@ -699,7 +697,6 @@ function resolveMemoryOsPreset(value: unknown): MemoryOsPresetName | undefined {
699
697
  }
700
698
  return MEMORY_OS_PRESET_ALIASES[normalized];
701
699
  }
702
-
703
700
  export function parseConfig(
704
701
  raw: unknown,
705
702
  rawOperatorConfig?: Record<string, unknown> | null,
@@ -3306,6 +3303,7 @@ export function parseConfig(
3306
3303
  typeof cfg.maxCompressionTokensPerHour === "number"
3307
3304
  ? Math.max(0, Math.floor(cfg.maxCompressionTokensPerHour))
3308
3305
  : 1500,
3306
+ ...parseActiveContextFields(cfg),
3309
3307
  behaviorLoopAutoTuneEnabled: cfg.behaviorLoopAutoTuneEnabled === true,
3310
3308
  behaviorLoopLearningWindowDays:
3311
3309
  typeof cfg.behaviorLoopLearningWindowDays === "number"
@@ -0,0 +1,182 @@
1
+ /**
2
+ * Pure context summary seam (issue #2347).
3
+ *
4
+ * The only shared summary path: `LcmSummarizer` and active-context
5
+ * transforms both call `summarizeContextPure`. No DAG writes, no model
6
+ * client construction — callers inject the model seam (`SummarizeFn`).
7
+ */
8
+ import { looksLikeMechanicalTelemetryTranscript } from "./telemetry-transcript.js";
9
+ import { estimateTokenCount } from "./token-estimate.js";
10
+
11
+ /** Model seam injected by the caller (orchestrator LLM path or a test stub). */
12
+ export type SummarizeFn = (
13
+ text: string,
14
+ targetTokens: number,
15
+ aggressive: boolean,
16
+ ) => Promise<string | null>;
17
+
18
+ export type ContextSummaryMethod = "deterministic" | "llm" | "auto";
19
+
20
+ export interface PureContextSummaryResult {
21
+ text: string;
22
+ method: "llm" | "deterministic";
23
+ /** True when the requested path degraded (auto mode only). */
24
+ fallback: boolean;
25
+ modelUsed?: string;
26
+ /**
27
+ * Escalation level preserved for LCM callers: 0 normal LLM, 1 aggressive
28
+ * LLM, 2 deterministic truncation. Undefined when never escalated.
29
+ */
30
+ escalation?: number;
31
+ }
32
+
33
+ export interface SummarizeContextPureOptions {
34
+ /** LLM seam. Required for `llm`; without it `auto` degrades to deterministic. */
35
+ llm?: SummarizeFn;
36
+ /** Hard ceiling for deterministic truncation output. */
37
+ deterministicMaxTokens?: number;
38
+ /** Route obvious mechanical telemetry straight to truncation. */
39
+ telemetryPrefilterEnabled?: boolean;
40
+ /** Recorded verbatim in the result for telemetry. */
41
+ modelUsed?: string;
42
+ }
43
+
44
+ /** Thrown when `llm` mode cannot produce usable text (no silent fallback). */
45
+ export class ContextSummaryUnavailableError extends Error {
46
+ constructor(reason: string) {
47
+ super(`context summary unavailable: ${reason}`);
48
+ this.name = "ContextSummaryUnavailableError";
49
+ }
50
+ }
51
+
52
+ const DEFAULT_DETERMINISTIC_MAX_TOKENS = 256;
53
+ /** LLM output tolerance before an attempt is rejected as too long (LCM parity). */
54
+ const OUTPUT_TOKEN_TOLERANCE = 1.5;
55
+ const MIN_DETERMINISTIC_TOKENS = 1;
56
+
57
+ /**
58
+ * Summarize text through the shared seam.
59
+ *
60
+ * - `deterministic`: safe truncation only, never throws, never calls the LLM.
61
+ * - `llm`: exactly one non-aggressive LLM call; failure or unusable output
62
+ * throws {@link ContextSummaryUnavailableError} (fallback is not allowed).
63
+ * - `auto`: escalation ladder (LLM → aggressive LLM → deterministic), with
64
+ * `fallback: true` and an `escalation` level on degradation.
65
+ */
66
+ export async function summarizeContextPure(
67
+ text: string,
68
+ targetTokens: number,
69
+ method: ContextSummaryMethod,
70
+ options: SummarizeContextPureOptions = {},
71
+ ): Promise<PureContextSummaryResult> {
72
+ const deterministicMaxTokens = Math.max(
73
+ MIN_DETERMINISTIC_TOKENS,
74
+ options.deterministicMaxTokens ?? DEFAULT_DETERMINISTIC_MAX_TOKENS,
75
+ );
76
+
77
+ if (method === "deterministic") {
78
+ return {
79
+ text: deterministicTruncate(text, Math.min(targetTokens, deterministicMaxTokens)),
80
+ method: "deterministic",
81
+ fallback: false,
82
+ };
83
+ }
84
+
85
+ const usableLlm = options.llm ?? null;
86
+ if (method === "llm") {
87
+ if (!usableLlm) {
88
+ throw new ContextSummaryUnavailableError("no llm seam configured");
89
+ }
90
+ const result = await attemptLlm(usableLlm, text, targetTokens, false);
91
+ if (result === null) {
92
+ throw new ContextSummaryUnavailableError("llm path failed");
93
+ }
94
+ return { text: result, method: "llm", fallback: false, modelUsed: options.modelUsed };
95
+ }
96
+
97
+ // auto
98
+ if (options.telemetryPrefilterEnabled && looksLikeMechanicalTelemetryTranscript(text)) {
99
+ return {
100
+ text: deterministicTruncate(text, Math.min(targetTokens, deterministicMaxTokens)),
101
+ method: "deterministic",
102
+ fallback: true,
103
+ escalation: 2,
104
+ };
105
+ }
106
+
107
+ if (usableLlm) {
108
+ const normal = await attemptLlm(usableLlm, text, targetTokens, false);
109
+ if (normal !== null) {
110
+ return { text: normal, method: "llm", fallback: false, escalation: 0, modelUsed: options.modelUsed };
111
+ }
112
+ const aggressiveTarget = Math.max(32, Math.ceil(targetTokens * 0.5));
113
+ const aggressive = await attemptLlm(usableLlm, text, aggressiveTarget, true);
114
+ if (aggressive !== null) {
115
+ return { text: aggressive, method: "llm", fallback: true, escalation: 1, modelUsed: options.modelUsed };
116
+ }
117
+ }
118
+
119
+ return {
120
+ text: deterministicTruncate(text, deterministicMaxTokens),
121
+ method: "deterministic",
122
+ fallback: true,
123
+ escalation: 2,
124
+ };
125
+ }
126
+
127
+ /** One LLM attempt; null on error, empty, or over-tolerance output. */
128
+ async function attemptLlm(
129
+ llm: SummarizeFn,
130
+ text: string,
131
+ targetTokens: number,
132
+ aggressive: boolean,
133
+ ): Promise<string | null> {
134
+ try {
135
+ const result = await llm(text, targetTokens, aggressive);
136
+ if (!result || result.trim().length === 0) return null;
137
+ if (estimateTokenCount(result) > targetTokens * OUTPUT_TOKEN_TOLERANCE) return null;
138
+ return result;
139
+ } catch {
140
+ return null;
141
+ }
142
+ }
143
+
144
+ /** Deterministic truncation: first and last sentence, plus middle truncation. */
145
+ export function deterministicTruncate(text: string, maxTokens: number): string {
146
+ if (maxTokens <= 0 || estimateTokenCount(text) <= maxTokens) return text;
147
+
148
+ const sentences = text.split(/(?<=[.!?])\s+/).filter((s) => s.length > 0);
149
+ if (sentences.length <= 2) return clampToTokenBudget(text, maxTokens);
150
+
151
+ const first = sentences[0];
152
+ const last = sentences[sentences.length - 1];
153
+ const render = (middle: string[], truncated: boolean): string =>
154
+ `${first} ${middle.join(" ")}${truncated ? " [...] " : " "}${last}`;
155
+
156
+ const base = render([], false);
157
+ if (estimateTokenCount(base) > maxTokens) return clampToTokenBudget(text, maxTokens);
158
+ if (estimateTokenCount(render([], true)) > maxTokens) return base;
159
+
160
+ const middle: string[] = [];
161
+ for (let i = 1; i < sentences.length - 1; i++) {
162
+ const candidate = [...middle, sentences[i]];
163
+ const truncated = i < sentences.length - 2;
164
+ if (estimateTokenCount(render(candidate, truncated)) > maxTokens) break;
165
+ middle.push(sentences[i]);
166
+ }
167
+
168
+ const truncated = middle.length < sentences.length - 2;
169
+ return clampToTokenBudget(render(middle, truncated), maxTokens);
170
+ }
171
+
172
+ function clampToTokenBudget(text: string, maxTokens: number): string {
173
+ const codePoints = [...text];
174
+ let low = 0;
175
+ let high = codePoints.length;
176
+ while (low < high) {
177
+ const mid = Math.ceil((low + high) / 2);
178
+ if (estimateTokenCount(codePoints.slice(0, mid).join("")) <= maxTokens) low = mid;
179
+ else high = mid - 1;
180
+ }
181
+ return codePoints.slice(0, low).join("");
182
+ }
package/src/index.ts CHANGED
@@ -1,17 +1,10 @@
1
1
  /**
2
- * @remnic/core
3
- *
4
- * Framework-agnostic Remnic memory engine.
5
- *
6
- * Exports the orchestrator, config parsing, storage, search,
7
- * extraction, graph, trust zones, and access layer.
8
- *
9
- * This package has ZERO OpenClaw imports — it can be consumed by
10
- * any host adapter (CLI, HTTP server, MCP server, etc.).
11
- *
2
+ * @remnic/core — framework-agnostic Remnic memory engine.
3
+ * Zero OpenClaw imports. Any host adapter can consume this package.
12
4
  */
13
-
14
5
  export { collapseWhitespace, displayWidth, graphemeUnits, padEndDisplay, truncateCodePointSafe, truncateGraphemeSafe } from "./whitespace.js";
6
+ export * from "./context-summary.js";
7
+ export * from "./active-context-transform.js";
15
8
 
16
9
  // ---------------------------------------------------------------------------
17
10
  // Plugin entry resolution
@@ -1,8 +1,6 @@
1
- import { log } from "../logger.js";
2
- import { looksLikeMechanicalTelemetryTranscript } from "../telemetry-transcript.js";
3
- import { estimateTokenCount } from "../token-estimate.js";
4
- import type { LcmArchive, LcmMessage } from "./archive.js";
1
+ import { summarizeContextPure, type SummarizeFn } from "../context-summary.js";
5
2
  import { estimateTokens } from "./archive.js";
3
+ import type { LcmArchive, LcmMessage } from "./archive.js";
6
4
  import type { LcmDag } from "./dag.js";
7
5
 
8
6
  /** Generate a ULID-like ID (timestamp + random). */
@@ -12,11 +10,9 @@ function generateNodeId(): string {
12
10
  return `lcm-${ts}-${rand}`;
13
11
  }
14
12
 
15
- export type SummarizeFn = (
16
- text: string,
17
- targetTokens: number,
18
- aggressive: boolean,
19
- ) => Promise<string | null>;
13
+ // `SummarizeFn` moved to the shared pure summary seam (context-summary.ts,
14
+ // #2347); re-exported here for back-compat with existing imports.
15
+ export type { SummarizeFn };
20
16
 
21
17
  export interface LcmSummarizerConfig {
22
18
  leafBatchSize: number;
@@ -145,98 +141,23 @@ export class LcmSummarizer {
145
141
  }
146
142
 
147
143
  /**
148
- * Three-level escalation:
149
- * 0 = Normal LLM summary
150
- * 1 = Aggressive bullet compression
151
- * 2 = Deterministic truncation (no LLM)
144
+ * Three-level escalation, delegated to the shared pure summary seam
145
+ * (context-summary.ts): 0 = normal LLM, 1 = aggressive, 2 = deterministic.
152
146
  */
153
147
  private async summarizeWithEscalation(
154
148
  text: string,
155
149
  targetTokens: number,
156
150
  ): Promise<{ text: string; escalation: number }> {
157
- const { telemetryPrefilterEnabled } = this.config;
158
- if (
159
- telemetryPrefilterEnabled &&
160
- looksLikeMechanicalTelemetryTranscript(text)
161
- ) {
162
- return {
163
- text: deterministicTruncate(
164
- text,
165
- Math.min(targetTokens, this.config.deterministicMaxTokens),
166
- ),
167
- escalation: 2,
168
- };
169
- }
170
-
171
- // Level 0: Normal LLM summary
172
- try {
173
- const result = await this.summarizeFn(text, targetTokens, false);
174
- if (result && estimateTokens(result) <= targetTokens * 1.5) {
175
- return { text: result, escalation: 0 };
176
- }
177
- // If too long, try aggressive
178
- } catch (err) {
179
- log.debug(`LCM level-0 summary failed: ${err}`);
180
- }
181
-
182
- // Level 1: Aggressive bullet compression
183
- try {
184
- const aggressiveTarget = Math.max(32, Math.ceil(targetTokens * 0.5));
185
- const result = await this.summarizeFn(text, aggressiveTarget, true);
186
- if (result && estimateTokens(result) <= targetTokens * 1.5) {
187
- return { text: result, escalation: 1 };
188
- }
189
- } catch (err) {
190
- log.debug(`LCM level-1 summary failed: ${err}`);
191
- }
192
-
193
- // Level 2: Deterministic truncation (guaranteed, no LLM)
194
- return {
195
- text: deterministicTruncate(text, this.config.deterministicMaxTokens),
196
- escalation: 2,
197
- };
198
- }
199
- }
200
-
201
- /** Deterministic truncation: first and last sentence, plus middle truncation. */
202
- function deterministicTruncate(text: string, maxTokens: number): string {
203
- if (maxTokens <= 0 || estimateTokenCount(text) <= maxTokens) return text;
204
-
205
- const sentences = text.split(/(?<=[.!?])\s+/).filter((s) => s.length > 0);
206
- if (sentences.length <= 2) return clampToTokenBudget(text, maxTokens);
207
-
208
- const first = sentences[0];
209
- const last = sentences[sentences.length - 1];
210
- const render = (middle: string[], truncated: boolean): string =>
211
- `${first} ${middle.join(" ")}${truncated ? " [...] " : " "}${last}`;
212
-
213
- const base = render([], false);
214
- if (estimateTokenCount(base) > maxTokens) return clampToTokenBudget(text, maxTokens);
215
- if (estimateTokenCount(render([], true)) > maxTokens) return base;
216
-
217
- const middle: string[] = [];
218
- for (let i = 1; i < sentences.length - 1; i++) {
219
- const candidate = [...middle, sentences[i]];
220
- const truncated = i < sentences.length - 2;
221
- if (estimateTokenCount(render(candidate, truncated)) > maxTokens) break;
222
- middle.push(sentences[i]);
151
+ const { deterministicMaxTokens, telemetryPrefilterEnabled } = this.config;
152
+ const result = await summarizeContextPure(text, targetTokens, "auto", {
153
+ llm: this.summarizeFn,
154
+ deterministicMaxTokens,
155
+ telemetryPrefilterEnabled,
156
+ });
157
+ return { text: result.text, escalation: result.escalation ?? 2 };
223
158
  }
224
-
225
- const truncated = middle.length < sentences.length - 2;
226
- return clampToTokenBudget(render(middle, truncated), maxTokens);
227
159
  }
228
160
 
229
- function clampToTokenBudget(text: string, maxTokens: number): string {
230
- const codePoints = [...text];
231
- let low = 0;
232
- let high = codePoints.length;
233
- while (low < high) {
234
- const mid = Math.ceil((low + high) / 2);
235
- if (estimateTokenCount(codePoints.slice(0, mid).join("")) <= maxTokens) low = mid;
236
- else high = mid - 1;
237
- }
238
- return codePoints.slice(0, low).join("");
239
- }
240
161
 
241
162
  function chunkArray<T>(arr: T[], size: number): T[][] {
242
163
  const chunks: T[][] = [];
@@ -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
+ }
@@ -0,0 +1,39 @@
1
+ import type { ContextTransformTelemetryRecord } from "../active-context-transform.js";
2
+ import { readContextTransformRecordRowsFromLines, readMaybeEncryptedLines } from "./secure-line-reader.js";
3
+
4
+ export interface ContextTransformLedgerHost {
5
+ memoryActionsPath: string;
6
+ ensureDirectories(): Promise<void>;
7
+ appendStorageSecureFile(path: string, payload: string): Promise<void>;
8
+ readStorageSecureFile(path: string): Promise<string>;
9
+ }
10
+
11
+ export async function appendContextTransformRecords(
12
+ host: ContextTransformLedgerHost,
13
+ records: ContextTransformTelemetryRecord[],
14
+ ): Promise<number> {
15
+ if (records.length === 0) return 0;
16
+ await host.ensureDirectories();
17
+ await host.appendStorageSecureFile(
18
+ host.memoryActionsPath,
19
+ records.map((record) => `${JSON.stringify(record)}\n`).join(""),
20
+ );
21
+ return records.length;
22
+ }
23
+
24
+ export async function readContextTransformRecords(
25
+ host: ContextTransformLedgerHost,
26
+ limit = 200,
27
+ ): Promise<ContextTransformTelemetryRecord[]> {
28
+ const cappedLimit = Math.max(0, Math.floor(limit));
29
+ if (cappedLimit === 0 || Number.isNaN(cappedLimit)) return [];
30
+ try {
31
+ const rows = await readContextTransformRecordRowsFromLines(
32
+ readMaybeEncryptedLines(host.memoryActionsPath, () => host.readStorageSecureFile(host.memoryActionsPath)),
33
+ cappedLimit,
34
+ );
35
+ return rows.map((row) => row.record);
36
+ } catch {
37
+ return [];
38
+ }
39
+ }
@@ -3,6 +3,7 @@ import { lstat, open } from "node:fs/promises";
3
3
  import { createInterface } from "node:readline";
4
4
 
5
5
  import { isEncryptedFile, MAGIC_HEADER_SIZE } from "../secure-store/secure-fs.js";
6
+ import type { ContextTransformTelemetryRecord } from "../active-context-transform.js";
6
7
  import type { MemoryActionEvent, MemoryLifecycleEvent } from "../types.js";
7
8
 
8
9
  /**
@@ -89,7 +90,11 @@ export async function readMemoryActionEventRowsFromLines(
89
90
  const line = row.trim();
90
91
  if (!line) continue;
91
92
  try {
92
- const parsed = JSON.parse(line) as Partial<MemoryActionEvent>;
93
+ const parsed = JSON.parse(line) as Partial<MemoryActionEvent> & { recordKind?: unknown };
94
+ // Ledger discriminated union (#2347): any row carrying a `recordKind`
95
+ // belongs to another record family (e.g. context_transform) and must
96
+ // be ignored here — the legacy parser stays strict for its own kind.
97
+ if (parsed.recordKind !== undefined) continue;
93
98
  const outcome = parsed.outcome === "applied" || parsed.outcome === "skipped" || parsed.outcome === "failed"
94
99
  ? parsed.outcome
95
100
  : null;
@@ -116,6 +121,50 @@ export async function readMemoryActionEventRowsFromLines(
116
121
  return writeIndex === 0 ? out : [...out.slice(writeIndex), ...out.slice(0, writeIndex)];
117
122
  }
118
123
 
124
+ /**
125
+ * Tail read for context-transform telemetry rows (#2347). Selects ONLY
126
+ * records discriminated by `recordKind: "context_transform"` — the sibling
127
+ * of `readMemoryActionEventRowsFromLines`, with the same O(limit) ring
128
+ * buffer and line-number semantics. Malformed rows are skipped fail-open;
129
+ * legacy action rows are never returned here.
130
+ */
131
+ export async function readContextTransformRecordRowsFromLines(
132
+ lines: AsyncIterable<string>,
133
+ limit: number,
134
+ ): Promise<Array<{ line: number; record: ContextTransformTelemetryRecord }>> {
135
+ const out: Array<{ line: number; record: ContextTransformTelemetryRecord }> = [];
136
+ let writeIndex = 0;
137
+ let lineNumber = 0;
138
+ for await (const row of lines) {
139
+ lineNumber += 1;
140
+ const line = row.trim();
141
+ if (!line) continue;
142
+ try {
143
+ const parsed = JSON.parse(line) as Partial<ContextTransformTelemetryRecord>;
144
+ if (
145
+ parsed.recordKind === "context_transform" &&
146
+ typeof parsed.timestamp === "string" &&
147
+ typeof parsed.actionId === "string" &&
148
+ typeof parsed.planHash === "string"
149
+ ) {
150
+ const entry = {
151
+ line: lineNumber,
152
+ record: parsed as ContextTransformTelemetryRecord,
153
+ };
154
+ if (out.length < limit) {
155
+ out.push(entry);
156
+ } else {
157
+ out[writeIndex] = entry;
158
+ writeIndex = (writeIndex + 1) % limit;
159
+ }
160
+ }
161
+ } catch {
162
+ // Ignore malformed rows (fail-open).
163
+ }
164
+ }
165
+ return writeIndex === 0 ? out : [...out.slice(writeIndex), ...out.slice(0, writeIndex)];
166
+ }
167
+
119
168
  /**
120
169
  * Validate that a parsed row carries every required lifecycle-event field.
121
170
  * Shared by the tail reader and the per-memory reader so both apply the EXACT
package/src/storage.ts CHANGED
@@ -29,6 +29,8 @@ import { runCommittedInvalidation } from "./storage/committed-invalidation.js";
29
29
  import { renderProfileWithLastUpdated, stripOkfProfileFrontmatter, withOkfProfileFrontmatter } from "./storage/profile-header.js";
30
30
  import { parseQuestionFile as parseQuestionFileText } from "./storage/questions-file.js";
31
31
  import { assertNotOkfReservedBasename, OKF_QUESTION_TYPE, okfTypeForEntityKind, okfTypeForMemory } from "./okf/type-mapping.js";
32
+ import { appendContextTransformRecords, readContextTransformRecords } from "./storage/context-transform-ledger.js";
33
+ import type { ContextTransformTelemetryRecord } from "./active-context-transform.js";
32
34
  import { readMaybeEncryptedLines, readMemoryActionEventRowsFromLines } from "./storage/secure-line-reader.js";
33
35
  import {
34
36
  appendLifecycleEventsSerialized,
@@ -5595,7 +5597,8 @@ export class StorageManager extends TombstoneBlockedCaptureIndexHost {
5595
5597
  await this.appendStorageSecureFile(this.memoryActionsPath, payload);
5596
5598
  return events.length;
5597
5599
  }
5598
-
5600
+ async appendContextTransformRecords(records: ContextTransformTelemetryRecord[]) { return appendContextTransformRecords(this as never, records); }
5601
+ async readContextTransformRecords(limit = 200) { return readContextTransformRecords(this as never, limit); }
5599
5602
  async appendMemoryLifecycleEvents(events: MemoryLifecycleEvent[]): Promise<number> {
5600
5603
  if (events.length === 0) return 0;
5601
5604
  await this.ensureDirectories();
package/src/types.ts CHANGED
@@ -15,7 +15,7 @@ import type { DriftDetectionSettings, MemoryDriftProvenance, RecallDriftAnnotati
15
15
  import type { ProceduralMaintenanceConfig } from "./procedural/maintenance-config.js";
16
16
  import type { SkillProjectionConfig } from "./procedural/skill-projection.js";
17
17
  import type { ActionGateConfig } from "./coding/action-gate.js";
18
-
18
+ import type { ActiveContextConfigFields } from "./active-context-config.js";
19
19
  import type { AmbientCaptureProvenance, BufferTurnOwner, SecurityConfig, OriginMetadata } from "./security/types.js";
20
20
  export type MemorySubject = "user" | "agent";
21
21
  export type SubjectGuardMode = "off" | "warn" | "enforce";
@@ -682,8 +682,7 @@ export interface SemanticChunkingConfigShape {
682
682
  fallbackToRecursive: boolean;
683
683
  }
684
684
 
685
-
686
- export interface PluginConfig extends BoundedJsonlStateConfig, SecurityConfig, DriftDetectionSettings {
685
+ export interface PluginConfig extends BoundedJsonlStateConfig, SecurityConfig, DriftDetectionSettings, ActiveContextConfigFields {
687
686
  openaiApiKey: string | undefined;
688
687
  openaiBaseUrl: string | undefined;
689
688
  model: string;