"""Thin wrapper around `fastvm.FastvmClient` with a helpful import error.

Reason: OSWorld's existing providers sprinkle `import boto3`/`import docker`
across manager + provider, which means missing SDK installs surface as
`ModuleNotFoundError` pointing at an arbitrary call site. Centralising the
import lets us emit one pointed message.
"""
from __future__ import annotations

from functools import lru_cache

try:
    from fastvm import FastvmClient
except ImportError as e:  # pragma: no cover — install-time hint
    raise ImportError(
        "The `fastvm` Python SDK is required for the FastVM OSWorld provider.\n"
        "Install it with: pip install fastvm\n"
        "Or, for local development: pip install -e /path/to/fastvm-sdk-python"
    ) from e


@lru_cache(maxsize=1)
def get_client() -> FastvmClient:
    """Return a process-wide FastvmClient.

    `FastvmClient` reads `FASTVM_API_KEY` and `FASTVM_BASE_URL` from the
    environment on construction. One client per process is plenty — it
    manages its own HTTP/2 connection pool.
    """
    return FastvmClient()
