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