export declare const RPC_STARTUP_LOCK_BYPASS_ENV = "CLINE_RPC_STARTUP_LOCK_HELD";
export declare const RPC_OWNER_ID_ENV = "CLINE_RPC_OWNER_ID";
export declare const RPC_BUILD_ID_ENV = "CLINE_RPC_BUILD_ID";
export declare const RPC_DISCOVERY_PATH_ENV = "CLINE_RPC_DISCOVERY_PATH";
export type RpcDiscoveryRecord = {
    ownerId: string;
    buildId: string;
    entryPath?: string;
    address: string;
    pid?: number;
    serverId?: string;
    startedAt?: string;
    protocolVersion: string;
    updatedAt: string;
};
export type RpcOwnerContext = {
    ownerId: string;
    buildId: string;
    entryPath?: string;
    discoveryPath: string;
};
export type ResolveRpcRuntimeResult = {
    address: string;
    action: "reuse" | "new-port" | "started";
    owner: RpcOwnerContext;
};
export type EnsureRpcRuntimeOptions = {
    owner?: RpcOwnerContext;
    resolveOwner?: () => RpcOwnerContext;
    spawnIfNeeded: (address: string, owner: RpcOwnerContext) => void | Promise<void>;
    readinessCheck?: (address: string) => Promise<boolean>;
};
export type ResolveRpcOwnerContextOptions = {
    discoveryPath?: string;
    hostBuildKey?: string;
    identityPath?: string;
    ownerBasis?: string;
    ownerId?: string;
    ownerPrefix?: string;
};
export declare function resolveRpcRuntimeBuildKey(hostBuildKey?: string): string;
export declare function resolveRpcOwnerContext(options?: ResolveRpcOwnerContextOptions): RpcOwnerContext;
export declare function recordRpcDiscovery(owner: RpcOwnerContext, record: Omit<RpcDiscoveryRecord, "ownerId" | "buildId" | "updatedAt">): Promise<void>;
export declare function clearRpcDiscoveryIfAddressMatches(owner: RpcOwnerContext, address: string): Promise<void>;
export declare function isCompatibleRuntime(address: string): Promise<boolean>;
export declare function withRpcStartupLock<T>(address: string, action: () => Promise<T>): Promise<T>;
export declare function resolveEnsuredRpcRuntime(requestedAddress: string, options?: {
    owner?: RpcOwnerContext;
    resolveOwner?: () => RpcOwnerContext;
}): Promise<ResolveRpcRuntimeResult>;
export declare function waitForCompatibleRpcRuntime(address: string, readinessCheck?: (address: string) => Promise<boolean>): Promise<boolean>;
export declare function ensureRpcRuntimeAddress(requestedAddress: string, options: EnsureRpcRuntimeOptions): Promise<ResolveRpcRuntimeResult>;
//# sourceMappingURL=rpc-runtime-ensure.d.ts.map