@mastra/core
Version:
Mastra is a framework for building AI-powered applications and agents with a modern TypeScript stack.
106 lines • 3.72 kB
TypeScript
/**
* LSP Client
*
* JSON-RPC client wrapper for communicating with language servers.
* Uses dynamic imports for vscode-jsonrpc and vscode-languageserver-protocol
* to keep them as optional dependencies.
*
* Spawns LSP servers via a SandboxProcessManager, so it works with any
* sandbox backend (local, E2B, etc.) that has a process manager.
*/
import type { SandboxProcessManager } from '../sandbox/process-manager/index.js';
import type { LSPServerDef } from './types.js';
/**
* Check if vscode-jsonrpc is available without importing it.
* Synchronous check — safe to call at registration time.
*/
export declare function isLSPAvailable(): boolean;
/**
* Load vscode-jsonrpc and vscode-languageserver-protocol.
* Returns null if not available. Caches result after first call.
*/
export declare function loadLSPDeps(): Promise<{
StreamMessageReader: any;
StreamMessageWriter: any;
createMessageConnection: any;
TextDocumentIdentifier: any;
Position: any;
} | null>;
/**
* Wraps a JSON-RPC connection to a single LSP server process.
* Uses a SandboxProcessManager to spawn the server process.
*/
export declare class LSPClient {
private connection;
private handle;
private serverDef;
private workspaceRoot;
private processManager;
private diagnostics;
private initializationOptions;
constructor(serverDef: LSPServerDef, workspaceRoot: string, processManager: SandboxProcessManager);
/** Whether the underlying server process is still running. */
get isAlive(): boolean;
/** Name of the LSP server. */
get serverName(): string;
/**
* Initialize the LSP connection — spawns the server and performs the handshake.
*/
initialize(initTimeout?: number): Promise<void>;
/**
* Notify the server that a document has been opened.
*/
notifyOpen(filePath: string, content: string, languageId: string): void;
/**
* Notify the server that a document has changed.
*/
notifyChange(filePath: string, content: string, version: number): void;
/**
* Wait for diagnostics to arrive for a file.
*
* When `waitForChange` is false (default), returns as soon as diagnostics
* are available. To avoid returning a premature empty array (servers may
* publish `[]` first while still analysing), empty results trigger a short
* settle window: polling continues for up to `settleMs` (default 500ms)
* to see if non-empty diagnostics arrive. Non-empty results are returned
* immediately.
*/
waitForDiagnostics(filePath: string, timeoutMs?: number, waitForChange?: boolean, settleMs?: number): Promise<any[]>;
/**
* Notify the server that a document was closed.
*/
notifyClose(filePath: string): void;
/**
* Query hover information at a position.
*/
queryHover(uri: string, position: {
line: number;
character: number;
}, timeoutMs?: number): Promise<any>;
/**
* Query definition(s) at a position.
*/
queryDefinition(uri: string, position: {
line: number;
character: number;
}, timeoutMs?: number): Promise<any[]>;
/**
* Query type definition(s) at a position.
*/
queryTypeDefinition(uri: string, position: {
line: number;
character: number;
}, timeoutMs?: number): Promise<any[]>;
/**
* Query implementation(s) at a position.
*/
queryImplementation(uri: string, position: {
line: number;
character: number;
}, timeoutMs?: number): Promise<any[]>;
/**
* Shutdown the connection and kill the process.
*/
shutdown(): Promise<void>;
}
//# sourceMappingURL=client.d.ts.map