feat(persona): add signed native organ reflex per baby
This commit is contained in:
parent
78a875a72f
commit
3583321c91
12 changed files with 412 additions and 9 deletions
|
|
@ -2,6 +2,7 @@ import fs from 'node:fs';
|
|||
import path from 'node:path';
|
||||
import crypto from 'node:crypto';
|
||||
import {PersonaSelfLoop} from './persona-self-loop.mjs';
|
||||
import {PersonaOrganReflex} from './persona-organ-reflex.mjs';
|
||||
|
||||
const req = (value, code) => { if (!value) throw Error(code); };
|
||||
const strings = value => Array.isArray(value) ? value.filter(item => typeof item === 'string' && item.trim()).slice(0, 40) : [];
|
||||
|
|
@ -83,12 +84,15 @@ export class PersonaRuntimeHub {
|
|||
req(profile.selfPrinciples.length > 0, 'PERSONA_RUNTIME_IDENTITY_SEED_MISSING');
|
||||
const loop = new PersonaSelfLoop({root: this.root, shelf: this.shelf, router: this.router, personaId: entry.persona_id, now: this.now,
|
||||
requireLifeLine: this.requireLifeLine, lifeTimeBootstrapPath: this.resolve(entry.life_time_bootstrap), profile});
|
||||
this.loops.set(entry.persona_id, {entry, loop});
|
||||
const organ=new PersonaOrganReflex({root:this.root,personaId:entry.persona_id,shelf:this.shelf,sourcePaths:[this.resolve(entry.self_kernel),memoryPath,...(isBaby?[this.bottleEnvironmentPath]:[])],now:this.now});
|
||||
organ.selfTest();loop.profile.organHealthProvider=()=>organ.status();
|
||||
this.loops.set(entry.persona_id, {entry, loop, organ});
|
||||
}
|
||||
|
||||
ids() { return [...this.loops.keys()]; }
|
||||
has(personaId) { return this.loops.has(personaId); }
|
||||
get(personaId) { const found = this.loops.get(personaId); req(found, 'PERSONA_RUNTIME_NOT_INSTALLED'); return found.loop; }
|
||||
organ(personaId) { const found=this.loops.get(personaId);req(found,'PERSONA_RUNTIME_NOT_INSTALLED');return found.organ; }
|
||||
|
||||
admitEvent(personaId, event) {
|
||||
const found = this.loops.get(personaId);
|
||||
|
|
@ -119,7 +123,7 @@ export class PersonaRuntimeHub {
|
|||
default_persona: null,
|
||||
shared_engine_is_shared_persona_brain: false,
|
||||
external_cognition_setter: false,
|
||||
personas: Object.fromEntries(this.ids().map(id => [id, this.get(id).status()])),
|
||||
personas: Object.fromEntries(this.ids().map(id => [id, {...this.get(id).status(),organ_health:this.organ(id).status()}])),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue