@livx.cc/agentx 0.99.153 → 0.99.155

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
@@ -7795,6 +7795,7 @@ function heardPrefix(text, spoken, lookahead = 4) {
7795
7795
  }
7796
7796
  return at;
7797
7797
  }
7798
+ var ECHO_RECENT_SEC = 1.8;
7798
7799
  var NumberedSpeakers = class {
7799
7800
  ids = /* @__PURE__ */ new Map();
7800
7801
  name(label) {
@@ -8067,6 +8068,10 @@ var VoiceEngine = class _VoiceEngine {
8067
8068
  drainTimer = null;
8068
8069
  // heuristic tier state (inert under AEC) — frozen as validated in the experiment
8069
8070
  echoWords = /* @__PURE__ */ new Set();
8071
+ /** Our words audible when this utterance's first partial came (undefined = no partial yet, null = no word timestamps). */
8072
+ uttEcho;
8073
+ /** The words of the line before this turn: its audio may still be playing ahead of this turn's first word. */
8074
+ lineBefore = /* @__PURE__ */ new Set();
8070
8075
  prevReply = "";
8071
8076
  reply = "";
8072
8077
  echoUntil = 0;
@@ -8323,6 +8328,7 @@ var VoiceEngine = class _VoiceEngine {
8323
8328
  if (this.options.revealMode === "word") this.startWordReveal();
8324
8329
  this.emo = this.options.emotions ? new EmotionStream(this.options.showEmotions) : null;
8325
8330
  this.echoWords = new Set(this.words(this.prevReply));
8331
+ this.lineBefore = new Set(this.echoWords);
8326
8332
  this.tts.newContext();
8327
8333
  this.clause = "";
8328
8334
  this.clearAckTimer("new_turn");
@@ -8811,6 +8817,18 @@ var VoiceEngine = class _VoiceEngine {
8811
8817
  this.diag("echo_head", { dropped: toks.slice(0, i).join(" ").slice(0, 60) });
8812
8818
  return toks.slice(i).join(" ");
8813
8819
  }
8820
+ /** Our words whose audio played in the last ECHO_RECENT_SEC (+ the ack just said) — what an echo can be made of right
8821
+ * now. null = no word timestamps (the bag rule judges alone). */
8822
+ audibleWords() {
8823
+ if (!this.echoActive() || !this.wordStarts.length) return null;
8824
+ const now4 = this.player.playedMs() / 1e3, out = /* @__PURE__ */ new Set();
8825
+ this.wordStarts.forEach((s, i) => {
8826
+ if (s <= now4 + 0.3 && s >= now4 - ECHO_RECENT_SEC) for (const w of this.words(this.wordTexts[i] ?? "")) out.add(w);
8827
+ });
8828
+ if (now4 < this.wordStarts[0] + ECHO_RECENT_SEC) for (const w of this.lineBefore) out.add(w);
8829
+ if (this.ackAt && this.clock.now() - this.ackAt < 3e3) for (const w of this.words(this.lastAck)) out.add(w);
8830
+ return out;
8831
+ }
8814
8832
  novelWords(text) {
8815
8833
  return this.words(text).filter((w) => !this.echoWords.has(w));
8816
8834
  }
@@ -8837,10 +8855,10 @@ var VoiceEngine = class _VoiceEngine {
8837
8855
  * of our last words in their own sentence is neither: live 20261103-114604, over "…Want me to open the thread?" the
8838
8856
  * user's "You can't open the thread?" (3 of 5 in line) was swallowed and they had to say it again — the old rule
8839
8857
  * (half the words in a word pair we said) counted it as echo. Shorter finals can't show order → bag rule. */
8840
- echoFinal(text) {
8858
+ echoFinal(text, audible = null) {
8841
8859
  if (this.genuine(text)) return false;
8842
8860
  const w = this.words(text);
8843
- if (w.length < 4) return true;
8861
+ if (w.length < 4) return audible ? w.every((x) => audible.has(x)) : true;
8844
8862
  const said = this.words(`${this.prevReply} ${this.reply} ${this.lastAck}`);
8845
8863
  const span = w.length + 2;
8846
8864
  let best = 0, run = 0;
@@ -8882,6 +8900,7 @@ var VoiceEngine = class _VoiceEngine {
8882
8900
  return w.length === 1 && d.length > 0 && this.clock.now() - this.lastDispatchAt < _VoiceEngine.DUP_FINAL_MS && d[d.length - 1].startsWith(w[0]);
8883
8901
  }
8884
8902
  handlePartial(text) {
8903
+ if (text.trim() && !this.uttEcho) this.uttEcho = { at: this.clock.now(), words: this.audibleWords() };
8885
8904
  if (this.speaking) {
8886
8905
  if (!this.options.bargeIn) return;
8887
8906
  if (this.clock.now() < this.bargeGraceUntil) {
@@ -9305,6 +9324,9 @@ var VoiceEngine = class _VoiceEngine {
9305
9324
  }
9306
9325
  handleUtterance(text, langs, rawTurns) {
9307
9326
  let turns;
9327
+ const cap = this.uttEcho;
9328
+ this.uttEcho = void 0;
9329
+ const audible = cap && this.clock.now() - cap.at < 15e3 ? cap.words : null;
9308
9330
  if (this.echoHead) {
9309
9331
  this.echoHead = false;
9310
9332
  text = this.dropEchoHead(text);
@@ -9339,7 +9361,7 @@ var VoiceEngine = class _VoiceEngine {
9339
9361
  this.stt.reset();
9340
9362
  return;
9341
9363
  }
9342
- if (this.echoActive() && (!this.options.bargeIn || (this.usingAec ? this.echoFinal(text) : this.novelWords(text).length < 2))) {
9364
+ if (this.echoActive() && (!this.options.bargeIn || (this.usingAec ? this.echoFinal(text, audible) : this.novelWords(text).length < 2))) {
9343
9365
  this.diag("echo_swallow", { guard: "echo_gate", text: text.slice(0, 60) });
9344
9366
  this.stt.reset();
9345
9367
  return;
@@ -10460,11 +10482,16 @@ function cueKind(text) {
10460
10482
  return r.split(" ").some((w) => AGREE.has(w)) ? "agree" : null;
10461
10483
  }
10462
10484
  var ASIDES = {
10463
- en: { agree: ["Oh yeah, definitely.", "Yeah, exactly.", "Right, yeah."], continue: [] },
10464
- he: { agree: ["\u05DB\u05DF, \u05D1\u05D3\u05D9\u05D5\u05E7.", "\u05DB\u05DF, \u05DE\u05DE\u05E9.", "\u05E0\u05DB\u05D5\u05DF, \u05DB\u05DF."], continue: [] }
10485
+ en: { agree: ["Oh yeah, definitely.", "Yeah, exactly.", "Right, yeah."], continue: [], react: ["I know, right?", "Right? Wild.", "Yeah, crazy, right?"] },
10486
+ he: { agree: ["\u05DB\u05DF, \u05D1\u05D3\u05D9\u05D5\u05E7.", "\u05DB\u05DF, \u05DE\u05DE\u05E9.", "\u05E0\u05DB\u05D5\u05DF, \u05DB\u05DF."], continue: [], react: ["\u05E0\u05DB\u05D5\u05DF? \u05DE\u05D8\u05D5\u05E8\u05E3.", "\u05DB\u05DF, \u05DE\u05D8\u05D5\u05E8\u05E3.", "\u05DE\u05D8\u05D5\u05E8\u05E3, \u05E0\u05DB\u05D5\u05DF?"] }
10487
+ };
10488
+ var REACT = /^(?:(?:oh|and|so|wait|but|ok|okay|yeah)\s+)*(?:wow|whoa|woah|really|seriously|no way|oh my god|omg|crazy|insane|amazing|unbelievable|what|are you serious|you're kidding|וואו|באמת|מה|מטורף|רצינית?|לא נכון)(?:\s+(?:wow|really|seriously|that's crazy|that's wild|no way|באמת|וואו))*$/u;
10489
+ var isReaction = (text) => {
10490
+ const t = norm2(text);
10491
+ return REACT.test(t) || new RegExp("\\s\\p{L}{1,3}$", "u").test(t) && REACT.test(t.replace(new RegExp("\\s\\p{L}{1,3}$", "u"), ""));
10465
10492
  };
10466
- function overlapAside(text, lang, avoid = "", pick = (n) => Math.floor(Math.random() * n)) {
10467
- const kind = cueKind(text);
10493
+ function overlapAside(text, lang, avoid = "", pick = (n) => Math.floor(Math.random() * n), react = false) {
10494
+ const kind = react && REACT.test(norm2(text)) ? "react" : cueKind(text);
10468
10495
  const l = new RegExp("\\p{Script=Hebrew}", "u").test(text) ? "he" : /[a-z]/i.test(text) ? "en" : lang;
10469
10496
  const pool = kind && l ? ASIDES[l]?.[kind] : void 0;
10470
10497
  if (!pool?.length) return null;
@@ -14132,8 +14159,8 @@ var SOFT_CUE = "~";
14132
14159
  var STOP4 = new Set("about after again also always been before being could does doing down even every from going have here into just know like look make many more most much must never only other over really right same should some still such sure take than that their them then there these they thing think this those through very want well were what when where which while will with would your yeah okay".split(" "));
14133
14160
  var isContent = (w) => w.length >= 4 && !STOP4.has(w);
14134
14161
  function echoesHeard(line, heard) {
14135
- const said = cueWords(heard).map(stem).filter(echoable);
14136
- return cueWords(lineWords(line)).map(stem).filter(echoable).some((w) => said.some((h) => h === w || Math.min(h.length, w.length) >= 4 && (h.startsWith(w) || w.startsWith(h))));
14162
+ const said = cueWords(heard).filter(echoable).map(stem);
14163
+ return cueWords(lineWords(line)).filter(echoable).map(stem).some((w) => said.some((h) => h === w || Math.min(h.length, w.length) >= 4 && (h.startsWith(w) || w.startsWith(h))));
14137
14164
  }
14138
14165
  var stem = (w) => w.replace(/['’]s$/, "").replace(new RegExp("(?<=\\p{L}{3})s$", "u"), "");
14139
14166
  var SHORT_STOP = new Set("the and you are was for not but has had his her its our who why how can did get got let may one out see she two use way yes all any new now off old own say too him hey huh ooh wow yep".split(" "));
@@ -15448,6 +15475,15 @@ var VoiceCallOptions = class {
15448
15475
  /** Writes that immediate answer (fastWorkReply). */
15449
15476
  workReply;
15450
15477
  workReplyBudgetMs = 1500;
15478
+ /** Live: the quick lane (fastQuickLane) owns the conversation — each turn it answers, acks + hands to MAIN, resumes a
15479
+ * cut answer, or stays quiet. Absent (or another mode): every turn goes to MAIN as before. */
15480
+ quick;
15481
+ /** Past this the turn goes to MAIN as before (the bridge covers it). */
15482
+ quickBudgetMs = 1800;
15483
+ /** The unsaid rest of MAIN's reply a barge just cut (a peek, like heardCut), else null — what a resume says. */
15484
+ cutRest;
15485
+ /** A resume said that rest: the host drops the cut (MAIN's history keeps the whole reply). */
15486
+ dropCut;
15451
15487
  /** Host TTS (fill lane): resolves when played; `false` = could not play. */
15452
15488
  speak = () => false;
15453
15489
  /** Stop the in-flight fill line now (barge-in only). */
@@ -15456,6 +15492,10 @@ var VoiceCallOptions = class {
15456
15492
  /** Host caption — never history. */
15457
15493
  show = () => {
15458
15494
  };
15495
+ /** The user's words that start no MAIN turn — the host's transcript shows them (sendTurn shows the rest): `quick` = a
15496
+ * turn the quick lane answered, `aside` = said while MAIN worked, `kept` = a soft barge-in kept over the reply. */
15497
+ userLine = () => {
15498
+ };
15459
15499
  /** The fast model (lines, banks, progress) — used only with `ai`. */
15460
15500
  fastModel = latestClaude("haiku");
15461
15501
  /** Model client for the fast model + the channel decider / overlap judge. Absent → canned lines and rules only. */
@@ -15489,6 +15529,7 @@ var VoiceCallOptions = class {
15489
15529
  progressLeadMs = 1e3;
15490
15530
  };
15491
15531
  var VoiceCall = class {
15532
+ // a MAIN reply cut while audible: its heard part goes to the history at the next turn
15492
15533
  constructor(options) {
15493
15534
  this.options = options;
15494
15535
  this.options = { ...new VoiceCallOptions(), ...options };
@@ -15551,6 +15592,11 @@ var VoiceCall = class {
15551
15592
  progressTimer = null;
15552
15593
  lastUserAt = -Infinity;
15553
15594
  ended = false;
15595
+ /** The call as both lanes know it: the user's turns and what was said aloud (quick lines, MAIN's heard replies). */
15596
+ history = [];
15597
+ cutRest = "";
15598
+ // the unsaid rest of the last cut MAIN reply, until the next turn decides it
15599
+ cutTurn;
15554
15600
  get o() {
15555
15601
  return this.options;
15556
15602
  }
@@ -15617,6 +15663,13 @@ var VoiceCall = class {
15617
15663
  if (this.ended) return;
15618
15664
  if (by === "main") return this.main({ type: "audio", ...this.cur ? { id: this.cur.id } : {} }, inMs);
15619
15665
  const at = this.o.now() + Math.max(0, inMs);
15666
+ const q2 = this.cur;
15667
+ if (q2?.quickWord && !q2.closed) {
15668
+ this.lastAudibleAt = at;
15669
+ q2.marks.fillAudio ??= at;
15670
+ this.sounded(q2, "quick", at);
15671
+ return this.quickWorded(q2, at);
15672
+ }
15620
15673
  if (this.gate.holding || !this.cur || this.cur.closed) {
15621
15674
  this.earlyHeard ??= { at, by };
15622
15675
  return;
@@ -15646,6 +15699,7 @@ var VoiceCall = class {
15646
15699
  return;
15647
15700
  case "text":
15648
15701
  if (!ev.text) return;
15702
+ c.reply += ev.text;
15649
15703
  c.marks.mainFirst ??= this.o.now();
15650
15704
  c.marks.mainText ??= this.o.now();
15651
15705
  if (!c.streamed) {
@@ -15722,6 +15776,7 @@ var VoiceCall = class {
15722
15776
  } catch (e) {
15723
15777
  log31.warn(`cancel threw: ${e.message}`);
15724
15778
  }
15779
+ if (c?.worded && c.lane === "deep" && !c.cutRead) this.cutTurn = c;
15725
15780
  if (c?.running) {
15726
15781
  c.running = false;
15727
15782
  this.o.abortTurn(c.id);
@@ -15730,10 +15785,44 @@ var VoiceCall = class {
15730
15785
  }
15731
15786
  /** Soft barge-in: keep (a listener cue — no turn) or cut (→ barge()). */
15732
15787
  async overlap(text) {
15788
+ if (this.o.mode === "live" && isReaction(text)) return this.kept(text), "keep";
15733
15789
  const d = await this.judge.judge(text);
15734
15790
  if (d.verdict === "cut") this.barge();
15791
+ else if (d.verdict === "keep") this.kept(text);
15735
15792
  return d.verdict;
15736
15793
  }
15794
+ /** An overlap kept over the reply (no turn): the transcript and the quick lane's history still hold their words — once,
15795
+ * in full: the host asks about every growing partial ("Oh," "Oh, wow" "Oh, wow—really?"; Para replay showed all four). */
15796
+ kept(text) {
15797
+ if (!norm3(text)) return;
15798
+ const p = this.keptLine, a = norm3(text).replace(/ /g, ""), b = p ? norm3(p.text).replace(/ /g, "") : "";
15799
+ if (p && (a.startsWith(b) || b.startsWith(a))) {
15800
+ if (a.length > b.length) {
15801
+ p.text = text;
15802
+ if (p.line) p.line.text = text;
15803
+ }
15804
+ clearTimeout(p.timer);
15805
+ } else {
15806
+ this.flushKept();
15807
+ const line = this.quickOn ? { who: "user", text } : void 0;
15808
+ if (line) this.history.push(line);
15809
+ this.keptLine = { text, timer: void 0, line };
15810
+ }
15811
+ this.keptLine.timer = setTimeout(() => this.flushKept(), isReaction(this.keptLine.text) ? 1500 : 4e3);
15812
+ }
15813
+ keptLine;
15814
+ /** The kept words go to the transcript; `turn` = the words a new turn starts with (they grew into it: no line of their own). */
15815
+ flushKept(turn = "") {
15816
+ const p = this.keptLine;
15817
+ if (!p) return;
15818
+ this.keptLine = void 0;
15819
+ clearTimeout(p.timer);
15820
+ if (turn && norm3(turn).replace(/ /g, "").startsWith(norm3(p.text).replace(/ /g, ""))) {
15821
+ if (p.line) this.history.splice(this.history.indexOf(p.line), 1);
15822
+ return;
15823
+ }
15824
+ this.o.userLine(p.text, "kept");
15825
+ }
15737
15826
  /** The fill channel's spoken aside for an overlap judged 'keep' ("yeah" → "Oh yeah, definitely."): the host plays it
15738
15827
  * while the reply is held, then resumes the same reply (bod-voice decideOverlap's aside). ≤4 canned words, never a
15739
15828
  * claim, the cue's language; null = stay quiet (a plain listener cue, too soon after the last, or no line). It is a
@@ -15741,9 +15830,10 @@ var VoiceCall = class {
15741
15830
  aside(text) {
15742
15831
  const now4 = this.o.now();
15743
15832
  if (now4 - this.lastAside.at < this.o.asideGapMs) return null;
15744
- const line = overlapAside(text, this.lang, this.lastAside.text);
15833
+ const line = overlapAside(text, this.lang, this.lastAside.text, void 0, this.o.mode === "live");
15745
15834
  if (!line) return null;
15746
15835
  this.lastAside = { text: line, at: now4 };
15836
+ if (this.quickOn) this.history.push({ who: "you", text: line });
15747
15837
  this.o.onMetric({ name: "fill", kind: "aside", text: line, lang: this.lang });
15748
15838
  return line;
15749
15839
  }
@@ -15756,6 +15846,7 @@ var VoiceCall = class {
15756
15846
  return this.fill.drain();
15757
15847
  }
15758
15848
  end() {
15849
+ this.flushKept();
15759
15850
  if (this.cur) this.close(this.cur);
15760
15851
  this.ended = true;
15761
15852
  this.gate.end();
@@ -15771,18 +15862,24 @@ var VoiceCall = class {
15771
15862
  this.lang = l;
15772
15863
  if (l) this.fill.setLanguage(l, true);
15773
15864
  }
15865
+ get quickOn() {
15866
+ return this.o.mode === "live" && !!this.o.quick;
15867
+ }
15774
15868
  onTurn(t) {
15775
15869
  this.floor = "";
15870
+ this.flushKept(t.text);
15776
15871
  if (this.o.noteTurn && this.o.workReply && t.kind !== "replace" && this.working && !isClosing(t.text)) return void this.overWork(this.cur, t);
15872
+ const prev = this.cur, quick = this.quickOn && !this.working && (t.kind === "new" || prev?.lane !== "deep");
15777
15873
  const now4 = this.o.now(), lastWord = this.lastWordAt !== null;
15778
15874
  const at = this.lastWordAt ?? this.firstFinalAt ?? now4;
15779
15875
  const finalAt = this.finalAt || now4;
15780
15876
  this.firstFinalAt = null;
15781
15877
  this.lastWordAt = null;
15782
- if (this.cur) this.close(this.cur, t.replaces === this.cur.id ? "replaced" : void 0);
15878
+ if (this.quickOn) this.logCut();
15879
+ if (prev) this.close(prev, t.replaces === prev.id ? "replaced" : void 0);
15783
15880
  this.follow(t.text);
15784
15881
  this.clearProgress();
15785
- this.cur = { id: t.id, text: t.text, at, finalAt, lastWord, running: true, streamed: false, sounded: false, worded: false, done: false, marks: { sent: now4 }, closed: false, due: turnIntent(t.text) !== "closer", open: 0, tool: "", draft: "", drafting: false, draftAt: -Infinity };
15882
+ this.cur = { id: t.id, text: t.text, at, finalAt, lastWord, running: !quick, streamed: false, sounded: false, worded: false, done: false, marks: { sent: now4 }, closed: false, due: turnIntent(t.text) !== "closer", open: 0, tool: "", draft: "", drafting: false, draftAt: -Infinity, reply: "", ...this.quickOn ? { lane: quick ? "pending" : "deep" } : {} };
15786
15883
  const early = this.earlyHeard;
15787
15884
  this.earlyHeard = null;
15788
15885
  if (early && early.at >= at) {
@@ -15791,9 +15888,109 @@ var VoiceCall = class {
15791
15888
  }
15792
15889
  this.progress.turn();
15793
15890
  this.o.onMetric({ name: "turn", id: t.id, kind: t.kind, text: t.text });
15794
- this.o.sendTurn(t.text, { id: t.id, ...t.replaces ? { replaces: t.replaces } : {} });
15891
+ if (this.quickOn) {
15892
+ const last = this.history.at(-1);
15893
+ if (t.kind !== "new" && last?.who === "user") last.text = t.text;
15894
+ else this.history.push({ who: "user", text: t.text });
15895
+ }
15896
+ if (quick) return void this.quickTurn(this.cur, t);
15897
+ this.o.sendTurn(t.text, { id: t.id, ...t.replaces && (!this.quickOn || prev?.lane === "deep") ? { replaces: t.replaces } : {} });
15795
15898
  if (t.kind === "new") this.fill.onUserTurn(t.text, now4 - at, this.o.heardCut?.() ?? void 0);
15796
15899
  }
15900
+ /** A MAIN reply cut while it played: the history keeps the part heard; a resume may say the rest. */
15901
+ logCut() {
15902
+ const c = this.cutTurn;
15903
+ this.cutTurn = void 0;
15904
+ if (!c || c.cutRead) return;
15905
+ c.cutRead = true;
15906
+ this.cutRest = "";
15907
+ const heard = this.o.heardCut?.() ?? null;
15908
+ if (heard === null) return void this.logReply(c);
15909
+ if (c.logged) Object.assign(c.logged, { text: heard, cut: true });
15910
+ else this.history.push(c.logged = { who: "you", text: heard, cut: true });
15911
+ this.cutRest = this.o.cutRest?.() ?? "";
15912
+ }
15913
+ logReply(c) {
15914
+ if (c.lane !== "deep" || c.logged || !c.reply.trim()) return;
15915
+ this.history.push(c.logged = { who: "you", text: c.reply.replace(/\[[a-z ]+\]\s*/gi, "").trim() });
15916
+ }
15917
+ /** The quick lane owns this turn: it answers, acks and hands it to MAIN, resumes a cut answer, or stays quiet. A late
15918
+ * or unusable decision hands the turn to MAIN as before (the fill channel's bridge covers it). */
15919
+ async quickTurn(c, t) {
15920
+ const ac = new AbortController(), t0 = this.o.now(), lang = this.lang, rest = this.cutRest;
15921
+ c.ask = ac;
15922
+ const late = setTimeout(() => ac.abort(), this.o.quickBudgetMs);
15923
+ const mv = lang ? await this.o.quick({ history: this.history.slice(0, -1), heard: t.text, lang, rest }, ac.signal).catch((e) => {
15924
+ if (this.cur === c) log31.warn(`quick lane ${ac.signal.aborted ? `late (${this.o.quickBudgetMs}ms)` : `failed: ${e?.message ?? e}`} \u2014 deep lane`);
15925
+ return null;
15926
+ }).finally(() => clearTimeout(late)) : null;
15927
+ if (this.ended || this.cur !== c || c.closed) return;
15928
+ c.ask = void 0;
15929
+ this.o.onMetric({ name: "lane", id: c.id, kind: mv?.kind ?? "fallback", ms: Math.round(this.o.now() - t0), ...mv && "line" in mv && mv.line ? { text: mv.line } : mv?.kind === "deep" && mv.ack ? { text: mv.ack } : {} });
15930
+ const note = (n) => this.o.noteTurn?.(`[${n}]`);
15931
+ if (!mv || mv.kind === "deep") {
15932
+ c.lane = "deep";
15933
+ c.running = true;
15934
+ this.cutRest = "";
15935
+ const ack = mv?.kind === "deep" ? mv.ack : "", brief = mv?.kind === "deep" ? mv.brief : "";
15936
+ if (ack) {
15937
+ note(`You (the call's quick voice) already told them aloud: "${ack}". Do not acknowledge again \u2014 start with the answer itself.${brief && brief !== t.text ? ` It took their words to mean: ${brief}.` : ""}`);
15938
+ this.history.push({ who: "you", text: ack });
15939
+ }
15940
+ this.o.sendTurn(t.text, { id: t.id });
15941
+ if (!ack) return void this.fill.onUserTurn(t.text, this.o.now() - c.at, this.o.heardCut?.() ?? void 0);
15942
+ this.gate.replyStarted(c.id);
15943
+ if (await this.sayRetry(ack, "ack", c.id)) {
15944
+ this.o.show(ack, "ack");
15945
+ if (this.cur === c && c.running) this.beat(c);
15946
+ }
15947
+ return;
15948
+ }
15949
+ c.lane = "quick";
15950
+ this.o.userLine(t.text, "quick");
15951
+ if (mv.kind === "quiet") {
15952
+ c.due = false;
15953
+ return this.close(c, "silent");
15954
+ }
15955
+ const said = mv.kind === "resume" ? `${mv.line} ${cutSentence([...this.history].reverse().find((h) => h.who === "you" && h.cut)?.text ?? "")} ${rest}`.replace(/\s+/g, " ").trim() : mv.line;
15956
+ this.gate.replyStarted(c.id);
15957
+ if (!await this.sayRetry(said, "reply", c.id)) return this.close(c, "silent");
15958
+ this.o.show(said, "reply");
15959
+ if (mv.kind === "resume") {
15960
+ this.cutRest = "";
15961
+ this.o.dropCut?.();
15962
+ this.history.push({ who: "you", text: rest });
15963
+ note(`They asked you to go on, and you continued your cut answer aloud: "${rest}". All of it has now been said.`);
15964
+ } else {
15965
+ this.history.push({ who: "you", text: said });
15966
+ note(`On the call they said "${t.text}" and you (the call's quick voice) answered aloud: "${said}". Already said \u2014 do not repeat it.`);
15967
+ }
15968
+ if (this.o.hostAudio && !c.worded) {
15969
+ c.quickWord = true;
15970
+ return;
15971
+ }
15972
+ this.quickWorded(c, this.lastAudibleAt);
15973
+ }
15974
+ /** The quick lane's answer became audible at `at`: the turn's first word, and it is answered. */
15975
+ quickWorded(c, at) {
15976
+ c.quickWord = false;
15977
+ if (!c.worded) {
15978
+ c.worded = true;
15979
+ c.marks.mainAudio = at;
15980
+ this.o.onMetric({ name: "first_word", id: c.id, ms: Math.round(at - c.at), by: "quick" });
15981
+ }
15982
+ this.close(c, "answered");
15983
+ }
15984
+ /** say(), retried while the host's player is busy (up to 2s). */
15985
+ async sayRetry(line, kind, id) {
15986
+ for (let i = 0; i < 8; i++) {
15987
+ if (this.ended) return false;
15988
+ if (this.say(line, kind) !== false) return true;
15989
+ await new Promise((r) => setTimeout(r, 250));
15990
+ }
15991
+ this.o.onMetric({ name: "drop", id, kind: `${kind} unplayed`, text: line });
15992
+ return false;
15993
+ }
15797
15994
  onDrop(text, why) {
15798
15995
  if (!this.gate.holding) {
15799
15996
  this.firstFinalAt = null;
@@ -15817,7 +16014,7 @@ var VoiceCall = class {
15817
16014
  this.o.onMetric({ name: "fill", kind, text, lang: this.lang });
15818
16015
  if (kind !== "backchannel") this.progress.heard();
15819
16016
  const c = this.cur && !this.cur.closed ? this.cur : void 0;
15820
- const forTurn = !!c && (kind === "bridge" || kind === "progress" || kind === "filler" && c.running && !c.sounded);
16017
+ const forTurn = !!c && (kind === "bridge" || kind === "progress" || kind === "ack" || kind === "reply" || kind === "filler" && c.running && !c.sounded);
15821
16018
  if (c && forTurn && c.marks.fill === void 0) {
15822
16019
  c.marks.fill = this.o.now();
15823
16020
  c.fillKind = kind;
@@ -15827,7 +16024,7 @@ var VoiceCall = class {
15827
16024
  this.lastAudibleAt = this.o.now();
15828
16025
  if (c && forTurn) {
15829
16026
  c.marks.fillAudio ??= this.o.now();
15830
- this.sounded(c, kind === "progress" ? "progress" : "fill");
16027
+ this.sounded(c, kind === "progress" ? "progress" : kind === "ack" || kind === "reply" ? "quick" : "fill");
15831
16028
  }
15832
16029
  return r;
15833
16030
  }
@@ -15841,6 +16038,8 @@ var VoiceCall = class {
15841
16038
  close(c, end) {
15842
16039
  if (c.closed) return;
15843
16040
  c.closed = true;
16041
+ c.ask?.abort();
16042
+ this.logReply(c);
15844
16043
  c.end = c.worded ? "answered" : end ?? c.end ?? "silent";
15845
16044
  if (!c.worded) this.o.onMetric({ name: "first_word", id: c.id, by: "main", kind: c.end });
15846
16045
  const rel = (t) => t === void 0 ? void 0 : Math.round(t - c.at);
@@ -15877,17 +16076,14 @@ var VoiceCall = class {
15877
16076
  const line = own || (this.o.mode === "live" ? "" : answer);
15878
16077
  const stop = /^\s*stop\s*:/i.test(raw), change = !answer || /^\s*work\s*:/i.test(raw);
15879
16078
  const noted = `[The user said this on the call while you worked: "${t.text}".${line ? ` You answered aloud: "${line}".` : ""}${stop ? " That stopped the work." : ""} Take it into account; do not answer it again.]`;
16079
+ this.history.push({ who: "user", text: t.text });
16080
+ if (!change) this.o.userLine(t.text, "aside");
15880
16081
  if (line && !this.ended) {
15881
- for (let i = 0; i < 8 && this.say(line, "aside") === false; i++) {
15882
- if (i === 7) {
15883
- this.o.onMetric({ name: "drop", id: t.id, kind: "aside unplayed", text: line });
15884
- break;
15885
- }
15886
- await new Promise((r) => setTimeout(r, 250));
15887
- }
16082
+ await this.sayRetry(line, "aside", t.id);
15888
16083
  if (this.lastAudibleAt >= at) {
15889
16084
  this.progress.note(line);
15890
16085
  this.o.show(line, "aside");
16086
+ this.history.push({ who: "you", text: line });
15891
16087
  }
15892
16088
  } else if (!line) this.o.onMetric({ name: "drop", id: t.id, kind: "no aside line" });
15893
16089
  if (stop) {
@@ -15942,6 +16138,12 @@ var VoiceCall = class {
15942
16138
  }
15943
16139
  }
15944
16140
  };
16141
+ function cutSentence(heard) {
16142
+ const tail = heard.trim().split(/(?<=[.!?…])\s+/).at(-1) ?? "";
16143
+ if (!tail || /[.!?…]["'”’)]*$/.test(tail)) return "";
16144
+ const w = tail.split(/\s+/);
16145
+ return w.length <= 6 ? tail : w.slice(-3).join(" ");
16146
+ }
15945
16147
 
15946
16148
  // src/index.ts
15947
16149
  init_llm();
@@ -17475,6 +17677,13 @@ function bindVoiceCall(v, call, live, decideMs = 900) {
17475
17677
  held2 ??= ownCut();
17476
17678
  return held2?.full ? cutHeard(held2) : null;
17477
17679
  };
17680
+ call.options.cutRest = () => {
17681
+ held2 ??= ownCut();
17682
+ return held2?.full ? held2.full.slice(cutHeard(held2).length).trim() || null : null;
17683
+ };
17684
+ call.options.dropCut = () => {
17685
+ v.takeInterruptedReply();
17686
+ };
17478
17687
  o.onPartial = (t) => {
17479
17688
  if (live() && (own || !v.audible)) call.interim(t, performance.now(), v.usingAec);
17480
17689
  onPartial(t);
@@ -17832,7 +18041,7 @@ var JsonlDiagSink = class {
17832
18041
  };
17833
18042
 
17834
18043
  // src/voice/spokenFilter.ts
17835
- var SPOKEN_TURN = "Your reply is spoken aloud: answer in one to three short plain sentences \u2014 no markdown, headings, lists, links or code, and no sources line even when a tool asks you to cite them (offer to send them if asked) \u2014 and offer more detail only if asked.";
18044
+ var SPOKEN_TURN = `Your reply is spoken aloud: answer in one to three short plain sentences \u2014 no markdown, headings, lists, links or code, and no sources line even when a tool asks you to cite them (offer to send them if asked) \u2014 and offer more detail only if asked. Say only facts from this turn's tool results or this call, and keep a list in its source's order: "top" or "first" is its rank 1.`;
17836
18045
  var HEADS = ["sources", "source", "references", "citations", "links"];
17837
18046
  var MARKS = String.raw`[#*_>\s-]*`;
17838
18047
  var SOURCES = new RegExp(String.raw`(^|\n|[.!?…]\s)${MARKS}(?:${HEADS.join("|")})${MARKS}[::]`, "i");
@@ -17916,6 +18125,159 @@ ${o.persona}
17916
18125
  return line || o.fallback;
17917
18126
  }
17918
18127
 
18128
+ // src/voice/quickLane.ts
18129
+ init_logging();
18130
+ var log39 = forComponent("QuickLane");
18131
+ var SAY_WORDS = 30;
18132
+ var ACK_WORDS = 10;
18133
+ var ACKS = { en: ["On it.", "Sure, one sec.", "Okay, looking.", "Got it, checking."], he: ["\u05E8\u05D2\u05E2 \u05D0\u05D7\u05D3.", "\u05D0\u05D5\u05E7\u05D9\u05D9, \u05E9\u05E0\u05D9\u05D9\u05D4.", "\u05E9\u05E0\u05D9\u05D9\u05D4."] };
18134
+ function quickMove(raw, c) {
18135
+ const mv = rawMove(raw, c), owns = quickOwns(c.heard);
18136
+ if (owns === "reaction" && (!mv || mv.kind === "deep")) {
18137
+ const l = ownLine(ASIDES[c.lang]?.react, c);
18138
+ return l ? { kind: "say", line: l } : { kind: "quiet" };
18139
+ }
18140
+ if (isClosing(c.heard) && (!mv || mv.kind !== "say")) {
18141
+ const l = ownLine(BYES[c.lang], c);
18142
+ return l ? { kind: "say", line: l } : mv;
18143
+ }
18144
+ return mv;
18145
+ }
18146
+ var BYES = { en: ["Bye, talk soon!", "Take care, bye!"], he: ["\u05D1\u05D9\u05D9, \u05E0\u05D3\u05D1\u05E8!", "\u05DC\u05D4\u05EA\u05E8\u05D0\u05D5\u05EA!"] };
18147
+ var ownLine = (pool, c) => {
18148
+ const said = new Set(c.history.filter((h) => h.who === "you").map((h) => norm3(h.text)));
18149
+ return (pool ?? []).find((x) => !said.has(norm3(x))) ?? "";
18150
+ };
18151
+ function rawMove(raw, c) {
18152
+ const m = /^\s*(SAY|DEEP|RESUME|QUIET)\b\s*:?\s*(.*)$/im.exec(raw.trim());
18153
+ if (!m) return null;
18154
+ const kind = m[1].toUpperCase(), body = m[2].trim();
18155
+ const owns = quickOwns(c.heard);
18156
+ if (!owns && kind !== "DEEP") return { kind: "deep", ack: stockAck(c), brief: "" };
18157
+ if (kind === "QUIET") return { kind: "quiet" };
18158
+ if (kind === "RESUME") {
18159
+ const l = sayLine(body, c.lang);
18160
+ return !c.rest ? null : GO_ON.test(c.heard) ? { kind: "resume", line: l.split(/\s+/).length <= 5 ? l : "" } : { kind: "quiet" };
18161
+ }
18162
+ if (kind === "DEEP") {
18163
+ const [ack = "", brief = ""] = body.split(body.includes("|") ? "|" : /\s+[—–-]\s+/).map((s) => s.trim());
18164
+ const a = cleanLine(ack, c.lang, ACK_WORDS);
18165
+ const said = new Set(c.history.filter((h) => h.who === "you").map((h) => norm3(h.text)));
18166
+ const ok = a && !said.has(norm3(a)) && !RESULT_CLAIM_RE.test(a) && !new RegExp("\\p{N}", "u").test(a);
18167
+ return { kind: "deep", ack: ok ? a : stockAck(c), brief };
18168
+ }
18169
+ const line = sayLine(body, c.lang);
18170
+ if (!line) return null;
18171
+ if (parrots(line, c.heard)) return { kind: "quiet" };
18172
+ if (c.history.some((h) => h.who === "you" && norm3(h.text) === norm3(line))) return { kind: "quiet" };
18173
+ const facts = unknownFacts(line, c), novel = novelWords(line, c);
18174
+ const unknown = facts.length || novel.length >= 2 ? [...facts, ...novel] : [];
18175
+ if (unknown.length) {
18176
+ log39.debug(`quick line "${line}" names ${unknown.join(", ")} \u2014 not in the call: deep lane`);
18177
+ return { kind: "deep", ack: "", brief: "" };
18178
+ }
18179
+ return { kind: "say", line };
18180
+ }
18181
+ var stockAck = (c) => ownLine(ACKS[c.lang], c);
18182
+ function quickOwns(heard) {
18183
+ const t = heard.replace(/\s*[—–]\s*/g, " ").trim(), n = norm3(t);
18184
+ if (!n) return null;
18185
+ if (HOLD.test(t)) return "hold";
18186
+ if (GO_ON.test(t) && t.split(/\s+/).length <= 5) return "goon";
18187
+ if (!/(?:^|\s)(?:what|מה)(?:\s|$)/u.test(n) && isReaction(t)) return "reaction";
18188
+ if (GREET.test(n) || SMALL_TALK.test(n)) return "greeting";
18189
+ if (isClosing(t) || turnIntent(t) === "closer") return "closer";
18190
+ if (RESTATE.test(n)) return "restate";
18191
+ return null;
18192
+ }
18193
+ var GREET = /^(?:(?:hi|hey|hello|hiya|yo|good (?:morning|afternoon|evening)|שלום|היי|הי|בוקר טוב|ערב טוב)(?:\s+there)?\s*)+(?:(?:how are you|how are you doing|how's it going|hows it going|how is it going|what's up|whats up|how have you been|מה שלומך|מה נשמע|מה קורה)(?:\s+today)?)?$|^(?:how are you|how are you doing|how's it going|hows it going|how is it going|what's up|whats up|how have you been|מה שלומך|מה נשמע|מה קורה)(?:\s+today)?$/u;
18194
+ var SMALL_TALK = /^(?:(?:oh|yeah|well|so)\s+)*(?:i'?m|im|i am)\s+(?:good|fine|great|ok|okay|alright|well|doing (?:good|well|great|fine|ok|okay))(?:\s+(?:thanks|thank you))?(?:\s+(?:and|how about)?\s*(?:you|yourself))?$/u;
18195
+ var RESTATE = /^(?:(?:sorry|wait|okay|ok|so|and)\s+)*(?:say (?:that|it) again|come again|repeat (?:that|it)|can you repeat (?:that|it)|what did you (?:just )?say|which one was (?:that|it)|what was (?:that|it) again|pardon)$/u;
18196
+ function sayLine(s, lang) {
18197
+ const l = s.split("\n")[0].replace(/^["'“”«»]+|["'“”«»]+$/g, "").trim();
18198
+ const d = detectLanguage(l);
18199
+ const latinOnly = !new RegExp("\\p{L}", "u").test(l.replace(new RegExp("\\p{Script=Latin}", "gu"), "")), latinLang = fitsLanguage("ok", lang);
18200
+ return l && (d ? d === lang : fitsLanguage(l, lang) || latinOnly && latinLang) && l.split(/\s+/).length <= SAY_WORDS ? l : "";
18201
+ }
18202
+ function parrots(line, heard) {
18203
+ const h = new Set(norm3(heard).split(" ").filter(Boolean));
18204
+ const l = norm3(line).split(" ").filter((w) => w && !FILLER.has(w));
18205
+ return h.size <= 3 && l.length > 0 && l.every((w) => h.has(w));
18206
+ }
18207
+ var FILLER = new Set("oh ah uh um yeah yes so well".split(" "));
18208
+ function unknownFacts(line, c) {
18209
+ const known = norm3([c.heard, c.rest ?? "", ...c.history.map((h) => h.text)].join(" "));
18210
+ const knownSet = new Set(known.split(" "));
18211
+ const out = [];
18212
+ for (const s of line.split(/(?<=[.!?])\s+/)) {
18213
+ const ws = s.split(/\s+/);
18214
+ ws.forEach((w, i) => {
18215
+ const k = norm3(w);
18216
+ if (!k) return;
18217
+ const fact = new RegExp("\\p{N}", "u").test(k) || i > 0 && new RegExp("^\\p{Lu}", "u").test(w) && k !== "i" && !/^i'/.test(k);
18218
+ if (fact && !knownSet.has(k) && !knownSet.has(k.replace(/'s$/, ""))) out.push(w);
18219
+ });
18220
+ }
18221
+ return out;
18222
+ }
18223
+ function novelWords(line, c, within) {
18224
+ const st = (w) => w.replace(/['’]s$/, "").replace(new RegExp("(?<=\\p{L}{3})(?:es|s)$", "u"), "");
18225
+ const known = new Set(norm3(within ?? [c.heard, c.rest ?? "", ...c.history.map((h) => h.text)].join(" ")).split(" ").map(st));
18226
+ return norm3(line).split(" ").filter((w) => isContent(w) && !SOCIAL.has(w)).filter((w) => within ? known.has(st(w)) : !known.has(st(w)));
18227
+ }
18228
+ var SOCIAL = new Set("thanks thank doing well good great fine help assist today glad sure right crazy wild sorry problem welcome talk later hear nice awesome pretty happy know okay cool stuff night morning evening love care chat again anything else there think sounds absolutely course totally really amazing exactly definitely listening ahead want need would could like going about what that this these those something someone tell more much maybe just wanna gonna kidding believe insane unreal huh yeah sounds fun hope busy pleasure great".split(" "));
18229
+ var GO_ON = new RegExp("(?<!\\p{L})(?:go on|go ahead|continue|keep going|carry on|you were saying|as you were|finish (?:that|it)|\u05D4\u05DE\u05E9\u05D9\u05DB\u05D9|\u05D4\u05DE\u05E9\u05DA|\u05EA\u05DE\u05E9\u05D9\u05DB\u05D9|\u05EA\u05DE\u05E9\u05D9\u05DA|\u05DB\u05DF,? \u05EA\u05DE\u05E9\u05D9\u05DB\u05D9)(?!\\p{L})", "iu");
18230
+ var HOLD = /^(?:(?:okay|ok|oh|um|uh|so|sorry|no)[,.]?\s+)*(?:wait|hold on|hang on|one sec(?:ond)?|just a sec(?:ond)?|give me a sec(?:ond)?|רגע|שנייה|חכי|חכה)(?:[,.!—–-]?\s*(?:wait|hold on|hang on|a sec(?:ond)?|please|רגע))*[.!?…—–-]*$/iu;
18231
+ var HOLDS = { en: ["Sure.", "Sure, take your time.", "No problem."], he: ["\u05D1\u05D8\u05D7.", "\u05D0\u05D9\u05DF \u05D1\u05E2\u05D9\u05D4."] };
18232
+ function holdLine(c) {
18233
+ if (!HOLD.test(c.heard.trim())) return "";
18234
+ const said = new Set(c.history.filter((h) => h.who === "you").map((h) => norm3(h.text)));
18235
+ return (HOLDS[c.lang] ?? []).find((x) => !said.has(norm3(x))) ?? "";
18236
+ }
18237
+ function fastQuickLane(ai, model, gender, persona = "", hedgeMs = 900) {
18238
+ return async (c, signal) => {
18239
+ if (c.rest && GO_ON.test(c.heard)) return { kind: "resume", line: "" };
18240
+ const hold = holdLine(c);
18241
+ if (hold) return { kind: "say", line: hold };
18242
+ const ask = async () => {
18243
+ const raw = await fastText(ai, { model, prompt: quickPrompt(c, gender, persona), signal, temperature: 0.4 });
18244
+ const mv = quickMove(raw, c);
18245
+ if (!mv) log39.debug(`quick lane: unusable "${raw.slice(0, 80)}"`);
18246
+ return mv;
18247
+ };
18248
+ let timer;
18249
+ const first = ask();
18250
+ const second = new Promise((res, rej) => {
18251
+ timer = setTimeout(() => ask().then(res, rej), hedgeMs);
18252
+ });
18253
+ try {
18254
+ return await Promise.any([first, second]);
18255
+ } finally {
18256
+ clearTimeout(timer);
18257
+ }
18258
+ };
18259
+ }
18260
+ function quickPrompt(c, gender, persona = "") {
18261
+ const hist = c.history.slice(-12).map((h) => `${h.who === "user" ? "Them" : "You"}: ${h.text.slice(0, 400)}${h.cut ? " \u2014(they cut you here)" : ""}`).join("\n");
18262
+ return `${persona ? `Who you are on this call:
18263
+ ${persona.slice(0, 500)}
18264
+
18265
+ ` : ""}You are the quick voice of a live phone call. A slower expert colleague works behind you: they use tools, the web and files and think things through. You answer at once.
18266
+
18267
+ The call so far:
18268
+ ${hist || "(just started)"}
18269
+
18270
+ They just said: "${c.heard}"
18271
+ ` + (c.rest ? `Your last answer was cut. Its unsaid rest: "${c.rest.slice(0, 300)}"
18272
+ ` : "") + `
18273
+ Reply with exactly ONE line, one of:
18274
+ SAY: <your words> \u2014 ONLY a greeting or how-are-you, a short reaction ("wow", "really?"), a goodbye, or when they ask exactly to repeat something ALREADY said ("say that again", "which one was that?"). Any request ("tell me a story\u2026"), any question about content ("what is\u2026?", "wait, what?", "how long is it?") is DEEP, even if you could guess. Max two short sentences. Use only facts from the call above; never invent a name, number, news item or result.
18275
+ DEEP: <a 2-8 word acknowledgement> | <what the colleague must do, names spelled right> \u2014 anything needing a lookup, current information, tools, files, or real thinking. The acknowledgement says you're on it ("Sure, checking Hacker News.") and never a result. The speech-to-text misspells names: fix them from context ("Haka News" \u2192 Hacker News).
18276
+ QUIET \u2014 nothing is owed: a bare "okay", "mm-hm", or a reaction you already answered.
18277
+ "Wait" / "hold on" with nothing new: a brief SAY ("Sure.") \u2014 no work for the colleague. Vary your words: never reuse an acknowledgement or reaction already said in this call.
18278
+ A reaction ("wow", "really?") gets a short fitting reply in your own words ("I know, right?"), never their word back. Never repeat what was already said. Speak ${languageName(c.lang)}. ${personaHint(gender)} Output only the line.`;
18279
+ }
18280
+
17919
18281
  // cli/config.ts
17920
18282
  import { homedir as homedir5 } from "os";
17921
18283
  import { existsSync as existsSync5, readFileSync as readFileSync7 } from "fs";
@@ -18063,7 +18425,7 @@ function applyOverlay(cfg, file) {
18063
18425
  // cli/hooks-config.ts
18064
18426
  import { spawnSync as spawnSync4 } from "child_process";
18065
18427
  init_platform();
18066
- var log39 = forComponent("hooks");
18428
+ var log40 = forComponent("hooks");
18067
18429
  var escapeRegex = (s) => s.replace(/[.+^${}()|[\]\\]/g, "\\$&");
18068
18430
  function ruleMatches(rule, toolName) {
18069
18431
  if (!rule.tool || rule.tool === "*") return true;
@@ -18082,7 +18444,7 @@ function runCmd(rule, env) {
18082
18444
  });
18083
18445
  return { code: r.status ?? 1, out: ((r.stdout ?? "") + (r.stderr ?? "")).trim() };
18084
18446
  } catch (e) {
18085
- log39.debug(`hook command failed: ${rule.command}`, e);
18447
+ log40.debug(`hook command failed: ${rule.command}`, e);
18086
18448
  return { code: 1, out: String(e?.message ?? e) };
18087
18449
  }
18088
18450
  }
@@ -18190,7 +18552,7 @@ import { existsSync as existsSync6, mkdirSync as mkdirSync8, readFileSync as rea
18190
18552
  import { homedir as homedir6 } from "os";
18191
18553
  import { join as join11 } from "path";
18192
18554
  init_platform();
18193
- var log40 = forComponent("session");
18555
+ var log41 = forComponent("session");
18194
18556
  var globalDir = () => join11(homedir6(), ".agent", "sessions");
18195
18557
  function indexLink(target, link2) {
18196
18558
  try {
@@ -18253,7 +18615,7 @@ var SessionStore = class {
18253
18615
  }
18254
18616
  load(id) {
18255
18617
  if (!this.safeId(id)) {
18256
- log40.debug(`rejecting unsafe session id: ${id}`);
18618
+ log41.debug(`rejecting unsafe session id: ${id}`);
18257
18619
  return void 0;
18258
18620
  }
18259
18621
  const path = join11(this.dir, `${id}.json`);
@@ -18261,7 +18623,7 @@ var SessionStore = class {
18261
18623
  try {
18262
18624
  return JSON.parse(readFileSync8(path, "utf8"));
18263
18625
  } catch (e) {
18264
- log40.debug(`unreadable session ${id} \u2014 ignoring`, e);
18626
+ log41.debug(`unreadable session ${id} \u2014 ignoring`, e);
18265
18627
  return void 0;
18266
18628
  }
18267
18629
  }
@@ -18274,7 +18636,7 @@ var SessionStore = class {
18274
18636
  try {
18275
18637
  metas.push(JSON.parse(readFileSync8(join11(this.dir, f), "utf8")).meta);
18276
18638
  } catch (e) {
18277
- log40.debug(`skipping unreadable session file ${f}`, e);
18639
+ log41.debug(`skipping unreadable session file ${f}`, e);
18278
18640
  }
18279
18641
  }
18280
18642
  return metas.sort((a, b) => b.updated - a.updated);
@@ -18706,7 +19068,7 @@ import { promisify } from "util";
18706
19068
  import { writeFileSync as writeFileSync6, mkdirSync as mkdirSync9 } from "fs";
18707
19069
  import { homedir as homedir7 } from "os";
18708
19070
  import { join as join12, resolve as resolve4, sep as sep3, parse as parsePath } from "path";
18709
- var log41 = forComponent("checkpoints");
19071
+ var log42 = forComponent("checkpoints");
18710
19072
  var exec = promisify(execFile4);
18711
19073
  var DEFAULT_EXCLUDE = [".agent/", ".git/", "node_modules/", "dist/", "build/", ".next/", "target/", ".venv/", "__pycache__/", "*.log"];
18712
19074
  function isBroadRoot(p) {
@@ -18754,7 +19116,7 @@ var ShadowRepo = class {
18754
19116
  writeFileSync6(join12(this.gitDir, "info", "exclude"), this.exclude.join("\n") + "\n");
18755
19117
  this.ready = true;
18756
19118
  } catch (e) {
18757
- log41.debug(`git checkpoints unavailable for ${this.workTree}`, e);
19119
+ log42.debug(`git checkpoints unavailable for ${this.workTree}`, e);
18758
19120
  this.ready = false;
18759
19121
  }
18760
19122
  return this.ready;
@@ -18765,7 +19127,7 @@ var ShadowRepo = class {
18765
19127
  }
18766
19128
  async commit(label, forced = []) {
18767
19129
  await this.run("add", "-A");
18768
- for (const p of forced) await this.run("add", "-f", "--", p).catch((e) => log41.debug(`force-add failed: ${p}`, e));
19130
+ for (const p of forced) await this.run("add", "-f", "--", p).catch((e) => log42.debug(`force-add failed: ${p}`, e));
18769
19131
  await this.run("commit", "--allow-empty", "-q", "-m", label);
18770
19132
  }
18771
19133
  /** Inject the CURRENT (pre-edit) content of `paths` into the turn-open restore point by amending it.
@@ -18773,8 +19135,8 @@ var ShadowRepo = class {
18773
19135
  * turn-boundary `add -A` would never have captured it. Amend (vs a new commit) keeps one restore
18774
19136
  * point per turn, so the REPL's turn↔frame mapping stays intact. */
18775
19137
  async amendForced(paths) {
18776
- for (const p of paths) await this.run("add", "-f", "--", p).catch((e) => log41.debug(`force-capture failed: ${p}`, e));
18777
- await this.run("commit", "--amend", "--no-edit", "-q", "--allow-empty").catch((e) => log41.debug("amend failed", e));
19138
+ for (const p of paths) await this.run("add", "-f", "--", p).catch((e) => log42.debug(`force-capture failed: ${p}`, e));
19139
+ await this.run("commit", "--amend", "--no-edit", "-q", "--allow-empty").catch((e) => log42.debug("amend failed", e));
18778
19140
  }
18779
19141
  /** Commits on `ref`, oldest-first (canonical index space). */
18780
19142
  async log(ref) {
@@ -18834,7 +19196,7 @@ var ShadowRepo = class {
18834
19196
  await this.run("gc", "--auto", "-q").catch(() => {
18835
19197
  });
18836
19198
  } catch (e) {
18837
- log41.debug("checkpoint prune failed", e);
19199
+ log42.debug("checkpoint prune failed", e);
18838
19200
  }
18839
19201
  }
18840
19202
  };
@@ -18902,7 +19264,7 @@ var GitCheckpoints = class {
18902
19264
  use(sessionId) {
18903
19265
  if (sessionId === this.session) return;
18904
19266
  this.session = sessionId;
18905
- if (this.started) for (const r of this.repos) void r.point(this.ref()).catch((e) => log41.debug("re-point failed", e));
19267
+ if (this.started) for (const r of this.repos) void r.point(this.ref()).catch((e) => log42.debug("re-point failed", e));
18906
19268
  }
18907
19269
  async begin(label) {
18908
19270
  if (!await this.start()) return;
@@ -18922,7 +19284,7 @@ var GitCheckpoints = class {
18922
19284
  process.stderr.write(`\x1B[2m checkpoints: '${this.repos[i].root}' too large to snapshot in ${Math.round(this.options.opTimeoutMs / 1e3)}s \u2014 file rewind disabled here\x1B[0m
18923
19285
  `);
18924
19286
  } else {
18925
- log41.debug("checkpoint commit failed", e);
19287
+ log42.debug("checkpoint commit failed", e);
18926
19288
  survivors.push(this.repos[i]);
18927
19289
  survivorCaches.push(this.caches[i] ?? []);
18928
19290
  }
@@ -18957,7 +19319,7 @@ var GitCheckpoints = class {
18957
19319
  if (this.forced.has(abs)) continue;
18958
19320
  this.forced.add(abs);
18959
19321
  const i = this.repoIndexFor(abs);
18960
- if (i >= 0) await this.repos[i].amendForced([abs]).catch((e) => log41.debug("amendForced failed", e));
19322
+ if (i >= 0) await this.repos[i].amendForced([abs]).catch((e) => log42.debug("amendForced failed", e));
18961
19323
  }
18962
19324
  }
18963
19325
  };
@@ -20747,7 +21109,7 @@ import { spawnSync as spawnSync6 } from "child_process";
20747
21109
  import { writeFileSync as writeFileSync8, mkdirSync as mkdirSync10, readdirSync as readdirSync2, unlinkSync as unlinkSync3, chmodSync, existsSync as existsSync7 } from "fs";
20748
21110
  import { homedir as homedir8 } from "os";
20749
21111
  import { join as join14 } from "path";
20750
- var log42 = forComponent("os-sched");
21112
+ var log43 = forComponent("os-sched");
20751
21113
  var OsScheduler = class {
20752
21114
  options;
20753
21115
  constructor(options) {
@@ -20809,7 +21171,7 @@ var OsScheduler = class {
20809
21171
  }
20810
21172
  }
20811
21173
  } catch (e) {
20812
- log42.debug(`cancel ${id}`, e);
21174
+ log43.debug(`cancel ${id}`, e);
20813
21175
  }
20814
21176
  for (const f of [`${id}.json`, `${id}.sh`]) {
20815
21177
  try {
@@ -20927,7 +21289,7 @@ import { existsSync as existsSync8, mkdirSync as mkdirSync11, unlinkSync as unli
20927
21289
  import { homedir as homedir9 } from "os";
20928
21290
  import { join as join15 } from "path";
20929
21291
  init_platform();
20930
- var log43 = forComponent("remote-trigger");
21292
+ var log44 = forComponent("remote-trigger");
20931
21293
  var TRIGGER_DIR = () => join15(homedir9(), ".agent", "triggers");
20932
21294
  var sockPath = (sessionId, dir = TRIGGER_DIR()) => join15(dir, `${sessionId}.sock`);
20933
21295
  var TriggerServer = class {
@@ -20965,13 +21327,13 @@ var TriggerServer = class {
20965
21327
  conn.end(JSON.stringify({ ok: false, error: String(e) }) + "\n");
20966
21328
  }
20967
21329
  });
20968
- conn.on("error", (e) => log43.debug("trigger conn error", e));
21330
+ conn.on("error", (e) => log44.debug("trigger conn error", e));
20969
21331
  });
20970
- this.server.on("error", (e) => log43.debug("trigger server error", e));
21332
+ this.server.on("error", (e) => log44.debug("trigger server error", e));
20971
21333
  this.server.listen(p);
20972
21334
  this.path = p;
20973
21335
  } catch (e) {
20974
- log43.debug("trigger server unavailable", e);
21336
+ log44.debug("trigger server unavailable", e);
20975
21337
  }
20976
21338
  }
20977
21339
  /** Re-bind on /resume (the session id changed). */
@@ -21103,7 +21465,7 @@ var strike = C("9");
21103
21465
  var link = (text, url) => useColor ? `\x1B]8;;${url}\x1B\\${cyan(text)}\x1B]8;;\x1B\\` : `${text} (${url})`;
21104
21466
  var mdPalette = { bold, dim, cyan, italic, strike, green, link };
21105
21467
  var err = (s) => process.stderr.write(s);
21106
- var log44 = forComponent("cli");
21468
+ var log45 = forComponent("cli");
21107
21469
  var VERSION = (() => {
21108
21470
  try {
21109
21471
  return JSON.parse(readFileSync10(new URL("../package.json", import.meta.url), "utf8")).version ?? "?";
@@ -21260,6 +21622,7 @@ function parseArgs(argv) {
21260
21622
  } else if (x === "--lean") a.lean = true;
21261
21623
  else if (x === "--keep-alive") a.keepAlive = true;
21262
21624
  else if (x === "--channel-only") a.channelOnly = true;
21625
+ else if (x === "--quick-lane") a.quickLane = true;
21263
21626
  else if (x === "--channel-mode") a.channelMode = parseChannelMode(val(++i, x));
21264
21627
  else if (x === "--conversational" || x === "--convo" || x === "--voice") {
21265
21628
  a.voice = true;
@@ -21310,6 +21673,7 @@ function parseArgs(argv) {
21310
21673
  if (a.inputFormat && (!a.duplex && !a.print && !a.channelOnly || a.outputFormat !== "stream-json")) throw new Error("--input-format stream-json needs --output-format stream-json and --duplex (or --voice), --channel-only or -p");
21311
21674
  if (a.keepAlive && (!a.print || !a.inputFormat)) throw new Error("--keep-alive needs -p --input-format stream-json --output-format stream-json");
21312
21675
  if (a.channelOnly && !a.inputFormat) throw new Error("--channel-only needs --input-format stream-json --output-format stream-json");
21676
+ if (a.quickLane && !a.channelOnly) throw new Error("--quick-lane only applies with --channel-only (--call has it in live)");
21313
21677
  if (a.duplex && a.plan) throw new Error("--plan is not supported in --duplex (workers are non-interactive; a plan could never be approved)");
21314
21678
  if (a.voiceSystemPrompt && !a.duplex) throw new Error("--voice-system-prompt only applies with --duplex");
21315
21679
  if (a.voicePersona && !a.duplex && !a.channelOnly) throw new Error("--voice-persona only applies with --call or --channel-only");
@@ -21376,6 +21740,9 @@ Flags:
21376
21740
  enter the agent's history (headless: stdin interim/pause/agent_state, stdout channel)
21377
21741
  --channel-only headless (--input-format stream-json): ONLY the second channel, for a host whose main
21378
21742
  answer comes from elsewhere (stdin user/text/barge/interim/pause/agent_state, stdout channel)
21743
+ --quick-lane with --channel-only --channel-mode live: two lanes, as --call \u2014 the quick lane answers chit-chat
21744
+ and reactions itself and acks real work before MAIN's turn; the host takes {type:'note'} lines
21745
+ into MAIN's next turn and sends {type:'cut', full, heard} (README: Fill channel for host apps)
21379
21746
  --voice-persona <f> call persona from a file: replaces the default call style in MAIN's prompt and tells the live
21380
21747
  prediction tree who is speaking (--call / --channel-only; as Para's Settings > Call persona)
21381
21748
  --channel-mode <m> second-channel talkativeness: turn (only a bridge when the answer is slow) | normal
@@ -22007,7 +22374,7 @@ function turnCost(model, usage) {
22007
22374
  const priced = model.startsWith("claude-code/") ? `anthropic/${resolveModelAlias(model.slice("claude-code/".length))}` : model;
22008
22375
  return costOf(getModelInfo(priced)?.pricing, usage?.promptTokens ?? 0, usage?.completionTokens ?? 0, usage?.cacheCreationTokens ?? 0, usage?.cacheReadTokens ?? 0, priced);
22009
22376
  }
22010
- async function evaluateGoal(ai, condition, transcript, log45) {
22377
+ async function evaluateGoal(ai, condition, transcript, log46) {
22011
22378
  const recent = transcript.filter((m) => m.role === "assistant").slice(-8).map((m) => {
22012
22379
  const text = typeof m.content === "string" ? m.content : m.content.filter((p) => p.type === "text").map((p) => p.text).join(" ");
22013
22380
  return text.slice(0, 600);
@@ -22027,7 +22394,7 @@ ${recent}` }
22027
22394
  const match = r.content.match(/\{[\s\S]*\}/);
22028
22395
  if (match) return JSON.parse(match[0]);
22029
22396
  } catch (e) {
22030
- log45(dim(` (goal evaluator error: ${e?.message ?? e})
22397
+ log46(dim(` (goal evaluator error: ${e?.message ?? e})
22031
22398
  `));
22032
22399
  }
22033
22400
  return { met: false, reason: "evaluation unclear" };
@@ -22255,7 +22622,7 @@ function mcpAgentTools(mounted, opts) {
22255
22622
  return tools;
22256
22623
  }
22257
22624
  async function closeMcp(mounted) {
22258
- await Promise.all(mounted.map((m) => m.client.close().catch((e) => log44.debug("mcp close failed", e))));
22625
+ await Promise.all(mounted.map((m) => m.client.close().catch((e) => log45.debug("mcp close failed", e))));
22259
22626
  }
22260
22627
  var IMG_EXT = { ".png": "image/png", ".jpg": "image/jpeg", ".jpeg": "image/jpeg", ".gif": "image/gif", ".webp": "image/webp" };
22261
22628
  function mentionRefs(line) {
@@ -22314,7 +22681,7 @@ async function expandMentions(fs, line) {
22314
22681
  if (loaded.includes(ref) || missing.includes(ref)) continue;
22315
22682
  if (ref.includes(":") && mcpMentionResolver) {
22316
22683
  const body = await mcpMentionResolver(ref).catch((e) => {
22317
- log44.debug("mcp mention resolve failed", e);
22684
+ log45.debug("mcp mention resolve failed", e);
22318
22685
  return null;
22319
22686
  });
22320
22687
  if (body != null) {
@@ -22340,7 +22707,7 @@ ${await fs.readFile(path)}`);
22340
22707
  ${blocks.join("\n\n")}` : line, loaded, missing };
22341
22708
  }
22342
22709
  function applyTurnMode(agent, session, task, flags = {}, onModel) {
22343
- const p = parseDirectives(task, { strict: true, keys: ["model", "turns", "delegate", "advisor", "mode"], warn: (m) => log44.debug(m) });
22710
+ const p = parseDirectives(task, { strict: true, keys: ["model", "turns", "delegate", "advisor", "mode"], warn: (m) => log45.debug(m) });
22344
22711
  const d = p.directives, isMode = !!(d.delegate || d.advisor || d.modeOff);
22345
22712
  if (p.unresolvedModel && /->|<-|delegate:|advisor:/.test(task.slice(0, task.length - p.prompt.length))) {
22346
22713
  err(red(` \u2717 unknown model "${p.unresolvedModel}"${p.ambiguous ? ` (could be: ${p.ambiguous.join(", ")})` : ""} \u2014 turn not sent
@@ -22433,7 +22800,7 @@ async function runTurn(agent, store, session, task, cp, cwd = process.cwd(), sen
22433
22800
  try {
22434
22801
  store.save(session);
22435
22802
  } catch (ex) {
22436
- log44.debug("mid-turn session flush failed", ex);
22803
+ log45.debug("mid-turn session flush failed", ex);
22437
22804
  }
22438
22805
  }
22439
22806
  return origNotify(e);
@@ -22597,14 +22964,14 @@ var isCancelTeardown = (e) => {
22597
22964
  function installCancelGuards(mounted) {
22598
22965
  process.on("unhandledRejection", (e) => {
22599
22966
  if (isCancelTeardown(e)) {
22600
- log44.debug("suppressed unhandledRejection (cursor stream cancel)", e);
22967
+ log45.debug("suppressed unhandledRejection (cursor stream cancel)", e);
22601
22968
  return;
22602
22969
  }
22603
- log44.error("unhandledRejection", e);
22970
+ log45.error("unhandledRejection", e);
22604
22971
  });
22605
22972
  process.on("uncaughtException", (e) => {
22606
22973
  if (isCancelTeardown(e)) {
22607
- log44.debug("suppressed uncaughtException (cursor stream cancel)", e);
22974
+ log45.debug("suppressed uncaughtException (cursor stream cancel)", e);
22608
22975
  return;
22609
22976
  }
22610
22977
  console.error(e);
@@ -22946,11 +23313,20 @@ async function repl(args, ai, cfg, cwd) {
22946
23313
  call = new VoiceCall({
22947
23314
  ai,
22948
23315
  ...fast.options,
23316
+ // live: the quick lane owns the conversation, MAIN is its deep lane (#1331). Only here: its lines reach MAIN through
23317
+ // noteTurn, which a --channel-only host (Para) does not take yet.
23318
+ ...args.channelMode === "live" && process.env.AGENTX_QUICK_LANE !== "0" ? { quick: fastQuickLane(ai, fast.options.fastModel, args.voiceGender, args.voicePersona) } : {},
22949
23319
  show: (t, kind) => {
22950
23320
  err("\r\x1B[0J" + dim(` \u21B3 ${kind === "progress" ? "\u22EF " : ""}${t}
22951
23321
  `));
22952
23322
  editorRef?.redrawNow();
22953
23323
  },
23324
+ // every user line shows, not only the ones MAIN runs on (live 20261104-111333: quick-lane turns and kept "Oh, wow." were missing)
23325
+ userLine: (t, how) => {
23326
+ err(`\r\x1B[0J ${bold(cyan("\u{1F3A4} \u203A"))} ${t}${how === "kept" ? dim(" (over the reply)") : ""}
23327
+ `);
23328
+ editorRef?.redrawNow();
23329
+ },
22954
23330
  onMetric: (m) => voiceDiag?.push({ t: performance.now(), ...m, kind: `call_${m.name}`, ...m.kind ? { what: m.kind } : {} }),
22955
23331
  abortTurn: (id) => {
22956
23332
  if (callTurns.get(id)?.running) {
@@ -22995,7 +23371,7 @@ ${SPOKEN_TURN}`, { id });
22995
23371
  editorRef?.abort();
22996
23372
  }
22997
23373
  } catch (e) {
22998
- log44.error("call turn failed", e);
23374
+ log45.error("call turn failed", e);
22999
23375
  } finally {
23000
23376
  rec.running = false;
23001
23377
  call?.main({ type: "done", id });
@@ -23145,7 +23521,7 @@ ${SPOKEN_TURN}`, { id });
23145
23521
  try {
23146
23522
  mkdirSync12(dir, { recursive: true });
23147
23523
  } catch (e) {
23148
- log44.debug("paste image dir create failed", e);
23524
+ log45.debug("paste image dir create failed", e);
23149
23525
  }
23150
23526
  const img = grabClipboardImage(dir, String(Date.now()));
23151
23527
  return img ? { display: "Image", ref: "@" + img.path, path: img.path } : null;
@@ -23258,7 +23634,7 @@ Added entries are loadable now via the Skill/SlashCommand tools; removed ones ar
23258
23634
  mkdirSync12(join16(cwd, ".agent"), { recursive: true });
23259
23635
  appendFileSync2(histPath, line + "\n");
23260
23636
  } catch (e) {
23261
- log44.debug("history write failed", e);
23637
+ log45.debug("history write failed", e);
23262
23638
  }
23263
23639
  };
23264
23640
  const ago = (t) => {
@@ -23330,7 +23706,7 @@ Added entries are loadable now via the Skill/SlashCommand tools; removed ones ar
23330
23706
  try {
23331
23707
  store.save(session);
23332
23708
  } catch (e) {
23333
- log44.debug("session save after rewind failed", e);
23709
+ log45.debug("session save after rewind failed", e);
23334
23710
  }
23335
23711
  err(green(" \u27F2 jumped back") + dim(` \u2014 ${face.transcript.length} message(s) kept; edit + resend
23336
23712
  `));
@@ -23365,7 +23741,7 @@ ${task}`;
23365
23741
  bangContext.length = 0;
23366
23742
  }
23367
23743
  const delta = await refreshCatalogs().catch((e) => {
23368
- log44.debug("catalog refresh failed", e);
23744
+ log45.debug("catalog refresh failed", e);
23369
23745
  return "";
23370
23746
  });
23371
23747
  if (delta) {
@@ -23639,7 +24015,7 @@ ${task}`;
23639
24015
  desc: "rescan skills/commands dirs and rebuild the system prompt (one cache miss) \u2014 picks up entries created mid-session",
23640
24016
  run: async () => {
23641
24017
  await refreshCatalogs().catch((e) => {
23642
- log44.debug("catalog refresh failed", e);
24018
+ log45.debug("catalog refresh failed", e);
23643
24019
  });
23644
24020
  face.reprepare();
23645
24021
  err(green(` \u2713 reloaded \u2014 ${skills.length} skill(s), ${cmds.length} command(s); system prompt rebuilds on next message
@@ -24142,7 +24518,7 @@ ${task}`;
24142
24518
  try {
24143
24519
  for (const def of (await loadAgents(fs2, d)).agents) if (!seen.has(def.name)) seen.set(def.name, { def, from: d });
24144
24520
  } catch (e) {
24145
- log44.debug(`loadAgents(${d}) failed`, e);
24521
+ log45.debug(`loadAgents(${d}) failed`, e);
24146
24522
  }
24147
24523
  }
24148
24524
  if (!seen.size) {
@@ -24230,7 +24606,7 @@ ${task}`;
24230
24606
  }
24231
24607
  if (idx >= 0) {
24232
24608
  const old = mounted.splice(idx, 1)[0];
24233
- await old.client.close().catch((e) => log44.debug("mcp close failed", e));
24609
+ await old.client.close().catch((e) => log45.debug("mcp close failed", e));
24234
24610
  }
24235
24611
  try {
24236
24612
  const m = await mountMcpServer(name, conf);
@@ -24258,7 +24634,7 @@ ${task}`;
24258
24634
  }
24259
24635
  const m = mounted.splice(idx, 1)[0];
24260
24636
  remountMcpTools();
24261
- await m.client.close().catch((e) => log44.debug("mcp close failed", e));
24637
+ await m.client.close().catch((e) => log45.debug("mcp close failed", e));
24262
24638
  err(dim(` removed "${name}"
24263
24639
  `));
24264
24640
  return;
@@ -24461,7 +24837,7 @@ ${task}`;
24461
24837
  try {
24462
24838
  return readdirSync4(join16(cwd, absDir.replace(/^\/+/, "")), { withFileTypes: true }).map((d) => ({ name: d.name, dir: d.isDirectory() }));
24463
24839
  } catch (e) {
24464
- log44.debug("completion readdir failed", absDir, e);
24840
+ log45.debug("completion readdir failed", absDir, e);
24465
24841
  return null;
24466
24842
  }
24467
24843
  };
@@ -24600,7 +24976,7 @@ ${out}
24600
24976
  return;
24601
24977
  }
24602
24978
  await refreshCatalogs().catch((e) => {
24603
- log44.debug("catalog refresh failed", e);
24979
+ log45.debug("catalog refresh failed", e);
24604
24980
  });
24605
24981
  const sk = skills.find((x) => x.name === name);
24606
24982
  if (sk) {
@@ -24730,7 +25106,7 @@ ${out}
24730
25106
  if (delivery || cut) dx?.parkCutDelivery(delivery, !!cut, heard);
24731
25107
  const cutReply = cut && cut.full.length - cut.heard.length > 40 ? cut : null;
24732
25108
  const noteP = replaces ? replaces.note : !cutReply ? Promise.resolve("") : (instinct ? instinct.bargeIntent(text).catch((e) => {
24733
- log44.warn(`barge intent failed \u2014 model decides: ${e.message}`);
25109
+ log45.warn(`barge intent failed \u2014 model decides: ${e.message}`);
24734
25110
  return void 0;
24735
25111
  }) : Promise.resolve(void 0)).then(async (intent) => interruptionNote(cutReply, intent) + ackedNote(await instinct?.ackFor(text)));
24736
25112
  const cutIn = replaces ? replaces.cutIn : interjectNote;
@@ -25131,10 +25507,10 @@ function channelOptions(ai, model, gender) {
25131
25507
  // 0: the reactive live path
25132
25508
  pickLeaf: fastLeafPicker(ai, process.env.AGENTX_LEAF_MODEL || "groq/openai/gpt-oss-120b"),
25133
25509
  persona: process.env.AGENTX_CALL_PERSONA ?? "",
25134
- onTree: (e) => log44.debug(`voice tree: ${e.branches} branches in ${e.ms}ms${e.tokens ? ` tokens ${e.tokens.input}/${e.tokens.output}` : ""}${e.error ? ` error ${e.error}` : ""}`),
25510
+ onTree: (e) => log45.debug(`voice tree: ${e.branches} branches in ${e.ms}ms${e.tokens ? ` tokens ${e.tokens.input}/${e.tokens.output}` : ""}${e.error ? ` error ${e.error}` : ""}`),
25135
25511
  onEvent: (e) => {
25136
- if (e.moment) log44.debug(`voice leaf: ${e.moment} ${e.conf} "${e.text}" ${e.acted}`);
25137
- else log44.debug(`channel ${e.trigger}: rule=${e.rule} choice=${e.choice ?? "-"} \u2192 ${e.acted}${e.text ? ` "${e.text}"` : ""}${e.cue ? " (planned cue)" : ""} ${e.ms}ms`);
25512
+ if (e.moment) log45.debug(`voice leaf: ${e.moment} ${e.conf} "${e.text}" ${e.acted}`);
25513
+ else log45.debug(`channel ${e.trigger}: rule=${e.rule} choice=${e.choice ?? "-"} \u2192 ${e.acted}${e.text ? ` "${e.text}"` : ""}${e.cue ? " (planned cue)" : ""} ${e.ms}ms`);
25138
25514
  },
25139
25515
  // Banks in the user's language: generated once per language, cached + topped up across sessions (~/.agent/cache).
25140
25516
  banks: new ChannelBanks({ generate: fastBankGenerator(ai, model), cacheDir: join16(homedir10(), ".agent", "cache", "channel-banks") }),
@@ -25161,7 +25537,7 @@ function overlapResponder(ai, mode, out, aside) {
25161
25537
  const judge = softBarge(mode) ? new OverlapJudge({ model: overlapModelFor(ai) }) : void 0;
25162
25538
  return (m) => {
25163
25539
  const text = String(m.text ?? "");
25164
- void (judge ? judge.judge(text) : Promise.resolve({ verdict: "cut", by: "mode", ms: 0 })).then((d) => {
25540
+ void (mode === "live" && isReaction(text) ? Promise.resolve({ verdict: "keep", by: "reaction", ms: 0 }) : judge ? judge.judge(text) : Promise.resolve({ verdict: "cut", by: "mode", ms: 0 })).then((d) => {
25165
25541
  const line = d.verdict === "keep" ? aside?.(text) : null;
25166
25542
  out({ type: "overlap", ...m.id !== void 0 ? { id: m.id } : {}, verdict: d.verdict, by: d.by, ms: d.ms, ...line ? { aside: line } : {} });
25167
25543
  });
@@ -25228,7 +25604,7 @@ async function duplexServe(args, ai, cfg, cwd) {
25228
25604
  try {
25229
25605
  store.save(session);
25230
25606
  } catch (e) {
25231
- log44.warn("duplex session save failed", e);
25607
+ log45.warn("duplex session save failed", e);
25232
25608
  }
25233
25609
  };
25234
25610
  const overlap2 = overlapResponder(ai, args.duplexV2 ? args.channelMode : void 0, out);
@@ -25268,7 +25644,7 @@ async function duplexServe(args, ai, cfg, cwd) {
25268
25644
  done2();
25269
25645
  out({ type: "turn_done", id, finishReason: res?.finishReason ?? "error", ...why ? { error: why } : {} });
25270
25646
  }).catch((e) => {
25271
- log44.error("duplex turn failed", e);
25647
+ log45.error("duplex turn failed", e);
25272
25648
  done2();
25273
25649
  out({ type: "turn_done", id, finishReason: "error", error: String(e?.message ?? e) });
25274
25650
  });
@@ -25285,9 +25661,23 @@ async function duplexServe(args, ai, cfg, cwd) {
25285
25661
  async function channelServe(args, ai, cfg) {
25286
25662
  const out = (o) => process.stdout.write(JSON.stringify(o) + "\n");
25287
25663
  const { model, notes, options: fast } = callFast(args, ai, cfg);
25664
+ const quick = args.quickLane && args.channelMode === "live" && process.env.AGENTX_QUICK_LANE !== "0";
25665
+ let cut = null;
25288
25666
  const call = new VoiceCall({
25289
25667
  ...fast,
25290
25668
  // no `ai` here: the channel's model wiring is explicit
25669
+ ...quick ? {
25670
+ quick: fastQuickLane(ai, fast.fastModel, args.voiceGender, process.env.AGENTX_CALL_PERSONA ?? ""),
25671
+ noteTurn: (text) => out({ type: "note", text }),
25672
+ heardCut: () => cut?.heard ?? null,
25673
+ cutRest: () => cut && cut.full.slice(cut.heard.length).trim() || null,
25674
+ dropCut: () => {
25675
+ cut = null;
25676
+ out({ type: "resumed" });
25677
+ },
25678
+ // the rest was said: the host's cut note no longer holds
25679
+ userLine: (text, how) => out({ type: "user_line", text, how })
25680
+ } : {},
25291
25681
  channel: { ...fast.channel, onTree: (e) => out({ type: "metric", name: "tree", ms: e.ms, kind: `${e.tokens ? `${e.tokens.input}/${e.tokens.output} tok ` : ""}${e.error ?? (e.lines ?? []).join(" | ")}` }), onLeaf: (e) => out({ type: "metric", name: "leaf", ms: e.ms, kind: `${e.moment} ${e.conf} ${e.acted}`, text: e.text }) },
25292
25682
  speak: (line, kind) => {
25293
25683
  out(channelLine(line, kind));
@@ -25306,8 +25696,11 @@ async function channelServe(args, ai, cfg) {
25306
25696
  const overlap2 = overlapResponder(ai, args.channelMode, (o) => {
25307
25697
  if (o.verdict === "cut") call.barge();
25308
25698
  out(o);
25309
- }, (t) => call.aside(t));
25310
- out({ type: "ready", model, channelMode: args.channelMode, softBarge: softBarge(args.channelMode), call: true, ...notes.length ? { notes } : {} });
25699
+ }, (t) => {
25700
+ call.kept(t);
25701
+ return call.aside(t);
25702
+ });
25703
+ out({ type: "ready", model, channelMode: args.channelMode, softBarge: softBarge(args.channelMode), call: true, ...quick ? { quickLane: true } : {}, ...notes.length ? { notes } : {} });
25311
25704
  const rl = createInterface({ input: process.stdin });
25312
25705
  rl.on("line", (line) => {
25313
25706
  let m;
@@ -25321,7 +25714,10 @@ async function channelServe(args, ai, cfg) {
25321
25714
  if (typeof m.text === "string") call.interim(m.text, Date.now(), typeof m.aec === "boolean" ? m.aec : void 0);
25322
25715
  } else if (m.type === "final" && typeof m.text === "string") call.final(m.text, m.sttId === void 0 ? void 0 : String(m.sttId), { ...typeof m.lastWordAgoMs === "number" ? { lastWordAgoMs: m.lastWordAgoMs } : {}, ...typeof m.lang === "string" ? { lang: m.lang } : {} });
25323
25716
  else if (m.type === "heard" && ["fill", "progress", "main"].includes(m.by)) call.heard(m.by, typeof m.inMs === "number" ? m.inMs : 0);
25324
- else if (m.type === "main" && m.ev && typeof m.ev.type === "string") call.main(m.ev);
25717
+ else if (m.type === "cut") {
25718
+ const full = String(m.full ?? "").trim(), heard = String(m.heard ?? "").trim();
25719
+ cut = full && heard.length < full.length && full.startsWith(heard) ? { full, heard } : null;
25720
+ } else if (m.type === "main" && m.ev && typeof m.ev.type === "string") call.main(m.ev);
25325
25721
  else if (m.type === "barge") call.barge();
25326
25722
  else if (channelInput(call.fill, m)) return;
25327
25723
  else if (m.type === "user" && typeof m.text === "string") call.hostTurn(m.text);