Web 工具调用时 .prepare 未定义的问题 #7338
Replies: 1 comment
|
Your diagnosis is right and the crash site matches your reasoning line for line. Three things I can add from reading the tree: your patch is not a workaround — it is the convention this repository already uses for exactly this problem, and it has a name; the "Web" in the title is where the error is rendered, not where it happens; and the same criterion that makes your patch right also tells you which neighbouring keys are at risk and which are not. The crash site, exactly
So the failing lookup is Your patch is the repository's own convention — and it is documentedThe tree does not merely tolerate
The term also appears in the architecture record The criterion — and why the neighbours are fine as they areA module-level symbol needs registry identity exactly when it is used as a key on an object that another module evaluation may have produced: a lookup
So the audit list is not "every The frame: nothing here is Web-specific
const resolutionMode = packaged ? 'runtime' : options.resolutionMode ?? 'runtime'Tools then execute in the Worth knowing if you bisect further: the desktop host passes this explicitly and defaults the other way — Honest boundary
Not reachable from a pluginFor anyone considering a plugin-side fix: a plugin can diagnose this from its own vantage — |
Uh oh!
There was an error while loading. Please reload this page.
问题描述:
更新代码后,Web 会话在模型调用工具时失败,页面显示:
普通文本回复可能正常,但调用 BashProbe、BashTest、job_list 等工具时失败。
问题原因:
dsh-tools 内部的工具调度器使用普通 Symbol() 标识:
Symbol('@deepseek-ai/dsh-tools.scheduler')当 Web bundle 中加载了多个 dsh-tools 副本时,不同副本生成的 symbol 不相等,导致 agent-loop 无法找到 ToolRuntime 的 scheduler,最终在调用 .prepare() 时触发运行时错误。
修复内容:
将内部 scheduler 标识改为:
Symbol.for('@deepseek-ai/dsh-tools.scheduler')相同 key 在同一进程内始终返回相同的 symbol,确保不同 bundle 中的 agent-loop 和 ToolRuntime 可以访问同一个工具调度器。
QA 测试版本:
仓库:sunny-zhai/deepseek-harness
分支:master
Commit:00649801cfb24ed3e42469d2356fc4d014547eb7
修改文件:packages/core/tools/src/index.ts
项目版本:dsh 0.1.6-alpha.2
平台:macOS
Node.js:v24.19.0
All reactions