UNPKG

@debugmcp/mcp-debugger

Version:

Run-time step-through debugging for LLM agents.

84 lines (83 loc) 3.19 kB
/** * Python Debug Adapter implementation * * Provides Python-specific debugging functionality using debugpy. * Encapsulates all Python-specific logic including executable discovery, * environment validation, and debugpy integration. * * @since 2.0.0 */ import { EventEmitter } from 'events'; import { DebugProtocol } from '@vscode/debugprotocol'; import { IDebugAdapter, AdapterState, ValidationResult, DependencyInfo, AdapterCommand, AdapterConfig, GenericLaunchConfig, LanguageSpecificLaunchConfig, DebugFeature, FeatureRequirement, AdapterCapabilities } from '../debug-adapter-interface.js'; import { DebugLanguage } from '../../session/models.js'; import { AdapterDependencies } from '../adapter-registry-interface.js'; /** * Python-specific launch configuration */ interface PythonLaunchConfig extends LanguageSpecificLaunchConfig { module?: string; pythonArgs?: string[]; console?: 'integratedTerminal' | 'internalConsole' | 'externalTerminal'; django?: boolean; flask?: boolean; jinja?: boolean; redirectOutput?: boolean; showReturnValue?: boolean; subProcess?: boolean; } /** * Python Debug Adapter implementation */ export declare class PythonDebugAdapter extends EventEmitter implements IDebugAdapter { readonly language = DebugLanguage.PYTHON; readonly name = "Python Debug Adapter"; private state; private dependencies; private pythonPathCache; private readonly cacheTimeout; private currentThreadId; private connected; constructor(dependencies: AdapterDependencies); initialize(): Promise<void>; dispose(): Promise<void>; getState(): AdapterState; isReady(): boolean; getCurrentThreadId(): number | null; private transitionTo; validateEnvironment(): Promise<ValidationResult>; getRequiredDependencies(): DependencyInfo[]; resolveExecutablePath(preferredPath?: string): Promise<string>; getDefaultExecutableName(): string; getExecutableSearchPaths(): string[]; buildAdapterCommand(config: AdapterConfig): AdapterCommand; getAdapterModuleName(): string; getAdapterInstallCommand(): string; transformLaunchConfig(config: GenericLaunchConfig): PythonLaunchConfig; getDefaultLaunchConfig(): Partial<GenericLaunchConfig>; sendDapRequest<T extends DebugProtocol.Response>(command: string, args?: unknown): Promise<T>; handleDapEvent(event: DebugProtocol.Event): void; handleDapResponse(_response: DebugProtocol.Response): void; connect(host: string, port: number): Promise<void>; disconnect(): Promise<void>; isConnected(): boolean; getInstallationInstructions(): string; getMissingExecutableError(): string; translateErrorMessage(error: Error): string; supportsFeature(feature: DebugFeature): boolean; getFeatureRequirements(feature: DebugFeature): FeatureRequirement[]; getCapabilities(): AdapterCapabilities; /** * Check Python version */ private checkPythonVersion; /** * Check if debugpy is installed */ private checkDebugpyInstalled; /** * Detect if Python is in a virtual environment */ private detectVirtualEnv; } export {};