UNPKG

interm-mcp

Version:

MCP server for terminal applications and TUI automation with 127 tools

175 lines (174 loc) 4.2 kB
import { InputSequence } from './types.js'; export interface InputEvent { id: string; type: 'keyboard' | 'mouse' | 'touch' | 'gesture' | 'voice' | 'eye_tracking'; timestamp: Date; data: any; processed: boolean; filtered: boolean; priority: 'low' | 'normal' | 'high' | 'critical'; } export interface InputFilter { id: string; name: string; type: 'allow' | 'block' | 'modify' | 'rate_limit'; pattern?: RegExp; condition?: (event: InputEvent) => boolean; action?: (event: InputEvent) => InputEvent | null; enabled: boolean; maxRate?: number; lastActivated?: Date; } export interface InputDevice { id: string; type: 'keyboard' | 'mouse' | 'touchscreen' | 'microphone' | 'eye_tracker' | 'gamepad' | 'midi'; name: string; connected: boolean; capabilities: string[]; lastActivity: Date; eventCount: number; } export interface InputAnalytics { totalEvents: number; eventsByType: Record<string, number>; averageLatency: number; peakLatency: number; filteredEvents: number; errorRate: number; deviceStats: Record<string, { events: number; errors: number; }>; sessionDuration: number; startTime: Date; } export declare class InputProcessingManager { private static instance; private eventQueue; private filters; private devices; private recordings; private isRecording; private currentRecordingId; private eventHistory; private analytics; private maxQueueSize; private maxHistorySize; private processingEnabled; private constructor(); static getInstance(): InputProcessingManager; /** * Initialize default input filters */ private initializeDefaultFilters; /** * Queue input event for processing */ queueEvent(event: Omit<InputEvent, 'id' | 'processed' | 'filtered'> & { priority?: 'low' | 'normal' | 'high' | 'critical'; }): string; /** * Process next event in queue */ private processNextEvent; /** * Apply filters to input event */ private applyFilters; /** * Add event to history */ private addToHistory; /** * Update latency statistics */ private updateLatencyStats; /** * Start recording input sequence */ startRecording(name?: string, description?: string): string; /** * Stop current recording */ stopRecording(): InputSequence | null; /** * Add event to current recording */ private addToRecording; /** * Playback recorded sequence */ playbackRecording(recordingId: string, speed?: number): Promise<void>; /** * Auto-detect connected input devices */ detectDevices(): Promise<InputDevice[]>; /** * macOS device detection */ private detectMacOSDevices; /** * Windows device detection */ private detectWindowsDevices; /** * Linux device detection */ private detectLinuxDevices; /** * Add custom input filter */ addFilter(filter: InputFilter): void; /** * Remove input filter */ removeFilter(filterId: string): boolean; /** * Get input analytics */ getAnalytics(): InputAnalytics; /** * Get event history */ getEventHistory(limit?: number): InputEvent[]; /** * Get connected devices */ getDevices(): InputDevice[]; /** * Get recordings */ getRecordings(): InputSequence[]; /** * Clear event queue */ clearQueue(): void; /** * Clear event history */ clearHistory(): void; /** * Enable/disable event processing */ setProcessingEnabled(enabled: boolean): void; /** * Get current queue size */ getQueueSize(): number; /** * Generate unique event ID */ private generateEventId; /** * Generate unique recording ID */ private generateRecordingId; /** * Optimize latency for high-performance scenarios */ optimizeLatency(): void; /** * Reset latency optimizations */ resetOptimizations(): void; }