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