/** * Platform Operations Handler - Handles platform events (save/restore/quit/restart/undo) * * Extracted from GameEngine as part of Phase 4 remediation. * Uses strategy pattern to handle different platform operation types. */ import { IPlatformEvent, ISemanticEvent, ISemanticEventSource, ISaveRestoreHooks } from '@sharpee/core'; import type { IParser } from '@sharpee/world-model'; import { SaveRestoreService, ISaveRestoreStateProvider } from './save-restore-service'; import { VocabularyManager } from './vocabulary-manager'; /** * Context for platform operation handling */ export interface PlatformOperationContext { currentTurn: number; turnEvents: Map; eventSource: ISemanticEventSource; emitEvent: (event: ISemanticEvent) => void; } /** * Callbacks for engine-level operations that require engine access */ export interface EngineCallbacks { stopEngine: (reason?: 'quit' | 'victory' | 'defeat' | 'abort') => void; restartStory: () => Promise; updateContext: (updates: { currentTurn?: number; }) => void; updateScopeVocabulary: () => void; emitStateChanged: () => void; getParser: () => IParser | undefined; } /** * Handler for platform operations */ export declare class PlatformOperationHandler { private saveRestoreHooks; private saveRestoreService; private stateProvider; private vocabularyManager; constructor(saveRestoreHooks: ISaveRestoreHooks | undefined, saveRestoreService: SaveRestoreService, stateProvider: ISaveRestoreStateProvider, vocabularyManager: VocabularyManager); /** * Process all pending platform operations * * @param pendingOps - Array of pending platform operations * @param context - Platform operation context * @param engineCallbacks - Callbacks for engine-level operations */ processAll(pendingOps: IPlatformEvent[], context: PlatformOperationContext, engineCallbacks: EngineCallbacks): Promise; /** * Handle a single platform operation */ private handleOperation; /** * Handle save request */ private handleSave; /** * Handle restore request */ private handleRestore; /** * Handle quit request */ private handleQuit; /** * Handle restart request */ private handleRestart; /** * Handle undo request */ private handleUndo; /** * Create an error event for a failed operation */ private createErrorEvent; } /** * Create a platform operation handler instance */ export declare function createPlatformOperationHandler(saveRestoreHooks: ISaveRestoreHooks | undefined, saveRestoreService: SaveRestoreService, stateProvider: ISaveRestoreStateProvider, vocabularyManager: VocabularyManager): PlatformOperationHandler; //# sourceMappingURL=platform-operations.d.ts.map