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++
Models page: a neutral placeholder until the engine's first answer, not the bundled Starter (#3740)
Niko1221e61b7024cfad
diff --git a/apps/host/src/lib/native.ts b/apps/host/src/lib/native.tsindex 3dfbf0680..9e8588a8b 100644--- a/apps/host/src/lib/native.ts+++ b/apps/host/src/lib/native.ts@@ -15,6 +15,10 @@ export interface NativeState {visionReader?: boolean;available:boolean;repo:string;downloadDirectory?:string;/** Free bytes on the drive that holds the models folder. */downloadFreeBytes?:number|null;downloadTotalBytes?:number|null;version?:string|null;summary:string;error:string|null;catalog:{families:NativeFamily[];contexts:number[];recommendation:{family:string|null;model:string|null;context?:number;why?:string};context_note:string}|null;installed:{models:{model:string;config:string;model_name:string;ready:boolean;/** The picture-reading files are on this computer (notes-split-agent8.md, item 8). */visionPrepared?:boolean;context?:number;kv?:string;images?:string;visionEnabled?:boolean;visionDevice?:string;lowRamMode?:string;resourceProfile?:'work'|'performance';/** The Drafting choice saved with the model: auto | mtp | dflash2 | off. */drafting?:string;dataFolder?:string;diskGb?:number;diskBytes?:number;/** Files this model shares with another (the picture reader, the draft layer): counted once, in `usage`. */sharedBytes?:number;/** What Delete frees: files in Strata's own folders that no other model uses. */removableGb?:number;missing_files?:string[]}[];/** What all models take on disk, from their real files, shared files counted once. */usage?:{total_bytes:number;total_gb:number;shared_bytes:number;shared_gb:number;models:Record<string,{bytes:number;gb:number}>}|null;data_folder:string;engine:{version:string|null}}|null;hardware:{ram_gb:number;engine_vendor?:string;gpus:{index:number;name:string;vram_gb:number;usable:boolean;/** SMs x clock: only the order between cards matters (strata_control/gpu_roles.py). */speed?:number;vendor?:string;uma?:boolean;integrated?:boolean;unified_gb?:number;problem?:string|null}[]}|null;fields:NativeField[];instances:NativeInstance[];defaultId:string|null;jobs:NativeJob[];capabilities:{/** The engine serves DFlash2 (Control says): the Drafting choice then offers it. */dflash2?:boolean;responses?:boolean;updates:boolean;rollback:boolean;calibration:boolean;componentUpdates?:boolean}}let state:NativeState|null=null;const listeners=new Set<()=>void>();+/** True once the first read of the native state has ended, whatever its answer: until then the Models page must not pick a model of its own (#3740). */+let settled=false;+export const nativeSettled=()=>settled;+export function subscribeNative(fn:()=>void){listeners.add(fn);return()=>{listeners.delete(fn);};}function put(value:NativeState){if(state&&JSON.stringify(state)===JSON.stringify(value))return;state=value;listeners.forEach(fn=>fn());}/** The host pushes its whole native state (jobs included) at every progress step: the page shows it at once, without waiting for the next poll. */export function applyNativeEvent(value:unknown){if(value&&typeof value==='object'&&'available' in value&&'jobs' in value)put(value as NativeState);}@@ -24,7 +28,7 @@ function read(force:boolean):Promise<void>{// A read that never answers must not freeze the page: after the limit the next poll starts a fresh one.let stop:ReturnType<typeof setTimeout>|undefined;const limit=new Promise<never>((_,reject)=>{stop=setTimeout(()=>reject(new Error('The host did not answer in time.')),READ_LIMIT_MS);});- return Promise.race([request,limit]).then(put).catch(error=>{if(state){state={...state,error:error.message,instances:state.instances.map(i=>({...i,metrics:null,phase:'unavailable'}))};listeners.forEach(fn=>fn());}}).finally(()=>clearTimeout(stop));+ return Promise.race([request,limit]).then(put).catch(error=>{if(state){state={...state,error:error.message,instances:state.instances.map(i=>({...i,metrics:null,phase:'unavailable'}))};listeners.forEach(fn=>fn());}}).finally(()=>{clearTimeout(stop);if(!settled){settled=true;listeners.forEach(fn=>fn());}});}/* Two kinds of read that never wait for each other: the light poll (the host answers at once with the jobs it holds) and the forced read after an action (the hostre-reads the installation, which can take many seconds while a download is writing). A slow forced read used to hold every later poll, so a running download looked stuck. */diff --git a/apps/host/src/screens/ModelRun.tsx b/apps/host/src/screens/ModelRun.tsxindex d36745448..56f92aff0 100644--- a/apps/host/src/screens/ModelRun.tsx+++ b/apps/host/src/screens/ModelRun.tsx@@ -1,5 +1,5 @@import { tr } from '../lib/i18n';-import { useEffect, useMemo, useRef, useState } from 'react';+import { useEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react';import { ActionError, Btn, Dialog, ErrorNotice, Icon, Select } from '../components/ui';import { Screen } from '../components/layout';import { DemoTest } from '../components/EngineExperience';@@ -24,7 +24,7 @@ import { familyVersion, modelFamilies } from '../lib/model-versions';import { sizeGb } from '../lib/format';import { applyImageModel, getState, useLifecycle, loadRuntimeModel, loadVariant, pushToast, restartEngine, saveEngine, selectImageModel, setConfigDraft, useStore, validateEngine } from '../lib/store';import type { ImageModelChoice, RuntimeModels, RuntimeModel } from '../lib/types';-import { useNative } from '../lib/native';+import { useNative, nativeSettled, subscribeNative } from '../lib/native';import { NativeModels } from '../components/NativeModels';import { NativeLocalModel } from '../components/NativeLocalModel';import { parseLocation } from '../lib/router';@@ -35,8 +35,12 @@ type Issue = {type RunStage = 'idle' | 'checking' | 'loading' | 'ready';export function ModelRunScreen() {const native = useNative();+ const settled = useSyncExternalStore(subscribeNative, nativeSettled);const location = parseLocation(window.location.hash), entry = location.param;const [other, setOther] = useState(entry === 'local' || entry === 'local-import'), [importFirst, setImportFirst] = useState(entry === 'local-import');+ // Before the engine's answer arrives the page would show the bundled Starter and then jump to the installed model (#3740): show a neutral placeholder instead.+ if (!native && !settled)+ return <div className="main__body"><div className="wrap stack" role="status" aria-label={tr("Loading…")}><div className="skel" style={{ height: 20, width: '60%' }}/><div className="skel" style={{ height: 20, width: '80%' }}/><div className="skel" style={{ height: 20, width: '70%' }}/></div></div>;if (native && other)return <NativeLocalModel onBack={() => { setOther(false); setImportFirst(false); }}/>;if (native && !other)diff --git a/apps/host/tests/native-settled.test.mjs b/apps/host/tests/native-settled.test.mjsnew file mode 100644index 000000000..6283fd418--- /dev/null+++ b/apps/host/tests/native-settled.test.mjs@@ -0,0 +1,21 @@+import test from 'node:test';+import assert from 'node:assert/strict';+import { build } from 'esbuild';++const compiled = await build({ stdin: { contents: "export * from './src/lib/native';", resolveDir: process.cwd() }, bundle: true, write: false, platform: 'node', format: 'esm' });+const lib = await import(`data:text/javascript;base64,${Buffer.from(compiled.outputFiles[0].text).toString('base64')}`);++test('the Models page waits for the first native answer before it picks a model (#3740)', async () => {+ let release;+ globalThis.fetch = () => new Promise(resolve => { release = () => resolve({ ok: true, status: 200, statusText: 'OK', text: async () => JSON.stringify({ available: true, jobs: [], instances: [] }) }); });+ let heard = 0;+ const off = lib.subscribeNative(() => { heard++; });+ assert.equal(lib.nativeSettled(), false, 'nothing read yet: show a placeholder, not the Starter');+ const reading = lib.refreshNative();+ assert.equal(lib.nativeSettled(), false);+ release();+ await reading;+ assert.equal(lib.nativeSettled(), true);+ assert.ok(heard >= 1, 'the page is told');+ off();+});