@elizaos/plugin-computeruse 2.0.0-alpha.9 → 2.0.3-beta.2

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.
Files changed (71) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +80 -0
  3. package/package.json +126 -103
  4. package/dist/actions/click-coordinates.d.ts +0 -3
  5. package/dist/actions/click-coordinates.d.ts.map +0 -1
  6. package/dist/actions/click-coordinates.js +0 -139
  7. package/dist/actions/click-coordinates.js.map +0 -1
  8. package/dist/actions/click.d.ts +0 -3
  9. package/dist/actions/click.d.ts.map +0 -1
  10. package/dist/actions/click.js +0 -144
  11. package/dist/actions/click.js.map +0 -1
  12. package/dist/actions/drag.d.ts +0 -3
  13. package/dist/actions/drag.d.ts.map +0 -1
  14. package/dist/actions/drag.js +0 -145
  15. package/dist/actions/drag.js.map +0 -1
  16. package/dist/actions/get-applications.d.ts +0 -3
  17. package/dist/actions/get-applications.d.ts.map +0 -1
  18. package/dist/actions/get-applications.js +0 -105
  19. package/dist/actions/get-applications.js.map +0 -1
  20. package/dist/actions/get-window-tree.d.ts +0 -3
  21. package/dist/actions/get-window-tree.d.ts.map +0 -1
  22. package/dist/actions/get-window-tree.js +0 -133
  23. package/dist/actions/get-window-tree.js.map +0 -1
  24. package/dist/actions/open-application.d.ts +0 -3
  25. package/dist/actions/open-application.d.ts.map +0 -1
  26. package/dist/actions/open-application.js +0 -117
  27. package/dist/actions/open-application.js.map +0 -1
  28. package/dist/actions/press-key.d.ts +0 -3
  29. package/dist/actions/press-key.d.ts.map +0 -1
  30. package/dist/actions/press-key.js +0 -115
  31. package/dist/actions/press-key.js.map +0 -1
  32. package/dist/actions/screenshot.d.ts +0 -3
  33. package/dist/actions/screenshot.d.ts.map +0 -1
  34. package/dist/actions/screenshot.js +0 -99
  35. package/dist/actions/screenshot.js.map +0 -1
  36. package/dist/actions/scroll.d.ts +0 -3
  37. package/dist/actions/scroll.d.ts.map +0 -1
  38. package/dist/actions/scroll.js +0 -137
  39. package/dist/actions/scroll.js.map +0 -1
  40. package/dist/actions/type.d.ts +0 -3
  41. package/dist/actions/type.d.ts.map +0 -1
  42. package/dist/actions/type.js +0 -163
  43. package/dist/actions/type.js.map +0 -1
  44. package/dist/index.d.ts +0 -8
  45. package/dist/index.d.ts.map +0 -1
  46. package/dist/index.js +0 -66
  47. package/dist/index.js.map +0 -1
  48. package/dist/providers/available-apps.d.ts +0 -3
  49. package/dist/providers/available-apps.d.ts.map +0 -1
  50. package/dist/providers/available-apps.js +0 -28
  51. package/dist/providers/available-apps.js.map +0 -1
  52. package/dist/providers/computeruse-state.d.ts +0 -3
  53. package/dist/providers/computeruse-state.d.ts.map +0 -1
  54. package/dist/providers/computeruse-state.js +0 -36
  55. package/dist/providers/computeruse-state.js.map +0 -1
  56. package/dist/service-registry.d.ts +0 -7
  57. package/dist/service-registry.d.ts.map +0 -1
  58. package/dist/service-registry.js +0 -2
  59. package/dist/service-registry.js.map +0 -1
  60. package/dist/services/computeruse-service.d.ts +0 -36
  61. package/dist/services/computeruse-service.d.ts.map +0 -1
  62. package/dist/services/computeruse-service.js +0 -391
  63. package/dist/services/computeruse-service.js.map +0 -1
  64. package/dist/types.d.ts +0 -41
  65. package/dist/types.d.ts.map +0 -1
  66. package/dist/types.js +0 -11
  67. package/dist/types.js.map +0 -1
  68. package/dist/utils/params.d.ts +0 -5
  69. package/dist/utils/params.d.ts.map +0 -1
  70. package/dist/utils/params.js +0 -13
  71. package/dist/utils/params.js.map +0 -1
