@burdenoff/fe-libs 2026.1004.4 → 2026.1004.5

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 (37) hide show
  1. package/dist/shared/assistant/i18nManifest.d.ts +10 -0
  2. package/dist/shared/assistant/i18nManifest.d.ts.map +1 -1
  3. package/dist/shared/assistant/i18nManifest.js +22 -12
  4. package/dist/shared/assistant/index.d.ts +3 -0
  5. package/dist/shared/assistant/index.d.ts.map +1 -1
  6. package/dist/shared/assistant/store.d.ts +10 -0
  7. package/dist/shared/assistant/store.d.ts.map +1 -1
  8. package/dist/shared/assistant/store.js +52 -44
  9. package/dist/shared/assistant/ui/AssistantChatArea.d.ts.map +1 -1
  10. package/dist/shared/assistant/ui/AssistantChatArea.js +761 -746
  11. package/dist/shared/assistant/ui/AssistantMoreMenu.d.ts.map +1 -1
  12. package/dist/shared/assistant/ui/AssistantMoreMenu.js +58 -56
  13. package/dist/shared/assistant/ui/AssistantSpeechProvider.d.ts.map +1 -1
  14. package/dist/shared/assistant/ui/AssistantSpeechProvider.js +106 -105
  15. package/dist/shared/assistant/ui/composer/AssistantVoiceGraceSelector.d.ts +20 -0
  16. package/dist/shared/assistant/ui/composer/AssistantVoiceGraceSelector.d.ts.map +1 -0
  17. package/dist/shared/assistant/ui/composer/AssistantVoiceGraceSelector.js +39 -0
  18. package/dist/shared/assistant/ui/useVoiceSession.d.ts +35 -2
  19. package/dist/shared/assistant/ui/useVoiceSession.d.ts.map +1 -1
  20. package/dist/shared/assistant/ui/useVoiceSession.js +232 -171
  21. package/dist/shared/assistant/ui/voice/AssistantVoiceSession.d.ts +15 -1
  22. package/dist/shared/assistant/ui/voice/AssistantVoiceSession.d.ts.map +1 -1
  23. package/dist/shared/assistant/ui/voice/AssistantVoiceSession.js +121 -101
  24. package/dist/shared/assistant/voice/handsFree.d.ts +160 -0
  25. package/dist/shared/assistant/voice/handsFree.d.ts.map +1 -0
  26. package/dist/shared/assistant/voice/handsFree.js +104 -0
  27. package/dist/shared/assistant/voice/supersededTurns.d.ts +29 -0
  28. package/dist/shared/assistant/voice/supersededTurns.d.ts.map +1 -0
  29. package/dist/shared/assistant/voice/supersededTurns.js +17 -0
  30. package/dist/shared/assistant/voice/useVoiceInput.d.ts +7 -0
  31. package/dist/shared/assistant/voice/useVoiceInput.d.ts.map +1 -1
  32. package/dist/shared/assistant/voice/useVoiceInput.js +13 -10
  33. package/dist/shared/assistant/voice/voiceSession.d.ts +64 -20
  34. package/dist/shared/assistant/voice/voiceSession.d.ts.map +1 -1
  35. package/dist/shared/assistant/voice/voiceSession.js +120 -67
  36. package/dist/shared-assistant.js +206 -203
  37. package/package.json +1 -1
