@remnic/core 9.3.729 → 9.3.730

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 (345) hide show
  1. package/dist/access-boundary.d.ts +6 -5
  2. package/dist/access-boundary.js +13 -13
  3. package/dist/access-cli.js +34 -33
  4. package/dist/access-cli.js.map +1 -1
  5. package/dist/access-http.d.ts +6 -5
  6. package/dist/access-http.js +19 -19
  7. package/dist/access-mcp.d.ts +6 -5
  8. package/dist/access-mcp.js +18 -18
  9. package/dist/access-operations-batch.js +16 -16
  10. package/dist/access-operations.d.ts +11 -10
  11. package/dist/access-operations.js +17 -17
  12. package/dist/access-schema.d.ts +42 -42
  13. package/dist/{access-service-BXMJqkTA.d.ts → access-service-Byoe3HsT.d.ts} +18 -3
  14. package/dist/access-service.d.ts +6 -5
  15. package/dist/access-service.js +12 -12
  16. package/dist/access-surface-catalog.d.ts +6 -5
  17. package/dist/action-confidence.d.ts +1 -1
  18. package/dist/active-memory-bridge.d.ts +1 -1
  19. package/dist/active-recall.d.ts +1 -1
  20. package/dist/active-recall.js +2 -2
  21. package/dist/{auto-sync-F3KCSQFJ.js → auto-sync-G3V5AN4C.js} +2 -2
  22. package/dist/behavior-learner.d.ts +1 -1
  23. package/dist/behavior-signals.d.ts +1 -1
  24. package/dist/bootstrap.d.ts +5 -4
  25. package/dist/briefing.d.ts +1 -1
  26. package/dist/briefing.js +3 -3
  27. package/dist/buffer-surprise-report.d.ts +1 -1
  28. package/dist/buffer.d.ts +1 -1
  29. package/dist/calibration.d.ts +1 -1
  30. package/dist/capabilities.d.ts +55 -2
  31. package/dist/capabilities.js +5 -1
  32. package/dist/{catalog-bMczlO2G.d.ts → catalog-DM1nk7cM.d.ts} +1 -1
  33. package/dist/causal-behavior.d.ts +1 -1
  34. package/dist/causal-consolidation.d.ts +1 -1
  35. package/dist/causal-consolidation.js +4 -4
  36. package/dist/causal-trajectory-graph.d.ts +1 -1
  37. package/dist/{chunk-4NOI577P.js → chunk-24ZLC5QN.js} +2 -2
  38. package/dist/{chunk-DMQWV6SQ.js → chunk-5RZOFIDL.js} +2 -2
  39. package/dist/{chunk-UM5AWJNQ.js → chunk-646B5ERJ.js} +62 -37
  40. package/dist/chunk-646B5ERJ.js.map +1 -0
  41. package/dist/{chunk-H5BWGCRZ.js → chunk-6TUWSUUD.js} +51 -47
  42. package/dist/{chunk-H5BWGCRZ.js.map → chunk-6TUWSUUD.js.map} +1 -1
  43. package/dist/{chunk-36SEDFAU.js → chunk-C5WN74HH.js} +2 -2
  44. package/dist/{chunk-MLKWJOAJ.js → chunk-CGPHMNL4.js} +2 -2
  45. package/dist/{chunk-R6OVFAX6.js → chunk-DJECGBBM.js} +7 -2
  46. package/dist/{chunk-R6OVFAX6.js.map → chunk-DJECGBBM.js.map} +1 -1
  47. package/dist/{chunk-3RCBIOOJ.js → chunk-ESF7TRYJ.js} +18 -2
  48. package/dist/{chunk-3RCBIOOJ.js.map → chunk-ESF7TRYJ.js.map} +1 -1
  49. package/dist/{chunk-EY6MDMHK.js → chunk-F6OEXJQQ.js} +2 -2
  50. package/dist/{chunk-M4V2JVSZ.js → chunk-FFUCCKPN.js} +2 -2
  51. package/dist/{chunk-O6YH5F47.js → chunk-FYWUNVFZ.js} +8 -8
  52. package/dist/{chunk-37436GML.js → chunk-GEXI357K.js} +2 -2
  53. package/dist/{chunk-YGIQORJ3.js → chunk-GGL34GCW.js} +3 -3
  54. package/dist/{chunk-4H4F3BFL.js → chunk-GXTYEG7Q.js} +3 -3
  55. package/dist/{chunk-4H4F3BFL.js.map → chunk-GXTYEG7Q.js.map} +1 -1
  56. package/dist/{chunk-WAS3NV46.js → chunk-H3MB3F62.js} +2 -2
  57. package/dist/{chunk-UTHQPSRC.js → chunk-HHNSLPX7.js} +11 -8
  58. package/dist/chunk-HHNSLPX7.js.map +1 -0
  59. package/dist/{chunk-76NHR6ZL.js → chunk-HJWQJUKQ.js} +4 -4
  60. package/dist/{chunk-Y4YD5TYW.js → chunk-IIBFCZA7.js} +3 -3
  61. package/dist/{chunk-UVPL565C.js → chunk-IQOEW5YV.js} +2 -2
  62. package/dist/{chunk-V4GNSDFH.js → chunk-KQYGNGON.js} +2 -2
  63. package/dist/{chunk-CBWI22JN.js → chunk-KSJCXXOU.js} +2 -2
  64. package/dist/{chunk-M4AYVEWS.js → chunk-LUCARK4W.js} +12 -11
  65. package/dist/chunk-LUCARK4W.js.map +1 -0
  66. package/dist/{chunk-I5REUWLH.js → chunk-NIZQH6AU.js} +3 -3
  67. package/dist/{chunk-4ESAR77N.js → chunk-NOU77OHX.js} +2 -2
  68. package/dist/{chunk-BQCHEV7O.js → chunk-O4ZIBPIW.js} +3 -3
  69. package/dist/{chunk-HOHVIVDR.js → chunk-OBJUKYDO.js} +2 -2
  70. package/dist/{chunk-YKBHOBJK.js → chunk-OEHCMALU.js} +56 -4
  71. package/dist/chunk-OEHCMALU.js.map +1 -0
  72. package/dist/{chunk-YOLZS7NY.js → chunk-OTQE66IX.js} +2 -2
  73. package/dist/{chunk-HEDZUSCS.js → chunk-OUITHS6V.js} +246 -368
  74. package/dist/chunk-OUITHS6V.js.map +1 -0
  75. package/dist/{chunk-4T3BMHKD.js → chunk-OZECYVGI.js} +20 -7
  76. package/dist/chunk-OZECYVGI.js.map +1 -0
  77. package/dist/{chunk-C2PG7IEH.js → chunk-P3VJCTVE.js} +2 -2
  78. package/dist/{chunk-EH5ED3C6.js → chunk-PMAQRUN4.js} +4 -4
  79. package/dist/chunk-PMAQRUN4.js.map +1 -0
  80. package/dist/{chunk-7RLCCNHU.js → chunk-Q6BAA57B.js} +4 -3
  81. package/dist/chunk-Q6BAA57B.js.map +1 -0
  82. package/dist/{chunk-HGNOCPZX.js → chunk-QZHF4BWN.js} +6 -6
  83. package/dist/chunk-SYX73XD7.js +283 -0
  84. package/dist/chunk-SYX73XD7.js.map +1 -0
  85. package/dist/{chunk-ASKXIAHD.js → chunk-WDJCZQB4.js} +2 -2
  86. package/dist/{chunk-AQLOP5F4.js → chunk-WNGXQMRI.js} +95 -6
  87. package/dist/chunk-WNGXQMRI.js.map +1 -0
  88. package/dist/{chunk-JYLFZWUX.js → chunk-XYUFGHUW.js} +2 -2
  89. package/dist/{chunk-3TSTGI6F.js → chunk-ZQUAVZNG.js} +2 -2
  90. package/dist/{chunk-4NR2PDZ5.js → chunk-ZVHRSR2R.js} +14 -4
  91. package/dist/chunk-ZVHRSR2R.js.map +1 -0
  92. package/dist/{cli-DmAiDd8A.d.ts → cli-Dt-tuiYH.d.ts} +3 -3
  93. package/dist/cli.d.ts +7 -6
  94. package/dist/cli.js +35 -35
  95. package/dist/compounding/engine.d.ts +12 -1
  96. package/dist/compounding/engine.js +3 -3
  97. package/dist/compounding/preference-consolidator.d.ts +1 -1
  98. package/dist/compression-optimizer.d.ts +1 -1
  99. package/dist/config.d.ts +1 -1
  100. package/dist/config.js +2 -2
  101. package/dist/connectors/codex-materialize-runner.d.ts +1 -1
  102. package/dist/connectors/codex-materialize-runner.js +3 -3
  103. package/dist/connectors/codex-materialize.d.ts +1 -1
  104. package/dist/connectors/index.d.ts +1 -1
  105. package/dist/connectors/index.js +3 -3
  106. package/dist/consolidation-provenance-check.d.ts +1 -1
  107. package/dist/consolidation-undo.d.ts +1 -1
  108. package/dist/contradiction/index.d.ts +1 -1
  109. package/dist/contradiction/index.js +1 -1
  110. package/dist/conversation-index/backend.d.ts +1 -1
  111. package/dist/conversation-index/chunker.d.ts +1 -1
  112. package/dist/conversation-index/faiss-adapter.d.ts +1 -1
  113. package/dist/conversation-index/indexer.d.ts +1 -1
  114. package/dist/conversation-index/search.d.ts +1 -1
  115. package/dist/day-summary.d.ts +1 -1
  116. package/dist/delinearize.d.ts +1 -1
  117. package/dist/direct-answer-wiring.d.ts +1 -1
  118. package/dist/direct-answer.d.ts +1 -1
  119. package/dist/embedding-fallback.d.ts +1 -1
  120. package/dist/embedding-fallback.js +2 -2
  121. package/dist/enrichment/index.d.ts +1 -1
  122. package/dist/entity-retrieval.d.ts +1 -1
  123. package/dist/entity-retrieval.js +3 -3
  124. package/dist/entity-schema.d.ts +1 -1
  125. package/dist/explicit-capture.d.ts +6 -4
  126. package/dist/explicit-capture.js +1 -1
  127. package/dist/extraction-faithfulness.d.ts +1 -1
  128. package/dist/extraction-judge-telemetry.d.ts +1 -1
  129. package/dist/extraction-judge-training.d.ts +1 -1
  130. package/dist/extraction-judge.d.ts +1 -1
  131. package/dist/extraction.d.ts +1 -1
  132. package/dist/extraction.js +3 -3
  133. package/dist/fallback-llm.d.ts +1 -1
  134. package/dist/{first-start-migration-22LPFHD5.js → first-start-migration-OOR57AYR.js} +2 -2
  135. package/dist/graph-dashboard-diff.d.ts +1 -1
  136. package/dist/graph-dashboard-key.d.ts +1 -1
  137. package/dist/graph-dashboard-parser.d.ts +1 -1
  138. package/dist/graph-edge-reinforcement.d.ts +1 -1
  139. package/dist/graph-snapshot.d.ts +1 -1
  140. package/dist/graph.d.ts +1 -1
  141. package/dist/identity-continuity.d.ts +1 -1
  142. package/dist/importance.d.ts +1 -1
  143. package/dist/index.d.ts +296 -11
  144. package/dist/index.js +359 -47
  145. package/dist/index.js.map +1 -1
  146. package/dist/intent.d.ts +1 -1
  147. package/dist/lcm/engine.d.ts +1 -1
  148. package/dist/lcm/index.d.ts +1 -1
  149. package/dist/lcm/tools.d.ts +1 -1
  150. package/dist/lifecycle.d.ts +1 -1
  151. package/dist/live-connectors-runner.d.ts +1 -1
  152. package/dist/local-llm.d.ts +1 -1
  153. package/dist/local-model-endpoint.d.ts +1 -1
  154. package/dist/maintenance/memory-governance.d.ts +1 -1
  155. package/dist/maintenance/memory-governance.js +3 -3
  156. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +3 -3
  157. package/dist/maintenance/rebuild-memory-projection.js +4 -4
  158. package/dist/mcp-memory-inspector-app.d.ts +6 -5
  159. package/dist/memory-action-policy.d.ts +1 -1
  160. package/dist/memory-cache.d.ts +1 -1
  161. package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
  162. package/dist/memory-projection-store.d.ts +1 -1
  163. package/dist/memory-provenance.d.ts +1 -1
  164. package/dist/memory-worth-outcomes.d.ts +1 -1
  165. package/dist/models-json.d.ts +1 -1
  166. package/dist/namespaces/migrate.d.ts +2 -2
  167. package/dist/namespaces/migrate.js +9 -9
  168. package/dist/namespaces/principal.d.ts +1 -1
  169. package/dist/namespaces/search.d.ts +1 -1
  170. package/dist/namespaces/search.js +5 -5
  171. package/dist/namespaces/storage.d.ts +2 -2
  172. package/dist/namespaces/storage.js +3 -3
  173. package/dist/native-knowledge.d.ts +1 -1
  174. package/dist/operator-toolkit.d.ts +1 -1
  175. package/dist/operator-toolkit.js +14 -14
  176. package/dist/orchestration/compression-guideline-coordinator.d.ts +105 -0
  177. package/dist/orchestration/compression-guideline-coordinator.js +12 -0
  178. package/dist/orchestration/maintenance.d.ts +2 -2
  179. package/dist/orchestration/maintenance.js +5 -5
  180. package/dist/{orchestrator-BR0sGsME.d.ts → orchestrator-B4KjaOtY.d.ts} +24 -8
  181. package/dist/orchestrator.d.ts +5 -4
  182. package/dist/orchestrator.js +28 -26
  183. package/dist/patterns-cli.d.ts +1 -1
  184. package/dist/policy-runtime.d.ts +1 -1
  185. package/dist/provenance.d.ts +1 -1
  186. package/dist/provenance.js +1 -1
  187. package/dist/qmd-recall-cache.d.ts +1 -1
  188. package/dist/qmd.d.ts +1 -1
  189. package/dist/recall-disclosure-escalation.d.ts +1 -1
  190. package/dist/recall-explain-renderer.d.ts +1 -1
  191. package/dist/recall-planner-llm.d.ts +1 -1
  192. package/dist/recall-state.d.ts +1 -1
  193. package/dist/recall-tag-filter.d.ts +1 -1
  194. package/dist/recall-xray-cli.d.ts +1 -1
  195. package/dist/recall-xray-renderer.d.ts +1 -1
  196. package/dist/recall-xray.d.ts +1 -1
  197. package/dist/{resolution-MN36NW5P.js → resolution-33PIX3TT.js} +2 -2
  198. package/dist/resolution-33PIX3TT.js.map +1 -0
  199. package/dist/resolve-auth-token.d.ts +1 -1
  200. package/dist/resume-bundles.js +3 -3
  201. package/dist/retrieval-agents.d.ts +1 -1
  202. package/dist/retrieval-tiers.d.ts +1 -1
  203. package/dist/routing/engine.d.ts +1 -1
  204. package/dist/routing/store.d.ts +1 -1
  205. package/dist/schemas.d.ts +84 -84
  206. package/dist/search/embed-helper.d.ts +1 -1
  207. package/dist/search/embed-helper.js +2 -2
  208. package/dist/search/factory.d.ts +1 -1
  209. package/dist/search/factory.js +4 -4
  210. package/dist/search/index.d.ts +1 -1
  211. package/dist/search/index.js +8 -8
  212. package/dist/search/lancedb-backend.d.ts +1 -1
  213. package/dist/search/meilisearch-backend.d.ts +1 -1
  214. package/dist/search/noop-backend.d.ts +1 -1
  215. package/dist/search/orama-backend.d.ts +1 -1
  216. package/dist/search/port.d.ts +1 -1
  217. package/dist/search/remote-backend.d.ts +1 -1
  218. package/dist/{semantic-consolidation-Cl15ksZy.d.ts → semantic-consolidation-CstTvHPo.d.ts} +1 -1
  219. package/dist/semantic-consolidation.d.ts +2 -2
  220. package/dist/semantic-consolidation.js +4 -4
  221. package/dist/semantic-rule-promotion.js +3 -3
  222. package/dist/semantic-rule-verifier.d.ts +1 -1
  223. package/dist/semantic-rule-verifier.js +3 -3
  224. package/dist/session-observer-bands.d.ts +1 -1
  225. package/dist/session-observer-state.d.ts +1 -1
  226. package/dist/shared-context/manager.d.ts +3 -3
  227. package/dist/signal.d.ts +1 -1
  228. package/dist/storage.d.ts +22 -3
  229. package/dist/storage.js +2 -2
  230. package/dist/summarizer.d.ts +1 -1
  231. package/dist/summary-snapshot.d.ts +1 -1
  232. package/dist/temporal-supersession.d.ts +1 -1
  233. package/dist/temporal-validity.d.ts +1 -1
  234. package/dist/threading.d.ts +1 -1
  235. package/dist/tier-migration.d.ts +1 -1
  236. package/dist/tier-routing.d.ts +1 -1
  237. package/dist/topics.d.ts +1 -1
  238. package/dist/transcript.d.ts +1 -1
  239. package/dist/transfer/types.d.ts +46 -46
  240. package/dist/trust-score-stage.d.ts +1 -1
  241. package/dist/trust-score.d.ts +1 -1
  242. package/dist/{types-ChQb9D6s.d.ts → types-VkxElCHR.d.ts} +8 -1
  243. package/dist/types.d.ts +1 -1
  244. package/dist/utility-runtime.d.ts +1 -1
  245. package/dist/verified-recall.js +3 -3
  246. package/package.json +12 -2
  247. package/src/access-service-coding-write.test.ts +2 -2
  248. package/src/access-service.ts +33 -14
  249. package/src/bitemporal-dedup-backfill.test.ts +10 -10
  250. package/src/bitemporal-frontmatter.test.ts +3 -3
  251. package/src/capabilities.test.ts +185 -0
  252. package/src/capabilities.ts +110 -0
  253. package/src/cli/creation-ledger-commands.ts +22 -21
  254. package/src/coding/architecture-surfaces.test.ts +25 -1
  255. package/src/coding/architecture-surfaces.ts +47 -19
  256. package/src/coding/decision-surfaces.ts +12 -3
  257. package/src/coding/review-context-structural.test.ts +303 -0
  258. package/src/coding/review-context.ts +79 -0
  259. package/src/coding/structural-context.test.ts +259 -0
  260. package/src/coding/structural-context.ts +315 -0
  261. package/src/coding/structural-subprocess-provider.test.ts +430 -0
  262. package/src/coding/structural-subprocess-provider.ts +355 -0
  263. package/src/compounding/engine.test.ts +90 -0
  264. package/src/compounding/engine.ts +25 -1
  265. package/src/contradiction/contradiction.test.ts +1 -1
  266. package/src/contradiction/resolution.ts +9 -1
  267. package/src/correction/correction-access-wiring.ts +21 -3
  268. package/src/correction/correction-contract.ts +7 -0
  269. package/src/correction/correction-planner.test.ts +231 -0
  270. package/src/correction/correction-planner.ts +73 -0
  271. package/src/correction/correction-service.ts +29 -0
  272. package/src/correction/correction-storage-integration.test.ts +2 -2
  273. package/src/dedup/semantic.test.ts +1 -1
  274. package/src/explicit-capture.ts +7 -4
  275. package/src/extraction-eventtime-wiring.test.ts +3 -3
  276. package/src/extraction-redaction-rules.test.ts +172 -0
  277. package/src/index.ts +29 -0
  278. package/src/maintenance/forget.test.ts +1 -1
  279. package/src/maintenance/memory-governance.test.ts +1 -1
  280. package/src/maintenance/pattern-reinforcement.test.ts +2 -2
  281. package/src/operator-toolkit.ts +4 -3
  282. package/src/orchestration/compression-guideline-coordinator.ts +449 -0
  283. package/src/orchestrator.ts +345 -464
  284. package/src/procedural/procedure-miner.test.ts +2 -2
  285. package/src/provenance-extraction.test.ts +382 -4
  286. package/src/provenance.ts +158 -22
  287. package/src/recall-handles-wiring.test.ts +1 -1
  288. package/src/search/factory.ts +4 -3
  289. package/src/semantic-rule-promotion.ts +1 -1
  290. package/src/source-attribution-roundtrip.test.ts +2 -2
  291. package/src/storage-contract/atomicity.test.ts +1 -1
  292. package/src/storage-contract/cache-coherence.test.ts +2 -2
  293. package/src/storage-contract/content-hash.test.ts +1 -1
  294. package/src/storage-contract/namespace-routing.test.ts +1 -1
  295. package/src/storage-contract/round-trip.test.ts +3 -3
  296. package/src/storage.ts +23 -2
  297. package/src/temporal-supersession.test.ts +12 -11
  298. package/src/temporal-validity.test.ts +11 -11
  299. package/src/wearables/cli.test.ts +30 -0
  300. package/src/wearables/cli.ts +3 -0
  301. package/src/wearables/memory-gen.test.ts +57 -1
  302. package/src/wearables/memory-gen.ts +31 -7
  303. package/src/wearables/pipeline.test.ts +40 -1
  304. package/src/wearables/pipeline.ts +4 -0
  305. package/src/wearables/service.test.ts +2 -2
  306. package/src/wearables/storage-io.test.ts +3 -3
  307. package/src/wearables/types.ts +7 -0
  308. package/dist/chunk-4NR2PDZ5.js.map +0 -1
  309. package/dist/chunk-4T3BMHKD.js.map +0 -1
  310. package/dist/chunk-7RLCCNHU.js.map +0 -1
  311. package/dist/chunk-AQLOP5F4.js.map +0 -1
  312. package/dist/chunk-EH5ED3C6.js.map +0 -1
  313. package/dist/chunk-HEDZUSCS.js.map +0 -1
  314. package/dist/chunk-M4AYVEWS.js.map +0 -1
  315. package/dist/chunk-UM5AWJNQ.js.map +0 -1
  316. package/dist/chunk-UTHQPSRC.js.map +0 -1
  317. package/dist/chunk-YKBHOBJK.js.map +0 -1
  318. /package/dist/{auto-sync-F3KCSQFJ.js.map → auto-sync-G3V5AN4C.js.map} +0 -0
  319. /package/dist/{chunk-4NOI577P.js.map → chunk-24ZLC5QN.js.map} +0 -0
  320. /package/dist/{chunk-DMQWV6SQ.js.map → chunk-5RZOFIDL.js.map} +0 -0
  321. /package/dist/{chunk-36SEDFAU.js.map → chunk-C5WN74HH.js.map} +0 -0
  322. /package/dist/{chunk-MLKWJOAJ.js.map → chunk-CGPHMNL4.js.map} +0 -0
  323. /package/dist/{chunk-EY6MDMHK.js.map → chunk-F6OEXJQQ.js.map} +0 -0
  324. /package/dist/{chunk-M4V2JVSZ.js.map → chunk-FFUCCKPN.js.map} +0 -0
  325. /package/dist/{chunk-O6YH5F47.js.map → chunk-FYWUNVFZ.js.map} +0 -0
  326. /package/dist/{chunk-37436GML.js.map → chunk-GEXI357K.js.map} +0 -0
  327. /package/dist/{chunk-YGIQORJ3.js.map → chunk-GGL34GCW.js.map} +0 -0
  328. /package/dist/{chunk-WAS3NV46.js.map → chunk-H3MB3F62.js.map} +0 -0
  329. /package/dist/{chunk-76NHR6ZL.js.map → chunk-HJWQJUKQ.js.map} +0 -0
  330. /package/dist/{chunk-Y4YD5TYW.js.map → chunk-IIBFCZA7.js.map} +0 -0
  331. /package/dist/{chunk-UVPL565C.js.map → chunk-IQOEW5YV.js.map} +0 -0
  332. /package/dist/{chunk-V4GNSDFH.js.map → chunk-KQYGNGON.js.map} +0 -0
  333. /package/dist/{chunk-CBWI22JN.js.map → chunk-KSJCXXOU.js.map} +0 -0
  334. /package/dist/{chunk-I5REUWLH.js.map → chunk-NIZQH6AU.js.map} +0 -0
  335. /package/dist/{chunk-4ESAR77N.js.map → chunk-NOU77OHX.js.map} +0 -0
  336. /package/dist/{chunk-BQCHEV7O.js.map → chunk-O4ZIBPIW.js.map} +0 -0
  337. /package/dist/{chunk-HOHVIVDR.js.map → chunk-OBJUKYDO.js.map} +0 -0
  338. /package/dist/{chunk-YOLZS7NY.js.map → chunk-OTQE66IX.js.map} +0 -0
  339. /package/dist/{chunk-C2PG7IEH.js.map → chunk-P3VJCTVE.js.map} +0 -0
  340. /package/dist/{chunk-HGNOCPZX.js.map → chunk-QZHF4BWN.js.map} +0 -0
  341. /package/dist/{chunk-ASKXIAHD.js.map → chunk-WDJCZQB4.js.map} +0 -0
  342. /package/dist/{chunk-JYLFZWUX.js.map → chunk-XYUFGHUW.js.map} +0 -0
  343. /package/dist/{chunk-3TSTGI6F.js.map → chunk-ZQUAVZNG.js.map} +0 -0
  344. /package/dist/{first-start-migration-22LPFHD5.js.map → first-start-migration-OOR57AYR.js.map} +0 -0
  345. /package/dist/{resolution-MN36NW5P.js.map → orchestration/compression-guideline-coordinator.js.map} +0 -0
