ChatView.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  1. <script setup lang="ts">
  2. import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'
  3. import { useRoute, useRouter } from 'vue-router'
  4. import AppIcon from '@/components/common/AppIcon.vue'
  5. import YaoYaoSidebarIcon from '@/components/common/YaoYaoSidebarIcon.vue'
  6. import type { ChoiceOption } from '@/components/common/types'
  7. import ComposerShell from '@/components/composer/ComposerShell.vue'
  8. import ModelChoiceDialog from '@/components/composer/ModelChoiceDialog.vue'
  9. import type { ComposerOption, ComposerReference, ComposerSubmit } from '@/components/composer/types'
  10. import PreviewInspector from '@/components/library/PreviewInspector.vue'
  11. import PreviewModal from '@/components/library/PreviewModal.vue'
  12. import ImagePreviewLightbox from '@/components/library/ImagePreviewLightbox.vue'
  13. import type { PreviewMedia } from '@/components/library/ImagePreviewLightbox.vue'
  14. import type { UiLibraryItem } from '@/components/library/types'
  15. import { mediaItemsFromMessages, mediaUrlIdentity, previewItemFromUrl } from '@/components/library/mediaSequence'
  16. import MessageTimeline from '@/components/messages/MessageTimeline.vue'
  17. import SessionOutline from '@/components/messages/SessionOutline.vue'
  18. import type { UiMessage } from '@/components/messages/types'
  19. import ResourceSidebar from '@/components/app/ResourceSidebar.vue'
  20. import FloatingResourceSearch from '@/components/app/FloatingResourceSearch.vue'
  21. import WorkspaceView from '@/components/workspace/WorkspaceView.vue'
  22. import { chatInteraction, chatMessagesToUi, sessionSidebarItem } from '@/components/workspace/viewModels'
  23. import { consumeLibraryItemForComposer, loadComposerFile } from '@/components/workspace/pendingComposer'
  24. import { readAgentShowThinking, writeAgentShowThinking } from '@/utils/sessionPreferences'
  25. import { modelChoiceId, modelForChoiceId } from '@/utils/sessionModel'
  26. import { MODEL_CATALOG_CHANGED_EVENT, modelCatalogChangedProfile } from '@/utils/modelCatalogEvents'
  27. import { estimateConversationTokens } from '@/utils/contextUsage'
  28. import { useAuthStore } from '@/stores/auth'
  29. import { useChatStore } from '@/stores/chat'
  30. import { getSession } from '@/api/sessions'
  31. const auth = useAuthStore()
  32. const chat = useChatStore()
  33. const route = useRoute()
  34. const router = useRouter()
  35. const quoted = ref<UiMessage | null>(null)
  36. const preview = ref<UiLibraryItem | null>(null)
  37. const filePreview = ref<UiLibraryItem | null>(null)
  38. const mediaPreviewIndex = ref<number | null>(null)
  39. const outlineOpen = ref(false)
  40. const modelDialog = ref(false)
  41. const modelSwitching = ref(false)
  42. const showThinking = ref(true)
  43. const queueMode = ref(false)
  44. const actionSessionId = ref('')
  45. const renaming = ref(false)
  46. const renameValue = ref('')
  47. const actionMenuPosition = ref({ x: 8, y: 8 })
  48. const composer = ref<InstanceType<typeof ComposerShell> | null>(null)
  49. const timeline = ref<InstanceType<typeof MessageTimeline> | null>(null)
  50. const headerSessionMenuButton = ref<HTMLButtonElement | null>(null)
  51. const restoringRouteProfile = ref('')
  52. let modelSyncTimer: number | undefined
  53. function handleModelCatalogChanged(event: Event) {
  54. const profile = modelCatalogChangedProfile(event)
  55. if (profile && profile === auth.activeProfile?.name) void chat.loadModels(profile).catch(() => undefined)
  56. }
  57. const sessions = computed(() => [...chat.sessions]
  58. .filter(session => !['cron', 'ios_group'].includes(session.source)))
  59. const agentNames = computed(() => new Map(auth.profiles.map(profile => [
  60. profile.name,
  61. profile.agentName || profile.displayName || profile.name,
  62. ])))
  63. const agentAvatars = computed(() => Object.fromEntries(auth.profiles.flatMap(profile =>
  64. profile.agentAvatar ? [[profile.name, profile.agentAvatar] as const] : []
  65. )))
  66. const sidebarItems = computed(() => sessions.value.map(session => sessionSidebarItem(
  67. session,
  68. chat.unreadCounts[session.id] ?? 0,
  69. agentNames.value.get(session.profile || auth.activeProfile?.name || ''),
  70. )))
  71. const messages = computed(() => chatMessagesToUi(chat.messages, profile => profile ? agentNames.value.get(profile) : undefined))
  72. const reportedContextTokens = computed(() => chat.contextUsage?.contextTokens
  73. || chat.contextUsage?.totalTokens
  74. || (activeSession.value?.inputTokens ?? 0) + (activeSession.value?.outputTokens ?? 0))
  75. const estimatedContextTokens = computed(() => estimateConversationTokens(chat.messages))
  76. const contextUsed = computed(() => reportedContextTokens.value || estimatedContextTokens.value)
  77. const contextIsEstimated = computed(() => !reportedContextTokens.value && contextUsed.value > 0)
  78. const conversationMediaItems = computed(() => mediaItemsFromMessages(messages.value))
  79. const lightboxMedia = computed(() => conversationMediaItems.value.map(item => ({ url: item.previewUrl || item.downloadUrl || '', name: item.name, type: item.kind as 'image' | 'video' })).filter(item => item.url))
  80. const activeSession = computed(() => chat.activeSession)
  81. const actionSession = computed(() => chat.sessions.find(session => session.id === actionSessionId.value))
  82. const connected = computed(() => ['connected', 'ready'].includes(chat.connectionState))
  83. const interaction = computed(() => chatInteraction(chat.pendingApproval, chat.pendingClarification))
  84. const reference = computed<ComposerReference | null>(() => quoted.value ? { id: quoted.value.id, content: quoted.value.content, author: quoted.value.author } : null)
  85. const forkSourceTitle = computed(() => {
  86. const parentId = activeSession.value?.parentSessionId
  87. if (!parentId) return ''
  88. return chat.sessions.find(session => session.id === parentId && session.profile === activeSession.value?.profile)?.title || parentId
  89. })
  90. const selectedModelId = computed(() => chat.selectedModel ? modelChoiceId(chat.selectedModel) : '')
  91. const reasoningOptions: ChoiceOption[] = [
  92. { id: '', label: '默认', description: '使用模型或 Profile 的默认强度' },
  93. { id: 'none', label: '关闭', description: '不使用额外推理' },
  94. { id: 'low', label: '低', description: '更快的轻量推理' },
  95. { id: 'medium', label: '中', description: '速度与深度平衡' },
  96. { id: 'high', label: '高', description: '更深入地分析复杂问题' },
  97. { id: 'xhigh', label: '极高', description: '适用于最复杂的任务' },
  98. ]
  99. const reasoningComposerOptions = computed<ComposerOption[]>(() => reasoningOptions.map(option => ({
  100. id: option.id,
  101. label: option.label,
  102. detail: option.description,
  103. })))
  104. const reasoningLabel = computed(() => reasoningOptions.find(option => option.id === (chat.reasoningEffort || ''))?.label || '默认')
  105. const actionMenuStyle = computed(() => ({ left: `${actionMenuPosition.value.x}px`, top: `${actionMenuPosition.value.y}px` }))
  106. function routeProfile(): string {
  107. const value = typeof route.query.profile === 'string' ? route.query.profile : ''
  108. return auth.profiles.some(profile => profile.name === value) ? value : ''
  109. }
  110. function sessionLocation(id: string, profile: string) {
  111. return { path: `/chat/${encodeURIComponent(id)}`, query: { profile } }
  112. }
  113. async function findLegacySessionProfile(sessionId: string): Promise<string> {
  114. for (const profile of auth.profiles) {
  115. try {
  116. const session = await getSession(sessionId, profile.name)
  117. if (session.id === sessionId) return profile.name
  118. } catch { /* Try the next profile: 9119 returns 404 for a foreign session. */ }
  119. }
  120. return auth.activeProfile?.name || ''
  121. }
  122. async function ensureRouteProfile(profile: string): Promise<void> {
  123. if (!profile || auth.activeProfile?.name === profile) return
  124. chat.switchProfile(profile)
  125. restoringRouteProfile.value = profile
  126. auth.selectProfile(profile)
  127. await nextTick()
  128. }
  129. async function refreshSessions() {
  130. const requestedId = typeof route.params.sessionId === 'string' ? route.params.sessionId : ''
  131. const profile = routeProfile() || (requestedId ? await findLegacySessionProfile(requestedId) : auth.activeProfile?.name || '')
  132. if (profile && auth.activeProfile?.name !== profile) {
  133. if (requestedId) await router.replace(sessionLocation(requestedId, profile))
  134. await ensureRouteProfile(profile)
  135. }
  136. // The session route is the authoritative navigation target. A secondary
  137. // unread-count request must never prevent its history from being restored.
  138. await chat.loadSessions(profile)
  139. if (requestedId && chat.activeSessionId !== requestedId) await chat.selectSession(requestedId, profile)
  140. if (requestedId && profile && routeProfile() !== profile) await router.replace(sessionLocation(requestedId, profile))
  141. void chat.loadUnread(profile).catch(() => undefined)
  142. }
  143. async function chooseSession(id: string) {
  144. outlineOpen.value = false
  145. preview.value = null
  146. const session = chat.sessions.find(item => item.id === id)
  147. const profile = session?.profile || auth.activeProfile?.name || 'default'
  148. await router.push(sessionLocation(id, profile))
  149. await ensureRouteProfile(profile)
  150. if (chat.activeProfileName !== profile) await chat.loadSessions(profile)
  151. await chat.selectSession(id, profile)
  152. await chat.markRead(id, profile).catch(() => undefined)
  153. quoted.value = null
  154. }
  155. async function createSession() {
  156. outlineOpen.value = false
  157. preview.value = null
  158. const id = chat.createSession(auth.activeProfile?.name)
  159. await router.push(sessionLocation(id, auth.activeProfile?.name || 'default'))
  160. }
  161. async function send(payload: ComposerSubmit) {
  162. try {
  163. await chat.send(payload.text, payload.files, queueMode.value ? 'queue' : chat.isStreaming ? 'steer' : 'submit')
  164. composer.value?.clearAfterSend()
  165. } catch { /* store exposes the error and the composer keeps its draft */ }
  166. }
  167. function openAttachment(attachment: NonNullable<UiMessage['attachments']>[number]) {
  168. const item = previewItemFromUrl(attachment.name, attachment.url || '', attachment.id, attachment.kind)
  169. item.size = attachment.size
  170. if (item.kind === 'image' || item.kind === 'video') openMedia(item)
  171. else { outlineOpen.value = false; preview.value = null; filePreview.value = item }
  172. }
  173. function openMedia(item: UiLibraryItem) {
  174. const target = mediaUrlIdentity(item.previewUrl || item.downloadUrl || '')
  175. const index = lightboxMedia.value.findIndex(media => mediaUrlIdentity(media.url) === target)
  176. mediaPreviewIndex.value = index >= 0 ? index : null
  177. }
  178. function openLocalFile({ name, url }: { name: string; url: string }) {
  179. const item = previewItemFromUrl(name, url)
  180. if (item.kind === 'image' || item.kind === 'video') openMedia(item)
  181. else { outlineOpen.value = false; filePreview.value = item }
  182. }
  183. async function addPreviewToComposer(item: UiLibraryItem) {
  184. const file = await loadComposerFile(item)
  185. if (!file || !composer.value) return
  186. composer.value.attachFiles([file])
  187. preview.value = null
  188. filePreview.value = null
  189. mediaPreviewIndex.value = null
  190. await nextTick()
  191. composer.value?.focus()
  192. }
  193. async function addMediaToComposer(media: PreviewMedia) {
  194. await addPreviewToComposer(previewItemFromUrl(media.name, media.url, `preview:${media.url}`, media.type))
  195. }
  196. async function selectModel(id: string) {
  197. if (id === selectedModelId.value) {
  198. modelDialog.value = false
  199. return
  200. }
  201. const model = modelForChoiceId(chat.models, id)
  202. if (!model || modelSwitching.value) return
  203. modelSwitching.value = true
  204. try {
  205. await chat.setModel(model)
  206. modelDialog.value = false
  207. } finally {
  208. modelSwitching.value = false
  209. }
  210. }
  211. function selectReasoning(id: string) {
  212. chat.reasoningEffort = id || undefined
  213. }
  214. async function toggleFastMode(enabled: boolean) {
  215. try { await chat.setFastMode(enabled) } catch { /* store restores the acknowledged state */ }
  216. }
  217. function restoreShowThinking(profile = auth.activeProfile?.name || 'default') {
  218. showThinking.value = readAgentShowThinking(auth.user?.id ?? 'local', profile)
  219. }
  220. function toggleShowThinking() {
  221. showThinking.value = !showThinking.value
  222. writeAgentShowThinking(auth.user?.id ?? 'local', auth.activeProfile?.name || 'default', showThinking.value)
  223. }
  224. function openSessionActions(id: string, event?: MouseEvent) {
  225. actionSessionId.value = id
  226. const session = chat.sessions.find(item => item.id === id)
  227. renameValue.value = session?.title || ''
  228. renaming.value = false
  229. const menuWidth = 208
  230. const menuHeight = 176
  231. const inset = 8
  232. const anchor = event?.currentTarget instanceof HTMLElement ? event.currentTarget.getBoundingClientRect() : null
  233. const requestedX = event?.type === 'contextmenu' ? event.clientX : anchor ? anchor.right - menuWidth : window.innerWidth - menuWidth - 14
  234. const requestedY = event?.type === 'contextmenu' ? event.clientY : anchor ? anchor.bottom + 5 : 46
  235. actionMenuPosition.value = {
  236. x: Math.max(inset, Math.min(requestedX, window.innerWidth - menuWidth - inset)),
  237. y: Math.max(inset, Math.min(requestedY, window.innerHeight - menuHeight - inset)),
  238. }
  239. }
  240. function closeSessionActions() {
  241. actionSessionId.value = ''
  242. renaming.value = false
  243. }
  244. function handleSessionActionPointer(event: PointerEvent) {
  245. if (!actionSessionId.value || (event.target as HTMLElement).closest('.session-actions')) return
  246. closeSessionActions()
  247. }
  248. function handleSessionActionKey(event: KeyboardEvent) {
  249. if (event.key === 'Escape' && actionSessionId.value) closeSessionActions()
  250. }
  251. async function saveRename() {
  252. const session = chat.sessions.find(item => item.id === actionSessionId.value)
  253. if (!session || !renameValue.value.trim()) return
  254. await chat.renameSession(session.id, renameValue.value.trim(), session.profile)
  255. closeSessionActions()
  256. }
  257. async function toggleSessionPinned() {
  258. const session = actionSession.value
  259. if (!session) return
  260. await chat.setSessionPinned(session.id, !session.pinned, session.profile)
  261. closeSessionActions()
  262. }
  263. async function openSessionOutline() {
  264. const session = actionSession.value
  265. if (!session) return
  266. closeSessionActions()
  267. if (session.id !== chat.activeSessionId || session.profile !== chat.activeProfileName) await chooseSession(session.id)
  268. preview.value = null
  269. outlineOpen.value = true
  270. }
  271. function closeInspector() {
  272. const restoreMenuFocus = outlineOpen.value
  273. preview.value = null
  274. outlineOpen.value = false
  275. if (restoreMenuFocus) void nextTick(() => headerSessionMenuButton.value?.focus())
  276. }
  277. function navigateOutline(target: { messageId: string; anchorId: string }) {
  278. timeline.value?.scrollToAnchor(target.messageId, target.anchorId)
  279. if (window.matchMedia('(max-width: 900px)').matches) closeInspector()
  280. }
  281. async function deleteSession() {
  282. const session = chat.sessions.find(item => item.id === actionSessionId.value)
  283. if (!session) return
  284. await chat.removeSession(session.id, session.profile)
  285. closeSessionActions()
  286. if (route.params.sessionId === session.id) await router.replace('/chat')
  287. }
  288. async function branch() {
  289. const id = await chat.branchSession()
  290. if (id) await router.push(sessionLocation(id, chat.activeProfileName || auth.activeProfile?.name || 'default'))
  291. }
  292. async function revealSourceMessage() {
  293. const messageId = typeof route.query.message === 'string' ? route.query.message : ''
  294. if (!messageId) return
  295. await nextTick()
  296. for (let attempt = 0; attempt < 10; attempt += 1) {
  297. if (timeline.value?.scrollToMessage(messageId)) return
  298. if (!chat.hasMoreBefore) return
  299. await chat.loadOlder()
  300. await nextTick()
  301. }
  302. }
  303. onMounted(async () => {
  304. restoreShowThinking()
  305. document.addEventListener('pointerdown', handleSessionActionPointer)
  306. document.addEventListener('keydown', handleSessionActionKey)
  307. window.addEventListener(MODEL_CATALOG_CHANGED_EVENT, handleModelCatalogChanged)
  308. await refreshSessions()
  309. await revealSourceMessage()
  310. })
  311. onBeforeUnmount(() => {
  312. document.removeEventListener('pointerdown', handleSessionActionPointer)
  313. document.removeEventListener('keydown', handleSessionActionKey)
  314. window.removeEventListener(MODEL_CATALOG_CHANGED_EVENT, handleModelCatalogChanged)
  315. if (modelSyncTimer !== undefined) window.clearInterval(modelSyncTimer)
  316. })
  317. watch(() => auth.activeProfile?.name, async (profile, previous) => {
  318. if (!profile || profile === previous) return
  319. restoreShowThinking(profile)
  320. outlineOpen.value = false
  321. preview.value = null
  322. if (restoringRouteProfile.value === profile) {
  323. restoringRouteProfile.value = ''
  324. return
  325. }
  326. chat.switchProfile(profile)
  327. const requestedId = typeof route.params.sessionId === 'string' ? route.params.sessionId : ''
  328. if (requestedId && routeProfile() === profile) {
  329. await Promise.allSettled([chat.loadSessions(profile), chat.loadUnread(profile)])
  330. await chat.selectSession(requestedId, profile)
  331. return
  332. }
  333. await router.replace({ path: '/chat', query: { profile } })
  334. await Promise.allSettled([chat.loadSessions(profile), chat.loadUnread(profile)])
  335. })
  336. watch(() => chat.activeSessionId, async id => {
  337. const profile = chat.activeProfileName || auth.activeProfile?.name || ''
  338. if (!id || (route.params.sessionId === id && routeProfile() === profile)) return
  339. await router.replace(sessionLocation(id, profile))
  340. })
  341. </script>
  342. <template>
  343. <WorkspaceView sidebar-title="历史记录" :sidebar-subtitle="`${sessions.length} 个会话`" :inspector-open="!!preview || outlineOpen" :inspector-close-label="outlineOpen ? '关闭会话大纲' : '关闭预览'" @close-inspector="closeInspector">
  344. <template #sidebar>
  345. <ResourceSidebar
  346. :items="sidebarItems"
  347. :active-id="chat.activeSessionId"
  348. :loading="chat.isLoading"
  349. external-search
  350. single-line
  351. :has-more="chat.hasMoreSessions"
  352. :loading-more="chat.isLoadingMoreSessions"
  353. search-placeholder="搜索会话"
  354. empty-title="还没有历史会话"
  355. empty-description="Hermes 会话会在这里以只读历史显示。"
  356. @load-more="chat.loadMoreSessions(auth.activeProfile?.name)"
  357. @select="chooseSession"
  358. @more="openSessionActions"
  359. @context-menu="openSessionActions"
  360. />
  361. </template>
  362. <div class="chat-workspace">
  363. <MessageTimeline
  364. ref="timeline"
  365. :messages="messages"
  366. :title="activeSession?.title || '历史记录'"
  367. :subtitle="activeSession ? `${activeSession.profile || auth.activeProfile?.name || ''} · ${activeSession.model || '默认模型'}` : '选择左侧会话查看历史'"
  368. :loading="chat.activeRouteState?.isLoadingHistory || chat.isLoading"
  369. :loading-older="chat.activeRouteState?.isLoadingHistory"
  370. :has-older="chat.hasMoreBefore"
  371. :connected="false"
  372. :synced="chat.historySynced"
  373. :show-tools="showThinking"
  374. :thinking="false"
  375. :show-assistant-identity="false"
  376. :agent-avatars="agentAvatars"
  377. :allow-branch="false"
  378. read-only
  379. empty-logo
  380. transparent-header
  381. @load-older="chat.loadOlder"
  382. @preview="openAttachment"
  383. @preview-file="openLocalFile"
  384. >
  385. <template #header-actions>
  386. <button v-if="activeSession" ref="headerSessionMenuButton" class="icon-button header-session-menu" type="button" title="会话操作" aria-label="会话操作" @click="openSessionActions(activeSession.id, $event)"><AppIcon name="dots" :size="18" /></button>
  387. </template>
  388. </MessageTimeline>
  389. <p v-if="chat.error" class="chat-error" role="alert"><AppIcon name="alert" :size="13" />{{ chat.error }}</p>
  390. </div>
  391. <template #inspector>
  392. <SessionOutline v-if="outlineOpen" :messages="messages" :has-older="chat.hasMoreBefore" @navigate="navigateOutline" />
  393. <PreviewInspector v-else-if="preview" :item="preview" :can-add-to-composer="false" @close="preview = null" />
  394. </template>
  395. </WorkspaceView>
  396. <FloatingResourceSearch section="chat" label="搜索会话" :items="sidebarItems" @select="chooseSession" />
  397. <PreviewModal v-if="filePreview" :item="filePreview" :items="conversationMediaItems" :can-add-to-composer="false" @close="filePreview = null" @source="filePreview = null" />
  398. <ImagePreviewLightbox v-model="mediaPreviewIndex" :images="lightboxMedia" :can-add="false" />
  399. <Teleport to="body">
  400. <Transition name="session-menu">
  401. <section v-if="actionSessionId" class="session-actions" :style="actionMenuStyle" role="menu" aria-label="会话操作" @contextmenu.prevent>
  402. <button class="action-row" role="menuitem" type="button" @click="openSessionOutline"><AppIcon name="menu" :size="14" />会话大纲</button>
  403. </section>
  404. </Transition>
  405. </Teleport>
  406. </template>
  407. <style scoped>
  408. .chat-workspace { display: flex; min-width: 0; min-height: 0; flex: 1; flex-direction: column; }
  409. .sidebar-primary-action { display: flex; width: 100%; min-height: 40px; align-items: center; gap: 10px; padding: 0 11px; border: 0; border-radius: 9px; background: transparent; color: var(--text-primary); cursor: pointer; font-size: 12px; font-weight: 610; text-align: left; transition: background-color 120ms ease; }
  410. .sidebar-primary-action:hover, .sidebar-primary-action:focus-visible { background: var(--surface-hover); outline: 0; }
  411. .sidebar-primary-action:focus-visible { box-shadow: inset 0 0 0 1px var(--line-strong); }
  412. .header-session-menu { color: var(--text-muted); background: transparent; }.header-session-menu:hover { color: var(--text-primary); background: var(--surface-soft); }
  413. .chat-error { display: flex; width: min(760px, calc(100% - 32px)); margin: 0 auto 4px; align-items: center; gap: 6px; color: var(--danger); font-size: 9px; }
  414. .session-actions { position: fixed; z-index: 205; width: 208px; box-sizing: border-box; padding: 6px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-raised); box-shadow: 0 12px 34px rgba(0,0,0,.16); }.action-row { display: flex; width: 100%; min-height: 34px; align-items: center; gap: 8px; padding: 0 9px; border: 0; border-radius: 7px; background: transparent; color: var(--text-secondary); cursor: pointer; font-size: 11px; text-align: left; }.action-row:hover, .action-row:focus-visible { outline: 0; background: var(--surface-soft); color: var(--text-primary); }.action-row.danger { color: var(--danger); }.session-actions label { display: flex; flex-direction: column; gap: 6px; padding: 4px; color: var(--text-muted); font-size: 9px; }.session-actions input { width: 100%; height: 32px; box-sizing: border-box; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; outline: 0; background: var(--surface-soft); color: var(--text-primary); font-size: 11px; }.session-actions input:focus { border-color: var(--line-strong); box-shadow: 0 0 0 3px var(--focus-ring); }.session-actions > div { display: flex; justify-content: flex-end; gap: 5px; margin-top: 7px; padding: 0 4px 3px; }.session-actions :deep(.quiet-button), .session-actions :deep(.solid-button) { min-height: 29px; padding-inline: 10px; font-size: 10px; }
  415. .session-menu-enter-active, .session-menu-leave-active { transition: opacity 100ms ease, transform 120ms var(--ease-out); transform-origin: top right; }.session-menu-enter-from, .session-menu-leave-to { opacity: 0; transform: translateY(-3px) scale(.98); }
  416. @media (prefers-reduced-motion: reduce) { .sidebar-primary-action, .session-menu-enter-active, .session-menu-leave-active { transition: none; } }
  417. </style>