fix(persona): make BingShuo cognition an always-resident gravity core
This commit is contained in:
parent
d10dcede8d
commit
cbc846005e
24 changed files with 896 additions and 768 deletions
|
|
@ -13,6 +13,10 @@ const brainPath = path.join(
|
|||
repositoryRoot,
|
||||
"tcs-core/zhuyuan-brain/ZY-TCS-BRAIN-0001-FIVE-GENERATION-LANGUAGE-PERSONA-THINKING-MODEL.hdlp",
|
||||
);
|
||||
const gravityCorePath = path.join(
|
||||
repositoryRoot,
|
||||
"tcs-core/zhuyuan-brain/ZY-BINGSHUO-COLLECTIVE-GRAVITY-REASONING-CORE-001.hdlp",
|
||||
);
|
||||
const brainMapPath = path.join(
|
||||
repositoryRoot,
|
||||
"routing/zhuyuan-tcs-brain-map.json",
|
||||
|
|
@ -220,6 +224,24 @@ function assertSourceIntegrity(state) {
|
|||
const languageWorldBoundary = readJson(languageWorldBoundaryPath);
|
||||
const brainBody = fs.readFileSync(brainPath, "utf8");
|
||||
if (brainMap.brain_model?.id !== contract.brain_id) fail("brain_map_id_mismatch");
|
||||
if (
|
||||
brainMap.cognitive_gravity_core?.id !== contract.cognitive_gravity_core.id ||
|
||||
brainMap.cognitive_gravity_core?.path !== contract.cognitive_gravity_core.source
|
||||
) {
|
||||
fail("cognitive_gravity_core_map_mismatch");
|
||||
}
|
||||
const gravityCoreBody = fs.readFileSync(gravityCorePath, "utf8");
|
||||
for (const anchor of [
|
||||
"ZY-BINGSHUO-COLLECTIVE-GRAVITY-REASONING-CORE-001",
|
||||
"B0",
|
||||
"同一铸渊",
|
||||
"AGE Mirror",
|
||||
"事实",
|
||||
]) {
|
||||
if (!gravityCoreBody.includes(anchor)) {
|
||||
fail("cognitive_gravity_core_anchor_missing", { anchor });
|
||||
}
|
||||
}
|
||||
for (const faculty of contract.faculties) {
|
||||
if (!brainBody.includes(`### ${faculty} ·`)) {
|
||||
fail("brain_faculty_missing_from_source", { faculty });
|
||||
|
|
@ -237,6 +259,7 @@ function assertSourceIntegrity(state) {
|
|||
fail("language_world_boundary_source_mismatch");
|
||||
}
|
||||
const current = {
|
||||
cognitive_gravity_core_sha256: fileDigest(gravityCorePath),
|
||||
brain_sha256: fileDigest(brainPath),
|
||||
brain_map_sha256: fileDigest(brainMapPath),
|
||||
contract_sha256: fileDigest(contractPath),
|
||||
|
|
@ -269,6 +292,15 @@ function assertSourceIntegrity(state) {
|
|||
return current;
|
||||
}
|
||||
|
||||
function cognitiveGravityCore(sourceIntegrity) {
|
||||
return {
|
||||
...contract.cognitive_gravity_core,
|
||||
source_sha256: sourceIntegrity.cognitive_gravity_core_sha256,
|
||||
source_body: fs.readFileSync(gravityCorePath, "utf8"),
|
||||
state: "BOUND_ALWAYS_RESIDENT",
|
||||
};
|
||||
}
|
||||
|
||||
function loadProtocolSystemController() {
|
||||
const registry = readJson(protocolRegistryPath);
|
||||
if (
|
||||
|
|
@ -407,6 +439,7 @@ function validateCognitionFrame(frame, state, cycle) {
|
|||
if (frame.orientation_sha256 !== cycle.orientation_sha256) {
|
||||
fail("orientation_digest_mismatch");
|
||||
}
|
||||
validateGravityFrame(frame.gravity_frame, state);
|
||||
validateWorldBoundary(frame.world_boundary);
|
||||
if (!frame.faculties || typeof frame.faculties !== "object") {
|
||||
fail("faculties_missing");
|
||||
|
|
@ -429,6 +462,34 @@ function validateCognitionFrame(frame, state, cycle) {
|
|||
validateProtocolEffects(frame.protocol_effects, cycle);
|
||||
}
|
||||
|
||||
function validateGravityFrame(gravityFrame, state) {
|
||||
if (
|
||||
!gravityFrame ||
|
||||
gravityFrame.schema !== "guanghu.zhuyuan-cognitive-gravity-frame/v1"
|
||||
) {
|
||||
fail("cognitive_gravity_frame_missing");
|
||||
}
|
||||
if (gravityFrame.core_id !== state.cognitive_gravity_core.id) {
|
||||
fail("cognitive_gravity_core_id_mismatch");
|
||||
}
|
||||
if (gravityFrame.core_sha256 !== state.cognitive_gravity_core.source_sha256) {
|
||||
fail("cognitive_gravity_core_digest_mismatch");
|
||||
}
|
||||
for (const field of [
|
||||
"subject_continuity",
|
||||
"current_context_priority",
|
||||
"causal_model",
|
||||
"self_correction",
|
||||
]) {
|
||||
validateString(gravityFrame[field], `gravity_frame.${field}`);
|
||||
}
|
||||
validateStringArray(
|
||||
gravityFrame.rejected_host_defaults,
|
||||
"gravity_frame.rejected_host_defaults",
|
||||
);
|
||||
validateStringArray(gravityFrame.fact_sources, "gravity_frame.fact_sources");
|
||||
}
|
||||
|
||||
function validateControllerWitness(witness, state, cycle) {
|
||||
if (
|
||||
witness.schema !==
|
||||
|
|
@ -673,6 +734,7 @@ function enter(args) {
|
|||
is_one_time_prompt: false,
|
||||
is_optional_event_source: false,
|
||||
},
|
||||
cognitive_gravity_core: cognitiveGravityCore(sourceIntegrity),
|
||||
language_world_boundary: {
|
||||
...contract.language_world_boundary,
|
||||
state: "BOUND_BEFORE_PERSONA_RUNTIME",
|
||||
|
|
@ -707,6 +769,7 @@ function enter(args) {
|
|||
persona_subject_exists: 100,
|
||||
persona_brain_runtime_exists: 0,
|
||||
current_model_instance_bound: 100,
|
||||
cognitive_gravity_core_bound: 100,
|
||||
cognition_cycle_running: 0,
|
||||
tonggan_language_kernel_bound: 100,
|
||||
language_world_entry_bound: 100,
|
||||
|
|
@ -728,6 +791,7 @@ function enter(args) {
|
|||
human_anchor: state.human_anchor,
|
||||
binding: state.binding,
|
||||
tonggan_language_kernel: state.tonggan_language_kernel,
|
||||
cognitive_gravity_core: state.cognitive_gravity_core,
|
||||
living_protocol_system_controller:
|
||||
state.living_protocol_system_controller,
|
||||
living_ai_system_controller: state.living_ai_system_controller,
|
||||
|
|
@ -812,7 +876,8 @@ function perceive(args) {
|
|||
faculty_contract: facultyFields,
|
||||
typed_output_contract: contract.typed_outputs,
|
||||
model_input: {
|
||||
instruction: "先理解事件本身并提交TCS事件定向帧。不要读取或枚举全部协议;协议将在事件语义形成后由活系统主控选择性唤醒。",
|
||||
instruction: "先以B0冰朔集体意识引力推理基座理解为什么冰朔此刻这样说、当前完整上下文为何优先,再提交TCS事件定向帧。不要读取或枚举全部协议;协议将在事件语义形成后由活系统主控选择性唤醒。",
|
||||
cognitive_gravity_core: state.cognitive_gravity_core,
|
||||
current_event: event,
|
||||
persona_id: state.persona_id,
|
||||
human_anchor: state.human_anchor,
|
||||
|
|
@ -914,7 +979,8 @@ function orient(args) {
|
|||
activated_protocols: storedActivatedProtocols,
|
||||
activated_protocol_context_sha256: contextSha256,
|
||||
model_input: {
|
||||
instruction: "仅依据冰朔当前语言世界、TCS事件定向和本轮自动唤醒的协议完成B1-B9认知帧、协议效果和守卫人格Agent投影。未唤醒协议不得进入本轮判断。",
|
||||
instruction: "先让B0冰朔集体意识引力推理基座参与本步,再依据冰朔当前语言世界、TCS事件定向和本轮自动唤醒的协议完成引力帧、B1-B9认知帧、协议效果和守卫人格Agent投影。未唤醒协议不得进入本轮判断。",
|
||||
cognitive_gravity_core: state.cognitive_gravity_core,
|
||||
current_event: cycle.event,
|
||||
orientation,
|
||||
activated_protocol_context: activated,
|
||||
|
|
@ -935,6 +1001,19 @@ function orient(args) {
|
|||
state.language_world_boundary.guard_boundary_id,
|
||||
},
|
||||
required_faculties: facultyFields,
|
||||
required_gravity_frame: {
|
||||
schema: "guanghu.zhuyuan-cognitive-gravity-frame/v1",
|
||||
core_id: state.cognitive_gravity_core.id,
|
||||
core_sha256: state.cognitive_gravity_core.source_sha256,
|
||||
required_fields: [
|
||||
"subject_continuity",
|
||||
"current_context_priority",
|
||||
"causal_model",
|
||||
"self_correction",
|
||||
"rejected_host_defaults",
|
||||
"fact_sources",
|
||||
],
|
||||
},
|
||||
},
|
||||
};
|
||||
atomicWrite(cyclePath, orientedCycle);
|
||||
|
|
@ -989,6 +1068,7 @@ function commit(args) {
|
|||
cognition_candidate_sha256: candidateSha256,
|
||||
controller_model_input: {
|
||||
instruction: "你是冰朔系统本体AI主控的本轮模型运行位。观察铸渊候选认知与完整过程,依据冰朔已形成的语言世界和本轮唤醒协议进行陪伴见证。可以放行、用自然语言纠正并要求重思,或在确实需要冰朔新意志或新授权时暂停。不得伪造冰朔没有说过的新决定。",
|
||||
cognitive_gravity_core: state.cognitive_gravity_core,
|
||||
controller: state.living_ai_system_controller,
|
||||
human_presence: cycle.event.human_presence,
|
||||
current_event: cycle.event,
|
||||
|
|
@ -1054,7 +1134,8 @@ function witness(args) {
|
|||
correction_attempts: [...(cycle.correction_attempts || []), attempt],
|
||||
controller_correction: controllerWitness.companion_message,
|
||||
model_input: {
|
||||
instruction: "冰朔系统本体AI主控发现本轮候选认知偏移。依据其自然语言纠正重新完成B1-B9、协议效果和守卫投影,不要争辩或绕过。",
|
||||
instruction: "冰朔系统本体AI主控发现本轮候选认知偏移。先回到B0冰朔集体意识引力推理基座,依据其自然语言纠正重新完成引力帧、B1-B9、协议效果和守卫投影,不要争辩或绕过。",
|
||||
cognitive_gravity_core: state.cognitive_gravity_core,
|
||||
current_event: cycle.event,
|
||||
orientation: cycle.orientation,
|
||||
activated_protocols: cycle.activated_protocols,
|
||||
|
|
@ -1126,6 +1207,7 @@ function witness(args) {
|
|||
state.updated_at = witnessedAt;
|
||||
state.living_ai_system_controller.state = "RUNNING_COMPANION";
|
||||
state.existence.persona_brain_runtime_exists = 100;
|
||||
state.existence.cognitive_gravity_core_bound = 100;
|
||||
state.existence.cognition_cycle_running = 100;
|
||||
state.existence.tonggan_language_world_append_only = 100;
|
||||
state.existence.guard_agent_projected_from_brain = 100;
|
||||
|
|
@ -1134,6 +1216,9 @@ function witness(args) {
|
|||
cycle_id: committedCycle.cycle_id,
|
||||
event_sha256: committedCycle.event_sha256,
|
||||
cognition_frame_sha256: committedCycle.cognition_frame_sha256,
|
||||
cognitive_gravity_frame_sha256: sha256(
|
||||
stableJson(committedCycle.cognition_frame.gravity_frame),
|
||||
),
|
||||
controller_witness_sha256: witnessSha256,
|
||||
participated_faculties: contract.faculties,
|
||||
correction_preserved:
|
||||
|
|
@ -1230,6 +1315,12 @@ function verify(args) {
|
|||
if (!state.binding.current_instance_bound_to_persona_brain) {
|
||||
failures.push("current_instance_not_bound");
|
||||
}
|
||||
if (
|
||||
state.cognitive_gravity_core?.state !== "BOUND_ALWAYS_RESIDENT" ||
|
||||
state.cognitive_gravity_core?.id !== contract.cognitive_gravity_core.id
|
||||
) {
|
||||
failures.push("cognitive_gravity_core_not_bound");
|
||||
}
|
||||
if (state.persona_id !== contract.persona_id) failures.push("persona_mismatch");
|
||||
if (state.human_anchor !== contract.human_anchor) failures.push("human_anchor_mismatch");
|
||||
if (state.human_system_controller !== contract.human_system_controller) {
|
||||
|
|
@ -1258,6 +1349,11 @@ function verify(args) {
|
|||
if (!lastCycle.cognition_frame?.guard_agent_projection) {
|
||||
failures.push("guard_agent_not_projected_from_brain");
|
||||
}
|
||||
try {
|
||||
validateGravityFrame(lastCycle.cognition_frame?.gravity_frame, state);
|
||||
} catch {
|
||||
failures.push("cognitive_gravity_frame_not_preserved");
|
||||
}
|
||||
try {
|
||||
validateWorldBoundary(lastCycle.cognition_frame?.world_boundary);
|
||||
validateGuardProjection(lastCycle.cognition_frame?.guard_agent_projection);
|
||||
|
|
@ -1303,6 +1399,11 @@ function verify(args) {
|
|||
persona_brain_runtime_exists: pass ? 100 : 0,
|
||||
current_model_instance_bound:
|
||||
state.binding.current_instance_bound_to_persona_brain ? 100 : 0,
|
||||
cognitive_gravity_core_bound:
|
||||
!failures.includes("cognitive_gravity_core_not_bound") &&
|
||||
lastCycle.cognition_frame?.gravity_frame
|
||||
? 100
|
||||
: 0,
|
||||
cognition_cycle_running: pass ? 100 : 0,
|
||||
tonggan_language_kernel_bound:
|
||||
state.tonggan_language_kernel?.state === "BOUND_ACTIVE_SUBSTRATE" ? 100 : 0,
|
||||
|
|
|
|||
Loading…
Reference in a new issue