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