@eslaykey/dsh-breeze-tts 1.0.3 → 1.0.5

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
@@ -5,6 +5,21 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), version
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [1.0.5] - 2026-10-31
9
+
10
+ ### Fixed
11
+ - After a client remount (or a fresh session) the "already spoken" marker could prime on an empty message list, so the previous reply was spoken again
12
+ - Auto-speak now reads only the message's own text blocks instead of the broad fallback walk, which could pick up unrelated text
13
+ - Added a one-line diagnostic to ~/.dsh/breeze-tts/autospeak.log recording what was spoken
14
+
15
+
16
+ ## [1.0.4] - 2026-10-31
17
+
18
+ ### Fixed
19
+ - Emotion tags were mangled by the text cleaner before synthesis, so auto-speak spoke the tag fragments instead of applying them
20
+ - A 260 ms breath is now inserted between synthesized segments, so tone changes no longer sound clipped together
21
+
22
+
8
23
  ## [1.0.3] - 2026-10-31
9
24
 
10
25
  ### Fixed
package/client.js CHANGED
@@ -482,7 +482,15 @@ function stripEmoji(text) {
482
482
 
483
483
  function cleanForSpeech(text, keepTags) {
484
484
  let value = String(text ?? '')
485
- if (!keepTags) value = value.replace(/<!--[\s\S]*?-->/g, ' ')
485
+ const tags = []
486
+ if (keepTags) {
487
+ value = value.replace(/<!--[\s\S]*?-->/g, (match) => {
488
+ tags.push(match)
489
+ return '@@TAG' + (tags.length - 1) + '@@'
490
+ })
491
+ } else {
492
+ value = value.replace(/<!--[\s\S]*?-->/g, ' ')
493
+ }
486
494
  value = value.replace(/!\[[^\]]*\]\([^)]*\)/g, ' ')
487
495
  value = value.replace(/\[([^\]]*)\]\([^)]*\)/g, '$1')
488
496
  value = value.replace(/https?:\/\/[^\s)]+/g, ' ')
@@ -492,6 +500,9 @@ function cleanForSpeech(text, keepTags) {
492
500
  value = value.replace(/\s+([:,。!?;、)】」》])/g, '$1')
493
501
  value = value.replace(/([(【「《])\s+/g, '$1')
494
502
  value = value.replace(/\s+/g, ' ')
503
+ if (keepTags && tags.length) {
504
+ value = value.replace(/@@TAG(\d+)@@/g, (match, index) => tags[Number(index)] || ' ')
505
+ }
495
506
  return value.trim()
496
507
  }
497
508
 
@@ -629,6 +640,7 @@ function cleanForSpeech(text, keepTags) {
629
640
  if (!snapshot) return
630
641
 
631
642
  if (!primed.current) {
643
+ if (!nodes.length) return
632
644
  primed.current = true
633
645
  for (const node of nodes) {
634
646
  const id = node && (node.id || node.messageId || (node.message && node.message.id))
@@ -652,9 +664,14 @@ function cleanForSpeech(text, keepTags) {
652
664
  const candidateId = node.id || node.messageId || (node.message && node.message.id) || ''
653
665
  if (!candidateId || played.current.ids.has(candidateId)) continue
654
666
  let raw = ''
667
+ let source = 'content'
655
668
  try {
656
- raw = collectText(node, [], 0).join(' ')
657
- if (!raw) raw = collectAnyText(node, [], 0).join(' ')
669
+ const message = node.message && typeof node.message === 'object' ? node.message : node
670
+ raw = textBlocks(message.content, []).join(' ')
671
+ if (!raw) {
672
+ raw = collectText(node, [], 0).join(' ')
673
+ source = 'collect'
674
+ }
658
675
  } catch {
659
676
  raw = ''
660
677
  }
@@ -682,6 +699,18 @@ function cleanForSpeech(text, keepTags) {
682
699
  text = spokenText
683
700
  measure = plain
684
701
  id = candidateId
702
+ try {
703
+ const node2 = node
704
+ const blocks = node2 && node2.message && Array.isArray(node2.message.content) ? node2.message.content : (Array.isArray(node2.blocks) ? node2.blocks : [])
705
+ const kinds = blocks.slice(0, 6).map((b) => String((b && (b.type || b.kind)) || '?')).join(',')
706
+ fetch('/breeze-tts/log', {
707
+ method: 'POST',
708
+ headers: { 'content-type': 'application/json' },
709
+ body: JSON.stringify({ msg: 'speak src=' + source + ' id=' + candidateId.slice(0, 18) + ' len=' + plain.length + ' kinds=' + kinds }),
710
+ }).catch(() => {})
711
+ } catch {
712
+ /* logging must never break playback */
713
+ }
685
714
  break
686
715
  }
687
716
  if (!id) {
package/index.js CHANGED
@@ -245,9 +245,10 @@ function chunkByLanguage(text, limit = 900) {
245
245
  return chunks
246
246
  }
247
247
 
248
- function concatWav(buffers) {
248
+ function concatWav(buffers, gapMs = 260) {
249
249
  let fmt = null
250
250
  const frames = []
251
+ let gapBytes = 0
251
252
  for (const buffer of buffers) {
252
253
  if (buffer.toString('ascii', 0, 4) !== 'RIFF') throw new Error('not a wav payload')
253
254
  let pos = 12
@@ -264,7 +265,19 @@ function concatWav(buffers) {
264
265
  if (!fmt) fmt = localFmt
265
266
  else if (!fmt.equals(localFmt)) throw new Error('wav format mismatch')
266
267
  }
267
- const body = Buffer.concat(frames)
268
+ if (fmt && fmt.length >= 16 && frames.length > 1) {
269
+ const channels = fmt.readUInt16LE(2)
270
+ const sampleRate = fmt.readUInt32LE(4)
271
+ const bits = fmt.readUInt16LE(14)
272
+ const blockAlign = Math.max(1, Math.round((channels * bits) / 8))
273
+ gapBytes = Math.round((sampleRate * gapMs) / 1000) * blockAlign
274
+ }
275
+ const parts = []
276
+ for (let index = 0; index < frames.length; index += 1) {
277
+ parts.push(frames[index])
278
+ if (index < frames.length - 1 && gapBytes > 0) parts.push(Buffer.alloc(gapBytes))
279
+ }
280
+ const body = Buffer.concat(parts)
268
281
  const header = Buffer.alloc(12)
269
282
  header.write('RIFF', 0, 'ascii')
270
283
  header.writeUInt32LE(4 + (8 + fmt.length) + (8 + body.length), 4)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslaykey/dsh-breeze-tts",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Breeze Blue text-to-speech for DeepSeek Harness: agent tools, reply playback, voice design and a settings page.",
5
5
  "author": "eslaykey",
6
6
  "license": "MIT",