import type WebSocket from 'ws'; import { type CertificateEvent, type SecretEvent, type AgentUpdateEvent, type ApiKeyRotationEvent, type HostConfigEvent, type DegradedConnectionInfo, type UnifiedAgentEvent } from './types.js'; /** * Message dispatcher for handling incoming WebSocket messages. * Routes messages to appropriate handlers based on message type. */ export declare class MessageDispatcher { private readonly handlers; private registeredAgentId; private readonly managedKeyNames; private readonly onPongReceived; private readonly apiKeyDedup; constructor(options: { managedKeyNames: string[]; onPongReceived: () => void; }); /** Test seam: clear the apikey deliveryId dedup cache. */ resetDedupForTesting(): void; /** * Handle an incoming WebSocket message. */ handleMessage(ws: WebSocket | null, message: UnifiedAgentEvent): void; private handleEventMessage; private handleConnectionEstablished; private handleDegradedConnection; private handleReprovisionAvailable; /** * Handle a top-level `update-available` message. * * The vault server sends operator-initiated update triggers as a top-level * message ({type:'update-available', version, channel, force, timestamp}) — * the fields live at the top level, NOT under `data`. See vault * src/routes/agent-updates.ts and unified-agent-websocket/index.ts * (broadcastUpdateAvailable). The legacy `{type:'event', topic:'updates'}` * path in handleEventMessage is kept for back-compat. */ private handleUpdateAvailable; /** * Get the registered agent ID. */ getAgentId(): string | null; /** * Clear the registered agent ID. */ clearAgentId(): void; onCertificateEvent(handler: (event: CertificateEvent) => void): void; onSecretEvent(handler: (event: SecretEvent) => void): void; onUpdateEvent(handler: (event: AgentUpdateEvent) => void): void; onApiKeyRotationEvent(handler: (event: ApiKeyRotationEvent) => void): void; onHostConfigEvent(handler: (event: HostConfigEvent) => void): void; onDegradedConnection(handler: (info: DegradedConnectionInfo) => void): void; onReprovisionAvailable(handler: (expiresAt: string) => void): void; onConnect(handler: (agentId: string) => void): void; onDisconnect(handler: (reason: string) => void): void; onError(handler: (error: Error) => void): void; offCertificateEvent(handler: (event: CertificateEvent) => void): void; offSecretEvent(handler: (event: SecretEvent) => void): void; /** * Remove all handlers. */ removeAllHandlers(): void; /** * Fire disconnect handlers. */ fireDisconnect(reason: string): void; /** * Fire error handlers. */ fireError(error: Error): void; } //# sourceMappingURL=dispatcher.d.ts.map