@remnic/core 10.0.190 → 10.0.192

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 (296) hide show
  1. package/dist/abstraction-nodes.js +4 -4
  2. package/dist/access-admin-ops-surface.js +76 -75
  3. package/dist/access-cli.js +76 -75
  4. package/dist/access-cli.js.map +1 -1
  5. package/dist/access-extraction-force-flush-preempt.js +76 -75
  6. package/dist/access-extraction-force-flush.js +76 -75
  7. package/dist/access-http-briefing.js +76 -75
  8. package/dist/access-http-query.js +76 -75
  9. package/dist/access-http.js +76 -75
  10. package/dist/access-identity-continuity-surface.js +76 -75
  11. package/dist/access-lcm-surface.js +76 -75
  12. package/dist/access-mcp.js +76 -75
  13. package/dist/access-observe-write-surface.js +76 -75
  14. package/dist/access-operations-batch.js +76 -75
  15. package/dist/access-operations.js +76 -75
  16. package/dist/access-recall-concurrency.js +76 -75
  17. package/dist/access-recall-diagnostics.js +2 -2
  18. package/dist/access-recall-response.js +76 -75
  19. package/dist/access-recall-surface.js +76 -75
  20. package/dist/access-service.js +76 -75
  21. package/dist/active-recall.js +16 -16
  22. package/dist/admin/admin-surfaces.d.ts +11 -0
  23. package/dist/admin/admin-surfaces.d.ts.map +1 -1
  24. package/dist/admin/admin-surfaces.js +43 -0
  25. package/dist/briefing.js +16 -16
  26. package/dist/buffer-persistence.d.ts +7 -0
  27. package/dist/buffer-persistence.d.ts.map +1 -1
  28. package/dist/buffer-persistence.js +1 -1
  29. package/dist/buffer.d.ts +2 -0
  30. package/dist/buffer.d.ts.map +1 -1
  31. package/dist/buffer.js +6 -6
  32. package/dist/{capsule-merge-BADOICNP.js → capsule-merge-3FARYIHP.js} +5 -5
  33. package/dist/causal-consolidation.js +17 -17
  34. package/dist/{chunk-IMSLPQJB.js → chunk-2QW5HPKU.js} +2 -2
  35. package/dist/{chunk-KNYUEYB6.js → chunk-2YJ2ST23.js} +2 -2
  36. package/dist/{chunk-X3ERYOLO.js → chunk-3BICT225.js} +2 -2
  37. package/dist/{chunk-UWKHLWUE.js → chunk-3RZ4GDOH.js} +2 -2
  38. package/dist/{chunk-ODIBCZLG.js → chunk-3YID7KZ6.js} +2 -2
  39. package/dist/{chunk-56BNHKZM.js → chunk-4EAVEDLG.js} +9 -9
  40. package/dist/{chunk-TLRIRISJ.js → chunk-4LCA2GEX.js} +2 -2
  41. package/dist/{chunk-4N33L4HY.js → chunk-5GIYIYJI.js} +2 -2
  42. package/dist/{chunk-65DWWJKI.js → chunk-75K6DRPN.js} +12 -9
  43. package/dist/chunk-75K6DRPN.js.map +1 -0
  44. package/dist/{chunk-ZDLVHGIC.js → chunk-7EP4FURO.js} +2 -2
  45. package/dist/{chunk-CAUADFDM.js → chunk-7SOKOEAZ.js} +2 -2
  46. package/dist/{chunk-7Q74DD2W.js → chunk-7V6GNQC2.js} +2 -2
  47. package/dist/{chunk-QXHWOUS6.js → chunk-AALJHIKH.js} +3 -3
  48. package/dist/{chunk-ATPY63F5.js → chunk-AJ7JHHRY.js} +2 -2
  49. package/dist/{chunk-B7GZL7PR.js → chunk-ARD2TEY2.js} +4 -4
  50. package/dist/{chunk-QSVWIKNY.js → chunk-BDFSVUUZ.js} +9 -7
  51. package/dist/chunk-BDFSVUUZ.js.map +1 -0
  52. package/dist/{chunk-3DADRUGW.js → chunk-BGA7S5EF.js} +3 -3
  53. package/dist/{chunk-RPOG6HLI.js → chunk-CJSTQNE5.js} +2 -2
  54. package/dist/{chunk-VQQZJ6KJ.js → chunk-DYUPSTCV.js} +3 -3
  55. package/dist/{chunk-E5QI6C6C.js → chunk-E3LGAZJC.js} +3 -3
  56. package/dist/{chunk-TAPF7T26.js → chunk-EEA2RM4B.js} +2 -2
  57. package/dist/{chunk-BL7WULM5.js → chunk-FDO7ITP6.js} +2 -2
  58. package/dist/{chunk-K3JGILZC.js → chunk-FGFU6J26.js} +3 -3
  59. package/dist/{chunk-6TIQLG7I.js → chunk-FKHXXL42.js} +2 -2
  60. package/dist/{chunk-QPD7EYGI.js → chunk-G2MS56KM.js} +2 -2
  61. package/dist/{chunk-2I3ETW3G.js → chunk-GH7IKABD.js} +2 -2
  62. package/dist/{chunk-KVTUUU7H.js → chunk-GYCUX3N4.js} +2 -2
  63. package/dist/{chunk-2VNMSEZR.js → chunk-HEJFE3BC.js} +3 -3
  64. package/dist/{chunk-KM4QO4LN.js → chunk-HLQANATZ.js} +2 -2
  65. package/dist/{chunk-AXSQGJSG.js → chunk-J7RQ3RP7.js} +11 -11
  66. package/dist/{chunk-H442UKDV.js → chunk-JITK24KX.js} +7 -7
  67. package/dist/{chunk-EJYUAN5F.js → chunk-K6UXWVQ6.js} +2 -2
  68. package/dist/{chunk-RVODERA5.js → chunk-KJ65WZHB.js} +2 -2
  69. package/dist/{chunk-QGT5KNQT.js → chunk-KOVQZJ27.js} +2 -2
  70. package/dist/{chunk-O6QSBI3U.js → chunk-KZ4BJRGQ.js} +2 -2
  71. package/dist/{chunk-D3FP4JQI.js → chunk-LR6LWX33.js} +4 -4
  72. package/dist/{chunk-NTS2RCQK.js → chunk-NAULI3EG.js} +2 -2
  73. package/dist/{chunk-V5W67PQV.js → chunk-NOKHMWMW.js} +4 -4
  74. package/dist/{chunk-7X6EZ2QB.js → chunk-ODI4K32P.js} +5 -5
  75. package/dist/{chunk-H7USCTPQ.js → chunk-OLD2GKQJ.js} +3 -3
  76. package/dist/{chunk-D7HOJFDS.js → chunk-ONSEODO2.js} +2 -2
  77. package/dist/{chunk-R3YMWUF3.js → chunk-P3IAZQPS.js} +2 -2
  78. package/dist/{chunk-LL6WEMTC.js → chunk-P3OONWJJ.js} +2 -2
  79. package/dist/chunk-P3OONWJJ.js.map +1 -0
  80. package/dist/{chunk-ZG4GNPRE.js → chunk-PBE7NFB5.js} +5 -5
  81. package/dist/{chunk-7KC6LT7U.js → chunk-PSQ347YP.js} +3 -3
  82. package/dist/{chunk-TQODBIMW.js → chunk-QFKNIKUF.js} +2 -2
  83. package/dist/{chunk-RFVX4WE7.js → chunk-QIPRDRGM.js} +1 -1
  84. package/dist/chunk-QIPRDRGM.js.map +1 -0
  85. package/dist/{chunk-C6Y2YHJL.js → chunk-QZMGZBTF.js} +2 -2
  86. package/dist/{chunk-PCGBESAN.js → chunk-SKJM4PKE.js} +2 -2
  87. package/dist/{chunk-T7R42MWB.js → chunk-STSORBX5.js} +2 -2
  88. package/dist/{chunk-XWPYK5T4.js → chunk-T765HQ5U.js} +3 -3
  89. package/dist/{chunk-RFEQ7DQN.js → chunk-TDG5NZAZ.js} +2 -2
  90. package/dist/{chunk-DLPS5YP3.js → chunk-TJV5HGSC.js} +4 -4
  91. package/dist/{chunk-YVXR7CPS.js → chunk-TWYYUMYO.js} +2 -2
  92. package/dist/{chunk-6MDHK6NO.js → chunk-TZ7ZA2LM.js} +2 -2
  93. package/dist/{chunk-ABPOW3SX.js → chunk-UAEJKURK.js} +92 -493
  94. package/dist/chunk-UAEJKURK.js.map +1 -0
  95. package/dist/{chunk-6OHCNTKU.js → chunk-UH2VY2QQ.js} +3 -3
  96. package/dist/{chunk-XQF2KLV5.js → chunk-VHQNJW4Q.js} +2 -2
  97. package/dist/{chunk-K6BS5RB4.js → chunk-WEI6HEUX.js} +11 -6
  98. package/dist/chunk-WEI6HEUX.js.map +1 -0
  99. package/dist/{chunk-3IA2SUWM.js → chunk-WRVKI6ZO.js} +2 -2
  100. package/dist/chunk-XC4PRJWM.js +593 -0
  101. package/dist/chunk-XC4PRJWM.js.map +1 -0
  102. package/dist/{chunk-R5S57GRK.js → chunk-XSRZM6CQ.js} +38 -13
  103. package/dist/chunk-XSRZM6CQ.js.map +1 -0
  104. package/dist/{chunk-OA7YDB6A.js → chunk-XZLCAL5O.js} +2 -2
  105. package/dist/{chunk-CIAQK2OU.js → chunk-XZMQLON4.js} +430 -292
  106. package/dist/chunk-XZMQLON4.js.map +1 -0
  107. package/dist/{chunk-HL53XYHC.js → chunk-YCJJODER.js} +5 -5
  108. package/dist/chunk-YCJJODER.js.map +1 -0
  109. package/dist/{chunk-GGQ3CJVH.js → chunk-YTT6XJNX.js} +4 -4
  110. package/dist/{chunk-A32EBVCZ.js → chunk-Z6EFSXU3.js} +2 -2
  111. package/dist/{chunk-GRX5BE73.js → chunk-ZNCCX7P6.js} +2 -2
  112. package/dist/cli.js +76 -75
  113. package/dist/coding/export-okf-codegraph.js +15 -15
  114. package/dist/compounding/engine.js +17 -17
  115. package/dist/config.d.ts.map +1 -1
  116. package/dist/config.js +16 -16
  117. package/dist/connectors/codex-materialize-runner.js +16 -16
  118. package/dist/connectors/index.js +16 -16
  119. package/dist/consolidation-provenance-check.js +5 -5
  120. package/dist/consolidation-undo.js +4 -4
  121. package/dist/contradiction/index.js +3 -3
  122. package/dist/convergence-refresh.js +18 -18
  123. package/dist/corpus-watermark.js +18 -18
  124. package/dist/cue-anchors.js +5 -5
  125. package/dist/{entity-canonical-id-migration-74IDJFPB.js → entity-canonical-id-migration-46EMEXTB.js} +4 -4
  126. package/dist/entity-retrieval.d.ts.map +1 -1
  127. package/dist/entity-retrieval.js +16 -16
  128. package/dist/explicit-capture.js +76 -75
  129. package/dist/extraction.js +20 -20
  130. package/dist/harmonic-construction.js +6 -6
  131. package/dist/harmonic-graph-version.js +3 -3
  132. package/dist/harmonic-retrieval.d.ts +15 -0
  133. package/dist/harmonic-retrieval.d.ts.map +1 -1
  134. package/dist/harmonic-retrieval.js +21 -19
  135. package/dist/index.js +97 -96
  136. package/dist/lcm/engine.js +2 -2
  137. package/dist/lcm/index.js +5 -5
  138. package/dist/location/index.js +17 -17
  139. package/dist/maintenance/memory-governance.js +16 -16
  140. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +16 -16
  141. package/dist/maintenance/rebuild-memory-projection-runner.js +18 -18
  142. package/dist/maintenance/rebuild-memory-projection.js +17 -17
  143. package/dist/memory-browse.js +5 -5
  144. package/dist/memory-cache.d.ts +44 -3
  145. package/dist/memory-cache.d.ts.map +1 -1
  146. package/dist/memory-cache.js +9 -1
  147. package/dist/memory-corpus-version.js +2 -2
  148. package/dist/namespaces/migrate.js +17 -17
  149. package/dist/namespaces/search.js +9 -9
  150. package/dist/namespaces/storage.js +16 -16
  151. package/dist/operator-doctor-corpus.js +19 -19
  152. package/dist/operator-toolkit.js +24 -24
  153. package/dist/orchestration/backlog-scheduler.js +77 -76
  154. package/dist/orchestration/backlog-scheduler.js.map +1 -1
  155. package/dist/orchestration/buffer-drain-runner.js +77 -76
  156. package/dist/orchestration/maintenance.js +24 -24
  157. package/dist/orchestration/recall-internal.d.ts.map +1 -1
  158. package/dist/orchestration/turn-ingestion-buffered.d.ts.map +1 -1
  159. package/dist/orchestrator.js +76 -75
  160. package/dist/page-versioning.js +4 -4
  161. package/dist/qmd.js +2 -2
  162. package/dist/recall-explain-renderer.js +3 -3
  163. package/dist/recall-navigate-access.js +2 -2
  164. package/dist/recall-navigate-disclosure.js +2 -2
  165. package/dist/recall-navigate.js +2 -2
  166. package/dist/recall-navigation.js +76 -75
  167. package/dist/recall-state-view-admission.js +5 -5
  168. package/dist/recall-why-service.js +5 -5
  169. package/dist/recall-xray-cli.js +4 -4
  170. package/dist/recall-xray-renderer.js +3 -3
  171. package/dist/recall-xray.js +2 -2
  172. package/dist/{resolution-RWIGFH2W.js → resolution-4QPPLDEN.js} +4 -4
  173. package/dist/resolution-4QPPLDEN.js.map +1 -0
  174. package/dist/resume-bundles.js +17 -17
  175. package/dist/search/factory.js +8 -8
  176. package/dist/search/index.js +13 -13
  177. package/dist/search/lancedb-backend.js +2 -2
  178. package/dist/search/meilisearch-backend.js +2 -2
  179. package/dist/search/orama-backend.js +2 -2
  180. package/dist/semantic-consolidation.js +17 -17
  181. package/dist/semantic-rule-promotion.js +16 -16
  182. package/dist/semantic-rule-verifier.js +16 -16
  183. package/dist/source-agent-qualifier.js +19 -19
  184. package/dist/standup/build.js +16 -16
  185. package/dist/storage/entity-listing.d.ts +20 -0
  186. package/dist/storage/entity-listing.d.ts.map +1 -0
  187. package/dist/storage/entity-store.d.ts +5 -0
  188. package/dist/storage/entity-store.d.ts.map +1 -1
  189. package/dist/storage/hot-cache-validation.d.ts +60 -0
  190. package/dist/storage/hot-cache-validation.d.ts.map +1 -0
  191. package/dist/storage.d.ts +2 -0
  192. package/dist/storage.d.ts.map +1 -1
  193. package/dist/storage.js +15 -15
  194. package/dist/transfer/capsule-import.js +5 -5
  195. package/dist/transfer/export-okf.js +16 -16
  196. package/dist/types.d.ts +2 -0
  197. package/dist/types.d.ts.map +1 -1
  198. package/dist/types.js +1 -1
  199. package/dist/verified-recall.js +16 -16
  200. package/dist/who-knows-cli.js +17 -17
  201. package/dist/who-knows.js +16 -16
  202. package/package.json +12 -2
  203. package/src/admin/admin-surfaces.test.ts +171 -0
  204. package/src/admin/admin-surfaces.ts +215 -2
  205. package/src/buffer-large-session-defer.test.ts +81 -0
  206. package/src/buffer-persistence.ts +8 -1
  207. package/src/buffer.ts +9 -4
  208. package/src/config.test.ts +9 -0
  209. package/src/config.ts +3 -6
  210. package/src/entity-recall-hot-cache.test.ts +116 -0
  211. package/src/entity-retrieval.ts +22 -4
  212. package/src/harmonic-graph-cache.test.ts +28 -9
  213. package/src/harmonic-retrieval.ts +20 -4
  214. package/src/memory-cache-hot.test.ts +47 -0
  215. package/src/memory-cache.ts +96 -17
  216. package/src/observe-flush-force-keys.test.ts +130 -0
  217. package/src/orchestration/recall-internal.ts +1 -0
  218. package/src/orchestration/turn-ingestion-buffered.test.ts +6 -2
  219. package/src/orchestration/turn-ingestion-buffered.ts +5 -1
  220. package/src/storage/entity-listing.ts +73 -0
  221. package/src/storage/entity-store.ts +25 -26
  222. package/src/storage/hot-cache-validation.ts +149 -0
  223. package/src/storage-contract/cache-coherence.test.ts +42 -5
  224. package/src/storage-hot-cache-stat-validate.test.ts +112 -0
  225. package/src/storage.ts +58 -44
  226. package/src/types.ts +2 -0
  227. package/dist/chunk-65DWWJKI.js.map +0 -1
  228. package/dist/chunk-ABPOW3SX.js.map +0 -1
  229. package/dist/chunk-CIAQK2OU.js.map +0 -1
  230. package/dist/chunk-HL53XYHC.js.map +0 -1
  231. package/dist/chunk-K6BS5RB4.js.map +0 -1
  232. package/dist/chunk-LL6WEMTC.js.map +0 -1
  233. package/dist/chunk-QSVWIKNY.js.map +0 -1
  234. package/dist/chunk-R5S57GRK.js.map +0 -1
  235. package/dist/chunk-RFVX4WE7.js.map +0 -1
  236. /package/dist/{entity-canonical-id-migration-74IDJFPB.js.map → admin/admin-surfaces.js.map} +0 -0
  237. /package/dist/{capsule-merge-BADOICNP.js.map → capsule-merge-3FARYIHP.js.map} +0 -0
  238. /package/dist/{chunk-IMSLPQJB.js.map → chunk-2QW5HPKU.js.map} +0 -0
  239. /package/dist/{chunk-KNYUEYB6.js.map → chunk-2YJ2ST23.js.map} +0 -0
  240. /package/dist/{chunk-X3ERYOLO.js.map → chunk-3BICT225.js.map} +0 -0
  241. /package/dist/{chunk-UWKHLWUE.js.map → chunk-3RZ4GDOH.js.map} +0 -0
  242. /package/dist/{chunk-ODIBCZLG.js.map → chunk-3YID7KZ6.js.map} +0 -0
  243. /package/dist/{chunk-56BNHKZM.js.map → chunk-4EAVEDLG.js.map} +0 -0
  244. /package/dist/{chunk-TLRIRISJ.js.map → chunk-4LCA2GEX.js.map} +0 -0
  245. /package/dist/{chunk-4N33L4HY.js.map → chunk-5GIYIYJI.js.map} +0 -0
  246. /package/dist/{chunk-ZDLVHGIC.js.map → chunk-7EP4FURO.js.map} +0 -0
  247. /package/dist/{chunk-CAUADFDM.js.map → chunk-7SOKOEAZ.js.map} +0 -0
  248. /package/dist/{chunk-7Q74DD2W.js.map → chunk-7V6GNQC2.js.map} +0 -0
  249. /package/dist/{chunk-QXHWOUS6.js.map → chunk-AALJHIKH.js.map} +0 -0
  250. /package/dist/{chunk-ATPY63F5.js.map → chunk-AJ7JHHRY.js.map} +0 -0
  251. /package/dist/{chunk-B7GZL7PR.js.map → chunk-ARD2TEY2.js.map} +0 -0
  252. /package/dist/{chunk-3DADRUGW.js.map → chunk-BGA7S5EF.js.map} +0 -0
  253. /package/dist/{chunk-RPOG6HLI.js.map → chunk-CJSTQNE5.js.map} +0 -0
  254. /package/dist/{chunk-VQQZJ6KJ.js.map → chunk-DYUPSTCV.js.map} +0 -0
  255. /package/dist/{chunk-E5QI6C6C.js.map → chunk-E3LGAZJC.js.map} +0 -0
  256. /package/dist/{chunk-TAPF7T26.js.map → chunk-EEA2RM4B.js.map} +0 -0
  257. /package/dist/{chunk-BL7WULM5.js.map → chunk-FDO7ITP6.js.map} +0 -0
  258. /package/dist/{chunk-K3JGILZC.js.map → chunk-FGFU6J26.js.map} +0 -0
  259. /package/dist/{chunk-6TIQLG7I.js.map → chunk-FKHXXL42.js.map} +0 -0
  260. /package/dist/{chunk-QPD7EYGI.js.map → chunk-G2MS56KM.js.map} +0 -0
  261. /package/dist/{chunk-2I3ETW3G.js.map → chunk-GH7IKABD.js.map} +0 -0
  262. /package/dist/{chunk-KVTUUU7H.js.map → chunk-GYCUX3N4.js.map} +0 -0
  263. /package/dist/{chunk-2VNMSEZR.js.map → chunk-HEJFE3BC.js.map} +0 -0
  264. /package/dist/{chunk-KM4QO4LN.js.map → chunk-HLQANATZ.js.map} +0 -0
  265. /package/dist/{chunk-AXSQGJSG.js.map → chunk-J7RQ3RP7.js.map} +0 -0
  266. /package/dist/{chunk-H442UKDV.js.map → chunk-JITK24KX.js.map} +0 -0
  267. /package/dist/{chunk-EJYUAN5F.js.map → chunk-K6UXWVQ6.js.map} +0 -0
  268. /package/dist/{chunk-RVODERA5.js.map → chunk-KJ65WZHB.js.map} +0 -0
  269. /package/dist/{chunk-QGT5KNQT.js.map → chunk-KOVQZJ27.js.map} +0 -0
  270. /package/dist/{chunk-O6QSBI3U.js.map → chunk-KZ4BJRGQ.js.map} +0 -0
  271. /package/dist/{chunk-D3FP4JQI.js.map → chunk-LR6LWX33.js.map} +0 -0
  272. /package/dist/{chunk-NTS2RCQK.js.map → chunk-NAULI3EG.js.map} +0 -0
  273. /package/dist/{chunk-V5W67PQV.js.map → chunk-NOKHMWMW.js.map} +0 -0
  274. /package/dist/{chunk-7X6EZ2QB.js.map → chunk-ODI4K32P.js.map} +0 -0
  275. /package/dist/{chunk-H7USCTPQ.js.map → chunk-OLD2GKQJ.js.map} +0 -0
  276. /package/dist/{chunk-D7HOJFDS.js.map → chunk-ONSEODO2.js.map} +0 -0
  277. /package/dist/{chunk-R3YMWUF3.js.map → chunk-P3IAZQPS.js.map} +0 -0
  278. /package/dist/{chunk-ZG4GNPRE.js.map → chunk-PBE7NFB5.js.map} +0 -0
  279. /package/dist/{chunk-7KC6LT7U.js.map → chunk-PSQ347YP.js.map} +0 -0
  280. /package/dist/{chunk-TQODBIMW.js.map → chunk-QFKNIKUF.js.map} +0 -0
  281. /package/dist/{chunk-C6Y2YHJL.js.map → chunk-QZMGZBTF.js.map} +0 -0
  282. /package/dist/{chunk-PCGBESAN.js.map → chunk-SKJM4PKE.js.map} +0 -0
  283. /package/dist/{chunk-T7R42MWB.js.map → chunk-STSORBX5.js.map} +0 -0
  284. /package/dist/{chunk-XWPYK5T4.js.map → chunk-T765HQ5U.js.map} +0 -0
  285. /package/dist/{chunk-RFEQ7DQN.js.map → chunk-TDG5NZAZ.js.map} +0 -0
  286. /package/dist/{chunk-DLPS5YP3.js.map → chunk-TJV5HGSC.js.map} +0 -0
  287. /package/dist/{chunk-YVXR7CPS.js.map → chunk-TWYYUMYO.js.map} +0 -0
  288. /package/dist/{chunk-6MDHK6NO.js.map → chunk-TZ7ZA2LM.js.map} +0 -0
  289. /package/dist/{chunk-6OHCNTKU.js.map → chunk-UH2VY2QQ.js.map} +0 -0
  290. /package/dist/{chunk-XQF2KLV5.js.map → chunk-VHQNJW4Q.js.map} +0 -0
  291. /package/dist/{chunk-3IA2SUWM.js.map → chunk-WRVKI6ZO.js.map} +0 -0
  292. /package/dist/{chunk-OA7YDB6A.js.map → chunk-XZLCAL5O.js.map} +0 -0
  293. /package/dist/{chunk-GGQ3CJVH.js.map → chunk-YTT6XJNX.js.map} +0 -0
  294. /package/dist/{chunk-A32EBVCZ.js.map → chunk-Z6EFSXU3.js.map} +0 -0
  295. /package/dist/{chunk-GRX5BE73.js.map → chunk-ZNCCX7P6.js.map} +0 -0
  296. /package/dist/{resolution-RWIGFH2W.js.map → entity-canonical-id-migration-46EMEXTB.js.map} +0 -0
