Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.
C++
App: off switches for the three 0.2.7 speed features in the model's Expert settings (Native engine settings > Speed), on by default, in eight languages
Niko1221ddd4d5d42b65
diff --git a/apps/host/server/native-control.mjs b/apps/host/server/native-control.mjsindex ef67c25c7..8309f22f4 100644--- a/apps/host/server/native-control.mjs+++ b/apps/host/server/native-control.mjs@@ -7,7 +7,7 @@ import { existsSync, readdirSync, readFileSync, writeFileSync, mkdirSync, realpaimport { join, resolve, dirname, basename, sep, relative, isAbsolute } from 'node:path';import { fileURLToPath } from 'node:url';import { createServer } from 'node:net';-import { NATIVE_FIELDS, APP_OWNED_FIELDS, withoutDraftLayer, validateNativeSettings, validateMcpServers, publicMcpServers, publicNativeEnv, restoreNativeEnv } from './native-settings.mjs';+import { NATIVE_FIELDS, APP_OWNED_FIELDS, withoutDraftLayer, validateNativeSettings, validateMcpServers, publicMcpServers, publicNativeEnv, restoreNativeEnv, speedSwitchRows } from './native-settings.mjs';import { resourceSettings, saferStart, reserveChoice } from './native-resources.mjs';import { USER_KEY, capture as captureUserArgs, merge as mergeUserArgs, setFlag as setUserFlag, stamped as stampedUserArgs } from './native-user-args.mjs';import { resolvePython, venvPython } from './python-resolver.mjs';@@ -150,7 +150,7 @@ export function createNativeControl({directory,requests=()=>[],changed=()=>{},spasync function openSettingsFile(model,options={}){const info=settingsFile(model);await openTextFile(info.path,options);return info;}/* A mistake in the file holds the start back with the line, instead of an engine that dies on it. Warnings (an unknown key) never do. */function assertSettingsFile(path){const check=checkRunConfig(readFileSync(path,'utf8'));if(!check.ok)throw new Error(`The settings file for this model has a mistake, so the model was not started. ${describeIssues(check.issues,'error').join(' ')}`);}- function settings(model){const {config}=record(model);const values=Object.fromEntries(NATIVE_FIELDS.map(f=>[f.id,config[f.id]??null]));if(typeof values.aliases==='string')values.aliases=values.aliases.split(',').map(v=>v.trim()).filter(Boolean);values.sampling=config.sampling??{};values.args=config.args??[];values.env=publicNativeEnv(config.env??{});return {model,values,mcp:publicMcpServers(config.mcp_servers??config.mcpServers??{}),restartNeeded:true,capabilities:{dsExperts:ownEngine(config)&&dsExpertsSupported(config)}};}+ function settings(model){const {entry,config}=record(model);const values=Object.fromEntries(NATIVE_FIELDS.map(f=>[f.id,config[f.id]??null]));if(typeof values.aliases==='string')values.aliases=values.aliases.split(',').map(v=>v.trim()).filter(Boolean);values.sampling=config.sampling??{};values.args=config.args??[];values.env=publicNativeEnv(config.env??{});return {model,values,mcp:publicMcpServers(config.mcp_servers??config.mcpServers??{}),restartNeeded:true,capabilities:{dsExperts:ownEngine(config)&&dsExpertsSupported(config)},speedSwitches:speedSwitchRows(config.env??{},{deepseek:ownEngine(config),backend:config.backend??entry?.backend??snapshot.installed?.engine?.backend??null,gpus:snapshot.hardware?.gpus??[]})};}function save(model,{values,mcp}){if([...jobs.values()].some(j=>j.state==='running'))throw new Error('Finish the current operation before saving native settings.');const {path,config}=record(model);if(busy(requests().filter(r=>instances.get(r.instanceId)?.model===model)))throw new Error('Finish this model’s requests before saving its settings.');const patch=validateNativeSettings(values??{}),next={...config};if(patch.ds_experts!=null&&!dsExpertsSupported(config))throw new Error('The Speed choice needs the newer DeepSeek engine. Update the engine in Settings, then choose it.');for(const field of nativeFields())if(field.supported===false&&patch[field.id]!=null&&JSON.stringify(patch[field.id])!==JSON.stringify(config[field.id]))throw new Error(`${field.label} needs a newer native Strata installation. Update it in Settings → About.`);for(const [key,value] of Object.entries(patch)){if(key==='env')next.env=restoreNativeEnv(value,config.env??{});else if(value===null)delete next[key];else next[key]=value;}if('vram_reserve_mib' in patch){const base=captureUserArgs(next);const mine=setUserFlag(base,'--vram-reserve-mib',patch.vram_reserve_mib);if(mine.length)next[USER_KEY]=mine;else delete next[USER_KEY];next.args=mine.length&&patch.vram_reserve_mib!==null?mergeUserArgs(next.args??[],mine):setUserFlag(next.args??[],'--vram-reserve-mib',null);delete next.ui_reserve_applied;if(Array.isArray(next.args_written))next.args_written=[...next.args];}if(mcp!==undefined){next.mcp_servers=validateMcpServers(mcp,config.mcp_servers??config.mcpServers??{});delete next.mcpServers;}copyFileSync(path,path+'.bak');chmodSync(path+'.bak',0o600);const temp=path+'.ui-tmp';writeFileSync(temp,JSON.stringify(next,null,2)+'\n',{mode:0o600});renameSync(temp,path);return settings(model);}function previousEngine(){if(packaged)return !!snapshot.engine?.previous;try{const data=snapshot.installed?.data_dir??snapshot.installed?.data_folder;return [join(preferences.repo,'engine/.previous'),data&&join(data,'engine/.previous')].filter(Boolean).some(existsSync)&&readFileSync(join(preferences.repo,'setup.py'),'utf8').includes('--rollback-engine');}catch{return false;}}async function plan(args){await refresh();if(!snapshot.available)throw new Error(snapshot.error);const result=await tool('strata_install',installArgs(args,false));diff --git a/apps/host/server/native-settings.mjs b/apps/host/server/native-settings.mjsindex dba90f94b..37730c782 100644--- a/apps/host/server/native-settings.mjs+++ b/apps/host/server/native-settings.mjs@@ -26,6 +26,43 @@ export const NATIVE_FIELDS=[{id:'mcp_max_rounds',label:'Maximum tool rounds',group:'Tools',type:'number',min:1,max:100},{id:'mcp_max_result_chars',label:'Maximum tool result characters',group:'Tools',type:'number',min:100,max:1000000},];+/** Engine environment names the app shows and edits: STRATA_* and the DeepSeek engine's DS4_*. Any other name in a model's file is kept untouched and not shown. */+export const ENV_FLAG=/^(?:STRATA|DS4)_[A-Z0-9_]+$/;+/**+ * The three speed features that are on by default in 0.2.7 and have an off switch in Expert settings. Each switch, when off, writes exactly the+ * environment entries below into the model's settings file ("env"); turning it on again removes them, so a default launch carries none of them.+ * The names are the engine switch contract (phaseA-tests/notes-027-plan.md); strata_control/speed_switches.py says the same for the Terminal+ * (tests/terminal/test_speed_switches.py compares the two).+ */+export const SPEED_SWITCHES=[+ {id:'faster_long_prompts',label:'Faster long prompts',group:'Speed',+ hint:'Reads long prompts faster by approximating part of the work. Turn off if answers about long documents look wrong.',+ off:{STRATA_KVA:'0'}},+ {id:'faster_radeon_9000',label:'Faster answers on Radeon RX 9000 / AI PRO R9700',group:'Speed',+ hint:'Shares the work between the graphics card and the processor in a way that makes answers faster on these cards. Turn off to go back to the previous setting, which is slower.',+ off:{STRATA_PCIE_FRAC_DEFAULT:'old'}},+ {id:'deepseek_speedups',label:'DeepSeek speed-ups',group:'Speed',+ hint:'Reads long prompts faster and loads the parts of the model it needs faster. Turn off if DeepSeek stops working or its answers look wrong; it then runs as in version 0.2.6.',+ off:{DS4_FAST_ATTN:'0',DS4_ATTN_SLAB:'0',DS4_COPY_PIN:'0',DS4_COPY_HUGETLB:'0',DS4_STORE_SPARE:'0',DS4_STORE_PUT:'0'}},+];+const GFX12=/^gfx120[01]$/i, RADEON_9000=/\b(?:RX\s*9\d{3}|AI\s*PRO\s*R97\d{2}|R97\d{2})\b/i;+/** Which switches make sense for this model on this PC: only those are shown. `backend` is the engine's (cuda, hip, sycl, metal, cpu). */+export function speedSwitchApplies(id,{deepseek=false,backend=null,gpus=[]}={}){+ if(id==='deepseek_speedups')return !!deepseek;+ if(deepseek)return false; // the Qwen engine's switches+ if(id==='faster_long_prompts')return backend==='cuda'||backend==='hip';+ if(id==='faster_radeon_9000')return backend==='hip'&&(gpus??[]).some(g=>(!g.vendor||g.vendor==='amd')&&(GFX12.test(String(g.arch??''))||(!g.arch&&RADEON_9000.test(String(g.name??'')))));+ return false;+}+/** A switch is off when every entry it writes is in the environment with its value; anything less (a hand-edited file) reads as on and is left alone. */+export function speedSwitchIsOff(env,id){const sw=SPEED_SWITCHES.find(s=>s.id===id);return !!sw&&Object.entries(sw.off).every(([name,value])=>env?.[name]===value);}+/** The environment with the switch turned off (its entries written) or on (its entries removed). Nothing else in it changes. */+export function setSpeedSwitch(env,id,on){+ const sw=SPEED_SWITCHES.find(s=>s.id===id);if(!sw)throw new Error(`Unknown speed switch: ${id}`);+ const next={...(env??{})};for(const [name,value] of Object.entries(sw.off)){if(on)delete next[name];else next[name]=value;}return next;+}+/** What the settings answer carries: each switch that applies, with its words, the entries it writes when off, and whether it is on. */+export function speedSwitchRows(env,context){return SPEED_SWITCHES.filter(s=>speedSwitchApplies(s.id,context)).map(s=>({...s,on:!speedSwitchIsOff(env,s.id)}));}/** Settings the app itself applies when it starts a model (they are not read from the engine's source, so the engine's text never says it supports them). */export const APP_OWNED_FIELDS=['mtp','batchMtp','drafting','ds_experts'];/** The engine arguments without the draft layer: --mtp <folder or count>, --spec-min-p <p> (its confidence threshold) and --batch-mtp. --spec stays: prompt lookup still uses its windows. Same rule as strata_control/draft_layer.py. */@@ -40,7 +77,7 @@ export function validateNativeSettings(values){for(const [key,value] of Object.entries(values)){if(key==='args'){if(!Array.isArray(value)||value.length>200||value.some(v=>typeof v!=='string'||v.length>4000||/[\n\r\0]/.test(v))||value.some(v=>['--host','--port','--api-key'].includes(v)))throw new Error('Engine arguments must be text values. Network access stays managed by Strata.');result.args=[...value];continue;}- if(key==='env'){if(!value||typeof value!=='object'||Array.isArray(value))throw new Error('Engine environment must be an object.');const env={};for(const [name,text] of Object.entries(value)){if(!/^STRATA_[A-Z0-9_]+$/.test(name)||typeof text!=='string'||text.length>4000||text.includes('\0'))throw new Error('Use STRATA_ environment flags with text values.');env[name]=text;}result.env=env;continue;}+ if(key==='env'){if(!value||typeof value!=='object'||Array.isArray(value))throw new Error('Engine environment must be an object.');const env={};for(const [name,text] of Object.entries(value)){if(!ENV_FLAG.test(name)||typeof text!=='string'||text.length>4000||text.includes('\0'))throw new Error('Use STRATA_ environment flags with text values.');env[name]=text;}result.env=env;continue;}if(key==='sampling'){if(!value||typeof value!=='object'||Array.isArray(value))throw new Error('Sampling must be an object.');const limits={temperature:[0,10],top_p:[Number.MIN_VALUE,1],top_k:[1,64],min_p:[0,1],repetition_penalty:[Number.MIN_VALUE,10],presence_penalty:[0,10],frequency_penalty:[0,10],penalty_last_n:[0,1048576],seed:[1,2147483647]};for(const [name,n] of Object.entries(value)){if(name==='experimental_speed_projection'){if(typeof n!=='boolean')throw new Error('Speed projection must be on or off.');continue;}if(!limits[name]||!Number.isFinite(n)||(['top_k','seed','penalty_last_n'].includes(name)&&!Number.isInteger(n))||n<limits[name][0]||n>limits[name][1])throw new Error(`Choose a valid sampling ${name}.`);}result.sampling={...value};continue;}const field=NATIVE_FIELDS.find(f=>f.id===key);if(!field)throw new Error(`Unknown native setting: ${key}`);if(value===null||value===''){result[key]=null;continue;}@@ -75,5 +112,5 @@ export function validateMcpServers(servers,previous={}){}const sensitive=name=>/KEY|TOKEN|SECRET|PASSWORD|CREDENTIAL/i.test(name);-export function publicNativeEnv(env){return Object.fromEntries(Object.entries(env).filter(([name])=>/^STRATA_[A-Z0-9_]+$/.test(name)).map(([name,value])=>[name,sensitive(name)?MASK:value]));}-export function restoreNativeEnv(env,previous={}){const result=Object.fromEntries(Object.entries(previous).filter(([name])=>!/^STRATA_[A-Z0-9_]+$/.test(name)));for(const [name,value] of Object.entries(env)){if(value===MASK){if(previous[name]===undefined)throw new Error(`Enter a new value for ${name}.`);result[name]=previous[name];}else result[name]=value;}return result;}+export function publicNativeEnv(env){return Object.fromEntries(Object.entries(env).filter(([name])=>ENV_FLAG.test(name)).map(([name,value])=>[name,sensitive(name)?MASK:value]));}+export function restoreNativeEnv(env,previous={}){const result=Object.fromEntries(Object.entries(previous).filter(([name])=>!ENV_FLAG.test(name)));for(const [name,value] of Object.entries(env)){if(value===MASK){if(previous[name]===undefined)throw new Error(`Enter a new value for ${name}.`);result[name]=previous[name];}else result[name]=value;}return result;}diff --git a/apps/host/src/components/NativeSettings.tsx b/apps/host/src/components/NativeSettings.tsxindex f9cd893a2..561c8f661 100644--- a/apps/host/src/components/NativeSettings.tsx+++ b/apps/host/src/components/NativeSettings.tsx@@ -9,11 +9,20 @@ import { Btn, ErrorNotice, Select } from './ui';import { speedOptions } from '../lib/deepseek-speed';import type { RunCard } from '../lib/native-fit';import { NativeMcpEditor } from './NativeMcpEditor';+/** One of the three speed features that are on by default: what it is called, what turning it off does, and the engine environment it writes when off (server/native-settings.mjs). */+interface SpeedSwitch {+ id: string;+ label: string;+ hint: string;+ off: Record<string, string>;+}+const switchIsOff = (sw: SpeedSwitch, env: Record<string, string> | undefined) => Object.entries(sw.off).every(([name, value]) => env?.[name] === value);export function NativeSettings({ model }: {model: string;}) {const native = useNative();const [revision,setRevision]=useState(0);+ const [switches, setSwitches] = useState<SpeedSwitch[]>([]); // the speed switches that apply to this model on this PCconst [dsExperts, setDsExperts] = useState(false); // the installed DeepSeek engine knows --experts (0.1.50 or newer)const [tuned, setTuned] = useState<{ preset: { name: string } | null; changed: TunedChange[] } | null>(null);const [values, setValues] = useState<Record<string, any>>({}), [mcp, setMcp] = useState('{}'), [original, setOriginal] = useState(''), [text, setText] = useState(''), [tab, setTab] = useState('fields'), [pending, setPending] = useState(false), [error, setError] = useState(''), [notice, setNotice] = useState(''), [query, setQuery] = useState('');@@ -30,10 +39,12 @@ export function NativeSettings({ model }: {mcp: Record<string, any>;tuned?: { preset: { name: string } | null; changed: TunedChange[] } | null;capabilities?: { dsExperts?: boolean };+ speedSwitches?: SpeedSwitch[];}>(`/api/native/models/${model}/settings`).then(input => {if (!active)return;setDsExperts(!!input.capabilities?.dsExperts);+ setSwitches(input.speedSwitches ?? []);setTuned(input.tuned ?? null);const value = nativeSettingsResponse(input);setValues(value.values);@@ -47,6 +58,8 @@ export function NativeSettings({ model }: {return () => { active = false; };}, [model,revision]);const change = (id: string, value: any) => { const next = { ...values, [id]: value }; setValues(next); setText(JSON.stringify(next, null, 2)); setNotice(''); };+ /** On removes the switch's environment entries, off writes them: the model's file then carries nothing for a default launch. */+ const changeSwitch = (sw: SpeedSwitch, on: boolean) => { const env = { ...(values.env ?? {}) }; for (const [name, value] of Object.entries(sw.off)) { if (on) delete env[name]; else env[name] = value; } change('env', env); };async function save() {setPending(true);setError('');@@ -97,8 +110,9 @@ export function NativeSettings({ model }: {{error ? <><ErrorNotice message={tr('Couldn’t load model settings.')} next={tr('Check that the engine is connected and this model is installed, then try again.')} onRetry={() => setRevision(value => value + 1)}/><details className="native-settings-diagnostic"><summary className="small">{tr('Details')}</summary><p className="small muted">{error}</p></details></> : <p className="small muted" role="status">{tr('Reading saved settings…')}</p>}</details>;const rows = (native?.fields ?? []).filter(f => (!f.forModel || (model.toLowerCase().includes(f.forModel) && (f.id !== 'ds_experts' || dsExperts))) && `${tr(f.label)} ${f.id} ${tr(f.group)}`.toLowerCase().includes(query.toLowerCase()));+ const switchRows = switches.filter(sw => `${tr(sw.label)} ${sw.id} ${tr('Speed')}`.toLowerCase().includes(query.toLowerCase()));return <details className="native-settings"><summary>{tr("Native engine settings")}</summary>{tr(tuned?.changed?.length ? <div className="native-tuned"><p className="small"><strong>{tr("Your tuning '{0}' sets", [tuned.preset?.name ?? ''])}</strong></p><ul>{tuned.changed.map(c => { const d = describeChange(c); return <li key={c.flag}><span>{d.name}</span><b>{d.now || tr('off')}</b>{d.was !== null ? <small className="muted">{tr("was {0}", [d.was])}</small> : null}</li>; })}</ul></div> : null)}<p className="small muted">{tr(!original ? 'Reading saved settings… ' : '')}{tr("Settings for this model. Blank values use Strata\u2019s defaults.")}</p><div className="editor-tabs" role="tablist" aria-label={tr("Native settings editor")}>{tr(['fields', 'json', 'tools'].map(t => <button key={t} role="tab" aria-selected={tab === t} onClick={() => chooseTab(t)}>{tr(t === 'fields' ? 'Parameters' : t === 'json' ? 'JSON' : 'MCP tools')}</button>))}</div>- {tr(tab === 'fields' ? <><input className="st-input" type="search" aria-label={tr("Search native parameters")} placeholder={tr("Search parameters…")} value={query} onChange={e => setQuery(e.target.value)}/>{tr(['Responses', 'GPU & memory', 'Serving', 'Image reading', 'Tools', 'Recovery'].map(group => rows.some(f => f.group === group) ? <section className="native-settings-group" key={group}><h3 className="h4">{tr(group)}</h3>{tr(rows.filter(f => f.group === group).map(f => <label className="native-setting-row" key={f.id}><span><strong>{tr(f.label)}</strong>{tr(f.supported === false ? <small>{tr("Requires a newer Strata installation.")}</small> : f.hint ? <small>{tr(f.hint)}</small> : null)}</span><NativeFieldInput field={f} value={values[f.id]} onChange={v => change(f.id, v)}/></label>))}</section> : null))}<section className="native-settings-group"><h3 className="h4">{tr("Sampling")}</h3>{tr([['temperature', 'Temperature'], ['top_p', 'Top-p'], ['top_k', 'Top-k'], ['min_p', 'Min-p'], ['repetition_penalty', 'Repetition penalty'], ['presence_penalty', 'Presence penalty'], ['frequency_penalty', 'Frequency penalty'], ['penalty_last_n', 'Penalty window'], ['seed', 'Seed']].map(([id, label]) => <label className="native-setting-row" key={id}><span><strong>{tr(label)}</strong></span><DecimalInput ariaLabel={tr("Native {0}", [label])} value={values.sampling?.[id] ?? null} onChange={n => { const sampling = { ...values.sampling }; if (n === null) delete sampling[id]; else sampling[id] = n; change('sampling', sampling); }}/></label>))}</section></> : tab === 'json' ? <><p className="small muted">{tr("Engine arguments and STRATA environment flags are editable here. Program paths and network access remain managed by the host.")}</p><textarea className="st-input native-json" aria-label={tr("Native configuration JSON")} spellCheck={false} value={text} onChange={e => { setText(e.target.value); setNotice(''); }}/></> : <><p className="small muted">{tr("Add local programs or HTTP MCP servers. Connected tools can read or change the resources you give them access to. Enable tools in chat when you want the model to use them.")}</p><NativeMcpEditor text={mcp} onChange={value => { setMcp(value); setNotice(''); }}/><details><summary className="small">{tr("Configuration example")}</summary><pre className="native-example">{'{\n "files": {\n "command": "npx",\n "args": ["-y", "@modelcontextprotocol/server-filesystem", "/your/folder"],\n "disabled": false\n }\n}'}</pre><p className="xs muted">{tr("Saved credentials are masked. Keep the mask to preserve an existing value; type a new value to replace it.")}</p></details></>)}+ {tr(tab === 'fields' ? <><input className="st-input" type="search" aria-label={tr("Search native parameters")} placeholder={tr("Search parameters…")} value={query} onChange={e => setQuery(e.target.value)}/>{tr(['Responses', 'GPU & memory', 'Serving', 'Image reading', 'Tools', 'Recovery'].map(group => rows.some(f => f.group === group) ? <section className="native-settings-group" key={group}><h3 className="h4">{tr(group)}</h3>{tr(rows.filter(f => f.group === group).map(f => <label className="native-setting-row" key={f.id}><span><strong>{tr(f.label)}</strong>{tr(f.supported === false ? <small>{tr("Requires a newer Strata installation.")}</small> : f.hint ? <small>{tr(f.hint)}</small> : null)}</span><NativeFieldInput field={f} value={values[f.id]} onChange={v => change(f.id, v)}/></label>))}</section> : null))}{tr(switchRows.length ? <section className="native-settings-group"><h3 className="h4">{tr("Speed")}</h3>{tr(switchRows.map(sw => <label className="native-setting-row" key={sw.id}><span><strong>{tr(sw.label)}</strong><small>{tr(sw.hint)}</small></span><Select ariaLabel={tr(sw.label)} value={switchIsOff(sw, values.env) ? 'off' : 'on'} options={[{ value: 'on', label: 'On (recommended)' }, { value: 'off', label: 'Off' }]} onChange={v => changeSwitch(sw, v === 'on')}/></label>))}</section> : null)}<section className="native-settings-group"><h3 className="h4">{tr("Sampling")}</h3>{tr([['temperature', 'Temperature'], ['top_p', 'Top-p'], ['top_k', 'Top-k'], ['min_p', 'Min-p'], ['repetition_penalty', 'Repetition penalty'], ['presence_penalty', 'Presence penalty'], ['frequency_penalty', 'Frequency penalty'], ['penalty_last_n', 'Penalty window'], ['seed', 'Seed']].map(([id, label]) => <label className="native-setting-row" key={id}><span><strong>{tr(label)}</strong></span><DecimalInput ariaLabel={tr("Native {0}", [label])} value={values.sampling?.[id] ?? null} onChange={n => { const sampling = { ...values.sampling }; if (n === null) delete sampling[id]; else sampling[id] = n; change('sampling', sampling); }}/></label>))}</section></> : tab === 'json' ? <><p className="small muted">{tr("Engine arguments and STRATA environment flags are editable here. Program paths and network access remain managed by the host.")}</p><textarea className="st-input native-json" aria-label={tr("Native configuration JSON")} spellCheck={false} value={text} onChange={e => { setText(e.target.value); setNotice(''); }}/></> : <><p className="small muted">{tr("Add local programs or HTTP MCP servers. Connected tools can read or change the resources you give them access to. Enable tools in chat when you want the model to use them.")}</p><NativeMcpEditor text={mcp} onChange={value => { setMcp(value); setNotice(''); }}/><details><summary className="small">{tr("Configuration example")}</summary><pre className="native-example">{'{\n "files": {\n "command": "npx",\n "args": ["-y", "@modelcontextprotocol/server-filesystem", "/your/folder"],\n "disabled": false\n }\n}'}</pre><p className="xs muted">{tr("Saved credentials are masked. Keep the mask to preserve an existing value; type a new value to replace it.")}</p></details></>)}<div className="native-settings-actions"><Btn disabled={pending || !original || !dirty} variant="primary" onClick={() => void save()}>{tr(pending ? 'Saving…' : 'Save settings')}</Btn><Btn disabled={pending} onClick={() => { const saved = JSON.parse(original || '{"values":{},"mcp":{}}'); setValues(saved.values); setText(JSON.stringify(saved.values, null, 2)); setMcp(JSON.stringify(saved.mcp, null, 2)); setError(''); }}>{tr("Restore saved")}</Btn></div>{tr(notice ? <p role="status" className="small">{tr(notice)}</p> : null)}{tr(error ? <ErrorNotice message={error} onRetry={() => setRevision(value => value + 1)}/> : null)}</details>;}diff --git a/apps/host/src/locales/fix-de.json b/apps/host/src/locales/fix-de.jsonindex 0081ec11b..7c3333f29 100644--- a/apps/host/src/locales/fix-de.json+++ b/apps/host/src/locales/fix-de.json@@ -67,5 +67,12 @@"fx66": "Standard (Schneller auf diesem PC)","fx67": "Standard (Volle Qualität auf diesem PC)","fx68": "Schneller (Standard auf diesem PC)",- "fx69": "Volle Qualität (Standard auf diesem PC)"+ "fx69": "Volle Qualität (Standard auf diesem PC)",+ "fx70": "Lange Prompts schneller lesen",+ "fx71": "Schnellere Antworten auf Radeon RX 9000 / AI PRO R9700",+ "fx72": "DeepSeek-Beschleunigungen",+ "fx73": "Liest lange Prompts schneller, indem ein Teil der Arbeit angenähert wird. Schalten Sie die Option aus, wenn Antworten zu langen Dokumenten falsch aussehen.",+ "fx74": "Verteilt die Arbeit so zwischen Grafikkarte und Prozessor, dass Antworten auf diesen Karten schneller werden. Ausschalten stellt die vorherige, langsamere Einstellung wieder her.",+ "fx75": "Liest lange Prompts schneller und lädt die benötigten Teile des Modells schneller. Schalten Sie die Option aus, wenn DeepSeek nicht mehr funktioniert oder die Antworten falsch aussehen; dann läuft es wie in Version 0.2.6.",+ "fx76": "Ein (empfohlen)"}diff --git a/apps/host/src/locales/fix-en.json b/apps/host/src/locales/fix-en.jsonindex ed8d0652a..5e272a01e 100644--- a/apps/host/src/locales/fix-en.json+++ b/apps/host/src/locales/fix-en.json@@ -67,5 +67,12 @@"fx66": "Default (Faster on this PC)","fx67": "Default (Full quality on this PC)","fx68": "Faster (default on this PC)",- "fx69": "Full quality (default on this PC)"+ "fx69": "Full quality (default on this PC)",+ "fx70": "Faster long prompts",+ "fx71": "Faster answers on Radeon RX 9000 / AI PRO R9700",+ "fx72": "DeepSeek speed-ups",+ "fx73": "Reads long prompts faster by approximating part of the work. Turn off if answers about long documents look wrong.",+ "fx74": "Shares the work between the graphics card and the processor in a way that makes answers faster on these cards. Turn off to go back to the previous setting, which is slower.",+ "fx75": "Reads long prompts faster and loads the parts of the model it needs faster. Turn off if DeepSeek stops working or its answers look wrong; it then runs as in version 0.2.6.",+ "fx76": "On (recommended)"}diff --git a/apps/host/src/locales/fix-es.json b/apps/host/src/locales/fix-es.jsonindex 83c72ad3d..f9cd50c7d 100644--- a/apps/host/src/locales/fix-es.json+++ b/apps/host/src/locales/fix-es.json@@ -67,5 +67,12 @@"fx66": "Predeterminado (Más rápido en este PC)","fx67": "Predeterminado (Calidad completa en este PC)","fx68": "Más rápido (predeterminado en este PC)",- "fx69": "Calidad completa (predeterminado en este PC)"+ "fx69": "Calidad completa (predeterminado en este PC)",+ "fx70": "Prompts largos más rápidos",+ "fx71": "Respuestas más rápidas en Radeon RX 9000 / AI PRO R9700",+ "fx72": "Aceleraciones de DeepSeek",+ "fx73": "Lee los prompts largos más rápido aproximando una parte del trabajo. Desactívalo si las respuestas sobre documentos largos parecen incorrectas.",+ "fx74": "Reparte el trabajo entre la tarjeta gráfica y el procesador de una forma que acelera las respuestas en estas tarjetas. Si lo desactivas, vuelve el ajuste anterior, que es más lento.",+ "fx75": "Lee los prompts largos más rápido y carga más rápido las partes del modelo que necesita. Desactívalo si DeepSeek deja de funcionar o sus respuestas parecen incorrectas; entonces funciona como en la versión 0.2.6.",+ "fx76": "Activado (recomendado)"}diff --git a/apps/host/src/locales/fix-ja.json b/apps/host/src/locales/fix-ja.jsonindex 18bf9810d..db46360a8 100644--- a/apps/host/src/locales/fix-ja.json+++ b/apps/host/src/locales/fix-ja.json@@ -67,5 +67,12 @@"fx66": "既定(この PC では「高速」)","fx67": "既定(この PC では「フル品質」)","fx68": "高速(この PC の既定)",- "fx69": "フル品質(この PC の既定)"+ "fx69": "フル品質(この PC の既定)",+ "fx70": "長いプロンプトを高速化",+ "fx71": "Radeon RX 9000 / AI PRO R9700 での高速な応答",+ "fx72": "DeepSeek の高速化",+ "fx73": "処理の一部を近似することで、長いプロンプトをより速く読み込みます。長い文書についての回答がおかしいと感じたらオフにしてください。",+ "fx74": "これらのグラフィックスカードで応答が速くなるよう、グラフィックスカードとプロセッサーの間で作業を分担します。オフにすると、以前の(より遅い)設定に戻ります。",+ "fx75": "長いプロンプトと、必要なモデルの部分をより速く読み込みます。DeepSeek が動かなくなったり、回答がおかしいと感じたりしたらオフにしてください。バージョン 0.2.6 と同じ動作になります。",+ "fx76": "オン(推奨)"}diff --git a/apps/host/src/locales/fix-ko.json b/apps/host/src/locales/fix-ko.jsonindex cdec83b07..694082b2a 100644--- a/apps/host/src/locales/fix-ko.json+++ b/apps/host/src/locales/fix-ko.json@@ -67,5 +67,12 @@"fx66": "기본값(이 PC에서는 더 빠르게)","fx67": "기본값(이 PC에서는 전체 품질)","fx68": "더 빠르게(이 PC의 기본값)",- "fx69": "전체 품질(이 PC의 기본값)"+ "fx69": "전체 품질(이 PC의 기본값)",+ "fx70": "긴 프롬프트 더 빠르게 읽기",+ "fx71": "Radeon RX 9000 / AI PRO R9700에서 더 빠른 응답",+ "fx72": "DeepSeek 속도 향상",+ "fx73": "작업의 일부를 근사 처리하여 긴 프롬프트를 더 빠르게 읽습니다. 긴 문서에 대한 답변이 이상해 보이면 끄세요.",+ "fx74": "이 그래픽 카드에서 응답이 빨라지도록 그래픽 카드와 프로세서가 작업을 나눕니다. 끄면 이전의 더 느린 설정으로 돌아갑니다.",+ "fx75": "긴 프롬프트와 필요한 모델 부분을 더 빠르게 읽고 불러옵니다. DeepSeek가 멈추거나 답변이 이상해 보이면 끄세요. 그러면 0.2.6 버전처럼 동작합니다.",+ "fx76": "켬(권장)"}diff --git a/apps/host/src/locales/fix-pt.json b/apps/host/src/locales/fix-pt.jsonindex da1041845..0e0aaf359 100644--- a/apps/host/src/locales/fix-pt.json+++ b/apps/host/src/locales/fix-pt.json@@ -67,5 +67,12 @@"fx66": "Padrão (Mais rápido neste PC)","fx67": "Padrão (Qualidade total neste PC)","fx68": "Mais rápido (padrão neste PC)",- "fx69": "Qualidade total (padrão neste PC)"+ "fx69": "Qualidade total (padrão neste PC)",+ "fx70": "Prompts longos mais rápidos",+ "fx71": "Respostas mais rápidas em Radeon RX 9000 / AI PRO R9700",+ "fx72": "Acelerações do DeepSeek",+ "fx73": "Lê prompts longos mais rápido aproximando parte do trabalho. Desative se as respostas sobre documentos longos parecerem erradas.",+ "fx74": "Divide o trabalho entre a placa de vídeo e o processador de um jeito que deixa as respostas mais rápidas nessas placas. Ao desativar, volta a configuração anterior, que é mais lenta.",+ "fx75": "Lê prompts longos mais rápido e carrega mais rápido as partes do modelo de que precisa. Desative se o DeepSeek parar de funcionar ou as respostas parecerem erradas; ele passa a funcionar como na versão 0.2.6.",+ "fx76": "Ativado (recomendado)"}diff --git a/apps/host/src/locales/fix-ru.json b/apps/host/src/locales/fix-ru.jsonindex eba9aed68..604661d23 100644--- a/apps/host/src/locales/fix-ru.json+++ b/apps/host/src/locales/fix-ru.json@@ -67,5 +67,12 @@"fx66": "По умолчанию (на этом компьютере — «Быстрее»)","fx67": "По умолчанию (на этом компьютере — «Полное качество»)","fx68": "Быстрее (по умолчанию на этом компьютере)",- "fx69": "Полное качество (по умолчанию на этом компьютере)"+ "fx69": "Полное качество (по умолчанию на этом компьютере)",+ "fx70": "Более быстрое чтение длинных запросов",+ "fx71": "Более быстрые ответы на Radeon RX 9000 / AI PRO R9700",+ "fx72": "Ускорения DeepSeek",+ "fx73": "Читает длинные запросы быстрее, приближённо выполняя часть работы. Отключите, если ответы по длинным документам выглядят неверными.",+ "fx74": "Распределяет работу между видеокартой и процессором так, что ответы на этих видеокартах получаются быстрее. Если отключить, вернётся прежняя, более медленная настройка.",+ "fx75": "Быстрее читает длинные запросы и быстрее загружает нужные части модели. Отключите, если DeepSeek перестаёт работать или его ответы выглядят неверными; тогда он работает как в версии 0.2.6.",+ "fx76": "Вкл. (рекомендуется)"}diff --git a/apps/host/src/locales/fix-zh.json b/apps/host/src/locales/fix-zh.jsonindex 271ffa73d..172e5375b 100644--- a/apps/host/src/locales/fix-zh.json+++ b/apps/host/src/locales/fix-zh.json@@ -67,5 +67,12 @@"fx66": "默认(这台电脑上为“更快”)","fx67": "默认(这台电脑上为“完整质量”)","fx68": "更快(这台电脑上的默认)",- "fx69": "完整质量(这台电脑上的默认)"+ "fx69": "完整质量(这台电脑上的默认)",+ "fx70": "更快读取长提示词",+ "fx71": "Radeon RX 9000 / AI PRO R9700 上更快的回答",+ "fx72": "DeepSeek 加速",+ "fx73": "通过近似处理部分计算,更快读取长提示词。如果关于长文档的回答看起来不对,请关闭。",+ "fx74": "以更适合这些显卡的方式在显卡和处理器之间分配工作,使回答更快。关闭后恢复到之前较慢的设置。",+ "fx75": "更快读取长提示词,并更快加载所需的模型部分。如果 DeepSeek 无法运行或回答看起来不对,请关闭;关闭后它将像 0.2.6 版本那样运行。",+ "fx76": "开启(推荐)"}diff --git a/apps/host/tests/speed-switches.test.mjs b/apps/host/tests/speed-switches.test.mjsnew file mode 100644index 000000000..8df4a6342--- /dev/null+++ b/apps/host/tests/speed-switches.test.mjs@@ -0,0 +1,180 @@+// The three 0.2.7 speed features are on by default and each has an off switch in Expert settings (the model's "Native engine settings").+// Off writes exactly the engine environment of the switch contract (phaseA-tests/notes-027-plan.md) into the model's settings file; on removes it,+// so a default launch carries none of it. strata_control/speed_switches.py says the same for the Terminal (tests/terminal/test_speed_switches.py).+import test from 'node:test';+import assert from 'node:assert/strict';+import { readFileSync, writeFileSync } from 'node:fs';+import { join } from 'node:path';+import { fileURLToPath } from 'node:url';+import { SPEED_SWITCHES, speedSwitchApplies, speedSwitchIsOff, speedSwitchRows, setSpeedSwitch, validateNativeSettings, publicNativeEnv, restoreNativeEnv } from '../server/native-settings.mjs';+import { nativeFixture } from './helpers/native-fixture.mjs';++const read = rel => readFileSync(fileURLToPath(new URL(rel, import.meta.url)), 'utf8').replace(/\r\n/g, '\n');+const OFF = {+ faster_long_prompts: { STRATA_KVA: '0' },+ faster_radeon_9000: { STRATA_PCIE_FRAC_DEFAULT: 'old' },+ deepseek_speedups: { DS4_FAST_ATTN: '0', DS4_ATTN_SLAB: '0', DS4_COPY_PIN: '0', DS4_COPY_HUGETLB: '0', DS4_STORE_SPARE: '0', DS4_STORE_PUT: '0' },+};+const R9700 = { index: 0, name: 'AMD Radeon AI PRO R9700', vendor: 'amd', arch: 'gfx1201', vram_gb: 32 };+const RX7900 = { index: 0, name: 'AMD Radeon RX 7900 XTX', vendor: 'amd', arch: 'gfx1100', vram_gb: 24 };+const RTX = { index: 0, name: 'NVIDIA GeForce RTX 4090', vendor: 'nvidia', arch: '89', vram_gb: 24 };+const STRIX = { index: 0, name: 'AMD Radeon 8060S', vendor: 'amd', arch: 'gfx1151', vram_gb: 96, uma: true };++test('there are exactly three switches and each writes the engine names of the contract', () => {+ assert.deepEqual(SPEED_SWITCHES.map(s => s.id), Object.keys(OFF));+ for (const sw of SPEED_SWITCHES) assert.deepEqual(sw.off, OFF[sw.id], sw.id);+});++test('a default launch has none of the new environment entries: every switch reads as on and an empty environment stays empty', () => {+ for (const sw of SPEED_SWITCHES) assert.equal(speedSwitchIsOff({}, sw.id), false);+ const env = { PATH: '/native/bin', STRATA_PREFILL: '2' };+ for (const sw of SPEED_SWITCHES) assert.deepEqual(setSpeedSwitch(env, sw.id, true), env, 'on removes nothing that is not the switch\'s');+ const rows = speedSwitchRows({}, { backend: 'hip', gpus: [R9700] });+ assert.ok(rows.every(r => r.on === true));+});++test('each switch off yields exactly its entries and nothing else; on again gives back the same environment', () => {+ const env = { PATH: '/native/bin', STRATA_PREFILL: '2', DS4_ASYNC_T: '4' };+ for (const sw of SPEED_SWITCHES) {+ const off = setSpeedSwitch(env, sw.id, false);+ assert.deepEqual(off, { ...env, ...OFF[sw.id] }, sw.id);+ assert.equal(speedSwitchIsOff(off, sw.id), true);+ for (const other of SPEED_SWITCHES) if (other.id !== sw.id) assert.equal(speedSwitchIsOff(off, other.id), false, `${sw.id} does not turn ${other.id} off`);+ const back = setSpeedSwitch(off, sw.id, true);+ assert.deepEqual(back, env, sw.id);+ assert.equal(JSON.stringify(back), JSON.stringify(env), 'byte for byte, key order included');+ }+ assert.throws(() => setSpeedSwitch({}, 'nothing', false), /Unknown speed switch/);+});++test('a hand-edited file with only some of a switch\'s entries reads as on and is left alone by an unchanged save', () => {+ const partial = { DS4_FAST_ATTN: '0' };+ assert.equal(speedSwitchIsOff(partial, 'deepseek_speedups'), false);+ assert.deepEqual(setSpeedSwitch(partial, 'faster_long_prompts', true), partial);+ assert.equal(speedSwitchIsOff({ STRATA_KVA: '1' }, 'faster_long_prompts'), false, 'only the off value counts');+});++test('a switch shows only where it applies: Qwen on CUDA or HIP, Qwen on a Radeon RX 9000 / R9700, DeepSeek', () => {+ const ids = context => speedSwitchRows({}, context).map(r => r.id);+ assert.deepEqual(ids({ backend: 'cuda', gpus: [RTX] }), ['faster_long_prompts']);+ assert.deepEqual(ids({ backend: 'hip', gpus: [RX7900] }), ['faster_long_prompts']);+ assert.deepEqual(ids({ backend: 'hip', gpus: [STRIX] }), ['faster_long_prompts'], 'Strix Halo (gfx1151) is not gfx12');+ assert.deepEqual(ids({ backend: 'hip', gpus: [R9700] }), ['faster_long_prompts', 'faster_radeon_9000']);+ assert.deepEqual(ids({ backend: 'hip', gpus: [{ name: 'AMD Radeon RX 9070 XT', vendor: 'amd' }] }), ['faster_long_prompts', 'faster_radeon_9000'], 'no arch reported: the card name decides');+ assert.deepEqual(ids({ backend: 'hip', gpus: [{ name: 'AMD Radeon RX 7900 XT', vendor: 'amd' }] }), ['faster_long_prompts']);+ assert.deepEqual(ids({ backend: 'cuda', gpus: [RTX, R9700] }), ['faster_long_prompts'], 'the Radeon switch needs the HIP engine');+ for (const backend of ['sycl', 'metal', 'cpu', null]) assert.deepEqual(ids({ backend, gpus: [R9700] }), [], `Qwen on ${backend}`);+ assert.deepEqual(ids({ deepseek: true, backend: 'hip', gpus: [R9700] }), ['deepseek_speedups'], 'DeepSeek has its own switch only');+ assert.deepEqual(ids({ deepseek: true, backend: 'cuda', gpus: [RTX] }), ['deepseek_speedups']);+ assert.equal(speedSwitchApplies('deepseek_speedups', { deepseek: false, backend: 'cuda', gpus: [RTX] }), false);+ assert.deepEqual(ids({}), [], 'nothing is known: nothing is offered');+});++test('the environment names round-trip through the validator, the public view and the restore, and other names stay untouched', () => {+ const all = Object.assign({}, ...Object.values(OFF));+ assert.deepEqual(validateNativeSettings({ env: all }), { env: all });+ assert.throws(() => validateNativeSettings({ env: { HOME: '/tmp' } }));+ assert.throws(() => validateNativeSettings({ env: { DS4_fast: '0' } }));+ const previous = { PATH: '/native/bin', HIP_VISIBLE_DEVICES: '0', ...all };+ assert.deepEqual(publicNativeEnv(previous), all);+ assert.deepEqual(restoreNativeEnv({}, previous), { PATH: '/native/bin', HIP_VISIBLE_DEVICES: '0' }, 'turning every switch on removes only theirs');+ assert.deepEqual(restoreNativeEnv(all, { PATH: '/native/bin' }), { PATH: '/native/bin', ...all });+});++function setConfig(f, model, patch) {+ const path = join(f.repo, `strata-${model}.json`);+ writeFileSync(path, JSON.stringify({ ...JSON.parse(readFileSync(path, 'utf8')), ...patch }));+ return path;+}++test('through the host: the settings answer lists the switches that apply, and off then on gives back the same file', async () => {+ const f = nativeFixture();+ try {+ f.setHardware({ ram_gb: 64, gpus: [R9700] });+ const path = setConfig(f, 'iq2_xs', { backend: 'hip' });+ await f.control.refresh();+ const before = readFileSync(path, 'utf8');+ const first = f.control.settings('iq2_xs');+ assert.deepEqual(first.speedSwitches.map(s => [s.id, s.on]), [['faster_long_prompts', true], ['faster_radeon_9000', true]]);+ assert.deepEqual(first.speedSwitches.map(s => s.off), [OFF.faster_long_prompts, OFF.faster_radeon_9000], 'the client writes what the host says');+ assert.equal('STRATA_KVA' in first.values.env, false, 'default: nothing in the environment');++ // the client turns "Faster long prompts" off: it sends the environment with the entry added+ const off = f.control.save('iq2_xs', { values: { env: { ...first.values.env, ...OFF.faster_long_prompts } } });+ const file = JSON.parse(readFileSync(path, 'utf8'));+ assert.equal(file.env.STRATA_KVA, '0');+ assert.equal(file.env.PATH, '/native/bin');+ assert.equal(file.env.STRATA_TOKEN, 'private', 'a credential is kept, not lost behind its mask');+ assert.equal('STRATA_PCIE_FRAC_DEFAULT' in file.env, false);+ assert.deepEqual(off.speedSwitches.map(s => [s.id, s.on]), [['faster_long_prompts', false], ['faster_radeon_9000', true]]);++ // and on again: the entry is gone and the file is as it was+ const env = { ...off.values.env };+ delete env.STRATA_KVA;+ const on = f.control.save('iq2_xs', { values: { env } });+ assert.deepEqual(on.speedSwitches.map(s => s.on), [true, true]);+ const after = JSON.parse(readFileSync(path, 'utf8'));+ assert.deepEqual(after, JSON.parse(before));+ assert.equal(JSON.stringify(after.env), JSON.stringify(JSON.parse(before).env), 'the same environment, same order');+ } finally { await f.cleanup(); }+});++test('through the host: a DeepSeek model gets its own switch only, and the Strix async entry is kept beside it', async () => {+ const f = nativeFixture();+ try {+ f.setHardware({ ram_gb: 128, gpus: [STRIX] });+ const path = setConfig(f, 'iq2_xs', { arch: 'deepseek41', backend: 'hip', env: { DS4_ASYNC_T: '4' } });+ await f.control.refresh();+ const first = f.control.settings('iq2_xs');+ assert.deepEqual(first.speedSwitches.map(s => [s.id, s.on]), [['deepseek_speedups', true]]);+ assert.equal(first.values.env.DS4_ASYNC_T, '4', 'setup\'s own entry is visible and kept');+ const off = f.control.save('iq2_xs', { values: { env: { ...first.values.env, ...OFF.deepseek_speedups } } });+ assert.deepEqual(JSON.parse(readFileSync(path, 'utf8')).env, { DS4_ASYNC_T: '4', ...OFF.deepseek_speedups });+ assert.equal(off.speedSwitches[0].on, false);+ const env = Object.fromEntries(Object.entries(off.values.env).filter(([name]) => !(name in OFF.deepseek_speedups)));+ f.control.save('iq2_xs', { values: { env } });+ assert.deepEqual(JSON.parse(readFileSync(path, 'utf8')).env, { DS4_ASYNC_T: '4' });+ } finally { await f.cleanup(); }+});++test('through the host: a Qwen model on a PC the engine cannot speed up offers no switch (SYCL, a Mac, no card)', async () => {+ const f = nativeFixture();+ try {+ f.setHardware({ ram_gb: 32, gpus: [{ index: 0, name: 'Intel Arc A750', vendor: 'intel', vram_gb: 8 }] });+ setConfig(f, 'iq2_xs', { backend: 'sycl' });+ await f.control.refresh();+ assert.deepEqual(f.control.settings('iq2_xs').speedSwitches, []);+ } finally { await f.cleanup(); }+});++test('the Expert settings show the rows in the existing row layout with an On / Off choice, and the words are in all eight languages', () => {+ const screen = read('../src/components/NativeSettings.tsx');+ assert.match(screen, /<h3 className="h4">\{tr\("Speed"\)\}<\/h3>/);+ assert.match(screen, /<label className="native-setting-row" key=\{sw\.id\}><span><strong>\{tr\(sw\.label\)\}<\/strong><small>\{tr\(sw\.hint\)\}<\/small><\/span><Select /, 'the same row, the same Select');+ assert.match(screen, /label: 'On \(recommended\)' \}, \{ value: 'off', label: 'Off' \}/);+ assert.match(screen, /if \(on\) delete env\[name\]; else env\[name\] = value;/, 'on removes the entries');+ const languages = ['en', 'zh', 'ja', 'de', 'es', 'ru', 'pt', 'ko'];+ const catalog = lang => JSON.parse(read(`../src/locales/fix-${lang}.json`));+ const words = [...SPEED_SWITCHES.flatMap(s => [s.label, s.hint]), 'On (recommended)'];+ const english = Object.values(catalog('en'));+ for (const word of words) assert.ok(english.includes(word), `English catalog: ${word}`);+ for (const lang of languages.slice(1)) {+ const translated = Object.values(catalog(lang));+ const en = catalog('en');+ for (const [id, text] of Object.entries(en)) if (words.includes(text)) {+ assert.ok(catalog(lang)[id] && catalog(lang)[id] !== text, `${lang} ${id} is translated`);+ assert.ok(translated.includes(catalog(lang)[id]));+ assert.ok(!/\{\d+\}/.test(catalog(lang)[id]));+ }+ }+ for (const lang of ['zh', 'ja', 'ko']) assert.ok(Object.values(catalog(lang)).some(v => v.includes('0.2.6')), 'the version number is kept in the DeepSeek text');+});++test('the effect texts say what turning the feature off does, in plain words', () => {+ for (const sw of SPEED_SWITCHES) {+ assert.match(sw.hint, /[Tt]urn off/, sw.id);+ assert.ok(sw.hint.length < 260, sw.id);+ assert.ok(!/STRATA_|DS4_|env|--/.test(sw.hint), 'no flags or variable names for a non-technical reader');+ }+ assert.equal(SPEED_SWITCHES[0].hint, 'Reads long prompts faster by approximating part of the work. Turn off if answers about long documents look wrong.');+});