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

launch: one-line installers (install.sh, install.ps1), local test feed builder, package_terminal installer step

Niko12214c9423e1946b
diff --git a/packaging/install.ps1 b/packaging/install.ps1
new file mode 100644
index 000000000..46aed0180
--- /dev/null
+++ b/packaging/install.ps1
@@ -0,0 +1,107 @@
+# Strata Terminal: one-line installer for Windows (PowerShell 5.1 or newer).
+#
+# irm <feed>/install.ps1 | iex
+#
+# What it does, in order (and nothing else):
+# 1. finds out which computer this is (Windows, processor, graphics card);
+# 2. downloads the Terminal archive named in the release folder's install-manifest.txt and checks its SHA-256 against it;
+# 3. unpacks it into %LOCALAPPDATA%\Strata\terminal\<version> (no administrator rights);
+# 4. checks the release's signed feed with the Terminal it just unpacked (`strata update --check`); if that fails it removes what it
+# unpacked and stops;
+# 5. adds %LOCALAPPDATA%\Strata\terminal\current\bin to your user PATH and prints: Installed. Run: strata launch
+#
+# The engine and the model are not part of this: `strata launch` fetches the engine for your graphics card the first time you choose
+# a model, from the same release folder, signed.
+#
+# <feed> is where the release folder is hosted; until that is decided this script has no address built in. Set $env:STRATA_FEED to the
+# folder (a URL) to use it, for example a local test feed: $env:STRATA_FEED='http://127.0.0.1:8099'; irm http://127.0.0.1:8099/install.ps1 | iex
+# Optional: $env:STRATA_DATA_DIR (default %LOCALAPPDATA%\Strata), $env:STRATA_INSTALL_TEST_TRUST='1' (a test feed: trust only its
+# test-trust.json for step 4), $env:STRATA_NO_PATH='1' (do not change the user PATH).
+$ErrorActionPreference = 'Stop'
+$ProgressPreference = 'SilentlyContinue'
+
+function Die([string]$msg) { [Console]::Error.WriteLine("strata installer: $msg"); throw "strata installer stopped" }
+
+$feed = if ($env:STRATA_FEED) { $env:STRATA_FEED } else { '__FEED__' }
+$feed = $feed.TrimEnd('/')
+if ($feed -eq '__FEED__' -or -not $feed) {
+ Die 'this installer does not know where the Strata release folder is. Set $env:STRATA_FEED to its address and run it again, for example: $env:STRATA_FEED=''https://example.org/strata'''
+}
+if ([Environment]::OSVersion.Platform -ne 'Win32NT') { Die 'this is the Windows installer; on Linux or macOS use install.sh.' }
+$arch = $env:PROCESSOR_ARCHITEW6432; if (-not $arch) { $arch = $env:PROCESSOR_ARCHITECTURE }
+if ($arch -ne 'AMD64') { Die "this computer ($arch) has no Strata Terminal yet. Supported: Windows on x64." }
+$platform = 'windows-x86_64'
+$gpu = ''
+try { $gpu = (Get-CimInstance Win32_VideoController | Where-Object { $_.Name -notmatch 'Basic|Remote' } | Select-Object -First 1 -ExpandProperty Name) } catch { }
+Write-Host 'Strata Terminal installer'
+Write-Host " This computer: Windows $arch ($platform)$(if ($gpu) { ", graphics: $gpu" })"
+Write-Host " Release folder: $feed"
+
+$data = if ($env:STRATA_DATA_DIR) { $env:STRATA_DATA_DIR } else { Join-Path $env:LOCALAPPDATA 'Strata' }
+$work = Join-Path ([IO.Path]::GetTempPath()) ("strata-install-" + [Guid]::NewGuid().ToString('N').Substring(0, 8))
+New-Item -ItemType Directory -Path $work | Out-Null
+try {
+ try { Invoke-WebRequest -UseBasicParsing -Uri "$feed/install-manifest.txt" -OutFile (Join-Path $work 'manifest.txt') }
+ catch { Die "could not read $feed/install-manifest.txt. Check the address and your internet connection." }
+ $line = Get-Content (Join-Path $work 'manifest.txt') | Where-Object { $_ -match "^$platform\s" } | Select-Object -First 1
+ if (-not $line) { Die "this release has no Terminal for $platform." }
+ $f = -split $line
+ $version, $rel, $want, $size = $f[1], $f[2], $f[3].ToLower(), $f[4]
+ Write-Host " Terminal $version ($([math]::Round([double]$size / 1MB)) MB)"
+ Write-Host 'Downloading...'
+ $zip = Join-Path $work 'terminal.zip'
+ try { Invoke-WebRequest -UseBasicParsing -Uri "$feed/$rel" -OutFile $zip }
+ catch { Die 'the download failed. Check your internet connection and run this again; nothing was installed.' }
+ $got = (Get-FileHash -Algorithm SHA256 $zip).Hash.ToLower()
+ if ($got -ne $want) { Die "the download does not match the release's checksum (got $got, wanted $want). It was not installed; try again." }
+ Write-Host ' Checksum ok.'
+
+ $dest = Join-Path $data "terminal\$version"
+ $incoming = "$dest.incoming"
+ New-Item -ItemType Directory -Force -Path (Join-Path $data 'terminal') | Out-Null
+ if (Test-Path $incoming) { Remove-Item -Recurse -Force $incoming }
+ try { Expand-Archive -LiteralPath $zip -DestinationPath $incoming -Force }
+ catch { Die 'the archive could not be unpacked (is the disk full?). Nothing was installed.' }
+ # the archive of a release folder is rooted at the bundle itself (control package) or in one folder (terminal archive)
+ if (-not (Test-Path (Join-Path $incoming 'bin\strata.cmd'))) {
+ $inner = Get-ChildItem $incoming -Directory | Where-Object { Test-Path (Join-Path $_.FullName 'bin\strata.cmd') } | Select-Object -First 1
+ if (-not $inner) { Remove-Item -Recurse -Force $incoming; Die 'the archive does not look like a Strata Terminal.' }
+ $moved = "$dest.moved"; Move-Item $inner.FullName $moved; Remove-Item -Recurse -Force $incoming; Move-Item $moved $incoming
+ }
+
+ if ($env:STRATA_INSTALL_TEST_TRUST -eq '1') {
+ $trust = Join-Path $work 'test-trust.json'
+ try { Invoke-WebRequest -UseBasicParsing -Uri "$feed/test-trust.json" -OutFile $trust } catch { Remove-Item -Recurse -Force $incoming; Die 'the test feed has no test-trust.json' }
+ $env:STRATA_UPDATE_TRUSTED_KEYS = $trust
+ }
+ Write-Host "Checking the release's signature..."
+ $strata = Join-Path $incoming 'bin\strata.cmd'
+ $out = & $strata update --check --no-engine --feed $feed 2>&1 | Out-String
+ if ($LASTEXITCODE -ne 0) {
+ ($out -split "`n" | Select-Object -First 6 | ForEach-Object { " $_" }) | ForEach-Object { [Console]::Error.WriteLine($_) }
+ Remove-Item -Recurse -Force $incoming
+ Die "the release folder's signed feed could not be verified, so nothing was installed. If you trust this source, ask its owner to publish a signed feed."
+ }
+ Write-Host ' Signature ok.'
+
+ if (Test-Path $dest) { Remove-Item -Recurse -Force $dest }
+ Move-Item $incoming $dest
+ $current = Join-Path $data 'terminal\current'
+ if (Test-Path $current) { cmd /c rmdir "$current" | Out-Null }
+ cmd /c mklink /J "$current" "$dest" | Out-Null
+ $bin = Join-Path $current 'bin'
+ if ($env:STRATA_NO_PATH -ne '1') {
+ $user = [Environment]::GetEnvironmentVariable('Path', 'User')
+ if (-not $user) { $user = '' }
+ if (($user -split ';') -notcontains $bin) {
+ [Environment]::SetEnvironmentVariable('Path', ($user.TrimEnd(';') + ';' + $bin).TrimStart(';'), 'User')
+ }
+ $env:Path = "$env:Path;$bin"
+ }
+ Write-Host 'Installed. Run: strata launch'
+ if ($env:STRATA_NO_PATH -eq '1') { Write-Host " (the program is $bin\strata.cmd)" }
+ else { Write-Host ' (open a new terminal window if the command is not found yet)' }
+}
+finally {
+ Remove-Item -Recurse -Force $work -ErrorAction SilentlyContinue
+}
diff --git a/packaging/install.sh b/packaging/install.sh
new file mode 100644
index 000000000..34c6efc1b
--- /dev/null
+++ b/packaging/install.sh
@@ -0,0 +1,119 @@
+#!/bin/sh
+# Strata Terminal: one-line installer for Linux and macOS.
+#
+# curl -fsSL <feed>/install.sh | sh
+#
+# What it does, in order (and nothing else):
+# 1. finds out which computer this is (system, processor, graphics card) so it can fetch the right archive;
+# 2. downloads the Terminal archive named in the release folder's install-manifest.txt and checks its SHA-256 against it;
+# 3. unpacks it into ${XDG_DATA_HOME:-~/.local/share}/strata/terminal/<version> (no administrator rights, nothing outside your home);
+# 4. checks the release's signed feed with the Terminal it just unpacked (`strata update --check`); if that check fails, it removes
+# what it unpacked and stops;
+# 5. puts a `strata` link in ~/.local/bin and prints: Installed. Run: strata launch
+#
+# The engine (the part that talks to your graphics card) and the model are NOT part of this: `strata launch` fetches the engine for
+# your card the first time you choose a model, from the same release folder, signed.
+#
+# <feed> is where the release folder is hosted; until that is decided this script has no address built in. Set STRATA_FEED to the
+# folder (a URL) to use it, for example a local test feed: STRATA_FEED=http://127.0.0.1:8099 sh install.sh
+#
+# Settings (all optional): STRATA_FEED, STRATA_DATA_DIR (default ~/.local/share/strata), STRATA_BIN_DIR (default ~/.local/bin),
+# STRATA_INSTALL_TEST_TRUST=1 (a test feed: also fetch <feed>/test-trust.json and trust only that key for the check in step 4).
+set -eu
+
+FEED="${STRATA_FEED:-__FEED__}"
+FEED="${FEED%/}"
+DATA_DIR="${STRATA_DATA_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/strata}"
+BIN_DIR="${STRATA_BIN_DIR:-$HOME/.local/bin}"
+
+say() { printf '%s\n' "$*"; }
+die() { printf 'strata installer: %s\n' "$*" >&2; exit 1; }
+
+case "$FEED" in
+ __FEED__|"") die "this installer does not know where the Strata release folder is. Set STRATA_FEED to its address and run it again, for example: STRATA_FEED=https://example.org/strata sh install.sh" ;;
+esac
+
+# ---- tools
+if command -v curl >/dev/null 2>&1; then
+ fetch() { curl -fsSL --retry 3 -o "$2" "$1"; }
+elif command -v wget >/dev/null 2>&1; then
+ fetch() { wget -q -O "$2" "$1"; }
+else
+ die "neither curl nor wget is installed, so nothing can be downloaded. Install one (for example: sudo apt install curl) and run this again."
+fi
+if command -v sha256sum >/dev/null 2>&1; then
+ sha() { sha256sum "$1" | cut -d' ' -f1; }
+elif command -v shasum >/dev/null 2>&1; then
+ sha() { shasum -a 256 "$1" | cut -d' ' -f1; }
+else
+ die "no sha256sum or shasum was found, so the download cannot be checked. Install coreutils and run this again."
+fi
+command -v tar >/dev/null 2>&1 || die "tar is not installed; install it and run this again."
+
+# ---- 1. this computer
+os=$(uname -s); arch=$(uname -m)
+case "$os-$arch" in
+ Linux-x86_64|Linux-amd64) platform=linux-x86_64 ;;
+ Darwin-arm64|Darwin-aarch64) platform=darwin-arm64 ;;
+ *) die "this computer ($os $arch) has no Strata Terminal yet. Supported: Linux x86_64, macOS on Apple silicon (Windows: use install.ps1)." ;;
+esac
+gpu=""
+if command -v nvidia-smi >/dev/null 2>&1; then
+ gpu=$(nvidia-smi --query-gpu=name --format=csv,noheader 2>/dev/null | head -1 || true)
+ [ -n "$gpu" ] && gpu="NVIDIA $gpu"
+fi
+if [ -z "$gpu" ] && [ "$os" = Linux ] && command -v lspci >/dev/null 2>&1; then
+ gpu=$(lspci 2>/dev/null | grep -iE 'vga|3d|display' | head -1 | sed 's/^[^:]*: *//' || true)
+fi
+if [ -z "$gpu" ] && [ "$os" = Darwin ]; then
+ gpu=$(system_profiler SPDisplaysDataType 2>/dev/null | sed -n 's/^ *Chipset Model: //p' | head -1 || true)
+fi
+say "Strata Terminal installer"
+say " This computer: $os $arch ($platform)${gpu:+, graphics: $gpu}"
+say " Release folder: $FEED"
+
+# ---- 2. download and check
+work=$(mktemp -d "${TMPDIR:-/tmp}/strata-install.XXXXXX") || die "cannot make a temporary folder"
+trap 'rm -rf "$work"' EXIT INT TERM
+fetch "$FEED/install-manifest.txt" "$work/manifest.txt" || die "could not read $FEED/install-manifest.txt. Check the address and your internet connection."
+line=$(awk -v p="$platform" '$1 == p { print; exit }' "$work/manifest.txt")
+[ -n "$line" ] || die "this release has no Terminal for $platform."
+set -- $line
+version=$2; rel=$3; want=$4
+say " Terminal $version ($(( ${5:-0} / 1048576 )) MB)"
+say "Downloading…"
+fetch "$FEED/$rel" "$work/terminal.tar.gz" || die "the download failed. Check your internet connection and run this again; nothing was installed."
+got=$(sha "$work/terminal.tar.gz")
+[ "$got" = "$want" ] || die "the download does not match the release's checksum (got $got, wanted $want). It was not installed; try again, and if it repeats the release folder is damaged."
+say " Checksum ok."
+
+# ---- 3. unpack
+dest="$DATA_DIR/terminal/$version"
+mkdir -p "$DATA_DIR/terminal" "$BIN_DIR"
+rm -rf "$dest.incoming"; mkdir -p "$dest.incoming"
+tar -xzf "$work/terminal.tar.gz" -C "$dest.incoming" || die "the archive could not be unpacked (is the disk full?). Nothing was installed."
+[ -x "$dest.incoming/bin/strata" ] || chmod +x "$dest.incoming/bin/strata" 2>/dev/null || true
+
+# ---- 4. the signed feed, checked with the Terminal just unpacked
+if [ "${STRATA_INSTALL_TEST_TRUST:-}" = 1 ]; then
+ fetch "$FEED/test-trust.json" "$work/test-trust.json" || { rm -rf "$dest.incoming"; die "the test feed has no test-trust.json"; }
+ STRATA_UPDATE_TRUSTED_KEYS="$work/test-trust.json"; export STRATA_UPDATE_TRUSTED_KEYS
+fi
+say "Checking the release's signature…"
+if ! "$dest.incoming/bin/strata" update --check --no-engine --feed "$FEED" >"$work/check.txt" 2>&1; then
+ sed -e 's/^/ /' "$work/check.txt" | head -6 >&2
+ rm -rf "$dest.incoming"
+ die "the release folder's signed feed could not be verified, so nothing was installed. If you trust this source, ask its owner to publish a signed feed."
+fi
+say " Signature ok."
+
+# ---- 5. in place
+rm -rf "$dest"
+mv "$dest.incoming" "$dest"
+ln -sfn "$dest" "$DATA_DIR/terminal/current"
+ln -sf "$DATA_DIR/terminal/current/bin/strata" "$BIN_DIR/strata"
+case ":$PATH:" in
+ *":$BIN_DIR:"*) say "Installed. Run: strata launch" ;;
+ *) say "Installed. Run: $BIN_DIR/strata launch"
+ say " (To type just 'strata', add this line to your shell profile: export PATH=\"$BIN_DIR:\$PATH\")" ;;
+esac
diff --git a/packaging/make_local_feed.py b/packaging/make_local_feed.py
new file mode 100644
index 000000000..fbcf32e6c
--- /dev/null
+++ b/packaging/make_local_feed.py
@@ -0,0 +1,108 @@
+#!/usr/bin/env python3
+"""Build a LOCAL, TEST-SIGNED release folder (a feed) from a Terminal archive and engine packages, to try `install.sh`, `install.ps1`,
+`strata update` and `strata launch` end to end without any hosting. Nothing is uploaded.
+
+ python packaging/make_local_feed.py --out FEED --terminal strata-terminal-0.1.45-linux-x86_64.tar.gz \
+ --engine /path/to/components/engine/0.1.45-linux-x86_64-cuda [--engine ...] \
+ [--keys KEYDIR] [--url http://127.0.0.1:8099] [--sequence 1]
+ python -m http.server 8099 --bind 127.0.0.1 --directory FEED # serve it (foreground; stop it with Ctrl+C)
+
+What it writes into FEED (the folder a person would host):
+ strata-feed.json + .sig the signed feed (Ed25519, the key in KEYDIR, made once, never inside a git checkout)
+ control/*, engine/* the Terminal (as a "control" package) and each engine package, archived
+ install-manifest.txt one line per platform for install.sh / install.ps1: platform version url sha256 size
+ install.sh, install.ps1 the one-line installers with this feed's address filled in (--url)
+ test-trust.json the PUBLIC test key: `STRATA_UPDATE_TRUSTED_KEYS=<this file>` lets this build trust the feed
+ (the real key goes into strata_control/update_keys.json at release; this one never does)
+
+The engine package folders are copied (never changed in place) before they are signed with the test key.
+"""
+
+from __future__ import annotations
+
+import argparse
+import json
+import shutil
+import sys
+import tarfile
+import tempfile
+import zipfile
+from pathlib import Path
+
+ROOT = Path(__file__).resolve().parents[1]
+sys.path.insert(0, str(ROOT / "packaging"))
+sys.path.insert(0, str(ROOT))
+
+import feed_tool as ft # noqa: E402
+
+
+def extract_terminal(archive: Path, into: Path) -> Path:
+ """Unpack a terminal archive; returns the folder that holds python/ and strata.py."""
+ if archive.name.endswith(".zip"):
+ with zipfile.ZipFile(archive) as zf:
+ zf.extractall(into)
+ else:
+ with tarfile.open(archive) as tf:
+ tf.extractall(into, filter="data")
+ (inner,) = [p for p in into.iterdir() if p.is_dir()]
+ return inner
+
+
+def main(argv=None) -> int:
+ ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
+ ap.add_argument("--out", type=Path, required=True)
+ ap.add_argument("--terminal", type=Path, action="append", default=[], help="a terminal archive (.tar.gz or .zip); repeat per platform")
+ ap.add_argument("--engine", type=Path, action="append", default=[], help="an engine package folder (with engine-component.json)")
+ ap.add_argument("--keys", type=Path, default=None, help="folder for the test key (default: <out>/../feed-test-keys)")
+ ap.add_argument("--url", default="http://127.0.0.1:8099", help="the address this feed will be served at (baked into install.sh/.ps1)")
+ ap.add_argument("--sequence", type=int, default=1)
+ ap.add_argument("--version", default=None, help="control version label (default: from the first terminal archive's VERSION)")
+ ap.add_argument("--channel", default="stable")
+ a = ap.parse_args(argv)
+
+ out = a.out.resolve()
+ keys = (a.keys or out.parent / "feed-test-keys").resolve()
+ if not (keys / "feed-key.json").exists():
+ ft.keygen(keys, allow_git=True)
+ key = ft._load_key(keys / "feed-key.json")
+ shutil.rmtree(out, ignore_errors=True)
+ (out / "engine").mkdir(parents=True)
+ (out / "control").mkdir(parents=True)
+ manifest_lines: list[str] = []
+ version = a.version
+ with tempfile.TemporaryDirectory(prefix="strata-feed-") as tmp:
+ tmpdir = Path(tmp)
+ for n, term in enumerate(a.terminal):
+ work = tmpdir / f"t{n}"
+ work.mkdir()
+ folder = extract_terminal(term.resolve(), work)
+ v = version or (folder / "VERSION").read_text(encoding="utf-8").strip()
+ version = v
+ platform = ("windows-x86_64" if (folder / "python" / "python.exe").exists() else
+ "darwin-arm64" if "darwin" in term.name else "linux-x86_64")
+ fmt = "zip" if platform.startswith("windows") else "tar.gz"
+ entry = ft.pack_control(folder, out / "control", version=v, platform=platform, fmt=fmt)
+ manifest_lines.append(f"{platform} {v} {entry['url']} {entry['sha256']} {entry['size']}")
+ print(f"control {platform} {v}: {entry['size'] // 1048576} MB")
+ for n, pkg in enumerate(a.engine):
+ copy = tmpdir / f"e{n}" / pkg.name
+ shutil.copytree(pkg, copy, symlinks=True)
+ ft.sign_package(copy, key)
+ entry = ft.pack_engine(copy, out / "engine")
+ print(f"engine {entry['platform']}-{entry['backend']} {entry['version']}: {entry['size'] // 1048576} MB")
+ shutil.rmtree(copy.parent, ignore_errors=True)
+ ft.build_feed(out, key=key, sequence=a.sequence, channel=a.channel, engine_dir=out / "engine" if a.engine else None,
+ control_dir=out / "control" if a.terminal else None)
+ (out / "install-manifest.txt").write_text("\n".join(manifest_lines) + "\n", encoding="utf-8")
+ base = a.url.rstrip("/")
+ for name in ("install.sh", "install.ps1"):
+ text = (ROOT / "packaging" / name).read_text(encoding="utf-8").replace("__FEED__", base)
+ (out / name).write_text(text, encoding="utf-8", newline="\n" if name.endswith(".sh") else None)
+ (out / "test-trust.json").write_text((keys / "feed-key.pub.json").read_text(encoding="utf-8"), encoding="utf-8")
+ print(f"feed written to {out}\n serve it: python -m http.server {base.rsplit(':', 1)[-1]} --bind 127.0.0.1 --directory {out}\n"
+ f" trust it: STRATA_UPDATE_TRUSTED_KEYS={out / 'test-trust.json'}")
+ return 0
+
+
+if __name__ == "__main__":
+ raise SystemExit(main())
diff --git a/packaging/package_terminal.py b/packaging/package_terminal.py
index 884e7251e..10b1ec331 100644
--- a/packaging/package_terminal.py
+++ b/packaging/package_terminal.py
@@ -340,6 +340,7 @@ def main() -> int:
if not src.exists():
raise SystemExit(f"missing tools module: {item}")
shutil.copy2(src, tools_dir / item)
+ installer = None if args.no_installer else add_installer(root)
(root / "VERSION").write_text(version + "\n", encoding="utf-8")
bin_dir = root / "bin"