@remnic/core 10.0.168 → 10.0.169

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 (376) hide show
  1. package/dist/access-admin-ops-surface.js +138 -137
  2. package/dist/access-cli.js +138 -137
  3. package/dist/access-cli.js.map +1 -1
  4. package/dist/access-coding-context-resolution.js +11 -11
  5. package/dist/access-extraction-force-flush-preempt.js +138 -137
  6. package/dist/access-extraction-force-flush.js +138 -137
  7. package/dist/access-http-briefing.js +138 -137
  8. package/dist/access-http-query.js +138 -137
  9. package/dist/access-http.js +138 -137
  10. package/dist/access-identity-continuity-surface.js +138 -137
  11. package/dist/access-lcm-surface.js +138 -137
  12. package/dist/access-mcp.js +138 -137
  13. package/dist/access-observe-write-category.js +11 -11
  14. package/dist/access-observe-write-surface.js +138 -137
  15. package/dist/access-offline-manifest.js +9 -9
  16. package/dist/access-operations-batch.js +138 -137
  17. package/dist/access-operations.js +138 -137
  18. package/dist/access-recall-concurrency.js +138 -137
  19. package/dist/access-recall-excerpt-attribution.d.ts +19 -0
  20. package/dist/access-recall-excerpt-attribution.d.ts.map +1 -0
  21. package/dist/access-recall-excerpt-attribution.js +8 -0
  22. package/dist/access-recall-response.js +138 -137
  23. package/dist/access-recall-surface.d.ts.map +1 -1
  24. package/dist/access-recall-surface.js +138 -137
  25. package/dist/access-schema.js +10 -10
  26. package/dist/access-service.js +138 -137
  27. package/dist/active-recall.js +24 -24
  28. package/dist/adapters/index.js +4 -4
  29. package/dist/adapters/registry.js +2 -2
  30. package/dist/{auto-sync-L3M4RKJD.js → auto-sync-ACP5U5A3.js} +3 -3
  31. package/dist/binary-lifecycle/scanner.d.ts +2 -4
  32. package/dist/binary-lifecycle/scanner.d.ts.map +1 -1
  33. package/dist/briefing.js +13 -13
  34. package/dist/buffer-add-turns-bounded.d.ts +11 -1
  35. package/dist/buffer-add-turns-bounded.d.ts.map +1 -1
  36. package/dist/buffer-add-turns-bounded.js +3 -3
  37. package/dist/buffer-session-cap.d.ts +2 -2
  38. package/dist/buffer-session-cap.d.ts.map +1 -1
  39. package/dist/buffer-session-cap.js +1 -1
  40. package/dist/buffer.d.ts +3 -2
  41. package/dist/buffer.d.ts.map +1 -1
  42. package/dist/buffer.js +12 -12
  43. package/dist/calibration.d.ts +19 -2
  44. package/dist/calibration.d.ts.map +1 -1
  45. package/dist/calibration.js +28 -5
  46. package/dist/calibration.js.map +1 -1
  47. package/dist/{capsule-crypto-GWVG7LGC.js → capsule-crypto-7FJQINUR.js} +2 -2
  48. package/dist/{capsule-merge-VHBRF65A.js → capsule-merge-BADOICNP.js} +2 -2
  49. package/dist/causal-behavior.js +2 -2
  50. package/dist/causal-chain.js +2 -2
  51. package/dist/causal-consolidation.js +17 -17
  52. package/dist/causal-retrieval.js +2 -2
  53. package/dist/causal-trajectory-graph.js +3 -3
  54. package/dist/causal-trajectory.js +1 -1
  55. package/dist/{chunk-OWHERGF2.js → chunk-2NLLXCJG.js} +2 -2
  56. package/dist/{chunk-D6BOOYNJ.js → chunk-32OTLNAU.js} +271 -237
  57. package/dist/chunk-32OTLNAU.js.map +1 -0
  58. package/dist/{chunk-L7SEYUHS.js → chunk-3I3NXB6X.js} +3 -3
  59. package/dist/{chunk-4NBUHYUV.js → chunk-3LADDLAF.js} +5 -5
  60. package/dist/{chunk-2DL3OFLD.js → chunk-45GEJRIG.js} +2 -2
  61. package/dist/{chunk-5BE3FLKL.js → chunk-5KDDAQ6K.js} +8 -8
  62. package/dist/{chunk-BPCR5DZP.js → chunk-62YZOQFR.js} +5 -5
  63. package/dist/chunk-62YZOQFR.js.map +1 -0
  64. package/dist/{chunk-HLWXCDUQ.js → chunk-63A2BU2B.js} +5 -5
  65. package/dist/{chunk-MOUSHJAR.js → chunk-7FPI5MFB.js} +5 -5
  66. package/dist/{chunk-ZX546Y3Y.js → chunk-7OYDFIL4.js} +2 -2
  67. package/dist/{chunk-CKZWLAHN.js → chunk-ACPFBVUD.js} +2 -2
  68. package/dist/{chunk-BKTCVXMK.js → chunk-AHOYKJ5X.js} +3 -3
  69. package/dist/{chunk-WEHSQBFR.js → chunk-AIF6V2OX.js} +9 -4
  70. package/dist/chunk-AIF6V2OX.js.map +1 -0
  71. package/dist/{chunk-FGT7CUYZ.js → chunk-ALTLOHO7.js} +2 -2
  72. package/dist/{chunk-FMFCQRDM.js → chunk-AUFPPBC3.js} +3 -3
  73. package/dist/{chunk-OAQRZ4SV.js → chunk-B5KTTWC7.js} +2 -2
  74. package/dist/{chunk-73TPOGS4.js → chunk-BFBS7OFQ.js} +9 -9
  75. package/dist/{chunk-QFTK6EDM.js → chunk-BFZFNXOC.js} +13 -13
  76. package/dist/{chunk-ZQUOUPP3.js → chunk-BHRPZBAH.js} +4 -4
  77. package/dist/{chunk-4L25GAYL.js → chunk-CX24SVLK.js} +2 -2
  78. package/dist/{chunk-YY57TRKN.js → chunk-D5ZLTLHF.js} +2 -2
  79. package/dist/{chunk-WEFFO2MJ.js → chunk-D6YCETHG.js} +2 -2
  80. package/dist/{chunk-ZDZJNXL6.js → chunk-DK2VBJ6Q.js} +4 -4
  81. package/dist/{chunk-VRHY7Y5A.js → chunk-DPL5VO5V.js} +3 -3
  82. package/dist/{chunk-LVGTH6IQ.js → chunk-E7ATID4Z.js} +11 -11
  83. package/dist/{chunk-CKELO7Q6.js → chunk-FHWX2REL.js} +2 -2
  84. package/dist/{chunk-CUPILBIP.js → chunk-FMIM36I4.js} +2 -2
  85. package/dist/{chunk-OWM2VWNX.js → chunk-FSXYBIEZ.js} +25 -24
  86. package/dist/chunk-FSXYBIEZ.js.map +1 -0
  87. package/dist/{chunk-A5UOREWD.js → chunk-FWTGO4NE.js} +2 -2
  88. package/dist/{chunk-3SL52JKD.js → chunk-FZVROZKC.js} +5 -5
  89. package/dist/{chunk-U3BCW7GX.js → chunk-G3RLCVJC.js} +3 -3
  90. package/dist/{chunk-UYIBNDQE.js → chunk-GF5NN3LE.js} +2 -2
  91. package/dist/{chunk-7OCKK5M5.js → chunk-GWY5ZFHP.js} +6 -6
  92. package/dist/{chunk-AL3TCNSJ.js → chunk-H3MLOQ7F.js} +24 -53
  93. package/dist/chunk-H3MLOQ7F.js.map +1 -0
  94. package/dist/{chunk-TNRGWJYT.js → chunk-H4IU24V5.js} +2 -2
  95. package/dist/{chunk-T4BT4FQN.js → chunk-HH6PXQ2B.js} +3 -3
  96. package/dist/{chunk-FEUWI5QH.js → chunk-HHPY5SSE.js} +2 -2
  97. package/dist/{chunk-OM5ESBES.js → chunk-HQPFACXO.js} +2 -2
  98. package/dist/{chunk-QLQUAVVP.js → chunk-I7WPLMUX.js} +16 -16
  99. package/dist/chunk-I7WPLMUX.js.map +1 -0
  100. package/dist/{chunk-IMULTENA.js → chunk-ID65XTF3.js} +2 -2
  101. package/dist/{chunk-WWQMZBDI.js → chunk-IJVU4ILJ.js} +4 -4
  102. package/dist/{chunk-GBSXTTLP.js → chunk-ITGAGNX5.js} +2 -2
  103. package/dist/chunk-IUGOGDCP.js +39 -0
  104. package/dist/chunk-IUGOGDCP.js.map +1 -0
  105. package/dist/{chunk-3PNJZTDV.js → chunk-JGGNUEVD.js} +2 -2
  106. package/dist/{chunk-YYXYZM2I.js → chunk-JN7OSQJR.js} +2 -2
  107. package/dist/{chunk-4D2EY4WM.js → chunk-K2DTHNDY.js} +6 -6
  108. package/dist/{chunk-TH6OYP6I.js → chunk-K36RMINQ.js} +3 -3
  109. package/dist/{chunk-OZKVVUJB.js → chunk-KIM5VNZN.js} +2 -2
  110. package/dist/{chunk-BFPQJNFZ.js → chunk-LXSDEPEK.js} +60 -11
  111. package/dist/{chunk-BFPQJNFZ.js.map → chunk-LXSDEPEK.js.map} +1 -1
  112. package/dist/{chunk-ZWDDY4WF.js → chunk-M7CFCRWJ.js} +2 -2
  113. package/dist/{chunk-QPFM6DHY.js → chunk-MTJFK42O.js} +2 -2
  114. package/dist/{chunk-RO5EGRAI.js → chunk-N3FRR6II.js} +2 -2
  115. package/dist/{chunk-UMEUU66X.js → chunk-O3OEVYUR.js} +2 -2
  116. package/dist/{chunk-J74YOBB3.js → chunk-PFR6ZKQI.js} +8 -8
  117. package/dist/{chunk-TAD6QMMD.js → chunk-PRC7SZYM.js} +2 -2
  118. package/dist/{chunk-LWZNSQN3.js → chunk-PUQQPLVV.js} +3 -3
  119. package/dist/{chunk-LWZNSQN3.js.map → chunk-PUQQPLVV.js.map} +1 -1
  120. package/dist/{chunk-GMO3BGOF.js → chunk-QC2MHZDD.js} +1 -1
  121. package/dist/{chunk-FOTFLHBN.js → chunk-QPLI7LUU.js} +3 -2
  122. package/dist/chunk-QPLI7LUU.js.map +1 -0
  123. package/dist/{chunk-2MWKUVHT.js → chunk-RK7SE3BL.js} +5 -5
  124. package/dist/{chunk-HDWISXFH.js → chunk-RVAPK2S7.js} +2 -2
  125. package/dist/{chunk-5PUZV73Z.js → chunk-SEIGLG62.js} +11 -11
  126. package/dist/{chunk-AVWOULJH.js → chunk-SH3GOZWK.js} +2 -2
  127. package/dist/{chunk-PFLN6TTW.js → chunk-T3MCVSUC.js} +2 -2
  128. package/dist/{chunk-WQUGCOKF.js → chunk-TFA6HPOA.js} +4 -4
  129. package/dist/{chunk-CLVILSBR.js → chunk-TGQW3AMK.js} +22 -22
  130. package/dist/{chunk-YZYAYUJQ.js → chunk-TLRIRISJ.js} +4 -4
  131. package/dist/{chunk-7VIJUZYW.js → chunk-TQ4CELUR.js} +3 -3
  132. package/dist/{chunk-5QDTZIGH.js → chunk-U7KP6QFU.js} +2 -2
  133. package/dist/{chunk-BUKK5SWA.js → chunk-UPD5XDJX.js} +5 -5
  134. package/dist/{chunk-BUKK5SWA.js.map → chunk-UPD5XDJX.js.map} +1 -1
  135. package/dist/{chunk-QVXEXGIM.js → chunk-VF6SC4OD.js} +2 -2
  136. package/dist/{chunk-EZG54YDS.js → chunk-VKXJQF5C.js} +2 -2
  137. package/dist/{chunk-RFLC6PKQ.js → chunk-VMRPLHEU.js} +2 -2
  138. package/dist/{chunk-U2PSE7MB.js → chunk-VPEIWMUT.js} +2 -2
  139. package/dist/{chunk-X67XNZ64.js → chunk-W4EJMMPP.js} +10 -10
  140. package/dist/{chunk-RB7NXZ2E.js → chunk-W4Q65VJL.js} +2 -2
  141. package/dist/{chunk-HDDRVXX4.js → chunk-W5LJ3SJ7.js} +2 -2
  142. package/dist/{chunk-W7N7NWG5.js → chunk-WCJQ3OUP.js} +2 -2
  143. package/dist/{chunk-JIF22AXI.js → chunk-WGKIXNLY.js} +5 -2
  144. package/dist/{chunk-JIF22AXI.js.map → chunk-WGKIXNLY.js.map} +1 -1
  145. package/dist/{chunk-FFWFFAP3.js → chunk-WI2WTIMY.js} +14 -8
  146. package/dist/chunk-WI2WTIMY.js.map +1 -0
  147. package/dist/{chunk-UVYI6VIX.js → chunk-X7Y7WX73.js} +1 -1
  148. package/dist/{chunk-22V3CMIW.js → chunk-XJTRIHTH.js} +8 -8
  149. package/dist/{chunk-SIONKXLU.js → chunk-XTRC6SSS.js} +14 -14
  150. package/dist/{chunk-SBRUTD5O.js → chunk-YSATDEBY.js} +5 -5
  151. package/dist/{chunk-3YOX2BQD.js → chunk-YWMCV5HL.js} +3 -3
  152. package/dist/{chunk-L272A5QW.js → chunk-YYDUBGUF.js} +30 -22
  153. package/dist/chunk-YYDUBGUF.js.map +1 -0
  154. package/dist/{chunk-6QWFZ3X5.js → chunk-ZA6CYFAK.js} +2 -2
  155. package/dist/cli.js +138 -137
  156. package/dist/coding/export-okf-codegraph.js +24 -24
  157. package/dist/coding/pre-action-gate.js +2 -2
  158. package/dist/compounding/engine.js +14 -14
  159. package/dist/config.js +24 -24
  160. package/dist/connectors/codex-marketplace.d.ts.map +1 -1
  161. package/dist/connectors/codex-materialize-runner.js +14 -14
  162. package/dist/connectors/codex-materialize.d.ts.map +1 -1
  163. package/dist/connectors/codex-materialize.js +1 -1
  164. package/dist/connectors/index.js +15 -15
  165. package/dist/consolidation-provenance-check.js +2 -2
  166. package/dist/convergence-refresh.js +15 -15
  167. package/dist/conversation-index/backend.js +2 -2
  168. package/dist/corpus-watermark.js +15 -15
  169. package/dist/deep-recall-http-glue.js +11 -11
  170. package/dist/embedding-fallback.js +2 -2
  171. package/dist/entity-retrieval.js +14 -14
  172. package/dist/event-order-recall.js +3 -3
  173. package/dist/explicit-capture.js +138 -137
  174. package/dist/extraction-judge.js +1 -1
  175. package/dist/extraction-normalization.js +1 -1
  176. package/dist/extraction-span-materialize.js +2 -2
  177. package/dist/extraction.js +27 -27
  178. package/dist/{graph-edge-decay-BC3IO2J4.js → graph-edge-decay-CXTNJ7IQ.js} +6 -6
  179. package/dist/graph-edge-decay-CXTNJ7IQ.js.map +1 -0
  180. package/dist/graph-jsonl.js +4 -4
  181. package/dist/graph-snapshot.js +4 -4
  182. package/dist/graph.js +5 -5
  183. package/dist/harmonic-retrieval.js +13 -13
  184. package/dist/index.js +197 -196
  185. package/dist/lcm/index.js +3 -3
  186. package/dist/local-llm.js +2 -2
  187. package/dist/location/index.js +14 -14
  188. package/dist/maintenance/memory-governance.js +13 -13
  189. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +13 -13
  190. package/dist/maintenance/rebuild-memory-projection-runner.js +15 -15
  191. package/dist/maintenance/rebuild-memory-projection.js +14 -14
  192. package/dist/memory-browse.js +5 -5
  193. package/dist/memory-controller.d.ts.map +1 -1
  194. package/dist/memory-controller.js +1 -1
  195. package/dist/namespaces/migrate.js +14 -14
  196. package/dist/namespaces/search.js +7 -7
  197. package/dist/namespaces/storage.d.ts.map +1 -1
  198. package/dist/namespaces/storage.js +13 -13
  199. package/dist/offline-sync-changeset-generations.js +4 -4
  200. package/dist/offline-sync-embedding-generation.js +3 -3
  201. package/dist/offline-sync-snapshot-stream.js +7 -7
  202. package/dist/offline-sync.js +6 -6
  203. package/dist/operator-doctor-corpus.js +16 -16
  204. package/dist/operator-toolkit.js +35 -35
  205. package/dist/orchestration/backlog-scheduler.d.ts +4 -0
  206. package/dist/orchestration/backlog-scheduler.d.ts.map +1 -1
  207. package/dist/orchestration/backlog-scheduler.js +149 -142
  208. package/dist/orchestration/backlog-scheduler.js.map +1 -1
  209. package/dist/orchestration/buffer-drain-runner.js +139 -138
  210. package/dist/orchestration/extraction-persist-citation.d.ts +2 -2
  211. package/dist/orchestration/extraction-persist-citation.d.ts.map +1 -1
  212. package/dist/orchestration/extraction-persist.d.ts.map +1 -1
  213. package/dist/orchestration/maintenance.js +23 -23
  214. package/dist/orchestration/recall-internal.d.ts.map +1 -1
  215. package/dist/orchestration/turn-ingestion-buffered.d.ts.map +1 -1
  216. package/dist/orchestrator.d.ts.map +1 -1
  217. package/dist/orchestrator.js +140 -139
  218. package/dist/qmd.js +4 -4
  219. package/dist/recall-navigation.js +138 -137
  220. package/dist/recall-state-view-admission.js +5 -5
  221. package/dist/recall-state-view-packet.d.ts.map +1 -1
  222. package/dist/recall-state-view-packet.js +30 -8
  223. package/dist/recall-state-view-packet.js.map +1 -1
  224. package/dist/recall-why-service.js +5 -5
  225. package/dist/reconcile/manifest.js +2 -2
  226. package/dist/resume-bundles.js +25 -25
  227. package/dist/search/factory.js +6 -6
  228. package/dist/search/index.js +8 -8
  229. package/dist/semantic-consolidation.js +18 -18
  230. package/dist/semantic-rule-promotion.js +13 -13
  231. package/dist/semantic-rule-verifier.js +13 -13
  232. package/dist/source-agent-qualifier.js +18 -18
  233. package/dist/source-attribution.d.ts +3 -3
  234. package/dist/source-attribution.d.ts.map +1 -1
  235. package/dist/source-attribution.js +1 -1
  236. package/dist/standup/build.js +13 -13
  237. package/dist/storage.d.ts +1 -0
  238. package/dist/storage.d.ts.map +1 -1
  239. package/dist/storage.js +12 -12
  240. package/dist/summarizer.d.ts +7 -1
  241. package/dist/summarizer.d.ts.map +1 -1
  242. package/dist/summarizer.js +3 -3
  243. package/dist/support-passport/index.js +16 -16
  244. package/dist/transfer/autodetect.js +3 -3
  245. package/dist/transfer/backup.js +2 -2
  246. package/dist/transfer/capsule-export.js +3 -3
  247. package/dist/transfer/capsule-import.js +3 -3
  248. package/dist/transfer/export-okf.js +13 -13
  249. package/dist/transfer/import-json.js +2 -2
  250. package/dist/transfer/import-md.js +2 -2
  251. package/dist/transfer/types.d.ts +15 -3
  252. package/dist/transfer/types.d.ts.map +1 -1
  253. package/dist/transfer/types.js +3 -1
  254. package/dist/verified-recall.js +13 -13
  255. package/dist/who-knows-cli.js +14 -14
  256. package/dist/who-knows.js +13 -13
  257. package/package.json +2 -2
  258. package/src/access-cli.test.ts +9 -9
  259. package/src/access-recall-excerpt-attribution.ts +69 -0
  260. package/src/access-recall-surface.ts +23 -21
  261. package/src/access-service-raw-excerpt-read-gate.test.ts +192 -11
  262. package/src/backlog-scheduler.test.ts +31 -0
  263. package/src/binary-lifecycle/scanner.ts +35 -14
  264. package/src/buffer-add-turns-bounded.ts +16 -2
  265. package/src/buffer-session-cap.ts +4 -4
  266. package/src/buffer.ts +5 -5
  267. package/src/calibration.ts +56 -4
  268. package/src/connectors/codex-marketplace-git.test.ts +267 -0
  269. package/src/connectors/codex-marketplace.ts +76 -13
  270. package/src/connectors/codex-materialize.ts +29 -55
  271. package/src/memory-controller.test.ts +11 -0
  272. package/src/memory-controller.ts +5 -1
  273. package/src/namespaces/storage.ts +1 -0
  274. package/src/orchestration/backlog-scheduler.ts +12 -3
  275. package/src/orchestration/extraction-persist-citation.ts +5 -3
  276. package/src/orchestration/extraction-persist.ts +15 -14
  277. package/src/orchestration/recall-internal.ts +2 -3
  278. package/src/orchestration/turn-ingestion-buffered.test.ts +52 -1
  279. package/src/orchestration/turn-ingestion-buffered.ts +26 -8
  280. package/src/orchestrator.ts +1 -0
  281. package/src/recall-state-view-packet.test.ts +40 -0
  282. package/src/recall-state-view-packet.ts +46 -9
  283. package/src/source-attribution.test.ts +57 -0
  284. package/src/source-attribution.ts +46 -43
  285. package/src/storage.ts +4 -3
  286. package/src/summarizer-shutdown.test.ts +49 -16
  287. package/src/summarizer.ts +13 -5
  288. package/src/testing/subjects/memory-maintenance.test.ts +293 -0
  289. package/src/transfer/capsule-export.ts +2 -1
  290. package/src/transfer/capsule-taxonomy-version.test.ts +70 -0
  291. package/src/transfer/types.ts +13 -3
  292. package/dist/chunk-AL3TCNSJ.js.map +0 -1
  293. package/dist/chunk-BPCR5DZP.js.map +0 -1
  294. package/dist/chunk-D6BOOYNJ.js.map +0 -1
  295. package/dist/chunk-FFWFFAP3.js.map +0 -1
  296. package/dist/chunk-FOTFLHBN.js.map +0 -1
  297. package/dist/chunk-L272A5QW.js.map +0 -1
  298. package/dist/chunk-OWM2VWNX.js.map +0 -1
  299. package/dist/chunk-QLQUAVVP.js.map +0 -1
  300. package/dist/chunk-WEHSQBFR.js.map +0 -1
  301. /package/dist/{capsule-crypto-GWVG7LGC.js.map → access-recall-excerpt-attribution.js.map} +0 -0
  302. /package/dist/{auto-sync-L3M4RKJD.js.map → auto-sync-ACP5U5A3.js.map} +0 -0
  303. /package/dist/{graph-edge-decay-BC3IO2J4.js.map → capsule-crypto-7FJQINUR.js.map} +0 -0
  304. /package/dist/{capsule-merge-VHBRF65A.js.map → capsule-merge-BADOICNP.js.map} +0 -0
  305. /package/dist/{chunk-OWHERGF2.js.map → chunk-2NLLXCJG.js.map} +0 -0
  306. /package/dist/{chunk-L7SEYUHS.js.map → chunk-3I3NXB6X.js.map} +0 -0
  307. /package/dist/{chunk-4NBUHYUV.js.map → chunk-3LADDLAF.js.map} +0 -0
  308. /package/dist/{chunk-2DL3OFLD.js.map → chunk-45GEJRIG.js.map} +0 -0
  309. /package/dist/{chunk-5BE3FLKL.js.map → chunk-5KDDAQ6K.js.map} +0 -0
  310. /package/dist/{chunk-HLWXCDUQ.js.map → chunk-63A2BU2B.js.map} +0 -0
  311. /package/dist/{chunk-MOUSHJAR.js.map → chunk-7FPI5MFB.js.map} +0 -0
  312. /package/dist/{chunk-ZX546Y3Y.js.map → chunk-7OYDFIL4.js.map} +0 -0
  313. /package/dist/{chunk-CKZWLAHN.js.map → chunk-ACPFBVUD.js.map} +0 -0
  314. /package/dist/{chunk-BKTCVXMK.js.map → chunk-AHOYKJ5X.js.map} +0 -0
  315. /package/dist/{chunk-FGT7CUYZ.js.map → chunk-ALTLOHO7.js.map} +0 -0
  316. /package/dist/{chunk-FMFCQRDM.js.map → chunk-AUFPPBC3.js.map} +0 -0
  317. /package/dist/{chunk-OAQRZ4SV.js.map → chunk-B5KTTWC7.js.map} +0 -0
  318. /package/dist/{chunk-73TPOGS4.js.map → chunk-BFBS7OFQ.js.map} +0 -0
  319. /package/dist/{chunk-QFTK6EDM.js.map → chunk-BFZFNXOC.js.map} +0 -0
  320. /package/dist/{chunk-ZQUOUPP3.js.map → chunk-BHRPZBAH.js.map} +0 -0
  321. /package/dist/{chunk-4L25GAYL.js.map → chunk-CX24SVLK.js.map} +0 -0
  322. /package/dist/{chunk-YY57TRKN.js.map → chunk-D5ZLTLHF.js.map} +0 -0
  323. /package/dist/{chunk-WEFFO2MJ.js.map → chunk-D6YCETHG.js.map} +0 -0
  324. /package/dist/{chunk-ZDZJNXL6.js.map → chunk-DK2VBJ6Q.js.map} +0 -0
  325. /package/dist/{chunk-VRHY7Y5A.js.map → chunk-DPL5VO5V.js.map} +0 -0
  326. /package/dist/{chunk-LVGTH6IQ.js.map → chunk-E7ATID4Z.js.map} +0 -0
  327. /package/dist/{chunk-CKELO7Q6.js.map → chunk-FHWX2REL.js.map} +0 -0
  328. /package/dist/{chunk-CUPILBIP.js.map → chunk-FMIM36I4.js.map} +0 -0
  329. /package/dist/{chunk-A5UOREWD.js.map → chunk-FWTGO4NE.js.map} +0 -0
  330. /package/dist/{chunk-3SL52JKD.js.map → chunk-FZVROZKC.js.map} +0 -0
  331. /package/dist/{chunk-U3BCW7GX.js.map → chunk-G3RLCVJC.js.map} +0 -0
  332. /package/dist/{chunk-UYIBNDQE.js.map → chunk-GF5NN3LE.js.map} +0 -0
  333. /package/dist/{chunk-7OCKK5M5.js.map → chunk-GWY5ZFHP.js.map} +0 -0
  334. /package/dist/{chunk-TNRGWJYT.js.map → chunk-H4IU24V5.js.map} +0 -0
  335. /package/dist/{chunk-T4BT4FQN.js.map → chunk-HH6PXQ2B.js.map} +0 -0
  336. /package/dist/{chunk-FEUWI5QH.js.map → chunk-HHPY5SSE.js.map} +0 -0
  337. /package/dist/{chunk-OM5ESBES.js.map → chunk-HQPFACXO.js.map} +0 -0
  338. /package/dist/{chunk-IMULTENA.js.map → chunk-ID65XTF3.js.map} +0 -0
  339. /package/dist/{chunk-WWQMZBDI.js.map → chunk-IJVU4ILJ.js.map} +0 -0
  340. /package/dist/{chunk-GBSXTTLP.js.map → chunk-ITGAGNX5.js.map} +0 -0
  341. /package/dist/{chunk-3PNJZTDV.js.map → chunk-JGGNUEVD.js.map} +0 -0
  342. /package/dist/{chunk-YYXYZM2I.js.map → chunk-JN7OSQJR.js.map} +0 -0
  343. /package/dist/{chunk-4D2EY4WM.js.map → chunk-K2DTHNDY.js.map} +0 -0
  344. /package/dist/{chunk-TH6OYP6I.js.map → chunk-K36RMINQ.js.map} +0 -0
  345. /package/dist/{chunk-OZKVVUJB.js.map → chunk-KIM5VNZN.js.map} +0 -0
  346. /package/dist/{chunk-ZWDDY4WF.js.map → chunk-M7CFCRWJ.js.map} +0 -0
  347. /package/dist/{chunk-QPFM6DHY.js.map → chunk-MTJFK42O.js.map} +0 -0
  348. /package/dist/{chunk-RO5EGRAI.js.map → chunk-N3FRR6II.js.map} +0 -0
  349. /package/dist/{chunk-UMEUU66X.js.map → chunk-O3OEVYUR.js.map} +0 -0
  350. /package/dist/{chunk-J74YOBB3.js.map → chunk-PFR6ZKQI.js.map} +0 -0
  351. /package/dist/{chunk-TAD6QMMD.js.map → chunk-PRC7SZYM.js.map} +0 -0
  352. /package/dist/{chunk-GMO3BGOF.js.map → chunk-QC2MHZDD.js.map} +0 -0
  353. /package/dist/{chunk-2MWKUVHT.js.map → chunk-RK7SE3BL.js.map} +0 -0
  354. /package/dist/{chunk-HDWISXFH.js.map → chunk-RVAPK2S7.js.map} +0 -0
  355. /package/dist/{chunk-5PUZV73Z.js.map → chunk-SEIGLG62.js.map} +0 -0
  356. /package/dist/{chunk-AVWOULJH.js.map → chunk-SH3GOZWK.js.map} +0 -0
  357. /package/dist/{chunk-PFLN6TTW.js.map → chunk-T3MCVSUC.js.map} +0 -0
  358. /package/dist/{chunk-WQUGCOKF.js.map → chunk-TFA6HPOA.js.map} +0 -0
  359. /package/dist/{chunk-CLVILSBR.js.map → chunk-TGQW3AMK.js.map} +0 -0
  360. /package/dist/{chunk-YZYAYUJQ.js.map → chunk-TLRIRISJ.js.map} +0 -0
  361. /package/dist/{chunk-7VIJUZYW.js.map → chunk-TQ4CELUR.js.map} +0 -0
  362. /package/dist/{chunk-5QDTZIGH.js.map → chunk-U7KP6QFU.js.map} +0 -0
  363. /package/dist/{chunk-QVXEXGIM.js.map → chunk-VF6SC4OD.js.map} +0 -0
  364. /package/dist/{chunk-EZG54YDS.js.map → chunk-VKXJQF5C.js.map} +0 -0
  365. /package/dist/{chunk-RFLC6PKQ.js.map → chunk-VMRPLHEU.js.map} +0 -0
  366. /package/dist/{chunk-U2PSE7MB.js.map → chunk-VPEIWMUT.js.map} +0 -0
  367. /package/dist/{chunk-X67XNZ64.js.map → chunk-W4EJMMPP.js.map} +0 -0
  368. /package/dist/{chunk-RB7NXZ2E.js.map → chunk-W4Q65VJL.js.map} +0 -0
  369. /package/dist/{chunk-HDDRVXX4.js.map → chunk-W5LJ3SJ7.js.map} +0 -0
  370. /package/dist/{chunk-W7N7NWG5.js.map → chunk-WCJQ3OUP.js.map} +0 -0
  371. /package/dist/{chunk-UVYI6VIX.js.map → chunk-X7Y7WX73.js.map} +0 -0
  372. /package/dist/{chunk-22V3CMIW.js.map → chunk-XJTRIHTH.js.map} +0 -0
  373. /package/dist/{chunk-SIONKXLU.js.map → chunk-XTRC6SSS.js.map} +0 -0
  374. /package/dist/{chunk-SBRUTD5O.js.map → chunk-YSATDEBY.js.map} +0 -0
  375. /package/dist/{chunk-3YOX2BQD.js.map → chunk-YWMCV5HL.js.map} +0 -0
  376. /package/dist/{chunk-6QWFZ3X5.js.map → chunk-ZA6CYFAK.js.map} +0 -0
