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++
tools: gguf-py is also looked up in the install folder (STRATA_INSTALL_DIR, the app's folder), so tools run by hand from the Control package find what setup.py downloaded; the error names STRATA_GGUF_PY (#3269)
Niko12219b8436df4e7d
diff --git a/tools/_paths.py b/tools/_paths.pyindex 336719ec8..097b7d1cf 100644--- a/tools/_paths.py+++ b/tools/_paths.py@@ -1,7 +1,9 @@"""tools/_paths.py - where the tools find llama.cpp's gguf-py (for the MTP packer and the fixtures).Order: $STRATA_GGUF_PY, then <engine>/third_party/llama.cpp/gguf-py (what setup.py clones), then the development-tree's ../../.ref/llama.cpp/gguf-py.+tree's ../../.ref/llama.cpp/gguf-py, then (#3269) the install folders: in the Control package setup.py writes third_party/+to the per-user install folder ($STRATA_INSTALL_DIR, else the app's folder, the Terminal's remembered installs), not+beside the tools, so a tool run by hand from the package finds it there."""from __future__ import annotations@@ -12,14 +14,34 @@ from pathlib import PathENGINE = Path(__file__).resolve().parents[1]+def _install_dirs() -> list[Path]:+ """The per-user install folders a Control-mode setup.py writes third_party/ into. Best effort: never raises."""+ out: list[Path] = []+ raw = os.environ.get("STRATA_INSTALL_DIR")+ if raw:+ out.append(Path(raw).expanduser())+ try:+ if str(ENGINE) not in sys.path:+ sys.path.append(str(ENGINE))+ from strata_control import discovery+ out.append(discovery.app_install_dir())+ out += [pl.path for pl in discovery.places(here=ENGINE)]+ except Exception:+ pass+ return out++def gguf_py() -> str:cands = [os.environ.get("STRATA_GGUF_PY"), ENGINE / "third_party" / "llama.cpp" / "gguf-py",ENGINE.parents[min(1, len(ENGINE.parents) - 1)] / ".ref" / "llama.cpp" / "gguf-py"] # the dev tree; a shallow install (G:\Strata) has no grandparent+ cands += [d / "third_party" / "llama.cpp" / "gguf-py" for d in _install_dirs()]for c in cands:if c and (Path(c) / "gguf").is_dir():return str(c)- sys.exit("llama.cpp's gguf-py was not found: run setup.py (it clones llama.cpp into third_party/), "- "or set STRATA_GGUF_PY")+ sys.exit("llama.cpp's gguf-py was not found. Set STRATA_GGUF_PY to the gguf-py folder of any llama.cpp checkout "+ "(<llama.cpp>/gguf-py), or run setup.py once (it downloads llama.cpp into third_party/ of the install "+ "folder; in the desktop app or the Terminal package that folder is STRATA_INSTALL_DIR, which this tool also "+ "looks in)")def add_gguf_py() -> None:diff --git a/tools/test_gguf_paths.py b/tools/test_gguf_paths.pynew file mode 100644index 000000000..1a73ffff9--- /dev/null+++ b/tools/test_gguf_paths.py@@ -0,0 +1,39 @@+"""#3269: a tool run by hand from the Control package finds gguf-py in the install folder setup.py wrote it to."""+import os+import sys+import tempfile+import unittest+from pathlib import Path+from unittest import mock++sys.path.insert(0, str(Path(__file__).resolve().parent))+import _paths # noqa: E402+++class GgufPyLookup(unittest.TestCase):+ def test_install_dir_is_searched(self):+ with tempfile.TemporaryDirectory() as d:+ gp = Path(d) / "third_party" / "llama.cpp" / "gguf-py"+ (gp / "gguf").mkdir(parents=True)+ env = {k: v for k, v in os.environ.items() if k != "STRATA_GGUF_PY"}+ env["STRATA_INSTALL_DIR"] = d+ with mock.patch.dict(os.environ, env, clear=True), \+ mock.patch.object(_paths, "ENGINE", Path(d) / "nowhere" / "pkg"):+ self.assertEqual(_paths.gguf_py(), str(gp))++ def test_env_wins_and_message_names_it(self):+ with tempfile.TemporaryDirectory() as d:+ (Path(d) / "gguf").mkdir()+ with mock.patch.dict(os.environ, {"STRATA_GGUF_PY": d}):+ self.assertEqual(_paths.gguf_py(), d)+ env = {k: v for k, v in os.environ.items() if k not in ("STRATA_GGUF_PY", "STRATA_INSTALL_DIR")}+ with tempfile.TemporaryDirectory() as d, mock.patch.dict(os.environ, env, clear=True), \+ mock.patch.object(_paths, "ENGINE", Path(d) / "a" / "b"), \+ mock.patch.object(_paths, "_install_dirs", return_value=[]):+ with self.assertRaises(SystemExit) as cm:+ _paths.gguf_py()+ self.assertIn("STRATA_GGUF_PY", str(cm.exception))+++if __name__ == "__main__":+ unittest.main()