package/src/index.ts CHANGED
@@ -103,6 +103,7 @@ export {
103
103
  StorageManager,
104
104
  parseEntityFile,
105
105
  serializeEntityFile,
106
+ type MemoryWriteResult,
106
107
  } from "./storage.js";
107
108
  export {
108
109
  getHostEmbeddingProvider,
@@ -453,10 +454,38 @@ export {
453
454
  parseTouchedFiles,
454
455
  rankReviewCandidates,
455
456
  packReviewContext,
457
+ packReviewContextStructural,
456
458
  type ReviewContext,
457
459
  type ReviewCandidate,
460
+ type PackReviewContextStructuralInput,
458
461
  } from "./coding/review-context.js";
459
462
 
463
+ export {
464
+ structuralProviderActive,
465
+ describeStructuralProviderStatus,
466
+ renderStructuralProviderStatusLine,
467
+ registerStructuralContextProvider,
468
+ getStructuralContextProvider,
469
+ clearStructuralContextProvidersForTest,
470
+ toStructuralContextDegradation,
471
+ type StructuralContextProvider,
472
+ type StructuralContextDegradation,
473
+ type StructuralContextErrorCode,
474
+ type StructuralSymbol,
475
+ type SymbolsForDiffResult,
476
+ type SymbolsForDiffOk,
477
+ type SymbolsForDiffErr,
478
+ type ArchitectureHintsResult,
479
+ type StructuralProviderStatus,
480
+ } from "./coding/structural-context.js";
481
+
482
+ export {
483
+ createSubprocessStructuralProvider,
484
+ probeStructuralProviderForDoctor,
485
+ type SubprocessProviderOptions,
486
+ type StructuralSpawnFn,
487
+ } from "./coding/structural-subprocess-provider.js";
488
+
460
489
  export {
461
490
  validateRequest,
462
491
  formatZodError,
@@ -184,7 +184,7 @@ test("forgetMemory: forgotten metadata survives storage round-trip", async () =>
184
184
  try {
185
185
  const storage = new StorageManager(dir);
186
186
  await storage.ensureDirectories();
187
- const id = await storage.writeMemory("fact", "Synthetic fact to forget.", {
187
+ const { id: id } = await storage.writeMemory("fact", "Synthetic fact to forget.", {
188
188
  source: "test",
189
189
  tags: ["roundtrip"],
190
190
  });
@@ -11,7 +11,7 @@ test("governance restore manifest pre-marks actions applied before mutation", as
11
11
  const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-governance-restore-"));
12
12
  try {
13
13
  const storage = new StorageManager(memoryDir);
14
- const memoryId = await storage.writeMemory("fact", "This memory is disputed.", {
14
+ const { id: memoryId } = await storage.writeMemory("fact", "This memory is disputed.", {
15
15
  source: "test",
16
16
  confidence: 0.9,
17
17
  });
@@ -414,7 +414,7 @@ test("frontmatter round-trip preserves reinforcement_count + last_reinforced_at
414
414
  try {
415
415
  const storage = new StorageManager(dir);
416
416
  await storage.ensureDirectories();
417
- const written = await storage.writeMemory(
417
+ const { id: written } = await storage.writeMemory(
418
418
  "fact",
419
419
  "Pattern-reinforcement round-trip body",
420
420
  { confidence: 0.9, tags: ["test"] },
@@ -456,7 +456,7 @@ test("storage rejects non-positive or non-integer reinforcement_count on write",
456
456
  try {
457
457
  const storage = new StorageManager(dir);
458
458
  await storage.ensureDirectories();
459
- const id = await storage.writeMemory("fact", "Body for validation test.", {
459
+ const { id: id } = await storage.writeMemory("fact", "Body for validation test.", {
460
460
  confidence: 0.9,
461
461
  tags: [],
462
462
  });
@@ -54,6 +54,7 @@ import type {
54
54
  } from "./types.js";
55
55
  import { reportBufferSurpriseDistribution } from "./buffer-surprise-report.js";
56
56
  import { readJudgeVerdictStats } from "./extraction-judge-telemetry.js";
57
+ import { resolveIndexingCapabilities } from "./capabilities.js";
57
58
 
58
59
  const OPENCLAW_REMNIC_PLUGIN_IDS = ["openclaw-remnic", "openclaw-engram"] as const;
59
60
 
@@ -931,7 +932,7 @@ async function buildOperatorConfigReviewReport(input: {
931
932
  config.memoryOsPreset !== "balanced" &&
932
933
  config.memoryOsPreset !== "research-max" &&
933
934
  config.memoryOsPreset !== "local-llm-heavy" &&
934
- config.queryAwareIndexingEnabled === false &&
935
+ resolveIndexingCapabilities(config).queryAwareIndexing === false &&
935
936
  config.verbatimArtifactsEnabled === false &&
936
937
  !caps.rerank
937
938
  ) {
@@ -1032,7 +1033,7 @@ async function buildOperatorConfigReviewReport(input: {
1032
1033
  }));
1033
1034
  }
1034
1035
 
1035
- if (config.conversationIndexEnabled && config.conversationIndexBackend === "qmd" && config.qmdEnabled === false) {
1036
+ if (resolveIndexingCapabilities(config).conversationIndex && config.conversationIndexBackend === "qmd" && config.qmdEnabled === false) {
1036
1037
  findings.push(buildConfigReviewFinding({
1037
1038
  key: "conversation_index_qmd_requires_qmd",
1038
1039
  status: "problem",
@@ -1066,7 +1067,7 @@ async function buildOperatorConfigReviewReport(input: {
1066
1067
  qmdDaemonEnabled: config.qmdDaemonEnabled,
1067
1068
  nativeKnowledgeEnabled: config.nativeKnowledge?.enabled === true,
1068
1069
  fileHygieneEnabled: config.fileHygiene?.enabled === true,
1069
- conversationIndexEnabled: config.conversationIndexEnabled,
1070
+ conversationIndexEnabled: resolveIndexingCapabilities(config).conversationIndex,
1070
1071
  },
1071
1072
  summary,
1072
1073
  findings,
@@ -0,0 +1,449 @@
1
+ /**
2
+ * Compression-guideline learning coordinator — extracted from the
3
+ * orchestrator (issue #1526, seam 4).
4
+ *
5
+ * Owns the compression-guideline learning lifecycle:
6
+ * - candidate computation from recorded memory-action events
7
+ * - optional LLM semantic refinement of the candidate
8
+ * - draft persistence + activation (optimizer/draft state files)
9
+ * - the recall section that surfaces active guidelines during recall
10
+ * - the consolidation-time learning pass that recomputes the draft
11
+ *
12
+ * The orchestrator constructs one instance and delegates the public
13
+ * entrypoints (`optimizeCompressionGuidelines`,
14
+ * `activateCompressionGuidelineDraft`) plus the two internal hooks
15
+ * (`runCompressionGuidelineLearningPass`, called from the consolidation
16
+ * loop; `buildCompressionGuidelineRecallSection`, called from the recall
17
+ * pipeline) to it. Storage is the orchestrator's stable `this.storage`;
18
+ * the fast-tier LLM call arrives as a callback so gateway routing stays
19
+ * owned by the orchestrator.
20
+ *
21
+ * Behavior-preserving move from orchestrator.ts. No logic changes — the
22
+ * orchestrator keeps thin delegating methods so existing call sites and
23
+ * tests that exercise the public API continue to work.
24
+ */
25
+
26
+ import { createHash } from "node:crypto";
27
+
28
+ // StorageManager type comes from the package barrel (type-only) so this
29
+ // module does not add a direct storage.ts import (#1533 ratchet).
30
+ import type { StorageManager } from "../index.js";
31
+ import type { PluginConfig, MemoryActionType, MemoryActionEvent } from "../types.js";
32
+ import { log } from "../logger.js";
33
+ import {
34
+ computeCompressionGuidelineCandidate,
35
+ refineCompressionGuidelineCandidateSemantically,
36
+ renderCompressionGuidelinesMarkdown,
37
+ } from "../compression-optimizer.js";
38
+
39
+ /** Dependencies injected by the orchestrator. All stable references or
40
+ * live accessors. */
41
+ export interface CompressionGuidelineCoordinatorDeps {
42
+ config: PluginConfig;
43
+ /** Live accessor: the orchestrator's storage manager (stable post-ctor). */
44
+ getStorage: () => StorageManager;
45
+ /** Fast-tier LLM call used for optional semantic refinement. Routes
46
+ * through the gateway chain when configured — owned by the
47
+ * orchestrator, injected here so this module stays LLM-agnostic. */
48
+ fastChatCompletion: (
49
+ messages: Array<{ role: string; content: string }>,
50
+ options: {
51
+ temperature?: number;
52
+ maxTokens?: number;
53
+ timeoutMs?: number;
54
+ operation?: string;
55
+ priority?: "background" | "recall-critical";
56
+ },
57
+ ) => Promise<{ content: string } | null>;
58
+ }
59
+
60
+ /**
61
+ * Coordinates compression-guideline learning. Holds no mutable state of
62
+ * its own — all persistence flows through the injected storage manager.
63
+ */
64
+ export class CompressionGuidelineCoordinator {
65
+ constructor(private readonly deps: CompressionGuidelineCoordinatorDeps) {}
66
+
67
+ private get storage(): StorageManager {
68
+ return this.deps.getStorage();
69
+ }
70
+
71
+ private get config(): PluginConfig {
72
+ return this.deps.config;
73
+ }
74
+
75
+ async optimizeCompressionGuidelines(options?: {
76
+ dryRun?: boolean;
77
+ eventLimit?: number;
78
+ }): Promise<{
79
+ enabled: boolean;
80
+ dryRun: boolean;
81
+ eventCount: number;
82
+ previousGuidelineVersion: number | null;
83
+ nextGuidelineVersion: number;
84
+ changedRules: number;
85
+ semanticRefinementApplied: boolean;
86
+ persisted: boolean;
87
+ draftContentHash: string | null;
88
+ }> {
89
+ const dryRun = options?.dryRun === true;
90
+ const eventLimit =
91
+ typeof options?.eventLimit === "number"
92
+ ? Math.max(0, Math.floor(options.eventLimit))
93
+ : 500;
94
+
95
+ const [activeState, draftState] = await Promise.all([
96
+ this.storage.readCompressionGuidelineOptimizerState(),
97
+ this.storage.readCompressionGuidelineDraftState().catch(() => null),
98
+ ]);
99
+ const previousState =
100
+ draftState &&
101
+ ((activeState?.guidelineVersion ?? 0) < draftState.guidelineVersion ||
102
+ (activeState?.guidelineVersion ?? 0) === draftState.guidelineVersion)
103
+ ? draftState
104
+ : activeState;
105
+
106
+ if (!this.config.compressionGuidelineLearningEnabled) {
107
+ return {
108
+ enabled: false,
109
+ dryRun,
110
+ eventCount: 0,
111
+ previousGuidelineVersion: previousState?.guidelineVersion ?? null,
112
+ nextGuidelineVersion: previousState?.guidelineVersion ?? 0,
113
+ changedRules: 0,
114
+ semanticRefinementApplied: false,
115
+ persisted: false,
116
+ draftContentHash: null,
117
+ };
118
+ }
119
+
120
+ let events = await this.storage.readMemoryActionEvents(eventLimit);
121
+ if (eventLimit > 0) {
122
+ let effectiveEvents = events.filter((event) => event.dryRun !== true);
123
+ let fetchLimit = eventLimit;
124
+ while (
125
+ effectiveEvents.length < eventLimit &&
126
+ events.length === fetchLimit
127
+ ) {
128
+ fetchLimit = Math.min(fetchLimit * 2, fetchLimit + 1000);
129
+ if (fetchLimit <= events.length) break;
130
+ events = await this.storage.readMemoryActionEvents(fetchLimit);
131
+ effectiveEvents = events.filter((event) => event.dryRun !== true);
132
+ }
133
+ events = effectiveEvents.slice(-eventLimit);
134
+ }
135
+ const generatedAt = new Date().toISOString();
136
+ const candidate = computeCompressionGuidelineCandidate(events, {
137
+ generatedAtIso: generatedAt,
138
+ previousState,
139
+ });
140
+ if (candidate.eventCounts.total === 0) {
141
+ return {
142
+ enabled: true,
143
+ dryRun,
144
+ eventCount: 0,
145
+ previousGuidelineVersion: previousState?.guidelineVersion ?? null,
146
+ nextGuidelineVersion: previousState?.guidelineVersion ?? 0,
147
+ changedRules: 0,
148
+ semanticRefinementApplied: false,
149
+ persisted: false,
150
+ draftContentHash: null,
151
+ };
152
+ }
153
+ const refinedCandidate =
154
+ await refineCompressionGuidelineCandidateSemantically(candidate, {
155
+ enabled: this.config.compressionGuidelineSemanticRefinementEnabled,
156
+ timeoutMs: this.config.compressionGuidelineSemanticTimeoutMs,
157
+ runRefinement: async (baseline) => {
158
+ const prompt = [
159
+ "You refine compression policy suggestions conservatively.",
160
+ "Return JSON only in this shape:",
161
+ '{"updates":[{"action":"summarize_node","delta":0.02,"confidence":"medium","note":"..."}]}',
162
+ "Constraints:",
163
+ "- Keep updates sparse and conservative.",
164
+ "- delta must stay between -0.15 and 0.15.",
165
+ "- Only include actions present in the input.",
166
+ "Input candidate:",
167
+ JSON.stringify(baseline),
168
+ ].join("\n");
169
+
170
+ const response = await this.deps.fastChatCompletion(
171
+ [
172
+ {
173
+ role: "system",
174
+ content: "Respond with strict JSON only. No markdown.",
175
+ },
176
+ { role: "user", content: prompt },
177
+ ],
178
+ {
179
+ temperature: 0.1,
180
+ maxTokens: 400,
181
+ operation: "compression_guideline_semantic_refinement",
182
+ priority: "background",
183
+ },
184
+ );
185
+
186
+ return this.parseCompressionSemanticRefinement(
187
+ response?.content ?? "",
188
+ );
189
+ },
190
+ });
191
+
192
+ const content = renderCompressionGuidelinesMarkdown(refinedCandidate);
193
+ const contentHash = createHash("sha256").update(content).digest("hex");
194
+ const semanticRefinementApplied =
195
+ JSON.stringify(refinedCandidate.ruleUpdates) !==
196
+ JSON.stringify(candidate.ruleUpdates);
197
+ const changedRules = refinedCandidate.ruleUpdates.filter(
198
+ (rule) => rule.delta !== 0,
199
+ ).length;
200
+
201
+ if (!dryRun) {
202
+ await this.storage.writeCompressionGuidelineDraft(content);
203
+ await this.storage.writeCompressionGuidelineDraftState({
204
+ version: refinedCandidate.optimizerVersion,
205
+ updatedAt: refinedCandidate.generatedAt,
206
+ sourceWindow: refinedCandidate.sourceWindow,
207
+ eventCounts: refinedCandidate.eventCounts,
208
+ guidelineVersion: refinedCandidate.guidelineVersion,
209
+ contentHash,
210
+ activationState: "draft",
211
+ actionSummaries: refinedCandidate.actionSummaries,
212
+ ruleUpdates: refinedCandidate.ruleUpdates,
213
+ });
214
+ }
215
+
216
+ return {
217
+ enabled: true,
218
+ dryRun,
219
+ eventCount: candidate.eventCounts.total,
220
+ previousGuidelineVersion: previousState?.guidelineVersion ?? null,
221
+ nextGuidelineVersion: refinedCandidate.guidelineVersion,
222
+ changedRules,
223
+ semanticRefinementApplied,
224
+ persisted: !dryRun,
225
+ draftContentHash: dryRun ? null : contentHash,
226
+ };
227
+ }
228
+
229
+ async activateCompressionGuidelineDraft(options?: {
230
+ expectedContentHash?: string;
231
+ expectedGuidelineVersion?: number;
232
+ }): Promise<{
233
+ enabled: boolean;
234
+ activated: boolean;
235
+ guidelineVersion: number | null;
236
+ reason?:
237
+ | "disabled"
238
+ | "missing_draft"
239
+ | "expected_revision_required"
240
+ | "content_hash_mismatch"
241
+ | "guideline_version_mismatch"
242
+ | "draft_changed";
243
+ }> {
244
+ if (!this.config.compressionGuidelineLearningEnabled) {
245
+ return {
246
+ enabled: false,
247
+ activated: false,
248
+ guidelineVersion: null,
249
+ reason: "disabled",
250
+ };
251
+ }
252
+
253
+ const draftState = await this.storage.readCompressionGuidelineDraftState();
254
+ if (!draftState) {
255
+ return {
256
+ enabled: true,
257
+ activated: false,
258
+ guidelineVersion: null,
259
+ reason: "missing_draft",
260
+ };
261
+ }
262
+
263
+ const expectedContentHash = options?.expectedContentHash?.trim();
264
+ const expectedGuidelineVersion = options?.expectedGuidelineVersion;
265
+
266
+ if (
267
+ (!expectedContentHash || expectedContentHash.length === 0) &&
268
+ typeof expectedGuidelineVersion !== "number"
269
+ ) {
270
+ return {
271
+ enabled: true,
272
+ activated: false,
273
+ guidelineVersion: null,
274
+ reason: "expected_revision_required",
275
+ };
276
+ }
277
+
278
+ if (expectedContentHash && draftState.contentHash !== expectedContentHash) {
279
+ return {
280
+ enabled: true,
281
+ activated: false,
282
+ guidelineVersion: null,
283
+ reason: "content_hash_mismatch",
284
+ };
285
+ }
286
+
287
+ if (
288
+ typeof expectedGuidelineVersion === "number" &&
289
+ draftState.guidelineVersion !== expectedGuidelineVersion
290
+ ) {
291
+ return {
292
+ enabled: true,
293
+ activated: false,
294
+ guidelineVersion: null,
295
+ reason: "guideline_version_mismatch",
296
+ };
297
+ }
298
+
299
+ const activated = await this.storage.activateCompressionGuidelineDraft({
300
+ ...(expectedContentHash ? { expectedContentHash } : {}),
301
+ ...(typeof expectedGuidelineVersion === "number"
302
+ ? { expectedGuidelineVersion }
303
+ : {}),
304
+ });
305
+ return {
306
+ enabled: true,
307
+ activated,
308
+ guidelineVersion: activated ? draftState.guidelineVersion : null,
309
+ ...(activated ? {} : { reason: "draft_changed" as const }),
310
+ };
311
+ }
312
+
313
+ /** Consolidation-time hook: recompute the draft from recent events. */
314
+ async runCompressionGuidelineLearningPass(): Promise<void> {
315
+ if (!this.config.compressionGuidelineLearningEnabled) return;
316
+ try {
317
+ const result = await this.optimizeCompressionGuidelines({
318
+ dryRun: false,
319
+ eventLimit: 500,
320
+ });
321
+ log.info(
322
+ `compression guideline learning updated (${result.eventCount} events)`,
323
+ );
324
+ } catch (err) {
325
+ log.warn(`compression guideline learning failed (ignored): ${err}`);
326
+ }
327
+ }
328
+
329
+ /** Recall-time hook: surface active guidelines as a recall section. */
330
+ async buildCompressionGuidelineRecallSection(): Promise<string | null> {
331
+ if (!this.config.contextCompressionActionsEnabled) return null;
332
+ if (!this.config.compressionGuidelineLearningEnabled) return null;
333
+
334
+ const state = await this.storage
335
+ .readCompressionGuidelineOptimizerState()
336
+ .catch(() => null);
337
+ if (!state || state.guidelineVersion <= 0) return null;
338
+
339
+ const raw = await this.storage
340
+ .readCompressionGuidelines()
341
+ .catch(() => null);
342
+ const summary = raw ? formatCompressionGuidelinesForRecall(raw, 5) : null;
343
+ if (!summary) return null;
344
+
345
+ return [
346
+ "## Active Compression Guidelines",
347
+ "",
348
+ `Guideline version: ${state.guidelineVersion}`,
349
+ `Updated: ${state.updatedAt}`,
350
+ "",
351
+ summary,
352
+ ].join("\n");
353
+ }
354
+
355
+ private parseCompressionSemanticRefinement(raw: string): {
356
+ updates: Array<{
357
+ action: MemoryActionType;
358
+ delta?: number;
359
+ confidence?: "low" | "medium" | "high";
360
+ note?: string;
361
+ }>;
362
+ } | null {
363
+ if (typeof raw !== "string" || raw.trim().length === 0) return null;
364
+ const trimmed = raw.trim();
365
+ const start = trimmed.indexOf("{");
366
+ const end = trimmed.lastIndexOf("}");
367
+ if (start === -1 || end === -1 || end <= start) return null;
368
+
369
+ try {
370
+ const parsed = JSON.parse(trimmed.slice(start, end + 1)) as {
371
+ updates?: Array<{
372
+ action?: unknown;
373
+ delta?: unknown;
374
+ confidence?: unknown;
375
+ note?: unknown;
376
+ }>;
377
+ };
378
+ if (!Array.isArray(parsed?.updates)) return null;
379
+
380
+ const validActions = new Set<MemoryActionType>([
381
+ "store_episode",
382
+ "store_note",
383
+ "update_note",
384
+ "create_artifact",
385
+ "summarize_node",
386
+ "discard",
387
+ "link_graph",
388
+ ]);
389
+
390
+ const updates = parsed.updates
391
+ .filter(
392
+ (item) =>
393
+ item &&
394
+ typeof item.action === "string" &&
395
+ validActions.has(item.action as MemoryActionType),
396
+ )
397
+ .map((item) => {
398
+ const confidence: "low" | "medium" | "high" | undefined =
399
+ item.confidence === "low" ||
400
+ item.confidence === "medium" ||
401
+ item.confidence === "high"
402
+ ? item.confidence
403
+ : undefined;
404
+ return {
405
+ action: item.action as MemoryActionType,
406
+ delta:
407
+ typeof item.delta === "number" && Number.isFinite(item.delta)
408
+ ? item.delta
409
+ : undefined,
410
+ confidence,
411
+ note: typeof item.note === "string" ? item.note : undefined,
412
+ };
413
+ });
414
+
415
+ return { updates };
416
+ } catch {
417
+ return null;
418
+ }
419
+ }
420
+ }
421
+
422
+ /**
423
+ * Format the active compression-guidelines section for recall. Extracted
424
+ * from the orchestrator (was a module-level export there); re-exported by
425
+ * the orchestrator barrel to preserve the public API. Pure — no state.
426
+ */
427
+ export function formatCompressionGuidelinesForRecall(
428
+ raw: string,
429
+ maxLines: number = 5,
430
+ ): string | null {
431
+ if (typeof raw !== "string" || raw.trim().length === 0) return null;
432
+ const sectionMatch = raw.match(
433
+ // End the section at `\n## ` or end-of-string. Plain $ (not \s*$): the
434
+ // \s* branch overlapped the lazy body and backtracked polynomially
435
+ // (CodeQL js/polynomial-redos). Captured lines are trimmed/filtered below,
436
+ // so trailing whitespace handling is unchanged.
437
+ /## Suggested Guidelines\s*\n([\s\S]*?)(?:\n##\s+|$)/i,
438
+ );
439
+ if (!sectionMatch) return null;
440
+
441
+ const lines = sectionMatch[1]
442
+ .split("\n")
443
+ .map((line) => line.trim())
444
+ .filter((line) => line.startsWith("- "))
445
+ .slice(0, Math.max(1, Math.floor(maxLines)));
446
+ if (lines.length === 0) return null;
447
+
448
+ return lines.join("\n");
449
+ }