@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
|
@@ -1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;gBACzB,MAAM,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE;gBACpC,IAAI,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,cAAc,EAAE,EAAE;aACtE,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,yCAAyC,GAAG,EAAE,CAAC,CAAC;YAC7D,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,uCAAuC,GAAG,EAAE;gBAClD,MAAM,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE;gBACpC,IAAI,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,cAAc,EAAE,EAAE;aACtE,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 computeruseGetWindowTreeAction: Action = {\n name: \"COMPUTERUSE_GET_WINDOW_TREE\",\n description:\n \"Gets the UI tree for a running application (useful for understanding what is currently on screen).\",\n similes: [\"GET_UI_TREE\", \"WINDOW_TREE\", \"DUMP_UI_TREE\"],\n parameters: [\n {\n name: \"process\",\n description: \"Process name of the target application (e.g. 'chrome', 'notepad')\",\n required: true,\n schema: { type: \"string\" },\n examples: [\"chrome\", \"notepad\"],\n },\n {\n name: \"title\",\n description: \"Optional window title filter\",\n required: false,\n schema: { type: \"string\" },\n },\n {\n name: \"maxDepth\",\n description: \"Optional max tree depth (MCP mode only)\",\n required: false,\n schema: { type: \"number\", minimum: 0 },\n examples: [6],\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(\"window tree\") || text.includes(\"ui tree\") || text.includes(\"dump tree\");\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 const params = options?.parameters;\n const process = getStringParam(params, \"process\");\n const title = getStringParam(params, \"title\");\n const maxDepth = getNumberParam(params, \"maxDepth\");\n\n if (!process) return { success: false, text: \"Missing required parameter: process\" };\n\n try {\n const treeText = await service.getWindowTree(process, title, maxDepth);\n const response: Content = {\n text: treeText.length > 0 ? treeText : \"(empty tree result)\",\n actions: [\"COMPUTERUSE_GET_WINDOW_TREE\"],\n source: message.content?.source ?? \"action\",\n };\n await callback?.(response);\n return {\n success: true,\n text: response.text ?? \"\",\n values: { process, title, maxDepth },\n data: { process, title, maxDepth, backend: service.getBackendName() },\n };\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n logger.error(`[computeruse] get window tree failed: ${msg}`);\n return {\n success: false,\n text: `ComputerUse get window tree failed: ${msg}`,\n values: { process, title, maxDepth },\n data: { process, title, maxDepth, backend: service.getBackendName() },\n };\n }\n },\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"open-application.d.ts","sourceRoot":"","sources":["../../src/actions/open-application.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EAQP,MAAM,eAAe,CAAC;AAKvB,eAAO,MAAM,gCAAgC,EAAE,MA4D9C,CAAC"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { logger } from "@elizaos/core";
|
|
2
|
-
import { getStringParam } from "../utils/params.js";
|
|
3
|
-
export const computeruseOpenApplicationAction = {
|
|
4
|
-
name: "COMPUTERUSE_OPEN_APPLICATION",
|
|
5
|
-
description: "Opens an application on the target machine (local or MCP).",
|
|
6
|
-
similes: ["OPEN_APP", "LAUNCH_APP", "START_APPLICATION"],
|
|
7
|
-
parameters: [
|
|
8
|
-
{
|
|
9
|
-
name: "name",
|
|
10
|
-
description: "Application name or executable path (e.g. 'calc', 'notepad', 'chrome')",
|
|
11
|
-
required: true,
|
|
12
|
-
schema: { type: "string" },
|
|
13
|
-
examples: ["calc", "notepad", "chrome"],
|
|
14
|
-
},
|
|
15
|
-
],
|
|
16
|
-
validate: async (runtime, message) => {
|
|
17
|
-
const service = runtime.getService("computeruse");
|
|
18
|
-
if (!service || !service.isEnabled())
|
|
19
|
-
return false;
|
|
20
|
-
const text = message.content?.text?.toLowerCase() ?? "";
|
|
21
|
-
return text.includes("open") || text.includes("launch") || text.includes("start");
|
|
22
|
-
},
|
|
23
|
-
handler: async (runtime, message, _state, options, callback) => {
|
|
24
|
-
const service = runtime.getService("computeruse");
|
|
25
|
-
if (!service)
|
|
26
|
-
return { success: false, text: "ComputerUse service not available" };
|
|
27
|
-
const name = getStringParam(options?.parameters, "name");
|
|
28
|
-
if (!name)
|
|
29
|
-
return { success: false, text: "Missing required parameter: name" };
|
|
30
|
-
try {
|
|
31
|
-
await service.openApplication(name);
|
|
32
|
-
const response = {
|
|
33
|
-
text: `Opened application: ${name}`,
|
|
34
|
-
actions: ["COMPUTERUSE_OPEN_APPLICATION"],
|
|
35
|
-
source: message.content?.source ?? "action",
|
|
36
|
-
};
|
|
37
|
-
await callback?.(response);
|
|
38
|
-
return {
|
|
39
|
-
success: true,
|
|
40
|
-
text: response.text ?? "",
|
|
41
|
-
values: { name },
|
|
42
|
-
data: { name, backend: service.getBackendName() },
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
catch (err) {
|
|
46
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
47
|
-
logger.error(`[computeruse] open application failed: ${msg}`);
|
|
48
|
-
return {
|
|
49
|
-
success: false,
|
|
50
|
-
text: `ComputerUse open application failed: ${msg}`,
|
|
51
|
-
values: { name },
|
|
52
|
-
data: { name, backend: service.getBackendName() },
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
//# sourceMappingURL=open-application.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"open-application.js","sourceRoot":"","sources":["../../src/actions/open-application.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,MAAM,CAAC,MAAM,gCAAgC,GAAW;IACtD,IAAI,EAAE,8BAA8B;IACpC,WAAW,EAAE,4DAA4D;IACzE,OAAO,EAAE,CAAC,UAAU,EAAE,YAAY,EAAE,mBAAmB,CAAC;IACxD,UAAU,EAAE;QACV;YACE,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,wEAAwE;YACrF,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC1B,QAAQ,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC;SACxC;KACF;IAED,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;Q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AC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC7D,MAAM,CAAC,KAAK,CAAC,0CAA0C,GAAG,EAAE,CAAC,CAAC;YAC9D,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,wCAAwC,GAAG,EAAE;gBACnD,MAAM,EAAE,EAAE,IAAI,EAAE;gBAChB,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,cAAc,EAAE,EAAE;aAClD,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 { getStringParam } from \"../utils/params.js\";\n\nexport const computeruseOpenApplicationAction: Action = {\n name: \"COMPUTERUSE_OPEN_APPLICATION\",\n description: \"Opens an application on the target machine (local or MCP).\",\n similes: [\"OPEN_APP\", \"LAUNCH_APP\", \"START_APPLICATION\"],\n parameters: [\n {\n name: \"name\",\n description: \"Application name or executable path (e.g. 'calc', 'notepad', 'chrome')\",\n required: true,\n schema: { type: \"string\" },\n examples: [\"calc\", \"notepad\", \"chrome\"],\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(\"open\") || text.includes(\"launch\") || text.includes(\"start\");\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 const name = getStringParam(options?.parameters, \"name\");\n if (!name) return { success: false, text: \"Missing required parameter: name\" };\n\n try {\n await service.openApplication(name);\n const response: Content = {\n text: `Opened application: ${name}`,\n actions: [\"COMPUTERUSE_OPEN_APPLICATION\"],\n source: message.content?.source ?? \"action\",\n };\n await callback?.(response);\n return {\n success: true,\n text: response.text ?? \"\",\n values: { name },\n data: { name, backend: service.getBackendName() },\n };\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n logger.error(`[computeruse] open application failed: ${msg}`);\n return {\n success: false,\n text: `ComputerUse open application failed: ${msg}`,\n values: { name },\n data: { name, backend: service.getBackendName() },\n };\n }\n },\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"press-key.d.ts","sourceRoot":"","sources":["../../src/actions/press-key.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EAQP,MAAM,eAAe,CAAC;AAKvB,eAAO,MAAM,yBAAyB,EAAE,MAkEvC,CAAC"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { logger } from "@elizaos/core";
|
|
2
|
-
import { getStringParam } from "../utils/params.js";
|
|
3
|
-
export const computerusePressKeyAction = {
|
|
4
|
-
name: "COMPUTERUSE_PRESS_KEY",
|
|
5
|
-
description: "Press a keyboard key or key combination (hotkey). Use for shortcuts, Enter, Tab, etc.",
|
|
6
|
-
similes: ["PRESS_KEY", "HOTKEY", "KEY_PRESS", "KEYBOARD_SHORTCUT"],
|
|
7
|
-
parameters: [
|
|
8
|
-
{
|
|
9
|
-
name: "keys",
|
|
10
|
-
description: "Key or key combination to press. Examples: 'enter', 'ctrl+c', 'alt+tab', 'ctrl+shift+s'",
|
|
11
|
-
required: true,
|
|
12
|
-
schema: { type: "string" },
|
|
13
|
-
examples: ["enter", "ctrl+c", "alt+tab", "tab", "escape"],
|
|
14
|
-
},
|
|
15
|
-
],
|
|
16
|
-
validate: async (runtime, message) => {
|
|
17
|
-
const service = runtime.getService("computeruse");
|
|
18
|
-
return !!service && service.isEnabled();
|
|
19
|
-
},
|
|
20
|
-
handler: async (runtime, message, _state, options, callback) => {
|
|
21
|
-
const service = runtime.getService("computeruse");
|
|
22
|
-
if (!service) {
|
|
23
|
-
return { success: false, text: "ComputerUse service not available" };
|
|
24
|
-
}
|
|
25
|
-
const params = options?.parameters;
|
|
26
|
-
const keys = getStringParam(params, "keys");
|
|
27
|
-
if (!keys) {
|
|
28
|
-
return { success: false, text: "Missing required parameter: keys" };
|
|
29
|
-
}
|
|
30
|
-
const backend = service.getBackendName();
|
|
31
|
-
try {
|
|
32
|
-
await service.pressKey(keys);
|
|
33
|
-
const response = {
|
|
34
|
-
text: `Pressed key: ${keys}`,
|
|
35
|
-
actions: ["COMPUTERUSE_PRESS_KEY"],
|
|
36
|
-
source: message.content?.source ?? "action",
|
|
37
|
-
};
|
|
38
|
-
await callback?.(response);
|
|
39
|
-
return {
|
|
40
|
-
success: true,
|
|
41
|
-
text: response.text ?? "",
|
|
42
|
-
values: { keys },
|
|
43
|
-
data: { keys, backend },
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
catch (err) {
|
|
47
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
48
|
-
logger.error(`[computeruse] press_key failed: ${msg}`);
|
|
49
|
-
return {
|
|
50
|
-
success: false,
|
|
51
|
-
text: `ComputerUse press key failed: ${msg}`,
|
|
52
|
-
values: { keys },
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
//# sourceMappingURL=press-key.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"press-key.js","sourceRoot":"","sources":["../../src/actions/press-key.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,MAAM,CAAC,MAAM,yBAAyB,GAAW;IAC/C,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EACT,uFAAuF;IACzF,OAAO,EAAE,C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B,OAAO,EAAE,CAAC,uBAAuB,CAAC;gBAClC,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,IAAI,EAAE;gBAChB,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;aACxB,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,mCAAmC,GAAG,EAAE,CAAC,CAAC;YACvD,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,iCAAiC,GAAG,EAAE;gBAC5C,MAAM,EAAE,EAAE,IAAI,EAAE;aACjB,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 { getStringParam } from \"../utils/params.js\";\n\nexport const computerusePressKeyAction: Action = {\n name: \"COMPUTERUSE_PRESS_KEY\",\n description:\n \"Press a keyboard key or key combination (hotkey). Use for shortcuts, Enter, Tab, etc.\",\n similes: [\"PRESS_KEY\", \"HOTKEY\", \"KEY_PRESS\", \"KEYBOARD_SHORTCUT\"],\n parameters: [\n {\n name: \"keys\",\n description:\n \"Key or key combination to press. Examples: 'enter', 'ctrl+c', 'alt+tab', 'ctrl+shift+s'\",\n required: true,\n schema: { type: \"string\" },\n examples: [\"enter\", \"ctrl+c\", \"alt+tab\", \"tab\", \"escape\"],\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 keys = getStringParam(params, \"keys\");\n if (!keys) {\n return { success: false, text: \"Missing required parameter: keys\" };\n }\n\n const backend = service.getBackendName();\n\n try {\n await service.pressKey(keys);\n\n const response: Content = {\n text: `Pressed key: ${keys}`,\n actions: [\"COMPUTERUSE_PRESS_KEY\"],\n source: message.content?.source ?? \"action\",\n };\n await callback?.(response);\n return {\n success: true,\n text: response.text ?? \"\",\n values: { keys },\n data: { keys, backend },\n };\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n logger.error(`[computeruse] press_key failed: ${msg}`);\n return {\n success: false,\n text: `ComputerUse press key failed: ${msg}`,\n values: { keys },\n };\n }\n },\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"screenshot.d.ts","sourceRoot":"","sources":["../../src/actions/screenshot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EAQP,MAAM,eAAe,CAAC;AAIvB,eAAO,MAAM,2BAA2B,EAAE,MAgDzC,CAAC"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { logger } from "@elizaos/core";
|
|
2
|
-
export const computeruseScreenshotAction = {
|
|
3
|
-
name: "COMPUTERUSE_SCREENSHOT",
|
|
4
|
-
description: "Capture a screenshot of the current screen.",
|
|
5
|
-
similes: ["SCREENSHOT", "CAPTURE_SCREEN", "TAKE_SCREENSHOT"],
|
|
6
|
-
parameters: [],
|
|
7
|
-
validate: async (runtime, message) => {
|
|
8
|
-
const service = runtime.getService("computeruse");
|
|
9
|
-
return !!service && service.isEnabled();
|
|
10
|
-
},
|
|
11
|
-
handler: async (runtime, message, _state, options, callback) => {
|
|
12
|
-
const service = runtime.getService("computeruse");
|
|
13
|
-
if (!service) {
|
|
14
|
-
return { success: false, text: "ComputerUse service not available" };
|
|
15
|
-
}
|
|
16
|
-
const backend = service.getBackendName();
|
|
17
|
-
try {
|
|
18
|
-
const screenshotData = await service.screenshot();
|
|
19
|
-
const response = {
|
|
20
|
-
text: "Screenshot captured",
|
|
21
|
-
actions: ["COMPUTERUSE_SCREENSHOT"],
|
|
22
|
-
source: message.content?.source ?? "action",
|
|
23
|
-
};
|
|
24
|
-
await callback?.(response);
|
|
25
|
-
return {
|
|
26
|
-
success: true,
|
|
27
|
-
text: response.text ?? "",
|
|
28
|
-
data: { backend, screenshotLength: screenshotData.length },
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
catch (err) {
|
|
32
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
33
|
-
logger.error(`[computeruse] screenshot failed: ${msg}`);
|
|
34
|
-
return {
|
|
35
|
-
success: false,
|
|
36
|
-
text: `ComputerUse screenshot failed: ${msg}`,
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
//# sourceMappingURL=screenshot.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"screenshot.js","sourceRoot":"","sources":["../../src/actions/screenshot.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAGvC,MAAM,CAAC,MAAM,2BAA2B,GAAW;IACjD,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EAAE,6CAA6C;IAC1D,OAAO,EAAE,CAAC,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,CAAC;IAC5D,UAAU,EAAE,EAAE;IAEd,QAAQ,EAAE,KA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ACxD,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,kCAAkC,GAAG,EAAE;aAC9C,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\";\n\nexport const computeruseScreenshotAction: Action = {\n name: \"COMPUTERUSE_SCREENSHOT\",\n description: \"Capture a screenshot of the current screen.\",\n similes: [\"SCREENSHOT\", \"CAPTURE_SCREEN\", \"TAKE_SCREENSHOT\"],\n parameters: [],\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 backend = service.getBackendName();\n\n try {\n const screenshotData = await service.screenshot();\n\n const response: Content = {\n text: \"Screenshot captured\",\n actions: [\"COMPUTERUSE_SCREENSHOT\"],\n source: message.content?.source ?? \"action\",\n };\n await callback?.(response);\n return {\n success: true,\n text: response.text ?? \"\",\n data: { backend, screenshotLength: screenshotData.length },\n };\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n logger.error(`[computeruse] screenshot failed: ${msg}`);\n return {\n success: false,\n text: `ComputerUse screenshot failed: ${msg}`,\n };\n }\n },\n};\n"]}
|
package/dist/actions/scroll.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scroll.d.ts","sourceRoot":"","sources":["../../src/actions/scroll.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EAQP,MAAM,eAAe,CAAC;AAKvB,eAAO,MAAM,uBAAuB,EAAE,MAsFrC,CAAC"}
|
package/dist/actions/scroll.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { logger } from "@elizaos/core";
|
|
2
|
-
import { getNumberParam, getStringParam } from "../utils/params.js";
|
|
3
|
-
export const computeruseScrollAction = {
|
|
4
|
-
name: "COMPUTERUSE_SCROLL",
|
|
5
|
-
description: "Scroll the mouse wheel at the current or specified position.",
|
|
6
|
-
similes: ["SCROLL", "SCROLL_UP", "SCROLL_DOWN", "MOUSE_SCROLL"],
|
|
7
|
-
parameters: [
|
|
8
|
-
{
|
|
9
|
-
name: "x",
|
|
10
|
-
description: "X coordinate to scroll at (optional)",
|
|
11
|
-
required: false,
|
|
12
|
-
schema: { type: "number" },
|
|
13
|
-
examples: [500],
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
name: "y",
|
|
17
|
-
description: "Y coordinate to scroll at (optional)",
|
|
18
|
-
required: false,
|
|
19
|
-
schema: { type: "number" },
|
|
20
|
-
examples: [500],
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
name: "direction",
|
|
24
|
-
description: "Scroll direction: 'up' or 'down'. Default: 'down'",
|
|
25
|
-
required: false,
|
|
26
|
-
schema: { type: "string" },
|
|
27
|
-
examples: ["up", "down"],
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
name: "amount",
|
|
31
|
-
description: "Number of scroll clicks. Default: 3",
|
|
32
|
-
required: false,
|
|
33
|
-
schema: { type: "number", default: 3, minimum: 1 },
|
|
34
|
-
examples: [3, 5, 10],
|
|
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 direction = getStringParam(params, "direction") ?? "down";
|
|
50
|
-
const amount = getNumberParam(params, "amount") ?? 3;
|
|
51
|
-
const backend = service.getBackendName();
|
|
52
|
-
try {
|
|
53
|
-
await service.scroll(direction, amount, x, y);
|
|
54
|
-
const posStr = x !== undefined ? `(${x}, ${y})` : "current position";
|
|
55
|
-
const response = {
|
|
56
|
-
text: `Scrolled ${direction} by ${amount} at ${posStr}`,
|
|
57
|
-
actions: ["COMPUTERUSE_SCROLL"],
|
|
58
|
-
source: message.content?.source ?? "action",
|
|
59
|
-
};
|
|
60
|
-
await callback?.(response);
|
|
61
|
-
return {
|
|
62
|
-
success: true,
|
|
63
|
-
text: response.text ?? "",
|
|
64
|
-
values: { x, y, direction, amount },
|
|
65
|
-
data: { x, y, direction, amount, backend },
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
catch (err) {
|
|
69
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
70
|
-
logger.error(`[computeruse] scroll failed: ${msg}`);
|
|
71
|
-
return {
|
|
72
|
-
success: false,
|
|
73
|
-
text: `ComputerUse scroll failed: ${msg}`,
|
|
74
|
-
values: { x, y, direction, amount },
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
//# sourceMappingURL=scroll.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scroll.js","sourceRoot":"","sources":["../../src/actions/scroll.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,uBAAuB,GAAW;IAC7C,IAAI,EAAE,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,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE;aAC3C,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,gCAAgC,GAAG,EAAE,CAAC,CAAC;YACpD,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,8BAA8B,GAAG,EAAE;gBACzC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,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 computeruseScrollAction: Action = {\n name: \"COMPUTERUSE_SCROLL\",\n description: \"Scroll the mouse wheel at the current or specified position.\",\n similes: [\"SCROLL\", \"SCROLL_UP\", \"SCROLL_DOWN\", \"MOUSE_SCROLL\"],\n parameters: [\n {\n name: \"x\",\n description: \"X coordinate to scroll at (optional)\",\n required: false,\n schema: { type: \"number\" },\n examples: [500],\n },\n {\n name: \"y\",\n description: \"Y coordinate to scroll at (optional)\",\n required: false,\n schema: { type: \"number\" },\n examples: [500],\n },\n {\n name: \"direction\",\n description: \"Scroll direction: 'up' or 'down'. Default: 'down'\",\n required: false,\n schema: { type: \"string\" },\n examples: [\"up\", \"down\"],\n },\n {\n name: \"amount\",\n description: \"Number of scroll clicks. Default: 3\",\n required: false,\n schema: { type: \"number\", default: 3, minimum: 1 },\n examples: [3, 5, 10],\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 direction = getStringParam(params, \"direction\") ?? \"down\";\n const amount = getNumberParam(params, \"amount\") ?? 3;\n\n const backend = service.getBackendName();\n\n try {\n await service.scroll(direction, amount, x, y);\n\n const posStr = x !== undefined ? `(${x}, ${y})` : \"current position\";\n const response: Content = {\n text: `Scrolled ${direction} by ${amount} at ${posStr}`,\n actions: [\"COMPUTERUSE_SCROLL\"],\n source: message.content?.source ?? \"action\",\n };\n await callback?.(response);\n return {\n success: true,\n text: response.text ?? \"\",\n values: { x, y, direction, amount },\n data: { x, y, direction, amount, backend },\n };\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n logger.error(`[computeruse] scroll failed: ${msg}`);\n return {\n success: false,\n text: `ComputerUse scroll failed: ${msg}`,\n values: { x, y, direction, amount },\n };\n }\n },\n};\n"]}
|
package/dist/actions/type.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/actions/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EAQP,MAAM,eAAe,CAAC;AAKvB,eAAO,MAAM,qBAAqB,EAAE,MA6GnC,CAAC"}
|
package/dist/actions/type.js
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { logger } from "@elizaos/core";
|
|
2
|
-
import { getBooleanParam, getNumberParam, getStringParam } from "../utils/params.js";
|
|
3
|
-
export const computeruseTypeAction = {
|
|
4
|
-
name: "COMPUTERUSE_TYPE",
|
|
5
|
-
description: "Types text into a UI element on the computer using a ComputerUse selector (optionally clearing the field).",
|
|
6
|
-
similes: ["TYPE_UI", "ENTER_TEXT", "FILL_FIELD"],
|
|
7
|
-
parameters: [
|
|
8
|
-
{
|
|
9
|
-
name: "process",
|
|
10
|
-
description: "Process name to scope the typing 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:Edit && name:Search"],
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
name: "text",
|
|
24
|
-
description: "Text to type",
|
|
25
|
-
required: true,
|
|
26
|
-
schema: { type: "string" },
|
|
27
|
-
examples: ["hello world", "user@example.com{Enter}"],
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
name: "timeoutMs",
|
|
31
|
-
description: "Timeout in milliseconds to find the element",
|
|
32
|
-
required: false,
|
|
33
|
-
schema: { type: "number", default: 5000, minimum: 0 },
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
name: "clearBeforeTyping",
|
|
37
|
-
description: "Whether to clear existing text before typing (default: true)",
|
|
38
|
-
required: false,
|
|
39
|
-
schema: { type: "boolean", default: true },
|
|
40
|
-
},
|
|
41
|
-
],
|
|
42
|
-
validate: async (runtime, message) => {
|
|
43
|
-
const service = runtime.getService("computeruse");
|
|
44
|
-
if (!service || !service.isEnabled())
|
|
45
|
-
return false;
|
|
46
|
-
const text = message.content?.text?.toLowerCase() ?? "";
|
|
47
|
-
return text.includes("type") || text.includes("enter") || text.includes("fill");
|
|
48
|
-
},
|
|
49
|
-
handler: async (runtime, message, _state, options, callback) => {
|
|
50
|
-
const service = runtime.getService("computeruse");
|
|
51
|
-
if (!service) {
|
|
52
|
-
return { success: false, text: "ComputerUse service not available" };
|
|
53
|
-
}
|
|
54
|
-
const params = options?.parameters;
|
|
55
|
-
const process = getStringParam(params, "process");
|
|
56
|
-
const selector = getStringParam(params, "selector");
|
|
57
|
-
const text = getStringParam(params, "text");
|
|
58
|
-
const timeoutMs = getNumberParam(params, "timeoutMs") ?? 5000;
|
|
59
|
-
const clearBeforeTyping = getBooleanParam(params, "clearBeforeTyping") ?? true;
|
|
60
|
-
if (!selector)
|
|
61
|
-
return { success: false, text: "Missing required parameter: selector" };
|
|
62
|
-
if (!text)
|
|
63
|
-
return { success: false, text: "Missing required parameter: text" };
|
|
64
|
-
try {
|
|
65
|
-
await service.typeText(selector, text, timeoutMs, clearBeforeTyping, process);
|
|
66
|
-
const response = {
|
|
67
|
-
text: `Typed into element: ${selector}`,
|
|
68
|
-
actions: ["COMPUTERUSE_TYPE"],
|
|
69
|
-
source: message.content?.source ?? "action",
|
|
70
|
-
};
|
|
71
|
-
await callback?.(response);
|
|
72
|
-
return {
|
|
73
|
-
success: true,
|
|
74
|
-
text: response.text ?? "",
|
|
75
|
-
values: { process, selector, timeoutMs, clearBeforeTyping },
|
|
76
|
-
data: {
|
|
77
|
-
process,
|
|
78
|
-
selector,
|
|
79
|
-
timeoutMs,
|
|
80
|
-
clearBeforeTyping,
|
|
81
|
-
backend: service.getBackendName(),
|
|
82
|
-
},
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
catch (err) {
|
|
86
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
87
|
-
logger.error(`[computeruse] type failed: ${msg}`);
|
|
88
|
-
return {
|
|
89
|
-
success: false,
|
|
90
|
-
text: `ComputerUse type failed: ${msg}`,
|
|
91
|
-
values: { process, selector, timeoutMs, clearBeforeTyping },
|
|
92
|
-
data: {
|
|
93
|
-
process,
|
|
94
|
-
selector,
|
|
95
|
-
timeoutMs,
|
|
96
|
-
clearBeforeTyping,
|
|
97
|
-
backend: service.getBackendName(),
|
|
98
|
-
},
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
};
|
|
103
|
-
//# sourceMappingURL=type.js.map
|
package/dist/actions/type.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../src/actions/type.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAErF,MAAM,CAAC,MAAM,qBAAqB,GAAW;IAC3C,IAAI,EAAE,kBAAkB;IACxB,WAAW,EACT,4GAA4G;IAC9G,OAAO,EAAE,CAAC,SAAS,EAAE,YAAY,EAAE,YAAY,CAAC;IAChD,UAAU,EAAE;QACV;YACE,IAAI,EAAE,SAAS;YACf,WAAW,EACT,iJAAiJ;YACnJ,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,0BAA0B,CAAC;SACvC;QACD;YACE,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,cAAc;YAC3B,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC1B,QAAQ,EAAE,CAAC,aAAa,EAAE,yBAAyB,CAAC;SACrD;QACD;YACE,IAAI,EAAE,WAAW;YACjB,WAAW,EAAE,6CAA6C;YAC1D,QAAQ,EAAE,KAAK;YACf,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAA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;YAClD,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,4BAA4B,GAAG,EAAE;gBACvC,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,iBAAiB,EAAE;gBAC3D,IAAI,EAAE;oBACJ,OAAO;oBACP,QAAQ;oBACR,SAAS;oBACT,iBAAiB;oBACjB,OAAO,EAAE,OAAO,CAAC,cAAc,EAAE;iBAClC;aACF,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 { getBooleanParam, getNumberParam, getStringParam } from \"../utils/params.js\";\n\nexport const computeruseTypeAction: Action = {\n name: \"COMPUTERUSE_TYPE\",\n description:\n \"Types text into a UI element on the computer using a ComputerUse selector (optionally clearing the field).\",\n similes: [\"TYPE_UI\", \"ENTER_TEXT\", \"FILL_FIELD\"],\n parameters: [\n {\n name: \"process\",\n description:\n \"Process name to scope the typing 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:Edit && name:Search\"],\n },\n {\n name: \"text\",\n description: \"Text to type\",\n required: true,\n schema: { type: \"string\" },\n examples: [\"hello world\", \"user@example.com{Enter}\"],\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 },\n {\n name: \"clearBeforeTyping\",\n description: \"Whether to clear existing text before typing (default: true)\",\n required: false,\n schema: { type: \"boolean\", default: true },\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(\"type\") || text.includes(\"enter\") || text.includes(\"fill\");\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 text = getStringParam(params, \"text\");\n const timeoutMs = getNumberParam(params, \"timeoutMs\") ?? 5000;\n const clearBeforeTyping = getBooleanParam(params, \"clearBeforeTyping\") ?? true;\n\n if (!selector) return { success: false, text: \"Missing required parameter: selector\" };\n if (!text) return { success: false, text: \"Missing required parameter: text\" };\n\n try {\n await service.typeText(selector, text, timeoutMs, clearBeforeTyping, process);\n const response: Content = {\n text: `Typed into element: ${selector}`,\n actions: [\"COMPUTERUSE_TYPE\"],\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, clearBeforeTyping },\n data: {\n process,\n selector,\n timeoutMs,\n clearBeforeTyping,\n backend: service.getBackendName(),\n },\n };\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n logger.error(`[computeruse] type failed: ${msg}`);\n return {\n success: false,\n text: `ComputerUse type failed: ${msg}`,\n values: { process, selector, timeoutMs, clearBeforeTyping },\n data: {\n process,\n selector,\n timeoutMs,\n clearBeforeTyping,\n backend: service.getBackendName(),\n },\n };\n }\n },\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"available-apps.d.ts","sourceRoot":"","sources":["../../src/providers/available-apps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,QAAQ,EAAyB,MAAM,eAAe,CAAC;AAG5F,eAAO,MAAM,gCAAgC,EAAE,QAsB9C,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export const computeruseAvailableAppsProvider = {
|
|
2
|
-
name: "COMPUTERUSE_AVAILABLE_APPS",
|
|
3
|
-
description: "Lists currently running applications (best-effort, may be summarized in MCP mode)",
|
|
4
|
-
get: async (runtime, _message, _state) => {
|
|
5
|
-
const service = runtime.getService("computeruse");
|
|
6
|
-
if (!service || !service.isEnabled()) {
|
|
7
|
-
return {
|
|
8
|
-
text: "ComputerUse is disabled",
|
|
9
|
-
values: { enabled: false },
|
|
10
|
-
data: { enabled: false },
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
const apps = await service.getApplications();
|
|
14
|
-
const text = `Running applications (${apps.length}):\n${apps.map((a) => `- ${a}`).join("\n")}`;
|
|
15
|
-
return {
|
|
16
|
-
text,
|
|
17
|
-
values: { enabled: true, count: apps.length },
|
|
18
|
-
data: { enabled: true, apps, count: apps.length, backend: service.getBackendName() },
|
|
19
|
-
};
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=available-apps.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"available-apps.js","sourceRoot":"","sources":["../../src/providers/available-apps.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,gCAAgC,GAAa;IACxD,IAAI,EAAE,4BAA4B;IAClC,WAAW,EAAE,mFAAmF;IAChG,GAAG,EAAE,KAAK,EAAE,OAAsB,EAAE,QAAgB,EAAE,MAAa,EAA2B,EAAE;QAC9F,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAqB,aAAa,CAAC,CAAC;QACtE,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC;YACrC,OAAO;gBACL,IAAI,EAAE,yBAAyB;gBAC/B,MAAM,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;gBAC1B,IAAI,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;aACzB,CAAC;QACJ,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,eAAe,EAAE,CAAC;QAC7C,MAAM,IAAI,GAAG,yBAAyB,IAAI,CAAC,MAAM,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAE/F,OAAO;YACL,IAAI;YACJ,MAAM,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE;YAC7C,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,cAAc,EAAE,EAAE;SACrF,CAAC;IACJ,CAAC;CACF,CAAC","sourcesContent":["import type { IAgentRuntime, Memory, Provider, ProviderResult, State } from \"@elizaos/core\";\nimport type { ComputerUseService } from \"../services/computeruse-service.js\";\n\nexport const computeruseAvailableAppsProvider: Provider = {\n name: \"COMPUTERUSE_AVAILABLE_APPS\",\n description: \"Lists currently running applications (best-effort, may be summarized in MCP mode)\",\n get: async (runtime: IAgentRuntime, _message: Memory, _state: State): Promise<ProviderResult> => {\n const service = runtime.getService<ComputerUseService>(\"computeruse\");\n if (!service || !service.isEnabled()) {\n return {\n text: \"ComputerUse is disabled\",\n values: { enabled: false },\n data: { enabled: false },\n };\n }\n\n const apps = await service.getApplications();\n const text = `Running applications (${apps.length}):\\n${apps.map((a) => `- ${a}`).join(\"\\n\")}`;\n\n return {\n text,\n values: { enabled: true, count: apps.length },\n data: { enabled: true, apps, count: apps.length, backend: service.getBackendName() },\n };\n },\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"computeruse-state.d.ts","sourceRoot":"","sources":["../../src/providers/computeruse-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,QAAQ,EAAyB,MAAM,eAAe,CAAC;AAG5F,eAAO,MAAM,wBAAwB,EAAE,QAmCtC,CAAC"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export const computeruseStateProvider = {
|
|
2
|
-
name: "COMPUTERUSE_STATE",
|
|
3
|
-
description: "Provides current ComputerUse backend/mode information",
|
|
4
|
-
get: async (runtime, _message, _state) => {
|
|
5
|
-
const service = runtime.getService("computeruse");
|
|
6
|
-
if (!service || !service.isEnabled()) {
|
|
7
|
-
return {
|
|
8
|
-
text: "ComputerUse is disabled",
|
|
9
|
-
values: { enabled: false },
|
|
10
|
-
data: { enabled: false },
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
const backend = service.getBackendName();
|
|
14
|
-
const mode = service.getMode();
|
|
15
|
-
const mcpServer = service.getMcpServerName();
|
|
16
|
-
return {
|
|
17
|
-
text: `ComputerUse enabled. Mode=${mode}. Backend=${backend ?? "none"}. Platform=${process.platform}.`,
|
|
18
|
-
values: {
|
|
19
|
-
enabled: true,
|
|
20
|
-
mode,
|
|
21
|
-
backend: backend ?? "none",
|
|
22
|
-
platform: process.platform,
|
|
23
|
-
mcpServer,
|
|
24
|
-
},
|
|
25
|
-
data: {
|
|
26
|
-
enabled: true,
|
|
27
|
-
mode,
|
|
28
|
-
backend,
|
|
29
|
-
platform: process.platform,
|
|
30
|
-
mcpServer,
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
//# sourceMappingURL=computeruse-state.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"computeruse-state.js","sourceRoot":"","sources":["../../src/providers/computeruse-state.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,wBAAwB,GAAa;IAChD,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,uDAAuD;IACpE,GAAG,EAAE,KAAK,EAAE,OAAsB,EAAE,QAAgB,EAAE,MAAa,EAA2B,EAAE;QAC9F,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAqB,aAAa,CAAC,CAAC;QACtE,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC;YACrC,OAAO;gBACL,IAAI,EAAE,yBAAyB;gBAC/B,MAAM,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;gBAC1B,IAAI,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;aACzB,CAAC;QACJ,CAAC;QAED,MAAM,OAAO,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;QACzC,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;QAC/B,MAAM,SAAS,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;QAE7C,OAAO;YACL,IAAI,EAAE,6BAA6B,IAAI,aAAa,OAAO,IAAI,MAAM,cAAc,OAAO,CAAC,QAAQ,GAAG;YACtG,MAAM,EAAE;gBACN,OAAO,EAAE,IAAI;gBACb,IAAI;gBACJ,OAAO,EAAE,OAAO,IAAI,MAAM;gBAC1B,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,SAAS;aACV;YACD,IAAI,EAAE;gBACJ,OAAO,EAAE,IAAI;gBACb,IAAI;gBACJ,OAAO;gBACP,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,SAAS;aACV;SACF,CAAC;IACJ,CAAC;CACF,CAAC","sourcesContent":["import type { IAgentRuntime, Memory, Provider, ProviderResult, State } from \"@elizaos/core\";\nimport type { ComputerUseService } from \"../services/computeruse-service.js\";\n\nexport const computeruseStateProvider: Provider = {\n name: \"COMPUTERUSE_STATE\",\n description: \"Provides current ComputerUse backend/mode information\",\n get: async (runtime: IAgentRuntime, _message: Memory, _state: State): Promise<ProviderResult> => {\n const service = runtime.getService<ComputerUseService>(\"computeruse\");\n if (!service || !service.isEnabled()) {\n return {\n text: \"ComputerUse is disabled\",\n values: { enabled: false },\n data: { enabled: false },\n };\n }\n\n const backend = service.getBackendName();\n const mode = service.getMode();\n const mcpServer = service.getMcpServerName();\n\n return {\n text: `ComputerUse enabled. Mode=${mode}. Backend=${backend ?? \"none\"}. Platform=${process.platform}.`,\n values: {\n enabled: true,\n mode,\n backend: backend ?? \"none\",\n platform: process.platform,\n mcpServer,\n },\n data: {\n enabled: true,\n mode,\n backend,\n platform: process.platform,\n mcpServer,\n },\n };\n },\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"service-registry.d.ts","sourceRoot":"","sources":["../src/service-registry.ts"],"names":[],"mappings":"AAEA,OAAO,QAAQ,eAAe,CAAC;IAC7B,UAAU,mBAAmB;QAC3B,WAAW,EAAE,aAAa,CAAC;KAC5B;CACF;AAED,eAAO,MAAM,wBAAwB,EAAG,aAAsB,CAAC"}
|
package/dist/service-registry.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"service-registry.js","sourceRoot":"","sources":["../src/service-registry.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,wBAAwB,GAAG,aAAsB,CAAC","sourcesContent":["// Module augmentation: add COMPUTERUSE to the core service registry so\n// `runtime.getServiceLoadPromise(\"computeruse\")` is type-safe.\ndeclare module \"@elizaos/core\" {\n interface ServiceTypeRegistry {\n COMPUTERUSE: \"computeruse\";\n }\n}\n\nexport const COMPUTERUSE_SERVICE_TYPE = \"computeruse\" as const;\n"]}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { IAgentRuntime } from "@elizaos/core";
|
|
2
|
-
import { Service } from "@elizaos/core";
|
|
3
|
-
import { type ComputerUseBackendName, type ComputerUseConfig } from "../types.js";
|
|
4
|
-
export declare class ComputerUseService extends Service {
|
|
5
|
-
static serviceType: string;
|
|
6
|
-
capabilityDescription: string;
|
|
7
|
-
private computeruseConfig;
|
|
8
|
-
private backendName;
|
|
9
|
-
private initialized;
|
|
10
|
-
private localDesktop;
|
|
11
|
-
constructor(runtime?: IAgentRuntime);
|
|
12
|
-
static start(runtime: IAgentRuntime): Promise<ComputerUseService>;
|
|
13
|
-
stop(): Promise<void>;
|
|
14
|
-
getMode(): ComputerUseConfig["COMPUTERUSE_MODE"];
|
|
15
|
-
getBackendName(): ComputerUseBackendName | null;
|
|
16
|
-
getMcpServerName(): string;
|
|
17
|
-
isEnabled(): boolean;
|
|
18
|
-
ensureReady(): Promise<void>;
|
|
19
|
-
private initializeBackend;
|
|
20
|
-
private ensureLocalBackend;
|
|
21
|
-
private ensureMcpBackend;
|
|
22
|
-
private waitForMcpService;
|
|
23
|
-
private getMcp;
|
|
24
|
-
private parseProcessScopedSelector;
|
|
25
|
-
openApplication(appName: string): Promise<void>;
|
|
26
|
-
click(selector: string, timeoutMs: number, process?: string): Promise<void>;
|
|
27
|
-
typeText(selector: string, text: string, timeoutMs: number, clearBeforeTyping: boolean, process?: string): Promise<void>;
|
|
28
|
-
getWindowTree(process: string, title?: string, maxDepth?: number): Promise<string>;
|
|
29
|
-
clickCoordinates(x: number, y: number, button?: string, numClicks?: number): Promise<void>;
|
|
30
|
-
pressKey(keys: string): Promise<void>;
|
|
31
|
-
scroll(direction?: string, amount?: number, x?: number, y?: number): Promise<void>;
|
|
32
|
-
drag(startX: number, startY: number, endX: number, endY: number): Promise<void>;
|
|
33
|
-
screenshot(): Promise<string>;
|
|
34
|
-
getApplications(): Promise<string[]>;
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=computeruse-service.d.ts.map
|