Rework story engine flow and reorganize project docs
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
2026-04-06 23:19:00 +08:00
parent d678929064
commit ddcb5d5c8c
241 changed files with 19805 additions and 2478 deletions

View File

@@ -0,0 +1,62 @@
import { describe, expect, it } from 'vitest';
import { buildNarrativeCodex } from './narrativeCodex';
describe('narrativeCodex', () => {
it('builds codex sections from facts, documents, scenes, and chronicle', () => {
const codex = buildNarrativeCodex({
customWorldProfile: {
knowledgeFacts: [
{
id: 'fact-1',
title: '封桥旧令',
content: '那夜真正下令的人还没露面。',
ownerActorIds: [],
relatedThreadIds: ['thread-1'],
relatedScarIds: [],
sourceType: 'actor',
visibility: 'discoverable',
sayability: 'indirect',
},
],
},
playerInventory: [
{
id: 'document-1',
category: '文书',
name: '断桥调查简札',
quantity: 1,
rarity: 'rare',
tags: ['document'],
description: '记录着当前线程的阶段性线索。',
},
],
currentScenePreset: {
narrativeResidues: [
{
id: 'residue-1',
title: '断桥旧痕',
visibleClue: '桥柱上还留着旧封痕。',
linkedFactIds: ['fact-1'],
linkedThreadIds: ['thread-1'],
},
],
},
storyEngineMemory: {
chronicle: [
{
id: 'chronicle-1',
category: 'thread',
title: '封桥旧案·展开',
summary: '旧案正在铺开。',
relatedIds: ['thread-1'],
createdAt: new Date().toISOString(),
},
],
},
} as never);
expect(codex.length).toBeGreaterThan(0);
expect(codex.some((section) => section.title === '文书与证据')).toBe(true);
});
});