import type { DocumentRegistry } from '@jupyterlab/docregistry'; import type { TranslationBundle } from '@jupyterlab/translation'; import { LabIcon } from '@jupyterlab/ui-components'; import type { CommandRegistry } from '@lumino/commands'; import type { IAgent } from '../launcher/agents'; import type { OmniboxRecents } from './recents'; /** * The source a result row came from, used to group rows under a header. */ type OmniboxItemKind = 'command' | 'file' | 'agent'; /** * A single result row, with the action it runs when chosen. */ export interface IOmniboxItem { kind: OmniboxItemKind; /** * Stable React key. */ key: string; /** * Primary text shown on the row. */ label: string; /** * Indices of matched characters in `label`, for highlighting. May be empty. */ matchIndices: readonly number[]; /** * Optional secondary text shown trailing the label. */ caption?: string; /** * Optional leading icon. */ icon?: LabIcon; /** * Run the row's action. */ execute: () => void; } /** * Results grouped by source; each group is already capped and sorted. */ interface IOmniboxSections { /** * Recently used commands and files, shown while the term is empty. */ recent: IOmniboxItem[]; commands: IOmniboxItem[]; files: IOmniboxItem[]; agents: IOmniboxItem[]; } interface IComputeOptions { query: string; commands: CommandRegistry; docRegistry: DocumentRegistry; agents: IAgent[]; files: string[]; /** * Recently-used tracker; `null` disables the recent rows and recording. */ recents: OmniboxRecents | null; trans: TranslationBundle; } /** * Build the grouped result set for a query. A leading `>` searches only * commands and a leading `/` only files; otherwise commands and files are * fuzzy-matched and every prompt-capable agent is offered an "Ask" row * carrying the query as its prompt. An empty term yields the recently used * rows for the active mode instead (and the widget shows a hint when there * are none). */ export declare function computeSections(options: IComputeOptions): IOmniboxSections; export {};