@livx.cc/agentx 0.99.150 → 0.99.152

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/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-CJ1eYZKA.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-CJ1eYZKA.js';
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-BVmp2lze.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-BVmp2lze.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';
@@ -972,6 +972,10 @@ declare class TurnGateOptions {
972
972
  * 20261103-114604, "Okay." settled 700ms into "What will the…" and MAIN started, was aborted twice and merged. The
973
973
  * rest's final merges in; capped at this long from the hold (an STT that never finalizes a partial). */
974
974
  talkingMaxMs: number;
975
+ /** With settleMs: a final of acknowledgement words only ("Ok Okay.") waits this long. No answer is due, and it is
976
+ * mostly the start of the turn: live 20261103-210433, "Ok Okay." settled at 700ms, the rest began 1s after it, and
977
+ * MAIN was started and aborted. Quiet past this sends it as it was. */
978
+ openerMs: number;
975
979
  onTurn: (t: GateTurn) => void;
976
980
  onDrop: (text: string, why: GateDrop) => void;
977
981
  /** A final is being held (ends mid-phrase) — the fill channel may cover it with a filler, never a bridge. */
@@ -1010,6 +1014,9 @@ declare class TurnGate {
1010
1014
  replyStarted(id: string): void;
1011
1015
  /** Send a held fragment now (e.g. the call ends). */
1012
1016
  flush(): void;
1017
+ /** Only acknowledgement words ("Ok Okay.", "Alright.") and no goodbye: no answer is due, and it usually opens what
1018
+ * comes next. */
1019
+ private opener;
1013
1020
  end(): void;
1014
1021
  private refinal;
1015
1022
  private send;
@@ -1869,6 +1876,7 @@ declare class VoiceCall {
1869
1876
  lang?: string;
1870
1877
  }): void;
1871
1878
  private finalAt;
1879
+ private floor;
1872
1880
  private sttLang;
1873
1881
  /** The host's player started a line's audio now (or in `inMs`): `fill`/`progress` = the fill channel's, `main` = MAIN's
1874
1882
  * reply (as main({type:'audio'})). With hostAudio this is what first_sound counts. */
package/dist/index.js CHANGED
@@ -10442,12 +10442,14 @@ var LEADER = /* @__PURE__ */ new Set(["yeah", "yea", "yes", "yep", "yup", "ok",
10442
10442
  var PHRASES = ["got it", "i see", "makes sense", "of course", "for sure", "all right", "that's right", "that's true", "thats right", "thats true", "love it", "i know", "me too", "uh huh"];
10443
10443
  var CONTINUE = /^(?:(?:and|so|oh) )?(?:and|so|really|seriously|then what|and then|go on|keep going|ואז|באמת|נו)$/;
10444
10444
  var AGREE = new Set("yeah yea yes yep yup right sure true totally exactly definitely absolutely agreed correct indeed \u05DB\u05DF \u05E0\u05DB\u05D5\u05DF \u05D1\u05D3\u05D9\u05D5\u05E7 \u05D1\u05E8\u05D5\u05E8 \u05D1\u05D8\u05D7 \u05D0\u05DB\u05DF \u05DC\u05D2\u05DE\u05E8\u05D9 \u05DE\u05E1\u05DB\u05D9\u05DD \u05DE\u05E1\u05DB\u05D9\u05DE\u05D4 \u05DE\u05DE\u05E9".split(" "));
10445
+ var DOUBT = /^(?:(?:and|so|oh|wait|but) )*(?:really|seriously|are|is|was|were|do|does|did|you|no way|באמת|בטוח|בטוחה|רצינית?)(?=\s|$)/u;
10445
10446
  var AGREE_PHRASES = ["of course", "for sure", "that's right", "that's true", "thats right", "thats true", "makes sense", "i agree"];
10446
10447
  var HE_ACK = new Set("\u05DB\u05DF \u05E0\u05DB\u05D5\u05DF \u05D1\u05D3\u05D9\u05D5\u05E7 \u05D1\u05E8\u05D5\u05E8 \u05D1\u05D8\u05D7 \u05D0\u05DB\u05DF \u05DC\u05D2\u05DE\u05E8\u05D9 \u05DE\u05DE\u05E9 \u05D0\u05D5\u05E7\u05D9\u05D9 \u05D0\u05D5\u05E7\u05D9 \u05E1\u05D1\u05D1\u05D4 \u05D9\u05E4\u05D4 \u05DE\u05E2\u05D5\u05DC\u05D4 \u05D5\u05D5\u05D0\u05D5 \u05D0\u05D4\u05D4 \u05D0\u05D4 \u05D4\u05DE\u05DE \u05DE\u05DE\u05DE".split(" "));
10447
10448
  function cueKind(text) {
10448
10449
  const t = norm2(text);
10449
10450
  if (!t) return null;
10450
10451
  if (CONTINUE.test(t)) return "continue";
10452
+ if (/\?/.test(text) || DOUBT.test(t)) return null;
10451
10453
  let r = t;
10452
10454
  for (const p of AGREE_PHRASES) if (r.includes(p)) return "agree";
10453
10455
  r = r.split(/[\s-]+/).filter((w) => !LEAD.has(w)).join(" ");
@@ -11150,6 +11152,10 @@ var TurnGateOptions = class {
11150
11152
  * 20261103-114604, "Okay." settled 700ms into "What will the…" and MAIN started, was aborted twice and merged. The
11151
11153
  * rest's final merges in; capped at this long from the hold (an STT that never finalizes a partial). */
11152
11154
  talkingMaxMs = 6e3;
11155
+ /** With settleMs: a final of acknowledgement words only ("Ok Okay.") waits this long. No answer is due, and it is
11156
+ * mostly the start of the turn: live 20261103-210433, "Ok Okay." settled at 700ms, the rest began 1s after it, and
11157
+ * MAIN was started and aborted. Quiet past this sends it as it was. */
11158
+ openerMs = 2e3;
11153
11159
  onTurn = () => {
11154
11160
  };
11155
11161
  onDrop = () => {
@@ -11207,7 +11213,7 @@ var TurnGate = class {
11207
11213
  if (this.closed && isClosing(t)) return this.o.onDrop(t, "goodbye");
11208
11214
  const mid = endsMidPhrase(t);
11209
11215
  if (mid || this.o.settleMs && !/\?["')\]]*$/.test(t)) {
11210
- const ms = mid ? this.o.holdMs : this.o.settleMs;
11216
+ const ms = mid ? this.o.holdMs : this.o.settleMs && this.opener(t) ? Math.max(this.o.settleMs, this.o.openerMs) : this.o.settleMs;
11211
11217
  this.held = { text: t, sttId, ms, replaces, since: now3, timer: setTimeout(() => this.settle(), ms) };
11212
11218
  return this.o.onHold(t);
11213
11219
  }
@@ -11252,6 +11258,11 @@ var TurnGate = class {
11252
11258
  if (this.closed && isClosing(h.text)) return this.o.onDrop(h.text, "goodbye");
11253
11259
  this.send(h.text, norm3(h.text), h.sttId, "new", h.replaces);
11254
11260
  }
11261
+ /** Only acknowledgement words ("Ok Okay.", "Alright.") and no goodbye: no answer is due, and it usually opens what
11262
+ * comes next. */
11263
+ opener(t) {
11264
+ return turnIntent(t) === "closer" && !isClosing(t);
11265
+ }
11255
11266
  end() {
11256
11267
  if (this.held) {
11257
11268
  clearTimeout(this.held.timer);
@@ -13777,8 +13788,30 @@ function matchCue(plan, heard, from = 0) {
13777
13788
  return null;
13778
13789
  }
13779
13790
 
13791
+ // src/voice/fastText.ts
13792
+ init_logging();
13793
+ var log28 = forComponent("FastText");
13794
+ var isReasoningFast = (model) => /gpt-oss/.test(model);
13795
+ async function fastText(ai, o) {
13796
+ const reasons = isReasoningFast(o.model);
13797
+ const r = await ai.chat({
13798
+ model: o.model,
13799
+ messages: [{ role: "user", content: o.prompt }],
13800
+ stream: false,
13801
+ ...o.signal ? { signal: o.signal } : {},
13802
+ maxTokens: reasons ? Math.max(o.maxTokens ?? 0, 400) : o.maxTokens ?? 150,
13803
+ ...o.temperature !== void 0 ? { temperature: o.temperature } : {},
13804
+ ...reasons ? { providerOptions: { reasoning_effort: "low" } } : {}
13805
+ });
13806
+ if (reasons && r.finishReason === "length") {
13807
+ log28.debug(`${o.model} hit its token cap \u2014 no answer: ${(r.content ?? "").slice(0, 80)}`);
13808
+ return "";
13809
+ }
13810
+ return r.content ?? "";
13811
+ }
13812
+
13780
13813
  // src/voice/convoTree.ts
13781
- var log28 = forComponent("ConvoTree");
13814
+ var log29 = forComponent("ConvoTree");
13782
13815
  var SOFT_CUE = "~";
13783
13816
  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(" "));
13784
13817
  var isContent = (w) => w.length >= 4 && !STOP4.has(w);
@@ -13885,7 +13918,7 @@ var ConvoTree = class {
13885
13918
 
13886
13919
  // src/voice/progress.ts
13887
13920
  init_logging();
13888
- var log29 = forComponent("Progress");
13921
+ var log30 = forComponent("Progress");
13889
13922
  var HE_RESULT_CLAIM = /(?:^|\s)(?:מצאתי|סיימתי|בוצע|הנה|אין)(?=\s|$|[.,!…])/u;
13890
13923
  var PLUMBING = /toolsearch|^mcp__.*__(list_commands|call_info)$/;
13891
13924
  var isPlumbing = (tool) => PLUMBING.test(tool.toLowerCase());
@@ -14060,7 +14093,7 @@ var Progress = class {
14060
14093
  });
14061
14094
  const hint = argsHint(args) || about.slice(-80);
14062
14095
  const raw = await Promise.race([this.o.generate(tool, hint, lang, ac.signal, this.lines).catch((e) => {
14063
- log29.warn(`progress line failed: ${e?.message ?? e}`);
14096
+ log30.warn(`progress line failed: ${e?.message ?? e}`);
14064
14097
  return null;
14065
14098
  }), late]).finally(() => clearTimeout(t));
14066
14099
  const l = cleanLine(raw ?? "", lang, 5);
@@ -14071,9 +14104,7 @@ var Progress = class {
14071
14104
  function fastProgressGenerator(ai, model, gender) {
14072
14105
  return async (tool, hint, lang, signal, avoid = []) => {
14073
14106
  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.`;
14074
- const reasoning = /gpt-oss/.test(model) ? { providerOptions: { reasoning_effort: "low" } } : {};
14075
- const r = await ai.chat({ model, messages: [{ role: "user", content: prompt }], stream: false, signal, maxTokens: 150, ...reasoning });
14076
- return r.content ?? "";
14107
+ return fastText(ai, { model, prompt, signal });
14077
14108
  };
14078
14109
  }
14079
14110
  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;
@@ -14090,7 +14121,7 @@ function workAck(raw, lang, gender = "") {
14090
14121
 
14091
14122
  // src/voice/secondChannel.ts
14092
14123
  init_logging();
14093
- var log30 = forComponent("SecondChannel");
14124
+ var log31 = forComponent("SecondChannel");
14094
14125
  var CHANNEL_MODES = {
14095
14126
  turn: { kinds: ["bridge"], bridgeDelayMs: 1500 },
14096
14127
  normal: {},
@@ -14255,15 +14286,15 @@ function withBudget(p, ms, what, ac) {
14255
14286
  let t;
14256
14287
  const late = new Promise((r) => {
14257
14288
  t = setTimeout(() => {
14258
- log30.debug(`${what}: over the ${ms}ms budget \u2014 dropped`);
14289
+ log31.debug(`${what}: over the ${ms}ms budget \u2014 dropped`);
14259
14290
  ac?.abort();
14260
14291
  r(null);
14261
14292
  }, ms);
14262
14293
  });
14263
14294
  return Promise.race([p.catch((e) => {
14264
14295
  const msg = String(e?.message ?? e);
14265
- if (e?.name === "AbortError" || /aborted/i.test(msg)) log30.debug(`${what}: aborted after its budget`);
14266
- else log30.warn(`${what} failed \u2014 falling back: ${msg}`);
14296
+ if (e?.name === "AbortError" || /aborted/i.test(msg)) log31.debug(`${what}: aborted after its budget`);
14297
+ else log31.warn(`${what} failed \u2014 falling back: ${msg}`);
14267
14298
  return null;
14268
14299
  }), late]).finally(() => clearTimeout(t));
14269
14300
  }
@@ -14307,8 +14338,12 @@ var SecondChannel = class {
14307
14338
  // a bridge generated ahead, used only if ready in time
14308
14339
  bridgeReady = Promise.resolve();
14309
14340
  // live: that draft settled
14341
+ noLine = "";
14342
+ // live: why that draft gave no line
14310
14343
  askLeaf = null;
14311
14344
  // live: this turn's ask leaf
14345
+ barged = false;
14346
+ // the user cut in since their last turn: that turn is a steer, not a story to react to
14312
14347
  leafReady = Promise.resolve();
14313
14348
  // live: the turn-end leaf pick settled
14314
14349
  recent = [];
@@ -14364,7 +14399,7 @@ var SecondChannel = class {
14364
14399
  if (host) this.pinned = true;
14365
14400
  const lang = primaryLang(tag);
14366
14401
  if (!lang || lang === this.lang) return;
14367
- log30.debug(`language ${this.lang} \u2192 ${lang}`);
14402
+ log31.debug(`language ${this.lang} \u2192 ${lang}`);
14368
14403
  this.lang = lang;
14369
14404
  this.recent = [];
14370
14405
  this.picks.clear();
@@ -14514,6 +14549,16 @@ var SecondChannel = class {
14514
14549
  }, Math.max(late, wait + 1));
14515
14550
  }
14516
14551
  }
14552
+ /** The STT closed the user's line (a final that ends a sentence), before it is a turn (the host may still hold it): a
14553
+ * listener cue armed on its last words is late now. Replay of 20261103-210433: "oh wow" played 330ms after "…and
14554
+ * hacker news." while the gate held the turn, and spaced the request's own line to 1.5s. */
14555
+ onLineEnd() {
14556
+ this.userSpeaking = false;
14557
+ for (const k of ["bcTimer", "leafTimer", "breathTimer"]) {
14558
+ if (this[k]) clearTimeout(this[k]);
14559
+ this[k] = null;
14560
+ }
14561
+ }
14517
14562
  /** The user's final line was dispatched to the main agent (its words are the bridge's micro-context). */
14518
14563
  onUserTurn(text, lastWordAgoMs = 0) {
14519
14564
  this.heard = text.trim();
@@ -14523,9 +14568,11 @@ var SecondChannel = class {
14523
14568
  this.detect(this.heard);
14524
14569
  this.main = "idle";
14525
14570
  this.onAgentState("queued");
14571
+ const steer = this.barged;
14572
+ this.barged = false;
14526
14573
  if (this.tree) {
14527
14574
  this.noteTalk("them", this.heard);
14528
- this.leafReady = this.turnEndLeaf();
14575
+ this.leafReady = this.turnEndLeaf(steer);
14529
14576
  }
14530
14577
  }
14531
14578
  /** The main answer's streamed text (before its audio): channel-1 is responding — no bridge from here on. */
@@ -14540,13 +14587,14 @@ var SecondChannel = class {
14540
14587
  /** The user barged in: cut the in-flight line now and drop every pending decision. */
14541
14588
  onBargeIn() {
14542
14589
  this.gen++;
14590
+ this.barged = true;
14543
14591
  this.cutLine = this.inflight || this.live ? this.live : null;
14544
14592
  if (this.inflight) {
14545
14593
  this.inflight = null;
14546
14594
  try {
14547
14595
  this.o.cancel();
14548
14596
  } catch (e) {
14549
- log30.warn(`cancel threw: ${e.message}`);
14597
+ log31.warn(`cancel threw: ${e.message}`);
14550
14598
  }
14551
14599
  }
14552
14600
  }
@@ -14656,7 +14704,7 @@ var SecondChannel = class {
14656
14704
  if (r.nodes.length) tree.grow(r.nodes, this.userSpeaking ? words2(this.heard).length : 0);
14657
14705
  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 } : {} });
14658
14706
  }, (e) => {
14659
- log30.warn(`tree failed: ${e?.message ?? e}`);
14707
+ log31.warn(`tree failed: ${e?.message ?? e}`);
14660
14708
  this.o.onTree({ ms: Math.round(this.o.now() - t0), branches: 0, error: String(e?.message ?? e) });
14661
14709
  }).finally(() => {
14662
14710
  clearTimeout(late);
@@ -14697,7 +14745,7 @@ var SecondChannel = class {
14697
14745
  }
14698
14746
  /** 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
14699
14747
  * MAIN is still silent, as the turn's first sound. */
14700
- async turnEndLeaf() {
14748
+ async turnEndLeaf(steer = false) {
14701
14749
  const tree = this.tree, gen = this.gen, heard = this.heard;
14702
14750
  let hit = tree.turnLeaf();
14703
14751
  if (!hit && this.o.pickLeaf && !tree.empty) {
@@ -14710,6 +14758,7 @@ var SecondChannel = class {
14710
14758
  if (gen === this.gen && echoesHeard(hit.node.line, heard)) this.askLeaf = { gen, text: hit.node.line };
14711
14759
  return;
14712
14760
  }
14761
+ if (hit && (steer || turnIntent(heard) === "ask")) return;
14713
14762
  if (hit && gen === this.gen && (this.main === "queued" || this.main === "thinking")) {
14714
14763
  this.playLeaf(hit, "working", "bridge");
14715
14764
  if (this.lastKind === "bridge" && this.bridged) {
@@ -14764,7 +14813,7 @@ var SecondChannel = class {
14764
14813
  const opts = this.options;
14765
14814
  if (opts.mode === "chatty" && !opts.aec && !this.degradedLogged) {
14766
14815
  this.degradedLogged = true;
14767
- log30.info("chatty mode without echo cancellation \u2014 normal timing (our lines would re-trigger the mic)");
14816
+ log31.info("chatty mode without echo cancellation \u2014 normal timing (our lines would re-trigger the mic)");
14768
14817
  }
14769
14818
  const rule = this.rule(trigger, pauseMs, breath, cue);
14770
14819
  if (rule === "silence") {
@@ -14783,14 +14832,14 @@ var SecondChannel = class {
14783
14832
  const d = await withBudget(this.o.decide(this.tail(), { ...this.state(pauseMs), rule }, ac.signal), this.o.decisionBudgetMs, "channel decision", ac);
14784
14833
  choice = d?.choice;
14785
14834
  if (choice && choice in CHANNEL_ACTIONS && (choice === "silence" || this.allowed(choice))) kind = choice;
14786
- else if (choice && choice in CHANNEL_ACTIONS) log30.debug(`decider chose ${choice} for a ${rule} moment \u2014 the rule stands`);
14835
+ else if (choice && choice in CHANNEL_ACTIONS) log31.debug(`decider chose ${choice} for a ${rule} moment \u2014 the rule stands`);
14787
14836
  }
14788
14837
  if (kind === "silence") return ev({ choice, acted: "silence" });
14789
14838
  if (stale()) return ev({ choice, kind, acted: "stale" });
14790
14839
  if (!this.allowed(kind)) return ev({ choice, kind, acted: "gated" });
14791
14840
  const react = kind === "backchannel" && !this.answeringUs && this.o.now() - this.lastReactAt >= this.o.reactionGapMs;
14792
14841
  const text = cue && react && !this.recent.some((r) => norm3(r) === norm3(cue.line)) ? cue.line : await this.line(kind, react);
14793
- if (!text) return ev({ choice, kind, acted: "no_bank" });
14842
+ if (!text) return ev({ choice, kind, acted: "no_bank", ...kind === "bridge" && this.ownWords ? { reason: this.noLine || (gen !== this.gen ? "turn moved on" : "no line") } : {} });
14794
14843
  if (stale()) return ev({ choice, kind, text, acted: "stale" });
14795
14844
  if (!this.allowed(kind)) return ev({ choice, kind, text, acted: "gated" });
14796
14845
  const said = this.say(kind, text);
@@ -14817,13 +14866,15 @@ var SecondChannel = class {
14817
14866
  this.bridgeDraft = null;
14818
14867
  this.askLeaf = null;
14819
14868
  this.bridgeReady = Promise.resolve();
14869
+ this.noLine = "";
14820
14870
  if (!this.o.generate || !(this.ownWords || this.o.generateFor.includes("bridge")) || !this.lang || !this.heard) return;
14821
14871
  const gen = this.gen, ac = new AbortController(), own = this.ownWords, heard = this.heard;
14822
14872
  const ctx = { kind: "bridge", heard: this.tail(), state: this.main, avoid: [...this.recent], lang: this.lang, ...own ? { ask: true } : {} };
14823
14873
  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) => {
14824
- const text = own && /^\s*none\b/i.test(raw ?? "") ? "" : cleanLine(raw ?? "", ctx.lang);
14825
- if (text && gen === this.gen && (!own || echoesHeard(text, heard))) this.bridgeDraft = { gen, text };
14826
- }).catch((e) => log30.debug(`bridge prefetch failed: ${e?.message ?? e}`));
14874
+ const none = own && /^\s*none\b/i.test(raw ?? ""), text = none ? "" : cleanLine(raw ?? "", ctx.lang), echoes = !own || echoesHeard(text, heard);
14875
+ if (text && gen === this.gen && echoes) this.bridgeDraft = { gen, text };
14876
+ else if (gen === this.gen) this.noLine = raw === null ? "fast model late or failed" : none ? "fast model: none" : !text ? "fast model line unusable" : "line names nothing heard";
14877
+ }).catch((e) => log31.debug(`bridge prefetch failed: ${e?.message ?? e}`));
14827
14878
  }
14828
14879
  async line(kind, react = true) {
14829
14880
  if (kind === "bridge" && this.ownWords) {
@@ -14850,7 +14901,7 @@ var SecondChannel = class {
14850
14901
  if (raw === null) ac.abort();
14851
14902
  const text = cleanLine(raw ?? "", this.lang);
14852
14903
  if (text && !this.recent.some((r) => norm3(r) === norm3(text))) return text;
14853
- if (text) log30.debug(`generated "${text}" repeats a recent line \u2014 canned`);
14904
+ if (text) log31.debug(`generated "${text}" repeats a recent line \u2014 canned`);
14854
14905
  }
14855
14906
  return this.pick(kind);
14856
14907
  }
@@ -14874,7 +14925,7 @@ var SecondChannel = class {
14874
14925
  try {
14875
14926
  r = this.o.speak(text, kind);
14876
14927
  } catch (e) {
14877
- log30.warn(`speak threw \u2014 line dropped: ${e.message}`);
14928
+ log31.warn(`speak threw \u2014 line dropped: ${e.message}`);
14878
14929
  return false;
14879
14930
  }
14880
14931
  if (r === false) return false;
@@ -14888,7 +14939,7 @@ var SecondChannel = class {
14888
14939
  if (words3) this.o.show(words3, kind);
14889
14940
  const p = Promise.resolve(r).then(() => {
14890
14941
  }, (e) => {
14891
- log30.warn(`channel line playback failed: ${e?.message ?? e}`);
14942
+ log31.warn(`channel line playback failed: ${e?.message ?? e}`);
14892
14943
  }).finally(() => {
14893
14944
  if (this.inflight === p) this.inflight = null;
14894
14945
  });
@@ -14937,9 +14988,7 @@ ${personaHint(gender)} Output only the line.` : `You voice the tiny side-sounds
14937
14988
  The assistant is: ${c.state}.
14938
14989
  ` + (c.avoid.length ? `Do not reuse any of: ${c.avoid.map((a) => `"${a}"`).join(", ")}.
14939
14990
  ` : "") + `React to their actual words, casually, in ${languageName(c.lang)}. ${personaHint(gender)} Output only the line.`;
14940
- const reasoning = /gpt-oss/.test(model) ? { providerOptions: { reasoning_effort: "low" } } : {};
14941
- const r = await ai.chat({ model, messages: [{ role: "user", content: prompt }], stream: false, signal, maxTokens: 150, ...reasoning });
14942
- return r.content ?? "";
14991
+ return fastText(ai, { model, prompt, signal });
14943
14992
  };
14944
14993
  }
14945
14994
  function closedQuestion(reply) {
@@ -14950,7 +14999,7 @@ function closedQuestion(reply) {
14950
14999
  }
14951
15000
 
14952
15001
  // src/voice/call.ts
14953
- var log31 = forComponent("VoiceCall");
15002
+ var log32 = forComponent("VoiceCall");
14954
15003
  function newWords(text, turn) {
14955
15004
  const said = new Set(norm3(turn).split(" "));
14956
15005
  return norm3(text).split(" ").filter((w) => w && !said.has(w)).length;
@@ -15105,7 +15154,7 @@ var VoiceCall = class {
15105
15154
  const c = this.cur, steers = !!this.o.noteTurn && this.working;
15106
15155
  const resumed = !steers || c.marks.mainFirst === void 0 && this.o.now() - c.at < this.o.resumeMs;
15107
15156
  if (this.o.mode === "live" && c?.running && !c.worded && resumed && newWords(text, c.text) >= 2) {
15108
- log31.debug("user resumed before the reply \u2014 yielded");
15157
+ log32.debug("user resumed before the reply \u2014 yielded");
15109
15158
  this.giveWay(c);
15110
15159
  this.gate.reopen(c.id);
15111
15160
  }
@@ -15124,9 +15173,13 @@ var VoiceCall = class {
15124
15173
  this.sttLang = o.lang ? primaryLang(o.lang) : null;
15125
15174
  this.lastWordAt = typeof lastWordAgoMs === "number" && lastWordAgoMs >= 0 ? now3 - lastWordAgoMs : null;
15126
15175
  this.finalAt = now3;
15176
+ this.floor = `${this.floor} ${text}`.trim();
15177
+ if (!endsMidPhrase(text) && turnIntent(this.floor) !== "say") this.fill.onLineEnd();
15127
15178
  this.gate.final(text, sttId);
15128
15179
  }
15129
15180
  finalAt = 0;
15181
+ floor = "";
15182
+ // the finals said since the last turn went out
15130
15183
  sttLang = null;
15131
15184
  // the STT's language for the final being followed
15132
15185
  /** The host's player started a line's audio now (or in `inMs`): `fill`/`progress` = the fill channel's, `main` = MAIN's
@@ -15226,7 +15279,7 @@ var VoiceCall = class {
15226
15279
  try {
15227
15280
  this.o.cancel();
15228
15281
  } catch (e) {
15229
- log31.warn(`cancel threw: ${e.message}`);
15282
+ log32.warn(`cancel threw: ${e.message}`);
15230
15283
  }
15231
15284
  return;
15232
15285
  }
@@ -15238,7 +15291,7 @@ var VoiceCall = class {
15238
15291
  try {
15239
15292
  this.o.cancel();
15240
15293
  } catch (e) {
15241
- log31.warn(`cancel threw: ${e.message}`);
15294
+ log32.warn(`cancel threw: ${e.message}`);
15242
15295
  }
15243
15296
  if (c?.running) {
15244
15297
  c.running = false;
@@ -15290,6 +15343,7 @@ var VoiceCall = class {
15290
15343
  if (l) this.fill.setLanguage(l, true);
15291
15344
  }
15292
15345
  onTurn(t) {
15346
+ this.floor = "";
15293
15347
  if (this.o.noteTurn && this.o.workReply && t.kind !== "replace" && this.working && !isClosing(t.text)) return void this.overWork(this.cur, t);
15294
15348
  const now3 = this.o.now(), lastWord = this.lastWordAt !== null;
15295
15349
  const at = this.lastWordAt ?? this.firstFinalAt ?? now3;
@@ -15316,6 +15370,7 @@ var VoiceCall = class {
15316
15370
  this.firstFinalAt = null;
15317
15371
  this.lastWordAt = null;
15318
15372
  this.earlyHeard = null;
15373
+ this.floor = "";
15319
15374
  }
15320
15375
  this.o.onMetric({ name: "drop", kind: why, text });
15321
15376
  }
@@ -15326,7 +15381,7 @@ var VoiceCall = class {
15326
15381
  try {
15327
15382
  r = this.o.speak(text, kind);
15328
15383
  } catch (e) {
15329
- log31.warn(`speak threw: ${e.message}`);
15384
+ log32.warn(`speak threw: ${e.message}`);
15330
15385
  return false;
15331
15386
  }
15332
15387
  if (r === false) return false;
@@ -15386,10 +15441,12 @@ var VoiceCall = class {
15386
15441
  this.o.onMetric({ name: "turn", id: t.id, kind: "aside", text: t.text });
15387
15442
  const ac = new AbortController(), late = setTimeout(() => ac.abort(), this.o.workReplyBudgetMs), lang = this.lang;
15388
15443
  const raw = lang ? await this.o.workReply({ request: c.text, heard: t.text, tool: c.tool, hint: argsHint(c.args), lang, avoid: this.progress.recent }, ac.signal).catch((e) => {
15389
- log31.warn(`work reply failed \u2014 MAIN only: ${e?.message ?? e}`);
15444
+ log32.warn(`work reply failed \u2014 MAIN only: ${e?.message ?? e}`);
15390
15445
  return "";
15391
15446
  }).finally(() => clearTimeout(late)) : "";
15392
- 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);
15447
+ const own = cleanWorkReply(raw, lang ?? ""), answer = own || workAck(raw, lang ?? "", this.o.gender);
15448
+ const line = own || (this.o.mode === "live" ? "" : answer);
15449
+ const stop = /^\s*stop\s*:/i.test(raw), change = !answer || /^\s*work\s*:/i.test(raw);
15393
15450
  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.]`;
15394
15451
  if (line && !this.ended) {
15395
15452
  for (let i = 0; i < 8 && this.say(line, "aside") === false; i++) {