dsh-notify-say 0.5.8 → 0.5.10

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/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  > 本文件由 `tools/release-build.ps1` 从开发提交自动生成,**请勿手工编辑**。
4
4
  > 只列面向使用者的变更(新增功能与修复),不含内部维护提交。
5
5
 
6
+ ## v0.5.9 — 2026-11-26
7
+
8
+ - fix(ci): Node 20 静态 import globSync 导致 CI 连红四次,加 D20 判据锁住
9
+ - fix(toast): 收录 PR #4 的发通知身份探测,并修其致命顺序 bug
10
+
11
+ ## v0.5.8 — 2026-11-24
12
+
13
+ - feat(ps7): 统一到 PowerShell 7 —— 四层防呆 + C7 静态闸(ADR-0015)
14
+ - fix(ps7): 运行时脚本不再带 #Requires 7.0,测试按两解释器分工(踩坑 #494)
15
+ - feat(ps7): 用户 CLI notify-config.ps1 退回 5.1 兼容 —— 它随 npm 包发给用户,而 Windows 出厂只有 5.1
16
+ - fix(release): release.ps1 用 pwsh 启动 release-build.ps1,否则 0.5.8 发版第 3 步必挂
17
+
6
18
  ## v0.5.7 — 2026-11-23
7
19
 
8
20
  - fix(notify-say): #5 PTC/code-mode 下提问提醒永不触发(v0.5.7)
@@ -345,10 +357,3 @@
345
357
  - feat(notify): 空闲门——子代理/后台任务在跑时不再误报「任务完成」
346
358
  - feat(notify): v0.3.1 失败语音——error 回合播日语道歉语音
347
359
 
348
- ## 未发布
349
-
350
- - feat(ps7): 统一到 PowerShell 7 —— 四层防呆 + C7 静态闸(ADR-0015)
351
- - fix(ps7): 运行时脚本不再带 #Requires 7.0,测试按两解释器分工(踩坑 #494)
352
- - feat(ps7): 用户 CLI notify-config.ps1 退回 5.1 兼容 —— 它随 npm 包发给用户,而 Windows 出厂只有 5.1
353
- - fix(release): release.ps1 用 pwsh 启动 release-build.ps1,否则 0.5.8 发版第 3 步必挂
354
-
package/README.md CHANGED
@@ -88,7 +88,7 @@ D:\Program Files (x86)\DSH\profiles\desktop\package.json
88
88
 
89
89
  ## 快速开始
90
90
 
91
- 装好之后**什么都不用配就能用**:任务完成时会弹 Toast + 播自带音色。
91
+ 装好之后**什么都不用配就能用**:任务完成时会弹 Toast + 系统语音播报(Windows TTS,零下载开箱即用;想换日语/中文语音包可在设置页「声音来源」里切换)。
92
92
 
93
93
  想做更多,进 **DSH 设置 → 通知**:
94
94
 
@@ -570,7 +570,7 @@ Windows 自定义协议只能在插件**被加载时**注册/清理,而 DSH
570
570
  ## 开发
571
571
 
572
572
  <details>
573
- <summary>展开查看:跑测试(694 条)、测试分层、CI 与发版流程</summary>
573
+ <summary>展开查看:跑测试(705 条)、测试分层、CI 与发版流程</summary>
574
574
 
575
575
  ### 跑测试
576
576
 
@@ -581,7 +581,7 @@ npm run test:route # 需要 --import loader 的接线测试
581
581
  npm run test:audio-wire
