@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.
Files changed (31) hide show
  1. package/dist/shared/assistant/api.d.ts +19 -1
  2. package/dist/shared/assistant/api.d.ts.map +1 -1
  3. package/dist/shared/assistant/api.js +57 -46
  4. package/dist/shared/assistant/index.d.ts +1 -0
  5. package/dist/shared/assistant/index.d.ts.map +1 -1
  6. package/dist/shared/assistant/sandboxReadiness.d.ts +45 -6
  7. package/dist/shared/assistant/sandboxReadiness.d.ts.map +1 -1
  8. package/dist/shared/assistant/sandboxReadiness.js +25 -11
  9. package/dist/shared/assistant/speech/browserSpeechEngine.d.ts.map +1 -1
  10. package/dist/shared/assistant/speech/browserSpeechEngine.js +1 -1
  11. package/dist/shared/assistant/transportErrors.d.ts +2 -0
  12. package/dist/shared/assistant/transportErrors.d.ts.map +1 -1
  13. package/dist/shared/assistant/transportErrors.js +5 -1
  14. package/dist/shared/assistant/turnProgress.d.ts +38 -0
  15. package/dist/shared/assistant/turnProgress.d.ts.map +1 -1
  16. package/dist/shared/assistant/turnProgress.js +24 -2
  17. package/dist/shared/assistant/turnTimeline.d.ts +288 -0
  18. package/dist/shared/assistant/turnTimeline.d.ts.map +1 -0
  19. package/dist/shared/assistant/turnTimeline.js +291 -0
  20. package/dist/shared/assistant/ui/AssistantChatArea.d.ts.map +1 -1
  21. package/dist/shared/assistant/ui/AssistantChatArea.js +537 -468
  22. package/dist/shared/assistant/ui/AssistantSpeechProvider.d.ts.map +1 -1
  23. package/dist/shared/assistant/ui/AssistantSpeechProvider.js +190 -185
  24. package/dist/shared/assistant/ui/useVoiceSession.d.ts +7 -1
  25. package/dist/shared/assistant/ui/useVoiceSession.d.ts.map +1 -1
  26. package/dist/shared/assistant/ui/useVoiceSession.js +87 -80
  27. package/dist/shared/assistant/voice/voiceSession.d.ts +25 -0
  28. package/dist/shared/assistant/voice/voiceSession.d.ts.map +1 -1
  29. package/dist/shared/assistant/voice/voiceSession.js +29 -13
  30. package/dist/shared-assistant.js +122 -121
  31. 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, SILENCE_SUBMIT_MS as r, isCapturing as i, isSubmittable as a, planReplyConsumption as o, spokenSoFar as s, voiceSessionReducer as c } from "../voice/voiceSession.js";
