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