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++
Engine packages: the folders named in BUILD.json lib_dirs go on the library path with the package folder (the Windows HIP package keeps the ROCm DLLs in rocm/bin), for serve, the binary smoke test and tuning
Niko12214db866ae00c8
diff --git a/serve/server.py b/serve/server.pyindex 31dceb85b..1b82c1023 100644--- a/serve/server.py+++ b/serve/server.py@@ -7456,7 +7456,7 @@ def with_component_engine(cfg: dict) -> dict:return cfgcfg = dict(cfg)cfg["exe"] = _component_exe(cfg["exe"], cfg)- cfg["lib_dirs"] = [str(Path(cfg["exe"]).parent), *(cfg.get("lib_dirs") or [])]+ cfg["lib_dirs"] = [*engine_component.package_lib_dirs(Path(cfg["exe"]).parent), *(cfg.get("lib_dirs") or [])]return cfgdiff --git a/strata_control/engine_component.py b/strata_control/engine_component.pyindex 55d456cda..27f733c9c 100644--- a/strata_control/engine_component.py+++ b/strata_control/engine_component.py@@ -150,6 +150,25 @@ class EngineComponent:"build_id": self.build_id, "variant": self.variant, "signed": bool(self.signature), "file_count": len(self.files), "bytes": sum(item[2] for item in self.files)}+def package_lib_dirs(folder) -> list[str]:+ """The folders an engine package needs on the library path (``PATH`` on Windows, ``LD_LIBRARY_PATH`` elsewhere): its own folder, then+ the ones its BUILD.json names in ``lib_dirs`` (relative; the Windows HIP package keeps the ROCm DLLs in ``rocm/bin``, which+ rocblas.dll's kernel data and ``../.kpack`` are laid out around). Only folders that exist inside the package."""+ folder = Path(folder)+ dirs = [str(folder)]+ try:+ names = json.loads((folder / "BUILD.json").read_text(encoding="utf-8-sig")).get("lib_dirs") or []+ except (OSError, ValueError, AttributeError):+ names = []+ for name in names:+ if not isinstance(name, str) or not name or Path(name).is_absolute() or ".." in Path(name).parts:+ continue+ path = folder / name+ if path.is_dir() and str(path) not in dirs:+ dirs.append(str(path))+ return dirs++# ----------------------------------------------------------------------------------------------- wheredef components_dir(environ=None, *, windows: bool | None = None, home: Path | None = None) -> Path:diff --git a/strata_control/tuning.py b/strata_control/tuning.pyindex c9c8394c4..8d3661772 100644--- a/strata_control/tuning.py+++ b/strata_control/tuning.py@@ -197,7 +197,8 @@ def engine_env(engine: Path | str) -> dict[str, str] | None:return Nonevar = "PATH" if os.name == "nt" else "LD_LIBRARY_PATH"env = dict(os.environ)- env[var] = os.pathsep.join([str(folder)] + ([env[var]] if env.get(var) else []))+ from strata_control import engine_component+ env[var] = os.pathsep.join(engine_component.package_lib_dirs(folder) + ([env[var]] if env.get(var) else []))return envdiff --git a/strata_control/updater.py b/strata_control/updater.pyindex e58eed1e5..adca61d41 100644--- a/strata_control/updater.py+++ b/strata_control/updater.py@@ -572,7 +572,7 @@ def binary_smoke(component: ec.EngineComponent, timeout: float = 60) -> dict:report its version. Weaker than a one-token answer, and reported as such."""var = "PATH" if os.name == "nt" else ("DYLD_LIBRARY_PATH" if sys.platform == "darwin" else "LD_LIBRARY_PATH")env = dict(os.environ)- env[var] = str(component.root) + os.pathsep + env.get(var, "")+ env[var] = os.pathsep.join(ec.package_lib_dirs(component.root)) + os.pathsep + env.get(var, "")try:done = subprocess.run([str(component.exe), "--version"], capture_output=True, text=True, timeout=timeout, env=env,cwd=str(component.root), creationflags=getattr(subprocess, "CREATE_NO_WINDOW", 0))diff --git a/tests/terminal/test_component_start.py b/tests/terminal/test_component_start.pyindex 42ce5c679..dbab849f4 100644--- a/tests/terminal/test_component_start.py+++ b/tests/terminal/test_component_start.py@@ -202,6 +202,18 @@ class ComponentStart(unittest.TestCase):server.with_component_engine({"exe": "component:strata-engine", "backend": "cuda"})self.assertEqual(caught.exception.code, 5)+ def test_the_build_json_lib_dirs_follow_the_package_folder(self):+ """The Windows HIP package keeps the ROCm DLLs in rocm/bin (BUILD.json lib_dirs): strata.exe does not load without them on PATH."""+ from serve import server+ folder = install_fake_engine(self.components)+ (folder / "rocm" / "bin").mkdir(parents=True)+ (folder / "BUILD.json").write_text(json.dumps({"lib_dirs": ["rocm/bin", "../escape", "missing", "/abs"]}), encoding="utf-8")+ cfg = server.with_component_engine({"exe": "component:strata-engine", "backend": "cuda", "lib_dirs": ["/other"]})+ self.assertEqual(cfg["lib_dirs"], [str(folder), str(folder / "rocm" / "bin"), "/other"])+ env = server.child_env(cfg)+ var = "PATH" if WINDOWS else "LD_LIBRARY_PATH"+ self.assertTrue(env[var].startswith(str(folder) + os.pathsep + str(folder / "rocm" / "bin")))+def test_doctor_names_the_missing_engine(self):from strata_control.doctor import inspectreport = inspect(self.config)