dsh-reminder-notify 0.13.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -0
- package/client.js +84 -4
- package/docs/PUBLISH.md +2 -2
- package/docs/detail.en.md +9 -82
- package/docs/detail.zh.md +8 -85
- package/index.js +41 -0
- package/package.json +1 -1
- package/publish/index.json +2 -2
package/README.md
CHANGED
|
@@ -85,3 +85,18 @@ dsh plugin --profile desktop add link:<本目录绝对路径>
|
|
|
85
85
|
- 仅 Windows(`os: ["win32"]`):卡片宿主是 WinForms。
|
|
86
86
|
- 每次弹卡片要起一个 PowerShell 进程,`Add-Type` 编译约 0.6 s 才出现(有轻微延迟,播放与动画照旧)。
|
|
87
87
|
- 卡片随 DSH 宿主进程存活;DSH 关掉时正在显示的卡片也会一起消失。
|
|
88
|
+
|
|
89
|
+
## 给别的插件用(0.15 起)
|
|
90
|
+
|
|
91
|
+
插件把整套提醒能力挂在宿主的一个服务上,别的插件不用自己起 PowerShell、也不用重复写排队与免打扰逻辑:
|
|
92
|
+
|
|
93
|
+
```js
|
|
94
|
+
const reminder = ctx.get('reminder') // 服务名固定为 reminder
|
|
95
|
+
await reminder.notify('decide', { message: '有个改动等你点头', seconds: 30 })
|
|
96
|
+
await reminder.digest({ force: true }) // 忽略「今天已发过」,立刻发一条日报
|
|
97
|
+
reminder.stats() // { total, today, byKind, byAction, last7 }
|
|
98
|
+
reminder.config() // 当前生效配置的只读副本
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
`notify()` 的 `kind` 与 `notify_user` 一致(`done` / `decide` / `raw`),其余参数同工具参数;调用同样受冷却、排队、合并、免打扰、历史记录约束。
|
|
102
|
+
|
package/client.js
CHANGED
|
@@ -340,6 +340,23 @@ window.__ModuleLoader__.load({
|
|
|
340
340
|
historyActionOk: '知道了',
|
|
341
341
|
historyActionSnooze: '稍后提醒',
|
|
342
342
|
historyActionQuietSkip: '免打扰跳过',
|
|
343
|
+
groupHelp: '使用说明(点开才看)',
|
|
344
|
+
helpIntro: '下面每条点开才看,平时不占地方。',
|
|
345
|
+
helpUse: '什么时候会弹',
|
|
346
|
+
helpUseText: '模型在任务收尾时发「完成」,在要你拍板前发「需要你来决定」,也可以直接用「普通」发任意一句话。你不需要手动触发。',
|
|
347
|
+
helpCard: '卡片上能做什么',
|
|
348
|
+
helpCardText: '「知道了」立刻关掉;「稍后提醒」过 N 分钟再弹一次(N 在设置里改);什么都不点就按停留秒数自动关闭。卡片不抢焦点,鼠标点一下也能关。',
|
|
349
|
+
helpQueue: '同时来好几条',
|
|
350
|
+
helpQueueText: '同一时间只显示一张,其余排队(上限在设置里改)。同档位在合并窗口内再次触发会并进排队那条,不重复弹。',
|
|
351
|
+
helpQuiet: '免打扰时段',
|
|
352
|
+
helpQuietText: '时段内不再弹「完成」和普通提醒:「需要你来决定」照常弹。处理方式可选「留到结束后补弹」或「直接跳过」。全屏时会自动换成窄卡片,少挡内容。',
|
|
353
|
+
helpDigest: '日报与手机推送',
|
|
354
|
+
helpDigestText: '打开日报后每天到点发一条,内容是当天条数与处理方式统计,可选带上余额。推送需要你自己的 webhook:企业微信机器人地址(格式选「企业微信机器人」)或 Server 酱的 sctapi.ftqq.com 地址(格式选「Server 酱」)。发失败时这里会写明原因。',
|
|
355
|
+
helpBalance: '余额提醒',
|
|
356
|
+
helpBalanceText: '用本机已登录的 DSH 账号查 DeepSeek 余额,低于阈值的百分比就提醒;基线是「最近一次充值后的余额」,赠送金不计入,刚充值后的 30 分钟内不播报。',
|
|
357
|
+
helpHost: '宿主与排查',
|
|
358
|
+
helpHostText: '卡片由包内 host/ReminderHost.ps1 用系统 PowerShell 绘制,没有 exe,所以不触发 SmartScreen。没有卡片时先按「试试看」三个按钮;还不行就检查宿主设置里的脚本路径,或在设置面板最下方看历史记录里有没有对应条目。',
|
|
359
|
+
helpTip: '完整说明在包内 docs/detail.zh.md;改完记得点最下面的「保存」。',
|
|
343
360
|
})
|
|
344
361
|
|
|
345
362
|
Object.assign(en, {
|
|
@@ -432,7 +449,24 @@ window.__ModuleLoader__.load({
|
|
|
432
449
|
historyActionDismiss: 'clicked',
|
|
433
450
|
historyActionOk: 'got it',
|
|
434
451
|
historyActionSnooze: 'snoozed',
|
|
435
|
-
historyActionQuietSkip: 'quiet
|
|
452
|
+
historyActionQuietSkip: 'skipped (quiet hours)',
|
|
453
|
+
groupHelp: 'How it works (expand to read)',
|
|
454
|
+
helpIntro: 'Each topic stays folded until you open it.',
|
|
455
|
+
helpUse: 'When a card appears',
|
|
456
|
+
helpUseText: 'The model fires "done" when a task finishes, "decide" before it needs your call, and can also send a plain "raw" message. You never trigger it by hand.',
|
|
457
|
+
helpCard: 'What the card can do',
|
|
458
|
+
helpCardText: '"Got it" closes it right away; "Snooze" brings it back after N minutes (configurable); doing nothing lets it auto-close after the stay time. The card never steals focus, and a click on it also dismisses it.',
|
|
459
|
+
helpQueue: 'Several at once',
|
|
460
|
+
helpQueueText: 'Only one card shows at a time, the rest queue up (limit is configurable). A repeat from the same kind inside the merge window joins the queued card instead of popping twice.',
|
|
461
|
+
helpQuiet: 'Quiet hours',
|
|
462
|
+
helpQuietText: 'Inside the window, "done" and raw reminders stay silent while "decide" still shows. Choose either "hold until it ends" or "skip it". On a full-screen app the card switches to a compact layout.',
|
|
463
|
+
helpDigest: 'Daily digest & phone push',
|
|
464
|
+
helpDigestText: 'With the digest on, one summary is sent each day: counts and how you handled them, optionally with the balance. Pushing needs your own webhook: a WeCom bot URL (format "WeCom bot") or a Server Chan sctapi.ftqq.com URL (format "Server Chan"). Failures are reported right here.',
|
|
465
|
+
helpBalance: 'Balance alerts',
|
|
466
|
+
helpBalanceText: 'Reads the DeepSeek balance through the signed-in DSH account and warns when it drops below a percentage of the baseline. The baseline is the balance right after your last top-up, bonus credit is excluded, and nothing fires within 30 minutes of a top-up.',
|
|
467
|
+
helpHost: 'Host & troubleshooting',
|
|
468
|
+
helpHostText: 'Cards are drawn by host/ReminderHost.ps1 with the built-in PowerShell, so there is no exe and no SmartScreen prompt. If nothing shows, press one of the three "try it" buttons first; then check the script path under host settings, or look for the entry in the history list at the bottom of this panel.',
|
|
469
|
+
helpTip: 'The full document ships in docs/detail.en.md. Remember to press "Save" at the bottom.',
|
|
436
470
|
})
|
|
437
471
|
|
|
438
472
|
const CSS = `
|
|
@@ -468,6 +502,8 @@ window.__ModuleLoader__.load({
|
|
|
468
502
|
.drn-fold-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; box-sizing: border-box; font: inherit; font-size: 12px; font-weight: 600; color: var(--dsw-alias-label-secondary); background: transparent; border: 0; padding: 10px 14px; cursor: pointer; text-align: left; }
|
|
469
503
|
.drn-fold-body { display: flex; flex-direction: column; gap: 12px; padding: 0 14px 14px; }
|
|
470
504
|
.drn-fold-body > .drn-group { border: 0; padding: 0; background: transparent; }
|
|
505
|
+
.drn-help { display: flex; flex-direction: column; gap: 8px; }
|
|
506
|
+
.drn-help-body { font-size: 12px; line-height: 1.6; color: var(--dsw-alias-label-secondary); white-space: pre-wrap; }
|
|
471
507
|
.drn-chevron { font-size: 11px; }
|
|
472
508
|
`
|
|
473
509
|
|
|
@@ -598,6 +634,18 @@ window.__ModuleLoader__.load({
|
|
|
598
634
|
{ id: 'audio', label: 'groupAudio', groups: ['audio'] },
|
|
599
635
|
{ id: 'queue', label: 'groupQueue', groups: ['queue'] },
|
|
600
636
|
{ id: 'misc', label: 'groupAdvanced', groups: ['digest', 'history', 'balance', 'host'] },
|
|
637
|
+
{ id: 'help', label: 'groupHelp', groups: [] },
|
|
638
|
+
]
|
|
639
|
+
|
|
640
|
+
// 0.14:说明收进面板里,按条目折叠。
|
|
641
|
+
const HELP_ITEMS = [
|
|
642
|
+
{ id: 'use', title: 'helpUse', body: 'helpUseText' },
|
|
643
|
+
{ id: 'card', title: 'helpCard', body: 'helpCardText' },
|
|
644
|
+
{ id: 'queue', title: 'helpQueue', body: 'helpQueueText' },
|
|
645
|
+
{ id: 'quiet', title: 'helpQuiet', body: 'helpQuietText' },
|
|
646
|
+
{ id: 'digest', title: 'helpDigest', body: 'helpDigestText' },
|
|
647
|
+
{ id: 'balance', title: 'helpBalance', body: 'helpBalanceText' },
|
|
648
|
+
{ id: 'host', title: 'helpHost', body: 'helpHostText' },
|
|
601
649
|
]
|
|
602
650
|
|
|
603
651
|
function sameValue(a, b) {
|
|
@@ -627,6 +675,7 @@ window.__ModuleLoader__.load({
|
|
|
627
675
|
// 0.13:折叠块的展开状态(默认全收起)与「试试看」的忙碌标记。
|
|
628
676
|
const [openBlocks, setOpenBlocks] = React.useState({})
|
|
629
677
|
const [tryBusy, setTryBusy] = React.useState(null)
|
|
678
|
+
const [helpOpen, setHelpOpen] = React.useState({})
|
|
630
679
|
|
|
631
680
|
React.useEffect(() => {
|
|
632
681
|
if (typeof fetch !== 'function') {
|
|
@@ -1318,9 +1367,40 @@ window.__ModuleLoader__.load({
|
|
|
1318
1367
|
|
|
1319
1368
|
const advanced = ADV_BLOCKS.map((block) => {
|
|
1320
1369
|
const open = openBlocks[block.id] === true
|
|
1321
|
-
const children = block.
|
|
1322
|
-
|
|
1323
|
-
|
|
1370
|
+
const children = block.id === 'help'
|
|
1371
|
+
? [
|
|
1372
|
+
h(
|
|
1373
|
+
'div',
|
|
1374
|
+
{ className: 'drn-help', key: 'help-list' },
|
|
1375
|
+
h('div', { className: 'drn-head-intro' }, label('helpIntro')),
|
|
1376
|
+
HELP_ITEMS.map((item) => {
|
|
1377
|
+
const opened = helpOpen[item.id] === true
|
|
1378
|
+
return h(
|
|
1379
|
+
'div',
|
|
1380
|
+
{ className: 'drn-fold', key: 'help-' + item.id },
|
|
1381
|
+
h(
|
|
1382
|
+
'button',
|
|
1383
|
+
{
|
|
1384
|
+
type: 'button',
|
|
1385
|
+
className: 'drn-fold-head',
|
|
1386
|
+
onClick: () => setHelpOpen(Object.assign({}, helpOpen, { [item.id]: !opened })),
|
|
1387
|
+
},
|
|
1388
|
+
h('span', null, label(item.title)),
|
|
1389
|
+
h('span', { className: 'drn-chevron' }, opened ? '▾ ' + label('foldCollapse') : '▸ ' + label('foldExpand')),
|
|
1390
|
+
),
|
|
1391
|
+
h(
|
|
1392
|
+
'div',
|
|
1393
|
+
{ className: 'drn-fold-body', style: opened ? undefined : { display: 'none' } },
|
|
1394
|
+
h('div', { className: 'drn-help-body' }, label(item.body)),
|
|
1395
|
+
),
|
|
1396
|
+
)
|
|
1397
|
+
}),
|
|
1398
|
+
h('div', { className: 'drn-head-intro' }, label('helpTip')),
|
|
1399
|
+
),
|
|
1400
|
+
]
|
|
1401
|
+
: block.groups.map((group) =>
|
|
1402
|
+
group === 'digest' ? groupCard('digest', ADV_DIGEST, false) : groupCard(group),
|
|
1403
|
+
)
|
|
1324
1404
|
return h(
|
|
1325
1405
|
'div',
|
|
1326
1406
|
{ className: 'drn-fold', key: 'fold-' + block.id },
|
package/docs/PUBLISH.md
CHANGED
|
@@ -4,7 +4,7 @@ DSH 的「插件市场 → 发现」页读的是**索引 URL**:一份 JSON(
|
|
|
4
4
|
索引本身不托管代码,只给出版本从哪儿装(`git` 仓库 + 固定提交,或 npm 包名)。
|
|
5
5
|
本目录的 `index.json` 由 `scripts/build-index.mjs` 生成,**不要手改**。
|
|
6
6
|
|
|
7
|
-
## 已发布状态(2026-11-
|
|
7
|
+
## 已发布状态(2026-11-21 更新)
|
|
8
8
|
|
|
9
9
|
| 项目 | 值 |
|
|
10
10
|
| --- | --- |
|
|
@@ -12,7 +12,7 @@ DSH 的「插件市场 → 发现」页读的是**索引 URL**:一份 JSON(
|
|
|
12
12
|
| 索引地址(他人添加这个) | `https://jiangshuaiye1203.github.io/dsh-reminder-notify/publish/index.json` |
|
|
13
13
|
| 站点首页 | https://jiangshuaiye1203.github.io/dsh-reminder-notify/ |
|
|
14
14
|
| npm 包 | https://www.npmjs.com/package/dsh-reminder-notify |
|
|
15
|
-
| 当前版本 | **0.
|
|
15
|
+
| 当前版本 | **0.14.0**,装源为 **npm**(`dsh-reminder-notify@0.14.0`),不再是 git 固定提交 |
|
|
16
16
|
| Pages | Deploy from a branch,`main` / `(root)` |
|
|
17
17
|
|
|
18
18
|
发新版(npm 源):改代码 → 升 `package.json` 版本 → `scripts\publish-npm.cmd` 发布到 npm →
|
package/docs/detail.en.md
CHANGED
|
@@ -1,86 +1,13 @@
|
|
|
1
|
-
# Desktop reminder
|
|
1
|
+
# Desktop reminder dsh-reminder-notify
|
|
2
2
|
|
|
3
|
-
Adds a `notify_user` tool to DeepSeek Harness:
|
|
3
|
+
Adds a `notify_user` tool to DeepSeek Harness: the model pops a "done" card when a task finishes and a "decide" card before it needs your call. Bottom-right corner, with sound, never steals focus, auto-closes on a timer.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Cards are drawn by the bundled `host/ReminderHost.ps1` with the built-in PowerShell 5.1, so the package ships no exe and never triggers SmartScreen.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## How to use
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
**
|
|
12
|
-
|
|
13
|
-
-
|
|
14
|
-
- **Try it** — three buttons (done card / decision card / plain card) so you can check position, colours and sound
|
|
15
|
-
without waiting for a real reminder. Each sample closes itself in 20 seconds
|
|
16
|
-
- **Save** / **Discard** at the bottom; saving applies immediately, no restart
|
|
17
|
-
|
|
18
|
-
**Common groups** (open by default)
|
|
19
|
-
|
|
20
|
-
- **Basics**: duration, position, sound on/off
|
|
21
|
-
- **Digest & push**: push switch, URL, format, digest switch, digest time; below it today's digest preview and a "send one now" button
|
|
22
|
-
|
|
23
|
-
**Advanced** (collapsed; click the header to expand)
|
|
24
|
-
|
|
25
|
-
- **Look**: background image, title icon, accent colours, title/message templates (`{title}` `{message}` `{kind}` `{time}`), plus per-kind overrides
|
|
26
|
-
- **Sounds**: audio directory ("Browse…"), the three per-kind file names (wav / mp3)
|
|
27
|
-
- **Queue & quiet hours**: spoken alerts, card buttons, snooze minutes, queue on/off and limit, merge window, quiet hours and their behaviour, compact card on fullscreen
|
|
28
|
-
- **History, balance & host**: history switch and kept entries (with counts, last 8 entries, refresh / clear), DeepSeek balance (thresholds, interval, spoken alerts, check now, set baseline), host (script or exe, script path, PowerShell path, per-kind cooldown)
|
|
29
|
-
|
|
30
|
-
## Digest and phone push (0.12+)
|
|
31
|
-
|
|
32
|
-
- **Daily digest**: with `digestEnabled` on, one card goes out after `digestTime` (default 09:00): how many reminders
|
|
33
|
-
fired today, per kind, how they were handled, plus the current balance if `digestIncludeBalance` is on.
|
|
34
|
-
`digestLastDate` keeps it to one per day; a missed day is not replayed.
|
|
35
|
-
- **Volume alert**: with `digestAlertCount` above 0, one extra "a lot of reminders" card fires the first time today
|
|
36
|
-
passes the threshold (`digestAlertDate` keeps it to once a day).
|
|
37
|
-
- **Phone push**: `pushEnabled` + `pushUrl` + `pushFormat` — `wecom` (WeCom bot), `serverchan` (ServerChan),
|
|
38
|
-
`json` (generic webhook), `text` (plain text). `pushDecide` and `pushDigest` decide whether decisions and the
|
|
39
|
-
digest are pushed. Delivery is fire-and-forget: 8s timeout, failures only show up in the return value.
|
|
40
|
-
Since 0.12.1 the `errcode` / `code` in the response is parsed, so a WeCom "invalid webhook url" (HTTP 200)
|
|
41
|
-
counts as a failure, and "Send one now" reports the result or the reason in the panel.
|
|
42
|
-
|
|
43
|
-
## Card behaviour (0.11+)
|
|
44
|
-
|
|
45
|
-
- **Queue**: one card at a time; later reminders wait in a queue (`queueEnabled` / `queueMax`) instead of stacking.
|
|
46
|
-
- **Merge**: the same kind fired again within `mergeWindowMs` (3 s by default) joins the queued entry — bodies are joined line by line, capped at 600 characters.
|
|
47
|
-
- **Buttons**: "Got it" closes immediately; "Snooze" re-fires in `snoozeMinutes` (10 by default). Ignoring it just auto-closes.
|
|
48
|
-
- **Quiet hours**: with `quietEnabled`, no "done" or plain reminders between `quietStart` and `quietEnd` (midnight crossing supported): `hold` delivers them after the window, `skip` drops them. **"Needs your call" always shows.**
|
|
49
|
-
- **Fullscreen fallback**: a narrower card is drawn when a fullscreen app is in front (`compactOnFullscreen`).
|
|
50
|
-
- **Speech**: `speakEnabled` reads title and body through `System.Speech` (needs a Chinese voice pack).
|
|
51
|
-
- **History**: every reminder result is appended (auto-close / card click / got it / snoozed / quiet-skip) to `~/.dsh/dsh-reminder-notify/history.json`, trimmed to `historyLimit`. The panel shows totals, the last 8 entries, and a Clear button.
|
|
52
|
-
|
|
53
|
-
## DeepSeek balance alerts
|
|
54
|
-
|
|
55
|
-
The balance comes from the signed-in DSH account on this machine (host `deepseekAccount` service); no API key is needed.
|
|
56
|
-
|
|
57
|
-
"20% left" needs a denominator, and the plugin uses a **baseline**: the balance right after the last top-up. The first check records the current balance as the baseline; if the balance later rises above it (a top-up), the baseline is raised automatically. When the balance falls below baseline × threshold%, the card pops (and optionally speaks), once per threshold.
|
|
58
|
-
|
|
59
|
-
Baseline rules (0.10.1):
|
|
60
|
-
|
|
61
|
-
- **Recharge wallet only** — bonus credit is shown separately and never counted, so bonus expiry cannot fake a plunge;
|
|
62
|
-
- the baseline stores the **account id and set time**: switching DeepSeek accounts resets it, and the panel shows `baseline ¥x (auto/manual · time)`;
|
|
63
|
-
- no alert for **30 minutes after a top-up**, and an alert needs **two consecutive readings** below the threshold, which filters out top-up reversals and similar jitter;
|
|
64
|
-
- when the balance cannot be read (signed out, service error) the last snapshot is kept and marked stale instead of being treated as ¥0.
|
|
65
|
-
|
|
66
|
-
## What was verified on a real machine (0.11.1 note)
|
|
67
|
-
|
|
68
|
-
Verified on Windows 11 · PowerShell 5.1 · 3440×1440 at 125%:
|
|
69
|
-
|
|
70
|
-
- **Queueing**: a second call while a card is open returns `queued:true, position_in_queue:1`, and it moves up once the first card closes.
|
|
71
|
-
- **Merging**: the same kind inside the merge window returns `merged:true, count:2` with one joined body.
|
|
72
|
-
- **Card buttons**: clicking "Got it" closes with `action:"ok"` and shows up in history (`elapsedMs:22413` on the real click).
|
|
73
|
-
- **Snooze**: when a host returns `{"action":"snooze","snooze":N}` the first record is `snoozed:false`, then the card returns N minutes later and records `snoozed:true`. Checked with a stub host that answers `snooze` immediately (`scriptPath` pointed at it) — same code path a real click takes.
|
|
74
|
-
- **Quiet hours**: `raw` inside the window returns `quiet:true`; `skip` returns `skipped:"quiet"` and shows nothing; `hold` re-fires exactly when the window ends (22:30–22:38 window, card appeared 22:38:00, history `quiet:true`); `decide` stays `quiet:false` and is never swallowed.
|
|
75
|
-
- **History**: `/dsh-reminder-notify/history` and the panel counters stay in sync, and `byAction` separates `timeout / ok / snooze / dismiss / quiet-skip`.
|
|
76
|
-
|
|
77
|
-
Not verifiable from code:
|
|
78
|
-
|
|
79
|
-
- Synthetic clicks cannot reach the card: it is a `WS_EX_NOACTIVATE` window, so `mouse_event` and `PostMessage(WM_LBUTTONDOWN)` never arrive (no `MouseDown` at all). Buttons need a human click; the hit-test maths is covered by unit tests.
|
|
80
|
-
- Whether speech is actually audible: logs prove `-Speak` reaches the host and `Microsoft Huihui Desktop (zh-CN)` is installed, but nothing can confirm the speaker played it.
|
|
81
|
-
|
|
82
|
-
## Known limits
|
|
83
|
-
|
|
84
|
-
- Windows only (`os: ["win32"]`): the card host is WinForms.
|
|
85
|
-
- Each card spawns a PowerShell process; `Add-Type` compilation takes about 0.6 s before the card appears.
|
|
86
|
-
- The card lives with the DSH host process; closing DSH closes a card that is still on screen.
|
|
9
|
+
- **Just want a different look or stay time**: change the "Basic" group below and press Save.
|
|
10
|
+
- **Want to see it now**: press one of the three "try it" buttons; a sample card closes itself after 20 seconds.
|
|
11
|
+
- **Want it on your phone**: open push under "Digest & push", pick the format, paste your own webhook URL (WeCom bot or Server Chan), then press "Send one now".
|
|
12
|
+
- **Everything else**: folded into "How it works (expand to read)" inside the settings panel below, one topic at a time.
|
|
13
|
+
- **For other plugins**: this plugin exposes a `reminder` service (`notify` / `digest` / `stats` / `config`); see the README.
|
package/docs/detail.zh.md
CHANGED
|
@@ -1,90 +1,13 @@
|
|
|
1
1
|
# 桌面提醒 dsh-reminder-notify
|
|
2
2
|
|
|
3
|
-
给 DeepSeek Harness 加一个 `notify_user`
|
|
3
|
+
给 DeepSeek Harness 加一个 `notify_user` 工具:模型在任务收尾时弹「完成」卡,在要你拍板前弹「需要你来决定」卡,屏幕右下角、带语音、不抢焦点、按秒自动关闭。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
卡片由包内的 `host/ReminderHost.ps1` 用系统自带的 PowerShell 5.1 绘制,仓库里没有 exe,安装不会触发 SmartScreen。
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## 怎么用
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
-
|
|
14
|
-
- 「试试看」三个按钮:**发一张完成卡 / 决定卡 / 通用卡**。二十秒后自动关,用来确认位置、配色、提示音是否合心意——不用等我真弹一张
|
|
15
|
-
- 「保存」/「放弃改动」在页面底部;保存即生效,不用重启
|
|
16
|
-
|
|
17
|
-
**常用的两组**(打开就能改)
|
|
18
|
-
|
|
19
|
-
- **基本**:停留秒数、弹窗位置、是否播放提示音
|
|
20
|
-
- **日报与推送**:推送开关、地址、格式、日报开关、日报时间;下面能预览今天的日报全文,也能「现在发一条」立刻试一次推送
|
|
21
|
-
|
|
22
|
-
**高级**(默认收起,点标题展开)
|
|
23
|
-
|
|
24
|
-
- **外观**:背景图、标题图标、强调色、标题/正文模板(`{title}` `{message}` `{kind}` `{time}`),以及每档位单独覆盖的背景 / 图标 / 模板
|
|
25
|
-
- **提示音**:提示音目录(可点「浏览…」选目录)、三档提示音文件名(wav / mp3),选了目录后下拉框会列出目录里的音频
|
|
26
|
-
- **排队与免打扰**:语音朗读、卡片按钮、「稍后提醒」分钟数、排队开关与上限、合并窗口、免打扰时段与处理方式、全屏时用紧凑卡片
|
|
27
|
-
- **历史、余额与宿主**:历史记录开关与保留条数(含统计与最近 8 条、刷新 / 清空)、DeepSeek 余额提醒(阈值、检查间隔、语音播报、立即查询、设为基线)、宿主(脚本或 exe 模式、脚本路径、PowerShell 路径、同档位冷却)
|
|
28
|
-
|
|
29
|
-
## 日报与手机推送(0.12 起)
|
|
30
|
-
|
|
31
|
-
- **每日日报**:`digestEnabled` 打开后,每天在 `digestTime`(默认 09:00)之后的第一次检查里发一条,
|
|
32
|
-
内容 = 今天的条数、各档位数量、处理方式统计(自动关闭 / 知道了 / 稍后提醒 / 点掉了 / 免打扰跳过),
|
|
33
|
-
末尾可选附当前余额。用 `digestLastDate` 记住今天已发过,所以一天只发一条,关机错过不补。
|
|
34
|
-
- **条数预警**:`digestAlertCount`(默认 0 = 关)大于 0 时,当天条数一旦超过阈值就额外弹一张
|
|
35
|
-
「提醒有点多」,一天只弹一次(`digestAlertDate`)。
|
|
36
|
-
- **手机推送**:`pushEnabled` + `pushUrl` + `pushFormat` ——
|
|
37
|
-
`wecom`(企业微信群机器人,`{"msgtype":"text",...}`)、`serverchan`(Server 酱,`{"title","desp"}`)、
|
|
38
|
-
`json`(`{"title","message","kind","time"}`)、`text`(`标题\n正文` 纯文本)。
|
|
39
|
-
`pushDecide` 控制「需要你来决定」是否推送,`pushDigest` 控制日报是否推送。
|
|
40
|
-
推送是 fire-and-forget:超时 8 秒、失败只记在返回值里,不影响卡片,也不阻塞 `notify_user`。
|
|
41
|
-
0.12.1 起会解析对方返回的 `errcode` / `code`:企业微信「webhook 地址不对」这类 HTTP 200 的失败也算失败,
|
|
42
|
-
面板上「现在发一条」会直接写出发送结果或失败原因。
|
|
43
|
-
|
|
44
|
-
## 提醒的行为(0.11 起)
|
|
45
|
-
|
|
46
|
-
- **排队**:一次只显示一张卡,后来的进队列(`queueEnabled` / `queueMax`),不再一叠好几张。
|
|
47
|
-
- **合并**:同档位在 `mergeWindowMs`(默认 3 秒)内再次触发,会并进排队中的那一条,正文按行拼起来、最多 600 字。
|
|
48
|
-
- **按钮**:「知道了」立即关;「稍后提醒」把这条按 `snoozeMinutes`(默认 10)延后重弹。不点按钮就是到时自动关。
|
|
49
|
-
- **免打扰**:`quietEnabled` 打开后,`quietStart`–`quietEnd`(支持跨零点)内不弹「完成」和普通提醒:
|
|
50
|
-
`quietMode: hold` 留到时段结束后补弹,`skip` 直接丢弃;**「需要你来决定」任何时段都照弹**。
|
|
51
|
-
- **全屏降级**:检测到前台是全屏应用时改画窄卡片,少挡内容(`compactOnFullscreen`)。
|
|
52
|
-
- **语音朗读**:`speakEnabled` 用 `System.Speech` 念出标题与正文,需要系统装了中文语音包。
|
|
53
|
-
- **历史**:每条提醒结束都会记一条(自动关闭 / 点了卡片 / 知道了 / 稍后提醒 / 免打扰跳过),
|
|
54
|
-
存在 `~/.dsh/dsh-reminder-notify/history.json`,超过 `historyLimit` 丢最旧的。
|
|
55
|
-
面板里能看到总计与今日条数、最近 8 条,也可以清空。
|
|
56
|
-
|
|
57
|
-
## DeepSeek 余额提醒
|
|
58
|
-
|
|
59
|
-
余额数据来自本机已登录的 DSH 账号(宿主 `deepseekAccount` 服务),不需要 API key。
|
|
60
|
-
|
|
61
|
-
「剩 20%」得有个分母,插件用的是**基线**:最近一次充值后的余额。第一次检查时把当前余额记为基线;之后余额比基线还高(说明刚充过值)就自动把基线抬上去并重新待命。余额跌到 基线 × 阈值% 以下就弹卡 +(可选)语音播报,同一档只报一次。
|
|
62
|
-
|
|
63
|
-
基线口径(0.10.1 起):
|
|
64
|
-
|
|
65
|
-
- **只认「充值余额」**,赠送金单独显示、不计入百分比(否则赠送金到期清零会误报);
|
|
66
|
-
- 基线绑定**账号身份与设定时间**,换 DeepSeek 账号会自动重来,面板上能看到「基线 ¥x(自动/手动 · 时间)」;
|
|
67
|
-
- 刚充值/刚抬升基线的 **30 分钟内不播报**,并且要**连续两次查到低于阈值**才响,避免充值入账被冲正之类的抖动误报;
|
|
68
|
-
- 查不到余额(未登录、接口失败)时保留上次结果,只显示过期提示,不会当成 0 元去喊。
|
|
69
|
-
|
|
70
|
-
## 各项功能的验证范围(0.11.1 记录)
|
|
71
|
-
|
|
72
|
-
真机(Windows 11 · PowerShell 5.1 · 屏幕 3440×1440 DPI 125%)跑过的:
|
|
73
|
-
|
|
74
|
-
- **排队**:第一张卡没关时再调 `notify_user`,返回 `queued:true`、`position_in_queue:1`,卡片关掉后第二张自动顶上。
|
|
75
|
-
- **合并**:同档位在合并窗口内再次触发,返回 `merged:true`、`count:2`,正文并成一条。
|
|
76
|
-
- **卡片按钮**:点「知道了」会以 `action:"ok"` 关闭并记进历史(真机点过一次,`elapsedMs:22413`)。
|
|
77
|
-
- **稍后提醒**:宿主回 `{"action":"snooze","snooze":N}` 之后,历史里第一次记 `snoozed:false`,N 分钟后再弹一次并记 `snoozed:true`。这条是用一个“立即返回 snooze”的假宿主脚本(`scriptPath` 指过去)验的,链路与真机点按钮走的是同一段代码。
|
|
78
|
-
- **免打扰**:窗口内 `raw` 返回 `quiet:true`;`skip` 返回 `skipped:"quiet"` 且不弹;`hold` 会在窗口结束的那一刻补弹(实测 22:30–22:38 的窗口,卡片在 22:38:00 出现,历史 `quiet:true`);同一时段 `decide` 档 `quiet:false`,照常弹。
|
|
79
|
-
- **历史与统计**:`/dsh-reminder-notify/history` 与面板的「共 N 条 · 今天 M 条」随每次关闭同步,`byAction` 能分开统计 `timeout / ok / snooze / dismiss / quiet-skip`。
|
|
80
|
-
|
|
81
|
-
没能自动验证的:
|
|
82
|
-
|
|
83
|
-
- **合成点击点不到卡片**:卡片是 `WS_EX_NOACTIVATE` 的无焦点窗口,`mouse_event`、`PostMessage(WM_LBUTTONDOWN)` 都收不到(连 `MouseDown` 日志都没有),所以按钮只能由人手点。宿主自己的命中判定逻辑有单测覆盖。
|
|
84
|
-
- **语音是否真的出声**:日志能确认 `-Speak` 传到了宿主、系统里也装了 `Microsoft Huihui Desktop (zh-CN)`,但没法从代码里确认扬声器里确实念了。
|
|
85
|
-
|
|
86
|
-
## 已知限制
|
|
87
|
-
|
|
88
|
-
- 仅 Windows(`os: ["win32"]`):卡片宿主是 WinForms。
|
|
89
|
-
- 每次弹卡片要起一个 PowerShell 进程,`Add-Type` 编译约 0.6 s 才出现。
|
|
90
|
-
- 卡片随 DSH 宿主进程存活;DSH 关掉时正在显示的卡片也会一起消失。
|
|
9
|
+
- **只想改外观和停留时间**:改下面「基本」那一组,点「保存」就生效。
|
|
10
|
+
- **想马上看效果**:点「试试看」里的三个按钮,各弹一张样卡,20 秒自动关。
|
|
11
|
+
- **想推到手机**:在「日报与推送」里打开推送、选格式、填自己的 webhook 地址(企业微信机器人或 Server 酱),点「现在发一条」验证。
|
|
12
|
+
- **其余说明**:全部收在下面设置面板的「使用说明(点开才看)」里,一次只展开一条。
|
|
13
|
+
- **给别的插件用**:本插件对外提供 `reminder` 服务(`notify` / `digest` / `stats` / `config`),写法见 README。
|
package/index.js
CHANGED
|
@@ -1579,7 +1579,48 @@ function registerHistoryRoute(ctx, getSettings) {
|
|
|
1579
1579
|
}, 'dsh-reminder-notify: history route')
|
|
1580
1580
|
}
|
|
1581
1581
|
|
|
1582
|
+
/** Host 服务名:别的插件用 ctx.get('reminder') 拿它。 */
|
|
1583
|
+
export const SERVICE_NAME = 'reminder'
|
|
1584
|
+
|
|
1585
|
+
function packageVersion() {
|
|
1586
|
+
try {
|
|
1587
|
+
return JSON.parse(fs.readFileSync(path.join(PACKAGE_ROOT, 'package.json'), 'utf8')).version
|
|
1588
|
+
} catch {
|
|
1589
|
+
return null
|
|
1590
|
+
}
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1593
|
+
/**
|
|
1594
|
+
* 0.15 起对外提供的服务:让别的插件也能发提醒、发日报、读统计,而不用自己起宿主。
|
|
1595
|
+
* 全部方法是 fire-and-forget 语义(返回 Promise,失败只在返回值里体现),不会抛给调用方。
|
|
1596
|
+
*/
|
|
1597
|
+
export function serviceOf(ctx, getSettings) {
|
|
1598
|
+
return {
|
|
1599
|
+
name: 'dsh-reminder-notify',
|
|
1600
|
+
version: packageVersion(),
|
|
1601
|
+
/** 发一张提醒卡。kind: done | decide | raw;options 同 notify_user 的参数。 */
|
|
1602
|
+
notify: (kind, options = {}) => notify(nodeKind(kind), options || {}, getSettings()),
|
|
1603
|
+
/** 立刻发一条日报(force: true 时忽略「今天已经发过」和「日报未开启」)。 */
|
|
1604
|
+
digest: (options = {}) => runDigest(ctx, getSettings, { force: (options || {}).force === true }),
|
|
1605
|
+
/** 提醒历史统计(不弹卡、不写文件)。 */
|
|
1606
|
+
stats: () => historyStats(readHistory(getSettings())),
|
|
1607
|
+
/** 当前生效的配置快照(只读副本)。 */
|
|
1608
|
+
config: () => ({ ...getSettings() }),
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1612
|
+
function nodeKind(kind) {
|
|
1613
|
+
return kind === 'decide' || kind === 'raw' ? kind : 'done'
|
|
1614
|
+
}
|
|
1615
|
+
|
|
1582
1616
|
export function apply(ctx, config) {
|
|
1617
|
+
const getSettings = () => settingsOf(config)
|
|
1618
|
+
if (typeof ctx.provide === 'function') {
|
|
1619
|
+
// 服务在 apply 里一次性注册;ctx.provide 自己挂在本 fiber 上,插件卸载时会自动回收。
|
|
1620
|
+
ctx.provide(SERVICE_NAME, serviceOf(ctx, getSettings))
|
|
1621
|
+
} else {
|
|
1622
|
+
ctx.logger?.warn?.('dsh-reminder-notify: ctx.provide is unavailable, the reminder service was not provided')
|
|
1623
|
+
}
|
|
1583
1624
|
registerAudioRoute(ctx, () => settingsOf(config))
|
|
1584
1625
|
registerConfigRoute(ctx, () => settingsOf(config))
|
|
1585
1626
|
registerPreviewRoute(ctx, () => settingsOf(config))
|
package/package.json
CHANGED