import { Config, Context, Effect, Layer, Option } from 'effect'; /** * Configuration for API port and WebSocket connections */ export interface ConnectionConfig { /** * The port to use for the API server */ readonly apiPort: number; /** * The maximum number of connection retry attempts */ readonly maxRetryAttempts: number; /** * The initial delay (ms) between retry attempts */ readonly initialRetryDelayMs: number; /** * Maximum timeout (ms) for WebSocket operations */ readonly socketTimeoutMs: number; /** * Heartbeat interval (ms) for connection health checks */ readonly heartbeatIntervalMs: number; } /** * Default connection configuration values */ export declare const DefaultConnectionConfig: ConnectionConfig; /** * Config schema for connection settings */ export declare const ConnectionConfigSchema: Config.Config<{ apiPort: number; maxRetryAttempts: number; initialRetryDelayMs: number; socketTimeoutMs: number; heartbeatIntervalMs: number; }>; declare const ConnectionConfigTag_base: Context.TagClass; /** * Environment configuration for connection settings */ export declare class ConnectionConfigTag extends ConnectionConfigTag_base { } export declare const ConnectionConfigLive: Layer.Layer; declare const ConnectionError_base: new = {}>(args: import("effect/Types").Equals extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & { readonly _tag: "ConnectionError"; } & Readonly; /** * Error that occurs during connection operations */ export declare class ConnectionError extends ConnectionError_base<{ readonly message: string; readonly cause?: unknown; }> { } /** * Connection handle for websocket or similar connections */ export interface ConnectionHandle { readonly ping: () => Promise; readonly close: () => Promise; } /** * Status information about a connection */ export interface ConnectionStatus { readonly isConnected: boolean; readonly lastHeartbeat: Option.Option; readonly reconnectAttempts: number; readonly url: string; } declare const ConnectionManager_base: Context.TagClass Effect.Effect; /** * Connect to a WebSocket endpoint with robust retry handling */ readonly connectWithRetry: (url: string, options?: Readonly>) => Effect.Effect; /** * Get the status of a connection */ readonly getConnectionStatus: (url: string) => Effect.Effect; /** * Set up a heartbeat on a connection to keep it alive */ readonly setupHeartbeat: (connection: Readonly, url: string) => Effect.Effect<{ readonly fiber: unknown; }, ConnectionError, never>; }>; /** * Context Tag for ConnectionManager */ export declare class ConnectionManager extends ConnectionManager_base { } /** * Extract the service type from the ConnectionManager tag */ export type ConnectionManagerService = Context.Tag.Service; /** * Creates a live implementation of the ConnectionManager */ export declare const makeConnectionManager: (config: Readonly) => Effect.Effect; /** * Live Layer implementation of the ConnectionManager */ export declare const ConnectionManagerLive: Layer.Layer; export {}; //# sourceMappingURL=connectionManager.d.ts.map