[Bug] Windows 3.10.1: computer-use 元素点击 raw 回退必失败——ax_native.node 未导出 activateWindow,window-scoped raw input 一律 notAuthorized
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 22
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
提交前确认 · Pre-submission checklist
- 我已搜索过现有 issue,确认这不是重复 / I searched existing issues and confirmed this isn't a duplicate.
- 我已阅读 CONTRIBUTING.md / I've read CONTRIBUTING.md.
问题类别 · Category
工具调用 / MCP · Tool use / MCP
涉及的 Agent 框架 · Agent framework
ZCode Agent(自研)
严重程度 · Severity
影响体验 · Major(功能可用但体验受损 / works but degraded)
复现频率 · Reproducibility
必现 · Always
问题描述 · Description
Windows 上,computer-use 插件所有走 raw 回退的指针动作必然失败,报错:
click: window-scoped raw input requires native activateWindow support. action_sent=false.
根因:native 插件 ax_native.node 的 Windows 构建没有实现/导出 activateWindow,而 JS 层在每次窗口绑定的 raw 派发前都强制要求它(见下方根因定位),导致该路径在 Windows 上是必现死路。对自绘 UI 应用(如微信 3.x 的 Duilib 界面——UIA Invoke 被接受但界面无响应)来说,raw 鼠标事件是唯一可靠的点击通道,因此这类应用在官方插件下无法完成点击。
与本仓库 #380(帧绑定坐标点击被 frame_dispatch_identity_mismatch 拒绝)互补:两者叠加后,Windows 上 raw 指针输入整体不可达,仅剩「UIA 元素 AXPress + 应用级键盘」可用。
复现步骤 · Steps to reproduce
- 启动微信 3.9.12.51(Duilib 自绘 UI;任何自绘应用均可),
open_application拉起。 get_app_state(app_ref={pid})返回元素树(微信主窗约 188 个元素,含搜索框textfield)。- 紧接
open_application(activate=true)返回active:true(窗口已在前台)后,对该textfield元素目标执行left_click。 - 返回
action_sent=false错误;重复执行均复现(本轮测试连做 2 次,激活前后各 1 次)。
期望表现 · Expected behavior
raw 回退应先激活目标窗口再派发点击(OS 能力已具备:activateApplication 正常工作,open_application(activate=true) 实测返回 active:true),或 adapter 在 Windows 上提供可用的 activateWindow,使 activateConcreteWindow 校验通过、点击送达。
实际表现 · Actual behavior
无条件抛 notAuthorized(action_sent=false):激活前、激活后、元素在前台窗口上,均 100% 复现。
根因定位(证据链)
-
报错点:
C:\Program Files\ZCode\resources\tools\cua-helper\dist\windows-helper.js的activateConcreteWindow:if (typeof adapter.activateWindow !== "function") { throw notAuthorized(`${method}: window-scoped raw input requires native activateWindow support. action_sent=false.`); } -
adapter 装配:
const activateWindow = wrapOptionalNativeMethod(native.activateWindow)——native 导出缺失时该包装得到undefined,typeof校验必失败。 -
二进制证据:对
cua-helper\build\Release\ax_native.node(387,480 字节;runtime-manifest.json 记录 sha256e56848…)做字符串扫描:activateWindow0 次命中(Windows 构建从未注册该导出);同文件activateApplication、preventActivation、SetForegroundWindow均存在。 -
旁证:
activateApplication路径正常(open_application(activate=true)成功置前台),说明 OS 层前台激活能力可用且 addon 已绑定SetForegroundWindow,缺的只是activateWindow这一个导出。 -
调用面:
activateConcreteWindow共 6 个调用点,覆盖 click / move_to / scroll / drag / mouse_down 全部窗口绑定的 raw 指针动作(坐标 + event 路径因 #380 的帧校验更早拦截,同样到不了 raw 派发)。
修复方向建议:Windows 构建导出 activateWindow(SetForegroundWindow + 前台校验可复用 activateApplication 的现成实现);或在 JS 层为 adapter 提供基于 activateApplication 的 fallback。
影响
自绘 / 画布类应用(微信 3.x、部分 QQ 界面、画图画布等)在 Windows 上无法被官方插件点击——观察、激活、键盘、截图均正常,唯独指针点击死路;Agent 只能绕行第三方自动化通道。插件内无用户侧规避(按设计 fail-closed)。
ZCode 版本 · ZCode version
3.10.1(desktop;computer-use 插件 0.5.13 / zcode-cua 0.5.13,cua-helper runtime-manifest packageVersion 0.5.13)
设备 / 系统 / 浏览器 · Device / OS / Browser
Windows 11 Pro build 26200 x64,单显示器 2560x1440;不涉及浏览器
截图 / 录屏 / 日志 · Screenshots / Recordings / Logs
错误回执(原文,两次):
click: window-scoped raw input requires native activateWindow support. action_sent=false.
二进制扫描结果(ax_native.node):
activateWindow 0 hits
activateApplication 2 hits
preventActivation 1 hit
SetForegroundWindow 1 hit
— GLM-5.3 in ZCode
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with dist/windows-helper.js and the activateConcreteWindow entry point, then inspect the Windows ax_native.node adapter and its existing activateApplication path. Done means window-scoped raw click, move, scroll, drag, and mouse actions can activate the target window and no longer return the reported notAuthorized error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- desktop, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100