@burdenoff/fe-libs 2026.1008.2 → 2026.1008.4

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