@burdenoff/microfe-healthybowl 2026.902.2 → 2026.902.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/components/assistant/AssistantChatArea.js +116 -116
  2. package/dist/components/assistant/AssistantChatArea.js.map +1 -1
  3. package/dist/components/assistant/AssistantConversationList.js +3 -3
  4. package/dist/components/assistant/composer/AssistantComposer.js +5 -1
  5. package/dist/components/assistant/composer/AssistantComposer.js.map +1 -1
  6. package/dist/components/assistant/voice/AssistantVoiceOrb.js +9 -9
  7. package/dist/components/assistant/voice/AssistantVoiceOrb.js.map +1 -1
  8. package/dist/components/assistant/voice/AssistantVoiceSession.js +1 -0
  9. package/dist/components/assistant/voice/AssistantVoiceSession.js.map +1 -1
  10. package/dist/components/assistant/voice/VoiceConversationView.js +1 -1
  11. package/dist/components/assistant/voice/VoiceConversationView.js.map +1 -1
  12. package/dist/components/assistant/voice/VoiceMiniController.js +1 -1
  13. package/dist/components/assistant/voice/VoiceMiniController.js.map +1 -1
  14. package/dist/healthybowl/HealthyBowlRoot.js +34 -26
  15. package/dist/healthybowl/HealthyBowlRoot.js.map +1 -1
  16. package/dist/healthybowl/HealthyBowlRoutes.js +105 -97
  17. package/dist/healthybowl/HealthyBowlRoutes.js.map +1 -1
  18. package/dist/healthybowl/hooks/useHealthyBowlLabour.js +297 -0
  19. package/dist/healthybowl/hooks/useHealthyBowlLabour.js.map +1 -0
  20. package/dist/healthybowl/pages/labour/CrewTimesheetPage.js +174 -0
  21. package/dist/healthybowl/pages/labour/CrewTimesheetPage.js.map +1 -0
  22. package/dist/healthybowl/pages/labour/LabourRosterPage.js +654 -0
  23. package/dist/healthybowl/pages/labour/LabourRosterPage.js.map +1 -0
  24. package/dist/hooks/useVoiceInput.js +34 -33
  25. package/dist/hooks/useVoiceInput.js.map +1 -1
  26. package/dist/hooks/useVoiceSession.js.map +1 -1
  27. package/dist/services/assistantExportService.js +29 -23
  28. package/dist/services/assistantExportService.js.map +1 -1
  29. package/dist/utils/voiceSession.js.map +1 -1
  30. package/dist/utils/voiceTurnVisibility.js +1 -1
  31. package/package.json +1 -1
@@ -2,47 +2,47 @@ import { useAssistantStore as e } from "../../store/assistantStore.js";
2
2
  import { useTr as t } from "../../shared/hooks/useTr.js";
3
3
  import { checkAssistantAiCredits as n, createAssistantSandbox as r, createAssistantSession as i, extendAssistantSandboxTTL as a, findExistingSandbox as o, getAssistantArtifacts as s, getAssistantMessages as c, getAssistantSession as l, reportAssistantAiTokenUsage as u, sendAssistantPromptAsync as d, waitForAssistantServiceReady as f, waitForSandboxReady as p } from "../../services/assistantApi.js";
4
4
  import { gatherPageContext as m } from "../../utils/pageContext.js";
5
- import { findAssistantLanguage as h, resolveAssistantLanguage as g } from "../../config/assistantLanguages.js";
6
- import { isTurnInFlight as _ } from "../../utils/assistantTurnState.js";
7
- import { parseToolActivity as v } from "./AssistantToolActivity.js";
8
- import { getOrganizationId as y, getWorkspaceId as ee } from "../../utils/assistantContext.js";
5
+ import { chatTurns as h, voiceMarker as g, voiceTurnsOnly as _ } from "../../utils/voiceTurnVisibility.js";
6
+ import { findAssistantLanguage as v, resolveAssistantLanguage as y } from "../../config/assistantLanguages.js";
7
+ import { isTurnInFlight as ee } from "../../utils/assistantTurnState.js";
8
+ import { parseToolActivity as b } from "./AssistantToolActivity.js";
9
+ import { getOrganizationId as x, getWorkspaceId as S } from "../../utils/assistantContext.js";
9
10
  import { buildPromptParts as te, buildPromptWithAttachments as ne, countInlineImageCandidates as re, countInlinedImageParts as ie, toMessageAttachment as ae } from "../../utils/assistantAttachments.js";
