@burdenoff/fe-libs 2026.1001.2 → 2026.1001.3

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 (50) hide show
  1. package/dist/shared/assistant/conversationDeleteCommand.d.ts +31 -0
  2. package/dist/shared/assistant/conversationDeleteCommand.d.ts.map +1 -0
  3. package/dist/shared/assistant/conversationDeleteCommand.js +14 -0
  4. package/dist/shared/assistant/history/historyControls.d.ts +9 -0
  5. package/dist/shared/assistant/history/historyControls.d.ts.map +1 -1
  6. package/dist/shared/assistant/history/historyControls.js +7 -1
  7. package/dist/shared/assistant/history/historyList.d.ts +10 -0
  8. package/dist/shared/assistant/history/historyList.d.ts.map +1 -1
  9. package/dist/shared/assistant/history/historyList.js +33 -28
  10. package/dist/shared/assistant/history/useHistoryRowControls.d.ts +13 -0
  11. package/dist/shared/assistant/history/useHistoryRowControls.d.ts.map +1 -0
  12. package/dist/shared/assistant/history/useHistoryRowControls.js +24 -0
  13. package/dist/shared/assistant/i18nManifest.d.ts +36 -0
  14. package/dist/shared/assistant/i18nManifest.d.ts.map +1 -1
  15. package/dist/shared/assistant/i18nManifest.js +36 -0
  16. package/dist/shared/assistant/index.d.ts +6 -0
  17. package/dist/shared/assistant/index.d.ts.map +1 -1
  18. package/dist/shared/assistant/localUiCommands.d.ts +8 -0
  19. package/dist/shared/assistant/localUiCommands.d.ts.map +1 -1
  20. package/dist/shared/assistant/localUiCommands.js +20 -19
  21. package/dist/shared/assistant/ui/AIAssistantPanel.d.ts.map +1 -1
  22. package/dist/shared/assistant/ui/AIAssistantPanel.js +67 -66
  23. package/dist/shared/assistant/ui/AssistantChatArea.d.ts.map +1 -1
  24. package/dist/shared/assistant/ui/AssistantChatArea.js +854 -809
  25. package/dist/shared/assistant/ui/AssistantConversationFilters.d.ts +12 -0
  26. package/dist/shared/assistant/ui/AssistantConversationFilters.d.ts.map +1 -0
  27. package/dist/shared/assistant/ui/AssistantConversationFilters.js +92 -0
  28. package/dist/shared/assistant/ui/AssistantConversationList.d.ts +9 -0
  29. package/dist/shared/assistant/ui/AssistantConversationList.d.ts.map +1 -1
  30. package/dist/shared/assistant/ui/AssistantConversationList.js +314 -214
  31. package/dist/shared/assistant/ui/AssistantDeleteConversationDialog.d.ts +59 -0
  32. package/dist/shared/assistant/ui/AssistantDeleteConversationDialog.d.ts.map +1 -0
  33. package/dist/shared/assistant/ui/AssistantDeleteConversationDialog.js +84 -0
  34. package/dist/shared/assistant/ui/AssistantHistoryNotices.d.ts +18 -0
  35. package/dist/shared/assistant/ui/AssistantHistoryNotices.d.ts.map +1 -1
  36. package/dist/shared/assistant/ui/AssistantHistoryNotices.js +76 -29
  37. package/dist/shared/assistant/ui/conversationDelete.d.ts +18 -0
  38. package/dist/shared/assistant/ui/conversationDelete.d.ts.map +1 -0
  39. package/dist/shared/assistant/ui/conversationDelete.js +16 -0
  40. package/dist/shared/assistant/ui/conversationDeleteDialog.d.ts +32 -0
  41. package/dist/shared/assistant/ui/conversationDeleteDialog.d.ts.map +1 -0
  42. package/dist/shared/assistant/ui/conversationDeleteDialog.js +54 -0
  43. package/dist/shared/assistant/ui/useVoiceSession.d.ts +5 -0
  44. package/dist/shared/assistant/ui/useVoiceSession.d.ts.map +1 -1
  45. package/dist/shared/assistant/ui/useVoiceSession.js +129 -121
  46. package/dist/shared/assistant/voice/voiceSession.d.ts +10 -0
  47. package/dist/shared/assistant/voice/voiceSession.d.ts.map +1 -1
  48. package/dist/shared/assistant/voice/voiceSession.js +6 -0
  49. package/dist/shared-assistant.js +170 -164
  50. package/package.json +1 -1
@@ -7,287 +7,292 @@ import { useAssistantTr as i } from "../i18n.js";
7
7
  import { useAssistantNavigate as a } from "./AssistantMarkdownRenderer.js";
8
8
  import { isAssistantModeId as o } from "../modeIds.js";
9
9
  import { AUTO_READ_MODE as s, autoSuggestions as c, classifyAssistantIntent as l, escalationToUndo as u, isAutoRoutingOffered as d, resolveAutoRoute as f } from "../autoRouting.js";
10
- import { getHistoryStamp as p, setHistoryBusyProbe as ee } from "../history/stampRegistry.js";
11
- import { beginApprovalInFlight as m, endApprovalInFlight as h, getApprovalInFlight as g, markLiveTurn as te, newestModelReplyId as _, resolveApprovablePendingWrite as ne, resolveRetryableMessageId as re, subscribeApprovalInFlight as v } from "../liveTurns.js";
12
- import { isWriteModeAcknowledged as ie, writeModeSendRefusalReason as ae } from "../writeModeConsent.js";
13
- import { resolveActiveModeSandbox as y, useAssistantStore as b } from "../store.js";
14
- import { abortAssistantTurn as oe, approvePendingWrite as se, createAssistantSandbox as ce, createAssistantSession as x, extendAssistantSandboxTTL as le, findExistingSandboxWithStatus as S, getAssistantArtifacts as ue, getAssistantMessages as de, getAssistantSession as fe, modeRequiresConfirmWrites as pe, promptGatewayRequestBytes as me, releaseSupersededAssistantSandboxes as he, sendAssistantPromptAsync as ge, waitForAssistantServiceReady as C, waitForSandboxRunning as _e, writeApprovalModeOf as ve } from "../api.js";
15
- import { sanitize as ye } from "../progress.js";
16
- import { AssistantSendRefusal as be, classifyTurnFailure as xe, turnConfirmsNoAction as Se, turnOutcomeCopy as Ce } from "../turnOutcome.js";
17
- import { assistantUsageLedger as we, hasPendingUsageReports as Te, reportUsageWithRetry as Ee, retryPendingUsageReports as De, usageSendRefusal as Oe } from "../usageReporting.js";
18
- import { withIncompleteTurnNotice as ke } from "../streamBudget.js";
19
- import { chatTurns as Ae, isVoiceTurn as w, voiceMarker as T, voiceSessionIdOf as E } from "../voice/turnVisibility.js";
20
- import { buildContinuedFromVoiceNote as je, buildVoiceTranscriptMarkdown as Me, voiceTranscriptFilename as Ne } from "../voice/voiceTranscript.js";
21
- import { pollDelayMs as Pe } from "../voice/assistantPollSchedule.js";
22
- import { toCaptionText as Fe } from "../voice/captionText.js";
23
- import { resolveAssistantLanguage as Ie } from "../voice/languages.js";
24
- import { resolveLanguagePair as Le } from "../voice/languagePair.js";
25
- import { INITIAL_TRANSCRIPT_AUTO_OPEN as Re, maySendSpokenTurn as ze, planTranscriptAutoOpen as Be, planVoiceSessionBinding as Ve } from "../voice/voiceReopen.js";
26
- import { countInlineImageCandidates as He, countInlinedImageParts as Ue, getSendableAttachments as We, largestInlineCharsPerFile as Ge, resolveAssistantInlineLimits as Ke, toMessageAttachment as qe } from "../attachments.js";
27
- import { WRITE_PROPOSAL_VOICE_COPY as Je, isVoiceProposalBound as Ye, voiceProposalChip as Xe, voiceProposalChipText as Ze, voiceReadbacksDue as Qe, voiceWaitingProposals as $e, writeProposalVoiceLine as et, writeProposalVoiceReadback as tt } from "../writeProposalVoice.js";
28
- import { createAdminModeAccessGate as nt, resolveAssistantSendModeAfterAccess as rt } from "../adminModeSendGate.js";
29
- import { buildBoundedAttachmentTurn as it } from "../attachmentTurn.js";
30
- import { isTurnInFlight as at, planAbandonedTurn as ot, planTurnAbort as st } from "../turnState.js";
31
- import { getAssistantDisplayContent as ct } from "../displayContent.js";
32
- import { NO_FIRST_TEXT as lt, buildAssistantProgress as ut, readAheadFor as dt, snapshotReplyFloor as ft, startSessionReadAhead as pt, trackFirstText as mt } from "../turnProgress.js";
33
- import { parseToolActivity as ht } from "./AssistantToolActivity.js";
34
- import { countSpokenTurns as gt, spokenMessagesSinceContinueNote as _t, spokenTurnText as vt } from "../spokenTurns.js";
35
- import { beginTurn as yt, describeTurn as D, detectTurnDevice as bt, markTurn as O, restartAttempt as xt, turnClockMs as St } from "../turnTimeline.js";
36
- import { useAssistantSpeech as Ct } from "./AssistantSpeechProvider.js";
37
- import { useVoiceSession as wt } from "./useVoiceSession.js";
38
- import { getOrganizationId as Tt, getWorkspaceId as k } from "../context.js";
39
- import { isMultimodalBodyRejection as Et, isRecoverableAssistantError as Dt } from "../transportErrors.js";
40
- import { createReadinessTracker as Ot, planAfterTransportFailure as kt, planTrustedSandboxFailure as At } from "../sandboxReadiness.js";
41
- import { writeProposalConfirmState as jt } from "./writeProposalPresentation.js";
42
- import { writeProposalUsesDialog as Mt } from "./AssistantWriteProposalCard.js";
43
- import { AssistantWriteConfirmDialog as Nt } from "./AssistantWriteConfirmDialog.js";
44
- import { useWriteProposalConfirm as Pt } from "./useWriteProposalConfirm.js";
45
- import { AssistantWriteProposalSlot as Ft } from "./AssistantWriteProposalSlot.js";
46
- import { readWriteProposalRefs as It, writeProposalsEnabledFor as Lt } from "../writeProposalDiscovery.js";
47
- import { planWriteReply as Rt, promptWriteApproval as zt } from "../writeReplySend.js";
48
- import { useWriteProposals as Bt } from "./useWriteProposals.js";
49
- import { AssistantSpokenTurnsNotice as Vt } from "./AssistantSpokenTurnsNotice.js";
50
- import { AssistantHistoryDeletedNotice as Ht, AssistantHistoryLoadState as Ut, AssistantHistoryReadOnlyBanner as Wt, AssistantHistoryShowEarlier as Gt } from "./AssistantHistoryNotices.js";
51
- import { VoiceTranscriptDrawer as Kt } from "./voice/VoiceTranscriptDrawer.js";
52
- import { downloadFile as qt } from "../exportConversation.js";
53
- import { conversationHasHistory as Jt, isOtherScopeHistoryConversation as Yt, isReadOnlyHistoryConversation as Xt, isReusableHistoryDraft as Zt } from "../history/historyList.js";
54
- import { useAssistantHistoryStatus as Qt } from "../history/historyStatus.js";
55
- import { assistantHistory as $t } from "../history/historyEngine.js";
56
- import { AssistantEmptyState as en } from "./AssistantEmptyState.js";
57
- import { resumeContextFor as tn } from "../history/historyResume.js";
58
- import { AssistantMessageList as nn } from "./AssistantMessageList.js";
59
- import { AssistantVoiceSession as rn } from "./voice/AssistantVoiceSession.js";
60
- import { useAssistantApiAccess as an } from "../useAssistantApiAccess.js";
61
- import { useConversationTurns as on } from "../useConversationTurns.js";
62
- import { sendAssistantTurnTimings as sn, startTurnTimingReporting as cn } from "../turnTimingReporter.js";
63
- import { WarmCancelled as ln, consumeWarm as un, prewarmTarget as dn, settleWarmBeforeSend as fn, startWarm as pn, warmState as mn } from "../prewarm.js";
64
- import { isAlreadyThere as hn, matchLocalUiCommand as gn, navDestinations as _n, planThemeChange as vn } from "../localUiCommands.js";
65
- import { chooseDestinationCopy as yn, navigationCommandCopy as bn, themeCommandCopy as xn } from "../localUiCommandCopy.js";
66
- import { dispatchAssistantQuotaExhausted as Sn, notifyAiCreditsUpdated as Cn } from "../aiCredits.js";
67
- import { useAssistantAttachments as wn } from "../useAssistantAttachments.js";
68
- import { AssistantComposer as Tn } from "./composer/AssistantComposer.js";
69
- import { isProdRuntime as En } from "../env.js";
70
- import { AssistantApiCallsConsentDialog as Dn } from "./AssistantApiCallsConsentDialog.js";
71
- import { useVisibleNavItems as On } from "../../../chrome/mobileTabBar/useVisibleNavItems.js";
72
- import { useCallback as A, useEffect as j, useMemo as kn, useRef as M, useState as An, useSyncExternalStore as jn } from "react";
73
- import { jsx as N, jsxs as Mn } from "react/jsx-runtime";
10
+ import { getHistoryStamp as ee, setHistoryBusyProbe as te } from "../history/stampRegistry.js";
11
+ import { beginApprovalInFlight as p, endApprovalInFlight as m, getApprovalInFlight as h, markLiveTurn as ne, newestModelReplyId as g, resolveApprovablePendingWrite as re, resolveRetryableMessageId as ie, subscribeApprovalInFlight as _ } from "../liveTurns.js";
12
+ import { isWriteModeAcknowledged as ae, writeModeSendRefusalReason as oe } from "../writeModeConsent.js";
13
+ import { resolveActiveModeSandbox as v, useAssistantStore as y } from "../store.js";
14
+ import { abortAssistantTurn as se, approvePendingWrite as ce, createAssistantSandbox as le, createAssistantSession as b, extendAssistantSandboxTTL as ue, findExistingSandboxWithStatus as x, getAssistantArtifacts as de, getAssistantMessages as fe, getAssistantSession as pe, modeRequiresConfirmWrites as me, promptGatewayRequestBytes as he, releaseSupersededAssistantSandboxes as ge, sendAssistantPromptAsync as _e, waitForAssistantServiceReady as S, waitForSandboxRunning as ve, writeApprovalModeOf as ye } from "../api.js";
15
+ import { sanitize as be } from "../progress.js";
16
+ import { AssistantSendRefusal as xe, classifyTurnFailure as Se, turnConfirmsNoAction as Ce, turnOutcomeCopy as we } from "../turnOutcome.js";
17
+ import { assistantUsageLedger as Te, hasPendingUsageReports as Ee, reportUsageWithRetry as De, retryPendingUsageReports as Oe, usageSendRefusal as ke } from "../usageReporting.js";
18
+ import { withIncompleteTurnNotice as Ae } from "../streamBudget.js";
19
+ import { chatTurns as je, isVoiceTurn as C, voiceMarker as w, voiceSessionIdOf as T } from "../voice/turnVisibility.js";
20
+ import { buildContinuedFromVoiceNote as Me, buildVoiceTranscriptMarkdown as Ne, voiceTranscriptFilename as Pe } from "../voice/voiceTranscript.js";
21
+ import { pollDelayMs as Fe } from "../voice/assistantPollSchedule.js";
22
+ import { toCaptionText as Ie } from "../voice/captionText.js";
23
+ import { resolveAssistantLanguage as Le } from "../voice/languages.js";
24
+ import { resolveLanguagePair as Re } from "../voice/languagePair.js";
25
+ import { INITIAL_TRANSCRIPT_AUTO_OPEN as ze, maySendSpokenTurn as Be, planTranscriptAutoOpen as Ve, planVoiceSessionBinding as He } from "../voice/voiceReopen.js";
26
+ import { countInlineImageCandidates as Ue, countInlinedImageParts as We, getSendableAttachments as Ge, largestInlineCharsPerFile as Ke, resolveAssistantInlineLimits as qe, toMessageAttachment as Je } from "../attachments.js";
27
+ import { WRITE_PROPOSAL_VOICE_COPY as Ye, isVoiceProposalBound as Xe, voiceProposalChip as Ze, voiceProposalChipText as Qe, voiceReadbacksDue as $e, voiceWaitingProposals as et, writeProposalVoiceLine as tt, writeProposalVoiceReadback as nt } from "../writeProposalVoice.js";
28
+ import { createAdminModeAccessGate as rt, resolveAssistantSendModeAfterAccess as it } from "../adminModeSendGate.js";
29
+ import { buildBoundedAttachmentTurn as at } from "../attachmentTurn.js";
30
+ import { isTurnInFlight as ot, planAbandonedTurn as st, planTurnAbort as ct } from "../turnState.js";
31
+ import { getAssistantDisplayContent as lt } from "../displayContent.js";
32
+ import { NO_FIRST_TEXT as ut, buildAssistantProgress as dt, readAheadFor as ft, snapshotReplyFloor as pt, startSessionReadAhead as mt, trackFirstText as ht } from "../turnProgress.js";
33
+ import { parseToolActivity as gt } from "./AssistantToolActivity.js";
34
+ import { countSpokenTurns as _t, spokenMessagesSinceContinueNote as vt, spokenTurnText as yt } from "../spokenTurns.js";
35
+ import { beginTurn as bt, describeTurn as E, detectTurnDevice as xt, markTurn as D, restartAttempt as St, turnClockMs as Ct } from "../turnTimeline.js";
36
+ import { useAssistantSpeech as wt } from "./AssistantSpeechProvider.js";
37
+ import { useVoiceSession as Tt } from "./useVoiceSession.js";
38
+ import { getOrganizationId as Et, getWorkspaceId as O } from "../context.js";
39
+ import { isMultimodalBodyRejection as Dt, isRecoverableAssistantError as Ot } from "../transportErrors.js";
40
+ import { createReadinessTracker as kt, planAfterTransportFailure as At, planTrustedSandboxFailure as jt } from "../sandboxReadiness.js";
41
+ import { writeProposalConfirmState as Mt } from "./writeProposalPresentation.js";
42
+ import { writeProposalUsesDialog as Nt } from "./AssistantWriteProposalCard.js";
43
+ import { AssistantWriteConfirmDialog as Pt } from "./AssistantWriteConfirmDialog.js";
44
+ import { useWriteProposalConfirm as Ft } from "./useWriteProposalConfirm.js";
45
+ import { AssistantWriteProposalSlot as It } from "./AssistantWriteProposalSlot.js";
46
+ import { readWriteProposalRefs as Lt, writeProposalsEnabledFor as Rt } from "../writeProposalDiscovery.js";
47
+ import { planWriteReply as zt, promptWriteApproval as Bt } from "../writeReplySend.js";
48
+ import { useWriteProposals as Vt } from "./useWriteProposals.js";
49
+ import { AssistantSpokenTurnsNotice as Ht } from "./AssistantSpokenTurnsNotice.js";
50
+ import { AssistantHistoryArchivedNotice as Ut, AssistantHistoryDeletedNotice as Wt, AssistantHistoryLoadState as Gt, AssistantHistoryReadOnlyBanner as Kt, AssistantHistoryShowEarlier as qt } from "./AssistantHistoryNotices.js";
51
+ import { VoiceTranscriptDrawer as Jt } from "./voice/VoiceTranscriptDrawer.js";
52
+ import { downloadFile as Yt } from "../exportConversation.js";
53
+ import { conversationHasHistory as Xt, isOtherScopeHistoryConversation as Zt, isReadOnlyHistoryConversation as Qt, isReusableHistoryDraft as $t } from "../history/historyList.js";
54
+ import { useAssistantHistoryStatus as en } from "../history/historyStatus.js";
55
+ import { assistantHistory as tn } from "../history/historyEngine.js";
56
+ import { AssistantEmptyState as nn } from "./AssistantEmptyState.js";
57
+ import { AssistantNothingToDeleteNotice as rn } from "./AssistantDeleteConversationDialog.js";
58
+ import { assistantHistoryIsOn as an } from "./conversationDelete.js";
59
+ import { useConversationDeleteDialog as on } from "./conversationDeleteDialog.js";
60
+ import { resolveConversationDeleteTarget as sn } from "../conversationDeleteCommand.js";
61
+ import { resumeContextFor as cn } from "../history/historyResume.js";
62
+ import { useHistoryRowControlsFor as ln } from "../history/useHistoryRowControls.js";
63
+ import { AssistantMessageList as un } from "./AssistantMessageList.js";
64
+ import { AssistantVoiceSession as dn } from "./voice/AssistantVoiceSession.js";
65
+ import { useAssistantApiAccess as fn } from "../useAssistantApiAccess.js";
66
+ import { useConversationTurns as pn } from "../useConversationTurns.js";
67
+ import { sendAssistantTurnTimings as mn, startTurnTimingReporting as hn } from "../turnTimingReporter.js";
68
+ import { WarmCancelled as gn, consumeWarm as _n, prewarmTarget as vn, settleWarmBeforeSend as yn, startWarm as bn, warmState as xn } from "../prewarm.js";
69
+ import { isAlreadyThere as Sn, matchLocalUiCommand as Cn, navDestinations as wn, planThemeChange as Tn } from "../localUiCommands.js";
70
+ import { chooseDestinationCopy as En, navigationCommandCopy as Dn, themeCommandCopy as On } from "../localUiCommandCopy.js";
71
+ import { dispatchAssistantQuotaExhausted as kn, notifyAiCreditsUpdated as An } from "../aiCredits.js";
72
+ import { useAssistantAttachments as jn } from "../useAssistantAttachments.js";
73
+ import { AssistantComposer as Mn } from "./composer/AssistantComposer.js";
74
+ import { isProdRuntime as Nn } from "../env.js";
75
+ import { AssistantApiCallsConsentDialog as Pn } from "./AssistantApiCallsConsentDialog.js";
76
+ import { useVisibleNavItems as Fn } from "../../../chrome/mobileTabBar/useVisibleNavItems.js";
77
+ import { useCallback as k, useEffect as A, useMemo as In, useRef as j, useState as Ln, useSyncExternalStore as Rn } from "react";
78
+ import { jsx as M, jsxs as zn } from "react/jsx-runtime";
74
79
  //#region src/shared/assistant/ui/AssistantChatArea.tsx
