Browser-Side API

Lookup tables for the browser side: connectDevframe options, RPC client events, connection statuses, and in-page channels error codes.

Lookup tables for a devframe's browser side. Each section links the guide page that teaches the concept.

connectDevframe options

The options of connectDevframe() / getDevframeRpcClient(): Client.

OptionDescription
connectionConnection prepared by setupDevframeConnection().
baseURLMount path to probe for __connection.json (array = fallback). Default './' (relative to document.baseURI); use an absolute path ('/__devframe/') from outside the SPA.
authTokenOverride the auth token (default: a locally-persisted id).
cacheOptionstrue for default caching, or an options object.
callTimeoutMs before a pending rpc.call rejects with a 'timeout' DevframeConnectionError; 0/omit = wait forever.
wsOptionsTransport overrides: onConnected / onError / onDisconnected hooks, socket URL.
rpcOptionsForwarded to birpc.
connectionMetaDescriptor that skips the __connection.json fetch.
webmcpMirror agent-flagged client RPC functions onto the page's WebMCP model context as tools; false opts out. Default true (applies only when the browser provides one). See Agent-Native.

RPC client events

Emitted over rpc.events: Events.

EventFires when
rpc:is-trusted:updatedTrust granted, denied, or revoked. Carries the new isTrusted boolean.
connection:statusThe connection status changes. Carries (status, previous).
connection:errorA connection-level failure: socket error or trust refused. Carries the Error.
rpc:errorAn rpc.call rejects, from the node side or a down connection. Carries (error, method).

Connection statuses

The values of rpc.status: Handling connection and auth errors.

StatusMeaning
connectingEstablishing socket / handshake. Calls queue until open.
connectedSocket open and trusted; calls are served.
unauthorizedSocket open, trust refused. Prompt for authentication.
disconnectedSocket closed (dropped mid-session or never opened).
errorFatal: the socket errored or connection meta couldn't load.

In-page channel endpoints

The browser-only endpoint methods of the in-page channel. emit() sends to the opposite endpoint; on() handles events arriving from that endpoint.

InPageChannelProtocol separates functions and events. Each section has optional pageScript and panel maps naming the receiving direction. Endpoint options require a complete functions map with handlers; events is optional, and when provided can include optional handlers (use {} to declare an event without a handler for channel.on()). call() uses function names regardless of return type, while emit(), callEvent() (deprecated), and on() use event names. A function returning void or Promise<void> remains an awaitable request/response call.

Method or propertyPage-script endpointPanel endpoint
emit(name, ...args)Fans an event out to every connected panel.Sends an event to the page script, buffering while connecting.
on(name, listener)Subscribes to events emitted by a panel. Returns an unsubscribe function.Subscribes to events emitted by the page script. Returns an unsubscribe function.
call(name, ...args)Available through a specific PanelPeer.Calls a page-script function and awaits its result.
eventsLocal panel:connected / panel:disconnected lifecycle events.Local status:updated lifecycle event.
sharedStateOwns the authoritative state.Mirrors the page-script state.

In-page channel error codes

The error.code values of InPageChannelError: Errors and fallbacks.

CodeWhenWhat to do
timeoutA call outlived callTimeoutMs (default 15s), or whenConnected(ms) expiredThe message carries the endpoint status: connecting usually means the page script isn't loaded in this context
closedThe endpoint was closed with calls pendingExpected during teardown
not-serializableA jsonSerializable: true payload contained a non-JSON valueThe message names the offending path (e.g. its arguments[0].nodes[2] is a Map)
not-cloneableThe port refused to clone a payload (DataCloneError)Strip functions/DOM nodes/reactivity proxies, or declare jsonSerializable: true for the precise error above
invalid-argsIncoming arguments failed their Standard-Schema validationThe message lists the schema issues
state-uninitializedThe page script read a shared state before providing its initialValueInitialize on first access