Back to home

Zhengshuji

dsh-sound-notifier

DSH(DeepSeek Harness)插件:在Web界面播放不同提示音,以提示Harness工作状态

Stars
0
Language
JavaScript
Created
Aug 15, 2026
Updated
Aug 15, 2026

Introduction

dsh-sound-notifier

Sound alerts for DeepSeek Harness (DSH): distinct chimes in the Web UI on message received, thinking start, tool call, and turn end.

DSH(DeepSeek Harness)插件:在 Web 界面中,于收到消息、开始思考、调用工具、回合结束四个关键节点播放不同的提示音。以官方 bundle 形式分发,随 DSH 启动自动加载,无需在会话内重复激活。

Features

  • 📩 收到消息 — 双音短提示(660Hz → 990Hz)
  • 💭 输出思考 — 上升滑音(392 → 784Hz,三角波)
  • 🛠 调用工具 — 清脆两下(233Hz → 311Hz,三角波)
  • 🏁 任务结束 — 大三和弦琶音(C5-E5-G5)
  • 🔇 子代理/工作流内部活动不响铃(仅顶层会话发声)
  • 💾 页面刷新不重播已播提示(sessionStorage 记录序号)
  • 🔊 提示音全部由 Web Audio API 合成,无需任何音频资源文件

工作原理

文件职责
Host 半index.js监听 DSH 事件 → 有界队列(上限 256 条)→ 经官方 webServer 服务暴露 GET /sound-alerts/events?after=N 轮询端点
Browser 半client.js标准 dsh.client 客户端插件,由 client-modules 注入 window.__DSH_BOOT__ 加载;每 400ms 同源 fetch 轮询端点,用 Web Audio 播放

事件对照:

节点触发事件
收到消息agent/inbox/inserted
开始思考llm/stream 中首次 reasoning-delta
调用工具tools/pre-execute
回合结束agent/turn-stopping

环境要求

  • DeepSeek Harness(源码 checkout 或安装版均可),Web 界面(dsh web / dsh --profile web
  • Node.js ≥ 22.19(DSH 自身要求)
  • pnpm(dsh plugin 子命令转发到 pnpm)

安装

deepseek-harness checkout 根目录执行:

pnpm dsh plugin --profile web add /path/to/dsh-sound-notifier

该命令会把本目录以 link: 形式安装进 ~/.dsh/profiles/web,并因 package.json 声明了 dsh.bundle 而自动把 dsh-sound-notifier 追加到该 profile 的 dsh.profile.bundles安装后重启 DSH 进程(停掉当前的 pnpm dsh web 再重新启动)即可生效。

验证组合(无需重启):

pnpm dsh --profile web --dump-config   # 应出现 "# == dsh-sound-notifier" 层与 sound-alerts 行

从 GitHub 安装(需在 profile 的 pnpm-workspace.yamlallowBuilds 放行 prepare 脚本,见官方 publish 文档):

pnpm dsh plugin --profile web add github:your-name/dsh-sound-notifier

卸载

pnpm dsh plugin --profile web remove dsh-sound-notifier

自定义提示音

编辑 client.js 中的 SOUNDS 表:

参数说明
freq起始频率(Hz)
endFreq滑音终点频率(Hz),缺省为无滑音
dur时长(秒)
type波形:sine / triangle / square / sawtooth
gain音量(0–1)
delay相对延迟(秒),用于排布多音

改完保存即生效(本地 link: 安装直接读取新文件),重启 DSH 进程后加载。

项目结构

dsh-sound-notifier/
├── package.json        # dsh.bundle + dsh.client manifest,exports ./client
├── cordis.patch.yml    # 插件行:{ id: sound-alerts, name: dsh-sound-notifier }
├── index.js            # Host 半(事件监听 + 队列 + 轮询端点)
├── client.js           # Browser 半(dsh.client bundle:轮询 + Web Audio)
├── src/                # 旧版动态插件源码(仅作临时激活参考,非安装路径)
├── manifest.json       # 插件元数据
└── README.md

已知限制

  • 轮询延迟:事件到发声最多约 400ms(轮询间隔)。
  • 端点路径固定/sound-alerts/events 由 Host 半的 webServer 路由提供;若部署未挂载 webserver,事件仍被记录但无人轮询。
  • 仅顶层会话发声agent.owner === undefined 过滤,单独打开子代理页面时其活动不响铃。
  • 内部 LLM 调用不响"思考"音compaction / session-title 目的被过滤。
  • 浏览器自动播放策略:首次发声前若无用户交互,浏览器可能挂起音频上下文;插件会在每次发声时自动 resume()

License

MIT