fix: keep custom tool environments selectable

The custom Node.js and Python choices could appear unavailable until a candidate was already discovered, and selecting the source implicitly adopted the first candidate. The chooser now stays operable, waits for an explicit validated path, keeps cancellation quiet, and shows validation errors beside the affected runtime.

Candidate discovery now prioritizes active virtual environments and Conda before bounded user/system PATH and common Node/Python locations, while preserving canonical validation and deduplication.

Release note: 修复自定义 Node.js/Python 环境入口不可用的问题,并增加对 PATH、venv、Conda 和常见安装位置的解释器检测。
This commit is contained in:
mesalogo
2026-09-02 16:29:55 +08:00
parent be39665ca9
commit 4d9ab72778
12 changed files with 530 additions and 129 deletions
@@ -146,6 +146,14 @@ MCP 面板
不显示“自动选择”“系统安装”“指定路径”三个交叉选项。自定义环境选中后,在同一区域展示
检测候选下拉框和“选择其他可执行文件”次操作。
“自定义环境”单选项始终可操作。尚无候选或已保存路径时,点击只展开选择区域并保持当前
实际来源,不把入口禁用,也不自动选择第一个候选。选择区域显示“刷新候选”和“选择其他
可执行文件”;只有用户明确选择且 Main 验证成功后才保存并切换来源。
文件选择取消不显示错误、不发送成功通知且保持选择区域展开。验证失败在对应 Node/Python
卡片的路径操作附近显示,保留原来源和原路径;不得只在页面顶部显示错误。刷新后出现候选
时通过正常列表更新呈现,不改变当前来源,焦点保持在触发操作或用户随后选择的候选上。
候选项格式:
```text
@@ -260,7 +268,8 @@ SKILL/MCP 的能力详情展示能力依赖状态:
- 安装、测试、更新、删除和文件选择使用语义按钮。
- 下载进度使用可命名的 `progressbar`。
- 状态不只依赖颜色,必须包含文字。
- 禁用控件仍提供可理解的邻近说明。
- 尚无自定义候选时不得禁用“自定义环境”入口;真正因活动操作禁用的控件仍提供可理解的
邻近说明。
- 切换到自定义环境后,焦点按正常 Tab 顺序进入候选选择框。
- 对话框关闭后焦点回到触发操作。
- 窄屏时卡片操作换行,不压缩版本和路径到不可读宽度。