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