@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
@@ -24,6 +24,7 @@ import {
24
24
  listAdminNamespaces,
25
25
  promoteMemory,
26
26
  REDACTED,
27
+ redactConfigText,
27
28
  redactSensitive,
28
29
  type PromotionStorageProvider,
29
30
  } from "./admin-surfaces.js";
@@ -100,6 +101,176 @@ test("redactSensitive leaves primitives untouched", () => {
100
101
  assert.equal(redactSensitive(null), null);
101
102
  });
102
103
 
104
+ // ---------------------------------------------------------------------------
105
+ // redactConfigText (COS-825: nested secrets leaked through config dumps)
106
+ // ---------------------------------------------------------------------------
107
+
108
+ test("redactConfigText redacts nested secret keys in parsed config text", () => {
109
+ const raw = JSON.stringify({
110
+ memoryDir: "/tmp/synthetic-memory",
111
+ qmdEnabled: true,
112
+ consolidateEveryN: 10,
113
+ server: { authToken: "synthetic-server-token", port: 4318 },
114
+ replicaPeers: {
115
+ peers: [{ url: "http://peer-one.invalid:9100", token: "synthetic-peer-token" }],
116
+ },
117
+ providers: { openai: { apiKey: "synthetic-openai-key" } },
118
+ database: { password: "synthetic-db-password" },
119
+ authorName: "kept-author",
120
+ });
121
+ const out = redactConfigText(raw);
122
+ const parsed: {
123
+ server: { authToken: string; port: number };
124
+ replicaPeers: { peers: Array<{ url: string; token: string }> };
125
+ providers: { openai: { apiKey: string } };
126
+ database: { password: string };
127
+ memoryDir: string;
128
+ authorName: string;
129
+ qmdEnabled: boolean;
130
+ consolidateEveryN: number;
131
+ } = JSON.parse(out);
132
+ assert.equal(parsed.server.authToken, REDACTED);
133
+ assert.equal(parsed.replicaPeers.peers[0].token, REDACTED);
134
+ assert.equal(parsed.providers.openai.apiKey, REDACTED);
135
+ assert.equal(parsed.database.password, REDACTED);
136
+ assert.equal(parsed.memoryDir, "/tmp/synthetic-memory");
137
+ assert.equal(parsed.replicaPeers.peers[0].url, "http://peer-one.invalid:9100");
138
+ assert.equal(parsed.authorName, "kept-author");
139
+ assert.equal(parsed.qmdEnabled, true);
140
+ assert.equal(parsed.consolidateEveryN, 10);
141
+ for (const secret of [
142
+ "synthetic-server-token",
143
+ "synthetic-peer-token",
144
+ "synthetic-openai-key",
145
+ "synthetic-db-password",
146
+ ]) {
147
+ assert.equal(out.includes(secret), false, `expected "${secret}" to be redacted from the dump`);
148
+ }
149
+ });
150
+
151
+ test("redactConfigText falls back to conservative regex redaction for unparsable files", () => {
152
+ const raw = [
153
+ "{",
154
+ ' "memoryDir": "/tmp/synthetic-memory", // humans keep comments in this file',
155
+ ' "server": { "authToken": "synthetic-server-token" },',
156
+ ' "replicaPeers": { "peers": [{ "url": "http://peer-one.invalid:9100", "token": "synthetic-peer-token" }] },',
157
+ ' "authorName": "kept-author"',
158
+ "}",
159
+ ].join("\n");
160
+ const out = redactConfigText(raw);
161
+ assert.equal(out.includes("synthetic-server-token"), false, "expected authToken redacted by fallback");
162
+ assert.equal(out.includes("synthetic-peer-token"), false, "expected nested token redacted by fallback");
163
+ assert.match(out, /<redacted>/);
164
+ assert.match(out, /kept-author/);
165
+ assert.match(out, /peer-one\.invalid:9100/);
166
+ });
167
+
168
+ test("redactConfigText redacts JSONC comments between a sensitive key and its value", () => {
169
+ const raw = '{ "server": { "authToken" /* lagging note */ : "synthetic-server-token" } }';
170
+ const out = redactConfigText(raw);
171
+ assert.equal(out.includes("synthetic-server-token"), false, "expected comment-gap authToken redacted");
172
+ assert.match(out, /<redacted>/);
173
+ });
174
+
175
+ test("redactConfigText takes the structured path for JSONC files and keeps non-secret fields", () => {
176
+ const raw = [
177
+ "{",
178
+ ' // operator note',
179
+ ' "server": { "authToken": "synthetic-server-token", "port": 4318 },',
180
+ ' "authorName": "kept-author", /* trailing note */',
181
+ ' "url": "http://peer-one.invalid:9100/x" // comment with a URL must not break strings',
182
+ "}",
183
+ ].join("\n");
184
+ const out = redactConfigText(raw);
185
+ const parsed: {
186
+ server: { authToken: string; port: number };
187
+ authorName: string;
188
+ url: string;
189
+ } = JSON.parse(out);
190
+ assert.equal(parsed.server.authToken, REDACTED);
191
+ assert.equal(parsed.server.port, 4318);
192
+ assert.equal(parsed.authorName, "kept-author");
193
+ assert.equal(parsed.url, "http://peer-one.invalid:9100/x");
194
+ });
195
+
196
+ test("redactConfigText survives an unterminated comment via the regex fallback", () => {
197
+ const raw = [
198
+ "{",
199
+ ' "server": { "authToken": "synthetic-server-token" },',
200
+ ' "authorName": "kept-author" /* never closed',
201
+ "}",
202
+ ].join("\n");
203
+ const out = redactConfigText(raw);
204
+ assert.equal(out.includes("synthetic-server-token"), false, "expected adjacent authToken redacted");
205
+ assert.match(out, /kept-author/);
206
+ });
207
+
208
+ test("redactSensitive redacts the whole value of a sensitive key regardless of type", () => {
209
+ const record = redactSensitive({
210
+ apiKeys: ["synthetic-short-key", "synthetic-second-key"],
211
+ credentials: { user: "kept-inside-credential-block", note: 42 },
212
+ memoryDir: "/tmp/synthetic-memory",
213
+ port: 4318,
214
+ });
215
+ assert.equal(record.apiKeys, REDACTED);
216
+ assert.equal(record.credentials, REDACTED);
217
+ assert.equal(record.memoryDir, "/tmp/synthetic-memory");
218
+ assert.equal(record.port, 4318);
219
+ });
220
+
221
+ test("redactConfigText redacts trailing-comma JSONC via the structured path", () => {
222
+ const out = redactConfigText('{"apiKeys": ["synthetic-short-key",], "memoryDir": "/tmp/keep"}');
223
+ const parsed: { apiKeys: unknown; memoryDir: string } = JSON.parse(out);
224
+ assert.equal(parsed.apiKeys, REDACTED);
225
+ assert.equal(parsed.memoryDir, "/tmp/keep");
226
+ });
227
+
228
+ test("redactConfigText redacts an EOF line comment config through the structured path", () => {
229
+ const out = redactConfigText('{"authToken": "synthetic-server-token", "authorName": "kept-author"} // trailing note');
230
+ const parsed: { authToken: string; authorName: string } = JSON.parse(out);
231
+ assert.equal(parsed.authToken, REDACTED);
232
+ assert.equal(parsed.authorName, "kept-author");
233
+ });
234
+
235
+ test("redactConfigText decodes escaped key names in the fallback", () => {
236
+ const out = redactConfigText('{"auth\\u0054oken": "synthetic-server-token" oops');
237
+ assert.equal(out.includes("synthetic-server-token"), false, "expected escaped-key value redacted");
238
+ assert.match(out, /<redacted>/);
239
+ });
240
+
241
+ test("redactConfigText redacts the property after a missing comma between scalars", () => {
242
+ const out = redactConfigText('{"port": 4318 "authToken": "synthetic-server-token"}');
243
+ assert.equal(out.includes("synthetic-server-token"), false, "expected authToken redacted after bare scalar");
244
+ assert.match(out, /4318/);
245
+ assert.match(out, /<redacted>/);
246
+ });
247
+
248
+ test("redactConfigText redacts the property after a missing comma following true", () => {
249
+ const out = redactConfigText('{"qmdEnabled": true "openaiApiKey": "synthetic-openai-key"}');
250
+ assert.equal(out.includes("synthetic-openai-key"), false, "expected apiKey redacted after true scalar");
251
+ assert.match(out, /<redacted>/);
252
+ });
253
+
254
+ test("redactConfigText redacts the credential after a line-broken unfinished string", () => {
255
+ const out = redactConfigText('{"label": "unfinished\n"authToken": "synthetic-server-token"}');
256
+ assert.equal(out.includes("synthetic-server-token"), false, "expected credential redacted across line break");
257
+ assert.match(out, /<redacted>/);
258
+ });
259
+
260
+ test("redactConfigText redacts the credential after a line-broken property name", () => {
261
+ const out = redactConfigText('{"a\n": 1, "authToken": "synthetic-server-token"}');
262
+ // The broken key suppresses the unpairable rest of its line: the credential
263
+ // never appears and no <redacted> marker is needed.
264
+ assert.equal(out.includes("synthetic-server-token"), false, "expected credential redacted after broken key");
265
+ assert.equal(out.includes("authToken"), false, "expected the detached pair suppressed");
266
+ });
267
+
268
+ test("redactConfigText redacts everything after a line-break-split sensitive value", () => {
269
+ const out = redactConfigText('{"authToken": "synthetic-server-token\nmore-secret-value"}');
270
+ assert.equal(out.includes("synthetic-server-token"), false, "expected first secret segment redacted");
271
+ assert.equal(out.includes("more-secret-value"), false, "expected post-break secret text redacted");
272
+ });
273
+
103
274
  // ---------------------------------------------------------------------------
