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