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