@addozhang/dsh-discord

notifytested: passnpmMIT

Discord adapter that installs into a dsh web or desktop profile: @mentions and threads bind to sessions with streaming replies and live tool-activity rows, nine slash commands cover workspace binding, permission presets and model selection, and tool approvals and user questions are claimed by whiche

下载量 / Downloads
2,335
依赖体积 / node_modules
7.17 MB
测试时间 / Tested
2026-11-06
DSH 版本 / Version
0.2.2-rc.1

Install

dsh plugin --profile web add @addozhang/dsh-discord

Sandbox test results

StageResult
1 install✓
2 list✓
3 mount✓
4 boot—

Four stages run in an isolated sandbox: install (network on) → list → mount → boot (last three with no network).

README

@addozhang/dsh-discord

[English](README.md) | 中文

![npm](https://www.npmjs.com/package/@addozhang/dsh-discord)

![CI](https://github.com/addozhang/dsh-discord/actions/workflows/ci.yml)

![license](./LICENSE)

![node](./package.json)

![dshfind](https://dshfind.com/en/plugins/addozhang/dsh-discord?ref=badge)

DeepSeek Harness 的 Discord 优先适配器:在 Discord 服务器中运行 DSH 会话——@机器人下一个任务,线程即开,回答流式输出,审批与提问以按钮形式送到手机上,随手即可回应。

零额外进程:适配器是 DSH 插件,直接挂载到你的 dsh web profile。会话状态保存在 DSH,持久绑定保存在 profile 的存储域中。

<p align="center">

<img src="docs/images/discord-task-lifecycle.jpg" alt="一次任务的完整生命周期:@提及锚定线程、工具活动行随回答流式编辑、最终以 Markdown 表格落地" width="720">

</p>

功能

  • @提及驱动会话 — 在已绑定的频道中,被授权的 @机器人 <任务> 会锚定一个线程(你的消息成为首帖)、创建 DSH 会话,并且至多提交一次。线程内的后续消息无需 @ 即可排队。消息附带的图片会一并送达:在严格的大小与主机白名单约束下从 Discord CDN 下载,并作为 image parts 提交给多模态模型。
  • 流式渲染 — typing 指示、单条头消息原地编辑、逐工具活动行、代码围栏感知的长文分段、一次性收尾;Turn 结束时活动消息会被删除。
  • 审批与提问(双面) — DSH 的 ask 渲染为按钮、下拉菜单与自由文本弹窗,并同时镜像到 web/桌面端:两端先答先得,另一端的控件与卡片自动失效(无 web 客户端时 Discord 单独承载)。所有权强制校验(提问者——或后续 Turn 的线程属主——才能点击),超时清扫 fail-closed,结算后的控件原地置灰。
  • 会话控制 — /steer、/stop、/queue list|remove 带运行所有权校验;/project bind|list|info 与 /session resume 管理 Guild↔工作区绑定与历史会话;/guild forget 供操作员清理。
  • 模型切换 — /model show 读取会话的实时模型目录;/model select 走交互式 provider → 模型 → 推理强度级联,也可直接填写 provider/model 应用。默认对所有授权成员开放,可收紧为仅 Host 操作员。
  • 适配器状态 — /info 显示适配器版本、连接状态与项目链接(反馈/文档)。任意频道可用。
  • 权限切换 — /permission show / set 读写会话权限预设(沙箱 + 审批捆绑档位),走宿主自己的 /permission 命令路径,journal 自动记审计;danger-full-access 需按钮二次确认。
  • 设置卡片,开箱双语 — Token 引导与连接/断开(存入 Host 凭据服务,绝不写入设置或日志)、服务器白名单、自动归档与语言。所有 Discord 可见文案提供中英双语;Bot 默认跟随 DSH 语言偏好,也可从卡片固定。
  • 安全设计 — 显式服务器白名单内的 deny-first 授权。提及抑制双保险:每条请求携带 allowed_mentions,外加 wire body 的字节级提及中和。DSH 提交至多一次,并做保留 unknown 的对账——结果不明的投递绝不盲目重发。绑定重启后持久;READY 扫描会重建被删除的 category/控制频道,而把被删除的工作区频道视为用户意图(解除映射,workspace 保持可重新绑定)。

环境要求

  • dsh CLI(web profile)。dsh 与适配器的通道需匹配——见[版本支持](#版本支持)。
  • Node.js ^22.19.0 || >=24
  • 一个 Discord 应用(含 Bot 用户),并在开发者门户启用 MESSAGE CONTENT 特权 intent(Developer Portal → 你的应用 → Bot → Privileged Gateway Intents)

版本支持

两条通道并行发布,各自跟随经过真机验证的 dsh 宿主面。适配器与 dsh CLI 请取同一行:

通道 · 适配器 · dsh CLI · 安装命令

stable(0.2.1 线) · 0.6.6 — npm latest · 0.2.1-rc.3+ — npm latest/next · dsh plugin --profile web add @addozhang/dsh-discord

next(0.2.1 线) · >=0.6.5-rc.1 — npm next · 0.2.1-rc.3+ — npm latest/next · dsh plugin --profile web add @addozhang/dsh-discord@next

旧线(0.1.7) · 0.5.0 — 精确版本号 · 0.1.7-rc.1 — 精确版本号 · dsh plugin --profile web add @addozhang/dsh-discord@0.5.0

  • 适配器 0.6.5+ 不再随包携带任何 dsh 内部包:dsh-storage-domain 的声明辅助(defineDomain/domainTable)已内联进插件,宿主的 storageDomain 服务按结构化契约消费。因此 dsh CLI / Desktop 在 0.2.1 线内升级(含 0.2.1-rc.5 起生效的插件精确版本兼容门)不会再禁用本插件。宿主 API 面仍由 startup 探针守护——宿主缺少所需服务面时拒绝激活并给出一条可操作诊断。
  • 适配器 0.6.1–0.6.4 的存量安装注意: 这些版本把 dsh-storage-domain@0.2.1-rc.3 作为运行时依赖随包携带。dsh 0.2.1-rc.5 起宿主会禁用 profile 树中与运行时版本不精确匹配的插件行——被携带的副本盖住宿主副本后,storageDomain 服务随之消失,插件保持 pending(UI 里既无工作区也无会话,数据无损)。把适配器升级到 0.6.5+ 即修复;若曾在 profile 的 package.json 里手工添加过 @deepseek-ai/dsh-storage-domain 条目(一种临时缓解),请一并移除——否则下一次宿主升级它会自己撞上同一道门禁。
  • 更早的配对关系不变:适配器 0.6.0-rc.1 ↔ dsh 0.2.0-rc.2(dist-tags 已移到 0.2.1,两侧都只能精确版本号安装),适配器 0.5.0 同理反向钉在 0.1.7-rc.1 线;适配器 >=0.5.0-rc.4(含 0.5.0)使用 0.1.7 的 profile-backed settings forms 与控制器服务,在更旧的宿主上无法加载(startup 探针会给出一条可操作的诊断后拒绝激活);0.5.0-rc.1–rc.3 对应 dsh 0.1.6-alpha;适配器 0.4.x 使用旧版 apiProxy 宿主面(该面已在 0.1.6-alpha 中移除)——它仍是 dsh 0.1.5 stable 线的配对,可用精确版本号安装(如 @addozhang/dsh-discord@0.4.0)。
  • 切换 dsh CLI 通道:npm install -g @deepseek-ai/dsh@latest(0.2.1-rc.x,配适配器 0.6.5+)或 npm install -g @deepseek-ai/dsh@0.1.7-rc.1(配适配器 0.5.0)。
  • next 刚发版后,@next 规格可能解析到过期的缓存版本。若装到的版本偏旧,请改用精确版本号安装(如 @addozhang/dsh-discord@0.6.5-rc.1),并核对 profile node_modules 中的 version 字段。

安装

使用 dsh CLI 安装——它会自动把包装进 profile 并注册 bundle。下面是 stable 通道;next 通道使用[版本支持](#版本支持)表中的 @next 命令(up / rm 同规格):

dsh plugin --profile web add @addozhang/dsh-discord

然后重启 dsh web 并刷新浏览器。dsh plugin 会自动对账 profile 的 bundle 列表——无需手动编辑。

升级与卸载使用同一条命令:

dsh plugin --profile web up @addozhang/dsh-discord   # 升级;bundle 列表会重新对账
dsh plugin --profile web rm @addozhang/dsh-discord   # 卸载;先执行 /guild forget 清理适配器记录

如果不用 CLI、手工管理 profile,等价做法是在 profile 目录里用 pnpm 安装本包,并在 dsh.profile.bundles 中自行登记:

{
  "dsh": { "profile": { "bundles": ["@deepseek-ai/dsh-base", "@deepseek-ai/dsh-web-app", "@addozhang/dsh-discord"] } }
}

配置

全部配置项位于 dsh-discord 设置命名空间,既可以在设置卡片中修改,也可以直接编辑 profile 的用户设置(settings.yaml):

配置项 · 默认值 · 说明

enabled · false · 适配器总开关;卡片 Connect 在 Token 存入后启动。

allowedGuildIds · [] · 服务器白名单。白名单之外零响应、零 DSH 调用。

memberUserIds / memberRoleIds · [] · 白名单 Guild 内的成员级授权。

administratorUserIds / administratorRoleIds · [] · 工作区管理员级(/project bind)。

deniedUserIds / deniedRoleIds · [] · 拒绝名单;优先级高于上述一切授权。

hostOperatorUserIds · [] · Host 操作员(/guild forget;启用 modelSelectOperatorOnly 后也包括 /model select)。

modelSelectOperatorOnly · false · 将 /model select 限制为 Host 操作员(仅 settings.yaml,卡片不展示)。默认 false:任何授权成员均可切换,且切换仍会更新 Host 默认。

permissionSelectOperatorOnly · true · 将 /permission set 限制为 Host 操作员(仅 settings.yaml)。默认 true——比 /model 更严,因为「完全权限」会同时解除沙箱与审批;可放开为任何授权成员可切换。

defaultVerbosity · essential-tools · 工具活动行粒度:text-only、essential-tools、full-tools。

language · auto · Bot 可见文案语言:auto 跟随 DSH 语言偏好(非中文渲染英文),或固定 zh/en。

…(truncated)

Rendered from the README published on npm. Formatted only, not edited.

Versions

Published on npm::25,最后更新 2026-11-04

Links

GitHub · Homepage · npm

Same category