dsh-notify-say 0.4.67 → 0.4.69
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 +8 -0
- package/lib/config-schema.js +8 -0
- package/lib/index.js +2848 -2793
- package/package.json +1 -1
- package/test/error-notify-contract.test.mjs +32 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-notify-say",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.69",
|
|
4
4
|
"description": "Desktop notifications for DSH Desktop that actually speak: Windows TTS out of the box (zero download), VOICEVOX voice packs optional, a selectable system-sound fallback, and an idle gate that waits for running subagents before saying the turn is done. Includes a settings-page GUI (sound source, per-event overrides, jump-back-to-session, cooldowns) and a self hot-reload for development.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -151,4 +151,36 @@ test('P13: 并发丢弃必须能定位是哪条通知', () => {
|
|
|
151
151
|
test('P14: spawnTts 要透传 psKind(TTS 失败也要能定位)', () => {
|
|
152
152
|
const body = fnBody('function spawnTts(args, psKind) {');
|
|
153
153
|
assert.match(body, /spawnNotify\(args, psKind\)/, 'spawnTts 必须透传 psKind');
|
|
154
|
+
});
|
|
155
|
+
// ══ 第 3 批:error 当场播报(2026-10-19 真机排查的根因)══════════════════
|
|
156
|
+
test('P15: error / blocked 必须在 turn/end 当场播,不等 idle 边沿', () => {
|
|
157
|
+
const idx = INDEX.indexOf("if (type === 'turn/end') {");
|
|
158
|
+
assert.ok(idx > 0, '要有 turn/end 处理');
|
|
159
|
+
const seg = INDEX.slice(idx, idx + 2200);
|
|
160
|
+
// 必须有 error/blocked 的立即播报分支
|
|
161
|
+
assert.match(seg, /endKind === 'error' \|\| endKind === 'blocked'/,
|
|
162
|
+
'必须有 error/blocked 的当场播报分支');
|
|
163
|
+
// 该分支必须 return(不能落下去写 lastTurnEnd,否则 idle 路径会再播一次)
|
|
164
|
+
const branch = seg.slice(seg.indexOf("endKind === 'error'"));
|
|
165
|
+
assert.match(branch, /return;/, '当场播后必须 return,避免走到 lastTurnEnd 记账');
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
test('P16: 数据依据 —— 不得因"怕重复"而把 error 也走记账路径', () => {
|
|
169
|
+
// 2026-10-19 实测 2195 个会话 / 6262 条 turn/end:
|
|
170
|
+
// 同一 turn 多条 turn/end = 0,同一 turn 多种 kind = 0
|
|
171
|
+
// 所以不存在"提前播会重复"的问题。
|
|
172
|
+
const idx = INDEX.indexOf("if (type === 'turn/end') {");
|
|
173
|
+
const seg = INDEX.slice(idx, idx + 2200);
|
|
174
|
+
assert.match(seg, /error .* 当场播报|当场播报,不等 idle|error \/ blocked → 当场播/,
|
|
175
|
+
'代码里应保留这条判断的依据说明,防止后人又改回"等 idle"');
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
test('P17: 子代理错误要有独立开关(默认开)', () => {
|
|
179
|
+
assert.match(INDEX, /notifyOnSubagentError/,
|
|
180
|
+
'子代理错误要能单独控制:不打扰于子代理完成,但不能静默子代理错误');
|
|
181
|
+
// 默认值定义在 config-schema.js(FIELD_DEFAULTS),不在 index.js
|
|
182
|
+
const SCHEMA = readFileSync(join(ROOT, 'lib/config-schema.js'), 'utf8');
|
|
183
|
+
const m = SCHEMA.match(/notifyOnSubagentError:\s*(true|false)/);
|
|
184
|
+
assert.ok(m, 'config-schema.js 里要有默认值');
|
|
185
|
+
assert.equal(m[1], 'true', '默认必须开 —— 错误不该被静默');
|
|
154
186
|
});
|