@burdenoff/microfe-healthybowl 2026.904.15 → 2026.904.16

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 (140) hide show
  1. package/dist/components/assistant/AssistantChatArea.js +72 -74
  2. package/dist/components/assistant/AssistantChatArea.js.map +1 -1
  3. package/dist/healthybowl/HealthyBowlRoot.js +56 -57
  4. package/dist/healthybowl/HealthyBowlRoot.js.map +1 -1
  5. package/dist/healthybowl/HealthyBowlRoutes.js +36 -48
  6. package/dist/healthybowl/HealthyBowlRoutes.js.map +1 -1
  7. package/dist/healthybowl/components/CreateFarmTaskButton.js.map +1 -1
  8. package/dist/healthybowl/components/PageLayout.js +10 -11
  9. package/dist/healthybowl/components/PageLayout.js.map +1 -1
  10. package/dist/healthybowl/context/HealthyBowlContext.js +7 -7
  11. package/dist/healthybowl/context/HealthyBowlContext.js.map +1 -1
  12. package/dist/healthybowl/hooks/useHealthyBowlCompliance.js +141 -157
  13. package/dist/healthybowl/hooks/useHealthyBowlCompliance.js.map +1 -1
  14. package/dist/healthybowl/hooks/useHealthyBowlData.js +0 -18
  15. package/dist/healthybowl/hooks/useHealthyBowlData.js.map +1 -1
  16. package/dist/healthybowl/hooks/useHealthyBowlDistribution.js +37 -52
  17. package/dist/healthybowl/hooks/useHealthyBowlDistribution.js.map +1 -1
  18. package/dist/healthybowl/hooks/useHealthyBowlLivestockDepth.js +78 -135
  19. package/dist/healthybowl/hooks/useHealthyBowlLivestockDepth.js.map +1 -1
  20. package/dist/healthybowl/hooks/useIrrigationAutomation.js +1 -1
  21. package/dist/healthybowl/hooks/useIrrigationAutomation.js.map +1 -1
  22. package/dist/healthybowl/hooks/useSuccessionPlanning.js +1 -1
  23. package/dist/healthybowl/hooks/useSuccessionPlanning.js.map +1 -1
  24. package/dist/healthybowl/hooks/useWeatherIntelligence.js +1 -1
  25. package/dist/healthybowl/hooks/useWeatherIntelligence.js.map +1 -1
  26. package/dist/healthybowl/offline/OfflineStatusPill.js +21 -40
  27. package/dist/healthybowl/offline/OfflineStatusPill.js.map +1 -1
  28. package/dist/healthybowl/offline/OfflineSyncProvider.js +130 -153
  29. package/dist/healthybowl/offline/OfflineSyncProvider.js.map +1 -1
  30. package/dist/healthybowl/offline/graphql.js.map +1 -1
  31. package/dist/healthybowl/offline/store.js +1 -1
  32. package/dist/healthybowl/offline/syncEngine.js +1 -2
  33. package/dist/healthybowl/offline/syncEngine.js.map +1 -1
  34. package/dist/healthybowl/offline/types.js.map +1 -1
  35. package/dist/healthybowl/pages/GettingStartedPage.js +0 -1
  36. package/dist/healthybowl/pages/GettingStartedPage.js.map +1 -1
  37. package/dist/healthybowl/pages/analytics/InsightsPage.js +2 -2
  38. package/dist/healthybowl/pages/analytics/InsightsPage.js.map +1 -1
  39. package/dist/healthybowl/pages/analytics/ReportsPage.js +99 -136
  40. package/dist/healthybowl/pages/analytics/ReportsPage.js.map +1 -1
  41. package/dist/healthybowl/pages/compliance/ComplianceOverviewPage.js +162 -204
  42. package/dist/healthybowl/pages/compliance/ComplianceOverviewPage.js.map +1 -1
  43. package/dist/healthybowl/pages/compliance/IcsGroupDetailPage.js +178 -196
  44. package/dist/healthybowl/pages/compliance/IcsGroupDetailPage.js.map +1 -1
  45. package/dist/healthybowl/pages/compliance/IcsGrowerDetailPage.js +141 -142
  46. package/dist/healthybowl/pages/compliance/IcsGrowerDetailPage.js.map +1 -1
  47. package/dist/healthybowl/pages/crops/CropFieldsPage.js +0 -2
  48. package/dist/healthybowl/pages/crops/CropFieldsPage.js.map +1 -1
  49. package/dist/healthybowl/pages/crops/CropHarvestPage.js +272 -316
  50. package/dist/healthybowl/pages/crops/CropHarvestPage.js.map +1 -1
  51. package/dist/healthybowl/pages/crops/CropPlanningPage.js +0 -6
  52. package/dist/healthybowl/pages/crops/CropPlanningPage.js.map +1 -1
  53. package/dist/healthybowl/pages/crops/FieldDetailsPage.js +846 -871
  54. package/dist/healthybowl/pages/crops/FieldDetailsPage.js.map +1 -1
  55. package/dist/healthybowl/pages/crops/HarvestDetailsPage.js +334 -376
  56. package/dist/healthybowl/pages/crops/HarvestDetailsPage.js.map +1 -1
  57. package/dist/healthybowl/pages/distribution/CsaPlanDetailPage.js +188 -415
  58. package/dist/healthybowl/pages/distribution/CsaPlanDetailPage.js.map +1 -1
  59. package/dist/healthybowl/pages/distribution/labels.js +2 -10
  60. package/dist/healthybowl/pages/distribution/labels.js.map +1 -1
  61. package/dist/healthybowl/pages/farm/FarmProfilePage.js +0 -1
  62. package/dist/healthybowl/pages/farm/FarmProfilePage.js.map +1 -1
  63. package/dist/healthybowl/pages/field-capture/CaptureObservationForm.js +8 -8
  64. package/dist/healthybowl/pages/fields/FieldMapPage.js +0 -2
  65. package/dist/healthybowl/pages/fields/FieldMapPage.js.map +1 -1
  66. package/dist/healthybowl/pages/financial/FinancialReportsPage.js +107 -92
  67. package/dist/healthybowl/pages/financial/FinancialReportsPage.js.map +1 -1
  68. package/dist/healthybowl/pages/government-schemes/ApplicationTrackingPage.js +188 -228
  69. package/dist/healthybowl/pages/government-schemes/ApplicationTrackingPage.js.map +1 -1
  70. package/dist/healthybowl/pages/government-schemes/SchemeDetailsPage.js +191 -261
  71. package/dist/healthybowl/pages/government-schemes/SchemeDetailsPage.js.map +1 -1
  72. package/dist/healthybowl/pages/inputs-insurance/InputsInsuranceOverviewPage.js +14 -14
  73. package/dist/healthybowl/pages/inputs-insurance/InputsInsuranceOverviewPage.js.map +1 -1
  74. package/dist/healthybowl/pages/irrigation/IrrigationPage.js +307 -338
  75. package/dist/healthybowl/pages/irrigation/IrrigationPage.js.map +1 -1
  76. package/dist/healthybowl/pages/livestock/AnimalDepthFormModal.js +102 -126
  77. package/dist/healthybowl/pages/livestock/AnimalDepthFormModal.js.map +1 -1
  78. package/dist/healthybowl/pages/livestock/AnimalDepthPage.js +215 -257
  79. package/dist/healthybowl/pages/livestock/AnimalDepthPage.js.map +1 -1
  80. package/dist/healthybowl/pages/livestock/GrazingPage.js +0 -1
  81. package/dist/healthybowl/pages/livestock/GrazingPage.js.map +1 -1
  82. package/dist/healthybowl/pages/livestock/HerdDepthPage.js +0 -4
  83. package/dist/healthybowl/pages/livestock/HerdDepthPage.js.map +1 -1
  84. package/dist/healthybowl/pages/livestock/grazing/RecordGrazingMoveModal.js +9 -8
  85. package/dist/healthybowl/pages/livestock/grazing/RecordGrazingMoveModal.js.map +1 -1
  86. package/dist/healthybowl/pages/network/ExpertsPage.js +419 -520
  87. package/dist/healthybowl/pages/network/ExpertsPage.js.map +1 -1
  88. package/dist/healthybowl/pages/weather/WeatherAlertHistoryPage.js +130 -129
  89. package/dist/healthybowl/pages/weather/WeatherAlertHistoryPage.js.map +1 -1
  90. package/dist/healthybowl/pages/weather/WeatherSettingsPage.js +237 -285
  91. package/dist/healthybowl/pages/weather/WeatherSettingsPage.js.map +1 -1
  92. package/dist/healthybowl/utils/plantingCapacity.js +10 -10
  93. package/dist/healthybowl/utils/plantingCapacity.js.map +1 -1
  94. package/dist/node_modules/fast-equals/dist/es/index.js +86 -74
  95. package/dist/node_modules/fast-equals/dist/es/index.js.map +1 -1
  96. package/dist/services/assistantApi.js +31 -60
  97. package/dist/services/assistantApi.js.map +1 -1
  98. package/dist/utils/pageContext.js +1 -15
  99. package/dist/utils/pageContext.js.map +1 -1
  100. package/package.json +1 -1
  101. package/dist/healthybowl/hooks/useAgronomyDecisions.js +0 -79
  102. package/dist/healthybowl/hooks/useAgronomyDecisions.js.map +0 -1
  103. package/dist/healthybowl/hooks/useAnalyticsReports.js +0 -173
  104. package/dist/healthybowl/hooks/useAnalyticsReports.js.map +0 -1
  105. package/dist/healthybowl/hooks/useComplianceExports.js +0 -74
  106. package/dist/healthybowl/hooks/useComplianceExports.js.map +0 -1
  107. package/dist/healthybowl/hooks/useConsultationPayments.js +0 -59
  108. package/dist/healthybowl/hooks/useConsultationPayments.js.map +0 -1
  109. package/dist/healthybowl/hooks/usePlantingEstimate.js +0 -88
  110. package/dist/healthybowl/hooks/usePlantingEstimate.js.map +0 -1
  111. package/dist/healthybowl/offline/HeaderOfflinePill.js +0 -28
  112. package/dist/healthybowl/offline/HeaderOfflinePill.js.map +0 -1
  113. package/dist/healthybowl/offline/captureCache.js +0 -30
  114. package/dist/healthybowl/offline/captureCache.js.map +0 -1
  115. package/dist/healthybowl/offline/headerSlot.js +0 -24
  116. package/dist/healthybowl/offline/headerSlot.js.map +0 -1
  117. package/dist/healthybowl/pages/ai/AiDecisionsPage.js +0 -287
  118. package/dist/healthybowl/pages/ai/AiDecisionsPage.js.map +0 -1
  119. package/dist/healthybowl/pages/compliance/ResidueTestsPage.js +0 -291
  120. package/dist/healthybowl/pages/compliance/ResidueTestsPage.js.map +0 -1
  121. package/dist/healthybowl/pages/compliance/SubstanceRulesPage.js +0 -300
  122. package/dist/healthybowl/pages/compliance/SubstanceRulesPage.js.map +0 -1
  123. package/dist/healthybowl/pages/compliance/substanceRuleForm.js +0 -135
  124. package/dist/healthybowl/pages/compliance/substanceRuleForm.js.map +0 -1
  125. package/dist/healthybowl/pages/government-schemes/schemeApplicationTransitions.js +0 -49
  126. package/dist/healthybowl/pages/government-schemes/schemeApplicationTransitions.js.map +0 -1
  127. package/dist/healthybowl/pages/government-schemes/schemeDocumentSlots.js +0 -48
  128. package/dist/healthybowl/pages/government-schemes/schemeDocumentSlots.js.map +0 -1
  129. package/dist/healthybowl/pages/government-schemes/useSchemeApplicationTransition.js +0 -54
  130. package/dist/healthybowl/pages/government-schemes/useSchemeApplicationTransition.js.map +0 -1
  131. package/dist/healthybowl/pages/livestock/PedigreeTree.js +0 -154
  132. package/dist/healthybowl/pages/livestock/PedigreeTree.js.map +0 -1
  133. package/dist/healthybowl/pages/livestock/eidTagInput.js +0 -39
  134. package/dist/healthybowl/pages/livestock/eidTagInput.js.map +0 -1
  135. package/dist/healthybowl/pages/livestock/pedigreeLayout.js +0 -68
  136. package/dist/healthybowl/pages/livestock/pedigreeLayout.js.map +0 -1
  137. package/dist/healthybowl/pages/weather/alertDelivery.js +0 -105
  138. package/dist/healthybowl/pages/weather/alertDelivery.js.map +0 -1
  139. package/dist/healthybowl/utils/icsInspection.js +0 -18
  140. package/dist/healthybowl/utils/icsInspection.js.map +0 -1
