/** * A dry run's script: the answers that stand in for each agent turn, each * check's script run, each commit and each question, checked against the flow * before the first one is taken. * * A key is a node's address (`gate/ask`) or an exact visit path * (`deliver#2/gate/ask`), the path winning. Its value is one answer, which * serves every attempt, or a list, consumed attempt by attempt within the * enclosing path, so each item of a `map` has its own list and a loop's * iterations share one. A list is always a list of answers, so a node whose * output is a list is answered inside one: `[["a", "b"]]`. An answer is an * output, the `verdict` call of a `verdict:` node, a check's `{ passed, * report }`, a commit's `{ committed, sha?, branch }`, an ask's output, or * `{ fail: }`. An ask's `nobody` and `timeout` take the node's real * path, its `default:` or its `enough:` included, and its `stopped` is the * card declined. A `flow` node is answered whole with its callee's output or * `{ fail: "child" }`, or walked into by keys under it, never both. */ import type { ScriptOutcome } from "../../verify.ts"; import { type CheckedFlow } from "../checked.ts"; import type { Heard } from "./ask.ts"; import type { CommitOutcome } from "./commit.ts"; import { type Ended } from "./ended.ts"; import type { ScriptedTurn } from "./scripted.ts"; /** Why a script is refused. Stable, so a test of a flow can assert on them. */ export declare const ANSWER_CODES: readonly ["answer-unknown-node", "answer-past-max", "answer-off-schema", "answer-fail-kind", "answer-flow-overlap"]; /** A script's mistake: its code, the key (and its place in a list), and one sentence. */ export type AnswerFault = { /** Which of {@link ANSWER_CODES}. */ readonly code: (typeof ANSWER_CODES)[number]; /** The key of `answers` it is about. */ readonly at: string; /** One sentence saying what is wrong with it. */ readonly message: string; }; /** The answers of a dry run, by node address or visit path. */ export type Answers = Readonly>; /** A checked script, handing out one turn per attempt. */ export declare class Script { private readonly answers; private readonly nodes; private readonly taken; private constructor(); /** `answers` checked against `flow`: a script, or every fault found in it. */ static check(flow: CheckedFlow, answers: Answers): { ok: true; script: Script; } | { ok: false; faults: AnswerFault[]; }; /** * The turn the attempt at visit `path`, of the agent node at `at`, takes, * or `undefined` when nothing scripts it. */ next(path: string, at: string): ScriptedTurn | undefined; /** * How the check or the commit at `at` ends at visit `path`, or `undefined` * when nothing scripts it: the outcome its port would give. */ ran(path: string, at: string): T | undefined; /** What the person's side of the ask at `at` gives at visit `path`, or `undefined` when nothing scripts it. */ heard(path: string, at: string): Heard | undefined; /** How the call at `at` ends at visit `path` when it is answered whole, or `undefined` to walk into its callee. */ whole(path: string, at: string): Ended | undefined; /** The answer the visit `path` of the node at `at` takes: its path's, else its address's, one per attempt from a list. */ private take; } //# sourceMappingURL=answers.d.ts.map