HistoryView.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468
  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', 'yaoyao_workspace', 'web'].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: `/history/${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, 'history')
  139. if (requestedId) {
  140. const target = await getSession(requestedId, profile).catch(() => undefined)
  141. if (target?.source === 'web') {
  142. await router.replace({ path: `/chat/${encodeURIComponent(requestedId)}`, query: { profile } })
  143. return
  144. }
  145. }
  146. if (requestedId && chat.activeSessionId !== requestedId) await chat.selectSession(requestedId, profile)
  147. if (requestedId && profile && routeProfile() !== profile) await router.replace(sessionLocation(requestedId, profile))
  148. void chat.loadUnread(profile).catch(() => undefined)
  149. if (!requestedId && chat.activeSession?.source === 'web') chat.clearSelection()
  150. }
  151. async function chooseSession(id: string) {
  152. outlineOpen.value = false
  153. preview.value = null
  154. const session = chat.sessions.find(item => item.id === id)
  155. const profile = session?.profile || auth.activeProfile?.name || 'default'
  156. await router.push(sessionLocation(id, profile))
  157. await ensureRouteProfile(profile)
  158. if (chat.activeProfileName !== profile) await chat.loadSessions(profile, 'history')
  159. await chat.selectSession(id, profile)
  160. await chat.markRead(id, profile).catch(() => undefined)
  161. quoted.value = null
  162. }
  163. async function createSession() {
  164. outlineOpen.value = false
  165. preview.value = null
  166. const id = chat.createSession(auth.activeProfile?.name)
  167. await router.push(sessionLocation(id, auth.activeProfile?.name || 'default'))
  168. }
  169. async function send(payload: ComposerSubmit) {
  170. try {
  171. await chat.send(payload.text, payload.files, queueMode.value ? 'queue' : chat.isStreaming ? 'steer' : 'submit')
  172. composer.value?.clearAfterSend()
  173. } catch { /* store exposes the error and the composer keeps its draft */ }
  174. }
  175. function openAttachment(attachment: NonNullable<UiMessage['attachments']>[number]) {
  176. const item = previewItemFromUrl(attachment.name, attachment.url || '', attachment.id, attachment.kind)
  177. item.size = attachment.size
  178. if (item.kind === 'image' || item.kind === 'video') openMedia(item)
  179. else { outlineOpen.value = false; preview.value = null; filePreview.value = item }
  180. }
  181. function openMedia(item: UiLibraryItem) {
  182. const target = mediaUrlIdentity(item.previewUrl || item.downloadUrl || '')
  183. const index = lightboxMedia.value.findIndex(media => mediaUrlIdentity(media.url) === target)
  184. mediaPreviewIndex.value = index >= 0 ? index : null
  185. }
  186. function openLocalFile({ name, url }: { name: string; url: string }) {
  187. const item = previewItemFromUrl(name, url)
  188. if (item.kind === 'image' || item.kind === 'video') openMedia(item)
  189. else { outlineOpen.value = false; filePreview.value = item }
  190. }
  191. async function addPreviewToComposer(item: UiLibraryItem) {
  192. const file = await loadComposerFile(item)
  193. if (!file || !composer.value) return
  194. composer.value.attachFiles([file])
  195. preview.value = null
  196. filePreview.value = null
  197. mediaPreviewIndex.value = null
  198. await nextTick()
  199. composer.value?.focus()
  200. }
  201. async function addMediaToComposer(media: PreviewMedia) {
  202. await addPreviewToComposer(previewItemFromUrl(media.name, media.url, `preview:${media.url}`, media.type))
  203. }
  204. async function selectModel(id: string) {
  205. if (id === selectedModelId.value) {
  206. modelDialog.value = false
  207. return
  208. }
  209. const model = modelForChoiceId(chat.models, id)
  210. if (!model || modelSwitching.value) return
  211. modelSwitching.value = true
  212. try {
  213. await chat.setModel(model)
  214. modelDialog.value = false
  215. } finally {
  216. modelSwitching.value = false
  217. }
  218. }
  219. function selectReasoning(id: string) {
  220. chat.reasoningEffort = id || undefined
  221. }
  222. async function toggleFastMode(enabled: boolean) {
  223. try { await chat.setFastMode(enabled) } catch { /* store restores the acknowledged state */ }
  224. }
  225. function restoreShowThinking(profile = auth.activeProfile?.name || 'default') {
  226. showThinking.value = readAgentShowThinking(auth.user?.id ?? 'local', profile)
  227. }
  228. function toggleShowThinking() {
  229. showThinking.value = !showThinking.value
  230. writeAgentShowThinking(auth.user?.id ?? 'local', auth.activeProfile?.name || 'default', showThinking.value)
  231. }
  232. function openSessionActions(id: string, event?: MouseEvent) {
  233. actionSessionId.value = id
  234. const session = chat.sessions.find(item => item.id === id)
  235. renameValue.value = session?.title || ''
  236. renaming.value = false
  237. const menuWidth = 208
  238. const menuHeight = 176
  239. const inset = 8
  240. const anchor = event?.currentTarget instanceof HTMLElement ? event.currentTarget.getBoundingClientRect() : null
  241. const requestedX = event?.type === 'contextmenu' ? event.clientX : anchor ? anchor.right - menuWidth : window.innerWidth - menuWidth - 14
  242. const requestedY = event?.type === 'contextmenu' ? event.clientY : anchor ? anchor.bottom + 5 : 46
  243. actionMenuPosition.value = {
  244. x: Math.max(inset, Math.min(requestedX, window.innerWidth - menuWidth - inset)),
  245. y: Math.max(inset, Math.min(requestedY, window.innerHeight - menuHeight - inset)),
  246. }
  247. }
  248. function closeSessionActions() {
  249. actionSessionId.value = ''
  250. renaming.value = false
  251. }
  252. function handleSessionActionPointer(event: PointerEvent) {
  253. if (!actionSessionId.value || (event.target as HTMLElement).closest('.session-actions')) return
  254. closeSessionActions()
  255. }
  256. function handleSessionActionKey(event: KeyboardEvent) {
  257. if (event.key === 'Escape' && actionSessionId.value) closeSessionActions()
  258. }
  259. async function saveRename() {
  260. const session = chat.sessions.find(item => item.id === actionSessionId.value)
  261. if (!session || !renameValue.value.trim()) return
  262. await chat.renameSession(session.id, renameValue.value.trim(), session.profile)
  263. closeSessionActions()
  264. }
  265. async function toggleSessionPinned() {
  266. const session = actionSession.value
  267. if (!session) return
  268. await chat.setSessionPinned(session.id, !session.pinned, session.profile)
  269. closeSessionActions()
  270. }
  271. async function openSessionOutline() {
  272. const session = actionSession.value
  273. if (!session) return
  274. closeSessionActions()
  275. if (session.id !== chat.activeSessionId || session.profile !== chat.activeProfileName) await chooseSession(session.id)
  276. preview.value = null
  277. outlineOpen.value = true
  278. }
  279. function closeInspector() {
  280. const restoreMenuFocus = outlineOpen.value
  281. preview.value = null
  282. outlineOpen.value = false
  283. if (restoreMenuFocus) void nextTick(() => headerSessionMenuButton.value?.focus())
  284. }
  285. function navigateOutline(target: { messageId: string; anchorId: string }) {
  286. timeline.value?.scrollToAnchor(target.messageId, target.anchorId)
  287. if (window.matchMedia('(max-width: 900px)').matches) closeInspector()
  288. }
  289. async function deleteSession() {
  290. const session = chat.sessions.find(item => item.id === actionSessionId.value)
  291. if (!session) return
  292. await chat.removeSession(session.id, session.profile)
  293. closeSessionActions()
  294. if (route.params.sessionId === session.id) await router.replace('/chat')
  295. }
  296. async function branch() {
  297. const id = await chat.branchSession()
  298. if (id) await router.push(sessionLocation(id, chat.activeProfileName || auth.activeProfile?.name || 'default'))
  299. }
  300. async function revealSourceMessage() {
  301. const messageId = typeof route.query.message === 'string' ? route.query.message : ''
  302. if (!messageId) return
  303. await nextTick()
  304. for (let attempt = 0; attempt < 10; attempt += 1) {
  305. if (timeline.value?.scrollToMessage(messageId)) return
  306. if (!chat.hasMoreBefore) return
  307. await chat.loadOlder()
  308. await nextTick()
  309. }
  310. }
  311. onMounted(async () => {
  312. restoreShowThinking()
  313. document.addEventListener('pointerdown', handleSessionActionPointer)
  314. document.addEventListener('keydown', handleSessionActionKey)
  315. window.addEventListener(MODEL_CATALOG_CHANGED_EVENT, handleModelCatalogChanged)
  316. await refreshSessions()
  317. await revealSourceMessage()
  318. })
  319. onBeforeUnmount(() => {
  320. document.removeEventListener('pointerdown', handleSessionActionPointer)
  321. document.removeEventListener('keydown', handleSessionActionKey)
  322. window.removeEventListener(MODEL_CATALOG_CHANGED_EVENT, handleModelCatalogChanged)
  323. if (modelSyncTimer !== undefined) window.clearInterval(modelSyncTimer)
  324. })
  325. watch(() => auth.activeProfile?.name, async (profile, previous) => {
  326. if (!profile || profile === previous) return
  327. restoreShowThinking(profile)
  328. outlineOpen.value = false
  329. preview.value = null
  330. if (restoringRouteProfile.value === profile) {
  331. restoringRouteProfile.value = ''
  332. return
  333. }
  334. chat.switchProfile(profile)
  335. const requestedId = typeof route.params.sessionId === 'string' ? route.params.sessionId : ''
  336. if (requestedId && routeProfile() === profile) {
  337. await Promise.allSettled([chat.loadSessions(profile, 'history'), chat.loadUnread(profile)])
  338. await chat.selectSession(requestedId, profile)
  339. return
  340. }
  341. await router.replace({ path: '/history', query: { profile } })
  342. await Promise.allSettled([chat.loadSessions(profile, 'history'), chat.loadUnread(profile)])
  343. })
  344. watch(() => chat.activeSessionId, async id => {
  345. const profile = chat.activeProfileName || auth.activeProfile?.name || ''
  346. if (!id || (route.params.sessionId === id && routeProfile() === profile)) return
  347. await router.replace(sessionLocation(id, profile))
  348. })
  349. </script>
  350. <template>
  351. <WorkspaceView sidebar-title="历史记录" :sidebar-subtitle="`${sessions.length} 个会话`" :inspector-open="!!preview || outlineOpen" :inspector-close-label="outlineOpen ? '关闭会话大纲' : '关闭预览'" @close-inspector="closeInspector">
  352. <template #sidebar>
  353. <ResourceSidebar
  354. :items="sidebarItems"
  355. :active-id="chat.activeSessionId"
  356. :loading="chat.isLoading"
  357. external-search
  358. single-line
  359. :has-more="chat.hasMoreSessions"
  360. :loading-more="chat.isLoadingMoreSessions"
  361. search-placeholder="搜索会话"
  362. empty-title="还没有历史会话"
  363. empty-description="Hermes 会话会在这里以只读历史显示。"
  364. @load-more="chat.loadMoreSessions(auth.activeProfile?.name)"
  365. @select="chooseSession"
  366. @more="openSessionActions"
  367. @context-menu="openSessionActions"
  368. />
  369. </template>
  370. <div class="chat-workspace">
  371. <MessageTimeline
  372. ref="timeline"
  373. :messages="messages"
  374. :title="activeSession?.title || '历史记录'"
  375. :subtitle="activeSession ? `${activeSession.profile || auth.activeProfile?.name || ''} · ${activeSession.model || '默认模型'}` : '选择左侧会话查看历史'"
  376. :loading="chat.activeRouteState?.isLoadingHistory || chat.isLoading"
  377. :loading-older="chat.activeRouteState?.isLoadingHistory"
  378. :has-older="chat.hasMoreBefore"
  379. :connected="false"
  380. :synced="chat.historySynced"
  381. :show-tools="showThinking"
  382. :thinking="false"
  383. :show-assistant-identity="false"
  384. :agent-avatars="agentAvatars"
  385. :allow-branch="false"
  386. read-only
  387. empty-logo
  388. transparent-header
  389. @load-older="chat.loadOlder"
  390. @preview="openAttachment"
  391. @preview-file="openLocalFile"
  392. >
  393. <template #header-actions>
  394. <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>
  395. </template>
  396. </MessageTimeline>
  397. <p v-if="chat.error" class="chat-error" role="alert"><AppIcon name="alert" :size="13" />{{ chat.error }}</p>
  398. </div>
  399. <template #inspector>
  400. <SessionOutline v-if="outlineOpen" :messages="messages" :has-older="chat.hasMoreBefore" @navigate="navigateOutline" />
  401. <PreviewInspector v-else-if="preview" :item="preview" :can-add-to-composer="false" @close="preview = null" />
  402. </template>
  403. </WorkspaceView>
  404. <FloatingResourceSearch section="chat" label="搜索会话" :items="sidebarItems" @select="chooseSession" />
  405. <PreviewModal v-if="filePreview" :item="filePreview" :items="conversationMediaItems" :can-add-to-composer="false" @close="filePreview = null" @source="filePreview = null" />
  406. <ImagePreviewLightbox v-model="mediaPreviewIndex" :images="lightboxMedia" :can-add="false" />
  407. <Teleport to="body">
  408. <Transition name="session-menu">
  409. <section v-if="actionSessionId" class="session-actions" :style="actionMenuStyle" role="menu" aria-label="会话操作" @contextmenu.prevent>
  410. <button class="action-row" role="menuitem" type="button" @click="openSessionOutline"><AppIcon name="menu" :size="14" />会话大纲</button>
  411. </section>
  412. </Transition>
  413. </Teleport>
  414. </template>
  415. <style scoped>
  416. .chat-workspace { display: flex; min-width: 0; min-height: 0; flex: 1; flex-direction: column; }
  417. .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; }
  418. .sidebar-primary-action:hover, .sidebar-primary-action:focus-visible { background: var(--surface-hover); outline: 0; }
  419. .sidebar-primary-action:focus-visible { box-shadow: inset 0 0 0 1px var(--line-strong); }
  420. .header-session-menu { color: var(--text-muted); background: transparent; }.header-session-menu:hover { color: var(--text-primary); background: var(--surface-soft); }
  421. .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; }
  422. .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; }
  423. .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); }
  424. @media (prefers-reduced-motion: reduce) { .sidebar-primary-action, .session-menu-enter-active, .session-menu-leave-active { transition: none; } }
  425. </style>