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

Linux tester AppImage: repack-appimage.sh puts the staged engine/Node/Python/Harness back byte for byte (linuxdeploy rewrites their RPATH, which broke the bundled engine's manifest check); control status says the bundled engine is being set up; WebKit DMA-BUF renderer off on Linux; e2e script takes --backend and finds the engine by its components path

Niko1221d2a38c9e5c33
diff --git a/apps/desktop/scripts/local-gguf-e2e.mjs b/apps/desktop/scripts/local-gguf-e2e.mjs
index 4b9ed4c52..32e49fa77 100644
--- a/apps/desktop/scripts/local-gguf-e2e.mjs
+++ b/apps/desktop/scripts/local-gguf-e2e.mjs
@@ -4,7 +4,8 @@
* preview a folder of a supported model, preview an unsupported GGUF (must be refused in plain terms), prepare the supported one
* (pack, from the folder, nothing copied), load it, get a chat answer, unload, shut down, and check nothing is left running.
*
- * node local-gguf-e2e.mjs --root /data/ui4-e2e --good /data/141-gyro/models/IQ2_XS --bad /data/ui4-e2e/bad [--context 8192]
+ * node local-gguf-e2e.mjs --root /data/ui4-e2e --good /data/141-gyro/models/IQ2_XS --bad /data/ui4-e2e/bad [--context 8192] [--backend cuda|metal]
+ * (the app folder is <root>/app: node/, host/, control/ ...; <root>/components gets the engine, from <root>/app/engine-bundle when the app carries one)
*/
import { spawn, spawnSync } from 'node:child_process';
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
@@ -24,7 +25,7 @@ let failed = false;
const record = (name, ok, detail = '') => { steps.push({ name, ok: !!ok, detail: String(detail).slice(0, 400) }); console.log(`${ok ? 'ok ' : 'FAIL'} ${name}${detail ? ' ' + String(detail).slice(0, 300) : ''}`); if (!ok) failed = true; };
const freePort = async () => { const s = createServer(); await new Promise(r => s.listen(0, '127.0.0.1', r)); const p = s.address().port; await new Promise(r => s.close(r)); return p; };
-const env = { ...process.env, STRATA_COMPONENTS_DIR: dirs.components, STRATA_PROFILE_DIR: dirs.profiles, STRATA_RUNTIME_DIR: dirs.runtime, STRATA_INSTALL_DIR: dirs.install, STRATA_HOME: dirs.home, STRATA_MODELS_DIR: join(root, 'Strata-data'), STRATA_ENGINE_BACKEND: 'cuda', XDG_CONFIG_HOME: dirs.xdg, APPDATA: dirs.appdata, PYTHONDONTWRITEBYTECODE: '1' };
+const env = { ...process.env, STRATA_COMPONENTS_DIR: dirs.components, STRATA_PROFILE_DIR: dirs.profiles, STRATA_RUNTIME_DIR: dirs.runtime, STRATA_INSTALL_DIR: dirs.install, STRATA_HOME: dirs.home, STRATA_MODELS_DIR: join(root, 'Strata-data'), STRATA_ENGINE_BACKEND: args.backend ?? 'cuda', XDG_CONFIG_HOME: dirs.xdg, APPDATA: dirs.appdata, PYTHONDONTWRITEBYTECODE: '1' };
delete env.STRATA_API_KEY;
const port = await freePort();
const base = `http://127.0.0.1:${port}`;
@@ -46,14 +47,15 @@ async function waitJob(id, seconds) {
}
throw new Error('operation did not finish in time');
}
-const engineProcs = () => spawnSync('ps', ['-eo', 'pid,args'], { encoding: 'utf8' }).stdout.split('\n').filter(l => l.includes('/engine/') && l.includes('/strata --serve'));
+const engineProcs = () => spawnSync('ps', ['-eo', 'pid,args'], { encoding: 'utf8' }).stdout.split('\n').filter(l => l.includes(join(dirs.components, 'engine')) && /\/strata( |$)/.test(l));
async function main() {
let up = false;
for (let i = 0; i < 200 && !up; i++) { try { up = (await fetch(base + '/api/health')).ok; } catch { await delay(150); } }
record('host healthy', up, up ? base : hostLog.slice(-500));
if (!up) return;
- const status = (await call('/api/control/status')).body;
+ let status = (await call('/api/control/status')).body;
+ for (let i = 0; i < 180 && status?.engineSetup; i++) { await delay(1000); status = (await call('/api/control/status')).body; } // the engine that came with the app is copied on the first start
record('Control status: bundled, engine usable', status?.engine?.usable === true, `engine=${status?.engine?.engine?.version} ${status?.engine?.notice ?? ''}`);
await call('/api/native?refresh=1');
diff --git a/apps/desktop/scripts/repack-appimage.sh b/apps/desktop/scripts/repack-appimage.sh
new file mode 100644
index 000000000..c0fe4d8a9
--- /dev/null
+++ b/apps/desktop/scripts/repack-appimage.sh
@@ -0,0 +1,56 @@
+#!/usr/bin/env bash
+# Put the bundled payloads back to the bytes they were staged with, inside a finished AppImage.
+#
+# apps/desktop/scripts/repack-appimage.sh <in.AppImage> <out.AppImage> [--resources <src-tauri/resources>] [--check]
+#
+# Why: Tauri hands the AppDir to linuxdeploy, which treats every ELF file under usr/lib as a library to fix up: it rewrites the RPATH of
+# the engine (strata, libstrata_kq.so, libcudart), of the bundled Python and Node and of the Harness's native modules. The files then no
+# longer match the SHA-256 and size their manifests list (engine-component.json), so the host refuses the bundled engine, and the
+# installer's own integrity promise ("what we staged is what runs") is broken. This script unpacks the AppImage, copies the staged
+# folders (control, harness, node, engine-bundle) over the AppDir byte for byte, and packs it again with the same runtime.
+#
+# --check does not write anything: it lists every engine-bundle file whose bytes differ from the manifest in the AppImage.
+set -euo pipefail
+
+IN="$(realpath "${1:?in.AppImage}")"; OUT="${2:-}"
+RES="$(cd "$(dirname "${BASH_SOURCE[0]}")/../src-tauri/resources" && pwd)"
+CHECK=0
+shift 2 || true
+while [ $# -gt 0 ]; do
+ case "$1" in
+ --resources) RES="$(cd "$2" && pwd)"; shift 2 ;;
+ --check) CHECK=1; shift ;;
+ *) echo "unknown option $1" >&2; exit 2 ;;
+ esac
+done
+
+OFFSET="$("$IN" --appimage-offset)"
+WORK="$(mktemp -d -t strata-repack.XXXXXX)"
+trap 'rm -rf "$WORK"' EXIT
+unsquashfs -no-progress -o "$OFFSET" -d "$WORK/AppDir" "$IN" >/dev/null
+# the product folder under usr/lib (Tauri names it after productName)
+LIB="$(find "$WORK/AppDir/usr/lib" -maxdepth 2 -type d -name engine-bundle -printf '%h\n' | head -1)"
+[ -n "$LIB" ] || LIB="$(find "$WORK/AppDir/usr/lib" -maxdepth 2 -type d -name control -printf '%h\n' | head -1)"
+[ -n "$LIB" ] || { echo "no Strata resource folder in the AppImage" >&2; exit 1; }
+
+if [ "$CHECK" = 1 ]; then
+ bad=0
+ while IFS= read -r f; do
+ rel="${f#$RES/}"
+ if ! cmp -s "$f" "$LIB/$rel"; then echo "differs: $rel"; bad=$((bad + 1)); fi
+ done < <(find "$RES/engine-bundle" "$RES/node" -type f ! -name .gitignore)
+ echo "$bad file(s) differ from what was staged"
+ [ "$bad" = 0 ]
+ exit
+fi
+
+[ -n "$OUT" ] || { echo "give out.AppImage" >&2; exit 2; }
+for d in control harness node engine-bundle; do
+ [ -d "$RES/$d" ] || continue
+ rsync -aL --checksum --delete --exclude .gitignore "$RES/$d/" "$LIB/$d/"
+done
+mksquashfs "$WORK/AppDir" "$WORK/app.squashfs" -root-owned -noappend -comp zstd -b 131072 -no-progress >/dev/null
+head -c "$OFFSET" "$IN" > "$OUT"
+cat "$WORK/app.squashfs" >> "$OUT"
+chmod +x "$OUT"
+echo "repacked: $OUT ($(stat -c %s "$OUT") bytes)"
diff --git a/apps/desktop/src-tauri/src/main.rs b/apps/desktop/src-tauri/src/main.rs
index 8f5a4694f..6415a04de 100644
--- a/apps/desktop/src-tauri/src/main.rs
+++ b/apps/desktop/src-tauri/src/main.rs
@@ -775,6 +775,14 @@ fn main() {
// its host hung with no output at all.
let args: Vec<String> = std::env::args().collect();
contain_app();
+ #[cfg(target_os = "linux")]
+ {
+ // WebKitGTK's DMA-BUF renderer shows a blank window on several NVIDIA + Wayland desktops (and some virtual GPUs); the plain
+ // renderer is slower to start by a hair and always works. Anyone who set the variable themselves keeps their choice.
+ if std::env::var_os("WEBKIT_DISABLE_DMABUF_RENDERER").is_none() {
+ std::env::set_var("WEBKIT_DISABLE_DMABUF_RENDERER", "1");
+ }
+ }
if let Some(path) = self_test_path(&args) {
let code = run_self_test(&path);
std::process::exit(code);
diff --git a/apps/host/server/index.mjs b/apps/host/server/index.mjs
index a4a3fbfc5..c7ed4a888 100644
--- a/apps/host/server/index.mjs
+++ b/apps/host/server/index.mjs
@@ -116,6 +116,8 @@ const appUpdater = createAppUpdater();
const bundledEngine = control && !process.env.STRATA_NO_BUNDLED_ENGINE
? installBundledEngine({ bundleDir: process.env.STRATA_ENGINE_BUNDLE_DIR || resolve(HERE, '..', '..', 'engine-bundle'), components: componentsDirectory(), log: line => console.log(line) })
: Promise.resolve({ action: 'none' });
+let bundledEngineSettled = !(control && !process.env.STRATA_NO_BUNDLED_ENGINE);
+bundledEngine.then(() => { bundledEngineSettled = true; }, () => { bundledEngineSettled = true; });
const native=createNativeControl({control,ready:bundledEngine,appUpdater,hardwareProbe:()=>(hardware.cachedHardware()?.gpus??[]).map((g,n)=>({index:g.index??n,vram_gb:g.vramGb})),directory:store.DATA_DIR,modelsDirectory:()=>store.MODELS_DIR,nativeDataDirectory:store.nativeDataDirectory,beforeLoad:async()=>{if(models.REAL&&models.library().loaded){if(serving.state().requests.some(r=>runtimeModels.state().instances.some(i=>i.id===r.instanceId)&&["queued","generating"].includes(r.state)))throw new Error("Finish requests before switching engines.");await models.unload();runtimeState();}},requests:()=>serving.state().requests,changed:value=>hub.send('native',value)});
/* The agent: chats become DeepSeek Harness sessions when that component is installed. It is a separate
pinned component (STRATA_HARNESS_DIR), not part of this host, so its absence is a visible capability
@@ -1193,10 +1195,13 @@ async function api(req, res, path, method, url) {
// --- Strata Control: what the installed app runs on, and what it will not do ---------------------
if (path === '/api/control/status' && method === 'GET') {
const engine = control ? await control.engine().catch(e => ({ usable: false, notice: e.message })) : null;
+ // the first start copies the engine that came with the app (about a minute): say so instead of "no engine"
+ if (engine && !engine.usable && !bundledEngineSettled) engine.notice = 'The engine that came with the app is being set up. This takes a minute the first time.';
return json(res, 200, {
packaged: process.env.STRATA_PACKAGED === '1',
control: CONTROL ? { dir: CONTROL.dir, python: CONTROL.python, version: control.version, bundle: CONTROL.bundle } : null,
engine,
+ engineSetup: !bundledEngineSettled,
componentsDir: componentsDirectory(),
acquisition: { forbidden: acquisitionForbidden(), env: process.env.STRATA_NO_ACQUIRE ?? null },
});
diff --git a/src2.tar b/src2.tar
new file mode 100644
index 000000000..d920af6c8
Binary files /dev/null and b/src2.tar differ