Skip to main content

Workbench Remote Components

A Remote Component is a View Extension rendering mode for plugin-owned custom UI inside Assistant Workbench. The View Extension defines where the view appears, who can see it, and which capabilities it may use. The Remote Component defines how those capabilities are presented and used inside an iframe. It is not a standalone plugin type and does not replace the server-side View Provider.
Read View Extensions before starting.

When to use one

Use a Remote Component when the Workbench needs:
  • A multi-panel business Workbench, editor, or canvas.
  • Complex interactions such as drag and drop, a timeline, or graphical editing.
  • Several paged datasets with targeted refresh behavior.
  • Coordination with Assistant chat, file previews, or other Workbench views.
Prefer platform-rendered stats, tables, lists, or read-only details for standard data presentation. Separate maintained source from generated assets:
  • src/**/*.ts and src/**/*.tsx are the source of truth.
  • app.js and app.css are generated assets; do not edit them manually.
  • The plugin build must generate and copy the Remote Component assets.
  • Add a dedicated TypeScript typecheck for the remote source.
React is the recommended development path. The View protocol also supports vue and esm runtimes; the current product executes iframe isolation.

Define stable keys

The public view key follows <providerKey>__<manifestKey>. component.entry is a provider-local entry key, not a browser URL.

Register the View Provider

The View Provider returns the Workbench manifest and handles its data and actions:
The domain middleware that owns the contract review data and Agent tools should declare REVIEW_FEATURE. The Workbench host exposes the view only after the Assistant connects that middleware. For a fixed Workbench entry, return the same manifest from agent.workbench.fixed and add workbench.fixed and menu configuration.

Return the Remote Component entry

The provider returns a complete HTML document from getRemoteComponentEntry(). Use the Plugin SDK HTML helper:
The platform validates the remote entry key and re-checks host access, manifest visibility, and feature activation before fetching the HTML.

Implement the frontend entry

Install the bridge listener first, then render business UI after init arrives:
See Remote Component Host Bridge for message types, timeouts, actions, files, client commands, and host events.

Data and actions

A Remote Component does not call platform APIs directly. It requests data through the host bridge:
The provider queries from the trusted server context and applies tenant, organization, and user authorization before filtering and pagination:
Load large datasets by page and panel. parameters accepts only scalar values or scalar arrays; do not send nested filter objects directly. Run mutations through declared executeAction or executeFileAction capabilities. A successful action may return refresh: true; a complex Remote Component can instead refresh only the affected region from the returned business identifier.

Theme, components, and layout

  • Build buttons, inputs, dialogs, tables, and other standard controls with @xpert-ai/plugin-shadcn-ui.
  • Load the shared stylesheet once and call installShadcnThemeVars() after applying the host --xui-* tokens.
  • Compile Tailwind against the Remote Component TSX and emit production app.css.
  • Keep html, body, #root, and the outer application at width: 100% and height: 100%.
  • Set min-width: 0, min-height: 0, and controlled overflow through flex and grid ancestors.
  • Make navigation or inspector panels collapsible when they compete with the primary workspace.
  • Use AlertDialog for consequential confirmations; do not use browser-native confirmation dialogs.

Internationalization

Treat host init.locale as authoritative and normalize it once at the entry boundary. Maintain at least en-US and zh-Hans; do not map every zh-* locale to Simplified Chinese. Components should use semantic translation keys and shared Intl formatters, without locale === ... copy branches in JSX. Keep { en_US, zh_Hans } localized objects at the manifest boundary.

State and debugging

  • Keep ephemeral UI state in React state or refs.
  • Persist durable business state through the host bridge.
  • Do not read or write localStorage or sessionStorage.
  • Gate detailed logs with host-provided init.debug.enabled; keep them off by default in production.
  • Never log tokens, tenant or organization IDs, file contents, full snapshots, or personally sensitive data.

Optional: open from a tool result

A persistent Workbench entry is listed from its host slot. Use xpert.extension_view only when the view should appear after a particular tool call:
The tool opens an already registered view. It should not return the complete page data or include host identity, API URLs, or credentials.

Validation checklist

  • The View Provider is registered in the plugin server module.
  • The manifest includes source and the correct activation.requiredFeatures.
  • Removing the owning Feature removes both the Agent tools and the View.
  • Remote entry, local view, and public view keys are stable and tested.
  • The production build regenerates app.js and app.css and checks for stale output.
  • Iframe messages validate the source window, protocol version, instance ID, and request ID.
  • Data, JSON actions, file actions, client commands, and host events are declared in the manifest.
  • Provider reads and mutations enforce tenant, organization, user, and business authorization.
  • Theme installation works in light, dark, and every supported density.
  • English and Chinese catalogs keep matching keys and interpolation parameters.
  • Workbench E2E loads the real generated assets.
  • Platform-dependent permissions, files, and installation behavior receive an installed-host pass.
Continue with Remote Component Host Bridge for the protocol mapping behind each host capability.