@@ -6,18 +6,18 @@ import { resolveLanguagePair as p } from "../../config/assistantLanguagePair.js"
6
6
  import { AssistantMessageList as m } from "./AssistantMessageList.js";
7
7
  import { AssistantApiCallsConsentDialog as h } from "./AssistantApiCallsConsentDialog.js";
8
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 y, getOrganizationId as ne, getWorkspaceId as b } from "../../utils/assistantContext.js";
12
- import { buildPromptParts as re, buildPromptWithAttachments as ie, countInlineImageCandidates as ae, countInlinedImageParts as oe, getSendableAttachments as x, toMessageAttachment as se } from "../../utils/assistantAttachments.js";
13
- import { useAssistantAttachments as S } from "../../hooks/useAssistantAttachments.js";
14
- import { AssistantComposer as ce } from "./composer/AssistantComposer.js";
15
- import { AssistantVoiceSession as le } from "./voice/AssistantVoiceSession.js";
16
- import { parseToolActivity as ue } from "./AssistantToolActivity.js";
17
- import { useVoiceSession as de } from "../../hooks/useVoiceSession.js";
18
- import { useAssistantApiAccess as fe } from "../../hooks/useAssistantApiAccess.js";
19
- import { useWorkspaceWriteAccess as pe } from "../../hooks/useWorkspaceWriteAccess.js";
20
- import { isVoiceTurn as me, voiceMarker as he, voiceSessionIdOf as ge } from "../../utils/voiceTurnVisibility.js";
9
+ import { AssistantSpokenTurnsNotice as ne } from "./AssistantSpokenTurnsNotice.js";
10
+ import { VoiceTranscriptDrawer as _ } from "./voice/VoiceTranscriptDrawer.js";
11
+ import { getActorId as v, getOrganizationId as re, getWorkspaceId as y } from "../../utils/assistantContext.js";
12
+ import { buildPromptParts as ie, buildPromptWithAttachments as ae, countInlineImageCandidates as oe, countInlinedImageParts as se, getSendableAttachments as b, toMessageAttachment as ce } from "../../utils/assistantAttachments.js";
13
+ import { useAssistantAttachments as x } from "../../hooks/useAssistantAttachments.js";
14
+ import { AssistantComposer as le } from "./composer/AssistantComposer.js";
15
+ import { AssistantVoiceSession as ue } from "./voice/AssistantVoiceSession.js";
16
+ import { parseToolActivity as de } from "./AssistantToolActivity.js";
17
+ import { useVoiceSession as fe } from "../../hooks/useVoiceSession.js";
18
+ import { useAssistantApiAccess as pe } from "../../hooks/useAssistantApiAccess.js";
19
+ import { useWorkspaceWriteAccess as me } from "../../hooks/useWorkspaceWriteAccess.js";
20
+ import { isVoiceTurn as he, voiceMarker as S, voiceSessionIdOf as ge } from "../../utils/voiceTurnVisibility.js";
21
21
  import { useConversationTurns as _e } from "../../hooks/useConversationTurns.js";
