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++
host tests: fileURLToPath replaces the regex that stripped the slash before a drive letter (replaces 439339ab1; the pathname form also left %20 in paths with spaces)
Niko122144d885874731
diff --git a/apps/host/tests/annotations-32.test.mjs b/apps/host/tests/annotations-32.test.mjsindex 34e6142af..db89ef00f 100644--- a/apps/host/tests/annotations-32.test.mjs+++ b/apps/host/tests/annotations-32.test.mjs@@ -1,3 +1,4 @@+import { fileURLToPath } from 'node:url';import test from 'node:test';import assert from 'node:assert/strict';import { readFile, mkdtemp, mkdir, writeFile, rm } from 'node:fs/promises';@@ -8,7 +9,7 @@ import { parseCpuTopology, parseWindowsProcessors, parseNvidiaDevices, parseNvidimport { CONTEXT_TOKENS, expertParams } from '../server/catalog.mjs';import { buildArgs } from '../server/supervisor.mjs';async function loadTs(path) {- const result=await build({entryPoints:[new URL(path,import.meta.url).pathname.replace(/^\/([A-Za-z]:)/,'$1')],bundle:true,write:false,platform:'node',format:'esm'}); const code=result.outputFiles[0].text;+ const result=await build({entryPoints:[fileURLToPath(new URL(path,import.meta.url))],bundle:true,write:false,platform:'node',format:'esm'}); const code=result.outputFiles[0].text;return import(`data:text/javascript;base64,${Buffer.from(code).toString('base64')}`);}const {usageDashboard,calendarDays}=await loadTs('../src/lib/usage-dashboard.ts');diff --git a/apps/host/tests/audit-fixes.test.mjs b/apps/host/tests/audit-fixes.test.mjsindex 0b5324253..755bd3ee4 100644--- a/apps/host/tests/audit-fixes.test.mjs+++ b/apps/host/tests/audit-fixes.test.mjs@@ -1,8 +1,9 @@+import { fileURLToPath } from 'node:url';import test from 'node:test';import assert from 'node:assert/strict';import { readFile } from 'node:fs/promises';import { build } from 'esbuild';-async function moduleAt(path) { const result=await build({entryPoints:[new URL(path,import.meta.url).pathname.replace(/^\/([A-Za-z]:)/,'$1')],bundle:true,write:false,platform:'node',format:'esm'}); const code=result.outputFiles[0].text; return import(`data:text/javascript;base64,${Buffer.from(code).toString('base64')}`); }+async function moduleAt(path) { const result=await build({entryPoints:[fileURLToPath(new URL(path,import.meta.url))],bundle:true,write:false,platform:'node',format:'esm'}); const code=result.outputFiles[0].text; return import(`data:text/javascript;base64,${Buffer.from(code).toString('base64')}`); }const {formatModelName,userError}=await moduleAt('../src/lib/format.ts');const {versionFit,recommendedVersion}=await moduleAt('../src/lib/model-versions.ts');const {memoryReading}=await moduleAt('../src/lib/hardware-summary.ts');diff --git a/apps/host/tests/chat-shortcuts.test.mjs b/apps/host/tests/chat-shortcuts.test.mjsindex a3a4beff0..5a3ddf1a9 100644--- a/apps/host/tests/chat-shortcuts.test.mjs+++ b/apps/host/tests/chat-shortcuts.test.mjs@@ -1,8 +1,9 @@+import { fileURLToPath } from 'node:url';import test from 'node:test';import assert from 'node:assert/strict';import { build } from 'esbuild';import { createRequire } from 'node:module';-const { outputFiles } = await build({ entryPoints: [new URL('../src/lib/commands.ts', import.meta.url).pathname.replace(/^\/([A-Za-z]:)/,'$1')], bundle: true, write: false, platform: 'node', format: 'cjs', plugins: [{ name: 'test-store', setup(build) { build.onResolve({ filter: /^\.\/store$/ }, () => ({ path: 'store', namespace: 'test-store' })); build.onLoad({ filter: /.*/, namespace: 'test-store' }, () => ({ contents: `+const { outputFiles } = await build({ entryPoints: [fileURLToPath(new URL('../src/lib/commands.ts',import.meta.url))], bundle: true, write: false, platform: 'node', format: 'cjs', plugins: [{ name: 'test-store', setup(build) { build.onResolve({ filter: /^\.\/store$/ }, () => ({ path: 'store', namespace: 'test-store' })); build.onLoad({ filter: /.*/, namespace: 'test-store' }, () => ({ contents: `export const getState = () => testStore.state;export const selectSession = id => { testStore.state.activeSession = id; testStore.calls.push(['select',id]); };export const go = (...args) => testStore.calls.push(['go',...args]);diff --git a/apps/host/tests/developer-previews.test.mjs b/apps/host/tests/developer-previews.test.mjsindex f1be670a9..e9dedc31d 100644--- a/apps/host/tests/developer-previews.test.mjs+++ b/apps/host/tests/developer-previews.test.mjs@@ -1,8 +1,9 @@+import { fileURLToPath } from 'node:url';import test from 'node:test';import assert from 'node:assert/strict';import { build, transform } from 'esbuild';import { readFile } from 'node:fs/promises';-const {outputFiles}=await build({entryPoints:[new URL('../src/lib/syntax.ts',import.meta.url).pathname.replace(/^\/([A-Za-z]:)/,'$1')],bundle:true,platform:'node',format:'esm',write:false});+const {outputFiles}=await build({entryPoints:[fileURLToPath(new URL('../src/lib/syntax.ts',import.meta.url))],bundle:true,platform:'node',format:'esm',write:false});const {codeLanguage,highlightedLines}=await import(`data:text/javascript;base64,${Buffer.from(outputFiles[0].text).toString('base64')}`);const source=await transform(await readFile(new URL('../src/lib/preview-layout.ts',import.meta.url),'utf8'),{loader:'ts',format:'esm'});const {previewWidth,pointerPreviewFraction,DEFAULT_PREVIEW_FRACTION}=await import(`data:text/javascript;base64,${Buffer.from(source.code).toString('base64')}`);diff --git a/apps/host/tests/experience.test.mjs b/apps/host/tests/experience.test.mjsindex 4a0c58cc4..40bafede8 100644--- a/apps/host/tests/experience.test.mjs+++ b/apps/host/tests/experience.test.mjs@@ -1,8 +1,9 @@+import { fileURLToPath } from 'node:url';import assert from 'node:assert/strict';import { test } from 'node:test';import { readFile } from 'node:fs/promises';import { build } from 'esbuild';-const result=await build({entryPoints:[new URL('../src/lib/experience.ts',import.meta.url).pathname.replace(/^\/([A-Za-z]:)/,'$1')],bundle:true,write:false,platform:'node',format:'esm'});+const result=await build({entryPoints:[fileURLToPath(new URL('../src/lib/experience.ts',import.meta.url))],bundle:true,write:false,platform:'node',format:'esm'});const code=result.outputFiles[0].text;const { estimate, recommend, configKey, hardwareKey, groupVariants, DEFAULT_EXECUTION: config } = await import(`data:text/javascript;base64,${Buffer.from(code).toString('base64')}`);const hw = { cpu: { model: 'Fixture CPU' }, gpus: [{ name: 'Fixture GPU' }], memory: { totalGb: 32 }, accelerator: { unified: true, backend: 'metal', usableVramGb: 24 } };diff --git a/apps/host/tests/local-models.test.mjs b/apps/host/tests/local-models.test.mjsindex 6c914958e..ad1281291 100644--- a/apps/host/tests/local-models.test.mjs+++ b/apps/host/tests/local-models.test.mjs@@ -1,3 +1,4 @@+import { fileURLToPath } from 'node:url';import test from 'node:test';import assert from 'node:assert/strict';import { spawn, spawnSync } from 'node:child_process';@@ -8,7 +9,7 @@ import { createServer } from 'node:net';import { readGGUF } from '../server/gguf.mjs';import { browseLocalModels, inspectLocalModel, createLocalModels } from '../server/local-models.mjs';import { ggufFixture } from './helpers/local-gguf.mjs';-const cwd=new URL('..',import.meta.url).pathname.replace(/^\/([A-Za-z]:)/,'$1'),pause=ms=>new Promise(r=>setTimeout(r,ms));+const cwd=fileURLToPath(new URL('..',import.meta.url)),pause=ms=>new Promise(r=>setTimeout(r,ms));function fixture(t){const root=mkdtempSync(join(tmpdir(),'strata-local-model-'));t.after(()=>rmSync(root,{recursive:true,force:true}));return root;}test('bounded reader gets real metadata and rejects fake extensions, partial tensors, unsupported versions and duplicate metadata',t=>{diff --git a/apps/host/tests/model-directory-default.test.mjs b/apps/host/tests/model-directory-default.test.mjsindex 057cf8113..85254db9e 100644--- a/apps/host/tests/model-directory-default.test.mjs+++ b/apps/host/tests/model-directory-default.test.mjs@@ -1,3 +1,4 @@+import { fileURLToPath } from 'node:url';import test from 'node:test';import assert from 'node:assert/strict';import {mkdtempSync,mkdirSync,writeFileSync,realpathSync,rmSync,symlinkSync} from 'node:fs';@@ -19,7 +20,7 @@ test('Linux respects localized XDG Documents and rejects shell expressions',()=>});test('new hosts create the default; custom folders and legacy weights remain in place',t=>{const root=realpathSync(mkdtempSync(join(tmpdir(),'strata-documents-')));t.after(()=>rmSync(root,{recursive:true,force:true}));- function boot(name,state,weights=false){const home=join(root,name),documents=join(root,name+'-documents');mkdirSync(join(home,'data'),{recursive:true});mkdirSync(join(home,'models'),{recursive:true});if(state)writeFileSync(join(home,'data','state.json'),JSON.stringify(state));if(weights){mkdirSync(join(home,'models','native','qwen'),{recursive:true});writeFileSync(join(home,'models','native','qwen','model.gguf'),'GGUFfixture');}const env={...process.env,STRATA_HOME:home,STRATA_DOCUMENTS_DIR:documents,STRATA_TEST_NATIVE:'1'};delete env.STRATA_MODELS_DIR;const result=spawnSync(process.execPath,['--input-type=module','-e',"const store=await import('./server/store.mjs');if(process.env.STRATA_TEST_NATIVE==='1'&&store.MODELS_DIR.endsWith('/Strata/Models')){const {statSync}=await import('node:fs');const {join}=await import('node:path');const native=store.nativeDataDirectory(store.MODELS_DIR);const a=statSync(join(native,'models')),b=statSync(store.MODELS_DIR);if(a.ino!==b.ino||a.dev!==b.dev)throw new Error('Native weights miss requested model folder');}console.log(store.MODELS_DIR);"],{cwd:new URL('..',import.meta.url).pathname.replace(/^\/([A-Za-z]:)/,'$1'),env,encoding:'utf8'});assert.equal(result.status,0,result.stderr);return {path:result.stdout.trim(),home,documents};}+ function boot(name,state,weights=false){const home=join(root,name),documents=join(root,name+'-documents');mkdirSync(join(home,'data'),{recursive:true});mkdirSync(join(home,'models'),{recursive:true});if(state)writeFileSync(join(home,'data','state.json'),JSON.stringify(state));if(weights){mkdirSync(join(home,'models','native','qwen'),{recursive:true});writeFileSync(join(home,'models','native','qwen','model.gguf'),'GGUFfixture');}const env={...process.env,STRATA_HOME:home,STRATA_DOCUMENTS_DIR:documents,STRATA_TEST_NATIVE:'1'};delete env.STRATA_MODELS_DIR;const result=spawnSync(process.execPath,['--input-type=module','-e',"const store=await import('./server/store.mjs');if(process.env.STRATA_TEST_NATIVE==='1'&&store.MODELS_DIR.endsWith('/Strata/Models')){const {statSync}=await import('node:fs');const {join}=await import('node:path');const native=store.nativeDataDirectory(store.MODELS_DIR);const a=statSync(join(native,'models')),b=statSync(store.MODELS_DIR);if(a.ino!==b.ino||a.dev!==b.dev)throw new Error('Native weights miss requested model folder');}console.log(store.MODELS_DIR);"],{cwd:fileURLToPath(new URL('..',import.meta.url)),env,encoding:'utf8'});assert.equal(result.status,0,result.stderr);return {path:result.stdout.trim(),home,documents};}const fresh=boot('fresh');assert.equal(fresh.path,join(fresh.documents,'Strata','Models'));const target=join(root,'redirected-target');mkdirSync(target);symlinkSync(target,join(root,'redirected-documents'));assert.equal(boot('redirected').path,join(target,'Strata','Models'));const custom=join(root,'custom');mkdirSync(custom);assert.equal(boot('custom-host',{modelsDir:custom}).path,custom);diff --git a/apps/host/tests/model-directory.test.mjs b/apps/host/tests/model-directory.test.mjsindex 69de67032..64403eb70 100644--- a/apps/host/tests/model-directory.test.mjs+++ b/apps/host/tests/model-directory.test.mjs@@ -1,3 +1,4 @@+import { fileURLToPath } from 'node:url';import test from 'node:test';import assert from 'node:assert/strict';import { spawn, spawnSync } from 'node:child_process';@@ -8,7 +9,7 @@ import { join } from 'node:path';import { createServer } from 'node:net';import { locateModelFile } from '../server/model-files.mjs';import { createImageModels, IMAGE_CATALOG } from '../server/image-models.mjs';-const cwd = new URL('..', import.meta.url).pathname.replace(/^\/([A-Za-z]:)/,'$1');+const cwd = fileURLToPath(new URL('..',import.meta.url));const pause = ms => new Promise(resolve => setTimeout(resolve, ms));function fixture(t) { const home=realpathSync(mkdtempSync(join(tmpdir(),'strata-directory-'))); t.after(()=>rmSync(home,{recursive:true,force:true})); return home; }diff --git a/apps/host/tests/model-storage.test.mjs b/apps/host/tests/model-storage.test.mjsindex e0aff805f..9f5c6d945 100644--- a/apps/host/tests/model-storage.test.mjs+++ b/apps/host/tests/model-storage.test.mjs@@ -1,3 +1,4 @@+import { fileURLToPath } from 'node:url';import test from 'node:test';import assert from 'node:assert/strict';import { mkdtempSync, rmSync } from 'node:fs';@@ -31,6 +32,6 @@ test('model deletion requires unloading, deletes files, and preserves installaticonst library=models.remove(id);assert.equal(fs.existsSync(file),false);assert.equal(fs.readFileSync(join(folder,'unrelated.txt'),'utf8'),'keep me');assert.equal(store.get().installed[id],undefined);assert.equal(library.variants.find(v=>v.id===id).state,'available');- `],{cwd:new URL('..',import.meta.url).pathname.replace(/^\/([A-Za-z]:)/,'$1'),env:{...process.env,STRATA_HOME:directory,STRATA_MODELS_DIR:join(directory,'models'),STRATA_REAL_ENGINE:'0'},encoding:'utf8'});+ `],{cwd:fileURLToPath(new URL('..',import.meta.url)),env:{...process.env,STRATA_HOME:directory,STRATA_MODELS_DIR:join(directory,'models'),STRATA_REAL_ENGINE:'0'},encoding:'utf8'});assert.equal(result.status,0,result.stderr||result.stdout);});diff --git a/apps/host/tests/runtime-api.test.mjs b/apps/host/tests/runtime-api.test.mjsindex 1d23edc2d..4afd6ef22 100644--- a/apps/host/tests/runtime-api.test.mjs+++ b/apps/host/tests/runtime-api.test.mjs@@ -1,3 +1,4 @@+import { fileURLToPath } from 'node:url';import test from 'node:test';import assert from 'node:assert/strict';import {spawn} from 'node:child_process';@@ -11,7 +12,7 @@ test('HTTP gateway lists all models, routes both protocols exactly, and isolatesconst home=await mkdtemp(join(tmpdir(),'strata-multiple-model-test-'));await mkdir(join(home,'data'));await writeFile(join(home,'data','state.json'),JSON.stringify({installed:{'qwen38-q4_k_m':{installedAt:'2026-10-14',simulated:true},'qwen36-q4_k_m':{installedAt:'2026-10-14',simulated:true}}}));const port=await freePort(),base=`http://127.0.0.1:${port}`;- const host=spawn(process.execPath,['server/index.mjs'],{cwd:new URL('..',import.meta.url).pathname.replace(/^\/([A-Za-z]:)/,'$1'),env:{...process.env,STRATA_HOME:home,STRATA_MODELS_DIR:join(home,'models'),STRATA_REAL_ENGINE:'0',STRATA_PORT:String(port),STRATA_BIND:'127.0.0.1'},stdio:'ignore'});+ const host=spawn(process.execPath,['server/index.mjs'],{cwd:fileURLToPath(new URL('..',import.meta.url)),env:{...process.env,STRATA_HOME:home,STRATA_MODELS_DIR:join(home,'models'),STRATA_REAL_ENGINE:'0',STRATA_PORT:String(port),STRATA_BIND:'127.0.0.1'},stdio:'ignore'});async function call(path,body){const response=await fetch(base+path,{method:body===undefined?'GET':'POST',headers:{'content-type':'application/json'},body:body===undefined?undefined:JSON.stringify(body)});return {status:response.status,body:await response.json()};}try{let ready=false;for(let i=0;i<80;i++){try{ready=(await call('/api/runtime')).status===200;if(ready)break;}catch{}await delay(100);}assert.ok(ready,'test host started');diff --git a/apps/host/tests/runtime-models.test.mjs b/apps/host/tests/runtime-models.test.mjsindex a3ed15997..a2bb00c9b 100644--- a/apps/host/tests/runtime-models.test.mjs+++ b/apps/host/tests/runtime-models.test.mjs@@ -1,3 +1,4 @@+import { fileURLToPath } from 'node:url';import test from 'node:test';import assert from 'node:assert/strict';import {createRuntimeModels,reservationBudget,rebalanceReservations} from '../server/runtime-models.mjs';@@ -46,7 +47,7 @@ test('load is rejected when unavailable, unsupported, or native multi-instance c// Monitor scoping must never carry one model's context or cache into another.import {build} from 'esbuild';-const bundled=await build({entryPoints:[new URL('../src/lib/runtime-models.ts',import.meta.url).pathname.replace(/^\/([A-Za-z]:)/,'$1')],bundle:true,write:false,platform:'node',format:'esm'});+const bundled=await build({entryPoints:[fileURLToPath(new URL('../src/lib/runtime-models.ts',import.meta.url))],bundle:true,write:false,platform:'node',format:'esm'});const {scopedMonitor}=await import(`data:text/javascript;base64,${Buffer.from(bundled.outputFiles[0].text).toString('base64')}`);test('Monitor keeps per-model requests/context separate and host RAM readings shared',()=>{const {service,load}=fixture();const a=load(['gpu-a']).instance,b=load(['gpu-b']).instance;diff --git a/apps/host/tests/settings-overlay.test.mjs b/apps/host/tests/settings-overlay.test.mjsindex 31972937b..c8a09df3e 100644--- a/apps/host/tests/settings-overlay.test.mjs+++ b/apps/host/tests/settings-overlay.test.mjs@@ -1,9 +1,10 @@+import { fileURLToPath } from 'node:url';import test from 'node:test';import assert from 'node:assert/strict';import { build } from 'esbuild';import { createRequire } from 'node:module';-const { outputFiles } = await build({ entryPoints: [new URL('../src/lib/router.ts', import.meta.url).pathname.replace(/^\/([A-Za-z]:)/,'$1')], bundle: true, write: false, platform: 'node', format: 'cjs' });+const { outputFiles } = await build({ entryPoints: [fileURLToPath(new URL('../src/lib/router.ts',import.meta.url))], bundle: true, write: false, platform: 'node', format: 'cjs' });const browserWindow = { location: { hash: '#/chat/a' }, matchMedia: () => ({ matches: false }) };let transitions = 0;const documentStub = { documentElement: { dataset: {} }, startViewTransition: () => { transitions++; return { ready: Promise.resolve(), updateCallbackDone: Promise.resolve(), finished: Promise.resolve() }; } };diff --git a/apps/host/tests/simplification.test.mjs b/apps/host/tests/simplification.test.mjsindex 6fcb39f14..d20131a9c 100644--- a/apps/host/tests/simplification.test.mjs+++ b/apps/host/tests/simplification.test.mjs@@ -1,3 +1,4 @@+import { fileURLToPath } from 'node:url';import assert from 'node:assert/strict';import { test } from 'node:test';import { readFile } from 'node:fs/promises';@@ -36,7 +37,7 @@ test('shared lifecycle policy blocks queued, active, disconnected and unknown sttest('blocked lifecycle writes do not change config; save-only still works', async () => {const { build } = await import('esbuild');const { createRequire } = await import('node:module');- const { outputFiles } = await build({entryPoints:[new URL('../src/lib/store.ts',import.meta.url).pathname.replace(/^\/([A-Za-z]:)/,'$1')],bundle:true,write:false,platform:'node',format:'cjs'});+ const { outputFiles } = await build({entryPoints:[fileURLToPath(new URL('../src/lib/store.ts',import.meta.url))],bundle:true,write:false,platform:'node',format:'cjs'});const mod={exports:{}}; new Function('require','module','exports','matchMedia',outputFiles[0].text)(createRequire(import.meta.url),mod,mod.exports,()=>({addEventListener(){},matches:false}));const store=mod.exports; const originalFetch=globalThis.fetch; const requests=[];globalThis.fetch=async (url, options) => {requests.push([url,options]); return new Response(JSON.stringify({expert:[],beginner:{contextLength:'recommended'},engine:{running:false}}),{status:200});};diff --git a/apps/host/tests/tune-and-timeskip-routes.test.mjs b/apps/host/tests/tune-and-timeskip-routes.test.mjsindex c9978abb5..b239aa4c4 100644--- a/apps/host/tests/tune-and-timeskip-routes.test.mjs+++ b/apps/host/tests/tune-and-timeskip-routes.test.mjs@@ -1,3 +1,4 @@+import { fileURLToPath } from 'node:url';/*** The tuning and Time-skip client routes.*@@ -20,8 +21,8 @@ import { mkdtemp, mkdir, writeFile, rm, chmod } from 'node:fs/promises';import { tmpdir } from 'node:os';import { join } from 'node:path';-const HOST = new URL('../server/index.mjs', import.meta.url).pathname.replace(/^\/([A-Za-z]:)/,'$1');-const REPO = new URL('../../..', import.meta.url).pathname.replace(/^\/([A-Za-z]:)/,'$1');+const HOST = fileURLToPath(new URL('../server/index.mjs',import.meta.url));+const REPO = fileURLToPath(new URL('../../..',import.meta.url));const wait = (ms) => new Promise((r) => setTimeout(r, ms));