/** * JSON-RPC 2.0 protocol constants and shared types. * * Single source of truth for the wire-level representation every * JSON-RPC transport in this codebase consumes: * - Parse helpers (`json-rpc-parse.ts`, Phase 8) * - Dispatcher (`json-rpc-dispatch.ts`, Phase 8) * - HTTP adapter (`json-rpc-http.ts`, Phase 11) * - WebSocket adapter (`json-rpc-websocket.ts`, Phase 12) * - Runtime stdio session (`stdio-session.ts`, Phase 13) * * Reserved-spec error codes (-32700..-32603) keep their JSON-RPC 2.0 * meanings. Weft domain codes live in the -32010..-32099 band; this stable * error-code allocation preserves compatibility across JSON-RPC transports. */ /** Literal `"2.0"` — the only `jsonrpc` version this runtime accepts. */ export declare const JSON_RPC_VERSION: "2.0"; export type JsonRpcVersion = typeof JSON_RPC_VERSION; /** * Error codes carried on the wire in `JsonRpcError.code`. * * Reserved band (-32700..-32603) — JSON-RPC 2.0 spec. * Weft domain band (-32010..-32099) — see `OperationFault` + * `fault-to-json-rpc.ts` for the mapping to `FaultCode`. */ export declare const JSON_RPC_ERROR_CODES: Readonly<{ readonly PARSE_ERROR: -32700; readonly INVALID_REQUEST: -32600; readonly METHOD_NOT_FOUND: -32601; readonly INVALID_PARAMS: -32602; readonly INTERNAL_ERROR: -32603; readonly UNAUTHORIZED: -32010; readonly FORBIDDEN: -32011; readonly NOT_FOUND: -32020; readonly CONFLICT: -32021; readonly UNPROCESSABLE: -32022; readonly TIMEOUT: -32023; readonly RATE_LIMITED: -32024; readonly NOT_IMPLEMENTED: -32025; readonly UNSUPPORTED_TRANSPORT: -32030; readonly SUBSCRIPTION_OVERFLOW: -32031; readonly ENGINE_FAILURE: -32099; }>; export type JsonRpcErrorCode = (typeof JSON_RPC_ERROR_CODES)[keyof typeof JSON_RPC_ERROR_CODES]; /** * A JSON-RPC request id. The spec allows string, number, or null. * `null` is only valid when returned in error responses for requests * whose id could not be parsed. */ export type JsonRpcId = string | number | null; /** Total runtime guard for `JsonRpcId`. Rejects NaN, Infinity, booleans, objects. */ export declare function isValidJsonRpcId(value: unknown): value is JsonRpcId; /** Raw JSON-RPC request shape (pre-parse, as it arrives on the wire). */ export type JsonRpcRequest = { readonly jsonrpc: JsonRpcVersion; readonly method: string; readonly params?: Record | undefined; readonly id?: JsonRpcId | undefined; }; /** JSON-RPC success response. */ export type JsonRpcSuccessResponse = { readonly jsonrpc: JsonRpcVersion; readonly result: unknown; readonly id: JsonRpcId; }; /** JSON-RPC error response. */ export type JsonRpcErrorResponse = { readonly jsonrpc: JsonRpcVersion; readonly error: { readonly code: number; readonly message: string; readonly data?: unknown; }; readonly id: JsonRpcId; }; export type JsonRpcResponse = JsonRpcSuccessResponse | JsonRpcErrorResponse;