@burdenoff/fe-libs 2026.1114.13 → 2026.1114.15
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 +30 -0
- package/dist/shared/assistant/i18nManifest.js +30 -0
- package/dist/shared/assistant/index.d.ts +6 -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 +1269 -1188
- 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.js +348 -362
- 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 +20 -17
- package/dist/shared/assistant/ui/voice/AssistantPageVoiceBar.js +230 -123
- package/dist/shared/assistant/ui/voice/AssistantVoiceSession.d.ts +2 -0
- package/dist/shared/assistant/ui/voice/AssistantVoiceSession.js +227 -229
- package/dist/shared/assistant/ui/voice/LiveWaveform.d.ts +4 -3
- package/dist/shared/assistant/ui/voice/LiveWaveform.js +1 -1
- 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 +3 -1
- package/dist/shared/assistant/ui/voice/useLiveLevel.js +23 -19
- package/dist/shared/assistant/voice/liveLevel.d.ts +4 -3
- package/dist/shared/assistant/voice/liveLevel.js +18 -15
- package/dist/shared/assistant/voice/useVoiceInput.d.ts +27 -1
- package/dist/shared/assistant/voice/useVoiceInput.js +141 -71
- package/dist/shared-assistant.js +383 -377
- package/package.json +1 -1
|
@@ -4,77 +4,78 @@ 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 { AssistantPageVoiceBar as
|
|
11
|
-
import { useLiveLevel as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
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";
|
|
24
25
|
// src/shared/assistant/ui/voice/AssistantVoiceSession.tsx
|
|
25
|
-
var
|
|
26
|
-
let k =
|
|
27
|
-
R !== D && (
|
|
28
|
-
let
|
|
29
|
-
|
|
30
|
-
let B =
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}, [
|
|
34
|
-
let
|
|
35
|
-
e("assistant.transcript",
|
|
36
|
-
let
|
|
37
|
-
|
|
38
|
-
let
|
|
39
|
-
|
|
40
|
-
}, [A,
|
|
41
|
-
|
|
42
|
-
}, []),
|
|
43
|
-
|
|
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(() => {
|
|
44
45
|
let e = () => {
|
|
45
|
-
document.visibilityState === "hidden" ?
|
|
46
|
+
document.visibilityState === "hidden" ? ut() : dt();
|
|
46
47
|
};
|
|
47
48
|
return document.addEventListener("visibilitychange", e), () => document.removeEventListener("visibilitychange", e);
|
|
48
|
-
}, [
|
|
49
|
-
let e =
|
|
49
|
+
}, [ut, dt]), o(() => {
|
|
50
|
+
let e = dt;
|
|
50
51
|
return window.addEventListener("focus", e), () => {
|
|
51
|
-
window.removeEventListener("focus", e),
|
|
52
|
+
window.removeEventListener("focus", e), K.current = !1;
|
|
52
53
|
};
|
|
53
|
-
}, []),
|
|
54
|
+
}, []), o(() => {
|
|
54
55
|
document.activeElement?.closest("[data-hands-free-notice]") || M.current?.focus();
|
|
55
|
-
}, []),
|
|
56
|
-
let
|
|
57
|
-
|
|
58
|
-
let e =
|
|
59
|
-
|
|
60
|
-
}, [F]),
|
|
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(() => {
|
|
61
62
|
let e = (e) => {
|
|
62
63
|
if (e.key === "Escape") {
|
|
63
|
-
let t =
|
|
64
|
+
let t = de({
|
|
64
65
|
defaultPrevented: e.defaultPrevented,
|
|
65
|
-
layerAbove:
|
|
66
|
+
layerAbove: ue({
|
|
66
67
|
target: e.target,
|
|
67
68
|
session: N.current,
|
|
68
69
|
doc: document
|
|
69
70
|
}),
|
|
70
|
-
transcriptOpen:
|
|
71
|
+
transcriptOpen: U
|
|
71
72
|
});
|
|
72
73
|
if (t === "ignore") return;
|
|
73
|
-
e.preventDefault(), t === "close-transcript" ?
|
|
74
|
+
e.preventDefault(), t === "close-transcript" ? W(!1) : m ? m.decline() : G ? E?.onClose() : C();
|
|
74
75
|
return;
|
|
75
76
|
}
|
|
76
77
|
if (e.key !== "Tab" || !V) return;
|
|
77
|
-
let t = (
|
|
78
|
+
let t = (U ? N.current?.querySelector("[data-testid=\"assistant-voice-transcript\"]") : N.current)?.querySelectorAll("button:not([disabled])");
|
|
78
79
|
if (!t || t.length === 0) return;
|
|
79
80
|
let n = t[0], r = t[t.length - 1];
|
|
80
81
|
n && r && (e.shiftKey && document.activeElement === n ? (e.preventDefault(), r.focus()) : !e.shiftKey && document.activeElement === r && (e.preventDefault(), n.focus()));
|
|
@@ -83,143 +84,140 @@ var m = ({ session: m, turns: Me = [], onSaveTranscript: Pe, onContinueInChat: F
|
|
|
83
84
|
}, [
|
|
84
85
|
C,
|
|
85
86
|
V,
|
|
86
|
-
|
|
87
|
-
|
|
87
|
+
U,
|
|
88
|
+
G,
|
|
88
89
|
E,
|
|
89
|
-
|
|
90
|
+
m
|
|
90
91
|
]);
|
|
91
|
-
let
|
|
92
|
-
letMeFinish:
|
|
93
|
-
imDone:
|
|
94
|
-
} : null,
|
|
95
|
-
|
|
96
|
-
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;
|
|
97
98
|
let e = document.activeElement;
|
|
98
99
|
e && e !== document.body || M.current?.focus();
|
|
99
|
-
}, [
|
|
100
|
-
let
|
|
101
|
-
snapshot:
|
|
102
|
-
capturing:
|
|
103
|
-
interrupting:
|
|
104
|
-
awaitingEndpoint:
|
|
105
|
-
}),
|
|
106
|
-
switch (
|
|
100
|
+
}, [mt]);
|
|
101
|
+
let Z = _e({
|
|
102
|
+
snapshot: d,
|
|
103
|
+
capturing: Ge,
|
|
104
|
+
interrupting: Ke,
|
|
105
|
+
awaitingEndpoint: qe
|
|
106
|
+
}), ht = (() => {
|
|
107
|
+
switch (Z) {
|
|
107
108
|
case "connecting": return k("voiceSession.connecting", "Starting the microphone…");
|
|
108
109
|
case "endpoint-grace": return k("voiceSession.endpointGrace", "Still listening — take your time");
|
|
109
110
|
case "interrupting": return k("voiceSession.interrupting", "Stopped — go ahead");
|
|
110
|
-
case "thinking": return k(
|
|
111
|
+
case "thinking": return k(ve.key, ve.fallback);
|
|
111
112
|
case "speaking": return k("voiceSession.speaking", "Speaking — tap to stop");
|
|
112
113
|
case "mic-error":
|
|
113
114
|
case "ended": return "";
|
|
114
115
|
case "listening": return A ? k("voiceSession.muted", "Microphone off") : k("voiceSession.listening", "Listening…");
|
|
115
|
-
default: return
|
|
116
|
+
default: return Z;
|
|
116
117
|
}
|
|
117
|
-
})(),
|
|
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({
|
|
118
119
|
tr: k,
|
|
119
|
-
stage:
|
|
120
|
+
stage: Z,
|
|
120
121
|
muted: A,
|
|
121
|
-
label:
|
|
122
|
-
}),
|
|
123
|
-
active: L && (
|
|
124
|
-
mic: L &&
|
|
125
|
-
pulseKey:
|
|
126
|
-
speaking:
|
|
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
|
|
127
129
|
});
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
privacyNotice: _
|
|
164
|
-
}), Ze) : null;
|
|
165
|
-
}
|
|
166
|
-
return /* @__PURE__ */ p("div", {
|
|
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", {
|
|
167
165
|
ref: N,
|
|
168
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"}`,
|
|
169
167
|
role: "dialog",
|
|
170
168
|
"aria-modal": V || void 0,
|
|
171
169
|
"aria-label": k("voiceSession.title", "Voice conversation"),
|
|
172
170
|
"data-testid": "assistant-voice-session",
|
|
173
|
-
[
|
|
171
|
+
[pe]: "",
|
|
174
172
|
children: [
|
|
175
|
-
I ? null : /* @__PURE__ */
|
|
173
|
+
I ? null : /* @__PURE__ */ u("button", {
|
|
176
174
|
ref: M,
|
|
177
175
|
type: "button",
|
|
178
176
|
onClick: C,
|
|
179
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`,
|
|
180
178
|
title: k("voiceSession.end", "End the voice conversation"),
|
|
181
179
|
"data-testid": "assistant-voice-end",
|
|
182
|
-
children: [/* @__PURE__ */
|
|
180
|
+
children: [/* @__PURE__ */ l(Me, {
|
|
183
181
|
className: V ? "size-6" : H ? "size-4" : "size-5",
|
|
184
182
|
"aria-hidden": "true"
|
|
185
|
-
}), /* @__PURE__ */
|
|
183
|
+
}), /* @__PURE__ */ l("span", {
|
|
186
184
|
className: `truncate whitespace-nowrap font-medium ${H ? "max-w-[3.5rem] text-xs" : "max-w-[7rem]"}`,
|
|
187
185
|
children: k("voiceSession.endShort", "End")
|
|
188
186
|
})]
|
|
189
187
|
}),
|
|
190
|
-
/* @__PURE__ */
|
|
191
|
-
className: `flex flex-col items-center ${I ? "min-h-[1.5rem]" : H ? `px-3 ${
|
|
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" : ""}`}`,
|
|
192
190
|
children: [
|
|
193
|
-
|
|
191
|
+
q ? /* @__PURE__ */ l("p", {
|
|
194
192
|
className: "max-w-xs text-center text-xs text-status-warning",
|
|
195
193
|
"data-testid": "assistant-voice-notice",
|
|
196
|
-
children:
|
|
194
|
+
children: f(p, k)
|
|
197
195
|
}) : null,
|
|
198
|
-
|
|
196
|
+
J ? /* @__PURE__ */ l("p", {
|
|
199
197
|
className: "max-w-xs text-center text-xs text-text-secondary",
|
|
200
198
|
"data-testid": "assistant-voice-avatar-hands-free",
|
|
201
|
-
children:
|
|
199
|
+
children: ot.handsFreeOff
|
|
202
200
|
}) : null,
|
|
203
|
-
/* @__PURE__ */
|
|
201
|
+
/* @__PURE__ */ l("span", {
|
|
204
202
|
className: "sr-only start-0 top-0",
|
|
205
203
|
role: "status",
|
|
206
204
|
"aria-live": "polite",
|
|
207
205
|
"aria-atomic": "true",
|
|
208
206
|
"data-testid": "assistant-voice-notice-announced",
|
|
209
|
-
children:
|
|
207
|
+
children: q && Fe(p) ? f(p, k) : J ? ot.handsFreeOff : null
|
|
210
208
|
}),
|
|
211
|
-
S ? /* @__PURE__ */
|
|
209
|
+
S ? /* @__PURE__ */ l("p", {
|
|
212
210
|
className: "max-w-xs text-center text-xs text-status-warning",
|
|
213
211
|
role: "status",
|
|
214
212
|
"aria-live": "polite",
|
|
215
213
|
"data-testid": "assistant-voice-attachment-notice",
|
|
216
214
|
children: S
|
|
217
215
|
}) : null,
|
|
218
|
-
O === void 0 ? null : /* @__PURE__ */
|
|
216
|
+
O === void 0 ? null : /* @__PURE__ */ u(Ne, { children: [O ? /* @__PURE__ */ l("p", {
|
|
219
217
|
className: "max-w-xs text-center text-xs text-text-secondary",
|
|
220
218
|
"data-testid": "assistant-voice-started-cue",
|
|
221
219
|
children: O
|
|
222
|
-
}) : null, /* @__PURE__ */
|
|
220
|
+
}) : null, /* @__PURE__ */ l("span", {
|
|
223
221
|
className: "sr-only start-0 top-0",
|
|
224
222
|
role: "status",
|
|
225
223
|
"aria-live": "polite",
|
|
@@ -230,69 +228,69 @@ var m = ({ session: m, turns: Me = [], onSaveTranscript: Pe, onContinueInChat: F
|
|
|
230
228
|
]
|
|
231
229
|
}),
|
|
232
230
|
(() => {
|
|
233
|
-
let e = /* @__PURE__ */
|
|
234
|
-
session:
|
|
231
|
+
let e = /* @__PURE__ */ l(r, {
|
|
232
|
+
session: d,
|
|
235
233
|
compact: H,
|
|
236
|
-
connecting:
|
|
237
|
-
onPress:
|
|
238
|
-
label:
|
|
239
|
-
}), t =
|
|
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", {
|
|
240
238
|
type: "button",
|
|
241
|
-
onClick: w ?
|
|
239
|
+
onClick: w ? X.imDone : X.letMeFinish,
|
|
242
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"}`,
|
|
243
241
|
title: w ? k("voiceSession.imDoneHint", "Send what you said now") : k("voiceSession.letMeFinishHint", "Pause sending until you tap “I’m done”"),
|
|
244
242
|
"data-testid": "assistant-voice-hold",
|
|
245
243
|
"data-holding": w ? "true" : "false",
|
|
246
244
|
children: w ? k("voiceSession.imDone", "I’m done") : k("voiceSession.letMeFinish", "Let me finish")
|
|
247
|
-
}) : null, n =
|
|
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", {
|
|
248
246
|
type: "button",
|
|
249
|
-
onClick:
|
|
250
|
-
disabled:
|
|
247
|
+
onClick: ne,
|
|
248
|
+
disabled: re,
|
|
251
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",
|
|
252
250
|
"data-testid": "assistant-voice-primary",
|
|
253
|
-
"data-state":
|
|
251
|
+
"data-state": Z,
|
|
254
252
|
"data-muted": A || void 0,
|
|
255
|
-
children: [n ? /* @__PURE__ */
|
|
253
|
+
children: [n ? /* @__PURE__ */ l(je, {
|
|
256
254
|
className: "size-4 fill-current",
|
|
257
255
|
"aria-hidden": "true"
|
|
258
|
-
}) :
|
|
256
|
+
}) : l(A ? De : Ee, {
|
|
259
257
|
className: "size-4",
|
|
260
258
|
"aria-hidden": "true"
|
|
261
259
|
}), n ? k("window.stopSpeaking", "Stop speaking") : A ? k("window.unmute", "Unmute") : k("window.mute", "Mute")]
|
|
262
|
-
}) : null,
|
|
260
|
+
}) : null, ae = t ? /* @__PURE__ */ u("div", {
|
|
263
261
|
className: "flex flex-col items-center gap-2",
|
|
264
262
|
children: [e, t]
|
|
265
|
-
}) : e,
|
|
263
|
+
}) : e, oe = I ? /* @__PURE__ */ u("div", {
|
|
266
264
|
className: "flex flex-col items-center gap-2",
|
|
267
|
-
children: [t,
|
|
268
|
-
}) : void 0,
|
|
269
|
-
return H ? /* @__PURE__ */
|
|
270
|
-
spokenChunks:
|
|
271
|
-
state:
|
|
272
|
-
caption:
|
|
273
|
-
statusText:
|
|
274
|
-
statusSuffix:
|
|
275
|
-
rotateStatus:
|
|
276
|
-
errorText:
|
|
277
|
-
control:
|
|
278
|
-
}) : /* @__PURE__ */
|
|
279
|
-
state:
|
|
280
|
-
userCaption:
|
|
281
|
-
spokenChunks:
|
|
282
|
-
assistantCaption:
|
|
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,
|
|
283
281
|
expanded: V,
|
|
284
|
-
statusText:
|
|
285
|
-
statusSuffix:
|
|
286
|
-
rotateStatus:
|
|
287
|
-
errorText:
|
|
288
|
-
control:
|
|
282
|
+
statusText: vt,
|
|
283
|
+
statusSuffix: Q,
|
|
284
|
+
rotateStatus: yt,
|
|
285
|
+
errorText: i,
|
|
286
|
+
control: ae,
|
|
289
287
|
compact: I || void 0,
|
|
290
|
-
compactControl:
|
|
288
|
+
compactControl: oe
|
|
291
289
|
});
|
|
292
290
|
})(),
|
|
293
|
-
T && !
|
|
291
|
+
T && !G && !I ? /* @__PURE__ */ l("div", {
|
|
294
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)]"}`,
|
|
295
|
-
children: /* @__PURE__ */
|
|
293
|
+
children: /* @__PURE__ */ l("button", {
|
|
296
294
|
type: "button",
|
|
297
295
|
onClick: () => {
|
|
298
296
|
P("panel"), T.onOpen();
|
|
@@ -302,22 +300,22 @@ var m = ({ session: m, turns: Me = [], onSaveTranscript: Pe, onContinueInChat: F
|
|
|
302
300
|
children: T.label
|
|
303
301
|
})
|
|
304
302
|
}) : null,
|
|
305
|
-
T && I ? /* @__PURE__ */
|
|
303
|
+
T && I ? /* @__PURE__ */ u("div", {
|
|
306
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",
|
|
307
305
|
"data-testid": "assistant-voice-proposal-chip-row",
|
|
308
306
|
children: [
|
|
309
|
-
/* @__PURE__ */
|
|
307
|
+
/* @__PURE__ */ l(Ae, {
|
|
310
308
|
className: "size-4 shrink-0 text-status-warning",
|
|
311
309
|
"aria-hidden": "true"
|
|
312
310
|
}),
|
|
313
|
-
T.status ? /* @__PURE__ */
|
|
311
|
+
T.status ? /* @__PURE__ */ l("p", {
|
|
314
312
|
role: "status",
|
|
315
313
|
"aria-live": "polite",
|
|
316
314
|
className: "min-w-0 flex-1 text-sm text-text-primary",
|
|
317
315
|
"data-testid": "assistant-voice-proposal-status",
|
|
318
316
|
children: T.status
|
|
319
|
-
}) : /* @__PURE__ */
|
|
320
|
-
/* @__PURE__ */
|
|
317
|
+
}) : /* @__PURE__ */ l("span", { className: "flex-1" }),
|
|
318
|
+
/* @__PURE__ */ l("button", {
|
|
321
319
|
type: "button",
|
|
322
320
|
onClick: T.onOpen,
|
|
323
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)]",
|
|
@@ -326,111 +324,111 @@ var m = ({ session: m, turns: Me = [], onSaveTranscript: Pe, onContinueInChat: F
|
|
|
326
324
|
})
|
|
327
325
|
]
|
|
328
326
|
}) : null,
|
|
329
|
-
E &&
|
|
327
|
+
E && G ? /* @__PURE__ */ u("div", {
|
|
330
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"}`,
|
|
331
329
|
"data-testid": "assistant-voice-proposal-tray",
|
|
332
|
-
children: [/* @__PURE__ */
|
|
330
|
+
children: [/* @__PURE__ */ l("div", {
|
|
333
331
|
className: "flex justify-end",
|
|
334
|
-
children: /* @__PURE__ */
|
|
332
|
+
children: /* @__PURE__ */ l("button", {
|
|
335
333
|
type: "button",
|
|
336
334
|
onClick: E.onClose,
|
|
337
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",
|
|
338
336
|
"aria-label": E.closeLabel,
|
|
339
337
|
"data-testid": "assistant-voice-proposal-tray-close",
|
|
340
|
-
children: /* @__PURE__ */
|
|
338
|
+
children: /* @__PURE__ */ l(Me, {
|
|
341
339
|
className: "size-4",
|
|
342
340
|
"aria-hidden": "true"
|
|
343
341
|
})
|
|
344
342
|
})
|
|
345
343
|
}), E.content]
|
|
346
344
|
}) : null,
|
|
347
|
-
|
|
345
|
+
m ? /* @__PURE__ */ l(le, {
|
|
348
346
|
view: B,
|
|
349
|
-
onContinue:
|
|
350
|
-
onNotNow:
|
|
347
|
+
onContinue: m.accept,
|
|
348
|
+
onNotNow: m.decline
|
|
351
349
|
}) : null,
|
|
352
|
-
|
|
353
|
-
turns:
|
|
354
|
-
onClose: () =>
|
|
355
|
-
onSave:
|
|
356
|
-
onContinueInChat:
|
|
357
|
-
renderAfterTurn:
|
|
350
|
+
U ? /* @__PURE__ */ l(oe, {
|
|
351
|
+
turns: Ie,
|
|
352
|
+
onClose: () => W(!1),
|
|
353
|
+
onSave: Re,
|
|
354
|
+
onContinueInChat: ze,
|
|
355
|
+
renderAfterTurn: Ze
|
|
358
356
|
}) : null,
|
|
359
|
-
|
|
357
|
+
v && !I ? /* @__PURE__ */ l("div", {
|
|
360
358
|
className: `absolute ${V ? "start-6 top-6" : H ? "start-11 top-2" : "start-3 top-3"}`,
|
|
361
|
-
children: /* @__PURE__ */
|
|
359
|
+
children: /* @__PURE__ */ l(t, {
|
|
362
360
|
onFiles: (e) => {
|
|
363
|
-
|
|
361
|
+
v(e), F || P((e) => e === "mini" ? "panel" : e);
|
|
364
362
|
},
|
|
365
|
-
onPickerOpen:
|
|
363
|
+
onPickerOpen: ft,
|
|
366
364
|
direction: "down",
|
|
367
|
-
canAddMore:
|
|
365
|
+
canAddMore: y,
|
|
368
366
|
disabled: x
|
|
369
367
|
})
|
|
370
368
|
}) : null,
|
|
371
|
-
(
|
|
369
|
+
(_.length > 0 || b > 0) && !H ? /* @__PURE__ */ l("div", {
|
|
372
370
|
className: I ? "w-full" : `absolute ${V ? "bottom-24 start-24 end-24" : "bottom-16 start-16 end-16"}`,
|
|
373
371
|
"data-testid": "assistant-voice-attachments",
|
|
374
|
-
children: /* @__PURE__ */
|
|
375
|
-
attachments:
|
|
376
|
-
onRemove:
|
|
377
|
-
onRetry:
|
|
378
|
-
preparingCount:
|
|
372
|
+
children: /* @__PURE__ */ l(n, {
|
|
373
|
+
attachments: _,
|
|
374
|
+
onRemove: He ?? (() => void 0),
|
|
375
|
+
onRetry: Ue ?? (() => void 0),
|
|
376
|
+
preparingCount: b,
|
|
379
377
|
disabled: x
|
|
380
378
|
})
|
|
381
379
|
}) : null,
|
|
382
|
-
I ? null : /* @__PURE__ */
|
|
380
|
+
I ? null : /* @__PURE__ */ l("button", {
|
|
383
381
|
type: "button",
|
|
384
|
-
onClick: () =>
|
|
382
|
+
onClick: () => W((e) => !e),
|
|
385
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`,
|
|
386
|
-
"aria-pressed":
|
|
384
|
+
"aria-pressed": U,
|
|
387
385
|
"aria-label": k("voiceSession.transcriptTitle", "Voice transcript"),
|
|
388
386
|
"data-testid": "assistant-voice-transcript-toggle",
|
|
389
|
-
children: /* @__PURE__ */
|
|
387
|
+
children: /* @__PURE__ */ l(ke, { className: V ? "size-6" : H ? "size-4" : "size-5" })
|
|
390
388
|
}),
|
|
391
|
-
F ? null : /* @__PURE__ */
|
|
389
|
+
F ? null : /* @__PURE__ */ l("button", {
|
|
392
390
|
type: "button",
|
|
393
|
-
onClick: () => P(
|
|
391
|
+
onClick: () => P(st),
|
|
394
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`,
|
|
395
|
-
"aria-label":
|
|
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"),
|
|
396
394
|
"data-testid": "assistant-voice-expand",
|
|
397
|
-
children: V ? /* @__PURE__ */
|
|
395
|
+
children: V ? /* @__PURE__ */ l(Oe, { className: "size-5" }) : /* @__PURE__ */ l(Te, { className: H ? "size-4" : "size-5" })
|
|
398
396
|
}),
|
|
399
|
-
I ? /* @__PURE__ */
|
|
397
|
+
I ? /* @__PURE__ */ u("div", {
|
|
400
398
|
className: "flex w-full items-center gap-2 pt-2",
|
|
401
399
|
"data-testid": "assistant-voice-controls",
|
|
402
400
|
children: [
|
|
403
|
-
|
|
404
|
-
onFiles: (e) =>
|
|
405
|
-
onPickerOpen:
|
|
401
|
+
v ? /* @__PURE__ */ l(t, {
|
|
402
|
+
onFiles: (e) => v(e),
|
|
403
|
+
onPickerOpen: ft,
|
|
406
404
|
direction: "up",
|
|
407
|
-
canAddMore:
|
|
405
|
+
canAddMore: y,
|
|
408
406
|
disabled: x
|
|
409
407
|
}) : null,
|
|
410
|
-
/* @__PURE__ */
|
|
408
|
+
/* @__PURE__ */ u("button", {
|
|
411
409
|
type: "button",
|
|
412
|
-
onClick: () =>
|
|
410
|
+
onClick: () => W((e) => !e),
|
|
413
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)]",
|
|
414
|
-
"aria-expanded":
|
|
412
|
+
"aria-expanded": U,
|
|
415
413
|
"data-testid": "assistant-voice-transcript-toggle",
|
|
416
|
-
children: [/* @__PURE__ */
|
|
414
|
+
children: [/* @__PURE__ */ l(ke, {
|
|
417
415
|
className: "size-4 shrink-0",
|
|
418
416
|
"aria-hidden": "true"
|
|
419
|
-
}), /* @__PURE__ */
|
|
417
|
+
}), /* @__PURE__ */ l("span", {
|
|
420
418
|
className: "truncate",
|
|
421
|
-
children:
|
|
419
|
+
children: U ? k("window.hideTranscript", "Hide transcript") : k("window.showTranscript", "Show transcript")
|
|
422
420
|
})]
|
|
423
421
|
}),
|
|
424
|
-
/* @__PURE__ */
|
|
422
|
+
/* @__PURE__ */ u("button", {
|
|
425
423
|
ref: M,
|
|
426
424
|
type: "button",
|
|
427
425
|
onClick: C,
|
|
428
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)]",
|
|
429
427
|
"data-testid": "assistant-voice-end",
|
|
430
|
-
children: [/* @__PURE__ */
|
|
428
|
+
children: [/* @__PURE__ */ l(Me, {
|
|
431
429
|
className: "size-4 shrink-0",
|
|
432
430
|
"aria-hidden": "true"
|
|
433
|
-
}), /* @__PURE__ */
|
|
431
|
+
}), /* @__PURE__ */ l("span", {
|
|
434
432
|
className: "truncate",
|
|
435
433
|
children: k("window.endVoice", "End voice")
|
|
436
434
|
})]
|
|
@@ -440,13 +438,13 @@ var m = ({ session: m, turns: Me = [], onSaveTranscript: Pe, onContinueInChat: F
|
|
|
440
438
|
]
|
|
441
439
|
});
|
|
442
440
|
};
|
|
443
|
-
function
|
|
444
|
-
return typeof e == "string" ?
|
|
441
|
+
function f(e, t) {
|
|
442
|
+
return typeof e == "string" ? Ie(e, t) : e.text;
|
|
445
443
|
}
|
|
446
|
-
function
|
|
444
|
+
function Fe(e) {
|
|
447
445
|
return e !== null && (typeof e != "string" || e === "reply-not-heard");
|
|
448
446
|
}
|
|
449
|
-
function
|
|
447
|
+
function Ie(e, t) {
|
|
450
448
|
switch (e) {
|
|
451
449
|
case "network": return t("voiceSession.noticeNetwork", "Speech recognition lost its connection. Check your network — it will retry.");
|
|
452
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.");
|
|
@@ -458,7 +456,7 @@ function Me(e, t) {
|
|
|
458
456
|
default: return e;
|
|
459
457
|
}
|
|
460
458
|
}
|
|
461
|
-
function
|
|
459
|
+
function Le(e, t) {
|
|
462
460
|
switch (e) {
|
|
463
461
|
case "mic-denied": return t("voiceSession.micDenied", "Microphone access is blocked. Allow it in your browser settings to talk.");
|
|
464
462
|
case "no-speech-support": return t("voiceSession.noSpeechSupport", "This browser cannot listen. Try a different browser, or type instead.");
|
|
@@ -466,4 +464,4 @@ function Ne(e, t) {
|
|
|
466
464
|
default: return e;
|
|
467
465
|
}
|
|
468
466
|
}
|
|
469
|
-
export {
|
|
467
|
+
export { d as AssistantVoiceSession };
|