Skip to content

API reference > @kontsedal/olas-devtools > DevtoolsStore

DevtoolsStore class ​

Subscribes to a root's debug bus and maintains live state for the devtools panel. Exposes signals so the React layer can consume them via@kontsedal/olas-react's useValue().

Pure logic — no DOM, no React. Construct one per root. Applying one event costs O(1) plus O(path depth): nothing here scans the tree or a log.

Signature:

typescript
export declare class DevtoolsStore

Constructors ​

Constructor

Modifiers

Description

(constructor)(options)

Constructs a new instance of the DevtoolsStore class

Properties ​

Property

Modifiers

Type

Description

cache$

readonly

ReadSignal<CacheEntry[]>

The cache log: subscriptions, fetches, invalidations and gc, oldest first. Capped at maxEntries.

cacheState$

readonly

Signal<DebugCacheEntry[]>

Live cache-entry state for the inspector. Seeded fromroot.debug.queryEntries() on attach(), then refreshed (coalesced) on every cache / snapshot event — NO polling. Empty until attached.

droppedEvents$

readonly

ReadSignal<number>

Timeline events the ring buffer overwrote since the last clearLogs().

events$

readonly

ReadSignal<TimelineEvent[]>

Unified causal timeline — every event, ordered by seq. A ring buffer.

fields$

readonly

ReadSignal<FieldEntry[]>

The field validation log, oldest first. Capped at maxEntries.

maxTimelineEntries

readonly

number

Capacity of the timeline ring buffer.

mutations$

readonly

ReadSignal<MutationEntry[]>

The mutation log: runs, successes, errors and rollbacks, oldest first. Capped at maxEntries.

subscribers$

readonly

ReadSignal<ReadonlyMap<string, number>>

Subscriptions per cache entry, keyed like the inspector (entryKey, query id and key). Kept from cache:subscribed / cache:unsubscribed, and re-seeded from each queryEntries() snapshot, so a panel attached after the controllers subscribed still counts them. An entry with none is absent.

tree$

readonly

ReadSignal<ControllerNode>

The live controller tree. Unchanged subtrees keep their object identity.

Methods ​

Method

Modifiers

Description

attach(root)

Subscribe to the given root's debug bus. Returns the unsubscribe. The caller (typically the React component) is responsible for invoking it on unmount.

clearLogs()

Clear every log AND the unified timeline, and reset the dropped count. Tree + live cache state are preserved — they reflect the current world, not a history.

flushPending()

Drain pending buffers into the signals. Public so tests can force a flush without waiting on rAF; production code shouldn't call this.

handle(event)

Apply one event. Exposed for tests.

isPaused()

Whether ingestion is currently paused.

pause()

Pause event ingestion. Recorded state is preserved; new events drop.

resume()

Resume event ingestion. Buffered events from before pause are NOT replayed.

search(query, limitPerKind)

Search controllers, live queries, mutations, form fields and event payloads for query (whitespace-separated terms, all must match, case-insensitive). The index is built on the first search after a change and reused until the next one, so typing costs no re-stringification.

searchStats()

Search-index diagnostics: how often it was built, and how many values it turned into text.

Released under the MIT License.