/** * Configuration Manager * Manages user-editable configuration in .cdp-tools/config.json */ /** * Port monitoring frequency configuration - interval per level in ms */ export interface PortMonitoringFreqMs { block: number; error: number; inform: number; } /** * Port monitoring configuration */ export interface PortMonitoringConfig { portMonitoringFreqMs: PortMonitoringFreqMs; } /** * Replay system configuration */ export interface ReplayConfig { /** Maximum nested conditional depth (default: 10) */ maxConditionalDepth: number; /** Maximum regex pattern length for url:matches conditions (default: 500) */ maxRegexLength: number; /** Show visual cursor during replay (default: true) */ showCursor: boolean; /** Export path for Playwright tests (default: ./tests/e2e) */ playwrightExportPath: string; /** Export path for Puppeteer tests (default: ./tests/puppeteer) */ puppeteerExportPath: string; /** Maximum delay between commands in ms when recording (default: 1000, 0 = no limit) */ maxDelayMs: number; } /** * DOM change detection configuration */ export interface ChangeDetectionConfig { /** Enable automatic change detection on actions (default: true) */ enabled: boolean; /** Max time to wait for mutations to settle in ms (default: 2000) */ settleTimeout: number; /** Time of no mutations to consider settled in ms (default: 300) */ quietPeriod: number; /** Longer timeout for page navigation in ms (default: 3000) */ navigationTimeout: number; } /** * Click validation configuration for replay sequences */ export interface ClickValidationConfig { /** Enable click validation in replay sequences (default: true) */ enabled: boolean; /** Validate navigation success if click caused URL change (default: true) */ validateNavigation: boolean; /** Require DOM mutations after click (default: false) */ requireDomChanges: boolean; /** Failure mode for DOM changes check: 'error' stops sequence, 'warn' logs and continues (default: 'warn') */ domChangesFailMode: 'error' | 'warn'; /** Check for new console errors after click (default: true) */ failOnConsoleErrors: boolean; /** Failure mode for console errors: 'error' stops sequence, 'warn' logs and continues (default: 'error') */ consoleErrorsFailMode: 'error' | 'warn'; /** Validate network requests triggered by click (default: false) */ validateNetworkPayload: boolean; /** Failure mode for network failures: 'error' stops sequence, 'warn' logs and continues (default: 'warn') */ networkFailMode: 'error' | 'warn'; /** Delay before validation checks in ms (default: 100) */ postClickDelayMs: number; } /** * Chrome configuration */ export interface ChromeConfig { /** Starting port for Chrome debugging - will find next available if in use (default: 9222) */ startingDebugPort: number; /** Inactivity timeout in minutes before closing connections and Chrome (default: 5, set to 0 to disable) */ inactivityTimeoutMinutes: number; /** Polling interval in minutes for inactivity checks (default: 2) */ inactivityPollingMinutes: number; } /** * Debug configuration */ export interface DebugConfig { /** Enable debug logging to debug.log on startup (default: false) */ enabled: boolean; /** Enable history log file - records all commands in replay-compatible format (default: false) */ historyLogEnabled: boolean; } /** * List of tools that can be toggled via config * New tools added here will be auto-discovered and added to enabled list on startup */ export declare const TOGGLEABLE_TOOLS: readonly ["connection", "tab", "breakpoint", "execution", "inspection", "source", "console", "network", "page", "dom", "screenshot", "input", "content", "modal", "storage", "download", "replay", "server", "issues", "dashboard"]; export type ToggleableToolName = typeof TOGGLEABLE_TOOLS[number]; /** * Tool dependencies - key depends on values * If a dependency is disabled, the dependent tool cannot function */ export declare const TOOL_DEPENDENCIES: Record; /** * Check for dependency conflicts in tools config * Returns array of conflict descriptions (grouped by disabled dependency), empty if no conflicts */ export declare function checkToolDependencyConflicts(enabled: string[], disabled: string[]): string[]; /** * Root configuration structure */ export interface ToolsConfig { enabled: string[]; disabled: string[]; } export interface CdpToolsConfig { version: number; configLocation: 'local' | 'global'; chrome: ChromeConfig; portMonitoring: PortMonitoringConfig; replay: ReplayConfig; changeDetection: ChangeDetectionConfig; clickValidation: ClickValidationConfig; debug: DebugConfig; tools: ToolsConfig; } /** * Configuration Manager * Loads and saves configuration from .cdp-tools/config.json * Also tracks runtime port state */ export declare class ConfigManager { private config; private loaded; private loadedFromPath; private currentPort; private dependencyConflicts; constructor(); /** * Synchronously load config for early access during module initialization */ private loadSync; /** * Validate tool dependencies and store any conflicts */ private validateDependencies; /** * Check if there are dependency conflicts blocking tool access */ hasDependencyConflicts(): boolean; /** * Get the list of dependency conflicts */ getDependencyConflicts(): string[]; /** * Get preferred path for creating new config * Prefers working directory if .cdp-tools folder exists or can be created */ private getPreferredConfigPath; /** * Load configuration from disk * Checks local config first for configLocation preference. * If configLocation is 'global', uses global config. * Otherwise creates/uses local config (seeding from global if available). */ load(): Promise; /** * Deep merge two config objects */ private mergeConfig; /** * Save configuration to disk * Saves to the same location it was loaded from, or global if new */ save(): Promise; /** * Synchronously save configuration to disk * Used during loadSync() to persist config before async code runs */ private saveSync; /** * Get the full configuration */ getConfig(): CdpToolsConfig; /** * Get port monitoring configuration */ getPortMonitoringConfig(): PortMonitoringConfig; /** * Get the interval for a specific monitoring level */ getIntervalForLevel(level: 'block' | 'error' | 'inform'): number; /** * Get Chrome configuration */ getChromeConfig(): ChromeConfig; /** * Get replay system configuration */ getReplayConfig(): ReplayConfig; /** * Get change detection configuration */ getChangeDetectionConfig(): ChangeDetectionConfig; /** * Get click validation configuration for replay sequences */ getClickValidationConfig(): ClickValidationConfig; /** * Get debug configuration */ getDebugConfig(): DebugConfig; /** * Get tools configuration */ getToolsConfig(): ToolsConfig; /** * Check if a tool is enabled * A tool is enabled if it's in the enabled list and not in the disabled list */ isToolEnabled(toolName: string): boolean; /** * Auto-discover and enable new tools * Any tool in TOGGLEABLE_TOOLS that isn't in disabled will be added to enabled * Also removes tools from enabled if they are in disabled * Returns true if config was modified */ discoverTools(): boolean; /** * Get list of available toggleable tools with their current state */ getToggleableTools(): Array<{ name: string; enabled: boolean; dependencies: string[]; }>; /** * Update port monitoring frequency configuration */ updatePortMonitoringFreqMs(updates: Partial): Promise; /** * Get the current port in use (runtime state) */ getCurrentPort(): number; /** * Set the current port (runtime state) */ setCurrentPort(port: number): void; /** * Get info about current config location and status */ getStatus(): { loadedFrom: string | null; isLocal: boolean; localPath: string; globalPath: string; localExists: boolean; globalExists: boolean; }; /** * Switch to using local config (creates if needed, optionally seeds from global) */ useLocal(seedFromGlobal?: boolean): Promise<{ path: string; seeded: boolean; }>; /** * Switch to using global config * Writes a minimal local config with just configLocation: 'global' */ useGlobal(): Promise<{ path: string; }>; /** * Reset config to defaults */ reset(): Promise; /** * Create a backup of current config */ backup(): Promise<{ path: string; } | null>; /** * Clone global config to local */ cloneFromGlobal(): Promise<{ path: string; } | { error: string; }>; } export declare const configManager: ConfigManager; //# sourceMappingURL=config.d.ts.map