@burdenoff/fe-libs 2026.1118.5 → 2026.1118.7

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.
Files changed (31) hide show
  1. package/dist/shared/assistant/avatar/live/createLiveAvatarSeam.js +8 -6
  2. package/dist/shared/assistant/speech/hostedTtsSpeechEngine.js +37 -27
  3. package/dist/shared/assistant/speech/index.d.ts +1 -1
  4. package/dist/shared/assistant/speech/notifyCancellationSpeechEngine.d.ts +14 -1
  5. package/dist/shared/assistant/speech/notifyCancellationSpeechEngine.js +3 -0
  6. package/dist/shared/assistant/speech/routingSpeechEngine.js +4 -4
  7. package/dist/shared/assistant/speech/speechFeed.d.ts +20 -3
  8. package/dist/shared/assistant/speech/speechFeed.js +25 -17
  9. package/dist/shared/assistant/speech/types.d.ts +68 -1
  10. package/dist/shared/assistant/speech/types.js +7 -2
  11. package/dist/shared/assistant/turnTimeline.d.ts +32 -0
  12. package/dist/shared/assistant/turnTimeline.js +3 -3
  13. package/dist/shared/assistant/ui/AIAssistantPanel.js +152 -152
  14. package/dist/shared/assistant/ui/AssistantChatArea.js +1228 -1227
  15. package/dist/shared/assistant/ui/AssistantSpeechProvider.d.ts +5 -3
  16. package/dist/shared/assistant/ui/AssistantSpeechProvider.js +393 -346
  17. package/dist/shared/assistant/ui/compact/AssistantCompactHeader.d.ts +9 -0
  18. package/dist/shared/assistant/ui/compact/AssistantCompactHeader.js +62 -52
  19. package/dist/shared/assistant/ui/compact/AssistantWindowHeader.js +29 -35
  20. package/dist/shared/assistant/ui/compact/windowTitle.d.ts +32 -9
  21. package/dist/shared/assistant/ui/compact/windowTitle.js +31 -6
  22. package/dist/shared/assistant/voice/firstClipPrefetchConfig.d.ts +19 -0
  23. package/dist/shared/assistant/voice/firstClipPrefetchConfig.js +8 -1
  24. package/dist/shared/assistant/voice/livePhraseSpeech.d.ts +23 -0
  25. package/dist/shared/assistant/voice/livePhraseSpeech.js +30 -30
  26. package/dist/shared/assistant/voice/phraseGate.d.ts +13 -0
  27. package/dist/shared/assistant/voice/phraseGate.js +6 -2
  28. package/dist/shared/assistant/voice/phrasePlayback.d.ts +59 -0
  29. package/dist/shared/assistant/voice/phrasePlayback.js +56 -34
  30. package/dist/shared-assistant.js +418 -418
  31. package/package.json +1 -1
@@ -5,5 +5,64 @@ export interface PhrasePlayback {
5
5
  retract(): void;
6
6
  cancel(): void;
7
7
  }
