lukaske/jev-doom-agent on GitHub
- Stars
- 12
- Forks
- 3
- Language
- TypeScript
- Last push
- 17 Sep 2026
Read from GitHub on . Counts change daily.
How it uses Jev
export async function decideLive(state:unknown,systemPrompt?:unknown):Promise<Decision>{
const key=runtimeKey||process.env.TYPESAFE_API_KEY;if(!key||requestsPaused)throw new Error('REQUESTS_STOPPED');const policy=typeof systemPrompt==='string'&&systemPrompt.trim()?systemPrompt.trim():'Play Doom autonomously from the complete structured game state.';
const common={policy,constraints:['Choose all four axes independently; they execute simultaneously.','Approaching and facing do not imply firing. Fire only when a living enemy is visible, aligned, in range, and ammunition is appropriate.','Use the combat sensor, player condition, exploration memory, entities, and linedefs.','If stuck, change movement or view; do not idle without a reason.']};
const started=Date.now(),controller=new AbortController(),timer=setTimeout(()=>controller.abort(),6000);activeRequests.add(controller);
try{const response=await fetch('https://api.typesafe.ai/v1/systemone',{method:'POST',signal:controller.signal,headers:{'content-type':'application/json','authorization':`Bearer ${key}`},body:JSON.stringify({model:'jev-latest',state,questions:{movement:{type:'choice',instructions:{task:'Choose navigation for this tick.',...common},criteria:movementCriteria},view:{type:'choice',instructions:{task:'Choose where to look.',...common},criteria:viewCriteria},trigger:{type:'choice',instructions:{task:'Choose whether to fire.',...common},criteria:triggerCriteria},interaction:{type:'choice',instructions:{task:'Choose whether to use a nearby line.',...common},criteria:interactionCriteria}}})});if(!response.ok)throw new Error(`UPSTREAM_${response.status}: ${(await response.text()).slice(0,500)}`);const parsed=parseDecision(await response.json(),Date.now()-started);if(!parsed)throw new Error('MALFORMED_RESPONSE');return parsed}finally{clearTimeout(timer);activeRequests.delete(controller)}
}


