@three-flatland/devtools 0.1.0-alpha.3 → 1.0.0-alpha.6

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