@burdenoff/fe-libs 2026.1114.12 → 2026.1114.14
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/conversation.d.ts +16 -0
- package/dist/shared/assistant/i18nManifest.d.ts +32 -0
- package/dist/shared/assistant/i18nManifest.js +32 -0
- package/dist/shared/assistant/index.d.ts +10 -0
- package/dist/shared/assistant/store.d.ts +7 -0
- package/dist/shared/assistant/store.js +3 -0
- package/dist/shared/assistant/ui/AssistantChatArea.js +1275 -1181
- package/dist/shared/assistant/ui/AssistantMessageList.d.ts +14 -0
- package/dist/shared/assistant/ui/AssistantMessageList.js +55 -52
- package/dist/shared/assistant/ui/composer/AssistantComposer.d.ts +6 -0
- package/dist/shared/assistant/ui/composer/AssistantComposer.js +400 -311
- package/dist/shared/assistant/ui/composer/AssistantDictation.d.ts +42 -0
- package/dist/shared/assistant/ui/composer/AssistantDictation.js +127 -0
- package/dist/shared/assistant/ui/composer/AssistantMicMenu.d.ts +23 -0
- package/dist/shared/assistant/ui/composer/AssistantMicMenu.js +176 -0
- package/dist/shared/assistant/ui/composer/microphones.d.ts +13 -0
- package/dist/shared/assistant/ui/composer/microphones.js +15 -0
- package/dist/shared/assistant/ui/composer/useCompactDictation.d.ts +70 -0
- package/dist/shared/assistant/ui/composer/useCompactDictation.js +136 -0
- package/dist/shared/assistant/ui/useVoiceSession.js +166 -164
- package/dist/shared/assistant/ui/voice/AssistantPageVoiceBar.d.ts +67 -0
- package/dist/shared/assistant/ui/voice/AssistantPageVoiceBar.js +290 -0
- package/dist/shared/assistant/ui/voice/AssistantVoiceSession.d.ts +11 -1
- package/dist/shared/assistant/ui/voice/AssistantVoiceSession.js +288 -244
- package/dist/shared/assistant/ui/voice/AssistantVoiceSessionButton.d.ts +5 -0
- package/dist/shared/assistant/ui/voice/AssistantVoiceSessionButton.js +6 -6
- package/dist/shared/assistant/ui/voice/LiveWaveform.d.ts +32 -0
- package/dist/shared/assistant/ui/voice/LiveWaveform.js +52 -0
- package/dist/shared/assistant/ui/voice/VoiceTurnMarks.d.ts +15 -0
- package/dist/shared/assistant/ui/voice/VoiceTurnMarks.js +43 -0
- package/dist/shared/assistant/ui/voice/formatClock.d.ts +2 -0
- package/dist/shared/assistant/ui/voice/formatClock.js +3 -0
- package/dist/shared/assistant/ui/voice/useLiveLevel.d.ts +23 -0
- package/dist/shared/assistant/ui/voice/useLiveLevel.js +56 -0
- package/dist/shared/assistant/voice/liveLevel.d.ts +85 -0
- package/dist/shared/assistant/voice/liveLevel.js +78 -0
- package/dist/shared/assistant/voice/useVoiceInput.d.ts +27 -1
- package/dist/shared/assistant/voice/useVoiceInput.js +141 -71
- package/dist/shared-assistant.js +393 -383
- package/package.json +1 -1
|
@@ -4,389 +4,433 @@ import { AssistantAttachmentChips as n } from "../composer/AssistantAttachmentCh
|
|
|
4
4
|
import { AssistantVoiceOrb as r } from "./AssistantVoiceOrb.js";
|
|
5
5
|
import { VoiceStage as ee } from "./VoiceStage.js";
|
|
6
6
|
import { VoiceMiniController as te } from "./VoiceMiniController.js";
|
|
7
|
-
import { useLiveAvatarHandsFreeGuard as
|
|
8
|
-
import { useAvatarCopy as
|
|
9
|
-
import { VoiceTranscriptDrawer as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
7
|
+
import { useLiveAvatarHandsFreeGuard as ne, useLiveAvatarTab as re, useLiveAvatarVoiceView as ie } from "../assistantLiveAvatarSeam.js";
|
|
8
|
+
import { useAvatarCopy as ae } from "../../avatar/useAvatarCopy.js";
|
|
9
|
+
import { VoiceTranscriptDrawer as oe } from "./VoiceTranscriptDrawer.js";
|
|
10
|
+
import { AssistantPageVoiceBar as se } from "./AssistantPageVoiceBar.js";
|
|
11
|
+
import { useLiveLevel as i } from "./useLiveLevel.js";
|
|
12
|
+
import { useAssistantStore as ce } from "../../store.js";
|
|
13
|
+
import { HandsFreePrivacyNotice as le } from "./HandsFreePrivacyNotice.js";
|
|
14
|
+
import { escapeBelongsToLayerAbove as ue, voiceSessionEscapeAction as de } from "./voiceSessionEscape.js";
|
|
15
|
+
import { ASSISTANT_PANEL_ATTR as fe, ASSISTANT_VOICE_SESSION_ATTR as pe } from "../panelOverlays.js";
|
|
16
|
+
import { focusWasDropped as me, useReturnFocus as he } from "../../../hooks/useReturnFocus.js";
|
|
17
|
+
import { micIsInterrupt as a, showsAssistantCaption as ge, voiceStageState as _e } from "../../voice/voiceStageState.js";
|
|
18
|
+
import { VOICE_THINKING_LABEL as ve, composeVoiceStatus as ye, voiceStatusSuffix as be } from "../../voice/voiceStatus.js";
|
|
19
|
+
import { useAssistantTr as xe } from "../../i18n.js";
|
|
20
|
+
import { spokenSoFar as Se } from "../../voice/voiceSession.js";
|
|
21
|
+
import { useCallback as Ce, useEffect as o, useMemo as we, useRef as s, useState as c } from "react";
|
|
22
|
+
import { Maximize2 as Te, Mic as Ee, MicOff as De, Minimize2 as Oe, ScrollText as ke, ShieldAlert as Ae, Square as je, X as Me } from "lucide-react";
|
|
23
|
+
import { Fragment as Ne, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
24
|
+
import { createPortal as Pe } from "react-dom";
|
|
21
25
|
// src/shared/assistant/ui/voice/AssistantVoiceSession.tsx
|
|
22
|
-
var
|
|
23
|
-
let
|
|
24
|
-
|
|
25
|
-
let
|
|
26
|
-
|
|
27
|
-
let
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}, [
|
|
31
|
-
let
|
|
32
|
-
e("assistant.transcript",
|
|
33
|
-
let
|
|
34
|
-
|
|
35
|
-
let
|
|
36
|
-
|
|
37
|
-
}, [
|
|
38
|
-
|
|
39
|
-
}, []),
|
|
40
|
-
|
|
26
|
+
var d = ({ session: d, turns: Ie = [], onSaveTranscript: Re, onContinueInChat: ze, notice: p = null, privacyNotice: m = null, bargeIn: Be = !1, spoken: Ve, onInterrupt: h, onToggleMute: g, attachments: _ = [], onAttachFiles: v, onRemoveAttachment: He, onRetryAttachment: Ue, canAttachMore: y = !0, preparingAttachments: b = 0, attachmentsLocked: x = !1, attachmentNotice: S = null, spokenChunks: We = null, onEnd: C, capturing: Ge = !0, interrupting: Ke = !1, awaitingEndpoint: qe = !1, holding: w = !1, correcting: Je = !1, onLetMeFinish: Ye, onImDone: Xe, proposalChip: T = null, proposalTray: E = null, renderAfterTurn: Ze, onViewChange: Qe, view: D, pageSlot: $e = null, startedCue: O }) => {
|
|
27
|
+
let k = xe(), { muted: A, error: j } = d, M = s(null), N = s(null), [et, P] = c("mini"), F = D !== void 0, I = D === "compact", L = D === "page", [R, tt] = c(D);
|
|
28
|
+
R !== D && (tt(D), D === void 0 && R !== void 0 && P(R === "compact" ? "panel" : R === "page" ? "mini" : R));
|
|
29
|
+
let nt = D === void 0 ? et : D === "compact" ? "panel" : D === "page" ? "mini" : D, z = re().open, [rt, it] = c(z);
|
|
30
|
+
rt !== z && (it(z), z && et !== "mini" && P("mini"));
|
|
31
|
+
let B = ie(nt, d.phase === "ended"), at = ne();
|
|
32
|
+
o(() => {
|
|
33
|
+
Qe?.(B);
|
|
34
|
+
}, [Qe, B]);
|
|
35
|
+
let ot = ae(), V = B === "full", H = B === "mini", st = B === "mini" ? "panel" : B === "panel" ? "full" : "mini", [U, W] = c(!1), ct = we(() => ({ run: () => U ? { status: "already" } : (W(!0), { status: "done" }) }), [U]);
|
|
36
|
+
e("assistant.transcript", ct);
|
|
37
|
+
let G = E !== null && !H, K = s(!1), lt = s(g);
|
|
38
|
+
lt.current = g;
|
|
39
|
+
let ut = Ce(() => {
|
|
40
|
+
d.phase !== "listening" && d.phase !== "thinking" || A || K.current || Se(d) || (K.current = !0, lt.current());
|
|
41
|
+
}, [A, d]), dt = Ce(() => {
|
|
42
|
+
K.current && (K.current = !1, lt.current());
|
|
43
|
+
}, []), ft = ut;
|
|
44
|
+
o(() => {
|
|
41
45
|
let e = () => {
|
|
42
|
-
document.visibilityState === "hidden" ?
|
|
46
|
+
document.visibilityState === "hidden" ? ut() : dt();
|
|
43
47
|
};
|
|
44
48
|
return document.addEventListener("visibilitychange", e), () => document.removeEventListener("visibilitychange", e);
|
|
45
|
-
}, [
|
|
46
|
-
let e =
|
|
49
|
+
}, [ut, dt]), o(() => {
|
|
50
|
+
let e = dt;
|
|
47
51
|
return window.addEventListener("focus", e), () => {
|
|
48
|
-
window.removeEventListener("focus", e),
|
|
52
|
+
window.removeEventListener("focus", e), K.current = !1;
|
|
49
53
|
};
|
|
50
|
-
}, []),
|
|
51
|
-
document.activeElement?.closest("[data-hands-free-notice]") ||
|
|
52
|
-
}, []),
|
|
53
|
-
let
|
|
54
|
-
|
|
55
|
-
let e =
|
|
56
|
-
|
|
57
|
-
}, [
|
|
54
|
+
}, []), o(() => {
|
|
55
|
+
document.activeElement?.closest("[data-hands-free-notice]") || M.current?.focus();
|
|
56
|
+
}, []), he(N, { fallbackSelector: `[${fe}]` });
|
|
57
|
+
let pt = s(F);
|
|
58
|
+
o(() => {
|
|
59
|
+
let e = pt.current;
|
|
60
|
+
pt.current = F, e && !F && me(document) && (N.current?.querySelector("[data-testid=\"assistant-voice-transcript-close\"]") ?? M.current)?.focus({ preventScroll: !0 });
|
|
61
|
+
}, [F]), o(() => {
|
|
58
62
|
let e = (e) => {
|
|
59
63
|
if (e.key === "Escape") {
|
|
60
|
-
let t =
|
|
64
|
+
let t = de({
|
|
61
65
|
defaultPrevented: e.defaultPrevented,
|
|
62
|
-
layerAbove:
|
|
66
|
+
layerAbove: ue({
|
|
63
67
|
target: e.target,
|
|
64
|
-
session:
|
|
68
|
+
session: N.current,
|
|
65
69
|
doc: document
|
|
66
70
|
}),
|
|
67
|
-
transcriptOpen:
|
|
71
|
+
transcriptOpen: U
|
|
68
72
|
});
|
|
69
73
|
if (t === "ignore") return;
|
|
70
|
-
e.preventDefault(), t === "close-transcript" ?
|
|
74
|
+
e.preventDefault(), t === "close-transcript" ? W(!1) : m ? m.decline() : G ? E?.onClose() : C();
|
|
71
75
|
return;
|
|
72
76
|
}
|
|
73
|
-
if (e.key !== "Tab" || !
|
|
74
|
-
let t = (
|
|
77
|
+
if (e.key !== "Tab" || !V) return;
|
|
78
|
+
let t = (U ? N.current?.querySelector("[data-testid=\"assistant-voice-transcript\"]") : N.current)?.querySelectorAll("button:not([disabled])");
|
|
75
79
|
if (!t || t.length === 0) return;
|
|
76
80
|
let n = t[0], r = t[t.length - 1];
|
|
77
81
|
n && r && (e.shiftKey && document.activeElement === n ? (e.preventDefault(), r.focus()) : !e.shiftKey && document.activeElement === r && (e.preventDefault(), n.focus()));
|
|
78
82
|
};
|
|
79
83
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
80
84
|
}, [
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
C,
|
|
86
|
+
V,
|
|
87
|
+
U,
|
|
88
|
+
G,
|
|
89
|
+
E,
|
|
90
|
+
m
|
|
87
91
|
]);
|
|
88
|
-
let
|
|
89
|
-
letMeFinish:
|
|
90
|
-
imDone:
|
|
91
|
-
} : null,
|
|
92
|
-
|
|
93
|
-
if (
|
|
92
|
+
let q = p !== null && j === null, J = at && p === null && j === null, Y = Se(d), X = Ye && Xe && d.phase === "listening" && !A && j === null ? {
|
|
93
|
+
letMeFinish: Ye,
|
|
94
|
+
imDone: Xe
|
|
95
|
+
} : null, mt = X !== null;
|
|
96
|
+
o(() => {
|
|
97
|
+
if (mt) return;
|
|
94
98
|
let e = document.activeElement;
|
|
95
|
-
e && e !== document.body ||
|
|
96
|
-
}, [
|
|
97
|
-
let
|
|
98
|
-
snapshot:
|
|
99
|
-
capturing:
|
|
100
|
-
interrupting:
|
|
101
|
-
awaitingEndpoint:
|
|
102
|
-
}),
|
|
103
|
-
switch (
|
|
104
|
-
case "connecting": return
|
|
105
|
-
case "endpoint-grace": return
|
|
106
|
-
case "interrupting": return
|
|
107
|
-
case "thinking": return
|
|
108
|
-
case "speaking": return
|
|
99
|
+
e && e !== document.body || M.current?.focus();
|
|
100
|
+
}, [mt]);
|
|
101
|
+
let Z = _e({
|
|
102
|
+
snapshot: d,
|
|
103
|
+
capturing: Ge,
|
|
104
|
+
interrupting: Ke,
|
|
105
|
+
awaitingEndpoint: qe
|
|
106
|
+
}), ht = (() => {
|
|
107
|
+
switch (Z) {
|
|
108
|
+
case "connecting": return k("voiceSession.connecting", "Starting the microphone…");
|
|
109
|
+
case "endpoint-grace": return k("voiceSession.endpointGrace", "Still listening — take your time");
|
|
110
|
+
case "interrupting": return k("voiceSession.interrupting", "Stopped — go ahead");
|
|
111
|
+
case "thinking": return k(ve.key, ve.fallback);
|
|
112
|
+
case "speaking": return k("voiceSession.speaking", "Speaking — tap to stop");
|
|
109
113
|
case "mic-error":
|
|
110
114
|
case "ended": return "";
|
|
111
|
-
case "listening": return
|
|
112
|
-
default: return
|
|
115
|
+
case "listening": return A ? k("voiceSession.muted", "Microphone off") : k("voiceSession.listening", "Listening…");
|
|
116
|
+
default: return Z;
|
|
113
117
|
}
|
|
114
|
-
})(),
|
|
115
|
-
tr:
|
|
116
|
-
stage:
|
|
117
|
-
muted:
|
|
118
|
-
label:
|
|
119
|
-
}),
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
118
|
+
})(), gt = !A && (Z === "listening" || Z === "endpoint-grace"), _t = gt && w ? k("voiceSession.holding", "Take your time — tap “I’m done” when you finish") : gt && Je ? k("voiceSession.correcting", "Stopped that answer — listening to your correction") : ht, Q = be({
|
|
119
|
+
tr: k,
|
|
120
|
+
stage: Z,
|
|
121
|
+
muted: A,
|
|
122
|
+
label: _t
|
|
123
|
+
}), vt = ye(_t, Q), yt = Z === "thinking", $ = !A && (Z === "listening" || Z === "endpoint-grace"), bt = ce((e) => e.micDeviceId), xt = i({
|
|
124
|
+
active: L && ($ || Z === "speaking"),
|
|
125
|
+
mic: L && $,
|
|
126
|
+
pulseKey: Y,
|
|
127
|
+
speaking: Z === "speaking",
|
|
128
|
+
deviceId: bt
|
|
129
|
+
});
|
|
130
|
+
return L ? $e ? Pe(/* @__PURE__ */ l(se, {
|
|
131
|
+
rootRef: N,
|
|
132
|
+
endRef: M,
|
|
133
|
+
stage: Z,
|
|
134
|
+
muted: A,
|
|
135
|
+
status: vt,
|
|
136
|
+
statusSuffix: Q,
|
|
137
|
+
rotateStatus: yt,
|
|
138
|
+
stageText: _t,
|
|
139
|
+
heard: $ ? Y : "",
|
|
140
|
+
level: xt,
|
|
141
|
+
notice: q ? f(p, k) : null,
|
|
142
|
+
announcedNotice: q && Fe(p) ? f(p, k) : null,
|
|
143
|
+
attachmentNotice: S,
|
|
144
|
+
startedCue: O,
|
|
145
|
+
errorText: j === null ? null : Le(j, k),
|
|
146
|
+
attachments: _,
|
|
147
|
+
preparingAttachments: b,
|
|
148
|
+
attachmentsLocked: x,
|
|
149
|
+
canAttachMore: y,
|
|
150
|
+
onAttachFiles: v,
|
|
151
|
+
onPickerOpen: ft,
|
|
152
|
+
onRemoveAttachment: He,
|
|
153
|
+
onRetryAttachment: Ue,
|
|
154
|
+
hold: X ? {
|
|
155
|
+
holding: w,
|
|
156
|
+
onPress: w ? X.imDone : X.letMeFinish
|
|
157
|
+
} : null,
|
|
158
|
+
onToggleMute: g,
|
|
159
|
+
muteDisabled: d.phase === "idle" || d.phase === "ended" || j !== null || Z === "connecting",
|
|
160
|
+
onInterrupt: h,
|
|
161
|
+
bargeIn: Be,
|
|
162
|
+
onEnd: C,
|
|
163
|
+
privacyNotice: m
|
|
164
|
+
}), $e) : null : /* @__PURE__ */ u("div", {
|
|
165
|
+
ref: N,
|
|
166
|
+
className: `flex flex-col ${I ? "items-stretch" : "items-center"} justify-between ${I ? "bg-bg-elevated" : "bg-bg-sunken"} ${I ? "absolute inset-0 z-20 px-3 pb-3 pt-2" : B === "full" ? "fixed inset-x-0 bottom-0 top-14 z-[60] px-6 py-8" : B === "panel" ? "absolute inset-0 z-20 px-4 py-6" : "absolute inset-x-0 bottom-0 z-20 min-h-[11.25rem] border-t border-border-subtle px-3 py-3 shadow-lg"}`,
|
|
123
167
|
role: "dialog",
|
|
124
|
-
"aria-modal":
|
|
125
|
-
"aria-label":
|
|
168
|
+
"aria-modal": V || void 0,
|
|
169
|
+
"aria-label": k("voiceSession.title", "Voice conversation"),
|
|
126
170
|
"data-testid": "assistant-voice-session",
|
|
127
|
-
[
|
|
171
|
+
[pe]: "",
|
|
128
172
|
children: [
|
|
129
|
-
|
|
130
|
-
ref:
|
|
173
|
+
I ? null : /* @__PURE__ */ u("button", {
|
|
174
|
+
ref: M,
|
|
131
175
|
type: "button",
|
|
132
|
-
onClick:
|
|
133
|
-
className: `absolute ${
|
|
134
|
-
title:
|
|
176
|
+
onClick: C,
|
|
177
|
+
className: `absolute ${V ? "end-6 top-6 h-14 gap-2 px-5 text-base" : H ? "end-12 top-2 h-8 gap-1.5 px-2.5 text-xs" : "end-3 top-3 h-11 gap-2 px-4 text-sm"} flex items-center justify-center rounded-full border border-border-default bg-bg-elevated text-text-secondary hover:bg-bg-sunken transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong`,
|
|
178
|
+
title: k("voiceSession.end", "End the voice conversation"),
|
|
135
179
|
"data-testid": "assistant-voice-end",
|
|
136
|
-
children: [/* @__PURE__ */
|
|
137
|
-
className:
|
|
180
|
+
children: [/* @__PURE__ */ l(Me, {
|
|
181
|
+
className: V ? "size-6" : H ? "size-4" : "size-5",
|
|
138
182
|
"aria-hidden": "true"
|
|
139
|
-
}), /* @__PURE__ */
|
|
140
|
-
className: `truncate whitespace-nowrap font-medium ${
|
|
141
|
-
children:
|
|
183
|
+
}), /* @__PURE__ */ l("span", {
|
|
184
|
+
className: `truncate whitespace-nowrap font-medium ${H ? "max-w-[3.5rem] text-xs" : "max-w-[7rem]"}`,
|
|
185
|
+
children: k("voiceSession.endShort", "End")
|
|
142
186
|
})]
|
|
143
187
|
}),
|
|
144
|
-
/* @__PURE__ */
|
|
145
|
-
className: `flex flex-col items-center ${
|
|
188
|
+
/* @__PURE__ */ u("div", {
|
|
189
|
+
className: `flex flex-col items-center ${I ? "min-h-[1.5rem]" : H ? `px-3 ${q || J || S ? "pt-9 pb-2" : ""}` : `min-h-[1.5rem] ${q || J || S ? V ? "pt-14" : "pt-10" : ""}`}`,
|
|
146
190
|
children: [
|
|
147
|
-
|
|
191
|
+
q ? /* @__PURE__ */ l("p", {
|
|
148
192
|
className: "max-w-xs text-center text-xs text-status-warning",
|
|
149
193
|
"data-testid": "assistant-voice-notice",
|
|
150
|
-
children:
|
|
194
|
+
children: f(p, k)
|
|
151
195
|
}) : null,
|
|
152
|
-
|
|
196
|
+
J ? /* @__PURE__ */ l("p", {
|
|
153
197
|
className: "max-w-xs text-center text-xs text-text-secondary",
|
|
154
198
|
"data-testid": "assistant-voice-avatar-hands-free",
|
|
155
|
-
children:
|
|
199
|
+
children: ot.handsFreeOff
|
|
156
200
|
}) : null,
|
|
157
|
-
/* @__PURE__ */
|
|
201
|
+
/* @__PURE__ */ l("span", {
|
|
158
202
|
className: "sr-only start-0 top-0",
|
|
159
203
|
role: "status",
|
|
160
204
|
"aria-live": "polite",
|
|
161
205
|
"aria-atomic": "true",
|
|
162
206
|
"data-testid": "assistant-voice-notice-announced",
|
|
163
|
-
children:
|
|
207
|
+
children: q && Fe(p) ? f(p, k) : J ? ot.handsFreeOff : null
|
|
164
208
|
}),
|
|
165
|
-
|
|
209
|
+
S ? /* @__PURE__ */ l("p", {
|
|
166
210
|
className: "max-w-xs text-center text-xs text-status-warning",
|
|
167
211
|
role: "status",
|
|
168
212
|
"aria-live": "polite",
|
|
169
213
|
"data-testid": "assistant-voice-attachment-notice",
|
|
170
|
-
children:
|
|
214
|
+
children: S
|
|
171
215
|
}) : null,
|
|
172
|
-
|
|
216
|
+
O === void 0 ? null : /* @__PURE__ */ u(Ne, { children: [O ? /* @__PURE__ */ l("p", {
|
|
173
217
|
className: "max-w-xs text-center text-xs text-text-secondary",
|
|
174
218
|
"data-testid": "assistant-voice-started-cue",
|
|
175
|
-
children:
|
|
176
|
-
}) : null, /* @__PURE__ */
|
|
219
|
+
children: O
|
|
220
|
+
}) : null, /* @__PURE__ */ l("span", {
|
|
177
221
|
className: "sr-only start-0 top-0",
|
|
178
222
|
role: "status",
|
|
179
223
|
"aria-live": "polite",
|
|
180
224
|
"aria-atomic": "true",
|
|
181
225
|
"data-testid": "assistant-voice-started-cue-announced",
|
|
182
|
-
children:
|
|
226
|
+
children: O
|
|
183
227
|
})] })
|
|
184
228
|
]
|
|
185
229
|
}),
|
|
186
230
|
(() => {
|
|
187
|
-
let e = /* @__PURE__ */
|
|
188
|
-
session:
|
|
189
|
-
compact:
|
|
190
|
-
connecting:
|
|
191
|
-
onPress:
|
|
192
|
-
label:
|
|
193
|
-
}), t =
|
|
231
|
+
let e = /* @__PURE__ */ l(r, {
|
|
232
|
+
session: d,
|
|
233
|
+
compact: H,
|
|
234
|
+
connecting: Z === "connecting",
|
|
235
|
+
onPress: a(Z) ? h : g,
|
|
236
|
+
label: a(Z) ? k("voiceSession.interrupt", "Stop the assistant and speak") : A ? k("voiceSession.unmute", "Turn the microphone on") : k("voiceSession.mute", "Turn the microphone off")
|
|
237
|
+
}), t = X ? /* @__PURE__ */ l("button", {
|
|
194
238
|
type: "button",
|
|
195
|
-
onClick:
|
|
196
|
-
className: `flex items-center justify-center rounded-full border font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong ${
|
|
197
|
-
title:
|
|
239
|
+
onClick: w ? X.imDone : X.letMeFinish,
|
|
240
|
+
className: `flex items-center justify-center rounded-full border font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong ${H ? "h-7 px-3 text-xs" : V ? "h-11 px-6 text-base" : "h-9 px-4 text-sm"} ${w ? "border-transparent bg-action-primary-bg text-action-primary-text hover:opacity-90" : "border-border-default bg-bg-elevated text-text-secondary hover:bg-bg-sunken"}`,
|
|
241
|
+
title: w ? k("voiceSession.imDoneHint", "Send what you said now") : k("voiceSession.letMeFinishHint", "Pause sending until you tap “I’m done”"),
|
|
198
242
|
"data-testid": "assistant-voice-hold",
|
|
199
|
-
"data-holding":
|
|
200
|
-
children:
|
|
201
|
-
}) : null, n =
|
|
243
|
+
"data-holding": w ? "true" : "false",
|
|
244
|
+
children: w ? k("voiceSession.imDone", "I’m done") : k("voiceSession.letMeFinish", "Let me finish")
|
|
245
|
+
}) : null, n = a(Z), ne = n ? h : g, re = d.phase === "idle" || d.phase === "ended" || j !== null || Z === "connecting" || !ne, ie = I ? /* @__PURE__ */ u("button", {
|
|
202
246
|
type: "button",
|
|
203
|
-
onClick:
|
|
204
|
-
disabled:
|
|
247
|
+
onClick: ne,
|
|
248
|
+
disabled: re,
|
|
205
249
|
className: "flex h-11 items-center justify-center gap-2 rounded-full border border-border-default bg-bg-elevated px-6 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)] disabled:cursor-default disabled:text-text-muted disabled:hover:bg-bg-elevated",
|
|
206
250
|
"data-testid": "assistant-voice-primary",
|
|
207
|
-
"data-state":
|
|
208
|
-
"data-muted":
|
|
209
|
-
children: [n ? /* @__PURE__ */
|
|
251
|
+
"data-state": Z,
|
|
252
|
+
"data-muted": A || void 0,
|
|
253
|
+
children: [n ? /* @__PURE__ */ l(je, {
|
|
210
254
|
className: "size-4 fill-current",
|
|
211
255
|
"aria-hidden": "true"
|
|
212
|
-
}) :
|
|
256
|
+
}) : l(A ? De : Ee, {
|
|
213
257
|
className: "size-4",
|
|
214
258
|
"aria-hidden": "true"
|
|
215
|
-
}), n ?
|
|
216
|
-
}) : null,
|
|
259
|
+
}), n ? k("window.stopSpeaking", "Stop speaking") : A ? k("window.unmute", "Unmute") : k("window.mute", "Mute")]
|
|
260
|
+
}) : null, ae = t ? /* @__PURE__ */ u("div", {
|
|
217
261
|
className: "flex flex-col items-center gap-2",
|
|
218
262
|
children: [e, t]
|
|
219
|
-
}) : e,
|
|
263
|
+
}) : e, oe = I ? /* @__PURE__ */ u("div", {
|
|
220
264
|
className: "flex flex-col items-center gap-2",
|
|
221
|
-
children: [t,
|
|
222
|
-
}) : void 0,
|
|
223
|
-
return
|
|
224
|
-
spokenChunks:
|
|
225
|
-
state:
|
|
226
|
-
caption:
|
|
227
|
-
statusText:
|
|
228
|
-
statusSuffix:
|
|
229
|
-
rotateStatus:
|
|
230
|
-
errorText:
|
|
231
|
-
control:
|
|
232
|
-
}) : /* @__PURE__ */
|
|
233
|
-
state:
|
|
234
|
-
userCaption:
|
|
235
|
-
spokenChunks:
|
|
236
|
-
assistantCaption:
|
|
237
|
-
expanded:
|
|
238
|
-
statusText:
|
|
239
|
-
statusSuffix:
|
|
240
|
-
rotateStatus:
|
|
241
|
-
errorText:
|
|
242
|
-
control:
|
|
243
|
-
compact:
|
|
244
|
-
compactControl:
|
|
265
|
+
children: [t, ie]
|
|
266
|
+
}) : void 0, se = ge(Z) ? Ve : Y || null, i = j === null ? null : Le(j, k);
|
|
267
|
+
return H ? /* @__PURE__ */ l(te, {
|
|
268
|
+
spokenChunks: We,
|
|
269
|
+
state: Z,
|
|
270
|
+
caption: se,
|
|
271
|
+
statusText: vt,
|
|
272
|
+
statusSuffix: Q,
|
|
273
|
+
rotateStatus: yt,
|
|
274
|
+
errorText: i,
|
|
275
|
+
control: ae
|
|
276
|
+
}) : /* @__PURE__ */ l(ee, {
|
|
277
|
+
state: Z,
|
|
278
|
+
userCaption: Y || null,
|
|
279
|
+
spokenChunks: We,
|
|
280
|
+
assistantCaption: Ve,
|
|
281
|
+
expanded: V,
|
|
282
|
+
statusText: vt,
|
|
283
|
+
statusSuffix: Q,
|
|
284
|
+
rotateStatus: yt,
|
|
285
|
+
errorText: i,
|
|
286
|
+
control: ae,
|
|
287
|
+
compact: I || void 0,
|
|
288
|
+
compactControl: oe
|
|
245
289
|
});
|
|
246
290
|
})(),
|
|
247
|
-
|
|
248
|
-
className:
|
|
249
|
-
children: /* @__PURE__ */
|
|
291
|
+
T && !G && !I ? /* @__PURE__ */ l("div", {
|
|
292
|
+
className: H ? "absolute start-20 end-36 top-2 flex justify-center" : `flex w-full justify-center ${V ? "max-w-[calc(100%-12rem)]" : "max-w-[calc(100%-8rem)]"}`,
|
|
293
|
+
children: /* @__PURE__ */ l("button", {
|
|
250
294
|
type: "button",
|
|
251
295
|
onClick: () => {
|
|
252
|
-
|
|
296
|
+
P("panel"), T.onOpen();
|
|
253
297
|
},
|
|
254
|
-
className: `max-w-full truncate rounded-full border border-border-default bg-bg-elevated font-medium text-text-primary transition-colors hover:bg-bg-raised focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong ${
|
|
298
|
+
className: `max-w-full truncate rounded-full border border-border-default bg-bg-elevated font-medium text-text-primary transition-colors hover:bg-bg-raised focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong ${H ? "h-8 px-3 text-xs" : "h-10 px-4 text-sm"}`,
|
|
255
299
|
"data-testid": "assistant-voice-proposal-chip",
|
|
256
|
-
children:
|
|
300
|
+
children: T.label
|
|
257
301
|
})
|
|
258
302
|
}) : null,
|
|
259
|
-
|
|
303
|
+
T && I ? /* @__PURE__ */ u("div", {
|
|
260
304
|
className: "flex min-h-11 w-full items-center gap-2 rounded-xl border border-status-warning bg-status-warning/10 px-3 py-1",
|
|
261
305
|
"data-testid": "assistant-voice-proposal-chip-row",
|
|
262
306
|
children: [
|
|
263
|
-
/* @__PURE__ */
|
|
307
|
+
/* @__PURE__ */ l(Ae, {
|
|
264
308
|
className: "size-4 shrink-0 text-status-warning",
|
|
265
309
|
"aria-hidden": "true"
|
|
266
310
|
}),
|
|
267
|
-
|
|
311
|
+
T.status ? /* @__PURE__ */ l("p", {
|
|
268
312
|
role: "status",
|
|
269
313
|
"aria-live": "polite",
|
|
270
314
|
className: "min-w-0 flex-1 text-sm text-text-primary",
|
|
271
315
|
"data-testid": "assistant-voice-proposal-status",
|
|
272
|
-
children:
|
|
273
|
-
}) : /* @__PURE__ */
|
|
274
|
-
/* @__PURE__ */
|
|
316
|
+
children: T.status
|
|
317
|
+
}) : /* @__PURE__ */ l("span", { className: "flex-1" }),
|
|
318
|
+
/* @__PURE__ */ l("button", {
|
|
275
319
|
type: "button",
|
|
276
|
-
onClick:
|
|
320
|
+
onClick: T.onOpen,
|
|
277
321
|
className: "min-h-9 shrink-0 rounded-button px-3 text-sm font-medium text-action-primary-bg transition-colors hover:bg-bg-sunken focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
|
|
278
322
|
"data-testid": "assistant-voice-proposal-chip",
|
|
279
|
-
children:
|
|
323
|
+
children: T.label
|
|
280
324
|
})
|
|
281
325
|
]
|
|
282
326
|
}) : null,
|
|
283
|
-
|
|
284
|
-
className: `absolute z-10 flex flex-col gap-2 overflow-y-auto rounded-lg border border-border-subtle bg-bg-elevated shadow-lg ${
|
|
327
|
+
E && G ? /* @__PURE__ */ u("div", {
|
|
328
|
+
className: `absolute z-10 flex flex-col gap-2 overflow-y-auto rounded-lg border border-border-subtle bg-bg-elevated shadow-lg ${V ? "inset-x-6 bottom-24 top-24 mx-auto max-w-xl p-4" : "inset-x-3 bottom-16 top-16 p-3"}`,
|
|
285
329
|
"data-testid": "assistant-voice-proposal-tray",
|
|
286
|
-
children: [/* @__PURE__ */
|
|
330
|
+
children: [/* @__PURE__ */ l("div", {
|
|
287
331
|
className: "flex justify-end",
|
|
288
|
-
children: /* @__PURE__ */
|
|
332
|
+
children: /* @__PURE__ */ l("button", {
|
|
289
333
|
type: "button",
|
|
290
|
-
onClick:
|
|
334
|
+
onClick: E.onClose,
|
|
291
335
|
className: "flex size-8 items-center justify-center rounded-full text-text-secondary transition-colors hover:bg-bg-raised hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong",
|
|
292
|
-
"aria-label":
|
|
336
|
+
"aria-label": E.closeLabel,
|
|
293
337
|
"data-testid": "assistant-voice-proposal-tray-close",
|
|
294
|
-
children: /* @__PURE__ */
|
|
338
|
+
children: /* @__PURE__ */ l(Me, {
|
|
295
339
|
className: "size-4",
|
|
296
340
|
"aria-hidden": "true"
|
|
297
341
|
})
|
|
298
342
|
})
|
|
299
|
-
}),
|
|
343
|
+
}), E.content]
|
|
300
344
|
}) : null,
|
|
301
|
-
|
|
302
|
-
view:
|
|
303
|
-
onContinue:
|
|
304
|
-
onNotNow:
|
|
345
|
+
m ? /* @__PURE__ */ l(le, {
|
|
346
|
+
view: B,
|
|
347
|
+
onContinue: m.accept,
|
|
348
|
+
onNotNow: m.decline
|
|
305
349
|
}) : null,
|
|
306
|
-
|
|
307
|
-
turns:
|
|
308
|
-
onClose: () =>
|
|
309
|
-
onSave:
|
|
310
|
-
onContinueInChat:
|
|
311
|
-
renderAfterTurn:
|
|
350
|
+
U ? /* @__PURE__ */ l(oe, {
|
|
351
|
+
turns: Ie,
|
|
352
|
+
onClose: () => W(!1),
|
|
353
|
+
onSave: Re,
|
|
354
|
+
onContinueInChat: ze,
|
|
355
|
+
renderAfterTurn: Ze
|
|
312
356
|
}) : null,
|
|
313
|
-
|
|
314
|
-
className: `absolute ${
|
|
315
|
-
children: /* @__PURE__ */
|
|
357
|
+
v && !I ? /* @__PURE__ */ l("div", {
|
|
358
|
+
className: `absolute ${V ? "start-6 top-6" : H ? "start-11 top-2" : "start-3 top-3"}`,
|
|
359
|
+
children: /* @__PURE__ */ l(t, {
|
|
316
360
|
onFiles: (e) => {
|
|
317
|
-
|
|
361
|
+
v(e), F || P((e) => e === "mini" ? "panel" : e);
|
|
318
362
|
},
|
|
319
|
-
onPickerOpen:
|
|
363
|
+
onPickerOpen: ft,
|
|
320
364
|
direction: "down",
|
|
321
|
-
canAddMore:
|
|
322
|
-
disabled:
|
|
365
|
+
canAddMore: y,
|
|
366
|
+
disabled: x
|
|
323
367
|
})
|
|
324
368
|
}) : null,
|
|
325
|
-
(
|
|
326
|
-
className:
|
|
369
|
+
(_.length > 0 || b > 0) && !H ? /* @__PURE__ */ l("div", {
|
|
370
|
+
className: I ? "w-full" : `absolute ${V ? "bottom-24 start-24 end-24" : "bottom-16 start-16 end-16"}`,
|
|
327
371
|
"data-testid": "assistant-voice-attachments",
|
|
328
|
-
children: /* @__PURE__ */
|
|
329
|
-
attachments:
|
|
330
|
-
onRemove:
|
|
331
|
-
onRetry:
|
|
332
|
-
preparingCount:
|
|
333
|
-
disabled:
|
|
372
|
+
children: /* @__PURE__ */ l(n, {
|
|
373
|
+
attachments: _,
|
|
374
|
+
onRemove: He ?? (() => void 0),
|
|
375
|
+
onRetry: Ue ?? (() => void 0),
|
|
376
|
+
preparingCount: b,
|
|
377
|
+
disabled: x
|
|
334
378
|
})
|
|
335
379
|
}) : null,
|
|
336
|
-
|
|
380
|
+
I ? null : /* @__PURE__ */ l("button", {
|
|
337
381
|
type: "button",
|
|
338
|
-
onClick: () =>
|
|
339
|
-
className: `absolute ${
|
|
340
|
-
"aria-pressed":
|
|
341
|
-
"aria-label":
|
|
382
|
+
onClick: () => W((e) => !e),
|
|
383
|
+
className: `absolute ${V ? "bottom-6 end-6 size-14" : H ? "end-2 top-2 size-8" : "bottom-3 end-3 size-11"} flex items-center justify-center rounded-full bg-bg-elevated text-text-secondary transition-colors hover:bg-bg-raised hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong`,
|
|
384
|
+
"aria-pressed": U,
|
|
385
|
+
"aria-label": k("voiceSession.transcriptTitle", "Voice transcript"),
|
|
342
386
|
"data-testid": "assistant-voice-transcript-toggle",
|
|
343
|
-
children: /* @__PURE__ */
|
|
387
|
+
children: /* @__PURE__ */ l(ke, { className: V ? "size-6" : H ? "size-4" : "size-5" })
|
|
344
388
|
}),
|
|
345
|
-
|
|
389
|
+
F ? null : /* @__PURE__ */ l("button", {
|
|
346
390
|
type: "button",
|
|
347
|
-
onClick: () =>
|
|
348
|
-
className: `absolute ${
|
|
349
|
-
"aria-label":
|
|
391
|
+
onClick: () => P(st),
|
|
392
|
+
className: `absolute ${V ? "bottom-6 start-6 size-14" : H ? "start-2 top-2 size-8" : "bottom-3 start-3 size-11"} flex items-center justify-center rounded-full bg-bg-elevated text-text-secondary transition-colors hover:bg-bg-raised hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong`,
|
|
393
|
+
"aria-label": st === "panel" ? k("voiceSession.expandPanel", "Show the conversation in the panel") : st === "full" ? k("voiceSession.expand", "Expand the conversation to full screen") : k("voiceSession.collapse", "Shrink to the compact controller"),
|
|
350
394
|
"data-testid": "assistant-voice-expand",
|
|
351
|
-
children:
|
|
395
|
+
children: V ? /* @__PURE__ */ l(Oe, { className: "size-5" }) : /* @__PURE__ */ l(Te, { className: H ? "size-4" : "size-5" })
|
|
352
396
|
}),
|
|
353
|
-
|
|
397
|
+
I ? /* @__PURE__ */ u("div", {
|
|
354
398
|
className: "flex w-full items-center gap-2 pt-2",
|
|
355
399
|
"data-testid": "assistant-voice-controls",
|
|
356
400
|
children: [
|
|
357
|
-
|
|
358
|
-
onFiles: (e) =>
|
|
359
|
-
onPickerOpen:
|
|
401
|
+
v ? /* @__PURE__ */ l(t, {
|
|
402
|
+
onFiles: (e) => v(e),
|
|
403
|
+
onPickerOpen: ft,
|
|
360
404
|
direction: "up",
|
|
361
|
-
canAddMore:
|
|
362
|
-
disabled:
|
|
405
|
+
canAddMore: y,
|
|
406
|
+
disabled: x
|
|
363
407
|
}) : null,
|
|
364
|
-
/* @__PURE__ */
|
|
408
|
+
/* @__PURE__ */ u("button", {
|
|
365
409
|
type: "button",
|
|
366
|
-
onClick: () =>
|
|
410
|
+
onClick: () => W((e) => !e),
|
|
367
411
|
className: "flex h-10 min-w-0 flex-1 items-center justify-center gap-2 rounded-full border border-border-default bg-bg-elevated px-3 text-sm text-text-secondary transition-colors hover:bg-bg-sunken hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
|
|
368
|
-
"aria-expanded":
|
|
412
|
+
"aria-expanded": U,
|
|
369
413
|
"data-testid": "assistant-voice-transcript-toggle",
|
|
370
|
-
children: [/* @__PURE__ */
|
|
414
|
+
children: [/* @__PURE__ */ l(ke, {
|
|
371
415
|
className: "size-4 shrink-0",
|
|
372
416
|
"aria-hidden": "true"
|
|
373
|
-
}), /* @__PURE__ */
|
|
417
|
+
}), /* @__PURE__ */ l("span", {
|
|
374
418
|
className: "truncate",
|
|
375
|
-
children:
|
|
419
|
+
children: U ? k("window.hideTranscript", "Hide transcript") : k("window.showTranscript", "Show transcript")
|
|
376
420
|
})]
|
|
377
421
|
}),
|
|
378
|
-
/* @__PURE__ */
|
|
379
|
-
ref:
|
|
422
|
+
/* @__PURE__ */ u("button", {
|
|
423
|
+
ref: M,
|
|
380
424
|
type: "button",
|
|
381
|
-
onClick:
|
|
425
|
+
onClick: C,
|
|
382
426
|
className: "flex h-10 min-w-0 flex-1 items-center justify-center gap-2 rounded-full border border-status-error-border bg-status-error-bg-subtle px-3 text-sm font-medium text-status-error-text transition-colors hover:opacity-90 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
|
|
383
427
|
"data-testid": "assistant-voice-end",
|
|
384
|
-
children: [/* @__PURE__ */
|
|
428
|
+
children: [/* @__PURE__ */ l(Me, {
|
|
385
429
|
className: "size-4 shrink-0",
|
|
386
430
|
"aria-hidden": "true"
|
|
387
|
-
}), /* @__PURE__ */
|
|
431
|
+
}), /* @__PURE__ */ l("span", {
|
|
388
432
|
className: "truncate",
|
|
389
|
-
children:
|
|
433
|
+
children: k("window.endVoice", "End voice")
|
|
390
434
|
})]
|
|
391
435
|
})
|
|
392
436
|
]
|
|
@@ -394,13 +438,13 @@ var m = ({ session: m, turns: ke = [], onSaveTranscript: je, onContinueInChat: M
|
|
|
394
438
|
]
|
|
395
439
|
});
|
|
396
440
|
};
|
|
397
|
-
function
|
|
398
|
-
return typeof e == "string" ?
|
|
441
|
+
function f(e, t) {
|
|
442
|
+
return typeof e == "string" ? Ie(e, t) : e.text;
|
|
399
443
|
}
|
|
400
|
-
function
|
|
444
|
+
function Fe(e) {
|
|
401
445
|
return e !== null && (typeof e != "string" || e === "reply-not-heard");
|
|
402
446
|
}
|
|
403
|
-
function
|
|
447
|
+
function Ie(e, t) {
|
|
404
448
|
switch (e) {
|
|
405
449
|
case "network": return t("voiceSession.noticeNetwork", "Speech recognition lost its connection. Check your network — it will retry.");
|
|
406
450
|
case "not-capturing": return t("voiceSession.noticeNotCapturing", "The microphone did not start. Check that this site is allowed to use it, then try again.");
|
|
@@ -412,7 +456,7 @@ function ke(e, t) {
|
|
|
412
456
|
default: return e;
|
|
413
457
|
}
|
|
414
458
|
}
|
|
415
|
-
function
|
|
459
|
+
function Le(e, t) {
|
|
416
460
|
switch (e) {
|
|
417
461
|
case "mic-denied": return t("voiceSession.micDenied", "Microphone access is blocked. Allow it in your browser settings to talk.");
|
|
418
462
|
case "no-speech-support": return t("voiceSession.noSpeechSupport", "This browser cannot listen. Try a different browser, or type instead.");
|
|
@@ -420,4 +464,4 @@ function Ae(e, t) {
|
|
|
420
464
|
default: return e;
|
|
421
465
|
}
|
|
422
466
|
}
|
|
423
|
-
export {
|
|
467
|
+
export { d as AssistantVoiceSession };
|