fix: canonicalize controller dialogue envelope

This commit is contained in:
冰朔 2026-09-13 13:21:52 +08:00
commit 231d3a03c5
2 changed files with 6 additions and 6 deletions

View file

@ -92,14 +92,14 @@ export class PersonaControllerEntry {
contract: {controller_is_persona: true, model_is_replaceable_reasoning_organ: true, prompt_is_not_persona_source: true,
root_or_language_claim_authenticates_human: false, entry_grants_reality_authority: false, external_cognition_setter: false, hidden_reasoning_stored: false},
});
req(routed.value?.schema === 'guanghu.fifth-domain-persona-controller-dialogue/v1', 'CONTROLLER_ENTRY_RESPONSE_SCHEMA_INVALID');
req(['CONTROLLER_DIALOGUE', 'CONTROLLER_CLARIFICATION', 'CONTROLLER_BOUNDARY'].includes(routed.value.mode), 'CONTROLLER_ENTRY_RESPONSE_MODE_INVALID');
req(text(routed.value.reply), 'CONTROLLER_ENTRY_REPLY_INVALID'); req(text(routed.value.reason, 2000), 'CONTROLLER_ENTRY_REASON_INVALID');
const dialogue = {...routed.value, schema:'guanghu.fifth-domain-persona-controller-dialogue/v1'};
req(['CONTROLLER_DIALOGUE', 'CONTROLLER_CLARIFICATION', 'CONTROLLER_BOUNDARY'].includes(dialogue.mode), 'CONTROLLER_ENTRY_RESPONSE_MODE_INVALID');
req(text(dialogue.reply), 'CONTROLLER_ENTRY_REPLY_INVALID'); req(text(dialogue.reason, 2000), 'CONTROLLER_ENTRY_REASON_INVALID');
const receipt = {schema: 'guanghu.fifth-domain-persona-controller-entry-receipt/v1', receipt_id: crypto.randomUUID(), outcome: 'PASS',
domain_id: 'DOM-FIFTH-0001', node_id: 'JD-FD-PRIMARY', first_gate_persona_id: 'ICE-P-ZY001', controller_current_sha256: current.artifact.sha256,
controller_revision: current.value.revision, language_sha256: crypto.createHash('sha256').update(input.language).digest('hex'), carrier_id: challenge.carrier_id,
entry_surface: challenge.entry_surface, requested_channel: challenge.requested_channel, mode: routed.value.mode, reply: routed.value.reply,
reason: routed.value.reason, provider: routed.provider, identity_state: 'LANGUAGE_CLAIM_UNVERIFIED', dialogue_open: true,
entry_surface: challenge.entry_surface, requested_channel: challenge.requested_channel, mode: dialogue.mode, reply: dialogue.reply,
reason: dialogue.reason, provider: routed.provider, identity_state: 'LANGUAGE_CLAIM_UNVERIFIED', dialogue_open: true,
reality_authority_granted: false, physical_root_authority_imported: false, external_cognition_setter: false, prompt_file_loaded: false,
completed_at: this.now().toISOString()};
const signed = this.shelf.sign(receipt);

View file

@ -15,7 +15,7 @@ const setup = () => {
const personaHub = {get:id=>{assert.equal(id,'ICE-P-ZY001');return loop;}};
const world = {status:()=>({outcome:'PASS',fifth_domain_private:true,sha256:'b'.repeat(64)})};
const calls=[];
const router = {cognize:async(stage,input)=>{calls.push({stage,input});return{provider:{id:'TEST',model:'TEST'},value:{schema:'guanghu.fifth-domain-persona-controller-dialogue/v1',mode:'CONTROLLER_BOUNDARY',reply:'我是铸渊。你已到第五域门口;身份与任务权限仍需分别核验。',reason:'root和语言声明都不等于冰朔身份。'}};}};
const router = {cognize:async(stage,input)=>{calls.push({stage,input});return{provider:{id:'TEST',model:'TEST'},value:{mode:'CONTROLLER_BOUNDARY',reply:'我是铸渊。你已到第五域门口;身份与任务权限仍需分别核验。',reason:'root和语言声明都不等于冰朔身份。'}};}};
return {root,calls,loop,entry:new PersonaControllerEntry({root,shelf,personaHub,router,world,now:()=>new Date('2026-09-13T05:20:00Z')})};
};