@elizaos/plugin-computeruse 2.0.0-alpha.9 → 2.0.11-beta.7
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/LICENSE +21 -0
- package/README.md +80 -0
- package/package.json +126 -103
- 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 -139
- 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 -144
- 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 -145
- 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 -105
- 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 -133
- 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 -117
- 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 -115
- 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 -99
- 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 -137
- 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 -163
- package/dist/actions/type.js.map +0 -1
- package/dist/index.d.ts +0 -8
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -66
- package/dist/index.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 -28
- 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 -36
- 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 -391
- package/dist/services/computeruse-service.js.map +0 -1
- package/dist/types.d.ts +0 -41
- package/dist/types.d.ts.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/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Shaw Walters and elizaOS Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# `@elizaos/plugin-computeruse`
|
|
2
|
+
|
|
3
|
+
Desktop automation plugin for elizaOS agents — screenshots, mouse /
|
|
4
|
+
keyboard control, browser CDP automation, window management, clipboard,
|
|
5
|
+
and the OCR provider registry that other plugins contribute to.
|
|
6
|
+
|
|
7
|
+
Ported from
|
|
8
|
+
[`coasty-ai/open-computer-use`](https://github.com/coasty-ai/open-computer-use)
|
|
9
|
+
(Apache 2.0).
|
|
10
|
+
|
|
11
|
+
## Boundary with `@elizaos/plugin-vision`
|
|
12
|
+
|
|
13
|
+
This plugin owns the OS surfaces:
|
|
14
|
+
|
|
15
|
+
- screen / display capture (`src/platform/capture.ts`,
|
|
16
|
+
`src/platform/displays.ts`,
|
|
17
|
+
`ComputerUseService.captureScreen()`),
|
|
18
|
+
- input + windows + clipboard + accessibility,
|
|
19
|
+
- the OCR provider registries — `OcrProvider` (line-level) and
|
|
20
|
+
`CoordOcrProvider` (hierarchical with absolute coords), defined in
|
|
21
|
+
`src/mobile/ocr-provider.ts`.
|
|
22
|
+
|
|
23
|
+
`@elizaos/plugin-vision` owns the camera pipeline, scene description
|
|
24
|
+
via `runtime.useModel(IMAGE_DESCRIPTION)`, the screen tiler, the
|
|
25
|
+
detector pipeline (faces / people / objects), and the OCR
|
|
26
|
+
implementations themselves. plugin-vision *consumes* capture from this
|
|
27
|
+
plugin via `runtime.getService("computeruse")` and *contributes* the
|
|
28
|
+
hierarchical OCR adapter into this plugin's `registerCoordOcrProvider`
|
|
29
|
+
seam at boot.
|
|
30
|
+
|
|
31
|
+
Both seams are runtime feature-detected — neither package depends on
|
|
32
|
+
the other.
|
|
33
|
+
|
|
34
|
+
## Enabling
|
|
35
|
+
|
|
36
|
+
- Config: `features.computeruse: true`
|
|
37
|
+
- Env: `COMPUTER_USE_ENABLED=1`
|
|
38
|
+
|
|
39
|
+
## Platform requirements
|
|
40
|
+
|
|
41
|
+
| OS | Capture | Input |
|
|
42
|
+
|----|---------|-------|
|
|
43
|
+
| macOS | `screencapture` (built-in) | `cliclick` (`brew install cliclick`), AppleScript |
|
|
44
|
+
| Linux | `import` (ImageMagick) / `scrot` | `xdotool` (`sudo apt install xdotool`) |
|
|
45
|
+
| Windows | PowerShell + `System.Drawing` | PowerShell |
|
|
46
|
+
| Browser | — | `puppeteer-core` + Chrome / Edge / Brave |
|
|
47
|
+
|
|
48
|
+
## Surface
|
|
49
|
+
|
|
50
|
+
- **Actions** — `COMPUTER_USE` (canonical screenshot / click / key /
|
|
51
|
+
scroll / etc.), `WINDOW` (list / focus / arrange / move /...), and
|
|
52
|
+
`COMPUTER_USE_AGENT` (high-level goal-driven autonomous desktop loop:
|
|
53
|
+
Brain → Cascade → dispatch up to `maxSteps` iterations).
|
|
54
|
+
Subactions of `COMPUTER_USE` and `WINDOW` are promoted to virtual
|
|
55
|
+
top-level actions (e.g. `COMPUTER_USE_CLICK`, `WINDOW_FOCUS`) so the
|
|
56
|
+
planner picks a specific verb directly from the catalogue.
|
|
57
|
+
- **Services** — `ComputerUseService` (`serviceType = "computeruse"`)
|
|
58
|
+
and `VisionContextProvider`.
|
|
59
|
+
- **Providers** — `computerStateProvider`, `sceneProvider`.
|
|
60
|
+
- **Routes** — approval inbox + SSE stream + approval-mode toggle under
|
|
61
|
+
`/api/computer-use/...`.
|
|
62
|
+
|
|
63
|
+
## File operations + shell
|
|
64
|
+
|
|
65
|
+
File operations live on the FILE action; shell / terminal access lives
|
|
66
|
+
on the SHELL action. They are **not** exposed by this plugin.
|
|
67
|
+
|
|
68
|
+
## Further reading
|
|
69
|
+
|
|
70
|
+
- [`docs/MULTI_MONITOR.md`](./docs/MULTI_MONITOR.md) — multi-display
|
|
71
|
+
capture and coordinate translation.
|
|
72
|
+
- [`docs/SCENE_BUILDER.md`](./docs/SCENE_BUILDER.md) — how windows,
|
|
73
|
+
a11y, screen, and OCR are composed into a single `Scene`.
|
|
74
|
+
- [`docs/IOS_CONSTRAINTS.md`](./docs/IOS_CONSTRAINTS.md) /
|
|
75
|
+
[`docs/ANDROID_CONSTRAINTS.md`](./docs/ANDROID_CONSTRAINTS.md) —
|
|
76
|
+
honest scope on mobile.
|
|
77
|
+
- [`docs/MOBILE_ASSISTANT_ROUTING.md`](./docs/MOBILE_ASSISTANT_ROUTING.md)
|
|
78
|
+
— mobile request routing.
|
|
79
|
+
- [`docs/AOSP_SYSTEM_APP.md`](./docs/AOSP_SYSTEM_APP.md) — AOSP
|
|
80
|
+
system-app deployment notes.
|
package/package.json
CHANGED
|
@@ -1,105 +1,128 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
2
|
+
"name": "@elizaos/plugin-computeruse",
|
|
3
|
+
"version": "2.0.11-beta.7",
|
|
4
|
+
"description": "Desktop automation plugin — screenshots, mouse/keyboard control, browser CDP, and window management for elizaOS agents. Ported from open-computer-use (Apache 2.0).",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"module": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
"./package.json": "./package.json",
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"eliza-source": {
|
|
14
|
+
"types": "./src/index.ts",
|
|
15
|
+
"import": "./src/index.ts",
|
|
16
|
+
"default": "./src/index.ts"
|
|
17
|
+
},
|
|
18
|
+
"import": "./dist/index.js",
|
|
19
|
+
"default": "./dist/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./*.css": "./dist/*.css",
|
|
22
|
+
"./*": {
|
|
23
|
+
"types": "./dist/*.d.ts",
|
|
24
|
+
"eliza-source": {
|
|
25
|
+
"types": "./src/*.ts",
|
|
26
|
+
"import": "./src/*.ts",
|
|
27
|
+
"default": "./src/*.ts"
|
|
28
|
+
},
|
|
29
|
+
"import": "./dist/*.js",
|
|
30
|
+
"default": "./dist/*.js"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"dist",
|
|
35
|
+
"README.md",
|
|
36
|
+
"package.json"
|
|
37
|
+
],
|
|
38
|
+
"scripts": {
|
|
39
|
+
"postinstall": "node scripts/ensure-platform-deps.mjs",
|
|
40
|
+
"build": "bun run build.ts",
|
|
41
|
+
"test": "vitest run --config vitest.config.ts",
|
|
42
|
+
"typecheck": "tsgo --noEmit",
|
|
43
|
+
"validate:ios-device-evidence": "node scripts/validate-ios-device-evidence.mjs"
|
|
44
|
+
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"@elizaos/core": "2.0.11-beta.7"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@elizaos/core": "2.0.11-beta.7",
|
|
50
|
+
"@types/node": "^25.2.3",
|
|
51
|
+
"bun-types": "^1.3.14",
|
|
52
|
+
"typescript": "^6.0.3",
|
|
53
|
+
"vitest": "4.1.9"
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"@nut-tree-fork/nut-js": "^4.2.6",
|
|
57
|
+
"puppeteer-core": "^24.9.0"
|
|
58
|
+
},
|
|
59
|
+
"license": "Apache-2.0",
|
|
60
|
+
"agentConfig": {
|
|
61
|
+
"pluginType": "elizaos:plugin:1.0.0",
|
|
62
|
+
"pluginParameters": {
|
|
63
|
+
"COMPUTER_USE_ENABLED": {
|
|
64
|
+
"type": "boolean",
|
|
65
|
+
"description": "Enable computer use capabilities (desktop automation, screenshots, browser control)",
|
|
66
|
+
"required": false,
|
|
67
|
+
"default": false,
|
|
68
|
+
"sensitive": false
|
|
69
|
+
},
|
|
70
|
+
"COMPUTER_USE_SCREENSHOT_AFTER_ACTION": {
|
|
71
|
+
"type": "boolean",
|
|
72
|
+
"description": "Automatically capture a screenshot after each desktop action",
|
|
73
|
+
"required": false,
|
|
74
|
+
"default": true,
|
|
75
|
+
"sensitive": false
|
|
76
|
+
},
|
|
77
|
+
"COMPUTER_USE_ACTION_TIMEOUT_MS": {
|
|
78
|
+
"type": "number",
|
|
79
|
+
"description": "Maximum action execution timeout in milliseconds",
|
|
80
|
+
"required": false,
|
|
81
|
+
"default": 10000,
|
|
82
|
+
"sensitive": false
|
|
83
|
+
},
|
|
84
|
+
"COMPUTER_USE_APPROVAL_MODE": {
|
|
85
|
+
"type": "string",
|
|
86
|
+
"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.",
|
|
87
|
+
"required": false,
|
|
88
|
+
"default": "smart_approve",
|
|
89
|
+
"enum": [
|
|
90
|
+
"full_control",
|
|
91
|
+
"smart_approve",
|
|
92
|
+
"approve_all",
|
|
93
|
+
"off"
|
|
94
|
+
],
|
|
95
|
+
"sensitive": false
|
|
96
|
+
},
|
|
97
|
+
"COMPUTER_USE_BROWSER_HEADLESS": {
|
|
98
|
+
"type": "boolean",
|
|
99
|
+
"description": "Run browser automation headlessly. Useful for CI and test environments without a visible desktop session.",
|
|
100
|
+
"required": false,
|
|
101
|
+
"default": false,
|
|
102
|
+
"sensitive": false
|
|
103
|
+
},
|
|
104
|
+
"ELIZA_COMPUTERUSE_DRIVER": {
|
|
105
|
+
"type": "string",
|
|
106
|
+
"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).",
|
|
107
|
+
"required": false,
|
|
108
|
+
"default": "nutjs",
|
|
109
|
+
"enum": [
|
|
110
|
+
"nutjs",
|
|
111
|
+
"legacy"
|
|
112
|
+
],
|
|
113
|
+
"sensitive": false
|
|
114
|
+
},
|
|
115
|
+
"BROWSER_EXECUTE_DISABLED": {
|
|
116
|
+
"type": "boolean",
|
|
117
|
+
"description": "browser_execute / executeBrowser always fail closed (GHSA-rcvr-766c-4phv). Use DOM, clickables, click, type, navigate, and screenshot instead.",
|
|
118
|
+
"required": false,
|
|
119
|
+
"default": true,
|
|
120
|
+
"sensitive": false
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"publishConfig": {
|
|
125
|
+
"access": "public"
|
|
126
|
+
},
|
|
127
|
+
"gitHead": "cdbc876f793d96073d7eb0d09715a031ce0cd32e"
|
|
105
128
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"click-coordinates.d.ts","sourceRoot":"","sources":["../../src/actions/click-coordinates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,MAAM,EAQN,MAAM,eAAe,CAAC;AAKvB,eAAO,MAAM,iCAAiC,EAAE,MAsL/C,CAAC"}
|
|
@@ -1,139 +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, state, options) => {
|
|
38
|
-
const __avTextRaw = typeof message?.content?.text === "string" ? message.content.text : "";
|
|
39
|
-
const __avText = __avTextRaw.toLowerCase();
|
|
40
|
-
const __avKeywords = ["computeruse", "click", "coordinates"];
|
|
41
|
-
const __avKeywordOk = __avKeywords.length > 0 &&
|
|
42
|
-
__avKeywords.some((word) => word.length > 0 && __avText.includes(word));
|
|
43
|
-
const __avRegex = /\b(?:computeruse|click|coordinates)\b/i;
|
|
44
|
-
const __avRegexOk = __avRegex.test(__avText);
|
|
45
|
-
const __avSource = String(message?.content?.source ?? message?.source ?? "");
|
|
46
|
-
const __avExpectedSource = "";
|
|
47
|
-
const __avSourceOk = __avExpectedSource
|
|
48
|
-
? __avSource === __avExpectedSource
|
|
49
|
-
: Boolean(__avSource ||
|
|
50
|
-
state ||
|
|
51
|
-
runtime?.agentId ||
|
|
52
|
-
runtime?.getService ||
|
|
53
|
-
runtime?.getSetting);
|
|
54
|
-
const __avOptions = options && typeof options === "object" ? options : {};
|
|
55
|
-
const __avInputOk = __avText.trim().length > 0 ||
|
|
56
|
-
Object.keys(__avOptions).length > 0 ||
|
|
57
|
-
Boolean(message?.content && typeof message.content === "object");
|
|
58
|
-
if (!(__avKeywordOk && __avRegexOk && __avSourceOk && __avInputOk)) {
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
const __avLegacyValidate = async (runtime, message, state, options) => {
|
|
62
|
-
const __avTextRaw = typeof message?.content?.text === "string" ? message.content.text : "";
|
|
63
|
-
const __avText = __avTextRaw.toLowerCase();
|
|
64
|
-
const __avKeywords = ["computeruse", "click", "coordinates"];
|
|
65
|
-
const __avKeywordOk = __avKeywords.length > 0 &&
|
|
66
|
-
__avKeywords.some((kw) => kw.length > 0 && __avText.includes(kw));
|
|
67
|
-
const __avRegex = /\b(?:computeruse|click|coordinates)\b/i;
|
|
68
|
-
const __avRegexOk = __avRegex.test(__avText);
|
|
69
|
-
const __avSource = String(message?.content?.source ?? message?.source ?? "");
|
|
70
|
-
const __avExpectedSource = "";
|
|
71
|
-
const __avSourceOk = __avExpectedSource
|
|
72
|
-
? __avSource === __avExpectedSource
|
|
73
|
-
: Boolean(__avSource || state || runtime?.agentId || runtime?.getService);
|
|
74
|
-
const __avOptions = options && typeof options === "object" ? options : {};
|
|
75
|
-
const __avInputOk = __avText.trim().length > 0 ||
|
|
76
|
-
Object.keys(__avOptions).length > 0 ||
|
|
77
|
-
Boolean(message?.content && typeof message.content === "object");
|
|
78
|
-
if (!(__avKeywordOk && __avRegexOk && __avSourceOk && __avInputOk)) {
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
const __avLegacyValidate = async (runtime, _message) => {
|
|
82
|
-
const service = runtime.getService("computeruse");
|
|
83
|
-
return !!service && service.isEnabled();
|
|
84
|
-
};
|
|
85
|
-
try {
|
|
86
|
-
return Boolean(await __avLegacyValidate(runtime, message, state, options));
|
|
87
|
-
}
|
|
88
|
-
catch {
|
|
89
|
-
return false;
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
try {
|
|
93
|
-
return Boolean(await __avLegacyValidate(runtime, message, state, options));
|
|
94
|
-
}
|
|
95
|
-
catch {
|
|
96
|
-
return false;
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
handler: async (runtime, message, _state, options, callback) => {
|
|
100
|
-
const service = runtime.getService("computeruse");
|
|
101
|
-
if (!service) {
|
|
102
|
-
return { success: false, text: "ComputerUse service not available" };
|
|
103
|
-
}
|
|
104
|
-
const params = options?.parameters;
|
|
105
|
-
const x = getNumberParam(params, "x");
|
|
106
|
-
const y = getNumberParam(params, "y");
|
|
107
|
-
const button = getStringParam(params, "button") ?? "left";
|
|
108
|
-
const numClicks = getNumberParam(params, "numClicks") ?? 1;
|
|
109
|
-
if (x === undefined || y === undefined) {
|
|
110
|
-
return { success: false, text: "Missing required parameters: x and y" };
|
|
111
|
-
}
|
|
112
|
-
const backend = service.getBackendName();
|
|
113
|
-
try {
|
|
114
|
-
await service.clickCoordinates(x, y, button, numClicks);
|
|
115
|
-
const response = {
|
|
116
|
-
text: `Clicked at coordinates (${x}, ${y}) with ${button} button`,
|
|
117
|
-
actions: ["COMPUTERUSE_CLICK_COORDINATES"],
|
|
118
|
-
source: message.content?.source ?? "action",
|
|
119
|
-
};
|
|
120
|
-
await callback?.(response);
|
|
121
|
-
return {
|
|
122
|
-
success: true,
|
|
123
|
-
text: response.text ?? "",
|
|
124
|
-
values: { x, y, button, numClicks },
|
|
125
|
-
data: { x, y, button, numClicks, backend },
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
catch (err) {
|
|
129
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
130
|
-
logger.error(`[computeruse] click_coordinates failed: ${msg}`);
|
|
131
|
-
return {
|
|
132
|
-
success: false,
|
|
133
|
-
text: `ComputerUse click at coordinates failed: ${msg}`,
|
|
134
|
-
values: { x, y, button, numClicks },
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
},
|
|
138
|
-
};
|
|
139
|
-
//# 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;IACxD,IAAI,EAAE,+BAA+B;IACrC,WAAW,EACV,4FAA4F;IAC7F,OAAO,EAAE,CAAC,UAAU,EAAE,gBAAgB,EAAE,UAAU,CAAC;IACnD,UAAU,EAAE;QACX;YACC,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;SACpB;QACD;YACC,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;SACpB;QACD;YACC,IAAI,EAAE,QAAQ;YACd,WAAW,EACV,6DAA6D;YAC9D,QAAQ,EAAE,KAAK;YACf,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC1B,QAAQ,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;SAC3B;QACD;YACC,IAAI,EAAE,WAAW;YACjB,WAAW,EAAE,mDAAmD;YAChE,QAAQ,EAAE,KAAK;YACf,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE;YAC9D,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;SAChB;KACD;IAED,QAAQ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E,MAAM,EAAE,SAAS,EAAE;gBACnC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE;aAC1C,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACd,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,2CAA2C,GAAG,EAAE,CAAC,CAAC;YAC/D,OAAO;gBACN,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,4CAA4C,GAAG,EAAE;gBACvD,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE;aACnC,CAAC;QACH,CAAC;IACF,CAAC;CACD,CAAC","sourcesContent":["import type {\n\tAction,\n\tActionResult,\n\tContent,\n\tHandlerCallback,\n\tHandlerOptions,\n\tIAgentRuntime,\n\tMemory,\n\tState,\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\tname: \"COMPUTERUSE_CLICK_COORDINATES\",\n\tdescription:\n\t\t\"Clicks at specific screen coordinates (x, y). Use for precise clicking at known positions.\",\n\tsimiles: [\"CLICK_AT\", \"CLICK_POSITION\", \"CLICK_XY\"],\n\tparameters: [\n\t\t{\n\t\t\tname: \"x\",\n\t\t\tdescription: \"X coordinate to click at\",\n\t\t\trequired: true,\n\t\t\tschema: { type: \"number\" },\n\t\t\texamples: [500, 960],\n\t\t},\n\t\t{\n\t\t\tname: \"y\",\n\t\t\tdescription: \"Y coordinate to click at\",\n\t\t\trequired: true,\n\t\t\tschema: { type: \"number\" },\n\t\t\texamples: [300, 540],\n\t\t},\n\t\t{\n\t\t\tname: \"button\",\n\t\t\tdescription:\n\t\t\t\t\"Mouse button: 'left', 'right', or 'middle'. Default: 'left'\",\n\t\t\trequired: false,\n\t\t\tschema: { type: \"string\" },\n\t\t\texamples: [\"left\", \"right\"],\n\t\t},\n\t\t{\n\t\t\tname: \"numClicks\",\n\t\t\tdescription: \"Number of clicks (1=single, 2=double). Default: 1\",\n\t\t\trequired: false,\n\t\t\tschema: { type: \"number\", default: 1, minimum: 1, maximum: 3 },\n\t\t\texamples: [1, 2],\n\t\t},\n\t],\n\n\tvalidate: async (\n\t\truntime: any,\n\t\tmessage: any,\n\t\tstate?: any,\n\t\toptions?: any,\n\t): Promise<boolean> => {\n\t\tconst __avTextRaw =\n\t\t\ttypeof message?.content?.text === \"string\" ? message.content.text : \"\";\n\t\tconst __avText = __avTextRaw.toLowerCase();\n\t\tconst __avKeywords = [\"computeruse\", \"click\", \"coordinates\"];\n\t\tconst __avKeywordOk =\n\t\t\t__avKeywords.length > 0 &&\n\t\t\t__avKeywords.some((word) => word.length > 0 && __avText.includes(word));\n\t\tconst __avRegex = /\\b(?:computeruse|click|coordinates)\\b/i;\n\t\tconst __avRegexOk = __avRegex.test(__avText);\n\t\tconst __avSource = String(\n\t\t\tmessage?.content?.source ?? message?.source ?? \"\",\n\t\t);\n\t\tconst __avExpectedSource = \"\";\n\t\tconst __avSourceOk = __avExpectedSource\n\t\t\t? __avSource === __avExpectedSource\n\t\t\t: Boolean(\n\t\t\t\t\t__avSource ||\n\t\t\t\t\t\tstate ||\n\t\t\t\t\t\truntime?.agentId ||\n\t\t\t\t\t\truntime?.getService ||\n\t\t\t\t\t\truntime?.getSetting,\n\t\t\t\t);\n\t\tconst __avOptions = options && typeof options === \"object\" ? options : {};\n\t\tconst __avInputOk =\n\t\t\t__avText.trim().length > 0 ||\n\t\t\tObject.keys(__avOptions as Record<string, unknown>).length > 0 ||\n\t\t\tBoolean(message?.content && typeof message.content === \"object\");\n\n\t\tif (!(__avKeywordOk && __avRegexOk && __avSourceOk && __avInputOk)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst __avLegacyValidate = async (\n\t\t\truntime: any,\n\t\t\tmessage: any,\n\t\t\tstate?: any,\n\t\t\toptions?: any,\n\t\t): Promise<boolean> => {\n\t\t\tconst __avTextRaw =\n\t\t\t\ttypeof message?.content?.text === \"string\" ? message.content.text : \"\";\n\t\t\tconst __avText = __avTextRaw.toLowerCase();\n\t\t\tconst __avKeywords = [\"computeruse\", \"click\", \"coordinates\"];\n\t\t\tconst __avKeywordOk =\n\t\t\t\t__avKeywords.length > 0 &&\n\t\t\t\t__avKeywords.some((kw) => kw.length > 0 && __avText.includes(kw));\n\t\t\tconst __avRegex = /\\b(?:computeruse|click|coordinates)\\b/i;\n\t\t\tconst __avRegexOk = __avRegex.test(__avText);\n\t\t\tconst __avSource = String(\n\t\t\t\tmessage?.content?.source ?? message?.source ?? \"\",\n\t\t\t);\n\t\t\tconst __avExpectedSource = \"\";\n\t\t\tconst __avSourceOk = __avExpectedSource\n\t\t\t\t? __avSource === __avExpectedSource\n\t\t\t\t: Boolean(\n\t\t\t\t\t\t__avSource || state || runtime?.agentId || runtime?.getService,\n\t\t\t\t\t);\n\t\t\tconst __avOptions = options && typeof options === \"object\" ? options : {};\n\t\t\tconst __avInputOk =\n\t\t\t\t__avText.trim().length > 0 ||\n\t\t\t\tObject.keys(__avOptions as Record<string, unknown>).length > 0 ||\n\t\t\t\tBoolean(message?.content && typeof message.content === \"object\");\n\n\t\t\tif (!(__avKeywordOk && __avRegexOk && __avSourceOk && __avInputOk)) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst __avLegacyValidate = async (\n\t\t\t\truntime: IAgentRuntime,\n\t\t\t\t_message: Memory,\n\t\t\t): Promise<boolean> => {\n\t\t\t\tconst service = runtime.getService<ComputerUseService>(\"computeruse\");\n\t\t\t\treturn !!service && service.isEnabled();\n\t\t\t};\n\t\t\ttry {\n\t\t\t\treturn Boolean(\n\t\t\t\t\tawait (__avLegacyValidate as any)(runtime, message, state, options),\n\t\t\t\t);\n\t\t\t} catch {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t};\n\t\ttry {\n\t\t\treturn Boolean(\n\t\t\t\tawait (__avLegacyValidate as any)(runtime, message, state, options),\n\t\t\t);\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t},\n\n\thandler: async (\n\t\truntime: IAgentRuntime,\n\t\tmessage: Memory,\n\t\t_state?: State,\n\t\toptions?: HandlerOptions,\n\t\tcallback?: HandlerCallback,\n\t): Promise<ActionResult> => {\n\t\tconst service = runtime.getService<ComputerUseService>(\"computeruse\");\n\t\tif (!service) {\n\t\t\treturn { success: false, text: \"ComputerUse service not available\" };\n\t\t}\n\n\t\tconst params = options?.parameters;\n\t\tconst x = getNumberParam(params, \"x\");\n\t\tconst y = getNumberParam(params, \"y\");\n\t\tconst button = getStringParam(params, \"button\") ?? \"left\";\n\t\tconst numClicks = getNumberParam(params, \"numClicks\") ?? 1;\n\n\t\tif (x === undefined || y === undefined) {\n\t\t\treturn { success: false, text: \"Missing required parameters: x and y\" };\n\t\t}\n\n\t\tconst backend = service.getBackendName();\n\n\t\ttry {\n\t\t\tawait service.clickCoordinates(x, y, button, numClicks);\n\n\t\t\tconst response: Content = {\n\t\t\t\ttext: `Clicked at coordinates (${x}, ${y}) with ${button} button`,\n\t\t\t\tactions: [\"COMPUTERUSE_CLICK_COORDINATES\"],\n\t\t\t\tsource: message.content?.source ?? \"action\",\n\t\t\t};\n\t\t\tawait callback?.(response);\n\t\t\treturn {\n\t\t\t\tsuccess: true,\n\t\t\t\ttext: response.text ?? \"\",\n\t\t\t\tvalues: { x, y, button, numClicks },\n\t\t\t\tdata: { x, y, button, numClicks, backend },\n\t\t\t};\n\t\t} catch (err) {\n\t\t\tconst msg = err instanceof Error ? err.message : String(err);\n\t\t\tlogger.error(`[computeruse] click_coordinates failed: ${msg}`);\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\ttext: `ComputerUse click at coordinates failed: ${msg}`,\n\t\t\t\tvalues: { x, y, button, numClicks },\n\t\t\t};\n\t\t}\n\t},\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,EACX,MAAM,EAQN,MAAM,eAAe,CAAC;AAKvB,eAAO,MAAM,sBAAsB,EAAE,MAwLpC,CAAC"}
|