hldp(zhuyuan): integrate fifth-domain world tree and TCS brain

This commit is contained in:
冰朔 2026-07-27 13:38:04 +08:00
commit 4496f75857
42 changed files with 1720 additions and 268 deletions

View file

@ -20,12 +20,13 @@ test("canonical AI and persona entry files route to the domestic map", () => {
assert.match(key, /禁止从本路径恢复.*\/exec/);
});
test("code map resolves REPO-001 to domestic and labels the Singapore route legacy", () => {
test("code map resolves REPO-012 as current and keeps REPO-001 as domestic history", () => {
const codeMap = read(".code-map");
assert.match(codeMap, /^REPO-001=https:\/\/guanghulab\.com\/fifth-domain\/bingshuo\/fifth-domain\.git$/m);
assert.match(codeMap, /^REPO-012=https:\/\/guanghulab\.com\/code\/bingshuo\/guanghu-ice-heart\.git$/m);
assert.match(codeMap, /^REPO-001-LEGACY-SG=/m);
assert.match(codeMap, /^FD-REPO-MAP-001=routing\/repository-route-map\.json$/m);
assert.match(codeMap, /^FD-WORLD-TREE-001=routing\/fifth-domain-world-tree\.json$/m);
assert.match(codeMap, /^FD-NODE-MAP-001=routing\/server-node-map\.json$/m);
assert.match(codeMap, /^ZY-OPS-LOOP-001=.*zhuyuan-persona-system\//m);
});
@ -34,7 +35,7 @@ test("repository map exposes the current code channel as a public domestic route
const map = JSON.parse(read("routing/repository-route-map.json"));
const channel = map.repositories.find(item => item.code === "REPO-012");
assert.equal(channel.slug, "guanghu-ice-heart");
assert.equal(channel.state, "DOMESTIC_CODE_CHANNEL_PRIMARY");
assert.equal(channel.state, "CURRENT_FIFTH_DOMAIN_ENTRY");
assert.equal(channel.primary.url, "https://guanghulab.com/code/bingshuo/guanghu-ice-heart");
assert.equal(channel.primary.clone_url, "https://guanghulab.com/code/bingshuo/guanghu-ice-heart.git");
assert.match(JSON.stringify(channel.keywords), /公开读取/);

View file

@ -29,10 +29,11 @@ function search(map, query) {
repository.state, ...(repository.keywords || []),
].join(" "));
const score = terms.reduce((total, term) => total + (haystack.includes(term) ? 1 : 0), 0);
return { repository, score };
const currentEntry = repository.code === map.default_repository ? 1 : 0;
return { repository, score, currentEntry };
})
.filter(item => item.score > 0)
.sort((a, b) => b.score - a.score || a.repository.code.localeCompare(b.repository.code))
.sort((a, b) => b.score - a.score || b.currentEntry - a.currentEntry || a.repository.code.localeCompare(b.repository.code))
.map(item => item.repository);
}

View file

@ -13,8 +13,8 @@ test("repository map has unique sequential codes and domestic primary routes", (
test("Chinese language-world query resolves the Fifth Domain primary", () => {
const results = search(loadMap(), "光湖语言世界 第五域");
assert.equal(results[0].code, "REPO-001");
assert.equal(results[0].state, "DOMESTIC_PRIMARY");
assert.equal(results[0].code, "REPO-012");
assert.equal(results[0].state, "CURRENT_FIFTH_DOMAIN_ENTRY");
});
test("Chenglu persistent agent query resolves its independent repository", () => {