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