dsh-task-reminder
Verified@liangliang205/dsh-task-reminder · v0.2.5 · MIT · Web UI
Remind you when a DSH session task finishes or waits on you: branded Windows toast, audible cue, and an SRA-compatible webhook.
Install
dsh plugin add @liangliang205/dsh-task-reminder 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-task-reminder
会话完成、失败、被阻塞、等你授权、等你回答时提醒你:带 DeepSeek Harness 名字和图标的系统通知 + 提示音 + 可选 Webhook。你正看着窗口时不打扰。
DSH 插件 bundle,零改动 DSH 核心,可发布到 npm 后用 dsh plugin add 一键安装。
npm 包名:
@liangliang205/dsh-task-reminder(无 scope 的dsh-task-reminder被 npm 以“与dsh-taskreminder过于相似”拒绝)。
常见误解:为什么我测试时没弹出
不是时长问题,是焦点问题。 默认 onlyWhenBlurred: true,含义是「你在看这个窗口时只写日志、不弹通知」,所以:
| 场景 | 结果 |
|---|---|
| 短任务,结束时你还盯着窗口 | ❌ 不弹(门控判定你在前台) |
| 短任务,结束时你已经切走 | ✅ 弹 |
| 长任务,你全程盯着 | ❌ 不弹(心跳持续续期,40 秒后仍算你在看) |
任何任务,onlyWhenBlurred: false |
✅ 总是弹 |
想验证提醒功能本身,用这个配置(挂载即弹一条,且不考虑焦点):
- id: task-reminder
name: '@liangliang205/dsh-task-reminder'
config:
notifyOnStart: true
onlyWhenBlurred: false
verbose: true
想确认是不是被门控挡掉,测完立刻看状态端点:
curl http://127.0.0.1:<端口>/task-reminder/api/state
foreground: true 且 suppressed 从 0 涨到 1,就是门控在工作,不是插件坏了。
它会在提醒哪些时刻
| 时刻 | 判定依据(会话日志事件) | 文案 |
|---|---|---|
| 任务完成 | turn/end → reason.kind = completed |
DSH · 任务完成 |
| 任务失败 | turn/end → error(带错误摘要) |
DSH · 任务失败 |
| 被阻塞 | turn/end → blocked |
DSH · 等待你处理 |
| 等你授权 | approval/asked(同一 id 只提醒一次) |
DSH · 需要授权(带工具名与原因) |
| 等你回答 | tool/call 且工具是 ask_user_question |
DSH · 需要回答(带第一个问题) |
| 超限 / 中止 | turn/end → max-tokens / aborted |
可分别用配置关掉 |
forked、interrupted 不是真实的任务结束,永不提醒;子代理会话默认静默。
你正看着窗口时不打扰
浏览器侧(lib/client.js)把「页面可见 + 窗口有焦点」上报给 Host;Host 在收到报告后的 activeWindowMs(默认 45 秒)内认为你在前台,期间的提醒只写日志、不弹通知。页面失焦、切走、关闭都会立即上报。
- 失败开放:没有任何客户端报告时(比如 headless profile、页面还没加载),一律照常提醒——宁可吵,不可静默失效。
- 心跳:前台状态每 20 秒续期,页面崩溃后 45 秒自动过期,不会永久静音。
- 无浏览器构建:
lib/client.js直接以window.__ModuleLoader__形式手写,仓库里没有打包步骤。
诊断端点(仅回环/受信 host 可访问):
# 前台判定 + 抑制计数 + 最近一次投递结果
curl http://127.0.0.1:55543/task-reminder/api/state
# {"ok":true,"foreground":false,"clients":[...],"suppressed":2,"suppressedAt":1762..,
# "deliveries":5,"lastDelivery":{"event":"session.turn.completed","at":1762..,
# "channels":{"desktop":"ok","sound":"ok"}}}
字段含义:foreground 当前是否判定你在前台;suppressed 被前台门控挡掉的次数;suppressedAt 最近一次挡掉的时间;deliveries 实际投递次数;lastDelivery.channels 每个通道的结果(ok 或 error: …)。“没收到提醒”时先看这里:suppressed 在涨=门控在工作;lastDelivery.channels.desktop 报错=toast 通道失败;两者都没变=插件没收到 turn/end。
上报接口 POST /task-reminder/api/visibility 强制要求 content-type: application/json——跨站表单发不出这个头,浏览器的预检又不会被批准,所以第三方网页无法伪造"你在前台"。
和已有的 dsh-task-notify 什么关系
npm 上已经有 [email protected](Gitee: chy959799/dsh-task-notify),功能相近,所以本包换名发布,避免撞名。两者取舍不同:
| 能力 | 本包 dsh-task-reminder |
已有 dsh-task-notify |
|---|---|---|
| Windows 通知归属 | WinRT toast + com.deepseek.dsh AUMID,显示 DeepSeek Harness + DSH 图标 |
node-notifier(Windows 走 SnoreToast,需要额外可执行文件) |
| 提醒时刻 | 完成/失败/阻塞/阻塞授权/等待回答/超限/中止 | 完成 + 授权 + 提问 |
| 推送渠道 | ✅ 系统通知 + 提示音 + Webhook(固定 payload) | 仅系统通知 |
| 前台静默 | ✅ 可见 + 有焦点才算前台,超时自动过期 | ✅ 仅页面可见性 |
| 设置界面 | ❌ 只走 cordis.patch.yml(见下) |
✅ 设置页 |
| 运行时依赖 | 0(纯 Node + 系统能力) | node-notifier、schemastery |
一句话:要"推到手机/别的机器"或"原生 DSH 品牌通知"用这个;要图形化设置页用那个。
为什么暂时没有设置页
DSH 的设置页给插件投影的只有 schema 里标了 .volatile() 的字段(dsh-settings 的 form projection),而且要自带 React 客户端包注册 settings.section slot 才有完整界面。本包当前选择零依赖 + 零构建,所以配置走 profile 的 cordis.patch.yml;要图形化编辑,下一步是把配置改成 schemastery Config 并补一个 settings.section 客户端包。
安装
# 从 npm 安装(推荐)
dsh plugin --profile desktop add @liangliang205/dsh-task-reminder
# 本地路径(开发)
dsh plugin --profile desktop add D:\pr\dsh-task-reminder
也可以让 agent 用 plugin_manager 工具:install_bundle + 目标名或绝对路径。装完热生效,不用重启应用。
配置
默认值在 cordis.patch.yml。要改就在 profile 的 cordis.patch.yml 里按 id 覆盖;patch 会整体替换该行 config,没写的字段回落到插件内置默认值:
- id: task-reminder
name: '@liangliang205/dsh-task-reminder'
config:
onlyWhenBlurred: false # 不管你在不在看,都弹
minDurationMs: 8000 # 8 秒内的短任务不提醒
notifyOn: [completed, blocked]
webhookUrl: https://example.com/hook
| 字段 | 默认 | 含义 |
|---|---|---|
locale |
zh |
文案语言,zh / en |
desktop |
true |
系统通知:Windows toast / macOS 通知中心 / Linux notify-send |
sound |
true |
提示音;与通知同开时 toast 自身静音,避免响两声 |
onlyWhenBlurred |
true |
页面在前台时静默(失败开放) |
notifyOn |
全部 5 种 | 哪些 turn/end 原因提醒 |
notifyOnApproval |
true |
工具等待授权时提醒 |
notifyOnQuestion |
true |
agent 提问时提醒 |
minDurationMs |
0 |
短于此时长的任务不提醒(毫秒) |
includeSubagents |
false |
子代理会话是否也提醒 |
minGapMs |
1200 |
提醒之间的最小间隔 |
activeWindowMs |
45000 |
一次前台报告的有效期(毫秒) |
soundFile |
空 | 自定义提示音(.wav) |
toastAppId |
com.deepseek.dsh |
toast 归属的 AppUserModelID |
webhookUrl |
空 | 非空则 POST payload |
webhookTimeoutMs |
5000 |
Webhook 超时 |
notifyOnStart |
false |
挂载时先发一条"已开启",用于验证接线 |
verbose |
false |
每次提醒写一行日志 |
Webhook payload
字段风格对齐 StarRailAssistant 的通知数据包,现成的 webhook 消费端(Bark / Server酱 / n8n / OneBot)可以直接接:
{
"title": "DSH · 任务完成",
"event": "session.turn.completed",
"result": "success",
"timestamp": "2026-11-07 20:25:39",
"sessionId": "smoke-session",
"sessionTitle": "本地实现任务完成提醒",
"cwd": "D:\\pr\\deepseek-harness",
"durationMs": 74000,
"message": "会话任务已完成:本地实现任务完成提醒",
"detail": "1m 14s · deepseek-harness"
}
event 取值:session.turn.completed / session.turn.failed / session.turn.blocked / session.turn.cancelled / session.turn.max-tokens / session.approval.asked / session.question.asked;result 取值 success / failure / blocked / cancelled / truncated,其中"等你处理"的三类都是 blocked,便于消费端优先处理。
验证
node --test # 20 个行为测试:文案、配置校验、真实 HTTP webhook、子代理静默、
# 授权去重、提问解析、前台门控、路由鉴权、浏览器半体的上报与清理
node tools/notify-smoke.mjs # 手工触发一次真实通知(走生产代码路径)
npm pack --dry-run # 检查发布内容
发布
npm login # 必做一次
npm version patch # 0.2.0 → 0.2.1(首次发布 0.2.0 时不要执行)
npm publish --access public
两个踩过的坑:
- 首次发布会要求 2FA:邮件 OTP 型账号必须用带 Bypass two-factor authentication 的 granular token,登录验证码不能用于发布。注意 npm 已公告 2027 年 1 月起取消“token 直发”,之后要走
npm stage publish+ 网页 2FA 批准。 - 包名过近似会被拒:
dsh-task-reminder与已存在的dsh-taskreminder被判相似,因此发布在@liangliang205scope 下。
发布前确认:
dsh.bundle.patch指向cordis.patch.yml——DSH 认出"这是组合包"的唯一依据;dsh.client.platform = "web"且exports["./client"]存在——浏览器半体靠这两个才能被扫到并注入;files覆盖lib/、cordis.patch.yml、README.md、LICENSE。
想被 Discover 页发现,需要一个市场索引 JSON(格式 1,见 DSH 仓库 packages/util/plugin-market-index),托管后可让用户把自己的索引 URL 加进 Discover;进官方目录则要走 DSH 仓库的 PR。
已知限制
- 只验证了 Windows;macOS / Linux 分支按平台命令行写好,未真机跑过。
- 每个 turn 都提醒:一个任务被拆成多轮追问会提醒多次,还没按"整段任务"聚合。
- 应用退出后没有提醒:提醒由 host 进程内插件发出,没有后台守护。
- toast 依赖已注册的 AUMID:源码跑 Web 版或换机器时,要么用已安装的桌面版,要么把
toastAppId换成该机器上已注册的 AUMID,否则 Windows 会静默丢弃通知。 - 没有设置页:配置只走
cordis.patch.yml,见上文原因。 - 前台判定需要页面配合:页面没加载(例如刚启动还没打开窗口)时按"不在前台"处理,会照常提醒。