@burdenoff/fe-libs 2026.1029.7 → 2026.1029.9

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