@burdenoff/fe-libs 2026.925.3 → 2026.925.5
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/api.d.ts +19 -1
- package/dist/shared/assistant/api.d.ts.map +1 -1
- package/dist/shared/assistant/api.js +57 -46
- package/dist/shared/assistant/index.d.ts +1 -0
- package/dist/shared/assistant/index.d.ts.map +1 -1
- package/dist/shared/assistant/sandboxReadiness.d.ts +45 -6
- package/dist/shared/assistant/sandboxReadiness.d.ts.map +1 -1
- package/dist/shared/assistant/sandboxReadiness.js +25 -11
- package/dist/shared/assistant/speech/browserSpeechEngine.d.ts.map +1 -1
- package/dist/shared/assistant/speech/browserSpeechEngine.js +1 -1
- package/dist/shared/assistant/transportErrors.d.ts +2 -0
- package/dist/shared/assistant/transportErrors.d.ts.map +1 -1
- package/dist/shared/assistant/transportErrors.js +5 -1
- package/dist/shared/assistant/turnProgress.d.ts +38 -0
- package/dist/shared/assistant/turnProgress.d.ts.map +1 -1
- package/dist/shared/assistant/turnProgress.js +24 -2
- package/dist/shared/assistant/turnTimeline.d.ts +288 -0
- package/dist/shared/assistant/turnTimeline.d.ts.map +1 -0
- package/dist/shared/assistant/turnTimeline.js +291 -0
- package/dist/shared/assistant/ui/AssistantChatArea.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantChatArea.js +537 -468
- package/dist/shared/assistant/ui/AssistantSpeechProvider.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantSpeechProvider.js +190 -185
- package/dist/shared/assistant/ui/useVoiceSession.d.ts +7 -1
- package/dist/shared/assistant/ui/useVoiceSession.d.ts.map +1 -1
- package/dist/shared/assistant/ui/useVoiceSession.js +87 -80
- package/dist/shared/assistant/voice/voiceSession.d.ts +25 -0
- package/dist/shared/assistant/voice/voiceSession.d.ts.map +1 -1
- package/dist/shared/assistant/voice/voiceSession.js +29 -13
- package/dist/shared-assistant.js +122 -121
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssistantSpeechProvider.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/AssistantSpeechProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAUL,KAAK,EAAE,EACP,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAKf,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AA2B/D,OAAO,EAQL,KAAK,iBAAiB,EACvB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"AssistantSpeechProvider.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/AssistantSpeechProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAUL,KAAK,EAAE,EACP,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAKf,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AA2B/D,OAAO,EAQL,KAAK,iBAAiB,EACvB,MAAM,uBAAuB,CAAC;AAmB/B,MAAM,WAAW,2BAA2B;IAC1C,gFAAgF;IAChF,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,iBAAiB,CAAC;IAChC;;;;OAIG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB,6EAA6E;IAC7E,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B;;;;;;OAMG;IACH,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;IACjD;;;;OAIG;IACH,YAAY,EAAE,SAAS,eAAe,EAAE,CAAC;IACzC,8EAA8E;IAC9E;;;;;;OAMG;IACH,YAAY,EAAE;QAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACzD,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B;;;;;;;;OAQG;IACH,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,mEAAmE;IACnE,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC7C,kDAAkD;IAClD,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;IAC3C;;;;;;;OAOG;IACH,MAAM,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3E,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,YAAY,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC;;;;;;;;;;;;;OAaG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB,kBAAkB,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/C;;;;;;;;;;;;;OAaG;IACH,iBAAiB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3C,kFAAkF;IAClF,YAAY,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C;AA4BD,wBAAgB,kBAAkB,IAAI,2BAA2B,CAEhE;AAED,UAAU,KAAK;IACb,QAAQ,EAAE,SAAS,CAAC;IACpB,0DAA0D;IAC1D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAED,eAAO,MAAM,uBAAuB,EAAE,EAAE,CAAC,KAAK,CAo4B7C,CAAC"}
|
|
@@ -4,20 +4,21 @@ import { isVoiceTurn as n } from "../voice/turnVisibility.js";
|
|
|
4
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
5
|
import { getSpeechEngine as u, subscribeSpeechEngine as d } from "../speech/createSpeechEngine.js";
|
|
6
6
|
import { chunkForSpeech as ee, toSpeakableText as f } from "../voice/speakableText.js";
|
|
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
|
|
14
|
-
import { isTurnInFlight as
|
|
15
|
-
import { parseToolActivity as
|
|
7
|
+
import { voicePreviewText as p } from "../voice/voicePreview.js";
|
|
8
|
+
import { findAssistantLanguage as m } from "../voice/languages.js";
|
|
9
|
+
import { resolveLanguagePair as te } from "../voice/languagePair.js";
|
|
10
|
+
import { speechLabelsFor as ne } from "../voice/speechLabels.js";
|
|
11
|
+
import { resolveSpeechLocale as re } from "../voice/replyLanguage.js";
|
|
12
|
+
import { IDLE_PLAYBACK as ie, isSpeakingMessage as h, publishedChunks as ae, speechPlaybackReducer as oe } from "../voice/speechPlayback.js";
|
|
13
|
+
import { useAssistantStore as g } from "../store.js";
|
|
14
|
+
import { isTurnInFlight as se } from "../turnState.js";
|
|
15
|
+
import { parseToolActivity as ce } from "./AssistantToolActivity.js";
|
|
16
16
|
import "../speech/index.js";
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
17
|
+
import { markTurn as le } from "../turnTimeline.js";
|
|
18
|
+
import { createContext as _, useCallback as v, useContext as y, useEffect as b, useMemo as x, useReducer as ue, useRef as S, useState as C, useSyncExternalStore as de } from "react";
|
|
19
|
+
import { jsx as fe } from "react/jsx-runtime";
|
|
19
20
|
//#region src/shared/assistant/ui/AssistantSpeechProvider.tsx
|
|
20
|
-
var
|
|
21
|
+
var pe = {
|
|
21
22
|
codeBlock: "",
|
|
22
23
|
image: "",
|
|
23
24
|
link: "",
|
|
@@ -26,7 +27,7 @@ var he = {
|
|
|
26
27
|
emailAt: "at",
|
|
27
28
|
emailDot: "dot",
|
|
28
29
|
nestedItem: ""
|
|
29
|
-
},
|
|
30
|
+
}, me = 4e3, w = _({
|
|
30
31
|
isSupported: !1,
|
|
31
32
|
availability: "unsupported",
|
|
32
33
|
isBlocked: !0,
|
|
@@ -48,281 +49,285 @@ var he = {
|
|
|
48
49
|
setSessionMicOpen: () => {},
|
|
49
50
|
previewVoice: () => {}
|
|
50
51
|
});
|
|
51
|
-
function
|
|
52
|
-
return
|
|
52
|
+
function he() {
|
|
53
|
+
return y(w);
|
|
53
54
|
}
|
|
54
|
-
var
|
|
55
|
-
let
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
var T = ({ children: _, visible: y = !0, engine: he }) => {
|
|
56
|
+
let T = de(d, u, u), E = he ?? T, D = t(), { locale: O } = e(), [k, A] = ue(oe, ie), [j, M] = C(() => E.listVoices()), [N, ge] = C(!1), [_e, P] = C(() => /* @__PURE__ */ new Map()), F = S(0), I = S(null), L = S(null);
|
|
57
|
+
b(() => () => {
|
|
58
|
+
L.current !== null && clearTimeout(L.current);
|
|
58
59
|
}, []);
|
|
59
|
-
let [
|
|
60
|
+
let [ve, R] = C(null), z = S(null), B = S(() => {}), V = v(() => {
|
|
60
61
|
z.current?.(), z.current = null;
|
|
61
|
-
}, []), H =
|
|
62
|
-
|
|
63
|
-
}, []),
|
|
64
|
-
|
|
65
|
-
if (!
|
|
62
|
+
}, []), H = g((e) => e.autoSpeakEnabled), ye = g((e) => e.setAutoSpeak), [U, be] = C(!1), xe = S(!1), Se = v((e) => {
|
|
63
|
+
xe.current = e;
|
|
64
|
+
}, []), Ce = g((e) => e.activeConversationId), W = x(() => E.isSupported(), [E]);
|
|
65
|
+
b(() => {
|
|
66
|
+
if (!W) return;
|
|
66
67
|
let e = () => {
|
|
67
|
-
|
|
68
|
+
M(E.listVoices()), P((e) => e.size === 0 ? e : /* @__PURE__ */ new Map());
|
|
68
69
|
};
|
|
69
|
-
return e(),
|
|
70
|
-
}, [
|
|
71
|
-
let
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
]),
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
]),
|
|
81
|
-
codeBlock:
|
|
82
|
-
image:
|
|
83
|
-
link:
|
|
84
|
-
largeTable:
|
|
85
|
-
truncated:
|
|
86
|
-
nestedItem:
|
|
87
|
-
emailAt:
|
|
88
|
-
emailDot:
|
|
89
|
-
}), [
|
|
90
|
-
V(),
|
|
91
|
-
}, [V,
|
|
92
|
-
let t =
|
|
70
|
+
return e(), E.subscribeVoices(e);
|
|
71
|
+
}, [E, W]);
|
|
72
|
+
let we = g((e) => e.assistantLanguage), Te = g((e) => e.replyLanguage), G = g((e) => e.preferredVoices), Ee = g((e) => e.setPreferredVoice), K = x(() => te(we, Te, O).reply, [
|
|
73
|
+
we,
|
|
74
|
+
Te,
|
|
75
|
+
O
|
|
76
|
+
]), q = K.code, J = v((e) => m(e)?.tag ?? s(e), []), De = v((e) => m(e)?.rate ?? .9, []), Y = x(() => c(W, j, K.tag, N), [
|
|
77
|
+
W,
|
|
78
|
+
j,
|
|
79
|
+
K,
|
|
80
|
+
N
|
|
81
|
+
]), X = x(() => ({
|
|
82
|
+
codeBlock: D("speech.codeBlock", "Code block"),
|
|
83
|
+
image: D("speech.image", "image"),
|
|
84
|
+
link: D("speech.link", "link"),
|
|
85
|
+
largeTable: D("speech.largeTable", "Table with {{rows}} rows and {{columns}} columns"),
|
|
86
|
+
truncated: D("speech.truncated", "The rest of this message is not read aloud"),
|
|
87
|
+
nestedItem: D("speech.nestedItem", "Sub-item {{ordinal}}"),
|
|
88
|
+
emailAt: D("speech.emailAt", "at"),
|
|
89
|
+
emailDot: D("speech.emailDot", "dot")
|
|
90
|
+
}), [D]), Z = v(() => {
|
|
91
|
+
V(), I.current = null, E.cancel(), A({ type: "stop" });
|
|
92
|
+
}, [V, E]), Oe = v((e) => {
|
|
93
|
+
let t = E.listVoices().find((t) => t.name === e) ?? null;
|
|
93
94
|
if (t) {
|
|
94
95
|
Z();
|
|
95
96
|
try {
|
|
96
|
-
|
|
97
|
+
E.speak([p(q)], {
|
|
97
98
|
voice: t,
|
|
98
|
-
lang:
|
|
99
|
+
lang: J(q),
|
|
99
100
|
fallback: !1
|
|
100
101
|
});
|
|
101
102
|
} catch {}
|
|
102
103
|
}
|
|
103
104
|
}, [
|
|
104
|
-
|
|
105
|
-
|
|
105
|
+
E,
|
|
106
|
+
q,
|
|
106
107
|
Z,
|
|
107
|
-
|
|
108
|
-
]),
|
|
108
|
+
J
|
|
109
|
+
]), ke = v((e) => _e.get(e) ?? null, [_e]), Ae = v((e, t, n, i) => {
|
|
109
110
|
V();
|
|
110
|
-
let
|
|
111
|
-
if (!
|
|
112
|
-
if (
|
|
113
|
-
|
|
111
|
+
let a = !1, o = () => {}, s = (r) => {
|
|
112
|
+
if (!a) {
|
|
113
|
+
if (a = !0, z.current = null, clearTimeout(c), o(), r.length === 0) {
|
|
114
|
+
ge(!0);
|
|
114
115
|
return;
|
|
115
116
|
}
|
|
116
|
-
|
|
117
|
+
M(r), B.current(e, t, r, n, i);
|
|
117
118
|
}
|
|
118
|
-
},
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
}, c = setTimeout(() => s(E.listVoices()), r);
|
|
120
|
+
o = E.subscribeVoices(() => s(E.listVoices())), z.current = () => {
|
|
121
|
+
a || (a = !0, clearTimeout(c), o(), z.current = null);
|
|
121
122
|
};
|
|
122
|
-
}, [V,
|
|
123
|
-
let
|
|
124
|
-
if (
|
|
125
|
-
let e =
|
|
126
|
-
e.length > 0 && (
|
|
123
|
+
}, [V, E]), Q = v((e, t, n, r, s = !1) => {
|
|
124
|
+
let l = n;
|
|
125
|
+
if (l.length === 0) {
|
|
126
|
+
let e = E.listVoices();
|
|
127
|
+
e.length > 0 && (l = e, M(e));
|
|
127
128
|
}
|
|
128
|
-
let
|
|
129
|
-
if (
|
|
130
|
-
let t =
|
|
129
|
+
let u = J(r), d = o(c(!0, l, r, N));
|
|
130
|
+
if (d === "block") {
|
|
131
|
+
let t = D("speech.noVoiceForReply", "This reply is in {{language}}, and no {{language}} voice is installed on this device.", { language: i(u, O) });
|
|
131
132
|
P((n) => new Map(n).set(e, t));
|
|
132
133
|
return;
|
|
133
134
|
}
|
|
134
|
-
if (
|
|
135
|
-
|
|
135
|
+
if (d === "wait-for-voices") {
|
|
136
|
+
Ae(e, t, r, s);
|
|
136
137
|
return;
|
|
137
138
|
}
|
|
138
139
|
P((t) => {
|
|
139
140
|
if (!t.has(e)) return t;
|
|
140
141
|
let n = new Map(t);
|
|
141
142
|
return n.delete(e), n;
|
|
142
|
-
});
|
|
143
|
-
let
|
|
144
|
-
F.current =
|
|
143
|
+
}), V();
|
|
144
|
+
let f = F.current + 1;
|
|
145
|
+
F.current = f, A({
|
|
145
146
|
type: "start",
|
|
146
147
|
messageId: e,
|
|
147
|
-
requestId:
|
|
148
|
-
});
|
|
149
|
-
let
|
|
148
|
+
requestId: f
|
|
149
|
+
}), I.current = s ? f : null, s && le(e, "ttsStarted");
|
|
150
|
+
let p = ee(t);
|
|
150
151
|
R({
|
|
151
|
-
requestId:
|
|
152
|
-
chunks:
|
|
152
|
+
requestId: f,
|
|
153
|
+
chunks: p,
|
|
153
154
|
index: -1
|
|
154
|
-
}),
|
|
155
|
-
R((e) => e?.requestId ===
|
|
156
|
-
},
|
|
157
|
-
let
|
|
158
|
-
F.current ===
|
|
155
|
+
}), L.current !== null && clearTimeout(L.current), L.current = setTimeout(() => {
|
|
156
|
+
R((e) => e?.requestId === f && e.index < 0 ? null : e);
|
|
157
|
+
}, me);
|
|
158
|
+
let m = () => {
|
|
159
|
+
F.current === f && L.current !== null && (clearTimeout(L.current), L.current = null), A({
|
|
159
160
|
type: "failed",
|
|
160
|
-
requestId:
|
|
161
|
+
requestId: f
|
|
161
162
|
});
|
|
162
163
|
};
|
|
163
164
|
try {
|
|
164
|
-
|
|
165
|
-
voice: a(
|
|
166
|
-
lang:
|
|
167
|
-
rate:
|
|
165
|
+
E.speak(p, {
|
|
166
|
+
voice: a(l, u, G[r]),
|
|
167
|
+
lang: u,
|
|
168
|
+
rate: De(r)
|
|
168
169
|
}, {
|
|
170
|
+
onStart: () => {
|
|
171
|
+
F.current === f && I.current === f && le(e, "firstAudio");
|
|
172
|
+
},
|
|
169
173
|
onChunkStart: (e) => {
|
|
170
|
-
F.current ===
|
|
174
|
+
F.current === f && L.current !== null && (clearTimeout(L.current), L.current = null), R((t) => t?.requestId === f ? {
|
|
171
175
|
...t,
|
|
172
176
|
index: e
|
|
173
|
-
} : F.current ===
|
|
174
|
-
requestId:
|
|
175
|
-
chunks:
|
|
177
|
+
} : F.current === f ? {
|
|
178
|
+
requestId: f,
|
|
179
|
+
chunks: p,
|
|
176
180
|
index: e
|
|
177
181
|
} : t);
|
|
178
182
|
},
|
|
179
|
-
onEnd: () =>
|
|
183
|
+
onEnd: () => A({
|
|
180
184
|
type: "finished",
|
|
181
|
-
requestId:
|
|
185
|
+
requestId: f
|
|
182
186
|
}),
|
|
183
|
-
onError: () =>
|
|
187
|
+
onError: () => A({
|
|
184
188
|
type: "failed",
|
|
185
|
-
requestId:
|
|
189
|
+
requestId: f
|
|
186
190
|
})
|
|
187
191
|
});
|
|
188
192
|
} catch {
|
|
189
|
-
|
|
193
|
+
m();
|
|
190
194
|
}
|
|
191
195
|
}, [
|
|
192
|
-
|
|
196
|
+
V,
|
|
193
197
|
E,
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
198
|
+
O,
|
|
199
|
+
G,
|
|
200
|
+
De,
|
|
201
|
+
J,
|
|
202
|
+
D,
|
|
203
|
+
N,
|
|
204
|
+
Ae
|
|
200
205
|
]);
|
|
201
|
-
|
|
206
|
+
b(() => {
|
|
202
207
|
B.current = Q;
|
|
203
208
|
}, [Q]);
|
|
204
|
-
let $ =
|
|
205
|
-
if (!
|
|
206
|
-
let
|
|
207
|
-
|
|
209
|
+
let $ = v((e, t, n, r) => {
|
|
210
|
+
if (!W) return;
|
|
211
|
+
let i = re(f(t, { labels: pe }), n ?? q), a = f(t, { labels: ne(i, X) });
|
|
212
|
+
a && Q(e, a, j, i, r?.auto === !0);
|
|
208
213
|
}, [
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
214
|
+
W,
|
|
215
|
+
X,
|
|
216
|
+
q,
|
|
212
217
|
Q,
|
|
213
|
-
|
|
214
|
-
]),
|
|
215
|
-
if (
|
|
218
|
+
j
|
|
219
|
+
]), je = v((e, t, n) => {
|
|
220
|
+
if (h(k, e)) {
|
|
216
221
|
Z();
|
|
217
222
|
return;
|
|
218
223
|
}
|
|
219
224
|
$(e, t, n);
|
|
220
225
|
}, [
|
|
221
|
-
|
|
226
|
+
k,
|
|
222
227
|
$,
|
|
223
228
|
Z
|
|
224
229
|
]);
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}, [
|
|
230
|
+
b(() => {
|
|
231
|
+
y || Z();
|
|
232
|
+
}, [y, Z]), b(() => {
|
|
228
233
|
Z(), P(/* @__PURE__ */ new Map());
|
|
229
|
-
}, [
|
|
234
|
+
}, [Ce, Z]), b(() => {
|
|
230
235
|
P((e) => e.size === 0 ? e : /* @__PURE__ */ new Map()), Z();
|
|
231
|
-
}, [
|
|
232
|
-
z.current?.(), z.current = null,
|
|
233
|
-
}, [
|
|
236
|
+
}, [q, Z]), b(() => () => {
|
|
237
|
+
z.current?.(), z.current = null, E.cancel();
|
|
238
|
+
}, [E]), b(() => {
|
|
234
239
|
if (typeof window > "u") return;
|
|
235
|
-
let e = () =>
|
|
240
|
+
let e = () => E.cancel();
|
|
236
241
|
return window.addEventListener("pagehide", e), () => window.removeEventListener("pagehide", e);
|
|
237
|
-
}, [
|
|
238
|
-
if (typeof document > "u" || !
|
|
242
|
+
}, [E]), b(() => {
|
|
243
|
+
if (typeof document > "u" || !W) return;
|
|
239
244
|
let e = () => {
|
|
240
245
|
if (document.visibilityState !== "visible") return;
|
|
241
|
-
let e =
|
|
242
|
-
e.length > 0 && V(),
|
|
246
|
+
let e = E.listVoices();
|
|
247
|
+
e.length > 0 && V(), M(e), ge(!1), P((e) => e.size === 0 ? e : /* @__PURE__ */ new Map());
|
|
243
248
|
};
|
|
244
249
|
return document.addEventListener("visibilitychange", e), window.addEventListener("focus", e), () => {
|
|
245
250
|
document.removeEventListener("visibilitychange", e), window.removeEventListener("focus", e);
|
|
246
251
|
};
|
|
247
252
|
}, [
|
|
248
253
|
V,
|
|
249
|
-
|
|
250
|
-
|
|
254
|
+
E,
|
|
255
|
+
W
|
|
251
256
|
]);
|
|
252
|
-
let
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
}, [$]),
|
|
256
|
-
if (!(!H && !
|
|
257
|
+
let Me = S($);
|
|
258
|
+
b(() => {
|
|
259
|
+
Me.current = $;
|
|
260
|
+
}, [$]), b(() => {
|
|
261
|
+
if (!(!H && !U || !y || !W)) return g.subscribe((e, t) => {
|
|
257
262
|
let r = e.activeConversationId;
|
|
258
263
|
if (!r || r !== t.activeConversationId) return;
|
|
259
264
|
let i = e.processingByConversationId[r], a = t.processingByConversationId[r];
|
|
260
|
-
if (i?.status !== "complete" || !
|
|
265
|
+
if (i?.status !== "complete" || !se(a?.status)) return;
|
|
261
266
|
let o = i.messageId ?? a?.messageId ?? null;
|
|
262
267
|
if (!o) return;
|
|
263
268
|
let s = e.conversations.find((e) => e.id === r)?.messages.find((e) => e.id === o);
|
|
264
|
-
if (!s || s.role !== "assistant" || n(s) !==
|
|
265
|
-
let { text: c } =
|
|
269
|
+
if (!s || s.role !== "assistant" || n(s) !== U || xe.current) return;
|
|
270
|
+
let { text: c } = ce(s.content);
|
|
266
271
|
if (c.trim()) try {
|
|
267
|
-
|
|
272
|
+
Me.current(o, c, s.metadata?.lang, { auto: !0 });
|
|
268
273
|
} catch {}
|
|
269
274
|
});
|
|
270
275
|
}, [
|
|
271
276
|
H,
|
|
277
|
+
U,
|
|
272
278
|
W,
|
|
273
|
-
|
|
274
|
-
g
|
|
279
|
+
y
|
|
275
280
|
]);
|
|
276
|
-
let
|
|
277
|
-
|
|
278
|
-
q,
|
|
281
|
+
let Ne = x(() => l(j, K.tag), [j, K]), Pe = x(() => a(j, K.tag, G[q]), [
|
|
282
|
+
j,
|
|
279
283
|
K,
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
284
|
+
G,
|
|
285
|
+
q
|
|
286
|
+
]), Fe = x(() => ({
|
|
287
|
+
isSupported: W,
|
|
288
|
+
availability: Y,
|
|
289
|
+
isBlocked: Y === "no-voices",
|
|
290
|
+
disabledReason: Y === "no-voices" ? D("speech.noVoicesOnDevice", "This device has no speech voices installed. Add one in your device speech or accessibility settings.") : null,
|
|
291
|
+
blockedFor: ke,
|
|
292
|
+
voiceChoices: Ne,
|
|
293
|
+
spokenChunks: ae(k, ve),
|
|
294
|
+
activeVoiceName: Pe?.name ?? null,
|
|
295
|
+
preferredVoiceName: G[q] ?? null,
|
|
296
|
+
setVoice: (e) => Ee(q, e),
|
|
297
|
+
speakingMessageId: k.status === "speaking" ? k.messageId : null,
|
|
298
|
+
isSpeaking: (e) => h(k, e),
|
|
299
|
+
toggle: je,
|
|
295
300
|
stop: Z,
|
|
296
301
|
autoSpeakEnabled: H,
|
|
297
|
-
setAutoSpeak:
|
|
298
|
-
sessionSpeaking:
|
|
299
|
-
setSessionSpeaking:
|
|
300
|
-
setSessionMicOpen:
|
|
301
|
-
previewVoice:
|
|
302
|
+
setAutoSpeak: ye,
|
|
303
|
+
sessionSpeaking: U,
|
|
304
|
+
setSessionSpeaking: be,
|
|
305
|
+
setSessionMicOpen: Se,
|
|
306
|
+
previewVoice: Oe
|
|
302
307
|
}), [
|
|
308
|
+
W,
|
|
309
|
+
Y,
|
|
310
|
+
ke,
|
|
311
|
+
Ne,
|
|
312
|
+
Pe,
|
|
303
313
|
G,
|
|
304
|
-
|
|
305
|
-
|
|
314
|
+
Ee,
|
|
315
|
+
q,
|
|
316
|
+
k,
|
|
306
317
|
je,
|
|
307
|
-
Me,
|
|
308
|
-
K,
|
|
309
|
-
Ce,
|
|
310
|
-
J,
|
|
311
|
-
D,
|
|
312
|
-
ke,
|
|
313
318
|
Z,
|
|
314
319
|
H,
|
|
315
|
-
U,
|
|
316
|
-
W,
|
|
317
320
|
ye,
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
+
U,
|
|
322
|
+
Se,
|
|
323
|
+
Oe,
|
|
324
|
+
D,
|
|
325
|
+
ve
|
|
321
326
|
]);
|
|
322
|
-
return /* @__PURE__ */
|
|
323
|
-
value:
|
|
324
|
-
children:
|
|
327
|
+
return /* @__PURE__ */ fe(w.Provider, {
|
|
328
|
+
value: Fe,
|
|
329
|
+
children: _
|
|
325
330
|
});
|
|
326
331
|
};
|
|
327
332
|
//#endregion
|
|
328
|
-
export {
|
|
333
|
+
export { T as AssistantSpeechProvider, he as useAssistantSpeech };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { VoiceTurnTiming } from '../turnTimeline';
|
|
1
2
|
import { VoiceSessionSnapshot } from '../voice/voiceSession';
|
|
2
3
|
/**
|
|
3
4
|
* A problem worth TELLING the user about that does not warrant killing the
|
|
@@ -19,7 +20,12 @@ interface Options {
|
|
|
19
20
|
* was spoken. A parent reading an exposed id would sample it a render later,
|
|
20
21
|
* which is a race the very first turn of a session is most likely to lose.
|
|
21
22
|
*/
|
|
22
|
-
onSubmit: (text: string, voiceSessionId: string
|
|
23
|
+
onSubmit: (text: string, voiceSessionId: string,
|
|
24
|
+
/**
|
|
25
|
+
* When the speech that was submitted ended and when its correction grace
|
|
26
|
+
* ran out (BOFF-7801) — taken here because the turn has no id yet.
|
|
27
|
+
*/
|
|
28
|
+
timing: VoiceTurnTiming) => void;
|
|
23
29
|
/**
|
|
24
30
|
* Id + text of the newest assistant reply. A CHANGE of id is what advances
|
|
25
31
|
* the session out of `thinking` — the text alone is not enough, because two
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useVoiceSession.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/useVoiceSession.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useVoiceSession.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/useVoiceSession.ts"],"names":[],"mappings":"AASA,OAAO,EAAe,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEpE,OAAO,EAcL,KAAK,oBAAoB,EAE1B,MAAM,uBAAuB,CAAC;AAsC/B;;;;;;;;GAQG;AACH,MAAM,MAAM,kBAAkB,GAC5B,SAAS,GAAG,eAAe,GAAG,eAAe,GAAG,oBAAoB,CAAC;AAMvE,UAAU,OAAO;IACf,+EAA+E;IAC/E;;;;;;;OAOG;IACH,QAAQ,EAAE,CACR,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,MAAM;IACtB;;;OAGG;IACH,MAAM,EAAE,eAAe,KACpB,IAAI,CAAC;IACV;;;;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;;IAqkBtE,qEAAqE;;IAErE;;;;;;;OAOG;;;;;IAEH,+DAA+D;;IAE/D;;;;;;;OAOG;;IAIH,0EAA0E;;IAE1E,6DAA6D;;IAE7D,sDAAsD;;;;;;EA4B3D"}
|