import type { Option } from "@clack/prompts"; export type SelectChoice = { value: string; label: string; hint?: string; /** * An action row rather than a datum — "create a new one". It shows while * nothing is typed, and again once a search has ruled out everything else, * but never beside real matches: clack puts the cursor on the first visible * row, so a create row surviving a search that found the right workspace * would have Enter create a second one. */ fallback?: boolean; }; /** * Whether this run may block on a person: not a coding agent, not CI, and * something that can actually answer (a TTY, or `/dev/tty` on the Cargo CLI). * * Agent harnesses often allocate a PTY, so `hasPromptInput` alone is not * enough — `isCodingAgent` is the gate that prevents a hang. */ export declare function shouldWaitForPerson(input: { isCodingAgent: boolean; isCi: boolean; hasPromptInput: boolean; }): boolean; /** * Past this many rows a list is faster to filter than to scroll. Shared with * the palette, which makes the same call about the same terminal. */ export declare const FILTER_THRESHOLD = 10; export declare const MAX_VISIBLE_ROWS = 12; /** * Whether this run may ask the user a question: a real terminal on both ends, * not CI, and not driven by a coding agent. Commands that also accept `--json` * must additionally refuse to prompt when it is set. */ export declare function isInteractive(): boolean; /** * Ask the user to pick one of `choices`, defaulting to `recommended`. * * A long list gets the type-ahead filter rather than a scroll: a workspace list * or the cookbook catalog runs well past what a terminal shows at once, and * arrowing through forty rows to reach a name you already know is the slowest * way to answer a question you have already answered in your head. */ export declare function selectOne(payload: { message: string; choices: SelectChoice[]; recommended?: string; /** * Answer to use when the prompt is cancelled (Escape, ctrl-c), for a * question where cancelling means "not this" rather than "abandon the * command" — see `askConfirm`'s `skippable`. A tool-approval prompt inside a * chat turn is the case that needs it: leaving would drop the whole session. */ cancelValue?: string; }): Promise; /** * The type-ahead filter for one set of choices: ordinary rows are matched on * their text, and a `fallback` row is kept exactly when it is the useful * answer — before anything is typed, and after a search has ruled the real * rows out. * * Exported for tests; `selectOne` is the only production caller. */ export declare function choiceFilter(choices: readonly SelectChoice[]): (search: string, option: Option) => boolean; type AskTextPayload = { message: string; placeholder?: string; defaultValue: string; validate?: (raw: string | undefined) => string | undefined; /** See `askConfirm`. Cancelling yields `defaultValue` instead of leaving. */ skippable?: boolean; }; /** Ask for a line of text, with `defaultValue` used when nothing is typed. */ export declare function askText(payload: AskTextPayload & { absentOnCancel: true; }): Promise; export declare function askText(payload: AskTextPayload): Promise; /** Ask a yes/no question. */ export declare function askConfirm(payload: { message: string; recommended: boolean; /** * Whether cancelling this one question means "not this", rather than * "abandon the command". * * Leaving is the default because it is right for a question the command * cannot proceed without. It is wrong for an optional step standing in front * of work already done: Escape on the research offer used to discard the * company answers given seconds earlier and the file they were headed for, * while answering *No* kept both. */ skippable?: boolean; }): Promise; /** * Refuse a run that needs an answer it cannot ask for, naming the exact command * to re-run. An agent reads one line and knows what to add, rather than having * to work the flag out from a usage dump. */ export declare function requireAnswer(payload: { needs: string; retryCommand: string; }): never; export {}; //# sourceMappingURL=prompt.d.ts.map