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