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(apps): search apps via ⌘K, ⌥1-9 dock switching, AI page rename (#903)
Call White9e38de7617d6
diff --git a/ui/src/apps/dockShortcuts.test.ts b/ui/src/apps/dockShortcuts.test.tsnew file mode 100644index 000000000..a37c1a83f--- /dev/null+++ b/ui/src/apps/dockShortcuts.test.ts@@ -0,0 +1,20 @@+import { describe, expect, it } from 'vitest';++import { dockIndexFromShortcut } from './dockShortcuts';++const chord = (overrides: Partial<KeyboardEvent> = {}) =>+ ({ altKey: true, ctrlKey: false, metaKey: false, shiftKey: false, code: 'Digit1', ...overrides }) as KeyboardEvent;++describe('dockIndexFromShortcut', () => {+ it('maps physical Digit1..Digit9 codes to zero-based Dock positions', () => {+ expect(dockIndexFromShortcut(chord({ code: 'Digit1', key: '¡' }))).toBe(0);+ expect(dockIndexFromShortcut(chord({ code: 'Digit9', key: 'ª' }))).toBe(8);+ });++ it('ignores event.key and rejects non-digit or modified chords', () => {+ expect(dockIndexFromShortcut(chord({ code: 'Numpad1', key: '1' }))).toBeNull();+ expect(dockIndexFromShortcut(chord({ code: 'Digit3', ctrlKey: true }))).toBeNull();+ expect(dockIndexFromShortcut(chord({ code: 'Digit3', shiftKey: true }))).toBeNull();+ expect(dockIndexFromShortcut(chord({ code: 'Digit3', altKey: false }))).toBeNull();+ });+});diff --git a/ui/src/apps/dockShortcuts.ts b/ui/src/apps/dockShortcuts.tsnew file mode 100644index 000000000..e84d0cb4f--- /dev/null+++ b/ui/src/apps/dockShortcuts.ts@@ -0,0 +1,8 @@+type DockShortcutEvent = Pick<KeyboardEvent, 'altKey' | 'ctrlKey' | 'metaKey' | 'shiftKey' | 'code'>;++/** Zero-based Dock index for an exact Alt/Option+1..9 chord. */+export function dockIndexFromShortcut(event: DockShortcutEvent): number | null {+ if (!event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return null;+ const match = /^Digit([1-9])$/.exec(event.code);+ return match ? Number(match[1]) - 1 : null;+}diff --git a/ui/src/components/ShowPagesPage.tsx b/ui/src/components/ShowPagesPage.tsxindex d51f21f0a..30a52967c 100644--- a/ui/src/components/ShowPagesPage.tsx+++ b/ui/src/components/ShowPagesPage.tsx@@ -1,4 +1,4 @@-import { useMemo, useState } from 'react';+import { useEffect, useMemo, useRef, useState } from 'react';import {AppWindow as AppWindowIcon,Check,@@ -7,6 +7,8 @@ import {Copy,ExternalLink,Link2,+ Loader2,+ Pencil,Plus,RefreshCw,RotateCw,@@ -18,6 +20,7 @@ import { Link } from 'react-router-dom';import clsx from 'clsx';import { useDock } from '../context/DockContext';+import { useWindowManager } from '../context/WindowManagerContext';import { copyTextToClipboard } from '../lib/utils';import { copyHref, displayLink, type ShowPageLinkInfo } from '../lib/showPageLinks';import { type ShowPage, type ShowPagesController, type Visibility } from './useShowPages';@@ -27,6 +30,7 @@ import { ShowPageShareIdField } from './workbench/ShowPageShareIdField';import { SearchField } from './settings/SettingsPrimitives';import { Button } from './ui/button';import { Badge } from './ui/badge';+import { Input } from './ui/input';import { SegmentedRadio, type SegmentedTone } from './ui/segmented';const LABEL = 'font-mono text-[10px] font-bold uppercase tracking-[0.12em] text-muted';@@ -42,6 +46,7 @@ const STATUS: Record<Visibility, { badge: 'warning' | 'info' | 'secondary'; toneinterface RowProps {page: ShowPage;+ now: number;expanded: boolean;busy: boolean;copied: boolean;@@ -49,6 +54,7 @@ interface RowProps {onOpen: () => void;onToggleExpand: () => void;onToggleInstall: (next: boolean) => void;+ onRename: (title: string | null) => Promise<void>;onSetVisibility: (visibility: Visibility) => void;onRotate: () => void;onCopy: () => void;@@ -57,6 +63,7 @@ interface RowProps {function ShowPageRow({page,+ now,expanded,busy,copied,@@ -64,6 +71,7 @@ function ShowPageRow({onOpen,onToggleExpand,onToggleInstall,+ onRename,onSetVisibility,onRotate,onCopy,@@ -79,7 +87,7 @@ function ShowPageRow({const relative = (iso: string): string => {const then = new Date(iso).getTime();if (Number.isNaN(then)) return '';- const seconds = Math.round((then - Date.now()) / 1000);+ const seconds = Math.round((then - now) / 1000);const rtf = new Intl.RelativeTimeFormat(i18n.language, { numeric: 'auto' });const abs = Math.abs(seconds);if (abs < 60) return rtf.format(Math.round(seconds), 'second');@@ -173,6 +181,8 @@ function ShowPageRow({<div className="bg-surface-2 px-5 pb-6 pt-2"><div className="grid gap-6 lg:grid-cols-[minmax(0,1fr)_300px]"><div className="flex flex-col gap-5">+ <InlineTitleRename page={page} disabled={busy} onRename={onRename} />+<div className="flex flex-col gap-2"><span className={LABEL}>{t('showPages.visibilityLabel')}</span><div className="max-w-[360px]">@@ -285,6 +295,93 @@ function ShowPageRow({);}+const InlineTitleRename: React.FC<{+ page: ShowPage;+ disabled: boolean;+ onRename: (title: string | null) => Promise<void>;+}> = ({ page, disabled, onRename }) => {+ const { t } = useTranslation();+ const [editing, setEditing] = useState(false);+ const [draft, setDraft] = useState(page.title ?? '');+ const [saving, setSaving] = useState(false);+ const inputRef = useRef<HTMLInputElement | null>(null);+ const editingRef = useRef(false);++ useEffect(() => {+ if (!editing) return;+ inputRef.current?.focus();+ inputRef.current?.select();+ }, [editing]);++ const start = () => {+ if (disabled || saving) return;+ setDraft(page.title ?? '');+ editingRef.current = true;+ setEditing(true);+ };++ const cancel = () => {+ editingRef.current = false;+ setDraft(page.title ?? '');+ setEditing(false);+ };++ const commit = () => {+ if (!editingRef.current) return;+ editingRef.current = false;+ setEditing(false);+ const next = draft.trim() || null;+ if (next === page.title) return;+ setSaving(true);+ void onRename(next)+ .catch(() => undefined)+ .finally(() => setSaving(false));+ };++ return (+ <div className="flex flex-col gap-2">+ <span className={LABEL}>{t('showPages.nameLabel')}</span>+ {editing ? (+ <Input+ ref={inputRef}+ value={draft}+ onChange={(event) => setDraft(event.target.value)}+ onBlur={commit}+ onKeyDown={(event) => {+ if (event.key === 'Enter') {+ event.preventDefault();+ commit();+ } else if (event.key === 'Escape') {+ event.preventDefault();+ event.stopPropagation();+ cancel();+ }+ }}+ placeholder={t('chat.titlePlaceholder')}+ aria-label={t('showPages.nameLabel')}+ className="h-9 max-w-[360px] px-3 text-[13px]"+ />+ ) : (+ <div className="flex max-w-[360px] items-center gap-2 rounded-lg border border-border bg-foreground/[0.03] px-3 py-2">+ <span className="min-w-0 flex-1 truncate text-[13px] text-foreground">+ {page.title?.trim() || t('chat.untitled')}+ </span>+ <button+ type="button"+ onClick={start}+ disabled={disabled || saving}+ title={t('showPages.rename')}+ aria-label={t('showPages.rename')}+ className="grid size-6 shrink-0 place-items-center rounded-md text-muted transition-colors hover:bg-foreground/[0.06] hover:text-foreground disabled:opacity-50"+ >+ {saving ? <Loader2 className="size-3.5 animate-spin" /> : <Pencil className="size-3.5" />}+ </button>+ </div>+ )}+ </div>+ );+};+// The full Show Pages inventory view (the "AI" tab): search + visibility filter +// rows that OPEN the page as an app window on click, each with a state-aware// install toggle (添加到 App ↔ 移出) and an explicit chevron for the share-link@@ -296,16 +393,24 @@ export function ShowPagesView({busyId,setVisibility,rotate,+ rename,onShareIdSaved,reload,onOpenApp,}: ShowPagesController & { onOpenApp?: (sessionId: string, title?: string) => void }) {const { t } = useTranslation();const { isPinned, pin, unpin } = useDock();+ const { windows, setParams, setTitle } = useWindowManager();const [search, setSearch] = useState('');const [filter, setFilter] = useState<ShowPageFilter>('all');const [expandedId, setExpandedId] = useState<string | null>(null);const [copiedId, setCopiedId] = useState<string | null>(null);+ const [now, setNow] = useState(() => Date.now());++ useEffect(() => {+ const timer = window.setInterval(() => setNow(Date.now()), 60_000);+ return () => window.clearInterval(timer);+ }, []);const copy = async (page: ShowPage) => {const href = copyHref(page);@@ -317,6 +422,21 @@ export function ShowPagesView({const visible = useMemo(() => filterShowPages(pages, filter, search), [pages, filter, search]);+ // The inventory is the title source for this view. Project it into matching+ // windows so optimistic edits, rollbacks, and newer session.activity events+ // all take the same ordered path instead of racing independent callbacks.+ useEffect(() => {+ pages.forEach((page) => {+ const title = page.title?.trim() || t('chat.untitled');+ windows+ .filter((win) => win.appId === 'showpage' && win.params?.sessionId === page.session_id)+ .forEach((win) => {+ if (win.title !== title) setTitle(win.id, title);+ if (win.params?.title !== title) setParams(win.id, { title });+ });+ });+ }, [pages, setParams, setTitle, t, windows]);+return (<div className="flex h-full min-h-0 flex-col"><div className="flex flex-wrap items-center justify-between gap-3 border-b border-border px-4 py-3 sm:px-5">@@ -361,6 +481,7 @@ export function ShowPagesView({<ShowPageRowkey={page.session_id}page={page}+ now={now}expanded={expandedId === page.session_id}busy={busyId === page.session_id}copied={copiedId === page.session_id}@@ -368,6 +489,7 @@ export function ShowPagesView({onOpen={() => onOpenApp?.(page.session_id, page.title ?? undefined)}onToggleExpand={() => setExpandedId((id) => (id === page.session_id ? null : page.session_id))}onToggleInstall={(next) => (next ? pin(page.session_id) : unpin(page.session_id))}+ onRename={(title) => rename(page, title)}onSetVisibility={(visibility) => setVisibility(page, visibility)}onRotate={() => rotate(page)}onCopy={() => copy(page)}diff --git a/ui/src/components/apps/Dock.tsx b/ui/src/components/apps/Dock.tsxindex 3bba082bd..956a2045a 100644--- a/ui/src/components/apps/Dock.tsx+++ b/ui/src/components/apps/Dock.tsx@@ -1,4 +1,4 @@-import { useEffect, useMemo, useRef, useState } from 'react';+import { useMemo, useRef, useState } from 'react';import { Reorder } from 'framer-motion';import { Copy, ExternalLink, LayoutGrid, PinOff, Plus, SquarePlus } from 'lucide-react';import { useTranslation } from 'react-i18next';@@ -9,6 +9,7 @@ import { showPageAvatar, showPagePrivatePath } from '../../apps/showPageAvatar';import { dockIdToSession, useDock } from '../../context/DockContext';import { useWindowManager } from '../../context/WindowManagerContext';import { ContextMenu, ContextMenuItem } from '../ui/context-menu';+import { useShowPageInventory } from '../useShowPages';// A resident Dock tile resolved from a persisted Dock id: either a built-in app// (files/terminal/editor) or a pinned Show Page (`show:<session_id>`).@@ -28,6 +29,7 @@ export const Dock: React.FC = () => {const { t } = useTranslation();const wm = useWindowManager();const { order, pins, undock, setOrder } = useDock();+ const { pages } = useShowPageInventory();const { windows, focusedId } = wm;const minimized = windows.filter((w) => w.minimized);@@ -35,30 +37,39 @@ export const Dock: React.FC = () => {const [menu, setMenu] = useState<{ x: number; y: number; item: ResidentItem } | null>(null);const pinBySession = useMemo(() => new Map(pins.map((pin) => [pin.session_id, pin])), [pins]);+ const pageBySession = useMemo(() => new Map(pages.map((page) => [page.session_id, page])), [pages]);const resolveItem = useMemo(() => {return (id: string): ResidentItem | null => {const sessionId = dockIdToSession(id);if (sessionId !== null) {- const title = pinBySession.get(sessionId)?.title_snapshot?.trim() || sessionId;+ const page = pageBySession.get(sessionId);+ const title = page+ ? page.title?.trim() || t('chat.untitled')+ : pinBySession.get(sessionId)?.title_snapshot?.trim() || sessionId;return { kind: 'showpage', id, sessionId, title };}const def = APP_REGISTRY[id as AppId];return def ? { kind: 'builtin', id, def } : null;};- }, [pinBySession]);+ }, [pageBySession, pinBySession, t]);// Local, drag-mutable copy of the order; framer's Reorder updates it live, and// it re-syncs whenever the server order changes (load / pin / unpin elsewhere).- const [localOrder, setLocalOrder] = useState<string[]>(order);- useEffect(() => setLocalOrder(order), [order]);- const localRef = useRef(localOrder);- localRef.current = localOrder;+ const [dragOrder, setDragOrder] = useState<string[] | null>(null);+ const dragRef = useRef<string[] | null>(null);+ const localOrder = dragOrder ?? order;+ const reorder = (next: string[]) => {+ dragRef.current = next;+ setDragOrder(next);+ };// Persist on drop — only when the order actually changed (a plain click can// fire a spurious drag-end), so an unchanged reorder makes no request.const commitOrder = () => {- const next = localRef.current;+ const next = dragRef.current ?? order;+ dragRef.current = null;+ setDragOrder(null);if (next.length === order.length && next.every((id, i) => id === order[i])) return;void setOrder(next);};@@ -136,8 +147,8 @@ export const Dock: React.FC = () => {apps the resident row would otherwise run off-screen (the popover sits atthe bottom-left), leaving later tiles unreachable for open/reorder/unpin. */}<div className="relative flex max-w-[min(88vw,880px)] items-end gap-2 overflow-x-auto overscroll-x-contain rounded-2xl border border-border-strong bg-surface-2/95 p-2 shadow-[0_24px_64px_-12px_rgba(0,0,0,0.65)] backdrop-blur-xl">- <Reorder.Group axis="x" values={localOrder} onReorder={setLocalOrder} as="div" className="flex items-end gap-2">- {localOrder.map((id) => {+ <Reorder.Group axis="x" values={localOrder} onReorder={reorder} as="div" className="flex items-end gap-2">+ {localOrder.map((id, index) => {const item = resolveItem(id);if (!item) return null;const running = windowsFor(item).length > 0;@@ -159,7 +170,9 @@ export const Dock: React.FC = () => {<div className="relative"><buttontype="button"- title={label}+ title={+ index < 9 ? `${label} · ${t('apps.dock.switchShortcut', { number: index + 1 })}` : label+ }aria-label={label}onClick={(e) => (e.metaKey || e.ctrlKey || e.altKey ? openNew(item) : activate(item))}onContextMenu={(e) => {diff --git a/ui/src/components/apps/MobileDockDrawer.tsx b/ui/src/components/apps/MobileDockDrawer.tsxindex b364d79a6..8cc1947a6 100644--- a/ui/src/components/apps/MobileDockDrawer.tsx+++ b/ui/src/components/apps/MobileDockDrawer.tsx@@ -7,6 +7,7 @@ import { APP_REGISTRY, type AppDefinition, type AppId } from '../../apps/registrimport { showPageAvatar } from '../../apps/showPageAvatar';import { dockIdToSession, useDock } from '../../context/DockContext';import { useAuthAccount } from '../../lib/useAuthAccount';+import { useShowPageInventory } from '../useShowPages';import { MoreAccountSection, MoreAppearanceSection, MoreConnectionSection } from '../workbench/MorePage';import { mobileRouteForDockId } from './mobileDock';@@ -30,6 +31,7 @@ export const MobileDockDrawer: React.FC<{ open: boolean; onClose: () => void }>const navigate = useNavigate();const { order, pins, undock, unpin } = useDock();const { email } = useAuthAccount();+ const { pages } = useShowPageInventory(open);// Long-press manage sheet (touch): a bottom action sheet keyed to a tile. Tap// opens the app; a press-hold opens the sheet. A cursor-positioned ContextMenu@@ -51,6 +53,7 @@ export const MobileDockDrawer: React.FC<{ open: boolean; onClose: () => void }>};const pinBySession = useMemo(() => new Map(pins.map((pin) => [pin.session_id, pin])), [pins]);+ const pageBySession = useMemo(() => new Map(pages.map((page) => [page.session_id, page])), [pages]);// Reset transient sub-surfaces while closed so a reopen starts clean — the// codebase's effect-free "adjust state during render" pattern (cf. LibraryApp's@@ -67,7 +70,10 @@ export const MobileDockDrawer: React.FC<{ open: boolean; onClose: () => void }>const resolveTile = (id: string): ResidentTile | null => {const sessionId = dockIdToSession(id);if (sessionId !== null) {- const title = pinBySession.get(sessionId)?.title_snapshot?.trim() || sessionId;+ const page = pageBySession.get(sessionId);+ const title = page+ ? page.title?.trim() || t('chat.untitled')+ : pinBySession.get(sessionId)?.title_snapshot?.trim() || sessionId;return { kind: 'showpage', id, sessionId, title };}const def = APP_REGISTRY[id as AppId];diff --git a/ui/src/components/apps/WindowLayer.tsx b/ui/src/components/apps/WindowLayer.tsxindex b26dcc9f0..bc7bb133c 100644--- a/ui/src/components/apps/WindowLayer.tsx+++ b/ui/src/components/apps/WindowLayer.tsx@@ -1,6 +1,12 @@import { useEffect, useRef, useState } from 'react';+import { useTranslation } from 'react-i18next';+import { APP_REGISTRY, type AppId } from '../../apps/registry';+import { dockIndexFromShortcut } from '../../apps/dockShortcuts';+import { dockIdToSession, useDock } from '../../context/DockContext';+import { useApi } from '../../context/ApiContext';import { useWindowManager } from '../../context/WindowManagerContext';+import { useShowPageInventory } from '../useShowPages';import { AppWindow } from './AppWindow';// In the TERMINAL, Ctrl is a control-character stream — ^W deletes a word, ^M is@@ -12,6 +18,15 @@ function inTerminalSurface(el: Element | null): boolean {return el instanceof HTMLElement && !!el.closest('.xterm');}+function inTextEntrySurface(el: Element | null): boolean {+ return (+ el instanceof HTMLElement &&+ !!el.closest(+ 'input, textarea, select, [contenteditable="true"], [role="textbox"], .monaco-editor, .xterm',+ )+ );+}+// The portal layer that hosts app windows. Covers the workbench main area (right// of the 240px sidebar on desktop). The layer itself is pointer-events-none so// empty space passes clicks through to the workbench underneath; each AppWindow@@ -19,9 +34,24 @@ function inTerminalSurface(el: Element | null): boolean {// so their terminal/editor state survives a minimize). Desktop-only — mobile opens// apps full screen (P5), so no free-floating windows there.export const WindowLayer: React.FC = () => {- const { windows, close, minimize, confirmClose } = useWindowManager();+ const { t } = useTranslation();+ const api = useApi();+ const { order, pins } = useDock();+ const { pages } = useShowPageInventory();+ const { windows, close, focus, minimize, openApp, restore, setParams, setTitle, confirmClose } =+ useWindowManager();const ref = useRef<HTMLDivElement | null>(null);const [size, setSize] = useState({ w: 0, h: 0 });+ const windowsRef = useRef(windows);+ const dockRef = useRef({ order, pins, pages });++ useEffect(() => {+ windowsRef.current = windows;+ }, [windows]);++ useEffect(() => {+ dockRef.current = { order, pins, pages };+ }, [order, pages, pins]);useEffect(() => {const el = ref.current;@@ -62,6 +92,79 @@ export const WindowLayer: React.FC = () => {return () => window.removeEventListener('keydown', onKeyDown);}, [close, minimize, confirmClose]);+ // Alt/Option+1..9 focuses or launches the Nth resident tile in the current+ // server-backed Dock order. Use `code`, not `key`: macOS keyboard layouts can+ // turn Option+digit into punctuation. Text inputs and terminals keep the chord+ // for character entry; the Windows layer is desktop-only.+ useEffect(() => {+ const onKeyDown = (e: KeyboardEvent) => {+ if (!window.matchMedia?.('(min-width: 768px)').matches) return;+ const index = dockIndexFromShortcut(e);+ const target = e.target instanceof Element ? e.target : document.activeElement;+ if (index === null || inTextEntrySurface(target)) return;+ const dockId = dockRef.current.order[index];+ if (!dockId) return;++ const sessionId = dockIdToSession(dockId);+ const appId: AppId = sessionId === null ? (dockId as AppId) : 'showpage';+ if (sessionId === null && !APP_REGISTRY[appId]) return;++ e.preventDefault();+ const own = windowsRef.current.filter((win) =>+ sessionId === null+ ? win.appId === appId+ : win.appId === 'showpage' && win.params?.sessionId === sessionId,+ );+ const visible = own.filter((win) => !win.minimized);+ const focusWindowDom = (id: string) =>+ document.querySelector<HTMLElement>(`[data-window-id="${id}"]`)?.focus({ preventScroll: true });+ if (visible.length > 0) {+ const target = visible.reduce((top, win) => (win.z > top.z ? win : top));+ focus(target.id);+ focusWindowDom(target.id);+ return;+ }+ if (own.length > 0) {+ const target = own.reduce((top, win) => (win.z > top.z ? win : top));+ restore(target.id);+ focusWindowDom(target.id);+ return;+ }+ if (sessionId === null) {+ const id = openApp(appId);+ window.requestAnimationFrame(() => focusWindowDom(id));+ return;+ }+ const page = dockRef.current.pages.find((candidate) => candidate.session_id === sessionId);+ const snapshot = dockRef.current.pins.find((pin) => pin.session_id === sessionId)?.title_snapshot?.trim();+ const title = page ? page.title?.trim() || t('chat.untitled') : snapshot || t('chat.untitled');+ const id = openApp('showpage', { title, params: { sessionId, title } });+ window.requestAnimationFrame(() => focusWindowDom(id));+ };+ window.addEventListener('keydown', onKeyDown);+ return () => window.removeEventListener('keydown', onKeyDown);+ }, [focus, openApp, restore, t]);++ // Session PATCHes already broadcast `session.activity`. Keep every open+ // Show Page window's persisted title/params live when a rename comes from the+ // Library, chat header, CLI, or another browser tab.+ useEffect(+ () =>+ api.connectWorkbenchEvents({+ onSessionActivity: (data) => {+ if (data.event !== 'updated' || !Object.prototype.hasOwnProperty.call(data, 'title')) return;+ const title = data.title?.trim() || t('chat.untitled');+ windowsRef.current+ .filter((win) => win.appId === 'showpage' && win.params?.sessionId === data.session_id)+ .forEach((win) => {+ setTitle(win.id, title);+ setParams(win.id, { title });+ });+ },+ }),+ [api, setParams, setTitle, t],+ );+// Render every window — minimized ones stay mounted (hidden + inert via AppWindow)// so their app body keeps its state. The layer is only aria-hidden when nothing is// actually shown.diff --git a/ui/src/components/useShowPages.test.ts b/ui/src/components/useShowPages.test.tsnew file mode 100644index 000000000..b63eca120--- /dev/null+++ b/ui/src/components/useShowPages.test.ts@@ -0,0 +1,33 @@+import { describe, expect, it } from 'vitest';++import { replaceShowPageTitleIfCurrent, type ShowPage } from './useShowPages';++const page = (title: string | null): ShowPage => ({+ session_id: 'session-1',+ visibility: 'private',+ title,+ platform: null,+ agent: null,+ path: '/tmp/show',+ active_url: null,+ private_url: null,+ public_url: null,+ url_available: false,+ share_id: null,+ offline: false,+ offline_at: null,+ created_at: '2026-01-01T00:00:00Z',+ updated_at: '2026-01-01T00:00:00Z',+});++describe('replaceShowPageTitleIfCurrent', () => {+ it('applies a matching optimistic rollback', () => {+ expect(replaceShowPageTitleIfCurrent([page('Draft')], 'session-1', 'Draft', 'Original')[0].title)+ .toBe('Original');+ });++ it('preserves a newer title when an older request settles', () => {+ const pages = [page('Newer title')];+ expect(replaceShowPageTitleIfCurrent(pages, 'session-1', 'Draft', 'Original')).toBe(pages);+ });+});diff --git a/ui/src/components/useShowPages.ts b/ui/src/components/useShowPages.tsindex f09feb476..b4f1147f4 100644--- a/ui/src/components/useShowPages.ts+++ b/ui/src/components/useShowPages.ts@@ -1,4 +1,4 @@-import { useCallback, useEffect, useState } from 'react';+import { useCallback, useEffect, useRef, useState } from 'react';import { useTranslation } from 'react-i18next';import { useApi } from '../context/ApiContext';@@ -25,6 +25,122 @@ export interface ShowPage {updated_at: string;}+type ShowPagePatch = Pick<ShowPage, 'session_id'> & Partial<ShowPage>;++export function replaceShowPageTitleIfCurrent(+ pages: ShowPage[],+ sessionId: string,+ expectedTitle: string | null,+ nextTitle: string | null,+): ShowPage[] {+ const index = pages.findIndex(+ (page) => page.session_id === sessionId && page.title === expectedTitle,+ );+ if (index < 0) return pages;+ const next = [...pages];+ next[index] = { ...next[index], title: nextTitle };+ return next;+}++// Read-side Show Page inventory shared by the Library, Dock, and global search.+// Session-title edits already publish `session.activity`; subscribe here so each+// mounted projection prefers the live title while `title_snapshot` remains only+// an offline/missing-page fallback.+export function useShowPageInventory(enabled = true) {+ const api = useApi();+ const [pages, setPages] = useState<ShowPage[]>([]);+ const [loading, setLoading] = useState(false);+ const [loaded, setLoaded] = useState(false);+ const [loadRequest, setLoadRequest] = useState(0);+ const loadSeqRef = useRef(0);+ const revisionRef = useRef(0);+ const pagesRef = useRef(pages);+ const loadedRef = useRef(loaded);+ pagesRef.current = pages;+ loadedRef.current = loaded;++ const requestLoad = useCallback(() => setLoadRequest((request) => request + 1), []);++ const mergePage = useCallback((next: ShowPagePatch) => {+ revisionRef.current += 1;+ setPages((prev) =>+ prev.map((page) => (page.session_id === next.session_id ? { ...page, ...next } : page)),+ );+ }, []);++ const removePage = useCallback((sessionId: string) => {+ revisionRef.current += 1;+ setPages((prev) => prev.filter((page) => page.session_id !== sessionId));+ }, []);++ const replaceTitleIfCurrent = useCallback(+ (sessionId: string, expectedTitle: string | null, nextTitle: string | null) => {+ revisionRef.current += 1;+ setPages((prev) =>+ replaceShowPageTitleIfCurrent(prev, sessionId, expectedTitle, nextTitle),+ );+ },+ [],+ );++ const load = useCallback(async () => {+ if (!enabled) return;+ const seq = (loadSeqRef.current += 1);+ const revision = revisionRef.current;+ setLoading(true);+ try {+ const res = (await api.getShowPages()) as { pages?: unknown };+ if (seq !== loadSeqRef.current) return;+ if (revision !== revisionRef.current) {+ requestLoad();+ return;+ }+ setPages(Array.isArray(res.pages) ? (res.pages as ShowPage[]) : []);+ setLoaded(true);+ } catch {+ if (seq === loadSeqRef.current) setLoaded(true);+ } finally {+ if (seq === loadSeqRef.current) setLoading(false);+ }+ }, [api, enabled, requestLoad]);++ useEffect(() => {+ if (enabled) void load();+ }, [enabled, load, loadRequest]);++ useEffect(() => {+ if (!enabled) return;+ return api.connectWorkbenchEvents({+ onConnected: requestLoad,+ onSessionActivity: (data) => {+ if (data.event === 'archived') {+ if (pagesRef.current.some((page) => page.session_id === data.session_id)) {+ removePage(data.session_id);+ } else if (!loadedRef.current) {+ requestLoad();+ }+ return;+ }+ if (data.event === 'updated' && Object.prototype.hasOwnProperty.call(data, 'title')) {+ if (pagesRef.current.some((page) => page.session_id === data.session_id)) {+ mergePage({ session_id: data.session_id, title: data.title ?? null });+ } else if (!loadedRef.current) {+ requestLoad();+ }+ return;+ }+ // Runtime Show activity can materialize a page outside this browser.+ // Normal session/user-message events do not change this inventory.+ if (data.event === 'show_event') requestLoad();+ },+ });+ }, [api, enabled, mergePage, removePage, requestLoad]);++ const reload = requestLoad;++ return { pages, loading, loaded, mergePage, replaceTitleIfCurrent, reload };+}+// The Show Pages inventory: fetch + the visibility / share-id / rotate mutations,// with their toasts. Lifted out of the view so the App Library owns one copy of// the pages state and projects it into both the Apps and Show Pages views (kept@@ -33,23 +149,9 @@ export function useShowPages() {const api = useApi();const { showToast } = useToast();const { t } = useTranslation();- const [pages, setPages] = useState<ShowPage[]>([]);+ const { pages, loading, loaded, mergePage, replaceTitleIfCurrent, reload } =+ useShowPageInventory();const [busyId, setBusyId] = useState<string | null>(null);- const [refreshTrigger, setRefreshTrigger] = useState(0);-- const load = useCallback(() => {- api- .getShowPages()- .then((res: any) => setPages(Array.isArray(res?.pages) ? res.pages : []))- .catch(() => {});- }, [api]);-- useEffect(() => {- load();- }, [load, refreshTrigger]);-- const mergePage = (next: ShowPage) =>- setPages((prev) => prev.map((page) => (page.session_id === next.session_id ? { ...page, ...next } : page)));const setVisibility = async (page: ShowPage, visibility: Visibility) => {if (page.visibility === visibility || busyId) return;@@ -86,9 +188,21 @@ export function useShowPages() {showToast(t('showPages.shareId.toast.saved'));};- const reload = useCallback(() => setRefreshTrigger((v) => v + 1), []);+ const rename = async (page: ShowPage, title: string | null) => {+ const previousTitle = page.title?.trim() || null;+ const nextTitle = title?.trim() || null;+ if (nextTitle === previousTitle) return;+ mergePage({ session_id: page.session_id, title: nextTitle });+ try {+ const updated = await api.updateSession(page.session_id, { title: nextTitle });+ replaceTitleIfCurrent(page.session_id, nextTitle, updated.title?.trim() || null);+ } catch (error) {+ replaceTitleIfCurrent(page.session_id, nextTitle, previousTitle);+ throw error;+ }+ };- return { pages, busyId, setVisibility, rotate, onShareIdSaved, reload };+ return { pages, loading, loaded, busyId, setVisibility, rotate, rename, onShareIdSaved, reload };}export type ShowPagesController = ReturnType<typeof useShowPages>;diff --git a/ui/src/components/workbench/SearchPage.tsx b/ui/src/components/workbench/SearchPage.tsxindex dd15aeb3e..8fd01c0c1 100644--- a/ui/src/components/workbench/SearchPage.tsx+++ b/ui/src/components/workbench/SearchPage.tsx@@ -6,9 +6,11 @@ import { AlertCircle, ChevronLeft, Loader2, Search, X } from 'lucide-react';import { useMessageSearch } from '../../lib/useMessageSearch';import { Button } from '../ui/button';import { Input } from '../ui/input';+import { AppSearchResultSection } from './search/AppSearchResults';import { SearchResultGroup } from './search/SearchResultGroup';+import { useAppSearchResults, useOpenSearchApp } from './search/useAppSearch';-// Mobile full-screen message-content search (design.pen K7Bytg "M · Search+// Mobile full-screen app + message-content search (design.pen K7Bytg "M · Search// results"). A focused surface with its OWN header (back chevron + an active// search field with mint glyph + clear ✕) over the grouped results — reached// from the Inbox search field (InboxPage) / the bottom-nav is hidden on@@ -27,6 +29,8 @@ export const SearchPage: React.FC = () => {const [searchParams, setSearchParams] = useSearchParams();const [query, setQuery] = useState(() => searchParams.get('q') ?? '');const { results, loading, error } = useMessageSearch(query);+ const { results: appResults, loading: appsLoading } = useAppSearchResults(query);+ const openSearchApp = useOpenSearchApp();const inputRef = useRef<HTMLInputElement | null>(null);// Drive the query (state + URL together). ``replace: true`` so each keystroke@@ -75,10 +79,10 @@ export const SearchPage: React.FC = () => {const trimmed = query.trim();const sessions = results?.sessions ?? [];- const hasResults = sessions.length > 0;+ const hasResults = appResults.length > 0 || sessions.length > 0;const showHint = trimmed.length === 0;const showError = trimmed.length > 0 && !loading && !!error;- const showEmpty = trimmed.length > 0 && !loading && results !== null && !hasResults;+ const showEmpty = trimmed.length > 0 && !loading && !appsLoading && results !== null && !hasResults;return (// Full-screen focused surface (like ChatPage): fixed over the shell, its own@@ -112,7 +116,7 @@ export const SearchPage: React.FC = () => {autoCorrect="off"enterKeyHint="search"/>- {loading && <Loader2 className="size-4 shrink-0 animate-spin text-muted" />}+ {(loading || appsLoading) && <Loader2 className="size-4 shrink-0 animate-spin text-muted" />}<Buttontype="button"variant="ghost"@@ -149,6 +153,7 @@ export const SearchPage: React.FC = () => {)}{hasResults && (<div className="flex flex-col gap-1.5">+ <AppSearchResultSection results={appResults} onSelect={openSearchApp} />{sessions.map((session) => (<SearchResultGroupkey={session.session_id}diff --git a/ui/src/components/workbench/search/AppSearchResults.tsx b/ui/src/components/workbench/search/AppSearchResults.tsxnew file mode 100644index 000000000..efe792688--- /dev/null+++ b/ui/src/components/workbench/search/AppSearchResults.tsx@@ -0,0 +1,78 @@+import { useTranslation } from 'react-i18next';+import { LayoutGrid } from 'lucide-react';+import clsx from 'clsx';++import { APP_REGISTRY } from '../../../apps/registry';+import { ShowPageAvatarTile } from '../../../apps/showPageAvatarTile';+import { Button } from '../../ui/button';+import type { AppSearchResult } from './appSearch';++type AppSearchResultSectionProps = {+ results: AppSearchResult[];+ selectedKey?: string;+ onSelect: (result: AppSearchResult) => void;+};++export const AppSearchResultSection: React.FC<AppSearchResultSectionProps> = ({+ results,+ selectedKey,+ onSelect,+}) => {+ const { t } = useTranslation();+ if (results.length === 0) return null;++ return (+ <section className="flex flex-col" aria-label={t('workbench.search.appsSection')}>+ <div className="flex items-center gap-1.5 px-2.5 py-1.5">+ <LayoutGrid className="size-[13px] shrink-0 text-muted" />+ <span className="min-w-0 flex-1 font-mono text-[11px] font-bold text-muted">+ {t('workbench.search.appsSection')}+ </span>+ <span className="shrink-0 font-mono text-[10px] text-muted">{results.length}</span>+ </div>+ <div className="flex flex-col">+ {results.map((result) => {+ const selected = selectedKey === result.key;+ const def = APP_REGISTRY[result.appId];+ const Icon = def.icon;+ return (+ <Button+ key={result.key}+ type="button"+ variant="ghost"+ onClick={() => onSelect(result)}+ aria-current={selected ? 'true' : undefined}+ className={clsx(+ 'h-auto w-full justify-start gap-2.5 px-2.5 py-2 text-left font-normal',+ selected+ ? 'bg-mint-soft ring-1 ring-inset ring-mint/40 hover:bg-mint-soft'+ : 'hover:bg-foreground/[0.04]',+ )}+ >+ {result.kind === 'showpage' && result.sessionId ? (+ <ShowPageAvatarTile+ sessionId={result.sessionId}+ title={result.title}+ className="size-7 rounded-md"+ />+ ) : (+ <span+ className="grid size-7 shrink-0 place-items-center rounded-md border border-border bg-foreground/[0.03]"+ style={{ color: `var(${def.accent})` }}+ >+ <Icon className="size-3.5" />+ </span>+ )}+ <span className="min-w-0 flex-1 truncate text-[13px] font-medium text-foreground">+ {result.title}+ </span>+ <span className="shrink-0 font-mono text-[10px] text-muted">+ {result.kind === 'showpage' ? t('library.kind.showPage') : t('library.kind.builtin')}+ </span>+ </Button>+ );+ })}+ </div>+ </section>+ );+};diff --git a/ui/src/components/workbench/search/SearchPalette.tsx b/ui/src/components/workbench/search/SearchPalette.tsxindex b63fc04fe..260e3a36d 100644--- a/ui/src/components/workbench/search/SearchPalette.tsx+++ b/ui/src/components/workbench/search/SearchPalette.tsx@@ -7,7 +7,9 @@ import { AlertCircle, Loader2, Search } from 'lucide-react';import { useMessageSearch } from '../../../lib/useMessageSearch';import { Dialog, DialogOverlay, DialogPortal, DialogTitle } from '../../ui/dialog';import { Input } from '../../ui/input';+import { AppSearchResultSection } from './AppSearchResults';import { SearchResultGroup } from './SearchResultGroup';+import { useAppSearchResults, useOpenSearchApp } from './useAppSearch';type SearchPaletteProps = {open: boolean;@@ -26,64 +28,59 @@ const FooterHint: React.FC<{ keyLabel: string; label: string }> = ({ keyLabel, l</span>);-// Desktop ⌘K command palette for message-content search (design.pen sUCZo).+// Desktop ⌘K command palette for global app + 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).+// <SearchResultGroup>, and a footer of keyboard hints. Message hits stay+// server-driven; the Apps section filters the built-in registry + Show Pages+// inventory client-side. Selecting a message routes to /chat/<session>?msg=<message>.export const SearchPalette: React.FC<SearchPaletteProps> = ({ open, onClose }) => {const { t } = useTranslation();const navigate = useNavigate();const [query, setQuery] = useState('');const { results, loading, error } = useMessageSearch(query);+ const { results: appResults, loading: appsLoading } = useAppSearchResults(query, open);+ const openSearchApp = useOpenSearchApp();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 })),+ // One flat navigation order: Apps first, then the existing message groups.+ const flatTargets = useMemo(+ () => [+ ...appResults.map((result) => ({ kind: 'app' as const, key: `app:${result.key}`, result })),+ ...(results?.sessions ?? []).flatMap((session) =>+ session.matches.map((match) => ({+ kind: 'message' as const,+ key: `message:${session.session_id}:${match.id}`,+ sessionId: session.session_id,+ messageId: match.id,+ })),),- [results],+ ],+ [appResults, 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 [selectedKey, setSelectedKey] = useState<string | null>(null);+ // A changed result set falls back to its first row without a state-sync+ // effect. Arrow navigation only stores an explicit key while it stays valid.+ const selectedTarget = flatTargets.find((target) => target.key === selectedKey) ?? flatTargets[0];const handleSelect = (sessionId: string, messageId: string) => {navigate(`/chat/${encodeURIComponent(sessionId)}?msg=${encodeURIComponent(messageId)}`);onClose();};+ const handleAppSelect = (result: (typeof appResults)[number]) => {+ openSearchApp(result);+ 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);+ if (flatTargets.length === 0) return;+ const idx = flatTargets.findIndex((target) => target.key === selectedTarget?.key);+ const next = idx < 0 ? 0 : (idx + delta + flatTargets.length) % flatTargets.length;+ setSelectedKey(flatTargets[next].key);};const onKeyDown = (e: React.KeyboardEvent) => {@@ -106,8 +103,8 @@ export const SearchPalette: React.FC<SearchPaletteProps> = ({ open, onClose }) =// row activates instead of the (possibly different) arrow-selected one.if (document.activeElement !== inputRef.current) return;e.preventDefault();- const target = flatMatches.find((m) => m.messageId === selectedId);- if (target) handleSelect(target.sessionId, target.messageId);+ if (selectedTarget?.kind === 'app') handleAppSelect(selectedTarget.result);+ else if (selectedTarget) handleSelect(selectedTarget.sessionId, selectedTarget.messageId);}};@@ -115,15 +112,16 @@ export const SearchPalette: React.FC<SearchPaletteProps> = ({ open, onClose }) =// 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;+ if (!selectedTarget || !listRef.current) return;const el = listRef.current.querySelector<HTMLElement>('[aria-current="true"]');el?.scrollIntoView({ block: 'nearest' });- }, [selectedId]);+ }, [selectedTarget]);const trimmed = query.trim();- const hasResults = (results?.sessions.length ?? 0) > 0;+ const hasMessageResults = (results?.sessions.length ?? 0) > 0;+ const hasResults = appResults.length > 0 || hasMessageResults;const showError = trimmed.length > 0 && !loading && !!error;- const showEmpty = trimmed.length > 0 && !loading && results !== null && !hasResults;+ const showEmpty = trimmed.length > 0 && !loading && !appsLoading && results !== null && !hasResults;const showHint = trimmed.length === 0;return (@@ -136,6 +134,8 @@ export const SearchPalette: React.FC<SearchPaletteProps> = ({ open, onClose }) =// Focus the query field rather than the first row, so typing flows// straight into the search input.e.preventDefault();+ setQuery('');+ setSelectedKey(null);inputRef.current?.focus();}}aria-describedby={undefined}@@ -150,14 +150,17 @@ export const SearchPalette: React.FC<SearchPaletteProps> = ({ open, onClose }) =ref={inputRef}variant="bare"value={query}- onChange={(e) => setQuery(e.target.value)}+ onChange={(e) => {+ setQuery(e.target.value);+ setSelectedKey(null);+ }}placeholder={t('workbench.search.placeholder')}className="min-w-0 flex-1 text-[17px]"aria-label={t('workbench.search.placeholder')}spellCheck={false}autoComplete="off"/>- {loading && <Loader2 className="size-4 shrink-0 animate-spin text-muted" />}+ {(loading || appsLoading) && <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>@@ -185,11 +188,20 @@ export const SearchPalette: React.FC<SearchPaletteProps> = ({ open, onClose }) =)}{hasResults && (<div className="flex flex-col gap-1.5">- {results!.sessions.map((session) => (+ <AppSearchResultSection+ results={appResults}+ selectedKey={selectedTarget?.kind === 'app' ? selectedTarget.result.key : undefined}+ onSelect={handleAppSelect}+ />+ {(results?.sessions ?? []).map((session) => (<SearchResultGroupkey={session.session_id}session={session}- selectedId={selectedId ?? undefined}+ selectedId={+ selectedTarget?.kind === 'message' && selectedTarget.sessionId === session.session_id+ ? selectedTarget.messageId+ : undefined+ }onSelect={(match) => handleSelect(session.session_id, match.id)}/>))}diff --git a/ui/src/components/workbench/search/appSearch.test.ts b/ui/src/components/workbench/search/appSearch.test.tsnew file mode 100644index 000000000..edd94a803--- /dev/null+++ b/ui/src/components/workbench/search/appSearch.test.ts@@ -0,0 +1,50 @@+import { describe, expect, it } from 'vitest';++import { filterAppSearchResults, type AppSearchResult } from './appSearch';++const results: AppSearchResult[] = [+ { key: 'builtin:files', kind: 'builtin', appId: 'files', title: 'Files', searchTitle: 'Files' },+ {+ key: 'show:installed',+ kind: 'showpage',+ appId: 'showpage',+ title: 'Sales dashboard',+ searchTitle: 'Sales dashboard',+ sessionId: 'installed',+ },+ {+ key: 'show:inventory-only',+ kind: 'showpage',+ appId: 'showpage',+ title: 'Incident review',+ searchTitle: 'Incident review',+ sessionId: 'inventory-only',+ },+ {+ key: 'show:untitled',+ kind: 'showpage',+ appId: 'showpage',+ title: 'Untitled session',+ searchTitle: '',+ sessionId: 'untitled',+ },+];++describe('filterAppSearchResults', () => {+ it('matches built-ins and every matching AI page regardless of install state', () => {+ expect(filterAppSearchResults(results, 'files').map((result) => result.key)).toEqual(['builtin:files']);+ expect(filterAppSearchResults(results, 'review').map((result) => result.key)).toEqual([+ 'show:inventory-only',+ ]);+ });++ it('normalizes case and surrounding whitespace', () => {+ expect(filterAppSearchResults(results, ' DASHBOARD ').map((result) => result.key)).toEqual([+ 'show:installed',+ ]);+ });++ it('does not match an untitled page by its session id', () => {+ expect(filterAppSearchResults(results, 'untitled')).toEqual([]);+ });+});diff --git a/ui/src/components/workbench/search/appSearch.ts b/ui/src/components/workbench/search/appSearch.tsnew file mode 100644index 000000000..48ed9624a--- /dev/null+++ b/ui/src/components/workbench/search/appSearch.ts@@ -0,0 +1,16 @@+import type { AppId } from '../../../apps/registry';++export type AppSearchResult = {+ key: string;+ kind: 'builtin' | 'showpage';+ appId: AppId;+ title: string;+ searchTitle: string;+ sessionId?: string;+};++export function filterAppSearchResults(results: AppSearchResult[], query: string): AppSearchResult[] {+ const normalized = query.trim().toLocaleLowerCase();+ if (!normalized) return [];+ return results.filter((result) => result.searchTitle.toLocaleLowerCase().includes(normalized));+}diff --git a/ui/src/components/workbench/search/useAppSearch.ts b/ui/src/components/workbench/search/useAppSearch.tsnew file mode 100644index 000000000..efe0626ec--- /dev/null+++ b/ui/src/components/workbench/search/useAppSearch.ts@@ -0,0 +1,75 @@+import { useCallback, useMemo } from 'react';+import { useTranslation } from 'react-i18next';+import { useLocation, useNavigate } from 'react-router-dom';++import { APP_LIST } from '../../../apps/registry';+import { showAppRoutePath } from '../../apps/mobileDock';+import { useShowPageInventory } from '../../useShowPages';+import { useWindowManager } from '../../../context/WindowManagerContext';+import { filterAppSearchResults, type AppSearchResult } from './appSearch';++export function useAppSearchResults(query: string, enabled = true) {+ const { t } = useTranslation();+ const { pages, loading, loaded } = useShowPageInventory(enabled);+ const candidates = useMemo<AppSearchResult[]>(+ () => [+ ...APP_LIST.map((def) => {+ const title = t(def.titleKey);+ return {+ key: `builtin:${def.id}`,+ kind: 'builtin' as const,+ appId: def.id,+ title,+ searchTitle: title,+ };+ }),+ ...pages.map((page) => {+ const liveTitle = page.title?.trim() ?? '';+ return {+ key: `show:${page.session_id}`,+ kind: 'showpage' as const,+ appId: 'showpage' as const,+ title: liveTitle || t('chat.untitled'),+ searchTitle: liveTitle,+ sessionId: page.session_id,+ };+ }),+ ],+ [pages, t],+ );+ const results = useMemo(() => filterAppSearchResults(candidates, query), [candidates, query]);++ return { results, loading: enabled && (loading || !loaded) };+}++export function useOpenSearchApp() {+ const wm = useWindowManager();+ const navigate = useNavigate();+ const location = useLocation();++ return useCallback(+ (result: AppSearchResult) => {+ const desktop = typeof window !== 'undefined' && !!window.matchMedia?.('(min-width: 768px)').matches;+ if (desktop) {+ wm.openApp(result.appId, {+ title: result.kind === 'showpage' ? result.title : undefined,+ params:+ result.kind === 'showpage'+ ? { sessionId: result.sessionId, title: result.title }+ : undefined,+ });+ if (location.pathname === '/search') {+ if (location.key === 'default') navigate('/inbox', { replace: true });+ else navigate(-1);+ }+ return;+ }+ if (result.kind === 'showpage') {+ if (result.sessionId) navigate(showAppRoutePath(result.sessionId));+ } else {+ navigate(`/apps/${result.appId}`);+ }+ },+ [location.key, location.pathname, navigate, wm],+ );+}diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.jsonindex 5ea6b8e7c..daf32298e 100644--- a/ui/src/i18n/en.json+++ b/ui/src/i18n/en.json@@ -174,6 +174,8 @@},"empty": "No Show Pages yet. They appear here once an agent session creates one.","emptyFiltered": "No Show Pages match this filter.",+ "nameLabel": "Name",+ "rename": "Rename","visibilityLabel": "Visibility","visibilityOffline": "Offline","liveLink": "Live link",@@ -732,6 +734,7 @@},"dock": {"newInstanceHint": "⌘-click for a new window",+ "switchShortcut": "⌥{{number}}","newWindow": "New Window","showAllWindows": "Show All Windows","openInNewTab": "Open in New Tab",@@ -1012,17 +1015,18 @@"search": {"roleYou": "You","roleAgent": "Agent",- "title": "Search messages",- "entry": "Search messages",- "placeholder": "Search messages",- "hint": "Search your messages",- "empty": "No messages found",+ "title": "Search",+ "entry": "Search",+ "placeholder": "Search apps and messages",+ "hint": "Search apps and messages",+ "empty": "No apps or messages found","error": "Search failed — try again.",+ "appsSection": "Apps","kbdEsc": "Esc","kbdNavigate": "Navigate","kbdOpen": "Open","kbdClose": "Close",- "footerNote": "Searching message content · all sessions",+ "footerNote": "Apps and message content · all sessions","scopeAll": "all sessions"},"inbox": {diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.jsonindex 4c73ba0aa..64b5f3aa6 100644--- a/ui/src/i18n/zh.json+++ b/ui/src/i18n/zh.json@@ -174,6 +174,8 @@},"empty": "暂无展示页面。当 Agent 会话创建展示页面后会显示在这里。","emptyFiltered": "没有符合该筛选条件的展示页面。",+ "nameLabel": "名称",+ "rename": "重命名","visibilityLabel": "可见性","visibilityOffline": "下线","liveLink": "访问链接",@@ -732,6 +734,7 @@},"dock": {"newInstanceHint": "⌘ 点击可新建窗口",+ "switchShortcut": "⌥{{number}}","newWindow": "新建窗口","showAllWindows": "显示所有窗口","openInNewTab": "在新标签页打开",@@ -1012,17 +1015,18 @@"search": {"roleYou": "你","roleAgent": "助手",- "title": "搜索消息",- "entry": "搜索消息",- "placeholder": "搜索消息",- "hint": "搜索你的消息",- "empty": "未找到消息",+ "title": "搜索",+ "entry": "搜索",+ "placeholder": "搜索应用与消息",+ "hint": "搜索应用与消息",+ "empty": "未找到应用或消息","error": "搜索失败,请重试。",+ "appsSection": "应用","kbdEsc": "Esc","kbdNavigate": "切换","kbdOpen": "打开","kbdClose": "关闭",- "footerNote": "搜索消息内容 · 全部会话",+ "footerNote": "应用与消息内容 · 全部会话","scopeAll": "全部会话"},"inbox": {