okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
f31abf7bd
main
1/** 2* 0.2.10: the agent's system prompt says which computer it is on, so a model on Windows does not spend its first steps on 3* `ls`, `uname` and `wc`. Pure test of the preset; the check with a real model on Windows needs the owner's OK. 4*/ 5import test from 'node:test' ; 6import assert from 'node:assert/strict' ; 7import { AGENT_PROMPT , agentPromptFor , standardPreset } from '../server/agent/preset.mjs' ; 8 9const promptOf = platform => standardPreset ({ platform}). plugins . find ( p => p . id === 'persona' ). config . prefix ; 10 11test ( 'the Windows prompt names PowerShell and the commands that do not exist' , () => { 12const text = promptOf ( 'win32' ); 13assert . match ( text , / runs Windows and the shell tool is PowerShell / ); 14assert . match ( text , / uname, wc and grep do not exist / ); 15assert . ok ( text . length < 1900 , ` ${ text . length } chars` ); 16assert . ok ( text . startsWith ( AGENT_PROMPT . split ( '\n\n' )[ 0 ]), 'the first line stays first' ); 17}); 18 19test ( 'macOS and Linux say so and do not mention PowerShell as the shell' , () => { 20assert . match ( promptOf ( 'darwin' ), / runs macOS / ); 21assert . match ( promptOf ( 'linux' ), / runs Linux / ); 22assert . doesNotMatch ( promptOf ( 'linux' ). split ( '\n\n' )[ 1 ], / PowerShell / ); 23}); 24 25test ( 'an unknown system keeps the plain prompt, and every other rule of it is still there' , () => { 26assert . equal ( agentPromptFor ( 'freebsd' ), AGENT_PROMPT ); 27for ( const p of [ 'win32' , 'darwin' , 'linux' ]) { 28for ( const rule of AGENT_PROMPT . split ( '\n\n' ). slice ( 1 )) assert . ok ( promptOf ( p ). includes ( rule ), ` ${ p } : ${ rule . slice ( 0 , 40 )} ` ); 29} 30});