Skip to content
GitHubXDiscord

@triggery/devtools-bridge

Page-side bridge that makes a Triggery runtime observable to external tools — the Chrome extension, a future standalone web panel, custom inspectors, anything that can listen to window.postMessage. Framework-agnostic, zero runtime dependencies, returns a no-op in Node / SSR.

npm bundle

pnpm add @triggery/core @triggery/devtools-bridge

Peer deps: @triggery/core.

ExportPurpose
installDevtoolsBridge(runtime)Attach the page-side bridge to a runtime. Returns a dispose() callback.
import { createRuntime } from '@triggery/core';
import { installDevtoolsBridge } from '@triggery/devtools-bridge';

const runtime = createRuntime();

if (import.meta.env.DEV) {
  installDevtoolsBridge(runtime);
}

That’s it. The bridge:

  1. Exposes a discovery handle on window.__triggery_devtools__ so tools can detect the runtime.
  2. Broadcasts a triggery:hello postMessage with the current graph() + inspector buffer.
  3. Subscribes to the runtime and broadcasts a triggery:snapshot for every new run.
  4. On dispose(), removes the discovery handle and broadcasts a triggery:bye.

In Node / SSR installDevtoolsBridge returns a no-op disposer.

{ source: 'triggery-devtools', type: 'triggery:hello',    runtimeId, graph, buffer, at }
{ source: 'triggery-devtools', type: 'triggery:snapshot', runtimeId, snapshot,     at }
{ source: 'triggery-devtools', type: 'triggery:bye',      runtimeId,               at }