Skip to main content

Remote Component Host Bridge

The host bridge connects a Remote Component iframe, the Workbench host, and the plugin View Provider. It is not a generic RPC tunnel: every capability requires a manifest declaration, a host message handler, and the corresponding server implementation.
The Remote Component sends business intent only. The host resolves the current user, host, tenant, and organization context and validates the view, feature, permissions, and capability declaration before calling the provider.

Three contract layers

The host must reject a capability when any layer is missing.

Message envelope

All messages use a fixed channel and protocol version:
  • The iframe sends ready after loading.
  • The host returns init with the instanceId, manifest, initial query, locale, theme, and debug configuration.
  • Later messages must carry the matching instanceId.
  • Requests and responses share one requestId.
  • The iframe accepts messages only from window.parent; the host accepts messages only from the current iframe contentWindow.

Supported messages

Host to iframe: Iframe to host:

Capability mapping

TypeScript bridge client

Keep the bridge in bridge.ts; business components should not construct wire messages directly.
Build named wrappers such as requestData(), executeAction(), and invokeClientCommand() on top of this boundary. Return stable error codes from the bridge and translate them at the UI boundary.

Query data

XpertViewQuery.parameters accepts only scalar values or scalar arrays. Serialize a complex filter into one explicit JSON string parameter and parse it safely in the provider. Use server-side pagination for large tables. Do not load every record into the iframe.

Execute actions

Use JSON actions for normal business mutations:
The actionKey must exist in manifest.actions, and its transport must match. The provider still validates the target, current user, and tenant/organization scope. Use executeFileAction for uploads; do not put binary or Base64 content in JSON actions. Use requestFileAccess for previews and downloads so the host can issue a time-bounded grant.

Client commands

Client commands perform host-local UI behavior without calling the plugin provider. Examples include sending an Assistant message, setting Assistant context, opening a file, or navigating to another Workbench view. They form a closed three-party contract:
  1. The source manifest allowlists the command key in clientCommands.
  2. The current host registers a handler for the same key.
  3. The Remote Component invokes it through invokeClientCommand and handles a structured failure result.
Do not navigate the top window directly from the iframe.

Host events

A Remote Component can subscribe to normalized host events, such as a completed Agent middleware tool:
Declarative views normally use refresh. Prefer forward for Remote Components so they can refresh only the affected data. If local edits are dirty, do not silently replace them with remote state.

Initialization, theme, and locale

Treat init.locale as authoritative and normalize it once to a BCP 47 tag such as en-US, zh-Hans, or zh-Hant. Do not select copy with locale branches inside business components. After applying init.theme.tokens, call installShadcnThemeVars() to install semantic theme variables. Gate debug logging with init.debug.enabled; do not infer development mode from URLs, hostnames, or platform identity. Do not rely on localStorage or sessionStorage. Keep ephemeral state in React and persist durable state through the host bridge.

Security checklist

  • Do not pass access tokens, API URLs, Assistant IDs, tenant IDs, or organization IDs into the iframe.
  • Do not let the iframe select hostType or hostId.
  • Reject actions, file capabilities, and client commands that are absent from the manifest.
  • Do not log tokens, file contents, complete business snapshots, or personally sensitive data.
  • Re-run authorization and tenant/organization isolation for every provider read and mutation.
  • Test the message source, protocol version, instance ID, and request ID boundaries.
Return to Workbench Remote Components for the complete development workflow.