@burdenoff/fe-libs 2026.1029.11 → 2026.1030.1

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