@elizaos/plugin-computeruse 2.0.0-alpha.8 → 2.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/desktop-handlers.d.ts +20 -0
- package/dist/actions/desktop-handlers.d.ts.map +1 -0
- package/dist/actions/desktop.d.ts +11 -0
- package/dist/actions/desktop.d.ts.map +1 -0
- package/dist/actions/helpers.d.ts +33 -0
- package/dist/actions/helpers.d.ts.map +1 -0
- package/dist/actions/use-computer.d.ts +3 -0
- package/dist/actions/use-computer.d.ts.map +1 -0
- package/dist/approval-manager.d.ts +29 -0
- package/dist/approval-manager.d.ts.map +1 -0
- package/dist/index.d.ts +30 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7126 -57
- package/dist/index.js.map +34 -1
- package/dist/osworld/action-converter.d.ts +35 -0
- package/dist/osworld/action-converter.d.ts.map +1 -0
- package/dist/osworld/adapter.d.ts +78 -0
- package/dist/osworld/adapter.d.ts.map +1 -0
- package/dist/osworld/types.d.ts +69 -0
- package/dist/osworld/types.d.ts.map +1 -0
- package/dist/platform/a11y.d.ts +36 -0
- package/dist/platform/a11y.d.ts.map +1 -0
- package/dist/platform/browser.d.ts +61 -0
- package/dist/platform/browser.d.ts.map +1 -0
- package/dist/platform/capabilities.d.ts +10 -0
- package/dist/platform/capabilities.d.ts.map +1 -0
- package/dist/platform/desktop.d.ts +33 -0
- package/dist/platform/desktop.d.ts.map +1 -0
- package/dist/platform/driver.d.ts +27 -0
- package/dist/platform/driver.d.ts.map +1 -0
- package/dist/platform/file-ops.d.ts +10 -0
- package/dist/platform/file-ops.d.ts.map +1 -0
- package/dist/platform/helpers.d.ts +61 -0
- package/dist/platform/helpers.d.ts.map +1 -0
- package/dist/platform/nut-driver.d.ts +19 -0
- package/dist/platform/nut-driver.d.ts.map +1 -0
- package/dist/platform/permissions.d.ts +21 -0
- package/dist/platform/permissions.d.ts.map +1 -0
- package/dist/platform/screenshot.d.ts +16 -0
- package/dist/platform/screenshot.d.ts.map +1 -0
- package/dist/platform/security.d.ts +12 -0
- package/dist/platform/security.d.ts.map +1 -0
- package/dist/platform/terminal.d.ts +38 -0
- package/dist/platform/terminal.d.ts.map +1 -0
- package/dist/platform/windows-list.d.ts +36 -0
- package/dist/platform/windows-list.d.ts.map +1 -0
- package/dist/providers/computer-state.d.ts +9 -0
- package/dist/providers/computer-state.d.ts.map +1 -0
- package/dist/register-routes.d.ts +2 -0
- package/dist/register-routes.d.ts.map +1 -0
- package/dist/register-routes.js +7111 -0
- package/dist/register-routes.js.map +34 -0
- package/dist/routes/computer-use-compat-routes.d.ts +29 -0
- package/dist/routes/computer-use-compat-routes.d.ts.map +1 -0
- package/dist/routes/computer-use-routes.d.ts +3 -0
- package/dist/routes/computer-use-routes.d.ts.map +1 -0
- package/dist/routes/sandbox-routes.d.ts +53 -0
- package/dist/routes/sandbox-routes.d.ts.map +1 -0
- package/dist/services/computer-use-service.d.ts +66 -0
- package/dist/services/computer-use-service.d.ts.map +1 -0
- package/dist/services/desktop-control.d.ts +35 -0
- package/dist/services/desktop-control.d.ts.map +1 -0
- package/dist/types.d.ts +273 -39
- package/dist/types.d.ts.map +1 -1
- package/package.json +65 -68
- package/dist/actions/click-coordinates.d.ts +0 -3
- package/dist/actions/click-coordinates.d.ts.map +0 -1
- package/dist/actions/click-coordinates.js +0 -81
- package/dist/actions/click-coordinates.js.map +0 -1
- package/dist/actions/click.d.ts +0 -3
- package/dist/actions/click.d.ts.map +0 -1
- package/dist/actions/click.js +0 -76
- package/dist/actions/click.js.map +0 -1
- package/dist/actions/drag.d.ts +0 -3
- package/dist/actions/drag.d.ts.map +0 -1
- package/dist/actions/drag.js +0 -87
- package/dist/actions/drag.js.map +0 -1
- package/dist/actions/get-applications.d.ts +0 -3
- package/dist/actions/get-applications.d.ts.map +0 -1
- package/dist/actions/get-applications.js +0 -42
- package/dist/actions/get-applications.js.map +0 -1
- package/dist/actions/get-window-tree.d.ts +0 -3
- package/dist/actions/get-window-tree.d.ts.map +0 -1
- package/dist/actions/get-window-tree.js +0 -73
- package/dist/actions/get-window-tree.js.map +0 -1
- package/dist/actions/open-application.d.ts +0 -3
- package/dist/actions/open-application.d.ts.map +0 -1
- package/dist/actions/open-application.js +0 -57
- package/dist/actions/open-application.js.map +0 -1
- package/dist/actions/press-key.d.ts +0 -3
- package/dist/actions/press-key.d.ts.map +0 -1
- package/dist/actions/press-key.js +0 -57
- package/dist/actions/press-key.js.map +0 -1
- package/dist/actions/screenshot.d.ts +0 -3
- package/dist/actions/screenshot.d.ts.map +0 -1
- package/dist/actions/screenshot.js +0 -41
- package/dist/actions/screenshot.js.map +0 -1
- package/dist/actions/scroll.d.ts +0 -3
- package/dist/actions/scroll.d.ts.map +0 -1
- package/dist/actions/scroll.js +0 -79
- package/dist/actions/scroll.js.map +0 -1
- package/dist/actions/type.d.ts +0 -3
- package/dist/actions/type.d.ts.map +0 -1
- package/dist/actions/type.js +0 -103
- package/dist/actions/type.js.map +0 -1
- package/dist/providers/available-apps.d.ts +0 -3
- package/dist/providers/available-apps.d.ts.map +0 -1
- package/dist/providers/available-apps.js +0 -22
- package/dist/providers/available-apps.js.map +0 -1
- package/dist/providers/computeruse-state.d.ts +0 -3
- package/dist/providers/computeruse-state.d.ts.map +0 -1
- package/dist/providers/computeruse-state.js +0 -35
- package/dist/providers/computeruse-state.js.map +0 -1
- package/dist/service-registry.d.ts +0 -7
- package/dist/service-registry.d.ts.map +0 -1
- package/dist/service-registry.js +0 -2
- package/dist/service-registry.js.map +0 -1
- package/dist/services/computeruse-service.d.ts +0 -36
- package/dist/services/computeruse-service.d.ts.map +0 -1
- package/dist/services/computeruse-service.js +0 -386
- package/dist/services/computeruse-service.js.map +0 -1
- package/dist/types.js +0 -11
- package/dist/types.js.map +0 -1
- package/dist/utils/params.d.ts +0 -5
- package/dist/utils/params.d.ts.map +0 -1
- package/dist/utils/params.js +0 -13
- package/dist/utils/params.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,35 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elizaos/plugin-computeruse",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
3
|
+
"version": "2.0.0-beta.1",
|
|
4
|
+
"description": "Desktop automation plugin — screenshots, mouse/keyboard control, browser CDP, terminal access, file operations, and window management for elizaOS agents. Ported from open-computer-use (Apache 2.0).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
9
|
-
"packageType": "plugin",
|
|
10
|
-
"platform": "node",
|
|
11
|
-
"license": "MIT",
|
|
12
|
-
"keywords": [
|
|
13
|
-
"plugin",
|
|
14
|
-
"elizaos",
|
|
15
|
-
"computeruse",
|
|
16
|
-
"automation",
|
|
17
|
-
"desktop",
|
|
18
|
-
"gui",
|
|
19
|
-
"mcp"
|
|
20
|
-
],
|
|
21
|
-
"repository": {
|
|
22
|
-
"type": "git",
|
|
23
|
-
"url": "https://github.com/elizaos/eliza"
|
|
24
|
-
},
|
|
25
|
-
"homepage": "https://elizaos.ai",
|
|
26
9
|
"exports": {
|
|
27
10
|
"./package.json": "./package.json",
|
|
28
11
|
".": {
|
|
29
|
-
"import":
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"default": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts"
|
|
33
15
|
}
|
|
34
16
|
},
|
|
35
17
|
"files": [
|
|
@@ -37,69 +19,84 @@
|
|
|
37
19
|
"README.md",
|
|
38
20
|
"package.json"
|
|
39
21
|
],
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
22
|
+
"scripts": {
|
|
23
|
+
"postinstall": "node scripts/ensure-platform-deps.mjs",
|
|
24
|
+
"build": "bun run build.ts",
|
|
25
|
+
"test": "vitest run --config vitest.config.ts",
|
|
26
|
+
"typecheck": "tsc --noEmit"
|
|
43
27
|
},
|
|
44
28
|
"peerDependencies": {
|
|
45
|
-
"@elizaos/
|
|
46
|
-
"@elizaos/core": "2.0.0-alpha.3"
|
|
47
|
-
},
|
|
48
|
-
"peerDependenciesMeta": {
|
|
49
|
-
"@elizaos/computeruse": {
|
|
50
|
-
"optional": true
|
|
51
|
-
}
|
|
29
|
+
"@elizaos/core": "2.0.0-beta.1"
|
|
52
30
|
},
|
|
53
31
|
"devDependencies": {
|
|
54
|
-
"@
|
|
55
|
-
"@
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"typescript": "^5.9.3",
|
|
59
|
-
"vitest": "^4.0.17"
|
|
32
|
+
"@elizaos/core": "2.0.0-beta.1",
|
|
33
|
+
"@types/node": "^25.2.3",
|
|
34
|
+
"typescript": "^6.0.3",
|
|
35
|
+
"vitest": "4.1.5"
|
|
60
36
|
},
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"lint": "bunx @biomejs/biome check --write --unsafe .",
|
|
65
|
-
"typecheck": "tsc --noEmit",
|
|
66
|
-
"clean": "rm -rf dist .turbo",
|
|
67
|
-
"lint:check": "bunx @biomejs/biome check .",
|
|
68
|
-
"build": "bun run build.ts",
|
|
69
|
-
"build:ts": "bun run build.ts",
|
|
70
|
-
"format": "bunx @biomejs/biome format --write .",
|
|
71
|
-
"format:check": "bunx @biomejs/biome format ."
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@nut-tree-fork/nut-js": "^4.2.6",
|
|
39
|
+
"puppeteer-core": "^24.9.0"
|
|
72
40
|
},
|
|
41
|
+
"license": "Apache-2.0",
|
|
73
42
|
"agentConfig": {
|
|
74
43
|
"pluginType": "elizaos:plugin:1.0.0",
|
|
75
44
|
"pluginParameters": {
|
|
76
|
-
"
|
|
45
|
+
"COMPUTER_USE_ENABLED": {
|
|
77
46
|
"type": "boolean",
|
|
78
|
-
"description": "Enable
|
|
79
|
-
"required": false
|
|
47
|
+
"description": "Enable computer use capabilities (desktop automation, screenshots, browser control)",
|
|
48
|
+
"required": false,
|
|
49
|
+
"default": false,
|
|
50
|
+
"sensitive": false
|
|
51
|
+
},
|
|
52
|
+
"COMPUTER_USE_SCREENSHOT_AFTER_ACTION": {
|
|
53
|
+
"type": "boolean",
|
|
54
|
+
"description": "Automatically capture a screenshot after each desktop action",
|
|
55
|
+
"required": false,
|
|
56
|
+
"default": true,
|
|
57
|
+
"sensitive": false
|
|
58
|
+
},
|
|
59
|
+
"COMPUTER_USE_ACTION_TIMEOUT_MS": {
|
|
60
|
+
"type": "number",
|
|
61
|
+
"description": "Maximum action execution timeout in milliseconds",
|
|
62
|
+
"required": false,
|
|
63
|
+
"default": 10000,
|
|
64
|
+
"sensitive": false
|
|
80
65
|
},
|
|
81
|
-
"
|
|
66
|
+
"COMPUTER_USE_APPROVAL_MODE": {
|
|
82
67
|
"type": "string",
|
|
83
|
-
"description": "
|
|
84
|
-
"required": false
|
|
68
|
+
"description": "Approval mode for computer-use commands: full_control auto-approves everything, smart_approve auto-approves safe read-only commands, approve_all requires approval for every command, off denies all commands.",
|
|
69
|
+
"required": false,
|
|
70
|
+
"default": "full_control",
|
|
71
|
+
"enum": [
|
|
72
|
+
"full_control",
|
|
73
|
+
"smart_approve",
|
|
74
|
+
"approve_all",
|
|
75
|
+
"off"
|
|
76
|
+
],
|
|
77
|
+
"sensitive": false
|
|
85
78
|
},
|
|
86
|
-
"
|
|
79
|
+
"COMPUTER_USE_BROWSER_HEADLESS": {
|
|
80
|
+
"type": "boolean",
|
|
81
|
+
"description": "Run browser automation headlessly. Useful for CI and test environments without a visible desktop session.",
|
|
82
|
+
"required": false,
|
|
83
|
+
"default": false,
|
|
84
|
+
"sensitive": false
|
|
85
|
+
},
|
|
86
|
+
"ELIZA_COMPUTERUSE_DRIVER": {
|
|
87
87
|
"type": "string",
|
|
88
|
-
"description": "
|
|
89
|
-
"required": false
|
|
88
|
+
"description": "Cross-platform input driver: 'nutjs' (default; uses @nut-tree-fork/nut-js native bindings, works on macOS/Linux/Windows) or 'legacy' (per-OS shell tools: cliclick/xdotool/PowerShell).",
|
|
89
|
+
"required": false,
|
|
90
|
+
"default": "nutjs",
|
|
91
|
+
"enum": [
|
|
92
|
+
"nutjs",
|
|
93
|
+
"legacy"
|
|
94
|
+
],
|
|
95
|
+
"sensitive": false
|
|
90
96
|
}
|
|
91
97
|
}
|
|
92
98
|
},
|
|
93
99
|
"publishConfig": {
|
|
94
100
|
"access": "public"
|
|
95
|
-
},
|
|
96
|
-
"milaidy": {
|
|
97
|
-
"platforms": [
|
|
98
|
-
"node"
|
|
99
|
-
],
|
|
100
|
-
"runtime": "node",
|
|
101
|
-
"platformDetails": {
|
|
102
|
-
"node": "Node.js only (platform: node)"
|
|
103
|
-
}
|
|
104
101
|
}
|
|
105
102
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"click-coordinates.d.ts","sourceRoot":"","sources":["../../src/actions/click-coordinates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EAQP,MAAM,eAAe,CAAC;AAKvB,eAAO,MAAM,iCAAiC,EAAE,MA0F/C,CAAC"}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { logger } from "@elizaos/core";
|
|
2
|
-
import { getNumberParam, getStringParam } from "../utils/params.js";
|
|
3
|
-
export const computeruseClickCoordinatesAction = {
|
|
4
|
-
name: "COMPUTERUSE_CLICK_COORDINATES",
|
|
5
|
-
description: "Clicks at specific screen coordinates (x, y). Use for precise clicking at known positions.",
|
|
6
|
-
similes: ["CLICK_AT", "CLICK_POSITION", "CLICK_XY"],
|
|
7
|
-
parameters: [
|
|
8
|
-
{
|
|
9
|
-
name: "x",
|
|
10
|
-
description: "X coordinate to click at",
|
|
11
|
-
required: true,
|
|
12
|
-
schema: { type: "number" },
|
|
13
|
-
examples: [500, 960],
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
name: "y",
|
|
17
|
-
description: "Y coordinate to click at",
|
|
18
|
-
required: true,
|
|
19
|
-
schema: { type: "number" },
|
|
20
|
-
examples: [300, 540],
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
name: "button",
|
|
24
|
-
description: "Mouse button: 'left', 'right', or 'middle'. Default: 'left'",
|
|
25
|
-
required: false,
|
|
26
|
-
schema: { type: "string" },
|
|
27
|
-
examples: ["left", "right"],
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
name: "numClicks",
|
|
31
|
-
description: "Number of clicks (1=single, 2=double). Default: 1",
|
|
32
|
-
required: false,
|
|
33
|
-
schema: { type: "number", default: 1, minimum: 1, maximum: 3 },
|
|
34
|
-
examples: [1, 2],
|
|
35
|
-
},
|
|
36
|
-
],
|
|
37
|
-
validate: async (runtime, message) => {
|
|
38
|
-
const service = runtime.getService("computeruse");
|
|
39
|
-
return !!service && service.isEnabled();
|
|
40
|
-
},
|
|
41
|
-
handler: async (runtime, message, _state, options, callback) => {
|
|
42
|
-
const service = runtime.getService("computeruse");
|
|
43
|
-
if (!service) {
|
|
44
|
-
return { success: false, text: "ComputerUse service not available" };
|
|
45
|
-
}
|
|
46
|
-
const params = options?.parameters;
|
|
47
|
-
const x = getNumberParam(params, "x");
|
|
48
|
-
const y = getNumberParam(params, "y");
|
|
49
|
-
const button = getStringParam(params, "button") ?? "left";
|
|
50
|
-
const numClicks = getNumberParam(params, "numClicks") ?? 1;
|
|
51
|
-
if (x === undefined || y === undefined) {
|
|
52
|
-
return { success: false, text: "Missing required parameters: x and y" };
|
|
53
|
-
}
|
|
54
|
-
const backend = service.getBackendName();
|
|
55
|
-
try {
|
|
56
|
-
await service.clickCoordinates(x, y, button, numClicks);
|
|
57
|
-
const response = {
|
|
58
|
-
text: `Clicked at coordinates (${x}, ${y}) with ${button} button`,
|
|
59
|
-
actions: ["COMPUTERUSE_CLICK_COORDINATES"],
|
|
60
|
-
source: message.content?.source ?? "action",
|
|
61
|
-
};
|
|
62
|
-
await callback?.(response);
|
|
63
|
-
return {
|
|
64
|
-
success: true,
|
|
65
|
-
text: response.text ?? "",
|
|
66
|
-
values: { x, y, button, numClicks },
|
|
67
|
-
data: { x, y, button, numClicks, backend },
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
catch (err) {
|
|
71
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
72
|
-
logger.error(`[computeruse] click_coordinates failed: ${msg}`);
|
|
73
|
-
return {
|
|
74
|
-
success: false,
|
|
75
|
-
text: `ComputerUse click at coordinates failed: ${msg}`,
|
|
76
|
-
values: { x, y, button, numClicks },
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
//# sourceMappingURL=click-coordinates.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"click-coordinates.js","sourceRoot":"","sources":["../../src/actions/click-coordinates.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpE,MAAM,CAAC,MAAM,iCAAiC,GAAW;IACvD,IAAI,EAAE,+BAA+B;IACrC,WAAW,EACT,4FAA4F;IAC9F,OAAO,EAAE,CAAC,UAAU,EAAE,gBAAgB,EAAE,UAAU,CAAC;IACnD,UAAU,EAAE;QACV;YACE,IAAI,EAAE,GAAG;YACT,WAAW,EAAE,0BAA0B;YACvC,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC1B,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;SACrB;QACD;YACE,IAAI,EAAE,GAAG;YACT,WAAW,EAAE,0BAA0B;YACvC,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC1B,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;SACrB;QACD;YACE,IAA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AE,SAAS,EAAE;aACpC,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import type {\n Action,\n ActionResult,\n Content,\n HandlerCallback,\n HandlerOptions,\n IAgentRuntime,\n Memory,\n State,\n} from \"@elizaos/core\";\nimport { logger } from \"@elizaos/core\";\nimport type { ComputerUseService } from \"../services/computeruse-service.js\";\nimport { getNumberParam, getStringParam } from \"../utils/params.js\";\n\nexport const computeruseClickCoordinatesAction: Action = {\n name: \"COMPUTERUSE_CLICK_COORDINATES\",\n description:\n \"Clicks at specific screen coordinates (x, y). Use for precise clicking at known positions.\",\n similes: [\"CLICK_AT\", \"CLICK_POSITION\", \"CLICK_XY\"],\n parameters: [\n {\n name: \"x\",\n description: \"X coordinate to click at\",\n required: true,\n schema: { type: \"number\" },\n examples: [500, 960],\n },\n {\n name: \"y\",\n description: \"Y coordinate to click at\",\n required: true,\n schema: { type: \"number\" },\n examples: [300, 540],\n },\n {\n name: \"button\",\n description: \"Mouse button: 'left', 'right', or 'middle'. Default: 'left'\",\n required: false,\n schema: { type: \"string\" },\n examples: [\"left\", \"right\"],\n },\n {\n name: \"numClicks\",\n description: \"Number of clicks (1=single, 2=double). Default: 1\",\n required: false,\n schema: { type: \"number\", default: 1, minimum: 1, maximum: 3 },\n examples: [1, 2],\n },\n ],\n\n validate: async (runtime: IAgentRuntime, message: Memory): Promise<boolean> => {\n const service = runtime.getService<ComputerUseService>(\"computeruse\");\n return !!service && service.isEnabled();\n },\n\n handler: async (\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n options?: HandlerOptions,\n callback?: HandlerCallback\n ): Promise<ActionResult> => {\n const service = runtime.getService<ComputerUseService>(\"computeruse\");\n if (!service) {\n return { success: false, text: \"ComputerUse service not available\" };\n }\n\n const params = options?.parameters;\n const x = getNumberParam(params, \"x\");\n const y = getNumberParam(params, \"y\");\n const button = getStringParam(params, \"button\") ?? \"left\";\n const numClicks = getNumberParam(params, \"numClicks\") ?? 1;\n\n if (x === undefined || y === undefined) {\n return { success: false, text: \"Missing required parameters: x and y\" };\n }\n\n const backend = service.getBackendName();\n\n try {\n await service.clickCoordinates(x, y, button, numClicks);\n\n const response: Content = {\n text: `Clicked at coordinates (${x}, ${y}) with ${button} button`,\n actions: [\"COMPUTERUSE_CLICK_COORDINATES\"],\n source: message.content?.source ?? \"action\",\n };\n await callback?.(response);\n return {\n success: true,\n text: response.text ?? \"\",\n values: { x, y, button, numClicks },\n data: { x, y, button, numClicks, backend },\n };\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n logger.error(`[computeruse] click_coordinates failed: ${msg}`);\n return {\n success: false,\n text: `ComputerUse click at coordinates failed: ${msg}`,\n values: { x, y, button, numClicks },\n };\n }\n },\n};\n"]}
|
package/dist/actions/click.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"click.d.ts","sourceRoot":"","sources":["../../src/actions/click.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EAQP,MAAM,eAAe,CAAC;AAKvB,eAAO,MAAM,sBAAsB,EAAE,MAkFpC,CAAC"}
|
package/dist/actions/click.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { logger } from "@elizaos/core";
|
|
2
|
-
import { getNumberParam, getStringParam } from "../utils/params.js";
|
|
3
|
-
export const computeruseClickAction = {
|
|
4
|
-
name: "COMPUTERUSE_CLICK",
|
|
5
|
-
description: "Clicks a UI element on the computer using a ComputerUse selector.",
|
|
6
|
-
similes: ["CLICK_UI", "CLICK_ELEMENT", "TAP_UI"],
|
|
7
|
-
parameters: [
|
|
8
|
-
{
|
|
9
|
-
name: "process",
|
|
10
|
-
description: "Process name to scope the click when using MCP mode (e.g. 'chrome', 'notepad'). Optional if selector is prefixed with 'process:<name> >> ...'.",
|
|
11
|
-
required: false,
|
|
12
|
-
schema: { type: "string" },
|
|
13
|
-
examples: ["chrome", "notepad"],
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
name: "selector",
|
|
17
|
-
description: "ComputerUse selector string for the target element",
|
|
18
|
-
required: true,
|
|
19
|
-
schema: { type: "string" },
|
|
20
|
-
examples: ["role:Button && name:Submit", "role:Edit && name:Search"],
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
name: "timeoutMs",
|
|
24
|
-
description: "Timeout in milliseconds to find the element",
|
|
25
|
-
required: false,
|
|
26
|
-
schema: { type: "number", default: 5000, minimum: 0 },
|
|
27
|
-
examples: [5000],
|
|
28
|
-
},
|
|
29
|
-
],
|
|
30
|
-
validate: async (runtime, message) => {
|
|
31
|
-
const service = runtime.getService("computeruse");
|
|
32
|
-
if (!service || !service.isEnabled())
|
|
33
|
-
return false;
|
|
34
|
-
const text = message.content?.text?.toLowerCase() ?? "";
|
|
35
|
-
return text.includes("click") || text.includes("tap");
|
|
36
|
-
},
|
|
37
|
-
handler: async (runtime, message, _state, options, callback) => {
|
|
38
|
-
const service = runtime.getService("computeruse");
|
|
39
|
-
if (!service) {
|
|
40
|
-
return { success: false, text: "ComputerUse service not available" };
|
|
41
|
-
}
|
|
42
|
-
const params = options?.parameters;
|
|
43
|
-
const process = getStringParam(params, "process");
|
|
44
|
-
const selector = getStringParam(params, "selector");
|
|
45
|
-
const timeoutMs = getNumberParam(params, "timeoutMs") ?? 5000;
|
|
46
|
-
if (!selector) {
|
|
47
|
-
return { success: false, text: "Missing required parameter: selector" };
|
|
48
|
-
}
|
|
49
|
-
try {
|
|
50
|
-
await service.click(selector, timeoutMs, process);
|
|
51
|
-
const response = {
|
|
52
|
-
text: `Clicked element: ${selector}`,
|
|
53
|
-
actions: ["COMPUTERUSE_CLICK"],
|
|
54
|
-
source: message.content?.source ?? "action",
|
|
55
|
-
};
|
|
56
|
-
await callback?.(response);
|
|
57
|
-
return {
|
|
58
|
-
success: true,
|
|
59
|
-
text: response.text ?? "",
|
|
60
|
-
values: { process, selector, timeoutMs },
|
|
61
|
-
data: { process, selector, timeoutMs, backend: service.getBackendName() },
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
catch (err) {
|
|
65
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
66
|
-
logger.error(`[computeruse] click failed: ${msg}`);
|
|
67
|
-
return {
|
|
68
|
-
success: false,
|
|
69
|
-
text: `ComputerUse click failed: ${msg}`,
|
|
70
|
-
values: { process, selector, timeoutMs },
|
|
71
|
-
data: { process, selector, timeoutMs, backend: service.getBackendName() },
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
};
|
|
76
|
-
//# sourceMappingURL=click.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"click.js","sourceRoot":"","sources":["../../src/actions/click.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpE,MAAM,CAAC,MAAM,sBAAsB,GAAW;IAC5C,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,mEAAmE;IAChF,OAAO,EAAE,CAAC,UAAU,EAAE,eAAe,EAAE,QAAQ,CAAC;IAChD,UAAU,EAAE;QACV;YACE,IAAI,EAAE,SAAS;YACf,WAAW,EACT,gJAAgJ;YAClJ,QAAQ,EAAE,KAAK;YACf,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC1B,QAAQ,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;SAChC;QACD;YACE,IAAI,EAAE,UAAU;YAChB,WAAW,EAAE,oDAAoD;YACjE,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC1B,QAAQ,EAAE,CAAC,4BAA4B,EAAE,0BAA0B,CAAC;SACrE;QACD;YACE,IAAI,EAAE,WAAW;YACjB,WAAW,EAAE,6CAA6C;YAC1D,QAAQ,EAAE,KAAK;YACf,MAAM,EAAE,EAAE,IAAI,EA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CAAC,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;YAClD,MAAM,QAAQ,GAAY;gBACxB,IAAI,EAAE,oBAAoB,QAAQ,EAAE;gBACpC,OAAO,EAAE,CAAC,mBAAmB,CAAC;gBAC9B,MAAM,EAAE,OAAO,CAAC,OAAO,EAAE,MAAM,IAAI,QAAQ;aAC5C,CAAC;YACF,MAAM,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC;YAC3B,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,IAAI,EAAE,QAAQ,CAAC,IAAI,IAAI,EAAE;gBACzB,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE;gBACxC,IAAI,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,cAAc,EAAE,EAAE;aAC1E,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC7D,MAAM,CAAC,KAAK,CAAC,+BAA+B,GAAG,EAAE,CAAC,CAAC;YACnD,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,6BAA6B,GAAG,EAAE;gBACxC,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE;gBACxC,IAAI,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,cAAc,EAAE,EAAE;aAC1E,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import type {\n Action,\n ActionResult,\n Content,\n HandlerCallback,\n HandlerOptions,\n IAgentRuntime,\n Memory,\n State,\n} from \"@elizaos/core\";\nimport { logger } from \"@elizaos/core\";\nimport type { ComputerUseService } from \"../services/computeruse-service.js\";\nimport { getNumberParam, getStringParam } from \"../utils/params.js\";\n\nexport const computeruseClickAction: Action = {\n name: \"COMPUTERUSE_CLICK\",\n description: \"Clicks a UI element on the computer using a ComputerUse selector.\",\n similes: [\"CLICK_UI\", \"CLICK_ELEMENT\", \"TAP_UI\"],\n parameters: [\n {\n name: \"process\",\n description:\n \"Process name to scope the click when using MCP mode (e.g. 'chrome', 'notepad'). Optional if selector is prefixed with 'process:<name> >> ...'.\",\n required: false,\n schema: { type: \"string\" },\n examples: [\"chrome\", \"notepad\"],\n },\n {\n name: \"selector\",\n description: \"ComputerUse selector string for the target element\",\n required: true,\n schema: { type: \"string\" },\n examples: [\"role:Button && name:Submit\", \"role:Edit && name:Search\"],\n },\n {\n name: \"timeoutMs\",\n description: \"Timeout in milliseconds to find the element\",\n required: false,\n schema: { type: \"number\", default: 5000, minimum: 0 },\n examples: [5000],\n },\n ],\n\n validate: async (runtime: IAgentRuntime, message: Memory): Promise<boolean> => {\n const service = runtime.getService<ComputerUseService>(\"computeruse\");\n if (!service || !service.isEnabled()) return false;\n\n const text = message.content?.text?.toLowerCase() ?? \"\";\n return text.includes(\"click\") || text.includes(\"tap\");\n },\n\n handler: async (\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n options?: HandlerOptions,\n callback?: HandlerCallback\n ): Promise<ActionResult> => {\n const service = runtime.getService<ComputerUseService>(\"computeruse\");\n if (!service) {\n return { success: false, text: \"ComputerUse service not available\" };\n }\n\n const params = options?.parameters;\n const process = getStringParam(params, \"process\");\n const selector = getStringParam(params, \"selector\");\n const timeoutMs = getNumberParam(params, \"timeoutMs\") ?? 5000;\n if (!selector) {\n return { success: false, text: \"Missing required parameter: selector\" };\n }\n\n try {\n await service.click(selector, timeoutMs, process);\n const response: Content = {\n text: `Clicked element: ${selector}`,\n actions: [\"COMPUTERUSE_CLICK\"],\n source: message.content?.source ?? \"action\",\n };\n await callback?.(response);\n return {\n success: true,\n text: response.text ?? \"\",\n values: { process, selector, timeoutMs },\n data: { process, selector, timeoutMs, backend: service.getBackendName() },\n };\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n logger.error(`[computeruse] click failed: ${msg}`);\n return {\n success: false,\n text: `ComputerUse click failed: ${msg}`,\n values: { process, selector, timeoutMs },\n data: { process, selector, timeoutMs, backend: service.getBackendName() },\n };\n }\n },\n};\n"]}
|
package/dist/actions/drag.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"drag.d.ts","sourceRoot":"","sources":["../../src/actions/drag.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EAQP,MAAM,eAAe,CAAC;AAKvB,eAAO,MAAM,qBAAqB,EAAE,MAkGnC,CAAC"}
|
package/dist/actions/drag.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { logger } from "@elizaos/core";
|
|
2
|
-
import { getNumberParam } from "../utils/params.js";
|
|
3
|
-
export const computeruseDragAction = {
|
|
4
|
-
name: "COMPUTERUSE_DRAG",
|
|
5
|
-
description: "Drag the mouse from one position to another. Use for drag-and-drop, resizing, selecting, sliders.",
|
|
6
|
-
similes: ["DRAG", "DRAG_AND_DROP", "MOUSE_DRAG"],
|
|
7
|
-
parameters: [
|
|
8
|
-
{
|
|
9
|
-
name: "startX",
|
|
10
|
-
description: "Starting X coordinate",
|
|
11
|
-
required: true,
|
|
12
|
-
schema: { type: "number" },
|
|
13
|
-
examples: [100],
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
name: "startY",
|
|
17
|
-
description: "Starting Y coordinate",
|
|
18
|
-
required: true,
|
|
19
|
-
schema: { type: "number" },
|
|
20
|
-
examples: [200],
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
name: "endX",
|
|
24
|
-
description: "Ending X coordinate",
|
|
25
|
-
required: true,
|
|
26
|
-
schema: { type: "number" },
|
|
27
|
-
examples: [500],
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
name: "endY",
|
|
31
|
-
description: "Ending Y coordinate",
|
|
32
|
-
required: true,
|
|
33
|
-
schema: { type: "number" },
|
|
34
|
-
examples: [200],
|
|
35
|
-
},
|
|
36
|
-
],
|
|
37
|
-
validate: async (runtime, message) => {
|
|
38
|
-
const service = runtime.getService("computeruse");
|
|
39
|
-
return !!service && service.isEnabled();
|
|
40
|
-
},
|
|
41
|
-
handler: async (runtime, message, _state, options, callback) => {
|
|
42
|
-
const service = runtime.getService("computeruse");
|
|
43
|
-
if (!service) {
|
|
44
|
-
return { success: false, text: "ComputerUse service not available" };
|
|
45
|
-
}
|
|
46
|
-
const params = options?.parameters;
|
|
47
|
-
const startX = getNumberParam(params, "startX");
|
|
48
|
-
const startY = getNumberParam(params, "startY");
|
|
49
|
-
const endX = getNumberParam(params, "endX");
|
|
50
|
-
const endY = getNumberParam(params, "endY");
|
|
51
|
-
if (startX === undefined ||
|
|
52
|
-
startY === undefined ||
|
|
53
|
-
endX === undefined ||
|
|
54
|
-
endY === undefined) {
|
|
55
|
-
return {
|
|
56
|
-
success: false,
|
|
57
|
-
text: "Missing required parameters: startX, startY, endX, endY",
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
const backend = service.getBackendName();
|
|
61
|
-
try {
|
|
62
|
-
await service.drag(startX, startY, endX, endY);
|
|
63
|
-
const response = {
|
|
64
|
-
text: `Dragged from (${startX}, ${startY}) to (${endX}, ${endY})`,
|
|
65
|
-
actions: ["COMPUTERUSE_DRAG"],
|
|
66
|
-
source: message.content?.source ?? "action",
|
|
67
|
-
};
|
|
68
|
-
await callback?.(response);
|
|
69
|
-
return {
|
|
70
|
-
success: true,
|
|
71
|
-
text: response.text ?? "",
|
|
72
|
-
values: { startX, startY, endX, endY },
|
|
73
|
-
data: { startX, startY, endX, endY, backend },
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
catch (err) {
|
|
77
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
78
|
-
logger.error(`[computeruse] drag failed: ${msg}`);
|
|
79
|
-
return {
|
|
80
|
-
success: false,
|
|
81
|
-
text: `ComputerUse drag failed: ${msg}`,
|
|
82
|
-
values: { startX, startY, endX, endY },
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
};
|
|
87
|
-
//# sourceMappingURL=drag.js.map
|
package/dist/actions/drag.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"drag.js","sourceRoot":"","sources":["../../src/actions/drag.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,MAAM,CAAC,MAAM,qBAAqB,GAAW;IAC3C,IAAI,EAAE,kBAAkB;IACxB,WAAW,EACT,mGAAmG;IACrG,OAAO,EAAE,CAAC,MAAM,EAAE,eAAe,EAAE,YAAY,CAAC;IAChD,UAAU,EAAE;QACV;YACE,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,uBAAuB;YACpC,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC1B,QAAQ,EAAE,CAAC,GAAG,CAAC;SAChB;QACD;YACE,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,uBAAuB;YACpC,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC1B,QAAQ,EAAE,CAAC,GAAG,CAAC;SAChB;QACD;YACE,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,qBAAqB;YAClC,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC1B,QAAQ,EAAE,CAAC,GAAG,CAAC;SAChB;QACD;YACE,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,qBAAqB;YAClC,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ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/C,MAAM,QAAQ,GAAY;gBACxB,IAAI,EAAE,iBAAiB,MAAM,KAAK,MAAM,SAAS,IAAI,KAAK,IAAI,GAAG;gBACjE,OAAO,EAAE,CAAC,kBAAkB,CAAC;gBAC7B,MAAM,EAAE,OAAO,CAAC,OAAO,EAAE,MAAM,IAAI,QAAQ;aAC5C,CAAC;YACF,MAAM,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC;YAC3B,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,IAAI,EAAE,QAAQ,CAAC,IAAI,IAAI,EAAE;gBACzB,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE;gBACtC,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE;aAC9C,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC7D,MAAM,CAAC,KAAK,CAAC,8BAA8B,GAAG,EAAE,CAAC,CAAC;YAClD,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,4BAA4B,GAAG,EAAE;gBACvC,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE;aACvC,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import type {\n Action,\n ActionResult,\n Content,\n HandlerCallback,\n HandlerOptions,\n IAgentRuntime,\n Memory,\n State,\n} from \"@elizaos/core\";\nimport { logger } from \"@elizaos/core\";\nimport type { ComputerUseService } from \"../services/computeruse-service.js\";\nimport { getNumberParam } from \"../utils/params.js\";\n\nexport const computeruseDragAction: Action = {\n name: \"COMPUTERUSE_DRAG\",\n description:\n \"Drag the mouse from one position to another. Use for drag-and-drop, resizing, selecting, sliders.\",\n similes: [\"DRAG\", \"DRAG_AND_DROP\", \"MOUSE_DRAG\"],\n parameters: [\n {\n name: \"startX\",\n description: \"Starting X coordinate\",\n required: true,\n schema: { type: \"number\" },\n examples: [100],\n },\n {\n name: \"startY\",\n description: \"Starting Y coordinate\",\n required: true,\n schema: { type: \"number\" },\n examples: [200],\n },\n {\n name: \"endX\",\n description: \"Ending X coordinate\",\n required: true,\n schema: { type: \"number\" },\n examples: [500],\n },\n {\n name: \"endY\",\n description: \"Ending Y coordinate\",\n required: true,\n schema: { type: \"number\" },\n examples: [200],\n },\n ],\n\n validate: async (runtime: IAgentRuntime, message: Memory): Promise<boolean> => {\n const service = runtime.getService<ComputerUseService>(\"computeruse\");\n return !!service && service.isEnabled();\n },\n\n handler: async (\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n options?: HandlerOptions,\n callback?: HandlerCallback\n ): Promise<ActionResult> => {\n const service = runtime.getService<ComputerUseService>(\"computeruse\");\n if (!service) {\n return { success: false, text: \"ComputerUse service not available\" };\n }\n\n const params = options?.parameters;\n const startX = getNumberParam(params, \"startX\");\n const startY = getNumberParam(params, \"startY\");\n const endX = getNumberParam(params, \"endX\");\n const endY = getNumberParam(params, \"endY\");\n\n if (\n startX === undefined ||\n startY === undefined ||\n endX === undefined ||\n endY === undefined\n ) {\n return {\n success: false,\n text: \"Missing required parameters: startX, startY, endX, endY\",\n };\n }\n\n const backend = service.getBackendName();\n\n try {\n await service.drag(startX, startY, endX, endY);\n\n const response: Content = {\n text: `Dragged from (${startX}, ${startY}) to (${endX}, ${endY})`,\n actions: [\"COMPUTERUSE_DRAG\"],\n source: message.content?.source ?? \"action\",\n };\n await callback?.(response);\n return {\n success: true,\n text: response.text ?? \"\",\n values: { startX, startY, endX, endY },\n data: { startX, startY, endX, endY, backend },\n };\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n logger.error(`[computeruse] drag failed: ${msg}`);\n return {\n success: false,\n text: `ComputerUse drag failed: ${msg}`,\n values: { startX, startY, endX, endY },\n };\n }\n },\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-applications.d.ts","sourceRoot":"","sources":["../../src/actions/get-applications.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EAQP,MAAM,eAAe,CAAC;AAIvB,eAAO,MAAM,gCAAgC,EAAE,MA8C9C,CAAC"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { logger } from "@elizaos/core";
|
|
2
|
-
export const computeruseGetApplicationsAction = {
|
|
3
|
-
name: "COMPUTERUSE_GET_APPLICATIONS",
|
|
4
|
-
description: "Lists currently running applications on the target machine.",
|
|
5
|
-
similes: ["LIST_APPS", "LIST_APPLICATIONS", "SHOW_RUNNING_APPS"],
|
|
6
|
-
validate: async (runtime, message) => {
|
|
7
|
-
const service = runtime.getService("computeruse");
|
|
8
|
-
if (!service || !service.isEnabled())
|
|
9
|
-
return false;
|
|
10
|
-
const text = message.content?.text?.toLowerCase() ?? "";
|
|
11
|
-
return text.includes("applications") || text.includes("apps") || text.includes("running");
|
|
12
|
-
},
|
|
13
|
-
handler: async (runtime, message, _state, _options, callback) => {
|
|
14
|
-
const service = runtime.getService("computeruse");
|
|
15
|
-
if (!service)
|
|
16
|
-
return { success: false, text: "ComputerUse service not available" };
|
|
17
|
-
try {
|
|
18
|
-
const apps = await service.getApplications();
|
|
19
|
-
const text = Array.isArray(apps)
|
|
20
|
-
? `Applications:\n${apps.map((a) => `- ${a}`).join("\n")}`
|
|
21
|
-
: "Applications: (see output)";
|
|
22
|
-
const response = {
|
|
23
|
-
text,
|
|
24
|
-
actions: ["COMPUTERUSE_GET_APPLICATIONS"],
|
|
25
|
-
source: message.content?.source ?? "action",
|
|
26
|
-
};
|
|
27
|
-
await callback?.(response);
|
|
28
|
-
return {
|
|
29
|
-
success: true,
|
|
30
|
-
text,
|
|
31
|
-
values: { count: apps.length },
|
|
32
|
-
data: { apps, backend: service.getBackendName() },
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
catch (err) {
|
|
36
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
37
|
-
logger.error(`[computeruse] get applications failed: ${msg}`);
|
|
38
|
-
return { success: false, text: `ComputerUse get applications failed: ${msg}` };
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
//# sourceMappingURL=get-applications.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-applications.js","sourceRoot":"","sources":["../../src/actions/get-applications.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAGvC,MAAM,CAAC,MAAM,gCAAgC,GAAW;IACtD,IAAI,EAAE,8BAA8B;IACpC,WAAW,EAAE,6DAA6D;IAC1E,OAAO,EAAE,CAAC,WAAW,EAAE,mBAAmB,EAAE,mBAAmB,CAAC;IAEhE,QAAQ,EAAE,KAAK,EAAE,OAAsB,EAAE,OAAe,EAAoB,EAAE;QAC5E,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAqB,aAAa,CAAC,CAAC;QACtE,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE;YAAE,OAAO,KAAK,CAAC;QAEnD,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;QACxD,OAAO,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC5F,CAAC;IAED,OAAO,EAAE,KAAK,EACZ,OAAsB,EACtB,OAAe,EACf,MAAc,EACd,QAAyB,EACzB,QAA0B,EACH,EAAE;QACzB,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAqB,aAAa,CAAC,CAAC;QACtE,IAAI,CAAC,OAAO;YAAE,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} from \"@elizaos/core\";\nimport { logger } from \"@elizaos/core\";\nimport type { ComputerUseService } from \"../services/computeruse-service.js\";\n\nexport const computeruseGetApplicationsAction: Action = {\n name: \"COMPUTERUSE_GET_APPLICATIONS\",\n description: \"Lists currently running applications on the target machine.\",\n similes: [\"LIST_APPS\", \"LIST_APPLICATIONS\", \"SHOW_RUNNING_APPS\"],\n\n validate: async (runtime: IAgentRuntime, message: Memory): Promise<boolean> => {\n const service = runtime.getService<ComputerUseService>(\"computeruse\");\n if (!service || !service.isEnabled()) return false;\n\n const text = message.content?.text?.toLowerCase() ?? \"\";\n return text.includes(\"applications\") || text.includes(\"apps\") || text.includes(\"running\");\n },\n\n handler: async (\n runtime: IAgentRuntime,\n message: Memory,\n _state?: State,\n _options?: HandlerOptions,\n callback?: HandlerCallback\n ): Promise<ActionResult> => {\n const service = runtime.getService<ComputerUseService>(\"computeruse\");\n if (!service) return { success: false, text: \"ComputerUse service not available\" };\n\n try {\n const apps = await service.getApplications();\n const text = Array.isArray(apps)\n ? `Applications:\\n${apps.map((a) => `- ${a}`).join(\"\\n\")}`\n : \"Applications: (see output)\";\n const response: Content = {\n text,\n actions: [\"COMPUTERUSE_GET_APPLICATIONS\"],\n source: message.content?.source ?? \"action\",\n };\n await callback?.(response);\n return {\n success: true,\n text,\n values: { count: apps.length },\n data: { apps, backend: service.getBackendName() },\n };\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n logger.error(`[computeruse] get applications failed: ${msg}`);\n return { success: false, text: `ComputerUse get applications failed: ${msg}` };\n }\n },\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-window-tree.d.ts","sourceRoot":"","sources":["../../src/actions/get-window-tree.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EAQP,MAAM,eAAe,CAAC;AAKvB,eAAO,MAAM,8BAA8B,EAAE,MA8E5C,CAAC"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { logger } from "@elizaos/core";
|
|
2
|
-
import { getNumberParam, getStringParam } from "../utils/params.js";
|
|
3
|
-
export const computeruseGetWindowTreeAction = {
|
|
4
|
-
name: "COMPUTERUSE_GET_WINDOW_TREE",
|
|
5
|
-
description: "Gets the UI tree for a running application (useful for understanding what is currently on screen).",
|
|
6
|
-
similes: ["GET_UI_TREE", "WINDOW_TREE", "DUMP_UI_TREE"],
|
|
7
|
-
parameters: [
|
|
8
|
-
{
|
|
9
|
-
name: "process",
|
|
10
|
-
description: "Process name of the target application (e.g. 'chrome', 'notepad')",
|
|
11
|
-
required: true,
|
|
12
|
-
schema: { type: "string" },
|
|
13
|
-
examples: ["chrome", "notepad"],
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
name: "title",
|
|
17
|
-
description: "Optional window title filter",
|
|
18
|
-
required: false,
|
|
19
|
-
schema: { type: "string" },
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
name: "maxDepth",
|
|
23
|
-
description: "Optional max tree depth (MCP mode only)",
|
|
24
|
-
required: false,
|
|
25
|
-
schema: { type: "number", minimum: 0 },
|
|
26
|
-
examples: [6],
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
validate: async (runtime, message) => {
|
|
30
|
-
const service = runtime.getService("computeruse");
|
|
31
|
-
if (!service || !service.isEnabled())
|
|
32
|
-
return false;
|
|
33
|
-
const text = message.content?.text?.toLowerCase() ?? "";
|
|
34
|
-
return text.includes("window tree") || text.includes("ui tree") || text.includes("dump tree");
|
|
35
|
-
},
|
|
36
|
-
handler: async (runtime, message, _state, options, callback) => {
|
|
37
|
-
const service = runtime.getService("computeruse");
|
|
38
|
-
if (!service)
|
|
39
|
-
return { success: false, text: "ComputerUse service not available" };
|
|
40
|
-
const params = options?.parameters;
|
|
41
|
-
const process = getStringParam(params, "process");
|
|
42
|
-
const title = getStringParam(params, "title");
|
|
43
|
-
const maxDepth = getNumberParam(params, "maxDepth");
|
|
44
|
-
if (!process)
|
|
45
|
-
return { success: false, text: "Missing required parameter: process" };
|
|
46
|
-
try {
|
|
47
|
-
const treeText = await service.getWindowTree(process, title, maxDepth);
|
|
48
|
-
const response = {
|
|
49
|
-
text: treeText.length > 0 ? treeText : "(empty tree result)",
|
|
50
|
-
actions: ["COMPUTERUSE_GET_WINDOW_TREE"],
|
|
51
|
-
source: message.content?.source ?? "action",
|
|
52
|
-
};
|
|
53
|
-
await callback?.(response);
|
|
54
|
-
return {
|
|
55
|
-
success: true,
|
|
56
|
-
text: response.text ?? "",
|
|
57
|
-
values: { process, title, maxDepth },
|
|
58
|
-
data: { process, title, maxDepth, backend: service.getBackendName() },
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
catch (err) {
|
|
62
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
63
|
-
logger.error(`[computeruse] get window tree failed: ${msg}`);
|
|
64
|
-
return {
|
|
65
|
-
success: false,
|
|
66
|
-
text: `ComputerUse get window tree failed: ${msg}`,
|
|
67
|
-
values: { process, title, maxDepth },
|
|
68
|
-
data: { process, title, maxDepth, backend: service.getBackendName() },
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
//# sourceMappingURL=get-window-tree.js.map
|