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