dsh-speak 1.7.2 → 1.7.4
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 +8 -3
- package/README.zh-CN.md +5 -1
- package/adapters/dsh/install.ps1 +1 -1
- package/engine/speak.ps1 +6 -1
- package/engine/speak.sh +3 -1
- package/engine/speech-prompt.ps1 +1 -1
- package/engine/speech-summary.ps1 +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -71,9 +71,14 @@ Windows:
|
|
|
71
71
|
|
|
72
72
|
- Windows 10 or 11, PowerShell (any recent version).
|
|
73
73
|
- Natural voices:
|
|
74
|
-
- **Windows 11**: natural voice packs are built into the system —
|
|
75
|
-
installation. Enable/switch them in *Settings → Accessibility →
|
|
76
|
-
*Settings → Time & Language → Speech*.
|
|
74
|
+
- **Windows 11 (21H2–23H2)**: natural voice packs are built into the system —
|
|
75
|
+
no extra installation. Enable/switch them in *Settings → Accessibility →
|
|
76
|
+
Narrator* or *Settings → Time & Language → Speech*.
|
|
77
|
+
- **Windows 11 24H2/25H2**: natural voices moved to MSIX app packages, which
|
|
78
|
+
`System.Speech` may not enumerate (falls back to a robotic stock voice). As
|
|
79
|
+
on Windows 10, install
|
|
80
|
+
[NaturalVoiceSAPIAdapter](https://github.com/gexgd0419/NaturalVoiceSAPIAdapter)
|
|
81
|
+
to bridge them.
|
|
77
82
|
- **Windows 10**: install
|
|
78
83
|
[NaturalVoiceSAPIAdapter](https://github.com/gexgd0419/NaturalVoiceSAPIAdapter)
|
|
79
84
|
and use its VoiceDownloader to download the natural voice pack(s) you want
|
package/README.zh-CN.md
CHANGED
|
@@ -64,8 +64,12 @@ harness 事件(DSH 会话事件 / Claude Code Stop hook / 任意方式)
|
|
|
64
64
|
|
|
65
65
|
- Windows 10 或 11,任意较新的 PowerShell。
|
|
66
66
|
- 自然语音:
|
|
67
|
-
- **Windows 11
|
|
67
|
+
- **Windows 11(21H2–23H2)**:系统已内置自然语音包,无需额外安装——在
|
|
68
68
|
*设置 → 辅助功能 → 讲述人* 或 *设置 → 时间和语言 → 语音* 中启用/切换即可。
|
|
69
|
+
- **Windows 11 24H2/25H2**:自然语音已改为 MSIX 应用包,`System.Speech` 可能
|
|
70
|
+
枚举不到(`SpeechSynthesizer` 找不到自然语音、回退到机械音)——与 Windows 10
|
|
71
|
+
相同,需安装 [NaturalVoiceSAPIAdapter](https://github.com/gexgd0419/NaturalVoiceSAPIAdapter)
|
|
72
|
+
桥接。
|
|
69
73
|
- **Windows 10**:需要安装
|
|
70
74
|
[NaturalVoiceSAPIAdapter](https://github.com/gexgd0419/NaturalVoiceSAPIAdapter),
|
|
71
75
|
并用它的 VoiceDownloader 手动下载你需要的中文或其他语言的自然语音包。
|
package/adapters/dsh/install.ps1
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# install.ps1 — one-command installer for the DSH adapter
|
|
1
|
+
# install.ps1 — one-command installer for the DSH adapter
|
|
2
2
|
# ========================================================
|
|
3
3
|
# 1. copies engine/*.ps1 to ~/.dsh/hooks/
|
|
4
4
|
# 2. copies speech-hook.js to ~/.dsh/profiles/web/plugins/
|
package/engine/speak.ps1
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# speak.ps1 — Harness-agnostic speech engine (Windows SAPI5 + NaturalVoiceSAPIAdapter)
|
|
1
|
+
# speak.ps1 — Harness-agnostic speech engine (Windows SAPI5 + NaturalVoiceSAPIAdapter)
|
|
2
2
|
# ====================================================================================
|
|
3
3
|
# Reads text (inline or from a UTF-8 file), cleans it for speech synthesis, and reads
|
|
4
4
|
# it aloud through Windows SAPI5, preferring natural voices registered by
|
|
@@ -68,7 +68,12 @@ if (-not $fullReadMode -and $text.Length -gt $MaxChars -and $LongTextMode -eq 'h
|
|
|
68
68
|
$candidate = ''
|
|
69
69
|
$bestLevel = 7
|
|
70
70
|
$firstNonEmpty = ''
|
|
71
|
+
# 代码块 fence 内的行跳过:其中的 "# 注释" 不是 markdown 标题,
|
|
72
|
+
# 否则长回复里的代码注释会被误当成标题只念注释
|
|
73
|
+
$inCodeBlock = $false
|
|
71
74
|
foreach ($line in ($text -split "`n")) {
|
|
75
|
+
if ($line -match '^\s*```') { $inCodeBlock = -not $inCodeBlock; continue }
|
|
76
|
+
if ($inCodeBlock) { continue }
|
|
72
77
|
if ($line -match '^\s*#{1,6}\s+') {
|
|
73
78
|
$level = ([regex]::Match($line, '^(\s*)(#+)')).Groups[2].Value.Length
|
|
74
79
|
if ($level -lt $bestLevel) {
|
package/engine/speak.sh
CHANGED
|
@@ -56,8 +56,10 @@ fi
|
|
|
56
56
|
# -F (full read, manual replay) skips this guard entirely.
|
|
57
57
|
if [ "$FULL_READ" != "1" ] && [ "$MAX_CHARS" -gt 0 ] && [ "${#TEXT}" -gt "$MAX_CHARS" ] && [ "$LONG_MODE" = "heading" ]; then
|
|
58
58
|
TEXT=$(printf '%s' "$TEXT" | /usr/bin/perl -CSD -e '
|
|
59
|
-
my $best = 7; my $cand = ""; my $first = "";
|
|
59
|
+
my $best = 7; my $cand = ""; my $first = ""; my $inCode = 0;
|
|
60
60
|
while (<STDIN>) {
|
|
61
|
+
if (/^\s*```/) { $inCode = !$inCode; next; } # 跳过代码块内的 "# 注释"
|
|
62
|
+
next if $inCode;
|
|
61
63
|
if (/^[ \t]*(\#{1,6})[ \t]+(.*)$/) { my $n = length($1); if ($n < $best) { $best = $n; $cand = $2; } }
|
|
62
64
|
elsif ($first eq "" && /\S/) { $first = $_; }
|
|
63
65
|
}
|
package/engine/speech-prompt.ps1
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# speech-prompt.ps1 — Short prompt announcement (synchronous, blocking)
|
|
1
|
+
# speech-prompt.ps1 — Short prompt announcement (synchronous, blocking)
|
|
2
2
|
# Use when a harness/agent needs the user's attention (a question, an approval
|
|
3
3
|
# request). Reads the text through engine/speak.ps1 and waits until it finishes,
|
|
4
4
|
# so the caller knows the announcement was actually spoken.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# speech-summary.ps1 — Reply summary announcement (synchronous, blocking)
|
|
1
|
+
# speech-summary.ps1 — Reply summary announcement (synchronous, blocking)
|
|
2
2
|
# For harnesses with no "reply finished" event (e.g. DSH has no Stop hook): the
|
|
3
3
|
# agent calls this at the end of its final reply.
|
|
4
4
|
#
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-speak",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.4",
|
|
4
4
|
"description": "Make your AI harness speak — voice announcements for DSH and other AI coding harnesses (Windows SAPI5 + macOS system voices)",
|
|
5
5
|
"main": "adapters/dsh/speech-hook.js",
|
|
6
6
|
"exports": {
|