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