Replies: 4 comments
|
Follow-up on the same root cause — this explains a second, downstream symptom. The callSeqs[index] = appendToolCall(session, turn, step, call.block); // persisted first
started++;
const prepared = await ctx.tools[TOOL_RUNTIME_SCHEDULER].prepare(call.exec); // throws hereSo every tool call that hit Consequences:
So the two symptoms ( Additional fixes for the list:
|
|
我的设备上也遇到了相同的问题,让D老师看过上面的分析后写了一个给Windows设计的修复脚本(只在Windows11+pwsh 7测试过可用,pwsh 5大概会因为编码问题报错。。没试过): |
|
工具调用类报错(含流式下工具名丢失/description 字段 required 死循环)我们在 FAQ 和第 8 章整理了根因与规避,可对照排查:https://github.com/Electricitysheep/dsh-handbook/blob/main/docs/faq.md |
|
@deepseek-ai/dsh-tools 被 materialize 两次(profile pnpm install 后)——这和"插件装在哪决定依赖解析"是同一机制:dsh 的扁平兜底目录($DSH_HOME/profiles/node_modules 软链接)让 Node 在 profile 内可解析到宿主包,但 profile 里再 install 会生成第二份。 完整机制 + 规避(link 开发依赖声明/版本线锁定)见手册第 3 章:https://github.com/Electricitysheep/dsh-handbook/blob/main/docs/03-profiles.md |
Uh oh!
There was an error while loading. Please reload this page.
Summary
Every tool call in every session fails with
Cannot read properties of undefined (reading 'prepare')after runningpnpm installinside a profile directory. Root cause:@deepseek-ai/dsh-toolsgets materialized twice — once in the installation tree, once in the profile'snode_modules— which splits its module-level schedulerSymbolinto two distinct objects.Environment
@deepseek-ai/dsh@0.1.0-rc.6, installed globally vianpm i -g @deepseek-ai/dshweb, with out-of-tree plugins added viadsh plugin add/pnpm installReproduction
web) and add any out-of-tree plugin that hard-depends on@deepseek-ai/dsh-tools(e.g.dsh-better-sidebar,@omdsh-dev/dsh-genui,@dsh-external/dsh-automation).pnpm installinside the profile directory.pwd).Observed behavior
The
turn/endevent records:{"reason":{"kind":"error","error":{"message":"Cannot read properties of undefined (reading 'prepare')","code":"UNKNOWN"}}}Every tool call dies at scheduler dispatch, for all sessions.
Root cause
dsh-agent-loopreaches the tool scheduler through a module-levelSymbol:TOOL_RUNTIME_SCHEDULERisSymbol("@deepseek-ai/dsh-tools.scheduler")(dsh-tools/lib/index.js:2409). It must be the same object everywhere in the process.The flat fallback
~/.dsh/profiles/node_modules(maintained byhealProfilesModuleFallback) correctly symlinks each@deepseek-ai/*package back to the installation tree, keeping the symbol a singleton — as long as the profile has no local materialization.Running
pnpm installinside a profile (whichdsh pluginforwards to pnpm) materializes@deepseek-ai/dsh-toolsand other in-box packages as physical copies under~/.dsh/profiles/<name>/node_modules/@deepseek-ai/. Any out-of-tree plugin that hard-depends on@deepseek-ai/dsh-toolsthen resolves to this profile-local copy, whoseSymbolis a different object from the installation tree's.Result:
dsh-agent-loop(installation tree) uses symbol A to look upctx.tools[symbolA], but the profile-localdsh-toolscopy produced symbol B, so the lookup yieldsundefinedand.preparethrows.Direct proof (both copies at 0.1.0-rc.6, byte-identical contents):
Why this is a design bug rather than a plugin bug
Symbolwith no guarantee against multiple copies.dsh pluginforwards topnpm, andpnpm installmaterializes in-box@deepseek-ai/*packages into the profilenode_modules, breaking the singleton assumption.webprofile manifest itself lists@deepseek-ai/dsh-toolsindependencies, so this reproduces even with zero third-party plugins, as long aspnpm installis run in the profile.Cannot read properties of undefinedwith no hint about the duplicate copy.Suggested fix direction
Symbol.for("<well-known-key>"), or a plain string key), or@deepseek-ai/*packages to the installation tree (declare them aspeerDependencies/external in the profile build, or dedupe them back to the fallback symlink), orctx.tools[TOOL_RUNTIME_SCHEDULER]lookup and emit a clear diagnostic like "multiple copies of @deepseek-ai/dsh-tools detected; remove profile-local @deepseek-ai packages and re-run".All reactions