@ekrooh/bare/core
The core subpath (core/messages) is the wire protocol surface: codec, plugin
kernel, RPC messenger, host IPC types, and typed plugin authoring.
Constants
Section titled “Constants”VERSION— wire protocol version, pinned at1(contract-tested).MessageType—ENVELOPE(+ the value unionMessageTypeValue).ErrorCode— deterministic error codes (+ the value unionErrorCode).MAX_HEADER_BYTES—0xffff.MAX_FRAME_BYTES—16 * 1024 * 1024.
Classes & factories
Section titled “Classes & factories”MessageProtocol—encode(type, header, payload?)/decode(bytes).createPluginRegistry()—registerthrows on a malformed id or on a reservedcore.*/vendor.*id that is not a framework plugin.createPluginRouter(registry, runtime, options?)— routes envelopes; options includedelegateToHost,getHostCapabilities,maxInflight,maxInflightPerChannel,maxInflightPerPlugin,serialPlugins.createProtocolMessenger(send, options?)andcreatePluginBus(messenger)— the page-side request/response matching and typedinvoke/dispatch.definePlugin(id, specs, options)— typed plugin authoring. AnEventSpecmay carryvalidate(args)(runtime check of the untrusted args) andhostTimeoutMs(deadline for a host-delegated call, collected into the manifest’shostTimeoutsMs).invokeEvent(spec, args, payload?, timeoutMs?)— typed invoke envelope builder; the RPC messenger’s default invoke timeout is 5s, so pass an explicittimeoutMsfor network/spool-bound events (see Authoring a Plugin).ok(result)/err(code, message)— result envelope helpers.
MessageHeader,WireMessage, header unions (DISPATCH,INVOKE_REQUEST,INVOKE_RESPONSE,HOST_CAPABILITIES_*,HOST_INVOKE_REQUEST).PluginManifest,PluginInvokeRequestHeader,PluginInvokeResponseHeader,CoreErrorWire.BareRuntimeContext,createBareRuntimeContext().
The exact export names are frozen by contract.test.ts — treat any change as a
breaking change.