@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.
- package/dist/shared/assistant/avatar/live/createLiveAvatarSeam.js +8 -6
- package/dist/shared/assistant/speech/hostedTtsSpeechEngine.js +37 -27
- package/dist/shared/assistant/speech/index.d.ts +1 -1
- package/dist/shared/assistant/speech/notifyCancellationSpeechEngine.d.ts +14 -1
- package/dist/shared/assistant/speech/notifyCancellationSpeechEngine.js +3 -0
- package/dist/shared/assistant/speech/routingSpeechEngine.js +4 -4
- package/dist/shared/assistant/speech/speechFeed.d.ts +20 -3
- package/dist/shared/assistant/speech/speechFeed.js +25 -17
- package/dist/shared/assistant/speech/types.d.ts +68 -1
- package/dist/shared/assistant/speech/types.js +7 -2
- package/dist/shared/assistant/turnTimeline.d.ts +32 -0
- package/dist/shared/assistant/turnTimeline.js +3 -3
- package/dist/shared/assistant/ui/AIAssistantPanel.js +152 -152
- package/dist/shared/assistant/ui/AssistantChatArea.js +1228 -1227
- package/dist/shared/assistant/ui/AssistantSpeechProvider.d.ts +5 -3
- package/dist/shared/assistant/ui/AssistantSpeechProvider.js +393 -346
- package/dist/shared/assistant/ui/compact/AssistantCompactHeader.d.ts +9 -0
- package/dist/shared/assistant/ui/compact/AssistantCompactHeader.js +62 -52
- package/dist/shared/assistant/ui/compact/AssistantWindowHeader.js +29 -35
- package/dist/shared/assistant/ui/compact/windowTitle.d.ts +32 -9
- package/dist/shared/assistant/ui/compact/windowTitle.js +31 -6
- package/dist/shared/assistant/voice/firstClipPrefetchConfig.d.ts +19 -0
- package/dist/shared/assistant/voice/firstClipPrefetchConfig.js +8 -1
- package/dist/shared/assistant/voice/livePhraseSpeech.d.ts +23 -0
- package/dist/shared/assistant/voice/livePhraseSpeech.js +30 -30
- package/dist/shared/assistant/voice/phraseGate.d.ts +13 -0
- package/dist/shared/assistant/voice/phraseGate.js +6 -2
- package/dist/shared/assistant/voice/phrasePlayback.d.ts +59 -0
- package/dist/shared/assistant/voice/phrasePlayback.js +56 -34
- package/dist/shared-assistant.js +418 -418
- 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 {
|
|
6
|
-
import {
|
|
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
|
|
9
|
-
let
|
|
10
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
16
|
-
ref:
|
|
43
|
+
/* @__PURE__ */ m("button", {
|
|
44
|
+
ref: s,
|
|
17
45
|
type: "button",
|
|
18
|
-
onClick:
|
|
19
|
-
className: `${
|
|
20
|
-
"aria-label":
|
|
21
|
-
"aria-expanded":
|
|
22
|
-
"aria-controls":
|
|
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__ */
|
|
52
|
+
children: /* @__PURE__ */ m(u, {
|
|
25
53
|
className: "size-5",
|
|
26
54
|
"aria-hidden": "true"
|
|
27
55
|
})
|
|
28
56
|
}),
|
|
29
|
-
/* @__PURE__ */
|
|
30
|
-
|
|
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:
|
|
51
|
-
className: `${
|
|
52
|
-
"aria-label":
|
|
53
|
-
"aria-pressed": !!
|
|
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__ */
|
|
65
|
+
children: /* @__PURE__ */ m(c, {
|
|
56
66
|
className: "size-5",
|
|
57
67
|
"aria-hidden": "true"
|
|
58
68
|
})
|
|
59
69
|
}) : null,
|
|
60
|
-
|
|
61
|
-
|
|
70
|
+
f,
|
|
71
|
+
b ? /* @__PURE__ */ m("button", {
|
|
62
72
|
type: "button",
|
|
63
|
-
onClick:
|
|
64
|
-
className: `${
|
|
65
|
-
"aria-label":
|
|
66
|
-
"aria-pressed":
|
|
67
|
-
title:
|
|
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:
|
|
79
|
+
children: m(x ? d : l, {
|
|
70
80
|
className: "size-5",
|
|
71
81
|
"aria-hidden": "true"
|
|
72
82
|
})
|
|
73
83
|
}) : null,
|
|
74
|
-
|
|
84
|
+
T ? /* @__PURE__ */ m("button", {
|
|
75
85
|
type: "button",
|
|
76
|
-
onClick:
|
|
77
|
-
className: `${
|
|
78
|
-
"aria-label":
|
|
86
|
+
onClick: T,
|
|
87
|
+
className: `${g} ${_}`,
|
|
88
|
+
"aria-label": E("header.close", "Close assistant"),
|
|
79
89
|
"data-testid": "assistant-close",
|
|
80
|
-
children: /* @__PURE__ */
|
|
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 {
|
|
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 {
|
|
4
|
-
import {
|
|
5
|
-
import { Minus as
|
|
6
|
-
import { jsx as
|
|
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
|
|
9
|
-
let
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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__ */
|
|
26
|
-
className: "flex min-w-0 flex-1 items-center gap-2",
|
|
27
|
-
children: [/* @__PURE__ */
|
|
28
|
-
|
|
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__ */
|
|
32
|
-
}), /* @__PURE__ */
|
|
33
|
-
ref:
|
|
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:
|
|
29
|
+
title: _,
|
|
36
30
|
"data-testid": "assistant-window-title",
|
|
37
|
-
children:
|
|
31
|
+
children: _
|
|
38
32
|
})]
|
|
39
33
|
}),
|
|
40
|
-
/* @__PURE__ */
|
|
41
|
-
/* @__PURE__ */
|
|
34
|
+
/* @__PURE__ */ c(t, { voiceLive: f }),
|
|
35
|
+
/* @__PURE__ */ c("button", {
|
|
42
36
|
type: "button",
|
|
43
|
-
onClick: () =>
|
|
44
|
-
className: `${
|
|
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__ */
|
|
42
|
+
children: /* @__PURE__ */ c(o, {
|
|
49
43
|
className: "size-[1.125rem]",
|
|
50
44
|
"aria-hidden": "true"
|
|
51
45
|
})
|
|
52
46
|
}),
|
|
53
|
-
/* @__PURE__ */
|
|
47
|
+
/* @__PURE__ */ c("button", {
|
|
54
48
|
type: "button",
|
|
55
|
-
onClick:
|
|
56
|
-
className: `${
|
|
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__ */
|
|
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 {
|
|
62
|
+
export { f as AssistantWindowHeader };
|
|
@@ -1,15 +1,38 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
1
2
|
/**
|
|
2
|
-
* The
|
|
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
|
-
* ★
|
|
6
|
-
*
|
|
7
|
-
*
|
|
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
|
|
12
|
-
* (`data-tighter`)
|
|
13
|
-
*
|
|
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
|
|
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
|
|
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 }) :
|
|
8
|
+
return a ? r("window.productTitle", "{{product}} Assistant", { product: a }) : null;
|
|
8
9
|
}
|
|
9
|
-
function
|
|
10
|
-
let
|
|
11
|
-
|
|
10
|
+
function a() {
|
|
11
|
+
let e = t();
|
|
12
|
+
return i() ?? e("window.title", "Quick assistant");
|
|
12
13
|
}
|
|
13
|
-
|
|
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
|
-
|
|
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 {
|
|
2
|
-
import {
|
|
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
|
|
5
|
-
function
|
|
6
|
-
let
|
|
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(),
|
|
12
|
-
}, g = (
|
|
13
|
-
if (p || f ||
|
|
14
|
-
let
|
|
15
|
-
l = u.slice(0,
|
|
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
|
|
20
|
-
if (
|
|
21
|
-
let a = [...e.parts].filter(([, e]) => e.messageId ===
|
|
22
|
-
if (o) return
|
|
23
|
-
key:
|
|
24
|
-
messageId:
|
|
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: `${
|
|
28
|
-
messageId:
|
|
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 &&
|
|
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 (
|
|
49
|
-
if (C && S?.finish !== void 0 &&
|
|
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
|
-
|
|
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
|
-
|
|
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,
|
|
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 };
|