/** * Why a flow is refused before its first spawn: a stable code, the file, where * in it, and one sentence. * * A fault is data, not an exception, so validation hands back every fault at * once and a caller formats them as it likes (`/flows` writes one per line, * `file at: message`). Codes are a closed set: tests assert them, and the * table in `docs/guide/flows.md` explains each one, which `npm test` holds to * this list. */ /** Every code a fault can carry. Adding one means adding its row to the guide's table. */ export declare const FAULT_CODES: readonly ["yaml-syntax", "not-a-flow", "pipeline-format-removed", "name-mismatch", "reserved-name", "unknown-flow", "broken-flow", "call-cycle", "flow-input-mismatch", "missing-key", "unknown-key", "key-type", "node-kind", "twin-keys", "invalid-id", "reserved-id", "duplicate-id", "unknown-agent", "broken-agent", "skills-without-read", "unknown-skill", "skill-hidden", "unknown-address", "invalid-address", "among-without-from", "among-mismatch", "unknown-scope", "memory-output-mismatch", "carry-mismatch", "verdict-with-output", "copies-needed", "retry-refused", "check-script-missing", "check-port-missing", "commit-in-copies", "memory-outside-copies", "ask-form-conflict", "ask-options-count", "ask-options-duplicate", "ask-default-mismatch", "git-port-missing", "not-a-repository", "unattended-ask", "section-missing", "section-empty", "section-duplicate", "section-unknown", "section-not-agent", "body-preamble", "schema-invalid", "condition-syntax", "condition-unknown-address", "condition-type", "condition-enum-value", "condition-free-string"]; /** A fault's code. */ export type FaultCode = (typeof FAULT_CODES)[number]; /** One reason a flow is refused. */ export type Fault = { /** Stable, and what a test or a caller matches: the guide's table explains each one. */ readonly code: FaultCode; /** The file the fault is in. */ readonly file: string; /** * Where: the node's address through its enclosing nodes, without * iterations, then the offending key (`deliver/work/code.retry`). `""` for * the file as a whole. */ readonly at: string; /** One sentence saying what is wrong, and what was meant when it can tell. */ readonly message: string; }; /** `; did you mean \`x\`?` when a candidate is near, else what there is. */ export declare function suggest(word: string, candidates: readonly string[], what: string): string; /** * The faults of one file, as they are found. * * Every reader pushes into one list, in the order it reads the file, so the * faults come back sorted by position without a sort. */ export declare class FaultList { readonly list: Fault[]; private readonly file; constructor(file: string); add(code: FaultCode, at: string, message: string): void; /** * Sorts the faults added since `mark` by `rank`, keeping the order they were * found in between equals. Readers check what they need in the order they * need it; a reader of the faults wants them in the order of the file. */ sort(rank: (fault: Fault) => number, mark?: number): void; /** A name that matches nothing, with the nearest one or what there is. */ unknown(code: FaultCode, at: string, word: string, candidates: readonly string[], what: string): void; /** Refuses every key of `record` outside `allowed`, at `.`. */ keys(record: Readonly>, allowed: readonly string[], at: string, what: string): void; } //# sourceMappingURL=fault.d.ts.map