/** * BaseRemoteAdapter — abstract base class for remote (HTTP/WebSocket/Unix) adapters. * * Provides shared utilities for connection management, server lifecycle, * and common remote adapter functionality. */ import type { AgentName, AgentCapabilities, ModelCapabilities, AgentConfig, AgentConfigSchema, AuthState, AuthSetupGuidance, Session, InstalledPlugin, PluginInstallOptions, PluginSearchOptions, PluginListing, RunOptions, RemoteAdapter, RemoteConnection, ServerOptions, ServerInfo, ServerHealth, SpawnArgs, ParseContext, AgentEvent } from '@a5c-ai/comm-adapter'; /** * Abstract base class for remote adapters. Provides shared utilities * and sensible defaults for HTTP, WebSocket, and Unix socket adapters. */ export declare abstract class BaseRemoteAdapter implements RemoteAdapter { readonly adapterType: "remote"; readonly cliCommand = "[remote]"; buildSpawnArgs(_options: RunOptions): SpawnArgs; parseEvent(_line: string, _context: ParseContext): AgentEvent | AgentEvent[] | null; abstract readonly agent: AgentName; abstract readonly displayName: string; abstract readonly connectionType: 'http' | 'websocket' | 'unix'; abstract readonly minVersion?: string; abstract readonly capabilities: AgentCapabilities; abstract readonly models: ModelCapabilities[]; abstract readonly defaultModelId?: string; abstract readonly configSchema: AgentConfigSchema; abstract connect(options: RunOptions): Promise; abstract disconnect(connection: RemoteConnection): Promise; abstract detectAuth(): Promise; abstract getAuthGuidance(): AuthSetupGuidance; abstract sessionDir(cwd?: string): string; abstract parseSessionFile(filePath: string): Promise; abstract listSessionFiles(cwd?: string): Promise; abstract readConfig(cwd?: string): Promise; abstract writeConfig(config: Partial, cwd?: string): Promise; readonly hostEnvSignals?: readonly string[]; listPlugins?(): Promise; installPlugin?(pluginId: string, options?: PluginInstallOptions): Promise; uninstallPlugin?(pluginId: string): Promise; searchPlugins?(query: string, options?: PluginSearchOptions): Promise; readHostMetadata?(env: NodeJS.ProcessEnv): Record; startServer?(options?: ServerOptions): Promise; stopServer?(serverInfo: ServerInfo): Promise; healthCheck?(serverInfo: ServerInfo): Promise; /** * Tracks active connections for cleanup. */ protected activeConnections: Map; /** * Tracks managed servers for cleanup. */ protected managedServers: Map; /** * Register an active connection for tracking. */ protected registerConnection(connection: RemoteConnection): void; /** * Unregister a connection (called on disconnect). */ protected unregisterConnection(connectionId: string): void; /** * Register a managed server for tracking. */ protected registerServer(serverInfo: ServerInfo): void; /** * Unregister a server (called on stop). */ protected unregisterServer(serverId: string): void; /** * Cleanup all active connections and servers. * Should be called during adapter shutdown. */ cleanup(): Promise; /** * Generate a unique connection ID. */ protected generateConnectionId(): string; /** * Generate a unique server ID. */ protected generateServerId(): string; /** * Find an available port for server startup. */ protected findAvailablePort(startPort?: number): Promise; }