/** * Persona projection shown in the interactive picker. Description and source * label come straight from the resolved spec / cascade so the user sees what * they'd see in `agentworkforce list`. */ export interface TuiCandidate { id: string; description: string; source: string; } export declare function defaultRecentsPath(workforceHomeDir?: string): string; /** * Parse the on-disk recents file. Returns an empty list on any shape problem — * the recents store is best-effort UX and must never block the CLI from * launching an agent. */ export declare function parseRecents(text: string): string[]; export declare function loadRecents(path?: string): string[]; /** * Move `id` to the front of the recents list, dedup, cap. Pure so tests don't * need a temp dir. */ export declare function nextRecents(prev: readonly string[], id: string, cap?: number): string[]; /** * Persist a persona id at the top of the recents list. Swallows IO errors — * a corrupt or unwritable recents file should never block a launch. */ export declare function recordRecent(id: string, path?: string): void; /** * Subsequence fuzzy match. Returns null when not all query chars appear in * order; otherwise returns a numeric score where smaller is a better match. * Score combines leading offset and gap size so prefix / dense matches sort * above scattered ones. */ export declare function fuzzyScore(query: string, target: string): number | null; /** * Rank candidates by best fuzzy match across name OR description. Name matches * outrank description matches at equal score to keep the picker feeling * direct — typing "rev" should surface "code-reviewer" not whichever persona * happens to mention "reviews" in prose. */ export declare function rankCandidates(candidates: readonly TuiCandidate[], query: string): TuiCandidate[]; /** * Project recent ids onto the candidate list, preserving recency order and * dropping ids that no longer resolve (uninstalled pack, renamed local * persona, etc.). */ export declare function recentCandidates(candidates: readonly TuiCandidate[], recentIds: readonly string[], cap?: number): TuiCandidate[]; export interface RunPersonaTuiOptions { candidates: readonly TuiCandidate[]; recentIds: readonly string[]; stdin?: NodeJS.ReadStream; stderr?: NodeJS.WriteStream; /** Cap on visible rows. Tests inject a small number; default 20. */ visibleCap?: number; /** Escape-sequence debounce in ms. Tests inject 0; default 50. */ escapeTimeoutMs?: number; } export type TuiViewMode = 'recents' | 'all' | 'matches'; export interface TuiView { mode: TuiViewMode; items: TuiCandidate[]; } /** * Decide what the picker should show given the candidate set, recents list, * and current query. Exported (and pure) so the recents-header logic can be * unit-tested without spinning up a TTY. * * - `recents` — empty query AND at least one recent id still resolves to a * known candidate. * - `all` — empty query AND no recent ids resolve (fresh install, or all * previously-used personas have been uninstalled/renamed). * - `matches` — non-empty query; items are the ranked fuzzy hits. */ export declare function computeTuiView(candidates: readonly TuiCandidate[], recentIds: readonly string[], query: string, visibleCap?: number): TuiView; /** * Interactive persona picker. Renders inside the alternate screen buffer so * scrollback survives, raw-mode reads single keystrokes for arrow/enter/esc * handling, and resolves with the chosen persona id (or undefined on quit). * * Falls back to undefined immediately when stdin or stderr isn't a TTY — the * caller should print the regular help text in that case. */ export declare function runPersonaPickerTui(opts: RunPersonaTuiOptions): Promise; //# sourceMappingURL=persona-tui.d.ts.map