@livx.cc/agentx 0.99.148 → 0.99.150
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 +273 -68
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +23 -7
- package/dist/index.js +118 -62
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -7933,9 +7933,11 @@ var VoiceEngineOptions = class {
|
|
|
7933
7933
|
/** HOST-DECIDED short overlaps (opt-in; 0 = off = cede on ≥2 genuine words, as always). The fast "≥2 novel words →
|
|
7934
7934
|
* cede" rule cannot tell a reaction ("Oh, that's new") from a barge, and it fires ~300ms before a host-side judge
|
|
7935
7935
|
* (e.g. an AI instinct) can answer — so a judge could never keep a delivery going (live 20260923-125143: ceded on
|
|
7936
|
-
* "Oh, that", the judge said keep_talking 300ms later). When > 0, a SHORT genuine overlap (≤ overlapDecideMaxWords
|
|
7937
|
-
*
|
|
7938
|
-
*
|
|
7936
|
+
* "Oh, that", the judge said keep_talking 300ms later). When > 0, a SHORT genuine overlap (≤ overlapDecideMaxWords —
|
|
7937
|
+
* its words are the host's to judge: a '?' or "what" ceded "What?" / "You're serious?", reactions, live
|
|
7938
|
+
* 20261103-114604) keeps the pause and waits for `decideOverlap()`; every new partial while waiting is re-offered
|
|
7939
|
+
* (`overlap_pause` redecide); with no decision after this many ms it cedes. Long barges still cede instantly. Audio
|
|
7940
|
+
* is already paused, so waiting costs no talk-over. */
|
|
7939
7941
|
overlapDecideMs = 0;
|
|
7940
7942
|
/** Longest overlap (words) the host decides; also how far an overlap the host kept may grow before it cedes. */
|
|
7941
7943
|
overlapDecideMaxWords = 4;
|
|
@@ -8829,17 +8831,39 @@ var VoiceEngine = class _VoiceEngine {
|
|
|
8829
8831
|
* that reuse a few of our words — live 20260923-102258, right after a barge over "…Gemini 3.8 Flash…":
|
|
8830
8832
|
* "Wait, there is a new Gemini model?" (3 novel / 6) was dropped twice and the user had to repeat it. Echo
|
|
8831
8833
|
* of our own audio reproduces RUNS of what we said, in order (mis-hearings break a word, not the run); a
|
|
8832
|
-
* reply that shares vocabulary scatters it. So a ≥4-word final that fails the bag test is echo only if
|
|
8833
|
-
*
|
|
8834
|
+
* reply that shares vocabulary scatters it. So a ≥4-word final that fails the bag test is echo only if ¾ of its
|
|
8835
|
+
* words line up, in order, inside ONE stretch of what we said (a mis-heard word breaks a word, not the line), or it
|
|
8836
|
+
* repeats ≥5 of our words verbatim in a row (a mis-heard tail: "…the latest email from you"). A user who quotes a few
|
|
8837
|
+
* of our last words in their own sentence is neither: live 20261103-114604, over "…Want me to open the thread?" the
|
|
8838
|
+
* 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
|
+
* (half the words in a word pair we said) counted it as echo. Shorter finals can't show order → bag rule. */
|
|
8834
8840
|
echoFinal(text) {
|
|
8835
8841
|
if (this.genuine(text)) return false;
|
|
8836
8842
|
const w = this.words(text);
|
|
8837
8843
|
if (w.length < 4) return true;
|
|
8838
8844
|
const said = this.words(`${this.prevReply} ${this.reply} ${this.lastAck}`);
|
|
8839
|
-
const
|
|
8840
|
-
|
|
8841
|
-
for (let i =
|
|
8842
|
-
|
|
8845
|
+
const span = w.length + 2;
|
|
8846
|
+
let best = 0, run = 0;
|
|
8847
|
+
for (let i = 0; i < said.length && best < w.length; i++) {
|
|
8848
|
+
if (!w.includes(said[i])) continue;
|
|
8849
|
+
for (let j = 0; j < w.length; j++) {
|
|
8850
|
+
let k = 0;
|
|
8851
|
+
while (w[j + k] !== void 0 && w[j + k] === said[i + k]) k++;
|
|
8852
|
+
run = Math.max(run, k);
|
|
8853
|
+
}
|
|
8854
|
+
const win = said.slice(i, i + span);
|
|
8855
|
+
const row = new Array(win.length + 1).fill(0);
|
|
8856
|
+
for (const x of w) {
|
|
8857
|
+
let diag = 0;
|
|
8858
|
+
for (let j = 1; j <= win.length; j++) {
|
|
8859
|
+
const up = row[j];
|
|
8860
|
+
row[j] = x === win[j - 1] ? diag + 1 : Math.max(row[j], row[j - 1]);
|
|
8861
|
+
diag = up;
|
|
8862
|
+
}
|
|
8863
|
+
}
|
|
8864
|
+
best = Math.max(best, row[win.length]);
|
|
8865
|
+
}
|
|
8866
|
+
return best * 4 >= w.length * 3 || run >= 5;
|
|
8843
8867
|
}
|
|
8844
8868
|
/** Display a partial — unless it's echo-shaped during/after our own speech (degraded-AEC bleed), or the STT's trailing
|
|
8845
8869
|
* re-emit of the line just dispatched (Soniox emits partials after <end>): the host types partials into its input box,
|
|
@@ -8912,7 +8936,8 @@ var VoiceEngine = class _VoiceEngine {
|
|
|
8912
8936
|
this.cedeOverlap("overlap_cede", txt);
|
|
8913
8937
|
return;
|
|
8914
8938
|
}
|
|
8915
|
-
if (
|
|
8939
|
+
if (this.options.overlapDecideMs > 0) this.awaitOverlapDecision(txt);
|
|
8940
|
+
else if (!this.decideTimer) this.armResume();
|
|
8916
8941
|
return;
|
|
8917
8942
|
}
|
|
8918
8943
|
const barge = this.usingAec ? this.genuine(text) : this.novelWords(text).length >= (this.suspectUntil ? 1 : 2);
|
|
@@ -9458,29 +9483,10 @@ var VoiceEngine = class _VoiceEngine {
|
|
|
9458
9483
|
return this.usingAec && this.options.overlapPause && this.player.canPause;
|
|
9459
9484
|
}
|
|
9460
9485
|
/** Stop/question words that make an overlap an obvious barge — never held for a host decision. */
|
|
9461
|
-
static OVERLAP_CEDE_WORDS = /* @__PURE__ */ new Set([
|
|
9462
|
-
"stop",
|
|
9463
|
-
"wait",
|
|
9464
|
-
"no",
|
|
9465
|
-
"hold",
|
|
9466
|
-
"hang",
|
|
9467
|
-
"pause",
|
|
9468
|
-
"quiet",
|
|
9469
|
-
"enough",
|
|
9470
|
-
"shut",
|
|
9471
|
-
"cancel",
|
|
9472
|
-
"what",
|
|
9473
|
-
"why",
|
|
9474
|
-
"how",
|
|
9475
|
-
"who",
|
|
9476
|
-
"when",
|
|
9477
|
-
"where",
|
|
9478
|
-
"which"
|
|
9479
|
-
]);
|
|
9480
9486
|
/** A short, non-urgent overlap: the kind a listener cue or reaction takes (see overlapDecideMs). */
|
|
9481
9487
|
shortOverlap(text) {
|
|
9482
9488
|
const w = this.words(text);
|
|
9483
|
-
return w.length <= this.options.overlapDecideMaxWords
|
|
9489
|
+
return w.length <= this.options.overlapDecideMaxWords;
|
|
9484
9490
|
}
|
|
9485
9491
|
/** Cede the floor to an overlap: interrupt, tell the host, then dispatch a final that was held while deciding. */
|
|
9486
9492
|
cedeOverlap(trigger, txt) {
|
|
@@ -9496,7 +9502,10 @@ var VoiceEngine = class _VoiceEngine {
|
|
|
9496
9502
|
* was only just asked about it (live: "Oh," → "Oh, that" → "Oh, that— that's new" outgrew every verdict, and the
|
|
9497
9503
|
* first window ran out mid-chase, ceding a reaction Jev kept) — but the whole hold is capped at 3× the window. */
|
|
9498
9504
|
awaitOverlapDecision(txt, fresh = false) {
|
|
9499
|
-
if (this.decideTimer && !fresh)
|
|
9505
|
+
if (this.decideTimer && !fresh) {
|
|
9506
|
+
this.diag("overlap_pause", { text: txt.slice(0, 60), redecide: true });
|
|
9507
|
+
fresh = true;
|
|
9508
|
+
}
|
|
9500
9509
|
if (this.resumeTimer) {
|
|
9501
9510
|
this.clock.clearTimeout(this.resumeTimer);
|
|
9502
9511
|
this.resumeTimer = null;
|
|
@@ -10430,7 +10439,7 @@ import { AIClient, DecideClient, JevAdapter, LlmDecideAdapter } from "ai.libx.js
|
|
|
10430
10439
|
init_logging();
|
|
10431
10440
|
var log20 = forComponent("Overlap");
|
|
10432
10441
|
var norm2 = (s) => s.toLowerCase().replace(/[’']/g, "'").replace(/[^\p{L}\p{N}' -]+/gu, " ").replace(/\s+/g, " ").trim();
|
|
10433
|
-
var HARD =
|
|
10442
|
+
var HARD = /^(?:(?:stop|wait|no|nope|hold on|hang on|hold up|pause|cancel|quiet|enough|shut up|never ?mind)(?: |$))+$/;
|
|
10434
10443
|
var ACK = new Set("yeah yea yes yep yup ya ok okay k right sure true totally exactly definitely absolutely indeed mm mmm hmm mhm mm-hm uh-huh uh huh aha ah oh ooh wow nice cool great awesome perfect good fine interesting gotcha got it i see makes sense fair agreed correct of course for sure lol ha haha hahaha heh hehe yeah yeah alright all right sweet neat oh nice oh wow oh cool oh okay oh yeah oh right that's right that's true thats right thats true love it i know me too same".split(" "));
|
|
10435
10444
|
var LEAD = /* @__PURE__ */ new Set(["and", "so", "um", "uh", "er", "well", "oh"]);
|
|
10436
10445
|
var LEADER = /* @__PURE__ */ new Set(["yeah", "yea", "yes", "yep", "yup", "ok", "okay", "right", "sure", "alright", "mm", "mhm", "hmm", "uh-huh", "totally", "exactly", "true"]);
|
|
@@ -10449,8 +10458,8 @@ function cueKind(text) {
|
|
|
10449
10458
|
return r.split(" ").some((w) => AGREE.has(w)) ? "agree" : null;
|
|
10450
10459
|
}
|
|
10451
10460
|
var ASIDES = {
|
|
10452
|
-
en: { agree: ["Oh yeah, definitely.", "Yeah, exactly.", "Right, yeah."], continue: [
|
|
10453
|
-
he: { agree: ["\u05DB\u05DF, \u05D1\u05D3\u05D9\u05D5\u05E7.", "\u05DB\u05DF, \u05DE\u05DE\u05E9.", "\u05E0\u05DB\u05D5\u05DF, \u05DB\u05DF."], continue: [
|
|
10461
|
+
en: { agree: ["Oh yeah, definitely.", "Yeah, exactly.", "Right, yeah."], continue: [] },
|
|
10462
|
+
he: { agree: ["\u05DB\u05DF, \u05D1\u05D3\u05D9\u05D5\u05E7.", "\u05DB\u05DF, \u05DE\u05DE\u05E9.", "\u05E0\u05DB\u05D5\u05DF, \u05DB\u05DF."], continue: [] }
|
|
10454
10463
|
};
|
|
10455
10464
|
function overlapAside(text, lang, avoid = "", pick = (n) => Math.floor(Math.random() * n)) {
|
|
10456
10465
|
const kind = cueKind(text);
|
|
@@ -10462,25 +10471,26 @@ function overlapAside(text, lang, avoid = "", pick = (n) => Math.floor(Math.rand
|
|
|
10462
10471
|
}
|
|
10463
10472
|
function overlapRule(text) {
|
|
10464
10473
|
if (CONTINUE.test(norm2(text))) return "keep";
|
|
10465
|
-
if (/\?/.test(text)) return "cut";
|
|
10466
10474
|
let t = norm2(text);
|
|
10467
10475
|
if (!t) return void 0;
|
|
10468
|
-
if (HARD.test(t)) return "cut";
|
|
10476
|
+
if (HARD.test(t + " ")) return t.includes(" ") ? "cut" : "hold";
|
|
10469
10477
|
for (const p of PHRASES) t = t.split(p).join(" ");
|
|
10470
10478
|
const words4 = t.split(/[\s-]+/).filter(Boolean);
|
|
10471
10479
|
const ack = (w) => ACK.has(w) || HE_ACK.has(w) || /^(?:ha)+h?$|^(?:he)+h?$|^m+(?:hm+)?$|^h?m+$/.test(w);
|
|
10472
10480
|
if (words4.every(ack)) return "keep";
|
|
10473
10481
|
const lead2 = words4.findIndex((w) => !LEAD.has(w));
|
|
10474
|
-
if (lead2 >= 0 && LEADER.has(words4[lead2]) && words4.slice(lead2).filter((w) => !ack(w) && !LEAD.has(w)).length <= 1) return "keep";
|
|
10482
|
+
if (lead2 >= 0 && LEADER.has(words4[lead2]) && !words4.some((w) => HARD.test(w + " ")) && words4.slice(lead2).filter((w) => !ack(w) && !LEAD.has(w)).length <= 1) return "keep";
|
|
10475
10483
|
return void 0;
|
|
10476
10484
|
}
|
|
10477
10485
|
function fastOverlapModel(ai, model = "groq/qwen/qwen3.8-27b") {
|
|
10478
10486
|
return async (heard, signal) => {
|
|
10479
|
-
const prompt = 'Live voice call. The assistant is mid-sentence and the user just said this over it: "' + heard +
|
|
10487
|
+
const prompt = 'Live voice call. The assistant is mid-sentence and the user just said this over it: "' + heard + `"
|
|
10488
|
+
Are they STEERING \u2014 asking for something new, asking a real question about it, correcting it, or telling it to stop? A reaction is not steering: surprise, disbelief, "what?", "really?", "you're serious?", "that's serious", agreement, a laugh \u2014 the assistant just carries on.
|
|
10489
|
+
Answer yes (steering) or no (a reaction).`;
|
|
10480
10490
|
const reasoning = /qwen/.test(model) ? { providerOptions: { reasoning_effort: "none" } } : /gpt-oss/.test(model) ? { providerOptions: { reasoning_effort: "low" } } : {};
|
|
10481
10491
|
const r = await ai.chat({ model, messages: [{ role: "user", content: prompt }], stream: false, signal, temperature: 0, maxTokens: /gpt-oss/.test(model) ? 200 : 3, ...reasoning });
|
|
10482
10492
|
const a = (r.content ?? "").trim().toLowerCase();
|
|
10483
|
-
return /^yes/.test(a) ? "
|
|
10493
|
+
return /^yes/.test(a) ? "cut" : /^no/.test(a) ? "keep" : null;
|
|
10484
10494
|
};
|
|
10485
10495
|
}
|
|
10486
10496
|
var OverlapJudgeOptions = class {
|
|
@@ -10489,8 +10499,9 @@ var OverlapJudgeOptions = class {
|
|
|
10489
10499
|
/** A model verdict later than this is dropped → cut. 600ms: groq qwen measured p50 ~100ms / max ~230ms in isolation
|
|
10490
10500
|
* (24 calls, 2026-10-14) but live, beside the reflex + chatty-channel calls, 2 of 2 ambiguous verdicts missed 300ms
|
|
10491
10501
|
* and cut the reply. The engine holds the overlap up to 900ms (bindOverlapInstinct) — a slightly later keep beats
|
|
10492
|
-
* a cut, so the budget sits
|
|
10493
|
-
|
|
10502
|
+
* a cut, so the budget sits inside that hold. 800ms: at 600, 2 of 20 live reactions ("This is serious.") came back
|
|
10503
|
+
* late and cut the reply (2026-11-03). */
|
|
10504
|
+
budgetMs = 800;
|
|
10494
10505
|
onDecision = () => {
|
|
10495
10506
|
};
|
|
10496
10507
|
now = () => performance.now();
|
|
@@ -10515,6 +10526,7 @@ var OverlapJudge = class {
|
|
|
10515
10526
|
};
|
|
10516
10527
|
const rule = overlapRule(heard);
|
|
10517
10528
|
if (rule) return done(rule, "rule");
|
|
10529
|
+
if (norm2(heard).split(/[\s-]+/).filter(Boolean).length < 2) return done("keep", "lone");
|
|
10518
10530
|
if (!this.o.model) return done("cut", "none");
|
|
10519
10531
|
const ctl = new AbortController();
|
|
10520
10532
|
let timer;
|
|
@@ -11446,6 +11458,10 @@ var TurnGateOptions = class {
|
|
|
11446
11458
|
dupWindowMs = 5e3;
|
|
11447
11459
|
/** A fuller final within this window of the last turn (or with its sttId) is a re-final of it. */
|
|
11448
11460
|
refinalWindowMs = 5e3;
|
|
11461
|
+
/** A held final never goes out while the user is saying more (a partial with new words, not yet final): live
|
|
11462
|
+
* 20261103-114604, "Okay." settled 700ms into "What will the…" and MAIN started, was aborted twice and merged. The
|
|
11463
|
+
* rest's final merges in; capped at this long from the hold (an STT that never finalizes a partial). */
|
|
11464
|
+
talkingMaxMs = 6e3;
|
|
11449
11465
|
onTurn = () => {
|
|
11450
11466
|
};
|
|
11451
11467
|
onDrop = () => {
|
|
@@ -11504,7 +11520,7 @@ var TurnGate = class {
|
|
|
11504
11520
|
const mid = endsMidPhrase(t);
|
|
11505
11521
|
if (mid || this.o.settleMs && !/\?["')\]]*$/.test(t)) {
|
|
11506
11522
|
const ms = mid ? this.o.holdMs : this.o.settleMs;
|
|
11507
|
-
this.held = { text: t, sttId, ms, replaces, timer: setTimeout(() => this.
|
|
11523
|
+
this.held = { text: t, sttId, ms, replaces, since: now4, timer: setTimeout(() => this.settle(), ms) };
|
|
11508
11524
|
return this.o.onHold(t);
|
|
11509
11525
|
}
|
|
11510
11526
|
this.send(t, key, sttId, "new", replaces);
|
|
@@ -11515,13 +11531,25 @@ var TurnGate = class {
|
|
|
11515
11531
|
const l = this.last;
|
|
11516
11532
|
if (l?.id !== id || this.held) return;
|
|
11517
11533
|
this.last = void 0;
|
|
11518
|
-
this.held = { text: l.text, sttId: l.sttId, ms: this.o.holdMs, replaces: id, timer: setTimeout(() => this.
|
|
11534
|
+
this.held = { text: l.text, sttId: l.sttId, ms: this.o.holdMs, replaces: id, since: this.o.now(), timer: setTimeout(() => this.settle(), this.o.holdMs) };
|
|
11519
11535
|
}
|
|
11520
|
-
/** The user is speaking again (a partial): a held fragment waits for the rest.
|
|
11521
|
-
|
|
11522
|
-
|
|
11523
|
-
|
|
11524
|
-
|
|
11536
|
+
/** The user is speaking again (a partial — `text`, the whole partial): a held fragment waits for the rest. A partial
|
|
11537
|
+
* with words the held text lacks is more speech under way: the hold lasts until its final (≤ talkingMaxMs). */
|
|
11538
|
+
speaking(text = "") {
|
|
11539
|
+
const h = this.held;
|
|
11540
|
+
if (!h) return;
|
|
11541
|
+
if (text && norm3(text).split(" ").some((w) => w && !` ${norm3(h.text)} `.includes(` ${w} `))) h.talking = true;
|
|
11542
|
+
clearTimeout(h.timer);
|
|
11543
|
+
h.timer = setTimeout(() => this.settle(), h.ms);
|
|
11544
|
+
}
|
|
11545
|
+
/** The hold's quiet ran out: send it — unless the user is mid-line (a partial with no final yet). */
|
|
11546
|
+
settle() {
|
|
11547
|
+
const h = this.held;
|
|
11548
|
+
if (h?.talking && this.o.now() - h.since < this.o.talkingMaxMs) {
|
|
11549
|
+
h.timer = setTimeout(() => this.settle(), h.ms);
|
|
11550
|
+
return;
|
|
11551
|
+
}
|
|
11552
|
+
this.flush();
|
|
11525
11553
|
}
|
|
11526
11554
|
/** MAIN started replying to turn `id` (its first text/tool/audio): a later re-final only adds its new words. */
|
|
11527
11555
|
replyStarted(id) {
|
|
@@ -14328,8 +14356,10 @@ var ProgressOptions = class {
|
|
|
14328
14356
|
generateBudgetMs = 800;
|
|
14329
14357
|
/** Speak only when nothing has been audible for this long. */
|
|
14330
14358
|
silenceMs = 3e3;
|
|
14331
|
-
/** At most one
|
|
14359
|
+
/** At most one spoken work line (progress, bridge or aside) per this long. */
|
|
14332
14360
|
gapMs = 4e3;
|
|
14361
|
+
/** One stage (a tool's topic) gets one line; a stage still running after this long may get another. 0 = 3 × gapMs. */
|
|
14362
|
+
stageRepeatMs = 0;
|
|
14333
14363
|
now = () => performance.now();
|
|
14334
14364
|
};
|
|
14335
14365
|
function argsHint(args) {
|
|
@@ -14347,6 +14377,7 @@ var Progress = class {
|
|
|
14347
14377
|
lastAt = -Infinity;
|
|
14348
14378
|
streamed = false;
|
|
14349
14379
|
lines = [];
|
|
14380
|
+
stages = /* @__PURE__ */ new Map();
|
|
14350
14381
|
get o() {
|
|
14351
14382
|
return this.options;
|
|
14352
14383
|
}
|
|
@@ -14363,15 +14394,25 @@ var Progress = class {
|
|
|
14363
14394
|
this.streamed = false;
|
|
14364
14395
|
}
|
|
14365
14396
|
/** May a line play now, or `leadMs` from now? (the caller passes when the user last heard anything) */
|
|
14366
|
-
due(lastAudibleAt, leadMs = 0) {
|
|
14367
|
-
const now4 = this.o.now();
|
|
14397
|
+
due(lastAudibleAt, leadMs = 0, tool = "") {
|
|
14398
|
+
const now4 = this.o.now(), spoken = tool ? this.stages.get(this.stage(tool)) : void 0;
|
|
14399
|
+
if (spoken !== void 0 && now4 - spoken < (this.o.stageRepeatMs || 3 * this.o.gapMs) - leadMs) return false;
|
|
14368
14400
|
return !this.streamed && now4 - lastAudibleAt >= this.o.silenceMs - leadMs && now4 - this.lastAt >= this.o.gapMs - leadMs;
|
|
14369
14401
|
}
|
|
14370
|
-
/** Mark `line` spoken. */
|
|
14371
|
-
spoke(line) {
|
|
14402
|
+
/** Mark `line` spoken, for `tool`'s stage. */
|
|
14403
|
+
spoke(line, tool = "") {
|
|
14372
14404
|
this.note(line);
|
|
14405
|
+
this.heard();
|
|
14406
|
+
if (tool) this.stages.set(this.stage(tool), this.o.now());
|
|
14407
|
+
}
|
|
14408
|
+
/** A work line played from elsewhere (a bridge, an aside): the same thought, so the gap counts from it. */
|
|
14409
|
+
heard() {
|
|
14373
14410
|
this.lastAt = this.o.now();
|
|
14374
14411
|
}
|
|
14412
|
+
stage(tool) {
|
|
14413
|
+
const n = tool.toLowerCase();
|
|
14414
|
+
return TOPICS.find(([re]) => re.test(n))?.[1] ?? n;
|
|
14415
|
+
}
|
|
14375
14416
|
/** A line the user heard from elsewhere (an aside): progress never repeats it. */
|
|
14376
14417
|
note(line) {
|
|
14377
14418
|
this.said.add(norm3(line));
|
|
@@ -14401,26 +14442,34 @@ var Progress = class {
|
|
|
14401
14442
|
r(null);
|
|
14402
14443
|
}, this.o.generateBudgetMs);
|
|
14403
14444
|
});
|
|
14404
|
-
const
|
|
14445
|
+
const hint = argsHint(args) || about.slice(-80);
|
|
14446
|
+
const raw = await Promise.race([this.o.generate(tool, hint, lang, ac.signal, this.lines).catch((e) => {
|
|
14405
14447
|
log28.warn(`progress line failed: ${e?.message ?? e}`);
|
|
14406
14448
|
return null;
|
|
14407
14449
|
}), late]).finally(() => clearTimeout(t));
|
|
14408
14450
|
const l = cleanLine(raw ?? "", lang, 5);
|
|
14409
|
-
if (!l || about && !echoesHeard(l,
|
|
14451
|
+
if (!l || about && !echoesHeard(l, hint) || RESULT_CLAIM_RE.test(l) || HE_RESULT_CLAIM.test(l) || this.said.has(norm3(l)) || this.streamed) return "";
|
|
14410
14452
|
return l;
|
|
14411
14453
|
}
|
|
14412
14454
|
};
|
|
14413
14455
|
function fastProgressGenerator(ai, model, gender) {
|
|
14414
14456
|
return async (tool, hint, lang, signal, avoid = []) => {
|
|
14415
|
-
const prompt = `An assistant on a live voice call is running the tool "${tool}"${hint ? ` (about: "${hint}")` : ""}. Write ONE spoken line of 2-5 words, in ${languageName(lang)}, saying what it is doing right now (like "checking the board\u2026"). ${hint ?
|
|
14457
|
+
const prompt = `An assistant on a live voice call is running the tool "${tool}"${hint ? ` (about: "${hint}")` : ""}. Write ONE spoken line of 2-5 words, in ${languageName(lang)}, saying what it is doing right now (like "checking the board\u2026"). ${hint ? 'Name what it works on the way a person would say it ("looking up that Astra post\u2026"), never a string of its keywords ("scanning Astra weights\u2026"). ' : ""}${avoid.length ? `It already said ${avoid.map((a) => `"${a}"`).join(", ")}: say something new, a different angle on the same work. ` : ""}Never state a result or a finding. ${personaHint(gender)} Output only the line.`;
|
|
14416
14458
|
const reasoning = /gpt-oss/.test(model) ? { providerOptions: { reasoning_effort: "low" } } : {};
|
|
14417
14459
|
const r = await ai.chat({ model, messages: [{ role: "user", content: prompt }], stream: false, signal, maxTokens: 150, ...reasoning });
|
|
14418
14460
|
return r.content ?? "";
|
|
14419
14461
|
};
|
|
14420
14462
|
}
|
|
14463
|
+
var WORK_CLAIM = /\b(?:none|nothing|nobody|zero|\d+|one|two|three|four|five|many|several|some|looks like|seems|turns out|apparently|it'?s|they'?re|there'?s)\b|(?:^|\s)(?:כלום|אף|נראה)(?=\s|$|[.,!…])/iu;
|
|
14464
|
+
var claimsResult = (l) => RESULT_CLAIM_RE.test(l) || HE_RESULT_CLAIM.test(l) || WORK_CLAIM.test(l);
|
|
14421
14465
|
function cleanWorkReply(raw, lang) {
|
|
14422
14466
|
const l = cleanLine(raw.replace(/^\s*(?:stop|work)\s*:/i, ""), lang, 8);
|
|
14423
|
-
return
|
|
14467
|
+
return claimsResult(l) ? "" : l;
|
|
14468
|
+
}
|
|
14469
|
+
function workAck(raw, lang, gender = "") {
|
|
14470
|
+
const l = cleanLine(raw.replace(/^\s*(?:stop|work)\s*:/i, ""), lang, 8);
|
|
14471
|
+
if (!l || !claimsResult(l)) return "";
|
|
14472
|
+
return (PROGRESS_TEMPLATES[gender ? `${lang}-${gender[0]}` : lang] ?? PROGRESS_TEMPLATES[lang])?.delegate[1] ?? "";
|
|
14424
14473
|
}
|
|
14425
14474
|
function fastWorkReply(ai, model, gender, persona = "") {
|
|
14426
14475
|
return async (c, signal) => {
|
|
@@ -14428,7 +14477,7 @@ function fastWorkReply(ai, model, gender, persona = "") {
|
|
|
14428
14477
|
${persona.slice(0, 500)}
|
|
14429
14478
|
|
|
14430
14479
|
` : ""}You are on a live voice call, in the middle of doing this for them: "${c.request.slice(-160)}"${c.tool ? ` (right now: ${c.tool}${c.hint ? ` on ${c.hint}` : ""})` : ""}. They just said, while you work: "${c.heard.slice(-200)}"
|
|
14431
|
-
Answer them at once with ONE short spoken line of 2-7 words in ${languageName(c.lang)}, the way a person busy on it would ("yeah, looking now"). You have
|
|
14480
|
+
Answer them at once with ONE short spoken line of 2-7 words in ${languageName(c.lang)}, the way a person busy on it would ("yeah, looking now"). You have NO results yet and cannot know any: only acknowledge the work, never say what was or was not found, not even "nothing yet" or "none so far". ` + (c.avoid.length ? `Do not reuse: ${c.avoid.map((a) => `"${a}"`).join(", ")}. ` : "") + `If they tell you to stop or drop the work, start the line with "stop:". If they change the request or add to it, start it with "work:". ${personaHint(gender)} Output only the line, no tone tag.`;
|
|
14432
14481
|
const reasoning = /gpt-oss/.test(model) ? { providerOptions: { reasoning_effort: "low" } } : {};
|
|
14433
14482
|
const r = await ai.chat({ model, messages: [{ role: "user", content: prompt }], stream: false, signal, maxTokens: 150, ...reasoning });
|
|
14434
14483
|
return r.content ?? "";
|
|
@@ -14598,6 +14647,11 @@ var SecondChannelOptions = class {
|
|
|
14598
14647
|
random = Math.random;
|
|
14599
14648
|
};
|
|
14600
14649
|
var words3 = (s) => s.trim() ? s.trim().split(/\s+/) : [];
|
|
14650
|
+
var HESITATION = /^(?:a+y*|a+i|e+[hr]*|erm+|u+[hm]*|h?m+|o+h+|ooh|like|so|well|אה+|אמ+|אה?ם+|ממ+)$/u;
|
|
14651
|
+
var onlyHesitation = (s) => {
|
|
14652
|
+
const w = words3(s).slice(-3).map((x) => x.toLowerCase().replace(/[^\p{L}]/gu, "")).filter(Boolean);
|
|
14653
|
+
return !!w.length && w.every((x) => HESITATION.test(x));
|
|
14654
|
+
};
|
|
14601
14655
|
function withBudget(p, ms, what, ac) {
|
|
14602
14656
|
let t;
|
|
14603
14657
|
const late = new Promise((r) => {
|
|
@@ -15216,6 +15270,7 @@ var SecondChannel = class {
|
|
|
15216
15270
|
return p;
|
|
15217
15271
|
}
|
|
15218
15272
|
say(kind, text) {
|
|
15273
|
+
if (kind === "backchannel" && onlyHesitation(this.heard)) return false;
|
|
15219
15274
|
let r;
|
|
15220
15275
|
try {
|
|
15221
15276
|
r = this.o.speak(text, kind);
|
|
@@ -15450,7 +15505,7 @@ var VoiceCall = class {
|
|
|
15450
15505
|
interim(text, _atMs, aec) {
|
|
15451
15506
|
if (this.ended || !text.trim()) return;
|
|
15452
15507
|
if (typeof aec === "boolean") this.fill.options.aec = aec;
|
|
15453
|
-
this.gate.speaking();
|
|
15508
|
+
this.gate.speaking(text);
|
|
15454
15509
|
this.lastUserAt = this.o.now();
|
|
15455
15510
|
const c = this.cur, steers = !!this.o.noteTurn && this.working;
|
|
15456
15511
|
const resumed = !steers || c.marks.mainFirst === void 0 && this.o.now() - c.at < this.o.resumeMs;
|
|
@@ -15681,6 +15736,7 @@ var VoiceCall = class {
|
|
|
15681
15736
|
}
|
|
15682
15737
|
if (r === false) return false;
|
|
15683
15738
|
this.o.onMetric({ name: "fill", kind, text, lang: this.lang });
|
|
15739
|
+
if (kind !== "backchannel") this.progress.heard();
|
|
15684
15740
|
const c = this.cur && !this.cur.closed ? this.cur : void 0;
|
|
15685
15741
|
const forTurn = !!c && (kind === "bridge" || kind === "progress" || kind === "filler" && c.running && !c.sounded);
|
|
15686
15742
|
if (c && forTurn && c.marks.fill === void 0) {
|
|
@@ -15738,7 +15794,7 @@ var VoiceCall = class {
|
|
|
15738
15794
|
log30.warn(`work reply failed \u2014 MAIN only: ${e?.message ?? e}`);
|
|
15739
15795
|
return "";
|
|
15740
15796
|
}).finally(() => clearTimeout(late)) : "";
|
|
15741
|
-
const line = cleanWorkReply(raw, lang ?? ""), stop = /^\s*stop\s*:/i.test(raw), change = !line || /^\s*work\s*:/i.test(raw);
|
|
15797
|
+
const ack = workAck(raw, lang ?? "", this.o.gender), line = cleanWorkReply(raw, lang ?? "") || ack, stop = /^\s*stop\s*:/i.test(raw), change = !line || /^\s*work\s*:/i.test(raw);
|
|
15742
15798
|
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.]`;
|
|
15743
15799
|
if (line && !this.ended) {
|
|
15744
15800
|
for (let i = 0; i < 8 && this.say(line, "aside") === false; i++) {
|
|
@@ -15774,7 +15830,7 @@ var VoiceCall = class {
|
|
|
15774
15830
|
this.progressTimer = null;
|
|
15775
15831
|
if (this.ended || this.cur !== c || !c.running || c.streamed && c.open <= 0) return;
|
|
15776
15832
|
const lang = this.lang, now4 = this.o.now();
|
|
15777
|
-
if (lang && !c.draft && !c.drafting && now4 - c.draftAt >= 1e3 && this.progress.due(this.lastAudibleAt, this.o.progressLeadMs)) {
|
|
15833
|
+
if (lang && !c.draft && !c.drafting && now4 - c.draftAt >= 1e3 && this.progress.due(this.lastAudibleAt, this.o.progressLeadMs, c.tool)) {
|
|
15778
15834
|
c.drafting = true;
|
|
15779
15835
|
void this.progress.line(c.tool, c.args, lang, this.o.mode === "live" ? c.text : "").then((l) => {
|
|
15780
15836
|
c.drafting = false;
|
|
@@ -15788,9 +15844,9 @@ var VoiceCall = class {
|
|
|
15788
15844
|
this.progressTimer = setTimeout(tick, 250);
|
|
15789
15845
|
};
|
|
15790
15846
|
const sayDraft = () => {
|
|
15791
|
-
if (!c.draft || this.ended || this.cur !== c || !c.running || c.streamed && c.open <= 0 || this.o.now() - this.lastUserAt < this.o.userQuietMs || !this.progress.due(this.lastAudibleAt)) return;
|
|
15847
|
+
if (!c.draft || this.ended || this.cur !== c || !c.running || c.streamed && c.open <= 0 || this.o.now() - this.lastUserAt < this.o.userQuietMs || !this.progress.due(this.lastAudibleAt, 0, c.tool)) return;
|
|
15792
15848
|
if (this.say(c.draft, "progress") !== false) {
|
|
15793
|
-
this.progress.spoke(c.draft);
|
|
15849
|
+
this.progress.spoke(c.draft, c.tool);
|
|
15794
15850
|
this.fill.covered();
|
|
15795
15851
|
this.o.show(c.draft, "progress");
|
|
15796
15852
|
c.draft = "";
|
|
@@ -17349,7 +17405,7 @@ function bindVoiceCall(v, call, live, decideMs = 900) {
|
|
|
17349
17405
|
void call.overlap(heard).then((verdict) => {
|
|
17350
17406
|
if (!live()) return;
|
|
17351
17407
|
if (verdict === "keep") v.decideOverlap("keep_talking", heard, call.aside(heard) ?? void 0);
|
|
17352
|
-
else v.decideOverlap("yield", heard);
|
|
17408
|
+
else if (verdict === "cut") v.decideOverlap("yield", heard);
|
|
17353
17409
|
});
|
|
17354
17410
|
};
|
|
17355
17411
|
Object.defineProperty(call.fill.options, "aec", { get: () => v.usingAec, set: () => {
|
|
@@ -17451,7 +17507,7 @@ var VoiceIO = class extends VoiceEngine {
|
|
|
17451
17507
|
...o,
|
|
17452
17508
|
stt: o.stt ?? new SonioxSTT({ auth: o.sonioxApiKey, source: duplex ?? new NodeMicSource(), terms: o.sttTerms }),
|
|
17453
17509
|
tts: o.tts ?? new CartesiaTTS({ auth: o.cartesiaApiKey, voiceId: o.cartesiaVoiceId }),
|
|
17454
|
-
asideTts: o.tts ?
|
|
17510
|
+
asideTts: o.tts ? o.asideTts : new CartesiaTTS({ auth: o.cartesiaApiKey, voiceId: o.cartesiaVoiceId }),
|
|
17455
17511
|
// asides (VoiceCall.aside): a 2nd client — the reply's context may still stream
|
|
17456
17512
|
player: o.player ?? duplex ?? new Player(),
|
|
17457
17513
|
bargeRmsMult: Number(process.env.BARGE_RMS_MULT || o.bargeRmsMult),
|
|
@@ -17529,8 +17585,89 @@ function fakeVoiceParts(uttFile) {
|
|
|
17529
17585
|
}, write() {
|
|
17530
17586
|
}, drainMs: () => 0, playedMs: () => 0, kill() {
|
|
17531
17587
|
} };
|
|
17588
|
+
if (process.env.AGENTX_VOICE_FAKE_TAPE) return { stt, ...fakeTape(process.env.AGENTX_VOICE_FAKE_TAPE, said) };
|
|
17532
17589
|
return { stt, tts, player };
|
|
17533
17590
|
}
|
|
17591
|
+
function fakeTape(heardFile, saidFile) {
|
|
17592
|
+
const CHAR = TTS_SAMPLE_RATE * 2 * 60 / 1e3;
|
|
17593
|
+
const makeTts = () => {
|
|
17594
|
+
const t = {
|
|
17595
|
+
connect() {
|
|
17596
|
+
},
|
|
17597
|
+
newContext() {
|
|
17598
|
+
},
|
|
17599
|
+
cancel() {
|
|
17600
|
+
},
|
|
17601
|
+
close() {
|
|
17602
|
+
},
|
|
17603
|
+
onAudio: (_) => {
|
|
17604
|
+
},
|
|
17605
|
+
onDone: () => {
|
|
17606
|
+
},
|
|
17607
|
+
speak(text, more = true) {
|
|
17608
|
+
if (saidFile) appendFileSync(saidFile, JSON.stringify({ t: Date.now(), speak: text }) + "\n");
|
|
17609
|
+
const pcm = new Uint8Array(text.length * CHAR), v = new DataView(pcm.buffer);
|
|
17610
|
+
for (let i = 0; i < text.length; i++) for (let b = 0; b < CHAR; b += 2) v.setUint16(i * CHAR + b, text.charCodeAt(i), true);
|
|
17611
|
+
setTimeout(() => {
|
|
17612
|
+
t.onAudio(pcm);
|
|
17613
|
+
if (!more) t.end();
|
|
17614
|
+
}, 5);
|
|
17615
|
+
},
|
|
17616
|
+
end() {
|
|
17617
|
+
setTimeout(() => t.onDone?.(), 20);
|
|
17618
|
+
}
|
|
17619
|
+
};
|
|
17620
|
+
return t;
|
|
17621
|
+
};
|
|
17622
|
+
let q2 = new Uint8Array(0), played = 0, paused = false, last = -1;
|
|
17623
|
+
const mark = (m) => appendFileSync(heardFile, m);
|
|
17624
|
+
const flush = () => {
|
|
17625
|
+
q2 = new Uint8Array(0);
|
|
17626
|
+
played = 0;
|
|
17627
|
+
paused = false;
|
|
17628
|
+
last = -1;
|
|
17629
|
+
};
|
|
17630
|
+
setInterval(() => {
|
|
17631
|
+
if (paused || !q2.length) return;
|
|
17632
|
+
const n = Math.min(TTS_SAMPLE_RATE * 2 * 20 / 1e3, q2.length);
|
|
17633
|
+
let out = "", p = played;
|
|
17634
|
+
for (let i = 0; i < n; i += 2, p += 2) if (Math.floor(p / CHAR) !== last) {
|
|
17635
|
+
last = Math.floor(p / CHAR);
|
|
17636
|
+
out += String.fromCharCode(q2[i] | q2[i + 1] << 8);
|
|
17637
|
+
}
|
|
17638
|
+
q2 = q2.subarray(n);
|
|
17639
|
+
played += n;
|
|
17640
|
+
if (out) mark(out);
|
|
17641
|
+
}, 20).unref();
|
|
17642
|
+
const player = {
|
|
17643
|
+
markTurn() {
|
|
17644
|
+
if (q2.length) mark("\u2702");
|
|
17645
|
+
flush();
|
|
17646
|
+
mark("\n");
|
|
17647
|
+
},
|
|
17648
|
+
write(c) {
|
|
17649
|
+
const a = new Uint8Array(q2.length + c.length);
|
|
17650
|
+
a.set(q2);
|
|
17651
|
+
a.set(c, q2.length);
|
|
17652
|
+
q2 = a;
|
|
17653
|
+
},
|
|
17654
|
+
drainMs: () => q2.length / (TTS_SAMPLE_RATE * 2 / 1e3),
|
|
17655
|
+
playedMs: () => played / (TTS_SAMPLE_RATE * 2 / 1e3),
|
|
17656
|
+
kill() {
|
|
17657
|
+
if (q2.length) mark("\u2702");
|
|
17658
|
+
flush();
|
|
17659
|
+
},
|
|
17660
|
+
pause() {
|
|
17661
|
+
paused = true;
|
|
17662
|
+
mark("\u23F8");
|
|
17663
|
+
},
|
|
17664
|
+
resume() {
|
|
17665
|
+
if (paused) mark("\u25B6");
|
|
17666
|
+
paused = false;
|
|
17667
|
+
}
|
|
17668
|
+
};
|
|
17669
|
+
return { tts: makeTts(), asideTts: makeTts(), player };
|
|
17670
|
+
}
|
|
17534
17671
|
|
|
17535
17672
|
// src/voice/diagSink.ts
|
|
17536
17673
|
init_logging();
|
|
@@ -17589,6 +17726,60 @@ var JsonlDiagSink = class {
|
|
|
17589
17726
|
}
|
|
17590
17727
|
};
|
|
17591
17728
|
|
|
17729
|
+
// src/voice/spokenFilter.ts
|
|
17730
|
+
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.";
|
|
17731
|
+
var HEADS = ["sources", "source", "references", "citations", "links"];
|
|
17732
|
+
var MARKS = String.raw`[#*_>\s-]*`;
|
|
17733
|
+
var SOURCES = new RegExp(String.raw`(^|\n|[.!?…]\s)${MARKS}(?:${HEADS.join("|")})${MARKS}[::]`, "i");
|
|
17734
|
+
var LINK = /\[([^\]\n]*)\]\([^)\s]*\)/g;
|
|
17735
|
+
var URL_RE = /(?:https?:\/\/|www\.)[^\s)\]]+/gi;
|
|
17736
|
+
var OPEN_LINK = /\[[^\]\n]*(?:\](?:\([^)\s]*)?)?$/;
|
|
17737
|
+
var OPEN_URL = /(?:^|\s)(?:h|ht|htt|http|https|https?:|https?:\/?|w|ww|www|(?:https?:\/\/|www\.)\S*)$/i;
|
|
17738
|
+
var OPEN_HEAD = new RegExp(String.raw`(?:^|\n|[.!?…]\s)${MARKS}([a-z]*)${MARKS}$`, "i");
|
|
17739
|
+
var SpokenFilter = class {
|
|
17740
|
+
held = "";
|
|
17741
|
+
ended = false;
|
|
17742
|
+
boundary = true;
|
|
17743
|
+
// what was spoken so far stops at a sentence or line end
|
|
17744
|
+
/** The next delta's speakable part ('' = nothing yet). */
|
|
17745
|
+
push(delta) {
|
|
17746
|
+
if (this.ended) return "";
|
|
17747
|
+
const text = this.held + delta;
|
|
17748
|
+
const sourced = this.scrub(text).match(SOURCES);
|
|
17749
|
+
if (sourced && (sourced[1] || this.boundary)) {
|
|
17750
|
+
this.ended = true;
|
|
17751
|
+
this.held = "";
|
|
17752
|
+
return this.spoke(this.scrub(text).slice(0, sourced.index + sourced[1].trimEnd().length));
|
|
17753
|
+
}
|
|
17754
|
+
const hold = this.holdFrom(text);
|
|
17755
|
+
this.held = text.slice(hold);
|
|
17756
|
+
return this.spoke(this.scrub(text.slice(0, hold)));
|
|
17757
|
+
}
|
|
17758
|
+
/** The reply ended: what was held, as far as it may be said. */
|
|
17759
|
+
end() {
|
|
17760
|
+
const rest = this.held;
|
|
17761
|
+
this.held = "";
|
|
17762
|
+
return this.ended ? "" : this.scrub(rest);
|
|
17763
|
+
}
|
|
17764
|
+
scrub(s) {
|
|
17765
|
+
return s.replace(LINK, "$1").replace(URL_RE, "");
|
|
17766
|
+
}
|
|
17767
|
+
spoke(s) {
|
|
17768
|
+
if (s.trim()) this.boundary = /[\n.!?…]\s*$/.test(s);
|
|
17769
|
+
return s;
|
|
17770
|
+
}
|
|
17771
|
+
holdFrom(s) {
|
|
17772
|
+
let at = s.length;
|
|
17773
|
+
const link2 = s.match(OPEN_LINK);
|
|
17774
|
+
if (link2) at = Math.min(at, link2.index);
|
|
17775
|
+
const url = s.match(OPEN_URL);
|
|
17776
|
+
if (url) at = Math.min(at, url.index);
|
|
17777
|
+
const head = s.match(OPEN_HEAD);
|
|
17778
|
+
if (head && (head[1] ? HEADS.some((h) => h.startsWith(head[1].toLowerCase())) : /[*_#>-]$/.test(s)) && (head.index > 0 || this.boundary)) at = Math.min(at, head.index);
|
|
17779
|
+
return at;
|
|
17780
|
+
}
|
|
17781
|
+
};
|
|
17782
|
+
|
|
17592
17783
|
// src/voice/greeting.ts
|
|
17593
17784
|
init_logging();
|
|
17594
17785
|
var log37 = forComponent("CallGreeting");
|
|
@@ -22636,6 +22827,7 @@ async function repl(args, ai, cfg, cwd) {
|
|
|
22636
22827
|
let callChain = Promise.resolve();
|
|
22637
22828
|
let callFastModel = "";
|
|
22638
22829
|
let callReplyOpen = false;
|
|
22830
|
+
let spoken = new SpokenFilter();
|
|
22639
22831
|
let greetNote = "";
|
|
22640
22832
|
const callTurns = /* @__PURE__ */ new Map();
|
|
22641
22833
|
const callTools = /* @__PURE__ */ new Set();
|
|
@@ -22676,7 +22868,7 @@ ${note}`;
|
|
|
22676
22868
|
}
|
|
22677
22869
|
const rec = { skip: false, running: false };
|
|
22678
22870
|
callTurns.set(id, rec);
|
|
22679
|
-
err(`\r\x1B[
|
|
22871
|
+
err(`\r\x1B[0J ${bold(cyan("\u{1F3A4} \u203A"))} ${text}
|
|
22680
22872
|
`);
|
|
22681
22873
|
callChain = callChain.then(async () => {
|
|
22682
22874
|
if (old?.before !== void 0) face.transcript.splice(old.before);
|
|
@@ -22688,8 +22880,11 @@ ${note}`;
|
|
|
22688
22880
|
const note = greetNote;
|
|
22689
22881
|
greetNote = "";
|
|
22690
22882
|
callReplyOpen = false;
|
|
22883
|
+
spoken = new SpokenFilter();
|
|
22691
22884
|
try {
|
|
22692
|
-
const r = await dispatchLine(text
|
|
22885
|
+
const r = await dispatchLine(`${text}${note}
|
|
22886
|
+
|
|
22887
|
+
${SPOKEN_TURN}`, { id });
|
|
22693
22888
|
if (r === "quit") {
|
|
22694
22889
|
await voiceIO?.awaitIdle();
|
|
22695
22890
|
editorRef?.abort();
|
|
@@ -22723,12 +22918,18 @@ ${note}`;
|
|
|
22723
22918
|
callReplyOpen = true;
|
|
22724
22919
|
voiceIO.beginSpeech();
|
|
22725
22920
|
}
|
|
22726
|
-
const
|
|
22921
|
+
const say = spoken.push(e.message);
|
|
22922
|
+
if (!say) return;
|
|
22923
|
+
const echo = voiceIO.speakDelta(say);
|
|
22727
22924
|
editorRef?.suspend();
|
|
22728
22925
|
voiceEcho(echo);
|
|
22729
22926
|
return;
|
|
22730
22927
|
}
|
|
22731
22928
|
if (voiceIO && (e.kind === "turn_start" || e.kind === "thinking_delta")) return;
|
|
22929
|
+
if (voiceIO) {
|
|
22930
|
+
voiceEchoEnd();
|
|
22931
|
+
editorRef?.suspend();
|
|
22932
|
+
}
|
|
22732
22933
|
return notify(e);
|
|
22733
22934
|
};
|
|
22734
22935
|
}
|
|
@@ -23074,6 +23275,10 @@ ${task}`;
|
|
|
23074
23275
|
task = t;
|
|
23075
23276
|
}
|
|
23076
23277
|
const r = await runTurn(face, store, session, task, duplex ? void 0 : checkpoints, cwd, sendVia ? (c) => sendVia(c, opts) : routeVia);
|
|
23278
|
+
if (call && voiceIO) {
|
|
23279
|
+
const rest = spoken.end();
|
|
23280
|
+
if (rest) voiceEcho(voiceIO.speakDelta(rest));
|
|
23281
|
+
}
|
|
23077
23282
|
if (voiceIO) {
|
|
23078
23283
|
voiceReasonEnd();
|
|
23079
23284
|
voiceEchoEnd();
|