dsh-plugin-linux-computer-use 0.0.0-stage → 0.1.1
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/CHANGELOG.md +47 -0
- package/LICENSE +21 -0
- package/README.md +142 -2
- package/cordis.patch.yml +35 -0
- package/docs/DETAIL.md +118 -0
- package/docs/RELEASING.md +56 -0
- package/docs/preview.svg +27 -0
- package/icon.svg +9 -0
- package/index.js +332 -0
- package/linux-computer-use-prep.sh +281 -0
- package/locale/en.json +7 -0
- package/locale/zh.json +7 -0
- package/package.json +61 -4
- package/server/cu_a11y.py +495 -0
- package/server/cu_display.py +523 -0
- package/server/cu_input.py +552 -0
- package/server/cu_sys.py +232 -0
- package/server/cu_unlock.py +280 -0
- package/server/linux_desktop_mcp.py +1377 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.1 - 2026-11-25
|
|
4
|
+
|
|
5
|
+
- fix: send the complete `input_absinfo` when creating the absolute pointer.
|
|
6
|
+
libinput rejected the device with "kernel bug: kernel has only x or y
|
|
7
|
+
resolution, not both" and silently dropped every motion and button event, so
|
|
8
|
+
clicks did nothing while the keyboard and the wheel kept working.
|
|
9
|
+
|
|
10
|
+
## 0.1.1 - 2026-11-25
|
|
11
|
+
|
|
12
|
+
- `desktop_status` gained `reset_input`, which recreates the virtual keyboard,
|
|
13
|
+
pointer and wheel devices. The compositor can stop honouring devices that
|
|
14
|
+
were created before the desktop session restarted, and this is the cheapest
|
|
15
|
+
way to recover without restarting the server.
|
|
16
|
+
- The accessibility tree no longer takes the whole server down when AT-SPI is
|
|
17
|
+
unreachable: the reachability test runs in a throwaway child process, so a
|
|
18
|
+
dead accessibility bus turns into a normal tool error instead of a crash.
|
|
19
|
+
Logging out and back in while the server keeps running is exactly the case
|
|
20
|
+
that used to kill it.
|
|
21
|
+
|
|
22
|
+
## 0.1.0
|
|
23
|
+
|
|
24
|
+
First release.
|
|
25
|
+
|
|
26
|
+
- 28 desktop tools over a stdio MCP server, published to the model as `mcp__linux__*`:
|
|
27
|
+
screenshots, AT-SPI UI tree (apps/tree/find/describe/text/action/focus/set_text),
|
|
28
|
+
pointer and keyboard input, clipboard, processes, app launching, gsettings, notifications,
|
|
29
|
+
window list, display info and a health snapshot.
|
|
30
|
+
- `linux_mcp_doctor` host tool: diagnoses the session, `/dev/uinput`, the launcher,
|
|
31
|
+
wl-clipboard, the portal version, PipeWire capture, the screenshot grant, the display
|
|
32
|
+
layout and AT-SPI availability — and works while the MCP bridge is off.
|
|
33
|
+
- Screenshots via the `xdg-desktop-portal` Screenshot interface: one approval, then silent
|
|
34
|
+
captures in about half a second. The ScreenCast + GStreamer path is kept as an opt-in
|
|
35
|
+
fallback (`DSH_LINUX_CU_SCREENCAST=1`).
|
|
36
|
+
- Input injection straight into `/dev/uinput` (absolute pointer, wheel device, full keyboard),
|
|
37
|
+
with `ydotool` as the fallback backend.
|
|
38
|
+
- Refuses pointer/keyboard injection while the session is locked (screenshots keep working),
|
|
39
|
+
and reports `session.locked` in `desktop_status`.
|
|
40
|
+
- Opt-in AI unlocking, **off by default**: with the default policy the `unlock_screen` tool is
|
|
41
|
+
not listed at all. When switched on, the password is stored in the GNOME keyring from the
|
|
42
|
+
user's own terminal (`--set-unlock-password`), read only at the moment of the call, never
|
|
43
|
+
written to the conversation, a config file or the log; the call must pass `confirm: "unlock"`
|
|
44
|
+
and is the only exception to the lock-screen guard. Managed with
|
|
45
|
+
`--unlock-policy off|keyring`, `--unlock-status`, `--clear-unlock-password`.
|
|
46
|
+
- Ships disabled: Computer Use is turned on in Settings → Plugins.
|
|
47
|
+
- `linux-computer-use-prep.sh`: idempotent sudo setup with `--verify` and `--uninstall`.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 dsh-plugin-linux-computer-use contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,143 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-plugin-linux-computer-use
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/dsh-plugin-linux-computer-use)
|
|
4
|
+
[](https://github.com/1804608397/dsh-plugin-linux-computer-use/releases)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
|
|
7
|
+
**Computer Use for Ubuntu / GNOME Wayland, bridged into DeepSeek Harness as MCP tools.**
|
|
8
|
+
|
|
9
|
+
给 DeepSeek Harness 装上"手和眼睛":截屏、UI 树、鼠标键盘、剪贴板、进程、系统设置,全部以 `mcp__linux__*` 工具暴露给模型;外带一个 `linux_mcp_doctor` 诊断工具。**默认关闭**,在插件面板里手动打开。
|
|
10
|
+
|
|
11
|
+
English summary at the bottom.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 它能做什么
|
|
16
|
+
|
|
17
|
+
| 能力 | 后端(为何) |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| 截屏 | `xdg-desktop-portal` Screenshot 接口(Wayland 下唯一合法路径);首次点一次系统授权框,之后每次静默、约 0.5 秒出图。ScreenCast+`pipewiresrc` 流式路径保留作兜底(GNOME 46 下静态画面取不到帧) |
|
|
20
|
+
| UI 树 / 找元素 / 点击元素 | AT-SPI2(`org.a11y.Bus`)——GNOME 原生应用完整可用 |
|
|
21
|
+
| 鼠标 / 键盘注入 | 直写 `/dev/uinput`(内核级,应用无法区分真人);`ydotool` 作兜底 |
|
|
22
|
+
| 剪贴板 | `wl-clipboard`(`wl-copy` / `wl-paste`) |
|
|
23
|
+
| 进程 | `ps` + `/proc`,可列表、可杀(有白名单与自保) |
|
|
24
|
+
| "注册表"类比 | `gsettings` / dconf |
|
|
25
|
+
| 通知 | `notify-send` |
|
|
26
|
+
| 显示器信息 | Mutter `DisplayConfig`(坐标换算、多屏) |
|
|
27
|
+
|
|
28
|
+
28 个工具,分组见 [docs/DETAIL.md](docs/DETAIL.md)。模型调用方式:`mcp__linux__screenshot`、`mcp__linux__click`、`mcp__linux__ui_find` ……
|
|
29
|
+
|
|
30
|
+
## 安装
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# 1. 装插件(npm 包名 / GitHub 仓库均可)
|
|
34
|
+
dsh plugin --profile web add dsh-plugin-linux-computer-use
|
|
35
|
+
|
|
36
|
+
# 2. 一次性准备系统权限(需要 sudo,幂等,可 --uninstall 回滚)
|
|
37
|
+
sudo ./linux-computer-use-prep.sh
|
|
38
|
+
sudo ./linux-computer-use-prep.sh --verify # 不需要 sudo
|
|
39
|
+
|
|
40
|
+
# 3. 重启 dsh(不需要注销重登,见下方说明)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
准备脚本做四件事:
|
|
44
|
+
|
|
45
|
+
1. udev 规则给 `/dev/uinput` 加上 `uaccess`,并立刻 `setfacl` 授予你 `rw`(这是主路径:进程身份不变);
|
|
46
|
+
2. 顺带把它设成 `input` 组、0660(备用路径,给没有 logind 的场景);
|
|
47
|
+
3. 装 `wl-clipboard`(必需)和 `ydotool`(可选兜底;Ubuntu 24.04 的 ydotool 包里没有 `ydotoold` 守护进程,所以兜底路径默认不可用——主路径 `/dev/uinput` 不依赖它);
|
|
48
|
+
4. 装一个固定路径启动器 `/usr/local/bin/dsh-linux-desktop-mcp`。
|
|
49
|
+
|
|
50
|
+
**不需要注销重登**:权限走 ACL(`u:cheng:rw`),不靠进程的组身份,所以哪怕宿主进程是很久以前启动的、哪怕 `systemd --user` 因为 `Linger=yes` 一直没重启,注入依然可用——只要重启一次 `dsh` 让 MCP 子进程重新拉起。
|
|
51
|
+
|
|
52
|
+
> 为什么不用 `sg input` 换组:`sg` 会把**真实 gid** 也切成 `input` 组的 995,而 `xdg-desktop-portal` 要用 `/proc/<pid>/root` 识别调用者身份,内核的 gid 检查会直接 `EACCES`,截屏就废了(实测报 `Portal operation not allowed: Unable to open /proc/<pid>/root`)。ACL 不碰进程身份,两条路都通。
|
|
53
|
+
|
|
54
|
+
## 打开
|
|
55
|
+
|
|
56
|
+
设置 → 插件 → **Ubuntu 桌面自动化 (Computer Use)** → 打开开关 → 刷新页面。
|
|
57
|
+
|
|
58
|
+
开着插件但没开 Computer Use 时也可以先跑 `linux_mcp_doctor`(不需要 MCP 在线),它会逐项告诉你缺什么、怎么补。
|
|
59
|
+
|
|
60
|
+
## 已知限制(重要,别踩坑)
|
|
61
|
+
|
|
62
|
+
- **Chromium / Electron / Qt 应用(Chrome、VS Code、微信、WPS、Bitwarden)暴露的 UI 树是空的**——这是平台事实,不是 bug。它们只能靠"截屏 + 坐标点击",窗口一动就得重新截图。原生 GTK 应用用 `ui_find` + `ui_action` 很稳。
|
|
63
|
+
- AT-SPI 全量枚举约 3–4 秒(某个无响应应用会拖慢),所以应用列表有 5 秒缓存。
|
|
64
|
+
- 截屏必须走 portal:第一次会弹一次系统授权框(GNOME 记住你的选择),之后每次截图静默、约 0.5 秒。ScreenCast 流式路径(`DSH_LINUX_CU_SCREENCAST=1` 可强制)在 GNOME 46 上画面静止时不产帧,只当兜底。
|
|
65
|
+
- **锁屏时只截图、不注入**:服务器会向 `org.gnome.ScreenSaver.GetActive` 查询锁屏状态,处于锁屏时 `click` / `key` / `type_text` 等全部拒绝执行(锁屏焦点在密码框上,误打就会往密码里塞字符),`screenshot` 仍可用。`desktop_status` 的 `session.locked` 会告诉你当前状态。
|
|
66
|
+
- 只能工作在**当前登录的图形会话**里;SSH / 无头环境下没有桌面可控制。
|
|
67
|
+
|
|
68
|
+
## 安全模型
|
|
69
|
+
|
|
70
|
+
- 打开 `input` 组 + `/dev/uinput` 之后,**该账户下任何进程都能控制键鼠**。这就是这个能力的本质,没有免费午餐。
|
|
71
|
+
- 缓解:MCP 桥接默认 `disabled`;`/dev/uinput` 只对 `input` 组开放;`ydotoold` socket 0600;所有工具调用走 DSH 的审批体系。
|
|
72
|
+
- 日志在 `~/.cache/dsh-linux-cu/server.log`(超 1 MB 轮转)。不联网、不上报、不含遥测。
|
|
73
|
+
|
|
74
|
+
## 无人值守与锁屏
|
|
75
|
+
|
|
76
|
+
锁屏是这台机器的安全基线,插件默认不试图绕过它:`/dev/uinput` 注入的是真实内核输入事件,在锁屏界面上它与物理键盘没有区别——正因为如此,默认配置下锁屏时插件拒绝一切注入。
|
|
77
|
+
|
|
78
|
+
- **锁屏时能做**:截图(画面是锁屏本身,通常没用)、读文件、跑命令、写代码、git / npm 等一切非 GUI 工作。
|
|
79
|
+
- **锁屏时不能做**:点击、拖拽、滚轮、按键、输入文字、UI 树操作。`desktop_status` 的 `session.locked` 和 `linux_mcp_doctor` 的 `screen-lock` 项会告诉你当前状态。
|
|
80
|
+
- **想让"人不在场"也能做 GUI 任务**,干净的方向是给自动化一块**独立的虚拟显示器**(`org.gnome.Mutter.RemoteDesktop` 的 virtual monitor,GNOME 46 起可用),由 RemoteDesktop 接口往虚拟屏注入,物理屏保持锁定、你的桌面不被共享。这条路尚未实现,属于后续计划;不会走"关掉自动锁屏"或"存一份登录密码"这两条捷径。
|
|
81
|
+
|
|
82
|
+
### 解锁开关(默认关闭)
|
|
83
|
+
|
|
84
|
+
如果确实希望模型能自己解锁屏幕,有一个显式开关,**默认关闭**;关闭时 `unlock_screen` 工具根本不会出现在模型面前(工具列表里没有它,模型也就不知道有这个能力)。
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
MCP=~/.local/share/dsh-linux-computer-use/linux_desktop_mcp.py
|
|
88
|
+
|
|
89
|
+
python3 -u $MCP --set-unlock-password # 在你自己终端里输入一次,隐藏回显,存进 GNOME 钥匙环
|
|
90
|
+
python3 -u $MCP --unlock-status # 查看开关与是否已存密码
|
|
91
|
+
python3 -u $MCP --unlock-policy off # 关掉(推荐随手关)
|
|
92
|
+
python3 -u $MCP --clear-unlock-password # 从钥匙环删除
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
规则只有三条,但都是硬的:
|
|
96
|
+
|
|
97
|
+
1. **密码不经过对话、配置文件和日志**。它存在 GNOME 钥匙环(libsecret)里,由你本人的终端 `getpass` 写进去;服务器只在 `unlock_screen` 被调用的那一瞬间读取,用完立刻丢引用,日志里只有"第几次尝试成功"。
|
|
98
|
+
2. **解锁是唯一的例外**。开关打开后,其它注入工具在锁屏时照旧拒绝;只有一次明确的 `unlock_screen` 调用(还必须带 `confirm: "unlock"` 参数)才会去敲密码,成功后会话就是解锁状态,后续操作照常。
|
|
99
|
+
3. **打开它意味着什么,要说清楚**:锁屏从此只挡"坐在键盘前的人",不再挡"以你身份运行的软件"。任何以你账户跑的进程都能从钥匙环读到那个密码——而这本来就是插件已经给你的能力范围。这就是为什么默认关闭、为什么建议用完随手 `--unlock-policy off`。
|
|
100
|
+
|
|
101
|
+
密码里如果有中文或其它非 ASCII 字符,注入会失败(`/dev/uinput` 的键盘设备只能敲有限字符集);这种情况请继续用"回来自己解锁"。
|
|
102
|
+
|
|
103
|
+
## 故障排查
|
|
104
|
+
|
|
105
|
+
### Pointer events are ignored
|
|
106
|
+
|
|
107
|
+
On rare sessions GNOME keeps the virtual pointer device open but stops
|
|
108
|
+
honouring its motion: keyboard and scroll still work, clicks do nothing.
|
|
109
|
+
|
|
110
|
+
1. `desktop_status` with `reset_input: true` recreates the devices
|
|
111
|
+
2. if that does not help, reboot the machine (a logout/login is not always
|
|
112
|
+
enough, because `dsh web` can survive it through systemd user lingering)
|
|
113
|
+
3. `dsh web` itself must run inside the current desktop session: its
|
|
114
|
+
`DBUS_SESSION_BUS_ADDRESS` is inherited, so an old process cannot reach the
|
|
115
|
+
accessibility bus or the portal any more
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
python3 -u ~/.local/share/dsh-linux-computer-use/linux_desktop_mcp.py --selftest
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
或在对话里让模型调用 `linux_mcp_doctor`。逐项报告:会话类型、Python/GI/Atspi/Gst、`/dev/uinput`、启动器、wl-clipboard、portal 版本、pipewiresrc、截屏授权、显示器、AT-SPI 应用数。
|
|
124
|
+
|
|
125
|
+
## 兼容性
|
|
126
|
+
|
|
127
|
+
- Ubuntu 24.04 / GNOME 46 / Wayland(主要目标,实测环境)
|
|
128
|
+
- 需要 `python3-gi`、`gir1.2-atspi-2.0`、`gstreamer1.0-pipewire`、`gstreamer1.0-plugins-base`(Ubuntu 桌面版默认自带)
|
|
129
|
+
- X11 会话可以工作(注入与截屏另有路径),但不是本插件的优化目标
|
|
130
|
+
|
|
131
|
+
## License
|
|
132
|
+
|
|
133
|
+
MIT
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
### English
|
|
138
|
+
|
|
139
|
+
Linux desktop automation for DeepSeek Harness on Wayland. Screenshots go through the `xdg-desktop-portal` Screenshot interface (the only Wayland-legal path, ~0.5s per capture after one granted approval); pointer and keyboard input go straight to `/dev/uinput` so applications cannot tell them from a real user; the UI tree comes from AT-SPI2. 28 tools are published as `mcp__linux__*`, plus a `linux_mcp_doctor` host tool that diagnoses the environment even while the bridge is off. Ships disabled: enable it in Settings → Plugins.
|
|
140
|
+
|
|
141
|
+
Install: `dsh plugin --profile web add dsh-plugin-linux-computer-use`, run `sudo ./linux-computer-use-prep.sh`, restart `dsh`, then flip the switch.
|
|
142
|
+
|
|
143
|
+
Known limit: Chromium, Electron and Qt windows expose an empty accessibility tree, so they need screenshot-and-coordinates clicking rather than semantic element actions.
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Linux Computer Use bundle.
|
|
2
|
+
#
|
|
3
|
+
# Two entries:
|
|
4
|
+
# 1. linux-computer-use-mcp - the MCP client that spawns the local stdio
|
|
5
|
+
# server and publishes its 28 tools as mcp__linux__*. It ships DISABLED
|
|
6
|
+
# (Computer Use is off by default); turn it on in Settings -> Plugins.
|
|
7
|
+
# 2. linux-computer-use-doctor - the linux_mcp_doctor host tool. It stays
|
|
8
|
+
# available even while the MCP entry is off, so diagnosis works before
|
|
9
|
+
# anything is enabled.
|
|
10
|
+
#
|
|
11
|
+
# The command is a fixed launcher path, not this package's own directory: a
|
|
12
|
+
# published package lands wherever the profile puts it, so linux-computer-use-prep.sh
|
|
13
|
+
# installs /usr/local/bin/dsh-linux-desktop-mcp, which execs the server copy the
|
|
14
|
+
# bundle syncs to ~/.local/share/dsh-linux-computer-use on every load.
|
|
15
|
+
- insert:
|
|
16
|
+
- id: linux-computer-use-mcp
|
|
17
|
+
name: '@deepseek-ai/dsh-mcp-client'
|
|
18
|
+
disabled: true
|
|
19
|
+
config:
|
|
20
|
+
serverName: linux
|
|
21
|
+
transport: stdio
|
|
22
|
+
command: /usr/local/bin/dsh-linux-desktop-mcp
|
|
23
|
+
args: []
|
|
24
|
+
toolCallTimeoutMs: 180000
|
|
25
|
+
startupTimeoutMs: 30000
|
|
26
|
+
failOnStartupError: false
|
|
27
|
+
reconnect:
|
|
28
|
+
enabled: true
|
|
29
|
+
initialDelayMs: 500
|
|
30
|
+
maxDelayMs: 10000
|
|
31
|
+
maxAttempts: 5
|
|
32
|
+
- id: linux-computer-use-doctor
|
|
33
|
+
name: dsh-plugin-linux-computer-use
|
|
34
|
+
config:
|
|
35
|
+
python: /usr/bin/python3
|
package/docs/DETAIL.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Ubuntu Desktop Automation (Computer Use)
|
|
2
|
+
|
|
3
|
+
Gives the agent eyes and hands on a **Wayland GNOME** desktop: it can look at the
|
|
4
|
+
screen, walk the accessibility tree of a window, move the pointer, click, type,
|
|
5
|
+
use the clipboard, inspect processes and change GSettings.
|
|
6
|
+
|
|
7
|
+
The equivalent on Windows is a single `SendInput` call plus UI Automation. On
|
|
8
|
+
Wayland neither exists, so each capability has its own path:
|
|
9
|
+
|
|
10
|
+
| Capability | How it works here | Why |
|
|
11
|
+
| --- | --- | --- |
|
|
12
|
+
| Screenshot | `xdg-desktop-portal` **Screenshot** (one approval, remembered by the desktop) → PNG in ~0.5s. A **ScreenCast** + `pipewiresrc` session stays as a fallback (`DSH_LINUX_CU_SCREENCAST=1`) | Wayland forbids silent screen capture; `org.gnome.Shell.Screenshot` returns *AccessDenied* for clients, and the ScreenCast stream stalls on static content under GNOME 46 |
|
|
13
|
+
| Pointer / keyboard | `/dev/uinput`: the server creates an absolute tablet device, a wheel device and a full keyboard, and writes kernel input events | No `SendInput`. `xdotool` only reaches XWayland windows, and `ydotool` (fallback) cannot scroll |
|
|
14
|
+
| UI tree | **AT-SPI2** (`org.a11y.Bus`) | UI Automation equivalent |
|
|
15
|
+
| Clipboard | `wl-copy` / `wl-paste` | `xclip` does not work on Wayland |
|
|
16
|
+
| Settings ("registry") | `gsettings` / dconf | closest analogue to the registry |
|
|
17
|
+
| Lock state | `org.gnome.ScreenSaver.GetActive` over the session bus | input must stop while the lock screen holds the password field; screenshots stay allowed |
|
|
18
|
+
| Processes | `ps` and `/proc` | portable |
|
|
19
|
+
|
|
20
|
+
## Requirements
|
|
21
|
+
|
|
22
|
+
Run the preparation script once (no logout needed):
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
sudo ./linux-computer-use-prep.sh # packages, udev rule, ACL, launcher
|
|
26
|
+
./linux-computer-use-prep.sh --verify
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
It installs `wl-clipboard` (required), `ydotool` (optional fallback), creates
|
|
30
|
+
`/etc/udev/rules.d/60-uinput.rules` so `/dev/uinput` carries `TAG+="uaccess"`
|
|
31
|
+
(an ACL for the active desktop user) and also belongs to group `input`
|
|
32
|
+
with mode `0660`, adds you to that group, and installs a `ydotoold` unit. It is
|
|
33
|
+
idempotent and has `--uninstall`.
|
|
34
|
+
|
|
35
|
+
## Enabling
|
|
36
|
+
|
|
37
|
+
Computer Use ships **disabled**: enabling it lets the agent move your real
|
|
38
|
+
pointer and type on your real keyboard, so it is not something to switch on by
|
|
39
|
+
accident. Turn it on in **Settings → Plugins → Ubuntu Desktop Automation**, then
|
|
40
|
+
reload the page. `linux_mcp_doctor` works either way.
|
|
41
|
+
|
|
42
|
+
## Tools (`mcp__linux__*`)
|
|
43
|
+
|
|
44
|
+
| Group | Tools |
|
|
45
|
+
| --- | --- |
|
|
46
|
+
| Vision | `screenshot` — PNG + size + path; the first call asks for permission once |
|
|
47
|
+
| Tree | `ui_apps`, `ui_tree`, `ui_find`, `ui_describe`, `ui_text` |
|
|
48
|
+
| Act on elements | `ui_action` (invoke/press/toggle), `ui_focus`, `ui_set_text` |
|
|
49
|
+
| Pointer | `click`, `move`, `drag`, `scroll`, `pointer_button` (hold/release) |
|
|
50
|
+
| Keyboard | `key` (`ctrl+shift+t`), `type_text` (Unicode via clipboard paste) |
|
|
51
|
+
| Clipboard | `clipboard_get`, `clipboard_set` |
|
|
52
|
+
| System | `process_list`, `process_kill`, `launch_app`, `settings_get`, `settings_set`, `settings_list_keys`, `notify`, `window_list`, `display_info`, `desktop_status` |
|
|
53
|
+
| Unlocking (opt-in) | `unlock_screen` — only listed while the unlock policy is on; see below |
|
|
54
|
+
|
|
55
|
+
Coordinates are **logical desktop pixels**. Pass `space: "screenshot"` to give
|
|
56
|
+
coordinates in the pixels of the most recent screenshot instead; on a HiDPI
|
|
57
|
+
display those differ, and the tool converts for you.
|
|
58
|
+
|
|
59
|
+
## What works well and what does not
|
|
60
|
+
|
|
61
|
+
* **Native GTK apps** (Files, Settings, Terminal, Text Editor) expose a real
|
|
62
|
+
accessibility tree — prefer `ui_find` + `ui_action` there, it survives layout
|
|
63
|
+
changes and works with the window in the background.
|
|
64
|
+
* **Chromium, Electron, Qt apps** (Chrome, VS Code, Slack, WeChat, WPS) expose
|
|
65
|
+
an empty tree unless accessibility is force-enabled. For these, use
|
|
66
|
+
`screenshot` + coordinate clicks. This is a platform limitation, not a bug
|
|
67
|
+
in this bundle.
|
|
68
|
+
* Enumerating applications takes ~3–4 s because one unresponsive app stalls the
|
|
69
|
+
a11y bus; results are cached for a few seconds.
|
|
70
|
+
* `type_text` falls back to clipboard-paste for characters the key table cannot
|
|
71
|
+
type, which briefly overwrites the clipboard.
|
|
72
|
+
|
|
73
|
+
## Lock state and the opt-in unlock switch
|
|
74
|
+
|
|
75
|
+
While the session is locked, every input tool refuses to run: the lock screen
|
|
76
|
+
keeps the password field focused, so injected keystrokes would land inside it.
|
|
77
|
+
Screenshots keep working. `desktop_status` reports `session.locked`.
|
|
78
|
+
|
|
79
|
+
Unlocking is **off by default**. While it is off, the `unlock_screen` tool is not
|
|
80
|
+
listed at all — the model does not learn the capability exists. To switch it on,
|
|
81
|
+
store a password in the GNOME keyring from your own terminal:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
python3 -u ~/.local/share/dsh-linux-computer-use/linux_desktop_mcp.py --set-unlock-password
|
|
85
|
+
python3 -u ~/.local/share/dsh-linux-computer-use/linux_desktop_mcp.py --unlock-status
|
|
86
|
+
python3 -u ~/.local/share/dsh-linux-computer-use/linux_desktop_mcp.py --unlock-policy off
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
The password lives in libsecret (never in a chat, a config file or the log), is
|
|
90
|
+
read only at the moment `unlock_screen` runs, and is dropped immediately after
|
|
91
|
+
typing. The call also has to carry `confirm: "unlock"`; it is the single
|
|
92
|
+
sanctioned exception to the lock-screen guard, and every other tool still
|
|
93
|
+
refuses while the screen is locked.
|
|
94
|
+
|
|
95
|
+
Switching it on means the lock screen stops a person at the keyboard, not
|
|
96
|
+
software running as you: any process of yours can read the keyring item. That
|
|
97
|
+
is why the default is off and why turning it back off afterwards is worth the
|
|
98
|
+
ten seconds.
|
|
99
|
+
|
|
100
|
+
## Security
|
|
101
|
+
|
|
102
|
+
Any process running as your user can inject input once `/dev/uinput` is
|
|
103
|
+
writable — that is exactly the power being granted. Mitigations: `/dev/uinput`
|
|
104
|
+
is group `input` (not world-writable), the `ydotoold` socket is `0600`, and the
|
|
105
|
+
MCP entry is disabled until you enable it in the plugin panel.
|
|
106
|
+
|
|
107
|
+
`process_kill` refuses pid 1 and the server itself. `settings_set` only writes
|
|
108
|
+
GSettings keys; it cannot edit files.
|
|
109
|
+
|
|
110
|
+
## Diagnostics
|
|
111
|
+
|
|
112
|
+
`linux_mcp_doctor` checks the bridge, `/dev/uinput`, the Python GI stack, the
|
|
113
|
+
portal, GStreamer, the clipboard helpers, the display layout and AT-SPI, and
|
|
114
|
+
prints a `fix:` line for each problem. The server also answers
|
|
115
|
+
`python3 server/linux_desktop_mcp.py --selftest` and `--status` when run by hand.
|
|
116
|
+
|
|
117
|
+
Logs: `~/.cache/dsh-linux-cu/server.log`, screenshots:
|
|
118
|
+
`~/.cache/dsh-linux-cu/shots/`.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Releasing
|
|
2
|
+
|
|
3
|
+
Maintainer notes. The npm account (`beiningcheng`) enforces **2FA with a security key only** —
|
|
4
|
+
TOTP cannot be configured on it any more, so every publish goes through one browser approval.
|
|
5
|
+
|
|
6
|
+
## Publish a new version
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
# 1. bump the version and add a CHANGELOG entry
|
|
10
|
+
npm version patch # or minor / major, then edit CHANGELOG.md
|
|
11
|
+
|
|
12
|
+
# 2. publish — this needs a real TTY, so run it in a terminal, not in a pipe
|
|
13
|
+
HTTPS_PROXY=http://127.0.0.1:7897 HTTP_PROXY=http://127.0.0.1:7897 \
|
|
14
|
+
NODE_OPTIONS=--dns-result-order=ipv4first \
|
|
15
|
+
npm publish --cache /tmp/npmcache
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
When npm prints
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
Authenticate your account at:
|
|
22
|
+
https://www.npmjs.com/auth/cli/<uuid>
|
|
23
|
+
Press ENTER to open in the browser...
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
press **Enter**, then in the opened page click **Use security key** and complete the system
|
|
27
|
+
prompt. The CLI publishes as soon as the browser flow succeeds.
|
|
28
|
+
|
|
29
|
+
Notes that cost time to rediscover:
|
|
30
|
+
|
|
31
|
+
- The registry is IPv6-only in its DNS answer and this machine has no working IPv6 route, so
|
|
32
|
+
`NODE_OPTIONS=--dns-result-order=ipv4first` plus the local proxy is mandatory.
|
|
33
|
+
- `npm publish` in a non-TTY (piped) shell prints the auth URL as `***` and can never finish.
|
|
34
|
+
- A granular access token without *Bypass 2FA* gets `403 ... Two-factor authentication or
|
|
35
|
+
granular access token with bypass 2fa enabled is required to publish packages`.
|
|
36
|
+
- The registry briefly exposes a `0.0.0-stage` placeholder while a version is being processed;
|
|
37
|
+
it is not `latest` and can be ignored.
|
|
38
|
+
|
|
39
|
+
## GitHub release
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
git push origin main
|
|
43
|
+
git tag -a v<version> -m "v<version>"
|
|
44
|
+
git push <remote-with-token> v<version>
|
|
45
|
+
npm pack --cache /tmp/npmcache
|
|
46
|
+
# then upload the tarball as a release asset through the API
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Marketplace listing
|
|
50
|
+
|
|
51
|
+
`awesome-dsh-plugin` takes one YAML file per plugin at
|
|
52
|
+
`data/plugins/<owner>__<repo>.yml` (see the repository's contributing guide). Gates:
|
|
53
|
+
|
|
54
|
+
- `package.json` must declare `dsh.bundle`
|
|
55
|
+
- the repository must be **at least 24 hours old**
|
|
56
|
+
- the repository must carry the `dsh-plugin` topic
|
package/docs/preview.svg
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 300" width="640" height="300" role="img" aria-label="Linux Desktop Control preview">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="bg" x1="0" y1="0" x2="0" y2="1">
|
|
4
|
+
<stop offset="0" stop-color="#0F1420"/>
|
|
5
|
+
<stop offset="1" stop-color="#161C2B"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
</defs>
|
|
8
|
+
<rect width="640" height="300" fill="url(#bg)"/>
|
|
9
|
+
<rect x="48" y="40" width="380" height="220" rx="10" fill="#1C2436" stroke="#2C3852" stroke-width="2"/>
|
|
10
|
+
<rect x="48" y="40" width="380" height="26" rx="10" fill="#243049"/>
|
|
11
|
+
<circle cx="66" cy="53" r="4" fill="#FF6B6B"/><circle cx="80" cy="53" r="4" fill="#FFD166"/><circle cx="94" cy="53" r="4" fill="#06D6A0"/>
|
|
12
|
+
<rect x="72" y="88" width="150" height="10" rx="5" fill="#3C4C6E"/>
|
|
13
|
+
<rect x="72" y="110" width="240" height="8" rx="4" fill="#2E3A54"/>
|
|
14
|
+
<rect x="72" y="128" width="200" height="8" rx="4" fill="#2E3A54"/>
|
|
15
|
+
<rect x="72" y="160" width="120" height="34" rx="8" fill="#4C8DFF" opacity=".85"/>
|
|
16
|
+
<rect x="208" y="160" width="120" height="34" rx="8" fill="#2A3450" stroke="#3C4C6E"/>
|
|
17
|
+
<path d="M300 196l26 14-11 3.5 6.5 11.5-8 4-6.2-12-8.3 7.4z" fill="#FFB020" stroke="#0B0F18" stroke-width="1.4" stroke-linejoin="round"/>
|
|
18
|
+
<g font-family="ui-sans-serif, system-ui, sans-serif" fill="#DCE6F7">
|
|
19
|
+
<text x="456" y="86" font-size="20" font-weight="600">Computer Use</text>
|
|
20
|
+
<text x="456" y="112" font-size="13" fill="#8FA3C4">28 tools · mcp__linux__*</text>
|
|
21
|
+
<text x="456" y="150" font-size="12" fill="#8FA3C4">screenshot · ui_tree</text>
|
|
22
|
+
<text x="456" y="170" font-size="12" fill="#8FA3C4">click · key · scroll</text>
|
|
23
|
+
<text x="456" y="190" font-size="12" fill="#8FA3C4">clipboard · processes</text>
|
|
24
|
+
<text x="456" y="210" font-size="12" fill="#8FA3C4">gsettings · notify</text>
|
|
25
|
+
<text x="456" y="244" font-size="12" fill="#06D6A0">off by default</text>
|
|
26
|
+
</g>
|
|
27
|
+
</svg>
|
package/icon.svg
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36" width="36" height="36" role="img" aria-label="Linux desktop control">
|
|
2
|
+
<rect x="2.5" y="6" width="31" height="20" rx="2.5" fill="none" stroke="#4C8DFF" stroke-width="2"/>
|
|
3
|
+
<path d="M8 22V10.5" stroke="#4C8DFF" stroke-width="2" stroke-linecap="round" opacity=".45"/>
|
|
4
|
+
<path d="M13 22v-6" stroke="#4C8DFF" stroke-width="2" stroke-linecap="round" opacity=".45"/>
|
|
5
|
+
<path d="M18 22v-9" stroke="#4C8DFF" stroke-width="2" stroke-linecap="round" opacity=".45"/>
|
|
6
|
+
<path d="M23 22v-4" stroke="#4C8DFF" stroke-width="2" stroke-linecap="round" opacity=".45"/>
|
|
7
|
+
<path d="M12 26h12v3.5H12z" fill="#4C8DFF" opacity=".35"/>
|
|
8
|
+
<path d="M22.5 17.5l7.5 4.2-3.2 1.1 1.9 3.4-2.3 1.2-1.8-3.5-2.4 2.2z" fill="#FFB020" stroke="#1B1B1B" stroke-width=".7" stroke-linejoin="round"/>
|
|
9
|
+
</svg>
|