@remnic/core 9.30.0 → 9.31.0

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 (495) hide show
  1. package/dist/access-admin-ops-surface.d.ts +10 -10
  2. package/dist/access-admin-ops-surface.js +50 -44
  3. package/dist/access-authorization-probe.d.ts +10 -10
  4. package/dist/access-authorization-probe.js +51 -45
  5. package/dist/access-boundary.d.ts +13 -11
  6. package/dist/access-boundary.js +50 -44
  7. package/dist/access-cli.js +168 -123
  8. package/dist/access-cli.js.map +1 -1
  9. package/dist/access-extraction-force-flush.d.ts +119 -0
  10. package/dist/access-extraction-force-flush.js +166 -0
  11. package/dist/access-health-types.d.ts +1 -1
  12. package/dist/access-http-lcm-compaction.d.ts +47 -13
  13. package/dist/access-http-lcm-compaction.js +7 -3
  14. package/dist/access-http-lifecycle-flush.d.ts +132 -0
  15. package/dist/access-http-lifecycle-flush.js +9 -0
  16. package/dist/access-http-lifecycle-flush.js.map +1 -0
  17. package/dist/access-http.d.ts +11 -10
  18. package/dist/access-http.js +66 -59
  19. package/dist/access-identity-continuity-surface.d.ts +8 -8
  20. package/dist/access-identity-continuity-surface.js +50 -44
  21. package/dist/access-lcm-surface.d.ts +10 -10
  22. package/dist/access-lcm-surface.js +50 -44
  23. package/dist/access-mcp-output-schemas.js +1 -1
  24. package/dist/access-mcp.d.ts +16 -10
  25. package/dist/access-mcp.js +58 -52
  26. package/dist/access-memory-search-fanout.d.ts +2 -2
  27. package/dist/{access-namespace-preflight-VfXssvoI.d.ts → access-namespace-preflight-D4vW97H1.d.ts} +1 -1
  28. package/dist/access-namespace-preflight.d.ts +3 -3
  29. package/dist/access-namespace-preflight.js +50 -44
  30. package/dist/access-observe-helpers.d.ts +22 -0
  31. package/dist/access-observe-helpers.js +10 -0
  32. package/dist/access-observe-helpers.js.map +1 -0
  33. package/dist/access-observe-write-surface.d.ts +51 -47
  34. package/dist/access-observe-write-surface.js +50 -44
  35. package/dist/access-operations-batch.js +53 -47
  36. package/dist/access-operations.d.ts +11 -11
  37. package/dist/access-operations.js +55 -49
  38. package/dist/access-recall-concurrency.d.ts +10 -10
  39. package/dist/access-recall-concurrency.js +50 -44
  40. package/dist/access-recall-response.d.ts +10 -10
  41. package/dist/access-recall-response.js +50 -44
  42. package/dist/access-recall-surface.d.ts +10 -10
  43. package/dist/access-recall-surface.js +50 -44
  44. package/dist/access-schema.d.ts +37 -7
  45. package/dist/access-schema.js +5 -3
  46. package/dist/{access-service-B5RwVsTV.d.ts → access-service-B6PZ_xUL.d.ts} +44 -20
  47. package/dist/access-service-helpers.d.ts +113 -0
  48. package/dist/access-service-helpers.js +8 -0
  49. package/dist/access-service-helpers.js.map +1 -0
  50. package/dist/access-service.d.ts +10 -10
  51. package/dist/access-service.js +50 -44
  52. package/dist/access-surface-catalog.d.ts +10 -10
  53. package/dist/access-surface-catalog.js +2 -0
  54. package/dist/access-surface-catalog.js.map +1 -1
  55. package/dist/access-wearables-meetings-surface.d.ts +3 -3
  56. package/dist/action-confidence.d.ts +1 -1
  57. package/dist/active-memory-bridge.d.ts +1 -1
  58. package/dist/active-recall.d.ts +1 -1
  59. package/dist/active-recall.js +1 -1
  60. package/dist/adapters/index.js +7 -7
  61. package/dist/adapters/registry.js +3 -3
  62. package/dist/behavior-learner.d.ts +1 -1
  63. package/dist/behavior-signals.d.ts +1 -1
  64. package/dist/bootstrap.d.ts +8 -8
  65. package/dist/briefing.d.ts +2 -2
  66. package/dist/briefing.js +14 -14
  67. package/dist/buffer-surprise-report.d.ts +1 -1
  68. package/dist/buffer-turn-helpers.d.ts +5 -0
  69. package/dist/buffer-turn-helpers.js +24 -0
  70. package/dist/buffer-turn-helpers.js.map +1 -0
  71. package/dist/buffer.d.ts +17 -4
  72. package/dist/buffer.js +21 -1
  73. package/dist/bulk-import/index.d.ts +3 -3
  74. package/dist/calibration.d.ts +1 -1
  75. package/dist/capabilities.d.ts +1 -1
  76. package/dist/{capsule-crypto-GWVG7LGC.js → capsule-crypto-7FJQINUR.js} +2 -2
  77. package/dist/capsule-crypto-7FJQINUR.js.map +1 -0
  78. package/dist/{capsule-merge-5KKJQBWQ.js → capsule-merge-2H2IUTBT.js} +4 -4
  79. package/dist/{catalog-V7inUQdp.d.ts → catalog-CGFYmTT8.d.ts} +1 -1
  80. package/dist/causal-behavior.d.ts +1 -1
  81. package/dist/causal-behavior.js +2 -2
  82. package/dist/causal-chain.js +2 -2
  83. package/dist/causal-consolidation.d.ts +1 -1
  84. package/dist/causal-consolidation.js +19 -19
  85. package/dist/causal-retrieval.js +2 -2
  86. package/dist/causal-trajectory-graph.d.ts +1 -1
  87. package/dist/causal-trajectory.js +1 -1
  88. package/dist/{chunk-LEPOP46W.js → chunk-227UFSEQ.js} +4 -4
  89. package/dist/{chunk-GIBMDSJ2.js → chunk-27P5YVDU.js} +2 -2
  90. package/dist/{chunk-2SA56WMI.js → chunk-2LTDWSR6.js} +4 -4
  91. package/dist/{chunk-OWHERGF2.js → chunk-2NLLXCJG.js} +2 -2
  92. package/dist/{chunk-YTSNAUXN.js → chunk-3F2LKUMU.js} +22 -8
  93. package/dist/chunk-3F2LKUMU.js.map +1 -0
  94. package/dist/chunk-3QL24R5Y.js +9 -0
  95. package/dist/chunk-3QL24R5Y.js.map +1 -0
  96. package/dist/chunk-4RNZMRAV.js +60 -0
  97. package/dist/chunk-4RNZMRAV.js.map +1 -0
  98. package/dist/{chunk-6U7F52DE.js → chunk-4XHR3I67.js} +60 -60
  99. package/dist/chunk-5IVLTFOV.js +65 -0
  100. package/dist/chunk-5IVLTFOV.js.map +1 -0
  101. package/dist/{chunk-2EUVEDF5.js → chunk-5XA7PQ5I.js} +2 -2
  102. package/dist/{chunk-ALSGMEJR.js → chunk-65ZPVYTA.js} +7 -7
  103. package/dist/{chunk-5VQJBH2G.js → chunk-6TAUHL33.js} +2 -2
  104. package/dist/{chunk-HUHX2OCX.js → chunk-7DRETLP5.js} +1 -1
  105. package/dist/chunk-7DRETLP5.js.map +1 -0
  106. package/dist/{chunk-RGIWINDN.js → chunk-7G5MH4NT.js} +30 -30
  107. package/dist/{chunk-WVO4G37W.js → chunk-7TEZUUGM.js} +3 -3
  108. package/dist/{chunk-MJCGLM25.js → chunk-7VUAG236.js} +5 -5
  109. package/dist/{chunk-M3C2V3PV.js → chunk-AJEMDQNA.js} +12 -12
  110. package/dist/{chunk-RKNJBZ55.js → chunk-AU7Q3LSC.js} +7 -7
  111. package/dist/{chunk-ACXPX4AG.js → chunk-BR2K43MK.js} +2 -2
  112. package/dist/{chunk-IYZ5K7MU.js → chunk-BUE5E2HL.js} +4 -187
  113. package/dist/chunk-BUE5E2HL.js.map +1 -0
  114. package/dist/{chunk-CZRYLSSW.js → chunk-BUGVGH4N.js} +2 -2
  115. package/dist/{chunk-YTQNQ4KB.js → chunk-C4VQMFVM.js} +3 -3
  116. package/dist/{chunk-ZPSVBSOF.js → chunk-CIVDJD6P.js} +3 -3
  117. package/dist/{chunk-K5GB36ME.js → chunk-CZDOT5I2.js} +2 -2
  118. package/dist/{chunk-VI2JQPNQ.js → chunk-E4PWACUN.js} +2 -2
  119. package/dist/{chunk-D2ANTDGO.js → chunk-E6BMSH7U.js} +2 -2
  120. package/dist/{chunk-P5PXWTW7.js → chunk-EJCAV3QZ.js} +3 -3
  121. package/dist/{chunk-CKMO4RDY.js → chunk-EMDLM3LW.js} +4 -4
  122. package/dist/chunk-ER7W6H4T.js +112 -0
  123. package/dist/chunk-ER7W6H4T.js.map +1 -0
  124. package/dist/{chunk-6FUPCJUL.js → chunk-FI4F5X2V.js} +54 -54
  125. package/dist/chunk-FI4F5X2V.js.map +1 -0
  126. package/dist/{chunk-LGHKJABJ.js → chunk-GOUILH55.js} +40 -18
  127. package/dist/chunk-GOUILH55.js.map +1 -0
  128. package/dist/{chunk-G5R3D5UP.js → chunk-GTTAHHD3.js} +2 -2
  129. package/dist/{chunk-H5CPS5JP.js → chunk-H36LJIPD.js} +3 -3
  130. package/dist/{chunk-AITCS2RC.js → chunk-IJ7HK452.js} +4 -4
  131. package/dist/{chunk-D3LMYTBV.js → chunk-J7WZUL2K.js} +9 -9
  132. package/dist/{chunk-5W4ZLBEZ.js → chunk-JCFTIQBR.js} +2 -2
  133. package/dist/{chunk-XOZ4ALGB.js → chunk-KE353EWI.js} +3 -3
  134. package/dist/{chunk-W5EG6LE3.js → chunk-KIT6M7EB.js} +3 -3
  135. package/dist/{chunk-5W7CTZ2E.js → chunk-KQAFEZQX.js} +4 -4
  136. package/dist/{chunk-Z54EM5YZ.js → chunk-MAXVH44E.js} +7 -7
  137. package/dist/{chunk-WZFAPHIK.js → chunk-MU7ZHSZE.js} +2 -2
  138. package/dist/chunk-N5Z4EVOR.js +123 -0
  139. package/dist/chunk-N5Z4EVOR.js.map +1 -0
  140. package/dist/{chunk-66772WBP.js → chunk-NFXQJHJD.js} +5 -5
  141. package/dist/{chunk-AZ5BTEKX.js → chunk-NQUF7XKR.js} +2 -2
  142. package/dist/{chunk-W4FBGYGK.js → chunk-NRV4Y3PM.js} +1 -1
  143. package/dist/{chunk-NHWB6HG2.js → chunk-NYCGIQRA.js} +2 -2
  144. package/dist/{chunk-4WKA6I65.js → chunk-OGCNZPKX.js} +1119 -309
  145. package/dist/chunk-OGCNZPKX.js.map +1 -0
  146. package/dist/{chunk-QJAQNXWI.js → chunk-ONHRRJZM.js} +6 -6
  147. package/dist/{chunk-FDAMS4PK.js → chunk-PNPOWBGC.js} +2 -2
  148. package/dist/{chunk-IC6CBHCA.js → chunk-QGENAYVS.js} +2 -2
  149. package/dist/{chunk-GBJ4RDFR.js → chunk-QIHIHZYC.js} +66 -91
  150. package/dist/chunk-QIHIHZYC.js.map +1 -0
  151. package/dist/{chunk-PUS63Q3G.js → chunk-RUYJ7TWU.js} +517 -2011
  152. package/dist/chunk-RUYJ7TWU.js.map +1 -0
  153. package/dist/{chunk-4A6YGWQN.js → chunk-TL4TO3EA.js} +115 -120
  154. package/dist/chunk-TL4TO3EA.js.map +1 -0
  155. package/dist/{chunk-SPJXKAVF.js → chunk-U52AKICI.js} +14 -13
  156. package/dist/chunk-U52AKICI.js.map +1 -0
  157. package/dist/chunk-ULARSG5Z.js +203 -0
  158. package/dist/chunk-ULARSG5Z.js.map +1 -0
  159. package/dist/{chunk-62U4J2GN.js → chunk-UR77VKF7.js} +2 -2
  160. package/dist/{chunk-JCBWCYEJ.js → chunk-VANLTS5F.js} +2 -2
  161. package/dist/{chunk-4Z4XNEWZ.js → chunk-VCD4PSK2.js} +56 -12
  162. package/dist/chunk-VCD4PSK2.js.map +1 -0
  163. package/dist/{chunk-RMMVQQA6.js → chunk-WDISJRMG.js} +2 -2
  164. package/dist/{chunk-B6JDYXL7.js → chunk-WWUVONGW.js} +7 -1
  165. package/dist/chunk-WWUVONGW.js.map +1 -0
  166. package/dist/{chunk-UVYI6VIX.js → chunk-X7Y7WX73.js} +1 -1
  167. package/dist/{chunk-TH2LSRMG.js → chunk-XHDIB4T4.js} +2 -2
  168. package/dist/{chunk-CVILPI77.js → chunk-XOQSEF7X.js} +6 -6
  169. package/dist/{chunk-LBOD4U5B.js → chunk-YFOMN2II.js} +6 -6
  170. package/dist/{chunk-RPW2NOU6.js → chunk-YIAA2X3D.js} +41 -1
  171. package/dist/chunk-YIAA2X3D.js.map +1 -0
  172. package/dist/chunk-YPC7W6GA.js +1604 -0
  173. package/dist/chunk-YPC7W6GA.js.map +1 -0
  174. package/dist/{chunk-I5NLEENJ.js → chunk-Z4SWV4VW.js} +3 -3
  175. package/dist/{chunk-PHWUFPCO.js → chunk-ZCPP5OW6.js} +61 -53
  176. package/dist/chunk-ZCPP5OW6.js.map +1 -0
  177. package/dist/{cli-C4GbETPC.d.ts → cli-BptUDTtp.d.ts} +5 -5
  178. package/dist/cli.d.ts +12 -12
  179. package/dist/cli.js +91 -84
  180. package/dist/compounding/engine.d.ts +2 -2
  181. package/dist/compounding/engine.js +14 -14
  182. package/dist/compounding/preference-consolidator.d.ts +1 -1
  183. package/dist/compression-optimizer.d.ts +1 -1
  184. package/dist/config.d.ts +1 -1
  185. package/dist/config.js +1 -1
  186. package/dist/connectors/codex-materialize-runner.d.ts +1 -1
  187. package/dist/connectors/codex-materialize-runner.js +14 -14
  188. package/dist/connectors/codex-materialize.d.ts +1 -1
  189. package/dist/connectors/index.d.ts +1 -1
  190. package/dist/connectors/index.js +17 -17
  191. package/dist/consolidation-provenance-check.d.ts +2 -2
  192. package/dist/consolidation-provenance-check.js +5 -5
  193. package/dist/consolidation-undo.d.ts +2 -2
  194. package/dist/consolidation-undo.js +3 -3
  195. package/dist/contradiction/index.d.ts +2 -2
  196. package/dist/contradiction/index.js +4 -4
  197. package/dist/conversation-index/backend.d.ts +1 -1
  198. package/dist/conversation-index/backend.js +2 -2
  199. package/dist/conversation-index/chunker.d.ts +1 -1
  200. package/dist/conversation-index/faiss-adapter.d.ts +1 -1
  201. package/dist/conversation-index/indexer.d.ts +1 -1
  202. package/dist/conversation-index/search.d.ts +1 -1
  203. package/dist/corpus-watermark.d.ts +1 -1
  204. package/dist/corpus-watermark.js +26 -26
  205. package/dist/day-summary.d.ts +1 -1
  206. package/dist/delinearize.d.ts +1 -1
  207. package/dist/direct-answer-wiring.d.ts +1 -1
  208. package/dist/direct-answer.d.ts +1 -1
  209. package/dist/embedding-fallback.d.ts +1 -1
  210. package/dist/enrichment/index.d.ts +1 -1
  211. package/dist/entity-retrieval.d.ts +2 -2
  212. package/dist/entity-retrieval.js +14 -14
  213. package/dist/entity-schema.d.ts +1 -1
  214. package/dist/explicit-capture.d.ts +8 -8
  215. package/dist/extraction-error-classification.d.ts +1 -1
  216. package/dist/extraction-faithfulness.d.ts +1 -1
  217. package/dist/extraction-judge-telemetry.d.ts +1 -1
  218. package/dist/extraction-judge-training.d.ts +1 -1
  219. package/dist/extraction-judge.d.ts +1 -1
  220. package/dist/extraction-liveness.d.ts +1 -1
  221. package/dist/extraction-source-grounding-rules.d.ts +1 -1
  222. package/dist/extraction-source-grounding.d.ts +15 -2
  223. package/dist/extraction-source-grounding.js +10 -1
  224. package/dist/extraction.d.ts +2 -15
  225. package/dist/extraction.js +5 -4
  226. package/dist/fallback-llm.d.ts +1 -1
  227. package/dist/graph-dashboard-diff.d.ts +1 -1
  228. package/dist/graph-dashboard-key.d.ts +1 -1
  229. package/dist/graph-dashboard-parser.d.ts +1 -1
  230. package/dist/graph-edge-reinforcement.d.ts +1 -1
  231. package/dist/graph-snapshot.d.ts +1 -1
  232. package/dist/graph.d.ts +1 -1
  233. package/dist/importance.d.ts +1 -1
  234. package/dist/importers/index.d.ts +1 -1
  235. package/dist/in-flight-reads.d.ts +1 -1
  236. package/dist/index.d.ts +19 -19
  237. package/dist/index.js +215 -207
  238. package/dist/intent.d.ts +1 -1
  239. package/dist/lcm/engine.d.ts +1 -1
  240. package/dist/lcm/engine.js +3 -3
  241. package/dist/lcm/index.d.ts +1 -1
  242. package/dist/lcm/index.js +6 -6
  243. package/dist/lcm/tools.d.ts +1 -1
  244. package/dist/lifecycle.d.ts +1 -1
  245. package/dist/live-connectors-runner.d.ts +1 -1
  246. package/dist/local-llm-helpers.d.ts +7 -0
  247. package/dist/local-llm-helpers.js +16 -0
  248. package/dist/local-llm-helpers.js.map +1 -0
  249. package/dist/local-llm.d.ts +3 -6
  250. package/dist/local-llm.js +2 -1
  251. package/dist/local-model-endpoint.d.ts +1 -1
  252. package/dist/maintenance/memory-governance.d.ts +1 -1
  253. package/dist/maintenance/memory-governance.js +14 -14
  254. package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +2 -2
  255. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +14 -14
  256. package/dist/maintenance/rebuild-memory-projection.d.ts +2 -2
  257. package/dist/maintenance/rebuild-memory-projection.js +15 -15
  258. package/dist/{maintenance-CL30NWtc.d.ts → maintenance-b6f92bRz.d.ts} +3 -3
  259. package/dist/mcp-memory-inspector-app.d.ts +10 -10
  260. package/dist/memory-action-policy.d.ts +1 -1
  261. package/dist/memory-cache.d.ts +1 -1
  262. package/dist/memory-corpus-version.js +2 -2
  263. package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
  264. package/dist/memory-projection-store.d.ts +1 -1
  265. package/dist/memory-provenance.d.ts +1 -1
  266. package/dist/memory-worth-outcomes.d.ts +2 -2
  267. package/dist/models-json.d.ts +1 -1
  268. package/dist/namespaces/migrate.d.ts +3 -3
  269. package/dist/namespaces/migrate.js +24 -24
  270. package/dist/namespaces/principal.d.ts +1 -1
  271. package/dist/namespaces/search.d.ts +1 -1
  272. package/dist/namespaces/search.js +9 -9
  273. package/dist/namespaces/storage.d.ts +3 -3
  274. package/dist/namespaces/storage.js +14 -14
  275. package/dist/native-knowledge.d.ts +1 -1
  276. package/dist/offline-sync-impression-drain.d.ts +1 -1
  277. package/dist/offline-sync-impression-drain.js +6 -5
  278. package/dist/operator-doctor-corpus.d.ts +1 -1
  279. package/dist/operator-doctor-corpus.js +29 -29
  280. package/dist/operator-doctor-replica.d.ts +1 -1
  281. package/dist/operator-doctor-replica.js +3 -3
  282. package/dist/operator-toolkit.d.ts +3 -3
  283. package/dist/operator-toolkit.js +38 -37
  284. package/dist/orchestration/compression-guideline-coordinator.d.ts +2 -2
  285. package/dist/orchestration/maintenance.d.ts +4 -4
  286. package/dist/orchestration/maintenance.js +22 -21
  287. package/dist/{orchestrator-CKTCRwWV.d.ts → orchestrator-3uGxC1qO.d.ts} +72 -34
  288. package/dist/orchestrator.d.ts +8 -8
  289. package/dist/orchestrator.js +167 -159
  290. package/dist/page-versioning.js +3 -3
  291. package/dist/patterns-cli.d.ts +1 -1
  292. package/dist/{pipeline-B7wj4rRZ.d.ts → pipeline-DepuNr-m.d.ts} +1 -1
  293. package/dist/policy-runtime.d.ts +1 -1
  294. package/dist/proactive-contention.d.ts +1 -1
  295. package/dist/provenance.d.ts +1 -1
  296. package/dist/{qmd-q9tg4dHp.d.ts → qmd-Dalr3Jby.d.ts} +1 -1
  297. package/dist/qmd-preflight.d.ts +2 -2
  298. package/dist/qmd-recall-cache.d.ts +1 -1
  299. package/dist/qmd.d.ts +2 -2
  300. package/dist/qmd.js +4 -4
  301. package/dist/recall-concurrency-config.d.ts +1 -1
  302. package/dist/recall-disclosure-escalation.d.ts +1 -1
  303. package/dist/recall-explain-renderer.d.ts +1 -1
  304. package/dist/recall-explain-renderer.js +3 -3
  305. package/dist/recall-memory-map.d.ts +1 -1
  306. package/dist/recall-planner-llm.d.ts +1 -1
  307. package/dist/recall-state.d.ts +1 -1
  308. package/dist/recall-tag-filter.d.ts +1 -1
  309. package/dist/recall-timings.d.ts +1 -1
  310. package/dist/recall-xray-cli.d.ts +1 -1
  311. package/dist/recall-xray-cli.js +4 -4
  312. package/dist/recall-xray-renderer.d.ts +1 -1
  313. package/dist/recall-xray-renderer.js +3 -3
  314. package/dist/recall-xray.d.ts +1 -1
  315. package/dist/recall-xray.js +2 -2
  316. package/dist/replay/normalizers/chatgpt.d.ts +1 -1
  317. package/dist/replay/normalizers/claude.d.ts +1 -1
  318. package/dist/replay/normalizers/openclaw.d.ts +1 -1
  319. package/dist/replay/normalizers/shared.d.ts +1 -1
  320. package/dist/replay/runner.d.ts +1 -1
  321. package/dist/replay/types.d.ts +1 -1
  322. package/dist/replica-divergence.d.ts +1 -1
  323. package/dist/replica-divergence.js +2 -2
  324. package/dist/replica-peers-config.d.ts +1 -1
  325. package/dist/resolve-auth-token.d.ts +1 -1
  326. package/dist/resume-bundles.js +1 -1
  327. package/dist/retrieval-agents.d.ts +2 -2
  328. package/dist/retrieval-tiers.d.ts +1 -1
  329. package/dist/routing/engine.d.ts +1 -1
  330. package/dist/routing/store.d.ts +1 -1
  331. package/dist/salvage-envelope.d.ts +1 -1
  332. package/dist/{scope-profiles-CWDyglPM.d.ts → scope-profiles-BpiM5hTU.d.ts} +1 -1
  333. package/dist/search/embed-helper.d.ts +1 -1
  334. package/dist/search/factory.d.ts +1 -1
  335. package/dist/search/factory.js +8 -8
  336. package/dist/search/index.d.ts +1 -1
  337. package/dist/search/index.js +12 -12
  338. package/dist/search/lancedb-backend.d.ts +1 -1
  339. package/dist/search/meilisearch-backend.d.ts +1 -1
  340. package/dist/search/noop-backend.d.ts +1 -1
  341. package/dist/search/orama-backend.d.ts +1 -1
  342. package/dist/search/port.d.ts +1 -1
  343. package/dist/search/remote-backend.d.ts +1 -1
  344. package/dist/{semantic-consolidation-BUE3deLn.d.ts → semantic-consolidation-CMtVrf9f.d.ts} +1 -1
  345. package/dist/semantic-consolidation.d.ts +2 -2
  346. package/dist/semantic-consolidation.js +16 -16
  347. package/dist/semantic-rule-promotion.js +14 -14
  348. package/dist/semantic-rule-verifier.d.ts +1 -1
  349. package/dist/semantic-rule-verifier.js +14 -14
  350. package/dist/{service-CXgM0bQG.d.ts → service-DuAxwSgg.d.ts} +2 -2
  351. package/dist/session-observer-bands.d.ts +1 -1
  352. package/dist/session-observer-state.d.ts +1 -1
  353. package/dist/shared-context/manager.d.ts +1 -1
  354. package/dist/signal.d.ts +1 -1
  355. package/dist/{storage-DysJq-XH.d.ts → storage-CF0Ih8GP.d.ts} +1 -1
  356. package/dist/storage.d.ts +2 -2
  357. package/dist/storage.js +13 -13
  358. package/dist/summarizer.d.ts +1 -1
  359. package/dist/summarizer.js +3 -2
  360. package/dist/summary-snapshot.d.ts +1 -1
  361. package/dist/temporal-supersession.d.ts +2 -2
  362. package/dist/temporal-timeline-recall.d.ts +1 -1
  363. package/dist/temporal-validity.d.ts +1 -1
  364. package/dist/threading.d.ts +1 -1
  365. package/dist/tier-migration.d.ts +2 -2
  366. package/dist/tier-routing.d.ts +1 -1
  367. package/dist/tokens.js +2 -2
  368. package/dist/topics.d.ts +1 -1
  369. package/dist/transcript.d.ts +1 -1
  370. package/dist/transfer/backup.js +2 -2
  371. package/dist/transfer/capsule-export.js +2 -2
  372. package/dist/transfer/capsule-import.js +5 -5
  373. package/dist/trust-score-stage.d.ts +1 -1
  374. package/dist/trust-score.d.ts +1 -1
  375. package/dist/{types-aPPzhnjT.d.ts → types-BpaYvJ6v.d.ts} +22 -2
  376. package/dist/types.d.ts +1 -1
  377. package/dist/types.js +1 -1
  378. package/dist/utility-runtime.d.ts +1 -1
  379. package/dist/verified-recall.js +14 -14
  380. package/dist/write-envelope.d.ts +1 -1
  381. package/package.json +2 -2
  382. package/src/access-boundary.ts +3 -0
  383. package/src/access-cli.test.ts +93 -0
  384. package/src/access-cli.ts +56 -2
  385. package/src/access-extraction-force-flush.ts +177 -0
  386. package/src/access-http-extraction-force-flush.test.ts +132 -0
  387. package/src/access-http-lcm-compaction.ts +99 -22
  388. package/src/access-http-lifecycle-flush.ts +81 -0
  389. package/src/access-http.test.ts +227 -0
  390. package/src/access-http.ts +33 -40
  391. package/src/access-mcp-output-schemas.ts +6 -0
  392. package/src/access-mcp.test.ts +40 -0
  393. package/src/access-mcp.ts +32 -1
  394. package/src/access-observe-helpers.ts +180 -0
  395. package/src/access-observe-write-surface.ts +78 -19
  396. package/src/access-operations-batch.ts +2 -1
  397. package/src/access-schema-pi.test.ts +17 -0
  398. package/src/access-schema.ts +28 -11
  399. package/src/access-service-helpers.ts +46 -0
  400. package/src/access-service-observe-lcm-parity.test.ts +781 -31
  401. package/src/access-service-observe-scope.test.ts +88 -0
  402. package/src/access-service.ts +46 -128
  403. package/src/access-surface-catalog.test.ts +32 -0
  404. package/src/access-surface-catalog.ts +2 -0
  405. package/src/buffer-session.test.ts +148 -0
  406. package/src/buffer-turn-helpers.ts +152 -0
  407. package/src/buffer.ts +126 -201
  408. package/src/correction/correction-access-wiring.ts +79 -27
  409. package/src/correction/correction-executor.test.ts +542 -1
  410. package/src/correction/correction-executor.ts +309 -89
  411. package/src/correction/correction-planner.test.ts +35 -1
  412. package/src/correction/correction-planner.ts +50 -3
  413. package/src/correction/correction-service.ts +12 -7
  414. package/src/correction/correction-storage-integration.test.ts +172 -1
  415. package/src/correction/passive-capture.test.ts +35 -0
  416. package/src/correction/passive-capture.ts +17 -3
  417. package/src/extraction-source-grounding.ts +55 -1
  418. package/src/extraction-timeout.test.ts +51 -0
  419. package/src/extraction.ts +64 -90
  420. package/src/local-llm-headers-timeout.test.ts +48 -0
  421. package/src/local-llm-helpers.ts +58 -0
  422. package/src/local-llm.ts +62 -58
  423. package/src/orchestration/extraction-run-helpers.ts +309 -0
  424. package/src/orchestration/extraction-run.test.ts +350 -7
  425. package/src/orchestration/extraction-run.ts +327 -250
  426. package/src/orchestration/recall-internal-deps.ts +385 -0
  427. package/src/orchestration/recall-internal.ts +16 -375
  428. package/src/orchestration/session-context.ts +193 -18
  429. package/src/orchestration/turn-ingestion.ts +61 -11
  430. package/src/orchestrator-flush.test.ts +511 -5
  431. package/src/orchestrator.ts +8 -6
  432. package/src/types.ts +2 -2
  433. package/dist/chunk-4A6YGWQN.js.map +0 -1
  434. package/dist/chunk-4WKA6I65.js.map +0 -1
  435. package/dist/chunk-4Z4XNEWZ.js.map +0 -1
  436. package/dist/chunk-6FUPCJUL.js.map +0 -1
  437. package/dist/chunk-B6JDYXL7.js.map +0 -1
  438. package/dist/chunk-GBJ4RDFR.js.map +0 -1
  439. package/dist/chunk-HUHX2OCX.js.map +0 -1
  440. package/dist/chunk-IYZ5K7MU.js.map +0 -1
  441. package/dist/chunk-LGHKJABJ.js.map +0 -1
  442. package/dist/chunk-PHWUFPCO.js.map +0 -1
  443. package/dist/chunk-PUS63Q3G.js.map +0 -1
  444. package/dist/chunk-RPW2NOU6.js.map +0 -1
  445. package/dist/chunk-SPJXKAVF.js.map +0 -1
  446. package/dist/chunk-YTSNAUXN.js.map +0 -1
  447. /package/dist/{capsule-crypto-GWVG7LGC.js.map → access-extraction-force-flush.js.map} +0 -0
  448. /package/dist/{capsule-merge-5KKJQBWQ.js.map → capsule-merge-2H2IUTBT.js.map} +0 -0
  449. /package/dist/{chunk-LEPOP46W.js.map → chunk-227UFSEQ.js.map} +0 -0
  450. /package/dist/{chunk-GIBMDSJ2.js.map → chunk-27P5YVDU.js.map} +0 -0
  451. /package/dist/{chunk-2SA56WMI.js.map → chunk-2LTDWSR6.js.map} +0 -0
  452. /package/dist/{chunk-OWHERGF2.js.map → chunk-2NLLXCJG.js.map} +0 -0
  453. /package/dist/{chunk-6U7F52DE.js.map → chunk-4XHR3I67.js.map} +0 -0
  454. /package/dist/{chunk-2EUVEDF5.js.map → chunk-5XA7PQ5I.js.map} +0 -0
  455. /package/dist/{chunk-ALSGMEJR.js.map → chunk-65ZPVYTA.js.map} +0 -0
  456. /package/dist/{chunk-5VQJBH2G.js.map → chunk-6TAUHL33.js.map} +0 -0
  457. /package/dist/{chunk-RGIWINDN.js.map → chunk-7G5MH4NT.js.map} +0 -0
  458. /package/dist/{chunk-WVO4G37W.js.map → chunk-7TEZUUGM.js.map} +0 -0
  459. /package/dist/{chunk-MJCGLM25.js.map → chunk-7VUAG236.js.map} +0 -0
  460. /package/dist/{chunk-M3C2V3PV.js.map → chunk-AJEMDQNA.js.map} +0 -0
  461. /package/dist/{chunk-RKNJBZ55.js.map → chunk-AU7Q3LSC.js.map} +0 -0
  462. /package/dist/{chunk-ACXPX4AG.js.map → chunk-BR2K43MK.js.map} +0 -0
  463. /package/dist/{chunk-CZRYLSSW.js.map → chunk-BUGVGH4N.js.map} +0 -0
  464. /package/dist/{chunk-YTQNQ4KB.js.map → chunk-C4VQMFVM.js.map} +0 -0
  465. /package/dist/{chunk-ZPSVBSOF.js.map → chunk-CIVDJD6P.js.map} +0 -0
  466. /package/dist/{chunk-K5GB36ME.js.map → chunk-CZDOT5I2.js.map} +0 -0
  467. /package/dist/{chunk-VI2JQPNQ.js.map → chunk-E4PWACUN.js.map} +0 -0
  468. /package/dist/{chunk-D2ANTDGO.js.map → chunk-E6BMSH7U.js.map} +0 -0
  469. /package/dist/{chunk-P5PXWTW7.js.map → chunk-EJCAV3QZ.js.map} +0 -0
  470. /package/dist/{chunk-CKMO4RDY.js.map → chunk-EMDLM3LW.js.map} +0 -0
  471. /package/dist/{chunk-G5R3D5UP.js.map → chunk-GTTAHHD3.js.map} +0 -0
  472. /package/dist/{chunk-H5CPS5JP.js.map → chunk-H36LJIPD.js.map} +0 -0
  473. /package/dist/{chunk-AITCS2RC.js.map → chunk-IJ7HK452.js.map} +0 -0
  474. /package/dist/{chunk-D3LMYTBV.js.map → chunk-J7WZUL2K.js.map} +0 -0
  475. /package/dist/{chunk-5W4ZLBEZ.js.map → chunk-JCFTIQBR.js.map} +0 -0
  476. /package/dist/{chunk-XOZ4ALGB.js.map → chunk-KE353EWI.js.map} +0 -0
  477. /package/dist/{chunk-W5EG6LE3.js.map → chunk-KIT6M7EB.js.map} +0 -0
  478. /package/dist/{chunk-5W7CTZ2E.js.map → chunk-KQAFEZQX.js.map} +0 -0
  479. /package/dist/{chunk-Z54EM5YZ.js.map → chunk-MAXVH44E.js.map} +0 -0
  480. /package/dist/{chunk-WZFAPHIK.js.map → chunk-MU7ZHSZE.js.map} +0 -0
  481. /package/dist/{chunk-66772WBP.js.map → chunk-NFXQJHJD.js.map} +0 -0
  482. /package/dist/{chunk-AZ5BTEKX.js.map → chunk-NQUF7XKR.js.map} +0 -0
  483. /package/dist/{chunk-W4FBGYGK.js.map → chunk-NRV4Y3PM.js.map} +0 -0
  484. /package/dist/{chunk-NHWB6HG2.js.map → chunk-NYCGIQRA.js.map} +0 -0
  485. /package/dist/{chunk-QJAQNXWI.js.map → chunk-ONHRRJZM.js.map} +0 -0
  486. /package/dist/{chunk-FDAMS4PK.js.map → chunk-PNPOWBGC.js.map} +0 -0
  487. /package/dist/{chunk-IC6CBHCA.js.map → chunk-QGENAYVS.js.map} +0 -0
  488. /package/dist/{chunk-62U4J2GN.js.map → chunk-UR77VKF7.js.map} +0 -0
  489. /package/dist/{chunk-JCBWCYEJ.js.map → chunk-VANLTS5F.js.map} +0 -0
  490. /package/dist/{chunk-RMMVQQA6.js.map → chunk-WDISJRMG.js.map} +0 -0
  491. /package/dist/{chunk-UVYI6VIX.js.map → chunk-X7Y7WX73.js.map} +0 -0
  492. /package/dist/{chunk-TH2LSRMG.js.map → chunk-XHDIB4T4.js.map} +0 -0
  493. /package/dist/{chunk-CVILPI77.js.map → chunk-XOQSEF7X.js.map} +0 -0
  494. /package/dist/{chunk-LBOD4U5B.js.map → chunk-YFOMN2II.js.map} +0 -0
  495. /package/dist/{chunk-I5NLEENJ.js.map → chunk-Z4SWV4VW.js.map} +0 -0
