@uptimizr/sdk-core 0.1.2 → 0.3.0

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 (43) hide show
  1. package/dist/aggregation/aggregator.d.ts +62 -0
  2. package/dist/aggregation/aggregator.d.ts.map +1 -0
  3. package/dist/aggregation/aggregator.js +194 -0
  4. package/dist/aggregation/aggregator.js.map +1 -0
  5. package/dist/aggregation/index.d.ts +14 -0
  6. package/dist/aggregation/index.d.ts.map +1 -0
  7. package/dist/aggregation/index.js +11 -0
  8. package/dist/aggregation/index.js.map +1 -0
  9. package/dist/aggregation/math.d.ts +63 -0
  10. package/dist/aggregation/math.d.ts.map +1 -0
  11. package/dist/aggregation/math.js +118 -0
  12. package/dist/aggregation/math.js.map +1 -0
  13. package/dist/aggregation/snapshot.d.ts +123 -0
  14. package/dist/aggregation/snapshot.d.ts.map +1 -0
  15. package/dist/aggregation/snapshot.js +16 -0
  16. package/dist/aggregation/snapshot.js.map +1 -0
  17. package/dist/aggregationSink.d.ts +67 -0
  18. package/dist/aggregationSink.d.ts.map +1 -0
  19. package/dist/aggregationSink.js +110 -0
  20. package/dist/aggregationSink.js.map +1 -0
  21. package/dist/client.d.ts +22 -0
  22. package/dist/client.d.ts.map +1 -1
  23. package/dist/client.js +71 -3
  24. package/dist/client.js.map +1 -1
  25. package/dist/graphicsDiagnostics.d.ts +301 -0
  26. package/dist/graphicsDiagnostics.d.ts.map +1 -0
  27. package/dist/graphicsDiagnostics.js +409 -0
  28. package/dist/graphicsDiagnostics.js.map +1 -0
  29. package/dist/index.d.ts +6 -0
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +3 -0
  32. package/dist/index.js.map +1 -1
  33. package/dist/offloadProtocol.d.ts +52 -8
  34. package/dist/offloadProtocol.d.ts.map +1 -1
  35. package/dist/offloadWorker.js +38 -7
  36. package/dist/offloadWorker.js.map +1 -1
  37. package/dist/processor.d.ts +2 -0
  38. package/dist/processor.d.ts.map +1 -1
  39. package/dist/processor.js +1 -1
  40. package/dist/processor.js.map +1 -1
  41. package/dist/types.d.ts +39 -0
  42. package/dist/types.d.ts.map +1 -1
  43. package/package.json +2 -2
