@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.
Files changed (37) hide show
  1. package/dist/shared/assistant/conversation.d.ts +16 -0
  2. package/dist/shared/assistant/i18nManifest.d.ts +30 -0
  3. package/dist/shared/assistant/i18nManifest.js +30 -0
  4. package/dist/shared/assistant/index.d.ts +6 -0
  5. package/dist/shared/assistant/store.d.ts +7 -0
  6. package/dist/shared/assistant/store.js +3 -0
  7. package/dist/shared/assistant/ui/AssistantChatArea.js +1269 -1188
  8. package/dist/shared/assistant/ui/AssistantMessageList.d.ts +14 -0
  9. package/dist/shared/assistant/ui/AssistantMessageList.js +55 -52
  10. package/dist/shared/assistant/ui/composer/AssistantComposer.js +348 -362
  11. package/dist/shared/assistant/ui/composer/AssistantDictation.d.ts +42 -0
  12. package/dist/shared/assistant/ui/composer/AssistantDictation.js +127 -0
  13. package/dist/shared/assistant/ui/composer/AssistantMicMenu.d.ts +23 -0
  14. package/dist/shared/assistant/ui/composer/AssistantMicMenu.js +176 -0
  15. package/dist/shared/assistant/ui/composer/microphones.d.ts +13 -0
  16. package/dist/shared/assistant/ui/composer/microphones.js +15 -0
  17. package/dist/shared/assistant/ui/composer/useCompactDictation.d.ts +70 -0
  18. package/dist/shared/assistant/ui/composer/useCompactDictation.js +136 -0
  19. package/dist/shared/assistant/ui/useVoiceSession.js +166 -164
  20. package/dist/shared/assistant/ui/voice/AssistantPageVoiceBar.d.ts +20 -17
  21. package/dist/shared/assistant/ui/voice/AssistantPageVoiceBar.js +230 -123
  22. package/dist/shared/assistant/ui/voice/AssistantVoiceSession.d.ts +2 -0
  23. package/dist/shared/assistant/ui/voice/AssistantVoiceSession.js +227 -229
  24. package/dist/shared/assistant/ui/voice/LiveWaveform.d.ts +4 -3
  25. package/dist/shared/assistant/ui/voice/LiveWaveform.js +1 -1
  26. package/dist/shared/assistant/ui/voice/VoiceTurnMarks.d.ts +15 -0
  27. package/dist/shared/assistant/ui/voice/VoiceTurnMarks.js +43 -0
  28. package/dist/shared/assistant/ui/voice/formatClock.d.ts +2 -0
  29. package/dist/shared/assistant/ui/voice/formatClock.js +3 -0
  30. package/dist/shared/assistant/ui/voice/useLiveLevel.d.ts +3 -1
  31. package/dist/shared/assistant/ui/voice/useLiveLevel.js +23 -19
  32. package/dist/shared/assistant/voice/liveLevel.d.ts +4 -3
  33. package/dist/shared/assistant/voice/liveLevel.js +18 -15
  34. package/dist/shared/assistant/voice/useVoiceInput.d.ts +27 -1
  35. package/dist/shared/assistant/voice/useVoiceInput.js +141 -71
  36. package/dist/shared-assistant.js +383 -377
  37. package/package.json +1 -1
@@ -1,39 +1,40 @@
1
- import { useVoiceInput as e } from "../voice/useVoiceInput.js";
2
- import { useHandsFreeInterrupt as t } from "../voice/handsfree/useHandsFreeInterrupt.js";
3
- import { readHandsFreeOverride as n, resolveHandsFreeEnabled as r } from "../voice/handsfree/handsFreeSetting.js";
4
- import { silencePlaybackReference as ee } from "../voice/handsfree/playbackReference.js";
5
- import { primeHostedPlayback as te } from "../speech/hostedTtsSpeechEngine.js";
1
+ import { useAssistantStore as e } from "../store.js";
2
+ import { useVoiceInput as t } from "../voice/useVoiceInput.js";
3
+ import { useHandsFreeInterrupt as n } from "../voice/handsfree/useHandsFreeInterrupt.js";
4
+ import { readHandsFreeOverride as r, resolveHandsFreeEnabled as ee } from "../voice/handsfree/handsFreeSetting.js";
5
+ import { silencePlaybackReference as te } from "../voice/handsfree/playbackReference.js";
6
+ import { primeHostedPlayback as ne } from "../speech/hostedTtsSpeechEngine.js";
6
7
  import { turnClockMs as i } from "../turnTimeline.js";
7
- import { useAssistantSpeech as ne } from "./AssistantSpeechProvider.js";
8
- import { useLiveAvatarOn as re } from "./assistantLiveAvatarSeam.js";
9
- import { captionChunks as ie } from "../voice/speechPlayback.js";
8
+ import { useAssistantSpeech as re } from "./AssistantSpeechProvider.js";
9
+ import { useLiveAvatarOn as ie } from "./assistantLiveAvatarSeam.js";
10
+ import { captionChunks as ae } from "../voice/speechPlayback.js";
10
11
  import { speechFeed as a } from "../speech/speechFeed.js";
