/** * A flow file turned into nodes: YAML frontmatter for the structure, one * `## ` section of Markdown per `agent` node for the prose. * * A flow is **a closed language, not a general one**. It has branches and * loops, and it stays safe because every construct comes from the closed * lists below, every loop and `map` carries a bound written in the file, and * every condition terminates and gives the same answer for the same values. So * the worst case of a run is known before its first spawn. That is the test * for any new key: a key that would make the worst case unknowable is a * TypeScript workflow instead. * * And the reason any of this exists: **no agent reads this file to decide * what happens next.** Our runner walks it. A model produces values, and our * code reads them. * * This file reads a flow's text into nodes and refuses what it does not * understand. The keys of the file are the list below; the kinds of node and * the keys of each are the lists at the top of `node.ts`, and `read-node.ts` * refuses a key valid on another kind too. Resolving names against the catalogue happens in * `check.ts`, still before any spawn. */ import { FaultList, type Fault } from "./fault.ts"; import { type FlowNode } from "./node.ts"; import type { ValueType } from "./type.ts"; /** The keys of a flow's frontmatter, and whether each is required. */ export declare const FLOW_KEYS: { readonly name: true; readonly description: true; readonly input: true; readonly model: false; readonly timeout: false; readonly nodes: true; }; /** A flow file, read: nothing in it is resolved against a catalogue yet. */ export type FlowFile = { readonly file: string; readonly name: string; readonly description: string; readonly input: ValueType; readonly model?: string; readonly timeoutMs?: number; /** The root sequence, without the nodes that were refused. */ readonly nodes: readonly FlowNode[]; /** Ids of refused nodes: what refers to one is not reported again. */ readonly refused: ReadonlySet; /** Where each fault of this file stands in it, so they come back in file order. */ readonly rank: (fault: Fault) => number; /** The prose of each `agent` node, by id; ids are unique in the whole file. */ readonly sections: ReadonlyMap; }; /** * A flow file read, and every fault found in it. * * `flow` is there whenever the frontmatter could be read, faults or not, so * the names it holds are checked too and a flow is refused with every fault * at once. What was refused is left out of it, and listed in `refused`. */ export type ReadFlow = { readonly flow?: FlowFile; readonly faults: FaultList; }; /** * `content`, the text of the flow file at `file`, read into nodes. * * A YAML syntax error is the only fault returned when there is one, with the * line in the file, since nothing past it can be read. */ export declare function readFlow(content: string, file: string): ReadFlow; //# sourceMappingURL=file.d.ts.map