75
- var Nn = 600, Pn = 2e4, Fn = 1e4;
76
- function In() {
80
+ var Bn = 600, Vn = 2e4, Hn = 1e4, Un = 6e3;
81
+ function N() {
77
82
  return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
78
83
  }
79
- var Ln = ({ visible: Ln = !0, writeAccess: Rn = "unknown" }) => {
80
- let P = i(), { product: F, modes: I, gatherPageContext: zn, buildPrompt: Bn, reportTurnTimings: Vn, reportTokenUsage: Hn, localUiCommands: Un } = r(), L = ve(r().writeApproval), Wn = A((e, t) => {
81
- let n = b.getState(), r = t ?? n.sandboxesByMode[e]?.sandboxId ?? null;
82
- return Ye({
84
+ var Wn = ({ visible: Wn = !0, writeAccess: Gn = "unknown" }) => {
85
+ let P = i(), { product: F, modes: I, gatherPageContext: Kn, buildPrompt: qn, reportTurnTimings: Jn, reportTokenUsage: Yn, localUiCommands: Xn } = r(), L = ye(r().writeApproval), Zn = k((e, t) => {
86
+ let n = y.getState(), r = t ?? n.sandboxesByMode[e]?.sandboxId ?? null;
87
+ return Xe({
83
88
  mode: e,
84
89
  productWriteApproval: L,
85
90
  capabilities: r ? n.sandboxWriteCapabilities[r] : null
86
91
  });
87
- }, [L]), { getAccessToken: R, getWorkspaceToken: Gn, userId: z } = n(), { locale: B } = t(), Kn = b((e) => e.assistantLanguage), qn = b((e) => e.replyLanguage), Jn = kn(() => Le(Kn, qn, B), [
88
- Kn,
89
- qn,
92
+ }, [L]), { getAccessToken: R, getWorkspaceToken: Qn, userId: z } = n(), { locale: B } = t(), $n = y((e) => e.assistantLanguage), er = y((e) => e.replyLanguage), tr = In(() => Re($n, er, B), [
93
+ $n,
94
+ er,
90
95
  B
91
- ]), Yn = Jn.reply.english, Xn = Jn.replyIsExplicit, Zn = Jn.reply.code, { conversations: Qn, activeConversationId: V, mode: H, processingByConversationId: $n, setMode: er, setConversationMode: tr, setActiveConversation: nr, createConversation: U, addMessage: W, updateMessage: rr, patchMessage: ir, mergeMessageMetadata: ar, setConversationProcessing: or, clearConversationProcessing: sr, setBackendSessionId: cr, clearBackendSessionId: lr, setSandbox: ur, clearSandbox: dr, acknowledgedWriteModes: fr, acknowledgeWriteMode: pr, autoRouting: mr, setAutoRouting: hr, routeConversation: gr } = b(), _r = Qn.find((e) => e.id === V), vr = on(_r), yr = vr.all, G = V ? $n[V] : void 0, K = at(G?.status), br = K ? G?.messageId ?? null : null, xr = G?.status === "error" ? G.messageId : null, Sr = b((e) => e.sandboxWriteCapabilities), { panel: q, entries: Cr, retiredSandboxes: wr } = Bt({
96
+ ]), nr = tr.reply.english, rr = tr.replyIsExplicit, ir = tr.reply.code, { conversations: ar, activeConversationId: V, mode: H, processingByConversationId: or, setMode: sr, setConversationMode: cr, setActiveConversation: lr, createConversation: U, addMessage: W, updateMessage: ur, patchMessage: dr, mergeMessageMetadata: fr, setConversationProcessing: pr, clearConversationProcessing: mr, setBackendSessionId: hr, clearBackendSessionId: gr, setSandbox: _r, clearSandbox: vr, acknowledgedWriteModes: yr, acknowledgeWriteMode: br, autoRouting: xr, setAutoRouting: Sr, routeConversation: Cr } = y(), G = ar.find((e) => e.id === V), wr = pn(G), Tr = wr.all, K = V ? or[V] : void 0, q = ot(K?.status), Er = q ? K?.messageId ?? null : null, Dr = K?.status === "error" ? K.messageId : null, Or = y((e) => e.sandboxWriteCapabilities), { panel: J, entries: kr, retiredSandboxes: Ar } = Vt({
92
97
  tr: P,
93
98
  productWriteApproval: L
94
- }), Tr = Pt({
95
- approve: (e, t) => q.approve(e, t),
96
- decline: (e, t, n) => q.decline(e, t, n),
97
- presented: (e, t) => q.presented(e, t)
98
- }), Er = Tr.dismiss, Dr = M(null);
99
- j(() => {
100
- Er();
101
- let e = Dr.current;
102
- Dr.current = V, e && e !== V && q.withdraw(e, "conversation_closed"), V && q.openConversation(V);
99
+ }), jr = Ft({
100
+ approve: (e, t) => J.approve(e, t),
101
+ decline: (e, t, n) => J.decline(e, t, n),
102
+ presented: (e, t) => J.presented(e, t)
103
+ }), Mr = jr.dismiss, Nr = j(null);
104
+ A(() => {
105
+ Mr();
106
+ let e = Nr.current;
107
+ Nr.current = V, e && e !== V && J.withdraw(e, "conversation_closed"), V && J.openConversation(V);
103
108
  }, [
104
109
  V,
105
- q,
106
- Er
110
+ J,
111
+ Mr
107
112
  ]);
108
- let Or = Xt(_r), kr = Qt((e) => V !== null && V in e.loadingIds), Ar = Qt((e) => V !== null && V in e.loadErrorIds), jr = Qt((e) => e.remoteDelete), [Mr, Nr] = An(() => Qt.getState().remoteDelete?.at ?? null), Pr = jr?.wasActive === !0 && jr.at !== Mr ? jr.at : null;
109
- j(() => {
110
- if (Pr === null) return;
111
- let e = window.setTimeout(() => Nr(Pr), Fn);
113
+ let Pr = Qt(G), Fr = ln(G)?.archivedAt != null, Ir = en((e) => V !== null && V in e.loadingIds), Lr = en((e) => V !== null && V in e.loadErrorIds), Rr = en((e) => e.remoteDelete), [zr, Br] = Ln(() => en.getState().remoteDelete?.at ?? null), Vr = Rr?.wasActive === !0 && Rr.at !== zr ? Rr.at : null;
114
+ A(() => {
115
+ if (Vr === null) return;
116
+ let e = window.setTimeout(() => Br(Vr), Hn);
112
117
  return () => window.clearTimeout(e);
113
- }, [Pr]);
114
- let { canUseApiCalls: Fr, loading: Ir } = an(k(), z), Lr = M(nt({
115
- loading: Ir,
116
- canUseAdminModes: Fr
117
- })).current, Rr = M(I);
118
- j(() => {
119
- Rr.current = I;
118
+ }, [Vr]);
119
+ let { canUseApiCalls: Hr, loading: Ur } = fn(O(), z), Wr = j(rt({
120
+ loading: Ur,
121
+ canUseAdminModes: Hr
122
+ })).current, Gr = j(I);
123
+ A(() => {
124
+ Gr.current = I;
120
125
  }, [I]);
121
- let zr = () => {
122
- let e = b.getState().activeConversationId;
123
- e && $t.openConversation(e, { modes: Rr.current });
124
- }, Br = () => {
125
- let e = b.getState().activeConversationId;
126
- e && $t.loadEarlier(e);
127
- }, Vr = M(R);
128
- j(() => {
129
- Vr.current = R;
126
+ let Kr = () => {
127
+ let e = y.getState().activeConversationId;
128
+ e && tn.openConversation(e, { modes: Gr.current });
129
+ }, qr = () => {
130
+ let e = y.getState().activeConversationId;
131
+ e && tn.loadEarlier(e);
132
+ }, Jr = j(R);
133
+ A(() => {
134
+ Jr.current = R;
130
135
  }, [R]);
131
- let Hr = !!F && Vn !== !1;
132
- j(() => {
133
- if (Hr) return cn({ send: (e) => sn(e, {
134
- workspaceId: k(),
136
+ let Yr = !!F && Jn !== !1;
137
+ A(() => {
138
+ if (Yr) return hn({ send: (e) => mn(e, {
139
+ workspaceId: O(),
135
140
  authContext: {
136
- accessToken: Vr.current(),
137
- organizationId: Tt()
141
+ accessToken: Jr.current(),
142
+ organizationId: Et()
138
143
  }
139
144
  }) });
140
- }, [Hr]), j(() => {
141
- Lr.update({
142
- loading: Ir,
143
- canUseAdminModes: Fr
145
+ }, [Yr]), A(() => {
146
+ Wr.update({
147
+ loading: Ur,
148
+ canUseAdminModes: Hr
144
149
  });
145
150
  }, [
146
- Lr,
147
- Ir,
148
- Fr
149
- ]), j(() => () => {
150
- Lr.abandon();
151
- }, [Lr]);
152
- let Ur = kn(() => I.filter((e) => !e.requiresAdmin || Fr), [I, Fr]), Wr = d(Ur), Gr = mr && Wr, Kr = M(Wr);
153
- j(() => {
154
- Kr.current = Wr;
151
+ Wr,
152
+ Ur,
153
+ Hr
154
+ ]), A(() => () => {
155
+ Wr.abandon();
155
156
  }, [Wr]);
156
- let qr = M(null), Jr = M(!1), Yr = Ge(I), [Xr, Zr] = An(null), [Qr, $r] = An(null), ei = Qr !== null && Qr === V, ti = A((e) => {
157
- $r(e ? b.getState().activeConversationId : null);
157
+ let Xr = In(() => I.filter((e) => !e.requiresAdmin || Hr), [I, Hr]), Zr = d(Xr), Qr = xr && Zr, $r = j(Zr);
158
+ A(() => {
159
+ $r.current = Zr;
160
+ }, [Zr]);
161
+ let ei = j(null), ti = j(!1), ni = Ke(I), [ri, ii] = Ln(null), [ai, oi] = Ln(null), si = ai !== null && ai === V, ci = k((e) => {
162
+ oi(e ? y.getState().activeConversationId : null);
158
163
  }, []);
159
- j(() => {
160
- $r((e) => e !== null && e !== V ? null : e);
164
+ A(() => {
165
+ oi((e) => e !== null && e !== V ? null : e);
161
166
  }, [V]);
162
- let ni = M(void 0), ri = M({}), J = M(Ot()), Y = M(/* @__PURE__ */ new Set()), ii = M(/* @__PURE__ */ new Set()), X = kn(() => I.find((e) => e.id === H), [I, H]), ai = b((e) => {
167
+ let li = j(void 0), ui = j({}), Y = j(kt()), X = j(/* @__PURE__ */ new Set()), di = j(/* @__PURE__ */ new Set()), fi = In(() => I.find((e) => e.id === H), [I, H]), pi = y((e) => {
163
168
  let t = e.sandboxesByMode[H]?.sandboxId;
164
169
  return t ? e.sandboxWriteCapabilities[t] : void 0;
165
- }), oi = X !== void 0 && Ye({
170
+ }), mi = fi !== void 0 && Xe({
166
171
  mode: H,
167
172
  productWriteApproval: L,
168
- capabilities: ai
169
- }), si = H === "assistant" || X !== void 0 && !X.writeCapable && !pe(H) || oi;
170
- j(() => {
171
- if (H !== "assistant" && X?.writeCapable && !ie(fr, H)) {
172
- er("assistant");
173
+ capabilities: pi
174
+ }), hi = H === "assistant" || fi !== void 0 && !fi.writeCapable && !me(H) || mi;
175
+ A(() => {
176
+ if (H !== "assistant" && fi?.writeCapable && !ae(yr, H)) {
177
+ sr("assistant");
173
178
  return;
174
179
  }
175
- Ir || (!X || X.requiresAdmin && !Fr) && H !== "assistant" && er("assistant");
180
+ Ur || (!fi || fi.requiresAdmin && !Hr) && H !== "assistant" && sr("assistant");
176
181
  }, [
177
182
  H,
178
- X,
179
- Fr,
180
- Ir,
181
- er,
182
- fr
183
+ fi,
184
+ Hr,
185
+ Ur,
186
+ sr,
187
+ yr
183
188
  ]);
184
- let ci = A((e, t, n, r) => {
185
- or(e, n, t, null, r);
186
- }, [or]), li = A(async (e, t, n, r, i, a = null) => {
189
+ let gi = k((e, t, n, r) => {
190
+ pr(e, n, t, null, r);
191
+ }, [pr]), _i = k(async (e, t, n, r, i, a = null) => {
187
192
  let s = (e, t) => {
188
- r && ci(r.conversationId, r.assistantMessageId, e, t), a && (a.step = t, a.onStep?.(t));
193
+ r && gi(r.conversationId, r.assistantMessageId, e, t), a && (a.step = t, a.onStep?.(t));
189
194
  }, c = (e) => {
190
- r && O(r.assistantMessageId, e);
195
+ r && D(r.assistantMessageId, e);
191
196
  }, l = () => {
192
197
  c("bootAdopted"), a?.beginBoot();
193
- }, u = () => a !== null && (a.signal.aborted || k() !== t), d = () => {
194
- if (u()) throw new ln("cancelled");
195
- }, f = b.getState().sandboxesByMode[e]?.sandboxId ?? null, p = !1, ee = !1, m = !1, h = !1, g = !1, te = async (r) => {
196
- if (i && !Y.current.has(r) && J.current.isFresh(r)) return p = !0, !0;
197
- m = !0;
198
+ }, u = () => a !== null && (a.signal.aborted || O() !== t), d = () => {
199
+ if (u()) throw new gn("cancelled");
200
+ }, f = y.getState().sandboxesByMode[e]?.sandboxId ?? null, ee = !1, te = !1, p = !1, m = !1, h = !1, ne = async (r) => {
201
+ if (i && !X.current.has(r) && Y.current.isFresh(r)) return ee = !0, !0;
202
+ p = !0;
198
203
  let o = !1;
199
204
  try {
200
- await _e(r, t, n, 3e5), await C(r, t, e, n, 9e4, () => {
205
+ await ve(r, t, n, 3e5), await S(r, t, e, n, 9e4, () => {
201
206
  o = !0, l();
202
207
  });
203
208
  } catch {
204
- if (u()) throw new ln("cancelled");
205
- return J.current.invalidate(r), Y.current.add(r), a?.dead.push(r), g = !0, !1;
209
+ if (u()) throw new gn("cancelled");
210
+ return Y.current.invalidate(r), X.current.add(r), a?.dead.push(r), h = !0, !1;
206
211
  }
207
- return d(), J.current.markVerified(r), o && (h = !0), !0;
212
+ return d(), Y.current.markVerified(r), o && (m = !0), !0;
208
213
  };
209
- if (f && (ur(e, f, "provisioning"), s("provisioning", "reusingEnvironment"), await te(f) || (ur(e, null, "provisioning"), f = null)), !f) {
214
+ if (f && (_r(e, f, "provisioning"), s("provisioning", "reusingEnvironment"), await ne(f) || (_r(e, null, "provisioning"), f = null)), !f) {
210
215
  s("provisioning", "lookingForEnvironment");
211
- let r = await S(t, F, e, En(), n, Y.current, L);
216
+ let r = await x(t, F, e, Nn(), n, X.current, L);
212
217
  d();
213
218
  let i = r?.id ?? null;
214
219
  if (i) {
215
- ur(e, i, "provisioning"), s("provisioning", "reusingEnvironment");
220
+ _r(e, i, "provisioning"), s("provisioning", "reusingEnvironment");
216
221
  let t = r?.status === "PROVISIONING" || r?.status === "PENDING";
217
- t && l(), await te(i) ? (f = i, t && (h = !0)) : ur(e, null, "provisioning");
222
+ t && l(), await ne(i) ? (f = i, t && (m = !0)) : _r(e, null, "provisioning");
218
223
  }
219
224
  }
220
225
  if (!f) {
221
- if (a && !a.mayCreate) throw new ln("no-create");
226
+ if (a && !a.mayCreate) throw new gn("no-create");
222
227
  if (c("provisionStarted"), e === "api-calls" && !R()) throw Error("API Calls mode requires an authenticated session. Please sign in again.");
223
- s("provisioning", "startingEnvironment"), ur(e, null, "provisioning");
224
- let r = a ? [] : await he(t, F, e, En(), n, Y.current, L);
228
+ s("provisioning", "startingEnvironment"), _r(e, null, "provisioning");
229
+ let r = a ? [] : await ge(t, F, e, Nn(), n, X.current, L);
225
230
  if (r.length > 0) {
226
231
  let e = new Set(r);
227
- for (let e of r) J.current.invalidate(e), Y.current.add(e);
228
- let t = b.getState().sandboxesByMode;
229
- for (let [n, r] of Object.entries(t)) o(n) && r?.sandboxId && e.has(r.sandboxId) && dr(n);
232
+ for (let e of r) Y.current.invalidate(e), X.current.add(e);
233
+ let t = y.getState().sandboxesByMode;
234
+ for (let [n, r] of Object.entries(t)) o(n) && r?.sandboxId && e.has(r.sandboxId) && vr(n);
230
235
  }
231
236
  c("createRequested");
232
237
  let i = a?.beginCreate();
233
238
  try {
234
- f = await ce(F, e, t, En(), Nn, n, { writeApproval: L });
239
+ f = await le(F, e, t, Nn(), Bn, n, { writeApproval: L });
235
240
  } finally {
236
241
  i?.();
237
242
  }
238
- ee = !0, d(), ur(e, f, "provisioning"), await _e(f, t, n, 3e5), d(), c("sandboxRunning"), await C(f, t, e, n, 9e4), d(), c("serviceReady"), J.current.markVerified(f);
243
+ te = !0, d(), _r(e, f, "provisioning"), await ve(f, t, n, 3e5), d(), c("sandboxRunning"), await S(f, t, e, n, 9e4), d(), c("serviceReady"), Y.current.markVerified(f);
239
244
  }
240
- return ur(e, f, "running"), {
245
+ return _r(e, f, "running"), {
241
246
  sandboxId: f,
242
- sandboxIsNew: ee,
243
- sandboxProbed: m,
244
- sandboxAdopted: h,
245
- deadSandboxProbe: g,
246
- trustedFromCache: p
247
+ sandboxIsNew: te,
248
+ sandboxProbed: p,
249
+ sandboxAdopted: m,
250
+ deadSandboxProbe: h,
251
+ trustedFromCache: ee
247
252
  };
248
253
  }, [
249
- dr,
254
+ vr,
250
255
  R,
251
256
  F,
252
257
  L,
253
- ur,
254
- ci
255
- ]), ui = A(async function e(t, n, r, i, a, o = {}) {
256
- let s = await fn(i, r, (e) => ci(t, n, "provisioning", e), () => O(n, "prewarmJoined"));
257
- for (let e of s.dead) J.current.invalidate(e), Y.current.add(e);
258
- s.verified && !Y.current.has(s.verified) && J.current.markVerified(s.verified), s.joined && D(n, { prewarm: s.joined });
259
- let { sandboxId: c, sandboxIsNew: l, sandboxProbed: u, sandboxAdopted: d, deadSandboxProbe: f, trustedFromCache: p } = await li(r, i, a, {
258
+ _r,
259
+ gi
260
+ ]), vi = k(async function e(t, n, r, i, a, o = {}) {
261
+ let s = await yn(i, r, (e) => gi(t, n, "provisioning", e), () => D(n, "prewarmJoined"));
262
+ for (let e of s.dead) Y.current.invalidate(e), X.current.add(e);
263
+ s.verified && !X.current.has(s.verified) && Y.current.markVerified(s.verified), s.joined && E(n, { prewarm: s.joined });
264
+ let { sandboxId: c, sandboxIsNew: l, sandboxProbed: u, sandboxAdopted: d, deadSandboxProbe: f, trustedFromCache: ee } = await _i(r, i, a, {
260
265
  conversationId: t,
261
266
  assistantMessageId: n
262
- }, o.trustCache !== !1), ee = un(i, r, c);
263
- !s.waited && ee && D(n, { prewarm: "hit" });
264
- let m = b.getState().conversations.find((e) => e.id === t)?.backendSessionId ?? null, h = !1, g = null;
265
- if (m) {
266
- let e = pt(c, m, (e, t) => de(e, i, t, r, a, { limit: 50 }));
267
+ }, o.trustCache !== !1), te = _n(i, r, c);
268
+ !s.waited && te && E(n, { prewarm: "hit" });
269
+ let p = y.getState().conversations.find((e) => e.id === t)?.backendSessionId ?? null, m = !1, h = null;
270
+ if (p) {
271
+ let e = mt(c, p, (e, t) => fe(e, i, t, r, a, { limit: 50 }));
267
272
  try {
268
- let t = await fe(c, i, m, r, a);
273
+ let t = await pe(c, i, p, r, a);
269
274
  if (t.mode !== r) throw Error(`Session mode mismatch: expected ${r}, received ${t.mode}`);
270
- g = e;
275
+ h = e;
271
276
  } catch {
272
- lr(t), m = null;
277
+ gr(t), p = null;
273
278
  }
274
279
  }
275
- if (!m) {
276
- ci(t, n, "connecting", "preparingSession");
280
+ if (!p) {
281
+ gi(t, n, "connecting", "preparingSession");
277
282
  let s;
278
283
  try {
279
- s = await x(c, i, r, a);
284
+ s = await b(c, i, r, a);
280
285
  } catch (s) {
281
- if (p) {
282
- J.current.invalidate(c);
283
- let l = At(s, o.isAbandoned?.() ?? !1), p = l === "check-network";
284
- if (l === "check-network" && (l = await kt(() => S(i, F, r, En(), a, Y.current, L))), l !== "rethrow" && o.isAbandoned?.() && (l = "rethrow"), l !== "rethrow") {
285
- p || D(n, { cacheProofFailed: !0 }), l === "replace" && (Y.current.add(c), lr(t), dr(r), q.retireSandbox(c));
286
+ if (ee) {
287
+ Y.current.invalidate(c);
288
+ let l = jt(s, o.isAbandoned?.() ?? !1), ee = l === "check-network";
289
+ if (l === "check-network" && (l = await At(() => x(i, F, r, Nn(), a, X.current, L))), l !== "rethrow" && o.isAbandoned?.() && (l = "rethrow"), l !== "rethrow") {
290
+ ee || E(n, { cacheProofFailed: !0 }), l === "replace" && (X.current.add(c), gr(t), vr(r), J.retireSandbox(c));
286
291
  let s = await e(t, n, r, i, a, {
287
292
  ...o,
288
293
  trustCache: !1
289
294
  });
290
- return p && (s.deadSandboxProbe || s.sandboxId !== c) && D(n, { cacheProofFailed: !0 }), {
295
+ return ee && (s.deadSandboxProbe || s.sandboxId !== c) && E(n, { cacheProofFailed: !0 }), {
291
296
  ...s,
292
297
  sandboxProbed: s.sandboxProbed || u,
293
298
  sandboxAdopted: s.sandboxAdopted || d,
@@ -297,62 +302,62 @@ var Ln = ({ visible: Ln = !0, writeAccess: Rn = "unknown" }) => {
297
302
  }
298
303
  throw s;
299
304
  }
300
- m = s.sessionId, cr(t, m), h = !0;
305
+ p = s.sessionId, hr(t, p), m = !0;
301
306
  }
302
307
  return {
303
308
  sandboxId: c,
304
- sessionId: m,
305
- sessionIsNew: h,
306
- readAhead: g,
309
+ sessionId: p,
310
+ sessionIsNew: m,
311
+ readAhead: h,
307
312
  sandboxIsNew: l,
308
313
  sandboxProbed: u,
309
314
  sandboxAdopted: d,
310
315
  deadSandboxProbe: f
311
316
  };
312
317
  }, [
313
- li,
314
- lr,
315
- dr,
318
+ _i,
319
+ gr,
320
+ vr,
316
321
  F,
317
322
  L,
318
- cr,
319
- ci,
320
- q
321
- ]), di = A((e) => {
322
- let t = k();
323
+ hr,
324
+ gi,
325
+ J
326
+ ]), yi = k((e) => {
327
+ let t = O();
323
328
  if (!t) return;
324
- let n = b.getState(), r = Date.now(), i = dn({
329
+ let n = y.getState(), r = Date.now(), i = vn({
325
330
  autoRouting: n.autoRouting,
326
- autoOffered: Kr.current,
331
+ autoOffered: $r.current,
327
332
  active: n.activeConversationId ? n.conversations.find((e) => e.id === n.activeConversationId) : void 0,
328
333
  selectedMode: n.mode,
329
334
  autoReadMode: s,
330
- modes: Rr.current,
335
+ modes: Gr.current,
331
336
  acknowledgedWriteModes: n.acknowledgedWriteModes,
332
- adminAccess: Lr.read(),
337
+ adminAccess: Wr.read(),
333
338
  dictated: e,
334
- voiceProposalBound: (e) => Wn(e),
335
- turnInFlight: Object.values(n.processingByConversationId).some((e) => at(e?.status)),
336
- ...mn(t),
339
+ voiceProposalBound: (e) => Zn(e),
340
+ turnInFlight: Object.values(n.processingByConversationId).some((e) => ot(e?.status)),
341
+ ...xn(t),
337
342
  now: r
338
343
  });
339
344
  if (!i) return;
340
- let a = pn(t, i, r), o = {
345
+ let a = bn(t, i, r), o = {
341
346
  accessToken: R(),
342
- workspaceToken: Gn(),
347
+ workspaceToken: Qn(),
343
348
  userId: z,
344
- organizationId: Tt()
349
+ organizationId: Et()
345
350
  };
346
- li(i.mode, t, o, null, !0, a).then((e) => a.finish({
351
+ _i(i.mode, t, o, null, !0, a).then((e) => a.finish({
347
352
  ok: !0,
348
353
  sandboxId: e.sandboxId,
349
354
  didWork: !e.trustedFromCache && (e.sandboxIsNew || e.sandboxProbed || e.sandboxAdopted),
350
355
  booted: e.sandboxIsNew || e.sandboxAdopted,
351
356
  dead: a.dead
352
357
  }), (e) => {
353
- if (!(e instanceof ln) && !a.signal.aborted && k() === t) {
354
- let e = b.getState().sandboxesByMode[i.mode]?.sandboxId ?? null;
355
- e && (J.current.invalidate(e), Y.current.add(e), a.dead.push(e), dr(i.mode));
358
+ if (!(e instanceof gn) && !a.signal.aborted && O() === t) {
359
+ let e = y.getState().sandboxesByMode[i.mode]?.sandboxId ?? null;
360
+ e && (Y.current.invalidate(e), X.current.add(e), a.dead.push(e), vr(i.mode));
356
361
  }
357
362
  a.finish({
358
363
  ok: !1,
@@ -362,102 +367,102 @@ var Ln = ({ visible: Ln = !0, writeAccess: Rn = "unknown" }) => {
362
367
  });
363
368
  });
364
369
  }, [
365
- li,
366
- Lr,
367
- dr,
370
+ _i,
371
+ Wr,
372
+ vr,
368
373
  R,
369
- Gn,
374
+ Qn,
370
375
  z,
371
- Wn
372
- ]), fi = A(() => di(!1), [di]), pi = jn(v, g, g)?.reference ?? null, [mi, hi] = An(0), gi = M(/* @__PURE__ */ new Set()), _i = M(null), vi = A(() => {
373
- let e = b.getState(), t = e.activeConversationId;
376
+ Zn
377
+ ]), bi = k(() => yi(!1), [yi]), xi = Rn(_, h, h)?.reference ?? null, [Si, Ci] = Ln(0), wi = j(/* @__PURE__ */ new Set()), Ti = j(null), Ei = k(() => {
378
+ let e = y.getState(), t = e.activeConversationId;
374
379
  if (!t) return;
375
- let n = e.processingByConversationId[t], r = at(n?.status) ? n?.messageId ?? null : null;
376
- if (!st({
380
+ let n = e.processingByConversationId[t], r = ot(n?.status) ? n?.messageId ?? null : null;
381
+ if (!ct({
377
382
  interruptedTurnId: r,
378
383
  activeTurnId: r,
379
- alreadyRequested: r ? gi.current.has(r) : !1
384
+ alreadyRequested: r ? wi.current.has(r) : !1
380
385
  }).send || !r) return;
381
- gi.current.add(r);
382
- let i = y(e), a = k(), o = e.conversations.find((e) => e.id === t)?.backendSessionId;
383
- !i || !a || !o || oe(i.sandboxId, a, o, i.mode, {
386
+ wi.current.add(r);
387
+ let i = v(e), a = O(), o = e.conversations.find((e) => e.id === t)?.backendSessionId;
388
+ !i || !a || !o || se(i.sandboxId, a, o, i.mode, {
384
389
  accessToken: R(),
385
- workspaceToken: Gn(),
390
+ workspaceToken: Qn(),
386
391
  userId: z,
387
- organizationId: Tt()
392
+ organizationId: Et()
388
393
  });
389
394
  }, [
390
395
  z,
391
396
  R,
392
- Gn
393
- ]), yi = A(async (e) => {
394
- let t = b.getState(), n = y(t), r = k(), i = t.activeConversationId;
395
- if (!n || !r || !i || Lt(t.sandboxWriteCapabilities[n.sandboxId])) return;
396
- let a = t.conversations.find((e) => e.id === i), o = a ? ne(Ae(a.messages), {
397
+ Qn
398
+ ]), Di = k(async (e) => {
399
+ let t = y.getState(), n = v(t), r = O(), i = t.activeConversationId;
400
+ if (!n || !r || !i || Rt(t.sandboxWriteCapabilities[n.sandboxId])) return;
401
+ let a = t.conversations.find((e) => e.id === i), o = a ? re(je(a.messages), {
397
402
  sessionId: a.backendSessionId,
398
403
  sandboxId: n.sandboxId,
399
404
  nowMs: Date.now()
400
405
  }) : null;
401
406
  if (o?.reference !== e) {
402
- hi((e) => e + 1);
407
+ Ci((e) => e + 1);
403
408
  return;
404
409
  }
405
410
  let s = {
406
411
  conversationId: i,
407
412
  reference: e
408
413
  };
409
- if (!m(s)) return;
414
+ if (!p(s)) return;
410
415
  try {
411
- await se(n.sandboxId, r, e, n.mode, {
416
+ await ce(n.sandboxId, r, e, n.mode, {
412
417
  accessToken: R(),
413
- workspaceToken: Gn(),
418
+ workspaceToken: Qn(),
414
419
  userId: z,
415
- organizationId: Tt()
420
+ organizationId: Et()
416
421
  });
417
422
  } catch (e) {
418
- h(s), W(i, {
419
- id: In(),
423
+ m(s), W(i, {
424
+ id: N(),
420
425
  role: "system",
421
426
  content: e instanceof Error ? e.message : "The change could not be approved.",
422
427
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
423
428
  });
424
429
  return;
425
430
  }
426
- h(s), ar(i, o.messageId, { pendingWriteApprovedAt: (/* @__PURE__ */ new Date()).toISOString() });
427
- let c = b.getState(), l = c.conversations.find((e) => e.id === i);
428
- c.activeConversationId !== i || !l || c.mode !== n.mode || l.backendSessionId !== a?.backendSessionId || y(c)?.sandboxId !== n.sandboxId || at(c.processingByConversationId[i]?.status) || _(Ae(l.messages)) !== o.messageId || Ai.current(P("pendingWrite.approvedPrompt", "I approved that change — go ahead."), [], {
431
+ m(s), fr(i, o.messageId, { pendingWriteApprovedAt: (/* @__PURE__ */ new Date()).toISOString() });
432
+ let c = y.getState(), l = c.conversations.find((e) => e.id === i);
433
+ c.activeConversationId !== i || !l || c.mode !== n.mode || l.backendSessionId !== a?.backendSessionId || v(c)?.sandboxId !== n.sandboxId || ot(c.processingByConversationId[i]?.status) || g(je(l.messages)) !== o.messageId || Wi.current(P("pendingWrite.approvedPrompt", "I approved that change — go ahead."), [], {
429
434
  approvalFollowUp: { approvedReplyId: o.messageId },
430
435
  targetConversationId: i
431
436
  });
432
437
  }, [
433
438
  z,
434
439
  W,
435
- ar,
440
+ fr,
436
441
  P
437
- ]), bi = e(), { speakFinishedReply: xi } = Ct(), Si = a(), { items: Ci } = On(), wi = M({
438
- theme: bi,
439
- navigate: Si,
440
- navItems: Ci,
441
- options: Un ?? {}
442
+ ]), Oi = e(), { speakFinishedReply: ki } = wt(), Ai = a(), { items: ji } = Fn(), Mi = j({
443
+ theme: Oi,
444
+ navigate: Ai,
445
+ navItems: ji,
446
+ options: Xn ?? {}
442
447
  });
443
- j(() => {
444
- wi.current = {
445
- theme: bi,
446
- navigate: Si,
447
- navItems: Ci,
448
- options: Un ?? {}
448
+ A(() => {
449
+ Mi.current = {
450
+ theme: Oi,
451
+ navigate: Ai,
452
+ navItems: ji,
453
+ options: Xn ?? {}
449
454
  };
450
455
  }, [
451
- bi,
452
- Si,
453
- Ci,
454
- Un
456
+ Oi,
457
+ Ai,
458
+ ji,
459
+ Xn
455
460
  ]);
456
- let Ti = A((e, t, n, r, i) => {
461
+ let Ni = k((e, t, n, r, i) => {
457
462
  let a = P(n.key, n.fallback, r), o = n.fallback.replace(/\{\{\s*count\s*\}\}/g, String(r.count)), s = {
458
463
  kind: "write-reply",
459
464
  line: n.key
460
- }, c = (/* @__PURE__ */ new Date()).toISOString(), l = In();
465
+ }, c = (/* @__PURE__ */ new Date()).toISOString(), l = N();
461
466
  W(e, {
462
467
  id: l,
463
468
  role: "user",
@@ -465,10 +470,10 @@ var Ln = ({ visible: Ln = !0, writeAccess: Rn = "unknown" }) => {
465
470
  timestamp: c,
466
471
  metadata: {
467
472
  localAction: s,
468
- ...T(i)
473
+ ...w(i)
469
474
  }
470
475
  });
471
- let u = In();
476
+ let u = N();
472
477
  W(e, {
473
478
  id: u,
474
479
  role: "assistant",
@@ -477,26 +482,55 @@ var Ln = ({ visible: Ln = !0, writeAccess: Rn = "unknown" }) => {
477
482
  metadata: {
478
483
  lang: a === o ? "en" : B,
479
484
  localAction: s,
480
- ...T(i)
485
+ ...w(i)
481
486
  }
482
- }), $t.recordCommittedEntries(e, [l, u], "LOCAL_COMMAND", k()), xi(e, u);
487
+ }), tn.recordCommittedEntries(e, [l, u], "LOCAL_COMMAND", O()), ki(e, u);
483
488
  }, [
484
489
  W,
485
490
  B,
486
- xi,
491
+ ki,
487
492
  P
488
- ]), Ei = A((e, t, n) => {
489
- let { theme: r, navigate: i } = wi.current, a, o;
493
+ ]), Pi = on(), Fi = Pi?.request ?? null, Ii = j(() => void 0), [Li, Ri] = Ln(null);
494
+ A(() => {
495
+ if (Li === null) return;
496
+ let e = window.setTimeout(() => Ri(null), Un);
497
+ return () => window.clearTimeout(e);
498
+ }, [Li]);
499
+ let zi = k((e) => {
500
+ if (!Fi) return !1;
501
+ let t = e !== void 0, n = y.getState(), r = sn({
502
+ spoken: t,
503
+ bound: li.current,
504
+ activeConversationId: n.activeConversationId,
505
+ conversations: n.conversations,
506
+ historyOn: an()
507
+ });
508
+ if (r && Fi(r), t) {
509
+ let e = r ? "Opened the delete confirmation. Choose Delete or Cancel on screen." : "There is no conversation to delete.", t = r ? P("deleteConversation.opened", "Opened the delete confirmation. Choose Delete or Cancel on screen.") : P("deleteConversation.nothing", "There is no conversation to delete.");
510
+ Ii.current({
511
+ id: `conversation-delete:${N()}`,
512
+ text: t,
513
+ lang: t === e ? "en" : B
514
+ });
515
+ } else r || Ri(Date.now());
516
+ return !0;
517
+ }, [
518
+ Fi,
519
+ B,
520
+ P
521
+ ]), Bi = k((e, t, n) => {
522
+ if (e.kind === "conversation-delete") return zi(n);
523
+ let { theme: r, navigate: i } = Mi.current, a, o;
490
524
  if (e.kind === "theme") {
491
525
  if (!r) return !1;
492
- let t = vn(e.request, {
526
+ let t = Tn(e.request, {
493
527
  mode: r.mode,
494
528
  resolvedTheme: r.resolvedTheme
495
529
  });
496
530
  if (!t.alreadyApplied) try {
497
531
  r.setMode(t.mode);
498
532
  } catch {}
499
- a = xn(P, t, e.request.kind === "family"), o = {
533
+ a = On(P, t, e.request.kind === "family"), o = {
500
534
  kind: "theme",
501
535
  mode: t.mode,
502
536
  alreadyApplied: t.alreadyApplied
@@ -504,19 +538,19 @@ var Ln = ({ visible: Ln = !0, writeAccess: Rn = "unknown" }) => {
504
538
  } else {
505
539
  if (!i) return !1;
506
540
  if (e.kind === "navigate") {
507
- let { destination: t } = e, n = hn(t, window.location.pathname + window.location.search, _n(wi.current.navItems));
508
- n || i(t.path), a = bn(P, t.label, n), o = {
541
+ let { destination: t } = e, n = Sn(t, window.location.pathname + window.location.search, wn(Mi.current.navItems));
542
+ n || i(t.path), a = Dn(P, t.label, n), o = {
509
543
  kind: "navigate",
510
544
  destinationId: t.id,
511
545
  path: t.path,
512
546
  alreadyHere: n
513
547
  };
514
- } else a = yn(P, e.candidates[0]?.label ?? e.query, e.candidates), o = {
548
+ } else a = En(P, e.candidates[0]?.label ?? e.query, e.candidates), o = {
515
549
  kind: "choose-destination",
516
550
  candidateIds: e.candidates.map((e) => e.id)
517
551
  };
518
552
  }
519
- let s = b.getState(), c = s.activeConversationId ?? U(void 0, s.autoRouting && Kr.current ? "assistant" : s.mode, s.autoRouting ? { routedBy: "auto" } : void 0), l = (/* @__PURE__ */ new Date()).toISOString(), u = In();
553
+ let s = y.getState(), c = s.activeConversationId ?? U(void 0, s.autoRouting && $r.current ? "assistant" : s.mode, s.autoRouting ? { routedBy: "auto" } : void 0), l = (/* @__PURE__ */ new Date()).toISOString(), u = N();
520
554
  W(c, {
521
555
  id: u,
522
556
  role: "user",
@@ -524,10 +558,10 @@ var Ln = ({ visible: Ln = !0, writeAccess: Rn = "unknown" }) => {
524
558
  timestamp: l,
525
559
  metadata: {
526
560
  localAction: o,
527
- ...T(n)
561
+ ...w(n)
528
562
  }
529
563
  });
530
- let d = In();
564
+ let d = N();
531
565
  return W(c, {
532
566
  id: d,
533
567
  role: "assistant",
@@ -536,33 +570,34 @@ var Ln = ({ visible: Ln = !0, writeAccess: Rn = "unknown" }) => {
536
570
  metadata: {
537
571
  lang: a.translated ? B : "en",
538
572
  localAction: o,
539
- ...T(n)
573
+ ...w(n)
540
574
  }
541
- }), $t.recordCommittedEntries(c, [u, d], "LOCAL_COMMAND", k()), xi(c, d), !0;
575
+ }), tn.recordCommittedEntries(c, [u, d], "LOCAL_COMMAND", O()), ki(c, d), !0;
542
576
  }, [
543
577
  W,
544
578
  U,
545
579
  B,
546
- xi,
580
+ zi,
581
+ ki,
547
582
  P
548
- ]), Di = A(async (e) => {
549
- Jr.current = !0;
583
+ ]), Vi = k(async (e) => {
584
+ ti.current = !0;
550
585
  try {
551
- await q.declineForReply(e.conversationId, e.reason, e.origin);
586
+ await J.declineForReply(e.conversationId, e.reason, e.origin);
552
587
  } finally {
553
- Jr.current = !1;
588
+ ti.current = !1;
554
589
  }
555
590
  if (e.commandText !== null) {
556
- let t = gn(e.commandText, _n(wi.current.navItems), wi.current.options);
557
- if (t && Ei(t, e.content, e.options.voiceSessionId)) return;
591
+ let t = Cn(e.commandText, wn(Mi.current.navItems), Mi.current.options);
592
+ if (t && Bi(t, e.content, e.options.voiceSessionId)) return;
558
593
  }
559
- await Ai.current(e.content, e.attachments, e.options);
560
- }, [Ei, q]), Z = A(async (e, t = [], n = {}) => {
561
- let r = n.voiceSessionId !== void 0, i = b.getState(), a = i.activeConversationId ?? V;
594
+ await Wi.current(e.content, e.attachments, e.options);
595
+ }, [Bi, J]), Z = k(async (e, t = [], n = {}) => {
596
+ let r = n.voiceSessionId !== void 0, i = y.getState(), a = i.activeConversationId ?? V;
562
597
  if (a) {
563
- if (at(i.processingByConversationId[a]?.status)) {
598
+ if (ot(i.processingByConversationId[a]?.status)) {
564
599
  let r = i.processingByConversationId[a]?.messageId ?? null;
565
- r && gi.current.has(r) && (_i.current = {
600
+ r && wi.current.has(r) && (Ti.current = {
566
601
  conversationId: a,
567
602
  content: e,
568
603
  attachments: t,
@@ -570,29 +605,29 @@ var Ln = ({ visible: Ln = !0, writeAccess: Rn = "unknown" }) => {
570
605
  });
571
606
  return;
572
607
  }
573
- if (ii.current.has(a)) return;
608
+ if (di.current.has(a)) return;
574
609
  }
575
- if (qr.current || g() !== null || Jr.current) return;
576
- let o = n.targetConversationId, s = p(), c = (e) => Xt(e) || Yt(e, s);
610
+ if (ei.current || h() !== null || ti.current) return;
611
+ let o = n.targetConversationId, s = ee(), c = (e) => Qt(e) || Zt(e, s);
577
612
  if (o !== void 0) {
578
613
  let e = i.conversations.find((e) => e.id === o);
579
614
  if (i.activeConversationId !== o || !e || e.mode !== i.mode || c(e)) return;
580
615
  }
581
616
  if (n.fromPerson && n.writeReplyBound === void 0) {
582
- let r = o ?? i.activeConversationId ?? null, a = n.voiceSessionId === void 0 ? "typed" : "spoken", s = Rt({
617
+ let r = o ?? i.activeConversationId ?? null, a = n.voiceSessionId === void 0 ? "typed" : "spoken", s = zt({
583
618
  text: e,
584
- locale: a === "spoken" ? Jn.input.code : B,
619
+ locale: a === "spoken" ? tr.input.code : B,
585
620
  origin: a,
586
621
  hasAttachments: t.length > 0,
587
- live: q.liveFor(r),
588
- matchesLocalCommand: (e) => gn(e, _n(wi.current.navItems), wi.current.options) !== null
622
+ live: J.liveFor(r),
623
+ matchesLocalCommand: (e) => Cn(e, wn(Mi.current.navItems), Mi.current.options) !== null
589
624
  });
590
625
  if (s.kind === "local_reply") {
591
- r && Ti(r, e, s.line, s.values, n.voiceSessionId);
626
+ r && Ni(r, e, s.line, s.values, n.voiceSessionId);
592
627
  return;
593
628
  }
594
629
  let c = s.kind === "local" ? s.fallback : s.bound, l = s.declineAll;
595
- if (l !== null && r) return Di({
630
+ if (l !== null && r) return Vi({
596
631
  conversationId: r,
597
632
  reason: l,
598
633
  origin: a,
@@ -611,342 +646,342 @@ var Ln = ({ visible: Ln = !0, writeAccess: Rn = "unknown" }) => {
611
646
  }
612
647
  let d = n.writeReplyBound?.promptText ?? e;
613
648
  if (n.fromPerson && t.length === 0 && n.writeReplyBound?.localCommands !== !1) {
614
- let t = gn(e, _n(wi.current.navItems), wi.current.options);
615
- if (t && Ei(t, e, n.voiceSessionId)) return;
649
+ let t = Cn(e, wn(Mi.current.navItems), Mi.current.options);
650
+ if (t && Bi(t, e, n.voiceSessionId)) return;
616
651
  }
617
- let ee = i.activeConversationId ? i.conversations.find((e) => e.id === i.activeConversationId) : void 0, m = c(ee) ? void 0 : ee, h = i.autoRouting && Kr.current && o === void 0 ? f({
652
+ let te = i.activeConversationId ? i.conversations.find((e) => e.id === i.activeConversationId) : void 0, p = c(te) ? void 0 : te, m = i.autoRouting && $r.current && o === void 0 ? f({
618
653
  intent: n.autoIntent ?? l(e),
619
654
  dictated: r,
620
- voiceProposalBound: r && Wn("api-calls") && ie(i.acknowledgedWriteModes, "api-calls"),
621
- conversation: m ? {
622
- mode: m.mode,
623
- routedBy: m.routedBy,
624
- hasHistory: Jt(m)
655
+ voiceProposalBound: r && Zn("api-calls") && ae(i.acknowledgedWriteModes, "api-calls"),
656
+ conversation: p ? {
657
+ mode: p.mode,
658
+ routedBy: p.routedBy,
659
+ hasHistory: Xt(p)
625
660
  } : null
626
661
  }) : null;
627
- if (h && Rr.current.find((e) => e.id === h.mode)?.writeCapable && !ie(i.acknowledgedWriteModes, h.mode)) {
628
- qr.current = {
662
+ if (m && Gr.current.find((e) => e.id === m.mode)?.writeCapable && !ae(i.acknowledgedWriteModes, m.mode)) {
663
+ ei.current = {
629
664
  content: e,
630
665
  attachments: t,
631
666
  options: n
632
- }, Zr(h.mode);
667
+ }, ii(m.mode);
633
668
  return;
634
669
  }
635
- let _ = h ? h.mode : i.mode, ne, re, v = o ?? V, y = v ? b.getState().conversations.find((e) => e.id === v) : void 0, se = h?.action === "escalate" && m ? {
636
- mode: m.mode,
637
- backendSessionId: m.backendSessionId ?? null
670
+ let g = m ? m.mode : i.mode, re, ie, _ = o ?? V, v = _ ? y.getState().conversations.find((e) => e.id === _) : void 0, ce = m?.action === "escalate" && p ? {
671
+ mode: p.mode,
672
+ backendSessionId: p.backendSessionId ?? null
638
673
  } : null;
639
- if (h) h.action === "new" || !m ? v = U(void 0, _, { routedBy: "auto" }) : (v = m.id, gr(v, _));
674
+ if (m) m.action === "new" || !p ? _ = U(void 0, g, { routedBy: "auto" }) : (_ = p.id, Cr(_, g));
640
675
  else {
641
676
  let e = i.autoRouting ? { routedBy: "auto" } : void 0;
642
- !v || c(y) || y && y.mode !== _ && Jt(y) ? v = U(void 0, _, e) : y && y.mode !== _ && (e ? gr(v, _) : tr(v, _));
677
+ !_ || c(v) || v && v.mode !== g && Xt(v) ? _ = U(void 0, g, e) : v && v.mode !== g && (e ? Cr(_, g) : cr(_, g));
643
678
  }
644
- if (!v) return;
645
- r && ni.current !== void 0 && v !== i.activeConversationId && (ni.current = v), n.approvalFollowUp || (ri.current[v] = t);
646
- let ce = () => b.getState().conversations.some((e) => e.id === v), x = k(), S = {
679
+ if (!_) return;
680
+ r && li.current !== void 0 && _ !== i.activeConversationId && (li.current = _), n.approvalFollowUp || (ui.current[_] = t);
681
+ let le = () => y.getState().conversations.some((e) => e.id === _), b = O(), x = {
647
682
  accessToken: R(),
648
- workspaceToken: Gn(),
683
+ workspaceToken: Qn(),
649
684
  userId: z,
650
- organizationId: Tt()
651
- }, fe = (e, t) => {
652
- ce() || !x || oe(e, x, t, _, {
685
+ organizationId: Et()
686
+ }, pe = (e, t) => {
687
+ le() || !b || se(e, b, t, g, {
653
688
  accessToken: R(),
654
- workspaceToken: Gn(),
689
+ workspaceToken: Qn(),
655
690
  userId: z,
656
- organizationId: Tt()
691
+ organizationId: Et()
657
692
  });
658
- }, he = {
659
- id: In(),
693
+ }, ge = {
694
+ id: N(),
660
695
  role: "user",
661
696
  content: e,
662
697
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
663
698
  metadata: {
664
- ...t.length ? { attachments: t.map(qe) } : {},
699
+ ...t.length ? { attachments: t.map(Je) } : {},
665
700
  ...n.approvalFollowUp ? {
666
701
  approvalFollowUp: !0,
667
702
  approvedReplyId: n.approvalFollowUp.approvedReplyId
668
703
  } : {},
669
- ...T(n.voiceSessionId)
704
+ ...w(n.voiceSessionId)
670
705
  }
671
706
  };
672
- W(v, he);
673
- let C = In();
674
- W(v, {
675
- id: C,
707
+ W(_, ge);
708
+ let S = N();
709
+ W(_, {
710
+ id: S,
676
711
  role: "assistant",
677
712
  content: "",
678
713
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
679
714
  metadata: {
680
- lang: Zn,
681
- ...T(n.voiceSessionId)
715
+ lang: ir,
716
+ ...w(n.voiceSessionId)
682
717
  }
683
- }), yt(C, {
718
+ }), bt(S, {
684
719
  channel: r ? "voice" : "chat",
685
- mode: _,
720
+ mode: g,
686
721
  product: F,
687
- language: Zn,
688
- device: bt(),
689
- routedByAuto: !!h
690
- }, n.voiceTiming), O(C, "accepted"), or(v, "provisioning", C, null), te(C);
691
- let _e = () => ot({
692
- turnId: C,
693
- abortRequested: gi.current.has(C),
694
- activeTurnId: b.getState().processingByConversationId[v]?.messageId ?? null,
695
- conversationExists: ce()
696
- }), ve = (e, t, r, i, a = !1, o = Zn) => {
697
- ir(v, C, { content: ye(e) }), ar(v, C, {
722
+ language: ir,
723
+ device: xt(),
724
+ routedByAuto: !!m
725
+ }, n.voiceTiming), D(S, "accepted"), pr(_, "provisioning", S, null), ne(S);
726
+ let ve = () => st({
727
+ turnId: S,
728
+ abortRequested: wi.current.has(S),
729
+ activeTurnId: y.getState().processingByConversationId[_]?.messageId ?? null,
730
+ conversationExists: le()
731
+ }), ye = (e, t, r, i, a = !1, o = ir) => {
732
+ dr(_, S, { content: be(e) }), fr(_, S, {
698
733
  lang: o,
699
734
  ...t?.length ? { artifacts: t } : {},
700
- ...t?.length || r || i ? { mode: _ } : {},
735
+ ...t?.length || r || i ? { mode: g } : {},
701
736
  ...r ? { sessionId: r } : {},
702
737
  ...i ? { sandboxId: i } : {},
703
738
  ...a ? { incomplete: !0 } : {},
704
- ...T(n.voiceSessionId)
739
+ ...w(n.voiceSessionId)
705
740
  });
706
- }, Ae = { session: null }, w = async (i = 1) => {
707
- O(C, "attemptStarted");
741
+ }, je = { session: null }, C = async (i = 1) => {
742
+ D(S, "attemptStarted");
708
743
  let a = null, o = null, s = !1;
709
744
  try {
710
- let { sandboxId: i, sessionId: c, sessionIsNew: l, readAhead: u, sandboxIsNew: f, sandboxProbed: p, sandboxAdopted: ee, deadSandboxProbe: m } = await ui(v, C, _, x, S, { isAbandoned: () => ot({
711
- turnId: C,
712
- abortRequested: gi.current.has(C),
713
- activeTurnId: b.getState().processingByConversationId[v]?.messageId ?? null,
714
- conversationExists: ce()
745
+ let { sandboxId: i, sessionId: c, sessionIsNew: l, readAhead: u, sandboxIsNew: f, sandboxProbed: ee, sandboxAdopted: te, deadSandboxProbe: p } = await vi(_, S, g, b, x, { isAbandoned: () => st({
746
+ turnId: S,
747
+ abortRequested: wi.current.has(S),
748
+ activeTurnId: y.getState().processingByConversationId[_]?.messageId ?? null,
749
+ conversationExists: le()
715
750
  }).abandon });
716
- if (a = i, O(C, "runtimeReady"), D(C, {
717
- runtime: f ? "cold" : ee ? "adopted" : p ? "probed" : l ? "new-session" : "warm",
718
- deadSandboxProbe: m
719
- }), o = c, Ae.session = {
751
+ if (a = i, D(S, "runtimeReady"), E(S, {
752
+ runtime: f ? "cold" : te ? "adopted" : ee ? "probed" : l ? "new-session" : "warm",
753
+ deadSandboxProbe: p
754
+ }), o = c, je.session = {
720
755
  sandboxId: i,
721
756
  sessionId: c
722
- }, ae(_, ne, b.getState().acknowledgedWriteModes, {
757
+ }, oe(g, re, y.getState().acknowledgedWriteModes, {
723
758
  dictated: r,
724
- confirmsWrites: pe(_),
725
- proposalBound: Wn(_, i)
726
- }) === "voice-in-write-mode") throw new be("voice-in-write-mode", "Voice in a write mode");
727
- let h = tn({
728
- conversation: b.getState().conversations.find((e) => e.id === v),
759
+ confirmsWrites: me(g),
760
+ proposalBound: Zn(g, i)
761
+ }) === "voice-in-write-mode") throw new xe("voice-in-write-mode", "Voice in a write mode");
762
+ let m = cn({
763
+ conversation: y.getState().conversations.find((e) => e.id === _),
729
764
  content: e,
730
765
  sessionIsNew: l,
731
- sendingMode: _,
732
- sendingModeConfig: ne,
733
- modes: Rr.current,
734
- answerText: (e) => ht(e).text
735
- }), g = await ft(() => de(i, x, c, _, S, { limit: 50 }), l, dt(u, i, c));
736
- ci(v, C, "streaming", "thinking");
737
- let te = zn?.(), ie = zt(b.getState().sandboxWriteCapabilities[i]), y = {
738
- conversationId: v,
739
- writeReply: ie === "proposal-v1" ? n.writeReplyBound?.writeReply ?? null : null
740
- }, { prompt: oe, parts: se } = it({
741
- content: h ? `${h}${d}` : d,
766
+ sendingMode: g,
767
+ sendingModeConfig: re,
768
+ modes: Gr.current,
769
+ answerText: (e) => gt(e).text
770
+ }), h = await pt(() => fe(i, b, c, g, x, { limit: 50 }), l, ft(u, i, c));
771
+ gi(_, S, "streaming", "thinking");
772
+ let ne = Kn?.(), ae = Bt(y.getState().sandboxWriteCapabilities[i]), v = {
773
+ conversationId: _,
774
+ writeReply: ae === "proposal-v1" ? n.writeReplyBound?.writeReply ?? null : null
775
+ }, { prompt: se, parts: ce } = at({
776
+ content: m ? `${m}${d}` : d,
742
777
  attachments: t,
743
- limits: Ke(ne),
744
- wrapPrompt: (e) => Bn?.(_, e, Yn, Xn, r, { writeApproval: ie }) ?? e,
745
- requestBytes: (e, t) => me({
778
+ limits: qe(re),
779
+ wrapPrompt: (e) => qn?.(g, e, nr, rr, r, { writeApproval: ae }) ?? e,
780
+ requestBytes: (e, t) => he({
746
781
  sandboxId: i,
747
- workspaceId: x,
782
+ workspaceId: b,
748
783
  sessionId: c,
749
- mode: _,
784
+ mode: g,
750
785
  prompt: e,
751
786
  parts: t,
752
- pageContext: te,
753
- authContext: S,
754
- ...y
787
+ pageContext: ne,
788
+ authContext: x,
789
+ ...v
755
790
  })
756
- }), xe = Ue(se), Se = xe > 0;
757
- s = He(t) > xe;
758
- let Ce = _e();
759
- if (Ce.abandon) {
760
- Ce.clearProcessing && sr(v);
791
+ }), Se = We(ce), Ce = Se > 0;
792
+ s = Ue(t) > Se;
793
+ let we = ve();
794
+ if (we.abandon) {
795
+ we.clearProcessing && mr(_);
761
796
  return;
762
797
  }
763
798
  try {
764
- await ge(i, x, c, oe, _, te, S, se?.length ? {
765
- parts: se,
766
- ...y
767
- } : y);
799
+ await _e(i, b, c, se, g, ne, x, ce?.length ? {
800
+ parts: ce,
801
+ ...v
802
+ } : v);
768
803
  } catch (e) {
769
- if (!se || !Et(e)) throw e;
770
- await ge(i, x, c, oe, _, te, S, y), s ||= Se;
804
+ if (!ce || !Dt(e)) throw e;
805
+ await _e(i, b, c, se, g, ne, x, v), s ||= Ce;
771
806
  }
772
- O(C, "promptSent");
773
- let Te = null, De = !1, Oe = lt, w = ut([], g), T = Date.now() + re.streamBudgetMs, E = Date.now(), je = Date.now();
774
- for (; Date.now() < T;) {
775
- fe(i, c);
776
- let e = _e();
807
+ D(S, "promptSent");
808
+ let Ee = null, Oe = !1, ke = ut, C = dt([], h), w = Date.now() + ie.streamBudgetMs, T = Date.now(), Me = Date.now();
809
+ for (; Date.now() < w;) {
810
+ pe(i, c);
811
+ let e = ve();
777
812
  if (e.abandon) {
778
- e.clearProcessing && sr(v);
813
+ e.clearProcessing && mr(_);
779
814
  return;
780
815
  }
781
- if (w = ut(await de(i, x, c, _, S, {
816
+ if (C = dt(await fe(i, b, c, g, x, {
782
817
  limit: 50,
783
- sinceMs: g
784
- }), g, { accumulateNarration: re.accumulatesNarration }), ir(v, C, { content: ye(w.content) }), w.hasRenderableOutput ? De || (De = !0, Te !== null && O(C, "lastQuietPoll", Te), O(C, "firstOutput")) : Te = St(), re.accumulatesNarration) w.hasText && O(C, "firstText");
818
+ sinceMs: h
819
+ }), h, { accumulateNarration: ie.accumulatesNarration }), dr(_, S, { content: be(C.content) }), C.hasRenderableOutput ? Oe || (Oe = !0, Ee !== null && D(S, "lastQuietPoll", Ee), D(S, "firstOutput")) : Ee = Ct(), ie.accumulatesNarration) C.hasText && D(S, "firstText");
785
820
  else {
786
- let e = mt(Oe, w, St());
787
- Oe = e.tracker, e.confirmedAt !== null && O(C, "firstText", e.confirmedAt);
821
+ let e = ht(ke, C, Ct());
822
+ ke = e.tracker, e.confirmedAt !== null && D(S, "firstText", e.confirmedAt);
788
823
  }
789
- if (w.pendingWrite && !Lt(b.getState().sandboxWriteCapabilities[i]) && ar(v, C, { pendingWrite: w.pendingWrite }), w.done) {
790
- O(C, "answerDone"), J.current.markVerified(i);
824
+ if (C.pendingWrite && !Rt(y.getState().sandboxWriteCapabilities[i]) && fr(_, S, { pendingWrite: C.pendingWrite }), C.done) {
825
+ D(S, "answerDone"), Y.current.markVerified(i);
791
826
  break;
792
827
  }
793
- Date.now() - E > 3e4 && (await le(i, x, 600, S).catch(() => void 0), E = Date.now()), await new Promise((e) => setTimeout(e, Pe(Date.now() - je)));
828
+ Date.now() - T > 3e4 && (await ue(i, b, 600, x).catch(() => void 0), T = Date.now()), await new Promise((e) => setTimeout(e, Fe(Date.now() - Me)));
794
829
  }
795
- let Me = re.producesArtifacts ? await ue(i, x, c, _, S).then((e) => e).catch(() => []) : void 0;
796
- w.usedTools !== void 0 && D(C, { usedTools: w.usedTools }), w.done || (D(C, { outcome: "timedOut" }), w = {
797
- ...w,
798
- content: ke(w.content, _, P, ne)
799
- }), s && (w = {
800
- ...w,
801
- content: `${w.content}\n\n${P("attachments.imagesNotSent", "_Your photo was too large to include with this message, so the answer above is from the text and the file link only. Try a smaller or more tightly cropped photo._")}`
830
+ let Ne = ie.producesArtifacts ? await de(i, b, c, g, x).then((e) => e).catch(() => []) : void 0;
831
+ C.usedTools !== void 0 && E(S, { usedTools: C.usedTools }), C.done || (E(S, { outcome: "timedOut" }), C = {
832
+ ...C,
833
+ content: Ae(C.content, g, P, re)
834
+ }), s && (C = {
835
+ ...C,
836
+ content: `${C.content}\n\n${P("attachments.imagesNotSent", "_Your photo was too large to include with this message, so the answer above is from the text and the file link only. Try a smaller or more tightly cropped photo._")}`
802
837
  });
803
- let Ne = !w.done;
804
- ve(w.content, Me, c, i, Ne), w.tokens && (ir(v, C, { tokens: w.tokens }), (Hn ? await Ee({
805
- workspaceId: x,
838
+ let Pe = !C.done;
839
+ ye(C.content, Ne, c, i, Pe), C.tokens && (dr(_, S, { tokens: C.tokens }), (Yn ? await De({
840
+ workspaceId: b,
806
841
  sessionId: c,
807
- messageId: w.messageId,
808
- model: w.model,
809
- tokens: w.tokens
810
- }, Hn, { ledger: we("panel", F) }) : { ok: !0 }).ok && Cn(F)), w.done || fe(i, c);
811
- let Fe = _e();
812
- if (Fe.abandon) {
813
- Fe.clearProcessing && sr(v);
842
+ messageId: C.messageId,
843
+ model: C.model,
844
+ tokens: C.tokens
845
+ }, Yn, { ledger: Te("panel", F) }) : { ok: !0 }).ok && An(F)), C.done || pe(i, c);
846
+ let Ie = ve();
847
+ if (Ie.abandon) {
848
+ Ie.clearProcessing && mr(_);
814
849
  return;
815
850
  }
816
- O(C, "complete"), D(C, { outcome: "answered" }), or(v, "complete", C, null), $t.recordCommittedEntries(v, [he.id, C], "TURN", x);
851
+ D(S, "complete"), E(S, { outcome: "answered" }), pr(_, "complete", S, null), tn.recordCommittedEntries(_, [ge.id, S], "TURN", b);
817
852
  } catch (e) {
818
- J.current.invalidate(a ?? b.getState().sandboxesByMode[_]?.sandboxId ?? null);
819
- let t = ot({
820
- turnId: C,
821
- abortRequested: gi.current.has(C),
822
- activeTurnId: b.getState().processingByConversationId[v]?.messageId ?? null,
823
- conversationExists: ce()
853
+ Y.current.invalidate(a ?? y.getState().sandboxesByMode[g]?.sandboxId ?? null);
854
+ let t = st({
855
+ turnId: S,
856
+ abortRequested: wi.current.has(S),
857
+ activeTurnId: y.getState().processingByConversationId[_]?.messageId ?? null,
858
+ conversationExists: le()
824
859
  });
825
- if (a && o && fe(a, o), t.abandon) {
826
- t.clearProcessing && sr(v);
860
+ if (a && o && pe(a, o), t.abandon) {
861
+ t.clearProcessing && mr(_);
827
862
  return;
828
863
  }
829
- if (i === 1 && Dt(e)) {
830
- let e = a ?? b.getState().sandboxesByMode[_]?.sandboxId ?? null;
831
- return e && (Y.current.add(e), J.current.invalidate(e)), lr(v), dr(_), rr(v, C, ""), ar(v, C, { pendingWrite: void 0 }), e && q.retireSandbox(e), xt(C), w(2);
864
+ if (i === 1 && Ot(e)) {
865
+ let e = a ?? y.getState().sandboxesByMode[g]?.sandboxId ?? null;
866
+ return e && (X.current.add(e), Y.current.invalidate(e)), gr(_), vr(g), ur(_, S, ""), fr(_, S, { pendingWrite: void 0 }), e && J.retireSandbox(e), St(S), C(2);
832
867
  }
833
868
  throw e;
834
869
  }
835
- }, E = v;
836
- ii.current.add(E);
870
+ }, T = _;
871
+ di.current.add(T);
837
872
  try {
838
- if (!x) throw Object.assign(/* @__PURE__ */ Error("Assistant backend is unavailable without an active workspace context."), { extensions: {
873
+ if (!b) throw Object.assign(/* @__PURE__ */ Error("Assistant backend is unavailable without an active workspace context."), { extensions: {
839
874
  code: "UNAUTHENTICATED",
840
875
  authFailure: "WORKSPACE_CONTEXT_MISSING"
841
876
  } });
842
- let e = await rt(_, () => Rr.current.find((e) => e.id === _), Lr);
843
- ne = e.config, re = e.capabilities;
844
- let t = ne, n = _e();
877
+ let e = await it(g, () => Gr.current.find((e) => e.id === g), Wr);
878
+ re = e.config, ie = e.capabilities;
879
+ let t = re, n = ve();
845
880
  if (n.abandon) {
846
- n.clearProcessing && sr(v);
881
+ n.clearProcessing && mr(_);
847
882
  return;
848
883
  }
849
- let i = ae(_, t, b.getState().acknowledgedWriteModes, {
884
+ let i = oe(g, t, y.getState().acknowledgedWriteModes, {
850
885
  dictated: r,
851
- confirmsWrites: pe(_),
852
- proposalBound: Wn(_)
886
+ confirmsWrites: me(g),
887
+ proposalBound: Zn(g)
853
888
  });
854
- if (i) throw new be(i, i === "confirm-write-mode" ? "Write mode not confirmed" : "Voice in a write mode");
855
- let a = we("panel", F);
856
- if (Hn && Te(a, x)) {
857
- let e = await De(a, x, Hn);
858
- if (!e.ok) throw Oe(e.kind);
859
- let t = _e();
889
+ if (i) throw new xe(i, i === "confirm-write-mode" ? "Write mode not confirmed" : "Voice in a write mode");
890
+ let a = Te("panel", F);
891
+ if (Yn && Ee(a, b)) {
892
+ let e = await Oe(a, b, Yn);
893
+ if (!e.ok) throw ke(e.kind);
894
+ let t = ve();
860
895
  if (t.abandon) {
861
- t.clearProcessing && sr(v);
896
+ t.clearProcessing && mr(_);
862
897
  return;
863
898
  }
864
899
  }
865
- O(C, "cleared"), await w();
900
+ D(S, "cleared"), await C();
866
901
  } catch (e) {
867
- if (J.current.invalidate(b.getState().sandboxesByMode[_]?.sandboxId ?? null), !ce()) {
868
- sr(v);
902
+ if (Y.current.invalidate(y.getState().sandboxesByMode[g]?.sandboxId ?? null), !le()) {
903
+ mr(_);
869
904
  return;
870
905
  }
871
- let t = Ae.session?.sandboxId ?? null, r = xe(e, { confirmsNoAction: Se({
872
- mode: _,
873
- capabilities: t ? b.getState().sandboxWriteCapabilities[t] : null
906
+ let t = je.session?.sandboxId ?? null, r = Se(e, { confirmsNoAction: Ce({
907
+ mode: g,
908
+ capabilities: t ? y.getState().sandboxWriteCapabilities[t] : null
874
909
  }) });
875
- D(C, { outcome: r.kind === "temporary" ? "failed" : "refused" }), r.offersUpgrade && Sn(F, "sandbox");
876
- let i = Ce(r, P);
877
- or(v, "error", C, i.headline), ir(v, C, { content: i.text }), ar(v, C, {
910
+ E(S, { outcome: r.kind === "temporary" ? "failed" : "refused" }), r.offersUpgrade && kn(F, "sandbox");
911
+ let i = we(r, P);
912
+ pr(_, "error", S, i.headline), dr(_, S, { content: i.text }), fr(_, S, {
878
913
  lang: i.translated ? B : "en",
879
- ...T(n.voiceSessionId)
914
+ ...w(n.voiceSessionId)
880
915
  });
881
916
  } finally {
882
- ii.current.delete(E), D(C, { outcome: "stopped" }), O(C, "complete");
883
- let e = b.getState(), t = u(se, _, e.conversations.find((e) => e.id === E), (t) => !!e.sandboxesByMode[t]?.sandboxId);
884
- t && (gr(E, t.mode), t.backendSessionId && cr(E, t.backendSessionId)), Ae.session && ce() && q.afterTurn({
885
- ...Ae.session,
886
- conversationId: E
887
- }, C);
888
- let n = _i.current;
889
- _i.current = null, n && n.conversationId === E && ce() && Ai.current(n.content, n.attachments, n.options);
917
+ di.current.delete(T), E(S, { outcome: "stopped" }), D(S, "complete");
918
+ let e = y.getState(), t = u(ce, g, e.conversations.find((e) => e.id === T), (t) => !!e.sandboxesByMode[t]?.sandboxId);
919
+ t && (Cr(T, t.mode), t.backendSessionId && hr(T, t.backendSessionId)), je.session && le() && J.afterTurn({
920
+ ...je.session,
921
+ conversationId: T
922
+ }, S);
923
+ let n = Ti.current;
924
+ Ti.current = null, n && n.conversationId === T && le() && Wi.current(n.content, n.attachments, n.options);
890
925
  }
891
926
  }, [
892
927
  V,
893
928
  W,
894
- Bn,
895
- lr,
896
- dr,
897
- Qn,
929
+ qn,
930
+ gr,
931
+ vr,
932
+ ar,
898
933
  U,
899
- ui,
900
- q,
901
- Ti,
902
- Di,
934
+ vi,
935
+ J,
936
+ Ni,
937
+ Vi,
903
938
  B,
904
- Jn,
905
- Wn,
906
- zn,
939
+ tr,
940
+ Zn,
941
+ Kn,
907
942
  R,
908
- Gn,
909
- ir,
943
+ Qn,
944
+ dr,
910
945
  F,
911
- Lr,
912
- Hn,
913
- Xn,
914
- B,
915
- Zn,
946
+ Wr,
916
947
  Yn,
917
- gr,
918
- Ei,
948
+ rr,
949
+ B,
950
+ ir,
951
+ nr,
952
+ Cr,
953
+ Bi,
954
+ hr,
919
955
  cr,
920
- tr,
921
- or,
922
- sr,
956
+ pr,
957
+ mr,
923
958
  P,
924
- ci,
925
- rr,
959
+ gi,
960
+ ur,
926
961
  z
927
- ]), Oi = A((e, t) => {
962
+ ]), Hi = k((e, t) => {
928
963
  Z(e, [], t ? { autoIntent: t } : {});
929
- }, [Z]), ki = A(() => {
930
- let e = [...vr.chat].reverse().find((e) => e.role === "user" && !e.metadata?.localAction);
964
+ }, [Z]), Ui = k(() => {
965
+ let e = [...wr.chat].reverse().find((e) => e.role === "user" && !e.metadata?.localAction);
931
966
  if (!e || e.metadata?.approvalFollowUp) return;
932
- let t = V ? ri.current[V] ?? [] : [];
967
+ let t = V ? ui.current[V] ?? [] : [];
933
968
  Z(e.content, t);
934
969
  }, [
935
- yr,
970
+ Tr,
936
971
  Z,
937
972
  V
938
- ]), Ai = M(Z);
939
- j(() => {
940
- Ai.current = Z;
973
+ ]), Wi = j(Z);
974
+ A(() => {
975
+ Wi.current = Z;
941
976
  }, [Z]);
942
- let ji = kn(() => {
943
- if (K) return null;
944
- for (let e = yr.length - 1; e >= 0; --e) {
945
- let t = yr[e];
946
- if (t?.role !== "assistant" || !w(t) || gi.current.has(t.id)) continue;
947
- let n = ct(t, G, P);
977
+ let Gi = In(() => {
978
+ if (q) return null;
979
+ for (let e = Tr.length - 1; e >= 0; --e) {
980
+ let t = Tr[e];
981
+ if (t?.role !== "assistant" || !C(t) || wi.current.has(t.id)) continue;
982
+ let n = lt(t, K, P);
948
983
  if (n.kind !== "output") return null;
949
- let r = ht(n.text).text.trim();
984
+ let r = gt(n.text).text.trim();
950
985
  return r ? {
951
986
  id: t.id,
952
987
  text: r
@@ -954,70 +989,70 @@ var Ln = ({ visible: Ln = !0, writeAccess: Rn = "unknown" }) => {
954
989
  }
955
990
  return null;
956
991
  }, [
957
- yr,
992
+ Tr,
993
+ q,
958
994
  K,
959
- G,
960
995
  P
961
- ]), Mi = kn(() => ji ? Fe(ji.text) : null, [ji]), Ni = vr.chat, Pi = b((e) => y(e)?.sandboxId ?? null), Fi = ne(Ni, {
962
- sessionId: _r?.backendSessionId,
963
- sandboxId: Pi,
996
+ ]), Ki = In(() => Gi ? Ie(Gi.text) : null, [Gi]), qi = wr.chat, Ji = y((e) => v(e)?.sandboxId ?? null), Yi = re(qi, {
997
+ sessionId: G?.backendSessionId,
998
+ sandboxId: Ji,
964
999
  nowMs: Date.now()
965
- }), Ii = re(Ni), Li = (e) => {
966
- if (It(e.metadata).length > 0) return !0;
1000
+ }), Xi = ie(qi), Zi = (e) => {
1001
+ if (Lt(e.metadata).length > 0) return !0;
967
1002
  let t = e.metadata?.sandboxId;
968
- return Lt(t ? Sr[t] : null);
969
- }, Ri = (e) => {
970
- let t = It(e.metadata);
971
- return t.length === 0 || !V ? null : /* @__PURE__ */ N(Ft, {
1003
+ return Rt(t ? Or[t] : null);
1004
+ }, Qi = (e) => {
1005
+ let t = Lt(e.metadata);
1006
+ return t.length === 0 || !V ? null : /* @__PURE__ */ M(It, {
972
1007
  refs: t,
973
1008
  conversationId: V,
974
- panel: q,
975
- entries: Cr,
976
- capabilitiesOf: (e) => Sr[e],
977
- turnInFlight: K,
1009
+ panel: J,
1010
+ entries: kr,
1011
+ capabilitiesOf: (e) => Or[e],
1012
+ turnInFlight: q,
978
1013
  tr: P,
979
- onReview: Tr.review,
980
- retiredSandboxes: wr
1014
+ onReview: jr.review,
1015
+ retiredSandboxes: Ar
981
1016
  });
982
- }, zi = Tr.dialog.view ? Cr[Tr.dialog.view.proposalId] : void 0, Bi = Fi?.expiresAtMs ?? null;
983
- j(() => {
984
- if (Bi === null) return;
985
- let e = window.setTimeout(() => hi((e) => e + 1), Math.max(0, Bi - Date.now()));
1017
+ }, $i = jr.dialog.view ? kr[jr.dialog.view.proposalId] : void 0, ea = Yi?.expiresAtMs ?? null;
1018
+ A(() => {
1019
+ if (ea === null) return;
1020
+ let e = window.setTimeout(() => Ci((e) => e + 1), Math.max(0, ea - Date.now()));
986
1021
  return () => window.clearTimeout(e);
987
- }, [Bi, mi]);
988
- let Q = kn(() => vr.voice.filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
1022
+ }, [ea, Si]);
1023
+ let Q = In(() => wr.voice.filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
989
1024
  id: e.id,
990
1025
  role: e.role,
991
- text: vt(e, G, P),
992
- sessionId: E(e),
1026
+ text: yt(e, K, P),
1027
+ sessionId: T(e),
993
1028
  timestamp: e.timestamp
994
1029
  })).filter((e) => e.text.length > 0), [
995
- vr.voice,
996
- G,
1030
+ wr.voice,
1031
+ K,
997
1032
  P
998
- ]), Vi = A(() => {
1033
+ ]), ta = k(() => {
999
1034
  if (Q.length === 0) return;
1000
1035
  let e = /* @__PURE__ */ new Date();
1001
- qt(Me(Q, {
1036
+ Yt(Ne(Q, {
1002
1037
  title: P("voiceSession.transcript", "Voice conversation"),
1003
1038
  savedAt: P("voiceSession.savedAt", "Saved"),
1004
1039
  session: P("voiceSession.sessionLabel", "Session"),
1005
1040
  earlier: P("voiceSession.earlierLabel", "Earlier"),
1006
1041
  you: P("voiceSession.speakerYou", "You"),
1007
1042
  assistant: P("voiceSession.speakerAssistant", "Assistant")
1008
- }, e), Ne(F, e), "text/markdown");
1043
+ }, e), Pe(F, e), "text/markdown");
1009
1044
  }, [
1010
1045
  F,
1011
1046
  Q,
1012
1047
  P
1013
- ]), Hi = wn({ perFileChars: Yr }), Ui = M(Hi);
1014
- Ui.current = Hi;
1015
- let Wi = M(/* @__PURE__ */ new Set()), Gi = M(() => !1), $ = wt({
1016
- onSubmit: A((e, t, n) => {
1017
- let r = ni.current, i = () => {
1018
- let i = Ui.current, a = b.getState();
1019
- if (!ze({
1020
- sessionLive: Gi.current(t),
1048
+ ]), na = jn({ perFileChars: ni }), ra = j(na);
1049
+ ra.current = na;
1050
+ let ia = j(/* @__PURE__ */ new Set()), aa = j(() => !1), $ = Tt({
1051
+ onSubmit: k((e, t, n) => {
1052
+ let r = li.current, i = () => {
1053
+ let i = ra.current, a = y.getState();
1054
+ if (!Be({
1055
+ sessionLive: aa.current(t),
1021
1056
  boundAtSubmit: r,
1022
1057
  activeConversationId: a.activeConversationId,
1023
1058
  boundConversationExists: a.conversations.some((e) => e.id === r)
@@ -1025,367 +1060,377 @@ var Ln = ({ visible: Ln = !0, writeAccess: Rn = "unknown" }) => {
1025
1060
  i.clear();
1026
1061
  return;
1027
1062
  }
1028
- let o = We(i.attachments), s = {
1063
+ let o = Ge(i.attachments), s = {
1029
1064
  ...n,
1030
- handedOver: St()
1065
+ handedOver: Ct()
1031
1066
  };
1032
- Ai.current(e, o, {
1067
+ Wi.current(e, o, {
1033
1068
  fromPerson: !0,
1034
1069
  voiceSessionId: t,
1035
1070
  voiceTiming: s
1036
1071
  }), i.clear();
1037
1072
  };
1038
- if (!Ui.current.isBusy) {
1073
+ if (!ra.current.isBusy) {
1039
1074
  i();
1040
1075
  return;
1041
1076
  }
1042
- let a = Date.now(), o = Wi.current, s = window.setInterval(() => {
1043
- Ui.current.isBusy && Date.now() - a < Pn || (window.clearInterval(s), o.delete(s), i());
1077
+ let a = Date.now(), o = ia.current, s = window.setInterval(() => {
1078
+ ra.current.isBusy && Date.now() - a < Vn || (window.clearInterval(s), o.delete(s), i());
1044
1079
  }, 200);
1045
1080
  o.add(s);
1046
1081
  }, []),
1047
- latestReply: ji,
1048
- language: Ie(Kn, B).tag
1082
+ latestReply: Gi,
1083
+ language: Le($n, B).tag
1049
1084
  });
1050
- Gi.current = $.isCurrentSession;
1051
- let Ki = $.active, qi = kn(() => $e(Object.values(Cr), V, wr), [
1052
- Cr,
1085
+ aa.current = $.isCurrentSession;
1086
+ let oa = $.answerLocally;
1087
+ A(() => {
1088
+ Ii.current = oa;
1089
+ }, [oa]);
1090
+ let sa = $.active, ca = In(() => et(Object.values(kr), V, Ar), [
1091
+ kr,
1053
1092
  V,
1054
- wr
1055
- ]), [Ji, Yi] = An(null);
1056
- j(() => {
1057
- Ki || Yi(null);
1058
- }, [Ki]);
1059
- let Xi = Tr.review, Zi = A(() => {
1060
- let e = qi[qi.length - 1];
1093
+ Ar
1094
+ ]), [la, ua] = Ln(null);
1095
+ A(() => {
1096
+ sa || ua(null);
1097
+ }, [sa]);
1098
+ let da = jr.review, fa = k(() => {
1099
+ let e = ca[ca.length - 1];
1061
1100
  if (!e) return;
1062
1101
  let { view: t } = e;
1063
- if (Mt(t) && jt(t, Sr[e.session.sandboxId]).offerConfirm) {
1064
- Xi(t);
1102
+ if (Nt(t) && Mt(t, Or[e.session.sandboxId]).offerConfirm) {
1103
+ da(t);
1065
1104
  return;
1066
1105
  }
1067
- Yi(t.proposalId);
1106
+ ua(t.proposalId);
1068
1107
  }, [
1069
- qi,
1070
- Sr,
1071
- Xi
1072
- ]), Qi = Ki ? Xe(qi) : null, $i = Ji ? Cr[Ji] : void 0, ea = Ki && $i && $i.session.conversationId === V ? {
1073
- content: /* @__PURE__ */ N(Ft, {
1108
+ ca,
1109
+ Or,
1110
+ da
1111
+ ]), pa = sa ? Ze(ca) : null, ma = la ? kr[la] : void 0, ha = sa && ma && ma.session.conversationId === V ? {
1112
+ content: /* @__PURE__ */ M(It, {
1074
1113
  refs: [{
1075
- proposalId: $i.view.proposalId,
1076
- sandboxId: $i.session.sandboxId,
1077
- sessionId: $i.session.sessionId
1114
+ proposalId: ma.view.proposalId,
1115
+ sandboxId: ma.session.sandboxId,
1116
+ sessionId: ma.session.sessionId
1078
1117
  }],
1079
- conversationId: $i.session.conversationId,
1080
- panel: q,
1081
- entries: Cr,
1082
- capabilitiesOf: (e) => Sr[e],
1083
- turnInFlight: K,
1118
+ conversationId: ma.session.conversationId,
1119
+ panel: J,
1120
+ entries: kr,
1121
+ capabilitiesOf: (e) => Or[e],
1122
+ turnInFlight: q,
1084
1123
  tr: P,
1085
- onReview: Xi,
1086
- retiredSandboxes: wr
1124
+ onReview: da,
1125
+ retiredSandboxes: Ar
1087
1126
  }),
1088
- closeLabel: et(P, Je.trayClose),
1089
- onClose: () => Yi(null)
1090
- } : null, ta = Tr.asking, na = $.holdListening;
1091
- j(() => {
1092
- na(Ki && ta);
1127
+ closeLabel: tt(P, Ye.trayClose),
1128
+ onClose: () => ua(null)
1129
+ } : null, ga = jr.asking, _a = Pi?.asking === !0, va = $.holdListening;
1130
+ A(() => {
1131
+ va(sa && (ga || _a));
1093
1132
  }, [
1094
- Ki,
1095
- ta,
1096
- na
1133
+ sa,
1134
+ ga,
1135
+ _a,
1136
+ va
1097
1137
  ]);
1098
- let ra = M(null), ia = $.announce;
1099
- j(() => {
1100
- if (!Ki) {
1101
- ra.current = null;
1138
+ let ya = j(null), ba = $.announce;
1139
+ A(() => {
1140
+ if (!sa) {
1141
+ ya.current = null;
1102
1142
  return;
1103
1143
  }
1104
- let e = ra.current;
1144
+ let e = ya.current;
1105
1145
  if (e === null) {
1106
- ra.current = new Set(Object.keys(Cr));
1146
+ ya.current = new Set(Object.keys(kr));
1107
1147
  return;
1108
1148
  }
1109
- for (let { view: t, session: n } of Qe(qi, e)) {
1149
+ for (let { view: t, session: n } of $e(ca, e)) {
1110
1150
  e.add(t.proposalId);
1111
- let r = Sr[n.sandboxId];
1112
- if (!Ye({
1151
+ let r = Or[n.sandboxId];
1152
+ if (!Xe({
1113
1153
  mode: "api-calls",
1114
1154
  productWriteApproval: L,
1115
1155
  capabilities: r
1116
1156
  })) continue;
1117
- let i = tt(t, jt(t, r).offerConfirm, P), a = t.proposalId;
1118
- ia({
1157
+ let i = nt(t, Mt(t, r).offerConfirm, P), a = t.proposalId;
1158
+ ba({
1119
1159
  id: `write-readback:${a}`,
1120
1160
  text: i.text,
1121
1161
  lang: i.translated ? B : "en",
1122
- stillWanted: () => q.entry(a)?.view.status === "pending"
1162
+ stillWanted: () => J.entry(a)?.view.status === "pending"
1123
1163
  });
1124
1164
  }
1125
1165
  }, [
1126
- Ki,
1127
- qi,
1128
- Cr,
1129
- Sr,
1166
+ sa,
1167
+ ca,
1168
+ kr,
1169
+ Or,
1130
1170
  L,
1131
1171
  P,
1132
1172
  B,
1133
- ia,
1134
- q
1173
+ ba,
1174
+ J
1135
1175
  ]);
1136
- let aa = M(!1);
1137
- j(() => {
1138
- aa.current = $.active;
1139
- }, [$.active]), j(() => ee((e) => {
1140
- if (!aa.current) return !1;
1141
- let t = ni.current;
1142
- return typeof t == "string" ? t === e : b.getState().activeConversationId === e;
1176
+ let xa = j(!1);
1177
+ A(() => {
1178
+ xa.current = $.active;
1179
+ }, [$.active]), A(() => te((e) => {
1180
+ if (!xa.current) return !1;
1181
+ let t = li.current;
1182
+ return typeof t == "string" ? t === e : y.getState().activeConversationId === e;
1143
1183
  }), []);
1144
- let oa = $.start, sa = A(() => {
1145
- di(!0), oa();
1146
- }, [di, oa]), ca = kn(() => _t(_r?.messages ?? []), [_r?.messages]), la = gt(vr.voice, G, P), ua = gt(ca, G, P) > 0, da = A(() => {
1147
- let e = b.getState().activeConversationId;
1184
+ let Sa = $.start, Ca = k(() => {
1185
+ yi(!0), Sa();
1186
+ }, [yi, Sa]), wa = In(() => vt(G?.messages ?? []), [G?.messages]), Ta = _t(wr.voice, K, P), Ea = _t(wa, K, P) > 0, Da = k(() => {
1187
+ let e = y.getState().activeConversationId;
1148
1188
  if (!e || Q.length === 0) return;
1149
- let t = new Set(ca.map((e) => e.id)), n = In();
1189
+ let t = new Set(wa.map((e) => e.id)), n = N();
1150
1190
  W(e, {
1151
1191
  id: n,
1152
1192
  role: "system",
1153
- content: je(Q.filter((e) => t.has(e.id)), {
1193
+ content: Me(Q.filter((e) => t.has(e.id)), {
1154
1194
  intro: P("voiceSession.continuedIntro", "Continued from a voice conversation. You asked about:"),
1155
1195
  nothing: P("voiceSession.continuedNothing", "Continued from a voice conversation."),
1156
1196
  more: (e) => P("voiceSession.continuedMore", "…and {{count}} more", { count: e })
1157
1197
  }),
1158
1198
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1159
- metadata: { continuedVoiceTurns: la }
1160
- }), $t.recordCommittedEntries(e, [n], "NOTE", k()), ti(!1), $.end();
1199
+ metadata: { continuedVoiceTurns: Ta }
1200
+ }), tn.recordCommittedEntries(e, [n], "NOTE", O()), ci(!1), $.end();
1161
1201
  }, [
1162
1202
  Q,
1163
- la,
1164
- ca,
1203
+ Ta,
1204
+ wa,
1165
1205
  W,
1166
1206
  P,
1167
1207
  $,
1168
- ti
1169
- ]), fa = M(0);
1170
- j(() => {
1171
- $.active && (fa.current = la);
1208
+ ci
1209
+ ]), Oa = j(0);
1210
+ A(() => {
1211
+ $.active && (Oa.current = Ta);
1172
1212
  }, [$.active]);
1173
- let pa = A(() => {
1174
- let e = la > fa.current;
1175
- $.end(), e && ti(!0);
1213
+ let ka = k(() => {
1214
+ let e = Ta > Oa.current;
1215
+ $.end(), e && ci(!0);
1176
1216
  }, [
1177
- la,
1217
+ Ta,
1178
1218
  $,
1179
- ti
1219
+ ci
1180
1220
  ]);
1181
- j(() => {
1182
- (!Ln || !si) && $.active && $.end();
1221
+ A(() => {
1222
+ (!Wn || !hi) && $.active && $.end();
1183
1223
  }, [
1184
- Ln,
1185
- si,
1224
+ Wn,
1225
+ hi,
1186
1226
  $
1187
- ]), j(() => {
1188
- let e = ni.current, t = b.getState(), n = Ve({
1227
+ ]), A(() => {
1228
+ let e = li.current, t = y.getState(), n = He({
1189
1229
  sessionLive: $.active,
1190
1230
  bound: e,
1191
1231
  activeConversationId: t.activeConversationId,
1192
1232
  boundConversationExists: t.conversations.some((t) => t.id === e)
1193
1233
  });
1194
- ni.current = n.bound, n.end && $.end();
1234
+ li.current = n.bound, n.end && $.end();
1195
1235
  }, [
1196
1236
  $,
1197
1237
  V,
1198
- Qn
1238
+ ar
1199
1239
  ]);
1200
- let ma = M(Re);
1201
- j(() => {
1202
- let e = Be(ma.current, {
1240
+ let Aa = j(ze);
1241
+ A(() => {
1242
+ let e = Ve(Aa.current, {
1203
1243
  activeConversationId: V,
1204
- chatTurnCount: Ni.length,
1244
+ chatTurnCount: qi.length,
1205
1245
  voiceTurnCount: Q.length,
1206
1246
  sessionLive: $.active,
1207
- sessionBoundTo: ni.current,
1208
- turnInFlight: K
1247
+ sessionBoundTo: li.current,
1248
+ turnInFlight: q
1209
1249
  });
1210
- ma.current = e.state, e.open && ti(!0);
1250
+ Aa.current = e.state, e.open && ci(!0);
1211
1251
  }, [
1212
1252
  V,
1213
- Ni.length,
1253
+ qi.length,
1214
1254
  Q.length,
1215
1255
  $.active,
1216
- K,
1217
- ti
1218
- ]), j(() => {
1256
+ q,
1257
+ ci
1258
+ ]), A(() => {
1219
1259
  if (!$.active) {
1220
- Ui.current.clear(), _i.current = null;
1221
- for (let e of Wi.current) window.clearInterval(e);
1222
- Wi.current.clear();
1260
+ ra.current.clear(), Ti.current = null;
1261
+ for (let e of ia.current) window.clearInterval(e);
1262
+ ia.current.clear();
1223
1263
  }
1224
- }, [$.active]), j(() => {
1225
- let e = Wi.current;
1264
+ }, [$.active]), A(() => {
1265
+ let e = ia.current;
1226
1266
  return () => {
1227
1267
  for (let t of e) window.clearInterval(t);
1228
1268
  e.clear();
1229
1269
  };
1230
- }, []), j(() => {
1231
- let e = b.getState().consumePendingPrompt();
1232
- return e && Ai.current(e), b.subscribe((e, t) => {
1270
+ }, []), A(() => {
1271
+ let e = y.getState().consumePendingPrompt();
1272
+ return e && Wi.current(e), y.subscribe((e, t) => {
1233
1273
  if (e.pendingPrompt && e.pendingPrompt !== t.pendingPrompt) {
1234
- let e = b.getState().consumePendingPrompt();
1235
- e && Ai.current(e);
1274
+ let e = y.getState().consumePendingPrompt();
1275
+ e && Wi.current(e);
1236
1276
  }
1237
1277
  });
1238
1278
  }, []);
1239
- let ha = A((e) => {
1240
- let t = V ? b.getState().conversations.find((e) => e.id === V) : void 0;
1241
- if (t && t.mode !== e && q.withdraw(t.id, "mode_switched"), t && Jt(t)) {
1279
+ let ja = k((e) => {
1280
+ let t = V ? y.getState().conversations.find((e) => e.id === V) : void 0;
1281
+ if (t && t.mode !== e && J.withdraw(t.id, "mode_switched"), t && Xt(t)) {
1242
1282
  if (t.mode !== e) {
1243
- let t = p(), n = b.getState().conversations.find((n) => n.mode === e && Zt(n, t) && !b.getState().processingByConversationId[n.id]);
1244
- n ? nr(n.id) : U(void 0, e);
1283
+ let t = ee(), n = y.getState().conversations.find((n) => n.mode === e && $t(n, t) && !y.getState().processingByConversationId[n.id]);
1284
+ n ? lr(n.id) : U(void 0, e);
1245
1285
  }
1246
- } else V && tr(V, e);
1247
- let n = b.getState().activeConversationId;
1248
- n ? tr(n, e) : hr(!1), er(e);
1286
+ } else V && cr(V, e);
1287
+ let n = y.getState().activeConversationId;
1288
+ n ? cr(n, e) : Sr(!1), sr(e);
1249
1289
  }, [
1250
1290
  V,
1251
1291
  U,
1252
- nr,
1253
- hr,
1254
- tr,
1255
- er,
1256
- q
1257
- ]), ga = A(() => {
1258
- let e = b.getState(), t = e.activeConversationId ? e.conversations.find((t) => t.id === e.activeConversationId) : void 0;
1292
+ lr,
1293
+ Sr,
1294
+ cr,
1295
+ sr,
1296
+ J
1297
+ ]), Ma = k(() => {
1298
+ let e = y.getState(), t = e.activeConversationId ? e.conversations.find((t) => t.id === e.activeConversationId) : void 0;
1259
1299
  if (!t) {
1260
- hr(!0), er(s);
1300
+ Sr(!0), sr(s);
1261
1301
  return;
1262
1302
  }
1263
1303
  if (t.routedBy === "auto") {
1264
- hr(!0);
1304
+ Sr(!0);
1265
1305
  return;
1266
1306
  }
1267
- if (!Jt(t)) {
1268
- gr(t.id, s);
1307
+ if (!Xt(t)) {
1308
+ Cr(t.id, s);
1269
1309
  return;
1270
1310
  }
1271
- q.withdraw(t.id, "mode_switched");
1272
- let n = p(), r = e.conversations.find((t) => t.routedBy === "auto" && Zt(t, n) && !e.processingByConversationId[t.id]);
1273
- r ? (nr(r.id), gr(r.id, s)) : U(void 0, s, { routedBy: "auto" });
1311
+ J.withdraw(t.id, "mode_switched");
1312
+ let n = ee(), r = e.conversations.find((t) => t.routedBy === "auto" && $t(t, n) && !e.processingByConversationId[t.id]);
1313
+ r ? (lr(r.id), Cr(r.id, s)) : U(void 0, s, { routedBy: "auto" });
1274
1314
  }, [
1275
1315
  U,
1276
- gr,
1277
- nr,
1278
- hr,
1279
- er,
1280
- q
1281
- ]), _a = A((e) => {
1282
- if (I.find((t) => t.id === e)?.writeCapable && !ie(b.getState().acknowledgedWriteModes, e)) {
1283
- Zr(e);
1316
+ Cr,
1317
+ lr,
1318
+ Sr,
1319
+ sr,
1320
+ J
1321
+ ]), Na = k((e) => {
1322
+ if (I.find((t) => t.id === e)?.writeCapable && !ae(y.getState().acknowledgedWriteModes, e)) {
1323
+ ii(e);
1284
1324
  return;
1285
1325
  }
1286
- ha(e);
1287
- }, [ha, I]), va = A(() => {
1288
- let e = Xr;
1289
- if (Zr(null), !e) return;
1290
- let t = qr.current;
1291
- if (qr.current = null, t) {
1292
- pr(e), Z(t.content, t.attachments, t.options);
1326
+ ja(e);
1327
+ }, [ja, I]), Pa = k(() => {
1328
+ let e = ri;
1329
+ if (ii(null), !e) return;
1330
+ let t = ei.current;
1331
+ if (ei.current = null, t) {
1332
+ br(e), Z(t.content, t.attachments, t.options);
1293
1333
  return;
1294
1334
  }
1295
- pr(e), ha(e);
1335
+ br(e), ja(e);
1296
1336
  }, [
1297
- Xr,
1298
- pr,
1299
- ha,
1337
+ ri,
1338
+ br,
1339
+ ja,
1300
1340
  Z
1301
- ]), ya = Xr === null ? void 0 : I.find((e) => e.id === Xr) ?? { id: Xr }, ba = A(() => {
1302
- Zr(null);
1303
- let e = qr.current;
1304
- qr.current = null, e && Z(e.content, e.attachments, {
1341
+ ]), Fa = ri === null ? void 0 : I.find((e) => e.id === ri) ?? { id: ri }, Ia = k(() => {
1342
+ ii(null);
1343
+ let e = ei.current;
1344
+ ei.current = null, e && Z(e.content, e.attachments, {
1305
1345
  ...e.options,
1306
1346
  autoIntent: "read"
1307
1347
  });
1308
1348
  }, [Z]);
1309
- return /* @__PURE__ */ Mn("div", {
1349
+ return /* @__PURE__ */ zn("div", {
1310
1350
  className: "relative flex flex-1 flex-col overflow-hidden",
1311
1351
  children: [
1312
- /* @__PURE__ */ Mn("div", {
1352
+ /* @__PURE__ */ zn("div", {
1313
1353
  className: "contents",
1314
1354
  inert: $.active || void 0,
1315
1355
  children: [
1316
- Pr === null ? null : /* @__PURE__ */ N(Ht, { onDismiss: () => Nr(Pr) }),
1317
- Q.length > 0 && !$.active ? /* @__PURE__ */ N(Vt, {
1356
+ Vr === null ? null : /* @__PURE__ */ M(Wt, { onDismiss: () => Br(Vr) }),
1357
+ Q.length > 0 && !$.active ? /* @__PURE__ */ M(Ht, {
1318
1358
  count: Q.length,
1319
- onOpenTranscript: () => ti(!0)
1359
+ onOpenTranscript: () => ci(!0)
1320
1360
  }) : null,
1321
- Ni.length === 0 && (kr || Ar) ? /* @__PURE__ */ N(Ut, {
1322
- state: kr ? "loading" : "failed",
1323
- onRetry: zr
1324
- }) : Ni.length === 0 && _r?.sync?.hasOlder ? /* @__PURE__ */ N("div", {
1361
+ qi.length === 0 && (Ir || Lr) ? /* @__PURE__ */ M(Gt, {
1362
+ state: Ir ? "loading" : "failed",
1363
+ onRetry: Kr
1364
+ }) : qi.length === 0 && G?.sync?.hasOlder ? /* @__PURE__ */ M("div", {
1325
1365
  className: "flex min-h-0 flex-1 flex-col",
1326
- children: /* @__PURE__ */ N(Gt, {
1327
- onShowEarlier: Br,
1328
- disabled: kr
1366
+ children: /* @__PURE__ */ M(qt, {
1367
+ onShowEarlier: qr,
1368
+ disabled: Ir
1329
1369
  })
1330
- }) : Ni.length === 0 ? /* @__PURE__ */ N(en, {
1370
+ }) : qi.length === 0 ? /* @__PURE__ */ M(nn, {
1331
1371
  mode: H,
1332
- onSuggestionClick: Oi,
1333
- explainsAuto: Gr,
1334
- suggestions: Gr && H === "assistant" ? c(I.find((e) => e.id === "assistant")?.suggestions ?? [], I.find((e) => e.id === "api-calls")?.suggestions ?? []) : void 0
1335
- }) : /* @__PURE__ */ Mn("div", {
1372
+ onSuggestionClick: Hi,
1373
+ explainsAuto: Qr,
1374
+ suggestions: Qr && H === "assistant" ? c(I.find((e) => e.id === "assistant")?.suggestions ?? [], I.find((e) => e.id === "api-calls")?.suggestions ?? []) : void 0
1375
+ }) : /* @__PURE__ */ zn("div", {
1336
1376
  className: "flex min-h-0 flex-1 flex-col",
1337
- children: [_r?.sync?.hasOlder ? /* @__PURE__ */ N(Gt, {
1338
- onShowEarlier: Br,
1339
- disabled: kr
1340
- }) : null, /* @__PURE__ */ N(nn, {
1341
- onApprovePendingWrite: yi,
1342
- approvingWriteRef: pi,
1343
- approvableMessageId: Fi?.messageId ?? null,
1344
- retryableMessageId: Ii,
1345
- messages: Ni,
1346
- processing: G ?? null,
1347
- streamingMessageId: br,
1348
- failedMessageId: xr,
1349
- onRetry: pi === null ? ki : void 0,
1350
- renderWriteProposals: Ri,
1351
- hidesLegacyWriteCard: Li
1377
+ children: [G?.sync?.hasOlder ? /* @__PURE__ */ M(qt, {
1378
+ onShowEarlier: qr,
1379
+ disabled: Ir
1380
+ }) : null, /* @__PURE__ */ M(un, {
1381
+ onApprovePendingWrite: Di,
1382
+ approvingWriteRef: xi,
1383
+ approvableMessageId: Yi?.messageId ?? null,
1384
+ retryableMessageId: Xi,
1385
+ messages: qi,
1386
+ processing: K ?? null,
1387
+ streamingMessageId: Er,
1388
+ failedMessageId: Dr,
1389
+ onRetry: xi === null ? Ui : void 0,
1390
+ renderWriteProposals: Qi,
1391
+ hidesLegacyWriteCard: Zi
1352
1392
  })]
1353
1393
  }),
1354
- Or ? /* @__PURE__ */ N(Wt, { onStartNew: () => U() }) : null,
1355
- Ni.length > 0 && (kr || Ar) ? /* @__PURE__ */ N(Ut, {
1356
- state: kr ? "loading" : "failed",
1357
- onRetry: zr,
1394
+ Pr ? /* @__PURE__ */ M(Kt, { onStartNew: () => U() }) : null,
1395
+ Fr && V ? /* @__PURE__ */ M(Ut, { onUnarchive: () => tn.updateConversation(V, { archived: !1 }) }) : null,
1396
+ Li === null ? null : /* @__PURE__ */ M(rn, {
1397
+ tr: P,
1398
+ onDismiss: () => Ri(null)
1399
+ }),
1400
+ qi.length > 0 && (Ir || Lr) ? /* @__PURE__ */ M(Gt, {
1401
+ state: Ir ? "loading" : "failed",
1402
+ onRetry: Kr,
1358
1403
  compact: !0
1359
1404
  }) : null,
1360
- /* @__PURE__ */ N(Tn, {
1361
- onStartVoiceSession: $.available && si ? sa : void 0,
1405
+ /* @__PURE__ */ M(Mn, {
1406
+ onStartVoiceSession: $.available && hi ? Ca : void 0,
1362
1407
  onSend: (e, t) => void Z(e, t, { fromPerson: !0 }),
1363
- onDraftStart: fi,
1364
- disabled: K || pi !== null || kr,
1365
- readOnly: Or,
1408
+ onDraftStart: bi,
1409
+ disabled: q || xi !== null || Ir,
1410
+ readOnly: Pr,
1366
1411
  placeholder: H === "api-calls" ? P("chatArea.placeholderActions", "What would you like me to do?") : P("chatArea.placeholderGeneral", "Ask me anything…"),
1367
1412
  mode: H,
1368
- writeAccessDenied: Rn === "denied" && !!X?.writeCapable,
1369
- availableModes: Ur,
1370
- attachmentCharsPerFile: Yr,
1371
- onModeChange: _a,
1372
- auto: Wr ? {
1373
- active: Gr,
1374
- onSelect: ga
1413
+ writeAccessDenied: Gn === "denied" && !!fi?.writeCapable,
1414
+ availableModes: Xr,
1415
+ attachmentCharsPerFile: ni,
1416
+ onModeChange: Na,
1417
+ auto: Zr ? {
1418
+ active: Qr,
1419
+ onSelect: Ma
1375
1420
  } : void 0
1376
1421
  })
1377
1422
  ]
1378
1423
  }),
1379
- ei && !$.active ? /* @__PURE__ */ N(Kt, {
1424
+ si && !$.active ? /* @__PURE__ */ M(Jt, {
1380
1425
  turns: Q,
1381
- onClose: () => ti(!1),
1382
- onSave: Vi,
1383
- onContinueInChat: ua ? da : void 0,
1426
+ onClose: () => ci(!1),
1427
+ onSave: ta,
1428
+ onContinueInChat: Ea ? Da : void 0,
1384
1429
  closeOnEscape: !0,
1385
- onShowEarlier: _r?.sync?.hasOlder ? Br : void 0,
1386
- showEarlierDisabled: kr
1430
+ onShowEarlier: G?.sync?.hasOlder ? qr : void 0,
1431
+ showEarlierDisabled: Ir
1387
1432
  }) : null,
1388
- $.active && /* @__PURE__ */ N(rn, {
1433
+ $.active && /* @__PURE__ */ M(dn, {
1389
1434
  session: $.session,
1390
1435
  notice: $.notice,
1391
1436
  capturing: $.capturing,
@@ -1393,44 +1438,44 @@ var Ln = ({ visible: Ln = !0, writeAccess: Rn = "unknown" }) => {
1393
1438
  awaitingEndpoint: $.awaitingEndpoint,
1394
1439
  turns: Q,
1395
1440
  spokenChunks: $.spokenChunks,
1396
- attachments: Hi.attachments,
1397
- onAttachFiles: Hi.addFiles,
1398
- onRemoveAttachment: Hi.remove,
1399
- onRetryAttachment: Hi.retry,
1400
- canAttachMore: Hi.canAddMore,
1401
- preparingAttachments: Hi.preparingCount,
1402
- onSaveTranscript: Vi,
1403
- onContinueInChat: da,
1441
+ attachments: na.attachments,
1442
+ onAttachFiles: na.addFiles,
1443
+ onRemoveAttachment: na.remove,
1444
+ onRetryAttachment: na.retry,
1445
+ canAttachMore: na.canAddMore,
1446
+ preparingAttachments: na.preparingCount,
1447
+ onSaveTranscript: ta,
1448
+ onContinueInChat: Da,
1404
1449
  onInterrupt: () => {
1405
- $.interrupt(), vi();
1450
+ $.interrupt(), Ei();
1406
1451
  },
1407
- spoken: Mi,
1452
+ spoken: Ki,
1408
1453
  onToggleMute: $.toggleMute,
1409
- onEnd: pa,
1410
- proposalChip: Qi ? {
1411
- label: Ze(Qi, P),
1412
- onOpen: Zi
1454
+ onEnd: ka,
1455
+ proposalChip: pa ? {
1456
+ label: Qe(pa, P),
1457
+ onOpen: fa
1413
1458
  } : null,
1414
- proposalTray: ea
1459
+ proposalTray: ha
1415
1460
  }),
1416
- /* @__PURE__ */ N(Dn, {
1417
- open: Xr !== null,
1418
- mode: ya,
1419
- currentMode: X ?? { id: H },
1420
- onConfirm: va,
1421
- onCancel: ba
1461
+ /* @__PURE__ */ M(Pn, {
1462
+ open: ri !== null,
1463
+ mode: Fa,
1464
+ currentMode: fi ?? { id: H },
1465
+ onConfirm: Pa,
1466
+ onCancel: Ia
1422
1467
  }),
1423
- /* @__PURE__ */ N(Nt, {
1424
- ...Tr.dialog,
1425
- view: zi?.view ?? Tr.dialog.view,
1426
- serverNow: zi?.serverNow ?? NaN,
1427
- arrivedAt: zi?.arrivedAt ?? NaN,
1428
- capabilities: zi ? Sr[zi.session.sandboxId] : null,
1429
- turnInFlight: K,
1468
+ /* @__PURE__ */ M(Pt, {
1469
+ ...jr.dialog,
1470
+ view: $i?.view ?? jr.dialog.view,
1471
+ serverNow: $i?.serverNow ?? NaN,
1472
+ arrivedAt: $i?.arrivedAt ?? NaN,
1473
+ capabilities: $i ? Or[$i.session.sandboxId] : null,
1474
+ turnInFlight: q,
1430
1475
  tr: P
1431
1476
  })
1432
1477
  ]
1433
1478
  });
1434
1479
  };
1435
1480
  //#endregion
1436
- export { Ln as AssistantChatArea };
1481
+ export { Wn as AssistantChatArea };