@remnic/core 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (485) hide show
  1. package/dist/abort-error.js +1 -0
  2. package/dist/abstraction-nodes.js +1 -0
  3. package/dist/access-audit.js +1 -0
  4. package/dist/access-cli.js +70 -45
  5. package/dist/access-cli.js.map +1 -1
  6. package/dist/access-http.d.ts +50 -5
  7. package/dist/access-http.js +37 -15
  8. package/dist/access-idempotency.js +1 -0
  9. package/dist/access-mcp.d.ts +10 -5
  10. package/dist/access-mcp.js +36 -13
  11. package/dist/access-schema.d.ts +133 -13
  12. package/dist/access-schema.js +20 -1
  13. package/dist/access-service-_AEUMVyX.d.ts +1981 -0
  14. package/dist/access-service.d.ts +11 -6
  15. package/dist/access-service.js +38 -14
  16. package/dist/active-memory-bridge.js +1 -0
  17. package/dist/active-recall.js +1 -0
  18. package/dist/active-recall.js.map +1 -1
  19. package/dist/behavior-learner.js +1 -0
  20. package/dist/behavior-learner.js.map +1 -1
  21. package/dist/behavior-signals.js +1 -0
  22. package/dist/bootstrap.d.ts +6 -4
  23. package/dist/bootstrap.js +1 -0
  24. package/dist/boxes.js +1 -0
  25. package/dist/briefing.d.ts +9 -5
  26. package/dist/briefing.js +9 -6
  27. package/dist/buffer-surprise-report.js +1 -0
  28. package/dist/buffer-surprise.js +1 -0
  29. package/dist/buffer.d.ts +1 -1
  30. package/dist/buffer.js +1 -0
  31. package/dist/calibration.d.ts +8 -1
  32. package/dist/calibration.js +10 -2
  33. package/dist/calibration.js.map +1 -1
  34. package/dist/capsule-cli.d.ts +137 -0
  35. package/dist/capsule-cli.js +34 -0
  36. package/dist/capsule-crypto-5CYAGVC5.js +18 -0
  37. package/dist/capsule-export-NZQPOTQ4.js +17 -0
  38. package/dist/capsule-export-NZQPOTQ4.js.map +1 -0
  39. package/dist/capsule-import-SDCUXLEV.js +16 -0
  40. package/dist/capsule-import-SDCUXLEV.js.map +1 -0
  41. package/dist/capsule-merge-DI7PNQ2H.js +189 -0
  42. package/dist/capsule-merge-DI7PNQ2H.js.map +1 -0
  43. package/dist/causal-behavior.js +1 -0
  44. package/dist/causal-behavior.js.map +1 -1
  45. package/dist/causal-chain.js +1 -0
  46. package/dist/causal-consolidation.js +11 -8
  47. package/dist/causal-consolidation.js.map +1 -1
  48. package/dist/causal-retrieval.js +2 -1
  49. package/dist/causal-retrieval.js.map +1 -1
  50. package/dist/causal-trajectory-graph.js +4 -1
  51. package/dist/causal-trajectory-graph.js.map +1 -1
  52. package/dist/causal-trajectory.js +2 -1
  53. package/dist/chunk-2LSZVONP.js +67 -0
  54. package/dist/chunk-2LSZVONP.js.map +1 -0
  55. package/dist/chunk-32KD5IHZ.js +245 -0
  56. package/dist/chunk-32KD5IHZ.js.map +1 -0
  57. package/dist/{chunk-VDX363PS.js → chunk-34F3PLWZ.js} +10 -3
  58. package/dist/chunk-34F3PLWZ.js.map +1 -0
  59. package/dist/chunk-3KIS4VGT.js +228 -0
  60. package/dist/chunk-3KIS4VGT.js.map +1 -0
  61. package/dist/chunk-3LCWFNVS.js +350 -0
  62. package/dist/chunk-3LCWFNVS.js.map +1 -0
  63. package/dist/chunk-43EKP2UK.js +26 -0
  64. package/dist/chunk-43EKP2UK.js.map +1 -0
  65. package/dist/chunk-457A4P3L.js +119 -0
  66. package/dist/chunk-457A4P3L.js.map +1 -0
  67. package/dist/{chunk-TMYO7B5P.js → chunk-47WOM4YW.js} +2 -2
  68. package/dist/{chunk-OC5OXUQ4.js → chunk-4PLGJRBV.js} +653 -17
  69. package/dist/chunk-4PLGJRBV.js.map +1 -0
  70. package/dist/{chunk-PVICZTKG.js → chunk-55FXRRSJ.js} +5 -5
  71. package/dist/{chunk-PVICZTKG.js.map → chunk-55FXRRSJ.js.map} +1 -1
  72. package/dist/{chunk-ULYOGL6R.js → chunk-5HRY2WRF.js} +7 -3
  73. package/dist/chunk-5HRY2WRF.js.map +1 -0
  74. package/dist/chunk-6TBWYBJ3.js +236 -0
  75. package/dist/chunk-6TBWYBJ3.js.map +1 -0
  76. package/dist/chunk-74EMIVE4.js +329 -0
  77. package/dist/chunk-74EMIVE4.js.map +1 -0
  78. package/dist/chunk-74WWN7ZW.js +82 -0
  79. package/dist/chunk-74WWN7ZW.js.map +1 -0
  80. package/dist/{chunk-6YJHX2DL.js → chunk-7GCMLT7J.js} +242 -22
  81. package/dist/chunk-7GCMLT7J.js.map +1 -0
  82. package/dist/chunk-A6XUJE5D.js +126 -0
  83. package/dist/chunk-A6XUJE5D.js.map +1 -0
  84. package/dist/chunk-AJA46VX5.js +393 -0
  85. package/dist/chunk-AJA46VX5.js.map +1 -0
  86. package/dist/{chunk-UWB5LMWY.js → chunk-AKUCB2OG.js} +525 -24
  87. package/dist/chunk-AKUCB2OG.js.map +1 -0
  88. package/dist/chunk-ASIQZXYO.js +277 -0
  89. package/dist/chunk-ASIQZXYO.js.map +1 -0
  90. package/dist/{chunk-DG6YMRDC.js → chunk-B2TL6GA2.js} +2 -2
  91. package/dist/chunk-BJMBJZ2Y.js +290 -0
  92. package/dist/chunk-BJMBJZ2Y.js.map +1 -0
  93. package/dist/chunk-BT7NVCML.js +79 -0
  94. package/dist/chunk-BT7NVCML.js.map +1 -0
  95. package/dist/chunk-CK5NTM2S.js +454 -0
  96. package/dist/chunk-CK5NTM2S.js.map +1 -0
  97. package/dist/{chunk-AYXIPSZO.js → chunk-CRU27Q4J.js} +2 -2
  98. package/dist/{chunk-F5VP6YCB.js → chunk-DCE6SQLA.js} +572 -155
  99. package/dist/chunk-DCE6SQLA.js.map +1 -0
  100. package/dist/{chunk-CUPFXL3J.js → chunk-DHRQHX36.js} +4 -4
  101. package/dist/chunk-DHRQHX36.js.map +1 -0
  102. package/dist/{chunk-STGWEHYR.js → chunk-DR7MCMPS.js} +981 -61
  103. package/dist/chunk-DR7MCMPS.js.map +1 -0
  104. package/dist/chunk-FP2373TW.js +149 -0
  105. package/dist/chunk-FP2373TW.js.map +1 -0
  106. package/dist/{chunk-RBBWYEFJ.js → chunk-G2WADRQ3.js} +1 -1
  107. package/dist/chunk-G7D6GZ5J.js +48 -0
  108. package/dist/chunk-G7D6GZ5J.js.map +1 -0
  109. package/dist/chunk-H7XKCNR6.js +60 -0
  110. package/dist/chunk-H7XKCNR6.js.map +1 -0
  111. package/dist/{chunk-3YGHKTBF.js → chunk-IM3JSE73.js} +953 -322
  112. package/dist/chunk-IM3JSE73.js.map +1 -0
  113. package/dist/chunk-IXEJRKCZ.js +18 -0
  114. package/dist/chunk-IXEJRKCZ.js.map +1 -0
  115. package/dist/chunk-IYY4MCPG.js +275 -0
  116. package/dist/chunk-IYY4MCPG.js.map +1 -0
  117. package/dist/{chunk-BECYBZLX.js → chunk-JWSENLQI.js} +502 -22
  118. package/dist/chunk-JWSENLQI.js.map +1 -0
  119. package/dist/chunk-KNKUID7G.js +183 -0
  120. package/dist/chunk-KNKUID7G.js.map +1 -0
  121. package/dist/chunk-L2IO2QPY.js +2036 -0
  122. package/dist/chunk-L2IO2QPY.js.map +1 -0
  123. package/dist/{chunk-SPI27QT6.js → chunk-L5IIGA5V.js} +9 -4
  124. package/dist/chunk-L5IIGA5V.js.map +1 -0
  125. package/dist/{chunk-XXVWLXSG.js → chunk-LVYGDT5V.js} +56 -82
  126. package/dist/chunk-LVYGDT5V.js.map +1 -0
  127. package/dist/{chunk-ZAIM4TUE.js → chunk-LW2NMHDW.js} +46 -1
  128. package/dist/chunk-LW2NMHDW.js.map +1 -0
  129. package/dist/{chunk-3OGMS3PE.js → chunk-LZRYQK6L.js} +3 -2
  130. package/dist/chunk-LZRYQK6L.js.map +1 -0
  131. package/dist/chunk-MDYG7VI7.js +48 -0
  132. package/dist/chunk-MDYG7VI7.js.map +1 -0
  133. package/dist/chunk-MXC3AP5I.js +74 -0
  134. package/dist/chunk-MXC3AP5I.js.map +1 -0
  135. package/dist/{chunk-DIXB44VE.js → chunk-N7X62G74.js} +25 -10
  136. package/dist/chunk-N7X62G74.js.map +1 -0
  137. package/dist/chunk-NN3TS5BM.js +147 -0
  138. package/dist/chunk-NN3TS5BM.js.map +1 -0
  139. package/dist/chunk-OA3L7BFR.js +183 -0
  140. package/dist/chunk-OA3L7BFR.js.map +1 -0
  141. package/dist/chunk-OZHRDTDX.js +240 -0
  142. package/dist/chunk-OZHRDTDX.js.map +1 -0
  143. package/dist/chunk-PCUKNJAZ.js +165 -0
  144. package/dist/chunk-PCUKNJAZ.js.map +1 -0
  145. package/dist/{chunk-6PFRXT4K.js → chunk-PFV5C235.js} +11 -6
  146. package/dist/chunk-PFV5C235.js.map +1 -0
  147. package/dist/chunk-PZ5AY32C.js +10 -0
  148. package/dist/chunk-PZ5AY32C.js.map +1 -0
  149. package/dist/{chunk-Y7R2XJ5Q.js → chunk-Q7FJ5ZHM.js} +6 -2
  150. package/dist/chunk-Q7FJ5ZHM.js.map +1 -0
  151. package/dist/{chunk-NBVAS5MT.js → chunk-R2L7SUX2.js} +6 -6
  152. package/dist/{chunk-WCLICCGB.js → chunk-RILIVK4O.js} +91 -4
  153. package/dist/chunk-RILIVK4O.js.map +1 -0
  154. package/dist/{chunk-C2EFFULQ.js → chunk-RK2Y4XOM.js} +163 -20
  155. package/dist/chunk-RK2Y4XOM.js.map +1 -0
  156. package/dist/{chunk-TP4FZJIZ.js → chunk-RULE4VG5.js} +5 -1
  157. package/dist/chunk-RULE4VG5.js.map +1 -0
  158. package/dist/{chunk-PVPWZSSI.js → chunk-SMA4IMHV.js} +19 -3
  159. package/dist/chunk-SMA4IMHV.js.map +1 -0
  160. package/dist/{chunk-L7IXWRYE.js → chunk-SS253RXF.js} +22 -13
  161. package/dist/chunk-SS253RXF.js.map +1 -0
  162. package/dist/chunk-TUFG6VXY.js +875 -0
  163. package/dist/chunk-TUFG6VXY.js.map +1 -0
  164. package/dist/chunk-TYEOAFH3.js +251 -0
  165. package/dist/chunk-TYEOAFH3.js.map +1 -0
  166. package/dist/chunk-UKJAGEXH.js +260 -0
  167. package/dist/chunk-UKJAGEXH.js.map +1 -0
  168. package/dist/{chunk-KVBLZUKV.js → chunk-USFPPRAF.js} +93 -3
  169. package/dist/chunk-USFPPRAF.js.map +1 -0
  170. package/dist/{chunk-GA5P7RST.js → chunk-VTJVUHRK.js} +22 -36
  171. package/dist/chunk-VTJVUHRK.js.map +1 -0
  172. package/dist/chunk-WIICJPET.js +45 -0
  173. package/dist/chunk-WIICJPET.js.map +1 -0
  174. package/dist/{chunk-VBVG2M5G.js → chunk-WPGJYVUH.js} +6 -2
  175. package/dist/chunk-WPGJYVUH.js.map +1 -0
  176. package/dist/{chunk-4HQS2HPX.js → chunk-WSZIHQBK.js} +29 -9
  177. package/dist/{chunk-4HQS2HPX.js.map → chunk-WSZIHQBK.js.map} +1 -1
  178. package/dist/{chunk-NZLQTHS5.js → chunk-WW3QQF4H.js} +4 -1
  179. package/dist/chunk-WW3QQF4H.js.map +1 -0
  180. package/dist/{chunk-FVA6TGI3.js → chunk-Y3WQ4ZWK.js} +42 -2
  181. package/dist/chunk-Y3WQ4ZWK.js.map +1 -0
  182. package/dist/chunk-YNJHCGDT.js +309 -0
  183. package/dist/chunk-YNJHCGDT.js.map +1 -0
  184. package/dist/{chunk-LOIMBRDE.js → chunk-ZGXSCMQN.js} +1993 -411
  185. package/dist/chunk-ZGXSCMQN.js.map +1 -0
  186. package/dist/{chunk-W6SL7OFG.js → chunk-ZTSE2ZJ6.js} +12 -2
  187. package/dist/{chunk-W6SL7OFG.js.map → chunk-ZTSE2ZJ6.js.map} +1 -1
  188. package/dist/chunking.js +1 -0
  189. package/dist/cipher-GVE2GQ5H.js +28 -0
  190. package/dist/cipher-GVE2GQ5H.js.map +1 -0
  191. package/dist/citations.js +1 -0
  192. package/dist/{cli-BkeRaYfk.d.ts → cli-x2APT9a6.d.ts} +26 -7
  193. package/dist/cli.d.ts +11 -6
  194. package/dist/cli.js +67 -33
  195. package/dist/codex-thread-key.js +1 -0
  196. package/dist/commitment-ledger.js +1 -0
  197. package/dist/compression-optimizer.js +1 -0
  198. package/dist/config.d.ts +2 -1
  199. package/dist/config.js +4 -1
  200. package/dist/connectors-cli-DFGtY2DB.d.ts +257 -0
  201. package/dist/connectors-cli.d.ts +2 -0
  202. package/dist/connectors-cli.js +22 -0
  203. package/dist/connectors-cli.js.map +1 -0
  204. package/dist/consolidation-operator.d.ts +65 -5
  205. package/dist/consolidation-operator.js +6 -1
  206. package/dist/consolidation-provenance-check.d.ts +1 -1
  207. package/dist/consolidation-provenance-check.js +3 -2
  208. package/dist/consolidation-undo.d.ts +1 -1
  209. package/dist/consolidation-undo.js +1 -0
  210. package/dist/consolidation-undo.js.map +1 -1
  211. package/dist/{contradiction-review-WIUBAR52.js → contradiction-review-5LTTVDQV.js} +2 -1
  212. package/dist/contradiction-review-5LTTVDQV.js.map +1 -0
  213. package/dist/{contradiction-scan-E3GJTI4F.js → contradiction-scan-3Z6YW7YA.js} +2 -1
  214. package/dist/{contradiction-scan-E3GJTI4F.js.map → contradiction-scan-3Z6YW7YA.js.map} +1 -1
  215. package/dist/cross-namespace-budget.js +1 -0
  216. package/dist/cue-anchors.js +1 -0
  217. package/dist/dashboard-runtime.js +1 -0
  218. package/dist/day-summary.js +1 -0
  219. package/dist/delinearize.js +1 -0
  220. package/dist/direct-answer-wiring.js +1 -0
  221. package/dist/direct-answer.js +1 -0
  222. package/dist/dreams-ledger-LR2NBAZE.js +286 -0
  223. package/dist/dreams-ledger-LR2NBAZE.js.map +1 -0
  224. package/dist/embedding-fallback.js +1 -0
  225. package/dist/{engine-72LSIWQP.js → engine-ICC2DSQF.js} +10 -7
  226. package/dist/engine-ICC2DSQF.js.map +1 -0
  227. package/dist/entity-retrieval.d.ts +1 -1
  228. package/dist/entity-retrieval.js +9 -6
  229. package/dist/entity-schema.js +1 -0
  230. package/dist/evals.js +1 -0
  231. package/dist/evidence-pack.d.ts +16 -0
  232. package/dist/evidence-pack.js +8 -0
  233. package/dist/evidence-pack.js.map +1 -0
  234. package/dist/explicit-capture.d.ts +6 -4
  235. package/dist/explicit-capture.js +1 -0
  236. package/dist/extraction-judge-telemetry.js +1 -0
  237. package/dist/extraction-judge-training.js +1 -0
  238. package/dist/extraction-judge.js +1 -0
  239. package/dist/extraction.js +7 -6
  240. package/dist/fallback-llm.js +3 -2
  241. package/dist/first-start-migration-4MHQEOSD.js +263 -0
  242. package/dist/first-start-migration-4MHQEOSD.js.map +1 -0
  243. package/dist/forget-PLR6J5DN.js +69 -0
  244. package/dist/forget-PLR6J5DN.js.map +1 -0
  245. package/dist/framework-CyHYDcri.d.ts +153 -0
  246. package/dist/fs-utils-IRVUFB6G.js +30 -0
  247. package/dist/fs-utils-IRVUFB6G.js.map +1 -0
  248. package/dist/graph-dashboard-diff.js +1 -0
  249. package/dist/graph-dashboard-key.js +1 -0
  250. package/dist/graph-dashboard-parser.js +1 -0
  251. package/dist/graph-edge-decay-PWB63GRE.js +207 -0
  252. package/dist/graph-edge-decay-PWB63GRE.js.map +1 -0
  253. package/dist/graph-edge-reinforcement.d.ts +81 -0
  254. package/dist/graph-edge-reinforcement.js +24 -0
  255. package/dist/graph-edge-reinforcement.js.map +1 -0
  256. package/dist/graph-events.d.ts +87 -0
  257. package/dist/graph-events.js +14 -0
  258. package/dist/graph-events.js.map +1 -0
  259. package/dist/graph-recall.js +1 -0
  260. package/dist/graph-retrieval.js +1 -0
  261. package/dist/graph-snapshot.d.ts +112 -0
  262. package/dist/graph-snapshot.js +19 -0
  263. package/dist/graph-snapshot.js.map +1 -0
  264. package/dist/graph.d.ts +105 -7
  265. package/dist/graph.js +20 -3
  266. package/dist/harmonic-retrieval.js +1 -0
  267. package/dist/himem.js +1 -0
  268. package/dist/hygiene.js +1 -0
  269. package/dist/identity-continuity.js +1 -0
  270. package/dist/importance.js +1 -0
  271. package/dist/index.d.ts +562 -13
  272. package/dist/index.js +329 -67
  273. package/dist/index.js.map +1 -1
  274. package/dist/intent.js +1 -0
  275. package/dist/json-extract.js +1 -0
  276. package/dist/json-store.js +1 -0
  277. package/dist/kdf-7S6RWKLZ.js +26 -0
  278. package/dist/kdf-7S6RWKLZ.js.map +1 -0
  279. package/dist/legacy-hook-compat.js +1 -0
  280. package/dist/legacy-hook-compat.js.map +1 -1
  281. package/dist/lifecycle.js +1 -0
  282. package/dist/live-connectors-runner.d.ts +48 -0
  283. package/dist/live-connectors-runner.js +17 -0
  284. package/dist/live-connectors-runner.js.map +1 -0
  285. package/dist/local-llm.js +1 -0
  286. package/dist/logger.js +1 -0
  287. package/dist/memory-action-policy.js +1 -0
  288. package/dist/memory-cache.d.ts +2 -1
  289. package/dist/memory-cache.js +4 -1
  290. package/dist/memory-governance-KG52RITE.js +37 -0
  291. package/dist/memory-governance-KG52RITE.js.map +1 -0
  292. package/dist/memory-lifecycle-ledger-utils.d.ts +2 -1
  293. package/dist/memory-lifecycle-ledger-utils.js +4 -1
  294. package/dist/memory-projection-format.js +1 -0
  295. package/dist/{memory-projection-store-DeSXPh1j.d.ts → memory-projection-store-D3vBHS4J.d.ts} +1 -0
  296. package/dist/memory-projection-store.d.ts +1 -1
  297. package/dist/memory-projection-store.js +1 -0
  298. package/dist/memory-worth-bench.js +1 -0
  299. package/dist/memory-worth-bench.js.map +1 -1
  300. package/dist/memory-worth-filter.js +1 -0
  301. package/dist/memory-worth-outcomes.d.ts +1 -1
  302. package/dist/memory-worth-outcomes.js +1 -0
  303. package/dist/memory-worth.js +1 -0
  304. package/dist/metadata-FC3XPDRQ.js +21 -0
  305. package/dist/metadata-FC3XPDRQ.js.map +1 -0
  306. package/dist/migrate-from-identity-anchor-TTEDEJGX.js +8 -0
  307. package/dist/migrate-from-identity-anchor-TTEDEJGX.js.map +1 -0
  308. package/dist/model-registry.js +1 -0
  309. package/dist/models-json.js +1 -0
  310. package/dist/native-knowledge.js +1 -0
  311. package/dist/negative.js +1 -0
  312. package/dist/objective-state-writers.js +1 -0
  313. package/dist/objective-state-writers.js.map +1 -1
  314. package/dist/objective-state.js +1 -0
  315. package/dist/openai-chat-compat.js +1 -0
  316. package/dist/operator-toolkit.d.ts +46 -2
  317. package/dist/operator-toolkit.js +28 -16
  318. package/dist/opik-exporter.js +1 -0
  319. package/dist/opik-exporter.js.map +1 -1
  320. package/dist/{orchestrator-CmJ-NTdJ.d.ts → orchestrator-ChkesB8U.d.ts} +177 -13
  321. package/dist/orchestrator.d.ts +6 -4
  322. package/dist/orchestrator.js +55 -39
  323. package/dist/page-versioning.js +1 -0
  324. package/dist/path-RMTY5Y5A.js +9 -0
  325. package/dist/path-RMTY5Y5A.js.map +1 -0
  326. package/dist/patterns-cli.d.ts +160 -0
  327. package/dist/patterns-cli.js +29 -0
  328. package/dist/patterns-cli.js.map +1 -0
  329. package/dist/peers-6OSQ3NK6.js +44 -0
  330. package/dist/peers-6OSQ3NK6.js.map +1 -0
  331. package/dist/plugin-id.js +1 -0
  332. package/dist/policy-runtime.js +1 -0
  333. package/dist/{port-BADbLZU5.d.ts → port-hqGnoStS.d.ts} +6 -0
  334. package/dist/profiling.js +1 -0
  335. package/dist/purge-6ATBGT77.js +205 -0
  336. package/dist/purge-6ATBGT77.js.map +1 -0
  337. package/dist/qmd-recall-cache.d.ts +1 -1
  338. package/dist/qmd-recall-cache.js +1 -0
  339. package/dist/qmd.d.ts +2 -1
  340. package/dist/qmd.js +4 -3
  341. package/dist/reasoning-trace-recall.js +1 -0
  342. package/dist/reasoning-trace-types.js +1 -0
  343. package/dist/recall-audit-anomaly.js +1 -0
  344. package/dist/recall-audit.js +1 -0
  345. package/dist/recall-disclosure-escalation.d.ts +84 -0
  346. package/dist/recall-disclosure-escalation.js +14 -0
  347. package/dist/recall-disclosure-escalation.js.map +1 -0
  348. package/dist/recall-explain-renderer.js +4 -1
  349. package/dist/recall-mmr.js +1 -0
  350. package/dist/recall-qos.js +1 -0
  351. package/dist/recall-query-policy.js +1 -0
  352. package/dist/recall-state.d.ts +7 -0
  353. package/dist/recall-state.js +2 -1
  354. package/dist/recall-tag-filter.d.ts +56 -0
  355. package/dist/recall-tag-filter.js +14 -0
  356. package/dist/recall-tag-filter.js.map +1 -0
  357. package/dist/recall-tokenization.js +1 -0
  358. package/dist/recall-xray-cli.d.ts +9 -2
  359. package/dist/recall-xray-cli.js +9 -4
  360. package/dist/recall-xray-renderer.js +4 -1
  361. package/dist/recall-xray.d.ts +116 -2
  362. package/dist/recall-xray.js +9 -3
  363. package/dist/reconstruct.js +1 -0
  364. package/dist/release-changelog.js +2 -0
  365. package/dist/release-changelog.js.map +1 -1
  366. package/dist/relevance.js +1 -0
  367. package/dist/rerank.js +1 -0
  368. package/dist/{resolution-QBTDHTG7.js → resolution-YGIBORXI.js} +2 -1
  369. package/dist/{resolution-QBTDHTG7.js.map → resolution-YGIBORXI.js.map} +1 -1
  370. package/dist/resolve-auth-token.d.ts +51 -0
  371. package/dist/resolve-auth-token.js +12 -0
  372. package/dist/resolve-auth-token.js.map +1 -0
  373. package/dist/resolve-provider-secret.d.ts +9 -1
  374. package/dist/resolve-provider-secret.js +4 -1
  375. package/dist/resume-bundles.js +4 -3
  376. package/dist/retrieval-agents.d.ts +1 -1
  377. package/dist/retrieval-agents.js +1 -0
  378. package/dist/retrieval-tiers.js +1 -0
  379. package/dist/retrieval.js +1 -0
  380. package/dist/sanitize.js +1 -0
  381. package/dist/schemas.d.ts +37 -24
  382. package/dist/schemas.js +2 -1
  383. package/dist/sdk-compat.js +1 -0
  384. package/dist/sdk-compat.js.map +1 -1
  385. package/dist/secure-store-4R2GSO7S.js +156 -0
  386. package/dist/secure-store-4R2GSO7S.js.map +1 -0
  387. package/dist/semantic-chunking.js +1 -0
  388. package/dist/{semantic-consolidation-CxJU6MJk.d.ts → semantic-consolidation-ByBXb-sf.d.ts} +3 -3
  389. package/dist/semantic-consolidation.d.ts +2 -2
  390. package/dist/semantic-consolidation.js +11 -6
  391. package/dist/semantic-rule-promotion.d.ts +1 -1
  392. package/dist/semantic-rule-promotion.js +9 -6
  393. package/dist/semantic-rule-verifier.d.ts +1 -1
  394. package/dist/semantic-rule-verifier.js +9 -6
  395. package/dist/session-integrity.js +1 -0
  396. package/dist/session-observer-bands.js +1 -0
  397. package/dist/session-observer-state.js +1 -0
  398. package/dist/session-toggles.js +2 -0
  399. package/dist/session-toggles.js.map +1 -1
  400. package/dist/signal.js +1 -0
  401. package/dist/skills-registry.js +2 -0
  402. package/dist/skills-registry.js.map +1 -1
  403. package/dist/source-attribution.js +1 -0
  404. package/dist/state-NCHQ4TRG.js +8 -0
  405. package/dist/state-NCHQ4TRG.js.map +1 -0
  406. package/dist/state-store-3EH7HYIN.js +16 -0
  407. package/dist/state-store-3EH7HYIN.js.map +1 -0
  408. package/dist/storage.d.ts +76 -2
  409. package/dist/storage.js +8 -5
  410. package/dist/store-contract.js +1 -0
  411. package/dist/summarizer.js +5 -4
  412. package/dist/summary-snapshot.js +1 -0
  413. package/dist/temporal-index.js +1 -0
  414. package/dist/temporal-supersession.d.ts +1 -1
  415. package/dist/temporal-supersession.js +2 -1
  416. package/dist/temporal-validity.d.ts +52 -0
  417. package/dist/temporal-validity.js +14 -0
  418. package/dist/temporal-validity.js.map +1 -0
  419. package/dist/threading.js +1 -0
  420. package/dist/tier-migration.d.ts +2 -2
  421. package/dist/tier-migration.js +1 -0
  422. package/dist/tier-routing.js +1 -0
  423. package/dist/tier-stats-62ZVDFKS.js +152 -0
  424. package/dist/tier-stats-62ZVDFKS.js.map +1 -0
  425. package/dist/tmt.js +1 -0
  426. package/dist/tokens.js +1 -0
  427. package/dist/topics.js +1 -0
  428. package/dist/trace-C5ETWBEF.js +290 -0
  429. package/dist/trace-C5ETWBEF.js.map +1 -0
  430. package/dist/transcript.js +1 -0
  431. package/dist/trust-zones.js +1 -0
  432. package/dist/tui-RI7P6PBS.js +13 -0
  433. package/dist/tui-RI7P6PBS.js.map +1 -0
  434. package/dist/types-V3FJ26TF.js +30 -0
  435. package/dist/types-V3FJ26TF.js.map +1 -0
  436. package/dist/types.d.ts +634 -9
  437. package/dist/types.js +10 -3
  438. package/dist/utility-learner.js +1 -0
  439. package/dist/utility-runtime.js +1 -0
  440. package/dist/utility-telemetry.js +1 -0
  441. package/dist/verified-recall.js +9 -6
  442. package/dist/version-utils.js +1 -0
  443. package/dist/whitespace.js +1 -0
  444. package/dist/work-product-ledger.js +1 -0
  445. package/package.json +2 -1
  446. package/dist/access-service-Br8ZydTK.d.ts +0 -827
  447. package/dist/chunk-3OGMS3PE.js.map +0 -1
  448. package/dist/chunk-3YGHKTBF.js.map +0 -1
  449. package/dist/chunk-6PFRXT4K.js.map +0 -1
  450. package/dist/chunk-6YJHX2DL.js.map +0 -1
  451. package/dist/chunk-BECYBZLX.js.map +0 -1
  452. package/dist/chunk-C2EFFULQ.js.map +0 -1
  453. package/dist/chunk-CUPFXL3J.js.map +0 -1
  454. package/dist/chunk-DIXB44VE.js.map +0 -1
  455. package/dist/chunk-F5VP6YCB.js.map +0 -1
  456. package/dist/chunk-FVA6TGI3.js.map +0 -1
  457. package/dist/chunk-GA5P7RST.js.map +0 -1
  458. package/dist/chunk-KVBLZUKV.js.map +0 -1
  459. package/dist/chunk-L7IXWRYE.js.map +0 -1
  460. package/dist/chunk-LOIMBRDE.js.map +0 -1
  461. package/dist/chunk-LTCGGW2D.js +0 -14
  462. package/dist/chunk-LTCGGW2D.js.map +0 -1
  463. package/dist/chunk-NZLQTHS5.js.map +0 -1
  464. package/dist/chunk-OC5OXUQ4.js.map +0 -1
  465. package/dist/chunk-PVPWZSSI.js.map +0 -1
  466. package/dist/chunk-SPI27QT6.js.map +0 -1
  467. package/dist/chunk-STGWEHYR.js.map +0 -1
  468. package/dist/chunk-TP4FZJIZ.js.map +0 -1
  469. package/dist/chunk-ULYOGL6R.js.map +0 -1
  470. package/dist/chunk-UWB5LMWY.js.map +0 -1
  471. package/dist/chunk-VBVG2M5G.js.map +0 -1
  472. package/dist/chunk-VDX363PS.js.map +0 -1
  473. package/dist/chunk-WCLICCGB.js.map +0 -1
  474. package/dist/chunk-X6GF3FX2.js +0 -26
  475. package/dist/chunk-X6GF3FX2.js.map +0 -1
  476. package/dist/chunk-XXVWLXSG.js.map +0 -1
  477. package/dist/chunk-Y7R2XJ5Q.js.map +0 -1
  478. package/dist/chunk-ZAIM4TUE.js.map +0 -1
  479. /package/dist/{contradiction-review-WIUBAR52.js.map → capsule-cli.js.map} +0 -0
  480. /package/dist/{engine-72LSIWQP.js.map → capsule-crypto-5CYAGVC5.js.map} +0 -0
  481. /package/dist/{chunk-TMYO7B5P.js.map → chunk-47WOM4YW.js.map} +0 -0
  482. /package/dist/{chunk-DG6YMRDC.js.map → chunk-B2TL6GA2.js.map} +0 -0
  483. /package/dist/{chunk-AYXIPSZO.js.map → chunk-CRU27Q4J.js.map} +0 -0
  484. /package/dist/{chunk-RBBWYEFJ.js.map → chunk-G2WADRQ3.js.map} +0 -0
  485. /package/dist/{chunk-NBVAS5MT.js.map → chunk-R2L7SUX2.js.map} +0 -0
