@livx.cc/agentx 0.99.149 → 0.99.151
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.d.ts +1 -1
- package/dist/cli.js +92 -56
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +15 -5
- package/dist/index.js +91 -55
- package/dist/index.js.map +1 -1
- package/dist/{secondChannel-CJ1eYZKA.d.ts → secondChannel--iqPHPO_.d.ts} +1 -0
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as AgentOptions, H as Hooks, x as RunResult, k as Decider, b as Agent, q as PermissionPolicy, G as Gender, L as LineKind, d as ChannelMode, y as SecondChannelOptions, S as SecondChannel } from './secondChannel
|
|
2
|
-
export { A as ADVISE_LIMIT, a as AdvisorSetup, C as CC_WRITE_TOOLS, e as ChatFragment, f as ChatUsage, g as Classification, h as Classifier, i as CompactResult, j as ContextFileSpec, D as DEFAULT_MUTATING, l as Decision, M as ModelRouter, m as ModelRouterOptions, P as PLANNER_BLOCKED, n as PLANNER_REFUSAL, o as PLAN_FIRST, p as PermissionOptions, r as PermissionRule, s as PreToolUseDecision, R as ReasoningEffort, t as RecordingHooks, u as RecordingLifecycle, v as RouteDecision, w as RouterState, T as Tier, z as ToolUse, B as ToolUseMeta, W as WRITE_TOOLS, E as advisorFor, F as advisorPrompt, I as ccModeOptions, J as claudeCodeDisallowedTools, K as composeHooks, N as delegatePrompt, O as delegateTools, Q as delegateWorkerFor, U as estimateTokens, V as jevAvailable, X as jevClassifier, Y as loadContextFiles, Z as loadInstructions, _ as makeAdvisor, $ as meterWorkers, a0 as pickTier, a1 as planMode, a2 as plannerBlocks, a3 as reasoningToChatFragment } from './secondChannel
|
|
1
|
+
import { c as AgentOptions, H as Hooks, x as RunResult, k as Decider, b as Agent, q as PermissionPolicy, G as Gender, L as LineKind, d as ChannelMode, y as SecondChannelOptions, S as SecondChannel } from './secondChannel--iqPHPO_.js';
|
|
2
|
+
export { A as ADVISE_LIMIT, a as AdvisorSetup, C as CC_WRITE_TOOLS, e as ChatFragment, f as ChatUsage, g as Classification, h as Classifier, i as CompactResult, j as ContextFileSpec, D as DEFAULT_MUTATING, l as Decision, M as ModelRouter, m as ModelRouterOptions, P as PLANNER_BLOCKED, n as PLANNER_REFUSAL, o as PLAN_FIRST, p as PermissionOptions, r as PermissionRule, s as PreToolUseDecision, R as ReasoningEffort, t as RecordingHooks, u as RecordingLifecycle, v as RouteDecision, w as RouterState, T as Tier, z as ToolUse, B as ToolUseMeta, W as WRITE_TOOLS, E as advisorFor, F as advisorPrompt, I as ccModeOptions, J as claudeCodeDisallowedTools, K as composeHooks, N as delegatePrompt, O as delegateTools, Q as delegateWorkerFor, U as estimateTokens, V as jevAvailable, X as jevClassifier, Y as loadContextFiles, Z as loadInstructions, _ as makeAdvisor, $ as meterWorkers, a0 as pickTier, a1 as planMode, a2 as plannerBlocks, a3 as reasoningToChatFragment } from './secondChannel--iqPHPO_.js';
|
|
3
3
|
export { MODEL_ALIASES, ModelSwitch, ResolveModelSwitchOpts, latestClaude, modelShortLabel, resolveModelAlias, resolveModelSwitch } from './models.js';
|
|
4
4
|
import { IFilesystem, FileMetadata } from '@livx.cc/wcli/core';
|
|
5
5
|
export { CommandExecutor, FileMetadata, IFilesystem, IndexedDbFilesystem, MemFilesystem, registerHeadlessCommands } from '@livx.cc/wcli/core';
|
|
@@ -940,7 +940,10 @@ declare const DEFAULT_CATALOG_BUDGET = 6000;
|
|
|
940
940
|
*/
|
|
941
941
|
declare function formatCatalog(entries: CatalogEntry[], opts: CatalogOptions): string;
|
|
942
942
|
|
|
943
|
-
|
|
943
|
+
/** keep = carry on · cut = give the floor · hold = stay paused and judge the line as it grows (a lone "wait" may be
|
|
944
|
+
* "Wait, really?"); the engine cedes if nothing more comes (bod-voice overlapDecideMs). A host that knows only keep/cut
|
|
945
|
+
* treats hold as cut. */
|
|
946
|
+
type OverlapVerdict = 'keep' | 'cut' | 'hold';
|
|
944
947
|
|
|
945
948
|
/** Does the user's line stop mid-phrase (trailing connective / spelled punctuation / comma / slash)? Only the user's own
|
|
946
949
|
* words count — host notes appended after a newline ("[the user interrupted you…]") are ignored. */
|
|
@@ -965,6 +968,10 @@ declare class TurnGateOptions {
|
|
|
965
968
|
dupWindowMs: number;
|
|
966
969
|
/** A fuller final within this window of the last turn (or with its sttId) is a re-final of it. */
|
|
967
970
|
refinalWindowMs: number;
|
|
971
|
+
/** A held final never goes out while the user is saying more (a partial with new words, not yet final): live
|
|
972
|
+
* 20261103-114604, "Okay." settled 700ms into "What will the…" and MAIN started, was aborted twice and merged. The
|
|
973
|
+
* rest's final merges in; capped at this long from the hold (an STT that never finalizes a partial). */
|
|
974
|
+
talkingMaxMs: number;
|
|
968
975
|
onTurn: (t: GateTurn) => void;
|
|
969
976
|
onDrop: (text: string, why: GateDrop) => void;
|
|
970
977
|
/** A final is being held (ends mid-phrase) — the fill channel may cover it with a filler, never a bridge. */
|
|
@@ -994,8 +1001,11 @@ declare class TurnGate {
|
|
|
994
1001
|
/** The user kept talking after turn `id` went out and before its reply made a sound: it was not over. Its words go back
|
|
995
1002
|
* to being held — the rest merges in and one whole turn replaces it; silence sends them again as they were. */
|
|
996
1003
|
reopen(id: string): void;
|
|
997
|
-
/** The user is speaking again (a partial): a held fragment waits for the rest.
|
|
998
|
-
|
|
1004
|
+
/** The user is speaking again (a partial — `text`, the whole partial): a held fragment waits for the rest. A partial
|
|
1005
|
+
* with words the held text lacks is more speech under way: the hold lasts until its final (≤ talkingMaxMs). */
|
|
1006
|
+
speaking(text?: string): void;
|
|
1007
|
+
/** The hold's quiet ran out: send it — unless the user is mid-line (a partial with no final yet). */
|
|
1008
|
+
private settle;
|
|
999
1009
|
/** MAIN started replying to turn `id` (its first text/tool/audio): a later re-final only adds its new words. */
|
|
1000
1010
|
replyStarted(id: string): void;
|
|
1001
1011
|
/** Send a held fragment now (e.g. the call ends). */
|
package/dist/index.js
CHANGED
|
@@ -7929,9 +7929,11 @@ var VoiceEngineOptions = class {
|
|
|
7929
7929
|
/** HOST-DECIDED short overlaps (opt-in; 0 = off = cede on ≥2 genuine words, as always). The fast "≥2 novel words →
|
|
7930
7930
|
* cede" rule cannot tell a reaction ("Oh, that's new") from a barge, and it fires ~300ms before a host-side judge
|
|
7931
7931
|
* (e.g. an AI instinct) can answer — so a judge could never keep a delivery going (live 20260923-125143: ceded on
|
|
7932
|
-
* "Oh, that", the judge said keep_talking 300ms later). When > 0, a SHORT genuine overlap (≤ overlapDecideMaxWords
|
|
7933
|
-
*
|
|
7934
|
-
*
|
|
7932
|
+
* "Oh, that", the judge said keep_talking 300ms later). When > 0, a SHORT genuine overlap (≤ overlapDecideMaxWords —
|
|
7933
|
+
* its words are the host's to judge: a '?' or "what" ceded "What?" / "You're serious?", reactions, live
|
|
7934
|
+
* 20261103-114604) keeps the pause and waits for `decideOverlap()`; every new partial while waiting is re-offered
|
|
7935
|
+
* (`overlap_pause` redecide); with no decision after this many ms it cedes. Long barges still cede instantly. Audio
|
|
7936
|
+
* is already paused, so waiting costs no talk-over. */
|
|
7935
7937
|
overlapDecideMs = 0;
|
|
7936
7938
|
/** Longest overlap (words) the host decides; also how far an overlap the host kept may grow before it cedes. */
|
|
7937
7939
|
overlapDecideMaxWords = 4;
|
|
@@ -8825,17 +8827,39 @@ var VoiceEngine = class _VoiceEngine {
|
|
|
8825
8827
|
* that reuse a few of our words — live 20260923-102258, right after a barge over "…Gemini 3.8 Flash…":
|
|
8826
8828
|
* "Wait, there is a new Gemini model?" (3 novel / 6) was dropped twice and the user had to repeat it. Echo
|
|
8827
8829
|
* of our own audio reproduces RUNS of what we said, in order (mis-hearings break a word, not the run); a
|
|
8828
|
-
* reply that shares vocabulary scatters it. So a ≥4-word final that fails the bag test is echo only if
|
|
8829
|
-
*
|
|
8830
|
+
* reply that shares vocabulary scatters it. So a ≥4-word final that fails the bag test is echo only if ¾ of its
|
|
8831
|
+
* words line up, in order, inside ONE stretch of what we said (a mis-heard word breaks a word, not the line), or it
|
|
8832
|
+
* repeats ≥5 of our words verbatim in a row (a mis-heard tail: "…the latest email from you"). A user who quotes a few
|
|
8833
|
+
* of our last words in their own sentence is neither: live 20261103-114604, over "…Want me to open the thread?" the
|
|
8834
|
+
* 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
|
|
8835
|
+
* (half the words in a word pair we said) counted it as echo. Shorter finals can't show order → bag rule. */
|
|
8830
8836
|
echoFinal(text) {
|
|
8831
8837
|
if (this.genuine(text)) return false;
|
|
8832
8838
|
const w = this.words(text);
|
|
8833
8839
|
if (w.length < 4) return true;
|
|
8834
8840
|
const said = this.words(`${this.prevReply} ${this.reply} ${this.lastAck}`);
|
|
8835
|
-
const
|
|
8836
|
-
|
|
8837
|
-
for (let i =
|
|
8838
|
-
|
|
8841
|
+
const span = w.length + 2;
|
|
8842
|
+
let best = 0, run = 0;
|
|
8843
|
+
for (let i = 0; i < said.length && best < w.length; i++) {
|
|
8844
|
+
if (!w.includes(said[i])) continue;
|
|
8845
|
+
for (let j = 0; j < w.length; j++) {
|
|
8846
|
+
let k = 0;
|
|
8847
|
+
while (w[j + k] !== void 0 && w[j + k] === said[i + k]) k++;
|
|
8848
|
+
run = Math.max(run, k);
|
|
8849
|
+
}
|
|
8850
|
+
const win = said.slice(i, i + span);
|
|
8851
|
+
const row = new Array(win.length + 1).fill(0);
|
|
8852
|
+
for (const x of w) {
|
|
8853
|
+
let diag = 0;
|
|
8854
|
+
for (let j = 1; j <= win.length; j++) {
|
|
8855
|
+
const up = row[j];
|
|
8856
|
+
row[j] = x === win[j - 1] ? diag + 1 : Math.max(row[j], row[j - 1]);
|
|
8857
|
+
diag = up;
|
|
8858
|
+
}
|
|
8859
|
+
}
|
|
8860
|
+
best = Math.max(best, row[win.length]);
|
|
8861
|
+
}
|
|
8862
|
+
return best * 4 >= w.length * 3 || run >= 5;
|
|
8839
8863
|
}
|
|
8840
8864
|
/** Display a partial — unless it's echo-shaped during/after our own speech (degraded-AEC bleed), or the STT's trailing
|
|
8841
8865
|
* re-emit of the line just dispatched (Soniox emits partials after <end>): the host types partials into its input box,
|
|
@@ -8908,7 +8932,8 @@ var VoiceEngine = class _VoiceEngine {
|
|
|
8908
8932
|
this.cedeOverlap("overlap_cede", txt);
|
|
8909
8933
|
return;
|
|
8910
8934
|
}
|
|
8911
|
-
if (
|
|
8935
|
+
if (this.options.overlapDecideMs > 0) this.awaitOverlapDecision(txt);
|
|
8936
|
+
else if (!this.decideTimer) this.armResume();
|
|
8912
8937
|
return;
|
|
8913
8938
|
}
|
|
8914
8939
|
const barge = this.usingAec ? this.genuine(text) : this.novelWords(text).length >= (this.suspectUntil ? 1 : 2);
|
|
@@ -9454,29 +9479,10 @@ var VoiceEngine = class _VoiceEngine {
|
|
|
9454
9479
|
return this.usingAec && this.options.overlapPause && this.player.canPause;
|
|
9455
9480
|
}
|
|
9456
9481
|
/** Stop/question words that make an overlap an obvious barge — never held for a host decision. */
|
|
9457
|
-
static OVERLAP_CEDE_WORDS = /* @__PURE__ */ new Set([
|
|
9458
|
-
"stop",
|
|
9459
|
-
"wait",
|
|
9460
|
-
"no",
|
|
9461
|
-
"hold",
|
|
9462
|
-
"hang",
|
|
9463
|
-
"pause",
|
|
9464
|
-
"quiet",
|
|
9465
|
-
"enough",
|
|
9466
|
-
"shut",
|
|
9467
|
-
"cancel",
|
|
9468
|
-
"what",
|
|
9469
|
-
"why",
|
|
9470
|
-
"how",
|
|
9471
|
-
"who",
|
|
9472
|
-
"when",
|
|
9473
|
-
"where",
|
|
9474
|
-
"which"
|
|
9475
|
-
]);
|
|
9476
9482
|
/** A short, non-urgent overlap: the kind a listener cue or reaction takes (see overlapDecideMs). */
|
|
9477
9483
|
shortOverlap(text) {
|
|
9478
9484
|
const w = this.words(text);
|
|
9479
|
-
return w.length <= this.options.overlapDecideMaxWords
|
|
9485
|
+
return w.length <= this.options.overlapDecideMaxWords;
|
|
9480
9486
|
}
|
|
9481
9487
|
/** Cede the floor to an overlap: interrupt, tell the host, then dispatch a final that was held while deciding. */
|
|
9482
9488
|
cedeOverlap(trigger, txt) {
|
|
@@ -9492,7 +9498,10 @@ var VoiceEngine = class _VoiceEngine {
|
|
|
9492
9498
|
* was only just asked about it (live: "Oh," → "Oh, that" → "Oh, that— that's new" outgrew every verdict, and the
|
|
9493
9499
|
* first window ran out mid-chase, ceding a reaction Jev kept) — but the whole hold is capped at 3× the window. */
|
|
9494
9500
|
awaitOverlapDecision(txt, fresh = false) {
|
|
9495
|
-
if (this.decideTimer && !fresh)
|
|
9501
|
+
if (this.decideTimer && !fresh) {
|
|
9502
|
+
this.diag("overlap_pause", { text: txt.slice(0, 60), redecide: true });
|
|
9503
|
+
fresh = true;
|
|
9504
|
+
}
|
|
9496
9505
|
if (this.resumeTimer) {
|
|
9497
9506
|
this.clock.clearTimeout(this.resumeTimer);
|
|
9498
9507
|
this.resumeTimer = null;
|
|
@@ -10426,7 +10435,7 @@ import { AIClient, DecideClient, JevAdapter, LlmDecideAdapter } from "ai.libx.js
|
|
|
10426
10435
|
init_logging();
|
|
10427
10436
|
var log21 = forComponent("Overlap");
|
|
10428
10437
|
var norm2 = (s) => s.toLowerCase().replace(/[’']/g, "'").replace(/[^\p{L}\p{N}' -]+/gu, " ").replace(/\s+/g, " ").trim();
|
|
10429
|
-
var HARD =
|
|
10438
|
+
var HARD = /^(?:(?:stop|wait|no|nope|hold on|hang on|hold up|pause|cancel|quiet|enough|shut up|never ?mind)(?: |$))+$/;
|
|
10430
10439
|
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(" "));
|
|
10431
10440
|
var LEAD = /* @__PURE__ */ new Set(["and", "so", "um", "uh", "er", "well", "oh"]);
|
|
10432
10441
|
var LEADER = /* @__PURE__ */ new Set(["yeah", "yea", "yes", "yep", "yup", "ok", "okay", "right", "sure", "alright", "mm", "mhm", "hmm", "uh-huh", "totally", "exactly", "true"]);
|
|
@@ -10445,8 +10454,8 @@ function cueKind(text) {
|
|
|
10445
10454
|
return r.split(" ").some((w) => AGREE.has(w)) ? "agree" : null;
|
|
10446
10455
|
}
|
|
10447
10456
|
var ASIDES = {
|
|
10448
|
-
en: { agree: ["Oh yeah, definitely.", "Yeah, exactly.", "Right, yeah."], continue: [
|
|
10449
|
-
he: { agree: ["\u05DB\u05DF, \u05D1\u05D3\u05D9\u05D5\u05E7.", "\u05DB\u05DF, \u05DE\u05DE\u05E9.", "\u05E0\u05DB\u05D5\u05DF, \u05DB\u05DF."], continue: [
|
|
10457
|
+
en: { agree: ["Oh yeah, definitely.", "Yeah, exactly.", "Right, yeah."], continue: [] },
|
|
10458
|
+
he: { agree: ["\u05DB\u05DF, \u05D1\u05D3\u05D9\u05D5\u05E7.", "\u05DB\u05DF, \u05DE\u05DE\u05E9.", "\u05E0\u05DB\u05D5\u05DF, \u05DB\u05DF."], continue: [] }
|
|
10450
10459
|
};
|
|
10451
10460
|
function overlapAside(text, lang, avoid = "", pick = (n) => Math.floor(Math.random() * n)) {
|
|
10452
10461
|
const kind = cueKind(text);
|
|
@@ -10458,25 +10467,26 @@ function overlapAside(text, lang, avoid = "", pick = (n) => Math.floor(Math.rand
|
|
|
10458
10467
|
}
|
|
10459
10468
|
function overlapRule(text) {
|
|
10460
10469
|
if (CONTINUE.test(norm2(text))) return "keep";
|
|
10461
|
-
if (/\?/.test(text)) return "cut";
|
|
10462
10470
|
let t = norm2(text);
|
|
10463
10471
|
if (!t) return void 0;
|
|
10464
|
-
if (HARD.test(t)) return "cut";
|
|
10472
|
+
if (HARD.test(t + " ")) return t.includes(" ") ? "cut" : "hold";
|
|
10465
10473
|
for (const p of PHRASES) t = t.split(p).join(" ");
|
|
10466
10474
|
const words3 = t.split(/[\s-]+/).filter(Boolean);
|
|
10467
10475
|
const ack = (w) => ACK.has(w) || HE_ACK.has(w) || /^(?:ha)+h?$|^(?:he)+h?$|^m+(?:hm+)?$|^h?m+$/.test(w);
|
|
10468
10476
|
if (words3.every(ack)) return "keep";
|
|
10469
10477
|
const lead2 = words3.findIndex((w) => !LEAD.has(w));
|
|
10470
|
-
if (lead2 >= 0 && LEADER.has(words3[lead2]) && words3.slice(lead2).filter((w) => !ack(w) && !LEAD.has(w)).length <= 1) return "keep";
|
|
10478
|
+
if (lead2 >= 0 && LEADER.has(words3[lead2]) && !words3.some((w) => HARD.test(w + " ")) && words3.slice(lead2).filter((w) => !ack(w) && !LEAD.has(w)).length <= 1) return "keep";
|
|
10471
10479
|
return void 0;
|
|
10472
10480
|
}
|
|
10473
10481
|
function fastOverlapModel(ai, model = "groq/qwen/qwen3.8-27b") {
|
|
10474
10482
|
return async (heard, signal) => {
|
|
10475
|
-
const prompt = 'Live voice call. The assistant is mid-sentence and the user just said this over it: "' + heard +
|
|
10483
|
+
const prompt = 'Live voice call. The assistant is mid-sentence and the user just said this over it: "' + heard + `"
|
|
10484
|
+
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.
|
|
10485
|
+
Answer yes (steering) or no (a reaction).`;
|
|
10476
10486
|
const reasoning = /qwen/.test(model) ? { providerOptions: { reasoning_effort: "none" } } : /gpt-oss/.test(model) ? { providerOptions: { reasoning_effort: "low" } } : {};
|
|
10477
10487
|
const r = await ai.chat({ model, messages: [{ role: "user", content: prompt }], stream: false, signal, temperature: 0, maxTokens: /gpt-oss/.test(model) ? 200 : 3, ...reasoning });
|
|
10478
10488
|
const a = (r.content ?? "").trim().toLowerCase();
|
|
10479
|
-
return /^yes/.test(a) ? "
|
|
10489
|
+
return /^yes/.test(a) ? "cut" : /^no/.test(a) ? "keep" : null;
|
|
10480
10490
|
};
|
|
10481
10491
|
}
|
|
10482
10492
|
var OverlapJudgeOptions = class {
|
|
@@ -10485,8 +10495,9 @@ var OverlapJudgeOptions = class {
|
|
|
10485
10495
|
/** A model verdict later than this is dropped → cut. 600ms: groq qwen measured p50 ~100ms / max ~230ms in isolation
|
|
10486
10496
|
* (24 calls, 2026-10-14) but live, beside the reflex + chatty-channel calls, 2 of 2 ambiguous verdicts missed 300ms
|
|
10487
10497
|
* and cut the reply. The engine holds the overlap up to 900ms (bindOverlapInstinct) — a slightly later keep beats
|
|
10488
|
-
* a cut, so the budget sits
|
|
10489
|
-
|
|
10498
|
+
* a cut, so the budget sits inside that hold. 800ms: at 600, 2 of 20 live reactions ("This is serious.") came back
|
|
10499
|
+
* late and cut the reply (2026-11-03). */
|
|
10500
|
+
budgetMs = 800;
|
|
10490
10501
|
onDecision = () => {
|
|
10491
10502
|
};
|
|
10492
10503
|
now = () => performance.now();
|
|
@@ -11135,6 +11146,10 @@ var TurnGateOptions = class {
|
|
|
11135
11146
|
dupWindowMs = 5e3;
|
|
11136
11147
|
/** A fuller final within this window of the last turn (or with its sttId) is a re-final of it. */
|
|
11137
11148
|
refinalWindowMs = 5e3;
|
|
11149
|
+
/** A held final never goes out while the user is saying more (a partial with new words, not yet final): live
|
|
11150
|
+
* 20261103-114604, "Okay." settled 700ms into "What will the…" and MAIN started, was aborted twice and merged. The
|
|
11151
|
+
* rest's final merges in; capped at this long from the hold (an STT that never finalizes a partial). */
|
|
11152
|
+
talkingMaxMs = 6e3;
|
|
11138
11153
|
onTurn = () => {
|
|
11139
11154
|
};
|
|
11140
11155
|
onDrop = () => {
|
|
@@ -11193,7 +11208,7 @@ var TurnGate = class {
|
|
|
11193
11208
|
const mid = endsMidPhrase(t);
|
|
11194
11209
|
if (mid || this.o.settleMs && !/\?["')\]]*$/.test(t)) {
|
|
11195
11210
|
const ms = mid ? this.o.holdMs : this.o.settleMs;
|
|
11196
|
-
this.held = { text: t, sttId, ms, replaces, timer: setTimeout(() => this.
|
|
11211
|
+
this.held = { text: t, sttId, ms, replaces, since: now3, timer: setTimeout(() => this.settle(), ms) };
|
|
11197
11212
|
return this.o.onHold(t);
|
|
11198
11213
|
}
|
|
11199
11214
|
this.send(t, key, sttId, "new", replaces);
|
|
@@ -11204,13 +11219,25 @@ var TurnGate = class {
|
|
|
11204
11219
|
const l = this.last;
|
|
11205
11220
|
if (l?.id !== id || this.held) return;
|
|
11206
11221
|
this.last = void 0;
|
|
11207
|
-
this.held = { text: l.text, sttId: l.sttId, ms: this.o.holdMs, replaces: id, timer: setTimeout(() => this.
|
|
11222
|
+
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) };
|
|
11223
|
+
}
|
|
11224
|
+
/** The user is speaking again (a partial — `text`, the whole partial): a held fragment waits for the rest. A partial
|
|
11225
|
+
* with words the held text lacks is more speech under way: the hold lasts until its final (≤ talkingMaxMs). */
|
|
11226
|
+
speaking(text = "") {
|
|
11227
|
+
const h = this.held;
|
|
11228
|
+
if (!h) return;
|
|
11229
|
+
if (text && norm3(text).split(" ").some((w) => w && !` ${norm3(h.text)} `.includes(` ${w} `))) h.talking = true;
|
|
11230
|
+
clearTimeout(h.timer);
|
|
11231
|
+
h.timer = setTimeout(() => this.settle(), h.ms);
|
|
11208
11232
|
}
|
|
11209
|
-
/** The user is
|
|
11210
|
-
|
|
11211
|
-
|
|
11212
|
-
|
|
11213
|
-
|
|
11233
|
+
/** The hold's quiet ran out: send it — unless the user is mid-line (a partial with no final yet). */
|
|
11234
|
+
settle() {
|
|
11235
|
+
const h = this.held;
|
|
11236
|
+
if (h?.talking && this.o.now() - h.since < this.o.talkingMaxMs) {
|
|
11237
|
+
h.timer = setTimeout(() => this.settle(), h.ms);
|
|
11238
|
+
return;
|
|
11239
|
+
}
|
|
11240
|
+
this.flush();
|
|
11214
11241
|
}
|
|
11215
11242
|
/** MAIN started replying to turn `id` (its first text/tool/audio): a later re-final only adds its new words. */
|
|
11216
11243
|
replyStarted(id) {
|
|
@@ -14031,18 +14058,19 @@ var Progress = class {
|
|
|
14031
14058
|
r(null);
|
|
14032
14059
|
}, this.o.generateBudgetMs);
|
|
14033
14060
|
});
|
|
14034
|
-
const
|
|
14061
|
+
const hint = argsHint(args) || about.slice(-80);
|
|
14062
|
+
const raw = await Promise.race([this.o.generate(tool, hint, lang, ac.signal, this.lines).catch((e) => {
|
|
14035
14063
|
log29.warn(`progress line failed: ${e?.message ?? e}`);
|
|
14036
14064
|
return null;
|
|
14037
14065
|
}), late]).finally(() => clearTimeout(t));
|
|
14038
14066
|
const l = cleanLine(raw ?? "", lang, 5);
|
|
14039
|
-
if (!l || about && !echoesHeard(l,
|
|
14067
|
+
if (!l || about && !echoesHeard(l, hint) || RESULT_CLAIM_RE.test(l) || HE_RESULT_CLAIM.test(l) || this.said.has(norm3(l)) || this.streamed) return "";
|
|
14040
14068
|
return l;
|
|
14041
14069
|
}
|
|
14042
14070
|
};
|
|
14043
14071
|
function fastProgressGenerator(ai, model, gender) {
|
|
14044
14072
|
return async (tool, hint, lang, signal, avoid = []) => {
|
|
14045
|
-
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 ?
|
|
14073
|
+
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.`;
|
|
14046
14074
|
const reasoning = /gpt-oss/.test(model) ? { providerOptions: { reasoning_effort: "low" } } : {};
|
|
14047
14075
|
const r = await ai.chat({ model, messages: [{ role: "user", content: prompt }], stream: false, signal, maxTokens: 150, ...reasoning });
|
|
14048
14076
|
return r.content ?? "";
|
|
@@ -14281,6 +14309,8 @@ var SecondChannel = class {
|
|
|
14281
14309
|
// live: that draft settled
|
|
14282
14310
|
askLeaf = null;
|
|
14283
14311
|
// live: this turn's ask leaf
|
|
14312
|
+
barged = false;
|
|
14313
|
+
// the user cut in since their last turn: that turn is a steer, not a story to react to
|
|
14284
14314
|
leafReady = Promise.resolve();
|
|
14285
14315
|
// live: the turn-end leaf pick settled
|
|
14286
14316
|
recent = [];
|
|
@@ -14495,9 +14525,11 @@ var SecondChannel = class {
|
|
|
14495
14525
|
this.detect(this.heard);
|
|
14496
14526
|
this.main = "idle";
|
|
14497
14527
|
this.onAgentState("queued");
|
|
14528
|
+
const steer = this.barged;
|
|
14529
|
+
this.barged = false;
|
|
14498
14530
|
if (this.tree) {
|
|
14499
14531
|
this.noteTalk("them", this.heard);
|
|
14500
|
-
this.leafReady = this.turnEndLeaf();
|
|
14532
|
+
this.leafReady = this.turnEndLeaf(steer);
|
|
14501
14533
|
}
|
|
14502
14534
|
}
|
|
14503
14535
|
/** The main answer's streamed text (before its audio): channel-1 is responding — no bridge from here on. */
|
|
@@ -14512,6 +14544,7 @@ var SecondChannel = class {
|
|
|
14512
14544
|
/** The user barged in: cut the in-flight line now and drop every pending decision. */
|
|
14513
14545
|
onBargeIn() {
|
|
14514
14546
|
this.gen++;
|
|
14547
|
+
this.barged = true;
|
|
14515
14548
|
this.cutLine = this.inflight || this.live ? this.live : null;
|
|
14516
14549
|
if (this.inflight) {
|
|
14517
14550
|
this.inflight = null;
|
|
@@ -14669,7 +14702,7 @@ var SecondChannel = class {
|
|
|
14669
14702
|
}
|
|
14670
14703
|
/** The user's turn went to MAIN: the armed leaf at once, else the quick model may name one in time. It plays only while
|
|
14671
14704
|
* MAIN is still silent, as the turn's first sound. */
|
|
14672
|
-
async turnEndLeaf() {
|
|
14705
|
+
async turnEndLeaf(steer = false) {
|
|
14673
14706
|
const tree = this.tree, gen = this.gen, heard = this.heard;
|
|
14674
14707
|
let hit = tree.turnLeaf();
|
|
14675
14708
|
if (!hit && this.o.pickLeaf && !tree.empty) {
|
|
@@ -14682,6 +14715,7 @@ var SecondChannel = class {
|
|
|
14682
14715
|
if (gen === this.gen && echoesHeard(hit.node.line, heard)) this.askLeaf = { gen, text: hit.node.line };
|
|
14683
14716
|
return;
|
|
14684
14717
|
}
|
|
14718
|
+
if (hit && steer) return;
|
|
14685
14719
|
if (hit && gen === this.gen && (this.main === "queued" || this.main === "thinking")) {
|
|
14686
14720
|
this.playLeaf(hit, "working", "bridge");
|
|
14687
14721
|
if (this.lastKind === "bridge" && this.bridged) {
|
|
@@ -15072,7 +15106,7 @@ var VoiceCall = class {
|
|
|
15072
15106
|
interim(text, _atMs, aec) {
|
|
15073
15107
|
if (this.ended || !text.trim()) return;
|
|
15074
15108
|
if (typeof aec === "boolean") this.fill.options.aec = aec;
|
|
15075
|
-
this.gate.speaking();
|
|
15109
|
+
this.gate.speaking(text);
|
|
15076
15110
|
this.lastUserAt = this.o.now();
|
|
15077
15111
|
const c = this.cur, steers = !!this.o.noteTurn && this.working;
|
|
15078
15112
|
const resumed = !steers || c.marks.mainFirst === void 0 && this.o.now() - c.at < this.o.resumeMs;
|
|
@@ -15361,7 +15395,9 @@ var VoiceCall = class {
|
|
|
15361
15395
|
log31.warn(`work reply failed \u2014 MAIN only: ${e?.message ?? e}`);
|
|
15362
15396
|
return "";
|
|
15363
15397
|
}).finally(() => clearTimeout(late)) : "";
|
|
15364
|
-
const
|
|
15398
|
+
const own = cleanWorkReply(raw, lang ?? ""), answer = own || workAck(raw, lang ?? "", this.o.gender);
|
|
15399
|
+
const line = own || (this.o.mode === "live" ? "" : answer);
|
|
15400
|
+
const stop = /^\s*stop\s*:/i.test(raw), change = !answer || /^\s*work\s*:/i.test(raw);
|
|
15365
15401
|
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.]`;
|
|
15366
15402
|
if (line && !this.ended) {
|
|
15367
15403
|
for (let i = 0; i < 8 && this.say(line, "aside") === false; i++) {
|