@burdenoff/fe-libs 2026.1027.13 → 2026.1027.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -53,209 +53,210 @@ import { useLiveAvatarTab as vn, useLiveAvatarTabSeam as yn } from "./assistantL
53
53
  import { useVoiceSession as bn } from "./useVoiceSession.js";
54
54
  import { isMultimodalBodyRejection as xn, isRecoverableAssistantError as Sn } from "../transportErrors.js";
55
55
  import { createReadinessTracker as Cn, planAfterTransportFailure as wn, planTrustedSandboxFailure as Tn } from "../sandboxReadiness.js";
56
- import { writeProposalConfirmState as En } from "./writeProposalPresentation.js";
57
- import { writeProposalUsesDialog as Dn } from "./AssistantWriteProposalCard.js";
58
- import { AssistantWriteConfirmDialog as On } from "./AssistantWriteConfirmDialog.js";
59
- import { useWriteProposalConfirm as kn } from "./useWriteProposalConfirm.js";
60
- import { AssistantWriteProposalSlot as An } from "./AssistantWriteProposalSlot.js";
61
- import { readWriteProposalRefs as jn, writeProposalsEnabledFor as Mn } from "../writeProposalDiscovery.js";
62
- import { planWriteReply as Nn, promptWriteApproval as Pn } from "../writeReplySend.js";
63
- import { useWriteProposals as Fn } from "./useWriteProposals.js";
64
- import { AssistantSpokenTurnsNotice as In } from "./AssistantSpokenTurnsNotice.js";
65
- import { AssistantHistoryArchivedNotice as Ln, AssistantHistoryDeletedNotice as Rn, AssistantHistoryLoadState as zn, AssistantHistoryReadOnlyBanner as Bn, AssistantHistoryShowEarlier as Vn } from "./AssistantHistoryNotices.js";
66
- import { VoiceTranscriptDrawer as Hn } from "./voice/VoiceTranscriptDrawer.js";
67
- import { downloadFile as Un } from "../exportConversation.js";
68
- import { conversationHasHistory as Wn, isOtherScopeHistoryConversation as Gn, isReadOnlyHistoryConversation as Kn, isReusableHistoryDraft as qn } from "../history/historyList.js";
69
- import { useAssistantHistoryStatus as Jn } from "../history/historyStatus.js";
70
- import { assistantHistory as Yn } from "../history/historyEngine.js";
71
- import { AssistantEmptyState as Xn } from "./AssistantEmptyState.js";
72
- import { AssistantNothingToDeleteNotice as Zn } from "./AssistantDeleteConversationDialog.js";
73
- import { assistantHistoryIsOn as Qn } from "./conversationDelete.js";
74
- import { useConversationDeleteDialog as $n } from "./conversationDeleteDialog.js";
75
- import { useControlConfirmDialog as er } from "./controlConfirmDialog.js";
76
- import { useLeaveConfirmAsking as tr } from "./leaveConfirm.js";
77
- import { startFocusReturnAfterKeep as nr } from "./leaveConfirmFocus.js";
78
- import { resolveConversationDeleteTarget as rr } from "../conversationDeleteCommand.js";
79
- import { resumeContextFor as ir } from "../history/historyResume.js";
80
- import { useHistoryRowControlsFor as ar } from "../history/useHistoryRowControls.js";
81
- import { liveCoverage as or } from "../liveDeltas.js";
82
- import { createLiveRender as sr } from "../liveOverlay.js";
83
- import { AssistantMessageList as cr } from "./AssistantMessageList.js";
84
- import { AssistantUiOfferLinks as lr } from "./AssistantUiOfferLink.js";
85
- import { AssistantVoiceSession as ur } from "./voice/AssistantVoiceSession.js";
86
- import { voiceStartBlocker as dr, voiceStartBlockerLasts as fr } from "./voice/voiceStartGate.js";
87
- import { avatarAskBlocker as pr, avatarAskWrites as mr, avatarTabAskLine as hr } from "./avatar/avatarAskGate.js";
88
- import { createAvatarTabDraft as gr } from "./avatar/avatarTabDraft.js";
89
- import { AssistantAvatarTab as _r } from "./avatar/AssistantAvatarTab.js";
90
- import { useAssistantApiAccess as vr } from "../useAssistantApiAccess.js";
91
- import { useConversationTurns as yr } from "../useConversationTurns.js";
92
- import { openTurnStream as br, turnStreamAvailable as xr } from "../turnStream.js";
93
- import { createSnapshotPoller as Sr } from "../snapshotPoller.js";
94
- import { sendAssistantTurnTimings as Cr, startTurnTimingReporting as wr } from "../turnTimingReporter.js";
95
- import { QuarantineSet as Tr, WarmCancelled as Er, claimPreopenedSession as Dr, consumeWarm as Or, preopenKey as kr, preopenWanted as Ar, prewarmTarget as jr, settleWarmBeforeSend as Mr, startPreopen as Nr, startWarm as Pr, warmState as Fr } from "../prewarm.js";
96
- import { navEntryIds as Ir } from "../uiActions/resolveTarget.js";
97
- import { lookupNamedRecords as Lr } from "../uiActions/recordNames.js";
98
- import { isAlreadyThere as Rr, matchLocalUiCommand as zr, mayBeNavigationFollowUp as Br, navDestinations as Vr, planThemeChange as Hr } from "../localUiCommands.js";
99
- import { offerAssentFor as Ur } from "../localeCommands/assent.js";
100
- import { readControlSnapshot as Wr } from "../appControls/snapshot.js";
101
- import { runNavigation as Gr } from "../uiActions/navigationOutcome.js";
102
- import { assistantBackStack as Kr, isBackRunnable as qr } from "../uiActions/backStack.js";
103
- import { buildNavigateAction as Jr, destinationForPath as Yr, labelForPath as Xr, newestAssistantOnSurface as Zr } from "../uiActions/navigateAction.js";
104
- import { buildNavigationContext as Qr, latestReplyOnSurface as $r, rememberPresentedList as ei } from "../uiActions/linkContext.js";
105
- import { buildUiCatalogue as ti, markUiCatalogueSent as ni, uiCatalogueSent as ri, uiCatalogueSessionKey as ii } from "../uiActions/uiCatalogue.js";
106
- import { offerYesOnSurface as ai } from "../uiActions/offerYesOnSurface.js";
107
- import { parseNavIntent as oi } from "../uiActions/navIntent.js";
108
- import { decideActOnResolve as si, n4LeaveGuard as ci } from "../uiActions/actOnResolve.js";
109
- import { planAppControl as li } from "../appControls/plan.js";
110
- import { dispatchAssistantQuotaExhausted as ui, notifyAiCreditsUpdated as di } from "../aiCredits.js";
111
- import { useAssistantAttachments as fi } from "../useAssistantAttachments.js";
112
- import { AssistantComposer as pi } from "./composer/AssistantComposer.js";
113
- import { isProdRuntime as mi } from "../env.js";
114
- import { AssistantApiCallsConsentDialog as hi } from "./AssistantApiCallsConsentDialog.js";
115
- import { createClientToolRunner as gi, offerClientTools as _i } from "../../agent-tools/adapters/assistant.js";
116
- import { useVisibleNavItems as vi } from "../../../chrome/mobileTabBar/useVisibleNavItems.js";
117
- import { useCallback as E, useEffect as D, useLayoutEffect as yi, useMemo as O, useRef as k, useState as A, useSyncExternalStore as bi } from "react";
118
- import { jsx as j, jsxs as xi } from "react/jsx-runtime";
56
+ import { AssistantAiDisclaimer as En } from "./AssistantAiDisclaimer.js";
57
+ import { writeProposalConfirmState as Dn } from "./writeProposalPresentation.js";
58
+ import { writeProposalUsesDialog as On } from "./AssistantWriteProposalCard.js";
59
+ import { AssistantWriteConfirmDialog as kn } from "./AssistantWriteConfirmDialog.js";
60
+ import { useWriteProposalConfirm as An } from "./useWriteProposalConfirm.js";
61
+ import { AssistantWriteProposalSlot as jn } from "./AssistantWriteProposalSlot.js";
62
+ import { readWriteProposalRefs as Mn, writeProposalsEnabledFor as Nn } from "../writeProposalDiscovery.js";
63
+ import { planWriteReply as Pn, promptWriteApproval as Fn } from "../writeReplySend.js";
64
+ import { useWriteProposals as In } from "./useWriteProposals.js";
65
+ import { AssistantSpokenTurnsNotice as Ln } from "./AssistantSpokenTurnsNotice.js";
66
+ import { AssistantHistoryArchivedNotice as Rn, AssistantHistoryDeletedNotice as zn, AssistantHistoryLoadState as Bn, AssistantHistoryReadOnlyBanner as Vn, AssistantHistoryShowEarlier as Hn } from "./AssistantHistoryNotices.js";
67
+ import { VoiceTranscriptDrawer as Un } from "./voice/VoiceTranscriptDrawer.js";
68
+ import { downloadFile as Wn } from "../exportConversation.js";
69
+ import { conversationHasHistory as Gn, isOtherScopeHistoryConversation as Kn, isReadOnlyHistoryConversation as qn, isReusableHistoryDraft as Jn } from "../history/historyList.js";
70
+ import { useAssistantHistoryStatus as Yn } from "../history/historyStatus.js";
71
+ import { assistantHistory as Xn } from "../history/historyEngine.js";
72
+ import { AssistantEmptyState as Zn } from "./AssistantEmptyState.js";
73
+ import { AssistantNothingToDeleteNotice as Qn } from "./AssistantDeleteConversationDialog.js";
74
+ import { assistantHistoryIsOn as $n } from "./conversationDelete.js";
75
+ import { useConversationDeleteDialog as er } from "./conversationDeleteDialog.js";
76
+ import { useControlConfirmDialog as tr } from "./controlConfirmDialog.js";
77
+ import { useLeaveConfirmAsking as nr } from "./leaveConfirm.js";
78
+ import { startFocusReturnAfterKeep as rr } from "./leaveConfirmFocus.js";
79
+ import { resolveConversationDeleteTarget as ir } from "../conversationDeleteCommand.js";
80
+ import { resumeContextFor as ar } from "../history/historyResume.js";
81
+ import { useHistoryRowControlsFor as or } from "../history/useHistoryRowControls.js";
82
+ import { liveCoverage as sr } from "../liveDeltas.js";
83
+ import { createLiveRender as cr } from "../liveOverlay.js";
84
+ import { AssistantMessageList as lr } from "./AssistantMessageList.js";
85
+ import { AssistantUiOfferLinks as ur } from "./AssistantUiOfferLink.js";
86
+ import { AssistantVoiceSession as dr } from "./voice/AssistantVoiceSession.js";
87
+ import { voiceStartBlocker as fr, voiceStartBlockerLasts as pr } from "./voice/voiceStartGate.js";
88
+ import { avatarAskBlocker as mr, avatarAskWrites as hr, avatarTabAskLine as gr } from "./avatar/avatarAskGate.js";
89
+ import { createAvatarTabDraft as _r } from "./avatar/avatarTabDraft.js";
90
+ import { AssistantAvatarTab as vr } from "./avatar/AssistantAvatarTab.js";
91
+ import { useAssistantApiAccess as yr } from "../useAssistantApiAccess.js";
92
+ import { useConversationTurns as br } from "../useConversationTurns.js";
93
+ import { openTurnStream as xr, turnStreamAvailable as Sr } from "../turnStream.js";
94
+ import { createSnapshotPoller as Cr } from "../snapshotPoller.js";
95
+ import { sendAssistantTurnTimings as wr, startTurnTimingReporting as Tr } from "../turnTimingReporter.js";
96
+ import { QuarantineSet as Er, WarmCancelled as Dr, claimPreopenedSession as Or, consumeWarm as kr, preopenKey as Ar, preopenWanted as jr, prewarmTarget as Mr, settleWarmBeforeSend as Nr, startPreopen as Pr, startWarm as Fr, warmState as Ir } from "../prewarm.js";
97
+ import { navEntryIds as Lr } from "../uiActions/resolveTarget.js";
98
+ import { lookupNamedRecords as Rr } from "../uiActions/recordNames.js";
99
+ import { isAlreadyThere as zr, matchLocalUiCommand as Br, mayBeNavigationFollowUp as Vr, navDestinations as Hr, planThemeChange as Ur } from "../localUiCommands.js";
100
+ import { offerAssentFor as Wr } from "../localeCommands/assent.js";
101
+ import { readControlSnapshot as Gr } from "../appControls/snapshot.js";
102
+ import { runNavigation as Kr } from "../uiActions/navigationOutcome.js";
103
+ import { assistantBackStack as qr, isBackRunnable as Jr } from "../uiActions/backStack.js";
104
+ import { buildNavigateAction as Yr, destinationForPath as Xr, labelForPath as Zr, newestAssistantOnSurface as Qr } from "../uiActions/navigateAction.js";
105
+ import { buildNavigationContext as $r, latestReplyOnSurface as ei, rememberPresentedList as ti } from "../uiActions/linkContext.js";
106
+ import { buildUiCatalogue as ni, markUiCatalogueSent as ri, uiCatalogueSent as ii, uiCatalogueSessionKey as ai } from "../uiActions/uiCatalogue.js";
107
+ import { offerYesOnSurface as oi } from "../uiActions/offerYesOnSurface.js";
108
+ import { parseNavIntent as si } from "../uiActions/navIntent.js";
109
+ import { decideActOnResolve as ci, n4LeaveGuard as li } from "../uiActions/actOnResolve.js";
110
+ import { planAppControl as ui } from "../appControls/plan.js";
111
+ import { dispatchAssistantQuotaExhausted as di, notifyAiCreditsUpdated as fi } from "../aiCredits.js";
112
+ import { useAssistantAttachments as pi } from "../useAssistantAttachments.js";
113
+ import { AssistantComposer as mi } from "./composer/AssistantComposer.js";
114
+ import { isProdRuntime as hi } from "../env.js";
115
+ import { AssistantApiCallsConsentDialog as gi } from "./AssistantApiCallsConsentDialog.js";
116
+ import { createClientToolRunner as _i, offerClientTools as vi } from "../../agent-tools/adapters/assistant.js";
117
+ import { useVisibleNavItems as yi } from "../../../chrome/mobileTabBar/useVisibleNavItems.js";
118
+ import { useCallback as E, useEffect as D, useLayoutEffect as bi, useMemo as xi, useRef as O, useState as k, useSyncExternalStore as Si } from "react";
119
+ import { jsx as A, jsxs as Ci } from "react/jsx-runtime";
119
120
  //#region src/shared/assistant/ui/AssistantChatArea.tsx
