@burdenoff/fe-libs 2026.1016.1 → 2026.1016.3

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