Skip to content

Browser Extension

The browser extension sends allowlisted site content snapshots to the local WebLayer daemon and applies the daemon's returned DOM commands. Chrome and Firefox use the same shared source with browser-specific manifests.

Build Development Extensions

make -C browser-extension

This creates browser-extension/dist/chrome and browser-extension/dist/firefox.

Load in Chrome

  1. Open chrome://extensions.
  2. Enable Developer mode.
  3. Choose Load unpacked.
  4. Select browser-extension/dist/chrome.

Load in Firefox

  1. Open about:debugging.
  2. Choose This Firefox.
  3. Choose Load Temporary Add-on.
  4. Select browser-extension/dist/firefox/manifest.json.

Daemon Contract

The extension captures content only through explicit site adapters. Unknown hosts, unknown page surfaces, and unknown DOM structures send nothing. The current adapter supports X.com and Twitter URLs for home, explore, search, and status pages, and it captures visible top-level article[data-testid="tweet"] post regions. X snapshots include observed post metadata such as post ID, author handle, visible order, and Replying to @... handles so the daemon can build the visible reply tree and decide any hide cascade. Quoted posts stay inside the captured post snapshot; nested quoted-post cards are not targeted as separate feedback regions.

The extension opens a WebSocket to:

GET ws://127.0.0.1:17891/v1/events

It sends DOM analysis events and receives command events. The daemon can push immediate pending commands, such as insertFeedbackControl, before local analysis finishes. When a final answer is already cached, the daemon can push final immediately without a pending event.

The REST endpoint remains available as a fallback and smoke-test path:

POST http://127.0.0.1:17891/v1/dom/analyze
Content-Type: application/json

The extension also sends user feedback to the daemon:

POST http://127.0.0.1:17891/v1/dom/feedback
Content-Type: application/json

Supported DOM command actions are keep, hide, dim, insertLabel, insertFeedbackControl, replaceText, and showDebugStats. The daemon emits showDebugStats only when X debug stats are enabled. On X pages the extension renders that payload in the right sidebar when the sidebar is available, with a link to the local daemon dashboard.

The extension decides only which site content surfaces may be captured. It does not make filtering decisions. The daemon interprets captured content and decides what commands to return.