@burdenoff/fe-libs 2026.1014.4 → 2026.1015.1
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/avatarPreferences.d.ts +61 -14
- package/dist/shared/assistant/avatar/avatarPreferences.js +54 -21
- package/dist/shared/assistant/avatar/live/LiveAvatarTabView.d.ts +33 -0
- package/dist/shared/assistant/avatar/live/LiveAvatarTabView.js +278 -0
- package/dist/shared/assistant/avatar/live/avatarSessionClient.d.ts +5 -0
- package/dist/shared/assistant/avatar/live/avatarSessionClient.js +25 -6
- package/dist/shared/assistant/avatar/live/avatarVoice.d.ts +43 -0
- package/dist/shared/assistant/avatar/live/avatarVoice.js +45 -0
- package/dist/shared/assistant/avatar/live/createLiveAvatarSeam.d.ts +21 -1
- package/dist/shared/assistant/avatar/live/createLiveAvatarSeam.js +74 -24
- package/dist/shared/assistant/avatar/live/liveAvatarController.d.ts +47 -8
- package/dist/shared/assistant/avatar/live/liveAvatarController.js +244 -161
- package/dist/shared/assistant/avatar/live/liveAvatarStatus.d.ts +2 -2
- package/dist/shared/assistant/avatar/live/liveAvatarStatus.js +11 -4
- package/dist/shared/assistant/avatar/useAvatarCopy.d.ts +52 -21
- package/dist/shared/assistant/avatar/useAvatarCopy.js +93 -48
- package/dist/shared/assistant/i18nManifest.d.ts +24 -2
- package/dist/shared/assistant/i18nManifest.js +24 -2
- package/dist/shared/assistant/index.d.ts +5 -0
- package/dist/shared/assistant/speech/hostedVoiceCatalogue.d.ts +19 -0
- package/dist/shared/assistant/speech/hostedVoiceCatalogue.js +25 -18
- package/dist/shared/assistant/ui/AIAssistantPanel.js +136 -103
- package/dist/shared/assistant/ui/AssistantAvatarTabs.d.ts +10 -0
- package/dist/shared/assistant/ui/AssistantAvatarTabs.js +48 -0
- package/dist/shared/assistant/ui/AssistantChatArea.js +1260 -1199
- package/dist/shared/assistant/ui/assistantLiveAvatarSeam.d.ts +165 -5
- package/dist/shared/assistant/ui/assistantLiveAvatarSeam.js +141 -59
- package/dist/shared/assistant/ui/avatar/AssistantAvatarTab.d.ts +13 -0
- package/dist/shared/assistant/ui/avatar/AssistantAvatarTab.js +70 -0
- package/dist/shared/assistant/ui/composer/AssistantComposer.d.ts +18 -0
- package/dist/shared/assistant/ui/composer/AssistantComposer.js +121 -102
- package/dist/shared/assistant/ui/composer/AssistantHandsFreeInterruptToggle.d.ts +9 -0
- package/dist/shared/assistant/ui/composer/AssistantHandsFreeInterruptToggle.js +28 -14
- package/dist/shared/assistant/ui/panelOverlays.d.ts +24 -3
- package/dist/shared/assistant/ui/panelOverlays.js +11 -10
- package/dist/shared/assistant/ui/useVoiceSession.js +234 -233
- package/dist/shared/assistant/ui/voice/AssistantVoiceSession.d.ts +6 -0
- package/dist/shared/assistant/ui/voice/AssistantVoiceSession.js +161 -149
- package/dist/shared/assistant/ui/voice/VoiceMiniController.js +7 -7
- package/dist/shared/assistant/ui/voice/VoiceStage.js +7 -7
- package/dist/shared/assistant/ui/voice/voiceStartGate.d.ts +57 -0
- package/dist/shared/assistant/ui/voice/voiceStartGate.js +9 -0
- package/dist/shared/assistant/voice/handsfree/handsFreeSetting.d.ts +7 -1
- package/dist/shared/assistant/voice/handsfree/handsFreeSetting.js +2 -2
- package/dist/shared-assistant.js +259 -254
- package/package.json +1 -1
|
@@ -3,253 +3,254 @@ import { planSubmitTimer as t, resolveVoiceGraceMs as n } from "../voice/handsFr
|
|
|
3
3
|
import { readHandsFreeOverride as r, resolveHandsFreeEnabled as ee } from "../voice/handsfree/handsFreeSetting.js";
|
|
4
4
|
import { silencePlaybackReference as te } from "../voice/handsfree/playbackReference.js";
|
|
5
5
|
import { speechFeed as ne } from "../speech/speechFeed.js";
|
|
6
|
-
import { INITIAL_SESSION as re, INTERRUPT_MAX_MS as ie, NOTHING_HEARD as
|
|
7
|
-
import { useHandsFreeInterrupt as
|
|
8
|
-
import { isTurnSuperseded as
|
|
9
|
-
import { captionChunks as
|
|
10
|
-
import { turnClockMs as
|
|
11
|
-
import { useAssistantSpeech as
|
|
12
|
-
import {
|
|
6
|
+
import { INITIAL_SESSION as re, INTERRUPT_MAX_MS as ie, NOTHING_HEARD as i, advanceHeardClock as ae, isCapturing as a, isSubmittable as oe, planListeningHold as se, planReplyConsumption as ce, planVoiceAnnouncement as le, shouldRecognise as ue, spokenSoFar as o, voiceSessionReducer as de } from "../voice/voiceSession.js";
|
|
7
|
+
import { useHandsFreeInterrupt as fe } from "../voice/handsfree/useHandsFreeInterrupt.js";
|
|
8
|
+
import { isTurnSuperseded as pe } from "../voice/supersededTurns.js";
|
|
9
|
+
import { captionChunks as me } from "../voice/speechPlayback.js";
|
|
10
|
+
import { turnClockMs as s } from "../turnTimeline.js";
|
|
11
|
+
import { useAssistantSpeech as he } from "./AssistantSpeechProvider.js";
|
|
12
|
+
import { useLiveAvatarOn as ge } from "./assistantLiveAvatarSeam.js";
|
|
13
|
+
import { useCallback as c, useEffect as l, useLayoutEffect as _e, useMemo as ve, useReducer as ye, useRef as u, useState as d } from "react";
|
|
13
14
|
//#region src/shared/assistant/ui/useVoiceSession.ts
|
|
14
15
|
var be = 4e3, xe = 2500, Se = 5e3, Ce = 12e3, we = "data:audio/wav;base64,UklGRiQAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQAAAAA=";
|
|
15
|
-
function Te({ onSubmit: Te, latestReply:
|
|
16
|
-
let
|
|
16
|
+
function Te({ onSubmit: Te, latestReply: f, language: p, graceMs: Ee, onSupersede: De, handsFreeInterrupt: Oe, handsFreeStreamNoticeAccepted: ke, onAcceptHandsFreeStreamNotice: Ae, onBargeIn: m }) {
|
|
17
|
+
let h = n(Ee), g = u(null), [_, v] = ye(c((e, t) => de(e, t, g.current), []), re), y = he(), { setSessionSpeaking: b, setSessionMicOpen: x, speakingMessageId: S, stop: C } = y, w = u(y.toggle), je = y.toggle;
|
|
17
18
|
_e(() => {
|
|
18
|
-
|
|
19
|
-
}, [
|
|
20
|
-
let
|
|
21
|
-
|
|
22
|
-
let
|
|
23
|
-
|
|
24
|
-
}, []),
|
|
19
|
+
w.current = je;
|
|
20
|
+
}, [je]);
|
|
21
|
+
let T = u(null), E = u({}), D = u(i), O = u(null), k = u(!1), A = u(null), [Me, j] = d(null), [M, N] = d(!1), [Ne, P] = d(!1), [F, I] = d(!1), L = u(_);
|
|
22
|
+
L.current = _;
|
|
23
|
+
let R = u([]), z = u(null), B = u(!1), V = c(() => {
|
|
24
|
+
R.current = [], z.current = null, B.current = !1;
|
|
25
|
+
}, []), H = c(() => {
|
|
25
26
|
for (;;) {
|
|
26
|
-
let e =
|
|
27
|
+
let e = R.current.shift();
|
|
27
28
|
if (!e) return !1;
|
|
28
29
|
if (!(e.stillWanted && !e.stillWanted())) {
|
|
29
|
-
|
|
30
|
+
z.current = e, g.current = g.current ? `${g.current} ${e.text}` : e.text;
|
|
30
31
|
try {
|
|
31
|
-
|
|
32
|
+
w.current(e.id, e.text, e.lang);
|
|
32
33
|
} catch {
|
|
33
|
-
|
|
34
|
+
z.current = null;
|
|
34
35
|
continue;
|
|
35
36
|
}
|
|
36
37
|
return !0;
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
|
-
}, []),
|
|
40
|
-
let t =
|
|
40
|
+
}, []), U = u(!1), Pe = c((e) => {
|
|
41
|
+
let t = se({
|
|
41
42
|
requested: e,
|
|
42
|
-
held:
|
|
43
|
-
muted:
|
|
43
|
+
held: U.current,
|
|
44
|
+
muted: L.current.muted
|
|
44
45
|
});
|
|
45
|
-
|
|
46
|
+
U.current = t.held, t.mute !== null && v({
|
|
46
47
|
type: "mute",
|
|
47
48
|
muted: t.mute
|
|
48
49
|
});
|
|
49
|
-
}, []),
|
|
50
|
-
let t =
|
|
51
|
-
t !== "drop" && (
|
|
52
|
-
}, []), Fe =
|
|
53
|
-
if (
|
|
54
|
-
|
|
50
|
+
}, []), W = c((e) => {
|
|
51
|
+
let t = le(L.current);
|
|
52
|
+
t !== "drop" && (z.current?.id === e.id || R.current.some((t) => t.id === e.id) || (R.current.push(e), t === "start" && !B.current && (B.current = !0, v({ type: "announce" }))));
|
|
53
|
+
}, []), Fe = c((e) => {
|
|
54
|
+
if (L.current.phase !== "thinking") {
|
|
55
|
+
W(e);
|
|
55
56
|
return;
|
|
56
57
|
}
|
|
57
|
-
|
|
58
|
-
}, [
|
|
59
|
-
Ie.current =
|
|
60
|
-
if (
|
|
61
|
-
let e =
|
|
62
|
-
|
|
58
|
+
R.current.push(e), B.current = !0, v({ type: "answered-locally" });
|
|
59
|
+
}, [W]), Ie = u(f);
|
|
60
|
+
Ie.current = f, l(() => {
|
|
61
|
+
if (_.phase === "speaking") {
|
|
62
|
+
let e = A.current;
|
|
63
|
+
g.current = e && O.current === e.id && f?.id !== e.id ? e.text : f?.text ?? null;
|
|
63
64
|
return;
|
|
64
65
|
}
|
|
65
|
-
if (
|
|
66
|
+
if (g.current === null) return;
|
|
66
67
|
let e = setTimeout(() => {
|
|
67
|
-
|
|
68
|
+
g.current = null;
|
|
68
69
|
}, xe);
|
|
69
70
|
return () => clearTimeout(e);
|
|
70
|
-
}, [
|
|
71
|
-
let
|
|
72
|
-
|
|
73
|
-
let
|
|
74
|
-
|
|
71
|
+
}, [_.phase, f]);
|
|
72
|
+
let G = u(p);
|
|
73
|
+
G.current = p;
|
|
74
|
+
let K = c((e, t) => {
|
|
75
|
+
v({
|
|
75
76
|
type: "speech",
|
|
76
77
|
transcript: e,
|
|
77
78
|
final: t,
|
|
78
79
|
at: Date.now(),
|
|
79
|
-
language:
|
|
80
|
+
language: G.current
|
|
80
81
|
});
|
|
81
|
-
}, []), Le =
|
|
82
|
-
|
|
82
|
+
}, []), Le = c((e, t, n) => {
|
|
83
|
+
v({
|
|
83
84
|
type: "speech",
|
|
84
85
|
transcript: e,
|
|
85
86
|
final: t,
|
|
86
87
|
at: Date.now(),
|
|
87
|
-
language: n ??
|
|
88
|
+
language: n ?? G.current,
|
|
88
89
|
gated: !0
|
|
89
90
|
});
|
|
90
|
-
}, []),
|
|
91
|
-
|
|
92
|
-
}, [
|
|
93
|
-
onFinalize:
|
|
94
|
-
language:
|
|
95
|
-
}), ze =
|
|
96
|
-
ze.current =
|
|
97
|
-
let Be =
|
|
98
|
-
|
|
99
|
-
}, [
|
|
100
|
-
enabled: ee(Oe, r()),
|
|
101
|
-
phase:
|
|
102
|
-
muted:
|
|
103
|
-
language:
|
|
91
|
+
}, []), q = u(0), Re = c(() => {
|
|
92
|
+
V(), C(), q.current = Date.now(), N(!0), v({ type: "interrupt" });
|
|
93
|
+
}, [C, V]), J = e({
|
|
94
|
+
onFinalize: c((e) => K(e, !0), [K]),
|
|
95
|
+
language: p
|
|
96
|
+
}), ze = u(m);
|
|
97
|
+
ze.current = m;
|
|
98
|
+
let Be = c(() => {
|
|
99
|
+
V(), te(), C(), q.current = Date.now(), N(!0), v({ type: "interrupt" }), ze.current?.();
|
|
100
|
+
}, [C, V]), Ve = ge(), Y = fe({
|
|
101
|
+
enabled: ee(Oe, r(), Ve),
|
|
102
|
+
phase: _.phase,
|
|
103
|
+
muted: _.muted,
|
|
104
|
+
language: p,
|
|
104
105
|
streamNoticeAccepted: ke ?? null,
|
|
105
106
|
onAcceptStreamNotice: Ae,
|
|
106
107
|
onBargeIn: Be,
|
|
107
108
|
onTranscript: Le
|
|
108
|
-
}),
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}, [
|
|
112
|
-
|
|
109
|
+
}), He = Y.mode === "notice", X = J.isListening || Y.suppressWebSpeech && Y.mode === "active";
|
|
110
|
+
l(() => {
|
|
111
|
+
J.interim && K(J.interim, !1);
|
|
112
|
+
}, [J.interim, K]), l(() => {
|
|
113
|
+
T.current && clearTimeout(T.current), P(!1), D.current = ae(D.current, _, s());
|
|
113
114
|
let e = t({
|
|
114
|
-
phase:
|
|
115
|
-
muted:
|
|
116
|
-
spoken:
|
|
117
|
-
holding:
|
|
118
|
-
graceMs:
|
|
115
|
+
phase: _.phase,
|
|
116
|
+
muted: _.muted,
|
|
117
|
+
spoken: o(_),
|
|
118
|
+
holding: F,
|
|
119
|
+
graceMs: h
|
|
119
120
|
});
|
|
120
121
|
if (!e.arm) return;
|
|
121
|
-
let n = setTimeout(() =>
|
|
122
|
-
return
|
|
123
|
-
|
|
124
|
-
speechEnded:
|
|
122
|
+
let n = setTimeout(() => P(!0), Math.min(800, e.delayMs)), r = s();
|
|
123
|
+
return T.current = setTimeout(() => {
|
|
124
|
+
E.current = {
|
|
125
|
+
speechEnded: D.current.at ?? r,
|
|
125
126
|
graceStarted: r,
|
|
126
|
-
graceEnded:
|
|
127
|
-
},
|
|
127
|
+
graceEnded: s()
|
|
128
|
+
}, v({
|
|
128
129
|
type: "silence",
|
|
129
130
|
at: Date.now()
|
|
130
131
|
});
|
|
131
132
|
}, e.delayMs), () => {
|
|
132
|
-
clearTimeout(n),
|
|
133
|
+
clearTimeout(n), T.current && clearTimeout(T.current);
|
|
133
134
|
};
|
|
134
135
|
}, [
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
]),
|
|
139
|
-
(
|
|
140
|
-
}, [
|
|
141
|
-
if (!
|
|
142
|
-
let e = Date.now() -
|
|
136
|
+
_,
|
|
137
|
+
F,
|
|
138
|
+
h
|
|
139
|
+
]), l(() => {
|
|
140
|
+
(_.phase !== "listening" || _.muted) && I(!1);
|
|
141
|
+
}, [_.phase, _.muted]), l(() => {
|
|
142
|
+
if (!M) return;
|
|
143
|
+
let e = Date.now() - q.current, t = X ? Math.max(0, 500 - e) : Math.max(0, ie - e), n = setTimeout(() => N(!1), t);
|
|
143
144
|
return () => clearTimeout(n);
|
|
144
|
-
}, [
|
|
145
|
-
let
|
|
146
|
-
|
|
147
|
-
if (
|
|
148
|
-
|
|
149
|
-
let e =
|
|
150
|
-
e && Te(e,
|
|
151
|
-
}, [
|
|
152
|
-
let e =
|
|
153
|
-
e.claim && (
|
|
145
|
+
}, [M, X]);
|
|
146
|
+
let Ue = u("");
|
|
147
|
+
_.phase === "listening" && (Ue.current = o(_)), l(() => {
|
|
148
|
+
if (_.phase !== "thinking") return;
|
|
149
|
+
x(!1), V();
|
|
150
|
+
let e = Ue.current.trim();
|
|
151
|
+
e && Te(e, Q.current ?? `vs-orphan-${Date.now().toString(36)}`, E.current, { correction: L.current.correcting }), E.current = {}, D.current = i;
|
|
152
|
+
}, [_.phase]), l(() => {
|
|
153
|
+
let e = ce(f?.id, _.phase, O.current, pe(f?.id));
|
|
154
|
+
e.claim && (O.current = f?.id ?? null, e.advance && f && v({
|
|
154
155
|
type: "reply",
|
|
155
|
-
text:
|
|
156
|
+
text: f.text
|
|
156
157
|
}));
|
|
157
|
-
}, [
|
|
158
|
-
if (
|
|
159
|
-
if (
|
|
160
|
-
|
|
158
|
+
}, [f, _.phase]), l(() => {
|
|
159
|
+
if (S === null || _.phase !== "thinking" || O.current === S) return;
|
|
160
|
+
if (pe(S)) {
|
|
161
|
+
C();
|
|
161
162
|
return;
|
|
162
163
|
}
|
|
163
|
-
let e = ne.peek(
|
|
164
|
-
!e || e.channel !== "voice" || e.voiceSessionId === void 0 || e.voiceSessionId !==
|
|
165
|
-
id:
|
|
164
|
+
let e = ne.peek(S);
|
|
165
|
+
!e || e.channel !== "voice" || e.voiceSessionId === void 0 || e.voiceSessionId !== Q.current || (O.current = S, A.current = {
|
|
166
|
+
id: S,
|
|
166
167
|
text: e.text
|
|
167
|
-
},
|
|
168
|
+
}, v({
|
|
168
169
|
type: "reply-audio-started",
|
|
169
|
-
replyId:
|
|
170
|
+
replyId: S
|
|
170
171
|
}));
|
|
171
172
|
}, [
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
]),
|
|
176
|
-
let e =
|
|
177
|
-
|
|
178
|
-
}, [
|
|
179
|
-
|
|
180
|
-
}, [
|
|
181
|
-
if (
|
|
173
|
+
S,
|
|
174
|
+
_.phase,
|
|
175
|
+
C
|
|
176
|
+
]), l(() => {
|
|
177
|
+
let e = S !== null;
|
|
178
|
+
k.current && !e && (z.current = null, (L.current.phase !== "speaking" || !H()) && v({ type: "speech-ended" })), k.current = e;
|
|
179
|
+
}, [S, H]), l(() => {
|
|
180
|
+
_.phase !== "listening" && j((e) => e === "nothing-heard" ? null : e);
|
|
181
|
+
}, [_.phase]), l(() => {
|
|
182
|
+
if (_.phase !== "speaking" || S !== null) return;
|
|
182
183
|
let e = setTimeout(() => {
|
|
183
|
-
|
|
184
|
+
k.current || (V(), v({ type: "speech-ended" }));
|
|
184
185
|
}, be);
|
|
185
186
|
return () => clearTimeout(e);
|
|
186
187
|
}, [
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
188
|
+
_.phase,
|
|
189
|
+
S,
|
|
190
|
+
V
|
|
190
191
|
]);
|
|
191
|
-
let
|
|
192
|
-
|
|
193
|
-
if (
|
|
194
|
-
let { phase: e } =
|
|
195
|
-
e === "idle" || e === "ended" || e === "thinking" ||
|
|
196
|
-
}, [
|
|
197
|
-
|
|
198
|
-
}, [
|
|
199
|
-
let
|
|
200
|
-
|
|
201
|
-
let
|
|
202
|
-
|
|
203
|
-
let e =
|
|
204
|
-
e !==
|
|
192
|
+
let Z = y.outputNotCleared;
|
|
193
|
+
l(() => {
|
|
194
|
+
if (Z === null || O.current !== Z.messageId) return;
|
|
195
|
+
let { phase: e } = L.current;
|
|
196
|
+
e === "idle" || e === "ended" || e === "thinking" || j("reply-not-heard");
|
|
197
|
+
}, [Z]), l(() => {
|
|
198
|
+
_.phase === "listening" || _.phase === "thinking" || j((e) => e === "reply-not-heard" ? null : e);
|
|
199
|
+
}, [_.phase]);
|
|
200
|
+
let We = u(De);
|
|
201
|
+
We.current = De;
|
|
202
|
+
let Ge = u(0);
|
|
203
|
+
l(() => {
|
|
204
|
+
let e = _.superseded;
|
|
205
|
+
e !== Ge.current && (Ge.current = e, e !== 0 && (V(), C(), We.current?.()));
|
|
205
206
|
}, [
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
]),
|
|
210
|
-
|
|
207
|
+
_.superseded,
|
|
208
|
+
V,
|
|
209
|
+
C
|
|
210
|
+
]), l(() => {
|
|
211
|
+
x(a(_)), ue(_) && !Y.suppressWebSpeech ? J.isActive || J.start("auto") : J.isActive && J.stop();
|
|
211
212
|
}, [
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
]),
|
|
217
|
-
|
|
218
|
-
}, [
|
|
219
|
-
|
|
213
|
+
_,
|
|
214
|
+
J,
|
|
215
|
+
x,
|
|
216
|
+
Y.suppressWebSpeech
|
|
217
|
+
]), l(() => {
|
|
218
|
+
_.phase !== "speaking" || !B.current || (B.current = !1, H() || v({ type: "speech-ended" }));
|
|
219
|
+
}, [_.phase, H]), l(() => {
|
|
220
|
+
J.error === "not-allowed" || J.error === "audio-capture" ? v({
|
|
220
221
|
type: "fail",
|
|
221
222
|
error: "mic-denied"
|
|
222
|
-
}) :
|
|
223
|
+
}) : J.error === "language-not-supported" ? v({
|
|
223
224
|
type: "fail",
|
|
224
225
|
error: "no-speech-support"
|
|
225
|
-
}) :
|
|
226
|
-
}, [
|
|
227
|
-
|
|
228
|
-
}, [
|
|
229
|
-
if (
|
|
230
|
-
let e = setTimeout(() =>
|
|
226
|
+
}) : J.error === "network" ? j("network") : J.error === "unknown" && j("recognition-failed");
|
|
227
|
+
}, [J.error]), l(() => {
|
|
228
|
+
J.error !== null || !X || j((e) => e === "network" || e === "recognition-failed" ? null : e);
|
|
229
|
+
}, [J.error, X]), l(() => {
|
|
230
|
+
if (X && j((e) => e === "not-capturing" ? null : e), !a(_) || X || He) return;
|
|
231
|
+
let e = setTimeout(() => j("not-capturing"), Se);
|
|
231
232
|
return () => clearTimeout(e);
|
|
232
233
|
}, [
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
]),
|
|
237
|
-
if (
|
|
238
|
-
let e = setTimeout(() =>
|
|
234
|
+
_,
|
|
235
|
+
X,
|
|
236
|
+
He
|
|
237
|
+
]), l(() => {
|
|
238
|
+
if (_.phase !== "listening" || _.muted || !X || o(_) !== "") return;
|
|
239
|
+
let e = setTimeout(() => j("nothing-heard"), Ce);
|
|
239
240
|
return () => clearTimeout(e);
|
|
240
|
-
}, [
|
|
241
|
-
|
|
242
|
-
}, [
|
|
243
|
-
let
|
|
244
|
-
if (
|
|
245
|
-
|
|
241
|
+
}, [_, X]), l(() => {
|
|
242
|
+
o(_) !== "" && j(null);
|
|
243
|
+
}, [_]);
|
|
244
|
+
let Q = u(null), Ke = c(() => {
|
|
245
|
+
if (N(!1), P(!1), I(!1), V(), U.current = !1, !J.isSupported) {
|
|
246
|
+
v({
|
|
246
247
|
type: "fail",
|
|
247
248
|
error: "no-speech-support"
|
|
248
249
|
});
|
|
249
250
|
return;
|
|
250
251
|
}
|
|
251
|
-
if (
|
|
252
|
-
|
|
252
|
+
if (y.isBlocked) {
|
|
253
|
+
v({
|
|
253
254
|
type: "fail",
|
|
254
255
|
error: "no-voice-support"
|
|
255
256
|
});
|
|
@@ -268,95 +269,95 @@ function Te({ onSubmit: Te, latestReply: d, language: f, graceMs: Ee, onSupersed
|
|
|
268
269
|
e.volume = 0, e.play().catch(() => {});
|
|
269
270
|
}
|
|
270
271
|
} catch {}
|
|
271
|
-
|
|
272
|
+
b(!0), j(null), O.current = Ie.current?.id ?? null, A.current = null, Q.current = `vs-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`, v({ type: "start" });
|
|
272
273
|
}, [
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
]),
|
|
278
|
-
|
|
274
|
+
J.isSupported,
|
|
275
|
+
y.isBlocked,
|
|
276
|
+
b,
|
|
277
|
+
V
|
|
278
|
+
]), qe = c(() => {
|
|
279
|
+
N(!1), P(!1), I(!1), V(), U.current = !1, Q.current = null, v({ type: "end" }), C(), b(!1);
|
|
279
280
|
}, [
|
|
281
|
+
C,
|
|
280
282
|
b,
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
speechEnded: T.current.at ?? t,
|
|
283
|
+
V
|
|
284
|
+
]), Je = c((e) => Q.current === e, []), Ye = c(() => {
|
|
285
|
+
let e = L.current;
|
|
286
|
+
e.phase !== "listening" || e.muted || I(!0);
|
|
287
|
+
}, []), Xe = c(() => {
|
|
288
|
+
I(!1);
|
|
289
|
+
let e = L.current;
|
|
290
|
+
if (e.phase !== "listening" || e.muted || !oe(o(e))) return;
|
|
291
|
+
let t = s();
|
|
292
|
+
E.current = {
|
|
293
|
+
speechEnded: D.current.at ?? t,
|
|
293
294
|
graceStarted: t,
|
|
294
295
|
graceEnded: t
|
|
295
|
-
},
|
|
296
|
+
}, v({
|
|
296
297
|
type: "silence",
|
|
297
298
|
at: Date.now()
|
|
298
299
|
});
|
|
299
|
-
}, []),
|
|
300
|
-
|
|
300
|
+
}, []), Ze = c(() => {
|
|
301
|
+
v({
|
|
301
302
|
type: "mute",
|
|
302
|
-
muted: !
|
|
303
|
+
muted: !L.current.muted
|
|
303
304
|
});
|
|
304
305
|
}, []);
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
}, [
|
|
308
|
-
let $ =
|
|
306
|
+
l(() => () => {
|
|
307
|
+
b(!1), x(!1);
|
|
308
|
+
}, [b, x]);
|
|
309
|
+
let $ = me(y.spokenChunks, _.phase, S);
|
|
309
310
|
return ve(() => ({
|
|
310
|
-
session:
|
|
311
|
-
notice:
|
|
311
|
+
session: _,
|
|
312
|
+
notice: Me ?? (Y.fallbackReason !== null && Y.fallbackReason !== "notice-declined" ? "hands-free-fallback" : Y.nothingHeard ? "hands-free-nothing-heard" : null),
|
|
312
313
|
spokenChunks: $,
|
|
313
|
-
capturing:
|
|
314
|
-
active:
|
|
315
|
-
interrupting:
|
|
314
|
+
capturing: X,
|
|
315
|
+
active: _.phase !== "idle" && (_.phase !== "ended" || _.error !== null),
|
|
316
|
+
interrupting: M,
|
|
316
317
|
awaitingEndpoint: Ne,
|
|
317
|
-
holding:
|
|
318
|
-
correcting:
|
|
318
|
+
holding: F,
|
|
319
|
+
correcting: _.correcting,
|
|
319
320
|
handsFree: {
|
|
320
|
-
mode:
|
|
321
|
-
nothingHeard:
|
|
322
|
-
transportKind:
|
|
323
|
-
fallbackReason:
|
|
324
|
-
privacyNotice:
|
|
321
|
+
mode: Y.mode,
|
|
322
|
+
nothingHeard: Y.nothingHeard,
|
|
323
|
+
transportKind: Y.transportKind,
|
|
324
|
+
fallbackReason: Y.fallbackReason,
|
|
325
|
+
privacyNotice: Y.privacyNotice
|
|
325
326
|
},
|
|
326
|
-
available:
|
|
327
|
-
start:
|
|
328
|
-
end:
|
|
329
|
-
isCurrentSession:
|
|
330
|
-
toggleMute:
|
|
327
|
+
available: J.isSupported && !y.isBlocked,
|
|
328
|
+
start: Ke,
|
|
329
|
+
end: qe,
|
|
330
|
+
isCurrentSession: Je,
|
|
331
|
+
toggleMute: Ze,
|
|
331
332
|
interrupt: Re,
|
|
332
|
-
letMeFinish:
|
|
333
|
-
imDone:
|
|
334
|
-
announce:
|
|
333
|
+
letMeFinish: Ye,
|
|
334
|
+
imDone: Xe,
|
|
335
|
+
announce: W,
|
|
335
336
|
holdListening: Pe,
|
|
336
337
|
answerLocally: Fe
|
|
337
338
|
}), [
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
339
|
+
_,
|
|
340
|
+
Me,
|
|
341
|
+
M,
|
|
341
342
|
Ne,
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
343
|
+
F,
|
|
344
|
+
X,
|
|
345
|
+
Y.mode,
|
|
346
|
+
Y.nothingHeard,
|
|
347
|
+
Y.transportKind,
|
|
348
|
+
Y.fallbackReason,
|
|
349
|
+
Y.privacyNotice,
|
|
350
|
+
J.isSupported,
|
|
351
|
+
y.isBlocked,
|
|
351
352
|
$,
|
|
352
|
-
Ge,
|
|
353
|
-
Q,
|
|
354
353
|
Ke,
|
|
355
|
-
Ye,
|
|
356
|
-
Re,
|
|
357
354
|
qe,
|
|
358
355
|
Je,
|
|
359
|
-
|
|
356
|
+
Ze,
|
|
357
|
+
Re,
|
|
358
|
+
Ye,
|
|
359
|
+
Xe,
|
|
360
|
+
W,
|
|
360
361
|
Pe,
|
|
361
362
|
Fe
|
|
362
363
|
]);
|
|
@@ -98,6 +98,12 @@ interface Props {
|
|
|
98
98
|
* — the page the model offered in that voice turn.
|
|
99
99
|
*/
|
|
100
100
|
renderAfterTurn?: (turnId: string) => ReactNode;
|
|
101
|
+
/**
|
|
102
|
+
* ★ BOFF-9341: told the view shown, while the panel has the Avatar tab: an
|
|
103
|
+
* enlarged session covers the tab, which then is no stage (D4). Absent, the
|
|
104
|
+
* session reports nothing.
|
|
105
|
+
*/
|
|
106
|
+
onViewChange?: (view: VoiceView) => void;
|
|
101
107
|
}
|
|
102
108
|
/**
|
|
103
109
|
* Full-screen voice conversation (BOFF-7120).
|