agent.libx.js 0.93.12 → 0.93.13

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
@@ -888,6 +888,12 @@ declare class VoiceEngineOptions {
888
888
  overlapPause: boolean;
889
889
  /** no new partial activity for this long while paused → resume, drop the interjection */
890
890
  overlapResumeMs: number;
891
+ /** A genuine barge over a LONG reply is defeated by the dominant-novel gate: Meet echoes our own
892
+ * speech back, so the partial is mostly our words + a few of hers → never "dominant novel" → it
893
+ * resumes (replaying old audio — the audible "completes the buffer" blip) instead of ceding.
894
+ * Mechanism-based discriminator: a re-PAUSE this soon after a resume = a persistent human, not an
895
+ * echo blip (which pauses once and stalls). Cede on the re-pause regardless of the novel gate. */
896
+ overlapRepauseCedeMs: number;
891
897
  }
892
898
  declare class VoiceEngine {
893
899
  options: VoiceEngineOptions;
@@ -912,6 +918,7 @@ declare class VoiceEngine {
912
918
  private pendingTimer;
913
919
  private lastInterrupted;
914
920
  private pausedAt;
921
+ private lastResumeAt;
915
922
  private lastOverlapPartial;
916
923
  private resumeTimer;
917
924
  private turnStartAt;
package/dist/index.js CHANGED
@@ -4314,6 +4314,12 @@ var VoiceEngineOptions = class {
4314
4314
  overlapPause = true;
4315
4315
  /** no new partial activity for this long while paused → resume, drop the interjection */
4316
4316
  overlapResumeMs = 700;
4317
+ /** A genuine barge over a LONG reply is defeated by the dominant-novel gate: Meet echoes our own
4318
+ * speech back, so the partial is mostly our words + a few of hers → never "dominant novel" → it
4319
+ * resumes (replaying old audio — the audible "completes the buffer" blip) instead of ceding.
4320
+ * Mechanism-based discriminator: a re-PAUSE this soon after a resume = a persistent human, not an
4321
+ * echo blip (which pauses once and stalls). Cede on the re-pause regardless of the novel gate. */
4322
+ overlapRepauseCedeMs = 1500;
4317
4323
  };
4318
4324
  var VoiceEngine = class _VoiceEngine {
4319
4325
  options;
@@ -4346,6 +4352,8 @@ var VoiceEngine = class _VoiceEngine {
4346
4352
  lastInterrupted = null;
4347
4353
  // overlap (pause) tier state — AEC + pause-capable sinks only
4348
4354
  pausedAt = 0;
4355
+ lastResumeAt = 0;
4356
+ // when the overlap last resumed from a false alarm — a quick re-pause cedes
4349
4357
  lastOverlapPartial = "";
4350
4358
  // change-detection: only NEW partial text counts as activity
4351
4359
  resumeTimer = null;
@@ -4479,6 +4487,7 @@ var VoiceEngine = class _VoiceEngine {
4479
4487
  this.drainTimer = null;
4480
4488
  }
4481
4489
  this.resetOverlap(false);
4490
+ this.lastResumeAt = 0;
4482
4491
  const heardChars = Math.round(Math.max(0, this.player.playedMs()) / 1e3 * 15);
4483
4492
  if (this.reply) this.lastInterrupted = { full: this.reply, heard: this.reply.slice(0, heardChars) };
4484
4493
  this.speaking = false;
@@ -4530,6 +4539,11 @@ var VoiceEngine = class _VoiceEngine {
4530
4539
  if (!this.pausedAt) {
4531
4540
  this.pausedAt = now();
4532
4541
  this.player.pause();
4542
+ if (this.lastResumeAt && now() - this.lastResumeAt < this.options.overlapRepauseCedeMs) {
4543
+ this.interrupt();
4544
+ this.options.onBargeIn(this.ctxOpen ? "speaking" : "drain");
4545
+ return;
4546
+ }
4533
4547
  }
4534
4548
  if (this.genuine(txt) && this.words(txt).length >= 2) {
4535
4549
  const phase = this.ctxOpen ? "speaking" : "drain";
@@ -4618,7 +4632,10 @@ var VoiceEngine = class _VoiceEngine {
4618
4632
  clearTimeout(this.resumeTimer);
4619
4633
  this.resumeTimer = null;
4620
4634
  }
4621
- if (this.pausedAt && resume) this.player.resume?.();
4635
+ if (this.pausedAt && resume) {
4636
+ this.player.resume?.();
4637
+ this.lastResumeAt = now();
4638
+ }
4622
4639
  this.pausedAt = 0;
4623
4640
  this.lastOverlapPartial = "";
4624
4641
  this.gatePassTimes = [];