/** * @fileoverview Resolver Interface (SPEC Section 8.2) * * Resolver handles discourse reference resolution. * Resolution is DETERMINISTIC (no LLM involved). */ import type { IntentIR, ResolvedIntentIR } from "../schema/index.js"; /** * Context for reference resolution. */ export type ResolutionContext = { /** Currently focused entity (for "this") */ readonly focus?: FocusEntry; /** Discourse history for "that" and "last" */ readonly discourse: readonly DiscourseEntry[]; }; /** * Focus entry representing the currently focused entity. */ export type FocusEntry = { readonly entityType: string; readonly id: string; }; /** * Discourse entry for reference resolution. */ export type DiscourseEntry = { readonly entityType: string; readonly id: string; /** Timestamp or sequence number for ordering */ readonly mentionedAt: number; }; /** * Resolver interface for discourse reference resolution. * * Resolution is DETERMINISTIC (no LLM involved). * Given same context, same IR -> same resolved IR. * * Resolution rules: * - this -> context.focus.id (if entityType matches) * - that -> most recent in discourse of different type from focus * - last -> most recent of same entityType * - id -> pass through * - absent ref (collection scope) -> preserve */ export interface Resolver { /** * Resolve symbolic references (this/that/last) to concrete IDs. * Collection scope (ref absent) is preserved. * * @throws Error if resolution fails (e.g., "this" with no focus) */ resolveReferences(ir: IntentIR, context?: ResolutionContext): ResolvedIntentIR; } /** * Create a default Resolver implementation. * * @example * const resolver = createResolver(); * const resolved = resolver.resolveReferences(ir, { * focus: { entityType: "Order", id: "123" }, * discourse: [ * { entityType: "Order", id: "456", mentionedAt: 1 }, * { entityType: "User", id: "789", mentionedAt: 2 } * ] * }); */ export declare function createResolver(): Resolver; //# sourceMappingURL=interface.d.ts.map