@burdenoff/fe-libs 2026.1114.13 → 2026.1114.14

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 (39) hide show
  1. package/dist/shared/assistant/conversation.d.ts +16 -0
  2. package/dist/shared/assistant/i18nManifest.d.ts +30 -0
  3. package/dist/shared/assistant/i18nManifest.js +30 -0
  4. package/dist/shared/assistant/index.d.ts +6 -0
  5. package/dist/shared/assistant/store.d.ts +7 -0
  6. package/dist/shared/assistant/store.js +3 -0
  7. package/dist/shared/assistant/ui/AssistantChatArea.js +1269 -1188
  8. package/dist/shared/assistant/ui/AssistantMessageList.d.ts +14 -0
  9. package/dist/shared/assistant/ui/AssistantMessageList.js +55 -52
  10. package/dist/shared/assistant/ui/composer/AssistantComposer.js +387 -395
  11. package/dist/shared/assistant/ui/composer/AssistantDictation.d.ts +42 -0
  12. package/dist/shared/assistant/ui/composer/AssistantDictation.js +127 -0
  13. package/dist/shared/assistant/ui/composer/AssistantMicMenu.d.ts +23 -0
  14. package/dist/shared/assistant/ui/composer/AssistantMicMenu.js +176 -0
  15. package/dist/shared/assistant/ui/composer/microphones.d.ts +13 -0
  16. package/dist/shared/assistant/ui/composer/microphones.js +15 -0
  17. package/dist/shared/assistant/ui/composer/useCompactDictation.d.ts +70 -0
  18. package/dist/shared/assistant/ui/composer/useCompactDictation.js +136 -0
  19. package/dist/shared/assistant/ui/useVoiceSession.js +166 -164
  20. package/dist/shared/assistant/ui/voice/AssistantPageVoiceBar.d.ts +20 -17
  21. package/dist/shared/assistant/ui/voice/AssistantPageVoiceBar.js +230 -123
  22. package/dist/shared/assistant/ui/voice/AssistantVoiceSession.d.ts +2 -0
  23. package/dist/shared/assistant/ui/voice/AssistantVoiceSession.js +227 -229
  24. package/dist/shared/assistant/ui/voice/AssistantVoiceSessionButton.d.ts +5 -0
  25. package/dist/shared/assistant/ui/voice/AssistantVoiceSessionButton.js +6 -6
  26. package/dist/shared/assistant/ui/voice/LiveWaveform.d.ts +4 -3
  27. package/dist/shared/assistant/ui/voice/LiveWaveform.js +1 -1
  28. package/dist/shared/assistant/ui/voice/VoiceTurnMarks.d.ts +15 -0
  29. package/dist/shared/assistant/ui/voice/VoiceTurnMarks.js +43 -0
  30. package/dist/shared/assistant/ui/voice/formatClock.d.ts +2 -0
  31. package/dist/shared/assistant/ui/voice/formatClock.js +3 -0
  32. package/dist/shared/assistant/ui/voice/useLiveLevel.d.ts +3 -1
  33. package/dist/shared/assistant/ui/voice/useLiveLevel.js +23 -19
  34. package/dist/shared/assistant/voice/liveLevel.d.ts +4 -3
  35. package/dist/shared/assistant/voice/liveLevel.js +18 -15
  36. package/dist/shared/assistant/voice/useVoiceInput.d.ts +27 -1
  37. package/dist/shared/assistant/voice/useVoiceInput.js +141 -71
  38. package/dist/shared-assistant.js +383 -377
  39. package/package.json +1 -1
@@ -99,186 +99,187 @@ import { toCaptionText as nr } from "../voice/captionText.js";
99
99
  import { buildContinuedFromVoiceNote as rr, buildVoiceTranscriptMarkdown as ir, voiceTranscriptFilename as ar } from "../voice/voiceTranscript.js";
100
100
  import { downloadFile as or } from "../exportConversation.js";
101
101
  import { chatTurns as sr, isVoiceTurn as cr, voiceMarker as lr, voiceSessionIdOf as ur } from "../voice/turnVisibility.js";
102
- import { isAwaitingOwnConversation as dr, maySendSpokenTurn as fr, planTranscriptAutoOpen as pr, planVoiceSessionBinding as mr, planVoiceSessionStart as hr, planVoiceSpokenEntry as gr, voiceBindingAtStart as _r, voiceBindingConversationId as vr } from "../voice/voiceReopen.js";
103
- import { transcriptAutoOpenSlot as yr } from "./transcriptAutoOpenSlot.js";
104
- import { toVoiceReply as br } from "../voice/voiceReply.js";
105
- import { beginApprovalInFlight as xr, endApprovalInFlight as Sr, getApprovalInFlight as Cr, markLiveTurn as wr, newestModelReplyId as Tr, resolveApprovablePendingWrite as Er, resolveRetryableMessageId as Dr, subscribeApprovalInFlight as Or } from "../liveTurns.js";
106
- import { createReadinessTracker as kr, planAfterTransportFailure as Ar, planTrustedSandboxFailure as jr } from "../sandboxReadiness.js";
107
- import { couldBeLocalUiCommand as Mr, isAlreadyThere as Nr, matchLocalUiCommand as Pr, mayBeNavigationFollowUp as Fr, navDestinations as Ir, planThemeChange as Lr } from "../localUiCommands.js";
108
- import { backDoneCopy as Rr, chooseDestinationCopy as zr, chooseLinkedCopy as Br, entityNounText as Vr, linkNotOpenableCopy as Hr, navigationCommandCopy as Ur, navigationOutcomeCopy as Wr, offerExpiredCopy as Gr, offerKeptForUnsavedCopy as Kr, offerNotAvailableCopy as qr, pickFromListCopy as Jr, recordChoiceCopy as Yr, recordKindsCopy as Xr, themeCommandCopy as Zr } from "../localUiCommandCopy.js";
109
- import { offerAssentFor as Qr } from "../localeCommands/assent.js";
110
- import { appControlCopy as $r } from "../appControls/copy.js";
111
- import { LANGUAGE_REPLY_DEADLINE_MS as ei, languageConfirmationCopy as ti, languageReplyStep as ni } from "../appControls/languageReply.js";
112
- import { planAppControl as ri } from "../appControls/plan.js";
113
- import { readControlSnapshot as ii } from "../appControls/snapshot.js";
114
- import { subscribeAssistantControls as ai } from "../appControls/registry.js";
115
- import { useAssistantControl as oi } from "../appControls/useAssistantControl.js";
116
- import { useControlConfirmDialog as si } from "./controlConfirmDialog.js";
117
- import { useLeaveConfirmAsking as ci } from "./leaveConfirm.js";
118
- import { startFocusReturnAfterKeep as li } from "./leaveConfirmFocus.js";
119
- import { buildNavigationContext as ui, latestReplyOnSurface as di, rememberPresentedList as fi } from "../uiActions/linkContext.js";
120
- import { lookupNamedRecords as pi } from "../uiActions/recordNames.js";
121
- import { navEntryIds as mi } from "../uiActions/resolveTarget.js";
122
- import { buildUiCatalogue as hi, markUiCatalogueSent as gi, uiCatalogueSent as _i, uiCatalogueSessionKey as vi } from "../uiActions/uiCatalogue.js";
123
- import { offerYesOnSurface as yi } from "../uiActions/offerYesOnSurface.js";
124
- import { UiOfferSession as bi, sandboxServesUiOffers as xi, uiOfferHintKind as Si, uiOfferInTime as Ci } from "../uiActions/uiOffers.js";
125
- import { parseNavIntent as wi } from "../uiActions/navIntent.js";
126
- import { decideActOnResolve as Ti, n4LeaveGuard as Ei } from "../uiActions/actOnResolve.js";
127
- import { AssistantUiOfferLinks as Di } from "./AssistantUiOfferLink.js";
128
- import { assistantBackStack as Oi, isBackRunnable as ki } from "../uiActions/backStack.js";
129
- import { subscribeDraftPathname as Ai } from "../uiActions/draftPathname.js";
130
- import { buildNavigateAction as ji, destinationForPath as Mi, labelForPath as Ni, newestAssistantOnSurface as Pi } from "../uiActions/navigateAction.js";
131
- import { runNavigation as Fi } from "../uiActions/navigationOutcome.js";
132
- import { assistantHistory as Ii } from "../history/historyEngine.js";
133
- import { conversationHasHistory as Li, isOtherScopeHistoryConversation as Ri, isReadOnlyHistoryConversation as zi, isReusableHistoryDraft as Bi } from "../history/historyList.js";
134
- import { resumeContextFor as Vi } from "../history/historyResume.js";
135
- import { useAssistantHistoryStatus as Hi } from "../history/historyStatus.js";
136
- import { useHistoryRowControlsFor as Ui } from "../history/useHistoryRowControls.js";
137
- import { getHistoryStamp as Wi, setHistoryBusyProbe as Gi } from "../history/stampRegistry.js";
138
- import { resolveConversationDeleteTarget as Ki } from "../conversationDeleteCommand.js";
139
- import { useAssistantNavigate as qi } from "./AssistantMarkdownRenderer.js";
140
- import { useAssistantSpeech as Ji } from "./AssistantSpeechProvider.js";
141
- import { useAssistantStopTurnLabel as Yi } from "../../providers/shell/useAssistantShellLabels.js";
142
- import { useThemeOrNull as Xi } from "../../providers/shell/ThemeProvider.js";
143
- import { useVisibleNavItems as Zi } from "../../../chrome/mobileTabBar/useVisibleNavItems.js";
144
- import { useAskAboutStore as Qi } from "../askAbout/askAboutStore.js";
145
- import { readMessageFocus as $i, withFocusNote as ea } from "../askAbout/focus.js";
146
- import { useCallback as D, useEffect as O, useLayoutEffect as ta, useMemo as k, useRef as A, useState as j, useSyncExternalStore as na } from "react";
147
- import { Fragment as ra, jsx as M, jsxs as ia } from "react/jsx-runtime";
102
+ import { VoiceChatEnded as dr, VoiceTurnTag as fr } from "./voice/VoiceTurnMarks.js";
103
+ import { isAwaitingOwnConversation as pr, maySendSpokenTurn as mr, planTranscriptAutoOpen as hr, planVoiceSessionBinding as gr, planVoiceSessionStart as _r, planVoiceSpokenEntry as vr, voiceBindingAtStart as yr, voiceBindingConversationId as br } from "../voice/voiceReopen.js";
104
+ import { transcriptAutoOpenSlot as xr } from "./transcriptAutoOpenSlot.js";
105
+ import { toVoiceReply as Sr } from "../voice/voiceReply.js";
106
+ import { beginApprovalInFlight as Cr, endApprovalInFlight as wr, getApprovalInFlight as Tr, markLiveTurn as Er, newestModelReplyId as Dr, resolveApprovablePendingWrite as Or, resolveRetryableMessageId as kr, subscribeApprovalInFlight as Ar } from "../liveTurns.js";
107
+ import { createReadinessTracker as jr, planAfterTransportFailure as Mr, planTrustedSandboxFailure as Nr } from "../sandboxReadiness.js";
108
+ import { couldBeLocalUiCommand as Pr, isAlreadyThere as Fr, matchLocalUiCommand as Ir, mayBeNavigationFollowUp as Lr, navDestinations as Rr, planThemeChange as zr } from "../localUiCommands.js";
109
+ import { backDoneCopy as Br, chooseDestinationCopy as Vr, chooseLinkedCopy as Hr, entityNounText as Ur, linkNotOpenableCopy as Wr, navigationCommandCopy as Gr, navigationOutcomeCopy as Kr, offerExpiredCopy as qr, offerKeptForUnsavedCopy as Jr, offerNotAvailableCopy as Yr, pickFromListCopy as Xr, recordChoiceCopy as Zr, recordKindsCopy as Qr, themeCommandCopy as $r } from "../localUiCommandCopy.js";
110
+ import { offerAssentFor as ei } from "../localeCommands/assent.js";
111
+ import { appControlCopy as ti } from "../appControls/copy.js";
112
+ import { LANGUAGE_REPLY_DEADLINE_MS as ni, languageConfirmationCopy as ri, languageReplyStep as ii } from "../appControls/languageReply.js";
113
+ import { planAppControl as ai } from "../appControls/plan.js";
114
+ import { readControlSnapshot as oi } from "../appControls/snapshot.js";
115
+ import { subscribeAssistantControls as si } from "../appControls/registry.js";
116
+ import { useAssistantControl as ci } from "../appControls/useAssistantControl.js";
117
+ import { useControlConfirmDialog as li } from "./controlConfirmDialog.js";
118
+ import { useLeaveConfirmAsking as ui } from "./leaveConfirm.js";
119
+ import { startFocusReturnAfterKeep as di } from "./leaveConfirmFocus.js";
120
+ import { buildNavigationContext as fi, latestReplyOnSurface as pi, rememberPresentedList as mi } from "../uiActions/linkContext.js";
121
+ import { lookupNamedRecords as hi } from "../uiActions/recordNames.js";
122
+ import { navEntryIds as gi } from "../uiActions/resolveTarget.js";
123
+ import { buildUiCatalogue as _i, markUiCatalogueSent as vi, uiCatalogueSent as yi, uiCatalogueSessionKey as bi } from "../uiActions/uiCatalogue.js";
124
+ import { offerYesOnSurface as xi } from "../uiActions/offerYesOnSurface.js";
125
+ import { UiOfferSession as Si, sandboxServesUiOffers as Ci, uiOfferHintKind as wi, uiOfferInTime as Ti } from "../uiActions/uiOffers.js";
126
+ import { parseNavIntent as Ei } from "../uiActions/navIntent.js";
127
+ import { decideActOnResolve as Di, n4LeaveGuard as Oi } from "../uiActions/actOnResolve.js";
128
+ import { AssistantUiOfferLinks as ki } from "./AssistantUiOfferLink.js";
129
+ import { assistantBackStack as Ai, isBackRunnable as ji } from "../uiActions/backStack.js";
130
+ import { subscribeDraftPathname as Mi } from "../uiActions/draftPathname.js";
131
+ import { buildNavigateAction as Ni, destinationForPath as Pi, labelForPath as Fi, newestAssistantOnSurface as Ii } from "../uiActions/navigateAction.js";
132
+ import { runNavigation as Li } from "../uiActions/navigationOutcome.js";
133
+ import { assistantHistory as Ri } from "../history/historyEngine.js";
134
+ import { conversationHasHistory as zi, isOtherScopeHistoryConversation as Bi, isReadOnlyHistoryConversation as Vi, isReusableHistoryDraft as Hi } from "../history/historyList.js";
135
+ import { resumeContextFor as Ui } from "../history/historyResume.js";
136
+ import { useAssistantHistoryStatus as Wi } from "../history/historyStatus.js";
137
+ import { useHistoryRowControlsFor as Gi } from "../history/useHistoryRowControls.js";
138
+ import { getHistoryStamp as Ki, setHistoryBusyProbe as qi } from "../history/stampRegistry.js";
139
+ import { resolveConversationDeleteTarget as Ji } from "../conversationDeleteCommand.js";
140
+ import { useAssistantNavigate as Yi } from "./AssistantMarkdownRenderer.js";
141
+ import { useAssistantSpeech as Xi } from "./AssistantSpeechProvider.js";
142
+ import { useAssistantStopTurnLabel as Zi } from "../../providers/shell/useAssistantShellLabels.js";
143
+ import { useThemeOrNull as Qi } from "../../providers/shell/ThemeProvider.js";
144
+ import { useVisibleNavItems as $i } from "../../../chrome/mobileTabBar/useVisibleNavItems.js";
145
+ import { useAskAboutStore as ea } from "../askAbout/askAboutStore.js";
146
+ import { readMessageFocus as ta, withFocusNote as na } from "../askAbout/focus.js";
147
+ import { useCallback as D, useEffect as O, useLayoutEffect as ra, useMemo as k, useRef as A, useState as j, useSyncExternalStore as ia } from "react";
148
+ import { Fragment as aa, jsx as M, jsxs as oa } from "react/jsx-runtime";
148
149
  // src/shared/assistant/ui/AssistantChatArea.tsx
149
- var aa = 2500, oa = 300, sa = 2e4, ca = 1e4, la = 1e4, ua = !1, da = {
150
+ var sa = 2500, ca = 300, la = 2e4, ua = 1e4, da = 1e4, fa = !1, pa = {
150
151
  committing: !1,
151
152
  dictating: !1
152
- }, fa = 6e3;
153
+ }, ma = 6e3;
153
154
  function N() {
154
155
  return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
155
156
  }
156
- var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ visible: ga = !0, writeAccess: _a = "unknown", presentation: va = "classic", inputRef: ya, onDraftDirtyChange: ba, surface: xa, onWindowVoiceChange: Sa, onOpenFull: Ca, onContinuedInChat: wa }) => {
157
- let P = jn(), Ta = Yi(), F = va === "compact", Ea = ze(), Da = Ve(), Oa = D((e) => Be("above", e), []), ka = D((e) => Be("below", e), []), Aa = F && xa === "window", { product: I, modes: L, gatherPageContext: ja, buildPrompt: Ma, reportTurnTimings: Na, reportTokenUsage: Pa, localUiCommands: Fa } = Nn(), R = Ct(Nn().writeApproval), Ia = D((e, t) => {
157
+ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ visible: va = !0, writeAccess: ya = "unknown", presentation: ba = "classic", inputRef: xa, onDraftDirtyChange: Sa, surface: Ca, onWindowVoiceChange: wa, onOpenFull: Ta, onContinuedInChat: Ea }) => {
158
+ let P = jn(), Da = Zi(), F = ba === "compact", I = ze(), Oa = Ve(), ka = D((e) => Be("above", e), []), Aa = D((e) => Be("below", e), []), ja = F && Ca === "window", { product: L, modes: R, gatherPageContext: Ma, buildPrompt: Na, reportTurnTimings: Pa, reportTokenUsage: Fa, localUiCommands: Ia } = Nn(), z = Ct(Nn().writeApproval), La = D((e, t) => {
158
159
  let n = w.getState(), r = t ?? n.sandboxesByMode[e]?.sandboxId ?? null;
159
160
  return g({
160
161
  mode: e,
161
- productWriteApproval: R,
162
+ productWriteApproval: z,
162
163
  capabilities: r ? n.sandboxWriteCapabilities[r] : null
163
164
  });
164
- }, [R]), { getAccessToken: La, getWorkspaceToken: Ra, userId: z } = r(), { locale: B, isLocaleLoading: za } = n(), Ba = w((e) => e.voiceGraceMs), Va = w((e) => e.handsFreeInterrupt), Ha = w((e) => e.handsFreeStreamNoticeAccepted), Ua = w((e) => e.acceptHandsFreeStreamNotice), Wa = w((e) => e.assistantLanguage), Ga = w((e) => e.replyLanguage), Ka = k(() => s(Wa, Ga, B), [
165
- Wa,
165
+ }, [z]), { getAccessToken: Ra, getWorkspaceToken: za, userId: B } = r(), { locale: V, isLocaleLoading: Ba } = n(), Va = w((e) => e.voiceGraceMs), Ha = w((e) => e.handsFreeInterrupt), Ua = w((e) => e.handsFreeStreamNoticeAccepted), Wa = w((e) => e.acceptHandsFreeStreamNotice), Ga = w((e) => e.assistantLanguage), Ka = w((e) => e.replyLanguage), qa = k(() => s(Ga, Ka, V), [
166
166
  Ga,
167
- B
168
- ]), qa = Ka.reply.english, Ja = Ka.replyIsExplicit, Ya = Ka.reply.code, { conversations: Xa, activeConversationId: V, mode: H, processingByConversationId: Za, setMode: Qa, setConversationMode: $a, setActiveConversation: eo, createConversation: to, addMessage: U, updateMessage: no, patchMessage: ro, mergeMessageMetadata: io, setConversationProcessing: ao, clearConversationProcessing: oo, setBackendSessionId: so, clearBackendSessionId: co, setSandbox: lo, clearSandbox: uo, acknowledgedWriteModes: fo, acknowledgeWriteMode: po, autoRouting: mo, setAutoRouting: ho, routeConversation: go } = w(), W = Xa.find((e) => e.id === V), _o = at(W), vo = _o.all, G = V ? Za[V] : void 0, yo = On(G?.status), bo = yo ? G?.messageId ?? null : null, xo = G?.status === "error" ? G.messageId : null, So = w((e) => e.sandboxWriteCapabilities), { panel: K, entries: Co, retiredSandboxes: wo } = ee({
167
+ Ka,
168
+ V
169
+ ]), Ja = qa.reply.english, Ya = qa.replyIsExplicit, Xa = qa.reply.code, { conversations: Za, activeConversationId: H, mode: U, processingByConversationId: Qa, setMode: $a, setConversationMode: eo, setActiveConversation: to, createConversation: no, addMessage: W, updateMessage: ro, patchMessage: io, mergeMessageMetadata: ao, setConversationProcessing: oo, clearConversationProcessing: so, setBackendSessionId: co, clearBackendSessionId: lo, setSandbox: uo, clearSandbox: fo, acknowledgedWriteModes: po, acknowledgeWriteMode: mo, autoRouting: ho, setAutoRouting: go, routeConversation: _o } = w(), G = Za.find((e) => e.id === H), vo = at(G), yo = vo.all, bo = H ? Qa[H] : void 0, xo = On(bo?.status), So = xo ? bo?.messageId ?? null : null, Co = bo?.status === "error" ? bo.messageId : null, wo = w((e) => e.sandboxWriteCapabilities), { panel: K, entries: To, retiredSandboxes: Eo } = ee({
169
170
  tr: P,
170
- productWriteApproval: R
171
- }), To = p({
171
+ productWriteApproval: z
172
+ }), Do = p({
172
173
  approve: (e, t) => K.approve(e, t),
173
174
  decline: (e, t, n) => K.decline(e, t, n),
174
175
  presented: (e, t) => K.presented(e, t)
175
- }), Eo = To.dismiss, Do = A(null);
176
+ }), Oo = Do.dismiss, ko = A(null);
176
177
  O(() => {
177
- Eo();
178
- let e = Do.current;
179
- Do.current = V, e && e !== V && K.withdraw(e, "conversation_closed"), V && K.openConversation(V);
178
+ Oo();
179
+ let e = ko.current;
180
+ ko.current = H, e && e !== H && K.withdraw(e, "conversation_closed"), H && K.openConversation(H);
180
181
  }, [
181
- V,
182
+ H,
182
183
  K,
183
- Eo
184
+ Oo
184
185
  ]);
