@burdenoff/fe-libs 2026.1029.9 → 2026.1029.10

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.
@@ -52,19 +52,20 @@ export type SpeechFeedEvent = {
52
52
  } | {
53
53
  type: 'audio';
54
54
  messageId: string;
55
- state: 'queued' | 'started' | 'paused' | 'ended';
55
+ state: 'queued' | 'started' | 'paused' | 'ended' | 'retrying';
56
56
  } | {
57
57
  type: 'abort';
58
58
  messageId: string;
59
+ retrying?: true;
59
60
  };
60
61
  type Listener = (event: SpeechFeedEvent) => void;
61
62
  export declare const speechFeed: {
62
63
  publish(messageId: string, item: SpeechFeedItem): void;
63
64
  append(messageId: string, item: SpeechFeedItem, phrases: readonly string[]): void;
64
65
  retract(messageId: string): void;
65
- audio(messageId: string, state: "queued" | "started" | "paused" | "ended"): void;
66
+ audio(messageId: string, state: "queued" | "started" | "paused" | "ended" | "retrying"): void;
66
67
  /** Forget a published message and tell the subscriber to stop speaking it. */
67
- abort(messageId: string): void;
68
+ abort(messageId: string, retrying?: boolean): void;
68
69
  subscribe(listener: Listener): () => void;
69
70
  /**
70
71
  * The item published for `messageId`, if it is still live (not aborted). The
@@ -41,10 +41,11 @@ var a = {
41
41
  state: t
42
42
  });
43
43
  },
44
- abort(e) {
44
+ abort(e, t = !1) {
45
45
  n.delete(e) && r({
46
46
  type: "abort",
47
- messageId: e
47
+ messageId: e,
48
+ ...t ? { retrying: !0 } : {}
48
49
  });
49
50
  },
50
51
  subscribe(e) {
@@ -1640,8 +1640,8 @@ var Gi = () => () => {}, Ki = () => "off", qi = ({ visible: qi = !0, writeAccess
1640
1640
  x.speech?.close(), x.speech = null, x.render?.end();
1641
1641
  }, Ke = () => {
1642
1642
  We(), x.stream?.close(), x.stream = null, x.render = null;
1643
- }, Je = !1, Ye = () => {
1644
- Je && (Je = !1, qe.abort(b));
1643
+ }, Je = !1, Ye = (e = !1) => {
1644
+ Je && (Je = !1, qe.abort(b, e));
1645
1645
  }, Xe = new u(), Qe = () => {}, $e = async (i = 1) => {
1646
1646
  T(b, "attemptStarted");
1647
1647
  let a = null, o = null, s = !1;
@@ -1818,9 +1818,12 @@ var Gi = () => () => {}, Ki = () => "off", qi = ({ visible: qi = !0, writeAccess
1818
1818
  } finally {
1819
1819
  et?.dispose();
1820
1820
  }
1821
- if (ht?.(), Ke(), (S.done || Je) && n.voiceSessionId !== void 0 && !Ae().abandon) {
1821
+ if (ht?.(), Ke(), S.done || (w(b, { outcome: "timedOut" }), S = {
1822
+ ...S,
1823
+ content: Ue(S.content, g, N, le)
1824
+ }), (S.done || Je) && n.voiceSessionId !== void 0 && !Ae().abandon) {
1822
1825
  let e = l(at(S.content));
1823
- (e.trim() || Je) && (s && it(e), T(b, "speechQueued"), Je = !0, qe.publish(b, {
1826
+ (e.trim() || Je) && ((s || !S.done) && it(e), T(b, "speechQueued"), Je = !0, qe.publish(b, {
1824
1827
  conversationId: _,
1825
1828
  channel: "voice",
1826
1829
  voiceSessionId: n.voiceSessionId,
@@ -1830,10 +1833,7 @@ var Gi = () => () => {}, Ki = () => "off", qi = ({ visible: qi = !0, writeAccess
1830
1833
  }));
1831
1834
  }
1832
1835
  let _t = ue.producesArtifacts ? await ye(i, y, c, g, ve).then((e) => e).catch(() => []) : void 0;
1833
- S.usedTools !== void 0 && w(b, { usedTools: S.usedTools }), S.done || (w(b, { outcome: "timedOut" }), S = {
1834
- ...S,
1835
- content: Ue(S.content, g, N, le)
1836
- }), s && (S = {
1836
+ S.usedTools !== void 0 && w(b, { usedTools: S.usedTools }), s && (S = {
1837
1837
  ...S,
1838
1838
  content: at(S.content)
1839
1839
  });
@@ -1872,7 +1872,7 @@ var Gi = () => () => {}, Ki = () => "off", qi = ({ visible: qi = !0, writeAccess
1872
1872
  if (i === 1 && Xe.canFailover() && Dn(e)) {
1873
1873
  Qe();
1874
1874
  let e = a ?? v.getState().sandboxesByMode[g]?.sandboxId ?? null;
1875
- return e && (Fo.current.add(e), Po.current.invalidate(e)), ka(_), ja(g), Ca(_, b, ""), Ta(_, b, { pendingWrite: void 0 }), e && K.retireSandbox(e), Ke(), Ye(), vn(b), $e(2);
1875
+ return e && (Fo.current.add(e), Po.current.invalidate(e)), ka(_), ja(g), Ca(_, b, ""), Ta(_, b, { pendingWrite: void 0 }), e && K.retireSandbox(e), Ke(), Ye(!0), vn(b), $e(2);
1876
1876
  }
1877
1877
  throw e;
1878
1878
  }
@@ -6,14 +6,14 @@ import { HOSTED_VOICES as i } from "../speech/hostedVoiceCatalogue.js";
6
6
  import { VOICE_LIST_TIMEOUT_MS as a, languageDisplayName as o, selectVoiceForLocale as s, speechGate as c, speechLangForLocale as l, voiceAvailability as ee, voicesForLocale as u } from "../voice/speechVoices.js";
7
7
  import { getSpeechEngine as d, subscribeSpeechEngine as te } from "../speech/createSpeechEngine.js";
8
8
  import { speechFeed as f } from "../speech/speechFeed.js";
9
- import { hasPendingReplyRequests as ne, releaseReplyRequestsOutside as p, replyWantsAvatar as re, settleReplyRequest as m, subscribeReplyRequests as h } from "../speech/replySpeechRequests.js";
10
- import { isTurnSuperseded as g } from "../voice/supersededTurns.js";
11
- import { chunkForSpeech as ie, toSpeakableText as _ } from "../voice/speakableText.js";
12
- import { voicePreviewText as v } from "../voice/voicePreview.js";
13
- import { findAssistantLanguage as y } from "../voice/languages.js";
14
- import { resolveLanguagePair as b } from "../voice/languagePair.js";
15
- import { speechLabelsFor as x } from "../voice/speechLabels.js";
16
- import { resolveSpeechLocale as S } from "../voice/replyLanguage.js";
9
+ import { hasPendingReplyRequests as p, releaseReplyRequestsOutside as m, replyWantsAvatar as ne, settleReplyRequest as h, subscribeReplyRequests as g } from "../speech/replySpeechRequests.js";
10
+ import { isTurnSuperseded as _ } from "../voice/supersededTurns.js";
11
+ import { chunkForSpeech as re, toSpeakableText as v } from "../voice/speakableText.js";
12
+ import { voicePreviewText as y } from "../voice/voicePreview.js";
13
+ import { findAssistantLanguage as b } from "../voice/languages.js";
14
+ import { resolveLanguagePair as x } from "../voice/languagePair.js";
15
+ import { speechLabelsFor as S } from "../voice/speechLabels.js";
16
+ import { resolveSpeechLocale as ie } from "../voice/replyLanguage.js";
17
17
  import { IDLE_PLAYBACK as ae, isSpeakingMessage as C, publishedChunks as oe, speechPlaybackReducer as se } from "../voice/speechPlayback.js";
18
18
  import { isTurnInFlight as ce } from "../turnState.js";
19
19
  import { parseToolActivity as le } from "./AssistantToolActivity.js";
@@ -38,11 +38,11 @@ var xe = {
38
38
  subscribe: () => A,
39
39
  getSnapshot: () => !1
40
40
  }, we = {
41
- subscribe: h,
42
- getSnapshot: ne
41
+ subscribe: g,
42
+ getSnapshot: p
43
43
  };
44
44
  function Te(e, t) {
45
- return re(t) ? {
45
+ return ne(t) ? {
46
46
  ...e,
47
47
  autoSpeakEnabled: !0
48
48
  } : e;
@@ -85,7 +85,7 @@ var De = ge({
85
85
  function j() {
86
86
  return _e(De);
87
87
  }
88
- var M = ({ children: ne, visible: h = !0, engine: ge }) => {
88
+ var M = ({ children: p, visible: g = !0, engine: ge }) => {
89
89
  let _e = ye(te, d, d), A = ge ?? _e, j = t(), { locale: M } = e(), [N, P] = ve(se, ae), [F, Oe] = k(() => A.listVoices()), [ke, Ae] = k(!1), [je, I] = k(() => /* @__PURE__ */ new Map()), [Me, Ne] = k(() => /* @__PURE__ */ new Set()), [Pe, Fe] = k(null), L = O(0), Ie = O(null), Le = O(null), R = O(void 0), z = O(null), B = O(null), V = O(/* @__PURE__ */ new Set()), H = O(null);
