这个月 deepseek harness 发布了, 做个简单插件熟悉了解一下
写了个简单的代码,直接参考即可
源码链接
说明
看了下dsh 的源码,是用pnpm 的monorepo,
一切皆插件, 大部分的功能都是在 packages 下面作为插件加进来的, 自己写插件的话可以参考这里面的代码了. 插件也是要用 ts 来写
如果python要使用的话, 可以用其python sdk 来引用
扩展阅读
官方插件开发文档:
https://deepseek-harness.github.io/deepseek-harness/develop/basic/publish
harness 一切皆插件的
https://github.com/cordiverse/paper
dsh 的安装
要先安装一下dsh
npm install --global @deepseek-ai/dsh --registry=https://registry.npmmirror.com npm uninstall --global @deepseek-ai/dsh # 卸载 dsh web # 启动 dsh plugin --profile web list # 查看插件 dsh plugin --profile web add . # 从源码安装插件, dsh plugin --profile web remove xxx # 删除某插件 dsh --profile web --dump-config # 查看一下插件的开发
插件开发直接参考官网文档这个即可,还是比较简单的
https://deepseek-harness.github.io/deepseek-harness/develop/basic/
需要的入口文件是:
cordis.patch.yml
- insert: - id: xxxx name: xxxxxpackage.json
{ "name": "dsh-docs-to-html-tool", "version": "0.1.2", "type": "module", "main": "index.ts", "files": [ "index.ts", "tool-logger.ts", "lib/convert.ts", "cordis.patch.yml" ], "dsh": { "bundle": { "patch": "./cordis.patch.yml" } }, "peerDependencies": { "@deepseek-ai/dsh-tools": ">=0.1.0-rc.6", "@deepseek-ai/dsh-llm": ">=0.1.0-rc.6" }, "dependencies": { "mammoth": "^1.12.1" }, "devDependencies": { "@types/node": "^26.3.0" } }index.ts
import type { Context } from '@deepseek-ai/cordis' import { defineTool } from '@deepseek-ai/dsh-tools' import { CallId } from '@deepseek-ai/dsh-llm' export const name = 'xxxx' export const inject = ['tools'] export function apply(ctx: Context) { ....index.ts 中的name 应该和 cordis.patch.yml 中的 id一样
package.json中的name应该和 cordis.patch.yml 中的 name一样
如果从其它源码中下载,记得要先npm install, 不然可能会有 code: ‘ERR_MODULE_NOT_FOUND’ 之类的错误 , 在dsh web 开户时, plugin 的add 不会抛错