mirror of
https://gitcode.com/JianFeeeee/HomeAgent.git
synced 2026-10-15 12:15:16 +00:00
feat(gui+waiter): computeruse 补高级操作、修 HiDPI 坐标;记录 PiDeck 借鉴
## computeruse 高级操作 此前两端(GUI 本机桥 / waiter 设备侧)都只有 9 个基础 action (click/move/scroll/keypress/type…),与业界 computer-use 的基本盘差距明显。 现补到 18 个,两端对齐: drag 拖拽(分步移动,见下) hover 只悬停不点击(触发 tooltip / 悬浮菜单) mousedown/up 按下与释放分离,可配对做「按住」 tripleclick 三击选中整行 middleclick 中键 hotkey/combo 组合键(ctrl+c 这类) wait/sleep 显式等待,等 UI/动画完成再下一步 display 显示器几何(bounds + scaleFactor + primary),多屏定位必需 ★ 拖拽**分步移动**(默认 12 步,上限 60)而不是一步到位:canvas 拖拽、 列表排序、滑动条这类应用依赖中间 mousemove 事件,一步到位会失效。 ## 修 HiDPI 坐标错位(GUI 侧) 截图给模型的是**物理像素**,而 SetCursorPos / xdotool / cliclick 期望 **逻辑点(DIP)**。旧代码只加了 display bounds 的原点偏移,完全没换算 scaleFactor ⇒ 150% 缩放屏上点击系统性偏移(越靠右下偏得越多)。 现在按目标屏 scaleFactor 换算,并提供 `physical:false` 让调用方声明 「坐标已是逻辑点」以免二次换算。 ## 组合键归一化(waiter 侧) 旧实现把模型给的 key 字符串原样丢给 `xdotool key`,于是 "Ctrl+C"、 "ctrl + c"、"CTRL-C" 全部失效。新增 normKeySpec:统一 + 与空格分隔、 统一小写、去重复修饰键。 顺带修 waiter 的 `type`:加 `--clearmodifiers`,避免残留的 Ctrl/Alt 把后续输入变成快捷键(旧实现一次输入就可能污染后续所有按键)。 ## scroll 修正(两端) 旧实现固定滚 `click 4/5`(上/下),忽略方向语义也不支持横向。 现按 dy 正负给方向、按量级分步、支持 dx 横向滚动。 ## 显式声明借鉴 PiDeck 用户要求声明 GUI 借鉴了 PiDeck 的设计与实现。做法: 1. 新增 `cmd/gui/DESIGN-NOTES.md` —— 逐项列出借鉴自 PiDeck 的设计 (三点渐次明暗 / 运行态呼吸光晕 / 工具调用分组卡)、PiDeck 的原始 实现(@keyframes 名与 CSS 片段)、HomeAgent 的落地位置、以及**动机**, 并明确区分「本仓自行决策」的部分(如「只有 1 个工具时不分组」是本地决定, 不是 PiDeck 做法)。 2. app.js / style.css 的相关代码处补出处注释。 3. 判据 computeruse.test.mjs 钉住这几条声明,防止后续丢失。 参考方式为阅读 PiDeck 打包产物 app.asar 中的 CSS 实现后**独立重写**, 未复制其代码或资源文件。 ## 判据 新增 cmd/gui/computeruse.test.mjs(进 npm test),30 条断言: · 两端各 9 项高级操作 · HiDPI 换算与 physical 开关 · 组合键归一化、type 的 --clearmodifiers · 拖拽分步移动(两端) · PiDeck 借鉴声明四处(含 DESIGN-NOTES.md 存在) 判据:cmd/gui npm test 全绿(114 条)。
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
"scripts": {
|
||||
"start": "electron . --no-sandbox",
|
||||
"dev": "electron . --no-sandbox --dev",
|
||||
"test": "node sse-backoff.test.mjs && node sse-backoff-behavior.test.mjs && node retry-guard.test.mjs && node endpoint-align.test.mjs && node connections-io.test.mjs && node silent-start.test.mjs && node package-config.test.mjs && node loading-notify.test.mjs",
|
||||
"test": "node sse-backoff.test.mjs && node sse-backoff-behavior.test.mjs && node retry-guard.test.mjs && node endpoint-align.test.mjs && node connections-io.test.mjs && node silent-start.test.mjs && node package-config.test.mjs && node loading-notify.test.mjs && node computeruse.test.mjs",
|
||||
"test-live": "node chat-perf.test.mjs && node protocol-align.test.mjs"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
Reference in New Issue
Block a user