90
90
  E(() => () => {
91
91
  H.current !== null && clearTimeout(H.current);
@@ -102,11 +102,11 @@ var M = ({ children: ne, visible: h = !0, engine: ge }) => {
102
102
  };
103
103
  return e(), A.subscribeVoices(e);
104
104
  }, [A, q]);
105
- let Je = n((e) => e.assistantLanguage), Ye = n((e) => e.replyLanguage), J = n((e) => e.preferredVoices), Xe = n((e) => e.setPreferredVoice), Y = D(() => b(Je, Ye, M).reply, [
105
+ let Je = n((e) => e.assistantLanguage), Ye = n((e) => e.replyLanguage), J = n((e) => e.preferredVoices), Xe = n((e) => e.setPreferredVoice), Y = D(() => x(Je, Ye, M).reply, [
106
106
  Je,
107
107
  Ye,
108
108
  M
109
- ]), X = Y.code, Ze = T((e) => y(e)?.tag ?? l(e), []), Qe = T((e) => y(e)?.rate ?? .9, []), $e = D(() => ee(q, F, Y.tag, ke), [
109
+ ]), X = Y.code, Ze = T((e) => b(e)?.tag ?? l(e), []), Qe = T((e) => b(e)?.rate ?? .9, []), $e = D(() => ee(q, F, Y.tag, ke), [
110
110
  q,
111
111
  F,
112
112
  Y,
@@ -120,25 +120,28 @@ var M = ({ children: ne, visible: h = !0, engine: ge }) => {
120
120
  nestedItem: j("speech.nestedItem", "Sub-item {{ordinal}}"),
121
121
  emailAt: j("speech.emailAt", "at"),
122
122
  emailDot: j("speech.emailDot", "dot")
123
- }), [j]), Z = T(() => {
124
- let e = B.current;
125
- if (e) try {
126
- e.playback.cancel();
127
- } finally {
128
- e.notifyEnded();
123
+ }), [j]), Z = T((e = "ended") => {
124
+ let t = B.current;
125
+ if (t) {
126
+ e === "retrying" && t.notifyEnded(e);
127
+ try {
128
+ t.playback.cancel();
129
+ } finally {
130
+ t.notifyEnded();
131
+ }
129
132
  }
130
- }, []), Q = T(() => {
131
- W(), Le.current = null, w(R.current, "stopped"), R.current = void 0, Z(), A.cancel(), m(Ie.current, "stopped"), P({ type: "stop" });
133
+ }, []), tt = T((e) => {
134
+ W(), Le.current = null, w(R.current, "stopped"), R.current = void 0, Z(e), A.cancel(), h(Ie.current, "stopped"), P({ type: "stop" });
132
135
  }, [
133
136
  W,
134
137
  Z,
135
138
  A
136
- ]), tt = T((e) => {
139
+ ]), Q = T(() => tt("ended"), [tt]), nt = T((e) => {
137
140
  let t = A.listVoices().find((t) => t.name === e) ?? null;
138
141
  if (t) {
139
142
  Q();
140
143
  try {
141
- A.speak([v(X)], {
144
+ A.speak([y(X)], {
142
145
  voice: t,
143
146
  lang: Ze(X),
144
147
  fallback: !1
@@ -150,139 +153,139 @@ var M = ({ children: ne, visible: h = !0, engine: ge }) => {
150
153
  X,
151
154
  Q,
152
155
  Ze
153
- ]), nt = T((e) => je.get(e) ?? null, [je]), rt = T((e) => Me.has(e) ? j("speech.deviceFallback", "Device voice used: the selected voice was unavailable.") : null, [Me, j]), it = T((e, t, n, r, i) => {
156
+ ]), rt = T((e) => je.get(e) ?? null, [je]), it = T((e) => Me.has(e) ? j("speech.deviceFallback", "Device voice used: the selected voice was unavailable.") : null, [Me, j]), at = T((e, t, n, r, i) => {
154
157
  W();
155
158
  let o = !1, s = () => {}, c = (a) => {
156
159
  if (!o) {
157
160
  if (o = !0, U.current = null, clearTimeout(l), s(), a.length === 0) {
158
- Ae(!0), m(e, "declined");
161
+ Ae(!0), h(e, "declined");
159
162
  return;
160
163
  }
161
164
  Oe(a), Be.current(e, t, a, n, r, i);
162
165
  }
163
166
  }, l = setTimeout(() => c(A.listVoices()), a);
164
167
  s = A.subscribeVoices(() => c(A.listVoices())), U.current = () => {
165
- o || (o = !0, clearTimeout(l), s(), U.current = null, m(e, "stopped"));
168
+ o || (o = !0, clearTimeout(l), s(), U.current = null, h(e, "stopped"));
166
169
  };
167
- }, [W, A]), at = T((e, t, n, r, a = !1, l, u = !1) => {
170
+ }, [W, A]), ot = T((e, t, n, r, a = !1, l, u = !1) => {
168
171
  let d = n;
169
172
  if (d.length === 0) {
170
173
  let e = A.listVoices();
171
174
  e.length > 0 && (d = e, Oe(e));
172
175
  }
173
- let te = Ze(r), ne = c(ee(!0, d, r, ke));
174
- if (ne === "block") {
176
+ let te = Ze(r), p = c(ee(!0, d, r, ke));
177
+ if (p === "block") {
175
178
  let t = j("speech.noVoiceForReply", "This reply is in {{language}}, and no {{language}} voice is installed on this device.", { language: o(te, M) });
176
- I((n) => new Map(n).set(e, t)), m(e, "declined");
179
+ I((n) => new Map(n).set(e, t)), h(e, "declined");
177
180
  return;
178
181
  }
179
- if (u && (ne !== "speak" || !A.open)) return;
180
- if (ne === "wait-for-voices") {
181
- it(e, t, r, a, l);
182
+ if (u && (p !== "speak" || !A.open)) return;
183
+ if (p === "wait-for-voices") {
184
+ at(e, t, r, a, l);
182
185
  return;
183
186
  }
184
- let p = {
187
+ let m = {
185
188
  voice: s(d, te, J[r]),
186
189
  lang: te,
187
190
  rate: Qe(r)
188
- }, h = ct.current;
189
- if (a && !h.autoSpeakEnabled && !h.sessionSpeaking && re(e)) {
190
- if (A.wouldSpeakOnAvatar?.(p) !== !0) {
191
- m(e, "declined");
191
+ }, g = lt.current;
192
+ if (a && !g.autoSpeakEnabled && !g.sessionSpeaking && ne(e)) {
193
+ if (A.wouldSpeakOnAvatar?.(m) !== !0) {
194
+ h(e, "declined");
192
195
  return;
193
196
  }
194
- p.avatarOnly = !0;
197
+ m.avatarOnly = !0;
195
198
  }
196
199
  I((t) => {
197
200
  if (!t.has(e)) return t;
198
201
  let n = new Map(t);
199
202
  return n.delete(e), n;
200
203
  });
201
- let g = J[r], _ = typeof g == "string" && i.some((e) => e.name === g) && !d.some((e) => e.name === g);
204
+ let _ = J[r], v = typeof _ == "string" && i.some((e) => e.name === _) && !d.some((e) => e.name === _);
202
205
  Ne((t) => {
203
- if (t.has(e) === _) return t;
206
+ if (t.has(e) === v) return t;
204
207
  let n = new Set(t);
205
- return _ ? n.add(e) : n.delete(e), n;
208
+ return v ? n.add(e) : n.delete(e), n;
206
209
  }), W(), Z();
207
- let v = L.current + 1;
208
- L.current = v, Ie.current !== e && m(Ie.current, "stopped"), Ie.current = e, m(e, "speaking"), P({
210
+ let y = L.current + 1;
211
+ L.current = y, Ie.current !== e && h(Ie.current, "stopped"), Ie.current = e, h(e, "speaking"), P({
209
212
  type: "start",
210
213
  messageId: e,
211
- requestId: v
212
- }), Le.current = a ? v : null, a && me(e, "ttsStarted"), w(R.current, "stopped");
213
- let y = a ? void 0 : fe(e);
214
- R.current = y;
215
- let b = l === void 0 ? ie(t) : ie(t, void 0, void 0, { firstChunkMaxChars: l });
214
+ requestId: y
215
+ }), Le.current = a ? y : null, a && me(e, "ttsStarted"), w(R.current, "stopped");
216
+ let b = a ? void 0 : fe(e);
217
+ R.current = b;
218
+ let x = l === void 0 ? re(t) : re(t, void 0, void 0, { firstChunkMaxChars: l });
216
219
  ze({
217
- requestId: v,
218
- chunks: b,
220
+ requestId: y,
221
+ chunks: x,
219
222
  index: -1
220
223
  }), H.current !== null && clearTimeout(H.current), H.current = setTimeout(() => {
221
- u || ze((e) => e?.requestId === v && e.index < 0 ? null : e);
224
+ u || ze((e) => e?.requestId === y && e.index < 0 ? null : e);
222
225
  }, Se);
223
- let x = !1, S = () => {
224
- x || (x = !0, !(!u || L.current !== v) && (B.current = null, f.audio(e, "ended")));
226
+ let S = !1, ie = (t = "ended") => {
227
+ S || (S = !0, !(!u || L.current !== y) && (B.current = null, f.audio(e, t)));
225
228
  }, ae = () => {
226
- w(y, "failed"), S(), L.current === v && H.current !== null && (clearTimeout(H.current), H.current = null), m(e, "failed"), P({
229
+ w(b, "failed"), ie(), L.current === y && H.current !== null && (clearTimeout(H.current), H.current = null), h(e, "failed"), P({
227
230
  type: "failed",
228
- requestId: v
231
+ requestId: y
229
232
  });
230
233
  }, C = !1;
231
234
  try {
232
235
  let n = {
233
236
  onStart: () => {
234
- L.current === v && w(y, "answered"), L.current === v && Le.current === v && me(e, "firstAudio");
237
+ L.current === y && w(b, "answered"), L.current === y && Le.current === y && me(e, "firstAudio");
235
238
  },
236
239
  onChunkStart: (t) => {
237
- C = !0, u && L.current === v && (f.peek(e)?.final === !1 && pe(e, { spokeNarration: !0 }), f.audio(e, "started")), L.current === v && H.current !== null && (clearTimeout(H.current), H.current = null), ze((e) => e?.requestId === v ? {
240
+ C = !0, u && L.current === y && (f.peek(e)?.final === !1 && pe(e, { spokeNarration: !0 }), f.audio(e, "started")), L.current === y && H.current !== null && (clearTimeout(H.current), H.current = null), ze((e) => e?.requestId === y ? {
238
241
  ...e,
239
242
  index: t
240
- } : L.current === v ? {
241
- requestId: v,
242
- chunks: b,
243
+ } : L.current === y ? {
244
+ requestId: y,
245
+ chunks: x,
243
246
  index: t
244
247
  } : e);
245
248
  },
246
249
  onPause: () => {
247
- u && L.current === v && f.audio(e, "paused");
250
+ u && L.current === y && f.audio(e, "paused");
248
251
  },
249
252
  onDeviceFallback: () => {
250
- L.current === v && Ne((t) => t.has(e) ? t : new Set(t).add(e));
253
+ L.current === y && Ne((t) => t.has(e) ? t : new Set(t).add(e));
251
254
  },
252
255
  onEnd: () => {
253
- w(y, "stopped"), S(), L.current === v && Le.current === v && me(e, "audioEnded"), m(e, "spoken"), P({
256
+ w(b, "stopped"), ie(), L.current === y && Le.current === y && me(e, "audioEnded"), h(e, "spoken"), P({
254
257
  type: "finished",
255
- requestId: v
258
+ requestId: y
256
259
  });
257
260
  },
258
261
  onError: (t) => {
259
- w(y, t === "cancelled" ? "stopped" : "failed"), S(), !C && L.current === v && Ne((t) => {
262
+ w(b, t === "cancelled" ? "stopped" : "failed"), ie(), !C && L.current === y && Ne((t) => {
260
263
  if (!t.has(e)) return t;
261
264
  let n = new Set(t);
262
265
  return n.delete(e), n;
263
- }), t === "output-not-cleared" && L.current === v && Fe({ messageId: e }), m(e, t === "output-not-cleared" ? "not-cleared" : t === "output-left" ? C ? "cut" : "declined" : t === "cancelled" ? "stopped" : "failed"), P({
266
+ }), t === "output-not-cleared" && L.current === y && Fe({ messageId: e }), h(e, t === "output-not-cleared" ? "not-cleared" : t === "output-left" ? C ? "cut" : "declined" : t === "cancelled" ? "stopped" : "failed"), P({
264
267
  type: "failed",
265
- requestId: v
268
+ requestId: y
266
269
  });
267
270
  }
268
271
  };
269
272
  if (u && A.open) {
270
273
  let i = A.open.bind(A);
271
274
  f.audio(e, "queued");
272
- let a = ue((e) => i(p, e), n, (e) => {
273
- b = [...e], ze((e) => e?.requestId === v ? {
275
+ let a = ue((e) => i(m, e), n, (e) => {
276
+ x = [...e], ze((e) => e?.requestId === y ? {
274
277
  ...e,
275
- chunks: b
278
+ chunks: x
276
279
  } : e);
277
280
  }, () => pe(e, { speechDivergence: !0 }));
278
- x ? a.cancel() : (B.current = {
281
+ S ? a.cancel() : (B.current = {
279
282
  messageId: e,
280
- requestId: v,
283
+ requestId: y,
281
284
  locale: r,
282
285
  playback: a,
283
- notifyEnded: S
286
+ notifyEnded: ie
284
287
  }, a.append(t));
285
- } else A.speak(b, p, n);
288
+ } else A.speak(x, m, n);
286
289
  } catch {
287
290
  ae();
288
291
  }
@@ -296,59 +299,59 @@ var M = ({ children: ne, visible: h = !0, engine: ge }) => {
296
299
  Ze,
297
300
  j,
298
301
  ke,
299
- it
302
+ at
300
303
  ]);
301
304
  E(() => {
302
- Be.current = at;
303
- }, [at]);
304
- let ot = T((e, t, n, r) => {
305
+ Be.current = ot;
306
+ }, [ot]);
307
+ let st = T((e, t, n, r) => {
305
308
  if (!q) return;
306
- let i = S(_(t, { labels: xe }), n ?? X), a = _(t, { labels: x(i, et) });
307
- a && at(e, a, F, i, r?.auto === !0, r?.firstChunkMaxChars, r?.phraseStream);
309
+ let i = ie(v(t, { labels: xe }), n ?? X), a = v(t, { labels: S(i, et) });
310
+ a && ot(e, a, F, i, r?.auto === !0, r?.firstChunkMaxChars, r?.phraseStream);
308
311
  }, [
309
312
  q,
310
313
  et,
311
314
  X,
312
- at,
315
+ ot,
313
316
  F
314
- ]), st = T((e, t, n) => {
317
+ ]), ct = T((e, t, n) => {
315
318
  if (C(N, e)) {
316
319
  Q();
317
320
  return;
318
321
  }
319
- ot(e, t, n);
322
+ st(e, t, n);
320
323
  }, [
321
324
  N,
322
- ot,
325
+ st,
323
326
  Q
324
327
  ]);
325
328
  E(() => {
326
- h || Q();
327
- }, [h, Q]);
328
- let ct = O({
329
+ g || Q();
330
+ }, [g, Q]);
331
+ let lt = O({
329
332
  autoSpeakEnabled: G,
330
333
  sessionSpeaking: K,
331
- visible: h,
334
+ visible: g,
332
335
  isSupported: q
333
336
  });
334
337
  E(() => {
335
- ct.current = {
338
+ lt.current = {
336
339
  autoSpeakEnabled: G,
337
340
  sessionSpeaking: K,
338
- visible: h,
341
+ visible: g,
339
342
  isSupported: q
340
343
  };
341
344
  }, [
342
345
  G,
343
346
  K,
344
- h,
347
+ g,
345
348
  q
346
349
  ]);
347
- let lt = O(null), ut = O(null), dt = O(() => {});
350
+ let ut = O(null), dt = O(null), ft = O(() => {});
348
351
  E(() => {
349
- Q(), V.current.clear(), I(/* @__PURE__ */ new Map()), Ne(/* @__PURE__ */ new Set()), p(n.getState().activeConversationId), lt.current = Ge;
350
- let e = ut.current;
351
- ut.current = null, e && e.conversationId === Ge && dt.current(e.conversationId, e.messageId);
352
+ Q(), V.current.clear(), I(/* @__PURE__ */ new Map()), Ne(/* @__PURE__ */ new Set()), m(n.getState().activeConversationId), ut.current = Ge;
353
+ let e = dt.current;
354
+ dt.current = null, e && e.conversationId === Ge && ft.current(e.conversationId, e.messageId);
352
355
  }, [Ge, Q]), E(() => {
353
356
  I((e) => e.size === 0 ? e : /* @__PURE__ */ new Map()), Q();
354
357
  }, [X, Q]), E(() => () => {
@@ -376,25 +379,25 @@ var M = ({ children: ne, visible: h = !0, engine: ge }) => {
376
379
  A,
377
380
  q
378
381
  ]);
379
- let ft = O(ot);
382
+ let pt = O(st);
380
383
  E(() => {
381
- ft.current = ot;
382
- }, [ot]);
384
+ pt.current = st;
385
+ }, [st]);
383
386
  let $ = T((e, t) => {
384
- if (r(e) !== t || g(e.id) || z.current?.messageId === e.id || Ue.current) return;
387
+ if (r(e) !== t || _(e.id) || z.current?.messageId === e.id || Ue.current) return;
385
388
  let { text: n } = le(e.content);
386
389
  if (n.trim()) try {
387
- ft.current(e.id, n, e.metadata?.lang, { auto: !0 });
390
+ pt.current(e.id, n, e.metadata?.lang, { auto: !0 });
388
391
  } catch {}
389
- }, []), pt = T((e, t) => {
390
- if (e !== lt.current) {
391
- n.getState().activeConversationId === e && (ut.current = {
392
+ }, []), mt = T((e, t) => {
393
+ if (e !== ut.current) {
394
+ n.getState().activeConversationId === e && (dt.current = {
392
395
  conversationId: e,
393
396
  messageId: t
394
397
  });
395
398
  return;
396
399
  }
397
- let r = Te(ct.current, t);
400
+ let r = Te(lt.current, t);
398
401
  if (!r.autoSpeakEnabled && !r.sessionSpeaking || !r.visible || !r.isSupported) return;
399
402
  let i = n.getState();
400
403
  if (i.activeConversationId !== e) return;
@@ -402,9 +405,9 @@ var M = ({ children: ne, visible: h = !0, engine: ge }) => {
402
405
  !a || a.role !== "assistant" || $(a, r.sessionSpeaking);
403
406
  }, [$]);
404
407
  E(() => {
405
- dt.current = pt;
406
- }, [pt]), E(() => {
407
- if (!(!G && !K || !h || !q)) return n.subscribe((e, t) => {
408
+ ft.current = mt;
409
+ }, [mt]), E(() => {
410
+ if (!(!G && !K || !g || !q)) return n.subscribe((e, t) => {
408
411
  let n = e.activeConversationId;
409
412
  if (!n || n !== t.activeConversationId) return;
410
413
  let r = e.processingByConversationId[n], i = t.processingByConversationId[n];
@@ -418,22 +421,22 @@ var M = ({ children: ne, visible: h = !0, engine: ge }) => {
418
421
  G,
419
422
  K,
420
423
  q,
421
- h,
424
+ g,
422
425
  $
423
426
  ]), E(() => {
424
- if (!(G || K || !qe || !h || !q)) return n.subscribe((e, t) => {
427
+ if (!(G || K || !qe || !g || !q)) return n.subscribe((e, t) => {
425
428
  let n = Ee(e, t);
426
- !n || !re(n.id) || $(n, !1);
429
+ !n || !ne(n.id) || $(n, !1);
427
430
  });
428
431
  }, [
429
432
  G,
430
433
  K,
431
434
  qe,
432
435
  q,
433
- h,
436
+ g,
434
437
  $
435
438
  ]);
436
- let mt = T((e) => {
439
+ let ht = T((e) => {
437
440
  if (e.type === "audio") return;
438
441
  if (e.type === "retract") {
439
442
  B.current?.messageId === e.messageId && B.current.playback.retract();
@@ -443,7 +446,7 @@ var M = ({ children: ne, visible: h = !0, engine: ge }) => {
443
446
  V.current.delete(e.messageId);
444
447
  let t = z.current;
445
448
  if (!t || t.messageId !== e.messageId) return;
446
- z.current = null, (t.requestId === null ? t.waiting && U.current !== null : L.current === t.requestId) && Q();
449
+ z.current = null, (t.requestId === null ? t.waiting && U.current !== null : L.current === t.requestId) && tt(e.retrying ? "retrying" : "ended");
447
450
  return;
448
451
  }
449
452
  let { messageId: t, item: r } = e;
@@ -451,11 +454,11 @@ var M = ({ children: ne, visible: h = !0, engine: ge }) => {
451
454
  if (V.current.has(t)) return;
452
455
  V.current.add(t);
453
456
  }
454
- let i = Te(ct.current, t);
455
- if (!i.autoSpeakEnabled && !i.sessionSpeaking || !i.visible || !i.isSupported || r.channel === "voice" !== i.sessionSpeaking || g(t) || Ue.current || n.getState().activeConversationId !== r.conversationId || lt.current !== r.conversationId) return;
457
+ let i = Te(lt.current, t);
458
+ if (!i.autoSpeakEnabled && !i.sessionSpeaking || !i.visible || !i.isSupported || r.channel === "voice" !== i.sessionSpeaking || _(t) || Ue.current || n.getState().activeConversationId !== r.conversationId || ut.current !== r.conversationId) return;
456
459
  let a = B.current;
457
460
  if (a?.messageId === t && a.requestId === L.current) {
458
- let t = _(e.type === "append" ? e.phrases.join(" ") : le(r.text).text, { labels: x(a.locale, et) });
461
+ let t = v(e.type === "append" ? e.phrases.join(" ") : le(r.text).text, { labels: S(a.locale, et) });
459
462
  e.type === "append" ? a.playback.append(t) : a.playback.finish(t);
460
463
  return;
461
464
  }
@@ -464,7 +467,7 @@ var M = ({ children: ne, visible: h = !0, engine: ge }) => {
464
467
  if (!o.trim()) return;
465
468
  let s = L.current;
466
469
  try {
467
- ft.current(t, o, r.lang, {
470
+ pt.current(t, o, r.lang, {
468
471
  auto: !0,
469
472
  firstChunkMaxChars: 110,
470
473
  phraseStream: e.type === "append"
@@ -477,66 +480,66 @@ var M = ({ children: ne, visible: h = !0, engine: ge }) => {
477
480
  waiting: !c && U.current !== null
478
481
  });
479
482
  }, [
480
- Q,
483
+ tt,
481
484
  A,
482
485
  et
483
486
  ]);
484
- E(() => f.subscribe(mt), [mt]);
485
- let ht = D(() => u(F, Y.tag), [F, Y]), gt = D(() => s(F, Y.tag, J[X]), [
487
+ E(() => f.subscribe(ht), [ht]);
488
+ let gt = D(() => u(F, Y.tag), [F, Y]), _t = D(() => s(F, Y.tag, J[X]), [
486
489
  F,
487
490
  Y,
488
491
  J,
489
492
  X
490
- ]), _t = D(() => ({
493
+ ]), vt = D(() => ({
491
494
  isSupported: q,
492
495
  availability: $e,
493
496
  isBlocked: $e === "no-voices",
494
497
  disabledReason: $e === "no-voices" ? j("speech.noVoicesOnDevice", "This device has no speech voices installed. Add one in your device speech or accessibility settings.") : null,
495
- blockedFor: nt,
496
- deviceFallbackFor: rt,
497
- voiceChoices: ht,
498
+ blockedFor: rt,
499
+ deviceFallbackFor: it,
500
+ voiceChoices: gt,
498
501
  spokenChunks: oe(N, Re),
499
- activeVoiceName: gt?.name ?? null,
502
+ activeVoiceName: _t?.name ?? null,
500
503
  preferredVoiceName: J[X] ?? null,
501
504
  setVoice: (e) => Xe(X, e),
502
505
  speakingMessageId: N.status === "speaking" ? N.messageId : null,
503
506
  outputNotCleared: Pe,
504
507
  isSpeaking: (e) => C(N, e),
505
- toggle: st,
508
+ toggle: ct,
506
509
  stop: Q,
507
510
  autoSpeakEnabled: G,
508
511
  setAutoSpeak: Ve,
509
512
  sessionSpeaking: K,
510
513
  setSessionSpeaking: He,
511
514
  setSessionMicOpen: We,
512
- speakFinishedReply: pt,
513
- previewVoice: tt
515
+ speakFinishedReply: mt,
516
+ previewVoice: nt
514
517
  }), [
515
518
  q,
516
519
  $e,
517
- nt,
518
520
  rt,
519
- ht,
521
+ it,
520
522
  gt,
523
+ _t,
521
524
  J,
522
525
  Xe,
523
526
  X,
524
527
  N,
525
528
  Pe,
526
- st,
529
+ ct,
527
530
  Q,
528
531
  G,
529
532
  Ve,
530
533
  K,
531
534
  We,
532
- pt,
533
- tt,
535
+ mt,
536
+ nt,
534
537
  j,
535
538
  Re
536
539
  ]);
537
540
  return /* @__PURE__ */ be(De.Provider, {
538
- value: _t,
539
- children: ne
541
+ value: vt,
542
+ children: p
540
543
  });
541
544
  };
542
545
  //#endregion
@@ -33,7 +33,7 @@ function Te({ onSubmit: Te, latestReply: f, language: p, graceMs: Ee, onSupersed
33
33
  g.muted,
34
34
  g.correctionTimingDecision
35
35
  ]);
36
- let j = u(null), M = u(!1), [Fe, Ie] = d(null), N = u(null), [Le, P] = d(null), [F, I] = d(!1), [Re, L] = d(!1), [R, z] = d(!1), B = u(g);
36
+ let j = u(null), Fe = u(!1), [Ie, M] = d(null), N = u(null), [Le, P] = d(null), [F, I] = d(!1), [Re, L] = d(!1), [R, z] = d(!1), B = u(g);
37
37
  B.current = g;
38
38
  let V = u([]), H = u(null), U = u(!1), W = c(() => {
39
39
  V.current = [], H.current = null, U.current = !1;
@@ -222,13 +222,18 @@ function Te({ onSubmit: Te, latestReply: f, language: p, graceMs: Ee, onSupersed
222
222
  if (e.type !== "audio") return;
223
223
  let t = B.current.phase;
224
224
  if (t !== "thinking" && t !== "speaking") return;
225
+ if (e.state === "retrying") {
226
+ if (j.current !== e.messageId || N.current?.id !== e.messageId) return;
227
+ j.current = null, N.current = null, M(e.messageId), _({ type: "reply-audio-paused" });
228
+ return;
229
+ }
225
230
  if (e.state === "ended") {
226
231
  if (j.current !== e.messageId || N.current?.id !== e.messageId) return;
227
232
  let n = i.peek(e.messageId);
228
233
  n?.channel === "voice" && n.voiceSessionId === $.current && (N.current = {
229
234
  id: e.messageId,
230
235
  text: n.text
231
- }), Ie(null);
236
+ }), M(null);
232
237
  let r = N.current;
233
238
  t === "thinking" && queueMicrotask(() => {
234
239
  N.current === r && B.current.phase === "thinking" && _({ type: "reply-audio-ended" });
@@ -237,7 +242,7 @@ function Te({ onSubmit: Te, latestReply: f, language: p, graceMs: Ee, onSupersed
237
242
  }
238
243
  if (o(e.messageId)) return;
239
244
  let n = i.peek(e.messageId);
240
- if (!(!n || n.channel !== "voice" || n.voiceSessionId !== $.current)) if (e.state === "queued") Ie(e.messageId), j.current = e.messageId, N.current = {
245
+ if (!(!n || n.channel !== "voice" || n.voiceSessionId !== $.current)) if (e.state === "queued") M(e.messageId), j.current = e.messageId, N.current = {
241
246
  id: e.messageId,
242
247
  text: n.text
243
248
  }, qe();
@@ -251,16 +256,16 @@ function Te({ onSubmit: Te, latestReply: f, language: p, graceMs: Ee, onSupersed
251
256
  partial: !n.final
252
257
  })) : e.state === "paused" && j.current === e.messageId && _({ type: "reply-audio-paused" });
253
258
  }), [qe]), l(() => {
254
- g.phase !== "thinking" && g.phase !== "speaking" && Ie(null);
259
+ g.phase !== "thinking" && g.phase !== "speaking" && M(null);
255
260
  }, [g.phase]), l(() => {
256
261
  let e = x !== null;
257
- M.current && !e && (H.current = null, (B.current.phase !== "speaking" || !G()) && _({ type: "speech-ended" })), M.current = e;
262
+ Fe.current && !e && (H.current = null, (B.current.phase !== "speaking" || !G()) && _({ type: "speech-ended" })), Fe.current = e;
258
263
  }, [x, G]), l(() => {
259
264
  g.phase !== "listening" && P((e) => e === "nothing-heard" ? null : e);
260
265
  }, [g.phase]), l(() => {
261
266
  if (g.phase !== "speaking" || x !== null) return;
262
267
  let e = setTimeout(() => {
263
- M.current || (W(), _({ type: "speech-ended" }));
268
+ Fe.current || (W(), _({ type: "speech-ended" }));
264
269
  }, xe);
265
270
  return () => clearTimeout(e);
266
271
  }, [
@@ -287,13 +292,13 @@ function Te({ onSubmit: Te, latestReply: f, language: p, graceMs: Ee, onSupersed
287
292
  W,
288
293
  S
289
294
  ]), l(() => {
290
- b(se(g)), fe(g) && Fe === null && !Z.suppressWebSpeech ? X.isActive || X.start("auto") : X.isActive && X.stop();
295
+ b(se(g)), fe(g) && Ie === null && !Z.suppressWebSpeech ? X.isActive || X.start("auto") : X.isActive && X.stop();
291
296
  }, [
292
297
  g,
293
298
  X,
294
299
  b,
295
300
  Z.suppressWebSpeech,
296
- Fe
301
+ Ie
297
302
  ]), l(() => {
298
303
  g.phase !== "speaking" || !U.current || (U.current = !1, G() || _({ type: "speech-ended" }));
299
304
  }, [g.phase, G]), l(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/fe-libs",
3
- "version": "2026.1029.9",
3
+ "version": "2026.1029.10",
4
4
  "description": "Burdenoff frontend primitives and domain libraries",
5
5
  "type": "module",
6
6
  "bin": {