@burdenoff/microfe-healthybowl 2026.904.23 → 2026.904.25

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 (33) hide show
  1. package/dist/components/assistant/AssistantChatArea.js +172 -172
  2. package/dist/components/assistant/AssistantChatArea.js.map +1 -1
  3. package/dist/components/assistant/composer/AssistantAttachmentButton.js +1 -2
  4. package/dist/components/assistant/composer/AssistantAttachmentChips.js +1 -2
  5. package/dist/components/assistant/composer/AssistantComposer.js +2 -187
  6. package/dist/components/assistant/composer/AssistantModeSelector.js +1 -2
  7. package/dist/components/assistant/composer/AssistantVoiceButton.js +1 -2
  8. package/dist/components/assistant/index.js +4 -4
  9. package/dist/healthybowl/offline/OfflineSyncProvider.js +79 -79
  10. package/dist/healthybowl/offline/OfflineSyncProvider.js.map +1 -1
  11. package/dist/healthybowl/pages/pest-management/AiPestDetectionPage.js +6 -6
  12. package/dist/healthybowl/pages/terrace/JournalEntryModal.js +1 -1
  13. package/dist/healthybowl/store/healthybowlStore.js +5 -5
  14. package/dist/healthybowl/utils/imageDownscale.js +2 -104
  15. package/dist/hooks/useAssistantAttachments.js +2 -244
  16. package/dist/utils/assistantAttachments.js +2 -2
  17. package/package.json +2 -2
  18. package/dist/components/assistant/composer/AssistantComposer.js.map +0 -1
  19. package/dist/components/assistant/composer/AssistantLanguageSelector.js +0 -2
  20. package/dist/components/assistant/voice/AssistantVoiceSessionButton.js +0 -2
  21. package/dist/healthybowl/utils/imageDownscale.js.map +0 -1
  22. package/dist/hooks/useAssistantAttachments.js.map +0 -1
  23. package/dist/hooks/useVoiceInput.js +0 -2
  24. package/dist/node_modules/fflate/esm/browser.js +0 -326
  25. package/dist/node_modules/fflate/esm/browser.js.map +0 -1
  26. package/dist/node_modules/pdfjs-dist/build/pdf.js +0 -16389
  27. package/dist/node_modules/pdfjs-dist/build/pdf.js.map +0 -1
  28. package/dist/node_modules/pdfjs-dist/build/pdf.worker.min.js +0 -52138
  29. package/dist/node_modules/pdfjs-dist/build/pdf.worker.min.js.map +0 -1
  30. package/dist/utils/documentExtract.js +0 -135
  31. package/dist/utils/documentExtract.js.map +0 -1
  32. package/dist/utils/documentText.js +0 -2
  33. package/dist/utils/speechVoices.js +0 -2
@@ -1,26 +1,26 @@
1
1
  import { useAssistantStore as e } from "../../store/assistantStore.js";
2
- import { createAssistantSandbox as t, createAssistantSession as n, extendAssistantSandboxTTL as r, findExistingSandbox as i, getAssistantArtifacts as a, getAssistantMessages as o, getAssistantSession as ee, reportAssistantAiTokenUsage as s, sendAssistantPromptAsync as c, waitForAssistantServiceReady as l, waitForSandboxReady as u } from "../../services/assistantApi.js";
3
- import { gatherPageContext as d } from "../../utils/pageContext.js";
4
- import { resolveAssistantLanguage as f } from "../../config/assistantLanguages.js";
5
- import { resolveLanguagePair as p } from "../../config/assistantLanguagePair.js";
6
- import { AssistantMessageList as m } from "./AssistantMessageList.js";
7
- import { AssistantApiCallsConsentDialog as h } from "./AssistantApiCallsConsentDialog.js";
8
- import { AssistantEmptyState as g } from "./AssistantEmptyState.js";
9
- import { AssistantSpokenTurnsNotice as _ } from "./AssistantSpokenTurnsNotice.js";
10
- import { VoiceTranscriptDrawer as v } from "./voice/VoiceTranscriptDrawer.js";
11
- import { getActorId as te, getOrganizationId as y, getWorkspaceId as ne } from "../../utils/assistantContext.js";
12
- import { buildPromptParts as re, buildPromptWithAttachments as ie, countInlineImageCandidates as ae, countInlinedImageParts as oe, getSendableAttachments as b, toMessageAttachment as x } from "../../utils/assistantAttachments.js";
13
- import { useAssistantAttachments as S } from "../../hooks/useAssistantAttachments.js";
14
- import { AssistantComposer as se } from "./composer/AssistantComposer.js";
15
- import { AssistantVoiceSession as ce } from "./voice/AssistantVoiceSession.js";
16
- import { parseToolActivity as le } from "./AssistantToolActivity.js";
17
- import { useVoiceSession as ue } from "../../hooks/useVoiceSession.js";
18
- import { useAssistantApiAccess as de } from "../../hooks/useAssistantApiAccess.js";
19
- import { useWorkspaceWriteAccess as fe } from "../../hooks/useWorkspaceWriteAccess.js";
20
- import { useConversationTurns as pe } from "../../hooks/useConversationTurns.js";
21
- import { dispatchAssistantQuotaExhausted as me, notifyAiCreditsUpdated as he } from "../../utils/aiCredits.js";
22
- import { isQuotaExhaustedError as ge } from "../../utils/quotaUtils.js";
23
- import { buildPromptForMode as _e } from "../../utils/assistantPrompt.js";
2
+ import { createAssistantSandbox as t, createAssistantSession as n, extendAssistantSandboxTTL as r, findExistingSandbox as i, getAssistantArtifacts as a, getAssistantMessages as o, getAssistantSession as s, reportAssistantAiTokenUsage as c, sendAssistantPromptAsync as l, waitForAssistantServiceReady as u, waitForSandboxReady as d } from "../../services/assistantApi.js";
3
+ import { gatherPageContext as f } from "../../utils/pageContext.js";
4
+ import { resolveAssistantLanguage as p } from "../../config/assistantLanguages.js";
5
+ import { resolveLanguagePair as m } from "../../config/assistantLanguagePair.js";
6
+ import { AssistantMessageList as h } from "./AssistantMessageList.js";
7
+ import { AssistantApiCallsConsentDialog as g } from "./AssistantApiCallsConsentDialog.js";
8
+ import { AssistantEmptyState as _ } from "./AssistantEmptyState.js";
9
+ import { AssistantSpokenTurnsNotice as v } from "./AssistantSpokenTurnsNotice.js";
10
+ import { VoiceTranscriptDrawer as y } from "./voice/VoiceTranscriptDrawer.js";
11
+ import { AssistantComposer as ee } from "./composer/AssistantComposer.js";
12
+ import { AssistantVoiceSession as b } from "./voice/AssistantVoiceSession.js";
13
+ import { parseToolActivity as x } from "./AssistantToolActivity.js";
14
+ import { useVoiceSession as te } from "../../hooks/useVoiceSession.js";
15
+ import { useAssistantApiAccess as S } from "../../hooks/useAssistantApiAccess.js";
16
+ import { useWorkspaceWriteAccess as ne } from "../../hooks/useWorkspaceWriteAccess.js";
17
+ import { useAssistantAttachments as re } from "../../hooks/useAssistantAttachments.js";
18
+ import { useConversationTurns as ie } from "../../hooks/useConversationTurns.js";
19
+ import { getActorId as ae, getOrganizationId as oe, getWorkspaceId as se } from "../../utils/assistantContext.js";
20
+ import { dispatchAssistantQuotaExhausted as ce, notifyAiCreditsUpdated as le } from "../../utils/aiCredits.js";
21
+ import { isQuotaExhaustedError as ue } from "../../utils/quotaUtils.js";
22
+ import { buildPromptForMode as de } from "../../utils/assistantPrompt.js";
23
+ import { buildPromptParts as fe, buildPromptWithAttachments as pe, countInlineImageCandidates as me, countInlinedImageParts as he, getSendableAttachments as ge, toMessageAttachment as _e } from "../../utils/assistantAttachments.js";
24
24
  import { isMultimodalBodyRejection as ve, isRecoverableAssistantError as ye } from "../../utils/assistantTransportErrors.js";
25
25
  import { isTurnInFlight as be } from "../../utils/assistantTurnState.js";
26
26
  import { ASSISTANT_MODES as xe } from "../../types/assistant.js";
@@ -66,18 +66,18 @@ function We(e, t) {
66
66
  content: "Thinking...",
67
67
  done: !1
68
68
  };
69
- let r = n[n.length - 1], i = A(r.parts), a = O(r.parts), o = j(r.parts), ee = Ce(r.parts), s = [
69
+ let r = n[n.length - 1], i = A(r.parts), a = O(r.parts), o = j(r.parts), s = Ce(r.parts), c = [
70
70
  i,
71
71
  ...a,
72
72
  ...o
73
- ].filter(Boolean).join("\n\n") || "Thinking...", c = r.info?.providerID, l = r.info?.modelID;
73
+ ].filter(Boolean).join("\n\n") || "Thinking...", l = r.info?.providerID, u = r.info?.modelID;
74
74
  return {
75
- content: s,
75
+ content: c,
76
76
  done: !!r.info?.time?.completed && (!!i || a.length > 0 || o.length > 0),
77
77
  tokens: r.info?.tokens,
78
78
  messageId: r.info?.id,
79
- ...c && l ? { model: `${c}/${l}` } : {},
80
- ...ee ? { pendingWrite: ee } : {}
79
+ ...l && u ? { model: `${l}/${u}` } : {},
80
+ ...s ? { pendingWrite: s } : {}
81
81
  };
82
82
  }
83
83
  function Ge(e) {
@@ -89,84 +89,84 @@ function Ge(e) {
89
89
  }
90
90
  }
91
91
  var Ke = ({ visible: Ce = !0 }) => {
92
- let O = Re(), A = Ie("workspace"), { getAccessToken: j, getWorkspaceToken: Ke, userId: qe } = Le(), { locale: Je } = Pe(), Ye = e((e) => e.assistantLanguage), Xe = e((e) => e.replyLanguage), Ze = T(() => p(Ye, Xe, Je), [
92
+ let O = Re(), A = Ie("workspace"), { getAccessToken: j, getWorkspaceToken: Ke, userId: qe } = Le(), { locale: Je } = Pe(), Ye = e((e) => e.assistantLanguage), Xe = e((e) => e.replyLanguage), Ze = T(() => m(Ye, Xe, Je), [
93
93
  Ye,
94
94
  Xe,
95
95
  Je
96
- ]), Qe = Ze.reply.english, $e = Ze.replyIsExplicit, et = Ze.reply.code, { conversations: tt, activeConversationId: M, mode: N, processingByConversationId: nt, setMode: P, setConversationMode: F, setActiveConversation: rt, createConversation: I, addMessage: L, updateMessage: it, patchMessage: R, mergeMessageMetadata: at, setConversationProcessing: z, clearConversationProcessing: ot, setBackendSessionId: st, clearBackendSessionId: B, setSandbox: V, clearSandbox: ct, acknowledgeApiCalls: lt } = e(), H = pe(tt.find((e) => e.id === M)), U = H.all, W = M ? nt[M] : void 0, G = be(W?.status), ut = G ? W?.messageId ?? null : null, dt = W?.status === "error" ? W.messageId : null, { canUseApiCalls: K, loading: ft } = de(y()), pt = fe(te(), ne() || null), mt = T(() => xe.filter((e) => !e.requiresAdmin || K), [K]), [ht, gt] = Ne(null), [_t, vt] = Ne(!1), yt = E({}), q = E(Me()), bt = E(/* @__PURE__ */ new Set()), xt = T(() => xe.find((e) => e.id === N), [N]);
96
+ ]), Qe = Ze.reply.english, $e = Ze.replyIsExplicit, et = Ze.reply.code, { conversations: tt, activeConversationId: M, mode: N, processingByConversationId: nt, setMode: P, setConversationMode: rt, setActiveConversation: it, createConversation: F, addMessage: I, updateMessage: at, patchMessage: L, mergeMessageMetadata: ot, setConversationProcessing: R, clearConversationProcessing: st, setBackendSessionId: ct, clearBackendSessionId: z, setSandbox: B, clearSandbox: lt, acknowledgeApiCalls: ut } = e(), V = ie(tt.find((e) => e.id === M)), dt = V.all, ft = M ? nt[M] : void 0, H = be(ft?.status), pt = H ? ft?.messageId ?? null : null, mt = ft?.status === "error" ? ft.messageId : null, { canUseApiCalls: U, loading: ht } = S(oe()), gt = ne(ae(), se() || null), _t = T(() => xe.filter((e) => !e.requiresAdmin || U), [U]), [vt, yt] = Ne(null), [bt, xt] = Ne(!1), St = E({}), W = E(Me()), Ct = E(/* @__PURE__ */ new Set()), G = T(() => xe.find((e) => e.id === N), [N]);
97
97
  w(() => {
98
- ft || (!xt || xt.requiresAdmin && !K) && N !== "assistant" && P("assistant");
98
+ ht || (!G || G.requiresAdmin && !U) && N !== "assistant" && P("assistant");
99
99
  }, [
100
100
  N,
101
- xt,
102
- K,
103
- ft,
101
+ G,
102
+ U,
103
+ ht,
104
104
  P
105
105
  ]);
106
- let J = C((e, t, n, r) => {
107
- z(e, n, t, null), r ? it(e, t, r) : it(e, t, Ge(n));
108
- }, [z, it]), St = C(async (r, a, o, s, c) => {
109
- let d = e.getState().sandboxesByMode[o]?.sandboxId ?? null, f = async (e) => {
110
- if (q.current.isFresh(e)) return !0;
106
+ let K = C((e, t, n, r) => {
107
+ R(e, n, t, null), r ? at(e, t, r) : at(e, t, Ge(n));
108
+ }, [R, at]), wt = C(async (r, a, o, c, l) => {
109
+ let f = e.getState().sandboxesByMode[o]?.sandboxId ?? null, p = async (e) => {
110
+ if (W.current.isFresh(e)) return !0;
111
111
  try {
112
- return await u(A, e, s, c, 3e5, (e) => J(r, a, "provisioning", e)), await l(A, e, s, c, 9e4, (e) => J(r, a, "connecting", e)), q.current.markVerified(e), !0;
112
+ return await d(A, e, c, l, 3e5, (e) => K(r, a, "provisioning", e)), await u(A, e, c, l, 9e4, (e) => K(r, a, "connecting", e)), W.current.markVerified(e), !0;
113
113
  } catch {
114
- return q.current.invalidate(e), !1;
114
+ return W.current.invalidate(e), !1;
115
115
  }
116
116
  };
117
- if (d && (V(o, d, "provisioning"), J(r, a, "provisioning", "Reusing assistant environment..."), await f(d) || (V(o, null, "provisioning"), d = null)), !d) {
118
- J(r, a, "provisioning", "Looking for existing environment...");
119
- let e = await i(A, s, o, c);
120
- e && (V(o, e, "provisioning"), J(r, a, "provisioning", "Reusing assistant environment..."), await f(e) ? d = e : V(o, null, "provisioning"));
117
+ if (f && (B(o, f, "provisioning"), K(r, a, "provisioning", "Reusing assistant environment..."), await p(f) || (B(o, null, "provisioning"), f = null)), !f) {
118
+ K(r, a, "provisioning", "Looking for existing environment...");
119
+ let e = await i(A, c, o, l);
120
+ e && (B(o, e, "provisioning"), K(r, a, "provisioning", "Reusing assistant environment..."), await p(e) ? f = e : B(o, null, "provisioning"));
121
121
  }
122
- if (!d) {
122
+ if (!f) {
123
123
  if (o === "api-calls" && !j()) throw Error("API Calls mode requires an authenticated session. Please sign in again.");
124
- J(r, a, "provisioning", "Starting assistant environment..."), V(o, null, "provisioning"), d = await t(A, o, s, c), V(o, d, "provisioning"), await u(A, d, s, c, 3e5, (e) => J(r, a, "provisioning", e)), await l(A, d, s, c, 9e4, (e) => J(r, a, "connecting", e));
124
+ K(r, a, "provisioning", "Starting assistant environment..."), B(o, null, "provisioning"), f = await t(A, o, c, l), B(o, f, "provisioning"), await d(A, f, c, l, 3e5, (e) => K(r, a, "provisioning", e)), await u(A, f, c, l, 9e4, (e) => K(r, a, "connecting", e));
125
125
  }
126
- V(o, d, "running");
127
- let p = e.getState().conversations.find((e) => e.id === r)?.backendSessionId ?? null;
128
- if (p) try {
129
- let e = await ee(A, d, s, p, c);
126
+ B(o, f, "running");
127
+ let m = e.getState().conversations.find((e) => e.id === r)?.backendSessionId ?? null;
128
+ if (m) try {
129
+ let e = await s(A, f, c, m, l);
130
130
  if (e.mode !== o) throw Error(`Session mode mismatch: expected ${o}, received ${e.mode}`);
131
131
  } catch {
132
- B(r), p = null;
132
+ z(r), m = null;
133
133
  }
134
- return p || (J(r, a, "connecting", "Preparing session..."), p = (await n(A, d, s, o, c)).sessionId, st(r, p)), {
135
- sandboxId: d,
136
- sessionId: p
134
+ return m || (K(r, a, "connecting", "Preparing session..."), m = (await n(A, f, c, o, l)).sessionId, ct(r, m)), {
135
+ sandboxId: f,
136
+ sessionId: m
137
137
  };
138
138
  }, [
139
139
  A,
140
- B,
140
+ z,
141
141
  j,
142
- st,
143
- V,
144
- J
145
- ]), Y = C(async (t, n = [], i = {}) => {
146
- let ee = i.voiceSessionId !== void 0, l = e.getState(), u = l.activeConversationId ?? M;
147
- if (u && (be(l.processingByConversationId[u]?.status) || bt.current.has(u))) return;
148
- let f = l.mode, p = M, m = p ? e.getState().conversations.find((e) => e.id === p) : void 0;
149
- if (p ? m && m.mode !== f && (m.messages.length > 0 || m.backendSessionId) ? p = I(void 0, f) : m && m.mode !== f && F(p, f) : p = I(void 0, f), !p) return;
150
- yt.current[p] = n;
151
- let h = ne(), g = {
142
+ ct,
143
+ B,
144
+ K
145
+ ]), q = C(async (t, n = [], i = {}) => {
146
+ let s = i.voiceSessionId !== void 0, u = e.getState(), d = u.activeConversationId ?? M;
147
+ if (d && (be(u.processingByConversationId[d]?.status) || Ct.current.has(d))) return;
148
+ let p = u.mode, m = M, h = m ? e.getState().conversations.find((e) => e.id === m) : void 0;
149
+ if (m ? h && h.mode !== p && (h.messages.length > 0 || h.backendSessionId) ? m = F(void 0, p) : h && h.mode !== p && rt(m, p) : m = F(void 0, p), !m) return;
150
+ St.current[m] = n;
151
+ let g = se(), _ = {
152
152
  accessToken: j(),
153
153
  workspaceToken: Ke(),
154
154
  userId: qe,
155
- organizationId: y()
156
- }, _ = {
155
+ organizationId: oe()
156
+ }, v = {
157
157
  id: Ue(),
158
158
  role: "user",
159
159
  content: t,
160
160
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
161
161
  metadata: {
162
- ...n.length ? { attachments: n.map(x) } : {},
162
+ ...n.length ? { attachments: n.map(_e) } : {},
163
163
  ...Ae(i.voiceSessionId)
164
164
  }
165
165
  };
166
- L(p, _);
167
- let v = Ue();
168
- L(p, {
169
- id: v,
166
+ I(m, v);
167
+ let y = Ue();
168
+ I(m, {
169
+ id: y,
170
170
  role: "assistant",
171
171
  content: "",
172
172
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
@@ -174,12 +174,12 @@ var Ke = ({ visible: Ce = !0 }) => {
174
174
  lang: et,
175
175
  ...Ae(i.voiceSessionId)
176
176
  }
177
- }), z(p, "provisioning", v, null);
178
- let te = (e, t, n, r, a = et) => {
179
- R(p, v, { content: ze(e) }), at(p, v, {
177
+ }), R(m, "provisioning", y, null);
178
+ let ee = (e, t, n, r, a = et) => {
179
+ L(m, y, { content: ze(e) }), ot(m, y, {
180
180
  lang: a,
181
181
  ...t?.length ? { artifacts: t } : {},
182
- ...t?.length || n || r ? { mode: f } : {},
182
+ ...t?.length || n || r ? { mode: p } : {},
183
183
  ...n ? { sessionId: n } : {},
184
184
  ...r ? { sandboxId: r } : {},
185
185
  ...Ae(i.voiceSessionId)
@@ -187,108 +187,108 @@ var Ke = ({ visible: Ce = !0 }) => {
187
187
  }, b = async (e = 1) => {
188
188
  let i = !1;
189
189
  try {
190
- let { sandboxId: e, sessionId: l } = await St(p, v, f, h, g), u = (await o(A, e, h, l, g, 50).catch(() => [])).reduce((e, t) => Math.max(e, k(t)), 0);
191
- J(p, v, "streaming", "Thinking...");
192
- let m = _e(f, ie(t, n), Qe, $e, ee), _ = re(m, n), y = oe(_), ne = y > 0, b = d();
193
- i = ae(n) > y;
190
+ let { sandboxId: e, sessionId: u } = await wt(m, y, p, g, _), d = (await o(A, e, g, u, _, 50).catch(() => [])).reduce((e, t) => Math.max(e, k(t)), 0);
191
+ K(m, y, "streaming", "Thinking...");
192
+ let h = de(p, pe(t, n), Qe, $e, s), v = fe(h, n), b = he(v), x = b > 0, te = f();
193
+ i = me(n) > b;
194
194
  try {
195
- await c(A, e, h, l, m, f, b, g, _);
195
+ await l(A, e, g, u, h, p, te, _, v);
196
196
  } catch (t) {
197
- if (!_ || !ve(t)) throw t;
198
- await c(A, e, h, l, m, f, b, g, void 0), i ||= ne;
197
+ if (!v || !ve(t)) throw t;
198
+ await l(A, e, g, u, h, p, te, _, void 0), i ||= x;
199
199
  }
200
- let x = We([], u), S = Date.now() + (Be[f] ?? Ve), se = Date.now(), ce = Date.now();
201
- for (; Date.now() < S && (x = We(await o(A, e, h, l, g, 50, u), u), R(p, v, { content: ze(x.content) }), x.pendingWrite && at(p, v, { pendingWrite: x.pendingWrite }), !x.done);) Date.now() - se > 3e4 && (await r(A, e, h, 600, g).catch(() => void 0), se = Date.now()), await new Promise((e) => setTimeout(e, Se(Date.now() - ce)));
202
- if (!x.done && f !== "vibe-plugins") throw Error("Assistant response timed out while streaming progress");
203
- let le = f === "vibe-plugins" ? await a(A, e, h, l, g).catch(() => []) : void 0;
204
- if (x.done || (x = {
205
- ...x,
206
- content: `${x.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
- }), i && (x = {
208
- ...x,
209
- content: `${x.content}\n\n${O("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
- }), te(x.content, le, l, e), x.tokens) {
211
- R(p, v, { tokens: x.tokens });
200
+ let S = We([], d), ne = Date.now() + (Be[p] ?? Ve), re = Date.now(), ie = Date.now();
201
+ for (; Date.now() < ne && (S = We(await o(A, e, g, u, _, 50, d), d), L(m, y, { content: ze(S.content) }), S.pendingWrite && ot(m, y, { pendingWrite: S.pendingWrite }), !S.done);) Date.now() - re > 3e4 && (await r(A, e, g, 600, _).catch(() => void 0), re = Date.now()), await new Promise((e) => setTimeout(e, Se(Date.now() - ie)));
202
+ if (!S.done && p !== "vibe-plugins") throw Error("Assistant response timed out while streaming progress");
203
+ let ae = p === "vibe-plugins" ? await a(A, e, g, u, _).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
+ }), i && (S = {
208
+ ...S,
209
+ content: `${S.content}\n\n${O("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
+ }), ee(S.content, ae, u, e), S.tokens) {
211
+ L(m, y, { tokens: S.tokens });
212
212
  try {
213
- await s(A, h, l, x.messageId, x.model, x.tokens, g), he();
213
+ await c(A, g, u, S.messageId, S.model, S.tokens, _), le();
214
214
  } catch {}
215
215
  }
216
- z(p, "complete", v, null);
216
+ R(m, "complete", y, null);
217
217
  } catch (t) {
218
- if (e === 1 && ye(t)) return B(p), ct(f), b(2);
218
+ if (e === 1 && ye(t)) return z(m), lt(p), b(2);
219
219
  throw t;
220
220
  }
221
- }, S = p;
222
- bt.current.add(S);
221
+ }, x = m;
222
+ Ct.current.add(x);
223
223
  try {
224
- if (!h) throw Error("Assistant backend is unavailable without an active workspace context.");
224
+ if (!g) throw Error("Assistant backend is unavailable without an active workspace context.");
225
225
  await b();
226
226
  } catch (t) {
227
- if (q.current.invalidate(e.getState().sandboxesByMode[f]?.sandboxId ?? null), ge(t)) {
228
- me("sandbox"), te("You've reached your sandbox limit on the current plan. Upgrade to start the AI assistant.", void 0, void 0, void 0, "en"), z(p, "error", v, null);
227
+ if (W.current.invalidate(e.getState().sandboxesByMode[p]?.sandboxId ?? null), ue(t)) {
228
+ ce("sandbox"), ee("You've reached your sandbox limit on the current plan. Upgrade to start the AI assistant.", void 0, void 0, void 0, "en"), R(m, "error", y, null);
229
229
  return;
230
230
  }
231
231
  let n = t instanceof Error ? t.message : "Something went wrong";
232
- z(p, "error", v, n), R(p, v, { content: `Sorry, an error occurred: ${n}. Please try again.` }), at(p, v, {
232
+ R(m, "error", y, n), L(m, y, { content: `Sorry, an error occurred: ${n}. Please try again.` }), ot(m, y, {
233
233
  lang: "en",
234
234
  ...Ae(i.voiceSessionId)
235
235
  });
236
236
  } finally {
237
- bt.current.delete(S);
237
+ Ct.current.delete(x);
238
238
  }
239
239
  }, [
240
240
  M,
241
- L,
241
+ I,
242
242
  A,
243
- B,
244
- ct,
243
+ z,
244
+ lt,
245
245
  tt,
246
- I,
247
- St,
246
+ F,
247
+ wt,
248
248
  j,
249
249
  Ke,
250
- R,
250
+ L,
251
251
  $e,
252
252
  et,
253
253
  Qe,
254
- st,
255
- F,
256
- z,
254
+ ct,
255
+ rt,
256
+ R,
257
257
  O,
258
- J,
258
+ K,
259
259
  qe
260
- ]), Ct = C((e) => {
261
- Y(e);
262
- }, [Y]), wt = C(() => {
263
- let e = [...H.chat].reverse().find((e) => e.role === "user"), t = M ? yt.current[M] ?? [] : [];
264
- e && Y(e.content, t);
260
+ ]), Tt = C((e) => {
261
+ q(e);
262
+ }, [q]), Et = C(() => {
263
+ let e = [...V.chat].reverse().find((e) => e.role === "user"), t = M ? St.current[M] ?? [] : [];
264
+ e && q(e.content, t);
265
265
  }, [
266
- U,
267
- Y,
266
+ dt,
267
+ q,
268
268
  M
269
- ]), Tt = E(Y);
269
+ ]), J = E(q);
270
270
  w(() => {
271
- Tt.current = Y;
272
- }, [Y]);
273
- let Et = T(() => {
274
- if (G) return null;
275
- for (let e = U.length - 1; e >= 0; --e) {
276
- let t = U[e];
271
+ J.current = q;
272
+ }, [q]);
273
+ let Y = T(() => {
274
+ if (H) return null;
275
+ for (let e = dt.length - 1; e >= 0; --e) {
276
+ let t = dt[e];
277
277
  if (t?.role !== "assistant" || !ke(t)) continue;
278
- let n = le(t.content).text.trim();
278
+ let n = x(t.content).text.trim();
279
279
  return n ? {
280
280
  id: t.id,
281
281
  text: n
282
282
  } : null;
283
283
  }
284
284
  return null;
285
- }, [U, G]), Dt = T(() => Et ? we(Et.text) : null, [Et]), Ot = H.chat, X = T(() => H.voice.filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
285
+ }, [dt, H]), Dt = T(() => Y ? we(Y.text) : null, [Y]), Ot = V.chat, X = T(() => V.voice.filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
286
286
  id: e.id,
287
287
  role: e.role,
288
- text: le(e.content).text.trim(),
288
+ text: x(e.content).text.trim(),
289
289
  sessionId: je(e),
290
290
  timestamp: e.timestamp
291
- })).filter((e) => e.text.length > 0), [H.voice]), kt = C(() => {
291
+ })).filter((e) => e.text.length > 0), [V.voice]), kt = C(() => {
292
292
  if (X.length === 0) return;
293
293
  let e = /* @__PURE__ */ new Date();
294
294
  Oe(Ee(X, {
@@ -299,13 +299,13 @@ var Ke = ({ visible: Ce = !0 }) => {
299
299
  you: O("voiceSession.speakerYou", "You"),
300
300
  assistant: O("voiceSession.speakerAssistant", "Assistant")
301
301
  }, e), De(e), "text/markdown");
302
- }, [X, O]), Z = S(), Q = E(Z);
302
+ }, [X, O]), Z = re(), Q = E(Z);
303
303
  Q.current = Z;
304
- let $ = ue({
304
+ let $ = te({
305
305
  onSubmit: C((e, t) => {
306
306
  let n = () => {
307
- let n = Q.current, r = b(n.attachments);
308
- Tt.current(e, r, { voiceSessionId: t }), n.clear();
307
+ let n = Q.current, r = ge(n.attachments);
308
+ J.current(e, r, { voiceSessionId: t }), n.clear();
309
309
  };
310
310
  if (!Q.current.isBusy) {
311
311
  n();
@@ -315,11 +315,11 @@ var Ke = ({ visible: Ce = !0 }) => {
315
315
  Q.current.isBusy && Date.now() - r < He || (window.clearInterval(i), n());
316
316
  }, 200);
317
317
  }, []),
318
- latestReply: Et,
319
- language: f(Ye, Je).tag
318
+ latestReply: Y,
319
+ language: p(Ye, Je).tag
320
320
  }), At = C(() => {
321
321
  let t = e.getState().activeConversationId;
322
- !t || X.length === 0 || (L(t, {
322
+ !t || X.length === 0 || (I(t, {
323
323
  id: Ue(),
324
324
  role: "system",
325
325
  content: Te(X, {
@@ -328,10 +328,10 @@ var Ke = ({ visible: Ce = !0 }) => {
328
328
  more: (e) => O("voiceSession.continuedMore", "…and {{count}} more", { count: e })
329
329
  }),
330
330
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
331
- }), vt(!1), $.end());
331
+ }), xt(!1), $.end());
332
332
  }, [
333
333
  X,
334
- L,
334
+ I,
335
335
  O
336
336
  ]);
337
337
  w(() => {
@@ -340,10 +340,10 @@ var Ke = ({ visible: Ce = !0 }) => {
340
340
  $.active || Q.current.clear();
341
341
  }, [$.active]), w(() => {
342
342
  let t = e.getState().consumePendingPrompt();
343
- return t && Tt.current(t), e.subscribe((t, n) => {
343
+ return t && J.current(t), e.subscribe((t, n) => {
344
344
  if (t.pendingPrompt && t.pendingPrompt !== n.pendingPrompt) {
345
345
  let t = e.getState().consumePendingPrompt();
346
- t && Tt.current(t);
346
+ t && J.current(t);
347
347
  }
348
348
  });
349
349
  }, []);
@@ -352,31 +352,31 @@ var Ke = ({ visible: Ce = !0 }) => {
352
352
  if (n && (n.messages.length > 0 || n.backendSessionId)) {
353
353
  if (n.mode !== t) {
354
354
  let n = e.getState().conversations.find((n) => n.mode === t && n.messages.length === 0 && !n.backendSessionId && !e.getState().processingByConversationId[n.id]);
355
- n ? rt(n.id) : I(void 0, t);
355
+ n ? it(n.id) : F(void 0, t);
356
356
  }
357
- } else M && F(M, t);
357
+ } else M && rt(M, t);
358
358
  P(t);
359
359
  }, [
360
360
  M,
361
- I,
362
- rt,
363
361
  F,
362
+ it,
363
+ rt,
364
364
  P
365
365
  ]), Mt = C((t) => {
366
366
  if (xe.find((e) => e.id === t)?.writeCapable && !e.getState().apiCallsAcknowledged) {
367
- gt(t);
367
+ yt(t);
368
368
  return;
369
369
  }
370
370
  jt(t);
371
371
  }, [jt]), Nt = C(() => {
372
- let e = ht;
373
- gt(null), lt(), e && jt(e);
372
+ let e = vt;
373
+ yt(null), ut(), e && jt(e);
374
374
  }, [
375
- ht,
376
- lt,
375
+ vt,
376
+ ut,
377
377
  jt
378
378
  ]), Pt = C(() => {
379
- gt(null);
379
+ yt(null);
380
380
  }, []);
381
381
  return /* @__PURE__ */ Fe("div", {
382
382
  className: "relative flex flex-1 flex-col overflow-hidden",
@@ -385,40 +385,40 @@ var Ke = ({ visible: Ce = !0 }) => {
385
385
  className: "contents",
386
386
  inert: $.active || void 0,
387
387
  children: [
388
- X.length > 0 && !$.active ? /* @__PURE__ */ D(_, {
388
+ X.length > 0 && !$.active ? /* @__PURE__ */ D(v, {
389
389
  count: X.length,
390
- onOpenTranscript: () => vt(!0)
390
+ onOpenTranscript: () => xt(!0)
391
391
  }) : null,
392
- Ot.length === 0 ? /* @__PURE__ */ D(g, {
392
+ Ot.length === 0 ? /* @__PURE__ */ D(_, {
393
393
  mode: N,
394
- onSuggestionClick: Ct
394
+ onSuggestionClick: Tt
395
395
  }) : /* @__PURE__ */ D("div", {
396
396
  className: "flex min-h-0 flex-1 flex-col",
397
- children: /* @__PURE__ */ D(m, {
397
+ children: /* @__PURE__ */ D(h, {
398
398
  messages: Ot,
399
- streamingMessageId: ut,
400
- failedMessageId: dt,
401
- onRetry: wt
399
+ streamingMessageId: pt,
400
+ failedMessageId: mt,
401
+ onRetry: Et
402
402
  })
403
403
  }),
404
- /* @__PURE__ */ D(se, {
404
+ /* @__PURE__ */ D(ee, {
405
405
  onStartVoiceSession: $.available && N !== "api-calls" ? $.start : void 0,
406
- onSend: (e, t) => void Y(e, t),
407
- disabled: G,
406
+ onSend: (e, t) => void q(e, t),
407
+ disabled: H,
408
408
  placeholder: N === "api-calls" ? O("chatArea.placeholderActions", "What would you like me to do?") : O("chatArea.placeholderGeneral", "Ask HealthyBowl anything…"),
409
409
  mode: N,
410
- writeAccessDenied: pt === "denied" && !!xt?.writeCapable,
411
- availableModes: mt,
410
+ writeAccessDenied: gt === "denied" && !!G?.writeCapable,
411
+ availableModes: _t,
412
412
  onModeChange: Mt
413
413
  })
414
414
  ]
415
415
  }),
416
- _t && !$.active ? /* @__PURE__ */ D(v, {
416
+ bt && !$.active ? /* @__PURE__ */ D(y, {
417
417
  turns: X,
418
- onClose: () => vt(!1),
418
+ onClose: () => xt(!1),
419
419
  onSave: kt
420
420
  }) : null,
421
- $.active && /* @__PURE__ */ D(ce, {
421
+ $.active && /* @__PURE__ */ D(b, {
422
422
  session: $.session,
423
423
  notice: $.notice,
424
424
  capturing: $.capturing,
@@ -439,8 +439,8 @@ var Ke = ({ visible: Ce = !0 }) => {
439
439
  onToggleMute: $.toggleMute,
440
440
  onEnd: $.end
441
441
  }),
442
- /* @__PURE__ */ D(h, {
443
- open: ht !== null,
442
+ /* @__PURE__ */ D(g, {
443
+ open: vt !== null,
444
444
  onConfirm: Nt,
445
445
  onCancel: Pt
446
446
  })