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