/** * Ctrl+X leader actions and the Ctrl+P command palette (OpenCode keybinds). * * Leader (ctrl+x, then): * n new session l sessions (resume) r resume last m model * t theme b toggle sidebar d diff view a toggle Build/Plan * c compact x export g tree y copy last msg * s status (/session) h hotkeys q quit ? leader help * * Built-in pi commands (/new, /model, ...) are only reachable by submitting them through the * editor, so leader actions that map to a slash command call the editor's onSubmit, which is * pi's own command dispatcher. */ import type { ExtensionAPI, ExtensionContext, Theme } from "@earendil-works/pi-coding-agent"; import { type Component, type Focusable } from "@earendil-works/pi-tui"; export interface LeaderAction { key: string; label: string; /** Slash command submitted through pi's dispatcher, or a function. */ run: string | (() => void); } export declare function leaderActions(hooks: { toggleSidebar: () => void; cycleMode: () => void; showHelp: () => void; }): LeaderAction[]; export interface PaletteItem { value: string; label: string; description?: string; /** Right-aligned hint, e.g. the key binding. */ hint?: string; } /** All slash commands for the palette: built-ins, extension commands, prompts, skills. */ export declare function paletteItems(pi: ExtensionAPI, builtins: ReadonlyArray<{ name: string; description?: string; }>, leader: LeaderAction[], widgetItems?: PaletteItem[]): PaletteItem[]; /** Fuzzy-ish match: every query character in order, scored by compactness and prefix. */ export declare function fuzzyScore(query: string, text: string): number | undefined; export declare function filterPalette(items: PaletteItem[], query: string): PaletteItem[]; /** Centered command palette: a search input over a filtered list. */ export declare class CommandPalette implements Component, Focusable { focused: boolean; private readonly input; private readonly items; private readonly theme; private readonly done; private readonly maxVisible; private list; private filtered; constructor(items: PaletteItem[], theme: Theme, done: (value: string | undefined) => void, maxVisible?: number); private makeList; invalidate(): void; handleInput(data: string): void; render(width: number): string[]; } /** Leader help overlay contents. */ export declare function leaderHelpLines(actions: LeaderAction[], theme: Theme): string[]; export declare function runPaletteValue(value: string, ctx: ExtensionContext, actions: LeaderAction[], submit: (text: string) => void): void;