@burdenoff/fe-libs 2026.906.2 → 2026.906.4
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 +12 -0
- package/dist/shared/assistant/conversation.d.ts.map +1 -1
- package/dist/shared/assistant/index.d.ts +1 -0
- package/dist/shared/assistant/index.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantChatArea.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantChatArea.js +154 -142
- package/dist/shared/assistant/ui/AssistantSpeechProvider.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantSpeechProvider.js +100 -88
- package/dist/shared/assistant/ui/useVoiceSession.d.ts.map +1 -1
- package/dist/shared/assistant/ui/useVoiceSession.js +1 -1
- package/dist/shared/assistant/ui/voice/AssistantVoiceSession.d.ts.map +1 -1
- package/dist/shared/assistant/ui/voice/AssistantVoiceSession.js +56 -56
- package/dist/shared/assistant/ui/voice/VoiceCaption.d.ts +6 -0
- package/dist/shared/assistant/ui/voice/VoiceCaption.d.ts.map +1 -1
- package/dist/shared/assistant/ui/voice/VoiceCaption.js +23 -14
- package/dist/shared/assistant/ui/voice/VoiceMiniController.d.ts.map +1 -1
- package/dist/shared/assistant/ui/voice/VoiceMiniController.js +28 -27
- package/dist/shared/assistant/ui/voice/VoiceStage.d.ts.map +1 -1
- package/dist/shared/assistant/ui/voice/VoiceStage.js +1 -0
- package/dist/shared/assistant/ui/voice/VoiceTranscriptDrawer.d.ts +18 -4
- package/dist/shared/assistant/ui/voice/VoiceTranscriptDrawer.d.ts.map +1 -1
- package/dist/shared/assistant/ui/voice/VoiceTranscriptDrawer.js +36 -26
- package/dist/shared/assistant/voice/miniCaptionBudget.d.ts +46 -0
- package/dist/shared/assistant/voice/miniCaptionBudget.d.ts.map +1 -0
- package/dist/shared/assistant/voice/miniCaptionBudget.js +15 -0
- package/dist/shared-assistant.js +69 -68
- package/package.json +1 -1
|
@@ -26,7 +26,7 @@ var de = {
|
|
|
26
26
|
emailAt: "at",
|
|
27
27
|
emailDot: "dot",
|
|
28
28
|
nestedItem: ""
|
|
29
|
-
}, S = h({
|
|
29
|
+
}, fe = 4e3, S = h({
|
|
30
30
|
isSupported: !1,
|
|
31
31
|
availability: "unsupported",
|
|
32
32
|
isBlocked: !0,
|
|
@@ -51,26 +51,30 @@ function C() {
|
|
|
51
51
|
return _(S);
|
|
52
52
|
}
|
|
53
53
|
var w = ({ children: h, visible: _ = !0, engine: C = n() }) => {
|
|
54
|
-
let w = ne(), { locale: T } = e(), [E, D] = le(oe, ae), [O, k] = x(() => C.listVoices()), [A,
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
let w = ne(), { locale: T } = e(), [E, D] = le(oe, ae), [O, k] = x(() => C.listVoices()), [A, j] = x(!1), [M, N] = x(() => /* @__PURE__ */ new Map()), P = b(0), F = b(null);
|
|
55
|
+
v(() => () => {
|
|
56
|
+
F.current !== null && clearTimeout(F.current);
|
|
57
|
+
}, []);
|
|
58
|
+
let [I, L] = x(null), R = b(null), z = b(() => {}), B = g(() => {
|
|
59
|
+
R.current?.(), R.current = null;
|
|
60
|
+
}, []), V = m((e) => e.autoSpeakEnabled), H = m((e) => e.setAutoSpeak), [U, pe] = x(!1), me = m((e) => e.activeConversationId), W = y(() => C.isSupported(), [C]);
|
|
57
61
|
v(() => {
|
|
58
|
-
if (!
|
|
62
|
+
if (!W) return;
|
|
59
63
|
let e = () => {
|
|
60
|
-
k(C.listVoices()),
|
|
64
|
+
k(C.listVoices()), N((e) => e.size === 0 ? e : /* @__PURE__ */ new Map());
|
|
61
65
|
};
|
|
62
66
|
return e(), C.subscribeVoices(e);
|
|
63
|
-
}, [C,
|
|
64
|
-
let
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
}, [C, W]);
|
|
68
|
+
let he = m((e) => e.assistantLanguage), ge = m((e) => e.replyLanguage), G = m((e) => e.preferredVoices), _e = m((e) => e.setPreferredVoice), K = y(() => te(he, ge, T).reply, [
|
|
69
|
+
he,
|
|
70
|
+
ge,
|
|
67
71
|
T
|
|
68
|
-
]), q = K.code, J = g((e) => f(e)?.tag ?? s(e), []),
|
|
69
|
-
|
|
72
|
+
]), q = K.code, J = g((e) => f(e)?.tag ?? s(e), []), ve = g((e) => f(e)?.rate ?? .9, []), Y = y(() => c(W, O, K.tag, A), [
|
|
73
|
+
W,
|
|
70
74
|
O,
|
|
71
75
|
K,
|
|
72
76
|
A
|
|
73
|
-
]),
|
|
77
|
+
]), ye = y(() => ({
|
|
74
78
|
codeBlock: w("speech.codeBlock", "Code block"),
|
|
75
79
|
image: w("speech.image", "image"),
|
|
76
80
|
link: w("speech.link", "link"),
|
|
@@ -80,8 +84,8 @@ var w = ({ children: h, visible: _ = !0, engine: C = n() }) => {
|
|
|
80
84
|
emailAt: w("speech.emailAt", "at"),
|
|
81
85
|
emailDot: w("speech.emailDot", "dot")
|
|
82
86
|
}), [w]), X = g(() => {
|
|
83
|
-
|
|
84
|
-
}, [
|
|
87
|
+
B(), C.cancel(), D({ type: "stop" });
|
|
88
|
+
}, [B, C]), be = g((e) => {
|
|
85
89
|
let t = C.listVoices().find((t) => t.name === e) ?? null;
|
|
86
90
|
t && (X(), C.speak([d(q)], {
|
|
87
91
|
voice: t,
|
|
@@ -92,21 +96,21 @@ var w = ({ children: h, visible: _ = !0, engine: C = n() }) => {
|
|
|
92
96
|
q,
|
|
93
97
|
X,
|
|
94
98
|
J
|
|
95
|
-
]),
|
|
96
|
-
|
|
99
|
+
]), xe = g((e) => M.get(e) ?? null, [M]), Se = g((e, t, n) => {
|
|
100
|
+
B();
|
|
97
101
|
let i = !1, a = () => {}, o = (r) => {
|
|
98
102
|
if (!i) {
|
|
99
|
-
if (i = !0,
|
|
100
|
-
|
|
103
|
+
if (i = !0, R.current = null, clearTimeout(s), a(), r.length === 0) {
|
|
104
|
+
j(!0);
|
|
101
105
|
return;
|
|
102
106
|
}
|
|
103
|
-
k(r),
|
|
107
|
+
k(r), z.current(e, t, r, n);
|
|
104
108
|
}
|
|
105
109
|
}, s = setTimeout(() => o(C.listVoices()), r);
|
|
106
|
-
a = C.subscribeVoices(() => o(C.listVoices())),
|
|
107
|
-
i || (i = !0, clearTimeout(s), a(),
|
|
110
|
+
a = C.subscribeVoices(() => o(C.listVoices())), R.current = () => {
|
|
111
|
+
i || (i = !0, clearTimeout(s), a(), R.current = null);
|
|
108
112
|
};
|
|
109
|
-
}, [
|
|
113
|
+
}, [B, C]), Z = g((e, t, n, r) => {
|
|
110
114
|
let s = n;
|
|
111
115
|
if (s.length === 0) {
|
|
112
116
|
let e = C.listVoices();
|
|
@@ -115,38 +119,46 @@ var w = ({ children: h, visible: _ = !0, engine: C = n() }) => {
|
|
|
115
119
|
let l = J(r), u = o(c(!0, s, r, A));
|
|
116
120
|
if (u === "block") {
|
|
117
121
|
let t = w("speech.noVoiceForReply", "This reply is in {{language}}, and no {{language}} voice is installed on this device.", { language: i(l, T) });
|
|
118
|
-
|
|
122
|
+
N((n) => new Map(n).set(e, t));
|
|
119
123
|
return;
|
|
120
124
|
}
|
|
121
125
|
if (u === "wait-for-voices") {
|
|
122
|
-
|
|
126
|
+
Se(e, t, r);
|
|
123
127
|
return;
|
|
124
128
|
}
|
|
125
|
-
|
|
129
|
+
N((t) => {
|
|
126
130
|
if (!t.has(e)) return t;
|
|
127
131
|
let n = new Map(t);
|
|
128
132
|
return n.delete(e), n;
|
|
129
133
|
});
|
|
130
|
-
let d =
|
|
131
|
-
|
|
134
|
+
let d = P.current + 1;
|
|
135
|
+
P.current = d, D({
|
|
132
136
|
type: "start",
|
|
133
137
|
messageId: e,
|
|
134
138
|
requestId: d
|
|
135
139
|
});
|
|
136
140
|
let f = ee(t);
|
|
137
|
-
|
|
141
|
+
L({
|
|
138
142
|
requestId: d,
|
|
139
143
|
chunks: f,
|
|
140
144
|
index: -1
|
|
141
|
-
}),
|
|
142
|
-
|
|
145
|
+
}), F.current !== null && clearTimeout(F.current), F.current = setTimeout(() => {
|
|
146
|
+
L((e) => e?.requestId === d && e.index < 0 ? null : e);
|
|
147
|
+
}, fe), C.speak(f, {
|
|
148
|
+
voice: a(s, l, G[r]),
|
|
143
149
|
lang: l,
|
|
144
|
-
rate:
|
|
150
|
+
rate: ve(r)
|
|
145
151
|
}, {
|
|
146
|
-
onChunkStart: (e) =>
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
152
|
+
onChunkStart: (e) => {
|
|
153
|
+
P.current === d && F.current !== null && (clearTimeout(F.current), F.current = null), L((t) => t?.requestId === d ? {
|
|
154
|
+
...t,
|
|
155
|
+
index: e
|
|
156
|
+
} : P.current === d ? {
|
|
157
|
+
requestId: d,
|
|
158
|
+
chunks: f,
|
|
159
|
+
index: e
|
|
160
|
+
} : t);
|
|
161
|
+
},
|
|
150
162
|
onEnd: () => D({
|
|
151
163
|
type: "finished",
|
|
152
164
|
requestId: d
|
|
@@ -159,27 +171,27 @@ var w = ({ children: h, visible: _ = !0, engine: C = n() }) => {
|
|
|
159
171
|
}, [
|
|
160
172
|
C,
|
|
161
173
|
T,
|
|
162
|
-
|
|
163
|
-
|
|
174
|
+
G,
|
|
175
|
+
ve,
|
|
164
176
|
J,
|
|
165
177
|
w,
|
|
166
178
|
A,
|
|
167
|
-
|
|
179
|
+
Se
|
|
168
180
|
]);
|
|
169
181
|
v(() => {
|
|
170
|
-
|
|
182
|
+
z.current = Z;
|
|
171
183
|
}, [Z]);
|
|
172
184
|
let Q = g((e, t, n) => {
|
|
173
|
-
if (!
|
|
174
|
-
let r = ie(u(t, { labels: de }), n ?? q), i = u(t, { labels: re(r,
|
|
185
|
+
if (!W) return;
|
|
186
|
+
let r = ie(u(t, { labels: de }), n ?? q), i = u(t, { labels: re(r, ye) });
|
|
175
187
|
i && Z(e, i, O, r);
|
|
176
188
|
}, [
|
|
177
|
-
|
|
178
|
-
|
|
189
|
+
W,
|
|
190
|
+
ye,
|
|
179
191
|
q,
|
|
180
192
|
Z,
|
|
181
193
|
O
|
|
182
|
-
]),
|
|
194
|
+
]), Ce = g((e, t, n) => {
|
|
183
195
|
if (p(E, e)) {
|
|
184
196
|
X();
|
|
185
197
|
return;
|
|
@@ -193,35 +205,35 @@ var w = ({ children: h, visible: _ = !0, engine: C = n() }) => {
|
|
|
193
205
|
v(() => {
|
|
194
206
|
_ || X();
|
|
195
207
|
}, [_, X]), v(() => {
|
|
196
|
-
X(),
|
|
197
|
-
}, [
|
|
198
|
-
|
|
208
|
+
X(), N(/* @__PURE__ */ new Map());
|
|
209
|
+
}, [me, X]), v(() => {
|
|
210
|
+
N((e) => e.size === 0 ? e : /* @__PURE__ */ new Map()), X();
|
|
199
211
|
}, [q, X]), v(() => () => {
|
|
200
|
-
|
|
212
|
+
R.current?.(), R.current = null, C.cancel();
|
|
201
213
|
}, [C]), v(() => {
|
|
202
214
|
if (typeof window > "u") return;
|
|
203
215
|
let e = () => C.cancel();
|
|
204
216
|
return window.addEventListener("pagehide", e), () => window.removeEventListener("pagehide", e);
|
|
205
217
|
}, [C]), v(() => {
|
|
206
|
-
if (typeof document > "u" || !
|
|
218
|
+
if (typeof document > "u" || !W) return;
|
|
207
219
|
let e = () => {
|
|
208
220
|
if (document.visibilityState !== "visible") return;
|
|
209
221
|
let e = C.listVoices();
|
|
210
|
-
e.length > 0 &&
|
|
222
|
+
e.length > 0 && B(), k(e), j(!1), N((e) => e.size === 0 ? e : /* @__PURE__ */ new Map());
|
|
211
223
|
};
|
|
212
224
|
return document.addEventListener("visibilitychange", e), window.addEventListener("focus", e), () => {
|
|
213
225
|
document.removeEventListener("visibilitychange", e), window.removeEventListener("focus", e);
|
|
214
226
|
};
|
|
215
227
|
}, [
|
|
216
|
-
|
|
228
|
+
B,
|
|
217
229
|
C,
|
|
218
|
-
|
|
230
|
+
W
|
|
219
231
|
]);
|
|
220
|
-
let
|
|
232
|
+
let we = b(Q);
|
|
221
233
|
v(() => {
|
|
222
|
-
|
|
234
|
+
we.current = Q;
|
|
223
235
|
}, [Q]), v(() => {
|
|
224
|
-
if (!(!
|
|
236
|
+
if (!(!V && !U || !_ || !W)) return m.subscribe((e, n) => {
|
|
225
237
|
let r = e.activeConversationId;
|
|
226
238
|
if (!r || r !== n.activeConversationId) return;
|
|
227
239
|
let i = e.processingByConversationId[r], a = n.processingByConversationId[r];
|
|
@@ -229,65 +241,65 @@ var w = ({ children: h, visible: _ = !0, engine: C = n() }) => {
|
|
|
229
241
|
let o = i.messageId ?? a?.messageId ?? null;
|
|
230
242
|
if (!o) return;
|
|
231
243
|
let s = e.conversations.find((e) => e.id === r)?.messages.find((e) => e.id === o);
|
|
232
|
-
if (!s || s.role !== "assistant" || t(s) !==
|
|
244
|
+
if (!s || s.role !== "assistant" || t(s) !== U) return;
|
|
233
245
|
let { text: c } = ce(s.content);
|
|
234
|
-
c.trim() &&
|
|
246
|
+
c.trim() && we.current(o, c, s.metadata?.lang);
|
|
235
247
|
});
|
|
236
248
|
}, [
|
|
237
|
-
R,
|
|
238
|
-
B,
|
|
239
249
|
V,
|
|
250
|
+
U,
|
|
251
|
+
W,
|
|
240
252
|
_
|
|
241
253
|
]);
|
|
242
|
-
let
|
|
254
|
+
let Te = y(() => l(O, K.tag), [O, K]), $ = y(() => a(O, K.tag, G[q]), [
|
|
243
255
|
O,
|
|
244
256
|
K,
|
|
245
|
-
|
|
257
|
+
G,
|
|
246
258
|
q
|
|
247
|
-
]),
|
|
248
|
-
isSupported:
|
|
259
|
+
]), Ee = y(() => ({
|
|
260
|
+
isSupported: W,
|
|
249
261
|
availability: Y,
|
|
250
262
|
isBlocked: Y === "no-voices",
|
|
251
263
|
disabledReason: Y === "no-voices" ? w("speech.noVoicesOnDevice", "This device has no speech voices installed. Add one in your device speech or accessibility settings.") : null,
|
|
252
|
-
blockedFor:
|
|
253
|
-
voiceChoices:
|
|
254
|
-
spokenChunks:
|
|
255
|
-
chunks:
|
|
256
|
-
index:
|
|
264
|
+
blockedFor: xe,
|
|
265
|
+
voiceChoices: Te,
|
|
266
|
+
spokenChunks: I ? {
|
|
267
|
+
chunks: I.chunks,
|
|
268
|
+
index: I.index
|
|
257
269
|
} : null,
|
|
258
270
|
activeVoiceName: $?.name ?? null,
|
|
259
|
-
preferredVoiceName:
|
|
260
|
-
setVoice: (e) =>
|
|
271
|
+
preferredVoiceName: G[q] ?? null,
|
|
272
|
+
setVoice: (e) => _e(q, e),
|
|
261
273
|
speakingMessageId: E.status === "speaking" ? E.messageId : null,
|
|
262
274
|
isSpeaking: (e) => p(E, e),
|
|
263
|
-
toggle:
|
|
275
|
+
toggle: Ce,
|
|
264
276
|
stop: X,
|
|
265
|
-
autoSpeakEnabled:
|
|
266
|
-
setAutoSpeak:
|
|
267
|
-
sessionSpeaking:
|
|
268
|
-
setSessionSpeaking:
|
|
269
|
-
previewVoice:
|
|
277
|
+
autoSpeakEnabled: V,
|
|
278
|
+
setAutoSpeak: H,
|
|
279
|
+
sessionSpeaking: U,
|
|
280
|
+
setSessionSpeaking: pe,
|
|
281
|
+
previewVoice: be
|
|
270
282
|
}), [
|
|
271
|
-
|
|
283
|
+
W,
|
|
272
284
|
Y,
|
|
273
|
-
|
|
274
|
-
|
|
285
|
+
xe,
|
|
286
|
+
Te,
|
|
275
287
|
$,
|
|
276
|
-
W,
|
|
277
288
|
G,
|
|
289
|
+
_e,
|
|
278
290
|
q,
|
|
279
291
|
E,
|
|
280
|
-
|
|
292
|
+
Ce,
|
|
281
293
|
X,
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
294
|
+
V,
|
|
295
|
+
H,
|
|
296
|
+
U,
|
|
297
|
+
be,
|
|
286
298
|
w,
|
|
287
|
-
|
|
299
|
+
I
|
|
288
300
|
]);
|
|
289
301
|
return /* @__PURE__ */ ue(S.Provider, {
|
|
290
|
-
value:
|
|
302
|
+
value: Ee,
|
|
291
303
|
children: h
|
|
292
304
|
});
|
|
293
305
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useVoiceSession.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/useVoiceSession.ts"],"names":[],"mappings":"AAUA,OAAO,EAWL,KAAK,oBAAoB,EAE1B,MAAM,uBAAuB,CAAC;AAsC/B;;;;;;;;GAQG;AACH,MAAM,MAAM,kBAAkB,GAC1B,SAAS,GACT,eAAe,GACf,eAAe,GACf,oBAAoB,CAAC;AAMzB,UAAU,OAAO;IACf,+EAA+E;IAC/E;;;;;;;OAOG;IACH,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD;;;;OAIG;IACH,WAAW,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACjD,6EAA6E;IAC7E,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,OAAO;;
|
|
1
|
+
{"version":3,"file":"useVoiceSession.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/useVoiceSession.ts"],"names":[],"mappings":"AAUA,OAAO,EAWL,KAAK,oBAAoB,EAE1B,MAAM,uBAAuB,CAAC;AAsC/B;;;;;;;;GAQG;AACH,MAAM,MAAM,kBAAkB,GAC1B,SAAS,GACT,eAAe,GACf,eAAe,GACf,oBAAoB,CAAC;AAMzB,UAAU,OAAO;IACf,+EAA+E;IAC/E;;;;;;;OAOG;IACH,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD;;;;OAIG;IACH,WAAW,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACjD,6EAA6E;IAC7E,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,OAAO;;IAsdtE,qEAAqE;;IAErE;;;;;;;OAOG;;;;;IAEH,+DAA+D;;IAE/D;;;;;;;OAOG;;IAIH,0EAA0E;;IAE1E,6DAA6D;;IAE7D,sDAAsD;;;;;;EA4B3D"}
|
|
@@ -77,7 +77,7 @@ function x({ onSubmit: x, latestReply: S, language: C }) {
|
|
|
77
77
|
error: "no-speech-support"
|
|
78
78
|
}) : G.error === "network" ? F("network") : G.error === "unknown" && F("recognition-failed");
|
|
79
79
|
}, [G.error]), d(() => {
|
|
80
|
-
if (!i(T) || G.isListening) return;
|
|
80
|
+
if (G.isListening && F((e) => e === "not-capturing" ? null : e), !i(T) || G.isListening) return;
|
|
81
81
|
let e = setTimeout(() => F("not-capturing"), v);
|
|
82
82
|
return () => clearTimeout(e);
|
|
83
83
|
}, [T, G.isListening]), d(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssistantVoiceSession.d.ts","sourceRoot":"","sources":["../../../../../src/shared/assistant/ui/voice/AssistantVoiceSession.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA4C,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAI1E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAO7D,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,gFAAgF;AAChF,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAElD,UAAU,KAAK;IACb,OAAO,EAAE,oBAAoB,CAAC;IAC9B,iEAAiE;IACjE,KAAK,CAAC,EAAE,aAAa,CAAC,mBAAmB,CAAC,CAAC;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D,YAAY,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC1D,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,mFAAmF;IACnF,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,0EAA0E;IAC1E,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,wEAAwE;IACxE,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC,KAAK,CAkkB3C,CAAC"}
|
|
@@ -2,31 +2,31 @@ import { micIsInterrupt as e, voiceStageState as t } from "../../voice/voiceStag
|
|
|
2
2
|
import { spokenSoFar as n } from "../../voice/voiceSession.js";
|
|
3
3
|
import { useAssistantTr as r } from "../../i18n.js";
|
|
4
4
|
import { AssistantAttachmentButton as i } from "../composer/AssistantAttachmentButton.js";
|
|
5
|
-
import { AssistantAttachmentChips as
|
|
6
|
-
import { AssistantVoiceOrb as
|
|
7
|
-
import { VoiceMiniController as
|
|
8
|
-
import { VoiceStage as
|
|
9
|
-
import { VoiceTranscriptDrawer as
|
|
10
|
-
import { useCallback as
|
|
11
|
-
import { Maximize2 as
|
|
12
|
-
import { jsx as
|
|
5
|
+
import { AssistantAttachmentChips as a } from "../composer/AssistantAttachmentChips.js";
|
|
6
|
+
import { AssistantVoiceOrb as o } from "./AssistantVoiceOrb.js";
|
|
7
|
+
import { VoiceMiniController as s } from "./VoiceMiniController.js";
|
|
8
|
+
import { VoiceStage as c } from "./VoiceStage.js";
|
|
9
|
+
import { VoiceTranscriptDrawer as ee } from "./VoiceTranscriptDrawer.js";
|
|
10
|
+
import { useCallback as te, useEffect as l, useRef as u, useState as d } from "react";
|
|
11
|
+
import { Maximize2 as f, Minimize2 as p, ScrollText as m, X as h } from "lucide-react";
|
|
12
|
+
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
13
13
|
//#region src/shared/assistant/ui/voice/AssistantVoiceSession.tsx
|
|
14
|
-
var
|
|
15
|
-
let F = r(), { muted: I, error: L } =
|
|
16
|
-
J.current =
|
|
17
|
-
let oe =
|
|
18
|
-
I || q.current || n(
|
|
19
|
-
}, [I,
|
|
20
|
-
|
|
14
|
+
var v = ({ session: v, turns: b = [], onSaveTranscript: x, onContinueInChat: S, notice: C = null, spoken: w, onInterrupt: T, onToggleMute: E, attachments: D = [], onAttachFiles: O, onRemoveAttachment: k, onRetryAttachment: re, canAttachMore: ie = !0, preparingAttachments: A = 0, spokenChunks: j = null, onEnd: M, capturing: ae = !0, interrupting: N = !1, awaitingEndpoint: P = !1 }) => {
|
|
15
|
+
let F = r(), { muted: I, error: L } = v, R = u(null), z = u(null), [B, V] = d("mini"), H = B === "full", U = B === "mini", W = B === "mini" ? "panel" : B === "panel" ? "full" : "mini", [G, K] = d(!1), q = u(!1), J = u(E);
|
|
16
|
+
J.current = E;
|
|
17
|
+
let oe = te(() => {
|
|
18
|
+
I || q.current || n(v) || (q.current = !0, J.current());
|
|
19
|
+
}, [I, v]);
|
|
20
|
+
l(() => {
|
|
21
21
|
let e = () => {
|
|
22
22
|
q.current && (q.current = !1, J.current());
|
|
23
23
|
};
|
|
24
24
|
return window.addEventListener("focus", e), () => {
|
|
25
25
|
window.removeEventListener("focus", e), q.current = !1;
|
|
26
26
|
};
|
|
27
|
-
}, []),
|
|
27
|
+
}, []), l(() => {
|
|
28
28
|
R.current?.focus();
|
|
29
|
-
}, []),
|
|
29
|
+
}, []), l(() => {
|
|
30
30
|
let e = (e) => {
|
|
31
31
|
if (e.key === "Escape") {
|
|
32
32
|
if (G) {
|
|
@@ -48,8 +48,8 @@ var g = ({ session: g, turns: y = [], onSaveTranscript: b, onContinueInChat: x,
|
|
|
48
48
|
H,
|
|
49
49
|
G
|
|
50
50
|
]);
|
|
51
|
-
let Y =
|
|
52
|
-
snapshot:
|
|
51
|
+
let Y = C !== null && L === null, X = n(v), Z = t({
|
|
52
|
+
snapshot: v,
|
|
53
53
|
capturing: ae,
|
|
54
54
|
interrupting: N,
|
|
55
55
|
awaitingEndpoint: P
|
|
@@ -66,7 +66,7 @@ var g = ({ session: g, turns: y = [], onSaveTranscript: b, onContinueInChat: x,
|
|
|
66
66
|
default: return Z;
|
|
67
67
|
}
|
|
68
68
|
})(), $ = I && Z !== "listening" && Q !== "" ? `${Q} · ${F("voiceSession.muted", "Microphone off")}` : Q;
|
|
69
|
-
return /* @__PURE__ */
|
|
69
|
+
return /* @__PURE__ */ _("div", {
|
|
70
70
|
ref: z,
|
|
71
71
|
className: `flex flex-col items-center justify-between bg-bg-sunken ${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 h-[11.25rem] border-t border-border-subtle px-3 py-3 shadow-lg"}`,
|
|
72
72
|
role: "dialog",
|
|
@@ -74,103 +74,103 @@ var g = ({ session: g, turns: y = [], onSaveTranscript: b, onContinueInChat: x,
|
|
|
74
74
|
"aria-label": F("voiceSession.title", "Voice conversation"),
|
|
75
75
|
"data-testid": "assistant-voice-session",
|
|
76
76
|
children: [
|
|
77
|
-
/* @__PURE__ */
|
|
77
|
+
/* @__PURE__ */ _("button", {
|
|
78
78
|
ref: R,
|
|
79
79
|
type: "button",
|
|
80
80
|
onClick: M,
|
|
81
|
-
className: `absolute ${H ? "right-6 top-6 h-14 gap-2 px-5 text-base" : U ? "right-
|
|
82
|
-
|
|
81
|
+
className: `absolute ${H ? "right-6 top-6 h-14 gap-2 px-5 text-base" : U ? "right-12 top-2 h-8 gap-1.5 px-2.5 text-xs" : "right-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`,
|
|
82
|
+
title: F("voiceSession.end", "End the voice conversation"),
|
|
83
83
|
"data-testid": "assistant-voice-end",
|
|
84
|
-
children: [/* @__PURE__ */
|
|
84
|
+
children: [/* @__PURE__ */ g(h, {
|
|
85
85
|
className: H ? "size-6" : U ? "size-4" : "size-5",
|
|
86
86
|
"aria-hidden": "true"
|
|
87
|
-
}),
|
|
88
|
-
className: "max-w-[
|
|
87
|
+
}), /* @__PURE__ */ g("span", {
|
|
88
|
+
className: `truncate whitespace-nowrap font-medium ${U ? "max-w-[3.5rem] text-xs" : "max-w-[7rem]"}`,
|
|
89
89
|
children: F("voiceSession.endShort", "End")
|
|
90
90
|
})]
|
|
91
91
|
}),
|
|
92
|
-
/* @__PURE__ */
|
|
92
|
+
/* @__PURE__ */ g("div", {
|
|
93
93
|
className: `flex flex-col items-center ${U ? "px-3" : `min-h-[1.5rem] ${Y ? H ? "pt-14" : "pt-10" : ""}`}`,
|
|
94
|
-
children: Y ? /* @__PURE__ */
|
|
94
|
+
children: Y ? /* @__PURE__ */ g("p", {
|
|
95
95
|
className: "max-w-xs text-center text-xs text-status-warning",
|
|
96
96
|
"data-testid": "assistant-voice-notice",
|
|
97
|
-
children:
|
|
97
|
+
children: ne(C, F)
|
|
98
98
|
}) : null
|
|
99
99
|
}),
|
|
100
100
|
(() => {
|
|
101
|
-
let t = /* @__PURE__ */
|
|
102
|
-
session:
|
|
101
|
+
let t = /* @__PURE__ */ g(o, {
|
|
102
|
+
session: v,
|
|
103
103
|
compact: U,
|
|
104
104
|
connecting: Z === "connecting",
|
|
105
|
-
onPress: e(Z) ?
|
|
105
|
+
onPress: e(Z) ? T : E,
|
|
106
106
|
label: e(Z) ? F("voiceSession.interrupt", "Stop the assistant and speak") : I ? F("voiceSession.unmute", "Turn the microphone on") : F("voiceSession.mute", "Turn the microphone off")
|
|
107
|
-
}), n = e(Z) ?
|
|
108
|
-
return U ? /* @__PURE__ */
|
|
107
|
+
}), n = e(Z) ? w : X || null, r = L === null ? null : y(L, F);
|
|
108
|
+
return U ? /* @__PURE__ */ g(s, {
|
|
109
109
|
spokenChunks: j,
|
|
110
110
|
state: Z,
|
|
111
111
|
caption: n,
|
|
112
112
|
statusText: $,
|
|
113
113
|
errorText: r,
|
|
114
114
|
control: t
|
|
115
|
-
}) : /* @__PURE__ */
|
|
115
|
+
}) : /* @__PURE__ */ g(c, {
|
|
116
116
|
state: Z,
|
|
117
117
|
userCaption: X || null,
|
|
118
118
|
spokenChunks: j,
|
|
119
|
-
assistantCaption:
|
|
119
|
+
assistantCaption: w,
|
|
120
120
|
expanded: H,
|
|
121
121
|
statusText: $,
|
|
122
122
|
errorText: r,
|
|
123
123
|
control: t
|
|
124
124
|
});
|
|
125
125
|
})(),
|
|
126
|
-
G ? /* @__PURE__ */
|
|
127
|
-
turns:
|
|
126
|
+
G ? /* @__PURE__ */ g(ee, {
|
|
127
|
+
turns: b,
|
|
128
128
|
onClose: () => K(!1),
|
|
129
|
-
onSave:
|
|
130
|
-
onContinueInChat:
|
|
129
|
+
onSave: x,
|
|
130
|
+
onContinueInChat: S
|
|
131
131
|
}) : null,
|
|
132
|
-
|
|
132
|
+
O ? /* @__PURE__ */ g("div", {
|
|
133
133
|
className: `absolute ${H ? "left-6 top-6" : U ? "left-11 top-2" : "left-3 top-3"}`,
|
|
134
|
-
children: /* @__PURE__ */
|
|
134
|
+
children: /* @__PURE__ */ g(i, {
|
|
135
135
|
onFiles: (e) => {
|
|
136
|
-
|
|
136
|
+
O(e), V((e) => e === "mini" ? "panel" : e);
|
|
137
137
|
},
|
|
138
138
|
onPickerOpen: oe,
|
|
139
139
|
direction: "down",
|
|
140
140
|
canAddMore: ie
|
|
141
141
|
})
|
|
142
142
|
}) : null,
|
|
143
|
-
(
|
|
143
|
+
(D.length > 0 || A > 0) && !U ? /* @__PURE__ */ g("div", {
|
|
144
144
|
className: `absolute ${H ? "bottom-24 left-24 right-24" : "bottom-16 left-16 right-16"}`,
|
|
145
145
|
"data-testid": "assistant-voice-attachments",
|
|
146
|
-
children: /* @__PURE__ */
|
|
147
|
-
attachments:
|
|
148
|
-
onRemove:
|
|
149
|
-
onRetry:
|
|
146
|
+
children: /* @__PURE__ */ g(a, {
|
|
147
|
+
attachments: D,
|
|
148
|
+
onRemove: k ?? (() => void 0),
|
|
149
|
+
onRetry: re ?? (() => void 0),
|
|
150
150
|
preparingCount: A
|
|
151
151
|
})
|
|
152
152
|
}) : null,
|
|
153
|
-
/* @__PURE__ */
|
|
153
|
+
/* @__PURE__ */ g("button", {
|
|
154
154
|
type: "button",
|
|
155
155
|
onClick: () => K((e) => !e),
|
|
156
|
-
className: `absolute ${H ? "bottom-6 right-6 size-14" : U ? "right-
|
|
156
|
+
className: `absolute ${H ? "bottom-6 right-6 size-14" : U ? "right-2 top-2 size-8" : "bottom-3 right-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`,
|
|
157
157
|
"aria-pressed": G,
|
|
158
158
|
"aria-label": F("voiceSession.transcript", "Voice transcript"),
|
|
159
159
|
"data-testid": "assistant-voice-transcript-toggle",
|
|
160
|
-
children: /* @__PURE__ */ m
|
|
160
|
+
children: /* @__PURE__ */ g(m, { className: H ? "size-6" : U ? "size-4" : "size-5" })
|
|
161
161
|
}),
|
|
162
|
-
/* @__PURE__ */
|
|
162
|
+
/* @__PURE__ */ g("button", {
|
|
163
163
|
type: "button",
|
|
164
164
|
onClick: () => V(W),
|
|
165
165
|
className: `absolute ${H ? "bottom-6 left-6 size-14" : U ? "left-2 top-2 size-8" : "bottom-3 left-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`,
|
|
166
166
|
"aria-label": W === "panel" ? F("voiceSession.expandPanel", "Show the conversation in the panel") : W === "full" ? F("voiceSession.expand", "Expand the conversation to full screen") : F("voiceSession.collapse", "Shrink to the compact controller"),
|
|
167
167
|
"data-testid": "assistant-voice-expand",
|
|
168
|
-
children: H ? /* @__PURE__ */
|
|
168
|
+
children: H ? /* @__PURE__ */ g(p, { className: "size-5" }) : /* @__PURE__ */ g(f, { className: U ? "size-4" : "size-5" })
|
|
169
169
|
})
|
|
170
170
|
]
|
|
171
171
|
});
|
|
172
172
|
};
|
|
173
|
-
function
|
|
173
|
+
function ne(e, t) {
|
|
174
174
|
switch (e) {
|
|
175
175
|
case "network": return t("voiceSession.noticeNetwork", "Speech recognition lost its connection. Check your network — it will retry.");
|
|
176
176
|
case "not-capturing": return t("voiceSession.noticeNotCapturing", "The microphone did not start. Check that this site is allowed to use it, then try again.");
|
|
@@ -179,7 +179,7 @@ function _(e, t) {
|
|
|
179
179
|
default: return e;
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
|
-
function
|
|
182
|
+
function y(e, t) {
|
|
183
183
|
switch (e) {
|
|
184
184
|
case "mic-denied": return t("voiceSession.micDenied", "Microphone access is blocked. Allow it in your browser settings to talk.");
|
|
185
185
|
case "no-speech-support": return t("voiceSession.noSpeechSupport", "This browser cannot listen. Try a different browser, or type instead.");
|
|
@@ -188,4 +188,4 @@ function v(e, t) {
|
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
//#endregion
|
|
191
|
-
export {
|
|
191
|
+
export { v as AssistantVoiceSession };
|
|
@@ -54,6 +54,12 @@ interface Props {
|
|
|
54
54
|
} | null;
|
|
55
55
|
testId?: string;
|
|
56
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Marks the scroll box the caption lives in, so the sounding chunk can be kept
|
|
59
|
+
* in view WITHOUT `scrollIntoView`, which also scrolls every ancestor scroller
|
|
60
|
+
* — here that would drag the page behind a docked session.
|
|
61
|
+
*/
|
|
62
|
+
export declare const CAPTION_SCROLL_ATTR = "data-caption-scroll";
|
|
57
63
|
export declare const VoiceCaption: FC<Props>;
|
|
58
64
|
export {};
|
|
59
65
|
//# sourceMappingURL=VoiceCaption.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VoiceCaption.d.ts","sourceRoot":"","sources":["../../../../../src/shared/assistant/ui/voice/VoiceCaption.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"VoiceCaption.d.ts","sourceRoot":"","sources":["../../../../../src/shared/assistant/ui/voice/VoiceCaption.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,UAAU,KAAK;IACb,IAAI,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,mDAAmD;IACnD,QAAQ,EAAE,OAAO,CAAC;IAClB;;;;;;;;;;;;;OAaG;IACH,YAAY,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,wBAAwB,CAAC;AAEzD,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,KAAK,CA4IlC,CAAC"}
|