@elizaos/plugin-computeruse 2.0.0-alpha.9 → 2.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/desktop-handlers.d.ts +20 -0
- package/dist/actions/desktop-handlers.d.ts.map +1 -0
- package/dist/actions/desktop.d.ts +11 -0
- package/dist/actions/desktop.d.ts.map +1 -0
- package/dist/actions/helpers.d.ts +33 -0
- package/dist/actions/helpers.d.ts.map +1 -0
- package/dist/actions/use-computer.d.ts +3 -0
- package/dist/actions/use-computer.d.ts.map +1 -0
- package/dist/approval-manager.d.ts +29 -0
- package/dist/approval-manager.d.ts.map +1 -0
- package/dist/index.d.ts +30 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7125 -59
- package/dist/index.js.map +34 -1
- package/dist/osworld/action-converter.d.ts +35 -0
- package/dist/osworld/action-converter.d.ts.map +1 -0
- package/dist/osworld/adapter.d.ts +78 -0
- package/dist/osworld/adapter.d.ts.map +1 -0
- package/dist/osworld/types.d.ts +69 -0
- package/dist/osworld/types.d.ts.map +1 -0
- package/dist/platform/a11y.d.ts +36 -0
- package/dist/platform/a11y.d.ts.map +1 -0
- package/dist/platform/browser.d.ts +61 -0
- package/dist/platform/browser.d.ts.map +1 -0
- package/dist/platform/capabilities.d.ts +10 -0
- package/dist/platform/capabilities.d.ts.map +1 -0
- package/dist/platform/desktop.d.ts +33 -0
- package/dist/platform/desktop.d.ts.map +1 -0
- package/dist/platform/driver.d.ts +27 -0
- package/dist/platform/driver.d.ts.map +1 -0
- package/dist/platform/file-ops.d.ts +10 -0
- package/dist/platform/file-ops.d.ts.map +1 -0
- package/dist/platform/helpers.d.ts +61 -0
- package/dist/platform/helpers.d.ts.map +1 -0
- package/dist/platform/nut-driver.d.ts +19 -0
- package/dist/platform/nut-driver.d.ts.map +1 -0
- package/dist/platform/permissions.d.ts +21 -0
- package/dist/platform/permissions.d.ts.map +1 -0
- package/dist/platform/screenshot.d.ts +16 -0
- package/dist/platform/screenshot.d.ts.map +1 -0
- package/dist/platform/security.d.ts +12 -0
- package/dist/platform/security.d.ts.map +1 -0
- package/dist/platform/terminal.d.ts +38 -0
- package/dist/platform/terminal.d.ts.map +1 -0
- package/dist/platform/windows-list.d.ts +36 -0
- package/dist/platform/windows-list.d.ts.map +1 -0
- package/dist/providers/computer-state.d.ts +9 -0
- package/dist/providers/computer-state.d.ts.map +1 -0
- package/dist/register-routes.d.ts +2 -0
- package/dist/register-routes.d.ts.map +1 -0
- package/dist/register-routes.js +7111 -0
- package/dist/register-routes.js.map +34 -0
- package/dist/routes/computer-use-compat-routes.d.ts +29 -0
- package/dist/routes/computer-use-compat-routes.d.ts.map +1 -0
- package/dist/routes/computer-use-routes.d.ts +3 -0
- package/dist/routes/computer-use-routes.d.ts.map +1 -0
- package/dist/routes/sandbox-routes.d.ts +53 -0
- package/dist/routes/sandbox-routes.d.ts.map +1 -0
- package/dist/services/computer-use-service.d.ts +66 -0
- package/dist/services/computer-use-service.d.ts.map +1 -0
- package/dist/services/desktop-control.d.ts +35 -0
- package/dist/services/desktop-control.d.ts.map +1 -0
- package/dist/types.d.ts +273 -39
- package/dist/types.d.ts.map +1 -1
- package/package.json +100 -103
- package/dist/actions/click-coordinates.d.ts +0 -3
- package/dist/actions/click-coordinates.d.ts.map +0 -1
- package/dist/actions/click-coordinates.js +0 -139
- package/dist/actions/click-coordinates.js.map +0 -1
- package/dist/actions/click.d.ts +0 -3
- package/dist/actions/click.d.ts.map +0 -1
- package/dist/actions/click.js +0 -144
- package/dist/actions/click.js.map +0 -1
- package/dist/actions/drag.d.ts +0 -3
- package/dist/actions/drag.d.ts.map +0 -1
- package/dist/actions/drag.js +0 -145
- package/dist/actions/drag.js.map +0 -1
- package/dist/actions/get-applications.d.ts +0 -3
- package/dist/actions/get-applications.d.ts.map +0 -1
- package/dist/actions/get-applications.js +0 -105
- package/dist/actions/get-applications.js.map +0 -1
- package/dist/actions/get-window-tree.d.ts +0 -3
- package/dist/actions/get-window-tree.d.ts.map +0 -1
- package/dist/actions/get-window-tree.js +0 -133
- package/dist/actions/get-window-tree.js.map +0 -1
- package/dist/actions/open-application.d.ts +0 -3
- package/dist/actions/open-application.d.ts.map +0 -1
- package/dist/actions/open-application.js +0 -117
- package/dist/actions/open-application.js.map +0 -1
- package/dist/actions/press-key.d.ts +0 -3
- package/dist/actions/press-key.d.ts.map +0 -1
- package/dist/actions/press-key.js +0 -115
- package/dist/actions/press-key.js.map +0 -1
- package/dist/actions/screenshot.d.ts +0 -3
- package/dist/actions/screenshot.d.ts.map +0 -1
- package/dist/actions/screenshot.js +0 -99
- package/dist/actions/screenshot.js.map +0 -1
- package/dist/actions/scroll.d.ts +0 -3
- package/dist/actions/scroll.d.ts.map +0 -1
- package/dist/actions/scroll.js +0 -137
- package/dist/actions/scroll.js.map +0 -1
- package/dist/actions/type.d.ts +0 -3
- package/dist/actions/type.d.ts.map +0 -1
- package/dist/actions/type.js +0 -163
- package/dist/actions/type.js.map +0 -1
- package/dist/providers/available-apps.d.ts +0 -3
- package/dist/providers/available-apps.d.ts.map +0 -1
- package/dist/providers/available-apps.js +0 -28
- package/dist/providers/available-apps.js.map +0 -1
- package/dist/providers/computeruse-state.d.ts +0 -3
- package/dist/providers/computeruse-state.d.ts.map +0 -1
- package/dist/providers/computeruse-state.js +0 -36
- package/dist/providers/computeruse-state.js.map +0 -1
- package/dist/service-registry.d.ts +0 -7
- package/dist/service-registry.d.ts.map +0 -1
- package/dist/service-registry.js +0 -2
- package/dist/service-registry.js.map +0 -1
- package/dist/services/computeruse-service.d.ts +0 -36
- package/dist/services/computeruse-service.d.ts.map +0 -1
- package/dist/services/computeruse-service.js +0 -391
- package/dist/services/computeruse-service.js.map +0 -1
- package/dist/types.js +0 -11
- package/dist/types.js.map +0 -1
- package/dist/utils/params.d.ts +0 -5
- package/dist/utils/params.d.ts.map +0 -1
- package/dist/utils/params.js +0 -13
- package/dist/utils/params.js.map +0 -1
package/dist/actions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YACF,MAAM,QAAQ,GAAY;gBACzB,IAAI,EAAE,uBAAuB,QAAQ,EAAE;gBACvC,OAAO,EAAE,CAAC,kBAAkB,CAAC;gBAC7B,MAAM,EAAE,OAAO,CAAC,OAAO,EAAE,MAAM,IAAI,QAAQ;aAC3C,CAAC;YACF,MAAM,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC;YAC3B,OAAO;gBACN,OAAO,EAAE,IAAI;gBACb,IAAI,EAAE,QAAQ,CAAC,IAAI,IAAI,EAAE;gBACzB,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,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;QAAC,OAAO,GAAG,EAAE,CAAC;YACd,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC7D,MAAM,CAAC,KAAK,CAAC,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"]}
|
|
@@ -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 +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 +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"}
|
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\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,C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,EAAE,MAAM,GACR,OAAO,CAAC,IAAI,CAAC;IAkCV,IAAI,CACT,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GACV,OAAO,CAAC,IAAI,CAAC;IA6BV,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IA+B7B,eAAe,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;CAkC1C"}
|
|
@@ -1,391 +0,0 @@
|
|
|
1
|
-
import { logger, Service } from "@elizaos/core";
|
|
2
|
-
import { computerUseConfigSchema, } from "../types.js";
|
|
3
|
-
export class ComputerUseService extends Service {
|
|
4
|
-
static serviceType = "computeruse";
|
|
5
|
-
capabilityDescription = "Enables the agent to control a computer UI locally (when supported) or via a ComputerUse MCP server";
|
|
6
|
-
computeruseConfig;
|
|
7
|
-
backendName = null;
|
|
8
|
-
initialized = false;
|
|
9
|
-
// Lazy-loaded to avoid importing native bindings unless actually used.
|
|
10
|
-
localDesktop = null;
|
|
11
|
-
constructor(runtime) {
|
|
12
|
-
super(runtime);
|
|
13
|
-
this.computeruseConfig = computerUseConfigSchema.parse({
|
|
14
|
-
COMPUTERUSE_ENABLED: String(process.env.COMPUTERUSE_ENABLED ?? "false"),
|
|
15
|
-
COMPUTERUSE_MODE: String(process.env.COMPUTERUSE_MODE ?? "auto"),
|
|
16
|
-
COMPUTERUSE_MCP_SERVER: String(process.env.COMPUTERUSE_MCP_SERVER ?? "computeruse"),
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
static async start(runtime) {
|
|
20
|
-
const service = new ComputerUseService(runtime);
|
|
21
|
-
return service;
|
|
22
|
-
}
|
|
23
|
-
async stop() {
|
|
24
|
-
this.localDesktop = null;
|
|
25
|
-
this.backendName = null;
|
|
26
|
-
this.initialized = false;
|
|
27
|
-
}
|
|
28
|
-
getMode() {
|
|
29
|
-
return this.computeruseConfig.COMPUTERUSE_MODE;
|
|
30
|
-
}
|
|
31
|
-
getBackendName() {
|
|
32
|
-
return this.backendName;
|
|
33
|
-
}
|
|
34
|
-
getMcpServerName() {
|
|
35
|
-
return this.computeruseConfig.COMPUTERUSE_MCP_SERVER;
|
|
36
|
-
}
|
|
37
|
-
isEnabled() {
|
|
38
|
-
return this.computeruseConfig.COMPUTERUSE_ENABLED;
|
|
39
|
-
}
|
|
40
|
-
async ensureReady() {
|
|
41
|
-
if (this.initialized)
|
|
42
|
-
return;
|
|
43
|
-
this.initialized = true;
|
|
44
|
-
await this.initializeBackend();
|
|
45
|
-
}
|
|
46
|
-
async initializeBackend() {
|
|
47
|
-
if (!this.computeruseConfig.COMPUTERUSE_ENABLED) {
|
|
48
|
-
logger.info("[computeruse] disabled (COMPUTERUSE_ENABLED=false)");
|
|
49
|
-
this.backendName = null;
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
// ── Sandbox mode: force MCP to prevent local desktop control ──────
|
|
53
|
-
const runtimeRecord = this.runtime;
|
|
54
|
-
const isSandboxMode = Boolean(runtimeRecord?.sandboxMode);
|
|
55
|
-
if (isSandboxMode) {
|
|
56
|
-
logger.info("[computeruse] sandbox mode active — forcing MCP backend (local desktop control disabled)");
|
|
57
|
-
this.computeruseConfig.COMPUTERUSE_MODE = "mcp";
|
|
58
|
-
await this.ensureMcpBackend();
|
|
59
|
-
this.backendName = "mcp";
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
// ── End sandbox mode override ─────────────────────────────────────
|
|
63
|
-
const mode = this.computeruseConfig.COMPUTERUSE_MODE;
|
|
64
|
-
if (mode === "local") {
|
|
65
|
-
await this.ensureLocalBackend();
|
|
66
|
-
this.backendName = "local";
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
if (mode === "mcp") {
|
|
70
|
-
await this.ensureMcpBackend();
|
|
71
|
-
this.backendName = "mcp";
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
// auto - try local on all platforms, fall back to MCP
|
|
75
|
-
try {
|
|
76
|
-
await this.ensureLocalBackend();
|
|
77
|
-
this.backendName = "local";
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
catch (err) {
|
|
81
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
82
|
-
logger.warn(`[computeruse] local backend unavailable, falling back to mcp: ${msg}`);
|
|
83
|
-
}
|
|
84
|
-
await this.ensureMcpBackend();
|
|
85
|
-
this.backendName = "mcp";
|
|
86
|
-
}
|
|
87
|
-
async ensureLocalBackend() {
|
|
88
|
-
if (this.localDesktop)
|
|
89
|
-
return;
|
|
90
|
-
// Import only when needed (native optional deps).
|
|
91
|
-
try {
|
|
92
|
-
const loadModule = Function("moduleName", "return import(moduleName)");
|
|
93
|
-
const mod = (await loadModule("@elizaos/computeruse"));
|
|
94
|
-
if (typeof mod.Desktop !== "function") {
|
|
95
|
-
throw new Error("Desktop API is not available in @elizaos/computeruse");
|
|
96
|
-
}
|
|
97
|
-
this.localDesktop = new mod.Desktop();
|
|
98
|
-
}
|
|
99
|
-
catch (err) {
|
|
100
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
101
|
-
const platform = process.platform;
|
|
102
|
-
if (platform === "darwin") {
|
|
103
|
-
throw new Error(`macOS native bindings not available: ${msg}. Use MCP mode or ensure @elizaos/computeruse-darwin-* is installed.`);
|
|
104
|
-
}
|
|
105
|
-
else if (platform === "linux") {
|
|
106
|
-
throw new Error(`Linux native bindings not available: ${msg}. Use MCP mode or ensure @elizaos/computeruse-linux-* is installed.`);
|
|
107
|
-
}
|
|
108
|
-
throw err;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
async ensureMcpBackend() {
|
|
112
|
-
const mcp = await this.waitForMcpService();
|
|
113
|
-
const serverName = this.computeruseConfig.COMPUTERUSE_MCP_SERVER;
|
|
114
|
-
const servers = mcp.getServers();
|
|
115
|
-
const exists = servers.some((s) => s.name === serverName);
|
|
116
|
-
if (!exists) {
|
|
117
|
-
throw new Error(`MCP server "${serverName}" not configured. Add it under runtime/character settings "mcp.servers".`);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
async waitForMcpService() {
|
|
121
|
-
// Services are registered during runtime initialization; depending on plugin order,
|
|
122
|
-
// "mcp" may not be available during another service's start hook.
|
|
123
|
-
for (let attempt = 0; attempt < 20; attempt++) {
|
|
124
|
-
const mcp = this.runtime.getService("mcp");
|
|
125
|
-
if (mcp)
|
|
126
|
-
return mcp;
|
|
127
|
-
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
128
|
-
}
|
|
129
|
-
throw new Error("MCP service not available. Add @elizaos/plugin-mcp and configure a computeruse server.");
|
|
130
|
-
}
|
|
131
|
-
getMcp() {
|
|
132
|
-
const mcp = this.runtime.getService("mcp");
|
|
133
|
-
if (!mcp) {
|
|
134
|
-
throw new Error("MCP service not available");
|
|
135
|
-
}
|
|
136
|
-
return mcp;
|
|
137
|
-
}
|
|
138
|
-
parseProcessScopedSelector(rawSelector, processHint) {
|
|
139
|
-
const selector = rawSelector.trim();
|
|
140
|
-
const match = selector.match(/^\s*process:([^\s>]+)\s*(?:>>\s*(.*))?$/);
|
|
141
|
-
if (match) {
|
|
142
|
-
const process = match[1]?.trim();
|
|
143
|
-
const inner = (match[2] ?? "").trim();
|
|
144
|
-
if (!process) {
|
|
145
|
-
throw new Error("Missing process. Provide parameters.process or prefix selector with 'process:<name> >> ...'");
|
|
146
|
-
}
|
|
147
|
-
return { process, selector: inner };
|
|
148
|
-
}
|
|
149
|
-
const process = processHint?.trim();
|
|
150
|
-
if (!process) {
|
|
151
|
-
throw new Error("Missing process. Provide parameters.process or prefix selector with 'process:<name> >> ...'");
|
|
152
|
-
}
|
|
153
|
-
return { process, selector };
|
|
154
|
-
}
|
|
155
|
-
async openApplication(appName) {
|
|
156
|
-
await this.ensureReady();
|
|
157
|
-
if (!this.computeruseConfig.COMPUTERUSE_ENABLED)
|
|
158
|
-
throw new Error("ComputerUse is disabled");
|
|
159
|
-
if (this.backendName === "local") {
|
|
160
|
-
await this.ensureLocalBackend();
|
|
161
|
-
this.localDesktop?.openApplication(appName);
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
if (this.backendName === "mcp") {
|
|
165
|
-
const mcp = this.getMcp();
|
|
166
|
-
await mcp.callTool(this.computeruseConfig.COMPUTERUSE_MCP_SERVER, "open_application", {
|
|
167
|
-
app_name: appName,
|
|
168
|
-
verify_element_exists: "",
|
|
169
|
-
verify_element_not_exists: "",
|
|
170
|
-
include_tree_after_action: false,
|
|
171
|
-
});
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
throw new Error("ComputerUse backend not initialized");
|
|
175
|
-
}
|
|
176
|
-
async click(selector, timeoutMs, process) {
|
|
177
|
-
await this.ensureReady();
|
|
178
|
-
if (!this.computeruseConfig.COMPUTERUSE_ENABLED)
|
|
179
|
-
throw new Error("ComputerUse is disabled");
|
|
180
|
-
if (this.backendName === "local") {
|
|
181
|
-
await this.ensureLocalBackend();
|
|
182
|
-
const el = await this.localDesktop?.locator(selector).first(timeoutMs);
|
|
183
|
-
if (!el)
|
|
184
|
-
throw new Error(`Element not found: ${selector}`);
|
|
185
|
-
await el.click();
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
if (this.backendName === "mcp") {
|
|
189
|
-
const mcp = this.getMcp();
|
|
190
|
-
const parsed = this.parseProcessScopedSelector(selector, process);
|
|
191
|
-
await mcp.callTool(this.computeruseConfig.COMPUTERUSE_MCP_SERVER, "click_element", {
|
|
192
|
-
process: parsed.process,
|
|
193
|
-
selector: parsed.selector,
|
|
194
|
-
timeout_ms: timeoutMs,
|
|
195
|
-
verify_element_exists: "",
|
|
196
|
-
verify_element_not_exists: "",
|
|
197
|
-
highlight_before_action: false,
|
|
198
|
-
ui_diff_before_after: false,
|
|
199
|
-
});
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
throw new Error("ComputerUse backend not initialized");
|
|
203
|
-
}
|
|
204
|
-
async typeText(selector, text, timeoutMs, clearBeforeTyping, process) {
|
|
205
|
-
await this.ensureReady();
|
|
206
|
-
if (!this.computeruseConfig.COMPUTERUSE_ENABLED)
|
|
207
|
-
throw new Error("ComputerUse is disabled");
|
|
208
|
-
if (this.backendName === "local") {
|
|
209
|
-
await this.ensureLocalBackend();
|
|
210
|
-
const el = await this.localDesktop?.locator(selector).first(timeoutMs);
|
|
211
|
-
if (!el)
|
|
212
|
-
throw new Error(`Element not found: ${selector}`);
|
|
213
|
-
el.typeText(text, { clearBeforeTyping });
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
if (this.backendName === "mcp") {
|
|
217
|
-
const mcp = this.getMcp();
|
|
218
|
-
const parsed = this.parseProcessScopedSelector(selector, process);
|
|
219
|
-
await mcp.callTool(this.computeruseConfig.COMPUTERUSE_MCP_SERVER, "type_into_element", {
|
|
220
|
-
process: parsed.process,
|
|
221
|
-
selector: parsed.selector,
|
|
222
|
-
text_to_type: text,
|
|
223
|
-
timeout_ms: timeoutMs,
|
|
224
|
-
clear_before_typing: clearBeforeTyping,
|
|
225
|
-
highlight_before_action: false,
|
|
226
|
-
ui_diff_before_after: false,
|
|
227
|
-
});
|
|
228
|
-
return;
|
|
229
|
-
}
|
|
230
|
-
throw new Error("ComputerUse backend not initialized");
|
|
231
|
-
}
|
|
232
|
-
async getWindowTree(process, title, maxDepth) {
|
|
233
|
-
await this.ensureReady();
|
|
234
|
-
if (!this.computeruseConfig.COMPUTERUSE_ENABLED)
|
|
235
|
-
throw new Error("ComputerUse is disabled");
|
|
236
|
-
if (this.backendName === "local") {
|
|
237
|
-
await this.ensureLocalBackend();
|
|
238
|
-
const tree = this.localDesktop?.getWindowTree(process, title, undefined);
|
|
239
|
-
return JSON.stringify(tree ?? null, null, 2);
|
|
240
|
-
}
|
|
241
|
-
if (this.backendName === "mcp") {
|
|
242
|
-
const mcp = this.getMcp();
|
|
243
|
-
const toolArgs = {
|
|
244
|
-
process,
|
|
245
|
-
include_tree_after_action: true,
|
|
246
|
-
};
|
|
247
|
-
if (title !== undefined)
|
|
248
|
-
toolArgs.title = title;
|
|
249
|
-
if (maxDepth !== undefined)
|
|
250
|
-
toolArgs.tree_max_depth = maxDepth;
|
|
251
|
-
const res = await mcp.callTool(this.computeruseConfig.COMPUTERUSE_MCP_SERVER, "get_window_tree", toolArgs);
|
|
252
|
-
const texts = res.content
|
|
253
|
-
.filter((c) => c.type === "text")
|
|
254
|
-
.map((c) => c.text)
|
|
255
|
-
.filter((t) => typeof t === "string");
|
|
256
|
-
return texts.join("\n");
|
|
257
|
-
}
|
|
258
|
-
throw new Error("ComputerUse backend not initialized");
|
|
259
|
-
}
|
|
260
|
-
async clickCoordinates(x, y, button = "left", numClicks = 1) {
|
|
261
|
-
await this.ensureReady();
|
|
262
|
-
if (!this.computeruseConfig.COMPUTERUSE_ENABLED)
|
|
263
|
-
throw new Error("ComputerUse is disabled");
|
|
264
|
-
if (this.backendName === "local") {
|
|
265
|
-
await this.ensureLocalBackend();
|
|
266
|
-
this.localDesktop?.clickAtCoordinates(x, y);
|
|
267
|
-
return;
|
|
268
|
-
}
|
|
269
|
-
if (this.backendName === "mcp") {
|
|
270
|
-
const mcp = this.getMcp();
|
|
271
|
-
await mcp.callTool(this.computeruseConfig.COMPUTERUSE_MCP_SERVER, "click_at_coordinates", { x, y, button, num_clicks: numClicks });
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
throw new Error("ComputerUse backend not initialized");
|
|
275
|
-
}
|
|
276
|
-
async pressKey(keys) {
|
|
277
|
-
await this.ensureReady();
|
|
278
|
-
if (!this.computeruseConfig.COMPUTERUSE_ENABLED)
|
|
279
|
-
throw new Error("ComputerUse is disabled");
|
|
280
|
-
if (this.backendName === "local") {
|
|
281
|
-
await this.ensureLocalBackend();
|
|
282
|
-
this.localDesktop?.pressKey(keys);
|
|
283
|
-
return;
|
|
284
|
-
}
|
|
285
|
-
if (this.backendName === "mcp") {
|
|
286
|
-
const mcp = this.getMcp();
|
|
287
|
-
await mcp.callTool(this.computeruseConfig.COMPUTERUSE_MCP_SERVER, "press_key", { key: keys });
|
|
288
|
-
return;
|
|
289
|
-
}
|
|
290
|
-
throw new Error("ComputerUse backend not initialized");
|
|
291
|
-
}
|
|
292
|
-
async scroll(direction = "down", amount = 3, x, y) {
|
|
293
|
-
await this.ensureReady();
|
|
294
|
-
if (!this.computeruseConfig.COMPUTERUSE_ENABLED)
|
|
295
|
-
throw new Error("ComputerUse is disabled");
|
|
296
|
-
if (this.backendName === "local") {
|
|
297
|
-
await this.ensureLocalBackend();
|
|
298
|
-
// Local backend: click at position first if specified, then scroll via key presses
|
|
299
|
-
if (x !== undefined && y !== undefined) {
|
|
300
|
-
this.localDesktop?.clickAtCoordinates(x, y);
|
|
301
|
-
}
|
|
302
|
-
const scrollKey = direction === "up" ? "scrollup" : "scrolldown";
|
|
303
|
-
for (let i = 0; i < amount; i++) {
|
|
304
|
-
this.localDesktop?.pressKey(scrollKey);
|
|
305
|
-
}
|
|
306
|
-
return;
|
|
307
|
-
}
|
|
308
|
-
if (this.backendName === "mcp") {
|
|
309
|
-
const mcp = this.getMcp();
|
|
310
|
-
const toolArgs = { direction, amount };
|
|
311
|
-
if (x !== undefined)
|
|
312
|
-
toolArgs.x = x;
|
|
313
|
-
if (y !== undefined)
|
|
314
|
-
toolArgs.y = y;
|
|
315
|
-
await mcp.callTool(this.computeruseConfig.COMPUTERUSE_MCP_SERVER, "scroll", toolArgs);
|
|
316
|
-
return;
|
|
317
|
-
}
|
|
318
|
-
throw new Error("ComputerUse backend not initialized");
|
|
319
|
-
}
|
|
320
|
-
async drag(startX, startY, endX, endY) {
|
|
321
|
-
await this.ensureReady();
|
|
322
|
-
if (!this.computeruseConfig.COMPUTERUSE_ENABLED)
|
|
323
|
-
throw new Error("ComputerUse is disabled");
|
|
324
|
-
if (this.backendName === "local") {
|
|
325
|
-
await this.ensureLocalBackend();
|
|
326
|
-
// The Desktop native API does not expose a drag method.
|
|
327
|
-
// Local backend can only click the start position; full drag requires MCP.
|
|
328
|
-
logger.warn("[computeruse] Local drag is limited to click-at-start. Use MCP for full drag.");
|
|
329
|
-
this.localDesktop?.clickAtCoordinates(startX, startY);
|
|
330
|
-
return;
|
|
331
|
-
}
|
|
332
|
-
if (this.backendName === "mcp") {
|
|
333
|
-
const mcp = this.getMcp();
|
|
334
|
-
await mcp.callTool(this.computeruseConfig.COMPUTERUSE_MCP_SERVER, "drag", { start_x: startX, start_y: startY, end_x: endX, end_y: endY });
|
|
335
|
-
return;
|
|
336
|
-
}
|
|
337
|
-
throw new Error("ComputerUse backend not initialized");
|
|
338
|
-
}
|
|
339
|
-
async screenshot() {
|
|
340
|
-
await this.ensureReady();
|
|
341
|
-
if (!this.computeruseConfig.COMPUTERUSE_ENABLED)
|
|
342
|
-
throw new Error("ComputerUse is disabled");
|
|
343
|
-
if (this.backendName === "local") {
|
|
344
|
-
await this.ensureLocalBackend();
|
|
345
|
-
const result = this.localDesktop?.captureMonitor(0);
|
|
346
|
-
if (result && typeof result === "object" && "toBase64" in result) {
|
|
347
|
-
return result.toBase64();
|
|
348
|
-
}
|
|
349
|
-
return String(result ?? "");
|
|
350
|
-
}
|
|
351
|
-
if (this.backendName === "mcp") {
|
|
352
|
-
const mcp = this.getMcp();
|
|
353
|
-
const res = await mcp.callTool(this.computeruseConfig.COMPUTERUSE_MCP_SERVER, "capture_screenshot", {});
|
|
354
|
-
const texts = res.content
|
|
355
|
-
.filter((c) => c.type === "text")
|
|
356
|
-
.map((c) => c.text)
|
|
357
|
-
.filter((t) => typeof t === "string");
|
|
358
|
-
return texts.join("");
|
|
359
|
-
}
|
|
360
|
-
throw new Error("ComputerUse backend not initialized");
|
|
361
|
-
}
|
|
362
|
-
async getApplications() {
|
|
363
|
-
await this.ensureReady();
|
|
364
|
-
if (!this.computeruseConfig.COMPUTERUSE_ENABLED)
|
|
365
|
-
throw new Error("ComputerUse is disabled");
|
|
366
|
-
if (this.backendName === "local") {
|
|
367
|
-
await this.ensureLocalBackend();
|
|
368
|
-
const apps = this.localDesktop?.applications() ?? [];
|
|
369
|
-
// Normalize into human-readable names.
|
|
370
|
-
const names = [];
|
|
371
|
-
for (const app of apps) {
|
|
372
|
-
const n = app.name();
|
|
373
|
-
if (typeof n === "string" && n.trim().length > 0)
|
|
374
|
-
names.push(n);
|
|
375
|
-
}
|
|
376
|
-
return names;
|
|
377
|
-
}
|
|
378
|
-
if (this.backendName === "mcp") {
|
|
379
|
-
const mcp = this.getMcp();
|
|
380
|
-
const res = await mcp.callTool(this.computeruseConfig.COMPUTERUSE_MCP_SERVER, "get_applications_and_windows_list", {});
|
|
381
|
-
// Return text-only summary for now; structured parsing is done in actions/providers if needed.
|
|
382
|
-
const texts = res.content
|
|
383
|
-
.filter((c) => c.type === "text")
|
|
384
|
-
.map((c) => c.text)
|
|
385
|
-
.filter((t) => typeof t === "string");
|
|
386
|
-
return texts.length > 0 ? texts : ["(see MCP tool output)"];
|
|
387
|
-
}
|
|
388
|
-
throw new Error("ComputerUse backend not initialized");
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
//# sourceMappingURL=computeruse-service.js.map
|