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.

Add onboarding debug info and fix Xpra window detection on Windows (#1014)

ddupontcace410dba37
diff --git a/libs/cuabot/src/cuabot.tsx b/libs/cuabot/src/cuabot.tsx
index 631f519873..92807e15aa 100644
--- a/libs/cuabot/src/cuabot.tsx
+++ b/libs/cuabot/src/cuabot.tsx
@@ -9,6 +9,9 @@ import { getDefaultAgent, AGENTS, AgentId, getAliasIgnored, getTelemetryEnabled
import { runOnboarding } from "./onboarding.js";
import { sendTelemetryToServer } from "./telemetry.js";
import { execSync } from "child_process";
+import { existsSync, readFileSync } from "fs";
+import { homedir } from "os";
+import { join } from "path";
function isCuabotInPath(): boolean {
try {
@@ -371,6 +374,102 @@ Commands:
process.exit(0);
}
+ case "--debug-onboarding": {
+ const CONFIG_DIR = join(homedir(), ".cuabot");
+ const SETTINGS_FILE = join(CONFIG_DIR, "settings.json");
+
+ console.log("=== Onboarding Debug ===\n");
+ console.log("Platform:", process.platform);
+ console.log("Home:", homedir());
+ console.log("");
+
+ // Check settings
+ console.log("=== Settings ===");
+ console.log("Settings file:", SETTINGS_FILE);
+ console.log("Settings exists:", existsSync(SETTINGS_FILE));
+ if (existsSync(SETTINGS_FILE)) {
+ try {
+ const settings = JSON.parse(readFileSync(SETTINGS_FILE, "utf-8"));
+ console.log("Settings content:", JSON.stringify(settings, null, 2));
+ console.log("aliasIgnored:", settings.aliasIgnored === true);
+ } catch (e) {
+ console.log("Failed to read settings:", e);
+ }
+ } else {
+ console.log("aliasIgnored: false (no settings file)");
+ }
+ console.log("");
+
+ // Check cuabot in PATH
+ console.log("=== Cuabot in PATH ===");
+ const pathCmd = process.platform === "win32" ? "where cuabot" : "which cuabot";
+ console.log("Command:", pathCmd);
+ try {
+ const result = execSync(pathCmd, { encoding: "utf-8" });
+ console.log("Result:", result.trim());
+ console.log("checkCuabotInPath: true");
+ } catch (e: any) {
+ console.log("Error:", e.message?.split("\n")[0] || "Command failed");
+ console.log("Exit code:", e.status);
+ console.log("checkCuabotInPath: false");
+ }
+ console.log("");
+
+ // Check shell RC file
+ console.log("=== Shell RC File ===");
+ let rcFile: string | null = null;
+ if (process.platform === "win32") {
+ const ps7Profile = join(homedir(), "Documents", "PowerShell", "Microsoft.PowerShell_profile.ps1");
+ const ps5Profile = join(homedir(), "Documents", "WindowsPowerShell", "Microsoft.PowerShell_profile.ps1");
+ const ps7Dir = join(homedir(), "Documents", "PowerShell");
+ console.log("PS7 dir exists:", existsSync(ps7Dir));
+ rcFile = existsSync(ps7Dir) ? ps7Profile : ps5Profile;
+ } else {
+ const shell = process.env.SHELL || "";
+ console.log("SHELL env:", shell);
+ if (shell.includes("zsh")) rcFile = join(homedir(), ".zshrc");
+ else if (shell.includes("bash")) {
+ const bashProfile = join(homedir(), ".bash_profile");
+ rcFile = (process.platform === "darwin" && existsSync(bashProfile)) ? bashProfile : join(homedir(), ".bashrc");
+ }
+ }
+ console.log("RC file:", rcFile);
+ if (rcFile) {
+ console.log("RC file exists:", existsSync(rcFile));
+ if (existsSync(rcFile)) {
+ const content = readFileSync(rcFile, "utf-8");
+ const hasAlias = content.includes("alias cuabot=") || content.includes("function cuabot");
+ console.log("Has cuabot alias/function:", hasAlias);
+ }
+ }
+ console.log("");
+
+ // Windows batch file check
+ if (process.platform === "win32") {
+ console.log("=== Windows Batch File ===");
+ const windowsApps = join(process.env.LOCALAPPDATA || join(homedir(), "AppData", "Local"), "Microsoft", "WindowsApps");
+ const batchFile = join(windowsApps, "cuabot.cmd");
+ console.log("Batch file path:", batchFile);
+ console.log("Batch file exists:", existsSync(batchFile));
+ if (existsSync(batchFile)) {
+ console.log("Batch file content:", readFileSync(batchFile, "utf-8"));
+ }
+ console.log("");
+ }
+
+ // Final result
+ console.log("=== Final Check Result ===");
+ const cuabotInPath = isCuabotInPath();
+ const aliasIgnored = getAliasIgnored();
+ const status = cuabotInPath || aliasIgnored ? "ok" : "error";
+ const message = cuabotInPath ? "ready" : aliasIgnored ? "using npx" : "not set up";
+ console.log("cuabotInPath:", cuabotInPath);
+ console.log("aliasIgnored:", aliasIgnored);
+ console.log("Status:", status);
+ console.log("Message:", message);
+ process.exit(0);
+ }
+
default: {
console.error(`Unknown flag: ${flag}`);
console.error(`Run 'cuabot --help' for usage`);
diff --git a/libs/cuabot/src/cuabotd.ts b/libs/cuabot/src/cuabotd.ts
index 850f1728e0..3995a885e0 100644
--- a/libs/cuabot/src/cuabotd.ts
+++ b/libs/cuabot/src/cuabotd.ts
@@ -455,7 +455,7 @@ async function updateCursorMasks(): Promise<void> {
// Reverse to go back-to-front (openWindows returns front-to-back)
for (const win of [...windows].reverse()) {
const b = win.bounds;
- const isXpra = win.owner.name === "Xpra";
+ const isXpra = win.owner.name === "Xpra" || win.owner.name.toLowerCase().includes("xpra");
const isCursorWindow = win.title.includes(cursorWindowPattern);
const ignoredWindows = ["cuabot-debug-masks", "Screen Studio", "recording-manager-widget"];
const isIgnoredWindow = ignoredWindows.some(name => win.title.includes(name));