/** * Cursor-aware slash and file-mention completion (INPUT-008, V2-044/045). * * Slash commands are recognized through the command token and its trailing * whitespace on the first line. File mentions reuse the existing * renderer-independent detector (`src/ui/mentions.ts`). */ import { type FileSuggestion } from "../../ui/mentions.js"; import type { CommandRegistry } from "../../app/commands/registry.js"; import type { CommandDefinition } from "../../app/commands/command.js"; export interface SlashToken { readonly token: string; readonly start: number; readonly end: number; } export declare function detectSlashToken(value: string, cursorOffset: number): SlashToken | undefined; export declare function slashSuggestions(registry: CommandRegistry, value: string, cursorOffset: number): CommandDefinition[]; export interface MentionMatch { readonly start: number; readonly query: string; readonly suggestions: readonly FileSuggestion[]; } export declare function mentionSuggestions(value: string, cursorOffset: number, baseDir?: string, limit?: number): MentionMatch | undefined; export type CompletionMenu = { readonly kind: "slash"; readonly start: number; readonly end: number; readonly items: readonly CommandDefinition[]; } | { readonly kind: "mention"; readonly start: number; readonly items: readonly FileSuggestion[]; } | { readonly kind: "none"; }; export interface ActivatedSlashCompletion { readonly command: string; readonly value: string; readonly cursorOffset: number; } export declare function activateSlashCompletion(menu: CompletionMenu, value: string, index: number): ActivatedSlashCompletion | undefined; /** True when a native cursor/input event would render the identical menu. */ export declare function sameCompletionMenu(a: CompletionMenu, b: CompletionMenu): boolean; /** Slash takes priority since a mention cannot start a line with "/". */ export declare function resolveCompletionMenu(registry: CommandRegistry, value: string, cursorOffset: number, baseDir?: string): CompletionMenu;