mirror of
https://github.com/Youzini-afk/ST-Bionic-Memory-Ecology.git
synced 2026-06-14 02:40:45 +08:00
perf: complete persist-load P2 hydration pass
This commit is contained in:
@@ -8,6 +8,11 @@ import {
|
||||
findLatestNode,
|
||||
serializeGraph,
|
||||
} from "../graph/graph.js";
|
||||
import { normalizeMemoryScope } from "../graph/memory-scope.js";
|
||||
import {
|
||||
normalizeStoryTime,
|
||||
normalizeStoryTimeSpan,
|
||||
} from "../graph/story-timeline.js";
|
||||
|
||||
const graph = createEmptyGraph();
|
||||
const objectiveNode = createNode({
|
||||
@@ -53,6 +58,50 @@ const latestPov = findLatestNode(
|
||||
assert.equal(latestObjective?.id, objectiveNode.id);
|
||||
assert.equal(latestPov?.id, povNode.id);
|
||||
|
||||
const normalizedScope = {
|
||||
layer: "pov",
|
||||
ownerType: "character",
|
||||
ownerId: "艾琳",
|
||||
ownerName: "艾琳",
|
||||
regionPrimary: "钟楼",
|
||||
regionPath: ["钟楼", "塔顶"],
|
||||
regionSecondary: ["旧城区"],
|
||||
};
|
||||
assert.equal(
|
||||
normalizeMemoryScope(normalizedScope),
|
||||
normalizedScope,
|
||||
"已规范的 scope 对象应直接复用",
|
||||
);
|
||||
|
||||
const normalizedStoryTime = {
|
||||
segmentId: "tl-1",
|
||||
label: "第二天清晨",
|
||||
tense: "ongoing",
|
||||
relation: "same",
|
||||
anchorLabel: "昨夜",
|
||||
confidence: "high",
|
||||
source: "derived",
|
||||
};
|
||||
assert.equal(
|
||||
normalizeStoryTime(normalizedStoryTime),
|
||||
normalizedStoryTime,
|
||||
"已规范的 storyTime 对象应直接复用",
|
||||
);
|
||||
|
||||
const normalizedStoryTimeSpan = {
|
||||
startSegmentId: "tl-0",
|
||||
endSegmentId: "tl-1",
|
||||
startLabel: "昨夜",
|
||||
endLabel: "第二天清晨",
|
||||
mixed: false,
|
||||
source: "derived",
|
||||
};
|
||||
assert.equal(
|
||||
normalizeStoryTimeSpan(normalizedStoryTimeSpan),
|
||||
normalizedStoryTimeSpan,
|
||||
"已规范的 storyTimeSpan 对象应直接复用",
|
||||
);
|
||||
|
||||
const legacyGraph = deserializeGraph({
|
||||
version: 6,
|
||||
lastProcessedSeq: 0,
|
||||
|
||||
Reference in New Issue
Block a user