@@ -1,18 +1,27 @@
1
1
  import {
2
2
  EngramMcpServer
3
- } from "./chunk-OC5OXUQ4.js";
3
+ } from "./chunk-4PLGJRBV.js";
4
4
  import {
5
5
  EngramAccessInputError
6
- } from "./chunk-STGWEHYR.js";
6
+ } from "./chunk-DR7MCMPS.js";
7
7
  import {
8
8
  isTrustZoneName
9
9
  } from "./chunk-EQINRHYR.js";
10
+ import {
11
+ expandTildePath
12
+ } from "./chunk-IXEJRKCZ.js";
13
+ import {
14
+ subscribeGraphEvents
15
+ } from "./chunk-WIICJPET.js";
16
+ import {
17
+ isRecallDisclosure
18
+ } from "./chunk-43EKP2UK.js";
10
19
  import {
11
20
  log
12
21
  } from "./chunk-2ODBA7MQ.js";
13
22
  import {
14
23
  validateRequest
15
- } from "./chunk-WCLICCGB.js";
24
+ } from "./chunk-RILIVK4O.js";
16
25
 
17
26
  // src/access-http.ts
18
27
  import { createServer } from "http";
@@ -156,9 +165,14 @@ var AdapterRegistry = class {
156
165
 
157
166
  // src/access-http.ts
158
167
  function resolveDefaultAdminConsolePublicDir() {
168
+ const thisDir = path.dirname(fileURLToPath(import.meta.url));
159
169
  const candidates = [
160
- fileURLToPath(new URL("../admin-console/public", import.meta.url)),
161
- fileURLToPath(new URL("./admin-console/public", import.meta.url))
170
+ // Standard: admin-console sibling to src/ (development layout)
171
+ path.resolve(thisDir, "../admin-console/public"),
172
+ // Bundled: admin-console inside dist/ alongside the bundle
173
+ path.resolve(thisDir, "./admin-console/public"),
174
+ // Package root: walk up from dist/ to the package root
175
+ path.resolve(thisDir, "../../admin-console/public")
162
176
  ];
163
177
  return candidates.find((candidate) => existsSync(candidate)) ?? candidates[0];
164
178
  }
@@ -206,6 +220,13 @@ function parseTrustZoneFilter(raw) {
206
220
  }
207
221
  throw new HttpError(400, "zone must be one of quarantine|working|trusted", "invalid_zone_filter");
208
222
  }
