UNPKG

@debugmcp/mcp-debugger

Version:

Run-time step-through debugging for LLM agents.

186 lines (185 loc) 4.94 kB
/** * Session-related data models */ import { DebugProtocol } from '@vscode/debugprotocol'; /** * Custom launch arguments interface extending DebugProtocol.LaunchRequestArguments */ export interface CustomLaunchRequestArguments extends DebugProtocol.LaunchRequestArguments { stopOnEntry?: boolean; justMyCode?: boolean; } /** * Supported debugger languages */ export declare enum DebugLanguage { PYTHON = "python", MOCK = "mock" } /** * Session lifecycle state - represents the session's existence */ export declare enum SessionLifecycleState { /** Session is created but not initialized */ CREATED = "created", /** Session is active and can accept debug operations */ ACTIVE = "active", /** Session has been terminated and cannot accept operations */ TERMINATED = "terminated" } /** * Execution state - represents the debugger's execution state * Only meaningful when SessionLifecycleState is ACTIVE */ export declare enum ExecutionState { /** Debug adapter is initializing */ INITIALIZING = "initializing", /** Program is running */ RUNNING = "running", /** Program is paused (at breakpoint, step, etc.) */ PAUSED = "paused", /** Program has terminated but session is still active */ TERMINATED = "terminated", /** Debug adapter encountered an error */ ERROR = "error" } /** * Debug session state (legacy - for backward compatibility) * @deprecated Use SessionLifecycleState and ExecutionState instead */ export declare enum SessionState { /** Session is created but not initialized */ CREATED = "created", /** Session is initializing */ INITIALIZING = "initializing", /** Session is ready to start debugging */ READY = "ready", /** Session is running */ RUNNING = "running", /** Session is paused at a breakpoint */ PAUSED = "paused", /** Session has stopped */ STOPPED = "stopped", /** Session encountered an error */ ERROR = "error" } /** * Maps legacy SessionState to new state model */ export declare function mapLegacyState(legacyState: SessionState): { lifecycle: SessionLifecycleState; execution?: ExecutionState; }; /** * Maps new state model to legacy SessionState */ export declare function mapToLegacyState(lifecycle: SessionLifecycleState, execution?: ExecutionState): SessionState; /** * Debug session configuration */ export interface SessionConfig { /** Programming language */ language: DebugLanguage; /** Session name */ name: string; /** Optional executable path for the language runtime */ executablePath?: string; } /** * Breakpoint definition */ export interface Breakpoint { /** Unique identifier */ id: string; /** File path */ file: string; /** Line number */ line: number; /** Conditional expression (if any) */ condition?: string; /** Whether the breakpoint is verified */ verified: boolean; } /** * Debug session information */ export interface DebugSession { /** Unique session ID */ id: string; /** Programming language */ language: DebugLanguage; /** Session name */ name: string; /** Session state (legacy) */ state: SessionState; /** Session lifecycle state */ sessionLifecycle: SessionLifecycleState; /** Execution state */ executionState?: ExecutionState; /** Current file */ currentFile?: string; /** Current line */ currentLine?: number; /** Created timestamp */ createdAt: Date; /** Updated timestamp */ updatedAt: Date; /** Active breakpoints mapped by ID */ breakpoints: Map<string, Breakpoint>; } /** * Subset of DebugSession for list operations (if needed, otherwise use DebugSession) */ export interface DebugSessionInfo { id: string; language: DebugLanguage; name: string; state: SessionState; createdAt: Date; updatedAt?: Date; } /** * Variable information */ export interface Variable { /** Variable name */ name: string; /** Variable value */ value: string; /** Variable type */ type: string; /** Whether the variable is expandable */ expandable: boolean; /** Variable children (for complex objects) */ children?: Variable[]; } /** * Stack frame information */ export interface StackFrame { /** Frame ID */ id: number; /** Frame name */ name: string; /** Source file */ file: string; /** Line number */ line: number; /** Column number */ column?: number; } /** * Debug location information */ export interface DebugLocation { /** Source file */ file: string; /** Line number */ line: number; /** Column number */ column?: number; /** Source code around the location */ sourceLines?: string[]; /** The specific line number in the source lines array that corresponds to the current location */ sourceLine?: number; }