Skip to content
On this page

JSBridge protocol

Look up the editor handshake, commands, events, state, and error model.

Envelope

Every packet carries a protocol version, session, sequence number, lane, kind, and type. Requests additionally carry an ID; responses and errors use replyTo. Inbound values are bounded JSON and sequence numbers stay within JavaScript's safe integer range.

Handshake

Text
WebView Native runtime | bridge.hello | | ------------------------------> | | BridgeReadyPayload | | <------------------------------ | | bridge.readyAck | | ------------------------------> |

BridgeReadyPayload contains capabilities, parameter metadata, current parameter values, and a state snapshot. The editor adopts the returned editorSessionId only after validating the complete payload.

Parameter commands

TypePurpose
param.beginBegin a host gesture
param.performRequest a normalized edit
param.endEnd a host gesture
param.formatFormat a normalized value
param.parseParse display text
param.changedConfirm host/controller state

Perform edits with a stable gesture ID. The runtime may coalesce pending perform requests while preserving all request IDs that require a response.

State and subscriptions

Reliable topics require an explicit subscription. Snapshot/config/UI commands use revisions to reject stale writes. Meter and realtime log streams are bounded; latest meter values may replace older frames.

Error codes

Important codes include validation_error, unsupported_version, unsupported_type, timeout, backpressure, host_rejected, plugin_faulted, state_conflict, and internal_error.

Errors are data, not thrown native panics. The JavaScript SDK turns an error packet into a rejected Promise with code, message, retryable, and optional bounded details.