223
+ function decodePeerIdSegment(raw) {
224
+ try {
225
+ return decodeURIComponent(raw);
226
+ } catch {
227
+ throw new EngramAccessInputError("peerId path segment is not valid percent-encoded input");
228
+ }
229
+ }
209
230
  var EngramAccessHttpServer = class {
210
231
  service;
211
232
  host;
@@ -223,6 +244,18 @@ var EngramAccessHttpServer = class {
223
244
  mcpServer;
224
245
  server = null;
225
246
  boundPort = 0;
247
+ /** Active SSE response objects for /engram/v1/graph/events. */
248
+ sseClients = /* @__PURE__ */ new Set();
249
+ /** Throttle batch: pending SSE event batches per client. */
250
+ sseBatchTimers = /* @__PURE__ */ new Map();
251
+ ssePendingBatches = /* @__PURE__ */ new Map();
252
+ /**
253
+ * Per-client cleanup callbacks: clear heartbeat interval, flush timer,
254
+ * unsubscribe from bus, and end the response. Stored here so `stop()`
255
+ * can invoke them even when the client hasn't disconnected yet
256
+ * (Cursor review thread `access-http.ts:232`).
257
+ */
258
+ sseCleanupFns = /* @__PURE__ */ new Set();
226
259
  constructor(options) {
227
260
  this.service = options.service;
228
261
  this.host = options.host?.trim() || "127.0.0.1";
@@ -298,6 +331,25 @@ var EngramAccessHttpServer = class {
298
331
  const server = this.server;
299
332
  this.server = null;
300
333
  this.boundPort = 0;
334
+ for (const cleanup of this.sseCleanupFns) {
335
+ try {
336
+ cleanup();
337
+ } catch {
338
+ }
339
+ }
340
+ this.sseCleanupFns.clear();
341
+ for (const [res, timer] of this.sseBatchTimers.entries()) {
342
+ clearTimeout(timer);
343
+ this.sseBatchTimers.delete(res);
344
+ }
345
+ this.ssePendingBatches.clear();
346
+ for (const res of this.sseClients) {
347
+ try {
348
+ res.end();
349
+ } catch {
350
+ }
351
+ }
352
+ this.sseClients.clear();
301
353
  await new Promise((resolve, reject) => {
302
354
  server.close((err) => err ? reject(err) : resolve());
303
355
  });
@@ -367,13 +419,37 @@ var EngramAccessHttpServer = class {
367
419
  resolveNamespace(_req, bodyNamespace) {
368
420
  return bodyNamespace || void 0;
369
421
  }
422
+ /**
423
+ * Resolve the recall disclosure depth from the request (issue #677 PR
424
+ * 2/4). Explicit body value wins; otherwise we accept a
425
+ * `?disclosure=...` query parameter so curl/browser tooling can use the
426
+ * three-tier surface without rewriting JSON. Invalid query values
427
+ * throw `EngramAccessInputError` (CLAUDE.md rule 51 — no silent
428
+ * fallback). An absent body field AND an absent query param yields
429
+ * `undefined`, which the service maps to `DEFAULT_RECALL_DISCLOSURE`.
430
+ */
431
+ resolveRecallDisclosure(bodyDisclosure, parsed) {
432
+ if (bodyDisclosure !== void 0) {
433
+ return bodyDisclosure;
434
+ }
435
+ const queryDisclosure = parsed.searchParams.get("disclosure");
436
+ if (queryDisclosure === null) {
437
+ return void 0;
438
+ }
439
+ if (!isRecallDisclosure(queryDisclosure)) {
440
+ throw new EngramAccessInputError(
441
+ `disclosure must be one of: chunk, section, raw (got: ${queryDisclosure})`
442
+ );
443
+ }
444
+ return queryDisclosure;
445
+ }
370
446
  async handle(req, res, correlationId) {
371
447
  const parsed = new URL(req.url ?? "/", `http://${hostToUrlAuthority(this.host)}`);
372
448
  const pathname = parsed.pathname;
373
449
  if (this.adminConsoleEnabled && await this.handleAdminConsole(req, res, pathname)) {
374
450
  return;
375
451
  }
376
- if (!this.isAuthorized(req)) {
452
+ if (!this.isAuthorized(req, pathname)) {
377
453
  const body = JSON.stringify({ error: "unauthorized", code: "unauthorized" });
378
454
  res.writeHead(401, {
379
455
  "content-type": "application/json; charset=utf-8",
@@ -403,6 +479,45 @@ var EngramAccessHttpServer = class {
403
479
  if (req.method === "POST" && pathname === "/engram/v1/recall") {
404
480
  const body = await this.readValidatedBody(req, "recall");
405
481
  const codingContext = "codingContext" in body ? body.codingContext : void 0;
482
+ const disclosure = this.resolveRecallDisclosure(body.disclosure, parsed);
483
+ const asOfQueryRaw = parsed.searchParams.get("as_of");
484
+ const bodyHasAsOf = typeof body.asOf === "string" && body.asOf.length > 0;
485
+ if (!bodyHasAsOf && asOfQueryRaw !== null && asOfQueryRaw.length === 0) {
486
+ throw new EngramAccessInputError(
487
+ "as_of must be a non-empty timestamp (got empty value)"
488
+ );
489
+ }
490
+ const asOf = body.asOf ?? (asOfQueryRaw !== null && asOfQueryRaw.length > 0 ? asOfQueryRaw : void 0);
491
+ const bodyHasTagsField = body !== null && typeof body === "object" && "tags" in body;
492
+ const bodyTagsValue = bodyHasTagsField ? body.tags : void 0;
493
+ const bodyTags = Array.isArray(bodyTagsValue) ? bodyTagsValue : void 0;
494
+ const queryTags = parsed.searchParams.getAll("tag");
495
+ const tags = bodyHasTagsField ? bodyTags : queryTags.length > 0 ? queryTags : void 0;
496
+ const bodyTagMatch = body.tagMatch;
497
+ let tagMatch;
498
+ if (bodyTagMatch !== void 0) {
499
+ if (bodyTagMatch === "any" || bodyTagMatch === "all") {
500
+ tagMatch = bodyTagMatch;
501
+ }
502
+ } else {
503
+ const queryTagMatch = parsed.searchParams.get("tag_match");
504
+ if (queryTagMatch !== null) {
505
+ if (queryTagMatch !== "any" && queryTagMatch !== "all") {
506
+ throw new EngramAccessInputError(
507
+ `tag_match must be one of: any, all (got: ${queryTagMatch})`
508
+ );
509
+ }
510
+ tagMatch = queryTagMatch;
511
+ }
512
+ }
513
+ const bodyIncludeLowConfidence = body.includeLowConfidence;
514
+ const queryIncludeLowConfidence = parsed.searchParams.get("include_low_confidence");
515
+ if (bodyIncludeLowConfidence === void 0 && queryIncludeLowConfidence !== null && queryIncludeLowConfidence !== "true" && queryIncludeLowConfidence !== "false") {
516
+ throw new EngramAccessInputError(
517
+ `include_low_confidence must be one of: true, false (got: ${queryIncludeLowConfidence})`
518
+ );
519
+ }
520
+ const includeLowConfidence = bodyIncludeLowConfidence === true || bodyIncludeLowConfidence === void 0 && queryIncludeLowConfidence === "true";
406
521
  const response = await this.service.recall({
407
522
  query: body.query ?? "",
408
523
  sessionKey: body.sessionKey,
@@ -410,7 +525,18 @@ var EngramAccessHttpServer = class {
410
525
  topK: body.topK,
411
526
  mode: body.mode,
412
527
  includeDebug: body.includeDebug === true,
413
- codingContext
528
+ // Forward the validated disclosure depth to the service layer
529
+ // (issue #677). The zod schema accepts/rejects body values;
530
+ // `resolveRecallDisclosure()` validates the query-param fallback.
531
+ disclosure,
532
+ codingContext,
533
+ // Forward cwd/projectTag for auto git-context resolution (issue #569).
534
+ cwd: body.cwd,
535
+ projectTag: body.projectTag,
536
+ ...asOf !== void 0 ? { asOf } : {},
537
+ ...tags !== void 0 ? { tags } : {},
538
+ ...tagMatch !== void 0 ? { tagMatch } : {},
539
+ ...includeLowConfidence ? { includeLowConfidence: true } : {}
414
540
  });
415
541
  this.respondJson(res, 200, response);
416
542
  return;
@@ -424,6 +550,36 @@ var EngramAccessHttpServer = class {
424
550
  this.respondJson(res, 200, { ok: true });
425
551
  return;
426
552
  }
553
+ if (req.method === "POST" && (pathname === "/engram/v1/capsules/export" || pathname === "/remnic/v1/capsules/export")) {
554
+ const body = await this.readValidatedBody(req, "capsuleExport");
555
+ this.ensureWriteRateLimitAvailable();
556
+ const result = await this.service.capsuleExport({
557
+ name: body.name,
558
+ namespace: this.resolveNamespace(req, body.namespace),
559
+ principal: this.resolveRequestPrincipal(req),
560
+ since: body.since,
561
+ includeKinds: body.includeKinds,
562
+ peerIds: body.peerIds,
563
+ includeTranscripts: body.includeTranscripts,
564
+ encrypt: body.encrypt
565
+ });
566
+ this.recordWriteRateLimitHit();
567
+ this.respondJson(res, 200, result);
568
+ return;
569
+ }
570
+ if (req.method === "POST" && (pathname === "/engram/v1/capsules/import" || pathname === "/remnic/v1/capsules/import")) {
571
+ const body = await this.readValidatedBody(req, "capsuleImport");
572
+ this.ensureWriteRateLimitAvailable();
573
+ const result = await this.service.capsuleImport({
574
+ archivePath: expandTildePath(body.archivePath),
575
+ namespace: this.resolveNamespace(req, body.namespace),
576
+ principal: this.resolveRequestPrincipal(req),
577
+ mode: body.mode
578
+ });
579
+ this.recordWriteRateLimitHit();
580
+ this.respondJson(res, 200, result);
581
+ return;
582
+ }
427
583
  if (req.method === "POST" && pathname === "/engram/v1/recall/explain") {
428
584
  const body = await this.readValidatedBody(req, "recallExplain");
429
585
  const response = await this.service.recallExplain({
@@ -480,6 +636,19 @@ var EngramAccessHttpServer = class {
480
636
  }
481
637
  budget = parsedBudget;
482
638
  }
639
+ const disclosureParam = parsed.searchParams.get("disclosure");
640
+ let disclosure;
641
+ if (disclosureParam !== null && disclosureParam.length > 0) {
642
+ if (!isRecallDisclosure(disclosureParam)) {
643
+ this.respondJson(res, 400, {
644
+ error: "invalid_disclosure",
645
+ code: "invalid_disclosure",
646
+ message: "disclosure must be one of: chunk, section, raw"
647
+ });
648
+ return;
649
+ }
650
+ disclosure = disclosureParam;
651
+ }
483
652
  let payload;
484
653
  try {
485
654
  payload = await this.service.recallXray({
@@ -487,7 +656,8 @@ var EngramAccessHttpServer = class {
487
656
  sessionKey,
488
657
  namespace,
489
658
  budget,
490
- authenticatedPrincipal: this.resolveRequestPrincipal(req)
659
+ authenticatedPrincipal: this.resolveRequestPrincipal(req),
660
+ ...disclosure !== void 0 ? { disclosure } : {}
491
661
  });
492
662
  } catch (err) {
493
663
  const message = err instanceof Error ? err.message : String(err);
@@ -512,7 +682,10 @@ var EngramAccessHttpServer = class {
512
682
  messages: body.messages,
513
683
  namespace: this.resolveNamespace(req, body.namespace),
514
684
  authenticatedPrincipal: this.resolveRequestPrincipal(req),
515
- skipExtraction: body.skipExtraction === true
685
+ skipExtraction: body.skipExtraction === true,
686
+ // Forward cwd/projectTag for auto git-context resolution (issue #569).
687
+ cwd: body.cwd,
688
+ projectTag: body.projectTag
516
689
  });
517
690
  this.recordWriteRateLimitHit();
518
691
  this.respondJson(res, 202, response);
@@ -827,7 +1000,7 @@ var EngramAccessHttpServer = class {
827
1000
  }
828
1001
  const namespace = parsed.searchParams.get("namespace") ?? void 0;
829
1002
  const limitRaw = parseInt(parsed.searchParams.get("limit") ?? "50", 10);
830
- const { listPairs } = await import("./contradiction-review-WIUBAR52.js");
1003
+ const { listPairs } = await import("./contradiction-review-5LTTVDQV.js");
831
1004
  const result = listPairs(this.service.memoryDir, {
832
1005
  filter: rawFilter,
833
1006
  namespace,
@@ -838,7 +1011,7 @@ var EngramAccessHttpServer = class {
838
1011
  }
839
1012
  if (req.method === "GET" && pathname.startsWith("/engram/v1/review/contradictions/")) {
840
1013
  const pairId = pathname.split("/").pop() ?? "";
841
- const { readPair } = await import("./contradiction-review-WIUBAR52.js");
1014
+ const { readPair } = await import("./contradiction-review-5LTTVDQV.js");
842
1015
  const pair = readPair(this.service.memoryDir, pairId);
843
1016
  if (!pair) {
844
1017
  this.respondJson(res, 404, { error: "pair_not_found" });
@@ -855,7 +1028,7 @@ var EngramAccessHttpServer = class {
855
1028
  this.respondJson(res, 400, { error: "pairId and verb are required" });
856
1029
  return;
857
1030
  }
858
- const { isValidResolutionVerb, executeResolution } = await import("./resolution-QBTDHTG7.js");
1031
+ const { isValidResolutionVerb, executeResolution } = await import("./resolution-YGIBORXI.js");
859
1032
  if (!isValidResolutionVerb(verb)) {
860
1033
  this.respondJson(res, 400, { error: `Invalid verb: ${verb}. Must be one of: keep-a, keep-b, merge, both-valid, needs-more-context` });
861
1034
  return;
@@ -864,9 +1037,83 @@ var EngramAccessHttpServer = class {
864
1037
  this.respondJson(res, 200, result);
865
1038
  return;
866
1039
  }
1040
+ if (req.method === "GET" && pathname === "/engram/v1/graph/snapshot") {
1041
+ const limitRaw = parsed.searchParams.get("limit");
1042
+ let limit;
1043
+ if (limitRaw !== null && limitRaw.length > 0) {
1044
+ const parsedLimit = Number(limitRaw);
1045
+ if (!Number.isFinite(parsedLimit) || !Number.isInteger(parsedLimit) || parsedLimit <= 0) {
1046
+ this.respondJson(res, 400, {
1047
+ error: "invalid_limit",
1048
+ code: "invalid_limit",
1049
+ message: "limit must be a positive integer"
1050
+ });
1051
+ return;
1052
+ }
1053
+ limit = parsedLimit;
1054
+ }
1055
+ const sinceRaw = parsed.searchParams.get("since");
1056
+ let since;
1057
+ if (sinceRaw !== null && sinceRaw.length > 0) {
1058
+ if (!Number.isFinite(Date.parse(sinceRaw))) {
1059
+ this.respondJson(res, 400, {
1060
+ error: "invalid_since",
1061
+ code: "invalid_since",
1062
+ message: "since must be a parseable ISO timestamp"
1063
+ });
1064
+ return;
1065
+ }
1066
+ since = sinceRaw;
1067
+ }
1068
+ const focusNodeIdRaw = parsed.searchParams.get("focusNodeId");
1069
+ const focusNodeId = focusNodeIdRaw && focusNodeIdRaw.length > 0 ? focusNodeIdRaw : void 0;
1070
+ const categoriesRaw = parsed.searchParams.get("categories");
1071
+ let categories;
1072
+ if (categoriesRaw !== null && categoriesRaw.length > 0) {
1073
+ categories = categoriesRaw.split(",").map((value) => value.trim()).filter((value) => value.length > 0);
1074
+ if (categories.length === 0) {
1075
+ this.respondJson(res, 400, {
1076
+ error: "invalid_categories",
1077
+ code: "invalid_categories",
1078
+ message: "categories must be a comma-separated list with at least one non-empty value"
1079
+ });
1080
+ return;
1081
+ }
1082
+ }
1083
+ const namespaceParam = parsed.searchParams.get("namespace");
1084
+ const namespace = this.resolveNamespace(
1085
+ req,
1086
+ namespaceParam && namespaceParam.length > 0 ? namespaceParam : void 0
1087
+ );
1088
+ try {
1089
+ const snapshot = await this.service.graphSnapshot(
1090
+ {
1091
+ namespace,
1092
+ ...limit !== void 0 ? { limit } : {},
1093
+ ...since !== void 0 ? { since } : {},
1094
+ ...focusNodeId !== void 0 ? { focusNodeId } : {},
1095
+ ...categories !== void 0 ? { categories } : {}
1096
+ },
1097
+ this.resolveRequestPrincipal(req)
1098
+ );
1099
+ this.respondJson(res, 200, snapshot);
1100
+ } catch (err) {
1101
+ const message = err instanceof Error ? err.message : String(err);
1102
+ if (message.startsWith("graphSnapshot:")) {
1103
+ this.respondJson(res, 400, {
1104
+ error: "invalid_request",
1105
+ code: "invalid_request",
1106
+ message
1107
+ });
1108
+ return;
1109
+ }
1110
+ throw err;
1111
+ }
1112
+ return;
1113
+ }
867
1114
  if (req.method === "POST" && pathname === "/engram/v1/contradiction-scan") {
868
1115
  const body = await this.readJsonBody(req);
869
- const { runContradictionScan } = await import("./contradiction-scan-E3GJTI4F.js");
1116
+ const { runContradictionScan } = await import("./contradiction-scan-3Z6YW7YA.js");
870
1117
  const result = await runContradictionScan({
871
1118
  storage: this.service.storageRef,
872
1119
  config: this.service.configRef,
@@ -879,12 +1126,244 @@ var EngramAccessHttpServer = class {
879
1126
  this.respondJson(res, 200, result);
880
1127
  return;
881
1128
  }
1129
+ if (req.method === "GET" && pathname === "/engram/v1/graph/events") {
1130
+ await this.handleGraphEventsSSE(req, res);
1131
+ return;
1132
+ }
1133
+ if (req.method === "GET" && pathname === "/engram/v1/console/state") {
1134
+ const namespace = parsed.searchParams.get("namespace") ?? void 0;
1135
+ const snapshot = await this.service.consoleState(namespace, this.resolveRequestPrincipal(req));
1136
+ this.respondJson(res, 200, snapshot);
1137
+ return;
1138
+ }
1139
+ if (req.method === "GET" && pathname === "/engram/v1/peers") {
1140
+ const result = await this.service.peerList();
1141
+ this.respondJson(res, 200, result);
1142
+ return;
1143
+ }
1144
+ const peerProfileMatch = /^\/engram\/v1\/peers\/([^/]+)\/profile$/.exec(pathname);
1145
+ if (peerProfileMatch) {
1146
+ if (req.method !== "GET") {
1147
+ this.respondJson(res, 405, { error: "method_not_allowed", code: "method_not_allowed" });
1148
+ return;
1149
+ }
1150
+ const peerId = decodePeerIdSegment(peerProfileMatch[1] ?? "");
1151
+ const result = await this.service.peerProfileGet(peerId);
1152
+ if (!result.found) {
1153
+ this.respondJson(res, 404, { error: "peer_profile_not_found", code: "peer_profile_not_found" });
1154
+ return;
1155
+ }
1156
+ this.respondJson(res, 200, result);
1157
+ return;
1158
+ }
1159
+ const peerIdMatch = /^\/engram\/v1\/peers\/([^/]+)$/.exec(pathname);
1160
+ if (peerIdMatch) {
1161
+ const peerId = decodePeerIdSegment(peerIdMatch[1] ?? "");
1162
+ if (req.method === "GET") {
1163
+ const result = await this.service.peerGet(peerId);
1164
+ if (!result.found) {
1165
+ this.respondJson(res, 404, { error: "peer_not_found", code: "peer_not_found" });
1166
+ return;
1167
+ }
1168
+ this.respondJson(res, 200, result);
1169
+ return;
1170
+ }
1171
+ if (req.method === "PUT") {
1172
+ const body = await this.readJsonBody(req);
1173
+ if ("kind" in body && body.kind !== void 0 && typeof body.kind !== "string") {
1174
+ throw new EngramAccessInputError("kind must be a string when provided");
1175
+ }
1176
+ if ("displayName" in body && body.displayName !== void 0 && typeof body.displayName !== "string") {
1177
+ throw new EngramAccessInputError("displayName must be a string when provided");
1178
+ }
1179
+ if ("notes" in body && body.notes !== void 0 && typeof body.notes !== "string") {
1180
+ throw new EngramAccessInputError("notes must be a string when provided");
1181
+ }
1182
+ const result = await this.service.peerSet({
1183
+ id: peerId,
1184
+ kind: typeof body.kind === "string" ? body.kind : void 0,
1185
+ displayName: typeof body.displayName === "string" ? body.displayName : void 0,
1186
+ notes: typeof body.notes === "string" ? body.notes : void 0
1187
+ });
1188
+ this.respondJson(res, result.created ? 201 : 200, result);
1189
+ return;
1190
+ }
1191
+ if (req.method === "DELETE") {
1192
+ const forgetParam = parsed.searchParams.get("forget");
1193
+ if (forgetParam === "true") {
1194
+ const body = await this.readJsonBody(req);
1195
+ const confirm = typeof body.confirm === "string" ? body.confirm : "";
1196
+ if (confirm !== "yes") {
1197
+ this.respondJson(res, 400, {
1198
+ error: "confirm_required",
1199
+ code: "confirm_required",
1200
+ message: "DELETE ?forget=true requires { confirm: 'yes' } in the request body"
1201
+ });
1202
+ return;
1203
+ }
1204
+ const result2 = await this.service.peerForget(peerId, { confirm: "yes" });
1205
+ this.respondJson(res, 200, result2);
1206
+ return;
1207
+ }
1208
+ const result = await this.service.peerDelete(peerId);
1209
+ this.respondJson(res, 200, result);
1210
+ return;
1211
+ }
1212
+ this.respondJson(res, 405, { error: "method_not_allowed", code: "method_not_allowed" });
1213
+ return;
1214
+ }
1215
+ if (req.method === "GET" && pathname === "/engram/v1/dreams/status") {
1216
+ const { normalizeDreamsStatusWindowHours } = await import("./dreams-ledger-LR2NBAZE.js");
1217
+ const windowHoursRaw = parsed.searchParams.get("windowHours");
1218
+ let windowHours;
1219
+ try {
1220
+ windowHours = normalizeDreamsStatusWindowHours(
1221
+ windowHoursRaw !== null ? Number(windowHoursRaw) : void 0
1222
+ );
1223
+ } catch {
1224
+ this.respondJson(res, 400, { error: "windowHours must be a positive integer" });
1225
+ return;
1226
+ }
1227
+ const namespaceParam = parsed.searchParams.get("namespace");
1228
+ const namespace = namespaceParam && namespaceParam.length > 0 ? namespaceParam : void 0;
1229
+ const result = await this.service.dreamsStatus({
1230
+ windowHours,
1231
+ namespace,
1232
+ principal: this.resolveRequestPrincipal(req)
1233
+ });
1234
+ this.respondJson(res, 200, result);
1235
+ return;
1236
+ }
1237
+ if (req.method === "POST" && pathname === "/engram/v1/dreams/run") {
1238
+ const body = await this.readJsonBody(req);
1239
+ const VALID_PHASES = ["lightSleep", "rem", "deepSleep"];
1240
+ const phase = typeof body.phase === "string" ? body.phase : void 0;
1241
+ if (!phase || !VALID_PHASES.includes(phase)) {
1242
+ this.respondJson(res, 400, {
1243
+ error: `phase is required and must be one of: ${VALID_PHASES.join(", ")}`
1244
+ });
1245
+ return;
1246
+ }
1247
+ if ("dryRun" in body && body.dryRun !== void 0 && typeof body.dryRun !== "boolean") {
1248
+ this.respondJson(res, 400, {
1249
+ error: "dryRun must be a boolean when provided"
1250
+ });
1251
+ return;
1252
+ }
1253
+ if ("namespace" in body && body.namespace !== void 0 && typeof body.namespace !== "string") {
1254
+ this.respondJson(res, 400, {
1255
+ error: "namespace must be a string when provided"
1256
+ });
1257
+ return;
1258
+ }
1259
+ const dryRun = body.dryRun === true;
1260
+ const namespace = typeof body.namespace === "string" ? body.namespace : void 0;
1261
+ if (!dryRun) {
1262
+ this.ensureWriteRateLimitAvailable();
1263
+ }
1264
+ const result = await this.service.dreamsRun({
1265
+ phase,
1266
+ dryRun,
1267
+ namespace,
1268
+ authenticatedPrincipal: this.resolveRequestPrincipal(req)
1269
+ });
1270
+ if (this.shouldCountWriteRateLimit(result)) {
1271
+ this.recordWriteRateLimitHit();
1272
+ }
1273
+ this.respondJson(res, 200, result);
1274
+ return;
1275
+ }
882
1276
  this.respondJson(res, 404, { error: "not_found", code: "not_found" });
883
1277
  }
1278
+ /**
1279
+ * SSE handler for /engram/v1/graph/events.
1280
+ *
1281
+ * Lifecycle:
1282
+ * 1. Write SSE headers (Content-Type: text/event-stream).
1283
+ * 2. Register this response in `sseClients`.
1284
+ * 3. Resolve the namespace from the request and subscribe to THAT
1285
+ * namespace's graph event bus (Codex P1: in multi-namespace
1286
+ * deployments each namespace has its own bus keyed by its storage
1287
+ * dir — subscribing to the global root leaks events across tenants).
1288
+ * 4. On each event, add to a 200 ms batch; flush batch as a single SSE frame.
1289
+ * 5. Send heartbeat every 25 s.
1290
+ * 6. On client disconnect (req "close"), clean up timers and unsubscribe.
1291
+ * 7. Register the cleanup callback in `sseCleanupFns` so `stop()` can
1292
+ * release the heartbeat interval and bus subscription even when the
1293
+ * client never disconnects (Cursor review thread `access-http.ts:232`).
1294
+ */
1295
+ async handleGraphEventsSSE(req, res) {
1296
+ const parsed = new URL(req.url ?? "/", `http://${hostToUrlAuthority(this.host)}`);
1297
+ const namespaceParam = parsed.searchParams.get("namespace");
1298
+ const namespace = namespaceParam && namespaceParam.length > 0 ? namespaceParam : void 0;
1299
+ const principal = this.resolveRequestPrincipal(req);
1300
+ const memoryDir = await this.service.getMemoryDirForNamespace(namespace, principal);
1301
+ res.writeHead(200, {
1302
+ "content-type": "text/event-stream; charset=utf-8",
1303
+ "cache-control": "no-cache, no-store, must-revalidate",
1304
+ "connection": "keep-alive",
1305
+ "x-accel-buffering": "no",
1306
+ // prevent nginx buffering
1307
+ "transfer-encoding": "chunked"
1308
+ });
1309
+ const writeSSE = (payload) => {
1310
+ try {
1311
+ res.write(`data: ${JSON.stringify(payload)}
1312
+
1313
+ `);
1314
+ } catch {
1315
+ }
1316
+ };
1317
+ writeSSE({ type: "connected" });
1318
+ this.sseClients.add(res);
1319
+ const flushBatch = () => {
1320
+ const batch = this.ssePendingBatches.get(res);
1321
+ if (!batch || batch.length === 0) return;
1322
+ this.ssePendingBatches.delete(res);
1323
+ this.sseBatchTimers.delete(res);
1324
+ writeSSE({ type: "batch", events: batch });
1325
+ };
1326
+ const unsubscribe = subscribeGraphEvents(memoryDir, (event) => {
1327
+ let batch = this.ssePendingBatches.get(res);
1328
+ if (!batch) {
1329
+ batch = [];
1330
+ this.ssePendingBatches.set(res, batch);
1331
+ }
1332
+ batch.push(event);
1333
+ if (!this.sseBatchTimers.has(res)) {
1334
+ this.sseBatchTimers.set(res, setTimeout(flushBatch, 200));
1335
+ }
1336
+ });
1337
+ const heartbeatInterval = setInterval(() => {
1338
+ writeSSE({ type: "heartbeat" });
1339
+ }, 25e3);
1340
+ const cleanup = () => {
1341
+ clearInterval(heartbeatInterval);
1342
+ const timer = this.sseBatchTimers.get(res);
1343
+ if (timer !== void 0) {
1344
+ clearTimeout(timer);
1345
+ this.sseBatchTimers.delete(res);
1346
+ }
1347
+ this.ssePendingBatches.delete(res);
1348
+ unsubscribe();
1349
+ this.sseClients.delete(res);
1350
+ this.sseCleanupFns.delete(cleanup);
1351
+ try {
1352
+ res.end();
1353
+ } catch {
1354
+ }
1355
+ };
1356
+ this.sseCleanupFns.add(cleanup);
1357
+ req.once("close", cleanup);
1358
+ req.once("error", cleanup);
1359
+ }
884
1360
  async handleMcpRequest(req, res) {
885
1361
  const body = await this.readJsonBody(req);
886
1362
  const request = body;
887
- const isMcpWrite = request.method === "tools/call" && typeof request.params?.name === "string" && (request.params.name === "engram.memory_store" || request.params.name === "engram.suggestion_submit" || request.params.name === "engram.observe");
1363
+ const toolName = typeof request.params?.name === "string" ? request.params.name : "";
1364
+ const toolArgs = request.params?.arguments;
1365
+ const dreamsRunDryRun = (toolName === "engram.dreams_run" || toolName === "remnic.dreams_run") && toolArgs !== null && typeof toolArgs === "object" && !Array.isArray(toolArgs) && toolArgs.dryRun === true;
1366
+ const isMcpWrite = request.method === "tools/call" && (toolName === "engram.memory_store" || toolName === "remnic.memory_store" || toolName === "engram.suggestion_submit" || toolName === "remnic.suggestion_submit" || toolName === "engram.observe" || toolName === "remnic.observe" || toolName === "engram.capsule_export" || toolName === "remnic.capsule_export" || toolName === "engram.capsule_import" || toolName === "remnic.capsule_import" || !dreamsRunDryRun && (toolName === "engram.dreams_run" || toolName === "remnic.dreams_run"));
888
1367
  if (isMcpWrite) {
889
1368
  this.ensureWriteRateLimitAvailable();
890
1369
  }
@@ -930,11 +1409,17 @@ var EngramAccessHttpServer = class {
930
1409
  }
931
1410
  async handleAdminConsole(req, res, pathname) {
932
1411
  if (req.method !== "GET") return false;
933
- if (pathname === "/engram/ui" || pathname === "/engram/ui/") {
1412
+ if (pathname === "/remnic/ui" || pathname === "/engram/ui") {
1413
+ res.statusCode = 301;
1414
+ res.setHeader("location", pathname + "/");
1415
+ res.end();
1416
+ return true;
1417
+ }
1418
+ if (pathname === "/remnic/ui/" || pathname === "/engram/ui/") {
934
1419
  await this.respondStatic(res, path.join(this.adminConsolePublicDir, "index.html"), "text/html; charset=utf-8");
935
1420
  return true;
936
1421
  }
937
- if (pathname === "/engram/ui/app.js") {
1422
+ if (pathname === "/remnic/ui/app.js" || pathname === "/engram/ui/app.js") {
938
1423
  await this.respondStatic(res, path.join(this.adminConsolePublicDir, "app.js"), "application/javascript; charset=utf-8");
939
1424
  return true;
940
1425
  }
@@ -984,15 +1469,31 @@ var EngramAccessHttpServer = class {
984
1469
  }
985
1470
  return result.data;
986
1471
  }
987
- isAuthorized(req) {
1472
+ isAuthorized(req, pathname) {
988
1473
  if (!this.authToken && this.authTokens.length === 0 && !this.authTokensGetter) return false;
989
1474
  const raw = req.headers.authorization;
990
- if (!raw) return false;
991
- const separator = raw.indexOf(" ");
992
- if (separator <= 0) return false;
993
- const scheme = raw.slice(0, separator).toLowerCase();
994
- if (scheme !== "bearer") return false;
995
- const token = raw.slice(separator + 1).trim();
1475
+ let candidate = null;
1476
+ if (raw) {
1477
+ const separator = raw.indexOf(" ");
1478
+ if (separator > 0) {
1479
+ const scheme = raw.slice(0, separator).toLowerCase();
1480
+ if (scheme === "bearer") {
1481
+ candidate = raw.slice(separator + 1).trim();
1482
+ }
1483
+ }
1484
+ }
1485
+ if (!candidate && pathname === "/engram/v1/graph/events") {
1486
+ try {
1487
+ const parsed = new URL(req.url ?? "/", `http://${hostToUrlAuthority(this.host)}`);
1488
+ const queryToken = parsed.searchParams.get("token");
1489
+ if (queryToken && queryToken.length > 0) {
1490
+ candidate = queryToken;
1491
+ }
1492
+ } catch {
1493
+ }
1494
+ }
1495
+ if (!candidate) return false;
1496
+ const token = candidate;
996
1497
  if (this.authToken && this.timingSafeStringEqual(token, this.authToken)) return true;
997
1498
  for (const valid of this.authTokens) {
998
1499
  if (this.timingSafeStringEqual(token, valid)) return true;
@@ -1043,4 +1544,4 @@ var EngramAccessHttpServer = class {
1043
1544
  export {
1044
1545
  EngramAccessHttpServer
1045
1546
  };
1046
- //# sourceMappingURL=chunk-UWB5LMWY.js.map
1547
+ //# sourceMappingURL=chunk-AKUCB2OG.js.map