@@ -11,6 +11,7 @@ import { parseConfig } from "./config.js";
11
11
  import { initLogger, resetLogger } from "./logger.js";
12
12
  import { HourlySummarizer } from "./summarizer.js";
13
13
  import type { LocalLlmChatCompletionOptions } from "./local-llm-helpers.js";
14
+ import type { LocalLlmClient } from "./local-llm.js";
14
15
  import type { TranscriptEntry } from "./types.js";
15
16
 
16
17
  function createConfig(memoryDir: string, extended = false) {
@@ -34,11 +35,9 @@ interface LlmStub {
34
35
  calls: { signal: AbortSignal | undefined }[];
35
36
  }
36
37
 
37
- function stubLocalLlm(summarizer: HourlySummarizer, stub: LlmStub): void {
38
- // SAFETY: localLlm is a private field, stubbed at the established field
39
- // seam with the client's real call shape; the stub parks until its caller
40
- // signal aborts (real transport behavior), mirroring a wedged local LLM.
41
- (summarizer as any).localLlm = {
38
+
39
+ function parkingChatCompletionStub(stub: LlmStub): Pick<LocalLlmClient, "chatCompletion"> {
40
+ return {
42
41
  chatCompletion: async (
43
42
  messages: Array<{ role: string; content: string }>,
44
43
  options: LocalLlmChatCompletionOptions,
@@ -98,8 +97,8 @@ test("aborting the shutdown signal aborts an in-flight generateSummary and reach
98
97
  undefined,
99
98
  undefined,
100
99
  controller.signal,
100
+ { localLlm: parkingChatCompletionStub(stub) },
101
101
  );
102
- stubLocalLlm(summarizer, stub);
103
102
 
104
103
  const hourStart = new Date(Date.now() - 3_600_000);
105
104
  hourStart.setMinutes(0, 0, 0);
@@ -135,8 +134,8 @@ test("an already-aborted summarizer refuses to start new work and never contacts
135
134
  undefined,
136
135
  undefined,
137
136
  controller.signal,
137
+ { localLlm: parkingChatCompletionStub(stub) },
138
138
  );
139
- stubLocalLlm(summarizer, stub);
140
139
 
141
140
  const hourStart = new Date(Date.now() - 3_600_000);
142
141
  hourStart.setMinutes(0, 0, 0);
@@ -150,6 +149,40 @@ test("an already-aborted summarizer refuses to start new work and never contacts
150
149
  }
151
150
  });
152
151
 
152
+
153
+ test("an injected local LLM stub receives the summary call through the constructor seam", async () => {
154
+ quietLogger();
155
+ const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-summary-seam-"));
156
+ const stub: LlmStub = { calls: [] };
157
+ try {
158
+ const controller = new AbortController();
159
+ const summarizer = new HourlySummarizer(
160
+ createConfig(memoryDir),
161
+ undefined,
162
+ undefined,
163
+ undefined,
164
+ controller.signal,
165
+ { localLlm: parkingChatCompletionStub(stub) },
166
+ );
167
+
168
+ const hourStart = new Date(Date.now() - 3_600_000);
169
+ hourStart.setMinutes(0, 0, 0);
170
+ const pending = summarizer.generateSummary("sess-summary-seam", hourStart, entriesFor());
171
+ await withTestDeadline((async () => {
172
+ while (stub.calls.length === 0) {
173
+ await new Promise((resolve) => setTimeout(resolve, 10));
174
+ }
175
+ })(), 5_000, "injected LLM stub to be entered");
176
+ controller.abort();
177
+ assert.equal(await withTestDeadline(pending, 2_000, "in-flight summarizer abort"), null);
178
+ assert.equal(stub.calls.length, 1);
179
+ assert.equal(stub.calls[0]?.signal?.aborted, true);
180
+ } finally {
181
+ resetLogger();
182
+ await rm(memoryDir, { recursive: true, force: true });
183
+ }
184
+ });
185
+
153
186
  for (const extended of [false, true]) {
154
187
  test(`a shutdown abort during the local call does not start a gateway call (${extended ? "extended" : "standard"} summary)`, async () => {
155
188
  quietLogger();
@@ -164,16 +197,16 @@ for (const extended of [false, true]) {
164
197
  undefined,
165
198
  undefined,
166
199
  controller.signal,
167
- );
168
- stubLocalLlm(summarizer, stub);
169
- // SAFETY: fallbackLlm is a private field, stubbed at the same field seam
170
- // as localLlm; the stub counts gateway calls and returns no result.
171
- (summarizer as any).fallbackLlm = {
172
- parseWithSchema: async (): Promise<null> => {
173
- gatewayCalls += 1;
174
- return null;
200
+ {
201
+ localLlm: parkingChatCompletionStub(stub),
202
+ fallbackLlm: {
203
+ parseWithSchema: async (): Promise<null> => {
204
+ gatewayCalls += 1;
205
+ return null;
206
+ },
207
+ },
175
208
  },
176
- };
209
+ );
177
210
 
178
211
  const hourStart = new Date(Date.now() - 3_600_000);
179
212
  hourStart.setMinutes(0, 0, 0);
package/src/summarizer.ts CHANGED
@@ -107,11 +107,16 @@ export function summarizeHourlyStatus(stats: HourlySummarizerRunStats): {
107
107
  };
108
108
  }
109
109
 
110
+ export type HourlySummarizerLlmClients = {
111
+ localLlm?: Pick<LocalLlmClient, "chatCompletion">;
112
+ fallbackLlm?: Pick<FallbackLlmClient, "parseWithSchema">;
113
+ };
114
+
110
115
  export class HourlySummarizer {
111
116
  private summariesDir: string;
112
117
  private config: PluginConfig;
113
- private localLlm: LocalLlmClient;
114
- private fallbackLlm: FallbackLlmClient;
118
+ private localLlm: Pick<LocalLlmClient, "chatCompletion">;
119
+ private fallbackLlm: Pick<FallbackLlmClient, "parseWithSchema">;
115
120
  private modelRegistry: ModelRegistry;
116
121
  private transcript?: TranscriptManager;
117
122
  /** Orchestrator-owned stop signal: refuses new summaries and aborts the
@@ -123,7 +128,8 @@ export class HourlySummarizer {
123
128
  gatewayConfig?: GatewayConfig,
124
129
  modelRegistry?: ModelRegistry,
125
130
  transcript?: TranscriptManager,
126
- shutdownSignal?: AbortSignal
131
+ shutdownSignal?: AbortSignal,
132
+ llmClients?: HourlySummarizerLlmClients
127
133
  ) {
128
134
  this.config = config;
129
135
  this.summariesDir = path.join(config.memoryDir, "summaries", "hourly");
@@ -132,10 +138,12 @@ export class HourlySummarizer {
132
138
  this.shutdownSignal = shutdownSignal;
133
139
 
134
140
  // Initialize local LLM client with shared model registry
135
- this.localLlm = new LocalLlmClient(config, this.modelRegistry, shutdownSignal);
141
+ this.localLlm = llmClients?.localLlm ?? new LocalLlmClient(config, this.modelRegistry, shutdownSignal);
136
142
 
137
143
  // Initialize fallback client with gateway config
138
- this.fallbackLlm = new FallbackLlmClient(gatewayConfig, fallbackLlmRuntimeContextFromConfig(config));
144
+ this.fallbackLlm =
145
+ llmClients?.fallbackLlm ??
146
+ new FallbackLlmClient(gatewayConfig, fallbackLlmRuntimeContextFromConfig(config));
139
147
 
140
148
  if (
141
149
  !gatewayConfig?.agents?.defaults?.model?.primary &&
@@ -0,0 +1,293 @@
1
+ /**
2
+ * Operator memory-maintenance subject for the scenario-matrix harness
3
+ * (issue #3642).
4
+ *
5
+ * Every canonical row exercises the three maintenance surfaces that matched
6
+ * the `maintenance/**` lifecycle glob but had no registered subject:
7
+ *
8
+ * - `forgetMemory` (maintenance/forget.ts): soft-deletes a fact memory —
9
+ * frontmatter status flip plus the live tombstone that blocks
10
+ * re-extraction resurrection.
11
+ * - `ensureCronJob` (maintenance/memory-governance-cron.ts): idempotent
12
+ * registration of a governance job inside jobs.json, including the
13
+ * updateExisting merge path.
14
+ * - `summarizeTiers` / `explainTierForMemory` (maintenance/tier-stats.ts):
15
+ * tier/status accounting over the same memories the forget mutated.
16
+ *
17
+ * Dimension mapping:
18
+ * - remembered-binding rows pre-seed jobs.json with the job already
19
+ * registered under a stale schedule — the binding a restarted process
20
+ * would find on disk.
21
+ * - the provider-rebinding row additionally drives `updateExisting` with a
22
+ * changed schedule and asserts the merge reports `updated: true`.
23
+ * - the dedupe/replay row re-runs `ensureCronJob` and `forgetMemory` and
24
+ * asserts both are idempotent: no second job, an AlreadyForgotten
25
+ * rejection, and byte-identical jobs.json.
26
+ * - the restart/reload row rebuilds the storage facade and re-parses
27
+ * jobs.json from disk — nothing may be lost across a process boundary.
28
+ * - flush-transition rows keep the same contract: these surfaces are
29
+ * write-through (no buffered flush exists), so on-disk state must be
30
+ * complete and readable the moment each call resolves.
31
+ */
32
+ import assert from "node:assert/strict";
33
+ import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
34
+ import os from "node:os";
35
+ import path from "node:path";
36
+
37
+ import {
38
+ forgetMemory,
39
+ ForgetMemoryAlreadyForgottenError,
40
+ type ForgetMemoryResult,
41
+ } from "../../maintenance/forget.js";
42
+ import { ensureCronJob } from "../../maintenance/memory-governance-cron.js";
43
+ import {
44
+ explainTierForMemory,
45
+ summarizeTiers,
46
+ type TierExplainResult,
47
+ type TierSummary,
48
+ } from "../../maintenance/tier-stats.js";
49
+ import type { StorageManager } from "../../storage.js";
50
+ import type { MemoryFile, MemoryFrontmatter, PluginConfig } from "../../types.js";
51
+ import { type LifecycleSubject, runLifecycleMatrix } from "../lifecycle-matrix.js";
52
+
53
+ const NOW = "2026-06-01T00:00:00.000Z";
54
+ const CRON_ID = "engram-subject-nightly";
55
+ const FORGET_ID = "fact-alpha";
56
+ const LEGACY_SCHEDULE = "0 2 * * *";
57
+ const CURRENT_SCHEDULE = "0 3 * * *";
58
+
59
+ interface EnsureResult {
60
+ created: boolean;
61
+ updated: boolean;
62
+ jobId: string;
63
+ }
64
+
65
+ interface MaintenanceState {
66
+ dir: string;
67
+ jobsPath: string;
68
+ hot: MemoryFile[];
69
+ archived: MemoryFile[];
70
+ cold: MemoryFile[];
71
+ frontmatterWrites: Array<{ id: string; patch: Partial<MemoryFrontmatter> }>;
72
+ tombstones: unknown[];
73
+ ensureFirst: EnsureResult | null;
74
+ ensureReplay: EnsureResult | null;
75
+ forgetResult: ForgetMemoryResult | null;
76
+ summary: TierSummary | null;
77
+ reloadedJobs: string | null;
78
+ reloadedSummary: TierSummary | null;
79
+ explain: TierExplainResult | null;
80
+ jobsJsonAfterFirst: string | null;
81
+ }
82
+
83
+ function makeMemory(id: string, overrides: Partial<MemoryFrontmatter> = {}): MemoryFile {
84
+ // SAFETY: the fixture literal fills exactly the fields the maintenance
85
+ // paths read; MemoryFrontmatter carries optional slots the fixture omits.
86
+ return {
87
+ path: `/virtual/${id}.md`,
88
+ content: `synthetic body for ${id}`,
89
+ frontmatter: {
90
+ id,
91
+ category: "preference",
92
+ created: "2026-01-01T00:00:00.000Z",
93
+ updated: "2026-01-01T00:00:00.000Z",
94
+ source: "test",
95
+ ...overrides,
96
+ } as MemoryFrontmatter,
97
+ };
98
+ }
99
+
100
+ function makeStorage(state: MaintenanceState): StorageManager {
101
+ const stub: Partial<StorageManager> = {
102
+ readAllMemories: async () => state.hot,
103
+ readArchivedMemories: async () => state.archived,
104
+ readAllColdMemories: async () => state.cold,
105
+ writeMemoryFrontmatter: async (memory, patch) => {
106
+ Object.assign(memory.frontmatter, patch);
107
+ state.frontmatterWrites.push({ id: memory.frontmatter.id, patch });
108
+ return true;
109
+ },
110
+ appendTombstone: async (input) => {
111
+ state.tombstones.push(input);
112
+ return "stub-tombstone";
113
+ },
114
+ };
115
+ // SAFETY: the test double exposes only the StorageManager methods the three
116
+ // maintenance surfaces call; a full StorageManager needs a real memory dir.
117
+ return stub as StorageManager;
118
+ }
119
+
120
+ function makeConfig(memoryDir: string): PluginConfig {
121
+ const config: Partial<PluginConfig> = {
122
+ memoryDir,
123
+ qmdTierMigrationEnabled: true,
124
+ qmdTierDemotionMinAgeDays: 14,
125
+ qmdTierDemotionValueThreshold: 0.35,
126
+ qmdTierPromotionValueThreshold: 0.7,
127
+ memoryUtilityLearningEnabled: false,
128
+ promotionByOutcomeEnabled: false,
129
+ lifecyclePolicyEnabled: false,
130
+ lifecycleStaleDecayThreshold: 0,
131
+ lifecyclePromoteHeatThreshold: 0,
132
+ };
133
+ // SAFETY: same reduced-config shape tier-stats.test.ts uses; the learning
134
+ // flags stay off so explainTierForMemory takes the null-runtime path.
135
+ return config as PluginConfig;
136
+ }
137
+
138
+ function buildJob() {
139
+ return {
140
+ id: CRON_ID,
141
+ schedule: CURRENT_SCHEDULE,
142
+ enabled: true,
143
+ payload: { kind: "nightly-governance" },
144
+ };
145
+ }
146
+
147
+ async function readJobIds(jobsPath: string): Promise<string[]> {
148
+ // SAFETY: jobs.json is written by this fixture's own ensureCronJob calls;
149
+ // the {jobs:[{id}]} shape is the file contract exercised under test.
150
+ const parsed = JSON.parse(await readFile(jobsPath, "utf8")) as { jobs: Array<{ id?: unknown }> };
151
+ return parsed.jobs.map((job) => String(job.id));
152
+ }
153
+
154
+ const subject: LifecycleSubject<MaintenanceState> = {
155
+ async setup(row) {
156
+ const dir = await mkdtemp(path.join(os.tmpdir(), "remnic-memory-maintenance-"));
157
+ const jobsPath = path.join(dir, "jobs.json");
158
+ try {
159
+ // remembered-binding rows model an earlier process having already
160
+ // registered the job under a stale schedule.
161
+ const seeded = row.dimensions.rememberedBinding
162
+ ? { jobs: [{ ...buildJob(), schedule: LEGACY_SCHEDULE }] }
163
+ : { jobs: [] };
164
+ await writeFile(jobsPath, JSON.stringify(seeded, null, 2) + "\n", "utf8");
165
+ } catch (err) {
166
+ await rm(dir, { recursive: true, force: true });
167
+ throw err;
168
+ }
169
+ return {
170
+ dir,
171
+ jobsPath,
172
+ hot: [
173
+ makeMemory(FORGET_ID, {
174
+ category: "fact",
175
+ status: "active",
176
+ contentHash: "hash-fact-alpha",
177
+ }),
178
+ makeMemory("pref-beta", { status: "active" }),
179
+ ],
180
+ archived: [],
181
+ cold: [makeMemory("cold-gamma", { status: "archived" })],
182
+ frontmatterWrites: [],
183
+ tombstones: [],
184
+ ensureFirst: null,
185
+ ensureReplay: null,
186
+ forgetResult: null,
187
+ summary: null,
188
+ reloadedJobs: null,
189
+ reloadedSummary: null,
190
+ explain: null,
191
+ jobsJsonAfterFirst: null,
192
+ };
193
+ },
194
+
195
+ async exercise(state, row) {
196
+ const storage = makeStorage(state);
197
+ const rebound = row.dimensions.providerIdentity === "rebound";
198
+ const options = rebound
199
+ ? { updateExisting: true, updateFields: ["schedule", "payload"] }
200
+ : {};
201
+
202
+ state.ensureFirst = await ensureCronJob(state.jobsPath, CRON_ID, buildJob, options);
203
+ state.forgetResult = await forgetMemory(storage, {
204
+ id: FORGET_ID,
205
+ reason: "matrix forget",
206
+ now: () => new Date(NOW),
207
+ });
208
+ state.summary = await summarizeTiers(storage);
209
+ state.explain = await explainTierForMemory(storage, FORGET_ID, makeConfig(state.dir));
210
+
211
+ if (row.dimensions.dedupeOrReplay) {
212
+ state.jobsJsonAfterFirst = await readFile(state.jobsPath, "utf8");
213
+ state.ensureReplay = await ensureCronJob(state.jobsPath, CRON_ID, buildJob, options);
214
+ await assert.rejects(
215
+ forgetMemory(storage, { id: FORGET_ID, now: () => new Date(NOW) }),
216
+ ForgetMemoryAlreadyForgottenError,
217
+ );
218
+ }
219
+
220
+ if (row.dimensions.restart) {
221
+ // A restarted process sees only what is on disk: re-parse jobs.json and
222
+ // rebuild the storage facade over the same persisted memory records.
223
+ state.reloadedJobs = await readFile(state.jobsPath, "utf8");
224
+ state.reloadedSummary = await summarizeTiers(makeStorage(state));
225
+ }
226
+ },
227
+
228
+ async invariants(state, row) {
229
+ const seeded = row.dimensions.rememberedBinding;
230
+ const rebound = row.dimensions.providerIdentity === "rebound";
231
+
232
+ const first = state.ensureFirst;
233
+ assert.ok(first, "ensureCronJob returned a result");
234
+ assert.equal(first.jobId, CRON_ID);
235
+ assert.equal(first.created, !seeded, "job is created only when no binding was seeded");
236
+ assert.equal(first.updated, rebound, "only the rebinding row rewrites the seeded job");
237
+
238
+ const jobIds = await readJobIds(state.jobsPath);
239
+ assert.deepEqual(jobIds, [CRON_ID], "jobs.json holds exactly one registration");
240
+
241
+ const forget = state.forgetResult;
242
+ assert.ok(forget, "forgetMemory returned a result");
243
+ assert.equal(forget.id, FORGET_ID);
244
+ assert.equal(forget.priorStatus, "active");
245
+ assert.equal(forget.forgottenAt, NOW);
246
+ assert.equal(forget.reason, "matrix forget");
247
+
248
+ const forgotten = state.hot.find((m) => m.frontmatter.id === FORGET_ID);
249
+ assert.equal(forgotten?.frontmatter.status, "forgotten");
250
+ assert.equal(forgotten?.frontmatter.forgottenAt, NOW);
251
+ assert.equal(forgotten?.frontmatter.forgottenReason, "matrix forget");
252
+ assert.ok(state.tombstones.length >= 1, "fact forget emits a live tombstone");
253
+
254
+ const summary = state.summary;
255
+ assert.ok(summary, "summarizeTiers returned a summary");
256
+ assert.equal(summary.total, 3);
257
+ assert.equal(summary.byTier.hot, 2);
258
+ assert.equal(summary.byTier.cold, 1);
259
+ assert.equal(summary.byStatus.forgotten, 1);
260
+ assert.equal(summary.forgottenCount, 1);
261
+
262
+ const explain = state.explain;
263
+ assert.ok(explain, "explainTierForMemory returned a result");
264
+ assert.equal(explain.id, FORGET_ID);
265
+ assert.equal(explain.currentTier, "hot");
266
+ assert.equal(explain.status, "forgotten");
267
+ assert.ok(Number.isFinite(explain.valueScore), "value score computed");
268
+ assert.ok(explain.decision, "tier transition decision present");
269
+
270
+ if (row.dimensions.dedupeOrReplay) {
271
+ const replay = state.ensureReplay;
272
+ assert.ok(replay, "replay ensureCronJob returned a result");
273
+ assert.equal(replay.created, false, "replay must not create a second job");
274
+ assert.equal(replay.updated, false, "replay with identical spec must not rewrite");
275
+ const jobsJsonNow = await readFile(state.jobsPath, "utf8");
276
+ assert.equal(jobsJsonNow, state.jobsJsonAfterFirst, "replay leaves jobs.json byte-identical");
277
+ }
278
+
279
+ if (row.dimensions.restart) {
280
+ // SAFETY: reloadedJobs was read from a jobs.json produced by this
281
+ // fixture's ensureCronJob call in the same row.
282
+ const parsed = JSON.parse(state.reloadedJobs ?? "") as { jobs: Array<{ id?: unknown }> };
283
+ assert.deepEqual(parsed.jobs.map((job) => String(job.id)), [CRON_ID]);
284
+ assert.equal(state.reloadedSummary?.forgottenCount, 1, "forgotten status survives a reload");
285
+ }
286
+ },
287
+
288
+ async teardown(state) {
289
+ await rm(state.dir, { recursive: true, force: true });
290
+ },
291
+ };
292
+
293
+ runLifecycleMatrix("memory-maintenance", subject);
@@ -499,7 +499,8 @@ function shouldInclude(
499
499
  *
500
500
  * Defaults (chosen to be safe + least-surprising):
501
501
  * - `version` — `0.1.0` (capsule authors override per release).
502
- * - `schemaVersion` — `taxonomy-v1` until the taxonomy registry stabilizes.
502
+ * - `schemaVersion` — `taxonomy-v1` (the only member of
503
+ * {@link CAPSULE_TAXONOMY_VERSIONS}; see issue 3572).
503
504
  * - `parentCapsule` — `null` (explicit "no parent" sentinel).
504
505
  * - `description` — empty string. Capsule authors override.
505
506
  * - `retrievalPolicy` — empty `tierWeights` map + `directAnswerEnabled: false`.
@@ -0,0 +1,70 @@
1
+ /**
2
+ * CapsuleTaxonomySchema schemaVersion registry — issue 3572.
3
+ *
4
+ * CapsuleBlockSchema accepted any non-empty string as the capsule's taxonomy
5
+ * schemaVersion (the "free-form placeholder" hack). These tests pin the
6
+ * contract: only taxonomy versions in the known registry parse, unknown ones
7
+ * are refused with a message naming the known versions, and export with an
8
+ * unknown override fails the same way.
9
+ */
10
+
11
+ import assert from "node:assert/strict";
12
+ import test from "node:test";
13
+
14
+ import { makeTempDir } from "../testing/tmp-dir.js";
15
+ import { exportCapsule } from "./capsule-export.js";
16
+ import { CAPSULE_TAXONOMY_VERSIONS, CapsuleBlockSchema } from "./types.js";
17
+
18
+ function baseBlock() {
19
+ return {
20
+ id: "capsule-test",
21
+ version: "0.1.0",
22
+ schemaVersion: CAPSULE_TAXONOMY_VERSIONS[0],
23
+ parentCapsule: null,
24
+ parent: null,
25
+ description: "",
26
+ retrievalPolicy: { tierWeights: {}, directAnswerEnabled: false },
27
+ includes: {
28
+ taxonomy: false,
29
+ identityAnchors: false,
30
+ peerProfiles: false,
31
+ procedural: false,
32
+ },
33
+ };
34
+ }
35
+
36
+ test("known taxonomy versions parse", () => {
37
+ for (const v of CAPSULE_TAXONOMY_VERSIONS) {
38
+ const parsed = CapsuleBlockSchema.parse({ ...baseBlock(), schemaVersion: v });
39
+ assert.equal(parsed.schemaVersion, v);
40
+ }
41
+ });
42
+
43
+ test("unknown taxonomy versions are refused, naming the registry", () => {
44
+ const result = CapsuleBlockSchema.safeParse({ ...baseBlock(), schemaVersion: "taxonomy-v9" });
45
+ assert.equal(result.success, false);
46
+ if (!result.success) {
47
+ assert.match(result.error.issues[0].message, /taxonomy-v1/);
48
+ }
49
+ // Empty string stays refused too.
50
+ assert.equal(CapsuleBlockSchema.safeParse({ ...baseBlock(), schemaVersion: "" }).success, false);
51
+ });
52
+
53
+ test("export refuses an unknown schemaVersion override", async () => {
54
+ const root = await makeTempDir("cap-taxonomy-root-");
55
+ const outDir = await makeTempDir("cap-taxonomy-out-");
56
+ await assert.rejects(
57
+ exportCapsule({
58
+ name: "taxonomy-refusal-capsule",
59
+ root,
60
+ outDir,
61
+ pluginVersion: "0.0.0-test",
62
+ now: 1_700_000_000_000,
63
+ // SAFETY: the invalid literal is the point of this test; the cast
64
+ // defeats the enum's compile-time narrowing so safeParse can reject
65
+ // "taxonomy-v9" at runtime.
66
+ capsule: { schemaVersion: "taxonomy-v9" as "taxonomy-v1" },
67
+ }),
68
+ /taxonomy-v1/,
69
+ );
70
+ });
@@ -142,14 +142,24 @@ export const CapsuleParentSchema = z.object({
142
142
 
143
143
  export type CapsuleParent = z.infer<typeof CapsuleParentSchema>;
144
144
 
145
+ /**
146
+ * Known taxonomy schema versions a capsule may be authored against
147
+ * (issue 3572). Exporters must emit one of these; importers refuse anything
148
+ * else instead of silently accepting a version they cannot interpret.
149
+ */
150
+ export const CAPSULE_TAXONOMY_VERSIONS = ["taxonomy-v1"] as const;
151
+
145
152
  export const CapsuleBlockSchema = z.object({
146
153
  id: CapsuleIdSchema,
147
154
  version: SemverLikeSchema,
148
155
  /**
149
- * Taxonomy schema version the capsule was authored against. Free-form for
150
- * now; later PRs may tighten this to a known taxonomy registry.
156
+ * Taxonomy schema version the capsule was authored against. Must be a
157
+ * member of {@link CAPSULE_TAXONOMY_VERSIONS}; the error names the known
158
+ * versions so writers can pick one.
151
159
  */
152
- schemaVersion: z.string().min(1, "capsule.schemaVersion must not be empty"),
160
+ schemaVersion: z.enum(CAPSULE_TAXONOMY_VERSIONS, {
161
+ message: `capsule.schemaVersion must be one of: ${CAPSULE_TAXONOMY_VERSIONS.join(", ")}`,
162
+ }),
153
163
  /**
154
164
  * Optional reference to the parent capsule this one was forked or derived
155
165
  * from. `null` (not `undefined`) is the explicit "no parent" sentinel so