import type { ColumnSchema, GridSchema, GridState } from 'apex-grid'; /** * A minimal JSON Schema (Draft 7) shape, just enough to express the state-patch * contract for an LLM structured-output call. Carried as a plain object: the AI * Toolkit never validates against it at runtime (the model SDK does that, and * {@link sanitizePatch} is the local guard), so no runtime JSON-Schema library is * pulled in. */ export interface JSONSchema { type?: string | string[]; properties?: Record; items?: JSONSchema; enum?: unknown[]; const?: unknown; required?: string[]; additionalProperties?: boolean | JSONSchema; oneOf?: JSONSchema[]; anyOf?: JSONSchema[]; description?: string; minimum?: number; [key: string]: unknown; } /** * The subset of {@link GridState} an AI patch may set: the view-control surface * (sort, filter, quick-filter, column layout, selection, pagination, and the * enterprise module blob). Other slices (row pinning, manual order, tree / * master-detail expansion) are not part of the v1 AI surface. */ export type StatePatch = Partial>; /** Keys of columns that opt into sorting. */ export declare function sortableKeys(schema: GridSchema): string[]; /** Every column key, in display order. */ export declare function columnKeys(schema: GridSchema): string[]; /** Columns that opt into filtering (i.e. advertise at least one operand). */ export declare function filterableColumns(schema: GridSchema): ColumnSchema[]; /** Keys of columns the enterprise grid marks groupable. */ export declare function groupableKeys(schema: GridSchema): string[]; /** Keys of columns the enterprise grid marks pivotable. */ export declare function pivotableKeys(schema: GridSchema): string[]; /** Columns the enterprise grid marks aggregatable (each carries its `aggFuncs`). */ export declare function aggregatableColumns(schema: GridSchema): ColumnSchema[]; /** * Build a strict JSON Schema describing a valid {@link StatePatch} from the * grid's {@link GridSchema}. This is the structured-output contract an LLM * targets: every field is constrained to the vocabulary the grid actually * advertises (sortable / filterable / groupable / pivotable column keys, valid * per-column filter operands, allowed sort directions, aggregation functions), * so a conforming model can only emit operations the grid can perform. Slices the * grid does not support (e.g. pagination on a non-paginated grid) are omitted. * * @remarks * Pure and AI-agnostic. The reference Claude adapter feeds the result to * `output_config.format`; the apply path validates independently via * {@link sanitizePatch}. Both draw from this same {@link GridSchema}. */ export declare function toJSONSchema(schema: GridSchema): JSONSchema;