@@ -18,204 +18,205 @@ import { assistantUsageLedger as Ce, hasPendingUsageReports as we, reportUsageWi
18
18
  import { withIncompleteTurnNotice as Oe } from "../streamBudget.js";
19
19
  import { chatTurns as T, isVoiceTurn as ke, voiceMarker as E, voiceSessionIdOf as Ae } from "../voice/turnVisibility.js";
20
20
  import { speechFeed as je } from "../speech/speechFeed.js";
21
- import { buildContinuedFromVoiceNote as Me, buildVoiceTranscriptMarkdown as Ne, voiceTranscriptFilename as Pe } from "../voice/voiceTranscript.js";
22
- import { pollDelayMs as Fe } from "../voice/assistantPollSchedule.js";
23
- import { toCaptionText as D } from "../voice/captionText.js";
24
- import { resolveAssistantLanguage as Ie } from "../voice/languages.js";
25
- import { resolveLanguagePair as Le } from "../voice/languagePair.js";
26
- import { INITIAL_TRANSCRIPT_AUTO_OPEN as Re, isAwaitingOwnConversation as ze, maySendSpokenTurn as Be, planTranscriptAutoOpen as Ve, planVoiceSessionBinding as He, planVoiceSessionStart as Ue, planVoiceSpokenEntry as We, voiceBindingAtStart as Ge, voiceBindingConversationId as Ke } from "../voice/voiceReopen.js";
27
- import { countInlineImageCandidates as qe, countInlinedImageParts as Je, getSendableAttachments as Ye, largestInlineCharsPerFile as Xe, resolveAssistantInlineLimits as Ze, toMessageAttachment as Qe } from "../attachments.js";
28
- import { WRITE_PROPOSAL_VOICE_COPY as $e, isVoiceProposalBound as et, voiceProposalChip as tt, voiceProposalChipText as nt, voiceReadbacksDue as rt, voiceWaitingProposals as it, writeProposalVoiceLine as at, writeProposalVoiceReadback as ot } from "../writeProposalVoice.js";
29
- import { createAdminModeAccessGate as st, resolveAssistantSendModeAfterAccess as ct } from "../adminModeSendGate.js";
30
- import { buildBoundedAttachmentTurn as lt } from "../attachmentTurn.js";
31
- import { isTurnInFlight as ut, planAbandonedTurn as dt, planTurnAbort as ft } from "../turnState.js";
32
- import { getAssistantDisplayContent as pt } from "../displayContent.js";
33
- import { NO_FIRST_TEXT as mt, buildAssistantProgress as ht, readAheadFor as gt, snapshotReplyFloor as _t, startSessionReadAhead as vt, trackFirstText as yt } from "../turnProgress.js";
34
- import { parseToolActivity as bt } from "./AssistantToolActivity.js";
35
- import { countSpokenTurns as xt, spokenMessagesSinceContinueNote as St, spokenTurnText as Ct } from "../spokenTurns.js";
36
- import { beginTurn as wt, describeTurn as O, detectTurnDevice as Tt, markTurn as k, restartAttempt as Et, turnClockMs as Dt } from "../turnTimeline.js";
37
- import { useAssistantSpeech as Ot } from "./AssistantSpeechProvider.js";
38
- import { useVoiceSession as kt } from "./useVoiceSession.js";
39
- import { getOrganizationId as At, getWorkspaceId as A } from "../context.js";
40
- import { isMultimodalBodyRejection as jt, isRecoverableAssistantError as Mt } from "../transportErrors.js";
41
- import { createReadinessTracker as Nt, planAfterTransportFailure as Pt, planTrustedSandboxFailure as Ft } from "../sandboxReadiness.js";
42
- import { writeProposalConfirmState as It } from "./writeProposalPresentation.js";
43
- import { writeProposalUsesDialog as Lt } from "./AssistantWriteProposalCard.js";
44
- import { AssistantWriteConfirmDialog as Rt } from "./AssistantWriteConfirmDialog.js";
45
- import { useWriteProposalConfirm as zt } from "./useWriteProposalConfirm.js";
46
- import { AssistantWriteProposalSlot as Bt } from "./AssistantWriteProposalSlot.js";
47
- import { readWriteProposalRefs as Vt, writeProposalsEnabledFor as Ht } from "../writeProposalDiscovery.js";
48
- import { planWriteReply as Ut, promptWriteApproval as Wt } from "../writeReplySend.js";
49
- import { useWriteProposals as Gt } from "./useWriteProposals.js";
50
- import { AssistantSpokenTurnsNotice as Kt } from "./AssistantSpokenTurnsNotice.js";
51
- import { AssistantHistoryArchivedNotice as qt, AssistantHistoryDeletedNotice as Jt, AssistantHistoryLoadState as Yt, AssistantHistoryReadOnlyBanner as Xt, AssistantHistoryShowEarlier as Zt } from "./AssistantHistoryNotices.js";
52
- import { VoiceTranscriptDrawer as Qt } from "./voice/VoiceTranscriptDrawer.js";
53
- import { downloadFile as $t } from "../exportConversation.js";
54
- import { conversationHasHistory as en, isOtherScopeHistoryConversation as tn, isReadOnlyHistoryConversation as nn, isReusableHistoryDraft as rn } from "../history/historyList.js";
55
- import { useAssistantHistoryStatus as an } from "../history/historyStatus.js";
56
- import { assistantHistory as on } from "../history/historyEngine.js";
57
- import { AssistantEmptyState as sn } from "./AssistantEmptyState.js";
58
- import { AssistantNothingToDeleteNotice as cn } from "./AssistantDeleteConversationDialog.js";
59
- import { assistantHistoryIsOn as ln } from "./conversationDelete.js";
60
- import { useConversationDeleteDialog as un } from "./conversationDeleteDialog.js";
61
- import { resolveConversationDeleteTarget as dn } from "../conversationDeleteCommand.js";
62
- import { resumeContextFor as fn } from "../history/historyResume.js";
63
- import { useHistoryRowControlsFor as pn } from "../history/useHistoryRowControls.js";
64
- import { AssistantMessageList as mn } from "./AssistantMessageList.js";
65
- import { AssistantVoiceSession as hn } from "./voice/AssistantVoiceSession.js";
66
- import { useAssistantApiAccess as gn } from "../useAssistantApiAccess.js";
67
- import { useConversationTurns as _n } from "../useConversationTurns.js";
68
- import { sendAssistantTurnTimings as vn, startTurnTimingReporting as yn } from "../turnTimingReporter.js";
69
- import { QuarantineSet as bn, WarmCancelled as xn, claimPreopenedSession as Sn, consumeWarm as Cn, preopenKey as wn, preopenWanted as Tn, prewarmTarget as En, settleWarmBeforeSend as Dn, startPreopen as On, startWarm as kn, warmState as An } from "../prewarm.js";
70
- import { isThereRequest as jn, parseChoice as Mn } from "../uiActions/deixis.js";
71
- import { navEntryIds as Nn } from "../uiActions/resolveTarget.js";
72
- import { planRecordResolution as Pn } from "../uiActions/recordNames.js";
73
- import { isAlreadyThere as Fn, matchLocalUiCommand as In, navDestinations as Ln, normaliseUtterance as Rn, planThemeChange as zn } from "../localUiCommands.js";
74
- import { backDoneCopy as Bn, chooseDestinationCopy as Vn, chooseLinkedCopy as Hn, entityNounText as Un, linkNotOpenableCopy as Wn, navigationCommandCopy as Gn, navigationOutcomeCopy as Kn, pickFromListCopy as qn, recordChoiceCopy as Jn, recordKindsCopy as Yn, themeCommandCopy as Xn } from "../localUiCommandCopy.js";
75
- import { runNavigation as Zn } from "../uiActions/navigationOutcome.js";
76
- import { assistantBackStack as Qn, isBackRunnable as $n } from "../uiActions/backStack.js";
77
- import { buildNavigateAction as er, destinationForPath as tr, labelForPath as nr, newestAssistantOnSurface as rr } from "../uiActions/navigateAction.js";
78
- import { buildNavigationContext as ir, latestReplyOnSurface as ar, rememberPresentedList as or } from "../uiActions/linkContext.js";
79
- import { buildUiCatalogue as sr } from "../uiActions/uiCatalogue.js";
80
- import { dispatchAssistantQuotaExhausted as cr, notifyAiCreditsUpdated as lr } from "../aiCredits.js";
81
- import { useAssistantAttachments as ur } from "../useAssistantAttachments.js";
82
- import { AssistantComposer as dr } from "./composer/AssistantComposer.js";
83
- import { isProdRuntime as fr } from "../env.js";
84
- import { AssistantApiCallsConsentDialog as pr } from "./AssistantApiCallsConsentDialog.js";
85
- import { useVisibleNavItems as mr } from "../../../chrome/mobileTabBar/useVisibleNavItems.js";
86
- import { useCallback as j, useEffect as M, useMemo as hr, useRef as N, useState as gr, useSyncExternalStore as _r } from "react";
87
- import { jsx as P, jsxs as vr } from "react/jsx-runtime";
21
+ import { isTurnSuperseded as Me, markTurnSuperseded as Ne } from "../voice/supersededTurns.js";
22
+ import { buildContinuedFromVoiceNote as Pe, buildVoiceTranscriptMarkdown as D, voiceTranscriptFilename as Fe } from "../voice/voiceTranscript.js";
23
+ import { pollDelayMs as Ie } from "../voice/assistantPollSchedule.js";
24
+ import { toCaptionText as Le } from "../voice/captionText.js";
25
+ import { resolveAssistantLanguage as Re } from "../voice/languages.js";
26
+ import { resolveLanguagePair as ze } from "../voice/languagePair.js";
27
+ import { INITIAL_TRANSCRIPT_AUTO_OPEN as Be, isAwaitingOwnConversation as Ve, maySendSpokenTurn as He, planTranscriptAutoOpen as Ue, planVoiceSessionBinding as We, planVoiceSessionStart as Ge, planVoiceSpokenEntry as Ke, voiceBindingAtStart as qe, voiceBindingConversationId as Je } from "../voice/voiceReopen.js";
28
+ import { countInlineImageCandidates as Ye, countInlinedImageParts as Xe, getSendableAttachments as Ze, largestInlineCharsPerFile as Qe, resolveAssistantInlineLimits as $e, toMessageAttachment as et } from "../attachments.js";
29
+ import { WRITE_PROPOSAL_VOICE_COPY as tt, isVoiceProposalBound as nt, voiceProposalChip as rt, voiceProposalChipText as it, voiceReadbacksDue as at, voiceWaitingProposals as ot, writeProposalVoiceLine as st, writeProposalVoiceReadback as ct } from "../writeProposalVoice.js";
30
+ import { createAdminModeAccessGate as lt, resolveAssistantSendModeAfterAccess as ut } from "../adminModeSendGate.js";
31
+ import { buildBoundedAttachmentTurn as dt } from "../attachmentTurn.js";
32
+ import { isTurnInFlight as ft, planAbandonedTurn as pt, planTurnAbort as mt } from "../turnState.js";
33
+ import { getAssistantDisplayContent as ht } from "../displayContent.js";
34
+ import { NO_FIRST_TEXT as gt, buildAssistantProgress as _t, readAheadFor as vt, snapshotReplyFloor as yt, startSessionReadAhead as bt, trackFirstText as xt } from "../turnProgress.js";
35
+ import { parseToolActivity as St } from "./AssistantToolActivity.js";
36
+ import { countSpokenTurns as Ct, spokenMessagesSinceContinueNote as wt, spokenTurnText as Tt } from "../spokenTurns.js";
37
+ import { beginTurn as Et, describeTurn as O, detectTurnDevice as Dt, markTurn as k, restartAttempt as Ot, turnClockMs as kt } from "../turnTimeline.js";
38
+ import { useAssistantSpeech as At } from "./AssistantSpeechProvider.js";
39
+ import { useVoiceSession as jt } from "./useVoiceSession.js";
40
+ import { getOrganizationId as Mt, getWorkspaceId as A } from "../context.js";
41
+ import { isMultimodalBodyRejection as Nt, isRecoverableAssistantError as Pt } from "../transportErrors.js";
42
+ import { createReadinessTracker as Ft, planAfterTransportFailure as It, planTrustedSandboxFailure as Lt } from "../sandboxReadiness.js";
43
+ import { writeProposalConfirmState as Rt } from "./writeProposalPresentation.js";
44
+ import { writeProposalUsesDialog as zt } from "./AssistantWriteProposalCard.js";
45
+ import { AssistantWriteConfirmDialog as Bt } from "./AssistantWriteConfirmDialog.js";
46
+ import { useWriteProposalConfirm as Vt } from "./useWriteProposalConfirm.js";
47
+ import { AssistantWriteProposalSlot as Ht } from "./AssistantWriteProposalSlot.js";
48
+ import { readWriteProposalRefs as Ut, writeProposalsEnabledFor as Wt } from "../writeProposalDiscovery.js";
49
+ import { planWriteReply as Gt, promptWriteApproval as Kt } from "../writeReplySend.js";
50
+ import { useWriteProposals as qt } from "./useWriteProposals.js";
51
+ import { AssistantSpokenTurnsNotice as Jt } from "./AssistantSpokenTurnsNotice.js";
52
+ import { AssistantHistoryArchivedNotice as Yt, AssistantHistoryDeletedNotice as Xt, AssistantHistoryLoadState as Zt, AssistantHistoryReadOnlyBanner as Qt, AssistantHistoryShowEarlier as $t } from "./AssistantHistoryNotices.js";
53
+ import { VoiceTranscriptDrawer as en } from "./voice/VoiceTranscriptDrawer.js";
54
+ import { downloadFile as tn } from "../exportConversation.js";
55
+ import { conversationHasHistory as nn, isOtherScopeHistoryConversation as rn, isReadOnlyHistoryConversation as an, isReusableHistoryDraft as on } from "../history/historyList.js";
56
+ import { useAssistantHistoryStatus as sn } from "../history/historyStatus.js";
57
+ import { assistantHistory as cn } from "../history/historyEngine.js";
58
+ import { AssistantEmptyState as ln } from "./AssistantEmptyState.js";
59
+ import { AssistantNothingToDeleteNotice as un } from "./AssistantDeleteConversationDialog.js";
60
+ import { assistantHistoryIsOn as dn } from "./conversationDelete.js";
61
+ import { useConversationDeleteDialog as fn } from "./conversationDeleteDialog.js";
62
+ import { resolveConversationDeleteTarget as pn } from "../conversationDeleteCommand.js";
63
+ import { resumeContextFor as mn } from "../history/historyResume.js";
64
+ import { useHistoryRowControlsFor as hn } from "../history/useHistoryRowControls.js";
65
+ import { AssistantMessageList as gn } from "./AssistantMessageList.js";
66
+ import { AssistantVoiceSession as _n } from "./voice/AssistantVoiceSession.js";
67
+ import { useAssistantApiAccess as vn } from "../useAssistantApiAccess.js";
68
+ import { useConversationTurns as yn } from "../useConversationTurns.js";
69
+ import { sendAssistantTurnTimings as bn, startTurnTimingReporting as xn } from "../turnTimingReporter.js";
70
+ import { QuarantineSet as Sn, WarmCancelled as Cn, claimPreopenedSession as wn, consumeWarm as Tn, preopenKey as En, preopenWanted as Dn, prewarmTarget as On, settleWarmBeforeSend as kn, startPreopen as An, startWarm as jn, warmState as Mn } from "../prewarm.js";
71
+ import { isThereRequest as Nn, parseChoice as Pn } from "../uiActions/deixis.js";
72
+ import { navEntryIds as Fn } from "../uiActions/resolveTarget.js";
73
+ import { planRecordResolution as In } from "../uiActions/recordNames.js";
74
+ import { isAlreadyThere as Ln, matchLocalUiCommand as Rn, navDestinations as zn, normaliseUtterance as Bn, planThemeChange as Vn } from "../localUiCommands.js";
75
+ import { backDoneCopy as Hn, chooseDestinationCopy as Un, chooseLinkedCopy as Wn, entityNounText as Gn, linkNotOpenableCopy as Kn, navigationCommandCopy as qn, navigationOutcomeCopy as Jn, pickFromListCopy as Yn, recordChoiceCopy as Xn, recordKindsCopy as Zn, themeCommandCopy as Qn } from "../localUiCommandCopy.js";
76
+ import { runNavigation as $n } from "../uiActions/navigationOutcome.js";
77
+ import { assistantBackStack as er, isBackRunnable as tr } from "../uiActions/backStack.js";
78
+ import { buildNavigateAction as nr, destinationForPath as rr, labelForPath as ir, newestAssistantOnSurface as ar } from "../uiActions/navigateAction.js";
79
+ import { buildNavigationContext as or, latestReplyOnSurface as sr, rememberPresentedList as cr } from "../uiActions/linkContext.js";
80
+ import { buildUiCatalogue as lr } from "../uiActions/uiCatalogue.js";
81
+ import { dispatchAssistantQuotaExhausted as ur, notifyAiCreditsUpdated as dr } from "../aiCredits.js";
82
+ import { useAssistantAttachments as fr } from "../useAssistantAttachments.js";
83
+ import { AssistantComposer as pr } from "./composer/AssistantComposer.js";
84
+ import { isProdRuntime as mr } from "../env.js";
85
+ import { AssistantApiCallsConsentDialog as hr } from "./AssistantApiCallsConsentDialog.js";
86
+ import { useVisibleNavItems as gr } from "../../../chrome/mobileTabBar/useVisibleNavItems.js";
87
+ import { useCallback as j, useEffect as M, useMemo as _r, useRef as N, useState as vr, useSyncExternalStore as yr } from "react";
88
+ import { jsx as P, jsxs as br } from "react/jsx-runtime";
88
89
  //#region src/shared/assistant/ui/AssistantChatArea.tsx
89
- var yr = 2500, br = 600, xr = 2e4, Sr = 1e4, Cr = 6e3;
90
+ var xr = 2500, Sr = 600, Cr = 2e4, wr = 1e4, Tr = 6e3;
90
91
  function F() {
91
92
  return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
92
93
  }
93
- var wr = ({ visible: wr = !0, writeAccess: Tr = "unknown" }) => {
94
- let I = i(), { product: L, modes: R, gatherPageContext: Er, buildPrompt: Dr, reportTurnTimings: Or, reportTokenUsage: kr, localUiCommands: Ar } = r(), z = _e(r().writeApproval), jr = j((e, t) => {
94
+ var Er = ({ visible: Er = !0, writeAccess: Dr = "unknown" }) => {
95
+ let I = i(), { product: L, modes: R, gatherPageContext: Or, buildPrompt: kr, reportTurnTimings: Ar, reportTokenUsage: jr, localUiCommands: Mr } = r(), z = _e(r().writeApproval), Nr = j((e, t) => {
95
96
  let n = b.getState(), r = t ?? n.sandboxesByMode[e]?.sandboxId ?? null;
96
- return et({
97
+ return nt({
97
98
  mode: e,
98
99
  productWriteApproval: z,
99
100
  capabilities: r ? n.sandboxWriteCapabilities[r] : null
100
101
  });
101
- }, [z]), { getAccessToken: B, getWorkspaceToken: Mr, userId: V } = n(), { locale: H } = t(), Nr = b((e) => e.assistantLanguage), Pr = b((e) => e.replyLanguage), Fr = hr(() => Le(Nr, Pr, H), [
102
- Nr,
103
- Pr,
102
+ }, [z]), { getAccessToken: B, getWorkspaceToken: Pr, userId: V } = n(), { locale: H } = t(), Fr = b((e) => e.voiceGraceMs), Ir = b((e) => e.assistantLanguage), Lr = b((e) => e.replyLanguage), Rr = _r(() => ze(Ir, Lr, H), [
103
+ Ir,
104
+ Lr,
104
105
  H
105
- ]), Ir = Fr.reply.english, Lr = Fr.replyIsExplicit, Rr = Fr.reply.code, { conversations: zr, activeConversationId: U, mode: W, processingByConversationId: Br, setMode: Vr, setConversationMode: Hr, setActiveConversation: Ur, createConversation: G, addMessage: K, updateMessage: Wr, patchMessage: Gr, mergeMessageMetadata: Kr, setConversationProcessing: qr, clearConversationProcessing: Jr, setBackendSessionId: Yr, clearBackendSessionId: Xr, setSandbox: Zr, clearSandbox: Qr, acknowledgedWriteModes: $r, acknowledgeWriteMode: ei, autoRouting: ti, setAutoRouting: ni, routeConversation: ri } = b(), ii = zr.find((e) => e.id === U), ai = _n(ii), oi = ai.all, q = U ? Br[U] : void 0, si = ut(q?.status), ci = si ? q?.messageId ?? null : null, li = q?.status === "error" ? q.messageId : null, ui = b((e) => e.sandboxWriteCapabilities), { panel: J, entries: di, retiredSandboxes: fi } = Gt({
106
+ ]), zr = Rr.reply.english, Br = Rr.replyIsExplicit, Vr = Rr.reply.code, { conversations: Hr, activeConversationId: U, mode: W, processingByConversationId: Ur, setMode: Wr, setConversationMode: Gr, setActiveConversation: Kr, createConversation: G, addMessage: K, updateMessage: qr, patchMessage: Jr, mergeMessageMetadata: Yr, setConversationProcessing: Xr, clearConversationProcessing: Zr, setBackendSessionId: Qr, clearBackendSessionId: $r, setSandbox: ei, clearSandbox: ti, acknowledgedWriteModes: ni, acknowledgeWriteMode: ri, autoRouting: ii, setAutoRouting: ai, routeConversation: oi } = b(), si = Hr.find((e) => e.id === U), ci = yn(si), li = ci.all, q = U ? Ur[U] : void 0, ui = ft(q?.status), di = ui ? q?.messageId ?? null : null, fi = q?.status === "error" ? q.messageId : null, pi = b((e) => e.sandboxWriteCapabilities), { panel: J, entries: mi, retiredSandboxes: hi } = qt({
106
107
  tr: I,
107
108
  productWriteApproval: z
108
- }), pi = zt({
109
+ }), gi = Vt({
109
110
  approve: (e, t) => J.approve(e, t),
110
111
  decline: (e, t, n) => J.decline(e, t, n),
111
112
  presented: (e, t) => J.presented(e, t)
112
- }), mi = pi.dismiss, hi = N(null);
113
+ }), _i = gi.dismiss, vi = N(null);
113
114
  M(() => {
114
- mi();
115
- let e = hi.current;
116
- hi.current = U, e && e !== U && J.withdraw(e, "conversation_closed"), U && J.openConversation(U);
115
+ _i();
116
+ let e = vi.current;
117
+ vi.current = U, e && e !== U && J.withdraw(e, "conversation_closed"), U && J.openConversation(U);
117
118
  }, [
118
119
  U,
119
120
  J,
120
- mi
121
+ _i
121
122
  ]);
122
- let gi = nn(ii), _i = pn(ii)?.archivedAt != null, vi = an((e) => U !== null && U in e.loadingIds), yi = an((e) => U !== null && U in e.loadErrorIds), bi = an((e) => e.remoteDelete), [xi, Si] = gr(() => an.getState().remoteDelete?.at ?? null), Ci = bi?.wasActive === !0 && bi.at !== xi ? bi.at : null;
123
+ let yi = an(si), bi = hn(si)?.archivedAt != null, xi = sn((e) => U !== null && U in e.loadingIds), Si = sn((e) => U !== null && U in e.loadErrorIds), Ci = sn((e) => e.remoteDelete), [wi, Ti] = vr(() => sn.getState().remoteDelete?.at ?? null), Ei = Ci?.wasActive === !0 && Ci.at !== wi ? Ci.at : null;
123
124
  M(() => {
124
- if (Ci === null) return;
125
- let e = window.setTimeout(() => Si(Ci), Sr);
125
+ if (Ei === null) return;
126
+ let e = window.setTimeout(() => Ti(Ei), wr);
126
127
  return () => window.clearTimeout(e);
127
- }, [Ci]);
128
- let { canUseApiCalls: wi, loading: Ti } = gn(A(), V), Ei = N(st({
129
- loading: Ti,
130
- canUseAdminModes: wi
131
- })).current, Di = N(R);
128
+ }, [Ei]);
129
+ let { canUseApiCalls: Di, loading: Oi } = vn(A(), V), ki = N(lt({
130
+ loading: Oi,
131
+ canUseAdminModes: Di
132
+ })).current, Ai = N(R);
132
133
  M(() => {
133
- Di.current = R;
134
+ Ai.current = R;
134
135
  }, [R]);
135
- let Oi = () => {
136
+ let ji = () => {
136
137
  let e = b.getState().activeConversationId;
137
- e && on.openConversation(e, { modes: Di.current });
138
- }, ki = () => {
138
+ e && cn.openConversation(e, { modes: Ai.current });
139
+ }, Mi = () => {
139
140
  let e = b.getState().activeConversationId;
140
- e && on.loadEarlier(e);
141
- }, Ai = N(B);
141
+ e && cn.loadEarlier(e);
142
+ }, Ni = N(B);
142
143
  M(() => {
143
- Ai.current = B;
144
+ Ni.current = B;
144
145
  }, [B]);
145
- let ji = !!L && Or !== !1;
146
+ let Pi = !!L && Ar !== !1;
146
147
  M(() => {
147
- if (ji) return yn({ send: (e) => vn(e, {
148
+ if (Pi) return xn({ send: (e) => bn(e, {
148
149
  workspaceId: A(),
149
150
  authContext: {
150
- accessToken: Ai.current(),
151
- organizationId: At()
151
+ accessToken: Ni.current(),
152
+ organizationId: Mt()
152
153
  }
153
154
  }) });
154
- }, [ji]), M(() => {
155
- Ei.update({
156
- loading: Ti,
157
- canUseAdminModes: wi
155
+ }, [Pi]), M(() => {
156
+ ki.update({
157
+ loading: Oi,
158
+ canUseAdminModes: Di
158
159
  });
159
160
  }, [
160
- Ei,
161
- Ti,
162
- wi
161
+ ki,
162
+ Oi,
163
+ Di
163
164
  ]), M(() => () => {
164
- Ei.abandon();
165
- }, [Ei]);
166
- let Mi = hr(() => R.filter((e) => !e.requiresAdmin || wi), [R, wi]), Ni = d(Mi), Pi = ti && Ni, Fi = N(Ni);
165
+ ki.abandon();
166
+ }, [ki]);
167
+ let Fi = _r(() => R.filter((e) => !e.requiresAdmin || Di), [R, Di]), Ii = d(Fi), Li = ii && Ii, Ri = N(Ii);
167
168
  M(() => {
168
- Fi.current = Ni;
169
- }, [Ni]);
170
- let Ii = N(null), Li = N(!1), Ri = Xe(R), [zi, Bi] = gr(null), [Vi, Hi] = gr(null), Ui = Vi !== null && Vi === U, Wi = j((e) => {
171
- Hi(e ? b.getState().activeConversationId : null);
169
+ Ri.current = Ii;
170
+ }, [Ii]);
171
+ let zi = N(null), Bi = N(!1), Vi = Qe(R), [Hi, Ui] = vr(null), [Wi, Gi] = vr(null), Ki = Wi !== null && Wi === U, qi = j((e) => {
172
+ Gi(e ? b.getState().activeConversationId : null);
172
173
  }, []);
173
174
  M(() => {
174
- Hi((e) => e !== null && e !== U ? null : e);
175
+ Gi((e) => e !== null && e !== U ? null : e);
175
176
  }, [U]);
176
- let Gi = N(void 0), [Ki, qi] = gr(!1), Ji = j((e) => {
177
- Gi.current = e, qi(ze(e));
178
- }, []), Yi = j(() => {
177
+ let Ji = N(void 0), [Yi, Xi] = vr(!1), Zi = j((e) => {
178
+ Ji.current = e, Xi(Ve(e));
179
+ }, []), Qi = j(() => {
179
180
  let e = b.getState(), t = e.activeConversationId, n = t ? e.conversations.find((e) => e.id === t) : void 0;
180
181
  return !t || !n ? null : {
181
182
  id: t,
182
- reusableDraft: rn(n, p()),
183
+ reusableDraft: on(n, p()),
183
184
  liveProposals: J.liveFor(t).count,
184
- turnInFlight: ut(e.processingByConversationId[t]?.status)
185
+ turnInFlight: ft(e.processingByConversationId[t]?.status)
185
186
  };
186
- }, [J]), Xi = N({}), Y = N(Nt()), X = N(new bn()), Zi = N(/* @__PURE__ */ new Set()), Qi = hr(() => R.find((e) => e.id === W), [R, W]), $i = b((e) => {
187
+ }, [J]), $i = N({}), Y = N(Ft()), X = N(new Sn()), ea = N(/* @__PURE__ */ new Set()), ta = _r(() => R.find((e) => e.id === W), [R, W]), na = b((e) => {
187
188
  let t = e.sandboxesByMode[W]?.sandboxId;
188
189
  return t ? e.sandboxWriteCapabilities[t] : void 0;
189
- }), ea = Qi !== void 0 && et({
190
+ }), ra = ta !== void 0 && nt({
190
191
  mode: W,
191
192
  productWriteApproval: z,
192
- capabilities: $i
193
- }), ta = W === "assistant" || Qi !== void 0 && !Qi.writeCapable && !pe(W) || ea;
193
+ capabilities: na
194
+ }), ia = W === "assistant" || ta !== void 0 && !ta.writeCapable && !pe(W) || ra;
194
195
  M(() => {
195
- if (W !== "assistant" && Qi?.writeCapable && !re($r, W)) {
196
- Vr("assistant");
196
+ if (W !== "assistant" && ta?.writeCapable && !re(ni, W)) {
197
+ Wr("assistant");
197
198
  return;
198
199
  }
199
- Ti || (!Qi || Qi.requiresAdmin && !wi) && W !== "assistant" && Vr("assistant");
200
+ Oi || (!ta || ta.requiresAdmin && !Di) && W !== "assistant" && Wr("assistant");
200
201
  }, [
201
202
  W,
202
- Qi,
203
- wi,
204
- Ti,
205
- Vr,
206
- $r
203
+ ta,
204
+ Di,
205
+ Oi,
206
+ Wr,
207
+ ni
207
208
  ]);
208
- let na = j((e, t, n, r) => {
209
- qr(e, n, t, null, r);
210
- }, [qr]), ra = j(async (e, t, n, r, i, a = null) => {
209
+ let aa = j((e, t, n, r) => {
210
+ Xr(e, n, t, null, r);
211
+ }, [Xr]), oa = j(async (e, t, n, r, i, a = null) => {
211
212
  let s = (e, t) => {
212
- r && na(r.conversationId, r.assistantMessageId, e, t), a && (a.step = t, a.onStep?.(t));
213
+ r && aa(r.conversationId, r.assistantMessageId, e, t), a && (a.step = t, a.onStep?.(t));
213
214
  }, c = (e) => {
214
215
  r && k(r.assistantMessageId, e);
215
216
  }, l = () => {
216
217
  c("bootAdopted"), a?.beginBoot();
217
218
  }, u = () => a !== null && (a.signal.aborted || A() !== t), d = () => {
218
- if (u()) throw new xn("cancelled");
219
+ if (u()) throw new Cn("cancelled");
219
220
  }, f = b.getState().sandboxesByMode[e]?.sandboxId ?? null, p = !1, m = !1, h = !1, g = !1, ee = !1, te = async (r) => {
220
221
  if (i && !X.current.has(r) && Y.current.isFresh(r)) return p = !0, !0;
221
222
  h = !0;
@@ -225,43 +226,43 @@ var wr = ({ visible: wr = !0, writeAccess: Tr = "unknown" }) => {
225
226
  o = !0, l();
226
227
  });
227
228
  } catch {
228
- if (u()) throw new xn("cancelled");
229
+ if (u()) throw new Cn("cancelled");
229
230
  return Y.current.invalidate(r), X.current.add(r), a?.dead.push(r), ee = !0, !1;
230
231
  }
231
232
  return d(), Y.current.markVerified(r), o && (g = !0), !0;
232
233
  };
233
- if (f && (Zr(e, f, "provisioning"), s("provisioning", "reusingEnvironment"), await te(f) || (Zr(e, null, "provisioning"), f = null)), !f) {
234
+ if (f && (ei(e, f, "provisioning"), s("provisioning", "reusingEnvironment"), await te(f) || (ei(e, null, "provisioning"), f = null)), !f) {
234
235
  s("provisioning", "lookingForEnvironment");
235
- let r = await le(t, L, e, fr(), n, X.current, z);
236
+ let r = await le(t, L, e, mr(), n, X.current, z);
236
237
  d();
237
238
  let i = r?.id ?? null;
238
239
  if (i) {
239
- Zr(e, i, "provisioning"), s("provisioning", "reusingEnvironment");
240
+ ei(e, i, "provisioning"), s("provisioning", "reusingEnvironment");
240
241
  let t = r?.status === "PROVISIONING" || r?.status === "PENDING";
241
- t && l(), await te(i) ? (f = i, t && (g = !0)) : Zr(e, null, "provisioning");
242
+ t && l(), await te(i) ? (f = i, t && (g = !0)) : ei(e, null, "provisioning");
242
243
  }
243
244
  }
244
245
  if (!f) {
245
- if (a && !a.mayCreate) throw new xn("no-create");
246
+ if (a && !a.mayCreate) throw new Cn("no-create");
246
247
  if (c("provisionStarted"), e === "api-calls" && !B()) throw Error("API Calls mode requires an authenticated session. Please sign in again.");
247
- s("provisioning", "startingEnvironment"), Zr(e, null, "provisioning");
248
- let r = a ? [] : await C(t, L, e, fr(), n, X.current, z);
248
+ s("provisioning", "startingEnvironment"), ei(e, null, "provisioning");
249
+ let r = a ? [] : await C(t, L, e, mr(), n, X.current, z);
249
250
  if (r.length > 0) {
250
251
  let e = new Set(r);
251
252
  for (let e of r) Y.current.invalidate(e), X.current.add(e);
252
253
  let t = b.getState().sandboxesByMode;
253
- for (let [n, r] of Object.entries(t)) o(n) && r?.sandboxId && e.has(r.sandboxId) && Qr(n);
254
+ for (let [n, r] of Object.entries(t)) o(n) && r?.sandboxId && e.has(r.sandboxId) && ti(n);
254
255
  }
255
256
  c("createRequested");
256
257
  let i = a?.beginCreate();
257
258
  try {
258
- f = await x(L, e, t, fr(), br, n, { writeApproval: z });
259
+ f = await x(L, e, t, mr(), Sr, n, { writeApproval: z });
259
260
  } finally {
260
261
  i?.();
261
262
  }
262
- m = !0, d(), Zr(e, f, "provisioning"), await ge(f, t, n, 3e5), d(), c("sandboxRunning"), await w(f, t, e, n, 9e4), d(), c("serviceReady"), Y.current.markVerified(f);
263
+ m = !0, d(), ei(e, f, "provisioning"), await ge(f, t, n, 3e5), d(), c("sandboxRunning"), await w(f, t, e, n, 9e4), d(), c("serviceReady"), Y.current.markVerified(f);
263
264
  }
264
- return Zr(e, f, "running"), {
265
+ return ei(e, f, "running"), {
265
266
  sandboxId: f,
266
267
  sandboxIsNew: m,
267
268
  sandboxProbed: h,
@@ -270,59 +271,59 @@ var wr = ({ visible: wr = !0, writeAccess: Tr = "unknown" }) => {
270
271
  trustedFromCache: p
271
272
  };
272
273
  }, [
273
- Qr,
274
+ ti,
274
275
  B,
275
276
  L,
276
277
  z,
277
- Zr,
278
- na
279
- ]), ia = j(async function e(t, n, r, i, a, o = {}) {
280
- let s = await Dn(i, r, (e) => na(t, n, "provisioning", e), () => k(n, "prewarmJoined"));
278
+ ei,
279
+ aa
280
+ ]), sa = j(async function e(t, n, r, i, a, o = {}) {
281
+ let s = await kn(i, r, (e) => aa(t, n, "provisioning", e), () => k(n, "prewarmJoined"));
281
282
  for (let e of s.dead) Y.current.invalidate(e), X.current.add(e);
282
283
  s.verified && !X.current.has(s.verified) && Y.current.markVerified(s.verified), s.joined && O(n, { prewarm: s.joined });
283
- let { sandboxId: c, sandboxIsNew: l, sandboxProbed: u, sandboxAdopted: d, deadSandboxProbe: f, trustedFromCache: p } = await ra(r, i, a, {
284
+ let { sandboxId: c, sandboxIsNew: l, sandboxProbed: u, sandboxAdopted: d, deadSandboxProbe: f, trustedFromCache: p } = await oa(r, i, a, {
284
285
  conversationId: t,
285
286
  assistantMessageId: n
286
- }, o.trustCache !== !1), m = Cn(i, r, c);
287
+ }, o.trustCache !== !1), m = Tn(i, r, c);
287
288
  !s.waited && m && O(n, { prewarm: "hit" });
288
289
  let h = b.getState().conversations.find((e) => e.id === t)?.backendSessionId ?? null, g = !1, ee = null;
289
290
  if (h) {
290
- let e = vt(c, h, (e, t) => de(e, i, t, r, a, { limit: 50 }));
291
+ let e = bt(c, h, (e, t) => de(e, i, t, r, a, { limit: 50 }));
291
292
  try {
292
293
  let t = await fe(c, i, h, r, a);
293
294
  if (t.mode !== r) throw Error(`Session mode mismatch: expected ${r}, received ${t.mode}`);
294
295
  ee = e;
295
296
  } catch {
296
- Xr(t), h = null;
297
+ $r(t), h = null;
297
298
  }
298
299
  }
299
300
  let te = !1;
300
301
  if (!h) {
301
- let e = Sn(wn({
302
+ let e = wn(En({
302
303
  workspaceId: i,
303
304
  mode: r,
304
305
  sandboxId: c,
305
306
  userId: V
306
307
  }), Date.now());
307
308
  if (e) {
308
- "pending" in e && na(t, n, "connecting", "preparingSession");
309
+ "pending" in e && aa(t, n, "connecting", "preparingSession");
309
310
  let o = "sessionId" in e ? e.sessionId : await e.pending;
310
311
  if (o && !X.current.has(c)) try {
311
- (await fe(c, i, o, r, a)).mode === r && (h = o, te = !0, Yr(t, h), g = !0);
312
+ (await fe(c, i, o, r, a)).mode === r && (h = o, te = !0, Qr(t, h), g = !0);
312
313
  } catch {}
313
314
  }
314
315
  }
315
316
  if (!h) {
316
- na(t, n, "connecting", "preparingSession");
317
+ aa(t, n, "connecting", "preparingSession");
317
318
  let s;
318
319
  try {
319
320
  s = await S(c, i, r, a);
320
321
  } catch (s) {
321
322
  if (p) {
322
323
  Y.current.invalidate(c);
323
- let l = Ft(s, o.isAbandoned?.() ?? !1), p = l === "check-network";
324
- if (l === "check-network" && (l = await Pt(() => le(i, L, r, fr(), a, X.current, z))), l !== "rethrow" && o.isAbandoned?.() && (l = "rethrow"), l !== "rethrow") {
325
- p || O(n, { cacheProofFailed: !0 }), l === "replace" && (X.current.add(c), Xr(t), Qr(r), J.retireSandbox(c));
324
+ let l = Lt(s, o.isAbandoned?.() ?? !1), p = l === "check-network";
325
+ if (l === "check-network" && (l = await It(() => le(i, L, r, mr(), a, X.current, z))), l !== "rethrow" && o.isAbandoned?.() && (l = "rethrow"), l !== "rethrow") {
326
+ p || O(n, { cacheProofFailed: !0 }), l === "replace" && (X.current.add(c), $r(t), ti(r), J.retireSandbox(c));
326
327
  let s = await e(t, n, r, i, a, {
327
328
  ...o,
328
329
  trustCache: !1
@@ -337,7 +338,7 @@ var wr = ({ visible: wr = !0, writeAccess: Tr = "unknown" }) => {
337
338
  }
338
339
  throw s;
339
340
  }
340
- h = s.sessionId, Yr(t, h), g = !0;
341
+ h = s.sessionId, Qr(t, h), g = !0;
341
342
  }
342
343
  return {
343
344
  sandboxId: c,
@@ -351,41 +352,41 @@ var wr = ({ visible: wr = !0, writeAccess: Tr = "unknown" }) => {
351
352
  sessionPreopened: te
352
353
  };
353
354
  }, [
354
- ra,
355
- Xr,
356
- Qr,
355
+ oa,
356
+ $r,
357
+ ti,
357
358
  L,
358
359
  z,
359
- Yr,
360
- na,
360
+ Qr,
361
+ aa,
361
362
  V,
362
363
  J
363
- ]), aa = j((e, t = !1) => {
364
+ ]), ca = j((e, t = !1) => {
364
365
  let n = A();
365
366
  if (!n) return;
366
- let r = b.getState(), i = Date.now(), a = En({
367
+ let r = b.getState(), i = Date.now(), a = On({
367
368
  autoRouting: r.autoRouting,
368
- autoOffered: Fi.current,
369
+ autoOffered: Ri.current,
369
370
  active: !t && r.activeConversationId ? r.conversations.find((e) => e.id === r.activeConversationId) : void 0,
370
371
  selectedMode: r.mode,
371
372
  autoReadMode: s,
372
- modes: Di.current,
373
+ modes: Ai.current,
373
374
  acknowledgedWriteModes: r.acknowledgedWriteModes,
374
- adminAccess: Ei.read(),
375
+ adminAccess: ki.read(),
375
376
  dictated: e,
376
- voiceProposalBound: (e) => jr(e),
377
- turnInFlight: Object.values(r.processingByConversationId).some((e) => ut(e?.status)),
378
- ...An(n),
377
+ voiceProposalBound: (e) => Nr(e),
378
+ turnInFlight: Object.values(r.processingByConversationId).some((e) => ft(e?.status)),
379
+ ...Mn(n),
379
380
  now: i
380
381
  });
381
382
  if (!a) return;
382
- let o = kn(n, a, i), c = {
383
+ let o = jn(n, a, i), c = {
383
384
  accessToken: B(),
384
- workspaceToken: Mr(),
385
+ workspaceToken: Pr(),
385
386
  userId: V,
386
- organizationId: At()
387
+ organizationId: Mt()
387
388
  };
388
- ra(a.mode, n, c, null, !0, o).then((e) => {
389
+ oa(a.mode, n, c, null, !0, o).then((e) => {
389
390
  if (o.finish({
390
391
  ok: !0,
391
392
  sandboxId: e.sandboxId,
@@ -394,24 +395,24 @@ var wr = ({ visible: wr = !0, writeAccess: Tr = "unknown" }) => {
394
395
  dead: o.dead
395
396
  }), o.signal.aborted || A() !== n || X.current.has(e.sandboxId)) return;
396
397
  let r = b.getState(), i = !t && r.activeConversationId ? r.conversations.find((e) => e.id === r.activeConversationId) : void 0, s = p();
397
- Tn({
398
+ Dn({
398
399
  active: i ? {
399
400
  mode: i.mode,
400
401
  backendSessionId: i.backendSessionId,
401
- continuable: !nn(i) && !tn(i, s),
402
- hasHistory: en(i)
402
+ continuable: !an(i) && !rn(i, s),
403
+ hasHistory: nn(i)
403
404
  } : void 0,
404
405
  mode: a.mode
405
- }) && On(wn({
406
+ }) && An(En({
406
407
  workspaceId: n,
407
408
  mode: a.mode,
408
409
  sandboxId: e.sandboxId,
409
410
  userId: V
410
411
  }), () => S(e.sandboxId, n, a.mode, c).then((e) => e.sessionId), Date.now());
411
412
  }, (e) => {
412
- if (!(e instanceof xn) && !o.signal.aborted && A() === n) {
413
+ if (!(e instanceof Cn) && !o.signal.aborted && A() === n) {
413
414
  let e = b.getState().sandboxesByMode[a.mode]?.sandboxId ?? null;
414
- e && (Y.current.invalidate(e), X.current.add(e), o.dead.push(e), Qr(a.mode));
415
+ e && (Y.current.invalidate(e), X.current.add(e), o.dead.push(e), ti(a.mode));
415
416
  }
416
417
  o.finish({
417
418
  ok: !1,
@@ -421,44 +422,50 @@ var wr = ({ visible: wr = !0, writeAccess: Tr = "unknown" }) => {
421
422
  });
422
423
  });
423
424
  }, [
424
- ra,
425
- Ei,
426
- Qr,
425
+ oa,
426
+ ki,
427
+ ti,
427
428
  B,
428
- Mr,
429
+ Pr,
429
430
  V,
430
- jr
431
- ]), oa = j(() => aa(!1), [aa]), sa = _r(y, ee, ee)?.reference ?? null, [ca, la] = gr(0), ua = N(/* @__PURE__ */ new Set()), da = N(null), fa = j(() => {
431
+ Nr
432
+ ]), la = j(() => ca(!1), [ca]), ua = yr(y, ee, ee)?.reference ?? null, [da, fa] = vr(0), pa = N(/* @__PURE__ */ new Set()), ma = N(null), ha = j(() => {
432
433
  let e = b.getState(), t = e.activeConversationId;
433
- if (!t) return;
434
- let n = e.processingByConversationId[t], r = ut(n?.status) ? n?.messageId ?? null : null;
435
- if (!ft({
434
+ if (!t) return null;
435
+ let n = e.processingByConversationId[t], r = ft(n?.status) ? n?.messageId ?? null : null;
436
+ if (!mt({
436
437
  interruptedTurnId: r,
437
438
  activeTurnId: r,
438
- alreadyRequested: r ? ua.current.has(r) : !1
439
- }).send || !r) return;
440
- ua.current.add(r);
439
+ alreadyRequested: r ? pa.current.has(r) : !1
440
+ }).send || !r) return null;
441
+ pa.current.add(r);
441
442
  let i = ae(e), a = A(), o = e.conversations.find((e) => e.id === t)?.backendSessionId;
442
- !i || !a || !o || oe(i.sandboxId, a, o, i.mode, {
443
+ return !i || !a || !o || oe(i.sandboxId, a, o, i.mode, {
443
444
  accessToken: B(),
444
- workspaceToken: Mr(),
445
+ workspaceToken: Pr(),
445
446
  userId: V,
446
- organizationId: At()
447
- });
447
+ organizationId: Mt()
448
+ }), r;
448
449
  }, [
449
450
  V,
450
451
  B,
451
- Mr
452
- ]), pa = j(async (e) => {
452
+ Pr
453
+ ]), ga = j(() => {
454
+ let e = ha();
455
+ return e && (Ne(e), je.abort(e)), e;
456
+ }, [ha]), _a = j(() => {
457
+ let e = b.getState().activeConversationId;
458
+ ga(), e && J.declineForReply(e, "corrected", "spoken");
459
+ }, [ga, J]), va = j(async (e) => {
453
460
  let t = b.getState(), n = ae(t), r = A(), i = t.activeConversationId;
454
- if (!n || !r || !i || Ht(t.sandboxWriteCapabilities[n.sandboxId])) return;
461
+ if (!n || !r || !i || Wt(t.sandboxWriteCapabilities[n.sandboxId])) return;
455
462
  let a = t.conversations.find((e) => e.id === i), o = a ? _(T(a.messages), {
456
463
  sessionId: a.backendSessionId,
457
464
  sandboxId: n.sandboxId,
458
465
  nowMs: Date.now()
459
466
  }) : null;
460
467
  if (o?.reference !== e) {
461
- la((e) => e + 1);
468
+ fa((e) => e + 1);
462
469
  return;
463
470
  }
464
471
  let s = {
@@ -469,9 +476,9 @@ var wr = ({ visible: wr = !0, writeAccess: Tr = "unknown" }) => {
469
476
  try {
470
477
  await se(n.sandboxId, r, e, n.mode, {
471
478
  accessToken: B(),
472
- workspaceToken: Mr(),
479
+ workspaceToken: Pr(),
473
480
  userId: V,
474
- organizationId: At()
481
+ organizationId: Mt()
475
482
  });
476
483
  } catch (e) {
477
484
  g(s), K(i, {
@@ -482,81 +489,81 @@ var wr = ({ visible: wr = !0, writeAccess: Tr = "unknown" }) => {
482
489
  });
483
490
  return;
484
491
  }
485
- g(s), Kr(i, o.messageId, { pendingWriteApprovedAt: (/* @__PURE__ */ new Date()).toISOString() });
492
+ g(s), Yr(i, o.messageId, { pendingWriteApprovedAt: (/* @__PURE__ */ new Date()).toISOString() });
486
493
  let c = b.getState(), l = c.conversations.find((e) => e.id === i);
487
- c.activeConversationId !== i || !l || c.mode !== n.mode || l.backendSessionId !== a?.backendSessionId || ae(c)?.sandboxId !== n.sandboxId || ut(c.processingByConversationId[i]?.status) || ne(T(l.messages)) !== o.messageId || Va.current(I("pendingWrite.approvedPrompt", "I approved that change — go ahead."), [], {
494
+ c.activeConversationId !== i || !l || c.mode !== n.mode || l.backendSessionId !== a?.backendSessionId || ae(c)?.sandboxId !== n.sandboxId || ft(c.processingByConversationId[i]?.status) || ne(T(l.messages)) !== o.messageId || Ka.current(I("pendingWrite.approvedPrompt", "I approved that change — go ahead."), [], {
488
495
  approvalFollowUp: { approvedReplyId: o.messageId },
489
496
  targetConversationId: i
490
497
  });
491
498
  }, [
492
499
  V,
493
500
  K,
494
- Kr,
501
+ Yr,
495
502
  I
496
- ]), ma = e(), { speakFinishedReply: ha } = Ot(), ga = a(), { items: _a, permissionsSettled: va, simulating: ya } = mr(), ba = N({
497
- theme: ma,
498
- navigate: ga,
499
- navItems: _a,
500
- options: Ar ?? {},
501
- navPermissionsSettled: va,
502
- navSimulating: ya
503
+ ]), ya = e(), { speakFinishedReply: ba } = At(), xa = a(), { items: Sa, permissionsSettled: Ca, simulating: wa } = gr(), Ta = N({
504
+ theme: ya,
505
+ navigate: xa,
506
+ navItems: Sa,
507
+ options: Mr ?? {},
508
+ navPermissionsSettled: Ca,
509
+ navSimulating: wa
503
510
  });
504
511
  M(() => {
505
- ba.current = {
506
- theme: ma,
507
- navigate: ga,
508
- navItems: _a,
509
- options: Ar ?? {},
510
- navPermissionsSettled: va,
511
- navSimulating: ya
512
+ Ta.current = {
513
+ theme: ya,
514
+ navigate: xa,
515
+ navItems: Sa,
516
+ options: Mr ?? {},
517
+ navPermissionsSettled: Ca,
518
+ navSimulating: wa
512
519
  };
513
520
  }, [
514
- ma,
515
- ga,
516
- _a,
517
- Ar,
518
- va,
519
- ya
521
+ ya,
522
+ xa,
523
+ Sa,
524
+ Mr,
525
+ Ca,
526
+ wa
520
527
  ]);
521
- let xa = N(!0);
522
- M(() => (xa.current = !0, () => {
523
- xa.current = !1;
528
+ let Ea = N(!0);
529
+ M(() => (Ea.current = !0, () => {
530
+ Ea.current = !1;
524
531
  }), []);
525
- let Sa = N(null), [Ca, wa] = gr(!1), Ta = j((e) => {
532
+ let Da = N(null), [Oa, ka] = vr(!1), Aa = j((e) => {
526
533
  let t = b.getState(), n = t.conversations.find((e) => e.id === t.activeConversationId);
527
- return n ? $n(Qn, window.location.pathname, rr(n.messages, e)) : !1;
528
- }, []), Ea = j((e, t, n = !1) => {
529
- let { navItems: r, options: i } = ba.current, a = Ln(r), o = null, s = Rn(e);
530
- if (jn(s) || Mn(s) !== null) {
531
- let e = b.getState(), n = e.conversations.find((t) => t.id === e.activeConversationId), s = n ? ar(n.messages, t) : null, c = n ? e.processingByConversationId[n.id] ?? null : null, l = c !== null && c.messageId === s?.id && ut(c.status);
532
- n && s && !l && (o = ir({
534
+ return n ? tr(er, window.location.pathname, ar(n.messages, e)) : !1;
535
+ }, []), ja = j((e, t, n = !1) => {
536
+ let { navItems: r, options: i } = Ta.current, a = zn(r), o = null, s = Bn(e);
537
+ if (Nn(s) || Pn(s) !== null) {
538
+ let e = b.getState(), n = e.conversations.find((t) => t.id === e.activeConversationId), s = n ? sr(n.messages, t) : null, c = n ? e.processingByConversationId[n.id] ?? null : null, l = c !== null && c.messageId === s?.id && ft(c.status);
539
+ n && s && !l && (o = or({
533
540
  reply: s,
534
- text: Ct(s, c, I),
541
+ text: Tt(s, c, I),
535
542
  resolve: {
536
543
  destinations: a,
537
544
  entityRoutes: i.entityRoutes,
538
- visibleNavIds: Nn(r),
539
- nounLabel: (e) => Un(I, e)
545
+ visibleNavIds: Fn(r),
546
+ nounLabel: (e) => Gn(I, e)
540
547
  }
541
548
  }));
542
549
  }
543
- return In(e, a, {
550
+ return Rn(e, a, {
544
551
  ...i,
545
- locale: t === void 0 ? H : Fr.input.code
552
+ locale: t === void 0 ? H : Rr.input.code
546
553
  }, {
547
- backRunnable: Ta(t),
554
+ backRunnable: Aa(t),
548
555
  navigation: o,
549
556
  skipRecords: n
550
557
  });
551
558
  }, [
552
- Ta,
553
- Fr,
559
+ Aa,
560
+ Rr,
554
561
  H,
555
562
  I
556
- ]), Da = j((e, t) => {
557
- let n = Ea(e, t);
563
+ ]), Ma = j((e, t) => {
564
+ let n = ja(e, t);
558
565
  if (!n) return !1;
559
- let { theme: r, navigate: i } = ba.current;
566
+ let { theme: r, navigate: i } = Ta.current;
560
567
  switch (n.kind) {
561
568
  case "theme": return r !== null;
562
569
  case "navigate":
@@ -568,11 +575,11 @@ var wr = ({ visible: wr = !0, writeAccess: Tr = "unknown" }) => {
568
575
  case "conversation-delete": return !1;
569
576
  case "open-record": return !1;
570
577
  }
571
- }, [Ea]), Oa = N(Da);
578
+ }, [ja]), Na = N(Ma);
572
579
  M(() => {
573
- Oa.current = Da;
574
- }, [Da]);
575
- let ka = j((e, t, n, r, i) => {
580
+ Na.current = Ma;
581
+ }, [Ma]);
582
+ let Pa = j((e, t, n, r, i) => {
576
583
  let a = I(n.key, n.fallback, r), o = n.fallback.replace(/\{\{\s*count\s*\}\}/g, String(r.count)), s = {
577
584
  kind: "write-reply",
578
585
  line: n.key
@@ -598,48 +605,48 @@ var wr = ({ visible: wr = !0, writeAccess: Tr = "unknown" }) => {
598
605
  localAction: s,
599
606
  ...E(i)
600
607
  }
601
- }), on.recordCommittedEntries(e, [l, u], "LOCAL_COMMAND", A()), ha(e, u);
608
+ }), cn.recordCommittedEntries(e, [l, u], "LOCAL_COMMAND", A()), ba(e, u);
602
609
  }, [
603
610
  K,
604
611
  H,
605
- ha,
612
+ ba,
606
613
  I
607
- ]), Aa = un(), ja = Aa?.request ?? null, Ma = N(() => void 0), [Na, Pa] = gr(null);
614
+ ]), Fa = fn(), Ia = Fa?.request ?? null, La = N(() => void 0), [Ra, za] = vr(null);
608
615
  M(() => {
609
- if (Na === null) return;
610
- let e = window.setTimeout(() => Pa(null), Cr);
616
+ if (Ra === null) return;
617
+ let e = window.setTimeout(() => za(null), Tr);
611
618
  return () => window.clearTimeout(e);
612
- }, [Na]);
613
- let Fa = j(() => {
619
+ }, [Ra]);
620
+ let Ba = j(() => {
614
621
  let e = b.getState();
615
- return G(void 0, e.autoRouting && Fi.current ? s : e.mode, e.autoRouting ? { routedBy: "auto" } : void 0);
616
- }, [G]), Ia = j((e) => {
617
- if (!ja) return !1;
618
- let t = e !== void 0, n = b.getState(), r = dn({
622
+ return G(void 0, e.autoRouting && Ri.current ? s : e.mode, e.autoRouting ? { routedBy: "auto" } : void 0);
623
+ }, [G]), Va = j((e) => {
624
+ if (!Ia) return !1;
625
+ let t = e !== void 0, n = b.getState(), r = pn({
619
626
  spoken: t,
620
- bound: Gi.current,
627
+ bound: Ji.current,
621
628
  activeConversationId: n.activeConversationId,
622
629
  conversations: n.conversations,
623
- historyOn: ln()
630
+ historyOn: dn()
624
631
  });
625
- if (r && ja(r), t) {
632
+ if (r && Ia(r), t) {
626
633
  let e = r ? "Opened the delete confirmation. Choose Delete or Cancel on screen." : "There is no conversation to delete.", t = r ? I("deleteConversation.opened", "Opened the delete confirmation. Choose Delete or Cancel on screen.") : I("deleteConversation.nothing", "There is no conversation to delete.");
627
- Ma.current({
634
+ La.current({
628
635
  id: `conversation-delete:${F()}`,
629
636
  text: t,
630
637
  lang: t === e ? "en" : H
631
638
  });
632
- } else r || Pa(Date.now());
639
+ } else r || za(Date.now());
633
640
  return !0;
634
641
  }, [
635
- ja,
642
+ Ia,
636
643
  H,
637
644
  I
638
- ]), La = j((e, t, n, r = !1) => {
639
- if (e.kind === "conversation-delete") return Ia(n);
640
- let { theme: i, navigate: a } = ba.current, o = null, s = () => {
641
- let e = (r ? null : o ?? b.getState().activeConversationId) ?? Fa();
642
- return r && Ji(e), e;
645
+ ]), Ha = j((e, t, n, r = !1) => {
646
+ if (e.kind === "conversation-delete") return Va(n);
647
+ let { theme: i, navigate: a } = Ta.current, o = null, s = () => {
648
+ let e = (r ? null : o ?? b.getState().activeConversationId) ?? Ba();
649
+ return r && Zi(e), e;
643
650
  }, c = (e, r) => {
644
651
  let i = F();
645
652
  return K(e, {
@@ -664,52 +671,52 @@ var wr = ({ visible: wr = !0, writeAccess: Tr = "unknown" }) => {
664
671
  localAction: i,
665
672
  ...E(n)
666
673
  }
667
- }), on.recordCommittedEntries(e, [t, s], "LOCAL_COMMAND", a), o && ha(e, s), s;
674
+ }), cn.recordCommittedEntries(e, [t, s], "LOCAL_COMMAND", a), o && ba(e, s), s;
668
675
  }, u = (e, t, n) => {
669
676
  let r = s(), i = l(r, c(r, t), e, t, A(), !0);
670
677
  return n?.(i), !0;
671
678
  }, d = (e) => {
672
- let t = s(), n = A(), r = window.location.pathname, i = c(t, er({
679
+ let t = s(), n = A(), r = window.location.pathname, i = c(t, nr({
673
680
  destinationId: e.destinationId,
674
681
  path: e.registryPath,
675
682
  alreadyHere: !1,
676
683
  via: e.via
677
684
  })), o = F();
678
- Sa.current = o, wa(!0);
685
+ Da.current = o, ka(!0);
679
686
  let u = (a) => {
680
687
  try {
681
688
  if (!b.getState().conversations.some((e) => e.id === t)) return;
682
- let o = Ln(ba.current.navItems), s = a.status === "arrived" || a.status === "redirected" ? a.landedPath : null, c = er({
689
+ let o = zn(Ta.current.navItems), s = a.status === "arrived" || a.status === "redirected" ? a.landedPath : null, c = nr({
683
690
  destinationId: e.destinationId,
684
691
  path: e.registryPath,
685
692
  alreadyHere: !1,
686
693
  via: e.via,
687
694
  outcome: a
688
695
  });
689
- Kr(t, i, { localAction: c });
690
- let u = l(t, i, e.via === "back" && a.status === "arrived" ? Bn(I, e.pageLabel()) : Kn(I, a, {
696
+ Yr(t, i, { localAction: c });
697
+ let u = l(t, i, e.via === "back" && a.status === "arrived" ? Hn(I, e.pageLabel()) : Jn(I, a, {
691
698
  page: e.pageLabel(),
692
- landed: s === null ? null : nr(o, s),
699
+ landed: s === null ? null : ir(o, s),
693
700
  path: e.target
694
- }), c, n, xa.current);
701
+ }), c, n, Ea.current);
695
702
  a.status === "arrived" && e.onArrived?.({
696
703
  replyId: u,
697
704
  fromPath: r,
698
705
  landedPath: a.landedPath
699
706
  });
700
707
  } finally {
701
- Sa.current === o && (Sa.current = null, xa.current && wa(!1));
708
+ Da.current === o && (Da.current = null, Ea.current && ka(!1));
702
709
  }
703
710
  };
704
- return Zn(a, e.target, {
711
+ return $n(a, e.target, {
705
712
  readPath: () => window.location.pathname + window.location.search,
706
713
  now: () => Date.now(),
707
714
  schedule: (e, t) => {
708
715
  window.setTimeout(e, t);
709
716
  },
710
- isShellLess: () => !xa.current
717
+ isShellLess: () => !Ea.current
711
718
  }).then(u, () => u({ status: "unconfirmed" })), !0;
712
- }, f = ({ replyId: e, fromPath: t, landedPath: n }) => Qn.push({
719
+ }, f = ({ replyId: e, fromPath: t, landedPath: n }) => er.push({
713
720
  fromPath: t,
714
721
  toPath: n,
715
722
  replyMessageId: e,
@@ -717,37 +724,37 @@ var wr = ({ visible: wr = !0, writeAccess: Tr = "unknown" }) => {
717
724
  });
718
725
  if (e.kind === "theme") {
719
726
  if (!i) return !1;
720
- let t = zn(e.request, {
727
+ let t = Vn(e.request, {
721
728
  mode: i.mode,
722
729
  resolvedTheme: i.resolvedTheme
723
730
  });
724
731
  if (!t.alreadyApplied) try {
725
732
  i.setMode(t.mode);
726
733
  } catch {}
727
- return u(Xn(I, t, e.request.kind === "family"), {
734
+ return u(Qn(I, t, e.request.kind === "family"), {
728
735
  kind: "theme",
729
736
  mode: t.mode,
730
737
  alreadyApplied: t.alreadyApplied
731
738
  });
732
739
  }
733
740
  if (!a) return !1;
734
- if (e.kind === "choose-destination") return u(Vn(I, e.candidates[0]?.label ?? e.query, e.candidates), {
741
+ if (e.kind === "choose-destination") return u(Un(I, e.candidates[0]?.label ?? e.query, e.candidates), {
735
742
  kind: "choose-destination",
736
743
  candidateIds: e.candidates.map((e) => e.id)
737
- }, (t) => or(t, e.candidates));
738
- if (e.kind === "choose-linked") return u(Hn(I, e.candidates), {
744
+ }, (t) => cr(t, e.candidates));
745
+ if (e.kind === "choose-linked") return u(Wn(I, e.candidates), {
739
746
  kind: "choose-destination",
740
747
  candidateIds: e.candidates.map((e) => e.id)
741
- }, (t) => or(t, e.candidates));
748
+ }, (t) => cr(t, e.candidates));
742
749
  if (e.kind === "pick-from-list") {
743
750
  let t = e.candidates !== null && e.candidates.every((e) => e !== null) ? e.candidates : null;
744
- return u(qn(I), t ? {
751
+ return u(Yn(I), t ? {
745
752
  kind: "choose-destination",
746
753
  candidateIds: t.map((e) => e.id)
747
754
  } : e.candidateIds.length > 0 ? {
748
755
  kind: "choose-destination",
749
756
  candidateIds: [...e.candidateIds]
750
- } : er({
757
+ } : nr({
751
758
  destinationId: "",
752
759
  path: "",
753
760
  alreadyHere: !1,
@@ -756,9 +763,9 @@ var wr = ({ visible: wr = !0, writeAccess: Tr = "unknown" }) => {
756
763
  status: "refused",
757
764
  reason: "not-routable"
758
765
  }
759
- }), t ? (e) => or(e, t) : void 0);
766
+ }), t ? (e) => cr(e, t) : void 0);
760
767
  }
761
- if (e.kind === "link-not-openable") return u(Wn(I), er({
768
+ if (e.kind === "link-not-openable") return u(Kn(I), nr({
762
769
  destinationId: "",
763
770
  path: "",
764
771
  alreadyHere: !1,
@@ -769,7 +776,7 @@ var wr = ({ visible: wr = !0, writeAccess: Tr = "unknown" }) => {
769
776
  }
770
777
  }));
771
778
  if (e.kind === "open-record") {
772
- let { options: r, navItems: i } = ba.current, a = r.entityRoutes ?? [], s = Nn(i), c = (r.records ?? []).flatMap((t) => {
779
+ let { options: r, navItems: i } = Ta.current, a = r.entityRoutes ?? [], s = Fn(i), c = (r.records ?? []).flatMap((t) => {
773
780
  let n = a.find((e) => e.id === t.entityRouteId), r = e.request.adapterIds.length === 0 || e.request.adapterIds.includes(t.id);
774
781
  return n && r && (n.visibleWith === void 0 || s.has(n.visibleWith)) ? [{
775
782
  adapter: t,
@@ -778,15 +785,15 @@ var wr = ({ visible: wr = !0, writeAccess: Tr = "unknown" }) => {
778
785
  });
779
786
  if (c.length === 0) return !1;
780
787
  let l = b.getState().activeConversationId, p = F();
781
- Sa.current = p, wa(!0);
788
+ Da.current = p, ka(!0);
782
789
  let m = () => {
783
- Sa.current === p && (Sa.current = null, xa.current && wa(!1));
790
+ Da.current === p && (Da.current = null, Ea.current && ka(!1));
784
791
  };
785
792
  return (async () => {
786
793
  let t = new AbortController(), n, r = new Promise((e) => {
787
794
  n = setTimeout(() => {
788
795
  t.abort(), e(null);
789
- }, yr);
796
+ }, xr);
790
797
  });
791
798
  try {
792
799
  return await Promise.all(c.map(async ({ adapter: n, route: i }) => {
@@ -794,7 +801,7 @@ var wr = ({ visible: wr = !0, writeAccess: Tr = "unknown" }) => {
794
801
  return {
795
802
  adapter: n,
796
803
  route: i,
797
- noun: Un(I, n.noun),
804
+ noun: Gn(I, n.noun),
798
805
  matches: a ?? []
799
806
  };
800
807
  }));
@@ -802,10 +809,10 @@ var wr = ({ visible: wr = !0, writeAccess: Tr = "unknown" }) => {
802
809
  clearTimeout(n);
803
810
  }
804
811
  })().then((r) => {
805
- if (!xa.current) return m();
806
- let i = Pn(e.request.name, r), a = b.getState().conversations.some((e) => e.id === l);
812
+ if (!Ea.current) return m();
813
+ let i = In(e.request.name, r), a = b.getState().conversations.some((e) => e.id === l);
807
814
  if (i.kind === "none") {
808
- m(), Va.current(t, [], {
815
+ m(), Ka.current(t, [], {
809
816
  fromPerson: !0,
810
817
  ...n === void 0 ? {} : { voiceSessionId: n },
811
818
  localRecordsChecked: !0
@@ -826,16 +833,16 @@ var wr = ({ visible: wr = !0, writeAccess: Tr = "unknown" }) => {
826
833
  return;
827
834
  }
828
835
  let s = i.candidates[0];
829
- u(i.why === "kinds" ? Yn(I, i.nouns, i.candidates) : Jn(I, i.nouns[0] ?? "", s?.label ?? e.request.name, i.candidates), {
836
+ u(i.why === "kinds" ? Zn(I, i.nouns, i.candidates) : Xn(I, i.nouns[0] ?? "", s?.label ?? e.request.name, i.candidates), {
830
837
  kind: "choose-destination",
831
838
  candidateIds: i.candidates.map((e) => e.id)
832
- }, (e) => or(e, i.candidates));
839
+ }, (e) => cr(e, i.candidates));
833
840
  }, () => m()), !0;
834
841
  }
835
842
  if (e.kind === "back") {
836
- let e = Qn.top();
843
+ let e = er.top();
837
844
  if (!e) return !1;
838
- let t = tr(Ln(ba.current.navItems), e.fromPath);
845
+ let t = rr(zn(Ta.current.navItems), e.fromPath);
839
846
  return d({
840
847
  target: e.fromPath,
841
848
  destinationId: t?.id ?? "",
@@ -843,12 +850,12 @@ var wr = ({ visible: wr = !0, writeAccess: Tr = "unknown" }) => {
843
850
  via: "back",
844
851
  pageLabel: () => t?.label ?? null,
845
852
  onArrived: () => {
846
- Qn.top() === e && Qn.pop();
853
+ er.top() === e && er.pop();
847
854
  }
848
855
  });
849
856
  }
850
857
  let { destination: p } = e;
851
- return Fn(p, window.location.pathname + window.location.search, Ln(ba.current.navItems)) ? u(Gn(I, p.label, !0), er({
858
+ return Ln(p, window.location.pathname + window.location.search, zn(Ta.current.navItems)) ? u(qn(I, p.label, !0), nr({
852
859
  destinationId: p.id,
853
860
  path: p.path,
854
861
  alreadyHere: !0,
@@ -863,45 +870,45 @@ var wr = ({ visible: wr = !0, writeAccess: Tr = "unknown" }) => {
863
870
  });
864
871
  }, [
865
872
  K,
866
- Ji,
867
- Fa,
873
+ Zi,
874
+ Ba,
868
875
  H,
869
- Kr,
870
- Ia,
871
- ha,
876
+ Yr,
877
+ Va,
878
+ ba,
872
879
  I
873
- ]), Ra = j(async (e) => {
874
- Li.current = !0;
880
+ ]), Ua = j(async (e) => {
881
+ Bi.current = !0;
875
882
  try {
876
883
  await J.declineForReply(e.conversationId, e.reason, e.origin);
877
884
  } finally {
878
- Li.current = !1;
885
+ Bi.current = !1;
879
886
  }
880
887
  if (e.commandText !== null) {
881
- let t = Ea(e.commandText, e.options.voiceSessionId);
882
- if (t && La(t, e.content, e.options.voiceSessionId)) return;
888
+ let t = ja(e.commandText, e.options.voiceSessionId);
889
+ if (t && Ha(t, e.content, e.options.voiceSessionId)) return;
883
890
  }
884
- await Va.current(e.content, e.attachments, e.options);
891
+ await Ka.current(e.content, e.attachments, e.options);
885
892
  }, [
886
- Ea,
887
- La,
893
+ ja,
894
+ Ha,
888
895
  J
889
896
  ]), Z = j(async (e, t = [], n = {}) => {
890
- let r = n.voiceSessionId !== void 0, i = b.getState(), a = !1, o = Gi.current;
891
- if (r && ze(o)) {
892
- let e = We(o, i.activeConversationId, Yi());
897
+ let r = n.voiceSessionId !== void 0, i = b.getState(), a = !1, o = Ji.current;
898
+ if (r && Ve(o)) {
899
+ let e = Ke(o, i.activeConversationId, Qi());
893
900
  if (e.kind === "gone") return;
894
901
  let t = n.voiceEntry ?? e;
895
- t.kind === "adopt" && Ji(t.conversationId), a = t.kind === "own", n = {
902
+ t.kind === "adopt" && Zi(t.conversationId), a = t.kind === "own", n = {
896
903
  ...n,
897
904
  voiceEntry: t
898
905
  };
899
906
  }
900
907
  let s = a ? null : i.activeConversationId, c = a ? null : i.activeConversationId ?? U;
901
908
  if (c) {
902
- if (ut(i.processingByConversationId[c]?.status)) {
909
+ if (ft(i.processingByConversationId[c]?.status)) {
903
910
  let r = i.processingByConversationId[c]?.messageId ?? null;
904
- r && ua.current.has(r) && (da.current = {
911
+ r && n.correctsInFlightTurn === !0 && !pa.current.has(r) && ga(), r && pa.current.has(r) && (ma.current = {
905
912
  conversationId: c,
906
913
  content: e,
907
914
  attachments: t,
@@ -909,29 +916,29 @@ var wr = ({ visible: wr = !0, writeAccess: Tr = "unknown" }) => {
909
916
  });
910
917
  return;
911
918
  }
912
- if (Zi.current.has(c)) return;
919
+ if (ea.current.has(c)) return;
913
920
  }
914
- if (Ii.current || ee() !== null || Li.current || Sa.current !== null) return;
915
- let d = n.targetConversationId, m = p(), h = (e) => nn(e) || tn(e, m);
921
+ if (zi.current || ee() !== null || Bi.current || Da.current !== null) return;
922
+ let d = n.targetConversationId, m = p(), h = (e) => an(e) || rn(e, m);
916
923
  if (d !== void 0) {
917
924
  let e = i.conversations.find((e) => e.id === d);
918
925
  if (i.activeConversationId !== d || !e || e.mode !== i.mode || h(e)) return;
919
926
  }
920
927
  if (n.fromPerson && n.writeReplyBound === void 0) {
921
- let r = d ?? s ?? null, i = n.voiceSessionId === void 0 ? "typed" : "spoken", a = Ut({
928
+ let r = d ?? s ?? null, i = n.voiceSessionId === void 0 ? "typed" : "spoken", a = Gt({
922
929
  text: e,
923
- locale: i === "spoken" ? Fr.input.code : H,
930
+ locale: i === "spoken" ? Rr.input.code : H,
924
931
  origin: i,
925
932
  hasAttachments: t.length > 0,
926
933
  live: J.liveFor(r),
927
- matchesLocalCommand: (e) => Ea(e, n.voiceSessionId) !== null
934
+ matchesLocalCommand: (e) => ja(e, n.voiceSessionId) !== null
928
935
  });
929
936
  if (a.kind === "local_reply") {
930
- r && ka(r, e, a.line, a.values, n.voiceSessionId);
937
+ r && Pa(r, e, a.line, a.values, n.voiceSessionId);
931
938
  return;
932
939
  }
933
940
  let o = a.kind === "local" ? a.fallback : a.bound, c = a.declineAll;
934
- if (c !== null && r) return Ra({
941
+ if (c !== null && r) return Ua({
935
942
  conversationId: r,
936
943
  reason: c,
937
944
  origin: i,
@@ -950,49 +957,49 @@ var wr = ({ visible: wr = !0, writeAccess: Tr = "unknown" }) => {
950
957
  }
951
958
  let g = n.writeReplyBound?.promptText ?? e;
952
959
  if (n.fromPerson && t.length === 0 && n.writeReplyBound?.localCommands !== !1) {
953
- let t = Ea(e, n.voiceSessionId, n.localRecordsChecked === !0);
954
- if (t && La(t, e, n.voiceSessionId, a)) return;
960
+ let t = ja(e, n.voiceSessionId, n.localRecordsChecked === !0);
961
+ if (t && Ha(t, e, n.voiceSessionId, a)) return;
955
962
  }
956
- let ne = s ? i.conversations.find((e) => e.id === s) : void 0, _ = h(ne) ? void 0 : ne, v = i.autoRouting && Fi.current && d === void 0 ? f({
963
+ let ne = s ? i.conversations.find((e) => e.id === s) : void 0, _ = h(ne) ? void 0 : ne, v = i.autoRouting && Ri.current && d === void 0 ? f({
957
964
  intent: n.autoIntent ?? l(e),
958
965
  dictated: r,
959
- voiceProposalBound: r && jr("api-calls") && re(i.acknowledgedWriteModes, "api-calls"),
966
+ voiceProposalBound: r && Nr("api-calls") && re(i.acknowledgedWriteModes, "api-calls"),
960
967
  conversation: _ ? {
961
968
  mode: _.mode,
962
969
  routedBy: _.routedBy,
963
- hasHistory: en(_)
970
+ hasHistory: nn(_)
964
971
  } : null
965
972
  }) : null;
966
- if (v && Di.current.find((e) => e.id === v.mode)?.writeCapable && !re(i.acknowledgedWriteModes, v.mode)) {
967
- Ii.current = {
973
+ if (v && Ai.current.find((e) => e.id === v.mode)?.writeCapable && !re(i.acknowledgedWriteModes, v.mode)) {
974
+ zi.current = {
968
975
  content: e,
969
976
  attachments: t,
970
977
  options: n
971
- }, Bi(v.mode);
978
+ }, Ui(v.mode);
972
979
  return;
973
980
  }
974
981
  let y = v ? v.mode : i.mode, ae, se, x = d ?? (a ? null : U), S = x ? b.getState().conversations.find((e) => e.id === x) : void 0, le = v?.action === "escalate" && _ ? {
975
982
  mode: _.mode,
976
983
  backendSessionId: _.backendSessionId ?? null
977
984
  } : null;
978
- if (v) v.action === "new" || !_ ? x = G(void 0, y, { routedBy: "auto" }) : (x = _.id, ri(x, y));
985
+ if (v) v.action === "new" || !_ ? x = G(void 0, y, { routedBy: "auto" }) : (x = _.id, oi(x, y));
979
986
  else {
980
987
  let e = i.autoRouting ? { routedBy: "auto" } : void 0;
981
- !x || h(S) || S && S.mode !== y && en(S) ? x = G(void 0, y, e) : S && S.mode !== y && (e ? ri(x, y) : Hr(x, y));
988
+ !x || h(S) || S && S.mode !== y && nn(S) ? x = G(void 0, y, e) : S && S.mode !== y && (e ? oi(x, y) : Gr(x, y));
982
989
  }
983
990
  if (!x) return;
984
- r && Gi.current !== void 0 && x !== i.activeConversationId && Ji(x), n.approvalFollowUp || (Xi.current[x] = t);
991
+ r && Ji.current !== void 0 && x !== i.activeConversationId && Zi(x), n.approvalFollowUp || ($i.current[x] = t);
985
992
  let fe = () => b.getState().conversations.some((e) => e.id === x), C = A(), w = {
986
993
  accessToken: B(),
987
- workspaceToken: Mr(),
994
+ workspaceToken: Pr(),
988
995
  userId: V,
989
- organizationId: At()
996
+ organizationId: Mt()
990
997
  }, ge = (e, t) => {
991
998
  fe() || !C || oe(e, C, t, y, {
992
999
  accessToken: B(),
993
- workspaceToken: Mr(),
1000
+ workspaceToken: Pr(),
994
1001
  userId: V,
995
- organizationId: At()
1002
+ organizationId: Mt()
996
1003
  });
997
1004
  }, _e = {
998
1005
  id: F(),
@@ -1000,7 +1007,7 @@ var wr = ({ visible: wr = !0, writeAccess: Tr = "unknown" }) => {
1000
1007
  content: e,
1001
1008
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1002
1009
  metadata: {
1003
- ...t.length ? { attachments: t.map(Qe) } : {},
1010
+ ...t.length ? { attachments: t.map(et) } : {},
1004
1011
  ...n.approvalFollowUp ? {
1005
1012
  approvalFollowUp: !0,
1006
1013
  approvedReplyId: n.approvalFollowUp.approvedReplyId
@@ -1016,24 +1023,24 @@ var wr = ({ visible: wr = !0, writeAccess: Tr = "unknown" }) => {
1016
1023
  content: "",
1017
1024
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1018
1025
  metadata: {
1019
- lang: Rr,
1026
+ lang: Vr,
1020
1027
  ...E(n.voiceSessionId)
1021
1028
  }
1022
- }), wt(T, {
1029
+ }), Et(T, {
1023
1030
  channel: r ? "voice" : "chat",
1024
1031
  mode: y,
1025
1032
  product: L,
1026
- language: Rr,
1027
- device: Tt(),
1033
+ language: Vr,
1034
+ device: Dt(),
1028
1035
  routedByAuto: !!v
1029
- }, n.voiceTiming), k(T, "accepted"), qr(x, "provisioning", T, null), te(T);
1030
- let ke = () => dt({
1036
+ }, n.voiceTiming), k(T, "accepted"), Xr(x, "provisioning", T, null), te(T);
1037
+ let ke = () => pt({
1031
1038
  turnId: T,
1032
- abortRequested: ua.current.has(T),
1039
+ abortRequested: pa.current.has(T),
1033
1040
  activeTurnId: b.getState().processingByConversationId[x]?.messageId ?? null,
1034
1041
  conversationExists: fe()
1035
- }), Ae = (e, t, r, i, a = !1, o = Rr) => {
1036
- Gr(x, T, { content: ve(e) }), Kr(x, T, {
1042
+ }), Ae = (e, t, r, i, a = !1, o = Vr) => {
1043
+ Jr(x, T, { content: ve(e) }), Yr(x, T, {
1037
1044
  lang: o,
1038
1045
  ...t?.length ? { artifacts: t } : {},
1039
1046
  ...t?.length || r || i ? { mode: y } : {},
@@ -1048,9 +1055,9 @@ var wr = ({ visible: wr = !0, writeAccess: Tr = "unknown" }) => {
1048
1055
  k(T, "attemptStarted");
1049
1056
  let a = null, o = null, s = !1;
1050
1057
  try {
1051
- let { sandboxId: i, sessionId: c, sessionIsNew: l, readAhead: u, sandboxIsNew: d, sandboxProbed: f, sandboxAdopted: p, deadSandboxProbe: m, sessionPreopened: h } = await ia(x, T, y, C, w, { isAbandoned: () => dt({
1058
+ let { sandboxId: i, sessionId: c, sessionIsNew: l, readAhead: u, sandboxIsNew: d, sandboxProbed: f, sandboxAdopted: p, deadSandboxProbe: m, sessionPreopened: h } = await sa(x, T, y, C, w, { isAbandoned: () => pt({
1052
1059
  turnId: T,
1053
- abortRequested: ua.current.has(T),
1060
+ abortRequested: pa.current.has(T),
1054
1061
  activeTurnId: b.getState().processingByConversationId[x]?.messageId ?? null,
1055
1062
  conversationExists: fe()
1056
1063
  }).abandon });
@@ -1063,30 +1070,30 @@ var wr = ({ visible: wr = !0, writeAccess: Tr = "unknown" }) => {
1063
1070
  }, ie(y, ae, b.getState().acknowledgedWriteModes, {
1064
1071
  dictated: r,
1065
1072
  confirmsWrites: pe(y),
1066
- proposalBound: jr(y, i)
1073
+ proposalBound: Nr(y, i)
1067
1074
  }) === "voice-in-write-mode") throw new ye("voice-in-write-mode", "Voice in a write mode");
1068
- let ee = fn({
1075
+ let ee = mn({
1069
1076
  conversation: b.getState().conversations.find((e) => e.id === x),
1070
1077
  content: e,
1071
1078
  sessionIsNew: l,
1072
1079
  sendingMode: y,
1073
1080
  sendingModeConfig: ae,
1074
- modes: Di.current,
1075
- answerText: (e) => bt(e).text
1076
- }), te = await _t(() => de(i, C, c, y, w, { limit: 50 }), l, gt(u, i, c));
1077
- na(x, T, "streaming", "thinking");
1078
- let ne = Er?.(), _ = Wt(b.getState().sandboxWriteCapabilities[i]), v = ba.current, re = v.options.uiCatalogue ? sr(Ln(v.navItems), {
1081
+ modes: Ai.current,
1082
+ answerText: (e) => St(e).text
1083
+ }), te = await yt(() => de(i, C, c, y, w, { limit: 50 }), l, vt(u, i, c));
1084
+ aa(x, T, "streaming", "thinking");
1085
+ let ne = Or?.(), _ = Kt(b.getState().sandboxWriteCapabilities[i]), v = Ta.current, re = v.options.uiCatalogue ? lr(zn(v.navItems), {
1079
1086
  permissionsSettled: v.navPermissionsSettled,
1080
1087
  simulating: v.navSimulating
1081
1088
  }) : null, oe = {
1082
1089
  conversationId: x,
1083
1090
  writeReply: _ === "proposal-v1" ? n.writeReplyBound?.writeReply ?? null : null,
1084
1091
  ...re ? { uiCatalogue: re } : {}
1085
- }, { prompt: S, parts: le } = lt({
1092
+ }, { prompt: S, parts: le } = dt({
1086
1093
  content: ee ? `${ee}${g}` : g,
1087
1094
  attachments: t,
1088
- limits: Ze(ae),
1089
- wrapPrompt: (e) => Dr?.(y, e, Ir, Lr, r, { writeApproval: _ }) ?? e,
1095
+ limits: $e(ae),
1096
+ wrapPrompt: (e) => kr?.(y, e, zr, Br, r, { writeApproval: _ }) ?? e,
1090
1097
  requestBytes: (e, t) => me({
1091
1098
  sandboxId: i,
1092
1099
  workspaceId: C,
@@ -1098,11 +1105,11 @@ var wr = ({ visible: wr = !0, writeAccess: Tr = "unknown" }) => {
1098
1105
  authContext: w,
1099
1106
  ...oe
1100
1107
  })
1101
- }), be = Je(le), xe = be > 0;
1102
- s = qe(t) > be;
1108
+ }), be = Xe(le), xe = be > 0;
1109
+ s = Ye(t) > be;
1103
1110
  let Se = ke();
1104
1111
  if (Se.abandon) {
1105
- Se.clearProcessing && Jr(x);
1112
+ Se.clearProcessing && Zr(x);
1106
1113
  return;
1107
1114
  }
1108
1115
  try {
@@ -1111,33 +1118,33 @@ var wr = ({ visible: wr = !0, writeAccess: Tr = "unknown" }) => {
1111
1118
  ...oe
1112
1119
  } : oe);
1113
1120
  } catch (e) {
1114
- if (!le || !jt(e)) throw e;
1121
+ if (!le || !Nt(e)) throw e;
1115
1122
  await he(i, C, c, S, y, ne, w, oe), s ||= xe;
1116
1123
  }
1117
- let we = (e) => Gr(x, T, { content: e }), Ee = (e) => s ? `${e}\n\n${I("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;
1124
+ let we = (e) => Jr(x, T, { content: e }), Ee = (e) => s ? `${e}\n\n${I("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;
1118
1125
  k(T, "promptSent");
1119
- let De = null, E = !1, Pe = mt, D = ht([], te), Ie = Date.now() + se.streamBudgetMs, Le = Date.now(), Re = Date.now();
1120
- for (; Date.now() < Ie;) {
1126
+ let De = null, E = !1, Pe = gt, D = _t([], te), Fe = Date.now() + se.streamBudgetMs, Le = Date.now(), Re = Date.now();
1127
+ for (; Date.now() < Fe;) {
1121
1128
  ge(i, c);
1122
1129
  let e = ke();
1123
1130
  if (e.abandon) {
1124
- e.clearProcessing && Jr(x);
1131
+ e.clearProcessing && Zr(x);
1125
1132
  return;
1126
1133
  }
1127
- if (D = ht(await de(i, C, c, y, w, {
1134
+ if (D = _t(await de(i, C, c, y, w, {
1128
1135
  limit: 50,
1129
1136
  sinceMs: te,
1130
1137
  surfaceTurnTerminal: !0
1131
- }), te, { accumulateNarration: se.accumulatesNarration }), Gr(x, T, { content: ve(D.content) }), D.hasRenderableOutput ? E || (E = !0, De !== null && k(T, "lastQuietPoll", De), k(T, "firstOutput")) : De = Dt(), se.accumulatesNarration) D.hasText && k(T, "firstText");
1138
+ }), te, { accumulateNarration: se.accumulatesNarration }), Jr(x, T, { content: ve(D.content) }), D.hasRenderableOutput ? E || (E = !0, De !== null && k(T, "lastQuietPoll", De), k(T, "firstOutput")) : De = kt(), se.accumulatesNarration) D.hasText && k(T, "firstText");
1132
1139
  else {
1133
- let e = yt(Pe, D, Dt());
1140
+ let e = xt(Pe, D, kt());
1134
1141
  Pe = e.tracker, e.confirmedAt !== null && k(T, "firstText", e.confirmedAt);
1135
1142
  }
1136
- if (D.pendingWrite && !Ht(b.getState().sandboxWriteCapabilities[i]) && Kr(x, T, { pendingWrite: D.pendingWrite }), D.done) {
1143
+ if (D.pendingWrite && !Wt(b.getState().sandboxWriteCapabilities[i]) && Yr(x, T, { pendingWrite: D.pendingWrite }), D.done) {
1137
1144
  k(T, "answerDone"), Y.current.markVerified(i);
1138
1145
  break;
1139
1146
  }
1140
- Date.now() - Le > 3e4 && (await ce(i, C, 600, w).catch(() => void 0), Le = Date.now()), await new Promise((e) => setTimeout(e, Fe(Date.now() - Re)));
1147
+ Date.now() - Le > 3e4 && (await ce(i, C, 600, w).catch(() => void 0), Le = Date.now()), await new Promise((e) => setTimeout(e, Ie(Date.now() - Re)));
1141
1148
  }
1142
1149
  if (D.done && n.voiceSessionId !== void 0 && !ke().abandon) {
1143
1150
  let e = ve(Ee(D.content));
@@ -1146,7 +1153,7 @@ var wr = ({ visible: wr = !0, writeAccess: Tr = "unknown" }) => {
1146
1153
  channel: "voice",
1147
1154
  voiceSessionId: n.voiceSessionId,
1148
1155
  text: e,
1149
- lang: Rr,
1156
+ lang: Vr,
1150
1157
  final: !0
1151
1158
  }));
1152
1159
  }
@@ -1159,155 +1166,156 @@ var wr = ({ visible: wr = !0, writeAccess: Tr = "unknown" }) => {
1159
1166
  content: Ee(D.content)
1160
1167
  });
1161
1168
  let Be = !D.done;
1162
- Ae(D.content, ze, c, i, Be), D.tokens && (Gr(x, T, { tokens: D.tokens }), (kr ? await Te({
1169
+ Ae(D.content, ze, c, i, Be), D.tokens && (Jr(x, T, { tokens: D.tokens }), (jr ? await Te({
1163
1170
  workspaceId: C,
1164
1171
  sessionId: c,
1165
1172
  messageId: D.messageId,
1166
1173
  model: D.model,
1167
1174
  tokens: D.tokens
1168
- }, kr, { ledger: Ce("panel", L) }) : { ok: !0 }).ok && lr(L)), D.done || ge(i, c);
1175
+ }, jr, { ledger: Ce("panel", L) }) : { ok: !0 }).ok && dr(L)), D.done || ge(i, c);
1169
1176
  let Ve = ke();
1170
1177
  if (Ve.abandon) {
1171
- Ve.clearProcessing && Jr(x);
1178
+ Ve.clearProcessing && Zr(x);
1172
1179
  return;
1173
1180
  }
1174
- k(T, "complete"), O(T, { outcome: "answered" }), qr(x, "complete", T, null), on.recordCommittedEntries(x, [_e.id, T], "TURN", C), Ne = !1;
1181
+ k(T, "complete"), O(T, { outcome: "answered" }), Xr(x, "complete", T, null), cn.recordCommittedEntries(x, [_e.id, T], "TURN", C), Ne = !1;
1175
1182
  } catch (e) {
1176
1183
  Y.current.invalidate(a ?? b.getState().sandboxesByMode[y]?.sandboxId ?? null);
1177
- let t = dt({
1184
+ let t = pt({
1178
1185
  turnId: T,
1179
- abortRequested: ua.current.has(T),
1186
+ abortRequested: pa.current.has(T),
1180
1187
  activeTurnId: b.getState().processingByConversationId[x]?.messageId ?? null,
1181
1188
  conversationExists: fe()
1182
1189
  });
1183
1190
  if (a && o && ge(a, o), t.abandon) {
1184
- t.clearProcessing && Jr(x);
1191
+ t.clearProcessing && Zr(x);
1185
1192
  return;
1186
1193
  }
1187
- if (i === 1 && Mt(e)) {
1194
+ if (i === 1 && Pt(e)) {
1188
1195
  let e = a ?? b.getState().sandboxesByMode[y]?.sandboxId ?? null;
1189
- return e && (X.current.add(e), Y.current.invalidate(e)), Xr(x), Qr(y), Wr(x, T, ""), Kr(x, T, { pendingWrite: void 0 }), e && J.retireSandbox(e), Pe(), Et(T), D(2);
1196
+ return e && (X.current.add(e), Y.current.invalidate(e)), $r(x), ti(y), qr(x, T, ""), Yr(x, T, { pendingWrite: void 0 }), e && J.retireSandbox(e), Pe(), Ot(T), D(2);
1190
1197
  }
1191
1198
  throw e;
1192
1199
  }
1193
- }, Ie = x;
1194
- Zi.current.add(Ie);
1200
+ }, Fe = x;
1201
+ ea.current.add(Fe);
1195
1202
  try {
1196
1203
  if (!C) throw Object.assign(/* @__PURE__ */ Error("Assistant backend is unavailable without an active workspace context."), { extensions: {
1197
1204
  code: "UNAUTHENTICATED",
1198
1205
  authFailure: "WORKSPACE_CONTEXT_MISSING"
1199
1206
  } });
1200
- let e = await ct(y, () => Di.current.find((e) => e.id === y), Ei);
1207
+ let e = await ut(y, () => Ai.current.find((e) => e.id === y), ki);
1201
1208
  ae = e.config, se = e.capabilities;
1202
1209
  let t = ae, n = ke();
1203
1210
  if (n.abandon) {
1204
- n.clearProcessing && Jr(x);
1211
+ n.clearProcessing && Zr(x);
1205
1212
  return;
1206
1213
  }
1207
1214
  let i = ie(y, t, b.getState().acknowledgedWriteModes, {
1208
1215
  dictated: r,
1209
1216
  confirmsWrites: pe(y),
1210
- proposalBound: jr(y)
1217
+ proposalBound: Nr(y)
1211
1218
  });
1212
1219
  if (i) throw new ye(i, i === "confirm-write-mode" ? "Write mode not confirmed" : "Voice in a write mode");
1213
1220
  let a = Ce("panel", L);
1214
- if (kr && we(a, C)) {
1215
- let e = await Ee(a, C, kr);
1221
+ if (jr && we(a, C)) {
1222
+ let e = await Ee(a, C, jr);
1216
1223
  if (!e.ok) throw De(e.kind);
1217
1224
  let t = ke();
1218
1225
  if (t.abandon) {
1219
- t.clearProcessing && Jr(x);
1226
+ t.clearProcessing && Zr(x);
1220
1227
  return;
1221
1228
  }
1222
1229
  }
1223
1230
  k(T, "cleared"), await D();
1224
1231
  } catch (e) {
1225
1232
  if (Y.current.invalidate(b.getState().sandboxesByMode[y]?.sandboxId ?? null), !fe()) {
1226
- Jr(x);
1233
+ Zr(x);
1227
1234
  return;
1228
1235
  }
1229
1236
  let t = Me.session?.sandboxId ?? null, r = be(e, { confirmsNoAction: xe({
1230
1237
  mode: y,
1231
1238
  capabilities: t ? b.getState().sandboxWriteCapabilities[t] : null
1232
1239
  }) });
1233
- O(T, { outcome: r.kind === "temporary" ? "failed" : "refused" }), r.offersUpgrade && cr(L, "sandbox");
1240
+ O(T, { outcome: r.kind === "temporary" ? "failed" : "refused" }), r.offersUpgrade && ur(L, "sandbox");
1234
1241
  let i = Se(r, I, { locale: H });
1235
- qr(x, "error", T, i.headline), Gr(x, T, { content: i.text }), Kr(x, T, {
1242
+ Xr(x, "error", T, i.headline), Jr(x, T, { content: i.text }), Yr(x, T, {
1236
1243
  lang: i.translated ? H : "en",
1237
1244
  ...E(n.voiceSessionId)
1238
1245
  });
1239
1246
  } finally {
1240
- Zi.current.delete(Ie), O(T, { outcome: "stopped" }), k(T, "complete"), Pe();
1241
- let e = b.getState(), t = u(le, y, e.conversations.find((e) => e.id === Ie), (t) => !!e.sandboxesByMode[t]?.sandboxId);
1242
- t && (ri(Ie, t.mode), t.backendSessionId && Yr(Ie, t.backendSessionId)), Me.session && fe() && J.afterTurn({
1247
+ ea.current.delete(Fe), O(T, { outcome: "stopped" }), k(T, "complete"), Pe();
1248
+ let e = b.getState(), t = u(le, y, e.conversations.find((e) => e.id === Fe), (t) => !!e.sandboxesByMode[t]?.sandboxId);
1249
+ t && (oi(Fe, t.mode), t.backendSessionId && Qr(Fe, t.backendSessionId)), Me.session && fe() && J.afterTurn({
1243
1250
  ...Me.session,
1244
- conversationId: Ie
1251
+ conversationId: Fe
1245
1252
  }, T);
1246
- let n = da.current;
1247
- da.current = null, n && n.conversationId === Ie && fe() && Va.current(n.content, n.attachments, n.options);
1253
+ let n = ma.current;
1254
+ ma.current = null, n && n.conversationId === Fe && fe() && Ka.current(n.content, n.attachments, n.options);
1248
1255
  }
1249
1256
  }, [
1250
1257
  U,
1251
1258
  K,
1252
- Dr,
1253
- Xr,
1254
- Qr,
1255
- zr,
1259
+ kr,
1260
+ $r,
1261
+ ti,
1262
+ Hr,
1256
1263
  G,
1257
- ia,
1264
+ sa,
1258
1265
  J,
1259
- ka,
1260
- Ra,
1266
+ ga,
1267
+ Pa,
1268
+ Ua,
1261
1269
  H,
1262
- Fr,
1263
- jr,
1264
- Er,
1270
+ Rr,
1271
+ Nr,
1272
+ Or,
1265
1273
  B,
1266
- Mr,
1267
- Gr,
1274
+ Pr,
1275
+ Jr,
1268
1276
  L,
1269
- Ei,
1270
- kr,
1271
- Lr,
1277
+ ki,
1278
+ jr,
1279
+ Br,
1272
1280
  H,
1273
- Rr,
1274
- Ir,
1275
- ri,
1276
- La,
1277
- Ea,
1278
- Ji,
1279
- Yi,
1280
- Yr,
1281
- Hr,
1282
- qr,
1283
- Jr,
1281
+ Vr,
1282
+ zr,
1283
+ oi,
1284
+ Ha,
1285
+ ja,
1286
+ Zi,
1287
+ Qi,
1288
+ Qr,
1289
+ Gr,
1290
+ Xr,
1291
+ Zr,
1284
1292
  I,
1285
- na,
1286
- Wr,
1293
+ aa,
1294
+ qr,
1287
1295
  V
1288
- ]), za = j((e, t) => {
1296
+ ]), Wa = j((e, t) => {
1289
1297
  Z(e, [], t ? { autoIntent: t } : {});
1290
- }, [Z]), Ba = j(() => {
1291
- let e = [...ai.chat].reverse().find((e) => e.role === "user" && !e.metadata?.localAction);
1298
+ }, [Z]), Ga = j(() => {
1299
+ let e = [...ci.chat].reverse().find((e) => e.role === "user" && !e.metadata?.localAction);
1292
1300
  if (!e || e.metadata?.approvalFollowUp) return;
1293
- let t = U ? Xi.current[U] ?? [] : [];
1301
+ let t = U ? $i.current[U] ?? [] : [];
1294
1302
  Z(e.content, t);
1295
1303
  }, [
1296
- oi,
1304
+ li,
1297
1305
  Z,
1298
1306
  U
1299
- ]), Va = N(Z);
1307
+ ]), Ka = N(Z);
1300
1308
  M(() => {
1301
- Va.current = Z;
1309
+ Ka.current = Z;
1302
1310
  }, [Z]);
1303
- let Ha = hr(() => {
1304
- if (si) return null;
1305
- for (let e = oi.length - 1; e >= 0; --e) {
1306
- let t = oi[e];
1307
- if (t?.role !== "assistant" || !ke(t) || ua.current.has(t.id)) continue;
1308
- let n = pt(t, q, I);
1311
+ let qa = _r(() => {
1312
+ if (ui) return null;
1313
+ for (let e = li.length - 1; e >= 0; --e) {
1314
+ let t = li[e];
1315
+ if (t?.role !== "assistant" || !ke(t) || pa.current.has(t.id) || Me(t.id)) continue;
1316
+ let n = ht(t, q, I);
1309
1317
  if (n.kind !== "output") return null;
1310
- let r = bt(n.text).text.trim();
1318
+ let r = St(n.text).text.trim();
1311
1319
  return r ? {
1312
1320
  id: t.id,
1313
1321
  text: r
@@ -1315,192 +1323,195 @@ var wr = ({ visible: wr = !0, writeAccess: Tr = "unknown" }) => {
1315
1323
  }
1316
1324
  return null;
1317
1325
  }, [
1318
- oi,
1319
- si,
1326
+ li,
1327
+ ui,
1320
1328
  q,
1321
1329
  I
1322
- ]), Ua = hr(() => Ha ? D(Ha.text) : null, [Ha]), Wa = ai.chat, Ga = b((e) => ae(e)?.sandboxId ?? null), Ka = _(Wa, {
1323
- sessionId: ii?.backendSessionId,
1324
- sandboxId: Ga,
1330
+ ]), Ja = _r(() => qa ? Le(qa.text) : null, [qa]), Ya = ci.chat, Xa = b((e) => ae(e)?.sandboxId ?? null), Za = _(Ya, {
1331
+ sessionId: si?.backendSessionId,
1332
+ sandboxId: Xa,
1325
1333
  nowMs: Date.now()
1326
- }), qa = v(Wa), Ja = (e) => {
1327
- if (Vt(e.metadata).length > 0) return !0;
1334
+ }), Qa = v(Ya), $a = (e) => {
1335
+ if (Ut(e.metadata).length > 0) return !0;
1328
1336
  let t = e.metadata?.sandboxId;
1329
- return Ht(t ? ui[t] : null);
1330
- }, Ya = (e) => {
1331
- let t = Vt(e.metadata);
1332
- return t.length === 0 || !U ? null : /* @__PURE__ */ P(Bt, {
1337
+ return Wt(t ? pi[t] : null);
1338
+ }, eo = (e) => {
1339
+ let t = Ut(e.metadata);
1340
+ return t.length === 0 || !U ? null : /* @__PURE__ */ P(Ht, {
1333
1341
  refs: t,
1334
1342
  conversationId: U,
1335
1343
  panel: J,
1336
- entries: di,
1337
- capabilitiesOf: (e) => ui[e],
1338
- turnInFlight: si,
1344
+ entries: mi,
1345
+ capabilitiesOf: (e) => pi[e],
1346
+ turnInFlight: ui,
1339
1347
  tr: I,
1340
- onReview: pi.review,
1341
- retiredSandboxes: fi
1348
+ onReview: gi.review,
1349
+ retiredSandboxes: hi
1342
1350
  });
1343
- }, Xa = pi.dialog.view ? di[pi.dialog.view.proposalId] : void 0, Za = Ka?.expiresAtMs ?? null;
1351
+ }, to = gi.dialog.view ? mi[gi.dialog.view.proposalId] : void 0, no = Za?.expiresAtMs ?? null;
1344
1352
  M(() => {
1345
- if (Za === null) return;
1346
- let e = window.setTimeout(() => la((e) => e + 1), Math.max(0, Za - Date.now()));
1353
+ if (no === null) return;
1354
+ let e = window.setTimeout(() => fa((e) => e + 1), Math.max(0, no - Date.now()));
1347
1355
  return () => window.clearTimeout(e);
1348
- }, [Za, ca]);
1349
- let Q = hr(() => ai.voice.filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
1356
+ }, [no, da]);
1357
+ let Q = _r(() => ci.voice.filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
1350
1358
  id: e.id,
1351
1359
  role: e.role,
1352
- text: Ct(e, q, I),
1360
+ text: Tt(e, q, I),
1353
1361
  sessionId: Ae(e),
1354
1362
  timestamp: e.timestamp
1355
1363
  })).filter((e) => e.text.length > 0), [
1356
- ai.voice,
1364
+ ci.voice,
1357
1365
  q,
1358
1366
  I
1359
- ]), Qa = j(() => {
1367
+ ]), ro = j(() => {
1360
1368
  if (Q.length === 0) return;
1361
1369
  let e = /* @__PURE__ */ new Date();
1362
- $t(Ne(Q, {
1370
+ tn(D(Q, {
1363
1371
  title: I("voiceSession.transcript", "Voice conversation"),
1364
1372
  savedAt: I("voiceSession.savedAt", "Saved"),
1365
1373
  session: I("voiceSession.sessionLabel", "Session"),
1366
1374
  earlier: I("voiceSession.earlierLabel", "Earlier"),
1367
1375
  you: I("voiceSession.speakerYou", "You"),
1368
1376
  assistant: I("voiceSession.speakerAssistant", "Assistant")
1369
- }, e), Pe(L, e), "text/markdown");
1377
+ }, e), Fe(L, e), "text/markdown");
1370
1378
  }, [
1371
1379
  L,
1372
1380
  Q,
1373
1381
  I
1374
- ]), $a = ur({ perFileChars: Ri }), eo = N($a);
1375
- eo.current = $a;
1376
- let to = N(/* @__PURE__ */ new Set()), no = N(() => !1), $ = kt({
1377
- onSubmit: j((e, t, n) => {
1378
- let r = Gi.current, i = Ke(r), a = () => {
1379
- let a = eo.current, o = b.getState();
1380
- if (!Be({
1381
- sessionLive: no.current(t),
1382
- boundAtSubmit: r,
1383
- activeConversationId: o.activeConversationId,
1384
- boundConversationExists: o.conversations.some((e) => e.id === i)
1382
+ ]), io = fr({ perFileChars: Vi }), ao = N(io);
1383
+ ao.current = io;
1384
+ let oo = N(/* @__PURE__ */ new Set()), so = N(() => !1), $ = jt({
1385
+ onSubmit: j((e, t, n, r) => {
1386
+ let i = Ji.current, a = Je(i), o = () => {
1387
+ let o = ao.current, s = b.getState();
1388
+ if (!He({
1389
+ sessionLive: so.current(t),
1390
+ boundAtSubmit: i,
1391
+ activeConversationId: s.activeConversationId,
1392
+ boundConversationExists: s.conversations.some((e) => e.id === a)
1385
1393
  })) {
1386
- a.clear();
1394
+ o.clear();
1387
1395
  return;
1388
1396
  }
1389
- let s = Ye(a.attachments), c = {
1397
+ let c = Ze(o.attachments), l = {
1390
1398
  ...n,
1391
- handedOver: Dt()
1399
+ handedOver: kt()
1392
1400
  };
1393
- Va.current(e, s, {
1401
+ Ka.current(e, c, {
1394
1402
  fromPerson: !0,
1395
1403
  voiceSessionId: t,
1396
- voiceTiming: c
1397
- }), a.clear();
1404
+ voiceTiming: l,
1405
+ ...r.correction ? { correctsInFlightTurn: !0 } : {}
1406
+ }), o.clear();
1398
1407
  };
1399
1408
  if ((() => {
1400
1409
  let e = b.getState();
1401
- return Be({
1402
- sessionLive: no.current(t),
1403
- boundAtSubmit: r,
1410
+ return He({
1411
+ sessionLive: so.current(t),
1412
+ boundAtSubmit: i,
1404
1413
  activeConversationId: e.activeConversationId,
1405
- boundConversationExists: e.conversations.some((e) => e.id === i)
1414
+ boundConversationExists: e.conversations.some((e) => e.id === a)
1406
1415
  });
1407
- })() && Oa.current(e, t)) {
1408
- Va.current(e, [], {
1416
+ })() && Na.current(e, t)) {
1417
+ Ka.current(e, [], {
1409
1418
  fromPerson: !0,
1410
1419
  voiceSessionId: t,
1411
1420
  voiceTiming: {
1412
1421
  ...n,
1413
- handedOver: Dt()
1422
+ handedOver: kt()
1414
1423
  }
1415
1424
  });
1416
1425
  return;
1417
1426
  }
1418
- if (!eo.current.isBusy) {
1419
- a();
1427
+ if (!ao.current.isBusy) {
1428
+ o();
1420
1429
  return;
1421
1430
  }
1422
- let o = Date.now(), s = to.current, c = window.setInterval(() => {
1423
- eo.current.isBusy && Date.now() - o < xr || (window.clearInterval(c), s.delete(c), a());
1431
+ let s = Date.now(), c = oo.current, l = window.setInterval(() => {
1432
+ ao.current.isBusy && Date.now() - s < Cr || (window.clearInterval(l), c.delete(l), o());
1424
1433
  }, 200);
1425
- s.add(c);
1434
+ c.add(l);
1426
1435
  }, []),
1427
- latestReply: Ha,
1428
- language: Ie(Nr, H).tag
1436
+ latestReply: qa,
1437
+ language: Re(Ir, H).tag,
1438
+ graceMs: Fr,
1439
+ onSupersede: _a
1429
1440
  });
1430
- no.current = $.isCurrentSession;
1431
- let ro = Ki ? Q.filter((e) => e.sessionId !== void 0 && $.isCurrentSession(e.sessionId)) : Q, io = $.answerLocally;
1441
+ so.current = $.isCurrentSession;
1442
+ let co = Yi ? Q.filter((e) => e.sessionId !== void 0 && $.isCurrentSession(e.sessionId)) : Q, lo = $.answerLocally;
1432
1443
  M(() => {
1433
- Ma.current = io;
1434
- }, [io]);
1435
- let ao = $.active, oo = hr(() => it(Object.values(di), U, fi), [
1436
- di,
1444
+ La.current = lo;
1445
+ }, [lo]);
1446
+ let uo = $.active, fo = _r(() => ot(Object.values(mi), U, hi), [
1447
+ mi,
1437
1448
  U,
1438
- fi
1439
- ]), [so, co] = gr(null);
1449
+ hi
1450
+ ]), [po, mo] = vr(null);
1440
1451
  M(() => {
1441
- ao || co(null);
1442
- }, [ao]);
1443
- let lo = pi.review, uo = j(() => {
1444
- let e = oo[oo.length - 1];
1452
+ uo || mo(null);
1453
+ }, [uo]);
1454
+ let ho = gi.review, go = j(() => {
1455
+ let e = fo[fo.length - 1];
1445
1456
  if (!e) return;
1446
1457
  let { view: t } = e;
1447
- if (Lt(t) && It(t, ui[e.session.sandboxId]).offerConfirm) {
1448
- lo(t);
1458
+ if (zt(t) && Rt(t, pi[e.session.sandboxId]).offerConfirm) {
1459
+ ho(t);
1449
1460
  return;
1450
1461
  }
1451
- co(t.proposalId);
1462
+ mo(t.proposalId);
1452
1463
  }, [
1453
- oo,
1454
- ui,
1455
- lo
1456
- ]), fo = ao ? tt(oo) : null, po = so ? di[so] : void 0, mo = ao && po && po.session.conversationId === U ? {
1457
- content: /* @__PURE__ */ P(Bt, {
1464
+ fo,
1465
+ pi,
1466
+ ho
1467
+ ]), _o = uo ? rt(fo) : null, vo = po ? mi[po] : void 0, yo = uo && vo && vo.session.conversationId === U ? {
1468
+ content: /* @__PURE__ */ P(Ht, {
1458
1469
  refs: [{
1459
- proposalId: po.view.proposalId,
1460
- sandboxId: po.session.sandboxId,
1461
- sessionId: po.session.sessionId
1470
+ proposalId: vo.view.proposalId,
1471
+ sandboxId: vo.session.sandboxId,
1472
+ sessionId: vo.session.sessionId
1462
1473
  }],
1463
- conversationId: po.session.conversationId,
1474
+ conversationId: vo.session.conversationId,
1464
1475
  panel: J,
1465
- entries: di,
1466
- capabilitiesOf: (e) => ui[e],
1467
- turnInFlight: si,
1476
+ entries: mi,
1477
+ capabilitiesOf: (e) => pi[e],
1478
+ turnInFlight: ui,
1468
1479
  tr: I,
1469
- onReview: lo,
1470
- retiredSandboxes: fi
1480
+ onReview: ho,
1481
+ retiredSandboxes: hi
1471
1482
  }),
1472
- closeLabel: at(I, $e.trayClose),
1473
- onClose: () => co(null)
1474
- } : null, ho = pi.asking, go = Aa?.asking === !0, _o = $.holdListening;
1483
+ closeLabel: st(I, tt.trayClose),
1484
+ onClose: () => mo(null)
1485
+ } : null, bo = gi.asking, xo = Fa?.asking === !0, So = $.holdListening;
1475
1486
  M(() => {
1476
- _o(ao && (ho || go));
1487
+ So(uo && (bo || xo));
1477
1488
  }, [
1478
- ao,
1479
- ho,
1480
- go,
1481
- _o
1489
+ uo,
1490
+ bo,
1491
+ xo,
1492
+ So
1482
1493
  ]);
1483
- let vo = N(null), yo = $.announce;
1494
+ let Co = N(null), wo = $.announce;
1484
1495
  M(() => {
1485
- if (!ao) {
1486
- vo.current = null;
1496
+ if (!uo) {
1497
+ Co.current = null;
1487
1498
  return;
1488
1499
  }
1489
- let e = vo.current;
1500
+ let e = Co.current;
1490
1501
  if (e === null) {
1491
- vo.current = new Set(Object.keys(di));
1502
+ Co.current = new Set(Object.keys(mi));
1492
1503
  return;
1493
1504
  }
1494
- for (let { view: t, session: n } of rt(oo, e)) {
1505
+ for (let { view: t, session: n } of at(fo, e)) {
1495
1506
  e.add(t.proposalId);
1496
- let r = ui[n.sandboxId];
1497
- if (!et({
1507
+ let r = pi[n.sandboxId];
1508
+ if (!nt({
1498
1509
  mode: "api-calls",
1499
1510
  productWriteApproval: z,
1500
1511
  capabilities: r
1501
1512
  })) continue;
1502
- let i = ot(t, It(t, r).offerConfirm, I), a = t.proposalId;
1503
- yo({
1513
+ let i = ct(t, Rt(t, r).offerConfirm, I), a = t.proposalId;
1514
+ wo({
1504
1515
  id: `write-readback:${a}`,
1505
1516
  text: i.text,
1506
1517
  lang: i.translated ? H : "en",
@@ -1508,333 +1519,337 @@ var wr = ({ visible: wr = !0, writeAccess: Tr = "unknown" }) => {
1508
1519
  });
1509
1520
  }
1510
1521
  }, [
1511
- ao,
1512
- oo,
1513
- di,
1514
- ui,
1522
+ uo,
1523
+ fo,
1524
+ mi,
1525
+ pi,
1515
1526
  z,
1516
1527
  I,
1517
1528
  H,
1518
- yo,
1529
+ wo,
1519
1530
  J
1520
1531
  ]);
1521
- let bo = N(!1);
1532
+ let To = N(!1);
1522
1533
  M(() => {
1523
- bo.current = $.active;
1534
+ To.current = $.active;
1524
1535
  }, [$.active]), M(() => m((e) => {
1525
- if (!bo.current) return !1;
1526
- let t = Gi.current;
1536
+ if (!To.current) return !1;
1537
+ let t = Ji.current;
1527
1538
  return typeof t == "string" ? t === e : b.getState().activeConversationId === e;
1528
1539
  }), []);
1529
- let xo = $.start, So = j(() => {
1530
- let e = b.getState().activeConversationId, t = Ue(Yi());
1531
- Ji(Ge(t, e)), aa(!0, t.kind === "own"), xo();
1540
+ let Eo = $.start, Do = j(() => {
1541
+ let e = b.getState().activeConversationId, t = Ge(Qi());
1542
+ Zi(qe(t, e)), ca(!0, t.kind === "own"), Eo();
1532
1543
  }, [
1533
- Ji,
1534
- aa,
1535
- Yi,
1536
- xo
1537
- ]), Co = hr(() => St(ii?.messages ?? []), [ii?.messages]), wo = xt(ai.voice, q, I), To = xt(Co, q, I) > 0, Eo = j(() => {
1544
+ Zi,
1545
+ ca,
1546
+ Qi,
1547
+ Eo
1548
+ ]), Oo = _r(() => wt(si?.messages ?? []), [si?.messages]), ko = Ct(ci.voice, q, I), Ao = Ct(Oo, q, I) > 0, jo = j(() => {
1538
1549
  let e = b.getState().activeConversationId;
1539
1550
  if (!e || Q.length === 0) return;
1540
- let t = new Set(Co.map((e) => e.id)), n = F();
1551
+ let t = new Set(Oo.map((e) => e.id)), n = F();
1541
1552
  K(e, {
1542
1553
  id: n,
1543
1554
  role: "system",
1544
- content: Me(Q.filter((e) => t.has(e.id)), {
1555
+ content: Pe(Q.filter((e) => t.has(e.id)), {
1545
1556
  intro: I("voiceSession.continuedIntro", "Continued from a voice conversation. You asked about:"),
1546
1557
  nothing: I("voiceSession.continuedNothing", "Continued from a voice conversation."),
1547
1558
  more: (e) => I("voiceSession.continuedMore", "…and {{count}} more", { count: e })
1548
1559
  }),
1549
1560
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1550
- metadata: { continuedVoiceTurns: wo }
1551
- }), on.recordCommittedEntries(e, [n], "NOTE", A()), Wi(!1), $.end();
1561
+ metadata: { continuedVoiceTurns: ko }
1562
+ }), cn.recordCommittedEntries(e, [n], "NOTE", A()), qi(!1), $.end();
1552
1563
  }, [
1553
1564
  Q,
1554
- wo,
1555
- Co,
1565
+ ko,
1566
+ Oo,
1556
1567
  K,
1557
1568
  I,
1558
1569
  $,
1559
- Wi
1560
- ]), Do = N({
1570
+ qi
1571
+ ]), Mo = N({
1561
1572
  conversationId: null,
1562
1573
  count: 0
1563
1574
  });
1564
1575
  M(() => {
1565
- $.active && (Do.current = {
1576
+ $.active && (Mo.current = {
1566
1577
  conversationId: U,
1567
- count: wo
1578
+ count: ko
1568
1579
  });
1569
1580
  }, [$.active]);
1570
- let Oo = j(() => {
1571
- let e = Do.current, t = wo > (e.conversationId === U ? e.count : 0);
1572
- $.end(), t && Wi(!0);
1581
+ let No = j(() => {
1582
+ let e = Mo.current, t = ko > (e.conversationId === U ? e.count : 0);
1583
+ $.end(), t && qi(!0);
1573
1584
  }, [
1574
1585
  U,
1575
- wo,
1586
+ ko,
1576
1587
  $,
1577
- Wi
1588
+ qi
1578
1589
  ]);
1579
1590
  M(() => {
1580
- (!wr || !ta) && $.active && $.end();
1591
+ (!Er || !ia) && $.active && $.end();
1581
1592
  }, [
1582
- wr,
1583
- ta,
1593
+ Er,
1594
+ ia,
1584
1595
  $
1585
1596
  ]), M(() => {
1586
- let e = Gi.current, t = Ke(e), n = b.getState(), r = He({
1597
+ let e = Ji.current, t = Je(e), n = b.getState(), r = We({
1587
1598
  sessionLive: $.active,
1588
1599
  bound: e,
1589
1600
  activeConversationId: n.activeConversationId,
1590
1601
  boundConversationExists: n.conversations.some((e) => e.id === t)
1591
1602
  });
1592
- Ji(r.bound), r.end && $.end();
1603
+ Zi(r.bound), r.end && $.end();
1593
1604
  }, [
1594
1605
  $,
1595
1606
  U,
1596
- zr,
1597
- Ji
1607
+ Hr,
1608
+ Zi
1598
1609
  ]);
1599
- let ko = N(Re);
1610
+ let Po = N(Be);
1600
1611
  M(() => {
1601
- let e = Ve(ko.current, {
1612
+ let e = Ue(Po.current, {
1602
1613
  activeConversationId: U,
1603
- chatTurnCount: Wa.length,
1614
+ chatTurnCount: Ya.length,
1604
1615
  voiceTurnCount: Q.length,
1605
1616
  sessionLive: $.active,
1606
- sessionBoundTo: Gi.current,
1607
- turnInFlight: si
1617
+ sessionBoundTo: Ji.current,
1618
+ turnInFlight: ui
1608
1619
  });
1609
- ko.current = e.state, e.open && Wi(!0);
1620
+ Po.current = e.state, e.open && qi(!0);
1610
1621
  }, [
1611
1622
  U,
1612
- Wa.length,
1623
+ Ya.length,
1613
1624
  Q.length,
1614
1625
  $.active,
1615
- si,
1616
- Wi
1626
+ ui,
1627
+ qi
1617
1628
  ]), M(() => {
1618
1629
  if (!$.active) {
1619
- eo.current.clear(), da.current = null;
1620
- for (let e of to.current) window.clearInterval(e);
1621
- to.current.clear();
1630
+ ao.current.clear(), ma.current = null;
1631
+ for (let e of oo.current) window.clearInterval(e);
1632
+ oo.current.clear();
1622
1633
  }
1623
1634
  }, [$.active]), M(() => {
1624
- let e = to.current;
1635
+ let e = oo.current;
1625
1636
  return () => {
1626
1637
  for (let t of e) window.clearInterval(t);
1627
1638
  e.clear();
1628
1639
  };
1629
1640
  }, []), M(() => {
1630
1641
  let e = b.getState().consumePendingPrompt();
1631
- return e && Va.current(e), b.subscribe((e, t) => {
1642
+ return e && Ka.current(e), b.subscribe((e, t) => {
1632
1643
  if (e.pendingPrompt && e.pendingPrompt !== t.pendingPrompt) {
1633
1644
  let e = b.getState().consumePendingPrompt();
1634
- e && Va.current(e);
1645
+ e && Ka.current(e);
1635
1646
  }
1636
1647
  });
1637
1648
  }, []);
1638
- let Ao = j((e) => {
1649
+ let Fo = j((e) => {
1639
1650
  let t = U ? b.getState().conversations.find((e) => e.id === U) : void 0;
1640
- if (t && t.mode !== e && J.withdraw(t.id, "mode_switched"), t && en(t)) {
1651
+ if (t && t.mode !== e && J.withdraw(t.id, "mode_switched"), t && nn(t)) {
1641
1652
  if (t.mode !== e) {
1642
- let t = p(), n = b.getState().conversations.find((n) => n.mode === e && rn(n, t) && !b.getState().processingByConversationId[n.id]);
1643
- n ? Ur(n.id) : G(void 0, e);
1653
+ let t = p(), n = b.getState().conversations.find((n) => n.mode === e && on(n, t) && !b.getState().processingByConversationId[n.id]);
1654
+ n ? Kr(n.id) : G(void 0, e);
1644
1655
  }
1645
- } else U && Hr(U, e);
1656
+ } else U && Gr(U, e);
1646
1657
  let n = b.getState().activeConversationId;
1647
- n ? Hr(n, e) : ni(!1), Vr(e);
1658
+ n ? Gr(n, e) : ai(!1), Wr(e);
1648
1659
  }, [
1649
1660
  U,
1650
1661
  G,
1651
- Ur,
1652
- ni,
1653
- Hr,
1654
- Vr,
1662
+ Kr,
1663
+ ai,
1664
+ Gr,
1665
+ Wr,
1655
1666
  J
1656
- ]), jo = j(() => {
1667
+ ]), Io = j(() => {
1657
1668
  let e = b.getState(), t = e.activeConversationId ? e.conversations.find((t) => t.id === e.activeConversationId) : void 0;
1658
1669
  if (!t) {
1659
- ni(!0), Vr(s);
1670
+ ai(!0), Wr(s);
1660
1671
  return;
1661
1672
  }
1662
1673
  if (t.routedBy === "auto") {
1663
- ni(!0);
1674
+ ai(!0);
1664
1675
  return;
1665
1676
  }
1666
- if (!en(t)) {
1667
- ri(t.id, s);
1677
+ if (!nn(t)) {
1678
+ oi(t.id, s);
1668
1679
  return;
1669
1680
  }
1670
1681
  J.withdraw(t.id, "mode_switched");
1671
- let n = p(), r = e.conversations.find((t) => t.routedBy === "auto" && rn(t, n) && !e.processingByConversationId[t.id]);
1672
- r ? (Ur(r.id), ri(r.id, s)) : G(void 0, s, { routedBy: "auto" });
1682
+ let n = p(), r = e.conversations.find((t) => t.routedBy === "auto" && on(t, n) && !e.processingByConversationId[t.id]);
1683
+ r ? (Kr(r.id), oi(r.id, s)) : G(void 0, s, { routedBy: "auto" });
1673
1684
  }, [
1674
1685
  G,
1675
- ri,
1676
- Ur,
1677
- ni,
1678
- Vr,
1686
+ oi,
1687
+ Kr,
1688
+ ai,
1689
+ Wr,
1679
1690
  J
1680
- ]), Mo = j((e) => {
1691
+ ]), Lo = j((e) => {
1681
1692
  if (R.find((t) => t.id === e)?.writeCapable && !re(b.getState().acknowledgedWriteModes, e)) {
1682
- Bi(e);
1693
+ Ui(e);
1683
1694
  return;
1684
1695
  }
1685
- Ao(e);
1686
- }, [Ao, R]), No = j(() => {
1687
- let e = zi;
1688
- if (Bi(null), !e) return;
1689
- let t = Ii.current;
1690
- if (Ii.current = null, t) {
1691
- ei(e), Z(t.content, t.attachments, t.options);
1696
+ Fo(e);
1697
+ }, [Fo, R]), Ro = j(() => {
1698
+ let e = Hi;
1699
+ if (Ui(null), !e) return;
1700
+ let t = zi.current;
1701
+ if (zi.current = null, t) {
1702
+ ri(e), Z(t.content, t.attachments, t.options);
1692
1703
  return;
1693
1704
  }
1694
- ei(e), Ao(e);
1705
+ ri(e), Fo(e);
1695
1706
  }, [
1696
- zi,
1697
- ei,
1698
- Ao,
1707
+ Hi,
1708
+ ri,
1709
+ Fo,
1699
1710
  Z
1700
- ]), Po = zi === null ? void 0 : R.find((e) => e.id === zi) ?? { id: zi }, Fo = j(() => {
1701
- Bi(null);
1702
- let e = Ii.current;
1703
- Ii.current = null, e && Z(e.content, e.attachments, {
1711
+ ]), zo = Hi === null ? void 0 : R.find((e) => e.id === Hi) ?? { id: Hi }, Bo = j(() => {
1712
+ Ui(null);
1713
+ let e = zi.current;
1714
+ zi.current = null, e && Z(e.content, e.attachments, {
1704
1715
  ...e.options,
1705
1716
  autoIntent: "read"
1706
1717
  });
1707
1718
  }, [Z]);
1708
- return /* @__PURE__ */ vr("div", {
1719
+ return /* @__PURE__ */ br("div", {
1709
1720
  className: "relative flex flex-1 flex-col overflow-hidden",
1710
1721
  children: [
1711
- /* @__PURE__ */ vr("div", {
1722
+ /* @__PURE__ */ br("div", {
1712
1723
  className: "contents",
1713
1724
  inert: $.active || void 0,
1714
1725
  children: [
1715
- Ci === null ? null : /* @__PURE__ */ P(Jt, { onDismiss: () => Si(Ci) }),
1716
- Q.length > 0 && !$.active ? /* @__PURE__ */ P(Kt, {
1726
+ Ei === null ? null : /* @__PURE__ */ P(Xt, { onDismiss: () => Ti(Ei) }),
1727
+ Q.length > 0 && !$.active ? /* @__PURE__ */ P(Jt, {
1717
1728
  count: Q.length,
1718
- onOpenTranscript: () => Wi(!0)
1729
+ onOpenTranscript: () => qi(!0)
1719
1730
  }) : null,
1720
- Wa.length === 0 && (vi || yi) ? /* @__PURE__ */ P(Yt, {
1721
- state: vi ? "loading" : "failed",
1722
- onRetry: Oi
1723
- }) : Wa.length === 0 && ii?.sync?.hasOlder ? /* @__PURE__ */ P("div", {
1731
+ Ya.length === 0 && (xi || Si) ? /* @__PURE__ */ P(Zt, {
1732
+ state: xi ? "loading" : "failed",
1733
+ onRetry: ji
1734
+ }) : Ya.length === 0 && si?.sync?.hasOlder ? /* @__PURE__ */ P("div", {
1724
1735
  className: "flex min-h-0 flex-1 flex-col",
1725
- children: /* @__PURE__ */ P(Zt, {
1726
- onShowEarlier: ki,
1727
- disabled: vi
1736
+ children: /* @__PURE__ */ P($t, {
1737
+ onShowEarlier: Mi,
1738
+ disabled: xi
1728
1739
  })
1729
- }) : Wa.length === 0 ? /* @__PURE__ */ P(sn, {
1740
+ }) : Ya.length === 0 ? /* @__PURE__ */ P(ln, {
1730
1741
  mode: W,
1731
- onSuggestionClick: za,
1732
- explainsAuto: Pi,
1733
- suggestions: Pi && W === "assistant" ? c(R.find((e) => e.id === "assistant")?.suggestions ?? [], R.find((e) => e.id === "api-calls")?.suggestions ?? []) : void 0
1734
- }) : /* @__PURE__ */ vr("div", {
1742
+ onSuggestionClick: Wa,
1743
+ explainsAuto: Li,
1744
+ suggestions: Li && W === "assistant" ? c(R.find((e) => e.id === "assistant")?.suggestions ?? [], R.find((e) => e.id === "api-calls")?.suggestions ?? []) : void 0
1745
+ }) : /* @__PURE__ */ br("div", {
1735
1746
  className: "flex min-h-0 flex-1 flex-col",
1736
- children: [ii?.sync?.hasOlder ? /* @__PURE__ */ P(Zt, {
1737
- onShowEarlier: ki,
1738
- disabled: vi
1739
- }) : null, /* @__PURE__ */ P(mn, {
1740
- onApprovePendingWrite: pa,
1741
- approvingWriteRef: sa,
1742
- approvableMessageId: Ka?.messageId ?? null,
1743
- retryableMessageId: qa,
1744
- messages: Wa,
1747
+ children: [si?.sync?.hasOlder ? /* @__PURE__ */ P($t, {
1748
+ onShowEarlier: Mi,
1749
+ disabled: xi
1750
+ }) : null, /* @__PURE__ */ P(gn, {
1751
+ onApprovePendingWrite: va,
1752
+ approvingWriteRef: ua,
1753
+ approvableMessageId: Za?.messageId ?? null,
1754
+ retryableMessageId: Qa,
1755
+ messages: Ya,
1745
1756
  processing: q ?? null,
1746
- streamingMessageId: ci,
1747
- failedMessageId: li,
1748
- onRetry: sa === null ? Ba : void 0,
1749
- renderWriteProposals: Ya,
1750
- hidesLegacyWriteCard: Ja
1757
+ streamingMessageId: di,
1758
+ failedMessageId: fi,
1759
+ onRetry: ua === null ? Ga : void 0,
1760
+ renderWriteProposals: eo,
1761
+ hidesLegacyWriteCard: $a
1751
1762
  })]
1752
1763
  }),
1753
- gi ? /* @__PURE__ */ P(Xt, { onStartNew: () => G() }) : null,
1754
- _i && U ? /* @__PURE__ */ P(qt, { onUnarchive: () => on.updateConversation(U, { archived: !1 }) }) : null,
1755
- Na === null ? null : /* @__PURE__ */ P(cn, {
1764
+ yi ? /* @__PURE__ */ P(Qt, { onStartNew: () => G() }) : null,
1765
+ bi && U ? /* @__PURE__ */ P(Yt, { onUnarchive: () => cn.updateConversation(U, { archived: !1 }) }) : null,
1766
+ Ra === null ? null : /* @__PURE__ */ P(un, {
1756
1767
  tr: I,
1757
- onDismiss: () => Pa(null)
1768
+ onDismiss: () => za(null)
1758
1769
  }),
1759
- Wa.length > 0 && (vi || yi) ? /* @__PURE__ */ P(Yt, {
1760
- state: vi ? "loading" : "failed",
1761
- onRetry: Oi,
1770
+ Ya.length > 0 && (xi || Si) ? /* @__PURE__ */ P(Zt, {
1771
+ state: xi ? "loading" : "failed",
1772
+ onRetry: ji,
1762
1773
  compact: !0
1763
1774
  }) : null,
1764
- /* @__PURE__ */ P(dr, {
1765
- onStartVoiceSession: $.available && ta ? So : void 0,
1775
+ /* @__PURE__ */ P(pr, {
1776
+ onStartVoiceSession: $.available && ia ? Do : void 0,
1766
1777
  onSend: (e, t) => void Z(e, t, { fromPerson: !0 }),
1767
- onDraftStart: oa,
1768
- disabled: si || sa !== null || vi || Ca,
1769
- readOnly: gi,
1778
+ onDraftStart: la,
1779
+ disabled: ui || ua !== null || xi || Oa,
1780
+ readOnly: yi,
1770
1781
  placeholder: W === "api-calls" ? I("chatArea.placeholderActions", "What would you like me to do?") : I("chatArea.placeholderGeneral", "Ask me anything…"),
1771
1782
  mode: W,
1772
- writeAccessDenied: Tr === "denied" && !!Qi?.writeCapable,
1773
- availableModes: Mi,
1774
- attachmentCharsPerFile: Ri,
1775
- onModeChange: Mo,
1776
- auto: Ni ? {
1777
- active: Pi,
1778
- onSelect: jo
1783
+ writeAccessDenied: Dr === "denied" && !!ta?.writeCapable,
1784
+ availableModes: Fi,
1785
+ attachmentCharsPerFile: Vi,
1786
+ onModeChange: Lo,
1787
+ auto: Ii ? {
1788
+ active: Li,
1789
+ onSelect: Io
1779
1790
  } : void 0
1780
1791
  })
1781
1792
  ]
1782
1793
  }),
1783
- Ui && !$.active ? /* @__PURE__ */ P(Qt, {
1794
+ Ki && !$.active ? /* @__PURE__ */ P(en, {
1784
1795
  turns: Q,
1785
- onClose: () => Wi(!1),
1786
- onSave: Qa,
1787
- onContinueInChat: To ? Eo : void 0,
1796
+ onClose: () => qi(!1),
1797
+ onSave: ro,
1798
+ onContinueInChat: Ao ? jo : void 0,
1788
1799
  closeOnEscape: !0,
1789
- onShowEarlier: ii?.sync?.hasOlder ? ki : void 0,
1790
- showEarlierDisabled: vi
1800
+ onShowEarlier: si?.sync?.hasOlder ? Mi : void 0,
1801
+ showEarlierDisabled: xi
1791
1802
  }) : null,
1792
- $.active && /* @__PURE__ */ P(hn, {
1803
+ $.active && /* @__PURE__ */ P(_n, {
1793
1804
  session: $.session,
1794
1805
  notice: $.notice,
1795
1806
  capturing: $.capturing,
1796
1807
  interrupting: $.interrupting,
1797
1808
  awaitingEndpoint: $.awaitingEndpoint,
1798
- turns: ro,
1809
+ holding: $.holding,
1810
+ correcting: $.correcting,
1811
+ onLetMeFinish: $.letMeFinish,
1812
+ onImDone: $.imDone,
1813
+ turns: co,
1799
1814
  spokenChunks: $.spokenChunks,
1800
- attachments: $a.attachments,
1801
- onAttachFiles: $a.addFiles,
1802
- onRemoveAttachment: $a.remove,
1803
- onRetryAttachment: $a.retry,
1804
- canAttachMore: $a.canAddMore,
1805
- preparingAttachments: $a.preparingCount,
1806
- onSaveTranscript: Qa,
1807
- onContinueInChat: Eo,
1815
+ attachments: io.attachments,
1816
+ onAttachFiles: io.addFiles,
1817
+ onRemoveAttachment: io.remove,
1818
+ onRetryAttachment: io.retry,
1819
+ canAttachMore: io.canAddMore,
1820
+ preparingAttachments: io.preparingCount,
1821
+ onSaveTranscript: ro,
1822
+ onContinueInChat: jo,
1808
1823
  onInterrupt: () => {
1809
- $.interrupt(), fa();
1824
+ $.interrupt(), ga();
1810
1825
  },
1811
- spoken: Ua,
1826
+ spoken: Ja,
1812
1827
  onToggleMute: $.toggleMute,
1813
- onEnd: Oo,
1814
- proposalChip: fo ? {
1815
- label: nt(fo, I),
1816
- onOpen: uo
1828
+ onEnd: No,
1829
+ proposalChip: _o ? {
1830
+ label: it(_o, I),
1831
+ onOpen: go
1817
1832
  } : null,
1818
- proposalTray: mo
1833
+ proposalTray: yo
1819
1834
  }),
1820
- /* @__PURE__ */ P(pr, {
1821
- open: zi !== null,
1822
- mode: Po,
1823
- currentMode: Qi ?? { id: W },
1824
- onConfirm: No,
1825
- onCancel: Fo
1835
+ /* @__PURE__ */ P(hr, {
1836
+ open: Hi !== null,
1837
+ mode: zo,
1838
+ currentMode: ta ?? { id: W },
1839
+ onConfirm: Ro,
1840
+ onCancel: Bo
1826
1841
  }),
1827
- /* @__PURE__ */ P(Rt, {
1828
- ...pi.dialog,
1829
- view: Xa?.view ?? pi.dialog.view,
1830
- serverNow: Xa?.serverNow ?? NaN,
1831
- arrivedAt: Xa?.arrivedAt ?? NaN,
1832
- capabilities: Xa ? ui[Xa.session.sandboxId] : null,
1833
- turnInFlight: si,
1842
+ /* @__PURE__ */ P(Bt, {
1843
+ ...gi.dialog,
1844
+ view: to?.view ?? gi.dialog.view,
1845
+ serverNow: to?.serverNow ?? NaN,
1846
+ arrivedAt: to?.arrivedAt ?? NaN,
1847
+ capabilities: to ? pi[to.session.sandboxId] : null,
1848
+ turnInFlight: ui,
1834
1849
  tr: I
1835
1850
  })
1836
1851
  ]
1837
1852
  });
1838
1853
  };
1839
1854
  //#endregion
1840
- export { wr as AssistantChatArea };
1855
+ export { Er as AssistantChatArea };