UNPKG

browser-debugger-cli

Version:

DevTools telemetry in your terminal. For humans and agents. Direct WebSocket to Chrome's debugging port.

60 lines 2.02 kB
/** * Pattern detector for identifying verbose CDP usage. * * Tracks CDP command execution and detects patterns that indicate * agents are using verbose approaches when high-level alternatives exist. */ import { type PatternDefinition } from './patternDefinitions.js'; /** * Pattern detection result with hint information. */ export interface PatternDetectionResult { /** Whether a hint should be shown */ shouldShow: boolean; /** Pattern that was detected */ pattern?: PatternDefinition; /** How many times this hint has been shown */ shownCount?: number; } /** * Pattern detector for tracking CDP usage and suggesting alternatives. * * Maintains state for pattern occurrence counts and hint display limits. * Designed to provide helpful guidance without overwhelming users. */ export declare class PatternDetector { private readonly methodCounts; private readonly hintShownCounts; private readonly maxHintsPerPattern; /** * Track a CDP command execution. * * Records the command and checks if any patterns are triggered. * Returns detection result indicating if a hint should be shown. * * @param method - CDP method that was executed (e.g., "Runtime.evaluate") * @returns Detection result with hint information */ trackCommand(method: string): PatternDetectionResult; /** * Reset all pattern tracking state. * * Useful for testing or when starting a fresh analysis. */ reset(): void; /** * Get current method count for a specific CDP method. * * @param method - CDP method name * @returns Number of times method has been called */ getMethodCount(method: string): number; /** * Get hint shown count for a specific pattern. * * @param patternName - Pattern identifier * @returns Number of times hint has been shown for this pattern */ getHintShownCount(patternName: string): number; } //# sourceMappingURL=patternDetector.d.ts.map