@burdenoff/fe-libs 2026.1118.7 → 2026.1118.9
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/index.d.ts +2 -0
- package/dist/shared/assistant/ui/useVoiceSession.js +188 -142
- package/dist/shared/assistant/voice/handsFree.d.ts +3 -1
- package/dist/shared/assistant/voice/handsfree/audioTrackTransport.d.ts +8 -0
- package/dist/shared/assistant/voice/handsfree/audioTrackTransport.js +36 -31
- package/dist/shared/assistant/voice/handsfree/backendStreamTransport.js +1 -0
- package/dist/shared/assistant/voice/handsfree/echoGate.d.ts +21 -0
- package/dist/shared/assistant/voice/handsfree/echoGate.js +11 -2
- package/dist/shared/assistant/voice/handsfree/handsFreeController.d.ts +7 -0
- package/dist/shared/assistant/voice/handsfree/handsFreeController.js +46 -42
- package/dist/shared/assistant/voice/handsfree/playbackReference.d.ts +63 -5
- package/dist/shared/assistant/voice/handsfree/playbackReference.js +56 -29
- package/dist/shared/assistant/voice/handsfree/preRollRing.d.ts +7 -0
- package/dist/shared/assistant/voice/handsfree/preRollRing.js +3 -0
- package/dist/shared/assistant/voice/handsfree/sttTransport.d.ts +16 -0
- package/dist/shared/assistant/voice/handsfree/useHandsFreeInterrupt.js +55 -54
- package/dist/shared/assistant/voice/handsfree/vad.d.ts +9 -0
- package/dist/shared/assistant/voice/handsfree/vad.js +10 -7
- package/dist/shared/assistant/voice/handsfree/webSpeechTransport.js +1 -0
- package/dist/shared/assistant/voice/thinkingTone.d.ts +213 -0
- package/dist/shared/assistant/voice/thinkingTone.js +182 -0
- package/dist/shared/assistant/voice/thinkingToneConfig.d.ts +4 -0
- package/dist/shared/assistant/voice/thinkingToneConfig.js +9 -0
- package/dist/shared/assistant/voice/voiceSession.d.ts +24 -0
- package/dist/shared/assistant/voice/voiceSession.js +18 -11
- package/dist/shared/backgrounds/useBackgroundPreference.d.ts +10 -4
- package/dist/shared/backgrounds/useBackgroundPreference.js +69 -47
- package/dist/shared-assistant.js +404 -402
- package/package.json +1 -1
|
@@ -73,6 +73,15 @@ export interface VoiceSessionSnapshot {
|
|
|
73
73
|
candidateId: number;
|
|
74
74
|
accepted: boolean;
|
|
75
75
|
};
|
|
76
|
+
/**
|
|
77
|
+
* ★ D3 (BOFF-12936), H2's one exception: the thinking tone sounded when a
|
|
78
|
+
* spoken turn was sent, and until this wall-clock ms what the recogniser
|
|
79
|
+
* reports without acoustic vetting may be the tone itself, not the person
|
|
80
|
+
* (`thinkingToneHeardUntil`, `mayBeThinkingTone`). Set by `thinking-tone`;
|
|
81
|
+
* absent when no tone has played. It is not cleared with the turn — it runs
|
|
82
|
+
* out — and `start` resets it.
|
|
83
|
+
*/
|
|
84
|
+
thinkingToneUntil?: number;
|
|
76
85
|
}
|
|
77
86
|
/**
|
|
78
87
|
* Deliberately does NOT include a "playback blocked" variant. Nothing can
|
|
@@ -167,6 +176,15 @@ export type VoiceSessionEvent =
|
|
|
167
176
|
*/
|
|
168
177
|
| {
|
|
169
178
|
type: 'answered-locally';
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* ★ D3 (BOFF-12936): the thinking tone started for the spoken turn just sent.
|
|
182
|
+
* `until`: the wall-clock ms by which the last of what a recogniser may report
|
|
183
|
+
* of it has arrived (`thinkingToneHeardUntil`). See `thinkingToneUntil`.
|
|
184
|
+
*/
|
|
185
|
+
| {
|
|
186
|
+
type: 'thinking-tone';
|
|
187
|
+
until: number;
|
|
170
188
|
} | {
|
|
171
189
|
type: 'fail';
|
|
172
190
|
error: VoiceSessionError;
|
|
@@ -347,6 +365,12 @@ export declare function isCapturing(snapshot: VoiceSessionSnapshot): boolean;
|
|
|
347
365
|
* lets a person correct themselves without tapping. Closed for the whole of
|
|
348
366
|
* `speaking`, and whenever muted. Barge-in while SPEAKING is a separate step
|
|
349
367
|
* (H3) and is NOT enabled here.
|
|
368
|
+
*
|
|
369
|
+
* ★ ONE deliberate exception to "nothing plays while thinking": the thinking
|
|
370
|
+
* tone (D3, BOFF-12936, opt-in per app), about 150 ms as a spoken turn is sent.
|
|
371
|
+
* The recogniser stays open through it; what it reports during the tone and its
|
|
372
|
+
* tail is never taken as speech (`thinkingToneUntil`), and hands-free capture
|
|
373
|
+
* attributes nothing while it sounds (`EchoGate.cueStarted`).
|
|
350
374
|
*/
|
|
351
375
|
export declare function shouldRecognise(snapshot: VoiceSessionSnapshot): boolean;
|
|
352
376
|
/** The orb's visual mode. Kept here so the UI has no state logic of its own. */
|
|
@@ -59,8 +59,11 @@ var h = Object.freeze({
|
|
|
59
59
|
submittedAt: null,
|
|
60
60
|
correcting: !1
|
|
61
61
|
};
|
|
62
|
-
function _(e,
|
|
63
|
-
|
|
62
|
+
function _(e, t) {
|
|
63
|
+
return t.gated !== !0 && e.thinkingToneUntil !== void 0 && t.at !== void 0 && t.at <= e.thinkingToneUntil;
|
|
64
|
+
}
|
|
65
|
+
function v(e, n, r) {
|
|
66
|
+
if (_(e, n) || !n.gated && p(n.transcript, r)) return e;
|
|
64
67
|
let i = t({
|
|
65
68
|
transcript: n.transcript,
|
|
66
69
|
submitted: e.submitted,
|
|
@@ -79,7 +82,7 @@ function _(e, n, r) {
|
|
|
79
82
|
interim: n.final ? "" : a
|
|
80
83
|
};
|
|
81
84
|
}
|
|
82
|
-
function
|
|
85
|
+
function y(t, r, i = null) {
|
|
83
86
|
if (r.type === "start") return {
|
|
84
87
|
...h,
|
|
85
88
|
phase: "listening"
|
|
@@ -120,7 +123,7 @@ function v(t, r, i = null) {
|
|
|
120
123
|
case "speech": {
|
|
121
124
|
if (t.muted) return t;
|
|
122
125
|
if (t.phase === "thinking") {
|
|
123
|
-
let e =
|
|
126
|
+
let e = v(t, r, i);
|
|
124
127
|
return r.timingCandidateId !== void 0 && (e !== t || r.final) ? {
|
|
125
128
|
...e,
|
|
126
129
|
correctionTimingDecision: {
|
|
@@ -129,7 +132,7 @@ function v(t, r, i = null) {
|
|
|
129
132
|
}
|
|
130
133
|
} : e;
|
|
131
134
|
}
|
|
132
|
-
if (t.phase !== "listening" || !r.gated && p(r.transcript, i)) return t;
|
|
135
|
+
if (t.phase !== "listening" || _(t, r) || !r.gated && p(r.transcript, i)) return t;
|
|
133
136
|
let a = t.correcting ? n(r.transcript, t.submitted) : r.transcript;
|
|
134
137
|
if (t.correcting && a === "") return t;
|
|
135
138
|
if (r.final) {
|
|
@@ -202,6 +205,10 @@ function v(t, r, i = null) {
|
|
|
202
205
|
pending: "",
|
|
203
206
|
interim: ""
|
|
204
207
|
} : t;
|
|
208
|
+
case "thinking-tone": return {
|
|
209
|
+
...t,
|
|
210
|
+
thinkingToneUntil: r.until
|
|
211
|
+
};
|
|
205
212
|
case "announce": return t.phase === "listening" && s(t) === "" ? {
|
|
206
213
|
...t,
|
|
207
214
|
phase: "speaking",
|
|
@@ -211,7 +218,7 @@ function v(t, r, i = null) {
|
|
|
211
218
|
default: return t;
|
|
212
219
|
}
|
|
213
220
|
}
|
|
214
|
-
function
|
|
221
|
+
function b(e) {
|
|
215
222
|
switch (e.phase) {
|
|
216
223
|
case "listening": return s(e) === "" ? "start" : "drop";
|
|
217
224
|
case "thinking":
|
|
@@ -219,7 +226,7 @@ function y(e) {
|
|
|
219
226
|
default: return "drop";
|
|
220
227
|
}
|
|
221
228
|
}
|
|
222
|
-
function
|
|
229
|
+
function x(e) {
|
|
223
230
|
let { requested: t, held: n, muted: r } = e;
|
|
224
231
|
return t ? n ? {
|
|
225
232
|
mute: null,
|
|
@@ -238,13 +245,13 @@ function b(e) {
|
|
|
238
245
|
held: !1
|
|
239
246
|
};
|
|
240
247
|
}
|
|
241
|
-
function
|
|
248
|
+
function S(e) {
|
|
242
249
|
return !e.muted && e.phase === "listening";
|
|
243
250
|
}
|
|
244
|
-
function
|
|
251
|
+
function C(e) {
|
|
245
252
|
return e.muted ? !1 : e.phase === "listening" || e.phase === "thinking";
|
|
246
253
|
}
|
|
247
|
-
function
|
|
254
|
+
function w(e) {
|
|
248
255
|
switch (e.phase) {
|
|
249
256
|
case "thinking": return "thinking";
|
|
250
257
|
case "speaking": return "speaking";
|
|
@@ -252,4 +259,4 @@ function C(e) {
|
|
|
252
259
|
default: return "idle";
|
|
253
260
|
}
|
|
254
261
|
}
|
|
255
|
-
export { r as ENDPOINT_GRACE_MS, h as INITIAL_SESSION, i as INTERRUPT_MAX_MS, a as INTERRUPT_MIN_MS, c as NOTHING_HEARD, u as advanceHeardClock,
|
|
262
|
+
export { r as ENDPOINT_GRACE_MS, h as INITIAL_SESSION, i as INTERRUPT_MAX_MS, a as INTERRUPT_MIN_MS, c as NOTHING_HEARD, u as advanceHeardClock, S as isCapturing, p as isEcho, o as isSubmittable, w as orbMode, x as planListeningHold, m as planReplyConsumption, b as planVoiceAnnouncement, C as shouldRecognise, s as spokenSoFar, y as voiceSessionReducer };
|
|
@@ -10,17 +10,23 @@ export declare const BACKGROUND_PREFERENCE_KEY = "boff-background";
|
|
|
10
10
|
export interface UseBackgroundPreferenceOptions {
|
|
11
11
|
/** The keys' namespace (default `boff-background`). */
|
|
12
12
|
storageKey?: string;
|
|
13
|
+
/**
|
|
14
|
+
* This product's own default, merged over the library default (dotted waves, accent, subtle).
|
|
15
|
+
* It applies wherever nothing valid is stored, and `reset()` returns to it. Pass a stable
|
|
16
|
+
* value (a module constant); its fields, not its identity, are what is used.
|
|
17
|
+
*/
|
|
18
|
+
defaults?: Partial<BackgroundPreference>;
|
|
13
19
|
}
|
|
14
20
|
export interface BackgroundPreferenceControls extends BackgroundPreference {
|
|
15
21
|
setEffect(effect: BackgroundEffectName): void;
|
|
16
22
|
setColors(colors: BackgroundColorMode): void;
|
|
17
23
|
setStrength(strength: BackgroundStrength): void;
|
|
18
|
-
/** Back to the default. */
|
|
24
|
+
/** Back to the default (the `defaults` option merged over the library default). */
|
|
19
25
|
reset(): void;
|
|
20
26
|
}
|
|
21
|
-
/** The stored choice (each field validated; anything else is the default). */
|
|
22
|
-
export declare function readBackgroundPreference(storageKey?: string): BackgroundPreference;
|
|
27
|
+
/** The stored choice (each field validated; anything else is the default, or the given `defaults`). */
|
|
28
|
+
export declare function readBackgroundPreference(storageKey?: string, defaults?: Partial<BackgroundPreference>): BackgroundPreference;
|
|
23
29
|
/** The person's background choice and its setters. */
|
|
24
|
-
export declare function useBackgroundPreference({ storageKey, }?: UseBackgroundPreferenceOptions): BackgroundPreferenceControls;
|
|
30
|
+
export declare function useBackgroundPreference({ storageKey, defaults, }?: UseBackgroundPreferenceOptions): BackgroundPreferenceControls;
|
|
25
31
|
/** Tests only: forget the in-memory channels (the stored values stay). */
|
|
26
32
|
export declare function resetBackgroundPreferenceChannels(): void;
|
|
@@ -24,86 +24,108 @@ function u() {
|
|
|
24
24
|
function d(e, t) {
|
|
25
25
|
return l[e].includes(t);
|
|
26
26
|
}
|
|
27
|
-
function f(e
|
|
28
|
-
let t =
|
|
29
|
-
|
|
27
|
+
function f(e) {
|
|
28
|
+
let t = { ...o };
|
|
29
|
+
if (!e) return t;
|
|
30
|
+
let n = (n) => {
|
|
31
|
+
let r = e[n];
|
|
32
|
+
d(n, r) && (t[n] = r);
|
|
33
|
+
};
|
|
34
|
+
return n("effect"), n("colors"), n("strength"), t;
|
|
35
|
+
}
|
|
36
|
+
function p(e = s, t) {
|
|
37
|
+
let n = f(t), r = u(), i = (t) => {
|
|
38
|
+
let i = null;
|
|
30
39
|
try {
|
|
31
|
-
|
|
40
|
+
i = r?.getItem(`${e}-${t}`) ?? null;
|
|
32
41
|
} catch {
|
|
33
|
-
|
|
42
|
+
i = null;
|
|
34
43
|
}
|
|
35
|
-
return d(
|
|
44
|
+
return d(t, i) ? i : n[t];
|
|
36
45
|
};
|
|
37
46
|
return {
|
|
38
|
-
effect:
|
|
39
|
-
colors:
|
|
40
|
-
strength:
|
|
47
|
+
effect: i("effect"),
|
|
48
|
+
colors: i("colors"),
|
|
49
|
+
strength: i("strength")
|
|
41
50
|
};
|
|
42
51
|
}
|
|
43
|
-
var
|
|
44
|
-
function
|
|
45
|
-
let
|
|
46
|
-
if (!
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
var m = /* @__PURE__ */ new Map(), h = (e, t) => c.every((n) => e[n] === t[n]);
|
|
53
|
+
function g(e, t) {
|
|
54
|
+
let n = m.get(e);
|
|
55
|
+
if (!n) {
|
|
56
|
+
let r = f(t);
|
|
57
|
+
n = {
|
|
58
|
+
value: p(e, r),
|
|
59
|
+
defaults: r,
|
|
60
|
+
listeners: /* @__PURE__ */ new Set(),
|
|
61
|
+
unpersisted: !1
|
|
62
|
+
}, m.set(e, n);
|
|
63
|
+
} else if (n.listeners.size === 0 && !n.unpersisted) {
|
|
64
|
+
t && (n.defaults = f(t));
|
|
65
|
+
let r = p(e, n.defaults);
|
|
66
|
+
h(r, n.value) || (n.value = r);
|
|
54
67
|
}
|
|
55
|
-
return
|
|
68
|
+
return n;
|
|
56
69
|
}
|
|
57
|
-
function
|
|
58
|
-
let n =
|
|
59
|
-
if (!
|
|
70
|
+
function _(e, t) {
|
|
71
|
+
let n = g(e);
|
|
72
|
+
if (!h(n.value, t)) {
|
|
60
73
|
n.value = t;
|
|
61
74
|
for (let e of [...n.listeners]) e();
|
|
62
75
|
}
|
|
63
76
|
}
|
|
64
|
-
function
|
|
77
|
+
function v(e, t) {
|
|
65
78
|
let n = u(), r = n !== null;
|
|
66
79
|
for (let i of c) try {
|
|
67
80
|
n?.setItem(`${e}-${i}`, t[i]);
|
|
68
81
|
} catch {
|
|
69
82
|
r = !1;
|
|
70
83
|
}
|
|
71
|
-
|
|
84
|
+
g(e).unpersisted = !r, _(e, t);
|
|
72
85
|
}
|
|
73
|
-
var
|
|
74
|
-
function
|
|
75
|
-
for (let [t, n] of
|
|
86
|
+
var y = 0;
|
|
87
|
+
function b(e) {
|
|
88
|
+
for (let [t, n] of m) (e.key === null || e.key.startsWith(`${t}-`)) && (n.unpersisted = !1, _(t, p(t, n.defaults)));
|
|
76
89
|
}
|
|
77
|
-
function
|
|
90
|
+
function x() {
|
|
78
91
|
if (typeof window > "u") return () => void 0;
|
|
79
|
-
|
|
92
|
+
y === 0 && window.addEventListener("storage", b), y += 1;
|
|
80
93
|
let e = !1;
|
|
81
94
|
return () => {
|
|
82
|
-
e || (e = !0, --
|
|
95
|
+
e || (e = !0, --y, y === 0 && window.removeEventListener("storage", b));
|
|
83
96
|
};
|
|
84
97
|
}
|
|
85
|
-
function
|
|
86
|
-
let t =
|
|
87
|
-
|
|
98
|
+
function S({ storageKey: e = s, defaults: t } = {}) {
|
|
99
|
+
let { effect: n, colors: o, strength: c } = t ?? {}, l = i(() => f({
|
|
100
|
+
effect: n,
|
|
101
|
+
colors: o,
|
|
102
|
+
strength: c
|
|
103
|
+
}), [
|
|
104
|
+
n,
|
|
105
|
+
o,
|
|
106
|
+
c
|
|
107
|
+
]), u = r((t) => {
|
|
108
|
+
let n = x(), r = g(e, l);
|
|
88
109
|
return r.listeners.add(t), () => {
|
|
89
110
|
r.listeners.delete(t), n();
|
|
90
111
|
};
|
|
91
|
-
}, [e]),
|
|
92
|
-
d(t, n) &&
|
|
93
|
-
...
|
|
112
|
+
}, [e, l]), p = r(() => g(e, l).value, [e, l]), m = a(u, p, () => l), h = r((t, n) => {
|
|
113
|
+
d(t, n) && v(e, {
|
|
114
|
+
...g(e).value,
|
|
94
115
|
[t]: n
|
|
95
116
|
});
|
|
96
117
|
}, [e]);
|
|
97
118
|
return i(() => ({
|
|
98
|
-
...
|
|
99
|
-
setEffect: (e) =>
|
|
100
|
-
setColors: (e) =>
|
|
101
|
-
setStrength: (e) =>
|
|
102
|
-
reset: () =>
|
|
119
|
+
...m,
|
|
120
|
+
setEffect: (e) => h("effect", e),
|
|
121
|
+
setColors: (e) => h("colors", e),
|
|
122
|
+
setStrength: (e) => h("strength", e),
|
|
123
|
+
reset: () => v(e, { ...g(e, l).defaults })
|
|
103
124
|
}), [
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
e
|
|
125
|
+
m,
|
|
126
|
+
h,
|
|
127
|
+
e,
|
|
128
|
+
l
|
|
107
129
|
]);
|
|
108
130
|
}
|
|
109
|
-
export { s as BACKGROUND_PREFERENCE_KEY, o as DEFAULT_BACKGROUND_PREFERENCE,
|
|
131
|
+
export { s as BACKGROUND_PREFERENCE_KEY, o as DEFAULT_BACKGROUND_PREFERENCE, p as readBackgroundPreference, S as useBackgroundPreference };
|