@remnic/core 1.1.10 → 1.1.12

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 (299) hide show
  1. package/README.md +3 -3
  2. package/dist/access-cli.js +67 -59
  3. package/dist/access-cli.js.map +1 -1
  4. package/dist/access-http.d.ts +7 -4
  5. package/dist/access-http.js +30 -26
  6. package/dist/access-mcp.d.ts +9 -4
  7. package/dist/access-mcp.js +29 -25
  8. package/dist/access-schema.d.ts +188 -8
  9. package/dist/access-schema.js +12 -3
  10. package/dist/{access-service-BTTNyo1i.d.ts → access-service-DDjzFALq.d.ts} +54 -5
  11. package/dist/access-service.d.ts +7 -4
  12. package/dist/access-service.js +26 -23
  13. package/dist/action-confidence.d.ts +83 -0
  14. package/dist/action-confidence.js +22 -0
  15. package/dist/active-memory-bridge.d.ts +1 -1
  16. package/dist/active-recall.d.ts +1 -1
  17. package/dist/behavior-learner.d.ts +1 -1
  18. package/dist/behavior-signals.d.ts +1 -1
  19. package/dist/bootstrap.d.ts +4 -2
  20. package/dist/briefing.d.ts +1 -1
  21. package/dist/briefing.js +5 -5
  22. package/dist/buffer-surprise-report.d.ts +1 -1
  23. package/dist/buffer.d.ts +1 -1
  24. package/dist/calibration.d.ts +1 -1
  25. package/dist/calibration.js +4 -4
  26. package/dist/{capsule-export-LLEVB2RG.js → capsule-export-7QNCBZOQ.js} +3 -3
  27. package/dist/{capsule-import-UW45R2MZ.js → capsule-import-EPBHD2EN.js} +3 -3
  28. package/dist/causal-behavior.d.ts +1 -1
  29. package/dist/causal-consolidation.d.ts +1 -1
  30. package/dist/causal-consolidation.js +11 -11
  31. package/dist/{chunk-VQXK37XA.js → chunk-23ZZK64Y.js} +1 -1
  32. package/dist/chunk-23ZZK64Y.js.map +1 -0
  33. package/dist/{chunk-HJYHRE4S.js → chunk-242S3I2A.js} +2 -2
  34. package/dist/{chunk-MCC6KDQF.js → chunk-3B6KIRBH.js} +131 -13
  35. package/dist/chunk-3B6KIRBH.js.map +1 -0
  36. package/dist/chunk-4RA3C3EV.js +60 -0
  37. package/dist/chunk-4RA3C3EV.js.map +1 -0
  38. package/dist/{chunk-EYNQTST2.js → chunk-4YM32CRU.js} +4 -4
  39. package/dist/{chunk-6AUUAZEX.js → chunk-5NXIJZFX.js} +38 -8
  40. package/dist/chunk-5NXIJZFX.js.map +1 -0
  41. package/dist/chunk-6NKAQ74D.js +2237 -0
  42. package/dist/chunk-6NKAQ74D.js.map +1 -0
  43. package/dist/{chunk-PHNGXFQ6.js → chunk-7V22HTMD.js} +3 -3
  44. package/dist/{chunk-363MWCD3.js → chunk-7ZM3BFKK.js} +84 -62
  45. package/dist/chunk-7ZM3BFKK.js.map +1 -0
  46. package/dist/chunk-AC5LO7IU.js +308 -0
  47. package/dist/chunk-AC5LO7IU.js.map +1 -0
  48. package/dist/chunk-AH2JUU6X.js +336 -0
  49. package/dist/chunk-AH2JUU6X.js.map +1 -0
  50. package/dist/{chunk-VX2IUQFE.js → chunk-AQJNPMOA.js} +41 -11
  51. package/dist/chunk-AQJNPMOA.js.map +1 -0
  52. package/dist/{chunk-P73JTV34.js → chunk-BBE34QBJ.js} +4 -4
  53. package/dist/{chunk-5GCNE7CN.js → chunk-BZSQEPRW.js} +454 -140
  54. package/dist/chunk-BZSQEPRW.js.map +1 -0
  55. package/dist/chunk-C5BCH4ZS.js +317 -0
  56. package/dist/chunk-C5BCH4ZS.js.map +1 -0
  57. package/dist/{chunk-C5HUWVH2.js → chunk-CPKTBRS2.js} +6 -6
  58. package/dist/{chunk-IBX3VFOM.js → chunk-D4GAOFF6.js} +118 -2
  59. package/dist/chunk-D4GAOFF6.js.map +1 -0
  60. package/dist/chunk-DB5A3NHS.js +906 -0
  61. package/dist/chunk-DB5A3NHS.js.map +1 -0
  62. package/dist/{chunk-I6BQZSML.js → chunk-DZZPC36E.js} +10 -10
  63. package/dist/{chunk-O4XJUPSF.js → chunk-E2UCDP5S.js} +39 -2
  64. package/dist/chunk-E2UCDP5S.js.map +1 -0
  65. package/dist/{chunk-SRBJUAMP.js → chunk-FMEBPEAO.js} +11 -67
  66. package/dist/chunk-FMEBPEAO.js.map +1 -0
  67. package/dist/{chunk-4DXC6HQQ.js → chunk-FQDPCE3I.js} +5 -5
  68. package/dist/{chunk-NN3LPQ5D.js → chunk-HELQZFZO.js} +155 -16
  69. package/dist/chunk-HELQZFZO.js.map +1 -0
  70. package/dist/{chunk-57QNCUEZ.js → chunk-HL5LRPNA.js} +2 -2
  71. package/dist/{chunk-VTU2B4VF.js → chunk-HQZVVSVB.js} +2 -1
  72. package/dist/chunk-HQZVVSVB.js.map +1 -0
  73. package/dist/{chunk-6Z6UH6TK.js → chunk-HY3L4WKC.js} +69 -3
  74. package/dist/chunk-HY3L4WKC.js.map +1 -0
  75. package/dist/{chunk-QIGOEM65.js → chunk-IB3BFHGN.js} +5 -5
  76. package/dist/{chunk-RXTFCYQF.js → chunk-JESOB2HO.js} +6 -6
  77. package/dist/{chunk-2YMTO4ZJ.js → chunk-JKDVIE52.js} +9 -2
  78. package/dist/chunk-JKDVIE52.js.map +1 -0
  79. package/dist/{chunk-WGK4VHGP.js → chunk-MNU6ZBWT.js} +302 -140
  80. package/dist/chunk-MNU6ZBWT.js.map +1 -0
  81. package/dist/chunk-OAZ5MFUB.js +4124 -0
  82. package/dist/chunk-OAZ5MFUB.js.map +1 -0
  83. package/dist/{chunk-ZTSE2ZJ6.js → chunk-OIGNEXKZ.js} +50 -3
  84. package/dist/chunk-OIGNEXKZ.js.map +1 -0
  85. package/dist/chunk-OZKZ2TRP.js +3729 -0
  86. package/dist/chunk-OZKZ2TRP.js.map +1 -0
  87. package/dist/{chunk-GGD5W7TB.js → chunk-PD6O7AXF.js} +7 -2
  88. package/dist/chunk-PD6O7AXF.js.map +1 -0
  89. package/dist/{chunk-S3IP6R6K.js → chunk-PH4C2U43.js} +23 -3
  90. package/dist/chunk-PH4C2U43.js.map +1 -0
  91. package/dist/chunk-PYPOFEMK.js +294 -0
  92. package/dist/chunk-PYPOFEMK.js.map +1 -0
  93. package/dist/{chunk-EQINRHYR.js → chunk-QDZ2RLEC.js} +243 -7
  94. package/dist/chunk-QDZ2RLEC.js.map +1 -0
  95. package/dist/{chunk-KWBPHZUU.js → chunk-RK6F44Y6.js} +3 -2
  96. package/dist/chunk-RK6F44Y6.js.map +1 -0
  97. package/dist/{chunk-36CTNQY7.js → chunk-RVPLBATS.js} +42 -10
  98. package/dist/chunk-RVPLBATS.js.map +1 -0
  99. package/dist/chunk-SOAU2OE2.js +125 -0
  100. package/dist/chunk-SOAU2OE2.js.map +1 -0
  101. package/dist/{chunk-A4ACKWIW.js → chunk-U5JMRGKX.js} +55 -4
  102. package/dist/chunk-U5JMRGKX.js.map +1 -0
  103. package/dist/{chunk-LIO5X3CM.js → chunk-UVMUAWVT.js} +2 -2
  104. package/dist/chunk-VWT3F4IV.js +2161 -0
  105. package/dist/chunk-VWT3F4IV.js.map +1 -0
  106. package/dist/{chunk-PB5KW5PL.js → chunk-WEJG4TB5.js} +6 -6
  107. package/dist/{chunk-KBYWQWSB.js → chunk-X7HPGUVG.js} +2 -2
  108. package/dist/{chunk-Y5KDIOKF.js → chunk-XAMBKFQS.js} +383 -9
  109. package/dist/chunk-XAMBKFQS.js.map +1 -0
  110. package/dist/{chunk-ZL4S7ARC.js → chunk-Y3VMVTYX.js} +3 -3
  111. package/dist/{chunk-Z5S5HNGY.js → chunk-ZG7PTKBK.js} +21 -5
  112. package/dist/chunk-ZG7PTKBK.js.map +1 -0
  113. package/dist/{chunk-6XA7UN4Z.js → chunk-ZNQN6ZTA.js} +2 -2
  114. package/dist/{chunk-WTFWLUSX.js → chunk-ZVTKDVVM.js} +2 -2
  115. package/dist/{cli-BrEwQTnW.d.ts → cli-BR8KpIU0.d.ts} +2 -2
  116. package/dist/cli.d.ts +7 -4
  117. package/dist/cli.js +44 -40
  118. package/dist/codex-cli-fallback.d.ts +1 -0
  119. package/dist/codex-cli-fallback.js +1 -1
  120. package/dist/compression-optimizer.d.ts +1 -1
  121. package/dist/config.d.ts +1 -1
  122. package/dist/config.js +1 -1
  123. package/dist/consolidation-provenance-check.d.ts +1 -1
  124. package/dist/consolidation-undo.d.ts +1 -1
  125. package/dist/{contradiction-scan-3Z6YW7YA.js → contradiction-scan-QTXAMBUA.js} +3 -2
  126. package/dist/contradiction-scan-QTXAMBUA.js.map +1 -0
  127. package/dist/day-summary.d.ts +1 -1
  128. package/dist/delinearize.d.ts +1 -1
  129. package/dist/direct-answer-wiring.d.ts +1 -1
  130. package/dist/direct-answer-wiring.js +1 -1
  131. package/dist/direct-answer.d.ts +1 -1
  132. package/dist/embedding-fallback.d.ts +1 -1
  133. package/dist/{engine-FOC3IJLA.js → engine-35M5BKQ7.js} +7 -7
  134. package/dist/entity-retrieval.d.ts +1 -1
  135. package/dist/entity-retrieval.js +5 -5
  136. package/dist/entity-schema.d.ts +1 -1
  137. package/dist/event-order-recall.d.ts +17 -0
  138. package/dist/event-order-recall.js +11 -0
  139. package/dist/event-order-recall.js.map +1 -0
  140. package/dist/evidence-pack.d.ts +3 -1
  141. package/dist/evidence-pack.js +5 -3
  142. package/dist/explicit-capture.d.ts +4 -2
  143. package/dist/explicit-cue-recall.d.ts +19 -1
  144. package/dist/explicit-cue-recall.js +10 -4
  145. package/dist/extraction-judge-telemetry.d.ts +1 -1
  146. package/dist/extraction-judge-training.d.ts +1 -1
  147. package/dist/extraction-judge.d.ts +1 -1
  148. package/dist/extraction.d.ts +1 -1
  149. package/dist/extraction.js +8 -7
  150. package/dist/fallback-llm.d.ts +2 -1
  151. package/dist/fallback-llm.js +4 -4
  152. package/dist/focused-list-recall.d.ts +17 -0
  153. package/dist/focused-list-recall.js +11 -0
  154. package/dist/focused-list-recall.js.map +1 -0
  155. package/dist/identity-continuity.d.ts +1 -1
  156. package/dist/importance.d.ts +1 -1
  157. package/dist/{index-1qIcnbG1.d.ts → index-DJ9QWMw-.d.ts} +3 -2
  158. package/dist/index.d.ts +49 -12
  159. package/dist/index.js +289 -115
  160. package/dist/index.js.map +1 -1
  161. package/dist/intent.d.ts +1 -1
  162. package/dist/intent.js +1 -1
  163. package/dist/lifecycle.d.ts +1 -1
  164. package/dist/live-connectors-runner.d.ts +1 -1
  165. package/dist/local-llm.d.ts +8 -4
  166. package/dist/local-llm.js +1 -1
  167. package/dist/mcp-memory-inspector-app.d.ts +106 -0
  168. package/dist/mcp-memory-inspector-app.js +20 -0
  169. package/dist/mcp-memory-inspector-app.js.map +1 -0
  170. package/dist/memory-action-policy.d.ts +1 -1
  171. package/dist/memory-cache.d.ts +1 -1
  172. package/dist/{memory-governance-F3QOJGEY.js → memory-governance-IMPQZXFC.js} +7 -7
  173. package/dist/memory-governance-IMPQZXFC.js.map +1 -0
  174. package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
  175. package/dist/memory-projection-store.d.ts +1 -1
  176. package/dist/memory-provenance.d.ts +57 -0
  177. package/dist/memory-provenance.js +13 -0
  178. package/dist/memory-provenance.js.map +1 -0
  179. package/dist/memory-worth-outcomes.d.ts +1 -1
  180. package/dist/models-json.d.ts +1 -1
  181. package/dist/native-knowledge.d.ts +1 -1
  182. package/dist/objective-state-writers.d.ts +1 -1
  183. package/dist/objective-state-writers.js +2 -2
  184. package/dist/operator-toolkit.d.ts +1 -1
  185. package/dist/operator-toolkit.js +11 -11
  186. package/dist/{orchestrator-6IvQ-Phj.d.ts → orchestrator-DDMPqU6R.d.ts} +10 -1
  187. package/dist/orchestrator.d.ts +4 -2
  188. package/dist/orchestrator.js +53 -46
  189. package/dist/patterns-cli.d.ts +1 -1
  190. package/dist/policy-runtime.d.ts +1 -1
  191. package/dist/qmd-recall-cache.d.ts +1 -1
  192. package/dist/qmd.d.ts +1 -1
  193. package/dist/recall-disclosure-escalation.d.ts +1 -1
  194. package/dist/recall-explain-renderer.d.ts +3 -1
  195. package/dist/recall-explain-renderer.js +5 -3
  196. package/dist/recall-state.d.ts +1 -1
  197. package/dist/recall-tag-filter.d.ts +3 -1
  198. package/dist/recall-xray-cli.d.ts +3 -1
  199. package/dist/recall-xray-cli.js +6 -4
  200. package/dist/recall-xray-renderer.d.ts +3 -1
  201. package/dist/recall-xray-renderer.js +5 -3
  202. package/dist/recall-xray.d.ts +8 -1
  203. package/dist/recall-xray.js +4 -2
  204. package/dist/resolve-auth-token.d.ts +1 -1
  205. package/dist/resolve-provider-secret.js +1 -1
  206. package/dist/response-guidance-recall.d.ts +18 -0
  207. package/dist/response-guidance-recall.js +11 -0
  208. package/dist/response-guidance-recall.js.map +1 -0
  209. package/dist/resume-bundles.js +3 -3
  210. package/dist/retrieval-agents.d.ts +1 -1
  211. package/dist/retrieval-tiers.d.ts +1 -1
  212. package/dist/sdk-compat.d.ts +3 -2
  213. package/dist/sdk-compat.js.map +1 -1
  214. package/dist/semantic-consolidation.d.ts +1 -1
  215. package/dist/semantic-consolidation.js +6 -6
  216. package/dist/semantic-rule-promotion.js +5 -5
  217. package/dist/semantic-rule-verifier.d.ts +1 -1
  218. package/dist/semantic-rule-verifier.js +6 -6
  219. package/dist/session-observer-bands.d.ts +1 -1
  220. package/dist/session-observer-state.d.ts +1 -1
  221. package/dist/signal.d.ts +1 -1
  222. package/dist/storage.d.ts +3 -1
  223. package/dist/storage.js +4 -4
  224. package/dist/summarizer.d.ts +1 -1
  225. package/dist/summarizer.js +6 -6
  226. package/dist/summary-snapshot.d.ts +1 -1
  227. package/dist/targeted-fact-recall.d.ts +17 -0
  228. package/dist/targeted-fact-recall.js +11 -0
  229. package/dist/targeted-fact-recall.js.map +1 -0
  230. package/dist/telemetry-transcript.d.ts +7 -0
  231. package/dist/telemetry-transcript.js +16 -0
  232. package/dist/telemetry-transcript.js.map +1 -0
  233. package/dist/temporal-supersession.d.ts +1 -1
  234. package/dist/temporal-supersession.js +2 -1
  235. package/dist/temporal-validity.d.ts +1 -1
  236. package/dist/threading.d.ts +1 -1
  237. package/dist/tier-migration.d.ts +1 -1
  238. package/dist/tier-routing.d.ts +1 -1
  239. package/dist/tokens.js +1 -1
  240. package/dist/topics.d.ts +1 -1
  241. package/dist/transcript.d.ts +1 -1
  242. package/dist/trust-zones.d.ts +3 -2
  243. package/dist/trust-zones.js +1 -1
  244. package/dist/types.d.ts +60 -2
  245. package/dist/types.js +1 -1
  246. package/dist/user-model.d.ts +37 -0
  247. package/dist/user-model.js +28 -0
  248. package/dist/user-model.js.map +1 -0
  249. package/dist/utility-runtime.d.ts +1 -1
  250. package/dist/verified-recall.js +6 -6
  251. package/package.json +1 -1
  252. package/dist/chunk-2YMTO4ZJ.js.map +0 -1
  253. package/dist/chunk-363MWCD3.js.map +0 -1
  254. package/dist/chunk-36CTNQY7.js.map +0 -1
  255. package/dist/chunk-5GCNE7CN.js.map +0 -1
  256. package/dist/chunk-6AUUAZEX.js.map +0 -1
  257. package/dist/chunk-6Z6UH6TK.js.map +0 -1
  258. package/dist/chunk-74WWN7ZW.js +0 -82
  259. package/dist/chunk-74WWN7ZW.js.map +0 -1
  260. package/dist/chunk-A4ACKWIW.js.map +0 -1
  261. package/dist/chunk-EQINRHYR.js.map +0 -1
  262. package/dist/chunk-ERUDW6DU.js +0 -965
  263. package/dist/chunk-ERUDW6DU.js.map +0 -1
  264. package/dist/chunk-GGD5W7TB.js.map +0 -1
  265. package/dist/chunk-IBX3VFOM.js.map +0 -1
  266. package/dist/chunk-KWBPHZUU.js.map +0 -1
  267. package/dist/chunk-MCC6KDQF.js.map +0 -1
  268. package/dist/chunk-NN3LPQ5D.js.map +0 -1
  269. package/dist/chunk-O4XJUPSF.js.map +0 -1
  270. package/dist/chunk-S3IP6R6K.js.map +0 -1
  271. package/dist/chunk-SRBJUAMP.js.map +0 -1
  272. package/dist/chunk-VQXK37XA.js.map +0 -1
  273. package/dist/chunk-VTU2B4VF.js.map +0 -1
  274. package/dist/chunk-VX2IUQFE.js.map +0 -1
  275. package/dist/chunk-WGK4VHGP.js.map +0 -1
  276. package/dist/chunk-Y5KDIOKF.js.map +0 -1
  277. package/dist/chunk-Z5S5HNGY.js.map +0 -1
  278. package/dist/chunk-ZTSE2ZJ6.js.map +0 -1
  279. package/dist/contradiction-scan-3Z6YW7YA.js.map +0 -1
  280. /package/dist/{capsule-export-LLEVB2RG.js.map → action-confidence.js.map} +0 -0
  281. /package/dist/{capsule-import-UW45R2MZ.js.map → capsule-export-7QNCBZOQ.js.map} +0 -0
  282. /package/dist/{engine-FOC3IJLA.js.map → capsule-import-EPBHD2EN.js.map} +0 -0
  283. /package/dist/{chunk-HJYHRE4S.js.map → chunk-242S3I2A.js.map} +0 -0
  284. /package/dist/{chunk-EYNQTST2.js.map → chunk-4YM32CRU.js.map} +0 -0
  285. /package/dist/{chunk-PHNGXFQ6.js.map → chunk-7V22HTMD.js.map} +0 -0
  286. /package/dist/{chunk-P73JTV34.js.map → chunk-BBE34QBJ.js.map} +0 -0
  287. /package/dist/{chunk-C5HUWVH2.js.map → chunk-CPKTBRS2.js.map} +0 -0
  288. /package/dist/{chunk-I6BQZSML.js.map → chunk-DZZPC36E.js.map} +0 -0
  289. /package/dist/{chunk-4DXC6HQQ.js.map → chunk-FQDPCE3I.js.map} +0 -0
  290. /package/dist/{chunk-57QNCUEZ.js.map → chunk-HL5LRPNA.js.map} +0 -0
  291. /package/dist/{chunk-QIGOEM65.js.map → chunk-IB3BFHGN.js.map} +0 -0
  292. /package/dist/{chunk-RXTFCYQF.js.map → chunk-JESOB2HO.js.map} +0 -0
  293. /package/dist/{chunk-LIO5X3CM.js.map → chunk-UVMUAWVT.js.map} +0 -0
  294. /package/dist/{chunk-PB5KW5PL.js.map → chunk-WEJG4TB5.js.map} +0 -0
  295. /package/dist/{chunk-KBYWQWSB.js.map → chunk-X7HPGUVG.js.map} +0 -0
  296. /package/dist/{chunk-ZL4S7ARC.js.map → chunk-Y3VMVTYX.js.map} +0 -0
  297. /package/dist/{chunk-6XA7UN4Z.js.map → chunk-ZNQN6ZTA.js.map} +0 -0
  298. /package/dist/{chunk-WTFWLUSX.js.map → chunk-ZVTKDVVM.js.map} +0 -0
  299. /package/dist/{memory-governance-F3QOJGEY.js.map → engine-35M5BKQ7.js.map} +0 -0
