diff --git a/__init__.py b/__init__.py index 2f4a6f2..417d5e3 100644 --- a/__init__.py +++ b/__init__.py @@ -11,6 +11,11 @@ __version__ = "0.1.0" +# Module-level guard: prevent duplicate WSS auto-start when the plugin is +# installed in multiple locations (e.g. global + profile). The first +# ``register()`` that runs sets this True; subsequent calls no-op. +_auto_start_done = False + def register(ctx) -> None: """Hermes plugin entry point. @@ -165,6 +170,12 @@ def _log(msg: str) -> None: except Exception: pass + global _auto_start_done + if _auto_start_done: + _log("auto-start already handled by another registration, skipping") + return + _auto_start_done = True + _log("auto-start check running") if os.environ.get("HERMES_NODES_AUTO_START", "1") == "1":