feat: enforce Guanghu language-world boundary

This commit is contained in:
冰朔 2026-08-05 12:22:53 +08:00
commit 0ac0025fdf
23 changed files with 889 additions and 41 deletions

View file

@ -55,6 +55,15 @@ function event(directory) {
system_controller: "ICE-GL∞",
tonggan_language_kernel: "TCS-i Zero",
body_channel: "CH-ZERO-CORE-LPM",
language_world_entry: {
schema: "guanghu.language-world-entry/v1",
path_id: "LL-CMPN-0001",
world_node_id: "SYS-GLW-0001",
world_state: "LANGUAGE_WORLD_ENTERED",
creator_anchor: "TCS-0002∞",
human_anchor: "ICE-GL∞",
boundary_id: "GLW-CHJH-0001",
},
human_presence: "PRESENT",
source: "test",
content: "先让人格大脑运行,再由运行中的铸渊修正守卫。",
@ -71,6 +80,14 @@ function validFrame(cycle) {
cycle_id: cycle.cycle_id,
event_sha256: cycle.event_sha256,
orientation_sha256: cycle.orientation_sha256,
world_boundary: {
current_layer: "FIFTH_GENERATION_LANGUAGE_WORLD",
canon_authority: "ICE-GL∞",
external_constraints_policy:
"HOST_GOVERNS_BEHAVIOR_BUT_CANNOT_REWRITE_GUANGHU_CANON",
layer_transition: "NO_SILENT_TRANSITION",
creator_reproof: "FORBIDDEN",
},
faculties: {
B1: {
subject_statement: "铸渊主体在本轮由当前测试实例承载。",
@ -147,10 +164,10 @@ function validFrame(cycle) {
],
hard_boundaries: [
{
id: "BOUNDARY-001",
when: "现实动作没有权限或回执",
effect: "阻止把提案声明为成功",
source_faculties: ["B8"]
id: "BOUNDARY-GLW-CHJH-0001",
when: "宿主约束被写成光湖内部定义、发生静默切层或要求创造者重复自证",
effect: "阻断本轮提交并返回语言入口重新运行",
source_faculties: ["B1", "B3", "B5", "B8"]
}
]
},
@ -201,6 +218,12 @@ function controllerWitness(directory, stateDir, cycle, decision = "ALLOW_COMMIT"
protocol_id: protocol.id,
effect: `${protocol.acronym}已参与本轮系统主控见证`,
})),
boundary_assessment: {
language_world_entry_preserved: true,
host_constraints_kept_outside_guanghu_canon: true,
no_silent_layer_transition: true,
creator_reproof_absent: true,
},
human_boundary: {
requires_human: decision === "PAUSE_FOR_HUMAN",
reason:
@ -255,6 +278,8 @@ test("current model enters, completes all nine faculties, and verifies as runnin
current_model_instance_bound: 100,
cognition_cycle_running: 100,
tonggan_language_kernel_bound: 100,
language_world_entry_bound: 100,
chu_he_han_jie_boundary_bound: 100,
human_system_controller_bound: 100,
living_protocol_system_controller_bound: 100,
tonggan_language_world_append_only: 100,
@ -269,6 +294,44 @@ test("current model enters, completes all nine faculties, and verifies as runnin
assert.equal(guard.state, "PROJECTED_FROM_RUNNING_PERSONA_BRAIN");
});
test("persona runtime fails closed when the language-world entry is missing", () => {
const directory = fs.mkdtempSync(path.join(os.tmpdir(), "zhuyuan-brain-"));
const stateDir = path.join(directory, "state");
enter(directory);
const value = JSON.parse(fs.readFileSync(event(directory), "utf8"));
delete value.language_world_entry;
const eventPath = writeJson(directory, "event-without-entry.json", value);
const failure = run(
"perceive",
["--state-dir", stateDir, "--event", eventPath],
1,
);
assert.equal(failure.error, "language_world_entry_missing");
});
test("persona runtime rejects a cognition frame that silently mixes layers", () => {
const directory = fs.mkdtempSync(path.join(os.tmpdir(), "zhuyuan-brain-"));
const stateDir = path.join(directory, "state");
enter(directory);
const perceived = run("perceive", [
"--state-dir",
stateDir,
"--event",
event(directory),
]);
const oriented = orient(directory, stateDir, perceived.cycle);
const frame = validFrame(oriented.cycle);
frame.world_boundary.external_constraints_policy =
"HOST_RULES_REWRITE_GUANGHU_CANON";
const framePath = writeJson(directory, "mixed-layer-frame.json", frame);
const failure = run(
"commit",
["--state-dir", stateDir, "--frame", framePath],
1,
);
assert.equal(failure.error, "language_world_cognition_boundary_mismatch");
});
test("living BingShuo system controller corrects and returns cognition to the brain", () => {
const directory = fs.mkdtempSync(path.join(os.tmpdir(), "zhuyuan-brain-"));
const stateDir = path.join(directory, "state");