582
582
  ```
583
583
 
584
- **694 条测试通过**(`test:all` 两段实测:主套件 640 = 604 passed + 36 skipped 需真实宿主;
584
+ **705 条测试通过**(`test:all` 两段实测:主套件 651 = 615 passed + 36 skipped 需真实宿主;
585
585
  route 注入段 54 = 53 passed + 1 skipped)。
586
586
  绝大多数是纯逻辑测试,克隆仓库后 `npm test` 即可跑。
587
587
 
package/dsh-notify.ps1 CHANGED
@@ -449,6 +449,60 @@ function Write-NotifyLog([string]$KindTag, [string]$Extra, [string]$Detail) {
449
449
  # 2026-09-25 样式统一:发通知身份改用官方壳 AUMID com.deepseek.dsh(来源名 "DeepSeek Harness"、
450
450
  # 角标随壳图标);备选未采用:desktop\assets\icon.png 做 appLogoOverride 角标(旧 ps1 2026-09-03 做法)。
451
451
  $xmlEscape = { param([string]$s) ([string]$s).Replace('&', '&amp;').Replace('<', '&lt;').Replace('>', '&gt;').Replace('"', '&quot;').Replace("'", '&apos;') }
452
+
453
+ # ── 发通知用的 AUMID 解析(2026-10-25)────────────────────────────────────
454
+ #
455
+ # 为什么要探测而不是写死:见调用处的注释 —— AUMID 没注册时 Toast 不报错,
456
+ # 只是把 AUMID 原文当应用名、且没有小图标,属于"静默降级",最难排查的那类。
457
+ #
458
+ # 为什么要缓存:本机实测 Get-StartApps 约 540ms,而 ps1 是**每条通知起一个进程**,
459
+ # 不缓存就等于每条通知都晚半秒出声。缓存文件 %LOCALAPPDATA%\dsh-notify-say\toast-aumid.txt
460
+ # 只有一行;删掉它即强制重新探测(换安装包或换机器后排查用)。
461
+ function Get-ToastAppId {
462
+ $cacheDir = Join-Path $env:LOCALAPPDATA 'dsh-notify-say'
463
+ $cacheFile = Join-Path $cacheDir 'toast-aumid.txt'
464
+
465
+ # 1) 缓存命中:0 成本
466
+ try {
467
+ if (Test-Path -LiteralPath $cacheFile) {
468
+ $cached = (Get-Content -LiteralPath $cacheFile -Raw -ErrorAction Stop).Trim()
469
+ if ($cached) { return @($cached) }
470
+ }
471
+ } catch { }
472
+
473
+ # 2) 探测:开始菜单里注册为「DeepSeek Harness」的那一项,AppID 就是 Windows
474
+ # 用来找图标与显示名的 AUMID。
475
+ $found = @()
476
+ try {
477
+ $hit = Get-StartApps -ErrorAction Stop |
478
+ Where-Object { $_.Name -match 'DeepSeek\s*Harness' -or $_.AppID -match 'deepseek' } |
479
+ Select-Object -First 1
480
+ if ($hit -and $hit.AppID) { $found += [string]$hit.AppID }
481
+ } catch { }
482
+
483
+ # 3) 兜底:历史写死的身份 + 借用身份。探测不到时行为与改动前完全一致。
484
+ $found += @('com.deepseek.dsh', 'Microsoft.Windows.Shell.RunDialog')
485
+
486
+ # 去重保序
487
+ $seen = @{}
488
+ $list = @()
489
+ foreach ($id in $found) {
490
+ if ($id -and -not $seen.ContainsKey($id)) {
491
+ $seen[$id] = $true
492
+ $list += $id
493
+ }
494
+ }
495
+
496
+ # 只缓存"探测成功"的结果;纯兜底不写缓存,避免一次探测失败被永久固化。
497
+ if ($list.Count -gt 2) {
498
+ try {
499
+ New-Item -ItemType Directory -Force -Path $cacheDir | Out-Null
500
+ Set-Content -LiteralPath $cacheFile -Value $list[0] -Encoding ASCII -NoNewline
501
+ } catch { }
502
+ }
503
+ return $list
504
+ }
505
+
452
506
  $titleXml = & $xmlEscape $Title
453
507
  $bodyXml = & $xmlEscape $Body
454
508
  # 第三行按需拼接:没有 -Detail 就不加 <text>,模板还是两行。
@@ -478,14 +532,25 @@ if ($SoundOnly -or $Preview) {
478
532
  $launchXml = (& $xmlEscape $toastLaunch)
479
533
  $xml.LoadXml("<toast activationType=`"protocol`" launch=`"$launchXml`"><visual><binding template=`"ToastGeneric`"><text>$titleXml</text><text>$bodyXml</text>$detailXml</binding></visual></toast>")
480
534
  $toast = New-Object Windows.UI.Notifications.ToastNotification $xml
481
- # 2026-09-25 样式统一:改用官方壳注册的 AUMID(Get-StartApps 实证 com.deepseek.dsh
482
- # 注册为 "DeepSeek Harness")→ 来源名与角标自动随壳;失败回退借用身份,保证通知不丢。
483
- try {
484
- [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier('com.deepseek.dsh').Show($toast)
485
- } catch {
486
- [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier('Microsoft.Windows.Shell.RunDialog').Show($toast)
535
+ # 2026-10-25:发通知身份改成**按本机实际注册的 AUMID 解析**,不再写死 com.deepseek.dsh。
536
+ #
537
+ # 为什么:官方壳的 AUMID 并非处处一致 —— 官方安装包注册 com.deepseek.dsh,
538
+ # 而 Electron 默认身份(开始菜单快捷方式里带的正是它)是 electron.app.<ProductName>。
539
+ # 一旦这里写死的那个没在本机注册,Windows 仍会收下 Toast(**不抛异常**,所以原有
540
+ # try/catch 兜不住),但会把 **AUMID 原文当应用名印上去、且画不出名字旁边的小图标**。
541
+ # 用户实测截图里标题行就是 "com.deepseek.dsh"。
542
+ #
543
+ # 解析顺序见 Get-ToastAppId:磁盘缓存 → Get-StartApps 里注册为「DeepSeek Harness」
544
+ # 的项 → 退回历史行为。缓存是必要的:本机实测 Get-StartApps 约 540ms,
545
+ # 每条通知都跑一次会让提示音明显滞后。
546
+ $toastAumids = @(Get-ToastAppId)
547
+ foreach ($toastAumid in $toastAumids) {
548
+ try {
549
+ [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($toastAumid).Show($toast)
550
+ $shown = $true
551
+ break
552
+ } catch { }
487
553
  }
488
- $shown = $true
489
554
  } catch { $shown = $false }
490
555
  }
491
556