@@ -0,0 +1,593 @@
1
+ import {
2
+ planSessionTranscriptMigration
3
+ } from "./chunk-WWDO7ZWM.js";
4
+ import {
5
+ resolveScopePlan
6
+ } from "./chunk-Y6FJDJUK.js";
7
+ import {
8
+ canReadNamespace,
9
+ canWriteNamespace
10
+ } from "./chunk-CA5MRHBP.js";
11
+ import {
12
+ resolveNamespaceCapabilities
13
+ } from "./chunk-MOWZCAKS.js";
14
+
15
+ // src/admin/admin-surfaces.ts
16
+ import path from "path";
17
+ var REDACTED = "<redacted>";
18
+ var SENSITIVE_KEY_SOURCE = "(?:token|secret|password|api[_-]?key|bearer|authorization|credential|private[_-]?key)";
19
+ var SENSITIVE_KEY_RE = new RegExp(SENSITIVE_KEY_SOURCE, "i");
20
+ var BEARER_VALUE_RE = /^(bearer|sk-|pk-|xox[bp]-|AKIA)/i;
21
+ var LONG_OPAQUE_RE = /^[A-Za-z0-9_\-]{32,}$/;
22
+ var SAFE_DIAGNOSTIC_KEYS = /* @__PURE__ */ new Set(["identityToken"]);
23
+ function redactSensitive(value) {
24
+ return walkRedact(value, void 0);
25
+ }
26
+ function walkRedact(value, key) {
27
+ if (typeof value === "string") {
28
+ if (key && SENSITIVE_KEY_RE.test(key) && !SAFE_DIAGNOSTIC_KEYS.has(key)) {
29
+ return REDACTED;
30
+ }
31
+ if (BEARER_VALUE_RE.test(value)) return REDACTED;
32
+ if (!(key && SAFE_DIAGNOSTIC_KEYS.has(key)) && LONG_OPAQUE_RE.test(value) && value.length >= 40 && !/^[0-9a-f]{16}$/.test(value)) {
33
+ return REDACTED;
34
+ }
35
+ return value;
36
+ }
37
+ if (Array.isArray(value)) {
38
+ return value.map((entry) => walkRedact(entry, void 0));
39
+ }
40
+ if (value && typeof value === "object") {
41
+ const record = value;
42
+ const out = {};
43
+ for (const [k, v] of Object.entries(record)) {
44
+ out[k] = SENSITIVE_KEY_RE.test(k) && !SAFE_DIAGNOSTIC_KEYS.has(k) ? REDACTED : walkRedact(v, k);
45
+ }
46
+ return out;
47
+ }
48
+ return value;
49
+ }
50
+ function stripJsonComments(text) {
51
+ let out = "";
52
+ let inString = false;
53
+ for (let i = 0; i < text.length; i += 1) {
54
+ const ch = text[i];
55
+ if (inString) {
56
+ out += ch;
57
+ if (ch === "\\" && i + 1 < text.length) {
58
+ out += text[i + 1];
59
+ i += 1;
60
+ } else if (ch === '"') {
61
+ inString = false;
62
+ }
63
+ continue;
64
+ }
65
+ if (ch === '"') {
66
+ inString = true;
67
+ out += ch;
68
+ continue;
69
+ }
70
+ if (ch === "/" && text[i + 1] === "*") {
71
+ const end = text.indexOf("*/", i + 2);
72
+ if (end === -1) break;
73
+ i = end + 1;
74
+ continue;
75
+ }
76
+ if (ch === "/" && text[i + 1] === "/") {
77
+ const end = text.indexOf("\n", i + 2);
78
+ if (end === -1) break;
79
+ i = end;
80
+ continue;
81
+ }
82
+ if (ch === ",") {
83
+ let j = i + 1;
84
+ while (j < text.length && (text[j] === " " || text[j] === " " || text[j] === "\n" || text[j] === "\r")) j += 1;
85
+ if (text[j] === "}" || text[j] === "]") continue;
86
+ out += ch;
87
+ continue;
88
+ }
89
+ out += ch;
90
+ }
91
+ return out;
92
+ }
93
+ function redactConfigText(raw) {
94
+ const withoutComments = stripJsonComments(raw);
95
+ try {
96
+ const parsed = JSON.parse(withoutComments);
97
+ return JSON.stringify(redactSensitive(parsed), null, 2);
98
+ } catch {
99
+ return redactFallbackPairs(withoutComments);
100
+ }
101
+ }
102
+ function redactFallbackPairs(text) {
103
+ const out = [];
104
+ const n = text.length;
105
+ let i = 0;
106
+ while (i < n) {
107
+ if (text[i] !== '"') {
108
+ out.push(text[i]);
109
+ i += 1;
110
+ continue;
111
+ }
112
+ const keyStart = i;
113
+ const keyEnd = scanJsonString(text, i);
114
+ if (keyEnd === -1) {
115
+ out.push(text.slice(i));
116
+ break;
117
+ }
118
+ if (text[keyEnd] !== '"') {
119
+ const nl = text.indexOf("\n", keyEnd);
120
+ out.push(text.slice(i, keyEnd));
121
+ i = nl === -1 ? n : nl + 1;
122
+ continue;
123
+ }
124
+ let k = skipJsonWhitespace(text, keyEnd + 1);
125
+ if (text[k] !== ":") {
126
+ out.push(text.slice(i, keyEnd + 1));
127
+ const nl = text.indexOf("\n", keyEnd + 1);
128
+ i = nl === -1 ? n : nl + 1;
129
+ continue;
130
+ }
131
+ k = skipJsonWhitespace(text, k + 1);
132
+ out.push(text.slice(i, k));
133
+ i = k;
134
+ const decodedKey = decodeJsonKeyName(text.slice(keyStart + 1, keyEnd));
135
+ if (text[i] !== '"') {
136
+ if (text[i] === "{" || text[i] === "[") {
137
+ out.push(text[i]);
138
+ i += 1;
139
+ continue;
140
+ }
141
+ const valueEnd2 = scanToValueEnd(text, i);
142
+ out.push(text.slice(i, valueEnd2));
143
+ i = valueEnd2;
144
+ continue;
145
+ }
146
+ const valueEnd = scanJsonString(text, i);
147
+ if (valueEnd === -1) {
148
+ if (SENSITIVE_KEY_RE.test(decodedKey)) {
149
+ out.push(REDACTED);
150
+ i = n;
151
+ } else {
152
+ const stop = text.indexOf("\n", i);
153
+ const stopAt = stop === -1 ? n : stop + 1;
154
+ out.push(text.slice(i, stopAt));
155
+ i = stopAt;
156
+ }
157
+ continue;
158
+ }
159
+ if (SENSITIVE_KEY_RE.test(decodedKey)) {
160
+ out.push(REDACTED);
161
+ if (text[valueEnd] !== '"') {
162
+ i = n;
163
+ } else {
164
+ i = valueEnd + 1;
165
+ }
166
+ } else {
167
+ out.push(text.slice(i, valueEnd + 1));
168
+ i = valueEnd + 1;
169
+ }
170
+ }
171
+ return out.join("");
172
+ }
173
+ function scanJsonString(text, start) {
174
+ let i = start + 1;
175
+ const n = text.length;
176
+ while (i < n) {
177
+ const ch = text[i];
178
+ if (ch === "\\") {
179
+ i += 2;
180
+ continue;
181
+ }
182
+ if (ch === '"' || ch === "\n" || ch === "\r") return i;
183
+ i += 1;
184
+ }
185
+ return -1;
186
+ }
187
+ function skipJsonWhitespace(text, start) {
188
+ let i = start;
189
+ while (i < text.length && (text[i] === " " || text[i] === " " || text[i] === "\n" || text[i] === "\r")) i += 1;
190
+ return i;
191
+ }
192
+ function scanToValueEnd(text, start) {
193
+ let i = start;
194
+ while (i < text.length && text[i] !== "," && text[i] !== "}" && text[i] !== "]" && text[i] !== "\n" && text[i] !== '"') i += 1;
195
+ return i;
196
+ }
197
+ function decodeJsonKeyName(rawKey) {
198
+ try {
199
+ return JSON.parse(`"${rawKey}"`);
200
+ } catch {
201
+ return rawKey;
202
+ }
203
+ }
204
+ function inspectScope(options) {
205
+ const { config } = options;
206
+ const namespacesEnabled = options.namespacesEnabled ?? resolveNamespaceCapabilities(config).namespaces === true;
207
+ const plan = resolveScopePlan({
208
+ config,
209
+ sessionKey: options.sessionKey,
210
+ namespace: options.namespace,
211
+ principalOverride: options.principalOverride,
212
+ codingContext: options.codingContext ?? null,
213
+ namespacesEnabled
214
+ });
215
+ const warnings = [];
216
+ if (namespacesEnabled && !plan.principal) {
217
+ warnings.push("namespace routing is enabled but no principal resolved for this session key");
218
+ }
219
+ if (config.codingMode?.projectScope && namespacesEnabled && options.codingContext && !plan.codingOverlay) {
220
+ warnings.push("coding project scope is enabled but the overlay was suppressed by an explicit namespace override");
221
+ }
222
+ if (options.namespace && options.namespace.trim().length > 0 && !plan.namespaceOverride) {
223
+ warnings.push(
224
+ `requested namespace override '${options.namespace}' is not readable by this principal and was ignored`
225
+ );
226
+ }
227
+ if (plan.namespaceOverride && !canWriteNamespace(plan.principal, plan.namespaceOverride, config)) {
228
+ warnings.push(
229
+ `explicit namespace override '${plan.namespaceOverride}' is readable but not writable by this principal; it is the effective write namespace but writes will be rejected`
230
+ );
231
+ }
232
+ const layers = [];
233
+ const scopeProfilePlan = plan.scopeProfilePlan;
234
+ if (scopeProfilePlan) {
235
+ for (const layer of scopeProfilePlan.layers) {
236
+ layers.push({
237
+ id: layer.id,
238
+ namespace: layer.namespace,
239
+ readable: layer.readable,
240
+ writable: layer.writable,
241
+ promotable: layer.promotable,
242
+ reason: layer.reason
243
+ });
244
+ }
245
+ for (const target of scopeProfilePlan.promotionTargets) {
246
+ if (!layers.some((layer) => layer.id === target.target)) {
247
+ layers.push({
248
+ id: target.target,
249
+ namespace: target.namespace,
250
+ readable: false,
251
+ writable: false,
252
+ promotable: target.authorized,
253
+ reason: target.reason
254
+ });
255
+ }
256
+ }
257
+ } else {
258
+ layers.push({
259
+ id: "self",
260
+ namespace: plan.baseNamespace,
261
+ readable: canReadNamespace(plan.principal, plan.baseNamespace, config),
262
+ writable: canWriteNamespace(plan.principal, plan.baseNamespace, config),
263
+ promotable: false,
264
+ reason: "principal self namespace (no scope profile active)"
265
+ });
266
+ }
267
+ if (plan.codingOverlay) {
268
+ layers.push({
269
+ id: "coding",
270
+ namespace: plan.codingOverlay.namespace,
271
+ readable: true,
272
+ writable: true,
273
+ promotable: false,
274
+ reason: "coding overlay namespace combined with the principal base (rule 42)"
275
+ });
276
+ }
277
+ if (plan.namespaceOverride) {
278
+ layers.push({
279
+ id: "explicit",
280
+ namespace: plan.namespaceOverride,
281
+ readable: true,
282
+ writable: canWriteNamespace(plan.principal, plan.namespaceOverride, config),
283
+ promotable: false,
284
+ reason: "explicit namespace override authorized for this principal"
285
+ });
286
+ }
287
+ const promotionTargets = scopeProfilePlan ? scopeProfilePlan.promotionTargets.map((target) => ({
288
+ target: target.target,
289
+ namespace: target.namespace,
290
+ authorized: target.authorized,
291
+ reason: target.reason
292
+ })) : [];
293
+ for (const warning of scopeProfilePlan?.warnings ?? []) {
294
+ warnings.push(warning);
295
+ }
296
+ return {
297
+ principal: plan.principal,
298
+ namespaceOverride: plan.namespaceOverride,
299
+ writeNamespace: plan.baseNamespace,
300
+ readNamespaces: [...plan.readNamespaces],
301
+ codingOverlay: plan.codingOverlay ? {
302
+ namespace: plan.codingOverlay.namespace,
303
+ readFallbacks: plan.codingOverlay.readFallbacks
304
+ } : null,
305
+ scopeProfileId: scopeProfilePlan?.profileId ?? null,
306
+ layers,
307
+ promotionTargets,
308
+ warnings,
309
+ plan
310
+ };
311
+ }
312
+ async function listAdminNamespaces(options) {
313
+ const { catalog, filter } = options;
314
+ if (!catalog.enabled) {
315
+ return { enabled: false, entries: [] };
316
+ }
317
+ const staleMs = (options.staleThresholdDays ?? 30) * 24 * 60 * 60 * 1e3;
318
+ const staleBefore = new Date(Date.now() - staleMs);
319
+ const records = await catalog.listNamespaces({
320
+ kind: filter?.kind,
321
+ discoveredBy: filter?.discoveredBy,
322
+ writtenSince: filter?.writtenSince
323
+ });
324
+ let entries = records.map((record) => toAdminEntry(record, staleBefore));
325
+ if (filter?.staleBefore) {
326
+ const cutoff = filter.staleBefore.getTime();
327
+ entries = entries.filter((entry) => {
328
+ if (!entry.lastWriteAt) return true;
329
+ const ms = Date.parse(entry.lastWriteAt);
330
+ return Number.isFinite(ms) && ms <= cutoff;
331
+ });
332
+ }
333
+ return { enabled: true, entries };
334
+ }
335
+ function toAdminEntry(record, staleBefore) {
336
+ const lastWriteMs = record.lastWriteAt ? Date.parse(record.lastWriteAt) : Number.NaN;
337
+ const stale = !Number.isFinite(lastWriteMs) || lastWriteMs < staleBefore.getTime();
338
+ return {
339
+ namespace: record.namespace,
340
+ identityToken: record.identityToken,
341
+ kind: record.kind,
342
+ createdAt: record.createdAt,
343
+ lastReadAt: record.lastReadAt,
344
+ lastWriteAt: record.lastWriteAt,
345
+ lastMaintenanceAt: record.lastMaintenanceAt,
346
+ storageDir: record.storageDir,
347
+ discoveredBy: record.discoveredBy,
348
+ stale
349
+ };
350
+ }
351
+ function classifyQmdState(qmd) {
352
+ if (!qmd.available) {
353
+ return {
354
+ state: "unavailable",
355
+ reason: "QMD backend is unavailable for this namespace",
356
+ degraded: true
357
+ };
358
+ }
359
+ switch (qmd.collectionState) {
360
+ case "present":
361
+ return { state: "healthy", reason: "QMD collection is ready", degraded: false };
362
+ case "skipped":
363
+ return {
364
+ state: "healthy",
365
+ reason: "QMD is skipped for this namespace (intentionally disabled)",
366
+ degraded: false
367
+ };
368
+ case "missing":
369
+ return {
370
+ state: "missing",
371
+ reason: "QMD collection is not built for this namespace \u2014 add the collection to the QMD index",
372
+ degraded: true
373
+ };
374
+ case "unknown":
375
+ return {
376
+ state: "unknown",
377
+ reason: "QMD collection status could not be determined (transient during startup/reindex)",
378
+ degraded: true
379
+ };
380
+ default:
381
+ return {
382
+ state: "unknown",
383
+ reason: `QMD reported an unrecognized collection state '${qmd.collectionState}'`,
384
+ degraded: false
385
+ };
386
+ }
387
+ }
388
+ async function gatherMaintenanceHealth(options) {
389
+ const { catalog, qmdHealthProvider } = options;
390
+ if (!catalog.enabled) {
391
+ return { enabled: false, degradedMode: false, perNamespace: [] };
392
+ }
393
+ const records = await catalog.listNamespaces();
394
+ let degradedMode = false;
395
+ const perNamespace = await Promise.all(
396
+ records.map(async (record) => {
397
+ const entry = {
398
+ namespace: record.namespace,
399
+ kind: record.kind,
400
+ lastMaintenanceAt: record.lastMaintenanceAt,
401
+ maintenanceMissing: !record.lastMaintenanceAt || Object.keys(record.lastMaintenanceAt).length === 0,
402
+ qmdDegraded: false,
403
+ qmdState: "not_probed",
404
+ qmdStateReason: "QMD health probe not run for this report"
405
+ };
406
+ if (qmdHealthProvider) {
407
+ try {
408
+ const qmd = await qmdHealthProvider(record.namespace);
409
+ if (qmd) {
410
+ entry.qmd = qmd;
411
+ const classified = classifyQmdState(qmd);
412
+ entry.qmdState = classified.state;
413
+ entry.qmdStateReason = classified.reason;
414
+ entry.qmdDegraded = classified.degraded;
415
+ } else {
416
+ entry.qmdState = "not_probed";
417
+ entry.qmdStateReason = "QMD health not available for this namespace";
418
+ }
419
+ } catch (err) {
420
+ entry.qmdDegraded = true;
421
+ entry.qmdState = "unavailable";
422
+ entry.qmdStateReason = "QMD health probe failed";
423
+ entry.qmdError = "QMD health probe failed";
424
+ }
425
+ }
426
+ if (entry.qmdDegraded) degradedMode = true;
427
+ return entry;
428
+ })
429
+ );
430
+ return { enabled: true, degradedMode, perNamespace };
431
+ }
432
+ async function auditTranscripts(memoryDir) {
433
+ const plan = await planSessionTranscriptMigration({
434
+ memoryDir,
435
+ apply: false
436
+ });
437
+ const files = plan.files.map((file) => ({
438
+ sourceRelPath: file.sourceRelPath,
439
+ fileName: file.fileName,
440
+ distinctSessions: file.groups.length,
441
+ movedEntries: file.groups.reduce((sum, group) => sum + group.entryCount, 0),
442
+ unmovableLines: file.unmovableLines
443
+ }));
444
+ const mixedOtherDefault = files.some((file) => file.sourceRelPath.split(path.sep).includes("other"));
445
+ const summary = plan.movedEntries === 0 ? "No mixed-session transcript data detected; nothing to migrate." : `Found ${plan.movedEntries} entries across ${plan.distinctSessions} distinct sessions stranded in shared/legacy directories. Run the CLI migration command to re-home them.`;
446
+ return {
447
+ generatedAt: plan.generatedAt,
448
+ dryRun: true,
449
+ transcriptsDir: plan.transcriptsDir,
450
+ mixedOtherDefault,
451
+ distinctSessions: plan.distinctSessions,
452
+ movedEntries: plan.movedEntries,
453
+ files,
454
+ summary
455
+ };
456
+ }
457
+ var AdminPromotionError = class extends Error {
458
+ code;
459
+ constructor(code, message) {
460
+ super(message);
461
+ this.name = "AdminPromotionError";
462
+ this.code = code;
463
+ }
464
+ };
465
+ async function promoteMemory(options) {
466
+ const reason = options.reason.trim();
467
+ if (reason.length === 0) {
468
+ throw new AdminPromotionError("reason_required", "promotion requires a non-empty reason");
469
+ }
470
+ if (options.targets.length === 0) {
471
+ throw new AdminPromotionError("targets_required", "promotion requires at least one target");
472
+ }
473
+ const { config, principal, scopeProfilePlan } = options;
474
+ const resolvedTargets = options.targets.map((requested) => {
475
+ if (requested.kind === "explicit") {
476
+ const namespace = requested.namespace?.trim();
477
+ if (!namespace) {
478
+ return {
479
+ target: requested.kind,
480
+ namespace: "",
481
+ authorized: false,
482
+ promoted: false,
483
+ reason: "explicit promotion requires a namespace"
484
+ };
485
+ }
486
+ const authorized = canWriteNamespace(principal, namespace, config);
487
+ return {
488
+ target: requested.kind,
489
+ namespace,
490
+ authorized,
491
+ promoted: false,
492
+ reason: authorized ? "explicit namespace writable by this principal" : "explicit namespace is not writable by this principal"
493
+ };
494
+ }
495
+ if (!scopeProfilePlan) {
496
+ return {
497
+ target: requested.kind,
498
+ namespace: "",
499
+ authorized: false,
500
+ promoted: false,
501
+ reason: requested.kind === "userProject" || requested.kind === "teamProject" ? `no active scope profile; '${requested.kind}' promotion requires an active scope profile with a coding context (pass a sessionKey)` : `no active scope profile; '${requested.kind}' promotion requires an active scope profile`
502
+ };
503
+ }
504
+ const layer = scopeProfilePlan.promotionTargets.find((t) => t.target === requested.kind);
505
+ if (!layer) {
506
+ return {
507
+ target: requested.kind,
508
+ namespace: "",
509
+ authorized: false,
510
+ promoted: false,
511
+ reason: `promotion target '${requested.kind}' is not configured on the active scope profile`
512
+ };
513
+ }
514
+ return {
515
+ target: requested.kind,
516
+ namespace: layer.namespace ?? "",
517
+ authorized: layer.authorized && Boolean(layer.namespace),
518
+ promoted: false,
519
+ reason: layer.reason
520
+ };
521
+ });
522
+ const sourceMemory = await options.storage.readMemory(options.sourceNamespace, options.sourceMemoryId);
523
+ if (!sourceMemory) {
524
+ throw new AdminPromotionError(
525
+ "source_not_found",
526
+ `source memory ${options.sourceMemoryId} not found in namespace ${options.sourceNamespace}`
527
+ );
528
+ }
529
+ const auditTargets = [];
530
+ for (const target of resolvedTargets) {
531
+ if (!target.authorized || !target.namespace) {
532
+ auditTargets.push({ target: target.target, namespace: target.namespace, promoted: false });
533
+ continue;
534
+ }
535
+ if (target.namespace === options.sourceNamespace) {
536
+ target.reason = "target namespace equals source namespace; nothing to promote";
537
+ auditTargets.push({ target: target.target, namespace: target.namespace, promoted: false });
538
+ continue;
539
+ }
540
+ try {
541
+ const promotedId = await options.storage.writePromotedMemory(target.namespace, {
542
+ category: sourceMemory.category,
543
+ content: sourceMemory.content,
544
+ confidence: sourceMemory.frontmatter.confidence ?? 0.5,
545
+ tags: [...sourceMemory.frontmatter.tags ?? [], `admin-promotion-${target.target}`],
546
+ entityRef: sourceMemory.frontmatter.entityRef,
547
+ sourceMemoryId: options.sourceMemoryId,
548
+ sourceNamespace: options.sourceNamespace,
549
+ reason,
550
+ actor: options.actor,
551
+ validAt: sourceMemory.frontmatter.valid_at,
552
+ lineage: [options.sourceMemoryId],
553
+ ...sourceMemory.frontmatter.sourceConnector ? { sourceConnector: sourceMemory.frontmatter.sourceConnector } : {},
554
+ ...sourceMemory.frontmatter.toolScoped ? { toolScoped: true } : {}
555
+ });
556
+ target.promoted = true;
557
+ target.promotedMemoryId = promotedId;
558
+ auditTargets.push({ target: target.target, namespace: target.namespace, promoted: true });
559
+ } catch (err) {
560
+ target.reason = "promotion write failed";
561
+ auditTargets.push({ target: target.target, namespace: target.namespace, promoted: false });
562
+ }
563
+ }
564
+ const at = (/* @__PURE__ */ new Date()).toISOString();
565
+ const audit = {
566
+ at,
567
+ actor: options.actor,
568
+ sourceMemoryId: options.sourceMemoryId,
569
+ sourceNamespace: options.sourceNamespace,
570
+ reason,
571
+ targets: auditTargets
572
+ };
573
+ return {
574
+ ok: resolvedTargets.some((t) => t.promoted),
575
+ sourceMemoryId: options.sourceMemoryId,
576
+ sourceNamespace: options.sourceNamespace,
577
+ targets: resolvedTargets,
578
+ audit
579
+ };
580
+ }
581
+
582
+ export {
583
+ REDACTED,
584
+ redactSensitive,
585
+ redactConfigText,
586
+ inspectScope,
587
+ listAdminNamespaces,
588
+ gatherMaintenanceHealth,
589
+ auditTranscripts,
590
+ AdminPromotionError,
591
+ promoteMemory
592
+ };
593
+ //# sourceMappingURL=chunk-XC4PRJWM.js.map