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