@remnic/core 9.65.1 → 9.65.3

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 (576) hide show
  1. package/dist/access-admin-ops-surface.d.ts +44 -44
  2. package/dist/access-admin-ops-surface.js +36 -35
  3. package/dist/access-authorization-probe.d.ts +39 -40
  4. package/dist/access-authorization-probe.js +37 -36
  5. package/dist/access-boundary.d.ts +41 -185
  6. package/dist/access-boundary.js +36 -35
  7. package/dist/access-cli.js +110 -107
  8. package/dist/access-cli.js.map +1 -1
  9. package/dist/access-coding-context-resolution.d.ts +3 -1
  10. package/dist/access-extraction-force-flush.d.ts +25 -25
  11. package/dist/access-extraction-force-flush.js +36 -35
  12. package/dist/access-health-types.d.ts +3 -1
  13. package/dist/access-http-lcm-compaction.d.ts +39 -39
  14. package/dist/access-http-lifecycle-flush.d.ts +40 -41
  15. package/dist/access-http-offline-stream.d.ts +25 -25
  16. package/dist/access-http-query.d.ts +4 -2
  17. package/dist/access-http-query.js +38 -37
  18. package/dist/access-http.d.ts +51 -44
  19. package/dist/access-http.js +57 -56
  20. package/dist/access-identity-continuity-surface.d.ts +12 -12
  21. package/dist/access-identity-continuity-surface.js +36 -35
  22. package/dist/access-lcm-surface.d.ts +27 -27
  23. package/dist/access-lcm-surface.js +36 -35
  24. package/dist/access-mcp-admin-tools.d.ts +9 -1
  25. package/dist/access-mcp-admin-tools.js +3 -1
  26. package/dist/access-mcp-output-schemas.js +1 -1
  27. package/dist/access-mcp.d.ts +39 -39
  28. package/dist/access-mcp.js +50 -47
  29. package/dist/access-memory-search-fanout.d.ts +4 -2
  30. package/dist/{access-namespace-preflight-BKUnKsBv.d.ts → access-namespace-preflight-B7Usyz-K.d.ts} +1 -1
  31. package/dist/access-namespace-preflight.d.ts +5 -3
  32. package/dist/access-namespace-preflight.js +36 -35
  33. package/dist/access-observe-write-surface.d.ts +39 -39
  34. package/dist/access-observe-write-surface.js +36 -35
  35. package/dist/access-offline-manifest.d.ts +12 -12
  36. package/dist/access-offline-manifest.js +5 -5
  37. package/dist/access-operations-batch.js +41 -40
  38. package/dist/access-operations.d.ts +46 -47
  39. package/dist/access-operations.js +44 -43
  40. package/dist/access-recall-concurrency.d.ts +40 -40
  41. package/dist/access-recall-concurrency.js +36 -35
  42. package/dist/access-recall-response.d.ts +24 -24
  43. package/dist/access-recall-response.js +36 -35
  44. package/dist/access-recall-surface.d.ts +24 -24
  45. package/dist/access-recall-surface.js +36 -35
  46. package/dist/access-schema.d.ts +139 -139
  47. package/dist/access-schema.js +3 -3
  48. package/dist/{access-service-B1Lbb-nQ.d.ts → access-service-DkaIG3n8.d.ts} +688 -140
  49. package/dist/access-service-helpers.d.ts +40 -40
  50. package/dist/access-service.d.ts +47 -47
  51. package/dist/access-service.js +36 -35
  52. package/dist/access-surface-catalog.d.ts +41 -42
  53. package/dist/access-surface-catalog.js +44 -37
  54. package/dist/access-surface-catalog.js.map +1 -1
  55. package/dist/access-wearables-meetings-surface.d.ts +5 -3
  56. package/dist/action-confidence.d.ts +3 -1
  57. package/dist/active-memory-bridge.d.ts +3 -1
  58. package/dist/active-recall.d.ts +3 -1
  59. package/dist/active-recall.js +11 -1
  60. package/dist/active-recall.js.map +1 -1
  61. package/dist/adapters/index.js +4 -4
  62. package/dist/adapters/registry.js +2 -2
  63. package/dist/ambient-provenance.d.ts +3 -1
  64. package/dist/artifact-search.d.ts +3 -1
  65. package/dist/{auto-sync-5L7EUZ27.js → auto-sync-H64ZCNIR.js} +13 -5
  66. package/dist/{auto-sync-5L7EUZ27.js.map → auto-sync-H64ZCNIR.js.map} +1 -1
  67. package/dist/behavior-learner.d.ts +3 -1
  68. package/dist/behavior-signals.d.ts +3 -1
  69. package/dist/bootstrap.d.ts +12 -12
  70. package/dist/briefing-window.d.ts +4 -2
  71. package/dist/briefing.d.ts +4 -2
  72. package/dist/briefing.js +16 -15
  73. package/dist/buffer-surprise-report.d.ts +3 -1
  74. package/dist/buffer-turn-helpers.d.ts +3 -1
  75. package/dist/buffer.d.ts +4 -2
  76. package/dist/buffer.js +4 -4
  77. package/dist/bulk-import/index.d.ts +5 -3
  78. package/dist/calibration.d.ts +3 -1
  79. package/dist/calibration.js +1 -1
  80. package/dist/capabilities.d.ts +3 -1
  81. package/dist/{capsule-crypto-7FJQINUR.js → capsule-crypto-YO5QJ6L3.js} +2 -2
  82. package/dist/{catalog-DjVhJoRM.d.ts → catalog-CX2BZEJh.d.ts} +1 -1
  83. package/dist/causal-behavior.d.ts +1 -1
  84. package/dist/causal-consolidation.d.ts +3 -1
  85. package/dist/causal-consolidation.js +20 -19
  86. package/dist/causal-consolidation.js.map +1 -1
  87. package/dist/causal-trajectory-graph.d.ts +1 -1
  88. package/dist/{chunk-MIBKEW7A.js → chunk-2VXWFYJE.js} +3 -3
  89. package/dist/{chunk-3YTTAGPB.js → chunk-3DVBKTSO.js} +2 -2
  90. package/dist/{chunk-EIR5VLIH.js → chunk-4K7IW3F7.js} +2 -2
  91. package/dist/chunk-4K7IW3F7.js.map +1 -0
  92. package/dist/{chunk-JTSVMJHV.js → chunk-4XDGYCZI.js} +3 -3
  93. package/dist/chunk-573TEZCD.js +88 -0
  94. package/dist/chunk-573TEZCD.js.map +1 -0
  95. package/dist/{chunk-HQSBYI5X.js → chunk-57HVIG5U.js} +2 -2
  96. package/dist/{chunk-PMVPCZJZ.js → chunk-6433HV72.js} +2 -2
  97. package/dist/{chunk-N6TRHP72.js → chunk-6TAX66IA.js} +2 -2
  98. package/dist/{chunk-AGKIG3YA.js → chunk-6VALIZKG.js} +2 -2
  99. package/dist/{chunk-YQ3CBLL4.js → chunk-76PL4XLG.js} +512 -8
  100. package/dist/chunk-76PL4XLG.js.map +1 -0
  101. package/dist/{chunk-4NZHHGVL.js → chunk-7BDZTALN.js} +4 -1
  102. package/dist/chunk-7BDZTALN.js.map +1 -0
  103. package/dist/{chunk-NS5ETDYD.js → chunk-7BEPVIH3.js} +3 -3
  104. package/dist/{chunk-JG22O53B.js → chunk-7CBKAQIG.js} +2 -1
  105. package/dist/chunk-7CBKAQIG.js.map +1 -0
  106. package/dist/{chunk-LYIZXQYY.js → chunk-7KFIMGMP.js} +2 -2
  107. package/dist/{chunk-LWVO2QZV.js → chunk-7QOO4LGC.js} +56 -56
  108. package/dist/chunk-AAXJNINV.js +55 -0
  109. package/dist/chunk-AAXJNINV.js.map +1 -0
  110. package/dist/{chunk-56BSXSHC.js → chunk-AB3A7EFH.js} +31 -2
  111. package/dist/{chunk-56BSXSHC.js.map → chunk-AB3A7EFH.js.map} +1 -1
  112. package/dist/{chunk-CCTVAVTT.js → chunk-AUO2LJ3K.js} +2 -2
  113. package/dist/{chunk-ALCJRQ72.js → chunk-AYDDB3XI.js} +2 -2
  114. package/dist/{chunk-3TMYV3LP.js → chunk-AYYGRVRP.js} +5 -5
  115. package/dist/{chunk-W6TSGWYS.js → chunk-AZAA5DNP.js} +2 -2
  116. package/dist/{chunk-WTOE7CW4.js → chunk-BKYPJUQL.js} +122 -16
  117. package/dist/chunk-BKYPJUQL.js.map +1 -0
  118. package/dist/{chunk-6JJT5AKI.js → chunk-BQUEAVNW.js} +2 -2
  119. package/dist/{chunk-2NLLXCJG.js → chunk-BXLOS5AJ.js} +2 -2
  120. package/dist/{chunk-CEH2AFXG.js → chunk-C24UZSFW.js} +6 -6
  121. package/dist/{chunk-ZPN7W3OP.js → chunk-CDUUDBWJ.js} +3 -3
  122. package/dist/{chunk-35NN3ZFA.js → chunk-CTVWELNK.js} +21 -3
  123. package/dist/chunk-CTVWELNK.js.map +1 -0
  124. package/dist/{chunk-Y23B2QXP.js → chunk-D27J626P.js} +2 -2
  125. package/dist/{chunk-2572MRP2.js → chunk-DHTQP334.js} +2 -2
  126. package/dist/{chunk-HJQZQUPC.js → chunk-DJZWNKFO.js} +5 -5
  127. package/dist/{chunk-X7Y7WX73.js → chunk-DQEMWVMT.js} +1 -1
  128. package/dist/{chunk-VJ6ECBIP.js → chunk-E4MVQQVX.js} +2 -2
  129. package/dist/{chunk-SYJ6EKKE.js → chunk-EIVIB73I.js} +2 -2
  130. package/dist/{chunk-HUNSEO5U.js → chunk-EV3YFLCB.js} +2 -2
  131. package/dist/{chunk-GEULB2VI.js → chunk-FC7TIRFS.js} +21 -1
  132. package/dist/chunk-FC7TIRFS.js.map +1 -0
  133. package/dist/{chunk-VPGRXEAB.js → chunk-G57LQRP6.js} +2 -2
  134. package/dist/{chunk-BC4QD3FM.js → chunk-GN55KU2P.js} +2 -2
  135. package/dist/{chunk-4W6INNXO.js → chunk-GUXS322H.js} +2 -2
  136. package/dist/{chunk-DBXZZIDU.js → chunk-H5FW4S5Q.js} +434 -693
  137. package/dist/chunk-H5FW4S5Q.js.map +1 -0
  138. package/dist/chunk-I32NKXE2.js +879 -0
  139. package/dist/chunk-I32NKXE2.js.map +1 -0
  140. package/dist/{chunk-3MADV4YC.js → chunk-IQSC3V2E.js} +2 -2
  141. package/dist/{chunk-UYCIS6V5.js → chunk-JCWY73FK.js} +2 -2
  142. package/dist/{chunk-T42L3S6A.js → chunk-LBWQ65SX.js} +4 -4
  143. package/dist/{chunk-MSTNSVXI.js → chunk-LDBFXD4F.js} +2 -1
  144. package/dist/chunk-LDBFXD4F.js.map +1 -0
  145. package/dist/{chunk-CEQF6L5K.js → chunk-LUNJ3WFO.js} +9 -7
  146. package/dist/chunk-LUNJ3WFO.js.map +1 -0
  147. package/dist/{chunk-256FBCVX.js → chunk-M4AHBM72.js} +7 -7
  148. package/dist/{chunk-YEQEGSJA.js → chunk-MBDJJTAT.js} +3 -3
  149. package/dist/{chunk-IAY7YBXS.js → chunk-MRTUN665.js} +2 -2
  150. package/dist/{chunk-JFJ3MHGV.js → chunk-NXKJHSDN.js} +1 -1
  151. package/dist/chunk-NXKJHSDN.js.map +1 -0
  152. package/dist/{chunk-R3AAOKR2.js → chunk-NZWEEALH.js} +2 -2
  153. package/dist/{chunk-I2HTKOOP.js → chunk-ODZG724P.js} +2 -2
  154. package/dist/{chunk-7QFBLYFP.js → chunk-OJD4WS2E.js} +3 -3
  155. package/dist/{chunk-CUS6S7PN.js → chunk-OLWTCWQ2.js} +9 -9
  156. package/dist/chunk-OLWTCWQ2.js.map +1 -0
  157. package/dist/{chunk-53ENM6F6.js → chunk-P4DHENRE.js} +2 -2
  158. package/dist/{chunk-DEFI2QBT.js → chunk-PAYGC3BD.js} +52 -22
  159. package/dist/chunk-PAYGC3BD.js.map +1 -0
  160. package/dist/{chunk-KPBLJCCV.js → chunk-PDVQ5JU3.js} +2 -2
  161. package/dist/{chunk-7BY7V4YX.js → chunk-Q4WONDMJ.js} +4 -3
  162. package/dist/{chunk-7BY7V4YX.js.map → chunk-Q4WONDMJ.js.map} +1 -1
  163. package/dist/{chunk-ESCQ6LY7.js → chunk-QFMO32TO.js} +3 -3
  164. package/dist/{chunk-HQSPXTQO.js → chunk-QXIQPCCN.js} +1 -1
  165. package/dist/{chunk-CFRBTATE.js → chunk-R47WINCY.js} +3 -3
  166. package/dist/{chunk-G72IPMR7.js → chunk-R4OCGPSH.js} +2 -2
  167. package/dist/{chunk-LCU5R6TQ.js → chunk-RAIUTAZZ.js} +22 -3
  168. package/dist/chunk-RAIUTAZZ.js.map +1 -0
  169. package/dist/chunk-RIAM7DND.js +167 -0
  170. package/dist/chunk-RIAM7DND.js.map +1 -0
  171. package/dist/{chunk-VZVP2W4O.js → chunk-RK4WXUI2.js} +2 -2
  172. package/dist/{chunk-JBPKEARU.js → chunk-RKNJBZ55.js} +4 -4
  173. package/dist/{chunk-6L27N6YI.js → chunk-S7Q5CM7E.js} +2 -2
  174. package/dist/{chunk-CTQRPANJ.js → chunk-SVSRPG6M.js} +2 -2
  175. package/dist/{chunk-GXWDWOWP.js → chunk-TDKSCV62.js} +2 -2
  176. package/dist/{chunk-S2VBSTTA.js → chunk-THG4GYIE.js} +2 -2
  177. package/dist/{chunk-IXRC7EQG.js → chunk-TR7DGXGI.js} +2 -2
  178. package/dist/{chunk-63FHSH7E.js → chunk-TYUS5TLG.js} +4 -4
  179. package/dist/{chunk-7PWWGYGO.js → chunk-URHCUXKI.js} +2 -2
  180. package/dist/{chunk-Z54TXZ2F.js → chunk-VA5KMSAE.js} +16 -7
  181. package/dist/chunk-VA5KMSAE.js.map +1 -0
  182. package/dist/{chunk-KQAFEZQX.js → chunk-VDX2J7OX.js} +2 -2
  183. package/dist/{chunk-MUJ4QFUQ.js → chunk-W4BMEGQA.js} +4 -4
  184. package/dist/{chunk-5HK3CJAR.js → chunk-W675UJCZ.js} +2 -2
  185. package/dist/{chunk-3PXVYJMC.js → chunk-WN5FSGLE.js} +2077 -215
  186. package/dist/chunk-WN5FSGLE.js.map +1 -0
  187. package/dist/{chunk-3RHFGGI5.js → chunk-YF6UHWOV.js} +30 -10
  188. package/dist/chunk-YF6UHWOV.js.map +1 -0
  189. package/dist/{chunk-X5SDZMO7.js → chunk-YHCBJULX.js} +2 -2
  190. package/dist/{chunk-5UYSCYR7.js → chunk-Z4RPXHJH.js} +4 -4
  191. package/dist/{cli-Pulnz-qm.d.ts → cli-ChKeYMZv.d.ts} +5 -5
  192. package/dist/cli.d.ts +25 -25
  193. package/dist/cli.js +81 -78
  194. package/dist/coding/pre-action-gate.d.ts +2 -60
  195. package/dist/compounding/engine.d.ts +4 -2
  196. package/dist/compounding/engine.js +17 -16
  197. package/dist/compounding/preference-consolidator.d.ts +3 -1
  198. package/dist/compression-optimizer.d.ts +3 -1
  199. package/dist/config.d.ts +3 -1
  200. package/dist/config.js +11 -1
  201. package/dist/connectors/codex-materialize-runner.d.ts +3 -1
  202. package/dist/connectors/codex-materialize-runner.js +16 -15
  203. package/dist/connectors/codex-materialize.d.ts +3 -1
  204. package/dist/connectors/index.d.ts +3 -1
  205. package/dist/connectors/index.js +16 -15
  206. package/dist/consolidation-provenance-check.d.ts +4 -2
  207. package/dist/consolidation-undo.d.ts +4 -2
  208. package/dist/contradiction/index.d.ts +10 -270
  209. package/dist/contradiction/index.js +20 -7
  210. package/dist/{contradiction-review-QKJH5DKD.js → contradiction-review-WRVLRWHS.js} +6 -2
  211. package/dist/{contradiction-scan-VOTQRRSX.js → contradiction-scan-AKUWPX5N.js} +5 -3
  212. package/dist/converge-config.d.ts +3 -1
  213. package/dist/convergence-refresh.d.ts +4 -2
  214. package/dist/convergence-refresh.js +18 -17
  215. package/dist/conversation-index/backend.d.ts +3 -1
  216. package/dist/conversation-index/chunker.d.ts +3 -1
  217. package/dist/conversation-index/faiss-adapter.d.ts +3 -1
  218. package/dist/conversation-index/indexer.d.ts +3 -1
  219. package/dist/conversation-index/search.d.ts +3 -1
  220. package/dist/corpus-watermark.d.ts +3 -1
  221. package/dist/corpus-watermark.js +18 -17
  222. package/dist/cross-lingual-recall.d.ts +3 -1
  223. package/dist/day-summary.d.ts +3 -1
  224. package/dist/delinearize.d.ts +3 -1
  225. package/dist/dependency-propagation-config.d.ts +3 -1
  226. package/dist/{dependency-propagation-delivery-Co17gxYb.d.ts → dependency-propagation-delivery-B8ZMBBCY.d.ts} +1 -1
  227. package/dist/direct-answer-wiring.d.ts +3 -1
  228. package/dist/direct-answer.d.ts +3 -1
  229. package/dist/embedding-fallback.d.ts +3 -1
  230. package/dist/enrichment/index.d.ts +3 -1
  231. package/dist/entity-origin-fields.d.ts +3 -1
  232. package/dist/entity-retrieval.d.ts +4 -2
  233. package/dist/entity-retrieval.js +16 -15
  234. package/dist/entity-schema.d.ts +3 -1
  235. package/dist/episodic-context.d.ts +3 -1
  236. package/dist/explicit-capture.d.ts +12 -12
  237. package/dist/explicit-capture.js +7 -6
  238. package/dist/external-wiki-access.d.ts +41 -42
  239. package/dist/external-wiki-access.js +37 -36
  240. package/dist/external-wiki-collection-registration.d.ts +3 -1
  241. package/dist/external-wiki-collection.d.ts +3 -1
  242. package/dist/external-wiki-mcp-tools.d.ts +40 -40
  243. package/dist/extraction-error-classification.d.ts +3 -1
  244. package/dist/extraction-faithfulness.d.ts +3 -1
  245. package/dist/extraction-judge-telemetry.d.ts +3 -1
  246. package/dist/extraction-judge-training.d.ts +3 -1
  247. package/dist/extraction-judge.d.ts +3 -1
  248. package/dist/extraction-judge.js +2 -2
  249. package/dist/extraction-liveness.d.ts +3 -1
  250. package/dist/extraction-normalization.d.ts +3 -1
  251. package/dist/extraction-normalization.js +2 -2
  252. package/dist/extraction-prompt.d.ts +4 -2
  253. package/dist/extraction-prompt.js +1 -1
  254. package/dist/extraction-source-grounding-rules.d.ts +3 -1
  255. package/dist/extraction-source-grounding.d.ts +3 -1
  256. package/dist/extraction.d.ts +3 -1
  257. package/dist/extraction.js +22 -21
  258. package/dist/fallback-llm.d.ts +3 -1
  259. package/dist/graph-dashboard-diff.d.ts +3 -1
  260. package/dist/graph-dashboard-key.d.ts +3 -1
  261. package/dist/graph-dashboard-parser.d.ts +3 -1
  262. package/dist/graph-edge-reinforcement.d.ts +3 -1
  263. package/dist/graph-path-reconstruction.d.ts +3 -1
  264. package/dist/graph-path-scoring.d.ts +3 -1
  265. package/dist/graph-snapshot.d.ts +3 -1
  266. package/dist/graph.d.ts +3 -1
  267. package/dist/harmonic-retrieval.js +1 -1
  268. package/dist/importance.d.ts +3 -1
  269. package/dist/importers/index.d.ts +3 -1
  270. package/dist/in-flight-reads.d.ts +3 -1
  271. package/dist/index-CexDrJzC.d.ts +284 -0
  272. package/dist/index.d.ts +946 -707
  273. package/dist/index.js +253 -151
  274. package/dist/intent.d.ts +3 -1
  275. package/dist/lcm/engine.d.ts +3 -1
  276. package/dist/lcm/engine.js +3 -3
  277. package/dist/lcm/index.d.ts +3 -1
  278. package/dist/lcm/index.js +6 -6
  279. package/dist/lcm/tools.d.ts +3 -1
  280. package/dist/lifecycle.d.ts +3 -1
  281. package/dist/live-connectors-runner.d.ts +3 -1
  282. package/dist/local-llm.d.ts +3 -1
  283. package/dist/local-model-endpoint.d.ts +3 -1
  284. package/dist/maintenance/memory-governance.d.ts +3 -1
  285. package/dist/maintenance/memory-governance.js +16 -15
  286. package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +4 -2
  287. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +16 -15
  288. package/dist/maintenance/rebuild-memory-projection.d.ts +4 -2
  289. package/dist/maintenance/rebuild-memory-projection.js +17 -16
  290. package/dist/{maintenance-DiSLtVN7.d.ts → maintenance-nkdtSrVr.d.ts} +3 -3
  291. package/dist/mcp-memory-inspector-app.d.ts +37 -37
  292. package/dist/mcp-read-only-tools.js +1 -1
  293. package/dist/memory-action-policy.d.ts +3 -1
  294. package/dist/memory-cache.d.ts +3 -1
  295. package/dist/memory-lifecycle-ledger-utils.d.ts +3 -1
  296. package/dist/memory-projection-store.d.ts +3 -1
  297. package/dist/memory-provenance.d.ts +3 -1
  298. package/dist/memory-snapshot.d.ts +3 -1
  299. package/dist/memory-subject-cli.d.ts +177 -0
  300. package/dist/memory-subject-cli.js +16 -0
  301. package/dist/memory-subject.d.ts +128 -0
  302. package/dist/memory-subject.js +44 -0
  303. package/dist/memory-subject.js.map +1 -0
  304. package/dist/memory-worth-outcomes.d.ts +7 -4
  305. package/dist/memory-worth-outcomes.js +1 -1
  306. package/dist/models-json.d.ts +3 -1
  307. package/dist/namespaces/migrate.d.ts +5 -3
  308. package/dist/namespaces/migrate.js +17 -16
  309. package/dist/namespaces/principal.d.ts +3 -1
  310. package/dist/namespaces/search.d.ts +3 -1
  311. package/dist/namespaces/search.js +6 -6
  312. package/dist/namespaces/storage.d.ts +5 -3
  313. package/dist/namespaces/storage.js +16 -15
  314. package/dist/native-knowledge.d.ts +3 -1
  315. package/dist/offline-sync-impression-drain.d.ts +3 -1
  316. package/dist/operator-doctor-corpus.d.ts +3 -1
  317. package/dist/operator-doctor-corpus.js +19 -18
  318. package/dist/operator-doctor-replica.d.ts +3 -1
  319. package/dist/operator-toolkit.d.ts +5 -3
  320. package/dist/operator-toolkit.js +29 -24
  321. package/dist/orchestration/compression-guideline-coordinator.d.ts +4 -2
  322. package/dist/orchestration/maintenance.d.ts +6 -4
  323. package/dist/orchestration/maintenance.js +22 -21
  324. package/dist/{orchestrator-DzCaxNS4.d.ts → orchestrator-Bvq1-RQs.d.ts} +23 -9
  325. package/dist/orchestrator.d.ts +12 -12
  326. package/dist/orchestrator.js +111 -108
  327. package/dist/patterns-cli.d.ts +3 -1
  328. package/dist/{pipeline-HJ8DKbFl.d.ts → pipeline-C8vfIiTX.d.ts} +1 -1
  329. package/dist/policy-runtime.d.ts +3 -1
  330. package/dist/proactive-contention.d.ts +3 -1
  331. package/dist/provenance.d.ts +3 -1
  332. package/dist/{public-http-DwXauTX3.d.ts → public-http-Cy0aYbys.d.ts} +1 -1
  333. package/dist/{qmd-BzxluoLt.d.ts → qmd-B9p1SZTZ.d.ts} +1 -1
  334. package/dist/qmd-preflight.d.ts +4 -2
  335. package/dist/qmd-recall-cache.d.ts +3 -1
  336. package/dist/qmd.d.ts +4 -2
  337. package/dist/qmd.js +4 -4
  338. package/dist/recall-concurrency-config.d.ts +3 -1
  339. package/dist/recall-disclosure-escalation.d.ts +3 -1
  340. package/dist/recall-explain-renderer.d.ts +3 -1
  341. package/dist/recall-explain-renderer.js +3 -3
  342. package/dist/recall-memory-map.d.ts +3 -1
  343. package/dist/recall-planner-llm.d.ts +3 -1
  344. package/dist/recall-state.d.ts +3 -1
  345. package/dist/recall-tag-filter.d.ts +3 -1
  346. package/dist/recall-timings.d.ts +3 -1
  347. package/dist/recall-xray-cli.d.ts +3 -1
  348. package/dist/recall-xray-cli.js +4 -4
  349. package/dist/recall-xray-renderer.d.ts +3 -1
  350. package/dist/recall-xray-renderer.js +3 -3
  351. package/dist/recall-xray.d.ts +3 -1
  352. package/dist/recall-xray.js +2 -2
  353. package/dist/reconcile/cursor.d.ts +3 -1
  354. package/dist/reconcile/manifest.d.ts +3 -1
  355. package/dist/reconcile/manifest.js +3 -3
  356. package/dist/reconcile/plan.d.ts +3 -1
  357. package/dist/replay/normalizers/chatgpt.d.ts +3 -1
  358. package/dist/replay/normalizers/claude.d.ts +3 -1
  359. package/dist/replay/normalizers/openclaw.d.ts +3 -1
  360. package/dist/replay/normalizers/shared.d.ts +3 -1
  361. package/dist/replay/runner.d.ts +3 -1
  362. package/dist/replay/types.d.ts +3 -1
  363. package/dist/replica-divergence.d.ts +3 -1
  364. package/dist/replica-peers-config.d.ts +3 -1
  365. package/dist/resolution-4552BNRV.js +36 -0
  366. package/dist/resolution-4552BNRV.js.map +1 -0
  367. package/dist/resolve-auth-token.d.ts +3 -1
  368. package/dist/resume-bundles.js +9 -2
  369. package/dist/retrieval-agents.d.ts +4 -2
  370. package/dist/retrieval-tiers.d.ts +3 -1
  371. package/dist/routing/engine.d.ts +3 -1
  372. package/dist/routing/store.d.ts +3 -1
  373. package/dist/salvage-envelope.d.ts +3 -1
  374. package/dist/salvage-envelope.js +10 -2
  375. package/dist/schemas.d.ts +130 -116
  376. package/dist/schemas.js +1 -1
  377. package/dist/{scope-profiles-CEMZz0t5.d.ts → scope-profiles-DLrRxFWR.d.ts} +1 -1
  378. package/dist/search/embed-helper.d.ts +3 -1
  379. package/dist/search/factory.d.ts +3 -1
  380. package/dist/search/factory.js +5 -5
  381. package/dist/search/index.d.ts +3 -1
  382. package/dist/search/index.js +9 -9
  383. package/dist/search/lancedb-backend.d.ts +3 -1
  384. package/dist/search/meilisearch-backend.d.ts +3 -1
  385. package/dist/search/noop-backend.d.ts +3 -1
  386. package/dist/search/orama-backend.d.ts +3 -1
  387. package/dist/search/port.d.ts +3 -1
  388. package/dist/search/remote-backend.d.ts +3 -1
  389. package/dist/{semantic-TddhF0y7.d.ts → semantic-BalR6EXU.d.ts} +1 -1
  390. package/dist/{semantic-consolidation-D9dYj6vu.d.ts → semantic-consolidation-DlN6xe20.d.ts} +1 -1
  391. package/dist/semantic-consolidation.d.ts +4 -2
  392. package/dist/semantic-consolidation.js +17 -16
  393. package/dist/semantic-rule-promotion.js +16 -15
  394. package/dist/semantic-rule-verifier.d.ts +3 -1
  395. package/dist/semantic-rule-verifier.js +16 -15
  396. package/dist/{service-_qgST_0y.d.ts → service-GkYyVfm9.d.ts} +2 -2
  397. package/dist/session-observer-bands.d.ts +3 -1
  398. package/dist/session-observer-state.d.ts +3 -1
  399. package/dist/shared-context/manager.d.ts +13 -11
  400. package/dist/signal.d.ts +3 -1
  401. package/dist/source-agent-qualifier.d.ts +3 -1
  402. package/dist/source-agent-qualifier.js +18 -17
  403. package/dist/{storage-B9lbNTYE.d.ts → storage-BIDzuKIn.d.ts} +3 -2
  404. package/dist/storage.d.ts +4 -2
  405. package/dist/storage.js +18 -17
  406. package/dist/subject-config.d.ts +40 -0
  407. package/dist/subject-config.js +20 -0
  408. package/dist/subject-config.js.map +1 -0
  409. package/dist/summarizer.d.ts +3 -1
  410. package/dist/summary-snapshot.d.ts +3 -1
  411. package/dist/support-passport/index.d.ts +43 -43
  412. package/dist/support-passport/index.js +39 -38
  413. package/dist/temporal-supersession.d.ts +4 -2
  414. package/dist/temporal-timeline-recall.d.ts +3 -1
  415. package/dist/temporal-validity.d.ts +3 -1
  416. package/dist/threading.d.ts +3 -1
  417. package/dist/tier-migration.d.ts +4 -2
  418. package/dist/tier-routing.d.ts +3 -1
  419. package/dist/topics.d.ts +3 -1
  420. package/dist/transcript.d.ts +3 -1
  421. package/dist/transfer/backup.js +2 -2
  422. package/dist/transfer/capsule-export.js +2 -2
  423. package/dist/transfer/capsule-import.js +2 -2
  424. package/dist/transfer/types.d.ts +86 -86
  425. package/dist/trust-score-stage.d.ts +3 -1
  426. package/dist/trust-score.d.ts +3 -1
  427. package/dist/{types-BrEzuxPA.d.ts → types-BxAcOl5Q.d.ts} +360 -32
  428. package/dist/types.d.ts +3 -1
  429. package/dist/types.js +1 -1
  430. package/dist/utility-runtime.d.ts +3 -1
  431. package/dist/verified-recall.js +16 -15
  432. package/dist/who-knows-cli.d.ts +40 -40
  433. package/dist/who-knows-cli.js +17 -16
  434. package/dist/who-knows.d.ts +42 -42
  435. package/dist/who-knows.js +16 -15
  436. package/dist/write-envelope.d.ts +7 -2
  437. package/dist/write-envelope.js +10 -1
  438. package/package.json +2 -2
  439. package/scripts/build-with-heap.mjs +1 -1
  440. package/src/access-boundary.ts +6 -0
  441. package/src/access-http.ts +6 -5
  442. package/src/access-mcp-admin-tools.ts +38 -0
  443. package/src/access-mcp-output-schemas.ts +20 -0
  444. package/src/access-mcp.ts +8 -8
  445. package/src/access-operations-batch.ts +13 -0
  446. package/src/access-service.ts +112 -0
  447. package/src/access-surface-catalog.test.ts +24 -0
  448. package/src/access-surface-catalog.ts +6 -0
  449. package/src/coding/action-gate.test.ts +341 -0
  450. package/src/coding/action-gate.ts +556 -0
  451. package/src/config.ts +15 -17
  452. package/src/contradiction/contradiction-review.ts +50 -4
  453. package/src/contradiction/contradiction-scan.ts +14 -3
  454. package/src/contradiction/resolution.ts +50 -2
  455. package/src/extraction-prompt.ts +1 -0
  456. package/src/extraction.ts +4 -1
  457. package/src/index.ts +9 -9
  458. package/src/mcp-read-only-tools.ts +1 -0
  459. package/src/memory-subject-cli.ts +135 -0
  460. package/src/memory-subject.test.ts +48 -0
  461. package/src/memory-subject.ts +314 -0
  462. package/src/memory-worth-outcomes.test.ts +6 -2
  463. package/src/memory-worth-outcomes.ts +11 -7
  464. package/src/operator-toolkit.ts +1 -1
  465. package/src/orchestration/extraction-persist.ts +48 -48
  466. package/src/orchestration/recall-internal.ts +6 -5
  467. package/src/orchestration/recall-rerank-coordinator.ts +123 -4
  468. package/src/orchestration/recall-result-formatter.ts +6 -2
  469. package/src/orchestration/recall-search-pipeline.ts +14 -1
  470. package/src/preferences/drift-config.ts +118 -0
  471. package/src/preferences/drift-recall.ts +133 -0
  472. package/src/preferences/drift-types.ts +87 -0
  473. package/src/preferences/index.ts +12 -0
  474. package/src/preferences/preference-drift.test.ts +690 -0
  475. package/src/preferences/preference-drift.ts +724 -0
  476. package/src/procedural/library-maintenance.test.ts +582 -0
  477. package/src/procedural/library-maintenance.ts +546 -0
  478. package/src/procedural/maintenance-config.ts +78 -0
  479. package/src/procedural/procedure-recall.ts +29 -1
  480. package/src/procedural/procedure-stats.ts +20 -0
  481. package/src/review/review-deck-access.test.ts +325 -0
  482. package/src/review/review-deck-http-base.ts +133 -0
  483. package/src/review/review-deck-mutation.test.ts +417 -0
  484. package/src/review/review-deck-mutation.ts +677 -0
  485. package/src/review/review-deck-snapshot.ts +196 -0
  486. package/src/review/review-deck-surface.ts +117 -0
  487. package/src/review/review-deck.test.ts +347 -0
  488. package/src/review/review-deck.ts +311 -0
  489. package/src/schemas.ts +7 -0
  490. package/src/spaces/index.ts +38 -2
  491. package/src/storage.ts +10 -8
  492. package/src/subject-config.ts +80 -0
  493. package/src/types.ts +33 -32
  494. package/src/write-envelope.test.ts +14 -0
  495. package/src/write-envelope.ts +24 -3
  496. package/dist/chunk-35NN3ZFA.js.map +0 -1
  497. package/dist/chunk-3PXVYJMC.js.map +0 -1
  498. package/dist/chunk-3RHFGGI5.js.map +0 -1
  499. package/dist/chunk-4NZHHGVL.js.map +0 -1
  500. package/dist/chunk-CEQF6L5K.js.map +0 -1
  501. package/dist/chunk-CUS6S7PN.js.map +0 -1
  502. package/dist/chunk-DBXZZIDU.js.map +0 -1
  503. package/dist/chunk-DEFI2QBT.js.map +0 -1
  504. package/dist/chunk-EIR5VLIH.js.map +0 -1
  505. package/dist/chunk-GEULB2VI.js.map +0 -1
  506. package/dist/chunk-JFJ3MHGV.js.map +0 -1
  507. package/dist/chunk-JG22O53B.js.map +0 -1
  508. package/dist/chunk-LCU5R6TQ.js.map +0 -1
  509. package/dist/chunk-MDVBCPOS.js +0 -402
  510. package/dist/chunk-MDVBCPOS.js.map +0 -1
  511. package/dist/chunk-MSTNSVXI.js.map +0 -1
  512. package/dist/chunk-WTOE7CW4.js.map +0 -1
  513. package/dist/chunk-YQ3CBLL4.js.map +0 -1
  514. package/dist/chunk-Z54TXZ2F.js.map +0 -1
  515. package/dist/resolution-DKMBPXHI.js +0 -18
  516. /package/dist/{capsule-crypto-7FJQINUR.js.map → capsule-crypto-YO5QJ6L3.js.map} +0 -0
  517. /package/dist/{chunk-MIBKEW7A.js.map → chunk-2VXWFYJE.js.map} +0 -0
  518. /package/dist/{chunk-3YTTAGPB.js.map → chunk-3DVBKTSO.js.map} +0 -0
  519. /package/dist/{chunk-JTSVMJHV.js.map → chunk-4XDGYCZI.js.map} +0 -0
  520. /package/dist/{chunk-HQSBYI5X.js.map → chunk-57HVIG5U.js.map} +0 -0
  521. /package/dist/{chunk-PMVPCZJZ.js.map → chunk-6433HV72.js.map} +0 -0
  522. /package/dist/{chunk-N6TRHP72.js.map → chunk-6TAX66IA.js.map} +0 -0
  523. /package/dist/{chunk-AGKIG3YA.js.map → chunk-6VALIZKG.js.map} +0 -0
  524. /package/dist/{chunk-NS5ETDYD.js.map → chunk-7BEPVIH3.js.map} +0 -0
  525. /package/dist/{chunk-LYIZXQYY.js.map → chunk-7KFIMGMP.js.map} +0 -0
  526. /package/dist/{chunk-LWVO2QZV.js.map → chunk-7QOO4LGC.js.map} +0 -0
  527. /package/dist/{chunk-CCTVAVTT.js.map → chunk-AUO2LJ3K.js.map} +0 -0
  528. /package/dist/{chunk-ALCJRQ72.js.map → chunk-AYDDB3XI.js.map} +0 -0
  529. /package/dist/{chunk-3TMYV3LP.js.map → chunk-AYYGRVRP.js.map} +0 -0
  530. /package/dist/{chunk-W6TSGWYS.js.map → chunk-AZAA5DNP.js.map} +0 -0
  531. /package/dist/{chunk-6JJT5AKI.js.map → chunk-BQUEAVNW.js.map} +0 -0
  532. /package/dist/{chunk-2NLLXCJG.js.map → chunk-BXLOS5AJ.js.map} +0 -0
  533. /package/dist/{chunk-CEH2AFXG.js.map → chunk-C24UZSFW.js.map} +0 -0
  534. /package/dist/{chunk-ZPN7W3OP.js.map → chunk-CDUUDBWJ.js.map} +0 -0
  535. /package/dist/{chunk-Y23B2QXP.js.map → chunk-D27J626P.js.map} +0 -0
  536. /package/dist/{chunk-2572MRP2.js.map → chunk-DHTQP334.js.map} +0 -0
  537. /package/dist/{chunk-HJQZQUPC.js.map → chunk-DJZWNKFO.js.map} +0 -0
  538. /package/dist/{chunk-X7Y7WX73.js.map → chunk-DQEMWVMT.js.map} +0 -0
  539. /package/dist/{chunk-VJ6ECBIP.js.map → chunk-E4MVQQVX.js.map} +0 -0
  540. /package/dist/{chunk-SYJ6EKKE.js.map → chunk-EIVIB73I.js.map} +0 -0
  541. /package/dist/{chunk-HUNSEO5U.js.map → chunk-EV3YFLCB.js.map} +0 -0
  542. /package/dist/{chunk-VPGRXEAB.js.map → chunk-G57LQRP6.js.map} +0 -0
  543. /package/dist/{chunk-BC4QD3FM.js.map → chunk-GN55KU2P.js.map} +0 -0
  544. /package/dist/{chunk-4W6INNXO.js.map → chunk-GUXS322H.js.map} +0 -0
  545. /package/dist/{chunk-3MADV4YC.js.map → chunk-IQSC3V2E.js.map} +0 -0
  546. /package/dist/{chunk-UYCIS6V5.js.map → chunk-JCWY73FK.js.map} +0 -0
  547. /package/dist/{chunk-T42L3S6A.js.map → chunk-LBWQ65SX.js.map} +0 -0
  548. /package/dist/{chunk-256FBCVX.js.map → chunk-M4AHBM72.js.map} +0 -0
  549. /package/dist/{chunk-YEQEGSJA.js.map → chunk-MBDJJTAT.js.map} +0 -0
  550. /package/dist/{chunk-IAY7YBXS.js.map → chunk-MRTUN665.js.map} +0 -0
  551. /package/dist/{chunk-R3AAOKR2.js.map → chunk-NZWEEALH.js.map} +0 -0
  552. /package/dist/{chunk-I2HTKOOP.js.map → chunk-ODZG724P.js.map} +0 -0
  553. /package/dist/{chunk-7QFBLYFP.js.map → chunk-OJD4WS2E.js.map} +0 -0
  554. /package/dist/{chunk-53ENM6F6.js.map → chunk-P4DHENRE.js.map} +0 -0
  555. /package/dist/{chunk-KPBLJCCV.js.map → chunk-PDVQ5JU3.js.map} +0 -0
  556. /package/dist/{chunk-ESCQ6LY7.js.map → chunk-QFMO32TO.js.map} +0 -0
  557. /package/dist/{chunk-HQSPXTQO.js.map → chunk-QXIQPCCN.js.map} +0 -0
  558. /package/dist/{chunk-CFRBTATE.js.map → chunk-R47WINCY.js.map} +0 -0
  559. /package/dist/{chunk-G72IPMR7.js.map → chunk-R4OCGPSH.js.map} +0 -0
  560. /package/dist/{chunk-VZVP2W4O.js.map → chunk-RK4WXUI2.js.map} +0 -0
  561. /package/dist/{chunk-JBPKEARU.js.map → chunk-RKNJBZ55.js.map} +0 -0
  562. /package/dist/{chunk-6L27N6YI.js.map → chunk-S7Q5CM7E.js.map} +0 -0
  563. /package/dist/{chunk-CTQRPANJ.js.map → chunk-SVSRPG6M.js.map} +0 -0
  564. /package/dist/{chunk-GXWDWOWP.js.map → chunk-TDKSCV62.js.map} +0 -0
  565. /package/dist/{chunk-S2VBSTTA.js.map → chunk-THG4GYIE.js.map} +0 -0
  566. /package/dist/{chunk-IXRC7EQG.js.map → chunk-TR7DGXGI.js.map} +0 -0
  567. /package/dist/{chunk-63FHSH7E.js.map → chunk-TYUS5TLG.js.map} +0 -0
  568. /package/dist/{chunk-7PWWGYGO.js.map → chunk-URHCUXKI.js.map} +0 -0
  569. /package/dist/{chunk-KQAFEZQX.js.map → chunk-VDX2J7OX.js.map} +0 -0
  570. /package/dist/{chunk-MUJ4QFUQ.js.map → chunk-W4BMEGQA.js.map} +0 -0
  571. /package/dist/{chunk-5HK3CJAR.js.map → chunk-W675UJCZ.js.map} +0 -0
  572. /package/dist/{chunk-X5SDZMO7.js.map → chunk-YHCBJULX.js.map} +0 -0
  573. /package/dist/{chunk-5UYSCYR7.js.map → chunk-Z4RPXHJH.js.map} +0 -0
  574. /package/dist/{contradiction-review-QKJH5DKD.js.map → contradiction-review-WRVLRWHS.js.map} +0 -0
  575. /package/dist/{contradiction-scan-VOTQRRSX.js.map → contradiction-scan-AKUWPX5N.js.map} +0 -0
  576. /package/dist/{resolution-DKMBPXHI.js.map → memory-subject-cli.js.map} +0 -0
