Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
[package]
name = "platform-linux"
version.workspace = true
edition.workspace = true
license.workspace = true
[dependencies]
tokio = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
anyhow = { workspace = true }
thiserror = { workspace = true }
tracing = { workspace = true }
async-trait = "0.1"
futures-util = "0.3"
cua-driver-core = { path = "../cua-driver-core" }
cua-driver-contract = { path = "../cua-driver-contract" }
cursor-overlay = { path = "../cursor-overlay" }
pip-preview = { path = "../pip-preview" }
sha2 = { workspace = true }
# tiny-skia for cursor rendering (shared cross-platform)
tiny-skia = { version = "0.11", default-features = false, features = ["std"] }
[target.'cfg(target_os = "linux")'.dependencies]
clipboard-rs = { version = "0.3.5", features = ["wayland"] }
cua-driver-core = { path = "../cua-driver-core", features = ["keyring"] }
# X11 background input + window enumeration + MIT-SHM capture
x11rb = { version = "0.13", features = ["xinput", "randr", "xfixes", "composite", "shape", "xtest", "shm", "res"] }
x11 = { version = "2.21", features = ["xlib", "xinput", "xtest"] }
base64 = { workspace = true }
image = { workspace = true }
# Map X server-returned MIT-SHM CreateSegment FDs (no SysV shmget/shmat).
memmap2 = "0.9"
# kill(2) for the kill_app tool — SIGKILL via libc::kill.
libc = "0.2"
# Native AT-SPI over D-Bus (pure Rust, via zbus) — replaces the pyatspi
# subprocess bridge so accessibility input/readback needs no Python or GI
# typelibs at runtime. `tokio` matches the driver's async runtime; `zbus`
# re-exports the bus types we need (fdo::DBusProxy for pid resolution).
atspi = { version = "0.30", default-features = false, features = ["proxies", "wrappers", "tokio", "zbus"] }
# Declared directly rather than through the facade's `connection` feature:
# `atspi` forwards atspi-connection's default features, and `default-features
# = false` on the facade does not reach them, so `p2p` stayed enabled. `p2p`
# subscribes to every bus-name change and awaits a peer-discovery round trip
# per application on the shared connection; 64 queued name changes stall the
# socket reader and the connection never reads another event (#4894).
# LibreOffice also advertises a private socket its VCL main loop never
# services. The session a11y bus is what gdbus/pyatspi use and is the only
# route this crate takes; the CI feature-graph guard keeps `p2p` out.
atspi-connection = { version = "0.14", default-features = false, features = ["wrappers"] }
evdev = "0.12"
# Math-expression evaluator for parallel_mouse_drag `fn` paths (y = f(x)).
meval = "0.2"
# Native Wayland backend (window enumeration via wlr-foreign-toplevel-management;
# capture/input protocols added as those slices land). Pure-Rust client; used
# when running under a Wayland compositor with no X11 (no DISPLAY).
wayland-client = "0.31"
wayland-backend = "0.3"
wayland-scanner = "0.31"
# Vendored toplevel-export bindings and bounded compositor IPC connections.
bitflags = "2"
socket2 = "0.6"
wayland-protocols-wlr = { version = "0.3", features = ["client"] }
# Wayland staging protocols: ext-foreign-toplevel-list-v1,
# ext-image-capture-source-v1, ext-image-copy-capture-v1 (per-window
# screenshot on modern wlroots/GNOME/KDE) and wp-fractional-scale-v1 +
# wp-viewporter (HiDPI for the layer-shell overlay). The transitive pull
# from wayland-protocols-wlr does NOT enable `staging`; declaring it here
# unifies the feature globally.
wayland-protocols = { version = "0.32", features = ["client", "staging", "unstable"] }
# xdg-desktop-portal client: display-screenshot tier
# (org.freedesktop.portal.Screenshot), per-window ScreenCast
# (org.freedesktop.portal.ScreenCast), and the libei input session
# (org.freedesktop.portal.RemoteDesktop.ConnectToEIS). ashpd allows exactly
# one async backend, and gpui's Linux port selects `async-io` through oo7,
# so an app embedding both must use it here too; zbus keeps running on
# tokio when both of its backends are enabled.
#
# ashpd's RemoteDesktop feature is pure Rust. Only our ScreenCast frame reader
# pulls pipewire-rs/libspa, whose headers are newer than Debian bullseye.
ashpd = { version = "0.13", default-features = false, features = ["async-io", "screenshot"] }
# zbus is pulled transitively via ashpd + atspi but declared directly so
# the portal-probe path in wayland::portal_screenshot can talk to the
# session bus without going through ashpd's higher-level builders.
zbus = { version = "5", default-features = false, features = ["tokio"] }
# Parse `file://` URIs returned by org.freedesktop.portal.Screenshot.
# ashpd re-exports `url` transitively; declared explicitly so ashpd
# version bumps cannot silently break the resolver.
url = "2"
# PipeWire types and constants for the ScreenCast video route, which dequeues
# frames from the node id returned by `open_pipe_wire_remote`. libpipewire
# itself is loaded at runtime (`wayland::libpipewire`), so builds need its
# headers but the binary does not link it. Gated behind `portal-capture`.
pipewire-sys = { version = "0.10", optional = true }
libloading = { version = "0.8", optional = true }
# SPA pods, format parsing and buffer types (header-only, compiled in): builds
# the SPA_PARAM_EnumFormat pod (raw BGRx/BGRA/RGBx/RGBA at announced
# width/height) handed to `pw_stream_connect`. Same `portal-capture` gating.
libspa = { version = "0.10", optional = true }
# Pure-Rust libei/libeis bindings for the GNOME/KDE input path (handshake
# → seat → device → pointer_absolute/button/scroll/keyboard/text). API is
# documented as "incomplete and subject to change" — budget for churn on
# the next bump. Re-exports `enumflags2` we use for `BitFlags<DeviceType>`.
reis = { version = "0.7", features = ["tokio"], optional = true }
# Calloop event loop drives the EIS worker thread — reis's example uses
# calloop::EventLoop + Generic source to multiplex EIS protocol reads
# with command-channel polling. reis 0.7 also ships a calloop adapter
# but we use the plain Generic source for clarity.
calloop = { version = "0.14", optional = true }
# Used directly in the ashpd RemoteDesktop call to compose
# `BitFlags::from(DeviceType::Keyboard) | DeviceType::Pointer`. reis also
# re-exports this same major version; pinning explicitly prevents
# duplicate-crate hazards.
enumflags2 = { version = "0.7", optional = true }
# Bounded MPSC command/reply channel for the persistent virtual-pointer
# owner thread. EventQueue<State> is !Send, so the persistent device must
# live on its own thread; crossbeam gives us a Send sender and synchronous
# reply channels that preserve the "tool call blocks until compositor
# roundtripped" contract the X11 path provides.
crossbeam-channel = "0.5"
# Resolves text against the compositor's XKB keymap: niri text input and the
# libei keymap fallback when the EIS server does NOT advertise `ei_text`
# (libei < 1.6, i.e. older GNOME / KDE Plasma 6.0).
xkbcommon = "0.9"
# Resolve `$XDG_STATE_HOME` (with platform fallback) for persisting the
# ScreenCast and RemoteDesktop `restore_token`s so users see the consent
# dialog only once per install, not once per process.
dirs = "5"
[features]
default = []
linux-example = []
# GNOME/KDE input is pure Rust plus libxkbcommon, which is available in the
# Debian 11 release container. Ashpd's RemoteDesktop API exposes ScreenCast
# stream metadata, so its lightweight screencast module is required here too.
# The PipeWire frame reader remains isolated in portal-capture below.
portal-input = [
"ashpd/remote_desktop",
"ashpd/screencast",
"dep:reis",
"dep:calloop",
"dep:enumflags2",
]
# PipeWire-backed ScreenCast capture (the full-desktop video route for
# KDE/KWin and other compositors without wlr-screencopy) keeps its newer
# system-header requirement and remains enabled by Nix/modern desktop builds.
portal-capture = [
"ashpd/screencast",
"dep:pipewire-sys",
"dep:libloading",
"dep:libspa",
]
# Backward-compatible full desktop feature used by the Nix package.
portal-libei = ["portal-input", "portal-capture"]
[dev-dependencies]
tokio = { workspace = true, features = ["test-util"] }
tempfile = "3"
# Used by the `screenshot_cascade` example to surface the
# `tracing::debug!` lines emitted by each tier of the dispatch as it
# falls through.
tracing-subscriber = { workspace = true }
# Cargo example that probes portal/libei device readiness without sending input.
# Lives under
# the `portal-input` feature gate so a stock `cargo build --examples`
# doesn't try to compile against the (now-optional) reis/xkbcommon deps.
[[example]]
name = "libei_probe"
required-features = ["portal-input"]
[[example]]
name = "libei_input"
required-features = ["portal-input"]
[[example]]
name = "screenshot_cascade"
required-features = ["linux-example"]