Ground bot intentions in live game knowledge and verify outcomes
Core tests / core (push) Successful in 28s

This commit is contained in:
Codex
2026-09-25 13:28:03 +08:00
parent 20ccd0fced
commit 502cb1e4fd
17 changed files with 251 additions and 24 deletions
+2 -2
View File
@@ -11,7 +11,7 @@ export type BrainRoute={
function survivalDecision(bot:Bot,observation:Observation){
const w=bot.world;
if(w&&Date.now()/1000-w.at<90&&typeof w.healthPct==='number'&&w.healthPct<85&&bot.personality.activities.includes('rest')&&observation.availableActions.includes('rest'))
if(w&&Date.now()/1000-w.at>=0&&Date.now()/1000-w.at<90&&typeof w.healthPct==='number'&&(w.healthPct<85||(typeof w.manaPct==='number'&&w.manaPct<35))&&bot.personality.activities.includes('rest')&&observation.availableActions.includes('rest'))
return {action:'rest' as const,goal:'Recover before risking another fight.',reason:'Staying alive comes before my task. I need to recover and reassess the danger.'};
return null;
}
@@ -54,7 +54,7 @@ export class LocalLLMProvider implements LLMProvider {
content:JSON.stringify({
identity:{name:bot.name,race:bot.race,role:bot.role,tier:bot.tier},
home:bot.homeId??null,
safety:{healthPercent:bot.world?.healthPct??null,observedAt:bot.world?.at??null,inCombat:bot.world?.inCombat??null,nearbyCompanions:bot.world?.nearby??[],lastSurvivalAction:bot.world?.survivalAction??null},
safety:bot.world&&Date.now()/1000-bot.world.at<90?{manaPercent:bot.world.manaPct??null,healthPercent:bot.world?.healthPct??null,observedAt:bot.world?.at??null,inCombat:bot.world?.inCombat??null,nearbyCompanions:bot.world?.nearby??[],lastSurvivalAction:bot.world?.survivalAction??null}:null,
personality:bot.personality,
goal:bot.goal,
memories:[...bot.memories].sort((a,b)=>b.importance-a.importance).slice(0,memoryLimit),