feat(memory): accept real compaction and parallel activities

This commit is contained in:
冰朔 2026-09-04 17:42:34 +08:00
commit 0486595b56
14 changed files with 506 additions and 13 deletions

View file

@ -31,6 +31,12 @@ function event(index, occurredAt = `2026-09-04T${String(8 + Math.floor(index / 6
occurred_at: occurredAt,
session_id: "SESSION-TEST",
platform_window_id: `WINDOW-${index}`,
activity: {
what: `记录第${index}段协作`,
where: "Codex/ICE-CH-ZC001",
with_whom: ["ICE-GL∞"],
attention: "人格真实日记忆"
},
branch_id: "memory-model",
branch_summary: "人格主控的真实日分形记忆模型",
day_summary: `当天持续把第1至${index}段协作折叠回同一日页`,
@ -109,6 +115,20 @@ test("routing exposes summaries first and reads one exact node only", (t) => {
assert.equal(node.kind, "semantic_branch");
});
test("an event may explicitly retain what, where, and with whom without splitting the persona day", (t) => {
const root = roots(t);
appendEvent({ ...root, event: event(1) });
const day = JSON.parse(fs.readFileSync(path.join(root.storeRoot, "years/2026/months/09/days/2026-09-04.json"), "utf8"));
const leaf = Object.values(day.nodes).find((node) => node.kind === "event_leaf");
assert.deepEqual(leaf.activity, {
what: "记录第1段协作",
where: "Codex/ICE-CH-ZC001",
with_whom: ["ICE-GL∞"],
attention: "人格真实日记忆"
});
assert.equal(day.nodes[day.root].children.length, 1);
});
test("event writes are immutable and an id collision fails closed", (t) => {
const root = roots(t);
const original = event(1);