@burdenoff/fe-libs 2026.1003.1 → 2026.1003.2

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 (27) hide show
  1. package/dist/shared/assistant/index.d.ts +1 -0
  2. package/dist/shared/assistant/index.d.ts.map +1 -1
  3. package/dist/shared/assistant/prewarm.d.ts +71 -0
  4. package/dist/shared/assistant/prewarm.d.ts.map +1 -1
  5. package/dist/shared/assistant/prewarm.js +49 -2
  6. package/dist/shared/assistant/speech/speechFeed.d.ts +63 -0
  7. package/dist/shared/assistant/speech/speechFeed.d.ts.map +1 -0
  8. package/dist/shared/assistant/speech/speechFeed.js +40 -0
  9. package/dist/shared/assistant/turnTimeline.d.ts +22 -2
  10. package/dist/shared/assistant/turnTimeline.d.ts.map +1 -1
  11. package/dist/shared/assistant/turnTimeline.js +18 -1
  12. package/dist/shared/assistant/turnTimingReport.d.ts.map +1 -1
  13. package/dist/shared/assistant/turnTimingReport.js +5 -4
  14. package/dist/shared/assistant/ui/AssistantChatArea.d.ts.map +1 -1
  15. package/dist/shared/assistant/ui/AssistantChatArea.js +981 -931
  16. package/dist/shared/assistant/ui/AssistantSpeechProvider.d.ts.map +1 -1
  17. package/dist/shared/assistant/ui/AssistantSpeechProvider.js +198 -169
  18. package/dist/shared/assistant/ui/useVoiceSession.d.ts.map +1 -1
  19. package/dist/shared/assistant/ui/useVoiceSession.js +165 -153
  20. package/dist/shared/assistant/voice/speakableText.d.ts +16 -1
  21. package/dist/shared/assistant/voice/speakableText.d.ts.map +1 -1
  22. package/dist/shared/assistant/voice/speakableText.js +116 -102
  23. package/dist/shared/assistant/voice/voiceSession.d.ts +12 -0
  24. package/dist/shared/assistant/voice/voiceSession.d.ts.map +1 -1
  25. package/dist/shared/assistant/voice/voiceSession.js +6 -0
  26. package/dist/shared-assistant.js +151 -150
  27. package/package.json +1 -1
@@ -8,15 +8,15 @@ var e = {
8
8
  nestedItem: "Sub-item {{ordinal}}",
9
9
  emailAt: "at",
10
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) {
11
+ }, t = 3, n = 8e3, r = 180, i = 40, a = 110, o = 40, s = /^\s{0,3}(?:`{3,}|~{3,})/, c = /^\s{0,3}#{1,6}\s+(.*)$/, l = /^\s{0,3}([-*_])(?:\s*\1){2,}\s*$/, u = /^\s{0,3}(?:>\s?)+/, d = /^(\s*)(?:[-*+]|(\d{1,9})[.)])\s+/, f = /^\[[ xX]\]\s*/, p = /[.!?…⋯:;。!?;.।॥۔؟؛]$/, m = /^\s{0,3}=+\s*$/, h = /^(?: {4}|\t)/;
12
+ function g(e, t) {
13
13
  return Object.entries(t).reduce((e, [t, n]) => e.replace(RegExp(`\\{\\{${t}\\}\\}`, "g"), String(n)), e);
14
14
  }
15
- function h(e) {
15
+ function _(e) {
16
16
  let t = e.trim();
17
17
  return t.includes("|") && t.includes("-") && /^[\s:|-]+$/.test(t);
18
18
  }
19
- function g(e) {
19
+ function v(e) {
20
20
  let t = e.trim().replace(/^\|/, "").replace(/\|$/, ""), n = [], r = "";
21
21
  for (let e = 0; e < t.length; e += 1) {
22
22
  let i = t[e];
@@ -32,7 +32,7 @@ function g(e) {
32
32
  }
33
33
  return n.push(r), n.map((e) => e.trim());
34
34
  }
35
- var _ = {
35
+ var y = {
36
36
  "&amp;": " and ",
37
37
  "&lt;": " less than ",
38
38
  "&gt;": " greater than ",
@@ -40,89 +40,89 @@ var _ = {
40
40
  "&#39;": "'",
41
41
  "&apos;": "'",
42
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") {
43
+ }, b = "[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(?:\\.[A-Za-z0-9-]+)+", x = RegExp(`<(?:mailto:)?(${b})>`, "g"), S = RegExp(`\\bmailto:(${b})`, "g"), C = new RegExp(b, "g");
44
+ function w(e, t = "at", n = "dot") {
45
45
  return e.replace(/@/g, ` ${t} `).replace(/\./g, ` ${n} `).replace(/\s+/g, " ").trim();
46
46
  }
47
- var C = 57600, w = /[\ue121-\ue17e]/g, T = "", E = /\ue180/g, D = /[\ue100-\ue1ff]/g;
48
- function O(e, t) {
49
- let n = e.replace(D, "").replace(/\\[!-/:-@[-`{-~]|(`+)[^`]*?\1(?!`)/g, (e, t) => t ? e.replace(/\\/g, T) : e).replace(/\\([!-/:-@[-`{-~])/g, (e, t) => String.fromCharCode(C + t.charCodeAt(0)));
50
- 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, " ");
51
- for (let [e, t] of Object.entries(_)) n = n.split(e).join(t);
52
- 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().replace(w, (e) => String.fromCharCode(e.charCodeAt(0) - C)).replace(E, "\\");
47
+ var T = 57600, E = /[\ue121-\ue17e]/g, D = "", O = /\ue180/g, k = /[\ue100-\ue1ff]/g;
48
+ function A(e, t) {
49
+ let n = e.replace(k, "").replace(/\\[!-/:-@[-`{-~]|(`+)[^`]*?\1(?!`)/g, (e, t) => t ? e.replace(/\\/g, D) : e).replace(/\\([!-/:-@[-`{-~])/g, (e, t) => String.fromCharCode(T + t.charCodeAt(0)));
50
+ 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(x, (e, n) => ` ${w(n, t.emailAt, t.emailDot)} `), n = n.replace(S, (e, n) => ` ${w(n, t.emailAt, t.emailDot)} `), n = n.replace(C, (e) => ` ${w(e, t.emailAt, t.emailDot)} `), n = n.replace(/`+([^`]*)`+/g, (e, t) => t), n = n.replace(/<\/?[a-zA-Z][^>]*>/g, " ");
51
+ for (let [e, t] of Object.entries(y)) n = n.split(e).join(t);
52
+ 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().replace(E, (e) => String.fromCharCode(e.charCodeAt(0) - T)).replace(O, "\\");
53
53
  }
54
- function k(e) {
54
+ function j(e) {
55
55
  let t = e.trim();
56
- return t ? d.test(t) ? t : `${t}.` : "";
56
+ return t ? p.test(t) ? t : `${t}.` : "";
57
57
  }
58
- function A(e, t, n) {
58
+ function M(e, t, n) {
59
59
  if (e.length <= t) return e;
60
60
  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;
61
61
  return `${r.slice(0, o).trim()}\n${n}`;
62
62
  }
63
- function j(e) {
63
+ function N(e) {
64
64
  let t = 0;
65
65
  for (let n of e) t += n === " " ? 4 : 1;
66
66
  return t;
67
67
  }
68
- function M(e, t) {
68
+ function P(e, t) {
69
69
  let n = e[e.length - 1];
70
70
  if (!n?.ordinal) return "";
71
71
  if (e.length === 1) return `${n.ordinal}. `;
72
72
  let r = e.map((e) => e.ordinal);
73
- return r.every((e) => !!e) ? `${r.join(".")}. ` : `${m(t.nestedItem, { ordinal: n.ordinal })}. `;
73
+ return r.every((e) => !!e) ? `${r.join(".")}. ` : `${g(t.nestedItem, { ordinal: n.ordinal })}. `;
74
74
  }
75
- function N(t, n = {}) {
75
+ function F(t, n = {}) {
76
76
  let r = {
77
77
  ...e,
78
78
  ...n.labels
79
- }, i = n.maxChars ?? 8e3, d = n.maxSpokenTableRows ?? 3;
79
+ }, i = n.maxChars ?? 8e3, a = n.maxSpokenTableRows ?? 3;
80
80
  if (!t) return "";
81
- let _ = t.replace(/\r\n?/g, "\n").split("\n"), v = [], y = [], b = 0;
82
- for (; b < _.length;) {
83
- let e = _[b].replace(c, ""), t = b === 0 || !_[b - 1].replace(c, "").trim();
84
- if (a.test(e)) {
85
- for (b += 1; b < _.length && !a.test(_[b].replace(c, ""));) b += 1;
86
- b += 1, v.push(k(r.codeBlock));
81
+ let o = t.replace(/\r\n?/g, "\n").split("\n"), p = [], y = [], b = 0;
82
+ for (; b < o.length;) {
83
+ let e = o[b].replace(u, ""), t = b === 0 || !o[b - 1].replace(u, "").trim();
84
+ if (s.test(e)) {
85
+ for (b += 1; b < o.length && !s.test(o[b].replace(u, ""));) b += 1;
86
+ b += 1, p.push(j(r.codeBlock));
87
87
  continue;
88
88
  }
89
- if (t && y.length === 0 && e.trim() && p.test(e)) {
90
- for (b += 1; b < _.length;) {
91
- let e = _[b].replace(c, "");
92
- if (e.trim() && p.test(e)) {
89
+ if (t && y.length === 0 && e.trim() && h.test(e)) {
90
+ for (b += 1; b < o.length;) {
91
+ let e = o[b].replace(u, "");
92
+ if (e.trim() && h.test(e)) {
93
93
  b += 1;
94
94
  continue;
95
95
  }
96
96
  if (e.trim()) break;
97
97
  let t = b;
98
- for (; t < _.length && !_[t].replace(c, "").trim();) t += 1;
99
- let n = t < _.length ? _[t].replace(c, "") : "";
100
- if (!n.trim() || !p.test(n)) break;
98
+ for (; t < o.length && !o[t].replace(u, "").trim();) t += 1;
99
+ let n = t < o.length ? o[t].replace(u, "") : "";
100
+ if (!n.trim() || !h.test(n)) break;
101
101
  b = t;
102
102
  }
103
- v.push(k(r.codeBlock));
103
+ p.push(j(r.codeBlock));
104
104
  continue;
105
105
  }
106
- if (s.test(e)) {
106
+ if (l.test(e)) {
107
107
  b += 1;
108
108
  continue;
109
109
  }
110
- if (f.test(e)) {
110
+ if (m.test(e)) {
111
111
  b += 1;
112
112
  continue;
113
113
  }
114
- let n = b + 1 < _.length ? _[b + 1].replace(c, "") : "";
115
- if (e.includes("|") && h(n)) {
114
+ let n = b + 1 < o.length ? o[b + 1].replace(u, "") : "";
115
+ if (e.includes("|") && _(n)) {
116
116
  y.length = 0;
117
- let t = g(e).map((e) => O(e, r));
117
+ let t = v(e).map((e) => A(e, r));
118
118
  b += 2;
119
119
  let n = [];
120
- for (; b < _.length;) {
121
- let e = _[b].replace(c, "");
120
+ for (; b < o.length;) {
121
+ let e = o[b].replace(u, "");
122
122
  if (!e.includes("|") || !e.trim()) break;
123
- n.push(g(e).map((e) => O(e, r))), b += 1;
123
+ n.push(v(e).map((e) => A(e, r))), b += 1;
124
124
  }
125
- if (n.length > d) v.push(k(m(r.largeTable, {
125
+ if (n.length > a) p.push(j(g(r.largeTable, {
126
126
  rows: n.length,
127
127
  columns: t.length
128
128
  })));
@@ -132,44 +132,44 @@ function N(t, n = {}) {
132
132
  let r = t[n];
133
133
  return r ? `${r}: ${e}` : e;
134
134
  }).filter(Boolean);
135
- n.length && v.push(k(n.join(", ")));
135
+ n.length && p.push(j(n.join(", ")));
136
136
  }
137
137
  continue;
138
138
  }
139
139
  if (b += 1, !e.trim()) continue;
140
- let i = o.exec(e);
140
+ let i = c.exec(e);
141
141
  if (i) {
142
142
  y.length = 0;
143
- let e = O(i[1].replace(/\s+#+\s*$/, ""), r);
144
- e && v.push(k(e));
143
+ let e = A(i[1].replace(/\s+#+\s*$/, ""), r);
144
+ e && p.push(j(e));
145
145
  continue;
146
146
  }
147
- let x = l.exec(e), S = e, C = "";
147
+ let x = d.exec(e), S = e, C = "";
148
148
  if (x) {
149
- S = e.slice(x[0].length).replace(u, "");
150
- let t = j(x[1]);
149
+ S = e.slice(x[0].length).replace(f, "");
150
+ let t = N(x[1]);
151
151
  for (; y.length > 0 && y[y.length - 1].indent >= t;) y.pop();
152
152
  y.push({
153
153
  indent: t,
154
154
  ordinal: x[2] ?? null
155
- }), C = M(y, r);
155
+ }), C = P(y, r);
156
156
  } else /^\s/.test(e) || (y.length = 0);
157
- if (!x && f.test(n)) {
157
+ if (!x && m.test(n)) {
158
158
  y.length = 0, b += 1;
159
- let t = O(e, r);
160
- t && v.push(k(t));
159
+ let t = A(e, r);
160
+ t && p.push(j(t));
161
161
  continue;
162
162
  }
163
- let w = O(S, r);
164
- w && v.push(k(`${C}${w}`));
163
+ let w = A(S, r);
164
+ w && p.push(j(`${C}${w}`));
165
165
  }
166
- return A(v.join("\n").replace(/\n{2,}/g, "\n").trim(), i, k(r.truncated));
166
+ return M(p.join("\n").replace(/\n{2,}/g, "\n").trim(), i, j(r.truncated));
167
167
  }
168
- var P = new Set([
168
+ var I = new Set([
169
169
  ".",
170
170
  "!",
171
171
  "?"
172
- ]), F = new Set([
172
+ ]), L = new Set([
173
173
  "。",
174
174
  "!",
175
175
  "?",
@@ -183,7 +183,7 @@ var P = new Set([
183
183
  "۔",
184
184
  "؟",
185
185
  "؛"
186
- ]), I = new Set([
186
+ ]), R = new Set([
187
187
  "\"",
188
188
  "'",
189
189
  ")",
@@ -198,25 +198,25 @@ var P = new Set([
198
198
  "』",
199
199
  "】",
200
200
  ")"
201
- ]), L = 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(",")), R = new Set([
201
+ ]), z = 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(",")), B = new Set([
202
202
  "no",
203
203
  "nos",
204
204
  "p",
205
205
  "ch",
206
206
  "sec",
207
207
  "art"
208
- ]), z = /^\d+(?:\.\d+)*$/, B = /^[A-Za-z]$/;
209
- function V(e, t, n) {
210
- for (let r = t; r < n; r += 1) if (F.has(e[r])) return !0;
208
+ ]), V = /^\d+(?:\.\d+)*$/, H = /^[A-Za-z]$/;
209
+ function U(e, t, n) {
210
+ for (let r = t; r < n; r += 1) if (L.has(e[r])) return !0;
211
211
  if (n < e.length && !/\s/.test(e[n])) return !1;
212
212
  if (e[t] !== ".") return !0;
213
213
  let r = e.slice(0, t), i = /(\S+)$/.exec(r)?.[1] ?? "";
214
214
  if (!i) return !0;
215
- if (z.test(i) && !r.slice(0, r.length - i.length).trim()) return !1;
215
+ if (V.test(i) && !r.slice(0, r.length - i.length).trim()) return !1;
216
216
  let a = i.toLowerCase();
217
- return B.test(i) || L.has(a) ? !1 : R.has(a) ? !/^\s*\d/.test(e.slice(n)) : !0;
217
+ return H.test(i) || z.has(a) ? !1 : B.has(a) ? !/^\s*\d/.test(e.slice(n)) : !0;
218
218
  }
219
- function H(e) {
219
+ function W(e) {
220
220
  let t = [];
221
221
  for (let n of e.split("\n")) {
222
222
  let e = n.trim();
@@ -224,14 +224,14 @@ function H(e) {
224
224
  let r = 0, i = 0;
225
225
  for (; i < e.length;) {
226
226
  let n = e[i];
227
- if (!P.has(n) && !F.has(n)) {
227
+ if (!I.has(n) && !L.has(n)) {
228
228
  i += 1;
229
229
  continue;
230
230
  }
231
231
  let a = i;
232
- for (; a < e.length && (P.has(e[a]) || F.has(e[a]));) a += 1;
233
- for (; a < e.length && I.has(e[a]);) a += 1;
234
- if (V(e, i, a)) {
232
+ for (; a < e.length && (I.has(e[a]) || L.has(e[a]));) a += 1;
233
+ for (; a < e.length && R.has(e[a]);) a += 1;
234
+ if (U(e, i, a)) {
235
235
  let n = e.slice(r, a).trim();
236
236
  n && t.push(n), r = a;
237
237
  }
@@ -242,40 +242,40 @@ function H(e) {
242
242
  }
243
243
  return t;
244
244
  }
245
- var U = /[\u3040-\u30ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff\uff66-\uff9f]/, W = /[\u3000-\u303f\u3040-\u30ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff\uff01-\uff9f]/, G = /[、,,;;::。!?!?]/, K = /[A-Za-z0-9][A-Za-z0-9._,:%/+-]*[A-Za-z0-9%]|[\s\S]/gu;
246
- function q(e) {
247
- return U.test(e);
245
+ var G = /[\u3040-\u30ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff\uff66-\uff9f]/, K = /[\u3000-\u303f\u3040-\u30ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff\uff01-\uff9f]/, q = /[、,,;;::。!?!?]/, J = /[A-Za-z0-9][A-Za-z0-9._,:%/+-]*[A-Za-z0-9%]|[\s\S]/gu;
246
+ function Y(e) {
247
+ return G.test(e);
248
248
  }
249
- function J(e, t) {
249
+ function X(e, t) {
250
250
  let n = `${e.slice(-1)}${t.slice(0, 1)}`;
251
- return W.test(n) ? `${e}${t}` : `${e} ${t}`;
251
+ return K.test(n) ? `${e}${t}` : `${e} ${t}`;
252
252
  }
253
- function Y(e, t) {
253
+ function Z(e, t) {
254
254
  let n = t.trim();
255
255
  n && e.push(n);
256
256
  }
257
- function X(e, t) {
257
+ function Q(e, t) {
258
258
  let n = [], r = "", i = -1;
259
- for (let a of e.match(K) ?? []) {
259
+ for (let a of e.match(J) ?? []) {
260
260
  if (r.length + a.length > t && r.trim()) {
261
261
  if (i > 0 && i < r.length && i >= t * .4) {
262
- Y(n, r.slice(0, i));
262
+ Z(n, r.slice(0, i));
263
263
  let e = r.slice(i);
264
- e.trim().length + a.length > t ? (Y(n, e), r = "") : r = e;
265
- } else Y(n, r), r = "";
264
+ e.trim().length + a.length > t ? (Z(n, e), r = "") : r = e;
265
+ } else Z(n, r), r = "";
266
266
  i = -1;
267
267
  }
268
268
  if (a.length > t) {
269
- Y(n, r), r = "", i = -1;
269
+ Z(n, r), r = "", i = -1;
270
270
  for (let e = 0; e < a.length; e += t) n.push(a.slice(e, e + t));
271
271
  continue;
272
272
  }
273
- r += a, G.test(a) && (i = r.length);
273
+ r += a, q.test(a) && (i = r.length);
274
274
  }
275
- return Y(n, r), n;
275
+ return Z(n, r), n;
276
276
  }
277
- function Z(e, t) {
278
- if (q(e)) return X(e, t);
277
+ function $(e, t) {
278
+ if (Y(e)) return Q(e, t);
279
279
  let n = [], r = "";
280
280
  for (let i of e.split(/\s+/)) {
281
281
  if (i.length > t) {
@@ -287,29 +287,43 @@ function Z(e, t) {
287
287
  }
288
288
  return r && n.push(r), n;
289
289
  }
290
- function Q(e, t = 180, n = 40) {
291
- let r = Math.max(1, t), i = Math.max(1, Math.min(n, r)), a = [], o = "", s = r;
292
- for (let t of H(e)) {
293
- let e = q(t) ? i : r;
290
+ function ee(e, t = 180, n = 40, r = {}) {
291
+ let i = Math.max(1, t), a = Math.max(1, Math.min(n, i)), o = [], s = "", c = i;
292
+ for (let t of W(e)) {
293
+ let e = Y(t) ? a : i;
294
294
  if (t.length > e) {
295
- o &&= (a.push(o), ""), a.push(...Z(t, e)), s = r;
295
+ s &&= (o.push(s), ""), o.push(...$(t, e)), c = i;
296
296
  continue;
297
297
  }
298
- if (!o) {
299
- o = t, s = e;
298
+ if (!s) {
299
+ s = t, c = e;
300
300
  continue;
301
301
  }
302
- let n = J(o, t), c = Math.min(s, e);
303
- n.length <= c ? (o = n, s = c) : (a.push(o), o = t, s = e);
302
+ let n = X(s, t), r = Math.min(c, e);
303
+ n.length <= r ? (s = n, c = r) : (o.push(s), s = t, c = e);
304
304
  }
305
- if (o && a.push(o), a.length > 1) {
306
- let e = H(a[0]);
305
+ if (s && o.push(s), o.length > 1) {
306
+ let e = W(o[0]);
307
307
  if (e.length > 1) {
308
308
  let [t, ...n] = e;
309
- a.splice(0, 1, t, n.reduce((e, t) => J(e, t)));
309
+ o.splice(0, 1, t, n.reduce((e, t) => X(e, t)));
310
310
  }
311
311
  }
312
- return a;
312
+ if (r.firstChunkMaxChars !== void 0 && o.length > 0) {
313
+ let [e, t] = te(o[0], r.firstChunkMaxChars);
314
+ t && o.splice(0, 1, e, t);
315
+ }
316
+ return o;
317
+ }
318
+ function te(e, t) {
319
+ if (e.length <= t || Y(e)) return [e, null];
320
+ for (let n = Math.min(t, e.length - 1); n >= o; --n) {
321
+ let t = e[n - 1], r = e[n];
322
+ if (!("—–".includes(t) || ",;:".includes(t) && /\s/.test(r))) continue;
323
+ let i = e.slice(0, n).trimEnd(), a = e.slice(n).trimStart();
324
+ if (i && a) return [i, a];
325
+ }
326
+ return [e, null];
313
327
  }
314
328
  //#endregion
315
- 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, q as containsCjk, S as speakableEmail, g as splitTableRow, N as toSpeakableText };
329
+ 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, a as SPEECH_FIRST_CHUNK_MAX_CHARS, ee as chunkForSpeech, Y as containsCjk, w as speakableEmail, v as splitTableRow, F as toSpeakableText };
@@ -70,6 +70,18 @@ export type VoiceSessionEvent =
70
70
  } | {
71
71
  type: 'reply';
72
72
  text: string;
73
+ }
74
+ /**
75
+ * ★ BOFF-8062 (C1): this turn's reply has STARTED being spoken from the
76
+ * speech feed — at the turn's `answerDone`, before the reply message is
77
+ * complete in the store. Only a `thinking` moves, to `speaking`, exactly as
78
+ * `reply` does; the later `reply` for the same id is then a no-op because the
79
+ * caller claimed it (`planReplyConsumption`). C1 never pauses a reply, so no
80
+ * path strands the session in `thinking`.
81
+ */
82
+ | {
83
+ type: 'reply-audio-started';
84
+ replyId: string;
73
85
  } | {
74
86
  type: 'speech-ended';
75
87
  } | {
@@ -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;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BAAiB,EACxB,eAAe,EAAE,MAAM,GAAG,IAAI,GAC7B;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAItC;AAED,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,oBAAoB,CAMzD,CAAC;AAEH;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,oBAAoB,EAC9B,KAAK,EAAE,iBAAiB,EACxB,UAAU,GAAE,MAAM,GAAG,IAAW,GAC/B,oBAAoB,CAkHtB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,oBAAoB,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAUhG;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE;IACvC,sCAAsC;IACtC,SAAS,EAAE,OAAO,CAAC;IACnB,uDAAuD;IACvD,IAAI,EAAE,OAAO,CAAC;IACd,8EAA8E;IAC9E,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG;IAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAY1C;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,oBAAoB,GAAG,OAAO,CAKnE;AAED,gFAAgF;AAChF,wBAAgB,OAAO,CAAC,QAAQ,EAAE,oBAAoB,GAAG,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,UAAU,CAatG"}
@@ -100,6 +100,12 @@ function m(e, t, n = null) {
100
100
  pending: "",
101
101
  interim: ""
102
102
  } : e;
103
+ case "reply-audio-started": return e.phase === "thinking" ? {
104
+ ...e,
105
+ phase: "speaking",
106
+ pending: "",
107
+ interim: ""
108
+ } : e;
103
109
  case "speech-ended": return e.phase === "speaking" ? {
104
110
  ...e,
105
111
  phase: "listening",