Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

1.9 KB
Raw Blame
// SPDX-License-Identifier: FSL-1.1-MIT
// Copyright (c) 2026 Cua AI, Inc.

/** Why New Space cannot run anything on this machine, in the words of its OS. */

const DOCKER_DESKTOP_URL = "https://docs.docker.com/desktop/setup/install/windows-install/";

/**
 * The line New Space shows when no local runtime is ready. `containerDetail`
 * is the runtime doctor's detail for the container engine, when it gave one
 * (for example "container engine at npipe://... is not running").
 */
export function noLocalRuntimeReason(platform: string, containerDetail?: string, managedDetail?: string): string {
  if (platform === "darwin") return "No local runtime found (Docker or Lume).";
  // Windows: Cua Spaces runs its own container engine in WSL 2. When it cannot, its
  // detail says what to turn on (WSL 2, Virtual Machine Platform, virtualization).
  if (platform === "win32" && managedDetail && /wsl|virtual|not enough disk space/i.test(managedDetail)) return managedDetail;
  const detail = (containerDetail ?? "").toLowerCase();
  const installedButStopped = /not running|did not answer|not listening|start |socket not found|pipe\/dockerdesktop/.test(detail);
  if (platform === "win32") {
    if (installedButStopped) {
      return "Docker Desktop isn't running. Start it and wait for “Engine running”, then try again.";
    }
    return `Cua runs local Spaces in Docker Desktop (WSL 2 alone isn't enough). Install it from ${DOCKER_DESKTOP_URL}, start it, then try again.`;
  }
  if (/permission denied/.test(detail)) {
    return "Docker is installed, but your account isn't allowed to use it yet. Run `sudo usermod -aG docker $USER` in a terminal, then reopen Cua Spaces.";
  }
  if (installedButStopped) return "Docker isn't running. Start it (for example `sudo systemctl start docker`), then try again.";
  return "No local runtime found. Install Docker Engine or Podman and start it, then try again.";
}