dsh-plugin-discord:把 DeepSeek Harness 会话接入 Discord

前言

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,许可证为 MITpackage.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/
  • 文件上传受会话工作目录、配置项 uploadRootsmaxUploadBytes 限制。

安装与启用

使用官方安装命令,把插件安装到 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/

上传限制包括会话工作目录、uploadRootsmaxUploadBytes

适用场景与注意

适合:

  • 从 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,可用 notifySecretDSH_DISCORD_NOTIFY_SECRET 覆盖。
  • 内联问题要求 dsh >= 0.1.1;旧版 host 上问题留在 web 端。
  • 文件上传受会话工作目录、uploadRootsmaxUploadBytes 限制。
  • bot token 的完整配置说明不完整;使用前请核对仓库 README 与插件文档。

结尾

dsh-plugin-discord 提供的是 Discord 与 dsh 会话之间的桥接,以及 Discord 主动通知通道。

仓库地址:

https://github.com/ghbhiee/dsh-plugin-discord

本文未确认插件目录页 URL,因此不列出。

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye