前言¶
DeepSeek Harness(dsh)已有 web UI,dsh-plugin-discord 的目標是讓 Discord 也能使用同一批 dsh 會話。如果你希望在 Discord 中發起或繼續 dsh 會話,或者讓腳本通過 Discord 推送通知,dsh-plugin-discord 提供了一個橋接層。
這是什麼¶
dsh-plugin-discord 是 DeepSeek Harness(dsh)的 Discord 橋接插件,owner 爲 ghbhiee,許可證爲 MIT,package.json 版本爲 0.6.0。
官方一句話描述是:
Discord bridge for DeepSeek Harness: chat with your dsh sessions from Discord, sharing the very same sessions with the web UI
也就是說,它把 allowlisted Discord users/channels 的消息接入 dsh 會話,並把 dsh 會話的回覆發回 Discord;同時提供主動通知 HTTP API 和 MCP endpoint。
核心功能¶
會話與消息¶
- allowlisted Discord users/channels 的消息會進入一個 dsh 會話。
- dsh 會話的回覆會返回 Discord。
- 插件會註冊 Discord slash commands:任意文本提示、
/new、/sessions、/use、/current、/stop、/help。
主動通知¶
- HTTP API 路徑:
/plugins/discord/api/notify - MCP endpoint 路徑:
/plugins/discord/mcp - 可使用配置關閉整個 notify surface:
notifyEnabled: false
內聯問題¶
ask_user_question可渲染爲 Discord inline components:select menu、modal free text、cancel button。- 該能力要求
dsh >= 0.1.1;在舊版 host 上,問題仍只在 web 端處理。
文件傳輸¶
- Agent 可在回覆中寫入
[discord-file: /absolute/path],用於發送文件到 Discord。 - Discord attachments 會保存到
.discord-uploads/。 - 文件上傳受會話工作目錄、配置項
uploadRoots和maxUploadBytes限制。
安裝與啓用¶
使用官方安裝命令,把插件安裝到 web profile:
dsh plugin --profile web add github:ghbhiee/dsh-plugin-discord
該命令安裝的是 github:ghbhiee/dsh-plugin-discord。
插件會以當前 dsh 進程權限運行;安裝前應檢查源碼與 MIT 許可證。
已覈實資料中提到 bot token 相關配置,並出現環境變量名 DSH_DISCORD_TOKEN,但對應說明被截斷,完整配置細節缺失;本文不展開具體 token 配置。
典型用法¶
發送主動通知¶
以下示例向本機 dsh 的 notify 接口發送一條通知:
curl -s -X POST http://127.0.0.1:3080/plugins/discord/api/notify \
-H "authorization: Bearer $(cat ~/.dsh/profiles/web/discord-notify.secret)" \
-H 'content-type: application/json' \
-d '{"content": "磁盤使用率 92%"}'
該接口默認是 loopback。若從遠程機器調用,需要 tunnel 或 reverse proxy。
Bearer secret¶
Bearer secret 會生成到 <profile dir>/discord-notify.secret;也可以覆蓋爲配置項 notifySecret 或環境變量 DSH_DISCORD_NOTIFY_SECRET。
示例使用的 web profile 路徑是:
~/.dsh/profiles/web/discord-notify.secret
MCP endpoint¶
如果客戶端使用 MCP,可把客戶端指向插件的 MCP endpoint。以下示例使用 claude CLI:
claude mcp add --transport http discord \
http://127.0.0.1:3080/plugins/discord/mcp \
--header "Authorization: Bearer $(cat ~/.dsh/profiles/web/discord-notify.secret)"
該示例演示把 MCP 客戶端指向 /plugins/discord/mcp。
文件傳輸¶
Agent 發送文件時,在回覆中寫入:
[discord-file: /absolute/path]
Discord 用戶發來的附件會保存到:
.discord-uploads/
上傳限制包括會話工作目錄、uploadRoots 和 maxUploadBytes。
適用場景與注意¶
適合:
- 從 Discord 使用 dsh 會話,並與 web UI 共享同一會話。
- 在 Discord 中處理
ask_user_question的選項、自由文本和取消操作。 - 通過
/plugins/discord/api/notify或/plugins/discord/mcp推送主動通知。 - 通過
[discord-file: /absolute/path]和.discord-uploads/做文件傳輸。
注意:
- 插件以當前 dsh 進程權限運行;安裝前應檢查源碼與許可證。
- 消息接入覆蓋 allowlisted Discord users/channels。
- notify endpoint 默認是 loopback;遠程調用需要 tunnel 或 reverse proxy。
- Bearer secret 位於
<profile dir>/discord-notify.secret,可用notifySecret或DSH_DISCORD_NOTIFY_SECRET覆蓋。 - 內聯問題要求
dsh >= 0.1.1;舊版 host 上問題留在 web 端。 - 文件上傳受會話工作目錄、
uploadRoots和maxUploadBytes限制。 - bot token 的完整配置說明不完整;使用前請覈對倉庫 README 與插件文檔。
結尾¶
dsh-plugin-discord 提供的是 Discord 與 dsh 會話之間的橋接,以及 Discord 主動通知通道。
倉庫地址:
https://github.com/ghbhiee/dsh-plugin-discord
本文未確認插件目錄頁 URL,因此不列出。