@elizaos/plugin-computeruse 2.0.3-beta.2 → 2.0.3-beta.3
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/clipboard.d.ts +22 -0
- package/dist/actions/clipboard.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/progress.d.ts +26 -0
- package/dist/actions/progress.d.ts.map +1 -0
- package/dist/actions/use-computer-agent.d.ts +113 -0
- package/dist/actions/use-computer-agent.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/actions/window-handlers.d.ts +11 -0
- package/dist/actions/window-handlers.d.ts.map +1 -0
- package/dist/actions/window.d.ts +11 -0
- package/dist/actions/window.d.ts.map +1 -0
- package/dist/actor/actor.d.ts +84 -0
- package/dist/actor/actor.d.ts.map +1 -0
- package/dist/actor/agent-callbacks.d.ts +128 -0
- package/dist/actor/agent-callbacks.d.ts.map +1 -0
- package/dist/actor/agent-loop.d.ts +134 -0
- package/dist/actor/agent-loop.d.ts.map +1 -0
- package/dist/actor/aosp-input-actor.d.ts +87 -0
- package/dist/actor/aosp-input-actor.d.ts.map +1 -0
- package/dist/actor/brain.d.ts +195 -0
- package/dist/actor/brain.d.ts.map +1 -0
- package/dist/actor/cascade.d.ts +92 -0
- package/dist/actor/cascade.d.ts.map +1 -0
- package/dist/actor/computer-interface.d.ts +276 -0
- package/dist/actor/computer-interface.d.ts.map +1 -0
- package/dist/actor/dispatch.d.ts +24 -0
- package/dist/actor/dispatch.d.ts.map +1 -0
- package/dist/actor/index.d.ts +12 -0
- package/dist/actor/index.d.ts.map +1 -0
- package/dist/actor/types.d.ts +94 -0
- package/dist/actor/types.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 +46 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13649 -0
- package/dist/index.js.map +68 -0
- package/dist/mcp/index.d.ts +8 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/server.d.ts +42 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/tools.d.ts +53 -0
- package/dist/mcp/tools.d.ts.map +1 -0
- package/dist/mobile/android-bridge.d.ts +263 -0
- package/dist/mobile/android-bridge.d.ts.map +1 -0
- package/dist/mobile/android-scene.d.ts +52 -0
- package/dist/mobile/android-scene.d.ts.map +1 -0
- package/dist/mobile/android-trajectory.d.ts +66 -0
- package/dist/mobile/android-trajectory.d.ts.map +1 -0
- package/dist/mobile/index.d.ts +19 -0
- package/dist/mobile/index.d.ts.map +1 -0
- package/dist/mobile/ios-app-intent-registry.d.ts +20 -0
- package/dist/mobile/ios-app-intent-registry.d.ts.map +1 -0
- package/dist/mobile/ios-bridge.d.ts +359 -0
- package/dist/mobile/ios-bridge.d.ts.map +1 -0
- package/dist/mobile/ios-computer-interface.d.ts +160 -0
- package/dist/mobile/ios-computer-interface.d.ts.map +1 -0
- package/dist/mobile/mobile-computer-interface.d.ts +142 -0
- package/dist/mobile/mobile-computer-interface.d.ts.map +1 -0
- package/dist/mobile/mobile-screen-capture.d.ts +64 -0
- package/dist/mobile/mobile-screen-capture.d.ts.map +1 -0
- package/dist/mobile/ocr-provider.d.ts +187 -0
- package/dist/mobile/ocr-provider.d.ts.map +1 -0
- package/dist/mobile/ocr-provider.js +111 -0
- package/dist/mobile/ocr-provider.js.map +10 -0
- package/dist/osworld/action-converter.d.ts +38 -0
- package/dist/osworld/action-converter.d.ts.map +1 -0
- package/dist/osworld/adapter.d.ts +79 -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/parity/index.d.ts +9 -0
- package/dist/parity/index.d.ts.map +1 -0
- package/dist/parity/parity-matrix.d.ts +82 -0
- package/dist/parity/parity-matrix.d.ts.map +1 -0
- package/dist/parity/screenspot.d.ts +56 -0
- package/dist/parity/screenspot.d.ts.map +1 -0
- package/dist/platform/a11y.d.ts +64 -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 +33 -0
- package/dist/platform/capabilities.d.ts.map +1 -0
- package/dist/platform/capture.d.ts +65 -0
- package/dist/platform/capture.d.ts.map +1 -0
- package/dist/platform/clipboard.d.ts +24 -0
- package/dist/platform/clipboard.d.ts.map +1 -0
- package/dist/platform/coords.d.ts +73 -0
- package/dist/platform/coords.d.ts.map +1 -0
- package/dist/platform/desktop.d.ts +56 -0
- package/dist/platform/desktop.d.ts.map +1 -0
- package/dist/platform/displays.d.ts +97 -0
- package/dist/platform/displays.d.ts.map +1 -0
- package/dist/platform/driver.d.ts +49 -0
- package/dist/platform/driver.d.ts.map +1 -0
- package/dist/platform/file-ops.d.ts +27 -0
- package/dist/platform/file-ops.d.ts.map +1 -0
- package/dist/platform/helpers.d.ts +60 -0
- package/dist/platform/helpers.d.ts.map +1 -0
- package/dist/platform/launch.d.ts +54 -0
- package/dist/platform/launch.d.ts.map +1 -0
- package/dist/platform/normalized-coords.d.ts +46 -0
- package/dist/platform/normalized-coords.d.ts.map +1 -0
- package/dist/platform/nut-driver.d.ts +86 -0
- package/dist/platform/nut-driver.d.ts.map +1 -0
- package/dist/platform/permissions.d.ts +33 -0
- package/dist/platform/permissions.d.ts.map +1 -0
- package/dist/platform/process-list.d.ts +32 -0
- package/dist/platform/process-list.d.ts.map +1 -0
- package/dist/platform/ps-host.d.ts +77 -0
- package/dist/platform/ps-host.d.ts.map +1 -0
- package/dist/platform/screenshot-errors.d.ts +54 -0
- package/dist/platform/screenshot-errors.d.ts.map +1 -0
- package/dist/platform/screenshot-quality.d.ts +11 -0
- package/dist/platform/screenshot-quality.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 +20 -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/wayland-portal.d.ts +25 -0
- package/dist/platform/wayland-portal.d.ts.map +1 -0
- package/dist/platform/windows-list.d.ts +78 -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/providers/scene.d.ts +21 -0
- package/dist/providers/scene.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 +13836 -0
- package/dist/register-routes.js.map +71 -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/sandbox/docker-backend.d.ts +69 -0
- package/dist/sandbox/docker-backend.d.ts.map +1 -0
- package/dist/sandbox/index.d.ts +62 -0
- package/dist/sandbox/index.d.ts.map +1 -0
- package/dist/sandbox/qemu-backend.d.ts +48 -0
- package/dist/sandbox/qemu-backend.d.ts.map +1 -0
- package/dist/sandbox/remote-guest.d.ts +72 -0
- package/dist/sandbox/remote-guest.d.ts.map +1 -0
- package/dist/sandbox/sandbox-driver.d.ts +41 -0
- package/dist/sandbox/sandbox-driver.d.ts.map +1 -0
- package/dist/sandbox/surface-types.d.ts +17 -0
- package/dist/sandbox/surface-types.d.ts.map +1 -0
- package/dist/sandbox/types.d.ts +138 -0
- package/dist/sandbox/types.d.ts.map +1 -0
- package/dist/sandbox/wsb-backend.d.ts +48 -0
- package/dist/sandbox/wsb-backend.d.ts.map +1 -0
- package/dist/scene/a11y-provider.d.ts +83 -0
- package/dist/scene/a11y-provider.d.ts.map +1 -0
- package/dist/scene/apps.d.ts +39 -0
- package/dist/scene/apps.d.ts.map +1 -0
- package/dist/scene/dhash.d.ts +105 -0
- package/dist/scene/dhash.d.ts.map +1 -0
- package/dist/scene/ocr-adapter.d.ts +64 -0
- package/dist/scene/ocr-adapter.d.ts.map +1 -0
- package/dist/scene/scene-builder.d.ts +107 -0
- package/dist/scene/scene-builder.d.ts.map +1 -0
- package/dist/scene/scene-types.d.ts +70 -0
- package/dist/scene/scene-types.d.ts.map +1 -0
- package/dist/scene/screen-state.d.ts +105 -0
- package/dist/scene/screen-state.d.ts.map +1 -0
- package/dist/scene/serialize.d.ts +28 -0
- package/dist/scene/serialize.d.ts.map +1 -0
- package/dist/security/browser-script-policy.d.ts +9 -0
- package/dist/security/browser-script-policy.d.ts.map +1 -0
- package/dist/services/computer-use-service.d.ts +142 -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/services/index.d.ts +7 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/vision-context-provider.d.ts +32 -0
- package/dist/services/vision-context-provider.d.ts.map +1 -0
- package/dist/types.d.ts +385 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +16 -5
- package/registry-entry.json +74 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Coordinate translation between display-local and OS-global pixel space (WS5).
|
|
3
|
+
*
|
|
4
|
+
* Contract:
|
|
5
|
+
* - Every public mouse-bearing action accepts `{displayId, x, y}` where
|
|
6
|
+
* `(x, y)` is LOCAL to that display (top-left = 0,0, units = pixels of the
|
|
7
|
+
* display's logical bounds).
|
|
8
|
+
* - This module translates to the OS-global space the input drivers expect.
|
|
9
|
+
*
|
|
10
|
+
* Why local-first:
|
|
11
|
+
* - The model sees each display independently (one capture, no virtual
|
|
12
|
+
* desktop stitching). Local coords match what the model just looked at.
|
|
13
|
+
* - Virtual-desktop coords are a perpetual DPI / negative-origin bug source.
|
|
14
|
+
*
|
|
15
|
+
* Per-OS behavior of the input drivers we wrap (nutjs / xdotool / cliclick /
|
|
16
|
+
* PowerShell `SetCursorPos`):
|
|
17
|
+
* - Linux/X11: drivers expect global pixel coords matching xrandr origins.
|
|
18
|
+
* Translation = display.x + local.x. No DPI conversion.
|
|
19
|
+
* - Windows: `SetCursorPos` and nutjs both take physical pixel coords
|
|
20
|
+
* when the process is PerMonitorV2 DPI aware. Translation = display.x +
|
|
21
|
+
* local.x. No multiplier here — caller is responsible for declaring
|
|
22
|
+
* dpiAwareness.
|
|
23
|
+
* - macOS: Quartz event coords are in points (logical), not backing-
|
|
24
|
+
* store pixels. Translation = display.x + local.x with no scale multiply
|
|
25
|
+
* IF the local coords are also in points. We document the local coord
|
|
26
|
+
* space as "logical pixels" matching the capture's render at logical
|
|
27
|
+
* resolution; for retina captures the screenshot is upsampled to backing-
|
|
28
|
+
* store pixels and the model is expected to scale clicks back down
|
|
29
|
+
* before sending. The translator divides by scaleFactor when local
|
|
30
|
+
* coords were sourced from a backing-store-resolution screenshot.
|
|
31
|
+
*/
|
|
32
|
+
export interface LocalPoint {
|
|
33
|
+
displayId: number;
|
|
34
|
+
x: number;
|
|
35
|
+
y: number;
|
|
36
|
+
}
|
|
37
|
+
export interface GlobalPoint {
|
|
38
|
+
x: number;
|
|
39
|
+
y: number;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Resolve a LocalPoint to a GlobalPoint the input driver can act on.
|
|
43
|
+
*
|
|
44
|
+
* `coordSource` describes the coordinate reference:
|
|
45
|
+
* - `"logical"` (default) — local coords are in logical pixels matching the
|
|
46
|
+
* display's `bounds[2..3]`. No scale conversion is applied.
|
|
47
|
+
* - `"backing"` — local coords were taken against a capture rendered at
|
|
48
|
+
* `bounds * scaleFactor` (e.g. raw retina PNG). They are divided by
|
|
49
|
+
* scaleFactor before translation. macOS-only relevant.
|
|
50
|
+
*/
|
|
51
|
+
export declare function localToGlobal(point: LocalPoint, coordSource?: "logical" | "backing"): GlobalPoint;
|
|
52
|
+
/**
|
|
53
|
+
* As `localToGlobal`, but tolerates a missing displayId by defaulting to the
|
|
54
|
+
* primary display. Logs nothing — callers should warn before using this.
|
|
55
|
+
*/
|
|
56
|
+
export declare function localToGlobalDefault(point: {
|
|
57
|
+
displayId?: number;
|
|
58
|
+
x: number;
|
|
59
|
+
y: number;
|
|
60
|
+
}, coordSource?: "logical" | "backing"): GlobalPoint;
|
|
61
|
+
/**
|
|
62
|
+
* Inverse: given an OS-global point, return the (displayId, x, y) of the
|
|
63
|
+
* display containing it. Returns null if no display contains the point.
|
|
64
|
+
* Useful for translating OS-reported cursor positions back to local coords.
|
|
65
|
+
*/
|
|
66
|
+
export declare function globalToLocal(point: GlobalPoint): LocalPoint | null;
|
|
67
|
+
/**
|
|
68
|
+
* Validate a local point is inside its display's bounds. Returns the clamped
|
|
69
|
+
* point — never throws. Use this before sending to drivers that crash on
|
|
70
|
+
* out-of-bounds coords on some Linux versions.
|
|
71
|
+
*/
|
|
72
|
+
export declare function clampToDisplay(point: LocalPoint): LocalPoint;
|
|
73
|
+
//# sourceMappingURL=coords.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coords.d.ts","sourceRoot":"","sources":["../../src/platform/coords.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAMH,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,WAAW;IAC1B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,UAAU,EACjB,WAAW,GAAE,SAAS,GAAG,SAAqB,GAC7C,WAAW,CAUb;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EACnD,WAAW,GAAE,SAAS,GAAG,SAAqB,GAC7C,WAAW,CASb;AAuBD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,UAAU,GAAG,IAAI,CAQnE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,CAS5D"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-platform desktop automation — mouse, keyboard, scroll, drag.
|
|
3
|
+
*
|
|
4
|
+
* Ported from coasty-ai/open-computer-use desktop-automation.ts (Apache 2.0)
|
|
5
|
+
* and eliza sandbox-routes.ts performClick/performType/performKeypress.
|
|
6
|
+
*
|
|
7
|
+
* Platform backends:
|
|
8
|
+
* macOS — cliclick (preferred, brew install cliclick) or AppleScript fallback
|
|
9
|
+
* Linux — xdotool (required: sudo apt install xdotool)
|
|
10
|
+
* Windows — PowerShell with user32.dll P/Invoke
|
|
11
|
+
*
|
|
12
|
+
* All coordinate inputs are validated via validateInt() to prevent injection.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Read the current OS cursor position (legacy shell driver). Returns global
|
|
16
|
+
* logical pixels. Windows uses `System.Windows.Forms.Cursor` (must Add-Type the
|
|
17
|
+
* assembly first or the type is unresolved); macOS uses `cliclick p:.`; Linux
|
|
18
|
+
* uses `xdotool getmouselocation`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function legacyGetCursorPosition(): {
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
};
|
|
24
|
+
export declare function desktopClick(x: number, y: number): void;
|
|
25
|
+
export declare function desktopClickWithModifiers(x: number, y: number, modifiers: string[]): void;
|
|
26
|
+
export declare function desktopDoubleClick(x: number, y: number): void;
|
|
27
|
+
export declare function desktopRightClick(x: number, y: number): void;
|
|
28
|
+
export declare function desktopMouseMove(x: number, y: number): void;
|
|
29
|
+
export declare function desktopDrag(x1: number, y1: number, x2: number, y2: number): void;
|
|
30
|
+
export declare function desktopScroll(x: number, y: number, direction: "up" | "down" | "left" | "right", amount?: number): void;
|
|
31
|
+
export declare function desktopType(text: string): void;
|
|
32
|
+
/**
|
|
33
|
+
* Press a single key by name (e.g. "Return", "Tab", "Escape", "F5").
|
|
34
|
+
*/
|
|
35
|
+
export declare function desktopKeyPress(key: string): void;
|
|
36
|
+
/**
|
|
37
|
+
* Press a key combination like "ctrl+c", "cmd+shift+s", "alt+F4".
|
|
38
|
+
* Modifier names: ctrl, shift, alt, cmd/meta/super.
|
|
39
|
+
*
|
|
40
|
+
* Ported from open-computer-use desktopKeyCombo().
|
|
41
|
+
*/
|
|
42
|
+
export declare function desktopKeyCombo(combo: string): void;
|
|
43
|
+
/**
|
|
44
|
+
* Windows fast-path for `set_value` (#9170 — trycua/cua `set_value`): use UI
|
|
45
|
+
* Automation `ValuePattern.SetValue` on the element under (x,y) to set its value
|
|
46
|
+
* directly, without synthesizing keystrokes. Returns `true` if the element
|
|
47
|
+
* exposed ValuePattern and was set; `false` (incl. on any error) so the caller
|
|
48
|
+
* falls back to the universal focus → select-all → type path.
|
|
49
|
+
*
|
|
50
|
+
* Uses `Add-Type -AssemblyName` (signed framework assemblies), not a
|
|
51
|
+
* runtime-compiled inline class. Real actuation is exercised by the interactive
|
|
52
|
+
* real-driver lane; this box's session can't host a ValuePattern control to
|
|
53
|
+
* probe it (see #9170).
|
|
54
|
+
*/
|
|
55
|
+
export declare function win32TrySetValueByPattern(x: number, y: number, value: string): boolean;
|
|
56
|
+
//# sourceMappingURL=desktop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"desktop.d.ts","sourceRoot":"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AE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,KAAK,EAAE,MAAM,GACZ,OAAO,CAsBT"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Multi-monitor display enumeration (WS5).
|
|
3
|
+
*
|
|
4
|
+
* Returns the live set of physical displays attached to the host, in a
|
|
5
|
+
* single, OS-agnostic shape:
|
|
6
|
+
*
|
|
7
|
+
* { id, bounds: [x, y, w, h], scaleFactor, primary, name }
|
|
8
|
+
*
|
|
9
|
+
* Notes on `id`:
|
|
10
|
+
* - macOS — `CGDirectDisplayID` (32-bit unsigned). Stable across reboots.
|
|
11
|
+
* - Windows — `Screen.DeviceName` hash → small integer. We expose a 0-based
|
|
12
|
+
* index because PowerShell `System.Windows.Forms.Screen` does
|
|
13
|
+
* not surface a kernel handle, and the device name (e.g.
|
|
14
|
+
* `\\.\DISPLAY1`) is a string. The index is stable for a given
|
|
15
|
+
* process but may shift across hot-plug events.
|
|
16
|
+
* - Linux X — `xrandr --listmonitors` ordinal. Stable per process.
|
|
17
|
+
* - Linux W — compositor-specific output id (Hyprland/Sway). Best effort.
|
|
18
|
+
*
|
|
19
|
+
* Coordinate space:
|
|
20
|
+
* `bounds` is in OS-global pixel space. On macOS, that means scaled
|
|
21
|
+
* "points" by default — we record the backing-store scale factor in
|
|
22
|
+
* `scaleFactor` so callers can translate to pixel-perfect coords when
|
|
23
|
+
* composing captures.
|
|
24
|
+
*
|
|
25
|
+
* This module never executes input. It is read-only.
|
|
26
|
+
*/
|
|
27
|
+
export interface DisplayInfo {
|
|
28
|
+
/** OS-stable identifier or a 0-based fallback index. */
|
|
29
|
+
id: number;
|
|
30
|
+
/** [x, y, width, height] in OS-global pixel space. */
|
|
31
|
+
bounds: [number, number, number, number];
|
|
32
|
+
/** Backing-store scale factor. 1 on Linux, 1..N on HiDPI macOS/Windows. */
|
|
33
|
+
scaleFactor: number;
|
|
34
|
+
/** Whether this is the primary display. */
|
|
35
|
+
primary: boolean;
|
|
36
|
+
/** Human-readable name (e.g. `eDP-1`, `Built-in Retina Display`). */
|
|
37
|
+
name: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Error thrown when the host has no usable display surface. Headless Linux
|
|
41
|
+
* (no `DISPLAY` and no `WAYLAND_DISPLAY`), CI containers without an X
|
|
42
|
+
* server, and macOS/Windows hosts that report zero active displays all
|
|
43
|
+
* surface as this typed error so callers can distinguish "no monitors" from
|
|
44
|
+
* a transient enumeration failure.
|
|
45
|
+
*/
|
|
46
|
+
export declare class NoDisplayError extends Error {
|
|
47
|
+
readonly code: "NO_DISPLAY";
|
|
48
|
+
constructor(message: string);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* List all attached displays. Cached to avoid spamming xrandr / PowerShell on
|
|
52
|
+
* burst calls (provider runs every turn; see {@link CACHE_MS}).
|
|
53
|
+
*
|
|
54
|
+
* Returns a single-display fallback when the OS reports nothing — most
|
|
55
|
+
* callers want a sensible default, not an empty array. Use `isHeadless()`
|
|
56
|
+
* or `assertHasDisplays()` to distinguish the truly-headless case from a
|
|
57
|
+
* single attached monitor.
|
|
58
|
+
*/
|
|
59
|
+
export declare function listDisplays(): DisplayInfo[];
|
|
60
|
+
/** Force a fresh enumeration, ignoring cache. */
|
|
61
|
+
export declare function refreshDisplays(): DisplayInfo[];
|
|
62
|
+
/** Convenience: the primary display, or the first one if none is flagged. */
|
|
63
|
+
export declare function getPrimaryDisplay(): DisplayInfo;
|
|
64
|
+
/** Look up a display by id, or null if unknown. */
|
|
65
|
+
export declare function findDisplay(id: number): DisplayInfo | null;
|
|
66
|
+
/**
|
|
67
|
+
* Detect a truly headless host. Returns true when:
|
|
68
|
+
* - Linux: neither `DISPLAY` nor `WAYLAND_DISPLAY` is set, AND no
|
|
69
|
+
* compositor / X server enumeration tool reports anything.
|
|
70
|
+
* - macOS / Windows: enumeration via system_profiler / PowerShell yields
|
|
71
|
+
* zero displays.
|
|
72
|
+
* The single-display fallback returned by `listDisplays()` does NOT count as
|
|
73
|
+
* a real display for this check.
|
|
74
|
+
*/
|
|
75
|
+
export declare function isHeadless(): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Capture-path guard: throws `NoDisplayError` on a truly headless host.
|
|
78
|
+
* Callers that hit "no monitor" should surface this typed error rather than
|
|
79
|
+
* returning an empty buffer or a generic `Error`.
|
|
80
|
+
*/
|
|
81
|
+
export declare function assertHasDisplays(): void;
|
|
82
|
+
export declare function parseXrandrMonitors(output: string): DisplayInfo[];
|
|
83
|
+
export declare function parseHyprlandMonitors(output: string): DisplayInfo[];
|
|
84
|
+
export declare function parseSwayOutputs(output: string): DisplayInfo[];
|
|
85
|
+
export declare function parseDarwinDisplays(output: string): DisplayInfo[];
|
|
86
|
+
export declare function parseSystemProfilerDisplays(output: string): DisplayInfo[];
|
|
87
|
+
export declare function parseWindowsScreens(output: string): DisplayInfo[];
|
|
88
|
+
/**
|
|
89
|
+
* Asynchronously populate the display cache via the warm PowerShell host
|
|
90
|
+
* (Windows only). Lets the service pre-seed the cache at init without the
|
|
91
|
+
* blocking ~10-16s cold `powershell.exe` spawn that the sync
|
|
92
|
+
* {@link listDisplays} path would otherwise pay on the first turn. No-op (and
|
|
93
|
+
* never throws) when the host is unavailable — the sync path remains the
|
|
94
|
+
* fallback. Override the resulting TTL with `COMPUTERUSE_DISPLAYS_CACHE_MS`.
|
|
95
|
+
*/
|
|
96
|
+
export declare function warmDisplaysCache(): Promise<void>;
|
|
97
|
+
//# sourceMappingURL=displays.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"displays.d.ts","sourceRoot":"","sources":["../../src/platform/displays.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAMH,MAAM,WAAW,WAAW;IAC1B,wDAAwD;IACxD,EAAE,EAAE,MAAM,CAAC;IACX,sDAAsD;IACtD,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE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+
/**
|
|
2
|
+
* Driver-selection seam for desktop input + screenshot capture.
|
|
3
|
+
*
|
|
4
|
+
* Default = `nutjs` (cross-platform native bindings via @nut-tree-fork/nut-js).
|
|
5
|
+
* Set `ELIZA_COMPUTERUSE_DRIVER=legacy` to fall back to the per-OS shell
|
|
6
|
+
* drivers (cliclick/xdotool/PowerShell). The legacy drivers also activate
|
|
7
|
+
* automatically when the nutjs native module fails to load.
|
|
8
|
+
*
|
|
9
|
+
* Each exported function dispatches to the chosen backend. Callers (the
|
|
10
|
+
* service, actions, tests) use these wrappers; the underlying `desktop.ts`
|
|
11
|
+
* and `screenshot.ts` modules remain importable for the legacy code path.
|
|
12
|
+
*/
|
|
13
|
+
import type { ScreenRegion } from "../types.js";
|
|
14
|
+
export type DriverName = "nutjs" | "legacy";
|
|
15
|
+
export declare function selectedDriver(): DriverName;
|
|
16
|
+
export declare function driverClick(x: number, y: number): Promise<void>;
|
|
17
|
+
export declare function driverClickWithModifiers(x: number, y: number, modifiers: string[]): Promise<void>;
|
|
18
|
+
export declare function driverDoubleClick(x: number, y: number): Promise<void>;
|
|
19
|
+
export declare function driverRightClick(x: number, y: number): Promise<void>;
|
|
20
|
+
export declare function driverMiddleClick(x: number, y: number): Promise<void>;
|
|
21
|
+
export declare function driverMouseDown(x: number, y: number, button?: "left" | "middle" | "right"): Promise<void>;
|
|
22
|
+
export declare function driverMouseUp(x: number, y: number, button?: "left" | "middle" | "right"): Promise<void>;
|
|
23
|
+
export declare function driverMouseMove(x: number, y: number): Promise<void>;
|
|
24
|
+
export declare function driverGetCursorPosition(): Promise<{
|
|
25
|
+
x: number;
|
|
26
|
+
y: number;
|
|
27
|
+
}>;
|
|
28
|
+
export declare function driverDrag(x1: number, y1: number, x2: number, y2: number): Promise<void>;
|
|
29
|
+
export declare function driverDragPath(path: Array<{
|
|
30
|
+
x: number;
|
|
31
|
+
y: number;
|
|
32
|
+
}>): Promise<void>;
|
|
33
|
+
export declare function driverScroll(x: number, y: number, direction: "up" | "down" | "left" | "right", amount?: number): Promise<void>;
|
|
34
|
+
export declare function driverType(text: string): Promise<void>;
|
|
35
|
+
export declare function driverKeyPress(key: string): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Set the value of the UI element at (x,y) (#9170 — trycua/cua `set_value`).
|
|
38
|
+
* On Windows, first try UI Automation `ValuePattern.SetValue` (direct, no
|
|
39
|
+
* keystrokes — best for text inputs / combo boxes). Universal fallback (all
|
|
40
|
+
* platforms, incl. elements without ValuePattern): click to focus, select-all,
|
|
41
|
+
* then type the value — composed of the already-verified click/key-combo/type
|
|
42
|
+
* primitives. `value` is validated by the underlying type primitive.
|
|
43
|
+
*/
|
|
44
|
+
export declare function driverSetValue(x: number, y: number, value: string): Promise<void>;
|
|
45
|
+
export declare function driverKeyCombo(combo: string): Promise<void>;
|
|
46
|
+
export declare function driverKeyDown(key: string): Promise<void>;
|
|
47
|
+
export declare function driverKeyUp(key: string): Promise<void>;
|
|
48
|
+
export declare function driverCaptureScreenshot(region?: ScreenRegion): Promise<Buffer>;
|
|
49
|
+
//# sourceMappingURL=driver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../src/platform/driver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAuChD,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,QAAQ,CAAC;AAI5C,wBAAgB,cAAc,IAAI,UAAU,CA0B3C;AAID,wBAAsB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGrE;AAED,wBAAsB,wBAAwB,CAC5C,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,SAAS,EAAE,MAAM,EAAE,GAClB,OAAO,CAAC,IAAI,CAAC,CAIf;AAED,wBAAsB,iBAAiB,CAAC,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MAAM,GAAG,OAAO,EAC3C,MAAM,SAAI,GACT,OAAO,CAAC,IAAI,CAAC,CAGf;AAID,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAG5D;AAED,wBAAsB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAG/D;AAED;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAClC,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC,CAOf;AAED,wBAAsB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGjE;AAED,wBAAsB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAG9D;AAED,wBAAsB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAG5D;AAID,wBAAsB,uBAAuB,CAC3C,MAAM,CAAC,EAAE,YAAY,GACpB,OAAO,CAAC,MAAM,CAAC,CASjB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { FileActionResult } from "../types.js";
|
|
2
|
+
export declare function readFile(targetPath: string, encoding?: BufferEncoding): Promise<FileActionResult>;
|
|
3
|
+
export declare function writeFile(targetPath: string, content: string): Promise<FileActionResult>;
|
|
4
|
+
export declare function editFile(targetPath: string, oldText: string, newText: string): Promise<FileActionResult>;
|
|
5
|
+
export declare function appendFile(targetPath: string, content: string): Promise<FileActionResult>;
|
|
6
|
+
export declare function deleteFile(targetPath: string): Promise<FileActionResult>;
|
|
7
|
+
export declare function fileExists(targetPath: string): Promise<FileActionResult>;
|
|
8
|
+
export declare function listDirectory(targetPath: string): Promise<FileActionResult>;
|
|
9
|
+
export declare function deleteDirectory(targetPath: string): Promise<FileActionResult>;
|
|
10
|
+
/**
|
|
11
|
+
* Read raw bytes as base64 (#9170 — cua `read_bytes`). Optional byte `offset` /
|
|
12
|
+
* `length` window for chunked transfer of a sandbox guest file. Unlike `readFile`
|
|
13
|
+
* (text, truncated to 10k chars) this is binary-safe and returns the exact bytes.
|
|
14
|
+
*/
|
|
15
|
+
export declare function readBytes(targetPath: string, offset?: number, length?: number): Promise<FileActionResult>;
|
|
16
|
+
/**
|
|
17
|
+
* Write base64-encoded bytes to a file (#9170 — cua `write_bytes`), creating
|
|
18
|
+
* parent directories. Binary-safe counterpart to `writeFile`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function writeBytes(targetPath: string, base64: string): Promise<FileActionResult>;
|
|
21
|
+
/** Create a directory (recursive) (#9170 — cua `create_dir`). */
|
|
22
|
+
export declare function createDirectory(targetPath: string): Promise<FileActionResult>;
|
|
23
|
+
/** Whether a path exists AND is a directory (#9170 — cua `directory_exists`). */
|
|
24
|
+
export declare function directoryExists(targetPath: string): Promise<FileActionResult>;
|
|
25
|
+
/** File/dir size in bytes (#9170 — cua `get_file_size`). */
|
|
26
|
+
export declare function getFileSize(targetPath: string): Promise<FileActionResult>;
|
|
27
|
+
//# sourceMappingURL=file-ops.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-ops.d.ts","sourceRoot":"","sources":["../../src/platform/file-ops.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAa,MAAM,aAAa,CAAC;AAG/D,wBAAsB,QAAQ,CAC5B,UAAU,EAAE,MAAM,EAClB,QAAQ,GAAE,cAAuB,GAChC,OAAO,CAAC,gBAAgB,CAAC,CAmB3B;AAED,wBAAsB,SAAS,CAC7B,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,gBAAgB,CAAC,CAoB3B;AAED,wBAAsB,QAAQ,CAC5B,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,gBAAgB,CAAC,CA8B3B;AAED,wBAAsB,UAAU,CAC9B,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,gBAAgB,CAAC,CAoB3B;AAED,wBAAsB,UAAU,CAC9B,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,gBAAgB,CAAC,CAmB3B;AAED,wBAAsB,UAAU,CAC9B,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,gBAAgB,CAAC,CA+B3B;AAED,wBAAsB,aAAa,CACjC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,gBAAgB,CAAC,CA0B3B;AAED,wBAAsB,eAAe,CACnC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,gBAAgB,CAAC,CAmB3B;AASD;;;;GAIG;AACH,wBAAsB,SAAS,CAC7B,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,gBAAgB,CAAC,CAwB3B;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAC9B,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,gBAAgB,CAAC,CAkB3B;AAED,iEAAiE;AACjE,wBAAsB,eAAe,CACnC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,gBAAgB,CAAC,CAiB3B;AAED,iFAAiF;AACjF,wBAAsB,eAAe,CACnC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,gBAAgB,CAAC,CAwB3B;AAED,4DAA4D;AAC5D,wBAAsB,WAAW,CAC/B,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,gBAAgB,CAAC,CAmB3B"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared platform utilities for computer-use plugin.
|
|
3
|
+
*
|
|
4
|
+
* Ported from coasty-ai/open-computer-use desktop-automation.ts
|
|
5
|
+
* and eliza sandbox-routes.ts (Apache 2.0 / MIT).
|
|
6
|
+
*/
|
|
7
|
+
export declare function commandExists(cmd: string): boolean;
|
|
8
|
+
/** Reset the {@link commandExists} memo (test-only / PATH change). */
|
|
9
|
+
export declare function clearCommandExistsCache(): void;
|
|
10
|
+
/**
|
|
11
|
+
* Run a command via execFileSync (no shell) with timeout.
|
|
12
|
+
* Throws on non-zero exit or timeout.
|
|
13
|
+
*/
|
|
14
|
+
export declare function runCommand(command: string, args: string[], timeout: number): string;
|
|
15
|
+
/**
|
|
16
|
+
* Run a command via execFileSync, returning the raw Buffer stdout.
|
|
17
|
+
*/
|
|
18
|
+
export declare function runCommandBuffer(command: string, args: string[], timeout: number): void;
|
|
19
|
+
/**
|
|
20
|
+
* Run a shell command string (uses shell). Use sparingly — prefer runCommand.
|
|
21
|
+
*/
|
|
22
|
+
export declare function runShellCommand(cmd: string, timeout: number): string;
|
|
23
|
+
/**
|
|
24
|
+
* Coerce a value to a safe integer to prevent shell injection via coordinates.
|
|
25
|
+
* Ported from open-computer-use desktop-automation.ts validateInt().
|
|
26
|
+
*/
|
|
27
|
+
export declare function validateInt(val: unknown): number;
|
|
28
|
+
/**
|
|
29
|
+
* Validate and clamp coordinates within screen bounds.
|
|
30
|
+
*/
|
|
31
|
+
export declare function validateCoordinate(x: number, y: number, maxX: number, maxY: number): [number, number];
|
|
32
|
+
/**
|
|
33
|
+
* Validate a window/process identifier before interpolating it into a
|
|
34
|
+
* platform shell command (AppleScript / PowerShell). Rejects anything that
|
|
35
|
+
* is not a decimal integer or `0x`-prefixed hex, preventing escape out of
|
|
36
|
+
* the surrounding script literal.
|
|
37
|
+
*/
|
|
38
|
+
export declare function validateWindowId(windowId: string): string;
|
|
39
|
+
/**
|
|
40
|
+
* Validate text input length to prevent abuse.
|
|
41
|
+
*/
|
|
42
|
+
export declare function validateText(text: string, maxLength?: number): string;
|
|
43
|
+
/**
|
|
44
|
+
* Safely escape a string for use inside an AppleScript double-quoted literal.
|
|
45
|
+
* Ported from open-computer-use desktop-automation.ts.
|
|
46
|
+
*/
|
|
47
|
+
export declare function escapeAppleScript(value: string): string;
|
|
48
|
+
/**
|
|
49
|
+
* Validate a key name for xdotool. Must be a known key name or a single
|
|
50
|
+
* printable ASCII character.
|
|
51
|
+
*/
|
|
52
|
+
export declare function safeXdotoolKey(key: string): string;
|
|
53
|
+
export declare function validateKeypress(keys: string, maxLength?: number): string;
|
|
54
|
+
export declare function canonicalKeyName(key: string): string;
|
|
55
|
+
export declare function toCliclickKeyName(key: string): string;
|
|
56
|
+
export declare function toXdotoolKeyName(key: string): string;
|
|
57
|
+
export declare function toWindowsSendKey(key: string): string;
|
|
58
|
+
export type PlatformOS = "darwin" | "linux" | "win32";
|
|
59
|
+
export declare function currentPlatform(): PlatformOS;
|
|
60
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/platform/helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAiBH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAalD;AAED,sEAAsE;AACtE,wBAAgB,uBAAuB,IAAI,IAAI,CAE9C;AAED;;;GAGG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE,MAAM,GACd,MAAM,CAOR;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE,MAAM,GACd,IAAI,CAKN;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAMpE;AAID;;;GAGG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAYhD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GACX,CAAC,MAAM,EAAE,MAAM,CAAC,CAIlB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAWzD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,SAAO,GAAG,MAAM,CAQnE;AAID;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEvD;AA8DD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAgBlD;AAOD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,SAAM,GAAG,MAAM,CAetE;AAoCD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAMpD;AAmBD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAGrD;AAmBD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAMpD;AAmBD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAMpD;AAID,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC;AAEtD,wBAAgB,eAAe,IAAI,UAAU,CAM5C"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Open a target (file / URL / folder) and launch applications (#9170 M12).
|
|
3
|
+
*
|
|
4
|
+
* trycua/cua exposes `open(target)` and `launch(app, args) -> pid`. Eliza had
|
|
5
|
+
* neither as a COMPUTER_USE verb. These are real desktop automation (the agent
|
|
6
|
+
* opening a document or starting an app), so they live in the COMPUTER_USE
|
|
7
|
+
* action and pass through the approval manager like every other non-read verb.
|
|
8
|
+
*
|
|
9
|
+
* Implementation notes:
|
|
10
|
+
* - `open` shells the OS default-handler (`open` / `xdg-open` / `start`), so a
|
|
11
|
+
* URL opens in the browser, a file in its default app, a folder in the file
|
|
12
|
+
* manager — exactly the OS double-click behavior.
|
|
13
|
+
* - `launch` spawns the executable DETACHED and returns its pid so the caller
|
|
14
|
+
* can track / focus it. The child is unref'd so it outlives the agent turn.
|
|
15
|
+
*/
|
|
16
|
+
/** Result of a launch — the spawned process id (and the resolved command). */
|
|
17
|
+
export interface LaunchResult {
|
|
18
|
+
pid: number;
|
|
19
|
+
command: string;
|
|
20
|
+
args: string[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Open a file / URL / folder with the OS default handler. Resolves once the
|
|
24
|
+
* launcher returns (the launcher exits immediately; the opened app keeps
|
|
25
|
+
* running). Rejects on a non-zero launcher exit.
|
|
26
|
+
*/
|
|
27
|
+
export declare function openTarget(target: string): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Launch an application detached and return its pid. `app` is an executable
|
|
30
|
+
* name/path (or, on macOS, an app-bundle name launched via `open -a`). The
|
|
31
|
+
* child is unref'd so it survives the agent turn.
|
|
32
|
+
*/
|
|
33
|
+
export declare function launchApp(app: string, args?: string[]): Promise<LaunchResult>;
|
|
34
|
+
/** Result of a kill — the resolved target and how it was addressed. */
|
|
35
|
+
export interface KillResult {
|
|
36
|
+
target: string;
|
|
37
|
+
/** Numeric pid when the target was a pid; omitted for a process-name kill. */
|
|
38
|
+
pid?: number;
|
|
39
|
+
killed: true;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Terminate a running application by pid (all-digits) or process name
|
|
43
|
+
* (#9170 — trycua/cua `kill_app`). Pairs with `launchApp`. Destructive, so it
|
|
44
|
+
* routes through the approval manager like every other non-read verb. Uses
|
|
45
|
+
* `execFile` (no shell) so the target can't inject a command.
|
|
46
|
+
*
|
|
47
|
+
* - Windows: `taskkill /F /PID <n>` or `/F /IM <name>.exe`.
|
|
48
|
+
* - macOS / Linux: `kill -9 <pid>` or `pkill -f <name>`.
|
|
49
|
+
*
|
|
50
|
+
* Rejects when the target does not exist (non-zero exit) so the caller gets
|
|
51
|
+
* clear feedback rather than a silent no-op.
|
|
52
|
+
*/
|
|
53
|
+
export declare function killApp(target: string): Promise<KillResult>;
|
|
54
|
+
//# sourceMappingURL=launch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launch.d.ts","sourceRoot":"","sources":["../../src/platform/launch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,8EAA8E;AAC9E,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAID;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BxD;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CACvB,GAAG,EAAE,MAAM,EACX,IAAI,GAAE,MAAM,EAAO,GAClB,OAAO,CAAC,YAAY,CAAC,CA6CvB;AAED,uEAAuE;AACvE,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,8EAA8E;IAC9E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,IAAI,CAAC;CACd;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAwC3D"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { ScreenRegion } from "../types.js";
|
|
2
|
+
/** Upper bound of each normalized axis (inclusive). 0 = left/top, 1000 = right/bottom. */
|
|
3
|
+
export declare const NORMALIZED_COORD_MAX = 1000;
|
|
4
|
+
/** A point in the 0–1000 normalized coordinate space. */
|
|
5
|
+
export interface NormalizedPoint {
|
|
6
|
+
nx: number;
|
|
7
|
+
ny: number;
|
|
8
|
+
}
|
|
9
|
+
/** A box in the 0–1000 normalized coordinate space (inclusive corners). */
|
|
10
|
+
export interface NormalizedBox {
|
|
11
|
+
nx0: number;
|
|
12
|
+
ny0: number;
|
|
13
|
+
nx1: number;
|
|
14
|
+
ny1: number;
|
|
15
|
+
}
|
|
16
|
+
/** A pixel point in some display/capture space. */
|
|
17
|
+
export interface PixelPoint {
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
}
|
|
21
|
+
/** The pixel extent a normalized point is measured against. */
|
|
22
|
+
export interface PixelBounds {
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
}
|
|
26
|
+
/** Clamp a normalized point into [0, 1000] on both axes. */
|
|
27
|
+
export declare function clampNormalized(point: NormalizedPoint): NormalizedPoint;
|
|
28
|
+
/**
|
|
29
|
+
* Map a pixel point in `bounds` to the 0–1000 normalized space. The input is
|
|
30
|
+
* clamped to the bounds first, so an off-screen coordinate maps to the nearest
|
|
31
|
+
* edge rather than escaping the canonical range.
|
|
32
|
+
*/
|
|
33
|
+
export declare function toNormalized(point: PixelPoint, bounds: PixelBounds): NormalizedPoint;
|
|
34
|
+
/**
|
|
35
|
+
* Map a normalized point back to a pixel point in `bounds`. Rounds to the nearest
|
|
36
|
+
* pixel and clamps into the bounds. Round-trips with {@link toNormalized} to
|
|
37
|
+
* within one pixel (the quantization error of the 1000-bucket grid).
|
|
38
|
+
*/
|
|
39
|
+
export declare function fromNormalized(point: NormalizedPoint, bounds: PixelBounds): PixelPoint;
|
|
40
|
+
/** Map a pixel rectangle (`ScreenRegion`) to a normalized box. */
|
|
41
|
+
export declare function boxToNormalized(region: ScreenRegion, bounds: PixelBounds): NormalizedBox;
|
|
42
|
+
/** Map a normalized box back to a pixel `ScreenRegion` (non-negative width/height). */
|
|
43
|
+
export declare function boxFromNormalized(box: NormalizedBox, bounds: PixelBounds): ScreenRegion;
|
|
44
|
+
/** The pixel center of a normalized box — the click target a grounded element resolves to. */
|
|
45
|
+
export declare function normalizedBoxCenter(box: NormalizedBox, bounds: PixelBounds): PixelPoint;
|
|
46
|
+
//# sourceMappingURL=normalized-coords.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalized-coords.d.ts","sourceRoot":"","sources":["../../src/platform/normalized-coords.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,0FAA0F;AAC1F,eAAO,MAAM,oBAAoB,OAAO,CAAC;AAEzC,yDAAyD;AACzD,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,2EAA2E;AAC3E,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb;AAED,mDAAmD;AACnD,MAAM,WAAW,UAAU;IACzB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,+DAA+D;AAC/D,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAOD,4DAA4D;AAC5D,wBAAgB,eAAe,CAAC,KAAK,EAAE,eAAe,GAAG,eAAe,CAKvE;AAcD;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,WAAW,GAClB,eAAe,CAKjB;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,eAAe,EACtB,MAAM,EAAE,WAAW,GAClB,UAAU,CAKZ;AAED,kEAAkE;AAClE,wBAAgB,eAAe,CAC7B,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,WAAW,GAClB,aAAa,CAOf;AAED,uFAAuF;AACvF,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,aAAa,EAClB,MAAM,EAAE,WAAW,GAClB,YAAY,CAMd;AAED,8FAA8F;AAC9F,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,aAAa,EAClB,MAAM,EAAE,WAAW,GAClB,UAAU,CAKZ"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-platform desktop driver backed by @nut-tree-fork/nut-js.
|
|
3
|
+
*
|
|
4
|
+
* Wraps native libnut bindings into the same input surface exposed by
|
|
5
|
+
* the legacy per-OS shell drivers in `desktop.ts` and `screenshot.ts`.
|
|
6
|
+
* Selected at runtime via `ELIZA_COMPUTERUSE_DRIVER=nutjs` (default) — the
|
|
7
|
+
* legacy shell drivers remain the fallback when the env var is set to
|
|
8
|
+
* `legacy` or when the native module fails to load.
|
|
9
|
+
*
|
|
10
|
+
* Native module loading: nut-js ships prebuilt binaries via `libnut`. We
|
|
11
|
+
* load it eagerly at module init and surface a clean diagnostic if the
|
|
12
|
+
* binary is missing for the current arch (`isAvailable()` reports false).
|
|
13
|
+
*/
|
|
14
|
+
import type { ScreenRegion } from "../types.js";
|
|
15
|
+
export declare function isAvailable(): boolean;
|
|
16
|
+
export declare function loadFailureReason(): string | null;
|
|
17
|
+
export declare function nutClick(x: number, y: number): Promise<void>;
|
|
18
|
+
export declare function nutClickWithModifiers(x: number, y: number, modifiers: string[]): Promise<void>;
|
|
19
|
+
export declare function nutDoubleClick(x: number, y: number): Promise<void>;
|
|
20
|
+
export declare function nutRightClick(x: number, y: number): Promise<void>;
|
|
21
|
+
export declare function nutMiddleClick(x: number, y: number): Promise<void>;
|
|
22
|
+
export declare function nutMouseMove(x: number, y: number): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Press (and hold) a mouse button at `(x, y)` without releasing it. Pairs with
|
|
25
|
+
* `nutMouseUp` to express hold-drags, marquee selection, and press-and-hold
|
|
26
|
+
* gestures that a single `click` cannot. The caller is responsible for the
|
|
27
|
+
* matching release.
|
|
28
|
+
*/
|
|
29
|
+
export declare function nutMouseDown(x: number, y: number, button?: "left" | "middle" | "right"): Promise<void>;
|
|
30
|
+
/** Release a previously-held mouse button at `(x, y)`. See {@link nutMouseDown}. */
|
|
31
|
+
export declare function nutMouseUp(x: number, y: number, button?: "left" | "middle" | "right"): Promise<void>;
|
|
32
|
+
/** Clamp a requested scroll amount to a safe per-notch count (1..20). Pure. */
|
|
33
|
+
export declare function clampScrollNotches(amount: number): number;
|
|
34
|
+
/**
|
|
35
|
+
* Interpolated integer waypoints from (x1,y1) to (x2,y2) over `steps` moves
|
|
36
|
+
* (excludes the start, includes the end). Pure — exported for unit tests.
|
|
37
|
+
*/
|
|
38
|
+
export declare function interpolateDragSteps(x1: number, y1: number, x2: number, y2: number, steps?: number): Array<{
|
|
39
|
+
x: number;
|
|
40
|
+
y: number;
|
|
41
|
+
}>;
|
|
42
|
+
export declare function nutDrag(x1: number, y1: number, x2: number, y2: number): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Densify a polyline by interpolating integer waypoints along every segment so
|
|
45
|
+
* a held-button drag traces curves/corners instead of teleporting corner to
|
|
46
|
+
* corner. Includes the very first point and every segment endpoint. Pure —
|
|
47
|
+
* exported for unit tests.
|
|
48
|
+
*
|
|
49
|
+
* `perSegmentSteps` controls how many intermediate points are inserted between
|
|
50
|
+
* consecutive vertices (≥1; the endpoint is always included).
|
|
51
|
+
*/
|
|
52
|
+
export declare function densifyDragPath(path: Array<{
|
|
53
|
+
x: number;
|
|
54
|
+
y: number;
|
|
55
|
+
}>, perSegmentSteps?: number): Array<{
|
|
56
|
+
x: number;
|
|
57
|
+
y: number;
|
|
58
|
+
}>;
|
|
59
|
+
/**
|
|
60
|
+
* Press the left button at the first point, move through every interpolated
|
|
61
|
+
* waypoint with the button held, then release at the last point. Backs
|
|
62
|
+
* multi-point `drag(path)` and AOSP swipe paths. Requires ≥2 points.
|
|
63
|
+
*/
|
|
64
|
+
export declare function nutDragPath(path: Array<{
|
|
65
|
+
x: number;
|
|
66
|
+
y: number;
|
|
67
|
+
}>): Promise<void>;
|
|
68
|
+
export declare function nutGetCursorPosition(): Promise<{
|
|
69
|
+
x: number;
|
|
70
|
+
y: number;
|
|
71
|
+
}>;
|
|
72
|
+
export declare function nutScroll(x: number, y: number, direction: "up" | "down" | "left" | "right", amount: number): Promise<void>;
|
|
73
|
+
export declare function nutType(text: string): Promise<void>;
|
|
74
|
+
export declare function nutKeyPress(key: string): Promise<void>;
|
|
75
|
+
/** Press (and hold) a single key without releasing it. Pairs with `nutKeyUp`
|
|
76
|
+
* to express press-and-hold (e.g. holding Shift while issuing other input). */
|
|
77
|
+
export declare function nutKeyDown(key: string): Promise<void>;
|
|
78
|
+
/** Release a previously-held key. See {@link nutKeyDown}. */
|
|
79
|
+
export declare function nutKeyUp(key: string): Promise<void>;
|
|
80
|
+
export declare function nutKeyCombo(combo: string): Promise<void>;
|
|
81
|
+
export declare function nutCaptureScreenshot(region?: ScreenRegion): Promise<Buffer>;
|
|
82
|
+
export declare function nutScreenSize(): Promise<{
|
|
83
|
+
width: number;
|
|
84
|
+
height: number;
|
|
85
|
+
}>;
|
|
86
|
+
//# sourceMappingURL=nut-driver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nut-driver.d.ts","sourceRoot":"","sources":["../../src/platform/nut-driver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAOH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAmEhD,wBAAgB,WAAW,IAAI,OAAO,CAErC;AAED,wBAAgB,iBAAiB,IAAI,MAAM,GAAG,IAAI,CAIjD;AAkHD,wBAAsB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAMlE;AAED,wBAAsB,qBAAqB,CACzC,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,SAAS,EAAE,MAAM,EAAE,GAClB,OAAO,CAA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MAAM,CAAC,EAAE,YAAY,GACpB,OAAO,CAAC,MAAM,CAAC,CAiCjB;AAED,wBAAsB,aAAa,IAAI,OAAO,CAAC;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC,CAOD"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { PermissionType } from "../types.js";
|
|
2
|
+
type PermissionErrorOptions = {
|
|
3
|
+
permissionType: PermissionType;
|
|
4
|
+
operation: string;
|
|
5
|
+
message: string;
|
|
6
|
+
details?: string;
|
|
7
|
+
};
|
|
8
|
+
export type PermissionDeniedError = Error & {
|
|
9
|
+
permissionDenied: true;
|
|
10
|
+
permissionType: PermissionType;
|
|
11
|
+
operation: string;
|
|
12
|
+
details?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function createPermissionDeniedError(options: PermissionErrorOptions): PermissionDeniedError;
|
|
15
|
+
export declare function isPermissionDeniedError(value: unknown): value is PermissionDeniedError;
|
|
16
|
+
export declare function classifyPermissionDeniedError(error: unknown, fallback: {
|
|
17
|
+
permissionType: PermissionType;
|
|
18
|
+
operation: string;
|
|
19
|
+
}): PermissionDeniedError | null;
|
|
20
|
+
export interface PermissionProbeResult {
|
|
21
|
+
/** True if the OS reports the permission is granted for this process. */
|
|
22
|
+
readonly granted: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* `null` when the OS doesn't expose a probe (Linux desktop, headless, etc.)
|
|
25
|
+
* — caller should treat this as "unknown, attempt the operation and rely on
|
|
26
|
+
* runtime classification".
|
|
27
|
+
*/
|
|
28
|
+
readonly probed: boolean;
|
|
29
|
+
readonly details?: string;
|
|
30
|
+
}
|
|
31
|
+
export declare function probePermission(permissionType: PermissionType): PermissionProbeResult;
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=permissions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../src/platform/permissions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,KAAK,sBAAsB,GAAG;IAC5B,cAAc,EAAE,cAAc,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,KAAK,GAAG;IAC1C,gBAAgB,EAAE,IAAI,CAAC;IACvB,cAAc,EAAE,cAAc,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAkCF,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,sBAAsB,GAC9B,qBAAqB,CAUvB;AAED,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,qBAAqB,CAQhC;AAcD,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE;IACR,cAAc,EAAE,cAAc,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;CACnB,GACA,qBAAqB,GAAG,IAAI,CAiF9B;AASD,MAAM,WAAW,qBAAqB;IACpC,yEAAyE;IACzE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAmCD,wBAAgB,eAAe,CAC7B,cAAc,EAAE,cAAc,GAC7B,qBAAqB,CA2BvB"}
|