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