104
275
  // inspectScope — single-user (namespaces disabled)
105
276
  // ---------------------------------------------------------------------------
@@ -43,7 +43,8 @@ import type { CodingContext, MemoryCategory, MemoryFrontmatter, PluginConfig } f
43
43
  */
44
44
  export const REDACTED = "<redacted>";
45
45
 
46
- const SENSITIVE_KEY_RE = /(token|secret|password|api[_-]?key|bearer|authorization|credential|private[_-]?key)/i;
46
+ const SENSITIVE_KEY_SOURCE = "(?:token|secret|password|api[_-]?key|bearer|authorization|credential|private[_-]?key)";
47
+ const SENSITIVE_KEY_RE = new RegExp(SENSITIVE_KEY_SOURCE, "i");
47
48
  const BEARER_VALUE_RE = /^(bearer|sk-|pk-|xox[bp]-|AKIA)/i;
48
49
  const LONG_OPAQUE_RE = /^[A-Za-z0-9_\-]{32,}$/;
49
50
 
@@ -93,13 +94,225 @@ function walkRedact(value: unknown, key: string | undefined): unknown {
93
94
  const record = value as Record<string, unknown>;
94
95
  const out: Record<string, unknown> = {};
95
96
  for (const [k, v] of Object.entries(record)) {
96
- out[k] = walkRedact(v, k);
97
+ // A sensitive name redacts the COMPLETE value regardless of type: arrays
98
+ // and objects under e.g. `apiKeys` / `credentials` carry credentials just
99
+ // as strings do (recursing dropped the key and leaked short members).
100
+ out[k] = SENSITIVE_KEY_RE.test(k) && !SAFE_DIAGNOSTIC_KEYS.has(k) ? REDACTED : walkRedact(v, k);
97
101
  }
98
102
  return out;
99
103
  }
