dsh-notify
DSH 会话桌面通知插件:仅在用户离开时,针对任务完成和用户提问发送系统通知。
AI 分析
核心用途是在后台运行长任务时,及时提醒用户智能体的最新状态。适合经常让 AI 执行耗时任务并切到其他窗口工作的用户。
安装
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:TARS-snail/dsh-notify说明文档
阅读完整 README ↗2. 安装进某个 profile(首次使用该 profile 会自动初始化)
dsh plugin --profile web add /path/to/DSH_remind
`dsh plugin` 检测到包声明了 `dsh.bundle` 后,会自动把它追加进该 profile 的 `dsh.profile.bundles` 层列表。重启该 profile(如 `dsh web`)后生效。
### 从 GitHub 安装
发布到仓库后:
```sh
dsh plugin --profile web add github:you/dsh-notify#
git 依赖安装时 pnpm 会执行 prepare 脚本(即 npm run build)自动构建 lib/;pnpm ≥ 10 需要你在 profile 目录的 pnpm-workspace.yaml 里允许执行构建脚本(首次 add 失败时 dsh 会打印确切的键):
allowBuilds:
dsh-notify: true
验证配置层(不启动)
dsh --profile web --patch /path/to/DSH_remind/cordis.patch.yml --dump-config
### 验证配置层(不启动)
```sh
dsh --profile web --patch /path/to/DSH_remind/cordis.patch.yml --dump-config
## 配置
默认零配置可用。在 profile 的 `cordis.patch.yml`(用户层)中按 id 覆盖该行:
```yaml
- id: notify
name: dsh-notify
config:
backend: notify-send
urgency: normal
expireMs: 10000
onTurnComplete: true
onGoalComplete: true
onUserQuestion: true
onlyQuestionsWithChoices: false
onlyWhenAway: true
presenceTtlMs: 45000
playSound: true
titlePrefix: DSH
previewMaxChars: 120
debounceMs: 1000
| 字段 | 类型 | 默认 | 说明 |
|---|---|---|---|
backend | auto | notify-send | console | command | auto | auto:有 notify-send 用桌面通知,否则降级控制台 |
command | string | '' | command 后端的命令模板,经 /bin/sh -c 执行;{title}、{message} 被替换,引号转义由命令作者负责 |
urgency | low | normal | critical | normal | notify-send 的紧急度 |
expireMs | number | 10000 | notify-send 展示时长(毫秒,0 = 常驻直到关闭) |
titlePrefix | string | DSH | 通知标题前缀 |
onTurnComplete | boolean | true | 一轮回答完成时通知 |
onGoalComplete | boolean | true | goal(长期任务)完成时通知 |
onUserQuestion | boolean | true | agent 提问时通知 |
onlyQuestionsWithChoices | boolean | false | 为 true 时只通知带选项(需选择)的问题 |
onlyWhenAway | boolean | true | 为 true 时,正在浏览该会话(当前标签页且窗口有焦点)就不弹通知;离开才弹 |
presenceTtlMs | number | 45000 | 浏览器上报的在场状态有效期(毫秒);标签页停止上报(崩溃/断连)后超过该时长即视为离开 |
playSound | boolean | true | 弹通知时播放系统默认提示音(canberra-gtk-play -i message → pw-play/paplay 兜底) |
previewMaxChars | number | 120 | 通知正文中回答摘要/目标内容的截断长度 |
debounceMs | number | 0 及以上 | 同类通知的最小间隔(毫秒),避免同一时刻连发多条 |
自定义命令示例(macOS):
config:
backend: command
command: 'osascript -e "display notification \"{message}\" with title \"{title}\""'