Repository navigation
[Bug] 桌面端启动即崩:profile manifest 的 UTF-8 BOM 未被容忍;dsh plugin add 中断后无法自愈 #10159
xinyuli815
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
环境
@deepseek-ai/dsh-desktop0.2.1-rc.2pwsh7 未安装)dsh-dafeiyu@0.1.18后重启应用现象
安装插件后重启桌面端,应用无法启动,只留下一条崩溃日志:
锘?是 UTF-8 BOM(EF BB BF)被按 GBK 渲染的产物。日志里能直接看到原始字节:Unexpected token '<EF BB BF>', "<EF BB BF>{\r\n。最小复现
A. BOM 导致启动失败(可 100% 复现)
<HOME>/.dsh/profiles/desktop/package.json文件开头插入 UTF-8 BOM(3 字节EF BB BF)。Windows 记事本、Visual Studio、PowerShell 5.1 的Set-Content -Encoding utf8都会这么做。B.
dsh plugin add中断后重试无法补齐dsh plugin --profile desktop add <某个声明了 dsh.bundle 的插件>package.json、但命令还没结束时 kill 进程。+ <pkg> <version>,退出码 0。package.json的dependencies有该插件,dsh.profile.bundles里始终没有它 —— 插件"装了但没启用",重试也不会修。根因
1.
readProfileManifest不容忍 BOM,且解析异常不带路径app.asar/dsh/node_modules/@deepseek-ai/dsh-app-boot/lib/index.js:905-916readFileSync(p, "utf8")不会去掉 BOM,JSON.parse('\uFEFF{...}')直接抛。loadProfileDirectory(:1015-1040)对每个 bundle 都有try/catch → skippedBundles降级,唯独清单本身没有降级路径。一个坏插件可以跳过,一个坏字节却让整个应用拒绝启动。2.
pwsh工具静默降级到 PowerShell 5.1,但仍按 pwsh 7 宣称app.asar/dsh/node_modules/@deepseek-ai/dsh-pwsh-local/lib/index.js:23-33而模型看到的工具描述(
dsh-tool-pwsh/lib/index.js:255-258)仍是"Execute a PowerShell command (
pwsh -Command) … fresh pwsh process",没有任何 5.1 提示。两者编码语义不兼容(实测):
Set-Content -Encoding utf8EF BB BFOut-File默认FF FEENCODING_PREAMBLE(同文件 :100、:204)只为 5.1 修了标准输出解码,管不到写文件;$OutputEncoding也不影响Set-Content。于是一个在 pwsh 7 下完全正确的命令,在本机静默写出了 BOM。3.
reconcile对"已存在但未登记的 bundle"永久跳过app.asar/dsh/node_modules/@deepseek-ai/dsh-plugin-manager/lib/types/operations.jspackage.json,进程被 kill → 不 reconcile → 留下dep 有 / bundles 无。beforeDeps已包含该依赖 →continue→ 永远补不上(实测清单 mtime 停留在中断那次的时间)。package.json—— 本次事故正是这样写入了 BOM。4. 启动失败缺少上下文,且没有恢复入口
dsh-desktop-host/lib/index.js:224直接调用,无 try/catch:fatal 上报只取
error.message(同文件 :353-362),而readProfileManifest的 parse 异常恰好没有路径信息,所以弹窗/日志里只有一句裸SyntaxError。产品也没有 "profile 损坏 → 用模板重建/回滚" 的路径。影响
<HOME>/.dsh/profiles/*/package.json的用户(记事本、VS、PowerShell 5.1、某些同步/备份工具)都会让桌面端完全无法启动,且错误信息无法定位文件。建议修复
path的 try/catch;解析失败时降级到模板 + 明确告警,而不是 fatal。runRecordPath(dir)(运行中写入、结束时删除)。启动一次操作时若发现残留 run record,说明上次被中断 → 强制做全量 reconcile,而不是用beforeDeps跳过。-Encoding utf8会写 BOM(Out-File默认 UTF-16);或直接内置/要求 pwsh 7。附:崩溃日志原文
All reactions