computer-use 0.2.0

Cross-platform desktop automation for agents: screenshots, mouse, keyboard, accessibility, CDP, and isolation.
Documentation
[package]
name = "computer-use"
version = "0.2.0"
edition = "2021"
rust-version = "1.91"
license = "MIT OR Apache-2.0"
description = "Cross-platform desktop automation for agents: screenshots, mouse, keyboard, accessibility, CDP, and isolation."
repository = "https://github.com/lindoelio/computer-use"
homepage = "https://github.com/lindoelio/computer-use"
readme = "README.md"
keywords = ["computer-use", "automation", "gui", "agent", "screenshot"]
categories = [
    "command-line-utilities",
    "accessibility",
    "development-tools::testing",
]
authors = ["Lindoélio Lázaro"]
include = [
    "/src/**",
    "/tests/**",
    "/Cargo.toml",
    "/Cargo.lock",
    "/README.md",
    "/CHANGELOG.md",
    "/LICENSE-MIT",
    "/LICENSE-APACHE",
    # Documentation shipped with the crate tarball.
    "/docs/ROADMAP.md",
    "/docs/ISOLATION.md",
    "/docs/PACKAGING.md",
    "/docs/SKYLIGHT.md",
    "/docs/policy.example.toml",
    # macOS .app packaging assets and the build script. The bundle id is
    # `ai.lindoelio.computer-use`; the script ad-hoc signs when no Developer
    # ID is configured.
    "/packaging/macos/Info.plist",
    "/packaging/macos/entitlements.plist",
    "/scripts/package-macos-app.sh",
]

[lib]
name = "computer_use"
path = "src/lib.rs"

[[bin]]
name = "computer-use"
path = "src/main.rs"

[features]
default = []
# Crate dependencies are attached in the phase that uses them.
# P1 declares the names so `--all-features` compiles on every OS.
# P10: `cdp` pulls chromiumoxide and a minimal tokio for CDP attach.
cdp = ["dep:chromiumoxide", "dep:tokio", "dep:futures"]
skylight = []
virtual-display = ["skylight"]
# P13b: XDG Desktop Portal ScreenCast (capture) + RemoteDesktop (input) on
# Wayland. Off by default because `pipewire` links `libpipewire-0.3` and needs
# bindgen (libclang) at build time; on in the Linux release binary.
# The three crates are Linux-gated optional dependencies, so `--all-features`
# on macOS and Windows compiles without them.
portal = ["dep:ashpd", "dep:pipewire", "dep:reis"]

[dependencies]
base64 = "0.22"
clap = { version = "4", features = ["derive"] }
enigo = "0.3.0"
image = { version = "0.25", default-features = false, features = ["png", "jpeg"] }
serde = { version = "1", features = ["derive"] }
dirs = "6"
serde_json = "1"
thiserror = "2"
toml = "0.8.23"
xcap = "0.3.3"
# P10: optional CDP client (attach only, never to spawn). Pinned to 0.9.1 per the
# ROADMAP.md design.
chromiumoxide = { version = "0.9.1", optional = true, default-features = false }
# P10 builds the runtime fresh per call. P13a reuses the same dependency so the
# Linux AT-SPI work can `block_on` `AccessibilityConnection::new()` from the CLI
# thread without pulling in a second async runtime.
tokio = { version = "1", optional = true, default-features = false, features = [
    "rt",
] }
# `chromiumoxide`'s handler is a `futures::Stream`; we only use `StreamExt`
# to drive it inside our short-lived runtime.
futures = { version = "0.3", optional = true, default-features = false, features = [
    "std",
] }

[target.'cfg(unix)'.dependencies]
libc = "0.2"

# macOS and Windows pasteboards do not use the Wayland feature.
[target.'cfg(not(target_os = "linux"))'.dependencies]
arboard = "3.7.0"

# Default features pull `wayland-data-control`. X11 plus image data is enough.
# P13a: AT-SPI2 for the accessibility tree, actions, and component extents; the
# `connection` + `proxies` features pull zbus, the `AccessibilityConnection`
# builder, the `AccessibleProxy` we walk, and the `Action`/`Text`/`Value`/
# `Component` proxies that drive element actions. `x11rb` with the `xtest`
# feature provides XTest fake_input for the `event` input tier on plain X11
# (Wayland without portal is `unsupported` until part B). A small current-
# thread tokio runtime drives `block_on(AccessibilityConnection::new())` from
# the CLI thread.
[target.'cfg(target_os = "linux")'.dependencies]
arboard = { version = "3.7.0", default-features = false, features = ["image-data"] }
atspi = { version = "0.30.0", default-features = false, features = ["connection", "proxies"] }
x11rb = { version = "0.13", default-features = false, features = ["allow-unsafe-code", "xtest"] }
tokio = { version = "1", default-features = false, features = ["rt", "macros", "time"] }
# P13b: the `portal` feature. `ashpd` speaks the XDG Desktop Portal D-Bus
# interfaces (`screencast` for the capture dialog, `remote_desktop` for input);
# `pipewire` consumes the ScreenCast stream and pulls one video frame; `reis`
# is the optional libei client for relative motion. All three are optional so
# `--all-features` on macOS and Windows does not build them, and so a default
# `cargo test` on Linux needs no PipeWire at all.
#
# `pipewire` pulls `pipewire-sys` and `libspa-sys`, which run bindgen against
# the system headers; CI therefore installs `libpipewire-0.3-dev` plus
# `libclang-dev`/`clang` on ubuntu.
ashpd = { version = "0.13.13", default-features = false, optional = true, features = [
    "screencast",
    "remote_desktop",
    "tokio",
] }
pipewire = { version = "0.9", optional = true }
reis = { version = "0.7", default-features = false, optional = true, features = [
    "tokio",
] }

