@burdenoff/microfe-healthybowl 2026.829.1 → 2026.829.3

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.
@@ -2,35 +2,37 @@ 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 { isTurnInFlight as h } from "../../utils/assistantTurnState.js";
6
- import { getOrganizationId as g, getWorkspaceId as ee } from "../../utils/assistantContext.js";
7
- import { buildPromptParts as te, buildPromptWithAttachments as ne, countInlineImageCandidates as re, countInlinedImageParts as ie, toMessageAttachment as _ } from "../../utils/assistantAttachments.js";
8
- import { AssistantMessageList as v } from "./AssistantMessageList.js";
9
- import { AssistantApiCallsConsentDialog as y } from "./AssistantApiCallsConsentDialog.js";
10
- import { ASSISTANT_MODES as b } from "../../types/assistant.js";
11
- import { AssistantEmptyState as x } from "./AssistantEmptyState.js";
12
- import { AssistantComposer as S } from "./composer/AssistantComposer.js";
13
- import { useAssistantApiAccess as C } from "../../hooks/useAssistantApiAccess.js";
14
- import { isQuotaExhaustedError as w } from "../../utils/quotaUtils.js";
15
- import { dispatchAssistantQuotaExhausted as T, notifyAiCreditsUpdated as ae } from "../../utils/aiCredits.js";
16
- import { buildPromptForMode as oe } from "../../utils/assistantPrompt.js";
17
- import { isMultimodalBodyRejection as se, isRecoverableAssistantError as ce } from "../../utils/assistantTransportErrors.js";
18
- import { useCallback as E, useEffect as D, useMemo as le, useRef as O, useState as ue } from "react";
19
- import { jsx as k, jsxs as de } from "react/jsx-runtime";
20
- import { useGatewayClient as fe } from "@burdenoff/fe-libs/shared/graphql";
21
- import { useAuthToken as pe } from "@burdenoff/fe-libs/shared/providers/shell";
5
+ import { findAssistantLanguage as h, resolveAssistantLanguage as g } from "../../config/assistantLanguages.js";
6
+ import { isTurnInFlight as _ } from "../../utils/assistantTurnState.js";
7
+ import { getOrganizationId as v, getWorkspaceId as ee } from "../../utils/assistantContext.js";
8
+ import { buildPromptParts as te, buildPromptWithAttachments as ne, countInlineImageCandidates as re, countInlinedImageParts as ie, toMessageAttachment as y } from "../../utils/assistantAttachments.js";
9
+ import { AssistantMessageList as b } from "./AssistantMessageList.js";
10
+ import { AssistantApiCallsConsentDialog as x } from "./AssistantApiCallsConsentDialog.js";
11
+ import { ASSISTANT_MODES as S } from "../../types/assistant.js";
12
+ import { AssistantEmptyState as C } from "./AssistantEmptyState.js";
13
+ import { AssistantComposer as w } from "./composer/AssistantComposer.js";
14
+ import { useAssistantApiAccess as ae } from "../../hooks/useAssistantApiAccess.js";
15
+ import { isQuotaExhaustedError as oe } from "../../utils/quotaUtils.js";
16
+ import { dispatchAssistantQuotaExhausted as se, notifyAiCreditsUpdated as ce } from "../../utils/aiCredits.js";
17
+ import { buildPromptForMode as le } from "../../utils/assistantPrompt.js";
18
+ import { isMultimodalBodyRejection as ue, isRecoverableAssistantError as de } from "../../utils/assistantTransportErrors.js";
19
+ import { useCallback as T, useEffect as E, useMemo as D, useRef as O, useState as fe } from "react";
20
+ import { useI18n as pe } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
21
+ import { jsx as k, jsxs as me } from "react/jsx-runtime";
22
+ import { useGatewayClient as he } from "@burdenoff/fe-libs/shared/graphql";
23
+ import { useAuthToken as ge } from "@burdenoff/fe-libs/shared/providers/shell";
22
24
  import { getAssistantMedia as A } from "@burdenoff/fe-libs/shared/assistant";
23
25
  //#region src/components/assistant/AssistantChatArea.tsx
24
- var me = {
26
+ var _e = {
25
27
  general: 18e4,
26
28
  assistant: 18e4,
27
29
  "api-calls": 18e4,
28
30
  "vibe-plugins": 6e5
29
- }, he = 18e4;
30
- function ge() {
31
+ }, ve = 18e4;
32
+ function ye() {
31
33
  return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
32
34
  }
33
- function _e(e) {
35
+ function be(e) {
34
36
  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]");
35
37
  }
36
38
  function j(e) {
@@ -45,7 +47,7 @@ function N(e) {
45
47
  return t === "completed" ? `Completed: ${n}` : t === "failed" ? `Failed: ${n}` : `Running: ${n}`;
46
48
  });
47
49
  }
48
- function ve(e, t) {
50
+ function xe(e, t) {
49
51
  let n = e.filter((e) => e.info?.role === "assistant" && j(e) > t).sort((e, t) => j(e) - j(t));
50
52
  if (n.length === 0) return {
51
53
  content: "Thinking...",
@@ -62,7 +64,7 @@ function ve(e, t) {
62
64
  tokens: r.info?.tokens
63
65
  };
64
66
  }
65
- function ye(e) {
67
+ function Se(e) {
66
68
  switch (e) {
67
69
  case "provisioning": return "Starting assistant environment...";
68
70
  case "connecting": return "Connecting to assistant...";
@@ -71,247 +73,254 @@ function ye(e) {
71
73
  }
72
74
  }
73
75
  var P = () => {
74
- let A = t(), M = fe("workspace"), { getAccessToken: N, getWorkspaceToken: P, userId: be } = pe(), { conversations: xe, activeConversationId: F, mode: I, processingByConversationId: Se, setMode: L, setConversationMode: R, setActiveConversation: Ce, createConversation: z, addMessage: B, updateMessage: V, patchMessage: H, setConversationProcessing: U, clearConversationProcessing: we, setBackendSessionId: W, clearBackendSessionId: G, setSandbox: K, clearSandbox: Te, acknowledgeApiCalls: Ee } = e(), q = xe.find((e) => e.id === F)?.messages ?? [], J = F ? Se[F] : void 0, De = h(J?.status), Oe = De ? J?.messageId ?? null : null, ke = J?.status === "error" ? J.messageId : null, { canUseApiCalls: Y, loading: Ae } = C(g()), je = le(() => b.filter((e) => !e.requiresAdmin || Y), [Y]), [Me, Ne] = ue(null), Pe = O({}), Fe = O(/* @__PURE__ */ new Set());
75
- D(() => {
76
- if (Ae) return;
77
- let e = b.find((e) => e.id === I);
78
- (!e || e.requiresAdmin && !Y) && I !== "assistant" && L("assistant");
76
+ let A = t(), M = he("workspace"), { getAccessToken: N, getWorkspaceToken: P, userId: Ce } = ge(), { locale: F } = pe(), I = e((e) => e.assistantLanguage), we = D(() => g(I, F).english, [I, F]), Te = h(I) !== null, L = D(() => g(I, F).code, [I, F]), { conversations: Ee, activeConversationId: R, mode: z, processingByConversationId: De, setMode: B, setConversationMode: V, setActiveConversation: Oe, createConversation: H, addMessage: U, updateMessage: ke, patchMessage: W, setConversationProcessing: G, clearConversationProcessing: Ae, setBackendSessionId: je, clearBackendSessionId: K, setSandbox: q, clearSandbox: Me, acknowledgeApiCalls: Ne } = e(), J = Ee.find((e) => e.id === R)?.messages ?? [], Y = R ? De[R] : void 0, Pe = _(Y?.status), Fe = Pe ? Y?.messageId ?? null : null, Ie = Y?.status === "error" ? Y.messageId : null, { canUseApiCalls: X, loading: Le } = ae(v()), Re = D(() => S.filter((e) => !e.requiresAdmin || X), [X]), [ze, Be] = fe(null), Ve = O({}), He = O(/* @__PURE__ */ new Set());
77
+ E(() => {
78
+ if (Le) return;
79
+ let e = S.find((e) => e.id === z);
80
+ (!e || e.requiresAdmin && !X) && z !== "assistant" && B("assistant");
79
81
  }, [
80
- I,
81
- Y,
82
- Ae,
83
- L
82
+ z,
83
+ X,
84
+ Le,
85
+ B
84
86
  ]);
85
- let X = E((e, t, n, r) => {
86
- U(e, n, t, null), r ? V(e, t, r) : V(e, t, ye(n));
87
- }, [U, V]), Ie = E(async (t, n, a, s, c) => {
87
+ let Z = T((e, t, n, r) => {
88
+ G(e, n, t, null), r ? ke(e, t, r) : ke(e, t, Se(n));
89
+ }, [G, ke]), Ue = T(async (t, n, a, s, c) => {
88
90
  let u = e.getState().sandboxesByMode[a]?.sandboxId ?? null, d = async (e) => {
89
91
  try {
90
- return await p(M, e, s, c, 3e5, (e) => X(t, n, "provisioning", e)), await f(M, e, s, c, 9e4, (e) => X(t, n, "connecting", e)), !0;
92
+ return await p(M, e, s, c, 3e5, (e) => Z(t, n, "provisioning", e)), await f(M, e, s, c, 9e4, (e) => Z(t, n, "connecting", e)), !0;
91
93
  } catch {
92
94
  return !1;
93
95
  }
94
96
  };
95
- if (u && (K(a, u, "provisioning"), X(t, n, "provisioning", "Reusing assistant environment..."), await d(u) || (K(a, null, "provisioning"), u = null)), !u) {
96
- X(t, n, "provisioning", "Looking for existing environment...");
97
+ if (u && (q(a, u, "provisioning"), Z(t, n, "provisioning", "Reusing assistant environment..."), await d(u) || (q(a, null, "provisioning"), u = null)), !u) {
98
+ Z(t, n, "provisioning", "Looking for existing environment...");
97
99
  let e = await o(M, s, a, c);
98
- e && (K(a, e, "provisioning"), X(t, n, "provisioning", "Reusing assistant environment..."), await d(e) ? u = e : K(a, null, "provisioning"));
100
+ e && (q(a, e, "provisioning"), Z(t, n, "provisioning", "Reusing assistant environment..."), await d(e) ? u = e : q(a, null, "provisioning"));
99
101
  }
100
102
  if (!u) {
101
103
  if (a === "api-calls" && !N()) throw Error("API Calls mode requires an authenticated session. Please sign in again.");
102
- X(t, n, "provisioning", "Starting assistant environment..."), K(a, null, "provisioning"), u = await r(M, a, s, c), K(a, u, "provisioning"), await p(M, u, s, c, 3e5, (e) => X(t, n, "provisioning", e)), await f(M, u, s, c, 9e4, (e) => X(t, n, "connecting", e));
104
+ Z(t, n, "provisioning", "Starting assistant environment..."), q(a, null, "provisioning"), u = await r(M, a, s, c), q(a, u, "provisioning"), await p(M, u, s, c, 3e5, (e) => Z(t, n, "provisioning", e)), await f(M, u, s, c, 9e4, (e) => Z(t, n, "connecting", e));
103
105
  }
104
- K(a, u, "running");
106
+ q(a, u, "running");
105
107
  let m = e.getState().conversations.find((e) => e.id === t)?.backendSessionId ?? null;
106
108
  if (m) try {
107
109
  let e = await l(M, u, s, m, c);
108
110
  if (e.mode !== a) throw Error(`Session mode mismatch: expected ${a}, received ${e.mode}`);
109
111
  } catch {
110
- G(t), m = null;
112
+ K(t), m = null;
111
113
  }
112
- return m || (X(t, n, "connecting", "Preparing session..."), m = (await i(M, u, s, a, c)).sessionId, W(t, m)), {
114
+ return m || (Z(t, n, "connecting", "Preparing session..."), m = (await i(M, u, s, a, c)).sessionId, je(t, m)), {
113
115
  sandboxId: u,
114
116
  sessionId: m
115
117
  };
116
118
  }, [
117
119
  M,
118
- G,
119
- N,
120
- W,
121
120
  K,
122
- X
123
- ]), Z = E(async (t, r = []) => {
124
- let i = e.getState(), o = i.activeConversationId ?? F;
125
- if (o && (h(i.processingByConversationId[o]?.status) || Fe.current.has(o))) return;
126
- let l = i.mode, f = F, p = f ? e.getState().conversations.find((e) => e.id === f) : void 0;
127
- if (f ? p && p.mode !== l && (p.messages.length > 0 || p.backendSessionId) ? f = z(void 0, l) : p && p.mode !== l && R(f, l) : f = z(void 0, l), !f) return;
128
- Pe.current[f] = r;
129
- let v = ee(), y = {
121
+ N,
122
+ je,
123
+ q,
124
+ Z
125
+ ]), Q = T(async (t, r = []) => {
126
+ let i = e.getState(), o = i.activeConversationId ?? R;
127
+ if (o && (_(i.processingByConversationId[o]?.status) || He.current.has(o))) return;
128
+ let l = i.mode, f = R, p = f ? e.getState().conversations.find((e) => e.id === f) : void 0;
129
+ if (f ? p && p.mode !== l && (p.messages.length > 0 || p.backendSessionId) ? f = H(void 0, l) : p && p.mode !== l && V(f, l) : f = H(void 0, l), !f) return;
130
+ Ve.current[f] = r;
131
+ let h = ee(), g = {
130
132
  accessToken: N(),
131
133
  workspaceToken: P(),
132
- userId: be,
133
- organizationId: g()
134
+ userId: Ce,
135
+ organizationId: v()
134
136
  }, b = {
135
- id: ge(),
137
+ id: ye(),
136
138
  role: "user",
137
139
  content: t,
138
140
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
139
- metadata: r.length ? { attachments: r.map(_) } : void 0
141
+ metadata: r.length ? { attachments: r.map(y) } : void 0
140
142
  };
141
- B(f, b);
142
- let x = ge();
143
- B(f, {
143
+ U(f, b);
144
+ let x = ye();
145
+ U(f, {
144
146
  id: x,
145
147
  role: "assistant",
146
148
  content: "",
147
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
148
- }), U(f, "provisioning", x, null);
149
- let S = (e, t, n, r) => {
150
- H(f, x, {
151
- content: _e(e),
152
- metadata: t?.length || n || r ? {
153
- artifacts: t,
154
- mode: l,
155
- sessionId: n,
156
- sandboxId: r
157
- } : void 0
149
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
150
+ metadata: { lang: L }
151
+ }), G(f, "provisioning", x, null);
152
+ let S = (e, t, n, r, i = L) => {
153
+ W(f, x, {
154
+ content: be(e),
155
+ metadata: {
156
+ lang: i,
157
+ ...t?.length ? { artifacts: t } : {},
158
+ ...t?.length || n || r ? { mode: l } : {},
159
+ ...n ? { sessionId: n } : {},
160
+ ...r ? { sandboxId: r } : {}
161
+ }
158
162
  });
159
163
  }, C = async (e = 1) => {
160
164
  let i = !1;
161
165
  try {
162
- await n(M, v, y);
166
+ await n(M, h, g);
163
167
  } catch (e) {
164
- if (w(e)) {
165
- T("ai-credits"), S("You've run out of AI credits for this billing cycle. Upgrade your plan to keep chatting."), U(f, "error", x, null);
168
+ if (oe(e)) {
169
+ se("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"), G(f, "error", x, null);
166
170
  return;
167
171
  }
168
172
  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);
169
173
  }
170
174
  try {
171
- let { sandboxId: e, sessionId: n } = await Ie(f, x, l, v, y), o = (await c(M, e, v, n, y, 50).catch(() => [])).reduce((e, t) => Math.max(e, j(t)), 0);
172
- X(f, x, "streaming", "Thinking...");
173
- let p = oe(l, ne(t, r)), h = te(p, r), g = ie(h), ee = g > 0, _ = m();
174
- i = re(r) > g;
175
+ let { sandboxId: e, sessionId: n } = await Ue(f, x, l, h, g), o = (await c(M, e, h, n, g, 50).catch(() => [])).reduce((e, t) => Math.max(e, j(t)), 0);
176
+ Z(f, x, "streaming", "Thinking...");
177
+ let p = le(l, ne(t, r), we, Te), _ = te(p, r), v = ie(_), ee = v > 0, y = m();
178
+ i = re(r) > v;
175
179
  try {
176
- await d(M, e, v, n, p, l, _, y, h);
180
+ await d(M, e, h, n, p, l, y, g, _);
177
181
  } catch (t) {
178
- if (!h || !se(t)) throw t;
179
- await d(M, e, v, n, p, l, _, y, void 0), i ||= ee;
182
+ if (!_ || !ue(t)) throw t;
183
+ await d(M, e, h, n, p, l, y, g, void 0), i ||= ee;
180
184
  }
181
- let b = ve([], o), C = Date.now() + (me[l] ?? he), w = Date.now();
182
- for (; Date.now() < C && (b = ve(await c(M, e, v, n, y, 50), o), H(f, x, { content: _e(b.content) }), !b.done);) Date.now() - w > 3e4 && (await a(M, e, v, 600, y).catch(() => void 0), w = Date.now()), await new Promise((e) => setTimeout(e, 1500));
185
+ let b = xe([], o), C = Date.now() + (_e[l] ?? ve), w = Date.now();
186
+ for (; Date.now() < C && (b = xe(await c(M, e, h, n, g, 50), o), W(f, x, { content: be(b.content) }), !b.done);) Date.now() - w > 3e4 && (await a(M, e, h, 600, g).catch(() => void 0), w = Date.now()), await new Promise((e) => setTimeout(e, 1500));
183
187
  if (!b.done && l !== "vibe-plugins") throw Error("Assistant response timed out while streaming progress");
184
- let T = l === "vibe-plugins" ? await s(M, e, v, n, y).catch(() => []) : void 0;
188
+ let ae = l === "vibe-plugins" ? await s(M, e, h, n, g).catch(() => []) : void 0;
185
189
  if (b.done || (b = {
186
190
  ...b,
187
191
  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._`
188
192
  }), i && (b = {
189
193
  ...b,
190
194
  content: `${b.content}\n\n${A("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._")}`
191
- }), S(b.content, T, n, e), b.tokens) {
192
- H(f, x, { tokens: b.tokens });
195
+ }), S(b.content, ae, n, e), b.tokens) {
196
+ W(f, x, { tokens: b.tokens });
193
197
  try {
194
- await u(M, v, n, b.tokens, y), ae();
198
+ await u(M, h, n, b.tokens, g), ce();
195
199
  } catch {}
196
200
  }
197
- U(f, "complete", x, null);
201
+ G(f, "complete", x, null);
198
202
  } catch (t) {
199
- if (e === 1 && ce(t)) return G(f), Te(l), C(2);
203
+ if (e === 1 && de(t)) return K(f), Me(l), C(2);
200
204
  throw t;
201
205
  }
202
- }, E = f;
203
- Fe.current.add(E);
206
+ }, w = f;
207
+ He.current.add(w);
204
208
  try {
205
- if (!v) throw Error("Assistant backend is unavailable without an active workspace context.");
209
+ if (!h) throw Error("Assistant backend is unavailable without an active workspace context.");
206
210
  await C();
207
211
  } catch (e) {
208
- if (w(e)) {
209
- T("sandbox"), S("You've reached your sandbox limit on the current plan. Upgrade to start the AI assistant."), U(f, "error", x, null);
212
+ if (oe(e)) {
213
+ se("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"), G(f, "error", x, null);
210
214
  return;
211
215
  }
212
216
  let t = e instanceof Error ? e.message : "Something went wrong";
213
- U(f, "error", x, t), V(f, x, `Sorry, an error occurred: ${t}. Please try again.`);
217
+ G(f, "error", x, t), W(f, x, {
218
+ content: `Sorry, an error occurred: ${t}. Please try again.`,
219
+ metadata: { lang: "en" }
220
+ });
214
221
  } finally {
215
- Fe.current.delete(E);
222
+ He.current.delete(w);
216
223
  }
217
224
  }, [
218
- F,
219
- B,
225
+ R,
226
+ U,
220
227
  M,
221
- G,
222
- Te,
223
- xe,
224
- z,
225
- Ie,
228
+ K,
229
+ Me,
230
+ Ee,
231
+ H,
232
+ Ue,
226
233
  N,
227
234
  P,
228
- H,
229
235
  W,
230
- R,
231
- U,
232
- A,
233
- X,
236
+ Te,
237
+ L,
238
+ we,
239
+ je,
234
240
  V,
235
- be
236
- ]), Le = E((e) => {
237
- Z(e);
238
- }, [Z]), Re = E(() => {
239
- let e = [...q].reverse().find((e) => e.role === "user"), t = F ? Pe.current[F] ?? [] : [];
240
- e && Z(e.content, t);
241
- }, [
242
- q,
241
+ G,
242
+ A,
243
243
  Z,
244
- F
245
- ]), Q = O(Z);
246
- D(() => {
247
- Q.current = Z;
248
- }, [Z]), D(() => {
244
+ Ce
245
+ ]), We = T((e) => {
246
+ Q(e);
247
+ }, [Q]), Ge = T(() => {
248
+ let e = [...J].reverse().find((e) => e.role === "user"), t = R ? Ve.current[R] ?? [] : [];
249
+ e && Q(e.content, t);
250
+ }, [
251
+ J,
252
+ Q,
253
+ R
254
+ ]), Ke = O(Q);
255
+ E(() => {
256
+ Ke.current = Q;
257
+ }, [Q]), E(() => {
249
258
  let t = e.getState().consumePendingPrompt();
250
- return t && Q.current(t), e.subscribe((t, n) => {
259
+ return t && Ke.current(t), e.subscribe((t, n) => {
251
260
  if (t.pendingPrompt && t.pendingPrompt !== n.pendingPrompt) {
252
261
  let t = e.getState().consumePendingPrompt();
253
- t && Q.current(t);
262
+ t && Ke.current(t);
254
263
  }
255
264
  });
256
265
  }, []);
257
- let $ = E((t) => {
258
- let n = F ? e.getState().conversations.find((e) => e.id === F) : void 0;
266
+ let $ = T((t) => {
267
+ let n = R ? e.getState().conversations.find((e) => e.id === R) : void 0;
259
268
  if (n && (n.messages.length > 0 || n.backendSessionId)) {
260
269
  if (n.mode !== t) {
261
270
  let n = e.getState().conversations.find((n) => n.mode === t && n.messages.length === 0 && !n.backendSessionId && !e.getState().processingByConversationId[n.id]);
262
- n ? Ce(n.id) : z(void 0, t);
271
+ n ? Oe(n.id) : H(void 0, t);
263
272
  }
264
- } else F && R(F, t);
265
- L(t);
273
+ } else R && V(R, t);
274
+ B(t);
266
275
  }, [
267
- F,
268
- z,
269
- Ce,
270
276
  R,
271
- L
272
- ]), ze = E((t) => {
273
- if (b.find((e) => e.id === t)?.writeCapable && !e.getState().apiCallsAcknowledged) {
274
- Ne(t);
277
+ H,
278
+ Oe,
279
+ V,
280
+ B
281
+ ]), qe = T((t) => {
282
+ if (S.find((e) => e.id === t)?.writeCapable && !e.getState().apiCallsAcknowledged) {
283
+ Be(t);
275
284
  return;
276
285
  }
277
286
  $(t);
278
- }, [$]), Be = E(() => {
279
- let e = Me;
280
- Ne(null), Ee(), e && $(e);
287
+ }, [$]), Je = T(() => {
288
+ let e = ze;
289
+ Be(null), Ne(), e && $(e);
281
290
  }, [
282
- Me,
283
- Ee,
291
+ ze,
292
+ Ne,
284
293
  $
285
- ]), Ve = E(() => {
286
- Ne(null);
294
+ ]), Ye = T(() => {
295
+ Be(null);
287
296
  }, []);
288
- return /* @__PURE__ */ de("div", {
297
+ return /* @__PURE__ */ me("div", {
289
298
  className: "flex flex-1 flex-col overflow-hidden",
290
299
  children: [
291
- q.length === 0 ? /* @__PURE__ */ k(x, {
292
- mode: I,
293
- onSuggestionClick: Le
300
+ J.length === 0 ? /* @__PURE__ */ k(C, {
301
+ mode: z,
302
+ onSuggestionClick: We
294
303
  }) : /* @__PURE__ */ k("div", {
295
304
  className: "flex min-h-0 flex-1 flex-col",
296
- children: /* @__PURE__ */ k(v, {
297
- messages: q,
298
- streamingMessageId: Oe,
299
- failedMessageId: ke,
300
- onRetry: Re
305
+ children: /* @__PURE__ */ k(b, {
306
+ messages: J,
307
+ streamingMessageId: Fe,
308
+ failedMessageId: Ie,
309
+ onRetry: Ge
301
310
  })
302
311
  }),
303
- /* @__PURE__ */ k(S, {
304
- onSend: (e, t) => void Z(e, t),
305
- disabled: De,
306
- placeholder: I === "api-calls" ? A("healthybowl.assistant.chatArea.placeholderActions", "What would you like me to do?") : A("healthybowl.assistant.chatArea.placeholderGeneral", "Ask HealthyBowl anything…"),
307
- mode: I,
308
- availableModes: je,
309
- onModeChange: ze
312
+ /* @__PURE__ */ k(w, {
313
+ onSend: (e, t) => void Q(e, t),
314
+ disabled: Pe,
315
+ placeholder: z === "api-calls" ? A("healthybowl.assistant.chatArea.placeholderActions", "What would you like me to do?") : A("healthybowl.assistant.chatArea.placeholderGeneral", "Ask HealthyBowl anything…"),
316
+ mode: z,
317
+ availableModes: Re,
318
+ onModeChange: qe
310
319
  }),
311
- /* @__PURE__ */ k(y, {
312
- open: Me !== null,
313
- onConfirm: Be,
314
- onCancel: Ve
320
+ /* @__PURE__ */ k(x, {
321
+ open: ze !== null,
322
+ onConfirm: Je,
323
+ onCancel: Ye
315
324
  })
316
325
  ]
317
326
  });