@burdenoff/microfe-healthybowl 2026.904.6 → 2026.904.7

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 (163) hide show
  1. package/dist/components/assistant/AssistantChatArea.js +214 -212
  2. package/dist/components/assistant/AssistantChatArea.js.map +1 -1
  3. package/dist/components/assistant/AssistantMessageItem.js +15 -15
  4. package/dist/components/assistant/AssistantSpeechProvider.js +2 -295
  5. package/dist/components/assistant/AssistantToolActivity.js +2 -110
  6. package/dist/components/assistant/composer/AssistantComposer.js +7 -7
  7. package/dist/components/assistant/composer/AssistantComposer.js.map +1 -1
  8. package/dist/components/assistant/index.js +1 -1
  9. package/dist/config/assistantLanguages.js +2 -2
  10. package/dist/healthybowl/HealthyBowlRoot.js +57 -56
  11. package/dist/healthybowl/HealthyBowlRoot.js.map +1 -1
  12. package/dist/healthybowl/HealthyBowlRoutes.js +48 -36
  13. package/dist/healthybowl/HealthyBowlRoutes.js.map +1 -1
  14. package/dist/healthybowl/components/CreateFarmTaskButton.js.map +1 -1
  15. package/dist/healthybowl/components/PageLayout.js +11 -10
  16. package/dist/healthybowl/components/PageLayout.js.map +1 -1
  17. package/dist/healthybowl/context/HealthyBowlContext.js +7 -7
  18. package/dist/healthybowl/context/HealthyBowlContext.js.map +1 -1
  19. package/dist/healthybowl/hooks/useAgronomyDecisions.js +79 -0
  20. package/dist/healthybowl/hooks/useAgronomyDecisions.js.map +1 -0
  21. package/dist/healthybowl/hooks/useAnalyticsReports.js +173 -0
  22. package/dist/healthybowl/hooks/useAnalyticsReports.js.map +1 -0
  23. package/dist/healthybowl/hooks/useComplianceExports.js +74 -0
  24. package/dist/healthybowl/hooks/useComplianceExports.js.map +1 -0
  25. package/dist/healthybowl/hooks/useConsultationPayments.js +59 -0
  26. package/dist/healthybowl/hooks/useConsultationPayments.js.map +1 -0
  27. package/dist/healthybowl/hooks/useHealthyBowlCompliance.js +157 -141
  28. package/dist/healthybowl/hooks/useHealthyBowlCompliance.js.map +1 -1
  29. package/dist/healthybowl/hooks/useHealthyBowlData.js +18 -0
  30. package/dist/healthybowl/hooks/useHealthyBowlData.js.map +1 -1
  31. package/dist/healthybowl/hooks/useHealthyBowlDistribution.js +52 -37
  32. package/dist/healthybowl/hooks/useHealthyBowlDistribution.js.map +1 -1
  33. package/dist/healthybowl/hooks/useHealthyBowlLivestockDepth.js +135 -78
  34. package/dist/healthybowl/hooks/useHealthyBowlLivestockDepth.js.map +1 -1
  35. package/dist/healthybowl/hooks/useIrrigationAutomation.js +1 -1
  36. package/dist/healthybowl/hooks/useIrrigationAutomation.js.map +1 -1
  37. package/dist/healthybowl/hooks/usePlantingEstimate.js +88 -0
  38. package/dist/healthybowl/hooks/usePlantingEstimate.js.map +1 -0
  39. package/dist/healthybowl/hooks/useSuccessionPlanning.js +1 -1
  40. package/dist/healthybowl/hooks/useSuccessionPlanning.js.map +1 -1
  41. package/dist/healthybowl/hooks/useWeatherIntelligence.js +1 -1
  42. package/dist/healthybowl/hooks/useWeatherIntelligence.js.map +1 -1
  43. package/dist/healthybowl/offline/HeaderOfflinePill.js +28 -0
  44. package/dist/healthybowl/offline/HeaderOfflinePill.js.map +1 -0
  45. package/dist/healthybowl/offline/OfflineStatusPill.js +40 -21
  46. package/dist/healthybowl/offline/OfflineStatusPill.js.map +1 -1
  47. package/dist/healthybowl/offline/OfflineSyncProvider.js +153 -130
  48. package/dist/healthybowl/offline/OfflineSyncProvider.js.map +1 -1
  49. package/dist/healthybowl/offline/captureCache.js +30 -0
  50. package/dist/healthybowl/offline/captureCache.js.map +1 -0
  51. package/dist/healthybowl/offline/graphql.js.map +1 -1
  52. package/dist/healthybowl/offline/headerSlot.js +24 -0
  53. package/dist/healthybowl/offline/headerSlot.js.map +1 -0
  54. package/dist/healthybowl/offline/store.js +1 -1
  55. package/dist/healthybowl/offline/syncEngine.js +2 -1
  56. package/dist/healthybowl/offline/syncEngine.js.map +1 -1
  57. package/dist/healthybowl/offline/types.js.map +1 -1
  58. package/dist/healthybowl/pages/GettingStartedPage.js +1 -0
  59. package/dist/healthybowl/pages/GettingStartedPage.js.map +1 -1
  60. package/dist/healthybowl/pages/ai/AiDecisionsPage.js +287 -0
  61. package/dist/healthybowl/pages/ai/AiDecisionsPage.js.map +1 -0
  62. package/dist/healthybowl/pages/analytics/InsightsPage.js +2 -2
  63. package/dist/healthybowl/pages/analytics/InsightsPage.js.map +1 -1
  64. package/dist/healthybowl/pages/analytics/ReportsPage.js +136 -99
  65. package/dist/healthybowl/pages/analytics/ReportsPage.js.map +1 -1
  66. package/dist/healthybowl/pages/compliance/ComplianceOverviewPage.js +204 -162
  67. package/dist/healthybowl/pages/compliance/ComplianceOverviewPage.js.map +1 -1
  68. package/dist/healthybowl/pages/compliance/IcsGroupDetailPage.js +196 -178
  69. package/dist/healthybowl/pages/compliance/IcsGroupDetailPage.js.map +1 -1
  70. package/dist/healthybowl/pages/compliance/IcsGrowerDetailPage.js +142 -141
  71. package/dist/healthybowl/pages/compliance/IcsGrowerDetailPage.js.map +1 -1
  72. package/dist/healthybowl/pages/compliance/ResidueTestsPage.js +291 -0
  73. package/dist/healthybowl/pages/compliance/ResidueTestsPage.js.map +1 -0
  74. package/dist/healthybowl/pages/compliance/SubstanceRulesPage.js +300 -0
  75. package/dist/healthybowl/pages/compliance/SubstanceRulesPage.js.map +1 -0
  76. package/dist/healthybowl/pages/compliance/substanceRuleForm.js +135 -0
  77. package/dist/healthybowl/pages/compliance/substanceRuleForm.js.map +1 -0
  78. package/dist/healthybowl/pages/crops/CropFieldsPage.js +2 -0
  79. package/dist/healthybowl/pages/crops/CropFieldsPage.js.map +1 -1
  80. package/dist/healthybowl/pages/crops/CropHarvestPage.js +316 -272
  81. package/dist/healthybowl/pages/crops/CropHarvestPage.js.map +1 -1
  82. package/dist/healthybowl/pages/crops/CropPlanningPage.js +6 -0
  83. package/dist/healthybowl/pages/crops/CropPlanningPage.js.map +1 -1
  84. package/dist/healthybowl/pages/crops/FieldDetailsPage.js +871 -846
  85. package/dist/healthybowl/pages/crops/FieldDetailsPage.js.map +1 -1
  86. package/dist/healthybowl/pages/crops/HarvestDetailsPage.js +376 -334
  87. package/dist/healthybowl/pages/crops/HarvestDetailsPage.js.map +1 -1
  88. package/dist/healthybowl/pages/distribution/CsaPlanDetailPage.js +415 -188
  89. package/dist/healthybowl/pages/distribution/CsaPlanDetailPage.js.map +1 -1
  90. package/dist/healthybowl/pages/distribution/labels.js +10 -2
  91. package/dist/healthybowl/pages/distribution/labels.js.map +1 -1
  92. package/dist/healthybowl/pages/farm/FarmProfilePage.js +1 -0
  93. package/dist/healthybowl/pages/farm/FarmProfilePage.js.map +1 -1
  94. package/dist/healthybowl/pages/field-capture/CaptureObservationForm.js +8 -8
  95. package/dist/healthybowl/pages/fields/FieldMapPage.js +2 -0
  96. package/dist/healthybowl/pages/fields/FieldMapPage.js.map +1 -1
  97. package/dist/healthybowl/pages/financial/FinancialReportsPage.js +92 -107
  98. package/dist/healthybowl/pages/financial/FinancialReportsPage.js.map +1 -1
  99. package/dist/healthybowl/pages/government-schemes/ApplicationTrackingPage.js +228 -188
  100. package/dist/healthybowl/pages/government-schemes/ApplicationTrackingPage.js.map +1 -1
  101. package/dist/healthybowl/pages/government-schemes/SchemeDetailsPage.js +261 -191
  102. package/dist/healthybowl/pages/government-schemes/SchemeDetailsPage.js.map +1 -1
  103. package/dist/healthybowl/pages/government-schemes/schemeApplicationTransitions.js +49 -0
  104. package/dist/healthybowl/pages/government-schemes/schemeApplicationTransitions.js.map +1 -0
  105. package/dist/healthybowl/pages/government-schemes/schemeDocumentSlots.js +48 -0
  106. package/dist/healthybowl/pages/government-schemes/schemeDocumentSlots.js.map +1 -0
  107. package/dist/healthybowl/pages/government-schemes/useSchemeApplicationTransition.js +54 -0
  108. package/dist/healthybowl/pages/government-schemes/useSchemeApplicationTransition.js.map +1 -0
  109. package/dist/healthybowl/pages/inputs-insurance/InputsInsuranceOverviewPage.js +14 -14
  110. package/dist/healthybowl/pages/inputs-insurance/InputsInsuranceOverviewPage.js.map +1 -1
  111. package/dist/healthybowl/pages/irrigation/IrrigationPage.js +338 -307
  112. package/dist/healthybowl/pages/irrigation/IrrigationPage.js.map +1 -1
  113. package/dist/healthybowl/pages/livestock/AnimalDepthFormModal.js +126 -102
  114. package/dist/healthybowl/pages/livestock/AnimalDepthFormModal.js.map +1 -1
  115. package/dist/healthybowl/pages/livestock/AnimalDepthPage.js +257 -215
  116. package/dist/healthybowl/pages/livestock/AnimalDepthPage.js.map +1 -1
  117. package/dist/healthybowl/pages/livestock/GrazingPage.js +1 -0
  118. package/dist/healthybowl/pages/livestock/GrazingPage.js.map +1 -1
  119. package/dist/healthybowl/pages/livestock/HerdDepthPage.js +4 -0
  120. package/dist/healthybowl/pages/livestock/HerdDepthPage.js.map +1 -1
  121. package/dist/healthybowl/pages/livestock/PedigreeTree.js +154 -0
  122. package/dist/healthybowl/pages/livestock/PedigreeTree.js.map +1 -0
  123. package/dist/healthybowl/pages/livestock/eidTagInput.js +39 -0
  124. package/dist/healthybowl/pages/livestock/eidTagInput.js.map +1 -0
  125. package/dist/healthybowl/pages/livestock/grazing/RecordGrazingMoveModal.js +8 -9
  126. package/dist/healthybowl/pages/livestock/grazing/RecordGrazingMoveModal.js.map +1 -1
  127. package/dist/healthybowl/pages/livestock/pedigreeLayout.js +68 -0
  128. package/dist/healthybowl/pages/livestock/pedigreeLayout.js.map +1 -0
  129. package/dist/healthybowl/pages/network/ExpertsPage.js +520 -419
  130. package/dist/healthybowl/pages/network/ExpertsPage.js.map +1 -1
  131. package/dist/healthybowl/pages/weather/WeatherAlertHistoryPage.js +129 -130
  132. package/dist/healthybowl/pages/weather/WeatherAlertHistoryPage.js.map +1 -1
  133. package/dist/healthybowl/pages/weather/WeatherSettingsPage.js +285 -237
  134. package/dist/healthybowl/pages/weather/WeatherSettingsPage.js.map +1 -1
  135. package/dist/healthybowl/pages/weather/alertDelivery.js +105 -0
  136. package/dist/healthybowl/pages/weather/alertDelivery.js.map +1 -0
  137. package/dist/healthybowl/utils/icsInspection.js +18 -0
  138. package/dist/healthybowl/utils/icsInspection.js.map +1 -0
  139. package/dist/healthybowl/utils/plantingCapacity.js +10 -10
  140. package/dist/healthybowl/utils/plantingCapacity.js.map +1 -1
  141. package/dist/hooks/useVoiceSession.js +2 -164
  142. package/dist/node_modules/@ungap/structured-clone/esm/deserialize.js +33 -42
  143. package/dist/node_modules/@ungap/structured-clone/esm/deserialize.js.map +1 -1
  144. package/dist/node_modules/@ungap/structured-clone/esm/serialize.js +44 -47
  145. package/dist/node_modules/@ungap/structured-clone/esm/serialize.js.map +1 -1
  146. package/dist/node_modules/fast-equals/dist/es/index.js +74 -86
  147. package/dist/node_modules/fast-equals/dist/es/index.js.map +1 -1
  148. package/dist/services/assistantApi.js +60 -31
  149. package/dist/services/assistantApi.js.map +1 -1
  150. package/dist/services/speech/index.js +2 -2
  151. package/dist/utils/pageContext.js +15 -1
  152. package/dist/utils/pageContext.js.map +1 -1
  153. package/dist/utils/speechVoices.js +2 -2
  154. package/dist/utils/voiceSession.js +2 -2
  155. package/package.json +2 -2
  156. package/dist/components/assistant/AssistantSpeechProvider.js.map +0 -1
  157. package/dist/components/assistant/AssistantToolActivity.js.map +0 -1
  158. package/dist/config/speechLabels.js +0 -2
  159. package/dist/hooks/useVoiceSession.js.map +0 -1
  160. package/dist/utils/replyLanguage.js +0 -2
  161. package/dist/utils/speakableText.js +0 -2
  162. package/dist/utils/speechPlayback.js +0 -2
  163. package/dist/utils/voicePreview.js +0 -2