[target.'cfg(target_os = "macos")'.dependencies]
block2 = "0.6"
objc2 = "0.6.5"
objc2-app-kit = { version = "0.3.2", default-features = false, features = [
    "NSApplication",
    "NSBezierPath",
    "NSColor",
    "NSGraphics",
    "NSResponder",
    "NSRunningApplication",
    "NSScreen",
    "NSView",
    "NSWindow",
    "NSWorkspace",
    "block2",
    "objc2-core-foundation",
] }
objc2-application-services = { version = "0.3.2", default-features = false, features = [
    "AXError",
    "AXUIElement",
    "AXValue",
    "HIServices",
    "libc",
] }
objc2-core-foundation = { version = "0.3.2", default-features = false, features = [
    "CFArray",
    "CFBase",
    "CFCGTypes",
    "CFDate",
    "CFDictionary",
    "CFNumber",
    "CFMachPort",
    "CFRunLoop",
    "CFString",
    "CFURL",
] }
objc2-core-graphics = { version = "0.3.2", default-features = false, features = [
    "CGBitmapContext",
    "CGColorSpace",
    "CGContext",
    "CGDirectDisplay",
    "CGDisplayConfiguration",
    "CGError",
    "CGEvent",
    "CGEventSource",
    "CGEventTypes",
    "CGRemoteOperation",
    "CGGeometry",
    "CGImage",
    "CGSession",
    "CGWindow",
    "libc",
] }
objc2-core-media = { version = "0.3.2", default-features = false, features = [
    "CMSampleBuffer",
] }
dispatch2 = "0.3"
objc2-foundation = { version = "0.3.2", default-features = false, features = [
    "NSArray",
    "NSBundle",
    "NSData",
    "NSDictionary",
    "NSError",
    "NSObject",
    "NSProcessInfo",
    "NSString",
    "NSURL",
] }
objc2-screen-capture-kit = { version = "0.3.2", default-features = false, features = [
    "SCError",
    "SCScreenshotManager",
    "SCShareableContent",
    "SCStream",
    "block2",
    "dispatch2",
    "libc",
    "objc2-core-foundation",
    "objc2-core-graphics",
    "objc2-core-media",
] }
# P11: VNRecognizeTextRequest (accurate + language correction) for OCR.
objc2-vision = { version = "0.3.2", default-features = false, features = [
    "VNRecognizeTextRequest",
    "VNRequest",
    "VNRequestHandler",
    "VNObservation",
    "VNTypes",
    "objc2-core-foundation",
] }

# P12a: Windows UI Automation. `windows` is the Win32 surface for window
# enumeration and process lookups; `uiautomation` wraps the UIA COM stack
# (control view walker, control patterns). Both are target-gated.
#
# P12b adds `windows-capture` 2.0.1 for one `Windows.Graphics.Capture` frame
# from a resolved HWND, and `Media_Ocr` for `OcrEngine`. `Graphics_Imaging` is
# the `SoftwareBitmap` the OCR engine takes, `Security_Cryptography` is the
# `CryptographicBuffer::CreateFromByteArray` wrapper that copies our RGBA
# buffer into a WinRT `IBuffer`, and `Win32_UI_HiDpi` is `GetDpiForWindow`.
[target.'cfg(target_os = "windows")'.dependencies]
windows = { version = "0.62", default-features = false, features = [
    "Foundation",
    "Globalization",
    "Graphics_Imaging",
    "Media_Ocr",
    "Security_Cryptography",
    "Storage_Streams",
    "Win32_Foundation",
    "Win32_Security",
    "Win32_System_Com",
    "Win32_System_Threading",
    "Win32_System_WinRT",
    "Win32_UI_HiDpi",
    "Win32_UI_WindowsAndMessaging",
    "Win32_Graphics_Gdi",
] }
uiautomation = { version = "0.25.1", default-features = false, features = [
    "control",
    "pattern",
    "input",
] }
windows-capture = "2.0.1"

[profile.release]
lto = "thin"
strip = true