@@ -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;IAC9C,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,8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,8BAA8B,GAAG,EAAE;gBACzC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,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 computeruseScrollAction: Action = {\n\tname: \"COMPUTERUSE_SCROLL\",\n\tdescription: \"Scroll the mouse wheel at the current or specified position.\",\n\tsimiles: [\"SCROLL\", \"SCROLL_UP\", \"SCROLL_DOWN\", \"MOUSE_SCROLL\"],\n\tparameters: [\n\t\t{\n\t\t\tname: \"x\",\n\t\t\tdescription: \"X coordinate to scroll at (optional)\",\n\t\t\trequired: false,\n\t\t\tschema: { type: \"number\" },\n\t\t\texamples: [500],\n\t\t},\n\t\t{\n\t\t\tname: \"y\",\n\t\t\tdescription: \"Y coordinate to scroll at (optional)\",\n\t\t\trequired: false,\n\t\t\tschema: { type: \"number\" },\n\t\t\texamples: [500],\n\t\t},\n\t\t{\n\t\t\tname: \"direction\",\n\t\t\tdescription: \"Scroll direction: 'up' or 'down'. Default: 'down'\",\n\t\t\trequired: false,\n\t\t\tschema: { type: \"string\" },\n\t\t\texamples: [\"up\", \"down\"],\n\t\t},\n\t\t{\n\t\t\tname: \"amount\",\n\t\t\tdescription: \"Number of scroll clicks. Default: 3\",\n\t\t\trequired: false,\n\t\t\tschema: { type: \"number\", default: 3, minimum: 1 },\n\t\t\texamples: [3, 5, 10],\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\", \"scroll\"];\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|scroll)\\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\", \"scroll\"];\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|scroll)\\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 direction = getStringParam(params, \"direction\") ?? \"down\";\n\t\tconst amount = getNumberParam(params, \"amount\") ?? 3;\n\n\t\tconst backend = service.getBackendName();\n\n\t\ttry {\n\t\t\tawait service.scroll(direction, amount, x, y);\n\n\t\t\tconst posStr = x !== undefined ? `(${x}, ${y})` : \"current position\";\n\t\t\tconst response: Content = {\n\t\t\t\ttext: `Scrolled ${direction} by ${amount} at ${posStr}`,\n\t\t\t\tactions: [\"COMPUTERUSE_SCROLL\"],\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, direction, amount },\n\t\t\t\tdata: { x, y, direction, amount, 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] scroll failed: ${msg}`);\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\ttext: `ComputerUse scroll failed: ${msg}`,\n\t\t\t\tvalues: { x, y, direction, amount },\n\t\t\t};\n\t\t}\n\t},\n};\n"]}
@@ -1,3 +0,0 @@
1
- import type { Action } from "@elizaos/core";
2
- export declare const computeruseTypeAction: Action;
3
- //# sourceMappingURL=type.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/actions/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,MAAM,EAQN,MAAM,eAAe,CAAC;AASvB,eAAO,MAAM,qBAAqB,EAAE,MAsNnC,CAAC"}
@@ -1,163 +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, state, options) => {
43
- const __avTextRaw = typeof message?.content?.text === "string" ? message.content.text : "";
44
- const __avText = __avTextRaw.toLowerCase();
45
- const __avKeywords = ["computeruse", "type"];
46
- const __avKeywordOk = __avKeywords.length > 0 &&
47
- __avKeywords.some((word) => word.length > 0 && __avText.includes(word));
48
- const __avRegex = /\b(?:computeruse|type)\b/i;
49
- const __avRegexOk = __avRegex.test(__avText);
50
- const __avSource = String(message?.content?.source ?? message?.source ?? "");
51
- const __avExpectedSource = "";
52
- const __avSourceOk = __avExpectedSource
53
- ? __avSource === __avExpectedSource
54
- : Boolean(__avSource ||
55
- state ||
56
- runtime?.agentId ||
57
- runtime?.getService ||
58
- runtime?.getSetting);
59
- const __avOptions = options && typeof options === "object" ? options : {};
60
- const __avInputOk = __avText.trim().length > 0 ||
61
- Object.keys(__avOptions).length > 0 ||
62
- Boolean(message?.content && typeof message.content === "object");
63
- if (!(__avKeywordOk && __avRegexOk && __avSourceOk && __avInputOk)) {
64
- return false;
65
- }
66
- const __avLegacyValidate = async (runtime, message, state, options) => {
67
- const __avTextRaw = typeof message?.content?.text === "string" ? message.content.text : "";
68
- const __avText = __avTextRaw.toLowerCase();
69
- const __avKeywords = ["computeruse", "type"];
70
- const __avKeywordOk = __avKeywords.length > 0 &&
71
- __avKeywords.some((kw) => kw.length > 0 && __avText.includes(kw));
72
- const __avRegex = /\b(?:computeruse|type)\b/i;
73
- const __avRegexOk = __avRegex.test(__avText);
74
- const __avSource = String(message?.content?.source ?? message?.source ?? "");
75
- const __avExpectedSource = "";
76
- const __avSourceOk = __avExpectedSource
77
- ? __avSource === __avExpectedSource
78
- : Boolean(__avSource || state || runtime?.agentId || runtime?.getService);
79
- const __avOptions = options && typeof options === "object" ? options : {};
80
- const __avInputOk = __avText.trim().length > 0 ||
81
- Object.keys(__avOptions).length > 0 ||
82
- Boolean(message?.content && typeof message.content === "object");
83
- if (!(__avKeywordOk && __avRegexOk && __avSourceOk && __avInputOk)) {
84
- return false;
85
- }
86
- const __avLegacyValidate = async (runtime, message) => {
87
- const service = runtime.getService("computeruse");
88
- if (!service || !service.isEnabled())
89
- return false;
90
- const text = message.content?.text?.toLowerCase() ?? "";
91
- return (text.includes("type") ||
92
- text.includes("enter") ||
93
- text.includes("fill"));
94
- };
95
- try {
96
- return Boolean(await __avLegacyValidate(runtime, message, state, options));
97
- }
98
- catch {
99
- return false;
100
- }
101
- };
102
- try {
103
- return Boolean(await __avLegacyValidate(runtime, message, state, options));
104
- }
105
- catch {
106
- return false;
107
- }
108
- },
109
- handler: async (runtime, message, _state, options, callback) => {
110
- const service = runtime.getService("computeruse");
111
- if (!service) {
112
- return { success: false, text: "ComputerUse service not available" };
113
- }
114
- const params = options?.parameters;
115
- const process = getStringParam(params, "process");
116
- const selector = getStringParam(params, "selector");
117
- const text = getStringParam(params, "text");
118
- const timeoutMs = getNumberParam(params, "timeoutMs") ?? 5000;
119
- const clearBeforeTyping = getBooleanParam(params, "clearBeforeTyping") ?? true;
120
- if (!selector)
121
- return { success: false, text: "Missing required parameter: selector" };
122
- if (!text)
123
- return { success: false, text: "Missing required parameter: text" };
124
- try {
125
- await service.typeText(selector, text, timeoutMs, clearBeforeTyping, process);
126
- const response = {
127
- text: `Typed into element: ${selector}`,
128
- actions: ["COMPUTERUSE_TYPE"],
129
- source: message.content?.source ?? "action",
130
- };
131
- await callback?.(response);
132
- return {
133
- success: true,
134
- text: response.text ?? "",
135
- values: { process, selector, timeoutMs, clearBeforeTyping },
136
- data: {
137
- process,
138
- selector,
139
- timeoutMs,
140
- clearBeforeTyping,
141
- backend: service.getBackendName(),
142
- },
143
- };
144
- }
145
- catch (err) {
146
- const msg = err instanceof Error ? err.message : String(err);
147
- logger.error(`[computeruse] type failed: ${msg}`);
148
- return {
149
- success: false,
150
- text: `ComputerUse type failed: ${msg}`,
151
- values: { process, selector, timeoutMs, clearBeforeTyping },
152
- data: {
153
- process,
154
- selector,
155
- timeoutMs,
156
- clearBeforeTyping,
157
- backend: service.getBackendName(),
158
- },
159
- };
160
- }
161
- },
162
- };
163
- //# sourceMappingURL=type.js.map
@@ -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,EACN,eAAe,EACf,cAAc,EACd,cAAc,GACd,MAAM,oBAAoB,CAAC;AAE5B,MAAM,CAAC,MAAM,qBAAqB,GAAW;IAC5C,IAAI,EAAE,kBAAkB;IACxB,WAAW,EACV,4GAA4G;IAC7G,OAAO,EAAE,CAAC,SAAS,EAAE,YAAY,EAAE,YAAY,CAAC;IAChD,UAAU,EAAE;QACX;YACC,IAAI,EAAE,SAAS;YACf,WAAW,EACV,iJAAiJ;YAClJ,QAAQ,EAAE,KAAK;YACf,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC1B,QAAQ,EAAE,CAAC,QAAQ,EAAE,SAAS,C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AAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC7D,MAAM,CAAC,KAAK,CAAC,8BAA8B,GAAG,EAAE,CAAC,CAAC;YAClD,OAAO;gBACN,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,4BAA4B,GAAG,EAAE;gBACvC,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,iBAAiB,EAAE;gBAC3D,IAAI,EAAE;oBACL,OAAO;oBACP,QAAQ;oBACR,SAAS;oBACT,iBAAiB;oBACjB,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 {\n\tgetBooleanParam,\n\tgetNumberParam,\n\tgetStringParam,\n} from \"../utils/params.js\";\n\nexport const computeruseTypeAction: Action = {\n\tname: \"COMPUTERUSE_TYPE\",\n\tdescription:\n\t\t\"Types text into a UI element on the computer using a ComputerUse selector (optionally clearing the field).\",\n\tsimiles: [\"TYPE_UI\", \"ENTER_TEXT\", \"FILL_FIELD\"],\n\tparameters: [\n\t\t{\n\t\t\tname: \"process\",\n\t\t\tdescription:\n\t\t\t\t\"Process name to scope the typing 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:Edit && name:Search\"],\n\t\t},\n\t\t{\n\t\t\tname: \"text\",\n\t\t\tdescription: \"Text to type\",\n\t\t\trequired: true,\n\t\t\tschema: { type: \"string\" },\n\t\t\texamples: [\"hello world\", \"user@example.com{Enter}\"],\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},\n\t\t{\n\t\t\tname: \"clearBeforeTyping\",\n\t\t\tdescription:\n\t\t\t\t\"Whether to clear existing text before typing (default: true)\",\n\t\t\trequired: false,\n\t\t\tschema: { type: \"boolean\", default: true },\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\", \"type\"];\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|type)\\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\", \"type\"];\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|type)\\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 (\n\t\t\t\t\ttext.includes(\"type\") ||\n\t\t\t\t\ttext.includes(\"enter\") ||\n\t\t\t\t\ttext.includes(\"fill\")\n\t\t\t\t);\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 text = getStringParam(params, \"text\");\n\t\tconst timeoutMs = getNumberParam(params, \"timeoutMs\") ?? 5000;\n\t\tconst clearBeforeTyping =\n\t\t\tgetBooleanParam(params, \"clearBeforeTyping\") ?? true;\n\n\t\tif (!selector)\n\t\t\treturn { success: false, text: \"Missing required parameter: selector\" };\n\t\tif (!text)\n\t\t\treturn { success: false, text: \"Missing required parameter: text\" };\n\n\t\ttry {\n\t\t\tawait service.typeText(\n\t\t\t\tselector,\n\t\t\t\ttext,\n\t\t\t\ttimeoutMs,\n\t\t\t\tclearBeforeTyping,\n\t\t\t\tprocess,\n\t\t\t);\n\t\t\tconst response: Content = {\n\t\t\t\ttext: `Typed into element: ${selector}`,\n\t\t\t\tactions: [\"COMPUTERUSE_TYPE\"],\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, clearBeforeTyping },\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\tclearBeforeTyping,\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] type failed: ${msg}`);\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\ttext: `ComputerUse type failed: ${msg}`,\n\t\t\t\tvalues: { process, selector, timeoutMs, clearBeforeTyping },\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\tclearBeforeTyping,\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/index.d.ts DELETED
@@ -1,8 +0,0 @@
1
- import type { Plugin } from "@elizaos/core";
2
- import "./service-registry.js";
3
- import { ComputerUseService } from "./services/computeruse-service.js";
4
- export * from "./types.js";
5
- export { ComputerUseService };
6
- export declare const computerusePlugin: Plugin;
7
- export default computerusePlugin;
8
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,MAAM,EAAE,MAAM,eAAe,CAAC;AAG3D,OAAO,uBAAuB,CAAC;AAa/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAEvE,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAY9B,eAAO,MAAM,iBAAiB,EAAE,MAuC/B,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
package/dist/index.js DELETED
@@ -1,66 +0,0 @@
1
- import { logger } from "@elizaos/core";
2
- import { z } from "zod";
3
- import "./service-registry.js";
4
- import { computeruseClickAction } from "./actions/click.js";
5
- import { computeruseClickCoordinatesAction } from "./actions/click-coordinates.js";
6
- import { computeruseDragAction } from "./actions/drag.js";
7
- import { computeruseGetApplicationsAction } from "./actions/get-applications.js";
8
- import { computeruseGetWindowTreeAction } from "./actions/get-window-tree.js";
9
- import { computeruseOpenApplicationAction } from "./actions/open-application.js";
10
- import { computerusePressKeyAction } from "./actions/press-key.js";
11
- import { computeruseScreenshotAction } from "./actions/screenshot.js";
12
- import { computeruseScrollAction } from "./actions/scroll.js";
13
- import { computeruseTypeAction } from "./actions/type.js";
14
- import { computeruseAvailableAppsProvider } from "./providers/available-apps.js";
15
- import { computeruseStateProvider } from "./providers/computeruse-state.js";
16
- import { ComputerUseService } from "./services/computeruse-service.js";
17
- export * from "./types.js";
18
- export { ComputerUseService };
19
- const configSchema = z.object({
20
- COMPUTERUSE_ENABLED: z
21
- .string()
22
- .optional()
23
- .default("false")
24
- .transform((val) => val === "true"),
25
- COMPUTERUSE_MODE: z.enum(["auto", "local", "mcp"]).optional().default("auto"),
26
- COMPUTERUSE_MCP_SERVER: z.string().optional().default("computeruse"),
27
- });
28
- export const computerusePlugin = {
29
- name: "plugin-computeruse",
30
- description: "Computer automation plugin (local or MCP)",
31
- config: {
32
- COMPUTERUSE_ENABLED: process.env.COMPUTERUSE_ENABLED ?? "true",
33
- COMPUTERUSE_MODE: process.env.COMPUTERUSE_MODE ?? "auto",
34
- COMPUTERUSE_MCP_SERVER: process.env.COMPUTERUSE_MCP_SERVER ?? "computeruse",
35
- },
36
- async init(config, _runtime) {
37
- logger.info("Initializing computeruse plugin");
38
- // Auto-enable when the plugin is loaded — the plugin being present in
39
- // the runtime means the user toggled it on via the Capabilities UI.
40
- const configWithDefaults = {
41
- ...config,
42
- COMPUTERUSE_ENABLED: config.COMPUTERUSE_ENABLED ?? "true",
43
- };
44
- const validated = await configSchema.parseAsync(configWithDefaults);
45
- for (const [key, value] of Object.entries(validated)) {
46
- process.env[key] = String(value);
47
- }
48
- },
49
- services: [ComputerUseService],
50
- actions: [
51
- computeruseOpenApplicationAction,
52
- computeruseClickAction,
53
- computeruseClickCoordinatesAction,
54
- computeruseTypeAction,
55
- computerusePressKeyAction,
56
- computeruseScrollAction,
57
- computeruseDragAction,
58
- computeruseScreenshotAction,
59
- computeruseGetApplicationsAction,
60
- computeruseGetWindowTreeAction,
61
- ],
62
- providers: [computeruseStateProvider, computeruseAvailableAppsProvider],
63
- dependencies: ["mcp"],
64
- };
65
- export default computerusePlugin;
66
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,uBAAuB,CAAC;AAC/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,iCAAiC,EAAE,MAAM,gCAAgC,CAAC;AACnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,gCAAgC,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,EAAE,8BAA8B,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAE,gCAAgC,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM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AG;YAC1B,GAAG,MAAM;YACT,mBAAmB,EAAE,MAAM,CAAC,mBAAmB,IAAI,MAAM;SACzD,CAAC;QACF,MAAM,SAAS,GAAG,MAAM,YAAY,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;QACpE,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;YACtD,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAClC,CAAC;IACF,CAAC;IACD,QAAQ,EAAE,CAAC,kBAAkB,CAAC;IAC9B,OAAO,EAAE;QACR,gCAAgC;QAChC,sBAAsB;QACtB,iCAAiC;QACjC,qBAAqB;QACrB,yBAAyB;QACzB,uBAAuB;QACvB,qBAAqB;QACrB,2BAA2B;QAC3B,gCAAgC;QAChC,8BAA8B;KAC9B;IACD,SAAS,EAAE,CAAC,wBAAwB,EAAE,gCAAgC,CAAC;IACvE,YAAY,EAAE,CAAC,KAAK,CAAC;CACrB,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["import type { IAgentRuntime, Plugin } from \"@elizaos/core\";\nimport { logger } from \"@elizaos/core\";\nimport { z } from \"zod\";\nimport \"./service-registry.js\";\nimport { computeruseClickAction } from \"./actions/click.js\";\nimport { computeruseClickCoordinatesAction } from \"./actions/click-coordinates.js\";\nimport { computeruseDragAction } from \"./actions/drag.js\";\nimport { computeruseGetApplicationsAction } from \"./actions/get-applications.js\";\nimport { computeruseGetWindowTreeAction } from \"./actions/get-window-tree.js\";\nimport { computeruseOpenApplicationAction } from \"./actions/open-application.js\";\nimport { computerusePressKeyAction } from \"./actions/press-key.js\";\nimport { computeruseScreenshotAction } from \"./actions/screenshot.js\";\nimport { computeruseScrollAction } from \"./actions/scroll.js\";\nimport { computeruseTypeAction } from \"./actions/type.js\";\nimport { computeruseAvailableAppsProvider } from \"./providers/available-apps.js\";\nimport { computeruseStateProvider } from \"./providers/computeruse-state.js\";\nimport { ComputerUseService } from \"./services/computeruse-service.js\";\n\nexport * from \"./types.js\";\nexport { ComputerUseService };\n\nconst configSchema = z.object({\n\tCOMPUTERUSE_ENABLED: z\n\t\t.string()\n\t\t.optional()\n\t\t.default(\"false\")\n\t\t.transform((val) => val === \"true\"),\n\tCOMPUTERUSE_MODE: z.enum([\"auto\", \"local\", \"mcp\"]).optional().default(\"auto\"),\n\tCOMPUTERUSE_MCP_SERVER: z.string().optional().default(\"computeruse\"),\n});\n\nexport const computerusePlugin: Plugin = {\n\tname: \"plugin-computeruse\",\n\tdescription: \"Computer automation plugin (local or MCP)\",\n\tconfig: {\n\t\tCOMPUTERUSE_ENABLED: process.env.COMPUTERUSE_ENABLED ?? \"true\",\n\t\tCOMPUTERUSE_MODE: process.env.COMPUTERUSE_MODE ?? \"auto\",\n\t\tCOMPUTERUSE_MCP_SERVER: process.env.COMPUTERUSE_MCP_SERVER ?? \"computeruse\",\n\t},\n\tasync init(\n\t\tconfig: Record<string, string>,\n\t\t_runtime: IAgentRuntime,\n\t): Promise<void> {\n\t\tlogger.info(\"Initializing computeruse plugin\");\n\t\t// Auto-enable when the plugin is loaded — the plugin being present in\n\t\t// the runtime means the user toggled it on via the Capabilities UI.\n\t\tconst configWithDefaults = {\n\t\t\t...config,\n\t\t\tCOMPUTERUSE_ENABLED: config.COMPUTERUSE_ENABLED ?? \"true\",\n\t\t};\n\t\tconst validated = await configSchema.parseAsync(configWithDefaults);\n\t\tfor (const [key, value] of Object.entries(validated)) {\n\t\t\tprocess.env[key] = String(value);\n\t\t}\n\t},\n\tservices: [ComputerUseService],\n\tactions: [\n\t\tcomputeruseOpenApplicationAction,\n\t\tcomputeruseClickAction,\n\t\tcomputeruseClickCoordinatesAction,\n\t\tcomputeruseTypeAction,\n\t\tcomputerusePressKeyAction,\n\t\tcomputeruseScrollAction,\n\t\tcomputeruseDragAction,\n\t\tcomputeruseScreenshotAction,\n\t\tcomputeruseGetApplicationsAction,\n\t\tcomputeruseGetWindowTreeAction,\n\t],\n\tproviders: [computeruseStateProvider, computeruseAvailableAppsProvider],\n\tdependencies: [\"mcp\"],\n};\n\nexport default computerusePlugin;\n"]}
@@ -1,3 +0,0 @@
1
- import type { Provider } from "@elizaos/core";
2
- export declare const computeruseAvailableAppsProvider: Provider;
3
- //# sourceMappingURL=available-apps.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"available-apps.d.ts","sourceRoot":"","sources":["../../src/providers/available-apps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGX,QAAQ,EAGR,MAAM,eAAe,CAAC;AAGvB,eAAO,MAAM,gCAAgC,EAAE,QAiC9C,CAAC"}
@@ -1,28 +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
- dynamic: true,
5
- get: async (runtime, _message, _state) => {
6
- const service = runtime.getService("computeruse");
7
- if (!service || !service.isEnabled()) {
8
- return {
9
- text: "ComputerUse is disabled",
10
- values: { enabled: false },
11
- data: { enabled: false },
12
- };
13
- }
14
- const apps = await service.getApplications();
15
- const text = `Running applications (${apps.length}):\n${apps.map((app) => `- ${app}`).join("\n")}`;
16
- return {
17
- text,
18
- values: { enabled: true, count: apps.length },
19
- data: {
20
- enabled: true,
21
- apps,
22
- count: apps.length,
23
- backend: service.getBackendName(),
24
- },
25
- };
26
- },
27
- };
28
- //# sourceMappingURL=available-apps.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"available-apps.js","sourceRoot":"","sources":["../../src/providers/available-apps.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,MAAM,gCAAgC,GAAa;IACzD,IAAI,EAAE,4BAA4B;IAClC,WAAW,EACV,mFAAmF;IACpF,OAAO,EAAE,IAAI;IACb,GAAG,EAAE,KAAK,EACT,OAAsB,EACtB,QAAgB,EAChB,MAAa,EACa,EAAE;QAC5B,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAqB,aAAa,CAAC,CAAC;QACtE,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC;YACtC,OAAO;gBACN,IAAI,EAAE,yBAAyB;gBAC/B,MAAM,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;gBAC1B,IAAI,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;aACxB,CAAC;QACH,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,GAAG,EAAE,EAAE,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAEnG,OAAO;YACN,IAAI;YACJ,MAAM,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE;YAC7C,IAAI,EAAE;gBACL,OAAO,EAAE,IAAI;gBACb,IAAI;gBACJ,KAAK,EAAE,IAAI,CAAC,MAAM;gBAClB,OAAO,EAAE,OAAO,CAAC,cAAc,EAAE;aACjC;SACD,CAAC;IACH,CAAC;CACD,CAAC","sourcesContent":["import type {\n\tIAgentRuntime,\n\tMemory,\n\tProvider,\n\tProviderResult,\n\tState,\n} from \"@elizaos/core\";\nimport type { ComputerUseService } from \"../services/computeruse-service.js\";\n\nexport const computeruseAvailableAppsProvider: Provider = {\n\tname: \"COMPUTERUSE_AVAILABLE_APPS\",\n\tdescription:\n\t\t\"Lists currently running applications (best-effort, may be summarized in MCP mode)\",\n\tdynamic: true,\n\tget: async (\n\t\truntime: IAgentRuntime,\n\t\t_message: Memory,\n\t\t_state: State,\n\t): Promise<ProviderResult> => {\n\t\tconst service = runtime.getService<ComputerUseService>(\"computeruse\");\n\t\tif (!service || !service.isEnabled()) {\n\t\t\treturn {\n\t\t\t\ttext: \"ComputerUse is disabled\",\n\t\t\t\tvalues: { enabled: false },\n\t\t\t\tdata: { enabled: false },\n\t\t\t};\n\t\t}\n\n\t\tconst apps = await service.getApplications();\n\t\tconst text = `Running applications (${apps.length}):\\n${apps.map((app) => `- ${app}`).join(\"\\n\")}`;\n\n\t\treturn {\n\t\t\ttext,\n\t\t\tvalues: { enabled: true, count: apps.length },\n\t\t\tdata: {\n\t\t\t\tenabled: true,\n\t\t\t\tapps,\n\t\t\t\tcount: apps.length,\n\t\t\t\tbackend: service.getBackendName(),\n\t\t\t},\n\t\t};\n\t},\n};\n"]}
@@ -1,3 +0,0 @@
1
- import type { Provider } from "@elizaos/core";
2
- export declare const computeruseStateProvider: Provider;
3
- //# sourceMappingURL=computeruse-state.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"computeruse-state.d.ts","sourceRoot":"","sources":["../../src/providers/computeruse-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGX,QAAQ,EAGR,MAAM,eAAe,CAAC;AAGvB,eAAO,MAAM,wBAAwB,EAAE,QAwCtC,CAAC"}
@@ -1,36 +0,0 @@
1
- export const computeruseStateProvider = {
2
- name: "COMPUTERUSE_STATE",
3
- description: "Provides current ComputerUse backend/mode information",
4
- dynamic: true,
5
- get: async (runtime, _message, _state) => {
6
- const service = runtime.getService("computeruse");
7
- if (!service || !service.isEnabled()) {
8
- return {
9
- text: "ComputerUse is disabled",
10
- values: { enabled: false },
11
- data: { enabled: false },
12
- };
13
- }
14
- const backend = service.getBackendName();
15
- const mode = service.getMode();
16
- const mcpServer = service.getMcpServerName();
17
- return {
18
- text: `ComputerUse enabled. Mode=${mode}. Backend=${backend ?? "none"}. Platform=${process.platform}.`,
19
- values: {
20
- enabled: true,
21
- mode,
22
- backend: backend ?? "none",
23
- platform: process.platform,
24
- mcpServer,
25
- },
26
- data: {
27
- enabled: true,
28
- mode,
29
- backend,
30
- platform: process.platform,
31
- mcpServer,
32
- },
33
- };
34
- },
35
- };
36
- //# sourceMappingURL=computeruse-state.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"computeruse-state.js","sourceRoot":"","sources":["../../src/providers/computeruse-state.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,MAAM,wBAAwB,GAAa;IACjD,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,uDAAuD;IACpE,OAAO,EAAE,IAAI;IACb,GAAG,EAAE,KAAK,EACT,OAAsB,EACtB,QAAgB,EAChB,MAAa,EACa,EAAE;QAC5B,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAqB,aAAa,CAAC,CAAC;QACtE,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC;YACtC,OAAO;gBACN,IAAI,EAAE,yBAAyB;gBAC/B,MAAM,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;gBAC1B,IAAI,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;aACxB,CAAC;QACH,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;YACN,IAAI,EAAE,6BAA6B,IAAI,aAAa,OAAO,IAAI,MAAM,cAAc,OAAO,CAAC,QAAQ,GAAG;YACtG,MAAM,EAAE;gBACP,OAAO,EAAE,IAAI;gBACb,IAAI;gBACJ,OAAO,EAAE,OAAO,IAAI,MAAM;gBAC1B,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,SAAS;aACT;YACD,IAAI,EAAE;gBACL,OAAO,EAAE,IAAI;gBACb,IAAI;gBACJ,OAAO;gBACP,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,SAAS;aACT;SACD,CAAC;IACH,CAAC;CACD,CAAC","sourcesContent":["import type {\n\tIAgentRuntime,\n\tMemory,\n\tProvider,\n\tProviderResult,\n\tState,\n} from \"@elizaos/core\";\nimport type { ComputerUseService } from \"../services/computeruse-service.js\";\n\nexport const computeruseStateProvider: Provider = {\n\tname: \"COMPUTERUSE_STATE\",\n\tdescription: \"Provides current ComputerUse backend/mode information\",\n\tdynamic: true,\n\tget: async (\n\t\truntime: IAgentRuntime,\n\t\t_message: Memory,\n\t\t_state: State,\n\t): Promise<ProviderResult> => {\n\t\tconst service = runtime.getService<ComputerUseService>(\"computeruse\");\n\t\tif (!service || !service.isEnabled()) {\n\t\t\treturn {\n\t\t\t\ttext: \"ComputerUse is disabled\",\n\t\t\t\tvalues: { enabled: false },\n\t\t\t\tdata: { enabled: false },\n\t\t\t};\n\t\t}\n\n\t\tconst backend = service.getBackendName();\n\t\tconst mode = service.getMode();\n\t\tconst mcpServer = service.getMcpServerName();\n\n\t\treturn {\n\t\t\ttext: `ComputerUse enabled. Mode=${mode}. Backend=${backend ?? \"none\"}. Platform=${process.platform}.`,\n\t\t\tvalues: {\n\t\t\t\tenabled: true,\n\t\t\t\tmode,\n\t\t\t\tbackend: backend ?? \"none\",\n\t\t\t\tplatform: process.platform,\n\t\t\t\tmcpServer,\n\t\t\t},\n\t\t\tdata: {\n\t\t\t\tenabled: true,\n\t\t\t\tmode,\n\t\t\t\tbackend,\n\t\t\t\tplatform: process.platform,\n\t\t\t\tmcpServer,\n\t\t\t},\n\t\t};\n\t},\n};\n"]}
@@ -1,7 +0,0 @@
1
- declare module "@elizaos/core" {
2
- interface ServiceTypeRegistry {
3
- COMPUTERUSE: "computeruse";
4
- }
5
- }
6
- export declare const COMPUTERUSE_SERVICE_TYPE: "computeruse";
7
- //# sourceMappingURL=service-registry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"service-registry.d.ts","sourceRoot":"","sources":["../src/service-registry.ts"],"names":[],"mappings":"AAEA,OAAO,QAAQ,eAAe,CAAC;IAC9B,UAAU,mBAAmB;QAC5B,WAAW,EAAE,aAAa,CAAC;KAC3B;CACD;AAED,eAAO,MAAM,wBAAwB,EAAG,aAAsB,CAAC"}
@@ -1,2 +0,0 @@
1
- export const COMPUTERUSE_SERVICE_TYPE = "computeruse";
2
- //# sourceMappingURL=service-registry.js.map
@@ -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\tinterface ServiceTypeRegistry {\n\t\tCOMPUTERUSE: \"computeruse\";\n\t}\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
@@ -1 +0,0 @@
1
- {"version":3,"file":"computeruse-service.d.ts","sourceRoot":"","sources":["../../src/services/computeruse-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAU,OAAO,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,EACN,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EAGtB,MAAM,aAAa,CAAC;AA0CrB,qBAAa,kBAAmB,SAAQ,OAAO;IAC9C,MAAM,CAAC,WAAW,SAAiB;IACnC,qBAAqB,SACkF;IAEvG,OAAO,CAAC,iBAAiB,CAAoB;IAC7C,OAAO,CAAC,WAAW,CAAuC;IAC1D,OAAO,CAAC,WAAW,CAAS;IAG5B,OAAO,CAAC,YAAY,CAAiC;gBAEzC,OAAO,CAAC,EAAE,aAAa;WAWtB,KAAK,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAKjE,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAM3B,OAAO,IAAI,iBAAiB,CAAC,kBAAkB,CAAC;IAIhD,cAAc,IAAI,sBAAsB,GAAG,IAAI;IAI/C,gBAAgB,IAAI,MAAM;IAI1B,SAAS,IAAI,OAAO;IAId,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;YAMpB,iBAAiB;YAiDjB,kBAAkB;YAgClB,gBAAgB;YAahB,iBAAiB;IAa/B,OAAO,CAAC,MAAM;IAQd,OAAO,CAAC,0BAA0B;IA0B5B,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA6B/C,KAAK,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