Skip to content

The agent that grows with you

feat(desktop): search inside log tails with next/prev and severity marks

Brooklyn Nicholson1b91b8eaa576
diff --git a/apps/desktop/src/app/capabilities/mcp/mcp-editor.tsx b/apps/desktop/src/app/capabilities/mcp/mcp-editor.tsx
index 1395d8d8925..c4c8ea573d4 100644
--- a/apps/desktop/src/app/capabilities/mcp/mcp-editor.tsx
+++ b/apps/desktop/src/app/capabilities/mcp/mcp-editor.tsx
@@ -1,6 +1,8 @@
import { useState } from 'react'
import { JsonDocumentEditor } from '@/components/chat/json-document-editor'
+import { LogSearchField, useLogSearch } from '@/components/chat/log-search'
+import { LogTail } from '@/components/chat/log-tail'
import { Button } from '@/components/ui/button'
import { TextTab } from '@/components/ui/text-tab'
import { useI18n } from '@/i18n'
@@ -8,7 +10,7 @@ import { notifyError } from '@/store/notifications'
import { DetailPane } from '../../master-detail'
-import { McpLogs, type McpLogSource } from './mcp-logs'
+import { type McpLogSource, useMcpLogLines } from './mcp-logs'
import type { McpServersController } from './use-mcp-servers'
export interface McpJsonEditorProps {
@@ -60,11 +62,21 @@ export function McpLogPane({ server }: McpLogPaneProps) {
const { t } = useI18n()
const m = t.settings.mcp
const [source, setSource] = useState<McpLogSource>('stdio')
+ const [query, setQuery] = useState('')
+ const lines = useMcpLogLines(server, source)
+ const search = useLogSearch(lines, query)
return (
<DetailPane
actions={
<span className="flex items-center gap-1.5">
+ <LogSearchField
+ containerClassName="mr-1 w-36"
+ onChange={setQuery}
+ placeholder={t.ui.logs.search}
+ search={search}
+ value={query}
+ />
{(['stdio', 'agent'] as const).map(kind => (
<TextTab
active={source === kind}
@@ -81,7 +93,7 @@ export function McpLogPane({ server }: McpLogPaneProps) {
id="mcp-logs"
title={<span className="text-[0.68rem] font-normal text-muted-foreground/60">{server ?? m.allServers}</span>}
>
- <McpLogs emptyLabel={m.noOutput} server={server} source={source} />
+ <LogTail emptyLabel={m.noOutput} lines={lines} search={search} />
</DetailPane>
)
}
diff --git a/apps/desktop/src/app/capabilities/mcp/mcp-logs.tsx b/apps/desktop/src/app/capabilities/mcp/mcp-logs.tsx
index 7cc66655cc2..b950d9b672e 100644
--- a/apps/desktop/src/app/capabilities/mcp/mcp-logs.tsx
+++ b/apps/desktop/src/app/capabilities/mcp/mcp-logs.tsx
@@ -1,7 +1,6 @@
import { useStore } from '@nanostores/react'
import { useEffect, useState } from 'react'
-import { LogTail } from '@/components/chat/log-tail'
import { getLogs } from '@/hermes'
import { startCompletionPoll } from '@/lib/completion-poll'
import { $activeGatewayProfile } from '@/store/profile'
@@ -32,15 +31,7 @@ export function filterStdioSections(lines: string[], server: string): string[] {
export type McpLogSource = 'agent' | 'stdio'
-export function McpLogs({
- emptyLabel,
- server,
- source
-}: {
- emptyLabel: string
- server: null | string
- source: McpLogSource
-}) {
+export function useMcpLogLines(server: null | string, source: McpLogSource): null | string[] {
const [lines, setLines] = useState<null | string[]>(null)
const activeProfile = useStore($activeGatewayProfile)
@@ -61,5 +52,5 @@ export function McpLogs({
})
}, [server, source, activeProfile])
- return <LogTail emptyLabel={emptyLabel} lines={lines} />
+ return lines
}
diff --git a/apps/desktop/src/app/command-center/index.tsx b/apps/desktop/src/app/command-center/index.tsx
index 9c05ab44747..6dd640fdb34 100644
--- a/apps/desktop/src/app/command-center/index.tsx
+++ b/apps/desktop/src/app/command-center/index.tsx
@@ -1,6 +1,7 @@
import { compactNumber } from '@hermes/shared'
import { type MouseEvent, type ReactNode, useCallback, useEffect, useMemo, useRef, useState } from 'react'
+import { LogSearchField, useLogSearch } from '@/components/chat/log-search'
import { LogTail } from '@/components/chat/log-tail'
import { PageLoader } from '@/components/page-loader'
import { Button } from '@/components/ui/button'
@@ -37,6 +38,8 @@ import { confirmSharedGatewayRestart } from '@/store/system-actions'
import { SidebarLoadMoreRow } from '../chat/sidebar/load-more-row'
import { useRefreshHotkey } from '../hooks/use-refresh-hotkey'
import { useRouteEnumParam } from '../hooks/use-route-enum-param'
+import { PAGE_INSET_X } from '../layout-constants'
+import { OverlayBreadcrumbHeader } from '../overlays/overlay-breadcrumb-header'
import { OverlayMain, OverlayNav, OverlaySplitLayout } from '../overlays/overlay-split-layout'
import { OverlayView } from '../overlays/overlay-view'
@@ -275,6 +278,7 @@ export function CommandCenterView({
})
const sessionListHasResults = filteredSessions.length > 0
+ const logSearch = useLogSearch(logs, logQuery)
// Same cap semantics as the sidebar's recents ("Load more" visible when any
// profile's backend page was truncated). Reuses the shared $sessions window:
@@ -295,17 +299,6 @@ export function CommandCenterView({
}
}, [loadMorePending, onLoadMoreSessions])
- // Client-side substring filter over the fetched tail (matches `hermes logs --search`).
- const visibleLogs = useMemo(() => {
- const needle = logQuery.trim().toLowerCase()
-
- if (!needle) {
- return logs
- }
-
- return logs.filter(line => line.toLowerCase().includes(needle))
- }, [logQuery, logs])
-
const runSystemAction = useCallback(
async (kind: 'restart' | 'update') => {
setSystemError('')
@@ -377,203 +370,207 @@ export function CommandCenterView({
[cc, section, setSection]
)
+ const activeGroup = navGroups.find(group => group.active)
+
return (
<OverlayView closeLabel={cc.close} onClose={onClose}>
<OverlaySplitLayout>
<OverlayNav groups={navGroups} />
- <OverlayMain>
- <header className="mb-4 flex items-center justify-between gap-3 max-[47.5rem]:mb-2">
- {/* Redundant on narrow — the nav dropdown already names the section. */}
- <div className="min-w-0 max-[47.5rem]:hidden">
- <h2 className="text-[length:var(--conversation-text-font-size)] font-semibold text-foreground">
- {cc.sections[section]}
- </h2>
- <p className="mt-0.5 text-[length:var(--conversation-caption-font-size)] leading-(--conversation-caption-line-height) text-(--ui-text-tertiary)">
- {cc.sectionDescriptions[section]}
- </p>
- </div>
- <div className="flex shrink-0 items-center gap-2">
- {section === 'sessions' && (
- <SearchField
- containerClassName="max-w-[40vw]"
- onChange={next => setQuery(next)}
- placeholder={cc.searchPlaceholder}
- value={query}
- />
- )}
- {section === 'usage' && (
- <SegmentedControl
- onChange={id => setUsagePeriod(Number(id) as UsagePeriod)}
- options={USAGE_PERIODS.map(value => ({ id: String(value), label: cc.days(value) }))}
- value={String(usagePeriod)}
- />
- )}
- </div>
- </header>
-
- {section === 'sessions' ? (
- <div className="flex min-h-0 flex-1 flex-col">
- <div className="min-h-0 flex-1 overflow-y-auto">
- {!sessionListHasResults ? (
- <EmptyPanel description={debouncedQuery ? cc.noResults : cc.noSessions} />
- ) : (
- <ul>
- {filteredSessions.map(session => {
- const pinId = sessionPinId(session)
- const pinned = pinnedSessionIds.includes(pinId)
-
- return (
- <li className="group flex items-center gap-2 py-2" key={session.id}>
- <button
- className="min-w-0 flex-1 text-left"
- onClick={() => onOpenSession(session.id, session)}
- type="button"
- >
- <div className="truncate text-[length:var(--conversation-text-font-size)] font-medium text-foreground">
- {sessionTitle(session)}
- </div>
- <div className="truncate text-[length:var(--conversation-caption-font-size)] text-(--ui-text-tertiary)">
- {formatTimestamp(session.last_active || session.started_at)}
- </div>
- </button>
- <div className="flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100">
- <RowIconButton
- onClick={() => (pinned ? unpinSession(pinId) : pinSession(pinId))}
- title={pinned ? cc.unpinSession : cc.pinSession}
- >
- {pinned ? <BookmarkFilled className="size-3.5" /> : <Bookmark className="size-3.5" />}
- </RowIconButton>
- <RowIconButton
- onClick={() => void exportSession(session.id, { session, title: sessionTitle(session) })}
- title={cc.exportSession}
- >
- <Download className="size-3.5" />
- </RowIconButton>
- <RowIconButton
- className="hover:text-destructive"
- onClick={() => setPendingDelete(session)}
- title={cc.deleteSession}
+ <OverlayMain className="px-0 pb-0">
+ {activeGroup && (
+ <OverlayBreadcrumbHeader
+ group={activeGroup}
+ rootLabel={cc.commandCenter}
+ trailing={
+ <>
+ {section === 'sessions' && (
+ <SearchField
+ containerClassName="max-w-[40vw]"
+ onChange={next => setQuery(next)}
+ placeholder={cc.searchPlaceholder}
+ value={query}
+ />
+ )}
+ {section === 'usage' && (
+ <SegmentedControl
+ onChange={id => setUsagePeriod(Number(id) as UsagePeriod)}
+ options={USAGE_PERIODS.map(value => ({ id: String(value), label: cc.days(value) }))}
+ value={String(usagePeriod)}
+ />
+ )}
+ </>
+ }
+ />
+ )}
+ <div className={cn('flex min-h-0 flex-1 flex-col', PAGE_INSET_X)}>
+ {section === 'sessions' ? (
+ <div className="flex min-h-0 flex-1 flex-col">
+ <div className="min-h-0 flex-1 overflow-y-auto">
+ {!sessionListHasResults ? (
+ <EmptyPanel description={debouncedQuery ? cc.noResults : cc.noSessions} />
+ ) : (
+ <ul>
+ {filteredSessions.map(session => {
+ const pinId = sessionPinId(session)
+ const pinned = pinnedSessionIds.includes(pinId)
+
+ return (
+ <li className="group flex items-center gap-2 py-2" key={session.id}>
+ <button
+ className="min-w-0 flex-1 text-left"
+ onClick={() => onOpenSession(session.id, session)}
+ type="button"
>
- <Trash2 className="size-3.5" />
- </RowIconButton>
- </div>
- </li>
- )
- })}
- </ul>
+ <div className="truncate text-[length:var(--conversation-text-font-size)] font-medium text-foreground">
+ {sessionTitle(session)}
+ </div>
+ <div className="truncate text-[length:var(--conversation-caption-font-size)] text-(--ui-text-tertiary)">
+ {formatTimestamp(session.last_active || session.started_at)}
+ </div>
+ </button>
+ <div className="flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100">
+ <RowIconButton
+ onClick={() => (pinned ? unpinSession(pinId) : pinSession(pinId))}
+ title={pinned ? cc.unpinSession : cc.pinSession}
+ >
+ {pinned ? <BookmarkFilled className="size-3.5" /> : <Bookmark className="size-3.5" />}
+ </RowIconButton>
+ <RowIconButton
+ onClick={() =>
+ void exportSession(session.id, { session, title: sessionTitle(session) })
+ }
+ title={cc.exportSession}
+ >
+ <Download className="size-3.5" />
+ </RowIconButton>
+ <RowIconButton
+ className="hover:text-destructive"
+ onClick={() => setPendingDelete(session)}
+ title={cc.deleteSession}
+ >
+ <Trash2 className="size-3.5" />
+ </RowIconButton>
+ </div>
+ </li>
+ )
+ })}
+ </ul>
+ )}
+ </div>
+ {hasMoreSessions && !!onLoadMoreSessions && !debouncedQuery && (
+ <div className="flex shrink-0 items-end justify-end">
+ <SidebarLoadMoreRow
+ loading={loadMorePending}
+ onClick={() => void onLoadMore()}
+ step={SIDEBAR_SESSIONS_PAGE_SIZE}
+ />
+ </div>
)}
</div>
- {hasMoreSessions && !!onLoadMoreSessions && !debouncedQuery && (
- <div className="flex shrink-0 items-end justify-end">
- <SidebarLoadMoreRow
- loading={loadMorePending}
- onClick={() => void onLoadMore()}
- step={SIDEBAR_SESSIONS_PAGE_SIZE}
- />
- </div>
- )}
- </div>
- ) : section === 'usage' ? (
- <UsagePanel
- error={usageError}
- loading={usageLoading}
- onRefresh={() => void refreshUsage(usagePeriod)}
- period={usagePeriod}
- usage={usage}
- />
- ) : section === 'maintenance' ? (
- <MaintenancePanel />
- ) : (
- <div className="grid min-h-0 flex-1 grid-rows-[auto_minmax(0,1fr)] gap-4">
- <div>
- {status ? (
- <div className="grid gap-2">
- <div className="flex items-start justify-between gap-3 max-[47.5rem]:flex-col max-[47.5rem]:gap-2">
- <div className="min-w-0">
- <div className="flex items-center gap-2">
- <span
- className={cn(
- 'size-2 shrink-0 rounded-full',
- status.gateway_running ? 'bg-emerald-500' : 'bg-amber-500'
- )}
- />
- <span className="text-[length:var(--conversation-text-font-size)] font-medium text-foreground">
- {status.gateway_running ? cc.gatewayRunning : cc.gatewayStopped}
- </span>
+ ) : section === 'usage' ? (
+ <UsagePanel
+ error={usageError}
+ loading={usageLoading}
+ onRefresh={() => void refreshUsage(usagePeriod)}
+ period={usagePeriod}
+ usage={usage}
+ />
+ ) : section === 'maintenance' ? (
+ <MaintenancePanel />
+ ) : (
+ <div className="grid min-h-0 flex-1 grid-rows-[auto_minmax(0,1fr)] gap-4">
+ <div>
+ {status ? (
+ <div className="grid gap-2">
+ <div className="flex items-start justify-between gap-3 max-[47.5rem]:flex-col max-[47.5rem]:gap-2">
+ <div className="min-w-0">
+ <div className="flex items-center gap-2">
+ <span
+ className={cn(
+ 'size-2 shrink-0 rounded-full',
+ status.gateway_running ? 'bg-emerald-500' : 'bg-amber-500'
+ )}
+ />
+ <span className="text-[length:var(--conversation-text-font-size)] font-medium text-foreground">
+ {status.gateway_running ? cc.gatewayRunning : cc.gatewayStopped}
+ </span>
+ </div>
+ <div className="mt-1 text-[length:var(--conversation-caption-font-size)] text-(--ui-text-tertiary)">
+ {cc.hermesActiveSessions(status.version, status.active_sessions)}
+ </div>
</div>
- <div className="mt-1 text-[length:var(--conversation-caption-font-size)] text-(--ui-text-tertiary)">
- {cc.hermesActiveSessions(status.version, status.active_sessions)}
+ <div className="flex shrink-0 flex-wrap items-center gap-x-3 gap-y-1 whitespace-nowrap max-[47.5rem]:whitespace-normal">
+ <Button onClick={() => void runSystemAction('restart')} size="xs" variant="text">
+ {cc.restartGateway}
+ </Button>
+ <Button onClick={() => void runSystemAction('update')} size="xs" variant="textStrong">
+ {cc.updateHermes}
+ </Button>
</div>
</div>
- <div className="flex shrink-0 flex-wrap items-center gap-x-3 gap-y-1 whitespace-nowrap max-[47.5rem]:whitespace-normal">
- <Button onClick={() => void runSystemAction('restart')} size="xs" variant="text">
- {cc.restartGateway}
- </Button>
- <Button onClick={() => void runSystemAction('update')} size="xs" variant="textStrong">
- {cc.updateHermes}
- </Button>
- </div>
+ {systemAction && (
+ <div className="text-[length:var(--conversation-caption-font-size)] text-(--ui-text-tertiary)">
+ {systemAction.name} ·{' '}
+ {systemAction.running
+ ? cc.actionRunning
+ : systemAction.exit_code === 0
+ ? cc.actionDone
+ : cc.actionFailed}
+ </div>
+ )}
</div>
- {systemAction && (
- <div className="text-[length:var(--conversation-caption-font-size)] text-(--ui-text-tertiary)">
- {systemAction.name} ·{' '}
- {systemAction.running
- ? cc.actionRunning
- : systemAction.exit_code === 0
- ? cc.actionDone
- : cc.actionFailed}
- </div>
- )}
- </div>
- ) : (
- <PageLoader className="min-h-32" label={cc.loadingStatus} />
- )}
- </div>
+ ) : (
+ <PageLoader className="min-h-32" label={cc.loadingStatus} />
+ )}
+ </div>
- <div className="flex min-h-0 flex-col pt-2">
- <div className="mb-2 flex flex-wrap items-center justify-between gap-x-3 gap-y-1">
- <span className="text-[0.625rem] font-medium uppercase tracking-[0.08em] text-(--ui-text-tertiary)">
- {cc.recentLogs}
- </span>
- <div className="flex flex-wrap items-center gap-x-3 gap-y-1">
- <ResponsiveTabs
- align="end"
- onChange={id => setLogFile(id as (typeof LOG_FILES)[number])}
- tabs={LOG_FILES.map(value => ({ id: value, label: value }))}
- value={logFile}
- />
- <ResponsiveTabs
- align="end"
- onChange={id => setLogLevel(id as (typeof LOG_LEVELS)[number])}
- tabs={LOG_LEVELS.map(value => ({
- id: value,
- label: value === 'ALL' ? 'all' : value.toLowerCase()
- }))}
- value={logLevel}
- />
- <SearchField
- containerClassName="w-44"
- onChange={next => setLogQuery(next)}
- placeholder={cc.logSearchPlaceholder}
- value={logQuery}
- />
- </div>
- {systemError && (
- <span className="inline-flex items-center gap-1 text-[length:var(--conversation-caption-font-size)] text-destructive">
- <AlertCircle className="size-3.5" />
- {systemError}
+ <div className="flex min-h-0 flex-col pt-2">
+ <div className="mb-2 flex flex-wrap items-center justify-between gap-x-3 gap-y-1">
+ <span className="text-[0.625rem] font-medium uppercase tracking-[0.08em] text-(--ui-text-tertiary)">
+ {cc.recentLogs}
</span>
- )}
+ <div className="flex flex-wrap items-center gap-x-3 gap-y-1">
+ <ResponsiveTabs
+ align="end"
+ onChange={id => setLogFile(id as (typeof LOG_FILES)[number])}
+ tabs={LOG_FILES.map(value => ({ id: value, label: value }))}
+ value={logFile}
+ />
+ <ResponsiveTabs
+ align="end"
+ onChange={id => setLogLevel(id as (typeof LOG_LEVELS)[number])}
+ tabs={LOG_LEVELS.map(value => ({
+ id: value,
+ label: value === 'ALL' ? 'all' : value.toLowerCase()
+ }))}
+ value={logLevel}
+ />
+ <LogSearchField
+ containerClassName="w-44"
+ onChange={setLogQuery}
+ placeholder={cc.logSearchPlaceholder}
+ search={logSearch}
+ value={logQuery}
+ />
+ </div>
+ {systemError && (
+ <span className="inline-flex items-center gap-1 text-[length:var(--conversation-caption-font-size)] text-destructive">
+ <AlertCircle className="size-3.5" />
+ {systemError}
+ </span>
+ )}
+ </div>
+ <LogTail
+ className="flex-1 rounded-lg border border-(--ui-stroke-tertiary) bg-(--ui-bg-quinary)"
+ emptyLabel={cc.noLogs}
+ lines={systemLoading && logs.length === 0 ? null : logs}
+ search={logSearch}
+ />
</div>
- <LogTail
- className="flex-1 rounded-lg border border-(--ui-stroke-tertiary) bg-(--ui-bg-quinary)"
- emptyLabel={cc.noLogs}
- lines={systemLoading && logs.length === 0 ? null : visibleLogs}
- />
</div>
- </div>
- )}
+ )}
+ </div>
</OverlayMain>
</OverlaySplitLayout>
{pendingDelete && (
diff --git a/apps/desktop/src/app/overlays/overlay-breadcrumb-header.tsx b/apps/desktop/src/app/overlays/overlay-breadcrumb-header.tsx
new file mode 100644
index 00000000000..35802818ac6
--- /dev/null
+++ b/apps/desktop/src/app/overlays/overlay-breadcrumb-header.tsx
@@ -0,0 +1,51 @@
+import type { ReactNode } from 'react'
+
+import { Button } from '@/components/ui/button'
+import { ChevronRight } from '@/lib/icons'
+import { cn } from '@/lib/utils'
+
+import { PAGE_INSET_X } from '../layout-constants'
+
+import type { OverlayNavGroup, OverlayNavLink } from './overlay-split-layout'
+
+interface OverlayBreadcrumbHeaderProps {
+ child?: OverlayNavLink
+ group: OverlayNavGroup
+ rootLabel: string
+ trailing?: ReactNode
+}
+
+export function OverlayBreadcrumbHeader({
+ child,
+ group,
+ rootLabel,
+ trailing
+}: OverlayBreadcrumbHeaderProps) {
+ return (
+ <div className={cn('mb-3 flex shrink-0 items-start justify-between gap-3', PAGE_INSET_X)}>
+ <nav
+ aria-label={group.label}
+ className="flex min-w-0 items-center gap-1.5 text-xs text-(--ui-text-tertiary)"
+ >
+ <span className="shrink-0">{rootLabel}</span>
+ <ChevronRight aria-hidden className="size-3 shrink-0" />
+ {child ? (
+ <>
+ <Button onClick={group.onSelect} size="inline" variant="text">
+ {group.label}
+ </Button>
+ <ChevronRight aria-hidden className="size-3 shrink-0" />
+ <span aria-current="page" className="truncate text-foreground">
+ {child.label}
+ </span>
+ </>
+ ) : (
+ <span aria-current="page" className="truncate text-foreground">
+ {group.label}
+ </span>
+ )}
+ </nav>
+ {trailing && <div className="flex shrink-0 items-center">{trailing}</div>}
+ </div>
+ )
+}
diff --git a/apps/desktop/src/app/settings/subpage-navigation.tsx b/apps/desktop/src/app/settings/subpage-navigation.tsx
index 53c17ef5776..22f4bbc2241 100644
--- a/apps/desktop/src/app/settings/subpage-navigation.tsx
+++ b/apps/desktop/src/app/settings/subpage-navigation.tsx
@@ -1,36 +1,10 @@
-import { Button } from '@/components/ui/button'
import { useI18n } from '@/i18n'
-import { ChevronRight } from '@/lib/icons'
-import { cn } from '@/lib/utils'
-import { PAGE_INSET_X } from '../layout-constants'
+import { OverlayBreadcrumbHeader } from '../overlays/overlay-breadcrumb-header'
import type { OverlayNavGroup, OverlayNavLink } from '../overlays/overlay-split-layout'
export function SettingsSubpageHeader({ group, child }: { group: OverlayNavGroup; child?: OverlayNavLink }) {
const { t } = useI18n()
- return (
- <nav
- aria-label={group.label}
- className={cn('mb-3 flex shrink-0 items-center gap-1.5 text-xs text-(--ui-text-tertiary)', PAGE_INSET_X)}
- >
- <span className="shrink-0">{t.commandCenter.settings}</span>
- <ChevronRight aria-hidden className="size-3 shrink-0" />
- {child ? (
- <>
- <Button onClick={group.onSelect} size="inline" variant="text">
- {group.label}
- </Button>
- <ChevronRight aria-hidden className="size-3 shrink-0" />
- <span aria-current="page" className="truncate text-foreground">
- {child.label}
- </span>
- </>
- ) : (
- <span aria-current="page" className="truncate text-foreground">
- {group.label}
- </span>
- )}
- </nav>
- )
+ return <OverlayBreadcrumbHeader child={child} group={group} rootLabel={t.commandCenter.settings} />
}
diff --git a/apps/desktop/src/components/chat/log-search.tsx b/apps/desktop/src/components/chat/log-search.tsx
new file mode 100644
index 00000000000..c359f34aefd
--- /dev/null
+++ b/apps/desktop/src/components/chat/log-search.tsx
@@ -0,0 +1,113 @@
+import { type KeyboardEvent, useMemo, useState } from 'react'
+
+import { Button } from '@/components/ui/button'
+import { SearchField } from '@/components/ui/search-field'
+import { Tip } from '@/components/ui/tooltip'
+import { useI18n } from '@/i18n'
+import { findBarKeyAction, formatMatchLabel } from '@/lib/find-in-page'
+import { ChevronDown, ChevronUp } from '@/lib/icons'
+import { findLogSearchHits, type LogSearchHit } from '@/lib/log-search'
+import { cn } from '@/lib/utils'
+
+export interface LogSearch {
+ /** Index into `hits` of the match the view is parked on; -1 with no hits. */
+ active: number
+ hits: LogSearchHit[]
+ next: () => void
+ previous: () => void
+ query: string
+}
+
+/**
+ * Highlight-and-step search over a log's lines, the same model as ⌘F in chat.
+ * The cursor is stored with the query it belongs to, so typing a new query
+ * lands on its first hit without an effect resetting state.
+ */
+export function useLogSearch(lines: readonly string[] | null, query: string): LogSearch {
+ const needle = query.trim()
+ const hits = useMemo(() => findLogSearchHits(lines ?? [], needle), [lines, needle])
+ const [cursor, setCursor] = useState({ index: 0, needle: '' })
+
+ const active = hits.length === 0 ? -1 : cursor.needle === needle ? Math.min(cursor.index, hits.length - 1) : 0
+
+ const step = (delta: number) => {
+ if (hits.length > 0) {
+ setCursor({ index: (active + delta + hits.length) % hits.length, needle })
+ }
+ }
+
+ return { active, hits, next: () => step(1), previous: () => step(-1), query: needle }
+}
+
+interface LogSearchFieldProps {
+ containerClassName?: string
+ onChange: (query: string) => void
+ placeholder: string
+ search: LogSearch
+ value: string
+}
+
+export function LogSearchField({ containerClassName, onChange, placeholder, search, value }: LogSearchFieldProps) {
+ const { t } = useI18n()
+ const label = formatMatchLabel(search.query, search.active + 1, search.hits.length)
+
+ const onKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {
+ const action =
+ event.key === 'Enter' ? (event.shiftKey ? 'previous' : 'next') : findBarKeyAction(event, { inInput: true })
+
+ if (!action) {
+ return
+ }
+
+ event.preventDefault()
+
+ if (action === 'close') {
+ onChange('')
+ } else {
+ search[action]()
+ }
+ }
+
+ return (
+ <SearchField
+ containerClassName={containerClassName}
+ onChange={onChange}
+ onKeyDown={onKeyDown}
+ placeholder={placeholder}
+ trailingAction={
+ search.query ? (
+ <span className="flex items-center gap-0.5">
+ <span
+ aria-live="polite"
+ className={cn(
+ 'mr-0.5 text-[0.6875rem] leading-none tabular-nums',
+ search.hits.length ? 'text-(--ui-text-secondary)' : 'text-destructive'
+ )}
+ >
+ {label}
+ </span>
+ {(['previous', 'next'] as const).map(direction => {
+ const Icon = direction === 'next' ? ChevronDown : ChevronUp
+
+ return (
+ <Tip key={direction} label={t.findInPage[direction]}>
+ <Button
+ aria-label={t.findInPage[direction]}
+ className="size-5 shrink-0 text-muted-foreground/85 hover:bg-accent/60 hover:text-foreground"
+ disabled={search.hits.length === 0}
+ onClick={search[direction]}
+ size="icon-xs"
+ variant="ghost"
+ >
+ <Icon className="size-3.5" />
+ </Button>
+ </Tip>
+ )
+ })}
+ </span>
+ ) : null
+ }
+ value={value}
+ />
+ )
+}
diff --git a/apps/desktop/src/components/chat/log-tail.test.tsx b/apps/desktop/src/components/chat/log-tail.test.tsx
new file mode 100644
index 00000000000..6d00a775c64
--- /dev/null
+++ b/apps/desktop/src/components/chat/log-tail.test.tsx
@@ -0,0 +1,73 @@
+import { act, cleanup, fireEvent, render, screen } from '@testing-library/react'
+import { useState } from 'react'
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+
+import { I18nProvider } from '@/i18n'
+
+import { LogSearchField, useLogSearch } from './log-search'
+import { LogTail } from './log-tail'
+
+afterEach(cleanup)
+
+function Harness({ lines }: { lines: string[] }) {
+ const [query, setQuery] = useState('')
+ const search = useLogSearch(lines, query)
+
+ return (
+ <I18nProvider configClient={null}>
+ <LogSearchField onChange={setQuery} placeholder="Search logs" search={search} value={query} />
+ <LogTail emptyLabel="No logs" lines={lines} search={search} />
+ </I18nProvider>
+ )
+}
+
+const input = () => screen.getByRole('textbox', { name: 'Search logs' })
+
+const marks = (container: HTMLElement, state?: 'active') =>
+ container.querySelectorAll(state ? '[data-log-hit="active"]' : '[data-log-hit]')
+
+describe('LogTail search', () => {
+ beforeEach(() => {
+ Element.prototype.scrollIntoView = vi.fn()
+ })
+
+ it('highlights every hit in place and steps one active hit through all of them', () => {
+ const { container } = render(<Harness lines={['Docker docker', 'nothing', 'DOCKER']} />)
+
+ fireEvent.change(input(), { target: { value: 'docker' } })
+
+ expect(marks(container)).toHaveLength(3)
+ expect(container.textContent).toContain('nothing')
+
+ const visited = new Set<string>()
+
+ for (let step = 0; step < 3; step += 1) {
+ expect(marks(container, 'active')).toHaveLength(1)
+ visited.add(`${[...marks(container)].indexOf(marks(container, 'active')[0])}`)
+ fireEvent.keyDown(input(), { key: 'Enter' })
+ }
+
+ expect(visited.size).toBe(3)
+ })
+
+ it('returns to the live tail when the search is cleared', () => {
+ let height = 400
+
+ vi.spyOn(HTMLElement.prototype, 'scrollHeight', 'get').mockImplementation(() => height)
+
+ const lines = ['boot', 'needle here', 'ready']
+ const { container, rerender } = render(<Harness lines={lines} />)
+ const scroller = container.querySelector<HTMLElement>('[data-selectable-text]')!
+
+ fireEvent.change(input(), { target: { value: 'needle' } })
+ // Parking on a hit releases the follow, as a real scroll event would.
+ scroller.scrollTop = 0
+ fireEvent.scroll(scroller)
+
+ fireEvent.change(input(), { target: { value: '' } })
+ height = 900
+ act(() => rerender(<Harness lines={[...lines, 'new line']} />))
+
+ expect(scroller.scrollTop).toBe(900)
+ })
+})
diff --git a/apps/desktop/src/components/chat/log-tail.tsx b/apps/desktop/src/components/chat/log-tail.tsx
index e7debd27535..3967ef88eb8 100644
--- a/apps/desktop/src/components/chat/log-tail.tsx
+++ b/apps/desktop/src/components/chat/log-tail.tsx
@@ -1,7 +1,13 @@
-import { useEffect, useRef } from 'react'
+import { useEffect, useMemo, useRef } from 'react'
import { CodeCardBody } from '@/components/chat/code-card'
+import type { LogSearch } from '@/components/chat/log-search'
+import { Button } from '@/components/ui/button'
import { CopyButton } from '@/components/ui/copy-button'
+import { Tip } from '@/components/ui/tooltip'
+import { useI18n } from '@/i18n'
+import { ArrowBarToDown, ArrowBarToUp } from '@/lib/icons'
+import { logLineSegments, logLineSeverity, type LogSearchHit, type LogSeverity } from '@/lib/log-search'
import { cn } from '@/lib/utils'
interface LogTailProps {
@@ -10,33 +16,111 @@ interface LogTailProps {
lines: null | string[]
emptyLabel: string
className?: string
+ /** From useLogSearch: highlights every hit and parks the view on the active one. */
+ search?: LogSearch
}
-/** The shared terminal-log surface: CodeCardBody typography, a hover-reveal copy
- * button, and follow-the-tail scrolling (releases when the user scrolls up).
- * One component behind every log pane — MCP stdio/agent, hub action logs, etc.
- * — so they all read, copy, and scroll identically. */
-export function LogTail({ className, emptyLabel, lines }: LogTailProps) {
+// A hairline in the gutter, not a tint on the text: the level word is already
+// in the line, this only makes warnings and errors findable at a glance.
+const SEVERITY_RULE: Record<LogSeverity, string> = {
+ critical: 'before:bg-destructive',
+ error: 'before:bg-destructive',
+ warning: 'before:bg-(--ui-yellow)'
+}
+
+const HOVER_CONTROL =
+ 'h-5 rounded-md px-1 opacity-5 transition-opacity group-hover/logs:opacity-100 hover:opacity-100 focus-visible:opacity-100'
+
+/** The shared terminal-log surface: CodeCardBody typography, hover-reveal copy
+ * and jump controls, follow-the-tail scrolling (releases when the user scrolls
+ * up), and optional in-place search. One component behind every log pane —
+ * MCP stdio/agent, Command Center, hub action logs — so they all read, copy,
+ * search, and scroll identically. */
+export function LogTail({ className, emptyLabel, lines, search }: LogTailProps) {
+ const { t } = useI18n()
const scrollRef = useRef<HTMLDivElement | null>(null)
const stickRef = useRef(true)
+ const searching = Boolean(search?.query)
+ const active = search?.active ?? -1
- useEffect(() => {
+ const hitsByLine = useMemo(() => {
+ const byLine = new Map<number, { hit: LogSearchHit; index: number }[]>()
+
+ search?.hits.forEach((hit, index) => {
+ byLine.set(hit.line, [...(byLine.get(hit.line) ?? []), { hit, index }])
+ })
+
+ return byLine
+ }, [search?.hits])
+
+ // Jumping to the end is also re-engaging the follow: a programmatic scroll's
+ // event can land after the next lines render, so don't wait for onScroll.
+ const followTail = () => {
const el = scrollRef.current
- if (el && stickRef.current) {
+ stickRef.current = true
+
+ if (el) {
el.scrollTop = el.scrollHeight
}
- }, [lines])
+ }
+
+ // Follow the tail while nobody is searching; a search parks the view on its
+ // hit instead, and polling must not yank it back down.
+ useEffect(() => {
+ if (!searching && stickRef.current) {
+ followTail()
+ }
+ }, [lines, searching])
+
+ // Clearing a search returns to the live tail. Scrolling to a hit released the
+ // follow, so without this the pane would stay parked forever.
+ useEffect(() => {
+ if (!searching) {
+ followTail()
+ }
+ }, [searching])
+
+ useEffect(() => {
+ if (active >= 0) {
+ scrollRef.current?.querySelector('[data-log-hit="active"]')?.scrollIntoView({ block: 'center' })
+ }
+ }, [active, search?.query])
+
+ const jump = (edge: 'bottom' | 'top') => {
+ const el = scrollRef.current
+
+ el?.scrollTo({ behavior: 'smooth', top: edge === 'top' ? 0 : el.scrollHeight })
+ }
return (
<div className={cn('group/logs relative h-full min-h-0', className)}>
- <CopyButton
- appearance="inline"
- className="absolute right-2.5 top-1.5 z-10 h-5 gap-0 rounded-md px-1 opacity-5 transition-opacity group-hover/logs:opacity-100 hover:opacity-100 focus-visible:opacity-100"
- iconClassName="size-3"
- showLabel={false}
- text={() => (lines ?? []).join('\n')}
- />
+ <div className="absolute right-2.5 top-1.5 z-10 flex items-center gap-0.5">
+ {(['top', 'bottom'] as const).map(edge => {
+ const Icon = edge === 'top' ? ArrowBarToUp : ArrowBarToDown
+
+ return (
+ <Tip key={edge} label={t.ui.logs[edge]}>
+ <Button
+ aria-label={t.ui.logs[edge]}
+ className={cn(HOVER_CONTROL, 'text-muted-foreground hover:text-foreground')}
+ onClick={() => jump(edge)}
+ size="icon-xs"
+ variant="ghost"
+ >
+ <Icon className="size-3" />
+ </Button>
+ </Tip>
+ )
+ })}
+ <CopyButton
+ appearance="inline"
+ className={cn(HOVER_CONTROL, 'gap-0')}
+ iconClassName="size-3"
+ showLabel={false}
+ text={() => (lines ?? []).join('\n')}
+ />
+ </div>
<div
className="h-full min-h-0 overflow-y-auto [scrollbar-gutter:stable]"
data-selectable-text="true"
@@ -53,11 +137,45 @@ export function LogTail({ className, emptyLabel, lines }: LogTailProps) {
) : (
<CodeCardBody>
<pre className="whitespace-pre-wrap break-words">
- {lines.map((line, index) => (
- <span className={cn('block', line.startsWith('=====') && 'mt-1 text-(--ui-text-tertiary)')} key={index}>
- {line}
- </span>
- ))}
+ {lines.map((line, index) => {
+ const severity = logLineSeverity(line)
+ const hits = hitsByLine.get(index)
+
+ return (
+ <span
+ className={cn(
+ 'block',
+ line.startsWith('=====') && 'mt-1 text-(--ui-text-tertiary)',
+ severity &&
+ cn(
+ 'relative before:absolute before:-left-1.5 before:inset-y-0 before:w-0.5 before:rounded-full',
+ SEVERITY_RULE[severity]
+ )
+ )}
+ data-log-severity={severity ?? undefined}
+ key={index}
+ >
+ {hits
+ ? logLineSegments(line, hits).map((segment, part) =>
+ segment.hit === null ? (
+ segment.text
+ ) : (
+ <mark
+ className={cn(
+ 'rounded-[2px] text-inherit',
+ segment.hit === active ? 'bg-(--ui-yellow)/55 text-foreground' : 'bg-(--ui-yellow)/30'
+ )}
+ data-log-hit={segment.hit === active ? 'active' : 'match'}
+ key={part}
+ >
+ {segment.text}
+ </mark>
+ )
+ )
+ : line}
+ </span>
+ )
+ })}
</pre>
</CodeCardBody>
)}
diff --git a/apps/desktop/src/components/ui/search-field.tsx b/apps/desktop/src/components/ui/search-field.tsx
index 7275f118978..c7e55632269 100644
--- a/apps/desktop/src/components/ui/search-field.tsx
+++ b/apps/desktop/src/components/ui/search-field.tsx
@@ -1,4 +1,4 @@
-import { type ReactNode, type RefObject, useState } from 'react'
+import { type KeyboardEventHandler, type ReactNode, type RefObject, useState } from 'react'
import { Button } from '@/components/ui/button'
import { Codicon } from '@/components/ui/codicon'
@@ -21,6 +21,7 @@ interface SearchFieldProps {
inputClassName?: string
loading?: boolean
onClear?: () => void
+ onKeyDown?: KeyboardEventHandler<HTMLInputElement>
inputRef?: RefObject<HTMLInputElement | null>
trailingAction?: ReactNode
/**
@@ -48,6 +49,7 @@ export function SearchField({
inputClassName,
loading = false,
onClear,
+ onKeyDown,
inputRef,
trailingAction,
variant = 'underline',
@@ -98,6 +100,7 @@ export function SearchField({
inputClassName
)}
onChange={event => onChange(event.target.value)}
+ onKeyDown={onKeyDown}
placeholder={effectivePlaceholder}
ref={inputRef}
type="text"
diff --git a/apps/desktop/src/i18n/ar.ts b/apps/desktop/src/i18n/ar.ts
index 09871062d46..bce9a4dbe53 100644
--- a/apps/desktop/src/i18n/ar.ts
+++ b/apps/desktop/src/i18n/ar.ts
@@ -1451,11 +1451,6 @@ export const ar = defineLocale({
system: 'النظام',
usage: 'الاستخدام'
},
- sectionDescriptions: {
- sessions: 'البحث في الجلسات وإدارتها',
- system: 'الحالة والسجلات وإجراءات النظام',
- usage: 'نشاط الرموز والتكلفة والمهارات عبر الزمن'
- },
nav: {
newChat: {
title: 'جلسة جديدة',
@@ -1520,6 +1515,7 @@ export const ar = defineLocale({
actionStartedWaiting: 'بدأ الإجراء، جار الانتظار...',
loadingStatus: 'جار تحميل الحالة',
recentLogs: 'السجلات الأخيرة',
+ logSearchPlaceholder: 'البحث في سطور السجل...',
noLogs: 'لا توجد سجلات',
days: count => `${count} يوم`,
statSessions: 'الجلسات',
@@ -3695,6 +3691,11 @@ export const ar = defineLocale({
search: {
clear: 'مسح البحث'
},
+ logs: {
+ bottom: 'أسفل السجل',
+ search: 'البحث في السجلات…',
+ top: 'أعلى السجل'
+ },
pagination: {
label: 'ترقيم الصفحات',
previous: 'السابق',
diff --git a/apps/desktop/src/i18n/de.ts b/apps/desktop/src/i18n/de.ts
index a275c5f372d..da8d5f34b17 100644
--- a/apps/desktop/src/i18n/de.ts
+++ b/apps/desktop/src/i18n/de.ts
@@ -3085,12 +3085,6 @@ export const deOverrides = {
system: 'System',
usage: 'Nutzung'
},
- sectionDescriptions: {
- maintenance: 'Diagnose, Backups, Curator und Memory-Daten',
- sessions: 'Sessions durchsuchen und verwalten',
- system: 'Status, Logs und Systemaktionen',
- usage: 'Token-, Kosten- und Skill-Aktivität im Zeitverlauf'
- },
nav: {
newChat: {
title: 'Neue Session',
@@ -3176,7 +3170,7 @@ export const deOverrides = {
actions: count => `${count} Aktionen`,
logFile: 'Logdatei',
logLevel: 'Stufe',
- logSearchPlaceholder: 'Logzeilen filtern...',
+ logSearchPlaceholder: 'Logs durchsuchen…',
maintenance: {
runOps: 'Diagnose',
doctor: 'Doctor ausführen',
@@ -6114,6 +6108,11 @@ export const deOverrides = {
search: {
clear: 'Suche löschen'
},
+ logs: {
+ bottom: 'Zum Ende',
+ search: 'Logs durchsuchen…',
+ top: 'Zum Anfang'
+ },
pagination: {
label: 'Seitennummerierung',
previous: 'Zurück',
diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.ts
index 042afb91843..bd6fcf809f5 100644
--- a/apps/desktop/src/i18n/en.ts
+++ b/apps/desktop/src/i18n/en.ts
@@ -2780,12 +2780,6 @@ export const en: Translations = {
mcpServers: 'MCP servers',
archivedChats: 'Archived chats',
sections: { maintenance: 'Maintenance', sessions: 'Sessions', system: 'System', usage: 'Usage' },
- sectionDescriptions: {
- maintenance: 'Diagnostics, backups, curator, and memory data',
- sessions: 'Search and manage sessions',
- system: 'Status, logs, and system actions',
- usage: 'Token, cost, and skill activity over time'
- },
nav: {
newChat: { title: 'New session', detail: 'Start a fresh session' },
settings: { title: 'Settings', detail: 'Configure Hermes desktop' },
@@ -2847,7 +2841,7 @@ export const en: Translations = {
actions: count => `${count} actions`,
logFile: 'Log file',
logLevel: 'Level',
- logSearchPlaceholder: 'Filter log lines...',
+ logSearchPlaceholder: 'Search log lines...',
maintenance: {
runOps: 'Diagnostics',
doctor: 'Run doctor',
@@ -5625,6 +5619,11 @@ export const en: Translations = {
search: {
clear: 'Clear search'
},
+ logs: {
+ bottom: 'Bottom of log',
+ search: 'Search logs…',
+ top: 'Top of log'
+ },
pagination: {
label: 'pagination',
previous: 'Prev',
diff --git a/apps/desktop/src/i18n/es.ts b/apps/desktop/src/i18n/es.ts
index 9afe7669814..f674704cc85 100644
--- a/apps/desktop/src/i18n/es.ts
+++ b/apps/desktop/src/i18n/es.ts
@@ -3077,12 +3077,6 @@ export const esOverrides = {
system: 'Sistema',
usage: 'Uso'
},
- sectionDescriptions: {
- maintenance: 'Diagnóstico, copias de seguridad, curador y datos de memoria',
- sessions: 'Buscar y gestionar sesiones',
- system: 'Estado, registros y acciones del sistema',
- usage: 'Actividad de tokens, coste y skills a lo largo del tiempo'
- },
nav: {
newChat: {
title: 'Nueva sesión',
@@ -3169,7 +3163,7 @@ export const esOverrides = {
actions: count => `${count} acciones`,
logFile: 'Archivo de registro',
logLevel: 'Nivel',
- logSearchPlaceholder: 'Filtrar líneas de registro…',
+ logSearchPlaceholder: 'Buscar en los registros…',
maintenance: {
runOps: 'Diagnóstico',
doctor: 'Ejecutar diagnóstico',
@@ -6103,6 +6097,11 @@ export const esOverrides = {
search: {
clear: 'Limpiar búsqueda'
},
+ logs: {
+ bottom: 'Ir al final',
+ search: 'Buscar en los registros…',
+ top: 'Ir al inicio'
+ },
pagination: {
label: 'paginación',
previous: 'Anterior',
diff --git a/apps/desktop/src/i18n/fr.ts b/apps/desktop/src/i18n/fr.ts
index 7c79ce08be0..f02f6a2eda7 100644
--- a/apps/desktop/src/i18n/fr.ts
+++ b/apps/desktop/src/i18n/fr.ts
@@ -3096,12 +3096,6 @@ export const frOverrides = {
system: 'Système',
usage: 'Utilisation'
},
- sectionDescriptions: {
- maintenance: 'Diagnostiques, sauvegardes, curateur et données de mémoire',
- sessions: 'Rechercher et gérer les sessions',
- system: 'État, journaux et actions système',
- usage: 'Activité des jetons, coûts et skills au fil du temps'
- },
nav: {
newChat: {
title: 'Nouvelle session',
@@ -3187,7 +3181,7 @@ export const frOverrides = {
actions: count => `${count} actions`,
logFile: 'Fichier journal',
logLevel: 'Niveau',
- logSearchPlaceholder: 'Filtrer les lignes du journal...',
+ logSearchPlaceholder: 'Rechercher dans les journaux…',
maintenance: {
runOps: 'Diagnostiques',
doctor: 'Exécuter le diagnostic',
@@ -6125,6 +6119,11 @@ export const frOverrides = {
search: {
clear: 'Effacer la recherche'
},
+ logs: {
+ bottom: 'Aller à la fin',
+ search: 'Rechercher dans les journaux…',
+ top: 'Aller au début'
+ },
pagination: {
label: 'pagination',
previous: 'Préc.',
diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.ts
index 607963f0aaf..32ae5817954 100644
--- a/apps/desktop/src/i18n/ja.ts
+++ b/apps/desktop/src/i18n/ja.ts
@@ -1845,11 +1845,6 @@ export const ja = defineLocale({
mcpServers: 'MCP サーバー',
archivedChats: 'アーカイブ済みチャット',
sections: { sessions: 'セッション', system: 'システム', usage: '使用状況' },
- sectionDescriptions: {
- sessions: 'セッションの検索と管理',
- system: 'ステータス、ログ、システムアクション',
- usage: 'トークン、コスト、スキルの活動履歴'
- },
nav: {
newChat: { title: '新しいセッション', detail: '新しいセッションを開始' },
settings: { title: '設定', detail: 'Hermes デスクトップを設定' },
@@ -1890,6 +1885,7 @@ export const ja = defineLocale({
actionStartedWaiting: 'アクションが開始されました。ステータスを待機中...',
loadingStatus: 'ステータスを読み込み中...',
recentLogs: '最近のログ',
+ logSearchPlaceholder: 'ログ行を検索…',
noLogs: 'ログはまだ読み込まれていません。',
days: count => `${count}日`,
statSessions: 'セッション',
@@ -4220,6 +4216,11 @@ export const ja = defineLocale({
search: {
clear: '検索をクリア'
},
+ logs: {
+ bottom: 'ログの末尾',
+ search: 'ログを検索…',
+ top: 'ログの先頭'
+ },
pagination: {
label: 'ページング',
previous: '前へ',
diff --git a/apps/desktop/src/i18n/ru.ts b/apps/desktop/src/i18n/ru.ts
index 0d68d3031c2..a226606dca5 100644
--- a/apps/desktop/src/i18n/ru.ts
+++ b/apps/desktop/src/i18n/ru.ts
@@ -1948,12 +1948,6 @@ export const ru = defineLocale({
mcpServers: 'MCP-серверы',
archivedChats: 'Архивные чаты',
sections: { maintenance: 'Обслуживание', sessions: 'Сеансы', system: 'Система', usage: 'Использование' },
- sectionDescriptions: {
- maintenance: 'Диагностика, резервные копии, курир и данные памяти',
- sessions: 'Поиск и управление сеансами',
- system: 'Статус, журналы и системные действия',
- usage: 'Токены, стоимость и активность навыков со временем'
- },
nav: {
newChat: { title: 'Новый сеанс', detail: 'Начать новый сеанс' },
settings: { title: 'Настройки', detail: 'Настройка Hermes desktop' },
@@ -2015,7 +2009,7 @@ export const ru = defineLocale({
actions: count => `${count} ${RU_NOUN(count, 'действие', 'действия', 'действий')}`,
logFile: 'Файл журнала',
logLevel: 'Уровень',
- logSearchPlaceholder: 'Фильтр строк журнала...',
+ logSearchPlaceholder: 'Поиск по строкам журнала...',
maintenance: {
runOps: 'Диагностика',
doctor: 'Запустить doctor',
@@ -4286,6 +4280,11 @@ export const ru = defineLocale({
search: {
clear: 'Очистить поиск'
},
+ logs: {
+ bottom: 'В конец журнала',
+ search: 'Поиск в журналах…',
+ top: 'В начало журнала'
+ },
pagination: {
label: 'пагинация',
previous: 'Назад',
diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.ts
index eb904bcf728..50f66e29171 100644
--- a/apps/desktop/src/i18n/types.ts
+++ b/apps/desktop/src/i18n/types.ts
@@ -2373,7 +2373,6 @@ export interface Translations {
mcpServers: string
archivedChats: string
sections: Record<'maintenance' | 'sessions' | 'system' | 'usage', string>
- sectionDescriptions: Record<'maintenance' | 'sessions' | 'system' | 'usage', string>
nav: Record<'newChat' | 'settings' | 'capabilities' | 'messaging' | 'artifacts', { title: string; detail: string }>
sectionEntries: Record<'sessions' | 'system' | 'usage', { title: string; detail: string }>
providerNavigate: string
@@ -4642,6 +4641,11 @@ export interface Translations {
search: {
clear: string
}
+ logs: {
+ bottom: string
+ search: string
+ top: string
+ }
pagination: {
label: string
previous: string
diff --git a/apps/desktop/src/i18n/zh-hant.ts b/apps/desktop/src/i18n/zh-hant.ts
index c795b950539..ce957173e23 100644
--- a/apps/desktop/src/i18n/zh-hant.ts
+++ b/apps/desktop/src/i18n/zh-hant.ts
@@ -2088,11 +2088,6 @@ export const zhHant = defineLocale({
mcpServers: 'MCP 伺服器',
archivedChats: '已封存聊天',
sections: { sessions: '工作階段', system: '系統', usage: '使用量' },
- sectionDescriptions: {
- sessions: '搜尋和管理工作階段',
- system: '狀態、記錄和系統動作',
- usage: '一段時間內的詞元、費用和技能活動'
- },
nav: {
newChat: { title: '新工作階段', detail: '開始新的工作階段' },
settings: { title: '設定', detail: '設定 Hermes 桌面端' },
@@ -2133,6 +2128,7 @@ export const zhHant = defineLocale({
actionStartedWaiting: '動作已啟動,等待狀態…',
loadingStatus: '正在載入狀態…',
recentLogs: '最近記錄',
+ logSearchPlaceholder: '搜尋記錄行…',
noLogs: '尚未載入記錄。',
days: count => `${count} 天`,
statSessions: '工作階段',
@@ -4351,6 +4347,11 @@ export const zhHant = defineLocale({
search: {
clear: '清除搜尋'
},
+ logs: {
+ bottom: '記錄底端',
+ search: '搜尋記錄…',
+ top: '記錄頂端'
+ },
pagination: {
label: '分頁',
previous: '上一頁',
diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.ts
index cbb4bc4772e..caeaec62178 100644
--- a/apps/desktop/src/i18n/zh.ts
+++ b/apps/desktop/src/i18n/zh.ts
@@ -2581,12 +2581,6 @@ export const zh = defineLocale({
mcpServers: 'MCP 服务器',
archivedChats: '已归档对话',
sections: { maintenance: '维护', sessions: '会话', system: '系统', usage: '用量' },
- sectionDescriptions: {
- maintenance: '诊断、备份、维护器与记忆数据',
- sessions: '搜索与管理会话',
- system: '状态、日志与系统操作',
- usage: '一段时间内的词元、成本与技能活动'
- },
nav: {
newChat: { title: '新建会话', detail: '开始一个新会话' },
settings: { title: '设置', detail: '配置 Hermes 桌面端' },
@@ -2648,7 +2642,7 @@ export const zh = defineLocale({
actions: count => `${count} 次操作`,
logFile: '日志文件',
logLevel: '级别',
- logSearchPlaceholder: '筛选日志行…',
+ logSearchPlaceholder: '搜索日志行…',
maintenance: {
runOps: '诊断',
doctor: '运行体检',
@@ -5177,6 +5171,11 @@ export const zh = defineLocale({
search: {
clear: '清除搜索'
},
+ logs: {
+ bottom: '日志底部',
+ search: '搜索日志…',
+ top: '日志顶部'
+ },
pagination: {
label: '分页',
previous: '上一页',
diff --git a/apps/desktop/src/lib/icons.ts b/apps/desktop/src/lib/icons.ts
index 76f1af34f22..3c0a6ea6798 100644
--- a/apps/desktop/src/lib/icons.ts
+++ b/apps/desktop/src/lib/icons.ts
@@ -5,6 +5,8 @@ import {
IconAppWindow as AppWindow,
IconArchive as Archive,
IconArchiveOff as ArchiveOff,
+ IconArrowBarToDown as ArrowBarToDown,
+ IconArrowBarToUp as ArrowBarToUp,
IconArrowUp as ArrowUp,
IconArrowUpRight as ArrowUpRight,
IconAt as AtSign,
@@ -26,6 +28,7 @@ import {
IconChevronLeft as ChevronLeftIcon,
IconChevronRight as ChevronRight,
IconChevronRight as ChevronRightIcon,
+ IconChevronUp as ChevronUp,
IconCircle as CircleIcon,
IconCircleLetterA as CircleLetterA,
IconClipboard as Clipboard,
@@ -140,6 +143,8 @@ export {
AppWindow,
Archive,
ArchiveOff,
+ ArrowBarToDown,
+ ArrowBarToUp,
ArrowUp,
ArrowUpRight,
AtSign,
@@ -161,6 +166,7 @@ export {
ChevronLeftIcon,
ChevronRight,
ChevronRightIcon,
+ ChevronUp,
CircleIcon,
CircleLetterA,
Clipboard,
diff --git a/apps/desktop/src/lib/log-search.test.ts b/apps/desktop/src/lib/log-search.test.ts
new file mode 100644
index 00000000000..06a0de0ec8c
--- /dev/null
+++ b/apps/desktop/src/lib/log-search.test.ts
@@ -0,0 +1,41 @@
+import { describe, expect, it } from 'vitest'
+
+import { findLogSearchHits, logLineSegments, logLineSeverity } from './log-search'
+
+describe('findLogSearchHits', () => {
+ it('returns offsets that slice the original line back to the query, case-insensitively', () => {
+ // U+0130 lowercases to two code units; offsets taken from a lowercased copy
+ // would land one character early on everything after it.
+ const lines = ['İstanbul Docker', 'docker DOCKER', 'nothing']
+ const hits = findLogSearchHits(lines, ' docker ')
+
+ expect(hits).toHaveLength(3)
+
+ for (const hit of hits) {
+ expect(lines[hit.line].slice(hit.start, hit.end).toLowerCase()).toBe('docker')
+ }
+ })
+
+ it('treats the query as a literal, not a pattern', () => {
+ expect(findLogSearchHits(['a.b', 'axb'], 'a.b')).toEqual([{ end: 3, line: 0, start: 0 }])
+ })
+})
+
+describe('logLineSegments', () => {
+ it('reassembles into the original line with hits marked by their global index', () => {
+ const line = 'x Docker y docker'
+ const hits = findLogSearchHits([line], 'docker').map((hit, index) => ({ hit, index: index + 5 }))
+ const segments = logLineSegments(line, hits)
+
+ expect(segments.map(segment => segment.text).join('')).toBe(line)
+ expect(segments.filter(segment => segment.hit !== null).map(segment => segment.hit)).toEqual([5, 6])
+ })
+})
+
+describe('logLineSeverity', () => {
+ it('reads the level column, not a level word inside the message', () => {
+ expect(logLineSeverity('2026-09-23 21:15:07,123 WARNING gateway.run: retrying')).toBe('warning')
+ expect(logLineSeverity('2026-09-23 21:15:07,123 INFO tools: ERROR count=0')).toBeNull()
+ expect(logLineSeverity('ERROR without a timestamp')).toBeNull()
+ })
+})
diff --git a/apps/desktop/src/lib/log-search.ts b/apps/desktop/src/lib/log-search.ts
new file mode 100644
index 00000000000..6fc4ef1d7e4
--- /dev/null
+++ b/apps/desktop/src/lib/log-search.ts
@@ -0,0 +1,76 @@
+// Pure matching behind in-log search (LogTail + useLogSearch). Kept free of
+// React so the offsets, segment cuts, and severity column are testable alone.
+
+export interface LogSearchHit {
+ end: number
+ line: number
+ start: number
+}
+
+export type LogSeverity = 'critical' | 'error' | 'warning'
+
+export interface LogLineSegment {
+ /** Index into the full hit list this segment belongs to, or null. */
+ hit: null | number
+ text: string
+}
+
+const escapeRegExp = (text: string) => text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
+
+/**
+ * Every case-insensitive literal occurrence of `query`, with offsets into the
+ * ORIGINAL line. Lowercasing a copy and slicing the original by its offsets
+ * drifts whenever case mapping changes length (U+0130 lowercases to two code
+ * units), so the match runs on the original text with the `iu` flags instead.
+ */
+export function findLogSearchHits(lines: readonly string[], query: string): LogSearchHit[] {
+ const needle = query.trim()
+
+ if (!needle) {
+ return []
+ }
+
+ const pattern = new RegExp(escapeRegExp(needle), 'giu')
+ const hits: LogSearchHit[] = []
+
+ lines.forEach((text, line) => {
+ for (const match of text.matchAll(pattern)) {
+ hits.push({ end: match.index + match[0].length, line, start: match.index })
+ }
+ })
+
+ return hits
+}
+
+// hermes_logging._LOG_FORMAT puts the level right after the timestamp. Anchoring
+// to that column keeps a message that merely mentions "ERROR" from being
+// marked as one.
+const LEVEL_COLUMN = /^\d{4}-\d{2}-\d{2} [\d:.,]+ (WARNING|ERROR|CRITICAL)\b/
+
+export function logLineSeverity(line: string): LogSeverity | null {
+ const level = LEVEL_COLUMN.exec(line)?.[1]
+
+ return level ? (level.toLowerCase() as LogSeverity) : null
+}
+
+/** Cut one line at its hits. `hits` pairs each of this line's hits with its
+ * index in the full list so the active one can be told apart. */
+export function logLineSegments(text: string, hits: readonly { hit: LogSearchHit; index: number }[]): LogLineSegment[] {
+ const segments: LogLineSegment[] = []
+ let cursor = 0
+
+ for (const { hit, index } of hits) {
+ if (hit.start > cursor) {
+ segments.push({ hit: null, text: text.slice(cursor, hit.start) })
+ }
+
+ segments.push({ hit: index, text: text.slice(hit.start, hit.end) })
+ cursor = hit.end
+ }
+
+ if (cursor < text.length || segments.length === 0) {
+ segments.push({ hit: null, text: text.slice(cursor) })
+ }
+
+ return segments
+}