@agent-sh/computer-use-linux 0.4.9 → 0.5.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 +34 -9
- package/npm/README.md +6 -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 +20 -10
- package/skills/computer-use-linux/references/pi-setup.md +95 -24
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: computer-use-linux
|
|
3
|
-
description: "Linux desktop observation and control via the computer-use-linux MCP server: accessibility trees, screenshots, window targeting, and input synthesis (click, type, scroll).
|
|
3
|
+
description: "Linux desktop observation and control via native Pi tools or the computer-use-linux MCP server: accessibility trees, screenshots, window targeting, and input synthesis (click, type, scroll)."
|
|
4
4
|
author: agent-sh
|
|
5
5
|
license: MIT
|
|
6
6
|
platforms: [linux]
|
|
7
|
+
compatibility: "Native Pi tools require Pi 0.84.4+ and Node.js 22.19+; the standalone CLI/MCP server supports Node.js 18+."
|
|
7
8
|
---
|
|
8
9
|
|
|
9
10
|
# computer-use-linux
|
|
10
11
|
|
|
11
|
-
Use `computer-use-linux` when an agent needs to observe or operate a local Linux desktop
|
|
12
|
+
Use `computer-use-linux` when an agent needs to observe or operate a local Linux desktop: inspect the accessibility tree, list/focus windows, take screenshots, click, scroll, type, press keys, or invoke AT-SPI actions.
|
|
12
13
|
|
|
13
14
|
## When to Use
|
|
14
15
|
|
|
@@ -23,6 +24,12 @@ Do not use this for remote browsers, websites, or headless automation when a bro
|
|
|
23
24
|
|
|
24
25
|
## Install
|
|
25
26
|
|
|
27
|
+
Pi users need only the package:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pi install npm:@agent-sh/computer-use-linux
|
|
31
|
+
```
|
|
32
|
+
|
|
26
33
|
Preferred install:
|
|
27
34
|
|
|
28
35
|
```bash
|
|
@@ -69,20 +76,23 @@ If the binary is not on `PATH`, use the absolute path (typically `~/.local/bin/c
|
|
|
69
76
|
|
|
70
77
|
## Procedure
|
|
71
78
|
|
|
72
|
-
1.
|
|
73
|
-
2.
|
|
74
|
-
3.
|
|
75
|
-
4.
|
|
76
|
-
5.
|
|
77
|
-
6.
|
|
78
|
-
7.
|
|
79
|
-
8.
|
|
79
|
+
1. In Pi, call `computer_use_linux_tools` with the exact tools or capability you need. Enabled tools use the `computer_use_linux_<name>` prefix, appear starting on the next model turn, and remain active for the session.
|
|
80
|
+
2. Begin every desktop-control turn with `get_app_state`; use `include_screenshot: false` when the accessibility tree is sufficient. Its compact readiness block identifies missing setup.
|
|
81
|
+
3. Use `doctor` only when you need the full diagnostic report.
|
|
82
|
+
4. If `can_build_accessibility_tree` is false, run `setup_accessibility` and restart the target app.
|
|
83
|
+
5. If `can_query_windows` is false on GNOME Wayland, run `setup_window_targeting` and ask the user to log out and back in if setup says the shell extension needs a reload.
|
|
84
|
+
6. Before targeted input, call `list_windows` or `focused_window` and verify the intended window by title, app id, pid, or wm class.
|
|
85
|
+
7. Prefer semantic targeting from `get_app_state`: use element indices or role/name/text/states selectors.
|
|
86
|
+
8. Use coordinates only when the UI surface has no useful accessibility tree.
|
|
87
|
+
9. For text input, prefer `type_text` with a target selector (`window_id`, `pid`, `app_id`, `wm_class`, `title`, `tty`, `terminal_pid`, `terminal_command`, or `terminal_cwd`) rather than relying on current focus.
|
|
88
|
+
10. After mutating actions, re-check state with `get_app_state`, `focused_window`, or an app-specific readback.
|
|
80
89
|
|
|
81
90
|
## Pitfalls
|
|
82
91
|
|
|
83
92
|
- Already-running GTK, Qt, and Electron apps may need a restart after AT-SPI is enabled.
|
|
84
93
|
- GNOME may show a portal prompt on the first screenshot or `get_app_state` call with screenshots enabled.
|
|
85
94
|
- Desktop input is stateful. Avoid concurrent tool calls against this MCP server.
|
|
95
|
+
- Pi serializes the native Computer Use tools and keeps one process for the session. If that process exits, do not replay an ambiguous mutating call; obtain a fresh `get_app_state` before another element-based action.
|
|
86
96
|
- `click`, `drag`, `press_key`, `type_text`, `perform_action`, and `set_value` can change real application state.
|
|
87
97
|
- When ydotool is selected, `ydotoold` should run as a per-user service with its socket under `/run/user/$UID`, not as a system-wide service.
|
|
88
98
|
- The optional ydotool backend requires version 1.0.3 or newer; `doctor` rejects older or semantically incompatible CLIs even when `ydotoold` is running.
|
|
@@ -1,57 +1,128 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: pi-setup
|
|
3
|
-
description: "Pi coding agent setup for
|
|
3
|
+
description: "Pi coding agent setup for native computer-use-linux tools."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Pi Setup
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## Install
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Install one package:
|
|
11
11
|
|
|
12
12
|
```bash
|
|
13
|
-
pi install npm:pi-mcp-adapter
|
|
14
13
|
pi install npm:@agent-sh/computer-use-linux
|
|
15
14
|
```
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
Restart Pi or run `/reload`. No separate MCP adapter or MCP configuration is
|
|
17
|
+
required.
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
The integration is designed for current Pi releases with additive dynamic tool
|
|
20
|
+
loading. Update Pi and installed packages when needed:
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
```bash
|
|
23
|
+
pi update --all
|
|
24
|
+
```
|
|
22
25
|
|
|
23
|
-
|
|
26
|
+
## How tool loading works
|
|
24
27
|
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
Pi initially sees one small loader:
|
|
29
|
+
|
|
30
|
+
```text
|
|
31
|
+
computer_use_linux_tools
|
|
27
32
|
```
|
|
28
33
|
|
|
29
|
-
|
|
34
|
+
Enable exact tools:
|
|
30
35
|
|
|
31
|
-
```
|
|
32
|
-
|
|
36
|
+
```text
|
|
37
|
+
computer_use_linux_tools({ tools: ["doctor", "list_windows"] })
|
|
33
38
|
```
|
|
34
39
|
|
|
35
|
-
|
|
40
|
+
Or search by capability:
|
|
36
41
|
|
|
37
|
-
```
|
|
38
|
-
|
|
42
|
+
```text
|
|
43
|
+
computer_use_linux_tools({ query: "inspect a window and type text" })
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
The selected native tools appear starting on the next model turn with their
|
|
47
|
+
full upstream schemas and remain active for the session:
|
|
48
|
+
|
|
49
|
+
```text
|
|
50
|
+
computer_use_linux_doctor({})
|
|
51
|
+
computer_use_linux_list_windows({})
|
|
52
|
+
computer_use_linux_type_text({ text: "hello", title: "Notes" })
|
|
39
53
|
```
|
|
40
54
|
|
|
55
|
+
Pi does not start the desktop process when the loader runs. The first real tool
|
|
56
|
+
call starts one computer-use-linux process, and the package reuses it for the
|
|
57
|
+
session so `get_app_state` element indices and portal sessions remain valid.
|
|
58
|
+
|
|
59
|
+
## Safe operating loop
|
|
60
|
+
|
|
61
|
+
1. Enable `get_app_state`, `list_windows`, and any likely action tools.
|
|
62
|
+
2. Call `computer_use_linux_get_app_state`, using
|
|
63
|
+
`include_screenshot: false` when accessibility data is enough.
|
|
64
|
+
3. Inspect the returned readiness block; enable/call `doctor` only for full
|
|
65
|
+
diagnostics.
|
|
66
|
+
4. Identify the target with `computer_use_linux_list_windows` or
|
|
67
|
+
`computer_use_linux_focused_window`.
|
|
68
|
+
5. Enable and call the required action tool.
|
|
69
|
+
6. Re-observe after the UI changes.
|
|
70
|
+
|
|
71
|
+
Native Computer Use tools execute sequentially. Cancellation is forwarded to
|
|
72
|
+
the MCP request. If the server process exits, the failed call is never replayed
|
|
73
|
+
automatically; call `get_app_state` again before another element-based action.
|
|
74
|
+
|
|
75
|
+
## Migration from the adapter-based package
|
|
76
|
+
|
|
77
|
+
Older releases required `pi-mcp-adapter` and wrote a
|
|
78
|
+
`computer-use-linux` entry into `mcp.json` under the configured Pi agent
|
|
79
|
+
directory.
|
|
80
|
+
|
|
81
|
+
The native integration does not write MCP configuration. It reads only the
|
|
82
|
+
legacy entry location to show a migration notice. After updating:
|
|
83
|
+
|
|
84
|
+
1. Remove only the `computer-use-linux` entry from the Pi agent `mcp.json` if
|
|
85
|
+
it is still present.
|
|
86
|
+
2. Keep `pi-mcp-adapter` if you use it for other MCP servers; otherwise remove
|
|
87
|
+
it with `pi remove npm:pi-mcp-adapter`.
|
|
88
|
+
3. Run `/reload`.
|
|
89
|
+
|
|
90
|
+
The package reports a non-destructive migration notice when it detects the
|
|
91
|
+
legacy entry.
|
|
92
|
+
|
|
41
93
|
## If the binary is not found
|
|
42
94
|
|
|
43
95
|
The extension looks for `computer-use-linux` in this order:
|
|
44
96
|
|
|
45
|
-
1. `COMPUTER_USE_LINUX_BIN`
|
|
46
|
-
2. The
|
|
47
|
-
|
|
97
|
+
1. `COMPUTER_USE_LINUX_BIN`
|
|
98
|
+
2. The binary downloaded inside the installed npm package
|
|
99
|
+
|
|
100
|
+
Reinstall the package if the bundled binary is missing:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
pi remove npm:@agent-sh/computer-use-linux
|
|
104
|
+
pi install npm:@agent-sh/computer-use-linux
|
|
105
|
+
```
|
|
48
106
|
|
|
49
|
-
|
|
107
|
+
Users with a separate build can set:
|
|
50
108
|
|
|
51
109
|
```bash
|
|
52
|
-
|
|
53
|
-
# or
|
|
54
|
-
cargo install computer-use-linux
|
|
110
|
+
export COMPUTER_USE_LINUX_BIN=/absolute/path/to/computer-use-linux
|
|
55
111
|
```
|
|
56
112
|
|
|
57
|
-
|
|
113
|
+
## Verification
|
|
114
|
+
|
|
115
|
+
Enable and call the readiness tool:
|
|
116
|
+
|
|
117
|
+
```text
|
|
118
|
+
computer_use_linux_tools({ tools: ["doctor"] })
|
|
119
|
+
computer_use_linux_doctor({})
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Ready output has:
|
|
123
|
+
|
|
124
|
+
- `can_register_mcp_tools: true`
|
|
125
|
+
- `can_build_accessibility_tree: true`
|
|
126
|
+
- `can_query_windows: true`
|
|
127
|
+
- `can_send_development_input: true`
|
|
128
|
+
- `blockers: []`
|