diff --git a/apps/host/server/engine-step.mjs b/apps/host/server/engine-step.mjs
index da774247..1274c7b5 100644
--- a/apps/host/server/engine-step.mjs
+++ b/apps/host/server/engine-step.mjs
@@ -75,8 +75,11 @@ export function createEngineStep({ control, signal = null, onChange = () => {} }
const modelRemaining = Number.isFinite(model?.remaining_gb) ? model.remaining_gb : null;
const active = !['done', 'current', 'skipped', 'failed'].includes(part.state);
const engineRemaining = active || part.state === 'done' ? Math.max(0, part.total_gb - part.done_gb) : 0;
+ /* The install knows its files (strata_mcp files_progress): the model's parts and the picture reader, each counted. Without that, one
+ model part from the combined figures. The engine is added either way. */
+ const own = Array.isArray(install.parts) && install.parts.some(p => p?.kind === 'model') ? install.parts.filter(p => p?.kind !== 'engine') : null;
const parts = [
- { kind: 'model', name: model?.file ?? install.model ?? 'Model', state: install.running === false ? 'done' : 'downloading', done_gb: modelDone ?? 0, total_gb: round((modelDone ?? 0) + (modelRemaining ?? 0)) },
+ ...(own ?? [{ kind: 'model', name: model?.file ?? install.model ?? 'Model', state: install.running === false ? 'done' : 'downloading', done_gb: modelDone ?? 0, total_gb: round((modelDone ?? 0) + (modelRemaining ?? 0)) }]),
{ ...part },
];
const merged = { ...install, engine: { ...part }, parts };
diff --git a/apps/host/server/native-control.mjs b/apps/host/server/native-control.mjs
index a7c1c8f9..1a99dbba 100644
--- a/apps/host/server/native-control.mjs
+++ b/apps/host/server/native-control.mjs
@@ -355,7 +355,7 @@ return {summary:result.summary??'Deleted',removed:result.plan?.gb??null};}
const room=args.resourceProfile==='work';
return autotuner.start(job,job.kind==='recheck'?'recheck':'tune',{configPath:path,presetId:args.presetId,mode:args.mode,use:args.use,goal:room?'room':'speed',leaveRam:room?20:0,allowSmallDifferences:args.allowSmallDifferences===true,name:args.name},{onProgress:p=>{job.summary=p.text??job.summary;emit();}});
}
- function operation(kind,args={}){if(!['install','load','benchmark','tune','autotune','recheck','calibrate','update-engine','update-strata','rollback','remove'].includes(kind))throw new Error('Choose a supported native operation.');if(!snapshot.available)throw new Error(snapshot.error??'Connect the native Strata installation first.');if(kind==='install'||kind==='load'){const refusal=engineRefusal(snapshot.catalog,args.model,snapshot.engineInfo);if(refusal)throw new Error(refusal);}return begin(kind,job=>kind==='install'?install(job,args):kind==='load'?loadEngine(job,args):kind==='benchmark'?benchmark(job,args):kind==='tune'?tune(job,args):kind==='autotune'||kind==='recheck'?autotune(job,args):kind==='remove'?removeModel(job,args):program(job,args),{guided:args.guided===true,model:args.model});}
+ function operation(kind,args={}){if(!['install','load','benchmark','tune','autotune','recheck','calibrate','update-engine','update-strata','rollback','remove'].includes(kind))throw new Error('Choose a supported native operation.');if(!snapshot.available)throw new Error(snapshot.error??'Connect the native Strata installation first.');if(kind==='install'||kind==='load'){const refusal=engineRefusal(snapshot.catalog,args.model,snapshot.engineInfo);if(refusal)throw new Error(refusal);}return begin(kind,job=>kind==='install'?install(job,args):kind==='load'?loadEngine(job,args):kind==='benchmark'?benchmark(job,args):kind==='tune'?tune(job,args):kind==='autotune'||kind==='recheck'?autotune(job,args):kind==='remove'?removeModel(job,args):program(job,args),{guided:args.guided===true,model:args.model,...(args.family?{family:args.family}:{})});}
async function cancel(id){const job=jobs.get(id);if(!job||job.state!=='running')throw new Error('This operation is no longer running.');if(job.kind==='install'){job.engineAbort?.abort();await tool('strata_install',{cancel:true});}else if(job.abort)job.abort.abort();else if(job.process){if(!['tune','calibrate','autotune','recheck'].includes(job.kind))throw new Error('File updates cannot be cancelled safely while files are being replaced.');job.state='cancelled';await stopProcess(job.process);}job.state='cancelled';job.summary=job.kind==='install'?'Stopped. Completed downloads are kept.':'Stopped.';emit();return state();}
async function close(){closing=true;clearInterval(timer);const installing=packaged&&child&&[...jobs.values()].some(j=>j.kind==='install'&&j.state==='running');if(installing)await send('tools/call',{name:'strata_install',arguments:{cancel:true}},15000).catch(()=>{});const operations=[];for(const job of jobs.values()){job.abort?.abort();if(job.process)operations.push(stopProcess(job.process));if(job.state==='running')job.state='cancelled';}await Promise.all(operations);await Promise.all([...instances.keys()].map(id=>unload(id,true).catch(()=>{})));disconnect();}
// Remove nonserializable process references from public jobs.
diff --git a/apps/host/src/components/DownloadParts.tsx b/apps/host/src/components/DownloadParts.tsx
new file mode 100644
index 00000000..0827ad02
--- /dev/null
+++ b/apps/host/src/components/DownloadParts.tsx
@@ -0,0 +1,17 @@
+import { tr } from '../lib/i18n';
+
+export interface InstallPart { kind?: string; name?: string; state?: string; done_gb?: number; total_gb?: number; files_done?: number; files_total?: number }
+
+/**
+ * The parts of a download, one line each: the model (with "2/4" when it comes in parts), the picture reader, the engine. A model in several
+ * parts is only downloaded when every line says Done, so a person can see which part is under way instead of one bar that restarts.
+ */
+export function DownloadParts({ parts }: { parts: InstallPart[] | undefined }) {
+ if (!parts || parts.length < 2) return null;
+ return
{tr("This model can read pictures, but the engine installed here does not include the picture reader yet, so Read pictures is off. Update the engine in Settings → About to turn it on.")}
: null)}{tr(error ? : null)}; }
diff --git a/apps/host/src/components/VersionPicker.tsx b/apps/host/src/components/VersionPicker.tsx
index b173a737..c0b9e726 100644
--- a/apps/host/src/components/VersionPicker.tsx
+++ b/apps/host/src/components/VersionPicker.tsx
@@ -3,14 +3,16 @@ import { tr } from '../lib/i18n';
import { Icon } from './ui';
import { FloatingMenu } from './FloatingMenu';
import { cx } from '../lib/format';
-import type { CatalogVersion } from '../lib/native-catalog';
-import { RECOMMENDED, VERSION_GROUPS, fitOn, groupOpen, type FitHardware } from '../lib/native-fit';
+import { versionNote, type CatalogVersion } from '../lib/native-catalog';
+import { nvfp4Version } from '../lib/native-names';
+import { VERSION_GROUPS, fitOn, groupOpen, recommendedVersions, type FitHardware } from '../lib/native-fit';
/** The name a version goes by in the list: the quantization, with the maker where the quantization alone is ambiguous. */
export function versionName(v: CatalogVersion, withMaker = false): string {
switch (v.sourceFamily) {
case 'swift': return `Swift ${v.model}`;
case 'unsloth': return `Unsloth ${v.model}`;
+ case 'nvfp4': return tr(nvfp4Version(v.model)?.name ?? v.model);
case 'coder': return `Coder ${v.model}`;
case 'qwen': return withMaker ? `${v.model} (GSQ-RCO)` : v.model;
default: return v.model;
@@ -24,43 +26,52 @@ const gb = (n: number) => `${Number.isInteger(n) ? n : n.toFixed(1)} GB`;
* which stays on the SSD, is not in it); the download size is secondary. "Uses SSD N GB" appears only where this computer would read
* part of the model from its SSD. The first group is a fixed list of four; the rest fold away.
*/
-export function VersionPicker({ versions, selectedId, hardware, onSelect, onOwnGguf }: {
+export function VersionPicker({ versions, selectedId, hardware, onSelect, onOwnGguf, downloaded, showRecommended = true, moreLabel }: {
versions: CatalogVersion[];
selectedId: string;
hardware: FitHardware | null | undefined;
onSelect: (id: string) => void;
onOwnGguf: () => void;
+ /** The versions already on this computer (ready to load): each gets a small "Downloaded" tag. */
+ downloaded?: ReadonlySet;
+ /** False where the recommended four are shown elsewhere (the first-run page): the menu then holds only the groups. */
+ showRecommended?: boolean;
+ /** What the button says while the selected version is one of the recommended four shown elsewhere. */
+ moreLabel?: string;
}) {
const trigger = useRef(null);
const [open, setOpen] = useState(false);
// A group is open when the person opened it; until they touch it, only the group that holds the selected version is open.
const [opened, setOpened] = useState>({});
const selected = versions.find(v => v.id === selectedId);
- const recommended = RECOMMENDED.map(r => ({ r, v: versions.find(v => v.sourceFamily === r.family && v.model === r.model) })).filter((x): x is { r: typeof RECOMMENDED[number]; v: CatalogVersion } => !!x.v);
+ const recommended = recommendedVersions(versions);
+ // Where the recommended four are shown outside the menu, the menu holds only the others.
+ const apart = new Set(showRecommended ? [] : recommended.map(x => x.v.id));
+ const rest = versions.filter(v => !apart.has(v.id));
const groups = [
- ...VERSION_GROUPS.map(g => ({ id: g.id, title: g.title, items: versions.filter(v => g.families.includes(v.sourceFamily)) })),
- { id: 'other', title: 'Qwen3.6 models', items: versions.filter(v => !VERSION_GROUPS.some(g => g.families.includes(v.sourceFamily))) },
+ ...VERSION_GROUPS.map(g => ({ id: g.id, title: g.title, items: rest.filter(v => g.families.includes(v.sourceFamily)) })),
+ { id: 'other', title: 'Qwen3.6 models', items: rest.filter(v => !VERSION_GROUPS.some(g => g.families.includes(v.sourceFamily))) },
].filter(g => g.items.length);
const row = (v: CatalogVersion, label: string, note?: string) => {
const fit = fitOn(v, hardware);
const on = v.id === selectedId;
+ const line = versionNote(v.model);
return ;
};
- const fit = selected ? fitOn(selected, hardware) : null;
+ const fit = selected && !apart.has(selected.id) ? fitOn(selected, hardware) : null;
return <>
{tr(open ? setOpen(false)}>
diff --git a/apps/host/src/lib/client.ts b/apps/host/src/lib/client.ts
index 7dd3f1ca..1b80353f 100644
--- a/apps/host/src/lib/client.ts
+++ b/apps/host/src/lib/client.ts
@@ -47,7 +47,7 @@ export interface StreamEvent {
export function onEvent(handler: (e: StreamEvent) => void, onStatus?: (s: 'live' | 'offline') => void) {
let source: EventSource;
let seenAt = Date.now();
- const names = ['engine', 'monitor', 'models', 'image-models', 'runtime', 'providers', 'serving', 'download', 'log', 'setup', 'skills', 'task', 'goal', 'timeskip', 'plan', 'queue'];
+ const names = ['engine', 'monitor', 'models', 'native', 'image-models', 'runtime', 'providers', 'serving', 'download', 'log', 'setup', 'skills', 'task', 'goal', 'timeskip', 'plan', 'queue'];
const connect = () => {
source?.close();
seenAt = Date.now();
diff --git a/apps/host/src/lib/download-eta.ts b/apps/host/src/lib/download-eta.ts
index 64b5c556..5d02f905 100644
--- a/apps/host/src/lib/download-eta.ts
+++ b/apps/host/src/lib/download-eta.ts
@@ -53,3 +53,22 @@ export function installProgress(install: InstallParts | undefined): { done_gb: n
if (d && Number.isFinite(d.done_gb) && Number.isFinite(d.total_gb)) return { done_gb: d.done_gb!, total_gb: d.total_gb!, remaining_gb: Number.isFinite(d.remaining_gb) ? d.remaining_gb! : Math.max(0, d.total_gb! - d.done_gb!), percent: d.percent ?? 0, file: d.file };
return undefined;
}
+
+/** Which part of a multi-part install is being fetched now: the model's parts (with "part 2 of 4"), the picture reader or the engine. */
+export interface InstallStage { kind: 'model' | 'vision' | 'engine' | 'other'; index?: number; count?: number }
+export function installStage(install: { parts?: { kind?: string; state?: string; files_done?: number; files_total?: number }[]; running?: boolean } | undefined): InstallStage | undefined {
+ const parts = install?.parts ?? [];
+ const now = parts.find(p => p.state === 'downloading') ?? parts.find(p => !['done', 'current', 'skipped', 'failed'].includes(p.state ?? ''));
+ if (!now) return undefined;
+ const kind = now.kind === 'model' || now.kind === 'vision' || now.kind === 'engine' ? now.kind : 'other';
+ const count = Number(now.files_total) > 1 ? Number(now.files_total) : undefined;
+ return { kind, ...(count ? { index: Math.min(count, Number(now.files_done ?? 0) + 1), count } : {}) };
+}
+/** The sentence for it, in plain words. */
+export function stageText(stage: InstallStage | undefined): string {
+ if (!stage) return tr('Downloading model files…');
+ if (stage.kind === 'vision') return tr('Downloading the picture reader…');
+ if (stage.kind === 'engine') return tr('Downloading the engine for this PC…');
+ if (stage.count && stage.index) return tr('Downloading model files · part {0} of {1}', [stage.index, stage.count]);
+ return tr('Downloading model files…');
+}
diff --git a/apps/host/src/lib/kept-state.ts b/apps/host/src/lib/kept-state.ts
new file mode 100644
index 00000000..2d162640
--- /dev/null
+++ b/apps/host/src/lib/kept-state.ts
@@ -0,0 +1,23 @@
+import { useCallback, useEffect, useState, type Dispatch, type SetStateAction } from 'react';
+
+/**
+ * A piece of screen state that survives leaving the screen. The Models page keeps its choices (version, context, computer use, picture
+ * reading ...) in useState, so going to Monitor and back reset them and a person lost track of what they were downloading. Kept values
+ * live in memory for the whole session (not on disk: a new start begins from the installed model again).
+ */
+const kept = new Map();
+
+export function useKept(key: string, initial: T): [T, Dispatch>] {
+ const [value, setValue] = useState(() => (kept.has(key) ? kept.get(key) as T : initial));
+ useEffect(() => { kept.set(key, value); }, [key, value]);
+ const set = useCallback>>(next => setValue(old => {
+ const result = typeof next === 'function' ? (next as (o: T) => T)(old) : next;
+ kept.set(key, result);
+ return result;
+ }), [key]);
+ return [value, set];
+}
+
+export const keptValue = (key: string): T | undefined => kept.get(key) as T | undefined;
+/** Forget everything kept (tests, and a changed installation). */
+export const forgetKept = () => kept.clear();
diff --git a/apps/host/src/lib/native-catalog.ts b/apps/host/src/lib/native-catalog.ts
index aee650b4..92f983f7 100644
--- a/apps/host/src/lib/native-catalog.ts
+++ b/apps/host/src/lib/native-catalog.ts
@@ -1,9 +1,12 @@
import type {NativeFamily,NativeSize} from './native';
import {tr} from './i18n';
+import {nvfp4Version} from './native-names';
export interface CatalogVersion extends NativeSize{sourceFamily:string;edition:string;images:boolean}
export interface CatalogModel extends Omit{sizes:CatalogVersion[]}
-export function nativeVersionLabel(model:string){return tr(({Q2_0:'Fastest',IQ2_XS:'Compact',IQ3_XXS:'Balanced',IQ3_S:'High quality',IQ1_M:'Coding','Gyro-S':'Smallest','Gyro-M':'Small memory'} as Record)[model]??model);}
+export function nativeVersionLabel(model:string){const nv=nvfp4Version(model);if(nv)return tr(nv.name);return tr(({Q2_0:'Fastest',IQ2_XS:'Compact',IQ3_XXS:'Balanced',IQ3_S:'High quality',IQ1_M:'Coding','Gyro-S':'Smallest','Gyro-M':'Small memory'} as Record)[model]??model);}
export const catalogVersionLabel=(version:CatalogVersion)=>{const label=nativeVersionLabel(version.model);return [tr(version.edition),label===version.model&&version.edition?'':label].filter(Boolean).join(' · ');};
+/** The one line that says how a version differs from its neighbours (the three NVFP4 versions); empty for the rest. */
+export const versionNote=(model:string)=>{const nv=nvfp4Version(model);return nv?tr(nv.note):'';};
/** Display groups are distinct from the engine's installation family IDs. */
export function nativeCatalogModels(families:NativeFamily[]):CatalogModel[]{
if(!families.length)return[];
diff --git a/apps/host/src/lib/native-fit.ts b/apps/host/src/lib/native-fit.ts
index 32250cc7..8a72c105 100644
--- a/apps/host/src/lib/native-fit.ts
+++ b/apps/host/src/lib/native-fit.ts
@@ -61,3 +61,8 @@ export const RECOMMENDED: { family: string; model: string; note: string }[] = [
/** Is a group of the version list open? What the person chose wins; until they touch it, only the group holding the selected version is open
* (the running version's group used to stay open whatever was clicked). */
export const groupOpen = (opened: Record, id: string, containsSelected: boolean): boolean => opened[id] ?? containsSelected;
+
+/** The recommended four, found in a version list (a version the catalog does not offer is skipped). */
+export function recommendedVersions(versions: V[]): { r: typeof RECOMMENDED[number]; v: V }[] {
+ return RECOMMENDED.map(r => ({ r, v: versions.find(v => v.sourceFamily === r.family && v.model === r.model) })).filter((x): x is { r: typeof RECOMMENDED[number]; v: V } => !!x.v);
+}
diff --git a/apps/host/src/lib/native-names.ts b/apps/host/src/lib/native-names.ts
index de2ef322..db71ff0f 100644
--- a/apps/host/src/lib/native-names.ts
+++ b/apps/host/src/lib/native-names.ts
@@ -4,12 +4,27 @@
*/
const FAMILIES: [string, string][] = [['swift-', 'Swift'], ['coder-', 'Coder'], ['unsloth-', 'Unsloth'], ['gyro-gyro-', 'Gyro'], ['gyro-', 'Gyro'], ['nvfp4-', 'NVFP4'], ['qwen36-', 'Qwen3.6']];
+/**
+ * The three NVFP4 versions, named by who made the weights (the plain model names NVFP4 / NVFP4-NVIDIA / NVFP4-QAD looked like the same thing):
+ * - NVFP4: Strata's own GPTQ conversion of Qwen's weights, the best quality of the three;
+ * - NVFP4-NVIDIA: NVIDIA's own NVFP4 checkpoint (plain rounding), converted for Strata, the same size and speed;
+ * - NVFP4-QAD: NVIDIA's FP4 checkpoint that was trained for FP4 (quantization-aware distillation), slightly faster on short prompts.
+ * `note` is the one line that says how they differ.
+ */
+export const NVFP4_VERSIONS: Record = {
+ 'NVFP4': { name: 'NVFP4 (Strata’s version)', note: 'Strata’s own conversion. The best quality of the NVFP4 versions.' },
+ 'NVFP4-NVIDIA': { name: 'NVFP4 (NVIDIA’s version)', note: 'NVIDIA’s own NVFP4 checkpoint, converted for Strata. Same size and speed.' },
+ 'NVFP4-QAD': { name: 'NVFP4 (NVIDIA, trained for FP4)', note: 'NVIDIA’s FP4 checkpoint, trained for FP4. Slightly faster on short prompts.' },
+};
+export const nvfp4Version = (model: string) => NVFP4_VERSIONS[String(model ?? '').toUpperCase()];
+
export function nativeShortName(id: string): string {
const lower = String(id ?? '').toLowerCase();
for (const [prefix, label] of FAMILIES) {
if (!lower.startsWith(prefix)) continue;
const rest = lower.slice(prefix.length).toUpperCase();
if (!rest) return label;
+ if (label === 'NVFP4') return nvfp4Version(rest)?.name ?? `${label} ${rest}`;
return label === 'Gyro' ? `Gyro-${rest.replace(/^GYRO-/, '')}` : `${label} ${rest}`;
}
return lower.toUpperCase() || String(id);
diff --git a/apps/host/src/lib/native.ts b/apps/host/src/lib/native.ts
index 509bef23..e30f2985 100644
--- a/apps/host/src/lib/native.ts
+++ b/apps/host/src/lib/native.ts
@@ -6,17 +6,58 @@ export interface GpuChoice {options:GpuChoiceOption[];recommended:string|null;ig
export interface NativeSize {/** The first engine that reads this size's files (the catalog), and whether the installed engine is older: the screen then says "needs a newer engine" and offers the update. */engine_min?:string|null;needsNewerEngine?:boolean;id:string;model:string;about:string;download_gb:number;ram_needed_gb:number;experts_gb:number;on_this_pc:string|null;installed:boolean;gpu_options?:GpuChoice|null;images?:boolean;imagesCapable?:boolean}
export interface NativeFamily {family:string;title:string;about:string;experimental:boolean;images:boolean;sizes:NativeSize[]}
export interface NativeField {id:string;label:string;group:string;type:'number'|'boolean'|'string'|'enum'|'array';min?:number;max?:number;choices?:string[];hint?:string;supported?:boolean}
-export interface NativeJob {id:string;kind:string;guided?:boolean;model?:string;state:'running'|'done'|'error'|'cancelled';startedAt:string;summary:string;error:string|null;details?:string;result:Record|null;progress?:Record|null}
+export interface NativeJob {id:string;kind:string;guided?:boolean;model?:string;family?:string;state:'running'|'done'|'error'|'cancelled';startedAt:string;summary:string;error:string|null;details?:string;result:Record|null;progress?:Record|null}
export interface NativeInstance {id:string;apiModelId:string;model:string;label:string;aliases?:string[];vision?:boolean;resourceProfile?:'work'|'performance'|null;context?:number;port:number;gpus:number[];status:'loading'|'ready'|'unloading'|'error';phase:string;loadedAt:string;error:string|null;metrics:Record|null}
export interface NativeState {
/** The picture reader (strata-vision) is installed with the engine, so models marked for pictures can read them here. */
visionReader?: boolean;available:boolean;repo:string;downloadDirectory?:string;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';dataFolder?:string;diskGb?:number;diskBytes?:number;missing_files?:string[]}[];data_folder:string;engine:{version:string|null}}|null;hardware:{ram_gb:number;gpus:{index:number;name:string;vram_gb:number;usable:boolean}[]}|null;fields:NativeField[];instances:NativeInstance[];defaultId:string|null;jobs:NativeJob[];capabilities:{responses?:boolean;updates:boolean;rollback:boolean;calibration:boolean;componentUpdates?:boolean}}
-let state:NativeState|null=null,timer:ReturnType|null=null,reading:Promise|null=null;
+let state:NativeState|null=null;
const listeners=new Set<()=>void>();
-let again=false;
+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);}
+const READ_LIMIT_MS=20000;
+function read(force:boolean):Promise{
+ const request=api.get(`/api/native${force?'?refresh=1':''}`);
+ // A read that never answers must not freeze the page: after the limit the next poll starts a fresh one.
+ let stop:ReturnType|undefined;
+ const limit=new Promise((_,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));
+}
+/* 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 host
+ re-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. */
+let light:Promise|null=null,forced:Promise|null=null,again=false;
/** A forced refresh (after an action) never joins a read that began before the action: that read cannot know about the new job. It waits for it, then reads again. */
-export function refreshNative(force=false):Promise{if(reading){if(!force)return reading;if(again)return reading;again=true;return reading.then(()=>{again=false;return refreshNative(true);});}reading=api.get(`/api/native${force?'?refresh=1':''}`).then(value=>{if(state&&JSON.stringify(state)===JSON.stringify(value))return;state=value;listeners.forEach(fn=>fn());}).catch(error=>{if(state){state={...state,error:error.message,instances:state.instances.map(i=>({...i,metrics:null,phase:'unavailable'}))};listeners.forEach(fn=>fn());}}).finally(()=>{reading=null;});return reading;}
-export function useNative(){const value=useSyncExternalStore(fn=>{listeners.add(fn);return()=>listeners.delete(fn);},()=>state);useEffect(()=>{void refreshNative();if(!timer)timer=setInterval(()=>void refreshNative(),2500);return()=>{if(!listeners.size&&timer){clearInterval(timer);timer=null;}};},[]);return value;}
+export function refreshNative(force=false):Promise{
+ if(!force){if(light)return light;light=read(false).finally(()=>{light=null;});return light;}
+ if(forced){if(again)return forced;again=true;return forced.then(()=>{again=false;return refreshNative(true);});}
+ forced=read(true).finally(()=>{forced=null;});return forced;
+}
+const POLL_MS=2500,RUNNING_POLL_MS=1000;
+let users=0,timeout:ReturnType|null=null,watching=false;
+const hidden=()=>typeof document!=='undefined'&&document.visibilityState==='hidden';
+/** How long until the next poll: quicker while a download or load is running, none while the window is hidden (it reads again the moment it is shown). */
+export const nativePollDelay=(value:NativeState|null,isHidden=false):number|null=>isHidden?null:value?.jobs?.some(j=>j.state==='running')?RUNNING_POLL_MS:POLL_MS;
+function schedule(){
+ if(timeout){clearTimeout(timeout);timeout=null;}
+ if(!users)return;
+ const wait=nativePollDelay(state,hidden());
+ if(wait===null)return;
+ timeout=setTimeout(()=>{timeout=null;void refreshNative().finally(schedule);},wait);
+}
+const shown=()=>{if(!hidden()&&users){void refreshNative();schedule();}};
+export function useNative(){
+ const value=useSyncExternalStore(fn=>{listeners.add(fn);return()=>listeners.delete(fn);},()=>state);
+ useEffect(()=>{
+ users++;void refreshNative().finally(schedule);
+ if(!watching&&typeof document!=='undefined'){watching=true;document.addEventListener('visibilitychange',shown);window.addEventListener('focus',shown);}
+ return()=>{users--;if(!users){if(timeout){clearTimeout(timeout);timeout=null;}if(watching&&typeof document!=='undefined'){watching=false;document.removeEventListener('visibilitychange',shown);window.removeEventListener('focus',shown);}}};
+ },[]);
+ // a new job (or its end) changes how fast the next poll should come
+ const running=value?.jobs?.some(j=>j.state==='running')??false;
+ useEffect(()=>{schedule();},[running]);
+ return value;
+}
export const nativeState=()=>state;
/** Connection-list projection only; memory reservations are not inferred. */
export function nativeRouting(native:NativeState|null,hardware:Hardware|null):RuntimeModels|null{
diff --git a/apps/host/src/lib/store.ts b/apps/host/src/lib/store.ts
index 9899b80c..17449831 100644
--- a/apps/host/src/lib/store.ts
+++ b/apps/host/src/lib/store.ts
@@ -11,7 +11,7 @@ import { PREVIEW_EXAMPLES, type PreviewArtifact } from './artifacts';
import { lifecyclePolicy } from './lifecycle';
import { newestServingState } from './serving-state';
import { photoData, uploadChatPhotos, photoHistorySlots, pendingChatPhotos, takeChatPhotos } from './chat-photos';
-import { nativeState } from './native';
+import { applyNativeEvent, nativeState } from './native';
import { pictureStatus } from './pictures';
import { taskHandoverMessage, taskHandoverTitle } from './task-handover';
import type { Task } from './tasks';
@@ -641,6 +641,9 @@ function applyEvent(e: StreamEvent) {
case 'runtime':
set({runtime:data as unknown as RuntimeModels});
break;
+ case 'native':
+ applyNativeEvent(data);
+ break;
case 'image-models':
if (Array.isArray(data.variants)) set({ imageModels: data as unknown as ImageModelLibrary });
break;
diff --git a/apps/host/src/locales/de.json b/apps/host/src/locales/de.json
index 935736b7..918a1fad 100644
--- a/apps/host/src/locales/de.json
+++ b/apps/host/src/locales/de.json
@@ -3221,5 +3221,19 @@
"s3225": "Was sie getan hat",
"s3226": "Dateien",
"s3227": "Bitte hilf mir, von hier aus weiterzumachen.",
- "s3228": "…und {0} weitere Schritte"
+ "s3228": "…und {0} weitere Schritte",
+ "s3229": "NVFP4 (Strata-Version)",
+ "s3230": "NVFP4 (NVIDIA-Version)",
+ "s3231": "NVFP4 (NVIDIA, für FP4 trainiert)",
+ "s3232": "Strata-eigene Umwandlung. Die beste Qualität unter den NVFP4-Versionen.",
+ "s3233": "NVIDIAs eigener NVFP4-Checkpoint, für Strata umgewandelt. Gleiche Größe und Geschwindigkeit.",
+ "s3234": "NVIDIAs für FP4 trainierter Checkpoint. Bei kurzen Eingaben etwas schneller.",
+ "s3235": "Alle anderen Versionen",
+ "s3236": "Weitere Versionen",
+ "s3237": "Modelldateien werden heruntergeladen · Teil {0} von {1}",
+ "s3238": "Die Bildleser-Dateien werden heruntergeladen…",
+ "s3239": "Die Engine für diesen PC wird heruntergeladen…",
+ "s3240": "{0} wird vorbereitet",
+ "s3241": "Teile des Downloads",
+ "s3242": "Bildleser"
}
diff --git a/apps/host/src/locales/en.json b/apps/host/src/locales/en.json
index 08edd6ba..7502344c 100644
--- a/apps/host/src/locales/en.json
+++ b/apps/host/src/locales/en.json
@@ -3221,5 +3221,19 @@
"s3225": "What it did",
"s3226": "Files",
"s3227": "Please help me take it from here.",
- "s3228": "…and {0} more steps"
+ "s3228": "…and {0} more steps",
+ "s3229": "NVFP4 (Strata’s version)",
+ "s3230": "NVFP4 (NVIDIA’s version)",
+ "s3231": "NVFP4 (NVIDIA, trained for FP4)",
+ "s3232": "Strata’s own conversion. The best quality of the NVFP4 versions.",
+ "s3233": "NVIDIA’s own NVFP4 checkpoint, converted for Strata. Same size and speed.",
+ "s3234": "NVIDIA’s FP4 checkpoint, trained for FP4. Slightly faster on short prompts.",
+ "s3235": "All other versions",
+ "s3236": "More versions",
+ "s3237": "Downloading model files · part {0} of {1}",
+ "s3238": "Downloading the picture reader…",
+ "s3239": "Downloading the engine for this PC…",
+ "s3240": "Preparing {0}",
+ "s3241": "Download parts",
+ "s3242": "Picture reader"
}
diff --git a/apps/host/src/locales/es.json b/apps/host/src/locales/es.json
index 4a00e218..e9710a80 100644
--- a/apps/host/src/locales/es.json
+++ b/apps/host/src/locales/es.json
@@ -3221,5 +3221,19 @@
"s3225": "Qué hizo",
"s3226": "Archivos",
"s3227": "Ayúdame a continuar desde aquí.",
- "s3228": "…y {0} pasos más"
+ "s3228": "…y {0} pasos más",
+ "s3229": "NVFP4 (versión de Strata)",
+ "s3230": "NVFP4 (versión de NVIDIA)",
+ "s3231": "NVFP4 (NVIDIA, entrenada para FP4)",
+ "s3232": "Conversión propia de Strata. La mejor calidad de las versiones NVFP4.",
+ "s3233": "El punto de control NVFP4 propio de NVIDIA, convertido para Strata. Mismo tamaño y velocidad.",
+ "s3234": "El punto de control de NVIDIA entrenado para FP4. Algo más rápido con mensajes cortos.",
+ "s3235": "Todas las demás versiones",
+ "s3236": "Más versiones",
+ "s3237": "Descargando los archivos del modelo · parte {0} de {1}",
+ "s3238": "Descargando el lector de imágenes…",
+ "s3239": "Descargando el motor para este PC…",
+ "s3240": "Preparando {0}",
+ "s3241": "Partes de la descarga",
+ "s3242": "Lector de imágenes"
}
diff --git a/apps/host/src/locales/ja.json b/apps/host/src/locales/ja.json
index ec8bdf4c..8b48a974 100644
--- a/apps/host/src/locales/ja.json
+++ b/apps/host/src/locales/ja.json
@@ -3221,5 +3221,19 @@
"s3225": "実行した内容",
"s3226": "ファイル",
"s3227": "ここから先を手伝ってください。",
- "s3228": "…ほか {0} 件の手順"
+ "s3228": "…ほか {0} 件の手順",
+ "s3229": "NVFP4(Strata 版)",
+ "s3230": "NVFP4(NVIDIA 版)",
+ "s3231": "NVFP4(NVIDIA、FP4 向けに学習)",
+ "s3232": "Strata 独自の変換版です。NVFP4 の中で最も高品質です。",
+ "s3233": "NVIDIA 自身の NVFP4 チェックポイントを Strata 用に変換したものです。サイズと速度は同じです。",
+ "s3234": "NVIDIA が FP4 向けに学習したチェックポイントです。短いプロンプトでは少し高速です。",
+ "s3235": "その他のすべてのバージョン",
+ "s3236": "その他のバージョン",
+ "s3237": "モデルファイルをダウンロード中 · {1} 個中 {0} 個目",
+ "s3238": "画像読み取りファイルをダウンロード中…",
+ "s3239": "このパソコン用のエンジンをダウンロード中…",
+ "s3240": "{0} を準備中",
+ "s3241": "ダウンロードの内訳",
+ "s3242": "画像読み取り"
}
diff --git a/apps/host/src/locales/ko.json b/apps/host/src/locales/ko.json
index 40dc9433..f1274ebc 100644
--- a/apps/host/src/locales/ko.json
+++ b/apps/host/src/locales/ko.json
@@ -3221,5 +3221,19 @@
"s3225": "수행한 내용",
"s3226": "파일",
"s3227": "여기서부터 이어서 도와주세요.",
- "s3228": "…외 {0}단계"
+ "s3228": "…외 {0}단계",
+ "s3229": "NVFP4 (Strata 버전)",
+ "s3230": "NVFP4 (NVIDIA 버전)",
+ "s3231": "NVFP4 (NVIDIA, FP4용으로 학습)",
+ "s3232": "Strata가 직접 변환한 버전입니다. NVFP4 버전 중 품질이 가장 좋습니다.",
+ "s3233": "NVIDIA가 직접 만든 NVFP4 체크포인트를 Strata용으로 변환했습니다. 크기와 속도는 같습니다.",
+ "s3234": "NVIDIA가 FP4용으로 학습한 체크포인트입니다. 짧은 입력에서 조금 더 빠릅니다.",
+ "s3235": "다른 모든 버전",
+ "s3236": "더 많은 버전",
+ "s3237": "모델 파일 다운로드 중 · {1}개 중 {0}번째",
+ "s3238": "이미지 읽기 파일 다운로드 중…",
+ "s3239": "이 PC용 엔진 다운로드 중…",
+ "s3240": "{0} 준비 중",
+ "s3241": "다운로드 구성",
+ "s3242": "이미지 읽기"
}
diff --git a/apps/host/src/locales/pt.json b/apps/host/src/locales/pt.json
index 53292b3d..a3c2748b 100644
--- a/apps/host/src/locales/pt.json
+++ b/apps/host/src/locales/pt.json
@@ -3221,5 +3221,19 @@
"s3225": "O que fez",
"s3226": "Arquivos",
"s3227": "Por favor, ajude-me a continuar daqui.",
- "s3228": "…e mais {0} etapas"
+ "s3228": "…e mais {0} etapas",
+ "s3229": "NVFP4 (versão da Strata)",
+ "s3230": "NVFP4 (versão da NVIDIA)",
+ "s3231": "NVFP4 (NVIDIA, treinada para FP4)",
+ "s3232": "Conversão própria da Strata. A melhor qualidade entre as versões NVFP4.",
+ "s3233": "O checkpoint NVFP4 da própria NVIDIA, convertido para a Strata. Mesmo tamanho e velocidade.",
+ "s3234": "O checkpoint da NVIDIA treinado para FP4. Um pouco mais rápido com mensagens curtas.",
+ "s3235": "Todas as outras versões",
+ "s3236": "Mais versões",
+ "s3237": "Baixando arquivos do modelo · parte {0} de {1}",
+ "s3238": "Baixando o leitor de imagens…",
+ "s3239": "Baixando o mecanismo para este PC…",
+ "s3240": "Preparando {0}",
+ "s3241": "Partes do download",
+ "s3242": "Leitor de imagens"
}
diff --git a/apps/host/src/locales/ru.json b/apps/host/src/locales/ru.json
index d810a845..45303891 100644
--- a/apps/host/src/locales/ru.json
+++ b/apps/host/src/locales/ru.json
@@ -3221,5 +3221,19 @@
"s3225": "Что она сделала",
"s3226": "Файлы",
"s3227": "Помогите мне продолжить отсюда.",
- "s3228": "…и ещё шагов: {0}"
+ "s3228": "…и ещё шагов: {0}",
+ "s3229": "NVFP4 (версия Strata)",
+ "s3230": "NVFP4 (версия NVIDIA)",
+ "s3231": "NVFP4 (NVIDIA, обучена для FP4)",
+ "s3232": "Собственная конвертация Strata. Лучшее качество среди версий NVFP4.",
+ "s3233": "Собственный NVFP4-чекпойнт NVIDIA, конвертированный для Strata. Тот же размер и скорость.",
+ "s3234": "Чекпойнт NVIDIA, обученный для FP4. Немного быстрее на коротких запросах.",
+ "s3235": "Все остальные версии",
+ "s3236": "Другие версии",
+ "s3237": "Скачивание файлов модели · часть {0} из {1}",
+ "s3238": "Скачивание модуля чтения изображений…",
+ "s3239": "Скачивание движка для этого компьютера…",
+ "s3240": "Подготовка: {0}",
+ "s3241": "Части загрузки",
+ "s3242": "Чтение изображений"
}
diff --git a/apps/host/src/locales/zh.json b/apps/host/src/locales/zh.json
index 358312cc..5452b649 100644
--- a/apps/host/src/locales/zh.json
+++ b/apps/host/src/locales/zh.json
@@ -3221,5 +3221,19 @@
"s3225": "它做了什么",
"s3226": "文件",
"s3227": "请帮我从这里继续。",
- "s3228": "……以及另外 {0} 个步骤"
+ "s3228": "……以及另外 {0} 个步骤",
+ "s3229": "NVFP4(Strata 版本)",
+ "s3230": "NVFP4(NVIDIA 版本)",
+ "s3231": "NVFP4(NVIDIA,为 FP4 训练)",
+ "s3232": "Strata 自己的转换版本,是 NVFP4 各版本中质量最好的。",
+ "s3233": "NVIDIA 自己的 NVFP4 检查点,已为 Strata 转换。大小和速度相同。",
+ "s3234": "NVIDIA 为 FP4 训练的检查点。短提示下速度略快。",
+ "s3235": "其他所有版本",
+ "s3236": "更多版本",
+ "s3237": "正在下载模型文件 · 第 {0} 部分,共 {1} 部分",
+ "s3238": "正在下载图片读取组件…",
+ "s3239": "正在下载适用于此电脑的引擎…",
+ "s3240": "正在准备 {0}",
+ "s3241": "下载分段",
+ "s3242": "图片读取组件"
}
diff --git a/apps/host/src/styles/app.css b/apps/host/src/styles/app.css
index 5c615af7..842f5f01 100644
--- a/apps/host/src/styles/app.css
+++ b/apps/host/src/styles/app.css
@@ -7021,14 +7021,17 @@ textarea {
.version-menu { display: flex; flex-direction: column; max-height: min(70vh, 640px); overflow: auto; padding: 4px 0; min-width: min(620px, calc(100vw - 24px)); }
.version-head { display: grid; grid-template-columns: 1fr 84px 84px; gap: 10px; padding: 8px 18px 4px; font-size: var(--st-fs-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--st-ink-muted); }
.version-head span:nth-child(n+2) { text-align: right; }
-.version-row { display: grid; grid-template-columns: 1fr 84px 84px; gap: 10px; align-items: baseline; width: calc(100% - 12px); margin: 0 6px; padding: 8px 12px; border: 0; border-radius: var(--st-r-sm); background: transparent; color: var(--st-ink); font: inherit; text-align: left; cursor: pointer; }
+.version-row { display: grid; grid-template-columns: 1fr 84px 84px; gap: 10px; align-items: baseline; width: calc(100% - 12px); margin: 0 6px; padding: 6px 12px; border: 0; border-radius: var(--st-r-sm); background: transparent; color: var(--st-ink); font: inherit; font-size: var(--st-fs-md); text-align: left; cursor: pointer; }
.version-row:hover, .version-row:focus-visible { background: var(--st-surface-2); }
.version-row.is-on { background: var(--st-surface-2); }
.version-row__name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.version-row__name svg { color: var(--st-accent-text); margin-right: 6px; vertical-align: -2px; }
+.version-row__title { display: inline-flex; align-items: baseline; gap: 0; max-width: 100%; }
+.version-row__note { display: block; margin-top: 1px; font-size: var(--st-fs-xs); white-space: normal; line-height: 1.35; }
+.version-row__have, .version-trigger .version-row__have { margin-left: 8px; padding: 1px 8px; border-radius: var(--st-r-pill); background: var(--st-accent-tint); color: var(--st-accent-text); font-size: var(--st-fs-xs); font-weight: 700; white-space: nowrap; }
.version-row__ssd { margin-left: 10px; font-size: var(--st-fs-xs); color: var(--st-warn-text); }
.version-row__ram { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
-.version-row__dl { text-align: right; font-size: var(--st-fs-sm); color: var(--st-ink-muted); font-variant-numeric: tabular-nums; }
+.version-row__dl { text-align: right; font-size: var(--st-fs-xs); color: var(--st-ink-muted); font-variant-numeric: tabular-nums; }
.version-group { border-top: 1px solid var(--st-line-soft); margin-top: 4px; }
.version-group[data-open] { background: var(--st-surface-2); padding-bottom: 6px; }
.version-group[data-open] .version-row:hover { background: var(--st-surface); }
diff --git a/apps/host/src/styles/onboarding.css b/apps/host/src/styles/onboarding.css
index 84e885c6..b7577073 100644
--- a/apps/host/src/styles/onboarding.css
+++ b/apps/host/src/styles/onboarding.css
@@ -243,3 +243,11 @@
@media(max-width:700px){.onboard-sharing{grid-template-columns:1fr;gap:20px;padding:22px}.onboard-sharing-computer{width:min(300px,100%);justify-self:center}.onboard-sharing-caption{font-size:14px}.onboard-sharing-numbers{justify-content:space-between;gap:20px}.onboard-sharing-headroom{padding-left:20px}.guided-onboarding .onboard-resource-options>button{padding:16px;grid-template-columns:1fr;gap:7px}.guided-onboarding .onboard-resource-options small{grid-column:1;grid-row:4;justify-self:start}.guided-onboarding .onboard-resource-options strong{font-size:13px}.guided-onboarding .onboard-resource-options p{font-size:11px}.guided-onboarding .onboard-load-vision,.guided-onboarding .onboard-calibration{padding:14px}.guided-onboarding .onboard-load-vision strong,.guided-onboarding .onboard-calibration strong{font-size:12px}}
.onboard-progress-actions{display:flex;align-items:center;gap:10px}
.onboard-tune-stage:has(.error-notice) .onboard-sharing{display:none}
+
+/* ---- QA 2026-10-18: more versions, download parts ---- */
+.onboard-more-versions { margin-top: 12px; }
+.onboard-more-versions .version-trigger { background: var(--st-surface); }
+.native-parts { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: var(--st-fs-sm); }
+.native-parts li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-top: 1px solid var(--st-line-soft); }
+.native-parts li[data-state="done"] > span::before { content: "\2713\00a0"; color: var(--st-accent-text); }
+.native-parts li[data-state="downloading"] > span { font-weight: 700; }
diff --git a/apps/host/tests/qa1-downloads.test.mjs b/apps/host/tests/qa1-downloads.test.mjs
new file mode 100644
index 00000000..9938d615
--- /dev/null
+++ b/apps/host/tests/qa1-downloads.test.mjs
@@ -0,0 +1,125 @@
+import test from 'node:test';
+import assert from 'node:assert/strict';
+import { build } from 'esbuild';
+import { createEngineStep } from '../server/engine-step.mjs';
+
+const compiled = await build({
+ stdin: {
+ contents: "export * from './src/lib/native'; export * from './src/lib/download-eta'; export * from './src/lib/native-fit'; export * from './src/lib/native-names'; export * from './src/lib/native-catalog'; export * from './src/lib/i18n';",
+ 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')}`);
+
+const job = (progress, state = 'running') => ({ id: 'j1', kind: 'install', state, startedAt: '', summary: '', error: null, result: { install: progress } });
+const stateWith = (jobs, extra = {}) => ({ available: true, repo: '', summary: '', error: null, catalog: null, installed: null, hardware: null, instances: [], jobs, ...extra });
+const answer = body => ({ ok: true, status: 200, statusText: 'OK', text: async () => JSON.stringify(body) });
+
+test('a slow forced read never holds the light poll: a running download keeps moving', async () => {
+ const seen = [];
+ globalThis.fetch = async url => {
+ seen.push(url);
+ if (String(url).includes('refresh=1')) { await new Promise(r => setTimeout(r, 400)); return answer(stateWith([job({ download: { done_gb: 1, total_gb: 10 } })])); }
+ return answer(stateWith([job({ download: { done_gb: 5, total_gb: 10 } })]));
+ };
+ const slow = lib.refreshNative(true);
+ const t0 = Date.now();
+ await lib.refreshNative();
+ assert.ok(Date.now() - t0 < 200, 'the light read answered while the forced one was still running');
+ assert.equal(lib.nativeState().jobs[0].result.install.download.done_gb, 5);
+ await slow;
+ assert.ok(seen.some(u => String(u).includes('refresh=1')) && seen.some(u => !String(u).includes('refresh=1')));
+});
+
+test('a second forced read waits for the first and then reads again (it never joins a read that began before the action)', async () => {
+ let calls = 0;
+ globalThis.fetch = async () => { calls += 1; await new Promise(r => setTimeout(r, 50)); return answer(stateWith([], { summary: `read ${calls}` })); };
+ const a = lib.refreshNative(true), b = lib.refreshNative(true), c = lib.refreshNative(true);
+ await Promise.all([a, b, c]);
+ assert.equal(calls, 2, 'one read for the first, one more for everything asked meanwhile');
+ assert.equal(lib.nativeState().summary, 'read 2');
+});
+
+test('the host pushes its native state and the page takes it at once', () => {
+ lib.applyNativeEvent(stateWith([job({ download: { done_gb: 7, total_gb: 10 } })], { summary: 'pushed' }));
+ assert.equal(lib.nativeState().summary, 'pushed');
+ lib.applyNativeEvent({ nonsense: true });
+ lib.applyNativeEvent(null);
+ assert.equal(lib.nativeState().summary, 'pushed', 'a frame that is not a native state changes nothing');
+});
+
+test('the poll is quick while a job runs, normal otherwise, and stops while the window is hidden', () => {
+ assert.equal(lib.nativePollDelay(null), 2500);
+ assert.equal(lib.nativePollDelay(stateWith([job({})], {})), 1000);
+ assert.equal(lib.nativePollDelay(stateWith([job({}, 'done')])), 2500);
+ assert.equal(lib.nativePollDelay(stateWith([job({})]), true), null);
+});
+
+const parts = (model, vision, engine = { kind: 'engine', name: 'Engine', state: 'done', done_gb: 0.4, total_gb: 0.4 }) => [model, vision, engine];
+const modelPart = (state, done, total, files_done, files_total) => ({ kind: 'model', name: 'Model files', state, done_gb: done, total_gb: total, files_done, files_total });
+const visionPart = (state, done = 0) => ({ kind: 'vision', name: 'Picture reader', state, done_gb: done, total_gb: 0.9 });
+
+test('a model in parts says which part is under way, then the picture reader', () => {
+ lib.setTranslationLanguage('en');
+ const second = { parts: parts(modelPart('downloading', 20, 66, 1, 2), visionPart('waiting')) };
+ assert.deepEqual(lib.installStage(second), { kind: 'model', index: 2, count: 2 });
+ assert.equal(lib.stageText(lib.installStage(second)), 'Downloading model files · part 2 of 2');
+ const reader = { parts: parts(modelPart('done', 66, 66, 2, 2), visionPart('downloading', 0.3)) };
+ assert.deepEqual(lib.installStage(reader), { kind: 'vision' });
+ assert.equal(lib.stageText(lib.installStage(reader)), 'Downloading the picture reader…');
+ assert.equal(lib.stageText(lib.installStage(undefined)), 'Downloading model files…');
+ const single = { parts: [modelPart('downloading', 1, 20, 0, 1), visionPart('waiting')] };
+ assert.equal(lib.stageText(lib.installStage(single)), 'Downloading model files…', 'one file is not "part 1 of 1"');
+});
+
+test('the figure counts every part: the model whole but the picture reader not yet is not finished', () => {
+ const p = lib.installProgress({ parts: parts(modelPart('done', 10, 10, 2, 2), visionPart('downloading', 0.3)) });
+ assert.equal(p.percent, 94, 'the bar is not at its end while the picture reader is still coming');
+ assert.ok(Math.abs(p.total_gb - 11.3) < 0.01, `total ${p.total_gb}`);
+ assert.ok(p.remaining_gb > 0.5);
+ const half = lib.installProgress({ parts: parts(modelPart('downloading', 33, 66, 1, 2), visionPart('waiting')) });
+ assert.equal(half.percent, Math.floor(100 * (33 + 0.4) / (66 + 0.9 + 0.4)));
+});
+
+test('the engine step keeps the install job\'s own parts (model parts, picture reader) and adds the engine', () => {
+ const step = createEngineStep({ control: null });
+ const install = { running: true, step: '5/7: downloading', download: { file: 'picture reader', done_gb: 66.3, total_gb: 66.9, remaining_gb: 0.6, percent: 99 },
+ parts: [modelPart('done', 66, 66, 2, 2), visionPart('downloading', 0.3)] };
+ const merged = step.merge(install);
+ assert.deepEqual(merged.parts.map(p => p.kind), ['model', 'vision', 'engine']);
+ assert.equal(merged.parts[0].files_total, 2);
+ const bare = step.merge({ running: true, download: { file: 'model files', done_gb: 1, remaining_gb: 9 } });
+ assert.deepEqual(bare.parts.map(p => p.kind), ['model', 'engine'], 'an install without part information keeps the old two-part list');
+});
+
+test('the recommended four come first; the others are what the "More versions" list holds', () => {
+ const v = (sourceFamily, model) => ({ sourceFamily, model, id: `${sourceFamily}-${model}` });
+ const all = [v('qwen', 'Q2_0'), v('gyro', 'Gyro-S'), v('swift', 'IQ2_XS'), v('qwen', 'IQ3_S'), v('unsloth', 'UD-Q4_K_XL'), v('nvfp4', 'NVFP4')];
+ const rec = lib.recommendedVersions(all).map(x => x.v.model);
+ assert.deepEqual(rec, ['Gyro-S', 'IQ2_XS', 'IQ3_S', 'UD-Q4_K_XL']);
+ assert.deepEqual(all.filter(x => !rec.includes(x.model)).map(x => x.model), ['Q2_0', 'NVFP4']);
+ assert.deepEqual(lib.recommendedVersions([v('qwen36', 'UD-Q4_K_XL')]), [], 'Qwen3.6 has no recommended set: its versions are all shown');
+});
+
+test('the three NVFP4 versions have clear names and one line that tells them apart', () => {
+ lib.setTranslationLanguage('en');
+ const names = ['NVFP4', 'NVFP4-NVIDIA', 'NVFP4-QAD'].map(m => lib.nativeVersionLabel(m));
+ assert.deepEqual(names, ['NVFP4 (Strata’s version)', 'NVFP4 (NVIDIA’s version)', 'NVFP4 (NVIDIA, trained for FP4)']);
+ assert.equal(new Set(names).size, 3);
+ const lines = ['NVFP4', 'NVFP4-NVIDIA', 'NVFP4-QAD'].map(m => lib.versionNote(m));
+ assert.match(lines[0], /best quality/i);
+ assert.match(lines[1], /NVIDIA’s own NVFP4 checkpoint/);
+ assert.match(lines[2], /trained for FP4/);
+ assert.match(lines[2], /faster on short prompts/);
+ assert.equal(lib.versionNote('IQ3_S'), '');
+ assert.equal(lib.nativeShortName('nvfp4-nvfp4-nvidia'), 'NVFP4 (NVIDIA’s version)');
+ for (const language of ['zh', 'ja', 'de', 'es', 'ru', 'pt', 'ko']) {
+ lib.setTranslationLanguage(language);
+ const local = ['NVFP4', 'NVFP4-NVIDIA', 'NVFP4-QAD'].map(m => lib.nativeVersionLabel(m));
+ assert.equal(new Set(local).size, 3, `${language}: three different names`);
+ assert.ok(local.every((n, i) => n !== names[i]), `${language}: translated`);
+ assert.ok(['NVFP4', 'NVFP4-NVIDIA', 'NVFP4-QAD'].every((m, i) => lib.versionNote(m) !== lines[i]), `${language}: the line is translated`);
+ }
+ lib.setTranslationLanguage('en');
+});
diff --git a/apps/host/tests/ui4-fixes.test.mjs b/apps/host/tests/ui4-fixes.test.mjs
index b42749f2..04ec8304 100644
--- a/apps/host/tests/ui4-fixes.test.mjs
+++ b/apps/host/tests/ui4-fixes.test.mjs
@@ -21,7 +21,9 @@ test('item 1: downloaded models get a short name, family and quantization', asyn
assert.equal(nativeShortName('unsloth-ud-q4_k_xl'), 'Unsloth UD-Q4_K_XL');
assert.equal(nativeShortName('gyro-gyro-s'), 'Gyro-S');
assert.equal(nativeShortName('coder-iq1_m'), 'Coder IQ1_M');
- assert.equal(nativeShortName('nvfp4-nvfp4'), 'NVFP4 NVFP4');
+ assert.equal(nativeShortName('nvfp4-nvfp4'), 'NVFP4 (Strata’s version)');
+ assert.equal(nativeShortName('nvfp4-nvfp4-nvidia'), 'NVFP4 (NVIDIA’s version)');
+ assert.equal(nativeShortName('nvfp4-nvfp4-qad'), 'NVFP4 (NVIDIA, trained for FP4)');
const storage = await read('components/SettingsStorage.tsx');
assert.match(storage, /title=\{m\.model_name \|\| m\.model\}/, 'the full name is the tooltip');
});
diff --git a/tests/desktop/test_control_install.py b/tests/desktop/test_control_install.py
index b36df1b3..765f3f84 100644
--- a/tests/desktop/test_control_install.py
+++ b/tests/desktop/test_control_install.py
@@ -249,6 +249,71 @@ class InstallerServerTests(unittest.TestCase):
# a resumed install counts what is already on disk
self.assertGreater(self.mcp.combined_progress(dict(step5), job)["download"]["done_gb"], 0)
+ def test_a_model_in_parts_counts_every_part_and_the_picture_reader(self):
+ """QA 2026-10-18 (6): the bar stopped at 99 % while the picture reader downloaded, and a first whole part looked like a finished
+ model. Every part is counted, the picture reader is a part of its own, and 'done' needs all of them."""
+ S = self.mcp.Strata(self.root, ROOT).setup_module()
+ models = self.root / "Strata-data" / "models"
+ files = self.mcp.expected_files(S, "qwen", "IQ3_S", models, True)
+ self.assertEqual([f["role"] for f in files], ["model", "model", "vision"])
+ self.assertEqual(Path(files[2]["path"]).parent, models, "the picture reader sits beside the model folders")
+ folder = Path(files[0]["path"]).parent
+ folder.mkdir(parents=True)
+ job = {"folder": str(folder), "total_gb": 0.004, "files": files}
+ step5 = {"step": "5/7: downloading Qwen3.8-Flash-Next IQ3_S"}
+ # the first part is whole, the second not started: the model is NOT downloaded
+ Path(files[0]["path"]).write_bytes(b"x" * 2_000_000)
+ one = self.mcp.combined_progress(dict(step5), job)
+ model = next(x for x in one["parts"] if x["kind"] == "model")
+ self.assertEqual((model["files_done"], model["files_total"], model["state"]), (1, 2, "downloading"))
+ self.assertLess(one["download"]["percent"], 99)
+ # both parts whole, the picture reader under way: still counted, and the bar is not at its end
+ Path(files[1]["path"]).write_bytes(b"x" * 2_000_000)
+ Path(files[2]["path"]).with_name(Path(files[2]["path"]).name + ".part").write_bytes(b"x" * 400_000)
+ two = self.mcp.combined_progress(dict(step5), job)
+ vision = next(x for x in two["parts"] if x["kind"] == "vision")
+ self.assertEqual(vision["state"], "downloading")
+ self.assertEqual(two["download"]["file"], "picture reader")
+ self.assertGreater(two["download"]["done_gb"], one["download"]["done_gb"])
+ self.assertGreater(two["download"]["total_gb"], 0.004, "the picture reader is part of the total")
+ self.assertLessEqual(two["download"]["percent"], 99)
+ # all whole
+ Path(files[2]["path"]).with_name(Path(files[2]["path"]).name + ".part").unlink()
+ Path(files[2]["path"]).write_bytes(b"x" * 907_543_008)
+ three = self.mcp.combined_progress(dict(step5), job)
+ self.assertTrue(all(x["state"] == "done" for x in three["parts"]))
+ self.assertEqual(three["download"]["done_gb"], three["download"]["total_gb"])
+ # not a download once setup prepares the files
+ self.assertNotIn("download", self.mcp.combined_progress({"step": "6/7: preparing the model for Strata", "download": {"x": 1}}, job))
+
+ def test_a_pack_with_many_files_reports_the_whole_pack(self):
+ S = self.mcp.Strata(self.root, ROOT).setup_module()
+ files = self.mcp.expected_files(S, "nvfp4", "NVFP4", self.root / "models", False)
+ self.assertGreater(len(files), 5)
+ self.assertTrue(all(f["bytes"] for f in files), "a ready-made pack pins every file's size")
+ big = next(f for f in files if f["path"].endswith("experts.bin"))
+ Path(big["path"]).parent.mkdir(parents=True)
+ Path(big["path"] + ".part").write_bytes(b"x" * 1000)
+ prog = self.mcp.combined_progress({"step": "5/7: downloading"}, {"files": files, "total_gb": 128.0})
+ model = prog["parts"][0]
+ self.assertEqual((model["kind"], model["state"], model["files_done"], model["files_total"]), ("model", "downloading", 0, len(files)))
+ self.assertAlmostEqual(model["total_gb"], sum(f["bytes"] for f in files) / 1e9, places=2)
+
+ def test_a_config_with_only_some_parts_is_not_ready(self):
+ """The config names the first part only; 'ready' used to mean that part exists."""
+ data = self.root / "models" / "x"
+ data.mkdir(parents=True)
+ first = data / "Model-00001-of-00003.gguf"
+ first.write_bytes(b"x")
+ self.assertEqual(len(self.mcp.shard_gaps([str(first)])), 2)
+ (data / "Model-00002-of-00003.gguf").write_bytes(b"x")
+ (data / "Model-00003-of-00003.gguf.part").write_bytes(b"x")
+ self.assertEqual([Path(g).name for g in self.mcp.shard_gaps([str(first)])], ["Model-00003-of-00003.gguf"])
+ (data / "Model-00003-of-00003.gguf.part").unlink()
+ (data / "Model-00003-of-00003.gguf").write_bytes(b"x")
+ self.assertEqual(self.mcp.shard_gaps([str(first)]), [])
+ self.assertEqual(self.mcp.shard_gaps([str(data / "single.gguf")]), [])
+
@unittest.skipUnless(os.name == "nt" or sys.platform.startswith("linux"), "a PC with a GPU probe")
def test_a_real_install_reaches_the_model_download_with_nothing_else_acquired(self):
"""setup.py in the app's mode, as the install job runs it: steps 1-4 pass (PC check, packages bundled, engine component
diff --git a/tools/strata_mcp.py b/tools/strata_mcp.py
index 6a6ebabe..5184aaaf 100644
--- a/tools/strata_mcp.py
+++ b/tools/strata_mcp.py
@@ -580,6 +580,7 @@ class Strata:
tag = path.stem[len("strata-"):]
missing = [p for p in [cfg.get("exe"), *[x for x in a if isinstance(x, str) and x.endswith(".gguf")]]
if not p or not Path(p).exists()]
+ missing += shard_gaps([x for x in a if isinstance(x, str) and x.endswith(".gguf")]) # a model in parts is whole only with every part
script = self.root / f"run-{tag}.{'bat' if WIN else 'sh'}"
vis = cfg.get("vision")
return {"model": tag, "config": path.name, "model_name": cfg.get("model_name"),
@@ -1115,12 +1116,112 @@ class Strata:
return out
+SHARD_NAME = re.compile(r"^(.*)-(\d{5})-of-(\d{5})\.gguf$")
+DEFAULT_MMPROJ_BYTES = 907_543_008 # the Flash-Next picture reader (mmproj BF16), when a family does not pin its size
+
+
+def shard_gaps(ggufs) -> list:
+ """The parts of a multi-part GGUF (name-00001-of-00004.gguf) that are not there whole: a missing part, or one still being
+ downloaded (.part). A config that names only the first part used to look finished with one part of four on disk."""
+ gaps = []
+ for g in ggufs:
+ m = SHARD_NAME.match(str(g))
+ if not m:
+ continue
+ for i in range(1, int(m.group(3)) + 1):
+ sib = Path(f"{m.group(1)}-{i:05d}-of-{m.group(3)}.gguf")
+ if not sib.is_file() or sib.with_name(sib.name + ".part").exists():
+ gaps.append(str(sib))
+ return gaps
+
+
+def expected_files(S, family: str, model: str, models_dir: Path, vision: bool) -> list:
+ """The files setup fetches for one install, with the sizes it can know before the download starts:
+ [{path, bytes|None, role}] where role is "model" (the shards or the pack's files) or "vision" (the picture reader).
+ Empty when the setup module cannot say (the caller then falls back to the folder scan)."""
+ out = []
+ try:
+ own = (getattr(S, "OWN_PATH_FAMILIES", None) or {}).get(family)
+ if own: # Qwen3.6: the GGUF and the picture reader in the model's folder
+ folder = Path(models_dir) / (own["tag"] + model)
+ name = own["file"].format(q=model)
+ out.append({"path": str(folder / name), "bytes": own["sha256"][name][0], "role": "model"})
+ if vision:
+ out.append({"path": str(folder / own["mmproj"]), "bytes": own["sha256"][own["mmproj"]][0], "role": "vision"})
+ return out
+ fam, d = S.FAMILIES[family], S.MODELS[model]
+ if d.get("repo"): # NVFP4: a ready-made pack, many files with pinned sizes
+ for f in S.ready_needed(model, Path(models_dir)):
+ out.append({"path": str(S.ready_where(Path(models_dir), f)), "bytes": f[4], "role": "model"})
+ else:
+ folder = Path(models_dir) / (fam.get("tag", "") + model)
+ for i in range(1, S.model_shards(fam, model) + 1):
+ out.append({"path": str(folder / S.model_file(fam, model, i)), "bytes": None, "role": "model"})
+ if vision: # beside the model folders, not inside them (setup step 5)
+ size = (fam.get("mmproj_sha256") or (None,))[0] or DEFAULT_MMPROJ_BYTES
+ out.append({"path": str(Path(models_dir) / fam.get("mmproj", S.MMPROJ)), "bytes": size, "role": "vision"})
+ except Exception: # noqa: BLE001 - progress is a convenience: never break the install
+ return []
+ return out
+
+
+def files_progress(prog: dict, job: dict, files: list) -> dict:
+ """One honest download figure for a model in parts: every part counted (finished, partial, waiting), the picture reader as a part
+ of its own, and a part list the screen can name ("part 2 of 4"). The finished state needs EVERY part: a first shard that is whole
+ does not make the model downloaded."""
+ log = prog.get("download") or {}
+ cur_gb = float(log.get("total_gb") or 0)
+ rows = []
+ for f in files:
+ p = Path(f["path"])
+ part = p.with_name(p.name + ".part")
+ try:
+ if part.is_file():
+ state, have = "downloading", part.stat().st_size
+ elif p.is_file():
+ state, have = "done", p.stat().st_size
+ else:
+ state, have = "waiting", 0
+ except OSError:
+ state, have = "waiting", 0
+ total = f.get("bytes") or (have if state == "done" else 0)
+ if state == "downloading" and not total and cur_gb and p.name in str(log.get("file", "")): # the log line names this file
+ total = int(cur_gb * 1e9)
+ rows.append({"role": f.get("role", "model"), "state": state, "have": have, "total": max(total, have)})
+ plan_total = float(job.get("total_gb") or 0) * 1e9
+ parts = []
+ for role, name in (("model", "Model files"), ("vision", "Picture reader")):
+ mine = [r for r in rows if r["role"] == role]
+ if not mine:
+ continue
+ have = sum(r["have"] for r in mine)
+ known = sum(r["total"] for r in mine)
+ total = known if all(r["total"] for r in mine) else max(plan_total if role == "model" else 0, known, have)
+ k = sum(1 for r in mine if r["state"] == "done")
+ state = "done" if k == len(mine) else "downloading" if any(r["state"] == "downloading" for r in mine) or k else "waiting"
+ parts.append({"kind": role, "name": name, "state": state, "done_gb": round(min(have, total) / 1e9, 3),
+ "total_gb": round(total / 1e9, 3), "files_done": k, "files_total": len(mine)})
+ total_gb = sum(x["total_gb"] for x in parts)
+ done_gb = min(sum(x["done_gb"] for x in parts), total_gb)
+ active = next((x for x in parts if x["state"] != "done"), parts[-1] if parts else None)
+ if active and active["state"] == "waiting" and any(x["state"] == "done" for x in parts):
+ active = dict(active, state="downloading")
+ prog["download"] = {"file": "picture reader" if active and active["kind"] == "vision" else "model files",
+ "done_gb": round(done_gb, 3), "total_gb": round(total_gb, 3),
+ "remaining_gb": round(max(0.0, total_gb - done_gb), 3),
+ "percent": min(99, int(100 * done_gb / total_gb)) if total_gb else 0}
+ prog["parts"] = parts
+ return prog
+
+
def combined_progress(prog: dict, job: dict) -> dict:
"""One total for the whole model: the bytes of all its files (finished, partial and the one in flight, read from the
model's folder) over the download size, instead of each file's own 0-100% (a two-file model went 70 GB -> 0 -> up
again). Only while the download step runs; later steps are not a download."""
folder, total = job.get("folder"), job.get("total_gb")
step = str(prog.get("step") or "")
+ if job.get("files") and step.startswith("5/"): # the install knows its files: count each of them
+ return files_progress(prog, job, job["files"])
if not folder or not total or not step.startswith("5/"):
prog.pop("download", None)
return prog
@@ -1687,8 +1788,13 @@ class Tools:
ident = proc_identity(p.pid)
if ident is None and p.poll() and s.state("install-result").get("job") != job_id:
raise ToolError("setup did not start: " + " | ".join(read_tail(log_path, 5)))
+ folder = plan.get("model_folder")
+ files = []
+ if s.setup_module() is not None and folder: # every file of this install, for a progress that counts all the parts
+ files = expected_files(s.setup_module(), plan["family"], plan["model"], Path(folder).parent,
+ plan.get("images") in ("yes", "gpu", "cpu"))
s.save_state("install", {"job": job_id, "pid": p.pid, "ident": ident, "log": str(log_path),
- "model": plan["model"], "family": plan["family"], "folder": plan.get("model_folder"),
+ "model": plan["model"], "family": plan["family"], "folder": folder, "files": files,
"total_gb": plan.get("download_gb"),
"started": time.strftime("%Y-%m-%d %H:%M:%S"), "args": args})
return {"summary": f"Install of {plan['title']} started in the background (about 20-90 minutes, mostly the "