【Bug】源码模式加载外部 npm 插件时 isAgentLoopRequest() 错误返回 false(AgentLoop 请求身份未在 dsh-llm 模块实例间共享) #4613
kober-basket
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.
在源码模式运行
pnpm dsh时,外部 npm 插件虽然收到了 AgentLoop 创建的同一个llm/stream options,但isAgentLoopRequest(options)会错误返回false。运行路径
源码模式下,两侧实际加载了不同的
dsh-llm模块:插件收到的确实是原始 DSH 请求对象:
但 AgentLoop 执行的是:
插件查询的却是:
因为身份记录保存在不同的
WeakSet中,所以同一个对象也无法被识别。最小复现
在完成
pnpm run build后执行:实际输出:
这个复现不依赖任何第三方插件。它只是还原源码 AgentLoop 与外部 npm 插件分别加载
src和lib的运行方式。影响
任何通过公开的
isAgentLoopRequest()观察llm/stream的外部插件,都可能:预期结果
AgentLoop 标记并传入
llm/stream的同一个options,应被同一 JavaScript realm 内加载的所有dsh-llm实例正确识别。同时应继续保持精确对象身份语义:
不应通过
sessionId、冻结状态或请求字段结构推断其身份。环境
masteratb150a551b8v22.22.011.7.026.5.1arm64我已经准备了一份本地修复:让分别加载的
dsh-llm模块在同一 realm 中共享一个版本化的请求身份注册表。相关单元测试、构建及文档检查均已通过;如有需要,我可以提供 patch。All reactions