/** * POST `/jsonrpc` HTTP transport adapter. * * Takes an incoming `Request`, validates the method + content-type + * body size, reads the body (bounded), and delegates dispatch to * `dispatchJsonRpc`. Maps the dispatcher's `DispatchJsonRpcResult` * onto an HTTP `Response` per JSON-RPC 2.0 spec conventions: * * - single non-notification → HTTP 200 + JSON body * - single notification → HTTP 204 No Content * - batch with ≥1 response → HTTP 200 + JSON array body * - all-notification batch → HTTP 204 No Content * * Note: body-level errors (parse-error, invalid-request) come back in * the JSON-RPC error envelope with `id: null` at HTTP 200 per spec. * HTTP 4xx/5xx are reserved for transport-level concerns (wrong * method, wrong content-type, body too large, server crash). * * The pre-read content-length guard rejects oversize bodies before * allocating a buffer. The post-read size check is the backstop when * the client omits content-length or lies. */ import type { OperationRegistry } from './operation-catalog.ts'; import type { Principal } from './principal.ts'; export type JsonRpcHttpContext = { readonly registry: OperationRegistry; readonly engine: unknown; readonly principal: Principal; /** Hard cap on request body size. Defaults to 1 MB. */ readonly maxBodyBytes?: number; }; /** Handle a POST `/jsonrpc` request end-to-end. */ export declare function handleJsonRpcHttpRequest(request: Request, context: JsonRpcHttpContext): Promise;