120
- var Si = 2500, Ci = 600, wi = 2e4, Ti = 1e4, Ei = 1e4, Di = {
121
+ var wi = 2500, Ti = 600, Ei = 2e4, Di = 1e4, Oi = 1e4, ki = {
121
122
  committing: !1,
122
123
  dictating: !1
123
- }, Oi = 6e3;
124
- function M() {
124
+ }, Ai = 6e3;
125
+ function j() {
125
126
  return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
126
127
  }
127
- var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess: Mi = "unknown" }) => {
128
- let N = a(), { product: P, modes: F, gatherPageContext: Ni, buildPrompt: Pi, reportTurnTimings: Fi, reportTokenUsage: Ii, localUiCommands: Li } = i(), I = Oe(i().writeApproval), Ri = E((e, t) => {
128
+ var ji = () => () => {}, Mi = () => "off", Ni = ({ visible: Ni = !0, writeAccess: Pi = "unknown" }) => {
129
+ let M = a(), { product: N, modes: P, gatherPageContext: Fi, buildPrompt: Ii, reportTurnTimings: Li, reportTokenUsage: Ri, localUiCommands: zi } = i(), F = Oe(i().writeApproval), Bi = E((e, t) => {
129
130
  let n = _.getState(), r = t ?? n.sandboxesByMode[e]?.sandboxId ?? null;
130
131
  return vt({
131
132
  mode: e,
132
- productWriteApproval: I,
133
+ productWriteApproval: F,
133
134
  capabilities: r ? n.sandboxWriteCapabilities[r] : null
134
135
  });
135
- }, [I]), { getAccessToken: L, getWorkspaceToken: zi, userId: R } = n(), { locale: z, isLocaleLoading: Bi } = e(), Vi = _((e) => e.voiceGraceMs), Hi = _((e) => e.handsFreeInterrupt), Ui = _((e) => e.handsFreeStreamNoticeAccepted), Wi = _((e) => e.acceptHandsFreeStreamNotice), Gi = _((e) => e.assistantLanguage), Ki = _((e) => e.replyLanguage), qi = O(() => nt(Gi, Ki, z), [
136
- Gi,
137
- Ki,
138
- z
139
- ]), Ji = qi.reply.english, Yi = qi.replyIsExplicit, Xi = qi.reply.code, { conversations: Zi, activeConversationId: B, mode: V, processingByConversationId: Qi, setMode: $i, setConversationMode: ea, setActiveConversation: ta, createConversation: na, addMessage: H, updateMessage: ra, patchMessage: ia, mergeMessageMetadata: aa, setConversationProcessing: oa, clearConversationProcessing: sa, setBackendSessionId: ca, clearBackendSessionId: la, setSandbox: ua, clearSandbox: da, acknowledgedWriteModes: fa, acknowledgeWriteMode: pa, autoRouting: ma, setAutoRouting: ha, routeConversation: ga } = _(), U = Zi.find((e) => e.id === B), _a = yr(U), va = _a.all, ya = B ? Qi[B] : void 0, ba = Pt(ya?.status), xa = ba ? ya?.messageId ?? null : null, Sa = ya?.status === "error" ? ya.messageId : null, Ca = _((e) => e.sandboxWriteCapabilities), { panel: W, entries: wa, retiredSandboxes: Ta } = Fn({
140
- tr: N,
141
- productWriteApproval: I
142
- }), Ea = kn({
143
- approve: (e, t) => W.approve(e, t),
144
- decline: (e, t, n) => W.decline(e, t, n),
145
- presented: (e, t) => W.presented(e, t)
146
- }), Da = Ea.dismiss, Oa = k(null);
136
+ }, [F]), { getAccessToken: I, getWorkspaceToken: Vi, userId: L } = n(), { locale: R, isLocaleLoading: Hi } = e(), Ui = _((e) => e.voiceGraceMs), Wi = _((e) => e.handsFreeInterrupt), Gi = _((e) => e.handsFreeStreamNoticeAccepted), Ki = _((e) => e.acceptHandsFreeStreamNotice), qi = _((e) => e.assistantLanguage), Ji = _((e) => e.replyLanguage), Yi = xi(() => nt(qi, Ji, R), [
137
+ qi,
138
+ Ji,
139
+ R
140
+ ]), Xi = Yi.reply.english, Zi = Yi.replyIsExplicit, Qi = Yi.reply.code, { conversations: $i, activeConversationId: z, mode: B, processingByConversationId: ea, setMode: ta, setConversationMode: na, setActiveConversation: ra, createConversation: ia, addMessage: V, updateMessage: aa, patchMessage: oa, mergeMessageMetadata: sa, setConversationProcessing: ca, clearConversationProcessing: la, setBackendSessionId: ua, clearBackendSessionId: da, setSandbox: fa, clearSandbox: pa, acknowledgedWriteModes: ma, acknowledgeWriteMode: ha, autoRouting: ga, setAutoRouting: _a, routeConversation: va } = _(), H = $i.find((e) => e.id === z), ya = br(H), ba = ya.all, xa = z ? ea[z] : void 0, Sa = Pt(xa?.status), Ca = Sa ? xa?.messageId ?? null : null, wa = xa?.status === "error" ? xa.messageId : null, Ta = _((e) => e.sandboxWriteCapabilities), { panel: U, entries: Ea, retiredSandboxes: Da } = In({
141
+ tr: M,
142
+ productWriteApproval: F
143
+ }), Oa = An({
144
+ approve: (e, t) => U.approve(e, t),
145
+ decline: (e, t, n) => U.decline(e, t, n),
146
+ presented: (e, t) => U.presented(e, t)
147
+ }), ka = Oa.dismiss, Aa = O(null);
147
148
  D(() => {
148
- Da();
149
- let e = Oa.current;
150
- Oa.current = B, e && e !== B && W.withdraw(e, "conversation_closed"), B && W.openConversation(B);
149
+ ka();
150
+ let e = Aa.current;
151
+ Aa.current = z, e && e !== z && U.withdraw(e, "conversation_closed"), z && U.openConversation(z);
151
152
  }, [
152
- B,
153
- W,
154
- Da
153
+ z,
154
+ U,
155
+ ka
155
156
  ]);
156
- let ka = Kn(U), Aa = ar(U)?.archivedAt != null, ja = Jn((e) => B !== null && B in e.loadingIds), Ma = Jn((e) => B !== null && B in e.loadErrorIds), Na = Jn((e) => e.remoteDelete), [Pa, Fa] = A(() => Jn.getState().remoteDelete?.at ?? null), Ia = Na?.wasActive === !0 && Na.at !== Pa ? Na.at : null;
157
+ let ja = qn(H), Ma = or(H)?.archivedAt != null, Na = Yn((e) => z !== null && z in e.loadingIds), Pa = Yn((e) => z !== null && z in e.loadErrorIds), Fa = Yn((e) => e.remoteDelete), [Ia, La] = k(() => Yn.getState().remoteDelete?.at ?? null), Ra = Fa?.wasActive === !0 && Fa.at !== Ia ? Fa.at : null;
157
158
  D(() => {
158
- if (Ia === null) return;
159
- let e = window.setTimeout(() => Fa(Ia), Ei);
159
+ if (Ra === null) return;
160
+ let e = window.setTimeout(() => La(Ra), Oi);
160
161
  return () => window.clearTimeout(e);
161
- }, [Ia]);
162
- let { canUseApiCalls: La, loading: Ra } = vr(C(), R), za = k(Tt({
163
- loading: Ra,
164
- canUseAdminModes: La
165
- })).current, Ba = k(F);
162
+ }, [Ra]);
163
+ let { canUseApiCalls: za, loading: Ba } = yr(C(), L), Va = O(Tt({
164
+ loading: Ba,
165
+ canUseAdminModes: za
166
+ })).current, Ha = O(P);
166
167
  D(() => {
167
- Ba.current = F;
168
- }, [F]);
169
- let Va = () => {
168
+ Ha.current = P;
169
+ }, [P]);
170
+ let Ua = () => {
170
171
  let e = _.getState().activeConversationId;
171
- e && Yn.openConversation(e, { modes: Ba.current });
172
- }, Ha = () => {
172
+ e && Xn.openConversation(e, { modes: Ha.current });
173
+ }, Wa = () => {
173
174
  let e = _.getState().activeConversationId;
174
- e && Yn.loadEarlier(e);
175
- }, Ua = k(L);
175
+ e && Xn.loadEarlier(e);
176
+ }, Ga = O(I);
176
177
  D(() => {
177
- Ua.current = L;
178
- }, [L]);
179
- let Wa = !!P && Fi !== !1;
178
+ Ga.current = I;
179
+ }, [I]);
180
+ let Ka = !!N && Li !== !1;
180
181
  D(() => {
181
- if (Wa) return wr({ send: (e) => Cr(e, {
182
+ if (Ka) return Tr({ send: (e) => wr(e, {
182
183
  workspaceId: C(),
183
184
  authContext: {
184
- accessToken: Ua.current(),
185
+ accessToken: Ga.current(),
185
186
  organizationId: Mt()
186
187
  }
187
188
  }) });
188
- }, [Wa]), D(() => {
189
- za.update({
190
- loading: Ra,
191
- canUseAdminModes: La
189
+ }, [Ka]), D(() => {
190
+ Va.update({
191
+ loading: Ba,
192
+ canUseAdminModes: za
192
193
  });
193
194
  }, [
194
- za,
195
- Ra,
196
- La
195
+ Va,
196
+ Ba,
197
+ za
197
198
  ]), D(() => () => {
198
- za.abandon();
199
- }, [za]);
200
- let Ga = O(() => F.filter((e) => !e.requiresAdmin || La), [F, La]), Ka = p(Ga), qa = ma && Ka, Ja = k(Ka);
199
+ Va.abandon();
200
+ }, [Va]);
201
+ let qa = xi(() => P.filter((e) => !e.requiresAdmin || za), [P, za]), Ja = p(qa), Ya = ga && Ja, Xa = O(Ja);
201
202
  D(() => {
202
- Ja.current = Ka;
203
- }, [Ka]);
204
- let Ya = k(null), Xa = k(!1), [Za, Qa] = A(!1), $a = pt(F), [eo, to] = A(null), [no, ro] = A(null), io = no !== null && no === B, G = vn(), ao = yn(), K = G.open && ao !== null, oo = G.close, so = k(K);
205
- yi(() => {
206
- so.current = K;
207
- }, [K]);
208
- let co = E((e) => {
209
- e && so.current || ro(e ? _.getState().activeConversationId : null);
203
+ Xa.current = Ja;
204
+ }, [Ja]);
205
+ let Za = O(null), Qa = O(!1), [$a, eo] = k(!1), to = pt(P), [no, ro] = k(null), [io, ao] = k(null), oo = io !== null && io === z, W = vn(), so = yn(), G = W.open && so !== null, co = W.close, lo = O(G);
206
+ bi(() => {
207
+ lo.current = G;
208
+ }, [G]);
209
+ let uo = E((e) => {
210
+ e && lo.current || ao(e ? _.getState().activeConversationId : null);
210
211
  }, []);
211
212
  D(() => {
212
- ro((e) => e !== null && e !== B ? null : e);
213
- }, [B]);
214
- let lo = k(void 0), [uo, fo] = A(!1), po = E((e) => {
215
- lo.current = e, fo(it(e));
216
- }, []), mo = E(() => {
213
+ ao((e) => e !== null && e !== z ? null : e);
214
+ }, [z]);
215
+ let fo = O(void 0), [po, mo] = k(!1), ho = E((e) => {
216
+ fo.current = e, mo(it(e));
217
+ }, []), go = E(() => {
217
218
  let e = _.getState(), t = e.activeConversationId, n = t ? e.conversations.find((e) => e.id === t) : void 0;
218
219
  return !t || !n ? null : {
219
220
  id: t,
220
- reusableDraft: qn(n, re()),
221
- liveProposals: W.liveFor(t).count,
221
+ reusableDraft: Jn(n, re()),
222
+ liveProposals: U.liveFor(t).count,
222
223
  turnInFlight: Pt(e.processingByConversationId[t]?.status)
223
224
  };
224
- }, [W]), ho = k({}), q = k(Cn()), J = k(new Tr()), go = k(/* @__PURE__ */ new Set()), _o = O(() => F.find((e) => e.id === V), [F, V]), vo = _((e) => {
225
- let t = e.sandboxesByMode[V]?.sandboxId;
225
+ }, [U]), _o = O({}), K = O(Cn()), q = O(new Er()), vo = O(/* @__PURE__ */ new Set()), yo = xi(() => P.find((e) => e.id === B), [P, B]), bo = _((e) => {
226
+ let t = e.sandboxesByMode[B]?.sandboxId;
226
227
  return t ? e.sandboxWriteCapabilities[t] : void 0;
227
- }), yo = _o !== void 0 && vt({
228
- mode: V,
229
- productWriteApproval: I,
230
- capabilities: vo
231
- }), bo = V === "assistant" || _o !== void 0 && !_o.writeCapable && !xe(V) || yo;
228
+ }), xo = yo !== void 0 && vt({
229
+ mode: B,
230
+ productWriteApproval: F,
231
+ capabilities: bo
232
+ }), So = B === "assistant" || yo !== void 0 && !yo.writeCapable && !xe(B) || xo;
232
233
  D(() => {
233
- if (V !== "assistant" && _o?.writeCapable && !ue(fa, V)) {
234
- $i("assistant");
234
+ if (B !== "assistant" && yo?.writeCapable && !ue(ma, B)) {
235
+ ta("assistant");
235
236
  return;
236
237
  }
237
- Ra || (!_o || _o.requiresAdmin && !La) && V !== "assistant" && $i("assistant");
238
+ Ba || (!yo || yo.requiresAdmin && !za) && B !== "assistant" && ta("assistant");
238
239
  }, [
239
- V,
240
- _o,
241
- La,
242
- Ra,
243
- $i,
244
- fa
240
+ B,
241
+ yo,
242
+ za,
243
+ Ba,
244
+ ta,
245
+ ma
245
246
  ]);
246
- let xo = E((e, t, n, r) => {
247
- oa(e, n, t, null, r);
248
- }, [oa]), So = E(async (e, t, n, r, i, a = null) => {
247
+ let Co = E((e, t, n, r) => {
248
+ ca(e, n, t, null, r);
249
+ }, [ca]), wo = E(async (e, t, n, r, i, a = null) => {
249
250
  let o = (e, t) => {
250
- r && xo(r.conversationId, r.assistantMessageId, e, t), a && (a.step = t, a.onStep?.(t));
251
+ r && Co(r.conversationId, r.assistantMessageId, e, t), a && (a.step = t, a.onStep?.(t));
251
252
  }, s = (e) => {
252
253
  r && T(r.assistantMessageId, e);
253
254
  }, c = () => {
254
255
  s("bootAdopted"), a?.beginBoot();
255
256
  }, l = () => a !== null && (a.signal.aborted || C() !== t), d = () => {
256
- if (l()) throw new Er("cancelled");
257
+ if (l()) throw new Dr("cancelled");
257
258
  }, f = _.getState().sandboxesByMode[e]?.sandboxId ?? null, ee = !1, te = !1, p = !1, ne = !1, re = !1, ie = async (r) => {
258
- if (i && !J.current.has(r) && q.current.isFresh(r)) return ee = !0, !0;
259
+ if (i && !q.current.has(r) && K.current.isFresh(r)) return ee = !0, !0;
259
260
  p = !0;
260
261
  let o = !1;
261
262
  try {
@@ -263,43 +264,43 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
263
264
  o = !0, c();
264
265
  });
265
266
  } catch {
266
- if (l()) throw new Er("cancelled");
267
- return q.current.invalidate(r), J.current.add(r), a?.dead.push(r), re = !0, !1;
267
+ if (l()) throw new Dr("cancelled");
268
+ return K.current.invalidate(r), q.current.add(r), a?.dead.push(r), re = !0, !1;
268
269
  }
269
- return d(), q.current.markVerified(r), o && (ne = !0), !0;
270
+ return d(), K.current.markVerified(r), o && (ne = !0), !0;
270
271
  };
271
- if (f && (ua(e, f, "provisioning"), o("provisioning", "reusingEnvironment"), await ie(f) || (ua(e, null, "provisioning"), f = null)), !f) {
272
+ if (f && (fa(e, f, "provisioning"), o("provisioning", "reusingEnvironment"), await ie(f) || (fa(e, null, "provisioning"), f = null)), !f) {
272
273
  o("provisioning", "lookingForEnvironment");
273
- let r = await _e(t, P, e, mi(), n, J.current, I);
274
+ let r = await _e(t, N, e, hi(), n, q.current, F);
274
275
  d();
275
276
  let i = r?.id ?? null;
276
277
  if (i) {
277
- ua(e, i, "provisioning"), o("provisioning", "reusingEnvironment");
278
+ fa(e, i, "provisioning"), o("provisioning", "reusingEnvironment");
278
279
  let t = r?.status === "PROVISIONING" || r?.status === "PENDING";
279
- t && c(), await ie(i) ? (f = i, t && (ne = !0)) : ua(e, null, "provisioning");
280
+ t && c(), await ie(i) ? (f = i, t && (ne = !0)) : fa(e, null, "provisioning");
280
281
  }
281
282
  }
282
283
  if (!f) {
283
- if (a && !a.mayCreate) throw new Er("no-create");
284
- if (s("provisionStarted"), e === "api-calls" && !L()) throw Error("API Calls mode requires an authenticated session. Please sign in again.");
285
- o("provisioning", "startingEnvironment"), ua(e, null, "provisioning");
286
- let r = a ? [] : await we(t, P, e, mi(), n, J.current, I);
284
+ if (a && !a.mayCreate) throw new Dr("no-create");
285
+ if (s("provisionStarted"), e === "api-calls" && !I()) throw Error("API Calls mode requires an authenticated session. Please sign in again.");
286
+ o("provisioning", "startingEnvironment"), fa(e, null, "provisioning");
287
+ let r = a ? [] : await we(t, N, e, hi(), n, q.current, F);
287
288
  if (r.length > 0) {
288
289
  let e = new Set(r);
289
- for (let e of r) q.current.invalidate(e), J.current.add(e);
290
+ for (let e of r) K.current.invalidate(e), q.current.add(e);
290
291
  let t = _.getState().sandboxesByMode;
291
- for (let [n, r] of Object.entries(t)) u(n) && r?.sandboxId && e.has(r.sandboxId) && da(n);
292
+ for (let [n, r] of Object.entries(t)) u(n) && r?.sandboxId && e.has(r.sandboxId) && pa(n);
292
293
  }
293
294
  s("createRequested");
294
295
  let i = a?.beginCreate();
295
296
  try {
296
- f = await me(P, e, t, mi(), Ci, n, { writeApproval: I });
297
+ f = await me(N, e, t, hi(), Ti, n, { writeApproval: F });
297
298
  } finally {
298
299
  i?.();
299
300
  }
300
- te = !0, d(), ua(e, f, "provisioning"), await De(f, t, n, 3e5), d(), s("sandboxRunning"), await Ee(f, t, e, n, 9e4), d(), s("serviceReady"), q.current.markVerified(f);
301
+ te = !0, d(), fa(e, f, "provisioning"), await De(f, t, n, 3e5), d(), s("sandboxRunning"), await Ee(f, t, e, n, 9e4), d(), s("serviceReady"), K.current.markVerified(f);
301
302
  }
302
- return ua(e, f, "running"), {
303
+ return fa(e, f, "running"), {
303
304
  sandboxId: f,
304
305
  sandboxIsNew: te,
305
306
  sandboxProbed: p,
@@ -308,20 +309,20 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
308
309
  trustedFromCache: ee
309
310
  };
310
311
  }, [
311
- da,
312
- L,
313
- P,
312
+ pa,
314
313
  I,
315
- ua,
316
- xo
317
- ]), Co = E(async function e(t, n, r, i, a, o = {}) {
318
- let s = await Mr(i, r, (e) => xo(t, n, "provisioning", e), () => T(n, "prewarmJoined"));
319
- for (let e of s.dead) q.current.invalidate(e), J.current.add(e);
320
- s.verified && !J.current.has(s.verified) && q.current.markVerified(s.verified), s.joined && w(n, { prewarm: s.joined });
321
- let { sandboxId: c, sandboxIsNew: l, sandboxProbed: u, sandboxAdopted: d, deadSandboxProbe: f, trustedFromCache: ee } = await So(r, i, a, {
314
+ N,
315
+ F,
316
+ fa,
317
+ Co
318
+ ]), To = E(async function e(t, n, r, i, a, o = {}) {
319
+ let s = await Nr(i, r, (e) => Co(t, n, "provisioning", e), () => T(n, "prewarmJoined"));
320
+ for (let e of s.dead) K.current.invalidate(e), q.current.add(e);
321
+ s.verified && !q.current.has(s.verified) && K.current.markVerified(s.verified), s.joined && w(n, { prewarm: s.joined });
322
+ let { sandboxId: c, sandboxIsNew: l, sandboxProbed: u, sandboxAdopted: d, deadSandboxProbe: f, trustedFromCache: ee } = await wo(r, i, a, {
322
323
  conversationId: t,
323
324
  assistantMessageId: n
324
- }, o.trustCache !== !1), te = Or(i, r, c);
325
+ }, o.trustCache !== !1), te = kr(i, r, c);
325
326
  !s.waited && te && w(n, { prewarm: "hit" });
326
327
  let p = _.getState().conversations.find((e) => e.id === t)?.backendSessionId ?? null, ne = !1, re = null;
327
328
  if (p) {
@@ -331,36 +332,36 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
331
332
  if (t.mode !== r) throw Error(`Session mode mismatch: expected ${r}, received ${t.mode}`);
332
333
  re = e;
333
334
  } catch {
334
- la(t), p = null;
335
+ da(t), p = null;
335
336
  }
336
337
  }
337
338
  let ie = !1;
338
339
  if (!p) {
339
- let e = Dr(kr({
340
+ let e = Or(Ar({
340
341
  workspaceId: i,
341
342
  mode: r,
342
343
  sandboxId: c,
343
- userId: R
344
+ userId: L
344
345
  }), Date.now());
345
346
  if (e) {
346
- "pending" in e && xo(t, n, "connecting", "preparingSession");
347
+ "pending" in e && Co(t, n, "connecting", "preparingSession");
347
348
  let o = "sessionId" in e ? e.sessionId : await e.pending;
348
- if (o && !J.current.has(c)) try {
349
- (await y(c, i, o, r, a)).mode === r && (p = o, ie = !0, ca(t, p), ne = !0);
349
+ if (o && !q.current.has(c)) try {
350
+ (await y(c, i, o, r, a)).mode === r && (p = o, ie = !0, ua(t, p), ne = !0);
350
351
  } catch {}
351
352
  }
352
353
  }
353
354
  if (!p) {
354
- xo(t, n, "connecting", "preparingSession");
355
+ Co(t, n, "connecting", "preparingSession");
355
356
  let s;
356
357
  try {
357
358
  s = await he(c, i, r, a);
358
359
  } catch (s) {
359
360
  if (ee) {
360
- q.current.invalidate(c);
361
+ K.current.invalidate(c);
361
362
  let l = Tn(s, o.isAbandoned?.() ?? !1), ee = l === "check-network";
362
- if (l === "check-network" && (l = await wn(() => _e(i, P, r, mi(), a, J.current, I))), l !== "rethrow" && o.isAbandoned?.() && (l = "rethrow"), l !== "rethrow") {
363
- ee || w(n, { cacheProofFailed: !0 }), l === "replace" && (J.current.add(c), la(t), da(r), W.retireSandbox(c));
363
+ if (l === "check-network" && (l = await wn(() => _e(i, N, r, hi(), a, q.current, F))), l !== "rethrow" && o.isAbandoned?.() && (l = "rethrow"), l !== "rethrow") {
364
+ ee || w(n, { cacheProofFailed: !0 }), l === "replace" && (q.current.add(c), da(t), pa(r), U.retireSandbox(c));
364
365
  let s = await e(t, n, r, i, a, {
365
366
  ...o,
366
367
  trustCache: !1
@@ -375,7 +376,7 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
375
376
  }
376
377
  throw s;
377
378
  }
378
- p = s.sessionId, ca(t, p), ne = !0;
379
+ p = s.sessionId, ua(t, p), ne = !0;
379
380
  }
380
381
  return {
381
382
  sandboxId: c,
@@ -389,67 +390,67 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
389
390
  sessionPreopened: ie
390
391
  };
391
392
  }, [
392
- So,
393
- la,
393
+ wo,
394
394
  da,
395
- P,
396
- I,
397
- ca,
398
- xo,
399
- R,
400
- W
401
- ]), wo = E((e, t = !1) => {
395
+ pa,
396
+ N,
397
+ F,
398
+ ua,
399
+ Co,
400
+ L,
401
+ U
402
+ ]), Eo = E((e, t = !1) => {
402
403
  let n = C();
403
404
  if (!n) return;
404
- let r = _.getState(), i = Date.now(), a = jr({
405
+ let r = _.getState(), i = Date.now(), a = Mr({
405
406
  autoRouting: r.autoRouting,
406
- autoOffered: Ja.current,
407
+ autoOffered: Xa.current,
407
408
  active: !t && r.activeConversationId ? r.conversations.find((e) => e.id === r.activeConversationId) : void 0,
408
409
  selectedMode: r.mode,
409
410
  autoReadMode: d,
410
- modes: Ba.current,
411
+ modes: Ha.current,
411
412
  acknowledgedWriteModes: r.acknowledgedWriteModes,
412
- adminAccess: za.read(),
413
+ adminAccess: Va.read(),
413
414
  dictated: e,
414
- voiceProposalBound: (e) => Ri(e),
415
+ voiceProposalBound: (e) => Bi(e),
415
416
  turnInFlight: Object.values(r.processingByConversationId).some((e) => Pt(e?.status)),
416
- ...Fr(n),
417
+ ...Ir(n),
417
418
  now: i
418
419
  });
419
420
  if (!a) return;
420
- let o = Pr(n, a, i), s = {
421
- accessToken: L(),
422
- workspaceToken: zi(),
423
- userId: R,
421
+ let o = Fr(n, a, i), s = {
422
+ accessToken: I(),
423
+ workspaceToken: Vi(),
424
+ userId: L,
424
425
  organizationId: Mt()
425
426
  };
426
- So(a.mode, n, s, null, !0, o).then((e) => {
427
+ wo(a.mode, n, s, null, !0, o).then((e) => {
427
428
  if (o.finish({
428
429
  ok: !0,
429
430
  sandboxId: e.sandboxId,
430
431
  didWork: !e.trustedFromCache && (e.sandboxIsNew || e.sandboxProbed || e.sandboxAdopted),
431
432
  booted: e.sandboxIsNew || e.sandboxAdopted,
432
433
  dead: o.dead
433
- }), o.signal.aborted || C() !== n || J.current.has(e.sandboxId)) return;
434
+ }), o.signal.aborted || C() !== n || q.current.has(e.sandboxId)) return;
434
435
  let r = _.getState(), i = !t && r.activeConversationId ? r.conversations.find((e) => e.id === r.activeConversationId) : void 0, c = re();
435
- Ar({
436
+ jr({
436
437
  active: i ? {
437
438
  mode: i.mode,
438
439
  backendSessionId: i.backendSessionId,
439
- continuable: !Kn(i) && !Gn(i, c),
440
- hasHistory: Wn(i)
440
+ continuable: !qn(i) && !Kn(i, c),
441
+ hasHistory: Gn(i)
441
442
  } : void 0,
442
443
  mode: a.mode
443
- }) && Nr(kr({
444
+ }) && Pr(Ar({
444
445
  workspaceId: n,
445
446
  mode: a.mode,
446
447
  sandboxId: e.sandboxId,
447
- userId: R
448
+ userId: L
448
449
  }), () => he(e.sandboxId, n, a.mode, s).then((e) => e.sessionId), Date.now());
449
450
  }, (e) => {
450
- if (!(e instanceof Er) && !o.signal.aborted && C() === n) {
451
+ if (!(e instanceof Dr) && !o.signal.aborted && C() === n) {
451
452
  let e = _.getState().sandboxesByMode[a.mode]?.sandboxId ?? null;
452
- e && (q.current.invalidate(e), J.current.add(e), o.dead.push(e), da(a.mode));
453
+ e && (K.current.invalidate(e), q.current.add(e), o.dead.push(e), pa(a.mode));
453
454
  }
454
455
  o.finish({
455
456
  ok: !1,
@@ -459,50 +460,50 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
459
460
  });
460
461
  });
461
462
  }, [
462
- So,
463
- za,
464
- da,
463
+ wo,
464
+ Va,
465
+ pa,
466
+ I,
467
+ Vi,
465
468
  L,
466
- zi,
467
- R,
468
- Ri
469
- ]), To = E(() => wo(!1), [wo]), Eo = bi(le, se, se)?.reference ?? null, [Do, Oo] = A(0), ko = k(/* @__PURE__ */ new Set()), Ao = k(null), jo = E(() => {
469
+ Bi
470
+ ]), Do = E(() => Eo(!1), [Eo]), Oo = Si(le, se, se)?.reference ?? null, [ko, Ao] = k(0), jo = O(/* @__PURE__ */ new Set()), Mo = O(null), No = E(() => {
470
471
  let e = _.getState(), t = e.activeConversationId;
471
472
  if (!t) return null;
472
473
  let n = e.processingByConversationId[t], r = Pt(n?.status) ? n?.messageId ?? null : null;
473
474
  if (!It({
474
475
  interruptedTurnId: r,
475
476
  activeTurnId: r,
476
- alreadyRequested: r ? ko.current.has(r) : !1
477
+ alreadyRequested: r ? jo.current.has(r) : !1
477
478
  }).send || !r) return null;
478
- ko.current.add(r);
479
+ jo.current.add(r);
479
480
  let i = fe(e), a = C(), o = e.conversations.find((e) => e.id === t)?.backendSessionId;
480
481
  return !i || !a || !o || pe(i.sandboxId, a, o, i.mode, {
481
- accessToken: L(),
482
- workspaceToken: zi(),
483
- userId: R,
482
+ accessToken: I(),
483
+ workspaceToken: Vi(),
484
+ userId: L,
484
485
  organizationId: Mt()
485
486
  }), r;
486
487
  }, [
487
- R,
488
488
  L,
489
- zi
490
- ]), Mo = E(() => {
491
- let e = jo();
489
+ I,
490
+ Vi
491
+ ]), Po = E(() => {
492
+ let e = No();
492
493
  return e && (Ye(e), Ge.abort(e)), e;
493
- }, [jo]), No = E(() => {
494
+ }, [No]), Fo = E(() => {
494
495
  let e = _.getState().activeConversationId;
495
- Mo(), e && W.declineForReply(e, "corrected", "spoken");
496
- }, [Mo, W]), Po = E(async (e) => {
496
+ Po(), e && U.declineForReply(e, "corrected", "spoken");
497
+ }, [Po, U]), Io = E(async (e) => {
497
498
  let t = _.getState(), n = fe(t), r = C(), i = t.activeConversationId;
498
- if (!n || !r || !i || Mn(t.sandboxWriteCapabilities[n.sandboxId])) return;
499
+ if (!n || !r || !i || Nn(t.sandboxWriteCapabilities[n.sandboxId])) return;
499
500
  let a = t.conversations.find((e) => e.id === i), o = a ? h(He(a.messages), {
500
501
  sessionId: a.backendSessionId,
501
502
  sandboxId: n.sandboxId,
502
503
  nowMs: Date.now()
503
504
  }) : null;
504
505
  if (o?.reference !== e) {
505
- Oo((e) => e + 1);
506
+ Ao((e) => e + 1);
506
507
  return;
507
508
  }
508
509
  let s = {
@@ -512,81 +513,81 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
512
513
  if (!ae(s)) return;
513
514
  try {
514
515
  await v(n.sandboxId, r, e, n.mode, {
515
- accessToken: L(),
516
- workspaceToken: zi(),
517
- userId: R,
516
+ accessToken: I(),
517
+ workspaceToken: Vi(),
518
+ userId: L,
518
519
  organizationId: Mt()
519
520
  });
520
521
  } catch (e) {
521
- oe(s), H(i, {
522
- id: M(),
522
+ oe(s), V(i, {
523
+ id: j(),
523
524
  role: "system",
524
525
  content: e instanceof Error ? e.message : "The change could not be approved.",
525
526
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
526
527
  });
527
528
  return;
528
529
  }
529
- oe(s), aa(i, o.messageId, { pendingWriteApprovedAt: (/* @__PURE__ */ new Date()).toISOString() });
530
+ oe(s), sa(i, o.messageId, { pendingWriteApprovedAt: (/* @__PURE__ */ new Date()).toISOString() });
530
531
  let c = _.getState(), l = c.conversations.find((e) => e.id === i);
531
- c.activeConversationId !== i || !l || c.mode !== n.mode || l.backendSessionId !== a?.backendSessionId || fe(c)?.sandboxId !== n.sandboxId || Pt(c.processingByConversationId[i]?.status) || m(He(l.messages)) !== o.messageId || Ls.current(N("pendingWrite.approvedPrompt", "I approved that change — go ahead."), [], {
532
+ c.activeConversationId !== i || !l || c.mode !== n.mode || l.backendSessionId !== a?.backendSessionId || fe(c)?.sandboxId !== n.sandboxId || Pt(c.processingByConversationId[i]?.status) || m(He(l.messages)) !== o.messageId || zs.current(M("pendingWrite.approvedPrompt", "I approved that change — go ahead."), [], {
532
533
  approvalFollowUp: { approvedReplyId: o.messageId },
533
534
  targetConversationId: i
534
535
  });
535
536
  }, [
536
- R,
537
- H,
538
- aa,
539
- N
540
- ]), Fo = t(), { speakFinishedReply: Io, speakingMessageId: Lo, stop: Ro } = _n(), zo = k(null), Bo = E((e, t) => {
541
- let n = zo.current;
537
+ L,
538
+ V,
539
+ sa,
540
+ M
541
+ ]), Lo = t(), { speakFinishedReply: Ro, speakingMessageId: zo, stop: Bo } = _n(), Vo = O(null), Ho = E((e, t) => {
542
+ let n = Vo.current;
542
543
  n?.token === e && n.exchange === null && (n.exchange = t);
543
- }, []), Vo = E((e) => {
544
- let t = zo.current;
544
+ }, []), Uo = E((e) => {
545
+ let t = Vo.current;
545
546
  e !== void 0 && t?.token === e && (t.handled = !0);
546
- }, []), Ho = E((e, t) => {
547
- Bo(e, t), so.current && Ke(t);
548
- }, [Bo]), Uo = o(), { items: Wo, permissionsSettled: Go, simulating: Ko } = vi(), Y = k({
549
- theme: Fo,
550
- navigate: Uo,
551
- navItems: Wo,
552
- options: Li ?? {},
553
- navPermissionsSettled: Go,
554
- navSimulating: Ko
547
+ }, []), Wo = E((e, t) => {
548
+ Ho(e, t), lo.current && Ke(t);
549
+ }, [Ho]), Go = o(), { items: Ko, permissionsSettled: qo, simulating: Jo } = yi(), J = O({
550
+ theme: Lo,
551
+ navigate: Go,
552
+ navItems: Ko,
553
+ options: zi ?? {},
554
+ navPermissionsSettled: qo,
555
+ navSimulating: Jo
555
556
  });
556
557
  D(() => {
557
- Y.current = {
558
- theme: Fo,
559
- navigate: Uo,
560
- navItems: Wo,
561
- options: Li ?? {},
562
- navPermissionsSettled: Go,
563
- navSimulating: Ko
558
+ J.current = {
559
+ theme: Lo,
560
+ navigate: Go,
561
+ navItems: Ko,
562
+ options: zi ?? {},
563
+ navPermissionsSettled: qo,
564
+ navSimulating: Jo
564
565
  };
565
566
  }, [
566
- Fo,
567
- Uo,
568
- Wo,
569
- Li,
567
+ Lo,
570
568
  Go,
571
- Ko
569
+ Ko,
570
+ zi,
571
+ qo,
572
+ Jo
572
573
  ]);
573
- let X = k(!0);
574
- D(() => (X.current = !0, () => {
575
- X.current = !1;
574
+ let Y = O(!0);
575
+ D(() => (Y.current = !0, () => {
576
+ Y.current = !1;
576
577
  }), []);
577
- let qo = k({
578
- tr: N,
579
- locale: z
580
- }), Jo = k(null), [Yo, Xo] = A(null), Zo = k(null), Qo = E((e) => {
581
- Zo.current !== null && (window.clearTimeout(Zo.current), Zo.current = null);
582
- let t = Jo.current;
583
- t && (Jo.current = null, window.clearTimeout(t.deadline), X.current && Xo(null), !(!e || !X.current) && (Zo.current = window.setTimeout(() => {
584
- if (Zo.current = null, !X.current) return;
578
+ let Yo = O({
579
+ tr: M,
580
+ locale: R
581
+ }), Xo = O(null), [Zo, Qo] = k(null), $o = O(null), es = E((e) => {
582
+ $o.current !== null && (window.clearTimeout($o.current), $o.current = null);
583
+ let t = Xo.current;
584
+ t && (Xo.current = null, window.clearTimeout(t.deadline), Y.current && Qo(null), !(!e || !Y.current) && ($o.current = window.setTimeout(() => {
585
+ if ($o.current = null, !Y.current) return;
585
586
  let e = _.getState();
586
587
  if (e.activeConversationId !== t.conversationId) return;
587
588
  let n = e.conversations.find((e) => e.id === t.conversationId)?.messages.find((e) => e.id === t.messageId);
588
589
  if (!n) return;
589
- let r = qo.current, i = tn(n, null, r.tr);
590
+ let r = Yo.current, i = tn(n, null, r.tr);
590
591
  if (i.kind !== "output") return;
591
592
  let a = $t(n, r.tr);
592
593
  Ge.publish(n.id, {
@@ -598,48 +599,48 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
598
599
  final: !0
599
600
  });
600
601
  }, 0)));
601
- }, []), $o = E(() => Qo(!0), [Qo]);
602
+ }, []), ts = E(() => es(!0), [es]);
602
603
  D(() => {
603
- qo.current = {
604
- tr: N,
605
- locale: z
604
+ Yo.current = {
605
+ tr: M,
606
+ locale: R
606
607
  };
607
- let e = Jo.current;
608
+ let e = Xo.current;
608
609
  if (!e) return;
609
610
  let t = en({
610
611
  wanted: e.wanted,
611
- locale: z,
612
- isLoading: Bi(e.wanted),
613
- translatedNow: Zt(N, e.reply).translated
612
+ locale: R,
613
+ isLoading: Hi(e.wanted),
614
+ translatedNow: Zt(M, e.reply).translated
614
615
  });
615
616
  if (t === "write") {
616
- $o();
617
+ ts();
617
618
  return;
618
619
  }
619
620
  if (t === "grace") {
620
- let e = window.setTimeout($o, 400);
621
+ let e = window.setTimeout(ts, 400);
621
622
  return () => window.clearTimeout(e);
622
623
  }
623
624
  }, [
624
- N,
625
- z,
626
- Bi,
627
- Yo,
628
- $o
629
- ]), D(() => () => Qo(!1), [Qo]);
630
- let es = k(null), [ts, ns] = A(!1), [rs, is] = A(null), [Z] = A(() => new ke()), [as, os] = A(0), ss = E(() => os((e) => e + 1), []), cs = E(() => {
631
- let e = Y.current;
625
+ M,
626
+ R,
627
+ Hi,
628
+ Zo,
629
+ ts
630
+ ]), D(() => () => es(!1), [es]);
631
+ let ns = O(null), [rs, is] = k(!1), [as, os] = k(null), [X] = k(() => new ke()), [ss, cs] = k(0), ls = E(() => cs((e) => e + 1), []), us = E(() => {
632
+ let e = J.current;
632
633
  return {
633
- destinations: Vr(e.navItems),
634
+ destinations: Hr(e.navItems),
634
635
  permissionsSettled: e.navPermissionsSettled,
635
636
  simulating: e.navSimulating
636
637
  };
637
- }, []), ls = k(R);
638
+ }, []), ds = O(L);
638
639
  D(() => {
639
- ls.current = R;
640
- }, [R]);
641
- let us = E((e, t) => {
642
- let n = Z.replyIdOf(e), r = n ? Z.turnFor(n) : void 0, i = Z.offer(e), a = {
640
+ ds.current = L;
641
+ }, [L]);
642
+ let fs = E((e, t) => {
643
+ let n = X.replyIdOf(e), r = n ? X.turnFor(n) : void 0, i = X.offer(e), a = {
643
644
  ok: !1,
644
645
  reason: "gone",
645
646
  copy: null,
@@ -649,9 +650,9 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
649
650
  if (!n || !r || !i || i.used) return a;
650
651
  let o = r.conversationId, s = _.getState().conversations.find((e) => e.id === o);
651
652
  if (!s) return a;
652
- let c = s.messages.find((e) => e.id === n), l = c?.metadata?.voice === !0 ? c.metadata.voiceSessionId : void 0, u = Z.liveOffersFor(n, {
653
- registry: cs(),
654
- actorId: ls.current,
653
+ let c = s.messages.find((e) => e.id === n), l = c?.metadata?.voice === !0 ? c.metadata.voiceSessionId : void 0, u = X.liveOffersFor(n, {
654
+ registry: us(),
655
+ actorId: ds.current,
655
656
  conversationId: o,
656
657
  perfNow: performance.now()
657
658
  }).find((t) => t.offer.offerId === e);
@@ -660,46 +661,46 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
660
661
  return {
661
662
  ok: !1,
662
663
  reason: e ? "unavailable" : "expired",
663
- copy: e ? Kt(N, t || null) : Wt(N),
664
+ copy: e ? Kt(M, t || null) : Wt(M),
664
665
  conversationId: o,
665
666
  voiceSessionId: l
666
667
  };
667
668
  }
668
- return Z.markUsed(e) ? (ss(), {
669
+ return X.markUsed(e) ? (ls(), {
669
670
  ok: !0,
670
671
  target: u.target,
671
672
  conversationId: o,
672
673
  voiceSessionId: l
673
674
  }) : a;
674
675
  }, [
675
- Z,
676
- cs,
677
- N,
678
- ss
679
- ]), ds = E((e, t, n, r, i) => {
680
- let a = M();
681
- H(e, {
676
+ X,
677
+ us,
678
+ M,
679
+ ls
680
+ ]), ps = E((e, t, n, r, i) => {
681
+ let a = j();
682
+ V(e, {
682
683
  id: a,
683
684
  role: "system",
684
685
  content: n.text,
685
686
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
686
687
  metadata: {
687
- lang: n.translated ? z : "en",
688
+ lang: n.translated ? R : "en",
688
689
  ...i ? { localAction: i } : {},
689
690
  ...We(t)
690
691
  }
691
- }), i && Yn.recordCommittedEntries(e, [a], "NOTE", r);
692
- }, [H, z]), fs = E((e, t) => (t.status === "kept" || t.status === "refused" && t.reason === "unsaved-changes") && Z.release(e), [Z]), ps = k(null);
692
+ }), i && Xn.recordCommittedEntries(e, [a], "NOTE", r);
693
+ }, [V, R]), ms = E((e, t) => (t.status === "kept" || t.status === "refused" && t.reason === "unsaved-changes") && X.release(e), [X]), hs = O(null);
693
694
  D(() => () => {
694
- ps.current?.(), ps.current = null;
695
+ hs.current?.(), hs.current = null;
695
696
  }, []);
696
- let ms = E((e) => {
697
- ps.current?.(), ps.current = X.current ? nr(document, e) : null;
698
- }, []), hs = E((e, t, n, r = !1) => {
699
- if (es.current !== null) return;
700
- let i = us(e, n), a = C(), o = (e, t, n, r) => ds(e, t, n, a, r);
697
+ let gs = E((e) => {
698
+ hs.current?.(), hs.current = Y.current ? rr(document, e) : null;
699
+ }, []), _s = E((e, t, n, r = !1) => {
700
+ if (ns.current !== null) return;
701
+ let i = fs(e, n), a = C(), o = (e, t, n, r) => ps(e, t, n, a, r);
701
702
  if (!i.ok) {
702
- i.copy && i.conversationId && o(i.conversationId, i.voiceSessionId, i.copy), ss();
703
+ i.copy && i.conversationId && o(i.conversationId, i.voiceSessionId, i.copy), ls();
703
704
  return;
704
705
  }
705
706
  let { target: s, conversationId: c, voiceSessionId: l } = i, u = {
@@ -707,7 +708,7 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
707
708
  offerId: e
708
709
  };
709
710
  if (r) {
710
- o(c, l, Ht(N, s.label, !0), Jr({
711
+ o(c, l, Ht(M, s.label, !0), Yr({
711
712
  destinationId: s.id,
712
713
  path: s.path,
713
714
  alreadyHere: !0,
@@ -716,17 +717,17 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
716
717
  }));
717
718
  return;
718
719
  }
719
- let d = M();
720
- es.current = d, ns(!0);
720
+ let d = j();
721
+ ns.current = d, is(!0);
721
722
  let f = (t) => {
722
723
  try {
723
- if (fs(e, t) && (ss(), t.status === "kept" && ms(e)), t.status === "kept" || !_.getState().conversations.some((e) => e.id === c)) return;
724
+ if (ms(e, t) && (ls(), t.status === "kept" && gs(e)), t.status === "kept" || !_.getState().conversations.some((e) => e.id === c)) return;
724
725
  let n = t.status === "arrived" || t.status === "redirected" ? t.landedPath : null;
725
- o(c, l, Ut(N, t, {
726
+ o(c, l, Ut(M, t, {
726
727
  page: s.label,
727
- landed: n === null ? null : Xr(Vr(Y.current.navItems), n),
728
+ landed: n === null ? null : Zr(Hr(J.current.navItems), n),
728
729
  path: s.path
729
- }), Jr({
730
+ }), Yr({
730
731
  destinationId: s.id,
731
732
  path: s.path,
732
733
  alreadyHere: !1,
@@ -735,89 +736,89 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
735
736
  offer: u
736
737
  }));
737
738
  } finally {
738
- es.current === d && (es.current = null, X.current && ns(!1));
739
+ ns.current === d && (ns.current = null, Y.current && is(!1));
739
740
  }
740
741
  };
741
- Gr(Y.current.navigate, s.path, {
742
+ Kr(J.current.navigate, s.path, {
742
743
  readPath: () => window.location.pathname + window.location.search,
743
744
  now: () => Date.now(),
744
745
  schedule: (e, t) => {
745
746
  window.setTimeout(e, t);
746
747
  },
747
- isShellLess: () => !X.current,
748
+ isShellLess: () => !Y.current,
748
749
  initiator: t === "tap" ? "person" : "assistant",
749
750
  surface: "offer"
750
751
  }).then(f, () => f({ status: "unconfirmed" }));
751
752
  }, [
752
- us,
753
- ds,
754
- N,
755
- ss,
756
753
  fs,
757
- ms
758
- ]), gs = E((e, t) => hs(e, "tap", t || null), [hs]), _s = E((e) => {
759
- let { replyId: t, conversationId: n } = e, r = Z.turnFor(t);
754
+ ps,
755
+ M,
756
+ ls,
757
+ ms,
758
+ gs
759
+ ]), vs = E((e, t) => _s(e, "tap", t || null), [_s]), ys = E((e) => {
760
+ let { replyId: t, conversationId: n } = e, r = X.turnFor(t);
760
761
  if (!r) return;
761
- let i = window.location.pathname + window.location.search, a = Vr(Y.current.navItems), o = si({
762
+ let i = window.location.pathname + window.location.search, a = Hr(J.current.navItems), o = ci({
762
763
  intent: e.intent,
763
- live: Z.liveOffersFor(t, {
764
- registry: cs(),
765
- actorId: ls.current,
764
+ live: X.liveOffersFor(t, {
765
+ registry: us(),
766
+ actorId: ds.current,
766
767
  conversationId: n,
767
768
  perfNow: performance.now()
768
769
  }),
769
- unusedCount: Z.offersFor(t).filter((e) => !e.used).length,
770
- pendingProposals: W.liveFor(n).count,
770
+ unusedCount: X.offersFor(t).filter((e) => !e.used).length,
771
+ pendingProposals: U.liveFor(n).count,
771
772
  turnWriteCapable: r.writeCapable,
772
773
  atSend: e.atSend,
773
774
  now: {
774
775
  location: i,
775
776
  conversationId: _.getState().activeConversationId,
776
777
  workspaceId: C(),
777
- actorId: ls.current ?? null
778
+ actorId: ds.current ?? null
778
779
  },
779
- mounted: X.current,
780
+ mounted: Y.current,
780
781
  visible: document.visibilityState === "visible",
781
- unsavedChanges: ci(Y.current.options),
782
+ unsavedChanges: li(J.current.options),
782
783
  alreadyThere: ({ target: e }) => {
783
784
  let t = a.find((t) => t.id === e.id);
784
- return t ? Rr(t, i, a) : !1;
785
+ return t ? zr(t, i, a) : !1;
785
786
  }
786
787
  });
787
788
  if (o.act === "navigate" || o.act === "already-here") {
788
- hs(o.offer.offer.offerId, "resolve", o.offer.target.label, o.act === "already-here");
789
+ _s(o.offer.offer.offerId, "resolve", o.offer.target.label, o.act === "already-here");
789
790
  return;
790
791
  }
791
- let [s] = o.unsaved ?? [], [c] = Z.liveOffersFor(t, {
792
- registry: cs(),
793
- actorId: ls.current,
792
+ let [s] = o.unsaved ?? [], [c] = X.liveOffersFor(t, {
793
+ registry: us(),
794
+ actorId: ds.current,
794
795
  conversationId: n,
795
796
  perfNow: performance.now()
796
797
  });
797
- o.hold === "R5-unsaved" && s && c && ds(n, e.voiceSessionId, Gt(N, s.label, c.target.label), C());
798
+ o.hold === "R5-unsaved" && s && c && ps(n, e.voiceSessionId, Gt(M, s.label, c.target.label), C());
798
799
  }, [
799
- Z,
800
- cs,
801
- W,
802
- hs,
803
- ds,
804
- N
805
- ]), vs = E((e) => {
800
+ X,
801
+ us,
802
+ U,
803
+ _s,
804
+ ps,
805
+ M
806
+ ]), bs = E((e) => {
806
807
  let t = _.getState(), n = t.conversations.find((e) => e.id === t.activeConversationId);
807
- return n ? qr(Kr, window.location.pathname, Zr(n.messages, e)) : !1;
808
- }, []), ys = E((e, t, n = !1) => {
809
- let { navItems: r, options: i } = Y.current, a = Vr(r), o = null, s = {
808
+ return n ? Jr(qr, window.location.pathname, Qr(n.messages, e)) : !1;
809
+ }, []), xs = E((e, t, n = !1) => {
810
+ let { navItems: r, options: i } = J.current, a = Hr(r), o = null, s = {
810
811
  ...i,
811
- locale: t === void 0 ? z : qi.input.code,
812
- uiLocale: z,
813
- inputLocale: qi.input.code
812
+ locale: t === void 0 ? R : Yi.input.code,
813
+ uiLocale: R,
814
+ inputLocale: Yi.input.code
814
815
  };
815
- if (Br(e, s)) {
816
- let e = _.getState(), n = e.conversations.find((t) => t.id === e.activeConversationId), s = n ? $r(n.messages, t, { lookThroughRefusedOffers: { ownsOffer: (e, t) => Z.offersFor(e.id).some((e) => e.offerId === t) } }) : null, c = n ? e.processingByConversationId[n.id] ?? null : null, l = c !== null && c.messageId === s?.id && Pt(c.status);
816
+ if (Vr(e, s)) {
817
+ let e = _.getState(), n = e.conversations.find((t) => t.id === e.activeConversationId), s = n ? ei(n.messages, t, { lookThroughRefusedOffers: { ownsOffer: (e, t) => X.offersFor(e.id).some((e) => e.offerId === t) } }) : null, c = n ? e.processingByConversationId[n.id] ?? null : null, l = c !== null && c.messageId === s?.id && Pt(c.status);
817
818
  if (n && s && !l) {
818
- let e = Z.liveOffersFor(s.id, {
819
- registry: cs(),
820
- actorId: ls.current,
819
+ let e = X.liveOffersFor(s.id, {
820
+ registry: us(),
821
+ actorId: ds.current,
821
822
  conversationId: n.id,
822
823
  perfNow: performance.now()
823
824
  }).flatMap(({ offer: e, target: t }) => {
@@ -827,36 +828,36 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
827
828
  target: n
828
829
  }] : [];
829
830
  });
830
- o = Qr({
831
+ o = $r({
831
832
  reply: s,
832
- text: fn(s, c, N),
833
+ text: fn(s, c, M),
833
834
  resolve: {
834
835
  destinations: a,
835
836
  entityRoutes: i.entityRoutes,
836
- visibleNavIds: Ir(r),
837
- nounLabel: (e) => Bt(N, e)
837
+ visibleNavIds: Lr(r),
838
+ nounLabel: (e) => Bt(M, e)
838
839
  },
839
840
  offers: e
840
841
  });
841
842
  }
842
843
  }
843
- return zr(e, a, s, {
844
- backRunnable: vs(t),
844
+ return Br(e, a, s, {
845
+ backRunnable: bs(t),
845
846
  navigation: o,
846
847
  skipRecords: n,
847
- controls: Wr()
848
+ controls: Gr()
848
849
  });
849
850
  }, [
850
- vs,
851
- qi,
852
- z,
853
- N,
854
- Z,
855
- cs
856
- ]), bs = E((e, t) => {
857
- let n = ys(e, t);
851
+ bs,
852
+ Yi,
853
+ R,
854
+ M,
855
+ X,
856
+ us
857
+ ]), Ss = E((e, t) => {
858
+ let n = xs(e, t);
858
859
  if (!n) return !1;
859
- let { theme: r, navigate: i } = Y.current;
860
+ let { theme: r, navigate: i } = J.current;
860
861
  switch (n.kind) {
861
862
  case "theme": return r !== null;
862
863
  case "navigate":
@@ -866,40 +867,40 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
866
867
  case "link-not-openable":
867
868
  case "back": return i !== null;
868
869
  case "conversation-delete": return !1;
869
- case "app-control": return li(n.request, { voiceLive: t !== void 0 || Cc.current }) !== null;
870
+ case "app-control": return ui(n.request, { voiceLive: t !== void 0 || wc.current }) !== null;
870
871
  case "open-record": return !1;
871
872
  }
872
- }, [ys]), xs = k(bs);
873
+ }, [xs]), Cs = O(Ss);
873
874
  D(() => {
874
- xs.current = bs;
875
- }, [bs]);
876
- let Ss = E((e, t) => {
875
+ Cs.current = Ss;
876
+ }, [Ss]);
877
+ let ws = E((e, t) => {
877
878
  let n = {
878
879
  state: "none",
879
880
  accept: null
880
- }, { navigate: r, options: i, navItems: a } = Y.current;
881
+ }, { navigate: r, options: i, navItems: a } = J.current;
881
882
  if (!e || r === null || i.uiOffers !== !0) return n;
882
883
  let o = _.getState(), s = o.conversations.find((t) => t.id === e);
883
884
  if (!s) return n;
884
885
  let c = o.processingByConversationId[s.id] ?? null, l = {
885
- registry: cs(),
886
- actorId: ls.current,
886
+ registry: us(),
887
+ actorId: ds.current,
887
888
  conversationId: s.id,
888
889
  perfNow: performance.now()
889
- }, { state: u, reply: d } = ai(Z, {
890
+ }, { state: u, reply: d } = oi(X, {
890
891
  ...l,
891
892
  messages: s.messages,
892
893
  voiceSessionId: t,
893
894
  processing: c,
894
- displayedText: (e) => fn(e, c, N),
895
- productWriteApproval: I,
895
+ displayedText: (e) => fn(e, c, M),
896
+ productWriteApproval: F,
896
897
  capabilitiesOf: (e) => _.getState().sandboxWriteCapabilities[e]
897
898
  });
898
899
  if (u !== "acceptable" || !d) return {
899
900
  state: u,
900
901
  accept: null
901
902
  };
902
- let [f] = Z.liveOffersFor(d.id, l), ee = f ? Vr(a).find((e) => e.id === f.target.id) : void 0;
903
+ let [f] = X.liveOffersFor(d.id, l), ee = f ? Hr(a).find((e) => e.id === f.target.id) : void 0;
903
904
  return !f || !ee ? n : {
904
905
  state: u,
905
906
  accept: {
@@ -908,16 +909,16 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
908
909
  }
909
910
  };
910
911
  }, [
911
- Z,
912
- cs,
913
- I,
914
- N
915
- ]), Cs = E((e, t, n, r, i, a) => {
916
- let o = N(n.key, n.fallback, r), s = n.fallback.replace(/\{\{\s*count\s*\}\}/g, String(r.count)), c = {
912
+ X,
913
+ us,
914
+ F,
915
+ M
916
+ ]), Ts = E((e, t, n, r, i, a) => {
917
+ let o = M(n.key, n.fallback, r), s = n.fallback.replace(/\{\{\s*count\s*\}\}/g, String(r.count)), c = {
917
918
  kind: "write-reply",
918
919
  line: n.key
919
- }, l = (/* @__PURE__ */ new Date()).toISOString(), u = M();
920
- H(e, {
920
+ }, l = (/* @__PURE__ */ new Date()).toISOString(), u = j();
921
+ V(e, {
921
922
  id: u,
922
923
  role: "user",
923
924
  content: t,
@@ -927,67 +928,67 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
927
928
  ...We(i)
928
929
  }
929
930
  });
930
- let d = M();
931
- H(e, {
931
+ let d = j();
932
+ V(e, {
932
933
  id: d,
933
934
  role: "assistant",
934
935
  content: o,
935
936
  timestamp: l,
936
937
  metadata: {
937
- lang: o === s ? "en" : z,
938
+ lang: o === s ? "en" : R,
938
939
  localAction: c,
939
940
  ...We(i)
940
941
  }
941
- }), Yn.recordCommittedEntries(e, [u, d], "LOCAL_COMMAND", C()), a !== void 0 && Ho(a, {
942
+ }), Xn.recordCommittedEntries(e, [u, d], "LOCAL_COMMAND", C()), a !== void 0 && Wo(a, {
942
943
  conversationId: e,
943
944
  questionId: u,
944
945
  replyId: d
945
- }), Io(e, d);
946
+ }), Ro(e, d);
946
947
  }, [
947
- H,
948
- z,
949
- Ho,
950
- Io,
951
- N
952
- ]), ws = $n(), Ts = er(), Es = ws?.request ?? null, Ds = k(() => void 0), [Os, ks] = A(null);
948
+ V,
949
+ R,
950
+ Wo,
951
+ Ro,
952
+ M
953
+ ]), Es = er(), Ds = tr(), Os = Es?.request ?? null, ks = O(() => void 0), [As, js] = k(null);
953
954
  D(() => {
954
- if (Os === null) return;
955
- let e = window.setTimeout(() => ks(null), Oi);
955
+ if (As === null) return;
956
+ let e = window.setTimeout(() => js(null), Ai);
956
957
  return () => window.clearTimeout(e);
957
- }, [Os]);
958
- let As = E(() => {
958
+ }, [As]);
959
+ let Ms = E(() => {
959
960
  let e = _.getState();
960
- return na(void 0, e.autoRouting && Ja.current ? d : e.mode, e.autoRouting ? { routedBy: "auto" } : void 0);
961
- }, [na]), js = E((e) => {
962
- if (!Es) return !1;
963
- let t = e !== void 0, n = _.getState(), r = rr({
961
+ return ia(void 0, e.autoRouting && Xa.current ? d : e.mode, e.autoRouting ? { routedBy: "auto" } : void 0);
962
+ }, [ia]), Ns = E((e) => {
963
+ if (!Os) return !1;
964
+ let t = e !== void 0, n = _.getState(), r = ir({
964
965
  spoken: t,
965
- bound: lo.current,
966
+ bound: fo.current,
966
967
  activeConversationId: n.activeConversationId,
967
968
  conversations: n.conversations,
968
- historyOn: Qn()
969
+ historyOn: $n()
969
970
  });
970
- if (r && Es(r), t) {
971
- 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.");
972
- Ds.current({
973
- id: `conversation-delete:${M()}`,
971
+ if (r && Os(r), t) {
972
+ let e = r ? "Opened the delete confirmation. Choose Delete or Cancel on screen." : "There is no conversation to delete.", t = r ? M("deleteConversation.opened", "Opened the delete confirmation. Choose Delete or Cancel on screen.") : M("deleteConversation.nothing", "There is no conversation to delete.");
973
+ ks.current({
974
+ id: `conversation-delete:${j()}`,
974
975
  text: t,
975
- lang: t === e ? "en" : z
976
+ lang: t === e ? "en" : R
976
977
  });
977
- } else r || ks(Date.now());
978
+ } else r || js(Date.now());
978
979
  return !0;
979
980
  }, [
980
- Es,
981
- z,
982
- N
983
- ]), Ms = E((e, t, n, r = !1, i) => {
984
- if (e.kind === "conversation-delete") return js(n);
985
- let { theme: a, navigate: o } = Y.current, s = null, c = () => {
986
- let e = (r ? null : s ?? _.getState().activeConversationId) ?? As();
987
- return r && po(e), e;
981
+ Os,
982
+ R,
983
+ M
984
+ ]), Ps = E((e, t, n, r = !1, i) => {
985
+ if (e.kind === "conversation-delete") return Ns(n);
986
+ let { theme: a, navigate: o } = J.current, s = null, c = () => {
987
+ let e = (r ? null : s ?? _.getState().activeConversationId) ?? Ms();
988
+ return r && ho(e), e;
988
989
  }, l = (e, r) => {
989
- let i = M();
990
- return H(e, {
990
+ let i = j();
991
+ return V(e, {
991
992
  id: i,
992
993
  role: "user",
993
994
  content: t,
@@ -998,44 +999,44 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
998
999
  }
999
1000
  }), i;
1000
1001
  }, u = (e, t, r, a, o, s, c) => {
1001
- let l = c ?? M();
1002
- return H(e, {
1002
+ let l = c ?? j();
1003
+ return V(e, {
1003
1004
  id: l,
1004
1005
  role: "assistant",
1005
1006
  content: r.text,
1006
1007
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1007
1008
  metadata: {
1008
- lang: r.translated ? z : "en",
1009
+ lang: r.translated ? R : "en",
1009
1010
  localAction: a,
1010
1011
  ...We(n)
1011
1012
  }
1012
- }), Yn.recordCommittedEntries(e, [t, l], "LOCAL_COMMAND", o), i !== void 0 && Ho(i, {
1013
+ }), Xn.recordCommittedEntries(e, [t, l], "LOCAL_COMMAND", o), i !== void 0 && Wo(i, {
1013
1014
  conversationId: e,
1014
1015
  questionId: t,
1015
1016
  replyId: l
1016
- }), s && Io(e, l), l;
1017
+ }), s && Ro(e, l), l;
1017
1018
  }, d = (e, t, n) => {
1018
1019
  let r = c(), i = u(r, l(r, t), e, t, C(), !0);
1019
1020
  return n?.(i), !0;
1020
1021
  }, f = (e) => {
1021
- let t = c(), n = C(), r = window.location.pathname, a = l(t, Jr({
1022
+ let t = c(), n = C(), r = window.location.pathname, a = l(t, Yr({
1022
1023
  destinationId: e.destinationId,
1023
1024
  path: e.registryPath,
1024
1025
  alreadyHere: !1,
1025
1026
  via: e.via,
1026
1027
  offer: e.offer
1027
- })), s = i === void 0 ? void 0 : M();
1028
- i !== void 0 && s !== void 0 && (Bo(i, {
1028
+ })), s = i === void 0 ? void 0 : j();
1029
+ i !== void 0 && s !== void 0 && (Ho(i, {
1029
1030
  conversationId: t,
1030
1031
  questionId: a,
1031
1032
  replyId: s
1032
- }), is(s));
1033
- let d = M();
1034
- es.current = d, ns(!0);
1033
+ }), os(s));
1034
+ let d = j();
1035
+ ns.current = d, is(!0);
1035
1036
  let f = (i) => {
1036
1037
  try {
1037
- if (e.offer && fs(e.offer.offerId, i) && ss(), i.status === "kept" || !_.getState().conversations.some((e) => e.id === t)) return;
1038
- let o = Vr(Y.current.navItems), c = i.status === "arrived" || i.status === "redirected" ? i.landedPath : null, l = Jr({
1038
+ if (e.offer && ms(e.offer.offerId, i) && ls(), i.status === "kept" || !_.getState().conversations.some((e) => e.id === t)) return;
1039
+ let o = Hr(J.current.navItems), c = i.status === "arrived" || i.status === "redirected" ? i.landedPath : null, l = Yr({
1039
1040
  destinationId: e.destinationId,
1040
1041
  path: e.registryPath,
1041
1042
  alreadyHere: !1,
@@ -1043,30 +1044,30 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
1043
1044
  outcome: i,
1044
1045
  offer: e.offer
1045
1046
  });
1046
- aa(t, a, { localAction: l });
1047
- let d = u(t, a, e.via === "back" && i.status === "arrived" ? Lt(N, e.pageLabel()) : Ut(N, i, {
1047
+ sa(t, a, { localAction: l });
1048
+ let d = u(t, a, e.via === "back" && i.status === "arrived" ? Lt(M, e.pageLabel()) : Ut(M, i, {
1048
1049
  page: e.pageLabel(),
1049
- landed: c === null ? null : Xr(o, c),
1050
+ landed: c === null ? null : Zr(o, c),
1050
1051
  path: e.target
1051
- }), l, n, X.current, s);
1052
+ }), l, n, Y.current, s);
1052
1053
  i.status === "arrived" && e.onArrived?.({
1053
1054
  replyId: d,
1054
1055
  fromPath: r,
1055
1056
  landedPath: i.landedPath
1056
1057
  });
1057
1058
  } finally {
1058
- es.current === d && (es.current = null, X.current && ns(!1)), s !== void 0 && X.current && is((e) => e === s ? null : e);
1059
+ ns.current === d && (ns.current = null, Y.current && is(!1)), s !== void 0 && Y.current && os((e) => e === s ? null : e);
1059
1060
  }
1060
1061
  };
1061
- return Gr(o, e.target, {
1062
+ return Kr(o, e.target, {
1062
1063
  readPath: () => window.location.pathname + window.location.search,
1063
1064
  now: () => Date.now(),
1064
1065
  schedule: (e, t) => {
1065
1066
  window.setTimeout(e, t);
1066
1067
  },
1067
- isShellLess: () => !X.current
1068
+ isShellLess: () => !Y.current
1068
1069
  }).then(f, () => f({ status: "unconfirmed" })), !0;
1069
- }, ee = ({ replyId: e, fromPath: t, landedPath: n }) => Kr.push({
1070
+ }, ee = ({ replyId: e, fromPath: t, landedPath: n }) => qr.push({
1070
1071
  fromPath: t,
1071
1072
  toPath: n,
1072
1073
  replyMessageId: e,
@@ -1074,21 +1075,21 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
1074
1075
  });
1075
1076
  if (e.kind === "theme") {
1076
1077
  if (!a) return !1;
1077
- let t = Hr(e.request, {
1078
+ let t = Ur(e.request, {
1078
1079
  mode: a.mode,
1079
1080
  resolvedTheme: a.resolvedTheme
1080
1081
  });
1081
1082
  if (!t.alreadyApplied) try {
1082
1083
  a.setMode(t.mode);
1083
1084
  } catch {}
1084
- return d(Xt(N, t, e.request.kind === "family"), {
1085
+ return d(Xt(M, t, e.request.kind === "family"), {
1085
1086
  kind: "theme",
1086
1087
  mode: t.mode,
1087
1088
  alreadyApplied: t.alreadyApplied
1088
1089
  });
1089
1090
  }
1090
1091
  if (e.kind === "app-control") {
1091
- let t = li(e.request, { voiceLive: n !== void 0 || Cc.current });
1092
+ let t = ui(e.request, { voiceLive: n !== void 0 || wc.current });
1092
1093
  if (!t) return !1;
1093
1094
  let r = (e) => ({
1094
1095
  kind: "app-control",
@@ -1096,41 +1097,41 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
1096
1097
  outcome: e.outcome,
1097
1098
  ...e.reply.code === "language" ? { languageLabel: e.reply.label } : {}
1098
1099
  }), i = (t) => {
1099
- if (e.request.control === "language" && Qo(!1), e.request.control === "language" && t.reply.code === "language" && !t.reply.already && t.outcome === "done") {
1100
+ if (e.request.control === "language" && es(!1), e.request.control === "language" && t.reply.code === "language" && !t.reply.already && t.outcome === "done") {
1100
1101
  let n = c(), i = r(t), a = u(n, l(n, i), Zt((e, t) => t, t.reply), i, C(), !1);
1101
- return Jo.current = {
1102
+ return Xo.current = {
1102
1103
  wanted: e.request.code,
1103
1104
  reply: t.reply,
1104
1105
  conversationId: n,
1105
1106
  messageId: a,
1106
- deadline: window.setTimeout($o, Qt)
1107
- }, Xo(a), !0;
1107
+ deadline: window.setTimeout(ts, Qt)
1108
+ }, Qo(a), !0;
1108
1109
  }
1109
- return d(Zt(N, t.reply), r(t));
1110
+ return d(Zt(M, t.reply), r(t));
1110
1111
  };
1111
1112
  if (t.kind === "reply") return i(t.run);
1112
1113
  if (t.kind === "run") {
1113
1114
  let e = t.run();
1114
1115
  return t.silent && (e.outcome === "done" || e.outcome === "already") ? !0 : i(e);
1115
1116
  }
1116
- let a = Ts;
1117
+ let a = Ds;
1117
1118
  if (!a) return !1;
1118
1119
  let o = null;
1119
- return d(Zt(N, t.ask.reply), r(t.ask), (e) => {
1120
+ return d(Zt(M, t.ask.reply), r(t.ask), (e) => {
1120
1121
  o = _.getState().conversations.find((t) => t.messages.some((t) => t.id === e))?.id ?? null;
1121
1122
  }), a.request({
1122
1123
  prompt: t.prompt,
1123
1124
  onConfirm: () => {
1124
1125
  let e = t.confirmed(), i = o, a = i !== null && _.getState().conversations.some((e) => e.id === i);
1125
1126
  if (!i || !a) return;
1126
- let s = Zt(N, e.reply);
1127
- H(i, {
1128
- id: M(),
1127
+ let s = Zt(M, e.reply);
1128
+ V(i, {
1129
+ id: j(),
1129
1130
  role: "assistant",
1130
1131
  content: s.text,
1131
1132
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1132
1133
  metadata: {
1133
- lang: s.translated ? z : "en",
1134
+ lang: s.translated ? R : "en",
1134
1135
  localAction: r(e),
1135
1136
  ...We(n)
1136
1137
  }
@@ -1139,23 +1140,23 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
1139
1140
  }), !0;
1140
1141
  }
1141
1142
  if (!o) return !1;
1142
- if (e.kind === "choose-destination") return d(Rt(N, e.candidates[0]?.label ?? e.query, e.candidates), {
1143
+ if (e.kind === "choose-destination") return d(Rt(M, e.candidates[0]?.label ?? e.query, e.candidates), {
1143
1144
  kind: "choose-destination",
1144
1145
  candidateIds: e.candidates.map((e) => e.id)
1145
- }, (t) => ei(t, e.candidates));
1146
- if (e.kind === "choose-linked") return d(zt(N, e.candidates), {
1146
+ }, (t) => ti(t, e.candidates));
1147
+ if (e.kind === "choose-linked") return d(zt(M, e.candidates), {
1147
1148
  kind: "choose-destination",
1148
1149
  candidateIds: e.candidates.map((e) => e.id)
1149
- }, (t) => ei(t, e.candidates));
1150
+ }, (t) => ti(t, e.candidates));
1150
1151
  if (e.kind === "pick-from-list") {
1151
1152
  let t = e.candidates !== null && e.candidates.every((e) => e !== null) ? e.candidates : null;
1152
- return d(qt(N), t ? {
1153
+ return d(qt(M), t ? {
1153
1154
  kind: "choose-destination",
1154
1155
  candidateIds: t.map((e) => e.id)
1155
1156
  } : e.candidateIds.length > 0 ? {
1156
1157
  kind: "choose-destination",
1157
1158
  candidateIds: [...e.candidateIds]
1158
- } : Jr({
1159
+ } : Yr({
1159
1160
  destinationId: "",
1160
1161
  path: "",
1161
1162
  alreadyHere: !1,
@@ -1164,9 +1165,9 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
1164
1165
  status: "refused",
1165
1166
  reason: "not-routable"
1166
1167
  }
1167
- }), t ? (e) => ei(e, t) : void 0);
1168
+ }), t ? (e) => ti(e, t) : void 0);
1168
1169
  }
1169
- if (e.kind === "link-not-openable") return d(Vt(N), Jr({
1170
+ if (e.kind === "link-not-openable") return d(Vt(M), Yr({
1170
1171
  destinationId: "",
1171
1172
  path: "",
1172
1173
  alreadyHere: !1,
@@ -1179,7 +1180,7 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
1179
1180
  if (e.kind === "open-record") {
1180
1181
  let r;
1181
1182
  try {
1182
- let { options: t, navItems: n } = Y.current, i = t.entityRoutes ?? [], a = Ir(n);
1183
+ let { options: t, navItems: n } = J.current, i = t.entityRoutes ?? [], a = Lr(n);
1183
1184
  r = (t.records ?? []).flatMap((t) => {
1184
1185
  let n = i.find((e) => e.id === t.entityRouteId), r = e.request.adapterIds.length === 0 || e.request.adapterIds.includes(t.id);
1185
1186
  return n && r && (n.visibleWith === void 0 || a.has(n.visibleWith)) ? [{
@@ -1191,28 +1192,28 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
1191
1192
  return !1;
1192
1193
  }
1193
1194
  if (r.length === 0) return !1;
1194
- let i = _.getState().activeConversationId, a = M();
1195
- es.current = a, ns(!0);
1195
+ let i = _.getState().activeConversationId, a = j();
1196
+ ns.current = a, is(!0);
1196
1197
  let o = () => {
1197
- es.current === a && (es.current = null, X.current && ns(!1));
1198
+ ns.current === a && (ns.current = null, Y.current && is(!1));
1198
1199
  };
1199
1200
  return (async () => {
1200
1201
  let a = { kind: "none" }, c = !0;
1201
1202
  try {
1202
- a = await Lr({
1203
+ a = await Rr({
1203
1204
  name: e.request.name,
1204
1205
  usable: r,
1205
- nounOf: (e) => Bt(N, e.noun),
1206
- timeoutMs: Si
1206
+ nounOf: (e) => Bt(M, e.noun),
1207
+ timeoutMs: wi
1207
1208
  }), c = _.getState().conversations.some((e) => e.id === i);
1208
1209
  } catch {
1209
1210
  a = { kind: "none" };
1210
1211
  } finally {
1211
1212
  o();
1212
1213
  }
1213
- if (!X.current) return;
1214
+ if (!Y.current) return;
1214
1215
  if (a.kind === "none") {
1215
- Ls.current(t, [], {
1216
+ zs.current(t, [], {
1216
1217
  fromPerson: !0,
1217
1218
  ...n === void 0 ? {} : { voiceSessionId: n },
1218
1219
  localRecordsChecked: !0
@@ -1233,16 +1234,16 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
1233
1234
  return;
1234
1235
  }
1235
1236
  let l = a.candidates[0];
1236
- d(a.why === "kinds" ? Yt(N, a.nouns, a.candidates) : Jt(N, a.nouns[0] ?? "", l?.label ?? e.request.name, a.candidates), {
1237
+ d(a.why === "kinds" ? Yt(M, a.nouns, a.candidates) : Jt(M, a.nouns[0] ?? "", l?.label ?? e.request.name, a.candidates), {
1237
1238
  kind: "choose-destination",
1238
1239
  candidateIds: a.candidates.map((e) => e.id)
1239
- }, (e) => ei(e, a.candidates));
1240
+ }, (e) => ti(e, a.candidates));
1240
1241
  })().catch(() => void 0), !0;
1241
1242
  }
1242
1243
  if (e.kind === "back") {
1243
- let e = Kr.top();
1244
+ let e = qr.top();
1244
1245
  if (!e) return !1;
1245
- let t = Yr(Vr(Y.current.navItems), e.fromPath);
1246
+ let t = Xr(Hr(J.current.navItems), e.fromPath);
1246
1247
  return f({
1247
1248
  target: e.fromPath,
1248
1249
  destinationId: t?.id ?? "",
@@ -1250,27 +1251,27 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
1250
1251
  via: "back",
1251
1252
  pageLabel: () => t?.label ?? null,
1252
1253
  onArrived: () => {
1253
- Kr.top() === e && Kr.pop();
1254
+ qr.top() === e && qr.pop();
1254
1255
  }
1255
1256
  });
1256
1257
  }
1257
1258
  let te, p = e.destination;
1258
1259
  if (e.via === "offer") {
1259
- let t = us(e.offerId, e.destination.label);
1260
- if (!t.ok) return d(t.copy ?? Wt(N), {
1260
+ let t = fs(e.offerId, e.destination.label);
1261
+ if (!t.ok) return d(t.copy ?? Wt(M), {
1261
1262
  kind: "write-reply",
1262
1263
  line: t.reason === "unavailable" ? "offer.notAvailable" : "offer.expired"
1263
1264
  });
1264
1265
  te = {
1265
1266
  trigger: e.trigger,
1266
1267
  offerId: e.offerId
1267
- }, p = Vr(Y.current.navItems).find((e) => e.id === t.target.id) ?? {
1268
+ }, p = Hr(J.current.navItems).find((e) => e.id === t.target.id) ?? {
1268
1269
  id: t.target.id,
1269
1270
  label: t.target.label,
1270
1271
  path: t.target.path
1271
1272
  };
1272
1273
  }
1273
- return Rr(p, window.location.pathname + window.location.search, Vr(Y.current.navItems)) ? d(Ht(N, p.label, !0), Jr({
1274
+ return zr(p, window.location.pathname + window.location.search, Hr(J.current.navItems)) ? d(Ht(M, p.label, !0), Yr({
1274
1275
  destinationId: p.id,
1275
1276
  path: p.path,
1276
1277
  alreadyHere: !0,
@@ -1286,55 +1287,55 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
1286
1287
  onArrived: ee
1287
1288
  });
1288
1289
  }, [
1289
- H,
1290
- po,
1291
- Ts,
1292
- As,
1293
- $o,
1294
- z,
1295
- aa,
1296
- Bo,
1297
- js,
1290
+ V,
1291
+ ho,
1292
+ Ds,
1293
+ Ms,
1294
+ ts,
1295
+ R,
1296
+ sa,
1298
1297
  Ho,
1299
- Qo,
1300
- Io,
1301
- N,
1302
- us,
1298
+ Ns,
1299
+ Wo,
1300
+ es,
1301
+ Ro,
1302
+ M,
1303
1303
  fs,
1304
- ss
1305
- ]), Ns = E(async (e) => {
1306
- Xa.current = !0, Qa(!0);
1304
+ ms,
1305
+ ls
1306
+ ]), Fs = E(async (e) => {
1307
+ Qa.current = !0, eo(!0);
1307
1308
  try {
1308
- await W.declineForReply(e.conversationId, e.reason, e.origin);
1309
+ await U.declineForReply(e.conversationId, e.reason, e.origin);
1309
1310
  } finally {
1310
- Xa.current = !1, X.current && Qa(!1);
1311
+ Qa.current = !1, Y.current && eo(!1);
1311
1312
  }
1312
1313
  if (e.commandText !== null) {
1313
- let t = ys(e.commandText, e.options.voiceSessionId);
1314
- if (t && Ms(t, e.content, e.options.voiceSessionId)) return;
1314
+ let t = xs(e.commandText, e.options.voiceSessionId);
1315
+ if (t && Ps(t, e.content, e.options.voiceSessionId)) return;
1315
1316
  }
1316
- await Ls.current(e.content, e.attachments, e.options);
1317
+ await zs.current(e.content, e.attachments, e.options);
1317
1318
  }, [
1318
- ys,
1319
- Ms,
1320
- W
1321
- ]), Q = E(async (e, t = [], n = {}) => {
1322
- let r = n.voiceSessionId !== void 0, i = _.getState(), a = !1, o = lo.current;
1319
+ xs,
1320
+ Ps,
1321
+ U
1322
+ ]), Z = E(async (e, t = [], n = {}) => {
1323
+ let r = n.voiceSessionId !== void 0, i = _.getState(), a = !1, o = fo.current;
1323
1324
  if (r && it(o)) {
1324
- let e = S(o, i.activeConversationId, mo());
1325
+ let e = S(o, i.activeConversationId, go());
1325
1326
  if (e.kind === "gone") return;
1326
1327
  let t = n.voiceEntry ?? e;
1327
- t.kind === "adopt" && po(t.conversationId), a = t.kind === "own", n = {
1328
+ t.kind === "adopt" && ho(t.conversationId), a = t.kind === "own", n = {
1328
1329
  ...n,
1329
1330
  voiceEntry: t
1330
1331
  };
1331
1332
  }
1332
- let u = a ? null : i.activeConversationId, d = a ? null : i.activeConversationId ?? B;
1333
+ let u = a ? null : i.activeConversationId, d = a ? null : i.activeConversationId ?? z;
1333
1334
  if (d) {
1334
1335
  if (Pt(i.processingByConversationId[d]?.status)) {
1335
1336
  if (n.avatarTabAsk !== void 0) return;
1336
1337
  let r = i.processingByConversationId[d]?.messageId ?? null;
1337
- r && n.correctsInFlightTurn === !0 && !ko.current.has(r) && Mo(), r && ko.current.has(r) && (Ao.current = {
1338
+ r && n.correctsInFlightTurn === !0 && !jo.current.has(r) && Po(), r && jo.current.has(r) && (Mo.current = {
1338
1339
  conversationId: d,
1339
1340
  content: e,
1340
1341
  attachments: t,
@@ -1342,55 +1343,55 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
1342
1343
  });
1343
1344
  return;
1344
1345
  }
1345
- if (go.current.has(d)) return;
1346
+ if (vo.current.has(d)) return;
1346
1347
  }
1347
- if (Ya.current || se() !== null || Xa.current || es.current !== null) return;
1348
- let f = n.targetConversationId, p = re(), ie = (e) => Kn(e) || Gn(e, p);
1348
+ if (Za.current || se() !== null || Qa.current || ns.current !== null) return;
1349
+ let f = n.targetConversationId, p = re(), ie = (e) => qn(e) || Kn(e, p);
1349
1350
  if (f !== void 0) {
1350
1351
  let e = i.conversations.find((e) => e.id === f);
1351
1352
  if (i.activeConversationId !== f || !e || e.mode !== i.mode || ie(e)) return;
1352
1353
  }
1353
1354
  if (n.avatarTabAsk !== void 0) {
1354
1355
  let e = u ? i.conversations.find((e) => e.id === u) : void 0, t = e && !ie(e) ? e : void 0;
1355
- if (mr({
1356
- auto: i.autoRouting && Ja.current && f === void 0,
1356
+ if (hr({
1357
+ auto: i.autoRouting && Xa.current && f === void 0,
1357
1358
  selectedMode: i.mode,
1358
1359
  conversation: t ? {
1359
1360
  mode: t.mode,
1360
1361
  routedBy: t.routedBy,
1361
- hasHistory: Wn(t)
1362
+ hasHistory: Gn(t)
1362
1363
  } : null,
1363
- modeWrites: (e) => Ba.current.find((t) => t.id === e)?.writeCapable === !0 || xe(e)
1364
+ modeWrites: (e) => Ha.current.find((t) => t.id === e)?.writeCapable === !0 || xe(e)
1364
1365
  }) !== null) return;
1365
1366
  }
1366
1367
  if (n.fromPerson && n.writeReplyBound === void 0) {
1367
- let r = f ?? u ?? null, i = n.voiceSessionId === void 0 ? "typed" : "spoken", o = Ss(r, n.voiceSessionId), s = Nn({
1368
+ let r = f ?? u ?? null, i = n.voiceSessionId === void 0 ? "typed" : "spoken", o = ws(r, n.voiceSessionId), s = Pn({
1368
1369
  text: e,
1369
- locale: i === "spoken" ? qi.input.code : z,
1370
+ locale: i === "spoken" ? Yi.input.code : R,
1370
1371
  origin: i,
1371
1372
  hasAttachments: t.length > 0,
1372
- live: W.liveFor(r),
1373
- matchesLocalCommand: (e) => ys(e, n.voiceSessionId) !== null,
1373
+ live: U.liveFor(r),
1374
+ matchesLocalCommand: (e) => xs(e, n.voiceSessionId) !== null,
1374
1375
  offer: o.state,
1375
- offerAssent: o.state !== "none" && Ur({
1376
+ offerAssent: o.state !== "none" && Wr({
1376
1377
  text: e,
1377
- uiLocale: z,
1378
- inputLocale: qi.input.code,
1379
- commandLocales: Y.current.options.commandLocales,
1380
- manifest: Y.current.options.commandManifest,
1381
- leaveGuard: Y.current.options.leaveGuard
1378
+ uiLocale: R,
1379
+ inputLocale: Yi.input.code,
1380
+ commandLocales: J.current.options.commandLocales,
1381
+ manifest: J.current.options.commandManifest,
1382
+ leaveGuard: J.current.options.leaveGuard
1382
1383
  })
1383
1384
  });
1384
1385
  if (s.kind === "accept_offer") {
1385
1386
  let t = o.accept;
1386
- if (t && Ms({
1387
+ if (t && Ps({
1387
1388
  kind: "navigate",
1388
1389
  destination: t.destination,
1389
1390
  via: "offer",
1390
1391
  offerId: t.offerId,
1391
1392
  trigger: "yes"
1392
1393
  }, e, n.voiceSessionId, a, n.avatarTabAsk)) {
1393
- Vo(n.avatarTabAsk);
1394
+ Uo(n.avatarTabAsk);
1394
1395
  return;
1395
1396
  }
1396
1397
  s = {
@@ -1407,11 +1408,11 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
1407
1408
  };
1408
1409
  }
1409
1410
  if (s.kind === "local_reply") {
1410
- r && Cs(r, e, s.line, s.values, n.voiceSessionId, n.avatarTabAsk);
1411
+ r && Ts(r, e, s.line, s.values, n.voiceSessionId, n.avatarTabAsk);
1411
1412
  return;
1412
1413
  }
1413
1414
  let c = s.kind === "local" ? s.fallback : s.bound, l = s.declineAll;
1414
- if (l !== null && r) return n.avatarTabAsk === void 0 ? Ns({
1415
+ if (l !== null && r) return n.avatarTabAsk === void 0 ? Fs({
1415
1416
  conversationId: r,
1416
1417
  reason: l,
1417
1418
  origin: i,
@@ -1430,55 +1431,55 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
1430
1431
  }
1431
1432
  let ae = n.writeReplyBound?.promptText ?? e;
1432
1433
  if (n.fromPerson && t.length === 0 && n.writeReplyBound?.localCommands !== !1) {
1433
- let t = ys(e, n.voiceSessionId, n.localRecordsChecked === !0);
1434
- if (t && Ms(t, e, n.voiceSessionId, a, n.avatarTabAsk)) {
1435
- Vo(n.avatarTabAsk);
1434
+ let t = xs(e, n.voiceSessionId, n.localRecordsChecked === !0);
1435
+ if (t && Ps(t, e, n.voiceSessionId, a, n.avatarTabAsk)) {
1436
+ Uo(n.avatarTabAsk);
1436
1437
  return;
1437
1438
  }
1438
1439
  }
1439
- let oe = u ? i.conversations.find((e) => e.id === u) : void 0, m = ie(oe) ? void 0 : oe, h = i.autoRouting && Ja.current && f === void 0 ? ne({
1440
+ let oe = u ? i.conversations.find((e) => e.id === u) : void 0, m = ie(oe) ? void 0 : oe, h = i.autoRouting && Xa.current && f === void 0 ? ne({
1440
1441
  intent: n.avatarTabAsk === void 0 ? n.autoIntent ?? ee(e) : "read",
1441
1442
  dictated: r,
1442
- voiceProposalBound: r && Ri("api-calls") && ue(i.acknowledgedWriteModes, "api-calls"),
1443
+ voiceProposalBound: r && Bi("api-calls") && ue(i.acknowledgedWriteModes, "api-calls"),
1443
1444
  conversation: m ? {
1444
1445
  mode: m.mode,
1445
1446
  routedBy: m.routedBy,
1446
- hasHistory: Wn(m)
1447
+ hasHistory: Gn(m)
1447
1448
  } : null
1448
1449
  }) : null;
1449
- if (h && Ba.current.find((e) => e.id === h.mode)?.writeCapable && !ue(i.acknowledgedWriteModes, h.mode)) {
1450
- Ya.current = {
1450
+ if (h && Ha.current.find((e) => e.id === h.mode)?.writeCapable && !ue(i.acknowledgedWriteModes, h.mode)) {
1451
+ Za.current = {
1451
1452
  content: e,
1452
1453
  attachments: t,
1453
1454
  options: n
1454
- }, to(h.mode);
1455
+ }, ro(h.mode);
1455
1456
  return;
1456
1457
  }
1457
- let g = h ? h.mode : i.mode, le, fe, v = f ?? (a ? null : B), me = v ? _.getState().conversations.find((e) => e.id === v) : void 0, he = h?.action === "escalate" && m ? {
1458
+ let g = h ? h.mode : i.mode, le, fe, v = f ?? (a ? null : z), me = v ? _.getState().conversations.find((e) => e.id === v) : void 0, he = h?.action === "escalate" && m ? {
1458
1459
  mode: m.mode,
1459
1460
  backendSessionId: m.backendSessionId ?? null
1460
1461
  } : null;
1461
- if (h) h.action === "new" || !m ? v = na(void 0, g, { routedBy: "auto" }) : (v = m.id, ga(v, g));
1462
+ if (h) h.action === "new" || !m ? v = ia(void 0, g, { routedBy: "auto" }) : (v = m.id, va(v, g));
1462
1463
  else {
1463
1464
  let e = i.autoRouting ? { routedBy: "auto" } : void 0;
1464
- !v || ie(me) || me && me.mode !== g && Wn(me) ? v = na(void 0, g, e) : me && me.mode !== g && (e ? ga(v, g) : ea(v, g));
1465
+ !v || ie(me) || me && me.mode !== g && Gn(me) ? v = ia(void 0, g, e) : me && me.mode !== g && (e ? va(v, g) : na(v, g));
1465
1466
  }
1466
1467
  if (!v) return;
1467
- r && lo.current !== void 0 && v !== i.activeConversationId && po(v), n.approvalFollowUp || (ho.current[v] = t);
1468
+ r && fo.current !== void 0 && v !== i.activeConversationId && ho(v), n.approvalFollowUp || (_o.current[v] = t);
1468
1469
  let _e = () => _.getState().conversations.some((e) => e.id === v), y = C(), we = {
1469
- accessToken: L(),
1470
- workspaceToken: zi(),
1471
- userId: R,
1470
+ accessToken: I(),
1471
+ workspaceToken: Vi(),
1472
+ userId: L,
1472
1473
  organizationId: Mt()
1473
1474
  }, Ee = (e, t) => {
1474
1475
  _e() || !y || pe(e, y, t, g, {
1475
- accessToken: L(),
1476
- workspaceToken: zi(),
1477
- userId: R,
1476
+ accessToken: I(),
1477
+ workspaceToken: Vi(),
1478
+ userId: L,
1478
1479
  organizationId: Mt()
1479
1480
  });
1480
1481
  }, De = {
1481
- id: M(),
1482
+ id: j(),
1482
1483
  role: "user",
1483
1484
  content: e,
1484
1485
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
@@ -1491,30 +1492,30 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
1491
1492
  ...We(n.voiceSessionId)
1492
1493
  }
1493
1494
  };
1494
- H(v, De);
1495
- let Oe = n.fromPerson === !0 && t.length === 0 && n.approvalFollowUp === void 0 && ae === e ? oi(e, r ? qi.input.code : z) : null, ke = {
1495
+ V(v, De);
1496
+ let Oe = n.fromPerson === !0 && t.length === 0 && n.approvalFollowUp === void 0 && ae === e ? si(e, r ? Yi.input.code : R) : null, ke = {
1496
1497
  location: window.location.pathname + window.location.search,
1497
1498
  conversationId: _.getState().activeConversationId,
1498
1499
  workspaceId: C(),
1499
- actorId: R ?? null
1500
- }, b = M();
1501
- H(v, {
1500
+ actorId: L ?? null
1501
+ }, b = j();
1502
+ V(v, {
1502
1503
  id: b,
1503
1504
  role: "assistant",
1504
1505
  content: "",
1505
1506
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1506
1507
  metadata: {
1507
- lang: Xi,
1508
+ lang: Qi,
1508
1509
  ...We(n.voiceSessionId)
1509
1510
  }
1510
1511
  }), pn(b, {
1511
1512
  channel: r ? "voice" : "chat",
1512
1513
  mode: g,
1513
- product: P,
1514
- language: Xi,
1514
+ product: N,
1515
+ language: Qi,
1515
1516
  device: mn(),
1516
1517
  routedByAuto: !!h
1517
- }, n.voiceTiming), T(b, "accepted"), oa(v, "provisioning", b, null), ce(b), n.avatarTabAsk !== void 0 && Ho(n.avatarTabAsk, {
1518
+ }, n.voiceTiming), T(b, "accepted"), ca(v, "provisioning", b, null), ce(b), n.avatarTabAsk !== void 0 && Wo(n.avatarTabAsk, {
1518
1519
  conversationId: v,
1519
1520
  questionId: De.id,
1520
1521
  replyId: b
@@ -1522,13 +1523,13 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
1522
1523
  let je = () => {
1523
1524
  let e = Ft({
1524
1525
  turnId: b,
1525
- abortRequested: ko.current.has(b),
1526
+ abortRequested: jo.current.has(b),
1526
1527
  activeTurnId: _.getState().processingByConversationId[v]?.messageId ?? null,
1527
1528
  conversationExists: _e()
1528
1529
  });
1529
1530
  return e.abandon && Ke(), e;
1530
- }, He = (e, t, r, i, a = !1, o = Xi) => {
1531
- ia(v, b, { content: s(e) }), aa(v, b, {
1531
+ }, He = (e, t, r, i, a = !1, o = Qi) => {
1532
+ oa(v, b, { content: s(e) }), sa(v, b, {
1532
1533
  lang: o,
1533
1534
  ...t?.length ? { artifacts: t } : {},
1534
1535
  ...t?.length || r || i ? { mode: g } : {},
@@ -1550,14 +1551,14 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
1550
1551
  T(b, "attemptStarted");
1551
1552
  let a = null, o = null, c = !1;
1552
1553
  try {
1553
- let { sandboxId: i, sessionId: u, sessionIsNew: d, readAhead: f, sandboxIsNew: ee, sandboxProbed: te, sandboxAdopted: p, deadSandboxProbe: ne, sessionPreopened: re } = await Co(v, b, g, y, we, { isAbandoned: () => Ft({
1554
+ let { sandboxId: i, sessionId: u, sessionIsNew: d, readAhead: f, sandboxIsNew: ee, sandboxProbed: te, sandboxAdopted: p, deadSandboxProbe: ne, sessionPreopened: re } = await To(v, b, g, y, we, { isAbandoned: () => Ft({
1554
1555
  turnId: b,
1555
- abortRequested: ko.current.has(b),
1556
+ abortRequested: jo.current.has(b),
1556
1557
  activeTurnId: _.getState().processingByConversationId[v]?.messageId ?? null,
1557
1558
  conversationExists: _e()
1558
1559
  }).abandon });
1559
1560
  if (a = i, Qe(), Qe = l(i, () => {
1560
- ko.current.add(b), Ye(b), Ge.abort(b);
1561
+ jo.current.add(b), Ye(b), Ge.abort(b);
1561
1562
  }), T(b, "runtimeReady"), w(b, {
1562
1563
  runtime: ee ? "cold" : p ? "adopted" : te ? "probed" : re ? "preopened" : d ? "new-session" : "warm",
1563
1564
  deadSandboxProbe: ne
@@ -1567,23 +1568,23 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
1567
1568
  }, de(g, le, _.getState().acknowledgedWriteModes, {
1568
1569
  dictated: r,
1569
1570
  confirmsWrites: xe(g),
1570
- proposalBound: Ri(g, i)
1571
+ proposalBound: Bi(g, i)
1571
1572
  }) === "voice-in-write-mode") throw new Me("voice-in-write-mode", "Voice in a write mode");
1572
- let ie = ir({
1573
+ let ie = ar({
1573
1574
  conversation: _.getState().conversations.find((e) => e.id === v),
1574
1575
  content: e,
1575
1576
  sessionIsNew: d,
1576
1577
  sendingMode: g,
1577
1578
  sendingModeConfig: le,
1578
- modes: Ba.current,
1579
+ modes: Ha.current,
1579
1580
  answerText: (e) => ln(e).text
1580
1581
  });
1581
- if (qe(), xr()) {
1582
- let e = br({
1582
+ if (qe(), Sr()) {
1583
+ let e = xr({
1583
1584
  mint: () => be(i, y, u, g, we),
1584
1585
  mark: (e) => T(b, e)
1585
1586
  });
1586
- x.stream = e, x.render = sr({
1587
+ x.stream = e, x.render = cr({
1587
1588
  stream: e,
1588
1589
  conversationId: v,
1589
1590
  messageId: b,
@@ -1593,12 +1594,12 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
1593
1594
  });
1594
1595
  }
1595
1596
  let oe = await on(() => ye(i, y, u, g, we, { limit: 50 }), d, an(f, i, u));
1596
- xo(v, b, "streaming", "thinking");
1597
- let se = Ni?.(), ce = Pn(_.getState().sandboxWriteCapabilities[i]), m = Y.current, h = ii(i, u), ue = m.options.uiCatalogue ? ti(Vr(m.navItems), {
1597
+ Co(v, b, "streaming", "thinking");
1598
+ let se = Fi?.(), ce = Fn(_.getState().sandboxWriteCapabilities[i]), m = J.current, h = ai(i, u), ue = m.options.uiCatalogue ? ni(Hr(m.navItems), {
1598
1599
  permissionsSettled: m.navPermissionsSettled,
1599
1600
  simulating: m.navSimulating,
1600
- sentBefore: ri(h)
1601
- }) : null, pe = _.getState().sandboxWriteCapabilities[i]?.clientTools === !0 ? _i({ writeCapable: le?.writeCapable === !0 || g === "api-calls" }) : null, me = pe?.manifest ?? [], he = {
1601
+ sentBefore: ii(h)
1602
+ }) : null, pe = _.getState().sandboxWriteCapabilities[i]?.clientTools === !0 ? vi({ writeCapable: le?.writeCapable === !0 || g === "api-calls" }) : null, me = pe?.manifest ?? [], he = {
1602
1603
  conversationId: v,
1603
1604
  writeReply: ce === "proposal-v1" ? n.writeReplyBound?.writeReply ?? null : null,
1604
1605
  ...ue ? { uiCatalogue: ue } : {},
@@ -1607,7 +1608,7 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
1607
1608
  content: ie ? `${ie}${ae}` : ae,
1608
1609
  attachments: t,
1609
1610
  limits: mt(le),
1610
- wrapPrompt: (e) => Pi?.(g, e, Ji, Yi, r, { writeApproval: ce }) ?? e,
1611
+ wrapPrompt: (e) => Ii?.(g, e, Xi, Zi, r, { writeApproval: ce }) ?? e,
1611
1612
  requestBytes: (e, t) => Ce({
1612
1613
  sandboxId: i,
1613
1614
  workspaceId: y,
@@ -1623,7 +1624,7 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
1623
1624
  c = dt(t) > Fe;
1624
1625
  let ze = je();
1625
1626
  if (ze.abandon) {
1626
- ze.clearProcessing && sa(v);
1627
+ ze.clearProcessing && la(v);
1627
1628
  return;
1628
1629
  }
1629
1630
  let Be = (e) => Ze.dispatch({
@@ -1641,9 +1642,9 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
1641
1642
  if (!Ze.canFailover() || !Pe || !xn(e)) throw e;
1642
1643
  await Be(void 0), c ||= Le;
1643
1644
  }
1644
- ue && ni(h);
1645
- let We = _.getState().sandboxWriteCapabilities[i], Xe = m.options.uiOffers === !0 && Ae(We) ? R : null, et = !!Xe;
1646
- Xe && Z.recordTurn({
1645
+ ue && ri(h);
1646
+ let We = _.getState().sandboxWriteCapabilities[i], Xe = m.options.uiOffers === !0 && Ae(We) ? L : null, et = !!Xe;
1647
+ Xe && X.recordTurn({
1647
1648
  replyId: b,
1648
1649
  conversationId: v,
1649
1650
  sandboxId: i,
@@ -1653,16 +1654,16 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
1653
1654
  actorId: Xe,
1654
1655
  floorMs: oe
1655
1656
  });
1656
- let tt = pe && me.length > 0 ? gi({
1657
+ let tt = pe && me.length > 0 ? _i({
1657
1658
  tools: pe.tools,
1658
1659
  post: (e, t) => Se(i, y, u, e, t, g, we)
1659
1660
  }) : null, nt = tt ? (e) => tt.receive(e) : void 0, rt = et ? (e, t) => {
1660
- Z.receive(b, e, t, performance.now()) && ss();
1661
- } : void 0, it = (e) => ia(v, b, { content: e }), at = (e) => c ? `${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;
1661
+ X.receive(b, e, t, performance.now()) && ls();
1662
+ } : void 0, it = (e) => oa(v, b, { content: e }), at = (e) => c ? `${e}\n\n${M("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;
1662
1663
  T(b, "promptSent");
1663
1664
  let ot = null, st = !1, ct = nn, S = rn([], oe);
1664
1665
  x.render?.arm(oe);
1665
- let lt = Date.now() + fe.streamBudgetMs, ut = Date.now(), pt = Date.now(), ht = Sr(() => ye(i, y, u, g, we, {
1666
+ let lt = Date.now() + fe.streamBudgetMs, ut = Date.now(), pt = Date.now(), ht = Cr(() => ye(i, y, u, g, we, {
1666
1667
  limit: 50,
1667
1668
  sinceMs: oe,
1668
1669
  surfaceTurnTerminal: !0,
@@ -1674,23 +1675,23 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
1674
1675
  Ee(i, u);
1675
1676
  let e = je();
1676
1677
  if (e.abandon) {
1677
- e.clearProcessing && sa(v);
1678
+ e.clearProcessing && la(v);
1678
1679
  return;
1679
1680
  }
1680
1681
  let t = await ht.next();
1681
- if (et && Z.observeMessages(b, t) && ss(), S = rn(t, oe, { accumulateNarration: fe.accumulatesNarration }), ia(v, b, { content: s(S.content) }), S.hasRenderableOutput ? st || (st = !0, ot !== null && T(b, "lastQuietPoll", ot), T(b, "firstOutput")) : ot = gn(), fe.accumulatesNarration) S.hasText && T(b, "firstText");
1682
+ if (et && X.observeMessages(b, t) && ls(), S = rn(t, oe, { accumulateNarration: fe.accumulatesNarration }), oa(v, b, { content: s(S.content) }), S.hasRenderableOutput ? st || (st = !0, ot !== null && T(b, "lastQuietPoll", ot), T(b, "firstOutput")) : ot = gn(), fe.accumulatesNarration) S.hasText && T(b, "firstText");
1682
1683
  else {
1683
1684
  let e = cn(ct, S, gn());
1684
1685
  ct = e.tracker, e.confirmedAt !== null && T(b, "firstText", e.confirmedAt);
1685
1686
  }
1686
- if (S.pendingWrite && !Mn(_.getState().sandboxWriteCapabilities[i]) && aa(v, b, { pendingWrite: S.pendingWrite }), S.done && (x.stream ? w(b, {
1687
+ if (S.pendingWrite && !Nn(_.getState().sandboxWriteCapabilities[i]) && sa(v, b, { pendingWrite: S.pendingWrite }), S.done && (x.stream ? w(b, {
1687
1688
  transport: x.stream.reachedOpen ? "sse" : "poll",
1688
- live: or(x.stream.live)
1689
+ live: sr(x.stream.live)
1689
1690
  }) : w(b, {
1690
1691
  transport: "poll",
1691
1692
  live: "none"
1692
1693
  }), Ke()), S.done) {
1693
- T(b, "answerDone"), q.current.markVerified(i);
1694
+ T(b, "answerDone"), K.current.markVerified(i);
1694
1695
  break;
1695
1696
  }
1696
1697
  if (x.render?.refresh(t), Date.now() - ut > 3e4 && (await ge(i, y, 600, we).catch(() => void 0), ut = Date.now()), !ht.hasPending()) {
@@ -1708,32 +1709,32 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
1708
1709
  channel: "voice",
1709
1710
  voiceSessionId: n.voiceSessionId,
1710
1711
  text: e,
1711
- lang: Xi,
1712
+ lang: Qi,
1712
1713
  final: !0
1713
1714
  }));
1714
1715
  }
1715
1716
  let _t = fe.producesArtifacts ? await ve(i, y, u, g, we).then((e) => e).catch(() => []) : void 0;
1716
1717
  S.usedTools !== void 0 && w(b, { usedTools: S.usedTools }), S.done || (w(b, { outcome: "timedOut" }), S = {
1717
1718
  ...S,
1718
- content: Ve(S.content, g, N, le)
1719
+ content: Ve(S.content, g, M, le)
1719
1720
  }), c && (S = {
1720
1721
  ...S,
1721
1722
  content: at(S.content)
1722
1723
  });
1723
1724
  let vt = !S.done;
1724
- He(S.content, _t, u, i, vt), S.tokens && (ia(v, b, { tokens: S.tokens }), (Ii ? await Re({
1725
+ He(S.content, _t, u, i, vt), S.tokens && (oa(v, b, { tokens: S.tokens }), (Ri ? await Re({
1725
1726
  workspaceId: y,
1726
1727
  sessionId: u,
1727
1728
  messageId: S.messageId,
1728
1729
  model: S.model,
1729
1730
  tokens: S.tokens
1730
- }, Ii, { ledger: Ie("panel", P) }) : { ok: !0 }).ok && di(P)), S.done || Ee(i, u);
1731
+ }, Ri, { ledger: Ie("panel", N) }) : { ok: !0 }).ok && fi(N)), S.done || Ee(i, u);
1731
1732
  let yt = je();
1732
1733
  if (yt.abandon) {
1733
- yt.clearProcessing && sa(v);
1734
+ yt.clearProcessing && la(v);
1734
1735
  return;
1735
1736
  }
1736
- T(b, "complete"), w(b, { outcome: "answered" }), oa(v, "complete", b, null), Yn.recordCommittedEntries(v, [De.id, b], "TURN", y), Je = !1, et && Oe && S.done && _s({
1737
+ T(b, "complete"), w(b, { outcome: "answered" }), ca(v, "complete", b, null), Xn.recordCommittedEntries(v, [De.id, b], "TURN", y), Je = !1, et && Oe && S.done && ys({
1737
1738
  replyId: b,
1738
1739
  conversationId: v,
1739
1740
  voiceSessionId: n.voiceSessionId,
@@ -1741,273 +1742,273 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
1741
1742
  atSend: ke
1742
1743
  });
1743
1744
  } catch (e) {
1744
- q.current.invalidate(a ?? _.getState().sandboxesByMode[g]?.sandboxId ?? null);
1745
+ K.current.invalidate(a ?? _.getState().sandboxesByMode[g]?.sandboxId ?? null);
1745
1746
  let t = Ft({
1746
1747
  turnId: b,
1747
- abortRequested: ko.current.has(b),
1748
+ abortRequested: jo.current.has(b),
1748
1749
  activeTurnId: _.getState().processingByConversationId[v]?.messageId ?? null,
1749
1750
  conversationExists: _e()
1750
1751
  });
1751
1752
  if (Ke(), a && o && Ee(a, o), t.abandon) {
1752
- t.clearProcessing && sa(v);
1753
+ t.clearProcessing && la(v);
1753
1754
  return;
1754
1755
  }
1755
1756
  if (i === 1 && Ze.canFailover() && Sn(e)) {
1756
1757
  Qe();
1757
1758
  let e = a ?? _.getState().sandboxesByMode[g]?.sandboxId ?? null;
1758
- return e && (J.current.add(e), q.current.invalidate(e)), la(v), da(g), ra(v, b, ""), aa(v, b, { pendingWrite: void 0 }), e && W.retireSandbox(e), qe(), Xe(), hn(b), et(2);
1759
+ return e && (q.current.add(e), K.current.invalidate(e)), da(v), pa(g), aa(v, b, ""), sa(v, b, { pendingWrite: void 0 }), e && U.retireSandbox(e), qe(), Xe(), hn(b), et(2);
1759
1760
  }
1760
1761
  throw e;
1761
1762
  }
1762
1763
  }, tt = v;
1763
- go.current.add(tt);
1764
+ vo.current.add(tt);
1764
1765
  try {
1765
1766
  if (!y) throw Object.assign(/* @__PURE__ */ Error("Assistant backend is unavailable without an active workspace context."), { extensions: {
1766
1767
  code: "UNAUTHENTICATED",
1767
1768
  authFailure: "WORKSPACE_CONTEXT_MISSING"
1768
1769
  } });
1769
- let e = await Et(g, () => Ba.current.find((e) => e.id === g), za);
1770
+ let e = await Et(g, () => Ha.current.find((e) => e.id === g), Va);
1770
1771
  le = e.config, fe = e.capabilities;
1771
1772
  let t = le, n = je();
1772
1773
  if (n.abandon) {
1773
- n.clearProcessing && sa(v);
1774
+ n.clearProcessing && la(v);
1774
1775
  return;
1775
1776
  }
1776
1777
  let i = de(g, t, _.getState().acknowledgedWriteModes, {
1777
1778
  dictated: r,
1778
1779
  confirmsWrites: xe(g),
1779
- proposalBound: Ri(g)
1780
+ proposalBound: Bi(g)
1780
1781
  });
1781
1782
  if (i) throw new Me(i, i === "confirm-write-mode" ? "Write mode not confirmed" : "Voice in a write mode");
1782
- let a = Ie("panel", P);
1783
- if (Ii && Le(a, y)) {
1784
- let e = await ze(a, y, Ii);
1783
+ let a = Ie("panel", N);
1784
+ if (Ri && Le(a, y)) {
1785
+ let e = await ze(a, y, Ri);
1785
1786
  if (!e.ok) throw Be(e.kind);
1786
1787
  let t = je();
1787
1788
  if (t.abandon) {
1788
- t.clearProcessing && sa(v);
1789
+ t.clearProcessing && la(v);
1789
1790
  return;
1790
1791
  }
1791
1792
  }
1792
1793
  T(b, "cleared"), await et();
1793
1794
  } catch (e) {
1794
- if (q.current.invalidate(_.getState().sandboxesByMode[g]?.sandboxId ?? null), !_e()) {
1795
- sa(v);
1795
+ if (K.current.invalidate(_.getState().sandboxesByMode[g]?.sandboxId ?? null), !_e()) {
1796
+ la(v);
1796
1797
  return;
1797
1798
  }
1798
1799
  let t = Ue.session?.sandboxId ?? null, r = Ne(e, { confirmsNoAction: Pe({
1799
1800
  mode: g,
1800
1801
  capabilities: t ? _.getState().sandboxWriteCapabilities[t] : null
1801
1802
  }) });
1802
- w(b, { outcome: r.kind === "temporary" ? "failed" : "refused" }), r.offersUpgrade && ui(P, "sandbox");
1803
- let i = Fe(r, N, { locale: z });
1804
- oa(v, "error", b, i.headline), ia(v, b, { content: i.text }), aa(v, b, {
1805
- lang: i.translated ? z : "en",
1803
+ w(b, { outcome: r.kind === "temporary" ? "failed" : "refused" }), r.offersUpgrade && di(N, "sandbox");
1804
+ let i = Fe(r, M, { locale: R });
1805
+ ca(v, "error", b, i.headline), oa(v, b, { content: i.text }), sa(v, b, {
1806
+ lang: i.translated ? R : "en",
1806
1807
  ...We(n.voiceSessionId)
1807
1808
  });
1808
1809
  } finally {
1809
- Qe(), go.current.delete(tt), w(b, { outcome: "stopped" }), T(b, "complete"), Xe(), qe();
1810
+ Qe(), vo.current.delete(tt), w(b, { outcome: "stopped" }), T(b, "complete"), Xe(), qe();
1810
1811
  let e = _.getState(), t = te(he, g, e.conversations.find((e) => e.id === tt), (t) => !!e.sandboxesByMode[t]?.sandboxId);
1811
- t && (ga(tt, t.mode), t.backendSessionId && ca(tt, t.backendSessionId)), Ue.session && _e() && W.afterTurn({
1812
+ t && (va(tt, t.mode), t.backendSessionId && ua(tt, t.backendSessionId)), Ue.session && _e() && U.afterTurn({
1812
1813
  ...Ue.session,
1813
1814
  conversationId: tt
1814
1815
  }, b);
1815
- let n = Ao.current;
1816
- Ao.current = null, n && n.conversationId === tt && _e() && Ls.current(n.content, n.attachments, n.options);
1816
+ let n = Mo.current;
1817
+ Mo.current = null, n && n.conversationId === tt && _e() && zs.current(n.content, n.attachments, n.options);
1817
1818
  }
1818
1819
  }, [
1819
- B,
1820
- H,
1821
- Pi,
1822
- la,
1823
- da,
1824
- Zi,
1825
- na,
1826
- Co,
1827
- W,
1828
- Mo,
1829
- Cs,
1830
- Ns,
1831
1820
  z,
1832
- qi,
1833
- Ri,
1834
- Ni,
1835
- L,
1836
- zi,
1837
- ia,
1838
- P,
1839
- za,
1821
+ V,
1840
1822
  Ii,
1823
+ da,
1824
+ pa,
1825
+ $i,
1826
+ ia,
1827
+ To,
1828
+ U,
1829
+ Po,
1830
+ Ts,
1831
+ Fs,
1832
+ R,
1841
1833
  Yi,
1842
- z,
1843
- Xi,
1844
- Ji,
1845
- ga,
1846
- Ms,
1847
- ys,
1848
- po,
1849
- mo,
1850
- ca,
1851
- ea,
1834
+ Bi,
1835
+ Fi,
1836
+ I,
1837
+ Vi,
1852
1838
  oa,
1853
- sa,
1854
1839
  N,
1855
- xo,
1856
- ra,
1840
+ Va,
1841
+ Ri,
1842
+ Zi,
1857
1843
  R,
1858
- Z,
1859
- ss,
1860
- Ss,
1861
- _s,
1862
- Ho,
1863
- Vo
1864
- ]), Ps = E((e, t) => {
1865
- Q(e, [], t ? { autoIntent: t } : {});
1866
- }, [Q]), Fs = Nt(), Is = E(() => {
1867
- let e = [..._a.chat].reverse().find((e) => e.role === "user" && !e.metadata?.localAction);
1844
+ Qi,
1845
+ Xi,
1846
+ va,
1847
+ Ps,
1848
+ xs,
1849
+ ho,
1850
+ go,
1851
+ ua,
1852
+ na,
1853
+ ca,
1854
+ la,
1855
+ M,
1856
+ Co,
1857
+ aa,
1858
+ L,
1859
+ X,
1860
+ ls,
1861
+ ws,
1862
+ ys,
1863
+ Wo,
1864
+ Uo
1865
+ ]), Is = E((e, t) => {
1866
+ Z(e, [], t ? { autoIntent: t } : {});
1867
+ }, [Z]), Ls = Nt(), Rs = E(() => {
1868
+ let e = [...ya.chat].reverse().find((e) => e.role === "user" && !e.metadata?.localAction);
1868
1869
  if (!e || e.metadata?.approvalFollowUp) return;
1869
- let t = B ? ho.current[B] ?? [] : [];
1870
+ let t = z ? _o.current[z] ?? [] : [];
1870
1871
  if (t.some((e) => Ot(e, Date.now()))) {
1871
- let n = B ?? void 0;
1872
- kt(t, Fs).then((t) => {
1873
- Q(e.content, t, n === void 0 ? void 0 : { targetConversationId: n });
1872
+ let n = z ?? void 0;
1873
+ kt(t, Ls).then((t) => {
1874
+ Z(e.content, t, n === void 0 ? void 0 : { targetConversationId: n });
1874
1875
  });
1875
1876
  return;
1876
1877
  }
1877
- Q(e.content, t);
1878
+ Z(e.content, t);
1878
1879
  }, [
1879
- va,
1880
- Q,
1881
- B,
1882
- Fs
1883
- ]), Ls = k(Q);
1880
+ ba,
1881
+ Z,
1882
+ z,
1883
+ Ls
1884
+ ]), zs = O(Z);
1884
1885
  D(() => {
1885
- Ls.current = Q;
1886
- }, [Q]);
1887
- let Rs = O(() => {
1888
- if (ba) return null;
1889
- for (let e = va.length - 1; e >= 0; --e) {
1890
- let t = va[e];
1886
+ zs.current = Z;
1887
+ }, [Z]);
1888
+ let Bs = xi(() => {
1889
+ if (Sa) return null;
1890
+ for (let e = ba.length - 1; e >= 0; --e) {
1891
+ let t = ba[e];
1891
1892
  if (t?.role !== "assistant") continue;
1892
- if (t.id === Yo) return null;
1893
- if (!Ue(t) || ko.current.has(t.id) || Je(t.id)) continue;
1894
- let n = tn(t, ya, N);
1893
+ if (t.id === Zo) return null;
1894
+ if (!Ue(t) || jo.current.has(t.id) || Je(t.id)) continue;
1895
+ let n = tn(t, xa, M);
1895
1896
  if (n.kind !== "output") return null;
1896
1897
  let r = ln(n.text).text.trim();
1897
- return r ? qe(t, r, ya) : null;
1898
+ return r ? qe(t, r, xa) : null;
1898
1899
  }
1899
1900
  return null;
1900
1901
  }, [
1901
- va,
1902
1902
  ba,
1903
- ya,
1904
- Yo,
1905
- N
1906
- ]), zs = O(() => Rs ? et(Rs.text) : null, [Rs]), Bs = O(() => _a.chat.filter((e) => e.id !== Yo), [_a.chat, Yo]), Vs = _((e) => fe(e)?.sandboxId ?? null), Hs = h(Bs, {
1907
- sessionId: U?.backendSessionId,
1908
- sandboxId: Vs,
1903
+ Sa,
1904
+ xa,
1905
+ Zo,
1906
+ M
1907
+ ]), Vs = xi(() => Bs ? et(Bs.text) : null, [Bs]), Hs = xi(() => ya.chat.filter((e) => e.id !== Zo), [ya.chat, Zo]), Us = _((e) => fe(e)?.sandboxId ?? null), Ws = h(Hs, {
1908
+ sessionId: H?.backendSessionId,
1909
+ sandboxId: Us,
1909
1910
  nowMs: Date.now()
1910
- }), Us = g(Bs), Ws = (e) => {
1911
- if (jn(e.metadata).length > 0) return !0;
1911
+ }), Gs = g(Hs), Ks = (e) => {
1912
+ if (Mn(e.metadata).length > 0) return !0;
1912
1913
  let t = e.metadata?.sandboxId;
1913
- return Mn(t ? Ca[t] : null);
1914
- }, Gs = (e) => {
1915
- let t = jn(e.metadata);
1916
- return t.length === 0 || !B ? null : /* @__PURE__ */ j(An, {
1914
+ return Nn(t ? Ta[t] : null);
1915
+ }, qs = (e) => {
1916
+ let t = Mn(e.metadata);
1917
+ return t.length === 0 || !z ? null : /* @__PURE__ */ A(jn, {
1917
1918
  refs: t,
1918
- conversationId: B,
1919
- panel: W,
1920
- entries: wa,
1921
- capabilitiesOf: (e) => Ca[e],
1922
- turnInFlight: ba,
1923
- tr: N,
1924
- onReview: Ea.review,
1925
- retiredSandboxes: Ta
1919
+ conversationId: z,
1920
+ panel: U,
1921
+ entries: Ea,
1922
+ capabilitiesOf: (e) => Ta[e],
1923
+ turnInFlight: Sa,
1924
+ tr: M,
1925
+ onReview: Oa.review,
1926
+ retiredSandboxes: Da
1926
1927
  });
1927
- }, Ks = (e) => {
1928
- if (!B) return null;
1929
- let t = Z.liveOffersFor(e, {
1928
+ }, Js = (e) => {
1929
+ if (!z) return null;
1930
+ let t = X.liveOffersFor(e, {
1930
1931
  registry: {
1931
- destinations: Vr(Wo),
1932
- permissionsSettled: Go,
1933
- simulating: Ko
1932
+ destinations: Hr(Ko),
1933
+ permissionsSettled: qo,
1934
+ simulating: Jo
1934
1935
  },
1935
- actorId: R,
1936
- conversationId: B,
1936
+ actorId: L,
1937
+ conversationId: z,
1937
1938
  perfNow: performance.now()
1938
1939
  }), n = t[0];
1939
- return n ? /* @__PURE__ */ j(lr, {
1940
+ return n ? /* @__PURE__ */ A(ur, {
1940
1941
  offers: t.map(({ offer: e, target: t }) => ({
1941
1942
  offerId: e.offerId,
1942
1943
  label: t.label,
1943
1944
  path: t.path
1944
1945
  })),
1945
- hint: t.length === 1 && I === "proposal-v1" ? b(n.offer, Z.turnFor(e)) : "link",
1946
- onOpen: gs
1946
+ hint: t.length === 1 && F === "proposal-v1" ? b(n.offer, X.turnFor(e)) : "link",
1947
+ onOpen: vs
1947
1948
  }, n.offer.offerId) : null;
1948
- }, qs = (e) => e.role === "assistant" ? Ks(e.id) : null;
1949
+ }, Ys = (e) => e.role === "assistant" ? Js(e.id) : null;
1949
1950
  D(() => {
1950
- let e = Z.nextExpiryInMs(performance.now());
1951
+ let e = X.nextExpiryInMs(performance.now());
1951
1952
  if (e === null) return;
1952
- let t = window.setTimeout(ss, e + 1);
1953
+ let t = window.setTimeout(ls, e + 1);
1953
1954
  return () => window.clearTimeout(t);
1954
1955
  }, [
1955
- Z,
1956
- as,
1957
- ss
1956
+ X,
1957
+ ss,
1958
+ ls
1958
1959
  ]);
1959
- let Js = Ea.dialog.view ? wa[Ea.dialog.view.proposalId] : void 0, Ys = Hs?.expiresAtMs ?? null;
1960
+ let Xs = Oa.dialog.view ? Ea[Oa.dialog.view.proposalId] : void 0, Zs = Ws?.expiresAtMs ?? null;
1960
1961
  D(() => {
1961
- if (Ys === null) return;
1962
- let e = window.setTimeout(() => Oo((e) => e + 1), Math.max(0, Ys - Date.now()));
1962
+ if (Zs === null) return;
1963
+ let e = window.setTimeout(() => Ao((e) => e + 1), Math.max(0, Zs - Date.now()));
1963
1964
  return () => window.clearTimeout(e);
1964
- }, [Ys, Do]);
1965
- let Xs = O(() => _a.voice.filter((e) => e.id !== Yo && (e.role === "user" || e.role === "assistant")).map((e) => ({
1965
+ }, [Zs, ko]);
1966
+ let Q = xi(() => ya.voice.filter((e) => e.id !== Zo && (e.role === "user" || e.role === "assistant")).map((e) => ({
1966
1967
  id: e.id,
1967
1968
  role: e.role,
1968
- text: fn(e, ya, N),
1969
+ text: fn(e, xa, M),
1969
1970
  sessionId: x(e),
1970
1971
  timestamp: e.timestamp
1971
1972
  })).filter((e) => e.text.length > 0), [
1972
- _a.voice,
1973
- ya,
1974
- Yo,
1975
- N
1976
- ]), Zs = E(() => {
1977
- if (Xs.length === 0) return;
1973
+ ya.voice,
1974
+ xa,
1975
+ Zo,
1976
+ M
1977
+ ]), Qs = E(() => {
1978
+ if (Q.length === 0) return;
1978
1979
  let e = /* @__PURE__ */ new Date();
1979
- Un(Ze(Xs, {
1980
- title: N("voiceSession.transcript", "Voice conversation"),
1981
- savedAt: N("voiceSession.savedAt", "Saved"),
1982
- session: N("voiceSession.sessionLabel", "Session"),
1983
- earlier: N("voiceSession.earlierLabel", "Earlier"),
1984
- you: N("voiceSession.speakerYou", "You"),
1985
- assistant: N("voiceSession.speakerAssistant", "Assistant")
1986
- }, e), Qe(P, e), "text/markdown");
1980
+ Wn(Ze(Q, {
1981
+ title: M("voiceSession.transcript", "Voice conversation"),
1982
+ savedAt: M("voiceSession.savedAt", "Saved"),
1983
+ session: M("voiceSession.sessionLabel", "Session"),
1984
+ earlier: M("voiceSession.earlierLabel", "Earlier"),
1985
+ you: M("voiceSession.speakerYou", "You"),
1986
+ assistant: M("voiceSession.speakerAssistant", "Assistant")
1987
+ }, e), Qe(N, e), "text/markdown");
1987
1988
  }, [
1988
- P,
1989
- Xs,
1990
- N
1991
- ]), Qs = fi({ perFileChars: $a }), $s = k(Qs);
1992
- $s.current = Qs;
1993
- let [ec, tc] = A(null), nc = ec === null ? null : N("attachments.voiceDropped", "{{count}} attachment(s) couldn't be saved and weren't sent.", { count: ec });
1989
+ N,
1990
+ Q,
1991
+ M
1992
+ ]), $s = pi({ perFileChars: to }), ec = O($s);
1993
+ ec.current = $s;
1994
+ let [tc, nc] = k(null), rc = tc === null ? null : M("attachments.voiceDropped", "{{count}} attachment(s) couldn't be saved and weren't sent.", { count: tc });
1994
1995
  D(() => {
1995
- if (ec === null) return;
1996
- let e = window.setTimeout(() => tc(null), Ti);
1996
+ if (tc === null) return;
1997
+ let e = window.setTimeout(() => nc(null), Di);
1997
1998
  return () => window.clearTimeout(e);
1998
- }, [ec]);
1999
- let rc = k(/* @__PURE__ */ new Set()), ic = k(() => !1), $ = bn({
1999
+ }, [tc]);
2000
+ let ic = O(/* @__PURE__ */ new Set()), ac = O(() => !1), $ = bn({
2000
2001
  onSubmit: E((e, t, n, r) => {
2001
- let i = lo.current, a = ut(i), o = () => {
2002
+ let i = fo.current, a = ut(i), o = () => {
2002
2003
  let e = _.getState();
2003
2004
  return at({
2004
- sessionLive: ic.current(t),
2005
+ sessionLive: ac.current(t),
2005
2006
  boundAtSubmit: i,
2006
2007
  activeConversationId: e.activeConversationId,
2007
2008
  boundConversationExists: e.conversations.some((e) => e.id === a)
2008
2009
  });
2009
2010
  }, s = () => {
2010
- let i = $s.current;
2011
+ let i = ec.current;
2011
2012
  jt({
2012
2013
  draft: i,
2013
2014
  maySend: o,
@@ -2017,18 +2018,18 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
2017
2018
  ...n,
2018
2019
  handedOver: gn()
2019
2020
  };
2020
- Ls.current(e, i, {
2021
+ zs.current(e, i, {
2021
2022
  fromPerson: !0,
2022
2023
  voiceSessionId: t,
2023
2024
  voiceTiming: a,
2024
2025
  ...r.correction ? { correctsInFlightTurn: !0 } : {}
2025
2026
  });
2026
2027
  },
2027
- announceDropped: (e) => tc(e)
2028
+ announceDropped: (e) => nc(e)
2028
2029
  });
2029
2030
  };
2030
- if (o() && xs.current(e, t)) {
2031
- Ls.current(e, [], {
2031
+ if (o() && Cs.current(e, t)) {
2032
+ zs.current(e, [], {
2032
2033
  fromPerson: !0,
2033
2034
  voiceSessionId: t,
2034
2035
  voiceTiming: {
@@ -2038,536 +2039,537 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
2038
2039
  });
2039
2040
  return;
2040
2041
  }
2041
- if (!$s.current.isBusy) {
2042
+ if (!ec.current.isBusy) {
2042
2043
  s();
2043
2044
  return;
2044
2045
  }
2045
- let c = Date.now(), l = rc.current, u = window.setInterval(() => {
2046
- let e = $s.current.isBusy;
2047
- $s.current.isCommitting || e && Date.now() - c < wi || (window.clearInterval(u), l.delete(u), s());
2046
+ let c = Date.now(), l = ic.current, u = window.setInterval(() => {
2047
+ let e = ec.current.isBusy;
2048
+ ec.current.isCommitting || e && Date.now() - c < Ei || (window.clearInterval(u), l.delete(u), s());
2048
2049
  }, 200);
2049
2050
  l.add(u);
2050
2051
  }, []),
2051
- latestReply: Rs,
2052
- language: tt(Gi, z).tag,
2053
- graceMs: Vi,
2054
- onSupersede: No,
2055
- handsFreeStreamNoticeAccepted: Ui,
2056
- onAcceptHandsFreeStreamNotice: Wi,
2057
- handsFreeInterrupt: Hi,
2058
- onBargeIn: Mo
2052
+ latestReply: Bs,
2053
+ language: tt(qi, R).tag,
2054
+ graceMs: Ui,
2055
+ onSupersede: Fo,
2056
+ handsFreeStreamNoticeAccepted: Gi,
2057
+ onAcceptHandsFreeStreamNotice: Ki,
2058
+ handsFreeInterrupt: Wi,
2059
+ onBargeIn: Po
2059
2060
  });
2060
- ic.current = $.isCurrentSession;
2061
- let ac = uo ? Xs.filter((e) => e.sessionId !== void 0 && $.isCurrentSession(e.sessionId)) : Xs, oc = $.answerLocally;
2062
- D(() => {
2063
- Ds.current = oc;
2064
- }, [oc]);
2065
- let sc = $.active, cc = O(() => St(Object.values(wa), B, Ta), [
2066
- wa,
2067
- B,
2068
- Ta
2069
- ]), [lc, uc] = A(null);
2061
+ ac.current = $.isCurrentSession;
2062
+ let oc = po ? Q.filter((e) => e.sessionId !== void 0 && $.isCurrentSession(e.sessionId)) : Q, sc = $.answerLocally;
2070
2063
  D(() => {
2071
- sc || uc(null);
2064
+ ks.current = sc;
2072
2065
  }, [sc]);
2073
- let dc = Ea.review, fc = E(() => {
2074
- let e = cc[cc.length - 1];
2066
+ let cc = $.active, lc = xi(() => St(Object.values(Ea), z, Da), [
2067
+ Ea,
2068
+ z,
2069
+ Da
2070
+ ]), [uc, dc] = k(null);
2071
+ D(() => {
2072
+ cc || dc(null);
2073
+ }, [cc]);
2074
+ let fc = Oa.review, pc = E(() => {
2075
+ let e = lc[lc.length - 1];
2075
2076
  if (!e) return;
2076
2077
  let { view: t } = e;
2077
- if (Dn(t) && En(t, Ca[e.session.sandboxId]).offerConfirm) {
2078
- dc(t);
2078
+ if (On(t) && Dn(t, Ta[e.session.sandboxId]).offerConfirm) {
2079
+ fc(t);
2079
2080
  return;
2080
2081
  }
2081
- uc(t.proposalId);
2082
+ dc(t.proposalId);
2082
2083
  }, [
2083
- cc,
2084
- Ca,
2085
- dc
2086
- ]), pc = sc ? yt(cc) : null, mc = lc ? wa[lc] : void 0, hc = sc && mc && mc.session.conversationId === B ? {
2087
- content: /* @__PURE__ */ j(An, {
2084
+ lc,
2085
+ Ta,
2086
+ fc
2087
+ ]), mc = cc ? yt(lc) : null, hc = uc ? Ea[uc] : void 0, gc = cc && hc && hc.session.conversationId === z ? {
2088
+ content: /* @__PURE__ */ A(jn, {
2088
2089
  refs: [{
2089
- proposalId: mc.view.proposalId,
2090
- sandboxId: mc.session.sandboxId,
2091
- sessionId: mc.session.sessionId
2090
+ proposalId: hc.view.proposalId,
2091
+ sandboxId: hc.session.sandboxId,
2092
+ sessionId: hc.session.sessionId
2092
2093
  }],
2093
- conversationId: mc.session.conversationId,
2094
- panel: W,
2095
- entries: wa,
2096
- capabilitiesOf: (e) => Ca[e],
2097
- turnInFlight: ba,
2098
- tr: N,
2099
- onReview: dc,
2100
- retiredSandboxes: Ta
2094
+ conversationId: hc.session.conversationId,
2095
+ panel: U,
2096
+ entries: Ea,
2097
+ capabilitiesOf: (e) => Ta[e],
2098
+ turnInFlight: Sa,
2099
+ tr: M,
2100
+ onReview: fc,
2101
+ retiredSandboxes: Da
2101
2102
  }),
2102
- closeLabel: Ct(N, _t.trayClose),
2103
- onClose: () => uc(null)
2104
- } : null, gc = Ea.asking, _c = ws?.asking === !0, vc = Ts?.asking === !0, yc = tr(), bc = $.holdListening;
2105
- r("assistant.transcript", O(() => sc || K ? null : { run: () => io ? { status: "already" } : (co(!0), { status: "done" }) }, [
2106
- sc,
2107
- K,
2108
- io,
2109
- co
2110
- ])), r("assistant.conversation.new", O(() => sc ? null : { run: () => {
2103
+ closeLabel: Ct(M, _t.trayClose),
2104
+ onClose: () => dc(null)
2105
+ } : null, _c = Oa.asking, vc = Es?.asking === !0, yc = Ds?.asking === !0, bc = nr(), xc = $.holdListening;
2106
+ r("assistant.transcript", xi(() => cc || G ? null : { run: () => oo ? { status: "already" } : (uo(!0), { status: "done" }) }, [
2107
+ cc,
2108
+ G,
2109
+ oo,
2110
+ uo
2111
+ ])), r("assistant.conversation.new", xi(() => cc ? null : { run: () => {
2111
2112
  let e = _.getState(), t = e.conversations.find((t) => t.id === e.activeConversationId);
2112
2113
  return t && t.messages.length === 0 ? { status: "already" } : (e.createConversation(), { status: "done" });
2113
- } }, [sc])), D(() => {
2114
- bc(sc && (gc || _c || vc || yc));
2114
+ } }, [cc])), D(() => {
2115
+ xc(cc && (_c || vc || yc || bc));
2115
2116
  }, [
2116
- sc,
2117
- gc,
2117
+ cc,
2118
2118
  _c,
2119
2119
  vc,
2120
2120
  yc,
2121
- bc
2121
+ bc,
2122
+ xc
2122
2123
  ]);
2123
- let xc = k(null), Sc = $.announce;
2124
+ let Sc = O(null), Cc = $.announce;
2124
2125
  D(() => {
2125
- if (!sc) {
2126
- xc.current = null;
2126
+ if (!cc) {
2127
+ Sc.current = null;
2127
2128
  return;
2128
2129
  }
2129
- let e = xc.current;
2130
+ let e = Sc.current;
2130
2131
  if (e === null) {
2131
- xc.current = new Set(Object.keys(wa));
2132
+ Sc.current = new Set(Object.keys(Ea));
2132
2133
  return;
2133
2134
  }
2134
- for (let { view: t, session: n } of xt(cc, e)) {
2135
+ for (let { view: t, session: n } of xt(lc, e)) {
2135
2136
  e.add(t.proposalId);
2136
- let r = Ca[n.sandboxId];
2137
+ let r = Ta[n.sandboxId];
2137
2138
  if (!vt({
2138
2139
  mode: "api-calls",
2139
- productWriteApproval: I,
2140
+ productWriteApproval: F,
2140
2141
  capabilities: r
2141
2142
  })) continue;
2142
- let i = wt(t, En(t, r).offerConfirm, N), a = t.proposalId;
2143
- Sc({
2143
+ let i = wt(t, Dn(t, r).offerConfirm, M), a = t.proposalId;
2144
+ Cc({
2144
2145
  id: `write-readback:${a}`,
2145
2146
  text: i.text,
2146
- lang: i.translated ? z : "en",
2147
- stillWanted: () => W.entry(a)?.view.status === "pending"
2147
+ lang: i.translated ? R : "en",
2148
+ stillWanted: () => U.entry(a)?.view.status === "pending"
2148
2149
  });
2149
2150
  }
2150
2151
  }, [
2151
- sc,
2152
2152
  cc,
2153
- wa,
2154
- Ca,
2155
- I,
2156
- N,
2157
- z,
2158
- Sc,
2159
- W
2153
+ lc,
2154
+ Ea,
2155
+ Ta,
2156
+ F,
2157
+ M,
2158
+ R,
2159
+ Cc,
2160
+ U
2160
2161
  ]);
2161
- let Cc = k(!1);
2162
+ let wc = O(!1);
2162
2163
  D(() => {
2163
- Cc.current = $.active;
2164
+ wc.current = $.active;
2164
2165
  }, [$.active]), D(() => ie((e) => {
2165
- if (!Cc.current) return !1;
2166
- let t = lo.current;
2166
+ if (!wc.current) return !1;
2167
+ let t = fo.current;
2167
2168
  return typeof t == "string" ? t === e : _.getState().activeConversationId === e;
2168
2169
  }), []);
2169
- let wc = $.start, Tc = E(() => {
2170
- let e = _.getState().activeConversationId, t = ct(mo());
2171
- po(lt(t, e)), wo(!0, t.kind === "own"), wc();
2170
+ let Tc = $.start, Ec = E(() => {
2171
+ let e = _.getState().activeConversationId, t = ct(go());
2172
+ ho(lt(t, e)), Eo(!0, t.kind === "own"), Tc();
2172
2173
  }, [
2173
- po,
2174
- wo,
2175
- mo,
2176
- wc
2177
- ]), Ec = O(() => dn(U?.messages ?? []), [U?.messages]), Dc = un(_a.voice, ya, N), Oc = un(Ec, ya, N) > 0, kc = E(() => {
2174
+ ho,
2175
+ Eo,
2176
+ go,
2177
+ Tc
2178
+ ]), Dc = xi(() => dn(H?.messages ?? []), [H?.messages]), Oc = un(ya.voice, xa, M), kc = un(Dc, xa, M) > 0, Ac = E(() => {
2178
2179
  let e = _.getState().activeConversationId;
2179
- if (!e || Xs.length === 0) return;
2180
- let t = new Set(Ec.map((e) => e.id)), n = M();
2181
- H(e, {
2180
+ if (!e || Q.length === 0) return;
2181
+ let t = new Set(Dc.map((e) => e.id)), n = j();
2182
+ V(e, {
2182
2183
  id: n,
2183
2184
  role: "system",
2184
- content: Xe(Xs.filter((e) => t.has(e.id)), {
2185
- intro: N("voiceSession.continuedIntro", "Continued from a voice conversation. You asked about:"),
2186
- nothing: N("voiceSession.continuedNothing", "Continued from a voice conversation."),
2187
- more: (e) => N("voiceSession.continuedMore", "…and {{count}} more", { count: e })
2185
+ content: Xe(Q.filter((e) => t.has(e.id)), {
2186
+ intro: M("voiceSession.continuedIntro", "Continued from a voice conversation. You asked about:"),
2187
+ nothing: M("voiceSession.continuedNothing", "Continued from a voice conversation."),
2188
+ more: (e) => M("voiceSession.continuedMore", "…and {{count}} more", { count: e })
2188
2189
  }),
2189
2190
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
2190
- metadata: { continuedVoiceTurns: Dc }
2191
- }), Yn.recordCommittedEntries(e, [n], "NOTE", C()), co(!1), $.end(), oo();
2191
+ metadata: { continuedVoiceTurns: Oc }
2192
+ }), Xn.recordCommittedEntries(e, [n], "NOTE", C()), uo(!1), $.end(), co();
2192
2193
  }, [
2193
- Xs,
2194
+ Q,
2195
+ Oc,
2194
2196
  Dc,
2195
- Ec,
2196
- H,
2197
- N,
2197
+ V,
2198
+ M,
2198
2199
  $,
2199
- co,
2200
- oo
2201
- ]), Ac = k({
2200
+ uo,
2201
+ co
2202
+ ]), jc = O({
2202
2203
  conversationId: null,
2203
2204
  count: 0
2204
2205
  });
2205
2206
  D(() => {
2206
- $.active && (Ac.current = {
2207
- conversationId: B,
2208
- count: Dc
2207
+ $.active && (jc.current = {
2208
+ conversationId: z,
2209
+ count: Oc
2209
2210
  });
2210
2211
  }, [$.active]);
2211
- let jc = E(() => {
2212
- let e = Ac.current, t = Dc > (e.conversationId === B ? e.count : 0);
2213
- $.end(), t && co(!0);
2212
+ let Mc = E(() => {
2213
+ let e = jc.current, t = Oc > (e.conversationId === z ? e.count : 0);
2214
+ $.end(), t && uo(!0);
2214
2215
  }, [
2215
- B,
2216
- Dc,
2216
+ z,
2217
+ Oc,
2217
2218
  $,
2218
- co
2219
+ uo
2219
2220
  ]);
2220
2221
  D(() => {
2221
- (!ji || !bo) && $.active && $.end();
2222
+ (!Ni || !So) && $.active && $.end();
2222
2223
  }, [
2223
- ji,
2224
- bo,
2224
+ Ni,
2225
+ So,
2225
2226
  $
2226
2227
  ]);
2227
- let [Mc, Nc] = A(Di), Pc = dr({
2228
+ let [Nc, Pc] = k(ki), Fc = fr({
2228
2229
  available: $.available,
2229
- allowedInMode: bo,
2230
- readOnly: ka,
2231
- busy: ba || Eo !== null || ja || ts,
2232
- committing: Mc.committing,
2233
- dictating: Mc.dictating
2234
- }), Fc = gt(), [Ic, Lc] = A(null);
2230
+ allowedInMode: So,
2231
+ readOnly: ja,
2232
+ busy: Sa || Oo !== null || Na || rs,
2233
+ committing: Nc.committing,
2234
+ dictating: Nc.dictating
2235
+ }), Ic = gt(), [Lc, Rc] = k(null);
2235
2236
  D(() => {
2236
- Ic !== null && (!K || Ic.conversationId !== B) && Lc(null);
2237
+ Lc !== null && (!G || Lc.conversationId !== z) && Rc(null);
2237
2238
  }, [
2238
- K,
2239
- B,
2240
- Ic
2239
+ G,
2240
+ z,
2241
+ Lc
2241
2242
  ]);
2242
- let Rc = Ic !== null && Lo === Ic.replyId, zc = k(!1), Bc = E(() => {
2243
- zc.current = !0, Rc && Ro(), Tc();
2243
+ let zc = Lc !== null && zo === Lc.replyId, Bc = O(!1), Vc = E(() => {
2244
+ Bc.current = !0, zc && Bo(), Ec();
2244
2245
  }, [
2245
- Tc,
2246
- Rc,
2247
- Ro
2246
+ Ec,
2247
+ zc,
2248
+ Bo
2248
2249
  ]);
2249
2250
  D(() => {
2250
- $.active || (zc.current = !1);
2251
+ $.active || (Bc.current = !1);
2251
2252
  }, [$.active]), D(() => {
2252
- K || !zc.current || (zc.current = !1, $.active && jc());
2253
+ G || !Bc.current || (Bc.current = !1, $.active && Mc());
2253
2254
  }, [
2254
- K,
2255
+ G,
2255
2256
  $.active,
2256
- jc
2257
+ Mc
2257
2258
  ]), D(() => {
2258
- K && co(!1);
2259
- }, [K, co]);
2260
- let Vc = O(() => ({
2259
+ G && uo(!1);
2260
+ }, [G, uo]);
2261
+ let Hc = xi(() => ({
2261
2262
  live: $.active,
2262
- blocked: Pc === null ? null : Fc.voiceStartBlocked(Pc),
2263
- impossible: fr(Pc),
2264
- start: Bc
2263
+ blocked: Fc === null ? null : Ic.voiceStartBlocked(Fc),
2264
+ impossible: pr(Fc),
2265
+ start: Vc
2265
2266
  }), [
2266
2267
  $.active,
2267
- Pc,
2268
2268
  Fc,
2269
- Bc
2270
- ]), [Hc, Uc] = A("mini"), Wc = ji && G.covered !== !0 && !($.active && Hc !== "mini") && !(io && !$.active) && !(gc || _c || vc || yc), Gc = ao?.ask, Kc = bi(Gc?.subscribe ?? ki, Gc?.getSnapshot ?? Ai, Gc?.getSnapshot ?? Ai), qc = pr({
2269
+ Ic,
2270
+ Vc
2271
+ ]), [Uc, Wc] = k("mini"), Gc = Ni && W.covered !== !0 && !($.active && Uc !== "mini") && !(oo && !$.active) && !(_c || vc || yc || bc), Kc = so?.ask, qc = Si(Kc?.subscribe ?? ji, Kc?.getSnapshot ?? Mi, Kc?.getSnapshot ?? Mi), Jc = mr({
2271
2272
  voiceLive: $.active,
2272
- readOnly: ka,
2273
- writes: mr({
2274
- auto: qa,
2275
- selectedMode: V,
2276
- conversation: U && !ka ? {
2277
- mode: U.mode,
2278
- routedBy: U.routedBy,
2279
- hasHistory: Wn(U)
2273
+ readOnly: ja,
2274
+ writes: hr({
2275
+ auto: Ya,
2276
+ selectedMode: B,
2277
+ conversation: H && !ja ? {
2278
+ mode: H.mode,
2279
+ routedBy: H.routedBy,
2280
+ hasHistory: Gn(H)
2280
2281
  } : null,
2281
- modeWrites: (e) => F.find((t) => t.id === e)?.writeCapable === !0 || xe(e)
2282
+ modeWrites: (e) => P.find((t) => t.id === e)?.writeCapable === !0 || xe(e)
2282
2283
  }),
2283
- avatar: Kc,
2284
- busy: ba || Eo !== null || ja || ts || eo !== null || Za,
2285
- committing: Mc.committing
2286
- }), Jc = k(qc);
2287
- yi(() => {
2288
- Jc.current = qc;
2289
- }, [qc]);
2290
- let Yc = E((e) => {
2284
+ avatar: qc,
2285
+ busy: Sa || Oo !== null || Na || rs || no !== null || $a,
2286
+ committing: Nc.committing
2287
+ }), Yc = O(Jc);
2288
+ bi(() => {
2289
+ Yc.current = Jc;
2290
+ }, [Jc]);
2291
+ let Xc = E((e) => {
2291
2292
  let t = e.trim();
2292
- if (t === "" || Jc.current !== null) return { accepted: !1 };
2293
- Rc && Ro();
2293
+ if (t === "" || Yc.current !== null) return { accepted: !1 };
2294
+ zc && Bo();
2294
2295
  let n = {
2295
- token: M(),
2296
+ token: j(),
2296
2297
  exchange: null,
2297
2298
  handled: !1
2298
2299
  };
2299
- zo.current = n;
2300
+ Vo.current = n;
2300
2301
  try {
2301
- Q(t, [], {
2302
+ Z(t, [], {
2302
2303
  fromPerson: !0,
2303
2304
  avatarTabAsk: n.token,
2304
2305
  localRecordsChecked: !0,
2305
- ...qa ? { autoIntent: "read" } : {}
2306
+ ...Ya ? { autoIntent: "read" } : {}
2306
2307
  });
2307
2308
  } finally {
2308
- zo.current = null;
2309
+ Vo.current = null;
2309
2310
  }
2310
2311
  let r = n.exchange;
2311
2312
  return r === null ? n.handled ? {
2312
2313
  accepted: !0,
2313
2314
  recorded: !1
2314
- } : { accepted: !1 } : (Lc(r), {
2315
+ } : { accepted: !1 } : (Rc(r), {
2315
2316
  accepted: !0,
2316
2317
  recorded: !0,
2317
2318
  ...r
2318
2319
  });
2319
2320
  }, [
2320
- qa,
2321
- Q,
2322
- Ro,
2323
- Rc
2324
- ]), [Xc] = A(() => gr()), Zc = O(() => ({
2325
- blocker: qc,
2326
- line: hr(qc, Pc),
2327
- send: Yc,
2328
- last: Ic,
2329
- navigatingReplyId: rs,
2330
- draft: Xc
2321
+ Ya,
2322
+ Z,
2323
+ Bo,
2324
+ zc
2325
+ ]), [Zc] = k(() => _r()), Qc = xi(() => ({
2326
+ blocker: Jc,
2327
+ line: gr(Jc, Fc),
2328
+ send: Xc,
2329
+ last: Lc,
2330
+ navigatingReplyId: as,
2331
+ draft: Zc
2331
2332
  }), [
2332
- qc,
2333
- Pc,
2334
- Yc,
2335
- Ic,
2336
- rs,
2337
- Xc
2338
- ]), Qc = G.setReplyEscape, $c = K && Wc && Rc;
2333
+ Jc,
2334
+ Fc,
2335
+ Xc,
2336
+ Lc,
2337
+ as,
2338
+ Zc
2339
+ ]), $c = W.setReplyEscape, el = G && Gc && zc;
2339
2340
  D(() => {
2340
- if (!(!Qc || !$c)) return Qc(Ro), () => Qc(null);
2341
+ if (!(!$c || !el)) return $c(Bo), () => $c(null);
2341
2342
  }, [
2342
- Qc,
2343
2343
  $c,
2344
- Ro
2344
+ el,
2345
+ Bo
2345
2346
  ]), D(() => {
2346
- let e = lo.current, t = ut(e), n = _.getState(), r = st({
2347
+ let e = fo.current, t = ut(e), n = _.getState(), r = st({
2347
2348
  sessionLive: $.active,
2348
2349
  bound: e,
2349
2350
  activeConversationId: n.activeConversationId,
2350
2351
  boundConversationExists: n.conversations.some((e) => e.id === t)
2351
2352
  });
2352
- po(r.bound), r.end && $.end();
2353
+ ho(r.bound), r.end && $.end();
2353
2354
  }, [
2354
2355
  $,
2355
- B,
2356
- Zi,
2357
- po
2356
+ z,
2357
+ $i,
2358
+ ho
2358
2359
  ]);
2359
- let el = k(rt);
2360
+ let tl = O(rt);
2360
2361
  D(() => {
2361
- let e = ot(el.current, {
2362
- activeConversationId: B,
2363
- chatTurnCount: Bs.length,
2364
- voiceTurnCount: Xs.length,
2362
+ let e = ot(tl.current, {
2363
+ activeConversationId: z,
2364
+ chatTurnCount: Hs.length,
2365
+ voiceTurnCount: Q.length,
2365
2366
  sessionLive: $.active,
2366
- sessionBoundTo: lo.current,
2367
- turnInFlight: ba
2367
+ sessionBoundTo: fo.current,
2368
+ turnInFlight: Sa
2368
2369
  });
2369
- el.current = e.state, e.open && co(!0);
2370
+ tl.current = e.state, e.open && uo(!0);
2370
2371
  }, [
2371
- B,
2372
- Bs.length,
2373
- Xs.length,
2372
+ z,
2373
+ Hs.length,
2374
+ Q.length,
2374
2375
  $.active,
2375
- ba,
2376
- co
2376
+ Sa,
2377
+ uo
2377
2378
  ]), D(() => {
2378
2379
  if (!$.active) {
2379
- $s.current.clear(), tc(null), Ao.current = null;
2380
- for (let e of rc.current) window.clearInterval(e);
2381
- rc.current.clear();
2380
+ ec.current.clear(), nc(null), Mo.current = null;
2381
+ for (let e of ic.current) window.clearInterval(e);
2382
+ ic.current.clear();
2382
2383
  }
2383
2384
  }, [$.active]), D(() => {
2384
- let e = rc.current;
2385
+ let e = ic.current;
2385
2386
  return () => {
2386
2387
  for (let t of e) window.clearInterval(t);
2387
2388
  e.clear();
2388
2389
  };
2389
2390
  }, []), D(() => {
2390
2391
  let e = _.getState().consumePendingPrompt();
2391
- return e && Ls.current(e), _.subscribe((e, t) => {
2392
+ return e && zs.current(e), _.subscribe((e, t) => {
2392
2393
  if (e.pendingPrompt && e.pendingPrompt !== t.pendingPrompt) {
2393
2394
  let e = _.getState().consumePendingPrompt();
2394
- e && Ls.current(e);
2395
+ e && zs.current(e);
2395
2396
  }
2396
2397
  });
2397
2398
  }, []);
2398
- let tl = E((e) => {
2399
- let t = B ? _.getState().conversations.find((e) => e.id === B) : void 0;
2400
- if (t && t.mode !== e && W.withdraw(t.id, "mode_switched"), t && Wn(t)) {
2399
+ let nl = E((e) => {
2400
+ let t = z ? _.getState().conversations.find((e) => e.id === z) : void 0;
2401
+ if (t && t.mode !== e && U.withdraw(t.id, "mode_switched"), t && Gn(t)) {
2401
2402
  if (t.mode !== e) {
2402
- let t = re(), n = _.getState().conversations.find((n) => n.mode === e && qn(n, t) && !_.getState().processingByConversationId[n.id]);
2403
- n ? ta(n.id) : na(void 0, e);
2403
+ let t = re(), n = _.getState().conversations.find((n) => n.mode === e && Jn(n, t) && !_.getState().processingByConversationId[n.id]);
2404
+ n ? ra(n.id) : ia(void 0, e);
2404
2405
  }
2405
- } else B && ea(B, e);
2406
+ } else z && na(z, e);
2406
2407
  let n = _.getState().activeConversationId;
2407
- n ? ea(n, e) : ha(!1), $i(e);
2408
+ n ? na(n, e) : _a(!1), ta(e);
2408
2409
  }, [
2409
- B,
2410
+ z,
2411
+ ia,
2412
+ ra,
2413
+ _a,
2410
2414
  na,
2411
2415
  ta,
2412
- ha,
2413
- ea,
2414
- $i,
2415
- W
2416
- ]), nl = E(() => {
2416
+ U
2417
+ ]), rl = E(() => {
2417
2418
  let e = _.getState(), t = e.activeConversationId ? e.conversations.find((t) => t.id === e.activeConversationId) : void 0;
2418
2419
  if (!t) {
2419
- ha(!0), $i(d);
2420
+ _a(!0), ta(d);
2420
2421
  return;
2421
2422
  }
2422
2423
  if (t.routedBy === "auto") {
2423
- ha(!0);
2424
+ _a(!0);
2424
2425
  return;
2425
2426
  }
2426
- if (!Wn(t)) {
2427
- ga(t.id, d);
2427
+ if (!Gn(t)) {
2428
+ va(t.id, d);
2428
2429
  return;
2429
2430
  }
2430
- W.withdraw(t.id, "mode_switched");
2431
- let n = re(), r = e.conversations.find((t) => t.routedBy === "auto" && qn(t, n) && !e.processingByConversationId[t.id]);
2432
- r ? (ta(r.id), ga(r.id, d)) : na(void 0, d, { routedBy: "auto" });
2431
+ U.withdraw(t.id, "mode_switched");
2432
+ let n = re(), r = e.conversations.find((t) => t.routedBy === "auto" && Jn(t, n) && !e.processingByConversationId[t.id]);
2433
+ r ? (ra(r.id), va(r.id, d)) : ia(void 0, d, { routedBy: "auto" });
2433
2434
  }, [
2434
- na,
2435
- ga,
2435
+ ia,
2436
+ va,
2437
+ ra,
2438
+ _a,
2436
2439
  ta,
2437
- ha,
2438
- $i,
2439
- W
2440
- ]), rl = E((e) => {
2441
- if (F.find((t) => t.id === e)?.writeCapable && !ue(_.getState().acknowledgedWriteModes, e)) {
2442
- to(e);
2440
+ U
2441
+ ]), il = E((e) => {
2442
+ if (P.find((t) => t.id === e)?.writeCapable && !ue(_.getState().acknowledgedWriteModes, e)) {
2443
+ ro(e);
2443
2444
  return;
2444
2445
  }
2445
- tl(e);
2446
- }, [tl, F]), il = E(() => {
2447
- let e = eo;
2448
- if (to(null), !e) return;
2449
- let t = Ya.current;
2450
- if (Ya.current = null, t) {
2451
- pa(e), Q(t.content, t.attachments, t.options);
2446
+ nl(e);
2447
+ }, [nl, P]), al = E(() => {
2448
+ let e = no;
2449
+ if (ro(null), !e) return;
2450
+ let t = Za.current;
2451
+ if (Za.current = null, t) {
2452
+ ha(e), Z(t.content, t.attachments, t.options);
2452
2453
  return;
2453
2454
  }
2454
- pa(e), tl(e);
2455
+ ha(e), nl(e);
2455
2456
  }, [
2456
- eo,
2457
- pa,
2458
- tl,
2459
- Q
2460
- ]), al = eo === null ? void 0 : F.find((e) => e.id === eo) ?? { id: eo }, ol = E(() => {
2461
- to(null);
2462
- let e = Ya.current;
2463
- Ya.current = null, e && Q(e.content, e.attachments, {
2457
+ no,
2458
+ ha,
2459
+ nl,
2460
+ Z
2461
+ ]), ol = no === null ? void 0 : P.find((e) => e.id === no) ?? { id: no }, sl = E(() => {
2462
+ ro(null);
2463
+ let e = Za.current;
2464
+ Za.current = null, e && Z(e.content, e.attachments, {
2464
2465
  ...e.options,
2465
2466
  autoIntent: "read"
2466
2467
  });
2467
- }, [Q]);
2468
- return /* @__PURE__ */ xi("div", {
2468
+ }, [Z]);
2469
+ return /* @__PURE__ */ Ci("div", {
2469
2470
  className: "relative flex flex-1 flex-col overflow-hidden",
2470
2471
  children: [
2471
- /* @__PURE__ */ xi("div", {
2472
+ /* @__PURE__ */ Ci("div", {
2472
2473
  className: "contents",
2473
- inert: $.active || K || void 0,
2474
- ...G.ids ? {
2474
+ inert: $.active || G || void 0,
2475
+ ...W.ids ? {
2475
2476
  role: "tabpanel",
2476
- id: G.ids.chatPanel,
2477
- "aria-labelledby": G.ids.chatTab
2477
+ id: W.ids.chatPanel,
2478
+ "aria-labelledby": W.ids.chatTab
2478
2479
  } : {},
2479
2480
  children: [
2480
- Ia === null ? null : /* @__PURE__ */ j(Rn, { onDismiss: () => Fa(Ia) }),
2481
- Xs.length > 0 && !$.active ? /* @__PURE__ */ j(In, {
2482
- count: Xs.length,
2483
- onOpenTranscript: () => co(!0)
2481
+ Ra === null ? null : /* @__PURE__ */ A(zn, { onDismiss: () => La(Ra) }),
2482
+ Q.length > 0 && !$.active ? /* @__PURE__ */ A(Ln, {
2483
+ count: Q.length,
2484
+ onOpenTranscript: () => uo(!0)
2484
2485
  }) : null,
2485
- Bs.length === 0 && (ja || Ma) ? /* @__PURE__ */ j(zn, {
2486
- state: ja ? "loading" : "failed",
2487
- onRetry: Va
2488
- }) : Bs.length === 0 && U?.sync?.hasOlder ? /* @__PURE__ */ j("div", {
2486
+ Hs.length === 0 && (Na || Pa) ? /* @__PURE__ */ A(Bn, {
2487
+ state: Na ? "loading" : "failed",
2488
+ onRetry: Ua
2489
+ }) : Hs.length === 0 && H?.sync?.hasOlder ? /* @__PURE__ */ A("div", {
2489
2490
  className: "flex min-h-0 flex-1 flex-col",
2490
- children: /* @__PURE__ */ j(Vn, {
2491
- onShowEarlier: Ha,
2492
- disabled: ja
2491
+ children: /* @__PURE__ */ A(Hn, {
2492
+ onShowEarlier: Wa,
2493
+ disabled: Na
2493
2494
  })
2494
- }) : Bs.length === 0 ? /* @__PURE__ */ j(Xn, {
2495
- mode: V,
2496
- onSuggestionClick: Ps,
2497
- explainsAuto: qa,
2498
- suggestions: qa && V === "assistant" ? f(F.find((e) => e.id === "assistant")?.suggestions ?? [], F.find((e) => e.id === "api-calls")?.suggestions ?? []) : void 0
2499
- }) : /* @__PURE__ */ xi("div", {
2495
+ }) : Hs.length === 0 ? /* @__PURE__ */ A(Zn, {
2496
+ mode: B,
2497
+ onSuggestionClick: Is,
2498
+ explainsAuto: Ya,
2499
+ suggestions: Ya && B === "assistant" ? f(P.find((e) => e.id === "assistant")?.suggestions ?? [], P.find((e) => e.id === "api-calls")?.suggestions ?? []) : void 0
2500
+ }) : /* @__PURE__ */ Ci("div", {
2500
2501
  className: "flex min-h-0 flex-1 flex-col",
2501
- children: [U?.sync?.hasOlder ? /* @__PURE__ */ j(Vn, {
2502
- onShowEarlier: Ha,
2503
- disabled: ja
2504
- }) : null, /* @__PURE__ */ j(cr, {
2505
- onApprovePendingWrite: Po,
2506
- approvingWriteRef: Eo,
2507
- approvableMessageId: Hs?.messageId ?? null,
2508
- retryableMessageId: Us,
2509
- messages: Bs,
2510
- processing: ya ?? null,
2511
- streamingMessageId: xa,
2512
- failedMessageId: Sa,
2513
- onRetry: Eo === null ? Is : void 0,
2514
- renderWriteProposals: Gs,
2515
- hidesLegacyWriteCard: Ws,
2516
- renderUiOffers: qs
2502
+ children: [H?.sync?.hasOlder ? /* @__PURE__ */ A(Hn, {
2503
+ onShowEarlier: Wa,
2504
+ disabled: Na
2505
+ }) : null, /* @__PURE__ */ A(lr, {
2506
+ onApprovePendingWrite: Io,
2507
+ approvingWriteRef: Oo,
2508
+ approvableMessageId: Ws?.messageId ?? null,
2509
+ retryableMessageId: Gs,
2510
+ messages: Hs,
2511
+ processing: xa ?? null,
2512
+ streamingMessageId: Ca,
2513
+ failedMessageId: wa,
2514
+ onRetry: Oo === null ? Rs : void 0,
2515
+ renderWriteProposals: qs,
2516
+ hidesLegacyWriteCard: Ks,
2517
+ renderUiOffers: Ys
2517
2518
  })]
2518
2519
  }),
2519
- ka ? /* @__PURE__ */ j(Bn, { onStartNew: () => na() }) : null,
2520
- Aa && B ? /* @__PURE__ */ j(Ln, { onUnarchive: () => Yn.updateConversation(B, { archived: !1 }) }) : null,
2521
- Os === null ? null : /* @__PURE__ */ j(Zn, {
2522
- tr: N,
2523
- onDismiss: () => ks(null)
2520
+ ja ? /* @__PURE__ */ A(Vn, { onStartNew: () => ia() }) : null,
2521
+ Ma && z ? /* @__PURE__ */ A(Rn, { onUnarchive: () => Xn.updateConversation(z, { archived: !1 }) }) : null,
2522
+ As === null ? null : /* @__PURE__ */ A(Qn, {
2523
+ tr: M,
2524
+ onDismiss: () => js(null)
2524
2525
  }),
2525
- Bs.length > 0 && (ja || Ma) ? /* @__PURE__ */ j(zn, {
2526
- state: ja ? "loading" : "failed",
2527
- onRetry: Va,
2526
+ Hs.length > 0 && (Na || Pa) ? /* @__PURE__ */ A(Bn, {
2527
+ state: Na ? "loading" : "failed",
2528
+ onRetry: Ua,
2528
2529
  compact: !0
2529
2530
  }) : null,
2530
- /* @__PURE__ */ j(pi, {
2531
- onStartVoiceSession: $.available && bo ? Tc : void 0,
2532
- onSend: (e, t) => void Q(e, t, { fromPerson: !0 }),
2533
- onDraftStart: To,
2534
- disabled: ba || Eo !== null || ja || ts,
2535
- readOnly: ka,
2536
- placeholder: V === "api-calls" ? N("chatArea.placeholderActions", "What would you like me to do?") : N("chatArea.placeholderGeneral", "Ask me anything…"),
2537
- mode: V,
2538
- writeAccessDenied: Mi === "denied" && !!_o?.writeCapable,
2539
- availableModes: Ga,
2540
- attachmentCharsPerFile: $a,
2541
- onModeChange: rl,
2542
- auto: Ka ? {
2543
- active: qa,
2544
- onSelect: nl
2531
+ /* @__PURE__ */ A(mi, {
2532
+ onStartVoiceSession: $.available && So ? Ec : void 0,
2533
+ onSend: (e, t) => void Z(e, t, { fromPerson: !0 }),
2534
+ onDraftStart: Do,
2535
+ disabled: Sa || Oo !== null || Na || rs,
2536
+ readOnly: ja,
2537
+ placeholder: B === "api-calls" ? M("chatArea.placeholderActions", "What would you like me to do?") : M("chatArea.placeholderGeneral", "Ask me anything…"),
2538
+ mode: B,
2539
+ writeAccessDenied: Pi === "denied" && !!yo?.writeCapable,
2540
+ availableModes: qa,
2541
+ attachmentCharsPerFile: to,
2542
+ onModeChange: il,
2543
+ auto: Ja ? {
2544
+ active: Ya,
2545
+ onSelect: rl
2545
2546
  } : void 0,
2546
- suspendDictation: K,
2547
- onVoiceStateChange: G.ids ? Nc : void 0
2548
- })
2547
+ suspendDictation: G,
2548
+ onVoiceStateChange: W.ids ? Pc : void 0
2549
+ }),
2550
+ /* @__PURE__ */ A(En, { className: "px-3 pb-2 pt-1" })
2549
2551
  ]
2550
2552
  }),
2551
- io && !$.active ? /* @__PURE__ */ j(Hn, {
2552
- turns: Xs,
2553
- onClose: () => co(!1),
2554
- onSave: Zs,
2555
- onContinueInChat: Oc ? kc : void 0,
2553
+ oo && !$.active ? /* @__PURE__ */ A(Un, {
2554
+ turns: Q,
2555
+ onClose: () => uo(!1),
2556
+ onSave: Qs,
2557
+ onContinueInChat: kc ? Ac : void 0,
2556
2558
  closeOnEscape: !0,
2557
- onShowEarlier: U?.sync?.hasOlder ? Ha : void 0,
2558
- showEarlierDisabled: ja,
2559
- renderAfterTurn: Ks
2559
+ onShowEarlier: H?.sync?.hasOlder ? Wa : void 0,
2560
+ showEarlierDisabled: Na,
2561
+ renderAfterTurn: Js
2560
2562
  }) : null,
2561
- K && ao && G.ids ? /* @__PURE__ */ j(_r, {
2562
- tab: ao,
2563
- id: G.ids.avatarPanel,
2564
- labelledBy: G.ids.avatarTab,
2565
- leaveHintId: G.ids.leaveHint,
2566
- shown: Wc,
2567
- voice: Vc,
2568
- ...Gc ? { ask: Zc } : {}
2563
+ G && so && W.ids ? /* @__PURE__ */ A(vr, {
2564
+ tab: so,
2565
+ id: W.ids.avatarPanel,
2566
+ labelledBy: W.ids.avatarTab,
2567
+ leaveHintId: W.ids.leaveHint,
2568
+ shown: Gc,
2569
+ voice: Hc,
2570
+ ...Kc ? { ask: Qc } : {}
2569
2571
  }) : null,
2570
- $.active && /* @__PURE__ */ j(ur, {
2572
+ $.active && /* @__PURE__ */ A(dr, {
2571
2573
  session: $.session,
2572
2574
  notice: $.notice,
2573
2575
  privacyNotice: $.handsFree.privacyNotice,
@@ -2578,50 +2580,50 @@ var ki = () => () => {}, Ai = () => "off", ji = ({ visible: ji = !0, writeAccess
2578
2580
  correcting: $.correcting,
2579
2581
  onLetMeFinish: $.letMeFinish,
2580
2582
  onImDone: $.imDone,
2581
- turns: ac,
2583
+ turns: oc,
2582
2584
  spokenChunks: $.spokenChunks,
2583
- attachments: Qs.attachments,
2584
- onAttachFiles: Qs.addFiles,
2585
- onRemoveAttachment: Qs.remove,
2586
- onRetryAttachment: Qs.retry,
2587
- canAttachMore: Qs.canAddMore,
2588
- preparingAttachments: Qs.preparingCount,
2589
- attachmentsLocked: Qs.isCommitting,
2590
- attachmentNotice: nc,
2591
- onSaveTranscript: Zs,
2592
- onContinueInChat: kc,
2585
+ attachments: $s.attachments,
2586
+ onAttachFiles: $s.addFiles,
2587
+ onRemoveAttachment: $s.remove,
2588
+ onRetryAttachment: $s.retry,
2589
+ canAttachMore: $s.canAddMore,
2590
+ preparingAttachments: $s.preparingCount,
2591
+ attachmentsLocked: $s.isCommitting,
2592
+ attachmentNotice: rc,
2593
+ onSaveTranscript: Qs,
2594
+ onContinueInChat: Ac,
2593
2595
  onInterrupt: () => {
2594
- $.interrupt(), Mo();
2596
+ $.interrupt(), Po();
2595
2597
  },
2596
- spoken: zs,
2598
+ spoken: Vs,
2597
2599
  onToggleMute: $.toggleMute,
2598
- onEnd: jc,
2599
- proposalChip: pc ? {
2600
- label: bt(pc, N),
2601
- onOpen: fc
2600
+ onEnd: Mc,
2601
+ proposalChip: mc ? {
2602
+ label: bt(mc, M),
2603
+ onOpen: pc
2602
2604
  } : null,
2603
- proposalTray: hc,
2604
- renderAfterTurn: Ks,
2605
- onViewChange: G.ids ? Uc : void 0
2605
+ proposalTray: gc,
2606
+ renderAfterTurn: Js,
2607
+ onViewChange: W.ids ? Wc : void 0
2606
2608
  }),
2607
- /* @__PURE__ */ j(hi, {
2608
- open: eo !== null,
2609
- mode: al,
2610
- currentMode: _o ?? { id: V },
2611
- onConfirm: il,
2612
- onCancel: ol
2609
+ /* @__PURE__ */ A(gi, {
2610
+ open: no !== null,
2611
+ mode: ol,
2612
+ currentMode: yo ?? { id: B },
2613
+ onConfirm: al,
2614
+ onCancel: sl
2613
2615
  }),
2614
- /* @__PURE__ */ j(On, {
2615
- ...Ea.dialog,
2616
- view: Js?.view ?? Ea.dialog.view,
2617
- serverNow: Js?.serverNow ?? NaN,
2618
- arrivedAt: Js?.arrivedAt ?? NaN,
2619
- capabilities: Js ? Ca[Js.session.sandboxId] : null,
2620
- turnInFlight: ba,
2621
- tr: N
2616
+ /* @__PURE__ */ A(kn, {
2617
+ ...Oa.dialog,
2618
+ view: Xs?.view ?? Oa.dialog.view,
2619
+ serverNow: Xs?.serverNow ?? NaN,
2620
+ arrivedAt: Xs?.arrivedAt ?? NaN,
2621
+ capabilities: Xs ? Ta[Xs.session.sandboxId] : null,
2622
+ turnInFlight: Sa,
2623
+ tr: M
2622
2624
  })
2623
2625
  ]
2624
2626
  });
2625
2627
  };
2626
2628
  //#endregion
2627
- export { ji as AssistantChatArea };
2629
+ export { Ni as AssistantChatArea };