dsh-windows-desktop
by Altairpaca
README.md
# dsh-windows-desktop
给 DeepSeek Harness 装上「一台 Windows 电脑」:**实时画面 + 完整工具面**,装一个插件就够。
完整替代 [Windows-MCP](https://github.com/CursorTouch/Windows-MCP),并且多了一直可见的画面。
**不再依赖它**:被控机用自己的 Python 环境(`-Standalone`),连它的解释器都不用。
## 能力
**29 个工具**:
| 类别 | 工具 |
|---|---|
| 画面 | `screenshot`(PNG 落盘)、`display_info` |
| UI 自动化 | `ui_tree`、`click_element`、`type_into` |
| 键鼠 | `click`、`move_mouse_to`、`scroll`、`drag`、`press_key`、`type_text` |
| 窗口 | `list_windows`、`activate_window`、`launch_app` |
| 命令 | `powershell` |
| 注册表 | `registry_read`、`registry_write` |
| 进程 | `list_processes`、`kill_process` |
| 文件 | `read_file`、`write_file`、`list_dir` |
| 剪贴板 | `clipboard_get`、`clipboard_set` |
| 等待 | `wait`、`wait_for`(条件轮询窗口/元素) |
| 批量 | `multi_select`、`multi_edit` |
| 通知 | `notification`(Windows toast) |
**实时画面**:`/plugins/dsh-windows-desktop/viewer`,原生 MJPEG 播放,8–13 fps。
## 安装
**DSH 侧(一条命令)**:
```bash
dsh plugin --profile <profile> add <本目录>
```
**被控机(一条命令)**:
```powershell
.\install.ps1 -Key <密钥> -Standalone
```
`-Standalone` 会用 uv 建一个独立 Python 环境,不依赖机器上任何已有安装。
自检会过四关:依赖 → 端口 → Session 1 → 出帧。
不带 `-Standalone` 则使用机器上已有的 Python(需有 fastmcp/uiautomation 等)。
## 架构
```
DSH 主机 (Linux) 被控机 (Windows, Session 1)
┌──────────────────────────┐ ┌────────────────────────────┐
│ 插件 │ ssh -L │ agent/server.py │
│ FrameChannel ────────────┼───────────▶│ :8201 MJPEG 帧服务 │
│ 拉 127.0.0.1:18201 │ 18201 │ ImageGrab → JPEG │
│ │ │ │
│ dsh-mcp-client ──────────┼───────────▶│ :8200 MCP streamable-http│
│ 连 127.0.0.1:18200 │ 18200 │ 24 个工具 │
└──────────────────────────┘ └────────────────────────────┘
```
被控机上**只跑一个进程**,同时提供 MCP 与帧服务。
## 三个硬约束(都是实测出来的)
1. **抓屏必须在被控机 Session 1**。插件在 Linux 上看不到 Windows 屏幕;经 SSH 拉起的进程在 Session 0 也抓不到(`OSError: screen grab failed`)。只有 `schtasks /it` 拉起的进程在 Session 1。
2. **一切走本机回环**。DSH 装了全局代理,`no_proxy` 只含回环;直连 tailnet IP 会被吞。
3. **隧道远端必须写 tailnet IP**。Windows 回环不跨 Session:服务在 Session 1,sshd 在 Session 0。
## 实测数据
2560×1600 的被控机:
| 项 | 数值 |
|---|---|
| 抓屏上限(ImageGrab) | 20 fps |
| 端到端 MJPEG | **8–13 fps / 约 950 KB/s** |
| 单帧(1280×800, q70) | 约 70–95 KB |
| 首帧延迟 | < 1 秒 |
| 工具调用(powershell) | 立即返回 |
## 配置
在 profile 的 `cordis.patch.yml` 的 `config` 里:
| 字段 | 默认 | 说明 |
|---|---|---|
| `host` | `altairpaca` | ssh 别名 |
| `remoteHost` | 空 | 被控机 tailnet 地址 |
| `remoteMcpPort` / `remoteFramePort` | `8200` / `8201` | 被控机端口 |
| `localMcpPort` / `localFramePort` | `18200` / `18201` | 本机回环端口 |
| `stream.fps` | `8` | 帧率 1–60 |
| `stream.scale` | `0.5` | 缩放 0.1–1 |
| `stream.quality` | `70` | JPEG 质量 10–95 |
| `auth.frameKey` | 空 | 留空则自动生成,但两边必须一致 |
## 已知限制
- **单被控机**。一条通道一个 `host`。
- **只能看,不能点**。页面是纯监看;操作走工具。
- **带宽**。950 KB/s 是 MJPEG 的代价。要更低就降 `fps` 或 `scale`。
- 未在 Windows 10 以外的系统验证。
## 许可
MIT。`agent/server.py` 的 UIA 能力依赖 [uiautomation](https://pypi.org/project/uiautomation/)(Apache-2.0),不 vendor 它的代码。
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues