@burdenoff/fe-libs 2026.903.6 → 2026.903.8

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.
@@ -30,4 +30,15 @@ export { createHostedTtsEngine } from './speech/hostedTtsSpeechEngine';
30
30
  export { createRoutingSpeechEngine } from './speech/routingSpeechEngine';
31
31
  export { HOSTED_VOICES, HOSTED_TTS_TIER, hostedSupportsLanguage } from './speech/hostedVoiceCatalogue';
32
32
  export type { SpeechEngineConfig } from './speech/createSpeechEngine';
33
+ export { getSpeechEngine, resetSpeechEngine, configureSpeechEngine, readSpeechEngineConfig, } from './speech/createSpeechEngine';
34
+ export type { SpeechVoiceLike } from './speech/types';
35
+ export * from './voice/voiceStageState';
36
+ export * from './voice/voiceSession';
37
+ export * from './voice/speechVoices';
38
+ export * from './voice/voiceTranscript';
39
+ export * from './voice/speakableText';
40
+ export * from './voice/voicePreview';
41
+ export * from './voice/assistantPollSchedule';
42
+ export * from './voice/captionText';
43
+ export * from './voice/languagePair';
33
44
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,QAAQ,EACR,aAAa,EACb,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAKpB,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,4BAA4B,EAC5B,sBAAsB,EACtB,mBAAmB,EACnB,wBAAwB,E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B,EAAE,MAAM,mBAAmB,CAAC;AACzG,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAK3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvG,YAAY,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,QAAQ,EACR,aAAa,EACb,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAKpB,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,4BAA4B,EAC5B,sBAAsB,EACtB,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,wBAAwB,EACxB,yBAAyB,EACzB,aAAa,EACb,qBAAqB,EACrB,yBAAyB,EACzB,uBAAuB,EACvB,2BAA2B,GAC5B,MAAM,OAAO,CAAC;AAEf,YAAY,EACV,aAAa,EACb,mBAAmB,EACnB,WAAW,EACX,sBAAsB,EACtB,yBAAyB,EACzB,iBAAiB,EACjB,YAAY,EACZ,mBAAmB,EACnB,uBAAuB,EACvB,sBAAsB,EACtB,iBAAiB,EACjB,2BAA2B,E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,CAAC;AACvG,YAAY,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAMtE,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,6BAA6B,CAAC;AACrC,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAOtD,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC"}
@@ -1,23 +1,27 @@
1
1
  import { browserSpeechEngine as e } from "./browserSpeechEngine.js";
2
2
  import { createHostedTtsEngine as t } from "./hostedTtsSpeechEngine.js";
3
- import "./routingSpeechEngine.js";
3
+ import { createRoutingSpeechEngine as n } from "./routingSpeechEngine.js";
4
4
  //#region src/shared/assistant/speech/createSpeechEngine.ts