11
- import { planSubmitTimer as ae, resolveVoiceGraceMs as oe } from "../voice/handsFree.js";
12
- import { isTurnSuperseded as se } from "../voice/supersededTurns.js";
13
- import { INITIAL_SESSION as ce, INTERRUPT_MAX_MS as le, NOTHING_HEARD as ue, advanceHeardClock as de, isCapturing as fe, isSubmittable as pe, planListeningHold as me, planReplyConsumption as he, planVoiceAnnouncement as ge, shouldRecognise as _e, spokenSoFar as o, voiceSessionReducer as ve } from "../voice/voiceSession.js";
14
- import { useCallback as s, useEffect as c, useLayoutEffect as ye, useMemo as be, useReducer as xe, useRef as l, useState as u } from "react";
12
+ import { planSubmitTimer as oe, resolveVoiceGraceMs as se } from "../voice/handsFree.js";
13
+ import { isTurnSuperseded as ce } from "../voice/supersededTurns.js";
14
+ import { INITIAL_SESSION as le, INTERRUPT_MAX_MS as ue, NOTHING_HEARD as de, advanceHeardClock as fe, isCapturing as pe, isSubmittable as me, planListeningHold as he, planReplyConsumption as ge, planVoiceAnnouncement as _e, shouldRecognise as ve, spokenSoFar as o, voiceSessionReducer as ye } from "../voice/voiceSession.js";
15
+ import { useCallback as s, useEffect as c, useLayoutEffect as be, useMemo as xe, useReducer as Se, useRef as l, useState as u } from "react";
15
16
  // src/shared/assistant/ui/useVoiceSession.ts
