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: the DeepSeek engine package that runs is the newest of the running Terminal's own install (STRATA_INSTALL_DIR, else its own folder) and the install the model's settings came from (the first remembered install, which can be an older Terminal folder or another checkout); the running Terminal's own on a tie; the choice is logged; versions compare as numbers; tests
Niko1221a62ca064a3e9
diff --git a/strata_cli/launch/runner.py b/strata_cli/launch/runner.pyindex 6dd18e672..af47fa792 100644--- a/strata_cli/launch/runner.py+++ b/strata_cli/launch/runner.py@@ -1860,6 +1860,9 @@ class Runner:if found is None:returnold = str(cfg.get("exe") or "")+ choice = getattr(self, "dsv41_choice", None)+ if choice and choice[0] == str(found):+ self.emit("engine", f"DeepSeek engine: {found} ({choice[1]}).", None)if os.path.normcase(os.path.normpath(old)) != os.path.normcase(os.path.normpath(str(found))):cfg["exe"] = str(found)if old:@@ -1874,7 +1877,26 @@ class Runner:own = (os.environ.get("STRATA_DSV41_EXE") or "").strip()if own:return (Path(own) if Path(own).is_file() else None), True- folders: list[Path] = [Path(self.catalog.root) / dsv41_engine.DIR] # this install's own package first+ # The install this Terminal RUNS from (STRATA_INSTALL_DIR, else the folder its strata_cli comes from) and the install the model's settings live in+ # (catalog.root: the first remembered install, which after an update or on a computer with several installs can be an older one) can both hold a+ # DeepSeek engine package: the NEWEST version wins, the running Terminal's own on a tie, and the answer is logged.+ roots: list[Path] = []+ for r in (os.environ.get("STRATA_INSTALL_DIR"), self.catalog.src, self.catalog.root):+ if r and not any(os.path.normcase(os.path.normpath(str(r))) == os.path.normcase(os.path.normpath(str(x))) for x in roots):+ roots.append(Path(r))+ picks = []+ for i, r in enumerate(roots):+ exe = dsv41_engine.find(r / dsv41_engine.DIR)+ if exe is not None:+ picks.append((dsv41_engine.version_key(exe.parent.name), -i, exe, r))+ if picks:+ best = max(picks, key=lambda t: (t[0], t[1]))+ why = ("this Terminal's own folder" if best[3] == roots[0] or best[3] == Path(self.catalog.src) else "the install the model's settings came from")+ if len(picks) > 1:+ why += f", the newest of {len(picks)} packages"+ self.dsv41_choice = (str(best[2]), why)+ return best[2], True+ folders: list[Path] = [Path(self.catalog.root) / dsv41_engine.DIR] # (nothing there: the older places, as before)try:from strata_control import engine_component as ecrep = ec.status()diff --git a/strata_control/dsv41_engine.py b/strata_control/dsv41_engine.pyindex 5085c8aad..dc389022b 100644--- a/strata_control/dsv41_engine.py+++ b/strata_control/dsv41_engine.py@@ -20,10 +20,16 @@ def exe_name() -> str:return NAME + (".exe" if os.name == "nt" else "")+def version_key(folder_name: str) -> tuple:+ """The version at the front of a package folder's name ("0.1.49-windows-x86_64-cuda-cuda13" -> (0, 1, 49)), for choosing the newest."""+ head = str(folder_name).split("-")[0]+ return tuple(int(x) for x in head.split(".") if x.isdigit())++def find(dest: Path) -> Path | None:"""The newest installed package's strata-dsv41 in `dest` (engine-dsv41/), or None."""try:- folders = sorted((d for d in Path(dest).iterdir() if d.is_dir() and (d / exe_name()).is_file()), key=lambda d: d.name)+ folders = sorted((d for d in Path(dest).iterdir() if d.is_dir() and (d / exe_name()).is_file()), key=lambda d: (version_key(d.name), d.name))except OSError:return Nonereturn folders[-1] / exe_name() if folders else Nonediff --git a/tests/terminal/test_dsv41_tui_items.py b/tests/terminal/test_dsv41_tui_items.pyindex 9789e3a5b..846ecdfe0 100644--- a/tests/terminal/test_dsv41_tui_items.py+++ b/tests/terminal/test_dsv41_tui_items.py@@ -176,3 +176,72 @@ class MissingEngine(unittest.TestCase):self.assertFalse(self.check({"arch": "deepseek41", "exe": str(exe)}, None))self.assertFalse(self.check({"arch": "deepseek41", "exe": "C:/gone/x.exe"}, exe))self.assertFalse(self.check({"arch": "qwen4exp", "exe": "component:strata-engine"}, None))+++class WhichInstallsEngine(unittest.TestCase):+ """The DeepSeek engine package that runs: the newest of the running Terminal's own install and the install the model's settings came from."""++ def runner(self, own, root):+ f = mock.MagicMock()+ f.catalog.src = Path(own)+ f.catalog.root = Path(root)+ f.catalog.strata.setup_module.side_effect = RuntimeError("none")+ f.catalog.data_dir.return_value = Path(root) / "data"+ f.s.data_dir = None+ return f++ def make(self, base, version):+ d = Path(base) / "engine-dsv41" / f"{version}-windows-x86_64-cuda-cuda13"+ d.mkdir(parents=True)+ exe = d / ("strata-dsv41.exe" if sys.platform == "win32" else "strata-dsv41")+ exe.write_bytes(b"x")+ return exe++ def found(self, own, root):+ from strata_cli.launch import runner as R+ f = self.runner(own, root)+ with mock.patch.dict("os.environ", {"STRATA_DSV41_EXE": "", "STRATA_INSTALL_DIR": ""}), \+ mock.patch("strata_control.engine_component.status", return_value={"usable": False}):+ out = R.Runner.dsv41_engine_found(f)+ return out[0], getattr(f, "dsv41_choice", None)++ def test_the_running_terminals_newer_package_beats_an_older_first_install(self):+ import tempfile+ with tempfile.TemporaryDirectory() as d:+ old = self.make(Path(d) / "inst5", "0.1.48")+ new = self.make(Path(d) / "inst8", "0.1.49")+ exe, choice = self.found(Path(d) / "inst8", Path(d) / "inst5")+ self.assertEqual(exe, new)+ self.assertIn("own folder", choice[1])+ self.assertIn("newest of 2", choice[1])++ def test_an_older_package_in_the_running_terminal_does_not_beat_a_newer_one_in_the_settings_install(self):+ import tempfile+ with tempfile.TemporaryDirectory() as d:+ self.make(Path(d) / "inst8", "0.1.48")+ new = self.make(Path(d) / "inst5", "0.1.49")+ exe, _ = self.found(Path(d) / "inst8", Path(d) / "inst5")+ self.assertEqual(exe, new)++ def test_the_same_version_in_both_means_the_running_terminals_own(self):+ import tempfile+ with tempfile.TemporaryDirectory() as d:+ self.make(Path(d) / "inst5", "0.1.49")+ own = self.make(Path(d) / "inst8", "0.1.49")+ exe, choice = self.found(Path(d) / "inst8", Path(d) / "inst5")+ self.assertEqual(exe, own)+ self.assertIn("own folder", choice[1])++ def test_only_the_settings_install_has_one(self):+ import tempfile+ with tempfile.TemporaryDirectory() as d:+ only = self.make(Path(d) / "inst5", "0.1.49")+ (Path(d) / "inst8").mkdir()+ exe, choice = self.found(Path(d) / "inst8", Path(d) / "inst5")+ self.assertEqual(exe, only)+ self.assertIn("settings came from", choice[1])++ def test_versions_compare_as_numbers(self):+ from strata_control import dsv41_engine+ self.assertGreater(dsv41_engine.version_key("0.1.49-x"), dsv41_engine.version_key("0.1.9-x"))+ self.assertGreater(dsv41_engine.version_key("0.1.49.1-x"), dsv41_engine.version_key("0.1.49-x"))