Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
feat(search): desktop ⌘K command palette + sidebar entry
cyh4749e5ee8d8b
diff --git a/ui/src/components/AppShell.tsx b/ui/src/components/AppShell.tsxindex 06bad4468..11307817f 100644--- a/ui/src/components/AppShell.tsx+++ b/ui/src/components/AppShell.tsx@@ -13,6 +13,7 @@ import { ThemeToggle } from './ThemeToggle';import { VersionBadge } from './VersionBadge';import { WorkbenchSidebar } from './workbench/WorkbenchSidebar';import { NewSessionSheet } from './workbench/NewSessionSheet';+import { SearchPalette } from './workbench/search/SearchPalette';import { Button } from './ui/button';import { InstallHint } from './InstallHint';import logoImg from '../assets/logo.png';@@ -141,6 +142,7 @@ export const AppShell: React.FC = () => {const [enabledPlatforms, setEnabledPlatforms] = useState<string[]>([]);const [config, setConfig] = useState<any>(null);const [newSessionOpen, setNewSessionOpen] = useState(false);+ const [searchOpen, setSearchOpen] = useState(false);// Mirror the iOS visual-viewport height into --app-vvh. The MOBILE shell is a// static locked column that does NOT read it (resizing the shell mid-focus// fought iOS's scroll-into-view and flung the input off-screen); only the md+@@ -155,6 +157,20 @@ export const AppShell: React.FC = () => {}).catch(() => {});}, [api]);+ // Global ⌘K / Ctrl+K toggles the message-search palette. Intercept the chord+ // everywhere (it's a deliberate command, so it wins even from the composer);+ // the palette's own input/Esc/arrow handling takes over once it is open.+ useEffect(() => {+ const onKeyDown = (e: KeyboardEvent) => {+ if ((e.metaKey || e.ctrlKey) && (e.key === 'k' || e.key === 'K')) {+ e.preventDefault();+ setSearchOpen((prev) => !prev);+ }+ };+ window.addEventListener('keydown', onKeyDown);+ return () => window.removeEventListener('keydown', onKeyDown);+ }, []);+const hasChannelPlatforms = enabledPlatforms.some((platform) => platformSupportsChannels(config, platform));const isRunning = status.state === 'running';@@ -242,7 +258,7 @@ export const AppShell: React.FC = () => {</nav></div>)}- {shellMode === 'workbench' && <WorkbenchSidebar />}+ {shellMode === 'workbench' && <WorkbenchSidebar onOpenSearch={() => setSearchOpen(true)} />}</div>{/* Bottom: Status (with embedded version badge) + toggles + hostname */}@@ -365,6 +381,11 @@ export const AppShell: React.FC = () => {onClose={() => setNewSessionOpen(false)}onOpen={() => setNewSessionOpen(true)}/>++ {/* ⌘K message-search palette. Mounted shell-wide so the shortcut works from+ both Workbench and Control Panel; the sidebar field is the workbench+ entry point. */}+ <SearchPalette open={searchOpen} onClose={() => setSearchOpen(false)} /></div>);};diff --git a/ui/src/components/workbench/WorkbenchSidebar.tsx b/ui/src/components/workbench/WorkbenchSidebar.tsxindex 299770baa..97eae8843 100644--- a/ui/src/components/workbench/WorkbenchSidebar.tsx+++ b/ui/src/components/workbench/WorkbenchSidebar.tsx@@ -19,6 +19,7 @@ import {Loader2,Pencil,Plus,+ Search,Settings2,WandSparkles,} from 'lucide-react';@@ -612,7 +613,7 @@ const ProjectRow: React.FC<{);};-export const WorkbenchSidebar: React.FC = () => {+export const WorkbenchSidebar: React.FC<{ onOpenSearch?: () => void }> = ({ onOpenSearch }) => {const { t } = useTranslation();const navigate = useNavigate();const { totalUnread, unreadSessions, inboxSessions, markRead, unreadBySession } = useWorkbenchInbox();@@ -688,6 +689,21 @@ export const WorkbenchSidebar: React.FC = () => {// popover stays OUT of any overflow box below, so it is never clipped.return (<div className="flex min-h-0 flex-1 flex-col gap-4">+ {/* Search field — the sidebar's first item (Brand lives in AppShell).+ Field-style button per design.pen XErMu: search glyph + muted+ placeholder + ⌘K pill; opens the ⌘K command palette. */}+ <button+ type="button"+ onClick={onOpenSearch}+ className="flex items-center gap-2 rounded-lg border border-border-strong bg-foreground/[0.03] px-[11px] py-[9px] text-left transition hover:bg-foreground/[0.05]"+ >+ <Search className="size-3.5 shrink-0 text-muted" />+ <span className="flex-1 truncate text-[13px] text-muted">{t('workbench.search.entry')}</span>+ <kbd className="shrink-0 rounded-[5px] border border-border bg-foreground/[0.06] px-1.5 py-0.5 font-mono text-[11px] font-medium text-muted">+ ⌘K+ </kbd>+ </button>+{/* Inbox entry — hover opens the floating popover. */}<divclassName="relative"diff --git a/ui/src/components/workbench/search/SearchPalette.tsx b/ui/src/components/workbench/search/SearchPalette.tsxnew file mode 100644index 000000000..afd1937d4--- /dev/null+++ b/ui/src/components/workbench/search/SearchPalette.tsx@@ -0,0 +1,190 @@+import { useEffect, useMemo, useRef, useState } from 'react';+import { useTranslation } from 'react-i18next';+import { useNavigate } from 'react-router-dom';+import * as DialogPrimitive from '@radix-ui/react-dialog';+import { Loader2, Search } from 'lucide-react';++import { useMessageSearch } from '../../../lib/useMessageSearch';+import { Dialog, DialogOverlay, DialogPortal, DialogTitle } from '../../ui/dialog';+import { SearchResultGroup } from './SearchResultGroup';++type SearchPaletteProps = {+ open: boolean;+ onClose: () => void;+};++// One footer keyboard hint: a key-cap pill + its label (↑↓ Navigate, etc.).+// Mirrors design.pen UM9dm → Hint (Key cornerRadius 5 / #FFFFFF0F / border,+// mono key + Inter muted label).+const FooterHint: React.FC<{ keyLabel: string; label: string }> = ({ keyLabel, label }) => (+ <span className="flex items-center gap-1.5">+ <kbd className="flex items-center justify-center rounded-[5px] border border-border bg-foreground/[0.06] px-1.5 py-0.5 font-mono text-[10px] font-bold text-muted">+ {keyLabel}+ </kbd>+ <span className="text-[11px] text-muted">{label}</span>+ </span>+);++// Desktop ⌘K command palette for message-content search (design.pen sUCZo).+// A centered 720px modal: a query row (mint search glyph + text input + an Esc+// pill), a scrollable results area grouped by session via the shared+// <SearchResultGroup>, and a footer of keyboard hints. Results are SERVER-driven+// (useMessageSearch) — there is no client-side filtering. Selecting a hit routes+// to /chat/<session>?msg=<message> (the ?msg contract is consumed by P5).+export const SearchPalette: React.FC<SearchPaletteProps> = ({ open, onClose }) => {+ const { t } = useTranslation();+ const navigate = useNavigate();+ const [query, setQuery] = useState('');+ const { results, loading } = useMessageSearch(query);+ const inputRef = useRef<HTMLInputElement | null>(null);+ const listRef = useRef<HTMLDivElement | null>(null);++ // A flat, ordered list of (sessionId, messageId) — the navigation order the+ // arrow keys walk, reading sessions top-to-bottom and matches within each.+ const flatMatches = useMemo(+ () =>+ (results?.sessions ?? []).flatMap((session) =>+ session.matches.map((match) => ({ sessionId: session.session_id, messageId: match.id })),+ ),+ [results],+ );++ const [selectedId, setSelectedId] = useState<string | null>(null);++ // Reset the query (and the in-flight search via the hook) every time the+ // palette reopens — the parent keeps it mounted, so without this a stale+ // query/result set would flash on the next open.+ useEffect(() => {+ if (open) {+ setQuery('');+ setSelectedId(null);+ }+ }, [open]);++ // Keep a valid highlight as results change: default to the first hit, and snap+ // back to it if the previously selected message dropped out of the new set.+ useEffect(() => {+ if (flatMatches.length === 0) {+ setSelectedId(null);+ return;+ }+ setSelectedId((prev) =>+ prev && flatMatches.some((m) => m.messageId === prev) ? prev : flatMatches[0].messageId,+ );+ }, [flatMatches]);++ const handleSelect = (sessionId: string, messageId: string) => {+ navigate(`/chat/${encodeURIComponent(sessionId)}?msg=${encodeURIComponent(messageId)}`);+ onClose();+ };++ const moveSelection = (delta: number) => {+ if (flatMatches.length === 0) return;+ const idx = flatMatches.findIndex((m) => m.messageId === selectedId);+ const next = idx < 0 ? 0 : (idx + delta + flatMatches.length) % flatMatches.length;+ setSelectedId(flatMatches[next].messageId);+ };++ const onKeyDown = (e: React.KeyboardEvent) => {+ if (e.key === 'ArrowDown') {+ e.preventDefault();+ moveSelection(1);+ } else if (e.key === 'ArrowUp') {+ e.preventDefault();+ moveSelection(-1);+ } else if (e.key === 'Enter') {+ e.preventDefault();+ const target = flatMatches.find((m) => m.messageId === selectedId);+ if (target) handleSelect(target.sessionId, target.messageId);+ }+ };++ // Scroll the highlighted row into view as the selection walks past the fold.+ // SearchResultRow marks the active row with aria-current="true"; lean on that+ // rather than threading a new data attribute through the shared P2 component.+ useEffect(() => {+ if (!selectedId || !listRef.current) return;+ const el = listRef.current.querySelector<HTMLElement>('[aria-current="true"]');+ el?.scrollIntoView({ block: 'nearest' });+ }, [selectedId]);++ const trimmed = query.trim();+ const hasResults = (results?.sessions.length ?? 0) > 0;+ const showEmpty = trimmed.length > 0 && !loading && results !== null && !hasResults;+ const showHint = trimmed.length === 0;++ return (+ <Dialog open={open} onOpenChange={(next) => (next ? undefined : onClose())}>+ <DialogPortal>+ <DialogOverlay className="bg-[#05050B]/85" />+ <DialogPrimitive.Content+ onKeyDown={onKeyDown}+ onOpenAutoFocus={(e) => {+ // Focus the query field rather than the first row, so typing flows+ // straight into the search input.+ e.preventDefault();+ inputRef.current?.focus();+ }}+ aria-describedby={undefined}+ className="fixed left-1/2 top-[120px] z-50 flex max-h-[min(640px,calc(100dvh-160px))] w-[720px] max-w-[calc(100vw-2rem)] -translate-x-1/2 flex-col overflow-hidden rounded-2xl border border-border-strong bg-surface-2 shadow-[0_32px_80px_-16px_rgba(0,0,0,0.75)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0 data-[state=open]:zoom-in-95 data-[state=closed]:zoom-out-95"+ >+ <DialogTitle className="sr-only">{t('workbench.search.title')}</DialogTitle>++ {/* Query row — mint search glyph + input + Esc pill. */}+ <div className="flex shrink-0 items-center gap-3 border-b border-border px-[18px] py-4">+ <Search className="size-[18px] shrink-0 text-mint" />+ <input+ ref={inputRef}+ value={query}+ onChange={(e) => setQuery(e.target.value)}+ placeholder={t('workbench.search.placeholder')}+ className="min-w-0 flex-1 bg-transparent text-[17px] text-foreground outline-none placeholder:text-muted"+ aria-label={t('workbench.search.placeholder')}+ spellCheck={false}+ autoComplete="off"+ />+ {loading && <Loader2 className="size-4 shrink-0 animate-spin text-muted" />}+ <kbd className="shrink-0 rounded-md border border-border bg-foreground/[0.06] px-2 py-[3px] font-mono text-[11px] text-muted">+ {t('workbench.search.kbdEsc')}+ </kbd>+ </div>++ {/* Results / states. */}+ <div ref={listRef} className="min-h-0 flex-1 overflow-y-auto px-2.5 py-2">+ {showHint && (+ <div className="px-2.5 py-10 text-center text-[13px] text-muted">+ {t('workbench.search.hint')}+ </div>+ )}+ {showEmpty && (+ <div className="px-2.5 py-10 text-center text-[13px] text-muted">+ {t('workbench.search.empty')}+ </div>+ )}+ {hasResults && (+ <div className="flex flex-col gap-1.5">+ {results!.sessions.map((session) => (+ <SearchResultGroup+ key={session.session_id}+ session={session}+ selectedId={selectedId ?? undefined}+ onSelect={(match) => handleSelect(session.session_id, match.id)}+ />+ ))}+ </div>+ )}+ </div>++ {/* Footer keyboard hints. */}+ <div className="flex shrink-0 items-center gap-4 border-t border-border bg-foreground/[0.02] px-4 py-[11px]">+ <FooterHint keyLabel="↑↓" label={t('workbench.search.kbdNavigate')} />+ <FooterHint keyLabel="↵" label={t('workbench.search.kbdOpen')} />+ <FooterHint keyLabel={t('workbench.search.kbdEsc')} label={t('workbench.search.kbdClose')} />+ <span className="flex-1" />+ <span className="truncate text-[11px] text-muted">{t('workbench.search.footerNote')}</span>+ </div>+ </DialogPrimitive.Content>+ </DialogPortal>+ </Dialog>+ );+};diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.jsonindex 18a40507d..e6ffcb4c5 100644--- a/ui/src/i18n/en.json+++ b/ui/src/i18n/en.json@@ -629,7 +629,17 @@},"search": {"roleYou": "You",- "roleAgent": "Agent"+ "roleAgent": "Agent",+ "title": "Search messages",+ "entry": "Search messages",+ "placeholder": "Search messages",+ "hint": "Search your messages",+ "empty": "No messages found",+ "kbdEsc": "Esc",+ "kbdNavigate": "Navigate",+ "kbdOpen": "Open",+ "kbdClose": "Close",+ "footerNote": "Searching message content · all sessions"},"inbox": {"eyebrow": "Inbox",diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.jsonindex 56adc2981..07c73f194 100644--- a/ui/src/i18n/zh.json+++ b/ui/src/i18n/zh.json@@ -629,7 +629,17 @@},"search": {"roleYou": "你",- "roleAgent": "助手"+ "roleAgent": "助手",+ "title": "搜索消息",+ "entry": "搜索消息",+ "placeholder": "搜索消息",+ "hint": "搜索你的消息",+ "empty": "未找到消息",+ "kbdEsc": "Esc",+ "kbdNavigate": "切换",+ "kbdOpen": "打开",+ "kbdClose": "关闭",+ "footerNote": "搜索消息内容 · 全部会话"},"inbox": {"eyebrow": "收件箱",