Repository navigation
Conversation
Linux 下 traeDataDir() 与 tcDecrypt 本已工作(storage.json 的 iCubeAuthInfo://icube.cloudide 可正常解出凭据),但 detectTrae() 的 clientInstalled/clientPath/running 三个字段硬编码 win32-only,导致 /api/status 的 traeClient 判定为未安装、面板不给本机导入入口。 - clientPathOf(): 新增 darwin(/Applications/<name>.app)与 linux (PATH 常见目录 kebab-case bin + .desktop Name 匹配解析 Exec 兜底) - traeRunning()/traeRunningCached(): unix 走 unixTraePids() (Linux 读 /proc/<pid>/exe,macOS pgrep -x),不再恒 false - terminateTrae(): unix SIGTERM→轮询→SIGKILL,nap 在非 win32 用 sleep 子进程替代 Atomics.wait - deviceId 口径不变:Linux 客户端 storage.json 只落 aha-<hash> 无 纯数字 icube-dc 条目,维持 null 由上层降级提示(实测本机验证) 验证(Ubuntu 26.04 + Trae CN 2.3.92182 deb): detectTrae 修复前 clientInstalled:false/signedIn:true 矛盾态 → 修复后 clientPath=/usr/share/trae-cn/trae-cn、clientInstalled:true; 伪装 /proc exe 名实测 running true→terminate closed true→false 全链 无新依赖,win32 行为零改动。
Owner
|
已审阅并合并到 main(合并提交 0e6477e),随下一版本发出。 审查结论:改动质量高——
合并说明:你的分支基于 v1.7.2 tag 提交(97dc460),不含今天的 4 笔 UI 提交——合并时已核对,只取 src/traeLocal.js 的真改动,其余文件的基点差异未混入。建议以后从最新 main 拉分支,可以省去这类核对。 本地全量测试 442/442 通过。 |
Owner
|
已合并到 main(0e6477e),关闭本 PR。感谢高质量的贡献——根因定位、分层探测设计、边界如实说明都是范本级的。 |
techysy
added a commit
that referenced
this pull request
Nov 11, 2026
[Fix] Trae 本机凭据探测补齐 Linux/macOS:Ubuntu 下能解密却被判「客户端未安装」,无法导入 (合并时仅取 src/traeLocal.js——PR 分支基于 v1.7.2 tag 提交、不含今天 4 笔 UI 提交, 自动合并已正确以 main 为准;其余文件的差异为基点噪音,已核对未混入)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题场景(Ubuntu 实测)
我在 Ubuntu 24.04.1 LTS 桌面装 Trae CN(deb 官方包),CD 面板提示「本机未安装 Trae 客户端」,无法走本机导入 —— 但凭据其实是完整可解的。
根因
traeLocal.js的平台分支只补了一半:traeDataDir()/tcDecrypt()的 Linux 路径本来就是通的(实测~/.config/Trae CN/User/globalStorage/storage.json的iCubeAuthInfo://icube.cloudide信封可正常解出 uid/token,信封头tc与 Windows 一致);detectTrae()暴露给/api/status的三个字段硬编码 win32-only:clientPathOf()→ 非 win32 恒null→clientInstalled=false、cnInstalled/intlInstalled=false(面板判定未安装,导入入口不给开)traeRunning()/traeRunningCached()→ 依赖tasklist.exe/winProc,非 win32 恒false结果出现自相矛盾的探测态:
signedIn: true+clientInstalled: false—— 这正是「扫不出登录凭证」的直接原因。改动(src/traeLocal.js,+100 -8,零新依赖,win32 行为不变)
clientPathOf()新增 darwin(/Applications/<name>.app,含用户级)与 linux(PATH 常见目录 kebab-case bin,如trae-cn/trae;查不到再按.desktop的Name=匹配变体名解析Exec=兜底,适配 deb 装到/usr/share/trae-cn/的场景)unixTraePids():Linux 读/proc/<pid>/exe、macOSpgrep -x;traeRunning()与traeRunningCached()的 unix 分支改走它(/proc 读取足够轻,可承受 status 轮询)terminateTrae()补 unix 信号路径(SIGTERM → 轮询 → SIGKILL),nap()非 win32 用sleep子进程替代Atomics.wait本机验证(Ubuntu 24.04.1 LTS + Trae CN 2.3.92182)
已知边界(如实说明)
deviceIdOf()维持不动:Linux 客户端 storage.json 只有icube-dc:aha-<hash>没有 16 位纯数字条目(实测本机 + state.vscdb/ahanet 全扫),签到用的 x-device-id 在 Linux 侧仍拿不到 —— 属客户端平台差异而非 CD 缺陷,故liveToAccount()返回meta.deviceId: undefined由上层降级。如果这会影响签到口径,需要另开 issue 讨论 Linux 的设备号来源。