@burdenoff/fe-libs 2026.1009.1 → 2026.1010.1

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