neo-dsh-plugins

August 14, 2026 · View on GitHub

社区 DSH(DeepSeek Harness)插件 monorepo。每个插件是一个独立的 npm 包,位于 packages/ 下,构建产物可装入任意 dsh profile(如 web GUI 所在的 profile)。

结构

packages/tool-hello/        示例工具插件(@neo-dsh/tool-hello)
  src/index.ts              Cordis 插件本体(name / inject / Config / apply)
  lib/                      构建产物(pnpm build 生成,不入库)
  scripts/runtime-test.mjs  独立运行期测试(真实 dsh-tools 注册表)
docs/plugin-development.md  新插件开发与接入指南
scripts/new-plugin.mjs      脚手架:一条命令生成新工具插件包
scripts/smoke-plugin.mjs    插件导出形状冒烟测试
scripts/verify-gui-plugin.mjs  查询运行中 GUI 的 Loader 清单验证插件已生效
.github/workflows/ci.yml    GitHub Actions:install/typecheck/build/test/smoke

环境

  • Node >= 20,TypeScript(NodeNext ESM)
  • 包管理:pnpm workspace。本机若没有全局 pnpm,可用 npx --yes pnpm@10 ... (并设置 npm_config_cache 指向工作区内目录以避免沙箱拦截)。

快速开始

# 安装依赖(store/cache 放工作区内,避免写权限问题)
$env:npm_config_cache = "D:\selfs\neo_dsh_plugins\.npm-cache"
$env:npm_config_store_dir = "D:\selfs\neo_dsh_plugins\.pnpm-store"
npx --yes pnpm@10 install

# 构建全部插件
npx --yes pnpm@10 build
# 或单个
npx --yes pnpm@10 --filter @neo-dsh/tool-hello build

# 冒烟测试某个插件(校验 loader 形状)
node scripts/smoke-plugin.mjs packages/tool-hello

新建一个工具插件(脚手架)

node scripts/new-plugin.mjs my-tool --tool my_tool
pnpm install
pnpm --filter @neo-dsh/my-tool build
pnpm --filter @neo-dsh/my-tool test

脚手架会从模板生成 packages/<slug>/(包、配置、工具、测试、README),然后按 docs/plugin-development.md 接入 profile 即可。

CI

仓库已配置 GitHub Actions(.github/workflows/ci.yml):push/PR 自动跑 pnpm install --frozen-lockfile → typecheck → build → test → smoke。 verify:gui 需要运行中的 GUI,不进 CI,本地手动执行。

把插件装入一个 dsh profile

以运行中的 web GUI(C:\Users\86349\.dsh\profiles\web)为例:

  1. 把插件包软链进 profile 的 node_modules:

    New-Item -ItemType Directory -Path "$env:USERPROFILE\.dsh\profiles\web\node_modules\@neo-dsh" -Force
    New-Item -ItemType Junction -Path "$env:USERPROFILE\.dsh\profiles\web\node_modules\@neo-dsh\tool-hello" `
      -Target "D:\selfs\neo_dsh_plugins\packages\tool-hello"
    

    (插件自身的依赖在其 package-local node_modules 内自包含解析,无需在 profile 里装依赖。)

  2. 在 profile 的 cordis.patch.yml 加一行 loader 条目:

    - insert:
        - id: tool-hello
          name: '@neo-dsh/tool-hello'
          config:
            greeting: Hello
    
  3. 验证组合配置树包含该行:

    dsh --profile web --dump-config | Select-String "tool-hello"
    
  4. 验证运行中 GUI 已加载(直接查 Loader 清单,fiberPhase: active 即生效):

    node scripts/verify-gui-plugin.mjs
    
  5. GUI 通过 HMR 热载入;若未生效,重启 web profile。新会话中模型即可使用 neo_hello 工具。

更多细节见 docs/plugin-development.md