@remnic/core 9.35.1 → 9.35.3
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.d.ts +5 -5
- package/dist/access-admin-ops-surface.js +19 -18
- package/dist/access-authorization-probe.d.ts +5 -5
- package/dist/access-authorization-probe.js +20 -19
- package/dist/access-boundary.d.ts +5 -5
- package/dist/access-boundary.js +19 -18
- package/dist/access-cli.js +43 -42
- package/dist/access-cli.js.map +1 -1
- package/dist/access-extraction-force-flush.d.ts +5 -5
- package/dist/access-extraction-force-flush.js +19 -18
- package/dist/access-http-lcm-compaction.d.ts +5 -5
- package/dist/access-http-lifecycle-flush.d.ts +5 -5
- package/dist/access-http.d.ts +5 -5
- package/dist/access-http.js +24 -23
- package/dist/access-identity-continuity-surface.d.ts +4 -4
- package/dist/access-identity-continuity-surface.js +19 -18
- package/dist/access-lcm-surface.d.ts +5 -5
- package/dist/access-lcm-surface.js +19 -18
- package/dist/access-mcp.d.ts +5 -5
- package/dist/access-mcp.js +22 -21
- package/dist/access-namespace-preflight.js +19 -18
- package/dist/access-observe-write-surface.d.ts +5 -5
- package/dist/access-observe-write-surface.js +19 -18
- package/dist/access-operations-batch.js +20 -19
- package/dist/access-operations.d.ts +8 -8
- package/dist/access-operations.js +21 -20
- package/dist/access-recall-concurrency.d.ts +5 -5
- package/dist/access-recall-concurrency.js +19 -18
- package/dist/access-recall-response.d.ts +5 -5
- package/dist/access-recall-response.js +19 -18
- package/dist/access-recall-surface.d.ts +5 -5
- package/dist/access-recall-surface.js +19 -18
- package/dist/access-schema.d.ts +88 -88
- package/dist/{access-service-D9zIBlpp.d.ts → access-service-C2WYT1pO.d.ts} +3 -3
- package/dist/access-service-helpers.d.ts +5 -5
- package/dist/access-service.d.ts +5 -5
- package/dist/access-service.js +19 -18
- package/dist/access-surface-catalog.d.ts +5 -5
- package/dist/access-wearables-meetings-surface.d.ts +2 -2
- package/dist/bootstrap.d.ts +4 -4
- package/dist/briefing.d.ts +1 -1
- package/dist/briefing.js +10 -9
- package/dist/buffer.d.ts +1 -1
- package/dist/{capsule-merge-2H2IUTBT.js → capsule-merge-IDWJPCWK.js} +77 -8
- package/dist/capsule-merge-IDWJPCWK.js.map +1 -0
- package/dist/causal-consolidation.js +11 -10
- package/dist/causal-consolidation.js.map +1 -1
- package/dist/{chunk-65ZPVYTA.js → chunk-3CE77VAP.js} +55 -5
- package/dist/chunk-3CE77VAP.js.map +1 -0
- package/dist/chunk-4J7G5SY4.js +338 -0
- package/dist/chunk-4J7G5SY4.js.map +1 -0
- package/dist/{chunk-EO7X2LDK.js → chunk-4TAD3B56.js} +2 -2
- package/dist/{chunk-QHYB4MJV.js → chunk-5ZGHUWTT.js} +2 -2
- package/dist/{chunk-TCIWHK3N.js → chunk-6D5D5A4M.js} +5 -5
- package/dist/{chunk-BIXWNHIL.js → chunk-6TF4M2LB.js} +5 -5
- package/dist/{chunk-2NUC473W.js → chunk-AKELMJO2.js} +220 -48
- package/dist/{chunk-2NUC473W.js.map → chunk-AKELMJO2.js.map} +1 -1
- package/dist/{chunk-FBUE6PD3.js → chunk-BEQOZOYZ.js} +21 -4
- package/dist/chunk-BEQOZOYZ.js.map +1 -0
- package/dist/{chunk-SA3WJJF2.js → chunk-BGLDKAYY.js} +2 -2
- package/dist/{chunk-OPRP6Q4Z.js → chunk-DKKZ6SO2.js} +3 -3
- package/dist/{chunk-6TAUHL33.js → chunk-DLVPUX7U.js} +10 -2
- package/dist/chunk-DLVPUX7U.js.map +1 -0
- package/dist/{chunk-QNWXCJ76.js → chunk-ENTCVTQR.js} +18 -1
- package/dist/{chunk-QNWXCJ76.js.map → chunk-ENTCVTQR.js.map} +1 -1
- package/dist/{chunk-AEPYA55F.js → chunk-FE7MUX7M.js} +2 -2
- package/dist/{chunk-NQUF7XKR.js → chunk-FT4RF53O.js} +2 -2
- package/dist/{chunk-GHR7WHZX.js → chunk-GORHSN5C.js} +2 -2
- package/dist/{chunk-7TEZUUGM.js → chunk-HUS2XN3T.js} +2 -2
- package/dist/{chunk-XWDZQIYU.js → chunk-IJAQCBGV.js} +2 -2
- package/dist/{chunk-TJLLYV2X.js → chunk-IMEXE4XS.js} +7 -7
- package/dist/{chunk-ZCPP5OW6.js → chunk-JQSBRLJ6.js} +31 -27
- package/dist/chunk-JQSBRLJ6.js.map +1 -0
- package/dist/{chunk-IZXTZ7BF.js → chunk-JYLN6KHH.js} +6 -6
- package/dist/{chunk-HEVWWPTL.js → chunk-LH3KXIBJ.js} +17 -17
- package/dist/{chunk-EH5U2YCX.js → chunk-M3DBB2ND.js} +2 -2
- package/dist/{chunk-XABS455Y.js → chunk-NBAEGFXT.js} +5 -5
- package/dist/{chunk-DP7ZV2II.js → chunk-OA6PIPDE.js} +2 -2
- package/dist/{chunk-T4HH5Q3U.js → chunk-OJRLTZQM.js} +3 -3
- package/dist/{chunk-7ZHGPX56.js → chunk-PRP3M5Y3.js} +2 -2
- package/dist/{chunk-Y2ZD2RVG.js → chunk-PYTUBWAS.js} +2 -2
- package/dist/{chunk-4TGZCYHH.js → chunk-Q3CVY7LV.js} +1954 -1642
- package/dist/chunk-Q3CVY7LV.js.map +1 -0
- package/dist/{chunk-PH3ZWL3W.js → chunk-Q53RLEW7.js} +2 -2
- package/dist/{chunk-Y6OWJ3V5.js → chunk-RY2XZTFN.js} +2 -2
- package/dist/{chunk-2SHIWGY7.js → chunk-RY7CHVGE.js} +2 -2
- package/dist/{chunk-7VUAG236.js → chunk-T3FVAHM7.js} +4 -4
- package/dist/{chunk-2LTDWSR6.js → chunk-TSH56VPU.js} +2 -2
- package/dist/{chunk-J6SLNQRO.js → chunk-UBWOCQ3I.js} +6 -2
- package/dist/chunk-UBWOCQ3I.js.map +1 -0
- package/dist/{chunk-5FHE4JI7.js → chunk-VEUVON5I.js} +2 -2
- package/dist/{chunk-KEWUNL7P.js → chunk-WET4M3R6.js} +2 -2
- package/dist/chunk-WKDFJXW5.js +158 -0
- package/dist/chunk-WKDFJXW5.js.map +1 -0
- package/dist/{chunk-SLPLPGJQ.js → chunk-WL2S2UBB.js} +5 -5
- package/dist/{chunk-AHZYNPLX.js → chunk-YVMVVE4B.js} +2 -2
- package/dist/{chunk-5HTAJCTO.js → chunk-ZB3YODID.js} +15 -15
- package/dist/{cli-mFX-QQvx.d.ts → cli-jkmzdT8P.d.ts} +3 -3
- package/dist/cli.d.ts +6 -6
- package/dist/cli.js +34 -33
- package/dist/compounding/engine.d.ts +1 -1
- package/dist/compounding/engine.js +10 -9
- package/dist/connectors/codex-materialize-runner.js +10 -9
- package/dist/connectors/index.js +10 -9
- package/dist/consolidation-provenance-check.d.ts +1 -1
- package/dist/consolidation-provenance-check.js +8 -2
- package/dist/consolidation-undo.d.ts +1 -1
- package/dist/consolidation-undo.js +10 -1
- package/dist/consolidation-undo.js.map +1 -1
- package/dist/contradiction/index.d.ts +1 -1
- package/dist/corpus-watermark.js +12 -11
- package/dist/entity-retrieval.d.ts +1 -1
- package/dist/entity-retrieval.js +10 -9
- package/dist/explicit-capture.d.ts +4 -4
- package/dist/explicit-capture.js +6 -3
- package/dist/extraction.js +13 -12
- package/dist/{forget-4UY2EOKH.js → forget-DNAJ66ZD.js} +2 -2
- package/dist/index.d.ts +398 -398
- package/dist/index.js +43 -42
- package/dist/local-llm-helpers.d.ts +63 -1
- package/dist/local-llm-helpers.js +10 -1
- package/dist/local-llm.d.ts +4 -1
- package/dist/local-llm.js +2 -2
- package/dist/maintenance/memory-governance.js +10 -9
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +1 -1
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +10 -9
- package/dist/maintenance/rebuild-memory-projection.d.ts +1 -1
- package/dist/maintenance/rebuild-memory-projection.js +11 -10
- package/dist/{maintenance-70Wq118b.d.ts → maintenance-Ha9Dg93M.d.ts} +1 -1
- package/dist/mcp-memory-inspector-app.d.ts +5 -5
- package/dist/memory-worth-outcomes.d.ts +1 -1
- package/dist/namespaces/migrate.d.ts +1 -1
- package/dist/namespaces/migrate.js +11 -10
- package/dist/namespaces/storage.d.ts +1 -1
- package/dist/namespaces/storage.js +10 -9
- package/dist/offline-sync-impression-drain.js +3 -3
- package/dist/operator-doctor-corpus.js +13 -12
- package/dist/operator-toolkit.d.ts +1 -1
- package/dist/operator-toolkit.js +17 -16
- package/dist/orchestration/compression-guideline-coordinator.d.ts +1 -1
- package/dist/orchestration/maintenance.d.ts +2 -2
- package/dist/orchestration/maintenance.js +15 -14
- package/dist/{orchestrator-BH8LT-NX.d.ts → orchestrator-DV_u9bfx.d.ts} +3 -3
- package/dist/orchestrator.d.ts +4 -4
- package/dist/orchestrator.js +43 -42
- package/dist/page-versioning.js +7 -1
- package/dist/schemas.d.ts +76 -76
- package/dist/semantic-consolidation.js +11 -10
- package/dist/semantic-rule-promotion.js +10 -9
- package/dist/semantic-rule-verifier.js +10 -9
- package/dist/{service-CrxXHz5T.d.ts → service-JxXXY-Eh.d.ts} +1 -1
- package/dist/shared-context/manager.d.ts +8 -8
- package/dist/source-agent-qualifier.js +10 -9
- package/dist/{storage-CyWa1Jm6.d.ts → storage-BbH4HDUS.d.ts} +30 -26
- package/dist/storage.d.ts +1 -1
- package/dist/storage.js +9 -8
- package/dist/summarizer.js +3 -3
- package/dist/temporal-supersession.d.ts +1 -1
- package/dist/tier-migration.d.ts +1 -1
- package/dist/transfer/capsule-import.js +8 -2
- package/dist/transfer/types.d.ts +66 -66
- package/dist/verified-recall.js +10 -9
- package/package.json +2 -2
- package/src/binary-lifecycle/pipeline.ts +52 -1
- package/src/consolidation-undo.ts +4 -0
- package/src/curation/index.ts +41 -5
- package/src/lifecycle/tombstones.ts +40 -0
- package/src/local-llm-helpers.ts +171 -0
- package/src/local-llm.ts +34 -30
- package/src/maintenance/memory-governance.ts +4 -0
- package/src/page-versioning.ts +16 -1
- package/src/review/index.ts +97 -13
- package/src/spaces/index.ts +127 -6
- package/src/storage/citation-hash-source.ts +97 -0
- package/src/storage/entity-canonical-id-lock.ts +33 -0
- package/src/storage/entity-canonical-id-migration-adapter.ts +8 -4
- package/src/storage/entity-canonical-id-migration.ts +129 -77
- package/src/storage/entity-canonical-id-references.ts +557 -0
- package/src/storage/entity-ref-repair.ts +171 -0
- package/src/storage/entity-store.ts +163 -2
- package/src/storage/tombstone-blocked-capture-sync.ts +18 -0
- package/src/storage.ts +363 -396
- package/src/transfer/capsule-import.ts +91 -3
- package/src/transfer/capsule-merge.ts +128 -10
- package/dist/capsule-merge-2H2IUTBT.js.map +0 -1
- package/dist/chunk-4RNZMRAV.js +0 -60
- package/dist/chunk-4RNZMRAV.js.map +0 -1
- package/dist/chunk-4TGZCYHH.js.map +0 -1
- package/dist/chunk-65ZPVYTA.js.map +0 -1
- package/dist/chunk-6TAUHL33.js.map +0 -1
- package/dist/chunk-FBUE6PD3.js.map +0 -1
- package/dist/chunk-J6SLNQRO.js.map +0 -1
- package/dist/chunk-ZCPP5OW6.js.map +0 -1
- /package/dist/{chunk-EO7X2LDK.js.map → chunk-4TAD3B56.js.map} +0 -0
- /package/dist/{chunk-QHYB4MJV.js.map → chunk-5ZGHUWTT.js.map} +0 -0
- /package/dist/{chunk-TCIWHK3N.js.map → chunk-6D5D5A4M.js.map} +0 -0
- /package/dist/{chunk-BIXWNHIL.js.map → chunk-6TF4M2LB.js.map} +0 -0
- /package/dist/{chunk-SA3WJJF2.js.map → chunk-BGLDKAYY.js.map} +0 -0
- /package/dist/{chunk-OPRP6Q4Z.js.map → chunk-DKKZ6SO2.js.map} +0 -0
- /package/dist/{chunk-AEPYA55F.js.map → chunk-FE7MUX7M.js.map} +0 -0
- /package/dist/{chunk-NQUF7XKR.js.map → chunk-FT4RF53O.js.map} +0 -0
- /package/dist/{chunk-GHR7WHZX.js.map → chunk-GORHSN5C.js.map} +0 -0
- /package/dist/{chunk-7TEZUUGM.js.map → chunk-HUS2XN3T.js.map} +0 -0
- /package/dist/{chunk-XWDZQIYU.js.map → chunk-IJAQCBGV.js.map} +0 -0
- /package/dist/{chunk-TJLLYV2X.js.map → chunk-IMEXE4XS.js.map} +0 -0
- /package/dist/{chunk-IZXTZ7BF.js.map → chunk-JYLN6KHH.js.map} +0 -0
- /package/dist/{chunk-HEVWWPTL.js.map → chunk-LH3KXIBJ.js.map} +0 -0
- /package/dist/{chunk-EH5U2YCX.js.map → chunk-M3DBB2ND.js.map} +0 -0
- /package/dist/{chunk-XABS455Y.js.map → chunk-NBAEGFXT.js.map} +0 -0
- /package/dist/{chunk-DP7ZV2II.js.map → chunk-OA6PIPDE.js.map} +0 -0
- /package/dist/{chunk-T4HH5Q3U.js.map → chunk-OJRLTZQM.js.map} +0 -0
- /package/dist/{chunk-7ZHGPX56.js.map → chunk-PRP3M5Y3.js.map} +0 -0
- /package/dist/{chunk-Y2ZD2RVG.js.map → chunk-PYTUBWAS.js.map} +0 -0
- /package/dist/{chunk-PH3ZWL3W.js.map → chunk-Q53RLEW7.js.map} +0 -0
- /package/dist/{chunk-Y6OWJ3V5.js.map → chunk-RY2XZTFN.js.map} +0 -0
- /package/dist/{chunk-2SHIWGY7.js.map → chunk-RY7CHVGE.js.map} +0 -0
- /package/dist/{chunk-7VUAG236.js.map → chunk-T3FVAHM7.js.map} +0 -0
- /package/dist/{chunk-2LTDWSR6.js.map → chunk-TSH56VPU.js.map} +0 -0
- /package/dist/{chunk-5FHE4JI7.js.map → chunk-VEUVON5I.js.map} +0 -0
- /package/dist/{chunk-KEWUNL7P.js.map → chunk-WET4M3R6.js.map} +0 -0
- /package/dist/{chunk-SLPLPGJQ.js.map → chunk-WL2S2UBB.js.map} +0 -0
- /package/dist/{chunk-AHZYNPLX.js.map → chunk-YVMVVE4B.js.map} +0 -0
- /package/dist/{chunk-5HTAJCTO.js.map → chunk-ZB3YODID.js.map} +0 -0
- /package/dist/{forget-4UY2EOKH.js.map → forget-DNAJ66ZD.js.map} +0 -0
package/dist/transfer/types.d.ts
CHANGED
|
@@ -20,26 +20,26 @@ declare const ExportManifestV1Schema: z.ZodObject<{
|
|
|
20
20
|
bytes: number;
|
|
21
21
|
}>, "many">;
|
|
22
22
|
}, "strip", z.ZodTypeAny, {
|
|
23
|
-
|
|
23
|
+
format: "openclaw-engram-export";
|
|
24
24
|
createdAt: string;
|
|
25
|
+
pluginVersion: string;
|
|
25
26
|
files: {
|
|
26
27
|
path: string;
|
|
27
28
|
sha256: string;
|
|
28
29
|
bytes: number;
|
|
29
30
|
}[];
|
|
30
|
-
|
|
31
|
-
pluginVersion: string;
|
|
31
|
+
schemaVersion: 1;
|
|
32
32
|
includesTranscripts: boolean;
|
|
33
33
|
}, {
|
|
34
|
-
|
|
34
|
+
format: "openclaw-engram-export";
|
|
35
35
|
createdAt: string;
|
|
36
|
+
pluginVersion: string;
|
|
36
37
|
files: {
|
|
37
38
|
path: string;
|
|
38
39
|
sha256: string;
|
|
39
40
|
bytes: number;
|
|
40
41
|
}[];
|
|
41
|
-
|
|
42
|
-
pluginVersion: string;
|
|
42
|
+
schemaVersion: 1;
|
|
43
43
|
includesTranscripts: boolean;
|
|
44
44
|
}>;
|
|
45
45
|
type ExportManifestV1 = z.infer<typeof ExportManifestV1Schema>;
|
|
@@ -75,26 +75,26 @@ declare const ExportBundleV1Schema: z.ZodObject<{
|
|
|
75
75
|
bytes: number;
|
|
76
76
|
}>, "many">;
|
|
77
77
|
}, "strip", z.ZodTypeAny, {
|
|
78
|
-
|
|
78
|
+
format: "openclaw-engram-export";
|
|
79
79
|
createdAt: string;
|
|
80
|
+
pluginVersion: string;
|
|
80
81
|
files: {
|
|
81
82
|
path: string;
|
|
82
83
|
sha256: string;
|
|
83
84
|
bytes: number;
|
|
84
85
|
}[];
|
|
85
|
-
|
|
86
|
-
pluginVersion: string;
|
|
86
|
+
schemaVersion: 1;
|
|
87
87
|
includesTranscripts: boolean;
|
|
88
88
|
}, {
|
|
89
|
-
|
|
89
|
+
format: "openclaw-engram-export";
|
|
90
90
|
createdAt: string;
|
|
91
|
+
pluginVersion: string;
|
|
91
92
|
files: {
|
|
92
93
|
path: string;
|
|
93
94
|
sha256: string;
|
|
94
95
|
bytes: number;
|
|
95
96
|
}[];
|
|
96
|
-
|
|
97
|
-
pluginVersion: string;
|
|
97
|
+
schemaVersion: 1;
|
|
98
98
|
includesTranscripts: boolean;
|
|
99
99
|
}>;
|
|
100
100
|
records: z.ZodArray<z.ZodObject<{
|
|
@@ -109,15 +109,15 @@ declare const ExportBundleV1Schema: z.ZodObject<{
|
|
|
109
109
|
}>, "many">;
|
|
110
110
|
}, "strip", z.ZodTypeAny, {
|
|
111
111
|
manifest: {
|
|
112
|
-
|
|
112
|
+
format: "openclaw-engram-export";
|
|
113
113
|
createdAt: string;
|
|
114
|
+
pluginVersion: string;
|
|
114
115
|
files: {
|
|
115
116
|
path: string;
|
|
116
117
|
sha256: string;
|
|
117
118
|
bytes: number;
|
|
118
119
|
}[];
|
|
119
|
-
|
|
120
|
-
pluginVersion: string;
|
|
120
|
+
schemaVersion: 1;
|
|
121
121
|
includesTranscripts: boolean;
|
|
122
122
|
};
|
|
123
123
|
records: {
|
|
@@ -126,15 +126,15 @@ declare const ExportBundleV1Schema: z.ZodObject<{
|
|
|
126
126
|
}[];
|
|
127
127
|
}, {
|
|
128
128
|
manifest: {
|
|
129
|
-
|
|
129
|
+
format: "openclaw-engram-export";
|
|
130
130
|
createdAt: string;
|
|
131
|
+
pluginVersion: string;
|
|
131
132
|
files: {
|
|
132
133
|
path: string;
|
|
133
134
|
sha256: string;
|
|
134
135
|
bytes: number;
|
|
135
136
|
}[];
|
|
136
|
-
|
|
137
|
-
pluginVersion: string;
|
|
137
|
+
schemaVersion: 1;
|
|
138
138
|
includesTranscripts: boolean;
|
|
139
139
|
};
|
|
140
140
|
records: {
|
|
@@ -313,16 +313,16 @@ declare const CapsuleBlockSchema: z.ZodObject<{
|
|
|
313
313
|
peerProfiles: boolean;
|
|
314
314
|
}>;
|
|
315
315
|
}, "strip", z.ZodTypeAny, {
|
|
316
|
-
schemaVersion: string;
|
|
317
316
|
includes: {
|
|
318
317
|
procedural: boolean;
|
|
319
318
|
taxonomy: boolean;
|
|
320
319
|
identityAnchors: boolean;
|
|
321
320
|
peerProfiles: boolean;
|
|
322
321
|
};
|
|
322
|
+
description: string;
|
|
323
323
|
id: string;
|
|
324
|
+
schemaVersion: string;
|
|
324
325
|
version: string;
|
|
325
|
-
description: string;
|
|
326
326
|
parentCapsule: string | null;
|
|
327
327
|
parent: {
|
|
328
328
|
version: string;
|
|
@@ -334,16 +334,16 @@ declare const CapsuleBlockSchema: z.ZodObject<{
|
|
|
334
334
|
directAnswerEnabled: boolean;
|
|
335
335
|
};
|
|
336
336
|
}, {
|
|
337
|
-
schemaVersion: string;
|
|
338
337
|
includes: {
|
|
339
338
|
procedural: boolean;
|
|
340
339
|
taxonomy: boolean;
|
|
341
340
|
identityAnchors: boolean;
|
|
342
341
|
peerProfiles: boolean;
|
|
343
342
|
};
|
|
343
|
+
description: string;
|
|
344
344
|
id: string;
|
|
345
|
+
schemaVersion: string;
|
|
345
346
|
version: string;
|
|
346
|
-
description: string;
|
|
347
347
|
parentCapsule: string | null;
|
|
348
348
|
retrievalPolicy: {
|
|
349
349
|
tierWeights: Record<string, number>;
|
|
@@ -464,16 +464,16 @@ declare const ExportManifestV2Schema: z.ZodObject<{
|
|
|
464
464
|
peerProfiles: boolean;
|
|
465
465
|
}>;
|
|
466
466
|
}, "strip", z.ZodTypeAny, {
|
|
467
|
-
schemaVersion: string;
|
|
468
467
|
includes: {
|
|
469
468
|
procedural: boolean;
|
|
470
469
|
taxonomy: boolean;
|
|
471
470
|
identityAnchors: boolean;
|
|
472
471
|
peerProfiles: boolean;
|
|
473
472
|
};
|
|
473
|
+
description: string;
|
|
474
474
|
id: string;
|
|
475
|
+
schemaVersion: string;
|
|
475
476
|
version: string;
|
|
476
|
-
description: string;
|
|
477
477
|
parentCapsule: string | null;
|
|
478
478
|
parent: {
|
|
479
479
|
version: string;
|
|
@@ -485,16 +485,16 @@ declare const ExportManifestV2Schema: z.ZodObject<{
|
|
|
485
485
|
directAnswerEnabled: boolean;
|
|
486
486
|
};
|
|
487
487
|
}, {
|
|
488
|
-
schemaVersion: string;
|
|
489
488
|
includes: {
|
|
490
489
|
procedural: boolean;
|
|
491
490
|
taxonomy: boolean;
|
|
492
491
|
identityAnchors: boolean;
|
|
493
492
|
peerProfiles: boolean;
|
|
494
493
|
};
|
|
494
|
+
description: string;
|
|
495
495
|
id: string;
|
|
496
|
+
schemaVersion: string;
|
|
496
497
|
version: string;
|
|
497
|
-
description: string;
|
|
498
498
|
parentCapsule: string | null;
|
|
499
499
|
retrievalPolicy: {
|
|
500
500
|
tierWeights: Record<string, number>;
|
|
@@ -507,27 +507,25 @@ declare const ExportManifestV2Schema: z.ZodObject<{
|
|
|
507
507
|
} | null | undefined;
|
|
508
508
|
}>;
|
|
509
509
|
}, "strip", z.ZodTypeAny, {
|
|
510
|
-
|
|
510
|
+
format: "openclaw-engram-export";
|
|
511
511
|
createdAt: string;
|
|
512
|
+
pluginVersion: string;
|
|
512
513
|
files: {
|
|
513
514
|
path: string;
|
|
514
515
|
sha256: string;
|
|
515
516
|
bytes: number;
|
|
516
517
|
}[];
|
|
517
|
-
format: "openclaw-engram-export";
|
|
518
|
-
pluginVersion: string;
|
|
519
|
-
includesTranscripts: boolean;
|
|
520
518
|
capsule: {
|
|
521
|
-
schemaVersion: string;
|
|
522
519
|
includes: {
|
|
523
520
|
procedural: boolean;
|
|
524
521
|
taxonomy: boolean;
|
|
525
522
|
identityAnchors: boolean;
|
|
526
523
|
peerProfiles: boolean;
|
|
527
524
|
};
|
|
525
|
+
description: string;
|
|
528
526
|
id: string;
|
|
527
|
+
schemaVersion: string;
|
|
529
528
|
version: string;
|
|
530
|
-
description: string;
|
|
531
529
|
parentCapsule: string | null;
|
|
532
530
|
parent: {
|
|
533
531
|
version: string;
|
|
@@ -539,28 +537,28 @@ declare const ExportManifestV2Schema: z.ZodObject<{
|
|
|
539
537
|
directAnswerEnabled: boolean;
|
|
540
538
|
};
|
|
541
539
|
};
|
|
542
|
-
}, {
|
|
543
540
|
schemaVersion: 2;
|
|
541
|
+
includesTranscripts: boolean;
|
|
542
|
+
}, {
|
|
543
|
+
format: "openclaw-engram-export";
|
|
544
544
|
createdAt: string;
|
|
545
|
+
pluginVersion: string;
|
|
545
546
|
files: {
|
|
546
547
|
path: string;
|
|
547
548
|
sha256: string;
|
|
548
549
|
bytes: number;
|
|
549
550
|
}[];
|
|
550
|
-
format: "openclaw-engram-export";
|
|
551
|
-
pluginVersion: string;
|
|
552
|
-
includesTranscripts: boolean;
|
|
553
551
|
capsule: {
|
|
554
|
-
schemaVersion: string;
|
|
555
552
|
includes: {
|
|
556
553
|
procedural: boolean;
|
|
557
554
|
taxonomy: boolean;
|
|
558
555
|
identityAnchors: boolean;
|
|
559
556
|
peerProfiles: boolean;
|
|
560
557
|
};
|
|
558
|
+
description: string;
|
|
561
559
|
id: string;
|
|
560
|
+
schemaVersion: string;
|
|
562
561
|
version: string;
|
|
563
|
-
description: string;
|
|
564
562
|
parentCapsule: string | null;
|
|
565
563
|
retrievalPolicy: {
|
|
566
564
|
tierWeights: Record<string, number>;
|
|
@@ -572,6 +570,8 @@ declare const ExportManifestV2Schema: z.ZodObject<{
|
|
|
572
570
|
forkRoot: string;
|
|
573
571
|
} | null | undefined;
|
|
574
572
|
};
|
|
573
|
+
schemaVersion: 2;
|
|
574
|
+
includesTranscripts: boolean;
|
|
575
575
|
}>;
|
|
576
576
|
type ExportManifestV2 = z.infer<typeof ExportManifestV2Schema>;
|
|
577
577
|
declare const ExportBundleV2Schema: z.ZodObject<{
|
|
@@ -683,16 +683,16 @@ declare const ExportBundleV2Schema: z.ZodObject<{
|
|
|
683
683
|
peerProfiles: boolean;
|
|
684
684
|
}>;
|
|
685
685
|
}, "strip", z.ZodTypeAny, {
|
|
686
|
-
schemaVersion: string;
|
|
687
686
|
includes: {
|
|
688
687
|
procedural: boolean;
|
|
689
688
|
taxonomy: boolean;
|
|
690
689
|
identityAnchors: boolean;
|
|
691
690
|
peerProfiles: boolean;
|
|
692
691
|
};
|
|
692
|
+
description: string;
|
|
693
693
|
id: string;
|
|
694
|
+
schemaVersion: string;
|
|
694
695
|
version: string;
|
|
695
|
-
description: string;
|
|
696
696
|
parentCapsule: string | null;
|
|
697
697
|
parent: {
|
|
698
698
|
version: string;
|
|
@@ -704,16 +704,16 @@ declare const ExportBundleV2Schema: z.ZodObject<{
|
|
|
704
704
|
directAnswerEnabled: boolean;
|
|
705
705
|
};
|
|
706
706
|
}, {
|
|
707
|
-
schemaVersion: string;
|
|
708
707
|
includes: {
|
|
709
708
|
procedural: boolean;
|
|
710
709
|
taxonomy: boolean;
|
|
711
710
|
identityAnchors: boolean;
|
|
712
711
|
peerProfiles: boolean;
|
|
713
712
|
};
|
|
713
|
+
description: string;
|
|
714
714
|
id: string;
|
|
715
|
+
schemaVersion: string;
|
|
715
716
|
version: string;
|
|
716
|
-
description: string;
|
|
717
717
|
parentCapsule: string | null;
|
|
718
718
|
retrievalPolicy: {
|
|
719
719
|
tierWeights: Record<string, number>;
|
|
@@ -726,27 +726,25 @@ declare const ExportBundleV2Schema: z.ZodObject<{
|
|
|
726
726
|
} | null | undefined;
|
|
727
727
|
}>;
|
|
728
728
|
}, "strip", z.ZodTypeAny, {
|
|
729
|
-
|
|
729
|
+
format: "openclaw-engram-export";
|
|
730
730
|
createdAt: string;
|
|
731
|
+
pluginVersion: string;
|
|
731
732
|
files: {
|
|
732
733
|
path: string;
|
|
733
734
|
sha256: string;
|
|
734
735
|
bytes: number;
|
|
735
736
|
}[];
|
|
736
|
-
format: "openclaw-engram-export";
|
|
737
|
-
pluginVersion: string;
|
|
738
|
-
includesTranscripts: boolean;
|
|
739
737
|
capsule: {
|
|
740
|
-
schemaVersion: string;
|
|
741
738
|
includes: {
|
|
742
739
|
procedural: boolean;
|
|
743
740
|
taxonomy: boolean;
|
|
744
741
|
identityAnchors: boolean;
|
|
745
742
|
peerProfiles: boolean;
|
|
746
743
|
};
|
|
744
|
+
description: string;
|
|
747
745
|
id: string;
|
|
746
|
+
schemaVersion: string;
|
|
748
747
|
version: string;
|
|
749
|
-
description: string;
|
|
750
748
|
parentCapsule: string | null;
|
|
751
749
|
parent: {
|
|
752
750
|
version: string;
|
|
@@ -758,28 +756,28 @@ declare const ExportBundleV2Schema: z.ZodObject<{
|
|
|
758
756
|
directAnswerEnabled: boolean;
|
|
759
757
|
};
|
|
760
758
|
};
|
|
761
|
-
}, {
|
|
762
759
|
schemaVersion: 2;
|
|
760
|
+
includesTranscripts: boolean;
|
|
761
|
+
}, {
|
|
762
|
+
format: "openclaw-engram-export";
|
|
763
763
|
createdAt: string;
|
|
764
|
+
pluginVersion: string;
|
|
764
765
|
files: {
|
|
765
766
|
path: string;
|
|
766
767
|
sha256: string;
|
|
767
768
|
bytes: number;
|
|
768
769
|
}[];
|
|
769
|
-
format: "openclaw-engram-export";
|
|
770
|
-
pluginVersion: string;
|
|
771
|
-
includesTranscripts: boolean;
|
|
772
770
|
capsule: {
|
|
773
|
-
schemaVersion: string;
|
|
774
771
|
includes: {
|
|
775
772
|
procedural: boolean;
|
|
776
773
|
taxonomy: boolean;
|
|
777
774
|
identityAnchors: boolean;
|
|
778
775
|
peerProfiles: boolean;
|
|
779
776
|
};
|
|
777
|
+
description: string;
|
|
780
778
|
id: string;
|
|
779
|
+
schemaVersion: string;
|
|
781
780
|
version: string;
|
|
782
|
-
description: string;
|
|
783
781
|
parentCapsule: string | null;
|
|
784
782
|
retrievalPolicy: {
|
|
785
783
|
tierWeights: Record<string, number>;
|
|
@@ -791,6 +789,8 @@ declare const ExportBundleV2Schema: z.ZodObject<{
|
|
|
791
789
|
forkRoot: string;
|
|
792
790
|
} | null | undefined;
|
|
793
791
|
};
|
|
792
|
+
schemaVersion: 2;
|
|
793
|
+
includesTranscripts: boolean;
|
|
794
794
|
}>;
|
|
795
795
|
records: z.ZodArray<z.ZodObject<{
|
|
796
796
|
path: z.ZodString;
|
|
@@ -804,27 +804,25 @@ declare const ExportBundleV2Schema: z.ZodObject<{
|
|
|
804
804
|
}>, "many">;
|
|
805
805
|
}, "strip", z.ZodTypeAny, {
|
|
806
806
|
manifest: {
|
|
807
|
-
|
|
807
|
+
format: "openclaw-engram-export";
|
|
808
808
|
createdAt: string;
|
|
809
|
+
pluginVersion: string;
|
|
809
810
|
files: {
|
|
810
811
|
path: string;
|
|
811
812
|
sha256: string;
|
|
812
813
|
bytes: number;
|
|
813
814
|
}[];
|
|
814
|
-
format: "openclaw-engram-export";
|
|
815
|
-
pluginVersion: string;
|
|
816
|
-
includesTranscripts: boolean;
|
|
817
815
|
capsule: {
|
|
818
|
-
schemaVersion: string;
|
|
819
816
|
includes: {
|
|
820
817
|
procedural: boolean;
|
|
821
818
|
taxonomy: boolean;
|
|
822
819
|
identityAnchors: boolean;
|
|
823
820
|
peerProfiles: boolean;
|
|
824
821
|
};
|
|
822
|
+
description: string;
|
|
825
823
|
id: string;
|
|
824
|
+
schemaVersion: string;
|
|
826
825
|
version: string;
|
|
827
|
-
description: string;
|
|
828
826
|
parentCapsule: string | null;
|
|
829
827
|
parent: {
|
|
830
828
|
version: string;
|
|
@@ -836,6 +834,8 @@ declare const ExportBundleV2Schema: z.ZodObject<{
|
|
|
836
834
|
directAnswerEnabled: boolean;
|
|
837
835
|
};
|
|
838
836
|
};
|
|
837
|
+
schemaVersion: 2;
|
|
838
|
+
includesTranscripts: boolean;
|
|
839
839
|
};
|
|
840
840
|
records: {
|
|
841
841
|
content: string;
|
|
@@ -843,27 +843,25 @@ declare const ExportBundleV2Schema: z.ZodObject<{
|
|
|
843
843
|
}[];
|
|
844
844
|
}, {
|
|
845
845
|
manifest: {
|
|
846
|
-
|
|
846
|
+
format: "openclaw-engram-export";
|
|
847
847
|
createdAt: string;
|
|
848
|
+
pluginVersion: string;
|
|
848
849
|
files: {
|
|
849
850
|
path: string;
|
|
850
851
|
sha256: string;
|
|
851
852
|
bytes: number;
|
|
852
853
|
}[];
|
|
853
|
-
format: "openclaw-engram-export";
|
|
854
|
-
pluginVersion: string;
|
|
855
|
-
includesTranscripts: boolean;
|
|
856
854
|
capsule: {
|
|
857
|
-
schemaVersion: string;
|
|
858
855
|
includes: {
|
|
859
856
|
procedural: boolean;
|
|
860
857
|
taxonomy: boolean;
|
|
861
858
|
identityAnchors: boolean;
|
|
862
859
|
peerProfiles: boolean;
|
|
863
860
|
};
|
|
861
|
+
description: string;
|
|
864
862
|
id: string;
|
|
863
|
+
schemaVersion: string;
|
|
865
864
|
version: string;
|
|
866
|
-
description: string;
|
|
867
865
|
parentCapsule: string | null;
|
|
868
866
|
retrievalPolicy: {
|
|
869
867
|
tierWeights: Record<string, number>;
|
|
@@ -875,6 +873,8 @@ declare const ExportBundleV2Schema: z.ZodObject<{
|
|
|
875
873
|
forkRoot: string;
|
|
876
874
|
} | null | undefined;
|
|
877
875
|
};
|
|
876
|
+
schemaVersion: 2;
|
|
877
|
+
includesTranscripts: boolean;
|
|
878
878
|
};
|
|
879
879
|
records: {
|
|
880
880
|
content: string;
|
package/dist/verified-recall.js
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
compareVerifiedEpisodeResults,
|
|
3
3
|
searchVerifiedEpisodes
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-4TAD3B56.js";
|
|
5
5
|
import "./chunk-B7RWBZXW.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-Q3CVY7LV.js";
|
|
7
7
|
import "./chunk-UHVXE24Y.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-ENTCVTQR.js";
|
|
9
9
|
import "./chunk-WIPEXG6R.js";
|
|
10
|
-
import "./chunk-DNHVPZOD.js";
|
|
11
|
-
import "./chunk-6CIAGZ6X.js";
|
|
12
10
|
import "./chunk-HKF5VASQ.js";
|
|
13
11
|
import "./chunk-J6A3CX5N.js";
|
|
14
12
|
import "./chunk-HXDWZFNP.js";
|
|
15
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-T3FVAHM7.js";
|
|
16
14
|
import "./chunk-EGGE52UU.js";
|
|
17
15
|
import "./chunk-ILGC6JH6.js";
|
|
18
16
|
import "./chunk-SCU65EZI.js";
|
|
@@ -20,20 +18,23 @@ import "./chunk-WRJVB3C2.js";
|
|
|
20
18
|
import "./chunk-GCASGYIO.js";
|
|
21
19
|
import "./chunk-DM2T26WE.js";
|
|
22
20
|
import "./chunk-LDXUBPMO.js";
|
|
23
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-BEQOZOYZ.js";
|
|
24
22
|
import "./chunk-CGASUJVP.js";
|
|
25
23
|
import "./chunk-R3DJVOSM.js";
|
|
26
24
|
import "./chunk-BT7NVCML.js";
|
|
27
|
-
import "./chunk-FFAZ2XFU.js";
|
|
28
25
|
import "./chunk-3CSX3ETE.js";
|
|
29
26
|
import "./chunk-RL6NEVXT.js";
|
|
30
27
|
import "./chunk-JYIJNNN3.js";
|
|
31
28
|
import "./chunk-AAD2ZS6P.js";
|
|
32
29
|
import "./chunk-YXZG5TVN.js";
|
|
33
30
|
import "./chunk-G7D6GZ5J.js";
|
|
34
|
-
import "./chunk-
|
|
31
|
+
import "./chunk-DLVPUX7U.js";
|
|
35
32
|
import "./chunk-IJ7HK452.js";
|
|
36
33
|
import "./chunk-PDJTHRAW.js";
|
|
34
|
+
import "./chunk-4J7G5SY4.js";
|
|
35
|
+
import "./chunk-DNHVPZOD.js";
|
|
36
|
+
import "./chunk-6CIAGZ6X.js";
|
|
37
|
+
import "./chunk-FFAZ2XFU.js";
|
|
37
38
|
import "./chunk-W5H6ZRPT.js";
|
|
38
39
|
import "./chunk-XMMESCPD.js";
|
|
39
40
|
import "./chunk-42JKGUFJ.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remnic/core",
|
|
3
|
-
"version": "9.35.
|
|
3
|
+
"version": "9.35.3",
|
|
4
4
|
"description": "Framework-agnostic Remnic memory engine — orchestrator, storage, extraction, search, trust zones",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -3086,7 +3086,7 @@
|
|
|
3086
3086
|
"core"
|
|
3087
3087
|
],
|
|
3088
3088
|
"peerDependencies": {
|
|
3089
|
-
"@remnic/coding-graph": "^9.35.
|
|
3089
|
+
"@remnic/coding-graph": "^9.35.3"
|
|
3090
3090
|
},
|
|
3091
3091
|
"peerDependenciesMeta": {
|
|
3092
3092
|
"@remnic/coding-graph": {
|
|
@@ -20,6 +20,16 @@ import { readManifest, writeManifest } from "./manifest.js";
|
|
|
20
20
|
import { scanForBinaries } from "./scanner.js";
|
|
21
21
|
import { bumpMemoryCorpusVersionForDir } from "../memory-corpus-version.js";
|
|
22
22
|
import { RECALL_FALLBACK_DIRS } from "../utils/category-dir.js";
|
|
23
|
+
import {
|
|
24
|
+
HistoricalEntityCanonicalIdCache,
|
|
25
|
+
canonicalizeEntityRefFrontmatter,
|
|
26
|
+
classifyEntityRefWritePath,
|
|
27
|
+
repairContentAfterJournalMove,
|
|
28
|
+
requestEntityCanonicalIdReconcile,
|
|
29
|
+
} from "../storage/entity-canonical-id-references.js";
|
|
30
|
+
|
|
31
|
+
// Write-boundary journal cache for redirect rewrites (issue #2213).
|
|
32
|
+
const historicalIdCache = new HistoricalEntityCanonicalIdCache();
|
|
23
33
|
|
|
24
34
|
/**
|
|
25
35
|
* True when `mdPath` is an active recall-corpus memory file under `memoryDir`
|
|
@@ -319,7 +329,48 @@ async function stageRedirect(
|
|
|
319
329
|
let writeFailCount = 0;
|
|
320
330
|
for (const update of updates) {
|
|
321
331
|
try {
|
|
322
|
-
|
|
332
|
+
// Whole-record rewrite of bytes read earlier (issue #2213): for
|
|
333
|
+
// memory-tier records, resolve the frontmatter entityRef through the
|
|
334
|
+
// CURRENT journal at the write and REPAIR afterwards — writing back
|
|
335
|
+
// the as-read bytes could revert a rewrite a peer migration performed
|
|
336
|
+
// since the read. findMarkdownFiles also surfaces transcripts,
|
|
337
|
+
// profiles, and other Markdown outside the migration's scope: those
|
|
338
|
+
// keep their bytes (plus the redirect) untouched, and entities/ pages
|
|
339
|
+
// get the bounded reconcile marker instead — their migrated surface
|
|
340
|
+
// is relationship targets, not an entityRef frontmatter field.
|
|
341
|
+
const stateDir = path.join(memoryDir, "state");
|
|
342
|
+
const kind = classifyEntityRefWritePath(memoryDir, update.mdPath);
|
|
343
|
+
if (kind === "memory") {
|
|
344
|
+
const idsAtWrite = historicalIdCache.get(stateDir);
|
|
345
|
+
const written = canonicalizeEntityRefFrontmatter(update.content, idsAtWrite);
|
|
346
|
+
// Snapshot the ORIGINAL bytes: if repair fails after the write, the
|
|
347
|
+
// catch below reports a failed redirect, so the file must return to
|
|
348
|
+
// its pre-redirect state — a retry needs the original reference,
|
|
349
|
+
// and the skipped corpus bump means a warm cache would otherwise
|
|
350
|
+
// keep serving bytes that no longer match disk (AGENTS.md §14).
|
|
351
|
+
const originalBytes = await readMarkdownFile(update.mdPath).catch(() => null);
|
|
352
|
+
await writeMarkdownFile(update.mdPath, written);
|
|
353
|
+
try {
|
|
354
|
+
await repairContentAfterJournalMove({
|
|
355
|
+
stateDir,
|
|
356
|
+
cache: historicalIdCache,
|
|
357
|
+
idsAtWrite,
|
|
358
|
+
rawContent: update.content,
|
|
359
|
+
lastWritten: written,
|
|
360
|
+
rewrite: (next) => writeMarkdownFile(update.mdPath, next),
|
|
361
|
+
});
|
|
362
|
+
} catch (err) {
|
|
363
|
+
if (originalBytes !== null) {
|
|
364
|
+
await writeMarkdownFile(update.mdPath, originalBytes).catch(() => undefined);
|
|
365
|
+
}
|
|
366
|
+
throw err;
|
|
367
|
+
}
|
|
368
|
+
} else {
|
|
369
|
+
await writeMarkdownFile(update.mdPath, update.content);
|
|
370
|
+
if (kind === "entity") {
|
|
371
|
+
await requestEntityCanonicalIdReconcile(stateDir);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
323
374
|
// The redirect rewrote an on-disk memory file out-of-band (not through a
|
|
324
375
|
// StorageManager mutation). Bump the corpus sentinel per write so a warm
|
|
325
376
|
// hot-memories cache rescans — mid-batch too, never serving pre-redirect
|
|
@@ -26,6 +26,7 @@ import { constants as fsConstants } from "node:fs";
|
|
|
26
26
|
import type { StorageManager } from "./storage.js";
|
|
27
27
|
import type { VersioningConfig } from "./page-versioning.js";
|
|
28
28
|
import { bumpMemoryCorpusVersionForDir } from "./memory-corpus-version.js";
|
|
29
|
+
import { requestEntityCanonicalIdReconcile } from "./storage/entity-canonical-id-references.js";
|
|
29
30
|
import { getVersion } from "./page-versioning.js";
|
|
30
31
|
|
|
31
32
|
/**
|
|
@@ -654,6 +655,9 @@ export async function runConsolidationUndo(options: {
|
|
|
654
655
|
// restores would stay invisible to recall until an unrelated mutation or
|
|
655
656
|
// restart (esp. with hotMemoriesCacheTtlMs: 0). Issue #1902, Codex Medium.
|
|
656
657
|
bumpMemoryCorpusVersionForDir(memoryDir);
|
|
658
|
+
// Restored bytes predate the current migration journal and can carry
|
|
659
|
+
// legacy entity references (issue #2213) — request one reconcile pass.
|
|
660
|
+
await requestEntityCanonicalIdReconcile(path.join(memoryDir, "state"));
|
|
657
661
|
result.restores.push({
|
|
658
662
|
entry: p.entry,
|
|
659
663
|
sourcePath: p.sourcePath,
|
package/src/curation/index.ts
CHANGED
|
@@ -10,6 +10,11 @@ import path from "node:path";
|
|
|
10
10
|
import crypto from "node:crypto";
|
|
11
11
|
import { getCategoryDir, ALL_CATEGORY_DIRS } from "../utils/category-dir.js";
|
|
12
12
|
import { bumpMemoryCorpusVersionForDir } from "../memory-corpus-version.js";
|
|
13
|
+
import {
|
|
14
|
+
HistoricalEntityCanonicalIdCache,
|
|
15
|
+
canonicalizeEntityRefFrontmatter,
|
|
16
|
+
repairContentAfterJournalMoveSync,
|
|
17
|
+
} from "../storage/entity-canonical-id-references.js";
|
|
13
18
|
|
|
14
19
|
// ── Types ────────────────────────────────────────────────────────────────────
|
|
15
20
|
|
|
@@ -444,6 +449,10 @@ function loadExistingMemories(memoryDir: string): Map<string, ExistingMemory> {
|
|
|
444
449
|
|
|
445
450
|
// ── Writing ──────────────────────────────────────────────────────────────────
|
|
446
451
|
|
|
452
|
+
// Curation writes raw frontmatter directly, so it is a write boundary for
|
|
453
|
+
// entity references too (issue #2213): resolve through the target's journal.
|
|
454
|
+
const historicalIdCache = new HistoricalEntityCanonicalIdCache();
|
|
455
|
+
|
|
447
456
|
function writeStatement(stmt: CuratedStatement, memoryDir: string): string {
|
|
448
457
|
const now = new Date();
|
|
449
458
|
const dateDir = now.toISOString().split("T")[0];
|
|
@@ -454,8 +463,12 @@ function writeStatement(stmt: CuratedStatement, memoryDir: string): string {
|
|
|
454
463
|
|
|
455
464
|
const fileName = `${stmt.category}-${Date.now()}-${stmt.id.slice(0, 8)}.md`;
|
|
456
465
|
const filePath = path.join(dir, fileName);
|
|
466
|
+
const historicalIds = historicalIdCache.get(path.join(memoryDir, "state"));
|
|
457
467
|
|
|
458
|
-
|
|
468
|
+
// Keep the caller's ORIGINAL ref in the raw form: repair-after-write must
|
|
469
|
+
// re-resolve from it, including the direction where a mapping was parked
|
|
470
|
+
// and the resolution falls back to the legacy claimant (issue #2213).
|
|
471
|
+
const rawBody = `${[
|
|
459
472
|
"---",
|
|
460
473
|
`id: ${stmt.id}`,
|
|
461
474
|
`category: ${stmt.category}`,
|
|
@@ -471,14 +484,37 @@ function writeStatement(stmt: CuratedStatement, memoryDir: string): string {
|
|
|
471
484
|
"---",
|
|
472
485
|
]
|
|
473
486
|
.filter(Boolean)
|
|
474
|
-
.join("\n")
|
|
475
|
-
|
|
476
|
-
const body = `${frontmatter}\n\n${stmt.content}\n`;
|
|
487
|
+
.join("\n")}\n\n${stmt.content}\n`;
|
|
488
|
+
const body = canonicalizeEntityRefFrontmatter(rawBody, historicalIds);
|
|
477
489
|
|
|
478
490
|
fs.writeFileSync(filePath, body);
|
|
491
|
+
// Post-write REPAIR (issue #2213): a peer process publishing the journal
|
|
492
|
+
// across this write would otherwise strand the reference — the corpus bump
|
|
493
|
+
// below no longer re-triggers the migration, and a parked mapping cannot be
|
|
494
|
+
// fixed after the fact by the reconcile pass. On repair exhaustion, remove
|
|
495
|
+
// the just-created file so the retryable error leaves no untracked partial
|
|
496
|
+
// statement (a retry would otherwise duplicate it).
|
|
497
|
+
try {
|
|
498
|
+
repairContentAfterJournalMoveSync({
|
|
499
|
+
stateDir: path.join(memoryDir, "state"),
|
|
500
|
+
cache: historicalIdCache,
|
|
501
|
+
idsAtWrite: historicalIds,
|
|
502
|
+
rawContent: rawBody,
|
|
503
|
+
lastWritten: body,
|
|
504
|
+
rewrite: (next) => fs.writeFileSync(filePath, next),
|
|
505
|
+
});
|
|
506
|
+
} catch (err) {
|
|
507
|
+
try {
|
|
508
|
+
fs.unlinkSync(filePath);
|
|
509
|
+
} catch {
|
|
510
|
+
// Best effort — the retryable repair error is the primary signal.
|
|
511
|
+
}
|
|
512
|
+
throw err;
|
|
513
|
+
}
|
|
479
514
|
// Bump the corpus sentinel per write (out-of-band create) so a concurrent
|
|
480
515
|
// same-process readAllMemories rescans and sees this statement immediately,
|
|
481
|
-
// never a stale/partial corpus mid-batch (Cursor Medium, #1902).
|
|
516
|
+
// never a stale/partial corpus mid-batch (Cursor Medium, #1902). AFTER the
|
|
517
|
+
// repair, so a rescan never captures pre-repair bytes.
|
|
482
518
|
bumpMemoryCorpusVersionForDir(memoryDir);
|
|
483
519
|
return filePath;
|
|
484
520
|
}
|