@spatius/avatarkit 1.3.1-beta.3 → 1.3.1-beta.5

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.
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Internal telemetry surface for the companion RTC SDK.
3
+ *
4
+ * `@spatius/avatarkit-rtc` reports into the same OpenObserve backend and shares
5
+ * this SDK's OTel providers, so its spans must sit on the same calibrated
6
+ * timeline. Without that, a client whose wall clock is off puts RTC spans at a
7
+ * time that does not line up with the server-side records they need to be read
8
+ * against.
9
+ *
10
+ * Deliberately NOT re-exported from the package root: this is a bridge between
11
+ * two first-party packages, not API for integrators. It exposes conversion only
12
+ * — nothing here can alter the clock baseline.
13
+ *
14
+ * NOTE: nothing in this file may be tagged `@internal`. The dts plugin runs with
15
+ * `stripInternal: true`, which erases such declarations from the emitted `.d.ts`
16
+ * — the entry would still export both functions at runtime while shipping an
17
+ * empty `export {}` type file, leaving the RTC package with no types.
18
+ *
19
+ * @packageDocumentation
20
+ */
21
+ /**
22
+ * Convert a `performance.now()` reading taken earlier into a timeline
23
+ * timestamp (epoch ms), preferring the server-calibrated baseline and falling
24
+ * back to the local clock until calibration completes.
25
+ *
26
+ * Collect marks on the monotonic clock and convert at report time: the wall
27
+ * clock and `performance.now()` drift apart while the main thread is blocked,
28
+ * and calibration may not have finished when the mark was taken.
29
+ *
30
+ * @param mono - the `performance.now()` value recorded at collection time
31
+ */
32
+ export declare function resolveMonoTimestamp(mono: number): number;
33
+ /**
34
+ * Whether clock calibration against the backend has completed. Timestamps
35
+ * resolve either way; this only reports whether they are server-aligned yet.
36
+ */
37
+ export declare function isClockCalibrated(): boolean;
@@ -0,0 +1,45 @@
1
+ import { h as clockSync } from "./logger-C61wOfFi.js";
2
+ //#region internal-telemetry.ts
3
+ /**
4
+ * Internal telemetry surface for the companion RTC SDK.
5
+ *
6
+ * `@spatius/avatarkit-rtc` reports into the same OpenObserve backend and shares
7
+ * this SDK's OTel providers, so its spans must sit on the same calibrated
8
+ * timeline. Without that, a client whose wall clock is off puts RTC spans at a
9
+ * time that does not line up with the server-side records they need to be read
10
+ * against.
11
+ *
12
+ * Deliberately NOT re-exported from the package root: this is a bridge between
13
+ * two first-party packages, not API for integrators. It exposes conversion only
14
+ * — nothing here can alter the clock baseline.
15
+ *
16
+ * NOTE: nothing in this file may be tagged `@internal`. The dts plugin runs with
17
+ * `stripInternal: true`, which erases such declarations from the emitted `.d.ts`
18
+ * — the entry would still export both functions at runtime while shipping an
19
+ * empty `export {}` type file, leaving the RTC package with no types.
20
+ *
21
+ * @packageDocumentation
22
+ */
23
+ /**
24
+ * Convert a `performance.now()` reading taken earlier into a timeline
25
+ * timestamp (epoch ms), preferring the server-calibrated baseline and falling
26
+ * back to the local clock until calibration completes.
27
+ *
28
+ * Collect marks on the monotonic clock and convert at report time: the wall
29
+ * clock and `performance.now()` drift apart while the main thread is blocked,
30
+ * and calibration may not have finished when the mark was taken.
31
+ *
32
+ * @param mono - the `performance.now()` value recorded at collection time
33
+ */
34
+ function resolveMonoTimestamp(mono) {
35
+ return clockSync.resolveMono(mono);
36
+ }
37
+ /**
38
+ * Whether clock calibration against the backend has completed. Timestamps
39
+ * resolve either way; this only reports whether they are server-aligned yet.
40
+ */
41
+ function isClockCalibrated() {
42
+ return clockSync.isReady();
43
+ }
44
+ //#endregion
45
+ export { isClockCalibrated, resolveMonoTimestamp };