/** * Turn Event Processor - Processes events during turn execution * * Extracted from GameEngine as part of Phase 4 remediation. * Handles event enrichment, perception filtering, and event emission. */ import { ISemanticEvent, ISemanticEventSource, IPlatformEvent } from '@sharpee/core'; import { WorldModel, IFEntity } from '@sharpee/world-model'; import { IPerceptionService } from '@sharpee/stdlib'; import { EngineConfig } from './types'; /** * Context for event processing pipeline */ export interface EventProcessingContext { turn?: number; playerId?: string; locationId?: string; } /** * Process an event through normalization and enrichment */ export declare function processEvent(event: ISemanticEvent, context?: EventProcessingContext): ISemanticEvent; /** * Context for event enrichment - matches EventProcessingContext */ export interface EnrichmentContext { turn: number; playerId: string; locationId: string | undefined; } /** * Result of processing events for a turn phase */ export interface ProcessedEventsResult { /** Processed semantic events */ semanticEvents: ISemanticEvent[]; /** Platform events that need handling */ platformEvents: IPlatformEvent[]; } /** * Callback type for emitting events */ export type EventEmitCallback = (event: ISemanticEvent) => void; /** * Callback type for dispatching to entity handlers */ export type EntityHandlerDispatcher = (event: ISemanticEvent) => void; /** * Service for processing turn events */ export declare class TurnEventProcessor { private perceptionService?; constructor(perceptionService?: IPerceptionService | undefined); /** * Process action events from command execution * * @param events - Raw events from command executor * @param enrichmentContext - Context for event enrichment * @param player - Player entity for perception filtering * @param world - World model for perception filtering * @returns Processed events and platform events */ processActionEvents(events: ISemanticEvent[], enrichmentContext: EnrichmentContext, player: IFEntity, world: WorldModel): ProcessedEventsResult; /** * Process semantic events (e.g., from NPC or scheduler ticks) * * @param events - Semantic events to process * @param enrichmentContext - Context for event enrichment * @param player - Player entity for perception filtering * @param world - World model for perception filtering * @returns Processed events and platform events */ processSemanticEvents(events: ISemanticEvent[], enrichmentContext: EnrichmentContext, player: IFEntity, world: WorldModel): ProcessedEventsResult; /** * Emit events through all configured channels * * @param semanticEvents - Events to emit * @param eventSource - Event source for tracking * @param turnEvents - Turn events map to update * @param turn - Current turn number * @param config - Engine config with event callback * @param eventEmitter - Callback for engine event emission * @param entityDispatcher - Optional callback for entity handler dispatch */ emitEvents(semanticEvents: ISemanticEvent[], eventSource: ISemanticEventSource, turnEvents: Map, turn: number, config: EngineConfig, eventEmitter: EventEmitCallback, entityDispatcher?: EntityHandlerDispatcher): void; /** * Check for victory events in the processed events * * @param events - Events to check * @returns Victory details if found, null otherwise */ checkForVictory(events: ISemanticEvent[]): { reason: string; score: number; } | null; } /** * Create a turn event processor instance */ export declare function createTurnEventProcessor(perceptionService?: IPerceptionService): TurnEventProcessor; //# sourceMappingURL=turn-event-processor.d.ts.map