3
- import { useAssistantSpeech as l } from "./AssistantSpeechProvider.js";
4
- import { useCallback as u, useEffect as d, useMemo as f, useReducer as p, useRef as m, useState as h } from "react";
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 g = 4e3, _ = 2500, v = 5e3, y = 12e3, b = "data:audio/wav;base64,UklGRiQAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQAAAAA=";
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 = m(null), [T, E] = p(u((e, t) => c(e, t, w.current), []), t), D = l(), { setSessionSpeaking: O, setSessionMicOpen: k, speakingMessageId: A, stop: j } = D, M = m(null), N = m(null), P = m(!1), [F, I] = h(null), [L, R] = h(!1), [z, B] = h(!1), V = m(T);
9
- V.current = T;
10
- let H = m(S);
11
- H.current = S, d(() => {
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 U = u((e, t) => {
23
+ let G = d((e, t) => {
23
24
  E({
24
25
  type: "speech",
25
26
  transcript: e,
26
27
  final: t
27
28
  });
28
- }, []), W = m(0), G = u(() => {
29
- j(), W.current = Date.now(), R(!0), E({ type: "interrupt" });
30
- }, [j]), K = e({
31
- onFinalize: u((e) => U(e, !0), [U]),
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
- d(() => {
35
- K.interim && U(K.interim, !1);
36
- }, [K.interim, U]), d(() => {
37
- if (M.current && clearTimeout(M.current), B(!1), T.phase !== "listening" || T.muted || !a(s(T))) return;
38
- let e = setTimeout(() => B(!0), 800);
39
- return M.current = setTimeout(() => E({ type: "silence" }), r), () => {
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]), d(() => {
43
- if (!L) return;
44
- let e = Date.now() - W.current, t = K.isListening ? Math.max(0, 500 - e) : Math.max(0, n - e), r = setTimeout(() => R(!1), t);
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
- }, [L, K.isListening]);
47
- let q = m("");
48
- T.phase === "listening" && (q.current = s(T)), d(() => {
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 = q.current.trim();
51
- e && x(e, J.current ?? `vs-orphan-${Date.now().toString(36)}`);
52
- }, [T.phase]), d(() => {
53
- let e = o(S?.id, T.phase, N.current);
54
- e.claim && (N.current = S?.id ?? null, e.advance && S && E({
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]), d(() => {
65
+ }, [S, T.phase]), f(() => {
59
66
  let e = A !== null;
60
- P.current && !e && E({ type: "speech-ended" }), P.current = e;
61
- }, [A]), d(() => {
62
- T.phase !== "listening" && I((e) => e === "nothing-heard" ? null : e);
63
- }, [T.phase]), d(() => {
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
- P.current || E({ type: "speech-ended" });
67
- }, g);
73
+ I.current || E({ type: "speech-ended" });
74
+ }, ne);
68
75
  return () => clearTimeout(e);
69
- }, [T.phase, A]), d(() => {
70
- let e = i(T);
71
- k(e), e ? K.isActive || K.start("auto") : K.isActive && K.stop();
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
- K,
81
+ J,
75
82
  k
76
- ]), d(() => {
77
- K.error === "not-allowed" || K.error === "audio-capture" ? E({
83
+ ]), f(() => {
84
+ J.error === "not-allowed" || J.error === "audio-capture" ? E({
78
85
  type: "fail",
79
86
  error: "mic-denied"
80
- }) : K.error === "language-not-supported" ? E({
87
+ }) : J.error === "language-not-supported" ? E({
81
88
  type: "fail",
82
89
  error: "no-speech-support"
83
- }) : K.error === "network" ? I("network") : K.error === "unknown" && I("recognition-failed");
84
- }, [K.error]), d(() => {
85
- K.error !== null || !K.isListening || I((e) => e === "network" || e === "recognition-failed" ? null : e);
86
- }, [K.error, K.isListening]), d(() => {
87
- if (K.isListening && I((e) => e === "not-capturing" ? null : e), !i(T) || K.isListening) return;
88
- let e = setTimeout(() => I("not-capturing"), v);
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, K.isListening]), d(() => {
91
- if (T.phase !== "listening" || T.muted || !K.isListening || s(T) !== "") return;
92
- let e = setTimeout(() => I("nothing-heard"), y);
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, K.isListening]), d(() => {
95
- s(T) !== "" && I(null);
101
+ }, [T, J.isListening]), f(() => {
102
+ c(T) !== "" && R(null);
96
103
  }, [T]);
97
- let J = m(null), Y = u(() => {
98
- if (R(!1), B(!1), !K.isSupported) {
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), I(null), N.current = H.current?.id ?? null, J.current = `vs-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`, E({ type: "start" });
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
- K.isSupported,
134
+ J.isSupported,
128
135
  D.isBlocked,
129
136
  O
130
- ]), X = u(() => {
131
- R(!1), B(!1), J.current = null, E({ type: "end" }), j(), O(!1);
132
- }, [j, O]), Z = u(() => {
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: !V.current.muted
142
+ muted: !U.current.muted
136
143
  });
137
144
  }, []);
138
- return d(() => () => {
145
+ return f(() => () => {
139
146
  O(!1), k(!1);
140
- }, [O, k]), f(() => ({
147
+ }, [O, k]), p(() => ({
141
148
  session: T,
142
- notice: F,
149
+ notice: L,
143
150
  spokenChunks: D.spokenChunks,
144
- capturing: K.isListening,
151
+ capturing: J.isListening,
145
152
  active: T.phase !== "idle" && (T.phase !== "ended" || T.error !== null),
146
- interrupting: L,
147
- awaitingEndpoint: z,
148
- available: K.isSupported && !D.isBlocked,
149
- start: Y,
150
- end: X,
151
- toggleMute: Z,
152
- interrupt: G
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
- K.isListening,
159
- K.isSupported,
164
+ V,
165
+ J.isListening,
166
+ J.isSupported,
160
167
  D.isBlocked,
161
168
  D.spokenChunks,
162
- Y,
163
- X,
164
169
  Z,
165
- G
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 +1 @@
1
- {"version":3,"file":"voiceSession.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/voice/voiceSession.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,8EAA8E;AAC9E,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,CAAC;AAEzF,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,iBAAiB,CAAC;IACzB,8DAA8D;IAC9D,KAAK,EAAE,OAAO,CAAC;IACf,oEAAoE;IACpE,OAAO,EAAE,MAAM,CAAC;IAChB,6EAA6E;IAC7E,OAAO,EAAE,MAAM,CAAC;IAChB,2DAA2D;IAC3D,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAAC;CACjC;AAED;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG,mBAAmB,GAAG,kBAAkB,GAAG,YAAY,CAAC;AAExF,MAAM,MAAM,iBAAiB;AAC3B,uEAAuE;AACrE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE;AACxD,6CAA6C;GAC3C;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,GACxB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE;AAClC,wEAAwE;GACtE;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GACrB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,iBAAiB,CAAA;CAAE,GAC1C;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,CA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AQ,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
- function o(e) {
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 s = 3;
13
- function c(e, t) {
28
+ var u = 3;
29
+ function d(e, t) {
14
30
  if (!t) return !1;
15
- let n = o(e);
16
- return n.length === 0 ? !0 : n.split(" ").length < s ? !1 : ` ${o(t)} `.includes(` ${n} `);
31
+ let n = l(e);
32
+ return n.length === 0 ? !0 : n.split(" ").length < u ? !1 : ` ${l(t)} `.includes(` ${n} `);
17
33
  }
18
- function l(e, t, n) {
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 u = Object.freeze({
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 d(e, t, n = null) {
50
+ function m(e, t, n = null) {
35
51
  if (t.type === "start") return {
36
- ...u,
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" || c(t.transcript, n) ? e : t.final ? {
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 f(e) {
112
+ function h(e) {
97
113
  return e.muted ? !1 : e.phase === "listening";
98
114
  }
99
- function p(e) {
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, u as INITIAL_SESSION, n as INTERRUPT_MAX_MS, r as INTERRUPT_MIN_MS, e as SILENCE_SUBMIT_MS, f as isCapturing, c as isEcho, i as isSubmittable, p as orbMode, l as planReplyConsumption, a as spokenSoFar, d as voiceSessionReducer };
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 };