10
- import { AssistantMessageList as b } from "./AssistantMessageList.js";
11
- import { AssistantApiCallsConsentDialog as x } from "./AssistantApiCallsConsentDialog.js";
12
- import { ASSISTANT_MODES as S } from "../../types/assistant.js";
11
+ import { AssistantMessageList as C } from "./AssistantMessageList.js";
12
+ import { AssistantApiCallsConsentDialog as w } from "./AssistantApiCallsConsentDialog.js";
13
+ import { ASSISTANT_MODES as T } from "../../types/assistant.js";
13
14
  import { AssistantEmptyState as oe } from "./AssistantEmptyState.js";
14
- import { AssistantComposer as C } from "./composer/AssistantComposer.js";
15
- import { AssistantVoiceSession as se } from "./voice/AssistantVoiceSession.js";
16
- import { useVoiceSession as ce } from "../../hooks/useVoiceSession.js";
17
- import { useAssistantApiAccess as le } from "../../hooks/useAssistantApiAccess.js";
18
- import { isQuotaExhaustedError as ue } from "../../utils/quotaUtils.js";
19
- import { dispatchAssistantQuotaExhausted as de, notifyAiCreditsUpdated as fe } from "../../utils/aiCredits.js";
20
- import { buildPromptForMode as pe } from "../../utils/assistantPrompt.js";
21
- import { isMultimodalBodyRejection as me, isRecoverableAssistantError as he } from "../../utils/assistantTransportErrors.js";
22
- import { pollDelayMs as ge } from "../../utils/assistantPollSchedule.js";
23
- import { toCaptionText as _e } from "../../utils/captionText.js";
24
- import { chatTurns as ve, voiceMarker as w, voiceTurnsOnly as ye } from "../../utils/voiceTurnVisibility.js";
25
- import { createReadinessTracker as be } from "../../utils/sandboxReadiness.js";
26
- import { useCallback as T, useEffect as E, useMemo as D, useRef as O, useState as xe } from "react";
27
- import { useI18n as Se } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
28
- import { jsx as k, jsxs as Ce } from "react/jsx-runtime";
29
- import { useGatewayClient as we } from "@burdenoff/fe-libs/shared/graphql";
30
- import { useAuthToken as Te } from "@burdenoff/fe-libs/shared/providers/shell";
31
- import { getAssistantMedia as Ee } from "@burdenoff/fe-libs/shared/assistant";
15
+ import { AssistantComposer as se } from "./composer/AssistantComposer.js";
16
+ import { AssistantVoiceSession as ce } from "./voice/AssistantVoiceSession.js";
17
+ import { useVoiceSession as le } from "../../hooks/useVoiceSession.js";
18
+ import { useAssistantApiAccess as ue } from "../../hooks/useAssistantApiAccess.js";
19
+ import { isQuotaExhaustedError as de } from "../../utils/quotaUtils.js";
20
+ import { dispatchAssistantQuotaExhausted as fe, notifyAiCreditsUpdated as pe } from "../../utils/aiCredits.js";
21
+ import { buildPromptForMode as me } from "../../utils/assistantPrompt.js";
22
+ import { isMultimodalBodyRejection as he, isRecoverableAssistantError as ge } from "../../utils/assistantTransportErrors.js";
23
+ import { pollDelayMs as _e } from "../../utils/assistantPollSchedule.js";
24
+ import { toCaptionText as ve } from "../../utils/captionText.js";
25
+ import { createReadinessTracker as ye } from "../../utils/sandboxReadiness.js";
26
+ import { useCallback as E, useEffect as D, useMemo as O, useRef as k, useState as be } from "react";
27
+ import { useI18n as xe } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
28
+ import { jsx as A, jsxs as Se } from "react/jsx-runtime";
29
+ import { useGatewayClient as Ce } from "@burdenoff/fe-libs/shared/graphql";
30
+ import { useAuthToken as we } from "@burdenoff/fe-libs/shared/providers/shell";
31
+ import { getAssistantMedia as Te } from "@burdenoff/fe-libs/shared/assistant";
32
32
  //#region src/components/assistant/AssistantChatArea.tsx