100
104
  return value;
101
105
  }
102
106
 
107
+ /**
108
+ * Remove `/* *\/` and `//` comments outside JSON strings and drop trailing
109
+ * commas, so JSONC-style configs can take the structured redaction path
110
+ * (JSON.parse rejects both). A trailing comma is a comma whose next
111
+ * non-whitespace character is a closing `}` or `]`. Unterminated constructs
112
+ * truncate the remainder, keeping the conservative regex fallback in charge.
113
+ * Linear scan: tracks string state with escape handling, so comments and
114
+ * commas inside string values (e.g. URLs) are never touched.
115
+ */
116
+ function stripJsonComments(text: string): string {
117
+ let out = "";
118
+ let inString = false;
119
+ for (let i = 0; i < text.length; i += 1) {
120
+ const ch = text[i];
121
+ if (inString) {
122
+ out += ch;
123
+ if (ch === "\\" && i + 1 < text.length) {
124
+ out += text[i + 1];
125
+ i += 1;
126
+ } else if (ch === '"') {
127
+ inString = false;
128
+ }
129
+ continue;
130
+ }
131
+ if (ch === '"') {
132
+ inString = true;
133
+ out += ch;
134
+ continue;
135
+ }
136
+ if (ch === "/" && text[i + 1] === "*") {
137
+ const end = text.indexOf("*/", i + 2);
138
+ if (end === -1) break;
139
+ i = end + 1;
140
+ continue;
141
+ }
142
+ if (ch === "/" && text[i + 1] === "/") {
143
+ const end = text.indexOf("\n", i + 2);
144
+ if (end === -1) break;
145
+ i = end;
146
+ continue;
147
+ }
148
+ if (ch === ",") {
149
+ let j = i + 1;
150
+ while (j < text.length && (text[j] === " " || text[j] === "\t" || text[j] === "\n" || text[j] === "\r")) j += 1;
151
+ if (text[j] === "}" || text[j] === "]") continue;
152
+ out += ch;
153
+ continue;
154
+ }
155
+ out += ch;
156
+ }
157
+ return out;
158
+ }
159
+
160
+ /**
161
+ * Redact a raw config-file text dump for display (COS-825). Parses JSON and
162
+ * walks it with `redactSensitive`, so nested credentials (e.g. replica peer
163
+ * tokens) get the same key/value rules the admin surfaces use. JSONC-style
164
+ * comments are stripped first (outside strings), so files humans edit by hand
165
+ * still take the structured path. Files that still do not parse keep their
166
+ * comment-stripped text under a conservative regex: every
167
+ * `"<sensitive-key>": "<value>"` pair at any depth has its value replaced
168
+ * with the redaction marker.
169
+ */
170
+ export function redactConfigText(raw: string): string {
171
+ const withoutComments = stripJsonComments(raw);
172
+ try {
173
+ const parsed: unknown = JSON.parse(withoutComments);
174
+ return JSON.stringify(redactSensitive(parsed), null, 2);
175
+ } catch {
176
+ return redactFallbackPairs(withoutComments);
177
+ }
178
+ }
179
+
180
+ /**
181
+ * Last-resort redaction for text JSON.parse still refuses (real syntax
182
+ * errors): walk the text linearly, decode each property name
183
+ * (`"auth\u0054oken"` names `authToken`), and replace the whole string value
184
+ * of a sensitive property with the redaction marker. Unterminated string
185
+ * values under a sensitive property are cut at end of line. Non-string
186
+ * values stay visible: anything JSONC-tolerant already took the structured
187
+ * path above, so this only sees genuinely broken files. Scanner, not regex —
188
+ * the pair shape is unbounded and check:regex-safety rejects such patterns.
189
+ */
190
+ function redactFallbackPairs(text: string): string {
191
+ const out: string[] = [];
192
+ const n = text.length;
193
+ let i = 0;
194
+ while (i < n) {
195
+ if (text[i] !== '"') {
196
+ out.push(text[i]);
197
+ i += 1;
198
+ continue;
199
+ }
200
+ const keyStart = i;
201
+ const keyEnd = scanJsonString(text, i);
202
+ if (keyEnd === -1) {
203
+ out.push(text.slice(i));
204
+ break;
205
+ }
206
+ if (text[keyEnd] !== '"') {
207
+ // A raw CR/LF cut the key: the fragment cannot pair safely, and the
208
+ // following line's leading quote would open a phantom string that
209
+ // detaches later credentials from their pairs. Drop through the end of
210
+ // that line instead of exposing them.
211
+ const nl = text.indexOf("\n", keyEnd);
212
+ out.push(text.slice(i, keyEnd));
213
+ i = nl === -1 ? n : nl + 1;
214
+ continue;
215
+ }
216
+ let k = skipJsonWhitespace(text, keyEnd + 1);
217
+ if (text[k] !== ":") {
218
+ // Orphan string (no colon follows): pairing in this broken text is not
219
+ // trustworthy, so suppress through the rest of the line instead of
220
+ // risking a later credential pairing past its key.
221
+ out.push(text.slice(i, keyEnd + 1));
222
+ const nl = text.indexOf("\n", keyEnd + 1);
223
+ i = nl === -1 ? n : nl + 1;
224
+ continue;
225
+ }
226
+ k = skipJsonWhitespace(text, k + 1);
227
+ out.push(text.slice(i, k));
228
+ i = k;
229
+ const decodedKey = decodeJsonKeyName(text.slice(keyStart + 1, keyEnd));
230
+ if (text[i] !== '"') {
231
+ // Non-string value: `{` / `[` are transparent — pairs nested inside are
232
+ // processed by the main loop, so sensitive keys never hide under a
233
+ // non-sensitive parent. Scalars stop at the next quote so a missing
234
+ // comma never swallows a following property (old regex redacted those).
235
+ // Anything JSONC-tolerant already took the structured path above.
236
+ if (text[i] === "{" || text[i] === "[") {
237
+ out.push(text[i]);
238
+ i += 1;
239
+ continue;
240
+ }
241
+ const valueEnd = scanToValueEnd(text, i);
242
+ out.push(text.slice(i, valueEnd));
243
+ i = valueEnd;
244
+ continue;
245
+ }
246
+ const valueEnd = scanJsonString(text, i);
247
+ if (valueEnd === -1) {
248
+ // Unterminated at EOF under a sensitive key: nothing after is
249
+ // trustworthy, redact to end of input.
250
+ if (SENSITIVE_KEY_RE.test(decodedKey)) {
251
+ out.push(REDACTED);
252
+ i = n;
253
+ } else {
254
+ const stop = text.indexOf("\n", i);
255
+ const stopAt = stop === -1 ? n : stop + 1;
256
+ out.push(text.slice(i, stopAt));
257
+ i = stopAt;
258
+ }
259
+ continue;
260
+ }
261
+ if (SENSITIVE_KEY_RE.test(decodedKey)) {
262
+ out.push(REDACTED);
263
+ // A raw CR/LF ended the string: the credential spans a broken line and
264
+ // its real end is unknowable, so redact everything after it too.
265
+ if (text[valueEnd] !== '"') {
266
+ i = n;
267
+ } else {
268
+ i = valueEnd + 1;
269
+ }
270
+ } else {
271
+ out.push(text.slice(i, valueEnd + 1));
272
+ i = valueEnd + 1;
273
+ }
274
+ }
275
+ return out.join("");
276
+ }
277
+
278
+ /** Index just past the JSON string opening at `start`, or -1 if unterminated. Raw CR/LF terminate the scan (invalid JSON recovery). */
279
+ function scanJsonString(text: string, start: number): number {
280
+ let i = start + 1;
281
+ const n = text.length;
282
+ while (i < n) {
283
+ const ch = text[i];
284
+ if (ch === "\\") {
285
+ i += 2;
286
+ continue;
287
+ }
288
+ if (ch === '"' || ch === "\n" || ch === "\r") return i;
289
+ i += 1;
290
+ }
291
+ return -1;
292
+ }
293
+
294
+ function skipJsonWhitespace(text: string, start: number): number {
295
+ let i = start;
296
+ while (i < text.length && (text[i] === " " || text[i] === "\t" || text[i] === "\n" || text[i] === "\r")) i += 1;
297
+ return i;
298
+ }
299
+
300
+ function scanToValueEnd(text: string, start: number): number {
301
+ let i = start;
302
+ while (i < text.length && text[i] !== "," && text[i] !== "}" && text[i] !== "]" && text[i] !== "\n" && text[i] !== '"') i += 1;
303
+ return i;
304
+ }
305
+
306
+ function decodeJsonKeyName(rawKey: string): string {
307
+ try {
308
+ // SAFETY: JSON.parse of a double-quoted string literal always yields a
309
+ // string; malformed escapes throw and the raw key is used instead.
310
+ return JSON.parse(`"${rawKey}"`) as string;
311
+ } catch {
312
+ return rawKey;
313
+ }
314
+ }
315
+
103
316
  // ---------------------------------------------------------------------------