@@ -0,0 +1,409 @@
1
+ import { LIMITS } from "@uptimizr/schema";
2
+ const DEFAULT_MAX_ATTEMPTS = 20;
3
+ const DEFAULT_INTERVAL_MS = 250;
4
+ /**
5
+ * Wire a WebGPU `GPUDevice.lost` into a `graphics_diagnostic` (ADR 0021 part 2,
6
+ * `category: "device-lost"`). Engine-agnostic: every connector that can have a
7
+ * WebGPU device hands a device *getter* here, so the gating, severity mapping,
8
+ * length-cap, and event shape live in exactly one place.
9
+ *
10
+ * Behavior:
11
+ * - **Opt-in gate.** No-ops (nothing scheduled, nothing emitted) unless
12
+ * `ctx.config.captureGraphicsDiagnostics` is on. (Unlike `context_lost`, which is
13
+ * always-on; device loss is the richer opt-in diagnostic.)
14
+ * - **Async device init.** A WebGPU backend builds its device asynchronously
15
+ * (three's `renderer.init()` / first `renderAsync`, Babylon's `initAsync`), so
16
+ * the device is frequently `undefined` at collector `start()` time. We therefore
17
+ * take a *getter* and **poll** it (bounded by {@link WireGpuDeviceLostOptions})
18
+ * until the device appears, rather than reading once and silently giving up.
19
+ * - **Severity.** `info` when `reason === "destroyed"` (an expected, app-requested
20
+ * loss via `device.destroy()`); `fatal` otherwise (an unrequested loss —
21
+ * rendering cannot continue).
22
+ * - **Marker.** Emits a single discrete incident (no `count`): device loss is rare
23
+ * and decisive, so the high-fidelity marker is the right default here.
24
+ * - **Privacy.** The optional `message` is locally truncated to
25
+ * {@link LIMITS.maxGraphicsDiagnosticMessageLength} and rides through `ctx.emit`,
26
+ * which applies the client's `beforeSend` for deployer-owned redaction.
27
+ *
28
+ * Teardown is cooperative: pass an `isActive` predicate (typically `() => !stopped`).
29
+ * It is checked before each poll and again when `device.lost` resolves, so neither a
30
+ * pending poll nor a late device loss emits after the collector has stopped.
31
+ *
32
+ * @param ctx Collector context (config + `emit`).
33
+ * @param getDevice Returns the WebGPU device, or `undefined`/`null` while it is
34
+ * still initializing or on WebGL (where it never appears — a clean no-op). Must
35
+ * not throw; read the field defensively (optional chaining).
36
+ * @param isActive Returns `false` once the collector has been torn down.
37
+ * @param options Polling bounds (mainly for tests).
38
+ */
39
+ export function wireGpuDeviceLost(ctx, getDevice, isActive, options) {
40
+ if (!ctx.config.captureGraphicsDiagnostics)
41
+ return;
42
+ const maxAttempts = options?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS;
43
+ const intervalMs = options?.intervalMs ?? DEFAULT_INTERVAL_MS;
44
+ let attempts = 0;
45
+ const attach = (device) => {
46
+ const lost = device.lost;
47
+ if (!lost || typeof lost.then !== "function")
48
+ return;
49
+ void lost.then((info) => {
50
+ if (!isActive())
51
+ return;
52
+ const reason = typeof info?.reason === "string" ? info.reason : undefined;
53
+ const severity = reason === "destroyed" ? "info" : "fatal";
54
+ const rawMessage = typeof info?.message === "string" ? info.message : undefined;
55
+ const message = rawMessage
56
+ ? rawMessage.slice(0, LIMITS.maxGraphicsDiagnosticMessageLength)
57
+ : undefined;
58
+ ctx.emit({
59
+ type: "graphics_diagnostic",
60
+ severity,
61
+ category: "device-lost",
62
+ backend: "webgpu",
63
+ ...(message ? { message } : {}),
64
+ });
65
+ });
66
+ };
67
+ const poll = () => {
68
+ if (!isActive())
69
+ return;
70
+ const device = getDevice();
71
+ if (device) {
72
+ attach(device);
73
+ return;
74
+ }
75
+ // Device not ready yet (async backend init). Retry on a bounded schedule; the
76
+ // WebGL path never produces a device, so this simply exhausts and stops.
77
+ attempts += 1;
78
+ if (attempts >= maxAttempts)
79
+ return;
80
+ setTimeout(poll, intervalMs);
81
+ };
82
+ poll();
83
+ }
84
+ export function createDiagnosticRollup(emit) {
85
+ let count = 0;
86
+ let first;
87
+ let timer;
88
+ const flush = () => {
89
+ if (count === 0)
90
+ return;
91
+ emit(count, first);
92
+ count = 0;
93
+ first = undefined;
94
+ };
95
+ return {
96
+ record(value) {
97
+ if (count === 0)
98
+ first = value;
99
+ count += 1;
100
+ },
101
+ get count() {
102
+ return count;
103
+ },
104
+ flush,
105
+ start(intervalMs) {
106
+ timer = setInterval(flush, intervalMs);
107
+ },
108
+ stop() {
109
+ if (timer)
110
+ clearInterval(timer);
111
+ timer = undefined;
112
+ flush();
113
+ },
114
+ };
115
+ }
116
+ const DEFAULT_FLUSH_INTERVAL_MS = 30_000;
117
+ /**
118
+ * Wire WebGPU `uncapturederror` into a **rate-limited per-session rollup**
119
+ * (ADR 0021 part 2, decision 4 / ADR 0012). This is the highest-volume diagnostic,
120
+ * so the default — and only — emission is aggregated: a burst of errors becomes a
121
+ * single `graphics_diagnostic` carrying `count: N` plus the first message, never N
122
+ * discrete events. Shared and engine-agnostic so every connector (Babylon, three,
123
+ * …) hands a device *getter* here and the gating, subtype mapping, length-cap,
124
+ * aggregation, and flush cadence live in exactly one place.
125
+ *
126
+ * Behavior:
127
+ * - **Opt-in gate.** No-ops unless `ctx.config.captureGraphicsDiagnostics` is on.
128
+ * - **Async device init.** Polls the getter (bounded, same as {@link wireGpuDeviceLost})
129
+ * until the WebGPU device appears, so a backend that builds its device async
130
+ * (three `renderer.init()`/`renderAsync`, Babylon `initAsync`) isn't missed.
131
+ * - **Subtype.** `GPUOutOfMemoryError` → `out-of-memory` (`severity: error`);
132
+ * anything else → `validation` (`severity: warning`). The most severe category
133
+ * seen wins for the rollup; the first message is kept.
134
+ * - **Rollup.** Accumulates `count` + first `message` and flushes one event on a
135
+ * bounded interval and again at teardown; emits nothing if no error occurred.
136
+ * - **Privacy.** `message` is truncated to {@link LIMITS.maxGraphicsDiagnosticMessageLength}
137
+ * and rides through `ctx.emit` (so `beforeSend` applies); raw shader source is excluded.
138
+ *
139
+ * @returns A teardown function that removes the listener, clears the timer, and
140
+ * flushes any pending rollup. Connectors call it from `stop()`/dispose.
141
+ * @param getDevice Returns the WebGPU device, or `undefined`/`null` while it is
142
+ * still initializing or on WebGL (a clean no-op). Must not throw.
143
+ * @param isActive Returns `false` once the collector is torn down — nothing emits after.
144
+ */
145
+ export function wireGpuUncapturedError(ctx, getDevice, isActive, options) {
146
+ if (!ctx.config.captureGraphicsDiagnostics)
147
+ return () => { };
148
+ const maxAttempts = options?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS;
149
+ const intervalMs = options?.intervalMs ?? DEFAULT_INTERVAL_MS;
150
+ const flushIntervalMs = options?.flushIntervalMs ?? DEFAULT_FLUSH_INTERVAL_MS;
151
+ let attempts = 0;
152
+ let firstMessage;
153
+ let category = "validation";
154
+ let device;
155
+ let listener;
156
+ const rollup = createDiagnosticRollup((n, first) => {
157
+ const severity = category === "out-of-memory" ? "error" : "warning";
158
+ ctx.emit({
159
+ type: "graphics_diagnostic",
160
+ severity,
161
+ category,
162
+ backend: "webgpu",
163
+ count: n,
164
+ ...(first ? { message: first } : {}),
165
+ });
166
+ category = "validation";
167
+ });
168
+ const attach = (target) => {
169
+ if (typeof target.addEventListener !== "function")
170
+ return;
171
+ device = target;
172
+ listener = (e) => {
173
+ if (!isActive())
174
+ return;
175
+ const error = e?.error;
176
+ if (rollup.count === 0) {
177
+ const raw = typeof error?.message === "string" ? error.message : undefined;
178
+ firstMessage = raw ? raw.slice(0, LIMITS.maxGraphicsDiagnosticMessageLength) : undefined;
179
+ }
180
+ rollup.record(firstMessage);
181
+ if (error?.constructor?.name === "GPUOutOfMemoryError")
182
+ category = "out-of-memory";
183
+ };
184
+ target.addEventListener("uncapturederror", listener);
185
+ rollup.start(flushIntervalMs);
186
+ };
187
+ const poll = () => {
188
+ if (!isActive())
189
+ return;
190
+ const target = getDevice();
191
+ if (target) {
192
+ attach(target);
193
+ return;
194
+ }
195
+ attempts += 1;
196
+ if (attempts >= maxAttempts)
197
+ return;
198
+ setTimeout(poll, intervalMs);
199
+ };
200
+ poll();
201
+ return () => {
202
+ if (device && listener && typeof device.removeEventListener === "function") {
203
+ device.removeEventListener("uncapturederror", listener);
204
+ }
205
+ rollup.stop();
206
+ };
207
+ }
208
+ const DEFAULT_MAX_SHADER_INCIDENTS = 25;
209
+ /**
210
+ * Build a `graphics_diagnostic` for a shader compile/link **failure**. Pure and
211
+ * redaction-aware: the engine info log is the message (length-capped); raw shader
212
+ * `source` is appended **only** when the deployer opted in via `captureShaderSource`
213
+ * (ADR 0021 part 2 — source is application IP). Either way the result is capped to
214
+ * the schema limit and still rides through `beforeSend`.
215
+ */
216
+ export function buildShaderCompileDiagnostic(input) {
217
+ const log = input.infoLog?.trim() ?? "";
218
+ const includeSource = input.captureShaderSource && input.source ? input.source : "";
219
+ const raw = includeSource ? `${log}\n${includeSource}`.trim() : log;
220
+ const message = raw ? raw.slice(0, LIMITS.maxGraphicsDiagnosticMessageLength) : undefined;
221
+ return {
222
+ type: "graphics_diagnostic",
223
+ severity: "error",
224
+ category: "shader-compile",
225
+ ...(input.backend ? { backend: input.backend } : {}),
226
+ ...(message ? { message } : {}),
227
+ };
228
+ }
229
+ /**
230
+ * Capture WebGL shader compile and program link **failures** as
231
+ * `graphics_diagnostic` (`category: shader-compile`). Wraps the context's
232
+ * `compileShader`/`linkProgram`; on a failed status it reads the matching info log
233
+ * (and, when `captureShaderSource` is on, the shader source) and emits one capped,
234
+ * redactable diagnostic. Bounded per session so a build loop cannot flood ingestion.
235
+ *
236
+ * Opt-in: no-ops unless `ctx.config.captureGraphicsDiagnostics`. Returns a detach
237
+ * fn that restores the original methods.
238
+ */
239
+ export function wireGlShaderDiagnostics(ctx, gl, isActive, options) {
240
+ if (!ctx.config.captureGraphicsDiagnostics)
241
+ return () => { };
242
+ const max = options?.maxIncidents ?? DEFAULT_MAX_SHADER_INCIDENTS;
243
+ const backend = gl.LINK_STATUS != null ? "webgl2" : "webgl";
244
+ const wantSource = ctx.config.captureShaderSource;
245
+ let count = 0;
246
+ if (typeof gl.compileShader !== "function" || typeof gl.linkProgram !== "function")
247
+ return () => { };
248
+ const origCompile = gl.compileShader.bind(gl);
249
+ const origLink = gl.linkProgram.bind(gl);
250
+ const emit = (infoLog, source) => {
251
+ if (!isActive() || count >= max)
252
+ return;
253
+ count += 1;
254
+ ctx.emit(buildShaderCompileDiagnostic({
255
+ backend,
256
+ captureShaderSource: wantSource,
257
+ ...(infoLog ? { infoLog } : {}),
258
+ ...(source ? { source } : {}),
259
+ }));
260
+ };
261
+ gl.compileShader = function (shader) {
262
+ origCompile(shader);
263
+ if (!isActive())
264
+ return;
265
+ if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
266
+ const source = wantSource && gl.getShaderSource ? gl.getShaderSource(shader) : undefined;
267
+ emit(gl.getShaderInfoLog(shader), source ?? undefined);
268
+ }
269
+ };
270
+ gl.linkProgram = function (program) {
271
+ origLink(program);
272
+ if (!isActive())
273
+ return;
274
+ if (!gl.getProgramParameter(program, gl.LINK_STATUS))
275
+ emit(gl.getProgramInfoLog(program));
276
+ };
277
+ return () => {
278
+ gl.compileShader = origCompile;
279
+ gl.linkProgram = origLink;
280
+ };
281
+ }
282
+ /**
283
+ * Capture WebGPU shader-module compile errors as `graphics_diagnostic`
284
+ * (`category: shader-compile`). Wraps `device.createShaderModule` and inspects the
285
+ * module's async `compilationInfo()` for `error` messages. Source (`descriptor.code`)
286
+ * is included only when `captureShaderSource` is on. Opt-in + bounded; returns detach.
287
+ */
288
+ export function wireGpuShaderDiagnostics(ctx, device, isActive, options) {
289
+ if (!ctx.config.captureGraphicsDiagnostics)
290
+ return () => { };
291
+ const max = options?.maxIncidents ?? DEFAULT_MAX_SHADER_INCIDENTS;
292
+ const wantSource = ctx.config.captureShaderSource;
293
+ let count = 0;
294
+ if (typeof device.createShaderModule !== "function")
295
+ return () => { };
296
+ const orig = device.createShaderModule.bind(device);
297
+ device.createShaderModule = function (descriptor) {
298
+ const module = orig(descriptor);
299
+ const info = module.getCompilationInfo ?? module.compilationInfo;
300
+ if (typeof info === "function") {
301
+ void info.call(module).then((result) => {
302
+ if (!isActive() || count >= max)
303
+ return;
304
+ const errors = (result?.messages ?? []).filter((m) => m?.type === "error");
305
+ if (errors.length === 0)
306
+ return;
307
+ count += 1;
308
+ ctx.emit(buildShaderCompileDiagnostic({
309
+ backend: "webgpu",
310
+ captureShaderSource: wantSource,
311
+ infoLog: errors.map((m) => m.message ?? "").join("\n"),
312
+ ...(descriptor?.code ? { source: descriptor.code } : {}),
313
+ }));
314
+ });
315
+ }
316
+ return module;
317
+ };
318
+ return () => {
319
+ device.createShaderModule = orig;
320
+ };
321
+ }
322
+ const DEFAULT_GL_ERROR_INTERVAL_MS = 5000;
323
+ const GL_NO_ERROR = 0;
324
+ /**
325
+ * Opportunistically **sample** `gl.getError()` and emit a rate-limited rollup
326
+ * `graphics_diagnostic` (`category: validation`, ADR 0021 part 2). Runs on a low-rate
327
+ * timer — never per-frame, since `getError()` forces a sync GPU stall (ADR forbids it).
328
+ * Non-`NO_ERROR` results are aggregated into a single `count`ed event flushed on the
329
+ * next tick (and on teardown), so a storm cannot flood ingestion. WebGPU has no
330
+ * `getError`, so passing nothing makes this a clean no-op.
331
+ *
332
+ * Opt-in: no-ops unless `captureGraphicsDiagnostics`. Returns a detach fn that flushes
333
+ * any pending rollup and clears the timer.
334
+ */
335
+ export function wireGlErrorSampling(ctx, gl, isActive, options) {
336
+ if (!ctx.config.captureGraphicsDiagnostics)
337
+ return () => { };
338
+ const intervalMs = options?.intervalMs ?? DEFAULT_GL_ERROR_INTERVAL_MS;
339
+ const rollup = createDiagnosticRollup((n, first) => {
340
+ ctx.emit({
341
+ type: "graphics_diagnostic",
342
+ severity: "warning",
343
+ category: "validation",
344
+ ...(first != null ? { code: `0x${first.toString(16)}` } : {}),
345
+ count: n,
346
+ });
347
+ });
348
+ const sample = () => {
349
+ if (!isActive())
350
+ return;
351
+ // Drain every pending GL error in one go: `getError()` reports one flag at a
352
+ // time, so we loop until NO_ERROR to fold a tick's full backlog into the rollup.
353
+ let code = gl.getError();
354
+ while (code !== GL_NO_ERROR) {
355
+ rollup.record(code);
356
+ code = gl.getError();
357
+ }
358
+ rollup.flush();
359
+ };
360
+ const timer = setInterval(sample, intervalMs);
361
+ return () => {
362
+ clearInterval(timer);
363
+ rollup.stop();
364
+ };
365
+ }
366
+ /**
367
+ * Emit a one-shot context-creation failure as a `graphics_diagnostic`
368
+ * (ADR 0021 part 2, `category: "context-loss"`, `severity: "fatal"`) when a
369
+ * connector cannot obtain a rendering context/adapter at init. Engine-agnostic:
370
+ * every connector reduces its backend-specific check to a {@link ContextCreationProbe}
371
+ * so the gating, length-cap, and event shape live in exactly one place.
372
+ *
373
+ * Behavior:
374
+ * - **Opt-in gate.** No-ops unless `ctx.config.captureGraphicsDiagnostics` is on
375
+ * (mirroring {@link wireGpuDeviceLost}; `context_lost` runtime loss stays
376
+ * always-on, this *creation* case is the richer opt-in diagnostic).
377
+ * - **Discrete marker.** Emits a single incident with no `count`: a creation
378
+ * failure is rare and decisive, so the high-fidelity marker is the right default.
379
+ * - **Backend.** `unknown` when the connector can't determine which API failed
380
+ * (no context means little to introspect).
381
+ * - **Ordering.** Connectors call this at `start()`. The client sets `started`
382
+ * before running collectors, so the marker queues right after `session_start`
383
+ * and is flushed by the normal cadence even though no transport round-trip has
384
+ * happened yet.
385
+ * - **Privacy.** Any `message` is truncated to
386
+ * {@link LIMITS.maxGraphicsDiagnosticMessageLength} and rides `ctx.emit`, which
387
+ * applies the client's `beforeSend` for deployer-owned redaction.
388
+ *
389
+ * @param ctx Collector context (config + `emit`).
390
+ * @param probe The connector's context-creation result. Must not throw; read the
391
+ * engine defensively (optional chaining) and pass `{ failed: false }` on doubt.
392
+ */
393
+ export function wireContextCreationFailure(ctx, probe) {
394
+ if (!ctx.config.captureGraphicsDiagnostics)
395
+ return;
396
+ if (!probe.failed)
397
+ return;
398
+ const message = probe.message
399
+ ? probe.message.slice(0, LIMITS.maxGraphicsDiagnosticMessageLength)
400
+ : undefined;
401
+ ctx.emit({
402
+ type: "graphics_diagnostic",
403
+ severity: "fatal",
404
+ category: "context-loss",
405
+ backend: probe.backend ?? "unknown",
406
+ ...(message ? { message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export { CANONICAL_FRAME, toCanonicalAabb, toCanonicalDirection, toCanonicalPosition, toCanonicalQuat, fromCanonicalAabb, fromCanonicalDirection, fromCanonicalPosition, fromCanonicalQuat, } from "./coordinates.js";
16
16
  export { decomposeWorldMatrix } from "./matrix.js";
17
17
  export type { DecomposedTransform } from "./matrix.js";
18
+ export { createAggregator, collectSnapshotTransferables, percentileAsc, visibilityContribution, aabbClose, roundAabb, vec3Close, poseUnchanged, nodeSampleUnchanged, clamp01, } from "./aggregation/index.js";
19
+ export type { Aggregator, AggregatorConfig, AggregatorOptions, Snapshot, SnapshotChannel, CameraSnapshot, PerfSnapshot, NodeSnapshot, VisibilityMeshObservation, VisibilityTickSnapshot, VisibilityFlushSnapshot, GestureSnapshot, HoverSnapshot, VisibilityContribution, CameraPose, NodeSample, } from "./aggregation/index.js";
18
20
  export { xrSource, xrHandedness } from "./xrInput.js";
21
+ export { wireGpuDeviceLost, wireGpuUncapturedError, wireContextCreationFailure, wireGlShaderDiagnostics, wireGpuShaderDiagnostics, wireGlErrorSampling, buildShaderCompileDiagnostic, createDiagnosticRollup, } from "./graphicsDiagnostics.js";
22
+ export type { GpuDeviceLostLike, GpuDeviceLostInfoLike, WireGpuDeviceLostOptions, GpuErrorLike, GpuDeviceErrorTargetLike, WireGpuUncapturedErrorOptions, ContextCreationProbe, DiagnosticRollup, ShaderDiagnosticsOptions, GlErrorSamplingOptions, WebGlShaderContextLike, WebGpuShaderDeviceLike, WebGlErrorContextLike, } from "./graphicsDiagnostics.js";
19
23
  export type { Collector, CollectorContext, CollectorHandle, BeforeSendHook, EventInput, ResolvedConfig, StartMeta, TrackInputOptions, CapabilityChangeReport, Transport, UptimizrConfig, } from "./types.js";
20
24
  export type { Processor, WorkerLike, WorkerFactory, WorkerProcessorOptions } from "./processor.js";
25
+ export { createMainSink, createWorkerAggregationSink } from "./aggregationSink.js";
26
+ export type { AggregationSink, WorkerAggregationSinkOptions } from "./aggregationSink.js";
21
27
  export type { SampleRate, SamplingProfile, BoneSamplingConfig, NodeSamplingConfig, ResolvedCadence, } from "./sampling.js";
22
28
  export type { CameraGestureSample, ClassifiedGesture, GestureThresholds, GestureClassifyOptions, } from "./gesture.js";
23
29
  export type { XrInputSourceLike, XrCaptureOptions, XrRayHit, XrRayProbe } from "./xrInput.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAClG,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AACjF,OAAO,EACL,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEtD,YAAY,EACV,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,UAAU,EACV,cAAc,EACd,SAAS,EACT,iBAAiB,EACjB,sBAAsB,EACtB,SAAS,EACT,cAAc,GACf,MAAM,YAAY,CAAC;AAEpB,YAAY,EAAE,S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B,YAAY,EACV,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
package/dist/index.js CHANGED
@@ -14,5 +14,8 @@ export { resolveCadence } from "./sampling.js";
14
14
  export { classifyCameraGesture, DEFAULT_GESTURE_THRESHOLDS } from "./gesture.js";
15
15
  export { CANONICAL_FRAME, toCanonicalAabb, toCanonicalDirection, toCanonicalPosition, toCanonicalQuat, fromCanonicalAabb, fromCanonicalDirection, fromCanonicalPosition, fromCanonicalQuat, } from "./coordinates.js";
16
16
  export { decomposeWorldMatrix } from "./matrix.js";
17
+ export { createAggregator, collectSnapshotTransferables, percentileAsc, visibilityContribution, aabbClose, roundAabb, vec3Close, poseUnchanged, nodeSampleUnchanged, clamp01, } from "./aggregation/index.js";
17
18
  export { xrSource, xrHandedness } from "./xrInput.js";
19
+ export { wireGpuDeviceLost, wireGpuUncapturedError, wireContextCreationFailure, wireGlShaderDiagnostics, wireGpuShaderDiagnostics, wireGlErrorSampling, buildShaderCompileDiagnostic, createDiagnosticRollup, } from "./graphicsDiagnostics.js";
20
+ export { createMainSink, createWorkerAggregationSink } from "./aggregationSink.js";
18
21
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAClG,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,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,sBAAsB,EACtB,SAAS,EACT,SAAS,EACT,SAAS,EACT,aAAa,EACb,mBAAmB,EACnB,OAAO,GACR,MAAM,wBAAwB,CAAC;AAmBhC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,0BAA0B,EAC1B,uBAAuB,EACvB,wBAAwB,EACxB,mBAAmB,EACnB,4BAA4B,EAC5B,sBAAsB,GACvB,MAAM,0BAA0B,CAAC;AAgClC,OAAO,EAAE,cAAc,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC"}
@@ -1,17 +1,25 @@
1
1
  import type { CollectRequest } from "@uptimizr/schema";
2
+ import type { AggregatorConfig } from "./aggregation/aggregator.js";
3
+ import type { Snapshot } from "./aggregation/snapshot.js";
4
+ import type { EventInput } from "./types.js";
2
5
  /**
3
6
  * Wire protocol for the opt-in offload worker (ADR 0031).
4
7
  *
5
8
  * These are **type-only** definitions shared by the main-thread processor
6
- * ([`processor.ts`](./processor.ts)) and the worker entry
9
+ * ([`processor.ts`](./processor.ts)), the aggregation sink
10
+ * ([`aggregationSink.ts`](./aggregationSink.ts)) and the worker entry
7
11
  * ([`offloadWorker.ts`](./offloadWorker.ts)). Keeping the protocol in its own
8
12
  * module (with no runtime exports) means the worker bundle pulls in none of the
9
- * processor's runtime code — it stays tiny.
13
+ * main-thread runtime code — it stays tiny.
10
14
  *
11
- * The only thing that crosses the boundary is the plain-data `CollectRequest`
12
- * DTO: by the time a batch reaches the worker it is an array of Zod-shaped plain
13
- * objects with no engine/DOM handles, so it travels by structured clone (or, for
14
- * buffer-backed fields, by transfer).
15
+ * Two roles cross the boundary:
16
+ * - **Transport** (#93–99): a finalized plain-data `CollectRequest` batch travels
17
+ * to the worker to be serialized + dispatched; only an ack comes back.
18
+ * - **Aggregation** (#10): raw plain-number {@link Snapshot} DTOs travel to the
19
+ * worker (high-volume channels by transfer), are aggregated worker-side into
20
+ * finalized {@link EventInput}s, and those come back to the page for the
21
+ * envelope/`beforeSend`/queue/transport machinery — so the unload guarantee
22
+ * (ADR 0031 §5) and `beforeSend` (a main-thread closure) are preserved.
15
23
  */
16
24
  /** Sets the collector URL the worker dispatches to. Sent once at construction. */
17
25
  export interface WorkerInitMessage {
@@ -27,14 +35,50 @@ export interface WorkerBatchMessage {
27
35
  /** The plain-data batch to serialize and send. */
28
36
  batch: CollectRequest;
29
37
  }
38
+ /** Configures the worker-resident aggregator. Sent once at construction. */
39
+ export interface WorkerAggInitMessage {
40
+ type: "aggInit";
41
+ /** Serializable per-channel aggregation config (no callbacks/handles). */
42
+ config: AggregatorConfig;
43
+ }
44
+ /** A raw snapshot DTO to aggregate worker-side (ADR 0031 follow-up, #10). */
45
+ export interface WorkerSnapshotMessage {
46
+ type: "snapshot";
47
+ /** Capture timestamp (epoch ms) stamped on the page; carried onto emitted events. */
48
+ capturedAt: number;
49
+ /** The plain-number snapshot to ingest. */
50
+ snapshot: Snapshot;
51
+ }
52
+ /**
53
+ * Drain barrier for the terminal unload flush (ADR 0031 §5). Because
54
+ * `postMessage` is ordered, by the time the worker echoes this back every prior
55
+ * snapshot's finalized events have already been posted to the page.
56
+ */
57
+ export interface WorkerFlushUnloadMessage {
58
+ type: "flushUnload";
59
+ id: number;
60
+ }
30
61
  /** Messages the main thread sends to the worker. */
31
- export type WorkerInbound = WorkerInitMessage | WorkerBatchMessage;
62
+ export type WorkerInbound = WorkerInitMessage | WorkerBatchMessage | WorkerAggInitMessage | WorkerSnapshotMessage | WorkerFlushUnloadMessage;
32
63
  /** The delivery result for one batch, reported back to the main thread. */
33
64
  export interface WorkerResultMessage {
34
65
  type: "result";
35
66
  id: number;
36
67
  ok: boolean;
37
68
  }
69
+ /** Finalized events produced by the worker-resident aggregator (#10). */
70
+ export interface WorkerEventsMessage {
71
+ type: "events";
72
+ /** The `capturedAt` of the snapshot that produced these events (for `ts`). */
73
+ capturedAt: number;
74
+ /** Finalized, envelope-less events to emit on the page. */
75
+ events: EventInput[];
76
+ }
77
+ /** Ack that the unload drain barrier has been reached (#10). */
78
+ export interface WorkerUnloadDoneMessage {
79
+ type: "unloadDone";
80
+ id: number;
81
+ }
38
82
  /** Messages the worker sends back to the main thread. */
39
- export type WorkerOutbound = WorkerResultMessage;
83
+ export type WorkerOutbound = WorkerResultMessage | WorkerEventsMessage | WorkerUnloadDoneMessage;
40
84
  //# sourceMappingURL=offloadProtocol.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"offloadProtocol.d.ts","sourceRoot":"","sources":["../src/offloadProtocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD;;;;;;;;;;;;;GAaG;AAEH,kFAAkF;AAClF,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,GAAG,EAAE,MAAM,CAAC;CACb;AAED,6DAA6D;AAC7D,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,mEAAmE;IACnE,EAAE,EAAE,MAAM,CAAC;IACX,kDAAkD;IAClD,KAAK,EAAE,cAAc,CAAC;CACvB;AAED,oDAAoD;AACpD,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,kBAAkB,CAAC;AAEnE,2EAA2E;AAC3E,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,QAAQ,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,OAAO,CAAC;CACb;AAED,yDAAyD;AACzD,MAAM,MAAM,cAAc,GAAG,mBAAmB,CAAC"}
1
+ {"version":3,"file":"offloadProtocol.d.ts","sourceRoot":"","sources":["../src/offloadProtocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,EAAE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ACtB;AAED,gEAAgE;AAChE,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,YAAY,CAAC;IACnB,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,yDAAyD;AACzD,MAAM,MAAM,cAAc,GAAG,mBAAmB,GAAG,mBAAmB,GAAG,uBAAuB,CAAC"}
@@ -1,18 +1,50 @@
1
+ import { createAggregator } from "./aggregation/aggregator.js";
1
2
  // The build uses the DOM lib (not WebWorker), so narrow `self` structurally.
2
3
  const scope = self;
3
4
  /** Resolved collector URL, set by the `init` message before any batch arrives. */
4
5
  let collectUrl = "";
6
+ /** Worker-resident aggregator, created on `aggInit`. Buffers events per ingest. */
7
+ let aggregator;
8
+ let eventBuffer = [];
5
9
  scope.addEventListener("message", (event) => {
6
10
  const message = event.data;
7
11
  if (!message) {
8
12
  return;
9
13
  }
10
- if (message.type === "init") {
11
- collectUrl = message.url;
12
- return;
13
- }
14
- if (message.type === "batch") {
15
- void dispatch(message.id, message.batch);
14
+ switch (message.type) {
15
+ case "init":
16
+ collectUrl = message.url;
17
+ return;
18
+ case "batch":
19
+ void dispatch(message.id, message.batch);
20
+ return;
21
+ case "aggInit":
22
+ aggregator = createAggregator({
23
+ ...message.config,
24
+ emit: (e) => eventBuffer.push(e),
25
+ });
26
+ return;
27
+ case "snapshot": {
28
+ if (!aggregator)
29
+ return;
30
+ eventBuffer = [];
31
+ aggregator.ingest(message.snapshot);
32
+ if (eventBuffer.length > 0) {
33
+ const out = {
34
+ type: "events",
35
+ capturedAt: message.capturedAt,
36
+ events: eventBuffer,
37
+ };
38
+ eventBuffer = [];
39
+ scope.postMessage(out);
40
+ }
41
+ return;
42
+ }
43
+ case "flushUnload": {
44
+ const done = { type: "unloadDone", id: message.id };
45
+ scope.postMessage(done);
46
+ return;
47
+ }
16
48
  }
17
49
  });
18
50
  /** Serialize and POST one batch, then report the outcome back to the page. */
@@ -37,5 +69,4 @@ async function dispatch(id, batch) {
37
69
  const result = { type: "result", id, ok };
38
70
  scope.postMessage(result);
39
71
  }
40
- export {};
41
72
  //# sourceMappingURL=offloadWorker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"offloadWorker.js","sourceRoot":"","sources":["../src/offloadWorker.ts"],"names":[],"mappings":"AAuBA,6EAA6E;AAC7E,MAAM,KAAK,GAAG,IAA8B,CAAC;AAE7C,kFAAkF;AAClF,IAAI,UAAU,GAAG,EAAE,CAAC;AAEpB,KAAK,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;IAC1C,MAAM,OAAO,GAAG,KAAK,CAAC,IAAiC,CAAC;IACxD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO;IACT,CAAC;IACD,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QAC5B,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC;QACzB,OAAO;IACT,CAAC;IACD,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC7B,KAAK,QAAQ,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,8EAA8E;AAC9E,KAAK,UAAU,QAAQ,CAAC,EAAU,EAAE,KAAc;IAChD,IAAI,EAAE,GAAG,KAAK,CAAC;IACf,IAAI,CAAC;QACH,IAAI,UAAU,EAAE,CAAC;YACf,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YACnC,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,UAAU,EAAE;gBACxC,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;gBAC/C,IAAI;gBACJ,yEAAyE;gBACzE,SAAS,EAAE,IAAI,CAAC,MAAM,GAAG,MAAM;aAChC,CAAC,CAAC;YACH,EAAE,GAAG,GAAG,CAAC,EAAE,CAAC;QACd,CAAC;IACH,CAAC;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,CAAC;IAC/D,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC"}
@@ -88,6 +88,8 @@ export interface WorkerProcessorOptions {
88
88
  * channels that opt in must own a fresh buffer per batch.
89
89
  */
90
90
  export declare function collectTransferables(batch: CollectRequest): Transferable[];
91
+ /** Default factory: a module worker shipped alongside the SDK in `dist/`. */
92
+ export declare function defaultWorkerFactory(): WorkerLike;
91
93
  /**
92
94
  * Create a worker-backed processor that runs steady-state serialization +
93
95
  * dispatch off the main thread (ADR 0031). Returns `null` when a worker cannot