@livx.cc/agentx 0.99.145 → 0.99.146
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/README.md +1 -1
- package/dist/cli.d.ts +2 -1
- package/dist/cli.js +631 -205
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +376 -58
- package/dist/index.js.map +1 -1
- package/dist/{secondChannel-BFPgXN2z.d.ts → secondChannel-CJ1eYZKA.d.ts} +117 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10127,6 +10127,7 @@ function fitsLanguage(line, lang) {
|
|
|
10127
10127
|
}
|
|
10128
10128
|
var norm3 = (s) => s.toLowerCase().replace(/[^\p{L}\p{N}' ]/gu, "").replace(/\s+/g, " ").trim();
|
|
10129
10129
|
function cleanLine(s, lang, maxWords = 6) {
|
|
10130
|
+
if (/^(?:gasp|quiet|laughter)[.!?…]*$/i.test(s.trim())) return "";
|
|
10130
10131
|
const first = s.trim().split("\n")[0];
|
|
10131
10132
|
const tags = [...first.matchAll(LINE_TAG)].map((m) => `[${m[1].toLowerCase()}]`).filter((t, i, a) => a.indexOf(t) === i).join(" ");
|
|
10132
10133
|
const raw = first.replace(LINE_TAG, " ").trim();
|
|
@@ -12939,7 +12940,137 @@ init_models();
|
|
|
12939
12940
|
|
|
12940
12941
|
// src/voice/progress.ts
|
|
12941
12942
|
init_logging();
|
|
12942
|
-
|
|
12943
|
+
|
|
12944
|
+
// src/voice/convoTree.ts
|
|
12945
|
+
init_logging();
|
|
12946
|
+
|
|
12947
|
+
// src/voice/backchannelPlan.ts
|
|
12948
|
+
init_logging();
|
|
12949
|
+
var log27 = forComponent("BackchannelPlan");
|
|
12950
|
+
var silentTurn = (p) => p.density === "none" || p.turn === "short_command" || p.turn === "question";
|
|
12951
|
+
var cueWords = (s) => s.toLowerCase().replace(/[^\p{L}\p{N}'\s]+/gu, " ").split(/\s+/).filter(Boolean);
|
|
12952
|
+
function matchCue(plan, heard, from = 0) {
|
|
12953
|
+
if (!plan || silentTurn(plan)) return null;
|
|
12954
|
+
const w = cueWords(heard);
|
|
12955
|
+
for (let i = Math.max(0, from); i < w.length; i++) {
|
|
12956
|
+
for (const c of plan.cues) {
|
|
12957
|
+
for (const p of c.when) {
|
|
12958
|
+
const pw = p.split(" ");
|
|
12959
|
+
if (i + pw.length <= w.length && pw.every((x, j) => w[i + j] === x)) return c;
|
|
12960
|
+
}
|
|
12961
|
+
}
|
|
12962
|
+
}
|
|
12963
|
+
return null;
|
|
12964
|
+
}
|
|
12965
|
+
|
|
12966
|
+
// src/voice/convoTree.ts
|
|
12967
|
+
var log28 = forComponent("ConvoTree");
|
|
12968
|
+
var SOFT_CUE = "~";
|
|
12969
|
+
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(" "));
|
|
12970
|
+
var isContent = (w) => w.length >= 4 && !STOP4.has(w);
|
|
12971
|
+
function echoesHeard(line, heard) {
|
|
12972
|
+
const said = new Set(cueWords(heard));
|
|
12973
|
+
return cueWords(lineWords(line)).some((w) => isContent(w) && said.has(w));
|
|
12974
|
+
}
|
|
12975
|
+
var leafKey = (line) => cueWords(lineWords(line)).join(" ");
|
|
12976
|
+
var ConvoTreeOptions = class {
|
|
12977
|
+
/** A leaf plays at this confidence or above. */
|
|
12978
|
+
threshold = 0.5;
|
|
12979
|
+
/** How much more likely a cue of one word / of two or more is if its branch is the true one. */
|
|
12980
|
+
cueEvidence = 3;
|
|
12981
|
+
phraseEvidence = 8;
|
|
12982
|
+
/** A hit weakens each sibling by this factor. */
|
|
12983
|
+
siblingDecay = 0.5;
|
|
12984
|
+
/** A cue counts only within the newest N words: older ones have passed, a reaction to them would be late. */
|
|
12985
|
+
cueWindow = 4;
|
|
12986
|
+
};
|
|
12987
|
+
var namesHeard = (n, said) => (n.names ?? []).every((w) => said.has(w));
|
|
12988
|
+
function echoHeard(node, heard) {
|
|
12989
|
+
if (node.when[0] === SOFT_CUE) return true;
|
|
12990
|
+
const said = new Set(cueWords(heard));
|
|
12991
|
+
return node.when.flatMap((w) => w.split(" ")).some((w) => isContent(w) && said.has(w)) && namesHeard(node, said);
|
|
12992
|
+
}
|
|
12993
|
+
var ConvoTree = class {
|
|
12994
|
+
// a turn_end leaf waiting for the turn to end
|
|
12995
|
+
constructor(options) {
|
|
12996
|
+
this.options = options;
|
|
12997
|
+
this.options = { ...new ConvoTreeOptions(), ...options };
|
|
12998
|
+
}
|
|
12999
|
+
options;
|
|
13000
|
+
live = [];
|
|
13001
|
+
from = 0;
|
|
13002
|
+
// word index after the last hit
|
|
13003
|
+
armed = null;
|
|
13004
|
+
get o() {
|
|
13005
|
+
return this.options;
|
|
13006
|
+
}
|
|
13007
|
+
get nodes() {
|
|
13008
|
+
return this.live;
|
|
13009
|
+
}
|
|
13010
|
+
get empty() {
|
|
13011
|
+
return !this.live.length;
|
|
13012
|
+
}
|
|
13013
|
+
/** A fresh tree. `heardWords`: words already said this turn (a tree grown mid-turn matches only what comes next). */
|
|
13014
|
+
grow(nodes, heardWords = 0) {
|
|
13015
|
+
this.live = nodes.map((n) => ({ ...n }));
|
|
13016
|
+
this.armed = null;
|
|
13017
|
+
this.from = heardWords;
|
|
13018
|
+
}
|
|
13019
|
+
/** Posterior of a node after seeing its cue. */
|
|
13020
|
+
confidence(p, words3) {
|
|
13021
|
+
const l = p * (words3 > 1 ? this.o.phraseEvidence : this.o.cueEvidence);
|
|
13022
|
+
return l / (l + 1 - p);
|
|
13023
|
+
}
|
|
13024
|
+
/** The partial's newest evidence: the strongest new cue hit (its children open, its siblings fade), or null. A turn_end
|
|
13025
|
+
* hit is armed for endTurn; the caller plays the others. Hits under the threshold still sharpen the tree. */
|
|
13026
|
+
step(heard) {
|
|
13027
|
+
const w = cueWords(heard), said = new Set(w);
|
|
13028
|
+
let best = null;
|
|
13029
|
+
for (let i = Math.max(this.from, w.length - this.o.cueWindow); i < w.length; i++) {
|
|
13030
|
+
for (const node2 of this.live) for (const cue of node2.when) {
|
|
13031
|
+
const pw = cue.split(" ");
|
|
13032
|
+
if (!namesHeard(node2, said) || i + pw.length > w.length || !pw.every((x, j) => w[i + j] === x)) continue;
|
|
13033
|
+
const conf2 = this.confidence(node2.p, pw.length);
|
|
13034
|
+
if (!best || conf2 > best.conf) best = { node: node2, conf: conf2, end: i + pw.length };
|
|
13035
|
+
}
|
|
13036
|
+
}
|
|
13037
|
+
if (!best) return null;
|
|
13038
|
+
const { node, conf } = best;
|
|
13039
|
+
this.from = best.end;
|
|
13040
|
+
this.take(node, conf);
|
|
13041
|
+
const hit = { node, conf };
|
|
13042
|
+
if ((node.moment === "turn_end" || node.moment === "ask") && conf >= (this.armed?.conf ?? 0)) {
|
|
13043
|
+
this.armed = hit;
|
|
13044
|
+
return null;
|
|
13045
|
+
}
|
|
13046
|
+
return conf >= this.o.threshold ? hit : null;
|
|
13047
|
+
}
|
|
13048
|
+
/** A node happened: it leaves the live set, its siblings fade, its children open. */
|
|
13049
|
+
take(node, conf) {
|
|
13050
|
+
this.live = [...this.live.filter((n) => n !== node).map((n) => ({ ...n, p: n.p * this.o.siblingDecay })), ...node.next.map((n) => ({ ...n, p: Math.min(1, n.p * Math.max(conf, 0.5) * 1.5) }))];
|
|
13051
|
+
}
|
|
13052
|
+
/** The turn ended: the armed leaf if it clears the threshold. The live set stays for a picker; `advance` clears it. */
|
|
13053
|
+
turnLeaf() {
|
|
13054
|
+
const a = this.armed;
|
|
13055
|
+
return a && a.conf >= this.o.threshold ? a : null;
|
|
13056
|
+
}
|
|
13057
|
+
/** A quick model named a node at the turn's end: its evidence counts as a phrase. Null when under the threshold. */
|
|
13058
|
+
picked(i, heard = "") {
|
|
13059
|
+
const node = this.live[i];
|
|
13060
|
+
if (!node || !echoHeard(node, heard)) return null;
|
|
13061
|
+
const conf = this.confidence(node.p, 2);
|
|
13062
|
+
return conf >= this.o.threshold ? { node, conf } : null;
|
|
13063
|
+
}
|
|
13064
|
+
/** Next turn: what followed a played/armed branch stays live until a fresh tree lands; the rest is gone. */
|
|
13065
|
+
advance() {
|
|
13066
|
+
this.live = this.live.filter((n) => n.p >= 0.05);
|
|
13067
|
+
this.armed = null;
|
|
13068
|
+
this.from = 0;
|
|
13069
|
+
}
|
|
13070
|
+
};
|
|
13071
|
+
|
|
13072
|
+
// src/voice/progress.ts
|
|
13073
|
+
var log29 = forComponent("Progress");
|
|
12943
13074
|
var HE_RESULT_CLAIM = /(?:^|\s)(?:מצאתי|סיימתי|בוצע|הנה|אין)(?=\s|$|[.,!…])/u;
|
|
12944
13075
|
var TOPICS = [
|
|
12945
13076
|
[/toolsearch|^mcp__.*__(list_commands|call_info)$/, null],
|
|
@@ -13063,8 +13194,8 @@ var Progress = class {
|
|
|
13063
13194
|
this.said.add(norm3(line));
|
|
13064
13195
|
this.lastAt = this.o.now();
|
|
13065
13196
|
}
|
|
13066
|
-
/** The line for this tool call in `lang`, or '' (no template and no/late/invalid generation, a repeat, a result claim). */
|
|
13067
|
-
async line(tool, args, lang) {
|
|
13197
|
+
/** `about`: the user's request, for a generated line. The line for this tool call in `lang`, or '' (no template and no/late/invalid generation, a repeat, a result claim). */
|
|
13198
|
+
async line(tool, args, lang, about = "") {
|
|
13068
13199
|
if (this.streamed) return "";
|
|
13069
13200
|
const name = tool.toLowerCase();
|
|
13070
13201
|
const hit = TOPICS.find(([re]) => re.test(name));
|
|
@@ -13083,18 +13214,18 @@ var Progress = class {
|
|
|
13083
13214
|
r(null);
|
|
13084
13215
|
}, this.o.generateBudgetMs);
|
|
13085
13216
|
});
|
|
13086
|
-
const raw = await Promise.race([this.o.generate(tool, argsHint(args), lang, ac.signal).catch((e) => {
|
|
13087
|
-
|
|
13217
|
+
const raw = await Promise.race([this.o.generate(tool, [about.slice(-80), argsHint(args)].filter(Boolean).join("; "), lang, ac.signal).catch((e) => {
|
|
13218
|
+
log29.warn(`progress line failed: ${e?.message ?? e}`);
|
|
13088
13219
|
return null;
|
|
13089
13220
|
}), late]).finally(() => clearTimeout(t));
|
|
13090
13221
|
const l = cleanLine(raw ?? "", lang, 5);
|
|
13091
|
-
if (!l || RESULT_CLAIM_RE.test(l) || HE_RESULT_CLAIM.test(l) || this.said.has(norm3(l)) || this.streamed) return "";
|
|
13222
|
+
if (!l || about && !echoesHeard(l, `${about} ${argsHint(args)}`) || RESULT_CLAIM_RE.test(l) || HE_RESULT_CLAIM.test(l) || this.said.has(norm3(l)) || this.streamed) return "";
|
|
13092
13223
|
return l;
|
|
13093
13224
|
}
|
|
13094
13225
|
};
|
|
13095
13226
|
function fastProgressGenerator(ai, model, gender) {
|
|
13096
13227
|
return async (tool, hint, lang, signal) => {
|
|
13097
|
-
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"). Never state a result or a finding. ${personaHint(gender)} Output only the line.`;
|
|
13228
|
+
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 ? "Use the words of what it is about. " : ""}Never state a result or a finding. ${personaHint(gender)} Output only the line.`;
|
|
13098
13229
|
const reasoning = /gpt-oss/.test(model) ? { providerOptions: { reasoning_effort: "low" } } : {};
|
|
13099
13230
|
const r = await ai.chat({ model, messages: [{ role: "user", content: prompt }], stream: false, signal, maxTokens: 150, ...reasoning });
|
|
13100
13231
|
return r.content ?? "";
|
|
@@ -13103,28 +13234,7 @@ function fastProgressGenerator(ai, model, gender) {
|
|
|
13103
13234
|
|
|
13104
13235
|
// src/voice/secondChannel.ts
|
|
13105
13236
|
init_logging();
|
|
13106
|
-
|
|
13107
|
-
// src/voice/backchannelPlan.ts
|
|
13108
|
-
init_logging();
|
|
13109
|
-
var log28 = forComponent("BackchannelPlan");
|
|
13110
|
-
var silentTurn = (p) => p.density === "none" || p.turn === "short_command" || p.turn === "question";
|
|
13111
|
-
var cueWords = (s) => s.toLowerCase().replace(/[^\p{L}\p{N}'\s]+/gu, " ").split(/\s+/).filter(Boolean);
|
|
13112
|
-
function matchCue(plan, heard, from = 0) {
|
|
13113
|
-
if (!plan || silentTurn(plan)) return null;
|
|
13114
|
-
const w = cueWords(heard);
|
|
13115
|
-
for (let i = Math.max(0, from); i < w.length; i++) {
|
|
13116
|
-
for (const c of plan.cues) {
|
|
13117
|
-
for (const p of c.when) {
|
|
13118
|
-
const pw = p.split(" ");
|
|
13119
|
-
if (i + pw.length <= w.length && pw.every((x, j) => w[i + j] === x)) return c;
|
|
13120
|
-
}
|
|
13121
|
-
}
|
|
13122
|
-
}
|
|
13123
|
-
return null;
|
|
13124
|
-
}
|
|
13125
|
-
|
|
13126
|
-
// src/voice/secondChannel.ts
|
|
13127
|
-
var log29 = forComponent("SecondChannel");
|
|
13237
|
+
var log30 = forComponent("SecondChannel");
|
|
13128
13238
|
var CHANNEL_MODES = {
|
|
13129
13239
|
turn: { kinds: ["bridge"], bridgeDelayMs: 1500 },
|
|
13130
13240
|
normal: {},
|
|
@@ -13143,10 +13253,10 @@ var CHANNEL_MODES = {
|
|
|
13143
13253
|
maxPerWindow: 6
|
|
13144
13254
|
},
|
|
13145
13255
|
live: {
|
|
13146
|
-
kinds: ["backchannel"],
|
|
13256
|
+
kinds: ["backchannel", "bridge"],
|
|
13147
13257
|
anticipate: true,
|
|
13148
13258
|
cueOnly: false,
|
|
13149
|
-
generateFor: ["backchannel"],
|
|
13259
|
+
generateFor: ["backchannel", "bridge"],
|
|
13150
13260
|
reactionGapMs: 0,
|
|
13151
13261
|
generateBudgetMs: 400,
|
|
13152
13262
|
backchannelMinWords: 3,
|
|
@@ -13196,6 +13306,8 @@ var SecondChannelOptions = class {
|
|
|
13196
13306
|
decideEveryWords = 3;
|
|
13197
13307
|
decisionBudgetMs = 300;
|
|
13198
13308
|
generateBudgetMs = 500;
|
|
13309
|
+
/** `live`: how long the fast model may take on a bridge line; later = silence. */
|
|
13310
|
+
bridgeBudgetMs = 1200;
|
|
13199
13311
|
minGapMs = 2500;
|
|
13200
13312
|
/** Backchannel after backchannel needs this gap (~4-6 cues in a 30s monologue — Para phone call 2026-10-13: 5s left
|
|
13201
13313
|
* one cue in a long statement). */
|
|
@@ -13249,6 +13361,31 @@ var SecondChannelOptions = class {
|
|
|
13249
13361
|
cueOnly = true;
|
|
13250
13362
|
onPlan = () => {
|
|
13251
13363
|
};
|
|
13364
|
+
/** `live` only (convoTree.ts): grows the prediction tree after each reply. Once a tree is up it is the only source of
|
|
13365
|
+
* lines while the user talks: a leaf above its threshold, or silence. No tree yet / a failed one: the reactive path. */
|
|
13366
|
+
grow;
|
|
13367
|
+
/** The quick model at a turn's end with no cue hit: names a leaf or none, inside `pickBudgetMs`. */
|
|
13368
|
+
pickLeaf;
|
|
13369
|
+
pickBudgetMs = 700;
|
|
13370
|
+
growBudgetMs = 15e3;
|
|
13371
|
+
tree = {};
|
|
13372
|
+
/** The tree grower's persona (who is speaking). */
|
|
13373
|
+
persona = "";
|
|
13374
|
+
/** Lines of talk the grower sees. */
|
|
13375
|
+
talkLines = 8;
|
|
13376
|
+
/** Mid-turn: at this many words the tree regrows once from what they are saying now. */
|
|
13377
|
+
regrowAtWords = 6;
|
|
13378
|
+
/** A leaf is dropped once the talk moved this many words past its cue. */
|
|
13379
|
+
leafStaleWords = 3;
|
|
13380
|
+
/** Interims stop this long: the quick model may pick a leaf (shorter than the ~400ms word cadence, so most gaps count; leafGated spaces the calls). */
|
|
13381
|
+
leafBreathMs = 200;
|
|
13382
|
+
/** Played leaves the grower must avoid, and how many lines pass before a tag may play again. */
|
|
13383
|
+
leafMemory = 16;
|
|
13384
|
+
tagEvery = 4;
|
|
13385
|
+
onTree = () => {
|
|
13386
|
+
};
|
|
13387
|
+
onLeaf = () => {
|
|
13388
|
+
};
|
|
13252
13389
|
now = () => performance.now();
|
|
13253
13390
|
random = Math.random;
|
|
13254
13391
|
};
|
|
@@ -13257,15 +13394,15 @@ function withBudget(p, ms, what, ac) {
|
|
|
13257
13394
|
let t;
|
|
13258
13395
|
const late = new Promise((r) => {
|
|
13259
13396
|
t = setTimeout(() => {
|
|
13260
|
-
|
|
13397
|
+
log30.debug(`${what}: over the ${ms}ms budget \u2014 dropped`);
|
|
13261
13398
|
ac?.abort();
|
|
13262
13399
|
r(null);
|
|
13263
13400
|
}, ms);
|
|
13264
13401
|
});
|
|
13265
13402
|
return Promise.race([p.catch((e) => {
|
|
13266
13403
|
const msg = String(e?.message ?? e);
|
|
13267
|
-
if (e?.name === "AbortError" || /aborted/i.test(msg))
|
|
13268
|
-
else
|
|
13404
|
+
if (e?.name === "AbortError" || /aborted/i.test(msg)) log30.debug(`${what}: aborted after its budget`);
|
|
13405
|
+
else log30.warn(`${what} failed \u2014 falling back: ${msg}`);
|
|
13269
13406
|
return null;
|
|
13270
13407
|
}), late]).finally(() => clearTimeout(t));
|
|
13271
13408
|
}
|
|
@@ -13278,6 +13415,7 @@ var SecondChannel = class {
|
|
|
13278
13415
|
for (const k of Object.keys(preset)) if (!options || !(k in options)) this.normalTiming[k] = base[k];
|
|
13279
13416
|
this.startedAt = this.o.now();
|
|
13280
13417
|
if (this.o.lang) this.setLanguage(this.o.lang, true);
|
|
13418
|
+
if (this.o.mode === "live" && this.o.grow) this.tree = new ConvoTree(this.o.tree);
|
|
13281
13419
|
}
|
|
13282
13420
|
options;
|
|
13283
13421
|
heard = "";
|
|
@@ -13306,6 +13444,12 @@ var SecondChannel = class {
|
|
|
13306
13444
|
// one bridge per main turn
|
|
13307
13445
|
bridgeDraft = null;
|
|
13308
13446
|
// a bridge generated ahead, used only if ready in time
|
|
13447
|
+
bridgeReady = Promise.resolve();
|
|
13448
|
+
// live: that draft settled
|
|
13449
|
+
askLeaf = null;
|
|
13450
|
+
// live: this turn's ask leaf
|
|
13451
|
+
leafReady = Promise.resolve();
|
|
13452
|
+
// live: the turn-end leaf pick settled
|
|
13309
13453
|
recent = [];
|
|
13310
13454
|
picks = /* @__PURE__ */ new Map();
|
|
13311
13455
|
inflight = null;
|
|
@@ -13333,6 +13477,21 @@ var SecondChannel = class {
|
|
|
13333
13477
|
normalTiming = {};
|
|
13334
13478
|
// chatty without aec: the preset's keys back at their defaults
|
|
13335
13479
|
degradedLogged = false;
|
|
13480
|
+
tree = null;
|
|
13481
|
+
// live with a grower only
|
|
13482
|
+
growing = false;
|
|
13483
|
+
growTries = 0;
|
|
13484
|
+
// per turn
|
|
13485
|
+
replyGrown = false;
|
|
13486
|
+
// one tree per reply (idle comes more than once)
|
|
13487
|
+
talk = [];
|
|
13488
|
+
leaves = [];
|
|
13489
|
+
// leaves played this call
|
|
13490
|
+
sinceTag = Infinity;
|
|
13491
|
+
regrown = false;
|
|
13492
|
+
picking = false;
|
|
13493
|
+
breathTimer = null;
|
|
13494
|
+
leafTimer = null;
|
|
13336
13495
|
/** The language lines are spoken in (detected from the user's words, or set by the host). */
|
|
13337
13496
|
get language() {
|
|
13338
13497
|
return this.lang;
|
|
@@ -13344,7 +13503,7 @@ var SecondChannel = class {
|
|
|
13344
13503
|
if (host) this.pinned = true;
|
|
13345
13504
|
const lang = primaryLang(tag);
|
|
13346
13505
|
if (!lang || lang === this.lang) return;
|
|
13347
|
-
|
|
13506
|
+
log30.debug(`language ${this.lang} \u2192 ${lang}`);
|
|
13348
13507
|
this.lang = lang;
|
|
13349
13508
|
this.recent = [];
|
|
13350
13509
|
this.picks.clear();
|
|
@@ -13357,6 +13516,10 @@ var SecondChannel = class {
|
|
|
13357
13516
|
const l = detectLanguage(text, !!this.lang);
|
|
13358
13517
|
if (l) this.setLanguage(l);
|
|
13359
13518
|
}
|
|
13519
|
+
/** `live` speaks no stock bridge/filler, with or without aec. */
|
|
13520
|
+
get ownWords() {
|
|
13521
|
+
return this.options.mode === "live";
|
|
13522
|
+
}
|
|
13360
13523
|
get bank() {
|
|
13361
13524
|
return this.lang ? this.o.banks ? this.o.banks.get(this.lang) : this.lang === "en" ? EN_BANK : null : null;
|
|
13362
13525
|
}
|
|
@@ -13380,7 +13543,23 @@ var SecondChannel = class {
|
|
|
13380
13543
|
this.onPause(this.o.fillerPauseMs);
|
|
13381
13544
|
}, this.o.fillerPauseMs);
|
|
13382
13545
|
let cue = null;
|
|
13383
|
-
if (this.
|
|
13546
|
+
if (this.tree) {
|
|
13547
|
+
if (this.tree.empty && !this.growing && this.growTries < 2) this.requestTree();
|
|
13548
|
+
if (!this.tree.empty) {
|
|
13549
|
+
this.treeStep(t);
|
|
13550
|
+
if (!this.regrown && words2(t).length >= this.o.regrowAtWords) {
|
|
13551
|
+
this.regrown = true;
|
|
13552
|
+
this.requestTree(t);
|
|
13553
|
+
}
|
|
13554
|
+
this.armBreath(t);
|
|
13555
|
+
if (this.bcTimer) {
|
|
13556
|
+
clearTimeout(this.bcTimer);
|
|
13557
|
+
this.bcTimer = null;
|
|
13558
|
+
}
|
|
13559
|
+
return;
|
|
13560
|
+
}
|
|
13561
|
+
}
|
|
13562
|
+
if (this.o.anticipate && !this.tree) {
|
|
13384
13563
|
const n = words2(t).length;
|
|
13385
13564
|
if (!this.plan && !this.planning && this.planTries < 2) this.requestPlan();
|
|
13386
13565
|
else if (this.plan && !this.revised && n >= this.o.reviseAtWords) {
|
|
@@ -13425,11 +13604,24 @@ var SecondChannel = class {
|
|
|
13425
13604
|
this.decidedAt = 0;
|
|
13426
13605
|
this.bridged = false;
|
|
13427
13606
|
this.cueFrom = 0;
|
|
13428
|
-
if (this.
|
|
13607
|
+
if (this.tree) {
|
|
13608
|
+
if (this.reply.trim() && !this.replyGrown) {
|
|
13609
|
+
this.replyGrown = true;
|
|
13610
|
+
this.noteTalk("you", this.reply);
|
|
13611
|
+
this.requestTree();
|
|
13612
|
+
}
|
|
13613
|
+
} else if (this.o.anticipate && this.reply.trim() && !this.plan && !this.planning) this.requestPlan();
|
|
13429
13614
|
return;
|
|
13430
13615
|
}
|
|
13431
13616
|
if (s === "queued") {
|
|
13432
13617
|
this.turnNo++;
|
|
13618
|
+
this.growTries = 0;
|
|
13619
|
+
this.replyGrown = false;
|
|
13620
|
+
this.regrown = false;
|
|
13621
|
+
if (this.breathTimer) {
|
|
13622
|
+
clearTimeout(this.breathTimer);
|
|
13623
|
+
this.breathTimer = null;
|
|
13624
|
+
}
|
|
13433
13625
|
this.plan = null;
|
|
13434
13626
|
this.planning = false;
|
|
13435
13627
|
this.planTries = 0;
|
|
@@ -13443,7 +13635,7 @@ var SecondChannel = class {
|
|
|
13443
13635
|
if (this[k]) clearTimeout(this[k]);
|
|
13444
13636
|
this[k] = null;
|
|
13445
13637
|
}
|
|
13446
|
-
if (this.o.instantBridge) this.prefetchBridge();
|
|
13638
|
+
if (this.o.instantBridge || this.ownWords) this.prefetchBridge();
|
|
13447
13639
|
const wait = Math.max(this.o.bridgeDelayMs, this.o.minGapMs - (this.o.now() - this.lastAt));
|
|
13448
13640
|
if (wait > 0) this.bridgeTimer = setTimeout(() => {
|
|
13449
13641
|
this.bridgeTimer = null;
|
|
@@ -13470,6 +13662,10 @@ var SecondChannel = class {
|
|
|
13470
13662
|
this.detect(this.heard);
|
|
13471
13663
|
this.main = "idle";
|
|
13472
13664
|
this.onAgentState("queued");
|
|
13665
|
+
if (this.tree) {
|
|
13666
|
+
this.noteTalk("them", this.heard);
|
|
13667
|
+
this.leafReady = this.turnEndLeaf();
|
|
13668
|
+
}
|
|
13473
13669
|
}
|
|
13474
13670
|
/** The main answer's streamed text (before its audio): channel-1 is responding — no bridge from here on. */
|
|
13475
13671
|
onMainTokens(text) {
|
|
@@ -13489,7 +13685,7 @@ var SecondChannel = class {
|
|
|
13489
13685
|
try {
|
|
13490
13686
|
this.o.cancel();
|
|
13491
13687
|
} catch (e) {
|
|
13492
|
-
|
|
13688
|
+
log30.warn(`cancel threw: ${e.message}`);
|
|
13493
13689
|
}
|
|
13494
13690
|
}
|
|
13495
13691
|
}
|
|
@@ -13500,6 +13696,10 @@ var SecondChannel = class {
|
|
|
13500
13696
|
this.cutLine = null;
|
|
13501
13697
|
return !!c && c === text.trim();
|
|
13502
13698
|
}
|
|
13699
|
+
/** Another fill line (progress) already covers this turn's wait: no bridge after it. */
|
|
13700
|
+
covered() {
|
|
13701
|
+
this.bridged = true;
|
|
13702
|
+
}
|
|
13503
13703
|
/** Resolves when the in-flight line finished playing (immediately when none) — hosts enqueue channel-1 audio behind it. */
|
|
13504
13704
|
drain() {
|
|
13505
13705
|
return this.inflight ?? Promise.resolve();
|
|
@@ -13579,6 +13779,106 @@ var SecondChannel = class {
|
|
|
13579
13779
|
this.o.onPlan(p, !!heard, Math.round(this.o.now() - t0));
|
|
13580
13780
|
});
|
|
13581
13781
|
}
|
|
13782
|
+
noteTalk(who, text) {
|
|
13783
|
+
this.talk = [...this.talk, `${who}: ${text.trim().slice(-300)}`].slice(-this.o.talkLines);
|
|
13784
|
+
}
|
|
13785
|
+
/** Grow the tree off the hot path. A tree that lands after its turn is still the best guess: it replaces what is live. */
|
|
13786
|
+
requestTree(heard) {
|
|
13787
|
+
if (!this.tree || !this.o.grow || !this.lang || this.growing) return;
|
|
13788
|
+
this.growing = true;
|
|
13789
|
+
this.growTries++;
|
|
13790
|
+
const t0 = this.o.now(), ac = new AbortController(), tree = this.tree;
|
|
13791
|
+
const ctx = { talk: heard ? [...this.talk, `them (still talking): ${heard.slice(-240)}`] : [...this.talk], lang: detectLanguage(this.talk.join(" ").replace(/\b(them|you):/g, "")) ?? this.lang, recent: this.leaves.slice(-this.o.leafMemory), ...this.o.persona ? { persona: this.o.persona } : {} };
|
|
13792
|
+
const late = setTimeout(() => ac.abort(), this.o.growBudgetMs);
|
|
13793
|
+
void this.o.grow(ctx, ac.signal).then((r) => {
|
|
13794
|
+
if (r.nodes.length) tree.grow(r.nodes, this.userSpeaking ? words2(this.heard).length : 0);
|
|
13795
|
+
this.o.onTree({ ms: Math.round(this.o.now() - t0), branches: r.nodes.length, lines: r.nodes.flatMap((n) => [n.line, ...n.next.map((k) => k.line)]), ...r.tokens ? { tokens: r.tokens } : {} });
|
|
13796
|
+
}, (e) => {
|
|
13797
|
+
log30.warn(`tree failed: ${e?.message ?? e}`);
|
|
13798
|
+
this.o.onTree({ ms: Math.round(this.o.now() - t0), branches: 0, error: String(e?.message ?? e) });
|
|
13799
|
+
}).finally(() => {
|
|
13800
|
+
clearTimeout(late);
|
|
13801
|
+
this.growing = false;
|
|
13802
|
+
});
|
|
13803
|
+
}
|
|
13804
|
+
/** Text match on the partial (no model). barge_in plays now, in_between at the next breath; turn_end waits in the tree. */
|
|
13805
|
+
treeStep(t) {
|
|
13806
|
+
const hit = this.tree.step(t);
|
|
13807
|
+
if (!hit) return;
|
|
13808
|
+
if (hit.node.moment === "barge_in") return this.playLeaf(hit, "interim", "backchannel");
|
|
13809
|
+
if (this.leafTimer) clearTimeout(this.leafTimer);
|
|
13810
|
+
const at = words2(t).length;
|
|
13811
|
+
this.leafTimer = setTimeout(() => {
|
|
13812
|
+
this.leafTimer = null;
|
|
13813
|
+
if (this.userSpeaking && words2(this.heard).length - at < this.o.leafStaleWords) this.playLeaf(hit, "interim", "backchannel");
|
|
13814
|
+
}, this.o.cuePauseMs);
|
|
13815
|
+
}
|
|
13816
|
+
/** A breath with no cue hit: the quick model may name the leaf that fits the words just said. Its answer plays only if
|
|
13817
|
+
* they have not moved on. */
|
|
13818
|
+
armBreath(t) {
|
|
13819
|
+
if (this.breathTimer) clearTimeout(this.breathTimer);
|
|
13820
|
+
if (!this.o.pickLeaf || !this.o.aec) return;
|
|
13821
|
+
this.breathTimer = setTimeout(() => {
|
|
13822
|
+
this.breathTimer = null;
|
|
13823
|
+
const n = words2(t).length, tree = this.tree;
|
|
13824
|
+
if (n < this.o.backchannelMinWords || this.heard !== t || this.leafTimer || this.picking || tree.empty || this.leafGated()) return;
|
|
13825
|
+
this.picking = true;
|
|
13826
|
+
const ac = new AbortController(), nodes = tree.nodes.filter((x) => x.moment !== "ask"), lines = nodes.map((x, i) => ({ i, line: x.line, when: x.when }));
|
|
13827
|
+
void withBudget(this.o.pickLeaf(t, lines, ac.signal), this.o.pickBudgetMs, "breath pick", ac).then((i) => {
|
|
13828
|
+
this.picking = false;
|
|
13829
|
+
const node = typeof i === "number" ? nodes[i] : void 0, hit = node && tree.nodes.includes(node) ? tree.picked(tree.nodes.indexOf(node), this.heard) : null;
|
|
13830
|
+
if (!hit || !this.userSpeaking || words2(this.heard).length - n >= this.o.leafStaleWords) return;
|
|
13831
|
+
tree.take(hit.node, hit.conf);
|
|
13832
|
+
this.playLeaf(hit, "interim", "backchannel");
|
|
13833
|
+
});
|
|
13834
|
+
}, this.o.leafBreathMs);
|
|
13835
|
+
}
|
|
13836
|
+
/** 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
|
|
13837
|
+
* MAIN is still silent, as the turn's first sound. */
|
|
13838
|
+
async turnEndLeaf() {
|
|
13839
|
+
const tree = this.tree, gen = this.gen, heard = this.heard;
|
|
13840
|
+
let hit = tree.turnLeaf();
|
|
13841
|
+
if (!hit && this.o.pickLeaf && !tree.empty) {
|
|
13842
|
+
const ac = new AbortController(), lines = tree.nodes.map((n, i2) => ({ i: i2, line: n.line, when: n.when }));
|
|
13843
|
+
const i = await withBudget(this.o.pickLeaf(heard, lines, ac.signal), this.o.pickBudgetMs, "leaf pick", ac);
|
|
13844
|
+
if (typeof i === "number" && i >= 0) hit = tree.picked(i, heard);
|
|
13845
|
+
}
|
|
13846
|
+
tree.advance();
|
|
13847
|
+
if (hit?.node.moment === "ask") {
|
|
13848
|
+
if (gen === this.gen && echoesHeard(hit.node.line, heard)) this.askLeaf = { gen, text: hit.node.line };
|
|
13849
|
+
return;
|
|
13850
|
+
}
|
|
13851
|
+
if (hit && gen === this.gen && (this.main === "queued" || this.main === "thinking")) {
|
|
13852
|
+
this.playLeaf(hit, "working", "bridge");
|
|
13853
|
+
if (this.lastKind === "bridge" && this.bridged) {
|
|
13854
|
+
this.bridged = false;
|
|
13855
|
+
this.lastKind = null;
|
|
13856
|
+
if (this.bridgeTimer) clearTimeout(this.bridgeTimer);
|
|
13857
|
+
this.bridgeTimer = setTimeout(() => {
|
|
13858
|
+
this.bridgeTimer = null;
|
|
13859
|
+
void this.consider("working");
|
|
13860
|
+
}, this.o.minGapMs);
|
|
13861
|
+
}
|
|
13862
|
+
}
|
|
13863
|
+
}
|
|
13864
|
+
leafGated() {
|
|
13865
|
+
return !this.lang || this.audioLocked || !!this.inflight || this.o.now() - this.lastAt < this.o.minGapMs || this.capped();
|
|
13866
|
+
}
|
|
13867
|
+
/** A leaf's gates: never over MAIN's audio or another line, spaced, capped; never a repeat. */
|
|
13868
|
+
playLeaf(hit, trigger, kind) {
|
|
13869
|
+
const { moment } = hit.node, conf = Math.round(hit.conf * 100) / 100;
|
|
13870
|
+
const tagged = hit.node.line !== lineWords(hit.node.line);
|
|
13871
|
+
const line = tagged && this.sinceTag < this.o.tagEvery ? lineWords(hit.node.line) : hit.node.line;
|
|
13872
|
+
const gated = !line || this.leafGated() || this.leaves.includes(leafKey(line));
|
|
13873
|
+
const said = !gated && this.say(kind, line);
|
|
13874
|
+
if (said) {
|
|
13875
|
+
this.leaves = [...this.leaves, leafKey(line)].slice(-this.o.leafMemory);
|
|
13876
|
+
this.sinceTag = line === hit.node.line && tagged ? 0 : this.sinceTag + 1;
|
|
13877
|
+
}
|
|
13878
|
+
const e = { trigger, rule: kind, kind, text: line, ms: 0, moment, conf, acted: gated ? "gated" : said ? "spoken" : "skipped" };
|
|
13879
|
+
this.o.onEvent(e);
|
|
13880
|
+
this.o.onLeaf(e);
|
|
13881
|
+
}
|
|
13582
13882
|
/** A clause boundary mid-floor: a breath or a comma-like close. Not a question (it wants the answer, not "mm-hm"), and a
|
|
13583
13883
|
* sentence end only deep into a story — a short request's end is the end of their turn (replay: "mm-hm" right after
|
|
13584
13884
|
* "Check hacker news for recent news.", just before the final). */
|
|
@@ -13601,7 +13901,7 @@ var SecondChannel = class {
|
|
|
13601
13901
|
const opts = this.options;
|
|
13602
13902
|
if (opts.mode === "chatty" && !opts.aec && !this.degradedLogged) {
|
|
13603
13903
|
this.degradedLogged = true;
|
|
13604
|
-
|
|
13904
|
+
log30.info("chatty mode without echo cancellation \u2014 normal timing (our lines would re-trigger the mic)");
|
|
13605
13905
|
}
|
|
13606
13906
|
const rule = this.rule(trigger, pauseMs, breath, cue);
|
|
13607
13907
|
if (rule === "silence") {
|
|
@@ -13620,7 +13920,7 @@ var SecondChannel = class {
|
|
|
13620
13920
|
const d = await withBudget(this.o.decide(this.tail(), { ...this.state(pauseMs), rule }, ac.signal), this.o.decisionBudgetMs, "channel decision", ac);
|
|
13621
13921
|
choice = d?.choice;
|
|
13622
13922
|
if (choice && choice in CHANNEL_ACTIONS && (choice === "silence" || this.allowed(choice))) kind = choice;
|
|
13623
|
-
else if (choice && choice in CHANNEL_ACTIONS)
|
|
13923
|
+
else if (choice && choice in CHANNEL_ACTIONS) log30.debug(`decider chose ${choice} for a ${rule} moment \u2014 the rule stands`);
|
|
13624
13924
|
}
|
|
13625
13925
|
if (kind === "silence") return ev({ choice, acted: "silence" });
|
|
13626
13926
|
if (stale()) return ev({ choice, kind, acted: "stale" });
|
|
@@ -13652,15 +13952,28 @@ var SecondChannel = class {
|
|
|
13652
13952
|
/** Start writing this turn's bridge now, so it may be ready by bridgeDelayMs. The bridge never waits for it. */
|
|
13653
13953
|
prefetchBridge() {
|
|
13654
13954
|
this.bridgeDraft = null;
|
|
13655
|
-
|
|
13656
|
-
|
|
13657
|
-
|
|
13658
|
-
|
|
13659
|
-
|
|
13660
|
-
|
|
13661
|
-
|
|
13955
|
+
this.askLeaf = null;
|
|
13956
|
+
this.bridgeReady = Promise.resolve();
|
|
13957
|
+
if (!this.o.generate || !(this.ownWords || this.o.generateFor.includes("bridge")) || !this.lang || !this.heard || this.ownWords && turnIntent(this.heard) !== "ask" && !requestOpener(this.heard)) return;
|
|
13958
|
+
const gen = this.gen, ac = new AbortController(), own = this.ownWords, heard = this.heard;
|
|
13959
|
+
const ctx = { kind: "bridge", heard: this.tail(), state: this.main, avoid: [...this.recent], lang: this.lang, ...own ? { ask: true } : {} };
|
|
13960
|
+
this.bridgeReady = withBudget(this.o.generate(ctx, ac.signal), own ? this.o.bridgeBudgetMs : Math.max(this.o.generateBudgetMs, this.o.bridgeDelayMs), "bridge generate", ac).then((raw) => {
|
|
13961
|
+
const text = own && /^\s*none\b/i.test(raw ?? "") ? "" : cleanLine(raw ?? "", ctx.lang);
|
|
13962
|
+
if (text && gen === this.gen && (!own || echoesHeard(text, heard))) this.bridgeDraft = { gen, text };
|
|
13963
|
+
}).catch((e) => log30.debug(`bridge prefetch failed: ${e?.message ?? e}`));
|
|
13662
13964
|
}
|
|
13663
13965
|
async line(kind, react = true) {
|
|
13966
|
+
if (kind === "bridge" && this.ownWords) {
|
|
13967
|
+
const gen = this.gen;
|
|
13968
|
+
await Promise.all([this.leafReady, this.bridgeReady]);
|
|
13969
|
+
if (gen !== this.gen) return "";
|
|
13970
|
+
const leaf = this.askLeaf?.gen === gen ? this.askLeaf.text : "", d = this.bridgeDraft?.gen === gen ? this.bridgeDraft.text : "";
|
|
13971
|
+
if (leaf && !this.leaves.includes(leafKey(leaf))) {
|
|
13972
|
+
this.leaves = [...this.leaves, leafKey(leaf)].slice(-this.o.leafMemory);
|
|
13973
|
+
return leaf;
|
|
13974
|
+
}
|
|
13975
|
+
return d && !this.recent.some((r) => norm3(r) === norm3(d)) ? d : "";
|
|
13976
|
+
}
|
|
13664
13977
|
if (kind === "bridge" && this.o.instantBridge) {
|
|
13665
13978
|
const d = this.bridgeDraft?.gen === this.gen ? this.bridgeDraft.text : "";
|
|
13666
13979
|
this.bridgeDraft = null;
|
|
@@ -13674,13 +13987,14 @@ var SecondChannel = class {
|
|
|
13674
13987
|
if (raw === null) ac.abort();
|
|
13675
13988
|
const text = cleanLine(raw ?? "", this.lang);
|
|
13676
13989
|
if (text && !this.recent.some((r) => norm3(r) === norm3(text))) return text;
|
|
13677
|
-
if (text)
|
|
13990
|
+
if (text) log30.debug(`generated "${text}" repeats a recent line \u2014 canned`);
|
|
13678
13991
|
}
|
|
13679
13992
|
return this.pick(kind);
|
|
13680
13993
|
}
|
|
13681
13994
|
/** Canned rotation in the user's language: never one of the last `bankExclude` picks of this kind, nor a recent
|
|
13682
13995
|
* line. '' = no bank for this language yet (silence). */
|
|
13683
13996
|
pick(kind) {
|
|
13997
|
+
if (this.ownWords && kind !== "backchannel") return "";
|
|
13684
13998
|
const pool = this.bank?.[kind] ?? [];
|
|
13685
13999
|
if (!pool.length) return "";
|
|
13686
14000
|
const hist = this.picks.get(kind) ?? [];
|
|
@@ -13696,7 +14010,7 @@ var SecondChannel = class {
|
|
|
13696
14010
|
try {
|
|
13697
14011
|
r = this.o.speak(text, kind);
|
|
13698
14012
|
} catch (e) {
|
|
13699
|
-
|
|
14013
|
+
log30.warn(`speak threw \u2014 line dropped: ${e.message}`);
|
|
13700
14014
|
return false;
|
|
13701
14015
|
}
|
|
13702
14016
|
if (r === false) return false;
|
|
@@ -13710,7 +14024,7 @@ var SecondChannel = class {
|
|
|
13710
14024
|
if (words3) this.o.show(words3, kind);
|
|
13711
14025
|
const p = Promise.resolve(r).then(() => {
|
|
13712
14026
|
}, (e) => {
|
|
13713
|
-
|
|
14027
|
+
log30.warn(`channel line playback failed: ${e?.message ?? e}`);
|
|
13714
14028
|
}).finally(() => {
|
|
13715
14029
|
if (this.inflight === p) this.inflight = null;
|
|
13716
14030
|
});
|
|
@@ -13750,7 +14064,9 @@ var REACT_HINT = 'a short reaction to their LAST words instead: feeling ("oh no"
|
|
|
13750
14064
|
var TAG_HINT = 'Real listeners often react without words: the line may be, or begin with, [laughter] or [gasp], and [quiet] before words breathes them under the voice ("[gasp]", "[laughter]", "[gasp] [quiet] no way"). Use a sound when it fits what they said.';
|
|
13751
14065
|
function fastLineGenerator(ai, model, gender) {
|
|
13752
14066
|
return async (c, signal) => {
|
|
13753
|
-
const prompt =
|
|
14067
|
+
const prompt = c.ask ? `A live voice call. The user just said: "${c.heard}"
|
|
14068
|
+
If this asks you to look up, check, find or do something that takes a while, write ONE spoken line of 2-5 words in ${languageName(c.lang)} that names the thing in their own words and says you are on it ("Hacker News, one sec."). If it is small talk, a statement, or something you can answer at once, write: none
|
|
14069
|
+
${personaHint(gender)} Output only the line.` : `You voice the tiny side-sounds of a live spoken conversation. Write ONE line of 1-5 words: ${KIND_HINT2[c.kind]}.
|
|
13754
14070
|
` + (c.react ? `Here the line may be ${REACT_HINT}.
|
|
13755
14071
|
` : "") + (c.tags ? `${TAG_HINT}
|
|
13756
14072
|
` : "") + `The user just said: "${c.heard}"
|
|
@@ -13770,7 +14086,7 @@ function closedQuestion(reply) {
|
|
|
13770
14086
|
}
|
|
13771
14087
|
|
|
13772
14088
|
// src/voice/call.ts
|
|
13773
|
-
var
|
|
14089
|
+
var log31 = forComponent("VoiceCall");
|
|
13774
14090
|
var VoiceCallOptions = class {
|
|
13775
14091
|
/** Host runs MAIN with exactly `text` (a replace: roll the `replaces` turn back first). */
|
|
13776
14092
|
sendTurn = () => {
|
|
@@ -13845,7 +14161,7 @@ var VoiceCall = class {
|
|
|
13845
14161
|
cancel: () => o.cancel(),
|
|
13846
14162
|
now: o.now
|
|
13847
14163
|
});
|
|
13848
|
-
this.progress = new Progress({ ...ai ? { generate: fastProgressGenerator(ai, o.fastModel, o.gender) } : {}, gender: o.gender, now: o.now, ...o.progress });
|
|
14164
|
+
this.progress = new Progress({ ...o.mode === "live" ? { templates: {}, generateBudgetMs: 1500 } : {}, ...ai ? { generate: fastProgressGenerator(ai, o.fastModel, o.gender) } : {}, gender: o.gender, now: o.now, ...o.progress });
|
|
13849
14165
|
this.judge = new OverlapJudge({ ...ai ? { model: overlapModelFor(ai) } : {}, now: o.now });
|
|
13850
14166
|
this.gate = new TurnGate({
|
|
13851
14167
|
now: o.now,
|
|
@@ -13898,7 +14214,7 @@ var VoiceCall = class {
|
|
|
13898
14214
|
this.gate.speaking();
|
|
13899
14215
|
const c = this.cur;
|
|
13900
14216
|
if (this.o.mode === "live" && c?.running && !c.worded && text.trim().split(/\s+/).length >= 2) {
|
|
13901
|
-
|
|
14217
|
+
log31.debug("user resumed before the reply \u2014 yielded");
|
|
13902
14218
|
this.barge();
|
|
13903
14219
|
}
|
|
13904
14220
|
this.follow(text);
|
|
@@ -14002,7 +14318,7 @@ var VoiceCall = class {
|
|
|
14002
14318
|
try {
|
|
14003
14319
|
this.o.cancel();
|
|
14004
14320
|
} catch (e) {
|
|
14005
|
-
|
|
14321
|
+
log31.warn(`cancel threw: ${e.message}`);
|
|
14006
14322
|
}
|
|
14007
14323
|
if (this.cur?.running) {
|
|
14008
14324
|
this.cur.running = false;
|
|
@@ -14089,7 +14405,7 @@ var VoiceCall = class {
|
|
|
14089
14405
|
try {
|
|
14090
14406
|
r = this.o.speak(text, kind);
|
|
14091
14407
|
} catch (e) {
|
|
14092
|
-
|
|
14408
|
+
log31.warn(`speak threw: ${e.message}`);
|
|
14093
14409
|
return false;
|
|
14094
14410
|
}
|
|
14095
14411
|
if (r === false) return false;
|
|
@@ -14140,7 +14456,8 @@ var VoiceCall = class {
|
|
|
14140
14456
|
async onTool(c, name, args) {
|
|
14141
14457
|
const lang = this.lang;
|
|
14142
14458
|
if (!lang || c.streamed) return;
|
|
14143
|
-
const line = await this.progress.line(name, args, lang);
|
|
14459
|
+
const line = await this.progress.line(name, args, lang, this.o.mode === "live" ? c.text : "");
|
|
14460
|
+
if (!line && this.o.mode === "live") this.o.onMetric({ name: "drop", id: c.id, kind: `no progress line: ${name}` });
|
|
14144
14461
|
if (!line || this.cur !== c || c.streamed || !c.running || this.lang !== lang) return;
|
|
14145
14462
|
this.clearProgress();
|
|
14146
14463
|
const tryNow = () => {
|
|
@@ -14152,6 +14469,7 @@ var VoiceCall = class {
|
|
|
14152
14469
|
}
|
|
14153
14470
|
if (this.say(line, "progress") !== false) {
|
|
14154
14471
|
this.progress.spoke(line);
|
|
14472
|
+
this.fill.covered();
|
|
14155
14473
|
this.o.show(line, "progress");
|
|
14156
14474
|
}
|
|
14157
14475
|
};
|