npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@intentic/desktop-automation

v1.436.0

Published

Drive a desktop from Node: capture the screen, move the pointer, click, type and scroll, Windows and Linux, no native modules

Readme

desktop-automation

Moves a real desktop from Node on Windows and Linux: captures the screen, moves the pointer, clicks, types, scrolls, lists and focuses windows, reads a window's controls, and uses the clipboard.

flowchart LR
    machine["intentic-machine<br/>screenshot, device, apps tools"] --> desktop(["desktop()"])
    sandbox["sandbox daemon<br/>its own virtual desktop"] --> desktop
    smoke["desktop-smoke-windows"] --> desktop
    desktop -->|"Windows"| ps["PowerShell calling user32"]
    desktop -->|"Linux X11"| x11["xdotool, wmctrl, xclip"]
    desktop -->|"Linux Wayland"| wl["ydotool, wtype, sway IPC"]
    desktop -->|"macOS; Linux elements; opt-in anywhere"| cua["cua-driver over MCP stdio"]
  • Runs on the user's device inside intentic-machine. It knows nothing about agents or permissions; the machine's device tools decide what is allowed before calling desktop().
  • No native modules, so it works from a single-file compiled binary: every action runs an existing program (run.ts), and a missing one fails with a DesktopError that says what to install.
  • Coordinates are pixels of the whole virtual desktop, its top-left at (0,0): points, window bounds, display bounds and element bounds alike. On Windows each action adds the virtual desktop's origin, which is not (0,0) on every multi-monitor setup.
  • A screenshot an agent sees is a frame (frames.ts): captured at the screen's own resolution, cut to a region if asked, shrunk to fit what a model reads whole (1456 px on the long edge, 1.15 megapixels), and given an id. A point read off it is mapped back by toDesktop; FrameLog refuses one read off a frame that is no longer the newest, and recognises a capture identical to the newest. Past those limits a model API shrinks the image itself and every coordinate read off it lands short. The PNG decoding, cropping, area-average shrinking and encoding are pure TypeScript over node:zlib (png.ts), about 0.2 s for a 5760×2160 desktop.
  • Every Windows script declares itself per-monitor DPI-aware (v2) first (windows/windows-dpi.ts). Without it, a 4K monitor at 150% reads as 2560×1440 and only its top-left part is ever captured. Only per-monitor v2, no older fallback: the system-wide SetProcessDPIAware reads a mixed-DPI desk wrong in a new way, and Defender rejected the script that carried both beside a screen copy (2026-10-05, on a 4K-at-150% monitor beside a 1920×1200 one).
  • elements() reads a window's controls through UI Automation (windows/elements-windows.ts, Windows only): one cache request over the whole subtree, from a C# helper PowerShell compiles, under a second for a VS Code window of 1330 controls. Chromium and Electron windows build their tree only once asked, so a bare first read is read again. An element is found again by its runtime id; elementAct invokes, sets, toggles, expands, collapses, selects or focuses it through its pattern, without the pointer, on a thread given 4 s, since an Invoke that opens a modal dialog does not return.
  • desktop({ env }) runs every program with that environment, so one process can drive a display of its own (the sandbox's agent desktop) without writing DISPLAY into its own process.env.
  • cua-driver, where the owner installed it (cua.ts), is driven over its own MCP server on stdio, never loaded into this process: it is the whole backend on macOS, where this package has no input of its own (without it every input method there throws, naming how to install it); on Linux it reads a window's controls through AT-SPI, which nothing here speaks without a native module; and INTENTIC_DESKTOP_DRIVER=cua puts every platform on it, for its background delivery. It is found at INTENTIC_CUA_DRIVER, on PATH, or where its installers put it. Measured against cua-driver 0.33.4 on Linux/X11 (2026-10-05); macOS is untested.
  • On Wayland, window listing works only under sway.
  • (2026-11-24) A window id is one of the spellings the lists hand out (isWindowId in parse.ts: decimal for an HWND or a sway container, wmctrl's hex, cua-driver's pid:window), and each backend checks its own before the id reaches a command: Windows parses it to a number (windowHandle), since it once went into a double-quoted PowerShell string where $(…) runs, and sway's must be digits, since swaymsg reads ; as a second command. Text an agent chose travels to PowerShell as base64 (psText), never as a literal.
  • Linux window bounds come from xwininfo -root -tree where it is installed: wmctrl counts a window's frame offset twice under a reparenting window manager (openbox put a window 18 px too low), which cut off the top of a window's screenshot.
  • notice() (Windows only) shows a banner that never takes focus or appears in a capture, and reports a global hotkey press; the machine uses it to pause input. windowsSession() says whether the sign-in screen is up, since keys typed then reach nothing.

Key files