"""VM backend implementations. The :class:`~ci_orchestrator.backends.protocol.VmBackend` Protocol defines the neutral interface every backend must satisfy. Phase A ships only the :class:`~ci_orchestrator.backends.workstation.WorkstationVmrunBackend`; Phase C will add an ESXi backend behind the same interface. """ from __future__ import annotations from ci_orchestrator.backends.protocol import VmBackend, VmHandle, VmState from ci_orchestrator.backends.workstation import WorkstationVmrunBackend __all__ = ["VmBackend", "VmHandle", "VmState", "WorkstationVmrunBackend", "load_backend"] def load_backend(config: object) -> VmBackend: """Factory: pick a backend implementation from ``config.backend.type``. Phase C hook: when the ESXi backend lands, this function will dispatch on ``config.backend.type``. For now only ``workstation`` is supported. """ backend_type = getattr(getattr(config, "backend", None), "type", "workstation") if backend_type != "workstation": raise NotImplementedError( f"Backend type '{backend_type}' is not implemented. " "Only 'workstation' is available in Phase A." ) vmrun_path = getattr(config, "vmrun_path", None) return WorkstationVmrunBackend(vmrun_path=vmrun_path)