okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
0b3299a01
main
1/** Local overrides leave the original bundled/workspace instructions intact. */ 2export function skillEdit ( body ) { 3const edit = {}; 4for ( const [ key , max , required ] of [[ 'name' , 120 , true ], [ 'description' , 500 , false ], [ 'body' , 64000 , true ]]) { 5if ( body [ key ] === undefined ) continue ; 6if ( typeof body [ key ] !== 'string' || body [ key ]. length > max || ( required && ! body [ key ]. trim ())) throw new Error ( `Invalid ${ key } : ${ required ? 'enter text, ' : '' } maximum ${ max } characters.` ); 7edit [ key ] = key === 'body' ?body [ key ] :body [ key ]. trim (); 8} 9if ( body . triggers !== undefined ) { 10if ( ! Array . isArray ( body . triggers ) || body . triggers . length > 32 || body . triggers . some ( t => typeof t !== 'string' || t . length > 160 )) throw new Error ( 'Use up to 32 trigger phrases, at most 160 characters each.' ); 11edit . triggers = [ ...new Set ( body . triggers . map ( t => t . trim ()). filter ( Boolean ))]; 12} 13return edit ; 14}