22
22
  import { isQuotaExhaustedError as ve } from "../../utils/quotaUtils.js";
23
23
  import { dispatchAssistantQuotaExhausted as ye, notifyAiCreditsUpdated as be } from "../../utils/aiCredits.js";
@@ -68,17 +68,15 @@ function Ge(e, t) {
68
68
  content: "Thinking...",
69
69
  done: !1
70
70
  };
71
- let r = n[n.length - 1], i = A(r.parts), a = O(r.parts), o = j(r.parts), s = De(r.parts), ee = [
72
- i,
73
- ...a,
74
- ...o
75
- ].filter(Boolean).join("\n\n") || "Thinking...", c = r.info?.providerID, l = r.info?.modelID;
71
+ let r = n[n.length - 1], i = A(r.parts), a = O(r.parts), o = j(r.parts), s = De(r.parts);
76
72
  return {
77
- content: ee,
73
+ content: [
74
+ i,
75
+ ...a,
76
+ ...o
77
+ ].filter(Boolean).join("\n\n") || "Thinking...",
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}` } : {},
82
80
  ...s ? { pendingWrite: s } : {}
83
81
  };
84
82
  }
@@ -95,7 +93,7 @@ var qe = ({ visible: De = !0 }) => {
95
93
  Xe,
96
94
  Ze,
97
95
  Ye
98
- ]), $e = Qe.reply.english, et = Qe.replyIsExplicit, tt = Qe.reply.code, { conversations: nt, activeConversationId: M, mode: N, processingByConversationId: rt, setMode: P, setConversationMode: F, setActiveConversation: it, createConversation: I, addMessage: L, updateMessage: at, patchMessage: R, mergeMessageMetadata: ot, setConversationProcessing: z, clearConversationProcessing: st, setBackendSessionId: ct, clearBackendSessionId: B, setSandbox: V, clearSandbox: lt, acknowledgeApiCalls: ut } = e(), H = _e(nt.find((e) => e.id === M)), U = H.all, W = M ? rt[M] : void 0, G = we(W?.status), dt = G ? W?.messageId ?? null : null, ft = W?.status === "error" ? W.messageId : null, { canUseApiCalls: pt, loading: mt } = fe(ne()), ht = pe(y(), b() || null), gt = T(() => Te.filter((e) => !e.requiresAdmin || pt), [pt]), [_t, vt] = Pe(null), [yt, bt] = Pe(!1), xt = E({}), St = E(Ne()), Ct = E(/* @__PURE__ */ new Set()), wt = T(() => Te.find((e) => e.id === N), [N]);
96
+ ]), $e = Qe.reply.english, et = Qe.replyIsExplicit, tt = Qe.reply.code, { conversations: nt, activeConversationId: M, mode: N, processingByConversationId: rt, setMode: P, setConversationMode: F, setActiveConversation: it, createConversation: I, addMessage: L, updateMessage: at, patchMessage: R, mergeMessageMetadata: ot, setConversationProcessing: z, clearConversationProcessing: st, setBackendSessionId: ct, clearBackendSessionId: B, setSandbox: V, clearSandbox: lt, acknowledgeApiCalls: ut } = e(), H = _e(nt.find((e) => e.id === M)), U = H.all, W = M ? rt[M] : void 0, G = we(W?.status), dt = G ? W?.messageId ?? null : null, ft = W?.status === "error" ? W.messageId : null, { canUseApiCalls: pt, loading: mt } = pe(re()), ht = me(v(), y() || null), gt = T(() => Te.filter((e) => !e.requiresAdmin || pt), [pt]), [_t, vt] = Pe(null), [yt, bt] = Pe(!1), xt = E({}), St = E(Ne()), Ct = E(/* @__PURE__ */ new Set()), wt = T(() => Te.find((e) => e.id === N), [N]);
99
97
  w(() => {
100
98
  mt || (!wt || wt.requiresAdmin && !pt) && N !== "assistant" && P("assistant");
101
99
  }, [
@@ -150,102 +148,102 @@ var qe = ({ visible: De = !0 }) => {
150
148
  let f = u.mode, p = M, m = p ? e.getState().conversations.find((e) => e.id === p) : void 0;
151
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;
152
150
  xt.current[p] = r;
153
- let h = b(), g = {
151
+ let h = y(), g = {
154
152
  accessToken: j(),
155
153
  workspaceToken: qe(),
156
154
  userId: Je,
157
- organizationId: ne()
158
- }, _ = {
155
+ organizationId: re()
156
+ }, ne = {
159
157
  id: Ue(),
160
158
  role: "user",
161
159
  content: n,
162
160
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
163
161
  metadata: {
164
- ...r.length ? { attachments: r.map(se) } : {},
165
- ...he(a.voiceSessionId)
162
+ ...r.length ? { attachments: r.map(ce) } : {},
163
+ ...S(a.voiceSessionId)
166
164
  }
167
165
  };
168
- L(p, _);
169
- let v = Ue();
166
+ L(p, ne);
167
+ let _ = Ue();
170
168
  L(p, {
171
- id: v,
169
+ id: _,
172
170
  role: "assistant",
173
171
  content: "",
174
172
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
175
173
  metadata: {
176
174
  lang: tt,
177
- ...he(a.voiceSessionId)
175
+ ...S(a.voiceSessionId)
178
176
  }
179
- }), z(p, "provisioning", v, null);
180
- let y = (e, t, n, r, i = tt) => {
181
- R(p, v, { content: We(e) }), ot(p, v, {
177
+ }), z(p, "provisioning", _, null);
178
+ let v = (e, t, n, r, i = tt) => {
179
+ R(p, _, { content: We(e) }), ot(p, _, {
182
180
  lang: i,
183
181
  ...t?.length ? { artifacts: t } : {},
184
182
  ...t?.length || n || r ? { mode: f } : {},
185
183
  ...n ? { sessionId: n } : {},
186
184
  ...r ? { sandboxId: r } : {},
187
- ...he(a.voiceSessionId)
185
+ ...S(a.voiceSessionId)
188
186
  });
189
- }, x = async (e = 1) => {
187
+ }, b = async (e = 1) => {
190
188
  let a = !1;
191
189
  try {
192
190
  await t(A, h, g);
193
191
  } catch (e) {
194
192
  if (ve(e)) {
195
- ye("ai-credits"), y("You've run out of AI credits for this billing cycle. Upgrade your plan to keep chatting.", void 0, void 0, void 0, "en"), z(p, "error", v, null);
193
+ ye("ai-credits"), v("You've run out of AI credits for this billing cycle. Upgrade your plan to keep chatting.", void 0, void 0, void 0, "en"), z(p, "error", _, null);
196
194
  return;
197
195
  }
198
196
  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);
199
197
  }
200
198
  try {
201
- let { sandboxId: e, sessionId: t } = await Tt(p, v, f, h, g), u = (await s(A, e, h, t, g, 50).catch(() => [])).reduce((e, t) => Math.max(e, k(t)), 0);
202
- K(p, v, "streaming", "Thinking...");
203
- let d = xe(f, ie(n, r), $e, et, ee), m = re(d, r), _ = oe(m), ne = _ > 0, b = te();
204
- a = ae(r) > _;
199
+ let { sandboxId: e, sessionId: t } = await Tt(p, _, f, h, g), u = (await s(A, e, h, t, g, 50).catch(() => [])).reduce((e, t) => Math.max(e, k(t)), 0);
200
+ K(p, _, "streaming", "Thinking...");
201
+ let d = xe(f, ae(n, r), $e, et, ee), m = ie(d, r), ne = se(m), re = ne > 0, y = te();
202
+ a = oe(r) > ne;
205
203
  try {
206
- await l(A, e, h, t, d, f, b, g, m);
204
+ await l(A, e, h, t, d, f, y, g, m);
207
205
  } catch (n) {
208
206
  if (!m || !Se(n)) throw n;
209
- await l(A, e, h, t, d, f, b, g, void 0), a ||= ne;
207
+ await l(A, e, h, t, d, f, y, g, void 0), a ||= re;
210
208
  }
211
- let x = Ge([], u), se = Date.now() + (Be[f] ?? Ve), S = Date.now(), ce = Date.now();
212
- for (; Date.now() < se && (x = Ge(await s(A, e, h, t, g, 50, u), u), R(p, v, { content: We(x.content) }), x.pendingWrite && ot(p, v, { pendingWrite: x.pendingWrite }), !x.done);) Date.now() - S > 3e4 && (await i(A, e, h, 600, g).catch(() => void 0), S = Date.now()), await new Promise((e) => setTimeout(e, Ee(Date.now() - ce)));
213
- if (!x.done && f !== "vibe-plugins") throw Error("Assistant response timed out while streaming progress");
214
- let le = f === "vibe-plugins" ? await o(A, e, h, t, g).catch(() => []) : void 0;
215
- if (x.done || (x = {
216
- ...x,
217
- 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._`
218
- }), a && (x = {
219
- ...x,
220
- 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._")}`
221
- }), y(x.content, le, t, e), x.tokens) {
222
- R(p, v, { tokens: x.tokens });
209
+ let b = Ge([], u), ce = Date.now() + (Be[f] ?? Ve), x = Date.now(), le = Date.now();
210
+ for (; Date.now() < ce && (b = Ge(await s(A, e, h, t, g, 50, u), u), R(p, _, { content: We(b.content) }), b.pendingWrite && ot(p, _, { pendingWrite: b.pendingWrite }), !b.done);) Date.now() - x > 3e4 && (await i(A, e, h, 600, g).catch(() => void 0), x = Date.now()), await new Promise((e) => setTimeout(e, Ee(Date.now() - le)));
211
+ if (!b.done && f !== "vibe-plugins") throw Error("Assistant response timed out while streaming progress");
212
+ let ue = f === "vibe-plugins" ? await o(A, e, h, t, g).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
+ }), v(b.content, ue, t, e), b.tokens) {
220
+ R(p, _, { tokens: b.tokens });
223
221
  try {
224
- await c(A, h, t, x.messageId, x.model, x.tokens, g), be();
222
+ await c(A, h, t, b.tokens, g), be();
225
223
  } catch {}
226
224
  }
