前言¶
寫 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:已抓取資料中未給出。