"""Ensure installed agent root is on sys.path for iuve_connect_agents imports."""

from __future__ import annotations

import sys
from pathlib import Path

# .../iuve_connect_agents/desktop/bootstrap_path.py -> agent install root (/opt/iuve-connect-desktop-agent)
_AGENT_ROOT = Path(__file__).resolve().parent.parent.parent
_VENDOR_ROOT = _AGENT_ROOT / "vendor"

for candidate in (_VENDOR_ROOT, _AGENT_ROOT):
    candidate_str = str(candidate)
    if candidate.is_dir() and candidate_str not in sys.path:
        sys.path.insert(0, candidate_str)
