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