devtools.DevToolsBridge
DevTools bridge implementation managing lifecycle telemetry, ring-buffered events, and sandboxed inspection for Chrome DevTools MCP and browser environments.
new DevToolsBridge(options?)
| Name | Type |
|---|---|
options? |
DevToolsOptions |
Private eventBuffer: DevToolsEvent[] = []
Private metrics: DevToolsPerformanceMetrics
Private options: Required<DevToolsOptions>
Private registeredTargets: Map<string, object>
Private targetIdCounter: number = 0
Private targetNames: WeakMap<object, string>
Private unregisterHooks: null | () => void = null
clearEventBuffer(): void
Clears all buffered events from the DevTools ring buffer.
void
connect(options?): () => void
Connects the DevTools bridge to @banksia/signals observability lifecycle hooks.
| Name | Type | Description |
|---|---|---|
options? |
DevToolsOptions |
Optional override configuration options. |
fn
An unsubscribe function to disconnect the DevTools bridge.
(): void
Connects the DevTools bridge to @banksia/signals observability lifecycle hooks.
void
An unsubscribe function to disconnect the DevTools bridge.
Example
Example
disconnect(): void
Disconnects the DevTools bridge and releases all registered lifecycle hooks.
void
getPerformanceMetrics(): DevToolsPerformanceMetrics
Retrieves current aggregate performance and profiling metrics.
The DevToolsPerformanceMetrics descriptor.
getRecentEvents(options?): DevToolsEvent[]
Retrieves recent telemetry events from the ring buffer.
| Name | Type | Description |
|---|---|---|
options? |
GetRecentEventsOptions |
Filtering and limit options. |
Array of DevToolsEvent items matching query.
getRecentMutations(limit?): DevToolsMutationEvent[]
Convenience helper to retrieve recent mutation events.
| Name | Type | Description |
|---|---|---|
limit? |
number |
Maximum number of mutation events to return. |
Array of DevToolsMutationEvent items.
inspectGraph(targetOrName?): DependencyGraphNode | Record<string, DependencyGraphNode>
Inspects the reactive dependency graph for a specific target or across all registered targets.
| Name | Type | Description |
|---|---|---|
targetOrName? |
string | object |
Optional target object or registered name. If omitted, returns graphs for all registered targets. |
DependencyGraphNode | Record<string, DependencyGraphNode>
The DependencyGraphNode for the target, or a record mapping target IDs to their graph nodes.
inspectState(targetOrName): null | Record<string, unknown>
Safely inspects the reactive state of a target object in an untracked, sandboxed execution context.
| Name | Type | Description |
|---|---|---|
targetOrName |
string | object |
The registered name or target object to inspect. |
null | Record<string, unknown>
A key-value snapshot of target properties with private values sanitized, or null.
inspectTarget(targetOrName): null | DevToolsTargetInspection
Inspects a registered target or reactive object, returning a full snapshot of state and dependency graph.
| Name | Type | Description |
|---|---|---|
targetOrName |
string | object |
The registered target name or object instance to inspect. |
null | DevToolsTargetInspection
A DevToolsTargetInspection object, or null if target is not found.
Remarks
All state reads are performed in an isolated, untracked sandbox (pushActiveSubscriber(null)),
ensuring that DevTools inspections do not pollute active reactivity contexts or create phantom dependencies.
isConnected(): boolean
Returns whether the DevTools bridge is currently active and capturing telemetry.
boolean
true if connected; otherwise false.
listRegisteredTargets(): { id: string ; name: string ; properties: string[] }[]
Lists all currently registered reactive target objects and stores.
{ id: string ; name: string ; properties: string[] }[]
Array of target descriptors with metadata and available property keys.
Private pushEvent(event): void
| Name | Type |
|---|---|
event |
DevToolsEvent |
void
registerTarget(target, name?): () => void
Explicitly registers a reactive target object, domain model, or store for indexing and inspection.
| Name | Type | Description |
|---|---|---|
target |
object |
The reactive object or store instance to register. |
name? |
string |
Optional diagnostic name or ID for indexing. |
fn
An unregister function to remove the target from registry.
(): void
Explicitly registers a reactive target object, domain model, or store for indexing and inspection.
void
An unregister function to remove the target from registry.
Example
Example
resetPerformanceMetrics(): void
Resets all accumulated performance metrics to zero.
void
Private sanitizeValue(val): unknown
| Name | Type |
|---|---|
val |
unknown |
unknown
unregisterTarget(targetOrName): void
Unregisters a previously registered reactive target object.
| Name | Type | Description |
|---|---|---|
targetOrName |
string | object |
The target instance or registered name to remove. |
void