前言¶
写 DeepSeek Harness 插件时,不只是实现一个工具:还要处理 bundle 格式、工具 DSL、配置校验、测试和发布前检查。下面介绍 sunshine-lang/dsh-plugin-template。它把这几部分集中在一个骨架里,适合作为从模板生成新插件的起点。
这是什么¶
dsh-plugin-template 是一个 DeepSeek Harness 插件骨架,由 sunshine-lang 维护,许可证为 MIT。
GitHub 仓库:
https://github.com/sunshine-lang/dsh-plugin-template
它覆盖的内容包括:
- DeepSeek Harness 插件骨架
- bundle 格式
- 工具 DSL
- 配置校验
- 测试
- 发布清单
- 用
scaffold脚本生成新插件
从模板生成插件¶
先运行脚手架,生成一个名为 dsh-myplugin 的插件目录:
node scripts/scaffold.mjs dsh-myplugin --description "what it does"
生成后,按自身能力补全工具、调整 Config 字段,并按发布清单补齐安装、用法和配置说明。
资料给出的测试命令是:
node --import tsx/esm scratch-plugin/dsh-myplugin/test-integration.ts
构建时,资料区分了两种路径。如果在 harness 仓库内构建,用:
pnpm exec tsc -p tsconfig.local.json
如果独立克隆并安装依赖,用:
npm install && npm run build
资料还指出:lib/ 已构建并提交;GitHub 安装不运行构建脚本。
最后在 Web UI 中试运行:
pnpm dsh --profile web --patch ./scratch-plugin/dsh-myplugin/cordis.patch.yml
安装与启用¶
已抓取资料未给出针对 dsh-plugin-template 的官方安装命令,也不要直接把模板名拼成安装命令。
如果按资料中的可选发布路径把插件发布为 npm 包,用户侧安装形式是:
dsh plugin add <name>
这里的 <name> 是发布后的 npm 包名。已抓取资料中 package.json 的 name、description、repository 仍为占位字段,最终发布包名和仓库地址未确认。
如果推送到 GitHub 后使用 GitHub 安装路径,资料给出的命令形式是:
dsh plugin add "github:you/repo"
资料提示,推送到 GitHub 时使用独立仓库,且该路径需要包根目录。
工具、Config 与解析约定¶
资料列出的几条约定如下:
- 可选工具参数要省略
required;写required: false会被 schema 编译器拒绝。 - 用 Schemastery 定义 Config;无效配置在加载时响亮失败。
- 对完整结果施加边界:限制文件大小、页数、字符数;在有意义的边界截断,并告诉模型如何继续。
- Node 解析:相对导入使用
.js后缀;@deepseek-ai/*依赖声明在dependencies中,从 profile 的node_modules解析。
运行环境与发布注意¶
engines要求node >=22.19。- 可选
npm publish;之后用户可dsh plugin add <name>。 lib/已构建并提交;GitHub 安装不运行构建脚本。- 在
pnpmworkspace 子目录里跑npm install会失败;独立开发请在 harness 仓库外脚手架;在仓库内构建请用tsconfig.local.json。
适用场景与注意¶
适合已经在用 DeepSeek Harness、需要写新插件或整理插件仓库结构的开发者。
需要明确:插件会以当前 dsh 进程权限运行,安装前应检查源码与许可证。本模板许可证为 MIT。
链接¶
- GitHub:https://github.com/sunshine-lang/dsh-plugin-template
- 目录页 URL:已抓取资料中未给出。