find-plugin for DeepSeek Harness
让 DSH Agent 能主动发现新能力,同时把安装决定、安全检查和版本控制牢牢留在用户手中。
DSH 社区插件分散在 GitHub,而一个 dsh-plugin topic 并不能证明仓库真实可用,更不能证明它值得信任。过去,用户需要自己搜索仓库、核对 bundle 和 patch、审查生命周期脚本、固定版本、修改 profile,再确认插件是否真的加载成功。find-plugin 把这条容易出错的链路收敛成 Agent 内的一次安全工作流:搜索、验证、风险披露、用户批准、固定 commit 安装、结果校验。
它不只是一个插件搜索器,更是 DSH 的受控自扩展入口:Agent 可以按任务寻找社区能力,但不能绕过用户确认;安装目标不会在检查后悄悄变化;社区包的生命周期脚本默认不会执行;失败也会明确指出依赖、bundle、patch 或配置验证停在哪一步。
为此,插件提供两个工具:find_plugin 负责发现和初步审查,install_plugin 负责在 approval 保护下完成固定版本安装。V1 刻意保持轻量,直接使用 GitHub 和 DSH 官方 plugin manager,不引入 registry、embedding、数据库或 Web UI。
安装
Prerequisites:
- Node.js 20 或更高版本。
pnpmmust be available on PATH。当前 DSH 官方 plugin manager 会在 profile 目录中调用pnpm。
默认安装命令:
npx @deepseek-ai/dsh plugin --profile web add github:graceen2331-prog/find-plugin
安装后重启当前 surface:
npx @deepseek-ai/dsh web
插件加载后会向 DSH tool registry 注册:
find_plugin
install_plugin
本仓库已提交 lib/ 中的构建产物。安装和运行不依赖 prepare、install 或 postinstall;本包也没有声明这些脚本。
工具
find_plugin
输入:
{ query: string }
实现行为:
- 只搜索 GitHub
topic:dsh-plugin,取少量候选后做本地关键词计分,最多返回 5 项。 - 返回仓库名、描述、stars、更新时间、GitHub URL、package name 与 bundle patch。
- discovery 阶段从同一 default branch 读取根
package.json和dsh.bundle.patch,不为每个候选额外消耗 GitHub core API 配额;真正安装时会重新解析并固定完整 commit SHA。 - 列出
install、prepare、postinstall及明显风险。 - 过滤归档/禁用仓库、缺失 manifest、bundle/profile 混用、危险 patch 路径、缺失或明显为空的 patch,以及 patch 引用了未提交构建入口等无效候选。
GitHub 未认证搜索额度较低。可选地通过 DSH_FIND_PLUGIN_GITHUB_TOKEN、GITHUB_TOKEN 或 GH_TOKEN 提供 token;token 只发送给 api.github.com。
install_plugin
输入:
{
owner: string
repo: string
profile?: string // 默认 web
}
安装顺序:
- 获取仓库 default branch 的完整 commit SHA,并在该 SHA 上重新验证 bundle。
- 在 DSH approval 中展示仓库、package、目标 profile、固定 SHA、生命周期脚本和风险。
- 只有
allowed-once才继续。 - 从当前正在运行的
@deepseek-ai/dshpackage 定位其bin.dshentry,用process.execPath和参数数组启动官方plugin --profile ... add;不会查找或执行全局dsh,也不会拼接 shell 字符串。 - 安装 spec 固定为
github:<owner>/<repo>#<40-char-sha>,并传入--ignore-scripts,因此社区包的生命周期脚本不会执行。 - 验证 profile dependency、SHA pin、
dsh.profile.bundles、已安装 bundle patch,以及官方--dump-config结果。 - 成功结果明确返回
restartRequired: true。V1 默认当前 runtime 不会热加载新增 bundle。
安全边界
- GitHub topic 不是信任信号;这里的静态检查只能过滤明显问题,不能证明插件安全。
- DSH 插件最终在 Harness 进程内运行,拥有该进程权限,不是沙箱。
- V1 永不执行依赖的生命周期脚本。只提交 TypeScript 源码、依赖
prepare才产生运行文件的插件会安装或加载失败;应要求作者提交构建后的 JS。 - 固定顶层仓库 commit 防止检查与安装之间的 branch 移动。
pnpm-lock.yaml继续负责解析后的依赖图;这不等于源码审计或供应链证明。 - approval 是一次性授权。拒绝、取消或没有可用 approval channel 时不会安装。
开发与验证
pnpm install --ignore-scripts
pnpm test
pnpm pack
发布前应在空的 DSH_HOME 中执行 README 顶部的 GitHub 安装命令,随后重启 Web surface,并从 DSH tool registry 确认两个工具已经注册。
No comments yet. Be the first to write one.