33
- var De = {
33
+ var Ee = {
34
34
  general: 18e4,
35
35
  assistant: 18e4,
36
36
  "api-calls": 18e4,
37
37
  "vibe-plugins": 6e5
38
- }, Oe = 18e4;
39
- function ke() {
38
+ }, De = 18e4;
39
+ function Oe() {
40
40
  return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
41
41
  }
42
- function Ae(e) {
42
+ function ke(e) {
43
43
  return e.replace(/(Authorization\s*:\s*Bearer\s+)[^\s\n]+/gi, "$1[REDACTED]").replace(/(X-Workspace-Authorization\s*:\s*Bearer\s+)[^\s\n]+/gi, "$1[REDACTED]").replace(/\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9._-]+\.[A-Za-z0-9._-]+\b/g, "[REDACTED_JWT]").replace(/\bsk-ant-[A-Za-z0-9-]+\b/g, "[REDACTED_API_KEY]");
44
44
  }
45
- function A(e) {
45
+ function Ae(e) {
46
46
  return e.info?.time?.created ?? 0;
47
47
  }
48
48
  function j(e) {
@@ -55,12 +55,12 @@ function M(e) {
55
55
  });
56
56
  }
57
57
  function je(e, t) {
58
- let n = e.filter((e) => e.info?.role === "assistant" && A(e) > t).sort((e, t) => A(e) - A(t));
58
+ let n = e.filter((e) => e.info?.role === "assistant" && Ae(e) > t).sort((e, t) => Ae(e) - Ae(t));
59
59
  if (n.length === 0) return {
60
60
  content: "Thinking...",
61
61
  done: !1
62
62
  };
63
- let r = n[n.length - 1], i = j(r.parts), a = Ee(r.parts), o = M(r.parts);
63
+ let r = n[n.length - 1], i = j(r.parts), a = Te(r.parts), o = M(r.parts);
64
64
  return {
65
65
  content: [
66
66
  i,
@@ -79,11 +79,11 @@ function Me(e) {
79
79
  default: return "";
80
80
  }
81
81
  }
82
- var N = ({ visible: Ee = !0 }) => {
83
- let j = t(), M = we("workspace"), { getAccessToken: N, getWorkspaceToken: Ne, userId: Pe } = Te(), { locale: P } = Se(), F = e((e) => e.assistantLanguage), Fe = D(() => g(F, P).english, [F, P]), Ie = h(F) !== null, Le = D(() => g(F, P).code, [F, P]), { conversations: Re, activeConversationId: I, mode: L, processingByConversationId: ze, setMode: R, setConversationMode: z, setActiveConversation: Be, createConversation: B, addMessage: Ve, updateMessage: He, patchMessage: V, setConversationProcessing: H, clearConversationProcessing: Ue, setBackendSessionId: We, clearBackendSessionId: U, setSandbox: W, clearSandbox: Ge, acknowledgeApiCalls: Ke } = e(), G = Re.find((e) => e.id === I)?.messages ?? [], K = I ? ze[I] : void 0, q = _(K?.status), qe = q ? K?.messageId ?? null : null, Je = K?.status === "error" ? K.messageId : null, { canUseApiCalls: J, loading: Ye } = le(y()), Xe = D(() => S.filter((e) => !e.requiresAdmin || J), [J]), [Ze, Qe] = xe(null), $e = O({}), Y = O(be()), et = O(/* @__PURE__ */ new Set());
84
- E(() => {
82
+ var N = ({ visible: Te = !0 }) => {
83
+ let j = t(), M = Ce("workspace"), { getAccessToken: N, getWorkspaceToken: Ne, userId: Pe } = we(), { locale: P } = xe(), F = e((e) => e.assistantLanguage), Fe = O(() => y(F, P).english, [F, P]), Ie = v(F) !== null, Le = O(() => y(F, P).code, [F, P]), { conversations: Re, activeConversationId: I, mode: L, processingByConversationId: ze, setMode: R, setConversationMode: z, setActiveConversation: Be, createConversation: B, addMessage: Ve, updateMessage: He, patchMessage: V, setConversationProcessing: H, clearConversationProcessing: Ue, setBackendSessionId: We, clearBackendSessionId: U, setSandbox: W, clearSandbox: Ge, acknowledgeApiCalls: Ke } = e(), G = Re.find((e) => e.id === I)?.messages ?? [], K = I ? ze[I] : void 0, q = ee(K?.status), qe = q ? K?.messageId ?? null : null, Je = K?.status === "error" ? K.messageId : null, { canUseApiCalls: J, loading: Ye } = ue(x()), Xe = O(() => T.filter((e) => !e.requiresAdmin || J), [J]), [Ze, Qe] = be(null), $e = k({}), Y = k(ye()), et = k(/* @__PURE__ */ new Set());
84
+ D(() => {
85
85
  if (Ye) return;
86
- let e = S.find((e) => e.id === L);
86
+ let e = T.find((e) => e.id === L);
87
87
  (!e || e.requiresAdmin && !J) && L !== "assistant" && R("assistant");
88
88
  }, [
89
89
  L,
@@ -91,9 +91,9 @@ var N = ({ visible: Ee = !0 }) => {
91
91
  Ye,
92
92
  R
93
93
  ]);
94
- let X = T((e, t, n, r) => {
94
+ let X = E((e, t, n, r) => {
95
95
  H(e, n, t, null), r ? He(e, t, r) : He(e, t, Me(n));
96
- }, [H, He]), tt = T(async (t, n, a, s, c) => {
96
+ }, [H, He]), tt = E(async (t, n, a, s, c) => {
97
97
  let u = e.getState().sandboxesByMode[a]?.sandboxId ?? null, d = async (e) => {
98
98
  if (Y.current.isFresh(e)) return !0;
99
99
  try {
@@ -130,114 +130,114 @@ var N = ({ visible: Ee = !0 }) => {
130
130
  We,
131
131
  W,
132
132
  X
133
- ]), Z = T(async (t, r = [], i = {}) => {
133
+ ]), Z = E(async (t, r = [], i = {}) => {
134
134
  let o = e.getState(), l = o.activeConversationId ?? I;
135
- if (l && (_(o.processingByConversationId[l]?.status) || et.current.has(l))) return;
135
+ if (l && (ee(o.processingByConversationId[l]?.status) || et.current.has(l))) return;
136
136
  let f = o.mode, p = I, h = p ? e.getState().conversations.find((e) => e.id === p) : void 0;
137
137
  if (p ? h && h.mode !== f && (h.messages.length > 0 || h.backendSessionId) ? p = B(void 0, f) : h && h.mode !== f && z(p, f) : p = B(void 0, f), !p) return;
138
138
  $e.current[p] = r;
139
- let g = ee(), v = {
139
+ let _ = S(), v = {
140
140
  accessToken: N(),
141
141
  workspaceToken: Ne(),
142
142
  userId: Pe,
143
- organizationId: y()
144
- }, b = {
145
- id: ke(),
143
+ organizationId: x()
144
+ }, y = {
145
+ id: Oe(),
146
146
  role: "user",
147
147
  content: t,
148
148
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
149
149
  metadata: {
150
150
  ...r.length ? { attachments: r.map(ae) } : {},
151
- ...w(i.dictated)
151
+ ...g(i.dictated)
152
152
  }
153
153
  };
154
- Ve(p, b);
155
- let x = ke();
154
+ Ve(p, y);
155
+ let b = Oe();
156
156
  Ve(p, {
157
- id: x,
157
+ id: b,
158
158
  role: "assistant",
159
159
  content: "",
160
160
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
161
161
  metadata: {
162
162
  lang: Le,
163
- ...w(i.dictated)
163
+ ...g(i.dictated)
164
164
  }
165
- }), H(p, "provisioning", x, null);
166
- let S = (e, t, n, r, a = Le) => {
167
- V(p, x, {
168
- content: Ae(e),
165
+ }), H(p, "provisioning", b, null);
166
+ let C = (e, t, n, r, a = Le) => {
167
+ V(p, b, {
168
+ content: ke(e),
169
169
  metadata: {
170
170
  lang: a,
171
171
  ...t?.length ? { artifacts: t } : {},
172
172
  ...t?.length || n || r ? { mode: f } : {},
173
173
  ...n ? { sessionId: n } : {},
174
174
  ...r ? { sandboxId: r } : {},
175
- ...w(i.dictated)
175
+ ...g(i.dictated)
176
176
  }
177
177
  });
178
- }, oe = async (e = 1) => {
178
+ }, w = async (e = 1) => {
179
179
  let o = !1;
180
180
  try {
181
- await n(M, g, v);
181
+ await n(M, _, v);
182
182
  } catch (e) {
183
- if (ue(e)) {
184
- de("ai-credits"), S("You've run out of AI credits for this billing cycle. Upgrade your plan to keep chatting.", void 0, void 0, void 0, "en"), H(p, "error", x, null);
183
+ if (de(e)) {
184
+ fe("ai-credits"), C("You've run out of AI credits for this billing cycle. Upgrade your plan to keep chatting.", void 0, void 0, void 0, "en"), H(p, "error", b, null);
185
185
  return;
186
186
  }
187
187
  console.warn("[assistant] AI-credit pre-flight check failed with a non-quota error; proceeding — gateway @usage(checkQuota) still enforces the real budget downstream", e);
188
188
  }
189
189
  try {
190
- let { sandboxId: e, sessionId: n } = await tt(p, x, f, g, v), l = (await c(M, e, g, n, v, 50).catch(() => [])).reduce((e, t) => Math.max(e, A(t)), 0);
191
- X(p, x, "streaming", "Thinking...");
192
- let h = pe(f, ne(t, r), Fe, Ie, i.dictated === !0), _ = te(h, r), y = ie(_), ee = y > 0, ae = m();
190
+ let { sandboxId: e, sessionId: n } = await tt(p, b, f, _, v), l = (await c(M, e, _, n, v, 50).catch(() => [])).reduce((e, t) => Math.max(e, Ae(t)), 0);
191
+ X(p, b, "streaming", "Thinking...");
192
+ let h = me(f, ne(t, r), Fe, Ie, i.dictated === !0), g = te(h, r), y = ie(g), ee = y > 0, x = m();
193
193
  o = re(r) > y;
194
194
  try {
195
- await d(M, e, g, n, h, f, ae, v, _);
195
+ await d(M, e, _, n, h, f, x, v, g);
196
196
  } catch (t) {
197
- if (!_ || !me(t)) throw t;
198
- await d(M, e, g, n, h, f, ae, v, void 0), o ||= ee;
197
+ if (!g || !he(t)) throw t;
198
+ await d(M, e, _, n, h, f, x, v, void 0), o ||= ee;
199
199
  }
200
- let b = je([], l), oe = Date.now() + (De[f] ?? Oe), C = Date.now(), se = Date.now();
201
- for (; Date.now() < oe && (b = je(await c(M, e, g, n, v, 50, l), l), V(p, x, { content: Ae(b.content) }), !b.done);) Date.now() - C > 3e4 && (await a(M, e, g, 600, v).catch(() => void 0), C = Date.now()), await new Promise((e) => setTimeout(e, ge(Date.now() - se)));
202
- if (!b.done && f !== "vibe-plugins") throw Error("Assistant response timed out while streaming progress");
203
- let ce = f === "vibe-plugins" ? await s(M, e, g, n, v).catch(() => []) : void 0;
204
- if (b.done || (b = {
205
- ...b,
206
- content: `${b.content}\n\n_Still building in the background — any artifacts below will finish shortly. Re-open this conversation to pick up the completed plugin._`
207
- }), o && (b = {
208
- ...b,
209
- content: `${b.content}\n\n${j("healthybowl.assistant.attachments.imagesNotSent", "_Your photo was too large to include with this message, so the answer above is from the text and the file link only. Try a smaller or more tightly cropped photo._")}`
210
- }), S(b.content, ce, n, e), b.tokens) {
211
- V(p, x, { tokens: b.tokens });
200
+ let S = je([], l), ae = Date.now() + (Ee[f] ?? De), w = Date.now(), T = Date.now();
201
+ for (; Date.now() < ae && (S = je(await c(M, e, _, n, v, 50, l), l), V(p, b, { content: ke(S.content) }), !S.done);) Date.now() - w > 3e4 && (await a(M, e, _, 600, v).catch(() => void 0), w = Date.now()), await new Promise((e) => setTimeout(e, _e(Date.now() - T)));
202
+ if (!S.done && f !== "vibe-plugins") throw Error("Assistant response timed out while streaming progress");
203
+ let oe = f === "vibe-plugins" ? await s(M, e, _, n, v).catch(() => []) : void 0;
204
+ if (S.done || (S = {
205
+ ...S,
206
+ content: `${S.content}\n\n_Still building in the background — any artifacts below will finish shortly. Re-open this conversation to pick up the completed plugin._`
207
+ }), o && (S = {
208
+ ...S,
209
+ content: `${S.content}\n\n${j("healthybowl.assistant.attachments.imagesNotSent", "_Your photo was too large to include with this message, so the answer above is from the text and the file link only. Try a smaller or more tightly cropped photo._")}`
210
+ }), C(S.content, oe, n, e), S.tokens) {
211
+ V(p, b, { tokens: S.tokens });
212
212
  try {
213
- await u(M, g, n, b.tokens, v), fe();
213
+ await u(M, _, n, S.tokens, v), pe();
214
214
  } catch {}
215
215
  }
216
- H(p, "complete", x, null);
216
+ H(p, "complete", b, null);
217
217
  } catch (t) {
218
- if (e === 1 && he(t)) return U(p), Ge(f), oe(2);
218
+ if (e === 1 && ge(t)) return U(p), Ge(f), w(2);
219
219
  throw t;
220
220
  }
221
- }, C = p;
222
- et.current.add(C);
221
+ }, T = p;
222
+ et.current.add(T);
223
223
  try {
224
- if (!g) throw Error("Assistant backend is unavailable without an active workspace context.");
225
- await oe();
224
+ if (!_) throw Error("Assistant backend is unavailable without an active workspace context.");
225
+ await w();
226
226
  } catch (t) {
227
- if (Y.current.invalidate(e.getState().sandboxesByMode[f]?.sandboxId ?? null), ue(t)) {
228
- de("sandbox"), S("You've reached your sandbox limit on the current plan. Upgrade to start the AI assistant.", void 0, void 0, void 0, "en"), H(p, "error", x, null);
227
+ if (Y.current.invalidate(e.getState().sandboxesByMode[f]?.sandboxId ?? null), de(t)) {
228
+ fe("sandbox"), C("You've reached your sandbox limit on the current plan. Upgrade to start the AI assistant.", void 0, void 0, void 0, "en"), H(p, "error", b, null);
229
229
  return;
230
230
  }
231
231
  let n = t instanceof Error ? t.message : "Something went wrong";
232
- H(p, "error", x, n), V(p, x, {
232
+ H(p, "error", b, n), V(p, b, {
233
233
  content: `Sorry, an error occurred: ${n}. Please try again.`,
234
234
  metadata: {
235
235
  lang: "en",
236
- ...w(i.dictated)
236
+ ...g(i.dictated)
237
237
  }
238
238
  });
239
239
  } finally {
240
- et.current.delete(C);
240
+ et.current.delete(T);
241
241
  }
242
242
  }, [
243
243
  I,
@@ -260,45 +260,45 @@ var N = ({ visible: Ee = !0 }) => {
260
260
  j,
261
261
  X,
262
262
  Pe
263
- ]), nt = T((e) => {
263
+ ]), nt = E((e) => {
264
264
  Z(e);
265
- }, [Z]), rt = T(() => {
266
- let e = [...G].reverse().find((e) => e.role === "user"), t = I ? $e.current[I] ?? [] : [];
265
+ }, [Z]), rt = E(() => {
266
+ let e = [...h(G)].reverse().find((e) => e.role === "user"), t = I ? $e.current[I] ?? [] : [];
267
267
  e && Z(e.content, t);
268
268
  }, [
269
269
  G,
270
270
  Z,
271
271
  I
272
- ]), it = O(Z);
273
- E(() => {
272
+ ]), it = k(Z);
273
+ D(() => {
274
274
  it.current = Z;
275
275
  }, [Z]);
276
- let Q = D(() => {
276
+ let Q = O(() => {
277
277
  if (q) return null;
278
278
  for (let e = G.length - 1; e >= 0; --e) {
279
279
  let t = G[e];
280
280
  if (t?.role !== "assistant") continue;
281
- let n = v(t.content).text.trim();
281
+ let n = b(t.content).text.trim();
282
282
  return n ? {
283
283
  id: t.id,
284
284
  text: n
285
285
  } : null;
286
286
  }
287
287
  return null;
288
- }, [G, q]), at = D(() => Q ? _e(Q.text) : null, [Q]), ot = D(() => ve(G), [G]), st = D(() => ye(G).filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
288
+ }, [G, q]), at = O(() => Q ? ve(Q.text) : null, [Q]), ot = O(() => h(G), [G]), st = O(() => _(G).filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
289
289
  id: e.id,
290
290
  role: e.role,
291
- text: v(e.content).text.trim()
292
- })).filter((e) => e.text.length > 0), [G]), $ = ce({
293
- onSubmit: T((e) => {
291
+ text: b(e.content).text.trim()
292
+ })).filter((e) => e.text.length > 0), [G]), $ = le({
293
+ onSubmit: E((e) => {
294
294
  it.current(e, [], { dictated: !0 });
295
295
  }, []),
296
296
  latestReply: Q,
297
- language: g(F, P).tag
297
+ language: y(F, P).tag
298
298
  });
299
- E(() => {
300
- !Ee && $.active && $.end();
301
- }, [Ee, $]), E(() => {
299
+ D(() => {
300
+ !Te && $.active && $.end();
301
+ }, [Te, $]), D(() => {
302
302
  let t = e.getState().consumePendingPrompt();
303
303
  return t && it.current(t), e.subscribe((t, n) => {
304
304
  if (t.pendingPrompt && t.pendingPrompt !== n.pendingPrompt) {
@@ -307,7 +307,7 @@ var N = ({ visible: Ee = !0 }) => {
307
307
  }
308
308
  });
309
309
  }, []);
310
- let ct = T((t) => {
310
+ let ct = E((t) => {
311
311
  let n = I ? e.getState().conversations.find((e) => e.id === I) : void 0;
312
312
  if (n && (n.messages.length > 0 || n.backendSessionId)) {
313
313
  if (n.mode !== t) {
@@ -322,40 +322,40 @@ var N = ({ visible: Ee = !0 }) => {
322
322
  Be,
323
323
  z,
324
324
  R
325
- ]), lt = T((t) => {
326
- if (S.find((e) => e.id === t)?.writeCapable && !e.getState().apiCallsAcknowledged) {
325
+ ]), lt = E((t) => {
326
+ if (T.find((e) => e.id === t)?.writeCapable && !e.getState().apiCallsAcknowledged) {
327
327
  Qe(t);
328
328
  return;
329
329
  }
330
330
  ct(t);
331
- }, [ct]), ut = T(() => {
331
+ }, [ct]), ut = E(() => {
332
332
  let e = Ze;
333
333
  Qe(null), Ke(), e && ct(e);
334
334
  }, [
335
335
  Ze,
336
336
  Ke,
337
337
  ct
338
- ]), dt = T(() => {
338
+ ]), dt = E(() => {
339
339
  Qe(null);
340
340
  }, []);
341
- return /* @__PURE__ */ Ce("div", {
341
+ return /* @__PURE__ */ Se("div", {
342
342
  className: "relative flex flex-1 flex-col overflow-hidden",
343
343
  children: [
344
- /* @__PURE__ */ Ce("div", {
344
+ /* @__PURE__ */ Se("div", {
345
345
  className: "contents",
346
346
  inert: $.active || void 0,
347
- children: [ot.length === 0 ? /* @__PURE__ */ k(oe, {
347
+ children: [ot.length === 0 ? /* @__PURE__ */ A(oe, {
348
348
  mode: L,
349
349
  onSuggestionClick: nt
350
- }) : /* @__PURE__ */ k("div", {
350
+ }) : /* @__PURE__ */ A("div", {
351
351
  className: "flex min-h-0 flex-1 flex-col",
352
- children: /* @__PURE__ */ k(b, {
352
+ children: /* @__PURE__ */ A(C, {
353
353
  messages: ot,
354
354
  streamingMessageId: qe,
355
355
  failedMessageId: Je,
356
356
  onRetry: rt
357
357
  })
358
- }), /* @__PURE__ */ k(C, {
358
+ }), /* @__PURE__ */ A(se, {
359
359
  onStartVoiceSession: $.available && L !== "api-calls" ? $.start : void 0,
360
360
  onSend: (e, t) => void Z(e, t),
361
361
  disabled: q,
@@ -365,7 +365,7 @@ var N = ({ visible: Ee = !0 }) => {
365
365
  onModeChange: lt
366
366
  })]
367
367
  }),
368
- $.active && /* @__PURE__ */ k(se, {
368
+ $.active && /* @__PURE__ */ A(ce, {
369
369
  session: $.session,
370
370
  notice: $.notice,
371
371
  capturing: $.capturing,
@@ -377,7 +377,7 @@ var N = ({ visible: Ee = !0 }) => {
377
377
  onToggleMute: $.toggleMute,
378
378
  onEnd: $.end
379
379
  }),
380
- /* @__PURE__ */ k(x, {
380
+ /* @__PURE__ */ A(w, {
381
381
  open: Ze !== null,
382
382
  onConfirm: ut,
383
383
  onCancel: dt