@burdenoff/fe-libs 2026.1007.6 → 2026.1008.1

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