import { type QVal } from './expr.js'; import { type ComposeCtx } from './compose.js'; import { type ViewRegistry } from './views.js'; import { type HistoryResolver } from './history.js'; import type { ComposedView, CoverageRow, DashboardResult, NavItem, Tile } from './dashboard.js'; import type { CompiledDefinition, ConceptIR, Finding, Inventory, IR, Row } from './types.js'; type Ctx = Record; export declare function conceptCtx(c: ConceptIR): Ctx; export interface EvalEnv { ir: IR; def: CompiledDefinition | null; inventory: Inventory | null; referenced: Set; rowsOf(block: string): { row: Row; concept: ConceptIR; }[]; /** per-concept root reached by walking the self-referencing frontmatter * `field`, resolving each value to a concept by title or meta.name — the same * resolution graph edges use. `roots` is concept-path → topmost-ancestor * title (a concept with no resolving value is its own root). `selfRefs` is * how many concepts resolve `field` to ANOTHER document; zero means `field` * is not a hierarchy field, which callers turn into a load error. The walk is * cycle-guarded (a repeat or self-loop stops it) and memoised per field. */ rootsFor(field: string): { roots: Map; selfRefs: number; }; /** E28 t1 — every name a row query may legitimately mention, memoised over * the corpus. The set is a UNION because the query context is built from * four independent sources (rowCtx): the block's declared columns, the * document frontmatter spread in ahead of them, the reserved names minted * last, and `cites_` per declared scheme. Declared-but-unused and * used-but-undeclared are both legitimate, so consulting the definition * alone or the corpus alone would each invent a false positive. */ knownFields(blocks: string[]): Set; /** E38 t3 — the relation-derived query fields ONE row carries, or null when * the definition declares no relations (the zero-consumers branch every * pre-relations format rides — rowCtx is then byte-identical). Backed by a * memoised corpus index (relationIndex): built once, on the first row that * asks, by walking every declaring block's relation cells. Keyed by the * row's own uuid, so no block name is needed — a uuid names one record. */ relationFields(row: Row): Record | null; /** E41 — the SECOND source (P31): the host's answer to a compiled history * ask. Absent on every host that has no operational event log in reach (an * offline `dj dashboard`, the selftest, any pure-text evaluation), and a * history chart then renders its static note instead of a picture of * nothing. Present, it may still decline (null) when the bake is out of * budget (P22) — the widget ships its binding and the browser fills it. */ history?: HistoryResolver; /** findings raised during evaluation — the same array evaluateDashboard was * handed, so a check at any depth reports through one channel */ findings: Finding[]; } export declare function makeEnv(ir: IR, inventory: Inventory | null, def?: CompiledDefinition | null, findings?: Finding[], history?: HistoryResolver): EvalEnv; export declare function packTraceability(env: EvalEnv, bind: any, tiles: Tile[], where: string): void; export declare function packCoverageByType(env: EvalEnv, bind: any, out: CoverageRow[], where: string): Record | undefined; export declare function packReverseGap(env: EvalEnv, bind: any, where: string): DashboardResult['reverseGap']; /** * One `record` widget spec → its payload data, or null (already warned) when * the view cannot name a block — the caller degrades to a note. Exported for * the record-view contract tests; `members` gates the pinned-subject `groups` * exactly as `opts.members` gates row membership everywhere else. */ export declare function evalRecordView(env: EvalEnv, w: any, where: string, registry: ViewRegistry, members: boolean): any | null; /** * One `mentions` widget spec → its payload data, or null (already warned) * when the grammar refuses — the caller degrades to a note. `recordSection` * says whether a record view is supplying a subject: `of: subject` is legal * ONLY there (§5 PR9 item 2), because everywhere else there is no record to * be the subject of. Exported for the mentions-view tests. */ export declare function evalMentionsView(env: EvalEnv, w: any, where: string, recordSection: boolean): any | null; export declare function evalNavItem(env: EvalEnv, item: any, where: string, members: boolean): NavItem; export declare const evalIndicator: (env: EvalEnv, ind: any, id: string, where: string) => Tile | null; /** `{field}` substitution over a whole view spec. The values come from ONE * document — its title, path, type, domain and every declared frontmatter * field — so a single view definition becomes one board per document. * Unknown placeholders are left alone: a `{documented}` a widget resolves * itself must survive this pass untouched. */ export declare const fillSpec: (node: any, vars: Record) => any; /** The HOST dashboard's shared pack/indicator state — what the three bare * shared-state spellings read. Only a dashboard has one; a surface without * it (report) triggers the R8 degradation below. */ export interface HostDashboardState { tiles: Tile[]; coverage: CoverageRow[]; coverageLegend: Record | undefined; reverseGap: DashboardResult['reverseGap']; } /** What one view evaluation borrows from its host surface. The identity trio * (`id`/`label`/`template`) arrives RESOLVED: for_each expansion is the * host's job (it owns the document set), and this module never re-derives * what the host already decided. */ export interface ViewEvalCtx { id: string; label: string; /** the for_each template's id when this view is an expanded instance */ template: string | null; /** the finding/refusal prefix, e.g. `views[3] (work)` */ where: string; members: boolean; registry: ViewRegistry; composeCtx: ComposeCtx; hostState?: HostDashboardState; } /** One view spec → one ComposedView. The body below is the closure family * MOVED VERBATIM from evaluateDashboard (R1) — the only new code is the R8 * hostState branches, which a dashboard (hostState always present) never * takes, so the step-0 DashboardResult hash is this function's acceptance. */ export declare function evaluateView(spec: any, env: EvalEnv, ctx: ViewEvalCtx): ComposedView; export {};