@agent-sh/computer-use-linux 0.4.10 → 0.6.0
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/README.md +101 -7
- package/npm/README.md +39 -0
- package/package.json +26 -3
- package/pi/extension/THIRD_PARTY_NOTICES.txt +671 -0
- package/pi/extension/generated-tools.ts +1334 -0
- package/pi/extension/index.ts +589 -196
- package/pi/extension/mcp-client.bundle.cjs +62 -0
- package/skills/computer-use-linux/SKILL.md +65 -10
- package/skills/computer-use-linux/references/pi-setup.md +95 -24
package/README.md
CHANGED
|
@@ -61,6 +61,23 @@ Screenshot payloads are size-bounded by default before they are returned to the
|
|
|
61
61
|
- `press_key` — keys / chords; can focus a window or terminal first
|
|
62
62
|
- `type_text` — literal text input, optionally targeted at a window or terminal
|
|
63
63
|
|
|
64
|
+
For a plain left `click` by element index or selector, a recognized native
|
|
65
|
+
AT-SPI `click`, `press`, or `toggle` action takes precedence
|
|
66
|
+
over bounds. Entry `activate` and slider `jump` must be requested explicitly
|
|
67
|
+
with `perform_action`; they are never a substitute for a pointer click, even
|
|
68
|
+
when bounds are missing.
|
|
69
|
+
This avoids pointer conversion for GTK3 HiDPI
|
|
70
|
+
extents and GTK4 zero-origin bounds when the element exposes such an action.
|
|
71
|
+
The preference does not substitute an arbitrary action name for a coordinate
|
|
72
|
+
click. Explicit `x`/`y`, right clicks, and double/multiple clicks retain pointer
|
|
73
|
+
semantics. Re-check application state after either kind of activation.
|
|
74
|
+
|
|
75
|
+
For coordinate `click` or `scroll` with `relative: true`, select a target window
|
|
76
|
+
and measure from its clipped screenshot crop origin. Divide preview `x` and
|
|
77
|
+
`y` by the returned screenshot `scale` before passing them. These are not raw
|
|
78
|
+
GDK surface or widget-local coordinates; decorations and clipping can change
|
|
79
|
+
the origin. A missing window target is rejected.
|
|
80
|
+
|
|
64
81
|
Targeted `press_key`/`type_text` results append focused-element feedback from AT-SPI (role, name, editable) and warn when no editable element holds focus. Click/screenshot/input results warn when the target window or coordinate is partially or fully off-screen. `get_app_state` returns a compact readiness block by default; pass `verbose: true` for the full diagnostics report.
|
|
65
82
|
|
|
66
83
|
**Semantic actions**
|
|
@@ -75,6 +92,8 @@ Targeted `press_key`/`type_text` results append focused-element feedback from AT
|
|
|
75
92
|
|
|
76
93
|
**Conditional host execution**
|
|
77
94
|
|
|
95
|
+
- `complete_interaction` - optional desktop completion notification, registered only with `COMPUTER_USE_LINUX_NOTIFY_ON_COMPLETE=1`. Repeated calls can create repeated notifications; it does not provide desktop exclusivity.
|
|
96
|
+
|
|
78
97
|
- `run_shell` — same-user `/bin/sh -c` execution without login-profile loading, registered only when the server operator starts the MCP process with `COMPUTER_USE_LINUX_ENABLE_SHELL=1`. It is deliberately absent by default and is not a sandbox.
|
|
79
98
|
|
|
80
99
|
### MCP safety contract
|
|
@@ -99,6 +118,7 @@ The binary also exposes the same capabilities from the CLI for scripting and deb
|
|
|
99
118
|
computer-use-linux mcp # stdio MCP server
|
|
100
119
|
computer-use-linux doctor # JSON readiness report
|
|
101
120
|
computer-use-linux setup # enable AT-SPI
|
|
121
|
+
computer-use-linux guard-accessibility # explicit foreground GNOME accessibility guard
|
|
102
122
|
computer-use-linux setup-window-targeting # install GNOME Shell extension
|
|
103
123
|
computer-use-linux apps
|
|
104
124
|
computer-use-linux state [APP_NAME]
|
|
@@ -243,20 +263,34 @@ Restart Claude Desktop. The tools should appear in the tools list.
|
|
|
243
263
|
### Pi Coding Agent
|
|
244
264
|
|
|
245
265
|
```bash
|
|
246
|
-
pi install npm:pi-mcp-adapter
|
|
247
266
|
pi install npm:@agent-sh/computer-use-linux
|
|
248
267
|
```
|
|
249
268
|
|
|
250
|
-
Restart
|
|
269
|
+
Restart Pi or run `/reload`. The package exposes one small loader initially;
|
|
270
|
+
the real tools keep their upstream schemas and are enabled only when Computer
|
|
271
|
+
Use is needed:
|
|
272
|
+
|
|
273
|
+
Native tools require Pi 0.84.4 or newer (Node.js 22.19 or newer). The
|
|
274
|
+
standalone npm CLI wrapper continues to support Node.js 18 or newer.
|
|
275
|
+
|
|
276
|
+
```
|
|
277
|
+
computer_use_linux_tools({ tools: ["doctor", "list_windows"] })
|
|
278
|
+
computer_use_linux_doctor({})
|
|
279
|
+
computer_use_linux_list_windows({})
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
You can also search by capability:
|
|
251
283
|
|
|
252
284
|
```
|
|
253
|
-
|
|
254
|
-
mcp({ search: "windows" }) # search for window tools
|
|
255
|
-
mcp({ tool: "computer_use_linux_doctor" }) # run readiness check
|
|
256
|
-
mcp({ tool: "computer_use_linux_list_windows" }) # list desktop windows
|
|
285
|
+
computer_use_linux_tools({ query: "observe a window and click a control" })
|
|
257
286
|
```
|
|
258
287
|
|
|
259
|
-
|
|
288
|
+
No separate MCP adapter or manual MCP configuration is required. Pi starts one
|
|
289
|
+
computer-use-linux process lazily on the first real tool call, reuses it for the
|
|
290
|
+
session so accessibility snapshots remain valid, serializes desktop actions,
|
|
291
|
+
and closes it on reload, session switch, or exit. See the
|
|
292
|
+
[Pi setup guide](skills/computer-use-linux/references/pi-setup.md) for migration
|
|
293
|
+
from older adapter-based installs.
|
|
260
294
|
|
|
261
295
|
### Hermes Agent
|
|
262
296
|
|
|
@@ -344,6 +378,7 @@ Most setups need none of these — `doctor` and the installers pick sensible def
|
|
|
344
378
|
|
|
345
379
|
| Variable | Effect |
|
|
346
380
|
| --- | --- |
|
|
381
|
+
| `COMPUTER_USE_LINUX_NOTIFY_ON_COMPLETE` | Set exactly to `1` to expose the optional `complete_interaction` notification tool. Requires `notify-send` and a desktop notification service; disabled by default. |
|
|
347
382
|
| `COMPUTER_USE_LINUX_COSMIC_HELPER` | Path to the `computer-use-linux-cosmic` helper when it isn't next to the binary or on `PATH`. |
|
|
348
383
|
| `CU_DISABLE_ABS_POINTER` | Disable the uinput absolute pointer and click through `ydotool` instead for setups where the abs-pointer device misbehaves. |
|
|
349
384
|
| `COMPUTER_USE_LINUX_FORCE_PORTAL_POINTER` / `…_KEYBOARD` | Always route pointer / keyboard through the RemoteDesktop portal on Wayland, skipping auto-detection. |
|
|
@@ -394,6 +429,44 @@ If you're running this on a shared workstation, set `ydotoold`'s socket permissi
|
|
|
394
429
|
|
|
395
430
|
## Troubleshooting
|
|
396
431
|
|
|
432
|
+
To receive an explicit completion cue, start the MCP server with
|
|
433
|
+
`COMPUTER_USE_LINUX_NOTIFY_ON_COMPLETE=1`. This exposes `complete_interaction`,
|
|
434
|
+
a parameter-free tool the agent calls once after finishing its desktop work.
|
|
435
|
+
It submits a notification through `notify-send` with a two-second execution
|
|
436
|
+
limit and bounded process cleanup. Missing services, errors, or timeouts return
|
|
437
|
+
`cue: "skipped"`; notification settings may suppress a submitted cue. This does
|
|
438
|
+
not reserve the desktop or prove that other clients have stopped sending input.
|
|
439
|
+
No sound or additional desktop settings are enabled by this option.
|
|
440
|
+
This option currently applies only to directly spawned MCP hosts. The native Pi
|
|
441
|
+
extension does not forward the flag or include this optional tool in its catalog.
|
|
442
|
+
|
|
443
|
+
`setup` and `setup_accessibility` write and read back GNOME's
|
|
444
|
+
`org.gnome.desktop.interface toolkit-accessibility` setting, even if AT-SPI
|
|
445
|
+
is already enabled at runtime. A runtime-only success is reported as a warning:
|
|
446
|
+
newly launched GTK apps may still have no tree. Enabling the saved key may
|
|
447
|
+
require restarting target apps. Other accessibility tools can change that key
|
|
448
|
+
later; setup does not continuously override user settings.
|
|
449
|
+
|
|
450
|
+
For an explicit foreground guard while using desktop automation, run:
|
|
451
|
+
|
|
452
|
+
```bash
|
|
453
|
+
computer-use-linux guard-accessibility
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
The guard registers a passive AT-SPI window-activation listener and watches
|
|
457
|
+
GNOME's saved `toolkit-accessibility` key. It re-enables the key after a reset
|
|
458
|
+
and verifies it by readback, with periodic checks as well as change monitoring.
|
|
459
|
+
This affects all applications using the current user's GNOME setting, not just
|
|
460
|
+
the target app. It does not start a screen reader or change focus.
|
|
461
|
+
|
|
462
|
+
`mcp`, `setup`, `setup_accessibility`, and `get_app_state` never start this guard.
|
|
463
|
+
Stop it with Ctrl-C or SIGTERM **before** intentionally disabling accessibility.
|
|
464
|
+
Stopping ends setting writes and removes its listener without disabling other
|
|
465
|
+
accessibility clients or restoring an old saved value. A reset and reassertion
|
|
466
|
+
are not atomic: an app launched in that interval may still need restarting.
|
|
467
|
+
This is an opt-in mitigation, not a guarantee that every GNOME toggle sequence
|
|
468
|
+
preserves application accessibility trees.
|
|
469
|
+
|
|
397
470
|
`computer-use-linux doctor` is the source of truth. Common failure modes and fixes:
|
|
398
471
|
|
|
399
472
|
- **`accessibility.at_spi_bus.ok = false`** — AT-SPI registry isn't running or the toolkit bridge is off. Fix: `computer-use-linux setup` (or call the `setup_accessibility` MCP tool). Restart the apps you want to drive.
|
|
@@ -405,9 +478,30 @@ If you're running this on a shared workstation, set `ydotoold`'s socket permissi
|
|
|
405
478
|
- **KWin / Hyprland / i3 / COSMIC / X11 windowing is unavailable** — check `doctor.windowing.backends`. KWin needs session-bus scripting; Hyprland needs `hyprctl`; i3 needs `i3-msg` and its IPC socket; generic X11 needs `wmctrl` and `xprop`. COSMIC needs `computer-use-linux-cosmic`, which the standard installers provide automatically; if you copied binaries by hand, copy the helper too or set `COMPUTER_USE_LINUX_COSMIC_HELPER`.
|
|
406
479
|
- **Screenshots return black frames on multi-monitor setups** — known portal / compositor edge case. Use `get_app_state` with `include_screenshot: false` and rely on AT-SPI until the portal backend is healthy.
|
|
407
480
|
- **`type_text` types into the wrong window** — pass an explicit target (`window_id`, `pid`, `wm_class`, `title`, or for terminals `tty` / `terminal_pid` / `terminal_command` / `terminal_cwd`). Without a target, input goes to whatever window currently has compositor focus.
|
|
481
|
+
- **Wayland pointer actions miss an unfocused window** — injected pointer input is subject to the compositor's input-focus rules. Call `activate_window` for the target before `click`, `drag`, or coordinate `scroll`; a pointer can land at the requested coordinate without the unfocused surface receiving the action.
|
|
408
482
|
|
|
409
483
|
If `doctor` is green and a specific tool still misbehaves, file an issue with the JSON output of `doctor` and the failing tool's request payload.
|
|
410
484
|
|
|
485
|
+
For coordinate calibration, launch [the GTK4 probe](examples/coordinate_probe.py)
|
|
486
|
+
in your test desktop and take a targeted screenshot. Choose the center of its
|
|
487
|
+
green 10x10 square from that screenshot, convert by `scale`, and click relative
|
|
488
|
+
to the same target window. The probe's delivered-event `hit: true` is the
|
|
489
|
+
acceptance condition. Do not pass its widget-local `(85, 85)` directly as a
|
|
490
|
+
window-relative click: margins and decorations belong to different spaces.
|
|
491
|
+
|
|
492
|
+
[The semantic-click regression](scripts/semantic_click_test.py) runs against a
|
|
493
|
+
built binary in an isolated graphical display and checks actual GTK3 button
|
|
494
|
+
activation through MCP at scales 1 and 2. This does not establish correctness
|
|
495
|
+
of Mutter 46 EWMH move/resize, all mixed-output layouts, or GNOME 50.4 pointer
|
|
496
|
+
clicks.
|
|
497
|
+
|
|
498
|
+
Native Wayland qualification on GNOME 50.1 at 133.3% display scale used the
|
|
499
|
+
same green target for both modes: crop-relative `(122, 145)` and desktop
|
|
500
|
+
`(2140, 193)` both delivered widget coordinates approximately `(84.81, 84.78)`
|
|
501
|
+
with `hit: true` through uinput. These are one capture's measured coordinates,
|
|
502
|
+
not reusable offsets. Raw surface coordinates must still be transformed before
|
|
503
|
+
comparing them with a widget-local target.
|
|
504
|
+
|
|
411
505
|
## Related
|
|
412
506
|
|
|
413
507
|
- [agent-workspace-linux](https://github.com/agent-sh/agent-workspace-linux) — the sibling MCP that gives an agent its **own** isolated Linux desktop (a hidden Xvfb display with its own apps and browser) instead of driving yours. It is the inverse of this project: `computer-use-linux` automates the desktop you are already on; `agent-workspace-linux` sandboxes the agent in a separate one. Use them together.
|
package/npm/README.md
CHANGED
|
@@ -9,9 +9,21 @@ mutating and can change real application state. The MCP tool list includes
|
|
|
9
9
|
`ToolAnnotations` so hosts can distinguish read-only observation from mutating
|
|
10
10
|
desktop actions.
|
|
11
11
|
|
|
12
|
+
Plain left `click` by element index or selector prefers a native AT-SPI
|
|
13
|
+
`click`, `press`, or `toggle` action over toolkit bounds,
|
|
14
|
+
avoiding pointer-coordinate conversion when that action is available. Explicit
|
|
15
|
+
`activate`/`jump` requests belong in `perform_action`, not `click`, even when
|
|
16
|
+
bounds are missing. Explicit
|
|
17
|
+
`x`/`y`, right clicks, and multi-clicks retain pointer semantics. For coordinate
|
|
18
|
+
`click` or `scroll` with `relative: true`, use the clipped target-window
|
|
19
|
+
screenshot crop origin and divide preview coordinates by screenshot `scale`.
|
|
20
|
+
Do not use widget-local or raw GDK surface coordinates. A window target is
|
|
21
|
+
required.
|
|
22
|
+
|
|
12
23
|
```bash
|
|
13
24
|
npm install -g @agent-sh/computer-use-linux
|
|
14
25
|
computer-use-linux doctor
|
|
26
|
+
pi install npm:@agent-sh/computer-use-linux
|
|
15
27
|
hermes skills tap add agent-sh/computer-use-linux
|
|
16
28
|
hermes skills install agent-sh/computer-use-linux/computer-use-linux
|
|
17
29
|
hermes mcp add computer-use-linux --command computer-use-linux --args mcp
|
|
@@ -19,6 +31,28 @@ hermes mcp test computer-use-linux
|
|
|
19
31
|
hermes mcp configure computer-use-linux
|
|
20
32
|
```
|
|
21
33
|
|
|
34
|
+
For an optional MCP completion notification, set
|
|
35
|
+
`COMPUTER_USE_LINUX_NOTIFY_ON_COMPLETE=1` in the server environment and have the
|
|
36
|
+
agent call `complete_interaction` after its desktop work. `notify-send` must be
|
|
37
|
+
installed with an available desktop notification service. The cue is best effort
|
|
38
|
+
and does not provide exclusive desktop ownership.
|
|
39
|
+
This cue is available only to directly spawned MCP hosts; the native Pi extension
|
|
40
|
+
does not yet forward the flag or include the tool in its catalog.
|
|
41
|
+
|
|
42
|
+
If accessibility is disabled, run `computer-use-linux setup`. Setup writes and
|
|
43
|
+
reads back GNOME's `toolkit-accessibility` setting and warns if only runtime
|
|
44
|
+
accessibility is available. Restart target apps if their trees remain empty.
|
|
45
|
+
|
|
46
|
+
To explicitly keep that saved setting enabled during desktop automation, run
|
|
47
|
+
`computer-use-linux guard-accessibility` in a foreground terminal. It registers
|
|
48
|
+
a passive AT-SPI window-activation listener and reasserts the current user's
|
|
49
|
+
GNOME `toolkit-accessibility` key after resets, verifying each write by readback.
|
|
50
|
+
This affects other apps using the same user setting. MCP, setup, and
|
|
51
|
+
`get_app_state` never start it automatically. Stop with Ctrl-C or SIGTERM before
|
|
52
|
+
disabling accessibility; stopping removes its listener and ends writes without
|
|
53
|
+
disabling other clients or restoring an old value. An app launched during a
|
|
54
|
+
reset may still need restarting, so this is not a complete GNOME toggle fix.
|
|
55
|
+
|
|
22
56
|
The generated Hermes config should look like this:
|
|
23
57
|
|
|
24
58
|
```yaml
|
|
@@ -35,6 +69,11 @@ GitHub release for this package version and verifies the `.sha256` asset before
|
|
|
35
69
|
installing it. It also installs the matching `computer-use-linux-cosmic` helper
|
|
36
70
|
used for COSMIC desktop window targeting.
|
|
37
71
|
|
|
72
|
+
When installed through Pi, the package supplies native, dynamically loaded
|
|
73
|
+
`computer_use_linux_*` tools. No separate MCP adapter or manual MCP
|
|
74
|
+
configuration is required. Native tools require Pi 0.84.4 or newer; the
|
|
75
|
+
standalone CLI wrapper retains Node.js 18 support.
|
|
76
|
+
|
|
38
77
|
If you already built or installed the binary yourself, set
|
|
39
78
|
`COMPUTER_USE_LINUX_BIN=/path/to/computer-use-linux` to make the wrapper use
|
|
40
79
|
that executable instead.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-sh/computer-use-linux",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Linux desktop-control MCP server: AT-SPI accessibility trees, Wayland/X11 input, screenshots, and compositor window targeting.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -40,18 +40,41 @@
|
|
|
40
40
|
"npm/README.md",
|
|
41
41
|
"npm/bin/computer-use-linux.js",
|
|
42
42
|
"npm/install.js",
|
|
43
|
-
"pi/"
|
|
43
|
+
"pi/extension/index.ts",
|
|
44
|
+
"pi/extension/generated-tools.ts",
|
|
45
|
+
"pi/extension/mcp-client.bundle.cjs",
|
|
46
|
+
"pi/extension/THIRD_PARTY_NOTICES.txt"
|
|
44
47
|
],
|
|
45
48
|
"pi": {
|
|
46
49
|
"extensions": ["./pi/extension/index.ts"],
|
|
47
50
|
"skills": ["./skills/computer-use-linux/SKILL.md"]
|
|
48
51
|
},
|
|
49
52
|
"scripts": {
|
|
53
|
+
"build:pi": "npm run build --prefix pi",
|
|
54
|
+
"check:pi-bundle": "npm run build:check --prefix pi",
|
|
50
55
|
"postinstall": "node npm/install.js",
|
|
51
|
-
"pack:check": "
|
|
56
|
+
"pack:check": "node scripts/check_npm_package.mjs",
|
|
57
|
+
"test:pi": "npm test --prefix pi",
|
|
58
|
+
"typecheck:pi": "npm run typecheck --prefix pi",
|
|
52
59
|
"test:wrapper": "node npm/bin/computer-use-linux.js --help"
|
|
53
60
|
},
|
|
54
61
|
"engines": {
|
|
55
62
|
"node": ">=18"
|
|
63
|
+
},
|
|
64
|
+
"peerDependencies": {
|
|
65
|
+
"@earendil-works/pi-ai": "*",
|
|
66
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
67
|
+
"typebox": "*"
|
|
68
|
+
},
|
|
69
|
+
"peerDependenciesMeta": {
|
|
70
|
+
"@earendil-works/pi-ai": {
|
|
71
|
+
"optional": true
|
|
72
|
+
},
|
|
73
|
+
"@earendil-works/pi-coding-agent": {
|
|
74
|
+
"optional": true
|
|
75
|
+
},
|
|
76
|
+
"typebox": {
|
|
77
|
+
"optional": true
|
|
78
|
+
}
|
|
56
79
|
}
|
|
57
80
|
}
|