@remnic/core 9.3.761 → 9.3.763
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 +10 -9
- package/dist/access-boundary.js +11 -10
- package/dist/access-cli.js +45 -44
- package/dist/access-cli.js.map +1 -1
- package/dist/access-http.js +17 -16
- package/dist/access-identity-continuity-surface.js +10 -9
- package/dist/access-lcm-surface.js +10 -9
- package/dist/access-mcp.js +14 -13
- package/dist/access-observe-write-surface.js +10 -9
- package/dist/access-operations-batch.js +12 -11
- package/dist/access-operations.js +13 -12
- package/dist/access-recall-surface.js +10 -9
- package/dist/access-service.js +10 -9
- package/dist/adapters/index.js +4 -4
- package/dist/adapters/registry.js +2 -2
- package/dist/briefing.js +5 -4
- package/dist/causal-consolidation.js +6 -5
- package/dist/causal-consolidation.js.map +1 -1
- package/dist/{chunk-742MWWVL.js → chunk-2RLECZ6J.js} +2 -2
- package/dist/{chunk-CFHDI5CV.js → chunk-6YEENRE3.js} +4 -4
- package/dist/{chunk-JYH3XYWM.js → chunk-6ZFE2TPO.js} +3 -3
- package/dist/{chunk-LG2MCUBC.js → chunk-A4FMQIST.js} +2 -2
- package/dist/{chunk-APJQ6UEA.js → chunk-AGNBY3VG.js} +4 -4
- package/dist/{chunk-OCPVA4TH.js → chunk-AS2NRB45.js} +2 -2
- package/dist/{chunk-W4ADKEIY.js → chunk-BAF7MBEH.js} +22 -22
- package/dist/{chunk-ICVNVSKN.js → chunk-BRYPUVJU.js} +2 -2
- package/dist/{chunk-IV4INTAU.js → chunk-CVINPTKG.js} +2 -2
- package/dist/{chunk-IRFHFRHP.js → chunk-D6YTILJO.js} +25 -25
- package/dist/chunk-DQC3ZZYM.js +35 -0
- package/dist/chunk-DQC3ZZYM.js.map +1 -0
- package/dist/{chunk-3DAIQSVS.js → chunk-DTTVX6EO.js} +23 -8
- package/dist/chunk-DTTVX6EO.js.map +1 -0
- package/dist/{chunk-P7UA66OG.js → chunk-IVFIYAIP.js} +2 -2
- package/dist/{chunk-RKNJBZ55.js → chunk-JBPKEARU.js} +4 -4
- package/dist/{chunk-Y3XEN5TL.js → chunk-K4EDULCP.js} +3 -3
- package/dist/{chunk-P7N2DQLC.js → chunk-KXG7HHIQ.js} +3 -3
- package/dist/{chunk-4WOXD56B.js → chunk-LDCFFJ67.js} +5 -5
- package/dist/{chunk-5AZQZFJG.js → chunk-N3QDLE2N.js} +5 -5
- package/dist/{chunk-2B3BTQN4.js → chunk-N4ZA2I7M.js} +2 -2
- package/dist/chunk-NDXJJKT2.js +118 -0
- package/dist/chunk-NDXJJKT2.js.map +1 -0
- package/dist/{chunk-HP23UD6W.js → chunk-NFWTMM2M.js} +2 -2
- package/dist/{chunk-3QLPBCFG.js → chunk-NKP6II6G.js} +4 -4
- package/dist/{chunk-HHCMZEUC.js → chunk-OX272PBW.js} +2 -2
- package/dist/{chunk-YU4CLTZY.js → chunk-QPTP6SKC.js} +2 -2
- package/dist/{chunk-6S2C5FQ4.js → chunk-R3K4CXPR.js} +2 -2
- package/dist/{chunk-XDFWMY4X.js → chunk-SFNQDXXL.js} +108 -14
- package/dist/chunk-SFNQDXXL.js.map +1 -0
- package/dist/{chunk-MB5RSUW6.js → chunk-SXN3LCUT.js} +114 -28
- package/dist/chunk-SXN3LCUT.js.map +1 -0
- package/dist/{chunk-3CBSKDRL.js → chunk-TIOXQPD7.js} +9 -9
- package/dist/{chunk-CXW6Y7SI.js → chunk-V5RVMULT.js} +4 -4
- package/dist/{chunk-DUU4VLOW.js → chunk-VKHZFF5P.js} +2 -2
- package/dist/{chunk-NPZTEHR7.js → chunk-X7HTU4HO.js} +2 -2
- package/dist/{chunk-ZAIU7ZEA.js → chunk-YDYC6PIS.js} +2 -2
- package/dist/cli.js +34 -33
- package/dist/compounding/engine.js +5 -4
- package/dist/connectors/codex-materialize-runner.js +5 -4
- package/dist/connectors/index.js +5 -4
- package/dist/entity-retrieval.js +5 -4
- package/dist/{forget-OEE5OELK.js → forget-WYLR4ZFV.js} +2 -2
- package/dist/index.js +47 -46
- package/dist/lcm/engine.js +2 -2
- package/dist/lcm/index.js +4 -4
- package/dist/maintenance/memory-governance.js +5 -4
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +11 -1
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +5 -4
- package/dist/maintenance/rebuild-memory-projection.d.ts +22 -1
- package/dist/maintenance/rebuild-memory-projection.js +6 -5
- package/dist/memory-projection-store.d.ts +6 -2
- package/dist/memory-projection-store.js +9 -3
- package/dist/namespaces/migrate.js +9 -8
- package/dist/namespaces/search.js +3 -3
- package/dist/namespaces/storage.js +5 -4
- package/dist/operator-toolkit.js +12 -11
- package/dist/orchestration/maintenance.js +7 -6
- package/dist/orchestrator.js +45 -44
- package/dist/{purge-6ATBGT77.js → purge-IHRX4Z7X.js} +7 -1
- package/dist/purge-IHRX4Z7X.js.map +1 -0
- package/dist/schemas.d.ts +22 -22
- package/dist/search/factory.js +2 -2
- package/dist/search/index.js +4 -4
- package/dist/semantic-consolidation.js +6 -5
- package/dist/semantic-rule-promotion.js +5 -4
- package/dist/semantic-rule-verifier.js +5 -4
- package/dist/storage-guards.d.ts +9 -0
- package/dist/storage-guards.js +11 -0
- package/dist/storage-guards.js.map +1 -0
- package/dist/storage.js +4 -3
- package/dist/transfer/import-sqlite.js +2 -2
- package/dist/transfer/types.d.ts +12 -12
- package/dist/verified-recall.js +5 -4
- package/package.json +2 -2
- package/src/maintenance/purge.test.ts +76 -0
- package/src/maintenance/purge.ts +3 -0
- package/src/maintenance/rebuild-memory-lifecycle-ledger.ts +59 -8
- package/src/maintenance/rebuild-memory-projection.ts +154 -10
- package/src/memory-projection-store.ts +143 -35
- package/src/storage-guards.ts +30 -0
- package/src/storage.ts +16 -16
- package/dist/chunk-3DAIQSVS.js.map +0 -1
- package/dist/chunk-GYJESQS5.js +0 -77
- package/dist/chunk-GYJESQS5.js.map +0 -1
- package/dist/chunk-MB5RSUW6.js.map +0 -1
- package/dist/chunk-XDFWMY4X.js.map +0 -1
- package/dist/purge-6ATBGT77.js.map +0 -1
- /package/dist/{chunk-742MWWVL.js.map → chunk-2RLECZ6J.js.map} +0 -0
- /package/dist/{chunk-CFHDI5CV.js.map → chunk-6YEENRE3.js.map} +0 -0
- /package/dist/{chunk-JYH3XYWM.js.map → chunk-6ZFE2TPO.js.map} +0 -0
- /package/dist/{chunk-LG2MCUBC.js.map → chunk-A4FMQIST.js.map} +0 -0
- /package/dist/{chunk-APJQ6UEA.js.map → chunk-AGNBY3VG.js.map} +0 -0
- /package/dist/{chunk-OCPVA4TH.js.map → chunk-AS2NRB45.js.map} +0 -0
- /package/dist/{chunk-W4ADKEIY.js.map → chunk-BAF7MBEH.js.map} +0 -0
- /package/dist/{chunk-ICVNVSKN.js.map → chunk-BRYPUVJU.js.map} +0 -0
- /package/dist/{chunk-IV4INTAU.js.map → chunk-CVINPTKG.js.map} +0 -0
- /package/dist/{chunk-IRFHFRHP.js.map → chunk-D6YTILJO.js.map} +0 -0
- /package/dist/{chunk-P7UA66OG.js.map → chunk-IVFIYAIP.js.map} +0 -0
- /package/dist/{chunk-RKNJBZ55.js.map → chunk-JBPKEARU.js.map} +0 -0
- /package/dist/{chunk-Y3XEN5TL.js.map → chunk-K4EDULCP.js.map} +0 -0
- /package/dist/{chunk-P7N2DQLC.js.map → chunk-KXG7HHIQ.js.map} +0 -0
- /package/dist/{chunk-4WOXD56B.js.map → chunk-LDCFFJ67.js.map} +0 -0
- /package/dist/{chunk-5AZQZFJG.js.map → chunk-N3QDLE2N.js.map} +0 -0
- /package/dist/{chunk-2B3BTQN4.js.map → chunk-N4ZA2I7M.js.map} +0 -0
- /package/dist/{chunk-HP23UD6W.js.map → chunk-NFWTMM2M.js.map} +0 -0
- /package/dist/{chunk-3QLPBCFG.js.map → chunk-NKP6II6G.js.map} +0 -0
- /package/dist/{chunk-HHCMZEUC.js.map → chunk-OX272PBW.js.map} +0 -0
- /package/dist/{chunk-YU4CLTZY.js.map → chunk-QPTP6SKC.js.map} +0 -0
- /package/dist/{chunk-6S2C5FQ4.js.map → chunk-R3K4CXPR.js.map} +0 -0
- /package/dist/{chunk-3CBSKDRL.js.map → chunk-TIOXQPD7.js.map} +0 -0
- /package/dist/{chunk-CXW6Y7SI.js.map → chunk-V5RVMULT.js.map} +0 -0
- /package/dist/{chunk-DUU4VLOW.js.map → chunk-VKHZFF5P.js.map} +0 -0
- /package/dist/{chunk-NPZTEHR7.js.map → chunk-X7HTU4HO.js.map} +0 -0
- /package/dist/{chunk-ZAIU7ZEA.js.map → chunk-YDYC6PIS.js.map} +0 -0
- /package/dist/{forget-OEE5OELK.js.map → forget-WYLR4ZFV.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
StorageManager
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DTTVX6EO.js";
|
|
4
4
|
import {
|
|
5
5
|
assertPathInsideRoot
|
|
6
6
|
} from "./chunk-5GPPACXK.js";
|
|
@@ -751,4 +751,4 @@ export {
|
|
|
751
751
|
listMemoryGovernanceRuns,
|
|
752
752
|
readMemoryGovernanceRunArtifact
|
|
753
753
|
};
|
|
754
|
-
//# sourceMappingURL=chunk-
|
|
754
|
+
//# sourceMappingURL=chunk-IVFIYAIP.js.map
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ReplitAdapter
|
|
3
|
+
} from "./chunk-TMSXWOBZ.js";
|
|
1
4
|
import {
|
|
2
5
|
ClaudeCodeAdapter
|
|
3
6
|
} from "./chunk-J64TK33U.js";
|
|
@@ -7,9 +10,6 @@ import {
|
|
|
7
10
|
import {
|
|
8
11
|
HermesAdapter
|
|
9
12
|
} from "./chunk-42NQ7AVG.js";
|
|
10
|
-
import {
|
|
11
|
-
ReplitAdapter
|
|
12
|
-
} from "./chunk-TMSXWOBZ.js";
|
|
13
13
|
|
|
14
14
|
// src/adapters/registry.ts
|
|
15
15
|
var AdapterRegistry = class {
|
|
@@ -53,4 +53,4 @@ var AdapterRegistry = class {
|
|
|
53
53
|
export {
|
|
54
54
|
AdapterRegistry
|
|
55
55
|
};
|
|
56
|
-
//# sourceMappingURL=chunk-
|
|
56
|
+
//# sourceMappingURL=chunk-JBPKEARU.js.map
|
|
@@ -3,14 +3,14 @@ import {
|
|
|
3
3
|
} from "./chunk-2MR3MFQB.js";
|
|
4
4
|
import {
|
|
5
5
|
defineOperation
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-A4FMQIST.js";
|
|
7
7
|
import {
|
|
8
8
|
CorrectionContractError,
|
|
9
9
|
DECISION_SUBCOMMANDS,
|
|
10
10
|
DELTA_SUBCOMMANDS,
|
|
11
11
|
EngramAccessInputError,
|
|
12
12
|
isCodegraphToolName
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-TIOXQPD7.js";
|
|
14
14
|
|
|
15
15
|
// src/access-operations.ts
|
|
16
16
|
import { z } from "zod";
|
|
@@ -463,4 +463,4 @@ export {
|
|
|
463
463
|
codegraphIngestTracesOperation,
|
|
464
464
|
REGISTERED_OPERATIONS
|
|
465
465
|
};
|
|
466
|
-
//# sourceMappingURL=chunk-
|
|
466
|
+
//# sourceMappingURL=chunk-K4EDULCP.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
NamespaceStorageRouter
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-OX272PBW.js";
|
|
4
4
|
import {
|
|
5
5
|
namespaceCollectionName
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-BRYPUVJU.js";
|
|
7
7
|
import {
|
|
8
8
|
namespaceIdentityFromToken,
|
|
9
9
|
namespaceIdentityToken
|
|
@@ -207,4 +207,4 @@ export {
|
|
|
207
207
|
verifyNamespaces,
|
|
208
208
|
runNamespaceMigration
|
|
209
209
|
};
|
|
210
|
-
//# sourceMappingURL=chunk-
|
|
210
|
+
//# sourceMappingURL=chunk-KXG7HHIQ.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-7WV3F5DQ.js";
|
|
4
4
|
import {
|
|
5
5
|
AdapterRegistry
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-JBPKEARU.js";
|
|
7
7
|
import {
|
|
8
8
|
EngramMcpServer,
|
|
9
9
|
cleanupExpiredChatSessions,
|
|
@@ -11,17 +11,17 @@ import {
|
|
|
11
11
|
processChatMessage,
|
|
12
12
|
sessionBelongsToPrincipal,
|
|
13
13
|
subscribeChatTranscript
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-6ZFE2TPO.js";
|
|
15
15
|
import {
|
|
16
16
|
validateRequest
|
|
17
17
|
} from "./chunk-2MR3MFQB.js";
|
|
18
18
|
import {
|
|
19
19
|
getOperation
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-A4FMQIST.js";
|
|
21
21
|
import {
|
|
22
22
|
CorrectionContractError,
|
|
23
23
|
EngramAccessInputError
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-TIOXQPD7.js";
|
|
25
25
|
import {
|
|
26
26
|
isTrustZoneName
|
|
27
27
|
} from "./chunk-JGSKJHF7.js";
|
|
@@ -2627,4 +2627,4 @@ function positiveIntQueryParam(value, label) {
|
|
|
2627
2627
|
export {
|
|
2628
2628
|
EngramAccessHttpServer
|
|
2629
2629
|
};
|
|
2630
|
-
//# sourceMappingURL=chunk-
|
|
2630
|
+
//# sourceMappingURL=chunk-LDCFFJ67.js.map
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
readNamespaceMaintenanceLastRanStatuses,
|
|
4
4
|
readNamespaceMaintenanceStatuses,
|
|
5
5
|
runNamespaceMaintenancePlan
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-NFWTMM2M.js";
|
|
7
7
|
import {
|
|
8
8
|
listNamespaces
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-KXG7HHIQ.js";
|
|
10
10
|
import {
|
|
11
11
|
analyzeSessionIntegrity,
|
|
12
12
|
applySessionRepair,
|
|
@@ -42,13 +42,13 @@ import {
|
|
|
42
42
|
import {
|
|
43
43
|
listMemoryGovernanceRuns,
|
|
44
44
|
readMemoryGovernanceRunArtifact
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-IVFIYAIP.js";
|
|
46
46
|
import {
|
|
47
47
|
analyzeGraphHealth
|
|
48
48
|
} from "./chunk-EHQ5HO5T.js";
|
|
49
49
|
import {
|
|
50
50
|
StorageManager
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-DTTVX6EO.js";
|
|
52
52
|
import {
|
|
53
53
|
lintWorkspaceFiles
|
|
54
54
|
} from "./chunk-DM2T26WE.js";
|
|
@@ -1599,4 +1599,4 @@ export {
|
|
|
1599
1599
|
runBenchmarkRecall,
|
|
1600
1600
|
runOperatorRepair
|
|
1601
1601
|
};
|
|
1602
|
-
//# sourceMappingURL=chunk-
|
|
1602
|
+
//# sourceMappingURL=chunk-N3QDLE2N.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-7FL4CNPV.js";
|
|
4
4
|
import {
|
|
5
5
|
StorageManager
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-DTTVX6EO.js";
|
|
7
7
|
import {
|
|
8
8
|
getCachedEpisodeMap,
|
|
9
9
|
setCachedEpisodeMap
|
|
@@ -107,4 +107,4 @@ export {
|
|
|
107
107
|
compareVerifiedEpisodeResults,
|
|
108
108
|
searchVerifiedEpisodes
|
|
109
109
|
};
|
|
110
|
-
//# sourceMappingURL=chunk-
|
|
110
|
+
//# sourceMappingURL=chunk-N4ZA2I7M.js.map
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import {
|
|
2
|
+
toBackupStamp
|
|
3
|
+
} from "./chunk-KJTKLXTH.js";
|
|
4
|
+
import {
|
|
5
|
+
writeFileAtomically
|
|
6
|
+
} from "./chunk-SFQ6QNL7.js";
|
|
7
|
+
import {
|
|
8
|
+
StorageManager
|
|
9
|
+
} from "./chunk-DTTVX6EO.js";
|
|
10
|
+
import {
|
|
11
|
+
buildLifecycleEventsForMemory,
|
|
12
|
+
sortMemoryLifecycleEvents
|
|
13
|
+
} from "./chunk-RULE4VG5.js";
|
|
14
|
+
import {
|
|
15
|
+
log
|
|
16
|
+
} from "./chunk-NU3CSQ4H.js";
|
|
17
|
+
|
|
18
|
+
// src/maintenance/rebuild-memory-lifecycle-ledger.ts
|
|
19
|
+
import path from "path";
|
|
20
|
+
import { stat } from "fs/promises";
|
|
21
|
+
function isNodeError(err) {
|
|
22
|
+
return typeof err === "object" && err !== null && "code" in err;
|
|
23
|
+
}
|
|
24
|
+
async function backupExistingLedger(memoryDir, outputPath, now) {
|
|
25
|
+
try {
|
|
26
|
+
await stat(outputPath);
|
|
27
|
+
} catch (err) {
|
|
28
|
+
if (isNodeError(err) && err.code === "ENOENT") {
|
|
29
|
+
return void 0;
|
|
30
|
+
}
|
|
31
|
+
throw err;
|
|
32
|
+
}
|
|
33
|
+
const backupPath = path.join(
|
|
34
|
+
memoryDir,
|
|
35
|
+
"archive",
|
|
36
|
+
"memory-lifecycle-ledger",
|
|
37
|
+
toBackupStamp(now),
|
|
38
|
+
"state",
|
|
39
|
+
"memory-lifecycle-ledger.jsonl"
|
|
40
|
+
);
|
|
41
|
+
return backupPath;
|
|
42
|
+
}
|
|
43
|
+
async function rebuildMemoryLifecycleLedger(options) {
|
|
44
|
+
const dryRun = options.dryRun !== false;
|
|
45
|
+
const now = options.now ?? /* @__PURE__ */ new Date();
|
|
46
|
+
const outputPath = path.join(options.memoryDir, "state", "memory-lifecycle-ledger.jsonl");
|
|
47
|
+
const storage = new StorageManager(options.memoryDir);
|
|
48
|
+
const tiers = [
|
|
49
|
+
await storage.readAllMemories(),
|
|
50
|
+
await storage.readAllColdMemories(),
|
|
51
|
+
await storage.readArchivedMemories()
|
|
52
|
+
];
|
|
53
|
+
const allMemories = tiers.flat();
|
|
54
|
+
const skippedBlankIdMemories = [];
|
|
55
|
+
const eventCandidates = [];
|
|
56
|
+
for (const tier of tiers) {
|
|
57
|
+
for (const memory of [...tier].sort((left, right) => left.path.localeCompare(right.path))) {
|
|
58
|
+
if (!memory.frontmatter.id.trim()) {
|
|
59
|
+
skippedBlankIdMemories.push({ path: memory.path });
|
|
60
|
+
log.warn(`lifecycle ledger rebuild skipped blank memory id: path=${memory.path}`);
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
for (const event of buildLifecycleEventsForMemory(memory)) {
|
|
64
|
+
eventCandidates.push({ event, path: memory.path });
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const orderedEvents = sortMemoryLifecycleEvents(eventCandidates.map((candidate) => candidate.event));
|
|
69
|
+
const candidateByEvent = new Map(
|
|
70
|
+
eventCandidates.map((candidate) => [candidate.event, candidate])
|
|
71
|
+
);
|
|
72
|
+
const keptByEventId = /* @__PURE__ */ new Map();
|
|
73
|
+
const events = [];
|
|
74
|
+
const skippedDuplicateEvents = [];
|
|
75
|
+
for (const event of orderedEvents) {
|
|
76
|
+
const candidate = candidateByEvent.get(event);
|
|
77
|
+
const kept = keptByEventId.get(event.eventId);
|
|
78
|
+
if (kept) {
|
|
79
|
+
skippedDuplicateEvents.push({
|
|
80
|
+
eventId: event.eventId,
|
|
81
|
+
keptPath: kept.path,
|
|
82
|
+
skippedPath: candidate.path
|
|
83
|
+
});
|
|
84
|
+
log.warn(
|
|
85
|
+
`lifecycle ledger rebuild skipped duplicate event_id=${event.eventId}: kept=${kept.path} skipped=${candidate.path}`
|
|
86
|
+
);
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
keptByEventId.set(event.eventId, candidate);
|
|
90
|
+
events.push(event);
|
|
91
|
+
}
|
|
92
|
+
let backupPath;
|
|
93
|
+
if (!dryRun) {
|
|
94
|
+
backupPath = await backupExistingLedger(options.memoryDir, outputPath, now);
|
|
95
|
+
const payload = events.map((event) => JSON.stringify(event)).join("\n");
|
|
96
|
+
backupPath = await writeFileAtomically(
|
|
97
|
+
outputPath,
|
|
98
|
+
payload.length > 0 ? `${payload}
|
|
99
|
+
` : "",
|
|
100
|
+
backupPath
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
dryRun,
|
|
105
|
+
scannedMemories: allMemories.length,
|
|
106
|
+
rebuiltRows: events.length,
|
|
107
|
+
outputPath,
|
|
108
|
+
backupPath,
|
|
109
|
+
skippedBlankIdMemories,
|
|
110
|
+
skippedDuplicateEvents
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export {
|
|
115
|
+
backupExistingLedger,
|
|
116
|
+
rebuildMemoryLifecycleLedger
|
|
117
|
+
};
|
|
118
|
+
//# sourceMappingURL=chunk-NDXJJKT2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/maintenance/rebuild-memory-lifecycle-ledger.ts"],"sourcesContent":["import path from \"node:path\";\nimport { stat } from \"node:fs/promises\";\nimport { StorageManager } from \"../storage.js\";\nimport { log } from \"../logger.js\";\nimport type { MemoryLifecycleEvent } from \"../types.js\";\nimport { toBackupStamp } from \"./backup-stamp.js\";\nimport { writeFileAtomically } from \"./atomic-file.js\";\nimport {\n buildLifecycleEventsForMemory,\n sortMemoryLifecycleEvents,\n} from \"../memory-lifecycle-ledger-utils.js\";\n\nexport interface RebuildMemoryLifecycleLedgerOptions {\n memoryDir: string;\n dryRun?: boolean;\n now?: Date;\n}\n\nexport interface SkippedLifecycleBlankIdMemory {\n path: string;\n}\n\nexport interface SkippedDuplicateLifecycleEvent {\n eventId: string;\n keptPath: string;\n skippedPath: string;\n}\n\nexport interface RebuildMemoryLifecycleLedgerResult {\n dryRun: boolean;\n scannedMemories: number;\n rebuiltRows: number;\n outputPath: string;\n backupPath?: string;\n skippedBlankIdMemories: SkippedLifecycleBlankIdMemory[];\n skippedDuplicateEvents: SkippedDuplicateLifecycleEvent[];\n}\n\nfunction isNodeError(err: unknown): err is NodeJS.ErrnoException {\n return typeof err === \"object\" && err !== null && \"code\" in err;\n}\n\nexport async function backupExistingLedger(\n memoryDir: string,\n outputPath: string,\n now: Date,\n): Promise<string | undefined> {\n try {\n await stat(outputPath);\n } catch (err) {\n if (isNodeError(err) && err.code === \"ENOENT\") {\n return undefined;\n }\n throw err;\n }\n\n const backupPath = path.join(\n memoryDir,\n \"archive\",\n \"memory-lifecycle-ledger\",\n toBackupStamp(now),\n \"state\",\n \"memory-lifecycle-ledger.jsonl\",\n );\n return backupPath;\n}\n\nexport async function rebuildMemoryLifecycleLedger(\n options: RebuildMemoryLifecycleLedgerOptions,\n): Promise<RebuildMemoryLifecycleLedgerResult> {\n const dryRun = options.dryRun !== false;\n const now = options.now ?? new Date();\n const outputPath = path.join(options.memoryDir, \"state\", \"memory-lifecycle-ledger.jsonl\");\n const storage = new StorageManager(options.memoryDir);\n const tiers = [\n await storage.readAllMemories(),\n await storage.readAllColdMemories(),\n await storage.readArchivedMemories(),\n ];\n const allMemories = tiers.flat();\n const skippedBlankIdMemories: SkippedLifecycleBlankIdMemory[] = [];\n const eventCandidates: Array<{ event: MemoryLifecycleEvent; path: string }> = [];\n for (const tier of tiers) {\n for (const memory of [...tier].sort((left, right) => left.path.localeCompare(right.path))) {\n if (!memory.frontmatter.id.trim()) {\n skippedBlankIdMemories.push({ path: memory.path });\n log.warn(`lifecycle ledger rebuild skipped blank memory id: path=${memory.path}`);\n continue;\n }\n for (const event of buildLifecycleEventsForMemory(memory)) {\n eventCandidates.push({ event, path: memory.path });\n }\n }\n }\n\n const orderedEvents = sortMemoryLifecycleEvents(eventCandidates.map((candidate) => candidate.event));\n const candidateByEvent = new Map(\n eventCandidates.map((candidate) => [candidate.event, candidate]),\n );\n const keptByEventId = new Map<string, { event: MemoryLifecycleEvent; path: string }>();\n const events: MemoryLifecycleEvent[] = [];\n const skippedDuplicateEvents: SkippedDuplicateLifecycleEvent[] = [];\n for (const event of orderedEvents) {\n const candidate = candidateByEvent.get(event)!;\n const kept = keptByEventId.get(event.eventId);\n if (kept) {\n skippedDuplicateEvents.push({\n eventId: event.eventId,\n keptPath: kept.path,\n skippedPath: candidate.path,\n });\n log.warn(\n `lifecycle ledger rebuild skipped duplicate event_id=${event.eventId}: `\n + `kept=${kept.path} skipped=${candidate.path}`,\n );\n continue;\n }\n keptByEventId.set(event.eventId, candidate);\n events.push(event);\n }\n\n let backupPath: string | undefined;\n if (!dryRun) {\n backupPath = await backupExistingLedger(options.memoryDir, outputPath, now);\n const payload = events.map((event) => JSON.stringify(event)).join(\"\\n\");\n backupPath = await writeFileAtomically(\n outputPath,\n payload.length > 0 ? `${payload}\\n` : \"\",\n backupPath,\n );\n }\n\n return {\n dryRun,\n scannedMemories: allMemories.length,\n rebuiltRows: events.length,\n outputPath,\n backupPath,\n skippedBlankIdMemories,\n skippedDuplicateEvents,\n };\n}\n"],"mappings":"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","names":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveDefaultNamespaceRoot,
|
|
3
3
|
resolveNamespaceStorageRoot
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-OX272PBW.js";
|
|
5
5
|
import {
|
|
6
6
|
getConfiguredNamespaces
|
|
7
7
|
} from "./chunk-BAVVI5GP.js";
|
|
@@ -2042,4 +2042,4 @@ export {
|
|
|
2042
2042
|
runNamespaceMaintenancePlan,
|
|
2043
2043
|
runNamespaceMaintenanceBatchPlan
|
|
2044
2044
|
};
|
|
2045
|
-
//# sourceMappingURL=chunk-
|
|
2045
|
+
//# sourceMappingURL=chunk-NFWTMM2M.js.map
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MeilisearchBackend
|
|
3
|
+
} from "./chunk-WRFKZEO6.js";
|
|
1
4
|
import {
|
|
2
5
|
NoopSearchBackend
|
|
3
6
|
} from "./chunk-CYEPCZN5.js";
|
|
@@ -13,9 +16,6 @@ import {
|
|
|
13
16
|
import {
|
|
14
17
|
LanceDbBackend
|
|
15
18
|
} from "./chunk-5CEJH5ZN.js";
|
|
16
|
-
import {
|
|
17
|
-
MeilisearchBackend
|
|
18
|
-
} from "./chunk-WRFKZEO6.js";
|
|
19
19
|
import {
|
|
20
20
|
createConversationIndexBackend
|
|
21
21
|
} from "./chunk-DCWIQFNA.js";
|
|
@@ -175,4 +175,4 @@ export {
|
|
|
175
175
|
createConversationSearchBackend,
|
|
176
176
|
createConversationIndexRuntime
|
|
177
177
|
};
|
|
178
|
-
//# sourceMappingURL=chunk-
|
|
178
|
+
//# sourceMappingURL=chunk-NKP6II6G.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-EGGE52UU.js";
|
|
5
5
|
import {
|
|
6
6
|
StorageManager
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-DTTVX6EO.js";
|
|
8
8
|
import {
|
|
9
9
|
MutationSerializer
|
|
10
10
|
} from "./chunk-LTJAMRGI.js";
|
|
@@ -339,4 +339,4 @@ export {
|
|
|
339
339
|
resolveNamespaceStorageRoot,
|
|
340
340
|
NamespaceStorageRouter
|
|
341
341
|
};
|
|
342
|
-
//# sourceMappingURL=chunk-
|
|
342
|
+
//# sourceMappingURL=chunk-OX272PBW.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-JRZV3767.js";
|
|
5
5
|
import {
|
|
6
6
|
StorageManager
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-DTTVX6EO.js";
|
|
8
8
|
import {
|
|
9
9
|
parseContinuityImprovementLoops
|
|
10
10
|
} from "./chunk-LDXUBPMO.js";
|
|
@@ -1276,4 +1276,4 @@ export {
|
|
|
1276
1276
|
defaultTierMigrationCycleBudget,
|
|
1277
1277
|
CompoundingEngine
|
|
1278
1278
|
};
|
|
1279
|
-
//# sourceMappingURL=chunk-
|
|
1279
|
+
//# sourceMappingURL=chunk-QPTP6SKC.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
StorageManager,
|
|
3
3
|
normalizeEntityName
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-DTTVX6EO.js";
|
|
5
5
|
import {
|
|
6
6
|
serializeMutations
|
|
7
7
|
} from "./chunk-LTJAMRGI.js";
|
|
@@ -956,4 +956,4 @@ export {
|
|
|
956
956
|
resolveBriefingSaveDir,
|
|
957
957
|
briefingFilename
|
|
958
958
|
};
|
|
959
|
-
//# sourceMappingURL=chunk-
|
|
959
|
+
//# sourceMappingURL=chunk-R3K4CXPR.js.map
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
listMemoryGovernanceRuns,
|
|
12
12
|
readMemoryGovernanceRunArtifact
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-IVFIYAIP.js";
|
|
14
14
|
import {
|
|
15
15
|
StorageManager
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-DTTVX6EO.js";
|
|
17
17
|
import {
|
|
18
18
|
MEMORY_LIFECYCLE_EVENT_SORT_ORDER,
|
|
19
19
|
buildLifecycleEventsForMemory,
|
|
@@ -29,16 +29,20 @@ import {
|
|
|
29
29
|
MEMORY_PROJECTION_SCHEMA_VERSION,
|
|
30
30
|
getMemoryProjectionPath,
|
|
31
31
|
initializeMemoryProjectionDb,
|
|
32
|
+
isProjectedMemoryPathValid,
|
|
32
33
|
memoryCurrentSelectExpressions,
|
|
33
34
|
parseCurrentRow,
|
|
34
35
|
parseTimelineRows,
|
|
35
36
|
readProjectedEntityMentions,
|
|
36
37
|
readProjectedGovernanceRecord,
|
|
37
38
|
readProjectedNativeKnowledgeChunks
|
|
38
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-SXN3LCUT.js";
|
|
39
40
|
import {
|
|
40
41
|
openBetterSqlite3
|
|
41
42
|
} from "./chunk-6KYMPV2O.js";
|
|
43
|
+
import {
|
|
44
|
+
log
|
|
45
|
+
} from "./chunk-NU3CSQ4H.js";
|
|
42
46
|
|
|
43
47
|
// src/maintenance/rebuild-memory-projection.ts
|
|
44
48
|
import path from "path";
|
|
@@ -291,19 +295,98 @@ function serializeGovernanceReviewQueueRow(row) {
|
|
|
291
295
|
relatedMemoryIds: row.relatedMemoryIds
|
|
292
296
|
});
|
|
293
297
|
}
|
|
298
|
+
function selectProjectionMemories(tiers) {
|
|
299
|
+
const allMemories = tiers.flat();
|
|
300
|
+
const memories = [];
|
|
301
|
+
const keptById = /* @__PURE__ */ new Map();
|
|
302
|
+
const skippedDuplicateMemories = [];
|
|
303
|
+
const skippedBlankIdMemories = [];
|
|
304
|
+
for (const tier of tiers) {
|
|
305
|
+
for (const memory of [...tier].sort((left, right) => left.path.localeCompare(right.path))) {
|
|
306
|
+
const memoryId = memory.frontmatter.id.trim();
|
|
307
|
+
if (!memoryId) {
|
|
308
|
+
skippedBlankIdMemories.push({ path: memory.path });
|
|
309
|
+
log.warn(`projection rebuild skipped blank memory id: path=${memory.path}`);
|
|
310
|
+
continue;
|
|
311
|
+
}
|
|
312
|
+
const kept = keptById.get(memoryId);
|
|
313
|
+
if (kept) {
|
|
314
|
+
skippedDuplicateMemories.push({
|
|
315
|
+
memoryId,
|
|
316
|
+
keptPath: kept.path,
|
|
317
|
+
skippedPath: memory.path
|
|
318
|
+
});
|
|
319
|
+
log.warn(
|
|
320
|
+
`projection rebuild skipped duplicate memory id=${memoryId}: kept=${kept.path} skipped=${memory.path}`
|
|
321
|
+
);
|
|
322
|
+
continue;
|
|
323
|
+
}
|
|
324
|
+
keptById.set(memoryId, memory);
|
|
325
|
+
memories.push(memory);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
return { allMemories, memories, skippedDuplicateMemories, skippedBlankIdMemories };
|
|
329
|
+
}
|
|
330
|
+
function deduplicateTimelineEvents(events, sourcePathFor) {
|
|
331
|
+
const keptById = /* @__PURE__ */ new Map();
|
|
332
|
+
const unique = [];
|
|
333
|
+
const skipped = [];
|
|
334
|
+
const skippedBlankIds = [];
|
|
335
|
+
for (const event of sortMemoryLifecycleEvents(events)) {
|
|
336
|
+
const sourcePath = sourcePathFor(event);
|
|
337
|
+
if (!event.memoryId.trim()) {
|
|
338
|
+
skippedBlankIds.push({ eventId: event.eventId, path: sourcePath });
|
|
339
|
+
log.warn(
|
|
340
|
+
`projection rebuild skipped timeline event with blank memory id: event_id=${event.eventId} path=${sourcePath}`
|
|
341
|
+
);
|
|
342
|
+
continue;
|
|
343
|
+
}
|
|
344
|
+
const kept = keptById.get(event.eventId);
|
|
345
|
+
if (kept) {
|
|
346
|
+
skipped.push({
|
|
347
|
+
eventId: event.eventId,
|
|
348
|
+
keptPath: kept.path,
|
|
349
|
+
skippedPath: sourcePath
|
|
350
|
+
});
|
|
351
|
+
log.warn(
|
|
352
|
+
`projection rebuild skipped duplicate timeline event_id=${event.eventId}: kept=${kept.path} skipped=${sourcePath}`
|
|
353
|
+
);
|
|
354
|
+
continue;
|
|
355
|
+
}
|
|
356
|
+
keptById.set(event.eventId, { event, path: sourcePath });
|
|
357
|
+
unique.push(event);
|
|
358
|
+
}
|
|
359
|
+
return { events: unique, skipped, skippedBlankIds };
|
|
360
|
+
}
|
|
294
361
|
async function loadAuthoritativeProjectionSnapshot(options) {
|
|
295
362
|
const storage = new StorageManager(options.memoryDir);
|
|
296
363
|
storage.invalidateAllMemoriesCacheForDir();
|
|
297
|
-
const
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
]
|
|
364
|
+
const selected = selectProjectionMemories([
|
|
365
|
+
await storage.readAllMemories(),
|
|
366
|
+
await storage.readAllColdMemories(),
|
|
367
|
+
await storage.readArchivedMemories()
|
|
368
|
+
]);
|
|
369
|
+
const allMemories = selected.allMemories;
|
|
370
|
+
const projectionMemories = selected.memories;
|
|
302
371
|
const lifecycleEvents = await storage.readAllMemoryLifecycleEvents();
|
|
303
|
-
const
|
|
304
|
-
const
|
|
372
|
+
const timeline = loadTimelineEvents(projectionMemories, lifecycleEvents);
|
|
373
|
+
const lifecycleLedgerPath = path.join(
|
|
374
|
+
options.memoryDir,
|
|
375
|
+
"state",
|
|
376
|
+
"memory-lifecycle-ledger.jsonl"
|
|
377
|
+
);
|
|
378
|
+
const memoryPathById = new Map(
|
|
379
|
+
projectionMemories.map((memory) => [memory.frontmatter.id, memory.path])
|
|
380
|
+
);
|
|
381
|
+
const deduplicatedTimeline = deduplicateTimelineEvents(
|
|
382
|
+
timeline.events,
|
|
383
|
+
(event) => timeline.usedLifecycleLedger ? lifecycleLedgerPath : memoryPathById.get(event.memoryId) ?? lifecycleLedgerPath
|
|
384
|
+
);
|
|
385
|
+
const events = deduplicatedTimeline.events;
|
|
386
|
+
const usedLifecycleLedger = timeline.usedLifecycleLedger;
|
|
387
|
+
const currentRows = projectionMemories.map((memory) => toCurrentStateRow(options.memoryDir, memory));
|
|
305
388
|
const scope = normalizeProjectionScope(options);
|
|
306
|
-
const scopedMemories = filterMemoriesForProjectionScope(
|
|
389
|
+
const scopedMemories = filterMemoriesForProjectionScope(projectionMemories, scope);
|
|
307
390
|
const scopedMemoryIds = new Set(scopedMemories.map((memory) => memory.frontmatter.id));
|
|
308
391
|
const nativeKnowledgeRows = await loadPersistedNativeKnowledgeChunks({
|
|
309
392
|
memoryDir: options.memoryDir,
|
|
@@ -338,7 +421,11 @@ async function loadAuthoritativeProjectionSnapshot(options) {
|
|
|
338
421
|
nativeKnowledgeRows,
|
|
339
422
|
governance,
|
|
340
423
|
usedLifecycleLedger,
|
|
341
|
-
scope
|
|
424
|
+
scope,
|
|
425
|
+
skippedDuplicateMemories: selected.skippedDuplicateMemories,
|
|
426
|
+
skippedBlankIdMemories: selected.skippedBlankIdMemories,
|
|
427
|
+
skippedDuplicateTimelineEvents: deduplicatedTimeline.skipped,
|
|
428
|
+
skippedBlankIdTimelineEvents: deduplicatedTimeline.skippedBlankIds
|
|
342
429
|
};
|
|
343
430
|
}
|
|
344
431
|
function readProjectedCurrentRows(memoryDir) {
|
|
@@ -446,6 +533,7 @@ function readProjectedGovernanceRows(memoryDir) {
|
|
|
446
533
|
}
|
|
447
534
|
function writeProjectionDb(dbPath, nowIso, currentRows, timelineRows, entityMentionRows, nativeKnowledgeRows, governance, usedLifecycleLedger) {
|
|
448
535
|
const db = openBetterSqlite3(dbPath);
|
|
536
|
+
const memoryDir = path.dirname(path.dirname(dbPath));
|
|
449
537
|
try {
|
|
450
538
|
initializeMemoryProjectionDb(db);
|
|
451
539
|
const insertMeta = db.prepare("INSERT OR REPLACE INTO meta(key, value) VALUES (?, ?)");
|
|
@@ -460,6 +548,7 @@ function writeProjectionDb(dbPath, nowIso, currentRows, timelineRows, entityMent
|
|
|
460
548
|
status,
|
|
461
549
|
lifecycle_state,
|
|
462
550
|
path_rel,
|
|
551
|
+
path_valid,
|
|
463
552
|
created_at,
|
|
464
553
|
updated_at,
|
|
465
554
|
archived_at,
|
|
@@ -473,7 +562,7 @@ function writeProjectionDb(dbPath, nowIso, currentRows, timelineRows, entityMent
|
|
|
473
562
|
last_accessed,
|
|
474
563
|
tags_json,
|
|
475
564
|
preview_text
|
|
476
|
-
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
565
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
477
566
|
`);
|
|
478
567
|
const insertTimeline = db.prepare(`
|
|
479
568
|
INSERT INTO memory_timeline (
|
|
@@ -564,6 +653,7 @@ function writeProjectionDb(dbPath, nowIso, currentRows, timelineRows, entityMent
|
|
|
564
653
|
row.status,
|
|
565
654
|
row.lifecycleState ?? null,
|
|
566
655
|
row.pathRel,
|
|
656
|
+
isProjectedMemoryPathValid(memoryDir, row.pathRel) ? 1 : 0,
|
|
567
657
|
row.created,
|
|
568
658
|
row.updated,
|
|
569
659
|
row.archivedAt ?? null,
|
|
@@ -778,6 +868,10 @@ async function rebuildMemoryProjection(options) {
|
|
|
778
868
|
outputPath,
|
|
779
869
|
backupPath,
|
|
780
870
|
usedLifecycleLedger: snapshot.usedLifecycleLedger,
|
|
871
|
+
skippedDuplicateMemories: snapshot.skippedDuplicateMemories,
|
|
872
|
+
skippedBlankIdMemories: snapshot.skippedBlankIdMemories,
|
|
873
|
+
skippedDuplicateTimelineEvents: snapshot.skippedDuplicateTimelineEvents,
|
|
874
|
+
skippedBlankIdTimelineEvents: snapshot.skippedBlankIdTimelineEvents,
|
|
781
875
|
scope: snapshot.scope
|
|
782
876
|
};
|
|
783
877
|
}
|
|
@@ -929,4 +1023,4 @@ export {
|
|
|
929
1023
|
verifyMemoryProjection,
|
|
930
1024
|
repairMemoryProjection
|
|
931
1025
|
};
|
|
932
|
-
//# sourceMappingURL=chunk-
|
|
1026
|
+
//# sourceMappingURL=chunk-SFNQDXXL.js.map
|