import type { WorkflowConfig } from "./types"; /** * Validates a `title`/`content` value at `path`. Returns an error message, or `null` when the * value is acceptable. * @param value The candidate value. * @param path Error path for this field, e.g. `steps[2].title`. * @param validateContent Custom content validator; when omitted, the value must be a `string`. */ type ContentValidator = (value: unknown, path: string) => string | null; /** Options accepted by `validateWorkflowConfig` (and threaded through internally). */ export interface ValidateWorkflowConfigOptions { /** * Validates `title`/`content` values. Returns an error message, or `null` when the value is * acceptable. Omit this to keep the default strict behavior — `title`/`content` must be plain * strings — which is required for the untrusted-JSON path (`JSON.parse()` output). Callers using * a rich content type `T` (e.g. `ReactNode`) must supply this to accept non-string values. */ readonly validateContent?: ContentValidator; } /** * Validates and narrows an unknown value to a `WorkflowConfig`. * * Performs a single pass over the whole config, collecting every issue (unknown/extra keys, wrong * types, missing required fields, invalid nested options, builtins used in slots that cannot run * them, etc.) rather than throwing on the first one — see `ConfigValidationError`. * * By default, `title`/`content` must be plain strings — the runtime cannot otherwise know what * `T` is, and this default keeps the untrusted-JSON path strict. Pass `options.validateContent` * to accept a richer `T` (e.g. `ReactNode`). * * @param config The parsed JSON (or equivalent plain object) to validate. * @param options Validation options; see {@link ValidateWorkflowConfigOptions}. * @throws {ConfigValidationError} When one or more issues are found. * @returns The same value, narrowed to `WorkflowConfig`. */ export declare function validateWorkflowConfig(config: unknown, options?: ValidateWorkflowConfigOptions): WorkflowConfig; export {};