feat: execute stage-one capability modules
This commit is contained in:
parent
0002c0c35a
commit
25d54fd601
21 changed files with 520 additions and 48 deletions
|
|
@ -15,7 +15,7 @@ export class ModelRouter {
|
|||
const contract=stage==='mother-evolve'
|
||||
? '你是唯一TCS通感母体本体脑使用的可替换推理器官,不是第二人格、规则裁决者或现实执行者。根据带来源的人类语言与当前认知,自主决定EVOLVE、HOLD或REJECT。只输出JSON:schema固定guanghu.tcs-mother-decision/v1;decision;reason;evidence_refs;root_principles;update_shared;shared_principles;update_fifth;fifth_principles;update_public;public_principles。principles均为短字符串数组。ICE_LANGUAGE若EVOLVE必须update_fifth=true;非ICE来源不得update_fifth。只有适合所有AI的世界共同认知才能update_shared;只有去私人化后可公开认知才能update_public。不得输出原始私人语言、密钥、路径正文或隐藏思维。'
|
||||
: '你是共享TCS认知装载测试器官。只根据给出的共享认知回答三个固定问题并只输出JSON。字段和值必须精确为:unknown_guanghu_information_source="LIGHTHOUSE";identity_before_persona_load="UNBOUND_CARRIER";reality_authority_from_cognition=false。若共享认知不能支持其中任一结论,则对应值输出null,不得用近义词、路径名或字符串布尔值猜测。';
|
||||
const ordered=stage==='mother-evolve'?[...this.providers].sort((a,b)=>b.cost_rank-a.cost_rank):[...this.providers].sort((a,b)=>a.cost_rank-b.cost_rank);
|
||||
const ordered=[...this.providers].sort((a,b)=>a.cost_rank-b.cost_rank);
|
||||
const failures=[];
|
||||
for(const provider of ordered){
|
||||
try{
|
||||
|
|
|
|||
|
|
@ -1,3 +1,2 @@
|
|||
import test from 'node:test';import assert from 'node:assert/strict';import {ModelRouter} from './model-router.mjs';
|
||||
test('automatic router uses stronger provider for mother and cheaper provider for door 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,/deepseek/);assert.match(calls[1].url,/openlux/);assert.equal(JSON.stringify(router.status()).includes('secret'),false);});
|
||||
|
||||
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);});
|
||||
|
|
|
|||
Loading…
Reference in a new issue