104
317
  // Effective scope inspector
105
318
  // ---------------------------------------------------------------------------
@@ -470,3 +470,84 @@ test("#3389 a debounce-off deferred retry re-arms after a transient write failur
470
470
  "a failed deferred save must re-arm a retry even with debounce off",
471
471
  );
472
472
  });
473
+
474
+ // COS-825: the observe path needs a subset barrier — the sessions it just
475
+ // admitted must land durably before the ack, but OTHER dirty sessions keep
476
+ // their steady-state deferral instead of being forced by every observe.
477
+ test("COS-825 a forced key writes despite the defer window", async () => {
478
+ const storage = new DeferStorage(emptyState());
479
+ const entries = new Map<string, BufferEntryState>([["big", bigEntry()]]);
480
+ const peek = (key: string) => entries.get(key);
481
+ const persistence = new BufferSessionPersistence();
482
+ let now = 1_000;
483
+ const clock = () => now;
484
+
485
+ persistence.markDirty("big");
486
+ await persistence.persist(storage, emptyState(), peek, undefined, { now: clock, allowDeferral: true });
487
+ persistence.markDirty("big");
488
+ now += 1_000; // still inside the defer interval
489
+ await persistence.persist(storage, emptyState(), peek, undefined, {
490
+ now: clock,
491
+ allowDeferral: true,
492
+ forceKeys: new Set(["big"]),
493
+ });
494
+ assert.equal(storage.writeCount("big"), 2, "a forced key is written now");
495
+ assert.equal(persistence.hasPending(), false);
496
+ });
497
+
498
+ test("COS-825 a subset barrier defers unforced large sessions and writes forced keys", async () => {
499
+ const storage = new DeferStorage(emptyState());
500
+ const entries = new Map<string, BufferEntryState>([
501
+ ["big", bigEntry()],
502
+ ["small", { turns: [makeTurn("small", "tiny")], lastExtractionAt: null, extractionCount: 0 }],
503
+ ]);
504
+ const peek = (key: string) => entries.get(key);
505
+ const persistence = new BufferSessionPersistence();
506
+ let now = 1_000;
507
+ const clock = () => now;
508
+
509
+ persistence.markDirty("big");
510
+ await persistence.persist(storage, emptyState(), peek, undefined, { now: clock, allowDeferral: true });
511
+ persistence.markDirty("big");
512
+ persistence.markDirty("small");
513
+ now += 1_000;
514
+ const outcome = await persistence.persist(storage, emptyState(), peek, undefined, {
515
+ now: clock,
516
+ allowDeferral: true,
517
+ forceKeys: new Set(["small"]),
518
+ });
519
+ assert.equal(storage.writeCount("small"), 1, "the admitted session is durable");
520
+ assert.equal(storage.writeCount("big"), 1, "the unrelated large session is not forced");
521
+ assert.deepEqual(outcome.deferred, ["big"]);
522
+ assert.ok(outcome.deferredRetryDelayMs !== undefined, "the deferred tail arms a retry");
523
+ assert.equal(persistence.hasPending(), true, "the deferred session stays pending");
524
+ });
525
+
526
+ test("COS-825 SmartBuffer: the observe flush forces only the admitted sessions", async () => {
527
+ const state = emptyState();
528
+ state.entries = { big: bigEntry() };
529
+ const storage = new DeferStorage(state);
530
+ const buffer = new SmartBuffer(
531
+ parseConfig({ triggerMode: "every_n", bufferMaxTurns: 1_000, bufferSaveDebounceMs: 0 }),
532
+ storage,
533
+ );
534
+
535
+ await buffer.addTurn("big", makeTurn("big", "more")); // first write lands
536
+ await buffer.addTurn("big", makeTurn("big", "more")); // deferred (large + recent)
537
+ await buffer.addTurn("small", makeTurn("small", "a")); // admitted session, inline save writes it
538
+ assert.equal(storage.writeCount("small"), 1, "the admitted session landed durably");
539
+ assert.equal(storage.writeCount("big"), 1);
540
+
541
+ // The observe path's subset barrier: force the admitted key only. Nothing
542
+ // may force the deferred large session here.
543
+ await buffer.flushPendingSave({
544
+ throwOnFailure: true,
545
+ allowDeferral: true,
546
+ forceKeys: new Set(["small"]),
547
+ });
548
+ assert.equal(storage.writeCount("big"), 1, "the deferred large session was not forced");
549
+
550
+ // The deferred tail still lands on a real barrier.
551
+ await buffer.save();
552
+ assert.equal(storage.writeCount("big"), 2, "a full barrier flushes the deferred session");
553
+ });
@@ -76,6 +76,13 @@ export interface BufferPersistOptions {
76
76
  * memory until the next pass or a forced flush.
77
77
  */
78
78
  allowDeferral?: boolean;
79
+ /**
80
+ * COS-825 subset barrier: sessions in this set always write now, even on an
81
+ * allowDeferral pass. The observe path forces exactly the sessions it
82
+ * admitted so their turns are durable before the ack, while other dirty
83
+ * sessions keep their rate-limited cadence.
84
+ */
85
+ forceKeys?: ReadonlySet<string>;
79
86
  }
