DeepSeek Harness 插件开发从入门到精通
最进看到的:https://www.wanxiangyundang.top/books/dsh-plugin-dev
总结的很到位 如何写一个DeepSeek Harness插件
这是官方develop/basic/index 教程的完整流程。
前提
从已完成从源码运行路径的仓库检出开始:
git clone https://github.com/deepseek-ai/deepseek-harness.git
cd deepseek-harness
pnpm install
第一步:创建本地项目
在仓库根目录:
mkdir -p scratch-plugin/src
第二步:写插件文件
创建scratch-plugin/src/my-plugin.ts:
import type { Context } from '@deepseek-ai/cordis'
export const name = 'hello-plugin'
export function apply(ctx: Context) {
// Required dependencies are ready before apply runs.
console.log('[hello-plugin] plugin loaded!')
}
第三步:注册到 cordis.yml
在仓库根目录运行pwd,然后创建scratch-plugin/cordis.yml,作为插入本地插件的 Web 覆盖层。把/absolute/path/to/deepseek-harness 替换成命令打印的路径:
- insert:
- id: hello
name: '/absolute/path/to/deepseek-harness/scratch-plugin/src/my-plugin.ts'
⚠插件路径必须是绝对路径。
patch 文件只贡献配置,不会改变 loader 解析模块路径时使用的 profile 目录。
第四步:带覆盖层启动
pnpm dsh web --patch ./scratch-plugin/cordis.yml
打开http://127.0.0.1:3080。启动期间,终端会打印:
[hello-plugin] plugin loaded!
这个流程教了什么
| 概念 | 含义 |
|---|---|
--patch overlay |
不改 profile 文件就能试插件 |
insert 动作 |
按 id 定位条目并插入新条目 |
| 绝对路径 | loader 相对 profile 目录解析模块 |
name 字段 |
指向插件入口文件 |
本文来自博客园,作者:半抹灯芯,转载请注明原文链接:https://www.cnblogs.com/wanxiangsucai/p/23464159

浙公网安备 33010602011771号
浙公网安备 33010602011771号