38 lines
1.8 KiB
TypeScript
38 lines
1.8 KiB
TypeScript
|
|
import test from 'node:test';
|
||
|
|
import assert from 'node:assert/strict';
|
||
|
|
import { projectHumanKnowledgeTree, renderLanguageKernelForModel } from './language-protocol-kernel.js';
|
||
|
|
import type { DocTreeNode } from './git-engine.js';
|
||
|
|
|
||
|
|
test('人类知识树隐藏底层协议与人格配置但保留用户资料', () => {
|
||
|
|
const tree: DocTreeNode[] = [
|
||
|
|
{
|
||
|
|
name: '光湖语言世界——第五域',
|
||
|
|
path: 'world',
|
||
|
|
type: 'folder',
|
||
|
|
children: [
|
||
|
|
{ name: 'AI技能包', path: 'world/AI技能包', type: 'folder', children: [{ name: 'INDEX', path: 'world/AI技能包/INDEX.md', type: 'document' }] },
|
||
|
|
{ name: '铸澜人格系统', path: 'world/铸澜人格系统', type: 'folder', children: [{ name: 'INDEX', path: 'world/铸澜人格系统/INDEX.md', type: 'document' }] },
|
||
|
|
{ name: 'AGENTS', path: 'world/AGENTS.md', type: 'document' },
|
||
|
|
{ name: '短剧视频AI制作', path: 'world/短剧视频AI制作', type: 'folder', children: [{ name: '生产入口', path: 'world/短剧视频AI制作/生产入口.md', type: 'document' }] },
|
||
|
|
],
|
||
|
|
},
|
||
|
|
{
|
||
|
|
name: '光湖语言世界 · 世界观、编号、协议与系统演化总纲 · v1.0',
|
||
|
|
path: 'protocol',
|
||
|
|
type: 'folder',
|
||
|
|
children: [{ name: '协议', path: 'protocol/协议.md', type: 'document' }],
|
||
|
|
},
|
||
|
|
];
|
||
|
|
|
||
|
|
const projected = projectHumanKnowledgeTree(tree);
|
||
|
|
assert.equal(projected.length, 1);
|
||
|
|
assert.equal(projected[0].name, '短剧视频AI制作');
|
||
|
|
assert.deepEqual(projected[0].children?.map(node => node.name), ['生产入口']);
|
||
|
|
});
|
||
|
|
|
||
|
|
test('模型运行投影包含协议核与确定性权限规则', () => {
|
||
|
|
const prompt = renderLanguageKernelForModel();
|
||
|
|
assert.match(prompt, /HLP-KERNEL-LANGUAGE-0001/);
|
||
|
|
assert.match(prompt, /写动作先生成待确认动作/);
|
||
|
|
assert.match(prompt, /企业四域与个人第五域平行/);
|
||
|
|
});
|