dsh-reminder-notify 0.12.1 → 0.14.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 CHANGED
@@ -42,6 +42,13 @@ dsh plugin --profile desktop add link:<本目录绝对路径>
42
42
  `json` 通用 webhook / `text` 纯文本;`pushDecide` 管「需要你来决定」要不要推,`pushDigest` 管日报要不要推。
43
43
  推送失败不影响桌面卡片,也不会拖慢 `notify_user`。
44
44
 
45
+ 0.13 起设置面板只放「要改的东西」:
46
+
47
+ - 顶部一行状态摘要(位置 · 秒数 · 提示音,开了推送/日报再各加一段)+ 三个「试试看」按钮(完成卡 / 决定卡 / 通用卡),
48
+ 点了就立刻弹一张样卡,二十秒自动关,不用等我真发。
49
+ - 常用两组直接展开:**基本**、**日报与推送**;其余四块(外观 / 提示音 / 排队与免打扰 / 历史·余额·宿主)收在「高级」里,点标题展开。
50
+ - 使用说明不再塞进面板,全部写在插件详情页(本插件的说明文档)里。
51
+
45
52
  ## 资产
46
53
 
47
54
  | 东西 | 位置 |
package/client.js CHANGED
@@ -252,6 +252,17 @@ window.__ModuleLoader__.load({
252
252
  groupQueue: '排队与免打扰',
253
253
  groupHistory: '历史与统计',
254
254
  groupDigest: '日报与推送',
255
+ // 0.13:高频项在前,其余收进折叠块;说明搬到插件详情页。
256
+ groupAdvanced: '高级:历史、余额与宿主',
257
+ foldExpand: '展开',
258
+ foldCollapse: '收起',
259
+ tryTitle: '试试看:',
260
+ tryDone: '发一张完成卡',
261
+ tryDecide: '发一张决定卡',
262
+ tryRaw: '发一张通用卡',
263
+ tryShown: '已经弹出一张样卡,20 秒后自动关闭。',
264
+ tryQuiet: '现在在免打扰时段,样卡被拦住了(正常行为)。',
265
+ tryFailed: '没能弹出示意卡:',
255
266
  speakEnabled: '朗读提醒内容',
256
267
  buttonsEnabled: '卡片显示按钮',
257
268
  snoozeMinutes: '「稍后提醒」延后分钟',
@@ -329,12 +340,39 @@ window.__ModuleLoader__.load({
329
340
  historyActionOk: '知道了',
330
341
  historyActionSnooze: '稍后提醒',
331
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;改完记得点最下面的「保存」。',
332
360
  })
333
361
 
334
362
  Object.assign(en, {
335
363
  groupQueue: 'Queue & quiet hours',
336
364
  groupHistory: 'History & stats',
337
365
  groupDigest: 'Digest & push',
366
+ groupAdvanced: 'Advanced: history, balance & host',
367
+ foldExpand: 'expand',
368
+ foldCollapse: 'collapse',
369
+ tryTitle: 'Try it:',
370
+ tryDone: 'Show a done card',
371
+ tryDecide: 'Show a decision card',
372
+ tryRaw: 'Show a plain card',
373
+ tryShown: 'A sample card is on screen; it closes itself in 20 seconds.',
374
+ tryQuiet: 'Quiet hours are active, so the sample was held back (expected).',
375
+ tryFailed: 'Could not show the sample: ',
338
376
  speakEnabled: 'Speak the reminder',
339
377
  buttonsEnabled: 'Show card buttons',
340
378
  snoozeMinutes: 'Snooze minutes',
@@ -411,7 +449,24 @@ window.__ModuleLoader__.load({
411
449
  historyActionDismiss: 'clicked',
412
450
  historyActionOk: 'got it',
413
451
  historyActionSnooze: 'snoozed',
414
- historyActionQuietSkip: 'quiet-skip',
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.',
415
470
  })
416
471
 
417
472
  const CSS = `
@@ -440,6 +495,16 @@ window.__ModuleLoader__.load({
440
495
  .drn-btn.small { padding: 5px 10px; white-space: nowrap; }
441
496
  .drn-msg { font-size: 12px; color: var(--dsw-alias-label-secondary); }
442
497
  .drn-msg.error { color: var(--dsw-alias-state-error-primary); }
498
+ .drn-summary { font-size: 12px; line-height: 1.55; color: var(--dsw-alias-label-secondary); border: 1px dashed var(--dsw-alias-border-l1); border-radius: 8px; padding: 8px 10px; }
499
+ .drn-try { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
500
+ .drn-try-title { font-size: 12px; color: var(--dsw-alias-label-secondary); }
501
+ .drn-fold { border: 1px solid var(--dsw-alias-border-l1); border-radius: 10px; background: var(--dsw-alias-bg-layer-1); }
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; }
503
+ .drn-fold-body { display: flex; flex-direction: column; gap: 12px; padding: 0 14px 14px; }
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; }
507
+ .drn-chevron { font-size: 11px; }
443
508
  `
444
509
 
445
510
  // 字段表:kind 决定控件类型,group 决定分组,缺省值来自宿主 config。
@@ -447,7 +512,7 @@ window.__ModuleLoader__.load({
447
512
  { key: 'seconds', group: 'basic', kind: 'number' },
448
513
  { key: 'position', group: 'basic', kind: 'select', options: ['br', 'center', 'tr'], optionLabels: ['positionBr', 'positionCenter', 'positionTr'] },
449
514
  { key: 'sound', group: 'basic', kind: 'boolean' },
450
- { key: 'cooldownMs', group: 'basic', kind: 'number' },
515
+ { key: 'cooldownMs', group: 'host', kind: 'number' },
451
516
  { key: 'doneAudio', group: 'audio', kind: 'text' },
452
517
  { key: 'decideAudio', group: 'audio', kind: 'text' },
453
518
  { key: 'rawAudio', group: 'audio', kind: 'text' },
@@ -561,6 +626,28 @@ window.__ModuleLoader__.load({
561
626
  const GROUPS = ['basic', 'audio', 'look', 'queue', 'history', 'digest', 'balance', 'host']
562
627
  const GROUP_LABELS = { basic: 'groupBasic', audio: 'groupAudio', look: 'groupLook', queue: 'groupQueue', history: 'groupHistory', digest: 'groupDigest', balance: 'groupBalance', host: 'groupHost' }
563
628
 
629
+ // 0.13:面板分两层。常用层只放「不填就不对劲」的项,其余按主题收进四个折叠块。
630
+ const COMMON_DIGEST = ['pushEnabled', 'pushUrl', 'pushFormat', 'digestEnabled', 'digestTime']
631
+ const ADV_DIGEST = ['digestTitle', 'digestIncludeBalance', 'digestAlertCount', 'pushDecide', 'pushDigest']
632
+ const ADV_BLOCKS = [
633
+ { id: 'look', label: 'groupLook', groups: ['look'] },
634
+ { id: 'audio', label: 'groupAudio', groups: ['audio'] },
635
+ { id: 'queue', label: 'groupQueue', groups: ['queue'] },
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' },
649
+ ]
650
+
564
651
  function sameValue(a, b) {
565
652
  return JSON.stringify(a) === JSON.stringify(b)
566
653
  }
@@ -585,6 +672,10 @@ window.__ModuleLoader__.load({
585
672
  const [historyBusy, setHistoryBusy] = React.useState(false)
586
673
  const [digest, setDigest] = React.useState(null)
587
674
  const [digestBusy, setDigestBusy] = React.useState(false)
675
+ // 0.13:折叠块的展开状态(默认全收起)与「试试看」的忙碌标记。
676
+ const [openBlocks, setOpenBlocks] = React.useState({})
677
+ const [tryBusy, setTryBusy] = React.useState(null)
678
+ const [helpOpen, setHelpOpen] = React.useState({})
588
679
 
589
680
  React.useEffect(() => {
590
681
  if (typeof fetch !== 'function') {
@@ -787,6 +878,52 @@ window.__ModuleLoader__.load({
787
878
  })
788
879
  }
789
880
 
881
+ // 0.13「试试看」:让宿主真的弹一张样卡(POST /preview,mode=card),
882
+ // 比读说明书更快知道每一档长什么样。样卡只停 20 秒,不改任何配置。
883
+ function tryCard(kind) {
884
+ if (tryBusy !== null) return
885
+ setTryBusy(kind)
886
+ setMessage(null)
887
+ Promise.resolve()
888
+ .then(() =>
889
+ fetch(PREVIEW_ROUTE, {
890
+ method: 'POST',
891
+ headers: { 'content-type': 'application/json', accept: 'application/json' },
892
+ body: JSON.stringify({ mode: 'card', kind }),
893
+ }),
894
+ )
895
+ .then((response) => {
896
+ const status = response ? response.status : 0
897
+ const body = response && typeof response.json === 'function' ? response.json() : Promise.resolve(null)
898
+ return Promise.resolve(body)
899
+ .catch(() => null)
900
+ .then((data) => {
901
+ if (response && response.ok && data && data.ok !== false) return data
902
+ const detail = data && (data.detail || data.error) ? (data.detail || data.error) : 'HTTP ' + status
903
+ throw new Error(detail)
904
+ })
905
+ })
906
+ .then((data) => {
907
+ setTryBusy(null)
908
+ const label = typeof t === 'function' ? t : (key) => key
909
+ const card = data && data.card ? data.card : {}
910
+ if (card.ok === false) {
911
+ setMessage({ ok: false, text: label('tryFailed') + String(card.detail || card.error || '') })
912
+ return
913
+ }
914
+ if (card.skipped === 'quiet') {
915
+ setMessage({ ok: true, text: label('tryQuiet') })
916
+ return
917
+ }
918
+ setMessage({ ok: true, text: label('tryShown') })
919
+ })
920
+ .catch((error) => {
921
+ setTryBusy(null)
922
+ const prefix = typeof t === 'function' ? t('tryFailed') : 'cannot show a sample: '
923
+ setMessage({ ok: false, text: prefix + String((error && error.message) || error) })
924
+ })
925
+ }
926
+
790
927
  // 余额:数字与「立即查询 / 重置基线」都走同一个路由(宿主侧问账号服务)。
791
928
  function shortTime(ms) {
792
929
  const n = Number(ms)
@@ -1072,8 +1209,11 @@ window.__ModuleLoader__.load({
1072
1209
  return input
1073
1210
  }
1074
1211
 
1075
- const groups = GROUPS.map((group) => {
1076
- const rows = FIELDS.filter((field) => field.group === group).map((field) =>
1212
+ // 一张分组卡片。allowed 有值时只渲染其中的键(用于把 digest 组拆成「常用」与「高级」两半)。
1213
+ const groupCard = (group, allowed, withExtras) => {
1214
+ const rows = FIELDS.filter(
1215
+ (field) => field.group === group && (allowed === undefined || allowed.includes(field.key)),
1216
+ ).map((field) =>
1077
1217
  h(
1078
1218
  'div',
1079
1219
  { className: 'drn-row', key: field.key },
@@ -1088,7 +1228,7 @@ window.__ModuleLoader__.load({
1088
1228
  h('div', { className: 'drn-control' }, control(field)),
1089
1229
  ),
1090
1230
  )
1091
- if (group === 'history') {
1231
+ if (withExtras !== false && group === 'history') {
1092
1232
  const label = typeof t === 'function' ? t : (key) => key
1093
1233
  rows.push(
1094
1234
  h(
@@ -1132,7 +1272,7 @@ window.__ModuleLoader__.load({
1132
1272
  )
1133
1273
  }
1134
1274
  }
1135
- if (group === 'digest') {
1275
+ if (withExtras !== false && group === 'digest') {
1136
1276
  const label = typeof t === 'function' ? t : (key) => key
1137
1277
  rows.push(
1138
1278
  h(
@@ -1149,19 +1289,19 @@ window.__ModuleLoader__.load({
1149
1289
  { className: 'drn-pick' },
1150
1290
  h(
1151
1291
  'button',
1152
- { type: 'button', className: 'drn-btn small', disabled: digestBusy, onClick: refreshDigest },
1292
+ { type: 'button', className: 'drn-btn drn-digest-btn', disabled: digestBusy, onClick: refreshDigest },
1153
1293
  label('digestRefresh'),
1154
1294
  ),
1155
1295
  h(
1156
1296
  'button',
1157
- { type: 'button', className: 'drn-btn small', disabled: digestBusy, onClick: sendDigest },
1297
+ { type: 'button', className: 'drn-btn drn-digest-btn', disabled: digestBusy, onClick: sendDigest },
1158
1298
  label(digestBusy ? 'digestSending' : 'digestSend'),
1159
1299
  ),
1160
1300
  ),
1161
1301
  ),
1162
1302
  )
1163
1303
  }
1164
- if (group === 'balance') {
1304
+ if (withExtras !== false && group === 'balance') {
1165
1305
  rows.push(
1166
1306
  h(
1167
1307
  'div',
@@ -1198,8 +1338,107 @@ window.__ModuleLoader__.load({
1198
1338
  h('div', { className: 'drn-group-title' }, typeof t === 'function' ? t(GROUP_LABELS[group]) : group),
1199
1339
  rows,
1200
1340
  )
1341
+ }
1342
+
1343
+ const label = typeof t === 'function' ? t : (key) => key
1344
+
1345
+ // 一句话状态:让人不开任何折叠就知道现在是「哪儿、多久、有没有声、推送/日报开没开」。
1346
+ const summaryText = () => {
1347
+ const posKey = values.position === 'center' ? 'positionCenter' : values.position === 'tr' ? 'positionTr' : 'positionBr'
1348
+ const sound = values.sound === false ? label('soundOff') : label('soundOn')
1349
+ const secs = values.seconds === undefined || values.seconds === null ? 60 : values.seconds
1350
+ const parts = [`${label(posKey)} · ${secs}${label('secondsUnit')} · ${sound}`]
1351
+ if (values.pushEnabled === true) {
1352
+ const fmt =
1353
+ values.pushFormat === 'serverchan'
1354
+ ? 'pushFormatServerchan'
1355
+ : values.pushFormat === 'json'
1356
+ ? 'pushFormatJson'
1357
+ : values.pushFormat === 'text'
1358
+ ? 'pushFormatText'
1359
+ : 'pushFormatWecom'
1360
+ parts.push(`${label('pushEnabled')} · ${label(fmt)}`)
1361
+ }
1362
+ if (values.digestEnabled === true) parts.push(`${label('digestEnabled')} · ${values.digestTime || '09:00'}`)
1363
+ return label('summaryPrefix') + parts.join(' · ')
1364
+ }
1365
+
1366
+ const common = [groupCard('basic'), groupCard('digest', COMMON_DIGEST, true)]
1367
+
1368
+ const advanced = ADV_BLOCKS.map((block) => {
1369
+ const open = openBlocks[block.id] === true
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
+ )
1404
+ return h(
1405
+ 'div',
1406
+ { className: 'drn-fold', key: 'fold-' + block.id },
1407
+ h(
1408
+ 'button',
1409
+ {
1410
+ type: 'button',
1411
+ className: 'drn-fold-head',
1412
+ onClick: () => setOpenBlocks(Object.assign({}, openBlocks, { [block.id]: !open })),
1413
+ },
1414
+ h('span', null, label(block.label)),
1415
+ h('span', { className: 'drn-chevron' }, open ? '▾ ' + label('foldCollapse') : '▸ ' + label('foldExpand')),
1416
+ ),
1417
+ h('div', { className: 'drn-fold-body', style: open ? undefined : { display: 'none' } }, children),
1418
+ )
1201
1419
  })
1202
1420
 
1421
+ const tryRow = h(
1422
+ 'div',
1423
+ { className: 'drn-try' },
1424
+ h('span', { className: 'drn-try-title' }, label('tryTitle')),
1425
+ h(
1426
+ 'button',
1427
+ { type: 'button', className: 'drn-btn drn-try-btn', disabled: tryBusy !== null, onClick: () => tryCard('done') },
1428
+ label('tryDone'),
1429
+ ),
1430
+ h(
1431
+ 'button',
1432
+ { type: 'button', className: 'drn-btn drn-try-btn', disabled: tryBusy !== null, onClick: () => tryCard('decide') },
1433
+ label('tryDecide'),
1434
+ ),
1435
+ h(
1436
+ 'button',
1437
+ { type: 'button', className: 'drn-btn drn-try-btn', disabled: tryBusy !== null, onClick: () => tryCard('raw') },
1438
+ label('tryRaw'),
1439
+ ),
1440
+ )
1441
+
1203
1442
  return h(
1204
1443
  'div',
1205
1444
  { className: 'drn-panel' },
@@ -1208,8 +1447,11 @@ window.__ModuleLoader__.load({
1208
1447
  { className: 'drn-head' },
1209
1448
  h('div', { className: 'drn-head-title' }, typeof t === 'function' ? t('title') : 'Desktop reminder settings'),
1210
1449
  h('div', { className: 'drn-head-intro' }, typeof t === 'function' ? t(writable ? 'intro' : 'readonly') : ''),
1450
+ h('div', { className: 'drn-summary' }, summaryText()),
1211
1451
  ),
1212
- groups,
1452
+ tryRow,
1453
+ common,
1454
+ advanced,
1213
1455
  h(
1214
1456
  'div',
1215
1457
  { className: 'drn-actions' },
package/docs/PUBLISH.md CHANGED
@@ -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.12.0**,装源为 **npm**(`dsh-reminder-notify@0.12.0`),不再是 git 固定提交 |
15
+ | 当前版本 | **0.12.1**,装源为 **npm**(`dsh-reminder-notify@0.12.1`),不再是 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,79 +1,12 @@
1
- # Desktop reminder (dsh-reminder-notify)
1
+ # Desktop reminder dsh-reminder-notify
2
2
 
3
- Adds a `notify_user` tool to DeepSeek Harness: when work is done (`kind=done`) or a decision is needed (`kind=decide`), a reminder card pops in the bottom-right with the matching voice — never stealing focus, auto-dismissing after N seconds.
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
- The card host is the bundled `host/ReminderHost.ps1`, drawn with the system PowerShell 5.1 + WinForms at run time, so the package ships no exe and is not blocked by SmartScreen or antivirus.
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
- ## Settings
7
+ ## How to use
8
8
 
9
- Open "Desktop reminder" in the Plugins page; the panel sits right under the description and has eight groups:
10
-
11
- - **Basics**: duration, position, sound on/off
12
- - **Sounds**: audio directory ("Browse…" picks a directory), the three per-kind file names (wav / mp3). Once a directory is picked the dropdown lists the audio files in it.
13
- - **Look**: background image, title icon, accent colours, title/message templates (`{title}` `{message}` `{kind}` `{time}`), plus per-kind overrides for background, icon and templates
14
- - **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
15
- - **History & stats**: record or not, entries kept, plus the total/today counts and the last 8 entries with "Refresh" and "Clear"
16
- - **Digest & push**: daily digest (switch, time, title, include balance, alert threshold) and phone push (switch, URL, format, whether decisions and the digest are pushed); the panel previews today's digest text and can send one right now
17
- - **Host**: script or exe host, script path, PowerShell path
18
-
19
- Changes apply on "Save" — no restart needed.
20
-
21
- - **DeepSeek balance**: enable, thresholds (20/10/5 % by default), check interval, spoken alerts; the panel can check now and set the current balance as the baseline
22
-
23
- ## Digest and phone push (0.12+)
24
-
25
- - **Daily digest**: with `digestEnabled` on, one card goes out after `digestTime` (default 09:00): how many reminders
26
- fired today, per kind, how they were handled, plus the current balance if `digestIncludeBalance` is on.
27
- `digestLastDate` keeps it to one per day; a missed day is not replayed.
28
- - **Volume alert**: with `digestAlertCount` above 0, one extra "a lot of reminders" card fires the first time today
29
- passes the threshold (`digestAlertDate` keeps it to once a day).
30
- - **Phone push**: `pushEnabled` + `pushUrl` + `pushFormat` — `wecom` (WeCom bot), `serverchan` (ServerChan),
31
- `json` (generic webhook), `text` (plain text). `pushDecide` and `pushDigest` decide whether decisions and the
32
- digest are pushed. Delivery is fire-and-forget: 8s timeout, failures only show up in the return value.
33
- Since 0.12.1 the `errcode` / `code` in the response is parsed, so a WeCom "invalid webhook url" (HTTP 200)
34
- counts as a failure, and "Send one now" reports the result or the reason in the panel.
35
-
36
- ## Card behaviour (0.11+)
37
-
38
- - **Queue**: one card at a time; later reminders wait in a queue (`queueEnabled` / `queueMax`) instead of stacking.
39
- - **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.
40
- - **Buttons**: "Got it" closes immediately; "Snooze" re-fires in `snoozeMinutes` (10 by default). Ignoring it just auto-closes.
41
- - **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.**
42
- - **Fullscreen fallback**: a narrower card is drawn when a fullscreen app is in front (`compactOnFullscreen`).
43
- - **Speech**: `speakEnabled` reads title and body through `System.Speech` (needs a Chinese voice pack).
44
- - **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.
45
-
46
- ## DeepSeek balance alerts
47
-
48
- The balance comes from the signed-in DSH account on this machine (host `deepseekAccount` service); no API key is needed.
49
-
50
- "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.
51
-
52
- Baseline rules (0.10.1):
53
-
54
- - **Recharge wallet only** — bonus credit is shown separately and never counted, so bonus expiry cannot fake a plunge;
55
- - the baseline stores the **account id and set time**: switching DeepSeek accounts resets it, and the panel shows `baseline ¥x (auto/manual · time)`;
56
- - 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;
57
- - when the balance cannot be read (signed out, service error) the last snapshot is kept and marked stale instead of being treated as ¥0.
58
-
59
- ## What was verified on a real machine (0.11.1 note)
60
-
61
- Verified on Windows 11 · PowerShell 5.1 · 3440×1440 at 125%:
62
-
63
- - **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.
64
- - **Merging**: the same kind inside the merge window returns `merged:true, count:2` with one joined body.
65
- - **Card buttons**: clicking "Got it" closes with `action:"ok"` and shows up in history (`elapsedMs:22413` on the real click).
66
- - **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.
67
- - **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.
68
- - **History**: `/dsh-reminder-notify/history` and the panel counters stay in sync, and `byAction` separates `timeout / ok / snooze / dismiss / quiet-skip`.
69
-
70
- Not verifiable from code:
71
-
72
- - 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.
73
- - 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.
74
-
75
- ## Known limits
76
-
77
- - Windows only (`os: ["win32"]`): the card host is WinForms.
78
- - Each card spawns a PowerShell process; `Add-Type` compilation takes about 0.6 s before the card appears.
79
- - 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.
package/docs/detail.zh.md CHANGED
@@ -1,83 +1,12 @@
1
1
  # 桌面提醒 dsh-reminder-notify
2
2
 
3
- 给 DeepSeek Harness 加一个 `notify_user` 工具:模型在任务收尾(`kind=done`)或征求同意之前(`kind=decide`)调用它,屏幕右下角弹出提醒卡片并播放对应语音,不抢焦点、按秒自动关闭。
3
+ 给 DeepSeek Harness 加一个 `notify_user` 工具:模型在任务收尾时弹「完成」卡,在要你拍板前弹「需要你来决定」卡,屏幕右下角、带语音、不抢焦点、按秒自动关闭。
4
4
 
5
- 卡片宿主是包内的 `host/ReminderHost.ps1`——用系统自带的 PowerShell 5.1 + WinForms 在运行期绘制,仓库里没有任何 exe,下载安装不会被 SmartScreen / 杀软拦。
5
+ 卡片由包内的 `host/ReminderHost.ps1` 用系统自带的 PowerShell 5.1 绘制,仓库里没有 exe,安装不会触发 SmartScreen。
6
6
 
7
- ## 设置
7
+ ## 怎么用
8
8
 
9
- 在「插件」页打开「桌面提醒」,描述下方就是设置面板,分八组:
10
-
11
- - **基本**:停留秒数、弹窗位置、是否播放提示音
12
- - **提示音**:提示音目录(可点「浏览…」选目录)、三档提示音文件名(wav / mp3),选了目录后下拉框会列出目录里的音频
13
- - **外观**:背景图、标题图标、强调色、标题/正文模板(`{title}` `{message}` `{kind}` `{time}`),以及每档位单独覆盖的背景 / 图标 / 模板
14
- - **排队与免打扰**:语音朗读、卡片按钮、「稍后提醒」分钟数、排队开关与上限、合并窗口、免打扰时段与处理方式、全屏时用紧凑卡片
15
- - **历史与统计**:是否记录、保留条数,面板里直接显示总条数 / 今日条数与最近 8 条记录,可「刷新」和「清空」
16
- - **日报与推送**:每日日报(开关、时间、标题、是否带余额、条数预警阈值)、手机推送(开关、地址、格式、「需要你来决定」与日报是否也推);面板里能预览今天的日报全文,也能「现在发一条」
17
- - **DeepSeek 余额**:开关、阈值(默认 20,10,5 %)、检查间隔、是否语音播报;面板里能「立即查询」,也能把当前余额设为基线
18
- - **宿主**:脚本模式或 exe 模式、脚本路径、PowerShell 路径
19
-
20
- 改完点「保存」,立刻生效,不用重启。
21
-
22
- ## 日报与手机推送(0.12 起)
23
-
24
- - **每日日报**:`digestEnabled` 打开后,每天在 `digestTime`(默认 09:00)之后的第一次检查里发一条,
25
- 内容 = 今天的条数、各档位数量、处理方式统计(自动关闭 / 知道了 / 稍后提醒 / 点掉了 / 免打扰跳过),
26
- 末尾可选附当前余额。用 `digestLastDate` 记住今天已发过,所以一天只发一条,关机错过不补。
27
- - **条数预警**:`digestAlertCount`(默认 0 = 关)大于 0 时,当天条数一旦超过阈值就额外弹一张
28
- 「提醒有点多」,一天只弹一次(`digestAlertDate`)。
29
- - **手机推送**:`pushEnabled` + `pushUrl` + `pushFormat` ——
30
- `wecom`(企业微信群机器人,`{"msgtype":"text",...}`)、`serverchan`(Server 酱,`{"title","desp"}`)、
31
- `json`(`{"title","message","kind","time"}`)、`text`(`标题\n正文` 纯文本)。
32
- `pushDecide` 控制「需要你来决定」是否推送,`pushDigest` 控制日报是否推送。
33
- 推送是 fire-and-forget:超时 8 秒、失败只记在返回值里,不影响卡片,也不阻塞 `notify_user`。
34
- 0.12.1 起会解析对方返回的 `errcode` / `code`:企业微信「webhook 地址不对」这类 HTTP 200 的失败也算失败,
35
- 面板上「现在发一条」会直接写出发送结果或失败原因。
36
-
37
- ## 提醒的行为(0.11 起)
38
-
39
- - **排队**:一次只显示一张卡,后来的进队列(`queueEnabled` / `queueMax`),不再一叠好几张。
40
- - **合并**:同档位在 `mergeWindowMs`(默认 3 秒)内再次触发,会并进排队中的那一条,正文按行拼起来、最多 600 字。
41
- - **按钮**:「知道了」立即关;「稍后提醒」把这条按 `snoozeMinutes`(默认 10)延后重弹。不点按钮就是到时自动关。
42
- - **免打扰**:`quietEnabled` 打开后,`quietStart`–`quietEnd`(支持跨零点)内不弹「完成」和普通提醒:
43
- `quietMode: hold` 留到时段结束后补弹,`skip` 直接丢弃;**「需要你来决定」任何时段都照弹**。
44
- - **全屏降级**:检测到前台是全屏应用时改画窄卡片,少挡内容(`compactOnFullscreen`)。
45
- - **语音朗读**:`speakEnabled` 用 `System.Speech` 念出标题与正文,需要系统装了中文语音包。
46
- - **历史**:每条提醒结束都会记一条(自动关闭 / 点了卡片 / 知道了 / 稍后提醒 / 免打扰跳过),
47
- 存在 `~/.dsh/dsh-reminder-notify/history.json`,超过 `historyLimit` 丢最旧的。
48
- 面板里能看到总计与今日条数、最近 8 条,也可以清空。
49
-
50
- ## DeepSeek 余额提醒
51
-
52
- 余额数据来自本机已登录的 DSH 账号(宿主 `deepseekAccount` 服务),不需要 API key。
53
-
54
- 「剩 20%」得有个分母,插件用的是**基线**:最近一次充值后的余额。第一次检查时把当前余额记为基线;之后余额比基线还高(说明刚充过值)就自动把基线抬上去并重新待命。余额跌到 基线 × 阈值% 以下就弹卡 +(可选)语音播报,同一档只报一次。
55
-
56
- 基线口径(0.10.1 起):
57
-
58
- - **只认「充值余额」**,赠送金单独显示、不计入百分比(否则赠送金到期清零会误报);
59
- - 基线绑定**账号身份与设定时间**,换 DeepSeek 账号会自动重来,面板上能看到「基线 ¥x(自动/手动 · 时间)」;
60
- - 刚充值/刚抬升基线的 **30 分钟内不播报**,并且要**连续两次查到低于阈值**才响,避免充值入账被冲正之类的抖动误报;
61
- - 查不到余额(未登录、接口失败)时保留上次结果,只显示过期提示,不会当成 0 元去喊。
62
-
63
- ## 各项功能的验证范围(0.11.1 记录)
64
-
65
- 真机(Windows 11 · PowerShell 5.1 · 屏幕 3440×1440 DPI 125%)跑过的:
66
-
67
- - **排队**:第一张卡没关时再调 `notify_user`,返回 `queued:true`、`position_in_queue:1`,卡片关掉后第二张自动顶上。
68
- - **合并**:同档位在合并窗口内再次触发,返回 `merged:true`、`count:2`,正文并成一条。
69
- - **卡片按钮**:点「知道了」会以 `action:"ok"` 关闭并记进历史(真机点过一次,`elapsedMs:22413`)。
70
- - **稍后提醒**:宿主回 `{"action":"snooze","snooze":N}` 之后,历史里第一次记 `snoozed:false`,N 分钟后再弹一次并记 `snoozed:true`。这条是用一个“立即返回 snooze”的假宿主脚本(`scriptPath` 指过去)验的,链路与真机点按钮走的是同一段代码。
71
- - **免打扰**:窗口内 `raw` 返回 `quiet:true`;`skip` 返回 `skipped:"quiet"` 且不弹;`hold` 会在窗口结束的那一刻补弹(实测 22:30–22:38 的窗口,卡片在 22:38:00 出现,历史 `quiet:true`);同一时段 `decide` 档 `quiet:false`,照常弹。
72
- - **历史与统计**:`/dsh-reminder-notify/history` 与面板的「共 N 条 · 今天 M 条」随每次关闭同步,`byAction` 能分开统计 `timeout / ok / snooze / dismiss / quiet-skip`。
73
-
74
- 没能自动验证的:
75
-
76
- - **合成点击点不到卡片**:卡片是 `WS_EX_NOACTIVATE` 的无焦点窗口,`mouse_event`、`PostMessage(WM_LBUTTONDOWN)` 都收不到(连 `MouseDown` 日志都没有),所以按钮只能由人手点。宿主自己的命中判定逻辑有单测覆盖。
77
- - **语音是否真的出声**:日志能确认 `-Speak` 传到了宿主、系统里也装了 `Microsoft Huihui Desktop (zh-CN)`,但没法从代码里确认扬声器里确实念了。
78
-
79
- ## 已知限制
80
-
81
- - 仅 Windows(`os: ["win32"]`):卡片宿主是 WinForms。
82
- - 每次弹卡片要起一个 PowerShell 进程,`Add-Type` 编译约 0.6 s 才出现。
83
- - 卡片随 DSH 宿主进程存活;DSH 关掉时正在显示的卡片也会一起消失。
9
+ - **只想改外观和停留时间**:改下面「基本」那一组,点「保存」就生效。
10
+ - **想马上看效果**:点「试试看」里的三个按钮,各弹一张样卡,20 秒自动关。
11
+ - **想推到手机**:在「日报与推送」里打开推送、选格式、填自己的 webhook 地址(企业微信机器人或 Server 酱),点「现在发一条」验证。
12
+ - **其余说明**:全部收在下面设置面板的「使用说明(点开才看)」里,一次只展开一条。
package/index.js CHANGED
@@ -978,6 +978,21 @@ function registerPreviewRoute(ctx, getSettings) {
978
978
  if (!['done', 'decide', 'raw'].includes(kind)) {
979
979
  return reply(res, 400, { ok: false, error: `unknown kind: ${kind}` })
980
980
  }
981
+ // 面板上的「试试看」:mode=card 时真的弹一张样卡,比只播提示音更能说明效果。
982
+ if (str(body?.mode, 'audio') === 'card') {
983
+ const settings = getSettings()
984
+ const sample = {
985
+ done: '这是一张「完成」卡:任务做完时这样弹,带提示音、按钮,到点自己消失。',
986
+ decide: '这是一张「需要你决定」卡:等你拍板时这样弹。',
987
+ raw: '这是一张通用提醒卡,标题和正文都由调用方给。',
988
+ }[kind]
989
+ const card = await notify(
990
+ kind,
991
+ { message: sample, seconds: Math.min(num(settings.seconds, 60), 20) },
992
+ { ...settings, quietEnabled: false },
993
+ )
994
+ return reply(res, 200, { ok: true, mode: 'card', kind, card })
995
+ }
981
996
  const result = await previewAudio(kind, getSettings())
982
997
  if (result.ok) return reply(res, 200, result)
983
998
  const status = result.error === 'no-audio' || result.error === 'audio-not-found' ? 400 : 500
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-reminder-notify",
3
- "version": "0.12.1",
3
+ "version": "0.14.0",
4
4
  "description": "DSH 桌面提醒插件:把「完成/需要决定」提醒变成 notify_user 工具(浮动卡片 + 提示音,不抢焦点,纯 PowerShell 源码宿主,仓库零 exe)",
5
5
  "author": "Jiangshuaiye1203",
6
6
  "type": "module",
@@ -48,8 +48,8 @@
48
48
  },
49
49
  "versions": [
50
50
  {
51
- "version": "0.12.0",
52
- "publishTimestamp": 1795186049,
51
+ "version": "0.13.0",
52
+ "publishTimestamp": 1795189754,
53
53
  "source": {
54
54
  "type": "npm"
55
55
  },