227
- z(p, "complete", v, null);
225
+ z(p, "complete", _, null);
228
226
  } catch (t) {
229
- if (e === 1 && Ce(t)) return B(p), lt(f), x(2);
227
+ if (e === 1 && Ce(t)) return B(p), lt(f), b(2);
230
228
  throw t;
231
229
  }
232
- }, S = p;
233
- Ct.current.add(S);
230
+ }, x = p;
231
+ Ct.current.add(x);
234
232
  try {
235
233
  if (!h) throw Error("Assistant backend is unavailable without an active workspace context.");
236
- await x();
234
+ await b();
237
235
  } catch (t) {
238
236
  if (St.current.invalidate(e.getState().sandboxesByMode[f]?.sandboxId ?? null), ve(t)) {
239
- ye("sandbox"), y("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);
237
+ ye("sandbox"), v("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", _, null);
240
238
  return;
241
239
  }
242
240
  let n = t instanceof Error ? t.message : "Something went wrong";
243
- z(p, "error", v, n), R(p, v, { content: `Sorry, an error occurred: ${n}. Please try again.` }), ot(p, v, {
241
+ z(p, "error", _, n), R(p, _, { content: `Sorry, an error occurred: ${n}. Please try again.` }), ot(p, _, {
244
242
  lang: "en",
245
- ...he(a.voiceSessionId)
243
+ ...S(a.voiceSessionId)
246
244
  });
247
245
  } finally {
248
- Ct.current.delete(S);
246
+ Ct.current.delete(x);
249
247
  }
250
248
  }, [
251
249
  M,
@@ -285,8 +283,8 @@ var qe = ({ visible: De = !0 }) => {
285
283
  if (G) return null;
286
284
  for (let e = U.length - 1; e >= 0; --e) {
287
285
  let t = U[e];
288
- if (t?.role !== "assistant" || !me(t)) continue;
289
- let n = ue(t.content).text.trim();
286
+ if (t?.role !== "assistant" || !he(t)) continue;
287
+ let n = de(t.content).text.trim();
290
288
  return n ? {
291
289
  id: t.id,
292
290
  text: n
@@ -296,7 +294,7 @@ var qe = ({ visible: De = !0 }) => {
296
294
  }, [U, G]), kt = T(() => J ? Oe(J.text) : null, [J]), At = H.chat, Y = T(() => H.voice.filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
297
295
  id: e.id,
298
296
  role: e.role,
299
- text: ue(e.content).text.trim(),
297
+ text: de(e.content).text.trim(),
300
298
  sessionId: ge(e),
301
299
  timestamp: e.timestamp
302
300
  })).filter((e) => e.text.length > 0), [H.voice]), jt = C(() => {
@@ -310,12 +308,12 @@ var qe = ({ visible: De = !0 }) => {
310
308
  you: O("voiceSession.speakerYou", "You"),
311
309
  assistant: O("voiceSession.speakerAssistant", "Assistant")
312
310
  }, e), je(e), "text/markdown");
313
- }, [Y, O]), X = S(), Z = E(X);
311
+ }, [Y, O]), X = x(), Z = E(X);
314
312
  Z.current = X;
