/** * The type of a value a flow passes around: what a schema declares, what a * condition is checked against, and what a node's typed output must match. * * One model for every reader. A schema is written in a short notation or a * closed JSON Schema subset, and both land here, so a condition, a `map-from` * and the `submit` tool all ask the same question of the same shape. * * There is no `any` and no `null`. A value a flow cannot name the shape of is * `text`: what an agent wrote with no `output:` schema. An agent reads it; a * condition never does, since a decision read out of prose is a guess. */ /** * A value's type. Plain data, so a checked flow can be written down as it is. * * `description` is what the author wrote for the model that fills the value; * it changes nothing about what matches. */ export type ValueType = { /** What the author wrote for the model that fills the value. */ readonly description?: string; } & ({ readonly kind: "text"; } /** * `free`: written by a model in the person's language, as an `ask-from`'s * answer is, so no literal of the file can be expected to equal it. */ | { readonly kind: "string"; readonly free?: true; } | { readonly kind: "number"; } | { readonly kind: "boolean"; } /** A closed set of strings. Compared strictly: a literal outside it is refused. */ | { readonly kind: "enum"; readonly values: readonly string[]; } | { readonly kind: "list"; readonly of: ValueType; } | { readonly kind: "object"; readonly fields: Readonly>; }); /** One field of an object. An optional one may be absent, and reading it then is an error. */ export type Field = { /** The field's type. */ readonly type: ValueType; /** Whether it may be absent: written `name?` in the short notation. */ readonly optional: boolean; }; /** * A type in the short notation a flow's author writes it in: `string`, * `a | b`, `[number]`, `{ passed: boolean, report?: string }`. * * Messages quote types this way, so a refusal reads in the words of the file. */ export declare function showType(type: ValueType): string; /** Whether two types match the same values. A description changes nothing about what matches. */ export declare function sameType(a: ValueType, b: ValueType): boolean; /** * Why `value` is not of `type`, or `undefined` when it is. * * Values are JSON-shaped: an absent field is `undefined`, and an object has * no field its type does not name, since a key nobody declared is one no * address can read. This is the one check a typed value passes, whether a * model submitted it or a dry run's script wrote it. */ export declare function mismatch(value: unknown, type: ValueType, at?: string): string | undefined; //# sourceMappingURL=type.d.ts.map