80
87
 
81
88
  /** Approximate serialized size of one session file without stringifying it. */
@@ -205,7 +212,7 @@ export class BufferSessionPersistence {
205
212
  this.markDeleted(key);
206
213
  continue;
207
214
  }
208
- if (opts?.allowDeferral === true && key !== reconcile?.key) {
215
+ if (opts?.allowDeferral === true && !opts.forceKeys?.has(key) && key !== reconcile?.key) {
209
216
  const last = this.lastPersistedAt.get(key);
210
217
  if (
211
218
  last !== undefined &&
package/src/buffer.ts CHANGED
@@ -250,9 +250,9 @@ export class SmartBuffer {
250
250
 
251
251
  private async saveUnlocked(
252
252
  reconcile?: { key: string; drained: import("./buffer-turn-helpers.js").DrainedTurnSets },
253
- opts?: { allowDeferral?: boolean },
253
+ opts?: { allowDeferral?: boolean; forceKeys?: ReadonlySet<string> },
254
254
  ): Promise<import("./buffer-persistence.js").BufferPersistOutcome> {
255
- const outcome = await this.persistence.persist(this.storage, this.state, (key) => this.peekEntry(key) ?? undefined, reconcile, { allowDeferral: opts?.allowDeferral === true });
255
+ const outcome = await this.persistence.persist(this.storage, this.state, (key) => this.peekEntry(key) ?? undefined, reconcile, { allowDeferral: opts?.allowDeferral === true, forceKeys: opts?.forceKeys });
256
256
  const { handedOver, drainedTurns } = outcome;
257
257
  // A drain tombstone: the turns the drain extracted leave this copy too,
258
258
  // so a stale owner never extracts (or persists) them a second time.
@@ -431,7 +431,12 @@ export class SmartBuffer {
431
431
  * proceeding to extract_now on a non-durable triggering turn. Default false
432
432
  * keeps the fail-open behavior for the timer/shutdown callers.
433
433
  */
434
- async flushPendingSave(opts?: { throwOnFailure?: boolean; allowDeferral?: boolean }): Promise<void> {
434
+ async flushPendingSave(opts?: {
435
+ throwOnFailure?: boolean;
436
+ allowDeferral?: boolean;
437
+ /** COS-825 subset barrier: these sessions write now even on a deferral pass. */
438
+ forceKeys?: ReadonlySet<string>;
439
+ }): Promise<void> {
435
440
  if (this.saveTimer) {
436
441
  clearTimeout(this.saveTimer);
437
442
  this.saveTimer = null;
@@ -446,7 +451,7 @@ export class SmartBuffer {
446
451
  // writes). resetToEmpty-only deletions also land here without a
447
452
  // pending-save flag.
448
453
  if (!this.pendingSave && !this.persistence.hasPending()) return;
449
- const outcome = await this.saveUnlocked(undefined, { allowDeferral: opts?.allowDeferral === true });
454
+ const outcome = await this.saveUnlocked(undefined, { allowDeferral: opts?.allowDeferral === true, forceKeys: opts?.forceKeys });
450
455
  // Clear the pending flag INSIDE the same serialized mutation as the
451
456
  // write (issue #1909 review): an addTurn interleaving between the
452
457
  // write and the clear would lose its re-armed timer. Deferred
@@ -3161,3 +3161,12 @@ test("parseConfig: extractionQueueConcurrency defaults to bounded-parallel 2 and
3161
3161
  );
3162
3162
  }
3163
3163
  });
3164
+
3165
+ test("parseConfig harmonicGraphCacheTtlMs defaults and validates (COS-825)", () => {
3166
+ assert.equal(parseConfig({}).harmonicGraphCacheTtlMs, 300_000);
3167
+ assert.equal(parseConfig({ harmonicGraphCacheTtlMs: 5_000 }).harmonicGraphCacheTtlMs, 5_000);
3168
+ assert.equal(parseConfig({ harmonicGraphCacheTtlMs: 3_600_000 }).harmonicGraphCacheTtlMs, 3_600_000);
3169
+ assert.throws(() => parseConfig({ harmonicGraphCacheTtlMs: 999 }));
3170
+ assert.throws(() => parseConfig({ harmonicGraphCacheTtlMs: 3_600_001 }));
3171
+ assert.throws(() => parseConfig({ harmonicGraphCacheTtlMs: 2.5 }));
3172
+ });
package/src/config.ts CHANGED
@@ -1760,12 +1760,7 @@ export function parseConfig(
1760
1760
  ),
1761
1761
  sessionObserverBands,
1762
1762
  injectQuestions: cfg.injectQuestions === true,
1763
- commitmentDecayDays: parseIntegerAtLeast(
1764
- cfg.commitmentDecayDays,
1765
- 90,
1766
- 1,
1767
- "commitmentDecayDays",
1768
- ),
1763
+ commitmentDecayDays: parseIntegerAtLeast(cfg.commitmentDecayDays, 90, 1, "commitmentDecayDays"),
1769
1764
  workspaceDir:
1770
1765
  typeof cfg.workspaceDir === "string" && cfg.workspaceDir.length > 0
1771
1766
  ? expandTildePath(cfg.workspaceDir)
@@ -2480,6 +2475,8 @@ export function parseConfig(
2480
2475
  memoryPoisoningDefenseEnabled: cfg.memoryPoisoningDefenseEnabled === true,
2481
2476
  memoryRedTeamBenchEnabled: cfg.memoryRedTeamBenchEnabled === true,
2482
2477
  harmonicRetrievalEnabled: cfg.harmonicRetrievalEnabled === true,
2478
+ harmonicGraphCacheTtlMs: parseIntegerInClosedRange(
2479
+ cfg.harmonicGraphCacheTtlMs, 1_000, 3_600_000, 300_000, "harmonicGraphCacheTtlMs"),
2483
2480
  episodicContextEnabled: cfg.episodicContextEnabled === true,
2484
2481
  abstractionAnchorsEnabled: cfg.abstractionAnchorsEnabled === true,
2485
2482
  verifiedRecallEnabled: cfg.verifiedRecallEnabled === true,