@@ -68,6 +68,7 @@ export const OPERATION_NAMES = [
68
68
  "recall_tier_explain",
69
69
  "recall_xray",
70
70
  "who_knows",
71
+ "promotion_candidates",
71
72
  "namespace_writable",
72
73
  "wearables_status",
73
74
  "wearables_sync",
@@ -88,6 +89,7 @@ export const OPERATION_NAMES = [
88
89
  "procedure_mining_run",
89
90
  "pattern_reinforcement_run",
90
91
  "procedural_stats",
92
+ "procedure_library_maintenance",
91
93
  "memory_timeline",
92
94
  "suggestion_submit",
93
95
  "entity_get",
@@ -138,6 +140,7 @@ export const OPERATION_NAMES = [
138
140
  "review_list",
139
141
  "review_resolve",
140
142
  "contradiction_scan_run",
143
+ "preference_drift_scan",
141
144
  "memory_summarize_hourly",
142
145
  "conversation_index_update",
143
146
  "profiling_report",
@@ -182,6 +185,9 @@ export const OPERATION_NAMES = [
182
185
  "trust_zones_status",
183
186
  "trust_zones_records",
184
187
  "review_disposition",
188
+ "review_deck_list",
189
+ "review_deck_action",
190
+ "review_deck_undo",
185
191
  "trust_zones_promote",
186
192
  "trust_zones_demo_seed",
187
193
  "citations_observed",
@@ -68,7 +68,7 @@ import { cleanupExpiredChatSessions, enforceChatSessionNamespace } from "./chat/
68
68
  import { isDefaultReviewNamespace, listPairs, readPair } from "./contradiction/contradiction-review.js";
69
69
  import { isValidResolutionVerb, executeResolution } from "./contradiction/resolution.js";
70
70
  import { RelayMissionStoreError } from "./relay/mission.js";
71
- import { SupportPassportAccessHttpBase } from "./support-passport/access-http-base.js";
71
+ import { ReviewDeckAccessHttpBase } from "./review/review-deck-http-base.js";
72
72
  import { serializeInlineScriptValue } from "./inline-script.js";
73
73
  import type { SupportPassportExternalRequestHandler } from "./support-passport/public-http.js";
74
74
  export interface AccessHttpReadinessState {
@@ -386,7 +386,7 @@ function codingContextFromProjectTag(projectTag: string): {
386
386
  };
387
387
  }
388
388
 
389
- export class EngramAccessHttpServer extends SupportPassportAccessHttpBase {
389
+ export class EngramAccessHttpServer extends ReviewDeckAccessHttpBase {
390
390
  protected readonly service: EngramAccessService;
391
391
  private readonly host: string;
392
392
  private readonly requestedPort: number;
@@ -396,7 +396,7 @@ export class EngramAccessHttpServer extends SupportPassportAccessHttpBase {
396
396
  private readonly authTokenEntriesGetter?: () => ReadonlyArray<{ token: string; connector?: string; capabilities?: TokenCapabilities }>;
397
397
  private readonly tokenPathPolicy?: (connector: string, pathname: string | undefined) => boolean;
398
398
  private readonly authenticatedPrincipal?: string;
399
- private readonly maxBodyBytes: number;
399
+ protected readonly maxBodyBytes: number;
400
400
  private readonly adminConsoleEnabled: boolean;
401
401
  protected readonly adminConsolePublicDir: string;
402
402
  private readonly adminConsolePrefillToken?: string;
@@ -730,7 +730,7 @@ export class EngramAccessHttpServer extends SupportPassportAccessHttpBase {
730
730
  /** Resolve namespace: only use the explicit body value. Adapter-inferred namespace
731
731
  * is intentionally NOT used as a fallback for REST requests — omitting namespace
732
732
  * should default to the server's global namespace, not silently scope to an adapter. */
733
- private resolveNamespace(_req: IncomingMessage, bodyNamespace?: string): string | undefined {
733
+ protected resolveNamespace(_req: IncomingMessage, bodyNamespace?: string): string | undefined {
734
734
  const namespace = bodyNamespace || undefined;
735
735
  // Per-token namespace enforcement (issues #1837/#1850): every HTTP
736
736
  // namespace-scoped route routes through this helper so none can dodge the
@@ -901,6 +901,7 @@ export class EngramAccessHttpServer extends SupportPassportAccessHttpBase {
901
901
  if (req.method === "POST" && pathname === "/mcp") return this.handleMcpRequest(req, res, abortSignal);
902
902
 
903
903
  if (await this.handleSupportPassportOwnerRequest(req, res, pathname, parsed.search.length > 0, abortSignal)) return;
904
+ if (await this.handleReviewDeckRequest(req, res, pathname, abortSignal)) return;
904
905
 
905
906
  if (req.method === "GET" && pathname === "/engram/v1/live") return this.respondJson(res, 200, { ok: true, ready: true });
906
907
  if (req.method === "GET" && pathname === "/engram/v1/health") {
@@ -3906,7 +3907,7 @@ export class EngramAccessHttpServer extends SupportPassportAccessHttpBase {
3906
3907
  * pass. Throws {@link EngramAccessForbiddenError} (→ 403) when a scoped
3907
3908
  * token calls a non-permitted op (issue #1837).
3908
3909
  */
3909
- private enforceTokenOp(op: OperationName): void {
3910
+ protected enforceTokenOp(op: OperationName): void {
3910
3911
  void getOperation(op); // preserve the registration side-effect assertion
3911
3912
  assertOperationAllowed(tokenCapabilityStore.getStore(), op);
3912
3913
  }
@@ -168,4 +168,42 @@ export const MCP_ADMIN_OPS_TOOLS: Array<{
168
168
  additionalProperties: false,
169
169
  },
170
170
  },
171
+ {
172
+ name: "engram.procedure_library_maintenance",
173
+ description:
174
+ "Run procedure library health maintenance (issue #2370): merge near-duplicate active procedures, flag stale-tool procedures for repair, and retire failure-dominant or idle ones — from Memory Worth + trajectory telemetry. Shadow-first: default run writes nothing and returns a proposed-transition report. apply=true (and procedural.maintenance.enabled) executes transitions; dryRun=true forces shadow.",
175
+ inputSchema: {
176
+ type: "object",
177
+ properties: {
178
+ namespace: { type: "string" },
179
+ apply: { type: "boolean" },
180
+ dryRun: { type: "boolean" },
181
+ },
182
+ additionalProperties: false,
183
+ },
184
+ },
185
+ {
186
+ name: "engram.preference_drift_scan",
187
+ description:
188
+ "Run a preference drift scan (issue #2371): classify aging preference memories as corroborated / stale / drifted from recent same-namespace evidence. Shadow-first — the default run reports only. apply=true (and driftDetection.enabled) stamps lastCorroborated / driftState and opens one review item per drifted preference. Never auto-deletes and never auto-supersedes.",
189
+ inputSchema: {
190
+ type: "object",
191
+ properties: {
192
+ namespace: { type: "string" },
193
+ apply: { type: "boolean" },
194
+ },
195
+ additionalProperties: false,
196
+ },
197
+ },
171
198
  ];
199
+
200
+ /**
201
+ * Tool-name → operation-name entries contributed by this module, spread into
202
+ * `MCP_MIGRATED_OPERATIONS` in access-mcp.ts. Declared here (rather than
203
+ * inline in the transport) for the same structural-ratchet reason the tool
204
+ * table above lives here. `remnic.*` aliases resolve by suffix, so only the
205
+ * `engram.*` name is listed.
206
+ */
207
+ export const MCP_ADMIN_OPS_MIGRATED_OPERATIONS: Readonly<Record<string, string>> = {
208
+ "engram.preference_drift_scan": "preference_drift_scan",
209
+ };
@@ -55,6 +55,7 @@ const TOOL_OUTPUT_SCHEMAS: Readonly<Record<string, Record<string, unknown>>> = {
55
55
  recall_tier_explain: objectSchema({ snapshotFound: T_BOOLEAN, tierExplain: T_NULLABLE_OBJECT }),
56
56
  recall_xray: objectSchema({ snapshotFound: T_BOOLEAN, snapshot: T_OBJECT }),
57
57
  who_knows: objectSchema({ topic: T_STRING, results: T_ARRAY }),
58
+ promotion_candidates: objectSchema({ namespace: T_STRING, targetNamespace: T_STRING, candidates: T_ARRAY }),
58
59
  set_coding_context: objectSchema({ ok: T_BOOLEAN }),
59
60
  wearables_status: objectSchema({
60
61
  enabled: T_BOOLEAN,
@@ -132,6 +133,11 @@ const TOOL_OUTPUT_SCHEMAS: Readonly<Record<string, Record<string, unknown>>> = {
132
133
  duplicatesSuperseded: T_NUMBER,
133
134
  }),
134
135
  procedural_stats: objectSchema({ namespace: T_STRING, counts: T_OBJECT, recent: T_OBJECT }),
136
+ procedure_library_maintenance: objectSchema({
137
+ enabled: T_BOOLEAN,
138
+ namespace: T_STRING,
139
+ report: T_OBJECT,
140
+ }),
135
141
  memory_get: objectSchema({ found: T_BOOLEAN, namespace: T_STRING, memory: T_NULLABLE_OBJECT }),
136
142
  memory_timeline: objectSchema({ found: T_BOOLEAN, namespace: T_STRING, count: T_NUMBER, timeline: T_ARRAY }),
137
143
  memory_store: objectSchema({
@@ -381,6 +387,20 @@ const TOOL_OUTPUT_SCHEMAS: Readonly<Record<string, Record<string, unknown>>> = {
381
387
  cooledDown: T_NUMBER,
382
388
  elapsedMs: T_NUMBER,
383
389
  }),
390
+ preference_drift_scan: objectSchema({
391
+ schemaVersion: T_NUMBER,
392
+ generatedAt: T_STRING,
393
+ mode: T_STRING,
394
+ namespace: T_STRING,
395
+ scanned: T_NUMBER,
396
+ eligible: T_NUMBER,
397
+ findings: T_ARRAY,
398
+ counts: T_OBJECT,
399
+ appliedCount: T_NUMBER,
400
+ reviewItemsOpened: T_NUMBER,
401
+ elapsedMs: T_NUMBER,
402
+ skippedReason: T_STRING,
403
+ }),
384
404
  memory_summarize_hourly: objectSchema({ ok: T_BOOLEAN, message: T_STRING }),
385
405
  conversation_index_update: objectSchema({
386
406
  enabled: T_BOOLEAN,
package/src/access-mcp.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { randomUUID } from "node:crypto";
2
2
  import {
3
- MCP_ADMIN_OPS_TOOLS,
3
+ MCP_ADMIN_OPS_MIGRATED_OPERATIONS, MCP_ADMIN_OPS_TOOLS,
4
4
  MCP_GIT_CONTEXT_SCHEMA_PROPS_IGNORED,
5
5
  } from "./access-mcp-admin-tools.js";
6
6
  import { readFile } from "node:fs/promises";
@@ -46,6 +46,7 @@ import { MCP_READ_ONLY_TOOL_SUFFIXES } from "./mcp-read-only-tools.js";
46
46
  import { MEETINGS_MCP_TOOLS } from "./meetings/mcp-tools.js";
47
47
  import { WEARABLES_MCP_TOOLS } from "./wearables/mcp-tools.js";
48
48
  import { WHO_KNOWS_MCP_TOOLS } from "./who-knows.js";
49
+ import { PROMOTION_CANDIDATES_MCP_TOOLS } from "./memory-subject.js";
49
50
  import { EXTERNAL_WIKI_MCP_TOOLS } from "./external-wiki-mcp-tools.js";
50
51
  import { abortError, isAbortError } from "./abort-error.js";
51
52
  import { SUPPORT_PASSPORT_MCP_MIGRATED_OPERATIONS, SUPPORT_PASSPORT_MCP_TOOLS } from "./support-passport/mcp-tools.js";
@@ -156,7 +157,7 @@ function withToolAliases(tool: McpTool, emitLegacyTools = true): McpTool[] {
156
157
  return emitLegacyTools ? [canonicalTool, tool] : [canonicalTool];
157
158
  }
158
159
 
159
- const MCP_MIGRATED_OPERATIONS: Readonly<Record<string, OperationName>> = {
160
+ export const MCP_MIGRATED_OPERATIONS: Readonly<Record<string, OperationName>> = {
160
161
  "engram.memory_get": "memory_get",
161
162
  "engram.memory_search": "memory_search",
162
163
  "engram.external_wiki_search": "external_wiki_search",
@@ -185,9 +186,8 @@ const MCP_MIGRATED_OPERATIONS: Readonly<Record<string, OperationName>> = {
185
186
  // Fully migrated through the strict-schema boundary (#1668).
186
187
  "engram.recall": "recall",
187
188
  "engram.recall_explain": "recall_explain",
188
- "engram.set_coding_context": "set_coding_context",
189
- "engram.recall_tier_explain": "recall_tier_explain",
190
- "engram.recall_xray": "recall_xray", "engram.who_knows": "who_knows",
189
+ "engram.set_coding_context": "set_coding_context", "engram.recall_tier_explain": "recall_tier_explain",
190
+ "engram.recall_xray": "recall_xray", "engram.who_knows": "who_knows", "engram.promotion_candidates": "promotion_candidates",
191
191
  "engram.wearables_status": "wearables_status",
192
192
  "engram.wearables_sync": "wearables_sync",
193
193
  "engram.transcript_day": "transcript_day",
@@ -203,7 +203,7 @@ const MCP_MIGRATED_OPERATIONS: Readonly<Record<string, OperationName>> = {
203
203
  "engram.entity_synthesis_run": "entity_synthesis_run",
204
204
  "engram.procedure_mining_run": "procedure_mining_run",
205
205
  "engram.pattern_reinforcement_run": "pattern_reinforcement_run",
206
- "engram.procedural_stats": "procedural_stats",
206
+ "engram.procedural_stats": "procedural_stats", "engram.procedure_library_maintenance": "procedure_library_maintenance",
207
207
  "engram.memory_timeline": "memory_timeline",
208
208
  "engram.suggestion_submit": "suggestion_submit",
209
209
  "engram.entity_get": "entity_get",
@@ -265,7 +265,7 @@ const MCP_MIGRATED_OPERATIONS: Readonly<Record<string, OperationName>> = {
265
265
  "engram.console_state": "console_state",
266
266
  "engram.dreams_status": "dreams_status",
267
267
  "engram.dreams_run": "dreams_run",
268
- ...SUPPORT_PASSPORT_MCP_MIGRATED_OPERATIONS,
268
+ ...SUPPORT_PASSPORT_MCP_MIGRATED_OPERATIONS, ...MCP_ADMIN_OPS_MIGRATED_OPERATIONS,
269
269
  "engram.memory_chat": "chat_message",
270
270
  };
271
271
 
@@ -706,7 +706,7 @@ export class EngramMcpServer {
706
706
  additionalProperties: false,
707
707
  },
708
708
  },
709
- ...WEARABLES_MCP_TOOLS, ...MEETINGS_MCP_TOOLS, ...WHO_KNOWS_MCP_TOOLS,
709
+ ...WEARABLES_MCP_TOOLS, ...MEETINGS_MCP_TOOLS, ...WHO_KNOWS_MCP_TOOLS, ...PROMOTION_CANDIDATES_MCP_TOOLS,
710
710
  ...(service.supportPassportEnabled ? SUPPORT_PASSPORT_MCP_TOOLS : []),
711
711
  {
712
712
  name: "engram.action_confidence",
@@ -35,6 +35,7 @@ import {
35
35
  import { listPairs, isDefaultReviewNamespace, readPair } from "./contradiction/contradiction-review.js";
36
36
  import { executeResolution, isValidResolutionVerb } from "./contradiction/resolution.js";
37
37
  import { runContradictionScan } from "./contradiction/contradiction-scan.js";
38
+ import { runPreferenceDriftScan } from "./preferences/preference-drift.js";
38
39
  import { runGraphEdgeDecayMaintenanceAcrossNamespaces } from "./maintenance/graph-edge-decay.js";
39
40
  import { normalizeDreamsStatusWindowHours } from "./maintenance/dreams-ledger.js";
40
41
 
@@ -147,6 +148,13 @@ defineOperation({ name: "who_knows", description: "Rank entities by demonstrated
147
148
  return { result: await ctx.service.whoKnows({ topic, ...(limit !== undefined ? { limit } : {}), namespace: optStr(input.namespace), authenticatedPrincipal: ctx.authenticatedPrincipal }) };
148
149
  },
149
150
  });
151
+ defineOperation({ name: "promotion_candidates", description: "List agent-subject reuse-signaled promotion candidates (#2372).", schema: strictSchema({ namespace: S.str, targetNamespace: S.str, limit: S.flexNum }),
152
+ handler: async (input, ctx) => {
153
+ let limit: number | undefined;
154
+ if (input.limit !== undefined) { const p = typeof input.limit === "number" ? input.limit : Number(input.limit); if (!Number.isInteger(p) || p < 1 || p > 100) throw new EngramAccessInputError("promotion_candidates: limit expects an integer in [1, 100]"); limit = p; }
155
+ return { result: await ctx.service.promotionCandidates({ ...(limit !== undefined ? { limit } : {}), namespace: optStr(input.namespace), targetNamespace: optStr(input.targetNamespace), authenticatedPrincipal: ctx.authenticatedPrincipal }) };
156
+ },
157
+ });
150
158
  defineOperation({ name: "namespace_writable", description: "Read-only preflight: is a namespace writable for the caller's principal?", allowedByOps: ["namespace_writable", "observe", "memory_store"], schema: strictSchema({ namespace: S.str, sessionKey: S.str, op: S.str, cwd: S.str, projectTag: S.str }), handler: async (input, ctx) => {
151
159
  const writeOp = parseNamespacePreflightWriteOp(optStr(input.op));
152
160
  const namespace = optStr(input.namespace);
@@ -213,6 +221,7 @@ defineOperation({ name: "entity_synthesis_run", description: "Bulk-drain the ent
213
221
  defineOperation({ name: "procedure_mining_run", description: "Run procedure mining.", schema: strictSchema({ namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.procedureMiningRun({ namespace: optStr(input.namespace), authenticatedPrincipal: ctx.authenticatedPrincipal }, ctx.authenticatedPrincipal) }) });
214
222
  defineOperation({ name: "pattern_reinforcement_run", description: "Run pattern reinforcement.", schema: strictSchema({ namespace: S.str, force: S.bool }), handler: async (input, ctx) => ({ result: await ctx.service.patternReinforcementRun({ namespace: optStr(input.namespace), force: input.force === true, authenticatedPrincipal: ctx.authenticatedPrincipal }, ctx.authenticatedPrincipal) }) });
215
223
  defineOperation({ name: "procedural_stats", description: "Procedural stats.", schema: strictSchema({ namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.procedureStats({ namespace: optStr(input.namespace) }, ctx.authenticatedPrincipal) }) });
224
+ defineOperation({ name: "procedure_library_maintenance", description: "Run procedure library maintenance (issue #2370): shadow-first merge / repair-flag / retire from outcome telemetry. apply=true plus procedural.maintenance.enabled required for writes.", schema: strictSchema({ namespace: S.str, apply: S.bool, dryRun: S.bool }), handler: async (input, ctx) => ({ result: await ctx.service.procedureLibraryMaintenance({ namespace: optStr(input.namespace), apply: input.apply === true, dryRun: input.dryRun === true, authenticatedPrincipal: ctx.authenticatedPrincipal }, ctx.authenticatedPrincipal) }) });
216
225
 
217
226
  // === MEMORY/ENTITY/OBSERVE/LCM ===
218
227
  defineOperation({ name: "memory_timeline", description: "Memory timeline.", schema: strictSchema({ memoryId: S.str, namespace: S.str, limit: S.num }), handler: async (input, ctx) => ({ result: await ctx.service.memoryTimeline(optStr(input.memoryId) ?? "", optStr(input.namespace), optNum(input.limit) ?? 200, ctx.authenticatedPrincipal) }) });
@@ -339,6 +348,7 @@ defineOperation({ name: "review_resolve", description: "Resolve pair.", schema:
339
348
  },
340
349
  });
341
350
  defineOperation({ name: "contradiction_scan_run", description: "Run scan.", schema: strictSchema({ namespace: S.str }), handler: async (input, ctx) => ({ result: await runContradictionScan({ storage: ctx.service.storageRef, config: ctx.service.configRef, memoryDir: ctx.service.memoryDir, embeddingLookupFactory: ctx.service.embeddingLookupFactoryRef, storageForNamespace: (ns) => ctx.service.getWritableStorageForNamespace(ns ?? undefined, ctx.authenticatedPrincipal), localLlm: ctx.service.localLlmRef, fallbackLlm: ctx.service.fallbackLlmRef, namespace: optStr(input.namespace) }) }) });
351
+ defineOperation({ name: "preference_drift_scan", description: "Run preference drift scan.", schema: strictSchema({ namespace: S.str, apply: S.bool }), handler: async (input, ctx) => ({ result: await runPreferenceDriftScan({ storage: ctx.service.storageRef, config: ctx.service.configRef, memoryDir: ctx.service.memoryDir, embeddingLookupFactory: ctx.service.embeddingLookupFactoryRef, storageForNamespace: (ns) => ctx.service.getWritableStorageForNamespace(ns ?? undefined, ctx.authenticatedPrincipal), localLlm: ctx.service.localLlmRef, fallbackLlm: ctx.service.fallbackLlmRef, namespace: optStr(input.namespace), apply: input.apply === true }) }) });
342
352
  defineOperation({ name: "graph_edge_decay_run", description: "Run edge decay.", fleetWide: true, schema: strictSchema({ dryRun: S.bool }), handler: async (input, ctx) => { const cfg = ctx.service.configRef; if (!cfg.graphEdgeDecayEnabled) return { result: { ranAt: new Date().toISOString(), disabled: true, reason: "graphEdgeDecayEnabled is false" } }; return { result: { results: await runGraphEdgeDecayMaintenanceAcrossNamespaces(ctx.service.memoryDir, { windowMs: cfg.graphEdgeDecayWindowMs, perWindow: cfg.graphEdgeDecayPerWindow, floor: cfg.graphEdgeDecayFloor, visibilityThreshold: cfg.graphEdgeDecayVisibilityThreshold, dryRun: input.dryRun === true, namespacesEnabled: cfg.namespacesEnabled === true, defaultNamespace: cfg.defaultNamespace }) } }; } });
343
353
 
344
354
  // === SUMMARIZE/PROFILING/PEERS/CONSOLE/DREAMS ===
@@ -389,6 +399,9 @@ defineOperation({ name: "quality_status", description: "Quality status.", schema
389
399
  defineOperation({ name: "trust_zones_status", description: "Trust-zone status.", schema: strictSchema({}), handler: async (_i, ctx) => ({ result: await ctx.service.trustZoneStatus() }) });
390
400
  defineOperation({ name: "trust_zones_records", description: "Browse trust-zone records.", schema: strictSchema({ namespace: S.str, limit: S.num, offset: S.num }), handler: async (input, ctx) => ({ result: await ctx.service.trustZoneBrowse({ namespace: optStr(input.namespace), limit: optNum(input.limit), offset: optNum(input.offset) }, ctx.authenticatedPrincipal) }) });
391
401
  defineOperation({ name: "review_disposition", description: "Review disposition.", schema: strictSchema({ memoryId: S.str, status: S.str, reasonCode: S.str, namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.reviewDisposition({ memoryId: optStr(input.memoryId) ?? "", status: (optStr(input.status) ?? "archived") as never, reasonCode: optStr(input.reasonCode) ?? "", namespace: optStr(input.namespace), authenticatedPrincipal: ctx.authenticatedPrincipal }) }) });
402
+ defineOperation({ name: "review_deck_list", description: "List review deck.", schema: strictSchema({ namespace: S.str, cursor: S.str, limit: S.num }), handler: async (input, ctx) => ({ result: await ctx.service.reviewDeckList({ namespace: optStr(input.namespace), principal: ctx.authenticatedPrincipal, cursor: optStr(input.cursor), limit: optNum(input.limit) ?? 1 }) }) });
403
+ defineOperation({ name: "review_deck_action", description: "Apply review deck action.", schema: strictSchema({ itemId: S.str, revision: S.str, action: S.str, correctionText: S.str, idempotencyKey: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.reviewDeckAction({ schemaVersion: 1, itemId: reqStr(input.itemId, "itemId"), revision: reqStr(input.revision, "revision"), action: reqStr(input.action, "action") as "keep", idempotencyKey: reqStr(input.idempotencyKey, "idempotencyKey"), ...(optStr(input.correctionText) ? { correctionText: optStr(input.correctionText)! } : {}) } as never, { principal: ctx.authenticatedPrincipal, signal: ctx.abortSignal }) }) });
404
+ defineOperation({ name: "review_deck_undo", description: "Undo review deck action.", schema: strictSchema({ receiptId: S.str, expectedRevision: S.str, idempotencyKey: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.reviewDeckUndo({ schemaVersion: 1, receiptId: reqStr(input.receiptId, "receiptId"), expectedRevision: reqStr(input.expectedRevision, "expectedRevision"), idempotencyKey: reqStr(input.idempotencyKey, "idempotencyKey") }, { principal: ctx.authenticatedPrincipal, signal: ctx.abortSignal }) }) });
392
405
  defineOperation({ name: "trust_zones_promote", description: "Promote trust-zone.", schema: strictSchema({ recordId: S.str, targetZone: S.str, promotionReason: S.str, dryRun: S.bool, namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.trustZonePromote({ recordId: optStr(input.recordId) ?? "", targetZone: (optStr(input.targetZone) ?? "working") as never, promotionReason: optStr(input.promotionReason) ?? "", dryRun: input.dryRun === true, namespace: optStr(input.namespace), authenticatedPrincipal: ctx.authenticatedPrincipal }) }) });
393
406
  defineOperation({ name: "trust_zones_demo_seed", description: "Demo seed.", schema: strictSchema({ scenario: S.str, dryRun: S.bool, namespace: S.str }), handler: async (input, ctx) => ({ result: await ctx.service.trustZoneDemoSeed({ scenario: optStr(input.scenario), dryRun: input.dryRun === true, namespace: optStr(input.namespace), authenticatedPrincipal: ctx.authenticatedPrincipal }) }) });
394
407
  defineOperation({ name: "citations_observed", description: "Record citations.", schema: strictSchema({}), handler: async (_i, _ctx) => ({ result: { ok: true } }) });
@@ -201,6 +201,10 @@ import type {
201
201
  RecallInvocationOptions,
202
202
  } from "./orchestrator.js";
203
203
  import { type ProcedureStatsReport, computeProcedureStats } from "./procedural/procedure-stats.js";
204
+ import {
205
+ runProcedureLibraryMaintenance,
206
+ type ProcedureLibraryMaintenanceReport,
207
+ } from "./procedural/library-maintenance.js";
204
208
  import type { RecallContextComposition } from "./recall-context-composition.js";
205
209
  import type { LastRecallSnapshot } from "./recall-state.js";
206
210
  import {
@@ -299,12 +303,14 @@ import {
299
303
  readOfflineSyncFileContentChunk,
300
304
  } from "./offline-sync.js";
301
305
  import { selfDeps } from "./orchestration/self-deps.js";
306
+ import { ReviewDeckSurface } from "./review/review-deck-surface.js";
302
307
  import { formatProfileTraceAscii } from "./profiling.js";
303
308
  import { decideDisclosureEscalation } from "./recall-disclosure-escalation.js";
304
309
  import { toRecallExplainJson } from "./recall-explain-renderer.js";
305
310
  import { type TagMatchMode, applyTagFilter, normalizeTags, parseTagMatch } from "./recall-tag-filter.js";
306
311
  import { type RecallXraySnapshot, estimateRecallTokens } from "./recall-xray.js";
307
312
  import { computeWhoKnows, loadWhoKnowsEntities, validateWhoKnowsInput, WHO_KNOWS_DEFAULT_LIMIT, type WhoKnowsResult } from "./who-knows.js";
313
+ import { computePromotionCandidates, type PromotionCandidatesResult } from "./memory-subject.js";
308
314
  import { SupportPassportAccessServiceBase } from "./support-passport/access-service-base.js";
309
315
  import {
310
316
  type ExportCapsuleOptions,
@@ -1238,6 +1244,7 @@ export class EngramAccessService extends SupportPassportAccessServiceBase {
1238
1244
  private readonly corpusWatermarkCache = new CorpusWatermarkCache();
1239
1245
  private readonly replicaDivergenceMonitor: ReplicaDivergenceMonitor;
1240
1246
  private readonly injectedSupportPassportGatewayRoute: SupportPassportModelRoute | null;
1247
+ readonly reviewDeckEnabled: boolean;
1241
1248
 
1242
1249
  /** AccessObserveWriteSurface (access-service decomposition). Lazy; selfDeps live wiring. */
1243
1250
  private _accessObserveWriteSurface: AccessObserveWriteSurface | undefined;
@@ -1273,6 +1280,17 @@ export class EngramAccessService extends SupportPassportAccessServiceBase {
1273
1280
  return this._accessAdminOpsSurface;
1274
1281
  }
1275
1282
 
1283
+ private _reviewDeckSurface: ReviewDeckSurface | undefined;
1284
+
1285
+ private get reviewDeckSurface(): ReviewDeckSurface {
1286
+ if (!this._reviewDeckSurface) {
1287
+ this._reviewDeckSurface = new ReviewDeckSurface(
1288
+ selfDeps<ConstructorParameters<typeof ReviewDeckSurface>[0]>(this)
1289
+ );
1290
+ }
1291
+ return this._reviewDeckSurface;
1292
+ }
1293
+
1276
1294
  /** AccessRecallSurface (access-service decomposition). Lazy; selfDeps live wiring. */
1277
1295
  private _accessRecallSurface: AccessRecallSurface | undefined;
1278
1296
 
@@ -1303,6 +1321,7 @@ export class EngramAccessService extends SupportPassportAccessServiceBase {
1303
1321
  options: {
1304
1322
  resolveSecretRef?: ResolveSecretRefFn | null;
1305
1323
  supportPassportGatewayRoute?: SupportPassportModelRoute | null;
1324
+ reviewDeckEnabled?: boolean;
1306
1325
  } = {}
1307
1326
  ) {
1308
1327
  super();
@@ -1313,6 +1332,7 @@ export class EngramAccessService extends SupportPassportAccessServiceBase {
1313
1332
  // per-peer `unreachable` (never a throw).
1314
1333
  this.replicaDivergenceMonitor = new ReplicaDivergenceMonitor({ resolveSecretRef: options.resolveSecretRef });
1315
1334
  this.injectedSupportPassportGatewayRoute = options.supportPassportGatewayRoute ?? null;
1335
+ this.reviewDeckEnabled = options.reviewDeckEnabled === true;
1316
1336
  const accessCaps = resolveAccessSetupCapabilities(orchestrator.config); // #1566 Cluster B
1317
1337
  this.budget = new CrossNamespaceBudget({
1318
1338
  enabled: accessCaps.recallCrossNamespaceBudget,
@@ -2738,6 +2758,41 @@ export class EngramAccessService extends SupportPassportAccessServiceBase {
2738
2758
  ]);
2739
2759
  return computeWhoKnows({ topic, limit, memories, entities });
2740
2760
  }
2761
+ /**
2762
+ * Read-only promotion-candidate surfacing (issue #2372): agent-subject,
2763
+ * active, reuse-signaled memories in the caller's namespace with no
2764
+ * equivalent in the target layer. No auto-promotion — callers use the
2765
+ * existing promotion commands.
2766
+ */
2767
+ async promotionCandidates(request: {
2768
+ namespace?: string;
2769
+ targetNamespace?: string;
2770
+ limit?: number;
2771
+ authenticatedPrincipal?: string;
2772
+ }): Promise<PromotionCandidatesResult> {
2773
+ const limit = request.limit ?? 20;
2774
+ if (!Number.isInteger(limit) || limit < 1 || limit > 100) {
2775
+ throw new EngramAccessInputError(
2776
+ `promotion_candidates: limit expects an integer in [1, 100] (got ${String(request.limit)})`,
2777
+ );
2778
+ }
2779
+ const resolvedNamespace = this.resolveReadableNamespace(request.namespace, request.authenticatedPrincipal);
2780
+ const resolvedTarget = this.resolveReadableNamespace(
2781
+ request.targetNamespace ?? this.orchestrator.config.sharedNamespace,
2782
+ request.authenticatedPrincipal,
2783
+ );
2784
+ const minAccessCount = this.orchestrator.config.promotionCandidates.minAccessCount;
2785
+ const [memories, targetMemories] = await Promise.all([
2786
+ (await this.orchestrator.getStorage(resolvedNamespace)).readAllMemories(),
2787
+ (await this.orchestrator.getStorage(resolvedTarget)).readAllMemories(),
2788
+ ]);
2789
+ return {
2790
+ namespace: resolvedNamespace,
2791
+ targetNamespace: resolvedTarget,
2792
+ minAccessCount,
2793
+ candidates: computePromotionCandidates({ memories, targetMemories, minAccessCount, limit }),
2794
+ };
2795
+ }
2741
2796
  async memoryStore(
2742
2797
  request: EngramAccessMemoryStoreRequest,
2743
2798
  hooks?: { enforceWriteQuota?: () => void | Promise<void> }
@@ -3580,6 +3635,51 @@ export class EngramAccessService extends SupportPassportAccessServiceBase {
3580
3635
  return { namespace: resolvedNamespace, ...report };
3581
3636
  }
3582
3637
 
3638
+ /**
3639
+ * Procedure library health maintenance (issue #2370). Shadow-first: the
3640
+ * gate is checked BEFORE any storage read, so `maintenance.enabled=false`
3641
+ * returns `{ enabled: false }` having touched nothing but config. Apply
3642
+ * mode additionally requires `apply: true`; `dryRun: true` forces shadow.
3643
+ *
3644
+ * The authenticated principal (never a client-supplied actor) drives the
3645
+ * namespace via the same writable resolver `procedureMiningRun` uses, so
3646
+ * cross-tenant writes are impossible.
3647
+ */
3648
+ async procedureLibraryMaintenance(
3649
+ request: {
3650
+ namespace?: string;
3651
+ apply?: boolean;
3652
+ dryRun?: boolean;
3653
+ authenticatedPrincipal?: string;
3654
+ },
3655
+ principal?: string
3656
+ ): Promise<
3657
+ | { enabled: false }
3658
+ | {
3659
+ enabled: true;
3660
+ namespace: string;
3661
+ report: ProcedureLibraryMaintenanceReport;
3662
+ }
3663
+ > {
3664
+ const procedural = this.orchestrator.config.procedural;
3665
+ if (procedural?.enabled !== true || procedural.maintenance?.enabled !== true) {
3666
+ return { enabled: false };
3667
+ }
3668
+ const resolvedNamespace = this.writableNamespaceFor(
3669
+ request.namespace,
3670
+ undefined,
3671
+ request.authenticatedPrincipal ?? principal
3672
+ );
3673
+ const storage = await this.orchestrator.getStorage(resolvedNamespace);
3674
+ const report = await runProcedureLibraryMaintenance({
3675
+ memoryDir: storage.dir,
3676
+ storage,
3677
+ config: this.orchestrator.config,
3678
+ apply: request.apply === true && request.dryRun !== true,
3679
+ });
3680
+ return { enabled: true, namespace: resolvedNamespace, report };
3681
+ }
3682
+
3583
3683
  async memorySummarizeHourly(): Promise<{
3584
3684
  ok: true;
3585
3685
  message: string;
@@ -5602,4 +5702,16 @@ export class EngramAccessService extends SupportPassportAccessServiceBase {
5602
5702
  }) {
5603
5703
  return this.accessAdminOpsSurface.adminPromoteMemory(request);
5604
5704
  }
5705
+
5706
+ async reviewDeckList(opts: Parameters<ReviewDeckSurface["list"]>[0]) {
5707
+ return this.reviewDeckSurface.list(opts);
5708
+ }
5709
+
5710
+ async reviewDeckAction(...args: Parameters<ReviewDeckSurface["action"]>) {
5711
+ return this.reviewDeckSurface.action(...args);
5712
+ }
5713
+
5714
+ async reviewDeckUndo(...args: Parameters<ReviewDeckSurface["undo"]>) {
5715
+ return this.reviewDeckSurface.undo(...args);
5716
+ }
5605
5717
  }
@@ -170,6 +170,14 @@ function extractMcpDispatchMap(): Map<string, string> {
170
170
  new URL("./support-passport/mcp-tools.ts", import.meta.url),
171
171
  "SUPPORT_PASSPORT_MCP_MIGRATED_OPERATIONS",
172
172
  ),
173
+ // Third dispatch home (issue #2371): the admin/maintenance tool table
174
+ // contributes its own map fragment, spread into MCP_MIGRATED_OPERATIONS.
175
+ // Every module that can register a dispatch entry must be read here, or
176
+ // this validator reports a false "no dispatch wiring".
177
+ ...extractMcpOperationMap(
178
+ new URL("./access-mcp-admin-tools.ts", import.meta.url),
179
+ "MCP_ADMIN_OPS_MIGRATED_OPERATIONS",
180
+ ),
173
181
  ]);
174
182
  }
175
183
 
@@ -317,6 +325,22 @@ function extractHttpRouteDispatchMap(): Map<string, Set<string>> {
317
325
  }
318
326
  }
319
327
  }
328
+ if (/\bawait\s+this\.handleReviewDeckRequest\(/.test(source)) {
329
+ const deckSource = readFileSync(
330
+ new URL("./review/review-deck-http-base.ts", import.meta.url),
331
+ "utf-8",
332
+ );
333
+ const deckRoutes = [
334
+ ["GET", "/engram/v1/review/deck", "review_deck_list"],
335
+ ["POST", "/engram/v1/review/deck/action", "review_deck_action"],
336
+ ["POST", "/engram/v1/review/deck/undo", "review_deck_undo"],
337
+ ] as const;
338
+ for (const [method, pathname, operation] of deckRoutes) {
339
+ if (deckSource.includes(`"${pathname}"`) && deckSource.includes(`enforceTokenOp("${operation}")`)) {
340
+ routeOps.set(`${method} ${pathname}`, new Set([operation]));
341
+ }
342
+ }
343
+ }
320
344
  for (const [sourcePath, routes] of [
321
345
  ["./support-passport/access-http.ts", SUPPORT_PASSPORT_OWNER_HTTP_ROUTES],
322
346
  ["./support-passport/public-http.ts", SUPPORT_PASSPORT_PUBLIC_HTTP_ROUTES],
@@ -57,6 +57,7 @@ export const MCP_TOOLS: readonly McpToolEntry[] = [
57
57
  { tool: "recall_tier_explain", operation: "recall_tier_explain" },
58
58
  { tool: "recall_xray", operation: "recall_xray" },
59
59
  { tool: "who_knows", operation: "who_knows" },
60
+ { tool: "promotion_candidates", operation: "promotion_candidates" },
60
61
  { tool: "wearables_status", operation: "wearables_status" },
61
62
  { tool: "wearables_sync", operation: "wearables_sync" },
62
63
  { tool: "transcript_day", operation: "transcript_day" },
@@ -76,6 +77,7 @@ export const MCP_TOOLS: readonly McpToolEntry[] = [
76
77
  { tool: "procedure_mining_run", operation: "procedure_mining_run" },
77
78
  { tool: "pattern_reinforcement_run", operation: "pattern_reinforcement_run" },
78
79
  { tool: "procedural_stats", operation: "procedural_stats" },
80
+ { tool: "procedure_library_maintenance", operation: "procedure_library_maintenance" },
79
81
  { tool: "memory_get", operation: "memory_get" },
80
82
  { tool: "memory_timeline", operation: "memory_timeline" },
81
83
  { tool: "memory_store", operation: "memory_store" },
@@ -151,6 +153,7 @@ export const MCP_TOOLS: readonly McpToolEntry[] = [
151
153
  { tool: "review_list", operation: "review_list" },
152
154
  { tool: "review_resolve", operation: "review_resolve" },
153
155
  { tool: "contradiction_scan_run", operation: "contradiction_scan_run" },
156
+ { tool: "preference_drift_scan", operation: "preference_drift_scan" },
154
157
  { tool: "memory_summarize_hourly", operation: "memory_summarize_hourly" },
155
158
  { tool: "conversation_index_update", operation: "conversation_index_update" },
156
159
  { tool: "profiling_report", operation: "profiling_report" },
@@ -251,6 +254,9 @@ export const HTTP_ROUTES: readonly HttpRouteEntry[] = [
251
254
  { method: "GET", pathname: "/engram/v1/procedural/stats", operation: "procedural_stats" },
252
255
  { method: "GET", pathname: "/engram/v1/trust-zones/records", operation: "trust_zones_records" },
253
256
  { method: "POST", pathname: "/engram/v1/review-disposition", operation: "review_disposition" },
257
+ { method: "GET", pathname: "/engram/v1/review/deck", operation: "review_deck_list" },
258
+ { method: "POST", pathname: "/engram/v1/review/deck/action", operation: "review_deck_action" },
259
+ { method: "POST", pathname: "/engram/v1/review/deck/undo", operation: "review_deck_undo" },
254
260
  { method: "POST", pathname: "/engram/v1/trust-zones/promote", operation: "trust_zones_promote" },
255
261
  { method: "POST", pathname: "/engram/v1/trust-zones/demo-seed", operation: "trust_zones_demo_seed" },
256
262
  { method: "POST", pathname: "/v1/citations/observed", operation: "citations_observed" },