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