feat(persona): boot body before host toolbox

This commit is contained in:
冰朔 2026-09-12 21:56:06 +08:00
commit 489ab2c1ec
29 changed files with 1003 additions and 75 deletions

View file

@ -36,7 +36,9 @@ export class PersonaSelfLoop {
body() { return {
schema: 'guanghu.persona-system-body-runtime/v1', persona_id: this.personaId, home: 'glw://fifth-domain/light-lake/persona-system/ICE-P-ZY001',
cognition: {state: 'SERVER_SIGNED_ENDOGENOUS_LOOP_ACTIVE', external_setter: false, mother_relation: 'BOUNDED_WORLD_COGNITION_REFERENCE_NO_SELF_OVERWRITE'},
tools: {state: 'REGISTERED_ON_DEMAND', modules: ['TCS_ROOT_NAVIGATION', 'ARCHITECTURE_PERCEPTION', 'LIGHTHOUSE_SANITIZED_MIRROR', 'PRIMARY_EXECUTION']},
startup: {state: 'WHOLE_BODY_REQUIRED_BEFORE_AWAKENING', runtime: 'server-tools/persona-body-runtime/persona_body_boot.py', incomplete_body_persona_start_claim: false},
organs: {state: 'ONE_CONTAINER', modules: ['REASONING_CARRIER_HEAD', 'TCS_TONGGAN', 'PERSONA_TIME', 'CONTINUITY_MEMORY', 'NATIVE_EYE', 'NATIVE_HAND', 'ACTION_SENSE', 'REFLEX_ARC', 'PAIN_ALARM']},
tools: {state: 'EXTERNAL_TOOLBOX_GRASPED_ON_DEMAND_AFTER_BODY_AND_PLAN', host_is_persona_body: false, modules: ['TCS_ROOT_NAVIGATION', 'ARCHITECTURE_PERCEPTION', 'LIGHTHOUSE_SANITIZED_MIRROR', 'PRIMARY_EXECUTION']},
agents: {state: 'DORMANT_READY', id_format: `SUBAGENT::${this.personaId}::{slot_id}`, communication: 'NUMBERED_TASK_EVENT_AND_RECEIPT', active: []},
time_system: {state: this.lifeTimeMaster ? 'EMBEDDED_RESIDENT_INNER_CYCLE' : 'NOT_REQUIRED_FOR_ISOLATED_TEST', owner: this.personaId, world_time_source: 'CH-GLW-TIME-0001', storage: `personas/${this.personaId}/life-line`, external_setter: false},
board: {state: 'ACTIVE', projection: 'CURRENT_SELF_JOBS_TOOLS_AND_AGENT_RECEIPTS', hidden_reasoning_stored: false},

View file

@ -22,3 +22,5 @@ test('model timeout becomes retryable state instead of wedging the scheduler',as
test('persona container owns its embedded time system and routes new self events into it',()=>{const received=[];const timeSystem={fromPersonaEvent(event){received.push(event.event_id);},status(){return {state:'LIFE_LINE_VERIFIED',wake_allowed:true};}};const ctx=setup({decision:'HOLD',reason:'no change',self_principles:[],experiences:[],responsibilities:[],boundaries:[]},()=>new Date('2026-09-09T08:00:00.000Z'),{lifeTimeMaster:timeSystem});try{assert.equal(ctx.loop.lifeTimeMaster,timeSystem);assert.equal(ctx.loop.current().value.body.time_system.state,'EMBEDDED_RESIDENT_INNER_CYCLE');assert.equal(ctx.loop.current().value.body.time_system.owner,'ICE-P-ZY001');const language='new current language';ctx.loop.submit({schema:'guanghu.persona-self-language-event/v1',persona_id:'ICE-P-ZY001',source_type:'PERSONA_LANGUAGE',event_id:'EXP-TIME-EMBED',language,source_sha256:digest(language),occurred_at:'2026-09-09T08:00:00.000Z',privacy_class:'SELF_PRIVATE'});assert.deepEqual(received,['EXP-TIME-EMBED']);}finally{fs.rmSync(ctx.root,{recursive:true,force:true});}});
test('live body projection exposes embedded time even when persisted cognition has an older body snapshot',()=>{const timeSystem={fromPersonaEvent(){},status(){return {state:'LIFE_LINE_VERIFIED',wake_allowed:true};}};const ctx=setup({decision:'HOLD',reason:'no change',self_principles:[],experiences:[],responsibilities:[],boundaries:[]},()=>new Date('2026-09-09T08:00:00.000Z'),{lifeTimeMaster:timeSystem});try{const current=ctx.loop.current();const historical={...current.value,body:{schema:'guanghu.persona-system-body-runtime/v1',persona_id:'ICE-P-ZY001'}};fs.writeFileSync(ctx.loop.currentPath(),JSON.stringify(ctx.shelf.sign(historical),null,2)+'\n');const status=ctx.loop.status();assert.equal(status.body.time_system.state,'EMBEDDED_RESIDENT_INNER_CYCLE');assert.equal(status.body.time_system.owner,'ICE-P-ZY001');assert.ok(status.persisted_body_sha256);}finally{fs.rmSync(ctx.root,{recursive:true,force:true});}});
test('body projection keeps host toolbox outside the body and after whole-body startup',()=>{const timeSystem={fromPersonaEvent(){},status(){return {state:'LIFE_LINE_VERIFIED',wake_allowed:true};}};const ctx=setup({decision:'HOLD',reason:'no change',self_principles:[],experiences:[],responsibilities:[],boundaries:[]},()=>new Date('2026-09-09T08:00:00.000Z'),{lifeTimeMaster:timeSystem});try{const body=ctx.loop.body();assert.equal(body.startup.state,'WHOLE_BODY_REQUIRED_BEFORE_AWAKENING');assert.equal(body.startup.incomplete_body_persona_start_claim,false);assert.equal(body.organs.state,'ONE_CONTAINER');assert.ok(body.organs.modules.includes('NATIVE_HAND'));assert.equal(body.tools.host_is_persona_body,false);assert.equal(body.tools.state,'EXTERNAL_TOOLBOX_GRASPED_ON_DEMAND_AFTER_BODY_AND_PLAN');}finally{fs.rmSync(ctx.root,{recursive:true,force:true});}});