@@ -1,25 +1,17 @@
1
1
  import {
2
2
  importCapsule
3
- } from "./chunk-QIGOEM65.js";
3
+ } from "./chunk-IB3BFHGN.js";
4
4
  import {
5
5
  applyTagFilter,
6
6
  normalizeTags,
7
7
  parseTagMatch
8
8
  } from "./chunk-BT7NVCML.js";
9
- import {
10
- toRecallExplainJson
11
- } from "./chunk-O4XJUPSF.js";
12
9
  import {
13
10
  decideDisclosureEscalation
14
11
  } from "./chunk-H7XKCNR6.js";
15
12
  import {
16
- buildProposedActions,
17
- buildQualityScore,
18
- groupActionsByStatus,
19
- listMemoryGovernanceRuns,
20
- readMemoryGovernanceRunArtifact,
21
- runMemoryGovernance
22
- } from "./chunk-EYNQTST2.js";
13
+ toRecallExplainJson
14
+ } from "./chunk-E2UCDP5S.js";
23
15
  import {
24
16
  clusterByKey,
25
17
  resolveGitContext
@@ -32,19 +24,27 @@ import {
32
24
  scoreTrustZoneProvenance,
33
25
  seedTrustZoneDemoDataset,
34
26
  summarizeTrustZonePromotionReadiness
35
- } from "./chunk-EQINRHYR.js";
27
+ } from "./chunk-QDZ2RLEC.js";
36
28
  import {
37
29
  estimateRecallTokens
38
- } from "./chunk-2YMTO4ZJ.js";
39
- import {
40
- recordMemoryOutcome
41
- } from "./chunk-EIR5VLIH.js";
30
+ } from "./chunk-JKDVIE52.js";
42
31
  import {
43
32
  recordObjectiveStateSnapshotsFromObservedMessages
44
- } from "./chunk-HJYHRE4S.js";
33
+ } from "./chunk-242S3I2A.js";
45
34
  import {
46
35
  objectiveStateStoreOverrideForNamespace
47
36
  } from "./chunk-5UM2VJ6D.js";