@@ -5,82 +5,84 @@ import { isVoiceTurn as f, voiceMarker as p, voiceSessionIdOf as m } from "../..
5
5
  import { downloadFile as h } from "../../services/assistantExportService.js";
6
6
  import { resolveAssistantLanguage as g } from "../../config/assistantLanguages.js";
7
7
  import { resolveLanguagePair as _ } from "../../config/assistantLanguagePair.js";
8
- import { isTurnInFlight as ne } from "../../utils/assistantTurnState.js";
9
- import { parseToolActivity as v } from "./AssistantToolActivity.js";
10
- import { getActorId as y, getOrganizationId as b, getWorkspaceId as re } from "../../utils/assistantContext.js";
11
- import { buildPromptParts as ie, buildPromptWithAttachments as ae, countInlineImageCandidates as oe, countInlinedImageParts as se, getSendableAttachments as x, toMessageAttachment as ce } from "../../utils/assistantAttachments.js";
8
+ import { getActorId as ne, getOrganizationId as v, getWorkspaceId as y } from "../../utils/assistantContext.js";
9
+ import { buildPromptParts as re, buildPromptWithAttachments as ie, countInlineImageCandidates as ae, countInlinedImageParts as oe, getSendableAttachments as b, toMessageAttachment as se } from "../../utils/assistantAttachments.js";
10
+ import { parseToolActivity as x } from "./AssistantToolActivity.js";
12
11
  import { AssistantMessageList as S } from "./AssistantMessageList.js";
