"""Zellij integration: binary resolution, plugin path, session name, cache.""" import shutil from pathlib import Path # Plugin path for zellij-send-keys ZELLIJ_PLUGIN = Path.home() / ".config" / "zellij" / "plugins" / "zellij-send-keys.wasm" def _resolve_zellij_bin(): """Resolve zellij binary even when PATH is minimal (eg launchctl).""" from_path = shutil.which("zellij") if from_path: return from_path common_paths = ( "/opt/homebrew/bin/zellij", # Apple Silicon Homebrew "/usr/local/bin/zellij", # Intel Homebrew "/usr/bin/zellij", ) for candidate in common_paths: p = Path(candidate) if p.exists() and p.is_file(): return str(p) return "zellij" # Fallback for explicit error reporting by subprocess ZELLIJ_BIN = _resolve_zellij_bin() # Default Zellij session for spawning ZELLIJ_SESSION = 'infra' # Cache for Zellij session list (avoid calling zellij on every request) _zellij_cache = {"sessions": None, "expires": 0}