/** * The search query: which field a hit landed in, how well it scored, and what * the row should light up. * * @author mystery4f <40482524+mystery4f@users.noreply.github.com> */ import type { Task } from "../../tasks/base/task.js"; /** * True when the query's characters all appear in the field, in order: the match * `dbg` makes against `deploy-bg`, where the three letters never sit together. */ /** The task field a hit landed in; the row renders the match in the field it can see. */ export type MatchField = "name" | "id" | "status" | "kind" | "step" | "command" | "prompt"; /** Where a row's query landed: the field, how well it scored, and what to light up. */ export interface RowMatch { readonly field: MatchField; readonly score: number; readonly positions: readonly number[]; /** The hit came from a word the row never prints, so the row has to say so. */ readonly hidden: boolean; /** Which of the chain's steps matched, when the field is a step name. */ readonly stepIndex?: number; } /** * The best-scoring field of the task for this query, or undefined when none * matches. A name heads the row, so it outranks an id, a status or a command hit * at the same tightness; a chain row shows its step names in place of a name, so * those rank next, and a prompt or a command is a word the row never prints, so * it ranks below everything the reader can see. */ export declare function bestFieldMatch(task: Task, query: string, steps?: readonly { name: string; index: number; }[]): RowMatch | undefined; /** * The pasted text as a query. A newline would otherwise read as Enter and a tab as * a key of its own, so both become spaces; the remaining C0 controls are dropped. */ export declare function pastedQuery(data: string): string | undefined; /** A printable keypress; key sequences, Enter and Escape are not part of a query. */ export declare function typedQuery(data: string): string | undefined;