Skip to content

@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.

  • VERSION — wire protocol version, pinned at 1 (contract-tested).
  • MessageType — ENVELOPE (+ the value union MessageTypeValue).
  • ErrorCode — deterministic error codes (+ the value union ErrorCode).
  • MAX_HEADER_BYTES — 0xffff.
  • MAX_FRAME_BYTES — 16 * 1024 * 1024.
  • MessageProtocol — encode(type, header, payload?) / decode(bytes).
  • createPluginRegistry() — register throws on a malformed id or on a reserved core.*/vendor.* id that is not a framework plugin.
  • createPluginRouter(registry, runtime, options?) — routes envelopes; options include delegateToHost, getHostCapabilities, maxInflight, maxInflightPerChannel, maxInflightPerPlugin, serialPlugins.
  • createProtocolMessenger(send, options?) and createPluginBus(messenger) — the page-side request/response matching and typed invoke/dispatch.
  • definePlugin(id, specs, options) — typed plugin authoring. An EventSpec may carry validate(args) (runtime check of the untrusted args) and hostTimeoutMs (deadline for a host-delegated call, collected into the manifest’s hostTimeoutsMs).
  • invokeEvent(spec, args, payload?, timeoutMs?) — typed invoke envelope builder; the RPC messenger’s default invoke timeout is 5s, so pass an explicit timeoutMs for 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.