Crux
API Reference@crux/core

Runtime Bridge

API reference for @crux/core/runtime-bridge schemas and command-plane helpers.

import {
  BridgeCommandRequestSchema,
  BridgeCommandResultSchema,
  RuntimeBridgeMessageSchema,
  RuntimePeerHelloSchema,
  connectRuntimeBridge,
  executeRuntimeBridgeCommand,
  getRuntimeBridgeManifest,
} from '@crux/core/runtime-bridge'

The Runtime Bridge is the local-dev command plane between the @crux/local Go service and a live application runtime. It is used for inspectable resources and framework-specific local commands. It is not the execution trace transport; runtime traces use @crux/core/observability.

Command errors

Failed commands return command.error with a stable error message and structured details. Runtime peers normalize thrown values with the same observability error contract used by spans, including thrown, summary, name, message, optional stack, safe raw data, phase, and errorKind when known.

The local Go bridge preserves those details for WebSocket, HTTP, and embedded eval-runner commands, and emits command.failed events for failed dispatches. Eval-runner process failures also become command errors, so devtools and the TUI can show bridge/eval failures even when no application span exists.

Schemas

ExportDescription
RuntimeBridgeConfigSchemaRuntime bridge configuration accepted by Crux config/integrations.
RuntimeBridgeMessageSchemaUnion schema for bridge messages.
RuntimePeerHelloSchemaPeer handshake payload.
BridgeCommandRequestSchemaCommand request sent by the Go service to a runtime peer.
BridgeCommandResultSchemaSuccessful command response.
BridgeCommandErrorSchemaFailed command response.

Helpers

ExportDescription
getRuntimeBridgeManifest()Returns the runtime peer manifest exposed to the local service.
connectRuntimeBridge()Connects a long-lived runtime peer.
executeRuntimeBridgeCommand()Executes a typed bridge command against registered runtime resources.

On this page