@burdenoff/fe-libs 2026.914.2 → 2026.915.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/i18nManifest.d.ts +335 -0
- package/dist/shared/assistant/i18nManifest.d.ts.map +1 -0
- package/dist/shared/assistant/i18nManifest.js +210 -0
- package/dist/shared/assistant/index.d.ts +2 -0
- package/dist/shared/assistant/index.d.ts.map +1 -1
- package/dist/shared/assistant/modeCopy.d.ts +27 -0
- package/dist/shared/assistant/modeCopy.d.ts.map +1 -0
- package/dist/shared/assistant/modeCopy.js +9 -0
- package/dist/shared/assistant/speech/browserSpeechEngine.d.ts.map +1 -1
- package/dist/shared/assistant/speech/browserSpeechEngine.js +53 -26
- package/dist/shared/assistant/speech/createSpeechEngine.d.ts +25 -2
- package/dist/shared/assistant/speech/createSpeechEngine.d.ts.map +1 -1
- package/dist/shared/assistant/speech/createSpeechEngine.js +36 -13
- package/dist/shared/assistant/speech/hostedTtsProtocol.d.ts +25 -1
- package/dist/shared/assistant/speech/hostedTtsProtocol.d.ts.map +1 -1
- package/dist/shared/assistant/speech/hostedTtsProtocol.js +15 -8
- package/dist/shared/assistant/speech/hostedTtsSpeechEngine.d.ts +16 -1
- package/dist/shared/assistant/speech/hostedTtsSpeechEngine.d.ts.map +1 -1
- package/dist/shared/assistant/speech/hostedTtsSpeechEngine.js +84 -52
- package/dist/shared/assistant/speech/hostedVoiceCatalogue.d.ts.map +1 -1
- package/dist/shared/assistant/speech/hostedVoiceCatalogue.js +2 -1
- package/dist/shared/assistant/speech/index.d.ts +1 -1
- package/dist/shared/assistant/speech/index.d.ts.map +1 -1
- package/dist/shared/assistant/speech/routingSpeechEngine.d.ts.map +1 -1
- package/dist/shared/assistant/speech/routingSpeechEngine.js +41 -20
- package/dist/shared/assistant/speech/types.d.ts +10 -0
- package/dist/shared/assistant/speech/types.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantMessageItem.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantMessageItem.js +1 -1
- package/dist/shared/assistant/ui/AssistantPendingWriteCard.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantPendingWriteCard.js +1 -1
- package/dist/shared/assistant/ui/AssistantSpeechProvider.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantSpeechProvider.js +209 -190
- package/dist/shared/assistant/ui/composer/AssistantModeSelector.d.ts +7 -3
- package/dist/shared/assistant/ui/composer/AssistantModeSelector.d.ts.map +1 -1
- package/dist/shared/assistant/ui/composer/AssistantModeSelector.js +30 -29
- package/dist/shared/assistant/ui/voice/AssistantVoiceSession.d.ts.map +1 -1
- package/dist/shared/assistant/ui/voice/AssistantVoiceSession.js +1 -1
- package/dist/shared/assistant/voice/speechVoices.d.ts +15 -0
- package/dist/shared/assistant/voice/speechVoices.d.ts.map +1 -1
- package/dist/shared/assistant/voice/speechVoices.js +31 -26
- package/dist/shared-assistant.js +102 -100
- package/package.json +1 -1
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { useI18n as e } from "../../providers/shell/I18nProvider.js";
|
|
2
2
|
import { useAssistantTr as t } from "../i18n.js";
|
|
3
3
|
import { isVoiceTurn as n } from "../voice/turnVisibility.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { chunkForSpeech as
|
|
7
|
-
import { voicePreviewText as
|
|
8
|
-
import { findAssistantLanguage as
|
|
9
|
-
import { resolveLanguagePair as
|
|
10
|
-
import { speechLabelsFor as
|
|
11
|
-
import { resolveSpeechLocale as
|
|
12
|
-
import { IDLE_PLAYBACK as
|
|
13
|
-
import { useAssistantStore as
|
|
4
|
+
import { VOICE_LIST_TIMEOUT_MS as r, languageDisplayName as i, selectVoiceForLocale as a, speechGate as o, speechLangForLocale as s, voiceAvailability as c, voicesForLocale as l } from "../voice/speechVoices.js";
|
|
5
|
+
import { getSpeechEngine as u, subscribeSpeechEngine as d } from "../speech/createSpeechEngine.js";
|
|
6
|
+
import { chunkForSpeech as ee, toSpeakableText as f } from "../voice/speakableText.js";
|
|
7
|
+
import { voicePreviewText as te } from "../voice/voicePreview.js";
|
|
8
|
+
import { findAssistantLanguage as p } from "../voice/languages.js";
|
|
9
|
+
import { resolveLanguagePair as ne } from "../voice/languagePair.js";
|
|
10
|
+
import { speechLabelsFor as re } from "../voice/speechLabels.js";
|
|
11
|
+
import { resolveSpeechLocale as ie } from "../voice/replyLanguage.js";
|
|
12
|
+
import { IDLE_PLAYBACK as ae, isSpeakingMessage as oe, publishedChunks as se, speechPlaybackReducer as ce } from "../voice/speechPlayback.js";
|
|
13
|
+
import { useAssistantStore as m } from "../store.js";
|
|
14
14
|
import { isTurnInFlight as le } from "../turnState.js";
|
|
15
15
|
import { parseToolActivity as ue } from "./AssistantToolActivity.js";
|
|
16
16
|
import "../speech/index.js";
|
|
17
|
-
import { createContext as
|
|
18
|
-
import { jsx as
|
|
17
|
+
import { createContext as de, useCallback as h, useContext as g, useEffect as _, useMemo as v, useReducer as fe, useRef as y, useState as b, useSyncExternalStore as pe } from "react";
|
|
18
|
+
import { jsx as me } from "react/jsx-runtime";
|
|
19
19
|
//#region src/shared/assistant/ui/AssistantSpeechProvider.tsx
|
|
20
|
-
var
|
|
20
|
+
var he = {
|
|
21
21
|
codeBlock: "",
|
|
22
22
|
image: "",
|
|
23
23
|
link: "",
|
|
@@ -26,7 +26,7 @@ var pe = {
|
|
|
26
26
|
emailAt: "at",
|
|
27
27
|
emailDot: "dot",
|
|
28
28
|
nestedItem: ""
|
|
29
|
-
},
|
|
29
|
+
}, ge = 4e3, x = de({
|
|
30
30
|
isSupported: !1,
|
|
31
31
|
availability: "unsupported",
|
|
32
32
|
isBlocked: !0,
|
|
@@ -51,192 +51,209 @@ var pe = {
|
|
|
51
51
|
function S() {
|
|
52
52
|
return g(x);
|
|
53
53
|
}
|
|
54
|
-
var C = ({ children:
|
|
55
|
-
let C = t(), { locale:
|
|
54
|
+
var C = ({ children: de, visible: g = !0, engine: S }) => {
|
|
55
|
+
let C = pe(d, u, u), w = S ?? C, T = t(), { locale: E } = e(), [D, O] = fe(ce, ae), [k, A] = b(() => w.listVoices()), [j, M] = b(!1), [N, P] = b(() => /* @__PURE__ */ new Map()), F = y(0), I = y(null);
|
|
56
56
|
_(() => () => {
|
|
57
|
-
|
|
57
|
+
I.current !== null && clearTimeout(I.current);
|
|
58
58
|
}, []);
|
|
59
|
-
let [
|
|
60
|
-
|
|
61
|
-
}, []),
|
|
62
|
-
|
|
63
|
-
}, []),
|
|
59
|
+
let [L, R] = b(null), z = y(null), B = y(() => {}), V = h(() => {
|
|
60
|
+
z.current?.(), z.current = null;
|
|
61
|
+
}, []), H = m((e) => e.autoSpeakEnabled), U = m((e) => e.setAutoSpeak), [W, _e] = b(!1), ve = y(!1), ye = h((e) => {
|
|
62
|
+
ve.current = e;
|
|
63
|
+
}, []), be = m((e) => e.activeConversationId), G = v(() => w.isSupported(), [w]);
|
|
64
64
|
_(() => {
|
|
65
|
-
if (!
|
|
65
|
+
if (!G) return;
|
|
66
66
|
let e = () => {
|
|
67
|
-
|
|
67
|
+
A(w.listVoices()), P((e) => e.size === 0 ? e : /* @__PURE__ */ new Map());
|
|
68
68
|
};
|
|
69
|
-
return e(),
|
|
70
|
-
}, [
|
|
71
|
-
let
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
]),
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
K,
|
|
79
|
-
k
|
|
80
|
-
]), X = v(() => ({
|
|
81
|
-
codeBlock: C("speech.codeBlock", "Code block"),
|
|
82
|
-
image: C("speech.image", "image"),
|
|
83
|
-
link: C("speech.link", "link"),
|
|
84
|
-
largeTable: C("speech.largeTable", "Table with {{rows}} rows and {{columns}} columns"),
|
|
85
|
-
truncated: C("speech.truncated", "The rest of this message is not read aloud"),
|
|
86
|
-
nestedItem: C("speech.nestedItem", "Sub-item {{ordinal}}"),
|
|
87
|
-
emailAt: C("speech.emailAt", "at"),
|
|
88
|
-
emailDot: C("speech.emailDot", "dot")
|
|
89
|
-
}), [C]), Z = h(() => {
|
|
90
|
-
R(), S.cancel(), E({ type: "stop" });
|
|
91
|
-
}, [R, S]), Se = h((e) => {
|
|
92
|
-
let t = S.listVoices().find((t) => t.name === e) ?? null;
|
|
93
|
-
t && (Z(), S.speak([d(q)], {
|
|
94
|
-
voice: t,
|
|
95
|
-
lang: J(q)
|
|
96
|
-
}));
|
|
97
|
-
}, [
|
|
98
|
-
S,
|
|
69
|
+
return e(), w.subscribeVoices(e);
|
|
70
|
+
}, [w, G]);
|
|
71
|
+
let xe = m((e) => e.assistantLanguage), Se = m((e) => e.replyLanguage), K = m((e) => e.preferredVoices), Ce = m((e) => e.setPreferredVoice), q = v(() => ne(xe, Se, E).reply, [
|
|
72
|
+
xe,
|
|
73
|
+
Se,
|
|
74
|
+
E
|
|
75
|
+
]), J = q.code, Y = h((e) => p(e)?.tag ?? s(e), []), we = h((e) => p(e)?.rate ?? .9, []), X = v(() => c(G, k, q.tag, j), [
|
|
76
|
+
G,
|
|
77
|
+
k,
|
|
99
78
|
q,
|
|
79
|
+
j
|
|
80
|
+
]), Te = v(() => ({
|
|
81
|
+
codeBlock: T("speech.codeBlock", "Code block"),
|
|
82
|
+
image: T("speech.image", "image"),
|
|
83
|
+
link: T("speech.link", "link"),
|
|
84
|
+
largeTable: T("speech.largeTable", "Table with {{rows}} rows and {{columns}} columns"),
|
|
85
|
+
truncated: T("speech.truncated", "The rest of this message is not read aloud"),
|
|
86
|
+
nestedItem: T("speech.nestedItem", "Sub-item {{ordinal}}"),
|
|
87
|
+
emailAt: T("speech.emailAt", "at"),
|
|
88
|
+
emailDot: T("speech.emailDot", "dot")
|
|
89
|
+
}), [T]), Z = h(() => {
|
|
90
|
+
V(), w.cancel(), O({ type: "stop" });
|
|
91
|
+
}, [V, w]), Ee = h((e) => {
|
|
92
|
+
let t = w.listVoices().find((t) => t.name === e) ?? null;
|
|
93
|
+
if (t) {
|
|
94
|
+
Z();
|
|
95
|
+
try {
|
|
96
|
+
w.speak([te(J)], {
|
|
97
|
+
voice: t,
|
|
98
|
+
lang: Y(J),
|
|
99
|
+
fallback: !1
|
|
100
|
+
});
|
|
101
|
+
} catch {}
|
|
102
|
+
}
|
|
103
|
+
}, [
|
|
104
|
+
w,
|
|
105
|
+
J,
|
|
100
106
|
Z,
|
|
101
|
-
|
|
102
|
-
]),
|
|
103
|
-
|
|
104
|
-
let
|
|
105
|
-
if (!
|
|
106
|
-
if (
|
|
107
|
-
|
|
107
|
+
Y
|
|
108
|
+
]), De = h((e) => N.get(e) ?? null, [N]), Oe = h((e, t, n) => {
|
|
109
|
+
V();
|
|
110
|
+
let i = !1, a = () => {}, o = (r) => {
|
|
111
|
+
if (!i) {
|
|
112
|
+
if (i = !0, z.current = null, clearTimeout(s), a(), r.length === 0) {
|
|
113
|
+
M(!0);
|
|
108
114
|
return;
|
|
109
115
|
}
|
|
110
|
-
|
|
116
|
+
A(r), B.current(e, t, r, n);
|
|
111
117
|
}
|
|
112
|
-
}, s = setTimeout(() => o(
|
|
113
|
-
a =
|
|
114
|
-
|
|
118
|
+
}, s = setTimeout(() => o(w.listVoices()), r);
|
|
119
|
+
a = w.subscribeVoices(() => o(w.listVoices())), z.current = () => {
|
|
120
|
+
i || (i = !0, clearTimeout(s), a(), z.current = null);
|
|
115
121
|
};
|
|
116
|
-
}, [
|
|
117
|
-
let
|
|
118
|
-
if (
|
|
119
|
-
let e =
|
|
120
|
-
e.length > 0 && (
|
|
122
|
+
}, [V, w]), Q = h((e, t, n, r) => {
|
|
123
|
+
let s = n;
|
|
124
|
+
if (s.length === 0) {
|
|
125
|
+
let e = w.listVoices();
|
|
126
|
+
e.length > 0 && (s = e, A(e));
|
|
121
127
|
}
|
|
122
|
-
let
|
|
123
|
-
if (
|
|
124
|
-
let t =
|
|
125
|
-
|
|
128
|
+
let l = Y(r), u = o(c(!0, s, r, j));
|
|
129
|
+
if (u === "block") {
|
|
130
|
+
let t = T("speech.noVoiceForReply", "This reply is in {{language}}, and no {{language}} voice is installed on this device.", { language: i(l, E) });
|
|
131
|
+
P((n) => new Map(n).set(e, t));
|
|
126
132
|
return;
|
|
127
133
|
}
|
|
128
|
-
if (
|
|
129
|
-
|
|
134
|
+
if (u === "wait-for-voices") {
|
|
135
|
+
Oe(e, t, r);
|
|
130
136
|
return;
|
|
131
137
|
}
|
|
132
|
-
|
|
138
|
+
P((t) => {
|
|
133
139
|
if (!t.has(e)) return t;
|
|
134
140
|
let n = new Map(t);
|
|
135
141
|
return n.delete(e), n;
|
|
136
142
|
});
|
|
137
|
-
let
|
|
138
|
-
|
|
143
|
+
let d = F.current + 1;
|
|
144
|
+
F.current = d, O({
|
|
139
145
|
type: "start",
|
|
140
146
|
messageId: e,
|
|
141
|
-
requestId:
|
|
147
|
+
requestId: d
|
|
142
148
|
});
|
|
143
|
-
let
|
|
144
|
-
|
|
145
|
-
requestId:
|
|
146
|
-
chunks:
|
|
149
|
+
let f = ee(t);
|
|
150
|
+
R({
|
|
151
|
+
requestId: d,
|
|
152
|
+
chunks: f,
|
|
147
153
|
index: -1
|
|
148
|
-
}),
|
|
149
|
-
|
|
150
|
-
},
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
rate: xe(r)
|
|
154
|
-
}, {
|
|
155
|
-
onChunkStart: (e) => {
|
|
156
|
-
M.current === u && N.current !== null && (clearTimeout(N.current), N.current = null), F((t) => t?.requestId === u ? {
|
|
157
|
-
...t,
|
|
158
|
-
index: e
|
|
159
|
-
} : M.current === u ? {
|
|
160
|
-
requestId: u,
|
|
161
|
-
chunks: d,
|
|
162
|
-
index: e
|
|
163
|
-
} : t);
|
|
164
|
-
},
|
|
165
|
-
onEnd: () => E({
|
|
166
|
-
type: "finished",
|
|
167
|
-
requestId: u
|
|
168
|
-
}),
|
|
169
|
-
onError: () => E({
|
|
154
|
+
}), I.current !== null && clearTimeout(I.current), I.current = setTimeout(() => {
|
|
155
|
+
R((e) => e?.requestId === d && e.index < 0 ? null : e);
|
|
156
|
+
}, ge);
|
|
157
|
+
let te = () => {
|
|
158
|
+
F.current === d && I.current !== null && (clearTimeout(I.current), I.current = null), O({
|
|
170
159
|
type: "failed",
|
|
171
|
-
requestId:
|
|
172
|
-
})
|
|
173
|
-
}
|
|
160
|
+
requestId: d
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
try {
|
|
164
|
+
w.speak(f, {
|
|
165
|
+
voice: a(s, l, K[r]),
|
|
166
|
+
lang: l,
|
|
167
|
+
rate: we(r)
|
|
168
|
+
}, {
|
|
169
|
+
onChunkStart: (e) => {
|
|
170
|
+
F.current === d && I.current !== null && (clearTimeout(I.current), I.current = null), R((t) => t?.requestId === d ? {
|
|
171
|
+
...t,
|
|
172
|
+
index: e
|
|
173
|
+
} : F.current === d ? {
|
|
174
|
+
requestId: d,
|
|
175
|
+
chunks: f,
|
|
176
|
+
index: e
|
|
177
|
+
} : t);
|
|
178
|
+
},
|
|
179
|
+
onEnd: () => O({
|
|
180
|
+
type: "finished",
|
|
181
|
+
requestId: d
|
|
182
|
+
}),
|
|
183
|
+
onError: () => O({
|
|
184
|
+
type: "failed",
|
|
185
|
+
requestId: d
|
|
186
|
+
})
|
|
187
|
+
});
|
|
188
|
+
} catch {
|
|
189
|
+
te();
|
|
190
|
+
}
|
|
174
191
|
}, [
|
|
175
|
-
S,
|
|
176
192
|
w,
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
193
|
+
E,
|
|
194
|
+
K,
|
|
195
|
+
we,
|
|
196
|
+
Y,
|
|
197
|
+
T,
|
|
198
|
+
j,
|
|
199
|
+
Oe
|
|
183
200
|
]);
|
|
184
201
|
_(() => {
|
|
185
|
-
|
|
202
|
+
B.current = Q;
|
|
186
203
|
}, [Q]);
|
|
187
204
|
let $ = h((e, t, n) => {
|
|
188
|
-
if (!
|
|
189
|
-
let r =
|
|
190
|
-
i && Q(e, i,
|
|
205
|
+
if (!G) return;
|
|
206
|
+
let r = ie(f(t, { labels: he }), n ?? J), i = f(t, { labels: re(r, Te) });
|
|
207
|
+
i && Q(e, i, k, r);
|
|
191
208
|
}, [
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
209
|
+
G,
|
|
210
|
+
Te,
|
|
211
|
+
J,
|
|
195
212
|
Q,
|
|
196
|
-
|
|
197
|
-
]),
|
|
198
|
-
if (
|
|
213
|
+
k
|
|
214
|
+
]), ke = h((e, t, n) => {
|
|
215
|
+
if (oe(D, e)) {
|
|
199
216
|
Z();
|
|
200
217
|
return;
|
|
201
218
|
}
|
|
202
219
|
$(e, t, n);
|
|
203
220
|
}, [
|
|
204
|
-
|
|
221
|
+
D,
|
|
205
222
|
$,
|
|
206
223
|
Z
|
|
207
224
|
]);
|
|
208
225
|
_(() => {
|
|
209
226
|
g || Z();
|
|
210
227
|
}, [g, Z]), _(() => {
|
|
211
|
-
Z(),
|
|
212
|
-
}, [
|
|
213
|
-
|
|
214
|
-
}, [
|
|
215
|
-
|
|
216
|
-
}, [
|
|
228
|
+
Z(), P(/* @__PURE__ */ new Map());
|
|
229
|
+
}, [be, Z]), _(() => {
|
|
230
|
+
P((e) => e.size === 0 ? e : /* @__PURE__ */ new Map()), Z();
|
|
231
|
+
}, [J, Z]), _(() => () => {
|
|
232
|
+
z.current?.(), z.current = null, w.cancel();
|
|
233
|
+
}, [w]), _(() => {
|
|
217
234
|
if (typeof window > "u") return;
|
|
218
|
-
let e = () =>
|
|
235
|
+
let e = () => w.cancel();
|
|
219
236
|
return window.addEventListener("pagehide", e), () => window.removeEventListener("pagehide", e);
|
|
220
|
-
}, [
|
|
221
|
-
if (typeof document > "u" || !
|
|
237
|
+
}, [w]), _(() => {
|
|
238
|
+
if (typeof document > "u" || !G) return;
|
|
222
239
|
let e = () => {
|
|
223
240
|
if (document.visibilityState !== "visible") return;
|
|
224
|
-
let e =
|
|
225
|
-
e.length > 0 &&
|
|
241
|
+
let e = w.listVoices();
|
|
242
|
+
e.length > 0 && V(), A(e), M(!1), P((e) => e.size === 0 ? e : /* @__PURE__ */ new Map());
|
|
226
243
|
};
|
|
227
244
|
return document.addEventListener("visibilitychange", e), window.addEventListener("focus", e), () => {
|
|
228
245
|
document.removeEventListener("visibilitychange", e), window.removeEventListener("focus", e);
|
|
229
246
|
};
|
|
230
247
|
}, [
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
248
|
+
V,
|
|
249
|
+
w,
|
|
250
|
+
G
|
|
234
251
|
]);
|
|
235
|
-
let
|
|
252
|
+
let Ae = y($);
|
|
236
253
|
_(() => {
|
|
237
|
-
|
|
254
|
+
Ae.current = $;
|
|
238
255
|
}, [$]), _(() => {
|
|
239
|
-
if (!(!
|
|
256
|
+
if (!(!H && !W || !g || !G)) return m.subscribe((e, t) => {
|
|
240
257
|
let r = e.activeConversationId;
|
|
241
258
|
if (!r || r !== t.activeConversationId) return;
|
|
242
259
|
let i = e.processingByConversationId[r], a = t.processingByConversationId[r];
|
|
@@ -244,65 +261,67 @@ var C = ({ children: m, visible: g = !0, engine: S = r() }) => {
|
|
|
244
261
|
let o = i.messageId ?? a?.messageId ?? null;
|
|
245
262
|
if (!o) return;
|
|
246
263
|
let s = e.conversations.find((e) => e.id === r)?.messages.find((e) => e.id === o);
|
|
247
|
-
if (!s || s.role !== "assistant" || n(s) !==
|
|
264
|
+
if (!s || s.role !== "assistant" || n(s) !== W || ve.current) return;
|
|
248
265
|
let { text: c } = ue(s.content);
|
|
249
|
-
c.trim()
|
|
266
|
+
if (c.trim()) try {
|
|
267
|
+
Ae.current(o, c, s.metadata?.lang);
|
|
268
|
+
} catch {}
|
|
250
269
|
});
|
|
251
270
|
}, [
|
|
252
|
-
|
|
253
|
-
V,
|
|
271
|
+
H,
|
|
254
272
|
W,
|
|
273
|
+
G,
|
|
255
274
|
g
|
|
256
275
|
]);
|
|
257
|
-
let
|
|
258
|
-
|
|
276
|
+
let je = v(() => l(k, q.tag), [k, q]), Me = v(() => a(k, q.tag, K[J]), [
|
|
277
|
+
k,
|
|
278
|
+
q,
|
|
259
279
|
K,
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
toggle: Te,
|
|
280
|
+
J
|
|
281
|
+
]), Ne = v(() => ({
|
|
282
|
+
isSupported: G,
|
|
283
|
+
availability: X,
|
|
284
|
+
isBlocked: X === "no-voices",
|
|
285
|
+
disabledReason: X === "no-voices" ? T("speech.noVoicesOnDevice", "This device has no speech voices installed. Add one in your device speech or accessibility settings.") : null,
|
|
286
|
+
blockedFor: De,
|
|
287
|
+
voiceChoices: je,
|
|
288
|
+
spokenChunks: se(D, L),
|
|
289
|
+
activeVoiceName: Me?.name ?? null,
|
|
290
|
+
preferredVoiceName: K[J] ?? null,
|
|
291
|
+
setVoice: (e) => Ce(J, e),
|
|
292
|
+
speakingMessageId: D.status === "speaking" ? D.messageId : null,
|
|
293
|
+
isSpeaking: (e) => oe(D, e),
|
|
294
|
+
toggle: ke,
|
|
276
295
|
stop: Z,
|
|
277
|
-
autoSpeakEnabled:
|
|
278
|
-
setAutoSpeak:
|
|
279
|
-
sessionSpeaking:
|
|
280
|
-
setSessionSpeaking:
|
|
281
|
-
setSessionMicOpen:
|
|
282
|
-
previewVoice:
|
|
296
|
+
autoSpeakEnabled: H,
|
|
297
|
+
setAutoSpeak: U,
|
|
298
|
+
sessionSpeaking: W,
|
|
299
|
+
setSessionSpeaking: _e,
|
|
300
|
+
setSessionMicOpen: ye,
|
|
301
|
+
previewVoice: Ee
|
|
283
302
|
}), [
|
|
284
|
-
W,
|
|
285
|
-
Y,
|
|
286
|
-
Ce,
|
|
287
|
-
De,
|
|
288
|
-
Oe,
|
|
289
303
|
G,
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
304
|
+
X,
|
|
305
|
+
De,
|
|
306
|
+
je,
|
|
307
|
+
Me,
|
|
308
|
+
K,
|
|
309
|
+
Ce,
|
|
310
|
+
J,
|
|
311
|
+
D,
|
|
312
|
+
ke,
|
|
294
313
|
Z,
|
|
295
|
-
|
|
296
|
-
B,
|
|
297
|
-
V,
|
|
314
|
+
H,
|
|
298
315
|
U,
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
316
|
+
W,
|
|
317
|
+
ye,
|
|
318
|
+
Ee,
|
|
319
|
+
T,
|
|
320
|
+
L
|
|
302
321
|
]);
|
|
303
|
-
return /* @__PURE__ */
|
|
304
|
-
value:
|
|
305
|
-
children:
|
|
322
|
+
return /* @__PURE__ */ me(x.Provider, {
|
|
323
|
+
value: Ne,
|
|
324
|
+
children: de
|
|
306
325
|
});
|
|
307
326
|
};
|
|
308
327
|
//#endregion
|
|
@@ -10,9 +10,13 @@ interface Props {
|
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* Per-mode presentation metadata
|
|
14
|
-
*
|
|
15
|
-
* transport-level value ('general' / 'api-calls' / 'vibe-plugins').
|
|
13
|
+
* Per-mode presentation metadata: the icon, and the shared English name used
|
|
14
|
+
* when a product's `label` is empty ('Ask' / 'Take action'), while the mode ID
|
|
15
|
+
* stays the transport-level value ('general' / 'api-calls' / 'vibe-plugins').
|
|
16
|
+
*
|
|
17
|
+
* ★ `i18nKey` is NOT the key the pill requests — that is `mode.<id>`, below.
|
|
18
|
+
* Nothing passes `i18nKey` to a translator; it is kept only because this table
|
|
19
|
+
* is published. Seed from `i18nManifest.ts`, never from this field.
|
|
16
20
|
*/
|
|
17
21
|
export declare const ASSISTANT_MODE_META: Record<AssistantMode, {
|
|
18
22
|
i18nKey: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssistantModeSelector.d.ts","sourceRoot":"","sources":["../../../../../src/shared/assistant/ui/composer/AssistantModeSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,EAAE,EAAsB,MAAM,OAAO,CAAC;AACzE,OAAO,EAA8B,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAI9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"AssistantModeSelector.d.ts","sourceRoot":"","sources":["../../../../../src/shared/assistant/ui/composer/AssistantModeSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,EAAE,EAAsB,MAAM,OAAO,CAAC;AACzE,OAAO,EAA8B,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAI9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIjD,UAAU,KAAK;IACb,IAAI,EAAE,aAAa,CAAC;IACpB,iFAAiF;IACjF,cAAc,EAAE,mBAAmB,EAAE,CAAC;IACtC,YAAY,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;IAC5C,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,CACtC,aAAa,EACb;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,UAAU,CAAA;CAAE,CAsBxD,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,GAChB,MAAM,GAAG,IAAI,CAgBf;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC,KAAK,CAkI3C,CAAC"}
|
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
import { useAssistantTr as e } from "../../i18n.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { ASSISTANT_MODE_FALLBACK_LABELS as t } from "../../modeCopy.js";
|
|
3
|
+
import { useCallback as n, useRef as r } from "react";
|
|
4
|
+
import { ShieldCheck as i, Sparkles as a, Zap as o } from "lucide-react";
|
|
5
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
5
6
|
//#region src/shared/assistant/ui/composer/AssistantModeSelector.tsx
|
|
6
|
-
var
|
|
7
|
+
var l = {
|
|
7
8
|
general: {
|
|
8
9
|
i18nKey: "mode.ask",
|
|
9
|
-
fallback:
|
|
10
|
-
icon:
|
|
10
|
+
fallback: t.general,
|
|
11
|
+
icon: a
|
|
11
12
|
},
|
|
12
13
|
assistant: {
|
|
13
14
|
i18nKey: "mode.ask",
|
|
14
|
-
fallback:
|
|
15
|
-
icon:
|
|
15
|
+
fallback: t.assistant,
|
|
16
|
+
icon: a
|
|
16
17
|
},
|
|
17
18
|
"api-calls": {
|
|
18
19
|
i18nKey: "mode.takeAction",
|
|
19
|
-
fallback: "
|
|
20
|
-
icon:
|
|
20
|
+
fallback: t["api-calls"],
|
|
21
|
+
icon: i
|
|
21
22
|
},
|
|
22
23
|
"vibe-plugins": {
|
|
23
24
|
i18nKey: "mode.build",
|
|
24
|
-
fallback: "
|
|
25
|
-
icon:
|
|
25
|
+
fallback: t["vibe-plugins"],
|
|
26
|
+
icon: o
|
|
26
27
|
}
|
|
27
28
|
};
|
|
28
|
-
function
|
|
29
|
+
function u(e, t, n) {
|
|
29
30
|
switch (e) {
|
|
30
31
|
case "Home": return 0;
|
|
31
32
|
case "End": return n;
|
|
@@ -36,21 +37,21 @@ function l(e, t, n) {
|
|
|
36
37
|
default: return null;
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
|
-
var
|
|
40
|
-
let d = e(), f =
|
|
41
|
-
if (
|
|
42
|
-
let
|
|
43
|
-
if (
|
|
40
|
+
var d = ({ mode: t, availableModes: i, onModeChange: a, disabled: o = !1 }) => {
|
|
41
|
+
let d = e(), f = r(null), p = n((e) => {
|
|
42
|
+
if (o) return;
|
|
43
|
+
let n = e.target?.closest("[data-mode-id]")?.dataset.modeId, r = n ? i.findIndex((e) => e.id === n) : -1, s = r >= 0 ? r : i.findIndex((e) => e.id === t), c = u(e.key, s, i.length - 1);
|
|
44
|
+
if (c === null) return;
|
|
44
45
|
e.preventDefault();
|
|
45
|
-
let
|
|
46
|
-
|
|
46
|
+
let l = i[c];
|
|
47
|
+
l && (f.current?.querySelector(`[data-mode-id="${l.id}"]`)?.focus(), l.id !== t && a(l.id));
|
|
47
48
|
}, [
|
|
48
49
|
i,
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
o,
|
|
51
|
+
t,
|
|
51
52
|
a
|
|
52
53
|
]);
|
|
53
|
-
return i.length < 2 ? null : /* @__PURE__ */
|
|
54
|
+
return i.length < 2 ? null : /* @__PURE__ */ s("div", {
|
|
54
55
|
ref: f,
|
|
55
56
|
role: "radiogroup",
|
|
56
57
|
"aria-label": d("modeSelector.ariaLabel", "Select assistant mode"),
|
|
@@ -58,24 +59,24 @@ var u = ({ mode: r, availableModes: i, onModeChange: a, disabled: u = !1 }) => {
|
|
|
58
59
|
className: "inline-flex max-w-full items-center gap-1 overflow-x-auto rounded-full border border-border-subtle bg-bg-elevated p-1 [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
59
60
|
"data-testid": "assistant-mode-selector",
|
|
60
61
|
children: i.map((e) => {
|
|
61
|
-
let
|
|
62
|
-
return /* @__PURE__ */
|
|
62
|
+
let n = l[e.id], r = n.icon, i = e.id === t;
|
|
63
|
+
return /* @__PURE__ */ c("button", {
|
|
63
64
|
type: "button",
|
|
64
65
|
role: "radio",
|
|
65
66
|
"aria-checked": i,
|
|
66
67
|
tabIndex: i ? 0 : -1,
|
|
67
|
-
disabled:
|
|
68
|
+
disabled: o,
|
|
68
69
|
onClick: () => a(e.id),
|
|
69
70
|
"data-mode-id": e.id,
|
|
70
71
|
className: `flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full px-3 py-1.5 text-[13px] font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong disabled:opacity-50 ${i ? "bg-action-primary-bg text-action-primary-text shadow-sm" : "text-text-secondary hover:bg-bg-surface hover:text-text-primary"}`,
|
|
71
72
|
"data-testid": `assistant-mode-option-${e.id}`,
|
|
72
|
-
children: [/* @__PURE__ */
|
|
73
|
+
children: [/* @__PURE__ */ s(r, {
|
|
73
74
|
className: "size-3.5",
|
|
74
75
|
"aria-hidden": "true"
|
|
75
|
-
}), /* @__PURE__ */
|
|
76
|
+
}), /* @__PURE__ */ s("span", { children: d(`mode.${e.id}`, e.label || n.fallback) })]
|
|
76
77
|
}, e.id);
|
|
77
78
|
})
|
|
78
79
|
});
|
|
79
80
|
};
|
|
80
81
|
//#endregion
|
|
81
|
-
export {
|
|
82
|
+
export { l as ASSISTANT_MODE_META, d as AssistantModeSelector, u as nextModeIndex };
|
|
@@ -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;AAgB7D,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;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aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,0EAA0E;IAC1E,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,4DAA4D;IAC5D,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,CAukB3C,CAAC"}
|
|
@@ -165,7 +165,7 @@ var _ = ({ session: _, turns: y = [], onSaveTranscript: b, onContinueInChat: x,
|
|
|
165
165
|
onClick: () => W((e) => !e),
|
|
166
166
|
className: `absolute ${B ? "bottom-6 right-6 size-14" : V ? "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`,
|
|
167
167
|
"aria-pressed": U,
|
|
168
|
-
"aria-label": N("voiceSession.
|
|
168
|
+
"aria-label": N("voiceSession.transcriptTitle", "Voice transcript"),
|
|
169
169
|
"data-testid": "assistant-voice-transcript-toggle",
|
|
170
170
|
children: /* @__PURE__ */ h(ae, { className: B ? "size-6" : V ? "size-4" : "size-5" })
|
|
171
171
|
}),
|