dsh-dock 0.17.0 → 0.19.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.
@@ -23,6 +23,12 @@ function defaultConfig() {
23
23
  notifyOnComplete: true,
24
24
  notifyOnError: true,
25
25
  notifyOnConfirm: true,
26
+ // 卡住提醒卡片(与 voiceOnStuck 同口径 18 秒无活动,但卡片与语音各自独立开关)
27
+ notifyOnStuck: true,
28
+ // 页内卡片总开关(关闭 → 右侧所有类型的通知卡片都不再弹出)
29
+ notifyCards: true,
30
+ // 卡片口径三挡(正文写多少):默认 detailed =历史内容,未设置时卡片不缩水
31
+ cardMode: 'detailed',
26
32
  notifyStayMs: 8000,
27
33
  systemNotify: false,
28
34
  soundNotify: true,
@@ -31,6 +37,18 @@ function defaultConfig() {
31
37
  dingtalkWebhook: '',
32
38
  feishuEnabled: false,
33
39
  feishuWebhook: '',
40
+ // 语音播报(浏览器 speechSynthesis 短句播报;默认总开关关闭)
41
+ voiceNotify: false,
42
+ voiceMode: 'brief',
43
+ voiceOnComplete: true,
44
+ voiceOnError: true,
45
+ voiceOnConfirm: true,
46
+ voiceOnStuck: true,
47
+ voiceRate: 1,
48
+ voiceVolume: 1,
49
+ voiceLang: '',
50
+ // 指定音色(speechSynthesis voiceURI,设备相关;空 = 按语言自动挑,本机没有时客户端回落)
51
+ voiceURI: '',
34
52
  // 迁移标记(schema 默认 false):settings 不可用时的兜底取 true——迁移由
35
53
  // src/host-core.js migrateNotifyConfig 统一负责,这里只是原样带回,不影响通知行为。
36
54
  migratedFromAnimation: true,
@@ -48,6 +66,8 @@ function readConfig(ctx) {
48
66
  if (n[key] !== undefined) cfg[key] = n[key]
49
67
  }
50
68
  if (!SOUND_EFFECTS.includes(cfg.soundEffect)) cfg.soundEffect = 'chime'
69
+ if (cfg.voiceMode !== 'brief' && cfg.voiceMode !== 'medium' && cfg.voiceMode !== 'detailed') cfg.voiceMode = 'brief'
70
+ if (cfg.cardMode !== 'brief' && cfg.cardMode !== 'medium' && cfg.cardMode !== 'detailed') cfg.cardMode = 'detailed'
51
71
  }
52
72
  } catch { /* settings 未挂载,用默认 */ }
53
73
  return cfg
@@ -264,6 +284,13 @@ export const feature = {
264
284
  if (typeof p.notifyOnComplete === 'boolean') cfg.notifyOnComplete = p.notifyOnComplete
265
285
  if (typeof p.notifyOnError === 'boolean') cfg.notifyOnError = p.notifyOnError
266
286
  if (typeof p.notifyOnConfirm === 'boolean') cfg.notifyOnConfirm = p.notifyOnConfirm
287
+ // 卡住提醒卡 + 页内卡片总开关(总开关只管卡片弹不弹,不管语音/提示音/系统通知)
288
+ if (typeof p.notifyOnStuck === 'boolean') cfg.notifyOnStuck = p.notifyOnStuck
289
+ if (typeof p.notifyCards === 'boolean') cfg.notifyCards = p.notifyCards
290
+ // 卡片口径三挡(正文写多少);非法值忽略(保持已存的值)
291
+ if (typeof p.cardMode === 'string' && (p.cardMode === 'brief' || p.cardMode === 'medium' || p.cardMode === 'detailed')) {
292
+ cfg.cardMode = p.cardMode
293
+ }
267
294
  if (typeof p.notifyStayMs === 'number' && Number.isFinite(p.notifyStayMs)) {
268
295
  cfg.notifyStayMs = Math.max(0, Math.min(600000, Math.round(p.notifyStayMs)))
269
296
  }
@@ -290,6 +317,23 @@ export const feature = {
290
317
  }
291
318
  cfg.feishuWebhook = hook
292
319
  }
320
+ // ===== 语音播报字段 =====
321
+ if (typeof p.voiceNotify === 'boolean') cfg.voiceNotify = p.voiceNotify
322
+ if (typeof p.voiceMode === 'string' && (p.voiceMode === 'brief' || p.voiceMode === 'medium' || p.voiceMode === 'detailed')) {
323
+ cfg.voiceMode = p.voiceMode
324
+ }
325
+ for (const key of ['voiceOnComplete', 'voiceOnError', 'voiceOnConfirm', 'voiceOnStuck']) {
326
+ if (typeof p[key] === 'boolean') cfg[key] = p[key]
327
+ }
328
+ if (typeof p.voiceRate === 'number' && Number.isFinite(p.voiceRate)) {
329
+ cfg.voiceRate = Math.min(2, Math.max(0.5, p.voiceRate))
330
+ }
331
+ if (typeof p.voiceVolume === 'number' && Number.isFinite(p.voiceVolume)) {
332
+ cfg.voiceVolume = Math.min(1, Math.max(0, p.voiceVolume))
333
+ }
334
+ if (typeof p.voiceLang === 'string') cfg.voiceLang = p.voiceLang.trim().slice(0, 20)
335
+ // 音色标识是浏览器给的字符串,与【语音朗读】同款限长即可(宿主拿不到本机音色表,不做存在性校验)
336
+ if (typeof p.voiceURI === 'string') cfg.voiceURI = p.voiceURI.trim().slice(0, 200)
293
337
 
294
338
  try {
295
339
  await mutateDockSection(ctx, ['notify'], cfg)