@burdenoff/fe-libs 2026.925.3 → 2026.925.4
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/speech/browserSpeechEngine.d.ts.map +1 -1
- package/dist/shared/assistant/speech/browserSpeechEngine.js +1 -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 +283 -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 +502 -465
- 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,14 +1,15 @@
|
|
|
1
1
|
import { useVoiceInput as e } from "../voice/useVoiceInput.js";
|
|
2
|
-
import { INITIAL_SESSION as t, INTERRUPT_MAX_MS as n,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { INITIAL_SESSION as t, INTERRUPT_MAX_MS as n, NOTHING_HEARD as r, SILENCE_SUBMIT_MS as ee, advanceHeardClock as i, isCapturing as a, isSubmittable as o, planReplyConsumption as s, spokenSoFar as c, voiceSessionReducer as te } from "../voice/voiceSession.js";
|
|
3
|
+
import { turnClockMs as l } from "../turnTimeline.js";
|
|
4
|
+
import { useAssistantSpeech as u } from "./AssistantSpeechProvider.js";
|
|
5
|
+
import { useCallback as d, useEffect as f, useMemo as p, useReducer as m, useRef as h, useState as g } from "react";
|
|
5
6
|
//#region src/shared/assistant/ui/useVoiceSession.ts
|
|
6
|
-
var
|
|
7
|
+
var ne = 4e3, _ = 2500, v = 5e3, y = 12e3, b = "data:audio/wav;base64,UklGRiQAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQAAAAA=";
|
|
7
8
|
function x({ onSubmit: x, latestReply: S, language: C }) {
|
|
8
|
-
let w =
|
|
9
|
-
|
|
10
|
-
let
|
|
11
|
-
|
|
9
|
+
let w = h(null), [T, E] = m(d((e, t) => te(e, t, w.current), []), t), D = u(), { setSessionSpeaking: O, setSessionMicOpen: k, speakingMessageId: A, stop: j } = D, M = h(null), N = h({}), P = h(r), F = h(null), I = h(!1), [L, R] = g(null), [z, B] = g(!1), [V, H] = g(!1), U = h(T);
|
|
10
|
+
U.current = T;
|
|
11
|
+
let W = h(S);
|
|
12
|
+
W.current = S, f(() => {
|
|
12
13
|
if (T.phase === "speaking") {
|
|
13
14
|
w.current = S?.text ?? null;
|
|
14
15
|
return;
|
|
@@ -19,83 +20,89 @@ function x({ onSubmit: x, latestReply: S, language: C }) {
|
|
|
19
20
|
}, _);
|
|
20
21
|
return () => clearTimeout(e);
|
|
21
22
|
}, [T.phase, S]);
|
|
22
|
-
let
|
|
23
|
+
let G = d((e, t) => {
|
|
23
24
|
E({
|
|
24
25
|
type: "speech",
|
|
25
26
|
transcript: e,
|
|
26
27
|
final: t
|
|
27
28
|
});
|
|
28
|
-
}, []),
|
|
29
|
-
j(),
|
|
30
|
-
}, [j]),
|
|
31
|
-
onFinalize:
|
|
29
|
+
}, []), K = h(0), q = d(() => {
|
|
30
|
+
j(), K.current = Date.now(), B(!0), E({ type: "interrupt" });
|
|
31
|
+
}, [j]), J = e({
|
|
32
|
+
onFinalize: d((e) => G(e, !0), [G]),
|
|
32
33
|
language: C
|
|
33
34
|
});
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}, [
|
|
37
|
-
if (M.current && clearTimeout(M.current),
|
|
38
|
-
let e = setTimeout(() =>
|
|
39
|
-
return M.current = setTimeout(() =>
|
|
35
|
+
f(() => {
|
|
36
|
+
J.interim && G(J.interim, !1);
|
|
37
|
+
}, [J.interim, G]), f(() => {
|
|
38
|
+
if (M.current && clearTimeout(M.current), H(!1), P.current = i(P.current, T, l()), T.phase !== "listening" || T.muted || !o(c(T))) return;
|
|
39
|
+
let e = setTimeout(() => H(!0), 800), t = l();
|
|
40
|
+
return M.current = setTimeout(() => {
|
|
41
|
+
N.current = {
|
|
42
|
+
speechEnded: P.current.at ?? t,
|
|
43
|
+
graceStarted: t,
|
|
44
|
+
graceEnded: l()
|
|
45
|
+
}, E({ type: "silence" });
|
|
46
|
+
}, ee), () => {
|
|
40
47
|
clearTimeout(e), M.current && clearTimeout(M.current);
|
|
41
48
|
};
|
|
42
|
-
}, [T]),
|
|
43
|
-
if (!
|
|
44
|
-
let e = Date.now() -
|
|
49
|
+
}, [T]), f(() => {
|
|
50
|
+
if (!z) return;
|
|
51
|
+
let e = Date.now() - K.current, t = J.isListening ? Math.max(0, 500 - e) : Math.max(0, n - e), r = setTimeout(() => B(!1), t);
|
|
45
52
|
return () => clearTimeout(r);
|
|
46
|
-
}, [
|
|
47
|
-
let
|
|
48
|
-
T.phase === "listening" && (
|
|
53
|
+
}, [z, J.isListening]);
|
|
54
|
+
let Y = h("");
|
|
55
|
+
T.phase === "listening" && (Y.current = c(T)), f(() => {
|
|
49
56
|
if (T.phase !== "thinking") return;
|
|
50
|
-
let e =
|
|
51
|
-
e && x(e,
|
|
52
|
-
}, [T.phase]),
|
|
53
|
-
let e =
|
|
54
|
-
e.claim && (
|
|
57
|
+
let e = Y.current.trim();
|
|
58
|
+
e && x(e, X.current ?? `vs-orphan-${Date.now().toString(36)}`, N.current), N.current = {}, P.current = r;
|
|
59
|
+
}, [T.phase]), f(() => {
|
|
60
|
+
let e = s(S?.id, T.phase, F.current);
|
|
61
|
+
e.claim && (F.current = S?.id ?? null, e.advance && S && E({
|
|
55
62
|
type: "reply",
|
|
56
63
|
text: S.text
|
|
57
64
|
}));
|
|
58
|
-
}, [S, T.phase]),
|
|
65
|
+
}, [S, T.phase]), f(() => {
|
|
59
66
|
let e = A !== null;
|
|
60
|
-
|
|
61
|
-
}, [A]),
|
|
62
|
-
T.phase !== "listening" &&
|
|
63
|
-
}, [T.phase]),
|
|
67
|
+
I.current && !e && E({ type: "speech-ended" }), I.current = e;
|
|
68
|
+
}, [A]), f(() => {
|
|
69
|
+
T.phase !== "listening" && R((e) => e === "nothing-heard" ? null : e);
|
|
70
|
+
}, [T.phase]), f(() => {
|
|
64
71
|
if (T.phase !== "speaking" || A !== null) return;
|
|
65
72
|
let e = setTimeout(() => {
|
|
66
|
-
|
|
67
|
-
},
|
|
73
|
+
I.current || E({ type: "speech-ended" });
|
|
74
|
+
}, ne);
|
|
68
75
|
return () => clearTimeout(e);
|
|
69
|
-
}, [T.phase, A]),
|
|
70
|
-
let e =
|
|
71
|
-
k(e), e ?
|
|
76
|
+
}, [T.phase, A]), f(() => {
|
|
77
|
+
let e = a(T);
|
|
78
|
+
k(e), e ? J.isActive || J.start("auto") : J.isActive && J.stop();
|
|
72
79
|
}, [
|
|
73
80
|
T,
|
|
74
|
-
|
|
81
|
+
J,
|
|
75
82
|
k
|
|
76
|
-
]),
|
|
77
|
-
|
|
83
|
+
]), f(() => {
|
|
84
|
+
J.error === "not-allowed" || J.error === "audio-capture" ? E({
|
|
78
85
|
type: "fail",
|
|
79
86
|
error: "mic-denied"
|
|
80
|
-
}) :
|
|
87
|
+
}) : J.error === "language-not-supported" ? E({
|
|
81
88
|
type: "fail",
|
|
82
89
|
error: "no-speech-support"
|
|
83
|
-
}) :
|
|
84
|
-
}, [
|
|
85
|
-
|
|
86
|
-
}, [
|
|
87
|
-
if (
|
|
88
|
-
let e = setTimeout(() =>
|
|
90
|
+
}) : J.error === "network" ? R("network") : J.error === "unknown" && R("recognition-failed");
|
|
91
|
+
}, [J.error]), f(() => {
|
|
92
|
+
J.error !== null || !J.isListening || R((e) => e === "network" || e === "recognition-failed" ? null : e);
|
|
93
|
+
}, [J.error, J.isListening]), f(() => {
|
|
94
|
+
if (J.isListening && R((e) => e === "not-capturing" ? null : e), !a(T) || J.isListening) return;
|
|
95
|
+
let e = setTimeout(() => R("not-capturing"), v);
|
|
89
96
|
return () => clearTimeout(e);
|
|
90
|
-
}, [T,
|
|
91
|
-
if (T.phase !== "listening" || T.muted || !
|
|
92
|
-
let e = setTimeout(() =>
|
|
97
|
+
}, [T, J.isListening]), f(() => {
|
|
98
|
+
if (T.phase !== "listening" || T.muted || !J.isListening || c(T) !== "") return;
|
|
99
|
+
let e = setTimeout(() => R("nothing-heard"), y);
|
|
93
100
|
return () => clearTimeout(e);
|
|
94
|
-
}, [T,
|
|
95
|
-
|
|
101
|
+
}, [T, J.isListening]), f(() => {
|
|
102
|
+
c(T) !== "" && R(null);
|
|
96
103
|
}, [T]);
|
|
97
|
-
let
|
|
98
|
-
if (
|
|
104
|
+
let X = h(null), Z = d(() => {
|
|
105
|
+
if (B(!1), H(!1), !J.isSupported) {
|
|
99
106
|
E({
|
|
100
107
|
type: "fail",
|
|
101
108
|
error: "no-speech-support"
|
|
@@ -122,47 +129,47 @@ function x({ onSubmit: x, latestReply: S, language: C }) {
|
|
|
122
129
|
e.volume = 0, e.play().catch(() => {});
|
|
123
130
|
}
|
|
124
131
|
} catch {}
|
|
125
|
-
O(!0),
|
|
132
|
+
O(!0), R(null), F.current = W.current?.id ?? null, X.current = `vs-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`, E({ type: "start" });
|
|
126
133
|
}, [
|
|
127
|
-
|
|
134
|
+
J.isSupported,
|
|
128
135
|
D.isBlocked,
|
|
129
136
|
O
|
|
130
|
-
]),
|
|
131
|
-
|
|
132
|
-
}, [j, O]),
|
|
137
|
+
]), Q = d(() => {
|
|
138
|
+
B(!1), H(!1), X.current = null, E({ type: "end" }), j(), O(!1);
|
|
139
|
+
}, [j, O]), $ = d(() => {
|
|
133
140
|
E({
|
|
134
141
|
type: "mute",
|
|
135
|
-
muted: !
|
|
142
|
+
muted: !U.current.muted
|
|
136
143
|
});
|
|
137
144
|
}, []);
|
|
138
|
-
return
|
|
145
|
+
return f(() => () => {
|
|
139
146
|
O(!1), k(!1);
|
|
140
|
-
}, [O, k]),
|
|
147
|
+
}, [O, k]), p(() => ({
|
|
141
148
|
session: T,
|
|
142
|
-
notice:
|
|
149
|
+
notice: L,
|
|
143
150
|
spokenChunks: D.spokenChunks,
|
|
144
|
-
capturing:
|
|
151
|
+
capturing: J.isListening,
|
|
145
152
|
active: T.phase !== "idle" && (T.phase !== "ended" || T.error !== null),
|
|
146
|
-
interrupting:
|
|
147
|
-
awaitingEndpoint:
|
|
148
|
-
available:
|
|
149
|
-
start:
|
|
150
|
-
end:
|
|
151
|
-
toggleMute:
|
|
152
|
-
interrupt:
|
|
153
|
+
interrupting: z,
|
|
154
|
+
awaitingEndpoint: V,
|
|
155
|
+
available: J.isSupported && !D.isBlocked,
|
|
156
|
+
start: Z,
|
|
157
|
+
end: Q,
|
|
158
|
+
toggleMute: $,
|
|
159
|
+
interrupt: q
|
|
153
160
|
}), [
|
|
154
161
|
T,
|
|
155
|
-
F,
|
|
156
162
|
L,
|
|
157
163
|
z,
|
|
158
|
-
|
|
159
|
-
|
|
164
|
+
V,
|
|
165
|
+
J.isListening,
|
|
166
|
+
J.isSupported,
|
|
160
167
|
D.isBlocked,
|
|
161
168
|
D.spokenChunks,
|
|
162
|
-
Y,
|
|
163
|
-
X,
|
|
164
169
|
Z,
|
|
165
|
-
|
|
170
|
+
Q,
|
|
171
|
+
$,
|
|
172
|
+
q
|
|
166
173
|
]);
|
|
167
174
|
}
|
|
168
175
|
//#endregion
|
|
@@ -141,6 +141,31 @@ export declare const INTERRUPT_MIN_MS = 500;
|
|
|
141
141
|
export declare function isSubmittable(text: string): boolean;
|
|
142
142
|
/** Everything heard this turn: committed phrases plus the current guess. */
|
|
143
143
|
export declare function spokenSoFar(snapshot: VoiceSessionSnapshot): string;
|
|
144
|
+
/**
|
|
145
|
+
* When the heard WORDS last changed — "stopped speaking" as far as a latency
|
|
146
|
+
* report can know it (BOFF-7801).
|
|
147
|
+
*
|
|
148
|
+
* The clock keeps the most speech heard so far (`text`, normalised) and when
|
|
149
|
+
* it grew. Words are compared as letters, marks and digits, so capitals and
|
|
150
|
+
* punctuation added by a final are not more speech (Tamil vowel signs are
|
|
151
|
+
* marks, and kept).
|
|
152
|
+
*
|
|
153
|
+
* - Anything that is a PREFIX of what was already heard is not new speech: a
|
|
154
|
+
* final committing the words (or an earlier segment of them) while the rest
|
|
155
|
+
* is re-sent as interim.
|
|
156
|
+
* - A FINAL no longer than what was heard is the recogniser REVISING it
|
|
157
|
+
* ("whether" → "weather") after its own end-of-speech silence: not new.
|
|
158
|
+
* - Anything else — more words — is new speech, and moves the time. So does a
|
|
159
|
+
* final with nothing heard before it, the only sign of that speech.
|
|
160
|
+
* - Nothing pending (muted, ended, submitted, a fresh start) forgets it all, so
|
|
161
|
+
* a discarded utterance lends no time to the next.
|
|
162
|
+
*/
|
|
163
|
+
export interface HeardClock {
|
|
164
|
+
text: string;
|
|
165
|
+
at: number | null;
|
|
166
|
+
}
|
|
167
|
+
export declare const NOTHING_HEARD: HeardClock;
|
|
168
|
+
export declare function advanceHeardClock(clock: HeardClock, snapshot: VoiceSessionSnapshot, now: number): HeardClock;
|
|
144
169
|
export declare function isEcho(transcript: string, spokenText: string | null): boolean;
|
|
145
170
|
/**
|
|
146
171
|
* What to do with a reply the app has just observed.
|
|
@@ -1 +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,QAAQ,EAAE,oBAAoB,GAAG,OAAO,CAKnE;AAED,gFAAgF;AAChF,wBAAgB,OAAO,CAAC,QAAQ,EAAE,oBAAoB,GAAG,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,UAAU,CAatG"}
|
|
@@ -6,16 +6,32 @@ function i(e) {
|
|
|
6
6
|
function a(e) {
|
|
7
7
|
return `${e.pending} ${e.interim}`.replace(/\s+/g, " ").trim();
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
var o = {
|
|
10
|
+
text: "",
|
|
11
|
+
at: null
|
|
12
|
+
}, s = (e) => e ? e.split(" ").length : 0;
|
|
13
|
+
function c(e, t, n) {
|
|
14
|
+
let r = a(t);
|
|
15
|
+
if (!r) return o;
|
|
16
|
+
let i = r.toLowerCase().replace(/[^\p{L}\p{M}\p{N}]+/gu, " ").trim();
|
|
17
|
+
return i === e.text || e.text.startsWith(i) ? e : t.interim.trim() === "" && s(i) <= s(e.text) ? {
|
|
18
|
+
text: i,
|
|
19
|
+
at: e.at
|
|
20
|
+
} : {
|
|
21
|
+
text: i,
|
|
22
|
+
at: n
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function l(e) {
|
|
10
26
|
return e.toLowerCase().replace(/[^\p{L}\p{N}]+/gu, " ").trim();
|
|
11
27
|
}
|
|
12
|
-
var
|
|
13
|
-
function
|
|
28
|
+
var u = 3;
|
|
29
|
+
function d(e, t) {
|
|
14
30
|
if (!t) return !1;
|
|
15
|
-
let n =
|
|
16
|
-
return n.length === 0 ? !0 : n.split(" ").length <
|
|
31
|
+
let n = l(e);
|
|
32
|
+
return n.length === 0 ? !0 : n.split(" ").length < u ? !1 : ` ${l(t)} `.includes(` ${n} `);
|
|
17
33
|
}
|
|
18
|
-
function
|
|
34
|
+
function f(e, t, n) {
|
|
19
35
|
return !e || e === n ? {
|
|
20
36
|
claim: !1,
|
|
21
37
|
advance: !1
|
|
@@ -24,16 +40,16 @@ function l(e, t, n) {
|
|
|
24
40
|
advance: t === "thinking"
|
|
25
41
|
};
|
|
26
42
|
}
|
|
27
|
-
var
|
|
43
|
+
var p = Object.freeze({
|
|
28
44
|
phase: "idle",
|
|
29
45
|
muted: !1,
|
|
30
46
|
pending: "",
|
|
31
47
|
interim: "",
|
|
32
48
|
error: null
|
|
33
49
|
});
|
|
34
|
-
function
|
|
50
|
+
function m(e, t, n = null) {
|
|
35
51
|
if (t.type === "start") return {
|
|
36
|
-
...
|
|
52
|
+
...p,
|
|
37
53
|
phase: "listening"
|
|
38
54
|
};
|
|
39
55
|
if (t.type === "end") return {
|
|
@@ -66,7 +82,7 @@ function d(e, t, n = null) {
|
|
|
66
82
|
pending: "",
|
|
67
83
|
interim: ""
|
|
68
84
|
} : e;
|
|
69
|
-
case "speech": return e.muted || e.phase !== "listening" ||
|
|
85
|
+
case "speech": return e.muted || e.phase !== "listening" || d(t.transcript, n) ? e : t.final ? {
|
|
70
86
|
...e,
|
|
71
87
|
pending: `${e.pending} ${t.transcript}`.replace(/\s+/g, " ").trim(),
|
|
72
88
|
interim: ""
|
|
@@ -93,10 +109,10 @@ function d(e, t, n = null) {
|
|
|
93
109
|
default: return e;
|
|
94
110
|
}
|
|
95
111
|
}
|
|
96
|
-
function
|
|
112
|
+
function h(e) {
|
|
97
113
|
return e.muted ? !1 : e.phase === "listening";
|
|
98
114
|
}
|
|
99
|
-
function
|
|
115
|
+
function g(e) {
|
|
100
116
|
switch (e.phase) {
|
|
101
117
|
case "thinking": return "thinking";
|
|
102
118
|
case "speaking": return "speaking";
|
|
@@ -105,4 +121,4 @@ function p(e) {
|
|
|
105
121
|
}
|
|
106
122
|
}
|
|
107
123
|
//#endregion
|
|
108
|
-
export { t as ENDPOINT_GRACE_MS,
|
|
124
|
+
export { t as ENDPOINT_GRACE_MS, p as INITIAL_SESSION, n as INTERRUPT_MAX_MS, r as INTERRUPT_MIN_MS, o as NOTHING_HEARD, e as SILENCE_SUBMIT_MS, c as advanceHeardClock, h as isCapturing, d as isEcho, i as isSubmittable, g as orbMode, f as planReplyConsumption, a as spokenSoFar, m as voiceSessionReducer };
|