import type { Logger } from '@ariestools/sdk';
import type { JsonRpcRequest } from '@metamask/json-rpc-engine/v2';
import { JsonRpcEngineV2, JsonRpcServer } from '@metamask/json-rpc-engine/v2';
import type { XyoConnection, XyoGateway, XyoGatewayRunner } from '@xyo-network/xl1-protocol/protocol-lib';
import type { RpcContext, RpcMiddleware } from './middleware/index.js';
/**
 * Composed alternative to {@link rpcEngineFromConnection}. Builds the same
 * engine surface, but as a stack of small middleware:
 *
 *   logging → [sub-engine per viewer/runner namespace] → method-not-found
 *
 * Each sub-engine pairs a {@link createValidationMiddleware} with a
 * {@link createTypedHandlerMiddleware}, isolating one viewer's schemas + handlers.
 * Cross-cutting concerns (logging, error mapping, future auth/rate-limit) live
 * once at the root rather than inside the dispatch loop.
 */
export declare const composedRpcEngineFromConnection: (connection: XyoConnection, logger?: Logger) => JsonRpcEngineV2<JsonRpcRequest, RpcContext>;
/** Convenience wrapper that returns a spec-compliant `JsonRpcServer`. */
export declare const composedRpcServerFromConnection: (connection: XyoConnection, logger?: Logger) => JsonRpcServer<RpcMiddleware>;
/**
 * Builds the composed engine for a gateway: the full connection surface via
 * {@link composedRpcEngineFromConnection}, plus the signer namespace when the
 * gateway is an {@link XyoGatewayRunner} (a plain read-only gateway has no
 * signer, so its engine simply omits the `xyoSigner_*` methods).
 *
 * Root stack: logging → [signer sub-engine] → connection engine. Sub-engines
 * pass through methods they don't own, so the connection engine's terminal
 * method-not-found middleware remains the overall terminal. The connection
 * engine is built without a logger — errors bubble to the root logging
 * middleware and are logged exactly once.
 */
export declare const composedRpcEngineFromGateway: (gateway: XyoGateway | XyoGatewayRunner, logger?: Logger) => JsonRpcEngineV2<JsonRpcRequest, RpcContext>;
/** Convenience wrapper that returns a spec-compliant `JsonRpcServer` for a gateway. */
export declare const composedRpcServerFromGateway: (gateway: XyoGateway | XyoGatewayRunner, logger?: Logger) => JsonRpcServer<RpcMiddleware>;
//# sourceMappingURL=composedRpcEngineFromConnection.d.ts.map