diff --git a/apps/host/server/native-control.mjs b/apps/host/server/native-control.mjs index ebfb9bd6..147ff225 100644 --- a/apps/host/server/native-control.mjs +++ b/apps/host/server/native-control.mjs @@ -25,6 +25,8 @@ const safeId=value=>typeof value==='string'&&/^[a-z0-9_-]{1,80}$/i.test(value); const busy=requests=>requests.some(r=>['queued','generating'].includes(r.state)); function readJson(path,fallback={}){try{return JSON.parse(readFileSync(path,'utf8').replace(/^\uFEFF/,''));}catch{return fallback;}} +/** The plain words for "no usable engine": the model still downloads, but loading needs the engine (owner decision 2026-10-18). */ +export const ENGINE_NOT_RECOGNISED='Strata didn’t recognise an engine for this computer. The model is downloaded, but it can’t run until the right engine is installed. Open Settings → Engine.'; export function createNativeControl({directory,requests=()=>[],changed=()=>{},spawnProcess=spawn,fetcher=fetch,modelsDirectory,nativeDataDirectory=value=>value,beforeLoad=async()=>{},hardwareProbe=()=>[],control=null,ready=null,appUpdater=null,defaultRepo=process.env.STRATA_NATIVE_REPO??resolve(ROOT,'../../Strata')}={}){ mkdirSync(directory,{recursive:true}); const settingsPath=join(directory,'native-host.json'); @@ -204,7 +206,7 @@ return {summary:result.summary??'Deleted',removed:result.plan?.gb??null};} return {cfg,resources,visionPreferences,parallelChoice,parallelNote}; } async function loadEngine(job,args){ - await refresh(true);if(job.state!=='running')return;const {config,entry,path:configFile}=record(args.model);assertSettingsFile(configFile);if(packaged){const engine=await control.engine();if(!engine.usable)throw new Error(engine.notice??'No engine for this PC was found.');}if(!entry.ready)throw new Error('Some model files are missing. Use Download / repair to restore them.'); + await refresh(true);if(job.state!=='running')return;const {config,entry,path:configFile}=record(args.model);assertSettingsFile(configFile);if(packaged){const engine=await control.engine();if(!engine.usable)throw new Error(ENGINE_NOT_RECOGNISED+(engine.notice?` ${engine.notice}`:''));}if(!entry.ready)throw new Error('Some model files are missing. Use Download / repair to restore them.'); if(externalRunning().length)throw new Error('A Strata server is already running outside this UI. Stop it before loading here, or connect its API in Settings → Models.'); if(args.multiple&&instances.size>=8)throw new Error('Unload an instance before adding another. Up to eight native instances can run here.'); const {cfg,resources,visionPreferences,parallelChoice,parallelNote:chosenNote}=buildConfig(args,config); @@ -345,7 +347,7 @@ return {summary:result.summary??'Deleted',removed:result.plan?.gb??null};} async function tuneOff(args){await refresh();const {path}=tuneConfig(args);return autotuner.off(path);} async function autotune(job,args){ await refresh(true);if(job.state!=='running')return; - if(packaged){const engine=await control.engine();if(!engine.usable)throw new Error(engine.notice??'No engine for this PC was found.');} + if(packaged){const engine=await control.engine();if(!engine.usable)throw new Error(ENGINE_NOT_RECOGNISED+(engine.notice?` ${engine.notice}`:''));} const {path}=tuneConfig(args); if(externalRunning().length)throw new Error('Stop the native server running outside this UI before tuning.'); if(busy(requests().filter(r=>instances.has(r.instanceId))))throw new Error('Finish requests before tuning.'); diff --git a/apps/host/src/components/EngineWarning.tsx b/apps/host/src/components/EngineWarning.tsx new file mode 100644 index 00000000..cbaa13c9 --- /dev/null +++ b/apps/host/src/components/EngineWarning.tsx @@ -0,0 +1,12 @@ +import { tr } from '../lib/i18n'; +import { Icon } from './ui'; +import type { NativeState } from '../lib/native'; + +/** The app could not find or recognise an engine for this computer (none installed and none in the feed, another card family, a driver that is too old). It still downloads the model + * (owner decision 2026-10-18) and says so before and during the download; loading says the same with the next step. */ +export const engineMissing = (native: NativeState | null | undefined) => !!native?.engine && native.engine.usable === false; + +export function EngineWarning({ native }: { native: NativeState | null | undefined }) { + if (!engineMissing(native)) return null; + return

{tr("Strata didn’t recognise an engine for this computer. The model will download, but it may not run until the right engine is installed (Settings → Engine).")}

{native?.engine?.notice ? {native.engine.notice} : null}
; +} diff --git a/apps/host/src/components/GuidedSetup.tsx b/apps/host/src/components/GuidedSetup.tsx index a8586cee..3697fdb7 100644 --- a/apps/host/src/components/GuidedSetup.tsx +++ b/apps/host/src/components/GuidedSetup.tsx @@ -15,6 +15,7 @@ import { downloadCounter, modelFolderLabel, onboardingError } from '../lib/onboa import { installProgress, installStage, stageText, useDownloadEta } from '../lib/download-eta'; import { VersionPicker } from './VersionPicker'; import { DownloadParts } from './DownloadParts'; +import { EngineWarning } from './EngineWarning'; import { recommendedVersions } from '../lib/native-fit'; import { nativeCatalogModels, catalogVersionLabel } from '../lib/native-catalog'; type Choices = NonNullable['onboarding']>; @@ -194,7 +195,7 @@ export function GuidedSetup() { {tr(folderOpen ? void perform(async () => { await nativeAction('directory', { directory: path }); setDirectory(path); setFolderOpen(false); setPlan(null); })}/> : null)} :
{tr("Connect your Strata installation")} void skip(false, 'Engine')}>{tr("Connect engine")}
)} : step === 3 ?
-
{tr(selectedFamily?.title)}{tr(version ? catalogVersionLabel(version) : '')}{tr(version?.model)}
+
{tr(selectedFamily?.title)}{tr(version ? catalogVersionLabel(version) : '')}{tr(version?.model)}
{tr(preparing ?
{tr(progress ? stageText(installStage(installJob?.result?.install)) : 'Preparing your model…')}
{tr(progress ? : )}
{tr(progress ? `${progress.percent ?? 0}%${Number.isFinite(progress.done_gb) && Number.isFinite(progress.total_gb) ? ` · ${progress.done_gb!.toFixed(1)} / ${progress.total_gb!.toFixed(1)} GB` : ''}` : 'Getting files ready…')}
{tr(eta ? {eta} : null)}
: <>{tr(stopped ? : null)}{tr(plan?.plan?.disk_short ? : null)})} {tr("Save to")}{tr(modelFolderLabel(folder))}{tr(!preparing ? : null)}
diff --git a/apps/host/src/components/NativeModels.tsx b/apps/host/src/components/NativeModels.tsx index 255393e1..05827343 100644 --- a/apps/host/src/components/NativeModels.tsx +++ b/apps/host/src/components/NativeModels.tsx @@ -9,6 +9,7 @@ import { Btn, Dialog, ErrorNotice, Icon, Select } from './ui'; import { installProgress, installStage, stageText, useDownloadEta } from '../lib/download-eta'; import { useKept } from '../lib/kept-state'; import { DownloadParts } from './DownloadParts'; +import { EngineWarning } from './EngineWarning'; import { sizeGb } from '../lib/format'; import { NativeDeleteDialog } from './NativeDelete'; import { plainFailureText } from '../lib/plain-errors'; @@ -181,6 +182,7 @@ export function NativeModels({ onOtherModels, onReady, onImport, onConnectEngine {tr(selectedSize?.imagesCapable && !selectedSize.images ?

{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(selectedSize?.images ? <>
{tr(expert && vision !== 'no' ?