Files
openclaw/extensions/cua-computer/index.test.ts
Peter Steinberger f695be341c feat(cua-computer): add experimental Windows/Linux computer-use fulfiller (#112267)
* feat(cua-computer): add experimental Windows/Linux computer-use fulfiller

Bundled plugin that fulfills the capability-based computer.act + screen.snapshot
node contract on Windows and Linux by supervising a pinned cua-driver 0.10.x
daemon over MCP stdio. macOS keeps the Peekaboo fulfiller; this plugin is
disabled by default and never available on darwin.

Grounded in cua-driver 0.10.0 source (tool schemas, refusal codes, coordinate
spaces, session/daemon lifecycle). Notable safety and correctness properties:
- Deny-by-default env allowlist so OpenClaw secrets (provider/channel tokens,
  CUA_API_KEY) never reach the separately installed daemon; telemetry and
  update checks forced off.
- Version-gated handshake (exact-minor pin + capability/schema version),
  time-bounded so a corrected driver recovers without a node restart.
- Robust daemon supervision: full readiness-budget polling, startup-race
  tolerance, signal-death and spawn-error recovery, shared-daemon lifecycle
  (never killed on dispose).
- Frame authorization preserved within upstream limits (generation + full live
  geometry; capture refused when screen and screenshot geometry diverge).
- Action mapping refuses inputs cua-driver cannot faithfully deliver:
  layout-shifted keys, modifier-held drag/scroll, Linux modifier clicks,
  hold_key/mouse down-up, non-positive scroll; drag duration clamped.

* fix(cua-computer): satisfy lint, test-types, dead-code, and docs-map gates
2026-07-21 05:58:04 -07:00

22 lines
851 B
TypeScript

import type {
OpenClawPluginApi,
OpenClawPluginNodeHostCommand,
} from "openclaw/plugin-sdk/plugin-entry";
import { describe, expect, it } from "vitest";
import plugin from "./index.js";
describe("cua-computer plugin registration", () => {
it("registers the screen and dangerous computer node-host commands", () => {
const commands: OpenClawPluginNodeHostCommand[] = [];
plugin.register({
pluginConfig: { driverPath: "cua-driver" },
registerNodeHostCommand: (command: OpenClawPluginNodeHostCommand) => commands.push(command),
} as unknown as OpenClawPluginApi);
expect(commands.map(({ command, cap, dangerous }) => ({ command, cap, dangerous }))).toEqual([
{ command: "screen.snapshot", cap: "screen", dangerous: false },
{ command: "computer.act", cap: "computer", dangerous: true },
]);
});
});