okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
425bca719
main
1import test from 'node:test' ; 2import assert from 'node:assert/strict' ; 3import { engineProgressMark } from '../server/agent/engine-progress.mjs' ; 4import { readFileSync } from 'node:fs' ; 5 6test ( 'the mark moves with the prompt read and with generation, and is null when the engine is idle or silent' , () => { 7const at = live => engineProgressMark ({ metrics :{ live} }); 8assert . equal ( engineProgressMark ( null ), null ); 9assert . equal ( engineProgressMark ({ metrics :null }), null ); 10assert . equal ( at ({ state :'idle' }), null ); 11assert . equal ( at ({ state :'unloaded' }), null ); 12const a = at ({ state :'reading' , prompt_read :4096 , prompt_total :90000 }); 13const b = at ({ state :'reading' , prompt_read :8192 , prompt_total :90000 }); 14assert . notEqual ( a , b ); 15assert . equal ( a , at ({ state :'reading' , prompt_read :4096 , prompt_total :90000 }), 'no progress, same mark' ); 16assert . notEqual ( at ({ state :'generating' , generated :1 }), at ({ state :'generating' , generated :2 })); 17assert . notEqual ( at ({ state :'reading' , slots :[{ state :'reading' , prompt_read :1 }] }), at ({ state :'reading' , slots :[{ state :'reading' , prompt_read :2 }] })); 18}); 19 20test ( 'the host wires it in and the local profile lifts the 300 s stream-idle timer' , () => { 21assert . match ( readFileSync ( new URL ( '../server/index.mjs' , import . meta. url ), 'utf8' ), / engineProgress: instanceId => engineProgressMark\( / ); 22assert . match ( readFileSync ( new URL ( '../server/agent/profile.mjs' , import . meta. url ), 'utf8' ), / streamIdleTimeoutMs: 60 \* 60_000 / ); 23});