Skip to content

dsh-turn-notify

Verified

dsh-turn-notify · v0.1.7 · MIT · Web UI

DSH Web GUI turn-end reminder: on every agent turn end (complete/error/aborted) play a Web Audio two-tone chime and show a browser Notification; once per turn, deduped, no visible UI. One-command install: npx -y dsh-turn-notify

Install

dsh plugin add dsh-turn-notify

Confirm the layer applied with dsh --profile default --dump-config — see the install guide.

Source

Published to npm without a public repository. Inspect the package contents before installing.

Tags

Creators

Readme

dsh-turn-notify

DSH Web GUI 静态插件:每当 agent 的一个 turn 结束(正常完成 / 报错 / 中止), 在浏览器播放 880→1318.5Hz 双音"叮"(Web Audio,约 0.7s,峰值 0.25), 并弹一条浏览器 Notification(标题 "DSH:回合完成",tag dsh-turn-end 防重复堆叠)。

  • 每个 turn 只响一次;连续多个 turn 各响一次;turn 进行中绝不响;
  • 页签在后台(document.hidden)照常弹通知、照常出声;
  • 无可见 UI(组件渲染 null),不注入任何 CSS,不产生 DOM——对其它插件零样式影响;
  • 仅监听当前打开的会话。

安装(本 profile 内)

源码在 local-plugins/dsh-turn-notify(本文件所在目录),package.jsonfile: 依赖挂进 profile;profile 的 cordis.patch.yml 已插入行 {id: turn-notify, name: dsh-turn-notify}。 重启 dsh web 即生效——静态 composition 插件走信任面,无需审批、重启自动挂载

使用

激活后全自动,无需配置:

场景 表现
任一 turn 结束 双音叮 + 系统通知 "DSH:回合完成"
页面刚打开还没交互过 首次任意点击或按键即解锁音频(并顺带弹通知授权)
页签在后台 照常弹通知,声音也照常播

维护

  • 修改代码后直接改 local-plugins/dsh-turn-notify/lib/client.js 并重启 dsh web; node_modules/dsh-turn-notify 是运行期副本,pnpm install 会按 file: 依赖自动重建。
  • 分发给别人:把 local-plugins/dsh-turn-notify 整目录给对方,按对方 profile 的同样三处接线(package.json file: 依赖 + cordis.patch.yml 行 + node_modules 副本), 或将来发布 npm 后改成 registry 依赖。

实现要点

  • 客户端无 turn/end 事件 → 会话快照状态迁移判定: running(host agent/status 帧)+ turnEnds(Map<turn, turn/end seq>,host agent-loop finally 无条件写 turn/end,timeline 变化时重建新 Map 引用 → useSession 选择器可靠重渲染)。
  • 开火条件:armed(会话窗口首次 open 时以现有 turnEnds 为历史基线,重载/翻页不响) ∧ running===false ∧ 存在未通知条目;notified Set 按 turn 号去重;sessionId 变化复位。
  • UI 落点:conversation.composer.dock(list / session 级 / additive,渲染 null)。
  • 卸载时 close 懒创建的 AudioContext(ctx.effect),副作用全部可逆。