8
+ /**
9
+ * The chunks of a reply's FIRST append, while nothing has been accepted yet:
10
+ * the voice reply's one first-piece rule (`voiceFirstPieceOptions`). ★ P1 fix 2
11
+ * (BOFF-12936): the production hold releases every phrase of the answer's step
12
+ * in one append, and a fast alpha stream two or three; packed whole, their first
13
+ * piece was not the one fetched early, and the early clip was paid for and
14
+ * thrown away. With P1 off this is the short first segment alone, as before.
15
+ */
16
+ export declare function firstAppendChunks(text: string): string[];
17
+ /** Which route will speak a reply first, as the first clip's guard predicts it. */
18
+ export type PhraseRoutePrediction =
19
+ /** The narrator's first release: the phrase queue's first piece, and its locale. */
20
+ {
21
+ readonly route: 'phrase';
22
+ readonly locale: string;
23
+ readonly piece: string;
24
+ }
25
+ /** The narrator will release nothing: the reply is read whole at its publish. */
26
+ | {
27
+ readonly route: 'speak';
28
+ };
29
+ /**
30
+ * ★★ P1 fix 3 (BOFF-12936): the first piece the PHRASE route will speak for an
31
+ * answer still being written (`markdown`, as the person sees it; `visible`,
32
+ * the bubble's text the narrator checks), with its locale; null while that
33
+ * cannot be known yet.
34
+ *
35
+ * The narrator (`createLivePhraseSpeech`) releases first:
36
+ * - on alpha, the first completed phrase: alone (once a second one completes,
37
+ * or after `NARRATION_HOLD_MS`), or with the next ones (on a fast stream, or
38
+ * every phrase still held when the step completes);
39
+ * - under the production hold (`holdForFinalAnswer`), every phrase of the
40
+ * answer's step at once, when the step completes.
41
+ * Its phrases are `phraseCandidates`, whose rules are not the chunker's: a
42
+ * filler ("Sure.") is dropped, "approx.", "min." or "No." end a phrase, and a
43
+ * list, a table or a code block is withheld, so the phrases released at the
44
+ * step's end may join a closing line written after one. `render` must turn
45
+ * the released phrases into their locale and spoken text exactly as the
46
+ * provider's append path does; the piece is then the first chunk of the
47
+ * queue's first append (`firstAppendChunks`).
48
+ *
49
+ * ★★ P1 review (BOFF-12936):
50
+ * - Null until the first piece of the phrases so far, JOINED, is final
51
+ * (`firstPieceFinal`), in both modes: a later phrase (the closing line after
52
+ * a list, or one the step's end releases with the first) must not be able to
53
+ * pack into it. A short intro followed by a list and a short closing line
54
+ * used to be predicted as the intro alone, and the clip went unused.
55
+ * - `speak` when a phrase so far is not on screen as it would be spoken
56
+ * (`phrasesShown`, the narrator's own check: an e-mail address or a bare URL
57
+ * in it). The narrator then stops before any release (on alpha at once,
58
+ * under the hold at the step's end), and the reply is read whole at its
59
+ * publish, so its first piece is the speak route's. A new source re-arms the
60
+ * narrator (a new text part on alpha, a new step under the hold): the same
61
+ * bet as narration before a tool (first-clip-prefetch.md, known content bets).
62
+ */
63
+ export declare function phraseRouteFirstPiece(markdown: string, visible: string, holdForFinalAnswer: boolean, render: (phrases: string) => {
64
+ locale: string;
65
+ text: string;
66
+ }): PhraseRoutePrediction | null;
8
67
  /** One reply, one engine request. Buffer text only; synthesis stays one ahead. */
9
68
  export declare function createPhrasePlayback(open: (handlers: SpeechSpeakHandlers) => SpeechQueue, handlers: SpeechSpeakHandlers, changed: (chunks: readonly string[]) => void, divergence: () => void): PhrasePlayback;
@@ -1,71 +1,93 @@
1
- import { MAX_SPEAKABLE_CHARS as e, chunkForSpeech as t } from "./speakableText.js";
2
- import { unspokenFinal as n } from "./phraseGate.js";
1
+ import { voiceFirstPieceOptions as e } from "./firstClipPrefetchConfig.js";
2
+ import { MAX_SPEAKABLE_CHARS as t, chunkForSpeech as n } from "./speakableText.js";
3
+ import { phraseCandidates as r, phrasesShown as i, unspokenFinal as a } from "./phraseGate.js";
3
4
  // src/shared/assistant/voice/phrasePlayback.ts
