import { type SrpcByteStream } from '../../srpc/SrpcByteStream'; import { type SrpcConnection, type SrpcMeta, type SrpcStream } from '../../srpc/types'; import type { MeshLinkFrame } from '../mesh-link'; import { MeshLinkPeer, MeshLinkRuntime } from '../mesh-link'; import type { MeshClientRemoteTransport, MeshClientService } from './mesh-client-service'; import type { MeshSrpcConnection } from './srpc-registry-metadata'; import { MeshRemoteSrpcConnection, type MeshRemoteConnectionTransport } from './mesh-srpc-remote-connection'; export interface MeshLocalInvokeResult { body: Uint8Array; issuedSenderIds: number[]; requiresExactSenderGrant?: boolean; } export declare class MeshLinkCapabilityError extends Error { constructor(message: string); } export interface MeshSrpcLinkControllerOptions { meshKey: string; requestTimeoutMs: number; runtime: MeshLinkRuntime; service: MeshClientService>; getLocalConnection(clientId: string): SrpcStream | undefined; /** Includes a pending stream, which is not yet visible in active registry lookups. */ hasLocalFenceConnection?(clientId: string, connectionId: string): boolean; invokeLocal(clientId: string, connectionId: string, prefix: string, data: Uint8Array, timeoutMs: number): Promise; serviceInvokeLocal?(clientId: string, connectionId: string, type: string, data: unknown, timeoutMs: number): Promise; reserveLocalSenderIds(clientId: string, connectionId: string, count: number): number[]; writeLocalStream(clientId: string, connectionId: string, streamId: number, data: Uint8Array): Promise; finishLocalStream(clientId: string, connectionId: string, streamId: number): Promise; destroyLocalStream(clientId: string, connectionId: string, streamId: number, error?: string): Promise; attachLocalReceiver(clientId: string, connectionId: string, streamId: number): SrpcByteStream; disconnectLocal(clientId: string, connectionId: string, reason?: string): Promise; /** Exact ownership handoff; distinct from an operator-requested disconnect. */ fenceLocal?(clientId: string, connectionId: string, reason?: string): Promise; updateLocalMetadata(clientId: string, connectionId: string, metadata: Partial): Promise; } export declare class MeshSrpcLinkController implements MeshRemoteConnectionTransport, MeshClientRemoteTransport { private readonly options; private readonly remoteConnections; private readonly resolvingRemoteConnections; private readonly senderRoutes; private readonly terminalSenderRoutes; private readonly attachedReceivers; private readonly issuedSenderGrants; private readonly reservations; private readonly handleCapabilities; private readonly revokedRemoteCapabilities; private readonly cleanupMarkers; private readonly terminalForwards; private readonly closedOwnerIdentities; private readonly verifiedPeers; private readonly verifyingPeers; private readonly unregisterPeerCloseHandler; private readonly unregisterEndpointPinResolver; private readonly endpointPinUnregisters; private readonly remoteConnectionPruneTimer; private readonly terminalRetryTimer; private closePromise?; private closed; constructor(options: MeshSrpcLinkControllerOptions); close(): Promise; private closeInternal; resolveClient(clientId: string, deadlineAt?: number): Promise | undefined>; listClients(): Promise[]>; invoke(connection: SrpcConnection, prefix: string, data: Uint8Array, timeoutMs: number, deadlineAt?: number): Promise; disconnect(connection: MeshRemoteSrpcConnection, reason?: string): Promise; /** Generic MeshClientService invocation over the authenticated mesh link. */ invokeClient(nodeId: number, request: { clientId: string; connectionId: string; type: string; data: unknown; timeoutMs?: number; deadlineAt?: number; }): Promise; /** Exact-generation physical fence used by ownership takeover and close. */ fenceClient(nodeId: number, request: { clientId: string; connectionId: string; reason?: string; timeoutMs?: number; }): Promise; updateClientMetadata(nodeId: number, request: { clientId: string; connectionId: string; metadata: TRegistryMeta; }): Promise; reserveSenderIds(connection: MeshRemoteSrpcConnection): Promise; releaseSenderIds(connection: MeshRemoteSrpcConnection, ids: number[]): Promise; private releaseReservation; updateMetadata(connection: MeshRemoteSrpcConnection, metadata: Partial): Promise; writeStream(connection: MeshRemoteSrpcConnection, streamId: number, data: Uint8Array): Promise; finishStream(connection: MeshRemoteSrpcConnection, streamId: number): Promise; destroyStream(connection: MeshRemoteSrpcConnection, streamId: number, error?: unknown): Promise; private reserveAndConfirm; private retryReservation; attachReceiver(connection: MeshRemoteSrpcConnection, streamId: number): Promise; activateSender(connection: MeshRemoteSrpcConnection, streamId: number): Promise; route(peer: MeshLinkPeer, frame: MeshLinkFrame): Promise; forwardClientDestroy(connectionId: string, streamId: number, error?: string): boolean; /** Core byte-stream teardown guard: only an authenticated route may * consume a sender owned by the opposite mesh endpoint. */ hasSenderRoute(connectionId: string, streamId: number): boolean; invalidateConnection(clientId: string, connectionId: string): void; private resolveRegisteredClient; private createRemoteConnection; private assertCurrent; private requestOwner; private requestClientOwner; private assertNodeCapability; private supportsDirectLink; private pinNode; /** Pins remain only while a live connection or terminal-cleanup obligation * can address the endpoint. Runtime pins themselves are ref-counted; this * releases the controller's last reference once no such obligation exists. */ private pruneEndpointPins; private attachLocalReceiver; private queueTerminalForward; private retryTerminalForwards; private retryTerminalForward; private drainTerminalForwards; private closePinnedPeer; private reserveRoute; private confirmReservation; private assertFrameCapability; private assertCapabilityRevocation; private acceptCapabilityRevocation; private rememberRevokedRemoteCapability; private assertLocalStreamOwnership; private activateSenderRoute; private grantIssuedSenderIds; private assertIssuedSenderGrant; private pruneReservations; private rememberTerminalSenderRoute; private getTerminalSenderRoute; private reservationExpiresAt; private handleCapabilityExpiresAt; private abandonPeerReservations; private abandonRoute; private abandonIssuedSenderGrant; private closeHandleCapability; private removeHandleCapability; private isCapabilityActive; private getRemoteConnection; private invalidate; private invalidateResolution; private invalidateClientConnections; private invalidateOtherGenerations; private pruneRemoteConnections; private verifyPeerMembership; private countRoutesForConnection; private countReceiversForConnection; private deleteSenderRoutes; private releaseAndMarkStale; private queueCleanup; private rememberCleanup; private retryCleanupMarkers; private retryCleanupMarker; private drainCleanupMarkers; private closeCleanupTargetPeer; private rememberClosedOwnerIdentity; private assertLeaseSafe; private assertOpen; } //# sourceMappingURL=mesh-srpc-link-controller.d.ts.map