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