4
- function r(r, i, a, o) {
5
- let s = [], c = [], l = 0, u = !1, d = !1, f = !1, p = !1, m = !1, h = r({
5
+ function o(t) {
6
+ return n(t, void 0, void 0, e());
7
+ }
8
+ var s = "4 more.";
9
+ function c(e) {
10
+ let t = o(e)[0];
11
+ return t !== void 0 && t === o(`${e} ${s}`)[0];
12
+ }
13
+ function l(e, t, n, a) {
14
+ let s = r(e), l = s[0];
15
+ if (l === void 0) return null;
16
+ if (!i(s, t)) return { route: "speak" };
17
+ let u = a(s.join(" "));
18
+ if (!c(u.text)) return null;
19
+ let { locale: d, text: f } = n ? u : a(l), p = o(f)[0];
20
+ return p === void 0 ? null : {
21
+ route: "phrase",
22
+ locale: d,
23
+ piece: p
24
+ };
25
+ }
26
+ function u(e, r, i, s) {
27
+ let c = [], l = [], u = 0, d = !1, f = !1, p = !1, m = !1, h = !1, g = e({
6
28
  onStart: () => {
7
- p || i.onStart?.();
29
+ m || r.onStart?.();
8
30
  },
9
31
  onChunkStart: (e) => {
10
- p || i.onChunkStart?.(e);
32
+ m || r.onChunkStart?.(e);
11
33
  },
12
34
  onPause: () => {
13
- p || i.onPause?.();
35
+ m || r.onPause?.();
14
36
  },
15
37
  onDeviceFallback: () => {
16
- p || i.onDeviceFallback?.();
38
+ m || r.onDeviceFallback?.();
17
39
  },
18
40
  onChunkEnd(e) {
19
- p || (g(), i.onChunkEnd?.(e));
41
+ m || (_(), r.onChunkEnd?.(e));
20
42
  },
21
43
  onRetract(e) {
22
- if (!p) {
23
- for (let t of e) s[t] = "";
24
- a([...s]), i.onRetract?.(e);
44
+ if (!m) {
45
+ for (let t of e) c[t] = "";
46
+ i([...c]), r.onRetract?.(e);
25
47
  }
26
48
  },
27
49
  onEnd() {
28
- p || (p = !0, i.onEnd?.());
50
+ m || (m = !0, r.onEnd?.());
29
51
  },
30
52
  onError(e) {
31
- p || (p = !0, c = [], i.onError?.(e));
53
+ m || (m = !0, l = [], r.onError?.(e));
32
54
  }
33
55
  });
34
- function g() {
35
- if (!(m || p)) {
36
- m = !0;
56
+ function _() {
57
+ if (!(h || m)) {
58
+ h = !0;
37
59
  try {
38
- for (; c.length && !p && (d || !s.some(Boolean) || c.length > 1);) {
39
- let e = c[0];
40
- if (s.push(e), a([...s]), !h.append([e])) {
41
- s.pop(), a([...s]);
60
+ for (; l.length && !m && (f || !c.some(Boolean) || l.length > 1);) {
61
+ let e = l[0];
62
+ if (c.push(e), i([...c]), !g.append([e])) {
63
+ c.pop(), i([...c]);
42
64
  break;
43
65
  }
44
- c.shift();
66
+ l.shift();
45
67
  }
46
- d && !c.length && !p && !f && (f = !0, h.end());
68
+ f && !l.length && !m && !p && (p = !0, g.end());
47
69
  } finally {
48
- m = !1;
70
+ h = !1;
49
71
  }
50
72
  }
51
73
  }
52
- let _ = (e) => t(e, void 0, void 0, { ...s.some(Boolean) ? { packFirstChunk: !0 } : { firstChunkMaxChars: 110 } });
74
+ let v = (e) => c.some(Boolean) ? n(e, void 0, void 0, { packFirstChunk: !0 }) : o(e);
53
75
  return {
54
76
  append(e) {
55
- d || p || u || (l + e.length > 8e3 ? u = !0 : (l += e.length, c = _([...c, e].filter(Boolean).join(" ")), g()));
77
+ f || m || d || (u + e.length > 8e3 ? d = !0 : (u += e.length, l = v([...l, e].filter(Boolean).join(" ")), _()));
56
78
  },
57
- finish(t) {
58
- if (d || p) return;
59
- d = !0;
60
- let r = n(t.slice(0, e), [...s, ...c]);
61
- r.diverged && o(), c = _([...c, r.text].filter(Boolean).join(" ")), g();
79
+ finish(e) {
80
+ if (f || m) return;
81
+ f = !0;
82
+ let n = a(e.slice(0, t), c);
83
+ n.diverged && s(), l = v(n.text), _();
62
84
  },
63
85
  retract() {
64
- d || p || (c = [], h.retract());
86
+ f || m || (l = [], g.retract());
65
87
  },
66
88
  cancel() {
67
- p = !0, c = [], h.cancel();
89
+ m = !0, l = [], g.cancel();
68
90
  }
69
91
  };
70
92
  }
71
- export { r as createPhrasePlayback };
93
+ export { u as createPhrasePlayback, o as firstAppendChunks, l as phraseRouteFirstPiece };