315
- let Q = de({
313
+ let Q = fe({
316
314
  onSubmit: C((e, t) => {
317
315
  let n = () => {
318
- let n = Z.current, r = x(n.attachments);
316
+ let n = Z.current, r = b(n.attachments);
319
317
  Ot.current(e, r, { voiceSessionId: t }), n.clear();
320
318
  };
321
319
  if (!Z.current.isBusy) {
@@ -396,7 +394,7 @@ var qe = ({ visible: De = !0 }) => {
396
394
  className: "contents",
397
395
  inert: Q.active || void 0,
398
396
  children: [
399
- Y.length > 0 && !Q.active ? /* @__PURE__ */ D(_, {
397
+ Y.length > 0 && !Q.active ? /* @__PURE__ */ D(ne, {
400
398
  count: Y.length,
401
399
  onOpenTranscript: () => bt(!0)
402
400
  }) : null,
@@ -412,7 +410,7 @@ var qe = ({ visible: De = !0 }) => {
412
410
  onRetry: Dt
413
411
  })
414
412
  }),
415
- /* @__PURE__ */ D(ce, {
413
+ /* @__PURE__ */ D(le, {
416
414
  onStartVoiceSession: Q.available && N !== "api-calls" ? Q.start : void 0,
417
415
  onSend: (e, t) => void q(e, t),
418
416
  disabled: G,
@@ -424,12 +422,12 @@ var qe = ({ visible: De = !0 }) => {
424
422
  })
425
423
  ]
426
424
  }),
427
- yt && !Q.active ? /* @__PURE__ */ D(v, {
425
+ yt && !Q.active ? /* @__PURE__ */ D(_, {
428
426
  turns: Y,
429
427
  onClose: () => bt(!1),
430
428
  onSave: jt
431
429
  }) : null,
432
- Q.active && /* @__PURE__ */ D(le, {
430
+ Q.active && /* @__PURE__ */ D(ue, {
433
431
  session: Q.session,
434
432
  notice: Q.notice,
435
433
  capturing: Q.capturing,