import type { FeatureDataProvider } from '../types'; import type { ConsoleLogEntry } from '../types/logs'; export type HubConnectionState = 'connecting' | 'connected' | 'paused' | 'retrying' | 'hub_unreachable' | 'hub_not_ready' | 'storage_full' | 'protocol_mismatch' | 'invalid_config'; export interface HubConfig { appId: string; endpoint?: string | null; } export interface HubSessionInfo { sessionId: string; deviceId: string; } export interface HubStatus { state: HubConnectionState; session: HubSessionInfo | null; error?: string; } type FetchLike = (url: string, init: { method: string; headers: Record; body?: string; signal?: unknown; }) => Promise<{ ok: boolean; status: number; json?: () => Promise; }>; type AbortControllerLike = { signal: unknown; abort: () => void; }; type AbortControllerCtor = new () => AbortControllerLike; export declare function normalizeHubEndpoint(value: string): string | null; export declare function isValidAppId(value: string): boolean; export interface HubClientOptions { fetch?: FetchLike; AbortController?: AbortControllerCtor; featureProvider: FeatureDataProvider; } export declare class HubClient { private _debugBuild; private _generation; private _requests; private _statusListeners; private _endpointListeners; private _config; private _runtimeEndpoint; private _discoveredEndpoint; private _sessionId; private _session; private _state; private _lastError; private _syncPaused; private _pending; private _inFlight; private _nextSequence; private _ackThrough; private _pendingBytes; private _inFlightBytes; private _overflowCount; private _overflowByType; private _deliveries; private _flushTimer; private _heartbeatTimer; private _retryTimer; private _retryAttempt; private _openSessionPromise; private _sending; private _active; private _appStateSubscription; private _featureProvider; private _featureUnsubscribes; private _lastFeatureIds; private _dirtyFeatures; private _onStatusChange?; private _fetch; private _AbortController; constructor(options: HubClientOptions); setDebugBuild(value: boolean): void; private _isDebugBuild; configure(config: HubConfig): void; setRuntimeEndpoint(value: string): void; clearRuntimeEndpoint(): void; setDiscoveredEndpoint(value: string | null): void; getRuntimeEndpoint(): string | null; getConfiguredEndpoint(): string | null; getEffectiveEndpoint(): string | null; subscribeStatus(listener: (status: HubStatus) => void): () => void; subscribeEndpoint(listener: () => void): () => void; markDiscoveryFailed(attempted: string[]): void; markDiscoverySucceeded(): void; setOnStatusChange(fn: ((status: HubStatus) => void) | undefined): void; connect(options?: { live?: boolean; }): void; disconnect(): void; isActive(): boolean; getStatus(): HubStatus; pauseSync(): void; resumeSync(): void; isSyncPaused(): boolean; /** Explicit copy uses the normal event sequence and waits for its actual ACK. */ sendCopy(text: string, label?: string, consoleEntry?: ConsoleLogEntry): Promise<'delivered' | 'unavailable'>; syncNow(): Promise; private _ensureSession; private _openSession; private _openSessionInternal; private _enqueueEvent; private _evictPending; private _onFeatureChange; private _snapshotFeatures; private _isPendingDelivery; private _hasPendingDelivery; private _scheduleFlush; private _doFlush; private _startHeartbeat; private _stopHeartbeat; private _sendHeartbeat; private _scheduleRetry; private _flushAndSwitchEndpoint; private _handleAppState; private _post; private _getDeviceInfo; private _emitStatus; private _current; private _invalidateRequests; private _clearTimers; _resetForTesting(): void; } export {}; //# sourceMappingURL=HubClient.d.ts.map