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/cli.js CHANGED
@@ -4119,6 +4119,12 @@ var VoiceEngineOptions = class {
4119
4119
  overlapPause = true;
4120
4120
  /** no new partial activity for this long while paused → resume, drop the interjection */
4121
4121
  overlapResumeMs = 700;
4122
+ /** A genuine barge over a LONG reply is defeated by the dominant-novel gate: Meet echoes our own
4123
+ * speech back, so the partial is mostly our words + a few of hers → never "dominant novel" → it
4124
+ * resumes (replaying old audio — the audible "completes the buffer" blip) instead of ceding.
4125
+ * Mechanism-based discriminator: a re-PAUSE this soon after a resume = a persistent human, not an
4126
+ * echo blip (which pauses once and stalls). Cede on the re-pause regardless of the novel gate. */
4127
+ overlapRepauseCedeMs = 1500;
4122
4128
  };
4123
4129
  var VoiceEngine = class _VoiceEngine {
4124
4130
  options;
@@ -4151,6 +4157,8 @@ var VoiceEngine = class _VoiceEngine {
4151
4157
  lastInterrupted = null;
4152
4158
  // overlap (pause) tier state — AEC + pause-capable sinks only
4153
4159
  pausedAt = 0;
4160
+ lastResumeAt = 0;
4161
+ // when the overlap last resumed from a false alarm — a quick re-pause cedes
4154
4162
  lastOverlapPartial = "";
4155
4163
  // change-detection: only NEW partial text counts as activity
4156
4164
  resumeTimer = null;
@@ -4284,6 +4292,7 @@ var VoiceEngine = class _VoiceEngine {
4284
4292
  this.drainTimer = null;
4285
4293
  }
4286
4294
  this.resetOverlap(false);
4295
+ this.lastResumeAt = 0;
4287
4296
  const heardChars = Math.round(Math.max(0, this.player.playedMs()) / 1e3 * 15);
4288
4297
  if (this.reply) this.lastInterrupted = { full: this.reply, heard: this.reply.slice(0, heardChars) };
4289
4298
  this.speaking = false;
@@ -4335,6 +4344,11 @@ var VoiceEngine = class _VoiceEngine {
4335
4344
  if (!this.pausedAt) {
4336
4345
  this.pausedAt = now();
4337
4346
  this.player.pause();
4347
+ if (this.lastResumeAt && now() - this.lastResumeAt < this.options.overlapRepauseCedeMs) {
4348
+ this.interrupt();
4349
+ this.options.onBargeIn(this.ctxOpen ? "speaking" : "drain");
4350
+ return;
4351
+ }
4338
4352
  }
4339
4353
  if (this.genuine(txt) && this.words(txt).length >= 2) {
4340
4354
  const phase = this.ctxOpen ? "speaking" : "drain";
@@ -4423,7 +4437,10 @@ var VoiceEngine = class _VoiceEngine {
4423
4437
  clearTimeout(this.resumeTimer);
4424
4438
  this.resumeTimer = null;
4425
4439
  }
4426
- if (this.pausedAt && resume) this.player.resume?.();
4440
+ if (this.pausedAt && resume) {
4441
+ this.player.resume?.();
4442
+ this.lastResumeAt = now();
4443
+ }
4427
4444
  this.pausedAt = 0;
4428
4445
  this.lastOverlapPartial = "";
4429
4446
  this.gatePassTimes = [];