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

serve: a component engine's folder goes first on the library path; with_component_engine helper + test

Niko122164d8488c6777
diff --git a/serve/server.py b/serve/server.py
index f17a5e7fc..9c58465e4 100644
--- a/serve/server.py
+++ b/serve/server.py
@@ -7260,6 +7260,17 @@ def default_model_name(cfg: dict) -> str:
return cfg.get("model_name") or FAMILY_MODEL_NAMES.get(cfg.get("arch") or "qwen4exp", "qwen3.8-flash-next")
+def with_component_engine(cfg: dict) -> dict:
+ """A run config that names "component:strata-engine" gets the engine package for this PC: the path in `exe`, and
+ the package's own folder first on the library path (the GPU runtime libraries ship beside the binary)."""
+ if not engine_component.is_reference(cfg.get("exe")):
+ return cfg
+ cfg = dict(cfg)
+ cfg["exe"] = _component_exe(cfg["exe"], cfg)
+ cfg["lib_dirs"] = [str(Path(cfg["exe"]).parent), *(cfg.get("lib_dirs") or [])]
+ return cfg
+
+
def _component_exe(reference: str, cfg: dict) -> str:
"""The engine a run config names as "component:strata-engine". No engine for this PC is a clear notice and exit 5;
the server never goes looking on the internet for one (strata_control/engine_component.py)."""
@@ -7455,6 +7466,7 @@ def main(argv=None, *, lifecycle_event=None, interrupt_exit_code: int = 0) -> in
if a.engine == "strata":
if not cfg:
ap.error("--engine strata needs --config")
+ cfg = with_component_engine(cfg)
vision = None
# The engine's own environment. It carries the offline policy too: an engine that fetched a
# missing shard or a plugin would break the promise the flag makes.
diff --git a/tests/terminal/test_component_start.py b/tests/terminal/test_component_start.py
index 45aff32f9..8651b0c33 100644
--- a/tests/terminal/test_component_start.py
+++ b/tests/terminal/test_component_start.py
@@ -133,6 +133,24 @@ class ComponentStart(unittest.TestCase):
self.assertNotEqual(code, 0)
self.assertFalse((self.root / "ran.txt").exists(), "a changed package must not run")
+ def test_the_package_folder_is_first_on_the_library_path(self):
+ from serve import server
+ folder = install_fake_engine(self.components)
+ cfg = server.with_component_engine({"exe": "component:strata-engine", "backend": "cuda", "lib_dirs": ["/other"]})
+ self.assertEqual(Path(cfg["exe"]).parent.resolve(), folder.resolve())
+ self.assertEqual(cfg["lib_dirs"][0], str(folder / ("engine.cmd" if WINDOWS else "engine")).rsplit(os.sep, 1)[0])
+ self.assertEqual(cfg["lib_dirs"][1:], ["/other"])
+ env = server.child_env(cfg)
+ var = "PATH" if WINDOWS else "LD_LIBRARY_PATH"
+ self.assertTrue(env[var].startswith(str(folder)))
+ plain = {"exe": "/some/where/strata", "args": []}
+ self.assertIs(server.with_component_engine(plain), plain)
+ with self.assertRaises(SystemExit) as caught:
+ for entry in (folder / "engine.cmd", folder / "engine"):
+ entry.unlink(missing_ok=True)
+ server.with_component_engine({"exe": "component:strata-engine", "backend": "cuda"})
+ self.assertEqual(caught.exception.code, 5)
+
def test_doctor_names_the_missing_engine(self):
from strata_control.doctor import inspect
report = inspect(self.config)