dsh-native-uia 0.6.2 → 0.6.3
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 +8 -5
- package/client/client.js +6 -8
- package/market/icon.svg +11 -0
- package/market/index.json +98 -0
- package/package.json +2 -1
- package/scripts/check-lease.mjs +4 -4
- package/scripts/install.mjs +2 -2
- package/scripts/lib/sources.mjs +1 -1
- package/scripts/regression-halt-latch.mjs +1 -1
- package/scripts/regression-worker.ps1 +1074 -1071
- package/scripts/verify-locator.mjs +4 -4
- package/scripts/verify.mjs +30 -4
- package/src/tools/defs/act.js +6 -7
- package/src/tools/defs/observe.js +5 -5
- package/src/tools/format.js +10 -10
- package/src/tools/ocr.js +2 -3
- package/src/tools/recipes.js +3 -4
- package/src/worker-client.js +9 -10
- package/worker/bin/build-ocr.ps1 +41 -41
- package/worker/indicator-server.ps1 +5 -5
- package/worker/lib/02-uia.ps1 +13 -16
- package/worker/lib/03-window.ps1 +7 -7
- package/worker/lib/04-match.ps1 +11 -12
- package/worker/lib/05-value.ps1 +9 -9
- package/worker/lib/06-snapshot.ps1 +2 -2
- package/worker/lib/07-action.ps1 +3 -3
- package/worker/lib/08-command.ps1 +24 -28
- package/worker/lib/09-pointer.ps1 +2 -2
- package/worker/ps-stdio.ps1 +173 -173
- package/worker/uia-worker.ps1 +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 御屏 · dsh-native-uia
|
|
2
2
|
|
|
3
|
-
给 DeepSeek Harness(DSH)桌面端加 **Windows 原生 computer-use**:以 UI Automation 控件树为主观测通道,纯文本模型就能看懂并操控桌面;动作后台投递(默认不动鼠标、不抢焦点),一次调用批量执行、逐步校验,成功的批次自动存成可回放配方。当前版本 **0.6.
|
|
3
|
+
给 DeepSeek Harness(DSH)桌面端加 **Windows 原生 computer-use**:以 UI Automation 控件树为主观测通道,纯文本模型就能看懂并操控桌面;动作后台投递(默认不动鼠标、不抢焦点),一次调用批量执行、逐步校验,成功的批次自动存成可回放配方。当前版本 **0.6.3**。
|
|
4
4
|
|
|
5
5
|
- 运行要求:Windows 10/11(UI Automation 客户端走 .NET Framework,由 PowerShell 5.1 承载),DSH 桌面端,Node ≥ 18。
|
|
6
6
|
- 组成:`src/`(DSH 插件主进程:工具定义、策略、状态、面板服务)、`worker/`(两个 PowerShell 进程:`uia-worker.ps1` 观察与投递,`indicator-server.ps1` 屏幕指示层)、`client/`(面板)、`scripts/`(闸门与回归)。
|
|
@@ -62,7 +62,7 @@ ref 属于一个窗口的一次 revision:**整窗**新快照使旧 ref 失效
|
|
|
62
62
|
|
|
63
63
|
## 4. 指示层
|
|
64
64
|
|
|
65
|
-
屏幕顶部居中一颗 **172×44 DIP** 的胶囊(黑壳 / 石墨银两种氛围光,深黑 / 声波 / 标块 /
|
|
65
|
+
屏幕顶部居中一颗 **172×44 DIP** 的胶囊(黑壳 / 石墨银两种氛围光,深黑 / 声波 / 标块 / 反白四种样式)。可见状态两种:`acting`(银白呼吸)常驻,`stopped`(暖红)短暂显示(默认 1.2 s)后自动收起;`hidden` 整层收起。壳上画银色 DSH 鲸鱼,尾鳍 20° 蒙皮摆尾;壳底缘内侧一层薄雾(fBm 密度场两层,可在面板关掉);**一整圈**边缘光随阶段呼吸(单张按"到最近屏幕边的距离"烘焙的距离场贴图,四边亮度一致、四角不再叠加,换阶段只重烤这张图);`act` 阶段指针跟一圈光晕。
|
|
66
66
|
|
|
67
67
|
指示层是独立进程,坏掉只降级为日志,不影响桌面动作。呼吸由 **33 ms 的 `DispatcherTimer`** 驱动,且 `Tick-Pulse` 对不足 33 ms 的重复 tick 直接丢弃——所以**视觉更新上限约 30 Hz**(这是代码里唯一的确定数)。真实合成帧率由分层透明窗和 GPU 决定,代码不承诺、也不统计;诊断时开 `DSH_INDICATOR_RENDER_HOOK=1` 会把 WPF 的 `CompositionTarget.Rendering` 一并接上(实测能把 2560×1600 分层表面顶到 ~55 Hz 合成),`framesRendered` 仍然只数"推过更新的 tick"。
|
|
68
68
|
|
|
@@ -81,23 +81,25 @@ npm run uninstall-plugin
|
|
|
81
81
|
|
|
82
82
|
本机服务:`http://127.0.0.1:3099`(`/api/state` 全量状态、`/api/summary` 摘要轮询、POST `/api/action` 的 worker / mode / theme / style / mist / kill),只答 JSON。
|
|
83
83
|
|
|
84
|
+
**DSH 插件市场。** 本包内含一份格式 1 的插件索引(`market/index.json` + `market/icon.svg`),发布后即可作为 DSH 的索引源:插件 → 实验性插件 → 打开「自定义插件索引」→ 发现 → 添加索引源,填 `https://cdn.jsdelivr.net/npm/dsh-native-uia@0.6.3/market/index.json`(国内镜像:`https://registry.npmmirror.com/dsh-native-uia/0.6.3/files/market/index.json`)。索引列出 0.6.0–0.6.3,安装走 npm。
|
|
85
|
+
|
|
84
86
|
## 6. 验证与打包
|
|
85
87
|
|
|
86
88
|
```powershell
|
|
87
|
-
npm run check # 静态闸门
|
|
89
|
+
npm run check # 静态闸门 93 项:解析、策略、契约、外观不变量、工具与 worker 能力对齐
|
|
88
90
|
node scripts/check-lease.mjs # 租约 / 空闲自熄 / Esc 停止(不起桌面)
|
|
89
91
|
node scripts/smoke.mjs # worker 启停与 ping
|
|
90
92
|
powershell -NoProfile -ExecutionPolicy Bypass -File scripts/regression-worker.ps1 # 定位阶梯(mock 树)
|
|
91
93
|
node scripts/regression-tools.mjs # 工具面回归
|
|
92
94
|
node scripts/regression-quality.mjs # 渲染质量
|
|
93
|
-
npm pack # → dsh-native-uia-0.6.
|
|
95
|
+
npm pack # → dsh-native-uia-0.6.3.tgz
|
|
94
96
|
```
|
|
95
97
|
|
|
96
98
|
真机脚本(会动桌面):`verify-live.mjs`、`verify-live-clipboard.mjs`、`verify-live-style.mjs`、`bench-live.mjs`、`verify-locator.mjs`、`verify-capture-scale.mjs`。
|
|
97
99
|
|
|
98
100
|
## 7. 已知边界
|
|
99
101
|
|
|
100
|
-
- 指示层视觉更新上限约 30 Hz(33 ms 定时器 + 同 tick
|
|
102
|
+
- 指示层视觉更新上限约 30 Hz(33 ms 定时器 + 同 tick 丢弃);真实合成帧率取决于分层透明窗与机器,代码不承诺。`DSH_INDICATOR_RENDER_HOOK=1` 只用于诊断,会把 WPF 的合成回调接上,不能当成帧率承诺。
|
|
101
103
|
- 批次步骤默认只能是 UIA 动词;要混指针/键盘步必须 `lazy:true`(这类批次不存配方)。
|
|
102
104
|
- `set_range` 只对真的暴露 RangeValue 的元素生效(滑块、数值调节器);普通文本框用它回 `pattern_unsupported`,该用 `set_value`。`scroll_to` 同理需要 ScrollItem。桌面多数窗口只有 Pane 带 ScrollItem,列表项要不要带取决于 provider。
|
|
103
105
|
- 节点树:虚拟化列表只扫已物化节点;`view:"raw"` 能吐出 ControlView 藏起来的节点,但同一棵树上 raw 的节点数可能是 control 的几倍,预算仍由 `maxNodes` 卡住;桥接 provider(部分 MSAA/Win32 老程序)连实时读都不给状态时,该节点就没有 state。
|
|
@@ -106,6 +108,7 @@ npm pack # → dsh-native-uia-0.6.2.tgz
|
|
|
106
108
|
|
|
107
109
|
## 8. 变更记录(压缩版,细节见 git)
|
|
108
110
|
|
|
111
|
+
- **0.6.3** 整理与上架。清掉全部“旧实现”式注释(worker 库、`src/`、`client/`、校验脚本),代码只描述当前约束;README 按代码复核(`stopped` 只是短暂显示,不是常驻);新增 `market/index.json`(格式 1)与图标,npm 包内含索引,把 jsDelivr / npmmirror 上的索引地址加进 DSH 即可在「发现」里安装。闸门 92 → 93。
|
|
109
112
|
- **0.6.2** 修“停止后再启动,氛围灯还是红的”。`Hide-Overlay` 只把 phase 改成 `hidden`,不重烤边缘光;`Render-Layout` 又按布局键复用整棵树,所以下一次 `show`(phase=acting)只换了胶囊文字,环形贴图仍是上一次 `stopped` 的红。现在记录环形贴图烘焙时的相位(`ringPhase`),`Show-Overlay` 在 `win.Show()` 之前发现相位与贴图不一致就重烤,启动那一帧不会闪旧色。闸门 91 → 92。
|
|
110
113
|
- **0.6.1** 边缘光改成一整圈。原来四条 `E = 4×环厚` 的渐变带各自铺满整条边,四个角互相重叠、alpha 相加,读出来就是"四条叠着、角上更亮"。现在用 `IndRing` 在 C# 里按**到最近屏幕边的距离**烘焙一张距离场贴图(≤1280 px 宽,上采样由 WPF 做),整屏一个 `Image`,四边亮度一致、四角连续;换阶段只重烤这张图,脉冲照旧只写它一个 `Opacity`。删掉 `New-Bar` / `New-GradH` / `New-Fade` / `New-Vignette` 四个只服务旧四条带的函数。闸门 90 → 91。
|
|
111
114
|
- **0.6.0** 动作面收口。`computer_act` 新增 `deselect` / `add_to_selection`(多选列表叠加,select 会清空别的选择)、`scroll_to`(ScrollItem.ScrollIntoView)、`set_range`(RangeValue.SetValue,按 Min/Max 夹取);`$patternTypes` 补 `ScrollItem`,能拿到对象才算真的能滚动到可见。`click / drag / scroll / mouse` 收 `ref`,中心坐标由 `describe` 现算。`computer_run` 的 `lazy:true` 支持同批混指针与键盘步(共用策略检查、遇错即停、不存配方),非 lazy 批次明确拒绝混步。真机:`scroll_to` 在资源管理器 Pane 上 applied=true / 21.7 ms。闸门 88 → 90。
|
package/client/client.js
CHANGED
|
@@ -147,17 +147,15 @@ window.__ModuleLoader__.load({
|
|
|
147
147
|
const activeTheme = themes.find((t) => t.id === themeId) ?? null;
|
|
148
148
|
// No stop control here: stopping belongs to Esc, which is watched by the always-idle overlay
|
|
149
149
|
// on a 40 ms poll with an edge latch, so it lands even while a long OCR or batch is running.
|
|
150
|
-
// A button that can only work between commands is the weaker of the two
|
|
151
|
-
// piece of run-watching on a page that exists to change settings.
|
|
150
|
+
// A button that can only work between commands is the weaker of the two.
|
|
152
151
|
/**
|
|
153
152
|
* One write path for all three settings.
|
|
154
153
|
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
* so two rows cannot both look pending from one click.
|
|
154
|
+
* Fire-and-forget would move the control only on the next poll -- up to 1.5 s later, with no
|
|
155
|
+
* feedback in between: the click lands, nothing changes, then the highlight jumps. The field
|
|
156
|
+
* is therefore written locally first (the control moves on the click), the in-flight control
|
|
157
|
+
* shows a pending state, and a failure puts the previous value back with the reason attached.
|
|
158
|
+
* `busy` is the field being written, so two rows cannot both look pending from one click.
|
|
161
159
|
*/
|
|
162
160
|
const [pending, setPending] = react.useState(null);
|
|
163
161
|
const [failed, setFailed] = react.useState('');
|
package/market/icon.svg
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36" width="36" height="36" fill="none" role="img" aria-label="御屏">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="yupingAccent" x1="17.5" y1="13" x2="25" y2="25" gradientUnits="userSpaceOnUse">
|
|
4
|
+
<stop stop-color="#54ECE7"/>
|
|
5
|
+
<stop offset="1" stop-color="#658EFF"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
</defs>
|
|
8
|
+
|
|
9
|
+
<path d="M7 12.5C7 10 9.6 8 12.1 8H23.9C26.4 8 29 10 29 12.5V23.5C29 26 26.4 28 23.9 28H17.8" stroke="#679EFE" stroke-width="3.5" stroke-linecap="round"/>
|
|
10
|
+
<path d="M17.5 13.5L26 17.3L22.4 18.3L21.5 22.1L17.5 13.5Z" fill="url(#yupingAccent)"/>
|
|
11
|
+
</svg>
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": 1,
|
|
3
|
+
"title": {
|
|
4
|
+
"en": "御屏 Native UIA",
|
|
5
|
+
"zh": "御屏 Native UIA"
|
|
6
|
+
},
|
|
7
|
+
"description": {
|
|
8
|
+
"en": "Windows UI Automation computer-use for DeepSeek Harness.",
|
|
9
|
+
"zh": "给 DeepSeek Harness 的 Windows 原生 computer-use 插件。"
|
|
10
|
+
},
|
|
11
|
+
"metadata": {
|
|
12
|
+
"categories": {
|
|
13
|
+
"automation": {
|
|
14
|
+
"title": {
|
|
15
|
+
"en": "Automation",
|
|
16
|
+
"zh": "自动化"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"labels": {
|
|
21
|
+
"windows": {
|
|
22
|
+
"title": {
|
|
23
|
+
"en": "Windows",
|
|
24
|
+
"zh": "Windows"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"uia": {
|
|
28
|
+
"title": {
|
|
29
|
+
"en": "UI Automation",
|
|
30
|
+
"zh": "UI Automation"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"computer-use": {
|
|
34
|
+
"title": {
|
|
35
|
+
"en": "Computer Use",
|
|
36
|
+
"zh": "电脑操控"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"plugins": [
|
|
42
|
+
{
|
|
43
|
+
"name": "dsh-native-uia",
|
|
44
|
+
"title": {
|
|
45
|
+
"en": "Native UIA",
|
|
46
|
+
"zh": "御屏"
|
|
47
|
+
},
|
|
48
|
+
"description": {
|
|
49
|
+
"en": "Reads the Windows UI Automation tree instead of pixels: text-only models can inspect controls, act in the background without moving the mouse, verify each batch, and replay successful runs as recipes.",
|
|
50
|
+
"zh": "以 Windows UI Automation 控件树为主观测通道:纯文本模型即可看懂并操控桌面,动作后台投递、批量执行并逐步校验,成功批次自动存为可回放配方。"
|
|
51
|
+
},
|
|
52
|
+
"icon": "icon.svg",
|
|
53
|
+
"author": "xiaobaga281",
|
|
54
|
+
"homepage": "https://github.com/xiaobaga281/dsh-native-uia#readme",
|
|
55
|
+
"repository": {
|
|
56
|
+
"url": "https://github.com/xiaobaga281/dsh-native-uia"
|
|
57
|
+
},
|
|
58
|
+
"metadata": {
|
|
59
|
+
"category": "automation",
|
|
60
|
+
"labels": [
|
|
61
|
+
"windows",
|
|
62
|
+
"uia",
|
|
63
|
+
"computer-use"
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
"versions": [
|
|
67
|
+
{
|
|
68
|
+
"version": "0.6.3",
|
|
69
|
+
"publishTimestamp": 1796123127,
|
|
70
|
+
"source": {
|
|
71
|
+
"type": "npm"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"version": "0.6.2",
|
|
76
|
+
"publishTimestamp": 1796093517,
|
|
77
|
+
"source": {
|
|
78
|
+
"type": "npm"
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"version": "0.6.1",
|
|
83
|
+
"publishTimestamp": 1796093133,
|
|
84
|
+
"source": {
|
|
85
|
+
"type": "npm"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"version": "0.6.0",
|
|
90
|
+
"publishTimestamp": 1796076962,
|
|
91
|
+
"source": {
|
|
92
|
+
"type": "npm"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-native-uia",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.3",
|
|
4
4
|
"displayName": "御屏",
|
|
5
5
|
"description": "以 Windows UI Automation 控件树为主观测通道的桌面操控插件:纯文本模型即可操控桌面,后台投递动作(不动鼠标、不抢焦点),一次调用批量执行并逐步校验,成功批次自动存为可回放配方。",
|
|
6
6
|
"type": "module",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"src",
|
|
17
17
|
"worker",
|
|
18
18
|
"client",
|
|
19
|
+
"market",
|
|
19
20
|
"scripts",
|
|
20
21
|
"locale",
|
|
21
22
|
"icon.svg",
|
package/scripts/check-lease.mjs
CHANGED
|
@@ -107,7 +107,7 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
|
107
107
|
console.log('✅ 终止→「御屏 · 已停止」→ 下一次动作重新点亮胶囊(show + acting + 新 subtext)');
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
// --- 6: no third state exists (the
|
|
110
|
+
// --- 6: no third state exists (the product has only the states its switches can reach) ---------------------
|
|
111
111
|
{
|
|
112
112
|
const indicator = fakeIndicator();
|
|
113
113
|
const activity = new ActivityWindow({ indicator, leaseMs: 200, beatMs: 50 });
|
|
@@ -223,9 +223,9 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
|
223
223
|
}
|
|
224
224
|
|
|
225
225
|
// --- 10: the subtext carries batch progress (appName · last step label (N steps)) ----------------
|
|
226
|
-
// The pill's second line
|
|
227
|
-
// label and the stepsRun counter,
|
|
228
|
-
// screen
|
|
226
|
+
// The pill's second line carries batch progress, not just the target app name: store.step records
|
|
227
|
+
// every step's label and the stepsRun counter, and all of it has to reach the overlay or the person
|
|
228
|
+
// watching the screen cannot tell how far the batch has gotten. The composition lives in composeSubtext()
|
|
229
229
|
// (activity-window.js, beside the palette — index.js only wires store into it via resolveLabel)
|
|
230
230
|
// and the result must reach the overlay through EVERY send site: claim's show, a claim on a live
|
|
231
231
|
// window (beat), observe's beat, the heartbeat beat, the stale-phase repaint, and the
|
package/scripts/install.mjs
CHANGED
|
@@ -111,8 +111,8 @@ if (mode === 'install') {
|
|
|
111
111
|
added.push(`${pkg.name} (dependency)`);
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
// The panel
|
|
115
|
-
// entry) is stale
|
|
114
|
+
// The panel ships inside this package, so a dependency on its former package (and any stray
|
|
115
|
+
// bundle entry) is stale.
|
|
116
116
|
const stale = 'dsh-native-uia-ui';
|
|
117
117
|
if (json.dependencies[stale] !== undefined) {
|
|
118
118
|
delete json.dependencies[stale];
|
package/scripts/lib/sources.mjs
CHANGED
|
@@ -8,7 +8,7 @@ const root = dirname(dirname(dirname(fileURLToPath(import.meta.url))));
|
|
|
8
8
|
* The browser half, the Host half and the gates all have to agree on ONE list order: the tool
|
|
9
9
|
* sources are concatenated in this order for the harness (which strips imports and evaluates the
|
|
10
10
|
* body), and the gates read the same concatenation so a rule can never be checked against a file
|
|
11
|
-
* the runtime
|
|
11
|
+
* the runtime does not load.
|
|
12
12
|
*/
|
|
13
13
|
export const TOOLS_FILES = [
|
|
14
14
|
'src/tools/runtime.js',
|
|
@@ -32,7 +32,7 @@ function test(name, fn) {
|
|
|
32
32
|
test('the latch window and the halt callback are present in the shipped source', () => {
|
|
33
33
|
assert.ok(Number.isFinite(latchMs) && latchMs > 0, 'HALT_LATCH_MS is missing or not a number');
|
|
34
34
|
assert.ok(typeof haltBody === 'string' && haltBody.length > 0, 'the halt callback was not found in index.js');
|
|
35
|
-
assert.match(haltBody, /killedAt/, 'the halt callback
|
|
35
|
+
assert.match(haltBody, /killedAt/, 'the halt callback ignores when the latch was armed');
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
// Build a store shaped like src/state.js and run the production halt body against it.
|