UNPKG

@debugmcp/mcp-debugger

Version:

Run-time step-through debugging for LLM agents.

55 lines (54 loc) 2.14 kB
/** * DAP connection management utilities */ import { DebugProtocol } from '@vscode/debugprotocol'; import { IDapClient, IDapClientFactory, ILogger } from './dap-proxy-interfaces.js'; export declare class DapConnectionManager { private dapClientFactory; private logger; private readonly INITIAL_CONNECT_DELAY; private readonly MAX_CONNECT_ATTEMPTS; private readonly CONNECT_RETRY_INTERVAL; constructor(dapClientFactory: IDapClientFactory, logger: ILogger); /** * Connect to DAP adapter with retry logic */ connectWithRetry(host: string, port: number): Promise<IDapClient>; /** * Initialize DAP session */ initializeSession(client: IDapClient, sessionId: string): Promise<void>; /** * Set up event handlers for a DAP client */ setupEventHandlers(client: IDapClient, handlers: { onInitialized?: () => void | Promise<void>; onOutput?: (body: DebugProtocol.OutputEvent['body']) => void; onStopped?: (body: DebugProtocol.StoppedEvent['body']) => void; onContinued?: (body: DebugProtocol.ContinuedEvent['body']) => void; onThread?: (body: DebugProtocol.ThreadEvent['body']) => void; onExited?: (body: DebugProtocol.ExitedEvent['body']) => void; onTerminated?: (body: DebugProtocol.TerminatedEvent['body']) => void; onError?: (err: Error) => void; onClose?: () => void; }): void; /** * Disconnect DAP client gracefully */ disconnect(client: IDapClient | null, terminateDebuggee?: boolean): Promise<void>; /** * Send a launch request with proper configuration */ sendLaunchRequest(client: IDapClient, scriptPath: string, scriptArgs?: string[], stopOnEntry?: boolean, justMyCode?: boolean): Promise<void>; /** * Set breakpoints for a file */ setBreakpoints(client: IDapClient, sourcePath: string, breakpoints: { line: number; condition?: string; }[]): Promise<DebugProtocol.SetBreakpointsResponse>; /** * Send configuration done notification */ sendConfigurationDone(client: IDapClient): Promise<void>; }