Skip to content

修复 dsh 0.2.x 兼容性:ui-chat 启动失败、账本与设置失效(Fixes #1) - #2

Open
WosLovesLife wants to merge 1 commit into
fancr-code:mainfrom
WosLovesLife:fix/issue-1-harness-0.2.x
Open

WosLovesLife wants to merge 1 commit into
fancr-code:mainfrom
WosLovesLife:fix/issue-1-harness-0.2.x

Conversation

@WosLovesLife

Copy link
Copy Markdown

关联 issue

Fixes #1

根因:不是 dsh.client.inject,而是 composer 插槽 id 冲突

issue #1 的报错总是指向 @deepseek-ai/dsh-client-ui-chat,而不是插件自身的条目。实际根因是 conversation.composer.dock 的插槽 id 冲突:

  • 0.2.1 / 0.2.2 的 dsh-client-ui-chat 自己往该插槽注册了 id: "usage"(内置 token 药丸)
  • 1.10.0 插件也注册 id: "usage"
  • 插槽 id 冲突让 ui-chat 的 apply 抛错,于是 web boot 报 1 entry did not activate / @deepseek-ai/dsh-client-ui-chat: failed
  • 这也解释了为什么最小化 profile 仍必现、日志却从不指向插件

issue 里推测的 dsh.client.inject / peer 范围不是原因;dsh.client 没有 inject 列表并不影响加载。

改动

  1. 客户端槽位命名空间化:usage → usage-meter,order: 2(排在原生 activity=0 / usage=1 之后),并用“费用”前缀与原生 token 药丸区分。lib/client.js
  2. 0.2.x 账本:0.2.x 删除了 session.events。宿主改为监听 session/event 的单事件 + 启动时 snapshotEvents(fromSeq) 回填,用 event.seq 去重;并把 lastSeq / last 随账本持久化,修掉 Harness 重启后重复累加历史用量的问题。lib/index.js
  3. 原生设置:声明 volatile Config(currency / budget / pricing,pricing 为模型名 → 档位价的 dict)。0.2.x 首次启动会把旧 settings.yaml 的 usage-meter: 节自动导入 profile entry,并在 设置 → 插件 自动生成表单;导入失败时回退读取 settings.yaml.imported 并告警。
  4. 更新方式:面板保留 npm 新版检查;发现新版后调用 pluginNavigation.openList() 打开 0.2.2 原生插件管理(带回滚与兼容检查),删除自定义 dsh plugin add 自更新逻辑。
  5. 版本与兼容:2.0.0;engines.dsh: >=0.2.1-rc.1 <0.3.0。0.1.x 用户停留在 1.10.0(breaking change)。
  6. 测试与 CI:新增 scripts/test-host-fold.mjs(0.2 事件 fold / retry / seq 去重 / 重启恢复)、scripts/test-config.mjs(Config 形状、旧 YAML 解析、槽位 id 断言)、scripts/smoke-web.mjs(临时 DSH_HOME + 打包安装 + headless Chrome)。CI 增加 npm install 以安装唯一的官方依赖。

验证

  • npm test:14 项定价解析 + host fold + Config/槽位,全部通过
  • npm run smoke(0.2.2-rc.1):打包安装 → 临时 profile 启动 → headless Chrome;无 boot 失败;/usage-meter/state 正常;旧 settings.yaml 的 USD / budget 3 / pricing 0.5 自动导入并下发
  • 0.2.1-rc.1 手动验证(issue [Bug] 1.10.0 在 dsh-desktop 0.2.1-rc.1 上导致客户端启动失败:@deepseek-ai/dsh-client-ui-chat: failed / 1 entry did not activate #1 的环境):全新 profile 不带任何版本豁免安装成功;启动无 boot error;/usage-meter/state 正常;settings.yaml 自动导入为 USD / budget 3 / pricing 0.5
  • 0.2.2-rc.1 桌面端实机:HMR 加载后 /usage-meter/state 返回 200,当前会话真实用量写入 5 个会话、3 个小时桶;无新的 crash log

0.2.1 的实机验证在 macOS 上完成;issue 报告者是 win32,但根因是平台无关的插槽 id 冲突,客户端模块代码相同。

兼容性与风险

  • Breaking:2.0.0 放弃 0.1.x;旧 Harness 用户应留在 1.10.0。
  • 新增唯一运行时依赖 @deepseek-ai/schemastery(Harness 官方、MIT、约 23KB ESM)。这是 0.2.x volatile Config 与 settings.yaml 自动导入的前提;没有 vendor 一份校验器,避免维护分叉。
  • session.snapshotEvents 在 0.2.2 已标记 deprecated;它是当前唯一可用的回填读法,后续可迁移到新的 Session API。
  • pricing 是 volatile dict,设置页的 dict 编辑器体验一般;currency / budget 是普通字段。面板 chip 与原生 Usage 药丸会并存(原生显示 token/缓存,插件显示费用/余额,定位不同)。

Checklist

- fix boot crash: namespace composer dock id usage -> usage-meter; 0.2.x
  ui-chat owns the bare `usage` id, so the collision failed its activation
  and blanked the web boot (reproduced on 0.2.1-rc.1 and 0.2.2-rc.1)
- fold 0.2.x sessions via session/event + snapshotEvents/seq; persist
  lastSeq/last so restarts stop double counting
- declare volatile Config (currency/budget/pricing) with the official
  @deepseek-ai/schemastery; auto-import legacy settings.yaml, fall back to
  settings.yaml.imported when the import is rejected
- hand updates to the native plugin manager via pluginNavigation; drop the
  custom `dsh plugin add` self-updater
- add host-fold/config regression tests and a local web smoke script; CI
  installs the schema dependency
- engines.dsh >=0.2.1-rc.1 <0.3.0; 0.1.x users stay on 1.10.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] 1.10.0 在 dsh-desktop 0.2.1-rc.1 上导致客户端启动失败:@deepseek-ai/dsh-client-ui-chat: failed / 1 entry did not activate

1 participant