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