/** * @file Pronoun Context for Parser (ADR-089 Phase B) * @description Tracks entity references for pronoun resolution * * Enables commands like: * - "take lamp. light it" → "it" = lamp * - "talk to Alice. give her the key" → "her" = Alice * - "take all. drop them" → "them" = all items taken */ import type { IParsedCommand, IValidatedCommand, PronounSet } from '@sharpee/world-model'; /** * Reference to an entity mentioned in a command */ export interface EntityReference { /** The entity's ID */ entityId: string; /** How the player referred to it ("the lamp", "Alice") */ text: string; /** Turn number when this reference was set */ turnNumber: number; } /** * Context for resolving pronouns in commands */ export interface PronounContext { /** * Inanimate singular - last direct object that's not an actor * Used for "it" resolution */ it: EntityReference | null; /** * Plural - last list, "all" result, or plural entity * Used for "them" resolution (inanimate plural) */ them: EntityReference[] | null; /** * Animate by object pronoun - keyed by the object pronoun form * "him" → entity using he/him * "her" → entity using she/her * Also handles animate singular "them" and neopronouns */ animateByPronoun: Map; /** * Last successful command (for "again"/"g" command) */ lastCommand: IParsedCommand | null; } /** * Standard pronouns that the parser should recognize */ export declare const RECOGNIZED_PRONOUNS: readonly ["it", "them", "him", "her", "xem", "zir", "hir", "em", "faer"]; export type RecognizedPronoun = typeof RECOGNIZED_PRONOUNS[number]; /** * Check if a word is a recognized pronoun */ export declare function isRecognizedPronoun(word: string): word is RecognizedPronoun; /** * Inanimate pronoun sets for objects without ActorTrait */ export declare const INANIMATE_IT: PronounSet; export declare const INANIMATE_THEM: PronounSet; /** * Set the global pronoun context manager (called by parser) */ export declare function setPronounContextManager(manager: PronounContextManager | null): void; /** * Get the global pronoun context manager (used by slot consumers) */ export declare function getPronounContextManager(): PronounContextManager | null; /** * Manager for pronoun context * Handles updating and resolving pronoun references */ export declare class PronounContextManager { private context; constructor(); /** * Create an empty pronoun context */ private createEmptyContext; /** * Reset the pronoun context (e.g., on game restart) */ reset(): void; /** * Get the current pronoun context (for debugging/testing) */ getContext(): Readonly; /** * Resolve a pronoun to entity references * @param pronoun The pronoun to resolve ("it", "him", "her", "them", etc.) * @returns Entity reference(s) or null if no match */ resolve(pronoun: string): EntityReference[] | null; /** * Update pronoun context after a successful command execution * @param command The validated command with resolved entity IDs * @param world The world model (for entity lookup) * @param turnNumber Current turn number */ updateFromCommand(command: IValidatedCommand, world: any, // WorldModel turnNumber: number): void; /** * Process a validated object reference and update context * Uses the already-resolved entity ID from validation */ private processValidatedReference; /** * Register an entity that was mentioned (for external use) * This allows actions to register entities they interact with */ registerEntity(entityId: string, text: string, world: any, turnNumber: number): void; /** * Get the last successful command (for "again" support) */ getLastCommand(): IParsedCommand | null; } //# sourceMappingURL=pronoun-context.d.ts.map