/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */ import { type IdeInfo } from '../ide/detect-ide.js'; import { type DiffUpdateResult } from '../ide/ideContext.js'; export type IDEConnectionState = { status: IDEConnectionStatus; details?: string; }; export declare enum IDEConnectionStatus { Connected = "connected", Disconnected = "disconnected", Connecting = "connecting" } /** * Manages the connection to and interaction with the IDE server. */ export declare class IdeClient { private static instance; private client; private state; private currentIde; private ideProcessInfo; private connectionConfig; private authToken; private diffResponses; private statusListeners; private trustChangeListeners; private constructor(); static getInstance(): Promise; static resetInstance(): void; addStatusChangeListener(listener: (state: IDEConnectionState) => void): void; removeStatusChangeListener(listener: (state: IDEConnectionState) => void): void; addTrustChangeListener(listener: (isTrusted: boolean) => void): void; removeTrustChangeListener(listener: (isTrusted: boolean) => void): void; connect(): Promise; /** * A diff is accepted with any modifications if the user performs one of the * following actions: * - Clicks the checkbox icon in the IDE to accept * - Runs `command+shift+p` > "LLxprt Code: Accept Diff in IDE" to accept * - Selects "accept" in the CLI UI * - Saves the file via `ctrl/command+s` * * A diff is rejected if the user performs one of the following actions: * - Clicks the "x" icon in the IDE * - Runs "LLxprt Code: Close Diff in IDE" * - Selects "no" in the CLI UI * - Closes the file */ openDiff(filePath: string, newContent?: string): Promise; closeDiff(filePath: string, options?: { suppressNotification?: boolean; }): Promise; resolveDiffFromCli(filePath: string, outcome: 'accepted' | 'rejected'): Promise; disconnect(): Promise; getCurrentIde(): IdeInfo | undefined; getConnectionStatus(): IDEConnectionState; getDetectedIdeDisplayName(): string | undefined; /** * Check if diffing functionality is enabled for this IDE client. * Returns true when the client is connected and the IDE supports diff operations. */ isDiffingEnabled(): boolean; private setState; static validateWorkspacePath(ideWorkspacePath: string | undefined, cwd: string): { isValid: boolean; error?: string; }; private getPortFromEnv; private getConnectionConfigFromFile; private createProxyAwareFetch; private registerClientHandlers; private establishConnection; }