/**
 * Search and filtering logic for the session selector.
 *
 * Supports three query modes: fuzzy token matching (default), quoted "phrase"
 * exact matching, and `re:<pattern>` regex matching.  Provides sort modes
 * (threaded, recent, relevance) and an optional name-only filter.
 */
import type { SessionInfo } from '../../../app/session/session-catalog.js';
export type SortMode = 'threaded' | 'recent' | 'relevance';
export type NameFilter = 'all' | 'named';
export interface ParsedSearchQuery {
    mode: 'tokens' | 'regex';
    tokens: {
        kind: 'fuzzy' | 'phrase';
        value: string;
    }[];
    regex: RegExp | null;
    /** If set, parsing failed and we should treat query as non-matching. */
    error?: string;
}
export interface MatchResult {
    matches: boolean;
    /** Lower is better; only meaningful when matches === true */
    score: number;
}
export declare function hasSessionName(session: SessionInfo): boolean;
/** Parse a raw query string into a structured search query. */
export declare function parseSearchQuery(query: string): ParsedSearchQuery;
/** Test whether a session matches the parsed query and compute a relevance score. */
export declare function matchSession(session: SessionInfo, parsed: ParsedSearchQuery): MatchResult;
/** Filter sessions by query and name filter, then sort according to the active sort mode. */
export declare function filterAndSortSessions(sessions: SessionInfo[], query: string, sortMode: SortMode, nameFilter?: NameFilter): SessionInfo[];
//# sourceMappingURL=session-selector-search.d.ts.map