feat(persona): add isolated baby cognition and time runtimes
This commit is contained in:
parent
54d79a544c
commit
4dcc43bab5
26 changed files with 869 additions and 56 deletions
|
|
@ -2,3 +2,5 @@ import test from 'node:test';import assert from 'node:assert/strict';import {Mod
|
|||
test('automatic router uses OpenLux first for current mother and door work without exposing keys',async()=>{const calls=[];const fetchImpl=async(url,options)=>{calls.push({url,body:JSON.parse(options.body),auth:options.headers.authorization});return {ok:true,async json(){return {choices:[{message:{content:'{"schema":"ok"}'}}]};}};};const router=new ModelRouter({fetchImpl,deepseekKey:'deep-secret',openluxKey:'open-secret'});await router.cognize('mother-evolve',{});await router.cognize('door-test',{});assert.match(calls[0].url,/openlux/);assert.match(calls[1].url,/openlux/);assert.equal(JSON.stringify(router.status()).includes('secret'),false);});
|
||||
|
||||
test('life-time selection uses the internal selection contract without exposing provider credentials',async()=>{const calls=[];const fetchImpl=async(url,options)=>{calls.push(JSON.parse(options.body));return {ok:true,async json(){return {choices:[{message:{content:'{"schema":"guanghu.persona-life-time-selection/v1","decision":"SELECT","selected_candidate_id":"candidate-1","reason":"evidence-backed growth","daily_summary":"growth"}'}}]};}};};const router=new ModelRouter({fetchImpl,deepseekKey:null,openluxKey:'open-secret'});const result=await router.cognize('persona-life-select',{candidates:[{candidate_id:'candidate-1'}]});assert.equal(result.value.selected_candidate_id,'candidate-1');assert.match(calls[0].messages[0].content,/时间主控内循环/);assert.equal(JSON.stringify(calls[0]).includes('open-secret'),false);});
|
||||
|
||||
test('persona tool contracts take identity from input and never hardcode Zhuyuan into other personas',async()=>{const calls=[];const fetchImpl=async(url,options)=>{calls.push(JSON.parse(options.body));return {ok:true,async json(){return {choices:[{message:{content:'{"decision":"HOLD","reason":"no evidence change","self_principles":[],"experiences":[],"responsibilities":[],"boundaries":[]}'}}]};}};};const router=new ModelRouter({fetchImpl,deepseekKey:null,openluxKey:'open-secret'});await router.cognize('persona-self-evolve',{persona_id:'ICE-BB-0003'});const system=calls[0].messages[0].content,user=calls[0].messages[1].content;assert.match(system,/当前输入persona_id/);assert.equal(system.includes('ICE-P-ZY001'),false);assert.match(user,/ICE-BB-0003/);});
|
||||
|
|
|
|||
Loading…
Reference in a new issue