37
+ import {
38
+ buildProposedActions,
39
+ buildQualityScore,
40
+ groupActionsByStatus,
41
+ listMemoryGovernanceRuns,
42
+ readMemoryGovernanceRunArtifact,
43
+ runMemoryGovernance
44
+ } from "./chunk-4YM32CRU.js";
45
+ import {
46
+ recordMemoryOutcome
47
+ } from "./chunk-EIR5VLIH.js";
48
48
  import {
49
49
  buildGraphSnapshot
50
50
  } from "./chunk-PCUKNJAZ.js";
@@ -54,15 +54,15 @@ import {
54
54
  import {
55
55
  formatProfileTraceAscii
56
56
  } from "./chunk-NBNN5GOB.js";
57
+ import {
58
+ buildProcedurePersistBody,
59
+ normalizeProcedureSteps
60
+ } from "./chunk-QDW3E4RD.js";
57
61
  import {
58
62
  persistExplicitCapture,
59
63
  queueExplicitCaptureForReview,
60
64
  validateExplicitCaptureInput
61
65
  } from "./chunk-GVPWB7EY.js";
62
- import {
63
- buildProcedurePersistBody,
64
- normalizeProcedureSteps
65
- } from "./chunk-QDW3E4RD.js";
66
66
  import {
67
67
  CrossNamespaceBudget
68
68
  } from "./chunk-GDFS42HT.js";
@@ -70,33 +70,19 @@ import {
70
70
  filterTrajectoriesByLookbackDays,
71
71
  readCausalTrajectoryRecords
72
72
  } from "./chunk-G2WADRQ3.js";
73
- import {
74
- defaultCapsulesDir
75
- } from "./chunk-74EMIVE4.js";
76
- import {
77
- canReadNamespace,
78
- canWriteNamespace,
79
- defaultNamespaceForPrincipal,
80
- recallNamespacesForPrincipal,
81
- resolvePrincipal
82
- } from "./chunk-N5AKDXAI.js";
83
73
  import {
84
74
  FileCalendarSource,
85
75
  buildBriefing,
86
76
  parseBriefingFocus,
87
77
  parseBriefingWindow
88
- } from "./chunk-WTFWLUSX.js";
78
+ } from "./chunk-ZVTKDVVM.js";
89
79
  import {
90
80
  parseEntityFile
91
- } from "./chunk-MCC6KDQF.js";
81
+ } from "./chunk-3B6KIRBH.js";
92
82
  import {
93
83
  DEFAULT_RECALL_DISCLOSURE,
94
84
  isRecallDisclosure
95
- } from "./chunk-VQXK37XA.js";
96
- import {
97
- inferMemoryStatus,
98
- toMemoryPathRel
99
- } from "./chunk-RULE4VG5.js";
85
+ } from "./chunk-23ZZK64Y.js";
100
86
  import {
101
87
  normalizeProjectionPreview,
102
88
  normalizeProjectionTags
@@ -104,6 +90,20 @@ import {
104
90
  import {
105
91
  getMemoryProjectionPath
106
92
  } from "./chunk-XJKFSSDW.js";
93
+ import {
94
+ inferMemoryStatus,
95
+ toMemoryPathRel
96
+ } from "./chunk-RULE4VG5.js";
97
+ import {
98
+ defaultCapsulesDir
99
+ } from "./chunk-74EMIVE4.js";
100
+ import {
101
+ canReadNamespace,
102
+ canWriteNamespace,
103
+ defaultNamespaceForPrincipal,
104
+ recallNamespacesForPrincipal,
105
+ resolvePrincipal
106
+ } from "./chunk-N5AKDXAI.js";
107
107
  import {
108
108
  log
109
109
  } from "./chunk-2ODBA7MQ.js";
@@ -116,7 +116,10 @@ import {
116
116
  } from "./chunk-XKECPATV.js";
117
117
  import {
118
118
  exportCapsule
119
- } from "./chunk-P73JTV34.js";
119
+ } from "./chunk-BBE34QBJ.js";
120
+ import {
121
+ evaluateActionConfidence
122
+ } from "./chunk-AH2JUU6X.js";
120
123
 
121
124
  // src/access-service.ts
122
125
  import { stat } from "fs/promises";
@@ -1143,24 +1146,24 @@ var EngramAccessService = class {
1143
1146
  }
1144
1147
  throw new EngramAccessInputError(`unsupported recall mode: ${mode}`);
1145
1148
  }
1146
- resolveRecallNamespace(namespace, sessionKey) {
1149
+ resolveRecallNamespace(namespace, sessionKey, authenticatedPrincipal) {
1147
1150
  const requested = namespace?.trim();
1148
1151
  if (!requested) return void 0;
1149
1152
  const resolved = this.resolveNamespace(requested);
1150
- const principal = resolvePrincipal(sessionKey, this.orchestrator.config);
1153
+ const principal = this.resolveRequestPrincipal(sessionKey, authenticatedPrincipal);
1151
1154
  if (!canReadNamespace(principal, resolved, this.orchestrator.config)) {
1152
1155
  throw new EngramAccessInputError(`namespace override is not readable: ${resolved}`);
1153
1156
  }
1154
1157
  return resolved;
1155
1158
  }
1156
- resolveWritePrincipal(sessionKey, authenticatedPrincipal) {
1159
+ resolveRequestPrincipal(sessionKey, authenticatedPrincipal) {
1157
1160
  const trusted = authenticatedPrincipal?.trim();
1158
1161
  if (trusted) return trusted;
1159
1162
  return resolvePrincipal(sessionKey, this.orchestrator.config);
1160
1163
  }
1161
1164
  resolveWritableNamespace(namespace, sessionKey, authenticatedPrincipal) {
1162
1165
  const resolved = this.resolveNamespace(namespace);
1163
- const principal = this.resolveWritePrincipal(sessionKey, authenticatedPrincipal);
1166
+ const principal = this.resolveRequestPrincipal(sessionKey, authenticatedPrincipal);
1164
1167
  if (!canWriteNamespace(principal, resolved, this.orchestrator.config)) {
1165
1168
  throw new EngramAccessInputError(`namespace is not writable: ${resolved}`);
1166
1169
  }
@@ -1213,6 +1216,63 @@ var EngramAccessService = class {
1213
1216
  graph
1214
1217
  } : void 0;
1215
1218
  }
1219
+ async buildRecallResponseFromXraySnapshot(options) {
1220
+ const memoryIds = options.snapshot.results.map((result) => result.memoryId);
1221
+ const resultPaths = options.snapshot.results.map((result) => result.path);
1222
+ const namespace = options.snapshot.namespace ? this.resolveNamespace(options.snapshot.namespace) : this.orchestrator.config.defaultNamespace;
1223
+ const sourcesUsed = Array.from(
1224
+ new Set(options.snapshot.results.map((result) => result.servedBy))
1225
+ );
1226
+ const snapshotForSerialization = {
1227
+ sessionKey: options.sessionKey ?? "",
1228
+ recordedAt: new Date(options.snapshot.capturedAt).toISOString(),
1229
+ queryHash: createHash("sha256").update(options.query).digest("hex"),
1230
+ queryLen: options.query.length,
1231
+ memoryIds,
1232
+ namespace,
1233
+ traceId: options.snapshot.traceId,
1234
+ plannerMode: options.normalizedMode,
1235
+ requestedMode: options.requestedMode && options.requestedMode !== "auto" ? options.requestedMode : void 0,
1236
+ sourcesUsed,
1237
+ budgetsApplied: {
1238
+ appliedTopK: memoryIds.length,
1239
+ recallBudgetChars: options.snapshot.budget.chars,
1240
+ maxMemoryTokens: this.orchestrator.config.maxMemoryTokens,
1241
+ finalContextChars: options.snapshot.budget.used
1242
+ },
1243
+ latencyMs: Date.now() - options.startedAt,
1244
+ resultPaths
1245
+ };
1246
+ const results = await this.serializeRecallResults(
1247
+ snapshotForSerialization,
1248
+ options.disclosure,
1249
+ {
1250
+ query: options.query,
1251
+ ...options.sessionKey ? { sessionKey: options.sessionKey } : {}
1252
+ }
1253
+ );
1254
+ const context = results.map((result) => {
1255
+ const content = typeof result.content === "string" && result.content.length > 0 ? result.content : "";
1256
+ return content || result.preview;
1257
+ }).filter((text) => text.length > 0).join("\n\n");
1258
+ return {
1259
+ query: options.query,
1260
+ ...options.sessionKey ? { sessionKey: options.sessionKey } : {},
1261
+ namespace,
1262
+ context,
1263
+ count: memoryIds.length,
1264
+ memoryIds,
1265
+ results,
1266
+ recordedAt: snapshotForSerialization.recordedAt,
1267
+ traceId: options.snapshot.traceId,
1268
+ plannerMode: options.normalizedMode,
1269
+ fallbackUsed: sourcesUsed.some((source) => source !== "hybrid"),
1270
+ sourcesUsed,
1271
+ disclosure: options.disclosure,
1272
+ budgetsApplied: snapshotForSerialization.budgetsApplied,
1273
+ latencyMs: snapshotForSerialization.latencyMs
1274
+ };
1275
+ }
1216
1276
  async serializeRecallResults(snapshot, disclosure, rawContext = null) {
1217
1277
  if (!snapshot) return [];
1218
1278
  const namespace = snapshot.namespace ? this.resolveNamespace(snapshot.namespace) : this.orchestrator.config.defaultNamespace;
@@ -1389,6 +1449,9 @@ var EngramAccessService = class {
1389
1449
  projectionAvailable
1390
1450
  };
1391
1451
  }
1452
+ async actionConfidence(request = {}) {
1453
+ return evaluateActionConfidence(request);
1454
+ }
1392
1455
  async daySummary(request) {
1393
1456
  if (!this.orchestrator.config.daySummaryEnabled) {
1394
1457
  throw new EngramAccessInputError("day summary is disabled");
@@ -1572,10 +1635,15 @@ var EngramAccessService = class {
1572
1635
  projectTag: request.projectTag
1573
1636
  });
1574
1637
  }
1575
- const namespaceOverride = this.resolveRecallNamespace(request.namespace, request.sessionKey);
1638
+ const authenticatedPrincipal = request.authenticatedPrincipal?.trim();
1639
+ const namespaceOverride = this.resolveRecallNamespace(
1640
+ request.namespace,
1641
+ request.sessionKey,
1642
+ authenticatedPrincipal
1643
+ );
1576
1644
  const namespace = namespaceOverride ?? this.orchestrator.config.defaultNamespace;
1577
1645
  const mode = this.normalizeRecallMode(request.mode);
1578
- const principal = resolvePrincipal(request.sessionKey, this.orchestrator.config);
1646
+ const principal = this.resolveRequestPrincipal(request.sessionKey, authenticatedPrincipal);
1579
1647
  const principalNamespace = defaultNamespaceForPrincipal(principal, this.orchestrator.config);
1580
1648
  const modeSkipsBudget = mode === "no_recall";
1581
1649
  const effectiveNamespaces = namespaceOverride ? [namespaceOverride] : recallNamespacesForPrincipal(principal, this.orchestrator.config);
@@ -1651,6 +1719,7 @@ var EngramAccessService = class {
1651
1719
  namespace: namespaceOverride,
1652
1720
  topK,
1653
1721
  mode,
1722
+ ...authenticatedPrincipal ? { principalOverride: authenticatedPrincipal } : {},
1654
1723
  ...asOf !== void 0 ? { asOf } : {},
1655
1724
  ...request.includeLowConfidence === true ? { includeLowConfidence: true } : {}
1656
1725
  };
@@ -1712,10 +1781,7 @@ var EngramAccessService = class {
1712
1781
  let auditAnomalies;
1713
1782
  if (this.auditAdapter) {
1714
1783
  try {
1715
- const resolvedAgentId = resolvePrincipal(
1716
- request.sessionKey,
1717
- this.orchestrator.config
1718
- );
1784
+ const resolvedAgentId = principal;
1719
1785
  const auditEntry = {
1720
1786
  ts: (/* @__PURE__ */ new Date()).toISOString(),
1721
1787
  sessionKey: request.sessionKey ?? "",
@@ -1859,6 +1925,8 @@ var EngramAccessService = class {
1859
1925
  }
1860
1926
  budgetOverride = parsed;
1861
1927
  }
1928
+ const mode = this.normalizeRecallMode(request.mode);
1929
+ const disclosure = request.disclosure ?? DEFAULT_RECALL_DISCLOSURE;
1862
1930
  const previousQueue = this.xrayQueue;
1863
1931
  let release = () => {
1864
1932
  };
@@ -1866,12 +1934,16 @@ var EngramAccessService = class {
1866
1934
  release = resolve2;
1867
1935
  });
1868
1936
  await previousQueue;
1937
+ const recallStartedAt = Date.now();
1938
+ const recallSessionKey = request.sessionKey?.trim() || void 0;
1939
+ let xrayResponse = { snapshotFound: false };
1869
1940
  try {
1870
1941
  this.orchestrator.clearLastXraySnapshot();
1871
- await this.orchestrator.recall(query, request.sessionKey?.trim() || void 0, {
1942
+ await this.orchestrator.recall(query, recallSessionKey, {
1872
1943
  xrayCapture: true,
1873
1944
  ...requestedNamespace ? { namespace: requestedNamespace } : {},
1874
1945
  ...budgetOverride !== void 0 ? { budgetCharsOverride: budgetOverride } : {},
1946
+ ...mode !== void 0 ? { mode } : {},
1875
1947
  // When the caller supplies an authenticated principal, forward
1876
1948
  // it via the dedicated override channel so orchestrator-side
1877
1949
  // ACL decisions use the SAME principal the access-surface
@@ -1882,104 +1954,128 @@ var EngramAccessService = class {
1882
1954
  // in namespace-enabled deployments produces false denials /
1883
1955
  // wrong-scope serving despite the pre-check passing
1884
1956
  // (CLAUDE.md rule 42).
1885
- ...authenticatedPrincipal ? { principalOverride: authenticatedPrincipal } : {}
1957
+ ...authenticatedPrincipal ? { principalOverride: authenticatedPrincipal } : {},
1958
+ ...request.currentContextScopes !== void 0 ? { currentContextScopes: request.currentContextScopes } : {}
1886
1959
  });
1887
1960
  const rawSnapshot = this.orchestrator.getLastXraySnapshot();
1888
- if (!rawSnapshot) return { snapshotFound: false };
1889
- if (requestedNamespace && rawSnapshot.namespace !== requestedNamespace) {
1890
- return { snapshotFound: false };
1891
- }
1892
- let snapshot = rawSnapshot;
1893
- const xrayFilterTags = normalizeTags(request.tags);
1894
- let xrayTagMatch;
1895
- try {
1896
- xrayTagMatch = parseTagMatch(request.tagMatch);
1897
- } catch (err) {
1898
- throw new EngramAccessInputError(
1899
- err instanceof Error ? err.message : String(err)
1900
- );
1901
- }
1902
- if (xrayFilterTags && xrayFilterTags.length > 0) {
1903
- const namespace = snapshot.namespace ? this.resolveNamespace(snapshot.namespace) : this.orchestrator.config.defaultNamespace;
1904
- const tagsByIndex = await Promise.all(
1905
- snapshot.results.map(async (result) => {
1906
- try {
1907
- const storage = await this.orchestrator.getStorage(namespace);
1908
- const memory = await storage.readMemoryByPath(result.path);
1909
- const t = memory?.frontmatter?.tags;
1910
- return Array.isArray(t) ? normalizeProjectionTags(t) : [];
1911
- } catch {
1912
- return [];
1913
- }
1914
- })
1915
- );
1916
- const tagged = snapshot.results.map((result, index) => ({
1917
- result,
1918
- tags: tagsByIndex[index] ?? []
1919
- }));
1920
- const { results: admittedTagged, trace } = applyTagFilter(tagged, {
1921
- tags: xrayFilterTags,
1922
- tagMatch: xrayTagMatch
1923
- });
1924
- const admittedResults = admittedTagged.map((entry) => entry.result);
1925
- const filters = trace ? [...snapshot.filters, trace] : snapshot.filters;
1926
- snapshot = { ...snapshot, results: admittedResults, filters };
1927
- }
1928
- if (request.disclosure !== void 0) {
1929
- const disclosure = request.disclosure;
1930
- const namespace = snapshot.namespace ? this.resolveNamespace(snapshot.namespace) : this.orchestrator.config.defaultNamespace;
1931
- const trimmedSessionKey = request.sessionKey?.trim() || void 0;
1932
- const rawExcerpts = disclosure === "raw" ? await this.fetchRawExcerpts(disclosure, {
1933
- query,
1934
- ...trimmedSessionKey ? { sessionKey: trimmedSessionKey } : {},
1935
- namespace
1936
- }) : null;
1937
- const rawExcerptText = rawExcerpts && rawExcerpts.length > 0 ? rawExcerpts.map((e) => e.content).join("\n") : "";
1938
- const memoryByIndex = await Promise.all(
1939
- snapshot.results.map(async (result) => {
1940
- try {
1941
- const storage = await this.orchestrator.getStorage(namespace);
1942
- return await storage.readMemoryByPath(result.path);
1943
- } catch {
1944
- return null;
1961
+ const namespaceMismatch = requestedNamespace !== void 0 && rawSnapshot?.namespace !== requestedNamespace;
1962
+ if (!rawSnapshot) {
1963
+ xrayResponse = { snapshotFound: false };
1964
+ } else if (namespaceMismatch) {
1965
+ xrayResponse = { snapshotFound: false };
1966
+ } else {
1967
+ let snapshot = rawSnapshot;
1968
+ const xrayFilterTags = normalizeTags(request.tags);
1969
+ let xrayTagMatch;
1970
+ try {
1971
+ xrayTagMatch = parseTagMatch(request.tagMatch);
1972
+ } catch (err) {
1973
+ throw new EngramAccessInputError(
1974
+ err instanceof Error ? err.message : String(err)
1975
+ );
1976
+ }
1977
+ if (xrayFilterTags && xrayFilterTags.length > 0) {
1978
+ const namespace = snapshot.namespace ? this.resolveNamespace(snapshot.namespace) : this.orchestrator.config.defaultNamespace;
1979
+ const tagsByIndex = await Promise.all(
1980
+ snapshot.results.map(async (result) => {
1981
+ try {
1982
+ const storage = await this.orchestrator.getStorage(namespace);
1983
+ const memory = await storage.readMemoryByPath(result.path);
1984
+ const t = memory?.frontmatter?.tags;
1985
+ return Array.isArray(t) ? normalizeProjectionTags(t) : [];
1986
+ } catch {
1987
+ return [];
1988
+ }
1989
+ })
1990
+ );
1991
+ const tagged = snapshot.results.map((result, index) => ({
1992
+ result,
1993
+ tags: tagsByIndex[index] ?? []
1994
+ }));
1995
+ const { results: admittedTagged, trace } = applyTagFilter(tagged, {
1996
+ tags: xrayFilterTags,
1997
+ tagMatch: xrayTagMatch
1998
+ });
1999
+ const admittedResults = admittedTagged.map((entry) => entry.result);
2000
+ const filters = trace ? [...snapshot.filters, trace] : snapshot.filters;
2001
+ snapshot = { ...snapshot, results: admittedResults, filters };
2002
+ }
2003
+ if (request.disclosure !== void 0) {
2004
+ const disclosure2 = request.disclosure;
2005
+ const namespace = snapshot.namespace ? this.resolveNamespace(snapshot.namespace) : this.orchestrator.config.defaultNamespace;
2006
+ const trimmedSessionKey = request.sessionKey?.trim() || void 0;
2007
+ const rawExcerpts = disclosure2 === "raw" ? await this.fetchRawExcerpts(disclosure2, {
2008
+ query,
2009
+ ...trimmedSessionKey ? { sessionKey: trimmedSessionKey } : {},
2010
+ namespace
2011
+ }) : null;
2012
+ const rawExcerptText = rawExcerpts && rawExcerpts.length > 0 ? rawExcerpts.map((e) => e.content).join("\n") : "";
2013
+ const memoryByIndex = await Promise.all(
2014
+ snapshot.results.map(async (result) => {
2015
+ try {
2016
+ const storage = await this.orchestrator.getStorage(namespace);
2017
+ return await storage.readMemoryByPath(result.path);
2018
+ } catch {
2019
+ return null;
2020
+ }
2021
+ })
2022
+ );
2023
+ const firstReadableIndex = memoryByIndex.findIndex((m) => m !== null);
2024
+ const baseDir = (await this.orchestrator.getStorage(namespace)).dir;
2025
+ const decorated = snapshot.results.map((result, index) => {
2026
+ const memory = memoryByIndex[index];
2027
+ if (!memory) {
2028
+ return { ...result, disclosure: disclosure2 };
1945
2029
  }
1946
- })
1947
- );
1948
- const firstReadableIndex = memoryByIndex.findIndex((m) => m !== null);
1949
- const baseDir = (await this.orchestrator.getStorage(namespace)).dir;
1950
- const decorated = snapshot.results.map((result, index) => {
1951
- const memory = memoryByIndex[index];
1952
- if (!memory) {
1953
- return { ...result, disclosure };
2030
+ const shaped = shapeMemorySummary(
2031
+ memory,
2032
+ baseDir,
2033
+ disclosure2,
2034
+ disclosure2 === "raw" && index === firstReadableIndex && rawExcerpts && rawExcerpts.length > 0 ? rawExcerpts : void 0
2035
+ );
2036
+ return {
2037
+ ...result,
2038
+ disclosure: disclosure2,
2039
+ estimatedTokens: estimateRecallTokens(JSON.stringify(shaped))
2040
+ };
2041
+ });
2042
+ if (disclosure2 === "raw" && firstReadableIndex === -1 && rawExcerptText.length > 0 && decorated.length > 0) {
2043
+ decorated[0] = {
2044
+ ...decorated[0],
2045
+ disclosure: disclosure2,
2046
+ estimatedTokens: estimateRecallTokens(rawExcerptText)
2047
+ };
1954
2048
  }
1955
- const shaped = shapeMemorySummary(
1956
- memory,
1957
- baseDir,
1958
- disclosure,
1959
- disclosure === "raw" && index === firstReadableIndex && rawExcerpts && rawExcerpts.length > 0 ? rawExcerpts : void 0
1960
- );
1961
- return {
1962
- ...result,
1963
- disclosure,
1964
- estimatedTokens: estimateRecallTokens(JSON.stringify(shaped))
2049
+ const decoratedSnapshot = { ...snapshot, results: decorated };
2050
+ xrayResponse = {
2051
+ snapshotFound: true,
2052
+ snapshot: decoratedSnapshot
1965
2053
  };
1966
- });
1967
- if (disclosure === "raw" && firstReadableIndex === -1 && rawExcerptText.length > 0 && decorated.length > 0) {
1968
- decorated[0] = {
1969
- ...decorated[0],
1970
- disclosure,
1971
- estimatedTokens: estimateRecallTokens(rawExcerptText)
2054
+ } else {
2055
+ xrayResponse = {
2056
+ snapshotFound: true,
2057
+ snapshot
1972
2058
  };
1973
2059
  }
1974
- return {
1975
- snapshotFound: true,
1976
- snapshot: { ...snapshot, results: decorated }
1977
- };
1978
2060
  }
1979
- return { snapshotFound: true, snapshot };
1980
2061
  } finally {
1981
2062
  release();
1982
2063
  }
2064
+ if (request.includeRecall === true && xrayResponse.snapshotFound === true && xrayResponse.snapshot) {
2065
+ return {
2066
+ ...xrayResponse,
2067
+ recall: await this.buildRecallResponseFromXraySnapshot({
2068
+ query,
2069
+ sessionKey: recallSessionKey,
2070
+ snapshot: xrayResponse.snapshot,
2071
+ disclosure,
2072
+ startedAt: recallStartedAt,
2073
+ requestedMode: request.mode,
2074
+ normalizedMode: mode
2075
+ })
2076
+ };
2077
+ }
2078
+ return xrayResponse;
1983
2079
  }
1984
2080
  // Sequence lock for `recallXray` — see comment inside the method.
1985
2081
  // Lives on the instance so every x-ray call on the same service
@@ -2914,7 +3010,7 @@ var EngramAccessService = class {
2914
3010
  }
2915
3011
  }
2916
3012
  const hasExplicitNamespace = typeof request.namespace === "string" && request.namespace.trim().length > 0;
2917
- const principal = this.resolveWritePrincipal(
3013
+ const principal = this.resolveRequestPrincipal(
2918
3014
  request.sessionKey,
2919
3015
  request.authenticatedPrincipal
2920
3016
  );
@@ -3009,7 +3105,7 @@ var EngramAccessService = class {
3009
3105
  if (!request.query || typeof request.query !== "string" || request.query.trim().length === 0) {
3010
3106
  throw new EngramAccessInputError("query is required and must be a non-empty string");
3011
3107
  }
3012
- const principal = this.resolveWritePrincipal(request.sessionKey, request.authenticatedPrincipal);
3108
+ const principal = this.resolveRequestPrincipal(request.sessionKey, request.authenticatedPrincipal);
3013
3109
  const namespace = this.resolveReadableNamespace(request.namespace, principal);
3014
3110
  if (!this.orchestrator.lcmEngine || !this.orchestrator.lcmEngine.enabled) {
3015
3111
  return {
@@ -3040,6 +3136,72 @@ var EngramAccessService = class {
3040
3136
  lcmEnabled: true
3041
3137
  };
3042
3138
  }
3139
+ async lcmCompactionFlush(request) {
3140
+ if (!request.sessionKey || typeof request.sessionKey !== "string" || request.sessionKey.trim().length === 0) {
3141
+ throw new EngramAccessInputError("sessionKey is required and must be a non-empty string");
3142
+ }
3143
+ const namespace = this.resolveWritableNamespace(
3144
+ request.namespace,
3145
+ request.sessionKey,
3146
+ request.authenticatedPrincipal
3147
+ );
3148
+ if (!this.orchestrator.lcmEngine || !this.orchestrator.lcmEngine.enabled) {
3149
+ return {
3150
+ enabled: false,
3151
+ flushed: false,
3152
+ sessionKey: request.sessionKey,
3153
+ namespace,
3154
+ reason: "LCM is disabled"
3155
+ };
3156
+ }
3157
+ const lcmSessionKey = namespace !== this.orchestrator.config.defaultNamespace ? `${namespace}:${request.sessionKey}` : request.sessionKey;
3158
+ await this.orchestrator.lcmEngine.waitForSessionObserveIdle(lcmSessionKey);
3159
+ await this.orchestrator.lcmEngine.preCompactionFlush(lcmSessionKey);
3160
+ return {
3161
+ enabled: true,
3162
+ flushed: true,
3163
+ sessionKey: request.sessionKey,
3164
+ namespace
3165
+ };
3166
+ }
3167
+ async lcmCompactionRecord(request) {
3168
+ if (!request.sessionKey || typeof request.sessionKey !== "string" || request.sessionKey.trim().length === 0) {
3169
+ throw new EngramAccessInputError("sessionKey is required and must be a non-empty string");
3170
+ }
3171
+ if (!Number.isInteger(request.tokensBefore) || request.tokensBefore < 0) {
3172
+ throw new EngramAccessInputError("tokensBefore must be a non-negative integer");
3173
+ }
3174
+ if (!Number.isInteger(request.tokensAfter) || request.tokensAfter < 0) {
3175
+ throw new EngramAccessInputError("tokensAfter must be a non-negative integer");
3176
+ }
3177
+ const namespace = this.resolveWritableNamespace(
3178
+ request.namespace,
3179
+ request.sessionKey,
3180
+ request.authenticatedPrincipal
3181
+ );
3182
+ if (!this.orchestrator.lcmEngine || !this.orchestrator.lcmEngine.enabled) {
3183
+ return {
3184
+ enabled: false,
3185
+ recorded: false,
3186
+ sessionKey: request.sessionKey,
3187
+ namespace,
3188
+ reason: "LCM is disabled"
3189
+ };
3190
+ }
3191
+ const lcmSessionKey = namespace !== this.orchestrator.config.defaultNamespace ? `${namespace}:${request.sessionKey}` : request.sessionKey;
3192
+ await this.orchestrator.lcmEngine.waitForSessionObserveIdle(lcmSessionKey);
3193
+ await this.orchestrator.lcmEngine.recordCompaction(
3194
+ lcmSessionKey,
3195
+ request.tokensBefore,
3196
+ request.tokensAfter
3197
+ );
3198
+ return {
3199
+ enabled: true,
3200
+ recorded: true,
3201
+ sessionKey: request.sessionKey,
3202
+ namespace
3203
+ };
3204
+ }
3043
3205
  // ── Parity tools (match OpenClaw plugin feature set) ──────────────────
3044
3206
  // ── Continuity / Identity ──────────────────────────────────────────────
3045
3207
  async continuityAuditGenerate(request) {
@@ -4289,4 +4451,4 @@ export {
4289
4451
  shapeMemorySummary,
4290
4452
  EngramAccessService
4291
4453
  };
4292
- //# sourceMappingURL=chunk-WGK4VHGP.js.map
4454
+ //# sourceMappingURL=chunk-MNU6ZBWT.js.map