@debugmcp/mcp-debugger
Version:
Run-time step-through debugging for LLM agents.
81 lines (80 loc) • 2.31 kB
TypeScript
/**
* DAP Proxy Core - Pure business logic without side effects
*
* This module contains the core proxy runner functionality that can be
* instantiated and controlled programmatically without auto-execution.
*/
import { DapProxyWorker } from './dap-proxy-worker.js';
import { DapProxyDependencies, ILogger, ProxyState } from './dap-proxy-interfaces.js';
export interface ProxyRunnerOptions {
/**
* Whether to use IPC for communication (when available)
*/
useIPC?: boolean;
/**
* Whether to use stdin/readline as fallback
*/
useStdin?: boolean;
/**
* Custom message handler for testing
*/
onMessage?: (message: string) => Promise<void>;
}
/**
* Core proxy runner that encapsulates all proxy logic
* without auto-execution or environment detection
*/
export declare class ProxyRunner {
private dependencies;
private options;
private worker;
private logger;
private rl?;
private messageHandler?;
private isRunning;
constructor(dependencies: DapProxyDependencies, logger: ILogger, options?: ProxyRunnerOptions);
/**
* Start the proxy runner and set up communication channels
*/
start(): Promise<void>;
/**
* Stop the proxy runner and clean up resources
*/
stop(): Promise<void>;
/**
* Get the current worker state
*/
getWorkerState(): ProxyState;
/**
* Get the worker instance (for testing)
*/
getWorker(): DapProxyWorker;
/**
* Create the default message processor
*/
private createMessageProcessor;
/**
* Set up IPC communication channel
*/
private setupIPCCommunication;
/**
* Set up stdin/readline communication channel
*/
private setupStdinCommunication;
/**
* Set up global error handlers
*/
setupGlobalErrorHandlers(errorShutdown: () => Promise<void>, getCurrentSessionId: () => string | null): void;
}
/**
* Detect if the module is being run directly or as a worker
*/
export declare function detectExecutionMode(): {
isDirectRun: boolean;
hasIPC: boolean;
isWorkerEnv: boolean;
};
/**
* Check if the module should auto-execute based on execution mode
*/
export declare function shouldAutoExecute(mode: ReturnType<typeof detectExecutionMode>): boolean;