import { type Component, Container } from "@oh-my-pi/pi-tui";
import type { SessionInfo } from "../../session/session-listing.js";
/** Returns the IDs of sessions whose recorded prompts match a query, best first. */
export type SessionHistoryMatcher = (query: string) => string[];
/**
 * Filter and rank session picker search results.
 *
 * Resume search narrows a recency-sorted list: once every query token appears
 * as a literal substring, newer sessions should beat a slightly better fuzzy
 * position match. Pure fuzzy/acronym matches still sort by fuzzy score after
 * literal matches, but weak pure fuzzy tokens are dropped as noise.
 */
export declare function rankSessionSearchMatches(allSessions: SessionInfo[], query: string): SessionInfo[];
/**
 * Combine metadata matches with prompt-history matches for ranking, using both
 * signals rather than replacing one with the other.
 *
 * - `fuzzy` is the ordered metadata/session-text result.
 * - `historyIds` are session IDs whose recorded prompts matched the query,
 *   ordered by prompt-history rank (typically newest matching prompt first); duplicates are tolerated.
 *
 * Ranking: prompt-history matches lead in history order, then remaining
 * metadata matches keep their existing order. A metadata match is never dropped,
 * and history matches not present in `allSessions` (e.g. deleted or out-of-scope
 * sessions) are ignored since they cannot be resumed from here.
 */
export declare function mergeSessionRanking(allSessions: SessionInfo[], fuzzy: SessionInfo[], historyIds: string[]): SessionInfo[];
/**
 * Custom session list component with multi-line items and search
 */
declare class SessionList implements Component {
    #private;
    onSelect?: (session: SessionInfo) => void;
    onCancel?: () => void;
    onExit: () => void;
    onToggleScope?: () => void;
    onDeleteRequest?: (session: SessionInfo) => void;
    constructor(sessions: SessionInfo[], showCwd?: boolean, historyMatcher?: SessionHistoryMatcher, getTerminalRows?: () => number);
    /** Replace the visible dataset, e.g. when toggling folder/all-projects scope. */
    setSessions(sessions: SessionInfo[], showCwd: boolean): void;
    removeSession(sessionPath: string): void;
    /** Resolve a list-local rendered-line index to a filtered-session index. */
    hitTestSession(line: number): number | undefined;
    /** Wheel notch: move the selection one step (clamped, no wrap). */
    handleWheel(delta: -1 | 1): void;
    /** Mouse click: select the session under the pointer and resume it. */
    selectAndConfirm(index: number): void;
    invalidate(): void;
    render(width: number): readonly string[];
    handleInput(keyData: string): void;
}
export interface SessionSelectorOptions {
    onDelete?: (session: SessionInfo) => Promise<boolean>;
    historyMatcher?: SessionHistoryMatcher;
    /** Loads sessions across all projects for the all-projects scope toggle (Tab). */
    loadAllSessions?: () => Promise<SessionInfo[]>;
    /** Preloaded all-projects list; cached so the first Tab toggle is instant. */
    allSessions?: SessionInfo[];
    /**
     * Reads the live terminal height so the visible window fits the viewport.
     * Omitted only in tests; defaults to a conservative 24 rows.
     */
    getTerminalRows?: () => number;
    /**
     * Fill the whole viewport and pin the footer (hint + bottom border) to the
     * last rows, so the footer stops drifting as the list window changes height.
     * Set by the standalone `--resume` picker (fullscreen alternate screen); the
     * in-editor selector leaves it off and renders compactly.
     */
    fillHeight?: boolean;
}
/**
 * Component that renders a session selector with optional confirmation dialog
 */
export declare class SessionSelectorComponent extends Container {
    #private;
    constructor(sessions: SessionInfo[], onSelect: (session: SessionInfo) => void, onCancel: () => void, onExit: () => void, options?: SessionSelectorOptions);
    setOnRequestRender(callback: () => void): void;
    /**
     * Concatenate the children's renders (like {@link Container}) while recording
     * the line where the session list begins, so the fullscreen picker can hit-
     * test mouse rows against the live list window. SessionList rebuilds its lines
     * every frame, so Container's reference-memoization never applied here.
     *
     * In fill-height mode the body is padded (or, on a cramped terminal, trimmed)
     * to leave exactly enough room for the footer at the screen bottom, so the
     * footer is always visible and never drifts as the list window resizes. The
     * in-editor selector just appends the footer directly.
     */
    render(width: number): readonly string[];
    handleInput(keyData: string): void;
    getSessionList(): SessionList;
}
export {};
