/** * Value encodings for protomux-rpc. * * Default: compact-encoding JSON (stable, human-debuggable). * Binary path: chunked base64 via push:binaryChunk / binaryStream* methods. * * Hyperschema migration path: * - SCHEMA_VERSION negotiated in handshake (shared/schema.js) * - MethodSchemas document field shapes * - Future: swap valueEncoding per-method to hyperschema structs while * keeping method names stable (PROTOCOL_VERSION bump when required) */ import c from 'compact-encoding' import { SCHEMA_VERSION } from './schema.js' /** Default encoding for all peardock RPC methods and pushes. */ export const json = c.json /** Raw buffer passthrough when needed (future hyperschema binary). */ export const raw = c.raw /** Empty / none encoding. */ export const none = c.none export const encodings = { valueEncoding: json, requestEncoding: json, responseEncoding: json, } /** * Encoding profile advertised to clients. * When hyperschema lands, profile becomes 'hyperschema' without changing method names. */ export const ENCODING_PROFILE = { name: 'json+chunked-binary', schemaVersion: SCHEMA_VERSION, binary: 'push:binaryChunk + binaryStreamOpen/Chunk/Close', future: 'hyperschema per-method valueEncoding', } export { SCHEMA_VERSION }