@ai-capabilities-suite/mcp-debugger-core
Version:
Core debugging engine for Node.js and TypeScript applications. Provides Inspector Protocol integration, breakpoint management, variable inspection, execution control, profiling, hang detection, and source map support.
131 lines (130 loc) • 4.5 kB
TypeScript
import { Breakpoint, HitCountCondition } from './debug-session';
/**
* Manages breakpoints for a debug session
* Handles breakpoint CRUD operations and state management
*/
export declare class BreakpointManager {
private breakpoints;
/**
* Generate a unique breakpoint identifier
*/
private generateBreakpointId;
/**
* Create a new breakpoint
* @param file File path where the breakpoint should be set
* @param line Line number (1-indexed)
* @param condition Optional condition expression
* @returns The created breakpoint
*/
createBreakpoint(file: string, line: number, condition?: string): Breakpoint;
/**
* Create a new logpoint (non-breaking breakpoint)
* @param file File path where the logpoint should be set
* @param line Line number (1-indexed)
* @param logMessage Log message template with variable interpolation
* @returns The created logpoint
*/
createLogpoint(file: string, line: number, logMessage: string): Breakpoint;
/**
* Create a new function breakpoint
* @param functionName Function name or regex pattern
* @returns The created function breakpoint
*/
createFunctionBreakpoint(functionName: string): Breakpoint;
/**
* Add an existing breakpoint (for backward compatibility)
* @param breakpoint Breakpoint to add
*/
addBreakpoint(breakpoint: Breakpoint): void;
/**
* Get a breakpoint by ID
* @param id Breakpoint identifier
* @returns The breakpoint or undefined if not found
*/
getBreakpoint(id: string): Breakpoint | undefined;
/**
* Get all breakpoints
* @returns Array of all breakpoints
*/
getAllBreakpoints(): Breakpoint[];
/**
* Get breakpoints for a specific file
* @param file File path
* @returns Array of breakpoints in the file
*/
getBreakpointsByFile(file: string): Breakpoint[];
/**
* Remove a breakpoint by ID
* @param id Breakpoint identifier
* @returns True if the breakpoint was found and removed
*/
removeBreakpoint(id: string): boolean;
/**
* Toggle a breakpoint's enabled state
* @param id Breakpoint identifier
* @returns The updated breakpoint or undefined if not found
*/
toggleBreakpoint(id: string): Breakpoint | undefined;
/**
* Enable a breakpoint
* @param id Breakpoint identifier
* @returns The updated breakpoint or undefined if not found
*/
enableBreakpoint(id: string): Breakpoint | undefined;
/**
* Disable a breakpoint
* @param id Breakpoint identifier
* @returns The updated breakpoint or undefined if not found
*/
disableBreakpoint(id: string): Breakpoint | undefined;
/**
* Update a breakpoint's CDP breakpoint ID
* @param id Breakpoint identifier
* @param cdpBreakpointId CDP breakpoint ID from the Inspector Protocol
* @returns The updated breakpoint or undefined if not found
*/
updateCdpBreakpointId(id: string, cdpBreakpointId: string): Breakpoint | undefined;
/**
* Clear all breakpoints
*/
clearAll(): void;
/**
* Get the number of breakpoints
*/
getBreakpointCount(): number;
/**
* Check if a breakpoint exists
* @param id Breakpoint identifier
* @returns True if the breakpoint exists
*/
hasBreakpoint(id: string): boolean;
/**
* Increment the hit count for a breakpoint
* @param id Breakpoint identifier
* @returns The updated hit count or undefined if breakpoint not found
*/
incrementHitCount(id: string): number | undefined;
/**
* Reset the hit count for a breakpoint
* @param id Breakpoint identifier
* @returns True if the breakpoint was found
*/
resetHitCount(id: string): boolean;
/**
* Reset all hit counts (typically called on session restart)
*/
resetAllHitCounts(): void;
/**
* Check if a breakpoint should pause based on hit count condition
* @param id Breakpoint identifier
* @returns True if the breakpoint should pause
*/
shouldPauseOnHitCount(id: string): boolean;
/**
* Set hit count condition for a breakpoint
* @param id Breakpoint identifier
* @param condition Hit count condition
* @returns The updated breakpoint or undefined if not found
*/
setHitCountCondition(id: string, condition: HitCountCondition): Breakpoint | undefined;
}