13
12
  import { AssistantApiCallsConsentDialog as C } from "./AssistantApiCallsConsentDialog.js";
14
- import { ASSISTANT_MODES as le } from "../../types/assistant.js";
15
- import { AssistantEmptyState as ue } from "./AssistantEmptyState.js";
16
- import { AssistantSpokenTurnsNotice as de } from "./AssistantSpokenTurnsNotice.js";
17
- import { VoiceTranscriptDrawer as fe } from "./voice/VoiceTranscriptDrawer.js";
18
- import { useAssistantAttachments as pe } from "../../hooks/useAssistantAttachments.js";
19
- import { AssistantComposer as me } from "./composer/AssistantComposer.js";
20
- import { AssistantVoiceSession as he } from "./voice/AssistantVoiceSession.js";
21
- import { useVoiceSession as ge } from "../../hooks/useVoiceSession.js";
22
- import { useAssistantApiAccess as _e } from "../../hooks/useAssistantApiAccess.js";
23
- import { useWorkspaceWriteAccess as ve } from "../../hooks/useWorkspaceWriteAccess.js";
24
- import { useConversationTurns as ye } from "../../hooks/useConversationTurns.js";
25
- import { isQuotaExhaustedError as be } from "../../utils/quotaUtils.js";
26
- import { dispatchAssistantQuotaExhausted as xe, notifyAiCreditsUpdated as Se } from "../../utils/aiCredits.js";
27
- import { buildPromptForMode as Ce } from "../../utils/assistantPrompt.js";
28
- import { isMultimodalBodyRejection as we, isRecoverableAssistantError as Te } from "../../utils/assistantTransportErrors.js";
29
- import { pollDelayMs as Ee } from "../../utils/assistantPollSchedule.js";
30
- import { findPendingWrite as De } from "../../utils/pendingWrite.js";
31
- import { toCaptionText as Oe } from "../../utils/captionText.js";
32
- import { buildContinuedFromVoiceNote as ke, buildVoiceTranscriptMarkdown as Ae, voiceTranscriptFilename as je } from "../../utils/voiceTranscript.js";
33
- import { createReadinessTracker as Me } from "../../utils/sandboxReadiness.js";
34
- import { useCallback as w, useEffect as T, useMemo as E, useRef as D, useState as Ne } from "react";
35
- import { useI18n as Pe } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
36
- import { getAssistantMedia as O, useAssistantTr as Fe } from "@burdenoff/fe-libs/shared/assistant";
37
- import { jsx as k, jsxs as Ie } from "react/jsx-runtime";
38
- import { useGatewayClient as Le } from "@burdenoff/fe-libs/shared/graphql";
39
- import { useAuthToken as Re } from "@burdenoff/fe-libs/shared/providers/shell";
13
+ import { ASSISTANT_MODES as w } from "../../types/assistant.js";
14
+ import { AssistantEmptyState as ce } from "./AssistantEmptyState.js";
15
+ import { AssistantSpokenTurnsNotice as le } from "./AssistantSpokenTurnsNotice.js";
16
+ import { VoiceTranscriptDrawer as ue } from "./voice/VoiceTranscriptDrawer.js";
17
+ import { useAssistantAttachments as de } from "../../hooks/useAssistantAttachments.js";
18
+ import { AssistantComposer as fe } from "./composer/AssistantComposer.js";
19
+ import { AssistantVoiceSession as pe } from "./voice/AssistantVoiceSession.js";
20
+ import { useVoiceSession as me } from "../../hooks/useVoiceSession.js";
21
+ import { useAssistantApiAccess as he } from "../../hooks/useAssistantApiAccess.js";
22
+ import { useWorkspaceWriteAccess as ge } from "../../hooks/useWorkspaceWriteAccess.js";
23
+ import { useConversationTurns as _e } from "../../hooks/useConversationTurns.js";
24
+ import { isQuotaExhaustedError as ve } from "../../utils/quotaUtils.js";
25
+ import { dispatchAssistantQuotaExhausted as ye, notifyAiCreditsUpdated as be } from "../../utils/aiCredits.js";
26
+ import { buildPromptForMode as xe } from "../../utils/assistantPrompt.js";
27
+ import { isMultimodalBodyRejection as Se, isRecoverableAssistantError as Ce } from "../../utils/assistantTransportErrors.js";
28
+ import { isTurnInFlight as we } from "../../utils/assistantTurnState.js";
29
+ import { pollDelayMs as Te } from "../../utils/assistantPollSchedule.js";
30
+ import { findPendingWrite as Ee } from "../../utils/pendingWrite.js";
31
+ import { toCaptionText as De } from "../../utils/captionText.js";
32
+ import { buildContinuedFromVoiceNote as Oe, buildVoiceTranscriptMarkdown as ke, voiceTranscriptFilename as Ae } from "../../utils/voiceTranscript.js";
33
+ import { createReadinessTracker as je } from "../../utils/sandboxReadiness.js";
34
+ import { useCallback as T, useEffect as E, useMemo as D, useRef as O, useState as Me } from "react";
35
+ import { useI18n as Ne } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
36
+ import { getAssistantMedia as k, useAssistantTr as Pe } from "@burdenoff/fe-libs/shared/assistant";
37
+ import { jsx as A, jsxs as Fe } from "react/jsx-runtime";
38
+ import { useGatewayClient as Ie } from "@burdenoff/fe-libs/shared/graphql";
39
+ import { useAuthToken as Le } from "@burdenoff/fe-libs/shared/providers/shell";
40
40
  //#region src/components/assistant/AssistantChatArea.tsx
