@remnic/core 9.29.0 → 9.29.1
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 +7 -7
- package/dist/access-authorization-probe.js +8 -8
- package/dist/access-boundary.js +7 -7
- package/dist/access-cli.js +27 -27
- package/dist/access-http.js +12 -12
- package/dist/access-identity-continuity-surface.js +7 -7
- package/dist/access-lcm-surface.js +7 -7
- package/dist/access-mcp.js +10 -10
- package/dist/access-namespace-preflight.js +7 -7
- package/dist/access-observe-write-surface.js +7 -7
- package/dist/access-operations-batch.js +8 -8
- package/dist/access-operations.js +9 -9
- package/dist/access-recall-concurrency.js +7 -7
- package/dist/access-recall-response.js +7 -7
- package/dist/access-recall-surface.js +7 -7
- package/dist/access-schema.d.ts +7 -7
- package/dist/access-service.js +7 -7
- package/dist/briefing.js +2 -2
- package/dist/causal-consolidation.js +3 -3
- package/dist/{chunk-2HNUMF5V.js → chunk-2AXMQWCN.js} +2 -2
- package/dist/{chunk-NBDCZWP4.js → chunk-2D7FEUCK.js} +2 -2
- package/dist/{chunk-Q6VFVAKZ.js → chunk-2GXM5N5A.js} +2 -2
- package/dist/{chunk-SG265CVF.js → chunk-35DL7IOI.js} +5 -5
- package/dist/{chunk-EVX44I7C.js → chunk-3JNDOAQ2.js} +2 -2
- package/dist/{chunk-QAOGGNE3.js → chunk-5QDRGWT2.js} +2 -2
- package/dist/{chunk-P3MH72CI.js → chunk-5ZCUDWD4.js} +2 -2
- package/dist/{chunk-VVIW3PTA.js → chunk-7L45JFPW.js} +3 -3
- package/dist/{chunk-ESBQWC3U.js → chunk-CW4AGY3G.js} +2 -2
- package/dist/{chunk-ZXAGJFHJ.js → chunk-E5OBR6CJ.js} +2 -2
- package/dist/{chunk-QMBNMPQM.js → chunk-FUYEVEX7.js} +15 -15
- package/dist/{chunk-KUJQHXPH.js → chunk-FZRQZW4H.js} +2 -2
- package/dist/{chunk-IMA2EWLV.js → chunk-GAWOEQEQ.js} +2 -2
- package/dist/{chunk-4PBVXX7L.js → chunk-HKJCMOT6.js} +2 -2
- package/dist/{chunk-CMRQ34J5.js → chunk-IAEAFLF2.js} +2 -2
- package/dist/{chunk-YGHMSDLK.js → chunk-IGPEJVBY.js} +2 -2
- package/dist/{chunk-FCDWWCLX.js → chunk-JMQUBRV6.js} +88 -25
- package/dist/chunk-JMQUBRV6.js.map +1 -0
- package/dist/{chunk-WZ7UB7XQ.js → chunk-JP3YPDAW.js} +13 -13
- package/dist/{chunk-GGUBDXRR.js → chunk-OP6F6L3S.js} +2 -2
- package/dist/{chunk-JDZRYH2N.js → chunk-OYJKSZIQ.js} +2 -2
- package/dist/{chunk-2XC73SHY.js → chunk-PBUZNGMX.js} +5 -5
- package/dist/{chunk-WONS4RZ2.js → chunk-PTSNLEXK.js} +2 -2
- package/dist/{chunk-XEQ7OT7U.js → chunk-QDKK63Y7.js} +2 -2
- package/dist/{chunk-ZGOQTOYA.js → chunk-UBKEQOTD.js} +2 -2
- package/dist/{chunk-T3GCXULH.js → chunk-VSURVXKY.js} +6 -6
- package/dist/{chunk-CSMCNOPH.js → chunk-WRFBW2TT.js} +3 -3
- package/dist/{chunk-G6LBWZRF.js → chunk-WU7TTVOD.js} +5 -5
- package/dist/cli.js +21 -21
- package/dist/compounding/engine.js +2 -2
- package/dist/connectors/codex-materialize-runner.js +2 -2
- package/dist/connectors/index.js +2 -2
- package/dist/corpus-watermark.js +4 -4
- package/dist/entity-retrieval.js +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +27 -27
- package/dist/maintenance/memory-governance.js +2 -2
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +2 -2
- package/dist/maintenance/rebuild-memory-projection.js +3 -3
- package/dist/namespaces/migrate.js +3 -3
- package/dist/namespaces/storage.js +2 -2
- package/dist/operator-doctor-corpus.js +5 -5
- package/dist/operator-toolkit.js +8 -8
- package/dist/orchestration/maintenance.js +7 -7
- package/dist/orchestrator.js +27 -27
- package/dist/schemas.d.ts +22 -22
- package/dist/semantic-consolidation.js +3 -3
- package/dist/semantic-rule-promotion.js +2 -2
- package/dist/semantic-rule-verifier.js +2 -2
- package/dist/storage.js +1 -1
- package/dist/transfer/types.d.ts +12 -12
- package/dist/verified-recall.js +2 -2
- package/package.json +2 -2
- package/src/storage/entity-canonical-id-migration.ts +151 -23
- package/dist/chunk-FCDWWCLX.js.map +0 -1
- /package/dist/{chunk-2HNUMF5V.js.map → chunk-2AXMQWCN.js.map} +0 -0
- /package/dist/{chunk-NBDCZWP4.js.map → chunk-2D7FEUCK.js.map} +0 -0
- /package/dist/{chunk-Q6VFVAKZ.js.map → chunk-2GXM5N5A.js.map} +0 -0
- /package/dist/{chunk-SG265CVF.js.map → chunk-35DL7IOI.js.map} +0 -0
- /package/dist/{chunk-EVX44I7C.js.map → chunk-3JNDOAQ2.js.map} +0 -0
- /package/dist/{chunk-QAOGGNE3.js.map → chunk-5QDRGWT2.js.map} +0 -0
- /package/dist/{chunk-P3MH72CI.js.map → chunk-5ZCUDWD4.js.map} +0 -0
- /package/dist/{chunk-VVIW3PTA.js.map → chunk-7L45JFPW.js.map} +0 -0
- /package/dist/{chunk-ESBQWC3U.js.map → chunk-CW4AGY3G.js.map} +0 -0
- /package/dist/{chunk-ZXAGJFHJ.js.map → chunk-E5OBR6CJ.js.map} +0 -0
- /package/dist/{chunk-QMBNMPQM.js.map → chunk-FUYEVEX7.js.map} +0 -0
- /package/dist/{chunk-KUJQHXPH.js.map → chunk-FZRQZW4H.js.map} +0 -0
- /package/dist/{chunk-IMA2EWLV.js.map → chunk-GAWOEQEQ.js.map} +0 -0
- /package/dist/{chunk-4PBVXX7L.js.map → chunk-HKJCMOT6.js.map} +0 -0
- /package/dist/{chunk-CMRQ34J5.js.map → chunk-IAEAFLF2.js.map} +0 -0
- /package/dist/{chunk-YGHMSDLK.js.map → chunk-IGPEJVBY.js.map} +0 -0
- /package/dist/{chunk-WZ7UB7XQ.js.map → chunk-JP3YPDAW.js.map} +0 -0
- /package/dist/{chunk-GGUBDXRR.js.map → chunk-OP6F6L3S.js.map} +0 -0
- /package/dist/{chunk-JDZRYH2N.js.map → chunk-OYJKSZIQ.js.map} +0 -0
- /package/dist/{chunk-2XC73SHY.js.map → chunk-PBUZNGMX.js.map} +0 -0
- /package/dist/{chunk-WONS4RZ2.js.map → chunk-PTSNLEXK.js.map} +0 -0
- /package/dist/{chunk-XEQ7OT7U.js.map → chunk-QDKK63Y7.js.map} +0 -0
- /package/dist/{chunk-ZGOQTOYA.js.map → chunk-UBKEQOTD.js.map} +0 -0
- /package/dist/{chunk-T3GCXULH.js.map → chunk-VSURVXKY.js.map} +0 -0
- /package/dist/{chunk-CSMCNOPH.js.map → chunk-WRFBW2TT.js.map} +0 -0
- /package/dist/{chunk-G6LBWZRF.js.map → chunk-WU7TTVOD.js.map} +0 -0
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
import {
|
|
17
17
|
ActivityStore,
|
|
18
18
|
MaintenanceScheduler
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-WU7TTVOD.js";
|
|
20
20
|
import {
|
|
21
21
|
migrateFromEngram
|
|
22
22
|
} from "./chunk-7HYPN2GC.js";
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
import {
|
|
33
33
|
CompoundingEngine,
|
|
34
34
|
defaultTierMigrationCycleBudget
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-CW4AGY3G.js";
|
|
36
36
|
import {
|
|
37
37
|
SharedContextManager
|
|
38
38
|
} from "./chunk-AS7YMSL6.js";
|
|
@@ -208,7 +208,7 @@ import {
|
|
|
208
208
|
buildEntityRecallSection,
|
|
209
209
|
entityRecentTranscriptLookbackHours,
|
|
210
210
|
readRecentEntityTranscriptEntries
|
|
211
|
-
} from "./chunk-
|
|
211
|
+
} from "./chunk-IGPEJVBY.js";
|
|
212
212
|
import {
|
|
213
213
|
formatDaySummaryMemories
|
|
214
214
|
} from "./chunk-RPSYDM6C.js";
|
|
@@ -217,7 +217,7 @@ import {
|
|
|
217
217
|
ensureBuiltInWearableConnectors,
|
|
218
218
|
getWearableConnector,
|
|
219
219
|
listWearableConnectors
|
|
220
|
-
} from "./chunk-
|
|
220
|
+
} from "./chunk-JP3YPDAW.js";
|
|
221
221
|
import {
|
|
222
222
|
normalizeReplaySessionKey
|
|
223
223
|
} from "./chunk-AJVLDJU6.js";
|
|
@@ -227,14 +227,14 @@ import {
|
|
|
227
227
|
import {
|
|
228
228
|
compareVerifiedEpisodeResults,
|
|
229
229
|
searchVerifiedEpisodes
|
|
230
|
-
} from "./chunk-
|
|
230
|
+
} from "./chunk-FZRQZW4H.js";
|
|
231
231
|
import {
|
|
232
232
|
ThreadingManager
|
|
233
233
|
} from "./chunk-OJP3N7UK.js";
|
|
234
234
|
import {
|
|
235
235
|
compareVerifiedSemanticRuleResults,
|
|
236
236
|
searchVerifiedSemanticRules
|
|
237
|
-
} from "./chunk-
|
|
237
|
+
} from "./chunk-HKJCMOT6.js";
|
|
238
238
|
import {
|
|
239
239
|
searchWorkProductLedgerEntries
|
|
240
240
|
} from "./chunk-ZRWB5D4H.js";
|
|
@@ -247,11 +247,11 @@ import {
|
|
|
247
247
|
import {
|
|
248
248
|
runNamespaceMaintenanceFanout,
|
|
249
249
|
summarizeNamespaceMaintenanceHealth
|
|
250
|
-
} from "./chunk-
|
|
250
|
+
} from "./chunk-VSURVXKY.js";
|
|
251
251
|
import {
|
|
252
252
|
NamespaceCatalog,
|
|
253
253
|
planNamespaceMaintenance
|
|
254
|
-
} from "./chunk-
|
|
254
|
+
} from "./chunk-E5OBR6CJ.js";
|
|
255
255
|
import {
|
|
256
256
|
isAboveImportanceThreshold,
|
|
257
257
|
scoreImportance
|
|
@@ -286,7 +286,7 @@ import {
|
|
|
286
286
|
materializeAfterSemanticConsolidation,
|
|
287
287
|
parseConsolidationResponse,
|
|
288
288
|
parseOperatorAwareConsolidationResponse
|
|
289
|
-
} from "./chunk-
|
|
289
|
+
} from "./chunk-PTSNLEXK.js";
|
|
290
290
|
import {
|
|
291
291
|
semanticChunkContent
|
|
292
292
|
} from "./chunk-P4BC54KI.js";
|
|
@@ -328,7 +328,7 @@ import {
|
|
|
328
328
|
} from "./chunk-B7RWBZXW.js";
|
|
329
329
|
import {
|
|
330
330
|
MeetingsInputError
|
|
331
|
-
} from "./chunk-
|
|
331
|
+
} from "./chunk-35DL7IOI.js";
|
|
332
332
|
import {
|
|
333
333
|
WearablesInputError,
|
|
334
334
|
describeErrorForOperator
|
|
@@ -346,7 +346,7 @@ import {
|
|
|
346
346
|
clusterByKey,
|
|
347
347
|
createCorrectionService,
|
|
348
348
|
detectPassiveCorrections
|
|
349
|
-
} from "./chunk-
|
|
349
|
+
} from "./chunk-PBUZNGMX.js";
|
|
350
350
|
import {
|
|
351
351
|
importCapsule
|
|
352
352
|
} from "./chunk-ALSGMEJR.js";
|
|
@@ -408,7 +408,7 @@ import {
|
|
|
408
408
|
} from "./chunk-CYEPCZN5.js";
|
|
409
409
|
import {
|
|
410
410
|
NamespaceStorageRouter
|
|
411
|
-
} from "./chunk-
|
|
411
|
+
} from "./chunk-QDKK63Y7.js";
|
|
412
412
|
import {
|
|
413
413
|
writeConversationChunks
|
|
414
414
|
} from "./chunk-72A4L5JJ.js";
|
|
@@ -420,7 +420,7 @@ import {
|
|
|
420
420
|
} from "./chunk-L2DPF4DF.js";
|
|
421
421
|
import {
|
|
422
422
|
buildChainFollowupGenerator
|
|
423
|
-
} from "./chunk-
|
|
423
|
+
} from "./chunk-2AXMQWCN.js";
|
|
424
424
|
import {
|
|
425
425
|
ContentHashIndex,
|
|
426
426
|
QmdResultResolver,
|
|
@@ -440,7 +440,7 @@ import {
|
|
|
440
440
|
reconstructFusionInputs,
|
|
441
441
|
selfDeps,
|
|
442
442
|
serializeFusionDay
|
|
443
|
-
} from "./chunk-
|
|
443
|
+
} from "./chunk-JMQUBRV6.js";
|
|
444
444
|
import {
|
|
445
445
|
bodyIsEscaped,
|
|
446
446
|
decodeTranscriptBody,
|
|
@@ -25220,4 +25220,4 @@ export {
|
|
|
25220
25220
|
filterRecallCandidates,
|
|
25221
25221
|
Orchestrator
|
|
25222
25222
|
};
|
|
25223
|
-
//# sourceMappingURL=chunk-
|
|
25223
|
+
//# sourceMappingURL=chunk-FUYEVEX7.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-B7RWBZXW.js";
|
|
4
4
|
import {
|
|
5
5
|
StorageManager
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-JMQUBRV6.js";
|
|
7
7
|
import {
|
|
8
8
|
getCachedEpisodeMap,
|
|
9
9
|
setCachedEpisodeMap
|
|
@@ -109,4 +109,4 @@ export {
|
|
|
109
109
|
compareVerifiedEpisodeResults,
|
|
110
110
|
searchVerifiedEpisodes
|
|
111
111
|
};
|
|
112
|
-
//# sourceMappingURL=chunk-
|
|
112
|
+
//# sourceMappingURL=chunk-FZRQZW4H.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
computeCorpusWatermarks,
|
|
6
6
|
resolveCorpusNamespaceRoots
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-2GXM5N5A.js";
|
|
8
8
|
|
|
9
9
|
// src/operator-doctor-corpus.ts
|
|
10
10
|
var DIGEST_PREFIX_LENGTH = 12;
|
|
@@ -78,4 +78,4 @@ export {
|
|
|
78
78
|
corpusWatermarksFromCheck,
|
|
79
79
|
summarizeCorpusAndReplica
|
|
80
80
|
};
|
|
81
|
-
//# sourceMappingURL=chunk-
|
|
81
|
+
//# sourceMappingURL=chunk-GAWOEQEQ.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
StorageManager
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JMQUBRV6.js";
|
|
4
4
|
import {
|
|
5
5
|
getCachedRuleMemories,
|
|
6
6
|
setCachedRuleMemories
|
|
@@ -119,4 +119,4 @@ export {
|
|
|
119
119
|
compareVerifiedSemanticRuleResults,
|
|
120
120
|
searchVerifiedSemanticRules
|
|
121
121
|
};
|
|
122
|
-
//# sourceMappingURL=chunk-
|
|
122
|
+
//# sourceMappingURL=chunk-HKJCMOT6.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
StorageManager
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JMQUBRV6.js";
|
|
4
4
|
import {
|
|
5
5
|
composeMemoryEnvelope
|
|
6
6
|
} from "./chunk-CGASUJVP.js";
|
|
@@ -546,4 +546,4 @@ export {
|
|
|
546
546
|
setSemanticRulePromotionTestHooks,
|
|
547
547
|
promoteSemanticRuleFromMemory
|
|
548
548
|
};
|
|
549
|
-
//# sourceMappingURL=chunk-
|
|
549
|
+
//# sourceMappingURL=chunk-IAEAFLF2.js.map
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "./chunk-2DQ2XREU.js";
|
|
7
7
|
import {
|
|
8
8
|
compareEntityTimestamps
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-JMQUBRV6.js";
|
|
10
10
|
import {
|
|
11
11
|
normalizeEntityName
|
|
12
12
|
} from "./chunk-YXZG5TVN.js";
|
|
@@ -843,4 +843,4 @@ export {
|
|
|
843
843
|
entityIndexVersion,
|
|
844
844
|
entityRecentTranscriptLookbackHours
|
|
845
845
|
};
|
|
846
|
-
//# sourceMappingURL=chunk-
|
|
846
|
+
//# sourceMappingURL=chunk-IGPEJVBY.js.map
|
|
@@ -1478,7 +1478,15 @@ function resolveHistoricalEntityCanonicalId(normalized, mappings) {
|
|
|
1478
1478
|
var EntityCanonicalIdMigrationStateSchema = z.object({
|
|
1479
1479
|
version: z.literal(ENTITY_CANONICAL_ID_MIGRATION_VERSION),
|
|
1480
1480
|
complete: z.boolean(),
|
|
1481
|
-
mappings: z.record(z.string().min(1))
|
|
1481
|
+
mappings: z.record(z.string().min(1)),
|
|
1482
|
+
/**
|
|
1483
|
+
* Pairs the migration refused to resolve, PARKED rather than dropped.
|
|
1484
|
+
* Deleting the record would strand the collision: once an operator removes
|
|
1485
|
+
* the legacy file, no later scan can rediscover the mapping, so references
|
|
1486
|
+
* still naming the legacy id would never be rewritten. Optional so a journal
|
|
1487
|
+
* written by an older build still parses.
|
|
1488
|
+
*/
|
|
1489
|
+
blocked: z.record(z.string().min(1)).optional()
|
|
1482
1490
|
});
|
|
1483
1491
|
async function fingerprintPath(filePath) {
|
|
1484
1492
|
let fileStat;
|
|
@@ -1682,9 +1690,10 @@ async function readSafeEntityEntries(entitiesDir) {
|
|
|
1682
1690
|
}
|
|
1683
1691
|
return entries;
|
|
1684
1692
|
}
|
|
1685
|
-
async function discoverMappings(deps, knownMappings = {}) {
|
|
1693
|
+
async function discoverMappings(deps, knownMappings = {}, blocked = /* @__PURE__ */ new Map()) {
|
|
1686
1694
|
const mappings = {};
|
|
1687
1695
|
const canonicalOwners = /* @__PURE__ */ new Map();
|
|
1696
|
+
blocked.clear();
|
|
1688
1697
|
const entityEntries = await readSafeEntityEntries(deps.entitiesDir);
|
|
1689
1698
|
for (const entry of entityEntries) {
|
|
1690
1699
|
if (!entry.endsWith(".md")) continue;
|
|
@@ -1710,18 +1719,20 @@ async function discoverMappings(deps, knownMappings = {}) {
|
|
|
1710
1719
|
if (canonicalExists) {
|
|
1711
1720
|
const canonicalContent2 = await deps.readStorageSecureFile(canonicalPath);
|
|
1712
1721
|
if (entityContent !== canonicalContent2) {
|
|
1713
|
-
|
|
1722
|
+
blocked.set(legacyId, canonicalId);
|
|
1723
|
+
continue;
|
|
1714
1724
|
}
|
|
1715
1725
|
}
|
|
1716
|
-
|
|
1717
|
-
if (previousOwner !== void 0 && previousOwner !== legacyId) {
|
|
1718
|
-
throw new Error(
|
|
1719
|
-
`Cannot migrate legacy entity ids ${previousOwner} and ${legacyId}: both normalize to ${canonicalId}.`
|
|
1720
|
-
);
|
|
1721
|
-
}
|
|
1722
|
-
canonicalOwners.set(canonicalId, legacyId);
|
|
1726
|
+
canonicalOwners.set(canonicalId, [...canonicalOwners.get(canonicalId) ?? [], legacyId]);
|
|
1723
1727
|
mappings[legacyId] = canonicalId;
|
|
1724
1728
|
}
|
|
1729
|
+
for (const [canonicalId, claimants] of canonicalOwners) {
|
|
1730
|
+
if (claimants.length < 2) continue;
|
|
1731
|
+
for (const legacyId of claimants) {
|
|
1732
|
+
blocked.set(legacyId, canonicalId);
|
|
1733
|
+
delete mappings[legacyId];
|
|
1734
|
+
}
|
|
1735
|
+
}
|
|
1725
1736
|
return mappings;
|
|
1726
1737
|
}
|
|
1727
1738
|
async function rewriteReferences(deps, mappings, refreshLock) {
|
|
@@ -1923,7 +1934,16 @@ function mergeDiscoveredMappings(existing, discovered) {
|
|
|
1923
1934
|
for (const [legacyId, canonicalId] of Object.entries(discovered)) {
|
|
1924
1935
|
const previousMapping = merged[legacyId];
|
|
1925
1936
|
if (previousMapping !== void 0 && previousMapping !== canonicalId) {
|
|
1926
|
-
|
|
1937
|
+
let hop = canonicalId;
|
|
1938
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1939
|
+
while (hop !== void 0 && hop !== previousMapping && !seen.has(hop)) {
|
|
1940
|
+
seen.add(hop);
|
|
1941
|
+
hop = merged[hop];
|
|
1942
|
+
}
|
|
1943
|
+
if (hop !== previousMapping) {
|
|
1944
|
+
throw new Error(`Legacy entity id ${legacyId} changed canonical target during migration.`);
|
|
1945
|
+
}
|
|
1946
|
+
continue;
|
|
1927
1947
|
}
|
|
1928
1948
|
if (previousMapping === void 0 && wouldCreateMappingCycle(merged, legacyId, canonicalId)) continue;
|
|
1929
1949
|
const previousOwner = canonicalOwners.get(canonicalId);
|
|
@@ -1978,7 +1998,7 @@ async function migrateEntityFilePair(deps, legacyId, canonicalId, refreshMigrati
|
|
|
1978
1998
|
deps.isEncryptedStorageFile(canonicalPath)
|
|
1979
1999
|
]);
|
|
1980
2000
|
if (legacyContent !== canonicalContent2) {
|
|
1981
|
-
|
|
2001
|
+
return { deferred: false, progressed: false, blocked: true };
|
|
1982
2002
|
}
|
|
1983
2003
|
if (legacyEncrypted && !canonicalEncrypted) {
|
|
1984
2004
|
if (!await refreshMigrationLock() || !await refreshEntityLock()) {
|
|
@@ -2055,6 +2075,46 @@ async function migrateLegacyEntityCanonicalIds(deps) {
|
|
|
2055
2075
|
mappings: {}
|
|
2056
2076
|
};
|
|
2057
2077
|
}
|
|
2078
|
+
const blocked = /* @__PURE__ */ new Map();
|
|
2079
|
+
const finish = () => {
|
|
2080
|
+
if (blocked.size > 0) {
|
|
2081
|
+
const pairs = [...blocked].map(([legacyId, canonicalId]) => `${legacyId} -> ${canonicalId}`).join(", ");
|
|
2082
|
+
log.warn(
|
|
2083
|
+
`entity canonical-id migration skipped ${blocked.size} unresolvable pair(s): ${pairs}. Both files were kept and the legacy id still resolves; merge or delete one side to migrate it.`
|
|
2084
|
+
);
|
|
2085
|
+
}
|
|
2086
|
+
return deps.readMigrationFingerprint?.();
|
|
2087
|
+
};
|
|
2088
|
+
const pruneBlocked = async () => {
|
|
2089
|
+
const current = state;
|
|
2090
|
+
if (!current) return false;
|
|
2091
|
+
let revived = false;
|
|
2092
|
+
const parked = { ...current.blocked ?? {} };
|
|
2093
|
+
const active = {};
|
|
2094
|
+
for (const [legacyId, canonicalId] of Object.entries(current.mappings)) {
|
|
2095
|
+
if (!blocked.has(legacyId)) active[legacyId] = canonicalId;
|
|
2096
|
+
}
|
|
2097
|
+
for (const [legacyId, canonicalId] of blocked) parked[legacyId] = canonicalId;
|
|
2098
|
+
for (const [legacyId, canonicalId] of Object.entries(parked)) {
|
|
2099
|
+
if (blocked.has(legacyId)) continue;
|
|
2100
|
+
delete parked[legacyId];
|
|
2101
|
+
if (active[legacyId] !== void 0) continue;
|
|
2102
|
+
const legacyPath = deps.resolveEntityFilePath(legacyId);
|
|
2103
|
+
if (legacyPath !== null && await fileExists(legacyPath)) continue;
|
|
2104
|
+
active[legacyId] = canonicalId;
|
|
2105
|
+
revived = true;
|
|
2106
|
+
}
|
|
2107
|
+
const collapsed = collapseMappings(active);
|
|
2108
|
+
for (const [legacyId, canonicalId] of Object.entries(parked)) {
|
|
2109
|
+
const moved = collapsed[canonicalId];
|
|
2110
|
+
if (moved !== void 0 && moved !== legacyId) parked[legacyId] = moved;
|
|
2111
|
+
}
|
|
2112
|
+
const same = (a, b) => Object.keys(a).length === Object.keys(b).length && Object.entries(a).every(([key, value]) => b[key] === value);
|
|
2113
|
+
if (same(collapsed, current.mappings) && same(parked, current.blocked ?? {})) return revived;
|
|
2114
|
+
state = { ...current, mappings: collapsed, blocked: parked };
|
|
2115
|
+
await writeState(deps, state);
|
|
2116
|
+
return revived;
|
|
2117
|
+
};
|
|
2058
2118
|
const previousMappings = state.mappings;
|
|
2059
2119
|
const collapsedMappings = collapseMappings(previousMappings);
|
|
2060
2120
|
const mappingsChanged = Object.keys(collapsedMappings).length !== Object.keys(previousMappings).length || Object.entries(collapsedMappings).some(
|
|
@@ -2065,11 +2125,12 @@ async function migrateLegacyEntityCanonicalIds(deps) {
|
|
|
2065
2125
|
if (!await lock.refresh()) throw new Error("Lost entity canonical-id migration lock.");
|
|
2066
2126
|
const discoveredBefore = rejectMappingCycles(
|
|
2067
2127
|
state.mappings,
|
|
2068
|
-
await discoverMappings(deps, state.mappings)
|
|
2128
|
+
await discoverMappings(deps, state.mappings, blocked)
|
|
2069
2129
|
);
|
|
2130
|
+
await pruneBlocked();
|
|
2070
2131
|
const mergedBefore = collapseMappings(mergeDiscoveredMappings(state.mappings, discoveredBefore));
|
|
2071
2132
|
if (state.complete && Object.keys(discoveredBefore).length === 0 && !mappingsChanged) {
|
|
2072
|
-
if (Object.keys(state.mappings).length === 0) return
|
|
2133
|
+
if (Object.keys(state.mappings).length === 0) return finish();
|
|
2073
2134
|
const rewroteColdMemory2 = await rewriteKnownReferences(
|
|
2074
2135
|
deps,
|
|
2075
2136
|
state.mappings,
|
|
@@ -2079,7 +2140,7 @@ async function migrateLegacyEntityCanonicalIds(deps) {
|
|
|
2079
2140
|
deps.invalidateAllMemoriesCache();
|
|
2080
2141
|
if (rewroteColdMemory2) deps.invalidateColdMemoriesCache();
|
|
2081
2142
|
deps.bumpMemoryStatusVersion();
|
|
2082
|
-
return
|
|
2143
|
+
return finish();
|
|
2083
2144
|
}
|
|
2084
2145
|
if (state.complete || Object.keys(discoveredBefore).length > 0 || Object.keys(mergedBefore).length !== Object.keys(state.mappings).length) {
|
|
2085
2146
|
state = { ...state, complete: false, mappings: mergedBefore };
|
|
@@ -2089,11 +2150,12 @@ async function migrateLegacyEntityCanonicalIds(deps) {
|
|
|
2089
2150
|
if (!await lock.refresh()) throw new Error("Lost entity canonical-id migration lock.");
|
|
2090
2151
|
const discoveredAfter2 = rejectMappingCycles(
|
|
2091
2152
|
state.mappings,
|
|
2092
|
-
await discoverMappings(deps, state.mappings)
|
|
2153
|
+
await discoverMappings(deps, state.mappings, blocked)
|
|
2093
2154
|
);
|
|
2094
|
-
|
|
2155
|
+
const revivedInRescan = await pruneBlocked();
|
|
2156
|
+
if (Object.keys(discoveredAfter2).length === 0 && !revivedInRescan) {
|
|
2095
2157
|
await writeState(deps, { ...state, complete: true });
|
|
2096
|
-
return
|
|
2158
|
+
return finish();
|
|
2097
2159
|
}
|
|
2098
2160
|
state = {
|
|
2099
2161
|
...state,
|
|
@@ -2114,9 +2176,8 @@ async function migrateLegacyEntityCanonicalIds(deps) {
|
|
|
2114
2176
|
canonicalId,
|
|
2115
2177
|
() => lock.refresh()
|
|
2116
2178
|
);
|
|
2117
|
-
if (result.
|
|
2118
|
-
|
|
2119
|
-
}
|
|
2179
|
+
if (result.blocked) blocked.set(legacyId, canonicalId);
|
|
2180
|
+
else if (result.deferred) deferredMappings.push([legacyId, canonicalId]);
|
|
2120
2181
|
progressed ||= result.progressed;
|
|
2121
2182
|
}
|
|
2122
2183
|
if (deferredMappings.length === 0) break;
|
|
@@ -2128,6 +2189,7 @@ async function migrateLegacyEntityCanonicalIds(deps) {
|
|
|
2128
2189
|
}
|
|
2129
2190
|
pendingMappings = deferredMappings;
|
|
2130
2191
|
}
|
|
2192
|
+
await pruneBlocked();
|
|
2131
2193
|
const rewroteColdMemory = await rewriteKnownReferences(
|
|
2132
2194
|
deps,
|
|
2133
2195
|
state.mappings,
|
|
@@ -2140,11 +2202,12 @@ async function migrateLegacyEntityCanonicalIds(deps) {
|
|
|
2140
2202
|
if (!await lock.refresh()) throw new Error("Lost entity canonical-id migration lock.");
|
|
2141
2203
|
const discoveredAfter = rejectMappingCycles(
|
|
2142
2204
|
state.mappings,
|
|
2143
|
-
await discoverMappings(deps, state.mappings)
|
|
2205
|
+
await discoverMappings(deps, state.mappings, blocked)
|
|
2144
2206
|
);
|
|
2145
|
-
|
|
2207
|
+
const revivedAfterRewrite = await pruneBlocked();
|
|
2208
|
+
if (Object.keys(discoveredAfter).length === 0 && !revivedAfterRewrite) {
|
|
2146
2209
|
await writeState(deps, { ...state, complete: true });
|
|
2147
|
-
return
|
|
2210
|
+
return finish();
|
|
2148
2211
|
}
|
|
2149
2212
|
state = {
|
|
2150
2213
|
...state,
|
|
@@ -10568,4 +10631,4 @@ export {
|
|
|
10568
10631
|
isValidBufferSurpriseEvent,
|
|
10569
10632
|
StorageManager3 as StorageManager
|
|
10570
10633
|
};
|
|
10571
|
-
//# sourceMappingURL=chunk-
|
|
10634
|
+
//# sourceMappingURL=chunk-JMQUBRV6.js.map
|