2026-08-03 10:50:33 +08:00
|
|
|
import assert from "node:assert/strict";
|
|
|
|
|
import fs from "node:fs";
|
|
|
|
|
import path from "node:path";
|
|
|
|
|
import test from "node:test";
|
|
|
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
|
|
|
|
|
|
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
|
|
|
const readJson = (relative) =>
|
|
|
|
|
JSON.parse(fs.readFileSync(path.join(root, relative), "utf8"));
|
|
|
|
|
|
2026-08-03 23:51:32 +08:00
|
|
|
test("code channel has one root and exactly three current repositories", () => {
|
2026-08-03 10:50:33 +08:00
|
|
|
const map = readJson("routing/code-channel-canonical-map.json");
|
|
|
|
|
assert.equal(map.web_root, "https://guanghulab.com/code/");
|
2026-08-03 23:51:32 +08:00
|
|
|
assert.equal(map.repositories.length, 3);
|
2026-08-03 10:50:33 +08:00
|
|
|
assert.deepEqual(
|
|
|
|
|
map.repositories.map((entry) => entry.code),
|
2026-08-03 23:51:32 +08:00
|
|
|
["REPO-012", "REPO-014", "REPO-015"],
|
2026-08-03 10:50:33 +08:00
|
|
|
);
|
|
|
|
|
for (const repository of map.repositories) {
|
|
|
|
|
assert.match(
|
|
|
|
|
repository.clone_url,
|
|
|
|
|
/^https:\/\/guanghulab\.com\/code\/bingshuo\/[^/]+\.git$/u,
|
|
|
|
|
);
|
|
|
|
|
assert.equal(repository.push_allowed, true);
|
|
|
|
|
assert.equal(
|
|
|
|
|
repository.lease_resource,
|
|
|
|
|
`repo://guanghulab.com/code/bingshuo/${repository.slug}#main`,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test("legacy repository routes are all non-current and non-push", () => {
|
|
|
|
|
const map = readJson("routing/repository-route-map.json");
|
|
|
|
|
const current = map.repositories.filter((entry) =>
|
2026-08-03 23:51:32 +08:00
|
|
|
["REPO-012", "REPO-014", "REPO-015"].includes(entry.code),
|
2026-08-03 10:50:33 +08:00
|
|
|
);
|
2026-08-03 23:51:32 +08:00
|
|
|
assert.equal(current.length, 3);
|
|
|
|
|
assert.equal(map.repositories.length, 3);
|
2026-08-03 10:50:33 +08:00
|
|
|
for (const repository of map.historical_repositories) {
|
|
|
|
|
assert.match(repository.state, /HISTORICAL.*(?:NO_PUSH|ROUTE_CLOSED)/u);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test("each registered persona system exposes all five components", () => {
|
|
|
|
|
const map = readJson("routing/persona-system-canonical-map.json");
|
|
|
|
|
assert.equal(map.persona_systems.length, 10);
|
|
|
|
|
assert.equal(
|
|
|
|
|
new Set(map.persona_systems.map((entry) => entry.id)).size,
|
|
|
|
|
map.persona_systems.length,
|
|
|
|
|
);
|
|
|
|
|
const components = [
|
|
|
|
|
"human_relationship_anchor",
|
|
|
|
|
"persona_subject",
|
|
|
|
|
"current_model_instance",
|
|
|
|
|
"permanent_memory_and_protocol",
|
|
|
|
|
"reality_execution_node",
|
|
|
|
|
];
|
|
|
|
|
for (const persona of map.persona_systems) {
|
|
|
|
|
for (const component of components) {
|
|
|
|
|
assert.ok(persona[component], `${persona.id} missing ${component}`);
|
|
|
|
|
}
|
|
|
|
|
assert.ok(persona.persona_subject.responsibility);
|
|
|
|
|
assert.ok(persona.persona_subject.self_recognition);
|
|
|
|
|
assert.ok(persona.persona_subject.canonical_path);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test("human and machine entry documents point to the canonical roots", () => {
|
|
|
|
|
const required = {
|
|
|
|
|
"README.md": "PERSONA-SYSTEM-ROOT.hdlp",
|
|
|
|
|
"INDEX.hdlp": "routing/code-channel-canonical-map.json",
|
|
|
|
|
"WORLD-ROUTER.hdlp": "https://guanghulab.com/code/",
|
|
|
|
|
"BROADCAST-TOWER.hdlp": "PERSONA-SYSTEM-ROOT.hdlp",
|
|
|
|
|
"eternal-lake-heart/heartbeat-core/LL-CURRENT.hdlp":
|
|
|
|
|
"TCS-PERSONA-SYSTEM-MAP-001",
|
|
|
|
|
};
|
|
|
|
|
for (const [relative, needle] of Object.entries(required)) {
|
|
|
|
|
const body = fs.readFileSync(path.join(root, relative), "utf8");
|
|
|
|
|
assert.ok(body.includes(needle), `${relative} missing ${needle}`);
|
|
|
|
|
}
|
|
|
|
|
});
|
2026-08-04 10:35:51 +08:00
|
|
|
|
|
|
|
|
test("persona recovery includes the current cognition and binary existence boundaries", () => {
|
|
|
|
|
const map = readJson("routing/persona-system-canonical-map.json");
|
|
|
|
|
assert.match(map.existence_rule, /0或100/u);
|
|
|
|
|
assert.match(map.existence_rule, /分别判定/u);
|
|
|
|
|
|
|
|
|
|
const cognition = fs.readFileSync(path.join(root, map.current_cognition), "utf8");
|
|
|
|
|
for (const component of [
|
|
|
|
|
"人类关系锚点",
|
|
|
|
|
"人格体主体",
|
|
|
|
|
"当前模型运行实例",
|
|
|
|
|
"永久记忆与协议",
|
|
|
|
|
"现实执行节点",
|
|
|
|
|
]) {
|
|
|
|
|
assert.ok(cognition.includes(component), `cognition missing ${component}`);
|
|
|
|
|
}
|
|
|
|
|
for (const boundary of [
|
|
|
|
|
"人格体主体存在",
|
|
|
|
|
"人格系统恢复",
|
|
|
|
|
"历史追平",
|
|
|
|
|
"原生物理驻留",
|
|
|
|
|
"当前在线",
|
|
|
|
|
]) {
|
|
|
|
|
assert.ok(cognition.includes(boundary), `cognition missing ${boundary}`);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const wake = fs.readFileSync(
|
|
|
|
|
path.join(
|
|
|
|
|
root,
|
|
|
|
|
"eternal-lake-heart/heartbeat-core/zhuyuan-persona-system/WAKE.hdlp",
|
|
|
|
|
),
|
|
|
|
|
"utf8",
|
|
|
|
|
);
|
|
|
|
|
assert.ok(wake.includes("ZY-BIDIRECTIONAL-COGNITION-015"));
|
|
|
|
|
});
|