"""Launch the PhillSwarm Ollama-compatible full-runtime bridge. Use this when Ollama-style clients should access the full HF swarm runtime instead of the reduced GGUF compatibility preview. """ from __future__ import annotations from pathlib import Path import importlib.util import sys def _detect_root() -> Path: here = Path(__file__).resolve() for root in [here.parent, *here.parents, Path.cwd()]: if (root / "src" / "swarm_moe_model").exists() or (root / "swarm_moe_model").exists(): return root.resolve() return here.parent.resolve() PROJECT_ROOT = _detect_root() def _bridge_file() -> Path: source = PROJECT_ROOT / "src" / "swarm_moe_model" / "ollama_bridge.py" packaged = PROJECT_ROOT / "swarm_moe_model" / "ollama_bridge.py" if source.exists(): return source return packaged def _load_main(): bridge_path = _bridge_file() spec = importlib.util.spec_from_file_location("phill_ollama_bridge_launcher", bridge_path) if spec is None or spec.loader is None: raise RuntimeError(f"Could not load Ollama bridge module from {bridge_path}") module = importlib.util.module_from_spec(spec) sys.modules[spec.name] = module spec.loader.exec_module(module) return module.main if __name__ == "__main__": _load_main()()