@livx.cc/agentx 0.99.161 → 0.99.162

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
@@ -11745,6 +11745,11 @@ var TurnGate = class {
11745
11745
  get lastTurn() {
11746
11746
  return this.last && { id: this.last.id, text: this.last.text, started: this.last.started };
11747
11747
  }
11748
+ /** The user's own line is not over: a fragment is held, or the last turn went out mid-phrase ("where is the—") within
11749
+ * `withinMs`. Their next words finish it — never a reaction to the reply. */
11750
+ unfinished(withinMs) {
11751
+ return !!this.held || !!this.last && endsMidPhrase(this.last.text) && this.o.now() - this.last.at < withinMs;
11752
+ }
11748
11753
  /** An STT final. */
11749
11754
  final(text, sttId) {
11750
11755
  let t = text.trim(), replaces;
@@ -11840,7 +11845,7 @@ var TurnGate = class {
11840
11845
  }
11841
11846
  }
11842
11847
  refinal(last, t, key, sttId) {
11843
- if (!last.started) return this.send(t, key, sttId ?? last.sttId, "replace", last.id);
11848
+ if (!last.started || endsMidPhrase(last.text)) return this.send(t, key, sttId ?? last.sttId, "replace", last.id);
11844
11849
  const a = words3(last.text), b = words3(t);
11845
11850
  let i = 0;
11846
11851
  while (i < a.length && i < b.length && norm3(a[i]) === norm3(b[i])) i++;
@@ -16050,6 +16055,10 @@ var VoiceCall = class {
16050
16055
  }
16051
16056
  /** Soft barge-in: keep (a listener cue — no turn) or cut (→ barge()). */
16052
16057
  async overlap(text) {
16058
+ if (this.gate.unfinished(UNFINISHED_MS)) {
16059
+ this.barge();
16060
+ return "cut";
16061
+ }
16053
16062
  if (this.o.mode === "live" && isReaction(text)) return this.kept(text), "keep";
16054
16063
  const d = await this.judge.judge(text);
16055
16064
  if (d.verdict === "cut") this.barge();
@@ -16427,6 +16436,7 @@ var VoiceCall = class {
16427
16436
  }
16428
16437
  }
16429
16438
  };
16439
+ var UNFINISHED_MS = 8e3;
16430
16440
  var BACK_TO = { en: "Anyway,", he: "\u05D1\u05DB\u05DC \u05DE\u05E7\u05E8\u05D4," };
16431
16441
  function cutSentence(heard) {
16432
16442
  const tail = heard.trim().split(/(?<=[.!?…])\s+/).at(-1) ?? "";