@remnic/core 10.0.167 → 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.
- package/dist/access-admin-ops-surface.js +139 -138
- package/dist/access-cli.js +139 -138
- package/dist/access-cli.js.map +1 -1
- package/dist/access-coding-context-resolution.js +11 -11
- package/dist/access-extraction-force-flush-preempt.js +139 -138
- package/dist/access-extraction-force-flush.js +139 -138
- package/dist/access-http-briefing.js +139 -138
- package/dist/access-http-query.js +139 -138
- package/dist/access-http.js +139 -138
- package/dist/access-identity-continuity-surface.js +139 -138
- package/dist/access-lcm-surface.js +139 -138
- package/dist/access-mcp.js +139 -138
- package/dist/access-observe-write-category.js +11 -11
- package/dist/access-observe-write-surface.js +139 -138
- package/dist/access-offline-manifest.js +9 -9
- package/dist/access-operations-batch.js +139 -138
- package/dist/access-operations.js +139 -138
- package/dist/access-recall-concurrency.js +139 -138
- package/dist/access-recall-excerpt-attribution.d.ts +19 -0
- package/dist/access-recall-excerpt-attribution.d.ts.map +1 -0
- package/dist/access-recall-excerpt-attribution.js +8 -0
- package/dist/access-recall-response.js +139 -138
- package/dist/access-recall-surface.d.ts.map +1 -1
- package/dist/access-recall-surface.js +139 -138
- package/dist/access-schema.js +10 -10
- package/dist/access-service.js +139 -138
- package/dist/active-recall.js +24 -24
- package/dist/adapters/index.js +4 -4
- package/dist/adapters/registry.js +2 -2
- package/dist/{auto-sync-L3M4RKJD.js → auto-sync-ACP5U5A3.js} +3 -3
- package/dist/binary-lifecycle/scanner.d.ts +2 -4
- package/dist/binary-lifecycle/scanner.d.ts.map +1 -1
- package/dist/briefing.js +13 -13
- package/dist/buffer-add-turns-bounded.d.ts +11 -1
- package/dist/buffer-add-turns-bounded.d.ts.map +1 -1
- package/dist/buffer-add-turns-bounded.js +3 -3
- package/dist/buffer-session-cap.d.ts +2 -2
- package/dist/buffer-session-cap.d.ts.map +1 -1
- package/dist/buffer-session-cap.js +1 -1
- package/dist/buffer.d.ts +3 -2
- package/dist/buffer.d.ts.map +1 -1
- package/dist/buffer.js +12 -12
- package/dist/bulk-import/index.d.ts +1 -1
- package/dist/bulk-import/index.d.ts.map +1 -1
- package/dist/bulk-import/index.js +3 -1
- package/dist/bulk-import/pipeline.d.ts +8 -0
- package/dist/bulk-import/pipeline.d.ts.map +1 -1
- package/dist/calibration.d.ts +19 -2
- package/dist/calibration.d.ts.map +1 -1
- package/dist/calibration.js +28 -5
- package/dist/calibration.js.map +1 -1
- package/dist/{capsule-crypto-GWVG7LGC.js → capsule-crypto-7FJQINUR.js} +2 -2
- package/dist/{capsule-merge-VHBRF65A.js → capsule-merge-BADOICNP.js} +2 -2
- package/dist/causal-behavior.js +2 -2
- package/dist/causal-chain.js +2 -2
- package/dist/causal-consolidation.js +17 -17
- package/dist/causal-retrieval.js +2 -2
- package/dist/causal-trajectory-graph.js +3 -3
- package/dist/causal-trajectory.js +1 -1
- package/dist/{chunk-OWHERGF2.js → chunk-2NLLXCJG.js} +2 -2
- package/dist/{chunk-IE2ZLO3R.js → chunk-32OTLNAU.js} +274 -248
- package/dist/chunk-32OTLNAU.js.map +1 -0
- package/dist/{chunk-L7SEYUHS.js → chunk-3I3NXB6X.js} +3 -3
- package/dist/{chunk-4NBUHYUV.js → chunk-3LADDLAF.js} +5 -5
- package/dist/{chunk-2DL3OFLD.js → chunk-45GEJRIG.js} +2 -2
- package/dist/{chunk-HSSERO3E.js → chunk-4P4GF76E.js} +8 -1
- package/dist/chunk-4P4GF76E.js.map +1 -0
- package/dist/{chunk-5BE3FLKL.js → chunk-5KDDAQ6K.js} +8 -8
- package/dist/{chunk-BPCR5DZP.js → chunk-62YZOQFR.js} +5 -5
- package/dist/chunk-62YZOQFR.js.map +1 -0
- package/dist/{chunk-HLWXCDUQ.js → chunk-63A2BU2B.js} +5 -5
- package/dist/{chunk-C5QYWM6F.js → chunk-7FPI5MFB.js} +5 -5
- package/dist/{chunk-ZX546Y3Y.js → chunk-7OYDFIL4.js} +2 -2
- package/dist/{chunk-CKZWLAHN.js → chunk-ACPFBVUD.js} +2 -2
- package/dist/{chunk-BKTCVXMK.js → chunk-AHOYKJ5X.js} +3 -3
- package/dist/{chunk-WEHSQBFR.js → chunk-AIF6V2OX.js} +9 -4
- package/dist/chunk-AIF6V2OX.js.map +1 -0
- package/dist/{chunk-FGT7CUYZ.js → chunk-ALTLOHO7.js} +2 -2
- package/dist/{chunk-FMFCQRDM.js → chunk-AUFPPBC3.js} +3 -3
- package/dist/{chunk-OAQRZ4SV.js → chunk-B5KTTWC7.js} +2 -2
- package/dist/{chunk-73TPOGS4.js → chunk-BFBS7OFQ.js} +9 -9
- package/dist/{chunk-QFTK6EDM.js → chunk-BFZFNXOC.js} +13 -13
- package/dist/{chunk-ZQUOUPP3.js → chunk-BHRPZBAH.js} +4 -4
- package/dist/{chunk-4L25GAYL.js → chunk-CX24SVLK.js} +2 -2
- package/dist/{chunk-YY57TRKN.js → chunk-D5ZLTLHF.js} +2 -2
- package/dist/{chunk-WEFFO2MJ.js → chunk-D6YCETHG.js} +2 -2
- package/dist/{chunk-ZDZJNXL6.js → chunk-DK2VBJ6Q.js} +4 -4
- package/dist/{chunk-VRHY7Y5A.js → chunk-DPL5VO5V.js} +3 -3
- package/dist/{chunk-LVGTH6IQ.js → chunk-E7ATID4Z.js} +11 -11
- package/dist/{chunk-CKELO7Q6.js → chunk-FHWX2REL.js} +2 -2
- package/dist/{chunk-CUPILBIP.js → chunk-FMIM36I4.js} +2 -2
- package/dist/{chunk-OWM2VWNX.js → chunk-FSXYBIEZ.js} +25 -24
- package/dist/chunk-FSXYBIEZ.js.map +1 -0
- package/dist/{chunk-A5UOREWD.js → chunk-FWTGO4NE.js} +2 -2
- package/dist/{chunk-3SL52JKD.js → chunk-FZVROZKC.js} +5 -5
- package/dist/{chunk-U3BCW7GX.js → chunk-G3RLCVJC.js} +3 -3
- package/dist/{chunk-UYIBNDQE.js → chunk-GF5NN3LE.js} +2 -2
- package/dist/{chunk-7OCKK5M5.js → chunk-GWY5ZFHP.js} +6 -6
- package/dist/{chunk-AL3TCNSJ.js → chunk-H3MLOQ7F.js} +24 -53
- package/dist/chunk-H3MLOQ7F.js.map +1 -0
- package/dist/{chunk-TNRGWJYT.js → chunk-H4IU24V5.js} +2 -2
- package/dist/{chunk-T4BT4FQN.js → chunk-HH6PXQ2B.js} +3 -3
- package/dist/{chunk-FEUWI5QH.js → chunk-HHPY5SSE.js} +2 -2
- package/dist/{chunk-OM5ESBES.js → chunk-HQPFACXO.js} +2 -2
- package/dist/{chunk-QLQUAVVP.js → chunk-I7WPLMUX.js} +16 -16
- package/dist/chunk-I7WPLMUX.js.map +1 -0
- package/dist/{chunk-IMULTENA.js → chunk-ID65XTF3.js} +2 -2
- package/dist/{chunk-WWQMZBDI.js → chunk-IJVU4ILJ.js} +4 -4
- package/dist/{chunk-GBSXTTLP.js → chunk-ITGAGNX5.js} +2 -2
- package/dist/chunk-IUGOGDCP.js +39 -0
- package/dist/chunk-IUGOGDCP.js.map +1 -0
- package/dist/{chunk-3PNJZTDV.js → chunk-JGGNUEVD.js} +2 -2
- package/dist/{chunk-YYXYZM2I.js → chunk-JN7OSQJR.js} +2 -2
- package/dist/{chunk-4D2EY4WM.js → chunk-K2DTHNDY.js} +6 -6
- package/dist/{chunk-TH6OYP6I.js → chunk-K36RMINQ.js} +3 -3
- package/dist/{chunk-OZKVVUJB.js → chunk-KIM5VNZN.js} +2 -2
- package/dist/{chunk-BFPQJNFZ.js → chunk-LXSDEPEK.js} +60 -11
- package/dist/{chunk-BFPQJNFZ.js.map → chunk-LXSDEPEK.js.map} +1 -1
- package/dist/{chunk-ZWDDY4WF.js → chunk-M7CFCRWJ.js} +2 -2
- package/dist/{chunk-QPFM6DHY.js → chunk-MTJFK42O.js} +2 -2
- package/dist/{chunk-RO5EGRAI.js → chunk-N3FRR6II.js} +2 -2
- package/dist/{chunk-UMEUU66X.js → chunk-O3OEVYUR.js} +2 -2
- package/dist/{chunk-J74YOBB3.js → chunk-PFR6ZKQI.js} +8 -8
- package/dist/{chunk-TAD6QMMD.js → chunk-PRC7SZYM.js} +2 -2
- package/dist/{chunk-LWZNSQN3.js → chunk-PUQQPLVV.js} +3 -3
- package/dist/{chunk-LWZNSQN3.js.map → chunk-PUQQPLVV.js.map} +1 -1
- package/dist/{chunk-GMO3BGOF.js → chunk-QC2MHZDD.js} +1 -1
- package/dist/{chunk-FOTFLHBN.js → chunk-QPLI7LUU.js} +3 -2
- package/dist/chunk-QPLI7LUU.js.map +1 -0
- package/dist/{chunk-2MWKUVHT.js → chunk-RK7SE3BL.js} +5 -5
- package/dist/{chunk-HDWISXFH.js → chunk-RVAPK2S7.js} +2 -2
- package/dist/{chunk-5PUZV73Z.js → chunk-SEIGLG62.js} +11 -11
- package/dist/{chunk-AVWOULJH.js → chunk-SH3GOZWK.js} +2 -2
- package/dist/{chunk-PFLN6TTW.js → chunk-T3MCVSUC.js} +2 -2
- package/dist/{chunk-WQUGCOKF.js → chunk-TFA6HPOA.js} +4 -4
- package/dist/{chunk-CLVILSBR.js → chunk-TGQW3AMK.js} +22 -22
- package/dist/{chunk-YZYAYUJQ.js → chunk-TLRIRISJ.js} +4 -4
- package/dist/{chunk-7VIJUZYW.js → chunk-TQ4CELUR.js} +3 -3
- package/dist/{chunk-5QDTZIGH.js → chunk-U7KP6QFU.js} +2 -2
- package/dist/{chunk-BUKK5SWA.js → chunk-UPD5XDJX.js} +5 -5
- package/dist/{chunk-BUKK5SWA.js.map → chunk-UPD5XDJX.js.map} +1 -1
- package/dist/{chunk-QVXEXGIM.js → chunk-VF6SC4OD.js} +2 -2
- package/dist/{chunk-EZG54YDS.js → chunk-VKXJQF5C.js} +2 -2
- package/dist/{chunk-RFLC6PKQ.js → chunk-VMRPLHEU.js} +2 -2
- package/dist/{chunk-U2PSE7MB.js → chunk-VPEIWMUT.js} +2 -2
- package/dist/{chunk-X67XNZ64.js → chunk-W4EJMMPP.js} +10 -10
- package/dist/{chunk-RB7NXZ2E.js → chunk-W4Q65VJL.js} +2 -2
- package/dist/{chunk-HDDRVXX4.js → chunk-W5LJ3SJ7.js} +2 -2
- package/dist/{chunk-W7N7NWG5.js → chunk-WCJQ3OUP.js} +2 -2
- package/dist/{chunk-JIF22AXI.js → chunk-WGKIXNLY.js} +5 -2
- package/dist/{chunk-JIF22AXI.js.map → chunk-WGKIXNLY.js.map} +1 -1
- package/dist/{chunk-FFWFFAP3.js → chunk-WI2WTIMY.js} +14 -8
- package/dist/chunk-WI2WTIMY.js.map +1 -0
- package/dist/{chunk-UVYI6VIX.js → chunk-X7Y7WX73.js} +1 -1
- package/dist/{chunk-22V3CMIW.js → chunk-XJTRIHTH.js} +8 -8
- package/dist/{chunk-SIONKXLU.js → chunk-XTRC6SSS.js} +14 -14
- package/dist/{chunk-SBRUTD5O.js → chunk-YSATDEBY.js} +5 -5
- package/dist/{chunk-3YOX2BQD.js → chunk-YWMCV5HL.js} +3 -3
- package/dist/{chunk-L272A5QW.js → chunk-YYDUBGUF.js} +30 -22
- package/dist/chunk-YYDUBGUF.js.map +1 -0
- package/dist/{chunk-6QWFZ3X5.js → chunk-ZA6CYFAK.js} +2 -2
- package/dist/cli.d.ts +1 -6
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +139 -138
- package/dist/coding/export-okf-codegraph.js +24 -24
- package/dist/coding/pre-action-gate.js +2 -2
- package/dist/compounding/engine.js +14 -14
- package/dist/config.js +24 -24
- package/dist/connectors/codex-marketplace.d.ts.map +1 -1
- package/dist/connectors/codex-materialize-runner.js +14 -14
- package/dist/connectors/codex-materialize.d.ts.map +1 -1
- package/dist/connectors/codex-materialize.js +1 -1
- package/dist/connectors/index.js +15 -15
- package/dist/consolidation-provenance-check.js +2 -2
- package/dist/convergence-refresh.js +15 -15
- package/dist/conversation-index/backend.js +2 -2
- package/dist/corpus-watermark.js +15 -15
- package/dist/deep-recall-http-glue.js +11 -11
- package/dist/embedding-fallback.js +2 -2
- package/dist/entity-retrieval.js +14 -14
- package/dist/event-order-recall.js +3 -3
- package/dist/explicit-capture.js +139 -138
- package/dist/extraction-judge.js +1 -1
- package/dist/extraction-normalization.js +1 -1
- package/dist/extraction-span-materialize.js +2 -2
- package/dist/extraction.js +27 -27
- package/dist/{graph-edge-decay-BC3IO2J4.js → graph-edge-decay-CXTNJ7IQ.js} +6 -6
- package/dist/graph-edge-decay-CXTNJ7IQ.js.map +1 -0
- package/dist/graph-jsonl.js +4 -4
- package/dist/graph-snapshot.js +4 -4
- package/dist/graph.js +5 -5
- package/dist/harmonic-retrieval.js +13 -13
- package/dist/index.js +198 -197
- package/dist/lcm/index.js +3 -3
- package/dist/local-llm.js +2 -2
- package/dist/location/index.js +14 -14
- package/dist/maintenance/memory-governance.js +13 -13
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +13 -13
- package/dist/maintenance/rebuild-memory-projection-runner.js +15 -15
- package/dist/maintenance/rebuild-memory-projection.js +14 -14
- package/dist/memory-browse.js +5 -5
- package/dist/memory-controller.d.ts.map +1 -1
- package/dist/memory-controller.js +1 -1
- package/dist/namespaces/migrate.js +14 -14
- package/dist/namespaces/search.js +7 -7
- package/dist/namespaces/storage.d.ts.map +1 -1
- package/dist/namespaces/storage.js +13 -13
- package/dist/offline-sync-changeset-generations.js +4 -4
- package/dist/offline-sync-embedding-generation.js +3 -3
- package/dist/offline-sync-snapshot-stream.js +7 -7
- package/dist/offline-sync.js +6 -6
- package/dist/operator-doctor-corpus.js +16 -16
- package/dist/operator-toolkit.js +35 -35
- package/dist/orchestration/backlog-scheduler.d.ts +4 -0
- package/dist/orchestration/backlog-scheduler.d.ts.map +1 -1
- package/dist/orchestration/backlog-scheduler.js +150 -143
- package/dist/orchestration/backlog-scheduler.js.map +1 -1
- package/dist/orchestration/buffer-drain-runner.js +140 -139
- package/dist/orchestration/extraction-persist-citation.d.ts +2 -2
- package/dist/orchestration/extraction-persist-citation.d.ts.map +1 -1
- package/dist/orchestration/extraction-persist.d.ts.map +1 -1
- package/dist/orchestration/maintenance.js +23 -23
- package/dist/orchestration/recall-internal.d.ts.map +1 -1
- package/dist/orchestration/turn-ingestion-buffered.d.ts.map +1 -1
- package/dist/orchestrator.d.ts.map +1 -1
- package/dist/orchestrator.js +141 -140
- package/dist/qmd.js +4 -4
- package/dist/recall-navigation.js +139 -138
- package/dist/recall-state-view-admission.js +5 -5
- package/dist/recall-state-view-packet.d.ts.map +1 -1
- package/dist/recall-state-view-packet.js +30 -8
- package/dist/recall-state-view-packet.js.map +1 -1
- package/dist/recall-why-service.js +5 -5
- package/dist/reconcile/manifest.js +2 -2
- package/dist/resume-bundles.js +25 -25
- package/dist/search/factory.js +6 -6
- package/dist/search/index.js +8 -8
- package/dist/semantic-consolidation.js +18 -18
- package/dist/semantic-rule-promotion.js +13 -13
- package/dist/semantic-rule-verifier.js +13 -13
- package/dist/source-agent-qualifier.js +18 -18
- package/dist/source-attribution.d.ts +3 -3
- package/dist/source-attribution.d.ts.map +1 -1
- package/dist/source-attribution.js +1 -1
- package/dist/standup/build.js +13 -13
- package/dist/storage.d.ts +1 -0
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +12 -12
- package/dist/summarizer.d.ts +7 -1
- package/dist/summarizer.d.ts.map +1 -1
- package/dist/summarizer.js +3 -3
- package/dist/support-passport/index.js +16 -16
- package/dist/transfer/autodetect.js +3 -3
- package/dist/transfer/backup.js +2 -2
- package/dist/transfer/capsule-export.js +3 -3
- package/dist/transfer/capsule-import.js +3 -3
- package/dist/transfer/export-okf.js +13 -13
- package/dist/transfer/import-json.js +2 -2
- package/dist/transfer/import-md.js +2 -2
- package/dist/transfer/types.d.ts +15 -3
- package/dist/transfer/types.d.ts.map +1 -1
- package/dist/transfer/types.js +3 -1
- package/dist/verified-recall.js +13 -13
- package/dist/who-knows-cli.js +14 -14
- package/dist/who-knows.js +13 -13
- package/package.json +2 -2
- package/src/access-cli.test.ts +9 -9
- package/src/access-recall-excerpt-attribution.ts +69 -0
- package/src/access-recall-surface.ts +26 -31
- package/src/access-service-raw-excerpt-read-gate.test.ts +192 -11
- package/src/backlog-scheduler.test.ts +31 -0
- package/src/binary-lifecycle/scanner.ts +35 -14
- package/src/buffer-add-turns-bounded.ts +16 -2
- package/src/buffer-session-cap.ts +4 -4
- package/src/buffer.ts +5 -5
- package/src/bulk-import/index.ts +1 -0
- package/src/bulk-import/pipeline.test.ts +31 -0
- package/src/bulk-import/pipeline.ts +14 -0
- package/src/calibration.ts +56 -4
- package/src/cli.ts +3 -23
- package/src/connectors/codex-marketplace-git.test.ts +267 -0
- package/src/connectors/codex-marketplace.ts +76 -13
- package/src/connectors/codex-materialize.ts +29 -55
- package/src/memory-controller.test.ts +11 -0
- package/src/memory-controller.ts +5 -1
- package/src/namespaces/storage.ts +1 -0
- package/src/orchestration/backlog-scheduler.ts +12 -3
- package/src/orchestration/extraction-persist-citation.ts +5 -3
- package/src/orchestration/extraction-persist.ts +15 -14
- package/src/orchestration/recall-internal.ts +2 -3
- package/src/orchestration/turn-ingestion-buffered.test.ts +52 -1
- package/src/orchestration/turn-ingestion-buffered.ts +26 -8
- package/src/orchestrator.ts +1 -0
- package/src/recall-state-view-packet.test.ts +40 -0
- package/src/recall-state-view-packet.ts +46 -9
- package/src/source-attribution.test.ts +57 -0
- package/src/source-attribution.ts +46 -43
- package/src/storage.ts +4 -3
- package/src/summarizer-shutdown.test.ts +49 -16
- package/src/summarizer.ts +13 -5
- package/src/testing/subjects/memory-maintenance.test.ts +293 -0
- package/src/transfer/capsule-export.ts +2 -1
- package/src/transfer/capsule-taxonomy-version.test.ts +70 -0
- package/src/transfer/types.ts +13 -3
- package/dist/chunk-AL3TCNSJ.js.map +0 -1
- package/dist/chunk-BPCR5DZP.js.map +0 -1
- package/dist/chunk-FFWFFAP3.js.map +0 -1
- package/dist/chunk-FOTFLHBN.js.map +0 -1
- package/dist/chunk-HSSERO3E.js.map +0 -1
- package/dist/chunk-IE2ZLO3R.js.map +0 -1
- package/dist/chunk-L272A5QW.js.map +0 -1
- package/dist/chunk-OWM2VWNX.js.map +0 -1
- package/dist/chunk-QLQUAVVP.js.map +0 -1
- package/dist/chunk-WEHSQBFR.js.map +0 -1
- /package/dist/{capsule-crypto-GWVG7LGC.js.map → access-recall-excerpt-attribution.js.map} +0 -0
- /package/dist/{auto-sync-L3M4RKJD.js.map → auto-sync-ACP5U5A3.js.map} +0 -0
- /package/dist/{graph-edge-decay-BC3IO2J4.js.map → capsule-crypto-7FJQINUR.js.map} +0 -0
- /package/dist/{capsule-merge-VHBRF65A.js.map → capsule-merge-BADOICNP.js.map} +0 -0
- /package/dist/{chunk-OWHERGF2.js.map → chunk-2NLLXCJG.js.map} +0 -0
- /package/dist/{chunk-L7SEYUHS.js.map → chunk-3I3NXB6X.js.map} +0 -0
- /package/dist/{chunk-4NBUHYUV.js.map → chunk-3LADDLAF.js.map} +0 -0
- /package/dist/{chunk-2DL3OFLD.js.map → chunk-45GEJRIG.js.map} +0 -0
- /package/dist/{chunk-5BE3FLKL.js.map → chunk-5KDDAQ6K.js.map} +0 -0
- /package/dist/{chunk-HLWXCDUQ.js.map → chunk-63A2BU2B.js.map} +0 -0
- /package/dist/{chunk-C5QYWM6F.js.map → chunk-7FPI5MFB.js.map} +0 -0
- /package/dist/{chunk-ZX546Y3Y.js.map → chunk-7OYDFIL4.js.map} +0 -0
- /package/dist/{chunk-CKZWLAHN.js.map → chunk-ACPFBVUD.js.map} +0 -0
- /package/dist/{chunk-BKTCVXMK.js.map → chunk-AHOYKJ5X.js.map} +0 -0
- /package/dist/{chunk-FGT7CUYZ.js.map → chunk-ALTLOHO7.js.map} +0 -0
- /package/dist/{chunk-FMFCQRDM.js.map → chunk-AUFPPBC3.js.map} +0 -0
- /package/dist/{chunk-OAQRZ4SV.js.map → chunk-B5KTTWC7.js.map} +0 -0
- /package/dist/{chunk-73TPOGS4.js.map → chunk-BFBS7OFQ.js.map} +0 -0
- /package/dist/{chunk-QFTK6EDM.js.map → chunk-BFZFNXOC.js.map} +0 -0
- /package/dist/{chunk-ZQUOUPP3.js.map → chunk-BHRPZBAH.js.map} +0 -0
- /package/dist/{chunk-4L25GAYL.js.map → chunk-CX24SVLK.js.map} +0 -0
- /package/dist/{chunk-YY57TRKN.js.map → chunk-D5ZLTLHF.js.map} +0 -0
- /package/dist/{chunk-WEFFO2MJ.js.map → chunk-D6YCETHG.js.map} +0 -0
- /package/dist/{chunk-ZDZJNXL6.js.map → chunk-DK2VBJ6Q.js.map} +0 -0
- /package/dist/{chunk-VRHY7Y5A.js.map → chunk-DPL5VO5V.js.map} +0 -0
- /package/dist/{chunk-LVGTH6IQ.js.map → chunk-E7ATID4Z.js.map} +0 -0
- /package/dist/{chunk-CKELO7Q6.js.map → chunk-FHWX2REL.js.map} +0 -0
- /package/dist/{chunk-CUPILBIP.js.map → chunk-FMIM36I4.js.map} +0 -0
- /package/dist/{chunk-A5UOREWD.js.map → chunk-FWTGO4NE.js.map} +0 -0
- /package/dist/{chunk-3SL52JKD.js.map → chunk-FZVROZKC.js.map} +0 -0
- /package/dist/{chunk-U3BCW7GX.js.map → chunk-G3RLCVJC.js.map} +0 -0
- /package/dist/{chunk-UYIBNDQE.js.map → chunk-GF5NN3LE.js.map} +0 -0
- /package/dist/{chunk-7OCKK5M5.js.map → chunk-GWY5ZFHP.js.map} +0 -0
- /package/dist/{chunk-TNRGWJYT.js.map → chunk-H4IU24V5.js.map} +0 -0
- /package/dist/{chunk-T4BT4FQN.js.map → chunk-HH6PXQ2B.js.map} +0 -0
- /package/dist/{chunk-FEUWI5QH.js.map → chunk-HHPY5SSE.js.map} +0 -0
- /package/dist/{chunk-OM5ESBES.js.map → chunk-HQPFACXO.js.map} +0 -0
- /package/dist/{chunk-IMULTENA.js.map → chunk-ID65XTF3.js.map} +0 -0
- /package/dist/{chunk-WWQMZBDI.js.map → chunk-IJVU4ILJ.js.map} +0 -0
- /package/dist/{chunk-GBSXTTLP.js.map → chunk-ITGAGNX5.js.map} +0 -0
- /package/dist/{chunk-3PNJZTDV.js.map → chunk-JGGNUEVD.js.map} +0 -0
- /package/dist/{chunk-YYXYZM2I.js.map → chunk-JN7OSQJR.js.map} +0 -0
- /package/dist/{chunk-4D2EY4WM.js.map → chunk-K2DTHNDY.js.map} +0 -0
- /package/dist/{chunk-TH6OYP6I.js.map → chunk-K36RMINQ.js.map} +0 -0
- /package/dist/{chunk-OZKVVUJB.js.map → chunk-KIM5VNZN.js.map} +0 -0
- /package/dist/{chunk-ZWDDY4WF.js.map → chunk-M7CFCRWJ.js.map} +0 -0
- /package/dist/{chunk-QPFM6DHY.js.map → chunk-MTJFK42O.js.map} +0 -0
- /package/dist/{chunk-RO5EGRAI.js.map → chunk-N3FRR6II.js.map} +0 -0
- /package/dist/{chunk-UMEUU66X.js.map → chunk-O3OEVYUR.js.map} +0 -0
- /package/dist/{chunk-J74YOBB3.js.map → chunk-PFR6ZKQI.js.map} +0 -0
- /package/dist/{chunk-TAD6QMMD.js.map → chunk-PRC7SZYM.js.map} +0 -0
- /package/dist/{chunk-GMO3BGOF.js.map → chunk-QC2MHZDD.js.map} +0 -0
- /package/dist/{chunk-2MWKUVHT.js.map → chunk-RK7SE3BL.js.map} +0 -0
- /package/dist/{chunk-HDWISXFH.js.map → chunk-RVAPK2S7.js.map} +0 -0
- /package/dist/{chunk-5PUZV73Z.js.map → chunk-SEIGLG62.js.map} +0 -0
- /package/dist/{chunk-AVWOULJH.js.map → chunk-SH3GOZWK.js.map} +0 -0
- /package/dist/{chunk-PFLN6TTW.js.map → chunk-T3MCVSUC.js.map} +0 -0
- /package/dist/{chunk-WQUGCOKF.js.map → chunk-TFA6HPOA.js.map} +0 -0
- /package/dist/{chunk-CLVILSBR.js.map → chunk-TGQW3AMK.js.map} +0 -0
- /package/dist/{chunk-YZYAYUJQ.js.map → chunk-TLRIRISJ.js.map} +0 -0
- /package/dist/{chunk-7VIJUZYW.js.map → chunk-TQ4CELUR.js.map} +0 -0
- /package/dist/{chunk-5QDTZIGH.js.map → chunk-U7KP6QFU.js.map} +0 -0
- /package/dist/{chunk-QVXEXGIM.js.map → chunk-VF6SC4OD.js.map} +0 -0
- /package/dist/{chunk-EZG54YDS.js.map → chunk-VKXJQF5C.js.map} +0 -0
- /package/dist/{chunk-RFLC6PKQ.js.map → chunk-VMRPLHEU.js.map} +0 -0
- /package/dist/{chunk-U2PSE7MB.js.map → chunk-VPEIWMUT.js.map} +0 -0
- /package/dist/{chunk-X67XNZ64.js.map → chunk-W4EJMMPP.js.map} +0 -0
- /package/dist/{chunk-RB7NXZ2E.js.map → chunk-W4Q65VJL.js.map} +0 -0
- /package/dist/{chunk-HDDRVXX4.js.map → chunk-W5LJ3SJ7.js.map} +0 -0
- /package/dist/{chunk-W7N7NWG5.js.map → chunk-WCJQ3OUP.js.map} +0 -0
- /package/dist/{chunk-UVYI6VIX.js.map → chunk-X7Y7WX73.js.map} +0 -0
- /package/dist/{chunk-22V3CMIW.js.map → chunk-XJTRIHTH.js.map} +0 -0
- /package/dist/{chunk-SIONKXLU.js.map → chunk-XTRC6SSS.js.map} +0 -0
- /package/dist/{chunk-SBRUTD5O.js.map → chunk-YSATDEBY.js.map} +0 -0
- /package/dist/{chunk-3YOX2BQD.js.map → chunk-YWMCV5HL.js.map} +0 -0
- /package/dist/{chunk-6QWFZ3X5.js.map → chunk-ZA6CYFAK.js.map} +0 -0
|
@@ -407,40 +407,34 @@ function templateMatcher(template: string): RegExp | null {
|
|
|
407
407
|
* `[Source: ...]` marker detection which is always available via
|
|
408
408
|
* {@link hasCitation}.
|
|
409
409
|
*/
|
|
410
|
-
export function hasCitationForTemplate(
|
|
410
|
+
export function hasCitationForTemplate(
|
|
411
|
+
text: string,
|
|
412
|
+
template: string,
|
|
413
|
+
priorTemplates: readonly string[] = [],
|
|
414
|
+
): boolean {
|
|
411
415
|
if (typeof text !== "string" || text.length === 0) return false;
|
|
412
416
|
// Always accept the default format as a fallback so facts tagged before a
|
|
413
417
|
// configuration change are not double-tagged on reprocessing.
|
|
414
418
|
if (hasCitation(text)) return true;
|
|
415
|
-
//
|
|
416
|
-
//
|
|
417
|
-
//
|
|
418
|
-
//
|
|
419
|
-
//
|
|
420
|
-
//
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
// (missing an old custom citation) produces a benign duplicate citation rather
|
|
424
|
-
// than data loss. A full fix would require storing the citation template used
|
|
425
|
-
// at write time in the frontmatter and checking that here.
|
|
426
|
-
if (template === DEFAULT_CITATION_FORMAT) return false;
|
|
427
|
-
|
|
428
|
-
// Fully-literal template (no placeholders): exact inclusion check.
|
|
429
|
-
if (!PLACEHOLDER_REGEX.test(template)) {
|
|
430
|
-
// Reset lastIndex because PLACEHOLDER_REGEX is declared with /g.
|
|
419
|
+
// Probe the current template plus every declared prior format
|
|
420
|
+
// (`inlineSourceAttributionFormatHistory`, issue #3567). A fact written
|
|
421
|
+
// while a different template was configured is detected here instead of
|
|
422
|
+
// being double-cited or hashed with its marker intact on reprocess.
|
|
423
|
+
// citationTemplatesToRecognize drops undetectable shapes, so an
|
|
424
|
+
// all-placeholder prior cannot false-positive.
|
|
425
|
+
for (const candidate of citationTemplatesToRecognize(template, priorTemplates)) {
|
|
426
|
+
if (candidate === DEFAULT_CITATION_FORMAT) continue;
|
|
431
427
|
PLACEHOLDER_REGEX.lastIndex = 0;
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
// docstring — callers should not rely on dedup for this shape.
|
|
441
|
-
return false;
|
|
428
|
+
if (!PLACEHOLDER_REGEX.test(candidate)) {
|
|
429
|
+
PLACEHOLDER_REGEX.lastIndex = 0;
|
|
430
|
+
if (text.includes(candidate)) return true;
|
|
431
|
+
continue;
|
|
432
|
+
}
|
|
433
|
+
PLACEHOLDER_REGEX.lastIndex = 0;
|
|
434
|
+
const matcher = templateMatcher(candidate);
|
|
435
|
+
if (matcher?.test(text)) return true;
|
|
442
436
|
}
|
|
443
|
-
return
|
|
437
|
+
return false;
|
|
444
438
|
}
|
|
445
439
|
|
|
446
440
|
/**
|
|
@@ -573,9 +567,10 @@ export function attachCitation(
|
|
|
573
567
|
text: string,
|
|
574
568
|
ctx: CitationContext,
|
|
575
569
|
template: string = DEFAULT_CITATION_FORMAT,
|
|
570
|
+
priorTemplates: readonly string[] = [],
|
|
576
571
|
): string {
|
|
577
572
|
if (typeof text !== "string") return text as unknown as string;
|
|
578
|
-
if (hasCitationForTemplate(text, template)) return text;
|
|
573
|
+
if (hasCitationForTemplate(text, template, priorTemplates)) return text;
|
|
579
574
|
const trimmedEnd = trimTrailingWhitespace(text);
|
|
580
575
|
if (trimmedEnd.length === 0) return text;
|
|
581
576
|
const citation = formatCitation(ctx, template);
|
|
@@ -730,28 +725,36 @@ export function stripCitation(text: string): string {
|
|
|
730
725
|
export function stripCitationForTemplate(
|
|
731
726
|
text: string,
|
|
732
727
|
template: string,
|
|
728
|
+
priorTemplates: readonly string[] = [],
|
|
733
729
|
): string {
|
|
734
730
|
if (typeof text !== "string" || text.length === 0) return text;
|
|
735
731
|
|
|
736
|
-
// First pass: the default-format marker, if any.
|
|
737
|
-
//
|
|
738
|
-
//
|
|
739
|
-
|
|
732
|
+
// First pass: the default-format marker, if any. Later passes still run —
|
|
733
|
+
// a body can carry the default marker AND markers from the current or a
|
|
734
|
+
// prior configured template, and canonicalization must remove every
|
|
735
|
+
// recognized form.
|
|
736
|
+
let out = hasCitation(text) ? stripCitation(text) : text;
|
|
740
737
|
|
|
741
|
-
|
|
738
|
+
for (const candidate of citationTemplatesToRecognize(template, priorTemplates)) {
|
|
739
|
+
if (candidate === DEFAULT_CITATION_FORMAT) continue;
|
|
740
|
+
out = stripSingleTemplateCitation(out, candidate);
|
|
741
|
+
}
|
|
742
|
+
return out;
|
|
743
|
+
}
|
|
742
744
|
|
|
745
|
+
// Strips every marker `template` produces — literal templates by exact
|
|
746
|
+
// match, placeholder templates via the compiled matcher. Undetectable
|
|
747
|
+
// (all-placeholder) shapes leave the text unchanged.
|
|
748
|
+
function stripSingleTemplateCitation(text: string, template: string): string {
|
|
743
749
|
PLACEHOLDER_REGEX.lastIndex = 0;
|
|
744
750
|
if (!PLACEHOLDER_REGEX.test(template)) {
|
|
745
751
|
PLACEHOLDER_REGEX.lastIndex = 0;
|
|
746
|
-
return stripExactLiteralCitation(
|
|
752
|
+
return stripExactLiteralCitation(text, template);
|
|
747
753
|
}
|
|
748
754
|
PLACEHOLDER_REGEX.lastIndex = 0;
|
|
749
755
|
|
|
750
|
-
// Build the template matcher. hasCitationForTemplate already returned true,
|
|
751
|
-
// which means templateMatcher produced a non-null result. The null branch
|
|
752
|
-
// here is a defensive fallback only — the default pass already ran.
|
|
753
756
|
const matcher = templateMatcher(template);
|
|
754
|
-
if (!matcher) return
|
|
757
|
+
if (!matcher) return text;
|
|
755
758
|
|
|
756
759
|
// The matcher regex was built without the global flag; add it for exec loop.
|
|
757
760
|
const globalMatcher = new RegExp(
|
|
@@ -762,12 +765,12 @@ export function stripCitationForTemplate(
|
|
|
762
765
|
let lastIndex = 0;
|
|
763
766
|
let match: RegExpExecArray | null;
|
|
764
767
|
|
|
765
|
-
while ((match = globalMatcher.exec(
|
|
768
|
+
while ((match = globalMatcher.exec(text)) !== null) {
|
|
766
769
|
const matchEnd = match.index + match[0].length;
|
|
767
|
-
const enclosure = enclosingDelimiterRange(
|
|
770
|
+
const enclosure = enclosingDelimiterRange(text, match.index, matchEnd);
|
|
768
771
|
const removalStart = enclosure?.start ?? match.index;
|
|
769
772
|
const removalEnd = enclosure?.end ?? matchEnd;
|
|
770
|
-
const before =
|
|
773
|
+
const before = text.slice(lastIndex, removalStart).replace(/[ \t]+$/, "");
|
|
771
774
|
result += before;
|
|
772
775
|
lastIndex = removalEnd;
|
|
773
776
|
// Guard against zero-width matches causing an infinite loop.
|
|
@@ -776,7 +779,7 @@ export function stripCitationForTemplate(
|
|
|
776
779
|
}
|
|
777
780
|
}
|
|
778
781
|
|
|
779
|
-
const after =
|
|
782
|
+
const after = text.slice(lastIndex).replace(/^[ \t]+/, "");
|
|
780
783
|
if (after.length > 0) {
|
|
781
784
|
if (result.length > 0) result += " ";
|
|
782
785
|
result += after;
|
package/src/storage.ts
CHANGED
|
@@ -1923,6 +1923,7 @@ export class StorageManager extends TombstoneBlockedCaptureIndexHost {
|
|
|
1923
1923
|
private offlineSyncDigestCacheWriteTimer: ReturnType<typeof setTimeout> | null = null;
|
|
1924
1924
|
/** Optional: set by the orchestrator after construction to enable template-aware citation stripping during legacy hash rebuild. */
|
|
1925
1925
|
citationTemplate: string = DEFAULT_CITATION_FORMAT;
|
|
1926
|
+
citationTemplateHistory: string[] = [];
|
|
1926
1927
|
/** Post-write catalog hook (#1522). Installed by the namespace router; fire-and-forget. */
|
|
1927
1928
|
onCatalogWrite?: () => void;
|
|
1928
1929
|
/** Post-write embedding hook (#2019). Installed by the orchestrator; fire-and-forget. */
|
|
@@ -3142,7 +3143,7 @@ export class StorageManager extends TombstoneBlockedCaptureIndexHost {
|
|
|
3142
3143
|
// and the normalized-text tier must match re-extraction, which hashes
|
|
3143
3144
|
// the citation-stripped contentHashSource. Idempotent on pre-stripped
|
|
3144
3145
|
// text (e.g. recordSupersession).
|
|
3145
|
-
const strippedRawContent = stripCitationForTemplate(input.rawContent, this.citationTemplate);
|
|
3146
|
+
const strippedRawContent = stripCitationForTemplate(input.rawContent, this.citationTemplate, this.citationTemplateHistory);
|
|
3146
3147
|
// Canonicalization + post-append recheck (#2213) live in the helper.
|
|
3147
3148
|
return await entityRefs.appendCanonicalizedTombstone(
|
|
3148
3149
|
this.stateDir,
|
|
@@ -3212,7 +3213,7 @@ export class StorageManager extends TombstoneBlockedCaptureIndexHost {
|
|
|
3212
3213
|
const all = [...(await this.readAllMemories()), ...(await this.readAllColdMemories())];
|
|
3213
3214
|
// Pure projection (lifecycle/tombstones.ts) keeps this method thin (#1520).
|
|
3214
3215
|
const retired = collectRetiredMemoriesForRebuild(all, {
|
|
3215
|
-
stripCitation: (text) => stripCitationForTemplate(text, this.citationTemplate),
|
|
3216
|
+
stripCitation: (text) => stripCitationForTemplate(text, this.citationTemplate, this.citationTemplateHistory),
|
|
3216
3217
|
supersessionKeysForFact,
|
|
3217
3218
|
});
|
|
3218
3219
|
return await store.rebuild(retired);
|
|
@@ -3428,7 +3429,7 @@ export class StorageManager extends TombstoneBlockedCaptureIndexHost {
|
|
|
3428
3429
|
}
|
|
3429
3430
|
private storedContentIdentityCandidates(content: string): string[] {
|
|
3430
3431
|
return storedContentIdentityCandidates(content, (value) =>
|
|
3431
|
-
hasCitationForTemplate(value, this.citationTemplate) ? stripCitationForTemplate(value, this.citationTemplate) : value
|
|
3432
|
+
hasCitationForTemplate(value, this.citationTemplate, this.citationTemplateHistory) ? stripCitationForTemplate(value, this.citationTemplate, this.citationTemplateHistory) : value
|
|
3432
3433
|
);
|
|
3433
3434
|
}
|
|
3434
3435
|
|
|
@@ -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
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
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 =
|
|
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`
|
|
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`.
|