Today WebView Bridge
Native Reference

Linux

Implementing the app-shell contract with Electron contextBridge and IPC.

Today on Linux is a full Electron application shell, not an embedded WebView. It still implements the same WebView Bridge contract so the shared web application can use one runtime API on every host.

Document-start runtime

The isolated Electron preload exposes both immutable globals before page scripts run:

window.__todayWebView = {
  platform: 'linux',
  host: 'electron',
  surface: 'app-shell',
  bridgeVersion: 1,
  appVersion: '...',
  deviceMachineId: '...',
  capabilities: ['agentTools', 'connectorPermissions', 'deviceRuntime', 'nativeHeaders'],
}

window.todayWebViewBridge = {
  postMessage(message) {
    // Promise RPC through the narrow Electron IPC handler.
  },
  onNativeEvent(handler) {
    // Optional direct subscription for device-runtime lifecycle events.
  },
}

The explicit 'linux' platform tag is required. Without it, a global todayWebViewBridge channel without the WebView2 marker falls back to Android. surface: 'app-shell' also makes bridge.isEmbeddedSurface() return false, so embed-only navigation and session behavior is not applied to the desktop window.

Transport and trust boundary

Use Electron contextBridge.exposeInMainWorld; do not expose ipcRenderer, Node, Electron, or arbitrary IPC channel names to the page. The Today desktop host additionally:

  • enables context isolation and Chromium sandboxing and disables Node integration;
  • exposes the bridge only to the trusted main-frame Today origins;
  • validates a non-empty message type and bounds the serialized message size;
  • checks the exact sender window, main frame, and active trusted origin again in the main process;
  • returns only serializable results through the promise-based facade.

These checks are the security boundary. The page-visible platform and isAvailable() values remain UX hints, as described in Environment Detection.

Linux desktop identity and capabilities

The desktop web/API context uses X-Client-Platform: linux-client. The device runtime identifies itself as clientPlatform: linux, clientType: linux-connector, and Node platform linux.

The Linux host advertises the eight universal desktop tools plus 15 Linux-native tools, for a 23-tool manifest. It exposes only connectors backed by those implementations:

linux_desktop
linux_documents
linux_downloads
linux_filesystem
linux_clipboard
linux_screen
linux_battery
linux_shell
linux_system
linux_device

It does not publish placeholders for macOS-only, Windows-only, Outlook, Ghost, Accessibility, Location, PowerShell-only, JXA, SDEF, or other unsupported capabilities. See the desktop-client README for the complete tool list and package commands.

Cloud rollout boundary

The bridge and package contract do not imply production device registration is enabled. Linux linux / linux-connector registration is currently a development-only cloud gate, and the API platform normalizer must recognize linux-client before Linux-specific routing and telemetry are available.

On this page