import platform


def detect_runtime_platform() -> str:
    """
    Detect runtime platform in a stable, app-friendly way.

    Returns:
        "windows" for Windows
        "macos" for macOS (Darwin)
    """
    system = platform.system()
    if system == "Windows":
        return "windows"
    if system == "Darwin":
        return "macos"
    raise RuntimeError(f"Unsupported platform: {system}")


def detect_macos_architecture() -> str:
    """
    Detect macOS architecture family.

    Returns:
        "intel" for x86_64
        "apple_silicon" for arm64
    """
    machine = platform.machine()
    if machine == "x86_64":
        return "intel"
    if machine == "arm64":
        return "apple_silicon"
    raise RuntimeError(f"Unsupported macOS architecture: {machine}")





