@livx.cc/agentx 0.99.149 → 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 +81 -53
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +13 -3
- package/dist/index.js +80 -52
- 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();
|
|
@@ -11447,6 +11458,10 @@ var TurnGateOptions = class {
|
|
|
11447
11458
|
dupWindowMs = 5e3;
|
|
11448
11459
|
/** A fuller final within this window of the last turn (or with its sttId) is a re-final of it. */
|
|
11449
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;
|
|
11450
11465
|
onTurn = () => {
|
|
11451
11466
|
};
|
|
11452
11467
|
onDrop = () => {
|
|
@@ -11505,7 +11520,7 @@ var TurnGate = class {
|
|
|
11505
11520
|
const mid = endsMidPhrase(t);
|
|
11506
11521
|
if (mid || this.o.settleMs && !/\?["')\]]*$/.test(t)) {
|
|
11507
11522
|
const ms = mid ? this.o.holdMs : this.o.settleMs;
|
|
11508
|
-
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) };
|
|
11509
11524
|
return this.o.onHold(t);
|
|
11510
11525
|
}
|
|
11511
11526
|
this.send(t, key, sttId, "new", replaces);
|
|
@@ -11516,13 +11531,25 @@ var TurnGate = class {
|
|
|
11516
11531
|
const l = this.last;
|
|
11517
11532
|
if (l?.id !== id || this.held) return;
|
|
11518
11533
|
this.last = void 0;
|
|
11519
|
-
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) };
|
|
11520
11535
|
}
|
|
11521
|
-
/** The user is speaking again (a partial): a held fragment waits for the rest.
|
|
11522
|
-
|
|
11523
|
-
|
|
11524
|
-
|
|
11525
|
-
|
|
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();
|
|
11526
11553
|
}
|
|
11527
11554
|
/** MAIN started replying to turn `id` (its first text/tool/audio): a later re-final only adds its new words. */
|
|
11528
11555
|
replyStarted(id) {
|
|
@@ -14415,18 +14442,19 @@ var Progress = class {
|
|
|
14415
14442
|
r(null);
|
|
14416
14443
|
}, this.o.generateBudgetMs);
|
|
14417
14444
|
});
|
|
14418
|
-
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) => {
|
|
14419
14447
|
log28.warn(`progress line failed: ${e?.message ?? e}`);
|
|
14420
14448
|
return null;
|
|
14421
14449
|
}), late]).finally(() => clearTimeout(t));
|
|
14422
14450
|
const l = cleanLine(raw ?? "", lang, 5);
|
|
14423
|
-
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 "";
|
|
14424
14452
|
return l;
|
|
14425
14453
|
}
|
|
14426
14454
|
};
|
|
14427
14455
|
function fastProgressGenerator(ai, model, gender) {
|
|
14428
14456
|
return async (tool, hint, lang, signal, avoid = []) => {
|
|
14429
|
-
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.`;
|
|
14430
14458
|
const reasoning = /gpt-oss/.test(model) ? { providerOptions: { reasoning_effort: "low" } } : {};
|
|
14431
14459
|
const r = await ai.chat({ model, messages: [{ role: "user", content: prompt }], stream: false, signal, maxTokens: 150, ...reasoning });
|
|
14432
14460
|
return r.content ?? "";
|
|
@@ -15477,7 +15505,7 @@ var VoiceCall = class {
|
|
|
15477
15505
|
interim(text, _atMs, aec) {
|
|
15478
15506
|
if (this.ended || !text.trim()) return;
|
|
15479
15507
|
if (typeof aec === "boolean") this.fill.options.aec = aec;
|
|
15480
|
-
this.gate.speaking();
|
|
15508
|
+
this.gate.speaking(text);
|
|
15481
15509
|
this.lastUserAt = this.o.now();
|
|
15482
15510
|
const c = this.cur, steers = !!this.o.noteTurn && this.working;
|
|
15483
15511
|
const resumed = !steers || c.marks.mainFirst === void 0 && this.o.now() - c.at < this.o.resumeMs;
|
|
@@ -17377,7 +17405,7 @@ function bindVoiceCall(v, call, live, decideMs = 900) {
|
|
|
17377
17405
|
void call.overlap(heard).then((verdict) => {
|
|
17378
17406
|
if (!live()) return;
|
|
17379
17407
|
if (verdict === "keep") v.decideOverlap("keep_talking", heard, call.aside(heard) ?? void 0);
|
|
17380
|
-
else v.decideOverlap("yield", heard);
|
|
17408
|
+
else if (verdict === "cut") v.decideOverlap("yield", heard);
|
|
17381
17409
|
});
|
|
17382
17410
|
};
|
|
17383
17411
|
Object.defineProperty(call.fill.options, "aec", { get: () => v.usingAec, set: () => {
|