@burdenoff/fe-libs 2026.1114.12 → 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 (40) hide show
  1. package/dist/shared/assistant/conversation.d.ts +16 -0
  2. package/dist/shared/assistant/i18nManifest.d.ts +32 -0
  3. package/dist/shared/assistant/i18nManifest.js +32 -0
  4. package/dist/shared/assistant/index.d.ts +10 -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 +1275 -1181
  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.d.ts +6 -0
  11. package/dist/shared/assistant/ui/composer/AssistantComposer.js +400 -311
  12. package/dist/shared/assistant/ui/composer/AssistantDictation.d.ts +42 -0
  13. package/dist/shared/assistant/ui/composer/AssistantDictation.js +127 -0
  14. package/dist/shared/assistant/ui/composer/AssistantMicMenu.d.ts +23 -0
  15. package/dist/shared/assistant/ui/composer/AssistantMicMenu.js +176 -0
  16. package/dist/shared/assistant/ui/composer/microphones.d.ts +13 -0
  17. package/dist/shared/assistant/ui/composer/microphones.js +15 -0
  18. package/dist/shared/assistant/ui/composer/useCompactDictation.d.ts +70 -0
  19. package/dist/shared/assistant/ui/composer/useCompactDictation.js +136 -0
  20. package/dist/shared/assistant/ui/useVoiceSession.js +166 -164
  21. package/dist/shared/assistant/ui/voice/AssistantPageVoiceBar.d.ts +67 -0
  22. package/dist/shared/assistant/ui/voice/AssistantPageVoiceBar.js +290 -0
  23. package/dist/shared/assistant/ui/voice/AssistantVoiceSession.d.ts +11 -1
  24. package/dist/shared/assistant/ui/voice/AssistantVoiceSession.js +288 -244
  25. package/dist/shared/assistant/ui/voice/AssistantVoiceSessionButton.d.ts +5 -0
  26. package/dist/shared/assistant/ui/voice/AssistantVoiceSessionButton.js +6 -6
  27. package/dist/shared/assistant/ui/voice/LiveWaveform.d.ts +32 -0
  28. package/dist/shared/assistant/ui/voice/LiveWaveform.js +52 -0
  29. package/dist/shared/assistant/ui/voice/VoiceTurnMarks.d.ts +15 -0
  30. package/dist/shared/assistant/ui/voice/VoiceTurnMarks.js +43 -0
  31. package/dist/shared/assistant/ui/voice/formatClock.d.ts +2 -0
  32. package/dist/shared/assistant/ui/voice/formatClock.js +3 -0
  33. package/dist/shared/assistant/ui/voice/useLiveLevel.d.ts +23 -0
  34. package/dist/shared/assistant/ui/voice/useLiveLevel.js +56 -0
  35. package/dist/shared/assistant/voice/liveLevel.d.ts +85 -0
  36. package/dist/shared/assistant/voice/liveLevel.js +78 -0
  37. package/dist/shared/assistant/voice/useVoiceInput.d.ts +27 -1
  38. package/dist/shared/assistant/voice/useVoiceInput.js +141 -71
  39. package/dist/shared-assistant.js +393 -383
  40. 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 || Fl.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 || Fl.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 || Fl.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,138 +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 = w((e) => ot(e)?.sandboxId ?? null), Zc = Er(Yc, {
2057
- sessionId: W?.backendSessionId,
2058
- sandboxId: Xc,
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,
2059
2065
  nowMs: Date.now()
2060
- }), Qc = Dr(Yc), $c = (e) => {
2066
+ }), rl = kr(Zc), il = (e) => {
2061
2067
  if (ae(e.metadata).length > 0) return !0;
2062
2068
  let t = e.metadata?.sandboxId;
2063
- return oe(t ? So[t] : null);
2064
- }, el = (e) => {
2069
+ return oe(t ? wo[t] : null);
2070
+ }, al = (e) => {
2065
2071
  let t = ae(e.metadata);
2066
- return t.length === 0 || !V ? null : /* @__PURE__ */ M(d, {
2072
+ return t.length === 0 || !H ? null : /* @__PURE__ */ M(d, {
2067
2073
  refs: t,
2068
- conversationId: V,
2074
+ conversationId: H,
2069
2075
  panel: K,
2070
- entries: Co,
2071
- capabilitiesOf: (e) => So[e],
2072
- turnInFlight: yo,
2076
+ entries: To,
2077
+ capabilitiesOf: (e) => wo[e],
2078
+ turnInFlight: xo,
2073
2079
  tr: P,
2074
- onReview: To.review,
2075
- retiredSandboxes: wo,
2080
+ onReview: Do.review,
2081
+ retiredSandboxes: Eo,
2076
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."))
2077
2083
  });
2078
- }, tl = (e) => {
2079
- if (!V) return null;
2084
+ }, ol = (e) => {
2085
+ if (!H) return null;
2080
2086
  let t = Z.liveOffersFor(e, {
2081
2087
  registry: {
2082
- destinations: Ir(Zs),
2083
- permissionsSettled: Qs,
2084
- simulating: $s
2088
+ destinations: Rr($s),
2089
+ permissionsSettled: ec,
2090
+ simulating: tc
2085
2091
  },
2086
- actorId: z,
2087
- conversationId: V,
2092
+ actorId: B,
2093
+ conversationId: H,
2088
2094
  perfNow: performance.now()
2089
2095
  }), n = t[0];
2090
- return n ? /* @__PURE__ */ M(Di, {
2096
+ return n ? /* @__PURE__ */ M(ki, {
2091
2097
  offers: t.map(({ offer: e, target: t }) => ({
2092
2098
  offerId: e.offerId,
2093
2099
  label: t.label,
2094
2100
  path: t.path
2095
2101
  })),
2096
- hint: t.length === 1 && R === "proposal-v1" ? Si(n.offer, Z.turnFor(e)) : "link",
2097
- onOpen: Cc
2102
+ hint: t.length === 1 && z === "proposal-v1" ? wi(n.offer, Z.turnFor(e)) : "link",
2103
+ onOpen: Tc
2098
2104
  }, n.offer.offerId) : null;
2099
- }, nl = (e) => e.role === "assistant" ? tl(e.id) : null;
2105
+ }, sl = (e) => e.role === "assistant" ? ol(e.id) : null;
2100
2106
  O(() => {
2101
2107
  let e = Z.nextExpiryInMs(performance.now());
2102
2108
  if (e === null) return;
2103
- let t = window.setTimeout(mc, e + 1);
2109
+ let t = window.setTimeout(gc, e + 1);
2104
2110
  return () => window.clearTimeout(t);
2105
2111
  }, [
2106
2112
  Z,
2107
- fc,
2108
- mc
2113
+ mc,
2114
+ gc
2109
2115
  ]);
2110
- let rl = To.dialog.view ? Co[To.dialog.view.proposalId] : void 0, il = Zc?.expiresAtMs ?? null;
2116
+ let cl = Do.dialog.view ? To[Do.dialog.view.proposalId] : void 0, ll = nl?.expiresAtMs ?? null;
2111
2117
  O(() => {
2112
- if (il === null) return;
2113
- let e = window.setTimeout(() => Fs((e) => e + 1), Math.max(0, il - Date.now()));
2118
+ if (ll === null) return;
2119
+ let e = window.setTimeout(() => Ls((e) => e + 1), Math.max(0, ll - Date.now()));
2114
2120
  return () => window.clearTimeout(e);
2115
- }, [il, Ps]);
2116
- let al = 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) => ({
2117
2123
  id: e.id,
2118
2124
  role: e.role,
2119
- text: tr(e, G, P),
2125
+ text: tr(e, bo, P),
2120
2126
  sessionId: ur(e),
2121
2127
  timestamp: e.timestamp
2122
2128
  })).filter((e) => e.text.length > 0), [
2123
- _o.voice,
2124
- G,
2125
- nc,
2129
+ vo.voice,
2130
+ bo,
2131
+ ic,
2126
2132
  P
2127
- ]), ol = D(() => {
2128
- if (al.length === 0) return;
2133
+ ]), dl = D(() => {
2134
+ if (ul.length === 0) return;
2129
2135
  let e = /* @__PURE__ */ new Date();
2130
- or(ir(al, {
2136
+ or(ir(ul, {
2131
2137
  title: P("voiceSession.transcript", "Voice conversation"),
2132
2138
  savedAt: P("voiceSession.savedAt", "Saved"),
2133
2139
  session: P("voiceSession.sessionLabel", "Session"),
2134
2140
  earlier: P("voiceSession.earlierLabel", "Earlier"),
2135
2141
  you: P("voiceSession.speakerYou", "You"),
2136
2142
  assistant: P("voiceSession.speakerAssistant", "Assistant")
2137
- }, e), ar(I, e), "text/markdown");
2143
+ }, e), ar(L, e), "text/markdown");
2138
2144
  }, [
2139
- I,
2140
- al,
2145
+ L,
2146
+ ul,
2141
2147
  P
2142
- ]), sl = $e({ perFileChars: $o }), cl = A(sl);
2143
- cl.current = sl;
2144
- let [ll, ul] = j(null), dl = ll === null ? null : P("attachments.voiceDropped", "{{count}} attachment(s) couldn't be saved and weren't sent.", { count: ll });
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 });
2145
2151
  O(() => {
2146
- if (ll === null) return;
2147
- let e = window.setTimeout(() => ul(null), ca);
2152
+ if (ml === null) return;
2153
+ let e = window.setTimeout(() => hl(null), ua);
2148
2154
  return () => window.clearTimeout(e);
2149
- }, [ll]);
2150
- let fl = A(/* @__PURE__ */ new Set()), pl = A(() => !1), ml = D((e, t, n, r) => {
2151
- 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 = () => {
2152
2158
  let e = w.getState();
2153
- return fr({
2154
- sessionLive: pl.current(t),
2159
+ return mr({
2160
+ sessionLive: vl.current(t),
2155
2161
  boundAtSubmit: i,
2156
2162
  activeConversationId: e.activeConversationId,
2157
2163
  boundConversationExists: e.conversations.some((e) => e.id === a)
2158
2164
  });
2159
2165
  }, s = () => {
2160
- let i = cl.current;
2166
+ let i = pl.current;
2161
2167
  nt({
2162
2168
  draft: i,
2163
2169
  maySend: o,
@@ -2167,18 +2173,18 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
2167
2173
  ...n,
2168
2174
  handedOver: dn()
2169
2175
  };
2170
- Kc.current(e, i, {
2176
+ Jc.current(e, i, {
2171
2177
  fromPerson: !0,
2172
2178
  voiceSessionId: t,
2173
2179
  voiceTiming: a,
2174
2180
  ...r.correction ? { correctsInFlightTurn: !0 } : {}
2175
2181
  });
2176
2182
  },
2177
- announceDropped: (e) => ul(e)
2183
+ announceDropped: (e) => hl(e)
2178
2184
  });
2179
2185
  };
2180
- if (o() && Nc.current(e, t)) {
2181
- Kc.current(e, [], {
2186
+ if (o() && Fc.current(e, t)) {
2187
+ Jc.current(e, [], {
2182
2188
  fromPerson: !0,
2183
2189
  voiceSessionId: t,
2184
2190
  voiceTiming: {
@@ -2188,469 +2194,547 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
2188
2194
  });
2189
2195
  return;
2190
2196
  }
2191
- if (!cl.current.isBusy) {
2197
+ if (!pl.current.isBusy) {
2192
2198
  s();
2193
2199
  return;
2194
2200
  }
2195
- let c = Date.now(), l = fl.current, u = window.setInterval(() => {
2196
- let e = cl.current.isBusy;
2197
- cl.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());
2198
2204
  }, 200);
2199
2205
  l.add(u);
2200
- }, []), $ = Ze({
2201
- onSubmit: ml,
2202
- latestReply: qc,
2203
- language: o(Wa, B).tag,
2204
- graceMs: Ba,
2205
- onSupersede: Bs,
2206
- handsFreeStreamNoticeAccepted: Ha,
2207
- onAcceptHandsFreeStreamNotice: Ua,
2208
- handsFreeInterrupt: Va,
2209
- 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
+ }
2210
2218
  });
2211
- pl.current = $.isCurrentSession;
2212
- let hl = us ? al.filter((e) => e.sessionId !== void 0 && $.isCurrentSession(e.sessionId)) : al, gl = $.answerLocally;
2219
+ vl.current = $.isCurrentSession;
2220
+ let xl = fs ? ul.filter((e) => e.sessionId !== void 0 && $.isCurrentSession(e.sessionId)) : ul, Sl = $.answerLocally;
2213
2221
  O(() => {
2214
- Ic.current = gl;
2215
- }, [gl]);
2216
- let _l = $.active, vl = k(() => v(Object.values(Co), V, wo), [
2217
- Co,
2218
- V,
2219
- wo
2220
- ]), [yl, bl] = 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);
2221
2229
  O(() => {
2222
- _l || bl(null);
2223
- }, [_l]);
2224
- let xl = To.review, Sl = D(() => {
2225
- let e = vl[vl.length - 1];
2230
+ Cl || El(null);
2231
+ }, [Cl]);
2232
+ let Dl = Do.review, Ol = D(() => {
2233
+ let e = wl[wl.length - 1];
2226
2234
  if (!e) return;
2227
2235
  let { view: t } = e;
2228
- f(t) && m(t, So[e.session.sandboxId]).offerConfirm ? xl(t) : bl(t.proposalId);
2236
+ f(t) && m(t, wo[e.session.sandboxId]).offerConfirm ? Dl(t) : El(t.proposalId);
2229
2237
  }, [
2230
- vl,
2231
- So,
2232
- xl
2233
- ]), Cl = _l ? _(vl) : null, wl = yl ? Co[yl] : void 0, Tl = _l && wl && wl.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 ? {
2234
2242
  content: /* @__PURE__ */ M(d, {
2235
2243
  refs: [{
2236
- proposalId: wl.view.proposalId,
2237
- sandboxId: wl.session.sandboxId,
2238
- sessionId: wl.session.sessionId
2244
+ proposalId: Al.view.proposalId,
2245
+ sandboxId: Al.session.sandboxId,
2246
+ sessionId: Al.session.sessionId
2239
2247
  }],
2240
- conversationId: wl.session.conversationId,
2248
+ conversationId: Al.session.conversationId,
2241
2249
  panel: K,
2242
- entries: Co,
2243
- capabilitiesOf: (e) => So[e],
2244
- turnInFlight: yo,
2250
+ entries: To,
2251
+ capabilitiesOf: (e) => wo[e],
2252
+ turnInFlight: xo,
2245
2253
  tr: P,
2246
- onReview: xl,
2247
- retiredSandboxes: wo
2254
+ onReview: Dl,
2255
+ retiredSandboxes: Eo
2248
2256
  }),
2249
2257
  closeLabel: re(P, h.trayClose),
2250
- onClose: () => bl(null)
2251
- } : null, El = To.asking, Dl = Ec?.asking === !0, Ol = Dc?.asking === !0, kl = ci(), Al = $.holdListening, jl = k(() => _l || J ? null : { run: () => is ? { status: "already" } : (cs(!0), { status: "done" }) }, [
2252
- _l,
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,
2253
2261
  J,
2254
- is,
2255
- cs
2262
+ os,
2263
+ us
2256
2264
  ]);
2257
- oi("assistant.transcript", jl);
2258
- let Ml = k(() => _l ? null : { run: () => {
2265
+ ci("assistant.transcript", Ll);
2266
+ let Rl = k(() => Cl ? null : { run: () => {
2259
2267
  let e = w.getState(), t = e.conversations.find((t) => t.id === e.activeConversationId);
2260
2268
  return t && t.messages.length === 0 ? { status: "already" } : (e.createConversation(), { status: "done" });
2261
- } }, [_l]);
2262
- oi("assistant.conversation.new", Ml), O(() => {
2263
- Al(_l && (El || Dl || Ol || kl));
2269
+ } }, [Cl]);
2270
+ ci("assistant.conversation.new", Rl), O(() => {
2271
+ Il(Cl && (Ml || Nl || Pl || Fl));
2264
2272
  }, [
2265
- _l,
2266
- El,
2267
- Dl,
2268
- Ol,
2269
- kl,
2270
- Al
2273
+ Cl,
2274
+ Ml,
2275
+ Nl,
2276
+ Pl,
2277
+ Fl,
2278
+ Il
2271
2279
  ]);
2272
- let Nl = A(null), Pl = $.announce;
2280
+ let zl = A(null), Bl = $.announce;
2273
2281
  O(() => {
2274
- if (!_l) {
2275
- Nl.current = null;
2282
+ if (!Cl) {
2283
+ zl.current = null;
2276
2284
  return;
2277
2285
  }
2278
- let e = Nl.current;
2279
- if (e === null) Nl.current = new Set(Object.keys(Co));
2280
- else for (let { view: t, session: n } of ne(vl, 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)) {
2281
2289
  e.add(t.proposalId);
2282
- let r = So[n.sandboxId];
2290
+ let r = wo[n.sandboxId];
2283
2291
  if (!g({
2284
2292
  mode: "api-calls",
2285
- productWriteApproval: R,
2293
+ productWriteApproval: z,
2286
2294
  capabilities: r
2287
2295
  })) continue;
2288
2296
  let i = ie(t, m(t, r).offerConfirm, P), a = t.proposalId;
2289
- Pl({
2297
+ Bl({
2290
2298
  id: `write-readback:${a}`,
2291
2299
  text: i.text,
2292
- lang: i.translated ? B : "en",
2300
+ lang: i.translated ? V : "en",
2293
2301
  stillWanted: () => K.entry(a)?.view.status === "pending"
2294
2302
  });
2295
2303
  }
2296
2304
  }, [
2297
- _l,
2298
- vl,
2299
- Co,
2300
- So,
2301
- R,
2305
+ Cl,
2306
+ wl,
2307
+ To,
2308
+ wo,
2309
+ z,
2302
2310
  P,
2303
- B,
2304
- Pl,
2311
+ V,
2312
+ Bl,
2305
2313
  K
2306
2314
  ]);
2307
- let Fl = A(!1);
2315
+ let Vl = A(!1);
2308
2316
  O(() => {
2309
- Fl.current = $.active;
2310
- }, [$.active]), O(() => Gi((e) => {
2311
- if (!Fl.current) return !1;
2312
- let t = ls.current;
2317
+ Vl.current = $.active;
2318
+ }, [$.active]), O(() => qi((e) => {
2319
+ if (!Vl.current) return !1;
2320
+ let t = ds.current;
2313
2321
  return typeof t == "string" ? t === e : w.getState().activeConversationId === e;
2314
2322
  }), []);
2315
- let Il = $.start, Ll = D(() => {
2316
- let e = w.getState().activeConversationId, t = hr(_s());
2317
- ms(_r(t, e)), ks(!0, t.kind === "own"), Il();
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();
2318
2326
  }, [
2319
- ms,
2320
- ks,
2321
- _s,
2322
- Il
2323
- ]), Rl = k(() => er(W?.messages ?? []), [W?.messages]), zl = $n(_o.voice, G, P), Bl = $n(Rl, G, P) > 0, Vl = 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(() => {
2324
2332
  let e = w.getState().activeConversationId;
2325
- if (!e || al.length === 0) return;
2326
- let t = new Set(Rl.map((e) => e.id)), n = N();
2327
- U(e, {
2333
+ if (!e || ul.length === 0) return;
2334
+ let t = new Set(Wl.map((e) => e.id)), n = N();
2335
+ W(e, {
2328
2336
  id: n,
2329
2337
  role: "system",
2330
- content: rr(al.filter((e) => t.has(e.id)), {
2338
+ content: rr(ul.filter((e) => t.has(e.id)), {
2331
2339
  intro: P("voiceSession.continuedIntro", "Continued from a voice conversation. You asked about:"),
2332
2340
  nothing: P("voiceSession.continuedNothing", "Continued from a voice conversation."),
2333
2341
  more: (e) => P("voiceSession.continuedMore", "…and {{count}} more", { count: e })
2334
2342
  }),
2335
2343
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
2336
- metadata: { continuedVoiceTurns: zl }
2337
- }), 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?.();
2338
2346
  }, [
2339
- al,
2340
- zl,
2341
- Rl,
2342
- U,
2347
+ ul,
2348
+ Gl,
2349
+ Wl,
2350
+ W,
2343
2351
  P,
2344
2352
  $,
2353
+ us,
2345
2354
  cs,
2346
- os,
2347
- wa
2348
- ]), Hl = A({
2355
+ Ea
2356
+ ]), Jl = A({
2349
2357
  conversationId: null,
2350
2358
  count: 0
2351
2359
  });
2352
2360
  O(() => {
2353
- $.active && (Hl.current = {
2354
- conversationId: V,
2355
- count: zl
2361
+ $.active && (Jl.current = {
2362
+ conversationId: H,
2363
+ count: Gl
2356
2364
  });
2357
2365
  }, [$.active]);
2358
- let Ul = D(() => {
2359
- let e = Hl.current, t = e.conversationId === V ? e.count : 0, n = zl > t;
2360
- $.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);
2361
2393
  }, [
2362
- V,
2363
- zl,
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,
2364
2447
  $,
2365
- cs
2448
+ us,
2449
+ uu
2366
2450
  ]);
2367
2451
  O(() => {
2368
- ga && Ts || !$.active || $.end();
2452
+ va && Ds || !$.active || $.end();
2369
2453
  }, [
2370
- ga,
2371
- Ts,
2454
+ va,
2455
+ Ds,
2372
2456
  $
2373
2457
  ]);
2374
- let [Wl, Gl] = j(da), Kl = Ge({
2458
+ let [pu, mu] = j(pa), hu = Ge({
2375
2459
  available: $.available,
2376
- allowedInMode: Ts,
2377
- readOnly: Oo,
2378
- busy: yo || Ns !== null || Ao || cc,
2379
- committing: Wl.committing,
2380
- dictating: Wl.dictating
2381
- }), ql = We();
2382
- ta(() => {
2383
- Sa?.({ live: $.active });
2384
- }, [Sa, $.active]);
2385
- let Jl = A(!1), Yl = D(() => {
2386
- Jl.current = !0, Ca?.({ review: !0 });
2387
- }, [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]);
2388
2472
  O(() => {
2389
- !Aa && Jl.current && (Jl.current = !1, ke(Ru.current));
2390
- }, [Aa]);
2391
- let Xl = $.active;
2473
+ !ja && _u.current && (_u.current = !1, ke(sd.current));
2474
+ }, [ja]);
2475
+ let yu = $.active;
2392
2476
  O(() => {
2393
- if (!Xl) gs.current = !1, hs.current = null;
2394
- else if (us) {
2395
- let e = ls.current;
2396
- dr(e) && (hs.current = e.openAtStart), gs.current = !0;
2397
- } 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({
2398
2482
  pending: "own",
2399
- openAtStart: hs.current
2400
- }, ls.current) && ps(!0));
2483
+ openAtStart: _s.current
2484
+ }, ds.current) && hs(!0));
2401
2485
  }, [
2402
- us,
2403
- Xl,
2486
+ fs,
2487
+ yu,
2404
2488
  F
2405
- ]), fs && !$.active && ps(!1);
2406
- let [Zl, Ql] = j(null);
2489
+ ]), ms && !$.active && hs(!1);
2490
+ let [bu, xu] = j(null);
2407
2491
  O(() => {
2408
- Zl !== null && (J && Zl.conversationId === V || Ql(null));
2492
+ bu !== null && (J && bu.conversationId === H || xu(null));
2409
2493
  }, [
2410
2494
  J,
2411
- V,
2412
- Zl
2495
+ H,
2496
+ bu
2413
2497
  ]);
2414
- let $l = Zl !== null && Ws === Zl.replyId, eu = A(!1), tu = D(() => {
2415
- eu.current = !0, $l && Gs(), Ll();
2498
+ let Su = bu !== null && Ks === bu.replyId, Cu = A(!1), wu = D(() => {
2499
+ Cu.current = !0, Su && qs(), Ul();
2416
2500
  }, [
2417
- Ll,
2418
- $l,
2419
- Gs
2420
- ]), nu = D(() => {
2421
- $l && Gs(), Ll();
2501
+ Ul,
2502
+ Su,
2503
+ qs
2504
+ ]), Tu = D(() => {
2505
+ Su && qs(), Ul();
2422
2506
  }, [
2423
- Ll,
2424
- $l,
2425
- Gs
2507
+ Ul,
2508
+ Su,
2509
+ qs
2426
2510
  ]);
2427
2511
  O(() => {
2428
- $.active || (eu.current = !1);
2512
+ $.active || (Cu.current = !1);
2429
2513
  }, [$.active]), O(() => {
2430
- !J && eu.current && (eu.current = !1, $.active && Ul());
2514
+ !J && Cu.current && (Cu.current = !1, $.active && fu());
2431
2515
  }, [
2432
2516
  J,
2433
2517
  $.active,
2434
- Ul
2518
+ fu
2435
2519
  ]), O(() => {
2436
- J && cs(!1);
2437
- }, [J, cs]);
2438
- let ru = k(() => ({
2520
+ J && us(!1);
2521
+ }, [J, us]);
2522
+ let Eu = k(() => ({
2439
2523
  live: $.active,
2440
- blocked: Kl === null ? null : ql.voiceStartBlocked(Kl),
2441
- impossible: Ke(Kl),
2442
- start: F ? nu : tu
2524
+ blocked: hu === null ? null : gu.voiceStartBlocked(hu),
2525
+ impossible: Ke(hu),
2526
+ start: F ? Tu : wu
2443
2527
  }), [
2444
2528
  $.active,
2445
- Kl,
2446
- ql,
2529
+ hu,
2530
+ gu,
2447
2531
  F,
2448
- nu,
2449
- tu
2450
- ]), [iu, au] = j("mini"), [ou, su] = j(!1), cu = Aa && $.active && (ou || J);
2451
- cu !== ou && su(cu);
2452
- let lu = F && !Ea && $.active && !J && (!Aa || ou), uu = ga && q.covered !== !0 && !($.active && iu !== "mini") && !(is && !$.active) && !(El || Dl || Ol || kl), du = as?.ask, fu = na(du?.subscribe ?? pa, du?.getSnapshot ?? ma, du?.getSnapshot ?? ma), pu = 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({
2453
2537
  voiceLive: $.active,
2454
- readOnly: Oo,
2538
+ readOnly: Ao,
2455
2539
  writes: qe({
2456
- auto: qo,
2457
- selectedMode: H,
2458
- conversation: W && !Oo ? {
2459
- mode: W.mode,
2460
- routedBy: W.routedBy,
2461
- 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)
2462
2546
  } : null,
2463
- 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)
2464
2548
  }),
2465
- avatar: fu,
2466
- busy: yo || Ns !== null || Ao || cc || es !== null || Zo,
2467
- committing: Wl.committing
2468
- }), mu = A(pu);
2469
- ta(() => {
2470
- mu.current = pu;
2471
- }, [pu]);
2472
- let hu = 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) => {
2473
2557
  let t = e.trim();
2474
- if (t === "" || mu.current !== null) return { accepted: !1 };
2475
- $l && Gs();
2558
+ if (t === "" || Lu.current !== null) return { accepted: !1 };
2559
+ Su && qs();
2476
2560
  let n = {
2477
2561
  token: N(),
2478
2562
  exchange: null,
2479
2563
  handled: !1
2480
2564
  };
2481
- Ks.current = n;
2565
+ Js.current = n;
2482
2566
  try {
2483
2567
  Q(t, [], {
2484
2568
  fromPerson: !0,
2485
2569
  avatarTabAsk: n.token,
2486
2570
  localRecordsChecked: !0,
2487
- ...qo ? { autoIntent: "read" } : {}
2571
+ ...Yo ? { autoIntent: "read" } : {}
2488
2572
  });
2489
2573
  } finally {
2490
- Ks.current = null;
2574
+ Js.current = null;
2491
2575
  }
2492
2576
  let r = n.exchange;
2493
2577
  return r === null ? n.handled ? {
2494
2578
  accepted: !0,
2495
2579
  recorded: !1
2496
- } : { accepted: !1 } : (Ql(r), {
2580
+ } : { accepted: !1 } : (xu(r), {
2497
2581
  accepted: !0,
2498
2582
  recorded: !0,
2499
2583
  ...r
2500
2584
  });
2501
2585
  }, [
2502
- qo,
2586
+ Yo,
2503
2587
  Q,
2504
- Gs,
2505
- $l
2506
- ]), [gu] = j(() => Ye()), _u = k(() => ({
2507
- blocker: pu,
2508
- line: Je(pu, Kl),
2509
- send: hu,
2510
- last: Zl,
2511
- navigatingReplyId: uc,
2512
- draft: gu
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
2513
2597
  }), [
2514
- pu,
2515
- Kl,
2598
+ Iu,
2516
2599
  hu,
2517
- Zl,
2518
- uc,
2519
- gu
2520
- ]), vu = q.setReplyEscape, yu = J && uu && $l;
2600
+ Ru,
2601
+ bu,
2602
+ fc,
2603
+ zu
2604
+ ]), Vu = q.setReplyEscape, Hu = J && Nu && Su;
2521
2605
  O(() => {
2522
- if (vu && yu) return vu(Gs), () => vu(null);
2606
+ if (Vu && Hu) return Vu(qs), () => Vu(null);
2523
2607
  }, [
2524
- vu,
2525
- yu,
2526
- Gs
2608
+ Vu,
2609
+ Hu,
2610
+ qs
2527
2611
  ]), O(() => {
2528
- 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({
2529
2613
  sessionLive: $.active,
2530
2614
  bound: e,
2531
2615
  activeConversationId: n.activeConversationId,
2532
2616
  boundConversationExists: n.conversations.some((e) => e.id === t)
2533
2617
  });
2534
- ms(r.bound), r.end && $.end();
2618
+ gs(r.bound), r.end && $.end();
2535
2619
  }, [
2536
2620
  $,
2537
- V,
2538
- Xa,
2539
- ms
2621
+ H,
2622
+ Za,
2623
+ gs
2540
2624
  ]), O(() => {
2541
- let e = pr(yr.read(), {
2542
- activeConversationId: V,
2543
- chatTurnCount: Yc.length,
2544
- voiceTurnCount: al.length,
2625
+ let e = hr(xr.read(), {
2626
+ activeConversationId: H,
2627
+ chatTurnCount: Zc.length,
2628
+ voiceTurnCount: ul.length,
2545
2629
  sessionLive: $.active,
2546
- sessionBoundTo: ls.current,
2547
- turnInFlight: yo
2630
+ sessionBoundTo: ds.current,
2631
+ turnInFlight: xo
2548
2632
  });
2549
- yr.write(e.state), e.open && cs(!0);
2633
+ xr.write(e.state), e.open && us(!0);
2550
2634
  }, [
2551
- V,
2552
- Yc.length,
2553
- al.length,
2635
+ H,
2636
+ Zc.length,
2637
+ ul.length,
2554
2638
  $.active,
2555
- yo,
2556
- cs
2639
+ xo,
2640
+ us
2557
2641
  ]), O(() => {
2558
2642
  if (!$.active) {
2559
- cl.current.clear(), ul(null), Ls.current = null;
2560
- for (let e of fl.current) window.clearInterval(e);
2561
- fl.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();
2562
2646
  }
2563
2647
  }, [$.active]), O(() => {
2564
- let e = fl.current;
2648
+ let e = _l.current;
2565
2649
  return () => {
2566
2650
  for (let t of e) window.clearInterval(t);
2567
2651
  e.clear();
2568
2652
  };
2569
2653
  }, []), O(() => {
2570
2654
  let e = w.getState().consumePendingPrompt();
2571
- return e && Kc.current(e), w.subscribe((e, t) => {
2655
+ return e && Jc.current(e), w.subscribe((e, t) => {
2572
2656
  if (e.pendingPrompt && e.pendingPrompt !== t.pendingPrompt) {
2573
2657
  let e = w.getState().consumePendingPrompt();
2574
- e && Kc.current(e);
2658
+ e && Jc.current(e);
2575
2659
  }
2576
2660
  });
2577
2661
  }, []);
2578
- let bu = D((e) => {
2579
- let t = V ? w.getState().conversations.find((e) => e.id === V) : void 0;
2580
- 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)) {
2581
2665
  if (t.mode !== e) {
2582
- let t = Wi(), n = w.getState().conversations.find((n) => n.mode === e && Bi(n, t) && !w.getState().processingByConversationId[n.id]);
2583
- 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);
2584
2668
  }
2585
- } else V && $a(V, e);
2669
+ } else H && eo(H, e);
2586
2670
  let n = w.getState().activeConversationId;
2587
- n ? $a(n, e) : ho(!1), Qa(e);
2671
+ n ? eo(n, e) : go(!1), $a(e);
2588
2672
  }, [
2589
- V,
2673
+ H,
2674
+ no,
2590
2675
  to,
2676
+ go,
2591
2677
  eo,
2592
- ho,
2593
2678
  $a,
2594
- Qa,
2595
2679
  K
2596
- ]), xu = D(() => {
2680
+ ]), Wu = D(() => {
2597
2681
  let e = w.getState(), t = e.activeConversationId ? e.conversations.find((t) => t.id === e.activeConversationId) : void 0;
2598
2682
  if (!t) {
2599
- ho(!0), Qa(b);
2683
+ go(!0), $a(b);
2600
2684
  return;
2601
2685
  }
2602
2686
  if (t.routedBy === "auto") {
2603
- ho(!0);
2687
+ go(!0);
2604
2688
  return;
2605
2689
  }
2606
- if (!Li(t)) {
2607
- go(t.id, b);
2690
+ if (!zi(t)) {
2691
+ _o(t.id, b);
2608
2692
  return;
2609
2693
  }
2610
2694
  K.withdraw(t.id, "mode_switched");
2611
- let n = Wi(), r = e.conversations.find((t) => t.routedBy === "auto" && Bi(t, n) && !e.processingByConversationId[t.id]);
2612
- 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" });
2613
2697
  }, [
2698
+ no,
2699
+ _o,
2614
2700
  to,
2615
2701
  go,
2616
- eo,
2617
- ho,
2618
- Qa,
2702
+ $a,
2619
2703
  K
2620
- ]), Su = D((e) => {
2621
- L.find((t) => t.id === e)?.writeCapable && !Jn(w.getState().acknowledgedWriteModes, e) ? ts(e) : bu(e);
2622
- }, [bu, L]), Cu = D(() => {
2623
- let e = es;
2624
- if (ts(null), !e) return;
2625
- let t = Yo.current;
2626
- Yo.current = null, t ? (po(e), Q(t.content, t.attachments, t.options)) : (po(e), bu(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));
2627
2711
  }, [
2628
- es,
2629
- po,
2630
- bu,
2712
+ ns,
2713
+ mo,
2714
+ Uu,
2631
2715
  Q
2632
- ]), wu = es === null ? void 0 : L.find((e) => e.id === es) ?? { id: es }, Tu = D(() => {
2633
- ts(null);
2634
- let e = Yo.current;
2635
- 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, {
2636
2720
  ...e.options,
2637
2721
  autoIntent: "read"
2638
2722
  });
2639
- }, [Q]), Eu = D(() => zs(), [zs]), [Du, Ou] = j(null), ku = D(() => {
2640
- 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;
2641
2725
  return {
2642
2726
  state: e,
2643
2727
  conversation: t ? {
2644
2728
  mode: t.mode,
2645
- hasHistory: Li(t),
2729
+ hasHistory: zi(t),
2646
2730
  routedByAuto: t.routedBy === "auto"
2647
2731
  } : null,
2648
2732
  waitingCount: t ? K.liveFor(t.id).count : 0,
2649
2733
  hasDraft: n !== null && (n.text.trim() !== "" || n.hasAttachments)
2650
2734
  };
2651
- }, [K]), Au = qo ? P("modeSelector.auto", "Auto") : void 0, ju = D((e) => {
2652
- if (es !== null) return;
2653
- let { state: t, conversation: n, waitingCount: r, hasDraft: i } = ku(), 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({
2654
2738
  target: {
2655
2739
  kind: "mode",
2656
2740
  mode: e,
@@ -2660,7 +2744,7 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
2660
2744
  waitingCount: r,
2661
2745
  hasDraft: i
2662
2746
  });
2663
- o.needsDialog ? Ou({
2747
+ o.needsDialog ? Zu({
2664
2748
  open: !0,
2665
2749
  target: {
2666
2750
  kind: "mode",
@@ -2668,240 +2752,247 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
2668
2752
  },
2669
2753
  plan: o,
2670
2754
  targetName: we(P, a ?? { id: e }),
2671
- currentName: Au
2672
- }) : bu(e);
2755
+ currentName: $u
2756
+ }) : Uu(e);
2673
2757
  }, [
2674
- Au,
2675
- ku,
2676
- es,
2677
- bu,
2678
- L,
2758
+ $u,
2759
+ Qu,
2760
+ ns,
2761
+ Uu,
2762
+ R,
2679
2763
  P
2680
- ]), Mu = D(() => {
2681
- if (es !== null) return;
2682
- let { conversation: e, waitingCount: t, hasDraft: n } = ku(), r = Ae({
2764
+ ]), td = D(() => {
2765
+ if (ns !== null) return;
2766
+ let { conversation: e, waitingCount: t, hasDraft: n } = Qu(), r = Ae({
2683
2767
  target: { kind: "auto" },
2684
2768
  conversation: e,
2685
2769
  waitingCount: t,
2686
2770
  hasDraft: n
2687
2771
  });
2688
- r.needsDialog ? Ou({
2772
+ r.needsDialog ? Zu({
2689
2773
  open: !0,
2690
2774
  target: { kind: "auto" },
2691
2775
  plan: r,
2692
2776
  targetName: P("modeSelector.auto", "Auto")
2693
- }) : xu();
2777
+ }) : Wu();
2694
2778
  }, [
2695
- xu,
2696
- ku,
2697
- es,
2779
+ Wu,
2780
+ Qu,
2781
+ ns,
2698
2782
  P
2699
- ]), Nu = D(() => {
2700
- let e = Du;
2701
- e?.open && (Ou({
2783
+ ]), nd = D(() => {
2784
+ let e = Xu;
2785
+ e?.open && (Zu({
2702
2786
  ...e,
2703
2787
  open: !1
2704
- }), e.target.kind === "auto" ? xu() : (e.plan.consent && po(e.target.mode), bu(e.target.mode)));
2788
+ }), e.target.kind === "auto" ? Wu() : (e.plan.consent && mo(e.target.mode), Uu(e.target.mode)));
2705
2789
  }, [
2706
- po,
2707
- xu,
2708
- Du,
2709
- bu
2710
- ]), Pu = D(() => {
2711
- Ou((e) => e && {
2790
+ mo,
2791
+ Wu,
2792
+ Xu,
2793
+ Uu
2794
+ ]), rd = D(() => {
2795
+ Zu((e) => e && {
2712
2796
  ...e,
2713
2797
  open: !1
2714
2798
  });
2715
- }, []), Fu = Du ? {
2716
- consent: Du.plan.consent,
2717
- withdrawnCount: Du.plan.withdrawnCount,
2718
- movesToNewConversation: Du.plan.movesToNewConversation,
2719
- draftKept: Du.plan.draftKept,
2720
- targetName: Du.targetName,
2721
- ...Du.currentName === void 0 ? {} : { currentName: Du.currentName }
2722
- } : void 0, Iu = Du?.target.kind === "mode" ? Du.target.mode : null, Lu = Iu === null ? void 0 : L.find((e) => e.id === Iu) ?? { id: Iu }, Ru = A(null), zu = 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(() => {
2723
2807
  if (!F) return 0;
2724
- let e = new Set(Yc.flatMap((e) => ae(e.metadata).map((e) => e.proposalId)));
2725
- 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);
2726
2810
  }, [
2727
2811
  F,
2728
- Yc,
2729
- V,
2730
- Co,
2731
- wo
2732
- ]), Bu = D(() => {
2733
- ke(Ru.current);
2734
- }, []), Vu = Ea && Da && Yc.length === 0 && !Ao && !jo && !W?.sync?.hasOlder, Hu = Vu ? /* @__PURE__ */ M("div", {
2735
- 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,
2736
2820
  className: "w-full shrink-0",
2737
2821
  "data-testid": "assistant-page-start-above"
2738
- }) : Yc.length === 0 && (Ao || jo) ? /* @__PURE__ */ M(_e, {
2739
- state: Ao ? "loading" : "failed",
2740
- onRetry: Vo
2741
- }) : Yc.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", {
2742
2826
  className: "flex min-h-0 flex-1 flex-col",
2743
2827
  children: /* @__PURE__ */ M(S, {
2744
- onShowEarlier: Ho,
2745
- disabled: Ao
2828
+ onShowEarlier: Wo,
2829
+ disabled: Mo
2746
2830
  })
2747
- }) : Yc.length === 0 ? /* @__PURE__ */ M(me, {
2748
- mode: H,
2749
- onSuggestionClick: Uc,
2750
- explainsAuto: qo,
2751
- suggestions: qo && H === "assistant" ? le(L.find((e) => e.id === "assistant")?.suggestions ?? [], L.find((e) => e.id === "api-calls")?.suggestions ?? []) : void 0
2752
- }) : /* @__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", {
2753
2837
  className: "flex min-h-0 flex-1 flex-col",
2754
- children: [W?.sync?.hasOlder ? /* @__PURE__ */ M(S, {
2755
- onShowEarlier: Ho,
2756
- disabled: Ao
2838
+ children: [G?.sync?.hasOlder ? /* @__PURE__ */ M(S, {
2839
+ onShowEarlier: Wo,
2840
+ disabled: Mo
2757
2841
  }) : null, /* @__PURE__ */ M(c, {
2758
- onApprovePendingWrite: Vs,
2759
- approvingWriteRef: Ns,
2760
- approvableMessageId: Zc?.messageId ?? null,
2761
- retryableMessageId: Qc,
2762
- messages: Yc,
2763
- processing: G ?? null,
2764
- streamingMessageId: bo,
2765
- failedMessageId: xo,
2766
- onRetry: Ns === null ? Gc : void 0,
2767
- renderWriteProposals: el,
2768
- hidesLegacyWriteCard: $c,
2769
- renderUiOffers: nl,
2770
- onStopTurn: F ? void 0 : Eu,
2771
- 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
2772
2857
  })]
2773
2858
  });
2774
- return /* @__PURE__ */ ia("div", {
2775
- ref: Ru,
2859
+ return /* @__PURE__ */ oa("div", {
2860
+ ref: sd,
2776
2861
  className: "relative flex flex-1 flex-col overflow-hidden",
2777
- style: Vu ? ha : void 0,
2862
+ style: ud ? _a : void 0,
2778
2863
  children: [
2779
- /* @__PURE__ */ ia("div", {
2864
+ /* @__PURE__ */ oa("div", {
2780
2865
  className: "contents",
2781
- inert: $.active || J || void 0,
2866
+ inert: $.active && !I || J || void 0,
2782
2867
  ...q.ids ? F ? { id: q.ids.chatPanel } : {
2783
2868
  role: "tabpanel",
2784
2869
  id: q.ids.chatPanel,
2785
2870
  "aria-labelledby": q.ids.chatTab
2786
2871
  } : {},
2787
2872
  children: [
2788
- Fo === null ? null : /* @__PURE__ */ M(ge, { onDismiss: () => Po(Fo) }),
2789
- al.length > 0 && !$.active ? /* @__PURE__ */ M(he, {
2790
- count: al.length,
2791
- 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)
2792
2877
  }) : null,
2793
- Hu,
2794
- Oo ? /* @__PURE__ */ M(ve, { onStartNew: () => to() }) : null,
2795
- ko && V ? /* @__PURE__ */ M(x, { onUnarchive: () => Ii.updateConversation(V, { archived: !1 }) }) : null,
2796
- 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, {
2797
2882
  tr: P,
2798
- onDismiss: () => Rc(null)
2883
+ onDismiss: () => Bc(null)
2799
2884
  }),
2800
- Yc.length > 0 && (Ao || jo) ? /* @__PURE__ */ M(_e, {
2801
- state: Ao ? "loading" : "failed",
2802
- onRetry: Vo,
2885
+ Qc.length > 0 && (Mo || No) ? /* @__PURE__ */ M(_e, {
2886
+ state: Mo ? "loading" : "failed",
2887
+ onRetry: Uo,
2803
2888
  compact: !0
2804
2889
  }) : null,
2805
2890
  /* @__PURE__ */ M(Ce, {
2806
- onStartVoiceSession: $.available && Ts ? Ll : void 0,
2891
+ onStartVoiceSession: $.available && Ds ? Ul : void 0,
2807
2892
  onSend: (e, t) => {
2808
- let n = Qi.getState().actions.take();
2893
+ let n = ea.getState().actions.take();
2809
2894
  Q(e, t, {
2810
2895
  fromPerson: !0,
2811
2896
  ...n ? { focus: n } : {}
2812
2897
  });
2813
2898
  },
2814
- onDraftChange: jc,
2815
- inputRef: F ? ya : void 0,
2816
- viewSwitch: F && !Ea && q.ids && q.compact && !lu ? /* @__PURE__ */ M(Le, {
2899
+ onDraftChange: Nc,
2900
+ inputRef: F ? xa : void 0,
2901
+ viewSwitch: F && !I && q.ids && q.compact && !Mu ? /* @__PURE__ */ M(Le, {
2817
2902
  selected: q.compact.view,
2818
2903
  onSelect: q.compact.selectView,
2819
2904
  ids: q.ids,
2820
2905
  instance: "chat"
2821
2906
  }) : void 0,
2822
- aboveCard: zu > 0 ? /* @__PURE__ */ M(Ee, {
2823
- count: zu,
2824
- onReview: Aa && Ca ? Yl : Bu,
2825
- 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
2826
2911
  }) : void 0,
2827
- disabled: yo || Ns !== null || Ao || cc,
2828
- readOnly: Oo,
2829
- placeholder: H === "api-calls" ? P("chatArea.placeholderActions", "What would you like me to do?") : P("chatArea.placeholderGeneral", "Ask me anything…"),
2830
- mode: H,
2831
- writeAccessDenied: _a === "denied" && !!Ss?.writeCapable,
2832
- availableModes: Go,
2833
- attachmentCharsPerFile: $o,
2834
- onModeChange: F ? ju : Su,
2835
- auto: Ko ? {
2836
- active: qo,
2837
- onSelect: F ? Mu : xu
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
2838
2923
  } : void 0,
2839
- suspendDictation: J || F && !ga,
2840
- onVoiceStateChange: q.ids || Aa ? Gl : void 0,
2841
- modeReadOnly: Aa || void 0,
2924
+ suspendDictation: J || F && !va,
2925
+ onVoiceStateChange: q.ids || ja ? mu : void 0,
2926
+ modeReadOnly: ja || void 0,
2842
2927
  voiceSessionActive: F ? $.active : void 0,
2843
- presentation: va,
2844
- turnInFlight: yo,
2845
- turnId: yo ? G?.messageId ?? null : null,
2846
- onStop: F ? Eu : void 0,
2847
- 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"
2848
2934
  }),
2849
- Vu ? /* @__PURE__ */ M("div", {
2850
- ref: ka,
2935
+ I ? /* @__PURE__ */ oa(aa, { children: [ud && !$.active ? /* @__PURE__ */ M("div", {
2936
+ ref: Aa,
2851
2937
  className: "w-full shrink-0",
2852
2938
  "data-testid": "assistant-page-start-below"
2853
- }) : null,
2939
+ }) : null, /* @__PURE__ */ M("div", {
2940
+ ref: el,
2941
+ className: "contents",
2942
+ "data-testid": "assistant-page-voice-slot"
2943
+ })] }) : null,
2854
2944
  F ? /* @__PURE__ */ M(Me, { children: /* @__PURE__ */ M(Ne, {
2855
- productKey: I,
2856
- enabled: !!Pa,
2945
+ productKey: L,
2946
+ enabled: !!Fa,
2857
2947
  testId: "assistant-ai-credit-balance"
2858
- }) }) : /* @__PURE__ */ ia(ra, { children: [/* @__PURE__ */ M(Ne, {
2859
- productKey: I,
2860
- enabled: !!Pa,
2948
+ }) }) : /* @__PURE__ */ oa(aa, { children: [/* @__PURE__ */ M(Ne, {
2949
+ productKey: L,
2950
+ enabled: !!Fa,
2861
2951
  className: "px-3 pt-1 text-center",
2862
2952
  testId: "assistant-ai-credit-balance"
2863
2953
  }), /* @__PURE__ */ M(je, { className: "px-3 pb-2 pt-1" })] })
2864
2954
  ]
2865
2955
  }),
2866
- is && !$.active ? /* @__PURE__ */ M(Se, {
2867
- turns: al,
2868
- onClose: () => cs(!1),
2869
- onSave: ol,
2870
- onContinueInChat: Bl ? Vl : void 0,
2956
+ os && !$.active ? /* @__PURE__ */ M(Se, {
2957
+ turns: ul,
2958
+ onClose: () => us(!1),
2959
+ onSave: dl,
2960
+ onContinueInChat: Kl ? ql : void 0,
2871
2961
  closeOnEscape: !0,
2872
- onShowEarlier: W?.sync?.hasOlder ? Ho : void 0,
2873
- showEarlierDisabled: Ao,
2874
- renderAfterTurn: tl
2962
+ onShowEarlier: G?.sync?.hasOlder ? Wo : void 0,
2963
+ showEarlierDisabled: Mo,
2964
+ renderAfterTurn: ol
2875
2965
  }) : null,
2876
- lu && q.ids && q.compact ? /* @__PURE__ */ M(Re, {
2966
+ Mu && q.ids && q.compact ? /* @__PURE__ */ M(Re, {
2877
2967
  ids: q.ids,
2878
2968
  compact: q.compact
2879
- }) : J && as && q.ids ? F && q.compact && as.CompactView ? /* @__PURE__ */ M(Ie, {
2880
- tab: as,
2881
- CompactView: as.CompactView,
2969
+ }) : J && ss && q.ids ? F && q.compact && ss.CompactView ? /* @__PURE__ */ M(Ie, {
2970
+ tab: ss,
2971
+ CompactView: ss.CompactView,
2882
2972
  ids: q.ids,
2883
2973
  compact: q.compact,
2884
- shown: uu,
2885
- voice: ru,
2974
+ shown: Nu,
2975
+ voice: Eu,
2886
2976
  ...$.active ? { mute: {
2887
2977
  muted: $.session.muted,
2888
2978
  toggle: $.toggleMute
2889
2979
  } } : {},
2890
- ...du ? { ask: _u } : {},
2980
+ ...Pu ? { ask: Bu } : {},
2891
2981
  footer: /* @__PURE__ */ M(Me, {})
2892
2982
  }) : /* @__PURE__ */ M(Fe, {
2893
- tab: as,
2983
+ tab: ss,
2894
2984
  id: q.ids.avatarPanel,
2895
2985
  labelledBy: q.ids.avatarTab,
2896
2986
  leaveHintId: q.ids.leaveHint,
2897
- shown: uu,
2898
- voice: ru,
2899
- ...du ? { ask: _u } : {}
2987
+ shown: Nu,
2988
+ voice: Eu,
2989
+ ...Pu ? { ask: Bu } : {}
2900
2990
  }) : null,
2901
2991
  $.active && /* @__PURE__ */ M(Pe, {
2902
2992
  session: $.session,
2903
2993
  notice: $.notice,
2904
2994
  privacyNotice: $.handsFree.privacyNotice,
2995
+ bargeIn: $.handsFree.mode === "active",
2905
2996
  capturing: $.capturing,
2906
2997
  interrupting: $.interrupting,
2907
2998
  awaitingEndpoint: $.awaitingEndpoint,
@@ -2909,63 +3000,66 @@ var pa = () => () => {}, ma = () => "off", ha = { overflowY: "auto" }, ga = ({ v
2909
3000
  correcting: $.correcting,
2910
3001
  onLetMeFinish: $.letMeFinish,
2911
3002
  onImDone: $.imDone,
2912
- turns: hl,
3003
+ turns: xl,
2913
3004
  spokenChunks: $.spokenChunks,
2914
- attachments: sl.attachments,
2915
- onAttachFiles: sl.addFiles,
2916
- onRemoveAttachment: sl.remove,
2917
- onRetryAttachment: sl.retry,
2918
- canAttachMore: sl.canAddMore,
2919
- preparingAttachments: sl.preparingCount,
2920
- attachmentsLocked: sl.isCommitting,
2921
- attachmentNotice: dl,
2922
- onSaveTranscript: ol,
2923
- onContinueInChat: Vl,
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,
2924
3015
  onInterrupt: () => {
2925
- $.interrupt(), zs();
3016
+ uu(), $.interrupt(), Vs();
2926
3017
  },
2927
- spoken: Jc,
3018
+ spoken: Xc,
2928
3019
  onToggleMute: $.toggleMute,
2929
- onEnd: Ul,
2930
- proposalChip: Cl ? Aa && Ca ? {
3020
+ onEnd: fu,
3021
+ proposalChip: kl ? ja && Ta ? {
2931
3022
  label: P("waitingChange.reviewInFull", "Review in full assistant"),
2932
- status: te(Cl, P),
2933
- onOpen: Ca
3023
+ status: te(kl, P),
3024
+ onOpen: Ta
2934
3025
  } : {
2935
- label: te(Cl, P),
2936
- onOpen: Sl
3026
+ label: te(kl, P),
3027
+ onOpen: Ol
2937
3028
  } : null,
2938
- proposalTray: Aa ? null : Tl,
2939
- renderAfterTurn: tl,
2940
- onViewChange: q.ids ? au : void 0,
2941
- ...Aa ? { view: J || ou ? "mini" : "compact" } : {},
2942
- startedCue: F ? fs ? P("window.voiceStartedCue", "Started a voice conversation. Your chat is in History.") : null : void 0
3029
+ proposalTray: ja ? null : jl,
3030
+ renderAfterTurn: ol,
3031
+ onViewChange: q.ids ? Ou : void 0,
3032
+ ...ja ? { view: J || ku ? "mini" : "compact" } : I ? {
3033
+ view: "page",
3034
+ pageSlot: $c
3035
+ } : {},
3036
+ startedCue: F ? ms ? P("window.voiceStartedCue", "Started a voice conversation. Your chat is in History.") : null : void 0
2943
3037
  }),
2944
3038
  /* @__PURE__ */ M(l, {
2945
- open: es !== null,
2946
- mode: wu,
2947
- currentMode: Ss ?? { id: H },
2948
- onConfirm: Cu,
2949
- onCancel: Tu
3039
+ open: ns !== null,
3040
+ mode: qu,
3041
+ currentMode: ws ?? { id: U },
3042
+ onConfirm: Ku,
3043
+ onCancel: Ju
2950
3044
  }),
2951
3045
  F ? /* @__PURE__ */ M(l, {
2952
- open: Du?.open === !0,
2953
- mode: Lu,
2954
- currentMode: Ss ?? { id: H },
2955
- switchPlan: Fu,
2956
- onConfirm: Nu,
2957
- onCancel: Pu
3046
+ open: Xu?.open === !0,
3047
+ mode: od,
3048
+ currentMode: ws ?? { id: U },
3049
+ switchPlan: id,
3050
+ onConfirm: nd,
3051
+ onCancel: rd
2958
3052
  }) : null,
2959
3053
  /* @__PURE__ */ M(u, {
2960
- ...To.dialog,
2961
- view: rl?.view ?? To.dialog.view,
2962
- serverNow: rl?.serverNow ?? NaN,
2963
- arrivedAt: rl?.arrivedAt ?? NaN,
2964
- capabilities: rl ? So[rl.session.sandboxId] : null,
2965
- 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,
2966
3060
  tr: P
2967
3061
  })
2968
3062
  ]
2969
3063
  });
2970
3064
  };
2971
- export { ga as AssistantChatArea };
3065
+ export { va as AssistantChatArea };