import type { VisibleWhen } from './types'; /** One declared section of a model form. `title`/`description` arrive already * localized from the kernel and are rendered verbatim. */ export interface FormSection { key: string; title?: string; description?: string; /** Sections mode only: render this section collapsed on first paint. */ collapsed?: boolean; /** Section-level visibility gate (kernel v0.84.0). When present and its * predicate evaluates false against the live form values, the whole section * is omitted (and in steps mode its wizard step drops from the sequence). * Tolerates the camelCase alias, same as fields. */ visible_when?: VisibleWhen; visibleWhen?: VisibleWhen; /** AI-assisted step (kernel v0.141.0): the SDK renders an interview panel * driven by the host's assist provider inside this section. */ assist?: FormAssist; } /** Declaration of an AI-assisted step (`form_layout.sections[].assist`). */ export interface FormAssist { /** Host-registered provider key, e.g. `brand.website_dna`. */ provider: string; label?: string; description?: string; /** Form fields sent to the provider when the session starts. */ input?: string[]; /** Form fields the provider may fill when it finishes. */ output?: string[]; /** `button` (default) or `auto` (start as soon as every input has a value). */ trigger?: 'button' | 'auto'; } /** Model-level layout directive. `mode` defaults to `"sections"`. */ export interface FormLayout { mode?: 'sections' | 'steps'; sections?: FormSection[]; } /** A resolved group of fields ready to render: a section plus the (already * visibility-filtered) fields that belong to it. */ export interface FieldGroup { /** Section key, or `__default__` for the orphan group. */ key: string; title?: string; description?: string; collapsed?: boolean; /** True for the synthetic group holding section-less / unknown-section fields. */ isDefault: boolean; fields: F[]; /** AI-assisted step declaration, when the section has one. */ assist?: FormAssist; } /** The synthetic key of the orphan group (fields with no / unknown `section`). */ export declare const DEFAULT_SECTION_KEY = "__default__"; /** Reads a field's `section` reference, tolerating a camelCase alias. */ export declare function getFieldSection(field: { section?: string; Section?: string; } | null | undefined): string | undefined; /** * Groups already-filtered (visible) fields by their `section`, honoring the * order of `layout.sections`. * * Contract: * - No `layout` (or no `sections`) → a single default group carrying every * field in its original order. Callers render this exactly like the legacy * flat list, so the layout-less path is byte-for-byte the current behaviour. * - Fields whose `section` is empty or references an UNKNOWN section key are * collected into ONE default group placed FIRST (before any declared * section) — the consistent, documented choice: general/uncategorized fields * lead, declared sections follow in their authored order. * - A declared section with zero visible fields is OMITTED entirely, so a * section whose only members are hidden by `visible_when` never renders an * empty shell (and never yields an empty wizard step). Because the caller * passes the already visibility-filtered list, this falls out for free. * - A section declaring its OWN `visible_when` is dropped whole (before its * fields are even collected) whenever the predicate evaluates false against * `values`, reusing the SAME evaluator the fields use. In steps mode the * caller derives the wizard sequence from these groups, so a hidden section * simply never becomes a step. Section-less / unknown-section fields are * never gated by any section predicate. Without a section `visible_when` * (or without `values`), behaviour is byte-for-byte the legacy path. */ export declare function groupFieldsBySection(fields: F[], layout: FormLayout | undefined, values?: Record | null): FieldGroup[]; //# sourceMappingURL=form-layout.d.ts.map