/** * Entity Resolver: turn an {@link Intent}'s raw slots into grounded values against * the schema, the live state, and conversation memory. Column names are matched * exactly, then case-insensitively, then by a bounded fuzzy match (so "reginn" * resolves to "region"); filter operators map to a valid per-column operand; values * are typed per the column; a bare "reverse" reads the active sort; and pronouns * ("it" / "those") resolve against `memory.lastEntities`. Errors are collected, not * thrown, so the planner can degrade to a helpful no-op. * * @see plans/ai-reasoning-layer-spec.md (section 4.5) */ import type { ColumnSchema, SortingDirection } from 'apex-grid'; import type { AggregationFn } from '../aggregation.js'; import type { AnalyticsQuery } from './analytics.js'; import type { GridContext } from './context.js'; import type { Intent } from './types.js'; /** Grounded entities for the planner. `columns` is order-preserving and may be empty. */ export interface ResolveResult { columns: ColumnSchema[]; direction?: SortingDirection; operand?: string; value?: unknown; aggFunc?: AggregationFn; text?: string; page?: number; pageSize?: number; visibility?: 'show' | 'hide'; pin?: 'start' | 'end' | null; reverse?: boolean; format?: string; /** A read-only analytics query, for the `analyze` intent. */ query?: AnalyticsQuery; errors: string[]; usedMemory?: boolean; } /** Grounds an {@link Intent} against a {@link GridContext}. */ export interface EntityResolver { resolve(intent: Intent, ctx: GridContext): ResolveResult; } /** Create the default {@link EntityResolver}. */ export declare function createEntityResolver(): EntityResolver;