import { pageMetadata } from "@/lib/page-metadata"
export const metadata = pageMetadata("docs/api/devtools")
# @json-render/devtools
Framework-agnostic core for the json-render devtools — vanilla TS panel UI, event store, DOM picker, and stream tap utilities. Every framework-specific adapter package depends on this.
Most users never import from this package directly. Pick the adapter that matches your renderer (`@json-render/devtools-react`, `@json-render/devtools-vue`, etc.) and drop the `` component into your app.
See the [Devtools guide](/docs/devtools) for the drop-in walkthrough.
## Event Store
### createEventStore
```ts
function createEventStore(options?: { bufferSize?: number }): EventStore
interface EventStore {
push: (event: DevtoolsEvent) => void;
snapshot: () => DevtoolsEvent[];
subscribe: (listener: () => void) => () => void;
clear: () => void;
size: () => number;
}
```
Ring-buffered pub/sub of `DevtoolsEvent`. Shared by every panel and every stream tap.
## Panel
### createPanel
```ts
function createPanel(options: PanelOptions): PanelHandle
interface PanelHandle {
open: () => void;
close: () => void;
toggle: () => void;
isOpen: () => boolean;
refresh: () => void;
destroy: () => void;
}
```
Mount the panel into a host document. Adapters call this internally.
### Panel tabs
Each tab is a factory function that returns a `TabDef`:
```ts
import {
specTab,
stateTab,
actionsTab,
streamTab,
catalogTab,
pickerTab,
} from "@json-render/devtools";
```
## Stream Taps
### tapJsonRenderStream
```ts
function tapJsonRenderStream(
stream: ReadableStream,
events: EventStore,
): ReadableStream
```
Mirror the spec patches flowing through a `pipeJsonRender` transform into a devtools event store. Returns the original stream unchanged — the tap just forks a copy.
### tapYamlStream
```ts
function tapYamlStream(
stream: ReadableStream,
events: EventStore,
): ReadableStream
```
YAML equivalent of `tapJsonRenderStream`.
### scanMessageParts
```ts
function scanMessageParts(
parts: readonly DataPart[] | undefined,
events: EventStore,
seen: WeakSet