DeskPilot
Desktop control for DeepSeek Harness (DSH). Give the agent eyes and hands on a Windows desktop: take screenshots, read the UI tree, click controls, and type — including Chinese — on pages that block copy and paste.
中文说明
这个插件解决什么问题
在线作业、考试系统、企业内网后台,这些页面有三个共同点:右键禁用、复制禁用、DOM 也拿不到。截图发给模型,它看得懂,却没法替你点。
DeskPilot 补的就是"看懂"之后的"动手":把窗口的 UI 自动化树读成文本,按控件名点击,把中文逐字敲进去。
八个工具
| 工具 | 作用 |
|---|---|
screen_windows |
列出窗口(进程 / pid / 标题),可按进程名过滤 |
screen_capture |
截整屏 / 窗口 / 区域,存 PNG 并返回路径 |
screen_read |
读 UI 元素树,返回缩进文本;单选/复选框带 [x]/[ ],输入框带当前值 |
screen_click |
按控件名点击(可指定第几个匹配),找不到才用坐标 |
screen_type |
逐字输入文本,支持中文,绕过禁用粘贴 |
screen_key |
发按键组合,如 ^{TAB}、{PGDN}、{ENTER} |
screen_scroll |
滚轮滚动 |
screen_cleanup |
删除本插件保存的所有截图 |
安装
# 在 DSH 里(推荐)
plugin_manager install_bundle target = dsh-deskpilot
# 或者直接下 npm 包
npm i dsh-deskpilot
只支持 Windows 10/11,依赖系统自带的 PowerShell 5.1 与 UI Automation;不需要 Python、不需要 OCR、不需要任何第三方依赖。
快速开始
直接用自然语言说需求,Agent 自己选工具:
- "打开 Edge 里那个作业页,把第 41 到 43 题做了"
- "看看这个窗口里现在选中了哪个选项"
- "帮我把这份表填了,数据在下面"
做题这条链路的典型顺序:screen_read 找出题干和选项 → screen_click 点选项 → 输入框先 screen_click 再 screen_type → screen_read 复核。
隐私与缓存
- 截图写到
%TEMP%\dsh-screen,每次截图顺手清理:超过 30 分钟的、以及除最新 20 张以外的全部删除。 - 任务结束调
screen_cleanup一次清空。 - Agent 用
read_image看过的图,DSH 会另存进它自己的附件库(%USERPROFILE%\.dsh\attachments)。那是 harness 的状态,插件不碰。
已知限制
- 只支持 Windows;锁屏时 UI Automation 失效。
- 纯 canvas 渲染的文字、图片里的文字在界面树里不存在,只能截图后靠视觉模型。
- 输入注入要求目标窗口在前台;插件会主动置前,但被抢焦点时字符可能打偏。
- 明确拒绝往密码框输入。
设计要点
bin/desktop.ps1单文件双模式:一次性调用(-Action …)与常驻服务(-Server,按行收发 JSON)。- 常驻服务把单次调用从 ~600 ms(PowerShell 启动 + Add-Type 编译)降到 60–400 ms;服务卡死会被超时杀掉并重建。
- 点击优先走 UIA 的 invoke/select 模式,失败才合成鼠标事件。
- 每次元素查找都有截止时间,模态框卡住不会无限等待。
- 进程启动后先声明 DPI 感知、再加载 WinForms,否则窗口坐标会被虚拟化,截图裁错区域。
开发
index.js 工具定义与传输层(常驻服务 + 一次性回退)
bin/desktop.ps1 UI Automation + SendInput,双模式
bin/native.cs P/Invoke:鼠标、键盘 Unicode 注入、窗口矩形
scripts/ 发布用 .cmd(登录、发布)
docs/ 上架材料、索引模板、宣传文案
改完代码不用重装:把插件在 DSH 里关掉再打开即可重新加载。
English
DeskPilot gives a DSH agent hands on a Windows desktop. It exists for the case where screenshots are not enough: the agent can see the page, but the page refuses copy/paste and exposes no DOM.
- Read — dumps the UI Automation tree as indented text. Unlike a screenshot it returns structured state:
RadioButton B. [x],Edit answer = 20 mm, so multiple-choice and fill-in questions can actually be answered. - Click — by control name, using the platform's own invoke/select pattern first; scrolls the control into view when it sits outside the window.
- Type — Unicode key injection, so Chinese text lands even where the page blocks the clipboard.
- Hygiene — screenshots are pruned on every capture;
screen_cleanupwipes them when the task is done.
A warm helper process keeps UI Automation loaded, so a call costs 60–400 ms instead of a fresh PowerShell start.
Requirements
Windows 10/11 with the built-in Windows PowerShell 5.1. No other dependency.
Install
plugin_manager install_bundle target = dsh-deskpilot
Limits
Windows only. UIA does not work while the screen is locked. Text painted into a canvas is invisible to the UI tree — use a screenshot and a vision model for that.
License
MIT
No comments yet. Be the first to write one.