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