5
- var n, r;
6
- function i() {
7
- if (n) return {
8
- endpoint: n,
9
- getHeaders: r
5
+ var r, i;
6
+ function a(e) {
7
+ let t = e.ttsEndpoint?.trim() || void 0;
8
+ t === r && e.getHeaders === i || (r = t, i = e.getHeaders, u());
9
+ }
10
+ function o() {
11
+ if (r) return {
12
+ endpoint: r,
13
+ getHeaders: i
10
14
  };
11
15
  if (typeof window < "u") {
12
16
  let e = window.__HB_TTS_ENDPOINT__;
13
17
  if (e) return {
14
18
  endpoint: e,
15
- getHeaders: r
19
+ getHeaders: i
16
20
  };
17
21
  }
18
22
  return { endpoint: (void 0)?.trim() || null };
19
23
  }
20
- function a(n = i()) {
24
+ function s(n = o()) {
21
25
  return {
22
26
  device: e,
23
27
  hosted: n.endpoint ? t({
@@ -27,5 +31,12 @@ function a(n = i()) {
27
31
  }) : null
28
32
  };
29
33
  }
34
+ var c = null;
35
+ function l() {
36
+ return c ||= n(s()), c;
37
+ }
38
+ function u() {
39
+ c = null;
40
+ }
30
41
  //#endregion
31
- export { a as createSpeechEngines };
42
+ export { a as configureSpeechEngine, s as createSpeechEngines, l as getSpeechEngine, o as readSpeechEngineConfig, u as resetSpeechEngine };
@@ -0,0 +1,7 @@
1
+ //#region src/shared/assistant/voice/assistantPollSchedule.ts
2
+ var e = 600, t = 1e3, n = 1500, r = 6e3, i = 2e4;
3
+ function a(e) {
4
+ return e < 6e3 ? 600 : e < 2e4 ? t : n;
5
+ }
6
+ //#endregion
7
+ export { e as POLL_FAST_MS, r as POLL_FAST_UNTIL_MS, n as POLL_SLOW_MS, t as POLL_STEADY_MS, i as POLL_STEADY_UNTIL_MS, a as pollDelayMs };
@@ -0,0 +1,314 @@
1
+ //#region src/shared/assistant/voice/speakableText.ts
2
+ var e = {
3
+ codeBlock: "Code block",
4
+ image: "image",
5
+ link: "link",
6
+ largeTable: "Table with {{rows}} rows and {{columns}} columns",
7
+ truncated: "The rest of this message is not read aloud",
8
+ nestedItem: "Sub-item {{ordinal}}",
9
+ emailAt: "at",
10
+ emailDot: "dot"
11
+ }, t = 3, n = 8e3, r = 180, i = 40, a = /^\s{0,3}(?:`{3,}|~{3,})/, o = /^\s{0,3}#{1,6}\s+(.*)$/, s = /^\s{0,3}([-*_])(?:\s*\1){2,}\s*$/, c = /^\s{0,3}(?:>\s?)+/, l = /^(\s*)(?:[-*+]|(\d{1,9})[.)])\s+/, u = /^\[[ xX]\]\s*/, d = /[.!?…⋯:;。!?;.।॥۔؟؛]$/, f = /^\s{0,3}=+\s*$/, p = /^(?: {4}|\t)/;
12
+ function m(e, t) {
13
+ return Object.entries(t).reduce((e, [t, n]) => e.replace(RegExp(`\\{\\{${t}\\}\\}`, "g"), String(n)), e);
14
+ }
15
+ function h(e) {
16
+ let t = e.trim();
17
+ return t.includes("|") && t.includes("-") && /^[\s:|-]+$/.test(t);
18
+ }
19
+ function g(e) {
20
+ let t = e.trim().replace(/^\|/, "").replace(/\|$/, ""), n = [], r = "";
21
+ for (let e = 0; e < t.length; e += 1) {
22
+ let i = t[e];
23
+ if (i === "\\" && t[e + 1] === "|") {
24
+ r += "|", e += 1;
25
+ continue;
26
+ }
27
+ if (i === "|") {
28
+ n.push(r), r = "";
29
+ continue;
30
+ }
31
+ r += i;
32
+ }
33
+ return n.push(r), n.map((e) => e.trim());
34
+ }
35
+ var _ = {
36
+ "&amp;": " and ",
37
+ "&lt;": " less than ",
38
+ "&gt;": " greater than ",
39
+ "&quot;": "\"",
40
+ "&#39;": "'",
41
+ "&apos;": "'",
42
+ "&nbsp;": " "
43
+ }, v = "[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(?:\\.[A-Za-z0-9-]+)+", y = RegExp(`<(?:mailto:)?(${v})>`, "g"), b = RegExp(`\\bmailto:(${v})`, "g"), x = new RegExp(v, "g");
44
+ function S(e, t = "at", n = "dot") {
45
+ return e.replace(/@/g, ` ${t} `).replace(/\./g, ` ${n} `).replace(/\s+/g, " ").trim();
46
+ }
47
+ function C(e, t) {
48
+ let n = e;
49
+ n = n.replace(/!\[([^\]]*)\]\([^)]*\)/g, (e, n) => n.trim() || ` ${t.image} `), n = n.replace(/\[([^\]]*)\]\([^)]*\)/g, (e, n) => n.trim() || ` ${t.link} `), n = n.replace(/\[([^\]]*)\]\[[^\]]*\]/g, (e, n) => n.trim() || ` ${t.link} `), n = n.replace(/<https?:\/\/[^>\s]+>/g, ` ${t.link} `), n = n.replace(/\bhttps?:\/\/\S+/g, ` ${t.link} `), n = n.replace(y, (e, n) => ` ${S(n, t.emailAt, t.emailDot)} `), n = n.replace(b, (e, n) => ` ${S(n, t.emailAt, t.emailDot)} `), n = n.replace(x, (e) => ` ${S(e, t.emailAt, t.emailDot)} `), n = n.replace(/`+([^`]*)`+/g, (e, t) => t), n = n.replace(/<\/?[a-zA-Z][^>]*>/g, " ");
50
+ for (let [e, t] of Object.entries(_)) n = n.split(e).join(t);
51
+ return n = n.replace(/(\*\*\*|___)(\S(?:[\s\S]*?\S)?)\1/g, "$2"), n = n.replace(/(\*\*|__)(\S(?:[\s\S]*?\S)?)\1/g, "$2"), n = n.replace(/~~(\S(?:[\s\S]*?\S)?)~~/g, "$1"), n = n.replace(/(^|[\s([{"'])\*(\S(?:[\s\S]*?\S)?)\*(?=$|[\s)\]}"'.,!?;:])/g, "$1$2"), n = n.replace(/(^|[\s([{"'])_(\S(?:[\s\S]*?\S)?)_(?=$|[\s)\]}"'.,!?;:])/g, "$1$2"), n = n.replace(/[\p{Extended_Pictographic}\uFE0F\u200D]/gu, " "), n = n.replace(/[•·▪▫◦‣⁃∙●○■□▶▸►➤➜→←↑↓⇒⇔★☆⭐✦✧✓✔✗✘✕✖]/gu, " "), n = n.replace(/(\d)?\s*[—–―]\s*(\d)?/g, (e, t, n) => t !== void 0 && n !== void 0 ? e : `${t ?? ""}, ${n ?? ""}`), n = n.replace(/\*{2,}/g, ""), n.replace(/\s+/g, " ").replace(/\s+([.,!?;:)\]}])/g, "$1").replace(/([([{])\s+/g, "$1").trim();
52
+ }
53
+ function w(e) {
54
+ let t = e.trim();
55
+ return t ? d.test(t) ? t : `${t}.` : "";
56
+ }
57
+ function T(e, t, n) {
58
+ if (e.length <= t) return e;
59
+ let r = e.slice(0, t), i = Math.max(r.lastIndexOf(". "), r.lastIndexOf("\n")), a = r.lastIndexOf(" "), o = i > t * .5 ? i + 1 : a > 0 ? a : t;
60
+ return `${r.slice(0, o).trim()}\n${n}`;
61
+ }
62
+ function E(e) {
63
+ let t = 0;
64
+ for (let n of e) t += n === " " ? 4 : 1;
65
+ return t;
66
+ }
67
+ function D(e, t) {
68
+ let n = e[e.length - 1];
69
+ if (!n?.ordinal) return "";
70
+ if (e.length === 1) return `${n.ordinal}. `;
71
+ let r = e.map((e) => e.ordinal);
72
+ return r.every((e) => !!e) ? `${r.join(".")}. ` : `${m(t.nestedItem, { ordinal: n.ordinal })}. `;
73
+ }
74
+ function O(t, n = {}) {
75
+ let r = {
76
+ ...e,
77
+ ...n.labels
78
+ }, i = n.maxChars ?? 8e3, d = n.maxSpokenTableRows ?? 3;
79
+ if (!t) return "";
80
+ let _ = t.replace(/\r\n?/g, "\n").split("\n"), v = [], y = [], b = 0;
81
+ for (; b < _.length;) {
82
+ let e = _[b].replace(c, ""), t = b === 0 || !_[b - 1].replace(c, "").trim();
83
+ if (a.test(e)) {
84
+ for (b += 1; b < _.length && !a.test(_[b].replace(c, ""));) b += 1;
85
+ b += 1, v.push(w(r.codeBlock));
86
+ continue;
87
+ }
88
+ if (t && y.length === 0 && e.trim() && p.test(e)) {
89
+ for (b += 1; b < _.length;) {
90
+ let e = _[b].replace(c, "");
91
+ if (e.trim() && p.test(e)) {
92
+ b += 1;
93
+ continue;
94
+ }
95
+ if (e.trim()) break;
96
+ let t = b;
97
+ for (; t < _.length && !_[t].replace(c, "").trim();) t += 1;
98
+ let n = t < _.length ? _[t].replace(c, "") : "";
99
+ if (!n.trim() || !p.test(n)) break;
100
+ b = t;
101
+ }
102
+ v.push(w(r.codeBlock));
103
+ continue;
104
+ }
105
+ if (s.test(e)) {
106
+ b += 1;
107
+ continue;
108
+ }
109
+ if (f.test(e)) {
110
+ b += 1;
111
+ continue;
112
+ }
113
+ let n = b + 1 < _.length ? _[b + 1].replace(c, "") : "";
114
+ if (e.includes("|") && h(n)) {
115
+ y.length = 0;
116
+ let t = g(e).map((e) => C(e, r));
117
+ b += 2;
118
+ let n = [];
119
+ for (; b < _.length;) {
120
+ let e = _[b].replace(c, "");
121
+ if (!e.includes("|") || !e.trim()) break;
122
+ n.push(g(e).map((e) => C(e, r))), b += 1;
123
+ }
124
+ if (n.length > d) v.push(w(m(r.largeTable, {
125
+ rows: n.length,
126
+ columns: t.length
127
+ })));
128
+ else for (let e of n) {
129
+ let n = e.map((e, n) => {
130
+ if (!e) return "";
131
+ let r = t[n];
132
+ return r ? `${r}: ${e}` : e;
133
+ }).filter(Boolean);
134
+ n.length && v.push(w(n.join(", ")));
135
+ }
136
+ continue;
137
+ }
138
+ if (b += 1, !e.trim()) continue;
139
+ let i = o.exec(e);
140
+ if (i) {
141
+ y.length = 0;
142
+ let e = C(i[1].replace(/\s+#+\s*$/, ""), r);
143
+ e && v.push(w(e));
144
+ continue;
145
+ }
146
+ let x = l.exec(e), S = e, T = "";
147
+ if (x) {
148
+ S = e.slice(x[0].length).replace(u, "");
149
+ let t = E(x[1]);
150
+ for (; y.length > 0 && y[y.length - 1].indent >= t;) y.pop();
151
+ y.push({
152
+ indent: t,
153
+ ordinal: x[2] ?? null
154
+ }), T = D(y, r);
155
+ } else /^\s/.test(e) || (y.length = 0);
156
+ if (!x && f.test(n)) {
157
+ y.length = 0, b += 1;
158
+ let t = C(e, r);
159
+ t && v.push(w(t));
160
+ continue;
161
+ }
162
+ let O = C(S, r);
163
+ O && v.push(w(`${T}${O}`));
164
+ }
165
+ return T(v.join("\n").replace(/\n{2,}/g, "\n").trim(), i, w(r.truncated));
166
+ }
167
+ var k = new Set([
168
+ ".",
169
+ "!",
170
+ "?"
171
+ ]), A = new Set([
172
+ "。",
173
+ "!",
174
+ "?",
175
+ ";",
176
+ ".",
177
+ "。",
178
+ "…",
179
+ "⋯",
180
+ "।",
181
+ "॥",
182
+ "۔",
183
+ "؟",
184
+ "؛"
185
+ ]), j = new Set([
186
+ "\"",
187
+ "'",
188
+ ")",
189
+ "]",
190
+ "}",
191
+ "»",
192
+ "”",
193
+ "’",
194
+ "〉",
195
+ "》",
196
+ "」",
197
+ "』",
198
+ "】",
199
+ ")"
200
+ ]), M = new Set(/* @__PURE__ */ "i.e,e.g,etc,approx,vs,cf,viz,al,est,dept,fig,figs,ref,min,max,avg,qty,temp,mr,mrs,ms,dr,prof,sr,jr,st,inc,ltd,co,corp,univ,ca,kg,mg,gm,ha,cm,mm,km,ml,lb,oz,sq,hrs,wk,yr,mo,vol,pp".split(",")), N = new Set([
201
+ "no",
202
+ "nos",
203
+ "p",
204
+ "ch",
205
+ "sec",
206
+ "art"
207
+ ]), P = /^\d+(?:\.\d+)*$/, F = /^[A-Za-z]$/;
208
+ function I(e, t, n) {
209
+ for (let r = t; r < n; r += 1) if (A.has(e[r])) return !0;
210
+ if (n < e.length && !/\s/.test(e[n])) return !1;
211
+ if (e[t] !== ".") return !0;
212
+ let r = e.slice(0, t), i = /(\S+)$/.exec(r)?.[1] ?? "";
213
+ if (!i) return !0;
214
+ if (P.test(i) && !r.slice(0, r.length - i.length).trim()) return !1;
215
+ let a = i.toLowerCase();
216
+ return F.test(i) || M.has(a) ? !1 : N.has(a) ? !/^\s*\d/.test(e.slice(n)) : !0;
217
+ }
218
+ function L(e) {
219
+ let t = [];
220
+ for (let n of e.split("\n")) {
221
+ let e = n.trim();
222
+ if (!e) continue;
223
+ let r = 0, i = 0;
224
+ for (; i < e.length;) {
225
+ let n = e[i];
226
+ if (!k.has(n) && !A.has(n)) {
227
+ i += 1;
228
+ continue;
229
+ }
230
+ let a = i;
231
+ for (; a < e.length && (k.has(e[a]) || A.has(e[a]));) a += 1;
232
+ for (; a < e.length && j.has(e[a]);) a += 1;
233
+ if (I(e, i, a)) {
234
+ let n = e.slice(r, a).trim();
235
+ n && t.push(n), r = a;
236
+ }
237
+ i = a;
238
+ }
239
+ let a = e.slice(r).trim();
240
+ a && t.push(a);
241
+ }
242
+ return t;
243
+ }
244
+ var R = /[\u3040-\u30ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff\uff66-\uff9f]/, z = /[\u3000-\u303f\u3040-\u30ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff\uff01-\uff9f]/, B = /[、,,;;::。!?!?]/, V = /[A-Za-z0-9][A-Za-z0-9._,:%/+-]*[A-Za-z0-9%]|[\s\S]/gu;
245
+ function H(e) {
246
+ return R.test(e);
247
+ }
248
+ function U(e, t) {
249
+ let n = `${e.slice(-1)}${t.slice(0, 1)}`;
250
+ return z.test(n) ? `${e}${t}` : `${e} ${t}`;
251
+ }
252
+ function W(e, t) {
253
+ let n = t.trim();
254
+ n && e.push(n);
255
+ }
256
+ function G(e, t) {
257
+ let n = [], r = "", i = -1;
258
+ for (let a of e.match(V) ?? []) {
259
+ if (r.length + a.length > t && r.trim()) {
260
+ if (i > 0 && i < r.length && i >= t * .4) {
261
+ W(n, r.slice(0, i));
262
+ let e = r.slice(i);
263
+ e.trim().length + a.length > t ? (W(n, e), r = "") : r = e;
264
+ } else W(n, r), r = "";
265
+ i = -1;
266
+ }
267
+ if (a.length > t) {
268
+ W(n, r), r = "", i = -1;
269
+ for (let e = 0; e < a.length; e += t) n.push(a.slice(e, e + t));
270
+ continue;
271
+ }
272
+ r += a, B.test(a) && (i = r.length);
273
+ }
274
+ return W(n, r), n;
275
+ }
276
+ function K(e, t) {
277
+ if (H(e)) return G(e, t);
278
+ let n = [], r = "";
279
+ for (let i of e.split(/\s+/)) {
280
+ if (i.length > t) {
281
+ r &&= (n.push(r), "");
282
+ for (let e = 0; e < i.length; e += t) n.push(i.slice(e, e + t));
283
+ continue;
284
+ }
285
+ r ? r.length + 1 + i.length <= t ? r = `${r} ${i}` : (n.push(r), r = i) : r = i;
286
+ }
287
+ return r && n.push(r), n;
288
+ }
289
+ function q(e, t = 180, n = 40) {
290
+ let r = Math.max(1, t), i = Math.max(1, Math.min(n, r)), a = [], o = "", s = r;
291
+ for (let t of L(e)) {
292
+ let e = H(t) ? i : r;
293
+ if (t.length > e) {
294
+ o &&= (a.push(o), ""), a.push(...K(t, e)), s = r;
295
+ continue;
296
+ }
297
+ if (!o) {
298
+ o = t, s = e;
299
+ continue;
300
+ }
301
+ let n = U(o, t), c = Math.min(s, e);
302
+ n.length <= c ? (o = n, s = c) : (a.push(o), o = t, s = e);
303
+ }
304
+ if (o && a.push(o), a.length > 1) {
305
+ let e = L(a[0]);
306
+ if (e.length > 1) {
307
+ let [t, ...n] = e;
308
+ a.splice(0, 1, t, n.reduce((e, t) => U(e, t)));
309
+ }
310
+ }
311
+ return a;
312
+ }
313
+ //#endregion
314
+ export { e as DEFAULT_SPEAKABLE_LABELS, n as MAX_SPEAKABLE_CHARS, t as MAX_SPOKEN_TABLE_ROWS, r as SPEECH_CHUNK_CHARS, i as SPEECH_CHUNK_CJK_CHARS, q as chunkForSpeech, H as containsCjk, S as speakableEmail, g as splitTableRow, O as toSpeakableText };
@@ -0,0 +1,63 @@
1
+ //#region src/shared/assistant/voice/speechVoices.ts
2
+ var e = {
3
+ en: "en-US",
4
+ es: "es-ES",
5
+ fr: "fr-FR",
6
+ de: "de-DE",
7
+ ja: "ja-JP",
8
+ zh: "zh-CN",
9
+ ta: "ta-IN",
10
+ hi: "hi-IN",
11
+ ar: "ar-SA"
12
+ };
13
+ function t(e) {
14
+ return e.trim().toLowerCase().replace(/_/g, "-");
15
+ }
16
+ function n(e) {
17
+ return t(e).split("-")[0];
18
+ }
19
+ function r(t) {
20
+ return e[t] ?? t;
21
+ }
22
+ function i(e, i) {
23
+ let o = t(r(i)), s = n(o);
24
+ if (!s) return [];
25
+ let c = e.filter((e) => n(e.lang) === s);
26
+ if (c.length === 0) return [];
27
+ let l = c.filter((e) => t(e.lang) === o);
28
+ return [...l.length > 0 ? l : c].sort((e, t) => a(t) - a(e));
29
+ }
30
+ function a(e) {
31
+ let t = e.name.toLowerCase(), n = 0;
32
+ return /premium|enhanced/.test(t) && (n += 40), /neural|natural|wavenet/.test(t) && (n += 30), /google/.test(t) && (n += 20), e.localService === !1 && (n += 10), e.default && (n += 1), n;
33
+ }
34
+ function o(e, t, n) {
35
+ let r = i(e, t);
36
+ if (r.length === 0) return null;
37
+ if (n) {
38
+ let e = r.find((e) => e.name === n);
39
+ if (e) return e;
40
+ }
41
+ return r[0] ?? null;
42
+ }
43
+ function s(e, t, n, r = !1) {
44
+ return e ? t.length === 0 ? r ? "no-voices" : "pending" : o(t, n) ? "ready" : "missing-voice" : "unsupported";
45
+ }
46
+ function c(e, t) {
47
+ let r = n(e);
48
+ if (!r) return e;
49
+ try {
50
+ return new Intl.DisplayNames([t], { type: "language" }).of(r) ?? r;
51
+ } catch {
52
+ return r;
53
+ }
54
+ }
55
+ function l(e) {
56
+ return e === "ready" ? "speak" : e === "pending" ? "wait-for-voices" : "block";
57
+ }
58
+ function u(e) {
59
+ return e === "missing-voice" || e === "no-voices";
60
+ }
61
+ var d = 2e3;
62
+ //#endregion
63
+ export { e as SPEECH_LANG, d as VOICE_LIST_TIMEOUT_MS, u as isSpeechBlocked, c as languageDisplayName, t as normalizeLangTag, n as primaryLanguageSubtag, o as selectVoiceForLocale, l as speechGate, r as speechLangForLocale, s as voiceAvailability, a as voiceQualityRank, i as voicesForLocale };
@@ -0,0 +1,27 @@
1
+ //#region src/shared/assistant/voice/voicePreview.ts
2
+ var e = {
3
+ en: "Hello! I am your HealthyBowl assistant.",
4
+ ta: "வணக்கம்! நான் உங்கள் HealthyBowl உதவியாளர்.",
5
+ hi: "नमस्ते! मैं आपका HealthyBowl सहायक हूँ।",
6
+ bn: "নমস্কার! আমি আপনার HealthyBowl সহায়ক।",
7
+ te: "నమస్కారం! నేను మీ HealthyBowl సహాయకుడిని.",
8
+ mr: "नमस्कार! मी तुमचा HealthyBowl सहाय्यक आहे.",
9
+ gu: "નમસ્તે! હું તમારો HealthyBowl સહાયક છું.",
10
+ kn: "ನಮಸ್ಕಾರ! ನಾನು ನಿಮ್ಮ HealthyBowl ಸಹಾಯಕ.",
11
+ ml: "നമസ്കാരം! ഞാൻ നിങ്ങളുടെ HealthyBowl സഹായിയാണ്.",
12
+ pa: "ਸਤ ਸ੍ਰੀ ਅਕਾਲ! ਮੈਂ ਤੁਹਾਡਾ HealthyBowl ਸਹਾਇਕ ਹਾਂ।",
13
+ ur: "السلام علیکم! میں آپ کا HealthyBowl معاون ہوں۔",
14
+ ar: "مرحبًا! أنا مساعد HealthyBowl الخاص بك.",
15
+ es: "¡Hola! Soy tu asistente de HealthyBowl.",
16
+ fr: "Bonjour ! Je suis votre assistant HealthyBowl.",
17
+ de: "Hallo! Ich bin Ihr HealthyBowl-Assistent.",
18
+ ja: "こんにちは!HealthyBowl のアシスタントです。",
19
+ zh: "你好!我是您的 HealthyBowl 助手。"
20
+ };
21
+ function t(t) {
22
+ let n = t.trim().toLowerCase().split(/[-_]/)[0];
23
+ return n && e[n] || e.en;
24
+ }
25
+ var n = Object.keys(e);
26
+ //#endregion
27
+ export { n as PREVIEW_LANGUAGES, t as voicePreviewText };
@@ -0,0 +1,108 @@
1
+ //#region src/shared/assistant/voice/voiceSession.ts
2
+ var e = 2e3, t = 800, n = 1500, r = 500;
3
+ function i(e) {
4
+ return e.trim().length > 0;
5
+ }
6
+ function a(e) {
7
+ return `${e.pending} ${e.interim}`.replace(/\s+/g, " ").trim();
8
+ }
9
+ function o(e) {
10
+ return e.toLowerCase().replace(/[^\p{L}\p{N}]+/gu, " ").trim();
11
+ }
12
+ var s = 3;
13
+ function c(e, t) {
14
+ if (!t) return !1;
15
+ let n = o(e);
16
+ return n.length === 0 ? !0 : n.split(" ").length < s ? !1 : ` ${o(t)} `.includes(` ${n} `);
17
+ }
18
+ function l(e, t, n) {
19
+ return !e || e === n ? {
20
+ claim: !1,
21
+ advance: !1
22
+ } : {
23
+ claim: !0,
24
+ advance: t === "thinking"
25
+ };
26
+ }
27
+ var u = Object.freeze({
28
+ phase: "idle",
29
+ muted: !1,
30
+ pending: "",
31
+ interim: "",
32
+ error: null
33
+ });
34
+ function d(e, t, n = null) {
35
+ if (t.type === "start") return {
36
+ ...u,
37
+ phase: "listening"
38
+ };
39
+ if (t.type === "end") return {
40
+ ...e,
41
+ phase: "ended",
42
+ pending: "",
43
+ interim: "",
44
+ error: null
45
+ };
46
+ if (e.phase === "ended") return e;
47
+ if (t.type === "fail") return {
48
+ ...e,
49
+ phase: "ended",
50
+ pending: "",
51
+ interim: "",
52
+ error: t.error
53
+ };
54
+ switch (t.type) {
55
+ case "mute": return {
56
+ ...e,
57
+ muted: t.muted,
58
+ ...t.muted ? {
59
+ pending: "",
60
+ interim: ""
61
+ } : {}
62
+ };
63
+ case "interrupt": return e.phase === "speaking" ? {
64
+ ...e,
65
+ phase: "listening",
66
+ pending: "",
67
+ interim: ""
68
+ } : e;
69
+ case "speech": return e.muted || e.phase !== "listening" || c(t.transcript, n) ? e : t.final ? {
70
+ ...e,
71
+ pending: `${e.pending} ${t.transcript}`.replace(/\s+/g, " ").trim(),
72
+ interim: ""
73
+ } : {
74
+ ...e,
75
+ interim: t.transcript
76
+ };
77
+ case "silence": return e.phase !== "listening" || e.muted || !i(a(e)) ? e : {
78
+ ...e,
79
+ phase: "thinking"
80
+ };
81
+ case "reply": return e.phase === "thinking" ? {
82
+ ...e,
83
+ phase: "speaking",
84
+ pending: "",
85
+ interim: ""
86
+ } : e;
87
+ case "speech-ended": return e.phase === "speaking" ? {
88
+ ...e,
89
+ phase: "listening",
90
+ pending: "",
91
+ interim: ""
92
+ } : e;
93
+ default: return e;
94
+ }
95
+ }
96
+ function f(e) {
97
+ return e.muted ? !1 : e.phase === "listening";
98
+ }
99
+ function p(e) {
100
+ switch (e.phase) {
101
+ case "thinking": return "thinking";
102
+ case "speaking": return "speaking";
103
+ case "listening": return e.muted ? "idle" : "listening";
104
+ default: return "idle";
105
+ }
106
+ }
107
+ //#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 };
@@ -0,0 +1,21 @@
1
+ //#region src/shared/assistant/voice/voiceStageState.ts
2
+ function e({ snapshot: e, capturing: t, interrupting: n = !1, awaitingEndpoint: r = !1 }) {
3
+ return e.error === null ? e.phase === "ended" ? "ended" : n ? "interrupting" : e.phase === "speaking" ? "speaking" : e.phase === "thinking" ? "thinking" : e.phase === "idle" || !t && !e.muted ? "connecting" : r ? "endpoint-grace" : "listening" : "mic-error";
4
+ }
5
+ function t(e) {
6
+ return e === "listening" || e === "endpoint-grace" || e === "thinking";
7
+ }
8
+ function n(e) {
9
+ return e === "speaking";
10
+ }
11
+ function r(e) {
12
+ return e === "speaking";
13
+ }
14
+ function i(e) {
15
+ return e === "listening" || e === "endpoint-grace" || e === "speaking";
16
+ }
17
+ function a(e) {
18
+ return e === "endpoint-grace";
19
+ }
20
+ //#endregion
21
+ export { r as micIsInterrupt, n as showsAssistantCaption, t as showsUserCaption, e as voiceStageState, i as waveformIsActive, a as waveformIsSettled };
@@ -12,8 +12,14 @@ import { browserSpeechEngine as L } from "./shared/assistant/speech/browserSpeec
12
12
  import { HOSTED_TTS_TIER as R, HOSTED_VOICES as z, hostedSupportsLanguage as B } from "./shared/assistant/speech/hostedVoiceCatalogue.js";
13
13
  import { createHostedTtsEngine as V } from "./shared/assistant/speech/hostedTtsSpeechEngine.js";
14
14
  import { createRoutingSpeechEngine as H } from "./shared/assistant/speech/routingSpeechEngine.js";
15
- import { createSpeechEngines as U } from "./shared/assistant/speech/createSpeechEngine.js";
16
- import { buildContinuedFromVoiceNote as W, buildVoiceTranscriptMarkdown as G, voiceTranscriptFilename as K } from "./shared/assistant/voice/voiceTranscript.js";
17
- import { ASSISTANT_LANGUAGES as q, findAssistantLanguage as J, resolveAssistantLanguage as Y } from "./shared/assistant/voice/languages.js";
18
- import { replyFollowsInput as X, resolveLanguagePair as Z } from "./shared/assistant/voice/languagePair.js";
19
- export { q as ASSISTANT_LANGUAGES, v as AssistantRuntimeManager, R as HOSTED_TTS_TIER, z as HOSTED_VOICES, L as browserSpeechEngine, W as buildContinuedFromVoiceNote, y as buildProgress, n as buildPromptRequestBody, G as buildVoiceTranscriptMarkdown, D as chatTurns, r as checkAssistantAiCredits, i as createAssistantSandbox, a as createAssistantSession, V as createHostedTtsEngine, H as createRoutingSpeechEngine, T as createSandboxAssistantTransport, U as createSpeechEngines, o as downloadAssistantArtifact, s as extendAssistantSandboxTTL, J as findAssistantLanguage, c as findExistingSandbox, F as findPendingWrite, l as getAssistantArtifacts, b as getAssistantMedia, u as getAssistantMessages, d as getAssistantSession, f as getAssistantStreamAccess, O as groupBySession, k as groupConsecutiveBySession, B as hostedSupportsLanguage, t as isQuotaExhaustedError, x as isRecoverable, A as isVoiceTurn, S as mapSessionToHistory, C as mergeMessagesById, I as parseConfirmationRefusal, X as replyFollowsInput, p as reportAssistantAiTokenUsage, Y as resolveAssistantLanguage, Z as resolveLanguagePair, w as sanitize, m as sendAssistantPromptAsync, h as sendHeartbeat, P as toCaptionText, E as useSandboxAssistantTransport, e as useVoiceInput, j as voiceMarker, M as voiceSessionIdOf, K as voiceTranscriptFilename, N as voiceTurnsOnly, g as waitForAssistantServiceReady, _ as waitForSandboxRunning };
15
+ import { configureSpeechEngine as U, createSpeechEngines as W, getSpeechEngine as G, readSpeechEngineConfig as K, resetSpeechEngine as q } from "./shared/assistant/speech/createSpeechEngine.js";
16
+ import { buildContinuedFromVoiceNote as J, buildVoiceTranscriptMarkdown as Y, voiceTranscriptFilename as X } from "./shared/assistant/voice/voiceTranscript.js";
17
+ import { ASSISTANT_LANGUAGES as Z, findAssistantLanguage as Q, resolveAssistantLanguage as $ } from "./shared/assistant/voice/languages.js";
18
+ import { replyFollowsInput as ee, resolveLanguagePair as te } from "./shared/assistant/voice/languagePair.js";
19
+ import { micIsInterrupt as ne, showsAssistantCaption as re, showsUserCaption as ie, voiceStageState as ae, waveformIsActive as oe, waveformIsSettled as se } from "./shared/assistant/voice/voiceStageState.js";
20
+ import { ENDPOINT_GRACE_MS as ce, INITIAL_SESSION as le, INTERRUPT_MAX_MS as ue, INTERRUPT_MIN_MS as de, SILENCE_SUBMIT_MS as fe, isCapturing as pe, isEcho as me, isSubmittable as he, orbMode as ge, planReplyConsumption as _e, spokenSoFar as ve, voiceSessionReducer as ye } from "./shared/assistant/voice/voiceSession.js";
21
+ import { SPEECH_LANG as be, VOICE_LIST_TIMEOUT_MS as xe, isSpeechBlocked as Se, languageDisplayName as Ce, normalizeLangTag as we, primaryLanguageSubtag as Te, selectVoiceForLocale as Ee, speechGate as De, speechLangForLocale as Oe, voiceAvailability as ke, voiceQualityRank as Ae, voicesForLocale as je } from "./shared/assistant/voice/speechVoices.js";
22
+ import { DEFAULT_SPEAKABLE_LABELS as Me, MAX_SPEAKABLE_CHARS as Ne, MAX_SPOKEN_TABLE_ROWS as Pe, SPEECH_CHUNK_CHARS as Fe, SPEECH_CHUNK_CJK_CHARS as Ie, chunkForSpeech as Le, containsCjk as Re, speakableEmail as ze, splitTableRow as Be, toSpeakableText as Ve } from "./shared/assistant/voice/speakableText.js";
23
+ import { PREVIEW_LANGUAGES as He, voicePreviewText as Ue } from "./shared/assistant/voice/voicePreview.js";
24
+ import { POLL_FAST_MS as We, POLL_FAST_UNTIL_MS as Ge, POLL_SLOW_MS as Ke, POLL_STEADY_MS as qe, POLL_STEADY_UNTIL_MS as Je, pollDelayMs as Ye } from "./shared/assistant/voice/assistantPollSchedule.js";
25
+ export { Z as ASSISTANT_LANGUAGES, v as AssistantRuntimeManager, Me as DEFAULT_SPEAKABLE_LABELS, ce as ENDPOINT_GRACE_MS, R as HOSTED_TTS_TIER, z as HOSTED_VOICES, le as INITIAL_SESSION, ue as INTERRUPT_MAX_MS, de as INTERRUPT_MIN_MS, Ne as MAX_SPEAKABLE_CHARS, Pe as MAX_SPOKEN_TABLE_ROWS, We as POLL_FAST_MS, Ge as POLL_FAST_UNTIL_MS, Ke as POLL_SLOW_MS, qe as POLL_STEADY_MS, Je as POLL_STEADY_UNTIL_MS, He as PREVIEW_LANGUAGES, fe as SILENCE_SUBMIT_MS, Fe as SPEECH_CHUNK_CHARS, Ie as SPEECH_CHUNK_CJK_CHARS, be as SPEECH_LANG, xe as VOICE_LIST_TIMEOUT_MS, L as browserSpeechEngine, J as buildContinuedFromVoiceNote, y as buildProgress, n as buildPromptRequestBody, Y as buildVoiceTranscriptMarkdown, D as chatTurns, r as checkAssistantAiCredits, Le as chunkForSpeech, U as configureSpeechEngine, Re as containsCjk, i as createAssistantSandbox, a as createAssistantSession, V as createHostedTtsEngine, H as createRoutingSpeechEngine, T as createSandboxAssistantTransport, W as createSpeechEngines, o as downloadAssistantArtifact, s as extendAssistantSandboxTTL, Q as findAssistantLanguage, c as findExistingSandbox, F as findPendingWrite, l as getAssistantArtifacts, b as getAssistantMedia, u as getAssistantMessages, d as getAssistantSession, f as getAssistantStreamAccess, G as getSpeechEngine, O as groupBySession, k as groupConsecutiveBySession, B as hostedSupportsLanguage, pe as isCapturing, me as isEcho, t as isQuotaExhaustedError, x as isRecoverable, Se as isSpeechBlocked, he as isSubmittable, A as isVoiceTurn, Ce as languageDisplayName, S as mapSessionToHistory, C as mergeMessagesById, ne as micIsInterrupt, we as normalizeLangTag, ge as orbMode, I as parseConfirmationRefusal, _e as planReplyConsumption, Ye as pollDelayMs, Te as primaryLanguageSubtag, K as readSpeechEngineConfig, ee as replyFollowsInput, p as reportAssistantAiTokenUsage, q as resetSpeechEngine, $ as resolveAssistantLanguage, te as resolveLanguagePair, w as sanitize, Ee as selectVoiceForLocale, m as sendAssistantPromptAsync, h as sendHeartbeat, re as showsAssistantCaption, ie as showsUserCaption, ze as speakableEmail, De as speechGate, Oe as speechLangForLocale, Be as splitTableRow, ve as spokenSoFar, P as toCaptionText, Ve as toSpeakableText, E as useSandboxAssistantTransport, e as useVoiceInput, ke as voiceAvailability, j as voiceMarker, Ue as voicePreviewText, Ae as voiceQualityRank, M as voiceSessionIdOf, ye as voiceSessionReducer, ae as voiceStageState, X as voiceTranscriptFilename, N as voiceTurnsOnly, je as voicesForLocale, g as waitForAssistantServiceReady, _ as waitForSandboxRunning, oe as waveformIsActive, se as waveformIsSettled };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/fe-libs",
3
- "version": "2026.903.6",
3
+ "version": "2026.903.8",
4
4
  "description": "Burdenoff frontend primitives and domain libraries",
5
5
  "type": "module",
6
6
  "bin": {