import { AsyncLocalStorage } from "node:async_hooks"; export declare const RUNTIME_PROTOCOL_VERSION = 3; export declare const RUNTIME_SYMBOL: unique symbol; /** Provider connection metadata visible to an interface consumer. */ export interface InterfaceConnection { /** Optional connection alias. */ id?: string; /** Resolved interface package path. */ path: string; /** Module ID of the provider represented by this connection. */ provider: string; /** Whether this provider is selected for unqualified interface calls. */ selected: boolean; } /** Module identity and provider routes propagated through asynchronous work. */ export interface ModuleExecutionContext { /** Stable module ID used by existing lifecycle and attribution APIs. */ module: string; /** Unique lifecycle generation ID. Defaults to the module ID when omitted. */ owner?: string; /** Provider ID used when attaching implementations. */ provider?: string; /** Provider selections keyed by stable interface proxy identity. */ providerRoutes?: Readonly>; } interface ActiveModuleExecutionContext extends ModuleExecutionContext { owner: string; ownershipToken: symbol; } export interface ProxyBrand { protocol: number; kind: "async" | "registering" | "event"; identity: string; } export interface RuntimeProxyState { kind: ProxyBrand["kind"]; value: unknown; } export interface RuntimeCleanup { cleanup(): void; unregisterModule?(module: string): void; } export interface RuntimeErrorDetails { operation: string; module?: string; proxyIdentity?: string; registrationId?: unknown; } export interface InterfaceRuntime { protocol: number; moduleByFolder: Array<{ dir: string; id: string; isImplementor?: boolean; }>; testStubMode: boolean; knownAsync: Map>; knownRegisters: Map>; registeringProxies: Set<{ unregisterModule(module: string): void; unregisterOwner(owner: string): void; }>; knownEvents: Set<{ unregisterModule(module: string): void; unregisterOwner(owner: string): void; }>; interfaceConnections: Record>; executionContext: AsyncLocalStorage; activeOwnerTokens: Map; proxyStates: Map; nextProxyIdentity: number; nextLeaseGeneration: number; maxPendingOperations: number; asyncContextReporter?: (trace: NodeJS.CallSite[]) => void; runtimeErrorReporter?: (error: unknown, details: RuntimeErrorDetails) => void; replayErrorReporter?: (id: unknown, error: unknown) => void; addAsyncProxy(module: string, proxy: RuntimeCleanup | { detach(): void; }): void; addRegisteringProxy(module: string, proxy: RuntimeCleanup | { detach(): void; }): void; } /** @internal */ export declare const internal: InterfaceRuntime; export declare function runWithModuleContext(context: ModuleExecutionContext, callback: () => T): T; export declare function captureModuleContext(): ActiveModuleExecutionContext | undefined; export declare function runWithCapturedModuleContext(context: ActiveModuleExecutionContext, callback: () => T): T; export declare function peekModuleContext(): ModuleExecutionContext | undefined; export declare function getModuleContext(): ModuleExecutionContext | undefined; export declare function invalidateModuleContext(owner: string): void; export {};