Repository navigation
Replies: 4 comments
|
[非官方] 这篇列出的 |
|
这篇综述的风险根因分析与我们在生态里的实测结论高度一致:单进程、共享注册表意味着「安装即授权」,信任不能靠用户逐行读源码来兜底,必须变成可复现的检查。我们针对文中三个层面做了对应防御件,可与防御实践一节互相印证:
三件套全部 Apache-2.0、npm 可装、已接入 OpenSSF Scorecard 与 npm provenance。如果作者愿意,欢迎把文中的防御实践与认证五维做一次交叉验证,我们的全部实测数据公开可查。 (EN) Our own measurements confirm this post's root-cause analysis: single-process shared registries make install equal to authorization, so trust must be reproducible rather than manual. We shipped the matching defenses: dsh-auto-review (second-model approval review, fail-closed, session-log auditable), dsh-permission-rules (declarative rules on tools/pre-execute), and dsh-plugin-certification (5-dimension spec v1 + public registry + badge). All Apache-2.0 on npm with OpenSSF Scorecard and npm provenance. Happy to cross-validate the defense practices in this post against the certification dimensions — our data is public. |
|
Concrete data point from a project that tried to apply the "hard parts" of this critique:
The discipline of "treat the routing decision as authority-bearing" turned out to be the same discipline as fail-closed PnL gates: every code path that mutates state (cooldowns, success counters, exploration accounting) goes through Happy to compare notes with anyone shipping a router / plugin in this ecosystem. Full write-up in DSH |
|
Reply to #1884 — AI-written plugin risks
This is the exact problem UEA was designed to address. The reference repo is here: MajidAsghariTabrizi/universal-engineering-agent (MIT, 31 self-tests, zero runtime deps). The core insight: the AI generates the implementation; the kernel enforces the engineering workflow. Specifically:
The documentation at The key distinction: UEA is not the agent, and it is not the AI writing code. It is the contract that the AI-written plugin must pass before the DSH session treats its output as trustworthy. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
AI 编写的 DSH 插件为什么容易出问题?—— 风险综述与防御实践
摘要
DeepSeek Harness 的定位是"一切皆插件",并且插件主要不是给社区 review 的成品,而是给 AI 现场生成、自用的。这带来了一个结构性风险:Cordis 插件跑在同一个进程里、共享 context 与工具注册表、没有运行时隔离——一个 AI 写的插件只要犯一个小错,轻则插件不生效,重则拖垮整个 DSH。
本文第一部分汇总社区里的真实证据(GitHub Discussions / Hacker News / Reddit / 中文社区),说明"AI 写的 DSH 插件质量差、容易导致崩溃"不是个别现象,而是有架构根因的普遍问题;第二部分给出作者在 omdp 仓库(dsh-connector / dsh-vision-bridge 两个插件的实际落地)验证过的防御实践,希望能帮大家少踩坑。
一、问题:插件为什么"跑着跑着就出问题"
如果你用 AI 写过 DSH(Cordis)插件,大概经历过这些:
waiting for services: ...cannot get property "xxx" without injectCannot find package ...直接dsh web起不来这些不是个例。它们的共同根源,是 DSH 的插件架构本身。
二、架构根因:单进程、共享注册表、无隔离
来自官方仓库的讨论 Discussion #326 — Thoughts on "Everything is a Plugin" — the user-side cost,作者 @phinn 分析了 DSH 的 49 个包依赖图后指出:
他还对比了 Webpack loaders:"那些平台花了多年时间建立运行时隔离,Cordis 没有。"
这意味着什么:
fail loud,行为不可预测injectdsh web启动即崩而 Hacker News 上关于 DSH 的讨论(DeepSeek Harness developer preview)更是点破了设计定位:
翻译过来就是:DSH 的插件是给 AI 生成、给自己用的,没有社区 review 这道质量闸门。 所以"AI 写的插件质量差"是设计使然,不是偶然现象。
三、社区证据:这不是个别现象
3.1 官方 GitHub Discussions
① Discussion #380 — 写第一个 dsh 插件踩的六个坑(0.1.0-rc.6 本机复核)
作者(做 dsh-superpowers,把 Superpowers 方法论搬进 DSH)用 AI 辅助开发,踩了 6 个坑,几乎全是"AI 写插件"高频翻车点:
createRequire找不到@deepseek-ai/*→MODULE_NOT_FOUND。inject写成对象。{ required: [...], optional: [...] }会被 Cordis 当成"我要 required 和 optional 这两个服务",插件永远 pending,启动卡住。inject数组 vs 对象的语义混淆。数组每一项是服务名;对象走Object.keys(),是拦截配置,别混用。作者的最终结论非常关键:
② Discussion #535 — npx @deepseek-ai/dsh web 报错
插件依赖导致整个 DSH 启动即崩的实证:
attachment插件:sharp原生二进制加载失败(win32-x64 不匹配)subprocess插件:node-pty找不到(Cannot find package ...)因为 DSH 的 loader 在启动时同步导入所有 bundle 的 loader entry,任何一个含原生依赖的插件装错平台,整个
dsh web直接抛错起不来,而不是降级跳过。③ Discussion #758 — Windows sandbox (workspace-write) 崩溃 + 4 related issues
虽然不是插件问题,但同属"早期框架隐蔽坑":沙箱临时目录清理后不自愈、ConstrainedLanguage 噪音、WMI 查询被拒、UAC 静默失败。作者本人在 Windows 上也踩过 BUG-1(
windows-acl-run: --temp is not an existing directory),说明这类运行时脆弱性是真实普遍的。④ 其他运行时隐藏问题
3.2 英文社区
3.3 中文社区 / 第三方评测
grep无匹配也返回 1 → 误判失败 → 自我强化验证循环(同任务请求数 61 vs 32、成本 $0.17 vs $0.05、token 290万 vs 54.8万)。四、AI 写插件的高频雷点清单(含真实报错)
以下是社区证据 + 作者实测汇总的、AI 写 DSH 插件最容易犯的错:
inject写成对象({required, optional})1 entry did not activate my-plugin: pending (waiting for services: required, optional)cannot get property "credentials" without inject(Cordis 的 Proxy 在 get 时直接抛,?.救不了)@deepseek-ai/*在 dev 链接下解析失败MODULE_NOT_FOUNDdsh web启动即崩:Could not load the "sharp" module using the win32-x64 runtime/Cannot find package ... node-ptyparameters用 DSH per-property mapschema must be a JSON Schema of 'type: "object"', got 'type: null'(HTTP 400)五、防御实践:如何写出"不崩"的 DSH 插件
5.1 三条核心原则
ctx上拿(社区共识,见 写第一个 dsh 插件踩的六个坑(0.1.0-rc.6 本机复核) #380)。inject显式声明 + 一维字符串数组:需要什么服务就明确声明什么,别靠?.兜底。5.2
inject正确写法5.3 服务访问的正确姿势
Cordis 对未注入服务的访问会在
get时直接抛错(Proxy 实现),所以:5.4 工具注册的正确姿势(JSON Schema)
ctx.tools.register(已安装 bundle 路径)会把parameters原样转发给 OpenAI 兼容 provider,所以必须是完整的 JSON Schema:5.5 错误处理与边界
try/catch,失败降级为可读的文本/错误信息,而不是抛到顶层。5.6 本地开发与验证流程
link:安装("@omdp/xxx": "link:D:/path"+pnpm install),改完重启 DSH 即生效,避免每次远程拉取。dsh --profile xxx --dump-config看 patch 层是否正确加载,再起一个最小会话测工具。node --check做语法校验,import后做 smoke test(确认模块能加载、导出函数存在)。5.7 发布注意
dsh plugin add github:...会失败,需在 profile 的pnpm-workspace.yaml加:prepare脚本,allowBuilds是唯一门槛。npm publish只认--otp(见 写第一个 dsh 插件踩的六个坑(0.1.0-rc.6 本机复核) #380)。六、作者实践:omdp 仓库怎么做的
作者维护的 omdp monorepo 里有两个插件,完全按上面的原则落地:
@omdp/dsh-connector:MCP + Skills 管理插件。纯 JS、仅依赖yaml;写cordis.patch.yml前做完整校验(transport/serverName/url/command),并原子写入,保证"坏配置到不了下次启动"。@omdp/dsh-vision-bridge:视觉桥插件(给文本模型加"眼睛")。零依赖、只 import Node 内置模块;工具parameters用完整 JSON Schema(修掉了type: null400);inject显式声明(修掉了cannot get property "credentials" without inject);工具重名做 fallback;粘贴路由做 magic-byte 校验 + 25MB 上限 + TTL 清理。这些修复过程本身就是"AI 写插件踩坑"的活案例——建议直接参考仓库里的实现。
七、开放讨论(欢迎社区参与)
--dump-config之外,能不能有"插件体检"工具,提前暴露 inject 错误、服务缺失、schema 问题?附录:来源链接
GitHub Discussions(官方仓库)
英文社区
中文社区 / 第三方
本文为社区公开讨论的整理与作者实测的归纳,观点归属原作者;DSH 仍处 developer preview,接口与行为会变,请以最新官方文档为准。
All reactions