Skip to content

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++

About/Updates: never show the host's placeholder engine version (strata-engine 0.1.0) while the real one is still being read; a forced status read that meets one already running waits and reads again, so the version after an engine update is not the old one; test

Niko1221dd9b9f746db0
diff --git a/apps/host/server/native-control.mjs b/apps/host/server/native-control.mjs
index 51bd69a3f..ef67c25c7 100644
--- a/apps/host/server/native-control.mjs
+++ b/apps/host/server/native-control.mjs
@@ -137,7 +137,7 @@ export function createNativeControl({directory,requests=()=>[],changed=()=>{},sp
if(closing)return state();
/* A read that is not forced never makes the window wait for the (slow) status of Control: it gets the last state at once, and a stale one
is refreshed in the background. Only the first read, and a forced one after an operation, waits. */
- if(refreshing)return !force&&snapshot.available?state():refreshing;if(!force&&Date.now()-lastRead<45000)return state();
+ if(refreshing)return !force&&snapshot.available?state():force?refreshing.then(()=>refresh(true)):refreshing; /* a forced read that meets one already running (started before an engine update finished) waits for it and reads again, so it never settles on the old answer */if(!force&&Date.now()-lastRead<45000)return state();
probeDrafting();
refreshing=(async()=>{try{const [catalog,status]=packaged?await (async()=>{const s=await tool('strata_status',{hardware:true});const c=await tool('strata_models').catch(error=>({families:[],contexts:[],recommendation:{family:null,model:null},context_note:'',error:error.message}));return [c,s];})():await Promise.all([tool('strata_models'),tool('strata_status',{hardware:true})]);let visionReader=false;if(packaged){try{const e=await control.engine();const root=e?.engine?.root??(e?.engine?.exe?dirname(e.engine.exe):'');visionReader=!!root&&['strata-vision','strata-vision.exe'].some(n=>existsSync(join(root,n)));}catch{visionReader=false;}}const markImages=c=>c&&Array.isArray(c.families)?{...c,families:c.families.map(f=>({...f,imagesCapable:!!f.images,images:!!f.images&&visionReader,sizes:(f.sizes??[]).map(s=>({...s,imagesCapable:!!s.images,images:!!s.images&&visionReader}))}))}:c;snapshot={available:true,repo:packaged?status.installDir:repo(),version:packaged?(control.version??null):await execute('git',['describe','--tags','--always'],repo()).then(s=>s.trim()).catch(()=>null),summary:status.summary,catalog:markEngine(packaged?markImages(catalog):catalog,status.engine),engineInfo:{version:status.engine?.version??null,source:status.engine?.source??null},visionReader:packaged?visionReader:true,installed:installedInfo(status.installed),hardware:status.hardware,error:null,install:status.install,external:status.running??null,...(packaged?{packaged:true,installDir:status.installDir,engine:status.engine,installerError:status.installerError}:{})};lastRead=Date.now();if(status.install?.running&&![...jobs.values()].some(j=>j.state==='running'))begin('install',j=>watchInstall(j,status.install));}catch(error){snapshot={...snapshot,available:false,error:error.message};lastRead=Date.now();}emit();return state();})().finally(()=>{refreshing=null;});const run=refreshing;if(!force&&snapshot.available){run.catch(()=>{});return state();}return run;
}
diff --git a/apps/host/src/components/SettingsUpdates.tsx b/apps/host/src/components/SettingsUpdates.tsx
index 3a35dc4d3..80c5bdcf9 100644
--- a/apps/host/src/components/SettingsUpdates.tsx
+++ b/apps/host/src/components/SettingsUpdates.tsx
@@ -9,6 +9,7 @@ import { NativeProgress } from './NativeModels';
import { jobErrorText } from '../lib/native-job-diagnostics';
import { appVersionLabel } from '../lib/app-version';
import { fetchUpdateCheck, publishUpdateCheck, useInstalledVersions, useLastUpdateCheck } from '../lib/update-check';
+import { shownEngineVersion } from '../lib/engine-version';
/** A check from an earlier day shows its date too, because the result is kept between visits. */
function checkedLabel(at: string) {
const when = new Date(at), sameDay = when.toDateString() === new Date().toDateString();
@@ -30,7 +31,7 @@ export function SettingsUpdates() {
const [error, setError] = useState('');
const request = useRef<AbortController | null>(null);
useEffect(() => () => request.current?.abort(), []);
- const installed = component === 'strata' ? appVersion : native?.available ? (native.installed?.engine?.version ?? 'Not installed') : engineVersion;
+ const installed = component === 'strata' ? appVersion : native?.available ? (native.installed?.engine?.version ?? 'Not installed') : shownEngineVersion(native, engineVersion);
const active = native?.jobs.find(j => j.state === 'running');
const result = checking || error ? null : (fresh ?? last);
async function operate(kind: string) {
@@ -78,7 +79,7 @@ export function SettingsUpdates() {
return <>
<div className="settings-versions" aria-busy={checking}>
{tr(versionRow('Strata', appVersion, result?.strata))}
- {tr(versionRow('Engine', native?.available ? (native.installed?.engine?.version ?? 'Not installed') : engineVersion, result?.engine))}
+ {tr(versionRow('Engine', native?.available ? (native.installed?.engine?.version ?? 'Not installed') : shownEngineVersion(native, engineVersion), result?.engine))}
<div className="settings-update-actions"><Btn size="sm" icon="refresh" disabled={checking} className={checking ? 'settings-update-checking' : undefined} onClick={() => void check()}>{tr(checking ? 'Checking…' : error || result?.strata.status === 'error' ? 'Try again' : result ? 'Check again' : 'Check for updates')}</Btn><Btn size="sm" variant="ghost" onClick={() => setRollback(true)}>{tr("Roll back\u2026")}</Btn></div>
<div className="settings-update-inline" role="status" aria-live="polite">{tr(checking ? 'Checking for new versions…' : error ? <span className="inline-error">{tr(error)}</span> : result ? <><span className="sr-only">{tr(result.strata.message)} {tr(result.engine.message)} </span>{tr("Checked at ")}{tr(checkedLabel(result.checkedAt))}</> : null)}</div>
</div>
@@ -100,6 +101,6 @@ export function AboutVersions() {
const native = useNative();
const app = appVersionLabel(useStore(s => s.setup?.app.version), native?.version);
const engineVersion = useStore(s => s.engine?.engine.version);
- const engine = native?.available ? native.installed?.engine?.version : engineVersion;
+ const engine = shownEngineVersion(native, engineVersion);
return <p className="settings-about-version"><strong>{tr("Strata")} {app ?? ''}</strong>{engine ? <span className="muted"> · {tr("Engine")} {engine}</span> : null}</p>;
}
diff --git a/apps/host/src/lib/engine-version.ts b/apps/host/src/lib/engine-version.ts
new file mode 100644
index 000000000..1448cc05b
--- /dev/null
+++ b/apps/host/src/lib/engine-version.ts
@@ -0,0 +1,8 @@
+/** The host's design-mode placeholder for the engine version; it is not an engine anyone installed. */
+const PLACEHOLDER_ENGINE = /^strata-engine 0\.1\.0$/;
+/** The engine version the app shows: the installed engine's once the host has read it; until then nothing (never the placeholder). */
+export function shownEngineVersion(native: { available?: boolean; installed?: { engine?: { version?: string | null } | null } | null } | null | undefined, storeVersion: string | undefined): string | undefined {
+ if (native?.available) return native.installed?.engine?.version ?? undefined;
+ return storeVersion && !PLACEHOLDER_ENGINE.test(storeVersion) ? storeVersion : undefined;
+}
+
diff --git a/apps/host/src/lib/update-check.ts b/apps/host/src/lib/update-check.ts
index e2ad594c8..16acc1717 100644
--- a/apps/host/src/lib/update-check.ts
+++ b/apps/host/src/lib/update-check.ts
@@ -2,6 +2,7 @@ import { useEffect, useState } from 'react';
import { useStore } from './store';
import { useNative } from './native';
import { appVersionLabel } from './app-version';
+import { shownEngineVersion } from './engine-version';
import { readUpdateCache, saveUpdateCache, type InstalledVersions } from './update-cache';
import type { UpdateCheckResult } from './types';
@@ -10,7 +11,7 @@ export function useInstalledVersions(): InstalledVersions {
const native = useNative();
const engineVersion = useStore(s => s.engine?.engine.version);
const appVersion = appVersionLabel(useStore(s => s.setup?.app.version), native?.version);
- return { appVersion: appVersion ?? null, engineVersion: (native?.available ? native.installed?.engine?.version : engineVersion) ?? null, controlVersion: native?.version ?? null };
+ return { appVersion: appVersion ?? null, engineVersion: shownEngineVersion(native, engineVersion) ?? null, controlVersion: native?.version ?? null };
}
/** The one place the app asks the host to check for updates. Called only from a button press. */
diff --git a/apps/host/tests/engine-version.test.mjs b/apps/host/tests/engine-version.test.mjs
index f1638fa59..5e0bac902 100644
--- a/apps/host/tests/engine-version.test.mjs
+++ b/apps/host/tests/engine-version.test.mjs
@@ -1,61 +1,11 @@
import test from 'node:test';
import assert from 'node:assert/strict';
-import { readFile } from 'node:fs/promises';
-import { engineRefusal, engineTooOld, markEngine, parseEngineVersion } from '../server/engine-version.mjs';
-import { nativeFixture } from './helpers/native-fixture.mjs';
-
-test('engine versions compare as numbers, a missing part counting as zero', () => {
- assert.deepEqual(parseEngineVersion('0.1.45.3'), [0, 1, 45, 3]);
- assert.deepEqual(parseEngineVersion('v0.1.45'), [0, 1, 45]);
- assert.equal(parseEngineVersion('dev'), null);
- assert.equal(engineTooOld('0.1.45', '0.1.45.1'), true, 'the released 0.1.45 stops at v4 files: too old for Gyro');
- assert.equal(engineTooOld('0.1.45.1', '0.1.45.1'), false);
- assert.equal(engineTooOld('0.1.45.3', '0.1.45.1'), false);
- assert.equal(engineTooOld('0.1.46', '0.1.45.1'), false);
- assert.equal(engineTooOld('0.1.44.1', '0.1.45.1'), true);
- assert.equal(engineTooOld('0.1.45', null), false, 'no minimum: never too old');
- assert.equal(engineTooOld(null, '0.1.45.1'), false, 'an unreadable version is not called too old');
- assert.equal(engineTooOld('0.1.40', '0.1.45.1', 'local'), false, 'an engine built from this checkout has it whatever its number says');
-});
-
-const catalog = () => ({ families: [{ family: 'qwen', sizes: [{ id: 'q2_0', model: 'Q2_0', engine_min: null }] }, { family: 'gyro', sizes: [{ id: 'gyro-gyro-s', model: 'Gyro-S', engine_min: '0.1.45.1' }, { id: 'gyro-gyro-m', model: 'Gyro-M', engine_min: '0.1.45.1' }] }] });
-
-test('the catalog marks the sizes an older engine cannot read; the refusal says what to do', () => {
- const marked = markEngine(catalog(), { version: '0.1.45' });
- assert.deepEqual(marked.families.flatMap(f => f.sizes.map(s => [s.id, s.needsNewerEngine])), [['q2_0', false], ['gyro-gyro-s', true], ['gyro-gyro-m', true]]);
- const text = engineRefusal(marked, 'gyro-gyro-s', { version: '0.1.45' });
- assert.match(text, /^This model needs a newer engine: Gyro-S needs engine 0\.1\.45\.1 or newer, and this one is 0\.1\.45\. Update the engine in Settings, then try again\.$/);
- assert.equal(engineRefusal(marked, 'q2_0', { version: '0.1.45' }), null);
- const fresh = markEngine(catalog(), { version: '0.1.45.3' });
- assert.ok(fresh.families.every(f => f.sizes.every(s => !s.needsNewerEngine)));
- assert.equal(markEngine(null, {}), null);
-});
-
-test('with an older engine installed the app refuses to download or load Gyro, with the plain sentence; a new enough engine goes on', async () => {
- const old = nativeFixture({ engineStatus: { version: '0.1.45', backend: 'cuda' } });
- try {
- old.catalog.families.push({ family: 'gyro', title: 'Qwen3.8-Flash-Next (Gyro)', about: '', images: false, sizes: [{ id: 'iq2_xs', model: 'Gyro-S', download_gb: 58, ram_needed_gb: 28, about: '', on_this_pc: 'fits', installed: true, engine_min: '0.1.45.1' }] });
- old.catalog.families[0].sizes[0].engine_min = '0.1.45.1';
- const state = await old.control.refresh(true);
- const sizes = state.catalog.families.flatMap(f => f.sizes);
- assert.ok(sizes.find(s => s.engine_min).needsNewerEngine);
- const id = sizes.find(s => s.engine_min).id;
- assert.throws(() => old.control.operation('load', { model: id }), /This model needs a newer engine: .* needs engine 0\.1\.45\.1 or newer, and this one is 0\.1\.45\./);
- assert.throws(() => old.control.operation('install', { model: id }), /needs a newer engine/);
- assert.equal(old.control.state().jobs.length, 0, 'nothing was started');
- } finally { await old.cleanup(); }
- const ok = nativeFixture({ engineStatus: { version: '0.1.45.3', backend: 'cuda' } });
- try {
- ok.catalog.families[0].sizes[0].engine_min = '0.1.45.1';
- const state = await ok.control.refresh(true);
- assert.ok(state.catalog.families[0].sizes.every(s => !s.needsNewerEngine));
- } finally { await ok.cleanup(); }
-});
-
-test('the screens use the existing "needs a newer engine" notice for a size, and the buttons are held back', async () => {
- const models = await readFile(new URL('../src/components/NativeModels.tsx', import.meta.url), 'utf8');
- assert.match(models, /selectedFamily && \(!selectedSize \|\| selectedSize\.needsNewerEngine\) \? <><h2 className="h3">\{tr\("This model needs a newer engine\."\)\}/);
- assert.match(models, /!!selectedSize\.needsNewerEngine\}/);
- const guided = await readFile(new URL('../src/components/GuidedSetup.tsx', import.meta.url), 'utf8');
- assert.equal((guided.match(/needsNewerEngine/g) ?? []).length, 3);
+import { shownEngineVersion } from '../src/lib/engine-version.ts';
+
+test('About never shows the host placeholder engine version while the real one is still being read', () => {
+ assert.equal(shownEngineVersion({ available: false }, 'strata-engine 0.1.0'), undefined);
+ assert.equal(shownEngineVersion(null, 'strata-engine 0.1.0'), undefined);
+ assert.equal(shownEngineVersion({ available: true, installed: { engine: { version: '0.1.48' } } }, 'strata-engine 0.1.0'), '0.1.48');
+ assert.equal(shownEngineVersion({ available: true, installed: { engine: null } }, 'strata-engine 0.1.0'), undefined);
+ assert.equal(shownEngineVersion({ available: false }, 'strata-engine 0.1.51'), 'strata-engine 0.1.51');
});