okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
7c4b3d743
main
1/** What a saved tuning changes in the engine's start-up flags (GET /api/native/models/<id>/settings -> tuned.changed), as the Expert mode fields show it. */ 2export interface TunedChange { flag :string ; was :string | null ; now :string | null } 3export interface TunedFields { kv ?:string ; lowRam ?:'auto' | 'resident' | 'mmap' ; vramReserveMib ?:number } 4 5export function tunedFields ( changed :TunedChange [] | undefined | null ) :TunedFields { 6const out :TunedFields = {}; 7for ( const c of changed ?? []) { 8if ( c . flag === '--kv' && c . now ) out . kv = c . now ; 9else if ( c . flag === '--resident-experts' ) out . lowRam = c . now !== null ?'resident' :c . was !== null ?'auto' :out . lowRam ; 10else if ( c . flag === '--mmap-experts' ) out . lowRam = c . now !== null ?'mmap' :c . was !== null ?'auto' :out . lowRam ; 11else if ( c . flag === '--vram-reserve-mib' && c . now !== null && Number . isFinite ( Number ( c . now ))) out . vramReserveMib = Number ( c . now ); 12} 13return out ; 14} 15 16/** "--spec 6 (was 4)" for the list of what the tuning changed. */ 17export function describeChange ( c :TunedChange ) :{ name :string ; now :string ; was :string | null } { 18return { name :c . flag . replace ( / ^-- / , '' ). replace ( / - / g , ' ' ), now :c . now ?? '' , was :c . was }; 19}