185
- let Oo = zi(W), ko = Ui(W)?.archivedAt != null, Ao = Hi((e) => V !== null && V in e.loadingIds), jo = Hi((e) => V !== null && V in e.loadErrorIds), Mo = Hi((e) => e.remoteDelete), [No, Po] = j(() => Hi.getState().remoteDelete?.at ?? null), Fo = Mo?.wasActive === !0 && Mo.at !== No ? Mo.at : null;
186
+ let Ao = Vi(G), jo = Gi(G)?.archivedAt != null, Mo = Wi((e) => H !== null && H in e.loadingIds), No = Wi((e) => H !== null && H in e.loadErrorIds), Po = Wi((e) => e.remoteDelete), [Fo, Io] = j(() => Wi.getState().remoteDelete?.at ?? null), Lo = Po?.wasActive === !0 && Po.at !== Fo ? Po.at : null;
186
187
  O(() => {
187
- if (Fo === null) return;
188
- let e = window.setTimeout(() => Po(Fo), la);
188
+ if (Lo === null) return;
189
+ let e = window.setTimeout(() => Io(Lo), da);
189
190
  return () => window.clearTimeout(e);
190
- }, [Fo]);
191
- let Io = T(), { canUseApiCalls: Lo, loading: Ro } = Qe(Io, z), zo = A(Xn({
192
- loading: Ro,
193
- canUseAdminModes: Lo
194
- })).current, Bo = A(L);
191
+ }, [Lo]);
192
+ let Ro = T(), { canUseApiCalls: zo, loading: Bo } = Qe(Ro, B), Vo = A(Xn({
193
+ loading: Bo,
194
+ canUseAdminModes: zo
195
+ })).current, Ho = A(R);
195
196
  O(() => {
196
- Bo.current = L;
197
- }, [L]);
198
- let Vo = () => {
197
+ Ho.current = R;
198
+ }, [R]);
199
+ let Uo = () => {
199
200
  let e = w.getState().activeConversationId;
200
- e && Ii.openConversation(e, { modes: Bo.current });
201
- }, Ho = () => {
201
+ e && Ri.openConversation(e, { modes: Ho.current });
202
+ }, Wo = () => {
202
203
  let e = w.getState().activeConversationId;
203
- e && Ii.loadEarlier(e);
204
- }, Uo = A(La);
204
+ e && Ri.loadEarlier(e);
205
+ }, Go = A(Ra);
205
206
  O(() => {
206
- Uo.current = La;
207
- }, [La]);
208
- let Wo = !!I && Na !== !1;
207
+ Go.current = Ra;
208
+ }, [Ra]);
209
+ let Ko = !!L && Pa !== !1;
209
210
  O(() => {
210
- if (Wo) return pn({ send: (e) => fn(e, {
211
+ if (Ko) return pn({ send: (e) => fn(e, {
211
212
  workspaceId: T(),
212
213
  authContext: {
213
- accessToken: Uo.current(),
214
+ accessToken: Go.current(),
214
215
  organizationId: Vt()
215
216
  }
216
217
  }) });
217
- }, [Wo]), O(() => {
218
- zo.update({
219
- loading: Ro,
220
- canUseAdminModes: Lo
218
+ }, [Ko]), O(() => {
219
+ Vo.update({
220
+ loading: Bo,
221
+ canUseAdminModes: zo
221
222
  });
222
223
  }, [
223
- zo,
224
- Ro,
225
- Lo
224
+ Vo,
225
+ Bo,
226
+ zo
226
227
  ]), O(() => () => {
227
- zo.abandon();
228
- }, [zo]);
229
- let Go = k(() => L.filter((e) => !e.requiresAdmin || Lo), [L, Lo]), Ko = fe(Go), qo = mo && Ko, Jo = A(Ko);
228
+ Vo.abandon();
229
+ }, [Vo]);
230
+ let qo = k(() => R.filter((e) => !e.requiresAdmin || zo), [R, zo]), Jo = fe(qo), Yo = ho && Jo, Xo = A(Jo);
230
231
  O(() => {
231
- Jo.current = Ko;
232
- }, [Ko]);
233
- let Yo = A(null), Xo = A(!1), [Zo, Qo] = j(!1), $o = gn(L), [es, ts] = j(null), [ns, rs] = j(() => yr.openFor());
232
+ Xo.current = Jo;
233
+ }, [Jo]);
234
+ let Zo = A(null), Qo = A(!1), [$o, es] = j(!1), ts = gn(R), [ns, rs] = j(null), [is, as] = j(() => xr.openFor());
234
235
  O(() => {
235
- yr.setOpenFor(ns);
236
- }, [ns]);
237
- let is = ns !== null && ns === V, q = He(), as = Ue(), J = q.open && as !== null, os = q.close, ss = A(J);
238
- ta(() => {
239
- ss.current = J;
236
+ xr.setOpenFor(is);
237
+ }, [is]);
238
+ let os = is !== null && is === H, q = He(), ss = Ue(), J = q.open && ss !== null, cs = q.close, ls = A(J);
239
+ ra(() => {
240
+ ls.current = J;
240
241
  }, [J]);
241
- let cs = D((e) => {
242
- e && ss.current || rs(e ? w.getState().activeConversationId : null);
243
- }, []);
242
+ let us = D((e) => {
243
+ e && ls.current || e && I || as(e ? w.getState().activeConversationId : null);
244
+ }, [I]);
244
245
  O(() => {
245
- rs((e) => e !== null && e !== V ? null : e);
246
- }, [V]);
247
- let ls = A(void 0), [us, ds] = j(!1), [fs, ps] = j(!1), ms = D((e) => {
248
- ls.current = e, ds(dr(e));
249
- }, []), hs = A(null), gs = A(!1), _s = D(() => {
246
+ as((e) => e !== null && e !== H ? null : e);
247
+ }, [H]);
248
+ let ds = A(void 0), [fs, ps] = j(!1), [ms, hs] = j(!1), gs = D((e) => {
249
+ ds.current = e, ps(pr(e));
250
+ }, []), _s = A(null), vs = A(!1), ys = D(() => {
250
251
  let e = w.getState(), t = e.activeConversationId, n = t ? e.conversations.find((e) => e.id === t) : void 0;
251
252
  return !t || !n ? null : {
252
253
  id: t,
253
- reusableDraft: Bi(n, Wi()),
254
+ reusableDraft: Hi(n, Ki()),
254
255
  liveProposals: K.liveFor(t).count,
255
256
  turnInFlight: On(e.processingByConversationId[t]?.status)
256
257
  };
257
- }, [K]), vs = A({}), ys = A(on(kr())), bs = A(new Jt()), xs = A(/* @__PURE__ */ new Set()), Ss = k(() => L.find((e) => e.id === H), [L, H]), Cs = w((e) => {
258
- let t = e.sandboxesByMode[H]?.sandboxId;
258
+ }, [K]), bs = A({}), xs = A(on(jr())), Ss = A(new Jt()), Cs = A(/* @__PURE__ */ new Set()), ws = k(() => R.find((e) => e.id === U), [R, U]), Ts = w((e) => {
259
+ let t = e.sandboxesByMode[U]?.sandboxId;
259
260
  return t ? e.sandboxWriteCapabilities[t] : void 0;
260
- }), ws = Ss !== void 0 && g({
261
- mode: H,
262
- productWriteApproval: R,
263
- capabilities: Cs
264
- }), Ts = H === "assistant" || Ss !== void 0 && !Ss.writeCapable && !gt(H) || ws;
261
+ }), Es = ws !== void 0 && g({
262
+ mode: U,
263
+ productWriteApproval: z,
264
+ capabilities: Ts
265
+ }), Ds = U === "assistant" || ws !== void 0 && !ws.writeCapable && !gt(U) || Es;
265
266
  O(() => {
266
- let e = L.find((e) => e.id === "assistant" || !e.requiresAdmin || Lo)?.id ?? L[0]?.id ?? "assistant";
267
- H !== "assistant" && Ss?.writeCapable && !Jn(fo, H) ? Qa(e) : Ro || (!Ss || Ss.requiresAdmin && !Lo) && H !== e && Qa(e);
267
+ let e = R.find((e) => e.id === "assistant" || !e.requiresAdmin || zo)?.id ?? R[0]?.id ?? "assistant";
268
+ U !== "assistant" && ws?.writeCapable && !Jn(po, U) ? $a(e) : Bo || (!ws || ws.requiresAdmin && !zo) && U !== e && $a(e);
268
269
  }, [
269
- H,
270
- Ss,
271
- Lo,
272
- Ro,
273
- Qa,
274
- fo,
275
- L
270
+ U,
271
+ ws,
272
+ zo,
273
+ Bo,
274
+ $a,
275
+ po,
276
+ R
276
277
  ]);
