@burdenoff/fe-libs 2026.1004.8 → 2026.1005.2

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