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