@burdenoff/microfe-healthybowl 2026.902.17 → 2026.902.19

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.
@@ -3,13 +3,14 @@ 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
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 { getActorId as x, getOrganizationId as S, getWorkspaceId as C } from "../../utils/assistantContext.js";
10
- import { buildPromptParts as te, buildPromptWithAttachments as ne, countInlineImageCandidates as re, countInlinedImageParts as ie, toMessageAttachment as ae } from "../../utils/assistantAttachments.js";
11
- import { AssistantMessageList as w } from "./AssistantMessageList.js";
12
- import { AssistantApiCallsConsentDialog as oe } from "./AssistantApiCallsConsentDialog.js";
6
+ import { resolveAssistantLanguage as v } from "../../config/assistantLanguages.js";
7
+ import { resolveLanguagePair as ee } from "../../config/assistantLanguagePair.js";
8
+ import { isTurnInFlight as te } from "../../utils/assistantTurnState.js";
9
+ import { parseToolActivity as y } from "./AssistantToolActivity.js";
10
+ import { getActorId as b, getOrganizationId as x, getWorkspaceId as S } from "../../utils/assistantContext.js";
11
+ import { buildPromptParts as ne, buildPromptWithAttachments as re, countInlineImageCandidates as ie, countInlinedImageParts as ae, toMessageAttachment as oe } from "../../utils/assistantAttachments.js";
12
+ import { AssistantMessageList as C } from "./AssistantMessageList.js";
13
+ import { AssistantApiCallsConsentDialog as w } from "./AssistantApiCallsConsentDialog.js";
13
14
  import { ASSISTANT_MODES as T } from "../../types/assistant.js";
14
15
  import { AssistantEmptyState as se } from "./AssistantEmptyState.js";
15
16
  import { AssistantComposer as ce } from "./composer/AssistantComposer.js";
@@ -81,90 +82,94 @@ function Ne(e) {
81
82
  }
82
83
  }
83
84
  var P = ({ visible: De = !0 }) => {
84
- let M = t(), N = Te("workspace"), { getAccessToken: P, getWorkspaceToken: Pe, userId: Fe } = Ee(), { locale: F } = Ce(), I = e((e) => e.assistantLanguage), Ie = O(() => y(I, F).english, [I, F]), Le = v(I) !== null, Re = O(() => y(I, F).code, [I, F]), { conversations: ze, activeConversationId: L, mode: R, processingByConversationId: Be, setMode: z, setConversationMode: B, setActiveConversation: Ve, createConversation: V, addMessage: He, updateMessage: Ue, patchMessage: H, setConversationProcessing: U, clearConversationProcessing: We, setBackendSessionId: Ge, clearBackendSessionId: W, setSandbox: G, clearSandbox: Ke, acknowledgeApiCalls: qe } = e(), K = ze.find((e) => e.id === L)?.messages ?? [], q = L ? Be[L] : void 0, J = ee(q?.status), Je = J ? q?.messageId ?? null : null, Ye = q?.status === "error" ? q.messageId : null, { canUseApiCalls: Y, loading: Xe } = de(S()), Ze = fe(x(), C() || null), Qe = O(() => T.filter((e) => !e.requiresAdmin || Y), [Y]), [$e, et] = Se(null), tt = k({}), X = k(xe()), nt = k(/* @__PURE__ */ new Set()), rt = O(() => T.find((e) => e.id === R), [R]);
85
+ let M = t(), N = Te("workspace"), { getAccessToken: P, getWorkspaceToken: Pe, userId: Fe } = Ee(), { locale: Ie } = Ce(), Le = e((e) => e.assistantLanguage), Re = e((e) => e.replyLanguage), ze = O(() => ee(Le, Re, Ie), [
86
+ Le,
87
+ Re,
88
+ Ie
89
+ ]), Be = ze.reply.english, Ve = ze.replyIsExplicit, He = ze.reply.code, { conversations: Ue, activeConversationId: F, mode: I, processingByConversationId: We, setMode: L, setConversationMode: R, setActiveConversation: Ge, createConversation: z, addMessage: Ke, updateMessage: qe, patchMessage: B, setConversationProcessing: V, clearConversationProcessing: Je, setBackendSessionId: Ye, clearBackendSessionId: H, setSandbox: U, clearSandbox: Xe, acknowledgeApiCalls: Ze } = e(), W = Ue.find((e) => e.id === F)?.messages ?? [], G = F ? We[F] : void 0, K = te(G?.status), Qe = K ? G?.messageId ?? null : null, $e = G?.status === "error" ? G.messageId : null, { canUseApiCalls: q, loading: et } = de(x()), tt = fe(b(), S() || null), nt = O(() => T.filter((e) => !e.requiresAdmin || q), [q]), [rt, it] = Se(null), at = k({}), J = k(xe()), ot = k(/* @__PURE__ */ new Set()), Y = O(() => T.find((e) => e.id === I), [I]);
85
90
  D(() => {
86
- Xe || (!rt || rt.requiresAdmin && !Y) && R !== "assistant" && z("assistant");
91
+ et || (!Y || Y.requiresAdmin && !q) && I !== "assistant" && L("assistant");
87
92
  }, [
88
- R,
89
- rt,
93
+ I,
90
94
  Y,
91
- Xe,
92
- z
95
+ q,
96
+ et,
97
+ L
93
98
  ]);
94
- let Z = E((e, t, n, r) => {
95
- U(e, n, t, null), r ? Ue(e, t, r) : Ue(e, t, Ne(n));
96
- }, [U, Ue]), it = E(async (t, n, a, s, c) => {
99
+ let X = E((e, t, n, r) => {
100
+ V(e, n, t, null), r ? qe(e, t, r) : qe(e, t, Ne(n));
101
+ }, [V, qe]), st = E(async (t, n, a, s, c) => {
97
102
  let u = e.getState().sandboxesByMode[a]?.sandboxId ?? null, d = async (e) => {
98
- if (X.current.isFresh(e)) return !0;
103
+ if (J.current.isFresh(e)) return !0;
99
104
  try {
100
- return await p(N, e, s, c, 3e5, (e) => Z(t, n, "provisioning", e)), await f(N, e, s, c, 9e4, (e) => Z(t, n, "connecting", e)), X.current.markVerified(e), !0;
105
+ return await p(N, e, s, c, 3e5, (e) => X(t, n, "provisioning", e)), await f(N, e, s, c, 9e4, (e) => X(t, n, "connecting", e)), J.current.markVerified(e), !0;
101
106
  } catch {
102
- return X.current.invalidate(e), !1;
107
+ return J.current.invalidate(e), !1;
103
108
  }
104
109
  };
105
- if (u && (G(a, u, "provisioning"), Z(t, n, "provisioning", "Reusing assistant environment..."), await d(u) || (G(a, null, "provisioning"), u = null)), !u) {
106
- Z(t, n, "provisioning", "Looking for existing environment...");
110
+ if (u && (U(a, u, "provisioning"), X(t, n, "provisioning", "Reusing assistant environment..."), await d(u) || (U(a, null, "provisioning"), u = null)), !u) {
111
+ X(t, n, "provisioning", "Looking for existing environment...");
107
112
  let e = await o(N, s, a, c);
108
- e && (G(a, e, "provisioning"), Z(t, n, "provisioning", "Reusing assistant environment..."), await d(e) ? u = e : G(a, null, "provisioning"));
113
+ e && (U(a, e, "provisioning"), X(t, n, "provisioning", "Reusing assistant environment..."), await d(e) ? u = e : U(a, null, "provisioning"));
109
114
  }
110
115
  if (!u) {
111
116
  if (a === "api-calls" && !P()) throw Error("API Calls mode requires an authenticated session. Please sign in again.");
112
- Z(t, n, "provisioning", "Starting assistant environment..."), G(a, null, "provisioning"), u = await r(N, a, s, c), G(a, u, "provisioning"), await p(N, u, s, c, 3e5, (e) => Z(t, n, "provisioning", e)), await f(N, u, s, c, 9e4, (e) => Z(t, n, "connecting", e));
117
+ X(t, n, "provisioning", "Starting assistant environment..."), U(a, null, "provisioning"), u = await r(N, a, s, c), U(a, u, "provisioning"), await p(N, u, s, c, 3e5, (e) => X(t, n, "provisioning", e)), await f(N, u, s, c, 9e4, (e) => X(t, n, "connecting", e));
113
118
  }
114
- G(a, u, "running");
119
+ U(a, u, "running");
115
120
  let m = e.getState().conversations.find((e) => e.id === t)?.backendSessionId ?? null;
116
121
  if (m) try {
117
122
  let e = await l(N, u, s, m, c);
118
123
  if (e.mode !== a) throw Error(`Session mode mismatch: expected ${a}, received ${e.mode}`);
119
124
  } catch {
120
- W(t), m = null;
125
+ H(t), m = null;
121
126
  }
122
- return m || (Z(t, n, "connecting", "Preparing session..."), m = (await i(N, u, s, a, c)).sessionId, Ge(t, m)), {
127
+ return m || (X(t, n, "connecting", "Preparing session..."), m = (await i(N, u, s, a, c)).sessionId, Ye(t, m)), {
123
128
  sandboxId: u,
124
129
  sessionId: m
125
130
  };
126
131
  }, [
127
132
  N,
128
- W,
133
+ H,
129
134
  P,
130
- Ge,
131
- G,
132
- Z
133
- ]), Q = E(async (t, r = [], i = {}) => {
134
- let o = e.getState(), l = o.activeConversationId ?? L;
135
- if (l && (ee(o.processingByConversationId[l]?.status) || nt.current.has(l))) return;
136
- let f = o.mode, p = L, h = p ? e.getState().conversations.find((e) => e.id === p) : void 0;
137
- if (p ? h && h.mode !== f && (h.messages.length > 0 || h.backendSessionId) ? p = V(void 0, f) : h && h.mode !== f && B(p, f) : p = V(void 0, f), !p) return;
138
- tt.current[p] = r;
139
- let _ = C(), v = {
135
+ Ye,
136
+ U,
137
+ X
138
+ ]), Z = E(async (t, r = [], i = {}) => {
139
+ let o = e.getState(), l = o.activeConversationId ?? F;
140
+ if (l && (te(o.processingByConversationId[l]?.status) || ot.current.has(l))) return;
141
+ let f = o.mode, p = F, h = p ? e.getState().conversations.find((e) => e.id === p) : void 0;
142
+ if (p ? h && h.mode !== f && (h.messages.length > 0 || h.backendSessionId) ? p = z(void 0, f) : h && h.mode !== f && R(p, f) : p = z(void 0, f), !p) return;
143
+ at.current[p] = r;
144
+ let _ = S(), v = {
140
145
  accessToken: P(),
141
146
  workspaceToken: Pe(),
142
147
  userId: Fe,
143
- organizationId: S()
144
- }, y = {
148
+ organizationId: x()
149
+ }, ee = {
145
150
  id: Ae(),
146
151
  role: "user",
147
152
  content: t,
148
153
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
149
154
  metadata: {
150
- ...r.length ? { attachments: r.map(ae) } : {},
155
+ ...r.length ? { attachments: r.map(oe) } : {},
151
156
  ...g(i.dictated)
152
157
  }
153
158
  };
154
- He(p, y);
155
- let b = Ae();
156
- He(p, {
157
- id: b,
159
+ Ke(p, ee);
160
+ let y = Ae();
161
+ Ke(p, {
162
+ id: y,
158
163
  role: "assistant",
159
164
  content: "",
160
165
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
161
166
  metadata: {
162
- lang: Re,
167
+ lang: He,
163
168
  ...g(i.dictated)
164
169
  }
165
- }), U(p, "provisioning", b, null);
166
- let x = (e, t, n, r, a = Re) => {
167
- H(p, b, {
170
+ }), V(p, "provisioning", y, null);
171
+ let b = (e, t, n, r, a = He) => {
172
+ B(p, y, {
168
173
  content: je(e),
169
174
  metadata: {
170
175
  lang: a,
@@ -175,61 +180,61 @@ var P = ({ visible: De = !0 }) => {
175
180
  ...g(i.dictated)
176
181
  }
177
182
  });
178
- }, w = async (e = 1) => {
183
+ }, C = async (e = 1) => {
179
184
  let o = !1;
180
185
  try {
181
186
  await n(N, _, v);
182
187
  } catch (e) {
183
188
  if (pe(e)) {
184
- me("ai-credits"), x("You've run out of AI credits for this billing cycle. Upgrade your plan to keep chatting.", void 0, void 0, void 0, "en"), U(p, "error", b, null);
189
+ me("ai-credits"), b("You've run out of AI credits for this billing cycle. Upgrade your plan to keep chatting.", void 0, void 0, void 0, "en"), V(p, "error", y, null);
185
190
  return;
186
191
  }
187
192
  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
193
  }
189
194
  try {
190
- let { sandboxId: e, sessionId: n } = await it(p, b, f, _, v), l = (await c(N, e, _, n, v, 50).catch(() => [])).reduce((e, t) => Math.max(e, j(t)), 0);
191
- Z(p, b, "streaming", "Thinking...");
192
- let h = ge(f, ne(t, r), Ie, Le, i.dictated === !0), g = te(h, r), y = ie(g), ee = y > 0, S = m();
193
- o = re(r) > y;
195
+ let { sandboxId: e, sessionId: n } = await st(p, y, f, _, v), l = (await c(N, e, _, n, v, 50).catch(() => [])).reduce((e, t) => Math.max(e, j(t)), 0);
196
+ X(p, y, "streaming", "Thinking...");
197
+ let h = ge(f, re(t, r), Be, Ve, i.dictated === !0), g = ne(h, r), ee = ae(g), te = ee > 0, x = m();
198
+ o = ie(r) > ee;
194
199
  try {
195
- await d(N, e, _, n, h, f, S, v, g);
200
+ await d(N, e, _, n, h, f, x, v, g);
196
201
  } catch (t) {
197
202
  if (!g || !_e(t)) throw t;
198
- await d(N, e, _, n, h, f, S, v, void 0), o ||= ee;
203
+ await d(N, e, _, n, h, f, x, v, void 0), o ||= te;
199
204
  }
200
- let C = Me([], l), ae = Date.now() + (Oe[f] ?? ke), w = Date.now(), oe = Date.now();
201
- for (; Date.now() < ae && (C = Me(await c(N, e, _, n, v, 50, l), l), H(p, b, { content: je(C.content) }), !C.done);) Date.now() - w > 3e4 && (await a(N, e, _, 600, v).catch(() => void 0), w = Date.now()), await new Promise((e) => setTimeout(e, ye(Date.now() - oe)));
202
- if (!C.done && f !== "vibe-plugins") throw Error("Assistant response timed out while streaming progress");
205
+ let S = Me([], l), oe = Date.now() + (Oe[f] ?? ke), C = Date.now(), w = Date.now();
206
+ for (; Date.now() < oe && (S = Me(await c(N, e, _, n, v, 50, l), l), B(p, y, { content: je(S.content) }), !S.done);) Date.now() - C > 3e4 && (await a(N, e, _, 600, v).catch(() => void 0), C = Date.now()), await new Promise((e) => setTimeout(e, ye(Date.now() - w)));
207
+ if (!S.done && f !== "vibe-plugins") throw Error("Assistant response timed out while streaming progress");
203
208
  let T = f === "vibe-plugins" ? await s(N, e, _, n, v).catch(() => []) : void 0;
204
- if (C.done || (C = {
205
- ...C,
206
- content: `${C.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 && (C = {
208
- ...C,
209
- content: `${C.content}\n\n${M("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
- }), x(C.content, T, n, e), C.tokens) {
211
- H(p, b, { tokens: C.tokens });
209
+ if (S.done || (S = {
210
+ ...S,
211
+ 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._`
212
+ }), o && (S = {
213
+ ...S,
214
+ content: `${S.content}\n\n${M("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._")}`
215
+ }), b(S.content, T, n, e), S.tokens) {
216
+ B(p, y, { tokens: S.tokens });
212
217
  try {
213
- await u(N, _, n, C.tokens, v), he();
218
+ await u(N, _, n, S.tokens, v), he();
214
219
  } catch {}
215
220
  }
216
- U(p, "complete", b, null);
221
+ V(p, "complete", y, null);
217
222
  } catch (t) {
218
- if (e === 1 && ve(t)) return W(p), Ke(f), w(2);
223
+ if (e === 1 && ve(t)) return H(p), Xe(f), C(2);
219
224
  throw t;
220
225
  }
221
- }, oe = p;
222
- nt.current.add(oe);
226
+ }, w = p;
227
+ ot.current.add(w);
223
228
  try {
224
229
  if (!_) throw Error("Assistant backend is unavailable without an active workspace context.");
225
- await w();
230
+ await C();
226
231
  } catch (t) {
227
- if (X.current.invalidate(e.getState().sandboxesByMode[f]?.sandboxId ?? null), pe(t)) {
228
- me("sandbox"), x("You've reached your sandbox limit on the current plan. Upgrade to start the AI assistant.", void 0, void 0, void 0, "en"), U(p, "error", b, null);
232
+ if (J.current.invalidate(e.getState().sandboxesByMode[f]?.sandboxId ?? null), pe(t)) {
233
+ me("sandbox"), b("You've reached your sandbox limit on the current plan. Upgrade to start the AI assistant.", void 0, void 0, void 0, "en"), V(p, "error", y, null);
229
234
  return;
230
235
  }
231
236
  let n = t instanceof Error ? t.message : "Something went wrong";
232
- U(p, "error", b, n), H(p, b, {
237
+ V(p, "error", y, n), B(p, y, {
233
238
  content: `Sorry, an error occurred: ${n}. Please try again.`,
234
239
  metadata: {
235
240
  lang: "en",
@@ -237,106 +242,106 @@ var P = ({ visible: De = !0 }) => {
237
242
  }
238
243
  });
239
244
  } finally {
240
- nt.current.delete(oe);
245
+ ot.current.delete(w);
241
246
  }
242
247
  }, [
243
- L,
244
- He,
245
- N,
246
- W,
248
+ F,
247
249
  Ke,
248
- ze,
249
- V,
250
- it,
250
+ N,
251
+ H,
252
+ Xe,
253
+ Ue,
254
+ z,
255
+ st,
251
256
  P,
252
257
  Pe,
253
- H,
254
- Le,
255
- Re,
256
- Ie,
257
- Ge,
258
258
  B,
259
- U,
259
+ Ve,
260
+ He,
261
+ Be,
262
+ Ye,
263
+ R,
264
+ V,
260
265
  M,
261
- Z,
266
+ X,
262
267
  Fe
263
- ]), at = E((e) => {
264
- Q(e);
265
- }, [Q]), ot = E(() => {
266
- let e = [...h(K)].reverse().find((e) => e.role === "user"), t = L ? tt.current[L] ?? [] : [];
267
- e && Q(e.content, t);
268
+ ]), ct = E((e) => {
269
+ Z(e);
270
+ }, [Z]), lt = E(() => {
271
+ let e = [...h(W)].reverse().find((e) => e.role === "user"), t = F ? at.current[F] ?? [] : [];
272
+ e && Z(e.content, t);
268
273
  }, [
269
- K,
270
- Q,
271
- L
272
- ]), st = k(Q);
274
+ W,
275
+ Z,
276
+ F
277
+ ]), Q = k(Z);
273
278
  D(() => {
274
- st.current = Q;
275
- }, [Q]);
276
- let ct = O(() => {
277
- if (J) return null;
278
- for (let e = K.length - 1; e >= 0; --e) {
279
- let t = K[e];
279
+ Q.current = Z;
280
+ }, [Z]);
281
+ let ut = O(() => {
282
+ if (K) return null;
283
+ for (let e = W.length - 1; e >= 0; --e) {
284
+ let t = W[e];
280
285
  if (t?.role !== "assistant") continue;
281
- let n = b(t.content).text.trim();
286
+ let n = y(t.content).text.trim();
282
287
  return n ? {
283
288
  id: t.id,
284
289
  text: n
285
290
  } : null;
286
291
  }
287
292
  return null;
288
- }, [K, J]), lt = O(() => ct ? be(ct.text) : null, [ct]), ut = O(() => h(K), [K]), dt = O(() => _(K).filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
293
+ }, [W, K]), dt = O(() => ut ? be(ut.text) : null, [ut]), ft = O(() => h(W), [W]), pt = O(() => _(W).filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
289
294
  id: e.id,
290
295
  role: e.role,
291
- text: b(e.content).text.trim()
292
- })).filter((e) => e.text.length > 0), [K]), $ = ue({
296
+ text: y(e.content).text.trim()
297
+ })).filter((e) => e.text.length > 0), [W]), $ = ue({
293
298
  onSubmit: E((e) => {
294
- st.current(e, [], { dictated: !0 });
299
+ Q.current(e, [], { dictated: !0 });
295
300
  }, []),
296
- latestReply: ct,
297
- language: y(I, F).tag
301
+ latestReply: ut,
302
+ language: v(Le, Ie).tag
298
303
  });
299
304
  D(() => {
300
305
  !De && $.active && $.end();
301
306
  }, [De, $]), D(() => {
302
307
  let t = e.getState().consumePendingPrompt();
303
- return t && st.current(t), e.subscribe((t, n) => {
308
+ return t && Q.current(t), e.subscribe((t, n) => {
304
309
  if (t.pendingPrompt && t.pendingPrompt !== n.pendingPrompt) {
305
310
  let t = e.getState().consumePendingPrompt();
306
- t && st.current(t);
311
+ t && Q.current(t);
307
312
  }
308
313
  });
309
314
  }, []);
310
- let ft = E((t) => {
311
- let n = L ? e.getState().conversations.find((e) => e.id === L) : void 0;
315
+ let mt = E((t) => {
316
+ let n = F ? e.getState().conversations.find((e) => e.id === F) : void 0;
312
317
  if (n && (n.messages.length > 0 || n.backendSessionId)) {
313
318
  if (n.mode !== t) {
314
319
  let n = e.getState().conversations.find((n) => n.mode === t && n.messages.length === 0 && !n.backendSessionId && !e.getState().processingByConversationId[n.id]);
315
- n ? Ve(n.id) : V(void 0, t);
320
+ n ? Ge(n.id) : z(void 0, t);
316
321
  }
317
- } else L && B(L, t);
318
- z(t);
322
+ } else F && R(F, t);
323
+ L(t);
319
324
  }, [
320
- L,
321
- V,
322
- Ve,
323
- B,
324
- z
325
- ]), pt = E((t) => {
325
+ F,
326
+ z,
327
+ Ge,
328
+ R,
329
+ L
330
+ ]), ht = E((t) => {
326
331
  if (T.find((e) => e.id === t)?.writeCapable && !e.getState().apiCallsAcknowledged) {
327
- et(t);
332
+ it(t);
328
333
  return;
329
334
  }
330
- ft(t);
331
- }, [ft]), mt = E(() => {
332
- let e = $e;
333
- et(null), qe(), e && ft(e);
335
+ mt(t);
336
+ }, [mt]), gt = E(() => {
337
+ let e = rt;
338
+ it(null), Ze(), e && mt(e);
334
339
  }, [
335
- $e,
336
- qe,
337
- ft
338
- ]), ht = E(() => {
339
- et(null);
340
+ rt,
341
+ Ze,
342
+ mt
343
+ ]), _t = E(() => {
344
+ it(null);
340
345
  }, []);
341
346
  return /* @__PURE__ */ we("div", {
342
347
  className: "relative flex flex-1 flex-col overflow-hidden",
@@ -344,26 +349,26 @@ var P = ({ visible: De = !0 }) => {
344
349
  /* @__PURE__ */ we("div", {
345
350
  className: "contents",
346
351
  inert: $.active || void 0,
347
- children: [ut.length === 0 ? /* @__PURE__ */ A(se, {
348
- mode: R,
349
- onSuggestionClick: at
352
+ children: [ft.length === 0 ? /* @__PURE__ */ A(se, {
353
+ mode: I,
354
+ onSuggestionClick: ct
350
355
  }) : /* @__PURE__ */ A("div", {
351
356
  className: "flex min-h-0 flex-1 flex-col",
352
- children: /* @__PURE__ */ A(w, {
353
- messages: ut,
354
- streamingMessageId: Je,
355
- failedMessageId: Ye,
356
- onRetry: ot
357
+ children: /* @__PURE__ */ A(C, {
358
+ messages: ft,
359
+ streamingMessageId: Qe,
360
+ failedMessageId: $e,
361
+ onRetry: lt
357
362
  })
358
363
  }), /* @__PURE__ */ A(ce, {
359
- onStartVoiceSession: $.available && R !== "api-calls" ? $.start : void 0,
360
- onSend: (e, t) => void Q(e, t),
361
- disabled: J,
362
- placeholder: R === "api-calls" ? M("healthybowl.assistant.chatArea.placeholderActions", "What would you like me to do?") : M("healthybowl.assistant.chatArea.placeholderGeneral", "Ask HealthyBowl anything…"),
363
- mode: R,
364
- writeAccessDenied: Ze === "denied" && !!rt?.writeCapable,
365
- availableModes: Qe,
366
- onModeChange: pt
364
+ onStartVoiceSession: $.available && I !== "api-calls" ? $.start : void 0,
365
+ onSend: (e, t) => void Z(e, t),
366
+ disabled: K,
367
+ placeholder: I === "api-calls" ? M("healthybowl.assistant.chatArea.placeholderActions", "What would you like me to do?") : M("healthybowl.assistant.chatArea.placeholderGeneral", "Ask HealthyBowl anything…"),
368
+ mode: I,
369
+ writeAccessDenied: tt === "denied" && !!Y?.writeCapable,
370
+ availableModes: nt,
371
+ onModeChange: ht
367
372
  })]
368
373
  }),
369
374
  $.active && /* @__PURE__ */ A(le, {
@@ -372,16 +377,16 @@ var P = ({ visible: De = !0 }) => {
372
377
  capturing: $.capturing,
373
378
  interrupting: $.interrupting,
374
379
  awaitingEndpoint: $.awaitingEndpoint,
375
- turns: dt,
380
+ turns: pt,
376
381
  onInterrupt: $.interrupt,
377
- spoken: lt,
382
+ spoken: dt,
378
383
  onToggleMute: $.toggleMute,
379
384
  onEnd: $.end
380
385
  }),
381
- /* @__PURE__ */ A(oe, {
382
- open: $e !== null,
383
- onConfirm: mt,
384
- onCancel: ht
386
+ /* @__PURE__ */ A(w, {
387
+ open: rt !== null,
388
+ onConfirm: gt,
389
+ onCancel: _t
385
390
  })
386
391
  ]
387
392
  });