Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
feat(plugin-launcher): unify tiles, pin in place, and size the panel to content
v_wyxgwangfb8827f76af7
diff --git a/apps/desktop/electron/main/bootstrap/launcher.ts b/apps/desktop/electron/main/bootstrap/launcher.tsindex f09faff51..84d2a9d8f 100644--- a/apps/desktop/electron/main/bootstrap/launcher.ts+++ b/apps/desktop/electron/main/bootstrap/launcher.ts@@ -17,7 +17,7 @@ import { suppressLinuxFramelessSystemMenu } from "../frameless-system-menu";import {PLUGIN_LAUNCHER_MAX_HEIGHT,PLUGIN_LAUNCHER_MAX_WIDTH,- PLUGIN_LAUNCHER_MIN_HEIGHT,+ PLUGIN_LAUNCHER_MIN_CONTENT_HEIGHT,PLUGIN_LAUNCHER_MIN_WIDTH,readLauncherWindowState,resolveLauncherBounds,@@ -131,7 +131,9 @@ export function createLauncher({// columns stay aligned from the minimum width up.resizable: true,minWidth: PLUGIN_LAUNCHER_MIN_WIDTH,- minHeight: PLUGIN_LAUNCHER_MIN_HEIGHT,+ // Height follows the measured content, so only the floor is set here;+ // the renderer reports the real height on show.+ minHeight: PLUGIN_LAUNCHER_MIN_CONTENT_HEIGHT,maxWidth: PLUGIN_LAUNCHER_MAX_WIDTH,maxHeight: PLUGIN_LAUNCHER_MAX_HEIGHT,minimizable: false,diff --git a/apps/desktop/electron/main/index.ts b/apps/desktop/electron/main/index.tsindex 2590ff840..2da967b78 100644--- a/apps/desktop/electron/main/index.ts+++ b/apps/desktop/electron/main/index.ts@@ -930,6 +930,9 @@ function registerIpc() {pluginServices.composerSuggestion.settle(answer),getPluginLauncherWindow: () => mainState.pluginLauncherWindow,togglePluginLauncher,+ /** Same delivery path as the application menu, so readiness and focus are+ * handled once instead of by the launcher IPC. */+ openPluginMarket: () => dispatchApplicationMenuCommand("openPluginMarket"),safeOpenExternal,updater,dataDir,diff --git a/apps/desktop/electron/main/ipc/plugin-launcher-ipc.ts b/apps/desktop/electron/main/ipc/plugin-launcher-ipc.tsindex 63a877998..aa508e2cd 100644--- a/apps/desktop/electron/main/ipc/plugin-launcher-ipc.ts+++ b/apps/desktop/electron/main/ipc/plugin-launcher-ipc.ts@@ -26,6 +26,7 @@ import {} from "@pi-desktop/shared";import type { HostProcess } from "../host-process";import type { LocalAppCatalog } from "../local-apps";+import { clampLauncherContentHeight } from "../plugin-launcher-state.ts";import type { PluginRuntime } from "../plugin-runtime";import type { IpcRegistrar } from "./types";@@ -40,6 +41,11 @@ export type PluginLauncherIpcDependencies = {getPluginLauncherWindow: () => BrowserWindow | null;plugins: PluginRuntime;localApps: LocalAppCatalog;+ /**+ * Show the main window on the plugin market page. The launcher cannot+ * navigate the shell itself, so it hands the request to the orchestrator.+ */+ openPluginMarket: () => void;/** Active app locale, used to resolve a localized trigger title. */getLocale: () => string;};@@ -177,6 +183,7 @@ export function registerPluginLauncherIpc({plugins,localApps,getLocale,+ openPluginMarket,}: PluginLauncherIpcDependencies): void {const { handleWithEvent } = registrar;@@ -219,4 +226,43 @@ export function registerPluginLauncherIpc({return { ok: true };},);++ /**+ * Size the panel to the content it just rendered.+ *+ * Only the launcher may call this, the value must be a finite positive number,+ * and it is clamped to the supported range — the width keeps whatever the user+ * dragged it to, because height is the only dimension the content decides.+ */+ handleWithEvent(+ IPC.invoke.pluginLauncherContentHeight,+ async (event, request: { height?: unknown }): Promise<{ height: number }> => {+ assertLauncherSender(getPluginLauncherWindow, event.sender.id);+ const height = clampLauncherContentHeight(request?.height);+ if (height === null) throw new Error("launcher content height is required");+ const window = getPluginLauncherWindow();+ if (!window || window.isDestroyed()) throw new Error("launcher window is gone");+ const [width] = window.getContentSize();+ window.setContentSize(width, height, false);+ return { height };+ },+ );++ /**+ * Leave the panel and send the user to the plugin market.+ *+ * The launcher renders in its own window and cannot navigate the shell, so it+ * asks the orchestrator to focus the main window and deliver the same+ * `openPluginMarket` command the application menu uses.+ */+ handleWithEvent(+ IPC.invoke.pluginLauncherOpenMarket,+ async (event): Promise<{ ok: true }> => {+ assertLauncherSender(getPluginLauncherWindow, event.sender.id);+ const launcher = getPluginLauncherWindow();+ if (launcher && !launcher.isDestroyed()) launcher.hide();+ openPluginMarket();+ return { ok: true };+ },+ );}diff --git a/apps/desktop/electron/main/ipc/register.ts b/apps/desktop/electron/main/ipc/register.tsindex ca2c88981..86d4f7c99 100644--- a/apps/desktop/electron/main/ipc/register.ts+++ b/apps/desktop/electron/main/ipc/register.ts@@ -110,6 +110,7 @@ export function registerIpcHandlers(dependencies: RegisterIpcDependencies) {settleComposerSuggestion,getPluginLauncherWindow,togglePluginLauncher,+ openPluginMarket,safeOpenExternal,updater,dataDir,@@ -527,6 +528,7 @@ export function registerIpcHandlers(dependencies: RegisterIpcDependencies) {plugins,localApps,getLocale: getUpdaterLocale,+ openPluginMarket,});registerSpeechIpc({ registrar, speech });diff --git a/apps/desktop/electron/main/local-apps.ts b/apps/desktop/electron/main/local-apps.tsindex 650a64d66..0b7bcb6f5 100644--- a/apps/desktop/electron/main/local-apps.ts+++ b/apps/desktop/electron/main/local-apps.ts@@ -49,7 +49,11 @@ export interface DiscoveredApp {source: LocalAppSource;launchTarget: string;iconPath?: string;- /** Small icon as a data URL, present only when it fitted the size budget. */+ /**+ * Platform icon as a data URL, present only when one was produced and it+ * fitted the size budget. Icons are cached between scans, so a rescan does+ * not pay for the same lookup again.+ */iconDataUrl?: string;}@@ -98,7 +102,7 @@ export interface LocalAppCatalogOptions {maxEntries?: number;/** Hard cap on icon lookups per scan. Default 200. */maxIcons?: number;- /** Data URLs longer than this are dropped. Default 4 KiB. */+ /** Data URLs longer than this are dropped. Default 32 KiB. */maxIconBytes?: number;/** Injectable clock, used by the TTL tests. */now?: () => number;@@ -126,7 +130,46 @@ export interface LocalAppCatalog {export const LOCAL_APP_TTL_MS = 5 * 60_000;export const LOCAL_APP_MAX_ENTRIES = 600;export const LOCAL_APP_MAX_ICONS = 200;-export const LOCAL_APP_MAX_ICON_BYTES = 4_096;+export const LOCAL_APP_MAX_ICON_BYTES = 32_768;++/**+ * Icons harvested across scans: `icon:<id>:<path>` -> data URL.+ *+ * Keyed by both the stable id and the path the icon came from, so an+ * application that is reinstalled elsewhere is not served a stale image.+ */+export type LocalAppIconCache = Map<string, string>;++export function localAppIconCacheKey(app: DiscoveredApp): string | null {+ const target = app.iconPath ?? app.launchTarget;+ return target ? `icon:${app.id}:${target}` : null;+}++/**+ * Keep only the icons the current scan can still use, then trim to the cap.+ *+ * Insertion order is the oldest entry first, so an overflowing cache drops the+ * least recently fetched icons rather than growing without bound.+ */+function pruneIconCache(+ cache: LocalAppIconCache,+ apps: readonly DiscoveredApp[],+ limit: number,+): void {+ const live = new Set<string>();+ for (const app of apps) {+ const key = localAppIconCacheKey(app);+ if (key) live.add(key);+ }+ for (const key of [...cache.keys()]) {+ if (!live.has(key)) cache.delete(key);+ }+ while (cache.size > Math.max(0, limit)) {+ const oldest = cache.keys().next();+ if (oldest.done) break;+ cache.delete(oldest.value);+ }+}export interface ScanLimits {maxEntries: number;@@ -167,10 +210,19 @@ async function attachIcons(deps: LocalAppDeps,diagnostics: string[],maxIconBytes: number,+ cache: LocalAppIconCache | undefined,): Promise<void> {for (const app of apps) {const target = app.iconPath ?? app.launchTarget;if (!target) continue;+ const key = localAppIconCacheKey(app);+ const cached = key ? cache?.get(key) : undefined;+ if (cached) {+ // A rescan reuses the icon it already paid for; the platform lookup is+ // the expensive part of a scan and nothing about it changed.+ app.iconDataUrl = cached;+ continue;+ }try {const icon = await deps.getFileIcon(target);if (!icon) continue;@@ -178,6 +230,7 @@ async function attachIcons(if (typeof dataUrl !== "string") continue;if (dataUrl.length === 0 || dataUrl.length > maxIconBytes) continue;app.iconDataUrl = dataUrl;+ if (key) cache?.set(key, dataUrl);} catch (error) {// Icons are cosmetic: a failing lookup must never fail the scan.diagnostics.push(`icon lookup failed for ${app.name}: ${errorMessage(error)}`);@@ -203,6 +256,7 @@ async function discoverPlatformApps(export async function scanLocalApps(deps: LocalAppDeps,limits: Partial<ScanLimits> = {},+ iconCache?: LocalAppIconCache,): Promise<LocalAppScan> {const resolved: ScanLimits = {maxEntries: limits.maxEntries ?? LOCAL_APP_MAX_ENTRIES,@@ -226,7 +280,9 @@ export async function scanLocalApps(deps,diagnostics,resolved.maxIconBytes,+ iconCache,);+ if (iconCache) pruneIconCache(iconCache, apps, resolved.maxIcons);return { apps, diagnostics, scannedAt: Date.now() };}@@ -251,10 +307,12 @@ export function createLocalAppCatalog(let cache: LocalAppScan | null = null;let inFlight: Promise<LocalAppScan> | null = null;+ /** Icons survive across scans; `scanLocalApps` prunes what no longer exists. */+ const iconCache: LocalAppIconCache = new Map();function startScan(): Promise<LocalAppScan> {if (inFlight) return inFlight;- const scan = scanLocalApps(deps, limits)+ const scan = scanLocalApps(deps, limits, iconCache).catch((error: unknown): LocalAppScan => ({apps: [],diagnostics: [`local app scan failed: ${errorMessage(error)}`],@@ -445,7 +503,10 @@ export async function createDefaultLocalAppDeps(): Promise<LocalAppDeps> {},async getFileIcon(target) {try {- const icon = await app.getFileIcon(target, { size: "small" });+ // `large` is the 32px native icon: at the panel's tile size the small+ // variant reads as a blurry square. Oversized results are dropped by+ // the byte budget instead of being downscaled here.+ const icon = await app.getFileIcon(target, { size: "large" });return icon ?? null;} catch {return null;diff --git a/apps/desktop/electron/main/plugin-launcher-state.ts b/apps/desktop/electron/main/plugin-launcher-state.tsindex 7b33c19c0..336b1b6fb 100644--- a/apps/desktop/electron/main/plugin-launcher-state.ts+++ b/apps/desktop/electron/main/plugin-launcher-state.ts@@ -20,11 +20,18 @@ export const PLUGIN_LAUNCHER_STATE_FILE = "plugin-launcher-state.json";* dragging.*/export const PLUGIN_LAUNCHER_MIN_WIDTH = 560;-export const PLUGIN_LAUNCHER_MIN_HEIGHT = 380;+/**+ * Height is not a user preference any more: the renderer measures what it+ * renders and asks for exactly that height through+ * `IPC.invoke.pluginLauncherContentHeight`. This floor only keeps the window+ * from collapsing while the measurement is still on its way.+ */+export const PLUGIN_LAUNCHER_MIN_CONTENT_HEIGHT = 120;/** Wider than this the eight tiles stop being scannable. */export const PLUGIN_LAUNCHER_MAX_WIDTH = 1280;export const PLUGIN_LAUNCHER_MAX_HEIGHT = 940;export const PLUGIN_LAUNCHER_DEFAULT_WIDTH = 760;+/** Initial height before the panel has measured itself. */export const PLUGIN_LAUNCHER_DEFAULT_HEIGHT = 440;export type LauncherWindowState = {@@ -58,6 +65,22 @@ function clampDimension(value: unknown, min: number, max: number, fallback: numbreturn Math.min(max, Math.max(min, Math.round(value)));}+/**+ * Accept a measured content height from the launcher renderer.+ *+ * The value crosses an IPC boundary, so anything that is not a finite positive+ * number is refused, and an accepted height is clamped into the supported range+ * — a compromised or buggy renderer can therefore ask for a different height,+ * never for a window the user cannot recover.+ */+export function clampLauncherContentHeight(value: unknown): number | null {+ if (!isFiniteNumber(value) || value <= 0) return null;+ return Math.min(+ PLUGIN_LAUNCHER_MAX_HEIGHT,+ Math.max(PLUGIN_LAUNCHER_MIN_CONTENT_HEIGHT, Math.round(value)),+ );+}+/*** Read a persisted state defensively: another version's payload, a truncated* write, or a hand-edited file must all degrade to "no remembered size" rather@@ -76,7 +99,7 @@ export function parseLauncherWindowState(raw: unknown): LauncherWindowState | nu),height: clampDimension(record.height,- PLUGIN_LAUNCHER_MIN_HEIGHT,+ PLUGIN_LAUNCHER_MIN_CONTENT_HEIGHT,PLUGIN_LAUNCHER_MAX_HEIGHT,PLUGIN_LAUNCHER_DEFAULT_HEIGHT,),@@ -108,8 +131,8 @@ export function resolveLauncherBounds();const height = clampDimension(state?.height,- PLUGIN_LAUNCHER_MIN_HEIGHT,- Math.max(PLUGIN_LAUNCHER_MIN_HEIGHT, Math.min(PLUGIN_LAUNCHER_MAX_HEIGHT, workArea.height)),+ PLUGIN_LAUNCHER_MIN_CONTENT_HEIGHT,+ Math.max(PLUGIN_LAUNCHER_MIN_CONTENT_HEIGHT, Math.min(PLUGIN_LAUNCHER_MAX_HEIGHT, workArea.height)),Math.min(PLUGIN_LAUNCHER_DEFAULT_HEIGHT, workArea.height),);const centeredX = Math.round(workArea.x + (workArea.width - width) / 2);diff --git a/apps/desktop/src/components/PluginLauncher.tsx b/apps/desktop/src/components/PluginLauncher.tsxindex 91512d687..764cae5a6 100644--- a/apps/desktop/src/components/PluginLauncher.tsx+++ b/apps/desktop/src/components/PluginLauncher.tsx@@ -1,12 +1,21 @@-import { useCallback, useEffect, useMemo, useRef, useState } from "react";+import {+ useCallback,+ useEffect,+ useLayoutEffect,+ useMemo,+ useRef,+ useState,+} from "react";import { useTranslation } from "react-i18next";import {isThemeColorScheme,type LauncherCatalog,} from "@pi-desktop/shared";import { api } from "../lib/api";+import { resolveLauncherContentHeight } from "../lib/launcher-height";import {LAUNCHER_COLUMNS,+ buildLauncherAllPluginsSection,buildLauncherPinnedSection,buildLauncherRecentSection,indexLauncherCatalog,@@ -15,15 +24,14 @@ import {type LauncherTile,} from "../lib/launcher-search";import {- readLauncherState,+ LAUNCHER_PIN_LIMIT,pruneLauncherState,+ readLauncherState,rememberLauncherUse,- setLauncherAliases,setLauncherPinned,type LauncherStoreSnapshot,} from "../lib/launcher-store";import { LauncherTileButton } from "./launcher/LauncherTileButton";-import { LauncherItemMenu } from "./launcher/LauncherItemMenu";import { IconPlug, IconSearch } from "./icons";/** Above this many matches the panel asks the user to keep typing. */@@ -31,64 +39,85 @@ const UNLIMITED = Number.MAX_SAFE_INTEGER;/** A background application scan is retried this many times before it is final. */const SCAN_RETRY_LIMIT = 3;const SCAN_RETRY_DELAY_MS = 1200;+/** How long the pinned row shakes when the pin budget is already spent. */+const PINS_FULL_PULSE_MS = 320;function optionId(itemId: string): string {return `plugin-launcher-option-${itemId.replace(/[^a-zA-Z0-9_-]+/g, "-")}`;}+const EMPTY_SECTION: LauncherSection = { tiles: [], total: 0 };++type LauncherAction = { label: string; title: string; onSelect: () => void };+/*** One titled grid of tiles.*- * The header carries the section's affordance — expand when the grid had to drop- * entries, collapse when it shows everything — and the grid itself is always- * eight columns wide, so widening the window widens tiles instead of reflowing- * them onto other rows.+ * The header carries the section's affordances — expand/collapse, open the full+ * plugin list — while the grid itself is always eight columns wide, so widening+ * the window widens tiles instead of reflowing them onto other rows. An empty+ * section renders nothing at all, header included.*/function LauncherSectionGrid({title,section,+ variant,startIndex,activeIndex,disabled,+ pinnedIds,+ actions,onOpen,- onMenu,- action,+ onTogglePin,}: {title: string;section: LauncherSection;+ /** `all` marks the single grid of every installed plugin. */+ variant?: "all";startIndex: number;activeIndex: number;disabled: boolean;+ pinnedIds: readonly string[];+ actions?: LauncherAction[];onOpen: (tile: LauncherTile) => void;- onMenu: (tile: LauncherTile) => void;- action?: { label: string; title: string; onSelect: () => void };+ onTogglePin: (tile: LauncherTile) => void;}) {if (!section.tiles.length) return null;return (<section className="plugin-launcher-group" aria-label={title}><header className="plugin-launcher-group-header"><h2>{title}</h2>- {action ? (- <button- type="button"- className="plugin-launcher-group-action"- tabIndex={-1}- onClick={action.onSelect}- >- {action.label}- </button>+ {actions?.length ? (+ <div className="plugin-launcher-group-actions">+ {actions.map((action) => (+ <button+ key={action.label}+ type="button"+ className="plugin-launcher-group-action"+ title={action.title}+ tabIndex={-1}+ onClick={action.onSelect}+ >+ {action.label}+ </button>+ ))}+ </div>) : null}</header>- <div className="plugin-launcher-grid" role="presentation">+ <div+ className={`plugin-launcher-grid${variant === "all" ? " plugin-launcher-grid-all" : ""}`}+ role="presentation"+ >{section.tiles.map((tile, index) => (<LauncherTileButtonkey={tile.id}tile={tile}+ pinned={pinnedIds.includes(tile.id)}active={activeIndex === startIndex + index}disabled={disabled}optionId={optionId(tile.id)}onOpen={() => onOpen(tile)}- onMenu={() => onMenu(tile)}+ onTogglePin={() => onTogglePin(tile)}/>))}</div>@@ -96,18 +125,33 @@ function LauncherSectionGrid({);}+/** Read a computed pixel length, tolerating `auto` and unit oddities. */+function pixels(value: string): number {+ const parsed = Number.parseFloat(value);+ return Number.isFinite(parsed) ? parsed : 0;+}+export function PluginLauncher() {const { t } = useTranslation();const inputRef = useRef<HTMLInputElement>(null);+ const mainRef = useRef<HTMLElement>(null);+ const surfaceRef = useRef<HTMLElement>(null);+ const searchRowRef = useRef<HTMLDivElement>(null);+ const resultsRef = useRef<HTMLDivElement>(null);+ const resultsContentRef = useRef<HTMLDivElement>(null);+ const footerRef = useRef<HTMLElement>(null);+ const reportedHeightRef = useRef(0);const [query, setQuery] = useState("");const [catalog, setCatalog] = useState<LauncherCatalog | null>(null);const [store, setStore] = useState<LauncherStoreSnapshot>(() => readLauncherState());const [activeIndex, setActiveIndex] = useState(0);const [expanded, setExpanded] = useState(false);+ const [showAllPlugins, setShowAllPlugins] = useState(false);const [loading, setLoading] = useState(true);const [openingId, setOpeningId] = useState<string | null>(null);const [error, setError] = useState<string | null>(null);- const [menuTile, setMenuTile] = useState<LauncherTile | null>(null);+ const [pinsFull, setPinsFull] = useState(false);+ const [pinsPulse, setPinsPulse] = useState(0);const loadPromiseRef = useRef<Promise<void> | null>(null);const scanRetriesRef = useRef(0);@@ -182,10 +226,15 @@ export function PluginLauncher() {setQuery("");setActiveIndex(0);setExpanded(false);+ setShowAllPlugins(false);+ setPinsFull(false);+ setPinsPulse(0);setOpeningId(null);setError(null);- setMenuTile(null);scanRetriesRef.current = 0;+ // The panel is re-shown at whatever size it had; ask for the content height+ // again instead of trusting the remembered window.+ reportedHeightRef.current = 0;setStore(readLauncherState());// Warm-up may run before the host is ready, so retry the persisted theme// when the launcher is actually shown instead of keeping the fallback.@@ -208,7 +257,7 @@ export function PluginLauncher() {return api.onPluginLauncherShown(reset);}, [reset]);- // Pins and aliases can be changed in another window; web storage already+ // Pins and preferences can be changed in another window; web storage already// broadcasts that, so the panel does not need its own cross-window channel.useEffect(() => {const onStorage = () => setStore(readLauncherState());@@ -224,32 +273,36 @@ export function PluginLauncher() {() =>index? buildLauncherRecentSection(index, store, expanded ? UNLIMITED : undefined)- : { tiles: [], total: 0 },+ : EMPTY_SECTION,[index, store, expanded],);const pinnedSection = useMemo(- () =>- index- ? buildLauncherPinnedSection(index, store, expanded ? UNLIMITED : undefined)- : { tiles: [], total: 0 },- [index, store, expanded],+ () => (index ? buildLauncherPinnedSection(index, store) : EMPTY_SECTION),+ [index, store],+ );+ const allPluginsSection = useMemo(+ () => (index ? buildLauncherAllPluginsSection(index, store) : EMPTY_SECTION),+ [index, store],);const matchSection = useMemo(() =>- index- ? searchLauncherItems(index, query, store)- : { tiles: [], total: 0 },+ index ? searchLauncherItems(index, query, store) : EMPTY_SECTION,[index, query, store],);const searching = query.trim().length > 0;- const navTiles = useMemo(- () =>- searching- ? matchSection.tiles- : [...recentSection.tiles, ...pinnedSection.tiles],- [searching, matchSection.tiles, recentSection.tiles, pinnedSection.tiles],- );+ const navTiles = useMemo(() => {+ if (searching) return matchSection.tiles;+ if (showAllPlugins) return allPluginsSection.tiles;+ return [...recentSection.tiles, ...pinnedSection.tiles];+ }, [+ searching,+ showAllPlugins,+ matchSection.tiles,+ allPluginsSection.tiles,+ recentSection.tiles,+ pinnedSection.tiles,+ ]);useEffect(() => {setActiveIndex((current) =>@@ -283,6 +336,39 @@ export function PluginLauncher() {[openingId],);+ const openPluginMarket = useCallback(async () => {+ setError(null);+ try {+ await api.launcherOpenPluginMarket();+ } catch (marketError) {+ setError(+ marketError instanceof Error ? marketError.message : String(marketError),+ );+ }+ }, []);++ const togglePin = useCallback(+ (tile: LauncherTile) => {+ const pinned = store.pins.includes(tile.id);+ if (!pinned && store.pins.length >= LAUNCHER_PIN_LIMIT) {+ // The row is full: say so, and shake the pins so the eye lands on the+ // section that refused the request.+ setPinsFull(true);+ setPinsPulse((current) => current + 1);+ return;+ }+ setPinsFull(false);+ setStore(setLauncherPinned(tile.id, !pinned));+ },+ [store.pins],+ );++ useEffect(() => {+ if (!pinsPulse) return;+ const timer = window.setTimeout(() => setPinsPulse(0), PINS_FULL_PULSE_MS);+ return () => window.clearTimeout(timer);+ }, [pinsPulse]);+const moveActive = useCallback((delta: number) => {if (!navTiles.length) return;@@ -305,6 +391,13 @@ export function PluginLauncher() {}if (event.key === "Escape") {event.preventDefault();+ if (showAllPlugins) {+ // The full list is a view inside the panel, not a separate window:+ // the first Escape leaves it and a second one dismisses the panel.+ setShowAllPlugins(false);+ setActiveIndex(0);+ return;+ }void api.dismissPluginLauncher();return;}@@ -334,18 +427,89 @@ export function PluginLauncher() {moveActive(-1);}},- [activeIndex, moveActive, navTiles, openTile],+ [activeIndex, moveActive, navTiles, openTile, showAllPlugins],);- const togglePin = useCallback((tile: LauncherTile) => {- const pinned = store.pins.includes(tile.id);- setStore(setLauncherPinned(tile.id, !pinned));- }, [store.pins]);-- const saveAliases = useCallback((tile: LauncherTile, aliases: string[]) => {- setStore(setLauncherAliases(tile.id, aliases));+ /**+ * Ask the host for exactly the height this render needs.+ *+ * Every part of the panel that decides its height is measured here: the+ * search row, the natural height of the results content, the footer, and the+ * padding/border around them. `results` scrolls, so its own box cannot be+ * trusted — the inner content wrapper is what reports the height.+ */+ const measureContentHeight = useCallback(() => {+ const main = mainRef.current;+ const surface = surfaceRef.current;+ const searchRow = searchRowRef.current;+ const results = resultsRef.current;+ const content = resultsContentRef.current;+ const footer = footerRef.current;+ if (!main || !surface || !searchRow || !results || !content || !footer) {+ return;+ }+ const mainStyle = window.getComputedStyle(main);+ const surfaceStyle = window.getComputedStyle(surface);+ const resultsStyle = window.getComputedStyle(results);+ const height = resolveLauncherContentHeight({+ searchRowHeight: searchRow.offsetHeight,+ resultsHeight:+ content.offsetHeight ++ pixels(resultsStyle.paddingTop) ++ pixels(resultsStyle.paddingBottom),+ footerHeight: footer.offsetHeight,+ chromeHeight:+ pixels(mainStyle.paddingTop) ++ pixels(mainStyle.paddingBottom) ++ pixels(surfaceStyle.borderTopWidth) ++ pixels(surfaceStyle.borderBottomWidth),+ });+ if (height <= 0 || height === reportedHeightRef.current) return;+ reportedHeightRef.current = height;+ void api.launcherSetContentHeight(height).catch(() => undefined);}, []);+ // Every view change re-measures; the observer below only has to catch+ // reflows the panel does not cause itself (font scale, zoom, OS text size).+ useLayoutEffect(() => {+ measureContentHeight();+ }, [+ measureContentHeight,+ query,+ showAllPlugins,+ expanded,+ store,+ catalog,+ loading,+ error,+ pinsFull,+ ]);++ useEffect(() => {+ let frame: number | null = null;+ const schedule = () => {+ if (frame !== null) return;+ frame = window.requestAnimationFrame(() => {+ frame = null;+ measureContentHeight();+ });+ };+ const targets = [resultsRef.current, resultsContentRef.current].filter(+ (target): target is HTMLDivElement => Boolean(target),+ );+ const observer =+ typeof ResizeObserver === "function"+ ? new ResizeObserver(schedule)+ : null;+ for (const target of targets) observer?.observe(target);+ window.addEventListener("resize", schedule);+ return () => {+ observer?.disconnect();+ window.removeEventListener("resize", schedule);+ if (frame !== null) window.cancelAnimationFrame(frame);+ };+ }, [measureContentHeight]);+const emptyText = loading? t("pluginLauncher.loading"): searching@@ -354,13 +518,152 @@ export function PluginLauncher() {? t("pluginLauncher.scanningApps"): t("pluginLauncher.empty");- const expandLabel = (section: LauncherSection) =>- t("pluginLauncher.expandRecent", { count: section.total });+ const marketAction = (+ <button+ type="button"+ className="plugin-launcher-empty-action"+ onClick={() => void openPluginMarket()}+ >+ {t("pluginLauncher.openPluginMarket")}+ </button>+ );++ const recentActions: LauncherAction[] = [];+ if (recentSection.total > recentSection.tiles.length || expanded) {+ recentActions.push({+ label: expanded+ ? t("pluginLauncher.collapse")+ : t("pluginLauncher.expandRecent", { count: recentSection.total }),+ title: t("pluginLauncher.recent"),+ onSelect: () => setExpanded((current) => !current),+ });+ }+ if (allPluginsSection.total > 0) {+ recentActions.push({+ label: t("pluginLauncher.showAllPlugins"),+ title: t("pluginLauncher.allPlugins"),+ onSelect: () => {+ setExpanded(false);+ setShowAllPlugins(true);+ setActiveIndex(0);+ },+ });+ }++ const renderResults = () => {+ if (searching) {+ if (matchSection.tiles.length) {+ return (+ <LauncherSectionGrid+ title={t("pluginLauncher.matches")}+ section={matchSection}+ startIndex={0}+ activeIndex={activeIndex}+ disabled={openingId !== null}+ pinnedIds={store.pins}+ onOpen={(tile) => void openTile(tile)}+ onTogglePin={togglePin}+ actions={+ matchSection.total > matchSection.tiles.length+ ? [+ {+ label: t("pluginLauncher.overflow", {+ count: matchSection.total - matchSection.tiles.length,+ }),+ title: t("pluginLauncher.overflowHint"),+ onSelect: () => undefined,+ },+ ]+ : undefined+ }+ />+ );+ }+ return (+ <div className="plugin-launcher-empty" role="status">+ <IconPlug size={20} aria-hidden />+ <span>{emptyText}</span>+ {marketAction}+ </div>+ );+ }++ if (showAllPlugins) {+ if (allPluginsSection.tiles.length) {+ return (+ <LauncherSectionGrid+ title={t("pluginLauncher.allPlugins")}+ variant="all"+ section={allPluginsSection}+ startIndex={0}+ activeIndex={activeIndex}+ disabled={openingId !== null}+ pinnedIds={store.pins}+ onOpen={(tile) => void openTile(tile)}+ onTogglePin={togglePin}+ />+ );+ }+ return (+ <div className="plugin-launcher-empty" role="status">+ <IconPlug size={20} aria-hidden />+ <span>{emptyText}</span>+ </div>+ );+ }++ if (recentSection.tiles.length || pinnedSection.tiles.length) {+ return (+ <>+ <LauncherSectionGrid+ title={t("pluginLauncher.recent")}+ section={recentSection}+ startIndex={0}+ activeIndex={activeIndex}+ disabled={openingId !== null}+ pinnedIds={store.pins}+ onOpen={(tile) => void openTile(tile)}+ onTogglePin={togglePin}+ actions={recentActions}+ />+ {pinnedSection.tiles.length ? (+ <div+ key={`pins-${pinsPulse}`}+ className={`plugin-launcher-pin-group${pinsPulse ? " shaking" : ""}`}+ >+ <LauncherSectionGrid+ title={t("pluginLauncher.pinned")}+ section={pinnedSection}+ startIndex={recentSection.tiles.length}+ activeIndex={activeIndex}+ disabled={openingId !== null}+ pinnedIds={store.pins}+ onOpen={(tile) => void openTile(tile)}+ onTogglePin={togglePin}+ />+ </div>+ ) : null}+ </>+ );+ }++ return (+ <div className="plugin-launcher-empty" role="status">+ <IconPlug size={20} aria-hidden />+ <span>{emptyText}</span>+ {marketAction}+ </div>+ );+ };return (- <main className="plugin-launcher" aria-label={t("pluginLauncher.title")}>- <section className="plugin-launcher-surface">- <div className="plugin-launcher-search-row">+ <main+ className="plugin-launcher"+ aria-label={t("pluginLauncher.title")}+ ref={mainRef}+ >+ <section className="plugin-launcher-surface" ref={surfaceRef}>+ <div className="plugin-launcher-search-row" ref={searchRowRef}><IconSearch size={18} aria-hidden /><inputref={inputRef}@@ -377,7 +680,15 @@ export function PluginLauncher() {aria-activedescendant={navTiles[activeIndex] ? optionId(navTiles[activeIndex].id) : undefined}- onChange={(event) => setQuery(event.target.value)}+ onChange={(event) => {+ setQuery(event.target.value);+ // Typing always means "search": the full plugin list steps aside+ // instead of filtering a view it cannot express.+ if (showAllPlugins) {+ setShowAllPlugins(false);+ setActiveIndex(0);+ }+ }}onKeyDown={handleKeyDown}/><span className="plugin-launcher-shortcut" aria-hidden>@@ -387,104 +698,27 @@ export function PluginLauncher() {<divid="plugin-launcher-results"- className={`plugin-launcher-results${expanded ? " expanded" : ""}`}+ className="plugin-launcher-results"role="listbox"aria-label={t("pluginLauncher.results")}+ ref={resultsRef}>- {searching ? (- matchSection.tiles.length ? (- <LauncherSectionGrid- title={t("pluginLauncher.matches")}- section={matchSection}- startIndex={0}- activeIndex={activeIndex}- disabled={openingId !== null}- onOpen={(tile) => void openTile(tile)}- onMenu={setMenuTile}- action={- matchSection.total > matchSection.tiles.length- ? {- label: t("pluginLauncher.overflow", {- count: matchSection.total - matchSection.tiles.length,- }),- title: t("pluginLauncher.overflowHint"),- onSelect: () => undefined,- }- : undefined- }- />- ) : (- <div className="plugin-launcher-empty" role="status">- <IconPlug size={20} aria-hidden />- <span>{emptyText}</span>- </div>- )- ) : recentSection.tiles.length || pinnedSection.tiles.length ? (- <>- <LauncherSectionGrid- title={t("pluginLauncher.recent")}- section={recentSection}- startIndex={0}- activeIndex={activeIndex}- disabled={openingId !== null}- onOpen={(tile) => void openTile(tile)}- onMenu={setMenuTile}- action={- recentSection.total > recentSection.tiles.length || expanded- ? {- label: expanded- ? t("pluginLauncher.collapse")- : expandLabel(recentSection),- title: t("pluginLauncher.recent"),- onSelect: () => setExpanded((current) => !current),- }- : undefined- }- />- <LauncherSectionGrid- title={t("pluginLauncher.pinned")}- section={pinnedSection}- startIndex={recentSection.tiles.length}- activeIndex={activeIndex}- disabled={openingId !== null}- onOpen={(tile) => void openTile(tile)}- onMenu={setMenuTile}- action={- pinnedSection.total > pinnedSection.tiles.length- ? {- label: t("pluginLauncher.showAll"),- title: t("pluginLauncher.pinned"),- onSelect: () => setExpanded(true),- }- : undefined- }- />- </>- ) : (- <div className="plugin-launcher-empty" role="status">- <IconPlug size={20} aria-hidden />- <span>{emptyText}</span>- </div>- )}+ <div className="plugin-launcher-results-content" ref={resultsContentRef}>+ {renderResults()}+ </div></div>- <footer className="plugin-launcher-footer">+ <footer className="plugin-launcher-footer" ref={footerRef}><span>{t("pluginLauncher.navigateHint")}</span><span>{t("pluginLauncher.openHint")}</span><span>{t("pluginLauncher.dismissHint")}</span>+ {pinsFull ? (+ <span className="plugin-launcher-pin-notice" role="status">+ {t("pluginLauncher.pinsFull", { limit: LAUNCHER_PIN_LIMIT })}+ </span>+ ) : null}{error ? <strong role="alert">{error}</strong> : null}</footer>-- {menuTile ? (- <LauncherItemMenu- tile={menuTile}- pinned={store.pins.includes(menuTile.id)}- aliases={store.aliases[menuTile.id] ?? []}- onClose={() => setMenuTile(null)}- onTogglePin={() => togglePin(menuTile)}- onSaveAliases={(aliases) => saveAliases(menuTile, aliases)}- />- ) : null}</section></main>);diff --git a/apps/desktop/src/components/launcher/LauncherItemMenu.tsx b/apps/desktop/src/components/launcher/LauncherItemMenu.tsxdeleted file mode 100644index da8bd3b23..000000000--- a/apps/desktop/src/components/launcher/LauncherItemMenu.tsx+++ /dev/null@@ -1,121 +0,0 @@-import { useEffect, useRef, useState } from "react";-import { useTranslation } from "react-i18next";-import type { LauncherTile } from "../../lib/launcher-search";--/**- * Per-tile actions the panel cannot show as tiles: pin or unpin the item, and- * teach the launcher a second name for it.- *- * The alias is what makes tools the host cannot guess ("微信" for WeChat) findable- * by the word the user actually types, so it is edited inline here rather than in- * a settings page (issue #2085 §4).- */-export function LauncherItemMenu({- tile,- pinned,- aliases,- onClose,- onTogglePin,- onSaveAliases,-}: {- tile: LauncherTile;- pinned: boolean;- aliases: string[];- onClose: () => void;- onTogglePin: () => void;- onSaveAliases: (aliases: string[]) => void;-}) {- const { t } = useTranslation();- const [alias, setAlias] = useState(aliases.join(" "));- const inputRef = useRef<HTMLInputElement>(null);-- useEffect(() => {- inputRef.current?.focus();- }, []);-- useEffect(() => {- const onKeyDown = (event: KeyboardEvent) => {- if (event.key === "Escape") {- event.preventDefault();- event.stopPropagation();- onClose();- }- };- window.addEventListener("keydown", onKeyDown, true);- return () => window.removeEventListener("keydown", onKeyDown, true);- }, [onClose]);-- const commit = () => {- onSaveAliases(- alias- .split(/\s+/)- .map((entry) => entry.trim())- .filter(Boolean),- );- onClose();- };-- return (- <>- <div- className="plugin-launcher-menu-backdrop"- role="presentation"- onClick={onClose}- />- <div className="plugin-launcher-menu" role="dialog" aria-label={tile.name}>- <strong className="plugin-launcher-menu-title">{tile.name}</strong>- <button- type="button"- className="plugin-launcher-menu-action"- onClick={() => {- onTogglePin();- onClose();- }}- >- {pinned ? t("pluginLauncher.unpin") : t("pluginLauncher.pin")}- </button>- <label className="plugin-launcher-menu-label" htmlFor="launcher-alias">- {t("pluginLauncher.alias")}- </label>- <input- id="launcher-alias"- ref={inputRef}- className="plugin-launcher-menu-input"- value={alias}- placeholder={t("pluginLauncher.aliasHint")}- onChange={(event) => setAlias(event.target.value)}- onKeyDown={(event) => {- if (event.nativeEvent.isComposing || event.nativeEvent.keyCode === 229) {- return;- }- if (event.key === "Enter") {- event.preventDefault();- commit();- }- }}- />- <div className="plugin-launcher-menu-row">- <button- type="button"- className="plugin-launcher-menu-action"- onClick={commit}- >- {t("pluginLauncher.aliasSave")}- </button>- {aliases.length ? (- <button- type="button"- className="plugin-launcher-menu-action"- onClick={() => {- onSaveAliases([]);- onClose();- }}- >- {t("pluginLauncher.aliasClear")}- </button>- ) : null}- </div>- </div>- </>- );-}diff --git a/apps/desktop/src/components/launcher/LauncherTileButton.tsx b/apps/desktop/src/components/launcher/LauncherTileButton.tsxindex 6ecc69c3a..2afaa2d23 100644--- a/apps/desktop/src/components/launcher/LauncherTileButton.tsx+++ b/apps/desktop/src/components/launcher/LauncherTileButton.tsx@@ -1,101 +1,110 @@+import { useEffect, useRef, useState } from "react";import { useTranslation } from "react-i18next";import type { LauncherTile } from "../../lib/launcher-search";+import { IconPin } from "../icons";/**- * The second line of a tile.+ * One grid cell: icon, type badge, and name — plus its own pin toggle.*- * It answers "why is this here": the reason the query matched, or, for a- * trigger hit, the text the plugin is about to receive. The launcher shows one- * line, so the text is truncated rather than wrapped — a wrapped line would- * break the eight-column grid alignment the panel promises.+ * Every cell has the same three parts so the eight-column grid stays aligned:+ * the icon shape (square plugin, round application) and the small type badge+ * carry the source, and the name replaces the old second text line, which used+ * to explain why the item matched. A long name is ellipsized instead of+ * wrapping, which would break the row rhythm.+ *+ * The pin sits in the corner and is only visible while the cell is hovered,+ * active or focused; an already pinned cell keeps it visible and filled.*/-function useTileDetail(tile: LauncherTile): string {- const { t } = useTranslation();- switch (tile.reason) {- case "pattern":- return t("pluginLauncher.reasonReceived", { value: tile.detail });- case "name":- return t("pluginLauncher.reasonName", { value: tile.detail });- case "pinyin":- return t("pluginLauncher.reasonPinyin", { value: tile.detail });- case "initials":- return t("pluginLauncher.reasonInitials", { value: tile.detail });- case "alias":- return t("pluginLauncher.reasonAlias", { value: tile.detail });- case "description":- return t("pluginLauncher.reasonDescription", { value: tile.detail });- case "pinned":- return t("pluginLauncher.reasonPinned");- default:- return t("pluginLauncher.reasonRecent");- }-}-export function LauncherTileButton({tile,+ pinned,active,disabled,optionId,onOpen,- onMenu,+ onTogglePin,}: {tile: LauncherTile;+ pinned: boolean;active: boolean;disabled: boolean;optionId: string;onOpen: () => void;- onMenu: (target: { tile: LauncherTile; anchor: DOMRect }) => void;+ onTogglePin: () => void;}) {const { t } = useTranslation();- const detail = useTileDetail(tile);- const sourceLabel =+ const [iconBroken, setIconBroken] = useState(false);+ const openRef = useRef<HTMLButtonElement>(null);++ // A rescan can hand us a different icon for the same id; a URL that failed+ // before must get another chance instead of staying a monogram forever.+ useEffect(() => {+ setIconBroken(false);+ }, [tile.iconDataUrl]);++ // Keyboard navigation moves the active cell through a scrolling results+ // area, so the cell that receives focus-by-proxy must be brought into view.+ useEffect(() => {+ if (!active) return;+ openRef.current?.scrollIntoView({ block: "nearest" });+ }, [active]);++ const typeLabel =tile.kind === "plugin"- ? t("pluginLauncher.sourcePlugin")- : t("pluginLauncher.sourceApp");+ ? t("pluginLauncher.typePlugin")+ : t("pluginLauncher.typeApp");+ const pinLabel = pinned ? t("pluginLauncher.unpin") : t("pluginLauncher.pin");const executable = tile.kind === "app" ? tile.executableName : undefined;+ const title = `${tile.name} · ${typeLabel}${executable ? ` · ${executable}` : ""}`;+ const showIcon = Boolean(tile.iconDataUrl) && !iconBroken;return (<div className={`plugin-launcher-tile${active ? " active" : ""}`}><buttonid={optionId}+ ref={openRef}type="button"role="option"aria-selected={active}disabled={disabled}className="plugin-launcher-tile-open"- title={`${tile.name} · ${sourceLabel}${executable ? ` · ${executable}` : ""} · ${detail}`}+ title={title}onClick={onOpen}><spanclassName={`plugin-launcher-icon plugin-launcher-icon-${tile.kind}`}aria-hidden>- {tile.iconDataUrl ? (- <img src={tile.iconDataUrl} alt="" draggable={false} />+ {showIcon ? (+ <img+ src={tile.iconDataUrl}+ alt=""+ draggable={false}+ onError={() => setIconBroken(true)}+ />) : (<span className="plugin-launcher-monogram">{tile.monogram}</span>)}</span>- <span className="plugin-launcher-tile-name">{tile.name}</span>- <span className="plugin-launcher-tile-detail">- <span className="plugin-launcher-source">{sourceLabel}</span>- <span className="plugin-launcher-detail-text">{detail}</span>+ <span className="plugin-launcher-tile-line">+ <span className="plugin-launcher-tile-name">{tile.name}</span>+ <span className="plugin-launcher-tile-type">{typeLabel}</span></span></button><buttontype="button"tabIndex={-1}- className="plugin-launcher-tile-menu"- aria-label={t("pluginLauncher.menuOpen", { name: tile.name })}+ className="plugin-launcher-pin"+ aria-label={pinLabel}+ aria-pressed={pinned}+ title={pinLabel}onClick={(event) => {+ // Pinning must not open the item: the click never reaches the tile.event.stopPropagation();- onMenu({- tile,- anchor: event.currentTarget.getBoundingClientRect(),- });+ onTogglePin();}}>- ⋯+ <IconPin size={12} aria-hidden /></button></div>);diff --git a/apps/desktop/src/features/app/useAppShellRuntime.tsx b/apps/desktop/src/features/app/useAppShellRuntime.tsxindex 236fc447d..cb8f735b3 100644--- a/apps/desktop/src/features/app/useAppShellRuntime.tsx+++ b/apps/desktop/src/features/app/useAppShellRuntime.tsx@@ -17,6 +17,7 @@ import { StartupAnimation } from "../../components/StartupAnimation";import { StartupSplash } from "../../components/StartupSplash";import { api } from "../../lib/api";import { composerSuggestion } from "../chat/composer/plugins/suggestion-bridge";+import { usePluginBrowseState } from "../plugins/browse-state";import { subscribeRemoteInteractions } from "../../lib/remote-interactions";import { playNotificationChime } from "../../lib/notification-sound";import {@@ -447,6 +448,12 @@ export function useAppShellRuntime() {case "openLogs":await api.openLogs();break;+ case "openPluginMarket":+ // Sent by the launcher's empty state: land on the marketplace tab+ // of the plugins page instead of the installed list.+ store.setPage("plugins");+ usePluginBrowseState.getState().setTab("market");+ break;case "checkForUpdates": {const updateState = await api.updatesCheck();if (updateState.status === "up-to-date") {diff --git a/apps/desktop/src/lib/api.ts b/apps/desktop/src/lib/api.tsindex f69b1628a..d4a75193d 100644--- a/apps/desktop/src/lib/api.ts+++ b/apps/desktop/src/lib/api.ts@@ -1514,6 +1514,15 @@ export const api = {invoke(IPC.invoke.pluginLauncherOpenApp, { appId }),launcherOpenPlugin: (request: LauncherOpenPluginRequest) =>invoke(IPC.invoke.pluginOpenPanel, request),+ /**+ * Ask for a window height that fits what the panel currently renders. The+ * host clamps the value into the supported range and ignores nonsense.+ */+ launcherSetContentHeight: (height: number) =>+ invoke(IPC.invoke.pluginLauncherContentHeight, { height }),+ /** Leave the panel, focus the main window, and open the plugin market page. */+ launcherOpenPluginMarket: () =>+ invoke(IPC.invoke.pluginLauncherOpenMarket),listPluginThemes: () => invoke<PluginTheme[]>(IPC.invoke.pluginThemes),listPluginProviderCatalog: () =>invoke<PluginProviderCatalogMeta[]>(IPC.invoke.pluginProviderCatalog),diff --git a/apps/desktop/src/lib/launcher-height.ts b/apps/desktop/src/lib/launcher-height.tsnew file mode 100644index 000000000..f6b5dd1c7--- /dev/null+++ b/apps/desktop/src/lib/launcher-height.ts@@ -0,0 +1,39 @@+/**+ * Content-driven height math for the launcher panel.+ *+ * The panel no longer opens at a remembered, user-dragged height: it measures+ * what it renders and asks the main process for exactly that height. The+ * arithmetic lives here, free of the DOM and of `BrowserWindow`, so the+ * conversion can be unit-tested on its own.+ */++/** The pieces of the panel that add up to the window content height. */+export type LauncherContentParts = {+ /** Height of the search row. */+ searchRowHeight: number;+ /** Natural height of the results viewport: content plus the scroller padding. */+ resultsHeight: number;+ /** Height of the footer bar. */+ footerHeight: number;+ /** Panel padding plus the frame border drawn around the surface. */+ chromeHeight: number;+};++/**+ * Total content height for one render.+ *+ * Rounded up — a fractional measurement would otherwise leave a one-pixel+ * scrollbar on a panel that fits — and floored at zero, so a collapsed layout+ * during teardown never asks for a negative window.+ */+export function resolveLauncherContentHeight(+ parts: LauncherContentParts,+): number {+ const total =+ parts.searchRowHeight ++ parts.resultsHeight ++ parts.footerHeight ++ parts.chromeHeight;+ if (!Number.isFinite(total) || total <= 0) return 0;+ return Math.ceil(total);+}diff --git a/apps/desktop/src/lib/launcher-search.ts b/apps/desktop/src/lib/launcher-search.tsindex cdf989f58..ec1f076be 100644--- a/apps/desktop/src/lib/launcher-search.ts+++ b/apps/desktop/src/lib/launcher-search.ts@@ -9,11 +9,15 @@* Ranking, best first:* 0 declared trigger (whole-input regex match) — a plugin asking for `1+1`* outranks every name that merely contains `1`- * 1 exact name 2 exact alias+ * 1 exact name* 3 name prefix 4 pinyin prefix 5 initials prefix- * 6 name substring 7 pinyin substring 8 alias substring 9 description+ * 6 name substring 7 pinyin substring+ * 9 description* Ties break on recency, then plugins before applications, then name, then* catalog order — so the order is stable across renders.+ *+ * The rank is internal: tiles carry name, icon and type only, so a match never+ * has to be explained in a second text line.*/import {LAUNCHER_TRIGGER_INPUT_MAX_LENGTH,@@ -44,21 +48,23 @@ export const LAUNCHER_RECENT_TILES = LAUNCHER_COLUMNS * LAUNCHER_RECENT_ROWS;export const LAUNCHER_PINNED_TILES = LAUNCHER_COLUMNS * LAUNCHER_PINNED_ROWS;export const LAUNCHER_MATCH_TILES = LAUNCHER_COLUMNS * LAUNCHER_MATCH_ROWS;--/** One grid cell. */+/**+ * One grid cell.+ *+ * `iconDataUrl` is only ever set for applications; plugins always render their+ * monogram, because the host does not read a plugin's manifest icon yet.+ */export type LauncherTile = {/** `plugin:<id>` or `app:<key>`. */id: string;kind: LauncherItemKind;name: string;- /** Second line: how it matched, or what the plugin will receive. */- detail: string;- reason: LauncherMatchReason;monogram: string;iconDataUrl?: string;executableName?: string;appSource?: LauncherAppSource;pluginId?: string;+ /** Present only when a declared trigger claimed the whole input. */trigger?: { id: string; payload: string };};@@ -69,7 +75,6 @@ type IndexedItem = {nameText: string;pinyin: string;initials: string;- aliases: AliasKeys[];description?: string;descriptionText: string;iconDataUrl?: string;@@ -80,34 +85,6 @@ type IndexedItem = {order: number;};-/** One alias with every form the matcher compares against. */-type AliasKeys = {- raw: string;- text: string;- pinyin: string;- initials: string;-};--function aliasKeys(raw: string): AliasKeys {- const tokens = launcherPinyinTokens(raw);- return {- raw,- text: normalizeLauncherText(raw),- pinyin: tokens.full,- initials: tokens.initials,- };-}--/** The first alias whose text, pinyin or initials satisfy `test`. */-function aliasHit(- aliases: readonly AliasKeys[],- test: (form: string) => boolean,-): AliasKeys | undefined {- return aliases.find(- (alias) => test(alias.text) || test(alias.pinyin) || test(alias.initials),- );-}-/** A launchable item plus everything the matcher needs, computed once. */export type LauncherIndex = {items: IndexedItem[];@@ -119,7 +96,6 @@ function indexEntry(order: number,store: LauncherStoreSnapshot,): IndexedItem {- const aliases = (store.aliases[entry.id] ?? []).map(aliasKeys);const tokens = launcherPinyinTokens(entry.name);const triggers =entry.kind === "plugin"@@ -137,7 +113,6 @@ function indexEntry(nameText: normalizeLauncherText(entry.name),pinyin: tokens.full,initials: tokens.initials,- aliases,description: entry.kind === "plugin" ? entry.description : undefined,descriptionText: normalizeLauncherText(entry.kind === "plugin" ? (entry.description ?? "") : "",@@ -172,16 +147,12 @@ export function indexLauncherCatalog(function tile(item: IndexedItem,- reason: LauncherMatchReason,- detail: string,trigger?: { id: string; payload: string },): LauncherTile {return {id: item.id,kind: item.kind,name: item.name,- detail,- reason,monogram: launcherMonogram(item.name),iconDataUrl: item.iconDataUrl,executableName: item.executableName,@@ -205,15 +176,11 @@ function section(tiles: LauncherTile[], limit: number): LauncherSection {return { tiles: tiles.slice(0, limit), total: tiles.length };}-function resolveIds(- ids: readonly string[],- index: LauncherIndex,- reason: LauncherMatchReason,-): LauncherTile[] {+function resolveIds(ids: readonly string[], index: LauncherIndex): LauncherTile[] {const tiles: LauncherTile[] = [];for (const id of ids) {const item = index.byId.get(id);- if (item) tiles.push(tile(item, reason, ""));+ if (item) tiles.push(tile(item));}return tiles;}@@ -224,16 +191,38 @@ export function buildLauncherRecentSection(store: LauncherStoreSnapshot,limit: number = LAUNCHER_RECENT_TILES,): LauncherSection {- return section(resolveIds(store.recents, index, "recent"), limit);+ return section(resolveIds(store.recents, index), limit);}-/** Pinned section: one row by default. */+/** Pinned section: exactly one row, since `LAUNCHER_PIN_LIMIT` caps the pins. */export function buildLauncherPinnedSection(index: LauncherIndex,store: LauncherStoreSnapshot,limit: number = LAUNCHER_PINNED_TILES,): LauncherSection {- return section(resolveIds(store.pins, index, "pinned"), limit);+ return section(resolveIds(store.pins, index), limit);+}++/**+ * The "all plugins" view: every installed plugin in one grid.+ *+ * Recently used plugins come first (in recents order), the rest keep catalog+ * order, and local applications are deliberately excluded — this view answers+ * "what plugins do I have", not "what can I launch".+ */+export function buildLauncherAllPluginsSection(+ index: LauncherIndex,+ store: LauncherStoreSnapshot,+): LauncherSection {+ const rank = recencyRank(store);+ const plugins = index.items+ .filter((item) => item.kind === "plugin")+ .sort(+ (left, right) =>+ (rank.get(left.id) ?? rank.size) - (rank.get(right.id) ?? rank.size) ||+ left.order - right.order,+ );+ return { tiles: plugins.map((item) => tile(item)), total: plugins.length };}const TRIGGER_PATTERN_MAX_LENGTH = 200;@@ -280,8 +269,8 @@ export function matchLauncherTrigger(type Scored = {item: IndexedItem;score: number;+ /** Which tier produced the score. Ranking and tests only, never rendered. */reason: LauncherMatchReason;- detail: string;trigger?: { id: string; payload: string };};@@ -292,6 +281,9 @@ function queryTrimmed(query: string): string {/*** The hit view: at most `LAUNCHER_MATCH_TILES` tiles, plus the number of matches* the grid had to drop so the footer can ask the user to keep typing.+ *+ * A trigger match wins the whole item: the plugin is not also scored by name, so+ * it appears exactly once and always ahead of the name matches.*/export function searchLauncherItems(index: LauncherIndex,@@ -316,7 +308,7 @@ export function searchLauncherItems(left.item.order - right.item.order,);return section(- scored.map((hit) => tile(hit.item, hit.reason, hit.detail, hit.trigger)),+ scored.map((hit) => tile(hit.item, hit.trigger)),LAUNCHER_MATCH_TILES,);}@@ -339,7 +331,6 @@ function scoreItemNormalized(item,score: 0,reason: "pattern",- detail: payload,trigger: { id: trigger.id, payload },};}@@ -350,45 +341,28 @@ function scoreItemNormalized(function scoreByName(item: IndexedItem, query: string): Scored | null {if (item.nameText === query) {- return { item, score: 1, reason: "name", detail: item.name };- }- const exactAlias = aliasHit(item.aliases, (form) => form === query);- if (exactAlias) {- return { item, score: 2, reason: "alias", detail: exactAlias.raw };+ return { item, score: 1, reason: "name" };}if (item.nameText.startsWith(query)) {- return { item, score: 3, reason: "name", detail: item.name };- }- const prefixAlias = aliasHit(item.aliases, (form) => form.startsWith(query));- if (prefixAlias) {- return { item, score: 3, reason: "alias", detail: prefixAlias.raw };+ return { item, score: 3, reason: "name" };}if (item.pinyin.startsWith(query)) {- return { item, score: 4, reason: "pinyin", detail: item.pinyin };+ return { item, score: 4, reason: "pinyin" };}if (item.initials.startsWith(query)) {- return { item, score: 5, reason: "initials", detail: item.initials };+ return { item, score: 5, reason: "initials" };}if (item.nameText.includes(query)) {- return { item, score: 6, reason: "name", detail: item.name };+ return { item, score: 6, reason: "name" };}if (item.pinyin.includes(query)) {- return { item, score: 7, reason: "pinyin", detail: item.pinyin };+ return { item, score: 7, reason: "pinyin" };}if (item.initials.includes(query)) {- return { item, score: 7, reason: "initials", detail: item.initials };- }- const partialAlias = aliasHit(item.aliases, (form) => form.includes(query));- if (partialAlias) {- return { item, score: 8, reason: "alias", detail: partialAlias.raw };+ return { item, score: 7, reason: "initials" };}if (item.descriptionText.includes(query)) {- return {- item,- score: 9,- reason: "description",- detail: item.description ?? "",- };+ return { item, score: 9, reason: "description" };}return null;}diff --git a/apps/desktop/src/lib/launcher-store.ts b/apps/desktop/src/lib/launcher-store.tsindex 10223554b..a2afb0e1c 100644--- a/apps/desktop/src/lib/launcher-store.ts+++ b/apps/desktop/src/lib/launcher-store.ts@@ -3,14 +3,15 @@** These live in the renderer's `localStorage` rather than host-core: they are* presentation state for one floating panel (which tiles the user pinned, what- * they typed an alias for, what they opened last), and both the launcher window- * and the main window share one origin, so the plain web storage already- * survives a restart and already notifies the other window through `storage`.+ * they opened last), and both the launcher window and the main window share one+ * origin, so the plain web storage already survives a restart and already+ * notifies the other window through `storage`.** Every read is defensive: storage can hold another version's payload, a* truncated write, or a hand-edited value, and none of those may break the- * panel. Unreadable records are dropped, and the store only ever returns ids it- * can still resolve against the live catalog (`pruneLauncherState`).+ * panel. Unreadable records are dropped, unknown fields written by an older or+ * newer build are ignored without a write-back, and the store only ever returns+ * ids it can still resolve against the live catalog (`pruneLauncherState`).*/const STATE_KEY = "pi.desktop.launcher.state";@@ -19,22 +20,20 @@ const LEGACY_HISTORY_KEY = "pi.desktop.pluginLaunchHistory";/** Recency list cap. The panel shows 16 at a time but reports the total. */export const LAUNCHER_RECENT_LIMIT = 60;-/** Pin cap, so a runaway script cannot grow the state file without bound. */-export const LAUNCHER_PIN_LIMIT = 24;-/** Aliases kept per item. */-export const LAUNCHER_ALIAS_LIMIT = 6;-/** Longest single alias, in characters. */-export const LAUNCHER_ALIAS_MAX_LENGTH = 32;-/** Items that may carry aliases. */-const LAUNCHER_ALIAS_ENTRY_LIMIT = 200;+/**+ * Pin cap, so a runaway script cannot grow the state file without bound. The+ * panel shows the pins as one row of eight tiles, so pinning past this is+ * refused instead of quietly pushing an older pin out of sight.+ */+export const LAUNCHER_PIN_LIMIT = 8;+/** Items that may carry a launcher-only preference (hidden plugins). */+const LAUNCHER_ENTRY_LIMIT = 200;export type LauncherStoreSnapshot = {/** Item ids, most recently used first. */recents: string[];/** Item ids in the order the user pinned them. */pins: string[];- /** Item id -> user-authored search aliases. */- aliases: Record<string, string[]>;/** Plugin ids the user hid from the launcher only. */disabledPlugins: string[];/** `<pluginId>::<triggerId>` entries the user switched off. */@@ -46,7 +45,6 @@ export type LauncherStorage = Pick<Storage, "getItem" | "setItem">;export const EMPTY_LAUNCHER_STATE: LauncherStoreSnapshot = {recents: [],pins: [],- aliases: {},disabledPlugins: [],disabledTriggers: [],};@@ -96,23 +94,6 @@ export function launcherTriggerKey(pluginId: string, triggerId: string): stringreturn `${pluginId}::${triggerId}`;}-function sanitizeAliases(value: unknown): Record<string, string[]> {- if (!isRecord(value)) return {};- const out: Record<string, string[]> = {};- let entries = 0;- for (const [itemId, aliases] of Object.entries(value)) {- if (entries >= LAUNCHER_ALIAS_ENTRY_LIMIT) break;- if (!itemId.trim() || !Array.isArray(aliases)) continue;- const cleaned = stringList(aliases, LAUNCHER_ALIAS_LIMIT)- .map((alias) => alias.slice(0, LAUNCHER_ALIAS_MAX_LENGTH))- .filter(Boolean);- if (!cleaned.length) continue;- out[itemId] = cleaned;- entries += 1;- }- return out;-}-/** Legacy plugin-only history, translated to the launcher's item ids. */function legacyRecents(storage: LauncherStorage | null): string[] {const parsed = readRaw(storage, LEGACY_HISTORY_KEY);@@ -143,9 +124,8 @@ export function readLauncherState(return {recents: recents.length ? recents : legacyRecents(storage),pins: stringList(stored.pins, LAUNCHER_PIN_LIMIT),- aliases: sanitizeAliases(stored.aliases),- disabledPlugins: stringList(stored.disabledPlugins, LAUNCHER_ALIAS_ENTRY_LIMIT),- disabledTriggers: stringList(stored.disabledTriggers, LAUNCHER_ALIAS_ENTRY_LIMIT * 4),+ disabledPlugins: stringList(stored.disabledPlugins, LAUNCHER_ENTRY_LIMIT),+ disabledTriggers: stringList(stored.disabledTriggers, LAUNCHER_ENTRY_LIMIT * 4),};}@@ -188,32 +168,28 @@ export function rememberLauncherUse();}+/**+ * Pin or unpin one item.+ *+ * Pinning is refused once `LAUNCHER_PIN_LIMIT` items are pinned: the panel+ * shows the pins as a single row, so an extra pin would either reflow the grid+ * or silently evict a pin the user made earlier. Unpinning always works, and+ * re-pinning an item that is already pinned keeps its position.+ */export function setLauncherPinned(itemId: string,pinned: boolean,storage: LauncherStorage | null = defaultStorage(),): LauncherStoreSnapshot {return updateLauncherState((current) => {- const without = current.pins.filter((id) => id !== itemId);- if (!pinned) return { ...current, pins: without };- return { ...current, pins: [...without, itemId].slice(-LAUNCHER_PIN_LIMIT) };- }, storage);-}--export function setLauncherAliases(- itemId: string,- aliases: string[],- storage: LauncherStorage | null = defaultStorage(),-): LauncherStoreSnapshot {- const cleaned = stringList(- aliases.map((alias) => alias.trim().slice(0, LAUNCHER_ALIAS_MAX_LENGTH)),- LAUNCHER_ALIAS_LIMIT,- ).filter(Boolean);- return updateLauncherState((current) => {- const next = { ...current.aliases };- if (cleaned.length) next[itemId] = cleaned;- else delete next[itemId];- return { ...current, aliases: next };+ const existing = current.pins.includes(itemId);+ if (!pinned) {+ if (!existing) return current;+ return { ...current, pins: current.pins.filter((id) => id !== itemId) };+ }+ if (existing) return current;+ if (current.pins.length >= LAUNCHER_PIN_LIMIT) return current;+ return { ...current, pins: [...current.pins, itemId] };}, storage);}@@ -227,7 +203,7 @@ export function setLauncherPluginDisabled(return {...current,disabledPlugins: disabled- ? [...without, pluginId].slice(-LAUNCHER_ALIAS_ENTRY_LIMIT)+ ? [...without, pluginId].slice(-LAUNCHER_ENTRY_LIMIT): without,};}, storage);@@ -251,8 +227,8 @@ export function setLauncherTriggerDisabled(/*** Drop everything that names an item the catalog no longer offers, so an- * uninstalled plugin or a removed application disappears from recents, pins and- * aliases instead of leaving a tile that cannot open.+ * uninstalled plugin or a removed application disappears from recents and pins+ * instead of leaving a tile that cannot open.*/export function pruneLauncherState(knownItemIds: Iterable<string>,@@ -260,14 +236,9 @@ export function pruneLauncherState(): LauncherStoreSnapshot {const known = new Set(knownItemIds);const current = readLauncherState(storage);- const aliases: Record<string, string[]> = {};- for (const [itemId, value] of Object.entries(current.aliases)) {- if (known.has(itemId)) aliases[itemId] = value;- }const next: LauncherStoreSnapshot = {recents: current.recents.filter((id) => known.has(id)),pins: current.pins.filter((id) => known.has(id)),- aliases,// Plugin ids stay: a disabled plugin keeps its preference across a reload// that momentarily reports it as not-ready.disabledPlugins: current.disabledPlugins,@@ -275,8 +246,7 @@ export function pruneLauncherState(};if (next.recents.length !== current.recents.length ||- next.pins.length !== current.pins.length ||- Object.keys(next.aliases).length !== Object.keys(current.aliases).length+ next.pins.length !== current.pins.length) {writeLauncherState(next, storage);}diff --git a/apps/desktop/src/styles/plugin-launcher.css b/apps/desktop/src/styles/plugin-launcher.cssindex 390295f1e..d25c2d872 100644--- a/apps/desktop/src/styles/plugin-launcher.css+++ b/apps/desktop/src/styles/plugin-launcher.css@@ -68,14 +68,23 @@ html[data-surface="plugin-launcher"] #root {line-height: var(--leading-tight);}+/*+ * The scroller: the window is sized to the content, so this only scrolls when+ * the clamp in the main process stops the window from growing any further.+ */.plugin-launcher-results {min-height: 0;overflow-y: auto;overflow-x: hidden;padding: 8px 12px 10px;+}++/* Content-sized wrapper: measuring it is how the panel learns its own height. */+.plugin-launcher-results-content {display: flex;flex-direction: column;gap: 10px;+ align-content: start;}.plugin-launcher-group {@@ -102,9 +111,15 @@ html[data-surface="plugin-launcher"] #root {white-space: nowrap;}-.plugin-launcher-group-action {+.plugin-launcher-group-actions {margin-left: auto;flex: 0 0 auto;+ display: flex;+ align-items: center;+ gap: 6px;+}++.plugin-launcher-group-action {border: 0;padding: 2px 4px;border-radius: var(--radius-sm);@@ -130,6 +145,11 @@ html[data-surface="plugin-launcher"] #root {gap: 6px;}+/* The full plugin list packs its rows upward instead of spreading them. */+.plugin-launcher-grid-all {+ align-content: start;+}+.plugin-launcher-tile {position: relative;min-width: 0;@@ -169,8 +189,7 @@ html[data-surface="plugin-launcher"] #root {/** Shape is the fastest source signal: plugins are square, applications are- * round. A plugin and an application with the same name stay distinguishable- * without reading the tag line.+ * round. The type badge beside the name repeats it in words.*/.plugin-launcher-icon {width: 34px;@@ -192,8 +211,8 @@ html[data-surface="plugin-launcher"] #root {}.plugin-launcher-icon img {- width: 24px;- height: 24px;+ width: 26px;+ height: 26px;object-fit: contain;/** Native icons are already round or square; never stretch them. */pointer-events: none;@@ -205,8 +224,18 @@ html[data-surface="plugin-launcher"] #root {line-height: var(--leading-tighter);}-.plugin-launcher-tile-name {+/* Name and type badge share one line; the name is the part that truncates. */+.plugin-launcher-tile-line {width: 100%;+ min-width: 0;+ display: flex;+ align-items: baseline;+ justify-content: center;+ gap: 4px;+ overflow: hidden;+}++.plugin-launcher-tile-name {min-width: 0;overflow: hidden;color: inherit;@@ -217,32 +246,17 @@ html[data-surface="plugin-launcher"] #root {white-space: nowrap;}-.plugin-launcher-tile-detail {- width: 100%;- min-width: 0;- display: flex;- align-items: baseline;- gap: 4px;- overflow: hidden;+.plugin-launcher-tile-type {+ flex: 0 0 auto;color: var(--ds-text-faint);font-size: var(--text-2xs, 10px);+ font-weight: var(--font-weight-normal);line-height: var(--leading-compact);-}--.plugin-launcher-source {- flex: 0 0 auto;- color: var(--ds-text-muted);- opacity: 0.85;-}--.plugin-launcher-detail-text {- min-width: 0;- overflow: hidden;- text-overflow: ellipsis;white-space: nowrap;}-.plugin-launcher-tile-menu {+/* The pin is quiet until the cell is under the pointer or focus. */+.plugin-launcher-pin {position: absolute;top: 2px;right: 2px;@@ -254,25 +268,43 @@ html[data-surface="plugin-launcher"] #root {border-radius: var(--radius-sm);background: transparent;color: var(--ds-text-faint);- font-size: var(--text-xs);- line-height: var(--leading-tighter);opacity: 0;cursor: pointer;}-.plugin-launcher-tile:hover .plugin-launcher-tile-menu,-.plugin-launcher-tile.active .plugin-launcher-tile-menu,-.plugin-launcher-tile:focus-within .plugin-launcher-tile-menu {+.plugin-launcher-tile:hover .plugin-launcher-pin,+.plugin-launcher-tile.active .plugin-launcher-pin,+.plugin-launcher-tile:focus-within .plugin-launcher-pin,+.plugin-launcher-pin[aria-pressed="true"] {opacity: 1;}-.plugin-launcher-tile-menu:hover {+.plugin-launcher-pin[aria-pressed="true"] {+ /* Same text colour as an active tile: the fill, not a hue, marks "pinned". */+ color: var(--ds-text-primary);+}++/* A filled glyph is the "already pinned" state, without a second icon set. */+.plugin-launcher-pin[aria-pressed="true"] svg {+ fill: currentColor;+}++.plugin-launcher-pin:hover {background: var(--ds-tile-deep);color: var(--ds-text-primary);}+.plugin-launcher-pin:focus-visible {+ outline: 2px solid var(--ds-accent);+ outline-offset: -2px;+}++/*+ * Empty states are short and fixed: the window follows the content, so a+ * `height: 100%` block would collapse to nothing.+ */.plugin-launcher-empty {- height: 100%;+ min-height: 96px;display: flex;flex-direction: column;align-items: center;@@ -282,6 +314,29 @@ html[data-surface="plugin-launcher"] #root {font-size: var(--text-sm-plus);}+.plugin-launcher-empty-action {+ border: 1px solid var(--ds-border);+ padding: 5px 10px;+ border-radius: var(--radius-sm);+ background: var(--ds-tile);+ color: var(--ds-text-secondary);+ font-size: var(--text-xs);+ cursor: pointer;+}++.plugin-launcher-empty-action:hover {+ background: var(--ds-bg-hover);+ color: var(--ds-text-primary);+}++.plugin-launcher-pin-notice {+ min-width: 0;+ overflow: hidden;+ color: var(--ds-text-muted);+ text-overflow: ellipsis;+ white-space: nowrap;+}+.plugin-launcher-footer {min-width: 0;display: flex;@@ -304,84 +359,30 @@ html[data-surface="plugin-launcher"] #root {white-space: nowrap;}-.plugin-launcher-menu-backdrop {- position: absolute;- inset: 0;- z-index: 2;-}--.plugin-launcher-menu {- position: absolute;- right: 14px;- bottom: 46px;- z-index: 3;- width: 240px;- display: flex;- flex-direction: column;- gap: 8px;- padding: 10px;- border: 1px solid var(--ds-border-strong);- border-radius: var(--radius-md);- background: var(--ds-bg-elevated-opaque);- box-shadow: var(--shadow-popover, none);-}--.plugin-launcher-menu-title {- overflow: hidden;- color: var(--ds-text-primary);- font-size: var(--text-sm-plus);- text-overflow: ellipsis;- white-space: nowrap;-}--.plugin-launcher-menu-label {- color: var(--ds-text-muted);- font-size: var(--text-xs);-}--.plugin-launcher-menu-input {- width: 100%;- min-width: 0;- padding: 6px 8px;- border: 1px solid var(--ds-border-strong);- border-radius: var(--radius-sm);- background: var(--ds-tile-deep);- color: var(--ds-text-primary);- font-size: var(--text-sm);- outline: 0;-}--.plugin-launcher-menu-input:focus-visible {- border-color: var(--ds-accent);-}--.plugin-launcher-menu-row {- display: flex;- gap: 8px;-}--.plugin-launcher-menu-action {- flex: 1;- padding: 6px 8px;- border: 1px solid var(--ds-border);- border-radius: var(--radius-sm);- background: var(--ds-tile);- color: var(--ds-text-secondary);- font-size: var(--text-xs);- cursor: pointer;-}--.plugin-launcher-menu-action:hover {- background: var(--ds-bg-hover);- color: var(--ds-text-primary);-}-@media (prefers-reduced-motion: no-preference) {.plugin-launcher-tile-open,- .plugin-launcher-tile-menu {+ .plugin-launcher-pin {transition:background-color 120ms ease,color 120ms ease,opacity 120ms ease;}++ /* Refused pin: the row it belongs to shakes once, so the eye finds it. */+ .plugin-launcher-pin-group.shaking {+ animation: plugin-launcher-pin-shake 300ms ease;+ }+}++@keyframes plugin-launcher-pin-shake {+ 0%,+ 100% {+ transform: translateX(0);+ }+ 25% {+ transform: translateX(-4px);+ }+ 75% {+ transform: translateX(4px);+ }}diff --git a/packages/shared/src/protocol.ts b/packages/shared/src/protocol.tsindex 3e5eb26bc..ecdabac68 100644--- a/packages/shared/src/protocol.ts+++ b/packages/shared/src/protocol.ts@@ -14,6 +14,9 @@ export const APP_MENU_COMMANDS = ["openHelp","openLogs","checkForUpdates",+ /** Brings the main window forward on the plugin market page (launcher empty+ * state, and any other surface that wants to send the user shopping). */+ "openPluginMarket",] as const;export type AppMenuCommand = (typeof APP_MENU_COMMANDS)[number];@@ -341,6 +344,10 @@ export const IPC = {pluginLauncherDismiss: "pi-desktop/pluginLauncher/dismiss",pluginLauncherCatalog: "pi-desktop/pluginLauncher/catalog",pluginLauncherOpenApp: "pi-desktop/pluginLauncher/openApp",+ /** Content-driven window height, measured by the panel itself. */+ pluginLauncherContentHeight: "pi-desktop/pluginLauncher/contentHeight",+ /** Close the panel, focus the main window, and open the plugin market. */+ pluginLauncherOpenMarket: "pi-desktop/pluginLauncher/openMarket",pluginThemes: "pi-desktop/plugin/themes",pluginProviderCatalog: "pi-desktop/plugin/providerCatalog",pluginScenicThemesDestinations: "pi-desktop/plugin/scenicThemes/destinations",diff --git a/packages/shared/src/types/launcher.ts b/packages/shared/src/types/launcher.tsindex fb668b1c2..0174e01d1 100644--- a/packages/shared/src/types/launcher.ts+++ b/packages/shared/src/types/launcher.ts@@ -13,14 +13,15 @@export type LauncherItemKind = "plugin" | "app";/**- * Why the launcher surfaced an item. Rendered as the tile's second line so the- * user learns how they matched instead of guessing.+ * Why the launcher surfaced an item.+ *+ * Ranking is the only consumer: the panel no longer explains a match in a+ * second text line, so this value never reaches the renderer's tiles.*/export type LauncherMatchReason =| "name"| "pinyin"| "initials"- | "alias"| "description"| "pattern"| "pinned"@@ -72,10 +73,10 @@ export type LauncherAppEntry = {/** Opaque item id: `app:<stableKey>`. */id: string;name: string;- /** Executable file name without extension, for the tile's source tag. */+ /** Executable file name without extension, used by the tile's tooltip. */executableName?: string;source: LauncherAppSource;- /** Small PNG data URL, when the platform could produce one. */+ /** PNG data URL, when the platform could produce one. */iconDataUrl?: string;};@@ -94,6 +95,17 @@ export type LauncherOpenAppRequest = {appId: string;};+/**+ * Ask the main process to give the launcher window exactly this content height.+ *+ * The panel measures its own content (search row, results, footer) and the+ * host clamps the value into the supported range, so the window always fits+ * what it shows instead of carrying a remembered user-dragged height.+ */+export type LauncherContentHeightRequest = {+ height: number;+};+/*** Open a plugin panel from the launcher, optionally handing it the input that* triggered it. `payload` is delivered to the plugin exactly once, only to the