Skip to content

v0.2.7 — 修复新装环境工具调用崩溃(核心包必须 peerDependencies)

Choose a tag to compare

@alanzhao0128 alanzhao0128 released this 20 Sep 09:45
· 15 commits to main since this release

0.2.7 — 修复「新装环境一调用工具就崩」

症状:全新安装(尤其是 Linux)后,纯聊天正常,但任何工具调用都整轮失败:

dsh: UNKNOWN: Cannot read properties of undefined (reading 'prepare')

tool/call 已写入但没有配对的 tool/result,错误不落盘栈。

根因:package.json 曾把 dsh-tools / dsh-settings / dsh-atomic-write / dsh-home-paths 写在 dependencies 里并钉死 0.1.2-rc.1。pnpm 会把它们 hoist 进 profile 的 node_modules,于是 profile 里出现第二份物理拷贝;cordis loader 从 profile 目录优先解析内置条目,而 fallback 里的宿主包仍用自己那份 —— dsh-tools 的调度器挂在包内私有 Symbol 上,两份拷贝 = 两个 Symbol,registry[TOOL_RUNTIME_SCHEDULER] 读到 undefined → scheduler.prepare 抛错。

修复:这些 DSH 核心包全部改为 peerDependencies(>=0.1.2-rc.1),插件沿父目录解析到宿主那一份;schemastery 仍为普通依赖。新 profile 里只剩 schemastery + cosmokit。

验证:用只拉旧 dsh-tools 的 shim 包复现了完全相同的崩溃(与插件无关),修复后全新 profile 端到端验证 —— 6/6 工具调用全部有配对结果(含 remember / read_memory)。

升级建议:如果你在全新环境装过旧版本并遇到上述崩溃,升级到 0.2.7 后需要重装 profile 依赖(dsh plugin --profile <p> add @alanzhao/dsh-memory-lite@0.2.7)并重启,让旧的第二份拷贝消失。

另:IMPLEMENTATION.md §19 记录了这条对所有 dsh 插件都适用的依赖政策。