/** * One visit of an `ask` node: its question put to a person, and what not * answering gives. * * Not answering is a value wherever the file says what it is: `default:` * when nobody answers, there or in time, and `answered: false` when the card * offers "that's enough". Only a question that has neither fails, with * `nobody` or `timeout`. Declining a card that offers no "enough" is the * run's stop key, pressed on the card that holds it. */ import type { Answer, Asking, Question } from "../../ask.ts"; import type { GitResult } from "../../git/index.ts"; import type { CheckedAskNode } from "../checked.ts"; import { type Visited } from "./ended.ts"; import type { Here } from "./walk.ts"; /** A question as it goes to the person: the question, and how the card puts it. */ export type Card = { readonly question: Question; readonly asking: Omit; }; /** * What the person's side gave: the node's output, the person declining the * card, or nobody answering, there or before the node's `timeout:`. */ export type Heard = { readonly output: unknown; } | { readonly declined: true; } | { readonly missed: "nobody" | "timeout"; }; /** What an ask visit needs from the run around it. */ export type AskingRun = { /** The run's signal: aborted, nothing starts and nothing catches the failure. */ readonly signal: AbortSignal; /** Puts `card` for the visit `path` of `node`; aborting `cut` takes it down. */ ask(node: CheckedAskNode, path: string, card: Card, cut: AbortSignal): Promise; /** What `tree` changed since `HEAD`, as `diff` reads it. */ diff(tree: string | undefined): Promise>; /** Stops the whole run, as its stop key does. */ stop(): void; }; /** Visits `node` at `path`. A stop or a cut is read off the signals, never off what the person's side says. */ export declare function visitAsk(run: AskingRun, node: CheckedAskNode, path: string, at: Here): Promise; /** What `node` outputs once `answer` came back: a choice card's pick, a yes or no, or a free text. */ export declare function outputOf(node: CheckedAskNode, answer: Answer): unknown; //# sourceMappingURL=ask.d.ts.map