41
- var ze = {
41
+ var Re = {
42
42
  general: 18e4,
43
43
  assistant: 18e4,
44
44
  "api-calls": 18e4,
45
45
  "vibe-plugins": 6e5
46
- }, Be = 18e4, Ve = 2e4;
47
- function He() {
46
+ }, ze = 18e4, Be = 2e4;
47
+ function Ve() {
48
48
  return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
49
49
  }
50
- function Ue(e) {
50
+ function He(e) {
51
51
  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]");
52
52
  }
53
- function A(e) {
53
+ function j(e) {
54
54
  return e.info?.time?.created ?? 0;
55
55
  }
56
- function j(e) {
56
+ function M(e) {
57
57
  return (e ?? []).filter((e) => e.type === "text" && typeof e.text == "string").map((e) => e.text?.trim() ?? "").filter(Boolean).join("\n");
58
58
  }
59
- function M(e) {
59
+ function N(e) {
60
60
  return (e ?? []).filter((e) => e.type === "tool" && e.tool).map((e) => {
61
61
  let t = e.state?.status ?? "running", n = e.tool ?? "tool";
62
62
  return t === "completed" ? `Completed: ${n}` : t === "failed" ? `Failed: ${n}` : `Running: ${n}`;
63
63
  });
64
64
  }
65
- function We(e, t) {
66
- let n = e.filter((e) => e.info?.role === "assistant" && A(e) > t).sort((e, t) => A(e) - A(t));
65
+ function Ue(e, t) {
66
+ let n = e.filter((e) => e.info?.role === "assistant" && j(e) > t).sort((e, t) => j(e) - j(t));
67
67
  if (n.length === 0) return {
68
68
  content: "Thinking...",
69
69
  done: !1
70
70
  };
71
- let r = n[n.length - 1], i = j(r.parts), a = O(r.parts), o = M(r.parts), s = De(r.parts);
71
+ let r = n[n.length - 1], i = M(r.parts), a = k(r.parts), o = N(r.parts), s = Ee(r.parts), ee = [
72
+ i,
73
+ ...a,
74
+ ...o
75
+ ].filter(Boolean).join("\n\n") || "Thinking...", c = r.info?.providerID, l = r.info?.modelID;
72
76
  return {
73
- content: [
74
- i,
75
- ...a,
76
- ...o
77
- ].filter(Boolean).join("\n\n") || "Thinking...",
77
+ content: ee,
78
78
  done: !!r.info?.time?.completed && (!!i || a.length > 0 || o.length > 0),
79
79
  tokens: r.info?.tokens,
80
+ messageId: r.info?.id,
81
+ ...c && l ? { model: `${c}/${l}` } : {},
80
82
  ...s ? { pendingWrite: s } : {}
81
83
  };
82
84
  }
83
- function Ge(e) {
85
+ function We(e) {
84
86
  switch (e) {
85
87
  case "provisioning": return "Starting assistant environment...";
86
88
  case "connecting": return "Connecting to assistant...";
@@ -88,95 +90,95 @@ function Ge(e) {
88
90
  default: return "";
89
91
  }
90
92
  }
91
- var Ke = ({ visible: De = !0 }) => {
92
- let O = Fe(), j = Le("workspace"), { getAccessToken: M, getWorkspaceToken: Ke, userId: qe } = Re(), { locale: Je } = Pe(), Ye = e((e) => e.assistantLanguage), Xe = e((e) => e.replyLanguage), Ze = E(() => _(Ye, Xe, Je), [
93
+ var Ge = ({ visible: Ee = !0 }) => {
94
+ let k = Pe(), M = Ie("workspace"), { getAccessToken: N, getWorkspaceToken: Ge, userId: Ke } = Le(), { locale: qe } = Ne(), Je = e((e) => e.assistantLanguage), Ye = e((e) => e.replyLanguage), Xe = D(() => _(Je, Ye, qe), [
95
+ Je,
93
96
  Ye,
94
- Xe,
95
- Je
96
- ]), Qe = Ze.reply.english, $e = Ze.replyIsExplicit, et = Ze.reply.code, { conversations: tt, activeConversationId: N, mode: P, processingByConversationId: nt, setMode: F, setConversationMode: I, setActiveConversation: rt, createConversation: L, addMessage: R, updateMessage: it, patchMessage: z, mergeMessageMetadata: at, setConversationProcessing: B, clearConversationProcessing: ot, setBackendSessionId: st, clearBackendSessionId: V, setSandbox: H, clearSandbox: ct, acknowledgeApiCalls: lt } = e(), U = ye(tt.find((e) => e.id === N)), W = U.all, G = N ? nt[N] : void 0, ut = ne(G?.status), dt = ut ? G?.messageId ?? null : null, ft = G?.status === "error" ? G.messageId : null, { canUseApiCalls: pt, loading: mt } = _e(b()), ht = ve(y(), re() || null), gt = E(() => le.filter((e) => !e.requiresAdmin || pt), [pt]), [_t, vt] = Ne(null), [yt, bt] = Ne(!1), xt = D({}), St = D(Me()), Ct = D(/* @__PURE__ */ new Set()), wt = E(() => le.find((e) => e.id === P), [P]);
97
- T(() => {
98
- mt || (!wt || wt.requiresAdmin && !pt) && P !== "assistant" && F("assistant");
97
+ qe
98
+ ]), Ze = Xe.reply.english, Qe = Xe.replyIsExplicit, $e = Xe.reply.code, { conversations: et, activeConversationId: P, mode: F, processingByConversationId: tt, setMode: I, setConversationMode: L, setActiveConversation: nt, createConversation: R, addMessage: z, updateMessage: rt, patchMessage: B, mergeMessageMetadata: it, setConversationProcessing: V, clearConversationProcessing: at, setBackendSessionId: ot, clearBackendSessionId: H, setSandbox: U, clearSandbox: st, acknowledgeApiCalls: ct } = e(), W = _e(et.find((e) => e.id === P)), G = W.all, lt = P ? tt[P] : void 0, ut = we(lt?.status), dt = ut ? lt?.messageId ?? null : null, ft = lt?.status === "error" ? lt.messageId : null, { canUseApiCalls: pt, loading: mt } = he(v()), ht = ge(ne(), y() || null), gt = D(() => w.filter((e) => !e.requiresAdmin || pt), [pt]), [_t, vt] = Me(null), [yt, bt] = Me(!1), xt = O({}), St = O(je()), Ct = O(/* @__PURE__ */ new Set()), wt = D(() => w.find((e) => e.id === F), [F]);
99
+ E(() => {
100
+ mt || (!wt || wt.requiresAdmin && !pt) && F !== "assistant" && I("assistant");
99
101
  }, [
100
- P,
102
+ F,
101
103
  wt,
102
104
  pt,
103
105
  mt,
104
- F
106
+ I
105
107
  ]);
106
- let K = w((e, t, n, r) => {
107
- B(e, n, t, null), r ? it(e, t, r) : it(e, t, Ge(n));
108
- }, [B, it]), Tt = w(async (t, i, o, s, c) => {
108
+ let K = T((e, t, n, r) => {
109
+ V(e, n, t, null), r ? rt(e, t, r) : rt(e, t, We(n));
110
+ }, [V, rt]), Tt = T(async (t, i, o, s, c) => {
109
111
  let l = e.getState().sandboxesByMode[o]?.sandboxId ?? null, te = async (e) => {
110
112
  if (St.current.isFresh(e)) return !0;
111
113
  try {
112
- return await d(j, e, s, c, 3e5, (e) => K(t, i, "provisioning", e)), await u(j, e, s, c, 9e4, (e) => K(t, i, "connecting", e)), St.current.markVerified(e), !0;
114
+ return await d(M, e, s, c, 3e5, (e) => K(t, i, "provisioning", e)), await u(M, e, s, c, 9e4, (e) => K(t, i, "connecting", e)), St.current.markVerified(e), !0;
113
115
  } catch {
114
116
  return St.current.invalidate(e), !1;
115
117
  }
116
118
  };
117
- if (l && (H(o, l, "provisioning"), K(t, i, "provisioning", "Reusing assistant environment..."), await te(l) || (H(o, null, "provisioning"), l = null)), !l) {
119
+ if (l && (U(o, l, "provisioning"), K(t, i, "provisioning", "Reusing assistant environment..."), await te(l) || (U(o, null, "provisioning"), l = null)), !l) {
118
120
  K(t, i, "provisioning", "Looking for existing environment...");
119
- let e = await a(j, s, o, c);
120
- e && (H(o, e, "provisioning"), K(t, i, "provisioning", "Reusing assistant environment..."), await te(e) ? l = e : H(o, null, "provisioning"));
121
+ let e = await a(M, s, o, c);
122
+ e && (U(o, e, "provisioning"), K(t, i, "provisioning", "Reusing assistant environment..."), await te(e) ? l = e : U(o, null, "provisioning"));
121
123
  }
122
124
  if (!l) {
123
- if (o === "api-calls" && !M()) throw Error("API Calls mode requires an authenticated session. Please sign in again.");
124
- K(t, i, "provisioning", "Starting assistant environment..."), H(o, null, "provisioning"), l = await n(j, o, s, c), H(o, l, "provisioning"), await d(j, l, s, c, 3e5, (e) => K(t, i, "provisioning", e)), await u(j, l, s, c, 9e4, (e) => K(t, i, "connecting", e));
125
+ if (o === "api-calls" && !N()) throw Error("API Calls mode requires an authenticated session. Please sign in again.");
126
+ K(t, i, "provisioning", "Starting assistant environment..."), U(o, null, "provisioning"), l = await n(M, o, s, c), U(o, l, "provisioning"), await d(M, l, s, c, 3e5, (e) => K(t, i, "provisioning", e)), await u(M, l, s, c, 9e4, (e) => K(t, i, "connecting", e));
125
127
  }
126
- H(o, l, "running");
128
+ U(o, l, "running");
127
129
  let f = e.getState().conversations.find((e) => e.id === t)?.backendSessionId ?? null;
128
130
  if (f) try {
129
- let e = await ee(j, l, s, f, c);
131
+ let e = await ee(M, l, s, f, c);
130
132
  if (e.mode !== o) throw Error(`Session mode mismatch: expected ${o}, received ${e.mode}`);
131
133
  } catch {
132
- V(t), f = null;
134
+ H(t), f = null;
133
135
  }
134
- return f || (K(t, i, "connecting", "Preparing session..."), f = (await r(j, l, s, o, c)).sessionId, st(t, f)), {
136
+ return f || (K(t, i, "connecting", "Preparing session..."), f = (await r(M, l, s, o, c)).sessionId, ot(t, f)), {
135
137
  sandboxId: l,
136
138
  sessionId: f
137
139
  };
138
140
  }, [
139
- j,
140
- V,
141
141
  M,
142
- st,
143
142
  H,
143
+ N,
144
+ ot,
145
+ U,
144
146
  K
145
- ]), q = w(async (n, r = [], a = {}) => {
146
- let ee = a.voiceSessionId !== void 0, u = e.getState(), d = u.activeConversationId ?? N;
147
- if (d && (ne(u.processingByConversationId[d]?.status) || Ct.current.has(d))) return;
148
- let f = u.mode, m = N, h = m ? e.getState().conversations.find((e) => e.id === m) : void 0;
149
- if (m ? h && h.mode !== f && (h.messages.length > 0 || h.backendSessionId) ? m = L(void 0, f) : h && h.mode !== f && I(m, f) : m = L(void 0, f), !m) return;
147
+ ]), q = T(async (n, r = [], a = {}) => {
148
+ let ee = a.voiceSessionId !== void 0, u = e.getState(), d = u.activeConversationId ?? P;
149
+ if (d && (we(u.processingByConversationId[d]?.status) || Ct.current.has(d))) return;
150
+ let f = u.mode, m = P, h = m ? e.getState().conversations.find((e) => e.id === m) : void 0;
151
+ if (m ? h && h.mode !== f && (h.messages.length > 0 || h.backendSessionId) ? m = R(void 0, f) : h && h.mode !== f && L(m, f) : m = R(void 0, f), !m) return;
150
152
  xt.current[m] = r;
151
- let g = re(), _ = {
152
- accessToken: M(),
153
- workspaceToken: Ke(),
154
- userId: qe,
155
- organizationId: b()
156
- }, v = {
157
- id: He(),
153
+ let g = y(), _ = {
154
+ accessToken: N(),
155
+ workspaceToken: Ge(),
156
+ userId: Ke,
157
+ organizationId: v()
158
+ }, ne = {
159
+ id: Ve(),
158
160
  role: "user",
159
161
  content: n,
160
162
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
161
163
  metadata: {
162
- ...r.length ? { attachments: r.map(ce) } : {},
164
+ ...r.length ? { attachments: r.map(se) } : {},
163
165
  ...p(a.voiceSessionId)
164
166
  }
165
167
  };
166
- R(m, v);
167
- let y = He();
168
- R(m, {
169
- id: y,
168
+ z(m, ne);
169
+ let b = Ve();
170
+ z(m, {
171
+ id: b,
170
172
  role: "assistant",
171
173
  content: "",
172
174
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
173
175
  metadata: {
174
- lang: et,
176
+ lang: $e,
175
177
  ...p(a.voiceSessionId)
176
178
  }
177
- }), B(m, "provisioning", y, null);
178
- let x = (e, t, n, r, i = et) => {
179
- z(m, y, { content: Ue(e) }), at(m, y, {
179
+ }), V(m, "provisioning", b, null);
180
+ let x = (e, t, n, r, i = $e) => {
181
+ B(m, b, { content: He(e) }), it(m, b, {
180
182
  lang: i,
181
183
  ...t?.length ? { artifacts: t } : {},
182
184
  ...t?.length || n || r ? { mode: f } : {},
@@ -187,44 +189,44 @@ var Ke = ({ visible: De = !0 }) => {
187
189
  }, S = async (e = 1) => {
188
190
  let a = !1;
189
191
  try {
190
- await t(j, g, _);
192
+ await t(M, g, _);
191
193
  } catch (e) {
192
- if (be(e)) {
193
- xe("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"), B(m, "error", y, null);
194
+ if (ve(e)) {
195
+ ye("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"), V(m, "error", b, null);
194
196
  return;
195
197
  }
196
198
  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);
197
199
  }
198
200
  try {
199
- let { sandboxId: e, sessionId: t } = await Tt(m, y, f, g, _), u = (await s(j, e, g, t, _, 50).catch(() => [])).reduce((e, t) => Math.max(e, A(t)), 0);
200
- K(m, y, "streaming", "Thinking...");
201
- let d = Ce(f, ae(n, r), Qe, $e, ee), p = ie(d, r), h = se(p), ne = h > 0, v = te();
202
- a = oe(r) > h;
201
+ let { sandboxId: e, sessionId: t } = await Tt(m, b, f, g, _), u = (await s(M, e, g, t, _, 50).catch(() => [])).reduce((e, t) => Math.max(e, j(t)), 0);
202
+ K(m, b, "streaming", "Thinking...");
203
+ let d = xe(f, ie(n, r), Ze, Qe, ee), p = re(d, r), h = oe(p), ne = h > 0, v = te();
204
+ a = ae(r) > h;
203
205
  try {
204
- await l(j, e, g, t, d, f, v, _, p);
206
+ await l(M, e, g, t, d, f, v, _, p);
205
207
  } catch (n) {
206
- if (!p || !we(n)) throw n;
207
- await l(j, e, g, t, d, f, v, _, void 0), a ||= ne;
208
+ if (!p || !Se(n)) throw n;
209
+ await l(M, e, g, t, d, f, v, _, void 0), a ||= ne;
208
210
  }
209
- let b = We([], u), re = Date.now() + (ze[f] ?? Be), ce = Date.now(), S = Date.now();
210
- for (; Date.now() < re && (b = We(await s(j, e, g, t, _, 50, u), u), z(m, y, { content: Ue(b.content) }), b.pendingWrite && at(m, y, { pendingWrite: b.pendingWrite }), !b.done);) Date.now() - ce > 3e4 && (await i(j, e, g, 600, _).catch(() => void 0), ce = Date.now()), await new Promise((e) => setTimeout(e, Ee(Date.now() - S)));
211
- if (!b.done && f !== "vibe-plugins") throw Error("Assistant response timed out while streaming progress");
212
- let C = f === "vibe-plugins" ? await o(j, e, g, t, _).catch(() => []) : void 0;
213
- if (b.done || (b = {
214
- ...b,
215
- 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._`
216
- }), a && (b = {
217
- ...b,
218
- content: `${b.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._")}`
219
- }), x(b.content, C, t, e), b.tokens) {
220
- z(m, y, { tokens: b.tokens });
211
+ let y = Ue([], u), se = Date.now() + (Re[f] ?? ze), S = Date.now(), C = Date.now();
212
+ for (; Date.now() < se && (y = Ue(await s(M, e, g, t, _, 50, u), u), B(m, b, { content: He(y.content) }), y.pendingWrite && it(m, b, { pendingWrite: y.pendingWrite }), !y.done);) Date.now() - S > 3e4 && (await i(M, e, g, 600, _).catch(() => void 0), S = Date.now()), await new Promise((e) => setTimeout(e, Te(Date.now() - C)));
213
+ if (!y.done && f !== "vibe-plugins") throw Error("Assistant response timed out while streaming progress");
214
+ let w = f === "vibe-plugins" ? await o(M, e, g, t, _).catch(() => []) : void 0;
215
+ if (y.done || (y = {
216
+ ...y,
217
+ content: `${y.content}\n\n_Still building in the background — any artifacts below will finish shortly. Re-open this conversation to pick up the completed plugin._`
218
+ }), a && (y = {
219
+ ...y,
220
+ content: `${y.content}\n\n${k("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._")}`
221
+ }), x(y.content, w, t, e), y.tokens) {
222
+ B(m, b, { tokens: y.tokens });
221
223
  try {
222
- await c(j, g, t, b.tokens, _), Se();
224
+ await c(M, g, t, y.messageId, y.model, y.tokens, _), be();
223
225
  } catch {}
224
226
  }
225
- B(m, "complete", y, null);
227
+ V(m, "complete", b, null);
226
228
  } catch (t) {
227
- if (e === 1 && Te(t)) return V(m), ct(f), S(2);
229
+ if (e === 1 && Ce(t)) return H(m), st(f), S(2);
228
230
  throw t;
229
231
  }
230
232
  }, C = m;
@@ -233,12 +235,12 @@ var Ke = ({ visible: De = !0 }) => {
233
235
  if (!g) throw Error("Assistant backend is unavailable without an active workspace context.");
234
236
  await S();
235
237
  } catch (t) {
236
- if (St.current.invalidate(e.getState().sandboxesByMode[f]?.sandboxId ?? null), be(t)) {
237
- xe("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"), B(m, "error", y, null);
238
+ if (St.current.invalidate(e.getState().sandboxesByMode[f]?.sandboxId ?? null), ve(t)) {
239
+ ye("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"), V(m, "error", b, null);
238
240
  return;
239
241
  }
240
242
  let n = t instanceof Error ? t.message : "Something went wrong";
241
- B(m, "error", y, n), z(m, y, { content: `Sorry, an error occurred: ${n}. Please try again.` }), at(m, y, {
243
+ V(m, "error", b, n), B(m, b, { content: `Sorry, an error occurred: ${n}. Please try again.` }), it(m, b, {
242
244
  lang: "en",
243
245
  ...p(a.voiceSessionId)
244
246
  });
@@ -246,188 +248,188 @@ var Ke = ({ visible: De = !0 }) => {
246
248
  Ct.current.delete(C);
247
249
  }
248
250
  }, [
249
- N,
250
- R,
251
- j,
252
- V,
253
- ct,
254
- tt,
255
- L,
256
- Tt,
257
- M,
258
- Ke,
251
+ P,
259
252
  z,
260
- $e,
261
- et,
262
- Qe,
253
+ M,
254
+ H,
263
255
  st,
264
- I,
256
+ et,
257
+ R,
258
+ Tt,
259
+ N,
260
+ Ge,
265
261
  B,
266
- O,
262
+ Qe,
263
+ $e,
264
+ Ze,
265
+ ot,
266
+ L,
267
+ V,
268
+ k,
267
269
  K,
268
- qe
269
- ]), Et = w((e) => {
270
+ Ke
271
+ ]), Et = T((e) => {
270
272
  q(e);
271
- }, [q]), Dt = w(() => {
272
- let e = [...U.chat].reverse().find((e) => e.role === "user"), t = N ? xt.current[N] ?? [] : [];
273
+ }, [q]), Dt = T(() => {
274
+ let e = [...W.chat].reverse().find((e) => e.role === "user"), t = P ? xt.current[P] ?? [] : [];
273
275
  e && q(e.content, t);
274
276
  }, [
275
- W,
277
+ G,
276
278
  q,
277
- N
278
- ]), J = D(q);
279
- T(() => {
280
- J.current = q;
279
+ P
280
+ ]), Ot = O(q);
281
+ E(() => {
282
+ Ot.current = q;
281
283
  }, [q]);
282
- let Ot = E(() => {
284
+ let J = D(() => {
283
285
  if (ut) return null;
284
- for (let e = W.length - 1; e >= 0; --e) {
285
- let t = W[e];
286
+ for (let e = G.length - 1; e >= 0; --e) {
287
+ let t = G[e];
286
288
  if (t?.role !== "assistant" || !f(t)) continue;
287
- let n = v(t.content).text.trim();
289
+ let n = x(t.content).text.trim();
288
290
  return n ? {
289
291
  id: t.id,
290
292
  text: n
291
293
  } : null;
292
294
  }
293
295
  return null;
294
- }, [W, ut]), kt = E(() => Ot ? Oe(Ot.text) : null, [Ot]), At = U.chat, Y = E(() => U.voice.filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
296
+ }, [G, ut]), kt = D(() => J ? De(J.text) : null, [J]), At = W.chat, Y = D(() => W.voice.filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
295
297
  id: e.id,
296
298
  role: e.role,
297
- text: v(e.content).text.trim(),
299
+ text: x(e.content).text.trim(),
298
300
  sessionId: m(e),
299
301
  timestamp: e.timestamp
300
- })).filter((e) => e.text.length > 0), [U.voice]), jt = w(() => {
302
+ })).filter((e) => e.text.length > 0), [W.voice]), jt = T(() => {
301
303
  if (Y.length === 0) return;
302
304
  let e = /* @__PURE__ */ new Date();
303
- h(Ae(Y, {
304
- title: O("voiceSession.transcript", "Voice conversation"),
305
- savedAt: O("voiceSession.savedAt", "Saved"),
306
- session: O("voiceSession.sessionLabel", "Session"),
307
- earlier: O("voiceSession.earlierLabel", "Earlier"),
308
- you: O("voiceSession.speakerYou", "You"),
309
- assistant: O("voiceSession.speakerAssistant", "Assistant")
310
- }, e), je(e), "text/markdown");
311
- }, [Y, O]), X = pe(), Z = D(X);
305
+ h(ke(Y, {
306
+ title: k("voiceSession.transcript", "Voice conversation"),
307
+ savedAt: k("voiceSession.savedAt", "Saved"),
308
+ session: k("voiceSession.sessionLabel", "Session"),
309
+ earlier: k("voiceSession.earlierLabel", "Earlier"),
310
+ you: k("voiceSession.speakerYou", "You"),
311
+ assistant: k("voiceSession.speakerAssistant", "Assistant")
312
+ }, e), Ae(e), "text/markdown");
313
+ }, [Y, k]), X = de(), Z = O(X);
312
314
  Z.current = X;
313
- let Q = ge({
314
- onSubmit: w((e, t) => {
315
+ let Q = me({
316
+ onSubmit: T((e, t) => {
315
317
  let n = () => {
316
- let n = Z.current, r = x(n.attachments);
317
- J.current(e, r, { voiceSessionId: t }), n.clear();
318
+ let n = Z.current, r = b(n.attachments);
319
+ Ot.current(e, r, { voiceSessionId: t }), n.clear();
318
320
  };
319
321
  if (!Z.current.isBusy) {
320
322
  n();
321
323
  return;
322
324
  }
323
325
  let r = Date.now(), i = window.setInterval(() => {
324
- Z.current.isBusy && Date.now() - r < Ve || (window.clearInterval(i), n());
326
+ Z.current.isBusy && Date.now() - r < Be || (window.clearInterval(i), n());
325
327
  }, 200);
326
328
  }, []),
327
- latestReply: Ot,
328
- language: g(Ye, Je).tag
329
- }), Mt = w(() => {
329
+ latestReply: J,
330
+ language: g(Je, qe).tag
331
+ }), Mt = T(() => {
330
332
  let t = e.getState().activeConversationId;
331
- !t || Y.length === 0 || (R(t, {
332
- id: He(),
333
+ !t || Y.length === 0 || (z(t, {
334
+ id: Ve(),
333
335
  role: "system",
334
- content: ke(Y, {
335
- intro: O("voiceSession.continuedIntro", "Continued from a voice conversation. You asked about:"),
336
- nothing: O("voiceSession.continuedNothing", "Continued from a voice conversation."),
337
- more: (e) => O("voiceSession.continuedMore", "…and {{count}} more", { count: e })
336
+ content: Oe(Y, {
337
+ intro: k("voiceSession.continuedIntro", "Continued from a voice conversation. You asked about:"),
338
+ nothing: k("voiceSession.continuedNothing", "Continued from a voice conversation."),
339
+ more: (e) => k("voiceSession.continuedMore", "…and {{count}} more", { count: e })
338
340
  }),
339
341
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
340
342
  }), bt(!1), Q.end());
341
343
  }, [
342
344
  Y,
343
- R,
344
- O
345
+ z,
346
+ k
345
347
  ]);
346
- T(() => {
347
- !De && Q.active && Q.end();
348
- }, [De, Q]), T(() => {
348
+ E(() => {
349
+ !Ee && Q.active && Q.end();
350
+ }, [Ee, Q]), E(() => {
349
351
  Q.active || Z.current.clear();
350
- }, [Q.active]), T(() => {
352
+ }, [Q.active]), E(() => {
351
353
  let t = e.getState().consumePendingPrompt();
352
- return t && J.current(t), e.subscribe((t, n) => {
354
+ return t && Ot.current(t), e.subscribe((t, n) => {
353
355
  if (t.pendingPrompt && t.pendingPrompt !== n.pendingPrompt) {
354
356
  let t = e.getState().consumePendingPrompt();
355
- t && J.current(t);
357
+ t && Ot.current(t);
356
358
  }
357
359
  });
358
360
  }, []);
359
- let $ = w((t) => {
360
- let n = N ? e.getState().conversations.find((e) => e.id === N) : void 0;
361
+ let $ = T((t) => {
362
+ let n = P ? e.getState().conversations.find((e) => e.id === P) : void 0;
361
363
  if (n && (n.messages.length > 0 || n.backendSessionId)) {
362
364
  if (n.mode !== t) {
363
365
  let n = e.getState().conversations.find((n) => n.mode === t && n.messages.length === 0 && !n.backendSessionId && !e.getState().processingByConversationId[n.id]);
364
- n ? rt(n.id) : L(void 0, t);
366
+ n ? nt(n.id) : R(void 0, t);
365
367
  }
366
- } else N && I(N, t);
367
- F(t);
368
+ } else P && L(P, t);
369
+ I(t);
368
370
  }, [
369
- N,
371
+ P,
372
+ R,
373
+ nt,
370
374
  L,
371
- rt,
372
- I,
373
- F
374
- ]), Nt = w((t) => {
375
- if (le.find((e) => e.id === t)?.writeCapable && !e.getState().apiCallsAcknowledged) {
375
+ I
376
+ ]), Nt = T((t) => {
377
+ if (w.find((e) => e.id === t)?.writeCapable && !e.getState().apiCallsAcknowledged) {
376
378
  vt(t);
377
379
  return;
378
380
  }
379
381
  $(t);
380
- }, [$]), Pt = w(() => {
382
+ }, [$]), Pt = T(() => {
381
383
  let e = _t;
382
- vt(null), lt(), e && $(e);
384
+ vt(null), ct(), e && $(e);
383
385
  }, [
384
386
  _t,
385
- lt,
387
+ ct,
386
388
  $
387
- ]), Ft = w(() => {
389
+ ]), Ft = T(() => {
388
390
  vt(null);
389
391
  }, []);
390
- return /* @__PURE__ */ Ie("div", {
392
+ return /* @__PURE__ */ Fe("div", {
391
393
  className: "relative flex flex-1 flex-col overflow-hidden",
392
394
  children: [
393
- /* @__PURE__ */ Ie("div", {
395
+ /* @__PURE__ */ Fe("div", {
394
396
  className: "contents",
395
397
  inert: Q.active || void 0,
396
398
  children: [
397
- Y.length > 0 && !Q.active ? /* @__PURE__ */ k(de, {
399
+ Y.length > 0 && !Q.active ? /* @__PURE__ */ A(le, {
398
400
  count: Y.length,
399
401
  onOpenTranscript: () => bt(!0)
400
402
  }) : null,
401
- At.length === 0 ? /* @__PURE__ */ k(ue, {
402
- mode: P,
403
+ At.length === 0 ? /* @__PURE__ */ A(ce, {
404
+ mode: F,
403
405
  onSuggestionClick: Et
404
- }) : /* @__PURE__ */ k("div", {
406
+ }) : /* @__PURE__ */ A("div", {
405
407
  className: "flex min-h-0 flex-1 flex-col",
406
- children: /* @__PURE__ */ k(S, {
408
+ children: /* @__PURE__ */ A(S, {
407
409
  messages: At,
408
410
  streamingMessageId: dt,
409
411
  failedMessageId: ft,
410
412
  onRetry: Dt
411
413
  })
412
414
  }),
413
- /* @__PURE__ */ k(me, {
414
- onStartVoiceSession: Q.available && P !== "api-calls" ? Q.start : void 0,
415
+ /* @__PURE__ */ A(fe, {
416
+ onStartVoiceSession: Q.available && F !== "api-calls" ? Q.start : void 0,
415
417
  onSend: (e, t) => void q(e, t),
416
418
  disabled: ut,
417
- placeholder: P === "api-calls" ? O("chatArea.placeholderActions", "What would you like me to do?") : O("chatArea.placeholderGeneral", "Ask HealthyBowl anything…"),
418
- mode: P,
419
+ placeholder: F === "api-calls" ? k("chatArea.placeholderActions", "What would you like me to do?") : k("chatArea.placeholderGeneral", "Ask HealthyBowl anything…"),
420
+ mode: F,
419
421
  writeAccessDenied: ht === "denied" && !!wt?.writeCapable,
420
422
  availableModes: gt,
421
423
  onModeChange: Nt
422
424
  })
423
425
  ]
424
426
  }),
425
- yt && !Q.active ? /* @__PURE__ */ k(fe, {
427
+ yt && !Q.active ? /* @__PURE__ */ A(ue, {
426
428
  turns: Y,
427
429
  onClose: () => bt(!1),
428
430
  onSave: jt
429
431
  }) : null,
430
- Q.active && /* @__PURE__ */ k(he, {
432
+ Q.active && /* @__PURE__ */ A(pe, {
431
433
  session: Q.session,
432
434
  notice: Q.notice,
433
435
  capturing: Q.capturing,
@@ -448,7 +450,7 @@ var Ke = ({ visible: De = !0 }) => {
448
450
  onToggleMute: Q.toggleMute,
449
451
  onEnd: Q.end
450
452
  }),
451
- /* @__PURE__ */ k(C, {
453
+ /* @__PURE__ */ A(C, {
452
454
  open: _t !== null,
453
455
  onConfirm: Pt,
454
456
  onCancel: Ft
@@ -457,6 +459,6 @@ var Ke = ({ visible: De = !0 }) => {
457
459
  });
458
460
  };
459
461
  //#endregion
460
- export { Ke as AssistantChatArea };
462
+ export { Ge as AssistantChatArea };
461
463
 
462
464
  //# sourceMappingURL=AssistantChatArea.js.map