/** * Session Recorder * * Records user interactions for playback and debugging. * * @since v1.33.3 * @since v1.36.0 - Extracted schemas to shared schemas.ts */ import type { Tier } from '../../core/types/auth.js'; import type { AppState, EventData, EventType, RecordedEvent, Recording, RecordingSummary } from './recording-types.js'; /** * State provider function type */ export type StateProvider = () => Partial; /** * Recording event listener */ export type RecordingEventListener = (event: RecordedEvent) => void; /** * Session recorder for capturing user interactions */ export declare class SessionRecorder { private recording; private startTime; private events; private isRecording; private outputDir; private stateProvider; private listeners; private lastCapturedState; constructor(outputDir?: string, stateProvider?: StateProvider); /** * Start a new recording */ start(name: string, description?: string): Recording; /** * Stop recording and save */ stop(): Recording; /** * Discard current recording without saving */ discard(): void; /** * Check if currently recording */ getIsRecording(): boolean; /** * Get current recording info */ getCurrentRecording(): Recording | null; /** * Get elapsed time in ms */ getElapsedTime(): number; /** * Get event count */ getEventCount(): number; /** * Record an event */ recordEvent(type: EventType, data: EventData): RecordedEvent | null; /** * Update the last event's stateAfter */ updateLastEventState(): void; /** * Record a keypress event */ recordKeypress(key: string, modifiers?: { ctrl?: boolean; meta?: boolean; shift?: boolean; alt?: boolean; }): RecordedEvent | null; /** * Record a navigation event */ recordNavigation(from: string, to: string, trigger?: 'keyboard' | 'command' | 'programmatic'): RecordedEvent | null; /** * Record a command execution */ recordCommand(commandId: string, commandName: string, args?: Record): RecordedEvent | null; /** * Record a tier change */ recordTierChange(from: Tier, to: Tier): RecordedEvent | null; /** * Record an API call */ recordApiCall(endpoint: string, method: string, body?: unknown): RecordedEvent | null; /** * Record an API response */ recordApiResponse(endpoint: string, status: number, body?: unknown, error?: string, duration?: number): RecordedEvent | null; /** * Record a state change */ recordStateChange(path: string, oldValue: unknown, newValue: unknown): RecordedEvent | null; /** * Record an error */ recordError(message: string, stack?: string, context?: string): RecordedEvent | null; /** * Record marker creation */ recordMarkerCreated(markerId: string, title: string, severity: string, file: string, lineStart: number): RecordedEvent | null; /** * Record note added */ recordNoteAdded(noteId: string, content: string): RecordedEvent | null; /** * Set the state provider function */ setStateProvider(provider: StateProvider): void; /** * Capture current app state */ private captureState; /** * Capture state only if it has changed (performance optimization) * Uses shallow comparison for common case where state rarely changes */ private captureStateIfChanged; /** * Capture recording metadata */ private captureMetadata; /** * Save recording to disk (with restricted file permissions) */ private save; /** * Load a recording by ID */ loadRecording(recordingId: string): Recording | null; /** * List all recordings */ listRecordings(): RecordingSummary[]; /** * Delete a recording */ deleteRecording(recordingId: string): boolean; /** * Get recordings count */ getRecordingsCount(): number; /** * Add an event listener */ onEvent(listener: RecordingEventListener): () => void; /** * Remove all listeners */ removeAllListeners(): void; /** * Reset the recorder */ reset(): void; } /** * Get the singleton session recorder */ export declare function getSessionRecorder(): SessionRecorder; /** * Reset the singleton */ export declare function resetSessionRecorder(): void; //# sourceMappingURL=session-recorder.d.ts.map