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: terminal archive carries the installer files (shared with the app's Control staging), legacy-console glyph and box fallback, install from a bundle runs in control mode
Niko122164034f1674c1
diff --git a/apps/desktop/scripts/stage-control.py b/apps/desktop/scripts/stage-control.pyindex bf570076a..013d48e40 100644--- a/apps/desktop/scripts/stage-control.py+++ b/apps/desktop/scripts/stage-control.py@@ -73,53 +73,15 @@ def extract(archive: Path, destination: Path) -> Path:return inner-#: What the app's installer needs on top of the Terminal bundle: the model catalog and GPU probe (tools/strata_mcp.py reads-#: setup.py's tables), and the install job, which downloads a model the user chose, prepares it with the bundled tools and-#: writes a run config naming "component:strata-engine". setup.py runs in its CONTROL mode there (no pip, no engine fetch,-#: no compiler). Entry points; their local imports under tools/ come with them.-INSTALLER_FILES = ("setup.py", "ref/load.py") # ref/load.py: strata_pack.py (the Q2_0 AVX-512 repack) imports it-INSTALLER_TOOLS = ("strata_mcp", "iq_pack", "strata_pack", "pack_index", "mtp_fetch", "mtp_pack", "mtp_rt", "draft_vocab",- "strata_tokenizer", "gguf_reader")-INSTALLER_DATA = "data" # draft vocabularies, expert profiles: 2 MB---def local_imports(folder: Path, entry: tuple[str, ...]) -> list[str]:- """The tools/ modules `entry` imports, transitively (static: import and from-import statements)."""- import ast- seen: set[str] = set()- todo = list(entry)- while todo:- name = todo.pop()- if name in seen:- continue- seen.add(name)- source = folder / "tools" / f"{name}.py"- if not source.exists():- raise SystemExit(f"installer tool missing: tools/{name}.py")- for node in ast.walk(ast.parse(source.read_text(encoding="utf-8-sig"))):- names = [a.name.split(".")[0] for a in node.names] if isinstance(node, ast.Import) else \- [node.module.split(".")[0]] if isinstance(node, ast.ImportFrom) and node.module and node.level == 0 else []- todo += [m for m in names if (folder / "tools" / f"{m}.py").exists() and m not in seen]- return sorted(seen)+#: What the app's installer needs on top of the Terminal bundle: the model catalog, GPU probe and install job. The list and the copy+#: live in packaging/package_terminal.py (the Terminal archive carries the same files, for `strata launch`).+INSTALLER_FILES, INSTALLER_TOOLS, INSTALLER_DATA = pt.INSTALLER_FILES, pt.INSTALLER_TOOLS, pt.INSTALLER_DATA+local_imports = pt.local_importsdef add_installer(folder: Path) -> dict:"""Copy the installer's files from the source tree into the staged Control (after the Terminal bundle is in place)."""- tools = local_imports(ROOT, INSTALLER_TOOLS)- copied = []- for name in INSTALLER_FILES:- (folder / name).parent.mkdir(parents=True, exist_ok=True)- shutil.copy2(ROOT / name, folder / name)- copied.append(name)- (folder / "tools").mkdir(exist_ok=True)- for name in tools:- shutil.copy2(ROOT / "tools" / f"{name}.py", folder / "tools" / f"{name}.py")- copied.append(f"tools/{name}.py")- if (folder / INSTALLER_DATA).exists():- shutil.rmtree(folder / INSTALLER_DATA)- shutil.copytree(ROOT / INSTALLER_DATA, folder / INSTALLER_DATA, ignore=shutil.ignore_patterns("__pycache__"))- return {"files": copied, "data": INSTALLER_DATA, "setup_sha256": sha256(folder / "setup.py"),- "mode": "STRATA_CONTROL_INSTALL=1: downloads the chosen model, prepares it, installs no package and no engine"}+ return pt.add_installer(folder, ROOT)def write_bundle_record(folder: Path, archive: Path) -> dict:diff --git a/packaging/package_terminal.py b/packaging/package_terminal.pyindex bb207382c..884e7251e 100644--- a/packaging/package_terminal.py+++ b/packaging/package_terminal.py@@ -107,6 +107,16 @@ TOOLS_SUBSET = ("gguf_reader.py",)+#: What `strata launch` and the desktop app's installer need on top of the read-only terminal: the model catalog and GPU probe+#: (tools/strata_mcp.py reads setup.py's tables) and the install job, which downloads the model the user chose, prepares it with+#: the bundled tools and writes a run config naming "component:strata-engine". setup.py runs in its CONTROL mode there+#: (STRATA_CONTROL_INSTALL=1: no pip, no engine fetch, no compiler). Entry points; their local imports under tools/ come with them.+#: The same list the app's Control component stages (apps/desktop/scripts/stage-control.py uses these names).+INSTALLER_FILES = ("setup.py", "ref/load.py") # ref/load.py: strata_pack.py (the Q2_0 AVX-512 repack) imports it+INSTALLER_TOOLS = ("strata_mcp", "iq_pack", "strata_pack", "pack_index", "mtp_fetch", "mtp_pack", "mtp_rt", "draft_vocab",+ "strata_tokenizer", "gguf_reader")+INSTALLER_DATA = "data" # draft vocabularies, expert profiles: 2 MB+#: packages the bundle must import after the install (the API server's and the CLI's).PROBE = "import jinja2, yaml, regex, psutil, requests, numpy, PIL, tqdm; print('deps ok')"@@ -216,6 +226,44 @@ def drop_build_path_launchers(root: Path, staging: Path, target: str) -> list[streturn gone+def local_imports(folder: Path, entry: tuple[str, ...]) -> list[str]:+ """The tools/ modules `entry` imports, transitively (static: import and from-import statements)."""+ import ast+ seen: set[str] = set()+ todo = list(entry)+ while todo:+ name = todo.pop()+ if name in seen:+ continue+ seen.add(name)+ source = folder / "tools" / f"{name}.py"+ if not source.exists():+ raise SystemExit(f"installer tool missing: tools/{name}.py")+ for node in ast.walk(ast.parse(source.read_text(encoding="utf-8-sig"))):+ names = [a.name.split(".")[0] for a in node.names] if isinstance(node, ast.Import) else [node.module.split(".")[0]] if isinstance(node, ast.ImportFrom) and node.module and node.level == 0 else []+ todo += [m for m in names if (folder / "tools" / f"{m}.py").exists() and m not in seen]+ return sorted(seen)+++def add_installer(folder: Path, source: Path = ROOT) -> dict:+ """Copy the installer's files from the source tree into a staged terminal folder (after the terminal payload is in place)."""+ tools = local_imports(source, INSTALLER_TOOLS)+ copied = []+ for name in INSTALLER_FILES:+ (folder / name).parent.mkdir(parents=True, exist_ok=True)+ shutil.copy2(source / name, folder / name)+ copied.append(name)+ (folder / "tools").mkdir(exist_ok=True)+ for name in tools:+ shutil.copy2(source / "tools" / f"{name}.py", folder / "tools" / f"{name}.py")+ copied.append(f"tools/{name}.py")+ if (folder / INSTALLER_DATA).exists():+ shutil.rmtree(folder / INSTALLER_DATA)+ shutil.copytree(source / INSTALLER_DATA, folder / INSTALLER_DATA, ignore=shutil.ignore_patterns("__pycache__"))+ return {"files": copied, "data": INSTALLER_DATA, "setup_sha256": sha256(folder / "setup.py"),+ "mode": "STRATA_CONTROL_INSTALL=1: downloads the chosen model, prepares it, installs no package and no engine"}++def write_archive(root: Path, name: str, out_dir: Path, kind: str) -> Path:if kind == "zip":path = out_dir / f"{name}.zip"@@ -240,6 +288,9 @@ def main() -> int:ap.add_argument("--skip-deps", action="store_true",help="skip the locked install (layout checks only; the result is NOT distributable)")ap.add_argument("--keep-staging", action="store_true")+ ap.add_argument("--no-installer", action="store_true",+ help="leave out setup.py, tools/strata_mcp.py and data/ (the read-only terminal of earlier releases; "+ "`strata launch` then cannot list or install models)")ap.add_argument("--cache", default=None, help="where the pinned interpreter archive is cached")ap.add_argument("--wheelhouse", default=None,help="install the locked wheels from this folder (lock_wheels.py --download) and fetch nothing")@@ -342,6 +393,7 @@ def main() -> int:"launchers_removed": removed,"payload": list(PAYLOAD),"tools_subset": list(TOOLS_SUBSET),+ "installer": installer,"excludes": ["engine binary", "model weights", "prepared data", "UI", "node_modules"],"deps_installed": not args.skip_deps,}, indent=2) + "\n", encoding="utf-8")diff --git a/strata_cli/cli.py b/strata_cli/cli.pyindex 12c543a2f..4b3afca98 100644--- a/strata_cli/cli.py+++ b/strata_cli/cli.py@@ -1785,8 +1785,14 @@ def _install(a: argparse.Namespace) -> int:"set STRATA_INSTALL_DIR to that folder to run it from here. To update the engine and Control ""from the signed update feed, run `strata update`", 5)extra = [x for x in a.setup_args if x != "--"]+ env = dict(os.environ)+ if (ROOT / "python").is_dir() and (ROOT / "VERSION").is_file():+ # the Terminal bundle: its installer only downloads and prepares the model (no pip, no engine fetch, no compiler)+ env["STRATA_CONTROL_INSTALL"] = "1"+ from strata_cli.launch.catalog import install_root+ env.setdefault("STRATA_INSTALL_DIR", str(install_root()))return subprocess.call([sys.executable, str(installer), "--update" if a.update else "--setup", *extra],- cwd=str(installer.parent))+ cwd=str(installer.parent), env=env)def _access_retry(a: argparse.Namespace, error: BaseException) -> int | None:diff --git a/strata_cli/consoleinfo.py b/strata_cli/consoleinfo.pynew file mode 100644index 000000000..9c78ff39b--- /dev/null+++ b/strata_cli/consoleinfo.py@@ -0,0 +1,52 @@+"""What kind of terminal this is, for the few places that must change what they draw.++The classic Windows console window (conhost: the default window of Windows PowerShell and cmd on Windows 10) uses Consolas, which+has no glyphs for the eighth-block sparkline characters, the rounded box corners or the check mark: they show as empty boxes.+Windows Terminal, VS Code's terminal, ConEmu and every Linux/macOS terminal with a modern font have them. `STRATA_GLYPHS=ascii|unicode`+overrides the guess.+"""++from __future__ import annotations++import os+import sys+++def legacy_console() -> bool:+ """True for the classic Windows console (no Windows Terminal, no VS Code, no ConEmu, no ssh session into it)."""+ forced = os.environ.get("STRATA_GLYPHS", "").strip().lower()+ if forced in ("ascii", "legacy"):+ return True+ if forced == "unicode":+ return False+ if os.name != "nt" and sys.platform != "win32":+ return False+ env = os.environ+ return not (env.get("WT_SESSION") or env.get("TERM_PROGRAM") or env.get("ConEmuANSI") or env.get("ANSICON")+ or env.get("TERM", "").startswith(("xterm", "screen", "tmux", "vt")))+++def console_columns() -> int | None:+ """The visible width of the Windows console window in columns (not its buffer), or None when it cannot be read."""+ if os.name != "nt":+ return None+ try:+ import ctypes+ from ctypes import wintypes++ class COORD(ctypes.Structure):+ _fields_ = [("X", ctypes.c_short), ("Y", ctypes.c_short)]++ class RECT(ctypes.Structure):+ _fields_ = [("Left", ctypes.c_short), ("Top", ctypes.c_short), ("Right", ctypes.c_short), ("Bottom", ctypes.c_short)]++ class INFO(ctypes.Structure):+ _fields_ = [("size", COORD), ("cursor", COORD), ("attr", wintypes.WORD), ("window", RECT), ("maxsize", COORD)]++ handle = ctypes.windll.kernel32.GetStdHandle(-11)+ info = INFO()+ if not ctypes.windll.kernel32.GetConsoleScreenBufferInfo(handle, ctypes.byref(info)):+ return None+ return int(info.window.Right - info.window.Left + 1)+ except Exception: # noqa: BLE001+ return Nonediff --git a/strata_cli/dashboard.py b/strata_cli/dashboard.pyindex 258479678..9b18e516b 100644--- a/strata_cli/dashboard.py+++ b/strata_cli/dashboard.py@@ -26,6 +26,19 @@ from strata_cli.render import (_queue_wait, activity_continuity_notice, activityWORK_SAMPLE_MAX_AGE_S = 5.0+_ASCII_BOXES = False+++def _rounded():+ """Panel corners: rounded where the font has them, square (Consolas has these) in the classic Windows console."""+ return box.SQUARE if _ASCII_BOXES else box.ROUNDED+++def set_ascii_boxes(on: bool) -> None:+ global _ASCII_BOXES+ _ASCII_BOXES = bool(on)++def _current_sample(row: dict, age_key: str) -> bool:"""A retained engine sample stops representing current work after five seconds."""age = row.get(age_key)@@ -214,7 +227,7 @@ def _panel(lines: list[str], title: str, accent: str, *, color: bool) -> Panel:body.highlight_regex(r"\b(?:DISCONNECTED|INCOMPATIBLE|REJECTED|AUTH REQUIRED)\b", "red")body.highlight_regex(r"[\u2800-\u28ff▁▂▃▄▅▆▇█]+", accent)return Panel(body, title=Text(title, style=f"bold {accent}" if color else "bold"),- border_style="dim" if color else "", box=box.ROUNDED, padding=(0, 1))+ border_style="dim" if color else "", box=_rounded(), padding=(0, 1))def _columns(left: list[Panel], right: list[Panel]) -> Table:@@ -734,6 +747,7 @@ def render_dashboard(snapshot: dict, *, width: int, height: int, history: MonitoSmaller terminals retain the existing compact text renderer in MonitorApp."""+ set_ascii_boxes(glyphs == "ascii")compact = width < 100 or height < 27accent = ("#0c8a60" if theme == "light" else "#34d399") if color else "default"danger = ("#b01a2e" if theme == "light" else "#ff8a98") if color else "default"@@ -755,7 +769,7 @@ def render_dashboard(snapshot: dict, *, width: int, height: int, history: Monito"bold"))heading.append(f" {safe(connection, max(0, width - 45))}")blocked = connection_state in ("disconnected", "auth_required", "incompatible")- header = Panel(heading, box=box.ROUNDED,+ header = Panel(heading, box=_rounded(),border_style=danger_border if blocked else accent, padding=(0, 1))if connection_state in ("connecting", "disconnected", "auth_required", "incompatible"):@@ -776,7 +790,7 @@ def render_dashboard(snapshot: dict, *, width: int, height: int, history: MonitoText(message), Text(action, style="dim"), Text(last_seen, style="dim"))panel = Panel(Align.center(lines, vertical="middle"),title=Text("CONNECTION", style=f"bold {danger}" if blocked else f"bold {accent}"),- border_style=danger_border if blocked else "dim", box=box.ROUNDED,+ border_style=danger_border if blocked else "dim", box=_rounded(),height=max(8, height - 4))return Group(header, panel, Text("r Retry q Detach 1-6 Views", style="dim"))diff --git a/strata_cli/detail_dashboard.py b/strata_cli/detail_dashboard.pyindex bdcb965ef..97afb37fa 100644--- a/strata_cli/detail_dashboard.py+++ b/strata_cli/detail_dashboard.py@@ -14,7 +14,7 @@ from rich.panel import Panelfrom rich.text import Textfrom strata_cli.client import complete_slots-from strata_cli.dashboard import (_age, _current_batch_value, _current_sample,+from strata_cli.dashboard import (set_ascii_boxes, _rounded, _age, _current_batch_value, _current_sample,_device_role, _gib, _meter, _rate_spark, _spark,_state, _visual_pair, _visual_panel, MonitorHistory)from strata_cli.render import (_device_stage, _queue_wait, _recent_detail,@@ -549,6 +549,7 @@ def render_detail_dashboard(snapshot: dict, view: str, *, width: int, height: incolor: bool = True, theme: str = "dark", selected: int = 0,detail: bool = False, serving_pane: str = "devices") -> Group:"""Render the five wide pages with the visual Overview's panel language."""+ set_ascii_boxes(glyphs == "ascii")palette = _palette(color, theme)state, live = _state(snapshot, connection_state, frozen)active = palette["green"] if state == "LIVE" else palette["amber"] if "STALE" in state else palette["red"]@@ -557,7 +558,7 @@ def render_detail_dashboard(snapshot: dict, view: str, *, width: int, height: inheading.append(" ")heading.append(state, style=f"bold {active}" if color else "bold")heading.append(f" {safe(connection, max(0, width - 48))}")- header = Panel(heading, box=box.ROUNDED, border_style=active if color else "",+ header = Panel(heading, box=_rounded(), border_style=active if color else "",padding=(0, 1))age = _age(snapshot)footer = _txt("1 Overview 2 Serving 3 Requests 4 Engine 5 Hardware 6 Logs "diff --git a/strata_cli/launch/widgets.py b/strata_cli/launch/widgets.pyindex 95e8ed38f..01c7d2c27 100644--- a/strata_cli/launch/widgets.py+++ b/strata_cli/launch/widgets.py@@ -23,6 +23,9 @@ ACCENT, WARN, BAD, SEL, RULE = "#34d399", "#f5c56b", "#f28b82", "#1f2a27", "#3a4def unicode_ok() -> bool:if os.environ.get("TERM") == "dumb":return False+ from strata_cli.consoleinfo import legacy_console+ if legacy_console(): # the classic Windows console's font has no arrows, check marks or block glyphs+ return Falseenc = getattr(sys.stdout, "encoding", None) or "utf-8"try:"›─↑↓•█░".encode(enc)@@ -35,7 +38,7 @@ class Glyphs:def __init__(self, unicode: bool | None = None):u = unicode_ok() if unicode is None else unicodeself.unicode = u- self.cursor = "›" if u else ">"+ self.cursor = "›" if u else ">" # (U+203A is in Consolas too, but one rule for the whole screen is simpler)self.rule = "─" if u else "-"self.updown = "↑↓" if u else "Up/Down"self.dot = "·" if u else "-"diff --git a/strata_cli/monitor.py b/strata_cli/monitor.pyindex c4559ba00..cd501926f 100644--- a/strata_cli/monitor.py+++ b/strata_cli/monitor.py@@ -26,7 +26,8 @@ def choose_glyphs(requested: str, encoding: str | None, term: str | None) -> str"""Prefer readable Unicode when the output stream can encode its graph cells."""if requested != "auto":return requested- if term == "dumb" or not encoding:+ from strata_cli.consoleinfo import legacy_console+ if term == "dumb" or not encoding or legacy_console():return "ascii"try:"▁█░".encode(encoding)@@ -124,6 +125,8 @@ class MonitorApp(App):self.theme_choice = "terminal" if theme == "auto" else themeself.color_choice = "never" if os.environ.get("NO_COLOR") is not None else colorself.glyph_choice = choose_glyphs(glyphs, sys.stdout.encoding, os.environ.get("TERM"))+ from strata_cli.consoleinfo import legacy_console+ self.margin = 3 if legacy_console() else 2 # one more column of room in the classic Windows console (its scroll bar)self.history = MonitorHistory()self.activity_continuity = ActivityContinuity()self.displayed_activity_continuity = self.activity_continuity.status()@@ -168,7 +171,7 @@ class MonitorApp(App):"requests": ((self.displayed.get("work") or {}).get("requests") or [])[:self.requests]}if self.view == 0 and size.width >= 78 and size.height >= 23:display = render_dashboard(- snapshot, width=max(30, size.width - 2), height=max(8, size.height - 2),+ snapshot, width=max(30, size.width - self.margin), height=max(8, size.height - 2),history=self.history, connection=getattr(self.endpoint, "base_url", getattr(self.endpoint, "root", "")),connection_state=self.connection_state, frozen=self.frozen,filter_text=self.filter_text, glyphs=self.glyph_choice,@@ -176,7 +179,7 @@ class MonitorApp(App):elif self.view != 0 and size.width >= 128 and size.height >= 36 and self.connection_state not in ("connecting", "disconnected", "auth_required", "incompatible"):display = render_detail_dashboard(- snapshot, VIEWS[self.view], width=max(30, size.width - 2),+ snapshot, VIEWS[self.view], width=max(30, size.width - self.margin),height=max(8, size.height - 2), history=self.history,connection=getattr(self.endpoint, "base_url", getattr(self.endpoint, "root", "")),connection_state=self.connection_state, frozen=self.frozen,@@ -185,7 +188,7 @@ class MonitorApp(App):selected=self.selected, detail=self.detail, serving_pane=self.serving_pane)else:content = render_view(snapshot, VIEWS[self.view],- width=max(30, size.width - 2), height=max(8, size.height - 2),+ width=max(30, size.width - self.margin), height=max(8, size.height - 2),selected=self.selected, frozen=self.frozen,filter_text=self.filter_text, glyphs=self.glyph_choice,connection=getattr(self.endpoint, "base_url", getattr(self.endpoint, "root", "")),