@burdenoff/fe-libs 2026.1115.10 → 2026.1115.11
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.d.ts +8 -1
- package/dist/shared/assistant/avatar/live/createLiveAvatarSeam.js +126 -123
- package/dist/shared/assistant/avatar/live/liveAvatarController.d.ts +7 -0
- package/dist/shared/assistant/avatar/live/liveAvatarController.js +3 -2
- package/dist/shared/assistant/ui/assistantLiveAvatarSeam.d.ts +26 -0
- package/dist/shared/assistant/ui/assistantLiveAvatarSeam.js +87 -79
- package/dist/shared/assistant/ui/composer/AssistantHandsFreeInterruptToggle.d.ts +4 -0
- package/dist/shared/assistant/ui/composer/AssistantHandsFreeInterruptToggle.js +22 -22
- package/dist/shared/assistant/ui/useVoiceSession.js +223 -223
- package/dist/shared/assistant/voice/handsfree/handsFreeController.js +79 -79
- package/dist/shared/assistant/voice/handsfree/handsFreeSetting.d.ts +6 -1
- package/dist/shared/assistant/voice/handsfree/handsFreeSetting.js +2 -2
- package/dist/shared/assistant/voice/handsfree/playbackReference.d.ts +45 -3
- package/dist/shared/assistant/voice/handsfree/playbackReference.js +62 -15
- package/dist/shared-assistant.js +370 -370
- package/package.json +1 -1
|
@@ -46,6 +46,13 @@ export interface LiveAvatarSeamOptions {
|
|
|
46
46
|
* plan checkout, `controller.checkMinutesPurchase()` (the tab then says "Checking your plan…" while it checks).
|
|
47
47
|
*/
|
|
48
48
|
readonly minutesPurchase?: LiveAvatarMinutesPurchase;
|
|
49
|
+
/**
|
|
50
|
+
* ★ P5 (BOFF-12936): let hands-free interrupt stay ON while the avatar is ON, so a person can talk over the avatar to
|
|
51
|
+
* interrupt it, and the avatar's own voice is refused as an echo (it becomes the echo gate's reference). DEFAULT OFF: then
|
|
52
|
+
* the BOFF-8822 pilot rule holds as before (hands-free OFF while the avatar is ON). Turn it on per environment, alpha
|
|
53
|
+
* first; it takes effect only where the browser can route the avatar's received voice (`isAvatarVoiceReferenceSupported`).
|
|
54
|
+
*/
|
|
55
|
+
readonly handsFreeWithAvatar?: boolean;
|
|
49
56
|
readonly onLog?: (event: LiveAvatarLogEvent) => void;
|
|
50
57
|
/** Overrides, for tests and for hosts with their own plumbing. Each defaults to the assistant's own. */
|
|
51
58
|
readonly client?: () => AvatarSessionClient | null;
|
|
@@ -58,7 +65,7 @@ export interface LiveAvatarSeamOptions {
|
|
|
58
65
|
readonly avatarVoiceStore?: LiveAvatarVoiceStore;
|
|
59
66
|
readonly scheduler?: AvatarScheduler;
|
|
60
67
|
readonly browserSupported?: () => boolean;
|
|
61
|
-
readonly controller?: Partial<Pick<LiveAvatarControllerDeps, 'createAudioElement' | 'releaseAudioElement' | 'startMeter' | 'decode' | 'now' | 'newIdempotencyKey' | 'subscribeWorkspaceChange' | 'subscribePageHide' | 'subscribePageHidden' | 'endOnHide' | 'subscribeUserGesture' | 'isPageVisible' | 'subscribePageVisible' | 'subscribePageShow' | 'idleMs' | 'endBeforeDeadlineMs' | 'connectTimeoutMs' | 'trackerConfig' | 'maxDrainMs' | 'stallMs' | 'readinessProbe'>>;
|
|
68
|
+
readonly controller?: Partial<Pick<LiveAvatarControllerDeps, 'createAudioElement' | 'releaseAudioElement' | 'startMeter' | 'decode' | 'now' | 'newIdempotencyKey' | 'subscribeWorkspaceChange' | 'subscribePageHide' | 'subscribePageHidden' | 'endOnHide' | 'subscribeUserGesture' | 'isPageVisible' | 'subscribePageVisible' | 'subscribePageShow' | 'idleMs' | 'endBeforeDeadlineMs' | 'connectTimeoutMs' | 'trackerConfig' | 'maxDrainMs' | 'stallMs' | 'readinessProbe' | 'registerVoiceReference'>>;
|
|
62
69
|
}
|
|
63
70
|
/** The seam, plus what a host or a test may need of it. */
|
|
64
71
|
export interface LiveAvatarSeamHandle extends AssistantLiveAvatarSeam {
|
|
@@ -1,46 +1,47 @@
|
|
|
1
1
|
import { ensureWorkspaceToken as e, getStoredAuthToken as t, getStoredWorkspaceId as n, resolveGatewayUrl as r } from "../../../graphql/fetch.js";
|
|
2
2
|
import { readSpeechEngineConfig as i } from "../../speech/createSpeechEngine.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
3
|
+
import { registerAvatarVoice as a } from "../../voice/handsfree/playbackReference.js";
|
|
4
|
+
import { isOutputRefusal as o } from "../../speech/pieceSink.js";
|
|
5
|
+
import { useAvatarPreferencesStore as s } from "../avatarPreferences.js";
|
|
6
|
+
import { decodeMp3ToPcm16k as c } from "./avatarAudioDecode.js";
|
|
7
|
+
import { startAvatarAudioMeter as l } from "./avatarAudioMeter.js";
|
|
8
|
+
import { sanitizeAvatarImages as u } from "./avatarFaces.js";
|
|
9
|
+
import { AVATAR_SAMPLE_RATE as d } from "./avatarPcm16.js";
|
|
10
|
+
import { realAvatarScheduler as f } from "./avatarPorts.js";
|
|
11
|
+
import { avatarApiBaseFromTtsEndpoint as p, avatarIdempotencyKey as m, createAvatarSessionClient as h } from "./avatarSessionClient.js";
|
|
12
|
+
import { LiveAvatarStageView as g } from "./LiveAvatarStage.js";
|
|
13
|
+
import { LiveAvatarCompactView as _ } from "./LiveAvatarCompactView.js";
|
|
14
|
+
import { LiveAvatarSettings as ee } from "./LiveAvatarSettings.js";
|
|
15
|
+
import { LiveAvatarTabView as v } from "./LiveAvatarTabView.js";
|
|
16
|
+
import { createLiveAvatarController as y } from "./liveAvatarController.js";
|
|
17
|
+
import { openLiveKitAvatarRoom as b } from "./liveKitAvatarRoom.js";
|
|
18
|
+
import { liveAvatarAskState as x } from "./liveAvatarStatus.js";
|
|
19
|
+
import { avatarSpeakerFor as S, hostedAvatarVoice as C, liveAvatarVoicesFrom as w, restoreVoiceWhenOutputLeaves as T } from "./avatarVoice.js";
|
|
20
|
+
import { jsx as E } from "react/jsx-runtime";
|
|
20
21
|
// src/shared/assistant/avatar/live/createLiveAvatarSeam.tsx
|
|
21
|
-
var
|
|
22
|
-
function
|
|
23
|
-
let t =
|
|
22
|
+
var D = /* @__PURE__ */ new WeakMap();
|
|
23
|
+
function O(e = globalThis) {
|
|
24
|
+
let t = D.get(e);
|
|
24
25
|
if (t !== void 0) return t;
|
|
25
|
-
let n =
|
|
26
|
-
return
|
|
26
|
+
let n = k(e);
|
|
27
|
+
return D.set(e, n), n;
|
|
27
28
|
}
|
|
28
|
-
function
|
|
29
|
+
function k(e) {
|
|
29
30
|
if (typeof e.RTCPeerConnection != "function" || typeof e.AudioContext != "function" || typeof e.MediaStream != "function" || typeof e.OfflineAudioContext != "function") return !1;
|
|
30
31
|
try {
|
|
31
|
-
return new e.OfflineAudioContext(1, 1,
|
|
32
|
+
return new e.OfflineAudioContext(1, 1, d), !0;
|
|
32
33
|
} catch {
|
|
33
34
|
return !1;
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
|
-
function
|
|
37
|
+
function A() {
|
|
37
38
|
let e = i().getHeaders?.() ?? {};
|
|
38
39
|
for (let [t, n] of Object.entries(e)) if (t.toLowerCase() === "authorization" && typeof n == "string" && n.trim() !== "") return n.trim();
|
|
39
40
|
let n = t();
|
|
40
41
|
return n ? `Bearer ${n}` : null;
|
|
41
42
|
}
|
|
42
|
-
async function
|
|
43
|
-
let i = n(), a =
|
|
43
|
+
async function j(t) {
|
|
44
|
+
let i = n(), a = A(), o = a?.replace(/^Bearer\s+/i, "") ?? null;
|
|
44
45
|
if (!i || !o) return null;
|
|
45
46
|
let s = t.refused?.replace(/^Bearer\s+/i, ""), c = await e({
|
|
46
47
|
url: r("workspace"),
|
|
@@ -49,40 +50,40 @@ async function A(t) {
|
|
|
49
50
|
currentQuery: "liveAvatarSession",
|
|
50
51
|
...t.fresh ? { issuanceGuard: {
|
|
51
52
|
identityKey: "liveAvatarSession",
|
|
52
|
-
isCurrent: () => n() === i &&
|
|
53
|
+
isCurrent: () => n() === i && A() === a,
|
|
53
54
|
accepts: (e, t) => e !== s && t === i
|
|
54
55
|
} } : {}
|
|
55
56
|
});
|
|
56
57
|
return c ? `Bearer ${c}` : null;
|
|
57
58
|
}
|
|
58
|
-
function
|
|
59
|
+
function M() {
|
|
59
60
|
let e = null;
|
|
60
61
|
return () => {
|
|
61
|
-
let t = typeof location > "u" ? void 0 : location.href, n =
|
|
62
|
+
let t = typeof location > "u" ? void 0 : location.href, n = p(i().endpoint, t);
|
|
62
63
|
return n === null ? null : (e?.base !== n && (e = {
|
|
63
64
|
base: n,
|
|
64
|
-
client:
|
|
65
|
+
client: h({
|
|
65
66
|
baseUrl: n,
|
|
66
|
-
getAuthorization:
|
|
67
|
-
getWorkspaceAuthorization:
|
|
67
|
+
getAuthorization: A,
|
|
68
|
+
getWorkspaceAuthorization: j
|
|
68
69
|
})
|
|
69
70
|
}), e.client);
|
|
70
71
|
};
|
|
71
72
|
}
|
|
72
|
-
var
|
|
73
|
-
getState: () =>
|
|
74
|
-
setAvatarEnabled: (e) =>
|
|
75
|
-
setAvatarId: (e) =>
|
|
76
|
-
subscribe: (e) =>
|
|
77
|
-
},
|
|
78
|
-
getState: () =>
|
|
79
|
-
subscribe: (e) =>
|
|
80
|
-
setVoiceMode: (e) =>
|
|
81
|
-
setAvatarSpeaker: (e) =>
|
|
73
|
+
var N = {
|
|
74
|
+
getState: () => s.getState(),
|
|
75
|
+
setAvatarEnabled: (e) => s.getState().setAvatarEnabled(e),
|
|
76
|
+
setAvatarId: (e) => s.getState().setAvatarId(e),
|
|
77
|
+
subscribe: (e) => s.subscribe(() => e())
|
|
78
|
+
}, P = {
|
|
79
|
+
getState: () => s.getState(),
|
|
80
|
+
subscribe: (e) => s.subscribe(() => e()),
|
|
81
|
+
setVoiceMode: (e) => s.getState().setVoiceMode(e),
|
|
82
|
+
setAvatarSpeaker: (e) => s.getState().setAvatarSpeaker(e)
|
|
82
83
|
};
|
|
83
|
-
function
|
|
84
|
+
function F(e, t) {
|
|
84
85
|
let n = (e) => {
|
|
85
|
-
|
|
86
|
+
o(e) || t();
|
|
86
87
|
};
|
|
87
88
|
return {
|
|
88
89
|
write: (t, r, i) => {
|
|
@@ -97,20 +98,20 @@ function P(e, t) {
|
|
|
97
98
|
cancel: () => e.cancel()
|
|
98
99
|
};
|
|
99
100
|
}
|
|
100
|
-
function
|
|
101
|
+
function I(e) {
|
|
101
102
|
if (e === void 0) return;
|
|
102
103
|
let { access: t } = e;
|
|
103
104
|
return { access: () => t.call(e) };
|
|
104
105
|
}
|
|
105
|
-
function
|
|
106
|
+
function L() {
|
|
106
107
|
if (typeof document > "u") return null;
|
|
107
108
|
let e = document.createElement("audio");
|
|
108
109
|
return e.autoplay = !0, e.hidden = !0, e.setAttribute("data-testid", "assistant-live-avatar-audio"), document.body.appendChild(e), e;
|
|
109
110
|
}
|
|
110
|
-
function
|
|
111
|
+
function R(e) {
|
|
111
112
|
if (typeof window < "u") return (t) => (window.addEventListener(e, t), () => window.removeEventListener(e, t));
|
|
112
113
|
}
|
|
113
|
-
function
|
|
114
|
+
function z() {
|
|
114
115
|
if (typeof document > "u" || typeof document.addEventListener != "function") return;
|
|
115
116
|
let e = () => document.visibilityState !== "hidden";
|
|
116
117
|
return {
|
|
@@ -135,10 +136,10 @@ function R() {
|
|
|
135
136
|
}
|
|
136
137
|
};
|
|
137
138
|
}
|
|
138
|
-
function
|
|
139
|
+
function B(e = globalThis) {
|
|
139
140
|
return typeof e.matchMedia == "function" && e.matchMedia("(hover: none) and (pointer: coarse)").matches;
|
|
140
141
|
}
|
|
141
|
-
function
|
|
142
|
+
function V(e = typeof document > "u" ? null : document) {
|
|
142
143
|
if (e !== null && typeof e.addEventListener == "function") return (t) => {
|
|
143
144
|
let n = (e) => {
|
|
144
145
|
e.isTrusted && t();
|
|
@@ -151,7 +152,7 @@ function B(e = typeof document > "u" ? null : document) {
|
|
|
151
152
|
};
|
|
152
153
|
};
|
|
153
154
|
}
|
|
154
|
-
function
|
|
155
|
+
function H() {
|
|
155
156
|
if (typeof window < "u" && typeof document < "u") return (e) => {
|
|
156
157
|
let t = window, n = document, r = () => {
|
|
157
158
|
n.visibilityState === "visible" && e();
|
|
@@ -161,32 +162,32 @@ function V() {
|
|
|
161
162
|
};
|
|
162
163
|
};
|
|
163
164
|
}
|
|
164
|
-
function
|
|
165
|
+
function U(e) {
|
|
165
166
|
return e === "starting" || e === "connecting" || e === "ready";
|
|
166
167
|
}
|
|
167
|
-
function
|
|
168
|
-
let t = e.preferences ??
|
|
169
|
-
client: e.client ??
|
|
170
|
-
openRoom: e.openRoom ??
|
|
171
|
-
scheduler: e.scheduler ??
|
|
168
|
+
function W(e = {}) {
|
|
169
|
+
let t = e.preferences ?? N, n = e.controller ?? {}, r = n.subscribeWorkspaceChange ?? R("burdenoff:workspace-changed"), i = n.subscribePageHide ?? R("pagehide"), o = z(), s = n.isPageVisible ?? o?.isVisible, d = n.subscribePageVisible ?? o?.onShown, p = n.subscribePageHidden ?? o?.onHidden, h = n.endOnHide ?? B, D = n.subscribeUserGesture ?? V(), k = n.subscribePageShow ?? H(), A = n.now ?? (() => Date.now()), j = y({
|
|
170
|
+
client: e.client ?? M(),
|
|
171
|
+
openRoom: e.openRoom ?? b,
|
|
172
|
+
scheduler: e.scheduler ?? f,
|
|
172
173
|
preferences: t,
|
|
173
|
-
decode: n.decode ?? ((e, t) =>
|
|
174
|
-
createAudioElement: n.createAudioElement ??
|
|
174
|
+
decode: n.decode ?? ((e, t) => c(e, { signal: t })),
|
|
175
|
+
createAudioElement: n.createAudioElement ?? L,
|
|
175
176
|
releaseAudioElement: n.releaseAudioElement ?? ((e) => {
|
|
176
177
|
e.srcObject = null, e.remove();
|
|
177
178
|
}),
|
|
178
|
-
startMeter: n.startMeter ?? ((e, t) => typeof MediaStream > "u" ? null :
|
|
179
|
-
browserSupported: e.browserSupported ?? (() =>
|
|
180
|
-
now:
|
|
181
|
-
newIdempotencyKey: n.newIdempotencyKey ?? (() =>
|
|
179
|
+
startMeter: n.startMeter ?? ((e, t) => typeof MediaStream > "u" ? null : l(new MediaStream([e]), t)),
|
|
180
|
+
browserSupported: e.browserSupported ?? (() => O()),
|
|
181
|
+
now: A,
|
|
182
|
+
newIdempotencyKey: n.newIdempotencyKey ?? (() => m()),
|
|
182
183
|
...r ? { subscribeWorkspaceChange: r } : {},
|
|
183
184
|
...i ? { subscribePageHide: i } : {},
|
|
184
|
-
...
|
|
185
|
-
...
|
|
186
|
-
...
|
|
187
|
-
endOnHide:
|
|
188
|
-
...
|
|
189
|
-
...
|
|
185
|
+
...s ? { isPageVisible: s } : {},
|
|
186
|
+
...d ? { subscribePageVisible: d } : {},
|
|
187
|
+
...p ? { subscribePageHidden: p } : {},
|
|
188
|
+
endOnHide: h,
|
|
189
|
+
...D ? { subscribeUserGesture: D } : {},
|
|
190
|
+
...k ? { subscribePageShow: k } : {},
|
|
190
191
|
...n.idleMs === void 0 ? {} : { idleMs: n.idleMs },
|
|
191
192
|
...n.endBeforeDeadlineMs === void 0 ? {} : { endBeforeDeadlineMs: n.endBeforeDeadlineMs },
|
|
192
193
|
...n.connectTimeoutMs === void 0 ? {} : { connectTimeoutMs: n.connectTimeoutMs },
|
|
@@ -194,33 +195,34 @@ function U(e = {}) {
|
|
|
194
195
|
...n.maxDrainMs === void 0 ? {} : { maxDrainMs: n.maxDrainMs },
|
|
195
196
|
...n.stallMs === void 0 ? {} : { stallMs: n.stallMs },
|
|
196
197
|
...n.readinessProbe === void 0 ? {} : { readinessProbe: n.readinessProbe },
|
|
198
|
+
...n.registerVoiceReference === void 0 ? e.handsFreeWithAvatar === !0 ? { registerVoiceReference: a } : {} : { registerVoiceReference: n.registerVoiceReference },
|
|
197
199
|
...e.onLog ? { onLog: e.onLog } : {}
|
|
198
|
-
}),
|
|
199
|
-
let i =
|
|
200
|
-
avatarVoices:
|
|
200
|
+
}), W = w(e.avatarVoices), G = e.avatarImages === void 0 ? null : u(e.avatarImages), K = e.avatarVoiceStore ?? P, q = () => K.getState(), J = I(e.minutesPurchase), Y = (n, r) => {
|
|
201
|
+
let i = S(q(), {
|
|
202
|
+
avatarVoices: W,
|
|
201
203
|
avatarId: t.getState().avatarId,
|
|
202
204
|
...e.defaultAvatarVoiceMode ? { hostDefault: e.defaultAvatarVoiceMode } : {}
|
|
203
205
|
});
|
|
204
|
-
return i === null ? null :
|
|
205
|
-
},
|
|
206
|
+
return i === null ? null : C(i, n, r.listVoices());
|
|
207
|
+
}, X = (e, t) => {
|
|
206
208
|
let n = {
|
|
207
209
|
...e,
|
|
208
210
|
voice: t
|
|
209
211
|
};
|
|
210
|
-
return n.audioOutput =
|
|
212
|
+
return n.audioOutput = T(j.createOutput(), () => {
|
|
211
213
|
n.voice = e.voice;
|
|
212
|
-
}, (e) =>
|
|
213
|
-
|
|
214
|
+
}, (e) => j.subscribe(() => {
|
|
215
|
+
j.getSnapshot().phase !== "ready" && e();
|
|
214
216
|
})), n;
|
|
215
|
-
},
|
|
217
|
+
}, Z = (e) => {
|
|
216
218
|
let t = (t) => {
|
|
217
|
-
let n =
|
|
219
|
+
let n = Y(t.lang, e), r = n === null ? t : {
|
|
218
220
|
...t,
|
|
219
221
|
voice: n
|
|
220
222
|
};
|
|
221
223
|
return {
|
|
222
224
|
voice: n,
|
|
223
|
-
target:
|
|
225
|
+
target: j.route(r, e)
|
|
224
226
|
};
|
|
225
227
|
}, n = null, r = () => {
|
|
226
228
|
let e = n;
|
|
@@ -231,9 +233,9 @@ function U(e = {}) {
|
|
|
231
233
|
}, l = () => !o && (o = !0, c(), !0), u = () => {
|
|
232
234
|
a && l() && (e.cancel(), i?.onError?.("output-left"));
|
|
233
235
|
};
|
|
234
|
-
s =
|
|
235
|
-
|
|
236
|
-
}), n = c, r.audioOutput &&=
|
|
236
|
+
s = j.subscribe(() => {
|
|
237
|
+
j.getSnapshot().phase !== "ready" && u();
|
|
238
|
+
}), n = c, r.audioOutput &&= F(r.audioOutput, u), r.fallback = !1, e.speak(t, r, {
|
|
237
239
|
...i,
|
|
238
240
|
onEnd: () => {
|
|
239
241
|
l() && i?.onEnd?.();
|
|
@@ -262,85 +264,86 @@ function U(e = {}) {
|
|
|
262
264
|
}
|
|
263
265
|
let l = s === null ? {
|
|
264
266
|
...a,
|
|
265
|
-
audioOutput:
|
|
266
|
-
} :
|
|
267
|
+
audioOutput: j.createOutput()
|
|
268
|
+
} : X(a, s);
|
|
267
269
|
a.avatarOnly === !0 ? i(n, l, o) : e.speak(n, l, o);
|
|
268
270
|
},
|
|
269
271
|
cancel: () => {
|
|
270
272
|
r(), e.cancel();
|
|
271
273
|
}
|
|
272
274
|
};
|
|
273
|
-
},
|
|
274
|
-
controller:
|
|
275
|
+
}, Q = ({ expanded: t, fallback: n }) => /* @__PURE__ */ E(g, {
|
|
276
|
+
controller: j,
|
|
275
277
|
expanded: t,
|
|
276
278
|
fallback: n,
|
|
277
279
|
...e.avatarNames ? { avatarNames: e.avatarNames } : {}
|
|
278
|
-
}),
|
|
280
|
+
}), te = {
|
|
279
281
|
subscribe: (e) => t.subscribe(e),
|
|
280
282
|
getSnapshot: () => t.getState().avatarEnabled,
|
|
281
|
-
switchOff: () =>
|
|
282
|
-
voiceLive: (e) =>
|
|
283
|
+
switchOff: () => j.switchOff(),
|
|
284
|
+
voiceLive: (e) => j.setVoiceLive(e)
|
|
283
285
|
}, $ = {
|
|
284
286
|
subscribe: (e) => t.subscribe(e),
|
|
285
287
|
getSnapshot: () => t.getState().avatarId
|
|
286
288
|
};
|
|
287
289
|
return {
|
|
288
|
-
decorateSpeechEngine:
|
|
289
|
-
Stage:
|
|
290
|
-
enabled:
|
|
290
|
+
decorateSpeechEngine: Z,
|
|
291
|
+
Stage: Q,
|
|
292
|
+
enabled: te,
|
|
291
293
|
tab: {
|
|
292
294
|
offered: {
|
|
293
|
-
subscribe: (e) =>
|
|
294
|
-
getSnapshot: () =>
|
|
295
|
+
subscribe: (e) => j.subscribe(e),
|
|
296
|
+
getSnapshot: () => j.getSnapshot().tabOffered
|
|
295
297
|
},
|
|
296
298
|
ask: {
|
|
297
|
-
subscribe: (e) =>
|
|
298
|
-
getSnapshot: () =>
|
|
299
|
+
subscribe: (e) => j.subscribe(e),
|
|
300
|
+
getSnapshot: () => x(j.getSnapshot(), A())
|
|
299
301
|
},
|
|
300
302
|
running: {
|
|
301
|
-
subscribe: (e) =>
|
|
302
|
-
getSnapshot: () =>
|
|
303
|
+
subscribe: (e) => j.subscribe(e),
|
|
304
|
+
getSnapshot: () => U(j.getSnapshot().phase)
|
|
303
305
|
},
|
|
304
306
|
endsOnLeave: {
|
|
305
|
-
subscribe: (e) =>
|
|
307
|
+
subscribe: (e) => j.subscribe(e),
|
|
306
308
|
getSnapshot: () => {
|
|
307
|
-
let e =
|
|
308
|
-
return
|
|
309
|
+
let e = j.getSnapshot();
|
|
310
|
+
return U(e.phase) && !e.heldByVoice;
|
|
309
311
|
}
|
|
310
312
|
},
|
|
311
|
-
setOpen: (e, t) =>
|
|
312
|
-
heldByVoice: () =>
|
|
313
|
-
CompactView: (t) => /* @__PURE__ */
|
|
313
|
+
setOpen: (e, t) => j.setTabOpen(e, t),
|
|
314
|
+
heldByVoice: () => j.getSnapshot().heldByVoice,
|
|
315
|
+
CompactView: (t) => /* @__PURE__ */ E(_, {
|
|
314
316
|
...t,
|
|
315
|
-
controller:
|
|
317
|
+
controller: j,
|
|
316
318
|
savedAvatar: $,
|
|
317
319
|
...e.avatarNames ? { avatarNames: e.avatarNames } : {},
|
|
318
|
-
...
|
|
320
|
+
...G ? { avatarImages: G } : {}
|
|
319
321
|
}),
|
|
320
|
-
View: (t) => /* @__PURE__ */
|
|
322
|
+
View: (t) => /* @__PURE__ */ E(v, {
|
|
321
323
|
...t,
|
|
322
|
-
controller:
|
|
323
|
-
avatarVoices:
|
|
324
|
-
voiceStore:
|
|
324
|
+
controller: j,
|
|
325
|
+
avatarVoices: W,
|
|
326
|
+
voiceStore: K,
|
|
325
327
|
...e.avatarNames ? { avatarNames: e.avatarNames } : {},
|
|
326
|
-
...
|
|
328
|
+
...G ? { avatarImages: G } : {},
|
|
327
329
|
...e.defaultAvatarVoiceMode ? { defaultAvatarVoiceMode: e.defaultAvatarVoiceMode } : {},
|
|
328
|
-
...
|
|
330
|
+
...J ? { minutesPurchase: J } : {}
|
|
329
331
|
}),
|
|
330
|
-
SettingsView: (t) => /* @__PURE__ */
|
|
332
|
+
SettingsView: (t) => /* @__PURE__ */ E(ee, {
|
|
331
333
|
...t,
|
|
332
|
-
controller:
|
|
334
|
+
controller: j,
|
|
333
335
|
savedAvatar: $,
|
|
334
|
-
avatarVoices:
|
|
335
|
-
voiceStore:
|
|
336
|
+
avatarVoices: W,
|
|
337
|
+
voiceStore: K,
|
|
336
338
|
...e.avatarNames ? { avatarNames: e.avatarNames } : {},
|
|
337
|
-
...
|
|
339
|
+
...G ? { avatarImages: G } : {},
|
|
338
340
|
...e.defaultAvatarVoiceMode ? { defaultAvatarVoiceMode: e.defaultAvatarVoiceMode } : {},
|
|
339
|
-
...
|
|
341
|
+
...J ? { minutesPurchase: J } : {}
|
|
340
342
|
})
|
|
341
343
|
},
|
|
342
|
-
controller:
|
|
343
|
-
|
|
344
|
+
controller: j,
|
|
345
|
+
...e.handsFreeWithAvatar === !0 ? { handsFreeWithAvatar: !0 } : {},
|
|
346
|
+
dispose: () => j.dispose()
|
|
344
347
|
};
|
|
345
348
|
}
|
|
346
|
-
export {
|
|
349
|
+
export { W as createLiveAvatarSeam, V as documentUserGesture, O as isLiveAvatarBrowserSupported, B as isTouchFirstDevice, A as liveAvatarAuthorization, j as liveAvatarWorkspaceAuthorization };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SpeechEngine, SpeechSpeakOptions } from '../../speech/types';
|
|
2
|
+
import { AvatarVoiceRegistration } from '../../voice/handsfree/playbackReference';
|
|
2
3
|
import { AvatarProblem } from '../useAvatarCopy';
|
|
3
4
|
import { AvatarMeterHandle } from './avatarAudioMeter';
|
|
4
5
|
import { AvatarRoom, AvatarScheduler } from './avatarPorts';
|
|
@@ -161,6 +162,12 @@ export interface LiveAvatarControllerDeps {
|
|
|
161
162
|
readonly releaseAudioElement: (element: HTMLAudioElement) => void;
|
|
162
163
|
/** A level meter on the avatar's received audio; null when none can be built (the output then cannot prove silence). */
|
|
163
164
|
readonly startMeter: (track: MediaStreamTrack, onChange: (audible: boolean) => void) => AvatarMeterHandle | null;
|
|
165
|
+
/**
|
|
166
|
+
* P5 (BOFF-12936): register each connected avatar's voice as hands-free's echo reference (the process-wide playback
|
|
167
|
+
* reference's `registerAvatarVoice`). Given only where the host opted in (`handsFreeWithAvatar`); absent, nothing is
|
|
168
|
+
* registered and everything is exactly as before.
|
|
169
|
+
*/
|
|
170
|
+
readonly registerVoiceReference?: () => AvatarVoiceRegistration;
|
|
164
171
|
/** The browser can show the avatar at all: what it needs is there (any browser or phone since BOFF-9696). */
|
|
165
172
|
readonly browserSupported: () => boolean;
|
|
166
173
|
/**
|
|
@@ -194,7 +194,7 @@ function m(s) {
|
|
|
194
194
|
De.leave();
|
|
195
195
|
let e = b;
|
|
196
196
|
if (b = null, e !== null) {
|
|
197
|
-
if (e.unsubscribe?.(), e.meter !== null) {
|
|
197
|
+
if (e.unsubscribe?.(), e.voiceReference?.release(), e.meter !== null) {
|
|
198
198
|
if (e.meterAudible) {
|
|
199
199
|
e.meterAudible = !1;
|
|
200
200
|
for (let t of [...e.meterListeners]) t(!1);
|
|
@@ -507,6 +507,7 @@ function m(s) {
|
|
|
507
507
|
meterListeners: f,
|
|
508
508
|
videoTrack: null,
|
|
509
509
|
unsubscribe: null,
|
|
510
|
+
voiceReference: s.registerVoiceReference?.() ?? null,
|
|
510
511
|
port: ee({
|
|
511
512
|
transport: d,
|
|
512
513
|
isEnabled: () => g && !_,
|
|
@@ -523,7 +524,7 @@ function m(s) {
|
|
|
523
524
|
token: u.participantToken,
|
|
524
525
|
audioElement: p.audioElement,
|
|
525
526
|
onAvatarAudio: (e) => {
|
|
526
|
-
if (e.mediaStreamTrack !== null && p.meter === null) try {
|
|
527
|
+
if (p.voiceReference?.setTrack(e.mediaStreamTrack), e.mediaStreamTrack !== null && p.meter === null) try {
|
|
527
528
|
p.meter = s.startMeter(e.mediaStreamTrack, (e) => {
|
|
528
529
|
p.meterAudible = e;
|
|
529
530
|
for (let t of [...f]) t(e);
|
|
@@ -31,6 +31,18 @@ export interface AssistantLiveAvatarSeam {
|
|
|
31
31
|
* it opens, and starts a paid session only on the person's Turn on.
|
|
32
32
|
*/
|
|
33
33
|
tab?: LiveAvatarTabSeam;
|
|
34
|
+
/**
|
|
35
|
+
* ★ P5 (BOFF-12936): let hands-free interrupt stay ON while the avatar is ON. Optional; DEFAULT OFF,
|
|
36
|
+
* and then the pilot rule holds exactly as before (`useLiveAvatarHandsFreeGuard`).
|
|
37
|
+
*
|
|
38
|
+
* When true, and only where this browser can route the avatar's received voice into the echo
|
|
39
|
+
* gate's reference (`isAvatarVoiceReferenceSupported`), the avatar's voice is metered like the
|
|
40
|
+
* hosted voice: the person can talk over the avatar to interrupt it, and the avatar's own voice is
|
|
41
|
+
* refused as an echo. Should the route fail at run time, the gate refuses every onset while the
|
|
42
|
+
* avatar is on (fail closed) and tap-to-interrupt stays. Hosts turn it on per environment, alpha
|
|
43
|
+
* first.
|
|
44
|
+
*/
|
|
45
|
+
handsFreeWithAvatar?: boolean;
|
|
34
46
|
}
|
|
35
47
|
/** Whether the Avatar tab may be offered, as a store read with `useSyncExternalStore`. STABLE. */
|
|
36
48
|
export interface LiveAvatarTabOfferedStore {
|
|
@@ -336,6 +348,16 @@ export declare function useLiveAvatarSpeechEngine(seam: AssistantLiveAvatarSeam
|
|
|
336
348
|
* voice, not its picture.
|
|
337
349
|
*/
|
|
338
350
|
export declare function useLiveAvatarOn(): boolean;
|
|
351
|
+
/**
|
|
352
|
+
* @internal Exported for the assistant's own hands-free wiring (`useVoiceSession`,
|
|
353
|
+
* `AssistantHandsFreeInterruptToggle`); not part of the module's public surface.
|
|
354
|
+
*
|
|
355
|
+
* P5 (BOFF-12936): whether the avatar's voice can serve as the echo gate's reference here, so
|
|
356
|
+
* hands-free may stay ON while the avatar is ON. True only when the host opted in
|
|
357
|
+
* (`handsFreeWithAvatar`) and this browser can route a received track into the reference bus.
|
|
358
|
+
* False without a seam, so every app that passes no `liveAvatar` reads exactly what it did.
|
|
359
|
+
*/
|
|
360
|
+
export declare function useLiveAvatarEchoReference(): boolean;
|
|
339
361
|
/**
|
|
340
362
|
* @internal Exported for `AssistantVoiceSession` alone; not part of the module's public surface.
|
|
341
363
|
*
|
|
@@ -360,6 +382,10 @@ export declare function useLiveAvatarOn(): boolean;
|
|
|
360
382
|
* the avatar stays ON, and goes with the last of them (a microtask late, so React's development
|
|
361
383
|
* double mount keeps it, as component state was kept before).
|
|
362
384
|
*
|
|
385
|
+
* ★ P5 (BOFF-12936): where the avatar's voice is the echo gate's reference
|
|
386
|
+
* (`useLiveAvatarEchoReference`), the rule is lifted: nothing is switched off and no notice is
|
|
387
|
+
* shown, and the person's own hands-free setting decides as it does without an avatar.
|
|
388
|
+
*
|
|
363
389
|
* Without a seam nothing here subscribes to, reads or writes anything.
|
|
364
390
|
*/
|
|
365
391
|
export declare function useLiveAvatarHandsFreeGuard(): boolean;
|