@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
@@ -23,6 +23,15 @@ export interface AssistantCompactHeaderProps {
23
23
  * The compact presentation's header (BOFF-10177, Slice 2):
24
24
  * `[☰] [✦] title / context ………… [Preview] [⋯] [Expand] [×]`.
25
25
  *
26
+ * ★ BOFF-15066 (the operator, 17 Nov: "use product name in the big panel too"): the title is the product's own name,
27
+ * "<Product> Assistant", the words the Quick window shows, so one product's assistant has one name wherever it opens.
28
+ * `header.title` stays for a product the catalog does not know, and in the classic header, which is unchanged (where
29
+ * FluidGrids and HealthyBowl keep "FluidGrids AI" and "HealthyBowl AI"). The name is fitted beside the controls: 16 px,
30
+ * else 15, else 14 px; then, only where even 14 px does not fit (every name on a 320 px phone, and Spanish's longer
31
+ * "Asistente de …"), without the brand tile, whose 44 px (its 4 px lead-in, 28 px tile and 12 px gap) go to the name.
32
+ * `truncate`, whose tooltip says the name whole, is the last resort (measured in Chromium, a pixel at a time from 320
33
+ * to 430 px: `scripts/assistant-welcome-browser-run.mjs`).
34
+ *
26
35
  * ★ What it does NOT carry, on purpose: no "Ready" line (D4), no New
27
36
  * conversation or History button (both live in ☰), and no Dock/Float toggle
28
37
  * (D13: Panel layout lives only in ☰ → Settings). Each is still reachable; see
@@ -2,82 +2,92 @@ import { useAssistantTr as e } from "../../i18n.js";
2
2
  import { useAssistantPreview as t } from "../../preview/context.js";
3
3
  import { hasAssistantPreviewSurface as n } from "../../preview/types.js";
4
4
  import { assistantPageLabelKey as r, translateProductCopy as i } from "../../productCopy.js";
5
- import { Eye as a, Maximize2 as o, Menu as s, Minimize2 as c, Sparkles as l, X as u } from "lucide-react";
6
- import { jsx as d, jsxs as f } from "react/jsx-runtime";
5
+ import { useAssistantProductTitle as a, useFittedAssistantTitle as o } from "./windowTitle.js";
6
+ import { useRef as s } from "react";
7
+ import { Eye as c, Maximize2 as l, Menu as u, Minimize2 as d, Sparkles as f, X as p } from "lucide-react";
8
+ import { jsx as m, jsxs as h } from "react/jsx-runtime";
7
9
  // src/shared/assistant/ui/compact/AssistantCompactHeader.tsx
8
- var p = "flex size-10 shrink-0 items-center justify-center rounded-button transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]", m = "text-text-secondary hover:bg-bg-sunken hover:text-text-primary", h = "bg-action-primary-bg/15 text-action-primary-bg", g = ({ contextLabel: g, menuOpen: _, menuViewId: v, onOpenMenu: y, menuButtonRef: b, conversationMenu: x, expandOffered: S, expanded: C, onToggleExpanded: w, onTogglePreview: T, previewOpen: E, onClose: D }) => {
9
- let O = e(), k = t();
10
- return /* @__PURE__ */ f("div", {
10
+ var g = "flex size-10 shrink-0 items-center justify-center rounded-button transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]", _ = "text-text-secondary hover:bg-bg-sunken hover:text-text-primary", v = "bg-action-primary-bg/15 text-action-primary-bg", y = ({ contextLabel: t }) => {
11
+ let n = e(), c = a() ?? n("header.title", "AI Assistant"), l = s(null), u = s(null);
12
+ return o(l, c, u), /* @__PURE__ */ h("div", {
13
+ className: "flex min-h-7 min-w-0 flex-1 items-center gap-3",
14
+ children: [/* @__PURE__ */ m("span", {
15
+ ref: u,
16
+ className: "ms-1 flex size-7 flex-shrink-0 items-center justify-center rounded-lg bg-gradient-to-br from-action-primary-bg/25 to-action-primary-bg/5 text-action-primary-bg data-[dropped]:hidden",
17
+ "data-testid": "assistant-header-mark",
18
+ children: /* @__PURE__ */ m(f, {
19
+ className: "size-4",
20
+ "aria-hidden": "true"
21
+ })
22
+ }), /* @__PURE__ */ h("span", {
23
+ className: "min-w-0 flex-1",
24
+ children: [/* @__PURE__ */ m("span", {
25
+ ref: l,
26
+ className: "block truncate text-base font-semibold leading-5 text-text-primary data-[tight]:text-[15px] data-[tighter]:text-sm",
27
+ title: c,
28
+ "data-testid": "assistant-header-title",
29
+ children: c
30
+ }), t ? /* @__PURE__ */ m("span", {
31
+ className: "mt-0.5 block truncate text-xs leading-tight text-text-muted",
32
+ children: n("header.context", "Context: {{page}}", { page: i(n, r(t), t) })
33
+ }) : null]
34
+ })]
35
+ });
36
+ }, b = ({ contextLabel: r, menuOpen: i, menuViewId: a, onOpenMenu: o, menuButtonRef: s, conversationMenu: f, expandOffered: b, expanded: x, onToggleExpanded: S, onTogglePreview: C, previewOpen: w, onClose: T }) => {
37
+ let E = e(), D = t();
38
+ return /* @__PURE__ */ h("div", {
11
39
  className: "flex min-h-14 items-center gap-0.5 border-b border-border-default bg-bg-elevated px-2 py-2",
12
40
  "data-testid": "assistant-header",
13
41
  "data-presentation": "compact",
14
42
  children: [
15
- /* @__PURE__ */ d("button", {
16
- ref: b,
43
+ /* @__PURE__ */ m("button", {
44
+ ref: s,
17
45
  type: "button",
18
- onClick: y,
19
- className: `${p} ${m}`,
20
- "aria-label": O("header.menu", "Assistant menu"),
21
- "aria-expanded": _,
22
- "aria-controls": _ ? v : void 0,
46
+ onClick: o,
47
+ className: `${g} ${_}`,
48
+ "aria-label": E("header.menu", "Assistant menu"),
49
+ "aria-expanded": i,
50
+ "aria-controls": i ? a : void 0,
23
51
  "data-testid": "assistant-menu",
24
- children: /* @__PURE__ */ d(s, {
52
+ children: /* @__PURE__ */ m(u, {
25
53
  className: "size-5",
26
54
  "aria-hidden": "true"
27
55
  })
28
56
  }),
29
- /* @__PURE__ */ f("div", {
30
- className: "flex min-w-0 flex-1 items-center gap-3 ps-1",
31
- children: [/* @__PURE__ */ d("span", {
32
- className: "flex size-7 flex-shrink-0 items-center justify-center rounded-lg bg-gradient-to-br from-action-primary-bg/25 to-action-primary-bg/5 text-action-primary-bg",
33
- children: /* @__PURE__ */ d(l, {
34
- className: "size-4",
35
- "aria-hidden": "true"
36
- })
37
- }), /* @__PURE__ */ f("span", {
38
- className: "min-w-0 flex-1",
39
- children: [/* @__PURE__ */ d("span", {
40
- className: "block truncate text-base font-semibold leading-tight text-text-primary",
41
- children: O("header.title", "AI Assistant")
42
- }), g ? /* @__PURE__ */ d("span", {
43
- className: "mt-0.5 block truncate text-xs leading-tight text-text-muted",
44
- children: O("header.context", "Context: {{page}}", { page: i(O, r(g), g) })
45
- }) : null]
46
- })]
47
- }),
48
- n(k) && T ? /* @__PURE__ */ d("button", {
57
+ /* @__PURE__ */ m(y, { contextLabel: r }),
58
+ n(D) && C ? /* @__PURE__ */ m("button", {
49
59
  type: "button",
50
- onClick: T,
51
- className: `${p} ${E ? h : m}`,
52
- "aria-label": k.label ?? O("header.preview", "Preview"),
53
- "aria-pressed": !!E,
60
+ onClick: C,
61
+ className: `${g} ${w ? v : _}`,
62
+ "aria-label": D.label ?? E("header.preview", "Preview"),
63
+ "aria-pressed": !!w,
54
64
  "data-testid": "assistant-toggle-preview",
55
- children: /* @__PURE__ */ d(a, {
65
+ children: /* @__PURE__ */ m(c, {
56
66
  className: "size-5",
57
67
  "aria-hidden": "true"
58
68
  })
59
69
  }) : null,
60
- x,
61
- S ? /* @__PURE__ */ d("button", {
70
+ f,
71
+ b ? /* @__PURE__ */ m("button", {
62
72
  type: "button",
63
- onClick: w,
64
- className: `${p} ${C ? h : m}`,
65
- "aria-label": O("header.expand", "Expand assistant"),
66
- "aria-pressed": C,
67
- title: C ? O("header.restoreSize", "Restore size") : O("header.expandTip", "Expand"),
73
+ onClick: S,
74
+ className: `${g} ${x ? v : _}`,
75
+ "aria-label": E("header.expand", "Expand assistant"),
76
+ "aria-pressed": x,
77
+ title: x ? E("header.restoreSize", "Restore size") : E("header.expandTip", "Expand"),
68
78
  "data-testid": "assistant-expand",
69
- children: d(C ? c : o, {
79
+ children: m(x ? d : l, {
70
80
  className: "size-5",
71
81
  "aria-hidden": "true"
72
82
  })
73
83
  }) : null,
74
- D ? /* @__PURE__ */ d("button", {
84
+ T ? /* @__PURE__ */ m("button", {
75
85
  type: "button",
76
- onClick: D,
77
- className: `${p} ${m}`,
78
- "aria-label": O("header.close", "Close assistant"),
86
+ onClick: T,
87
+ className: `${g} ${_}`,
88
+ "aria-label": E("header.close", "Close assistant"),
79
89
  "data-testid": "assistant-close",
80
- children: /* @__PURE__ */ d(u, {
90
+ children: /* @__PURE__ */ m(p, {
81
91
  className: "size-5",
82
92
  "aria-hidden": "true"
83
93
  })
@@ -85,4 +95,4 @@ var p = "flex size-10 shrink-0 items-center justify-center rounded-button transi
85
95
  ]
86
96
  });
87
97
  };
88
- export { g as AssistantCompactHeader };
98
+ export { b as AssistantCompactHeader };
@@ -1,63 +1,57 @@
1
1
  import { useAssistantTr as e } from "../../i18n.js";
2
2
  import { AssistantLanguagePill as t } from "./AssistantLanguagePill.js";
3
- import { fitAssistantWindowTitle as n, useAssistantWindowTitle as r } from "./windowTitle.js";
4
- import { useLayoutEffect as i, useRef as a } from "react";
5
- import { Minus as o, PanelRight as s, Sparkles as c } from "lucide-react";
6
- import { jsx as l, jsxs as u } from "react/jsx-runtime";
3
+ import { useAssistantWindowTitle as n, useFittedAssistantTitle as r } from "./windowTitle.js";
4
+ import { useRef as i } from "react";
5
+ import { Minus as a, PanelRight as o, Sparkles as s } from "lucide-react";
6
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
7
7
  // src/shared/assistant/ui/compact/AssistantWindowHeader.tsx
8
- var d = "flex size-10 shrink-0 items-center justify-center rounded-button transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]", f = "text-text-secondary hover:bg-bg-sunken hover:text-text-primary", p = ({ voiceLive: p, avatarOn: m, onOpenFull: h, onMinimize: g }) => {
9
- let _ = e(), v = r(), y = a(null);
10
- i(() => {
11
- let e = y.current;
12
- if (!e) return;
13
- let t = () => n(e);
14
- if (t(), typeof ResizeObserver > "u" || !e.parentElement) return;
15
- let r = new ResizeObserver(t);
16
- return r.observe(e.parentElement), () => r.disconnect();
17
- }, [v]);
18
- let b = _("window.openFull", "Open full assistant"), x = m ? _("window.openFullAvatarStays", "Open full assistant (the avatar stays on)") : b, S = m && p ? _("window.minimizeEndsAvatarAndVoice", "Minimize (turns off the avatar and ends voice)") : m ? _("window.minimizeTurnsOffAvatar", "Minimize (turns off the avatar)") : p ? _("window.minimizeEndsVoice", "Minimize (ends voice)") : _("window.minimize", "Minimize");
19
- return /* @__PURE__ */ u("div", {
8
+ var u = "flex size-10 shrink-0 items-center justify-center rounded-button transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]", d = "text-text-secondary hover:bg-bg-sunken hover:text-text-primary", f = ({ voiceLive: f, avatarOn: p, onOpenFull: m, onMinimize: h }) => {
9
+ let g = e(), _ = n(), v = i(null), y = i(null);
10
+ r(v, _, y);
11
+ let b = g("window.openFull", "Open full assistant"), x = p ? g("window.openFullAvatarStays", "Open full assistant (the avatar stays on)") : b, S = p && f ? g("window.minimizeEndsAvatarAndVoice", "Minimize (turns off the avatar and ends voice)") : p ? g("window.minimizeTurnsOffAvatar", "Minimize (turns off the avatar)") : f ? g("window.minimizeEndsVoice", "Minimize (ends voice)") : g("window.minimize", "Minimize");
12
+ return /* @__PURE__ */ l("div", {
20
13
  className: "relative flex h-[3.25rem] shrink-0 items-center gap-0.5 border-b border-border-subtle py-1.5 pe-1.5 ps-2.5",
21
14
  "data-testid": "assistant-window-header",
22
15
  "data-presentation": "compact",
23
16
  "data-surface": "window",
24
17
  children: [
25
- /* @__PURE__ */ u("div", {
26
- className: "flex min-w-0 flex-1 items-center gap-2",
27
- children: [/* @__PURE__ */ l("span", {
28
- className: "boff-accent-tile boff-accent-tile--duo flex size-7 shrink-0 items-center justify-center rounded-lg max-[23.99rem]:size-[1.625rem]",
18
+ /* @__PURE__ */ l("div", {
19
+ className: "flex min-h-7 min-w-0 flex-1 items-center gap-2",
20
+ children: [/* @__PURE__ */ c("span", {
21
+ ref: y,
22
+ className: "boff-accent-tile boff-accent-tile--duo flex size-7 shrink-0 items-center justify-center rounded-lg max-[23.99rem]:size-[1.625rem] data-[dropped]:hidden",
29
23
  "aria-hidden": "true",
30
24
  "data-testid": "assistant-window-mark",
31
- children: /* @__PURE__ */ l(c, { className: "boff-twinkle size-4" })
32
- }), /* @__PURE__ */ l("h2", {
33
- ref: y,
25
+ children: /* @__PURE__ */ c(s, { className: "boff-twinkle size-4" })
26
+ }), /* @__PURE__ */ c("h2", {
27
+ ref: v,
34
28
  className: "m-0 min-w-0 truncate text-[15px] font-semibold leading-5 tracking-[-0.012em] text-text-primary data-[tight]:text-sm data-[tighter]:text-[13px]",
35
- title: v,
29
+ title: _,
36
30
  "data-testid": "assistant-window-title",
37
- children: v
31
+ children: _
38
32
  })]
39
33
  }),
40
- /* @__PURE__ */ l(t, { voiceLive: p }),
41
- /* @__PURE__ */ l("button", {
34
+ /* @__PURE__ */ c(t, { voiceLive: f }),
35
+ /* @__PURE__ */ c("button", {
42
36
  type: "button",
43
- onClick: () => h(),
44
- className: `${d} ${f}`,
37
+ onClick: () => m(),
38
+ className: `${u} ${d}`,
45
39
  "aria-label": x,
46
40
  title: b,
47
41
  "data-testid": "assistant-open-full",
48
- children: /* @__PURE__ */ l(s, {
42
+ children: /* @__PURE__ */ c(o, {
49
43
  className: "size-[1.125rem]",
50
44
  "aria-hidden": "true"
51
45
  })
52
46
  }),
53
- /* @__PURE__ */ l("button", {
47
+ /* @__PURE__ */ c("button", {
54
48
  type: "button",
55
- onClick: g,
56
- className: `${d} ${f}`,
49
+ onClick: h,
50
+ className: `${u} ${d}`,
57
51
  "aria-label": S,
58
52
  title: S,
59
53
  "data-testid": "assistant-minimize",
60
- children: /* @__PURE__ */ l(o, {
54
+ children: /* @__PURE__ */ c(a, {
61
55
  className: "size-[1.125rem]",
62
56
  "aria-hidden": "true"
63
57
  })
@@ -65,4 +59,4 @@ var d = "flex size-10 shrink-0 items-center justify-center rounded-button transi
65
59
  ]
66
60
  });
67
61
  };
68
- export { p as AssistantWindowHeader };
62
+ export { f as AssistantWindowHeader };
@@ -1,15 +1,38 @@
1
+ import { RefObject } from 'react';
1
2
  /**
2
- * The window's name: "<Product> Assistant" (BOFF-15066), the product's display name from the shared catalog
3
- * (`config/products.ts`), so every product gets its own name from the SDK with no app change.
3
+ * The assistant's own name, "<Product> Assistant" (BOFF-15066): the product's display name from the shared catalog
4
+ * (`config/products.ts`), so every product gets its own name from the SDK with no app change. `null` for a product the
5
+ * catalog does not know (a host's own id): each surface then keeps its generic words, because a wrong name is worse than
6
+ * the generic one.
4
7
  *
5
- * ★ Its own key, `window.productTitle`, never `window.title`: that one is seeded in every product as "Quick assistant", so
6
- * reusing it would show the old words wherever a translation exists. A product the catalog does not know (a host's own id)
7
- * keeps `window.title`: a wrong name is worse than the generic one.
8
+ * ★ One key, `window.productTitle`, for the Quick window AND the full panel (the operator, 17 Nov: "use product name in the
9
+ * big panel too"): one product's assistant has one name wherever it opens, translated once. Never `window.title` or
10
+ * `header.title`: those are seeded in every product as "Quick assistant" and "AI Assistant" (FluidGrids' "FluidGrids
11
+ * AI", HealthyBowl's "HealthyBowl AI"), so reusing either would show the old words wherever a translation exists. Those
12
+ * two products' own `header.title` still names their classic panel (the installed apps).
8
13
  */
14
+ export declare function useAssistantProductTitle(): string | null;
15
+ /** The Quick window's name: the product's (`useAssistantProductTitle`), else `window.title`. */
9
16
  export declare function useAssistantWindowTitle(): string;
10
17
  /**
11
- * Fit the window's name in its box: 15 px (no attribute), else 14 px (`data-tight`), else 13 px
12
- * (`data-tighter`); a name that overflows even at 13 px keeps `data-tighter` and truncates. Each step is
13
- * measured as it is set (the browser lays the heading out again on each read).
18
+ * Fit an assistant name in its box: its own size (no attribute), else a step smaller (`data-tight`), else two steps
19
+ * smaller (`data-tighter`). The heading's classes say the sizes (the window: 15, 14 and 13 px; the full panel: 16, 15
20
+ * and 14 px). Given the header's brand `mark`, a name that does not fit even two steps smaller drops the mark
21
+ * (`data-dropped`, which the mark's classes hide) and is fitted again in the room it leaves. A name that overflows even
22
+ * then keeps `data-tighter` and truncates. Each step is measured as it is set (the browser lays the heading out again on
23
+ * each read).
24
+ *
25
+ * ★ The overflow test is fractional. `scrollWidth` and `clientWidth` are whole pixels, but the ellipsis is drawn for ANY
26
+ * overflow, so a name up to half a pixel too wide passed as fitting and showed "FluidGrids Assist…" (BOFF-15066 review).
27
+ * A Range gives the text's own width, ellipsized or not, to compare with the heading's box (it has no padding or border).
28
+ */
29
+ export declare function fitAssistantWindowTitle(heading: HTMLElement, mark?: HTMLElement | null): void;
30
+ /**
31
+ * Keep a header's name fitted (`fitAssistantWindowTitle`): before anything paints, and again whenever the name changes
32
+ * or its row resizes (a font, a language or a product name can each change its width). Attributes, not state: the fit
33
+ * must read each width in the same frame, before anything paints.
34
+ *
35
+ * ★ It watches the row that holds the mark and the name, never the name's own box: dropping the mark widens that box,
36
+ * and an observer that resizes what it watches loops ("ResizeObserver loop completed with undelivered notifications").
14
37
  */
15
- export declare function fitAssistantWindowTitle(heading: HTMLElement): void;
38
+ export declare function useFittedAssistantTitle(headingRef: RefObject<HTMLElement | null>, title: string, markRef?: RefObject<HTMLElement | null>): void;
@@ -1,13 +1,38 @@
1
1
  import { findProductConfig as e } from "../../../config/products.js";
2
2
  import { useAssistantTr as t } from "../../i18n.js";
3
3
  import { useAssistantProduct as n } from "../../product.js";
4
+ import { useLayoutEffect as r } from "react";
4
5
  // src/shared/assistant/ui/compact/windowTitle.ts
5
- function r() {
6
+ function i() {
6
7
  let r = t(), { product: i } = n(), a = i ? e(i)?.name : void 0;
7
- return a ? r("window.productTitle", "{{product}} Assistant", { product: a }) : r("window.title", "Quick assistant");
8
+ return a ? r("window.productTitle", "{{product}} Assistant", { product: a }) : null;
8
9
  }
9
- function i(e) {
10
- let t = () => e.scrollWidth > e.clientWidth;
11
- e.removeAttribute("data-tight"), e.removeAttribute("data-tighter"), t() && (e.setAttribute("data-tight", ""), t() && (e.removeAttribute("data-tight"), e.setAttribute("data-tighter", "")));
10
+ function a() {
11
+ let e = t();
12
+ return i() ?? e("window.title", "Quick assistant");
12
13
  }
13
- export { i as fitAssistantWindowTitle, r as useAssistantWindowTitle };
14
+ function o(e, t) {
15
+ let n = () => {
16
+ if (e.scrollWidth > e.clientWidth) return !0;
17
+ let t = e.ownerDocument?.createRange?.();
18
+ return t ? (t.selectNodeContents(e), t.getBoundingClientRect().width > e.getBoundingClientRect().width) : !1;
19
+ }, r = () => (e.removeAttribute("data-tight"), e.removeAttribute("data-tighter"), !n() || (e.setAttribute("data-tight", ""), !n()) || (e.removeAttribute("data-tight"), e.setAttribute("data-tighter", ""), !n()));
20
+ t?.removeAttribute("data-dropped"), !r() && t && (t.setAttribute("data-dropped", ""), r());
21
+ }
22
+ function s(e, t, n) {
23
+ r(() => {
24
+ let t = e.current;
25
+ if (!t) return;
26
+ let r = n?.current ?? null, i = () => o(t, r);
27
+ i();
28
+ let a = (r ?? t).parentElement;
29
+ if (typeof ResizeObserver > "u" || !a) return;
30
+ let s = new ResizeObserver(i);
31
+ return s.observe(a), () => s.disconnect();
32
+ }, [
33
+ e,
34
+ n,
35
+ t
36
+ ]);
37
+ }
38
+ export { o as fitAssistantWindowTitle, i as useAssistantProductTitle, a as useAssistantWindowTitle, s as useFittedAssistantTitle };
@@ -2,3 +2,22 @@ export declare function configureFirstClipPrefetch(options: {
2
2
  enabled: boolean;
3
3
  } | null): void;
4
4
  export declare function firstClipPrefetchEnabled(): boolean;
5
+ /**
6
+ * ★★ P1 fix 2 (BOFF-12936): the ONE first-piece rule of a voice reply, for
7
+ * every route that speaks one: the feed's `speak` (published at `answerDone`),
8
+ * the complete edge of a voice turn while P1 is on, the phrase queue's first
9
+ * append (alpha and the production hold alike) and the early fetch
10
+ * (`settledFirstChunk`). A first piece computed by one route and spoken by
11
+ * another used to differ: the phrase queue and the complete edge packed short
12
+ * replies whole, so the clip fetched early was paid for and never used.
13
+ *
14
+ * A short first segment (`SPEECH_FIRST_CHUNK_MAX_CHARS`, BOFF-8062) always;
15
+ * with P1 on, a first sentence of at least `FIRST_CLIP_LEAD_MIN_CHARS` also
16
+ * leads alone (`chunkForSpeech`'s `leadSentenceMinChars`). With P1 off every
17
+ * route chunks exactly as before: the feed and the phrase queue with the short
18
+ * first segment alone, the complete edge without this rule at all.
19
+ */
20
+ export declare function voiceFirstPieceOptions(): {
21
+ firstChunkMaxChars: number;
22
+ leadSentenceMinChars?: number;
23
+ };
@@ -1,3 +1,4 @@
1
+ import "./speakableText.js";
1
2
  // src/shared/assistant/voice/firstClipPrefetchConfig.ts
2
3
  var e = !1;
3
4
  function t(t) {
@@ -6,4 +7,10 @@ function t(t) {
6
7
  function n() {
7
8
  return e;
8
9
  }
9
- export { t as configureFirstClipPrefetch, n as firstClipPrefetchEnabled };
10
+ function r() {
11
+ return {
12
+ firstChunkMaxChars: 110,
13
+ ...e ? { leadSentenceMinChars: 40 } : {}
14
+ };
15
+ }
16
+ export { t as configureFirstClipPrefetch, n as firstClipPrefetchEnabled, r as voiceFirstPieceOptions };
@@ -1,9 +1,18 @@
1
1
  import { LiveDeltaState } from '../liveDeltas';
2
+ import { TurnStreamStatus } from '../turnStream';
2
3
  export declare const NARRATION_HOLD_MS = 700;
3
4
  export interface LivePhraseSpeech {
4
5
  update(visible: string, live: LiveDeltaState, floor: number): void;
5
6
  invalidate(live: LiveDeltaState, floor: number): void;
6
7
  close(): void;
8
+ /**
9
+ * ★★ P1 review (BOFF-12936): stopped before its first release, for the
10
+ * source it reads now (a phrase not on screen, a part it cannot vouch for, a
11
+ * step that called a tool). It releases nothing more from that source, so
12
+ * the reply is read whole at its publish. A new source (a new text part on
13
+ * alpha, a new step under the production hold) re-arms it.
14
+ */
15
+ readonly silent: boolean;
7
16
  }
8
17
  /** One turn's narrator. Its caller runs only on an opted-in voice/SSE overlay. */
9
18
  export declare function createLivePhraseSpeech(options: {
@@ -41,3 +50,17 @@ export declare function createLivePhraseSpeech(options: {
41
50
  setTimer?: (run: () => void, ms: number) => unknown;
42
51
  clearTimer?: (timer: unknown) => void;
43
52
  }): LivePhraseSpeech;
53
+ /**
54
+ * ★★ P1 review (BOFF-12936): will this turn's narrator release nothing for the
55
+ * answer as it stands? Then the reply is read whole at its publish (the speak
56
+ * route), and the first clip's early fetch must not predict the phrase route
57
+ * for it (`SpeechFeedItem.phraseRoute`). True when the turn has no narrator
58
+ * (phrase speech off, or a mode that accumulates narration), when it stopped
59
+ * before its first release (`silent`), or when the stream can carry no live
60
+ * text any more and carried none (a relay that refused the stream: the turn is
61
+ * polled). While the stream is minting or connecting the narrator may still
62
+ * release, and so it may while it has live text.
63
+ */
64
+ export declare function narratorReleasesNothing(narrator: LivePhraseSpeech | null, stream: {
65
+ readonly status: TurnStreamStatus;
66
+ }, live: LiveDeltaState): boolean;
@@ -1,31 +1,31 @@
1
- import { phraseCandidates as e } from "./phraseGate.js";
2
- import { toSpeakableText as t } from "./speakableText.js";
1
+ import { hasLiveText as e } from "../liveDeltas.js";
2
+ import { phraseCandidates as t, phrasesShown as n } from "./phraseGate.js";
3
3
  // src/shared/assistant/voice/livePhraseSpeech.ts
4
- var n = 700, r = /* @__PURE__ */ new Set(["tool-calls", "error"]);
5
- function i(n) {
6
- let i = n.holdForFinalAnswer === !0, a = n.setTimer ?? ((e, t) => setTimeout(e, t)), o = n.clearTimer ?? ((e) => {
4
+ var r = 700, i = /* @__PURE__ */ new Set(["tool-calls", "error"]);
5
+ function a(e) {
6
+ let r = e.holdForFinalAnswer === !0, a = e.setTimer ?? ((e, t) => setTimeout(e, t)), o = e.clearTimer ?? ((e) => {
7
7
  clearTimeout(e);
8
8
  }), s = null, c = "", l = [], u = [], d = "", f = !1, p = !1, m = () => {
9
9
  s !== null && o(s), s = null;
10
10
  }, h = () => {
11
- m(), n.retract(), f = !0;
12
- }, g = (e) => {
13
- if (p || f || e <= l.length) return;
14
- let t = u.slice(l.length, e);
15
- l = u.slice(0, e), n.append(t, d);
11
+ m(), e.retract(), f = !0;
12
+ }, g = (t) => {
13
+ if (p || f || t <= l.length) return;
14
+ let n = u.slice(l.length, t);
15
+ l = u.slice(0, t), e.append(n, d);
16
16
  }, _ = (e, t) => {
17
17
  let n = [...e.messages].filter(([, e]) => (e.created ?? 0) > t);
18
18
  n.sort((e, t) => (e[1].created ?? 0) - (t[1].created ?? 0));
19
- let r = n.at(-1)?.[0];
20
- if (r === void 0) return;
21
- let a = [...e.parts].filter(([, e]) => e.messageId === r), o = a.at(-1);
22
- if (o) return i ? {
23
- key: r,
24
- messageId: r,
19
+ let i = n.at(-1)?.[0];
20
+ if (i === void 0) return;
21
+ let a = [...e.parts].filter(([, e]) => e.messageId === i), o = a.at(-1);
22
+ if (o) return r ? {
23
+ key: i,
24
+ messageId: i,
25
25
  parts: a
26
26
  } : {
27
- key: `${r}/${o[0]}/${o[1].generation}`,
28
- messageId: r,
27
+ key: `${i}/${o[0]}/${o[1].generation}`,
28
+ messageId: i,
29
29
  parts: [o]
30
30
  };
31
31
  }, v = (e, t) => e.parts.some(([, e]) => !e.live || e.gapped || e.frozen || e.toolAfter || e.generation !== t.generation);
@@ -39,32 +39,32 @@ function i(n) {
39
39
  if (p) return;
40
40
  let x = _(y, b);
41
41
  if (!x) return;
42
- if (x.key !== c && (m(), c && n.retract(), c = x.key, l = [], f = !1), v(x, y)) {
42
+ if (x.key !== c && (m(), c && e.retract(), c = x.key, l = [], f = !1), v(x, y)) {
43
43
  h();
44
44
  return;
45
45
  }
46
46
  if (f) return;
47
47
  let S = y.messages.get(x.messageId), C = x.parts.every(([, e]) => e.ended) && S?.completed !== void 0;
48
- if (i) {
49
- if (C && S?.finish !== void 0 && r.has(S.finish)) {
48
+ if (r) {
49
+ if (C && S?.finish !== void 0 && i.has(S.finish)) {
50
50
  h();
51
51
  return;
52
52
  }
53
53
  if (!C) return;
54
54
  }
55
- if (u = x.parts.flatMap(([, t]) => e(t.text, C)), l.some((e, t) => u[t] !== e)) {
56
- h();
57
- return;
58
- }
59
- d = o;
60
- let w = t(o).replace(/\s+/g, " ");
61
- u.some((e) => !w.includes(e.replace(/\s+/g, " "))) ? h() : C ? (m(), g(u.length)) : (g(Math.max(0, u.length - 1)), l.length === u.length ? m() : s === null && (s = a(() => {
55
+ u = x.parts.flatMap(([, e]) => t(e.text, C)), l.some((e, t) => u[t] !== e) ? h() : (d = o, n(u, o) ? C ? (m(), g(u.length)) : (g(Math.max(0, u.length - 1)), l.length === u.length ? m() : s === null && (s = a(() => {
62
56
  s = null, g(u.length);
63
- }, 700)));
57
+ }, 700))) : h());
64
58
  },
65
59
  close() {
66
60
  p = !0, m();
61
+ },
62
+ get silent() {
63
+ return f && l.length === 0;
67
64
  }
68
65
  };
69
66
  }
70
- export { n as NARRATION_HOLD_MS, i as createLivePhraseSpeech };
67
+ function o(t, n, r) {
68
+ return t === null || t.silent ? !0 : (n.status === "unavailable" || n.status === "closed") && !e(r);
69
+ }
70
+ export { r as NARRATION_HOLD_MS, a as createLivePhraseSpeech, o as narratorReleasesNothing };
@@ -4,6 +4,19 @@
4
4
  * Unfinished paragraphs contribute only sentences with a confirmed ending.
5
5
  */
6
6
  export declare function phraseCandidates(markdown: string, final?: boolean): string[];
7
+ /**
8
+ * Is every phrase in the text the person sees (`visible`, the bubble's
9
+ * markdown), as it would be spoken? The narrator (`createLivePhraseSpeech`)
10
+ * releases nothing more once one is not, so speech never says what the screen
11
+ * does not show. A phrase is built with silent labels, so one that carries an
12
+ * e-mail address or a bare URL is never found: such a reply is read whole once
13
+ * it is done.
14
+ *
15
+ * ★★ P1 review (BOFF-12936): ONE function for the narrator and for the first
16
+ * clip's guard (`phraseRouteFirstPiece`), which reads a phrase that is not
17
+ * shown as "the narrator will release nothing": the two cannot drift.
18
+ */
19
+ export declare function phrasesShown(phrases: readonly string[], visible: string): boolean;
7
20
  /** Reconcile F against accepted/unwithdrawn S without reading the final twice. */
8
21
  export declare function unspokenFinal(final: string, segments: readonly string[]): {
9
22
  text: string;
@@ -35,7 +35,11 @@ function s(t, n = !1) {
35
35
  }
36
36
  return a;
37
37
  }
38
- function c(e, t) {
38
+ function c(e, n) {
39
+ let r = t(n).replace(/\s+/g, " ");
40
+ return e.every((e) => r.includes(e.replace(/\s+/g, " ")));
41
+ }
42
+ function l(e, t) {
39
43
  let n = (e) => e.replace(/\s+/g, " ").trim(), r = n(e), i = n(t.filter(Boolean).join(" "));
40
44
  if (!i) return {
41
45
  text: r,
@@ -60,4 +64,4 @@ function c(e, t) {
60
64
  diverged: !0
61
65
  };
62
66
  }
63
- export { s as phraseCandidates, c as unspokenFinal };
67
+ export { s as phraseCandidates, c as phrasesShown, l as unspokenFinal };