@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.
121 lines (120 loc) • 3.03 kB
TypeScript
/**
* Multi-target debugging support for debugging multiple processes simultaneously
* Coordinates breakpoints, aggregates logs, and supports parent-child process debugging
*/
import { EventEmitter } from "events";
import { DebugSession } from "./debug-session";
export interface DebugTarget {
id: string;
name: string;
session: DebugSession;
parentId?: string;
children: string[];
}
export interface MultiTargetBreakpoint {
file: string;
line: number;
condition?: string;
targets: string[];
}
export interface AggregatedLog {
timestamp: number;
targetId: string;
targetName: string;
level: "stdout" | "stderr" | "debug";
message: string;
}
/**
* Manages debugging of multiple processes simultaneously
*/
export declare class MultiTargetDebugger extends EventEmitter {
private targets;
private globalBreakpoints;
private logs;
private maxLogSize;
/**
* Add a debug target
*/
addTarget(id: string, name: string, session: DebugSession, parentId?: string): void;
/**
* Remove a debug target
*/
removeTarget(id: string): boolean;
/**
* Get a debug target by ID
*/
getTarget(id: string): DebugTarget | undefined;
/**
* Get all debug targets
*/
getAllTargets(): DebugTarget[];
/**
* Get root targets (targets without parents)
*/
getRootTargets(): DebugTarget[];
/**
* Get children of a target
*/
getChildren(targetId: string): DebugTarget[];
/**
* Set a breakpoint across multiple targets
*/
setGlobalBreakpoint(file: string, line: number, targetIds: string[], condition?: string): Promise<string>;
/**
* Remove a global breakpoint
*/
removeGlobalBreakpoint(breakpointId: string): Promise<boolean>;
/**
* Get all global breakpoints
*/
getGlobalBreakpoints(): Map<string, MultiTargetBreakpoint>;
/**
* Continue execution on all targets
*/
continueAll(): Promise<void>;
/**
* Continue execution on specific targets
*/
continueTargets(targetIds: string[]): Promise<void>;
/**
* Pause execution on all targets
*/
pauseAll(): Promise<void>;
/**
* Get aggregated logs from all targets
*/
getAggregatedLogs(options?: {
targetIds?: string[];
level?: "stdout" | "stderr" | "debug";
since?: number;
limit?: number;
}): AggregatedLog[];
/**
* Clear aggregated logs
*/
clearLogs(): void;
/**
* Set up log aggregation for a target
*/
private setupLogAggregation;
/**
* Add a log entry
*/
private addLog;
/**
* Set maximum log size
*/
setMaxLogSize(size: number): void;
/**
* Get target hierarchy as a tree structure
*/
getTargetTree(): DebugTarget[];
/**
* Build target tree recursively
*/
private buildTargetTree;
/**
* Stop all debug targets
*/
stopAll(): Promise<void>;
}