agent.libx.js 0.92.5 → 0.92.6

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.d.ts CHANGED
@@ -843,6 +843,12 @@ declare class VoiceEngine {
843
843
  private words;
844
844
  private novelWords;
845
845
  private echoActive;
846
+ /** Genuine user speech vs our own bleed (AEC tier): novel words must DOMINATE, not merely exist.
847
+ * Degraded AEC + an STT mis-hearing manufactures a single novel word out of pure echo (a name or
848
+ * rare word in our own reply comes back transcribed slightly differently — 1 novel / N words).
849
+ * A real interjection is mostly novel ("stop", "wait what") — short utterances pass on ratio,
850
+ * longer ones on count. */
851
+ private genuine;
846
852
  private handlePartial;
847
853
  private handleUtterance;
848
854
  private flushUtterance;
package/dist/index.js CHANGED
@@ -4173,9 +4173,20 @@ var VoiceEngine = class {
4173
4173
  echoActive() {
4174
4174
  return this.speaking || now() < this.echoUntil;
4175
4175
  }
4176
+ /** Genuine user speech vs our own bleed (AEC tier): novel words must DOMINATE, not merely exist.
4177
+ * Degraded AEC + an STT mis-hearing manufactures a single novel word out of pure echo (a name or
4178
+ * rare word in our own reply comes back transcribed slightly differently — 1 novel / N words).
4179
+ * A real interjection is mostly novel ("stop", "wait what") — short utterances pass on ratio,
4180
+ * longer ones on count. */
4181
+ genuine(text) {
4182
+ const total = this.words(text).length;
4183
+ const novel = this.novelWords(text).length;
4184
+ if (!novel) return false;
4185
+ return novel >= 2 || novel / Math.max(1, total) > 0.5;
4186
+ }
4176
4187
  handlePartial(text) {
4177
4188
  if (this.speaking) {
4178
- const barge = this.novelWords(text).length >= (this.usingAec ? 1 : this.suspectUntil ? 1 : 2);
4189
+ const barge = this.usingAec ? this.genuine(text) : this.novelWords(text).length >= (this.suspectUntil ? 1 : 2);
4179
4190
  if (barge) {
4180
4191
  const phase = this.ctxOpen ? "speaking" : "drain";
4181
4192
  this.interrupt();
@@ -4189,10 +4200,10 @@ var VoiceEngine = class {
4189
4200
  this.pendingTimer = null;
4190
4201
  }
4191
4202
  }
4192
- if (!this.echoActive() || this.novelWords(text).length >= 1) this.options.onPartial(text);
4203
+ if (!this.echoActive() || (this.usingAec ? this.genuine(text) : this.novelWords(text).length >= 1)) this.options.onPartial(text);
4193
4204
  }
4194
4205
  handleUtterance(text) {
4195
- if (this.echoActive() && this.novelWords(text).length < (this.usingAec ? 1 : 2)) {
4206
+ if (this.echoActive() && (this.usingAec ? !this.genuine(text) : this.novelWords(text).length < 2)) {
4196
4207
  this.stt.reset();
4197
4208
  return;
4198
4209
  }