@elizaos/plugin-computeruse 2.0.0-alpha.9 → 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 +7125 -59
- 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 +100 -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/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.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
C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
-
|
|
101
|
-
|
|
102
|
-
"node": "Node.js only (platform: node)"
|
|
103
|
-
}
|
|
104
|
-
}
|
|
2
|
+
"name": "@elizaos/plugin-computeruse",
|
|
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
|
+
"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
|
+
"import": "./dist/index.js",
|
|
13
|
+
"default": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"README.md",
|
|
20
|
+
"package.json"
|
|
21
|
+
],
|
|
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"
|
|
27
|
+
},
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"@elizaos/core": "2.0.0-beta.1"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@elizaos/core": "2.0.0-beta.1",
|
|
33
|
+
"@types/node": "^25.2.3",
|
|
34
|
+
"typescript": "^6.0.3",
|
|
35
|
+
"vitest": "4.1.5"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@nut-tree-fork/nut-js": "^4.2.6",
|
|
39
|
+
"puppeteer-core": "^24.9.0"
|
|
40
|
+
},
|
|
41
|
+
"license": "Apache-2.0",
|
|
42
|
+
"agentConfig": {
|
|
43
|
+
"pluginType": "elizaos:plugin:1.0.0",
|
|
44
|
+
"pluginParameters": {
|
|
45
|
+
"COMPUTER_USE_ENABLED": {
|
|
46
|
+
"type": "boolean",
|
|
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
|
|
65
|
+
},
|
|
66
|
+
"COMPUTER_USE_APPROVAL_MODE": {
|
|
67
|
+
"type": "string",
|
|
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
|
|
78
|
+
},
|
|
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
|
+
"type": "string",
|
|
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
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"publishConfig": {
|
|
100
|
+
"access": "public"
|
|
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,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;IAC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,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"}
|
package/dist/actions/click.js
DELETED
|
@@ -1,144 +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, state, options) => {
|
|
31
|
-
const __avTextRaw = typeof message?.content?.text === "string" ? message.content.text : "";
|
|
32
|
-
const __avText = __avTextRaw.toLowerCase();
|
|
33
|
-
const __avKeywords = ["computeruse", "click"];
|
|
34
|
-
const __avKeywordOk = __avKeywords.length > 0 &&
|
|
35
|
-
__avKeywords.some((word) => word.length > 0 && __avText.includes(word));
|
|
36
|
-
const __avRegex = /\b(?:computeruse|click)\b/i;
|
|
37
|
-
const __avRegexOk = __avRegex.test(__avText);
|
|
38
|
-
const __avSource = String(message?.content?.source ?? message?.source ?? "");
|
|
39
|
-
const __avExpectedSource = "";
|
|
40
|
-
const __avSourceOk = __avExpectedSource
|
|
41
|
-
? __avSource === __avExpectedSource
|
|
42
|
-
: Boolean(__avSource ||
|
|
43
|
-
state ||
|
|
44
|
-
runtime?.agentId ||
|
|
45
|
-
runtime?.getService ||
|
|
46
|
-
runtime?.getSetting);
|
|
47
|
-
const __avOptions = options && typeof options === "object" ? options : {};
|
|
48
|
-
const __avInputOk = __avText.trim().length > 0 ||
|
|
49
|
-
Object.keys(__avOptions).length > 0 ||
|
|
50
|
-
Boolean(message?.content && typeof message.content === "object");
|
|
51
|
-
if (!(__avKeywordOk && __avRegexOk && __avSourceOk && __avInputOk)) {
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
const __avLegacyValidate = async (runtime, message, state, options) => {
|
|
55
|
-
const __avTextRaw = typeof message?.content?.text === "string" ? message.content.text : "";
|
|
56
|
-
const __avText = __avTextRaw.toLowerCase();
|
|
57
|
-
const __avKeywords = ["computeruse", "click"];
|
|
58
|
-
const __avKeywordOk = __avKeywords.length > 0 &&
|
|
59
|
-
__avKeywords.some((kw) => kw.length > 0 && __avText.includes(kw));
|
|
60
|
-
const __avRegex = /\b(?:computeruse|click)\b/i;
|
|
61
|
-
const __avRegexOk = __avRegex.test(__avText);
|
|
62
|
-
const __avSource = String(message?.content?.source ?? message?.source ?? "");
|
|
63
|
-
const __avExpectedSource = "";
|
|
64
|
-
const __avSourceOk = __avExpectedSource
|
|
65
|
-
? __avSource === __avExpectedSource
|
|
66
|
-
: Boolean(__avSource || state || runtime?.agentId || runtime?.getService);
|
|
67
|
-
const __avOptions = options && typeof options === "object" ? options : {};
|
|
68
|
-
const __avInputOk = __avText.trim().length > 0 ||
|
|
69
|
-
Object.keys(__avOptions).length > 0 ||
|
|
70
|
-
Boolean(message?.content && typeof message.content === "object");
|
|
71
|
-
if (!(__avKeywordOk && __avRegexOk && __avSourceOk && __avInputOk)) {
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
const __avLegacyValidate = async (runtime, message) => {
|
|
75
|
-
const service = runtime.getService("computeruse");
|
|
76
|
-
if (!service || !service.isEnabled())
|
|
77
|
-
return false;
|
|
78
|
-
const text = message.content?.text?.toLowerCase() ?? "";
|
|
79
|
-
return text.includes("click") || text.includes("tap");
|
|
80
|
-
};
|
|
81
|
-
try {
|
|
82
|
-
return Boolean(await __avLegacyValidate(runtime, message, state, options));
|
|
83
|
-
}
|
|
84
|
-
catch {
|
|
85
|
-
return false;
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
try {
|
|
89
|
-
return Boolean(await __avLegacyValidate(runtime, message, state, options));
|
|
90
|
-
}
|
|
91
|
-
catch {
|
|
92
|
-
return false;
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
handler: async (runtime, message, _state, options, callback) => {
|
|
96
|
-
const service = runtime.getService("computeruse");
|
|
97
|
-
if (!service) {
|
|
98
|
-
return { success: false, text: "ComputerUse service not available" };
|
|
99
|
-
}
|
|
100
|
-
const params = options?.parameters;
|
|
101
|
-
const process = getStringParam(params, "process");
|
|
102
|
-
const selector = getStringParam(params, "selector");
|
|
103
|
-
const timeoutMs = getNumberParam(params, "timeoutMs") ?? 5000;
|
|
104
|
-
if (!selector) {
|
|
105
|
-
return { success: false, text: "Missing required parameter: selector" };
|
|
106
|
-
}
|
|
107
|
-
try {
|
|
108
|
-
await service.click(selector, timeoutMs, process);
|
|
109
|
-
const response = {
|
|
110
|
-
text: `Clicked element: ${selector}`,
|
|
111
|
-
actions: ["COMPUTERUSE_CLICK"],
|
|
112
|
-
source: message.content?.source ?? "action",
|
|
113
|
-
};
|
|
114
|
-
await callback?.(response);
|
|
115
|
-
return {
|
|
116
|
-
success: true,
|
|
117
|
-
text: response.text ?? "",
|
|
118
|
-
values: { process, selector, timeoutMs },
|
|
119
|
-
data: {
|
|
120
|
-
process,
|
|
121
|
-
selector,
|
|
122
|
-
timeoutMs,
|
|
123
|
-
backend: service.getBackendName(),
|
|
124
|
-
},
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
catch (err) {
|
|
128
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
129
|
-
logger.error(`[computeruse] click failed: ${msg}`);
|
|
130
|
-
return {
|
|
131
|
-
success: false,
|
|
132
|
-
text: `ComputerUse click failed: ${msg}`,
|
|
133
|
-
values: { process, selector, timeoutMs },
|
|
134
|
-
data: {
|
|
135
|
-
process,
|
|
136
|
-
selector,
|
|
137
|
-
timeoutMs,
|
|
138
|
-
backend: service.getBackendName(),
|
|
139
|
-
},
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
};
|
|
144
|
-
//# 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;IAC7C,IAAI,EAAE,mBAAmB;IACzB,WAAW,EACV,mEAAmE;IACpE,OAAO,EAAE,CAAC,UAAU,EAAE,eAAe,EAAE,QAAQ,CAAC;IAChD,UAAU,EAAE;QACX;YACC,IAAI,EAAE,SAAS;YACf,WAAW,EACV,gJAAgJ;YACjJ,QAAQ,EAAE,KAAK;YACf,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC1B,QAAQ,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;SAC/B;QACD;YACC,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,0B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OAAO,CAAC,OAAO,EAAE,MAAM,IAAI,QAAQ;aAC3C,CAAC;YACF,MAAM,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC;YAC3B,OAAO;gBACN,OAAO,EAAE,IAAI;gBACb,IAAI,EAAE,QAAQ,CAAC,IAAI,IAAI,EAAE;gBACzB,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE;gBACxC,IAAI,EAAE;oBACL,OAAO;oBACP,QAAQ;oBACR,SAAS;oBACT,OAAO,EAAE,OAAO,CAAC,cAAc,EAAE;iBACjC;aACD,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,+BAA+B,GAAG,EAAE,CAAC,CAAC;YACnD,OAAO;gBACN,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,6BAA6B,GAAG,EAAE;gBACxC,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE;gBACxC,IAAI,EAAE;oBACL,OAAO;oBACP,QAAQ;oBACR,SAAS;oBACT,OAAO,EAAE,OAAO,CAAC,cAAc,EAAE;iBACjC;aACD,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 computeruseClickAction: Action = {\n\tname: \"COMPUTERUSE_CLICK\",\n\tdescription:\n\t\t\"Clicks a UI element on the computer using a ComputerUse selector.\",\n\tsimiles: [\"CLICK_UI\", \"CLICK_ELEMENT\", \"TAP_UI\"],\n\tparameters: [\n\t\t{\n\t\t\tname: \"process\",\n\t\t\tdescription:\n\t\t\t\t\"Process name to scope the click when using MCP mode (e.g. 'chrome', 'notepad'). Optional if selector is prefixed with 'process:<name> >> ...'.\",\n\t\t\trequired: false,\n\t\t\tschema: { type: \"string\" },\n\t\t\texamples: [\"chrome\", \"notepad\"],\n\t\t},\n\t\t{\n\t\t\tname: \"selector\",\n\t\t\tdescription: \"ComputerUse selector string for the target element\",\n\t\t\trequired: true,\n\t\t\tschema: { type: \"string\" },\n\t\t\texamples: [\"role:Button && name:Submit\", \"role:Edit && name:Search\"],\n\t\t},\n\t\t{\n\t\t\tname: \"timeoutMs\",\n\t\t\tdescription: \"Timeout in milliseconds to find the element\",\n\t\t\trequired: false,\n\t\t\tschema: { type: \"number\", default: 5000, minimum: 0 },\n\t\t\texamples: [5000],\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\"];\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)\\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\"];\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)\\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\tmessage: Memory,\n\t\t\t): Promise<boolean> => {\n\t\t\t\tconst service = runtime.getService<ComputerUseService>(\"computeruse\");\n\t\t\t\tif (!service || !service.isEnabled()) return false;\n\n\t\t\t\tconst text = message.content?.text?.toLowerCase() ?? \"\";\n\t\t\t\treturn text.includes(\"click\") || text.includes(\"tap\");\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 process = getStringParam(params, \"process\");\n\t\tconst selector = getStringParam(params, \"selector\");\n\t\tconst timeoutMs = getNumberParam(params, \"timeoutMs\") ?? 5000;\n\t\tif (!selector) {\n\t\t\treturn { success: false, text: \"Missing required parameter: selector\" };\n\t\t}\n\n\t\ttry {\n\t\t\tawait service.click(selector, timeoutMs, process);\n\t\t\tconst response: Content = {\n\t\t\t\ttext: `Clicked element: ${selector}`,\n\t\t\t\tactions: [\"COMPUTERUSE_CLICK\"],\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: { process, selector, timeoutMs },\n\t\t\t\tdata: {\n\t\t\t\t\tprocess,\n\t\t\t\t\tselector,\n\t\t\t\t\ttimeoutMs,\n\t\t\t\t\tbackend: service.getBackendName(),\n\t\t\t\t},\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 failed: ${msg}`);\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\ttext: `ComputerUse click failed: ${msg}`,\n\t\t\t\tvalues: { process, selector, timeoutMs },\n\t\t\t\tdata: {\n\t\t\t\t\tprocess,\n\t\t\t\t\tselector,\n\t\t\t\t\ttimeoutMs,\n\t\t\t\t\tbackend: service.getBackendName(),\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t},\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,EACX,MAAM,EAQN,MAAM,eAAe,CAAC;AAKvB,eAAO,MAAM,qBAAqB,EAAE,MA6LnC,CAAC"}
|