@@ -33,6 +33,8 @@ import { join } from "node:path";
33
33
  import test from "node:test";
34
34
 
35
35
  import { EngramAccessService } from "./access-service.js";
36
+ import { PendingObserveExtractionTracker } from "./access-observe-helpers.js";
37
+
36
38
  import { tokenCapabilityStore } from "./access-token-capabilities.js";
37
39
  import { resolveAuthorizedNamespaceWritablePreflight } from "./access-namespace-preflight.js";
38
40
  import { Orchestrator } from "./orchestrator.js";
@@ -216,6 +218,92 @@ test("#1495 projectTag: LCM, extraction, objective-state, and response all agree
216
218
  );
217
219
  });
218
220
 
221
+ test("#2128 pending observe preparation is a force-flush barrier", async () => {
222
+ const tracker = new PendingObserveExtractionTracker();
223
+ const preparation = tracker.reserve("session-z");
224
+ let releaseExtraction!: () => void;
225
+ const extraction = new Promise<void>((resolve) => {
226
+ releaseExtraction = resolve;
227
+ });
228
+ let waited = false;
229
+ const waitPromise = tracker.wait("session-z", "alice", "team-project").then(() => {
230
+ waited = true;
231
+ });
232
+
233
+ await Promise.resolve();
234
+ assert.equal(waited, false, "a force flush must wait while observe is still resolving scope");
235
+
236
+ tracker.track(tracker.key("session-z", "alice", "team-project"), extraction, new AbortController());
237
+ preparation.release();
238
+ await Promise.resolve();
239
+ assert.equal(waited, false, "registration must remain a barrier until extraction settles");
240
+
241
+ releaseExtraction();
242
+ await waitPromise;
243
+ assert.equal(waited, true);
244
+ });
245
+
246
+ test("#2128 scoped observe preparation cancellation preserves another project", () => {
247
+ const tracker = new PendingObserveExtractionTracker();
248
+ const projectA = tracker.reserve("opaque-session", "projectTag:project-a");
249
+ const projectB = tracker.reserve("opaque-session", "projectTag:project-b");
250
+
251
+ tracker.cancel("opaque-session", undefined, "alice-project-a", "projectTag:project-a");
252
+
253
+ assert.equal(projectA.isCancelled(), true);
254
+ assert.equal(projectB.isCancelled(), false);
255
+ projectA.release();
256
+ projectB.release();
257
+ });
258
+
259
+
260
+ test("#2128 cancellation matches resolved scope despite a different request hint", () => {
261
+ const tracker = new PendingObserveExtractionTracker();
262
+ const preparation = tracker.reserve("session-z", "cwd:/workspace/project/src");
263
+ preparation.setScope("alice", "alice-project");
264
+
265
+ tracker.cancel("session-z", "alice", "alice-project", "projectTag:Acme/Webshop");
266
+
267
+ assert.equal(preparation.isCancelled(), true);
268
+ preparation.release();
269
+ });
270
+ test("#2128 concurrent scope plans do not share temporary coding context", async () => {
271
+ const probe = makeObserveProbe(withSelfPolicyPrefix("pi-geek"));
272
+ const service = new EngramAccessService(probe.orch);
273
+ const internals = service as unknown as {
274
+ resolveMemoryScopePlan: (request: EngramAccessObserveRequest) => Promise<{
275
+ writeNamespace: string;
276
+ }>;
277
+ };
278
+
279
+ const firstProject = projectTagProjectId("Acme/Webshop");
280
+ const secondProject = projectTagProjectId("Contoso/Portal");
281
+ const [firstPlan, secondPlan] = await Promise.all([
282
+ internals.resolveMemoryScopePlan.call(
283
+ service,
284
+ observeRequest({ sessionKey: "pi-geek:concurrent", projectTag: "Acme/Webshop" }),
285
+ ),
286
+ internals.resolveMemoryScopePlan.call(
287
+ service,
288
+ observeRequest({ sessionKey: "pi-geek:concurrent", projectTag: "Contoso/Portal" }),
289
+ ),
290
+ ]);
291
+
292
+ assert.equal(
293
+ firstPlan.writeNamespace,
294
+ combineNamespaces("pi-geek", projectNamespaceName(firstProject)),
295
+ );
296
+ assert.equal(
297
+ secondPlan.writeNamespace,
298
+ combineNamespaces("pi-geek", projectNamespaceName(secondProject)),
299
+ );
300
+ assert.equal(
301
+ probe.contexts.get("pi-geek:concurrent"),
302
+ undefined,
303
+ "scope planning must not bind temporary coding context visible to concurrent calls",
304
+ );
305
+ });
306
+
219
307
  test("#1501 scope profile exposes layered read/write/promotion diagnostics without changing user-project write default", async () => {
220
308
  const probe = makeObserveProbe({
221
309
  namespacePolicies: [
@@ -222,6 +222,20 @@ import type {
222
222
  RecallDisclosure,
223
223
  RecallPlanMode,
224
224
  } from "./types.js";
225
+ import {
226
+ delegateExtractionForceFlush,
227
+ type EngramAccessExtractionForceFlushRequest,
228
+ type EngramAccessExtractionForceFlushResponse,
229
+ type EngramAccessLcmCompactionFlushRequest,
230
+ type EngramAccessLcmCompactionFlushResponse,
231
+ } from "./access-service-helpers.js";
232
+ export type {
233
+ EngramAccessExtractionForceFlushRequest,
234
+ EngramAccessExtractionForceFlushResponse,
235
+ EngramAccessLcmCompactionFlushRequest,
236
+ EngramAccessLcmCompactionFlushResponse,
237
+ };
238
+
225
239
  import { DEFAULT_RECALL_DISCLOSURE, isRecallDisclosure } from "./types.js";
226
240
  import { estimateRecallTokens, type RecallXraySnapshot } from "./recall-xray.js";
227
241
  import type {
@@ -943,6 +957,8 @@ export interface MemoryScopePlan {
943
957
  readNamespaces: string[];
944
958
  /** Active scope profile id, when `defaultScopeProfile` is configured. */
945
959
  scopeProfile?: string;
960
+ /** Internal resolved profile used to keep scoped extraction persistence aligned with access resolution. */
961
+ scopeProfilePlan?: ResolvedScopeProfilePlan | null;
946
962
  /** Resolved profile layer that supplied `writeNamespace`. */
947
963
  writeLayer?: string;
948
964
  /** Resolved profile layers in the active profile contract. */
@@ -1082,19 +1098,6 @@ export interface EngramAccessLcmStatusResponse {
1082
1098
  stats?: { totalTurns?: number };
1083
1099
  }
1084
1100
 
1085
- export interface EngramAccessLcmCompactionFlushRequest {
1086
- sessionKey: string;
1087
- namespace?: string;
1088
- authenticatedPrincipal?: string;
1089
- }
1090
-
1091
- export interface EngramAccessLcmCompactionFlushResponse {
1092
- enabled: boolean;
1093
- flushed: boolean;
1094
- sessionKey: string;
1095
- namespace: string;
1096
- reason?: string;
1097
- }
1098
1101
 
1099
1102
  export interface EngramAccessLcmCompactionRecordRequest {
1100
1103
  sessionKey: string;
@@ -1732,98 +1735,27 @@ export class EngramAccessService {
1732
1735
  this.orchestrator.config,
1733
1736
  );
1734
1737
 
1735
- // Resolve the coding overlay through the SAME orchestrator method recall and
1736
- // the buffer-flush write path use (`applyCodingNamespaceOverlay`), NOT a
1737
- // private re-implementation. Routing through the one shared method (rule 22 /
1738
- // 42) means a project-scoped observe writes to byte-for-byte the namespace a
1739
- // same-session recall reads — and that the read/write overlay logic cannot
1740
- // drift (the #1495 drift this PR exists to close). The orchestrator method
1741
- // already gates on `namespacesEnabled` + a bound/derivable coding context, so
1742
- // it returns the base unchanged when no overlay applies.
1743
- //
1744
- // `applyCodingNamespaceOverlay` reads the session's ATTACHED context. The
1745
- // scope plan runs BEFORE `maybeAttachCodingContext` (resolve-before-mutate),
1746
- // so when nothing is attached yet we seed the per-call cwd/projectTag context
1747
- // first — identical to what attach would bind — so the overlay is the same
1748
- // either way (Codex review precedence: session context first, per-call
1749
- // fallback).
1750
- const hasSession =
1751
- typeof request.sessionKey === "string" && request.sessionKey.length > 0;
1752
- const overlayEligible =
1753
- hasSession &&
1754
- resolveNamespaceCapabilities(this.orchestrator.config).namespaces === true &&
1755
- this.orchestrator.config.codingMode?.projectScope === true;
1756
-
1757
- // Resolve the coding context the overlay must use: the session's ATTACHED
1758
- // context first (so a bound session wins), else the per-call cwd/projectTag —
1759
- // identical precedence to recall and to `resolveCodingScopedWriteNamespace`.
1760
- let attachedContext = hasSession
1761
- ? this.orchestrator.getCodingContextForSession(request.sessionKey)
1762
- : null;
1763
- // Track whether WE seeded the per-call context so we can leave the session
1764
- // exactly as we found it on any rejection (read-only contract / no-orphan
1765
- // guard, observe-scope "unauthorized overlay self-base" test).
1766
- let seededContext = false;
1767
- if (overlayEligible && !attachedContext) {
1768
- attachedContext = await this.resolveCodingContextFromOptions(request);
1769
- if (attachedContext) {
1770
- // Seed the per-call context so the shared
1771
- // `applyCodingNamespaceOverlay` (which reads ATTACHED session context)
1772
- // overlays it through the ONE method recall/buffer-flush use (rule 22 /
1773
- // 42) — no private re-implementation that could drift. On the happy
1774
- // path `maybeAttachCodingContext` re-binds the identical context after
1775
- // auth passes; on a rejection we clear the seed below, so the session is
1776
- // untouched either way.
1777
- this.orchestrator.setCodingContextForSession(
1778
- request.sessionKey!,
1779
- attachedContext,
1780
- );
1781
- seededContext = true;
1782
- }
1783
- }
1784
-
1785
- // Clear a seed we added, used only on the rejection paths so a failed
1786
- // observe never leaves an orphaned project binding (read-only contract).
1787
- const clearSeededContext = (): void => {
1788
- if (seededContext && hasSession) {
1789
- this.orchestrator.setCodingContextForSession(request.sessionKey!, null);
1790
- }
1791
- };
1738
+ // Resolve the coding context and overlay through the shared read-only
1739
+ // resolver used by the other scoped access paths. It applies the same
1740
+ // session-first, per-call fallback precedence without mutating session
1741
+ // state, so concurrent requests cannot observe temporary context.
1742
+ const {
1743
+ overlay: codingOverlay,
1744
+ profilePlan,
1745
+ } = await this.resolveCodingScopeInputs(request);
1746
+ const overlaidBase = codingOverlay
1747
+ ? combineNamespaces(baseNamespace, codingOverlay.namespace)
1748
+ : baseNamespace;
1749
+ const codingOverlayApplied = overlaidBase !== baseNamespace;
1792
1750
  const assertWriteNamespaceAllowed = (namespace: string): void => {
1793
- try {
1794
- this.assertTokenCanWriteNamespace(namespace);
1795
- } catch (error) {
1796
- clearSeededContext();
1797
- throw error;
1798
- }
1751
+ this.assertTokenCanWriteNamespace(namespace);
1799
1752
  };
1800
-
1801
-
1802
- const overlaidBase = this.orchestrator.applyCodingNamespaceOverlay(
1803
- request.sessionKey,
1804
- baseNamespace,
1805
- );
1806
- const codingOverlayApplied = overlaidBase !== baseNamespace;
1807
- const codingOverlay = overlayEligible
1808
- ? resolveCodingNamespaceOverlay(
1809
- attachedContext,
1810
- this.orchestrator.config.codingMode,
1811
- this.orchestrator.config.defaultNamespace,
1812
- )
1813
- : null;
1814
- const profilePlan = resolveScopeProfilePlan({
1815
- config: this.orchestrator.config,
1816
- principal,
1817
- codingContext: attachedContext,
1818
- codingOverlay,
1819
- });
1820
1753
  if (profilePlan) {
1821
1754
  const selectedLayer = profilePlan.layers.find((layer) => layer.id === profilePlan.writeLayer);
1822
1755
  const writeNamespaceReadable =
1823
1756
  profilePlan.writeNamespace.length > 0 &&
1824
1757
  profilePlan.readNamespaces.includes(profilePlan.writeNamespace);
1825
1758
  if (!selectedLayer?.writable || !writeNamespaceReadable) {
1826
- clearSeededContext();
1827
1759
  throw new NamespaceNotWritableError(profilePlan.writeNamespace, principal,
1828
1760
  `scope profile ${profilePlan.profileId} has no writable layer for principal ${principal ?? "anonymous"}`);
1829
1761
  }
@@ -1857,6 +1789,7 @@ export class EngramAccessService {
1857
1789
  objectiveStateNamespace: profilePlan.writeNamespace,
1858
1790
  readNamespaces,
1859
1791
  scopeProfile: profilePlan.profileId,
1792
+ scopeProfilePlan: profilePlan,
1860
1793
  writeLayer: profilePlan.writeLayer,
1861
1794
  layers: profilePlan.layers,
1862
1795
  promotionTargets: profilePlan.promotionTargets,
@@ -1899,7 +1832,6 @@ export class EngramAccessService {
1899
1832
  resolveNamespaceCapabilities(this.orchestrator.config).namespaces === true &&
1900
1833
  !canWriteNamespace(principal, baseNamespace, this.orchestrator.config)
1901
1834
  ) {
1902
- clearSeededContext();
1903
1835
  throw new NamespaceNotWritableError(baseNamespace, principal);
1904
1836
  }
1905
1837
  assertWriteNamespaceAllowed(writeNamespace);
@@ -1927,15 +1859,13 @@ export class EngramAccessService {
1927
1859
  // (the overlay is a principal-owned `project-*` sub-namespace derived from
1928
1860
  // it, so it needs no separate write policy — rule 42 / 47 / 48).
1929
1861
  if (!canWriteNamespace(principal, baseNamespace, this.orchestrator.config)) {
1930
- clearSeededContext();
1931
1862
  throw new NamespaceNotWritableError(baseNamespace, principal);
1932
1863
  }
1933
1864
  const writeNamespace = overlaidBase;
1934
1865
  const readNamespaces = [writeNamespace];
1935
1866
  // Include read fallbacks (branch→project→root) so the diagnostic readNamespaces
1936
- // matches what a same-session recall searches. Resolved through the pure
1937
- // overlay helper to enumerate fallbacks; the write namespace itself already
1938
- // came from `applyCodingNamespaceOverlay` so the two agree.
1867
+ // matches what a same-session recall searches. They come from the shared pure
1868
+ // coding-scope resolver, so the write namespace and read fallbacks agree.
1939
1869
  for (const fallback of codingOverlay?.readFallbacks ?? []) {
1940
1870
  const ns = combineNamespaces(baseNamespace, fallback);
1941
1871
  if (!readNamespaces.includes(ns)) readNamespaces.push(ns);
@@ -4333,26 +4263,9 @@ export class EngramAccessService {
4333
4263
  throw new EngramAccessInputError("sessionKey is required and must be a non-empty string");
4334
4264
  }
4335
4265
 
4336
- // Authorize compaction against the SCOPED WRITE TARGET the SAME effective
4337
- // write namespace `observe` archived the LCM queue under NOT a premature
4338
- // the writable-namespace resolver (undefined ⇒ config.defaultNamespace) (#1505
4339
- // thread NBHWs). Under a restrictive `default` WRITE policy where the
4340
- // principal can still write its self/project overlay, that premature default
4341
- // write-auth threw `namespace is not writable: default` BEFORE the scoped key
4342
- // was computed, so the overlay queue `observe` just wrote could never be
4343
- // flushed. `resolveMemoryScopePlan` is the ONE write-scoped plan/gate observe
4344
- // uses (rule 22 / 39 / 42): it authorizes the principal self base for an
4345
- // overlay write and only collapses to `config.defaultNamespace` (always
4346
- // writable) when no overlay applies — so it never throws `not writable:
4347
- // default` for a validly scoped observe's queue.
4266
+ // Authorize compaction against the same effective write namespace that
4267
+ // observe archived under, not a premature default writable-namespace check.
4348
4268
  const scope = await this.resolveMemoryScopePlan(request);
4349
- // Legacy `namespace` response field: pre-#1505 semantics were exactly
4350
- // the writable-namespace resolver (overlay-agnostic) — the
4351
- // authorized explicit namespace when supplied, else `config.defaultNamespace`.
4352
- // DERIVED from the scope plan (NOT a second auth pass, #1505 thread jvO):
4353
- // explicit ⇒ writeNamespace; user-project coding overlay ⇒ defaultNamespace;
4354
- // non-user scope-profile layer/no overlay ⇒ writeNamespace. Identical to
4355
- // observe's legacy field.
4356
4269
  const namespace = this.legacyResponseNamespaceForScope(scope);
4357
4270
  if (!this.orchestrator.lcmEngine || !this.orchestrator.lcmEngine.enabled) {
4358
4271
  return {
@@ -4364,13 +4277,7 @@ export class EngramAccessService {
4364
4277
  };
4365
4278
  }
4366
4279
 
4367
- // Flush the SAME LCM session_id `observe` archived under: encode the scope
4368
- // plan's EFFECTIVE write namespace (the coding overlay when one applies, else
4369
- // the default store) through the SAME `lcmSessionKeyForNamespace` helper
4370
- // observe uses for archival, so the flush key is byte-for-byte the write key
4371
- // (#1495 thread 2 / #1505 thread NBHWs, rule 42). A write-only / self-omitted
4372
- // principal still flushes the overlay queue because the scope plan authorized
4373
- // the write target by WRITE policy, not readability.
4280
+ // Flush the same LCM session ID observe archived under.
4374
4281
  const lcmSessionKey =
4375
4282
  lcmSessionKeyForNamespace(
4376
4283
  scope.writeNamespace,
@@ -4387,6 +4294,17 @@ export class EngramAccessService {
4387
4294
  };
4388
4295
  }
4389
4296
 
4297
+ async extractionForceFlush(request: EngramAccessExtractionForceFlushRequest): Promise<EngramAccessExtractionForceFlushResponse> {
4298
+ return delegateExtractionForceFlush(this.accessObserveWriteSurface, request);
4299
+ }
4300
+ cancelPendingObserveExtractions(
4301
+ sessionKey: string,
4302
+ principal?: string,
4303
+ namespace?: string,
4304
+ scopeHint?: string,
4305
+ ): void {
4306
+ this.accessObserveWriteSurface.cancelPendingObserveExtractions(sessionKey, principal, namespace, scopeHint);
4307
+ }
4390
4308
  async lcmCompactionRecord(
4391
4309
  request: EngramAccessLcmCompactionRecordRequest,
4392
4310
  ): Promise<EngramAccessLcmCompactionRecordResponse> {
@@ -282,6 +282,26 @@ function extractHttpRouteDispatchMap(): Map<string, Set<string>> {
282
282
  }
283
283
  }
284
284
 
285
+ if (/\bawait\s+maybeHandleLifecycleFlush\(/.test(source)) {
286
+ const lifecycleSource = readFileSync(
287
+ new URL("./access-http-lifecycle-flush.ts", import.meta.url),
288
+ "utf-8",
289
+ );
290
+ const lifecycleRoutes = [
291
+ ["/engram/v1/lcm/compaction/flush", "lcm_compaction_flush"],
292
+ ["/engram/v1/extraction/flush", "extraction_force_flush"],
293
+ ["/engram/v1/lcm/compaction/record", "lcm_compaction_record"],
294
+ ] as const;
295
+ for (const [pathname, operation] of lifecycleRoutes) {
296
+ const escapedPathname = pathname.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
297
+ const routeBlock = lifecycleSource.match(
298
+ new RegExp(`pathname\\s*===\\s*"${escapedPathname}"[\\s\\S]*?return true;`),
299
+ )?.[0];
300
+ if (routeBlock?.includes(`deps.enforceTokenOp("${operation}")`)) {
301
+ routeOps.set(`POST ${pathname}`, new Set([operation]));
302
+ }
303
+ }
304
+ }
285
305
  return routeOps;
286
306
  }
287
307
 
@@ -468,6 +488,18 @@ test("dispatch validator catches cross-method contamination on a shared path", (
468
488
  );
469
489
  });
470
490
 
491
+ test("dispatch validator follows lifecycle helper-owned HTTP routes", () => {
492
+ const routeDispatch = extractHttpRouteDispatchMap();
493
+ assert.equal(
494
+ routeDispatch.get("POST /engram/v1/lcm/compaction/flush")?.has("lcm_compaction_flush"),
495
+ true,
496
+ );
497
+ assert.equal(
498
+ routeDispatch.get("POST /engram/v1/extraction/flush")?.has("extraction_force_flush"),
499
+ true,
500
+ );
501
+ });
502
+
471
503
  // ---------------------------------------------------------------------------
472
504
  // Real surface coverage — the gate that runs on every build
473
505
  // ---------------------------------------------------------------------------
@@ -106,6 +106,7 @@ export const MCP_TOOLS: readonly McpToolEntry[] = [
106
106
  { tool: "observe", operation: "observe" },
107
107
  { tool: "lcm_search", operation: "lcm_search" },
108
108
  { tool: "lcm_compaction_flush", operation: "lcm_compaction_flush" },
109
+ { tool: "extraction_force_flush", operation: "extraction_force_flush" },
109
110
  { tool: "lcm_compaction_record", operation: "lcm_compaction_record" },
110
111
  { tool: "continuity_audit_generate", operation: "continuity_audit_generate" },
111
112
  { tool: "continuity_incident_open", operation: "continuity_incident_open" },
@@ -199,6 +200,7 @@ export const HTTP_ROUTES: readonly HttpRouteEntry[] = [
199
200
  { method: "POST", pathname: "/engram/v1/observe", operation: "observe" },
200
201
  { method: "POST", pathname: "/engram/v1/lcm/search", operation: "lcm_search" },
201
202
  { method: "POST", pathname: "/engram/v1/lcm/compaction/flush", operation: "lcm_compaction_flush" },
203
+ { method: "POST", pathname: "/engram/v1/extraction/flush", operation: "extraction_force_flush" },
202
204
  { method: "POST", pathname: "/engram/v1/lcm/compaction/record", operation: "lcm_compaction_record" },
203
205
  { method: "GET", pathname: "/engram/v1/lcm/status", operation: "lcm_status" },
204
206
  { method: "GET", pathname: "/engram/v1/relay/missions/:id", operation: "relay_mission_read" },
@@ -216,6 +216,59 @@ test("SmartBuffer clearAfterExtraction preserves appends after queued snapshots"
216
216
  );
217
217
  });
218
218
 
219
+ test("SmartBuffer shared-buffer clear removes only the extracted session turns", async () => {
220
+ const storage = new FakeStorage({
221
+ turns: [],
222
+ lastExtractionAt: null,
223
+ extractionCount: 0,
224
+ });
225
+ const buffer = new SmartBuffer(parseConfig({}), storage as any);
226
+ const aliceTurn = makeTurn("alice", "alice memory");
227
+ const bobTurn = makeTurn("bob", "bob memory");
228
+
229
+ await buffer.addTurn("provider-thread", aliceTurn);
230
+ await buffer.addTurn("provider-thread", bobTurn);
231
+ await buffer.clearAfterExtraction("provider-thread", [aliceTurn], {
232
+ allowNonPrefix: true,
233
+ });
234
+
235
+ assert.deepEqual(buffer.getTurns("provider-thread"), [bobTurn]);
236
+ });
237
+
238
+ test("SmartBuffer shared-buffer clear distinguishes duplicate turns by owner", async () => {
239
+ const storage = new FakeStorage({
240
+ turns: [],
241
+ lastExtractionAt: null,
242
+ extractionCount: 0,
243
+ });
244
+ const buffer = new SmartBuffer(parseConfig({}), storage as any);
245
+ const aliceTurn = { ...makeTurn("opaque-session", "same memory"), sessionOwnerPrincipal: "alice" };
246
+ const bobTurn = { ...makeTurn("opaque-session", "same memory"), sessionOwnerPrincipal: "bob" };
247
+
248
+ await buffer.addTurn("provider-thread", aliceTurn);
249
+ await buffer.addTurn("provider-thread", bobTurn);
250
+ await buffer.clearAfterExtraction("provider-thread", [aliceTurn], {
251
+ allowNonPrefix: true,
252
+ });
253
+
254
+ assert.deepEqual(buffer.getTurns("provider-thread"), [bobTurn]);
255
+ });
256
+
257
+ test("SmartBuffer preserves owner identity in deferred turns", async () => {
258
+ const storage = new FakeStorage({
259
+ turns: [],
260
+ lastExtractionAt: null,
261
+ extractionCount: 0,
262
+ });
263
+ const buffer = new SmartBuffer(parseConfig({}), storage as any);
264
+ const aliceTurn = { ...makeTurn("opaque-session", "deferred memory"), sessionOwnerPrincipal: "alice" };
265
+
266
+ await buffer.retainDeferredTurns("provider-thread", [aliceTurn]);
267
+
268
+ assert.deepEqual(buffer.getRetainedDeferredTurns("provider-thread"), [aliceTurn]);
269
+ });
270
+
271
+
219
272
  test("SmartBuffer clearAfterExtraction chooses the longest queued snapshot overlap", async () => {
220
273
  const storage = new FakeStorage({
221
274
  turns: [],
@@ -414,6 +467,101 @@ test("retainDeferredTurns preserves turns across clearAfterExtraction", async ()
414
467
  assert.equal(afterClear[1]?.content, "deferred context two");
415
468
  });
416
469
 
470
+ test("clearRetainedTurnsForSession drains only the force-flushed session", async () => {
471
+ const storage = new FakeStorage({
472
+ turns: [],
473
+ lastExtractionAt: null,
474
+ extractionCount: 0,
475
+ });
476
+ const buffer = new SmartBuffer(parseConfig({}), storage as any);
477
+ const sessionTurn = makeTurn("session-a", "deferred context");
478
+ const otherTurn = makeTurn("session-b", "other deferred context");
479
+
480
+ await buffer.addTurn("provider-thread", sessionTurn);
481
+ await buffer.retainDeferredTurns("provider-thread", [sessionTurn]);
482
+ await buffer.addTurn("other-thread", otherTurn);
483
+ await buffer.retainDeferredTurns("other-thread", [otherTurn]);
484
+
485
+ await buffer.clearRetainedTurnsForSession("session-a");
486
+
487
+ assert.deepEqual(buffer.getRetainedDeferredTurns("provider-thread"), []);
488
+ assert.deepEqual(buffer.getRetainedDeferredTurns("other-thread"), [otherTurn]);
489
+ assert.deepEqual(
490
+ storage.saved?.entries?.["provider-thread"]?.retainedTurns,
491
+ undefined,
492
+ );
493
+ });
494
+
495
+ test("clearRetainedTurnsForSession flushes another session's pending save when target is absent", async () => {
496
+ const storage = new FakeStorage({
497
+ turns: [],
498
+ lastExtractionAt: null,
499
+ extractionCount: 0,
500
+ });
501
+ const buffer = new SmartBuffer(
502
+ parseConfig({ bufferSaveDebounceMs: 10_000, triggerMode: "smart", bufferMaxTurns: 10_000 }),
503
+ storage as any,
504
+ );
505
+ const otherTurn = makeTurn("session-a", "pending turn from another session");
506
+ await buffer.addTurn("session-a", otherTurn);
507
+
508
+ const internals = buffer as unknown as DebouncedBufferInternals;
509
+ assert.equal(storage.saveCount, 0);
510
+ assert.equal(internals.pendingSave, true);
511
+ assert.notEqual(internals.saveTimer, null);
512
+
513
+ await buffer.clearRetainedTurnsForSession("session-b");
514
+
515
+ assert.equal(storage.saveCount, 1);
516
+ assert.equal(storage.saved?.entries?.["session-a"]?.turns.length, 1);
517
+ assert.equal(internals.pendingSave, false);
518
+ assert.equal(internals.saveTimer, null);
519
+ });
520
+
521
+ test("clearRetainedTurnsForSession drains only the authenticated owner", async () => {
522
+ const storage = new FakeStorage({
523
+ turns: [],
524
+ lastExtractionAt: null,
525
+ extractionCount: 0,
526
+ });
527
+ const buffer = new SmartBuffer(parseConfig({}), storage as any);
528
+ const aliceTurn = { ...makeTurn("opaque-session", "alice deferred"), sessionOwnerPrincipal: "alice" };
529
+ const bobTurn = { ...makeTurn("opaque-session", "bob deferred"), sessionOwnerPrincipal: "bob" };
530
+
531
+ await buffer.addTurn("provider-thread", aliceTurn);
532
+ await buffer.addTurn("provider-thread", bobTurn);
533
+ await buffer.retainDeferredTurns("provider-thread", [aliceTurn, bobTurn]);
534
+
535
+ await buffer.clearRetainedTurnsForSession("opaque-session", "alice");
536
+
537
+ assert.deepEqual(buffer.getRetainedDeferredTurns("provider-thread"), [bobTurn]);
538
+ });
539
+ test("clearRetainedTurnsForSession discovers buffer keys inside the mutation", async () => {
540
+ const storage = new FakeStorage({
541
+ turns: [],
542
+ lastExtractionAt: null,
543
+ extractionCount: 0,
544
+ });
545
+ const buffer = new SmartBuffer(parseConfig({}), storage as any);
546
+ const firstTurn = makeTurn("session-a", "first deferred context");
547
+ const lateTurn = makeTurn("session-a", "late deferred context");
548
+
549
+ await buffer.addTurn("provider-thread", firstTurn);
550
+ await buffer.retainDeferredTurns("provider-thread", [firstTurn]);
551
+ const originalFindBufferKeys = buffer.findBufferKeysForSession.bind(buffer);
552
+ (buffer as any).findBufferKeysForSession = async (sessionKey: string) => {
553
+ const keys = await originalFindBufferKeys(sessionKey);
554
+ await buffer.addTurn("late-provider-thread", lateTurn);
555
+ await buffer.retainDeferredTurns("late-provider-thread", [lateTurn]);
556
+ return keys;
557
+ };
558
+
559
+ await buffer.clearRetainedTurnsForSession("session-a");
560
+
561
+ assert.deepEqual(buffer.getRetainedDeferredTurns("provider-thread"), []);
562
+ assert.deepEqual(buffer.getRetainedDeferredTurns("late-provider-thread"), []);
563
+ });
564
+
417
565
  test("retainDeferredTurns respects the max tail size", async () => {
418
566
  const storage = new FakeStorage({
419
567
  turns: [],