dsh-screen-automation 0.1.0 → 0.1.2
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 +55 -0
- package/cordis.patch.yml +12 -3
- package/lib/index.js +34 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
> 这不是重写屏幕自动化,而是**桥接**:dsh 负责 Agent 编排,小助手负责本地执行。
|
|
8
8
|
|
|
9
|
+
> ⚠️ **前置依赖**:本插件只是一层桥接,**本机必须先独立安装「屏幕自动化小助手」桌面端**(Windows `.exe` / macOS `.app`),30 个工具才能真正工作。安装方式见下方「[前置依赖:安装屏幕自动化小助手](#前置依赖安装屏幕自动化小助手)」。
|
|
10
|
+
|
|
9
11
|
## 设计原则
|
|
10
12
|
|
|
11
13
|
- **桥接而非重实现**:dsh 插件只做「定位二进制 → 调 CLI → 解析 JSON → 回传」,智能只写在后端。
|
|
@@ -116,6 +118,59 @@ screen capture 拿图 → ctx.attachments.saveImage 登记为不可变图片引
|
|
|
116
118
|
|
|
117
119
|
都找不到时,工具会抛出带官网下载链接的明确错误。
|
|
118
120
|
|
|
121
|
+
## 前置依赖:安装屏幕自动化小助手
|
|
122
|
+
|
|
123
|
+
本插件**不内置**任何屏幕识别或输入执行的代码,它只是一层桥接。要让上面 30 个工具真正可用,
|
|
124
|
+
你本机必须先装好「屏幕自动化小助手」(Screen Automation Helper) 桌面端——Windows 上是
|
|
125
|
+
`ScreenAutomationHelper.exe`,macOS 上是 `Screen Automation Helper.app`。小助手通过 `cli <subcommand>`
|
|
126
|
+
暴露 JSON 接口,本插件只是去「定位二进制 → 调 CLI → 解析 JSON → 回传」。
|
|
127
|
+
|
|
128
|
+
### 1. 下载与安装
|
|
129
|
+
|
|
130
|
+
- **Windows 版**:<https://www.xiaozs.com/sah/downloads/windows/latest>
|
|
131
|
+
- **macOS 版**:<https://www.xiaozs.com/sah/downloads/mac/latest>
|
|
132
|
+
- **ZIP 备用**:<https://www.xiaozs.com/sah/downloads/zip/latest>
|
|
133
|
+
|
|
134
|
+
按**默认路径**安装即可,插件会自动在系统常见位置发现它(详见下方「二进制发现」一节)。
|
|
135
|
+
若使用自定义安装路径,或想在隔离环境里跑,用「二进制发现」里的环境变量 `SCREEN_AUTOMATION_BIN`
|
|
136
|
+
等显式指向可执行文件即可,无需放回默认位置。
|
|
137
|
+
|
|
138
|
+
> 下载页地址以官网为准;如链接变动,请替换为最新官方地址。
|
|
139
|
+
|
|
140
|
+
### Agent 会在对话里主动提示安装
|
|
141
|
+
|
|
142
|
+
本插件不靠 README 让 Agent「知道」前置依赖——dsh 在对话中不会读取仓库文档。
|
|
143
|
+
真正起作用的是运行时注入给 Agent 的信息:`screen_automation_status` 的工具描述要求 Agent
|
|
144
|
+
**先自检**;当小助手未安装时,该工具返回结构化结果(含 `installHint` 与 Windows/macOS/ZIP 下载链接),
|
|
145
|
+
其余工具在 `binary not found` 时报错里也带有同样的安装指引。因此 Agent 会在首次调用时自然地把
|
|
146
|
+
「请先安装屏幕自动化小助手」及下载链接转述给用户,而不是静默失败。
|
|
147
|
+
|
|
148
|
+
### 2. 装好后验证
|
|
149
|
+
|
|
150
|
+
在 dsh 中注册本插件,然后让 Agent 调用一次自检:
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
screen_automation_status
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
- 返回平台可用状态与版本号 → 桥接成功。
|
|
157
|
+
- 报 `binary not found` → 安装路径未被自动发现,按「二进制发现」设置 `SCREEN_AUTOMATION_BIN` /
|
|
158
|
+
`SCREEN_AUTOMATION_MAC_APP` / `SCREEN_AUTOMATION_WIN_EXE` 之一后再试。
|
|
159
|
+
|
|
160
|
+
### 3. 它与 dsh 插件的关系
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
屏幕自动化小助手(本地桌面端,必须独立安装)
|
|
164
|
+
▲ 被本插件 spawn CLI 调用
|
|
165
|
+
│
|
|
166
|
+
dsh-screen-automation(dsh 插件,本仓库)
|
|
167
|
+
▲ 被 dsh Agent 以工具形式调用
|
|
168
|
+
│
|
|
169
|
+
dsh Agent
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
先装小助手,再装本插件,二者各司其职:小助手是 Agent 在本地延伸的「手和眼」,本插件是它们之间的桥。
|
|
173
|
+
|
|
119
174
|
## 安装与构建
|
|
120
175
|
|
|
121
176
|
```sh
|
package/cordis.patch.yml
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
# DeepSeek Harness bundle patch — applied automatically when installed via:
|
|
2
2
|
# dsh plugin --profile web add dsh-screen-automation
|
|
3
3
|
# Inserts the screen-automation host plugin row so its 30 tools auto-register.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
#
|
|
5
|
+
# IMPORTANT: DSH loader patches must be a TOP-LEVEL YAML ARRAY of PatchOptions
|
|
6
|
+
# (see dsh-app-boot `parsePatchList` / cordis-plugin-include `applyEntryPatches`).
|
|
7
|
+
# Each entry may carry `insert`, whose value is an ARRAY of loader entry rows.
|
|
8
|
+
#
|
|
9
|
+
# The originally-published 0.1.0 shipped this file as an object keyed by
|
|
10
|
+
# `insert:` (i.e. `insert:\n id: ...`), which failed `parsePatchList` with
|
|
11
|
+
# "must be a top-level YAML array of loader patch entries" and broke profile
|
|
12
|
+
# boot. This array form is the correct, loadable shape.
|
|
13
|
+
- insert:
|
|
14
|
+
- id: screen-automation
|
|
15
|
+
name: dsh-screen-automation
|
package/lib/index.js
CHANGED
|
@@ -28,6 +28,19 @@ export const inject = ['tools'];
|
|
|
28
28
|
* 能解决就不升到 VLM,省 API 调用(钱)。VLM 是按需升层,非默认路径。
|
|
29
29
|
* - "本地"含本地算力,故 VLM 应下沉到小助手后端用本机推理,而非默认远程端点。
|
|
30
30
|
*/
|
|
31
|
+
/**
|
|
32
|
+
* 小助手未安装时给 Agent / 用户看的统一安装指引。
|
|
33
|
+
* 注意:dsh 不会去读 README,Agent 只在工具描述与工具返回/报错里获得信息,
|
|
34
|
+
* 所以这段引导必须写进运行时可被 Agent 读到的地方(下方两个 not-found 报错 + status 工具描述)。
|
|
35
|
+
* 链接按平台细分(Windows / macOS / ZIP 备用),与官方下载页一致。
|
|
36
|
+
*/
|
|
37
|
+
const INSTALL_HINT = 'The local "Screen Automation Helper" desktop app is required but was not found. ' +
|
|
38
|
+
'Install it (free, Windows / macOS) from one of:\n' +
|
|
39
|
+
' Windows: https://www.xiaozs.com/sah/downloads/windows/latest\n' +
|
|
40
|
+
' macOS: https://www.xiaozs.com/sah/downloads/mac/latest\n' +
|
|
41
|
+
' ZIP: https://www.xiaozs.com/sah/downloads/zip/latest\n' +
|
|
42
|
+
'Or point this plugin at an existing install via one of the env vars: ' +
|
|
43
|
+
'SCREEN_AUTOMATION_BIN, SCREEN_AUTOMATION_MAC_APP, SCREEN_AUTOMATION_WIN_EXE.';
|
|
31
44
|
/** 在多个候选路径里找到已安装的屏幕自动化小助手二进制。优先级:环境变量 > 平台默认位置。 */
|
|
32
45
|
function resolveBinary() {
|
|
33
46
|
const env = process.env;
|
|
@@ -62,9 +75,7 @@ function resolveBinary() {
|
|
|
62
75
|
async function runCli(args, timeoutMs = 30000) {
|
|
63
76
|
const bin = resolveBinary();
|
|
64
77
|
if (!bin) {
|
|
65
|
-
throw new Error(
|
|
66
|
-
'https://www.xiaozs.com/sah/downloads/ (Windows/macOS), or set one of: ' +
|
|
67
|
-
'SCREEN_AUTOMATION_BIN, SCREEN_AUTOMATION_MAC_APP, SCREEN_AUTOMATION_WIN_EXE.');
|
|
78
|
+
throw new Error(INSTALL_HINT);
|
|
68
79
|
}
|
|
69
80
|
const command = `cli ${args.join(' ')}`;
|
|
70
81
|
return new Promise((resolve, reject) => {
|
|
@@ -109,7 +120,16 @@ function cliTool(opts) {
|
|
|
109
120
|
},
|
|
110
121
|
},
|
|
111
122
|
async execute(args) {
|
|
112
|
-
|
|
123
|
+
try {
|
|
124
|
+
return await runCli(opts.buildArgs(args));
|
|
125
|
+
}
|
|
126
|
+
catch (e) {
|
|
127
|
+
if (opts.softFail) {
|
|
128
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
129
|
+
return { ok: false, command: opts.name, raw: msg, data: { installed: false, installHint: INSTALL_HINT } };
|
|
130
|
+
}
|
|
131
|
+
throw e;
|
|
132
|
+
}
|
|
113
133
|
},
|
|
114
134
|
});
|
|
115
135
|
}
|
|
@@ -118,8 +138,12 @@ export function apply(ctx) {
|
|
|
118
138
|
ctx.tools.register(cliTool({
|
|
119
139
|
name: 'screen_automation_status',
|
|
120
140
|
description: 'Check whether the local Screen Automation Helper desktop platform is available and report its status as JSON. ' +
|
|
121
|
-
'
|
|
141
|
+
'ALWAYS call this first to confirm the bridge works before any other screen_automation_* tool. ' +
|
|
142
|
+
'If it reports the helper is not installed (installed:false / "binary not found"), STOP and tell the user how ' +
|
|
143
|
+
'to install it — share the Windows/macOS/ZIP download links from the result error — and do NOT attempt other ' +
|
|
144
|
+
'screen_automation_* tools until the helper is installed and this status call succeeds.',
|
|
122
145
|
parameters: {},
|
|
146
|
+
softFail: true,
|
|
123
147
|
buildArgs: () => ['status'],
|
|
124
148
|
}));
|
|
125
149
|
// 2) 能力清单
|
|
@@ -537,7 +561,10 @@ export function apply(ctx) {
|
|
|
537
561
|
name: 'screen_automation_understand',
|
|
538
562
|
description: 'Capture the screen via the local helper and feed the screenshot to the dsh vision model. ' +
|
|
539
563
|
'Returns the model\'s natural-language understanding of what is on screen. ' +
|
|
540
|
-
'Use this for open-ended tasks OCR/template/color cannot solve (e.g. "what is this screen doing", "where did it error").'
|
|
564
|
+
'Use this for open-ended tasks OCR/template/color cannot solve (e.g. "what is this screen doing", "where did it error"). ' +
|
|
565
|
+
'Requires the local Screen Automation Helper desktop app to be installed and running. ' +
|
|
566
|
+
'If a "binary not found" error is returned, STOP and tell the user to install it ' +
|
|
567
|
+
'(share the Windows/macOS/ZIP download links in the error) before retrying.',
|
|
541
568
|
parameters: {
|
|
542
569
|
prompt: { type: 'string', description: 'What to ask about the screenshot. Defaults to a general description request.' },
|
|
543
570
|
target: { type: 'string', description: 'Capture target: foreground | virtual-screen | work-area | task. Default foreground.' },
|
|
@@ -569,7 +596,7 @@ export function apply(ctx) {
|
|
|
569
596
|
async execute(args) {
|
|
570
597
|
const bin = resolveBinary();
|
|
571
598
|
if (!bin) {
|
|
572
|
-
throw new Error(
|
|
599
|
+
throw new Error(INSTALL_HINT);
|
|
573
600
|
}
|
|
574
601
|
if (!ctx.llm) {
|
|
575
602
|
throw new Error('dsh LLM service (ctx.llm) is unavailable in this profile; cannot run vision understanding.');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-screen-automation",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "DeepSeek Harness (dsh) plugin that bridges the local 'Screen Automation Helper' desktop platform (Windows/macOS) into the Agent tool system. Exposes status, capabilities, workflow list/run/stop, run management, screen capture, local recognition primitives, input control, workflow lifecycle, task sessions and VLM understanding as dsh tools that shell out to the helper's CLI (JSON interface).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|