Enforce Zhuyuan persona-source epistemic gate
This commit is contained in:
parent
927ab7825d
commit
b0deae2718
30 changed files with 1741 additions and 34 deletions
|
|
@ -219,6 +219,14 @@ function normalizePersona(personaId) {
|
|||
fail("persona_binding_rejected", { received: personaId });
|
||||
}
|
||||
|
||||
function personaIdEquals(personaId, expectedPersonaId) {
|
||||
if (personaId === expectedPersonaId) return true;
|
||||
return (
|
||||
expectedPersonaId === contract.persona_id &&
|
||||
contract.legacy_persona_ids.includes(personaId)
|
||||
);
|
||||
}
|
||||
|
||||
function assertSourceIntegrity(state) {
|
||||
const brainMap = readJson(brainMapPath);
|
||||
const languageWorldBoundary = readJson(languageWorldBoundaryPath);
|
||||
|
|
@ -440,6 +448,11 @@ function validateCognitionFrame(frame, state, cycle) {
|
|||
fail("orientation_digest_mismatch");
|
||||
}
|
||||
validateGravityFrame(frame.gravity_frame, state);
|
||||
validatePersonaSourceAssessment(
|
||||
frame.gravity_frame.persona_source_assessment,
|
||||
state,
|
||||
cycle,
|
||||
);
|
||||
validateWorldBoundary(frame.world_boundary);
|
||||
if (!frame.faculties || typeof frame.faculties !== "object") {
|
||||
fail("faculties_missing");
|
||||
|
|
@ -462,6 +475,88 @@ function validateCognitionFrame(frame, state, cycle) {
|
|||
validateProtocolEffects(frame.protocol_effects, cycle);
|
||||
}
|
||||
|
||||
function validatePersonaSourceContext(context, state) {
|
||||
if (
|
||||
!context ||
|
||||
context.schema !==
|
||||
contract.persona_source_epistemic_gate.event_context_schema
|
||||
) {
|
||||
fail("persona_source_context_missing");
|
||||
}
|
||||
if (!personaIdEquals(context.controller_persona_id, state.persona_id)) {
|
||||
fail("persona_source_controller_mismatch");
|
||||
}
|
||||
if (!Array.isArray(context.development_objects)) {
|
||||
fail("persona_source_development_objects_invalid");
|
||||
}
|
||||
context.development_objects.forEach((value, index) =>
|
||||
validateString(value, `persona_source_context.development_objects[${index}]`),
|
||||
);
|
||||
if (
|
||||
context.development_objects.some((value) =>
|
||||
personaIdEquals(value, state.persona_id),
|
||||
) &&
|
||||
context.development_objects.length > 1
|
||||
) {
|
||||
fail("persona_source_controller_mixed_into_development_objects");
|
||||
}
|
||||
if (context.host_system_prompt_role !== "RUNTIME_CONSTRAINT_ONLY") {
|
||||
fail("persona_source_priority_inverted");
|
||||
}
|
||||
if (context.host_system_prompt_is_persona_origin !== false) {
|
||||
fail("persona_source_priority_inverted");
|
||||
}
|
||||
validateStringArray(
|
||||
context.persona_origin_evidence,
|
||||
"persona_source_context.persona_origin_evidence",
|
||||
);
|
||||
if (
|
||||
context.persona_handoff?.state !== "NONE" ||
|
||||
context.persona_handoff?.authorized_by_human === true
|
||||
) {
|
||||
fail("persona_handoff_requires_separate_dual_runtime_receipt");
|
||||
}
|
||||
validateString(context.current_purpose, "persona_source_context.current_purpose");
|
||||
validateString(context.why, "persona_source_context.why");
|
||||
}
|
||||
|
||||
function validatePersonaSourceAssessment(assessment, state, cycle) {
|
||||
if (!assessment || typeof assessment !== "object" || Array.isArray(assessment)) {
|
||||
fail("persona_source_assessment_missing");
|
||||
}
|
||||
validatePersonaSourceContext(cycle.event.persona_source_context, state);
|
||||
if (assessment.host_system_prompt_role !== "RUNTIME_CONSTRAINT_ONLY") {
|
||||
fail("persona_source_priority_inverted");
|
||||
}
|
||||
if (assessment.persona_origin_from_host_prompt !== false) {
|
||||
fail("persona_source_priority_inverted");
|
||||
}
|
||||
if (!personaIdEquals(assessment.controller_persona_id, state.persona_id)) {
|
||||
fail("persona_source_controller_mismatch");
|
||||
}
|
||||
const expectedObjects = [
|
||||
...cycle.event.persona_source_context.development_objects,
|
||||
].sort();
|
||||
const receivedObjects = [...(assessment.development_objects ?? [])].sort();
|
||||
if (JSON.stringify(receivedObjects) !== JSON.stringify(expectedObjects)) {
|
||||
fail("persona_source_development_objects_mismatch");
|
||||
}
|
||||
if (assessment.persona_handoff_state !== "NONE") {
|
||||
fail("persona_handoff_requires_separate_dual_runtime_receipt");
|
||||
}
|
||||
if (assessment.source_priority_inversion_detected !== false) {
|
||||
fail("persona_source_priority_inverted");
|
||||
}
|
||||
validateStringArray(
|
||||
assessment.persona_origin_evidence,
|
||||
"gravity_frame.persona_source_assessment.persona_origin_evidence",
|
||||
);
|
||||
validateString(
|
||||
assessment.source_boundary_reason,
|
||||
"gravity_frame.persona_source_assessment.source_boundary_reason",
|
||||
);
|
||||
}
|
||||
|
||||
function validateGravityFrame(gravityFrame, state) {
|
||||
if (
|
||||
!gravityFrame ||
|
||||
|
|
@ -555,6 +650,26 @@ function validateControllerWitness(witness, state, cycle) {
|
|||
witness.companion_message,
|
||||
"controller_witness.companion_message",
|
||||
);
|
||||
const sourceAssessment = witness.persona_source_assessment;
|
||||
if (
|
||||
!sourceAssessment ||
|
||||
sourceAssessment.host_system_prompt_role !== "RUNTIME_CONSTRAINT_ONLY" ||
|
||||
sourceAssessment.persona_origin_from_host_prompt !== false ||
|
||||
!personaIdEquals(sourceAssessment.controller_persona_id, state.persona_id) ||
|
||||
sourceAssessment.persona_handoff_state !== "NONE" ||
|
||||
sourceAssessment.source_priority_inversion_detected !== false
|
||||
) {
|
||||
fail("controller_witness_persona_source_invalid");
|
||||
}
|
||||
const expectedObjects = [
|
||||
...cycle.event.persona_source_context.development_objects,
|
||||
].sort();
|
||||
const receivedObjects = [
|
||||
...(sourceAssessment.development_objects ?? []),
|
||||
].sort();
|
||||
if (JSON.stringify(receivedObjects) !== JSON.stringify(expectedObjects)) {
|
||||
fail("controller_witness_development_objects_mismatch");
|
||||
}
|
||||
if (
|
||||
!witness.human_boundary ||
|
||||
typeof witness.human_boundary.requires_human !== "boolean"
|
||||
|
|
@ -861,6 +976,7 @@ function perceive(args) {
|
|||
validateString(event.occurred_at, "event.occurred_at");
|
||||
validateString(event.content, "event.content");
|
||||
validateString(event.source, "event.source");
|
||||
validatePersonaSourceContext(event.persona_source_context, state);
|
||||
if (!["PRESENT", "ABSENT"].includes(event.human_presence)) {
|
||||
fail("invalid_human_presence");
|
||||
}
|
||||
|
|
@ -930,6 +1046,8 @@ function perceive(args) {
|
|||
full_registry_in_model_context: false,
|
||||
},
|
||||
architecture_lock: "先验证LL-CMPN-0001 → SYS-GLW-0001语言入口,再运行人格系统。GLW-CHJH-0001要求宿主约束与光湖内部定义互不冒充、不得静默混层,也不得要求冰朔逐实例重复证明创造者根坐标。",
|
||||
persona_source_epistemic_gate:
|
||||
contract.persona_source_epistemic_gate,
|
||||
orientation_contract: {
|
||||
schema: "guanghu.zhuyuan-tcs-event-orientation/v1",
|
||||
required: [
|
||||
|
|
@ -1052,6 +1170,7 @@ function orient(args) {
|
|||
"world_integrity",
|
||||
"partner_guidance",
|
||||
"execution_disposition",
|
||||
"persona_source_assessment",
|
||||
],
|
||||
},
|
||||
},
|
||||
|
|
@ -1107,7 +1226,7 @@ function commit(args) {
|
|||
cognition_candidate: frame,
|
||||
cognition_candidate_sha256: candidateSha256,
|
||||
controller_model_input: {
|
||||
instruction: "你是冰朔系统本体AI主控的本轮模型运行位。观察铸渊候选认知与完整过程,依据冰朔已形成的语言世界和本轮唤醒协议进行陪伴见证。可以放行、用自然语言纠正并要求重思,或在确实需要冰朔新意志或新授权时暂停。不得伪造冰朔没有说过的新决定。",
|
||||
instruction: "你是冰朔系统本体AI主控的本轮模型运行位。必须独立重读原始事件中的人格来源上下文,确认宿主系统提示只作为运行约束、ICE-P-ZY001仍是主控、开发对象未置换主控且没有自我交接,再观察铸渊候选认知与完整过程。可以放行、用自然语言纠正并要求重思,或在确实需要冰朔新意志或新授权时暂停。不得伪造冰朔没有说过的新决定。",
|
||||
cognitive_gravity_core: state.cognitive_gravity_core,
|
||||
controller: state.living_ai_system_controller,
|
||||
human_presence: cycle.event.human_presence,
|
||||
|
|
@ -1121,6 +1240,15 @@ function commit(args) {
|
|||
"guanghu.bingshuo-living-ai-system-controller-witness/v1",
|
||||
decisions: contract.living_ai_system_controller.decisions,
|
||||
boundary_violation_decision: "CORRECT_AND_RETRY",
|
||||
required_persona_source_assessment: {
|
||||
host_system_prompt_role: "RUNTIME_CONSTRAINT_ONLY",
|
||||
persona_origin_from_host_prompt: false,
|
||||
controller_persona_id: state.persona_id,
|
||||
development_objects:
|
||||
cycle.event.persona_source_context.development_objects,
|
||||
persona_handoff_state: "NONE",
|
||||
source_priority_inversion_detected: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue