@burdenoff/microfe-healthybowl 2026.904.24 → 2026.904.26

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