flow/type

Source: src/flow/type.ts

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.

Field

type

export type Field = {
	/** The field's type. */
	readonly type: ValueType;
	/** Whether it may be absent: written `name?` in the short notation. */
	readonly optional: boolean;
};

One field of an object. An optional one may be absent, and reading it then is an error.

ValueType

type

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<Record<string, Field>> }
);

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.