zai-org / zai-org/feedback

Windows 端 computer-use(zcode-cua)MCP 显示「运行环境不可用」

Open
#405 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

priority: P2 status: 待评估 type: Bug
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

阻塞使用 · Blocking (无法使用核心功能 / core function unusable)

复现频率 · Reproducibility

必现 · Always

问题描述 · Description

Windows 端 computer-use(zcode-cua)MCP 显示「运行环境不可用」:broker_unavailable: Windows Computer Use Helper exited before ready (1)。根因是打包缺陷:resources/tools/cua-helper/ 缺少 package.json,其 dist/windows-helper.js 为 ESM 产物,被 ELECTRON_RUN_AS_NODE 模式的 Node 按 CommonJS 解析,启动即 SyntaxError: Cannot use import statement outside a module、退出码 1。3.9.1 / 3.9.2 / 3.10.1 三个版本均复现,且每次版本更新会删除用户手动补的修复文件。

复现步骤 · Steps to reproduce
  1. Windows 11 上安装/更新 ZCode 桌面版(任一:3.9.1.5853 / 3.9.2.6069 / 3.10.1.6272),确认 CUA 灰度开启
  2. 启动后查看 设置 → MCP:computer-use 显示「MCP 运行环境不可用」,错误 broker_unavailable: Windows Computer Use Helper exited before ready (1);首轮失败后同会话内变为 recovered Helper credentials are waiting for persistent-agent recycle
  3. 查看日志 ~/.zcode/v2/logs/[cua-product-helper] ... lifecycle failure {"errorClass":"early-exit"}cua helper warmup failed: Windows Computer Use Helper exited before ready (1)
  4. 手动复现:cd resources\tools\cua-helper,设 ELECTRON_RUN_AS_NODE=1,运行 ZCode.exe dist\windows-helper.js --socket \\.\pipe\t --parent-pid <pid> → 立即 SyntaxError
期望表现 · Expected behavior

cua-helper 打包目录附带 package.json(含 "type": "module")或入口改用 .mjs 扩展名,Helper 正常启动并上报 ready,computer-use MCP 恢复已连接。

实际表现 · Actual behavior

Helper 以退出码 1 秒退(ESM 被 CJS 解析失败),broker 被标记不可用,computer-use 完全无法使用。手动补 {"type":"module"} 的 package.json 后实测 Helper 即正常(IPC 上报 ready、创建 \\.\pipe\zcode-cua-helper-* 管道、MCP 已连接),但每次 ZCode 更新该文件都被删除、问题复发。

ZCode 版本 · ZCode version

3.10.1.6272(3.9.1–3.10.1 均复现;cua-helper 0.5.10/0.5.12/0.5.13)

设备 / 系统 / 浏览器 · Device / OS / Browser

Windows 11 25H2(OS 26200)· ZCode 桌面版

截图 / 录屏 / 日志 · Screenshots / Recordings / Logs

[cua-product-helper] Windows Computer Use Helper lifecycle failure
{"generation":1,"pid":...,"errorClass":"early-exit","error":"Error"}
[cua-product-helper] cua helper warmup failed: Windows Computer Use Helper exited before ready (1)
[cua-product-helper] Computer Use Helper broker_unavailable; disabling workspace
zcode-cua MCP server for this agent spawn (...)

手动复现输出:

Warning: Failed to load the ES module: ...\cua-helper\dist\windows-helper.js.
Make sure to set "type": "module" in the nearest package.json file or use the .mjs extension.
SyntaxError: Cannot use import statement outside a module

补充:本 issue 与 #364(Intel Mac 无法开启电脑控制)、#380(坐标点击被拒)不同——这里是 Helper 进程完全无法启动。

<!-- Failed to upload "zcode-cua-helper-bug-report.md" -->

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in resources/tools/cua-helper and inspect dist/windows-helper.js, then reproduce the launch with ELECTRON_RUN_AS_NODE=1 using the command in the issue. Verify the packaged Helper starts on Windows, reports ready, creates its named pipe, and keeps the computer-use MCP connected across an update.

Written by the indexing model from the issue text.

Assessment

Tech stack
electron, javascript, node.js
Domain
build-system, desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.