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++
chat speed is decode speed with reasoning, context shown is the running model's, Models shows Unload while loaded, VRAM reserve floor, default text size 14, installer branding, icon
Niko12210db5d17102ad
diff --git a/apps/desktop/scripts/make-icons.mjs b/apps/desktop/scripts/make-icons.mjsnew file mode 100644index 000000000..411e4b97b--- /dev/null+++ b/apps/desktop/scripts/make-icons.mjs@@ -0,0 +1,78 @@+#!/usr/bin/env node+/**+ * The app and installer icon, refined from the existing Strata mark (apps/host/public/brand/strata-mark-*.svg and the current+ * icons/icon.png): the same three rounded bars on the same dark tile, in the same colours. Nothing is redrawn. What changes is+ * how it is cut for small sizes: at 16-48 px the bars are snapped to whole pixels and made a little bolder and wider so they+ * stay crisp instead of blurring; from 64 px up the geometry is the mark's own proportions.+ *+ * node apps/desktop/scripts/make-icons.mjs [--out <folder>] writes icon-<size>.png for every size and icon.ico+ */+import { existsSync, mkdirSync, writeFileSync } from 'node:fs';+import { dirname, join, resolve } from 'node:path';+import { fileURLToPath, pathToFileURL } from 'node:url';++const args = Object.fromEntries(process.argv.slice(2).reduce((acc, a, i, all) => (a.startsWith('--') ? [...acc, [a.slice(2), all[i + 1]]] : acc), []));+const here = dirname(fileURLToPath(import.meta.url));+const host = resolve(here, '../../host');+const out = resolve(args.out ?? join(here, '../src-tauri/icons'));+mkdirSync(out, { recursive: true });+const { chromium } = await import(pathToFileURL(join(host, 'node_modules/playwright-core/index.mjs')).href).catch(() => import('playwright-core'));+const CHROME = process.env.CHROME ?? ['C:/Program Files/Google/Chrome/Application/chrome.exe', '/usr/bin/google-chrome'].find(existsSync);++const TILE = '#161a1d', LIGHT = '#eef1f3', GREEN = '#34d399'; // the colours of the current icon.png++/** Integer geometry for the small sizes: bars on whole pixels, centred. Returns [{x,y,w,h,fill}]. */+function hinted(size) {+ const bar = Math.max(2, Math.round(size * 0.14)), gap = Math.max(2, Math.round(size * 0.1)), mid = bar + 1;+ const total = 2 * bar + mid + 2 * gap, top = Math.floor((size - total) / 2);+ const even = w => (w % 2 === size % 2 ? w : w + 1);+ const wide = even(Math.round(size * 0.5)), long = even(Math.round(size * 0.76));+ return [+ { x: (size - wide) / 2, y: top, w: wide, h: bar, fill: LIGHT },+ { x: (size - long) / 2, y: top + bar + gap, w: long, h: mid, fill: GREEN },+ { x: (size - wide) / 2, y: top + bar + gap + mid + gap, w: wide, h: bar, fill: LIGHT },+ ];+}+/** The mark's own proportions (from icon.png at 512): bars 34% / 50% / 34% wide, 9% high, on a tile with 21.5% corners. */+function proportional(size) {+ const k = size / 512;+ return [+ { x: 170 * k, y: 156 * k, w: 173 * k, h: 46 * k, fill: LIGHT },+ { x: 128 * k, y: 232 * k, w: 256 * k, h: 48 * k, fill: GREEN },+ { x: 170 * k, y: 309 * k, w: 173 * k, h: 46 * k, fill: LIGHT },+ ];+}+function svg(size) {+ const small = size <= 48;+ const bars = (small ? hinted(size) : proportional(size));+ const radius = small ? Math.round(size * 0.22) : size * 0.215;+ const rects = bars.map(b => `<rect x="${b.x}" y="${b.y}" width="${b.w}" height="${b.h}" rx="${small ? Math.min(b.h / 2, 1.5 + size / 32) : b.h / 2}" fill="${b.fill}"${small ? ' shape-rendering="crispEdges"' : ''}/>`).join('');+ return `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}"><rect width="${size}" height="${size}" rx="${radius}" fill="${TILE}"/>${rects}</svg>`;+}++const SIZES = [16, 20, 24, 32, 40, 48, 64, 96, 128, 256, 512, 1024];+const browser = await chromium.launch({ executablePath: CHROME, headless: true });+const png = {};+for (const size of SIZES) {+ const page = await browser.newPage({ viewport: { width: size, height: size }, deviceScaleFactor: 1 });+ await page.setContent(`<!doctype html><body style="margin:0;background:transparent">${svg(size)}</body>`);+ png[size] = await page.screenshot({ omitBackground: true, clip: { x: 0, y: 0, width: size, height: size } });+ await page.close();+ writeFileSync(join(out, `icon-${size}.png`), png[size]);+}+await browser.close();++// The .ico: one PNG image per size (16-256), the sizes Windows asks for at 100-250% scaling.+const ICO = [16, 20, 24, 32, 40, 48, 64, 96, 128, 256];+const head = Buffer.alloc(6); head.writeUInt16LE(0, 0); head.writeUInt16LE(1, 2); head.writeUInt16LE(ICO.length, 4);+let offset = 6 + 16 * ICO.length;+const entries = [], blobs = [];+for (const size of ICO) {+ const data = png[size], e = Buffer.alloc(16);+ e.writeUInt8(size === 256 ? 0 : size, 0); e.writeUInt8(size === 256 ? 0 : size, 1); e.writeUInt8(0, 2); e.writeUInt8(0, 3);+ e.writeUInt16LE(1, 4); e.writeUInt16LE(32, 6); e.writeUInt32LE(data.length, 8); e.writeUInt32LE(offset, 12);+ offset += data.length; entries.push(e); blobs.push(data);+}+writeFileSync(join(out, 'icon.ico'), Buffer.concat([head, ...entries, ...blobs]));+writeFileSync(join(out, 'icon.png'), png[512]);+console.log('icons in', out, ICO.join(','));diff --git a/apps/desktop/scripts/make-installer-images.mjs b/apps/desktop/scripts/make-installer-images.mjsnew file mode 100644index 000000000..f12d6cc15--- /dev/null+++ b/apps/desktop/scripts/make-installer-images.mjs@@ -0,0 +1,66 @@+#!/usr/bin/env node+/**+ * The installer's pictures, drawn from the app's own design: the light surface and ink colours of the app (src/styles tokens), the+ * brand lockup and mark files, GT Walsheim Bold for the words (baked into the pictures, because NSIS cannot use a web font).+ *+ * node apps/desktop/scripts/make-installer-images.mjs [--out <folder>] [--preview <folder>]+ *+ * Writes sidebar.bmp (164x314, the welcome and finish pages) and header.bmp (150x57, the other pages) as 24-bit BMPs, and with+ * --preview the same as PNGs at 3x.+ */+import { spawnSync } from 'node:child_process';+import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';+import { dirname, join, resolve } from 'node:path';+import { fileURLToPath, pathToFileURL } from 'node:url';+import { tmpdir } from 'node:os';++const args = Object.fromEntries(process.argv.slice(2).reduce((acc, a, i, all) => (a.startsWith('--') ? [...acc, [a.slice(2), all[i + 1]]] : acc), []));+const here = dirname(fileURLToPath(import.meta.url));+const host = resolve(here, '../../host');+const out = resolve(args.out ?? join(here, '../src-tauri/nsis'));+mkdirSync(out, { recursive: true });+const { chromium } = await import(pathToFileURL(join(host, 'node_modules/playwright-core/index.mjs')).href).catch(() => import('playwright-core'));+const CHROME = process.env.CHROME ?? ['C:/Program Files/Google/Chrome/Application/chrome.exe', '/usr/bin/google-chrome'].find(existsSync);+const font = pathToFileURL(join(host, 'public/fonts/GTWalsheimPro-Bold.woff2')).href;+const fontMedium = pathToFileURL(join(host, 'public/fonts/GTWalsheimPro-Medium.woff2')).href;+const lockup = readFileSync(join(host, 'public/brand/strata-lockup-light.svg'), 'utf8');+const mark = readFileSync(join(host, 'public/brand/strata-mark-light.svg'), 'utf8');++// the app's light tokens+const SURFACE = '#f9fafb', INK = '#171b1e', MUTED = '#5b646b', ACCENT = '#10b981', LINE = '#e3e8ea';+const css = `@font-face{font-family:GT;font-weight:700;src:url(${font})}@font-face{font-family:GT;font-weight:500;src:url(${fontMedium})}+*{box-sizing:border-box}body{margin:0;font-family:GT,'Segoe UI',sans-serif;color:${INK};background:${SURFACE}}`;++const pages = {+ sidebar: { w: 164, h: 314, html: `<div style="width:164px;height:314px;padding:22px 18px;display:flex;flex-direction:column;background:linear-gradient(180deg,#f9fafb 0%,#eef6f2 100%);border-right:1px solid ${LINE}">+ <div style="height:26px">${lockup.replace('<svg', '<svg style="height:26px;width:auto;display:block"')}</div>+ <div style="margin-top:auto">+ <div style="font-weight:700;font-size:22px;line-height:1.12;letter-spacing:-.01em">State of<br>the art.<br>At home.</div>+ <div style="margin-top:10px;font-weight:500;font-size:11px;line-height:1.5;color:${MUTED}">AI on your own computer.<br>Private. Fast. Easy.</div>+ <div style="margin-top:16px;height:3px;width:34px;border-radius:2px;background:${ACCENT}"></div>+ </div></div>` },+ header: { w: 150, h: 57, html: `<div style="width:150px;height:57px;display:flex;align-items:center;justify-content:flex-end;padding-right:12px;background:${SURFACE}">${lockup.replace('<svg', '<svg style="height:22px;width:auto;display:block"')}</div>` },+};++const browser = await chromium.launch({ executablePath: CHROME, headless: true });+const work = join(tmpdir(), 'strata-installer-images'); mkdirSync(work, { recursive: true });+for (const [name, page] of Object.entries(pages)) {+ for (const scale of [1, 3]) {+ const file = join(work, `${name}.html`);+ writeFileSync(file, `<!doctype html><meta charset="utf-8"><style>${css}</style><body>${page.html}</body>`);+ const tab = await browser.newPage({ viewport: { width: page.w, height: page.h }, deviceScaleFactor: scale });+ await tab.goto(pathToFileURL(file).href);+ await tab.evaluate(() => document.fonts.ready);+ await tab.waitForTimeout(200);+ const png = join(work, `${name}@${scale}.png`);+ await tab.screenshot({ path: png, clip: { x: 0, y: 0, width: page.w, height: page.h } });+ await tab.close();+ if (scale === 3 && args.preview) { mkdirSync(resolve(args.preview), { recursive: true }); writeFileSync(join(resolve(args.preview), `${name}.png`), readFileSync(png)); }+ }+}+await browser.close();+// 24-bit BMP, the format NSIS wants: render at 3x, shrink with a good filter+const py = `import sys\nfrom PIL import Image\nfor name in ('sidebar','header'):\n im = Image.open(sys.argv[1] + '/' + name + '@3.png').convert('RGB')\n w, h = im.width // 3, im.height // 3\n im.resize((w, h), Image.LANCZOS).save(sys.argv[2] + '/' + name + '.bmp', 'BMP')\n`;+const done = spawnSync('python', ['-c', py, work, out], { encoding: 'utf8' });+if (done.status !== 0) { console.error(done.stderr); process.exit(1); }+console.log('wrote', join(out, 'sidebar.bmp'), join(out, 'header.bmp'));diff --git a/apps/desktop/scripts/ui-flows.mjs b/apps/desktop/scripts/ui-flows.mjsindex 3fc3f0e8f..69e261a8f 100644--- a/apps/desktop/scripts/ui-flows.mjs+++ b/apps/desktop/scripts/ui-flows.mjs@@ -98,19 +98,23 @@ for line in sys.stdin:`;writeFileSync(join(control, 'tools', 'strata_mcp.py'), FAKE_INSTALLER);-const FAKE_ENGINE = `import os, sys, json+const FAKE_ENGINE = `import os, sys, json, timefrom pathlib import Pathif os.environ.get('FAKE_ENGINE_FAIL'):print('memory guard: 5.1 GiB of RAM free is under the 6 GiB limit (limit 63.1 GiB)', flush=True)sys.exit(3)-print('READY 4096 stop', flush=True)+ctx = '4096'+if '--max-context' in sys.argv: ctx = sys.argv[sys.argv.index('--max-context') + 1]+print('READY %s stop' % ctx, flush=True)for line in sys.stdin:if line.strip() == 'QUIT': breakif line.startswith(('GEN ', 'BGEN ')):slot = int(line.split()[1]) if line.startswith('BGEN ') else None+ t0 = time.time(); n = 0for ch in os.environ.get('FAKE_REPLY', 'a'):- print('T %d' % ord(ch), flush=True)- print('DONE 1 1 1.0 1.0 length 0 0 0', flush=True)+ print('T %d' % ord(ch), flush=True); n += 1+ if os.environ.get('FAKE_TOKEN_DELAY'): time.sleep(float(os.environ['FAKE_TOKEN_DELAY']))+ print('DONE %d 12 300.0 %.1f length 0 0 0' % (n, max(1.0, (time.time() - t0) * 1000)), flush=True)if slot is not None: print(f'BADM {slot} 0', flush=True)`;@@ -243,11 +247,22 @@ await scenario('models', { installed: true }, async ({ base, api, browser, shotfor (let i = 0; i < 90 && !ready; i++) { const s = (await api('/api/native')).body; ready = s.instances.some(x => x.status === 'ready'); const err = s.instances.find(x => x.status === 'error'); if (err) throw new Error('load failed: ' + err.error); await delay(1000); }if (!ready) { const st = (await api('/api/native')).body; console.log('info jobs', JSON.stringify(st.jobs.map(j => [j.kind, j.state, j.error ?? j.summary])), 'instances', JSON.stringify(st.instances.map(i => [i.status, i.error]))); await shot(page, '2-models-after-click'); }check(ready, 'the model loads (a fake engine under the real Control)');+ await page.reload({ waitUntil: 'domcontentloaded' });+ await page.getByRole('button', { name: /^Unload$/ }).first().waitFor({ timeout: 30000 }).catch(() => {});+ await shot(page, '3-models-loaded');+ check(await page.getByRole('button', { name: /^Unload$/ }).count() > 0, 'after a reload the Models screen shows the model as loaded, with Unload');+ check(await page.getByRole('button', { name: /^Load model$/ }).count() === 0, 'and no longer offers Load model');+ await page.getByRole('button', { name: /^Unload$/ }).first().click();+ let gone = false;+ for (let i = 0; i < 40 && !gone; i++) { gone = (await api('/api/native')).body.instances.length === 0; await delay(500); }+ check(gone, 'Unload stops the engine');+ await page.getByRole('button', { name: /^Load model$/ }).first().waitFor({ timeout: 15000 }).catch(() => {});+ check(await page.getByRole('button', { name: /^Load model$/ }).count() > 0, 'and Load model is back');check(page.problems.length === 0, 'no page error', page.problems.join('; '));});// ------------------------------------------------------------------------------------------------ tune + reading size-await scenario('tune', { installed: true, env: { FAKE_REPLY: ['I am thinking about it.', '</think>', '', 'Here is a list:', '', '- one', '- two', '', '## Heading', '', 'Some `code` and **bold** text.', '', '| a | b |', '|---|---|', '| 1 | 2 |', '', '```', 'code line', '```', ''].join(String.fromCharCode(10)) } }, async ({ base, api, browser, dirs, shot }) => {+await scenario('tune', { installed: true, env: { FAKE_TOKEN_DELAY: '0.02', FAKE_REPLY: ['I am thinking about it.', '</think>', '', 'Here is a list:', '', '- one', '- two', '', '## Heading', '', 'Some `code` and **bold** text.', '', '| a | b |', '|---|---|', '| 1 | 2 |', '', '```', 'code line', '```', ''].join(String.fromCharCode(10)) } }, async ({ base, api, browser, dirs, shot }) => {const page = await newPage(browser, base);await clickText(page, /get started/i);await page.getByText(/Choose a version/i).waitFor({ timeout: 30000 });@@ -272,23 +287,51 @@ await scenario('tune', { installed: true, env: { FAKE_REPLY: ['I am thinking aboawait page.locator('.st-msg--assistant .st-bubble').first().waitFor({ timeout: 60000 });await page.locator('.st-msg--assistant .st-bubble p').first().waitFor({ timeout: 60000 }).catch(async () => console.log('info reply so far:', JSON.stringify(await page.locator('.st-msg--assistant').first().innerText()).slice(0, 300)));await page.waitForFunction(() => !document.querySelector('.st-msg--assistant .caret'), null, { timeout: 90000 }).catch(() => {});+ // the chat's telemetry chips: speed and context+ const chips = page.locator('.telemetry__chip');+ const chipTexts = await chips.allInnerTexts();+ console.log('info chips', JSON.stringify(chipTexts));+ let speedText = '', contextText = '';+ for (let i = 0; i < await chips.count(); i++) {+ await chips.nth(i).click();+ await delay(400);+ const pop = await page.locator('.telepop').last().innerText().catch(() => '');+ if (/tok\/s|speed/i.test(pop) && !speedText) speedText = pop;+ if (/context/i.test(pop) && !contextText) contextText = pop;+ await page.keyboard.press('Escape');+ }+ const tps = Number(speedText.match(/([\d.]+)\s*tok(?:ens)?\/s/)?.[1] ?? NaN);+ check(tps > 15 && tps < 120, 'the speed shown is the decode speed (the engine paced at ~50 tokens a second)', speedText.replace(/\s+/g, ' ').slice(0, 160));+ check(/32\.8K|32K|32,768|32768/.test(contextText) && !/128K/.test(contextText), 'the context shown is the one the model runs with (32K), not 128K', contextText.replace(/\s+/g, ' ').slice(0, 160));const sizes = [];- for (const px of [12, 16, 22]) {+ for (const px of [12, 14, 16, 22]) {await page.evaluate(v => { const k = 'strata.prefs.v2'; const cur = JSON.parse(localStorage.getItem(k) || '{}'); localStorage.setItem(k, JSON.stringify({ ...cur, contentFontSize: v })); }, px);await page.reload({ waitUntil: 'domcontentloaded' });await page.locator('.st-msg--assistant .st-bubble').first().waitFor({ timeout: 30000 });+ await page.screenshot({ path: join(shots, `tune-3-chat-${px}px.png`) });sizes.push(await page.evaluate(() => { const b = document.querySelector('.st-msg--assistant .st-bubble'); const t = b.querySelector('p, .md-li, span') ?? b; const u = document.querySelector('.st-msg--user .st-bubble'); const all = {}; for (const el of b.querySelectorAll('*')) { if (!el.childNodes.length || ![...el.childNodes].some(n => n.nodeType === 3 && n.textContent.trim())) continue; all[el.tagName.toLowerCase() + (el.className ? '.' + String(el.className).split(' ')[0] : '')] = parseFloat(getComputedStyle(el).fontSize); } const extra = {}; for (const [k, q] of Object.entries({ reasoning: '.st-msg--assistant .st-collapse__body', codeblock: '.st-msg--assistant .st-code pre', codehead: '.st-msg--assistant .st-code__head' })) { const e = document.querySelector(q); if (e) extra[k] = parseFloat(getComputedStyle(e).fontSize); } Object.assign(all, extra); const chain = []; for (let e = b.querySelector('p'); e && e !== b; e = e.parentElement) chain.push(e.tagName + '.' + String(e.className).split(' ')[0] + '=' + getComputedStyle(e).fontSize); all.chain = chain; globalThis.__all = all; return [parseFloat(getComputedStyle(b).fontSize), parseFloat(getComputedStyle(t).fontSize), parseFloat(getComputedStyle(u).fontSize), all]; }));}console.log('info chain', JSON.stringify(await page.evaluate(() => { const el = document.querySelector('.st-msg--assistant .st-bubble p'); const out = []; for (let e = el; e && !e.classList.contains('st-msg'); e = e.parentElement) out.push(e.tagName + '.' + String(e.className).split(' ')[0] + '=' + getComputedStyle(e).fontSize); return out; })));+ // which visible text does NOT follow the reading size? (same elements at 12 and 22)+ const survey = async px => { await page.evaluate(v => { const k = 'strata.prefs.v2'; const cur = JSON.parse(localStorage.getItem(k) || '{}'); localStorage.setItem(k, JSON.stringify({ ...cur, contentFontSize: v })); }, px); await page.reload({ waitUntil: 'domcontentloaded' }); await page.locator('.st-msg--assistant .st-bubble').first().waitFor({ timeout: 30000 }); await delay(600);+ return page.evaluate(() => { const out = {}; for (const el of document.querySelectorAll('main *, .chat *, textarea')) { if (![...el.childNodes].some(n => n.nodeType === 3 && n.textContent.trim()) && el.tagName !== 'TEXTAREA') continue; const r = el.getBoundingClientRect(); if (!r.width || !r.height) continue; const key = el.tagName.toLowerCase() + '.' + String(el.className).split(' ')[0] + ' <' + (el.parentElement?.className ?? '').toString().split(' ')[0] + '>'; out[key] = parseFloat(getComputedStyle(el).fontSize); } return out; }); };+ const a = await survey(12), b = await survey(22);+ // a fresh app (nothing saved) uses 14 px+ await page.evaluate(() => localStorage.removeItem('strata.prefs.v2'));+ await page.reload({ waitUntil: 'domcontentloaded' });+ await page.locator('.st-msg--assistant .st-bubble').first().waitFor({ timeout: 30000 });+ check(await page.evaluate(() => getComputedStyle(document.querySelector('.st-msg--assistant .st-bubble')).fontSize) === '14px', 'the default reading size is 14 px');+ const fixed = Object.keys(a).filter(k => k in b && a[k] === b[k]);+ console.log('info text that does not follow the reading size:', JSON.stringify(fixed.map(k => k + '=' + a[k])));await shot(page, '2-chat-22px');console.log('info sizes', JSON.stringify(sizes), JSON.stringify(await page.locator('.st-msg--assistant .st-bubble').first().innerHTML()).slice(0, 400));- check(sizes[0][1] === 12 && sizes[1][1] === 16 && sizes[2][1] === 22 && sizes[0][2] === 12 && sizes[2][2] === 22, 'the reading size changes the text size of the conversation', JSON.stringify(sizes));+ check(sizes[0][1] === 12 && sizes[1][1] === 14 && sizes[2][1] === 16 && sizes[3][1] === 22 && sizes[0][2] === 12 && sizes[3][2] === 22, 'the reading size changes the text size of the conversation', JSON.stringify(sizes));// the slider itselfawait page.evaluate(() => { location.hash = '#/chat?settings=1'; });const slider = page.getByLabel('Reading text size');if (await slider.count()) {await slider.first().focus();- for (let i = 0; i < 4; i++) await page.keyboard.press('ArrowLeft');+ for (let i = 0; i < 4; i++) await page.keyboard.press('ArrowRight');await delay(500);const now = await page.evaluate(() => getComputedStyle(document.querySelector('.st-msg--assistant .st-bubble') ?? document.body).fontSize);check(parseFloat(now) === 18, 'moving the slider changes the conversation text at once', now);diff --git a/apps/desktop/src-tauri/icons/128x128.png b/apps/desktop/src-tauri/icons/128x128.pngindex 63fb845f0..432eaf489 100644Binary files a/apps/desktop/src-tauri/icons/128x128.png and b/apps/desktop/src-tauri/icons/128x128.png differdiff --git a/apps/desktop/src-tauri/icons/[email protected] b/apps/desktop/src-tauri/icons/[email protected]index 3417d3529..3bea2d8ff 100644Binary files a/apps/desktop/src-tauri/icons/[email protected] and b/apps/desktop/src-tauri/icons/[email protected] differdiff --git a/apps/desktop/src-tauri/icons/32x32.png b/apps/desktop/src-tauri/icons/32x32.pngindex a3b6ecbad..c84b94653 100644Binary files a/apps/desktop/src-tauri/icons/32x32.png and b/apps/desktop/src-tauri/icons/32x32.png differdiff --git a/apps/desktop/src-tauri/icons/64x64.png b/apps/desktop/src-tauri/icons/64x64.pngindex 6152d38ad..c8c67a042 100644Binary files a/apps/desktop/src-tauri/icons/64x64.png and b/apps/desktop/src-tauri/icons/64x64.png differdiff --git a/apps/desktop/src-tauri/icons/icon.ico b/apps/desktop/src-tauri/icons/icon.icoindex a052e27f4..e38a27ec3 100644Binary files a/apps/desktop/src-tauri/icons/icon.ico and b/apps/desktop/src-tauri/icons/icon.ico differdiff --git a/apps/desktop/src-tauri/icons/icon.png b/apps/desktop/src-tauri/icons/icon.pngindex 3b9470607..da9c7603c 100644Binary files a/apps/desktop/src-tauri/icons/icon.png and b/apps/desktop/src-tauri/icons/icon.png differdiff --git a/apps/desktop/src-tauri/nsis/header.bmp b/apps/desktop/src-tauri/nsis/header.bmpnew file mode 100644index 000000000..efc77717dBinary files /dev/null and b/apps/desktop/src-tauri/nsis/header.bmp differdiff --git a/apps/desktop/src-tauri/nsis/installer.nsi b/apps/desktop/src-tauri/nsis/installer.nsiindex cca93d5d9..0c6fe9aa0 100644--- a/apps/desktop/src-tauri/nsis/installer.nsi+++ b/apps/desktop/src-tauri/nsis/installer.nsi@@ -165,6 +165,16 @@ VIAddVersionKey "ProductVersion" "${VERSION}"!define MUI_LANGDLL_REGISTRY_KEY "${MANUPRODUCTKEY}"!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"+; Strata's look and words: the app's light surface and ink, short copy, no directory page, straight on to the progress.+!define MUI_BGCOLOR "F9FAFB"+!define MUI_TEXTCOLOR "171B1E"+!define MUI_INSTFILESPAGE_PROGRESSBAR "smooth"+!define MUI_WELCOMEPAGE_TITLE "State of the art. At home."+!define MUI_WELCOMEPAGE_TEXT "Strata runs AI on your own computer.$\r$\n$\r$\nThis takes about a minute and needs no administrator. You choose your first model inside Strata."+!define MUI_FINISHPAGE_TITLE "Strata is ready."+!define MUI_FINISHPAGE_TEXT "Open it to pick your first model. Strata downloads it for you and gets it ready."+!define MUI_FINISHPAGE_RUN_TEXT "Open Strata"+; Installer pages, must be ordered as they appear; 1. Welcome Page!define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfPassive@@ -395,7 +405,7 @@ Function PageLeaveReinstallFunctionEnd; 5. Choose install directory page-!define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfPassive+!define MUI_PAGE_CUSTOMFUNCTION_PRE Skip!insertmacro MUI_PAGE_DIRECTORY; 6. Start menu shortcut page@@ -415,7 +425,7 @@ Var AppStartMenuFolder;; Don't auto jump to finish page after installation page,; because the installation page has useful info that can be used debug any issues with the installer.-!define MUI_FINISHPAGE_NOAUTOCLOSE+; (no NOAUTOCLOSE: welcome, progress, finish); Use show readme button in the finish page as a button create a desktop shortcut!define MUI_FINISHPAGE_SHOWREADME!define MUI_FINISHPAGE_SHOWREADME_TEXT "$(createDesktop)"diff --git a/apps/desktop/src-tauri/nsis/sidebar.bmp b/apps/desktop/src-tauri/nsis/sidebar.bmpnew file mode 100644index 000000000..9d936c6cfBinary files /dev/null and b/apps/desktop/src-tauri/nsis/sidebar.bmp differdiff --git a/apps/desktop/src-tauri/tauri.conf.json b/apps/desktop/src-tauri/tauri.conf.jsonindex 585c61cb1..daf8c6218 100644--- a/apps/desktop/src-tauri/tauri.conf.json+++ b/apps/desktop/src-tauri/tauri.conf.json@@ -24,7 +24,8 @@"deb"],"icon": [- "icons/icon.png"+ "icons/icon.png",+ "icons/icon.ico"],"category": "DeveloperTool","shortDescription": "Local AI, tuned to one model.",@@ -45,6 +46,9 @@"nsis": {"installMode": "currentUser","template": "nsis/installer.nsi",+ "headerImage": "nsis/header.bmp",+ "sidebarImage": "nsis/sidebar.bmp",+ "installerIcon": "icons/icon.ico","compression": "lzma","languages": ["English"diff --git a/apps/host/server/inference.mjs b/apps/host/server/inference.mjsindex 1c2fbde14..c3735863a 100644--- a/apps/host/server/inference.mjs+++ b/apps/host/server/inference.mjs@@ -278,6 +278,12 @@ export async function proxyCompletion({ baseUrl, message, history = [], systemPrlet streaming = true;let writing = false;let timings=null,finishReason=null;+ /* The speed shown while it streams is the decode speed of everything generated, reasoning included, from the first token: tokens+ (one per streamed chunk, or characters / 4 when the server batches) over the time since the first token, never the visible+ answer over the whole wall time. The engine's own numbers replace it when the answer is done. */+ let chunks=0,chars=0,lastStats=0;+ const liveStats=()=>{if(supervised||firstTokenAt===null)return;const now=Date.now();if(now-lastStats<400)return;const seconds=(now-firstTokenAt)/1000;if(seconds<.5)return;lastStats=now;+ const tokens=chars/Math.max(1,chunks)<8?chunks:Math.ceil(chars/4);onFrame({type:'stats',tokensOut:tokens,tps:Number((tokens/seconds).toFixed(1)),source:'stream'});};const metricsTicker = supervised? setInterval(() => {@@ -325,12 +331,16 @@ export async function proxyCompletion({ baseUrl, message, history = [], systemPrif (delta.reasoning_content) {if (firstTokenAt === null) engine?.beginThinking();if (firstTokenAt === null) firstTokenAt = Date.now();+ chunks++; chars+=delta.reasoning_content.length;onFrame({ type: 'reasoning', text: delta.reasoning_content });+ liveStats();}if (delta.content) {if (!writing) { engine?.beginGenerating(); writing = true; }if (firstTokenAt === null) firstTokenAt = Date.now();+ chunks++; chars+=delta.content.length;onFrame({ type: 'delta', text: delta.content });+ liveStats();}}if (done) break;diff --git a/apps/host/server/native-resources.mjs b/apps/host/server/native-resources.mjsindex 10f9dcc64..eda84f7f2 100644--- a/apps/host/server/native-resources.mjs+++ b/apps/host/server/native-resources.mjs@@ -15,9 +15,12 @@ export function resourceSettings(config,hardware,profile,model={}){args.push('--pool-workers',String(previous>0?Math.min(previous,workers):workers));}// Preserve calibrated worker counts and the installation's safety/vision reserve.- const safety=Math.max(config.vision?2048:700,baseline.reserve);const placement=Array.isArray(config.gpu)?config.gpu:[config.gpu??0];const gpuMemory=(hardware?.gpus??[]).filter(g=>placement.includes(g.index)).map(g=>g.vram_gb).filter(n=>Number.isFinite(n)&&n>0);+ /* The engine warns below ~1-1.5 GiB of free VRAM (the driver then pages GPU memory to system RAM and decoding falls to a few tokens a+ second, #2065), so neither profile may reserve less: 1536 MiB on a card of 16 GB or less, 1024 above; with pictures 2048. */+ const floor=gpuMemory.length&&Math.min(...gpuMemory)>16?1024:1536;+ const safety=Math.max(config.vision?2048:floor,baseline.reserve);const reserve=profile==='work'&&gpuMemory.length?Math.max(safety,Math.floor(Math.min(...gpuMemory)*1024*.2)):safety;remove('--vram-reserve-mib');args.push('--vram-reserve-mib',String(reserve));// RAM: "leave 20% for my work" keeps the model's RAM within 80% of the PC. A model whose experts do not fit there (thediff --git a/apps/host/src/components/NativeModels.tsx b/apps/host/src/components/NativeModels.tsxindex f635d82bf..e728b9272 100644--- a/apps/host/src/components/NativeModels.tsx+++ b/apps/host/src/components/NativeModels.tsx@@ -32,6 +32,8 @@ export function NativeModels({ onOtherModels, onReady, onImport, onConnectEngineexpertSection.current?.scrollIntoView({ block: 'start', behavior: 'smooth' }); }, [expert]);const selectedFamily = families.find(f => f.family === family || f.sizes.some(size => size.sourceFamily === family)) ?? families[0], selectedSize = selectedFamily?.sizes.find(s => s.id === size) ?? selectedFamily?.sizes[0];const installed = native?.installed?.models.find(m => m.model === selectedSize?.id);+ // The model that is running is shown as running, with Unload: not offered for loading again.+ const loadedSelected = native?.instances.find(i => i.model === selectedSize?.id && i.status === 'ready');// A model that is already on this PC loads as it was prepared: the page shows its settings, so loading it never asks to download.useEffect(() => { if (installed?.ready) {if (installed.context)@@ -101,7 +103,7 @@ export function NativeModels({ onOtherModels, onReady, onImport, onConnectEngine{tr(active ? <NativeProgress job={active}/> : null)}{tr(job?.state === 'error' ? <ErrorNotice message={job.error ?? job.summary} action={tr("Retry")} onRetry={() => void load()}/> : null)}{tr(error ? <ErrorNotice message={error}/> : null)}- <div className="native-model-actions">{tr(onReady && native?.instances.some(i => i.status === 'ready') ? <Btn variant="primary" onClick={onReady}>{tr("Start chatting")}</Btn> : <><Btn icon="gauge" disabled={!native?.instances.some(i => i.status === 'ready') || !!active} onClick={() => setBenchmark(true)}>{tr("Tune model")}</Btn><Btn variant="primary" icon="models" disabled={pending || !native?.available || !!active || !selectedSize || expert && deviceChoice === 'split' && gpus.length < 2} onClick={() => void load()}>{tr(pending ? 'Checking…' : installed?.ready ? 'Load model' : 'Download & load')}</Btn></>)}</div>+ <div className="native-model-actions">{tr(loadedSelected ? <><Btn icon="gauge" disabled={!!active} onClick={() => setBenchmark(true)}>{tr("Tune model")}</Btn><Btn disabled={pending || !!active} onClick={() => void perform(() => nativeAction(`instances/${loadedSelected.id}/unload`))}>{tr("Unload")}</Btn>{tr(onReady ? <Btn variant="primary" onClick={onReady}>{tr("Start chatting")}</Btn> : <span className="native-ready">{tr("Ready")}</span>)}</> : onReady && native?.instances.some(i => i.status === 'ready') ? <Btn variant="primary" onClick={onReady}>{tr("Start chatting")}</Btn> : <><Btn icon="gauge" disabled={!native?.instances.some(i => i.status === 'ready') || !!active} onClick={() => setBenchmark(true)}>{tr("Tune model")}</Btn><Btn variant="primary" icon="models" disabled={pending || !native?.available || !!active || !selectedSize || expert && deviceChoice === 'split' && gpus.length < 2} onClick={() => void load()}>{tr(pending ? 'Checking…' : installed?.ready ? 'Load model' : 'Download & load')}</Btn></>)}</div></div><aside className="stack stack--lg"><section className="st-card"><h2 className="h4">{tr("This computer")}</h2><p>{tr(native?.hardware?.ram_gb || hardware?.memory.totalGb || '—')}{tr(" GB RAM")}</p>{tr(native?.hardware?.gpus.length ? native.hardware.gpus.map(g => <p className="small" key={g.index}>{tr(g.name)} · {tr(g.vram_gb)}{tr(" GB")}</p>) : <p className="small muted">{tr("No supported GPU reported by this installation.")}</p>)}<p className="small muted">{tr("Compatibility and sizes come from your installed Strata version.")}</p></section><section className="st-card"><h2 className="h4">{tr("Model files")}</h2><p className="small muted">{tr("Strata prepares all shards, the draft layer and shared files. Completed downloads are reused.")}</p><code className="native-path">{installed?.dataFolder ?? native?.downloadDirectory ?? native?.installed?.data_folder ?? 'Choose an installation'}</code><Btn size="sm" variant="ghost" onClick={() => { setSettingsSection('Storage'); go('settings'); }}>{tr("Storage settings")}</Btn></section><Btn size="sm" variant="ghost" onClick={onOtherModels}>{tr("Other local models\u2026")}</Btn></aside></div>diff --git a/apps/host/src/components/TelemetryPopover.tsx b/apps/host/src/components/TelemetryPopover.tsxindex 15522f8a7..f44e1ccf4 100644--- a/apps/host/src/components/TelemetryPopover.tsx+++ b/apps/host/src/components/TelemetryPopover.tsx@@ -6,6 +6,7 @@ import { ContextRing } from './ContextRing';import { Popover } from './Popover';import { chatMetrics, compactTokens, elapsed } from '../lib/chat-metrics';import { useStore } from '../lib/store';+import { useNative } from '../lib/native';import type { Session } from '../lib/types';function Chip({ icon, visual, label, title, children }: {icon?: IconName;@@ -46,7 +47,11 @@ export function ChatTelemetry({ session }: {}) {const monitor = useStore(s => s.monitor);const engine = useStore(s => s.engine);- const m = chatMetrics(session, monitor, engine ? contextTokens(engine.beginner.contextLength) : undefined);+ // The context shown is the one the loaded model runs with (the engine's own --max-context), not a catalog or settings default.+ const native = useNative();+ const running = native?.instances.find(i => i.id === native.defaultId && i.status === 'ready') ?? native?.instances.find(i => i.status === 'ready');+ const runningContext = running ? Number(running.metrics?.engine?.max_context) || running.context || undefined : undefined;+ const m = chatMetrics(session, monitor, runningContext ?? (engine ? contextTokens(engine.beginner.contextLength) : undefined));const speed = useCalmSpeed(m.speed, session?.id ?? null, m.streaming);if (!m.hasReplies)return null;diff --git a/apps/host/src/lib/store.ts b/apps/host/src/lib/store.tsindex 18703366e..f2ae03074 100644--- a/apps/host/src/lib/store.ts+++ b/apps/host/src/lib/store.ts@@ -141,7 +141,7 @@ const PREFS_DEFAULTS: Prefs = {contrast: 'standard',rail: false,focus: false,- contentFontSize: 16,+ contentFontSize: 14,density: 'comfortable',motion: 'system',transparency: 'translucent',@@ -188,7 +188,7 @@ function loadPrefs(): Prefs {...parsed,language: validLanguage(parsed.language) ? parsed.language : 'en',fontFamily: typeof parsed.fontFamily === 'string' ? parsed.fontFamily.slice(0,128).replace(/[\x00-\x1f]/g,'') : '',- contentFontSize: Math.min(CONTENT_FS_MAX, Math.max(CONTENT_FS_MIN, Number(parsed.contentFontSize) || 16)),+ contentFontSize: Math.min(CONTENT_FS_MAX, Math.max(CONTENT_FS_MIN, Number(parsed.contentFontSize) || 14)),};} catch {/* fall through to the next key */@@ -1353,7 +1353,7 @@ export async function sendMessage(text: string) {} else if (type === 'agent') {patchSession(sessionId, s => ({ ...s, agents: updateAgent(s.agents ?? [], frame.agent) }));} else if (type === 'delta') {- patchAssistant((m) => { const content=m.content+String(frame.text??''); const count=Math.max(1,Math.ceil(content.length/4)); const seconds=Math.max(.1,(performance.now()-started)/1000); return {...m,content,tokens:count,inputTokens:m.inputTokens??Math.ceil((body.length+prior.reduce((n,p)=>n+p.content.length,0))/4),tps:count/seconds,usageSource:'estimated'}; });+ patchAssistant((m) => { const content=m.content+String(frame.text??''); const count=Math.max(1,Math.ceil((content.length+(m.reasoning?.length??0))/4)); return {...m,content,tokens:m.usageSource==='estimated'&&m.tps?m.tokens:count,inputTokens:m.inputTokens??Math.ceil((body.length+prior.reduce((n,p)=>n+p.content.length,0))/4),usageSource:'estimated'}; });} else if (type === 'artifacts' && Array.isArray(frame.artifacts)) {patchAssistant(m => ({ ...m, artifacts: frame.artifacts as PreviewArtifact[] }));} else if(type==='native-tool'){diff --git a/apps/host/src/styles/app.css b/apps/host/src/styles/app.cssindex b37f74af0..0c7c1f2b7 100644--- a/apps/host/src/styles/app.css+++ b/apps/host/src/styles/app.css@@ -452,11 +452,11 @@the text size — a fixed px allowance drifts at the extremes. */.app[data-focus='true'] .slashmenu,.app[data-focus='true'] .chat__inner {- font-size: var(--st-content-fs, 16px);+ font-size: var(--st-content-fs, 14px);max-width: calc(var(--st-measure) + 2.5em);}.app[data-focus='true'] .composer__inner {- font-size: var(--st-content-fs, 16px);+ font-size: var(--st-content-fs, 14px);/* the same column, less the transcript's 28px padding on each side */max-width: calc(var(--st-measure) + 2.5em - 56px);}@@ -474,8 +474,8 @@— the same scoping DSH uses for its 10–22px content setting. */.st-msg--assistant .st-bubble,.st-msg--user .st-bubble {- font-size: var(--st-content-fs, 16px);- line-height: calc(var(--st-content-fs, 16px) * 1.62);+ font-size: var(--st-content-fs, 14px);+ line-height: calc(var(--st-content-fs, 14px) * 1.62);}/* Density — the difference between scanning data and reading it. */@@ -6998,10 +6998,13 @@ textarea {model's reasoning keep their usual proportion (18px, 13px, 13px at the 16px default) at any size. */.st-bubble h2, .st-bubble h3, .st-bubble h4 { font-size: 1.125em; }.st-bubble .md-code { font-size: .8125em; }-.st-bubble .md-table { font-size: calc(var(--st-content-fs, 16px) * .8125); }+.st-bubble .md-table { font-size: calc(var(--st-content-fs, 14px) * .8125); }.st-bubble .md-table th, .st-bubble .md-table td { font-size: inherit; }-.st-bubble .st-code pre, .st-bubble .st-code pre code, .st-bubble .st-code .syntax-text { font-size: calc(var(--st-content-fs, 16px) * .8125); }-.st-msg--assistant .st-collapse__body { font-size: calc(var(--st-content-fs, 16px) * .8125); }+.st-bubble .st-code pre, .st-bubble .st-code pre code, .st-bubble .st-code .syntax-text { font-size: calc(var(--st-content-fs, 14px) * .8125); }+.st-msg--assistant .st-collapse__body { font-size: calc(var(--st-content-fs, 14px) * .8125); }.error-notice .error-detail { margin-top: 6px; }.error-notice .error-detail pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: 6px 0 0; font-family: var(--st-font-mono); }.error-detail-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 6px 0 0; font-family: var(--st-font-mono); }+/* What you type and the small print under each message follow the reading size too, so the whole conversation changes together. */+.st-composer textarea { font-size: var(--st-content-fs, 14px); }+.st-msg__meta, .st-msg__meta time { font-size: calc(var(--st-content-fs, 14px) * .8125); }diff --git a/apps/host/tests/agent-host.test.mjs b/apps/host/tests/agent-host.test.mjsindex 7335f89fd..1fabf6995 100644--- a/apps/host/tests/agent-host.test.mjs+++ b/apps/host/tests/agent-host.test.mjs@@ -26,7 +26,7 @@ const sleep = ms => new Promise(r => setTimeout(r, ms));async function startHost(t, { home, ws, harness = HARNESS } = {}) {const port = await freePort();- const env = { ...process.env, STRATA_HOME: home, STRATA_PORT: String(port), STRATA_WORKSPACE: ws, STRATA_REAL_ENGINE: '0' };+ const env = { ...process.env, STRATA_HOME: home, STRATA_PORT: String(port), STRATA_WORKSPACE: ws, STRATA_REAL_ENGINE: '0', STRATA_COMPONENTS_DIR: join(home, 'components') };if (harness) env.STRATA_HARNESS_DIR = harness; else delete env.STRATA_HARNESS_DIR;const child = spawn(process.execPath, [HOST], { env, stdio: ['ignore', 'pipe', 'pipe'], windowsHide: true });let log = '';diff --git a/apps/host/tests/resource-ram.test.mjs b/apps/host/tests/resource-ram.test.mjsindex bac52b5de..3965ea479 100644--- a/apps/host/tests/resource-ram.test.mjs+++ b/apps/host/tests/resource-ram.test.mjs@@ -29,3 +29,17 @@ test('a model that fits, or one that already has a RAM mode, is left alone', ()assert.equal(resourceSettings(own, pc64, 'work', iq3s).args.includes('--resident-budget-gib'), false);assert.equal(resourceSettings(config, pc64, 'work').args.includes('--resident-budget-gib'), false, 'no model size, no change');});++test('neither profile reserves less VRAM than the engine\'s safe floor (the driver pages GPU memory below it and decoding collapses)', () => {+ const card12 = { cpu: { cores: 12 }, ram_gb: 63, gpus: [{ index: 0, vram_gb: 11.9 }] };+ const card24 = { cpu: { cores: 12 }, ram_gb: 63, gpus: [{ index: 0, vram_gb: 24 }] };+ for (const profile of ['work', 'performance']) {+ const lowConfig = { gpu: 0, args: ['--max-context', '32768', '--vram-reserve-mib', '700'] };+ assert.ok(resourceSettings(lowConfig, card12, profile).vram_reserve_mib >= 1536, `${profile} on 12 GB`);+ assert.ok(resourceSettings({ gpu: 0, args: [] }, card12, profile).vram_reserve_mib >= 1536, `${profile}, nothing configured`);+ assert.ok(resourceSettings(lowConfig, card24, profile).vram_reserve_mib >= 1024, `${profile} on 24 GB`);+ }+ assert.equal(resourceSettings({ gpu: 0, args: [] }, card12, 'performance').vram_reserve_mib, 1536);+ assert.equal(resourceSettings({ gpu: 0, args: [] }, card24, 'performance').vram_reserve_mib, 1024);+ assert.equal(resourceSettings({ gpu: 0, args: [], vram_reserve_mib: 2437 }, card12, 'performance').vram_reserve_mib, 2437, 'a larger reserve of the installation is kept');+});diff --git a/apps/host/tests/stream-speed.test.mjs b/apps/host/tests/stream-speed.test.mjsnew file mode 100644index 000000000..309fedc76--- /dev/null+++ b/apps/host/tests/stream-speed.test.mjs@@ -0,0 +1,40 @@+import test from 'node:test';+import assert from 'node:assert/strict';+import { createServer } from 'node:http';+import { proxyCompletion } from '../server/inference.mjs';++/* The speed shown while an answer streams must be the decode speed of everything generated, reasoning included, from the first+ token (the owner saw 4-5 tok/s in chat while the engine log said 48-57): the stand-in engine streams 90 reasoning tokens at about+ 40 a second, a 4 s "prompt" before the first one, then a short answer. */+function engine({ promptMs, reasoning, answer, perSecond }) {+ return createServer((req, res) => {+ res.writeHead(200, { 'content-type': 'text/event-stream' });+ const send = obj => res.write(`data: ${JSON.stringify(obj)}\n\n`);+ let sent = 0;+ setTimeout(function tick() {+ if (sent < reasoning + answer) {+ send({ choices: [{ delta: sent < reasoning ? { reasoning_content: 'tok ' } : { content: 'ans ' } }] });+ sent++;+ return setTimeout(tick, 1000 / perSecond);+ }+ send({ choices: [], usage: { prompt_tokens: 20, completion_tokens: reasoning + answer } });+ res.write('data: [DONE]\n\n'); res.end();+ }, promptMs);+ });+}++test('live speed counts reasoning tokens over decode time, not the answer over the whole wait', async () => {+ const server = engine({ promptMs: 4000, reasoning: 90, answer: 10, perSecond: 40 });+ await new Promise(r => server.listen(0, '127.0.0.1', r));+ const frames = [];+ try {+ const result = await proxyCompletion({ baseUrl: `http://127.0.0.1:${server.address().port}/v1`, message: 'hi', onFrame: f => frames.push(f), engine: { beginReading() {}, beginThinking() {}, beginGenerating() {} } });+ const stats = frames.filter(f => f.type === 'stats');+ assert.ok(stats.length >= 2, 'live frames while it streams');+ const last = stats.at(-1);+ assert.ok(last.tps > 22 && last.tps < 80, `live tok/s ${last.tps} is the decode rate, not tokens over the wait including the prompt (~14)`);+ assert.ok(last.tokensOut >= 50, 'reasoning tokens are counted');+ assert.equal(result.tokensOut, 100);+ assert.ok(result.tps > 22 && result.tps < 80, `final tok/s ${result.tps}`);+ } finally { server.close(); }+});