@livx.cc/agentx 0.97.5 → 0.97.7

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/dist/index.js CHANGED
@@ -4651,6 +4651,8 @@ init_logging();
4651
4651
  // src/voice/spokenSplitter.ts
4652
4652
  var OPEN = "<spoken>";
4653
4653
  var CLOSE = "</spoken>";
4654
+ var CLOSERS = `"')]}\xBB\u201D\u2019`;
4655
+ var hasSpeech = (s) => /[\p{L}\p{N}]/u.test(s);
4654
4656
  var SentenceCoalescer = class _SentenceCoalescer {
4655
4657
  buf = "";
4656
4658
  static isEnd(c) {
@@ -4661,14 +4663,15 @@ var SentenceCoalescer = class _SentenceCoalescer {
4661
4663
  let cut = -1;
4662
4664
  for (let i = 0; i < this.buf.length; i++) if (_SentenceCoalescer.isEnd(this.buf[i])) cut = i;
4663
4665
  if (cut < 0) return "";
4666
+ if (this.buf[cut] !== "\n") while (cut + 1 < this.buf.length && CLOSERS.includes(this.buf[cut + 1])) cut++;
4664
4667
  const ready = this.buf.slice(0, cut + 1).trim();
4665
4668
  this.buf = this.buf.slice(cut + 1);
4666
- return ready;
4669
+ return hasSpeech(ready) ? ready : "";
4667
4670
  }
4668
4671
  flush() {
4669
4672
  const s = this.buf.trim();
4670
4673
  this.buf = "";
4671
- return s;
4674
+ return hasSpeech(s) ? s : "";
4672
4675
  }
4673
4676
  };
4674
4677
  var SpokenSplitter = class {
@@ -5946,7 +5949,7 @@ var VoiceEngine = class _VoiceEngine {
5946
5949
  * If nothing is currently speaking it plays immediately; otherwise it queues and plays after the
5947
5950
  * current utterance fully ends (settle → pumpQueue) — never spliced into an open reflex utterance. */
5948
5951
  enqueueUtterance(text) {
5949
- if (!text || !text.trim()) return;
5952
+ if (!text || !/[\p{L}\p{N}]/u.test(text)) return;
5950
5953
  this.uttQueue.push(text);
5951
5954
  if (!this.speaking) this.pumpQueue();
5952
5955
  }