16
- var Se = 4e3, Ce = 2500, we = 5e3, Te = 12e3;
17
- function Ee({ onSubmit: Ee, latestReply: d, language: f, graceMs: De, onSupersede: Oe, handsFreeInterrupt: ke, handsFreeStreamNoticeAccepted: Ae, onAcceptHandsFreeStreamNotice: je, onBargeIn: Me }) {
18
- let p = oe(De), m = l(null), Ne = s((e, t) => ve(e, t, m.current), []), [h, g] = xe(Ne, ce), _ = ne(), { setSessionSpeaking: v, setSessionMicOpen: y, speakingMessageId: b, stop: x } = _, Pe = l(_.toggle), Fe = _.toggle;
19
- ye(() => {
20
- Pe.current = Fe;
21
- }, [Fe]);
22
- let S = l(null), C = l({}), w = l(ue), T = l(void 0), E = l(void 0), Ie = l(0), D = l(void 0), O = l(/* @__PURE__ */ new Map()), Le = l(void 0);
17
+ var Ce = 4e3, we = 2500, Te = 5e3, Ee = 12e3;
18
+ function De({ onSubmit: De, latestReply: d, language: f, graceMs: Oe, onSupersede: ke, handsFreeInterrupt: Ae, handsFreeStreamNoticeAccepted: je, onAcceptHandsFreeStreamNotice: Me, onBargeIn: Ne }) {
19
+ let p = se(Oe), m = l(null), Pe = s((e, t) => ye(e, t, m.current), []), [h, g] = Se(Pe, le), _ = re(), { setSessionSpeaking: v, setSessionMicOpen: y, speakingMessageId: b, stop: x } = _, Fe = l(_.toggle), Ie = _.toggle;
20
+ be(() => {
21
+ Fe.current = Ie;
22
+ }, [Ie]);
23
+ let S = l(null), C = l({}), w = l(de), T = l(void 0), E = l(void 0), D = l(0), O = l(void 0), k = l(/* @__PURE__ */ new Map()), Le = l(void 0);
23
24
  c(() => {
24
25
  let e = h.correctionTimingDecision;
25
26
  if (e && e !== Le.current) {
26
27
  Le.current = e;
27
- for (let [t, n] of O.current) e.accepted && t >= e.candidateId && (T.current = n.lastSpeechFrame ?? T.current, E.current = n.recognizerSpeechEnded ?? E.current), (e.accepted || t <= e.candidateId) && O.current.delete(t);
28
- D.current !== void 0 && D.current <= e.candidateId && (D.current = void 0);
28
+ for (let [t, n] of k.current) e.accepted && t >= e.candidateId && (T.current = n.lastSpeechFrame ?? T.current, E.current = n.recognizerSpeechEnded ?? E.current), (e.accepted || t <= e.candidateId) && k.current.delete(t);
29
+ O.current !== void 0 && O.current <= e.candidateId && (O.current = void 0);
29
30
  }
30
- (h.phase !== "thinking" || h.muted) && (O.current.clear(), D.current = void 0), (h.phase === "idle" || h.phase === "ended") && (T.current = void 0, E.current = void 0);
31
+ (h.phase !== "thinking" || h.muted) && (k.current.clear(), O.current = void 0), (h.phase === "idle" || h.phase === "ended") && (T.current = void 0, E.current = void 0);
31
32
  }, [
32
33
  h.phase,
33
34
  h.muted,
34
35
  h.correctionTimingDecision
35
36
  ]);
36
- let k = l(null), A = l(!1), [Re, j] = u(null), M = l(null), [ze, N] = u(null), [P, F] = u(!1), [Be, I] = u(!1), [L, R] = u(!1), z = l(h);
37
+ let A = l(null), Re = l(!1), [ze, j] = u(null), M = l(null), [Be, N] = u(null), [P, F] = u(!1), [Ve, I] = u(!1), [L, R] = u(!1), z = l(h);
37
38
  z.current = h;
38
39
  let B = l([]), V = l(null), H = l(!1), U = s(() => {
39
40
  B.current = [], V.current = null, H.current = !1;
@@ -44,7 +45,7 @@ function Ee({ onSubmit: Ee, latestReply: d, language: f, graceMs: De, onSupersed
44
45
  if (!e.stillWanted || e.stillWanted()) {
45
46
  V.current = e, m.current = m.current ? `${m.current} ${e.text}` : e.text;
46
47
  try {
47
- Pe.current(e.id, e.text, e.lang);
48
+ Fe.current(e.id, e.text, e.lang);
48
49
  } catch {
49
50
  V.current = null;
50
51
  continue;
@@ -52,8 +53,8 @@ function Ee({ onSubmit: Ee, latestReply: d, language: f, graceMs: De, onSupersed
52
53
  return !0;
53
54
  }
54
55
  }
55
- }, []), G = l(!1), Ve = s((e) => {
56
- let t = me({
56
+ }, []), G = l(!1), He = s((e) => {
57
+ let t = he({
57
58
  requested: e,
58
59
  held: G.current,
59
60
  muted: z.current.muted
@@ -63,88 +64,89 @@ function Ee({ onSubmit: Ee, latestReply: d, language: f, graceMs: De, onSupersed
63
64
  muted: t.mute
64
65
  });
65
66
  }, []), K = s((e) => {
66
- let t = ge(z.current);
67
+ let t = _e(z.current);
67
68
  t !== "drop" && (V.current?.id === e.id || B.current.some((t) => t.id === e.id) || (B.current.push(e), t === "start" && !H.current && (H.current = !0, g({ type: "announce" }))));
68
- }, []), He = s((e) => {
69
+ }, []), Ue = s((e) => {
69
70
  z.current.phase === "thinking" ? (B.current.push(e), H.current = !0, g({ type: "answered-locally" })) : K(e);
70
- }, [K]), Ue = l(d);
71
- Ue.current = d, c(() => {
71
+ }, [K]), We = l(d);
72
+ We.current = d, c(() => {
72
73
  if (h.phase === "speaking") {
73
74
  let e = M.current;
74
- m.current = e && k.current === e.id && d?.id !== e.id ? e.text : d?.text ?? null;
75
+ m.current = e && A.current === e.id && d?.id !== e.id ? e.text : d?.text ?? null;
75
76
  return;
76
77
  }
77
78
  if (m.current === null) return;
78
79
  let e = setTimeout(() => {
79
80
  m.current = null;
80
- }, Ce);
81
+ }, we);
81
82
  return () => clearTimeout(e);
82
83
  }, [h.phase, d]);
83
- let q = l(f);
84
- q.current = f;
85
- let We = s((e, t) => {
84
+ let Ge = l(f);
85
+ Ge.current = f;
86
+ let Ke = s((e, t) => {
86
87
  let n = z.current;
87
88
  if (!n.muted) {
88
89
  if (n.phase === "thinking") {
89
- e === "lastSpeechFrame" && (D.current = void 0);
90
- let n = D.current ?? Ie.current, r = O.current.get(n) ?? {};
91
- r[e] = t, O.current.set(n, r);
90
+ e === "lastSpeechFrame" && (O.current = void 0);
91
+ let n = O.current ?? D.current, r = k.current.get(n) ?? {};
92
+ r[e] = t, k.current.set(n, r);
92
93
  } else n.phase === "listening" && (e === "lastSpeechFrame" ? T.current = t : E.current = t);
93
94
  }
94
- }, []), J = s((e) => {
95
+ }, []), q = s((e) => {
95
96
  let t = z.current;
96
97
  if (t.phase !== "thinking" || t.muted) return;
97
- let n = Ie.current;
98
- return e && (D.current = n, Ie.current += 1), n;
99
- }, []), Y = s((e, t) => {
98
+ let n = D.current;
99
+ return e && (O.current = n, D.current += 1), n;
100
+ }, []), J = s((e, t) => {
100
101
  g({
101
102
  type: "speech",
102
103
  transcript: e,
103
104
  final: t,
104
105
  at: Date.now(),
105
- language: q.current,
106
- timingCandidateId: J(t)
106
+ language: Ge.current,
107
+ timingCandidateId: q(t)
107
108
  });
108
- }, [J]), Ge = s((e, t, n) => {
109
+ }, [q]), qe = s((e, t, n) => {
109
110
  g({
110
111
  type: "speech",
111
112
  transcript: e,
112
113
  final: t,
113
114
  at: Date.now(),
114
- language: n ?? q.current,
115
+ language: n ?? Ge.current,
115
116
  gated: !0,
116
- timingCandidateId: J(t)
117
+ timingCandidateId: q(t)
117
118
  });
118
- }, [J]), Ke = l(0), qe = s(() => {
119
- U(), x(), Ke.current = Date.now(), F(!0), g({ type: "interrupt" });
120
- }, [x, U]), Je = s((e) => Y(e, !0), [Y]), X = e({
121
- onFinalize: Je,
119
+ }, [q]), Je = l(0), Ye = s(() => {
120
+ U(), x(), Je.current = Date.now(), F(!0), g({ type: "interrupt" });
121
+ }, [x, U]), Xe = s((e) => J(e, !0), [J]), Ze = e((e) => e.micDeviceId), Y = t({
122
+ onFinalize: Xe,
122
123
  language: f,
124
+ deviceId: Ze,
123
125
  onSpeechEnd: (e) => {
124
- We("recognizerSpeechEnded", e);
126
+ Ke("recognizerSpeechEnded", e);
125
127
  }
126
- }), Ye = X.stop, Xe = l(Me);
127
- Xe.current = Me;
128
- let Ze = s(() => {
129
- U(), ee(), x(), Ke.current = Date.now(), F(!0), g({ type: "interrupt" }), Xe.current?.();
130
- }, [x, U]), Qe = re(), Z = t({
131
- enabled: r(ke, n(), Qe),
128
+ }), Qe = Y.stop, $e = l(Ne);
129
+ $e.current = Ne;
130
+ let et = s(() => {
131
+ U(), te(), x(), Je.current = Date.now(), F(!0), g({ type: "interrupt" }), $e.current?.();
132
+ }, [x, U]), tt = ie(), X = n({
133
+ enabled: ee(Ae, r(), tt),
132
134
  phase: h.phase,
133
135
  muted: h.muted,
134
136
  language: f,
135
- streamNoticeAccepted: Ae ?? null,
136
- onAcceptStreamNotice: je,
137
- onBargeIn: Ze,
138
- onTranscript: Ge,
137
+ streamNoticeAccepted: je ?? null,
138
+ onAcceptStreamNotice: Me,
139
+ onBargeIn: et,
140
+ onTranscript: qe,
139
141
  onSpeechFrame: (e) => {
140
- We("lastSpeechFrame", e);
142
+ Ke("lastSpeechFrame", e);
141
143
  }
142
- }), $e = Z.mode === "notice", Q = X.isListening || Z.suppressWebSpeech && Z.mode === "active";
144
+ }), nt = X.mode === "notice", Z = Y.isListening || X.suppressWebSpeech && X.mode === "active";
143
145
  c(() => {
144
- X.interim && Y(X.interim, !1);
145
- }, [X.interim, Y]), c(() => {
146
- S.current && clearTimeout(S.current), I(!1), w.current = de(w.current, h, i());
147
- let e = ae({
146
+ Y.interim && J(Y.interim, !1);
147
+ }, [Y.interim, J]), c(() => {
148
+ S.current && clearTimeout(S.current), I(!1), w.current = fe(w.current, h, i());
149
+ let e = oe({
148
150
  phase: h.phase,
149
151
  muted: h.muted,
150
152
  spoken: o(h),
@@ -176,18 +178,18 @@ function Ee({ onSubmit: Ee, latestReply: d, language: f, graceMs: De, onSupersed
176
178
  (h.phase !== "listening" || h.muted) && R(!1);
177
179
  }, [h.phase, h.muted]), c(() => {
178
180
  if (!P) return;
179
- let e = Date.now() - Ke.current, t = Q ? Math.max(0, 500 - e) : Math.max(0, le - e), n = setTimeout(() => F(!1), t);
181
+ let e = Date.now() - Je.current, t = Z ? Math.max(0, 500 - e) : Math.max(0, ue - e), n = setTimeout(() => F(!1), t);
180
182
  return () => clearTimeout(n);
181
- }, [P, Q]);
182
- let et = l("");
183
- h.phase === "listening" && (et.current = o(h)), c(() => {
183
+ }, [P, Z]);
184
+ let rt = l("");
185
+ h.phase === "listening" && (rt.current = o(h)), c(() => {
184
186
  if (h.phase !== "thinking") return;
185
187
  y(!1), U(), N((e) => typeof e == "object" && e ? null : e);
186
- let e = et.current.trim();
187
- e && Ee(e, $.current ?? `vs-orphan-${Date.now().toString(36)}`, C.current, { correction: z.current.correcting }), C.current = {}, w.current = ue, T.current = void 0, E.current = void 0;
188
+ let e = rt.current.trim();
189
+ e && De(e, $.current ?? `vs-orphan-${Date.now().toString(36)}`, C.current, { correction: z.current.correcting }), C.current = {}, w.current = de, T.current = void 0, E.current = void 0;
188
190
  }, [h.phase]), c(() => {
189
- let e = he(d?.id, h.phase, k.current, se(d?.id));
190
- e.claim && (k.current = d?.id ?? null, e.advance && d && (d.refused ? (U(), N({
191
+ let e = ge(d?.id, h.phase, A.current, ce(d?.id));
192
+ e.claim && (A.current = d?.id ?? null, e.advance && d && (d.refused ? (U(), N({
191
193
  kind: "turn-refused",
192
194
  text: d.text
193
195
  }), g({ type: "turn-refused" })) : g({
@@ -199,13 +201,13 @@ function Ee({ onSubmit: Ee, latestReply: d, language: f, graceMs: De, onSupersed
199
201
  h.phase,
200
202
  U
201
203
  ]), c(() => {
202
- if (b === null || h.phase !== "thinking" || k.current === b) return;
203
- if (se(b)) {
204
+ if (b === null || h.phase !== "thinking" || A.current === b) return;
205
+ if (ce(b)) {
204
206
  x();
205
207
  return;
206
208
  }
207
209
  let e = a.peek(b);
208
- e && e.final && e.channel === "voice" && e.voiceSessionId !== void 0 && e.voiceSessionId === $.current && (k.current = b, M.current = {
210
+ e && e.final && e.channel === "voice" && e.voiceSessionId !== void 0 && e.voiceSessionId === $.current && (A.current = b, M.current = {
209
211
  id: b,
210
212
  text: e.text
211
213
  }, g({
@@ -221,12 +223,12 @@ function Ee({ onSubmit: Ee, latestReply: d, language: f, graceMs: De, onSupersed
221
223
  let t = z.current.phase;
222
224
  if (t !== "thinking" && t !== "speaking") return;
223
225
  if (e.state === "retrying") {
224
- if (k.current !== e.messageId || M.current?.id !== e.messageId) return;
225
- k.current = null, M.current = null, j(e.messageId), g({ type: "reply-audio-paused" });
226
+ if (A.current !== e.messageId || M.current?.id !== e.messageId) return;
227
+ A.current = null, M.current = null, j(e.messageId), g({ type: "reply-audio-paused" });
226
228
  return;
227
229
  }
228
230
  if (e.state === "ended") {
229
- if (k.current !== e.messageId || M.current?.id !== e.messageId) return;
231
+ if (A.current !== e.messageId || M.current?.id !== e.messageId) return;
230
232
  let n = a.peek(e.messageId);
231
233
  n?.channel === "voice" && n.voiceSessionId === $.current && (M.current = {
232
234
  id: e.messageId,
@@ -238,97 +240,97 @@ function Ee({ onSubmit: Ee, latestReply: d, language: f, graceMs: De, onSupersed
238
240
  });
239
241
  return;
240
242
  }
241
- if (se(e.messageId)) return;
243
+ if (ce(e.messageId)) return;
242
244
  let n = a.peek(e.messageId);
243
245
  if (n && n.channel === "voice" && n.voiceSessionId === $.current) {
244
- if (e.state === "queued") j(e.messageId), k.current = e.messageId, M.current = {
246
+ if (e.state === "queued") j(e.messageId), A.current = e.messageId, M.current = {
245
247
  id: e.messageId,
246
248
  text: n.text
247
- }, Ye();
248
- else if (k.current !== e.messageId) return;
249
- else e.state === "started" ? (k.current = e.messageId, M.current = {
249
+ }, Qe();
250
+ else if (A.current !== e.messageId) return;
251
+ else e.state === "started" ? (A.current = e.messageId, M.current = {
250
252
  id: e.messageId,
251
253
  text: n.text
252
254
  }, g({
253
255
  type: "reply-audio-started",
254
256
  replyId: e.messageId,
255
257
  partial: !n.final
256
- })) : e.state === "paused" && k.current === e.messageId && g({ type: "reply-audio-paused" });
258
+ })) : e.state === "paused" && A.current === e.messageId && g({ type: "reply-audio-paused" });
257
259
  }
258
- }), [Ye]), c(() => {
260
+ }), [Qe]), c(() => {
259
261
  h.phase !== "thinking" && h.phase !== "speaking" && j(null);
260
262
  }, [h.phase]), c(() => {
261
263
  let e = b !== null;
262
- A.current && !e && (V.current = null, z.current.phase === "speaking" && W() || g({ type: "speech-ended" })), A.current = e;
264
+ Re.current && !e && (V.current = null, z.current.phase === "speaking" && W() || g({ type: "speech-ended" })), Re.current = e;
263
265
  }, [b, W]), c(() => {
264
266
  h.phase !== "listening" && N((e) => e === "nothing-heard" ? null : e);
265
267
  }, [h.phase]), c(() => {
266
268
  if (h.phase !== "speaking" || b !== null) return;
267
269
  let e = setTimeout(() => {
268
- A.current || (U(), g({ type: "speech-ended" }));
269
- }, Se);
270
+ Re.current || (U(), g({ type: "speech-ended" }));
271
+ }, Ce);
270
272
  return () => clearTimeout(e);
271
273
  }, [
272
274
  h.phase,
273
275
  b,
274
276
  U
275
277
  ]);
276
- let tt = _.outputNotCleared;
278
+ let Q = _.outputNotCleared;
277
279
  c(() => {
278
- if (tt === null || k.current !== tt.messageId) return;
280
+ if (Q === null || A.current !== Q.messageId) return;
279
281
  let { phase: e } = z.current;
280
282
  e !== "idle" && e !== "ended" && e !== "thinking" && N("reply-not-heard");
281
- }, [tt]), c(() => {
283
+ }, [Q]), c(() => {
282
284
  h.phase !== "listening" && h.phase !== "thinking" && N((e) => e === "reply-not-heard" ? null : e);
283
285
  }, [h.phase]);
284
- let nt = l(Oe);
285
- nt.current = Oe;
286
- let rt = l(0);
286
+ let it = l(ke);
287
+ it.current = ke;
288
+ let at = l(0);
287
289
  c(() => {
288
290
  let e = h.superseded;
289
- e !== rt.current && (rt.current = e, e !== 0 && (U(), x(), nt.current?.()));
291
+ e !== at.current && (at.current = e, e !== 0 && (U(), x(), it.current?.()));
290
292
  }, [
291
293
  h.superseded,
292
294
  U,
293
295
  x
294
296
  ]), c(() => {
295
- let e = fe(h);
296
- y(e), _e(h) && Re === null && !Z.suppressWebSpeech ? X.isActive || X.start("auto") : X.isActive && X.stop();
297
+ let e = pe(h);
298
+ y(e), ve(h) && ze === null && !X.suppressWebSpeech ? Y.isActive || Y.start("auto") : Y.isActive && Y.stop();
297
299
  }, [
298
300
  h,
299
- X,
301
+ Y,
300
302
  y,
301
- Z.suppressWebSpeech,
302
- Re
303
+ X.suppressWebSpeech,
304
+ ze
303
305
  ]), c(() => {
304
306
  h.phase === "speaking" && H.current && (H.current = !1, W() || g({ type: "speech-ended" }));
305
307
  }, [h.phase, W]), c(() => {
306
- X.error === "not-allowed" || X.error === "audio-capture" ? g({
308
+ Y.error === "not-allowed" || Y.error === "audio-capture" ? g({
307
309
  type: "fail",
308
310
  error: "mic-denied"
309
- }) : X.error === "language-not-supported" ? g({
311
+ }) : Y.error === "language-not-supported" ? g({
310
312
  type: "fail",
311
313
  error: "no-speech-support"
312
- }) : X.error === "network" ? N("network") : X.error === "unknown" && N("recognition-failed");
313
- }, [X.error]), c(() => {
314
- X.error === null && Q && N((e) => e === "network" || e === "recognition-failed" ? null : e);
315
- }, [X.error, Q]), c(() => {
316
- if (Q && N((e) => e === "not-capturing" ? null : e), !fe(h) || Q || $e) return;
317
- let e = setTimeout(() => N("not-capturing"), we);
314
+ }) : Y.error === "network" ? N("network") : Y.error === "unknown" && N("recognition-failed");
315
+ }, [Y.error]), c(() => {
316
+ Y.error === null && Z && N((e) => e === "network" || e === "recognition-failed" ? null : e);
317
+ }, [Y.error, Z]), c(() => {
318
+ if (Z && N((e) => e === "not-capturing" ? null : e), !pe(h) || Z || nt) return;
319
+ let e = setTimeout(() => N("not-capturing"), Te);
318
320
  return () => clearTimeout(e);
319
321
  }, [
320
322
  h,
321
- Q,
322
- $e
323
+ Z,
324
+ nt
323
325
  ]), c(() => {
324
- if (h.phase !== "listening" || h.muted || !Q || o(h) !== "") return;
325
- let e = setTimeout(() => N("nothing-heard"), Te);
326
+ if (h.phase !== "listening" || h.muted || !Z || o(h) !== "") return;
327
+ let e = setTimeout(() => N("nothing-heard"), Ee);
326
328
  return () => clearTimeout(e);
327
- }, [h, Q]), c(() => {
329
+ }, [h, Z]), c(() => {
328
330
  o(h) !== "" && N(null);
329
331
  }, [h]);
330
- let $ = l(null), it = s(() => {
331
- if (F(!1), I(!1), R(!1), U(), G.current = !1, !X.isSupported) g({
332
+ let $ = l(null), ot = s(() => {
333
+ if (F(!1), I(!1), R(!1), U(), G.current = !1, !Y.isSupported) g({
332
334
  type: "fail",
333
335
  error: "no-speech-support"
334
336
  });
@@ -344,26 +346,26 @@ function Ee({ onSubmit: Ee, latestReply: d, language: f, graceMs: De, onSupersed
344
346
  t.volume = 0, e.speak(t);
345
347
  }
346
348
  } catch {}
347
- te(), v(!0), N(null), k.current = Ue.current?.id ?? null, M.current = null, $.current = `vs-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`, g({ type: "start" });
349
+ ne(), v(!0), N(null), A.current = We.current?.id ?? null, M.current = null, $.current = `vs-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`, g({ type: "start" });
348
350
  }
349
351
  }, [
350
- X.isSupported,
352
+ Y.isSupported,
351
353
  _.isBlocked,
352
354
  v,
353
355
  U
354
- ]), at = s(() => {
356
+ ]), st = s(() => {
355
357
  F(!1), I(!1), R(!1), U(), G.current = !1, $.current = null, g({ type: "end" }), x(), v(!1);
356
358
  }, [
357
359
  x,
358
360
  v,
359
361
  U
360
- ]), ot = s((e) => $.current === e, []), st = s(() => {
362
+ ]), ct = s((e) => $.current === e, []), lt = s(() => {
361
363
  let e = z.current;
362
364
  e.phase !== "listening" || e.muted || R(!0);
363
- }, []), ct = s(() => {
365
+ }, []), ut = s(() => {
364
366
  R(!1);
365
367
  let e = z.current;
366
- if (e.phase !== "listening" || e.muted || !pe(o(e))) return;
368
+ if (e.phase !== "listening" || e.muted || !me(o(e))) return;
367
369
  let t = i();
368
370
  C.current = {
369
371
  speechEnded: w.current.at ?? t,
@@ -376,7 +378,7 @@ function Ee({ onSubmit: Ee, latestReply: d, language: f, graceMs: De, onSupersed
376
378
  type: "silence",
377
379
  at: Date.now()
378
380
  });
379
- }, [p]), lt = s(() => {
381
+ }, [p]), dt = s(() => {
380
382
  g({
381
383
  type: "mute",
382
384
  muted: !z.current.muted
@@ -385,60 +387,60 @@ function Ee({ onSubmit: Ee, latestReply: d, language: f, graceMs: De, onSupersed
385
387
  c(() => () => {
386
388
  v(!1), y(!1);
387
389
  }, [v, y]);
388
- let ut = ie(_.spokenChunks, h.phase, b);
389
- return be(() => ({
390
+ let ft = ae(_.spokenChunks, h.phase, b);
391
+ return xe(() => ({
390
392
  session: h,
391
- notice: ze ?? (Z.fallbackReason !== null && Z.fallbackReason !== "notice-declined" ? "hands-free-fallback" : Z.nothingHeard ? "hands-free-nothing-heard" : null),
392
- spokenChunks: ut,
393
- capturing: Q,
393
+ notice: Be ?? (X.fallbackReason !== null && X.fallbackReason !== "notice-declined" ? "hands-free-fallback" : X.nothingHeard ? "hands-free-nothing-heard" : null),
394
+ spokenChunks: ft,
395
+ capturing: Z,
394
396
  active: h.phase !== "idle" && (h.phase !== "ended" || h.error !== null),
395
397
  interrupting: P,
396
- awaitingEndpoint: Be,
398
+ awaitingEndpoint: Ve,
397
399
  holding: L,
398
400
  correcting: h.correcting,
399
401
  handsFree: {
400
- mode: Z.mode,
401
- nothingHeard: Z.nothingHeard,
402
- transportKind: Z.transportKind,
403
- fallbackReason: Z.fallbackReason,
404
- privacyNotice: Z.privacyNotice
402
+ mode: X.mode,
403
+ nothingHeard: X.nothingHeard,
404
+ transportKind: X.transportKind,
405
+ fallbackReason: X.fallbackReason,
406
+ privacyNotice: X.privacyNotice
405
407
  },
406
- available: X.isSupported && !_.isBlocked,
407
- start: it,
408
- end: at,
409
- isCurrentSession: ot,
410
- toggleMute: lt,
411
- interrupt: qe,
412
- letMeFinish: st,
413
- imDone: ct,
408
+ available: Y.isSupported && !_.isBlocked,
409
+ start: ot,
410
+ end: st,
411
+ isCurrentSession: ct,
412
+ toggleMute: dt,
413
+ interrupt: Ye,
414
+ letMeFinish: lt,
415
+ imDone: ut,
414
416
  announce: K,
415
- holdListening: Ve,
416
- answerLocally: He
417
+ holdListening: He,
418
+ answerLocally: Ue
417
419
  }), [
418
420
  h,
419
- ze,
420
- P,
421
421
  Be,
422
+ P,
423
+ Ve,
422
424
  L,
423
- Q,
424
- Z.mode,
425
- Z.nothingHeard,
426
- Z.transportKind,
427
- Z.fallbackReason,
428
- Z.privacyNotice,
429
- X.isSupported,
425
+ Z,
426
+ X.mode,
427
+ X.nothingHeard,
428
+ X.transportKind,
429
+ X.fallbackReason,
430
+ X.privacyNotice,
431
+ Y.isSupported,
430
432
  _.isBlocked,
431
- ut,
432
- it,
433
- at,
433
+ ft,
434
434
  ot,
435
- lt,
436
- qe,
437
435
  st,
438
436
  ct,
437
+ dt,
438
+ Ye,
439
+ lt,
440
+ ut,
439
441
  K,
440
- Ve,
441
- He
442
+ He,
443
+ Ue
442
444
  ]);
443
445
  }
444
- export { Ee as useVoiceSession };
446
+ export { De as useVoiceSession };
@@ -13,11 +13,13 @@ export interface AssistantPageVoiceBarProps {
13
13
  status: string;
14
14
  statusSuffix: string | null;
15
15
  rotateStatus: boolean;
16
+ /** The session's own line for this stage (holding, correcting, still listening…). */
17
+ stageText: string;
16
18
  /** What the person is saying, as it is heard; empty when not listening. */
17
19
  heard: string;
18
- /** The waveform's level (`useLiveLevel`). */
20
+ /** The circle's level (`useLiveLevel`). */
19
21
  level: LiveLevelSource;
20
- /** A recoverable problem, shown above the box, and the same text when it is to be announced. */
22
+ /** A recoverable problem, shown above the dock, and the same text when it is to be announced. */
21
23
  notice: string | null;
22
24
  announcedNotice: string | null;
23
25
  attachmentNotice: string | null;
@@ -37,26 +39,27 @@ export interface AssistantPageVoiceBarProps {
37
39
  holding: boolean;
38
40
  onPress: () => void;
39
41
  } | null;
40
- /** The microphone control: Stop the assistant while it talks, Mute / Unmute otherwise. */
41
- primary: {
42
- interrupt: boolean;
43
- onPress?: () => void;
44
- disabled: boolean;
45
- };
42
+ onToggleMute: () => void;
43
+ /** Mute / Unmute can be pressed (not while connecting, ended or after an error). */
44
+ muteDisabled: boolean;
45
+ /** Cut the assistant off; offered while it speaks. */
46
+ onInterrupt?: () => void;
47
+ /** Speaking over the assistant cuts in too (hands-free interrupt is on). */
48
+ bargeIn: boolean;
46
49
  onEnd: () => void;
47
50
  privacyNotice: HandsFreePrivacyNoticeActions | null;
48
51
  }
49
52
  /**
50
- * The live voice conversation on a page (BOFF-13461; the operator, 14 Nov: "in
51
- * /assistant… the voice assistant still uses the panel ui… use same chat ui").
53
+ * The live voice chat on a page: the assistant dock (BOFF-13461; the operator's
54
+ * design of 14 Nov, "Voice chat: the assistant dock").
52
55
  *
53
- * The page's thread IS the conversation: what the person says and what the
54
- * assistant answers are turns of it, drawn by the chat area like typed ones. This
55
- * is only the box at the foot of the column, in the message box's place and in its
56
- * shape: what is being heard (or the status), a live waveform, and the controls,
57
- * Attach, Let me finish / I'm done, the microphone (Stop the assistant while it
58
- * talks; Mute / Unmute otherwise) and End. Notices sit above it, where the message
59
- * box keeps its status line.
56
+ * The message box turns into this dock, in its place and shape, and the chat stays
57
+ * in view above it, filling with both sides of the conversation (the chat area draws
58
+ * the spoken turns). The dock: a circle and a title that say what is happening
59
+ * (Connecting, Listening, Thinking, Speaking, Muted), what is being heard or what to
60
+ * do, the call's time; then Mute / Unmute, Interrupt while the assistant talks, Let
61
+ * me finish (H1), Attach, and End voice chat. Amber means "we are hearing you",
62
+ * blue "the assistant is talking"; the tab's title says the state too.
60
63
  *
61
64
  * All the session's state and rules stay in `AssistantVoiceSession` (`view="page"`),
62
65
  * which renders this through a portal into the page's slot.