@remnic/core 10.0.191 → 10.0.192
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/abstraction-nodes.js +4 -4
- package/dist/access-admin-ops-surface.js +62 -62
- package/dist/access-cli.js +62 -62
- package/dist/access-extraction-force-flush-preempt.js +62 -62
- package/dist/access-extraction-force-flush.js +62 -62
- package/dist/access-http-briefing.js +62 -62
- package/dist/access-http-query.js +62 -62
- package/dist/access-http.js +62 -62
- package/dist/access-identity-continuity-surface.js +62 -62
- package/dist/access-lcm-surface.js +62 -62
- package/dist/access-mcp.js +62 -62
- package/dist/access-observe-write-surface.js +62 -62
- package/dist/access-operations-batch.js +62 -62
- package/dist/access-operations.js +62 -62
- package/dist/access-recall-concurrency.js +62 -62
- package/dist/access-recall-diagnostics.js +2 -2
- package/dist/access-recall-response.js +62 -62
- package/dist/access-recall-surface.js +62 -62
- package/dist/access-service.js +62 -62
- package/dist/active-recall.js +11 -11
- package/dist/briefing.js +11 -11
- package/dist/buffer-persistence.d.ts +7 -0
- package/dist/buffer-persistence.d.ts.map +1 -1
- package/dist/buffer-persistence.js +1 -1
- package/dist/buffer.d.ts +2 -0
- package/dist/buffer.d.ts.map +1 -1
- package/dist/buffer.js +6 -6
- package/dist/{capsule-merge-BADOICNP.js → capsule-merge-3FARYIHP.js} +5 -5
- package/dist/causal-consolidation.js +12 -12
- package/dist/{chunk-IMSLPQJB.js → chunk-2QW5HPKU.js} +2 -2
- package/dist/{chunk-KNYUEYB6.js → chunk-2YJ2ST23.js} +2 -2
- package/dist/{chunk-BZ5VO7KO.js → chunk-3BICT225.js} +2 -2
- package/dist/{chunk-UWKHLWUE.js → chunk-3RZ4GDOH.js} +2 -2
- package/dist/{chunk-ODIBCZLG.js → chunk-3YID7KZ6.js} +2 -2
- package/dist/{chunk-4SUNBSPD.js → chunk-4EAVEDLG.js} +9 -9
- package/dist/{chunk-TLRIRISJ.js → chunk-4LCA2GEX.js} +2 -2
- package/dist/{chunk-4N33L4HY.js → chunk-5GIYIYJI.js} +2 -2
- package/dist/{chunk-JQCEG54G.js → chunk-75K6DRPN.js} +12 -9
- package/dist/chunk-75K6DRPN.js.map +1 -0
- package/dist/{chunk-ZDLVHGIC.js → chunk-7EP4FURO.js} +2 -2
- package/dist/{chunk-CAUADFDM.js → chunk-7SOKOEAZ.js} +2 -2
- package/dist/{chunk-7Q74DD2W.js → chunk-7V6GNQC2.js} +2 -2
- package/dist/{chunk-C6YKKH73.js → chunk-AALJHIKH.js} +3 -3
- package/dist/{chunk-C2UN2CY7.js → chunk-AJ7JHHRY.js} +2 -2
- package/dist/{chunk-QSVWIKNY.js → chunk-BDFSVUUZ.js} +9 -7
- package/dist/chunk-BDFSVUUZ.js.map +1 -0
- package/dist/{chunk-3DADRUGW.js → chunk-BGA7S5EF.js} +3 -3
- package/dist/{chunk-7GMOB4FF.js → chunk-CJSTQNE5.js} +2 -2
- package/dist/{chunk-6YAQ3AJ5.js → chunk-DYUPSTCV.js} +3 -3
- package/dist/{chunk-E5QI6C6C.js → chunk-E3LGAZJC.js} +3 -3
- package/dist/{chunk-NL5KFA5N.js → chunk-EEA2RM4B.js} +2 -2
- package/dist/{chunk-BL7WULM5.js → chunk-FDO7ITP6.js} +2 -2
- package/dist/{chunk-7BIGO6ZL.js → chunk-FGFU6J26.js} +3 -3
- package/dist/{chunk-6TIQLG7I.js → chunk-FKHXXL42.js} +2 -2
- package/dist/{chunk-QPD7EYGI.js → chunk-G2MS56KM.js} +2 -2
- package/dist/{chunk-FFTGLWHI.js → chunk-GH7IKABD.js} +2 -2
- package/dist/{chunk-RC2TVYY2.js → chunk-GYCUX3N4.js} +2 -2
- package/dist/{chunk-CJYVVVOG.js → chunk-HEJFE3BC.js} +3 -3
- package/dist/{chunk-KM4QO4LN.js → chunk-HLQANATZ.js} +2 -2
- package/dist/{chunk-RQOUKIFS.js → chunk-J7RQ3RP7.js} +2 -2
- package/dist/{chunk-QTHFGP5F.js → chunk-JITK24KX.js} +7 -7
- package/dist/{chunk-EJYUAN5F.js → chunk-K6UXWVQ6.js} +2 -2
- package/dist/{chunk-3XJITLZQ.js → chunk-KJ65WZHB.js} +2 -2
- package/dist/{chunk-JOR4Y326.js → chunk-KOVQZJ27.js} +2 -2
- package/dist/{chunk-O6QSBI3U.js → chunk-KZ4BJRGQ.js} +2 -2
- package/dist/{chunk-FZPZML67.js → chunk-LR6LWX33.js} +4 -4
- package/dist/{chunk-NTS2RCQK.js → chunk-NAULI3EG.js} +2 -2
- package/dist/{chunk-V5W67PQV.js → chunk-NOKHMWMW.js} +4 -4
- package/dist/{chunk-JGVW6F3Q.js → chunk-ODI4K32P.js} +5 -5
- package/dist/{chunk-H7USCTPQ.js → chunk-OLD2GKQJ.js} +3 -3
- package/dist/{chunk-D7HOJFDS.js → chunk-ONSEODO2.js} +2 -2
- package/dist/{chunk-R3YMWUF3.js → chunk-P3IAZQPS.js} +2 -2
- package/dist/{chunk-LL6WEMTC.js → chunk-P3OONWJJ.js} +2 -2
- package/dist/chunk-P3OONWJJ.js.map +1 -0
- package/dist/{chunk-7KC6LT7U.js → chunk-PSQ347YP.js} +3 -3
- package/dist/{chunk-U6OQ7GWU.js → chunk-QFKNIKUF.js} +2 -2
- package/dist/{chunk-RFVX4WE7.js → chunk-QIPRDRGM.js} +1 -1
- package/dist/chunk-QIPRDRGM.js.map +1 -0
- package/dist/{chunk-2DFXIJPZ.js → chunk-QZMGZBTF.js} +2 -2
- package/dist/{chunk-NSFHMGOF.js → chunk-SKJM4PKE.js} +2 -2
- package/dist/{chunk-T7R42MWB.js → chunk-STSORBX5.js} +2 -2
- package/dist/{chunk-ICA5SCIT.js → chunk-T765HQ5U.js} +3 -3
- package/dist/{chunk-RFEQ7DQN.js → chunk-TDG5NZAZ.js} +2 -2
- package/dist/{chunk-2S6PPGIR.js → chunk-TWYYUMYO.js} +2 -2
- package/dist/{chunk-U6JZGQXC.js → chunk-TZ7ZA2LM.js} +2 -2
- package/dist/{chunk-AIS7RLTG.js → chunk-UAEJKURK.js} +58 -56
- package/dist/{chunk-AIS7RLTG.js.map → chunk-UAEJKURK.js.map} +1 -1
- package/dist/{chunk-JIB3UUYV.js → chunk-UH2VY2QQ.js} +3 -3
- package/dist/{chunk-X5XK6WWV.js → chunk-VHQNJW4Q.js} +2 -2
- package/dist/{chunk-CP6MUXNI.js → chunk-WEI6HEUX.js} +11 -6
- package/dist/chunk-WEI6HEUX.js.map +1 -0
- package/dist/{chunk-3IA2SUWM.js → chunk-WRVKI6ZO.js} +2 -2
- package/dist/{chunk-R5S57GRK.js → chunk-XSRZM6CQ.js} +38 -13
- package/dist/chunk-XSRZM6CQ.js.map +1 -0
- package/dist/{chunk-2CWCJYT3.js → chunk-XZLCAL5O.js} +2 -2
- package/dist/{chunk-7MAMRCZ7.js → chunk-XZMQLON4.js} +430 -292
- package/dist/chunk-XZMQLON4.js.map +1 -0
- package/dist/{chunk-HL53XYHC.js → chunk-YCJJODER.js} +5 -5
- package/dist/chunk-YCJJODER.js.map +1 -0
- package/dist/{chunk-W7FZ7ZZE.js → chunk-Z6EFSXU3.js} +2 -2
- package/dist/{chunk-GRX5BE73.js → chunk-ZNCCX7P6.js} +2 -2
- package/dist/cli.js +62 -62
- package/dist/coding/export-okf-codegraph.js +10 -10
- package/dist/compounding/engine.js +12 -12
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +11 -11
- package/dist/connectors/codex-materialize-runner.js +11 -11
- package/dist/connectors/index.js +11 -11
- package/dist/consolidation-provenance-check.js +5 -5
- package/dist/consolidation-undo.js +4 -4
- package/dist/contradiction/index.js +3 -3
- package/dist/convergence-refresh.js +13 -13
- package/dist/corpus-watermark.js +13 -13
- package/dist/cue-anchors.js +5 -5
- package/dist/{entity-canonical-id-migration-74IDJFPB.js → entity-canonical-id-migration-46EMEXTB.js} +4 -4
- package/dist/entity-retrieval.d.ts.map +1 -1
- package/dist/entity-retrieval.js +11 -11
- package/dist/explicit-capture.js +62 -62
- package/dist/extraction.js +15 -15
- package/dist/harmonic-construction.js +6 -6
- package/dist/harmonic-graph-version.js +3 -3
- package/dist/harmonic-retrieval.d.ts +15 -0
- package/dist/harmonic-retrieval.d.ts.map +1 -1
- package/dist/harmonic-retrieval.js +16 -14
- package/dist/index.js +62 -62
- package/dist/location/index.js +12 -12
- package/dist/maintenance/memory-governance.js +11 -11
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +11 -11
- package/dist/maintenance/rebuild-memory-projection-runner.js +13 -13
- package/dist/maintenance/rebuild-memory-projection.js +12 -12
- package/dist/memory-browse.js +5 -5
- package/dist/memory-cache.d.ts +44 -3
- package/dist/memory-cache.d.ts.map +1 -1
- package/dist/memory-cache.js +9 -1
- package/dist/memory-corpus-version.js +2 -2
- package/dist/namespaces/migrate.js +12 -12
- package/dist/namespaces/search.js +4 -4
- package/dist/namespaces/storage.js +11 -11
- package/dist/operator-doctor-corpus.js +14 -14
- package/dist/operator-toolkit.js +19 -19
- package/dist/orchestration/backlog-scheduler.js +63 -63
- package/dist/orchestration/buffer-drain-runner.js +63 -63
- package/dist/orchestration/maintenance.js +19 -19
- package/dist/orchestration/recall-internal.d.ts.map +1 -1
- package/dist/orchestration/turn-ingestion-buffered.d.ts.map +1 -1
- package/dist/orchestrator.js +62 -62
- package/dist/page-versioning.js +4 -4
- package/dist/qmd.js +2 -2
- package/dist/recall-explain-renderer.js +3 -3
- package/dist/recall-navigate-access.js +2 -2
- package/dist/recall-navigate-disclosure.js +2 -2
- package/dist/recall-navigate.js +2 -2
- package/dist/recall-navigation.js +62 -62
- package/dist/recall-state-view-admission.js +5 -5
- package/dist/recall-why-service.js +5 -5
- package/dist/recall-xray-cli.js +4 -4
- package/dist/recall-xray-renderer.js +3 -3
- package/dist/recall-xray.js +2 -2
- package/dist/{resolution-RWIGFH2W.js → resolution-4QPPLDEN.js} +4 -4
- package/dist/resume-bundles.js +12 -12
- package/dist/search/factory.js +3 -3
- package/dist/search/index.js +3 -3
- package/dist/semantic-consolidation.js +12 -12
- package/dist/semantic-rule-promotion.js +11 -11
- package/dist/semantic-rule-verifier.js +11 -11
- package/dist/source-agent-qualifier.js +14 -14
- package/dist/standup/build.js +11 -11
- package/dist/storage/entity-listing.d.ts +20 -0
- package/dist/storage/entity-listing.d.ts.map +1 -0
- package/dist/storage/entity-store.d.ts +5 -0
- package/dist/storage/entity-store.d.ts.map +1 -1
- package/dist/storage/hot-cache-validation.d.ts +60 -0
- package/dist/storage/hot-cache-validation.d.ts.map +1 -0
- package/dist/storage.d.ts +2 -0
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +10 -10
- package/dist/transfer/capsule-import.js +5 -5
- package/dist/transfer/export-okf.js +11 -11
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/dist/verified-recall.js +11 -11
- package/dist/who-knows-cli.js +12 -12
- package/dist/who-knows.js +11 -11
- package/package.json +2 -2
- package/src/buffer-large-session-defer.test.ts +81 -0
- package/src/buffer-persistence.ts +8 -1
- package/src/buffer.ts +9 -4
- package/src/config.test.ts +9 -0
- package/src/config.ts +3 -6
- package/src/entity-recall-hot-cache.test.ts +116 -0
- package/src/entity-retrieval.ts +22 -4
- package/src/harmonic-graph-cache.test.ts +28 -9
- package/src/harmonic-retrieval.ts +20 -4
- package/src/memory-cache-hot.test.ts +47 -0
- package/src/memory-cache.ts +96 -17
- package/src/observe-flush-force-keys.test.ts +130 -0
- package/src/orchestration/recall-internal.ts +1 -0
- package/src/orchestration/turn-ingestion-buffered.test.ts +6 -2
- package/src/orchestration/turn-ingestion-buffered.ts +5 -1
- package/src/storage/entity-listing.ts +73 -0
- package/src/storage/entity-store.ts +25 -26
- package/src/storage/hot-cache-validation.ts +149 -0
- package/src/storage-contract/cache-coherence.test.ts +42 -5
- package/src/storage-hot-cache-stat-validate.test.ts +112 -0
- package/src/storage.ts +58 -44
- package/src/types.ts +2 -0
- package/dist/chunk-7MAMRCZ7.js.map +0 -1
- package/dist/chunk-CP6MUXNI.js.map +0 -1
- package/dist/chunk-HL53XYHC.js.map +0 -1
- package/dist/chunk-JQCEG54G.js.map +0 -1
- package/dist/chunk-LL6WEMTC.js.map +0 -1
- package/dist/chunk-QSVWIKNY.js.map +0 -1
- package/dist/chunk-R5S57GRK.js.map +0 -1
- package/dist/chunk-RFVX4WE7.js.map +0 -1
- /package/dist/{capsule-merge-BADOICNP.js.map → capsule-merge-3FARYIHP.js.map} +0 -0
- /package/dist/{chunk-IMSLPQJB.js.map → chunk-2QW5HPKU.js.map} +0 -0
- /package/dist/{chunk-KNYUEYB6.js.map → chunk-2YJ2ST23.js.map} +0 -0
- /package/dist/{chunk-BZ5VO7KO.js.map → chunk-3BICT225.js.map} +0 -0
- /package/dist/{chunk-UWKHLWUE.js.map → chunk-3RZ4GDOH.js.map} +0 -0
- /package/dist/{chunk-ODIBCZLG.js.map → chunk-3YID7KZ6.js.map} +0 -0
- /package/dist/{chunk-4SUNBSPD.js.map → chunk-4EAVEDLG.js.map} +0 -0
- /package/dist/{chunk-TLRIRISJ.js.map → chunk-4LCA2GEX.js.map} +0 -0
- /package/dist/{chunk-4N33L4HY.js.map → chunk-5GIYIYJI.js.map} +0 -0
- /package/dist/{chunk-ZDLVHGIC.js.map → chunk-7EP4FURO.js.map} +0 -0
- /package/dist/{chunk-CAUADFDM.js.map → chunk-7SOKOEAZ.js.map} +0 -0
- /package/dist/{chunk-7Q74DD2W.js.map → chunk-7V6GNQC2.js.map} +0 -0
- /package/dist/{chunk-C6YKKH73.js.map → chunk-AALJHIKH.js.map} +0 -0
- /package/dist/{chunk-C2UN2CY7.js.map → chunk-AJ7JHHRY.js.map} +0 -0
- /package/dist/{chunk-3DADRUGW.js.map → chunk-BGA7S5EF.js.map} +0 -0
- /package/dist/{chunk-7GMOB4FF.js.map → chunk-CJSTQNE5.js.map} +0 -0
- /package/dist/{chunk-6YAQ3AJ5.js.map → chunk-DYUPSTCV.js.map} +0 -0
- /package/dist/{chunk-E5QI6C6C.js.map → chunk-E3LGAZJC.js.map} +0 -0
- /package/dist/{chunk-NL5KFA5N.js.map → chunk-EEA2RM4B.js.map} +0 -0
- /package/dist/{chunk-BL7WULM5.js.map → chunk-FDO7ITP6.js.map} +0 -0
- /package/dist/{chunk-7BIGO6ZL.js.map → chunk-FGFU6J26.js.map} +0 -0
- /package/dist/{chunk-6TIQLG7I.js.map → chunk-FKHXXL42.js.map} +0 -0
- /package/dist/{chunk-QPD7EYGI.js.map → chunk-G2MS56KM.js.map} +0 -0
- /package/dist/{chunk-FFTGLWHI.js.map → chunk-GH7IKABD.js.map} +0 -0
- /package/dist/{chunk-RC2TVYY2.js.map → chunk-GYCUX3N4.js.map} +0 -0
- /package/dist/{chunk-CJYVVVOG.js.map → chunk-HEJFE3BC.js.map} +0 -0
- /package/dist/{chunk-KM4QO4LN.js.map → chunk-HLQANATZ.js.map} +0 -0
- /package/dist/{chunk-RQOUKIFS.js.map → chunk-J7RQ3RP7.js.map} +0 -0
- /package/dist/{chunk-QTHFGP5F.js.map → chunk-JITK24KX.js.map} +0 -0
- /package/dist/{chunk-EJYUAN5F.js.map → chunk-K6UXWVQ6.js.map} +0 -0
- /package/dist/{chunk-3XJITLZQ.js.map → chunk-KJ65WZHB.js.map} +0 -0
- /package/dist/{chunk-JOR4Y326.js.map → chunk-KOVQZJ27.js.map} +0 -0
- /package/dist/{chunk-O6QSBI3U.js.map → chunk-KZ4BJRGQ.js.map} +0 -0
- /package/dist/{chunk-FZPZML67.js.map → chunk-LR6LWX33.js.map} +0 -0
- /package/dist/{chunk-NTS2RCQK.js.map → chunk-NAULI3EG.js.map} +0 -0
- /package/dist/{chunk-V5W67PQV.js.map → chunk-NOKHMWMW.js.map} +0 -0
- /package/dist/{chunk-JGVW6F3Q.js.map → chunk-ODI4K32P.js.map} +0 -0
- /package/dist/{chunk-H7USCTPQ.js.map → chunk-OLD2GKQJ.js.map} +0 -0
- /package/dist/{chunk-D7HOJFDS.js.map → chunk-ONSEODO2.js.map} +0 -0
- /package/dist/{chunk-R3YMWUF3.js.map → chunk-P3IAZQPS.js.map} +0 -0
- /package/dist/{chunk-7KC6LT7U.js.map → chunk-PSQ347YP.js.map} +0 -0
- /package/dist/{chunk-U6OQ7GWU.js.map → chunk-QFKNIKUF.js.map} +0 -0
- /package/dist/{chunk-2DFXIJPZ.js.map → chunk-QZMGZBTF.js.map} +0 -0
- /package/dist/{chunk-NSFHMGOF.js.map → chunk-SKJM4PKE.js.map} +0 -0
- /package/dist/{chunk-T7R42MWB.js.map → chunk-STSORBX5.js.map} +0 -0
- /package/dist/{chunk-ICA5SCIT.js.map → chunk-T765HQ5U.js.map} +0 -0
- /package/dist/{chunk-RFEQ7DQN.js.map → chunk-TDG5NZAZ.js.map} +0 -0
- /package/dist/{chunk-2S6PPGIR.js.map → chunk-TWYYUMYO.js.map} +0 -0
- /package/dist/{chunk-U6JZGQXC.js.map → chunk-TZ7ZA2LM.js.map} +0 -0
- /package/dist/{chunk-JIB3UUYV.js.map → chunk-UH2VY2QQ.js.map} +0 -0
- /package/dist/{chunk-X5XK6WWV.js.map → chunk-VHQNJW4Q.js.map} +0 -0
- /package/dist/{chunk-3IA2SUWM.js.map → chunk-WRVKI6ZO.js.map} +0 -0
- /package/dist/{chunk-2CWCJYT3.js.map → chunk-XZLCAL5O.js.map} +0 -0
- /package/dist/{chunk-W7FZ7ZZE.js.map → chunk-Z6EFSXU3.js.map} +0 -0
- /package/dist/{chunk-GRX5BE73.js.map → chunk-ZNCCX7P6.js.map} +0 -0
- /package/dist/{entity-canonical-id-migration-74IDJFPB.js.map → entity-canonical-id-migration-46EMEXTB.js.map} +0 -0
- /package/dist/{resolution-RWIGFH2W.js.map → resolution-4QPPLDEN.js.map} +0 -0
package/dist/who-knows.js
CHANGED
|
@@ -9,15 +9,15 @@ import {
|
|
|
9
9
|
loadWhoKnowsEntities,
|
|
10
10
|
tokenizeTopic,
|
|
11
11
|
validateWhoKnowsInput
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-TWYYUMYO.js";
|
|
13
|
+
import "./chunk-XZMQLON4.js";
|
|
14
14
|
import "./chunk-QGVCFVX6.js";
|
|
15
15
|
import "./chunk-UHVXE24Y.js";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-FDO7ITP6.js";
|
|
17
17
|
import "./chunk-G6OFEGUR.js";
|
|
18
18
|
import "./chunk-QFZYIUMQ.js";
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
19
|
+
import "./chunk-XZLCAL5O.js";
|
|
20
|
+
import "./chunk-J7RQ3RP7.js";
|
|
21
21
|
import "./chunk-ZMEEOLQG.js";
|
|
22
22
|
import "./chunk-IOBQMVVL.js";
|
|
23
23
|
import "./chunk-TJV5HGSC.js";
|
|
@@ -48,15 +48,15 @@ import "./chunk-3ONXXHQO.js";
|
|
|
48
48
|
import "./chunk-4LZ7SVKM.js";
|
|
49
49
|
import "./chunk-YHTG64XV.js";
|
|
50
50
|
import "./chunk-3WU7XOFN.js";
|
|
51
|
-
import "./chunk-
|
|
52
|
-
import "./chunk-
|
|
51
|
+
import "./chunk-E3LGAZJC.js";
|
|
52
|
+
import "./chunk-HLQANATZ.js";
|
|
53
53
|
import "./chunk-5WITETWU.js";
|
|
54
54
|
import "./chunk-6CIAGZ6X.js";
|
|
55
55
|
import "./chunk-P4GUQSK3.js";
|
|
56
56
|
import "./chunk-G7D6GZ5J.js";
|
|
57
57
|
import "./chunk-7VLBZKNB.js";
|
|
58
58
|
import "./chunk-Y33KJ556.js";
|
|
59
|
-
import "./chunk-
|
|
59
|
+
import "./chunk-ONSEODO2.js";
|
|
60
60
|
import "./chunk-FZF7JX76.js";
|
|
61
61
|
import "./chunk-AF2XMJKD.js";
|
|
62
62
|
import "./chunk-OR42ZI54.js";
|
|
@@ -76,7 +76,7 @@ import "./chunk-4WCLZBM2.js";
|
|
|
76
76
|
import "./chunk-YCVB7X56.js";
|
|
77
77
|
import "./chunk-PQVCH2AE.js";
|
|
78
78
|
import "./chunk-EMMUQUHF.js";
|
|
79
|
-
import "./chunk-
|
|
79
|
+
import "./chunk-QIPRDRGM.js";
|
|
80
80
|
import "./chunk-YBA52OKG.js";
|
|
81
81
|
import "./chunk-X26YOFGS.js";
|
|
82
82
|
import "./chunk-BT7NVCML.js";
|
|
@@ -107,10 +107,10 @@ import "./chunk-VUFL7X3H.js";
|
|
|
107
107
|
import "./chunk-MOWZCAKS.js";
|
|
108
108
|
import "./chunk-X4OZMANG.js";
|
|
109
109
|
import "./chunk-R2MBW2S4.js";
|
|
110
|
-
import "./chunk-
|
|
110
|
+
import "./chunk-NAULI3EG.js";
|
|
111
111
|
import "./chunk-RBOJCG4T.js";
|
|
112
112
|
import "./chunk-7CT3AI52.js";
|
|
113
|
-
import "./chunk-
|
|
113
|
+
import "./chunk-XSRZM6CQ.js";
|
|
114
114
|
import "./chunk-42JKGUFJ.js";
|
|
115
115
|
import "./chunk-QUIRIG2P.js";
|
|
116
116
|
import "./chunk-6KH5NLQS.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remnic/core",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.192",
|
|
4
4
|
"description": "Framework-agnostic Remnic memory engine — orchestrator, storage, extraction, search, trust zones",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -3426,7 +3426,7 @@
|
|
|
3426
3426
|
"core"
|
|
3427
3427
|
],
|
|
3428
3428
|
"peerDependencies": {
|
|
3429
|
-
"@remnic/coding-graph": "^10.0.
|
|
3429
|
+
"@remnic/coding-graph": "^10.0.192"
|
|
3430
3430
|
},
|
|
3431
3431
|
"peerDependenciesMeta": {
|
|
3432
3432
|
"@remnic/coding-graph": {
|
|
@@ -470,3 +470,84 @@ test("#3389 a debounce-off deferred retry re-arms after a transient write failur
|
|
|
470
470
|
"a failed deferred save must re-arm a retry even with debounce off",
|
|
471
471
|
);
|
|
472
472
|
});
|
|
473
|
+
|
|
474
|
+
// COS-825: the observe path needs a subset barrier — the sessions it just
|
|
475
|
+
// admitted must land durably before the ack, but OTHER dirty sessions keep
|
|
476
|
+
// their steady-state deferral instead of being forced by every observe.
|
|
477
|
+
test("COS-825 a forced key writes despite the defer window", async () => {
|
|
478
|
+
const storage = new DeferStorage(emptyState());
|
|
479
|
+
const entries = new Map<string, BufferEntryState>([["big", bigEntry()]]);
|
|
480
|
+
const peek = (key: string) => entries.get(key);
|
|
481
|
+
const persistence = new BufferSessionPersistence();
|
|
482
|
+
let now = 1_000;
|
|
483
|
+
const clock = () => now;
|
|
484
|
+
|
|
485
|
+
persistence.markDirty("big");
|
|
486
|
+
await persistence.persist(storage, emptyState(), peek, undefined, { now: clock, allowDeferral: true });
|
|
487
|
+
persistence.markDirty("big");
|
|
488
|
+
now += 1_000; // still inside the defer interval
|
|
489
|
+
await persistence.persist(storage, emptyState(), peek, undefined, {
|
|
490
|
+
now: clock,
|
|
491
|
+
allowDeferral: true,
|
|
492
|
+
forceKeys: new Set(["big"]),
|
|
493
|
+
});
|
|
494
|
+
assert.equal(storage.writeCount("big"), 2, "a forced key is written now");
|
|
495
|
+
assert.equal(persistence.hasPending(), false);
|
|
496
|
+
});
|
|
497
|
+
|
|
498
|
+
test("COS-825 a subset barrier defers unforced large sessions and writes forced keys", async () => {
|
|
499
|
+
const storage = new DeferStorage(emptyState());
|
|
500
|
+
const entries = new Map<string, BufferEntryState>([
|
|
501
|
+
["big", bigEntry()],
|
|
502
|
+
["small", { turns: [makeTurn("small", "tiny")], lastExtractionAt: null, extractionCount: 0 }],
|
|
503
|
+
]);
|
|
504
|
+
const peek = (key: string) => entries.get(key);
|
|
505
|
+
const persistence = new BufferSessionPersistence();
|
|
506
|
+
let now = 1_000;
|
|
507
|
+
const clock = () => now;
|
|
508
|
+
|
|
509
|
+
persistence.markDirty("big");
|
|
510
|
+
await persistence.persist(storage, emptyState(), peek, undefined, { now: clock, allowDeferral: true });
|
|
511
|
+
persistence.markDirty("big");
|
|
512
|
+
persistence.markDirty("small");
|
|
513
|
+
now += 1_000;
|
|
514
|
+
const outcome = await persistence.persist(storage, emptyState(), peek, undefined, {
|
|
515
|
+
now: clock,
|
|
516
|
+
allowDeferral: true,
|
|
517
|
+
forceKeys: new Set(["small"]),
|
|
518
|
+
});
|
|
519
|
+
assert.equal(storage.writeCount("small"), 1, "the admitted session is durable");
|
|
520
|
+
assert.equal(storage.writeCount("big"), 1, "the unrelated large session is not forced");
|
|
521
|
+
assert.deepEqual(outcome.deferred, ["big"]);
|
|
522
|
+
assert.ok(outcome.deferredRetryDelayMs !== undefined, "the deferred tail arms a retry");
|
|
523
|
+
assert.equal(persistence.hasPending(), true, "the deferred session stays pending");
|
|
524
|
+
});
|
|
525
|
+
|
|
526
|
+
test("COS-825 SmartBuffer: the observe flush forces only the admitted sessions", async () => {
|
|
527
|
+
const state = emptyState();
|
|
528
|
+
state.entries = { big: bigEntry() };
|
|
529
|
+
const storage = new DeferStorage(state);
|
|
530
|
+
const buffer = new SmartBuffer(
|
|
531
|
+
parseConfig({ triggerMode: "every_n", bufferMaxTurns: 1_000, bufferSaveDebounceMs: 0 }),
|
|
532
|
+
storage,
|
|
533
|
+
);
|
|
534
|
+
|
|
535
|
+
await buffer.addTurn("big", makeTurn("big", "more")); // first write lands
|
|
536
|
+
await buffer.addTurn("big", makeTurn("big", "more")); // deferred (large + recent)
|
|
537
|
+
await buffer.addTurn("small", makeTurn("small", "a")); // admitted session, inline save writes it
|
|
538
|
+
assert.equal(storage.writeCount("small"), 1, "the admitted session landed durably");
|
|
539
|
+
assert.equal(storage.writeCount("big"), 1);
|
|
540
|
+
|
|
541
|
+
// The observe path's subset barrier: force the admitted key only. Nothing
|
|
542
|
+
// may force the deferred large session here.
|
|
543
|
+
await buffer.flushPendingSave({
|
|
544
|
+
throwOnFailure: true,
|
|
545
|
+
allowDeferral: true,
|
|
546
|
+
forceKeys: new Set(["small"]),
|
|
547
|
+
});
|
|
548
|
+
assert.equal(storage.writeCount("big"), 1, "the deferred large session was not forced");
|
|
549
|
+
|
|
550
|
+
// The deferred tail still lands on a real barrier.
|
|
551
|
+
await buffer.save();
|
|
552
|
+
assert.equal(storage.writeCount("big"), 2, "a full barrier flushes the deferred session");
|
|
553
|
+
});
|
|
@@ -76,6 +76,13 @@ export interface BufferPersistOptions {
|
|
|
76
76
|
* memory until the next pass or a forced flush.
|
|
77
77
|
*/
|
|
78
78
|
allowDeferral?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* COS-825 subset barrier: sessions in this set always write now, even on an
|
|
81
|
+
* allowDeferral pass. The observe path forces exactly the sessions it
|
|
82
|
+
* admitted so their turns are durable before the ack, while other dirty
|
|
83
|
+
* sessions keep their rate-limited cadence.
|
|
84
|
+
*/
|
|
85
|
+
forceKeys?: ReadonlySet<string>;
|
|
79
86
|
}
|
|
80
87
|
|
|
81
88
|
/** Approximate serialized size of one session file without stringifying it. */
|
|
@@ -205,7 +212,7 @@ export class BufferSessionPersistence {
|
|
|
205
212
|
this.markDeleted(key);
|
|
206
213
|
continue;
|
|
207
214
|
}
|
|
208
|
-
if (opts?.allowDeferral === true && key !== reconcile?.key) {
|
|
215
|
+
if (opts?.allowDeferral === true && !opts.forceKeys?.has(key) && key !== reconcile?.key) {
|
|
209
216
|
const last = this.lastPersistedAt.get(key);
|
|
210
217
|
if (
|
|
211
218
|
last !== undefined &&
|
package/src/buffer.ts
CHANGED
|
@@ -250,9 +250,9 @@ export class SmartBuffer {
|
|
|
250
250
|
|
|
251
251
|
private async saveUnlocked(
|
|
252
252
|
reconcile?: { key: string; drained: import("./buffer-turn-helpers.js").DrainedTurnSets },
|
|
253
|
-
opts?: { allowDeferral?: boolean },
|
|
253
|
+
opts?: { allowDeferral?: boolean; forceKeys?: ReadonlySet<string> },
|
|
254
254
|
): Promise<import("./buffer-persistence.js").BufferPersistOutcome> {
|
|
255
|
-
const outcome = await this.persistence.persist(this.storage, this.state, (key) => this.peekEntry(key) ?? undefined, reconcile, { allowDeferral: opts?.allowDeferral === true });
|
|
255
|
+
const outcome = await this.persistence.persist(this.storage, this.state, (key) => this.peekEntry(key) ?? undefined, reconcile, { allowDeferral: opts?.allowDeferral === true, forceKeys: opts?.forceKeys });
|
|
256
256
|
const { handedOver, drainedTurns } = outcome;
|
|
257
257
|
// A drain tombstone: the turns the drain extracted leave this copy too,
|
|
258
258
|
// so a stale owner never extracts (or persists) them a second time.
|
|
@@ -431,7 +431,12 @@ export class SmartBuffer {
|
|
|
431
431
|
* proceeding to extract_now on a non-durable triggering turn. Default false
|
|
432
432
|
* keeps the fail-open behavior for the timer/shutdown callers.
|
|
433
433
|
*/
|
|
434
|
-
async flushPendingSave(opts?: {
|
|
434
|
+
async flushPendingSave(opts?: {
|
|
435
|
+
throwOnFailure?: boolean;
|
|
436
|
+
allowDeferral?: boolean;
|
|
437
|
+
/** COS-825 subset barrier: these sessions write now even on a deferral pass. */
|
|
438
|
+
forceKeys?: ReadonlySet<string>;
|
|
439
|
+
}): Promise<void> {
|
|
435
440
|
if (this.saveTimer) {
|
|
436
441
|
clearTimeout(this.saveTimer);
|
|
437
442
|
this.saveTimer = null;
|
|
@@ -446,7 +451,7 @@ export class SmartBuffer {
|
|
|
446
451
|
// writes). resetToEmpty-only deletions also land here without a
|
|
447
452
|
// pending-save flag.
|
|
448
453
|
if (!this.pendingSave && !this.persistence.hasPending()) return;
|
|
449
|
-
const outcome = await this.saveUnlocked(undefined, { allowDeferral: opts?.allowDeferral === true });
|
|
454
|
+
const outcome = await this.saveUnlocked(undefined, { allowDeferral: opts?.allowDeferral === true, forceKeys: opts?.forceKeys });
|
|
450
455
|
// Clear the pending flag INSIDE the same serialized mutation as the
|
|
451
456
|
// write (issue #1909 review): an addTurn interleaving between the
|
|
452
457
|
// write and the clear would lose its re-armed timer. Deferred
|
package/src/config.test.ts
CHANGED
|
@@ -3161,3 +3161,12 @@ test("parseConfig: extractionQueueConcurrency defaults to bounded-parallel 2 and
|
|
|
3161
3161
|
);
|
|
3162
3162
|
}
|
|
3163
3163
|
});
|
|
3164
|
+
|
|
3165
|
+
test("parseConfig harmonicGraphCacheTtlMs defaults and validates (COS-825)", () => {
|
|
3166
|
+
assert.equal(parseConfig({}).harmonicGraphCacheTtlMs, 300_000);
|
|
3167
|
+
assert.equal(parseConfig({ harmonicGraphCacheTtlMs: 5_000 }).harmonicGraphCacheTtlMs, 5_000);
|
|
3168
|
+
assert.equal(parseConfig({ harmonicGraphCacheTtlMs: 3_600_000 }).harmonicGraphCacheTtlMs, 3_600_000);
|
|
3169
|
+
assert.throws(() => parseConfig({ harmonicGraphCacheTtlMs: 999 }));
|
|
3170
|
+
assert.throws(() => parseConfig({ harmonicGraphCacheTtlMs: 3_600_001 }));
|
|
3171
|
+
assert.throws(() => parseConfig({ harmonicGraphCacheTtlMs: 2.5 }));
|
|
3172
|
+
});
|
package/src/config.ts
CHANGED
|
@@ -1760,12 +1760,7 @@ export function parseConfig(
|
|
|
1760
1760
|
),
|
|
1761
1761
|
sessionObserverBands,
|
|
1762
1762
|
injectQuestions: cfg.injectQuestions === true,
|
|
1763
|
-
commitmentDecayDays: parseIntegerAtLeast(
|
|
1764
|
-
cfg.commitmentDecayDays,
|
|
1765
|
-
90,
|
|
1766
|
-
1,
|
|
1767
|
-
"commitmentDecayDays",
|
|
1768
|
-
),
|
|
1763
|
+
commitmentDecayDays: parseIntegerAtLeast(cfg.commitmentDecayDays, 90, 1, "commitmentDecayDays"),
|
|
1769
1764
|
workspaceDir:
|
|
1770
1765
|
typeof cfg.workspaceDir === "string" && cfg.workspaceDir.length > 0
|
|
1771
1766
|
? expandTildePath(cfg.workspaceDir)
|
|
@@ -2480,6 +2475,8 @@ export function parseConfig(
|
|
|
2480
2475
|
memoryPoisoningDefenseEnabled: cfg.memoryPoisoningDefenseEnabled === true,
|
|
2481
2476
|
memoryRedTeamBenchEnabled: cfg.memoryRedTeamBenchEnabled === true,
|
|
2482
2477
|
harmonicRetrievalEnabled: cfg.harmonicRetrievalEnabled === true,
|
|
2478
|
+
harmonicGraphCacheTtlMs: parseIntegerInClosedRange(
|
|
2479
|
+
cfg.harmonicGraphCacheTtlMs, 1_000, 3_600_000, 300_000, "harmonicGraphCacheTtlMs"),
|
|
2483
2480
|
episodicContextEnabled: cfg.episodicContextEnabled === true,
|
|
2484
2481
|
abstractionAnchorsEnabled: cfg.abstractionAnchorsEnabled === true,
|
|
2485
2482
|
verifiedRecallEnabled: cfg.verifiedRecallEnabled === true,
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* COS-825 hot-path fixes for the entity recall section.
|
|
3
|
+
*
|
|
4
|
+
* Two production-profile hotspots, each pinned by a test:
|
|
5
|
+
*
|
|
6
|
+
* 1. `readAllEntityFiles` keyed its cache on the memory-status version, which
|
|
7
|
+
* churns with every plain memory write. Under observe traffic the cache was
|
|
8
|
+
* busted on every recall, so the whole entity store was re-read (and
|
|
9
|
+
* re-decrypted) per recall. The cache is now validated by an entities-dir
|
|
10
|
+
* listing snapshot (name, mtime, size) plus the entity-mutation version,
|
|
11
|
+
* so unrelated memory writes no longer force a re-read while any entity
|
|
12
|
+
* file change — including one made without a version bump — does.
|
|
13
|
+
*
|
|
14
|
+
* 2. `readMemorySnippet` normalized (and `compactLine` re-normalized) the FULL
|
|
15
|
+
* memory content, then grapheme-truncated it to 180 units. `compactLine`
|
|
16
|
+
* now pre-slices its input to a bounded prefix before normalization, which
|
|
17
|
+
* bounds the regex + grapheme work per snippet. The pin below asserts the
|
|
18
|
+
* truncated output is unchanged for long plain-text content.
|
|
19
|
+
*/
|
|
20
|
+
import assert from "node:assert/strict";
|
|
21
|
+
import { mkdtemp, readdir, readFile, rm, utimes, writeFile } from "node:fs/promises";
|
|
22
|
+
import { tmpdir } from "node:os";
|
|
23
|
+
import path from "node:path";
|
|
24
|
+
import test from "node:test";
|
|
25
|
+
|
|
26
|
+
import { buildEntityRecallSection } from "./entity-retrieval.js";
|
|
27
|
+
import { clearMemoryCache, entityCacheStats } from "./memory-cache.js";
|
|
28
|
+
import { StorageManager } from "./storage.js";
|
|
29
|
+
import { parseConfig } from "./config.js";
|
|
30
|
+
import type { TranscriptEntry } from "./types.js";
|
|
31
|
+
|
|
32
|
+
async function withDir(run: (memoryDir: string, storage: StorageManager) => Promise<void>) {
|
|
33
|
+
const memoryDir = await mkdtemp(path.join(tmpdir(), "remnic-entity-hot-"));
|
|
34
|
+
clearMemoryCache();
|
|
35
|
+
try {
|
|
36
|
+
const storage = new StorageManager(memoryDir);
|
|
37
|
+
await storage.ensureDirectories();
|
|
38
|
+
await run(memoryDir, storage);
|
|
39
|
+
} finally {
|
|
40
|
+
clearMemoryCache();
|
|
41
|
+
await rm(memoryDir, { recursive: true, force: true });
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async function entityFilePath(memoryDir: string): Promise<string> {
|
|
46
|
+
const dir = path.join(memoryDir, "entities");
|
|
47
|
+
const entries = (await readdir(dir)).filter((name) => name.endsWith(".md"));
|
|
48
|
+
assert.equal(entries.length, 1, "expected exactly one entity file in the fixture");
|
|
49
|
+
return path.join(dir, entries[0]!);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
test("a plain memory write does not force an entity store re-read (COS-825)", async () => {
|
|
53
|
+
await withDir(async (_memoryDir, storage) => {
|
|
54
|
+
await storage.writeEntity("Alice", "person", ["Alice keeps the ledger."]);
|
|
55
|
+
await storage.readAllEntityFiles();
|
|
56
|
+
const afterFirstRead = { ...entityCacheStats };
|
|
57
|
+
assert.equal(afterFirstRead.rebuilds, 1, "first read rebuilds");
|
|
58
|
+
|
|
59
|
+
// A plain fact write bumps memory-status + corpus versions and the mention
|
|
60
|
+
// epoch, but touches no entity file.
|
|
61
|
+
await storage.writeMemory("fact", "an unrelated fact about whales", { source: "test" });
|
|
62
|
+
const entities = await storage.readAllEntityFiles();
|
|
63
|
+
assert.equal(entityCacheStats.rebuilds, afterFirstRead.rebuilds, "no re-read after a memory-only write");
|
|
64
|
+
assert.equal(entityCacheStats.hits, afterFirstRead.hits + 1);
|
|
65
|
+
assert.ok(entities.some((entity) => entity.name === "Alice"));
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test("an entity file edit invalidates by listing snapshot even without a version bump (COS-825)", async () => {
|
|
70
|
+
await withDir(async (memoryDir, storage) => {
|
|
71
|
+
await storage.writeEntity("Alice", "person", ["Alice keeps the ledger."]);
|
|
72
|
+
await storage.readAllEntityFiles();
|
|
73
|
+
const afterFirstRead = { ...entityCacheStats };
|
|
74
|
+
|
|
75
|
+
// Out-of-band edit: no storage-layer write, no version bump. The listing
|
|
76
|
+
// snapshot (mtime + size) is the only signal.
|
|
77
|
+
const filePath = await entityFilePath(memoryDir);
|
|
78
|
+
const raw = await readFile(filePath, "utf8");
|
|
79
|
+
await writeFile(filePath, raw.replace("Alice keeps the ledger.", "Alice keeps the DOUBLE ledger."));
|
|
80
|
+
await utimes(filePath, new Date(), new Date(Date.now() + 5_000));
|
|
81
|
+
|
|
82
|
+
const entities = await storage.readAllEntityFiles();
|
|
83
|
+
assert.equal(entityCacheStats.rebuilds, afterFirstRead.rebuilds + 1, "the edit forces one rebuild");
|
|
84
|
+
const alice = entities.find((entity) => entity.name === "Alice");
|
|
85
|
+
assert.ok(alice, "Alice is still present");
|
|
86
|
+
assert.ok(
|
|
87
|
+
alice.facts.some((fact) => fact.includes("DOUBLE ledger")),
|
|
88
|
+
"the rebuilt entity carries the edited fact",
|
|
89
|
+
);
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test("a long memory still yields the exact 180-unit snippet (COS-825 pre-slice pin)", async () => {
|
|
94
|
+
await withDir(async (memoryDir, storage) => {
|
|
95
|
+
const entityRef = await storage.writeEntity("Bob", "person", []);
|
|
96
|
+
const longBody = `${"deployment note. ".repeat(400)}final marker`;
|
|
97
|
+
await storage.writeMemory("fact", longBody, { source: "test", entityRef });
|
|
98
|
+
const transcriptEntries: TranscriptEntry[] = [];
|
|
99
|
+
const section = await buildEntityRecallSection({
|
|
100
|
+
storage,
|
|
101
|
+
config: parseConfig({ memoryDir, workspaceDir: path.join(memoryDir, "workspace") }),
|
|
102
|
+
query: "What is the deployment note for Bob?",
|
|
103
|
+
recentTurns: 0,
|
|
104
|
+
maxHints: 2,
|
|
105
|
+
maxSupportingFacts: 2,
|
|
106
|
+
maxRelatedEntities: 2,
|
|
107
|
+
maxChars: 10_000,
|
|
108
|
+
transcriptEntries,
|
|
109
|
+
});
|
|
110
|
+
assert.ok(section, "the section builds");
|
|
111
|
+
const normalized = longBody.replace(/\s+/g, " ").trim();
|
|
112
|
+
const expected = `${normalized.slice(0, 179)}…`;
|
|
113
|
+
assert.match(section, new RegExp(expected.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")));
|
|
114
|
+
assert.doesNotMatch(section, /final marker/, "content past the 180-unit budget stays out");
|
|
115
|
+
});
|
|
116
|
+
});
|
package/src/entity-retrieval.ts
CHANGED
|
@@ -112,9 +112,26 @@ export interface BuildEntityRecallSectionOptions {
|
|
|
112
112
|
function uniqueStrings(values: string[]): string[] {
|
|
113
113
|
return [...new Set(values.map((value) => value.trim()).filter((value) => value.length > 0))];
|
|
114
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* COS-825: the output only depends on the first maxLength display units, so
|
|
117
|
+
* normalization runs over a bounded prefix. Inputs longer than the prefix
|
|
118
|
+
* always take the truncate path (no short-circuit), so ordinary content keeps
|
|
119
|
+
* its exact output; only content whose first 4 KiB collapses to under one
|
|
120
|
+
* line of text (pathological leading whitespace) can differ.
|
|
121
|
+
*/
|
|
122
|
+
const COMPACT_LINE_PRESLICE_UNITS = 4_096;
|
|
123
|
+
|
|
115
124
|
function compactLine(value: string, maxLength: number = 220): string {
|
|
116
|
-
|
|
117
|
-
|
|
125
|
+
let sliced = value.length > COMPACT_LINE_PRESLICE_UNITS ? value.slice(0, COMPACT_LINE_PRESLICE_UNITS) : value;
|
|
126
|
+
// Never split a surrogate pair at the prefix boundary: a lone high surrogate
|
|
127
|
+
// would survive normalization and render as a malformed snippet (COS-825
|
|
128
|
+
// review round 3).
|
|
129
|
+
if (sliced.length > 0) {
|
|
130
|
+
const last = sliced.charCodeAt(sliced.length - 1);
|
|
131
|
+
if (last >= 0xd800 && last <= 0xdbff && sliced.length < value.length) sliced = sliced.slice(0, -1);
|
|
132
|
+
}
|
|
133
|
+
const normalized = sliced.replace(/\s+/g, " ").trim();
|
|
134
|
+
if (normalized.length <= maxLength && sliced === value) return normalized;
|
|
118
135
|
return `${truncateGraphemeSafe(normalized, maxLength - 1).trimEnd()}…`;
|
|
119
136
|
}
|
|
120
137
|
function dedupeHintSnippetsByText(snippets: EntityHintSnippet[]): EntityHintSnippet[] {
|
|
@@ -724,8 +741,9 @@ function resolveRecentTurnCandidates(
|
|
|
724
741
|
}
|
|
725
742
|
|
|
726
743
|
async function readMemorySnippet(memory: MemoryFile): Promise<string> {
|
|
727
|
-
|
|
728
|
-
|
|
744
|
+
// compactLine normalizes (bounded pre-slice, COS-825); a pre-normalized
|
|
745
|
+
// full-content pass here is redundant work on every entity-linked memory.
|
|
746
|
+
return compactLine(memory.content, 180);
|
|
729
747
|
}
|
|
730
748
|
|
|
731
749
|
async function buildHintSnippets(
|
|
@@ -43,7 +43,7 @@ async function withDir(run: (memoryDir: string, storage: StorageManager) => Prom
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
const read = (memoryDir: string, extra: { nowMs?: number } = {}) =>
|
|
46
|
+
const read = (memoryDir: string, extra: { nowMs?: number; ttlMs?: number } = {}) =>
|
|
47
47
|
readProjectedHarmonicGraph({ memoryDir, anchorsEnabled: true, useCache: true, ...extra });
|
|
48
48
|
|
|
49
49
|
test("a second cached read does no file reads", async () => {
|
|
@@ -274,16 +274,35 @@ test("a read past the TTL answers from the stale graph and refreshes behind it",
|
|
|
274
274
|
const clock = t.mock.method(Date, "now", () => start);
|
|
275
275
|
assert.equal((await read(memoryDir)).nodes.length, 1);
|
|
276
276
|
await rm(nodeFile, { force: true });
|
|
277
|
-
clock.mock.mockImplementation(() => start +
|
|
277
|
+
clock.mock.mockImplementation(() => start + 299_000);
|
|
278
278
|
assert.equal((await read(memoryDir)).nodes.length, 1, "still cached inside the TTL");
|
|
279
279
|
const missesBefore = harmonicGraphCacheStats.misses;
|
|
280
|
-
clock.mock.mockImplementation(() => start +
|
|
280
|
+
clock.mock.mockImplementation(() => start + 301_000);
|
|
281
281
|
assert.equal((await read(memoryDir)).nodes.length, 1, "past the TTL the caller does not wait for a rebuild");
|
|
282
282
|
assert.equal(harmonicGraphCacheStats.misses, missesBefore + 1, "a refresh was started");
|
|
283
283
|
await until(async () => (await read(memoryDir)).nodes.length === 0);
|
|
284
284
|
});
|
|
285
285
|
});
|
|
286
286
|
|
|
287
|
+
test("a custom ttlMs moves the refresh boundary (COS-825)", async (t) => {
|
|
288
|
+
await withDir(async (memoryDir, storage) => {
|
|
289
|
+
const memory = await storage.writeMemory("fact", "theta ttl fact", { source: "test" });
|
|
290
|
+
const nodeFile = await recordAbstractionNode({ memoryDir, node: node("n1", "theta ttl fact", [memory.id]) });
|
|
291
|
+
const start = Date.now();
|
|
292
|
+
const clock = t.mock.method(Date, "now", () => start);
|
|
293
|
+
assert.equal((await read(memoryDir, { ttlMs: 2_000 })).nodes.length, 1);
|
|
294
|
+
await rm(nodeFile, { force: true });
|
|
295
|
+
clock.mock.mockImplementation(() => start + 1_999);
|
|
296
|
+
const before = { ...harmonicGraphCacheStats };
|
|
297
|
+
assert.equal((await read(memoryDir, { ttlMs: 2_000 })).nodes.length, 1, "fresh inside the custom TTL");
|
|
298
|
+
assert.equal(harmonicGraphCacheStats.misses, before.misses, "no refresh inside the custom TTL");
|
|
299
|
+
clock.mock.mockImplementation(() => start + 2_001);
|
|
300
|
+
assert.equal((await read(memoryDir, { ttlMs: 2_000 })).nodes.length, 1, "past the custom TTL the stale graph is served");
|
|
301
|
+
assert.equal(harmonicGraphCacheStats.misses, before.misses + 1, "a refresh was started at the custom TTL");
|
|
302
|
+
await until(async () => (await read(memoryDir, { ttlMs: 2_000 })).nodes.length === 0);
|
|
303
|
+
});
|
|
304
|
+
});
|
|
305
|
+
|
|
287
306
|
test("a graph past the stale limit is rebuilt before it is served", async (t) => {
|
|
288
307
|
await withDir(async (memoryDir, storage) => {
|
|
289
308
|
const memory = await storage.writeMemory("fact", "kappa limit fact", { source: "test" });
|
|
@@ -292,8 +311,8 @@ test("a graph past the stale limit is rebuilt before it is served", async (t) =>
|
|
|
292
311
|
const clock = t.mock.method(Date, "now", () => start);
|
|
293
312
|
assert.equal((await read(memoryDir)).nodes.length, 1);
|
|
294
313
|
await rm(nodeFile, { force: true });
|
|
295
|
-
clock.mock.mockImplementation(() => start +
|
|
296
|
-
assert.equal((await read(memoryDir)).nodes.length, 0, "the stale window ends 300 s after the TTL, at
|
|
314
|
+
clock.mock.mockImplementation(() => start + 601_000);
|
|
315
|
+
assert.equal((await read(memoryDir)).nodes.length, 0, "the stale window ends 300 s after the 300 s TTL, at 600 s");
|
|
297
316
|
});
|
|
298
317
|
});
|
|
299
318
|
|
|
@@ -305,7 +324,7 @@ test("a graph is still served stale one millisecond before the stale window ends
|
|
|
305
324
|
const clock = t.mock.method(Date, "now", () => start);
|
|
306
325
|
assert.equal((await read(memoryDir)).nodes.length, 1);
|
|
307
326
|
await rm(nodeFile, { force: true });
|
|
308
|
-
clock.mock.mockImplementation(() => start +
|
|
327
|
+
clock.mock.mockImplementation(() => start + 599_999);
|
|
309
328
|
assert.equal((await read(memoryDir)).nodes.length, 1, "up to 300 s past the TTL the stale graph is served");
|
|
310
329
|
await settleHarmonicGraphBuilds();
|
|
311
330
|
});
|
|
@@ -406,18 +425,18 @@ test("a failing refresh is retried at most once per TTL, not on every stale read
|
|
|
406
425
|
const clock = t.mock.method(Date, "now", () => start);
|
|
407
426
|
assert.equal((await read(memoryDir)).nodes.length, 1);
|
|
408
427
|
const restore = await breakNodeStore(memoryDir);
|
|
409
|
-
clock.mock.mockImplementation(() => start +
|
|
428
|
+
clock.mock.mockImplementation(() => start + 301_000);
|
|
410
429
|
const missesBefore = harmonicGraphCacheStats.misses;
|
|
411
430
|
assert.equal((await read(memoryDir)).nodes.length, 1, "the stale graph is still served");
|
|
412
431
|
// The failing build bumps `misses` before it reads the broken store: wait for it to settle, not for a time.
|
|
413
432
|
await settleHarmonicGraphBuilds();
|
|
414
433
|
assert.equal(harmonicGraphCacheStats.misses, missesBefore + 1, "one refresh was started");
|
|
415
|
-
clock.mock.mockImplementation(() => start +
|
|
434
|
+
clock.mock.mockImplementation(() => start + 310_000);
|
|
416
435
|
for (let i = 0; i < 5; i += 1) await read(memoryDir);
|
|
417
436
|
await settleHarmonicGraphBuilds();
|
|
418
437
|
assert.equal(harmonicGraphCacheStats.misses, missesBefore + 1, "no new build inside the backoff");
|
|
419
438
|
await restore();
|
|
420
|
-
clock.mock.mockImplementation(() => start +
|
|
439
|
+
clock.mock.mockImplementation(() => start + 602_000);
|
|
421
440
|
await read(memoryDir);
|
|
422
441
|
await until(async () => harmonicGraphCacheStats.misses === missesBefore + 2);
|
|
423
442
|
});
|
|
@@ -579,7 +579,15 @@ async function buildExpiringHarmonicGraph(options: {
|
|
|
579
579
|
return { nodes: projectedNodes, anchors, validUntilMs };
|
|
580
580
|
}
|
|
581
581
|
|
|
582
|
-
|
|
582
|
+
/**
|
|
583
|
+
* Default time-to-live for a cached graph whose stamp is unchanged. Writes
|
|
584
|
+
* still invalidate immediately through the stamp; the TTL only bounds the
|
|
585
|
+
* wall-clock re-check. COS-825 moved the default from 30 s to 300 s: on a
|
|
586
|
+
* large store under observe traffic the stamp churns anyway, and a short TTL
|
|
587
|
+
* on top of it forced a whole-corpus rebuild every 30 s. Configurable via
|
|
588
|
+
* `harmonicGraphCacheTtlMs`.
|
|
589
|
+
*/
|
|
590
|
+
export const DEFAULT_HARMONIC_GRAPH_CACHE_TTL_MS = 300_000;
|
|
583
591
|
/**
|
|
584
592
|
* Past the TTL a graph whose stamp is unchanged is still served while a refresh runs behind it, so no
|
|
585
593
|
* recall waits for a rebuild just because the TTL lapsed. This is how long past the TTL; after it the graph is rebuilt first.
|
|
@@ -780,6 +788,10 @@ export async function readProjectedHarmonicGraph(options: {
|
|
|
780
788
|
temporalExpiredInInjection?: boolean;
|
|
781
789
|
nowMs?: number;
|
|
782
790
|
useCache?: boolean;
|
|
791
|
+
/** Cache time-to-live in ms for this read; defaults to
|
|
792
|
+
* DEFAULT_HARMONIC_GRAPH_CACHE_TTL_MS. Writes invalidate through the stamp
|
|
793
|
+
* regardless of this value. */
|
|
794
|
+
ttlMs?: number;
|
|
783
795
|
/** Per-caller bound on joining a shared build, in ms. On expiry the caller
|
|
784
796
|
* leaves with a HarmonicGraphWaitDeadlineError while the build keeps running.
|
|
785
797
|
* `0` or unset waits without a bound. Applies only on the cached path. */
|
|
@@ -798,18 +810,19 @@ export async function readProjectedHarmonicGraph(options: {
|
|
|
798
810
|
// The stamp is read BEFORE the build, so a write that lands mid-build leaves the
|
|
799
811
|
// entry stale and the next call rebuilds.
|
|
800
812
|
const stamp = readHarmonicGraphStamp(options.memoryDir, nodeStoreDir);
|
|
813
|
+
const ttlMs = options.ttlMs ?? DEFAULT_HARMONIC_GRAPH_CACHE_TTL_MS;
|
|
801
814
|
const nowMs = Date.now();
|
|
802
815
|
const hit = graphCache.get(key);
|
|
803
816
|
// A source's `invalid_at` passing changes the projection without bumping the stamp, so it ends the entry
|
|
804
817
|
// at the exact instant, however fresh the entry is.
|
|
805
|
-
if (hit && hit.stamp === stamp && nowMs < hit.validUntilMs && nowMs - hit.builtAtMs <
|
|
818
|
+
if (hit && hit.stamp === stamp && nowMs < hit.validUntilMs && nowMs - hit.builtAtMs < ttlMs + GRAPH_CACHE_MAX_STALE_MS) {
|
|
806
819
|
harmonicGraphCacheStats.hits++;
|
|
807
820
|
graphCache.delete(key);
|
|
808
821
|
graphCache.set(key, hit);
|
|
809
|
-
if (nowMs - hit.builtAtMs >=
|
|
822
|
+
if (nowMs - hit.builtAtMs >= ttlMs) {
|
|
810
823
|
harmonicGraphCacheStats.stale++;
|
|
811
824
|
const failedAtMs = refreshFailedAtMs.get(key);
|
|
812
|
-
const backingOff = failedAtMs !== undefined && nowMs - failedAtMs <
|
|
825
|
+
const backingOff = failedAtMs !== undefined && nowMs - failedAtMs < ttlMs;
|
|
813
826
|
if (graphBuilds.get(key)?.stamp !== stamp && !backingOff) {
|
|
814
827
|
startGraphBuild(key, stamp, options).promise.catch((err) => {
|
|
815
828
|
rememberRefreshFailure(key);
|
|
@@ -838,6 +851,8 @@ export async function searchHarmonicRetrieval(options: {
|
|
|
838
851
|
temporalExpiredInInjection?: boolean;
|
|
839
852
|
/** Share one projected graph between recalls until a write bumps a version sentinel (see readProjectedHarmonicGraph). */
|
|
840
853
|
useGraphCache?: boolean;
|
|
854
|
+
/** Cache time-to-live in ms for the shared graph (see readProjectedHarmonicGraph). */
|
|
855
|
+
graphCacheTtlMs?: number;
|
|
841
856
|
/** Bound on waiting for a shared graph build, in ms. Past it the search
|
|
842
857
|
* rejects with a HarmonicGraphWaitDeadlineError so a recall fails open
|
|
843
858
|
* instead of blocking on a rebuild a write storm keeps invalidating.
|
|
@@ -853,6 +868,7 @@ export async function searchHarmonicRetrieval(options: {
|
|
|
853
868
|
const graph = await readProjectedHarmonicGraph({
|
|
854
869
|
...options,
|
|
855
870
|
useCache: options.useGraphCache === true,
|
|
871
|
+
ttlMs: options.graphCacheTtlMs,
|
|
856
872
|
waitBudgetMs:
|
|
857
873
|
options.waitBudgetMs === undefined ? HARMONIC_GRAPH_WAIT_BUDGET_MS : options.waitBudgetMs,
|
|
858
874
|
});
|
|
@@ -129,3 +129,50 @@ test("hot cache: TTL expires an entry so external edits self-heal (#1902 Codex P
|
|
|
129
129
|
clearMemoryCache();
|
|
130
130
|
}
|
|
131
131
|
});
|
|
132
|
+
|
|
133
|
+
// COS-825: per-file stat snapshot so a version-mismatched entry can be
|
|
134
|
+
// validated by metadata instead of a full corpus re-read.
|
|
135
|
+
import { getHotCacheEntry, hotCacheReadStats, promoteHotCacheVersion } from "./memory-cache.js";
|
|
136
|
+
|
|
137
|
+
const STATS = new Map([["a.md", { mtimeMs: 100, size: 5 }]]);
|
|
138
|
+
|
|
139
|
+
test("hot cache: stat snapshot round-trips and promotes a patched entry", () => {
|
|
140
|
+
const dir = "/tmp/remnic-hot-unit-stats";
|
|
141
|
+
clearMemoryCache();
|
|
142
|
+
setCachedMemories(dir, [mem("a.md", "first")], 5, "", 0, STATS);
|
|
143
|
+
const entry = getHotCacheEntry(dir, "");
|
|
144
|
+
assert.ok(entry, "entry is visible for validation");
|
|
145
|
+
assert.deepEqual(entry.stats.get("a.md"), { mtimeMs: 100, size: 5 });
|
|
146
|
+
|
|
147
|
+
const promoted = promoteHotCacheVersion(dir, 6, "");
|
|
148
|
+
assert.ok(promoted, "a patched entry promotes to the current version");
|
|
149
|
+
assert.deepEqual(promoted.map((m) => m.path), ["a.md"]);
|
|
150
|
+
assert.ok(getCachedMemories(dir, 6), "after promotion the current version hits");
|
|
151
|
+
assert.equal(getCachedMemories(dir, 5), null, "the old version no longer hits");
|
|
152
|
+
clearMemoryCache();
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
test("hot cache: validation entry is keyId-scoped and absent without stats", () => {
|
|
156
|
+
const dir = "/tmp/remnic-hot-unit-stats-key";
|
|
157
|
+
clearMemoryCache();
|
|
158
|
+
setCachedMemories(dir, [mem("a.md")], 5, "keyA", 0, STATS);
|
|
159
|
+
assert.equal(getHotCacheEntry(dir, "keyB"), null, "a different key identity never validates");
|
|
160
|
+
setCachedMemories(dir, [mem("a.md")], 5, "", 0);
|
|
161
|
+
assert.equal(getHotCacheEntry(dir, ""), null, "an entry stored without stats cannot validate");
|
|
162
|
+
clearMemoryCache();
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
test("hot cache: updateCacheOnWrite drops the stat snapshot (never a false pass)", () => {
|
|
166
|
+
const dir = "/tmp/remnic-hot-unit-stats-patch";
|
|
167
|
+
clearMemoryCache();
|
|
168
|
+
setCachedMemories(dir, [mem("a.md")], 5, "", 0, STATS);
|
|
169
|
+
updateCacheOnWrite(dir, mem("a.md", "rewritten"), "");
|
|
170
|
+
assert.equal(getHotCacheEntry(dir, ""), null, "a patched entry carries no snapshot and cannot validate");
|
|
171
|
+
clearMemoryCache();
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
test("hot cache: read counters track validated hits vs full scans", () => {
|
|
175
|
+
clearMemoryCache();
|
|
176
|
+
assert.equal(hotCacheReadStats.validatedHits, 0);
|
|
177
|
+
assert.equal(hotCacheReadStats.fullScans, 0);
|
|
178
|
+
});
|