import { type CleanupRecord } from '../backend-contract/errors.js'; import type { ConnectionLifecycleEvent } from '../backend-contract/connection-lifecycle.js'; import type { AttachmentRecord } from '../backend-contract/identity.js'; import type { RendererLeaseIdentity } from '../backend-contract/electron.js'; import type { BoundedAsyncStream, BoundedAsyncStreamIterator } from '../backend-contract/streams.js'; import type { ElectronConnectionEventsSubscribeResponseV2 } from './protocol.js'; import type { ElectronBleIpcEvent } from './protocol.js'; import type { ElectronEventDelivery } from './renderer-stream-registry.js'; export interface ConnectionLifecycleSource { readonly peerId: string; readonly connectionId: string; readonly connectionGeneration: string; readonly events: BoundedAsyncStream>; } export interface ManagedConnectionEventSubscription { readonly connectionHandle: string; readonly connection: ConnectionLifecycleSource; readonly attachment: AttachmentRecord; readonly iterator: BoundedAsyncStreamIterator>; pump: Promise; cleanupRequested: boolean; cleanupResult: Promise | null; terminalHandled: boolean; admitted: boolean; retryHandle: ReturnType | null; } export interface RendererConnectionEventResources { readonly connectionEventSubscriptions: Map; } export interface ElectronConnectionEventStreamRegistryOptions { readonly maximumMessageBytes: number; readonly publish: (rendererLeaseId: string, event: ElectronBleIpcEvent) => Promise; readonly createEvent: (rendererLease: RendererLeaseIdentity, streamId: string, item: import('../backend-contract/primitives.js').SerializableRecord) => ElectronBleIpcEvent; } /** * Owns the exclusive renderer-scoped consumer of a connection's public lifecycle * stream. Registration is deliberately two-phase: main retains the iterator but * cannot pump it until the renderer has installed its local bounded stream and * explicitly declares the opaque handle ready. Removing the consumer only detaches * its iterator; it never closes, releases, or otherwise changes the main-owned * connection itself. */ export declare class ElectronConnectionEventStreamRegistry { private readonly options; constructor(options: ElectronConnectionEventStreamRegistryOptions); register(resources: RendererConnectionEventResources, handle: string, connectionHandle: string, connection: ConnectionLifecycleSource, attachment: AttachmentRecord): ElectronConnectionEventsSubscribeResponseV2; ready(resources: RendererConnectionEventResources, rendererLease: RendererLeaseIdentity, handle: string): void; remove(resources: RendererConnectionEventResources, handle: string, resource: ManagedConnectionEventSubscription, awaitPump: boolean): Promise; terminate(resources: RendererConnectionEventResources, rendererLease: RendererLeaseIdentity, streamId: string, reason: 'renderer-backpressure' | 'renderer-unavailable'): Promise; private forward; private terminalize; private detach; private scheduleDetachRetry; private clearRetry; } //# sourceMappingURL=connection-event-stream-registry.d.ts.map