UNPKG

@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.

83 lines (82 loc) 2.5 kB
import { InspectorClient } from './inspector-client'; import { SourceMapManager } from './source-map-manager'; /** * Result of evaluating an expression */ export interface EvaluationResult { value: any; type: string; objectId?: string; description?: string; originalName?: string; } /** * Result of inspecting an object's properties */ export interface PropertyDescriptor { name: string; value: any; type: string; writable?: boolean; enumerable?: boolean; configurable?: boolean; originalName?: string; } /** * Options for object inspection */ export interface InspectionOptions { maxDepth?: number; ownProperties?: boolean; accessorPropertiesOnly?: boolean; } /** * Handles variable inspection and expression evaluation using CDP */ export declare class VariableInspector { private inspector; private sourceMapManager; constructor(inspector: InspectorClient); /** * Set the source map manager for variable name mapping * Requirements: 7.4 */ setSourceMapManager(sourceMapManager: SourceMapManager): void; /** * Evaluate an expression in the current execution context * @param expression The JavaScript expression to evaluate * @param callFrameId Optional call frame ID (uses top frame if not provided) * @returns The evaluation result with type information */ evaluateExpression(expression: string, callFrameId?: string): Promise<EvaluationResult>; /** * Get properties of an object * @param objectId The CDP object ID * @param options Inspection options * @returns Array of property descriptors */ getObjectProperties(objectId: string, options?: InspectionOptions): Promise<PropertyDescriptor[]>; /** * Inspect an object with nested property resolution * @param objectId The CDP object ID * @param maxDepth Maximum depth to traverse (default: 2) * @returns Nested object structure */ inspectObject(objectId: string, maxDepth?: number): Promise<Record<string, any>>; /** * Recursively inspect an object up to a maximum depth */ private inspectObjectRecursive; /** * Get the current paused state with call frames */ private getCurrentPausedState; /** * Serialize a CDP RemoteObject to our EvaluationResult format */ private serializeRemoteObject; /** * Extract the actual value from a CDP RemoteObject */ private extractValue; }