diff --git a/packages/node/meshnet_node/config.py b/packages/node/meshnet_node/config.py index 9030fb0..bca5068 100644 --- a/packages/node/meshnet_node/config.py +++ b/packages/node/meshnet_node/config.py @@ -9,7 +9,11 @@ from pathlib import Path _DEFAULT_CONFIG_DIR = Path.home() / ".config" / "meshnet" _DEFAULT_CONFIG_FILE = _DEFAULT_CONFIG_DIR / "config.json" -_DEFAULT_DOWNLOAD_DIR = Path.home() / ".meshnet" / "models" +# MESHNET_DOWNLOAD_DIR overrides the model store for every node on this +# machine (all CLI flows fall back to this default; --download-dir still wins). +_DEFAULT_DOWNLOAD_DIR = Path( + os.environ.get("MESHNET_DOWNLOAD_DIR", str(Path.home() / ".meshnet" / "models")) +) _DEFAULT_TRACKER_URL = "http://localhost:8080" _DEFAULT_WALLET_PATH = str(Path.home() / ".config" / "meshnet" / "wallet.json") _DEFAULT_QUANTIZATION = "nf4" diff --git a/packages/node/pyproject.toml b/packages/node/pyproject.toml index e2b0c93..08cea8f 100644 --- a/packages/node/pyproject.toml +++ b/packages/node/pyproject.toml @@ -19,6 +19,7 @@ dependencies = [ "transformers>=4.39", "websockets>=13", "zstandard>=0.22", + "kernels>=0.11.1,<0.16", ] [project.scripts] diff --git a/tests/test_node_startup.py b/tests/test_node_startup.py index d277325..443bdd9 100644 --- a/tests/test_node_startup.py +++ b/tests/test_node_startup.py @@ -1414,3 +1414,16 @@ def test_layers_from_config_get_text_config_and_variants(): cfg = types.SimpleNamespace(get_text_config=lambda: inner) assert layers_from_config(cfg) == 32 assert layers_from_config(types.SimpleNamespace()) is None + + +def test_download_dir_env_override(monkeypatch): + import importlib + + from meshnet_node import config as config_mod + + monkeypatch.setenv("MESHNET_DOWNLOAD_DIR", "/tmp/llm-store") + importlib.reload(config_mod) + assert config_mod.DEFAULTS["download_dir"] == "/tmp/llm-store" + monkeypatch.delenv("MESHNET_DOWNLOAD_DIR") + importlib.reload(config_mod) + assert config_mod.DEFAULTS["download_dir"].endswith("models")