@remnic/core 10.0.110 → 10.0.112
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 +69 -67
- package/dist/access-cli.js +69 -67
- package/dist/access-cli.js.map +1 -1
- package/dist/access-extraction-force-flush.js +69 -67
- package/dist/access-http-briefing.js +69 -67
- package/dist/access-http-query.js +69 -67
- package/dist/access-http.js +69 -67
- package/dist/access-identity-continuity-surface.js +69 -67
- package/dist/access-lcm-surface.js +69 -67
- package/dist/access-mcp.js +69 -67
- package/dist/access-observe-write-category.js +5 -5
- package/dist/access-observe-write-surface.js +69 -67
- package/dist/access-operations-batch.js +69 -67
- package/dist/access-operations.js +69 -67
- package/dist/access-recall-concurrency.js +69 -67
- package/dist/access-recall-response.js +69 -67
- package/dist/access-recall-surface.js +69 -67
- package/dist/access-schema.js +4 -4
- package/dist/access-service.js +69 -67
- package/dist/active-recall.js +6 -6
- package/dist/adapters/index.js +4 -4
- package/dist/adapters/registry.js +2 -2
- package/dist/briefing.js +7 -7
- package/dist/{capsule-crypto-7FJQINUR.js → capsule-crypto-YO5QJ6L3.js} +2 -2
- package/dist/causal-consolidation.js +8 -8
- package/dist/{chunk-4TYIHHPW.js → chunk-4N7L2N54.js} +111 -98
- package/dist/{chunk-4TYIHHPW.js.map → chunk-4N7L2N54.js.map} +1 -1
- package/dist/{chunk-WQ4XKIOX.js → chunk-5RONA5FF.js} +70 -52
- package/dist/chunk-5RONA5FF.js.map +1 -0
- package/dist/{chunk-ZG4GNPRE.js → chunk-BNQJKWWZ.js} +8 -8
- package/dist/{chunk-2NLLXCJG.js → chunk-BXLOS5AJ.js} +2 -2
- package/dist/{chunk-7QIRIF3Z.js → chunk-C2KBLOKE.js} +2 -2
- package/dist/{chunk-AZYUG2HW.js → chunk-C6WVKVHZ.js} +2 -2
- package/dist/{chunk-JODSN3V5.js → chunk-CTQ2XD4R.js} +2 -2
- package/dist/{chunk-XNI3URDR.js → chunk-D5F3D7DA.js} +2 -2
- package/dist/{chunk-X7Y7WX73.js → chunk-DQEMWVMT.js} +1 -1
- package/dist/{chunk-LYR57GEF.js → chunk-EKWS6NCF.js} +3 -3
- package/dist/{chunk-XTN54NML.js → chunk-G3T6YMBO.js} +4 -4
- package/dist/{chunk-AOAREXFV.js → chunk-G6TDGYVC.js} +2 -2
- package/dist/chunk-GE5J2T67.js +100 -0
- package/dist/chunk-GE5J2T67.js.map +1 -0
- package/dist/{chunk-BUOP3DOK.js → chunk-GRS34Y7V.js} +2 -2
- package/dist/{chunk-FQACH7MC.js → chunk-HM62567O.js} +2 -2
- package/dist/{chunk-B3LGXOM5.js → chunk-IOLFR3JJ.js} +2 -2
- package/dist/{chunk-WCKLRFGF.js → chunk-J5MBTYDO.js} +2 -2
- package/dist/{chunk-HRMOKGQM.js → chunk-JCKN3E6Y.js} +2 -2
- package/dist/{chunk-UOIVXBNS.js → chunk-JTO63AXR.js} +2 -2
- package/dist/{chunk-AY535ZIM.js → chunk-KPFOFT4I.js} +2 -2
- package/dist/{chunk-S2HLHAZ4.js → chunk-L76BQSWB.js} +10 -2
- package/dist/chunk-L76BQSWB.js.map +1 -0
- package/dist/{chunk-FV2B6XE6.js → chunk-NRZJKDGO.js} +2 -2
- package/dist/{chunk-VLUWWPKO.js → chunk-O5DO5LXA.js} +13 -13
- package/dist/{chunk-5VWN3FJS.js → chunk-OSYHJCLK.js} +2 -2
- package/dist/chunk-PQVLF42S.js +87 -0
- package/dist/chunk-PQVLF42S.js.map +1 -0
- package/dist/{chunk-OLJYBMFW.js → chunk-Q7UY2CSW.js} +7 -7
- package/dist/{chunk-R2DOFBG4.js → chunk-QNTBJKTN.js} +2 -2
- package/dist/{chunk-7SW6EBEF.js → chunk-QYN6I3CG.js} +2 -2
- package/dist/{chunk-KQAFEZQX.js → chunk-R45L4TV6.js} +6 -6
- package/dist/{chunk-7HNQR5MV.js → chunk-R76L66OW.js} +3 -3
- package/dist/{chunk-QIGEWFXE.js → chunk-RJTHGVO3.js} +2 -2
- package/dist/{chunk-FVMEZ57K.js → chunk-RLXD2L3G.js} +7 -7
- package/dist/{chunk-25BUV3TU.js → chunk-S4G7WX7Q.js} +2 -2
- package/dist/{chunk-BP7LNNWG.js → chunk-SMAPUZYV.js} +2 -2
- package/dist/{chunk-GT2TH7FZ.js → chunk-T4FW43AG.js} +3 -3
- package/dist/{chunk-OIOKDTZU.js → chunk-T5DX6A7T.js} +17 -6
- package/dist/chunk-T5DX6A7T.js.map +1 -0
- package/dist/{chunk-EDVVW655.js → chunk-T6H5HNA6.js} +2 -2
- package/dist/{chunk-YD4D4EVO.js → chunk-TA6IK76H.js} +2 -2
- package/dist/{chunk-7ZEF43SR.js → chunk-TPAIKAT5.js} +3 -3
- package/dist/{chunk-IOGYSADY.js → chunk-TS34Y2T5.js} +2 -2
- package/dist/{chunk-OEVJH66T.js → chunk-VHWQGBXY.js} +3 -3
- package/dist/{chunk-63OWJXGW.js → chunk-VMEFUPOM.js} +2 -2
- package/dist/{chunk-E55J2NFL.js → chunk-WP25PXBB.js} +2 -2
- package/dist/{chunk-H4XPEXWA.js → chunk-XOCAG2LF.js} +2 -2
- package/dist/{chunk-K32VAS5B.js → chunk-YPDUSAPH.js} +2 -2
- package/dist/cli.js +69 -67
- package/dist/coding/export-okf-codegraph.js +6 -6
- package/dist/compounding/engine.js +8 -8
- package/dist/config.js +6 -6
- package/dist/connectors/codex-materialize-runner.js +7 -7
- package/dist/connectors/index.js +7 -7
- package/dist/convergence-refresh.js +9 -9
- package/dist/corpus-watermark.js +9 -9
- package/dist/deep-recall-http-glue.js +5 -5
- package/dist/entity-retrieval.js +7 -7
- package/dist/explicit-capture.js +69 -67
- package/dist/extraction.js +7 -7
- package/dist/harmonic-retrieval.js +7 -7
- package/dist/index.js +86 -84
- package/dist/lcm/engine.js +3 -3
- package/dist/lcm/index.js +9 -9
- package/dist/location/index.js +8 -8
- package/dist/maintenance/memory-governance.js +7 -7
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +7 -7
- package/dist/maintenance/rebuild-memory-projection-runner.js +9 -9
- package/dist/maintenance/rebuild-memory-projection.js +8 -8
- package/dist/memory-snapshot.d.ts +7 -1
- package/dist/memory-snapshot.d.ts.map +1 -1
- package/dist/memory-snapshot.js +5 -3
- package/dist/namespaces/migrate.js +8 -8
- package/dist/namespaces/search.js +4 -4
- package/dist/namespaces/storage.js +7 -7
- package/dist/operator-doctor-corpus.js +10 -10
- package/dist/operator-toolkit.js +13 -13
- package/dist/orchestration/backlog-scheduler.js +70 -68
- package/dist/orchestration/backlog-scheduler.js.map +1 -1
- package/dist/orchestration/buffer-drain-runner.js +70 -68
- package/dist/orchestration/maintenance.js +15 -15
- package/dist/orchestration/recall-internal.d.ts.map +1 -1
- package/dist/orchestration/workspace-ops.d.ts.map +1 -1
- package/dist/orchestrator.js +69 -67
- package/dist/recall-navigation.js +69 -67
- package/dist/resume-bundles.js +10 -8
- package/dist/search/factory.js +3 -3
- package/dist/search/index.js +7 -7
- package/dist/semantic-consolidation.js +8 -8
- package/dist/semantic-rule-promotion.js +7 -7
- package/dist/semantic-rule-verifier.js +7 -7
- package/dist/source-agent-qualifier.js +7 -7
- package/dist/standup/build.js +7 -7
- package/dist/storage.d.ts +3 -0
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +6 -6
- package/dist/transcript-recent.d.ts +22 -0
- package/dist/transcript-recent.d.ts.map +1 -0
- package/dist/transcript-recent.js +15 -0
- package/dist/transcript-recent.js.map +1 -0
- package/dist/transcript-write-dir-memo.d.ts +43 -0
- package/dist/transcript-write-dir-memo.d.ts.map +1 -0
- package/dist/transcript-write-dir-memo.js +10 -0
- package/dist/transcript-write-dir-memo.js.map +1 -0
- package/dist/transcript.d.ts +15 -3
- package/dist/transcript.d.ts.map +1 -1
- package/dist/transcript.js +3 -1
- package/dist/transfer/autodetect.js +1 -1
- package/dist/transfer/backup.js +2 -2
- package/dist/transfer/capsule-export.js +3 -3
- package/dist/transfer/capsule-import.js +2 -2
- package/dist/transfer/export-okf.js +7 -7
- package/dist/verified-recall.js +7 -7
- package/dist/who-knows-cli.js +8 -8
- package/dist/who-knows.js +7 -7
- package/package.json +2 -2
- package/src/memory-snapshot.ts +14 -1
- package/src/orchestration/recall-internal.ts +1 -4
- package/src/orchestration/workspace-ops.test.ts +113 -0
- package/src/orchestration/workspace-ops.ts +38 -12
- package/src/storage-contract/lazy-memory-snapshot.test.ts +194 -0
- package/src/storage.ts +15 -4
- package/src/transcript-ownership-digest.test.ts +8 -0
- package/src/transcript-recent-tail.test.ts +355 -0
- package/src/transcript-recent.ts +129 -0
- package/src/transcript-write-dir-memo.test.ts +308 -0
- package/src/transcript-write-dir-memo.ts +104 -0
- package/src/transcript.ts +70 -63
- package/dist/chunk-OIOKDTZU.js.map +0 -1
- package/dist/chunk-S2HLHAZ4.js.map +0 -1
- package/dist/chunk-WQ4XKIOX.js.map +0 -1
- /package/dist/{capsule-crypto-7FJQINUR.js.map → capsule-crypto-YO5QJ6L3.js.map} +0 -0
- /package/dist/{chunk-ZG4GNPRE.js.map → chunk-BNQJKWWZ.js.map} +0 -0
- /package/dist/{chunk-2NLLXCJG.js.map → chunk-BXLOS5AJ.js.map} +0 -0
- /package/dist/{chunk-7QIRIF3Z.js.map → chunk-C2KBLOKE.js.map} +0 -0
- /package/dist/{chunk-AZYUG2HW.js.map → chunk-C6WVKVHZ.js.map} +0 -0
- /package/dist/{chunk-JODSN3V5.js.map → chunk-CTQ2XD4R.js.map} +0 -0
- /package/dist/{chunk-XNI3URDR.js.map → chunk-D5F3D7DA.js.map} +0 -0
- /package/dist/{chunk-X7Y7WX73.js.map → chunk-DQEMWVMT.js.map} +0 -0
- /package/dist/{chunk-LYR57GEF.js.map → chunk-EKWS6NCF.js.map} +0 -0
- /package/dist/{chunk-XTN54NML.js.map → chunk-G3T6YMBO.js.map} +0 -0
- /package/dist/{chunk-AOAREXFV.js.map → chunk-G6TDGYVC.js.map} +0 -0
- /package/dist/{chunk-BUOP3DOK.js.map → chunk-GRS34Y7V.js.map} +0 -0
- /package/dist/{chunk-FQACH7MC.js.map → chunk-HM62567O.js.map} +0 -0
- /package/dist/{chunk-B3LGXOM5.js.map → chunk-IOLFR3JJ.js.map} +0 -0
- /package/dist/{chunk-WCKLRFGF.js.map → chunk-J5MBTYDO.js.map} +0 -0
- /package/dist/{chunk-HRMOKGQM.js.map → chunk-JCKN3E6Y.js.map} +0 -0
- /package/dist/{chunk-UOIVXBNS.js.map → chunk-JTO63AXR.js.map} +0 -0
- /package/dist/{chunk-AY535ZIM.js.map → chunk-KPFOFT4I.js.map} +0 -0
- /package/dist/{chunk-FV2B6XE6.js.map → chunk-NRZJKDGO.js.map} +0 -0
- /package/dist/{chunk-VLUWWPKO.js.map → chunk-O5DO5LXA.js.map} +0 -0
- /package/dist/{chunk-5VWN3FJS.js.map → chunk-OSYHJCLK.js.map} +0 -0
- /package/dist/{chunk-OLJYBMFW.js.map → chunk-Q7UY2CSW.js.map} +0 -0
- /package/dist/{chunk-R2DOFBG4.js.map → chunk-QNTBJKTN.js.map} +0 -0
- /package/dist/{chunk-7SW6EBEF.js.map → chunk-QYN6I3CG.js.map} +0 -0
- /package/dist/{chunk-KQAFEZQX.js.map → chunk-R45L4TV6.js.map} +0 -0
- /package/dist/{chunk-7HNQR5MV.js.map → chunk-R76L66OW.js.map} +0 -0
- /package/dist/{chunk-QIGEWFXE.js.map → chunk-RJTHGVO3.js.map} +0 -0
- /package/dist/{chunk-FVMEZ57K.js.map → chunk-RLXD2L3G.js.map} +0 -0
- /package/dist/{chunk-25BUV3TU.js.map → chunk-S4G7WX7Q.js.map} +0 -0
- /package/dist/{chunk-BP7LNNWG.js.map → chunk-SMAPUZYV.js.map} +0 -0
- /package/dist/{chunk-GT2TH7FZ.js.map → chunk-T4FW43AG.js.map} +0 -0
- /package/dist/{chunk-EDVVW655.js.map → chunk-T6H5HNA6.js.map} +0 -0
- /package/dist/{chunk-YD4D4EVO.js.map → chunk-TA6IK76H.js.map} +0 -0
- /package/dist/{chunk-7ZEF43SR.js.map → chunk-TPAIKAT5.js.map} +0 -0
- /package/dist/{chunk-IOGYSADY.js.map → chunk-TS34Y2T5.js.map} +0 -0
- /package/dist/{chunk-OEVJH66T.js.map → chunk-VHWQGBXY.js.map} +0 -0
- /package/dist/{chunk-63OWJXGW.js.map → chunk-VMEFUPOM.js.map} +0 -0
- /package/dist/{chunk-E55J2NFL.js.map → chunk-WP25PXBB.js.map} +0 -0
- /package/dist/{chunk-H4XPEXWA.js.map → chunk-XOCAG2LF.js.map} +0 -0
- /package/dist/{chunk-K32VAS5B.js.map → chunk-YPDUSAPH.js.map} +0 -0
package/dist/transfer/backup.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
backupMemoryDir
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-BXLOS5AJ.js";
|
|
4
4
|
import "../chunk-765K3SAT.js";
|
|
5
|
-
import "../chunk-X7Y7WX73.js";
|
|
6
5
|
import "../chunk-J4EB7DNW.js";
|
|
6
|
+
import "../chunk-DQEMWVMT.js";
|
|
7
7
|
import "../chunk-BJMBJZ2Y.js";
|
|
8
8
|
import "../chunk-UKJAGEXH.js";
|
|
9
9
|
import "../chunk-FP2373TW.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
exportCapsule,
|
|
3
3
|
isValidCapsuleSince
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-WEHSQBFR.js";
|
|
6
|
-
import "../chunk-X7Y7WX73.js";
|
|
4
|
+
} from "../chunk-R45L4TV6.js";
|
|
7
5
|
import "../chunk-J4EB7DNW.js";
|
|
6
|
+
import "../chunk-WEHSQBFR.js";
|
|
7
|
+
import "../chunk-DQEMWVMT.js";
|
|
8
8
|
import "../chunk-BJMBJZ2Y.js";
|
|
9
9
|
import "../chunk-UKJAGEXH.js";
|
|
10
10
|
import "../chunk-FP2373TW.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
importCapsule
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-JCKN3E6Y.js";
|
|
4
4
|
import "../chunk-QV2VZKD5.js";
|
|
5
5
|
import "../chunk-KUQLUYIR.js";
|
|
6
6
|
import "../chunk-O3GZPLVY.js";
|
|
7
7
|
import "../chunk-5WITETWU.js";
|
|
8
8
|
import "../chunk-6CIAGZ6X.js";
|
|
9
9
|
import "../chunk-WEHSQBFR.js";
|
|
10
|
-
import "../chunk-
|
|
10
|
+
import "../chunk-DQEMWVMT.js";
|
|
11
11
|
import "../chunk-BJMBJZ2Y.js";
|
|
12
12
|
import "../chunk-UKJAGEXH.js";
|
|
13
13
|
import "../chunk-FP2373TW.js";
|
|
@@ -4,27 +4,27 @@ import {
|
|
|
4
4
|
exportOkfBundle,
|
|
5
5
|
firstHeading,
|
|
6
6
|
parseIncludeStatus
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-JTO63AXR.js";
|
|
8
8
|
import {
|
|
9
9
|
OKF_EXPORT_VERSION
|
|
10
10
|
} from "../chunk-I7TR2OCU.js";
|
|
11
11
|
import "../chunk-D24OXEPB.js";
|
|
12
12
|
import "../chunk-3UXOZBHV.js";
|
|
13
|
-
import "../chunk-
|
|
13
|
+
import "../chunk-T5DX6A7T.js";
|
|
14
14
|
import "../chunk-QGVCFVX6.js";
|
|
15
15
|
import "../chunk-UHVXE24Y.js";
|
|
16
16
|
import "../chunk-O3JG4PD3.js";
|
|
17
17
|
import "../chunk-G6OFEGUR.js";
|
|
18
18
|
import "../chunk-RFUL2ZIQ.js";
|
|
19
|
-
import "../chunk-
|
|
20
|
-
import "../chunk-
|
|
19
|
+
import "../chunk-GRS34Y7V.js";
|
|
20
|
+
import "../chunk-RLXD2L3G.js";
|
|
21
|
+
import "../chunk-OVZIYLBZ.js";
|
|
22
|
+
import "../chunk-EXYT52NR.js";
|
|
21
23
|
import "../chunk-DOJBV6WR.js";
|
|
22
24
|
import "../chunk-PFUXPTBT.js";
|
|
23
25
|
import "../chunk-CYEPCZN5.js";
|
|
24
26
|
import "../chunk-DLZGSZVC.js";
|
|
25
|
-
import "../chunk-OVZIYLBZ.js";
|
|
26
27
|
import "../chunk-WNEVEMJ3.js";
|
|
27
|
-
import "../chunk-EXYT52NR.js";
|
|
28
28
|
import "../chunk-Y5NLBXPV.js";
|
|
29
29
|
import "../chunk-TFA6HPOA.js";
|
|
30
30
|
import "../chunk-F4TWWUMP.js";
|
|
@@ -34,7 +34,7 @@ import "../chunk-S2V7RUCL.js";
|
|
|
34
34
|
import "../chunk-PPUNC7UX.js";
|
|
35
35
|
import "../chunk-X3724WL4.js";
|
|
36
36
|
import "../chunk-MRPOZBJC.js";
|
|
37
|
-
import "../chunk-
|
|
37
|
+
import "../chunk-L76BQSWB.js";
|
|
38
38
|
import "../chunk-DM2T26WE.js";
|
|
39
39
|
import "../chunk-LDXUBPMO.js";
|
|
40
40
|
import "../chunk-FF6N7BXC.js";
|
package/dist/verified-recall.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
compareVerifiedEpisodeResults,
|
|
3
3
|
searchVerifiedEpisodes
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-TA6IK76H.js";
|
|
5
5
|
import "./chunk-B7RWBZXW.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-T5DX6A7T.js";
|
|
7
7
|
import "./chunk-QGVCFVX6.js";
|
|
8
8
|
import "./chunk-UHVXE24Y.js";
|
|
9
9
|
import "./chunk-O3JG4PD3.js";
|
|
10
10
|
import "./chunk-G6OFEGUR.js";
|
|
11
11
|
import "./chunk-RFUL2ZIQ.js";
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-GRS34Y7V.js";
|
|
13
|
+
import "./chunk-RLXD2L3G.js";
|
|
14
|
+
import "./chunk-OVZIYLBZ.js";
|
|
15
|
+
import "./chunk-EXYT52NR.js";
|
|
14
16
|
import "./chunk-DOJBV6WR.js";
|
|
15
17
|
import "./chunk-PFUXPTBT.js";
|
|
16
18
|
import "./chunk-CYEPCZN5.js";
|
|
17
19
|
import "./chunk-DLZGSZVC.js";
|
|
18
|
-
import "./chunk-OVZIYLBZ.js";
|
|
19
20
|
import "./chunk-WNEVEMJ3.js";
|
|
20
|
-
import "./chunk-EXYT52NR.js";
|
|
21
21
|
import "./chunk-Y5NLBXPV.js";
|
|
22
22
|
import "./chunk-TFA6HPOA.js";
|
|
23
23
|
import "./chunk-F4TWWUMP.js";
|
|
@@ -27,7 +27,7 @@ import "./chunk-S2V7RUCL.js";
|
|
|
27
27
|
import "./chunk-PPUNC7UX.js";
|
|
28
28
|
import "./chunk-X3724WL4.js";
|
|
29
29
|
import "./chunk-MRPOZBJC.js";
|
|
30
|
-
import "./chunk-
|
|
30
|
+
import "./chunk-L76BQSWB.js";
|
|
31
31
|
import "./chunk-DM2T26WE.js";
|
|
32
32
|
import "./chunk-LDXUBPMO.js";
|
|
33
33
|
import "./chunk-FF6N7BXC.js";
|
package/dist/who-knows-cli.js
CHANGED
|
@@ -4,23 +4,23 @@ import {
|
|
|
4
4
|
renderWhoKnows,
|
|
5
5
|
renderWhoKnowsJson,
|
|
6
6
|
renderWhoKnowsText
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-RJTHGVO3.js";
|
|
8
|
+
import "./chunk-C2KBLOKE.js";
|
|
9
|
+
import "./chunk-T5DX6A7T.js";
|
|
10
10
|
import "./chunk-QGVCFVX6.js";
|
|
11
11
|
import "./chunk-UHVXE24Y.js";
|
|
12
12
|
import "./chunk-O3JG4PD3.js";
|
|
13
13
|
import "./chunk-G6OFEGUR.js";
|
|
14
14
|
import "./chunk-RFUL2ZIQ.js";
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-GRS34Y7V.js";
|
|
16
|
+
import "./chunk-RLXD2L3G.js";
|
|
17
|
+
import "./chunk-OVZIYLBZ.js";
|
|
18
|
+
import "./chunk-EXYT52NR.js";
|
|
17
19
|
import "./chunk-DOJBV6WR.js";
|
|
18
20
|
import "./chunk-PFUXPTBT.js";
|
|
19
21
|
import "./chunk-CYEPCZN5.js";
|
|
20
22
|
import "./chunk-DLZGSZVC.js";
|
|
21
|
-
import "./chunk-OVZIYLBZ.js";
|
|
22
23
|
import "./chunk-WNEVEMJ3.js";
|
|
23
|
-
import "./chunk-EXYT52NR.js";
|
|
24
24
|
import "./chunk-Y5NLBXPV.js";
|
|
25
25
|
import "./chunk-TFA6HPOA.js";
|
|
26
26
|
import "./chunk-F4TWWUMP.js";
|
|
@@ -30,7 +30,7 @@ import "./chunk-S2V7RUCL.js";
|
|
|
30
30
|
import "./chunk-PPUNC7UX.js";
|
|
31
31
|
import "./chunk-X3724WL4.js";
|
|
32
32
|
import "./chunk-MRPOZBJC.js";
|
|
33
|
-
import "./chunk-
|
|
33
|
+
import "./chunk-L76BQSWB.js";
|
|
34
34
|
import "./chunk-DM2T26WE.js";
|
|
35
35
|
import "./chunk-LDXUBPMO.js";
|
|
36
36
|
import "./chunk-FF6N7BXC.js";
|
package/dist/who-knows.js
CHANGED
|
@@ -9,22 +9,22 @@ import {
|
|
|
9
9
|
loadWhoKnowsEntities,
|
|
10
10
|
tokenizeTopic,
|
|
11
11
|
validateWhoKnowsInput
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-C2KBLOKE.js";
|
|
13
|
+
import "./chunk-T5DX6A7T.js";
|
|
14
14
|
import "./chunk-QGVCFVX6.js";
|
|
15
15
|
import "./chunk-UHVXE24Y.js";
|
|
16
16
|
import "./chunk-O3JG4PD3.js";
|
|
17
17
|
import "./chunk-G6OFEGUR.js";
|
|
18
18
|
import "./chunk-RFUL2ZIQ.js";
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
19
|
+
import "./chunk-GRS34Y7V.js";
|
|
20
|
+
import "./chunk-RLXD2L3G.js";
|
|
21
|
+
import "./chunk-OVZIYLBZ.js";
|
|
22
|
+
import "./chunk-EXYT52NR.js";
|
|
21
23
|
import "./chunk-DOJBV6WR.js";
|
|
22
24
|
import "./chunk-PFUXPTBT.js";
|
|
23
25
|
import "./chunk-CYEPCZN5.js";
|
|
24
26
|
import "./chunk-DLZGSZVC.js";
|
|
25
|
-
import "./chunk-OVZIYLBZ.js";
|
|
26
27
|
import "./chunk-WNEVEMJ3.js";
|
|
27
|
-
import "./chunk-EXYT52NR.js";
|
|
28
28
|
import "./chunk-Y5NLBXPV.js";
|
|
29
29
|
import "./chunk-TFA6HPOA.js";
|
|
30
30
|
import "./chunk-F4TWWUMP.js";
|
|
@@ -34,7 +34,7 @@ import "./chunk-S2V7RUCL.js";
|
|
|
34
34
|
import "./chunk-PPUNC7UX.js";
|
|
35
35
|
import "./chunk-X3724WL4.js";
|
|
36
36
|
import "./chunk-MRPOZBJC.js";
|
|
37
|
-
import "./chunk-
|
|
37
|
+
import "./chunk-L76BQSWB.js";
|
|
38
38
|
import "./chunk-DM2T26WE.js";
|
|
39
39
|
import "./chunk-LDXUBPMO.js";
|
|
40
40
|
import "./chunk-FF6N7BXC.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remnic/core",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.112",
|
|
4
4
|
"description": "Framework-agnostic Remnic memory engine — orchestrator, storage, extraction, search, trust zones",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -3386,7 +3386,7 @@
|
|
|
3386
3386
|
"core"
|
|
3387
3387
|
],
|
|
3388
3388
|
"peerDependencies": {
|
|
3389
|
-
"@remnic/coding-graph": "^10.0.
|
|
3389
|
+
"@remnic/coding-graph": "^10.0.112"
|
|
3390
3390
|
},
|
|
3391
3391
|
"peerDependenciesMeta": {
|
|
3392
3392
|
"@remnic/coding-graph": {
|
package/src/memory-snapshot.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MemoryFile } from "./types.js";
|
|
1
|
+
import type { MemoryFile, MemoryFrontmatter } from "./types.js";
|
|
2
2
|
|
|
3
3
|
function sortSnapshotObject(_key: string, candidate: unknown): unknown {
|
|
4
4
|
if (candidate === null || typeof candidate !== "object" || Array.isArray(candidate)) return candidate;
|
|
@@ -13,3 +13,16 @@ function sortSnapshotObject(_key: string, candidate: unknown): unknown {
|
|
|
13
13
|
export function createMemorySnapshot(memory: MemoryFile): string {
|
|
14
14
|
return JSON.stringify([memory.frontmatter, memory.content], sortSnapshotObject);
|
|
15
15
|
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* created/updated for a snapshot rebuilt from a file's text. parseFrontmatter stamps a missing key with "now", so take
|
|
19
|
+
* the loaded memory's own stamp instead, as the old eager snapshot did: a file with no timestamps then never matches a
|
|
20
|
+
* later read of itself (refused every time, not by clock tick). Key presence follows the parser, which trims the key.
|
|
21
|
+
*/
|
|
22
|
+
export function loadTimeStamps(raw: string, parsed: MemoryFrontmatter, loaded: MemoryFrontmatter): Pick<MemoryFrontmatter, "created" | "updated"> {
|
|
23
|
+
const front = raw.slice(0, raw.indexOf("\n---", 3)); // the block parseFrontmatter reads, without a lazy regex
|
|
24
|
+
return {
|
|
25
|
+
created: /^[ \t]*created[ \t]*:/m.test(front) ? parsed.created : loaded.created,
|
|
26
|
+
updated: /^[ \t]*updated[ \t]*:/m.test(front) ? parsed.updated : loaded.updated,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -2361,10 +2361,7 @@ export class RecallInternalCoordinator {
|
|
|
2361
2361
|
}
|
|
2362
2362
|
|
|
2363
2363
|
if (!checkpointInjected) {
|
|
2364
|
-
const entries = await this.deps.transcript.readRecent(
|
|
2365
|
-
transcriptLookbackHours,
|
|
2366
|
-
sessionKey,
|
|
2367
|
-
);
|
|
2364
|
+
const entries = await this.deps.transcript.readRecent(transcriptLookbackHours, sessionKey, transcriptMaxTurns);
|
|
2368
2365
|
log.debug(
|
|
2369
2366
|
`recall: read ${entries.length} transcript entries for sessionKey=${sessionKey}`,
|
|
2370
2367
|
);
|
|
@@ -383,3 +383,116 @@ test("trackMemoryAccess preserves namespaces for relative paths", () => {
|
|
|
383
383
|
],
|
|
384
384
|
);
|
|
385
385
|
});
|
|
386
|
+
|
|
387
|
+
// COS-666e: flushAccessTracking scanned the whole corpus for every buffered update and resolved paths on each
|
|
388
|
+
// comparison: 100 updates x 130k memories x 2-3 resolves was a 40 s main-thread stall in production.
|
|
389
|
+
type FlushMemory = { path: string; frontmatter: { id: string; accessCount: number } };
|
|
390
|
+
type FlushBuffer = WorkspaceOpsDeps["accessTrackingBuffer"];
|
|
391
|
+
|
|
392
|
+
interface FlushOut {
|
|
393
|
+
flushed: AccessTrackingEntry[];
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
function flushHarness(memories: FlushMemory[], buffered: FlushBuffer) {
|
|
398
|
+
const out: FlushOut = { flushed: [] };
|
|
399
|
+
const deps = {
|
|
400
|
+
config: {
|
|
401
|
+
namespacesEnabled: false,
|
|
402
|
+
defaultNamespace: "default",
|
|
403
|
+
sharedNamespace: "shared",
|
|
404
|
+
namespacePolicies: [],
|
|
405
|
+
memoryDir: "/memory",
|
|
406
|
+
},
|
|
407
|
+
accessTrackingBuffer: buffered,
|
|
408
|
+
readAllMemoriesForNamespaces: async () => memories,
|
|
409
|
+
namespaceFromPath: () => "default",
|
|
410
|
+
storageRouter: {
|
|
411
|
+
storageFor: async () => ({
|
|
412
|
+
flushAccessTracking: async (entries: AccessTrackingEntry[]) => {
|
|
413
|
+
out.flushed = entries;
|
|
414
|
+
},
|
|
415
|
+
}),
|
|
416
|
+
},
|
|
417
|
+
};
|
|
418
|
+
// SAFETY: flushAccessTracking reads only the fields stubbed above; the full deps object is not worth building.
|
|
419
|
+
// oxlint-disable-next-line anti-slop/no-chained-type-assertions
|
|
420
|
+
return { out, coordinator: new WorkspaceOpsCoordinator(deps as unknown as WorkspaceOpsDeps) };
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
const stamp = "2026-07-19T00:00:00.000Z";
|
|
424
|
+
|
|
425
|
+
test("flushAccessTracking picks the first memory in corpus order when several match a buffered path or id", async () => {
|
|
426
|
+
const first = path.join("/memory", "facts", "dup.md");
|
|
427
|
+
const memories = [
|
|
428
|
+
{ path: first, frontmatter: { id: "dup-a", accessCount: 10 } },
|
|
429
|
+
{ path: path.join("/memory", "facts", "..", "facts", "dup.md"), frontmatter: { id: "dup-b", accessCount: 20 } }, // same resolved path
|
|
430
|
+
{ path: path.join("/memory", "facts", "other.md"), frontmatter: { id: "same-id", accessCount: 30 } },
|
|
431
|
+
{ path: path.join("/memory", "facts", "other2.md"), frontmatter: { id: "same-id", accessCount: 40 } },
|
|
432
|
+
];
|
|
433
|
+
const buffered: FlushBuffer = new Map([
|
|
434
|
+
["default:dup", { memoryId: "x", memoryPath: path.join("facts", "dup.md"), count: 1, lastAccessed: stamp }],
|
|
435
|
+
["default:same-id", { memoryId: "same-id", count: 1, lastAccessed: stamp }],
|
|
436
|
+
]);
|
|
437
|
+
const { out, coordinator } = flushHarness(memories, buffered);
|
|
438
|
+
await coordinator.flushAccessTracking();
|
|
439
|
+
const byPath = new Map(out.flushed.map((e) => [e.memoryPath, e.newCount]));
|
|
440
|
+
assert.equal(byPath.get(first), 11);
|
|
441
|
+
assert.equal(byPath.get(memories[2].path), 31);
|
|
442
|
+
assert.equal(out.flushed.length, 2);
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
test("flushAccessTracking looks buffered paths up in an index, not by scanning the corpus per update", async (t) => {
|
|
446
|
+
const corpus = 3000;
|
|
447
|
+
const memories = Array.from({ length: corpus }, (_, i) => ({
|
|
448
|
+
path: path.join("/memory", "facts", `m${i}.md`),
|
|
449
|
+
frontmatter: { id: `m${i}`, accessCount: i },
|
|
450
|
+
}));
|
|
451
|
+
const buffered: FlushBuffer = new Map();
|
|
452
|
+
for (let i = 0; i < 100; i++) {
|
|
453
|
+
const at = 2900 - i * 20; // late in the corpus: a scan walks almost all of it
|
|
454
|
+
buffered.set(`default:m${at}`, {
|
|
455
|
+
memoryId: `m${at}`,
|
|
456
|
+
memoryPath: i % 2 === 0 ? memories[at].path : path.join("facts", `m${at}.md`), // absolute, or relative to the memory dir
|
|
457
|
+
count: 1,
|
|
458
|
+
lastAccessed: stamp,
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
const { out, coordinator } = flushHarness(memories, buffered);
|
|
462
|
+
const resolve = t.mock.method(path, "resolve");
|
|
463
|
+
await coordinator.flushAccessTracking();
|
|
464
|
+
assert.equal(out.flushed.length, 100);
|
|
465
|
+
assert.equal(out.flushed.find((e) => e.memoryId === "m2900")?.newCount, 2901);
|
|
466
|
+
assert.equal(out.flushed.find((e) => e.memoryId === "m1000")?.newCount, 1001);
|
|
467
|
+
assert.ok(resolve.mock.callCount() < corpus * 4, `${resolve.mock.callCount()} path.resolve calls for ${corpus} memories and 100 updates`);
|
|
468
|
+
});
|
|
469
|
+
|
|
470
|
+
test("flushAccessTracking with 100 updates over 20,000 memories finishes in well under a second", async () => {
|
|
471
|
+
const memories = Array.from({ length: 20_000 }, (_, i) => ({
|
|
472
|
+
path: path.join("/memory", "facts", `m${i}.md`),
|
|
473
|
+
frontmatter: { id: `m${i}`, accessCount: 0 },
|
|
474
|
+
}));
|
|
475
|
+
const buffered: FlushBuffer = new Map();
|
|
476
|
+
for (let i = 0; i < 100; i++) {
|
|
477
|
+
const at = 19_999 - i * 7;
|
|
478
|
+
buffered.set(`default:m${at}`, { memoryId: `m${at}`, memoryPath: memories[at].path, count: 1, lastAccessed: stamp });
|
|
479
|
+
}
|
|
480
|
+
const { out, coordinator } = flushHarness(memories, buffered);
|
|
481
|
+
const started = performance.now();
|
|
482
|
+
await coordinator.flushAccessTracking();
|
|
483
|
+
const elapsed = performance.now() - started;
|
|
484
|
+
assert.equal(out.flushed.length, 100);
|
|
485
|
+
assert.ok(elapsed < 1000, `flush took ${Math.round(elapsed)} ms`); // the per-update corpus scan took several seconds here
|
|
486
|
+
});
|
|
487
|
+
|
|
488
|
+
test("flushAccessTracking takes the earlier memory when a relative path matches one as given and another under the memory dir", async () => {
|
|
489
|
+
const underMemoryDir = path.join("/memory", "facts", "x.md");
|
|
490
|
+
const memories = [
|
|
491
|
+
{ path: underMemoryDir, frontmatter: { id: "under-dir", accessCount: 5 } },
|
|
492
|
+
{ path: path.resolve("facts", "x.md"), frontmatter: { id: "as-given", accessCount: 50 } },
|
|
493
|
+
];
|
|
494
|
+
const buffered: FlushBuffer = new Map([["default:x", { memoryId: "x", memoryPath: path.join("facts", "x.md"), count: 1, lastAccessed: stamp }]]);
|
|
495
|
+
const { out, coordinator } = flushHarness(memories, buffered);
|
|
496
|
+
await coordinator.flushAccessTracking();
|
|
497
|
+
assert.deepEqual(out.flushed.map((e) => [e.memoryPath, e.newCount]), [[underMemoryDir, 6]]);
|
|
498
|
+
});
|
|
@@ -120,9 +120,35 @@ export interface WorkspaceOpsDeps {
|
|
|
120
120
|
readonly meetingsServiceByNamespace: Map<string, MeetingsService>;
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
123
|
+
/** A namespace's memories keyed for lookup: first index per resolved path, first memory per id (corpus order wins). */
|
|
124
|
+
interface MemoryIndex {
|
|
125
|
+
readonly list: MemoryFile[];
|
|
126
|
+
readonly byPath: Map<string, number>;
|
|
127
|
+
readonly byId: Map<string, MemoryFile>;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// COS-666e: the old per-update `find` over the corpus resolved paths on every comparison (a 40 s stall at 130k memories).
|
|
131
|
+
function indexMemories(list: MemoryFile[]): MemoryIndex {
|
|
132
|
+
const byPath = new Map<string, number>();
|
|
133
|
+
const byId = new Map<string, MemoryFile>();
|
|
134
|
+
list.forEach((memory, i) => {
|
|
135
|
+
const resolved = path.resolve(memory.path);
|
|
136
|
+
if (!byPath.has(resolved)) byPath.set(resolved, i);
|
|
137
|
+
if (!byId.has(memory.frontmatter.id)) byId.set(memory.frontmatter.id, memory);
|
|
138
|
+
});
|
|
139
|
+
return { list, byPath, byId };
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** The first memory, in corpus order, whose path is a requested path as given or relative to the memory dir. */
|
|
143
|
+
function findByRequestedPaths(index: MemoryIndex, requestedPaths: string[], memoryDir: string): MemoryFile | undefined {
|
|
144
|
+
let best: number | undefined;
|
|
145
|
+
for (const requested of requestedPaths) {
|
|
146
|
+
for (const key of [path.resolve(requested), path.resolve(memoryDir, requested)]) {
|
|
147
|
+
const i = index.byPath.get(key);
|
|
148
|
+
if (i !== undefined && (best === undefined || i < best)) best = i;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return best === undefined ? undefined : index.list[best];
|
|
126
152
|
}
|
|
127
153
|
|
|
128
154
|
function accessTrackingPathCandidates(storageDir: string, memoryPath: string): string[] {
|
|
@@ -1016,6 +1042,7 @@ export class WorkspaceOpsCoordinator {
|
|
|
1016
1042
|
const entriesByNamespace = new Map<string, AccessTrackingEntry[]>();
|
|
1017
1043
|
const mergedEntriesByNamespace = new Map<string, Map<string, AccessTrackingEntry>>();
|
|
1018
1044
|
const storageDirByNamespace = new Map<string, string | null>();
|
|
1045
|
+
const indexByNamespace = new Map<string, MemoryIndex>();
|
|
1019
1046
|
for (const [, update] of this.deps.accessTrackingBuffer) {
|
|
1020
1047
|
const memoryPath = update.memoryPath;
|
|
1021
1048
|
const namespace =
|
|
@@ -1036,16 +1063,15 @@ export class WorkspaceOpsCoordinator {
|
|
|
1036
1063
|
...(storageDir ? accessTrackingPathCandidates(storageDir, memoryPath) : []),
|
|
1037
1064
|
]
|
|
1038
1065
|
: [];
|
|
1066
|
+
let index = indexByNamespace.get(namespace);
|
|
1067
|
+
if (index === undefined && namespaceMemories) {
|
|
1068
|
+
index = indexMemories(namespaceMemories);
|
|
1069
|
+
indexByNamespace.set(namespace, index);
|
|
1070
|
+
}
|
|
1039
1071
|
const memory = memoryPath
|
|
1040
|
-
?
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
namespaceMemories?.find((candidate) =>
|
|
1044
|
-
requestedPaths.some((requestedPath) =>
|
|
1045
|
-
matchesMemoryPath(candidate.path, requestedPath, this.deps.config.memoryDir),
|
|
1046
|
-
),
|
|
1047
|
-
)
|
|
1048
|
-
: namespaceMemories?.find((candidate) => candidate.frontmatter.id === update.memoryId);
|
|
1072
|
+
? (index && (findByRequestedPaths(index, [memoryPath], this.deps.config.memoryDir) ??
|
|
1073
|
+
findByRequestedPaths(index, requestedPaths, this.deps.config.memoryDir)))
|
|
1074
|
+
: index?.byId.get(update.memoryId);
|
|
1049
1075
|
if (!memory) continue;
|
|
1050
1076
|
|
|
1051
1077
|
const namespaceEntries = mergedEntriesByNamespace.get(namespace) ?? new Map();
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* COS-666d: loading the corpus built a key-sorted JSON snapshot of every memory
|
|
3
|
+
* (`createMemorySnapshot`), 5-6.6 s of synchronous main-thread work at ~120k
|
|
4
|
+
* facts on every cache rebuild, for a value only `moveMemoryToPath` reads. The
|
|
5
|
+
* snapshot is now derived from the raw file text the loader already keeps, at
|
|
6
|
+
* the moment a tier move needs it, and means the same thing: the memory as it
|
|
7
|
+
* was loaded.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import assert from "node:assert/strict";
|
|
11
|
+
import test, { mock } from "node:test";
|
|
12
|
+
import { mkdir, mkdtemp, readFile, rename, rm, writeFile } from "node:fs/promises";
|
|
13
|
+
import os from "node:os";
|
|
14
|
+
import path from "node:path";
|
|
15
|
+
|
|
16
|
+
import { StorageManager } from "../storage.js";
|
|
17
|
+
import type { MemoryFile } from "../types.js";
|
|
18
|
+
import { resetStaticCaches } from "./harness.js";
|
|
19
|
+
|
|
20
|
+
/** Calls to the snapshot serializer: the only JSON.stringify here that is given a replacer function. */
|
|
21
|
+
async function countSnapshotCalls<T>(fn: () => Promise<T>): Promise<{ result: T; calls: number }> {
|
|
22
|
+
const spy = mock.method(JSON, "stringify");
|
|
23
|
+
try {
|
|
24
|
+
const result = await fn();
|
|
25
|
+
return { result, calls: spy.mock.calls.filter((call) => call.arguments[1] instanceof Function).length };
|
|
26
|
+
} finally {
|
|
27
|
+
spy.mock.restore();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async function withStorage(run: (storage: StorageManager, dir: string) => Promise<void>): Promise<void> {
|
|
32
|
+
const dir = await mkdtemp(path.join(os.tmpdir(), "remnic-lazy-snapshot-"));
|
|
33
|
+
try {
|
|
34
|
+
resetStaticCaches();
|
|
35
|
+
const storage = new StorageManager(dir);
|
|
36
|
+
await storage.ensureDirectories();
|
|
37
|
+
await run(storage, dir);
|
|
38
|
+
} finally {
|
|
39
|
+
resetStaticCaches();
|
|
40
|
+
await rm(dir, { recursive: true, force: true });
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
test("reading the corpus builds no snapshots", async () => {
|
|
45
|
+
await withStorage(async (storage) => {
|
|
46
|
+
for (let i = 0; i < 12; i++) await storage.writeMemory("fact", `lazy snapshot fact ${i}`);
|
|
47
|
+
resetStaticCaches();
|
|
48
|
+
const { result, calls } = await countSnapshotCalls(() => storage.readAllMemories());
|
|
49
|
+
assert.equal(result.length, 12);
|
|
50
|
+
assert.equal(calls, 0, "no snapshot may be built while loading the corpus");
|
|
51
|
+
const byPath = await countSnapshotCalls(() => storage.readMemoryByPath(result[0].path));
|
|
52
|
+
assert.ok(byPath.result);
|
|
53
|
+
assert.equal(byPath.calls, 0);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
test("a tier move still succeeds for a loaded memory the caller mutated, and builds the snapshot only then", async () => {
|
|
58
|
+
await withStorage(async (storage) => {
|
|
59
|
+
const { id } = await storage.writeMemory("fact", "original disk content");
|
|
60
|
+
const memory = (await storage.readAllMemories()).find((m) => m.frontmatter.id === id);
|
|
61
|
+
assert.ok(memory);
|
|
62
|
+
memory.content = "caller mutated unpersisted content";
|
|
63
|
+
const targetPath = storage.buildTierMemoryPath(memory, "cold");
|
|
64
|
+
const { result, calls } = await countSnapshotCalls(() => storage.moveMemoryToPath(memory, targetPath));
|
|
65
|
+
assert.equal(result, true);
|
|
66
|
+
assert.ok(calls > 0, "the move compares snapshots");
|
|
67
|
+
assert.ok((await readFile(targetPath, "utf8")).includes("original disk content"));
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
test("a tier move refuses when the file changed on disk since it was loaded", async () => {
|
|
72
|
+
await withStorage(async (storage) => {
|
|
73
|
+
const { id } = await storage.writeMemory("fact", "unmodified content");
|
|
74
|
+
const memory = (await storage.readAllMemories()).find((m) => m.frontmatter.id === id);
|
|
75
|
+
assert.ok(memory);
|
|
76
|
+
const disk = await readFile(memory.path, "utf8");
|
|
77
|
+
await writeFile(memory.path, disk.replace("unmodified content", "external edit on disk"));
|
|
78
|
+
await assert.rejects(
|
|
79
|
+
() => storage.moveMemoryToPath(memory, storage.buildTierMemoryPath(memory, "cold")),
|
|
80
|
+
/changed before its tier move/,
|
|
81
|
+
);
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
test("a tier move ignores a rewrite that only reorders frontmatter keys (the snapshot is key-order independent)", async () => {
|
|
86
|
+
await withStorage(async (storage) => {
|
|
87
|
+
const { id } = await storage.writeMemory("fact", "reordered frontmatter");
|
|
88
|
+
const memory = (await storage.readAllMemories()).find((m) => m.frontmatter.id === id);
|
|
89
|
+
assert.ok(memory);
|
|
90
|
+
const disk = await readFile(memory.path, "utf8");
|
|
91
|
+
const closing = disk.indexOf("\n---\n", 4);
|
|
92
|
+
assert.ok(disk.startsWith("---\n") && closing > 0, "memory file has frontmatter");
|
|
93
|
+
const front = disk.slice(4, closing);
|
|
94
|
+
const body = disk.slice(closing + 5);
|
|
95
|
+
await writeFile(memory.path, `---\n${front.split("\n").reverse().join("\n")}\n---\n${body}`);
|
|
96
|
+
assert.equal(await storage.moveMemoryToPath(memory, storage.buildTierMemoryPath(memory, "cold")), true);
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
test("a memory with no retained file text falls back to an eager snapshot", async () => {
|
|
101
|
+
await withStorage(async (storage) => {
|
|
102
|
+
const { id } = await storage.writeMemory("fact", "no raw text");
|
|
103
|
+
const loaded = (await storage.readAllMemories()).find((m) => m.frontmatter.id === id);
|
|
104
|
+
assert.ok(loaded);
|
|
105
|
+
// A handcrafted object has no retained raw document and was never loaded: the old fallback
|
|
106
|
+
// compares `frontmatter.updated` only, so the same state moves and a changed one is refused.
|
|
107
|
+
const copy: MemoryFile = { path: loaded.path, frontmatter: { ...loaded.frontmatter }, content: loaded.content };
|
|
108
|
+
assert.equal(await storage.moveMemoryToPath(copy, storage.buildTierMemoryPath(copy, "cold")), true);
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
test("a loaded archive-path memory whose file has no status still moves (loaded status is archived)", async () => {
|
|
113
|
+
await withStorage(async (storage, dir) => {
|
|
114
|
+
const { id } = await storage.writeMemory("fact", "archived without status");
|
|
115
|
+
const source = (await storage.readAllMemories()).find((m) => m.frontmatter.id === id);
|
|
116
|
+
assert.ok(source);
|
|
117
|
+
const archivedPath = path.join(dir, "archive", "2026-01-01", `${id}.md`);
|
|
118
|
+
await mkdir(path.dirname(archivedPath), { recursive: true });
|
|
119
|
+
await rename(source.path, archivedPath);
|
|
120
|
+
resetStaticCaches();
|
|
121
|
+
const memory = (await storage.readArchivedMemories()).find((m) => m.frontmatter.id === id);
|
|
122
|
+
assert.ok(memory);
|
|
123
|
+
assert.equal(memory.frontmatter.status, "archived");
|
|
124
|
+
assert.equal(await storage.moveMemoryToPath(memory, storage.buildTierMemoryPath(memory, "cold")), true);
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
test("a tier move ignores caller edits to a loaded memory's frontmatter, not just its content", async () => {
|
|
129
|
+
await withStorage(async (storage) => {
|
|
130
|
+
const { id } = await storage.writeMemory("fact", "frontmatter edited by caller", { tags: ["kept"] });
|
|
131
|
+
const memory = (await storage.readAllMemories()).find((m) => m.frontmatter.id === id);
|
|
132
|
+
assert.ok(memory);
|
|
133
|
+
memory.frontmatter.tags = [...memory.frontmatter.tags, "caller-only"];
|
|
134
|
+
memory.frontmatter.confidence = 0.01;
|
|
135
|
+
memory.frontmatter.created = "2000-01-01T00:00:00.000Z";
|
|
136
|
+
memory.frontmatter.updated = "2000-01-02T00:00:00.000Z";
|
|
137
|
+
assert.equal(await storage.moveMemoryToPath(memory, storage.buildTierMemoryPath(memory, "cold")), true);
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
test("a file with no created or updated is refused on every move, not only when the clock ticks", async () => {
|
|
142
|
+
await withStorage(async (storage) => {
|
|
143
|
+
const memories: MemoryFile[] = [];
|
|
144
|
+
for (let i = 0; i < 12; i++) {
|
|
145
|
+
const { id } = await storage.writeMemory("fact", `no timestamps ${i}`);
|
|
146
|
+
const file = (await storage.readAllMemories()).find((m) => m.frontmatter.id === id);
|
|
147
|
+
assert.ok(file);
|
|
148
|
+
const disk = await readFile(file.path, "utf8");
|
|
149
|
+
await writeFile(file.path, disk.replace(/^(created|updated): .*\n/gm, ""));
|
|
150
|
+
}
|
|
151
|
+
resetStaticCaches();
|
|
152
|
+
for (const m of await storage.readAllMemories()) if (m.content.startsWith("no timestamps")) memories.push(m);
|
|
153
|
+
assert.equal(memories.length, 12);
|
|
154
|
+
await new Promise((resolve) => setTimeout(resolve, 5)); // a fresh parse now stamps a later millisecond
|
|
155
|
+
for (const memory of memories) {
|
|
156
|
+
await assert.rejects(
|
|
157
|
+
() => storage.moveMemoryToPath(memory, storage.buildTierMemoryPath(memory, "cold")),
|
|
158
|
+
/changed before its tier move/,
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
test("a loaded memory under an entities path moves: the snapshot normalizes with the file's content", async () => {
|
|
165
|
+
await withStorage(async (storage, dir) => {
|
|
166
|
+
const { id } = await storage.writeMemory("fact", "**Type:** vendor\n\nan entity-like note");
|
|
167
|
+
const source = (await storage.readAllMemories()).find((m) => m.frontmatter.id === id);
|
|
168
|
+
assert.ok(source);
|
|
169
|
+
const entityPath = path.join(dir, "facts", "entities", `${id}.md`);
|
|
170
|
+
await mkdir(path.dirname(entityPath), { recursive: true });
|
|
171
|
+
await rename(source.path, entityPath);
|
|
172
|
+
resetStaticCaches();
|
|
173
|
+
const memory = (await storage.readAllMemories()).find((m) => m.frontmatter.id === id);
|
|
174
|
+
assert.ok(memory);
|
|
175
|
+
assert.ok(memory.frontmatter.tags.includes("vendor"), "loaded tags carry the type read from the content");
|
|
176
|
+
assert.equal(await storage.moveMemoryToPath(memory, storage.buildTierMemoryPath(memory, "cold")), true);
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
test("an indented created or updated key counts as present: caller edits to it do not refuse the move", async () => {
|
|
181
|
+
await withStorage(async (storage) => {
|
|
182
|
+
const { id } = await storage.writeMemory("fact", "indented timestamp keys");
|
|
183
|
+
const file = (await storage.readAllMemories()).find((m) => m.frontmatter.id === id);
|
|
184
|
+
assert.ok(file);
|
|
185
|
+
const disk = await readFile(file.path, "utf8");
|
|
186
|
+
await writeFile(file.path, disk.replace(/^(created|updated):/gm, " $1:"));
|
|
187
|
+
resetStaticCaches();
|
|
188
|
+
const memory = (await storage.readAllMemories()).find((m) => m.frontmatter.id === id);
|
|
189
|
+
assert.ok(memory);
|
|
190
|
+
memory.frontmatter.created = "2000-01-01T00:00:00.000Z";
|
|
191
|
+
memory.frontmatter.updated = "2000-01-02T00:00:00.000Z";
|
|
192
|
+
assert.equal(await storage.moveMemoryToPath(memory, storage.buildTierMemoryPath(memory, "cold")), true);
|
|
193
|
+
});
|
|
194
|
+
});
|