@burdenoff/fe-libs 2026.1117.6 → 2026.1117.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/shared/assistant/avatar/live/createLiveAvatarSeam.js +8 -0
- package/dist/shared/assistant/index.d.ts +1 -0
- package/dist/shared/assistant/speech/hostedTtsSpeechEngine.js +132 -98
- package/dist/shared/assistant/speech/routingSpeechEngine.js +6 -0
- package/dist/shared/assistant/speech/speechFeed.d.ts +14 -0
- package/dist/shared/assistant/speech/speechFeed.js +7 -0
- package/dist/shared/assistant/speech/types.d.ts +10 -0
- package/dist/shared/assistant/ui/AssistantChatArea.js +1168 -1158
- package/dist/shared/assistant/ui/AssistantSpeechProvider.js +281 -245
- package/dist/shared/assistant/voice/firstClipPrefetchConfig.d.ts +4 -0
- package/dist/shared/assistant/voice/firstClipPrefetchConfig.js +9 -0
- package/dist/shared/assistant/voice/speakableText.d.ts +18 -0
- package/dist/shared/assistant/voice/speakableText.js +113 -107
- package/dist/shared-assistant.js +381 -380
- package/package.json +1 -1
|
@@ -251,6 +251,14 @@ function W(e = {}) {
|
|
|
251
251
|
listVoices: () => e.listVoices(),
|
|
252
252
|
subscribeVoices: (t) => e.subscribeVoices(t),
|
|
253
253
|
wouldSpeakOnAvatar: (e) => t(e).target === "avatar",
|
|
254
|
+
prefetch: (n, r) => {
|
|
255
|
+
let { voice: i, target: a } = t(r);
|
|
256
|
+
e.prefetch?.(n, a === "avatar" && i !== null ? {
|
|
257
|
+
...r,
|
|
258
|
+
voice: i
|
|
259
|
+
} : r);
|
|
260
|
+
},
|
|
261
|
+
cancelPrefetch: () => e.cancelPrefetch?.(),
|
|
254
262
|
speak: (n, a, o) => {
|
|
255
263
|
r();
|
|
256
264
|
let { voice: s, target: c } = t(a);
|
|
@@ -422,6 +422,7 @@ export * from './avatar/live/avatarVoice';
|
|
|
422
422
|
export * from './promptDelivery';
|
|
423
423
|
export * from './speech/appendSpeechQueue';
|
|
424
424
|
export * from './voice/phraseSpeechConfig';
|
|
425
|
+
export * from './voice/firstClipPrefetchConfig';
|
|
425
426
|
export * from './voice/phraseGate';
|
|
426
427
|
export * from './voice/livePhraseSpeech';
|
|
427
428
|
export * from './voice/phrasePlayback';
|
|
@@ -66,14 +66,14 @@ function E(e) {
|
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
-
var
|
|
70
|
-
function
|
|
71
|
-
for (let e of [...
|
|
69
|
+
var ee = "data:audio/wav;base64,UklGRiQAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQAAAAA=", D = [], te = 4;
|
|
70
|
+
function O() {
|
|
71
|
+
for (let e of [...D]) e();
|
|
72
72
|
}
|
|
73
|
-
function
|
|
74
|
-
|
|
73
|
+
function k() {
|
|
74
|
+
D.length = 0;
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function ne(e, t) {
|
|
77
77
|
return new Promise((n) => {
|
|
78
78
|
if (t.aborted) {
|
|
79
79
|
n();
|
|
@@ -88,41 +88,41 @@ function M(e, t) {
|
|
|
88
88
|
t.addEventListener("abort", i, { once: !0 });
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function A(v) {
|
|
92
92
|
let y = v.fetchImpl ?? ((...e) => fetch(...e)), x = v.now ?? (() => Date.now()), S = v.setTimer ?? ((e, t) => {
|
|
93
93
|
let n = setTimeout(e, t);
|
|
94
94
|
return () => clearTimeout(n);
|
|
95
|
-
}), C = null, w = null,
|
|
96
|
-
if (!(
|
|
97
|
-
let e =
|
|
98
|
-
if (
|
|
99
|
-
e.muted = !0, e.src =
|
|
100
|
-
|
|
95
|
+
}), C = null, w = null, O = null, k = !1, A = () => {
|
|
96
|
+
if (!(k || typeof Audio != "function")) try {
|
|
97
|
+
let e = O ?? new Audio();
|
|
98
|
+
if (O = e, C === e) return;
|
|
99
|
+
e.muted = !0, e.src = ee, Promise.resolve(e.play()).then(() => {
|
|
100
|
+
O === e && C !== e && e.pause();
|
|
101
101
|
}, () => {});
|
|
102
102
|
} catch {}
|
|
103
103
|
};
|
|
104
|
-
|
|
105
|
-
let
|
|
104
|
+
D.push(A), D.length > te && D.shift();
|
|
105
|
+
let j = 0, M = null, N = null, P = null, F = null, I = null, L = 0, R = null, z = null, re = () => {
|
|
106
106
|
try {
|
|
107
107
|
return v.getHeaders?.() ?? {};
|
|
108
108
|
} catch {
|
|
109
109
|
return {};
|
|
110
110
|
}
|
|
111
|
-
},
|
|
112
|
-
for (let e of [...
|
|
113
|
-
},
|
|
114
|
-
|
|
115
|
-
},
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
let e =
|
|
119
|
-
e > 0 ?
|
|
111
|
+
}, B = () => x() >= L ? !1 : z === null || h(re()) === z, V = /* @__PURE__ */ new Set(), H = () => {
|
|
112
|
+
for (let e of [...V]) e();
|
|
113
|
+
}, U = () => {
|
|
114
|
+
R !== null && clearTimeout(R), R = null;
|
|
115
|
+
}, W = (e) => {
|
|
116
|
+
U(), R = setTimeout(() => {
|
|
117
|
+
R = null;
|
|
118
|
+
let e = L - x();
|
|
119
|
+
e > 0 ? W(e) : H();
|
|
120
120
|
}, e);
|
|
121
|
-
},
|
|
122
|
-
|
|
123
|
-
},
|
|
121
|
+
}, G = (e, t) => {
|
|
122
|
+
L = x() + e, z = t, W(e), H();
|
|
123
|
+
}, K = () => {
|
|
124
124
|
w &&= (URL.revokeObjectURL(w), null);
|
|
125
|
-
},
|
|
125
|
+
}, q = () => {
|
|
126
126
|
if (C) {
|
|
127
127
|
C.onended = null, C.onerror = null;
|
|
128
128
|
try {
|
|
@@ -130,54 +130,64 @@ function N(v) {
|
|
|
130
130
|
} catch {}
|
|
131
131
|
C = null;
|
|
132
132
|
}
|
|
133
|
-
|
|
133
|
+
K();
|
|
134
|
+
};
|
|
135
|
+
function J(e, t) {
|
|
136
|
+
let n = a(t.lang) ?? t.lang;
|
|
137
|
+
return o(e, n, r, t.voice?.name ?? null, t.rate);
|
|
138
|
+
}
|
|
139
|
+
let Y = (e, t) => JSON.stringify(J(e, t)), X = () => {
|
|
140
|
+
I?.controller.abort(), I = null;
|
|
141
|
+
}, Z = (e, t, n) => {
|
|
142
|
+
let r = I;
|
|
143
|
+
return I = null, r ? r.key === Y(e, t) ? (n.aborted ? r.controller.abort() : n.addEventListener("abort", () => r.controller.abort(), { once: !0 }), r.request) : (r.controller.abort(), null) : null;
|
|
134
144
|
};
|
|
135
|
-
async function
|
|
136
|
-
let
|
|
137
|
-
for (let t = 1; e(
|
|
145
|
+
async function Q(t, n, r, i = !1) {
|
|
146
|
+
let a = J(t, n), o = v.getHeaders?.() ?? {}, l;
|
|
147
|
+
for (let t = 1; e(r), l = await y(v.endpoint, {
|
|
138
148
|
method: "POST",
|
|
139
|
-
signal:
|
|
149
|
+
signal: r,
|
|
140
150
|
headers: {
|
|
141
151
|
"content-type": "application/json",
|
|
142
|
-
...
|
|
152
|
+
...o
|
|
143
153
|
},
|
|
144
|
-
body: JSON.stringify(
|
|
145
|
-
}), !
|
|
146
|
-
if (!(g.has(
|
|
147
|
-
let e = /* @__PURE__ */ Error(`hosted tts ${
|
|
148
|
-
throw e.reason =
|
|
154
|
+
body: JSON.stringify(a)
|
|
155
|
+
}), !l.ok; t += 1) {
|
|
156
|
+
if (!(g.has(l.status) && t < _ && !r.aborted)) {
|
|
157
|
+
let e = /* @__PURE__ */ Error(`hosted tts ${l.status}`);
|
|
158
|
+
throw e.reason = i && l.status === 429 ? "rate-limited" : s(l.status), e.headers = h(o), e;
|
|
149
159
|
}
|
|
150
|
-
await
|
|
160
|
+
await ne(b(l.headers.get("retry-after"), t), r);
|
|
151
161
|
}
|
|
152
|
-
let
|
|
153
|
-
if (!
|
|
162
|
+
let u = l.headers.get("content-type"), d = u?.includes("json") ? await l.json() : await l.arrayBuffer(), f = c(u, d);
|
|
163
|
+
if (!f) {
|
|
154
164
|
let e = /* @__PURE__ */ Error("hosted tts returned no audio");
|
|
155
165
|
throw e.reason = "unknown", e;
|
|
156
166
|
}
|
|
157
|
-
return
|
|
167
|
+
return f;
|
|
158
168
|
}
|
|
159
|
-
function
|
|
169
|
+
function $(e, r, i) {
|
|
160
170
|
return new Promise((a, o) => {
|
|
161
|
-
if (r !==
|
|
171
|
+
if (r !== j) {
|
|
162
172
|
a();
|
|
163
173
|
return;
|
|
164
174
|
}
|
|
165
175
|
let s = new Blob([e.slice().buffer], { type: "audio/mpeg" });
|
|
166
|
-
|
|
176
|
+
K(), w = URL.createObjectURL(s);
|
|
167
177
|
let c;
|
|
168
|
-
t() ? (c = new Audio(w), n(c)) : (c =
|
|
169
|
-
r ===
|
|
178
|
+
t() ? (c = new Audio(w), n(c)) : (c = O ?? new Audio(), O = c, c.muted = !1, c.src = w), C = c, c.onended = () => {
|
|
179
|
+
r === j && a();
|
|
170
180
|
}, c.onerror = () => {
|
|
171
|
-
if (r !==
|
|
181
|
+
if (r !== j) {
|
|
172
182
|
a();
|
|
173
183
|
return;
|
|
174
184
|
}
|
|
175
185
|
let e = /* @__PURE__ */ Error("audio playback failed");
|
|
176
186
|
e.reason = "unknown", o(e);
|
|
177
187
|
}, c.play().then(() => {
|
|
178
|
-
c ===
|
|
188
|
+
c === O && !c.muted && (k = !0), r === j && i?.();
|
|
179
189
|
}, (e) => {
|
|
180
|
-
if (r !==
|
|
190
|
+
if (r !== j) {
|
|
181
191
|
a();
|
|
182
192
|
return;
|
|
183
193
|
}
|
|
@@ -186,100 +196,109 @@ function N(v) {
|
|
|
186
196
|
});
|
|
187
197
|
});
|
|
188
198
|
}
|
|
189
|
-
let
|
|
199
|
+
let ie = {
|
|
190
200
|
id: "hosted-tts",
|
|
191
201
|
isSupported() {
|
|
192
|
-
return !
|
|
202
|
+
return !B() && typeof window < "u" && typeof window.Audio == "function" && typeof fetch == "function";
|
|
193
203
|
},
|
|
194
204
|
listVoices() {
|
|
195
|
-
return
|
|
205
|
+
return B() ? [] : [...i];
|
|
196
206
|
},
|
|
197
207
|
subscribeVoices(e) {
|
|
198
|
-
return
|
|
199
|
-
|
|
208
|
+
return V.add(e), () => {
|
|
209
|
+
V.delete(e);
|
|
200
210
|
};
|
|
201
211
|
},
|
|
202
212
|
speak(e, t, n = {}) {
|
|
203
|
-
|
|
213
|
+
N?.cancel(), N = null;
|
|
204
214
|
let r = d(e);
|
|
205
215
|
if (r.length === 0) {
|
|
206
216
|
n.onEnd?.();
|
|
207
217
|
return;
|
|
208
218
|
}
|
|
209
|
-
|
|
210
|
-
let i =
|
|
211
|
-
|
|
219
|
+
j += 1;
|
|
220
|
+
let i = j;
|
|
221
|
+
q(), P?.cancel(), F?.stop(), A();
|
|
212
222
|
let a = new AbortController();
|
|
213
|
-
|
|
223
|
+
M = a;
|
|
214
224
|
let o = !1, s = () => {
|
|
215
225
|
o || (o = !0, n.onStart?.());
|
|
216
226
|
}, c = (e) => {
|
|
217
|
-
let n =
|
|
227
|
+
let n = Q(e, t, a.signal);
|
|
218
228
|
return n.catch(() => {}), n;
|
|
219
229
|
}, f = t.audioOutput ? E(S) : null, h = t.audioOutput ? p(t.audioOutput, {
|
|
220
|
-
play: (e) =>
|
|
221
|
-
isCurrent: () => i ===
|
|
230
|
+
play: (e) => $(e, i, s),
|
|
231
|
+
isCurrent: () => i === j,
|
|
222
232
|
onChunkStart: (e) => {
|
|
223
233
|
f?.progress(), n.onChunkStart?.(e);
|
|
224
234
|
},
|
|
225
235
|
onStart: s
|
|
226
236
|
}) : null;
|
|
227
|
-
|
|
237
|
+
P = h, F = f;
|
|
228
238
|
let g = (e) => f ? f.guard(e) : e, _ = () => {
|
|
229
|
-
h && (f?.stop(),
|
|
239
|
+
h && (f?.stop(), F === f && (F = null), P === h && (P = null));
|
|
230
240
|
};
|
|
231
241
|
(async () => {
|
|
232
242
|
try {
|
|
233
|
-
let e =
|
|
234
|
-
for (let
|
|
235
|
-
if (i !==
|
|
236
|
-
let
|
|
237
|
-
if (i !==
|
|
238
|
-
let
|
|
239
|
-
|
|
243
|
+
let e = r[0], o = Z(e, t, a.signal), l = o ? o.catch(() => c(e)) : c(e);
|
|
244
|
+
for (let e = 0; e < r.length; e += 1) {
|
|
245
|
+
if (i !== j) return;
|
|
246
|
+
let t = await l;
|
|
247
|
+
if (i !== j) return;
|
|
248
|
+
let a = r[e + 1];
|
|
249
|
+
a !== void 0 && (l = c(a)), h ? (f?.handed(t.byteLength), await g(h.write(t))) : (n.onChunkStart?.(e), await $(t, i, s));
|
|
240
250
|
}
|
|
241
251
|
if (h) {
|
|
242
252
|
let e = await g(h.drain());
|
|
243
|
-
if (i !==
|
|
253
|
+
if (i !== j) return;
|
|
244
254
|
if (!e) throw Object.assign(/* @__PURE__ */ Error("audio output did not finish"), { reason: "unknown" });
|
|
245
255
|
}
|
|
246
|
-
i ===
|
|
256
|
+
i === j && (_(), n.onEnd?.());
|
|
247
257
|
} catch (e) {
|
|
248
|
-
if (a.abort(), i !==
|
|
258
|
+
if (a.abort(), i !== j) return;
|
|
249
259
|
let t = null;
|
|
250
260
|
if (h) {
|
|
251
261
|
let n = e instanceof T ? null : await g(h.drain()).then(() => null, (e) => e);
|
|
252
|
-
if (i !==
|
|
262
|
+
if (i !== j) return;
|
|
253
263
|
h.cancel(), m(e) ? t = e : m(n) && (t = n);
|
|
254
264
|
}
|
|
255
|
-
if (
|
|
265
|
+
if (j += 1, q(), _(), t) {
|
|
256
266
|
n.onError?.("output-not-cleared");
|
|
257
267
|
return;
|
|
258
268
|
}
|
|
259
269
|
let r = e?.reason;
|
|
260
|
-
u(r, e?.transient === !0) &&
|
|
270
|
+
u(r, e?.transient === !0) && G(l(r), r === "not-allowed" ? e.headers ?? null : null), n.onError?.(r === "not-allowed" || r === "unsupported" || r === "cancelled" ? r : "unknown");
|
|
261
271
|
}
|
|
262
272
|
})();
|
|
263
273
|
},
|
|
264
274
|
open(e, t = {}) {
|
|
265
|
-
|
|
266
|
-
let n = ++
|
|
267
|
-
|
|
275
|
+
ie.cancel();
|
|
276
|
+
let n = ++j;
|
|
277
|
+
A();
|
|
268
278
|
let r = e.audioOutput ? E(S) : null, i, a = -1, o = -1, s = -1, c = null, d = e.audioOutput ? p(e.audioOutput, {
|
|
269
|
-
play: (e) =>
|
|
270
|
-
isCurrent: () => n ===
|
|
279
|
+
play: (e) => $(e, n, () => i?.()),
|
|
280
|
+
isCurrent: () => n === j,
|
|
271
281
|
onChunkStart: () => {},
|
|
272
282
|
onStart: () => i?.()
|
|
273
283
|
}) : null;
|
|
274
|
-
|
|
284
|
+
P = d, F = r;
|
|
275
285
|
let h = (e) => r ? r.guard(e) : e, g = async () => {
|
|
276
286
|
if (d && !await h(d.drain())) throw Error("audio output did not finish");
|
|
277
287
|
}, _ = () => {
|
|
278
|
-
r?.stop(),
|
|
279
|
-
}, v = f({
|
|
288
|
+
r?.stop(), F === r && (F = null), P === d && (P = null), N === y && (N = null);
|
|
289
|
+
}, v = !0, y = f({
|
|
280
290
|
prepare: async (t, n) => {
|
|
281
291
|
try {
|
|
282
|
-
|
|
292
|
+
if (v) {
|
|
293
|
+
v = !1;
|
|
294
|
+
let r = Z(t, e, n);
|
|
295
|
+
if (r) try {
|
|
296
|
+
return await r;
|
|
297
|
+
} catch (e) {
|
|
298
|
+
if (n.aborted) throw e;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
return await Q(t, e, n, !0);
|
|
283
302
|
} catch (e) {
|
|
284
303
|
if (n.aborted) throw e;
|
|
285
304
|
try {
|
|
@@ -297,20 +316,20 @@ function N(v) {
|
|
|
297
316
|
let r = new Promise((e) => {
|
|
298
317
|
c = e;
|
|
299
318
|
});
|
|
300
|
-
await Promise.race([
|
|
319
|
+
await Promise.race([$(e, n, l), r]), c = null;
|
|
301
320
|
}
|
|
302
321
|
},
|
|
303
322
|
drain: g,
|
|
304
323
|
retract: (e) => {
|
|
305
|
-
d && o >= e ? d.retract(a) : !d && s >= e && (
|
|
324
|
+
d && o >= e ? d.retract(a) : !d && s >= e && (q(), c?.());
|
|
306
325
|
},
|
|
307
326
|
cancel: () => {
|
|
308
|
-
|
|
327
|
+
j += 1, q(), c?.(), d?.cancel(), _();
|
|
309
328
|
},
|
|
310
329
|
failed: (e) => {
|
|
311
330
|
if (m(e)) return "output-not-cleared";
|
|
312
331
|
let t = e, n = t?.reason;
|
|
313
|
-
return u(n, t?.transient === !0) &&
|
|
332
|
+
return u(n, t?.transient === !0) && G(l(n), n === "not-allowed" ? t?.headers ?? null : null), n === "not-allowed" || n === "unsupported" || n === "cancelled" || n === "rate-limited" ? n : "unknown";
|
|
314
333
|
}
|
|
315
334
|
}, {
|
|
316
335
|
...t,
|
|
@@ -318,16 +337,31 @@ function N(v) {
|
|
|
318
337
|
_(), t.onEnd?.();
|
|
319
338
|
}
|
|
320
339
|
});
|
|
321
|
-
return
|
|
340
|
+
return N = y, y;
|
|
322
341
|
},
|
|
323
342
|
headersChanged() {
|
|
324
|
-
x() >=
|
|
343
|
+
x() >= L || z === null || B() || (L = 0, z = null, U(), H());
|
|
344
|
+
},
|
|
345
|
+
prefetch(e, t) {
|
|
346
|
+
if (B() || e.trim() === "") return;
|
|
347
|
+
let n = Y(e, t);
|
|
348
|
+
if (I?.key === n) return;
|
|
349
|
+
X();
|
|
350
|
+
let r = new AbortController(), i = Q(e, t, r.signal);
|
|
351
|
+
i.catch(() => {}), I = {
|
|
352
|
+
key: n,
|
|
353
|
+
controller: r,
|
|
354
|
+
request: i
|
|
355
|
+
};
|
|
356
|
+
},
|
|
357
|
+
cancelPrefetch() {
|
|
358
|
+
X();
|
|
325
359
|
},
|
|
326
360
|
cancel() {
|
|
327
|
-
let e =
|
|
328
|
-
|
|
361
|
+
let e = N;
|
|
362
|
+
N = null, e?.cancel(), j += 1, M?.abort(), M = null, q(), P?.cancel(), P = null, F?.stop(), F = null;
|
|
329
363
|
}
|
|
330
364
|
};
|
|
331
|
-
return
|
|
365
|
+
return ie;
|
|
332
366
|
}
|
|
333
|
-
export { C as HOSTED_OUTPUT_MIN_AUDIO_BYTES_PER_SECOND, S as HOSTED_OUTPUT_STALL_AUDIO_RATIO, x as HOSTED_OUTPUT_STALL_BASE_MS,
|
|
367
|
+
export { C as HOSTED_OUTPUT_MIN_AUDIO_BYTES_PER_SECOND, S as HOSTED_OUTPUT_STALL_AUDIO_RATIO, x as HOSTED_OUTPUT_STALL_BASE_MS, ee as SILENT_WAV_DATA_URI, A as createHostedTtsEngine, w as hostedOutputStallMs, O as primeHostedPlayback, k as resetHostedPlaybackForTest, b as retryDelayMs };
|
|
@@ -48,6 +48,12 @@ function i({ device: i, hosted: a }) {
|
|
|
48
48
|
t(), n();
|
|
49
49
|
};
|
|
50
50
|
},
|
|
51
|
+
prefetch(e, t) {
|
|
52
|
+
u(t) === a && a.prefetch?.(e, t);
|
|
53
|
+
},
|
|
54
|
+
cancelPrefetch() {
|
|
55
|
+
a.cancelPrefetch?.();
|
|
56
|
+
},
|
|
51
57
|
speak(e, t, s) {
|
|
52
58
|
if (o?.cancel(), o = null, i.cancel(), a.cancel(), u(t) !== a) {
|
|
53
59
|
l(e, t, s);
|
|
@@ -49,6 +49,12 @@ export type SpeechFeedEvent = {
|
|
|
49
49
|
} | {
|
|
50
50
|
type: 'retract';
|
|
51
51
|
messageId: string;
|
|
52
|
+
}
|
|
53
|
+
/** P1 (BOFF-12936): the answer so far, still being written; nothing is spoken. */
|
|
54
|
+
| {
|
|
55
|
+
type: 'prefetch';
|
|
56
|
+
messageId: string;
|
|
57
|
+
item: SpeechFeedItem;
|
|
52
58
|
} | {
|
|
53
59
|
type: 'audio';
|
|
54
60
|
messageId: string;
|
|
@@ -63,6 +69,14 @@ export declare const speechFeed: {
|
|
|
63
69
|
publish(messageId: string, item: SpeechFeedItem): void;
|
|
64
70
|
append(messageId: string, item: SpeechFeedItem, phrases: readonly string[]): void;
|
|
65
71
|
retract(messageId: string): void;
|
|
72
|
+
/**
|
|
73
|
+
* ★ P1 (BOFF-12936, decision D1): the answer as the person sees it so far,
|
|
74
|
+
* while it is still being written (voice turns of an opted-in app only). The
|
|
75
|
+
* subscriber may fetch the clip the finished answer will start with; nothing
|
|
76
|
+
* is spoken, so the "never speak what is not on screen" rule is untouched.
|
|
77
|
+
* Not remembered: `peek` stays about published answers.
|
|
78
|
+
*/
|
|
79
|
+
prefetch(messageId: string, item: SpeechFeedItem): void;
|
|
66
80
|
audio(messageId: string, state: "queued" | "started" | "paused" | "ended" | "retrying"): void;
|
|
67
81
|
/** Forget a published message and tell the subscriber to stop speaking it. */
|
|
68
82
|
abort(messageId: string, retrying?: boolean): void;
|
|
@@ -233,6 +233,16 @@ export interface SpeechEngine {
|
|
|
233
233
|
* and only then.
|
|
234
234
|
*/
|
|
235
235
|
wouldSpeakOnAvatar?(options: SpeechSpeakOptions): boolean;
|
|
236
|
+
/**
|
|
237
|
+
* ★ P1 (BOFF-12936, decision D1): fetch a reply's first piece before the
|
|
238
|
+
* reply is released, so it can start the moment it is. Plays nothing; the
|
|
239
|
+
* clip is used only by the next reply whose first piece is exactly this
|
|
240
|
+
* request. Optional: engines that synthesise nothing (the device voice)
|
|
241
|
+
* omit it, and callers read that as "nothing to prefetch".
|
|
242
|
+
*/
|
|
243
|
+
prefetch?(text: string, options: SpeechSpeakOptions): void;
|
|
244
|
+
/** Drop a prefetched piece that will not be used (the reply was stopped or replaced). */
|
|
245
|
+
cancelPrefetch?(): void;
|
|
236
246
|
}
|
|
237
247
|
/** One reply. Appends never pre-empt the piece currently playing. */
|
|
238
248
|
export interface SpeechQueue {
|