@three-flatland/devtools 0.1.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +82 -0
- package/dist/buffers-modal.cjs +491 -0
- package/dist/buffers-modal.cjs.map +1 -0
- package/dist/buffers-modal.d.cts +62 -0
- package/dist/buffers-modal.d.ts +62 -0
- package/dist/buffers-modal.js +467 -0
- package/dist/buffers-modal.js.map +1 -0
- package/dist/buffers-view.cjs +269 -0
- package/dist/buffers-view.cjs.map +1 -0
- package/dist/buffers-view.d.cts +39 -0
- package/dist/buffers-view.d.ts +39 -0
- package/dist/buffers-view.js +245 -0
- package/dist/buffers-view.js.map +1 -0
- package/dist/create-pane.cjs +203 -0
- package/dist/create-pane.cjs.map +1 -0
- package/dist/create-pane.d.cts +66 -0
- package/dist/create-pane.d.ts +66 -0
- package/dist/create-pane.js +178 -0
- package/dist/create-pane.js.map +1 -0
- package/dist/dashboard/app.tsx +42 -0
- package/dist/dashboard/client.ts +21 -0
- package/dist/dashboard/export.ts +84 -0
- package/dist/dashboard/hooks.ts +75 -0
- package/dist/dashboard/index.html +1149 -0
- package/dist/dashboard/index.tsx +18 -0
- package/dist/dashboard/panels/batches.tsx +282 -0
- package/dist/dashboard/panels/buffers.tsx +425 -0
- package/dist/dashboard/panels/env.tsx +85 -0
- package/dist/dashboard/panels/header-stats.tsx +30 -0
- package/dist/dashboard/panels/producer-select.tsx +81 -0
- package/dist/dashboard/panels/protocol-log.tsx +743 -0
- package/dist/dashboard/panels/registry.tsx +642 -0
- package/dist/dashboard/panels/stats.tsx +431 -0
- package/dist/dashboard/protocol-store.ts +312 -0
- package/dist/dashboard/tsconfig.json +19 -0
- package/dist/dashboard/vendor/hooks.module.js +1 -0
- package/dist/dashboard/vendor/jsx-runtime.js +22 -0
- package/dist/dashboard/vendor/preact.module.js +12 -0
- package/dist/devtools-client.cjs +870 -0
- package/dist/devtools-client.cjs.map +1 -0
- package/dist/devtools-client.d.cts +362 -0
- package/dist/devtools-client.d.ts +362 -0
- package/dist/devtools-client.js +852 -0
- package/dist/devtools-client.js.map +1 -0
- package/dist/index.cjs +42 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/perf-trace.cjs +103 -0
- package/dist/perf-trace.cjs.map +1 -0
- package/dist/perf-trace.d.cts +27 -0
- package/dist/perf-trace.d.ts +27 -0
- package/dist/perf-trace.js +79 -0
- package/dist/perf-trace.js.map +1 -0
- package/dist/plugins.cjs +44 -0
- package/dist/plugins.cjs.map +1 -0
- package/dist/plugins.d.cts +7 -0
- package/dist/plugins.d.ts +7 -0
- package/dist/plugins.js +9 -0
- package/dist/plugins.js.map +1 -0
- package/dist/provider-switcher.cjs +95 -0
- package/dist/provider-switcher.cjs.map +1 -0
- package/dist/provider-switcher.d.cts +18 -0
- package/dist/provider-switcher.d.ts +18 -0
- package/dist/provider-switcher.js +71 -0
- package/dist/provider-switcher.js.map +1 -0
- package/dist/react/devtools-provider.cjs +59 -0
- package/dist/react/devtools-provider.cjs.map +1 -0
- package/dist/react/devtools-provider.d.cts +39 -0
- package/dist/react/devtools-provider.d.ts +39 -0
- package/dist/react/devtools-provider.js +38 -0
- package/dist/react/devtools-provider.js.map +1 -0
- package/dist/react/use-fps-graph.cjs +49 -0
- package/dist/react/use-fps-graph.cjs.map +1 -0
- package/dist/react/use-fps-graph.d.cts +15 -0
- package/dist/react/use-fps-graph.d.ts +15 -0
- package/dist/react/use-fps-graph.js +25 -0
- package/dist/react/use-fps-graph.js.map +1 -0
- package/dist/react/use-pane-button.cjs +58 -0
- package/dist/react/use-pane-button.cjs.map +1 -0
- package/dist/react/use-pane-button.d.cts +10 -0
- package/dist/react/use-pane-button.d.ts +10 -0
- package/dist/react/use-pane-button.js +34 -0
- package/dist/react/use-pane-button.js.map +1 -0
- package/dist/react/use-pane-folder.cjs +48 -0
- package/dist/react/use-pane-folder.cjs.map +1 -0
- package/dist/react/use-pane-folder.d.cts +15 -0
- package/dist/react/use-pane-folder.d.ts +15 -0
- package/dist/react/use-pane-folder.js +24 -0
- package/dist/react/use-pane-folder.js.map +1 -0
- package/dist/react/use-pane-input.cjs +70 -0
- package/dist/react/use-pane-input.cjs.map +1 -0
- package/dist/react/use-pane-input.d.cts +44 -0
- package/dist/react/use-pane-input.d.ts +44 -0
- package/dist/react/use-pane-input.js +46 -0
- package/dist/react/use-pane-input.js.map +1 -0
- package/dist/react/use-pane-radio-grid.cjs +78 -0
- package/dist/react/use-pane-radio-grid.cjs.map +1 -0
- package/dist/react/use-pane-radio-grid.d.cts +35 -0
- package/dist/react/use-pane-radio-grid.d.ts +35 -0
- package/dist/react/use-pane-radio-grid.js +54 -0
- package/dist/react/use-pane-radio-grid.js.map +1 -0
- package/dist/react/use-pane.cjs +45 -0
- package/dist/react/use-pane.cjs.map +1 -0
- package/dist/react/use-pane.d.cts +40 -0
- package/dist/react/use-pane.d.ts +40 -0
- package/dist/react/use-pane.js +21 -0
- package/dist/react/use-pane.js.map +1 -0
- package/dist/react.cjs +50 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +12 -0
- package/dist/react.d.ts +12 -0
- package/dist/react.js +19 -0
- package/dist/react.js.map +1 -0
- package/dist/registry-view.cjs +371 -0
- package/dist/registry-view.cjs.map +1 -0
- package/dist/registry-view.d.cts +24 -0
- package/dist/registry-view.d.ts +24 -0
- package/dist/registry-view.js +347 -0
- package/dist/registry-view.js.map +1 -0
- package/dist/stats-graph.cjs +297 -0
- package/dist/stats-graph.cjs.map +1 -0
- package/dist/stats-graph.d.cts +40 -0
- package/dist/stats-graph.d.ts +40 -0
- package/dist/stats-graph.js +273 -0
- package/dist/stats-graph.js.map +1 -0
- package/dist/stats-row.cjs +153 -0
- package/dist/stats-row.cjs.map +1 -0
- package/dist/stats-row.d.cts +24 -0
- package/dist/stats-row.d.ts +24 -0
- package/dist/stats-row.js +129 -0
- package/dist/stats-row.js.map +1 -0
- package/dist/theme.cjs +260 -0
- package/dist/theme.cjs.map +1 -0
- package/dist/theme.d.cts +10 -0
- package/dist/theme.d.ts +10 -0
- package/dist/theme.js +235 -0
- package/dist/theme.js.map +1 -0
- package/dist/vite-plugin.cjs +113 -0
- package/dist/vite-plugin.cjs.map +1 -0
- package/dist/vite-plugin.d.cts +9 -0
- package/dist/vite-plugin.d.ts +9 -0
- package/dist/vite-plugin.js +88 -0
- package/dist/vite-plugin.js.map +1 -0
- package/package.json +124 -0
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
import { RegistryEntryKind, TexturePixelType, BufferDisplayMode, ProviderIdentity, DebugFeature, BufferSubscriptionEntry, BufferChunkPayload, DebugMessage } from 'three-flatland/debug-protocol';
|
|
2
|
+
export { BufferChunkPayload } from 'three-flatland/debug-protocol';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Construction options for `DevtoolsClient`.
|
|
6
|
+
*/
|
|
7
|
+
interface DevtoolsClientOptions {
|
|
8
|
+
/** Features to subscribe to. */
|
|
9
|
+
features: DebugFeature[];
|
|
10
|
+
/**
|
|
11
|
+
* Override the discovery (bonjour) channel name. Rarely needed — only
|
|
12
|
+
* for isolated test sessions.
|
|
13
|
+
*/
|
|
14
|
+
discoveryChannelName?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Optional first listener, equivalent to calling `addListener(cb)`
|
|
17
|
+
* after construction.
|
|
18
|
+
*/
|
|
19
|
+
onChange?: (state: DevtoolsState) => void;
|
|
20
|
+
}
|
|
21
|
+
/** Listener signature for `DevtoolsClient.addListener`. */
|
|
22
|
+
type DevtoolsStateListener = (state: DevtoolsState) => void;
|
|
23
|
+
|
|
24
|
+
type BufferChunkListener = (chunk: BufferChunkPayload) => void;
|
|
25
|
+
/** Listener for raw protocol messages. Direction is `in` for messages
|
|
26
|
+
* received from the bus, `out` for messages the client posts. */
|
|
27
|
+
type RawMessageListener = (msg: DebugMessage, direction: 'in' | 'out') => void;
|
|
28
|
+
/** Per-field time-series ring. */
|
|
29
|
+
interface DevtoolsSeries {
|
|
30
|
+
/** Pre-allocated Float32 buffer. Read via (write - i - 1 + size) % size. */
|
|
31
|
+
readonly data: Float32Array;
|
|
32
|
+
/** Next write index. */
|
|
33
|
+
write: number;
|
|
34
|
+
/** Valid sample count (<= size). */
|
|
35
|
+
length: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Snapshot of a registered CPU array as seen by the client. The
|
|
39
|
+
* `sample` typed array is owned by this object (structured-cloned from
|
|
40
|
+
* the provider) — read-only by contract; don't mutate in place.
|
|
41
|
+
*/
|
|
42
|
+
interface RegistryEntrySnapshot {
|
|
43
|
+
name: string;
|
|
44
|
+
kind: RegistryEntryKind;
|
|
45
|
+
version: number;
|
|
46
|
+
count: number;
|
|
47
|
+
sample: Float32Array | Uint32Array | Int32Array;
|
|
48
|
+
label?: string;
|
|
49
|
+
}
|
|
50
|
+
/** Snapshot of a registered debug buffer as seen by the client. */
|
|
51
|
+
/**
|
|
52
|
+
* Client-side view of one render-pass event. Shallow copies of
|
|
53
|
+
* `PassEvent` from the wire — the provider reuses its scratch pool
|
|
54
|
+
* every frame, so we copy fields into fresh objects once on receive.
|
|
55
|
+
*/
|
|
56
|
+
interface BatchPassSnapshot {
|
|
57
|
+
label: string;
|
|
58
|
+
calls: number;
|
|
59
|
+
triangles: number;
|
|
60
|
+
cpuMs: number;
|
|
61
|
+
depth: number;
|
|
62
|
+
parent: number;
|
|
63
|
+
}
|
|
64
|
+
/** Client-side view of one batched-draw row. */
|
|
65
|
+
interface BatchSnapshot {
|
|
66
|
+
frame: number;
|
|
67
|
+
passes: BatchPassSnapshot[];
|
|
68
|
+
batches: Array<{
|
|
69
|
+
runKey: number;
|
|
70
|
+
materialId: number;
|
|
71
|
+
layer: number;
|
|
72
|
+
materialName: string;
|
|
73
|
+
spriteCount: number;
|
|
74
|
+
batchIdx: number;
|
|
75
|
+
/** Subsystem tag (e.g. `'sprite'`, `'tilechunk'`). Defaults to `'sprite'` on the client when absent. */
|
|
76
|
+
kind: string;
|
|
77
|
+
/** Per-batch label (e.g. `'chunk(0,2)'`). Empty string when the source didn't set one. */
|
|
78
|
+
label: string;
|
|
79
|
+
}>;
|
|
80
|
+
}
|
|
81
|
+
interface BufferSnapshot {
|
|
82
|
+
name: string;
|
|
83
|
+
/** Dimensions of the pixels currently stored in `pixels` — equal to
|
|
84
|
+
* source dims in stream mode, downsampled dims in thumbnail mode. */
|
|
85
|
+
width: number;
|
|
86
|
+
height: number;
|
|
87
|
+
/** Source (pre-downsample) dimensions — the "true" buffer size.
|
|
88
|
+
* Equals width/height in stream mode. */
|
|
89
|
+
srcWidth: number;
|
|
90
|
+
srcHeight: number;
|
|
91
|
+
pixelType: TexturePixelType;
|
|
92
|
+
/** How the consumer should visualise this buffer (defaults applied by producer). */
|
|
93
|
+
display: BufferDisplayMode;
|
|
94
|
+
version: number;
|
|
95
|
+
/** Latest CPU readback; `null` until the provider has served a sample. */
|
|
96
|
+
pixels: Uint8Array | Float32Array | null;
|
|
97
|
+
label?: string;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Accumulated state the consumer keeps up-to-date by merging deltas
|
|
101
|
+
* from `data` packets. Callers bind UI to this object and refresh
|
|
102
|
+
* when `onChange` fires.
|
|
103
|
+
*
|
|
104
|
+
* All fields start `undefined`; the first `data` packet (or
|
|
105
|
+
* `subscribe:ack.env` bootstrap) populates them. Subsequent deltas
|
|
106
|
+
* overwrite specific fields; `null` on the wire clears a field back
|
|
107
|
+
* to `undefined`.
|
|
108
|
+
*/
|
|
109
|
+
interface DevtoolsState {
|
|
110
|
+
/** Engine frame counter — last frame index covered by the latest batch. */
|
|
111
|
+
frame?: number;
|
|
112
|
+
drawCalls?: number;
|
|
113
|
+
triangles?: number;
|
|
114
|
+
/** Lines + points aggregated. */
|
|
115
|
+
primitives?: number;
|
|
116
|
+
geometries?: number;
|
|
117
|
+
textures?: number;
|
|
118
|
+
cpuMs?: number;
|
|
119
|
+
fps?: number;
|
|
120
|
+
gpuMs?: number;
|
|
121
|
+
/** JS heap used, MB. `undefined` on Safari / Firefox. */
|
|
122
|
+
heapUsedMB?: number;
|
|
123
|
+
/** JS heap limit, MB. Static per environment. */
|
|
124
|
+
heapLimitMB?: number;
|
|
125
|
+
series: {
|
|
126
|
+
fps: DevtoolsSeries;
|
|
127
|
+
cpuMs: DevtoolsSeries;
|
|
128
|
+
gpuMs: DevtoolsSeries;
|
|
129
|
+
heapUsedMB: DevtoolsSeries;
|
|
130
|
+
drawCalls: DevtoolsSeries;
|
|
131
|
+
triangles: DevtoolsSeries;
|
|
132
|
+
primitives: DevtoolsSeries;
|
|
133
|
+
geometries: DevtoolsSeries;
|
|
134
|
+
textures: DevtoolsSeries;
|
|
135
|
+
};
|
|
136
|
+
threeFlatlandVersion?: string;
|
|
137
|
+
threeRevision?: string;
|
|
138
|
+
backendName?: string;
|
|
139
|
+
backendTrackTimestamp?: boolean;
|
|
140
|
+
backendDisjoint?: boolean | null;
|
|
141
|
+
gpuModeEnabled?: boolean;
|
|
142
|
+
canvasWidth?: number;
|
|
143
|
+
canvasHeight?: number;
|
|
144
|
+
canvasPixelRatio?: number;
|
|
145
|
+
/**
|
|
146
|
+
* Named CPU arrays the provider has registered. Entries update on the
|
|
147
|
+
* `registry` feature of each data batch; keys are entry names, values
|
|
148
|
+
* are the latest sample + metadata. Removed entries are pruned.
|
|
149
|
+
*/
|
|
150
|
+
registry: Map<string, RegistryEntrySnapshot>;
|
|
151
|
+
/**
|
|
152
|
+
* Named debug buffers — same lifecycle as `registry`, but backed by
|
|
153
|
+
* periodic GPU readbacks through the `buffers` feature. `pixels` is
|
|
154
|
+
* `null` until the provider has delivered a sample (metadata arrives
|
|
155
|
+
* first so the UI can list the entry for selection).
|
|
156
|
+
*/
|
|
157
|
+
buffers: Map<string, BufferSnapshot>;
|
|
158
|
+
/**
|
|
159
|
+
* Most recent batch inspector snapshot — per-pass draw events + active
|
|
160
|
+
* batch registry contents. Client stores shallow copies of the arrays
|
|
161
|
+
* so subsequent bus messages don't mutate UI state under a render.
|
|
162
|
+
*/
|
|
163
|
+
batches: BatchSnapshot;
|
|
164
|
+
/** All providers currently announced on the bus (updated live). */
|
|
165
|
+
providers: ProviderIdentity[];
|
|
166
|
+
/** The provider this client is subscribed to. `null` until discovery picks one. */
|
|
167
|
+
selectedProviderId: string | null;
|
|
168
|
+
/** Is the selected provider considered alive? False after `SERVER_LIVENESS_MS` silence. */
|
|
169
|
+
serverAlive: boolean;
|
|
170
|
+
/** ms since the last message from the selected provider. */
|
|
171
|
+
serverLagMs: number;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Bus consumer. One per viewing surface (tweakpane panel, pop-out
|
|
175
|
+
* window, remote dashboard). Owns:
|
|
176
|
+
*
|
|
177
|
+
* - A stable consumer id (UUID v4).
|
|
178
|
+
* - A `BroadcastChannel` subscription.
|
|
179
|
+
* - Accumulated `DevtoolsState` derived from `data` packet deltas.
|
|
180
|
+
* - Ack timer (1 s, starts on `subscribe:ack`).
|
|
181
|
+
* - Server-liveness monitor; re-subscribes if no server message
|
|
182
|
+
* within `SERVER_LIVENESS_MS`.
|
|
183
|
+
*
|
|
184
|
+
* Call `start()` to send the initial subscribe + begin timers.
|
|
185
|
+
* `dispose()` sends unsubscribe, clears timers, closes the channel.
|
|
186
|
+
*/
|
|
187
|
+
declare class DevtoolsClient {
|
|
188
|
+
readonly id: string;
|
|
189
|
+
readonly state: DevtoolsState;
|
|
190
|
+
/** Shared discovery bus — carries query/announce/gone only. */
|
|
191
|
+
private _discoveryBus;
|
|
192
|
+
/** Per-provider data bus. Opened when we subscribe; closed on switch / gone. */
|
|
193
|
+
private _dataBus;
|
|
194
|
+
/** Bound handler for the current `_dataBus`. Tracked so we can detach on close. */
|
|
195
|
+
private _dataHandler;
|
|
196
|
+
private _features;
|
|
197
|
+
/**
|
|
198
|
+
* Registry entry filter. `null` = all entries; `string[]` = only
|
|
199
|
+
* these. Starts empty-array so providers don't drain (sometimes
|
|
200
|
+
* expensive) registry payloads until the pane actually needs them.
|
|
201
|
+
*/
|
|
202
|
+
private _registrySelection;
|
|
203
|
+
/**
|
|
204
|
+
* Buffer subscription. Map of entry-name → { mode, thumbSize? }.
|
|
205
|
+
* Empty map = metadata-only (consumer is connected to the `buffers`
|
|
206
|
+
* feature but isn't actually watching anything — provider skips all
|
|
207
|
+
* readbacks). `null` is not a distinct state; represented by `{}`.
|
|
208
|
+
*/
|
|
209
|
+
private _buffersSelection;
|
|
210
|
+
private _listeners;
|
|
211
|
+
private _chunkListeners;
|
|
212
|
+
private _rawMessageListeners;
|
|
213
|
+
private _ackTimer;
|
|
214
|
+
private _livenessTimer;
|
|
215
|
+
private _queryRetryTimer;
|
|
216
|
+
private _lastServerAt;
|
|
217
|
+
private _subscribed;
|
|
218
|
+
private _disposed;
|
|
219
|
+
/** Known providers by id — updated live via `provider:announce` + `provider:gone`. */
|
|
220
|
+
private _providers;
|
|
221
|
+
constructor(options: DevtoolsClientOptions);
|
|
222
|
+
/**
|
|
223
|
+
* Begin discovery + subscription. Sends a `provider:query`, waits
|
|
224
|
+
* `DISCOVERY_WINDOW_MS` for `provider:announce` responses, then picks
|
|
225
|
+
* the best provider (user > system) and subscribes to it.
|
|
226
|
+
*
|
|
227
|
+
* Idempotent — calling again while already started is a no-op.
|
|
228
|
+
*/
|
|
229
|
+
start(): void;
|
|
230
|
+
private _sendQuery;
|
|
231
|
+
/**
|
|
232
|
+
* Update the feature set. Re-posts `subscribe` on the current
|
|
233
|
+
* provider's data channel.
|
|
234
|
+
*/
|
|
235
|
+
setFeatures(features: DebugFeature[]): void;
|
|
236
|
+
/**
|
|
237
|
+
* Update the registry entry filter. Pass `null` for "every entry",
|
|
238
|
+
* `[]` to stop all registry traffic, or a list of names to narrow.
|
|
239
|
+
* Re-posts `subscribe` if the filter actually changed.
|
|
240
|
+
*/
|
|
241
|
+
/**
|
|
242
|
+
* Narrow which registry entries the provider should ship samples
|
|
243
|
+
* for. `null` = all entries; `[]` = none; `[name, …]` = only these.
|
|
244
|
+
* Metadata still flows regardless — only sample bytes are gated.
|
|
245
|
+
*/
|
|
246
|
+
setRegistry(names: string[] | null): void;
|
|
247
|
+
/**
|
|
248
|
+
* Update the buffer subscription. Map of entry-name → (mode, thumbSize?).
|
|
249
|
+
* - Empty map / missing names → metadata-only (provider sends no pixels,
|
|
250
|
+
* runs no readbacks). This is the idle state when no preview or
|
|
251
|
+
* modal is visible.
|
|
252
|
+
* - `{ name: { mode: 'thumbnail', thumbSize: 256 } }` → small
|
|
253
|
+
* downsampled preview. Use when a thumbnail card is visible.
|
|
254
|
+
* - `{ name: { mode: 'stream' } }` → full-size VP9 video stream.
|
|
255
|
+
* Use when the fullscreen modal is open.
|
|
256
|
+
*
|
|
257
|
+
* Mode changes (incl. unsubscribing) take effect on the next
|
|
258
|
+
* provider flush; the producer will drop old readbacks immediately.
|
|
259
|
+
*/
|
|
260
|
+
setBuffers(subscription: Record<string, BufferSubscriptionEntry>): void;
|
|
261
|
+
private _resubscribe;
|
|
262
|
+
/**
|
|
263
|
+
* Manually switch to a different provider. No-op if unknown or if
|
|
264
|
+
* already selected. Closes the old data channel and opens the new one.
|
|
265
|
+
*/
|
|
266
|
+
selectProvider(providerId: string): void;
|
|
267
|
+
dispose(): void;
|
|
268
|
+
/**
|
|
269
|
+
* Open a fresh per-provider data channel and start listening on it.
|
|
270
|
+
* Caller is responsible for posting the initial `subscribe`.
|
|
271
|
+
*/
|
|
272
|
+
private _joinDataChannel;
|
|
273
|
+
/**
|
|
274
|
+
* Send `unsubscribe` (if we have someone to tell) and close the data
|
|
275
|
+
* channel. Idempotent — safe to call when there's no active channel.
|
|
276
|
+
*/
|
|
277
|
+
private _leaveDataChannel;
|
|
278
|
+
/**
|
|
279
|
+
* Handler for the shared discovery bus. Only discovery messages land
|
|
280
|
+
* here by protocol; anything else is ignored.
|
|
281
|
+
*/
|
|
282
|
+
private _onDiscoveryMessage;
|
|
283
|
+
/**
|
|
284
|
+
* Handler for the per-provider data channel. Everything here is
|
|
285
|
+
* already implicitly addressed to us (we opened the channel with the
|
|
286
|
+
* provider's id), so no per-message filtering is required beyond
|
|
287
|
+
* matching our consumer `id` on `subscribe:ack`.
|
|
288
|
+
*/
|
|
289
|
+
private _onDataMessage;
|
|
290
|
+
private _markServerAlive;
|
|
291
|
+
/**
|
|
292
|
+
* Pick the best provider from the currently-known set and subscribe
|
|
293
|
+
* to it. Preference: `user` over `system`; first-announced as
|
|
294
|
+
* tiebreak. No-op if zero providers are known (we'll stay waiting;
|
|
295
|
+
* any future `provider:announce` that arrives doesn't auto-trigger
|
|
296
|
+
* this — call it again or restart discovery).
|
|
297
|
+
*/
|
|
298
|
+
private _pickProviderAndSubscribe;
|
|
299
|
+
/** Clear all feature-derived state so the next data packet can start fresh. */
|
|
300
|
+
private _resetAccumulatedState;
|
|
301
|
+
/**
|
|
302
|
+
* Apply a stats batch. Null = reset (feature cleared / provider gone).
|
|
303
|
+
* Otherwise: decode each typed array onto the matching Float32 ring
|
|
304
|
+
* and update the scalar with the batch mean (natural smoothing for
|
|
305
|
+
* the text label).
|
|
306
|
+
*/
|
|
307
|
+
private _applyStats;
|
|
308
|
+
/**
|
|
309
|
+
* Append `count` samples from a scaled integer view to a Float32 ring;
|
|
310
|
+
* return the batch mean (scaled). Zero-alloc past the ring itself.
|
|
311
|
+
*/
|
|
312
|
+
private _ingestI16;
|
|
313
|
+
private _ingestU16;
|
|
314
|
+
private _ingestU32;
|
|
315
|
+
/**
|
|
316
|
+
* Apply a batches feature payload — replaces the snapshot wholesale.
|
|
317
|
+
* The wire arrays are scratch pools on the producer; we truncate by
|
|
318
|
+
* the provided counts and copy fields into persistent snapshot
|
|
319
|
+
* objects the UI can hold across subsequent frames.
|
|
320
|
+
*
|
|
321
|
+
* The client-side snapshot arrays grow monotonically to the high
|
|
322
|
+
* watermark and entries are overwritten in place — same alloc
|
|
323
|
+
* discipline as the producer.
|
|
324
|
+
*/
|
|
325
|
+
private _applyBatches;
|
|
326
|
+
/**
|
|
327
|
+
* Apply a registry delta. `entries[name] === null` → remove;
|
|
328
|
+
* `entries[name]` present → upsert a snapshot keyed by `name`.
|
|
329
|
+
* A `null` batch (feature cleared) drops every entry.
|
|
330
|
+
*/
|
|
331
|
+
private _applyRegistry;
|
|
332
|
+
/**
|
|
333
|
+
* Apply a buffers delta. Metadata (width/height/version/pixelType)
|
|
334
|
+
* ships regardless of the client's selection; `pixels` only arrives
|
|
335
|
+
* when this entry is in the current selection. Retain the previous
|
|
336
|
+
* `pixels` when the delta is metadata-only so the UI keeps showing
|
|
337
|
+
* the last thumbnail while browsing.
|
|
338
|
+
*/
|
|
339
|
+
private _applyBuffers;
|
|
340
|
+
private _applyEnv;
|
|
341
|
+
private _checkLiveness;
|
|
342
|
+
private _sendAck;
|
|
343
|
+
private _postDiscovery;
|
|
344
|
+
private _postData;
|
|
345
|
+
private _fireRawMessage;
|
|
346
|
+
/** Subscribe to state-change events. Returns an unsubscribe function. */
|
|
347
|
+
addListener(cb: DevtoolsStateListener): () => void;
|
|
348
|
+
/** Explicit remove — equivalent to calling the unsubscribe returned from `addListener`. */
|
|
349
|
+
removeListener(cb: DevtoolsStateListener): void;
|
|
350
|
+
/** Subscribe to incoming WebCodecs buffer chunks. Returns an unsubscribe function. */
|
|
351
|
+
addChunkListener(cb: BufferChunkListener): () => void;
|
|
352
|
+
/**
|
|
353
|
+
* Subscribe to every bus message — both inbound (from providers) and
|
|
354
|
+
* outbound (our own `subscribe`/`ack`/etc.). Used by the dashboard's
|
|
355
|
+
* protocol-log panel. Listeners fire on the hot path so keep them
|
|
356
|
+
* cheap — filter and format lazily.
|
|
357
|
+
*/
|
|
358
|
+
addRawMessageListener(cb: RawMessageListener): () => void;
|
|
359
|
+
private _fire;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export { type BatchPassSnapshot, type BatchSnapshot, type BufferChunkListener, type BufferSnapshot, DevtoolsClient, type DevtoolsClientOptions, type DevtoolsSeries, type DevtoolsState, type DevtoolsStateListener, type RawMessageListener, type RegistryEntrySnapshot };
|