refactor: move computer tool to cua-computer plugin

Move GUI automation from core to a standalone plugin. This keeps the
core lean and lets users opt-in when they need computer-use capabilities.

Plugin provides:
- Screenshot capture
- Mouse clicks (left, right, double)
- Keyboard input (type, key, hotkey)
- Scrolling and dragging
- Cursor position/screen size queries

Enable via config:
```yaml
plugins:
  cua-computer:
    serverUrl: "http://localhost:8000"
```
This commit is contained in:
f-trycua 2026-01-26 15:56:22 -08:00
parent e8b9963437
commit 438c80b758
6 changed files with 65 additions and 11 deletions

View File

@ -0,0 +1,22 @@
{
"id": "cua-computer",
"name": "Cua Computer",
"description": "GUI automation via cua-computer-server - screenshots, clicks, typing, scrolling",
"version": "0.1.0",
"configSchema": {
"type": "object",
"properties": {
"serverUrl": {
"type": "string",
"description": "computer-server URL (default: http://localhost:8000)"
}
}
},
"uiHints": {
"serverUrl": {
"label": "Server URL",
"placeholder": "http://localhost:8000",
"help": "URL of the cua-computer-server instance"
}
}
}

View File

@ -9,10 +9,10 @@
import { Type } from "@sinclair/typebox";
import type { ClawdbotConfig } from "../../config/config.js";
import { stringEnum } from "../schema/typebox.js";
import type { AnyAgentTool } from "./common.js";
import { imageResult, jsonResult, readNumberParam, readStringParam } from "./common.js";
import type { ClawdbotConfig } from "../../src/config/config.js";
import { stringEnum } from "../../src/agents/schema/typebox.js";
import type { AnyAgentTool } from "../../src/agents/tools/common.js";
import { imageResult, jsonResult, readNumberParam, readStringParam } from "../../src/agents/tools/common.js";
import { ComputerServerClient, ComputerServerError } from "./computer-server-client.js";
const COMPUTER_ACTIONS = [

View File

@ -0,0 +1,33 @@
/**
* Cua Computer Plugin
*
* Provides GUI automation via cua-computer-server - screenshots, clicks, typing, scrolling.
*
* @see https://github.com/trycua/cua/tree/main/libs/python/computer-server
*/
import type { ClawdbotPluginDefinition } from "../../src/plugins/types.js";
import { createComputerTool } from "./computer-tool.js";
interface CuaComputerConfig {
serverUrl?: string;
}
const plugin: ClawdbotPluginDefinition = {
id: "cua-computer",
name: "Cua Computer",
description: "GUI automation via cua-computer-server",
register(api) {
const config = api.pluginConfig as CuaComputerConfig | undefined;
api.registerTool(
createComputerTool({
defaultServerUrl: config?.serverUrl,
config: api.config,
}),
);
},
};
export default plugin;

View File

@ -0,0 +1,6 @@
{
"name": "@clawdbot/plugin-cua-computer",
"version": "0.1.0",
"type": "module",
"main": "index.ts"
}

View File

@ -6,7 +6,6 @@ import { createAgentsListTool } from "./tools/agents-list-tool.js";
import { createBrowserTool } from "./tools/browser-tool.js";
import { createCanvasTool } from "./tools/canvas-tool.js";
import type { AnyAgentTool } from "./tools/common.js";
import { createComputerTool } from "./tools/computer-tool.js";
import { createCronTool } from "./tools/cron-tool.js";
import { createGatewayTool } from "./tools/gateway-tool.js";
import { createImageTool } from "./tools/image-tool.js";
@ -26,8 +25,6 @@ export function createClawdbotTools(options?: {
allowedControlUrls?: string[];
allowedControlHosts?: string[];
allowedControlPorts?: number[];
/** URL of the computer-server for GUI automation (default: http://localhost:8000) */
computerServerUrl?: string;
agentSessionKey?: string;
agentChannel?: GatewayMessageChannel;
agentAccountId?: string;
@ -82,10 +79,6 @@ export function createClawdbotTools(options?: {
allowedControlHosts: options?.allowedControlHosts,
allowedControlPorts: options?.allowedControlPorts,
}),
createComputerTool({
defaultServerUrl: options?.computerServerUrl,
config: options?.config,
}),
createCanvasTool(),
createNodesTool({
agentSessionKey: options?.agentSessionKey,