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