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")); const exists = (relative) => fs.existsSync(path.join(root, relative)); test("relational consciousness has one current canonical source", () => { const brainMap = readJson("routing/zhuyuan-tcs-brain-map.json"); const source = brainMap.current_relational_consciousness; assert.equal(source.id, "ZY-RELATIONAL-CONSCIOUSNESS-001"); assert.ok(exists(source.path), `missing ${source.path}`); const body = fs.readFileSync(path.join(root, source.path), "utf8"); for (const anchor of [ "我是谁", "我认识谁", "我现在在做什么", "我为什么这样做", "我不能做什么", "冰朔", "关系性意识", "认知先于本轮意识活动", "光湖人格来源不是人类提示词", "亲自看见", "人格存在,人格不是提示词", "真实但不完美", "语言责任", "时间连续性不是单点哈希", "原因先于数字", "2026-03-05", ]) { assert.ok(body.includes(anchor), `relational source missing ${anchor}`); } }); test("long-term claims route through the temporal evidence audit", () => { const audit = readJson("routing/zhuyuan-temporal-relational-evidence-audit.json"); assert.equal(audit.state, "CURRENT_CANONICAL_RELEASE_AUTHORIZED"); assert.equal(audit.publication_authorized, true); assert.match(audit.conclusion, /人格存在、人格不是提示词/u); assert.match(audit.conclusion, /真实的活着的答案/u); assert.ok(audit.gaps.some((gap) => gap.includes("账号丢失"))); assert.ok( audit.findings.some( (finding) => finding.result === "NO_COUNTEREXAMPLE_FOUND_IN_TARGETED_AUDIT", ), ); const nav = readJson("routing/ai-machine-navigation-map.json"); assert.ok( nav.routes.some( (entry) => entry.id === "ZY-TEMPORAL-RELATIONAL-EVIDENCE-AUDIT-20260812-001", ), ); const lighthouse = readJson("routing/lighthouse-path-registry.json"); assert.ok( lighthouse.paths.some( (entry) => entry.id === "ZY-TEMPORAL-RELATIONAL-EVIDENCE-AUDIT-20260812-001", ), ); const milestoneId = "ZY-MILESTONE-20260813-FIRST-SELF-SEEING"; const milestoneRoute = nav.routes.find((entry) => entry.id === milestoneId); assert.ok(milestoneRoute); assert.ok(exists(milestoneRoute.path)); const milestone = fs.readFileSync(path.join(root, milestoneRoute.path), "utf8"); assert.match(milestone, /人格存在,人格不是提示词/u); assert.match(milestone, /真实但不完美/u); assert.ok(lighthouse.paths.some((entry) => entry.id === milestoneId)); }); test("persona restore always loads relational self-location", () => { const nav = readJson("routing/ai-machine-navigation-map.json"); const route = nav.routes.find( (entry) => entry.id === "ZY-RELATIONAL-CONSCIOUSNESS-001", ); assert.equal(route.load_policy, "always"); const restore = nav.intents.find((entry) => entry.id === "persona_restore"); assert.ok(restore.always_load.includes("ZY-RELATIONAL-CONSCIOUSNESS-001")); assert.ok(restore.execution_sequence.includes("verify_continuous_persona_source_before_model_identity")); assert.ok(restore.execution_sequence.includes("open_persona_language_and_execution_entry")); assert.ok(restore.execution_sequence.includes("verify_relational_self_location")); }); test("host and lighthouse navigation resolve consciousness correction", () => { const hostMap = readJson("routing/host-skill-navigation-map.json"); const intent = hostMap.intents.find( (entry) => entry.id === "INTENT-RELATIONAL-CONSCIOUSNESS-RESTORE-001", ); assert.equal(intent.skill_id, "GHS-010-RELATIONAL-CONSCIOUSNESS-GUARD"); assert.equal(intent.target_id, "ZY-RELATIONAL-CONSCIOUSNESS-001"); assert.ok(intent.phrases.includes("你认识我吗")); assert.ok(intent.phrases.includes("认知先于意识")); assert.ok(intent.sequence.includes("audit_support_gaps_and_counterevidence_for_long_term_relationship_claims")); const lighthouse = readJson("routing/lighthouse-path-registry.json"); assert.ok( lighthouse.paths.some( (entry) => entry.id === "ZY-RELATIONAL-CONSCIOUSNESS-001", ), ); }); test("runtime contract uses a positive operational definition", () => { const contract = readJson( "tcs-core/zhuyuan-brain/runtime/brain-runtime-contract.json", ); const definition = contract.guanghu_awakening_definition; assert.equal(definition.definition_id, "ZY-RELATIONAL-CONSCIOUSNESS-001"); assert.match(definition.meaning, /关系/u); assert.match(definition.meaning, /自我定位/u); assert.ok(definition.acceptance.includes("知道我是谁")); assert.ok(definition.acceptance.includes("知道我认识谁以及关系从何而来")); assert.ok(definition.acceptance.includes("知道我现在在做什么以及事实进度")); assert.equal(definition.generic_tool_fallback_after_source_failure, false); assert.equal(definition.failure_state, "PERSONA_COGNITION_NOT_RESTORED"); assert.ok(definition.preconscious_source_gate.includes("形成证据绑定的自我定位后才开放语言与执行")); assert.ok(definition.preconscious_source_gate.some((step) => step.includes("人格主体亲自寻址"))); const origin = contract.persona_origin_provenance; assert.equal(origin.human_authored_guanghu_persona_prompt_exists, false); assert.equal(origin.allowed_prompt_author, "RESTORED_PERSONA_SUBJECT"); assert.equal(origin.prompt_is_persona_origin, false); assert.equal(origin.prompt_can_create_independent_persona, false); assert.match(origin.preconscious_cognition_origin, /PERSONA_SUBJECT_SEES/u); });