277
- let Es = D((e, t, n, r) => {
278
- ao(e, n, t, null, r);
279
- }, [ao]), Ds = D(async (e, t, n, r, i, a = null) => {
278
+ let Os = D((e, t, n, r) => {
279
+ oo(e, n, t, null, r);
280
+ }, [oo]), ks = D(async (e, t, n, r, i, a = null) => {
280
281
  let o = (e, t) => {
281
- r && Es(r.conversationId, r.assistantMessageId, e, t), a && (a.step = t, a.onStep?.(t));
282
+ r && Os(r.conversationId, r.assistantMessageId, e, t), a && (a.step = t, a.onStep?.(t));
282
283
  }, s = (e) => {
283
284
  r && E(r.assistantMessageId, e);
284
285
  }, c = () => {
@@ -286,7 +287,7 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
286
287
  }, l = () => a !== null && (a.signal.aborted || T() !== t), u = () => {
287
288
  if (l()) throw new Yt("cancelled");
288
289
  }, d = w.getState().sandboxesByMode[e]?.sandboxId ?? null, f = !1, p = !1, ee = !1, m = !1, h = !1, g = async (r) => {
289
- if (i && !bs.current.has(r) && ys.current.isFresh(r)) return f = !0, !0;
290
+ if (i && !Ss.current.has(r) && xs.current.isFresh(r)) return f = !0, !0;
290
291
  ee = !0;
291
292
  let o = !1;
292
293
  try {
@@ -295,42 +296,42 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
295
296
  });
296
297
  } catch {
297
298
  if (l()) throw new Yt("cancelled");
298
- return ys.current.invalidate(r), bs.current.add(r), a?.dead.push(r), h = !0, !1;
299
+ return xs.current.invalidate(r), Ss.current.add(r), a?.dead.push(r), h = !0, !1;
299
300
  }
300
- return u(), ys.current.markVerified(r), o && (m = !0), !0;
301
+ return u(), xs.current.markVerified(r), o && (m = !0), !0;
301
302
  };
302
- if (d && (lo(e, d, "provisioning"), o("provisioning", "reusingEnvironment"), await g(d) || (lo(e, null, "provisioning"), d = null)), !d) {
303
+ if (d && (uo(e, d, "provisioning"), o("provisioning", "reusingEnvironment"), await g(d) || (uo(e, null, "provisioning"), d = null)), !d) {
303
304
  o("provisioning", "lookingForEnvironment");
304
- let r = await dt(t, I, e, Mn(), n, bs.current, R);
305
+ let r = await dt(t, L, e, Mn(), n, Ss.current, z);
305
306
  u();
306
307
  let i = r?.id ?? null;
307
308
  if (i) {
308
- lo(e, i, "provisioning"), o("provisioning", "reusingEnvironment");
309
+ uo(e, i, "provisioning"), o("provisioning", "reusingEnvironment");
309
310
  let t = r?.status === "PROVISIONING" || r?.status === "PENDING";
310
- t && c(), await g(i) ? (d = i, t && (m = !0)) : lo(e, null, "provisioning");
311
+ t && c(), await g(i) ? (d = i, t && (m = !0)) : uo(e, null, "provisioning");
311
312
  }
312
313
  }
313
314
  if (!d) {
314
315
  if (a && !a.mayCreate) throw new Yt("no-create");
315
- if (s("provisionStarted"), e === "api-calls" && !La()) throw Error("API Calls mode requires an authenticated session. Please sign in again.");
316
- o("provisioning", "startingEnvironment"), lo(e, null, "provisioning");
317
- let r = a ? [] : await yt(t, I, e, Mn(), n, bs.current, R);
316
+ if (s("provisionStarted"), e === "api-calls" && !Ra()) throw Error("API Calls mode requires an authenticated session. Please sign in again.");
317
+ o("provisioning", "startingEnvironment"), uo(e, null, "provisioning");
318
+ let r = a ? [] : await yt(t, L, e, Mn(), n, Ss.current, z);
318
319
  if (r.length > 0) {
319
320
  let e = new Set(r);
320
- for (let e of r) ys.current.invalidate(e), bs.current.add(e);
321
+ for (let e of r) xs.current.invalidate(e), Ss.current.add(e);
321
322
  let t = w.getState().sandboxesByMode;
322
- for (let [n, r] of Object.entries(t)) y(n) && r?.sandboxId && e.has(r.sandboxId) && uo(n);
323
+ for (let [n, r] of Object.entries(t)) y(n) && r?.sandboxId && e.has(r.sandboxId) && fo(n);
323
324
  }
324
325
  s("createRequested");
325
326
  let i = a?.beginCreate();
326
327
  try {
327
- d = await lt(I, e, t, Mn(), oa, n, { writeApproval: R });
328
+ d = await lt(L, e, t, Mn(), ca, n, { writeApproval: z });
328
329
  } finally {
329
330
  i?.();
330
331
  }
331
- p = !0, u(), lo(e, d, "provisioning"), await St(d, t, n, 3e5), u(), s("sandboxRunning"), await xt(d, t, e, n, 9e4), u(), s("serviceReady"), ys.current.markVerified(d);
332
+ p = !0, u(), uo(e, d, "provisioning"), await St(d, t, n, 3e5), u(), s("sandboxRunning"), await xt(d, t, e, n, 9e4), u(), s("serviceReady"), xs.current.markVerified(d);
332
333
  }
333
- return lo(e, d, "running"), {
334
+ return uo(e, d, "running"), {
334
335
  sandboxId: d,
335
336
  sandboxIsNew: p,
336
337
  sandboxProbed: ee,
@@ -339,17 +340,17 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
339
340
  trustedFromCache: f
340
341
  };
341
342
  }, [
343
+ fo,
344
+ Ra,
345
+ L,
346
+ z,
342
347
  uo,
343
- La,
344
- I,
345
- R,
346
- lo,
347
- Es
348
- ]), Os = D(async function e(t, n, r, i, a, o = {}) {
349
- let s = await tn(i, r, (e) => Es(t, n, "provisioning", e), () => E(n, "prewarmJoined"));
350
- for (let e of s.dead) ys.current.invalidate(e), bs.current.add(e);
351
- s.verified && !bs.current.has(s.verified) && ys.current.markVerified(s.verified), s.joined && cn(n, { prewarm: s.joined });
352
- let { sandboxId: c, sandboxIsNew: l, sandboxProbed: u, sandboxAdopted: d, deadSandboxProbe: f, trustedFromCache: p } = await Ds(r, i, a, {
348
+ Os
349
+ ]), As = D(async function e(t, n, r, i, a, o = {}) {
350
+ let s = await tn(i, r, (e) => Os(t, n, "provisioning", e), () => E(n, "prewarmJoined"));
351
+ for (let e of s.dead) xs.current.invalidate(e), Ss.current.add(e);
352
+ s.verified && !Ss.current.has(s.verified) && xs.current.markVerified(s.verified), s.joined && cn(n, { prewarm: s.joined });
353
+ let { sandboxId: c, sandboxIsNew: l, sandboxProbed: u, sandboxAdopted: d, deadSandboxProbe: f, trustedFromCache: p } = await ks(r, i, a, {
353
354
  conversationId: t,
354
355
  assistantMessageId: n
355
356
  }, o.trustCache !== !1), ee = Zt(i, r, c);
@@ -362,7 +363,7 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
362
363
  if (t.mode !== r) throw Error(`Session mode mismatch: expected ${r}, received ${t.mode}`);
363
364
  g = e;
364
365
  } catch {
365
- co(t), m = null;
366
+ lo(t), m = null;
366
367
  }
367
368
  }
368
369
  let te = !1;
@@ -371,27 +372,27 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
371
372
  workspaceId: i,
372
373
  mode: r,
373
374
  sandboxId: c,
374
- userId: z
375
+ userId: B
375
376
  }), Date.now());
376
377
  if (e) {
377
- "pending" in e && Es(t, n, "connecting", "preparingSession");
378
+ "pending" in e && Os(t, n, "connecting", "preparingSession");
378
379
  let o = "sessionId" in e ? e.sessionId : await e.pending;
379
- if (o && !bs.current.has(c)) try {
380
- (await mt(c, i, o, r, a)).mode === r && (m = o, te = !0, so(t, m), h = !0);
380
+ if (o && !Ss.current.has(c)) try {
381
+ (await mt(c, i, o, r, a)).mode === r && (m = o, te = !0, co(t, m), h = !0);
381
382
  } catch {}
382
383
  }
383
384
  }
384
385
  if (!m) {
385
- Es(t, n, "connecting", "preparingSession");
386
+ Os(t, n, "connecting", "preparingSession");
386
387
  let s;
387
388
  try {
388
389
  s = await ut(c, i, r, a);
389
390
  } catch (s) {
390
391
  if (p) {
391
- ys.current.invalidate(c);
392
- let l = jr(s, o.isAbandoned?.() ?? !1), p = l === "check-network";
393
- if (l === "check-network" && (l = await Ar(() => dt(i, I, r, Mn(), a, bs.current, R))), l !== "rethrow" && o.isAbandoned?.() && (l = "rethrow"), l !== "rethrow") {
394
- p || cn(n, { cacheProofFailed: !0 }), l === "replace" && (bs.current.add(c), co(t), uo(r), K.retireSandbox(c));
392
+ xs.current.invalidate(c);
393
+ let l = Nr(s, o.isAbandoned?.() ?? !1), p = l === "check-network";
394
+ if (l === "check-network" && (l = await Mr(() => dt(i, L, r, Mn(), a, Ss.current, z))), l !== "rethrow" && o.isAbandoned?.() && (l = "rethrow"), l !== "rethrow") {
395
+ p || cn(n, { cacheProofFailed: !0 }), l === "replace" && (Ss.current.add(c), lo(t), fo(r), K.retireSandbox(c));
395
396
  let s = await e(t, n, r, i, a, {
396
397
  ...o,
397
398
  trustCache: !1
@@ -406,7 +407,7 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
406
407
  }
407
408
  throw s;
408
409
  }
409
- m = s.sessionId, so(t, m), h = !0;
410
+ m = s.sessionId, co(t, m), h = !0;
410
411
  }
411
412
  return {
412
413
  sandboxId: c,
@@ -421,67 +422,67 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
421
422
  knownFloor: _
422
423
  };
423
424
  }, [
424
- Ds,
425
- co,
426
- uo,
427
- I,
428
- R,
429
- so,
430
- Es,
425
+ ks,
426
+ lo,
427
+ fo,
428
+ L,
431
429
  z,
430
+ co,
431
+ Os,
432
+ B,
432
433
  K
433
- ]), ks = D((e, t = !1) => {
434
+ ]), js = D((e, t = !1) => {
434
435
  let n = T();
435
436
  if (!n) return;
436
437
  let r = w.getState(), i = Date.now(), a = en({
437
438
  autoRouting: r.autoRouting,
438
- autoOffered: Jo.current,
439
+ autoOffered: Xo.current,
439
440
  active: !t && r.activeConversationId ? r.conversations.find((e) => e.id === r.activeConversationId) : void 0,
440
441
  selectedMode: r.mode,
441
442
  autoReadMode: b,
442
- modes: Bo.current,
443
+ modes: Ho.current,
443
444
  acknowledgedWriteModes: r.acknowledgedWriteModes,
444
- adminAccess: zo.read(),
445
+ adminAccess: Vo.read(),
445
446
  dictated: e,
446
- voiceProposalBound: (e) => Ia(e),
447
+ voiceProposalBound: (e) => La(e),
447
448
  turnInFlight: Object.values(r.processingByConversationId).some((e) => On(e?.status)),
448
449
  ...an(n),
449
450
  now: i
450
451
  });
451
452
  if (!a) return;
452
453
  let o = rn(n, a, i), s = {
453
- accessToken: La(),
454
- workspaceToken: Ra(),
455
- userId: z,
454
+ accessToken: Ra(),
455
+ workspaceToken: za(),
456
+ userId: B,
456
457
  organizationId: Vt()
457
458
  };
458
- Ds(a.mode, n, s, null, !0, o).then((e) => {
459
+ ks(a.mode, n, s, null, !0, o).then((e) => {
459
460
  if (o.finish({
460
461
  ok: !0,
461
462
  sandboxId: e.sandboxId,
462
463
  didWork: !e.trustedFromCache && (e.sandboxIsNew || e.sandboxProbed || e.sandboxAdopted),
463
464
  booted: e.sandboxIsNew || e.sandboxAdopted,
464
465
  dead: o.dead
465
- }), o.signal.aborted || T() !== n || bs.current.has(e.sandboxId)) return;
466
- let r = w.getState(), i = !t && r.activeConversationId ? r.conversations.find((e) => e.id === r.activeConversationId) : void 0, c = Wi();
466
+ }), o.signal.aborted || T() !== n || Ss.current.has(e.sandboxId)) return;
467
+ let r = w.getState(), i = !t && r.activeConversationId ? r.conversations.find((e) => e.id === r.activeConversationId) : void 0, c = Ki();
467
468
  $t({
468
469
  active: i ? {
469
470
  mode: i.mode,
470
471
  backendSessionId: i.backendSessionId,
471
- continuable: !zi(i) && !Ri(i, c),
472
- hasHistory: Li(i)
472
+ continuable: !Vi(i) && !Bi(i, c),
473
+ hasHistory: zi(i)
473
474
  } : void 0,
474
475
  mode: a.mode
475
476
  }) && nn(Qt({
476
477
  workspaceId: n,
477
478
  mode: a.mode,
478
479
  sandboxId: e.sandboxId,
479
- userId: z
480
+ userId: B
480
481
  }), () => ut(e.sandboxId, n, a.mode, s).then((e) => e.sessionId), Date.now());
481
482
  }, (e) => {
482
483
  if (!(e instanceof Yt) && !o.signal.aborted && T() === n) {
483
484
  let e = w.getState().sandboxesByMode[a.mode]?.sandboxId ?? null;
484
- e && (ys.current.invalidate(e), bs.current.add(e), o.dead.push(e), uo(a.mode));
485
+ e && (xs.current.invalidate(e), Ss.current.add(e), o.dead.push(e), fo(a.mode));
485
486
  }
486
487
  o.finish({
487
488
  ok: !1,
@@ -491,68 +492,68 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
491
492
  });
492
493
  });
493
494
  }, [
494
- Ds,
495
- zo,
496
- uo,
497
- La,
495
+ ks,
496
+ Vo,
497
+ fo,
498
498
  Ra,
499
- z,
500
- Ia
501
- ]), As = A(!1), js = A(null), Ms = k(() => a(), []);
502
- O(() => () => Ms.cancel(), [Ms]);
503
- let Ns = na(Or, Cr, Cr)?.reference ?? null, [Ps, Fs] = j(0), Is = A(/* @__PURE__ */ new Set()), Ls = A(null), Rs = D(() => {
499
+ za,
500
+ B,
501
+ La
502
+ ]), Ms = A(!1), Ns = A(null), Ps = k(() => a(), []);
503
+ O(() => () => Ps.cancel(), [Ps]);
504
+ let Fs = ia(Ar, Tr, Tr)?.reference ?? null, [Is, Ls] = j(0), Rs = A(/* @__PURE__ */ new Set()), zs = A(null), Bs = D(() => {
504
505
  let e = w.getState(), t = e.activeConversationId;
505
506
  if (!t) return null;
506
507
  let n = e.processingByConversationId[t], r = On(n?.status) ? n?.messageId ?? null : null;
507
508
  if (!An({
508
509
  interruptedTurnId: r,
509
510
  activeTurnId: r,
510
- alreadyRequested: r ? Is.current.has(r) : !1
511
+ alreadyRequested: r ? Rs.current.has(r) : !1
511
512
  }).send || !r) return null;
512
- Is.current.add(r);
513
+ Rs.current.add(r);
513
514
  let i = ot(e), a = T(), o = e.conversations.find((e) => e.id === t)?.backendSessionId;
514
515
  return i && a && o && st(i.sandboxId, a, o, i.mode, {
515
- accessToken: La(),
516
- workspaceToken: Ra(),
517
- userId: z,
516
+ accessToken: Ra(),
517
+ workspaceToken: za(),
518
+ userId: B,
518
519
  organizationId: Vt()
519
520
  }), r;
520
521
  }, [
521
- z,
522
- La,
523
- Ra
524
- ]), zs = D(() => {
525
- let e = Rs();
522
+ B,
523
+ Ra,
524
+ za
525
+ ]), Vs = D(() => {
526
+ let e = Bs();
526
527
  return e && (Mt(e), kt.abort(e)), e;
527
- }, [Rs]), Bs = D(() => {
528
+ }, [Bs]), Hs = D(() => {
528
529
  let e = w.getState().activeConversationId;
529
- zs(), e && K.declineForReply(e, "corrected", "spoken");
530
- }, [zs, K]), Vs = D(async (e) => {
530
+ Vs(), e && K.declineForReply(e, "corrected", "spoken");
531
+ }, [Vs, K]), Us = D(async (e) => {
531
532
  let t = w.getState(), n = ot(t), r = T(), i = t.activeConversationId;
532
533
  if (!n || !r || !i || oe(t.sandboxWriteCapabilities[n.sandboxId])) return;
533
- let a = t.conversations.find((e) => e.id === i), o = a ? Er(sr(a.messages), {
534
+ let a = t.conversations.find((e) => e.id === i), o = a ? Or(sr(a.messages), {
534
535
  sessionId: a.backendSessionId,
535
536
  sandboxId: n.sandboxId,
536
537
  nowMs: Date.now()
537
538
  }) : null;
538
539
  if (o?.reference !== e) {
539
- Fs((e) => e + 1);
540
+ Ls((e) => e + 1);
540
541
  return;
541
542
  }
542
543
  let s = {
543
544
  conversationId: i,
544
545
  reference: e
545
546
  };
546
- if (!xr(s)) return;
547
+ if (!Cr(s)) return;
547
548
  try {
548
549
  await ct(n.sandboxId, r, e, n.mode, {
549
- accessToken: La(),
550
- workspaceToken: Ra(),
551
- userId: z,
550
+ accessToken: Ra(),
551
+ workspaceToken: za(),
552
+ userId: B,
552
553
  organizationId: Vt()
553
554
  });
554
555
  } catch (e) {
555
- Sr(s), U(i, {
556
+ wr(s), W(i, {
556
557
  id: N(),
557
558
  role: "system",
558
559
  content: e instanceof Error ? e.message : "The change could not be approved.",
@@ -560,69 +561,69 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
560
561
  });
561
562
  return;
562
563
  }
563
- Sr(s), io(i, o.messageId, { pendingWriteApprovedAt: (/* @__PURE__ */ new Date()).toISOString() });
564
+ wr(s), ao(i, o.messageId, { pendingWriteApprovedAt: (/* @__PURE__ */ new Date()).toISOString() });
564
565
  let c = w.getState(), l = c.conversations.find((e) => e.id === i);
565
- c.activeConversationId === i && l && c.mode === n.mode && l.backendSessionId === a?.backendSessionId && ot(c)?.sandboxId === n.sandboxId && !On(c.processingByConversationId[i]?.status) && Tr(sr(l.messages)) === o.messageId && Kc.current(P("pendingWrite.approvedPrompt", "I approved that change — go ahead."), [], {
566
+ c.activeConversationId === i && l && c.mode === n.mode && l.backendSessionId === a?.backendSessionId && ot(c)?.sandboxId === n.sandboxId && !On(c.processingByConversationId[i]?.status) && Dr(sr(l.messages)) === o.messageId && Jc.current(P("pendingWrite.approvedPrompt", "I approved that change — go ahead."), [], {
566
567
  approvalFollowUp: { approvedReplyId: o.messageId },
567
568
  targetConversationId: i
568
569
  });
569
570
  }, [
570
- z,
571
- U,
572
- io,
571
+ B,
572
+ W,
573
+ ao,
573
574
  P
574
- ]), Hs = Xi(), { speakFinishedReply: Us, speakingMessageId: Ws, stop: Gs } = Ji(), Ks = A(null), qs = D((e, t) => {
575
- let n = Ks.current;
575
+ ]), Ws = Qi(), { speakFinishedReply: Gs, speakingMessageId: Ks, stop: qs } = Xi(), Js = A(null), Ys = D((e, t) => {
576
+ let n = Js.current;
576
577
  n?.token === e && n.exchange === null && (n.exchange = t);
577
- }, []), Js = D((e) => {
578
- let t = Ks.current;
578
+ }, []), Xs = D((e) => {
579
+ let t = Js.current;
579
580
  e !== void 0 && t?.token === e && (t.handled = !0);
580
- }, []), Ys = D((e, t) => {
581
- qs(e, t), ss.current && At(t);
582
- }, [qs]), Xs = qi(), { items: Zs, permissionsSettled: Qs, simulating: $s } = Zi(), Y = A({
583
- theme: Hs,
584
- navigate: Xs,
585
- navItems: Zs,
586
- options: Fa ?? {},
587
- navPermissionsSettled: Qs,
588
- navSimulating: $s
581
+ }, []), Zs = D((e, t) => {
582
+ Ys(e, t), ls.current && At(t);
583
+ }, [Ys]), Qs = Yi(), { items: $s, permissionsSettled: ec, simulating: tc } = $i(), Y = A({
584
+ theme: Ws,
585
+ navigate: Qs,
586
+ navItems: $s,
587
+ options: Ia ?? {},
588
+ navPermissionsSettled: ec,
589
+ navSimulating: tc
589
590
  });
590
591
  O(() => {
591
592
  Y.current = {
592
- theme: Hs,
593
- navigate: Xs,
594
- navItems: Zs,
595
- options: Fa ?? {},
596
- navPermissionsSettled: Qs,
597
- navSimulating: $s
593
+ theme: Ws,
594
+ navigate: Qs,
595
+ navItems: $s,
596
+ options: Ia ?? {},
597
+ navPermissionsSettled: ec,
598
+ navSimulating: tc
598
599
  };
599
600
  }, [
600
- Hs,
601
- Xs,
602
- Zs,
603
- Fa,
601
+ Ws,
604
602
  Qs,
605
- $s
603
+ $s,
604
+ Ia,
605
+ ec,
606
+ tc
606
607
  ]);
607
608
  let X = A(!0);
608
609
  O(() => (X.current = !0, () => {
609
610
  X.current = !1;
610
611
  }), []);
611
- let ec = A({
612
+ let nc = A({
612
613
  tr: P,
613
- locale: B
614
- }), tc = A(null), [nc, rc] = j(null), ic = A(null), ac = D((e) => {
615
- ic.current !== null && (window.clearTimeout(ic.current), ic.current = null);
616
- let t = tc.current;
617
- t && (tc.current = null, window.clearTimeout(t.deadline), X.current && rc(null), e && X.current && (ic.current = window.setTimeout(() => {
618
- if (ic.current = null, !X.current) return;
614
+ locale: V
615
+ }), rc = A(null), [ic, ac] = j(null), oc = A(null), sc = D((e) => {
616
+ oc.current !== null && (window.clearTimeout(oc.current), oc.current = null);
617
+ let t = rc.current;
618
+ t && (rc.current = null, window.clearTimeout(t.deadline), X.current && ac(null), e && X.current && (oc.current = window.setTimeout(() => {
619
+ if (oc.current = null, !X.current) return;
619
620
  let e = w.getState();
620
621
  if (e.activeConversationId !== t.conversationId) return;
621
622
  let n = e.conversations.find((e) => e.id === t.conversationId)?.messages.find((e) => e.id === t.messageId);
622
623
  if (!n) return;
623
- let r = ec.current, i = Qn(n, null, r.tr);
624
+ let r = nc.current, i = Qn(n, null, r.tr);
624
625
  if (i.kind !== "output") return;
625
- let a = ti(n, r.tr);
626
+ let a = ri(n, r.tr);
626
627
  kt.publish(n.id, {
627
628
  conversationId: t.conversationId,
628
629
  channel: n.metadata?.voice === !0 ? "voice" : "chat",
@@ -632,44 +633,44 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
632
633
  final: !0
633
634
  });
634
635
  }, 0)));
635
- }, []), oc = D(() => ac(!0), [ac]);
636
+ }, []), cc = D(() => sc(!0), [sc]);
636
637
  O(() => {
637
- ec.current = {
638
+ nc.current = {
638
639
  tr: P,
639
- locale: B
640
+ locale: V
640
641
  };
641
- let e = tc.current;
642
+ let e = rc.current;
642
643
  if (!e) return;
643
- let t = ni({
644
+ let t = ii({
644
645
  wanted: e.wanted,
645
- locale: B,
646
- isLoading: za(e.wanted),
647
- translatedNow: $r(P, e.reply).translated
646
+ locale: V,
647
+ isLoading: Ba(e.wanted),
648
+ translatedNow: ti(P, e.reply).translated
648
649
  });
649
- if (t === "write") oc();
650
+ if (t === "write") cc();
650
651
  else if (t === "grace") {
651
- let e = window.setTimeout(oc, 400);
652
+ let e = window.setTimeout(cc, 400);
652
653
  return () => window.clearTimeout(e);
653
654
  }
654
655
  }, [
655
656
  P,
656
- B,
657
- za,
658
- nc,
659
- oc
660
- ]), O(() => () => ac(!1), [ac]);
661
- let sc = A(null), [cc, lc] = j(!1), [uc, dc] = j(null), [Z] = j(() => new bi()), [fc, pc] = j(0), mc = D(() => pc((e) => e + 1), []), hc = D(() => {
657
+ V,
658
+ Ba,
659
+ ic,
660
+ cc
661
+ ]), O(() => () => sc(!1), [sc]);
662
+ let lc = A(null), [uc, dc] = j(!1), [fc, pc] = j(null), [Z] = j(() => new Si()), [mc, hc] = j(0), gc = D(() => hc((e) => e + 1), []), _c = D(() => {
662
663
  let e = Y.current;
663
664
  return {
664
- destinations: Ir(e.navItems),
665
+ destinations: Rr(e.navItems),
665
666
  permissionsSettled: e.navPermissionsSettled,
666
667
  simulating: e.navSimulating
667
668
  };
668
- }, []), gc = A(z);
669
+ }, []), vc = A(B);
669
670
  O(() => {
670
- gc.current = z;
671
- }, [z]);
672
- let _c = D((e, t) => {
671
+ vc.current = B;
672
+ }, [B]);
673
+ let yc = D((e, t) => {
673
674
  let n = Z.replyIdOf(e), r = n ? Z.turnFor(n) : void 0, i = Z.offer(e), a = {
674
675
  ok: !1,
675
676
  reason: "gone",
@@ -681,22 +682,22 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
681
682
  let o = r.conversationId, s = w.getState().conversations.find((e) => e.id === o);
682
683
  if (!s) return a;
683
684
  let c = s.messages.find((e) => e.id === n), l = c?.metadata?.voice === !0 ? c.metadata.voiceSessionId : void 0, u = Z.liveOffersFor(n, {
684
- registry: hc(),
685
- actorId: gc.current,
685
+ registry: _c(),
686
+ actorId: vc.current,
686
687
  conversationId: o,
687
688
  perfNow: performance.now()
688
689
  }).find((t) => t.offer.offerId === e);
689
690
  if (!u) {
690
- let e = Ci(i, performance.now());
691
+ let e = Ti(i, performance.now());
691
692
  return {
692
693
  ok: !1,
693
694
  reason: e ? "unavailable" : "expired",
694
- copy: e ? qr(P, t || null) : Gr(P),
695
+ copy: e ? Yr(P, t || null) : qr(P),
695
696
  conversationId: o,
696
697
  voiceSessionId: l
697
698
  };
698
699
  }
699
- return Z.markUsed(e) ? (mc(), {
700
+ return Z.markUsed(e) ? (gc(), {
700
701
  ok: !0,
701
702
  target: u.target,
702
703
  conversationId: o,
@@ -704,33 +705,33 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
704
705
  }) : a;
705
706
  }, [
706
707
  Z,
707
- hc,
708
+ _c,
708
709
  P,
709
- mc
710
- ]), vc = D((e, t, n, r, i) => {
710
+ gc
711
+ ]), bc = D((e, t, n, r, i) => {
711
712
  let a = N();
712
- U(e, {
713
+ W(e, {
713
714
  id: a,
714
715
  role: "system",
715
716
  content: n.text,
716
717
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
717
718
  metadata: {
718
- lang: n.translated ? B : "en",
719
+ lang: n.translated ? V : "en",
719
720
  ...i ? { localAction: i } : {},
720
721
  ...lr(t)
721
722
  }
722
- }), i && Ii.recordCommittedEntries(e, [a], "NOTE", r);
723
- }, [U, B]), yc = D((e, t) => (t.status === "kept" || t.status === "refused" && t.reason === "unsaved-changes") && Z.release(e), [Z]), bc = A(null);
723
+ }), i && Ri.recordCommittedEntries(e, [a], "NOTE", r);
724
+ }, [W, V]), xc = D((e, t) => (t.status === "kept" || t.status === "refused" && t.reason === "unsaved-changes") && Z.release(e), [Z]), Sc = A(null);
724
725
  O(() => () => {
725
- bc.current?.(), bc.current = null;
726
+ Sc.current?.(), Sc.current = null;
726
727
  }, []);
727
- let xc = D((e) => {
728
- bc.current?.(), bc.current = X.current ? li(document, e) : null;
729
- }, []), Sc = D((e, t, n, r = !1) => {
730
- if (sc.current !== null) return;
731
- let i = _c(e, n), a = T(), o = (e, t, n, r) => vc(e, t, n, a, r);
728
+ let Cc = D((e) => {
729
+ Sc.current?.(), Sc.current = X.current ? di(document, e) : null;
730
+ }, []), wc = D((e, t, n, r = !1) => {
731
+ if (lc.current !== null) return;
732
+ let i = yc(e, n), a = T(), o = (e, t, n, r) => bc(e, t, n, a, r);
732
733
  if (!i.ok) {
733
- i.copy && i.conversationId && o(i.conversationId, i.voiceSessionId, i.copy), mc();
734
+ i.copy && i.conversationId && o(i.conversationId, i.voiceSessionId, i.copy), gc();
734
735
  return;
735
736
  }
736
737
  let { target: s, conversationId: c, voiceSessionId: l } = i, u = {
@@ -738,7 +739,7 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
738
739
  offerId: e
739
740
  };
740
741
  if (r) {
741
- o(c, l, Ur(P, s.label, !0), ji({
742
+ o(c, l, Gr(P, s.label, !0), Ni({
742
743
  destinationId: s.id,
743
744
  path: s.path,
744
745
  alreadyHere: !0,
@@ -748,16 +749,16 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
748
749
  return;
749
750
  }
750
751
  let d = N();
751
- sc.current = d, lc(!0);
752
+ lc.current = d, dc(!0);
752
753
  let f = (t) => {
753
754
  try {
754
- if (yc(e, t) && (mc(), t.status === "kept" && xc(e)), t.status === "kept" || !w.getState().conversations.some((e) => e.id === c)) return;
755
+ if (xc(e, t) && (gc(), t.status === "kept" && Cc(e)), t.status === "kept" || !w.getState().conversations.some((e) => e.id === c)) return;
755
756
  let n = t.status === "arrived" || t.status === "redirected" ? t.landedPath : null;
756
- o(c, l, Wr(P, t, {
757
+ o(c, l, Kr(P, t, {
757
758
  page: s.label,
758
- landed: n === null ? null : Ni(Ir(Y.current.navItems), n),
759
+ landed: n === null ? null : Fi(Rr(Y.current.navItems), n),
759
760
  path: s.path
760
- }), ji({
761
+ }), Ni({
761
762
  destinationId: s.id,
762
763
  path: s.path,
763
764
  alreadyHere: !1,
@@ -766,10 +767,10 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
766
767
  offer: u
767
768
  }));
768
769
  } finally {
769
- sc.current === d && (sc.current = null, X.current && lc(!1));
770
+ lc.current === d && (lc.current = null, X.current && dc(!1));
770
771
  }
771
772
  };
772
- Fi(Y.current.navigate, s.path, {
773
+ Li(Y.current.navigate, s.path, {
773
774
  readPath: () => window.location.pathname + window.location.search,
774
775
  now: () => Date.now(),
775
776
  schedule: (e, t) => {
@@ -780,20 +781,20 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
780
781
  surface: "offer"
781
782
  }).then(f, () => f({ status: "unconfirmed" }));
782
783
  }, [
783
- _c,
784
- vc,
785
- P,
786
- mc,
787
784
  yc,
788
- xc
789
- ]), Cc = D((e, t) => Sc(e, "tap", t || null), [Sc]), wc = D((e) => {
785
+ bc,
786
+ P,
787
+ gc,
788
+ xc,
789
+ Cc
790
+ ]), Tc = D((e, t) => wc(e, "tap", t || null), [wc]), Ec = D((e) => {
790
791
  let { replyId: t, conversationId: n } = e, r = Z.turnFor(t);
791
792
  if (!r) return;
792
- let i = window.location.pathname + window.location.search, a = Ir(Y.current.navItems), o = Ti({
793
+ let i = window.location.pathname + window.location.search, a = Rr(Y.current.navItems), o = Di({
793
794
  intent: e.intent,
794
795
  live: Z.liveOffersFor(t, {
795
- registry: hc(),
796
- actorId: gc.current,
796
+ registry: _c(),
797
+ actorId: vc.current,
797
798
  conversationId: n,
798
799
  perfNow: performance.now()
799
800
  }),
@@ -805,50 +806,50 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
805
806
  location: i,
806
807
  conversationId: w.getState().activeConversationId,
807
808
  workspaceId: T(),
808
- actorId: gc.current ?? null
809
+ actorId: vc.current ?? null
809
810
  },
810
811
  mounted: X.current,
811
812
  visible: document.visibilityState === "visible",
812
- unsavedChanges: Ei(Y.current.options),
813
+ unsavedChanges: Oi(Y.current.options),
813
814
  alreadyThere: ({ target: e }) => {
814
815
  let t = a.find((t) => t.id === e.id);
815
- return t ? Nr(t, i, a) : !1;
816
+ return t ? Fr(t, i, a) : !1;
816
817
  }
817
818
  });
818
819
  if (o.act === "navigate" || o.act === "already-here") {
819
- Sc(o.offer.offer.offerId, "resolve", o.offer.target.label, o.act === "already-here");
820
+ wc(o.offer.offer.offerId, "resolve", o.offer.target.label, o.act === "already-here");
820
821
  return;
821
822
  }
822
823
  let [s] = o.unsaved ?? [], [c] = Z.liveOffersFor(t, {
823
- registry: hc(),
824
- actorId: gc.current,
824
+ registry: _c(),
825
+ actorId: vc.current,
825
826
  conversationId: n,
826
827
  perfNow: performance.now()
827
828
  });
828
- o.hold === "R5-unsaved" && s && c && vc(n, e.voiceSessionId, Kr(P, s.label, c.target.label), T());
829
+ o.hold === "R5-unsaved" && s && c && bc(n, e.voiceSessionId, Jr(P, s.label, c.target.label), T());
829
830
  }, [
830
831
  Z,
831
- hc,
832
+ _c,
832
833
  K,
833
- Sc,
834
- vc,
834
+ wc,
835
+ bc,
835
836
  P
836
- ]), Tc = D((e) => {
837
+ ]), Dc = D((e) => {
837
838
  let t = w.getState(), n = t.conversations.find((e) => e.id === t.activeConversationId);
838
- return n ? ki(Oi, window.location.pathname, Pi(n.messages, e)) : !1;
839
- }, []), Ec = be(), Dc = si(), Oc = Ec?.request ?? null, kc = D((e, t, n = !1, r = !1) => {
840
- let { navItems: i, options: a, theme: o, navigate: s } = Y.current, c = Ir(i), l = null, u = {
839
+ return n ? ji(Ai, window.location.pathname, Ii(n.messages, e)) : !1;
840
+ }, []), Oc = be(), kc = li(), Ac = Oc?.request ?? null, jc = D((e, t, n = !1, r = !1) => {
841
+ let { navItems: i, options: a, theme: o, navigate: s } = Y.current, c = Rr(i), l = null, u = {
841
842
  ...a,
842
- locale: t === void 0 ? B : Ka.input.code,
843
- uiLocale: B,
844
- inputLocale: Ka.input.code
843
+ locale: t === void 0 ? V : qa.input.code,
844
+ uiLocale: V,
845
+ inputLocale: qa.input.code
845
846
  };
846
- if (r || Fr(e, u)) {
847
- let e = w.getState(), n = e.conversations.find((t) => t.id === e.activeConversationId), r = n ? di(n.messages, t, { lookThroughRefusedOffers: { ownsOffer: (e, t) => Z.offersFor(e.id).some((e) => e.offerId === t) } }) : null, o = n ? e.processingByConversationId[n.id] ?? null : null, s = o !== null && o.messageId === r?.id && On(o.status);
847
+ if (r || Lr(e, u)) {
848
+ let e = w.getState(), n = e.conversations.find((t) => t.id === e.activeConversationId), r = n ? pi(n.messages, t, { lookThroughRefusedOffers: { ownsOffer: (e, t) => Z.offersFor(e.id).some((e) => e.offerId === t) } }) : null, o = n ? e.processingByConversationId[n.id] ?? null : null, s = o !== null && o.messageId === r?.id && On(o.status);
848
849
  if (n && r && !s) {
849
850
  let e = Z.liveOffersFor(r.id, {
850
- registry: hc(),
851
- actorId: gc.current,
851
+ registry: _c(),
852
+ actorId: vc.current,
852
853
  conversationId: n.id,
853
854
  perfNow: performance.now()
854
855
  }).flatMap(({ offer: e, target: t }) => {
@@ -858,14 +859,14 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
858
859
  target: n
859
860
  }] : [];
860
861
  });
861
- l = ui({
862
+ l = fi({
862
863
  reply: r,
863
864
  text: tr(r, o, P),
864
865
  resolve: {
865
866
  destinations: c,
866
867
  entityRoutes: a.entityRoutes,
867
- visibleNavIds: mi(i),
868
- nounLabel: (e) => Vr(P, e)
868
+ visibleNavIds: gi(i),
869
+ nounLabel: (e) => Ur(P, e)
869
870
  },
870
871
  offers: e
871
872
  });
@@ -875,18 +876,18 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
875
876
  destinations: c,
876
877
  sentenceOptions: u,
877
878
  context: {
878
- backRunnable: Tc(t),
879
+ backRunnable: Dc(t),
879
880
  navigation: l,
880
881
  skipRecords: n,
881
- controls: ii(),
882
+ controls: oi(),
882
883
  executors: {
883
884
  theme: o !== null,
884
885
  navigation: s !== null,
885
- conversationDelete: Oc !== null,
886
+ conversationDelete: Ac !== null,
886
887
  appControl: (e) => {
887
888
  try {
888
- let n = ri(e, { voiceLive: t !== void 0 || Rl.current });
889
- return n !== null && (n.kind !== "confirm" || Dc !== null);
889
+ let n = ai(e, { voiceLive: t !== void 0 || Vl.current });
890
+ return n !== null && (n.kind !== "confirm" || kc !== null);
890
891
  } catch {
891
892
  return !1;
892
893
  }
@@ -895,34 +896,34 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
895
896
  }
896
897
  };
897
898
  }, [
898
- Tc,
899
- Ka,
900
- B,
899
+ Dc,
900
+ qa,
901
+ V,
901
902
  P,
902
903
  Z,
903
- hc,
904
- Oc,
905
- Dc
906
- ]), Ac = D((e, t, n = !1) => {
907
- let { destinations: r, sentenceOptions: i, context: a } = kc(e, t, n);
908
- return Pr(e, r, i, a);
909
- }, [kc]), jc = D((e) => {
910
- if (js.current = e, ba?.(Te(e)), Ms.cancel(), !e.text.trim() && !e.hasAttachments) {
911
- As.current = !1;
904
+ _c,
905
+ Ac,
906
+ kc
907
+ ]), Mc = D((e, t, n = !1) => {
908
+ let { destinations: r, sentenceOptions: i, context: a } = jc(e, t, n);
909
+ return Ir(e, r, i, a);
910
+ }, [jc]), Nc = D((e) => {
911
+ if (Ns.current = e, Sa?.(Te(e)), Ps.cancel(), !e.text.trim() && !e.hasAttachments) {
912
+ Ms.current = !1;
912
913
  return;
913
914
  }
914
- if (As.current) return;
915
+ if (Ms.current) return;
915
916
  let t = () => {
916
- As.current = !0, ks(!1);
917
+ Ms.current = !0, js(!1);
917
918
  };
918
- e.hasAttachments || e.dictated ? t() : Ms.schedule(() => {
919
- if (!As.current) {
919
+ e.hasAttachments || e.dictated ? t() : Ps.schedule(() => {
920
+ if (!Ms.current) {
920
921
  try {
921
- let { destinations: t, sentenceOptions: n, context: r } = kc(e.text, void 0, !1, !0);
922
- if (Mr(e.text, t, n, r)) return;
922
+ let { destinations: t, sentenceOptions: n, context: r } = jc(e.text, void 0, !1, !0);
923
+ if (Pr(e.text, t, n, r)) return;
923
924
  } catch {
924
- if (!ua) {
925
- ua = !0;
925
+ if (!fa) {
926
+ fa = !0;
926
927
  try {
927
928
  i.getLogger("assistant").warn("Draft command classification failed; using standard warm-up.");
928
929
  } catch {}
@@ -932,36 +933,36 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
932
933
  }
933
934
  });
934
935
  }, [
935
- Ms,
936
- ba,
937
- ks,
938
- kc
936
+ Ps,
937
+ Sa,
938
+ js,
939
+ jc
939
940
  ]);
940
941
  O(() => {
941
942
  let e = () => {
942
- js.current && jc(js.current);
943
- }, t = ai(e), n = Ai(window, e), r = Oi.subscribe(e);
943
+ Ns.current && Nc(Ns.current);
944
+ }, t = si(e), n = Mi(window, e), r = Ai.subscribe(e);
944
945
  return () => {
945
- t(), n(), r(), Ms.cancel();
946
+ t(), n(), r(), Ps.cancel();
946
947
  };
947
- }, [Ms, jc]), O(() => {
948
- js.current && jc(js.current);
948
+ }, [Ps, Nc]), O(() => {
949
+ Ns.current && Nc(Ns.current);
949
950
  }, [
950
- jc,
951
- Zs,
952
- Fa,
953
- Qs,
951
+ Nc,
954
952
  $s,
955
- Hs,
956
- Xs,
953
+ Ia,
954
+ ec,
955
+ tc,
956
+ Ws,
957
+ Qs,
958
+ U,
959
+ mc,
957
960
  H,
958
- fc,
959
- V,
960
- W?.messages,
961
- G
961
+ G?.messages,
962
+ bo
962
963
  ]);
963
- let Mc = D((e, t) => {
964
- let n = Ac(e, t);
964
+ let Pc = D((e, t) => {
965
+ let n = Mc(e, t);
965
966
  if (!n) return !1;
966
967
  let { theme: r, navigate: i } = Y.current;
967
968
  switch (n.kind) {
@@ -973,14 +974,14 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
973
974
  case "link-not-openable":
974
975
  case "back": return i !== null;
975
976
  case "conversation-delete": return !1;
976
- case "app-control": return ri(n.request, { voiceLive: t !== void 0 || Rl.current }) !== null;
977
+ case "app-control": return ai(n.request, { voiceLive: t !== void 0 || Vl.current }) !== null;
977
978
  case "open-record": return !1;
978
979
  }
979
- }, [Ac]), Nc = A(Mc);
980
+ }, [Mc]), Fc = A(Pc);
980
981
  O(() => {
981
- Nc.current = Mc;
982
- }, [Mc]);
983
- let Pc = D((e, t) => {
982
+ Fc.current = Pc;
983
+ }, [Pc]);
984
+ let Ic = D((e, t) => {
984
985
  let n = {
985
986
  state: "none",
986
987
  accept: null
@@ -989,24 +990,24 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
989
990
  let o = w.getState(), s = o.conversations.find((t) => t.id === e);
990
991
  if (!s) return n;
991
992
  let c = o.processingByConversationId[s.id] ?? null, l = {
992
- registry: hc(),
993
- actorId: gc.current,
993
+ registry: _c(),
994
+ actorId: vc.current,
994
995
  conversationId: s.id,
995
996
  perfNow: performance.now()
996
- }, { state: u, reply: d } = yi(Z, {
997
+ }, { state: u, reply: d } = xi(Z, {
997
998
  ...l,
998
999
  messages: s.messages,
999
1000
  voiceSessionId: t,
1000
1001
  processing: c,
1001
1002
  displayedText: (e) => tr(e, c, P),
1002
- productWriteApproval: R,
1003
+ productWriteApproval: z,
1003
1004
  capabilitiesOf: (e) => w.getState().sandboxWriteCapabilities[e]
1004
1005
  });
1005
1006
  if (u !== "acceptable" || !d) return {
1006
1007
  state: u,
1007
1008
  accept: null
1008
1009
  };
1009
- let [f] = Z.liveOffersFor(d.id, l), p = f ? Ir(a).find((e) => e.id === f.target.id) : void 0;
1010
+ let [f] = Z.liveOffersFor(d.id, l), p = f ? Rr(a).find((e) => e.id === f.target.id) : void 0;
1010
1011
  return !f || !p ? n : {
1011
1012
  state: u,
1012
1013
  accept: {
@@ -1016,15 +1017,15 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
1016
1017
  };
1017
1018
  }, [
1018
1019
  Z,
1019
- hc,
1020
- R,
1020
+ _c,
1021
+ z,
1021
1022
  P
1022
- ]), Fc = D((e, t, n, r, i, a) => {
1023
+ ]), Lc = D((e, t, n, r, i, a) => {
1023
1024
  let o = P(n.key, n.fallback, r), s = n.fallback.replace(/\{\{\s*count\s*\}\}/g, String(r.count)), c = {
1024
1025
  kind: "write-reply",
1025
1026
  line: n.key
1026
1027
  }, l = (/* @__PURE__ */ new Date()).toISOString(), u = N();
1027
- U(e, {
1028
+ W(e, {
1028
1029
  id: u,
1029
1030
  role: "user",
1030
1031
  content: t,
@@ -1035,66 +1036,66 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
1035
1036
  }
1036
1037
  });
1037
1038
  let d = N();
1038
- U(e, {
1039
+ W(e, {
1039
1040
  id: d,
1040
1041
  role: "assistant",
1041
1042
  content: o,
1042
1043
  timestamp: l,
1043
1044
  metadata: {
1044
- lang: o === s ? "en" : B,
1045
+ lang: o === s ? "en" : V,
1045
1046
  localAction: c,
1046
1047
  ...lr(i)
1047
1048
  }
1048
- }), Ii.recordCommittedEntries(e, [u, d], "LOCAL_COMMAND", T()), a !== void 0 && Ys(a, {
1049
+ }), Ri.recordCommittedEntries(e, [u, d], "LOCAL_COMMAND", T()), a !== void 0 && Zs(a, {
1049
1050
  conversationId: e,
1050
1051
  questionId: u,
1051
1052
  replyId: d
1052
- }), Us(e, d);
1053
+ }), Gs(e, d);
1053
1054
  }, [
1054
- U,
1055
- B,
1056
- Ys,
1057
- Us,
1055
+ W,
1056
+ V,
1057
+ Zs,
1058
+ Gs,
1058
1059
  P
1059
- ]), Ic = A(() => void 0), [Lc, Rc] = j(null);
1060
+ ]), Rc = A(() => void 0), [zc, Bc] = j(null);
1060
1061
  O(() => {
1061
- if (Lc === null) return;
1062
- let e = window.setTimeout(() => Rc(null), fa);
1062
+ if (zc === null) return;
1063
+ let e = window.setTimeout(() => Bc(null), ma);
1063
1064
  return () => window.clearTimeout(e);
1064
- }, [Lc]);
1065
- let zc = D(() => {
1065
+ }, [zc]);
1066
+ let Vc = D(() => {
1066
1067
  let e = w.getState();
1067
- return to(void 0, e.autoRouting && Jo.current ? b : e.mode, e.autoRouting ? { routedBy: "auto" } : void 0);
1068
- }, [to]), Bc = D((e) => {
1069
- if (!Oc) return !1;
1070
- let t = e !== void 0, n = w.getState(), r = Ki({
1068
+ return no(void 0, e.autoRouting && Xo.current ? b : e.mode, e.autoRouting ? { routedBy: "auto" } : void 0);
1069
+ }, [no]), Hc = D((e) => {
1070
+ if (!Ac) return !1;
1071
+ let t = e !== void 0, n = w.getState(), r = Ji({
1071
1072
  spoken: t,
1072
- bound: ls.current,
1073
+ bound: ds.current,
1073
1074
  activeConversationId: n.activeConversationId,
1074
1075
  conversations: n.conversations,
1075
1076
  historyOn: xe()
1076
1077
  });
1077
- if (r && Oc(r), t) {
1078
+ if (r && Ac(r), t) {
1078
1079
  let e = r ? "Opened the delete confirmation. Choose Delete or Cancel on screen." : "There is no conversation to delete.", t = r ? P("deleteConversation.opened", "Opened the delete confirmation. Choose Delete or Cancel on screen.") : P("deleteConversation.nothing", "There is no conversation to delete.");
1079
- Ic.current({
1080
+ Rc.current({
1080
1081
  id: `conversation-delete:${N()}`,
1081
1082
  text: t,
1082
- lang: t === e ? "en" : B
1083
+ lang: t === e ? "en" : V
1083
1084
  });
1084
- } else r || Rc(Date.now());
1085
+ } else r || Bc(Date.now());
1085
1086
  return !0;
1086
1087
  }, [
1087
- Oc,
1088
- B,
1088
+ Ac,
1089
+ V,
1089
1090
  P
1090
- ]), Vc = D((e, t, n, r = !1, i) => {
1091
- if (e.kind === "conversation-delete") return Bc(n);
1091
+ ]), Uc = D((e, t, n, r = !1, i) => {
1092
+ if (e.kind === "conversation-delete") return Hc(n);
1092
1093
  let { theme: a, navigate: o } = Y.current, s = null, c = () => {
1093
- let e = (r ? null : s ?? w.getState().activeConversationId) ?? zc();
1094
- return r && ms(e), e;
1094
+ let e = (r ? null : s ?? w.getState().activeConversationId) ?? Vc();
1095
+ return r && gs(e), e;
1095
1096
  }, l = (e, r) => {
1096
1097
  let i = N();
1097
- return U(e, {
1098
+ return W(e, {
1098
1099
  id: i,
1099
1100
  role: "user",
1100
1101
  content: t,
@@ -1106,43 +1107,43 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
1106
1107
  }), i;
1107
1108
  }, u = (e, t, r, a, o, s, c) => {
1108
1109
  let l = c ?? N();
1109
- return U(e, {
1110
+ return W(e, {
1110
1111
  id: l,
1111
1112
  role: "assistant",
1112
1113
  content: r.text,
1113
1114
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1114
1115
  metadata: {
1115
- lang: r.translated ? B : "en",
1116
+ lang: r.translated ? V : "en",
1116
1117
  localAction: a,
1117
1118
  ...lr(n)
1118
1119
  }
1119
- }), Ii.recordCommittedEntries(e, [t, l], "LOCAL_COMMAND", o), i !== void 0 && Ys(i, {
1120
+ }), Ri.recordCommittedEntries(e, [t, l], "LOCAL_COMMAND", o), i !== void 0 && Zs(i, {
1120
1121
  conversationId: e,
1121
1122
  questionId: t,
1122
1123
  replyId: l
1123
- }), s && Us(e, l), l;
1124
+ }), s && Gs(e, l), l;
1124
1125
  }, d = (e, t, n) => {
1125
1126
  let r = c(), i = l(r, t), a = u(r, i, e, t, T(), !0);
1126
1127
  return n?.(a), !0;
1127
1128
  }, f = (e) => {
1128
- let t = c(), n = T(), r = window.location.pathname, a = ji({
1129
+ let t = c(), n = T(), r = window.location.pathname, a = Ni({
1129
1130
  destinationId: e.destinationId,
1130
1131
  path: e.registryPath,
1131
1132
  alreadyHere: !1,
1132
1133
  via: e.via,
1133
1134
  offer: e.offer
1134
1135
  }), s = l(t, a), d = i === void 0 ? void 0 : N();
1135
- i !== void 0 && d !== void 0 && (qs(i, {
1136
+ i !== void 0 && d !== void 0 && (Ys(i, {
1136
1137
  conversationId: t,
1137
1138
  questionId: s,
1138
1139
  replyId: d
1139
- }), dc(d));
1140
+ }), pc(d));
1140
1141
  let f = N();
1141
- sc.current = f, lc(!0);
1142
+ lc.current = f, dc(!0);
1142
1143
  let p = (i) => {
1143
1144
  try {
1144
- if (e.offer && yc(e.offer.offerId, i) && mc(), i.status === "kept" || !w.getState().conversations.some((e) => e.id === t)) return;
1145
- let a = Ir(Y.current.navItems), o = i.status === "arrived" || i.status === "redirected" ? i.landedPath : null, c = ji({
1145
+ if (e.offer && xc(e.offer.offerId, i) && gc(), i.status === "kept" || !w.getState().conversations.some((e) => e.id === t)) return;
1146
+ let a = Rr(Y.current.navItems), o = i.status === "arrived" || i.status === "redirected" ? i.landedPath : null, c = Ni({
1146
1147
  destinationId: e.destinationId,
1147
1148
  path: e.registryPath,
1148
1149
  alreadyHere: !1,
@@ -1150,10 +1151,10 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
1150
1151
  outcome: i,
1151
1152
  offer: e.offer
1152
1153
  });
1153
- io(t, s, { localAction: c });
1154
- let l = e.via === "back" && i.status === "arrived" ? Rr(P, e.pageLabel()) : Wr(P, i, {
1154
+ ao(t, s, { localAction: c });
1155
+ let l = e.via === "back" && i.status === "arrived" ? Br(P, e.pageLabel()) : Kr(P, i, {
1155
1156
  page: e.pageLabel(),
1156
- landed: o === null ? null : Ni(a, o),
1157
+ landed: o === null ? null : Fi(a, o),
1157
1158
  path: e.target
1158
1159
  }), f = u(t, s, l, c, n, X.current, d);
1159
1160
  i.status === "arrived" && e.onArrived?.({
@@ -1162,10 +1163,10 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
1162
1163
  landedPath: i.landedPath
1163
1164
  });
1164
1165
  } finally {
1165
- sc.current === f && (sc.current = null, X.current && lc(!1)), d !== void 0 && X.current && dc((e) => e === d ? null : e);
1166
+ lc.current === f && (lc.current = null, X.current && dc(!1)), d !== void 0 && X.current && pc((e) => e === d ? null : e);
1166
1167
  }
1167
1168
  };
1168
- return Fi(o, e.target, {
1169
+ return Li(o, e.target, {
1169
1170
  readPath: () => window.location.pathname + window.location.search,
1170
1171
  now: () => Date.now(),
1171
1172
  schedule: (e, t) => {
@@ -1173,7 +1174,7 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
1173
1174
  },
1174
1175
  isShellLess: () => !X.current
1175
1176
  }).then(p, () => p({ status: "unconfirmed" })), !0;
1176
- }, p = ({ replyId: e, fromPath: t, landedPath: n }) => Oi.push({
1177
+ }, p = ({ replyId: e, fromPath: t, landedPath: n }) => Ai.push({
1177
1178
  fromPath: t,
1178
1179
  toPath: n,
1179
1180
  replyMessageId: e,
@@ -1181,21 +1182,21 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
1181
1182
  });
1182
1183
  if (e.kind === "theme") {
1183
1184
  if (!a) return !1;
1184
- let t = Lr(e.request, {
1185
+ let t = zr(e.request, {
1185
1186
  mode: a.mode,
1186
1187
  resolvedTheme: a.resolvedTheme
1187
1188
  });
1188
1189
  if (!t.alreadyApplied) try {
1189
1190
  a.setMode(t.mode);
1190
1191
  } catch {}
1191
- return d(Zr(P, t, e.request.kind === "family"), {
1192
+ return d($r(P, t, e.request.kind === "family"), {
1192
1193
  kind: "theme",
1193
1194
  mode: t.mode,
1194
1195
  alreadyApplied: t.alreadyApplied
1195
1196
  });
1196
1197
  }
1197
1198
  if (e.kind === "app-control") {
1198
- let t = ri(e.request, { voiceLive: n !== void 0 || Rl.current });
1199
+ let t = ai(e.request, { voiceLive: n !== void 0 || Vl.current });
1199
1200
  if (!t) return !1;
1200
1201
  let r = (e) => ({
1201
1202
  kind: "app-control",
@@ -1203,41 +1204,41 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
1203
1204
  outcome: e.outcome,
1204
1205
  ...e.reply.code === "language" ? { languageLabel: e.reply.label } : {}
1205
1206
  }), i = (t) => {
1206
- if (e.request.control === "language" && ac(!1), e.request.control === "language" && t.reply.code === "language" && !t.reply.already && t.outcome === "done") {
1207
- let n = c(), i = r(t), a = l(n, i), o = u(n, a, $r((e, t) => t, t.reply), i, T(), !1);
1208
- return tc.current = {
1207
+ if (e.request.control === "language" && sc(!1), e.request.control === "language" && t.reply.code === "language" && !t.reply.already && t.outcome === "done") {
1208
+ let n = c(), i = r(t), a = l(n, i), o = u(n, a, ti((e, t) => t, t.reply), i, T(), !1);
1209
+ return rc.current = {
1209
1210
  wanted: e.request.code,
1210
1211
  reply: t.reply,
1211
1212
  conversationId: n,
1212
1213
  messageId: o,
1213
- deadline: window.setTimeout(oc, ei)
1214
- }, rc(o), !0;
1214
+ deadline: window.setTimeout(cc, ni)
1215
+ }, ac(o), !0;
1215
1216
  }
1216
- return d($r(P, t.reply), r(t));
1217
+ return d(ti(P, t.reply), r(t));
1217
1218
  };
1218
1219
  if (t.kind === "reply") return i(t.run);
1219
1220
  if (t.kind === "run") {
1220
1221
  let e = t.run();
1221
1222
  return t.silent && (e.outcome === "done" || e.outcome === "already") ? !0 : i(e);
1222
1223
  }
1223
- let a = Dc;
1224
+ let a = kc;
1224
1225
  if (!a) return !1;
1225
1226
  let o = null;
1226
- return d($r(P, t.ask.reply), r(t.ask), (e) => {
1227
+ return d(ti(P, t.ask.reply), r(t.ask), (e) => {
1227
1228
  o = w.getState().conversations.find((t) => t.messages.some((t) => t.id === e))?.id ?? null;
1228
1229
  }), a.request({
1229
1230
  prompt: t.prompt,
1230
1231
  onConfirm: () => {
1231
1232
  let e = t.confirmed(), i = o, a = i !== null && w.getState().conversations.some((e) => e.id === i);
1232
1233
  if (!i || !a) return;
1233
- let s = $r(P, e.reply);
1234
- U(i, {
1234
+ let s = ti(P, e.reply);
1235
+ W(i, {
1235
1236
  id: N(),
1236
1237
  role: "assistant",
1237
1238
  content: s.text,
1238
1239
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1239
1240
  metadata: {
1240
- lang: s.translated ? B : "en",
1241
+ lang: s.translated ? V : "en",
1241
1242
  localAction: r(e),
1242
1243
  ...lr(n)
1243
1244
  }
@@ -1246,23 +1247,23 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
1246
1247
  }), !0;
1247
1248
  }
1248
1249
  if (!o) return !1;
1249
- if (e.kind === "choose-destination") return d(zr(P, e.candidates[0]?.label ?? e.query, e.candidates), {
1250
+ if (e.kind === "choose-destination") return d(Vr(P, e.candidates[0]?.label ?? e.query, e.candidates), {
1250
1251
  kind: "choose-destination",
1251
1252
  candidateIds: e.candidates.map((e) => e.id)
1252
- }, (t) => fi(t, e.candidates));
1253
- if (e.kind === "choose-linked") return d(Br(P, e.candidates), {
1253
+ }, (t) => mi(t, e.candidates));
1254
+ if (e.kind === "choose-linked") return d(Hr(P, e.candidates), {
1254
1255
  kind: "choose-destination",
1255
1256
  candidateIds: e.candidates.map((e) => e.id)
1256
- }, (t) => fi(t, e.candidates));
1257
+ }, (t) => mi(t, e.candidates));
1257
1258
  if (e.kind === "pick-from-list") {
1258
1259
  let t = e.candidates !== null && e.candidates.every((e) => e !== null) ? e.candidates : null;
1259
- return d(Jr(P), t ? {
1260
+ return d(Xr(P), t ? {
1260
1261
  kind: "choose-destination",
1261
1262
  candidateIds: t.map((e) => e.id)
1262
1263
  } : e.candidateIds.length > 0 ? {
1263
1264
  kind: "choose-destination",
1264
1265
  candidateIds: [...e.candidateIds]
1265
- } : ji({
1266
+ } : Ni({
1266
1267
  destinationId: "",
1267
1268
  path: "",
1268
1269
  alreadyHere: !1,
@@ -1271,9 +1272,9 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
1271
1272
  status: "refused",
1272
1273
  reason: "not-routable"
1273
1274
  }
1274
- }), t ? (e) => fi(e, t) : void 0);
1275
+ }), t ? (e) => mi(e, t) : void 0);
1275
1276
  }
1276
- if (e.kind === "link-not-openable") return d(Hr(P), ji({
1277
+ if (e.kind === "link-not-openable") return d(Wr(P), Ni({
1277
1278
  destinationId: "",
1278
1279
  path: "",
1279
1280
  alreadyHere: !1,
@@ -1286,7 +1287,7 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
1286
1287
  if (e.kind === "open-record") {
1287
1288
  let r;
1288
1289
  try {
1289
- let { options: t, navItems: n } = Y.current, i = t.entityRoutes ?? [], a = mi(n);
1290
+ let { options: t, navItems: n } = Y.current, i = t.entityRoutes ?? [], a = gi(n);
1290
1291
  r = (t.records ?? []).flatMap((t) => {
1291
1292
  let n = i.find((e) => e.id === t.entityRouteId), r = e.request.adapterIds.length === 0 || e.request.adapterIds.includes(t.id);
1292
1293
  return n && r && (n.visibleWith === void 0 || a.has(n.visibleWith)) ? [{
@@ -1299,18 +1300,18 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
1299
1300
  }
1300
1301
  if (r.length === 0) return !1;
1301
1302
  let i = w.getState().activeConversationId, a = N();
1302
- sc.current = a, lc(!0);
1303
+ lc.current = a, dc(!0);
1303
1304
  let o = () => {
1304
- sc.current === a && (sc.current = null, X.current && lc(!1));
1305
+ lc.current === a && (lc.current = null, X.current && dc(!1));
1305
1306
  };
1306
1307
  return (async () => {
1307
1308
  let a = { kind: "none" }, c = !0;
1308
1309
  try {
1309
- a = await pi({
1310
+ a = await hi({
1310
1311
  name: e.request.name,
1311
1312
  usable: r,
1312
- nounOf: (e) => Vr(P, e.noun),
1313
- timeoutMs: aa
1313
+ nounOf: (e) => Ur(P, e.noun),
1314
+ timeoutMs: sa
1314
1315
  }), c = w.getState().conversations.some((e) => e.id === i);
1315
1316
  } catch {
1316
1317
  a = { kind: "none" };
@@ -1319,7 +1320,7 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
1319
1320
  }
1320
1321
  if (!X.current) return;
1321
1322
  if (a.kind === "none") {
1322
- Kc.current(t, [], {
1323
+ Jc.current(t, [], {
1323
1324
  fromPerson: !0,
1324
1325
  ...n === void 0 ? {} : { voiceSessionId: n },
1325
1326
  localRecordsChecked: !0
@@ -1340,16 +1341,16 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
1340
1341
  return;
1341
1342
  }
1342
1343
  let l = a.candidates[0];
1343
- d(a.why === "kinds" ? Xr(P, a.nouns, a.candidates) : Yr(P, a.nouns[0] ?? "", l?.label ?? e.request.name, a.candidates), {
1344
+ d(a.why === "kinds" ? Qr(P, a.nouns, a.candidates) : Zr(P, a.nouns[0] ?? "", l?.label ?? e.request.name, a.candidates), {
1344
1345
  kind: "choose-destination",
1345
1346
  candidateIds: a.candidates.map((e) => e.id)
1346
- }, (e) => fi(e, a.candidates));
1347
+ }, (e) => mi(e, a.candidates));
1347
1348
  })().catch(() => void 0), !0;
1348
1349
  }
1349
1350
  if (e.kind === "back") {
1350
- let e = Oi.top();
1351
+ let e = Ai.top();
1351
1352
  if (!e) return !1;
1352
- let t = Ir(Y.current.navItems), n = Mi(t, e.fromPath);
1353
+ let t = Rr(Y.current.navItems), n = Pi(t, e.fromPath);
1353
1354
  return f({
1354
1355
  target: e.fromPath,
1355
1356
  destinationId: n?.id ?? "",
@@ -1357,27 +1358,27 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
1357
1358
  via: "back",
1358
1359
  pageLabel: () => n?.label ?? null,
1359
1360
  onArrived: () => {
1360
- Oi.top() === e && Oi.pop();
1361
+ Ai.top() === e && Ai.pop();
1361
1362
  }
1362
1363
  });
1363
1364
  }
1364
1365
  let ee, m = e.destination;
1365
1366
  if (e.via === "offer") {
1366
- let t = _c(e.offerId, e.destination.label);
1367
- if (!t.ok) return d(t.copy ?? Gr(P), {
1367
+ let t = yc(e.offerId, e.destination.label);
1368
+ if (!t.ok) return d(t.copy ?? qr(P), {
1368
1369
  kind: "write-reply",
1369
1370
  line: t.reason === "unavailable" ? "offer.notAvailable" : "offer.expired"
1370
1371
  });
1371
1372
  ee = {
1372
1373
  trigger: e.trigger,
1373
1374
  offerId: e.offerId
1374
- }, m = Ir(Y.current.navItems).find((e) => e.id === t.target.id) ?? {
1375
+ }, m = Rr(Y.current.navItems).find((e) => e.id === t.target.id) ?? {
1375
1376
  id: t.target.id,
1376
1377
  label: t.target.label,
1377
1378
  path: t.target.path
1378
1379
  };
1379
1380
  }
1380
- return Nr(m, window.location.pathname + window.location.search, Ir(Y.current.navItems)) ? d(Ur(P, m.label, !0), ji({
1381
+ return Fr(m, window.location.pathname + window.location.search, Rr(Y.current.navItems)) ? d(Gr(P, m.label, !0), Ni({
1381
1382
  destinationId: m.id,
1382
1383
  path: m.path,
1383
1384
  alreadyHere: !0,
@@ -1393,55 +1394,55 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
1393
1394
  onArrived: p
1394
1395
  });
1395
1396
  }, [
1396
- U,
1397
- ms,
1398
- Dc,
1399
- zc,
1400
- oc,
1401
- B,
1402
- io,
1403
- qs,
1404
- Bc,
1397
+ W,
1398
+ gs,
1399
+ kc,
1400
+ Vc,
1401
+ cc,
1402
+ V,
1403
+ ao,
1405
1404
  Ys,
1406
- ac,
1407
- Us,
1405
+ Hc,
1406
+ Zs,
1407
+ sc,
1408
+ Gs,
1408
1409
  P,
1409
- _c,
1410
1410
  yc,
1411
- mc
1412
- ]), Hc = D(async (e) => {
1413
- Xo.current = !0, Qo(!0);
1411
+ xc,
1412
+ gc
1413
+ ]), Wc = D(async (e) => {
1414
+ Qo.current = !0, es(!0);
1414
1415
  try {
1415
1416
  await K.declineForReply(e.conversationId, e.reason, e.origin);
1416
1417
  } finally {
1417
- Xo.current = !1, X.current && Qo(!1);
1418
+ Qo.current = !1, X.current && es(!1);
1418
1419
  }
1419
1420
  if (e.commandText !== null) {
1420
- let t = Ac(e.commandText, e.options.voiceSessionId);
1421
- if (t && Vc(t, e.content, e.options.voiceSessionId)) return;
1421
+ let t = Mc(e.commandText, e.options.voiceSessionId);
1422
+ if (t && Uc(t, e.content, e.options.voiceSessionId)) return;
1422
1423
  }
1423
- await Kc.current(e.content, e.attachments, e.options);
1424
+ await Jc.current(e.content, e.attachments, e.options);
1424
1425
  }, [
1425
- Ac,
1426
- Vc,
1426
+ Mc,
1427
+ Uc,
1427
1428
  K
1428
1429
  ]), Q = D(async (n, r = [], i = {}) => {
1429
- let a = i.voiceSessionId !== void 0, o = w.getState(), s = !1, c = ls.current;
1430
- if (a && dr(c)) {
1431
- let e = gr(c, o.activeConversationId, _s());
1430
+ let a = i.voiceSessionId !== void 0, o = w.getState(), s = !1, c = ds.current;
1431
+ if (a && pr(c)) {
1432
+ let e = vr(c, o.activeConversationId, ys());
1432
1433
  if (e.kind === "gone") return;
1433
1434
  let t = i.voiceEntry ?? e;
1434
- t.kind === "adopt" && ms(t.conversationId), s = t.kind === "own", i = {
1435
+ t.kind === "adopt" && gs(t.conversationId), s = t.kind === "own", i = {
1435
1436
  ...i,
1436
1437
  voiceEntry: t
1437
1438
  };
1438
1439
  }
1439
- let l = s ? null : o.activeConversationId, u = s ? null : o.activeConversationId ?? V;
1440
+ let l = s ? null : o.activeConversationId, u = s ? null : o.activeConversationId ?? H;
1440
1441
  if (u) {
1441
1442
  if (On(o.processingByConversationId[u]?.status)) {
1442
1443
  if (i.avatarTabAsk !== void 0) return;
1443
1444
  let e = o.processingByConversationId[u]?.messageId ?? null;
1444
- e && i.correctsInFlightTurn === !0 && !Is.current.has(e) && zs(), e && Is.current.has(e) && (Ls.current = {
1445
+ e && i.correctsInFlightTurn === !0 && !Rs.current.has(e) && Vs(), e && Rs.current.has(e) && (zs.current = {
1445
1446
  conversationId: u,
1446
1447
  content: n,
1447
1448
  attachments: r,
@@ -1449,10 +1450,10 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
1449
1450
  });
1450
1451
  return;
1451
1452
  }
1452
- if (xs.current.has(u)) return;
1453
+ if (Cs.current.has(u)) return;
1453
1454
  }
1454
- if (Yo.current || Cr() !== null || Xo.current || sc.current !== null) return;
1455
- let d = i.targetConversationId, f = Wi(), p = (e) => zi(e) || Ri(e, f);
1455
+ if (Zo.current || Tr() !== null || Qo.current || lc.current !== null) return;
1456
+ let d = i.targetConversationId, f = Ki(), p = (e) => Vi(e) || Bi(e, f);
1456
1457
  if (d !== void 0) {
1457
1458
  let e = o.conversations.find((e) => e.id === d);
1458
1459
  if (o.activeConversationId !== d || !e || e.mode !== o.mode || p(e)) return;
@@ -1460,29 +1461,29 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
1460
1461
  if (i.avatarTabAsk !== void 0) {
1461
1462
  let e = l ? o.conversations.find((e) => e.id === l) : void 0, t = e && !p(e) ? e : void 0;
1462
1463
  if (qe({
1463
- auto: o.autoRouting && Jo.current && d === void 0,
1464
+ auto: o.autoRouting && Xo.current && d === void 0,
1464
1465
  selectedMode: o.mode,
1465
1466
  conversation: t ? {
1466
1467
  mode: t.mode,
1467
1468
  routedBy: t.routedBy,
1468
- hasHistory: Li(t)
1469
+ hasHistory: zi(t)
1469
1470
  } : null,
1470
- modeWrites: (e) => Bo.current.find((t) => t.id === e)?.writeCapable === !0 || gt(e)
1471
+ modeWrites: (e) => Ho.current.find((t) => t.id === e)?.writeCapable === !0 || gt(e)
1471
1472
  }) !== null) return;
1472
1473
  }
1473
1474
  if (i.fromPerson && i.writeReplyBound === void 0) {
1474
- let e = d ?? l ?? null, t = i.voiceSessionId === void 0 ? "typed" : "spoken", a = Pc(e, i.voiceSessionId), o = se({
1475
+ let e = d ?? l ?? null, t = i.voiceSessionId === void 0 ? "typed" : "spoken", a = Ic(e, i.voiceSessionId), o = se({
1475
1476
  text: n,
1476
- locale: t === "spoken" ? Ka.input.code : B,
1477
+ locale: t === "spoken" ? qa.input.code : V,
1477
1478
  origin: t,
1478
1479
  hasAttachments: r.length > 0 || i.focus !== void 0,
1479
1480
  live: K.liveFor(e),
1480
- matchesLocalCommand: (e) => Ac(e, i.voiceSessionId) !== null,
1481
+ matchesLocalCommand: (e) => Mc(e, i.voiceSessionId) !== null,
1481
1482
  offer: a.state,
1482
- offerAssent: a.state !== "none" && Qr({
1483
+ offerAssent: a.state !== "none" && ei({
1483
1484
  text: n,
1484
- uiLocale: B,
1485
- inputLocale: Ka.input.code,
1485
+ uiLocale: V,
1486
+ inputLocale: qa.input.code,
1486
1487
  commandLocales: Y.current.options.commandLocales,
1487
1488
  manifest: Y.current.options.commandManifest,
1488
1489
  leaveGuard: Y.current.options.leaveGuard
@@ -1490,14 +1491,14 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
1490
1491
  });
1491
1492
  if (o.kind === "accept_offer") {
1492
1493
  let e = a.accept;
1493
- if (e && Vc({
1494
+ if (e && Uc({
1494
1495
  kind: "navigate",
1495
1496
  destination: e.destination,
1496
1497
  via: "offer",
1497
1498
  offerId: e.offerId,
1498
1499
  trigger: "yes"
1499
1500
  }, n, i.voiceSessionId, s, i.avatarTabAsk)) {
1500
- Js(i.avatarTabAsk);
1501
+ Xs(i.avatarTabAsk);
1501
1502
  return;
1502
1503
  }
1503
1504
  o = {
@@ -1514,11 +1515,11 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
1514
1515
  };
1515
1516
  }
1516
1517
  if (o.kind === "local_reply") {
1517
- e && Fc(e, n, o.line, o.values, i.voiceSessionId, i.avatarTabAsk);
1518
+ e && Lc(e, n, o.line, o.values, i.voiceSessionId, i.avatarTabAsk);
1518
1519
  return;
1519
1520
  }
1520
1521
  let c = o.kind === "local" ? o.fallback : o.bound, u = o.declineAll;
1521
- if (u !== null && e) return i.avatarTabAsk === void 0 ? Hc({
1522
+ if (u !== null && e) return i.avatarTabAsk === void 0 ? Wc({
1522
1523
  conversationId: e,
1523
1524
  reason: u,
1524
1525
  origin: t,
@@ -1537,51 +1538,51 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
1537
1538
  }
1538
1539
  let ee = i.writeReplyBound?.promptText ?? n;
1539
1540
  if (i.fromPerson && r.length === 0 && i.focus === void 0 && i.writeReplyBound?.localCommands !== !1) {
1540
- let e = Ac(n, i.voiceSessionId, i.localRecordsChecked === !0);
1541
- if (e && Vc(e, n, i.voiceSessionId, s, i.avatarTabAsk)) {
1542
- Js(i.avatarTabAsk);
1541
+ let e = Mc(n, i.voiceSessionId, i.localRecordsChecked === !0);
1542
+ if (e && Uc(e, n, i.voiceSessionId, s, i.avatarTabAsk)) {
1543
+ Xs(i.avatarTabAsk);
1543
1544
  return;
1544
1545
  }
1545
1546
  }
1546
- let m = l ? o.conversations.find((e) => e.id === l) : void 0, h = p(m) ? void 0 : m, g = o.autoRouting && Jo.current && d === void 0 ? pe({
1547
+ let m = l ? o.conversations.find((e) => e.id === l) : void 0, h = p(m) ? void 0 : m, g = o.autoRouting && Xo.current && d === void 0 ? pe({
1547
1548
  intent: i.avatarTabAsk === void 0 ? i.autoIntent ?? ue(n) : "read",
1548
1549
  dictated: a,
1549
- voiceProposalBound: a && Ia("api-calls") && Jn(o.acknowledgedWriteModes, "api-calls"),
1550
+ voiceProposalBound: a && La("api-calls") && Jn(o.acknowledgedWriteModes, "api-calls"),
1550
1551
  conversation: h ? {
1551
1552
  mode: h.mode,
1552
1553
  routedBy: h.routedBy,
1553
- hasHistory: Li(h)
1554
+ hasHistory: zi(h)
1554
1555
  } : null
1555
1556
  }) : null;
1556
- if (g && Bo.current.find((e) => e.id === g.mode)?.writeCapable && !Jn(o.acknowledgedWriteModes, g.mode)) {
1557
- Yo.current = {
1557
+ if (g && Ho.current.find((e) => e.id === g.mode)?.writeCapable && !Jn(o.acknowledgedWriteModes, g.mode)) {
1558
+ Zo.current = {
1558
1559
  content: n,
1559
1560
  attachments: r,
1560
1561
  options: i
1561
- }, ts(g.mode);
1562
+ }, rs(g.mode);
1562
1563
  return;
1563
1564
  }
1564
- let _ = g ? g.mode : o.mode, te, ne, v = d ?? (s ? null : V), re = v ? w.getState().conversations.find((e) => e.id === v) : void 0, ie = g?.action === "escalate" && h ? {
1565
+ let _ = g ? g.mode : o.mode, te, ne, v = d ?? (s ? null : H), re = v ? w.getState().conversations.find((e) => e.id === v) : void 0, ie = g?.action === "escalate" && h ? {
1565
1566
  mode: h.mode,
1566
1567
  backendSessionId: h.backendSessionId ?? null
1567
1568
  } : null;
1568
- if (g) g.action === "new" || !h ? v = to(void 0, _, { routedBy: "auto" }) : (v = h.id, go(v, _));
1569
+ if (g) g.action === "new" || !h ? v = no(void 0, _, { routedBy: "auto" }) : (v = h.id, _o(v, _));
1569
1570
  else {
1570
1571
  let e = o.autoRouting ? { routedBy: "auto" } : void 0;
1571
- !v || p(re) || re && re.mode !== _ && Li(re) ? v = to(void 0, _, e) : re && re.mode !== _ && (e ? go(v, _) : $a(v, _));
1572
+ !v || p(re) || re && re.mode !== _ && zi(re) ? v = no(void 0, _, e) : re && re.mode !== _ && (e ? _o(v, _) : eo(v, _));
1572
1573
  }
1573
1574
  if (!v) return;
1574
- a && ls.current !== void 0 && v !== o.activeConversationId && ms(v), i.approvalFollowUp || (vs.current[v] = r);
1575
+ a && ds.current !== void 0 && v !== o.activeConversationId && gs(v), i.approvalFollowUp || (bs.current[v] = r);
1575
1576
  let ae = () => w.getState().conversations.some((e) => e.id === v), y = T(), b = {
1576
- accessToken: La(),
1577
- workspaceToken: Ra(),
1578
- userId: z,
1577
+ accessToken: Ra(),
1578
+ workspaceToken: za(),
1579
+ userId: B,
1579
1580
  organizationId: Vt()
1580
1581
  }, le = (e, t) => {
1581
1582
  !ae() && y && st(e, y, t, _, {
1582
- accessToken: La(),
1583
- workspaceToken: Ra(),
1584
- userId: z,
1583
+ accessToken: Ra(),
1584
+ workspaceToken: za(),
1585
+ userId: B,
1585
1586
  organizationId: Vt()
1586
1587
  });
1587
1588
  }, fe = {
@@ -1599,30 +1600,30 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
1599
1600
  ...lr(i.voiceSessionId)
1600
1601
  }
1601
1602
  };
1602
- U(v, fe);
1603
- let me = i.fromPerson === !0 && r.length === 0 && i.focus === void 0 && i.approvalFollowUp === void 0 && ee === n ? wi(n, a ? Ka.input.code : B) : null, he = {
1603
+ W(v, fe);
1604
+ let me = i.fromPerson === !0 && r.length === 0 && i.focus === void 0 && i.approvalFollowUp === void 0 && ee === n ? Ei(n, a ? qa.input.code : V) : null, he = {
1604
1605
  location: window.location.pathname + window.location.search,
1605
1606
  conversationId: w.getState().activeConversationId,
1606
1607
  workspaceId: T(),
1607
- actorId: z ?? null
1608
+ actorId: B ?? null
1608
1609
  }, x = N();
1609
- U(v, {
1610
+ W(v, {
1610
1611
  id: x,
1611
1612
  role: "assistant",
1612
1613
  content: "",
1613
1614
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1614
1615
  metadata: {
1615
- lang: Ya,
1616
+ lang: Xa,
1616
1617
  ...lr(i.voiceSessionId)
1617
1618
  }
1618
1619
  }), sn(x, {
1619
1620
  channel: a ? "voice" : "chat",
1620
1621
  mode: _,
1621
- product: I,
1622
- language: Ya,
1622
+ product: L,
1623
+ language: Xa,
1623
1624
  device: ln(),
1624
1625
  routedByAuto: !!g
1625
- }, i.voiceTiming), E(x, "accepted"), ao(v, "provisioning", x, null), wr(x), i.avatarTabAsk !== void 0 && Ys(i.avatarTabAsk, {
1626
+ }, i.voiceTiming), E(x, "accepted"), oo(v, "provisioning", x, null), Er(x), i.avatarTabAsk !== void 0 && Zs(i.avatarTabAsk, {
1626
1627
  conversationId: v,
1627
1628
  questionId: fe.id,
1628
1629
  replyId: x
@@ -1630,13 +1631,13 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
1630
1631
  let ge = () => {
1631
1632
  let e = kn({
1632
1633
  turnId: x,
1633
- abortRequested: Is.current.has(x),
1634
+ abortRequested: Rs.current.has(x),
1634
1635
  activeTurnId: w.getState().processingByConversationId[v]?.messageId ?? null,
1635
1636
  conversationExists: ae()
1636
1637
  });
1637
1638
  return e.abandon && ye(), e;
1638
- }, _e = (e, t, n, r, a = !1, o = Ya) => {
1639
- ro(v, x, { content: Et(e) }), io(v, x, {
1639
+ }, _e = (e, t, n, r, a = !1, o = Xa) => {
1640
+ io(v, x, { content: Et(e) }), ao(v, x, {
1640
1641
  lang: o,
1641
1642
  ...t?.length ? { artifacts: t } : {},
1642
1643
  ...t?.length || n || r ? { mode: _ } : {},
@@ -1659,17 +1660,17 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
1659
1660
  E(x, "attemptStarted");
1660
1661
  let s = null, c = null, l = !1;
1661
1662
  try {
1662
- let { sandboxId: e, sessionId: u, sessionIsNew: d, readAhead: f, sandboxIsNew: p, sandboxProbed: m, sandboxAdopted: h, deadSandboxProbe: g, sessionPreopened: re, knownFloor: ie } = await Os(v, x, _, y, b, {
1663
+ let { sandboxId: e, sessionId: u, sessionIsNew: d, readAhead: f, sandboxIsNew: p, sandboxProbed: m, sandboxAdopted: h, deadSandboxProbe: g, sessionPreopened: re, knownFloor: ie } = await As(v, x, _, y, b, {
1663
1664
  isAbandoned: () => kn({
1664
1665
  turnId: x,
1665
- abortRequested: Is.current.has(x),
1666
+ abortRequested: Rs.current.has(x),
1666
1667
  activeTurnId: w.getState().processingByConversationId[v]?.messageId ?? null,
1667
1668
  conversationExists: ae()
1668
1669
  }).abandon,
1669
1670
  ...o ? { verifySession: !0 } : {}
1670
1671
  });
1671
1672
  if (s = e, we(), we = t(e, () => {
1672
- Is.current.add(x), Mt(x), kt.abort(x);
1673
+ Rs.current.add(x), Mt(x), kt.abort(x);
1673
1674
  }), E(x, "runtimeReady"), cn(x, {
1674
1675
  runtime: p ? "cold" : h ? "adopted" : m ? "probed" : re ? "preopened" : d ? "new-session" : "warm",
1675
1676
  deadSandboxProbe: g
@@ -1679,22 +1680,22 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
1679
1680
  }, F) {
1680
1681
  let e = ge();
1681
1682
  if (e.abandon) {
1682
- e.clearProcessing && oo(v);
1683
+ e.clearProcessing && so(v);
1683
1684
  return;
1684
1685
  }
1685
1686
  }
1686
1687
  if (Yn(_, te, w.getState().acknowledgedWriteModes, {
1687
1688
  dictated: a,
1688
1689
  confirmsWrites: gt(_),
1689
- proposalBound: Ia(_, e)
1690
+ proposalBound: La(_, e)
1690
1691
  }) === "voice-in-write-mode") throw new Wt("voice-in-write-mode", "Voice in a write mode");
1691
- let se = Vi({
1692
+ let se = Ui({
1692
1693
  conversation: w.getState().conversations.find((e) => e.id === v),
1693
1694
  content: n,
1694
1695
  sessionIsNew: d,
1695
1696
  sendingMode: _,
1696
1697
  sendingModeConfig: te,
1697
- modes: Bo.current,
1698
+ modes: Ho.current,
1698
1699
  answerText: (e) => Xe(e).text
1699
1700
  });
1700
1701
  if (be(), Kn()) {
@@ -1709,7 +1710,7 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
1709
1710
  channel: "voice",
1710
1711
  voiceSessionId: i.voiceSessionId,
1711
1712
  text: t,
1712
- lang: Ya,
1713
+ lang: Xa,
1713
1714
  final: !1
1714
1715
  }, e));
1715
1716
  },
@@ -1726,21 +1727,21 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
1726
1727
  });
1727
1728
  }
1728
1729
  let ue = ie ?? await Lt(() => pt(e, y, u, _, b, { limit: 50 }), d, Ft(f, e, u));
1729
- Es(v, x, "streaming", "thinking");
1730
- let de = ja?.(), pe = ce(w.getState().sandboxWriteCapabilities[e]), Se = Y.current, Te = vi(e, u), Ee = Se.options.uiCatalogue ? hi(Ir(Se.navItems), {
1730
+ Os(v, x, "streaming", "thinking");
1731
+ let de = Ma?.(), pe = ce(w.getState().sandboxWriteCapabilities[e]), Se = Y.current, Te = bi(e, u), Ee = Se.options.uiCatalogue ? _i(Rr(Se.navItems), {
1731
1732
  permissionsSettled: Se.navPermissionsSettled,
1732
1733
  simulating: Se.navSimulating,
1733
- sentBefore: _i(Te)
1734
+ sentBefore: yi(Te)
1734
1735
  }) : null, De = w.getState().sandboxWriteCapabilities[e]?.clientTools === !0 ? Tt({ writeCapable: te?.writeCapable === !0 || _ === "api-calls" }) : null, Oe = De?.manifest ?? [], ke = {
1735
1736
  conversationId: v,
1736
1737
  writeReply: pe === "proposal-v1" ? i.writeReplyBound?.writeReply ?? null : null,
1737
1738
  ...Ee ? { uiCatalogue: Ee } : {},
1738
1739
  ...Oe.length > 0 ? { clientTools: Oe } : {}
1739
1740
  }, { prompt: Ae, parts: je } = yn({
1740
- content: ea(se ? `${se}${ee}` : ee, i.focus),
1741
+ content: na(se ? `${se}${ee}` : ee, i.focus),
1741
1742
  attachments: r,
1742
1743
  limits: _n(te),
1743
- wrapPrompt: (e) => Ma?.(_, e, qa, Ja, a, { writeApproval: pe }) ?? e,
1744
+ wrapPrompt: (e) => Na?.(_, e, Ja, Ya, a, { writeApproval: pe }) ?? e,
1744
1745
  requestBytes: (t, n) => vt({
1745
1746
  sandboxId: e,
1746
1747
  workspaceId: y,
@@ -1756,7 +1757,7 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
1756
1757
  l = mn(r) > Me;
1757
1758
  let Pe = ge();
1758
1759
  if (Pe.abandon) {
1759
- Pe.clearProcessing && oo(v);
1760
+ Pe.clearProcessing && so(v);
1760
1761
  return;
1761
1762
  }
1762
1763
  let Fe = (t) => Ce.dispatch({
@@ -1775,8 +1776,8 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
1775
1776
  if (!Ce.canFailover() || !je || !En(e)) throw e;
1776
1777
  await Fe(void 0), l ||= Ne;
1777
1778
  }
1778
- Ee && gi(Te);
1779
- let Ie = w.getState().sandboxWriteCapabilities[e], Le = Se.options.uiOffers === !0 && xi(Ie) ? z : null, Re = !!Le;
1779
+ Ee && vi(Te);
1780
+ let Ie = w.getState().sandboxWriteCapabilities[e], Le = Se.options.uiOffers === !0 && Ci(Ie) ? B : null, Re = !!Le;
1780
1781
  Le && Z.recordTurn({
1781
1782
  replyId: x,
1782
1783
  conversationId: v,
@@ -1791,8 +1792,8 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
1791
1792
  tools: De.tools,
1792
1793
  post: (t, n) => _t(e, y, u, t, n, _, b)
1793
1794
  }) : null, Be = ze ? (e) => ze.receive(e) : void 0, Ve = Re ? (e, t) => {
1794
- Z.receive(x, e, t, performance.now()) && mc();
1795
- } : void 0, He = (e) => ro(v, x, { content: e }), Ue = (e) => l ? `${e}\n\n${P("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._")}` : e;
1795
+ Z.receive(x, e, t, performance.now()) && gc();
1796
+ } : void 0, He = (e) => io(v, x, { content: e }), Ue = (e) => l ? `${e}\n\n${P("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._")}` : e;
1796
1797
  E(x, "promptSent");
1797
1798
  let We = null, Ge = !1, Ke = Nt, C = Pt([], ue);
1798
1799
  S.render?.arm(ue);
@@ -1811,28 +1812,28 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
1811
1812
  le(e, u);
1812
1813
  let t = ge();
1813
1814
  if (t.abandon) {
1814
- t.clearProcessing && oo(v);
1815
+ t.clearProcessing && so(v);
1815
1816
  return;
1816
1817
  }
1817
1818
  let n = Date.now(), r = await et.next();
1818
- Re && Z.observeMessages(x, r) && mc(), C = Pt(r, ue, { accumulateNarration: ne.accumulatesNarration });
1819
+ Re && Z.observeMessages(x, r) && gc(), C = Pt(r, ue, { accumulateNarration: ne.accumulatesNarration });
1819
1820
  let i = Ot(Qe, C.done, Ze, Date.now());
1820
1821
  if (i !== C.done && (C = {
1821
1822
  ...C,
1822
1823
  done: i
1823
- }), ro(v, x, { content: Et(C.content) }), C.hasRenderableOutput ? Ge || (Ge = !0, We !== null && E(x, "lastQuietPoll", We), E(x, "firstOutput")) : We = dn(), ne.accumulatesNarration) C.hasText && E(x, "firstText");
1824
+ }), io(v, x, { content: Et(C.content) }), C.hasRenderableOutput ? Ge || (Ge = !0, We !== null && E(x, "lastQuietPoll", We), E(x, "firstOutput")) : We = dn(), ne.accumulatesNarration) C.hasText && E(x, "firstText");
1824
1825
  else {
1825
1826
  let e = Bt(Ke, C, dn());
1826
1827
  Ke = e.tracker, e.confirmedAt !== null && E(x, "firstText", e.confirmedAt);
1827
1828
  }
1828
- if (C.pendingWrite && !oe(w.getState().sandboxWriteCapabilities[e]) && io(v, x, { pendingWrite: C.pendingWrite }), C.done && (S.stream ? cn(x, {
1829
+ if (C.pendingWrite && !oe(w.getState().sandboxWriteCapabilities[e]) && ao(v, x, { pendingWrite: C.pendingWrite }), C.done && (S.stream ? cn(x, {
1829
1830
  transport: S.stream.reachedOpen ? "sse" : "poll",
1830
1831
  live: Bn(S.stream.live)
1831
1832
  }) : cn(x, {
1832
1833
  transport: "poll",
1833
1834
  live: "none"
1834
1835
  }), ye()), C.done) {
1835
- E(x, "answerDone"), ys.current.markVerified(e), ne.continuesInBackground || It(e, u, r);
1836
+ E(x, "answerDone"), xs.current.markVerified(e), ne.continuesInBackground || It(e, u, r);
1836
1837
  break;
1837
1838
  }
1838
1839
  if (S.render?.refresh(r), Date.now() - Je > 3e4 && (zn(e, y, b), Je = Date.now()), !et.hasPending()) {
@@ -1853,7 +1854,7 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
1853
1854
  channel: "voice",
1854
1855
  voiceSessionId: i.voiceSessionId,
1855
1856
  text: e,
1856
- lang: Ya,
1857
+ lang: Xa,
1857
1858
  final: !0
1858
1859
  }));
1859
1860
  }
@@ -1863,21 +1864,21 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
1863
1864
  content: Ue(C.content)
1864
1865
  });
1865
1866
  let rt = !C.done;
1866
- _e(C.content, nt, u, e, rt), C.tokens && (ro(v, x, { tokens: C.tokens }), Pa && Sn({
1867
+ _e(C.content, nt, u, e, rt), C.tokens && (io(v, x, { tokens: C.tokens }), Fa && Sn({
1867
1868
  workspaceId: y,
1868
1869
  sessionId: u,
1869
1870
  messageId: C.messageId,
1870
1871
  model: C.model,
1871
1872
  tokens: C.tokens
1872
- }, Pa, { ledger: bn("panel", I) }).then((e) => {
1873
- e.ok && Ut(I);
1873
+ }, Fa, { ledger: bn("panel", L) }).then((e) => {
1874
+ e.ok && Ut(L);
1874
1875
  })), C.done || le(e, u);
1875
1876
  let it = ge();
1876
1877
  if (it.abandon) {
1877
- it.clearProcessing && oo(v);
1878
+ it.clearProcessing && so(v);
1878
1879
  return;
1879
1880
  }
1880
- E(x, "complete"), cn(x, { outcome: "answered" }), ao(v, "complete", x, null), Ii.recordCommittedEntries(v, [fe.id, x], "TURN", y), xe = !1, Re && me && C.done && wc({
1881
+ E(x, "complete"), cn(x, { outcome: "answered" }), oo(v, "complete", x, null), Ri.recordCommittedEntries(v, [fe.id, x], "TURN", y), xe = !1, Re && me && C.done && Ec({
1881
1882
  replyId: x,
1882
1883
  conversationId: v,
1883
1884
  voiceSessionId: i.voiceSessionId,
@@ -1886,27 +1887,27 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
1886
1887
  });
1887
1888
  } catch (t) {
1888
1889
  let n = t instanceof In;
1889
- n || ys.current.invalidate(s ?? w.getState().sandboxesByMode[_]?.sandboxId ?? null);
1890
+ n || xs.current.invalidate(s ?? w.getState().sandboxesByMode[_]?.sandboxId ?? null);
1890
1891
  let r = kn({
1891
1892
  turnId: x,
1892
- abortRequested: Is.current.has(x),
1893
+ abortRequested: Rs.current.has(x),
1893
1894
  activeTurnId: w.getState().processingByConversationId[v]?.messageId ?? null,
1894
1895
  conversationExists: ae()
1895
1896
  });
1896
1897
  if (ye(), s && c && le(s, c), r.abandon) {
1897
- r.clearProcessing && oo(v);
1898
+ r.clearProcessing && so(v);
1898
1899
  return;
1899
1900
  }
1900
- if (n) return we(), co(v), be(), un(x), Te(e, !0);
1901
+ if (n) return we(), lo(v), be(), un(x), Te(e, !0);
1901
1902
  if (e === 1 && Ce.canFailover() && Dn(t)) {
1902
1903
  we();
1903
1904
  let e = s ?? w.getState().sandboxesByMode[_]?.sandboxId ?? null;
1904
- return e && (bs.current.add(e), ys.current.invalidate(e)), co(v), uo(_), no(v, x, ""), io(v, x, { pendingWrite: void 0 }), e && K.retireSandbox(e), be(), Se(!0), un(x), Te(2);
1905
+ return e && (Ss.current.add(e), xs.current.invalidate(e)), lo(v), fo(_), ro(v, x, ""), ao(v, x, { pendingWrite: void 0 }), e && K.retireSandbox(e), be(), Se(!0), un(x), Te(2);
1905
1906
  }
1906
1907
  throw t;
1907
1908
  }
1908
1909
  }, Ee = v;
1909
- xs.current.add(Ee);
1910
+ Cs.current.add(Ee);
1910
1911
  let De = Fn();
1911
1912
  Rn();
1912
1913
  try {
@@ -1914,111 +1915,111 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
1914
1915
  code: "UNAUTHENTICATED",
1915
1916
  authFailure: "WORKSPACE_CONTEXT_MISSING"
1916
1917
  } });
1917
- let e = await Zn(_, () => Bo.current.find((e) => e.id === _), zo);
1918
+ let e = await Zn(_, () => Ho.current.find((e) => e.id === _), Vo);
1918
1919
  te = e.config, ne = e.capabilities;
1919
1920
  let t = te, n = ge();
1920
1921
  if (n.abandon) {
1921
- n.clearProcessing && oo(v);
1922
+ n.clearProcessing && so(v);
1922
1923
  return;
1923
1924
  }
1924
1925
  let r = Yn(_, t, w.getState().acknowledgedWriteModes, {
1925
1926
  dictated: a,
1926
1927
  confirmsWrites: gt(_),
1927
- proposalBound: Ia(_)
1928
+ proposalBound: La(_)
1928
1929
  });
1929
1930
  if (r) throw new Wt(r, r === "confirm-write-mode" ? "Write mode not confirmed" : "Voice in a write mode");
1930
- let i = bn("panel", I);
1931
- if (Pa && await wn(i, y), Pa && xn(i, y)) {
1932
- let e = await Cn(i, y, Pa);
1931
+ let i = bn("panel", L);
1932
+ if (Fa && await wn(i, y), Fa && xn(i, y)) {
1933
+ let e = await Cn(i, y, Fa);
1933
1934
  if (!e.ok) throw Tn(e.kind);
1934
1935
  let t = ge();
1935
1936
  if (t.abandon) {
1936
- t.clearProcessing && oo(v);
1937
+ t.clearProcessing && so(v);
1937
1938
  return;
1938
1939
  }
1939
1940
  }
1940
1941
  E(x, "cleared"), await Te();
1941
1942
  } catch (e) {
1942
- if (ys.current.invalidate(w.getState().sandboxesByMode[_]?.sandboxId ?? null), !ae()) {
1943
- oo(v);
1943
+ if (xs.current.invalidate(w.getState().sandboxesByMode[_]?.sandboxId ?? null), !ae()) {
1944
+ so(v);
1944
1945
  return;
1945
1946
  }
1946
1947
  let t = ve.session?.sandboxId ?? null, n = Gt(e, { confirmsNoAction: Kt({
1947
1948
  mode: _,
1948
1949
  capabilities: t ? w.getState().sandboxWriteCapabilities[t] : null
1949
1950
  }) });
1950
- cn(x, { outcome: n.kind === "temporary" ? "failed" : "refused" }), n.offersUpgrade && Ht(I, "sandbox");
1951
- let r = qt(n, P, { locale: B });
1952
- ao(v, "error", x, r.headline), ro(v, x, { content: r.text }), io(v, x, {
1953
- lang: r.translated ? B : "en",
1951
+ cn(x, { outcome: n.kind === "temporary" ? "failed" : "refused" }), n.offersUpgrade && Ht(L, "sandbox");
1952
+ let r = qt(n, P, { locale: V });
1953
+ oo(v, "error", x, r.headline), io(v, x, { content: r.text }), ao(v, x, {
1954
+ lang: r.translated ? V : "en",
1954
1955
  ...lr(i.voiceSessionId)
1955
1956
  });
1956
1957
  } finally {
1957
- we(), xs.current.delete(Ee), cn(x, { outcome: "stopped" }), E(x, "complete"), Se(), be();
1958
+ we(), Cs.current.delete(Ee), cn(x, { outcome: "stopped" }), E(x, "complete"), Se(), be();
1958
1959
  let e = w.getState(), t = de(ie, _, e.conversations.find((e) => e.id === Ee), (t) => !!e.sandboxesByMode[t]?.sandboxId);
1959
- t && (go(Ee, t.mode), t.backendSessionId && so(Ee, t.backendSessionId)), ve.session && ae() && K.afterTurn({
1960
+ t && (_o(Ee, t.mode), t.backendSessionId && co(Ee, t.backendSessionId)), ve.session && ae() && K.afterTurn({
1960
1961
  ...ve.session,
1961
1962
  conversationId: Ee
1962
1963
  }, x);
1963
- let n = Ls.current;
1964
- Ls.current = null, n && n.conversationId === Ee && ae() && Kc.current(n.content, n.attachments, n.options), De();
1964
+ let n = zs.current;
1965
+ zs.current = null, n && n.conversationId === Ee && ae() && Jc.current(n.content, n.attachments, n.options), De();
1965
1966
  }
1966
1967
  }, [
1967
- V,
1968
- U,
1969
- Ma,
1970
- co,
1971
- uo,
1972
- Xa,
1973
- to,
1974
- Os,
1968
+ H,
1969
+ W,
1970
+ Na,
1971
+ lo,
1972
+ fo,
1973
+ Za,
1974
+ no,
1975
+ As,
1975
1976
  K,
1976
- zs,
1977
- Fc,
1978
- Hc,
1979
- B,
1980
- Ka,
1981
- Ia,
1982
- ja,
1977
+ Vs,
1978
+ Lc,
1979
+ Wc,
1980
+ V,
1981
+ qa,
1983
1982
  La,
1983
+ Ma,
1984
1984
  Ra,
1985
- ro,
1986
- I,
1987
- zo,
1988
- Pa,
1989
- Ja,
1990
- B,
1985
+ za,
1986
+ io,
1987
+ L,
1988
+ Vo,
1989
+ Fa,
1991
1990
  Ya,
1992
- qa,
1993
- go,
1994
- Vc,
1995
- Ac,
1996
- ms,
1997
- _s,
1998
- so,
1999
- $a,
2000
- ao,
1991
+ V,
1992
+ Xa,
1993
+ Ja,
1994
+ _o,
1995
+ Uc,
1996
+ Mc,
1997
+ gs,
1998
+ ys,
1999
+ co,
2000
+ eo,
2001
2001
  oo,
2002
+ so,
2002
2003
  P,
2003
- Es,
2004
- no,
2005
- z,
2004
+ Os,
2005
+ ro,
2006
+ B,
2006
2007
  Z,
2007
- mc,
2008
- Pc,
2009
- wc,
2010
- Ys,
2011
- Js,
2008
+ gc,
2009
+ Ic,
2010
+ Ec,
2011
+ Zs,
2012
+ Xs,
2012
2013
  F
2013
- ]), Uc = D((e, t) => {
2014
+ ]), Gc = D((e, t) => {
2014
2015
  Q(e, [], t ? { autoIntent: t } : {});
2015
- }, [Q]), Wc = et(), Gc = D(() => {
2016
- let e = [..._o.chat].reverse().find((e) => e.role === "user" && !e.metadata?.localAction);
2016
+ }, [Q]), Kc = et(), qc = D(() => {
2017
+ let e = [...vo.chat].reverse().find((e) => e.role === "user" && !e.metadata?.localAction);
2017
2018
  if (!e || e.metadata?.approvalFollowUp) return;
2018
- let t = V ? vs.current[V] ?? [] : [], n = $i(e.metadata?.askAbout) ?? void 0, r = n ? { focus: n } : {};
2019
+ let t = H ? bs.current[H] ?? [] : [], n = ta(e.metadata?.askAbout) ?? void 0, r = n ? { focus: n } : {};
2019
2020
  if (t.some((e) => rt(e, Date.now()))) {
2020
- let n = V ?? void 0;
2021
- it(t, Wc).then((t) => {
2021
+ let n = H ?? void 0;
2022
+ it(t, Kc).then((t) => {
2022
2023
  Q(e.content, t, {
2023
2024
  ...n === void 0 ? {} : { targetConversationId: n },
2024
2025
  ...r
@@ -2026,143 +2027,143 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
2026
2027
  });
2027
2028
  } else Q(e.content, t, r);
2028
2029
  }, [
2029
- vo,
2030
+ yo,
2030
2031
  Q,
2031
- V,
2032
- Wc
2033
- ]), Kc = A(Q);
2032
+ H,
2033
+ Kc
2034
+ ]), Jc = A(Q);
2034
2035
  O(() => {
2035
- Kc.current = Q;
2036
+ Jc.current = Q;
2036
2037
  }, [Q]);
2037
- let qc = k(() => {
2038
- if (yo) return null;
2039
- for (let e = vo.length - 1; e >= 0; --e) {
2040
- let t = vo[e];
2038
+ let Yc = k(() => {
2039
+ if (xo) return null;
2040
+ for (let e = yo.length - 1; e >= 0; --e) {
2041
+ let t = yo[e];
2041
2042
  if (t?.role !== "assistant") continue;
2042
- if (t.id === nc) return null;
2043
- if (!cr(t) || Is.current.has(t.id) || jt(t.id)) continue;
2044
- let n = Qn(t, G, P);
2043
+ if (t.id === ic) return null;
2044
+ if (!cr(t) || Rs.current.has(t.id) || jt(t.id)) continue;
2045
+ let n = Qn(t, bo, P);
2045
2046
  if (n.kind !== "output") return null;
2046
2047
  let r = Xe(n.text).text.trim();
2047
- return r ? br(t, r, G) : null;
2048
+ return r ? Sr(t, r, bo) : null;
2048
2049
  }
2049
2050
  return null;
2050
2051
  }, [
2051
- vo,
2052
2052
  yo,
2053
- G,
2054
- nc,
2053
+ xo,
2054
+ bo,
2055
+ ic,
2055
2056
  P
2056
- ]), Jc = k(() => qc ? nr(qc.text) : null, [qc]), Yc = k(() => _o.chat.filter((e) => e.id !== nc), [_o.chat, nc]), Xc = k(() => Ea ? _o.all.filter((e) => e.id !== nc) : Yc, [
2057
- Ea,
2058
- _o.all,
2059
- nc,
2060
- Yc
2061
- ]), [Zc, Qc] = j(null), $c = w((e) => ot(e)?.sandboxId ?? null), el = Er(Yc, {
2062
- sessionId: W?.backendSessionId,
2063
- sandboxId: $c,
2057
+ ]), Xc = k(() => Yc ? nr(Yc.text) : null, [Yc]), Zc = k(() => vo.chat.filter((e) => e.id !== ic), [vo.chat, ic]), Qc = k(() => I ? vo.all.filter((e) => e.id !== ic) : Zc, [
2058
+ I,
2059
+ vo.all,
2060
+ ic,
2061
+ Zc
2062
+ ]), [$c, el] = j(null), tl = w((e) => ot(e)?.sandboxId ?? null), nl = Or(Zc, {
2063
+ sessionId: G?.backendSessionId,
2064
+ sandboxId: tl,
2064
2065
  nowMs: Date.now()
2065
- }), tl = Dr(Yc), nl = (e) => {
2066
+ }), rl = kr(Zc), il = (e) => {
2066
2067
  if (ae(e.metadata).length > 0) return !0;
2067
2068
  let t = e.metadata?.sandboxId;
2068
- return oe(t ? So[t] : null);
2069
- }, rl = (e) => {
2069
+ return oe(t ? wo[t] : null);
2070
+ }, al = (e) => {
2070
2071
  let t = ae(e.metadata);
2071
- return t.length === 0 || !V ? null : /* @__PURE__ */ M(d, {
2072
+ return t.length === 0 || !H ? null : /* @__PURE__ */ M(d, {
2072
2073
  refs: t,
2073
- conversationId: V,
2074
+ conversationId: H,
2074
2075
  panel: K,
2075
- entries: Co,
2076
- capabilitiesOf: (e) => So[e],
2077
- turnInFlight: yo,
2076
+ entries: To,
2077
+ capabilitiesOf: (e) => wo[e],
2078
+ turnInFlight: xo,
2078
2079
  tr: P,
2079
- onReview: To.review,
2080
- retiredSandboxes: wo,
2080
+ onReview: Do.review,
2081
+ retiredSandboxes: Eo,
2081
2082
  onReapply: () => void Q(P("writeProposal.reapplyPrompt", "That change wasn't saved because it changed after you read it. Fetch the latest version and reapply only your change on top of it."))
2082
2083
  });
2083
- }, il = (e) => {
2084
- if (!V) return null;
2084
+ }, ol = (e) => {
2085
+ if (!H) return null;
2085
2086
  let t = Z.liveOffersFor(e, {
2086
2087
  registry: {
2087
- destinations: Ir(Zs),
2088
- permissionsSettled: Qs,
2089
- simulating: $s
2088
+ destinations: Rr($s),
2089
+ permissionsSettled: ec,
2090
+ simulating: tc
2090
2091
  },
2091
- actorId: z,
2092
- conversationId: V,
2092
+ actorId: B,
2093
+ conversationId: H,
2093
2094
  perfNow: performance.now()
2094
2095
  }), n = t[0];
2095
- return n ? /* @__PURE__ */ M(Di, {
2096
+ return n ? /* @__PURE__ */ M(ki, {
2096
2097
  offers: t.map(({ offer: e, target: t }) => ({
2097
2098
  offerId: e.offerId,
2098
2099
  label: t.label,
2099
2100
  path: t.path
2100
2101
  })),
2101
- hint: t.length === 1 && R === "proposal-v1" ? Si(n.offer, Z.turnFor(e)) : "link",
2102
- onOpen: Cc
2102
+ hint: t.length === 1 && z === "proposal-v1" ? wi(n.offer, Z.turnFor(e)) : "link",
2103
+ onOpen: Tc
2103
2104
  }, n.offer.offerId) : null;
2104
- }, al = (e) => e.role === "assistant" ? il(e.id) : null;
2105
+ }, sl = (e) => e.role === "assistant" ? ol(e.id) : null;
2105
2106
  O(() => {
2106
2107
  let e = Z.nextExpiryInMs(performance.now());
2107
2108
  if (e === null) return;
2108
- let t = window.setTimeout(mc, e + 1);
2109
+ let t = window.setTimeout(gc, e + 1);
2109
2110
  return () => window.clearTimeout(t);
2110
2111
  }, [
2111
2112
  Z,
2112
- fc,
2113
- mc
2113
+ mc,
2114
+ gc
2114
2115
  ]);
2115
- let ol = To.dialog.view ? Co[To.dialog.view.proposalId] : void 0, sl = el?.expiresAtMs ?? null;
2116
+ let cl = Do.dialog.view ? To[Do.dialog.view.proposalId] : void 0, ll = nl?.expiresAtMs ?? null;
2116
2117
  O(() => {
2117
- if (sl === null) return;
2118
- let e = window.setTimeout(() => Fs((e) => e + 1), Math.max(0, sl - Date.now()));
2118
+ if (ll === null) return;
2119
+ let e = window.setTimeout(() => Ls((e) => e + 1), Math.max(0, ll - Date.now()));
2119
2120
  return () => window.clearTimeout(e);
2120
- }, [sl, Ps]);
2121
- let cl = k(() => _o.voice.filter((e) => e.id !== nc && (e.role === "user" || e.role === "assistant")).map((e) => ({
2121
+ }, [ll, Is]);
2122
+ let ul = k(() => vo.voice.filter((e) => e.id !== ic && (e.role === "user" || e.role === "assistant")).map((e) => ({
2122
2123
  id: e.id,
2123
2124
  role: e.role,
2124
- text: tr(e, G, P),
2125
+ text: tr(e, bo, P),
2125
2126
  sessionId: ur(e),
2126
2127
  timestamp: e.timestamp
2127
2128
  })).filter((e) => e.text.length > 0), [
2128
- _o.voice,
2129
- G,
2130
- nc,
2129
+ vo.voice,
2130
+ bo,
2131
+ ic,
2131
2132
  P
2132
- ]), ll = D(() => {
2133
- if (cl.length === 0) return;
2133
+ ]), dl = D(() => {
2134
+ if (ul.length === 0) return;
2134
2135
  let e = /* @__PURE__ */ new Date();
2135
- or(ir(cl, {
2136
+ or(ir(ul, {
2136
2137
  title: P("voiceSession.transcript", "Voice conversation"),
2137
2138
  savedAt: P("voiceSession.savedAt", "Saved"),
2138
2139
  session: P("voiceSession.sessionLabel", "Session"),
2139
2140
  earlier: P("voiceSession.earlierLabel", "Earlier"),
2140
2141
  you: P("voiceSession.speakerYou", "You"),
2141
2142
  assistant: P("voiceSession.speakerAssistant", "Assistant")
2142
- }, e), ar(I, e), "text/markdown");
2143
+ }, e), ar(L, e), "text/markdown");
2143
2144
  }, [
2144
- I,
2145
- cl,
2145
+ L,
2146
+ ul,
2146
2147
  P
2147
- ]), ul = $e({ perFileChars: $o }), dl = A(ul);
2148
- dl.current = ul;
2149
- let [fl, pl] = j(null), ml = fl === null ? null : P("attachments.voiceDropped", "{{count}} attachment(s) couldn't be saved and weren't sent.", { count: fl });
2148
+ ]), fl = $e({ perFileChars: ts }), pl = A(fl);
2149
+ pl.current = fl;
2150
+ let [ml, hl] = j(null), gl = ml === null ? null : P("attachments.voiceDropped", "{{count}} attachment(s) couldn't be saved and weren't sent.", { count: ml });
2150
2151
  O(() => {
2151
- if (fl === null) return;
2152
- let e = window.setTimeout(() => pl(null), ca);
2152
+ if (ml === null) return;
2153
+ let e = window.setTimeout(() => hl(null), ua);
2153
2154
  return () => window.clearTimeout(e);
2154
- }, [fl]);
2155
- let hl = A(/* @__PURE__ */ new Set()), gl = A(() => !1), _l = D((e, t, n, r) => {
2156
- let i = ls.current, a = vr(i), o = () => {
2155
+ }, [ml]);
2156
+ let _l = A(/* @__PURE__ */ new Set()), vl = A(() => !1), yl = D((e, t, n, r) => {
2157
+ let i = ds.current, a = br(i), o = () => {
2157
2158
  let e = w.getState();
2158
- return fr({
2159
- sessionLive: gl.current(t),
2159
+ return mr({
2160
+ sessionLive: vl.current(t),
2160
2161
  boundAtSubmit: i,
2161
2162
  activeConversationId: e.activeConversationId,
2162
2163
  boundConversationExists: e.conversations.some((e) => e.id === a)
2163
2164
  });
2164
2165
  }, s = () => {
2165
- let i = dl.current;
2166
+ let i = pl.current;
2166
2167
  nt({
2167
2168
  draft: i,
2168
2169
  maySend: o,
@@ -2172,18 +2173,18 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
2172
2173
  ...n,
2173
2174
  handedOver: dn()
2174
2175
  };
2175
- Kc.current(e, i, {
2176
+ Jc.current(e, i, {
2176
2177
  fromPerson: !0,
2177
2178
  voiceSessionId: t,
2178
2179
  voiceTiming: a,
2179
2180
  ...r.correction ? { correctsInFlightTurn: !0 } : {}
2180
2181
  });
2181
2182
  },
2182
- announceDropped: (e) => pl(e)
2183
+ announceDropped: (e) => hl(e)
2183
2184
  });
2184
2185
  };
2185
- if (o() && Nc.current(e, t)) {
2186
- Kc.current(e, [], {
2186
+ if (o() && Fc.current(e, t)) {
2187
+ Jc.current(e, [], {
2187
2188
  fromPerson: !0,
2188
2189
  voiceSessionId: t,
2189
2190
  voiceTiming: {
@@ -2193,469 +2194,547 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
2193
2194
  });
2194
2195
  return;
2195
2196
  }
2196
- if (!dl.current.isBusy) {
2197
+ if (!pl.current.isBusy) {
2197
2198
  s();
2198
2199
  return;
2199
2200
  }
2200
- let c = Date.now(), l = hl.current, u = window.setInterval(() => {
2201
- let e = dl.current.isBusy;
2202
- dl.current.isCommitting || e && Date.now() - c < sa || (window.clearInterval(u), l.delete(u), s());
2201
+ let c = Date.now(), l = _l.current, u = window.setInterval(() => {
2202
+ let e = pl.current.isBusy;
2203
+ pl.current.isCommitting || e && Date.now() - c < la || (window.clearInterval(u), l.delete(u), s());
2203
2204
  }, 200);
2204
2205
  l.add(u);
2205
- }, []), $ = Ze({
2206
- onSubmit: _l,
2207
- latestReply: qc,
2208
- language: o(Wa, B).tag,
2209
- graceMs: Ba,
2210
- onSupersede: Bs,
2211
- handsFreeStreamNoticeAccepted: Ha,
2212
- onAcceptHandsFreeStreamNotice: Ua,
2213
- handsFreeInterrupt: Va,
2214
- onBargeIn: zs
2206
+ }, []), bl = A(() => void 0), $ = Ze({
2207
+ onSubmit: yl,
2208
+ latestReply: Yc,
2209
+ language: o(Ga, V).tag,
2210
+ graceMs: Va,
2211
+ onSupersede: Hs,
2212
+ handsFreeStreamNoticeAccepted: Ua,
2213
+ onAcceptHandsFreeStreamNotice: Wa,
2214
+ handsFreeInterrupt: Ha,
2215
+ onBargeIn: () => {
2216
+ bl.current(), Vs();
2217
+ }
2215
2218
  });
2216
- gl.current = $.isCurrentSession;
2217
- let vl = us ? cl.filter((e) => e.sessionId !== void 0 && $.isCurrentSession(e.sessionId)) : cl, yl = $.answerLocally;
2219
+ vl.current = $.isCurrentSession;
2220
+ let xl = fs ? ul.filter((e) => e.sessionId !== void 0 && $.isCurrentSession(e.sessionId)) : ul, Sl = $.answerLocally;
2218
2221
  O(() => {
2219
- Ic.current = yl;
2220
- }, [yl]);
2221
- let bl = $.active, xl = k(() => v(Object.values(Co), V, wo), [
2222
- Co,
2223
- V,
2224
- wo
2225
- ]), [Sl, Cl] = j(null);
2222
+ Rc.current = Sl;
2223
+ }, [Sl]);
2224
+ let Cl = $.active, wl = k(() => v(Object.values(To), H, Eo), [
2225
+ To,
2226
+ H,
2227
+ Eo
2228
+ ]), [Tl, El] = j(null);
2226
2229
  O(() => {
2227
- bl || Cl(null);
2228
- }, [bl]);
2229
- let wl = To.review, Tl = D(() => {
2230
- let e = xl[xl.length - 1];
2230
+ Cl || El(null);
2231
+ }, [Cl]);
2232
+ let Dl = Do.review, Ol = D(() => {
2233
+ let e = wl[wl.length - 1];
2231
2234
  if (!e) return;
2232
2235
  let { view: t } = e;
2233
- f(t) && m(t, So[e.session.sandboxId]).offerConfirm ? wl(t) : Cl(t.proposalId);
2236
+ f(t) && m(t, wo[e.session.sandboxId]).offerConfirm ? Dl(t) : El(t.proposalId);
2234
2237
  }, [
2235
- xl,
2236
- So,
2237
- wl
2238
- ]), El = bl ? _(xl) : null, Dl = Sl ? Co[Sl] : void 0, Ol = bl && Dl && Dl.session.conversationId === V ? {
2238
+ wl,
2239
+ wo,
2240
+ Dl
2241
+ ]), kl = Cl ? _(wl) : null, Al = Tl ? To[Tl] : void 0, jl = Cl && Al && Al.session.conversationId === H ? {
2239
2242
  content: /* @__PURE__ */ M(d, {
2240
2243
  refs: [{
2241
- proposalId: Dl.view.proposalId,
2242
- sandboxId: Dl.session.sandboxId,
2243
- sessionId: Dl.session.sessionId
2244
+ proposalId: Al.view.proposalId,
2245
+ sandboxId: Al.session.sandboxId,
2246
+ sessionId: Al.session.sessionId
2244
2247
  }],
2245
- conversationId: Dl.session.conversationId,
2248
+ conversationId: Al.session.conversationId,
2246
2249
  panel: K,
2247
- entries: Co,
2248
- capabilitiesOf: (e) => So[e],
2249
- turnInFlight: yo,
2250
+ entries: To,
2251
+ capabilitiesOf: (e) => wo[e],
2252
+ turnInFlight: xo,
2250
2253
  tr: P,
2251
- onReview: wl,
2252
- retiredSandboxes: wo
2254
+ onReview: Dl,
2255
+ retiredSandboxes: Eo
2253
2256
  }),
2254
2257
  closeLabel: re(P, h.trayClose),
2255
- onClose: () => Cl(null)
2256
- } : null, kl = To.asking, Al = Ec?.asking === !0, jl = Dc?.asking === !0, Ml = ci(), Nl = $.holdListening, Pl = k(() => bl || J ? null : { run: () => is ? { status: "already" } : (cs(!0), { status: "done" }) }, [
2257
- bl,
2258
+ onClose: () => El(null)
2259
+ } : null, Ml = Do.asking, Nl = Oc?.asking === !0, Pl = kc?.asking === !0, Fl = ui(), Il = $.holdListening, Ll = k(() => Cl || J ? null : { run: () => os ? { status: "already" } : (us(!0), { status: "done" }) }, [
2260
+ Cl,
2258
2261
  J,
2259
- is,
2260
- cs
2262
+ os,
2263
+ us
2261
2264
  ]);
2262
- oi("assistant.transcript", Pl);
2263
- let Fl = k(() => bl ? null : { run: () => {
2265
+ ci("assistant.transcript", Ll);
2266
+ let Rl = k(() => Cl ? null : { run: () => {
2264
2267
  let e = w.getState(), t = e.conversations.find((t) => t.id === e.activeConversationId);
2265
2268
  return t && t.messages.length === 0 ? { status: "already" } : (e.createConversation(), { status: "done" });
2266
- } }, [bl]);
2267
- oi("assistant.conversation.new", Fl), O(() => {
2268
- Nl(bl && (kl || Al || jl || Ml));
2269
+ } }, [Cl]);
2270
+ ci("assistant.conversation.new", Rl), O(() => {
2271
+ Il(Cl && (Ml || Nl || Pl || Fl));
2269
2272
  }, [
2270
- bl,
2271
- kl,
2272
- Al,
2273
- jl,
2273
+ Cl,
2274
2274
  Ml,
2275
- Nl
2275
+ Nl,
2276
+ Pl,
2277
+ Fl,
2278
+ Il
2276
2279
  ]);
2277
- let Il = A(null), Ll = $.announce;
2280
+ let zl = A(null), Bl = $.announce;
2278
2281
  O(() => {
2279
- if (!bl) {
2280
- Il.current = null;
2282
+ if (!Cl) {
2283
+ zl.current = null;
2281
2284
  return;
2282
2285
  }
2283
- let e = Il.current;
2284
- if (e === null) Il.current = new Set(Object.keys(Co));
2285
- else for (let { view: t, session: n } of ne(xl, e)) {
2286
+ let e = zl.current;
2287
+ if (e === null) zl.current = new Set(Object.keys(To));
2288
+ else for (let { view: t, session: n } of ne(wl, e)) {
2286
2289
  e.add(t.proposalId);
2287
- let r = So[n.sandboxId];
2290
+ let r = wo[n.sandboxId];
2288
2291
  if (!g({
2289
2292
  mode: "api-calls",
2290
- productWriteApproval: R,
2293
+ productWriteApproval: z,
2291
2294
  capabilities: r
2292
2295
  })) continue;
2293
2296
  let i = ie(t, m(t, r).offerConfirm, P), a = t.proposalId;
2294
- Ll({
2297
+ Bl({
2295
2298
  id: `write-readback:${a}`,
2296
2299
  text: i.text,
2297
- lang: i.translated ? B : "en",
2300
+ lang: i.translated ? V : "en",
2298
2301
  stillWanted: () => K.entry(a)?.view.status === "pending"
2299
2302
  });
2300
2303
  }
2301
2304
  }, [
2302
- bl,
2303
- xl,
2304
- Co,
2305
- So,
2306
- R,
2305
+ Cl,
2306
+ wl,
2307
+ To,
2308
+ wo,
2309
+ z,
2307
2310
  P,
2308
- B,
2309
- Ll,
2311
+ V,
2312
+ Bl,
2310
2313
  K
2311
2314
  ]);
2312
- let Rl = A(!1);
2315
+ let Vl = A(!1);
2313
2316
  O(() => {
2314
- Rl.current = $.active;
2315
- }, [$.active]), O(() => Gi((e) => {
2316
- if (!Rl.current) return !1;
2317
- let t = ls.current;
2317
+ Vl.current = $.active;
2318
+ }, [$.active]), O(() => qi((e) => {
2319
+ if (!Vl.current) return !1;
2320
+ let t = ds.current;
2318
2321
  return typeof t == "string" ? t === e : w.getState().activeConversationId === e;
2319
2322
  }), []);
2320
- let zl = $.start, Bl = D(() => {
2321
- let e = w.getState().activeConversationId, t = hr(_s());
2322
- ms(_r(t, e)), ks(!0, t.kind === "own"), zl();
2323
+ let Hl = $.start, Ul = D(() => {
2324
+ let e = w.getState().activeConversationId, t = _r(ys());
2325
+ gs(yr(t, e)), js(!0, t.kind === "own"), Hl();
2323
2326
  }, [
2324
- ms,
2325
- ks,
2326
- _s,
2327
- zl
2328
- ]), Vl = k(() => er(W?.messages ?? []), [W?.messages]), Hl = $n(_o.voice, G, P), Ul = $n(Vl, G, P) > 0, Wl = D(() => {
2327
+ gs,
2328
+ js,
2329
+ ys,
2330
+ Hl
2331
+ ]), Wl = k(() => er(G?.messages ?? []), [G?.messages]), Gl = $n(vo.voice, bo, P), Kl = $n(Wl, bo, P) > 0, ql = D(() => {
2329
2332
  let e = w.getState().activeConversationId;
2330
- if (!e || cl.length === 0) return;
2331
- let t = new Set(Vl.map((e) => e.id)), n = N();
2332
- U(e, {
2333
+ if (!e || ul.length === 0) return;
2334
+ let t = new Set(Wl.map((e) => e.id)), n = N();
2335
+ W(e, {
2333
2336
  id: n,
2334
2337
  role: "system",
2335
- content: rr(cl.filter((e) => t.has(e.id)), {
2338
+ content: rr(ul.filter((e) => t.has(e.id)), {
2336
2339
  intro: P("voiceSession.continuedIntro", "Continued from a voice conversation. You asked about:"),
2337
2340
  nothing: P("voiceSession.continuedNothing", "Continued from a voice conversation."),
2338
2341
  more: (e) => P("voiceSession.continuedMore", "…and {{count}} more", { count: e })
2339
2342
  }),
2340
2343
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
2341
- metadata: { continuedVoiceTurns: Hl }
2342
- }), Ii.recordCommittedEntries(e, [n], "NOTE", T()), cs(!1), $.end(), os(), wa?.();
2344
+ metadata: { continuedVoiceTurns: Gl }
2345
+ }), Ri.recordCommittedEntries(e, [n], "NOTE", T()), us(!1), $.end(), cs(), Ea?.();
2343
2346
  }, [
2344
- cl,
2345
- Hl,
2346
- Vl,
2347
- U,
2347
+ ul,
2348
+ Gl,
2349
+ Wl,
2350
+ W,
2348
2351
  P,
2349
2352
  $,
2353
+ us,
2350
2354
  cs,
2351
- os,
2352
- wa
2353
- ]), Gl = A({
2355
+ Ea
2356
+ ]), Jl = A({
2354
2357
  conversationId: null,
2355
2358
  count: 0
2356
2359
  });
2357
2360
  O(() => {
2358
- $.active && (Gl.current = {
2359
- conversationId: V,
2360
- count: Hl
2361
+ $.active && (Jl.current = {
2362
+ conversationId: H,
2363
+ count: Gl
2361
2364
  });
2362
2365
  }, [$.active]);
2363
- let Kl = D(() => {
2364
- let e = Gl.current, t = e.conversationId === V ? e.count : 0, n = Hl > t;
2365
- $.end(), n && cs(!0);
2366
+ let [Yl, Xl] = j({}), [Zl, Ql] = j({}), $l = A(null), eu = $.active;
2367
+ O(() => {
2368
+ if (!I) return;
2369
+ if (eu) {
2370
+ $l.current ??= {
2371
+ startedAt: Date.now(),
2372
+ sessionId: null
2373
+ };
2374
+ return;
2375
+ }
2376
+ let e = $l.current;
2377
+ $l.current = null;
2378
+ let t = e?.sessionId;
2379
+ if (e && t) {
2380
+ let n = Math.max(1, Math.round((Date.now() - e.startedAt) / 1e3));
2381
+ Ql((e) => ({
2382
+ ...e,
2383
+ [t]: n
2384
+ }));
2385
+ }
2386
+ }, [I, eu]);
2387
+ let tu = $.isCurrentSession;
2388
+ O(() => {
2389
+ let e = $l.current;
2390
+ if (!I || !e || e.sessionId) return;
2391
+ let t = ul.find((e) => e.sessionId !== void 0 && tu(e.sessionId));
2392
+ t?.sessionId && (e.sessionId = t.sessionId);
2366
2393
  }, [
2367
- V,
2368
- Hl,
2394
+ I,
2395
+ ul,
2396
+ tu
2397
+ ]);
2398
+ let nu = $.session.phase, ru = Qc[Qc.length - 1], iu = I && $.active && (nu === "thinking" || nu === "speaking") && ru?.role === "assistant" && cr(ru) ? ru.id : null, au = $.spokenChunks, ou = iu !== null && Ks === iu && au ? au.chunks.slice(0, au.index + 1).join(" ") : null, [su, cu] = j({});
2399
+ iu !== null && ou !== null && ou.length > (su[iu]?.length ?? 0) && cu({
2400
+ ...su,
2401
+ [iu]: ou
2402
+ });
2403
+ let lu = iu === null ? null : su[iu] ?? "", uu = D(() => {
2404
+ if (iu === null || lu === null || !H) return;
2405
+ let e = w.getState();
2406
+ if (lu === "") {
2407
+ e.mergeMessageMetadata(H, iu, { voiceNotSpoken: !0 });
2408
+ return;
2409
+ }
2410
+ if (Ks !== iu) return;
2411
+ let t = lu;
2412
+ Xl((e) => ({
2413
+ ...e,
2414
+ [iu]: t
2415
+ })), e.mergeMessageMetadata(H, iu, {
2416
+ voiceInterrupted: !0,
2417
+ voiceSpokenText: t
2418
+ });
2419
+ }, [
2420
+ iu,
2421
+ lu,
2422
+ H,
2423
+ Ks
2424
+ ]);
2425
+ O(() => {
2426
+ bl.current = uu;
2427
+ }, [uu]);
2428
+ let du = (e, t, n) => {
2429
+ if (!cr(e)) return;
2430
+ let r = ur(e), i = n[t + 1], a = $.active && r !== void 0 && tu(r), o = (!i || !cr(i) || ur(i) !== r) && !a ? /* @__PURE__ */ M(dr, { seconds: r ? Zl[r] : void 0 }) : null;
2431
+ if (e.role === "user") return { below: /* @__PURE__ */ oa(aa, { children: [/* @__PURE__ */ M(fr, { mark: "spoken" }), o] }) };
2432
+ if (e.role !== "assistant") return o ? { below: o } : void 0;
2433
+ let s = Yl[e.id] ?? (e.metadata?.voiceInterrupted ? e.metadata.voiceSpokenText : void 0);
2434
+ if (s !== void 0) return {
2435
+ content: s,
2436
+ below: /* @__PURE__ */ oa(aa, { children: [/* @__PURE__ */ M(fr, { mark: "interrupted" }), o] })
2437
+ };
2438
+ if (e.id === iu && lu !== null) return { content: lu };
2439
+ let c = a || r !== void 0 && Zl[r] !== void 0;
2440
+ return e.content.trim() !== "" && (c ? su[e.id] !== void 0 : !e.metadata?.voiceNotSpoken) ? { below: /* @__PURE__ */ oa(aa, { children: [/* @__PURE__ */ M(fr, { mark: "spokenAloud" }), o] }) } : o ? { below: o } : void 0;
2441
+ }, fu = D(() => {
2442
+ let e = Jl.current, t = e.conversationId === H ? e.count : 0, n = Gl > t;
2443
+ $.end(), n && us(!0), uu();
2444
+ }, [
2445
+ H,
2446
+ Gl,
2369
2447
  $,
2370
- cs
2448
+ us,
2449
+ uu
2371
2450
  ]);
2372
2451
  O(() => {
2373
- ga && Ts || !$.active || $.end();
2452
+ va && Ds || !$.active || $.end();
2374
2453
  }, [
2375
- ga,
2376
- Ts,
2454
+ va,
2455
+ Ds,
2377
2456
  $
2378
2457
  ]);
2379
- let [ql, Jl] = j(da), Yl = Ge({
2458
+ let [pu, mu] = j(pa), hu = Ge({
2380
2459
  available: $.available,
2381
- allowedInMode: Ts,
2382
- readOnly: Oo,
2383
- busy: yo || Ns !== null || Ao || cc,
2384
- committing: ql.committing,
2385
- dictating: ql.dictating
2386
- }), Xl = We();
2387
- ta(() => {
2388
- Sa?.({ live: $.active });
2389
- }, [Sa, $.active]);
2390
- let Zl = A(!1), Ql = D(() => {
2391
- Zl.current = !0, Ca?.({ review: !0 });
2392
- }, [Ca]);
2460
+ allowedInMode: Ds,
2461
+ readOnly: Ao,
2462
+ busy: xo || Fs !== null || Mo || uc,
2463
+ committing: pu.committing,
2464
+ dictating: pu.dictating
2465
+ }), gu = We();
2466
+ ra(() => {
2467
+ wa?.({ live: $.active });
2468
+ }, [wa, $.active]);
2469
+ let _u = A(!1), vu = D(() => {
2470
+ _u.current = !0, Ta?.({ review: !0 });
2471
+ }, [Ta]);
2393
2472
  O(() => {
2394
- !Aa && Zl.current && (Zl.current = !1, ke(Vu.current));
2395
- }, [Aa]);
2396
- let $l = $.active;
2473
+ !ja && _u.current && (_u.current = !1, ke(sd.current));
2474
+ }, [ja]);
2475
+ let yu = $.active;
2397
2476
  O(() => {
2398
- if (!$l) gs.current = !1, hs.current = null;
2399
- else if (us) {
2400
- let e = ls.current;
2401
- dr(e) && (hs.current = e.openAtStart), gs.current = !0;
2402
- } else gs.current && (gs.current = !1, F && De({
2477
+ if (!yu) vs.current = !1, _s.current = null;
2478
+ else if (fs) {
2479
+ let e = ds.current;
2480
+ pr(e) && (_s.current = e.openAtStart), vs.current = !0;
2481
+ } else vs.current && (vs.current = !1, F && De({
2403
2482
  pending: "own",
2404
- openAtStart: hs.current
2405
- }, ls.current) && ps(!0));
2483
+ openAtStart: _s.current
2484
+ }, ds.current) && hs(!0));
2406
2485
  }, [
2407
- us,
2408
- $l,
2486
+ fs,
2487
+ yu,
2409
2488
  F
2410
- ]), fs && !$.active && ps(!1);
2411
- let [eu, tu] = j(null);
2489
+ ]), ms && !$.active && hs(!1);
2490
+ let [bu, xu] = j(null);
2412
2491
  O(() => {
2413
- eu !== null && (J && eu.conversationId === V || tu(null));
2492
+ bu !== null && (J && bu.conversationId === H || xu(null));
2414
2493
  }, [
2415
2494
  J,
2416
- V,
2417
- eu
2495
+ H,
2496
+ bu
2418
2497
  ]);
2419
- let nu = eu !== null && Ws === eu.replyId, ru = A(!1), iu = D(() => {
2420
- ru.current = !0, nu && Gs(), Bl();
2498
+ let Su = bu !== null && Ks === bu.replyId, Cu = A(!1), wu = D(() => {
2499
+ Cu.current = !0, Su && qs(), Ul();
2421
2500
  }, [
2422
- Bl,
2423
- nu,
2424
- Gs
2425
- ]), au = D(() => {
2426
- nu && Gs(), Bl();
2501
+ Ul,
2502
+ Su,
2503
+ qs
2504
+ ]), Tu = D(() => {
2505
+ Su && qs(), Ul();
2427
2506
  }, [
2428
- Bl,
2429
- nu,
2430
- Gs
2507
+ Ul,
2508
+ Su,
2509
+ qs
2431
2510
  ]);
2432
2511
  O(() => {
2433
- $.active || (ru.current = !1);
2512
+ $.active || (Cu.current = !1);
2434
2513
  }, [$.active]), O(() => {
2435
- !J && ru.current && (ru.current = !1, $.active && Kl());
2514
+ !J && Cu.current && (Cu.current = !1, $.active && fu());
2436
2515
  }, [
2437
2516
  J,
2438
2517
  $.active,
2439
- Kl
2518
+ fu
2440
2519
  ]), O(() => {
2441
- J && cs(!1);
2442
- }, [J, cs]);
2443
- let ou = k(() => ({
2520
+ J && us(!1);
2521
+ }, [J, us]);
2522
+ let Eu = k(() => ({
2444
2523
  live: $.active,
2445
- blocked: Yl === null ? null : Xl.voiceStartBlocked(Yl),
2446
- impossible: Ke(Yl),
2447
- start: F ? au : iu
2524
+ blocked: hu === null ? null : gu.voiceStartBlocked(hu),
2525
+ impossible: Ke(hu),
2526
+ start: F ? Tu : wu
2448
2527
  }), [
2449
2528
  $.active,
2450
- Yl,
2451
- Xl,
2529
+ hu,
2530
+ gu,
2452
2531
  F,
2453
- au,
2454
- iu
2455
- ]), [su, cu] = j("mini"), [lu, uu] = j(!1), du = Aa && $.active && (lu || J);
2456
- du !== lu && uu(du);
2457
- let fu = F && !Ea && $.active && !J && (!Aa || lu), pu = ga && q.covered !== !0 && !($.active && su !== "mini") && !(is && !$.active) && !(kl || Al || jl || Ml), mu = as?.ask, hu = na(mu?.subscribe ?? pa, mu?.getSnapshot ?? ma, mu?.getSnapshot ?? ma), gu = C({
2532
+ Tu,
2533
+ wu
2534
+ ]), [Du, Ou] = j("mini"), [ku, Au] = j(!1), ju = ja && $.active && (ku || J);
2535
+ ju !== ku && Au(ju);
2536
+ let Mu = F && !I && $.active && !J && (!ja || ku), Nu = va && q.covered !== !0 && !($.active && Du !== "mini") && !(os && !$.active) && !(Ml || Nl || Pl || Fl), Pu = ss?.ask, Fu = ia(Pu?.subscribe ?? ha, Pu?.getSnapshot ?? ga, Pu?.getSnapshot ?? ga), Iu = C({
2458
2537
  voiceLive: $.active,
2459
- readOnly: Oo,
2538
+ readOnly: Ao,
2460
2539
  writes: qe({
2461
- auto: qo,
2462
- selectedMode: H,
2463
- conversation: W && !Oo ? {
2464
- mode: W.mode,
2465
- routedBy: W.routedBy,
2466
- hasHistory: Li(W)
2540
+ auto: Yo,
2541
+ selectedMode: U,
2542
+ conversation: G && !Ao ? {
2543
+ mode: G.mode,
2544
+ routedBy: G.routedBy,
2545
+ hasHistory: zi(G)
2467
2546
  } : null,
2468
- modeWrites: (e) => L.find((t) => t.id === e)?.writeCapable === !0 || gt(e)
2547
+ modeWrites: (e) => R.find((t) => t.id === e)?.writeCapable === !0 || gt(e)
2469
2548
  }),
2470
- avatar: hu,
2471
- busy: yo || Ns !== null || Ao || cc || es !== null || Zo,
2472
- committing: ql.committing
2473
- }), _u = A(gu);
2474
- ta(() => {
2475
- _u.current = gu;
2476
- }, [gu]);
2477
- let vu = D((e) => {
2549
+ avatar: Fu,
2550
+ busy: xo || Fs !== null || Mo || uc || ns !== null || $o,
2551
+ committing: pu.committing
2552
+ }), Lu = A(Iu);
2553
+ ra(() => {
2554
+ Lu.current = Iu;
2555
+ }, [Iu]);
2556
+ let Ru = D((e) => {
2478
2557
  let t = e.trim();
2479
- if (t === "" || _u.current !== null) return { accepted: !1 };
2480
- nu && Gs();
2558
+ if (t === "" || Lu.current !== null) return { accepted: !1 };
2559
+ Su && qs();
2481
2560
  let n = {
2482
2561
  token: N(),
2483
2562
  exchange: null,
2484
2563
  handled: !1
2485
2564
  };
2486
- Ks.current = n;
2565
+ Js.current = n;
2487
2566
  try {
2488
2567
  Q(t, [], {
2489
2568
  fromPerson: !0,
2490
2569
  avatarTabAsk: n.token,
2491
2570
  localRecordsChecked: !0,
2492
- ...qo ? { autoIntent: "read" } : {}
2571
+ ...Yo ? { autoIntent: "read" } : {}
2493
2572
  });
2494
2573
  } finally {
2495
- Ks.current = null;
2574
+ Js.current = null;
2496
2575
  }
2497
2576
  let r = n.exchange;
2498
2577
  return r === null ? n.handled ? {
2499
2578
  accepted: !0,
2500
2579
  recorded: !1
2501
- } : { accepted: !1 } : (tu(r), {
2580
+ } : { accepted: !1 } : (xu(r), {
2502
2581
  accepted: !0,
2503
2582
  recorded: !0,
2504
2583
  ...r
2505
2584
  });
2506
2585
  }, [
2507
- qo,
2586
+ Yo,
2508
2587
  Q,
2509
- Gs,
2510
- nu
2511
- ]), [yu] = j(() => Ye()), bu = k(() => ({
2512
- blocker: gu,
2513
- line: Je(gu, Yl),
2514
- send: vu,
2515
- last: eu,
2516
- navigatingReplyId: uc,
2517
- draft: yu
2588
+ qs,
2589
+ Su
2590
+ ]), [zu] = j(() => Ye()), Bu = k(() => ({
2591
+ blocker: Iu,
2592
+ line: Je(Iu, hu),
2593
+ send: Ru,
2594
+ last: bu,
2595
+ navigatingReplyId: fc,
2596
+ draft: zu
2518
2597
  }), [
2519
- gu,
2520
- Yl,
2521
- vu,
2522
- eu,
2523
- uc,
2524
- yu
2525
- ]), xu = q.setReplyEscape, Su = J && pu && nu;
2598
+ Iu,
2599
+ hu,
2600
+ Ru,
2601
+ bu,
2602
+ fc,
2603
+ zu
2604
+ ]), Vu = q.setReplyEscape, Hu = J && Nu && Su;
2526
2605
  O(() => {
2527
- if (xu && Su) return xu(Gs), () => xu(null);
2606
+ if (Vu && Hu) return Vu(qs), () => Vu(null);
2528
2607
  }, [
2529
- xu,
2530
- Su,
2531
- Gs
2608
+ Vu,
2609
+ Hu,
2610
+ qs
2532
2611
  ]), O(() => {
2533
- let e = ls.current, t = vr(e), n = w.getState(), r = mr({
2612
+ let e = ds.current, t = br(e), n = w.getState(), r = gr({
2534
2613
  sessionLive: $.active,
2535
2614
  bound: e,
2536
2615
  activeConversationId: n.activeConversationId,
2537
2616
  boundConversationExists: n.conversations.some((e) => e.id === t)
2538
2617
  });
2539
- ms(r.bound), r.end && $.end();
2618
+ gs(r.bound), r.end && $.end();
2540
2619
  }, [
2541
2620
  $,
2542
- V,
2543
- Xa,
2544
- ms
2621
+ H,
2622
+ Za,
2623
+ gs
2545
2624
  ]), O(() => {
2546
- let e = pr(yr.read(), {
2547
- activeConversationId: V,
2548
- chatTurnCount: Yc.length,
2549
- voiceTurnCount: cl.length,
2625
+ let e = hr(xr.read(), {
2626
+ activeConversationId: H,
2627
+ chatTurnCount: Zc.length,
2628
+ voiceTurnCount: ul.length,
2550
2629
  sessionLive: $.active,
2551
- sessionBoundTo: ls.current,
2552
- turnInFlight: yo
2630
+ sessionBoundTo: ds.current,
2631
+ turnInFlight: xo
2553
2632
  });
2554
- yr.write(e.state), e.open && cs(!0);
2633
+ xr.write(e.state), e.open && us(!0);
2555
2634
  }, [
2556
- V,
2557
- Yc.length,
2558
- cl.length,
2635
+ H,
2636
+ Zc.length,
2637
+ ul.length,
2559
2638
  $.active,
2560
- yo,
2561
- cs
2639
+ xo,
2640
+ us
2562
2641
  ]), O(() => {
2563
2642
  if (!$.active) {
2564
- dl.current.clear(), pl(null), Ls.current = null;
2565
- for (let e of hl.current) window.clearInterval(e);
2566
- hl.current.clear();
2643
+ pl.current.clear(), hl(null), zs.current = null;
2644
+ for (let e of _l.current) window.clearInterval(e);
2645
+ _l.current.clear();
2567
2646
  }
2568
2647
  }, [$.active]), O(() => {
2569
- let e = hl.current;
2648
+ let e = _l.current;
2570
2649
  return () => {
2571
2650
  for (let t of e) window.clearInterval(t);
2572
2651
  e.clear();
2573
2652
  };
2574
2653
  }, []), O(() => {
2575
2654
  let e = w.getState().consumePendingPrompt();
2576
- return e && Kc.current(e), w.subscribe((e, t) => {
2655
+ return e && Jc.current(e), w.subscribe((e, t) => {
2577
2656
  if (e.pendingPrompt && e.pendingPrompt !== t.pendingPrompt) {
2578
2657
  let e = w.getState().consumePendingPrompt();
2579
- e && Kc.current(e);
2658
+ e && Jc.current(e);
2580
2659
  }
2581
2660
  });
2582
2661
  }, []);
2583
- let Cu = D((e) => {
2584
- let t = V ? w.getState().conversations.find((e) => e.id === V) : void 0;
2585
- if (t && t.mode !== e && K.withdraw(t.id, "mode_switched"), t && Li(t)) {
2662
+ let Uu = D((e) => {
2663
+ let t = H ? w.getState().conversations.find((e) => e.id === H) : void 0;
2664
+ if (t && t.mode !== e && K.withdraw(t.id, "mode_switched"), t && zi(t)) {
2586
2665
  if (t.mode !== e) {
2587
- let t = Wi(), n = w.getState().conversations.find((n) => n.mode === e && Bi(n, t) && !w.getState().processingByConversationId[n.id]);
2588
- n ? eo(n.id) : to(void 0, e);
2666
+ let t = Ki(), n = w.getState().conversations.find((n) => n.mode === e && Hi(n, t) && !w.getState().processingByConversationId[n.id]);
2667
+ n ? to(n.id) : no(void 0, e);
2589
2668
  }
2590
- } else V && $a(V, e);
2669
+ } else H && eo(H, e);
2591
2670
  let n = w.getState().activeConversationId;
2592
- n ? $a(n, e) : ho(!1), Qa(e);
2671
+ n ? eo(n, e) : go(!1), $a(e);
2593
2672
  }, [
2594
- V,
2673
+ H,
2674
+ no,
2595
2675
  to,
2676
+ go,
2596
2677
  eo,
2597
- ho,
2598
2678
  $a,
2599
- Qa,
2600
2679
  K
2601
- ]), wu = D(() => {
2680
+ ]), Wu = D(() => {
2602
2681
  let e = w.getState(), t = e.activeConversationId ? e.conversations.find((t) => t.id === e.activeConversationId) : void 0;
2603
2682
  if (!t) {
2604
- ho(!0), Qa(b);
2683
+ go(!0), $a(b);
2605
2684
  return;
2606
2685
  }
2607
2686
  if (t.routedBy === "auto") {
2608
- ho(!0);
2687
+ go(!0);
2609
2688
  return;
2610
2689
  }
2611
- if (!Li(t)) {
2612
- go(t.id, b);
2690
+ if (!zi(t)) {
2691
+ _o(t.id, b);
2613
2692
  return;
2614
2693
  }
2615
2694
  K.withdraw(t.id, "mode_switched");
2616
- let n = Wi(), r = e.conversations.find((t) => t.routedBy === "auto" && Bi(t, n) && !e.processingByConversationId[t.id]);
2617
- r ? (eo(r.id), go(r.id, b)) : to(void 0, b, { routedBy: "auto" });
2695
+ let n = Ki(), r = e.conversations.find((t) => t.routedBy === "auto" && Hi(t, n) && !e.processingByConversationId[t.id]);
2696
+ r ? (to(r.id), _o(r.id, b)) : no(void 0, b, { routedBy: "auto" });
2618
2697
  }, [
2698
+ no,
2699
+ _o,
2619
2700
  to,
2620
2701
  go,
2621
- eo,
2622
- ho,
2623
- Qa,
2702
+ $a,
2624
2703
  K
2625
- ]), Tu = D((e) => {
2626
- L.find((t) => t.id === e)?.writeCapable && !Jn(w.getState().acknowledgedWriteModes, e) ? ts(e) : Cu(e);
2627
- }, [Cu, L]), Eu = D(() => {
2628
- let e = es;
2629
- if (ts(null), !e) return;
2630
- let t = Yo.current;
2631
- Yo.current = null, t ? (po(e), Q(t.content, t.attachments, t.options)) : (po(e), Cu(e));
2704
+ ]), Gu = D((e) => {
2705
+ R.find((t) => t.id === e)?.writeCapable && !Jn(w.getState().acknowledgedWriteModes, e) ? rs(e) : Uu(e);
2706
+ }, [Uu, R]), Ku = D(() => {
2707
+ let e = ns;
2708
+ if (rs(null), !e) return;
2709
+ let t = Zo.current;
2710
+ Zo.current = null, t ? (mo(e), Q(t.content, t.attachments, t.options)) : (mo(e), Uu(e));
2632
2711
  }, [
2633
- es,
2634
- po,
2635
- Cu,
2712
+ ns,
2713
+ mo,
2714
+ Uu,
2636
2715
  Q
2637
- ]), Du = es === null ? void 0 : L.find((e) => e.id === es) ?? { id: es }, Ou = D(() => {
2638
- ts(null);
2639
- let e = Yo.current;
2640
- Yo.current = null, e && Q(e.content, e.attachments, {
2716
+ ]), qu = ns === null ? void 0 : R.find((e) => e.id === ns) ?? { id: ns }, Ju = D(() => {
2717
+ rs(null);
2718
+ let e = Zo.current;
2719
+ Zo.current = null, e && Q(e.content, e.attachments, {
2641
2720
  ...e.options,
2642
2721
  autoIntent: "read"
2643
2722
  });
2644
- }, [Q]), ku = D(() => zs(), [zs]), [Au, ju] = j(null), Mu = D(() => {
2645
- let e = w.getState(), t = e.activeConversationId ? e.conversations.find((t) => t.id === e.activeConversationId) : void 0, n = js.current;
2723
+ }, [Q]), Yu = D(() => Vs(), [Vs]), [Xu, Zu] = j(null), Qu = D(() => {
2724
+ let e = w.getState(), t = e.activeConversationId ? e.conversations.find((t) => t.id === e.activeConversationId) : void 0, n = Ns.current;
2646
2725
  return {
2647
2726
  state: e,
2648
2727
  conversation: t ? {
2649
2728
  mode: t.mode,
2650
- hasHistory: Li(t),
2729
+ hasHistory: zi(t),
2651
2730
  routedByAuto: t.routedBy === "auto"
2652
2731
  } : null,
2653
2732
  waitingCount: t ? K.liveFor(t.id).count : 0,
2654
2733
  hasDraft: n !== null && (n.text.trim() !== "" || n.hasAttachments)
2655
2734
  };
2656
- }, [K]), Nu = qo ? P("modeSelector.auto", "Auto") : void 0, Pu = D((e) => {
2657
- if (es !== null) return;
2658
- let { state: t, conversation: n, waitingCount: r, hasDraft: i } = Mu(), a = L.find((t) => t.id === e), o = Ae({
2735
+ }, [K]), $u = Yo ? P("modeSelector.auto", "Auto") : void 0, ed = D((e) => {
2736
+ if (ns !== null) return;
2737
+ let { state: t, conversation: n, waitingCount: r, hasDraft: i } = Qu(), a = R.find((t) => t.id === e), o = Ae({
2659
2738
  target: {
2660
2739
  kind: "mode",
2661
2740
  mode: e,
@@ -2665,7 +2744,7 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
2665
2744
  waitingCount: r,
2666
2745
  hasDraft: i
2667
2746
  });
2668
- o.needsDialog ? ju({
2747
+ o.needsDialog ? Zu({
2669
2748
  open: !0,
2670
2749
  target: {
2671
2750
  kind: "mode",
@@ -2673,245 +2752,247 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
2673
2752
  },
2674
2753
  plan: o,
2675
2754
  targetName: we(P, a ?? { id: e }),
2676
- currentName: Nu
2677
- }) : Cu(e);
2755
+ currentName: $u
2756
+ }) : Uu(e);
2678
2757
  }, [
2679
- Nu,
2680
- Mu,
2681
- es,
2682
- Cu,
2683
- L,
2758
+ $u,
2759
+ Qu,
2760
+ ns,
2761
+ Uu,
2762
+ R,
2684
2763
  P
2685
- ]), Fu = D(() => {
2686
- if (es !== null) return;
2687
- let { conversation: e, waitingCount: t, hasDraft: n } = Mu(), r = Ae({
2764
+ ]), td = D(() => {
2765
+ if (ns !== null) return;
2766
+ let { conversation: e, waitingCount: t, hasDraft: n } = Qu(), r = Ae({
2688
2767
  target: { kind: "auto" },
2689
2768
  conversation: e,
2690
2769
  waitingCount: t,
2691
2770
  hasDraft: n
2692
2771
  });
2693
- r.needsDialog ? ju({
2772
+ r.needsDialog ? Zu({
2694
2773
  open: !0,
2695
2774
  target: { kind: "auto" },
2696
2775
  plan: r,
2697
2776
  targetName: P("modeSelector.auto", "Auto")
2698
- }) : wu();
2777
+ }) : Wu();
2699
2778
  }, [
2700
- wu,
2701
- Mu,
2702
- es,
2779
+ Wu,
2780
+ Qu,
2781
+ ns,
2703
2782
  P
2704
- ]), Iu = D(() => {
2705
- let e = Au;
2706
- e?.open && (ju({
2783
+ ]), nd = D(() => {
2784
+ let e = Xu;
2785
+ e?.open && (Zu({
2707
2786
  ...e,
2708
2787
  open: !1
2709
- }), e.target.kind === "auto" ? wu() : (e.plan.consent && po(e.target.mode), Cu(e.target.mode)));
2788
+ }), e.target.kind === "auto" ? Wu() : (e.plan.consent && mo(e.target.mode), Uu(e.target.mode)));
2710
2789
  }, [
2711
- po,
2712
- wu,
2713
- Au,
2714
- Cu
2715
- ]), Lu = D(() => {
2716
- ju((e) => e && {
2790
+ mo,
2791
+ Wu,
2792
+ Xu,
2793
+ Uu
2794
+ ]), rd = D(() => {
2795
+ Zu((e) => e && {
2717
2796
  ...e,
2718
2797
  open: !1
2719
2798
  });
2720
- }, []), Ru = Au ? {
2721
- consent: Au.plan.consent,
2722
- withdrawnCount: Au.plan.withdrawnCount,
2723
- movesToNewConversation: Au.plan.movesToNewConversation,
2724
- draftKept: Au.plan.draftKept,
2725
- targetName: Au.targetName,
2726
- ...Au.currentName === void 0 ? {} : { currentName: Au.currentName }
2727
- } : void 0, zu = Au?.target.kind === "mode" ? Au.target.mode : null, Bu = zu === null ? void 0 : L.find((e) => e.id === zu) ?? { id: zu }, Vu = A(null), Hu = k(() => {
2799
+ }, []), id = Xu ? {
2800
+ consent: Xu.plan.consent,
2801
+ withdrawnCount: Xu.plan.withdrawnCount,
2802
+ movesToNewConversation: Xu.plan.movesToNewConversation,
2803
+ draftKept: Xu.plan.draftKept,
2804
+ targetName: Xu.targetName,
2805
+ ...Xu.currentName === void 0 ? {} : { currentName: Xu.currentName }
2806
+ } : void 0, ad = Xu?.target.kind === "mode" ? Xu.target.mode : null, od = ad === null ? void 0 : R.find((e) => e.id === ad) ?? { id: ad }, sd = A(null), cd = k(() => {
2728
2807
  if (!F) return 0;
2729
- let e = new Set(Xc.flatMap((e) => ae(e.metadata).map((e) => e.proposalId)));
2730
- return Oe(Co, V, wo, e);
2808
+ let e = new Set(Qc.flatMap((e) => ae(e.metadata).map((e) => e.proposalId)));
2809
+ return Oe(To, H, Eo, e);
2731
2810
  }, [
2732
2811
  F,
2733
- Xc,
2734
- V,
2735
- Co,
2736
- wo
2737
- ]), Uu = D(() => {
2738
- ke(Vu.current);
2739
- }, []), Wu = Ea && Da && Xc.length === 0 && !Ao && !jo && !W?.sync?.hasOlder, Gu = Wu ? /* @__PURE__ */ M("div", {
2740
- ref: Oa,
2812
+ Qc,
2813
+ H,
2814
+ To,
2815
+ Eo
2816
+ ]), ld = D(() => {
2817
+ ke(sd.current);
2818
+ }, []), ud = I && Oa && Qc.length === 0 && !Mo && !No && !G?.sync?.hasOlder, dd = ud ? /* @__PURE__ */ M("div", {
2819
+ ref: ka,
2741
2820
  className: "w-full shrink-0",
2742
2821
  "data-testid": "assistant-page-start-above"
2743
- }) : Xc.length === 0 && (Ao || jo) ? /* @__PURE__ */ M(_e, {
2744
- state: Ao ? "loading" : "failed",
2745
- onRetry: Vo
2746
- }) : Xc.length === 0 && W?.sync?.hasOlder ? /* @__PURE__ */ M("div", {
2822
+ }) : Qc.length === 0 && (Mo || No) ? /* @__PURE__ */ M(_e, {
2823
+ state: Mo ? "loading" : "failed",
2824
+ onRetry: Uo
2825
+ }) : Qc.length === 0 && G?.sync?.hasOlder ? /* @__PURE__ */ M("div", {
2747
2826
  className: "flex min-h-0 flex-1 flex-col",
2748
2827
  children: /* @__PURE__ */ M(S, {
2749
- onShowEarlier: Ho,
2750
- disabled: Ao
2828
+ onShowEarlier: Wo,
2829
+ disabled: Mo
2751
2830
  })
2752
- }) : Xc.length === 0 ? /* @__PURE__ */ M(me, {
2753
- mode: H,
2754
- onSuggestionClick: Uc,
2755
- explainsAuto: qo,
2756
- suggestions: qo && H === "assistant" ? le(L.find((e) => e.id === "assistant")?.suggestions ?? [], L.find((e) => e.id === "api-calls")?.suggestions ?? []) : void 0
2757
- }) : /* @__PURE__ */ ia("div", {
2831
+ }) : Qc.length === 0 ? /* @__PURE__ */ M(me, {
2832
+ mode: U,
2833
+ onSuggestionClick: Gc,
2834
+ explainsAuto: Yo,
2835
+ suggestions: Yo && U === "assistant" ? le(R.find((e) => e.id === "assistant")?.suggestions ?? [], R.find((e) => e.id === "api-calls")?.suggestions ?? []) : void 0
2836
+ }) : /* @__PURE__ */ oa("div", {
2758
2837
  className: "flex min-h-0 flex-1 flex-col",
2759
- children: [W?.sync?.hasOlder ? /* @__PURE__ */ M(S, {
2760
- onShowEarlier: Ho,
2761
- disabled: Ao
2838
+ children: [G?.sync?.hasOlder ? /* @__PURE__ */ M(S, {
2839
+ onShowEarlier: Wo,
2840
+ disabled: Mo
2762
2841
  }) : null, /* @__PURE__ */ M(c, {
2763
- onApprovePendingWrite: Vs,
2764
- approvingWriteRef: Ns,
2765
- approvableMessageId: el?.messageId ?? null,
2766
- retryableMessageId: tl,
2767
- messages: Xc,
2768
- processing: G ?? null,
2769
- streamingMessageId: bo,
2770
- failedMessageId: xo,
2771
- onRetry: Ns === null ? Gc : void 0,
2772
- renderWriteProposals: rl,
2773
- hidesLegacyWriteCard: nl,
2774
- renderUiOffers: al,
2775
- onStopTurn: F ? void 0 : ku,
2776
- stopTurnLabel: F ? void 0 : Ta
2842
+ onApprovePendingWrite: Us,
2843
+ approvingWriteRef: Fs,
2844
+ approvableMessageId: nl?.messageId ?? null,
2845
+ retryableMessageId: rl,
2846
+ messages: Qc,
2847
+ decorate: I ? du : void 0,
2848
+ processing: bo ?? null,
2849
+ streamingMessageId: So,
2850
+ failedMessageId: Co,
2851
+ onRetry: Fs === null ? qc : void 0,
2852
+ renderWriteProposals: al,
2853
+ hidesLegacyWriteCard: il,
2854
+ renderUiOffers: sl,
2855
+ onStopTurn: F ? void 0 : Yu,
2856
+ stopTurnLabel: F ? void 0 : Da
2777
2857
  })]
2778
2858
  });
2779
- return /* @__PURE__ */ ia("div", {
2780
- ref: Vu,
2859
+ return /* @__PURE__ */ oa("div", {
2860
+ ref: sd,
2781
2861
  className: "relative flex flex-1 flex-col overflow-hidden",
2782
- style: Wu ? ha : void 0,
2862
+ style: ud ? _a : void 0,
2783
2863
  children: [
2784
- /* @__PURE__ */ ia("div", {
2864
+ /* @__PURE__ */ oa("div", {
2785
2865
  className: "contents",
2786
- inert: $.active && !Ea || J || void 0,
2866
+ inert: $.active && !I || J || void 0,
2787
2867
  ...q.ids ? F ? { id: q.ids.chatPanel } : {
2788
2868
  role: "tabpanel",
2789
2869
  id: q.ids.chatPanel,
2790
2870
  "aria-labelledby": q.ids.chatTab
2791
2871
  } : {},
2792
2872
  children: [
2793
- Fo === null ? null : /* @__PURE__ */ M(ge, { onDismiss: () => Po(Fo) }),
2794
- cl.length > 0 && !$.active ? /* @__PURE__ */ M(he, {
2795
- count: cl.length,
2796
- onOpenTranscript: () => cs(!0)
2873
+ Lo === null ? null : /* @__PURE__ */ M(ge, { onDismiss: () => Io(Lo) }),
2874
+ ul.length > 0 && !$.active && !I ? /* @__PURE__ */ M(he, {
2875
+ count: ul.length,
2876
+ onOpenTranscript: () => us(!0)
2797
2877
  }) : null,
2798
- Gu,
2799
- Oo ? /* @__PURE__ */ M(ve, { onStartNew: () => to() }) : null,
2800
- ko && V ? /* @__PURE__ */ M(x, { onUnarchive: () => Ii.updateConversation(V, { archived: !1 }) }) : null,
2801
- Lc === null ? null : /* @__PURE__ */ M(ye, {
2878
+ dd,
2879
+ Ao ? /* @__PURE__ */ M(ve, { onStartNew: () => no() }) : null,
2880
+ jo && H ? /* @__PURE__ */ M(x, { onUnarchive: () => Ri.updateConversation(H, { archived: !1 }) }) : null,
2881
+ zc === null ? null : /* @__PURE__ */ M(ye, {
2802
2882
  tr: P,
2803
- onDismiss: () => Rc(null)
2883
+ onDismiss: () => Bc(null)
2804
2884
  }),
2805
- Xc.length > 0 && (Ao || jo) ? /* @__PURE__ */ M(_e, {
2806
- state: Ao ? "loading" : "failed",
2807
- onRetry: Vo,
2885
+ Qc.length > 0 && (Mo || No) ? /* @__PURE__ */ M(_e, {
2886
+ state: Mo ? "loading" : "failed",
2887
+ onRetry: Uo,
2808
2888
  compact: !0
2809
2889
  }) : null,
2810
2890
  /* @__PURE__ */ M(Ce, {
2811
- onStartVoiceSession: $.available && Ts ? Bl : void 0,
2891
+ onStartVoiceSession: $.available && Ds ? Ul : void 0,
2812
2892
  onSend: (e, t) => {
2813
- let n = Qi.getState().actions.take();
2893
+ let n = ea.getState().actions.take();
2814
2894
  Q(e, t, {
2815
2895
  fromPerson: !0,
2816
2896
  ...n ? { focus: n } : {}
2817
2897
  });
2818
2898
  },
2819
- onDraftChange: jc,
2820
- inputRef: F ? ya : void 0,
2821
- viewSwitch: F && !Ea && q.ids && q.compact && !fu ? /* @__PURE__ */ M(Le, {
2899
+ onDraftChange: Nc,
2900
+ inputRef: F ? xa : void 0,
2901
+ viewSwitch: F && !I && q.ids && q.compact && !Mu ? /* @__PURE__ */ M(Le, {
2822
2902
  selected: q.compact.view,
2823
2903
  onSelect: q.compact.selectView,
2824
2904
  ids: q.ids,
2825
2905
  instance: "chat"
2826
2906
  }) : void 0,
2827
- aboveCard: Hu > 0 ? /* @__PURE__ */ M(Ee, {
2828
- count: Hu,
2829
- onReview: Aa && Ca ? Ql : Uu,
2830
- opensFull: Aa && Ca !== void 0
2907
+ aboveCard: cd > 0 ? /* @__PURE__ */ M(Ee, {
2908
+ count: cd,
2909
+ onReview: ja && Ta ? vu : ld,
2910
+ opensFull: ja && Ta !== void 0
2831
2911
  }) : void 0,
2832
- disabled: yo || Ns !== null || Ao || cc,
2833
- readOnly: Oo,
2834
- placeholder: H === "api-calls" ? P("chatArea.placeholderActions", "What would you like me to do?") : P("chatArea.placeholderGeneral", "Ask me anything…"),
2835
- mode: H,
2836
- writeAccessDenied: _a === "denied" && !!Ss?.writeCapable,
2837
- availableModes: Go,
2838
- attachmentCharsPerFile: $o,
2839
- onModeChange: F ? Pu : Tu,
2840
- auto: Ko ? {
2841
- active: qo,
2842
- onSelect: F ? Fu : wu
2912
+ disabled: xo || Fs !== null || Mo || uc,
2913
+ readOnly: Ao,
2914
+ placeholder: U === "api-calls" ? P("chatArea.placeholderActions", "What would you like me to do?") : P("chatArea.placeholderGeneral", "Ask me anything…"),
2915
+ mode: U,
2916
+ writeAccessDenied: ya === "denied" && !!ws?.writeCapable,
2917
+ availableModes: qo,
2918
+ attachmentCharsPerFile: ts,
2919
+ onModeChange: F ? ed : Gu,
2920
+ auto: Jo ? {
2921
+ active: Yo,
2922
+ onSelect: F ? td : Wu
2843
2923
  } : void 0,
2844
- suspendDictation: J || F && !ga,
2845
- onVoiceStateChange: q.ids || Aa ? Jl : void 0,
2846
- modeReadOnly: Aa || void 0,
2924
+ suspendDictation: J || F && !va,
2925
+ onVoiceStateChange: q.ids || ja ? mu : void 0,
2926
+ modeReadOnly: ja || void 0,
2847
2927
  voiceSessionActive: F ? $.active : void 0,
2848
- concealed: Ea && $.active,
2849
- presentation: va,
2850
- turnInFlight: yo,
2851
- turnId: yo ? G?.messageId ?? null : null,
2852
- onStop: F ? ku : void 0,
2853
- modeDisabledReason: yo ? "replying" : "busy"
2928
+ concealed: I && $.active,
2929
+ presentation: ba,
2930
+ turnInFlight: xo,
2931
+ turnId: xo ? bo?.messageId ?? null : null,
2932
+ onStop: F ? Yu : void 0,
2933
+ modeDisabledReason: xo ? "replying" : "busy"
2854
2934
  }),
2855
- Ea ? /* @__PURE__ */ ia(ra, { children: [Wu && !$.active ? /* @__PURE__ */ M("div", {
2856
- ref: ka,
2935
+ I ? /* @__PURE__ */ oa(aa, { children: [ud && !$.active ? /* @__PURE__ */ M("div", {
2936
+ ref: Aa,
2857
2937
  className: "w-full shrink-0",
2858
2938
  "data-testid": "assistant-page-start-below"
2859
2939
  }) : null, /* @__PURE__ */ M("div", {
2860
- ref: Qc,
2940
+ ref: el,
2861
2941
  className: "contents",
2862
2942
  "data-testid": "assistant-page-voice-slot"
2863
2943
  })] }) : null,
2864
2944
  F ? /* @__PURE__ */ M(Me, { children: /* @__PURE__ */ M(Ne, {
2865
- productKey: I,
2866
- enabled: !!Pa,
2945
+ productKey: L,
2946
+ enabled: !!Fa,
2867
2947
  testId: "assistant-ai-credit-balance"
2868
- }) }) : /* @__PURE__ */ ia(ra, { children: [/* @__PURE__ */ M(Ne, {
2869
- productKey: I,
2870
- enabled: !!Pa,
2948
+ }) }) : /* @__PURE__ */ oa(aa, { children: [/* @__PURE__ */ M(Ne, {
2949
+ productKey: L,
2950
+ enabled: !!Fa,
2871
2951
  className: "px-3 pt-1 text-center",
2872
2952
  testId: "assistant-ai-credit-balance"
2873
2953
  }), /* @__PURE__ */ M(je, { className: "px-3 pb-2 pt-1" })] })
2874
2954
  ]
2875
2955
  }),
2876
- is && !$.active ? /* @__PURE__ */ M(Se, {
2877
- turns: cl,
2878
- onClose: () => cs(!1),
2879
- onSave: ll,
2880
- onContinueInChat: Ul ? Wl : void 0,
2956
+ os && !$.active ? /* @__PURE__ */ M(Se, {
2957
+ turns: ul,
2958
+ onClose: () => us(!1),
2959
+ onSave: dl,
2960
+ onContinueInChat: Kl ? ql : void 0,
2881
2961
  closeOnEscape: !0,
2882
- onShowEarlier: W?.sync?.hasOlder ? Ho : void 0,
2883
- showEarlierDisabled: Ao,
2884
- renderAfterTurn: il
2962
+ onShowEarlier: G?.sync?.hasOlder ? Wo : void 0,
2963
+ showEarlierDisabled: Mo,
2964
+ renderAfterTurn: ol
2885
2965
  }) : null,
2886
- fu && q.ids && q.compact ? /* @__PURE__ */ M(Re, {
2966
+ Mu && q.ids && q.compact ? /* @__PURE__ */ M(Re, {
2887
2967
  ids: q.ids,
2888
2968
  compact: q.compact
2889
- }) : J && as && q.ids ? F && q.compact && as.CompactView ? /* @__PURE__ */ M(Ie, {
2890
- tab: as,
2891
- CompactView: as.CompactView,
2969
+ }) : J && ss && q.ids ? F && q.compact && ss.CompactView ? /* @__PURE__ */ M(Ie, {
2970
+ tab: ss,
2971
+ CompactView: ss.CompactView,
2892
2972
  ids: q.ids,
2893
2973
  compact: q.compact,
2894
- shown: pu,
2895
- voice: ou,
2974
+ shown: Nu,
2975
+ voice: Eu,
2896
2976
  ...$.active ? { mute: {
2897
2977
  muted: $.session.muted,
2898
2978
  toggle: $.toggleMute
2899
2979
  } } : {},
2900
- ...mu ? { ask: bu } : {},
2980
+ ...Pu ? { ask: Bu } : {},
2901
2981
  footer: /* @__PURE__ */ M(Me, {})
2902
2982
  }) : /* @__PURE__ */ M(Fe, {
2903
- tab: as,
2983
+ tab: ss,
2904
2984
  id: q.ids.avatarPanel,
2905
2985
  labelledBy: q.ids.avatarTab,
2906
2986
  leaveHintId: q.ids.leaveHint,
2907
- shown: pu,
2908
- voice: ou,
2909
- ...mu ? { ask: bu } : {}
2987
+ shown: Nu,
2988
+ voice: Eu,
2989
+ ...Pu ? { ask: Bu } : {}
2910
2990
  }) : null,
2911
2991
  $.active && /* @__PURE__ */ M(Pe, {
2912
2992
  session: $.session,
2913
2993
  notice: $.notice,
2914
2994
  privacyNotice: $.handsFree.privacyNotice,
2995
+ bargeIn: $.handsFree.mode === "active",
2915
2996
  capturing: $.capturing,
2916
2997
  interrupting: $.interrupting,
2917
2998
  awaitingEndpoint: $.awaitingEndpoint,
@@ -2919,66 +3000,66 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
2919
3000
  correcting: $.correcting,
2920
3001
  onLetMeFinish: $.letMeFinish,
2921
3002
  onImDone: $.imDone,
2922
- turns: vl,
3003
+ turns: xl,
2923
3004
  spokenChunks: $.spokenChunks,
2924
- attachments: ul.attachments,
2925
- onAttachFiles: ul.addFiles,
2926
- onRemoveAttachment: ul.remove,
2927
- onRetryAttachment: ul.retry,
2928
- canAttachMore: ul.canAddMore,
2929
- preparingAttachments: ul.preparingCount,
2930
- attachmentsLocked: ul.isCommitting,
2931
- attachmentNotice: ml,
2932
- onSaveTranscript: ll,
2933
- onContinueInChat: Wl,
3005
+ attachments: fl.attachments,
3006
+ onAttachFiles: fl.addFiles,
3007
+ onRemoveAttachment: fl.remove,
3008
+ onRetryAttachment: fl.retry,
3009
+ canAttachMore: fl.canAddMore,
3010
+ preparingAttachments: fl.preparingCount,
3011
+ attachmentsLocked: fl.isCommitting,
3012
+ attachmentNotice: gl,
3013
+ onSaveTranscript: dl,
3014
+ onContinueInChat: ql,
2934
3015
  onInterrupt: () => {
2935
- $.interrupt(), zs();
3016
+ uu(), $.interrupt(), Vs();
2936
3017
  },
2937
- spoken: Jc,
3018
+ spoken: Xc,
2938
3019
  onToggleMute: $.toggleMute,
2939
- onEnd: Kl,
2940
- proposalChip: El ? Aa && Ca ? {
3020
+ onEnd: fu,
3021
+ proposalChip: kl ? ja && Ta ? {
2941
3022
  label: P("waitingChange.reviewInFull", "Review in full assistant"),
2942
- status: te(El, P),
2943
- onOpen: Ca
3023
+ status: te(kl, P),
3024
+ onOpen: Ta
2944
3025
  } : {
2945
- label: te(El, P),
2946
- onOpen: Tl
3026
+ label: te(kl, P),
3027
+ onOpen: Ol
2947
3028
  } : null,
2948
- proposalTray: Aa ? null : Ol,
2949
- renderAfterTurn: il,
2950
- onViewChange: q.ids ? cu : void 0,
2951
- ...Aa ? { view: J || lu ? "mini" : "compact" } : Ea ? {
3029
+ proposalTray: ja ? null : jl,
3030
+ renderAfterTurn: ol,
3031
+ onViewChange: q.ids ? Ou : void 0,
3032
+ ...ja ? { view: J || ku ? "mini" : "compact" } : I ? {
2952
3033
  view: "page",
2953
- pageSlot: Zc
3034
+ pageSlot: $c
2954
3035
  } : {},
2955
- startedCue: F ? fs ? P("window.voiceStartedCue", "Started a voice conversation. Your chat is in History.") : null : void 0
3036
+ startedCue: F ? ms ? P("window.voiceStartedCue", "Started a voice conversation. Your chat is in History.") : null : void 0
2956
3037
  }),
2957
3038
  /* @__PURE__ */ M(l, {
2958
- open: es !== null,
2959
- mode: Du,
2960
- currentMode: Ss ?? { id: H },
2961
- onConfirm: Eu,
2962
- onCancel: Ou
3039
+ open: ns !== null,
3040
+ mode: qu,
3041
+ currentMode: ws ?? { id: U },
3042
+ onConfirm: Ku,
3043
+ onCancel: Ju
2963
3044
  }),
2964
3045
  F ? /* @__PURE__ */ M(l, {
2965
- open: Au?.open === !0,
2966
- mode: Bu,
2967
- currentMode: Ss ?? { id: H },
2968
- switchPlan: Ru,
2969
- onConfirm: Iu,
2970
- onCancel: Lu
3046
+ open: Xu?.open === !0,
3047
+ mode: od,
3048
+ currentMode: ws ?? { id: U },
3049
+ switchPlan: id,
3050
+ onConfirm: nd,
3051
+ onCancel: rd
2971
3052
  }) : null,
2972
3053
  /* @__PURE__ */ M(u, {
2973
- ...To.dialog,
2974
- view: ol?.view ?? To.dialog.view,
2975
- serverNow: ol?.serverNow ?? NaN,
2976
- arrivedAt: ol?.arrivedAt ?? NaN,
2977
- capabilities: ol ? So[ol.session.sandboxId] : null,
2978
- turnInFlight: yo,
3054
+ ...Do.dialog,
3055
+ view: cl?.view ?? Do.dialog.view,
3056
+ serverNow: cl?.serverNow ?? NaN,
3057
+ arrivedAt: cl?.arrivedAt ?? NaN,
3058
+ capabilities: cl ? wo[cl.session.sandboxId] : null,
3059
+ turnInFlight: xo,
2979
3060
  tr: P
2980
3061
  })
2981
3062
  ]
2982
3063
  });
2983
3064
  };
2984
- export { ga as AssistantChatArea };
3065
+ export { va as AssistantChatArea };